marko 6.4.10 → 6.4.12
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 +0 -3
- package/dist/common/accessor.debug.d.ts +0 -3
- package/dist/common/attr-tag.d.ts +1 -0
- package/dist/common/errors.d.ts +2 -0
- package/dist/common/helpers.d.ts +3 -1
- package/dist/common/types.d.ts +4 -3
- 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-DNB5yq3U.js → dom-CtXOr4Nm.js} +257 -230
- package/dist/debug/{dom-C1V5vpFs.mjs → dom-DaHYZpf2.mjs} +238 -229
- package/dist/debug/dom.js +8 -134
- package/dist/debug/dom.mjs +5 -126
- 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 -4239
- package/dist/debug/html.mjs +1 -4152
- package/dist/dom/abort-signal.d.ts +1 -1
- package/dist/dom/catch.feat.js +3 -3
- 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 +4 -5
- 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 +1 -1
- 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/load.d.ts +3 -4
- package/dist/dom/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/queue.d.ts +1 -2
- package/dist/dom/resume.d.ts +3 -1
- package/dist/dom/signals.d.ts +5 -7
- package/dist/{dom-C2-Flitp.js → dom-BB-Te-3z.js} +222 -239
- package/dist/{dom-DsHYWMCR.mjs → dom-BO-0hzLZ.mjs} +124 -146
- package/dist/dom.d.ts +1 -2
- package/dist/dom.js +17 -95
- package/dist/dom.mjs +6 -79
- package/dist/html/assets.d.ts +3 -4
- 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/for.d.ts +0 -1
- package/dist/html/writer.d.ts +4 -3
- package/dist/html-DMDc0zKs.mjs +2404 -0
- package/dist/html-DrHsybFm.js +2880 -0
- package/dist/html.d.ts +1 -2
- package/dist/html.js +2 -2578
- package/dist/html.mjs +3 -2573
- package/dist/translator/index.d.ts +0 -1
- package/dist/translator/index.js +4889 -4733
- package/dist/translator/interop/out-global.d.ts +5 -0
- package/dist/translator/util/assert.d.ts +6 -0
- package/dist/translator/util/branch-tag.d.ts +1 -1
- package/dist/translator/util/entry-builder.d.ts +1 -1
- package/dist/translator/util/finalize-references.d.ts +2 -1
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +10 -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 +12 -5
- package/dist/translator/util/runtime.d.ts +1 -0
- package/dist/translator/util/sections.d.ts +11 -2
- package/dist/translator/util/signals.d.ts +2 -1
- package/dist/translator/util/style-interpolation.d.ts +1 -1
- package/dist/translator/util/tag-facts.d.ts +2 -0
- package/dist/translator/util/tag-name-type.d.ts +1 -0
- package/dist/translator/util/translate-attrs.d.ts +1 -4
- package/dist/translator/util/visitors.d.ts +1 -1
- package/dist/translator/util/write-guard.d.ts +2 -0
- package/dist/translator/visitors/program/index.d.ts +2 -6
- package/dist/translator/visitors/referenced-identifier.d.ts +3 -1
- package/index.d.ts +2 -7
- package/package.json +4 -4
- package/dist/common/constants/keyed-scopes-prop.d.ts +0 -4
- package/dist/common/constants/keyed-scopes-prop.debug.d.ts +0 -4
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
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-DMo6pc_h.mjs";
|
|
2
|
+
// src/common/compat-meta.ts
|
|
3
|
+
const SET_SCOPE_REGISTER_ID = "$compat_setScope";
|
|
4
|
+
const RENDER_BODY_ID = "$compat_renderBody";
|
|
5
|
+
// src/html/compat.feat.ts
|
|
6
|
+
const K_TAGS_API_STATE = Symbol();
|
|
7
|
+
const COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
const compat = {
|
|
9
|
+
$global,
|
|
10
|
+
writeLoadAsset,
|
|
11
|
+
fork(scopeId, promise, content) {
|
|
12
|
+
_await(scopeId, "#text/0", promise, (value) => {
|
|
13
|
+
const branchId = _peek_scope_id();
|
|
14
|
+
content(value);
|
|
15
|
+
if (_peek_scope_id() === branchId) _scope_id();
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
write: _html,
|
|
19
|
+
writeScript,
|
|
20
|
+
nextScopeId: _scope_id,
|
|
21
|
+
peekNextScopeId: _peek_scope_id,
|
|
22
|
+
isInResumedBranch,
|
|
23
|
+
withChunk,
|
|
24
|
+
getChunk,
|
|
25
|
+
ensureState($global) {
|
|
26
|
+
let state = $global[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
27
|
+
if (!state) {
|
|
28
|
+
$global.runtimeId ||= "M";
|
|
29
|
+
$global.renderId ||= $global.componentIdPrefix || $global.widgetIdPrefix || "_";
|
|
30
|
+
$global[K_TAGS_API_STATE] = state = new State($global);
|
|
31
|
+
}
|
|
32
|
+
return state;
|
|
33
|
+
},
|
|
34
|
+
isRenderer(value) {
|
|
35
|
+
return typeof value === "function" && "id" in value;
|
|
36
|
+
},
|
|
37
|
+
setRendererId(renderer, id) {
|
|
38
|
+
renderer["id"] = id;
|
|
39
|
+
},
|
|
40
|
+
onFlush(fn) {
|
|
41
|
+
const { flushHTML } = Chunk.prototype;
|
|
42
|
+
Chunk.prototype.flushHTML = function(boundary) {
|
|
43
|
+
const { state } = boundary;
|
|
44
|
+
const reorders = swapReorders(state, null);
|
|
45
|
+
fn(this);
|
|
46
|
+
swapReorders(state, reorders);
|
|
47
|
+
return flushHTML.call(this, boundary);
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
setClassAPIRenderer,
|
|
51
|
+
writeSetScopeForComponent(branchId, m5c, m5i) {
|
|
52
|
+
writeScope(branchId, {
|
|
53
|
+
m5c,
|
|
54
|
+
m5i
|
|
55
|
+
});
|
|
56
|
+
_script(branchId, SET_SCOPE_REGISTER_ID);
|
|
57
|
+
},
|
|
58
|
+
toJSON() {
|
|
59
|
+
return function toJSON() {
|
|
60
|
+
let compatRegistered = COMPAT_REGISTRY.get(this);
|
|
61
|
+
if (!compatRegistered) {
|
|
62
|
+
const registered = REGISTRY.get(this);
|
|
63
|
+
if (registered) {
|
|
64
|
+
const scopeId = registered.scope ? getScopeId(registered.scope) : void 0;
|
|
65
|
+
if (scopeId !== void 0) _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
66
|
+
COMPAT_REGISTRY.set(this, compatRegistered = [registered.id, scopeId]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return compatRegistered;
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
joinChunks(chunks) {
|
|
73
|
+
let joined;
|
|
74
|
+
for (const chunk of chunks) {
|
|
75
|
+
if (chunk.boundary.aborted) continue;
|
|
76
|
+
if (joined) joined.append(chunk);
|
|
77
|
+
else joined = chunk;
|
|
78
|
+
}
|
|
79
|
+
return joined;
|
|
80
|
+
},
|
|
81
|
+
appendChunks(chunks) {
|
|
82
|
+
const chunk = $chunk;
|
|
83
|
+
for (const part of chunks) {
|
|
84
|
+
chunk.append(part);
|
|
85
|
+
if (part.effects) chunk.lastEffect = part.lastEffect;
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
deferReorders(reorders) {
|
|
89
|
+
const chunk = $chunk;
|
|
90
|
+
for (let i = reorders.length; i--;) {
|
|
91
|
+
const carrier = chunk.fork(chunk.boundary, chunk.next);
|
|
92
|
+
carrier.deferredReorder = reorders[i];
|
|
93
|
+
chunk.next = carrier;
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
createChunk($global) {
|
|
97
|
+
const state = this.ensureState($global);
|
|
98
|
+
return new Chunk(new Boundary(state), null, null, state);
|
|
99
|
+
},
|
|
100
|
+
flushScript(chunk, reorders) {
|
|
101
|
+
const { boundary } = chunk;
|
|
102
|
+
const { state } = boundary;
|
|
103
|
+
let html = "";
|
|
104
|
+
let scripts = "";
|
|
105
|
+
if (reorders) for (const reorder of reorders) state.reorder(reorder);
|
|
106
|
+
if (boundary.flush() === 0) ({html, scripts} = chunk.flush(boundary));
|
|
107
|
+
if (boundary.aborted) throw boundary.reason;
|
|
108
|
+
if (boundary.count) throw /* @__PURE__ */ new Error("Cannot serialize promise across tags/class compat layer.");
|
|
109
|
+
return {
|
|
110
|
+
html,
|
|
111
|
+
scripts
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
render(renderer, willRerender, classAPIOut, component, input, componentScopes, registerChildScope, parentChunk) {
|
|
115
|
+
if (parentChunk?.boundary.aborted) return;
|
|
116
|
+
const state = this.ensureState(classAPIOut.global);
|
|
117
|
+
const boundary = new Boundary(state, void 0, parentChunk?.boundary);
|
|
118
|
+
const context = getChunk()?.context ?? null;
|
|
119
|
+
let head = new Chunk(boundary, new Chunk(boundary, null, context, state), context, state);
|
|
120
|
+
let normalizedInput = input;
|
|
121
|
+
if ("renderBody" in input) {
|
|
122
|
+
normalizedInput = {};
|
|
123
|
+
for (const key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
124
|
+
}
|
|
125
|
+
const componentScope = new Chunk(boundary, null, context, state);
|
|
126
|
+
componentScope.render(() => {
|
|
127
|
+
if (this.hasPendingClassFunctions(classAPIOut.global)) drainClassFunctions(classAPIOut.global, (hostId) => {
|
|
128
|
+
const fnScopeId = _scope_id();
|
|
129
|
+
const scope = writeScope(fnScopeId, {
|
|
130
|
+
m5c: component.id,
|
|
131
|
+
m5h: hostId
|
|
132
|
+
});
|
|
133
|
+
_script(fnScopeId, SET_SCOPE_REGISTER_ID);
|
|
134
|
+
return scope;
|
|
135
|
+
});
|
|
136
|
+
if (willRerender || registerChildScope) {
|
|
137
|
+
const scopeId = _peek_scope_id();
|
|
138
|
+
writeScope(scopeId, { m5c: component.id });
|
|
139
|
+
_script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
head.render(() => {
|
|
143
|
+
_set_scope_reason(willRerender ? ALL_GROUPS : 0);
|
|
144
|
+
try {
|
|
145
|
+
renderer(normalizedInput);
|
|
146
|
+
} finally {
|
|
147
|
+
_set_scope_reason(void 0);
|
|
148
|
+
}
|
|
149
|
+
const asyncOut = classAPIOut.beginAsync({
|
|
150
|
+
last: true,
|
|
151
|
+
timeout: -1
|
|
152
|
+
});
|
|
153
|
+
classAPIOut.onLast((next) => {
|
|
154
|
+
(boundary.onNext = () => {
|
|
155
|
+
if (boundary.aborted) {
|
|
156
|
+
boundary.onNext = NOOP;
|
|
157
|
+
if (parentChunk?.boundary.aborted) {
|
|
158
|
+
asyncOut.end();
|
|
159
|
+
next();
|
|
160
|
+
} else asyncOut.error(boundary.reason);
|
|
161
|
+
} else if (!boundary.count) {
|
|
162
|
+
boundary.onNext = NOOP;
|
|
163
|
+
const queued = swapReorders(state, null);
|
|
164
|
+
head = head.consume(boundary);
|
|
165
|
+
const reorders = swapReorders(state, queued);
|
|
166
|
+
if (reorders) asyncOut.writer.get("reorders").push(...reorders);
|
|
167
|
+
const heldEffects = head.takeHeldEffects();
|
|
168
|
+
if (heldEffects) {
|
|
169
|
+
head.effects = joinHeldEffects(heldEffects, head.effects);
|
|
170
|
+
head.lastEffect = "";
|
|
171
|
+
}
|
|
172
|
+
asyncOut.write(head.html);
|
|
173
|
+
asyncOut.script(head.scripts);
|
|
174
|
+
head.html = head.scripts = "";
|
|
175
|
+
asyncOut.writer.get("chunks").push(head);
|
|
176
|
+
asyncOut.end();
|
|
177
|
+
componentScopes.push(componentScope);
|
|
178
|
+
next();
|
|
179
|
+
}
|
|
180
|
+
})();
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
register,
|
|
185
|
+
registerRenderBody(fn) {
|
|
186
|
+
register(RENDER_BODY_ID, fn);
|
|
187
|
+
},
|
|
188
|
+
registerClassFunctions(input) {
|
|
189
|
+
for (const key in input) {
|
|
190
|
+
const value = input[key];
|
|
191
|
+
if (typeof value === "function" && !REGISTRY.has(value)) register(RENDER_BODY_ID, value);
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
registerClassFunction($global, id, fn, hostId) {
|
|
195
|
+
let pending = pendingClassFunctions.get($global);
|
|
196
|
+
if (!pending) pendingClassFunctions.set($global, pending = []);
|
|
197
|
+
pending.push([
|
|
198
|
+
id,
|
|
199
|
+
fn,
|
|
200
|
+
hostId
|
|
201
|
+
]);
|
|
202
|
+
return fn;
|
|
203
|
+
},
|
|
204
|
+
hasPendingClassFunctions($global) {
|
|
205
|
+
return !!pendingClassFunctions.get($global)?.length;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
const pendingClassFunctions = /* @__PURE__ */ new WeakMap();
|
|
209
|
+
function drainClassFunctions($global, writeScope) {
|
|
210
|
+
const pending = pendingClassFunctions.get($global);
|
|
211
|
+
const scopeByHost = {};
|
|
212
|
+
for (const [id, fn, hostId] of pending) register(id, fn, scopeByHost[hostId] ||= writeScope(hostId));
|
|
213
|
+
pending.length = 0;
|
|
214
|
+
}
|
|
215
|
+
function swapReorders(state, reorders) {
|
|
216
|
+
const { writeReorders } = state;
|
|
217
|
+
state.writeReorders = reorders;
|
|
218
|
+
return writeReorders;
|
|
219
|
+
}
|
|
220
|
+
export { compat };
|