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.
Files changed (112) hide show
  1. package/dist/common/accessor.d.ts +0 -3
  2. package/dist/common/accessor.debug.d.ts +0 -3
  3. package/dist/common/attr-tag.d.ts +1 -0
  4. package/dist/common/errors.d.ts +2 -0
  5. package/dist/common/helpers.d.ts +3 -1
  6. package/dist/common/types.d.ts +4 -3
  7. package/dist/debug/dom/catch.feat.js +1 -1
  8. package/dist/debug/dom/catch.feat.mjs +1 -1
  9. package/dist/debug/dom/compat.feat.js +143 -0
  10. package/dist/debug/dom/compat.feat.mjs +141 -0
  11. package/dist/debug/dom/controllable-input.feat.js +1 -1
  12. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable-open.feat.js +1 -1
  14. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  15. package/dist/debug/dom/controllable-select.feat.js +1 -1
  16. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  17. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  18. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  19. package/dist/debug/dom/controllable.feat.js +1 -1
  20. package/dist/debug/dom/controllable.feat.mjs +1 -1
  21. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  22. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  23. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  24. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  25. package/dist/debug/dom/lazy.feat.js +1 -1
  26. package/dist/debug/dom/lazy.feat.mjs +1 -1
  27. package/dist/debug/dom/placeholder.feat.js +1 -1
  28. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  29. package/dist/debug/{dom-DNB5yq3U.js → dom-CtXOr4Nm.js} +257 -230
  30. package/dist/debug/{dom-C1V5vpFs.mjs → dom-DaHYZpf2.mjs} +238 -229
  31. package/dist/debug/dom.js +8 -134
  32. package/dist/debug/dom.mjs +5 -126
  33. package/dist/debug/html/compat.feat.js +222 -0
  34. package/dist/debug/html/compat.feat.mjs +220 -0
  35. package/dist/debug/html-DMo6pc_h.mjs +3931 -0
  36. package/dist/debug/html-DfZjMkhx.js +4513 -0
  37. package/dist/debug/html.js +83 -4239
  38. package/dist/debug/html.mjs +1 -4152
  39. package/dist/dom/abort-signal.d.ts +1 -1
  40. package/dist/dom/catch.feat.js +3 -3
  41. package/dist/dom/catch.feat.mjs +1 -1
  42. package/dist/dom/{compat.d.ts → compat.feat.d.ts} +18 -9
  43. package/dist/dom/compat.feat.js +101 -0
  44. package/dist/dom/compat.feat.mjs +100 -0
  45. package/dist/dom/control-flow.d.ts +4 -5
  46. package/dist/dom/controllable-input.feat.js +2 -2
  47. package/dist/dom/controllable-input.feat.mjs +1 -1
  48. package/dist/dom/controllable-open.feat.js +2 -2
  49. package/dist/dom/controllable-open.feat.mjs +1 -1
  50. package/dist/dom/controllable-select.feat.js +2 -2
  51. package/dist/dom/controllable-select.feat.mjs +1 -1
  52. package/dist/dom/controllable-textarea.feat.js +2 -2
  53. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  54. package/dist/dom/controllable.feat.js +2 -2
  55. package/dist/dom/controllable.feat.mjs +1 -1
  56. package/dist/dom/dom.d.ts +2 -1
  57. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  58. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  59. package/dist/dom/dynamic-tag-var.feat.js +1 -1
  60. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  61. package/dist/dom/lazy.feat.js +1 -1
  62. package/dist/dom/lazy.feat.mjs +1 -1
  63. package/dist/dom/load.d.ts +3 -4
  64. package/dist/dom/placeholder.feat.js +3 -3
  65. package/dist/dom/placeholder.feat.mjs +1 -1
  66. package/dist/dom/queue.d.ts +1 -2
  67. package/dist/dom/resume.d.ts +3 -1
  68. package/dist/dom/signals.d.ts +5 -7
  69. package/dist/{dom-C2-Flitp.js → dom-BB-Te-3z.js} +222 -239
  70. package/dist/{dom-DsHYWMCR.mjs → dom-BO-0hzLZ.mjs} +124 -146
  71. package/dist/dom.d.ts +1 -2
  72. package/dist/dom.js +17 -95
  73. package/dist/dom.mjs +6 -79
  74. package/dist/html/assets.d.ts +3 -4
  75. package/dist/html/{compat.d.ts → compat.feat.d.ts} +5 -4
  76. package/dist/html/compat.feat.js +165 -0
  77. package/dist/html/compat.feat.mjs +164 -0
  78. package/dist/html/dynamic-tag.d.ts +1 -2
  79. package/dist/html/for.d.ts +0 -1
  80. package/dist/html/writer.d.ts +4 -3
  81. package/dist/html-DMDc0zKs.mjs +2404 -0
  82. package/dist/html-DrHsybFm.js +2880 -0
  83. package/dist/html.d.ts +1 -2
  84. package/dist/html.js +2 -2578
  85. package/dist/html.mjs +3 -2573
  86. package/dist/translator/index.d.ts +0 -1
  87. package/dist/translator/index.js +4889 -4733
  88. package/dist/translator/interop/out-global.d.ts +5 -0
  89. package/dist/translator/util/assert.d.ts +6 -0
  90. package/dist/translator/util/branch-tag.d.ts +1 -1
  91. package/dist/translator/util/entry-builder.d.ts +1 -1
  92. package/dist/translator/util/finalize-references.d.ts +2 -1
  93. package/dist/translator/util/for-selector.d.ts +1 -1
  94. package/dist/translator/util/known-tag.d.ts +10 -1
  95. package/dist/translator/util/optional.d.ts +0 -1
  96. package/dist/translator/util/reasons.d.ts +0 -1
  97. package/dist/translator/util/references.d.ts +12 -5
  98. package/dist/translator/util/runtime.d.ts +1 -0
  99. package/dist/translator/util/sections.d.ts +11 -2
  100. package/dist/translator/util/signals.d.ts +2 -1
  101. package/dist/translator/util/style-interpolation.d.ts +1 -1
  102. package/dist/translator/util/tag-facts.d.ts +2 -0
  103. package/dist/translator/util/tag-name-type.d.ts +1 -0
  104. package/dist/translator/util/translate-attrs.d.ts +1 -4
  105. package/dist/translator/util/visitors.d.ts +1 -1
  106. package/dist/translator/util/write-guard.d.ts +2 -0
  107. package/dist/translator/visitors/program/index.d.ts +2 -6
  108. package/dist/translator/visitors/referenced-identifier.d.ts +3 -1
  109. package/index.d.ts +2 -7
  110. package/package.json +4 -4
  111. package/dist/common/constants/keyed-scopes-prop.d.ts +0 -4
  112. 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 };