marko 6.4.11 → 6.4.13
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/attr-tag.d.ts +1 -0
- package/dist/common/errors.d.ts +2 -0
- package/dist/common/helpers.d.ts +2 -0
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/compat.feat.js +143 -0
- package/dist/debug/dom/compat.feat.mjs +141 -0
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/debug/dom/lazy.feat.js +1 -1
- package/dist/debug/dom/lazy.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-DjUZd-9y.mjs → dom-BORByF2b.mjs} +54 -27
- package/dist/debug/{dom-mQ5mPBTF.js → dom-sfzdCRAg.js} +71 -38
- package/dist/debug/dom.js +4 -127
- package/dist/debug/dom.mjs +2 -119
- package/dist/debug/html/compat.feat.js +222 -0
- package/dist/debug/html/compat.feat.mjs +220 -0
- package/dist/debug/html-DMo6pc_h.mjs +3931 -0
- package/dist/debug/html-DfZjMkhx.js +4513 -0
- package/dist/debug/html.js +83 -4220
- package/dist/debug/html.mjs +1 -4133
- package/dist/dom/catch.feat.js +4 -4
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/{compat.d.ts → compat.feat.d.ts} +18 -9
- package/dist/dom/compat.feat.js +101 -0
- package/dist/dom/compat.feat.mjs +100 -0
- package/dist/dom/control-flow.d.ts +0 -1
- package/dist/dom/controllable-input.feat.js +2 -2
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +2 -2
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +2 -2
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +2 -2
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +2 -2
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dom.d.ts +2 -1
- package/dist/dom/dynamic-tag-script.feat.js +2 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +3 -3
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/resume.d.ts +3 -1
- package/dist/{dom-HEWdZCCb.mjs → dom-DKn1bCPC.mjs} +15 -19
- package/dist/{dom-B8j2453O.js → dom-DRiewpRL.js} +127 -136
- package/dist/dom.d.ts +0 -1
- package/dist/dom.js +21 -95
- package/dist/dom.mjs +3 -72
- package/dist/html/{compat.d.ts → compat.feat.d.ts} +5 -4
- package/dist/html/compat.feat.js +165 -0
- package/dist/html/compat.feat.mjs +164 -0
- package/dist/html/dynamic-tag.d.ts +1 -2
- package/dist/html/writer.d.ts +2 -1
- package/dist/html-DMDc0zKs.mjs +2404 -0
- package/dist/html-DrHsybFm.js +2880 -0
- package/dist/html.d.ts +0 -1
- package/dist/html.js +2 -2566
- package/dist/html.mjs +3 -2561
- package/dist/translator/core/if.d.ts +0 -85
- package/dist/translator/core/index.d.ts +2 -85
- package/dist/translator/index.d.ts +2 -85
- package/dist/translator/index.js +332 -476
- package/dist/translator/interop/index.d.ts +2 -0
- package/dist/translator/util/assert.d.ts +2 -0
- package/dist/translator/util/branch-tag.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +4 -1
- package/dist/translator/util/optional.d.ts +0 -1
- package/dist/translator/util/reasons.d.ts +0 -1
- package/dist/translator/util/references.d.ts +1 -0
- package/dist/translator/util/sections.d.ts +5 -1
- package/dist/translator/util/tag-facts.d.ts +2 -0
- package/dist/translator/util/translate-attrs.d.ts +1 -4
- package/dist/translator/visitors/program/index.d.ts +2 -2
- package/index.d.ts +2 -7
- package/package.json +4 -4
- package/tags/await.d.marko +9 -1
- package/tags/const.d.marko +7 -1
- package/tags/debug.d.marko +7 -1
- package/tags/define.d.marko +7 -1
- package/tags/effect.d.marko +6 -1
- package/tags/html-comment.d.marko +6 -0
- package/tags/html-script.d.marko +5 -0
- package/tags/html-style.d.marko +5 -0
- package/tags/id.d.marko +11 -1
- package/tags/let.d.marko +8 -1
- package/tags/lifecycle.d.marko +11 -1
- package/tags/log.d.marko +7 -1
- package/tags/script.d.marko +9 -1
- package/tags/show.d.marko +7 -1
- package/tags/try.d.marko +9 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
let SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_ID = "$C_b", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
2
|
+
$global,
|
|
3
|
+
writeLoadAsset,
|
|
4
|
+
fork(scopeId, promise, content) {
|
|
5
|
+
_await(scopeId, "a", promise, (value) => {
|
|
6
|
+
let branchId = _peek_scope_id();
|
|
7
|
+
content(value), _peek_scope_id() === branchId && _scope_id();
|
|
8
|
+
});
|
|
9
|
+
},
|
|
10
|
+
write: _html,
|
|
11
|
+
writeScript,
|
|
12
|
+
nextScopeId: _scope_id,
|
|
13
|
+
peekNextScopeId: _peek_scope_id,
|
|
14
|
+
isInResumedBranch,
|
|
15
|
+
withChunk,
|
|
16
|
+
getChunk,
|
|
17
|
+
ensureState($global) {
|
|
18
|
+
let state = $global[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
19
|
+
return state || ($global.runtimeId ||= "M", $global.renderId ||= $global.componentIdPrefix || $global.widgetIdPrefix || "_", $global[K_TAGS_API_STATE] = state = new State($global)), state;
|
|
20
|
+
},
|
|
21
|
+
isRenderer(value) {
|
|
22
|
+
return typeof value == "function" && "a" in value;
|
|
23
|
+
},
|
|
24
|
+
setRendererId(renderer, id) {
|
|
25
|
+
renderer.a = id;
|
|
26
|
+
},
|
|
27
|
+
onFlush(fn) {
|
|
28
|
+
let { flushHTML } = Chunk.prototype;
|
|
29
|
+
Chunk.prototype.flushHTML = function(boundary) {
|
|
30
|
+
let { state } = boundary, reorders = swapReorders(state, null);
|
|
31
|
+
return fn(this), swapReorders(state, reorders), flushHTML.call(this, boundary);
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
setClassAPIRenderer,
|
|
35
|
+
writeSetScopeForComponent(branchId, m5c, m5i) {
|
|
36
|
+
writeScope(branchId, {
|
|
37
|
+
m5c,
|
|
38
|
+
m5i
|
|
39
|
+
}), _script(branchId, SET_SCOPE_REGISTER_ID);
|
|
40
|
+
},
|
|
41
|
+
toJSON() {
|
|
42
|
+
return function() {
|
|
43
|
+
let compatRegistered = COMPAT_REGISTRY.get(this);
|
|
44
|
+
if (!compatRegistered) {
|
|
45
|
+
let registered = REGISTRY.get(this);
|
|
46
|
+
if (registered) {
|
|
47
|
+
let scopeId = registered.scope ? getScopeId(registered.scope) : void 0;
|
|
48
|
+
scopeId !== void 0 && _script(scopeId, SET_SCOPE_REGISTER_ID), COMPAT_REGISTRY.set(this, compatRegistered = [registered.id, scopeId]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return compatRegistered;
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
joinChunks(chunks) {
|
|
55
|
+
let joined;
|
|
56
|
+
for (let chunk of chunks) chunk.boundary.aborted || (joined ? joined.append(chunk) : joined = chunk);
|
|
57
|
+
return joined;
|
|
58
|
+
},
|
|
59
|
+
appendChunks(chunks) {
|
|
60
|
+
let chunk = $chunk;
|
|
61
|
+
for (let part of chunks) chunk.append(part), part.effects && (chunk.lastEffect = part.lastEffect);
|
|
62
|
+
},
|
|
63
|
+
deferReorders(reorders) {
|
|
64
|
+
let chunk = $chunk;
|
|
65
|
+
for (let i = reorders.length; i--;) {
|
|
66
|
+
let carrier = chunk.fork(chunk.boundary, chunk.next);
|
|
67
|
+
carrier.deferredReorder = reorders[i], chunk.next = carrier;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
createChunk($global) {
|
|
71
|
+
let state = this.ensureState($global);
|
|
72
|
+
return new Chunk(new Boundary(state), null, null, state);
|
|
73
|
+
},
|
|
74
|
+
flushScript(chunk, reorders) {
|
|
75
|
+
let { boundary } = chunk, { state } = boundary, html = "", scripts = "";
|
|
76
|
+
if (reorders) for (let reorder of reorders) state.reorder(reorder);
|
|
77
|
+
if (boundary.flush() === 0 && ({html, scripts} = chunk.flush(boundary)), boundary.aborted) throw boundary.reason;
|
|
78
|
+
if (boundary.count) throw /* @__PURE__ */ Error();
|
|
79
|
+
return {
|
|
80
|
+
html,
|
|
81
|
+
scripts
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
render(renderer, willRerender, classAPIOut, component, input, componentScopes, registerChildScope, parentChunk) {
|
|
85
|
+
if (parentChunk?.boundary.aborted) return;
|
|
86
|
+
let state = this.ensureState(classAPIOut.global), boundary = new Boundary(state, void 0, parentChunk?.boundary), context = getChunk()?.context ?? null, head = new Chunk(boundary, new Chunk(boundary, null, context, state), context, state), normalizedInput = input;
|
|
87
|
+
if ("renderBody" in input) {
|
|
88
|
+
normalizedInput = {};
|
|
89
|
+
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
90
|
+
}
|
|
91
|
+
let componentScope = new Chunk(boundary, null, context, state);
|
|
92
|
+
componentScope.render(() => {
|
|
93
|
+
if (this.hasPendingClassFunctions(classAPIOut.global) && drainClassFunctions(classAPIOut.global, (hostId) => {
|
|
94
|
+
let fnScopeId = _scope_id(), scope = writeScope(fnScopeId, {
|
|
95
|
+
m5c: component.id,
|
|
96
|
+
m5h: hostId
|
|
97
|
+
});
|
|
98
|
+
return _script(fnScopeId, SET_SCOPE_REGISTER_ID), scope;
|
|
99
|
+
}), willRerender || registerChildScope) {
|
|
100
|
+
let scopeId = _peek_scope_id();
|
|
101
|
+
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
102
|
+
}
|
|
103
|
+
}), head.render(() => {
|
|
104
|
+
_set_scope_reason(willRerender ? ALL_GROUPS : 0);
|
|
105
|
+
try {
|
|
106
|
+
renderer(normalizedInput);
|
|
107
|
+
} finally {
|
|
108
|
+
_set_scope_reason(void 0);
|
|
109
|
+
}
|
|
110
|
+
let asyncOut = classAPIOut.beginAsync({
|
|
111
|
+
last: !0,
|
|
112
|
+
timeout: -1
|
|
113
|
+
});
|
|
114
|
+
classAPIOut.onLast((next) => {
|
|
115
|
+
(boundary.onNext = () => {
|
|
116
|
+
if (boundary.aborted) boundary.onNext = NOOP, parentChunk?.boundary.aborted ? (asyncOut.end(), next()) : asyncOut.error(boundary.reason);
|
|
117
|
+
else if (!boundary.count) {
|
|
118
|
+
boundary.onNext = NOOP;
|
|
119
|
+
let queued = swapReorders(state, null);
|
|
120
|
+
head = head.consume(boundary);
|
|
121
|
+
let reorders = swapReorders(state, queued);
|
|
122
|
+
reorders && asyncOut.writer.get("reorders").push(...reorders);
|
|
123
|
+
let heldEffects = head.takeHeldEffects();
|
|
124
|
+
heldEffects && (head.effects = joinHeldEffects(heldEffects, head.effects), head.lastEffect = ""), asyncOut.write(head.html), asyncOut.script(head.scripts), head.html = head.scripts = "", asyncOut.writer.get("chunks").push(head), asyncOut.end(), componentScopes.push(componentScope), next();
|
|
125
|
+
}
|
|
126
|
+
})();
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
register,
|
|
131
|
+
registerRenderBody(fn) {
|
|
132
|
+
register(RENDER_BODY_ID, fn);
|
|
133
|
+
},
|
|
134
|
+
registerClassFunctions(input) {
|
|
135
|
+
for (let key in input) {
|
|
136
|
+
let value = input[key];
|
|
137
|
+
typeof value == "function" && !REGISTRY.has(value) && register(RENDER_BODY_ID, value);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
registerClassFunction($global, id, fn, hostId) {
|
|
141
|
+
let pending = pendingClassFunctions.get($global);
|
|
142
|
+
return pending || pendingClassFunctions.set($global, pending = []), pending.push([
|
|
143
|
+
id,
|
|
144
|
+
fn,
|
|
145
|
+
hostId
|
|
146
|
+
]), fn;
|
|
147
|
+
},
|
|
148
|
+
hasPendingClassFunctions($global) {
|
|
149
|
+
return !!pendingClassFunctions.get($global)?.length;
|
|
150
|
+
}
|
|
151
|
+
}, pendingClassFunctions = /* @__PURE__ */ new WeakMap();
|
|
152
|
+
import { A as $global, F as State, Ft as register, J as _scope_id, M as Boundary, N as Chunk, P as NOOP, Pt as REGISTRY, Q as _set_scope_reason, V as _html, Vt as setClassAPIRenderer, W as _peek_scope_id, Z as _script, _ as writeLoadAsset, at as getChunk, ct as joinHeldEffects, dt as writeScript, j as ALL_GROUPS, k as $chunk, lt as withChunk, ot as getScopeId, st as isInResumedBranch, t as _await, ut as writeScope } from "../html-DMDc0zKs.mjs";
|
|
153
|
+
// src/common/compat-meta.ts
|
|
154
|
+
// src/html/compat.feat.ts
|
|
155
|
+
function drainClassFunctions($global, writeScope) {
|
|
156
|
+
let pending = pendingClassFunctions.get($global), scopeByHost = {};
|
|
157
|
+
for (let [id, fn, hostId] of pending) register(id, fn, scopeByHost[hostId] ||= writeScope(hostId));
|
|
158
|
+
pending.length = 0;
|
|
159
|
+
}
|
|
160
|
+
function swapReorders(state, reorders) {
|
|
161
|
+
let { writeReorders } = state;
|
|
162
|
+
return state.writeReorders = reorders, writeReorders;
|
|
163
|
+
}
|
|
164
|
+
export { compat };
|
|
@@ -5,8 +5,7 @@ interface BodyContentObject {
|
|
|
5
5
|
[x: PropertyKey]: unknown;
|
|
6
6
|
content: ServerRenderer;
|
|
7
7
|
}
|
|
8
|
-
export declare
|
|
8
|
+
export declare function _dynamic_tag(scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, inputOrArgs: unknown, content?: (() => void) | 0, inputIsArgs?: 1, markerGuard?: 1 | 0, tagVar?: 1): unknown;
|
|
9
9
|
export declare function _content(id: string, fn: ServerRenderer, scopeId?: number): ServerRenderer;
|
|
10
10
|
export declare function _content_resume(id: string, fn: ServerRenderer, scopeId?: number, locals?: Locals): ServerRenderer;
|
|
11
|
-
export declare const patchDynamicTag: (patch: (tag: unknown, scopeId: number, accessor: Accessor) => unknown) => void;
|
|
12
11
|
export {};
|
package/dist/html/writer.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export declare function _el_mark(scopeId: number, accessor: Accessor, markerGuar
|
|
|
64
64
|
export declare function _text_mark(scopeId: number, accessor: Accessor, val: unknown, markerGuard?: number): string;
|
|
65
65
|
export declare function _html_mark(scopeId: number, accessor: Accessor, val: unknown, markerGuard?: number): string;
|
|
66
66
|
export declare function _resume_branch(scopeId: number): void;
|
|
67
|
-
export declare function _attr_content(nodeAccessor: Accessor, scopeId: number, content:
|
|
67
|
+
export declare function _attr_content(nodeAccessor: Accessor, scopeId: number, content: ServerRenderer | undefined, markerGuard?: number): void;
|
|
68
68
|
export declare function _var(parentScopeId: number, scopeOffsetAccessor: Accessor, childScopeId: number, registryId: string, nodeAccessor?: Accessor): void;
|
|
69
69
|
declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
|
|
70
70
|
export { writeScope as _scope };
|
|
@@ -105,6 +105,7 @@ export declare class State implements Channel {
|
|
|
105
105
|
flushScopes: boolean;
|
|
106
106
|
writeScopes: Record<number, PartialScope>;
|
|
107
107
|
readyIds: Set<string> | null;
|
|
108
|
+
readyPositions: Record<string, Record<string, number>> | null;
|
|
108
109
|
scopeReason: GroupMask;
|
|
109
110
|
$global: $Global & {
|
|
110
111
|
renderId: string;
|