marko 6.0.63 → 6.0.64
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/debug/dom.js +9 -2
- package/dist/debug/dom.mjs +9 -2
- package/dist/dom/signals.d.ts +2 -2
- package/dist/dom.js +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/translator/index.js +30 -11
- package/package.json +1 -1
- package/tags/let.d.marko +1 -1
package/dist/debug/dom.js
CHANGED
@@ -1059,9 +1059,16 @@ function _var(scope, childAccessor, signal) {
|
|
1059
1059
|
}
|
1060
1060
|
var _return = (scope, value) => scope["#TagVariable" /* TagVariable */]?.(value);
|
1061
1061
|
function _return_change(scope, changeHandler) {
|
1062
|
-
|
1062
|
+
if (changeHandler) {
|
1063
|
+
scope["#TagVariableChange" /* TagVariableChange */] = changeHandler;
|
1064
|
+
}
|
1063
1065
|
}
|
1064
|
-
var _var_change = (scope, value
|
1066
|
+
var _var_change = true ? (scope, value, name = "This") => {
|
1067
|
+
if (typeof scope["#TagVariableChange" /* TagVariableChange */] !== "function") {
|
1068
|
+
throw new TypeError(`${name} is a readonly tag variable.`);
|
1069
|
+
}
|
1070
|
+
scope["#TagVariableChange" /* TagVariableChange */](value);
|
1071
|
+
} : (scope, value) => scope["#TagVariableChange" /* TagVariableChange */]?.(value);
|
1065
1072
|
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
1066
1073
|
function _id({ $global }) {
|
1067
1074
|
const id = tagIdsByGlobal.get($global) || 0;
|
package/dist/debug/dom.mjs
CHANGED
@@ -962,9 +962,16 @@ function _var(scope, childAccessor, signal) {
|
|
962
962
|
}
|
963
963
|
var _return = (scope, value) => scope["#TagVariable" /* TagVariable */]?.(value);
|
964
964
|
function _return_change(scope, changeHandler) {
|
965
|
-
|
965
|
+
if (changeHandler) {
|
966
|
+
scope["#TagVariableChange" /* TagVariableChange */] = changeHandler;
|
967
|
+
}
|
966
968
|
}
|
967
|
-
var _var_change = (scope, value
|
969
|
+
var _var_change = true ? (scope, value, name = "This") => {
|
970
|
+
if (typeof scope["#TagVariableChange" /* TagVariableChange */] !== "function") {
|
971
|
+
throw new TypeError(`${name} is a readonly tag variable.`);
|
972
|
+
}
|
973
|
+
scope["#TagVariableChange" /* TagVariableChange */](value);
|
974
|
+
} : (scope, value) => scope["#TagVariableChange" /* TagVariableChange */]?.(value);
|
968
975
|
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
969
976
|
function _id({ $global }) {
|
970
977
|
const id = tagIdsByGlobal.get($global) || 0;
|
package/dist/dom/signals.d.ts
CHANGED
@@ -17,8 +17,8 @@ export declare function _closure_get<T>(valueAccessor: Accessor, fn: Signal<T>,
|
|
17
17
|
};
|
18
18
|
export declare function _var(scope: Scope, childAccessor: Accessor, signal: Signal<unknown>): void;
|
19
19
|
export declare const _return: (scope: Scope, value: unknown) => any;
|
20
|
-
export declare function _return_change(scope: Scope, changeHandler
|
21
|
-
export declare const _var_change: (scope: Scope, value: unknown) =>
|
20
|
+
export declare function _return_change(scope: Scope, changeHandler?: ((value: unknown) => void) | null | false): void;
|
21
|
+
export declare const _var_change: (scope: Scope, value: unknown, name?: string) => void;
|
22
22
|
export declare function _id({ $global }: Scope): string;
|
23
23
|
export declare function _script(id: string, fn: (scope: Scope) => void): (scope: Scope) => void;
|
24
24
|
export declare function _hoist(...path: Accessor[]): (scope: Scope) => (...args: unknown[]) => any;
|
package/dist/dom.js
CHANGED
@@ -684,7 +684,7 @@ function _var(scope, childAccessor, signal) {
|
|
684
684
|
}
|
685
685
|
var _return = (scope, value) => scope.e?.(value);
|
686
686
|
function _return_change(scope, changeHandler) {
|
687
|
-
scope.f = changeHandler;
|
687
|
+
changeHandler && (scope.f = changeHandler);
|
688
688
|
}
|
689
689
|
var _var_change = (scope, value) => scope.f?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
690
690
|
function _id({ $global }) {
|
package/dist/dom.mjs
CHANGED
@@ -590,7 +590,7 @@ function _var(scope, childAccessor, signal) {
|
|
590
590
|
}
|
591
591
|
var _return = (scope, value) => scope.e?.(value);
|
592
592
|
function _return_change(scope, changeHandler) {
|
593
|
-
scope.f = changeHandler;
|
593
|
+
changeHandler && (scope.f = changeHandler);
|
594
594
|
}
|
595
595
|
var _var_change = (scope, value) => scope.f?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
596
596
|
function _id({ $global }) {
|
package/dist/translator/index.js
CHANGED
@@ -3135,7 +3135,11 @@ var return_default = {
|
|
3135
3135
|
setSectionSerializedValue(
|
3136
3136
|
section,
|
3137
3137
|
getAccessorProp().TagVariableChange,
|
3138
|
-
|
3138
|
+
import_compiler18.types.logicalExpression(
|
3139
|
+
"||",
|
3140
|
+
attrs.valueChange,
|
3141
|
+
import_compiler18.types.unaryExpression("void", import_compiler18.types.numericLiteral(0))
|
3142
|
+
)
|
3139
3143
|
);
|
3140
3144
|
}
|
3141
3145
|
if (attrs.value) {
|
@@ -9570,7 +9574,7 @@ var let_default = {
|
|
9570
9574
|
"The [`<let>` tag](https://next.markojs.com/docs/reference/core-tag#let) variable cannot be destructured."
|
9571
9575
|
);
|
9572
9576
|
}
|
9573
|
-
if (valueChangeAttr && (0, import_babel_utils38.computeNode)(valueChangeAttr.value)) {
|
9577
|
+
if (valueChangeAttr && (0, import_babel_utils38.computeNode)(valueChangeAttr.value)?.value) {
|
9574
9578
|
throw tag.get("attributes").find((attr) => attr.node === valueChangeAttr).get("value").buildCodeFrameError(
|
9575
9579
|
"The [`<let>` tag](https://next.markojs.com/docs/reference/core-tag#let) [`valueChange=` attribute](https://next.markojs.com/docs/reference/core-tag#controllable-let) must be a function."
|
9576
9580
|
);
|
@@ -9621,7 +9625,11 @@ var let_default = {
|
|
9621
9625
|
setBindingSerializedValue(
|
9622
9626
|
section,
|
9623
9627
|
binding,
|
9624
|
-
|
9628
|
+
import_compiler44.types.logicalExpression(
|
9629
|
+
"||",
|
9630
|
+
valueChangeAttr.value,
|
9631
|
+
import_compiler44.types.unaryExpression("void", import_compiler44.types.numericLiteral(0))
|
9632
|
+
),
|
9625
9633
|
getAccessorPrefix().TagVariableChange
|
9626
9634
|
);
|
9627
9635
|
}
|
@@ -10734,6 +10742,7 @@ var custom_tag_default = {
|
|
10734
10742
|
throw tag.get("name").buildCodeFrameError("Unable to resolve file for tag.");
|
10735
10743
|
}
|
10736
10744
|
const varBinding = trackVarReferences(tag, 5 /* derived */);
|
10745
|
+
const mutatesTagVar = !!(tag.node.var?.type === "Identifier" && tag.scope.getBinding(tag.node.var.name)?.constantViolations.length);
|
10737
10746
|
if (varBinding) {
|
10738
10747
|
varBinding.scopeOffset = tagExtra[kChildOffsetScopeBinding] = createBinding("#scopeOffset", 0 /* dom */, section);
|
10739
10748
|
}
|
@@ -10745,7 +10754,7 @@ var custom_tag_default = {
|
|
10745
10754
|
addBindingSerializeReasonExpr(
|
10746
10755
|
section,
|
10747
10756
|
childScopeBinding,
|
10748
|
-
varSerializeReason
|
10757
|
+
mutatesTagVar || varSerializeReason
|
10749
10758
|
);
|
10750
10759
|
}
|
10751
10760
|
} else {
|
@@ -10771,7 +10780,7 @@ var custom_tag_default = {
|
|
10771
10780
|
addBindingSerializeReasonExpr(
|
10772
10781
|
section,
|
10773
10782
|
childScopeBinding,
|
10774
|
-
varSerializeReason
|
10783
|
+
mutatesTagVar || varSerializeReason
|
10775
10784
|
);
|
10776
10785
|
}
|
10777
10786
|
if (childExtra.inputSerializeReasons) {
|
@@ -10987,16 +10996,21 @@ function translateDOM(tag) {
|
|
10987
10996
|
);
|
10988
10997
|
const inputExport = childExports.input;
|
10989
10998
|
if (node.var) {
|
10999
|
+
const varBinding = node.var.extra.binding;
|
10990
11000
|
const source = initValue(
|
10991
11001
|
// TODO: support destructuring
|
10992
|
-
|
11002
|
+
varBinding
|
10993
11003
|
);
|
10994
11004
|
source.register = true;
|
10995
11005
|
source.buildAssignment = (valueSection, value) => {
|
10996
|
-
|
11006
|
+
const changeArgs = [
|
10997
11007
|
createScopeReadExpression(valueSection, childScopeBinding),
|
10998
11008
|
value
|
10999
|
-
]
|
11009
|
+
];
|
11010
|
+
if (!isOptimize()) {
|
11011
|
+
changeArgs.push(import_compiler56.types.stringLiteral(varBinding.name));
|
11012
|
+
}
|
11013
|
+
return import_compiler56.types.callExpression(importRuntime("_var_change"), changeArgs);
|
11000
11014
|
};
|
11001
11015
|
addStatement(
|
11002
11016
|
"render",
|
@@ -11741,13 +11755,14 @@ var dynamic_tag_default = {
|
|
11741
11755
|
const signal = getSignal(section, nodeBinding, "dynamicTag");
|
11742
11756
|
let tagVarSignal;
|
11743
11757
|
if (tag.node.var) {
|
11758
|
+
const varBinding = tag.node.var.extra.binding;
|
11744
11759
|
tagVarSignal = initValue(
|
11745
11760
|
// TODO: support destructuring
|
11746
|
-
|
11761
|
+
varBinding
|
11747
11762
|
);
|
11748
11763
|
tagVarSignal.register = true;
|
11749
11764
|
tagVarSignal.buildAssignment = (valueSection, value) => {
|
11750
|
-
|
11765
|
+
const changeArgs = [
|
11751
11766
|
import_compiler57.types.memberExpression(
|
11752
11767
|
getScopeExpression(tagVarSignal.section, valueSection),
|
11753
11768
|
import_compiler57.types.stringLiteral(
|
@@ -11756,7 +11771,11 @@ var dynamic_tag_default = {
|
|
11756
11771
|
true
|
11757
11772
|
),
|
11758
11773
|
value
|
11759
|
-
]
|
11774
|
+
];
|
11775
|
+
if (!isOptimize()) {
|
11776
|
+
changeArgs.push(import_compiler57.types.stringLiteral(varBinding.name));
|
11777
|
+
}
|
11778
|
+
return import_compiler57.types.callExpression(importRuntime("_var_change"), changeArgs);
|
11760
11779
|
};
|
11761
11780
|
}
|
11762
11781
|
signal.build = () => {
|
package/package.json
CHANGED