Comparing version 5.0.0-next.260 to 5.0.0-next.262
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.0.0-next.260", | ||
"version": "5.0.0-next.262", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "./types/index.d.ts", |
@@ -26,4 +26,2 @@ /** | ||
* ``` | ||
* | ||
* Docs: https://svelte.dev/docs/svelte-action | ||
*/ | ||
@@ -58,4 +56,2 @@ export interface ActionReturn< | ||
* See interface `ActionReturn` for more details. | ||
* | ||
* Docs: https://svelte.dev/docs/svelte-action | ||
*/ | ||
@@ -62,0 +58,0 @@ export interface Action< |
@@ -8,3 +8,2 @@ /** @import { FlipParams, AnimationConfig } from './public.js' */ | ||
* | ||
* https://svelte.dev/docs/svelte-animate#flip | ||
* @param {Element} node | ||
@@ -11,0 +10,0 @@ * @param {{ from: DOMRect; to: DOMRect }} fromTo |
@@ -18,3 +18,2 @@ /** @import { LegacyRoot } from './types/legacy-nodes.js' */ | ||
* | ||
* https://svelte.dev/docs/svelte-compiler#svelte-compile | ||
* @param {string} source The component source code | ||
@@ -58,3 +57,2 @@ * @param {CompileOptions} options The compiler options | ||
* | ||
* https://svelte.dev/docs/svelte-compiler#svelte-compile | ||
* @param {string} source The component source code | ||
@@ -79,3 +77,2 @@ * @param {ModuleCompileOptions} options | ||
* | ||
* https://svelte.dev/docs/svelte-compiler#svelte-parse | ||
* @overload | ||
@@ -93,3 +90,2 @@ * @param {string} source | ||
* | ||
* https://svelte.dev/docs/svelte-compiler#svelte-parse | ||
* @overload | ||
@@ -107,3 +103,2 @@ * @param {string} source | ||
* | ||
* https://svelte.dev/docs/svelte-compiler#svelte-parse | ||
* @param {string} source | ||
@@ -110,0 +105,0 @@ * @param {{ filename?: string; rootDir?: string; modern?: boolean }} [options] |
/** @import { VariableDeclarator, Node, Identifier } from 'estree' */ | ||
/** @import { Visitors } from 'zimmerframe' */ | ||
/** @import { ComponentAnalysis } from '../phases/types.js' */ | ||
/** @import { Scope } from '../phases/scope.js' */ | ||
/** @import { Scope, ScopeRoot } from '../phases/scope.js' */ | ||
/** @import { AST, Binding, SvelteNode, ValidatedCompileOptions } from '#compiler' */ | ||
@@ -9,2 +9,3 @@ import MagicString from 'magic-string'; | ||
import { parse } from '../phases/1-parse/index.js'; | ||
import { regex_valid_component_name } from '../phases/1-parse/state/element.js'; | ||
import { analyze_component } from '../phases/2-analyze/index.js'; | ||
@@ -16,2 +17,3 @@ import { get_rune } from '../phases/scope.js'; | ||
import { validate_component_options } from '../validate-options.js'; | ||
import { is_svg, is_void } from '../../utils.js'; | ||
@@ -57,2 +59,4 @@ const regex_style_tags = /(<style[^>]+>)([\S\s]*?)(<\/style>)/g; | ||
str.replaceAll(/(<svelte:options\s.*?\s?)accessors\s?/g, (_, $1) => $1); | ||
for (const content of style_contents) { | ||
@@ -91,3 +95,4 @@ str.overwrite(content[0], content[0] + style_placeholder.length, content[1]); | ||
legacy_imports: new Set(), | ||
script_insertions: new Set() | ||
script_insertions: new Set(), | ||
derived_components: new Map() | ||
}; | ||
@@ -109,2 +114,18 @@ | ||
let insertion_point = parsed.instance | ||
? /** @type {number} */ (parsed.instance.content.start) | ||
: 0; | ||
const need_script = | ||
state.legacy_imports.size > 0 || | ||
state.derived_components.size > 0 || | ||
state.script_insertions.size > 0 || | ||
state.props.length > 0 || | ||
analysis.uses_rest_props || | ||
analysis.uses_props; | ||
if (!parsed.instance && need_script) { | ||
str.appendRight(0, '<script>'); | ||
} | ||
const specifiers = [...state.legacy_imports].map((imported) => { | ||
@@ -115,5 +136,17 @@ const local = state.names[imported]; | ||
const legacy_import = `import { ${specifiers.join(', ')} } from 'svelte/legacy';`; | ||
let added_legacy_import = false; | ||
const legacy_import = `import { ${specifiers.join(', ')} } from 'svelte/legacy';\n`; | ||
if (state.legacy_imports.size > 0) { | ||
str.appendRight(insertion_point, `\n${indent}${legacy_import}`); | ||
} | ||
if (state.script_insertions.size > 0) { | ||
str.appendRight( | ||
insertion_point, | ||
`\n${indent}${[...state.script_insertions].join(`\n${indent}`)}` | ||
); | ||
} | ||
insertion_point = state.props_insertion_point; | ||
if (state.props.length > 0 || analysis.uses_rest_props || analysis.uses_props) { | ||
@@ -128,2 +161,3 @@ const has_many_props = state.props.length > 3; | ||
props = state.props | ||
.filter((prop) => !prop.type_only) | ||
.map((prop) => { | ||
@@ -148,3 +182,3 @@ let prop_str = | ||
// some render tags or forwarded event attributes to add | ||
str.appendRight(state.props_insertion_point, ` ${props},`); | ||
str.appendRight(insertion_point, ` ${props},`); | ||
} else { | ||
@@ -188,16 +222,4 @@ const uses_ts = parsed.instance?.attributes.some( | ||
if (parsed.instance) { | ||
props_declaration = `\n${indent}${props_declaration}`; | ||
str.appendRight(state.props_insertion_point, props_declaration); | ||
} else { | ||
const imports = state.legacy_imports.size > 0 ? `${indent}${legacy_import}\n` : ''; | ||
const script_insertions = | ||
state.script_insertions.size > 0 | ||
? `\n${indent}${[...state.script_insertions].join(`\n${indent}`)}` | ||
: ''; | ||
str.prepend( | ||
`<script>\n${imports}${indent}${props_declaration}${script_insertions}\n</script>\n\n` | ||
); | ||
added_legacy_import = true; | ||
} | ||
props_declaration = `\n${indent}${props_declaration}`; | ||
str.appendRight(insertion_point, props_declaration); | ||
} | ||
@@ -229,3 +251,5 @@ } | ||
!ids.includes(dep) && | ||
/** @type {number} */ (dep.node.start) > /** @type {number} */ (node.start) | ||
(dep.kind === 'prop' || dep.kind === 'bindable_prop' | ||
? state.props_insertion_point | ||
: /** @type {number} */ (dep.node.start)) > /** @type {number} */ (node.start) | ||
) | ||
@@ -248,20 +272,23 @@ ) { | ||
if (state.legacy_imports.size > 0 && !added_legacy_import) { | ||
const script_insertions = | ||
state.script_insertions.size > 0 | ||
? `\n${indent}${[...state.script_insertions].join(`\n${indent}`)}` | ||
: ''; | ||
insertion_point = parsed.instance | ||
? /** @type {number} */ (parsed.instance.content.end) | ||
: insertion_point; | ||
if (parsed.instance) { | ||
str.appendRight( | ||
/** @type {number} */ (parsed.instance.content.start), | ||
`\n${indent}${legacy_import}${script_insertions}\n` | ||
); | ||
} else { | ||
str.prepend( | ||
`<script>\n${indent}${legacy_import}\n${indent}${script_insertions}\n</script>\n\n` | ||
); | ||
} | ||
if (state.derived_components.size > 0) { | ||
str.appendRight( | ||
insertion_point, | ||
`\n${indent}${[...state.derived_components.entries()].map(([init, name]) => `const ${name} = $derived(${init});`).join(`\n${indent}`)}\n` | ||
); | ||
} | ||
if (state.props.length > 0 && state.analysis.accessors) { | ||
str.appendRight( | ||
insertion_point, | ||
`\n${indent}export {${state.props.reduce((acc, prop) => (prop.slot_name || prop.type_only ? acc : `${acc}\n${indent}\t${prop.local},`), '')}\n${indent}}\n` | ||
); | ||
} | ||
if (!parsed.instance && need_script) { | ||
str.appendRight(insertion_point, '\n</script>\n\n'); | ||
} | ||
return { code: str.toString() }; | ||
@@ -281,3 +308,3 @@ } catch (e) { | ||
* indent: string; | ||
* props: Array<{ local: string; exported: string; init: string; bindable: boolean; slot_name?: string; optional: boolean; type: string; comment?: string }>; | ||
* props: Array<{ local: string; exported: string; init: string; bindable: boolean; slot_name?: string; optional: boolean; type: string; comment?: string, type_only?: boolean }>; | ||
* props_insertion_point: number; | ||
@@ -288,3 +315,4 @@ * has_props_rune: boolean; | ||
* legacy_imports: Set<string>; | ||
* script_insertions: Set<string> | ||
* script_insertions: Set<string>; | ||
* derived_components: Map<string, string> | ||
* }} State | ||
@@ -419,2 +447,3 @@ */ | ||
prop.exported = binding.prop_alias || name; | ||
prop.type_only = false; | ||
} else { | ||
@@ -577,2 +606,11 @@ state.props.push({ | ||
handle_events(node, state); | ||
// Strip off any namespace from the beginning of the node name. | ||
const node_name = node.name.replace(/[a-zA-Z-]*:/g, ''); | ||
if (state.analysis.source[node.end - 2] === '/' && !is_void(node_name) && !is_svg(node_name)) { | ||
let trimmed_position = node.end - 2; | ||
while (state.str.original.charAt(trimmed_position - 1) === ' ') trimmed_position--; | ||
state.str.remove(trimmed_position, node.end - 1); | ||
state.str.appendRight(node.end, `</${node.name}>`); | ||
} | ||
next(); | ||
@@ -604,2 +642,70 @@ }, | ||
}, | ||
SvelteComponent(node, { state, next, path }) { | ||
next(); | ||
let expression = state.str | ||
.snip( | ||
/** @type {number} */ (node.expression.start), | ||
/** @type {number} */ (node.expression.end) | ||
) | ||
.toString(); | ||
if ( | ||
(node.expression.type !== 'Identifier' && node.expression.type !== 'MemberExpression') || | ||
!regex_valid_component_name.test(expression) | ||
) { | ||
let current_expression = expression; | ||
expression = state.scope.generate('SvelteComponent'); | ||
let needs_derived = true; | ||
for (let i = path.length - 1; i >= 0; i--) { | ||
const part = path[i]; | ||
if ( | ||
part.type === 'EachBlock' || | ||
part.type === 'AwaitBlock' || | ||
part.type === 'IfBlock' || | ||
part.type === 'SnippetBlock' || | ||
part.type === 'Component' || | ||
part.type === 'SvelteComponent' | ||
) { | ||
let position = node.start; | ||
if (i !== path.length - 1) { | ||
for (let modifier = 1; modifier < path.length - i; modifier++) { | ||
const path_part = path[i + modifier]; | ||
if ('start' in path_part) { | ||
position = /** @type {number} */ (path_part.start); | ||
break; | ||
} | ||
} | ||
} | ||
const indent = state.str.original.substring( | ||
state.str.original.lastIndexOf('\n', position) + 1, | ||
position | ||
); | ||
state.str.prependLeft( | ||
position, | ||
`{@const ${expression} = ${current_expression}}\n${indent}` | ||
); | ||
needs_derived = false; | ||
break; | ||
} | ||
} | ||
if (needs_derived) { | ||
if (state.derived_components.has(current_expression)) { | ||
expression = /** @type {string} */ (state.derived_components.get(current_expression)); | ||
} else { | ||
state.derived_components.set(current_expression, expression); | ||
} | ||
} | ||
} | ||
state.str.overwrite(node.start + 1, node.start + node.name.length + 1, expression); | ||
if (state.str.original.substring(node.end - node.name.length - 1, node.end - 1) === node.name) { | ||
state.str.overwrite(node.end - node.name.length - 1, node.end - 1, expression); | ||
} | ||
let this_pos = state.str.original.lastIndexOf('this', node.expression.start); | ||
while (!state.str.original.charAt(this_pos - 1).trim()) this_pos--; | ||
const end_pos = state.str.original.indexOf('}', node.expression.end) + 1; | ||
state.str.remove(this_pos, end_pos); | ||
}, | ||
SvelteWindow(node, { state, next }) { | ||
@@ -863,18 +969,2 @@ handle_events(node, state); | ||
/** | ||
* @param {AST.OnDirective} last | ||
* @param {State} state | ||
*/ | ||
function generate_event_name(last, state) { | ||
const scope = | ||
(last.expression && state.analysis.template.scopes.get(last.expression)) || state.scope; | ||
let name = 'event'; | ||
if (!scope.get(name)) return name; | ||
let i = 1; | ||
while (scope.get(`${name}${i}`)) i += 1; | ||
return `${name}${i}`; | ||
} | ||
/** | ||
* @param {Identifier} node | ||
@@ -950,3 +1040,4 @@ * @param {State} state | ||
type, | ||
comment | ||
comment, | ||
type_only: true | ||
}); | ||
@@ -953,0 +1044,0 @@ } |
@@ -354,7 +354,3 @@ /** @import { AST, Css, Directive } from '#compiler' */ | ||
if (combinator) { | ||
if (relative_selector.selectors.length === 0) { | ||
if (!inside_pseudo_class) { | ||
e.css_selector_invalid(start); | ||
} | ||
} else { | ||
if (relative_selector.selectors.length > 0) { | ||
relative_selector.end = index; | ||
@@ -361,0 +357,0 @@ children.push(relative_selector); |
@@ -26,3 +26,3 @@ /** @import { Expression } from 'estree' */ | ||
/^(?:![a-zA-Z]+|[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|[a-zA-Z][a-zA-Z0-9]*:[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9])$/; | ||
const regex_valid_component_name = | ||
export const regex_valid_component_name = | ||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#identifiers adjusted for our needs | ||
@@ -29,0 +29,0 @@ // (must start with uppercase letter if no dots, can contain dots) |
@@ -117,4 +117,28 @@ /** @import { ComponentAnalysis } from '../../types.js' */ | ||
); | ||
if ( | ||
node.metadata.rule?.metadata.parent_rule && | ||
node.children[0]?.selectors[0]?.type === 'NestingSelector' | ||
) { | ||
const parent_is_global = node.metadata.rule.metadata.parent_rule.prelude.children.some( | ||
(child) => child.children.length === 1 && child.children[0].metadata.is_global | ||
); | ||
// mark `&:hover` in `:global(.foo) { &:hover { color: green }}` as used | ||
if (parent_is_global) { | ||
node.metadata.used = true; | ||
} | ||
} | ||
}, | ||
RelativeSelector(node, context) { | ||
const parent = /** @type {Css.ComplexSelector} */ (context.path.at(-1)); | ||
if ( | ||
node.combinator != null && | ||
!context.state.rule?.metadata.parent_rule && | ||
parent.children[0] === node && | ||
context.path.at(-3)?.type !== 'PseudoClassSelector' | ||
) { | ||
e.css_selector_invalid(node.combinator); | ||
} | ||
node.metadata.is_global = node.selectors.length >= 1 && is_global(node); | ||
@@ -121,0 +145,0 @@ |
@@ -15,3 +15,5 @@ /** @import { AST } from '#compiler' */ | ||
context.visit(node.expression); | ||
visit_component(node, context); | ||
} |
@@ -279,2 +279,6 @@ /** @import * as ESTree from 'estree' */ | ||
if (binding?.kind === 'prop' || binding?.kind === 'bindable_prop') { | ||
return [getter, b.set(alias ?? name, [b.stmt(b.call(name, b.id('$$value')))])]; | ||
} | ||
if (binding?.kind === 'state' || binding?.kind === 'raw_state') { | ||
@@ -281,0 +285,0 @@ const value = binding.kind === 'state' ? b.call('$.proxy', b.id('$$value')) : b.id('$$value'); |
@@ -48,5 +48,3 @@ /** @import { BlockStatement, Expression, ExpressionStatement, Identifier, MemberExpression, Property, Statement } from 'estree' */ | ||
/** | ||
* @type {ExpressionStatement[]} | ||
*/ | ||
/** @type {ExpressionStatement[]} */ | ||
const binding_initializers = []; | ||
@@ -220,2 +218,5 @@ | ||
/** @type {import('estree').Property[]} */ | ||
const serialized_slots = []; | ||
// Group children by slot | ||
@@ -234,2 +235,5 @@ for (const child of node.fragment.nodes) { | ||
// Interop: allows people to pass snippets when component still uses slots | ||
serialized_slots.push(b.init(child.expression.name, b.true)); | ||
continue; | ||
@@ -244,4 +248,2 @@ } | ||
// Serialize each slot | ||
/** @type {Property[]} */ | ||
const serialized_slots = []; | ||
for (const slot_name of Object.keys(children)) { | ||
@@ -248,0 +250,0 @@ const block = /** @type {BlockStatement} */ ( |
@@ -1,2 +0,2 @@ | ||
/** @import { BlockStatement, Expression, ExpressionStatement, Property } from 'estree' */ | ||
/** @import { BlockStatement, Expression, ExpressionStatement, Literal, Property } from 'estree' */ | ||
/** @import { AST } from '#compiler' */ | ||
@@ -26,3 +26,2 @@ /** @import { ComponentContext } from '../types' */ | ||
/** @type {Expression} */ | ||
let name = b.literal('default'); | ||
@@ -37,3 +36,3 @@ | ||
if (attribute.name === 'name') { | ||
name = value; | ||
name = /** @type {Literal} */ (value); | ||
is_default = false; | ||
@@ -63,8 +62,12 @@ } else if (attribute.name !== 'slot') { | ||
const expression = is_default | ||
? b.call('$.default_slot', b.id('$$props')) | ||
: b.member(b.member(b.id('$$props'), '$$slots'), name, true, true); | ||
const slot = b.call( | ||
'$.slot', | ||
context.state.node, | ||
b.id('$$props'), | ||
name, | ||
props_expression, | ||
fallback | ||
); | ||
const slot = b.call('$.slot', context.state.node, expression, props_expression, fallback); | ||
context.state.init.push(b.stmt(slot)); | ||
} |
@@ -62,2 +62,3 @@ /** @import { BlockStatement, Expression, Pattern, Property, Statement } from 'estree' */ | ||
} | ||
for (const attribute of node.attributes) { | ||
@@ -106,2 +107,5 @@ if (attribute.type === 'LetDirective') { | ||
/** @type {Property[]} */ | ||
const serialized_slots = []; | ||
// Group children by slot | ||
@@ -120,2 +124,5 @@ for (const child of node.fragment.nodes) { | ||
// Interop: allows people to pass snippets when component still uses slots | ||
serialized_slots.push(b.init(child.expression.name, b.true)); | ||
continue; | ||
@@ -148,5 +155,2 @@ } | ||
// Serialize each slot | ||
/** @type {Property[]} */ | ||
const serialized_slots = []; | ||
for (const slot_name of Object.keys(children)) { | ||
@@ -153,0 +157,0 @@ const block = /** @type {BlockStatement} */ ( |
@@ -1,2 +0,2 @@ | ||
/** @import { BlockStatement, Expression, Property } from 'estree' */ | ||
/** @import { BlockStatement, Expression, Literal, Property } from 'estree' */ | ||
/** @import { AST } from '#compiler' */ | ||
@@ -18,4 +18,3 @@ /** @import { ComponentContext } from '../types.js' */ | ||
/** @type {Expression} */ | ||
let expression = b.call('$.default_slot', b.id('$$props')); | ||
let name = b.literal('default'); | ||
@@ -29,3 +28,3 @@ for (const attribute of node.attributes) { | ||
if (attribute.name === 'name') { | ||
expression = b.member(b.member_id('$$props.$$slots'), value, true, true); | ||
name = /** @type {Literal} */ (value); | ||
} else if (attribute.name !== 'slot') { | ||
@@ -47,5 +46,12 @@ props.push(b.init(attribute.name, value)); | ||
const slot = b.call('$.slot', b.id('$$payload'), expression, props_expression, fallback); | ||
const slot = b.call( | ||
'$.slot', | ||
b.id('$$payload'), | ||
b.id('$$props'), | ||
name, | ||
props_expression, | ||
fallback | ||
); | ||
context.state.template.push(empty_comment, b.stmt(slot), empty_comment); | ||
} |
@@ -28,4 +28,10 @@ /** @import { VariableDeclaration, VariableDeclarator, Expression, CallExpression, Pattern, Identifier } from 'estree' */ | ||
if (rune === '$props') { | ||
let has_rest = false; | ||
// remove $bindable() from props declaration | ||
const id = walk(declarator.id, null, { | ||
let id = walk(declarator.id, null, { | ||
RestElement(node, context) { | ||
if (context.path.at(-1) === declarator.id) { | ||
has_rest = true; | ||
} | ||
}, | ||
AssignmentPattern(node) { | ||
@@ -43,2 +49,20 @@ if ( | ||
}); | ||
if (id.type === 'ObjectPattern' && has_rest) { | ||
// If a rest pattern is used within an object pattern, we need to ensure we don't expose $$slots or $$events | ||
id.properties.splice( | ||
id.properties.length - 1, | ||
0, | ||
// @ts-ignore | ||
b.prop('init', b.id('$$slots'), b.id('$$slots')), | ||
b.prop('init', b.id('$$events'), b.id('$$events')) | ||
); | ||
} else if (id.type === 'Identifier') { | ||
// If $props is referenced as an identifier, we need to ensure we don't expose $$slots or $$events as properties | ||
// on the identifier reference | ||
id = b.object_pattern([ | ||
b.prop('init', b.id('$$slots'), b.id('$$slots')), | ||
b.prop('init', b.id('$$events'), b.id('$$events')), | ||
b.rest(b.id(id.name)) | ||
]); | ||
} | ||
declarations.push( | ||
@@ -45,0 +69,0 @@ b.declarator(/** @type {Pattern} */ (context.visit(id)), b.id('$$props')) |
@@ -394,2 +394,3 @@ /** @import { ClassDeclaration, Expression, FunctionDeclaration, Identifier, ImportDeclaration, MemberExpression, Node, Pattern, VariableDeclarator } from 'estree' */ | ||
const binding = scope.declare(id, 'template', 'const'); | ||
scope.reference(id, [context.path[context.path.length - 1], node]); | ||
bindings.push(binding); | ||
@@ -406,2 +407,3 @@ } | ||
const binding = scope.declare(id, 'template', 'const'); | ||
scope.reference(id, [context.path[context.path.length - 1], node]); | ||
bindings.push(binding); | ||
@@ -408,0 +410,0 @@ } |
@@ -333,3 +333,2 @@ /** @import { Processed, Preprocessor, MarkupPreprocessor, PreprocessorGroup } from './public.js' */ | ||
* | ||
* https://svelte.dev/docs/svelte-compiler#svelte-preprocess | ||
* @param {string} source | ||
@@ -336,0 +335,0 @@ * @param {PreprocessorGroup | PreprocessorGroup[]} preprocessor |
@@ -7,3 +7,2 @@ /* | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -17,3 +16,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -29,3 +27,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -40,3 +37,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -51,3 +47,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -74,3 +69,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -84,3 +78,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -94,3 +87,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -105,3 +97,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -115,3 +106,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -125,3 +115,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -135,3 +124,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -145,3 +133,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -156,3 +143,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -171,3 +157,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -181,3 +166,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -191,3 +175,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -205,3 +188,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -215,3 +197,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -225,3 +206,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -238,3 +218,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -248,3 +227,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -258,3 +236,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -268,3 +245,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -278,3 +254,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -288,3 +263,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -299,3 +273,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -309,3 +282,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -319,3 +291,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -329,3 +300,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -341,3 +311,2 @@ * @returns {number} | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -344,0 +313,0 @@ * @returns {number} |
@@ -19,3 +19,2 @@ /** @import { ComponentContext, ComponentContextLegacy } from '#client' */ | ||
* | ||
* https://svelte.dev/docs/svelte#onmount | ||
* @template T | ||
@@ -46,3 +45,2 @@ * @param {() => NotFunction<T> | Promise<NotFunction<T>> | (() => any)} fn | ||
* | ||
* https://svelte.dev/docs/svelte#ondestroy | ||
* @param {() => any} fn | ||
@@ -89,3 +87,2 @@ * @returns {void} | ||
* | ||
* https://svelte.dev/docs/svelte#createeventdispatcher | ||
* @deprecated Use callback props and/or the `$host()` rune instead — see https://svelte-5-preview.vercel.app/docs/deprecations#createeventdispatcher | ||
@@ -130,3 +127,2 @@ * @template {Record<string, any>} [EventMap = any] | ||
* | ||
* https://svelte.dev/docs/svelte#beforeupdate | ||
* @deprecated Use `$effect.pre` instead — see https://svelte-5-preview.vercel.app/docs/deprecations#beforeupdate-and-afterupdate | ||
@@ -155,3 +151,2 @@ * @param {() => void} fn | ||
* | ||
* https://svelte.dev/docs/svelte#afterupdate | ||
* @deprecated Use `$effect` instead — see https://svelte-5-preview.vercel.app/docs/deprecations#beforeupdate-and-afterupdate | ||
@@ -158,0 +153,0 @@ * @param {() => void} fn |
@@ -5,7 +5,8 @@ import { hydrate_next, hydrating } from '../hydration.js'; | ||
* @param {Comment} anchor | ||
* @param {void | ((anchor: Comment, slot_props: Record<string, unknown>) => void)} slot_fn | ||
* @param {Record<string, any>} $$props | ||
* @param {string} name | ||
* @param {Record<string, unknown>} slot_props | ||
* @param {null | ((anchor: Comment) => void)} fallback_fn | ||
*/ | ||
export function slot(anchor, slot_fn, slot_props, fallback_fn) { | ||
export function slot(anchor, $$props, name, slot_props, fallback_fn) { | ||
if (hydrating) { | ||
@@ -15,2 +16,10 @@ hydrate_next(); | ||
var slot_fn = $$props.$$slots?.[name]; | ||
// Interop: Can use snippets to fill slots | ||
var is_interop = false; | ||
if (slot_fn === true) { | ||
slot_fn = $$props[name === 'default' ? 'children' : name]; | ||
is_interop = true; | ||
} | ||
if (slot_fn === undefined) { | ||
@@ -21,3 +30,3 @@ if (fallback_fn !== null) { | ||
} else { | ||
slot_fn(anchor, slot_props); | ||
slot_fn(anchor, is_interop ? () => slot_props : slot_props); | ||
} | ||
@@ -24,0 +33,0 @@ } |
@@ -69,13 +69,1 @@ import { set, source } from '../../reactivity/sources.js'; | ||
} | ||
/** | ||
* @param {Record<string, any>} $$props | ||
*/ | ||
export function default_slot($$props) { | ||
var children = $$props.$$slots?.default; | ||
if (children === true) { | ||
return $$props.children; | ||
} else { | ||
return children; | ||
} | ||
} |
@@ -83,4 +83,3 @@ export { FILENAME, HMR, NAMESPACE_SVG } from '../../constants.js'; | ||
reactive_import, | ||
update_legacy_props, | ||
default_slot | ||
update_legacy_props | ||
} from './dom/legacy/misc.js'; | ||
@@ -87,0 +86,0 @@ export { |
@@ -862,3 +862,2 @@ /** @import { ComponentContext, Derived, Effect, Reaction, Signal, Source, Value } from '#client' */ | ||
* | ||
* https://svelte.dev/docs/svelte#getcontext | ||
* @template T | ||
@@ -889,3 +888,2 @@ * @param {any} key | ||
* | ||
* https://svelte.dev/docs/svelte#setcontext | ||
* @template T | ||
@@ -906,3 +904,2 @@ * @param {any} key | ||
* | ||
* https://svelte.dev/docs/svelte#hascontext | ||
* @param {any} key | ||
@@ -921,3 +918,2 @@ * @returns {boolean} | ||
* | ||
* https://svelte.dev/docs/svelte#getallcontexts | ||
* @template {Map<any, any>} [T=Map<any, any>] | ||
@@ -924,0 +920,0 @@ * @returns {T} |
@@ -408,3 +408,4 @@ /** @import { ComponentType, SvelteComponent } from 'svelte' */ | ||
* @param {Payload} payload | ||
* @param {void | ((payload: Payload, props: Record<string, unknown>) => void)} slot_fn | ||
* @param {Record<string, any>} $$props | ||
* @param {string} name | ||
* @param {Record<string, unknown>} slot_props | ||
@@ -414,3 +415,9 @@ * @param {null | (() => void)} fallback_fn | ||
*/ | ||
export function slot(payload, slot_fn, slot_props, fallback_fn) { | ||
export function slot(payload, $$props, name, slot_props, fallback_fn) { | ||
var slot_fn = $$props.$$slots?.[name]; | ||
// Interop: Can use snippets to fill slots | ||
if (slot_fn === true) { | ||
slot_fn = $$props[name === 'default' ? 'children' : name]; | ||
} | ||
if (slot_fn !== undefined) { | ||
@@ -550,3 +557,1 @@ slot_fn(payload, slot_props); | ||
export { escape_html as escape }; | ||
export { default_slot } from '../client/dom/legacy/misc.js'; |
@@ -56,3 +56,2 @@ /** @import { Task } from '#client' */ | ||
* | ||
* https://svelte.dev/docs/svelte-motion#spring | ||
* @template [T=any] | ||
@@ -59,0 +58,0 @@ * @param {T} [value] |
@@ -79,3 +79,2 @@ /** @import { Task } from '../internal/client/types' */ | ||
* | ||
* https://svelte.dev/docs/svelte-motion#tweened | ||
* @template T | ||
@@ -82,0 +81,0 @@ * @param {T} [value] |
@@ -15,3 +15,2 @@ /** @import { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable } from '../public.js' */ | ||
* | ||
* https://svelte.dev/docs/svelte-store#readable | ||
* @template T | ||
@@ -31,3 +30,2 @@ * @param {T} [value] initial value | ||
* | ||
* https://svelte.dev/docs/svelte-store#writable | ||
* @template T | ||
@@ -105,3 +103,2 @@ * @param {T} [value] initial value | ||
* | ||
* https://svelte.dev/docs/svelte-store#derived | ||
* @template {Stores} S | ||
@@ -119,3 +116,2 @@ * @template T | ||
* | ||
* https://svelte.dev/docs/svelte-store#derived | ||
* @template {Stores} S | ||
@@ -194,3 +190,2 @@ * @template T | ||
* | ||
* https://svelte.dev/docs/svelte-store#readonly | ||
* @template T | ||
@@ -210,3 +205,2 @@ * @param {Readable<T>} store - store to make readonly | ||
* | ||
* https://svelte.dev/docs/svelte-store#get | ||
* @template T | ||
@@ -213,0 +207,0 @@ * @param {Readable<T>} store |
@@ -12,3 +12,2 @@ /** @import { BlurParams, CrossfadeParams, DrawParams, FadeParams, FlyParams, ScaleParams, SlideParams, TransitionConfig } from './public' */ | ||
/** | ||
* https://svelte.dev/docs/svelte-easing | ||
* @param {number} t | ||
@@ -32,3 +31,2 @@ * @returns {number} | ||
* | ||
* https://svelte.dev/docs/svelte-transition#blur | ||
* @param {Element} node | ||
@@ -58,3 +56,2 @@ * @param {BlurParams} [params] | ||
* | ||
* https://svelte.dev/docs/svelte-transition#fade | ||
* @param {Element} node | ||
@@ -77,3 +74,2 @@ * @param {FadeParams} [params] | ||
* | ||
* https://svelte.dev/docs/svelte-transition#fly | ||
* @param {Element} node | ||
@@ -106,3 +102,2 @@ * @param {FlyParams} [params] | ||
* | ||
* https://svelte.dev/docs/svelte-transition#slide | ||
* @param {Element} node | ||
@@ -151,3 +146,2 @@ * @param {SlideParams} [params] | ||
* | ||
* https://svelte.dev/docs/svelte-transition#scale | ||
* @param {Element} node | ||
@@ -180,3 +174,2 @@ * @param {ScaleParams} [params] | ||
* | ||
* https://svelte.dev/docs/svelte-transition#draw | ||
* @param {SVGElement & { getTotalLength(): number }} node | ||
@@ -228,3 +221,2 @@ * @param {DrawParams} [params] | ||
* | ||
* https://svelte.dev/docs/svelte-transition#crossfade | ||
* @param {CrossfadeParams & { | ||
@@ -231,0 +223,0 @@ * fallback?: (node: Element, params: CrossfadeParams, intro: boolean) => TransitionConfig; |
@@ -9,3 +9,3 @@ // generated during release, do not modify | ||
*/ | ||
export const VERSION = '5.0.0-next.260'; | ||
export const VERSION = '5.0.0-next.262'; | ||
export const PUBLIC_VERSION = '5'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2234214
49209