marko 6.0.119 → 6.0.120
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/common/accessor.d.ts +2 -0
- package/dist/common/accessor.debug.d.ts +2 -0
- package/dist/common/types.d.ts +7 -3
- package/dist/debug/dom.js +605 -575
- package/dist/debug/dom.mjs +605 -575
- package/dist/dom/queue.d.ts +7 -0
- package/dist/dom/renderer.d.ts +1 -0
- package/dist/dom/signals.d.ts +1 -1
- package/dist/dom.js +332 -311
- package/dist/dom.mjs +332 -311
- package/dist/translator/index.js +58 -11
- package/dist/translator/util/optional.d.ts +1 -0
- package/dist/translator/util/signals.d.ts +1 -0
- package/package.json +1 -1
package/dist/translator/index.js
CHANGED
|
@@ -145,11 +145,13 @@ var AccessorProp = /* @__PURE__ */ ((AccessorProp4) => {
|
|
|
145
145
|
AccessorProp4["ClosestBranchId"] = "#ClosestBranchId";
|
|
146
146
|
AccessorProp4["Creating"] = "#Creating";
|
|
147
147
|
AccessorProp4["Destroyed"] = "#Destroyed";
|
|
148
|
+
AccessorProp4["DetachedAwait"] = "#DetachedAwait";
|
|
148
149
|
AccessorProp4["EndNode"] = "#EndNode";
|
|
149
150
|
AccessorProp4["Id"] = "#Id";
|
|
150
151
|
AccessorProp4["LoopKey"] = "#LoopKey";
|
|
151
152
|
AccessorProp4["ParentBranch"] = "#ParentBranch";
|
|
152
153
|
AccessorProp4["PendingEffects"] = "#PendingEffects";
|
|
154
|
+
AccessorProp4["PendingRenders"] = "#PendingRenders";
|
|
153
155
|
AccessorProp4["PlaceholderBranch"] = "#PlaceholderBranch";
|
|
154
156
|
AccessorProp4["PlaceholderContent"] = "#PlaceholderContent";
|
|
155
157
|
AccessorProp4["Renderer"] = "#Renderer";
|
|
@@ -1128,6 +1130,9 @@ function find(data, cb) {
|
|
|
1128
1130
|
}
|
|
1129
1131
|
}
|
|
1130
1132
|
}
|
|
1133
|
+
function some(data, cb) {
|
|
1134
|
+
return data ? Array.isArray(data) ? data.some(cb) : !!cb(data, 0) : false;
|
|
1135
|
+
}
|
|
1131
1136
|
function toArray(data, cb) {
|
|
1132
1137
|
return data ? Array.isArray(data) ? data.map(cb) : [cb(data, 0)] : [];
|
|
1133
1138
|
}
|
|
@@ -1297,11 +1302,13 @@ var AccessorProp2 = /* @__PURE__ */ ((AccessorProp4) => {
|
|
|
1297
1302
|
AccessorProp4["ClosestBranchId"] = "G";
|
|
1298
1303
|
AccessorProp4["Creating"] = "H";
|
|
1299
1304
|
AccessorProp4["Destroyed"] = "I";
|
|
1305
|
+
AccessorProp4["DetachedAwait"] = "V";
|
|
1300
1306
|
AccessorProp4["EndNode"] = "K";
|
|
1301
1307
|
AccessorProp4["Id"] = "L";
|
|
1302
1308
|
AccessorProp4["LoopKey"] = "M";
|
|
1303
1309
|
AccessorProp4["ParentBranch"] = "N";
|
|
1304
1310
|
AccessorProp4["PendingEffects"] = "J";
|
|
1311
|
+
AccessorProp4["PendingRenders"] = "W";
|
|
1305
1312
|
AccessorProp4["PlaceholderBranch"] = "P";
|
|
1306
1313
|
AccessorProp4["PlaceholderContent"] = "Q";
|
|
1307
1314
|
AccessorProp4["Renderer"] = "R";
|
|
@@ -3336,6 +3343,7 @@ var [getClosureSignalBuilder, _setClosureSignalBuilder] = createSectionState("qu
|
|
|
3336
3343
|
function setClosureSignalBuilder(tag, builder) {
|
|
3337
3344
|
_setClosureSignalBuilder(getSectionForBody(tag.get("body")), builder);
|
|
3338
3345
|
}
|
|
3346
|
+
var [getTryHasPlaceholder, setTryHasPlaceholder] = createSectionState("tryWithPlaceholder");
|
|
3339
3347
|
var [getSerializedAccessors] = createSectionState("serializedScopeProperties", () => /* @__PURE__ */ new Map());
|
|
3340
3348
|
function setSectionSerializedValue(section, prop, expression) {
|
|
3341
3349
|
const reason = getSerializeReason(section, prop);
|
|
@@ -3429,23 +3437,37 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
|
|
|
3429
3437
|
};
|
|
3430
3438
|
} else if (referencedBindings.section !== section && bindingUtil.find(section.referencedClosures, referencedBindings)) {
|
|
3431
3439
|
signal.build = () => {
|
|
3432
|
-
const
|
|
3440
|
+
const closure = getCanonicalBinding(referencedBindings);
|
|
3433
3441
|
const render = getSignalFn(signal);
|
|
3434
3442
|
const closureSignalBuilder = getClosureSignalBuilder(section);
|
|
3435
|
-
|
|
3443
|
+
if (closureSignalBuilder && !isDynamicClosure(section, closure)) {
|
|
3444
|
+
return closureSignalBuilder(closure, render);
|
|
3445
|
+
}
|
|
3446
|
+
return callRuntime(
|
|
3436
3447
|
"_closure_get",
|
|
3437
|
-
getScopeAccessorLiteral(
|
|
3448
|
+
getScopeAccessorLiteral(closure, true),
|
|
3438
3449
|
render,
|
|
3439
|
-
isImmediateOwner(section,
|
|
3450
|
+
isImmediateOwner(section, closure) ? void 0 : import_compiler22.types.arrowFunctionExpression(
|
|
3440
3451
|
[scopeIdentifier],
|
|
3441
|
-
getScopeExpression(section,
|
|
3442
|
-
)
|
|
3443
|
-
|
|
3452
|
+
getScopeExpression(section, closure.section)
|
|
3453
|
+
),
|
|
3454
|
+
some(closure.closureSections, underTryPlaceholder) ? import_compiler22.types.stringLiteral(getResumeRegisterId(section, closure)) : void 0
|
|
3455
|
+
);
|
|
3444
3456
|
};
|
|
3445
3457
|
}
|
|
3446
3458
|
}
|
|
3447
3459
|
return signal;
|
|
3448
3460
|
}
|
|
3461
|
+
function underTryPlaceholder(section) {
|
|
3462
|
+
let curSection = section.parent;
|
|
3463
|
+
while (curSection) {
|
|
3464
|
+
if (getTryHasPlaceholder(curSection)) {
|
|
3465
|
+
return true;
|
|
3466
|
+
}
|
|
3467
|
+
curSection = curSection.parent;
|
|
3468
|
+
}
|
|
3469
|
+
return false;
|
|
3470
|
+
}
|
|
3449
3471
|
function initValue(binding, isLet = false) {
|
|
3450
3472
|
const section = binding.section;
|
|
3451
3473
|
const signal = getSignal(section, binding);
|
|
@@ -4038,10 +4060,29 @@ function writeHTMLResumeStatements(path5) {
|
|
|
4038
4060
|
import_compiler22.types.numericLiteral(getDynamicClosureIndex(closure, section)),
|
|
4039
4061
|
getAccessorPrefix().ClosureSignalIndex
|
|
4040
4062
|
);
|
|
4041
|
-
|
|
4042
|
-
section
|
|
4043
|
-
(
|
|
4044
|
-
|
|
4063
|
+
if (underTryPlaceholder(section)) {
|
|
4064
|
+
const reason = getSerializeReason(section);
|
|
4065
|
+
if (reason) {
|
|
4066
|
+
getHTMLSectionStatements(section).push(
|
|
4067
|
+
import_compiler22.types.expressionStatement(
|
|
4068
|
+
getExprIfSerialized(
|
|
4069
|
+
section,
|
|
4070
|
+
reason,
|
|
4071
|
+
callRuntime(
|
|
4072
|
+
"_script",
|
|
4073
|
+
getScopeIdIdentifier(section),
|
|
4074
|
+
import_compiler22.types.stringLiteral(getResumeRegisterId(section, closure))
|
|
4075
|
+
)
|
|
4076
|
+
)
|
|
4077
|
+
)
|
|
4078
|
+
);
|
|
4079
|
+
}
|
|
4080
|
+
} else {
|
|
4081
|
+
addWriteScopeBuilder(
|
|
4082
|
+
section,
|
|
4083
|
+
(expr) => callRuntime("_subscribe", identifier, expr)
|
|
4084
|
+
);
|
|
4085
|
+
}
|
|
4045
4086
|
}
|
|
4046
4087
|
}
|
|
4047
4088
|
});
|
|
@@ -11121,6 +11162,9 @@ var try_default = {
|
|
|
11121
11162
|
}
|
|
11122
11163
|
const tagBody = tag.get("body");
|
|
11123
11164
|
const bodySection = getSectionForBody(tagBody);
|
|
11165
|
+
if (tag.node.extra?.attributeTags?.["@placeholder"]) {
|
|
11166
|
+
setTryHasPlaceholder(bodySection, true);
|
|
11167
|
+
}
|
|
11124
11168
|
setSectionParentIsOwner(bodySection, true);
|
|
11125
11169
|
flushBefore(tag);
|
|
11126
11170
|
},
|
|
@@ -11160,6 +11204,9 @@ var try_default = {
|
|
|
11160
11204
|
enter(tag) {
|
|
11161
11205
|
const tagBody = tag.get("body");
|
|
11162
11206
|
const bodySection = getSectionForBody(tagBody);
|
|
11207
|
+
if (tag.node.extra?.attributeTags?.["@placeholder"]) {
|
|
11208
|
+
setTryHasPlaceholder(bodySection, true);
|
|
11209
|
+
}
|
|
11163
11210
|
setSectionParentIsOwner(bodySection, true);
|
|
11164
11211
|
visit(tag, 37 /* Replace */);
|
|
11165
11212
|
enterShallow(tag);
|
|
@@ -21,6 +21,7 @@ export declare function forEach<T>(data: Opt<T>, cb: (item: T, index: number) =>
|
|
|
21
21
|
export declare function fromIter<T>(data: Iterable<T>): T | Many<T> | undefined;
|
|
22
22
|
export declare function toIter<T>(data: Opt<T>): Iterable<T>;
|
|
23
23
|
export declare function find<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): Opt<T>;
|
|
24
|
+
export declare function some<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): boolean;
|
|
24
25
|
export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
|
|
25
26
|
export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
|
|
26
27
|
export declare function filterMap<T, R>(data: Opt<T>, cb: (item: T) => undefined | R): Opt<R>;
|
|
@@ -26,6 +26,7 @@ export type Signal = {
|
|
|
26
26
|
};
|
|
27
27
|
type closureSignalBuilder = (closure: Binding, render: t.Expression) => t.Expression;
|
|
28
28
|
export declare function setClosureSignalBuilder(tag: t.NodePath<t.MarkoTag>, builder: closureSignalBuilder): void;
|
|
29
|
+
export declare const getTryHasPlaceholder: (section: Section) => true | undefined, setTryHasPlaceholder: (section: Section, value: true | undefined) => void;
|
|
29
30
|
export declare function setSectionSerializedValue(section: Section, prop: AccessorProp, expression: t.Expression): void;
|
|
30
31
|
export declare function setBindingSerializedValue(section: Section, binding: Binding, expression: t.Expression, prefix?: AccessorPrefix): void;
|
|
31
32
|
export declare function setSerializedValue(section: Section, key: string, expression: t.Expression): void;
|