svelte 3.46.4 → 3.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/action/index.d.ts +1 -0
- package/action/index.js +2 -0
- package/action/index.mjs +1 -0
- package/action/package.json +5 -0
- package/compiler.js +216 -25
- package/compiler.js.map +1 -1
- package/compiler.mjs +216 -25
- package/compiler.mjs.map +1 -1
- package/internal/index.js +9 -2
- package/internal/index.mjs +9 -3
- package/package.json +6 -3
- package/types/compiler/compile/nodes/Element.d.ts +3 -0
- package/types/compiler/compile/render_dom/Block.d.ts +1 -0
- package/types/compiler/compile/render_dom/wrappers/Element/index.d.ts +6 -1
- package/types/runtime/action/index.d.ts +41 -0
- package/types/runtime/internal/dev.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Svelte changelog
|
|
2
2
|
|
|
3
|
+
## 3.47.0
|
|
4
|
+
|
|
5
|
+
* Add support for dynamic elements through `<svelte:element>` ([#2324](https://github.com/sveltejs/svelte/issues/2324))
|
|
6
|
+
* Miscellaneous variable context fixes in `{@const}` ([#7222](https://github.com/sveltejs/svelte/pull/7222))
|
|
7
|
+
* Fix `{#key}` block not being reactive when the key variable is not otherwise used ([#7408](https://github.com/sveltejs/svelte/issues/7408))
|
|
8
|
+
* Add `Symbol` as a known global ([#7418](https://github.com/sveltejs/svelte/issues/7418))
|
|
9
|
+
|
|
10
|
+
## 3.46.6
|
|
11
|
+
|
|
12
|
+
* Actually include action TypeScript interface in published package ([#7407](https://github.com/sveltejs/svelte/pull/7407))
|
|
13
|
+
|
|
14
|
+
## 3.46.5
|
|
15
|
+
|
|
16
|
+
* Add TypeScript interfaces for typing actions ([#6538](https://github.com/sveltejs/svelte/issues/6538))
|
|
17
|
+
* Do not generate `unused-export-let` warning inside `<script context="module">` blocks ([#7055](https://github.com/sveltejs/svelte/issues/7055))
|
|
18
|
+
* Do not collapse whitespace-only CSS vars ([#7152](https://github.com/sveltejs/svelte/issues/7152))
|
|
19
|
+
* Add `aria-description` to the list of allowed ARIA attributes ([#7301](https://github.com/sveltejs/svelte/issues/7301))
|
|
20
|
+
* Fix attribute escaping during SSR ([#7327](https://github.com/sveltejs/svelte/issues/7327))
|
|
21
|
+
* Prevent `.innerHTML` optimization from being used when `style:` directive is present ([#7386](https://github.com/sveltejs/svelte/issues/7386))
|
|
22
|
+
|
|
3
23
|
## 3.46.4
|
|
4
24
|
|
|
5
25
|
* Avoid `maximum call stack size exceeded` errors on large components ([#4694](https://github.com/sveltejs/svelte/issues/4694))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../types/runtime/action/index';
|
package/action/index.js
ADDED
package/action/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/compiler.js
CHANGED
|
@@ -5854,6 +5854,7 @@
|
|
|
5854
5854
|
'setTimeout',
|
|
5855
5855
|
'String',
|
|
5856
5856
|
'SVGElement',
|
|
5857
|
+
'Symbol',
|
|
5857
5858
|
'SyntaxError',
|
|
5858
5859
|
'TypeError',
|
|
5859
5860
|
'undefined',
|
|
@@ -6037,6 +6038,10 @@
|
|
|
6037
6038
|
code: `invalid-${slug}-content`,
|
|
6038
6039
|
message: `<${name}> cannot have children`
|
|
6039
6040
|
}),
|
|
6041
|
+
invalid_element_definition: {
|
|
6042
|
+
code: 'invalid-element-definition',
|
|
6043
|
+
message: 'Invalid element definition'
|
|
6044
|
+
},
|
|
6040
6045
|
invalid_element_placement: (slug, name) => ({
|
|
6041
6046
|
code: `invalid-${slug}-placement`,
|
|
6042
6047
|
message: `<${name}> tags cannot be inside elements or blocks`
|
|
@@ -6097,6 +6102,10 @@
|
|
|
6097
6102
|
code: 'missing-attribute-value',
|
|
6098
6103
|
message: 'Expected value for the attribute'
|
|
6099
6104
|
},
|
|
6105
|
+
missing_element_definition: {
|
|
6106
|
+
code: 'missing-element-definition',
|
|
6107
|
+
message: '<svelte:element> must have a \'this\' attribute'
|
|
6108
|
+
},
|
|
6100
6109
|
unclosed_script: {
|
|
6101
6110
|
code: 'unclosed-script',
|
|
6102
6111
|
message: '<script> must have a closing tag'
|
|
@@ -16685,7 +16694,7 @@
|
|
|
16685
16694
|
['svelte:window', 'Window'],
|
|
16686
16695
|
['svelte:body', 'Body']
|
|
16687
16696
|
]);
|
|
16688
|
-
const valid_meta_tags = Array.from(meta_tags.keys()).concat('svelte:self', 'svelte:component', 'svelte:fragment');
|
|
16697
|
+
const valid_meta_tags = Array.from(meta_tags.keys()).concat('svelte:self', 'svelte:component', 'svelte:fragment', 'svelte:element');
|
|
16689
16698
|
const specials = new Map([
|
|
16690
16699
|
[
|
|
16691
16700
|
'script',
|
|
@@ -16705,6 +16714,7 @@
|
|
|
16705
16714
|
const SELF = /^svelte:self(?=[\s/>])/;
|
|
16706
16715
|
const COMPONENT = /^svelte:component(?=[\s/>])/;
|
|
16707
16716
|
const SLOT = /^svelte:fragment(?=[\s/>])/;
|
|
16717
|
+
const ELEMENT = /^svelte:element(?=[\s/>])/;
|
|
16708
16718
|
function parent_is_head(stack) {
|
|
16709
16719
|
let i = stack.length;
|
|
16710
16720
|
while (i--) {
|
|
@@ -16807,7 +16817,7 @@
|
|
|
16807
16817
|
}
|
|
16808
16818
|
if (name === 'svelte:component') {
|
|
16809
16819
|
const index = element.attributes.findIndex(attr => attr.type === 'Attribute' && attr.name === 'this');
|
|
16810
|
-
if (
|
|
16820
|
+
if (index === -1) {
|
|
16811
16821
|
parser.error(parser_errors.missing_component_definition, start);
|
|
16812
16822
|
}
|
|
16813
16823
|
const definition = element.attributes.splice(index, 1)[0];
|
|
@@ -16816,6 +16826,17 @@
|
|
|
16816
16826
|
}
|
|
16817
16827
|
element.expression = definition.value[0].expression;
|
|
16818
16828
|
}
|
|
16829
|
+
if (name === 'svelte:element') {
|
|
16830
|
+
const index = element.attributes.findIndex(attr => attr.type === 'Attribute' && attr.name === 'this');
|
|
16831
|
+
if (index === -1) {
|
|
16832
|
+
parser.error(parser_errors.missing_element_definition, start);
|
|
16833
|
+
}
|
|
16834
|
+
const definition = element.attributes.splice(index, 1)[0];
|
|
16835
|
+
if (definition.value === true) {
|
|
16836
|
+
parser.error(parser_errors.invalid_element_definition, definition.start);
|
|
16837
|
+
}
|
|
16838
|
+
element.tag = definition.value[0].data || definition.value[0].expression;
|
|
16839
|
+
}
|
|
16819
16840
|
// special cases – top-level <script> and <style>
|
|
16820
16841
|
if (specials.has(name) && parser.stack.length === 1) {
|
|
16821
16842
|
const special = specials.get(name);
|
|
@@ -16872,6 +16893,8 @@
|
|
|
16872
16893
|
}
|
|
16873
16894
|
if (parser.read(COMPONENT))
|
|
16874
16895
|
return 'svelte:component';
|
|
16896
|
+
if (parser.read(ELEMENT))
|
|
16897
|
+
return 'svelte:element';
|
|
16875
16898
|
if (parser.read(SLOT))
|
|
16876
16899
|
return 'svelte:fragment';
|
|
16877
16900
|
const name = parser.read_until(/(\s|\/|>)/);
|
|
@@ -17912,6 +17935,7 @@
|
|
|
17912
17935
|
hydrate: [],
|
|
17913
17936
|
mount: [],
|
|
17914
17937
|
measure: [],
|
|
17938
|
+
restore_measurements: [],
|
|
17915
17939
|
fix: [],
|
|
17916
17940
|
animate: [],
|
|
17917
17941
|
intro: [],
|
|
@@ -18100,6 +18124,11 @@
|
|
|
18100
18124
|
properties.measure = x `function #measure() {
|
|
18101
18125
|
${this.chunks.measure}
|
|
18102
18126
|
}`;
|
|
18127
|
+
if (this.chunks.restore_measurements.length) {
|
|
18128
|
+
properties.restore_measurements = x `function #restore_measurements(#measurement) {
|
|
18129
|
+
${this.chunks.restore_measurements}
|
|
18130
|
+
}`;
|
|
18131
|
+
}
|
|
18103
18132
|
properties.fix = x `function #fix() {
|
|
18104
18133
|
${this.chunks.fix}
|
|
18105
18134
|
}`;
|
|
@@ -18151,6 +18180,7 @@
|
|
|
18151
18180
|
m: ${properties.mount},
|
|
18152
18181
|
p: ${properties.update},
|
|
18153
18182
|
r: ${properties.measure},
|
|
18183
|
+
s: ${properties.restore_measurements},
|
|
18154
18184
|
f: ${properties.fix},
|
|
18155
18185
|
a: ${properties.animate},
|
|
18156
18186
|
i: ${properties.intro},
|
|
@@ -19052,6 +19082,10 @@
|
|
|
19052
19082
|
code: 'invalid-animation',
|
|
19053
19083
|
message: 'An element that uses the animate directive must be the sole child of a keyed each block'
|
|
19054
19084
|
},
|
|
19085
|
+
invalid_animation_dynamic_element: {
|
|
19086
|
+
code: 'invalid-animation',
|
|
19087
|
+
message: '<svelte:element> cannot have a animate directive'
|
|
19088
|
+
},
|
|
19055
19089
|
invalid_directive_value: {
|
|
19056
19090
|
code: 'invalid-directive-value',
|
|
19057
19091
|
message: 'Can only bind to an identifier (e.g. `foo`) or a member expression (e.g. `foo.bar` or `foo[baz]`)'
|
|
@@ -19264,11 +19298,20 @@
|
|
|
19264
19298
|
const id = component.get_unique_name(sanitize(get_function_name(node, owner)));
|
|
19265
19299
|
const declaration = b `const ${id} = ${node}`;
|
|
19266
19300
|
if (owner.type === 'ConstTag') {
|
|
19301
|
+
let child_scope = scope;
|
|
19267
19302
|
walk(node, {
|
|
19268
|
-
enter(node) {
|
|
19269
|
-
if (node
|
|
19303
|
+
enter(node, parent) {
|
|
19304
|
+
if (map.has(node))
|
|
19305
|
+
child_scope = map.get(node);
|
|
19306
|
+
if (node.type === 'Identifier' && is_reference(node, parent)) {
|
|
19307
|
+
if (child_scope.has(node.name))
|
|
19308
|
+
return;
|
|
19270
19309
|
this.replace(block.renderer.reference(node, ctx));
|
|
19271
19310
|
}
|
|
19311
|
+
},
|
|
19312
|
+
leave(node) {
|
|
19313
|
+
if (map.has(node))
|
|
19314
|
+
child_scope = child_scope.parent;
|
|
19272
19315
|
}
|
|
19273
19316
|
});
|
|
19274
19317
|
}
|
|
@@ -20177,7 +20220,7 @@
|
|
|
20177
20220
|
}
|
|
20178
20221
|
|
|
20179
20222
|
const svg$1 = /^(?:altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|animateMotion|animateTransform|circle|clipPath|color-profile|cursor|defs|desc|discard|ellipse|feBlend|feColorMatrix|feComponentTransfer|feComposite|feConvolveMatrix|feDiffuseLighting|feDisplacementMap|feDistantLight|feDropShadow|feFlood|feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|feMergeNode|feMorphology|feOffset|fePointLight|feSpecularLighting|feSpotLight|feTile|feTurbulence|filter|font|font-face|font-face-format|font-face-name|font-face-src|font-face-uri|foreignObject|g|glyph|glyphRef|hatch|hatchpath|hkern|image|line|linearGradient|marker|mask|mesh|meshgradient|meshpatch|meshrow|metadata|missing-glyph|mpath|path|pattern|polygon|polyline|radialGradient|rect|set|solidcolor|stop|svg|switch|symbol|text|textPath|tref|tspan|unknown|use|view|vkern)$/;
|
|
20180
|
-
const aria_attributes = 'activedescendant atomic autocomplete busy checked colcount colindex colspan controls current describedby details disabled dropeffect errormessage expanded flowto grabbed haspopup hidden invalid keyshortcuts label labelledby level live modal multiline multiselectable orientation owns placeholder posinset pressed readonly relevant required roledescription rowcount rowindex rowspan selected setsize sort valuemax valuemin valuenow valuetext'.split(' ');
|
|
20223
|
+
const aria_attributes = 'activedescendant atomic autocomplete busy checked colcount colindex colspan controls current describedby description details disabled dropeffect errormessage expanded flowto grabbed haspopup hidden invalid keyshortcuts label labelledby level live modal multiline multiselectable orientation owns placeholder posinset pressed readonly relevant required roledescription rowcount rowindex rowspan selected setsize sort valuemax valuemin valuenow valuetext'.split(' ');
|
|
20181
20224
|
const aria_attribute_set = new Set(aria_attributes);
|
|
20182
20225
|
const aria_roles = 'alert alertdialog application article banner blockquote button caption cell checkbox code columnheader combobox complementary contentinfo definition deletion dialog directory document emphasis feed figure form generic graphics-document graphics-object graphics-symbol grid gridcell group heading img link list listbox listitem log main marquee math meter menu menubar menuitem menuitemcheckbox menuitemradio navigation none note option paragraph presentation progressbar radio radiogroup region row rowgroup rowheader scrollbar search searchbox separator slider spinbutton status strong subscript superscript switch tab table tablist tabpanel term textbox time timer toolbar tooltip tree treegrid treeitem'.split(' ');
|
|
20183
20226
|
const aria_role_set = new Set(aria_roles);
|
|
@@ -20321,6 +20364,17 @@
|
|
|
20321
20364
|
this.outro = null;
|
|
20322
20365
|
this.animation = null;
|
|
20323
20366
|
this.name = info.name;
|
|
20367
|
+
if (info.name === 'svelte:element') {
|
|
20368
|
+
if (typeof info.tag !== 'string') {
|
|
20369
|
+
this.tag_expr = new Expression(component, this, scope, info.tag);
|
|
20370
|
+
}
|
|
20371
|
+
else {
|
|
20372
|
+
this.tag_expr = new Expression(component, this, scope, string_literal(info.tag));
|
|
20373
|
+
}
|
|
20374
|
+
}
|
|
20375
|
+
else {
|
|
20376
|
+
this.tag_expr = new Expression(component, this, scope, string_literal(this.name));
|
|
20377
|
+
}
|
|
20324
20378
|
this.namespace = get_namespace(parent, this, component.namespace);
|
|
20325
20379
|
if (this.namespace !== namespaces.foreign) {
|
|
20326
20380
|
if (this.name === 'textarea') {
|
|
@@ -20417,6 +20471,9 @@
|
|
|
20417
20471
|
this.optimise();
|
|
20418
20472
|
component.apply_stylesheet(this);
|
|
20419
20473
|
}
|
|
20474
|
+
get is_dynamic_element() {
|
|
20475
|
+
return this.name === 'svelte:element';
|
|
20476
|
+
}
|
|
20420
20477
|
validate() {
|
|
20421
20478
|
if (this.component.var_lookup.has(this.name) && this.component.var_lookup.get(this.name).imported) {
|
|
20422
20479
|
this.component.warn(this, compiler_warnings.component_name_lowercase(this.name));
|
|
@@ -23384,9 +23441,21 @@
|
|
|
23384
23441
|
filter: (node, _name) => node.name === 'details'
|
|
23385
23442
|
}
|
|
23386
23443
|
];
|
|
23444
|
+
const CHILD_DYNAMIC_ELEMENT_BLOCK = 'child_dynamic_element';
|
|
23387
23445
|
class ElementWrapper extends Wrapper {
|
|
23388
23446
|
constructor(renderer, block, parent, node, strip_whitespace, next_sibling) {
|
|
23389
23447
|
super(renderer, block, parent, node);
|
|
23448
|
+
this.child_dynamic_element_block = null;
|
|
23449
|
+
this.child_dynamic_element = null;
|
|
23450
|
+
if (node.is_dynamic_element && block.type !== CHILD_DYNAMIC_ELEMENT_BLOCK) {
|
|
23451
|
+
this.child_dynamic_element_block = block.child({
|
|
23452
|
+
comment: create_debugging_comment(node, renderer.component),
|
|
23453
|
+
name: renderer.component.get_unique_name('create_dynamic_element'),
|
|
23454
|
+
type: CHILD_DYNAMIC_ELEMENT_BLOCK
|
|
23455
|
+
});
|
|
23456
|
+
renderer.blocks.push(this.child_dynamic_element_block);
|
|
23457
|
+
this.child_dynamic_element = new ElementWrapper(renderer, this.child_dynamic_element_block, parent, node, strip_whitespace, next_sibling);
|
|
23458
|
+
}
|
|
23390
23459
|
this.var = {
|
|
23391
23460
|
type: 'Identifier',
|
|
23392
23461
|
name: node.name.replace(/[^a-zA-Z0-9_$]/g, '_')
|
|
@@ -23423,6 +23492,7 @@
|
|
|
23423
23492
|
if (node.animation) {
|
|
23424
23493
|
block.add_animation();
|
|
23425
23494
|
}
|
|
23495
|
+
block.add_dependencies(node.tag_expr.dependencies);
|
|
23426
23496
|
// add directive and handler dependencies
|
|
23427
23497
|
[node.animation, node.outro, ...node.actions, ...node.classes, ...node.styles].forEach(directive => {
|
|
23428
23498
|
if (directive && directive.expression) {
|
|
@@ -23441,7 +23511,9 @@
|
|
|
23441
23511
|
node.classes.length > 0 ||
|
|
23442
23512
|
node.intro || node.outro ||
|
|
23443
23513
|
node.handlers.length > 0 ||
|
|
23514
|
+
node.styles.length > 0 ||
|
|
23444
23515
|
this.node.name === 'option' ||
|
|
23516
|
+
node.tag_expr.dynamic_dependencies().length ||
|
|
23445
23517
|
renderer.options.dev) {
|
|
23446
23518
|
this.parent.cannot_use_innerhtml(); // need to use add_location
|
|
23447
23519
|
this.parent.not_static_content();
|
|
@@ -23450,6 +23522,90 @@
|
|
|
23450
23522
|
this.fragment = new FragmentWrapper(renderer, block, node.children, this, strip_whitespace, next_sibling);
|
|
23451
23523
|
}
|
|
23452
23524
|
render(block, parent_node, parent_nodes) {
|
|
23525
|
+
if (this.child_dynamic_element) {
|
|
23526
|
+
this.render_dynamic_element(block, parent_node, parent_nodes);
|
|
23527
|
+
}
|
|
23528
|
+
else {
|
|
23529
|
+
this.render_element(block, parent_node, parent_nodes);
|
|
23530
|
+
}
|
|
23531
|
+
}
|
|
23532
|
+
render_dynamic_element(block, parent_node, parent_nodes) {
|
|
23533
|
+
this.child_dynamic_element.render(this.child_dynamic_element_block, null, x `#nodes`);
|
|
23534
|
+
const previous_tag = block.get_unique_name('previous_tag');
|
|
23535
|
+
const tag = this.node.tag_expr.manipulate(block);
|
|
23536
|
+
block.add_variable(previous_tag, tag);
|
|
23537
|
+
block.chunks.init.push(b `
|
|
23538
|
+
${this.renderer.options.dev && b `@validate_dynamic_element(${tag});`}
|
|
23539
|
+
let ${this.var} = ${tag} && ${this.child_dynamic_element_block.name}(#ctx);
|
|
23540
|
+
`);
|
|
23541
|
+
block.chunks.create.push(b `
|
|
23542
|
+
if (${this.var}) ${this.var}.c();
|
|
23543
|
+
`);
|
|
23544
|
+
if (this.renderer.options.hydratable) {
|
|
23545
|
+
block.chunks.claim.push(b `
|
|
23546
|
+
if (${this.var}) ${this.var}.l(${parent_nodes});
|
|
23547
|
+
`);
|
|
23548
|
+
}
|
|
23549
|
+
block.chunks.mount.push(b `
|
|
23550
|
+
if (${this.var}) ${this.var}.m(${parent_node || '#target'}, ${parent_node ? 'null' : '#anchor'});
|
|
23551
|
+
`);
|
|
23552
|
+
const anchor = this.get_or_create_anchor(block, parent_node, parent_nodes);
|
|
23553
|
+
const has_transitions = !!(this.node.intro || this.node.outro);
|
|
23554
|
+
const not_equal = this.renderer.component.component_options.immutable ? x `@not_equal` : x `@safe_not_equal`;
|
|
23555
|
+
block.chunks.update.push(b `
|
|
23556
|
+
if (${tag}) {
|
|
23557
|
+
if (!${previous_tag}) {
|
|
23558
|
+
${this.var} = ${this.child_dynamic_element_block.name}(#ctx);
|
|
23559
|
+
${this.var}.c();
|
|
23560
|
+
${has_transitions && b `@transition_in(${this.var})`}
|
|
23561
|
+
${this.var}.m(${this.get_update_mount_node(anchor)}, ${anchor});
|
|
23562
|
+
} else if (${not_equal}(${previous_tag}, ${tag})) {
|
|
23563
|
+
${this.var}.d(1);
|
|
23564
|
+
${this.renderer.options.dev && b `@validate_dynamic_element(${tag});`}
|
|
23565
|
+
${this.var} = ${this.child_dynamic_element_block.name}(#ctx);
|
|
23566
|
+
${this.var}.c();
|
|
23567
|
+
${this.var}.m(${this.get_update_mount_node(anchor)}, ${anchor});
|
|
23568
|
+
} else {
|
|
23569
|
+
${this.var}.p(#ctx, #dirty);
|
|
23570
|
+
}
|
|
23571
|
+
} else if (${previous_tag}) {
|
|
23572
|
+
${has_transitions
|
|
23573
|
+
? b `
|
|
23574
|
+
@group_outros();
|
|
23575
|
+
@transition_out(${this.var}, 1, 1, () => {
|
|
23576
|
+
${this.var} = null;
|
|
23577
|
+
});
|
|
23578
|
+
@check_outros();
|
|
23579
|
+
`
|
|
23580
|
+
: b `
|
|
23581
|
+
${this.var}.d(1);
|
|
23582
|
+
${this.var} = null;
|
|
23583
|
+
`}
|
|
23584
|
+
}
|
|
23585
|
+
${previous_tag} = ${tag};
|
|
23586
|
+
`);
|
|
23587
|
+
if (this.child_dynamic_element_block.has_intros) {
|
|
23588
|
+
block.chunks.intro.push(b `@transition_in(${this.var});`);
|
|
23589
|
+
}
|
|
23590
|
+
if (this.child_dynamic_element_block.has_outros) {
|
|
23591
|
+
block.chunks.outro.push(b `@transition_out(${this.var});`);
|
|
23592
|
+
}
|
|
23593
|
+
block.chunks.destroy.push(b `if (${this.var}) ${this.var}.d(detaching)`);
|
|
23594
|
+
if (this.node.animation) {
|
|
23595
|
+
const measurements = block.get_unique_name('measurements');
|
|
23596
|
+
block.add_variable(measurements);
|
|
23597
|
+
block.chunks.measure.push(b `${measurements} = ${this.var}.r()`);
|
|
23598
|
+
block.chunks.fix.push(b `${this.var}.f();`);
|
|
23599
|
+
block.chunks.animate.push(b `
|
|
23600
|
+
${this.var}.s(${measurements});
|
|
23601
|
+
${this.var}.a()
|
|
23602
|
+
`);
|
|
23603
|
+
}
|
|
23604
|
+
}
|
|
23605
|
+
is_dom_node() {
|
|
23606
|
+
return super.is_dom_node() && !this.child_dynamic_element;
|
|
23607
|
+
}
|
|
23608
|
+
render_element(block, parent_node, parent_nodes) {
|
|
23453
23609
|
const { renderer } = this;
|
|
23454
23610
|
if (this.node.name === 'noscript')
|
|
23455
23611
|
return;
|
|
@@ -23462,7 +23618,7 @@
|
|
|
23462
23618
|
if (renderer.options.hydratable) {
|
|
23463
23619
|
if (parent_nodes) {
|
|
23464
23620
|
block.chunks.claim.push(b `
|
|
23465
|
-
${node} = ${this.get_claim_statement(parent_nodes)};
|
|
23621
|
+
${node} = ${this.get_claim_statement(block, parent_nodes)};
|
|
23466
23622
|
`);
|
|
23467
23623
|
if (!this.void && this.node.children.length > 0) {
|
|
23468
23624
|
block.chunks.claim.push(b `
|
|
@@ -23545,12 +23701,13 @@
|
|
|
23545
23701
|
const loc = renderer.locate(this.node.start);
|
|
23546
23702
|
block.chunks.hydrate.push(b `@add_location(${this.var}, ${renderer.file_var}, ${loc.line - 1}, ${loc.column}, ${this.node.start});`);
|
|
23547
23703
|
}
|
|
23704
|
+
block.renderer.dirty(this.node.tag_expr.dynamic_dependencies());
|
|
23548
23705
|
}
|
|
23549
23706
|
can_use_textcontent() {
|
|
23550
23707
|
return this.is_static_content && this.fragment.nodes.every(node => node.node.type === 'Text' || node.node.type === 'MustacheTag');
|
|
23551
23708
|
}
|
|
23552
23709
|
get_render_statement(block) {
|
|
23553
|
-
const { name, namespace } = this.node;
|
|
23710
|
+
const { name, namespace, tag_expr } = this.node;
|
|
23554
23711
|
if (namespace === namespaces.svg) {
|
|
23555
23712
|
return x `@svg_element("${name}")`;
|
|
23556
23713
|
}
|
|
@@ -23561,20 +23718,33 @@
|
|
|
23561
23718
|
if (is) {
|
|
23562
23719
|
return x `@element_is("${name}", ${is.render_chunks(block).reduce((lhs, rhs) => x `${lhs} + ${rhs}`)})`;
|
|
23563
23720
|
}
|
|
23564
|
-
|
|
23721
|
+
const reference = tag_expr.manipulate(block);
|
|
23722
|
+
return x `@element(${reference})`;
|
|
23565
23723
|
}
|
|
23566
|
-
get_claim_statement(nodes) {
|
|
23724
|
+
get_claim_statement(block, nodes) {
|
|
23567
23725
|
const attributes = this.attributes
|
|
23568
23726
|
.filter((attr) => !(attr instanceof SpreadAttributeWrapper) && !attr.property_name)
|
|
23569
23727
|
.map((attr) => p `${attr.name}: true`);
|
|
23570
|
-
|
|
23571
|
-
|
|
23572
|
-
|
|
23728
|
+
let reference;
|
|
23729
|
+
if (this.node.tag_expr.node.type === 'Literal') {
|
|
23730
|
+
if (this.node.namespace) {
|
|
23731
|
+
reference = `"${this.node.tag_expr.node.value}"`;
|
|
23732
|
+
}
|
|
23733
|
+
else {
|
|
23734
|
+
reference = `"${(this.node.tag_expr.node.value || '').toUpperCase()}"`;
|
|
23735
|
+
}
|
|
23736
|
+
}
|
|
23737
|
+
else if (this.node.namespace) {
|
|
23738
|
+
reference = x `${this.node.tag_expr.manipulate(block)}`;
|
|
23739
|
+
}
|
|
23740
|
+
else {
|
|
23741
|
+
reference = x `(${this.node.tag_expr.manipulate(block)} || 'null').toUpperCase()`;
|
|
23742
|
+
}
|
|
23573
23743
|
if (this.node.namespace === namespaces.svg) {
|
|
23574
|
-
return x `@claim_svg_element(${nodes},
|
|
23744
|
+
return x `@claim_svg_element(${nodes}, ${reference}, { ${attributes} })`;
|
|
23575
23745
|
}
|
|
23576
23746
|
else {
|
|
23577
|
-
return x `@claim_element(${nodes},
|
|
23747
|
+
return x `@claim_element(${nodes}, ${reference}, { ${attributes} })`;
|
|
23578
23748
|
}
|
|
23579
23749
|
}
|
|
23580
23750
|
add_directives_in_order(block) {
|
|
@@ -23943,6 +24113,10 @@
|
|
|
23943
24113
|
block.chunks.measure.push(b `
|
|
23944
24114
|
${rect} = ${this.var}.getBoundingClientRect();
|
|
23945
24115
|
`);
|
|
24116
|
+
if (block.type === CHILD_DYNAMIC_ELEMENT_BLOCK) {
|
|
24117
|
+
block.chunks.measure.push(b `return ${rect}`);
|
|
24118
|
+
block.chunks.restore_measurements.push(b `${rect} = #measurement;`);
|
|
24119
|
+
}
|
|
23946
24120
|
block.chunks.fix.push(b `
|
|
23947
24121
|
@fix_position(${this.var});
|
|
23948
24122
|
${stop_animation}();
|
|
@@ -24026,7 +24200,7 @@
|
|
|
24026
24200
|
if (should_cache) {
|
|
24027
24201
|
block.chunks.update.push(b `
|
|
24028
24202
|
if (${block.renderer.dirty(dependencies)} && (${cached_snippet} !== (${cached_snippet} = ${snippet}))) {
|
|
24029
|
-
${updater}
|
|
24203
|
+
${updater}
|
|
24030
24204
|
}
|
|
24031
24205
|
`);
|
|
24032
24206
|
}
|
|
@@ -24575,6 +24749,7 @@
|
|
|
24575
24749
|
name: renderer.component.get_unique_name('create_key_block'),
|
|
24576
24750
|
type: 'key'
|
|
24577
24751
|
});
|
|
24752
|
+
block.add_dependencies(node.expression.dependencies);
|
|
24578
24753
|
renderer.blocks.push(block);
|
|
24579
24754
|
}
|
|
24580
24755
|
this.block = block;
|
|
@@ -27726,7 +27901,8 @@
|
|
|
27726
27901
|
const contenteditable = (node.name !== 'textarea' &&
|
|
27727
27902
|
node.name !== 'input' &&
|
|
27728
27903
|
node.attributes.some((attribute) => attribute.name === 'contenteditable'));
|
|
27729
|
-
renderer.add_string(
|
|
27904
|
+
renderer.add_string('<');
|
|
27905
|
+
add_tag_name();
|
|
27730
27906
|
const class_expression_list = node.classes.map(class_directive => {
|
|
27731
27907
|
const { expression, name } = class_directive;
|
|
27732
27908
|
const snippet = expression ? expression.node : x `#ctx.${name}`; // TODO is this right?
|
|
@@ -27866,14 +28042,25 @@
|
|
|
27866
28042
|
else {
|
|
27867
28043
|
renderer.add_expression(node_contents);
|
|
27868
28044
|
}
|
|
27869
|
-
|
|
27870
|
-
renderer.add_string(`</${node.name}>`);
|
|
27871
|
-
}
|
|
28045
|
+
add_close_tag();
|
|
27872
28046
|
}
|
|
27873
28047
|
else {
|
|
27874
28048
|
renderer.render(children, options);
|
|
28049
|
+
add_close_tag();
|
|
28050
|
+
}
|
|
28051
|
+
function add_close_tag() {
|
|
27875
28052
|
if (!is_void(node.name)) {
|
|
27876
|
-
renderer.add_string(
|
|
28053
|
+
renderer.add_string('</');
|
|
28054
|
+
add_tag_name();
|
|
28055
|
+
renderer.add_string('>');
|
|
28056
|
+
}
|
|
28057
|
+
}
|
|
28058
|
+
function add_tag_name() {
|
|
28059
|
+
if (node.tag_expr.node.type === 'Literal') {
|
|
28060
|
+
renderer.add_string(node.tag_expr.node.value);
|
|
28061
|
+
}
|
|
28062
|
+
else {
|
|
28063
|
+
renderer.add_expression(node.tag_expr.node);
|
|
27877
28064
|
}
|
|
27878
28065
|
}
|
|
27879
28066
|
}
|
|
@@ -30182,6 +30369,10 @@
|
|
|
30182
30369
|
const first = this.node.value.children
|
|
30183
30370
|
? this.node.value.children[0]
|
|
30184
30371
|
: this.node.value;
|
|
30372
|
+
// Don't minify whitespace in custom properties, since some browsers (Chromium < 99)
|
|
30373
|
+
// treat --foo: ; and --foo:; differently
|
|
30374
|
+
if (first.type === 'Raw' && /^\s+$/.test(first.value))
|
|
30375
|
+
return;
|
|
30185
30376
|
let start = first.start;
|
|
30186
30377
|
while (/\s/.test(code.original[start]))
|
|
30187
30378
|
start += 1;
|
|
@@ -30490,7 +30681,7 @@
|
|
|
30490
30681
|
}
|
|
30491
30682
|
|
|
30492
30683
|
// This file is automatically generated
|
|
30493
|
-
var internal_exports = new Set(["HtmlTag", "HtmlTagHydration", "SvelteComponent", "SvelteComponentDev", "SvelteComponentTyped", "SvelteElement", "action_destroyer", "add_attribute", "add_classes", "add_flush_callback", "add_location", "add_render_callback", "add_resize_listener", "add_styles", "add_transform", "afterUpdate", "append", "append_dev", "append_empty_stylesheet", "append_hydration", "append_hydration_dev", "append_styles", "assign", "attr", "attr_dev", "attribute_to_object", "beforeUpdate", "bind", "binding_callbacks", "blank_object", "bubble", "check_outros", "children", "claim_component", "claim_element", "claim_html_tag", "claim_space", "claim_svg_element", "claim_text", "clear_loops", "component_subscribe", "compute_rest_props", "compute_slots", "createEventDispatcher", "create_animation", "create_bidirectional_transition", "create_component", "create_in_transition", "create_out_transition", "create_slot", "create_ssr_component", "current_component", "custom_event", "dataset_dev", "debug", "destroy_block", "destroy_component", "destroy_each", "detach", "detach_after_dev", "detach_before_dev", "detach_between_dev", "detach_dev", "dirty_components", "dispatch_dev", "each", "element", "element_is", "empty", "end_hydrating", "escape", "escape_attribute_value", "escape_object", "escaped", "exclude_internal_props", "fix_and_destroy_block", "fix_and_outro_and_destroy_block", "fix_position", "flush", "getAllContexts", "getContext", "get_all_dirty_from_scope", "get_binding_group_value", "get_current_component", "get_custom_elements_slots", "get_root_for_style", "get_slot_changes", "get_spread_object", "get_spread_update", "get_store_value", "globals", "group_outros", "handle_promise", "hasContext", "has_prop", "identity", "init", "insert", "insert_dev", "insert_hydration", "insert_hydration_dev", "intros", "invalid_attribute_name_character", "is_client", "is_crossorigin", "is_empty", "is_function", "is_promise", "listen", "listen_dev", "loop", "loop_guard", "merge_ssr_styles", "missing_component", "mount_component", "noop", "not_equal", "now", "null_to_empty", "object_without_properties", "onDestroy", "onMount", "once", "outro_and_destroy_block", "prevent_default", "prop_dev", "query_selector_all", "raf", "run", "run_all", "safe_not_equal", "schedule_update", "select_multiple_value", "select_option", "select_options", "select_value", "self", "setContext", "set_attributes", "set_current_component", "set_custom_element_data", "set_data", "set_data_dev", "set_input_type", "set_input_value", "set_now", "set_raf", "set_store_value", "set_style", "set_svg_attributes", "space", "spread", "src_url_equal", "start_hydrating", "stop_propagation", "subscribe", "svg_element", "text", "tick", "time_ranges_to_array", "to_number", "toggle_class", "transition_in", "transition_out", "trusted", "update_await_block_branch", "update_keyed_each", "update_slot", "update_slot_base", "validate_component", "validate_each_argument", "validate_each_keys", "validate_slots", "validate_store", "xlink_attr"]);
|
|
30684
|
+
var internal_exports = new Set(["HtmlTag", "HtmlTagHydration", "SvelteComponent", "SvelteComponentDev", "SvelteComponentTyped", "SvelteElement", "action_destroyer", "add_attribute", "add_classes", "add_flush_callback", "add_location", "add_render_callback", "add_resize_listener", "add_styles", "add_transform", "afterUpdate", "append", "append_dev", "append_empty_stylesheet", "append_hydration", "append_hydration_dev", "append_styles", "assign", "attr", "attr_dev", "attribute_to_object", "beforeUpdate", "bind", "binding_callbacks", "blank_object", "bubble", "check_outros", "children", "claim_component", "claim_element", "claim_html_tag", "claim_space", "claim_svg_element", "claim_text", "clear_loops", "component_subscribe", "compute_rest_props", "compute_slots", "createEventDispatcher", "create_animation", "create_bidirectional_transition", "create_component", "create_in_transition", "create_out_transition", "create_slot", "create_ssr_component", "current_component", "custom_event", "dataset_dev", "debug", "destroy_block", "destroy_component", "destroy_each", "detach", "detach_after_dev", "detach_before_dev", "detach_between_dev", "detach_dev", "dirty_components", "dispatch_dev", "each", "element", "element_is", "empty", "end_hydrating", "escape", "escape_attribute_value", "escape_object", "escaped", "exclude_internal_props", "fix_and_destroy_block", "fix_and_outro_and_destroy_block", "fix_position", "flush", "getAllContexts", "getContext", "get_all_dirty_from_scope", "get_binding_group_value", "get_current_component", "get_custom_elements_slots", "get_root_for_style", "get_slot_changes", "get_spread_object", "get_spread_update", "get_store_value", "globals", "group_outros", "handle_promise", "hasContext", "has_prop", "identity", "init", "insert", "insert_dev", "insert_hydration", "insert_hydration_dev", "intros", "invalid_attribute_name_character", "is_client", "is_crossorigin", "is_empty", "is_function", "is_promise", "listen", "listen_dev", "loop", "loop_guard", "merge_ssr_styles", "missing_component", "mount_component", "noop", "not_equal", "now", "null_to_empty", "object_without_properties", "onDestroy", "onMount", "once", "outro_and_destroy_block", "prevent_default", "prop_dev", "query_selector_all", "raf", "run", "run_all", "safe_not_equal", "schedule_update", "select_multiple_value", "select_option", "select_options", "select_value", "self", "setContext", "set_attributes", "set_current_component", "set_custom_element_data", "set_data", "set_data_dev", "set_input_type", "set_input_value", "set_now", "set_raf", "set_store_value", "set_style", "set_svg_attributes", "space", "spread", "src_url_equal", "start_hydrating", "stop_propagation", "subscribe", "svg_element", "text", "tick", "time_ranges_to_array", "to_number", "toggle_class", "transition_in", "transition_out", "trusted", "update_await_block_branch", "update_keyed_each", "update_slot", "update_slot_base", "validate_component", "validate_dynamic_element", "validate_each_argument", "validate_each_keys", "validate_slots", "validate_store", "xlink_attr"]);
|
|
30494
30685
|
|
|
30495
30686
|
function is_used_as_reference(node, parent) {
|
|
30496
30687
|
if (!is_reference(node, parent)) {
|
|
@@ -30672,7 +30863,7 @@
|
|
|
30672
30863
|
if (result) {
|
|
30673
30864
|
const { compile_options, name } = this;
|
|
30674
30865
|
const { format = 'esm' } = compile_options;
|
|
30675
|
-
const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${'3.
|
|
30866
|
+
const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${'3.47.0'}`;
|
|
30676
30867
|
const program = { type: 'Program', body: result.js };
|
|
30677
30868
|
walk(program, {
|
|
30678
30869
|
enter: (node, parent, key) => {
|
|
@@ -30883,7 +31074,7 @@
|
|
|
30883
31074
|
extract_names(declarator.id).forEach(name => {
|
|
30884
31075
|
const variable = this.var_lookup.get(name);
|
|
30885
31076
|
variable.export_name = name;
|
|
30886
|
-
if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
|
|
31077
|
+
if (!module_script && variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
|
|
30887
31078
|
this.warn(declarator, compiler_warnings.unused_export_let(this.name.name, name));
|
|
30888
31079
|
}
|
|
30889
31080
|
});
|
|
@@ -30901,7 +31092,7 @@
|
|
|
30901
31092
|
const variable = this.var_lookup.get(specifier.local.name);
|
|
30902
31093
|
if (variable) {
|
|
30903
31094
|
variable.export_name = specifier.exported.name;
|
|
30904
|
-
if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
|
|
31095
|
+
if (!module_script && variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
|
|
30905
31096
|
this.warn(specifier, compiler_warnings.unused_export_let(this.name.name, specifier.exported.name));
|
|
30906
31097
|
}
|
|
30907
31098
|
}
|
|
@@ -32165,7 +32356,7 @@
|
|
|
32165
32356
|
return result.to_processed();
|
|
32166
32357
|
}
|
|
32167
32358
|
|
|
32168
|
-
const VERSION = '3.
|
|
32359
|
+
const VERSION = '3.47.0';
|
|
32169
32360
|
|
|
32170
32361
|
exports.VERSION = VERSION;
|
|
32171
32362
|
exports.compile = compile;
|