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,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 let _dynamic_tag: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, inputOrArgs: unknown, content?: (() => void) | 0, inputIsArgs?: 1, markerGuard?: 1 | 0, tagVar?: 1) => unknown;
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 {};
@@ -1,4 +1,3 @@
1
- export { forIn, forOf, forTo, forUntil } from "../common/for";
2
1
  import type { Falsy } from "../common/types";
3
2
  export declare function forOfBy(by: Falsy | string | ((item: unknown, index: number) => unknown), item: unknown, index: number): unknown;
4
3
  export declare function forInBy(by: Falsy | ((key: string, value: unknown) => unknown), name: string, value: unknown): unknown;
@@ -23,7 +23,7 @@ export declare function getContext(key: keyof NonNullable<Chunk["context"]>): un
23
23
  export declare function getState(): State;
24
24
  export declare function rendererKey(renderer: unknown): unknown;
25
25
  export declare function getScopeId(scope: unknown): number | undefined;
26
- export declare function getScopeById(scopeId: number | undefined): ScopeInternals | undefined;
26
+ export declare function getScopeById(scopeId: number): ScopeInternals | undefined;
27
27
  export declare function $global(): $Global & {
28
28
  renderId: string;
29
29
  runtimeId: string;
@@ -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: unknown, markerGuard?: number): void;
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 };
@@ -81,7 +81,6 @@ export declare function _write_guard(reason: GroupMask, group: number): 0 | 1;
81
81
  export declare function writeWaitReady(readyId: string, renderer: ServerRenderer, input: unknown): void;
82
82
  export declare function deferBranchStart(chunk: Chunk): string;
83
83
  export declare function applyBranchStart(chunk: Chunk, beforeBranch: string, rendered: boolean): void;
84
- declare const NOOP: () => void;
85
84
  export declare function getAsyncContent(chunk: Chunk): AsyncContent | undefined;
86
85
  type Mark = Mark.Value;
87
86
  export declare class State implements Channel {
@@ -106,6 +105,7 @@ export declare class State implements Channel {
106
105
  flushScopes: boolean;
107
106
  writeScopes: Record<number, PartialScope>;
108
107
  readyIds: Set<string> | null;
108
+ readyPositions: Record<string, Record<string, number>> | null;
109
109
  scopeReason: GroupMask;
110
110
  $global: $Global & {
111
111
  renderId: string;
@@ -135,6 +135,7 @@ export declare class State implements Channel {
135
135
  }
136
136
  type FlushStatus = FlushStatus.Value;
137
137
  export { FlushStatus };
138
+ export declare function NOOP(): void;
138
139
  export declare class Boundary {
139
140
  onNext: typeof NOOP;
140
141
  count: number;