marko 6.4.4 → 6.4.6

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 (133) hide show
  1. package/dist/common/errors.d.ts +2 -1
  2. package/dist/common/helpers.d.ts +7 -7
  3. package/dist/debug/dom/catch.feat.js +3 -3
  4. package/dist/debug/dom/catch.feat.mjs +3 -3
  5. package/dist/debug/dom/controllable-input.feat.js +1 -1
  6. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-open.feat.js +1 -1
  8. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-select.feat.js +1 -1
  10. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable.feat.js +5 -5
  14. package/dist/debug/dom/controllable.feat.mjs +5 -5
  15. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  16. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  17. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  19. package/dist/debug/dom/lazy.feat.js +1 -1
  20. package/dist/debug/dom/lazy.feat.mjs +1 -1
  21. package/dist/debug/dom/placeholder.feat.js +1 -1
  22. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  23. package/dist/debug/{dom-CUxvM4i9.js → dom-CNgQ6lj9.js} +52 -52
  24. package/dist/debug/{dom-BeY1nGUb.mjs → dom-o9jQjchF.mjs} +43 -43
  25. package/dist/debug/dom.js +4 -4
  26. package/dist/debug/dom.mjs +4 -4
  27. package/dist/debug/html.js +721 -654
  28. package/dist/debug/html.mjs +721 -654
  29. package/dist/dom/catch.feat.js +4 -4
  30. package/dist/dom/catch.feat.mjs +3 -3
  31. package/dist/dom/control-flow.d.ts +2 -2
  32. package/dist/dom/controllable-input.feat.js +2 -2
  33. package/dist/dom/controllable-input.feat.mjs +1 -1
  34. package/dist/dom/controllable-open.feat.js +2 -2
  35. package/dist/dom/controllable-open.feat.mjs +1 -1
  36. package/dist/dom/controllable-select.feat.js +2 -2
  37. package/dist/dom/controllable-select.feat.mjs +1 -1
  38. package/dist/dom/controllable-textarea.feat.js +2 -2
  39. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  40. package/dist/dom/controllable.d.ts +4 -4
  41. package/dist/dom/controllable.feat.js +2 -2
  42. package/dist/dom/controllable.feat.mjs +2 -2
  43. package/dist/dom/dom.d.ts +5 -5
  44. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  45. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  46. package/dist/dom/dynamic-tag-var.feat.js +2 -2
  47. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  48. package/dist/dom/lazy.feat.js +1 -1
  49. package/dist/dom/lazy.feat.mjs +1 -1
  50. package/dist/dom/placeholder.feat.js +1 -1
  51. package/dist/dom/placeholder.feat.mjs +1 -1
  52. package/dist/dom/signals.d.ts +4 -1
  53. package/dist/{dom-Diu8MpmL.js → dom-60R4bRWD.js} +40 -40
  54. package/dist/{dom-DefWmvQB.mjs → dom-Ci2W4l1P.mjs} +33 -33
  55. package/dist/dom.js +6 -6
  56. package/dist/dom.mjs +4 -4
  57. package/dist/html/assets.d.ts +1 -1
  58. package/dist/html/compat.d.ts +2 -1
  59. package/dist/html/control-flow.d.ts +20 -0
  60. package/dist/html/serializer.d.ts +63 -16
  61. package/dist/html/writer.d.ts +47 -35
  62. package/dist/html.d.ts +2 -1
  63. package/dist/html.js +517 -466
  64. package/dist/html.mjs +517 -466
  65. package/dist/translator/core/for.d.ts +0 -4
  66. package/dist/translator/core/return.d.ts +0 -3
  67. package/dist/translator/core/style.d.ts +2 -2
  68. package/dist/translator/index.js +8104 -8108
  69. package/dist/translator/util/analyze-errors.d.ts +2 -1
  70. package/dist/translator/util/assert.d.ts +8 -1
  71. package/dist/translator/util/bindings.d.ts +13 -9
  72. package/dist/translator/util/body-to-text.d.ts +9 -0
  73. package/dist/translator/util/branch-tag.d.ts +10 -3
  74. package/dist/translator/util/build-string-expression.d.ts +4 -0
  75. package/dist/translator/util/content-derives.d.ts +7 -0
  76. package/dist/translator/util/entry-builder.d.ts +16 -5
  77. package/dist/translator/util/finalize-references.d.ts +3 -2
  78. package/dist/translator/util/generate-uid.d.ts +3 -2
  79. package/dist/translator/util/get-root.d.ts +3 -3
  80. package/dist/translator/util/get-tag-name.d.ts +1 -1
  81. package/dist/translator/util/known-tag.d.ts +10 -8
  82. package/dist/translator/util/module-read.d.ts +0 -3
  83. package/dist/translator/util/module-registrations.d.ts +44 -0
  84. package/dist/translator/util/nested-attribute-tags.d.ts +1 -1
  85. package/dist/translator/util/optional.d.ts +6 -1
  86. package/dist/translator/util/params-tree.d.ts +18 -0
  87. package/dist/translator/util/reasons.d.ts +10 -8
  88. package/dist/translator/util/references.d.ts +23 -28
  89. package/dist/translator/util/runtime.d.ts +0 -12
  90. package/dist/translator/util/scope-accessor.d.ts +0 -1
  91. package/dist/translator/util/scope-read.d.ts +3 -0
  92. package/dist/translator/util/section-renderer.d.ts +4 -0
  93. package/dist/translator/util/sections.d.ts +16 -16
  94. package/dist/translator/util/setup-work.d.ts +2 -1
  95. package/dist/translator/util/signals.d.ts +22 -11
  96. package/dist/translator/util/simplify-fn.d.ts +1 -0
  97. package/dist/translator/util/slots.d.ts +2 -2
  98. package/dist/translator/util/solve-reasons.d.ts +1 -3
  99. package/dist/translator/util/sources.d.ts +2 -1
  100. package/dist/translator/util/statement-tag.d.ts +2 -0
  101. package/dist/translator/util/static-text.d.ts +2 -1
  102. package/dist/translator/util/structure.d.ts +0 -10
  103. package/dist/translator/util/tag-facts.d.ts +8 -1
  104. package/dist/translator/util/tag-import.d.ts +20 -0
  105. package/dist/translator/util/tag-name-type.d.ts +9 -2
  106. package/dist/translator/util/to-only-or-block.d.ts +3 -0
  107. package/dist/translator/util/to-property-name.d.ts +2 -0
  108. package/dist/translator/util/translate-attrs.d.ts +7 -5
  109. package/dist/translator/util/translate-var.d.ts +2 -0
  110. package/dist/translator/util/traverse.d.ts +1 -2
  111. package/dist/translator/util/visitors.d.ts +4 -1
  112. package/dist/translator/util/with-previous-location.d.ts +1 -1
  113. package/dist/translator/util/write-guard.d.ts +6 -2
  114. package/dist/translator/util/writer.d.ts +1 -2
  115. package/dist/translator/visitors/export-declaration.d.ts +2 -3
  116. package/dist/translator/visitors/function.d.ts +0 -35
  117. package/dist/translator/visitors/import-declaration.d.ts +0 -16
  118. package/dist/translator/visitors/placeholder.d.ts +2 -1
  119. package/dist/translator/visitors/program/html.d.ts +0 -1
  120. package/dist/translator/visitors/program/index.d.ts +4 -5
  121. package/dist/translator/visitors/tag/custom-tag.d.ts +0 -14
  122. package/dist/translator/visitors/tag/native-tag.d.ts +3 -12
  123. package/package.json +4 -4
  124. package/dist/translator/util/binding-has-prop.d.ts +0 -8
  125. package/dist/translator/util/binding-prop-tree.d.ts +0 -18
  126. package/dist/translator/util/body-to-text-literal.d.ts +0 -9
  127. package/dist/translator/util/import-reference.d.ts +0 -3
  128. package/dist/translator/util/normalize-string-expression.d.ts +0 -4
  129. package/dist/translator/util/plugin-hooks.d.ts +0 -4
  130. package/dist/translator/util/resolve-relative-to-entry.d.ts +0 -2
  131. package/dist/translator/util/set-tag-derived-from.d.ts +0 -7
  132. package/dist/translator/util/to-first-expression-or-block.d.ts +0 -2
  133. package/dist/translator/util/to-first-statement-or-block.d.ts +0 -2
