|
|
@ -655,15 +655,15 @@ function serialize_element_special_value_attribute(element, node_id, attribute,
|
|
|
|
// This ensures things stay in sync with the select binding
|
|
|
|
// This ensures things stay in sync with the select binding
|
|
|
|
// in case of updates to the option value or new values appearing
|
|
|
|
// in case of updates to the option value or new values appearing
|
|
|
|
b.call('$.selected', node_id)
|
|
|
|
b.call('$.selected', node_id)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
: needs_option_call
|
|
|
|
: needs_option_call
|
|
|
|
? b.sequence([
|
|
|
|
? b.sequence([
|
|
|
|
inner_assignment,
|
|
|
|
inner_assignment,
|
|
|
|
// This ensures a one-way street to the DOM in case it's <select {value}>
|
|
|
|
// This ensures a one-way street to the DOM in case it's <select {value}>
|
|
|
|
// and not <select bind:value>
|
|
|
|
// and not <select bind:value>
|
|
|
|
b.call('$.select_option', node_id, value)
|
|
|
|
b.call('$.select_option', node_id, value)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
: inner_assignment
|
|
|
|
: inner_assignment
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (is_reactive) {
|
|
|
|
if (is_reactive) {
|
|
|
@ -953,7 +953,7 @@ function serialize_inline_component(node, component_name, context) {
|
|
|
|
: b.call(
|
|
|
|
: b.call(
|
|
|
|
'$.spread_props',
|
|
|
|
'$.spread_props',
|
|
|
|
...props_and_spreads.map((p) => (Array.isArray(p) ? b.object(p) : p))
|
|
|
|
...props_and_spreads.map((p) => (Array.isArray(p) ? b.object(p) : p))
|
|
|
|
);
|
|
|
|
);
|
|
|
|
/** @param {import('estree').Identifier} node_id */
|
|
|
|
/** @param {import('estree').Identifier} node_id */
|
|
|
|
let fn = (node_id) =>
|
|
|
|
let fn = (node_id) =>
|
|
|
|
b.call(
|
|
|
|
b.call(
|
|
|
@ -2345,7 +2345,7 @@ export const template_visitors = {
|
|
|
|
? b.arrow(
|
|
|
|
? b.arrow(
|
|
|
|
[b.id('$$anchor')],
|
|
|
|
[b.id('$$anchor')],
|
|
|
|
/** @type {import('estree').BlockStatement} */ (context.visit(node.fallback))
|
|
|
|
/** @type {import('estree').BlockStatement} */ (context.visit(node.fallback))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: b.literal(null);
|
|
|
|
: b.literal(null);
|
|
|
|
const key_function =
|
|
|
|
const key_function =
|
|
|
|
node.key && ((each_type & EACH_ITEM_REACTIVE) !== 0 || context.state.options.dev)
|
|
|
|
node.key && ((each_type & EACH_ITEM_REACTIVE) !== 0 || context.state.options.dev)
|
|
|
@ -2356,7 +2356,7 @@ export const template_visitors = {
|
|
|
|
b.return(/** @type {import('estree').Expression} */ (context.visit(node.key)))
|
|
|
|
b.return(/** @type {import('estree').Expression} */ (context.visit(node.key)))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: b.literal(null);
|
|
|
|
: b.literal(null);
|
|
|
|
|
|
|
|
|
|
|
|
if (node.index && each_node_meta.contains_group_binding) {
|
|
|
|
if (node.index && each_node_meta.contains_group_binding) {
|
|
|
@ -2418,7 +2418,7 @@ export const template_visitors = {
|
|
|
|
? b.arrow(
|
|
|
|
? b.arrow(
|
|
|
|
[b.id('$$anchor')],
|
|
|
|
[b.id('$$anchor')],
|
|
|
|
/** @type {import('estree').BlockStatement} */ (context.visit(node.alternate))
|
|
|
|
/** @type {import('estree').BlockStatement} */ (context.visit(node.alternate))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: b.literal(null)
|
|
|
|
: b.literal(null)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -2437,7 +2437,7 @@ export const template_visitors = {
|
|
|
|
? b.arrow(
|
|
|
|
? b.arrow(
|
|
|
|
[b.id('$$anchor')],
|
|
|
|
[b.id('$$anchor')],
|
|
|
|
/** @type {import('estree').BlockStatement} */ (context.visit(node.pending))
|
|
|
|
/** @type {import('estree').BlockStatement} */ (context.visit(node.pending))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: b.literal(null),
|
|
|
|
: b.literal(null),
|
|
|
|
node.then
|
|
|
|
node.then
|
|
|
|
? b.arrow(
|
|
|
|
? b.arrow(
|
|
|
@ -2445,10 +2445,10 @@ export const template_visitors = {
|
|
|
|
? [
|
|
|
|
? [
|
|
|
|
b.id('$$anchor'),
|
|
|
|
b.id('$$anchor'),
|
|
|
|
/** @type {import('estree').Pattern} */ (context.visit(node.value))
|
|
|
|
/** @type {import('estree').Pattern} */ (context.visit(node.value))
|
|
|
|
]
|
|
|
|
]
|
|
|
|
: [b.id('$$anchor')],
|
|
|
|
: [b.id('$$anchor')],
|
|
|
|
/** @type {import('estree').BlockStatement} */ (context.visit(node.then))
|
|
|
|
/** @type {import('estree').BlockStatement} */ (context.visit(node.then))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: b.literal(null),
|
|
|
|
: b.literal(null),
|
|
|
|
node.catch
|
|
|
|
node.catch
|
|
|
|
? b.arrow(
|
|
|
|
? b.arrow(
|
|
|
@ -2456,10 +2456,10 @@ export const template_visitors = {
|
|
|
|
? [
|
|
|
|
? [
|
|
|
|
b.id('$$anchor'),
|
|
|
|
b.id('$$anchor'),
|
|
|
|
/** @type {import('estree').Pattern} */ (context.visit(node.error))
|
|
|
|
/** @type {import('estree').Pattern} */ (context.visit(node.error))
|
|
|
|
]
|
|
|
|
]
|
|
|
|
: [b.id('$$anchor')],
|
|
|
|
: [b.id('$$anchor')],
|
|
|
|
/** @type {import('estree').BlockStatement} */ (context.visit(node.catch))
|
|
|
|
/** @type {import('estree').BlockStatement} */ (context.visit(node.catch))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: b.literal(null)
|
|
|
|
: b.literal(null)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -2876,9 +2876,9 @@ export const template_visitors = {
|
|
|
|
/** @type {import('estree').Expression} */ (node.expression).type ===
|
|
|
|
/** @type {import('estree').Expression} */ (node.expression).type ===
|
|
|
|
'ObjectExpression'
|
|
|
|
'ObjectExpression'
|
|
|
|
? // @ts-expect-error types don't match, but it can't contain spread elements and the structure is otherwise fine
|
|
|
|
? // @ts-expect-error types don't match, but it can't contain spread elements and the structure is otherwise fine
|
|
|
|
b.object_pattern(node.expression.properties)
|
|
|
|
b.object_pattern(node.expression.properties)
|
|
|
|
: // @ts-expect-error types don't match, but it can't contain spread elements and the structure is otherwise fine
|
|
|
|
: // @ts-expect-error types don't match, but it can't contain spread elements and the structure is otherwise fine
|
|
|
|
b.array_pattern(node.expression.elements),
|
|
|
|
b.array_pattern(node.expression.elements),
|
|
|
|
b.member(b.id('$$slotProps'), b.id(node.name))
|
|
|
|
b.member(b.id('$$slotProps'), b.id(node.name))
|
|
|
|
),
|
|
|
|
),
|
|
|
|
b.return(b.object(bindings.map((binding) => b.init(binding.node.name, binding.node))))
|
|
|
|
b.return(b.object(bindings.map((binding) => b.init(binding.node.name, binding.node))))
|
|
|
@ -2971,7 +2971,7 @@ export const template_visitors = {
|
|
|
|
: b.arrow(
|
|
|
|
: b.arrow(
|
|
|
|
[b.id('$$anchor')],
|
|
|
|
[b.id('$$anchor')],
|
|
|
|
b.block(create_block(node, 'fallback', node.fragment.nodes, context))
|
|
|
|
b.block(create_block(node, 'fallback', node.fragment.nodes, context))
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const expression = is_default
|
|
|
|
const expression = is_default
|
|
|
|
? b.member(b.id('$$props'), b.id('children'))
|
|
|
|
? b.member(b.id('$$props'), b.id('children'))
|
|
|
|