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/compiler.mjs
CHANGED
|
@@ -5848,6 +5848,7 @@ const globals = new Set([
|
|
|
5848
5848
|
'setTimeout',
|
|
5849
5849
|
'String',
|
|
5850
5850
|
'SVGElement',
|
|
5851
|
+
'Symbol',
|
|
5851
5852
|
'SyntaxError',
|
|
5852
5853
|
'TypeError',
|
|
5853
5854
|
'undefined',
|
|
@@ -6031,6 +6032,10 @@ var parser_errors = {
|
|
|
6031
6032
|
code: `invalid-${slug}-content`,
|
|
6032
6033
|
message: `<${name}> cannot have children`
|
|
6033
6034
|
}),
|
|
6035
|
+
invalid_element_definition: {
|
|
6036
|
+
code: 'invalid-element-definition',
|
|
6037
|
+
message: 'Invalid element definition'
|
|
6038
|
+
},
|
|
6034
6039
|
invalid_element_placement: (slug, name) => ({
|
|
6035
6040
|
code: `invalid-${slug}-placement`,
|
|
6036
6041
|
message: `<${name}> tags cannot be inside elements or blocks`
|
|
@@ -6091,6 +6096,10 @@ var parser_errors = {
|
|
|
6091
6096
|
code: 'missing-attribute-value',
|
|
6092
6097
|
message: 'Expected value for the attribute'
|
|
6093
6098
|
},
|
|
6099
|
+
missing_element_definition: {
|
|
6100
|
+
code: 'missing-element-definition',
|
|
6101
|
+
message: '<svelte:element> must have a \'this\' attribute'
|
|
6102
|
+
},
|
|
6094
6103
|
unclosed_script: {
|
|
6095
6104
|
code: 'unclosed-script',
|
|
6096
6105
|
message: '<script> must have a closing tag'
|
|
@@ -16679,7 +16688,7 @@ const meta_tags = new Map([
|
|
|
16679
16688
|
['svelte:window', 'Window'],
|
|
16680
16689
|
['svelte:body', 'Body']
|
|
16681
16690
|
]);
|
|
16682
|
-
const valid_meta_tags = Array.from(meta_tags.keys()).concat('svelte:self', 'svelte:component', 'svelte:fragment');
|
|
16691
|
+
const valid_meta_tags = Array.from(meta_tags.keys()).concat('svelte:self', 'svelte:component', 'svelte:fragment', 'svelte:element');
|
|
16683
16692
|
const specials = new Map([
|
|
16684
16693
|
[
|
|
16685
16694
|
'script',
|
|
@@ -16699,6 +16708,7 @@ const specials = new Map([
|
|
|
16699
16708
|
const SELF = /^svelte:self(?=[\s/>])/;
|
|
16700
16709
|
const COMPONENT = /^svelte:component(?=[\s/>])/;
|
|
16701
16710
|
const SLOT = /^svelte:fragment(?=[\s/>])/;
|
|
16711
|
+
const ELEMENT = /^svelte:element(?=[\s/>])/;
|
|
16702
16712
|
function parent_is_head(stack) {
|
|
16703
16713
|
let i = stack.length;
|
|
16704
16714
|
while (i--) {
|
|
@@ -16801,7 +16811,7 @@ function tag(parser) {
|
|
|
16801
16811
|
}
|
|
16802
16812
|
if (name === 'svelte:component') {
|
|
16803
16813
|
const index = element.attributes.findIndex(attr => attr.type === 'Attribute' && attr.name === 'this');
|
|
16804
|
-
if (
|
|
16814
|
+
if (index === -1) {
|
|
16805
16815
|
parser.error(parser_errors.missing_component_definition, start);
|
|
16806
16816
|
}
|
|
16807
16817
|
const definition = element.attributes.splice(index, 1)[0];
|
|
@@ -16810,6 +16820,17 @@ function tag(parser) {
|
|
|
16810
16820
|
}
|
|
16811
16821
|
element.expression = definition.value[0].expression;
|
|
16812
16822
|
}
|
|
16823
|
+
if (name === 'svelte:element') {
|
|
16824
|
+
const index = element.attributes.findIndex(attr => attr.type === 'Attribute' && attr.name === 'this');
|
|
16825
|
+
if (index === -1) {
|
|
16826
|
+
parser.error(parser_errors.missing_element_definition, start);
|
|
16827
|
+
}
|
|
16828
|
+
const definition = element.attributes.splice(index, 1)[0];
|
|
16829
|
+
if (definition.value === true) {
|
|
16830
|
+
parser.error(parser_errors.invalid_element_definition, definition.start);
|
|
16831
|
+
}
|
|
16832
|
+
element.tag = definition.value[0].data || definition.value[0].expression;
|
|
16833
|
+
}
|
|
16813
16834
|
// special cases – top-level <script> and <style>
|
|
16814
16835
|
if (specials.has(name) && parser.stack.length === 1) {
|
|
16815
16836
|
const special = specials.get(name);
|
|
@@ -16866,6 +16887,8 @@ function read_tag_name(parser) {
|
|
|
16866
16887
|
}
|
|
16867
16888
|
if (parser.read(COMPONENT))
|
|
16868
16889
|
return 'svelte:component';
|
|
16890
|
+
if (parser.read(ELEMENT))
|
|
16891
|
+
return 'svelte:element';
|
|
16869
16892
|
if (parser.read(SLOT))
|
|
16870
16893
|
return 'svelte:fragment';
|
|
16871
16894
|
const name = parser.read_until(/(\s|\/|>)/);
|
|
@@ -17906,6 +17929,7 @@ class Block$1 {
|
|
|
17906
17929
|
hydrate: [],
|
|
17907
17930
|
mount: [],
|
|
17908
17931
|
measure: [],
|
|
17932
|
+
restore_measurements: [],
|
|
17909
17933
|
fix: [],
|
|
17910
17934
|
animate: [],
|
|
17911
17935
|
intro: [],
|
|
@@ -18094,6 +18118,11 @@ class Block$1 {
|
|
|
18094
18118
|
properties.measure = x `function #measure() {
|
|
18095
18119
|
${this.chunks.measure}
|
|
18096
18120
|
}`;
|
|
18121
|
+
if (this.chunks.restore_measurements.length) {
|
|
18122
|
+
properties.restore_measurements = x `function #restore_measurements(#measurement) {
|
|
18123
|
+
${this.chunks.restore_measurements}
|
|
18124
|
+
}`;
|
|
18125
|
+
}
|
|
18097
18126
|
properties.fix = x `function #fix() {
|
|
18098
18127
|
${this.chunks.fix}
|
|
18099
18128
|
}`;
|
|
@@ -18145,6 +18174,7 @@ class Block$1 {
|
|
|
18145
18174
|
m: ${properties.mount},
|
|
18146
18175
|
p: ${properties.update},
|
|
18147
18176
|
r: ${properties.measure},
|
|
18177
|
+
s: ${properties.restore_measurements},
|
|
18148
18178
|
f: ${properties.fix},
|
|
18149
18179
|
a: ${properties.animate},
|
|
18150
18180
|
i: ${properties.intro},
|
|
@@ -19046,6 +19076,10 @@ var compiler_errors = {
|
|
|
19046
19076
|
code: 'invalid-animation',
|
|
19047
19077
|
message: 'An element that uses the animate directive must be the sole child of a keyed each block'
|
|
19048
19078
|
},
|
|
19079
|
+
invalid_animation_dynamic_element: {
|
|
19080
|
+
code: 'invalid-animation',
|
|
19081
|
+
message: '<svelte:element> cannot have a animate directive'
|
|
19082
|
+
},
|
|
19049
19083
|
invalid_directive_value: {
|
|
19050
19084
|
code: 'invalid-directive-value',
|
|
19051
19085
|
message: 'Can only bind to an identifier (e.g. `foo`) or a member expression (e.g. `foo.bar` or `foo[baz]`)'
|
|
@@ -19258,11 +19292,20 @@ class Expression {
|
|
|
19258
19292
|
const id = component.get_unique_name(sanitize(get_function_name(node, owner)));
|
|
19259
19293
|
const declaration = b `const ${id} = ${node}`;
|
|
19260
19294
|
if (owner.type === 'ConstTag') {
|
|
19295
|
+
let child_scope = scope;
|
|
19261
19296
|
walk(node, {
|
|
19262
|
-
enter(node) {
|
|
19263
|
-
if (node
|
|
19297
|
+
enter(node, parent) {
|
|
19298
|
+
if (map.has(node))
|
|
19299
|
+
child_scope = map.get(node);
|
|
19300
|
+
if (node.type === 'Identifier' && is_reference(node, parent)) {
|
|
19301
|
+
if (child_scope.has(node.name))
|
|
19302
|
+
return;
|
|
19264
19303
|
this.replace(block.renderer.reference(node, ctx));
|
|
19265
19304
|
}
|
|
19305
|
+
},
|
|
19306
|
+
leave(node) {
|
|
19307
|
+
if (map.has(node))
|
|
19308
|
+
child_scope = child_scope.parent;
|
|
19266
19309
|
}
|
|
19267
19310
|
});
|
|
19268
19311
|
}
|
|
@@ -20171,7 +20214,7 @@ class Let extends Node$1 {
|
|
|
20171
20214
|
}
|
|
20172
20215
|
|
|
20173
20216
|
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)$/;
|
|
20174
|
-
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(' ');
|
|
20217
|
+
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(' ');
|
|
20175
20218
|
const aria_attribute_set = new Set(aria_attributes);
|
|
20176
20219
|
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(' ');
|
|
20177
20220
|
const aria_role_set = new Set(aria_roles);
|
|
@@ -20315,6 +20358,17 @@ class Element extends Node$1 {
|
|
|
20315
20358
|
this.outro = null;
|
|
20316
20359
|
this.animation = null;
|
|
20317
20360
|
this.name = info.name;
|
|
20361
|
+
if (info.name === 'svelte:element') {
|
|
20362
|
+
if (typeof info.tag !== 'string') {
|
|
20363
|
+
this.tag_expr = new Expression(component, this, scope, info.tag);
|
|
20364
|
+
}
|
|
20365
|
+
else {
|
|
20366
|
+
this.tag_expr = new Expression(component, this, scope, string_literal(info.tag));
|
|
20367
|
+
}
|
|
20368
|
+
}
|
|
20369
|
+
else {
|
|
20370
|
+
this.tag_expr = new Expression(component, this, scope, string_literal(this.name));
|
|
20371
|
+
}
|
|
20318
20372
|
this.namespace = get_namespace(parent, this, component.namespace);
|
|
20319
20373
|
if (this.namespace !== namespaces.foreign) {
|
|
20320
20374
|
if (this.name === 'textarea') {
|
|
@@ -20411,6 +20465,9 @@ class Element extends Node$1 {
|
|
|
20411
20465
|
this.optimise();
|
|
20412
20466
|
component.apply_stylesheet(this);
|
|
20413
20467
|
}
|
|
20468
|
+
get is_dynamic_element() {
|
|
20469
|
+
return this.name === 'svelte:element';
|
|
20470
|
+
}
|
|
20414
20471
|
validate() {
|
|
20415
20472
|
if (this.component.var_lookup.has(this.name) && this.component.var_lookup.get(this.name).imported) {
|
|
20416
20473
|
this.component.warn(this, compiler_warnings.component_name_lowercase(this.name));
|
|
@@ -23378,9 +23435,21 @@ const events = [
|
|
|
23378
23435
|
filter: (node, _name) => node.name === 'details'
|
|
23379
23436
|
}
|
|
23380
23437
|
];
|
|
23438
|
+
const CHILD_DYNAMIC_ELEMENT_BLOCK = 'child_dynamic_element';
|
|
23381
23439
|
class ElementWrapper extends Wrapper {
|
|
23382
23440
|
constructor(renderer, block, parent, node, strip_whitespace, next_sibling) {
|
|
23383
23441
|
super(renderer, block, parent, node);
|
|
23442
|
+
this.child_dynamic_element_block = null;
|
|
23443
|
+
this.child_dynamic_element = null;
|
|
23444
|
+
if (node.is_dynamic_element && block.type !== CHILD_DYNAMIC_ELEMENT_BLOCK) {
|
|
23445
|
+
this.child_dynamic_element_block = block.child({
|
|
23446
|
+
comment: create_debugging_comment(node, renderer.component),
|
|
23447
|
+
name: renderer.component.get_unique_name('create_dynamic_element'),
|
|
23448
|
+
type: CHILD_DYNAMIC_ELEMENT_BLOCK
|
|
23449
|
+
});
|
|
23450
|
+
renderer.blocks.push(this.child_dynamic_element_block);
|
|
23451
|
+
this.child_dynamic_element = new ElementWrapper(renderer, this.child_dynamic_element_block, parent, node, strip_whitespace, next_sibling);
|
|
23452
|
+
}
|
|
23384
23453
|
this.var = {
|
|
23385
23454
|
type: 'Identifier',
|
|
23386
23455
|
name: node.name.replace(/[^a-zA-Z0-9_$]/g, '_')
|
|
@@ -23417,6 +23486,7 @@ class ElementWrapper extends Wrapper {
|
|
|
23417
23486
|
if (node.animation) {
|
|
23418
23487
|
block.add_animation();
|
|
23419
23488
|
}
|
|
23489
|
+
block.add_dependencies(node.tag_expr.dependencies);
|
|
23420
23490
|
// add directive and handler dependencies
|
|
23421
23491
|
[node.animation, node.outro, ...node.actions, ...node.classes, ...node.styles].forEach(directive => {
|
|
23422
23492
|
if (directive && directive.expression) {
|
|
@@ -23435,7 +23505,9 @@ class ElementWrapper extends Wrapper {
|
|
|
23435
23505
|
node.classes.length > 0 ||
|
|
23436
23506
|
node.intro || node.outro ||
|
|
23437
23507
|
node.handlers.length > 0 ||
|
|
23508
|
+
node.styles.length > 0 ||
|
|
23438
23509
|
this.node.name === 'option' ||
|
|
23510
|
+
node.tag_expr.dynamic_dependencies().length ||
|
|
23439
23511
|
renderer.options.dev) {
|
|
23440
23512
|
this.parent.cannot_use_innerhtml(); // need to use add_location
|
|
23441
23513
|
this.parent.not_static_content();
|
|
@@ -23444,6 +23516,90 @@ class ElementWrapper extends Wrapper {
|
|
|
23444
23516
|
this.fragment = new FragmentWrapper(renderer, block, node.children, this, strip_whitespace, next_sibling);
|
|
23445
23517
|
}
|
|
23446
23518
|
render(block, parent_node, parent_nodes) {
|
|
23519
|
+
if (this.child_dynamic_element) {
|
|
23520
|
+
this.render_dynamic_element(block, parent_node, parent_nodes);
|
|
23521
|
+
}
|
|
23522
|
+
else {
|
|
23523
|
+
this.render_element(block, parent_node, parent_nodes);
|
|
23524
|
+
}
|
|
23525
|
+
}
|
|
23526
|
+
render_dynamic_element(block, parent_node, parent_nodes) {
|
|
23527
|
+
this.child_dynamic_element.render(this.child_dynamic_element_block, null, x `#nodes`);
|
|
23528
|
+
const previous_tag = block.get_unique_name('previous_tag');
|
|
23529
|
+
const tag = this.node.tag_expr.manipulate(block);
|
|
23530
|
+
block.add_variable(previous_tag, tag);
|
|
23531
|
+
block.chunks.init.push(b `
|
|
23532
|
+
${this.renderer.options.dev && b `@validate_dynamic_element(${tag});`}
|
|
23533
|
+
let ${this.var} = ${tag} && ${this.child_dynamic_element_block.name}(#ctx);
|
|
23534
|
+
`);
|
|
23535
|
+
block.chunks.create.push(b `
|
|
23536
|
+
if (${this.var}) ${this.var}.c();
|
|
23537
|
+
`);
|
|
23538
|
+
if (this.renderer.options.hydratable) {
|
|
23539
|
+
block.chunks.claim.push(b `
|
|
23540
|
+
if (${this.var}) ${this.var}.l(${parent_nodes});
|
|
23541
|
+
`);
|
|
23542
|
+
}
|
|
23543
|
+
block.chunks.mount.push(b `
|
|
23544
|
+
if (${this.var}) ${this.var}.m(${parent_node || '#target'}, ${parent_node ? 'null' : '#anchor'});
|
|
23545
|
+
`);
|
|
23546
|
+
const anchor = this.get_or_create_anchor(block, parent_node, parent_nodes);
|
|
23547
|
+
const has_transitions = !!(this.node.intro || this.node.outro);
|
|
23548
|
+
const not_equal = this.renderer.component.component_options.immutable ? x `@not_equal` : x `@safe_not_equal`;
|
|
23549
|
+
block.chunks.update.push(b `
|
|
23550
|
+
if (${tag}) {
|
|
23551
|
+
if (!${previous_tag}) {
|
|
23552
|
+
${this.var} = ${this.child_dynamic_element_block.name}(#ctx);
|
|
23553
|
+
${this.var}.c();
|
|
23554
|
+
${has_transitions && b `@transition_in(${this.var})`}
|
|
23555
|
+
${this.var}.m(${this.get_update_mount_node(anchor)}, ${anchor});
|
|
23556
|
+
} else if (${not_equal}(${previous_tag}, ${tag})) {
|
|
23557
|
+
${this.var}.d(1);
|
|
23558
|
+
${this.renderer.options.dev && b `@validate_dynamic_element(${tag});`}
|
|
23559
|
+
${this.var} = ${this.child_dynamic_element_block.name}(#ctx);
|
|
23560
|
+
${this.var}.c();
|
|
23561
|
+
${this.var}.m(${this.get_update_mount_node(anchor)}, ${anchor});
|
|
23562
|
+
} else {
|
|
23563
|
+
${this.var}.p(#ctx, #dirty);
|
|
23564
|
+
}
|
|
23565
|
+
} else if (${previous_tag}) {
|
|
23566
|
+
${has_transitions
|
|
23567
|
+
? b `
|
|
23568
|
+
@group_outros();
|
|
23569
|
+
@transition_out(${this.var}, 1, 1, () => {
|
|
23570
|
+
${this.var} = null;
|
|
23571
|
+
});
|
|
23572
|
+
@check_outros();
|
|
23573
|
+
`
|
|
23574
|
+
: b `
|
|
23575
|
+
${this.var}.d(1);
|
|
23576
|
+
${this.var} = null;
|
|
23577
|
+
`}
|
|
23578
|
+
}
|
|
23579
|
+
${previous_tag} = ${tag};
|
|
23580
|
+
`);
|
|
23581
|
+
if (this.child_dynamic_element_block.has_intros) {
|
|
23582
|
+
block.chunks.intro.push(b `@transition_in(${this.var});`);
|
|
23583
|
+
}
|
|
23584
|
+
if (this.child_dynamic_element_block.has_outros) {
|
|
23585
|
+
block.chunks.outro.push(b `@transition_out(${this.var});`);
|
|
23586
|
+
}
|
|
23587
|
+
block.chunks.destroy.push(b `if (${this.var}) ${this.var}.d(detaching)`);
|
|
23588
|
+
if (this.node.animation) {
|
|
23589
|
+
const measurements = block.get_unique_name('measurements');
|
|
23590
|
+
block.add_variable(measurements);
|
|
23591
|
+
block.chunks.measure.push(b `${measurements} = ${this.var}.r()`);
|
|
23592
|
+
block.chunks.fix.push(b `${this.var}.f();`);
|
|
23593
|
+
block.chunks.animate.push(b `
|
|
23594
|
+
${this.var}.s(${measurements});
|
|
23595
|
+
${this.var}.a()
|
|
23596
|
+
`);
|
|
23597
|
+
}
|
|
23598
|
+
}
|
|
23599
|
+
is_dom_node() {
|
|
23600
|
+
return super.is_dom_node() && !this.child_dynamic_element;
|
|
23601
|
+
}
|
|
23602
|
+
render_element(block, parent_node, parent_nodes) {
|
|
23447
23603
|
const { renderer } = this;
|
|
23448
23604
|
if (this.node.name === 'noscript')
|
|
23449
23605
|
return;
|
|
@@ -23456,7 +23612,7 @@ class ElementWrapper extends Wrapper {
|
|
|
23456
23612
|
if (renderer.options.hydratable) {
|
|
23457
23613
|
if (parent_nodes) {
|
|
23458
23614
|
block.chunks.claim.push(b `
|
|
23459
|
-
${node} = ${this.get_claim_statement(parent_nodes)};
|
|
23615
|
+
${node} = ${this.get_claim_statement(block, parent_nodes)};
|
|
23460
23616
|
`);
|
|
23461
23617
|
if (!this.void && this.node.children.length > 0) {
|
|
23462
23618
|
block.chunks.claim.push(b `
|
|
@@ -23539,12 +23695,13 @@ class ElementWrapper extends Wrapper {
|
|
|
23539
23695
|
const loc = renderer.locate(this.node.start);
|
|
23540
23696
|
block.chunks.hydrate.push(b `@add_location(${this.var}, ${renderer.file_var}, ${loc.line - 1}, ${loc.column}, ${this.node.start});`);
|
|
23541
23697
|
}
|
|
23698
|
+
block.renderer.dirty(this.node.tag_expr.dynamic_dependencies());
|
|
23542
23699
|
}
|
|
23543
23700
|
can_use_textcontent() {
|
|
23544
23701
|
return this.is_static_content && this.fragment.nodes.every(node => node.node.type === 'Text' || node.node.type === 'MustacheTag');
|
|
23545
23702
|
}
|
|
23546
23703
|
get_render_statement(block) {
|
|
23547
|
-
const { name, namespace } = this.node;
|
|
23704
|
+
const { name, namespace, tag_expr } = this.node;
|
|
23548
23705
|
if (namespace === namespaces.svg) {
|
|
23549
23706
|
return x `@svg_element("${name}")`;
|
|
23550
23707
|
}
|
|
@@ -23555,20 +23712,33 @@ class ElementWrapper extends Wrapper {
|
|
|
23555
23712
|
if (is) {
|
|
23556
23713
|
return x `@element_is("${name}", ${is.render_chunks(block).reduce((lhs, rhs) => x `${lhs} + ${rhs}`)})`;
|
|
23557
23714
|
}
|
|
23558
|
-
|
|
23715
|
+
const reference = tag_expr.manipulate(block);
|
|
23716
|
+
return x `@element(${reference})`;
|
|
23559
23717
|
}
|
|
23560
|
-
get_claim_statement(nodes) {
|
|
23718
|
+
get_claim_statement(block, nodes) {
|
|
23561
23719
|
const attributes = this.attributes
|
|
23562
23720
|
.filter((attr) => !(attr instanceof SpreadAttributeWrapper) && !attr.property_name)
|
|
23563
23721
|
.map((attr) => p `${attr.name}: true`);
|
|
23564
|
-
|
|
23565
|
-
|
|
23566
|
-
|
|
23722
|
+
let reference;
|
|
23723
|
+
if (this.node.tag_expr.node.type === 'Literal') {
|
|
23724
|
+
if (this.node.namespace) {
|
|
23725
|
+
reference = `"${this.node.tag_expr.node.value}"`;
|
|
23726
|
+
}
|
|
23727
|
+
else {
|
|
23728
|
+
reference = `"${(this.node.tag_expr.node.value || '').toUpperCase()}"`;
|
|
23729
|
+
}
|
|
23730
|
+
}
|
|
23731
|
+
else if (this.node.namespace) {
|
|
23732
|
+
reference = x `${this.node.tag_expr.manipulate(block)}`;
|
|
23733
|
+
}
|
|
23734
|
+
else {
|
|
23735
|
+
reference = x `(${this.node.tag_expr.manipulate(block)} || 'null').toUpperCase()`;
|
|
23736
|
+
}
|
|
23567
23737
|
if (this.node.namespace === namespaces.svg) {
|
|
23568
|
-
return x `@claim_svg_element(${nodes},
|
|
23738
|
+
return x `@claim_svg_element(${nodes}, ${reference}, { ${attributes} })`;
|
|
23569
23739
|
}
|
|
23570
23740
|
else {
|
|
23571
|
-
return x `@claim_element(${nodes},
|
|
23741
|
+
return x `@claim_element(${nodes}, ${reference}, { ${attributes} })`;
|
|
23572
23742
|
}
|
|
23573
23743
|
}
|
|
23574
23744
|
add_directives_in_order(block) {
|
|
@@ -23937,6 +24107,10 @@ class ElementWrapper extends Wrapper {
|
|
|
23937
24107
|
block.chunks.measure.push(b `
|
|
23938
24108
|
${rect} = ${this.var}.getBoundingClientRect();
|
|
23939
24109
|
`);
|
|
24110
|
+
if (block.type === CHILD_DYNAMIC_ELEMENT_BLOCK) {
|
|
24111
|
+
block.chunks.measure.push(b `return ${rect}`);
|
|
24112
|
+
block.chunks.restore_measurements.push(b `${rect} = #measurement;`);
|
|
24113
|
+
}
|
|
23940
24114
|
block.chunks.fix.push(b `
|
|
23941
24115
|
@fix_position(${this.var});
|
|
23942
24116
|
${stop_animation}();
|
|
@@ -24020,7 +24194,7 @@ class ElementWrapper extends Wrapper {
|
|
|
24020
24194
|
if (should_cache) {
|
|
24021
24195
|
block.chunks.update.push(b `
|
|
24022
24196
|
if (${block.renderer.dirty(dependencies)} && (${cached_snippet} !== (${cached_snippet} = ${snippet}))) {
|
|
24023
|
-
${updater}
|
|
24197
|
+
${updater}
|
|
24024
24198
|
}
|
|
24025
24199
|
`);
|
|
24026
24200
|
}
|
|
@@ -24569,6 +24743,7 @@ class KeyBlockWrapper extends Wrapper {
|
|
|
24569
24743
|
name: renderer.component.get_unique_name('create_key_block'),
|
|
24570
24744
|
type: 'key'
|
|
24571
24745
|
});
|
|
24746
|
+
block.add_dependencies(node.expression.dependencies);
|
|
24572
24747
|
renderer.blocks.push(block);
|
|
24573
24748
|
}
|
|
24574
24749
|
this.block = block;
|
|
@@ -27720,7 +27895,8 @@ function Element$1 (node, renderer, options) {
|
|
|
27720
27895
|
const contenteditable = (node.name !== 'textarea' &&
|
|
27721
27896
|
node.name !== 'input' &&
|
|
27722
27897
|
node.attributes.some((attribute) => attribute.name === 'contenteditable'));
|
|
27723
|
-
renderer.add_string(
|
|
27898
|
+
renderer.add_string('<');
|
|
27899
|
+
add_tag_name();
|
|
27724
27900
|
const class_expression_list = node.classes.map(class_directive => {
|
|
27725
27901
|
const { expression, name } = class_directive;
|
|
27726
27902
|
const snippet = expression ? expression.node : x `#ctx.${name}`; // TODO is this right?
|
|
@@ -27860,14 +28036,25 @@ function Element$1 (node, renderer, options) {
|
|
|
27860
28036
|
else {
|
|
27861
28037
|
renderer.add_expression(node_contents);
|
|
27862
28038
|
}
|
|
27863
|
-
|
|
27864
|
-
renderer.add_string(`</${node.name}>`);
|
|
27865
|
-
}
|
|
28039
|
+
add_close_tag();
|
|
27866
28040
|
}
|
|
27867
28041
|
else {
|
|
27868
28042
|
renderer.render(children, options);
|
|
28043
|
+
add_close_tag();
|
|
28044
|
+
}
|
|
28045
|
+
function add_close_tag() {
|
|
27869
28046
|
if (!is_void(node.name)) {
|
|
27870
|
-
renderer.add_string(
|
|
28047
|
+
renderer.add_string('</');
|
|
28048
|
+
add_tag_name();
|
|
28049
|
+
renderer.add_string('>');
|
|
28050
|
+
}
|
|
28051
|
+
}
|
|
28052
|
+
function add_tag_name() {
|
|
28053
|
+
if (node.tag_expr.node.type === 'Literal') {
|
|
28054
|
+
renderer.add_string(node.tag_expr.node.value);
|
|
28055
|
+
}
|
|
28056
|
+
else {
|
|
28057
|
+
renderer.add_expression(node.tag_expr.node);
|
|
27871
28058
|
}
|
|
27872
28059
|
}
|
|
27873
28060
|
}
|
|
@@ -30176,6 +30363,10 @@ class Declaration$1 {
|
|
|
30176
30363
|
const first = this.node.value.children
|
|
30177
30364
|
? this.node.value.children[0]
|
|
30178
30365
|
: this.node.value;
|
|
30366
|
+
// Don't minify whitespace in custom properties, since some browsers (Chromium < 99)
|
|
30367
|
+
// treat --foo: ; and --foo:; differently
|
|
30368
|
+
if (first.type === 'Raw' && /^\s+$/.test(first.value))
|
|
30369
|
+
return;
|
|
30179
30370
|
let start = first.start;
|
|
30180
30371
|
while (/\s/.test(code.original[start]))
|
|
30181
30372
|
start += 1;
|
|
@@ -30484,7 +30675,7 @@ class Fragment extends Node$1 {
|
|
|
30484
30675
|
}
|
|
30485
30676
|
|
|
30486
30677
|
// This file is automatically generated
|
|
30487
|
-
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"]);
|
|
30678
|
+
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"]);
|
|
30488
30679
|
|
|
30489
30680
|
function is_used_as_reference(node, parent) {
|
|
30490
30681
|
if (!is_reference(node, parent)) {
|
|
@@ -30666,7 +30857,7 @@ class Component {
|
|
|
30666
30857
|
if (result) {
|
|
30667
30858
|
const { compile_options, name } = this;
|
|
30668
30859
|
const { format = 'esm' } = compile_options;
|
|
30669
|
-
const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${'3.
|
|
30860
|
+
const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${'3.47.0'}`;
|
|
30670
30861
|
const program = { type: 'Program', body: result.js };
|
|
30671
30862
|
walk(program, {
|
|
30672
30863
|
enter: (node, parent, key) => {
|
|
@@ -30877,7 +31068,7 @@ class Component {
|
|
|
30877
31068
|
extract_names(declarator.id).forEach(name => {
|
|
30878
31069
|
const variable = this.var_lookup.get(name);
|
|
30879
31070
|
variable.export_name = name;
|
|
30880
|
-
if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
|
|
31071
|
+
if (!module_script && variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
|
|
30881
31072
|
this.warn(declarator, compiler_warnings.unused_export_let(this.name.name, name));
|
|
30882
31073
|
}
|
|
30883
31074
|
});
|
|
@@ -30895,7 +31086,7 @@ class Component {
|
|
|
30895
31086
|
const variable = this.var_lookup.get(specifier.local.name);
|
|
30896
31087
|
if (variable) {
|
|
30897
31088
|
variable.export_name = specifier.exported.name;
|
|
30898
|
-
if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
|
|
31089
|
+
if (!module_script && variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
|
|
30899
31090
|
this.warn(specifier, compiler_warnings.unused_export_let(this.name.name, specifier.exported.name));
|
|
30900
31091
|
}
|
|
30901
31092
|
}
|
|
@@ -32159,7 +32350,7 @@ async function preprocess(source, preprocessor, options) {
|
|
|
32159
32350
|
return result.to_processed();
|
|
32160
32351
|
}
|
|
32161
32352
|
|
|
32162
|
-
const VERSION = '3.
|
|
32353
|
+
const VERSION = '3.47.0';
|
|
32163
32354
|
|
|
32164
32355
|
export { VERSION, compile, parse$3 as parse, preprocess, walk };
|
|
32165
32356
|
//# sourceMappingURL=compiler.mjs.map
|