@@ -1,22 +1,22 @@
1
1
  import { _hoist_read_error } from "../common/errors";
2
2
  import { type Opt } from "../common/opt";
3
- import { type $Global, type Accessor, type Falsy, ResumeSymbol } from "../common/types";
3
+ import { type $Global, type Accessor, ResumeSymbol } from "../common/types";
4
4
  import * as FlushStatus from "./constants/flush-status";
5
5
  import * as Mark from "./constants/mark";
6
- import { K_SCOPE_ID, type Locals, Serializer } from "./serializer";
6
+ import { K_SCOPE_ID, type Locals, type SerializeChannel, SerializerState } from "./serializer";
7
7
  import type { ServerRenderer } from "./template";
8
8
  export type PartialScope = Record<Accessor, unknown>;
9
- interface SerializeState {
10
- readyId?: string;
11
- parent?: SerializeState;
9
+ interface Channel extends SerializeChannel {
10
+ parent?: Channel;
12
11
  resumes: string;
13
12
  writeScopes: Record<number, PartialScope>;
14
13
  passiveScopes?: Record<number, PartialScope>;
15
14
  flushScopes: boolean;
16
15
  }
17
- type ScopeInternals = PartialScope & {
16
+ export type ScopeInternals = PartialScope & {
18
17
  [K_SCOPE_ID]?: number;
19
18
  };
19
+ export declare let $chunk: Chunk;
20
20
  export declare function getChunk(): Chunk | undefined;
21
21
  export declare function withChunk<T>(chunk: Chunk, cb: () => T): T;
22
22
  export declare function getContext(key: keyof NonNullable<Chunk["context"]>): unknown;
@@ -33,9 +33,20 @@ export declare function _scope_id(): number;
33
33
  export declare function _peek_scope_id(): number;
34
34
  export declare function withContext<T>(key: PropertyKey, value: unknown, cb: () => T): T;
35
35
  export declare function withContext<T, U>(key: PropertyKey, value: unknown, cb: (value: U) => T, cbValue: U): T;
36
+ export declare function withContext<T, U, V>(key: PropertyKey, value: unknown, cb: (value: U, value2: V) => T, cbValue: U, cbValue2: V): T;
37
+ export declare function captureContext(chunk: Chunk): void;
38
+ export declare const kBranchId: unique symbol;
39
+ export interface AsyncContent {
40
+ visit?: string;
41
+ end?: Chunk;
42
+ parent?: AsyncContent;
43
+ resumed?: true;
44
+ }
36
45
  export declare function isInResumedBranch(): boolean;
37
46
  export declare function withBranchId<T>(branchId: number, cb: () => T): T;
38
47
  export declare function withBranchId<T, U>(branchId: number, cb: (value: U) => T, cbValue: U): T;
48
+ export declare function withBranchId<T, U, V>(branchId: number, cb: (value: U, value2: V) => T, cbValue: U, cbValue2: V): T;
49
+ export declare function withAsyncContent<T, U>(async: AsyncContent, cb: (value: U) => T, value: U): T;
39
50
  export declare function _html(html: string): void;
40
51
  export declare function writeScript(script: string): void;
41
52
  export declare function catchableBoundary(): Boundary | null;
@@ -49,54 +60,46 @@ export declare function _hoist(scopeId: number, id: string): {
49
60
  (): void;
50
61
  [Symbol.iterator]: typeof _hoist_read_error;
51
62
  };
52
- export declare function _el_resume(scopeId: number, accessor: Accessor, shouldResume?: number): string;
53
- export declare function _text_resume(scopeId: number, accessor: Accessor, val: unknown, shouldResume?: number): string;
54
- export declare function _html_resume(scopeId: number, accessor: Accessor, val: unknown, shouldResume?: number): string;
63
+ export declare function _el_resume(scopeId: number, accessor: Accessor, markerGuard?: number): string;
64
+ export declare function _text_resume(scopeId: number, accessor: Accessor, val: unknown, markerGuard?: number): string;
65
+ export declare function _html_resume(scopeId: number, accessor: Accessor, val: unknown, markerGuard?: number): string;
55
66
  export declare function _resume_branch(scopeId: number): void;
56
67
  export declare function _attr_content(nodeAccessor: Accessor, scopeId: number, content: unknown, markerGuard?: number): void;
57
68
  export declare function _var(parentScopeId: number, scopeOffsetAccessor: Accessor, childScopeId: number, registryId: string, nodeAccessor?: Accessor): void;
58
- export declare function _show_start(display: unknown, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0): void;
59
- export declare function _show_end(scopeId: number, accessor: Accessor, display: unknown, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1 | 0): void;
60
- export declare function _for_of(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, branchGuard?: number, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1): void;
61
- export declare function _for_in(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, branchGuard?: number, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1): void;
62
- export declare function _for_to(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, branchGuard?: number, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1): void;
63
- export declare function _for_until(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, branchGuard?: number, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1): void;
64
- export declare function _if(cb: () => void | number, scopeId: number, accessor: Accessor, branchGuard?: number, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1): void;
65
- export declare function deferBranchStart(chunk: Chunk): string;
66
- export declare function applyBranchStart(chunk: Chunk, beforeBranch: string, rendered: boolean): void;
67
69
  declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
68
70
  export { writeScope as _scope };
69
71
  export declare function _existing_scope(scopeId: number): ScopeInternals;
70
72
  export declare function _scope_with_id(scopeId: number): ScopeInternals;
71
73
  export declare function _subscribe(subscribers: Set<ScopeInternals> | undefined, scope: ScopeInternals, resumeId?: string, markerGuard?: number): ScopeInternals;
72
74
  export type GroupMask = undefined | number | Partial<Record<string, number>>;
73
- export declare const CLIENT_ALL = 715827883;
74
- export declare function maskGroup(mask: GroupMask, group: number): number;
75
+ export declare const ALL_GROUPS = 715827883;
76
+ export declare function getGroupReason(reason: GroupMask, group: number): number;
75
77
  export declare function _set_scope_reason(reason: GroupMask): void;
76
78
  export declare function _scope_reason(): GroupMask;
77
- export declare function _write_if(condition: GroupMask, key: number): 1 | undefined;
78
- export declare function _write_guard(condition: GroupMask, key: number): 0 | 1;
79
+ export declare function _write_if(reason: GroupMask, group: number): 1 | undefined;
80
+ export declare function _write_guard(reason: GroupMask, group: number): 0 | 1;
79
81
  export declare function writeWaitReady(readyId: string, renderer: ServerRenderer, input: unknown): void;
80
- export declare function _await<T>(scopeId: number, accessor: Accessor, promise: Promise<T> | T, content: (value: T) => void, markerGuard?: number): void;
81
- export declare function _try(scopeId: number, accessor: Accessor, content: () => void, placeholderContent?: ServerRenderer, catchContent?: ServerRenderer, placeholderId?: string, catchId?: string): void;
82
+ export declare function deferBranchStart(chunk: Chunk): string;
83
+ export declare function applyBranchStart(chunk: Chunk, beforeBranch: string, rendered: boolean): void;
82
84
  declare const NOOP: () => void;
85
+ export declare function getAsyncContent(chunk: Chunk): AsyncContent | undefined;
83
86
  type Mark = Mark.Value;
84
- export declare class State implements SerializeState {
87
+ export declare class State implements Channel {
85
88
  tagId: number;
86
89
  scopeId: number;
87
90
  reorderId: number;
88
91
  readyGate: number;
89
- hasGlobals: boolean;
90
- needsMainRuntime: boolean;
91
- hasMainRuntime: boolean;
92
- hasReadyRuntime: boolean;
92
+ hasWrittenGlobals: boolean;
93
+ needsWalkerRuntime: boolean;
94
+ hasWalkerRuntime: boolean;
95
+ hasWrittenReady: boolean;
93
96
  hasReorderRuntime: boolean;
94
97
  hasWrittenResume: boolean;
95
98
  walkOnNextFlush: boolean;
96
99
  trailerHTML: string;
97
100
  resumes: string;
98
101
  nonceAttr: string;
99
- serializer: Serializer;
102
+ serializer: SerializerState;
100
103
  writeReorders: Chunk[] | null;
101
104
  scopes: Map<number, ScopeInternals>;
102
105
  scope: (scopeId: number) => ScopeInternals;
@@ -112,13 +115,20 @@ export declare class State implements SerializeState {
112
115
  renderId: string;
113
116
  runtimeId: string;
114
117
  });
115
- flushChunk(html: string, scripts: string, pending: number): string;
118
+ joinFlush(html: string, scripts: string, pending: number): string;
116
119
  walkScript(): string;
120
+ addResumes(channel: Channel, resumes: string): void;
121
+ queueScope(target: Channel, scopeId: number, partialScope: PartialScope): void;
122
+ queuePassiveScope(target: Channel, scopeId: number, partialScope: PartialScope): void;
123
+ queueEffect(scopeId: number, registryId: string): void;
124
+ serializeFlush(boundary: Boundary): void;
125
+ runtimeScript(): string;
126
+ keepsTryMarks(chunk: Chunk, resumeWrites: number): boolean;
117
127
  resumeScript(resumes: string): string;
118
128
  get runtimePrefix(): string;
119
129
  get commentPrefix(): string;
120
130
  reorder(chunk: Chunk): void;
121
- writeReady(id: string, resumes: string): string;
131
+ readyScript(id: string, resumes: string): string;
122
132
  readyAccess(readyKey: string): string;
123
133
  nextReorderId(): string;
124
134
  mark(code: ResumeSymbol | Mark, str: string): string;
@@ -170,9 +180,10 @@ export declare class Chunk {
170
180
  boundary: Boundary;
171
181
  next: Chunk | null;
172
182
  context: Record<string | symbol, unknown> | null;
173
- serializeState: SerializeState;
174
- constructor(boundary: Boundary, next: Chunk | null, context: Record<string | symbol, unknown> | null, serializeState: SerializeState);
183
+ channel: Channel;
184
+ constructor(boundary: Boundary, next: Chunk | null, context: Record<string | symbol, unknown> | null, channel: Channel);
175
185
  fork(boundary: Boundary, next: Chunk | null): Chunk;
186
+ forkRest(boundary: Boundary): Chunk;
176
187
  writeHTML(html: string): void;
177
188
  writeEffect(scopeId: number, registryId: string): void;
178
189
  writeScript(script: string): void;
@@ -187,8 +198,9 @@ export declare class Chunk {
187
198
  consume(boundary: Boundary): Chunk;
188
199
  render(content: () => void): Chunk;
189
200
  render<T>(content: (val: T) => void, val: T): Chunk;
201
+ render<T, U>(content: (val: T, val2: U) => void, val: T, val2: U): Chunk;
190
202
  flushReadyScripts(boundary: Boundary, reservations?: string[], holdEffects?: boolean): string;
191
- flushScript(boundary: Boundary): this;
203
+ flush(boundary: Boundary): this;
192
204
  flushHTML(boundary: Boundary): string;
193
205
  }
194
206
  export declare function joinHeldEffects(heldEffects: Opt<Chunk>, effects: string): string;
package/dist/html.d.ts CHANGED
@@ -4,7 +4,8 @@ export { _flush_head, withLoadAssets, withPageAssets } from "./html/assets";
4
4
  export { _attr, _attr_and, _attr_class, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_select_value, _attrs_textarea_value, _style_html, _textarea_value, } from "./html/attrs";
5
5
  export { compat } from "./html/compat";
6
6
  export { _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _to_text, _unescaped, } from "./html/content";
7
+ export { _await, _for_in, _for_of, _for_to, _for_until, _if, _show_end, _show_start, _try, } from "./html/control-flow";
7
8
  export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
8
9
  export { forIn, forOf, forTo, forUntil } from "./html/for";
9
10
  export { _template } from "./html/template";
10
- export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, _scope, _scope_id, _scope_reason, _html_resume, _scope_with_id, _script, _write_guard, _write_if, _set_scope_reason, _show_end, _show_start, _text_resume, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";
11
+ export { _attr_content, _el, _el_resume, _existing_scope, _hoist, _html, _id, _peek_scope_id, _resume, _resume_branch, _resume_locals, _scope, _scope_id, _scope_reason, _html_resume, _scope_with_id, _script, _write_guard, _write_if, _set_scope_reason, _text_resume, _subscribe, _trailers, _var, $global, } from "./html/writer";