svelte 4.1.2 → 4.2.1
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/compiler.cjs +107 -62
- package/elements.d.ts +1 -0
- package/package.json +4 -2
- package/src/.eslintrc.json +6 -0
- package/src/compiler/compile/Component.js +2 -2
- package/src/compiler/compile/create_module.js +10 -10
- package/src/compiler/compile/nodes/Binding.js +2 -2
- package/src/compiler/compile/nodes/EachBlock.js +5 -3
- package/src/compiler/compile/nodes/Element.js +31 -3
- package/src/compiler/compile/nodes/shared/get_const_tags.js +2 -2
- package/src/compiler/compile/render_dom/wrappers/Element/index.js +3 -6
- package/src/compiler/compile/render_dom/wrappers/InlineComponent/index.js +8 -3
- package/src/compiler/compile/render_dom/wrappers/Window.js +8 -8
- package/src/compiler/compile/render_dom/wrappers/shared/is_dynamic.js +5 -2
- package/src/compiler/compile/render_ssr/index.js +4 -0
- package/src/compiler/parse/read/css-tree-cq/css_tree_parse.js +4 -4
- package/src/compiler/parse/read/css-tree-cq/node/query_feature_range.js +3 -3
- package/src/compiler/utils/fuzzymatch.js +1 -5
- package/src/compiler/utils/globals.js +1 -1
- package/src/compiler/utils/mapped_code.js +12 -1
- package/src/runtime/internal/Component.js +15 -4
- package/src/runtime/internal/dom.js +35 -33
- package/src/shared/version.js +1 -1
- package/svelte-html.d.ts +252 -0
- package/types/index.d.ts.map +1 -1
package/compiler.cjs
CHANGED
|
@@ -6199,11 +6199,7 @@ function _distance(str1, str2) {
|
|
|
6199
6199
|
str1 = String(str1);
|
|
6200
6200
|
str2 = String(str2);
|
|
6201
6201
|
const distance = levenshtein(str1, str2);
|
|
6202
|
-
|
|
6203
|
-
return 1 - distance / str1.length;
|
|
6204
|
-
} else {
|
|
6205
|
-
return 1 - distance / str2.length;
|
|
6206
|
-
}
|
|
6202
|
+
return 1 - distance / Math.max(str1.length, str2.length);
|
|
6207
6203
|
}
|
|
6208
6204
|
|
|
6209
6205
|
// helper functions
|
|
@@ -9046,16 +9042,16 @@ function encodeInteger(buf, pos, state, segment, j) {
|
|
|
9046
9042
|
}
|
|
9047
9043
|
|
|
9048
9044
|
/** @type {(str?: string) => string} str */
|
|
9049
|
-
let btoa$
|
|
9045
|
+
let btoa$1 = () => {
|
|
9050
9046
|
throw new Error(
|
|
9051
9047
|
'Unsupported environment: `window.btoa` or `Buffer` should be supported.'
|
|
9052
9048
|
);
|
|
9053
9049
|
};
|
|
9054
9050
|
|
|
9055
9051
|
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
|
|
9056
|
-
btoa$
|
|
9052
|
+
btoa$1 = (str) => window.btoa(unescape(encodeURIComponent(str)));
|
|
9057
9053
|
} else if (typeof Buffer === 'function') {
|
|
9058
|
-
btoa$
|
|
9054
|
+
btoa$1 = (str) => Buffer.from(str, 'utf-8').toString('base64');
|
|
9059
9055
|
}
|
|
9060
9056
|
|
|
9061
9057
|
/** @typedef {import('estree').Node} Node */
|
|
@@ -9175,7 +9171,7 @@ function print(node, opts = {}) {
|
|
|
9175
9171
|
enumerable: false,
|
|
9176
9172
|
value: function toUrl() {
|
|
9177
9173
|
return (
|
|
9178
|
-
'data:application/json;charset=utf-8;base64,' + btoa$
|
|
9174
|
+
'data:application/json;charset=utf-8;base64,' + btoa$1(this.toString())
|
|
9179
9175
|
);
|
|
9180
9176
|
}
|
|
9181
9177
|
}
|
|
@@ -10207,7 +10203,7 @@ const structure$1 = {
|
|
|
10207
10203
|
value: ['Identifier', 'Number', 'Comparison', 'Dimension', 'QueryCSSFunction', 'Ratio', null]
|
|
10208
10204
|
};
|
|
10209
10205
|
|
|
10210
|
-
function
|
|
10206
|
+
function lookup_non_ws_type_and_value(offset, type, reference_str) {
|
|
10211
10207
|
let current_type;
|
|
10212
10208
|
|
|
10213
10209
|
do {
|
|
@@ -10217,7 +10213,7 @@ function lookup_non_WS_type_and_value(offset, type, referenceStr) {
|
|
|
10217
10213
|
}
|
|
10218
10214
|
} while (current_type !== 0); // NULL -> 0
|
|
10219
10215
|
|
|
10220
|
-
return current_type === type ? this.lookupValue(offset - 1,
|
|
10216
|
+
return current_type === type ? this.lookupValue(offset - 1, reference_str) : false;
|
|
10221
10217
|
}
|
|
10222
10218
|
|
|
10223
10219
|
function parse$3() {
|
|
@@ -10231,7 +10227,7 @@ function parse$3() {
|
|
|
10231
10227
|
while (!this.eof && this.tokenType !== RightParenthesis) {
|
|
10232
10228
|
switch (this.tokenType) {
|
|
10233
10229
|
case Number$1:
|
|
10234
|
-
if (
|
|
10230
|
+
if (lookup_non_ws_type_and_value.call(this, 1, Delim, '/')) {
|
|
10235
10231
|
child = this.Ratio();
|
|
10236
10232
|
} else {
|
|
10237
10233
|
child = this.Number();
|
|
@@ -10350,7 +10346,7 @@ QueryFeatureRange: query_feature_range
|
|
|
10350
10346
|
*
|
|
10351
10347
|
* The new nodes are located in `./node`.
|
|
10352
10348
|
*/
|
|
10353
|
-
const
|
|
10349
|
+
const cq_syntax = Ab({
|
|
10354
10350
|
atrule: {
|
|
10355
10351
|
// extend or override at-rule dictionary
|
|
10356
10352
|
container: {
|
|
@@ -10358,8 +10354,8 @@ const cqSyntax = Ab({
|
|
|
10358
10354
|
prelude() {
|
|
10359
10355
|
return this.createSingleNodeList(this.ContainerQuery());
|
|
10360
10356
|
},
|
|
10361
|
-
block(
|
|
10362
|
-
return this.Block(
|
|
10357
|
+
block(is_style_block = false) {
|
|
10358
|
+
return this.Block(is_style_block);
|
|
10363
10359
|
}
|
|
10364
10360
|
}
|
|
10365
10361
|
}
|
|
@@ -10367,7 +10363,7 @@ const cqSyntax = Ab({
|
|
|
10367
10363
|
node
|
|
10368
10364
|
});
|
|
10369
10365
|
|
|
10370
|
-
const parse$1 =
|
|
10366
|
+
const parse$1 = cq_syntax.parse;
|
|
10371
10367
|
|
|
10372
10368
|
// @ts-ignore
|
|
10373
10369
|
// import parse from 'css-tree/parser'; // When css-tree supports container queries uncomment.
|
|
@@ -15701,8 +15697,11 @@ function is_reserved_keyword(name) {
|
|
|
15701
15697
|
/** @param {import('../../../../interfaces.js').Var} variable */
|
|
15702
15698
|
function is_dynamic$1(variable) {
|
|
15703
15699
|
if (variable) {
|
|
15704
|
-
|
|
15705
|
-
|
|
15700
|
+
// Only variables declared in the instance script tags should be considered dynamic
|
|
15701
|
+
const is_declared_in_reactive_context = !variable.module && !variable.global;
|
|
15702
|
+
|
|
15703
|
+
if (is_declared_in_reactive_context && (variable.mutated || variable.reassigned)) return true; // dynamic internal state
|
|
15704
|
+
if (is_declared_in_reactive_context && variable.writable && variable.export_name) return true; // writable props
|
|
15706
15705
|
if (is_reserved_keyword(variable.name)) return true;
|
|
15707
15706
|
}
|
|
15708
15707
|
return false;
|
|
@@ -17486,7 +17485,9 @@ let EachBlock$1 = class EachBlock extends AbstractBlock {
|
|
|
17486
17485
|
this.has_animation = false;
|
|
17487
17486
|
[this.const_tags, this.children] = get_const_tags$1(info.children, component, this, this);
|
|
17488
17487
|
if (this.has_animation) {
|
|
17489
|
-
this.children = this.children.filter(
|
|
17488
|
+
this.children = this.children.filter(
|
|
17489
|
+
(child) => !is_empty_node(child) && !is_comment_node(child)
|
|
17490
|
+
);
|
|
17490
17491
|
if (this.children.length !== 1) {
|
|
17491
17492
|
const child = this.children.find(
|
|
17492
17493
|
(child) => !!(/** @type {import('./Element.js').default} */ (child).animation)
|
|
@@ -17504,12 +17505,12 @@ let EachBlock$1 = class EachBlock extends AbstractBlock {
|
|
|
17504
17505
|
};
|
|
17505
17506
|
|
|
17506
17507
|
/** @param {import('./interfaces.js').INode} node */
|
|
17507
|
-
function
|
|
17508
|
+
function is_empty_node(node) {
|
|
17508
17509
|
return node.type === 'Text' && node.data.trim() === '';
|
|
17509
17510
|
}
|
|
17510
17511
|
|
|
17511
17512
|
/** @param {import('./interfaces.js').INode} node */
|
|
17512
|
-
function
|
|
17513
|
+
function is_comment_node(node) {
|
|
17513
17514
|
return node.type === 'Comment';
|
|
17514
17515
|
}
|
|
17515
17516
|
|
|
@@ -17605,7 +17606,7 @@ class Binding extends Node {
|
|
|
17605
17606
|
this.is_readonly =
|
|
17606
17607
|
regex_dimensions.test(this.name) ||
|
|
17607
17608
|
regex_box_size.test(this.name) ||
|
|
17608
|
-
(
|
|
17609
|
+
(is_element(parent) &&
|
|
17609
17610
|
((parent.is_media_node() && read_only_media_attributes.has(this.name)) ||
|
|
17610
17611
|
(parent.name === 'input' && type === 'file'))) /* TODO others? */;
|
|
17611
17612
|
}
|
|
@@ -17634,7 +17635,7 @@ class Binding extends Node {
|
|
|
17634
17635
|
* @param {import('./shared/Node.js').default} node
|
|
17635
17636
|
* @returns {node is import('./Element.js').default}
|
|
17636
17637
|
*/
|
|
17637
|
-
function
|
|
17638
|
+
function is_element(node) {
|
|
17638
17639
|
return !!(/** @type {any} */ (node).is_media_node);
|
|
17639
17640
|
}
|
|
17640
17641
|
|
|
@@ -28078,7 +28079,7 @@ let Element$1 = class Element extends Node {
|
|
|
28078
28079
|
}
|
|
28079
28080
|
if (this.name === 'textarea') {
|
|
28080
28081
|
if (info.children.length > 0) {
|
|
28081
|
-
const value_attribute = info.attributes
|
|
28082
|
+
const value_attribute = get_value_attribute(info.attributes);
|
|
28082
28083
|
if (value_attribute) {
|
|
28083
28084
|
component.error(value_attribute, compiler_errors.textarea_duplicate_value);
|
|
28084
28085
|
return;
|
|
@@ -28097,7 +28098,7 @@ let Element$1 = class Element extends Node {
|
|
|
28097
28098
|
// Special case — treat these the same way:
|
|
28098
28099
|
// <option>{foo}</option>
|
|
28099
28100
|
// <option value={foo}>{foo}</option>
|
|
28100
|
-
const value_attribute = info.attributes
|
|
28101
|
+
const value_attribute = get_value_attribute(info.attributes);
|
|
28101
28102
|
if (!value_attribute) {
|
|
28102
28103
|
info.attributes.push({
|
|
28103
28104
|
type: 'Attribute',
|
|
@@ -28523,7 +28524,7 @@ let Element$1 = class Element extends Node {
|
|
|
28523
28524
|
) {
|
|
28524
28525
|
const interactive_handlers = handlers
|
|
28525
28526
|
.map((handler) => handler.name)
|
|
28526
|
-
.filter((
|
|
28527
|
+
.filter((handler_name) => a11y_interactive_handlers.has(handler_name));
|
|
28527
28528
|
if (interactive_handlers.length > 0) {
|
|
28528
28529
|
component.warn(
|
|
28529
28530
|
this,
|
|
@@ -29069,6 +29070,33 @@ function within_custom_element(parent) {
|
|
|
29069
29070
|
return false;
|
|
29070
29071
|
}
|
|
29071
29072
|
|
|
29073
|
+
/**
|
|
29074
|
+
* @param {any[]} attributes
|
|
29075
|
+
*/
|
|
29076
|
+
function get_value_attribute(attributes) {
|
|
29077
|
+
let node_value;
|
|
29078
|
+
attributes.forEach((node) => {
|
|
29079
|
+
if (node.type !== 'Spread' && node.name.toLowerCase() === 'value') {
|
|
29080
|
+
node_value = node;
|
|
29081
|
+
}
|
|
29082
|
+
if (node.type === 'Spread') {
|
|
29083
|
+
walk(/** @type {any} */ (node.expression), {
|
|
29084
|
+
enter(/** @type {import('estree').Node} */ node) {
|
|
29085
|
+
if (node_value) {
|
|
29086
|
+
this.skip();
|
|
29087
|
+
}
|
|
29088
|
+
if (node.type === 'Identifier') {
|
|
29089
|
+
if (/** @type {import('estree').Identifier} */ (node).name.toLowerCase() === 'value') {
|
|
29090
|
+
node_value = node;
|
|
29091
|
+
}
|
|
29092
|
+
}
|
|
29093
|
+
}
|
|
29094
|
+
});
|
|
29095
|
+
}
|
|
29096
|
+
});
|
|
29097
|
+
return node_value;
|
|
29098
|
+
}
|
|
29099
|
+
|
|
29072
29100
|
/** @extends Node<'Head'> */
|
|
29073
29101
|
let Head$1 = class Head extends Node {
|
|
29074
29102
|
/** @type {any[]} */
|
|
@@ -29850,8 +29878,8 @@ function sort_consts_nodes(consts_nodes, component) {
|
|
|
29850
29878
|
}, [])
|
|
29851
29879
|
);
|
|
29852
29880
|
if (cycle && cycle.length) {
|
|
29853
|
-
const
|
|
29854
|
-
const node =
|
|
29881
|
+
const node_list = lookup.get(cycle[0]);
|
|
29882
|
+
const node = node_list[0];
|
|
29855
29883
|
component.error(node.node, compiler_errors.cyclical_const_tags(cycle));
|
|
29856
29884
|
}
|
|
29857
29885
|
|
|
@@ -33707,7 +33735,8 @@ class ElementWrapper extends Wrapper {
|
|
|
33707
33735
|
const static_attributes = [];
|
|
33708
33736
|
this.attributes.forEach((attr) => {
|
|
33709
33737
|
if (attr instanceof SpreadAttributeWrapper) {
|
|
33710
|
-
|
|
33738
|
+
const snippet = { type: 'SpreadElement', argument: attr.node.expression.manipulate(block) };
|
|
33739
|
+
static_attributes.push(snippet);
|
|
33711
33740
|
} else {
|
|
33712
33741
|
const name = attr.property_name || attr.name;
|
|
33713
33742
|
static_attributes.push(p`${name}: ${attr.get_value(block)}`);
|
|
@@ -33957,11 +33986,7 @@ class ElementWrapper extends Wrapper {
|
|
|
33957
33986
|
}
|
|
33958
33987
|
if (this.dynamic_style_dependencies.size > 0) {
|
|
33959
33988
|
maybe_create_style_changed_var();
|
|
33960
|
-
|
|
33961
|
-
condition =
|
|
33962
|
-
all_deps.size === this.dynamic_style_dependencies.size
|
|
33963
|
-
? style_changed_var
|
|
33964
|
-
: x$1`${style_changed_var} || ${condition}`;
|
|
33989
|
+
condition = x$1`${condition} || ${style_changed_var}`;
|
|
33965
33990
|
}
|
|
33966
33991
|
block.chunks.update.push(b$1`
|
|
33967
33992
|
if (${condition}) {
|
|
@@ -35258,14 +35283,19 @@ class InlineComponentWrapper extends Wrapper {
|
|
|
35258
35283
|
this.slots.set(name, slot_definition);
|
|
35259
35284
|
}
|
|
35260
35285
|
warn_if_reactive() {
|
|
35261
|
-
|
|
35262
|
-
const
|
|
35286
|
+
let { name } = this.node;
|
|
35287
|
+
const top = name.split('.')[0]; // <T.foo/> etc. should check for T instead of "T.foo"
|
|
35288
|
+
const variable = this.renderer.component.var_lookup.get(top);
|
|
35263
35289
|
if (!variable) {
|
|
35264
35290
|
return;
|
|
35265
35291
|
}
|
|
35266
35292
|
const ignores = extract_ignores_above_node(this.node);
|
|
35267
35293
|
this.renderer.component.push_ignores(ignores);
|
|
35268
|
-
if (
|
|
35294
|
+
if (
|
|
35295
|
+
variable.reassigned ||
|
|
35296
|
+
variable.export_name || // or a prop
|
|
35297
|
+
variable.mutated
|
|
35298
|
+
) {
|
|
35269
35299
|
this.renderer.component.warn(this.node, compiler_warnings.reactive_component(name));
|
|
35270
35300
|
}
|
|
35271
35301
|
this.renderer.component.pop_ignores();
|
|
@@ -36274,14 +36304,14 @@ class WindowWrapper extends Wrapper {
|
|
|
36274
36304
|
bindings.scrollX && bindings.scrollY
|
|
36275
36305
|
? x$1`"${bindings.scrollX}" in this._state || "${bindings.scrollY}" in this._state`
|
|
36276
36306
|
: x$1`"${bindings.scrollX || bindings.scrollY}" in this._state`;
|
|
36277
|
-
const
|
|
36278
|
-
const
|
|
36307
|
+
const scroll_x = bindings.scrollX && x$1`this._state.${bindings.scrollX}`;
|
|
36308
|
+
const scroll_y = bindings.scrollY && x$1`this._state.${bindings.scrollY}`;
|
|
36279
36309
|
renderer.meta_bindings.push(b$1`
|
|
36280
36310
|
if (${condition}) {
|
|
36281
|
-
@_scrollTo(${
|
|
36311
|
+
@_scrollTo(${scroll_x || '@_window.pageXOffset'}, ${scroll_y || '@_window.pageYOffset'});
|
|
36282
36312
|
}
|
|
36283
|
-
${
|
|
36284
|
-
${
|
|
36313
|
+
${scroll_x && `${scroll_x} = @_window.pageXOffset;`}
|
|
36314
|
+
${scroll_y && `${scroll_y} = @_window.pageYOffset;`}
|
|
36285
36315
|
`);
|
|
36286
36316
|
block.event_listeners.push(x$1`
|
|
36287
36317
|
@listen(@_window, "${event}", () => {
|
|
@@ -36312,17 +36342,17 @@ class WindowWrapper extends Wrapper {
|
|
|
36312
36342
|
// special case... might need to abstract this out if we add more special cases
|
|
36313
36343
|
if (bindings.scrollX || bindings.scrollY) {
|
|
36314
36344
|
const condition = renderer.dirty([bindings.scrollX, bindings.scrollY].filter(Boolean));
|
|
36315
|
-
const
|
|
36345
|
+
const scroll_x = bindings.scrollX
|
|
36316
36346
|
? renderer.reference(bindings.scrollX)
|
|
36317
36347
|
: x$1`@_window.pageXOffset`;
|
|
36318
|
-
const
|
|
36348
|
+
const scroll_y = bindings.scrollY
|
|
36319
36349
|
? renderer.reference(bindings.scrollY)
|
|
36320
36350
|
: x$1`@_window.pageYOffset`;
|
|
36321
36351
|
block.chunks.update.push(b$1`
|
|
36322
36352
|
if (${condition} && !${scrolling}) {
|
|
36323
36353
|
${scrolling} = true;
|
|
36324
36354
|
@_clearTimeout(${scrolling_timeout});
|
|
36325
|
-
@_scrollTo(${
|
|
36355
|
+
@_scrollTo(${scroll_x}, ${scroll_y});
|
|
36326
36356
|
${scrolling_timeout} = @_setTimeout(${clear_scrolling}, 100);
|
|
36327
36357
|
}
|
|
36328
36358
|
`);
|
|
@@ -38058,7 +38088,18 @@ function apply_preprocessor_sourcemap(filename, svelte_map, preprocessor_map_inp
|
|
|
38058
38088
|
toUrl: {
|
|
38059
38089
|
enumerable: false,
|
|
38060
38090
|
value: function toUrl() {
|
|
38061
|
-
|
|
38091
|
+
let b64 = '';
|
|
38092
|
+
if (typeof window !== 'undefined' && window.btoa) {
|
|
38093
|
+
// btoa doesn't support multi-byte characters
|
|
38094
|
+
b64 = window.btoa(unescape(encodeURIComponent(this.toString())));
|
|
38095
|
+
} else if (typeof Buffer !== 'undefined') {
|
|
38096
|
+
b64 = Buffer.from(this.toString(), 'utf8').toString('base64');
|
|
38097
|
+
} else {
|
|
38098
|
+
throw new Error(
|
|
38099
|
+
'Unsupported environment: `window.btoa` or `Buffer` should be present to use toUrl.'
|
|
38100
|
+
);
|
|
38101
|
+
}
|
|
38102
|
+
return 'data:application/json;charset=utf-8;base64,' + b64;
|
|
38062
38103
|
}
|
|
38063
38104
|
}
|
|
38064
38105
|
});
|
|
@@ -39807,9 +39848,13 @@ function ssr(component, options) {
|
|
|
39807
39848
|
? b$1`
|
|
39808
39849
|
let $$settled;
|
|
39809
39850
|
let $$rendered;
|
|
39851
|
+
let #previous_head = $$result.head;
|
|
39810
39852
|
|
|
39811
39853
|
do {
|
|
39812
39854
|
$$settled = true;
|
|
39855
|
+
// $$result.head is mutated by the literal expression
|
|
39856
|
+
// need to reset it if we're looping back to prevent duplication
|
|
39857
|
+
$$result.head = #previous_head;
|
|
39813
39858
|
|
|
39814
39859
|
${reactive_declarations}
|
|
39815
39860
|
|
|
@@ -39881,7 +39926,7 @@ function trim(nodes) {
|
|
|
39881
39926
|
|
|
39882
39927
|
/** ----------------------------------------------------------------------
|
|
39883
39928
|
This file is automatically generated by `scripts/globals-extractor.js`.
|
|
39884
|
-
Generated At: 2023-
|
|
39929
|
+
Generated At: 2023-08-11T04:11:50.562Z
|
|
39885
39930
|
---------------------------------------------------------------------- */
|
|
39886
39931
|
|
|
39887
39932
|
var globals = new Set([
|
|
@@ -40724,7 +40769,7 @@ var globals = new Set([
|
|
|
40724
40769
|
* @param {any} program
|
|
40725
40770
|
* @param {import('estree').Identifier} name
|
|
40726
40771
|
* @param {string} banner
|
|
40727
|
-
* @param {any}
|
|
40772
|
+
* @param {any} svelte_path
|
|
40728
40773
|
* @param {Array<{ name: string; alias: import('estree').Identifier }>} helpers
|
|
40729
40774
|
* @param {Array<{ name: string; alias: import('estree').Identifier }>} globals
|
|
40730
40775
|
* @param {import('estree').ImportDeclaration[]} imports
|
|
@@ -40735,21 +40780,21 @@ function create_module(
|
|
|
40735
40780
|
program,
|
|
40736
40781
|
name,
|
|
40737
40782
|
banner,
|
|
40738
|
-
|
|
40783
|
+
svelte_path = 'svelte',
|
|
40739
40784
|
helpers,
|
|
40740
40785
|
globals,
|
|
40741
40786
|
imports,
|
|
40742
40787
|
module_exports,
|
|
40743
40788
|
exports_from
|
|
40744
40789
|
) {
|
|
40745
|
-
const internal_path = `${
|
|
40790
|
+
const internal_path = `${svelte_path}/internal`;
|
|
40746
40791
|
helpers.sort((a, b) => (a.name < b.name ? -1 : 1));
|
|
40747
40792
|
globals.sort((a, b) => (a.name < b.name ? -1 : 1));
|
|
40748
40793
|
return esm(
|
|
40749
40794
|
program,
|
|
40750
40795
|
name,
|
|
40751
40796
|
banner,
|
|
40752
|
-
|
|
40797
|
+
svelte_path,
|
|
40753
40798
|
internal_path,
|
|
40754
40799
|
helpers,
|
|
40755
40800
|
globals,
|
|
@@ -40761,11 +40806,11 @@ function create_module(
|
|
|
40761
40806
|
|
|
40762
40807
|
/**
|
|
40763
40808
|
* @param {any} source
|
|
40764
|
-
* @param {any}
|
|
40809
|
+
* @param {any} svelte_path
|
|
40765
40810
|
*/
|
|
40766
|
-
function edit_source(source,
|
|
40811
|
+
function edit_source(source, svelte_path) {
|
|
40767
40812
|
return source === 'svelte' || source.startsWith('svelte/')
|
|
40768
|
-
? source.replace('svelte',
|
|
40813
|
+
? source.replace('svelte', svelte_path)
|
|
40769
40814
|
: source;
|
|
40770
40815
|
}
|
|
40771
40816
|
|
|
@@ -40804,7 +40849,7 @@ function get_internal_globals(globals, helpers) {
|
|
|
40804
40849
|
* @param {any} program
|
|
40805
40850
|
* @param {import('estree').Identifier} name
|
|
40806
40851
|
* @param {string} banner
|
|
40807
|
-
* @param {string}
|
|
40852
|
+
* @param {string} svelte_path
|
|
40808
40853
|
* @param {string} internal_path
|
|
40809
40854
|
* @param {Array<{ name: string; alias: import('estree').Identifier }>} helpers
|
|
40810
40855
|
* @param {Array<{ name: string; alias: import('estree').Identifier }>} globals
|
|
@@ -40816,7 +40861,7 @@ function esm(
|
|
|
40816
40861
|
program,
|
|
40817
40862
|
name,
|
|
40818
40863
|
banner,
|
|
40819
|
-
|
|
40864
|
+
svelte_path,
|
|
40820
40865
|
internal_path,
|
|
40821
40866
|
helpers,
|
|
40822
40867
|
globals,
|
|
@@ -40838,7 +40883,7 @@ function esm(
|
|
|
40838
40883
|
|
|
40839
40884
|
/** @param {any} node */
|
|
40840
40885
|
function rewrite_import(node) {
|
|
40841
|
-
const value = edit_source(node.source.value,
|
|
40886
|
+
const value = edit_source(node.source.value, svelte_path);
|
|
40842
40887
|
if (node.source.value !== value) {
|
|
40843
40888
|
node.source.value = value;
|
|
40844
40889
|
node.source.raw = null;
|
|
@@ -41055,7 +41100,7 @@ function getBtoa () {
|
|
|
41055
41100
|
}
|
|
41056
41101
|
}
|
|
41057
41102
|
|
|
41058
|
-
const btoa
|
|
41103
|
+
const btoa = /*#__PURE__*/ getBtoa();
|
|
41059
41104
|
|
|
41060
41105
|
class SourceMap {
|
|
41061
41106
|
constructor(properties) {
|
|
@@ -41075,7 +41120,7 @@ class SourceMap {
|
|
|
41075
41120
|
}
|
|
41076
41121
|
|
|
41077
41122
|
toUrl() {
|
|
41078
|
-
return 'data:application/json;charset=utf-8;base64,' + btoa
|
|
41123
|
+
return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());
|
|
41079
41124
|
}
|
|
41080
41125
|
}
|
|
41081
41126
|
|
|
@@ -43530,7 +43575,7 @@ function is_used_as_reference(node, parent) {
|
|
|
43530
43575
|
* https://svelte.dev/docs/svelte-compiler#svelte-version
|
|
43531
43576
|
* @type {string}
|
|
43532
43577
|
*/
|
|
43533
|
-
const VERSION = '4.1
|
|
43578
|
+
const VERSION = '4.2.1';
|
|
43534
43579
|
|
|
43535
43580
|
const regex_leading_directory_separator = /^[/\\]/;
|
|
43536
43581
|
const regex_starts_with_term_export = /^Export/;
|
|
@@ -45056,8 +45101,8 @@ class Component {
|
|
|
45056
45101
|
}, [])
|
|
45057
45102
|
);
|
|
45058
45103
|
if (cycle && cycle.length) {
|
|
45059
|
-
const
|
|
45060
|
-
const declaration =
|
|
45104
|
+
const declaration_list = lookup.get(cycle[0]);
|
|
45105
|
+
const declaration = declaration_list[0];
|
|
45061
45106
|
return this.error(declaration.node, compiler_errors.cyclical_reactive_declaration(cycle));
|
|
45062
45107
|
}
|
|
45063
45108
|
|
package/elements.d.ts
CHANGED
|
@@ -808,6 +808,7 @@ export interface HTMLInputAttributes extends HTMLAttributes<HTMLInputElement> {
|
|
|
808
808
|
formnovalidate?: boolean | undefined | null;
|
|
809
809
|
formtarget?: string | undefined | null;
|
|
810
810
|
height?: number | string | undefined | null;
|
|
811
|
+
indeterminate?: boolean | undefined | null;
|
|
811
812
|
list?: string | undefined | null;
|
|
812
813
|
max?: number | string | undefined | null;
|
|
813
814
|
maxlength?: number | undefined | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Cybernetically enhanced web apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "src/runtime/index.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"motion.d.ts",
|
|
20
20
|
"action.d.ts",
|
|
21
21
|
"elements.d.ts",
|
|
22
|
+
"svelte-html.d.ts",
|
|
22
23
|
"README.md"
|
|
23
24
|
],
|
|
24
25
|
"exports": {
|
|
@@ -116,6 +117,7 @@
|
|
|
116
117
|
"agadoo": "^3.0.0",
|
|
117
118
|
"dts-buddy": "^0.1.7",
|
|
118
119
|
"esbuild": "^0.18.11",
|
|
120
|
+
"eslint-plugin-lube": "^0.1.7",
|
|
119
121
|
"happy-dom": "^9.20.3",
|
|
120
122
|
"jsdom": "^21.1.2",
|
|
121
123
|
"kleur": "^4.1.5",
|
|
@@ -134,6 +136,6 @@
|
|
|
134
136
|
"dev": "rollup -cw",
|
|
135
137
|
"posttest": "agadoo src/internal/index.js",
|
|
136
138
|
"types": "node ./scripts/generate-dts.js",
|
|
137
|
-
"lint": "prettier . --cache --plugin-search-dir=. --check && eslint \"{src,test}/**/*.
|
|
139
|
+
"lint": "prettier . --cache --plugin-search-dir=. --check && eslint \"{scripts,src,test}/**/*.js\" --cache --fix"
|
|
138
140
|
}
|
|
139
141
|
}
|
|
@@ -1555,8 +1555,8 @@ export default class Component {
|
|
|
1555
1555
|
}, [])
|
|
1556
1556
|
);
|
|
1557
1557
|
if (cycle && cycle.length) {
|
|
1558
|
-
const
|
|
1559
|
-
const declaration =
|
|
1558
|
+
const declaration_list = lookup.get(cycle[0]);
|
|
1559
|
+
const declaration = declaration_list[0];
|
|
1560
1560
|
return this.error(declaration.node, compiler_errors.cyclical_reactive_declaration(cycle));
|
|
1561
1561
|
}
|
|
1562
1562
|
|
|
@@ -4,7 +4,7 @@ import { b } from 'code-red';
|
|
|
4
4
|
* @param {any} program
|
|
5
5
|
* @param {import('estree').Identifier} name
|
|
6
6
|
* @param {string} banner
|
|
7
|
-
* @param {any}
|
|
7
|
+
* @param {any} svelte_path
|
|
8
8
|
* @param {Array<{ name: string; alias: import('estree').Identifier }>} helpers
|
|
9
9
|
* @param {Array<{ name: string; alias: import('estree').Identifier }>} globals
|
|
10
10
|
* @param {import('estree').ImportDeclaration[]} imports
|
|
@@ -15,21 +15,21 @@ export default function create_module(
|
|
|
15
15
|
program,
|
|
16
16
|
name,
|
|
17
17
|
banner,
|
|
18
|
-
|
|
18
|
+
svelte_path = 'svelte',
|
|
19
19
|
helpers,
|
|
20
20
|
globals,
|
|
21
21
|
imports,
|
|
22
22
|
module_exports,
|
|
23
23
|
exports_from
|
|
24
24
|
) {
|
|
25
|
-
const internal_path = `${
|
|
25
|
+
const internal_path = `${svelte_path}/internal`;
|
|
26
26
|
helpers.sort((a, b) => (a.name < b.name ? -1 : 1));
|
|
27
27
|
globals.sort((a, b) => (a.name < b.name ? -1 : 1));
|
|
28
28
|
return esm(
|
|
29
29
|
program,
|
|
30
30
|
name,
|
|
31
31
|
banner,
|
|
32
|
-
|
|
32
|
+
svelte_path,
|
|
33
33
|
internal_path,
|
|
34
34
|
helpers,
|
|
35
35
|
globals,
|
|
@@ -41,11 +41,11 @@ export default function create_module(
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @param {any} source
|
|
44
|
-
* @param {any}
|
|
44
|
+
* @param {any} svelte_path
|
|
45
45
|
*/
|
|
46
|
-
function edit_source(source,
|
|
46
|
+
function edit_source(source, svelte_path) {
|
|
47
47
|
return source === 'svelte' || source.startsWith('svelte/')
|
|
48
|
-
? source.replace('svelte',
|
|
48
|
+
? source.replace('svelte', svelte_path)
|
|
49
49
|
: source;
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -84,7 +84,7 @@ function get_internal_globals(globals, helpers) {
|
|
|
84
84
|
* @param {any} program
|
|
85
85
|
* @param {import('estree').Identifier} name
|
|
86
86
|
* @param {string} banner
|
|
87
|
-
* @param {string}
|
|
87
|
+
* @param {string} svelte_path
|
|
88
88
|
* @param {string} internal_path
|
|
89
89
|
* @param {Array<{ name: string; alias: import('estree').Identifier }>} helpers
|
|
90
90
|
* @param {Array<{ name: string; alias: import('estree').Identifier }>} globals
|
|
@@ -96,7 +96,7 @@ function esm(
|
|
|
96
96
|
program,
|
|
97
97
|
name,
|
|
98
98
|
banner,
|
|
99
|
-
|
|
99
|
+
svelte_path,
|
|
100
100
|
internal_path,
|
|
101
101
|
helpers,
|
|
102
102
|
globals,
|
|
@@ -118,7 +118,7 @@ function esm(
|
|
|
118
118
|
|
|
119
119
|
/** @param {any} node */
|
|
120
120
|
function rewrite_import(node) {
|
|
121
|
-
const value = edit_source(node.source.value,
|
|
121
|
+
const value = edit_source(node.source.value, svelte_path);
|
|
122
122
|
if (node.source.value !== value) {
|
|
123
123
|
node.source.value = value;
|
|
124
124
|
node.source.raw = null;
|
|
@@ -98,7 +98,7 @@ export default class Binding extends Node {
|
|
|
98
98
|
this.is_readonly =
|
|
99
99
|
regex_dimensions.test(this.name) ||
|
|
100
100
|
regex_box_size.test(this.name) ||
|
|
101
|
-
(
|
|
101
|
+
(is_element(parent) &&
|
|
102
102
|
((parent.is_media_node() && read_only_media_attributes.has(this.name)) ||
|
|
103
103
|
(parent.name === 'input' && type === 'file'))) /* TODO others? */;
|
|
104
104
|
}
|
|
@@ -127,6 +127,6 @@ export default class Binding extends Node {
|
|
|
127
127
|
* @param {import('./shared/Node.js').default} node
|
|
128
128
|
* @returns {node is import('./Element.js').default}
|
|
129
129
|
*/
|
|
130
|
-
function
|
|
130
|
+
function is_element(node) {
|
|
131
131
|
return !!(/** @type {any} */ (node).is_media_node);
|
|
132
132
|
}
|
|
@@ -84,7 +84,9 @@ export default class EachBlock extends AbstractBlock {
|
|
|
84
84
|
this.has_animation = false;
|
|
85
85
|
[this.const_tags, this.children] = get_const_tags(info.children, component, this, this);
|
|
86
86
|
if (this.has_animation) {
|
|
87
|
-
this.children = this.children.filter(
|
|
87
|
+
this.children = this.children.filter(
|
|
88
|
+
(child) => !is_empty_node(child) && !is_comment_node(child)
|
|
89
|
+
);
|
|
88
90
|
if (this.children.length !== 1) {
|
|
89
91
|
const child = this.children.find(
|
|
90
92
|
(child) => !!(/** @type {import('./Element.js').default} */ (child).animation)
|
|
@@ -102,11 +104,11 @@ export default class EachBlock extends AbstractBlock {
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
/** @param {import('./interfaces.js').INode} node */
|
|
105
|
-
function
|
|
107
|
+
function is_empty_node(node) {
|
|
106
108
|
return node.type === 'Text' && node.data.trim() === '';
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
/** @param {import('./interfaces.js').INode} node */
|
|
110
|
-
function
|
|
112
|
+
function is_comment_node(node) {
|
|
111
113
|
return node.type === 'Comment';
|
|
112
114
|
}
|