@lightspeed-js/core 0.4.7 → 0.4.8
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/dist/compile.js
CHANGED
|
@@ -913,9 +913,9 @@ class BindingEvaluator {
|
|
|
913
913
|
compileExpression(expr, params = []) {
|
|
914
914
|
return this.compile(expr, params);
|
|
915
915
|
}
|
|
916
|
-
evaluate(expr, instance, locals = []) {
|
|
916
|
+
evaluate(expr, instance, locals = [], params = []) {
|
|
917
917
|
try {
|
|
918
|
-
return this.compile(expr,
|
|
918
|
+
return this.compile(expr, params)(instance.state, instance.props, this.cells.createReadProxy(), this.pendingProbe(), ...locals);
|
|
919
919
|
} catch (error) {
|
|
920
920
|
warn(`Error evaluating "${expr}" in ${instance.id}:`, error);
|
|
921
921
|
return;
|
package/dist/index.js
CHANGED
|
@@ -485,9 +485,9 @@ class BindingEvaluator {
|
|
|
485
485
|
compileExpression(expr, params = []) {
|
|
486
486
|
return this.compile(expr, params);
|
|
487
487
|
}
|
|
488
|
-
evaluate(expr, instance, locals = []) {
|
|
488
|
+
evaluate(expr, instance, locals = [], params = []) {
|
|
489
489
|
try {
|
|
490
|
-
return this.compile(expr,
|
|
490
|
+
return this.compile(expr, params)(instance.state, instance.props, this.cells.createReadProxy(), this.pendingProbe(), ...locals);
|
|
491
491
|
} catch (error) {
|
|
492
492
|
warn(`Error evaluating "${expr}" in ${instance.id}:`, error);
|
|
493
493
|
return;
|
|
@@ -1569,7 +1569,8 @@ class Mounter {
|
|
|
1569
1569
|
outlet.replaceWith(holder);
|
|
1570
1570
|
}
|
|
1571
1571
|
for (const [name, nodes] of byName) {
|
|
1572
|
-
|
|
1572
|
+
const dropped = nodes.filter((node) => node.nodeType === 1 || node.nodeType === 3 && (node.textContent ?? "").trim() !== "");
|
|
1573
|
+
if (!dropped.length)
|
|
1573
1574
|
continue;
|
|
1574
1575
|
warn(name ? `No <slot name="${name}"> to receive this content - it was dropped.` : "Content passed to a component with no unnamed <slot> - it was dropped.");
|
|
1575
1576
|
}
|
|
@@ -1920,7 +1921,7 @@ class Mounter {
|
|
|
1920
1921
|
return block;
|
|
1921
1922
|
}
|
|
1922
1923
|
adoptRows(block, slices, context) {
|
|
1923
|
-
const value = this.bindings.evaluate(block.itemsExpr, context.owner, context.locals);
|
|
1924
|
+
const value = this.bindings.evaluate(block.itemsExpr, context.owner, context.locals, block.params);
|
|
1924
1925
|
const items = block.toItems(value);
|
|
1925
1926
|
if (items.length !== slices.length)
|
|
1926
1927
|
return false;
|
package/dist/ssg.js
CHANGED
|
@@ -504,9 +504,9 @@ class BindingEvaluator {
|
|
|
504
504
|
compileExpression(expr, params = []) {
|
|
505
505
|
return this.compile(expr, params);
|
|
506
506
|
}
|
|
507
|
-
evaluate(expr, instance, locals = []) {
|
|
507
|
+
evaluate(expr, instance, locals = [], params = []) {
|
|
508
508
|
try {
|
|
509
|
-
return this.compile(expr,
|
|
509
|
+
return this.compile(expr, params)(instance.state, instance.props, this.cells.createReadProxy(), this.pendingProbe(), ...locals);
|
|
510
510
|
} catch (error) {
|
|
511
511
|
warn(`Error evaluating "${expr}" in ${instance.id}:`, error);
|
|
512
512
|
return;
|
|
@@ -1592,7 +1592,8 @@ class Mounter {
|
|
|
1592
1592
|
outlet.replaceWith(holder);
|
|
1593
1593
|
}
|
|
1594
1594
|
for (const [name, nodes] of byName) {
|
|
1595
|
-
|
|
1595
|
+
const dropped = nodes.filter((node) => node.nodeType === 1 || node.nodeType === 3 && (node.textContent ?? "").trim() !== "");
|
|
1596
|
+
if (!dropped.length)
|
|
1596
1597
|
continue;
|
|
1597
1598
|
warn(name ? `No <slot name="${name}"> to receive this content - it was dropped.` : "Content passed to a component with no unnamed <slot> - it was dropped.");
|
|
1598
1599
|
}
|
|
@@ -1943,7 +1944,7 @@ class Mounter {
|
|
|
1943
1944
|
return block;
|
|
1944
1945
|
}
|
|
1945
1946
|
adoptRows(block, slices, context) {
|
|
1946
|
-
const value = this.bindings.evaluate(block.itemsExpr, context.owner, context.locals);
|
|
1947
|
+
const value = this.bindings.evaluate(block.itemsExpr, context.owner, context.locals, block.params);
|
|
1947
1948
|
const items = block.toItems(value);
|
|
1948
1949
|
if (items.length !== slices.length)
|
|
1949
1950
|
return false;
|
|
@@ -133,7 +133,12 @@ export declare class BindingEvaluator {
|
|
|
133
133
|
get cellManager(): CellManager;
|
|
134
134
|
/** Compile a standalone expression, e.g. a `$key`. */
|
|
135
135
|
compileExpression(expr: string, params?: string[]): Compiled;
|
|
136
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Evaluate once, outside a binding. `params` names the loop aliases `locals`
|
|
138
|
+
* holds: the compiled table is keyed by scope, so a block inside a `$for`
|
|
139
|
+
* row has to be looked up with the row's alias in scope, or it misses.
|
|
140
|
+
*/
|
|
141
|
+
evaluate(expr: string, instance: ComponentInstance, locals?: any[], params?: string[]): any;
|
|
137
142
|
applyBinding(binding: Binding, scope: BindingScope): void;
|
|
138
143
|
/** Re-evaluate everything owned by this instance, including its blocks. */
|
|
139
144
|
updateInstance(instance: ComponentInstance): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/vite.js
CHANGED
|
@@ -243,9 +243,9 @@ class BindingEvaluator {
|
|
|
243
243
|
compileExpression(expr, params = []) {
|
|
244
244
|
return this.compile(expr, params);
|
|
245
245
|
}
|
|
246
|
-
evaluate(expr, instance, locals = []) {
|
|
246
|
+
evaluate(expr, instance, locals = [], params = []) {
|
|
247
247
|
try {
|
|
248
|
-
return this.compile(expr,
|
|
248
|
+
return this.compile(expr, params)(instance.state, instance.props, this.cells.createReadProxy(), this.pendingProbe(), ...locals);
|
|
249
249
|
} catch (error) {
|
|
250
250
|
warn(`Error evaluating "${expr}" in ${instance.id}:`, error);
|
|
251
251
|
return;
|
|
@@ -1023,7 +1023,8 @@ class Mounter {
|
|
|
1023
1023
|
outlet.replaceWith(holder);
|
|
1024
1024
|
}
|
|
1025
1025
|
for (const [name, nodes] of byName) {
|
|
1026
|
-
|
|
1026
|
+
const dropped = nodes.filter((node) => node.nodeType === 1 || node.nodeType === 3 && (node.textContent ?? "").trim() !== "");
|
|
1027
|
+
if (!dropped.length)
|
|
1027
1028
|
continue;
|
|
1028
1029
|
warn(name ? `No <slot name="${name}"> to receive this content - it was dropped.` : "Content passed to a component with no unnamed <slot> - it was dropped.");
|
|
1029
1030
|
}
|
|
@@ -1374,7 +1375,7 @@ class Mounter {
|
|
|
1374
1375
|
return block;
|
|
1375
1376
|
}
|
|
1376
1377
|
adoptRows(block, slices, context) {
|
|
1377
|
-
const value = this.bindings.evaluate(block.itemsExpr, context.owner, context.locals);
|
|
1378
|
+
const value = this.bindings.evaluate(block.itemsExpr, context.owner, context.locals, block.params);
|
|
1378
1379
|
const items = block.toItems(value);
|
|
1379
1380
|
if (items.length !== slices.length)
|
|
1380
1381
|
return false;
|