marko 6.1.2 → 6.1.4
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 +5 -0
- package/dist/common/accessor.debug.d.ts +5 -0
- package/dist/common/compat-meta.d.ts +0 -1
- package/dist/common/opt.d.ts +3 -1
- package/dist/common/types.d.ts +1 -1
- package/dist/debug/dom.js +315 -122
- package/dist/debug/dom.mjs +306 -123
- package/dist/debug/html.js +922 -712
- package/dist/debug/html.mjs +920 -713
- package/dist/dom/compat.d.ts +3 -2
- package/dist/dom/control-flow.d.ts +2 -1
- package/dist/dom/load.d.ts +23 -0
- package/dist/dom/queue.d.ts +4 -2
- package/dist/dom/resume.d.ts +10 -8
- package/dist/dom/signals.d.ts +4 -3
- package/dist/dom.d.ts +3 -2
- package/dist/dom.js +195 -66
- package/dist/dom.mjs +195 -66
- package/dist/html/assets.d.ts +47 -0
- package/dist/html/compat.d.ts +3 -2
- package/dist/html/inlined-runtimes.d.ts +1 -1
- package/dist/html/inlined-runtimes.debug.d.ts +1 -1
- package/dist/html/serializer.d.ts +14 -9
- package/dist/html/writer.d.ts +34 -15
- package/dist/html.d.ts +1 -0
- package/dist/html.js +502 -345
- package/dist/html.mjs +502 -345
- package/dist/translator/index.d.ts +1 -0
- package/dist/translator/index.js +342 -76
- package/dist/translator/interop/index.d.ts +1 -0
- package/dist/translator/util/marko-config.d.ts +2 -0
- package/dist/translator/util/references.d.ts +1 -5
- package/dist/translator/util/runtime.d.ts +1 -0
- package/dist/translator/util/tag-name-type.d.ts +2 -0
- package/dist/translator/util/walks.d.ts +1 -1
- package/dist/translator/visitors/import-declaration.d.ts +10 -1
- package/dist/translator/visitors/tag/custom-tag.d.ts +7 -0
- package/package.json +2 -2
package/dist/html/writer.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { _hoist_read_error } from "../common/errors";
|
|
2
|
+
import { type Opt } from "../common/opt";
|
|
2
3
|
import { type $Global, type Accessor, type Falsy, ResumeSymbol } from "../common/types";
|
|
3
|
-
import { Serializer } from "./serializer";
|
|
4
|
+
import { K_SCOPE_ID, Serializer } from "./serializer";
|
|
5
|
+
import type { ServerRenderer } from "./template";
|
|
4
6
|
export type PartialScope = Record<Accessor, unknown>;
|
|
7
|
+
interface SerializeState {
|
|
8
|
+
readyId?: string;
|
|
9
|
+
parent?: SerializeState;
|
|
10
|
+
resumes: string;
|
|
11
|
+
writeScopes: Record<number, PartialScope>;
|
|
12
|
+
passiveScopes?: Record<number, PartialScope>;
|
|
13
|
+
flushScopes: boolean;
|
|
14
|
+
}
|
|
5
15
|
type ScopeInternals = PartialScope & {
|
|
6
16
|
[K_SCOPE_ID]?: number;
|
|
7
|
-
[K_SCOPE_REFERENCED]?: 1;
|
|
8
17
|
};
|
|
9
|
-
declare const K_SCOPE_ID: unique symbol;
|
|
10
|
-
declare const K_SCOPE_REFERENCED: unique symbol;
|
|
11
18
|
declare enum Mark {
|
|
12
19
|
Placeholder = "!^",
|
|
13
20
|
PlaceholderEnd = "!",
|
|
@@ -19,6 +26,7 @@ export declare function getState(): State;
|
|
|
19
26
|
export declare function getScopeId(scope: unknown): number | undefined;
|
|
20
27
|
export declare function _html(html: string): void;
|
|
21
28
|
export declare function writeScript(script: string): void;
|
|
29
|
+
export declare function writeWaitReady(readyId: string, renderer: ServerRenderer, input: unknown): void;
|
|
22
30
|
export declare function _script(scopeId: number, registryId: string): void;
|
|
23
31
|
export declare function _attr_content(nodeAccessor: Accessor, scopeId: number, content: unknown, serializeReason?: 1 | 0): void;
|
|
24
32
|
export declare function withContext<T>(key: PropertyKey, value: unknown, cb: () => T): T;
|
|
@@ -28,7 +36,7 @@ export declare function _resume<T extends WeakKey>(val: T, id: string, scopeId?:
|
|
|
28
36
|
export declare function _id(): string;
|
|
29
37
|
export declare function _scope_id(): number;
|
|
30
38
|
export declare function _peek_scope_id(): number;
|
|
31
|
-
export declare function getScopeById(scopeId: number | undefined):
|
|
39
|
+
export declare function getScopeById(scopeId: number | undefined): ScopeInternals | undefined;
|
|
32
40
|
export declare function _set_serialize_reason(reason: undefined | 0 | 1): void;
|
|
33
41
|
export declare function _scope_reason(): 0 | 1 | undefined;
|
|
34
42
|
export declare function _serialize_if(condition: undefined | 1 | Record<string, 1>, key: string): 1 | undefined;
|
|
@@ -49,7 +57,6 @@ export declare function _for_to(to: number, from: number | Falsy, step: number |
|
|
|
49
57
|
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, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
|
50
58
|
export declare function _if(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
|
51
59
|
declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
|
|
52
|
-
export declare function writeScopeToState(state: State, scopeId: number, partialScope: PartialScope): ScopeInternals;
|
|
53
60
|
export { writeScope as _scope };
|
|
54
61
|
export declare function _existing_scope(scopeId: number): ScopeInternals;
|
|
55
62
|
export declare function _scope_with_id(scopeId: number): ScopeInternals;
|
|
@@ -66,7 +73,7 @@ export declare function _try(scopeId: number, accessor: Accessor, content: () =>
|
|
|
66
73
|
content?(err: unknown): void;
|
|
67
74
|
};
|
|
68
75
|
}): void;
|
|
69
|
-
export declare class State {
|
|
76
|
+
export declare class State implements SerializeState {
|
|
70
77
|
$global: $Global & {
|
|
71
78
|
renderId: string;
|
|
72
79
|
runtimeId: string;
|
|
@@ -74,10 +81,11 @@ export declare class State {
|
|
|
74
81
|
tagId: number;
|
|
75
82
|
scopeId: number;
|
|
76
83
|
reorderId: number;
|
|
77
|
-
|
|
84
|
+
readyGate: number;
|
|
78
85
|
hasGlobals: boolean;
|
|
79
86
|
needsMainRuntime: boolean;
|
|
80
87
|
hasMainRuntime: boolean;
|
|
88
|
+
hasReadyRuntime: boolean;
|
|
81
89
|
hasReorderRuntime: boolean;
|
|
82
90
|
hasWrittenResume: boolean;
|
|
83
91
|
walkOnNextFlush: boolean;
|
|
@@ -86,9 +94,10 @@ export declare class State {
|
|
|
86
94
|
nonceAttr: string;
|
|
87
95
|
serializer: Serializer;
|
|
88
96
|
writeReorders: Chunk[] | null;
|
|
89
|
-
scopes: Map<number,
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
scopes: Map<number, ScopeInternals>;
|
|
98
|
+
flushScopes: boolean;
|
|
99
|
+
writeScopes: Record<number, PartialScope>;
|
|
100
|
+
readyIds: Set<string> | null;
|
|
92
101
|
serializeReason: undefined | 0 | 1;
|
|
93
102
|
constructor($global: $Global & {
|
|
94
103
|
renderId: string;
|
|
@@ -97,6 +106,8 @@ export declare class State {
|
|
|
97
106
|
get runtimePrefix(): string;
|
|
98
107
|
get commentPrefix(): string;
|
|
99
108
|
reorder(chunk: Chunk): void;
|
|
109
|
+
writeReady(id: string, resumes: string): string;
|
|
110
|
+
readyAccess(readyKey: string): string;
|
|
100
111
|
nextReorderId(): string;
|
|
101
112
|
mark(code: ResumeSymbol | Mark, str: string): string;
|
|
102
113
|
}
|
|
@@ -118,6 +129,7 @@ export declare class Chunk {
|
|
|
118
129
|
boundary: Boundary;
|
|
119
130
|
next: Chunk | null;
|
|
120
131
|
context: Record<string | symbol, unknown> | null;
|
|
132
|
+
serializeState: SerializeState;
|
|
121
133
|
html: string;
|
|
122
134
|
scripts: string;
|
|
123
135
|
effects: string;
|
|
@@ -126,18 +138,25 @@ export declare class Chunk {
|
|
|
126
138
|
consumed: boolean;
|
|
127
139
|
needsWalk: boolean;
|
|
128
140
|
reorderId: string | null;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
141
|
+
deferredReady: Opt<Chunk>;
|
|
142
|
+
placeholder: {
|
|
143
|
+
body: Chunk;
|
|
144
|
+
render: () => void;
|
|
145
|
+
branchId: number;
|
|
146
|
+
} | null;
|
|
147
|
+
constructor(boundary: Boundary, next: Chunk | null, context: Record<string | symbol, unknown> | null, serializeState: SerializeState);
|
|
148
|
+
fork(boundary: Boundary, next: Chunk | null): Chunk;
|
|
133
149
|
writeHTML(html: string): void;
|
|
134
150
|
writeEffect(scopeId: number, registryId: string): void;
|
|
135
151
|
writeScript(script: string): void;
|
|
136
152
|
append(chunk: Chunk): void;
|
|
153
|
+
takeDeferredReady(): Opt<Chunk>;
|
|
154
|
+
deferOwnReady(): void;
|
|
137
155
|
flushPlaceholder(): void;
|
|
138
156
|
consume(): Chunk;
|
|
139
157
|
render(content: () => void): Chunk;
|
|
140
158
|
render<T>(content: (val: T) => void, val: T): Chunk;
|
|
159
|
+
flushReadyScripts(reservations?: string[]): string;
|
|
141
160
|
flushScript(): this;
|
|
142
161
|
flushHTML(): string;
|
|
143
162
|
}
|
package/dist/html.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { attrTag, attrTags } from "./common/attr-tag";
|
|
2
2
|
export { _assert_hoist, _el_read_error, _hoist_read_error, } from "./common/errors";
|
|
3
|
+
export { _flush_head, withLoadAssets, withPageAssets } from "./html/assets";
|
|
3
4
|
export { _attr, _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_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, } from "./html/attrs";
|
|
4
5
|
export { compat } from "./html/compat";
|
|
5
6
|
export { _escape, _escape_comment, _escape_script, _escape_style, _unescaped, } from "./html/content";
|