mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
[ci] format
This commit is contained in:
parent
6fd3d5960f
commit
4a35c505e4
2 changed files with 17 additions and 18 deletions
|
@ -10,7 +10,6 @@ export default (element) => {
|
|||
let $$slots = undefined;
|
||||
let renderFns = {};
|
||||
|
||||
|
||||
for (const [key, value] of Object.entries(slotted)) {
|
||||
// Legacy slot support
|
||||
$$slots ??= {};
|
||||
|
@ -25,15 +24,15 @@ export default (element) => {
|
|||
}));
|
||||
}
|
||||
// @render support for Svelte ^5.0
|
||||
if (key === 'default') {
|
||||
renderFns.children = createRawSnippet(() => ({
|
||||
render: () => `<astro-slot>${value}</astro-slot>`
|
||||
}));
|
||||
} else {
|
||||
renderFns[key] = createRawSnippet(() => ({
|
||||
render: () => `<astro-slot name="${key}">${value}</astro-slot>`
|
||||
}));
|
||||
}
|
||||
if (key === 'default') {
|
||||
renderFns.children = createRawSnippet(() => ({
|
||||
render: () => `<astro-slot>${value}</astro-slot>`,
|
||||
}));
|
||||
} else {
|
||||
renderFns[key] = createRawSnippet(() => ({
|
||||
render: () => `<astro-slot name="${key}">${value}</astro-slot>`,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
const bootstrap = client !== 'only' ? hydrate : mount;
|
||||
|
@ -42,7 +41,7 @@ export default (element) => {
|
|||
...props,
|
||||
children,
|
||||
$$slots,
|
||||
...renderFns
|
||||
...renderFns,
|
||||
});
|
||||
} else {
|
||||
const component = bootstrap(Component, {
|
||||
|
@ -51,7 +50,7 @@ export default (element) => {
|
|||
...props,
|
||||
children,
|
||||
$$slots,
|
||||
...renderFns
|
||||
...renderFns,
|
||||
},
|
||||
});
|
||||
existingApplications.set(element, component);
|
||||
|
|
|
@ -18,7 +18,7 @@ async function renderToStaticMarkup(Component, props, slotted, metadata) {
|
|||
let children = undefined;
|
||||
let $$slots = undefined;
|
||||
const renderProps = {};
|
||||
|
||||
|
||||
for (const [key, value] of Object.entries(slotted)) {
|
||||
// Legacy slot support
|
||||
$$slots ??= {};
|
||||
|
@ -33,10 +33,10 @@ async function renderToStaticMarkup(Component, props, slotted, metadata) {
|
|||
}));
|
||||
}
|
||||
// @render support for Svelte ^5.0
|
||||
const slotName = key === 'default' ? 'children' : key;
|
||||
renderProps[slotName] = createRawSnippet(() => ({
|
||||
render: () => `<${tagName}${key !== 'default' ? ` name="${key}"` : ''}>${value}</${tagName}>`
|
||||
}));
|
||||
const slotName = key === 'default' ? 'children' : key;
|
||||
renderProps[slotName] = createRawSnippet(() => ({
|
||||
render: () => `<${tagName}${key !== 'default' ? ` name="${key}"` : ''}>${value}</${tagName}>`,
|
||||
}));
|
||||
}
|
||||
|
||||
const result = render(Component, {
|
||||
|
@ -44,7 +44,7 @@ async function renderToStaticMarkup(Component, props, slotted, metadata) {
|
|||
...props,
|
||||
children,
|
||||
$$slots,
|
||||
...renderProps
|
||||
...renderProps,
|
||||
},
|
||||
});
|
||||
return { html: result.body };
|
||||
|
|
Loading…
Reference in a new issue