const noop = () => {}; export default (target) => { return (Component, props, slotted, { client }) => { if (!target.hasAttribute('ssr')) return; const slots = {}; for (const [key, value] of Object.entries(slotted)) { slots[key] = createSlotDefinition(key, value); } try { new Component({ target, props: { ...props, $$slots: slots, $$scope: { ctx: [] }, }, hydrate: client !== 'only', $$inline: true, }); } catch (e) {} }; }; function createSlotDefinition(key, children) { let parent; return [ () => ({ // mount m(target) { parent = target; target.insertAdjacentHTML( 'beforeend', `${children}` ); }, // create c: noop, // hydrate l: noop, // destroy d() { if (!parent) return; const slot = parent.querySelector( `astro-slot${key === 'default' ? ':not([name])' : `[name="${key}"]`}` ); if (slot) slot.remove(); }, }), noop, noop, ]; } on> Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/examples/docs/public/make-scrollable-code-focusable.js (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2023-01-12 Add `.astro/` to `.gitignore` in example projects (#5841)Gravatar Chris Swithinbank 24-98/+46
* Delete committed types in with-content example * Add `.astro/` to `.gitignore` in example projects
2023-01-12chore: update changeset for `_astro` directory (#5843)Gravatar Nate Moore 1-2/+2
Co-authored-by: Nate Moore <nate@astro.build>
2023-01-12fix: pass flags to dev (#5840)Gravatar Sam Chen 3-1/+9
* fix: pass flags to dev * add changeset * Update .changeset/eleven-bulldogs-provide.md Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-01-12chore: update changelogs, add changeset for `_astro` directory (#5842)Gravatar Nate Moore 5-18/+10
Co-authored-by: Nate Moore <nate@astro.build>
2023-01-12[ci] formatGravatar natemoo-re 1-1/+1
2023-01-12fix(core): handle encoded characters when matching routes (#5836)Gravatar Nate Moore 8-2/+85
Co-authored-by: Nate Moore <nate@astro.build>
2023-01-12Handle compiler breaking change (#5803)Gravatar Bjorn Lu 12-328/+109
2023-01-12fix shiki css class replace logic in md and mdx integrations (#5837)Gravatar Giuseppe La Torre 3-3/+9
2023-01-11[ci] formatGravatar matthewp 2-2/+2
2023-01-11Simplify HMR handling (#5811)Gravatar Bjorn Lu 8-108/+46
* Simplify HMR handling * Try skip test to reveal other test result * Support virtual files * Fix head injection * Revert CI changes * Bring back normalizeFilename * Refactor * Add changeset
2023-01-11[Content collections] Remove experimental flag (#5825)Gravatar Ben Holmes 27-103/+58
* refactor: remove experimental.cc from core * chore: remove experimental flag from tests * fix: mock contentDir in remark tests * fix: check vfile.path in rel-image-error plugin * fix: move .astro/ excludes to all test/fixtures * fix: include test/**/fixtures in ignore * chore: changeset
2023-01-11[Content collections] Improve content config handling (#5824)Gravatar Ben Holmes 5-58/+78
* fix: always generate types on init * fix: skip type generation when no content dir found * fix: avoid stripping `.ts` for existsSync check * chore: changeset * fix: run type gen when content/ dir added in dev
2023-01-11Run sync as part of `astro check` (#5823)Gravatar Chris Swithinbank 3-2/+13
Co-authored-by: Ben Holmes <hey@bholmes.dev>
2023-01-11[ci] update lockfile (#5815)Gravatar Fred K. Bot 1-257/+256
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2023-01-11Fix order-of-execution bug when generating pages (#5822)Gravatar Nate Moore 2-2/+7
* fix: bundle all pages into a single chunk * chore: add changeset Co-authored-by: Nate Moore <nate@astro.build>
2023-01-11Fix `Code.astro` shiki css class replace logic (#5829)Gravatar Giuseppe La Torre 2-1/+6