diff options
author | 2022-06-23 15:12:46 +0000 | |
---|---|---|
committer | 2022-06-23 15:12:46 +0000 | |
commit | 059d00bd5d4bd2b64cb7d321d1ebf9c1ba44c625 (patch) | |
tree | 9b0d289c9fb3df8dd50eff8f6176f8117c0f6084 /packages/integrations/svelte | |
parent | 7373d61cdcaedd64bf5fd60521b157cfa4343558 (diff) | |
download | astro-059d00bd5d4bd2b64cb7d321d1ebf9c1ba44c625.tar.gz astro-059d00bd5d4bd2b64cb7d321d1ebf9c1ba44c625.tar.zst astro-059d00bd5d4bd2b64cb7d321d1ebf9c1ba44c625.zip |
[ci] format
Diffstat (limited to 'packages/integrations/svelte')
-rw-r--r-- | packages/integrations/svelte/client.js | 19 | ||||
-rw-r--r-- | packages/integrations/svelte/server.js | 3 |
2 files changed, 13 insertions, 9 deletions
diff --git a/packages/integrations/svelte/client.js b/packages/integrations/svelte/client.js index 36a8e8de1..c8c252eaa 100644 --- a/packages/integrations/svelte/client.js +++ b/packages/integrations/svelte/client.js @@ -11,10 +11,10 @@ export default (target) => { try { new Component({ target, - props: { + props: { ...props, $$slots: slots, - $$scope: { ctx: [] } + $$scope: { ctx: [] }, }, hydrate: client !== 'only', $$inline: true, @@ -24,11 +24,14 @@ export default (target) => { }; function createSlotDefinition(key, children) { - return [ - () => ({ + return [ + () => ({ // mount m(target) { - target.insertAdjacentHTML('beforeend', `<astro-slot${key === 'default' ? '' : ` name="${key}"`}>${children}</astro-slot>`) + target.insertAdjacentHTML( + 'beforeend', + `<astro-slot${key === 'default' ? '' : ` name="${key}"`}>${children}</astro-slot>` + ); }, // create c: noop, @@ -37,7 +40,7 @@ function createSlotDefinition(key, children) { // destroy d: noop, }), - noop, - noop, - ] + noop, + noop, + ]; } diff --git a/packages/integrations/svelte/server.js b/packages/integrations/svelte/server.js index 7a5610b4a..98ece3314 100644 --- a/packages/integrations/svelte/server.js +++ b/packages/integrations/svelte/server.js @@ -5,7 +5,8 @@ function check(Component) { async function renderToStaticMarkup(Component, props, slotted) { const slots = {}; for (const [key, value] of Object.entries(slotted)) { - slots[key] = () => `<astro-slot${key === 'default' ? '' : ` name="${key}"`}>${value}</astro-slot>`; + slots[key] = () => + `<astro-slot${key === 'default' ? '' : ` name="${key}"`}>${value}</astro-slot>`; } const { html } = Component.render(props, { $$slots: slots }); return { html }; |