@markless/serializer 0.4.0 → 0.6.0

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.
@@ -1,363 +0,0 @@
1
- //#region src/async-boundary-arm.d.ts
2
- declare const ASYNC_BOUNDARY_ARM: {
3
- readonly try: 0;
4
- readonly pending: 1;
5
- readonly catch: 2;
6
- };
7
- //#endregion
8
- //#region src/protocol-constants.d.ts
9
- declare const ASYNC_PROTOCOL_VERSION = 1;
10
- declare const STORAGE_PROTOCOL_VERSION = 2;
11
- declare function protocolStateVersion(storage: readonly unknown[] | undefined): typeof ASYNC_PROTOCOL_VERSION | typeof STORAGE_PROTOCOL_VERSION;
12
- declare const PROTOCOL_EVENT_ACTION_KIND: {
13
- readonly event: "event";
14
- readonly externalDelegate: "external-delegate";
15
- };
16
- declare function protocolInstanceSegment(edgeIndex: number): string;
17
- declare function protocolProjectionSegment(edgeIndex: number): string;
18
- /** One keyed `@for` row's identity segment. The key is identity, never the index. */
19
- declare function protocolRowSegment(key: unknown): string;
20
- /** The leading instance path of a composed id, or '' when the id is page-local. */
21
- declare function protocolInstancePath(id: string): string;
22
- declare const PROTOCOL_PROPS_GRAPH_NODE_ID = "prop:props";
23
- declare const PROTOCOL_PROP_GRAPH_NODE_PREFIX = "prop:";
24
- declare const PROTOCOL_PAGE_SPACE_ID_PREFIXES: string[];
25
- declare function protocolInstanceQualifies(graphNodeId: string): boolean | undefined;
26
- //#endregion
27
- //#region src/protocol.d.ts
28
- type ProtocolAsyncBoundaryArm = (typeof ASYNC_BOUNDARY_ARM)[keyof typeof ASYNC_BOUNDARY_ARM];
29
- type ProtocolSyncPolicyCondition = {
30
- readonly type: 'and';
31
- readonly conditions: ReadonlyArray<ProtocolSyncPolicyCondition>;
32
- } | {
33
- readonly type: 'or';
34
- readonly conditions: ReadonlyArray<ProtocolSyncPolicyCondition>;
35
- } | {
36
- readonly type: 'not';
37
- readonly condition: ProtocolSyncPolicyCondition;
38
- } | {
39
- readonly type: 'graph-truthy';
40
- readonly graphNodeId: string;
41
- readonly path?: ReadonlyArray<string>;
42
- } | {
43
- readonly type: 'constant-truthy';
44
- readonly value: unknown;
45
- } | {
46
- readonly type: 'event-equals';
47
- readonly field: string;
48
- readonly value: unknown;
49
- };
50
- type ProtocolSyncPolicyBranch = {
51
- readonly when: ProtocolSyncPolicyCondition;
52
- readonly actions: ReadonlyArray<'preventDefault' | 'stopPropagation'>;
53
- };
54
- type ProtocolSyncPolicy = ProtocolSyncPolicyBranch | {
55
- readonly branches: ReadonlyArray<ProtocolSyncPolicyBranch>;
56
- };
57
- type ProtocolEventActionKind = (typeof PROTOCOL_EVENT_ACTION_KIND)[keyof typeof PROTOCOL_EVENT_ACTION_KIND];
58
- type ProtocolEventAction = {
59
- readonly kind: typeof PROTOCOL_EVENT_ACTION_KIND.externalDelegate;
60
- readonly owner: string;
61
- };
62
- type ProtocolEventRecord = {
63
- readonly hostNodeId: string;
64
- readonly eventName: string;
65
- readonly syncPolicy?: ProtocolSyncPolicy;
66
- readonly symbolIds: ReadonlyArray<string>;
67
- readonly action?: ProtocolEventAction;
68
- };
69
- declare function protocolEventActionKind(record: Pick<ProtocolEventRecord, 'action'>): ProtocolEventActionKind;
70
- declare function protocolEventDispatchesMarkless(record: Pick<ProtocolEventRecord, 'action'>): boolean;
71
- type ProtocolStatePayload = {
72
- readonly version: typeof ASYNC_PROTOCOL_VERSION | typeof STORAGE_PROTOCOL_VERSION;
73
- readonly cells: ReadonlyArray<{
74
- readonly graphNodeId: string;
75
- readonly name: string;
76
- readonly valueKind: 'scalar' | 'object' | 'array' | 'unknown';
77
- readonly value?: unknown;
78
- readonly directValue?: unknown;
79
- }>;
80
- readonly computed: ReadonlyArray<{
81
- readonly graphNodeId: string;
82
- readonly name: string;
83
- readonly async: boolean;
84
- readonly deriveSymbolId?: string;
85
- readonly dependencies?: ReadonlyArray<{
86
- readonly graphNodeId: string;
87
- readonly path: ReadonlyArray<string>;
88
- }>;
89
- readonly snapshot?: {
90
- readonly status: 'idle';
91
- readonly version: 0;
92
- } | {
93
- readonly status: 'pending';
94
- readonly version: number;
95
- readonly key: unknown;
96
- } | {
97
- readonly status: 'fulfilled';
98
- readonly version: number;
99
- readonly key: unknown;
100
- readonly value: unknown;
101
- } | {
102
- readonly status: 'rejected';
103
- readonly version: number;
104
- readonly key: unknown;
105
- readonly error: unknown;
106
- };
107
- }>;
108
- readonly sharedSeeds?: ReadonlyArray<{
109
- readonly graphNodeId: string;
110
- readonly deriveSymbolId: string;
111
- readonly dependencies: ReadonlyArray<{
112
- readonly graphNodeId: string;
113
- readonly path: ReadonlyArray<string>;
114
- readonly reads: {
115
- readonly graphNodeId: string;
116
- readonly path: ReadonlyArray<string>;
117
- };
118
- }>;
119
- }>;
120
- readonly sharedDefinitions?: ReadonlyArray<{
121
- readonly id: string;
122
- readonly name: string;
123
- readonly exportedName: string;
124
- readonly scope?: 'request' | 'container' | 'page' | 'widget';
125
- readonly version: number;
126
- readonly graphNodeIds: ReadonlyArray<string>;
127
- readonly projectionIds?: ReadonlyArray<string>;
128
- readonly dependencies?: ReadonlyArray<{
129
- readonly definitionId: string;
130
- readonly definitionName: string;
131
- }>;
132
- readonly returnProperties?: ReadonlyArray<{
133
- readonly kind: 'graph';
134
- readonly name: string;
135
- readonly graphNodeId: string;
136
- readonly path: ReadonlyArray<string>;
137
- } | {
138
- readonly kind: 'method';
139
- readonly name: string;
140
- }>;
141
- }>;
142
- readonly storage?: ReadonlyArray<{
143
- readonly graphNodeId: string;
144
- readonly key: string;
145
- }>;
146
- };
147
- type ProtocolArmBranchRecord = {
148
- readonly id: string;
149
- readonly testReads: ReadonlyArray<{
150
- readonly source: string;
151
- readonly graphNodeId: string;
152
- readonly path: ReadonlyArray<string>;
153
- }>;
154
- readonly symbolId?: string;
155
- readonly armTests?: ReadonlyArray<unknown>;
156
- readonly declaredEmptyArms?: ReadonlyArray<number>;
157
- readonly startAnchor?: {
158
- readonly strategy: 'arm-branch-comment';
159
- readonly index: number;
160
- };
161
- readonly endAnchor?: {
162
- readonly strategy: 'arm-branch-comment';
163
- readonly index: number;
164
- };
165
- readonly armRecords?: NonNullable<ProtocolViewPayload['branches']>[number]['armRecords'];
166
- };
167
- type ProtocolArmRecordSet = {
168
- readonly locators: ReadonlyArray<{
169
- readonly hostNodeId: string;
170
- readonly strategy: 'arm-relative';
171
- readonly index: number;
172
- readonly tagName: string;
173
- }>;
174
- readonly events: ProtocolViewPayload['events'];
175
- readonly domUpdates?: ProtocolViewPayload['domUpdates'];
176
- readonly behaviors: ProtocolViewPayload['behaviors'];
177
- readonly elementHandles: ProtocolViewPayload['elementHandles'];
178
- readonly keyedRepeats?: ProtocolViewPayload['keyedRepeats'];
179
- readonly branches?: ReadonlyArray<ProtocolArmBranchRecord>;
180
- };
181
- type ProtocolStreamedArmPatch = readonly [arm: ProtocolAsyncBoundaryArm, records: ProtocolArmRecordSet];
182
- type ProtocolViewPayload = {
183
- readonly version: typeof ASYNC_PROTOCOL_VERSION;
184
- readonly asyncRunners?: Readonly<Record<string, string>>;
185
- readonly locators: ReadonlyArray<{
186
- readonly hostNodeId: string;
187
- readonly strategy: 'dom-order';
188
- readonly index: number;
189
- readonly tagName: string;
190
- }>;
191
- readonly events: ReadonlyArray<ProtocolEventRecord>;
192
- readonly domUpdates: ReadonlyArray<{
193
- readonly hostNodeId: string;
194
- readonly source: string;
195
- readonly graphNodeId: string;
196
- readonly path: ReadonlyArray<string>;
197
- readonly target?: {
198
- readonly kind: 'text';
199
- readonly prefix?: string;
200
- readonly suffix?: string;
201
- readonly trueValue?: string;
202
- readonly falseValue?: string;
203
- } | {
204
- readonly kind: 'attribute';
205
- readonly name: string;
206
- } | {
207
- readonly kind: 'property';
208
- readonly name: string;
209
- } | {
210
- readonly kind: 'class';
211
- readonly trueValue?: string;
212
- readonly falseValue?: string;
213
- } | {
214
- readonly kind: 'style';
215
- };
216
- readonly symbolId?: string;
217
- }>;
218
- readonly behaviors: ReadonlyArray<{
219
- readonly hostNodeId: string;
220
- readonly source: string;
221
- readonly functionSource: string;
222
- readonly inputSources: ReadonlyArray<string>;
223
- readonly inputValues?: ReadonlyArray<unknown>;
224
- readonly inputGraphReads?: ReadonlyArray<{
225
- readonly inputIndex: number;
226
- readonly source: string;
227
- readonly graphNodeId: string;
228
- readonly path: ReadonlyArray<string>;
229
- }>;
230
- readonly symbolId?: string;
231
- }>;
232
- readonly elementHandles: ReadonlyArray<{
233
- readonly hostNodeId: string;
234
- readonly handleId: string;
235
- readonly name: string; /** Declared `element<T[]>()`: this handle names an ordered set, and a read answers an array. */
236
- readonly plural?: boolean;
237
- }>;
238
- readonly keyedRepeats?: ReadonlyArray<{
239
- readonly id: string;
240
- readonly parentHostNodeId: string;
241
- readonly collectionGraphNodeId?: string;
242
- readonly collectionPath: ReadonlyArray<string>;
243
- readonly keyPath: ReadonlyArray<string>;
244
- readonly itemName: string;
245
- readonly rowElementCount: number;
246
- /**
247
- * Element children of the parent that stand before the rows. Rows occupy
248
- * `[rowStartOffset, rowStartOffset + items.length)` among the parent's child
249
- * elements; a repeat whose rows begin at 0 omits the field. A repeat whose
250
- * prefix has no compile-time element count ships no record at all.
251
- */
252
- readonly rowStartOffset?: number;
253
- /**
254
- * The `@empty` arm's finished markup, for the mint that raises it when the
255
- * collection empties after resume and takes it back out when a row returns.
256
- * Carried only for a repeat that HAS an `@empty` arm whose markup is fully
257
- * static and whose elements no record names: everything else would need
258
- * wiring the mint cannot do, so it ships nothing and the served behaviour
259
- * stands. A repeat with no `@empty` arm omits the field entirely.
260
- */
261
- readonly emptyArm?: {
262
- readonly html: string;
263
- };
264
- /**
265
- * One row's compiled markup, for the mint that builds a row the server never
266
- * rendered - an item appended to the collection after resume.
267
- *
268
- * `html` is the row chunk's statics joined, slot markers KEPT: the marker
269
- * comments are where the row's own text lives, so the mint finds each text
270
- * position by walking to it rather than by re-parsing. `textSlots` names
271
- * those positions - `path` is FRAGMENT-relative (`[0]` is the row root),
272
- * `itemPath` is the property path to read off the item - and is omitted
273
- * when the row has none, which is the fully static row.
274
- *
275
- * Carried only for a row the client can finish alone: static markup, or
276
- * markup whose every slot is text read off the repeated item. A row holding
277
- * anything else - a value from outside the row, an attribute, a nested
278
- * construct, a component - needs wiring the mint cannot do, so it ships
279
- * nothing and the served behaviour stands.
280
- *
281
- * Pay-per-use: a repeat whose row is not mintable emits no field at all, so
282
- * its record is byte-identical to what it was before this existed.
283
- */
284
- readonly rowTemplate?: {
285
- readonly html: string;
286
- readonly textSlots?: ReadonlyArray<{
287
- readonly path: ReadonlyArray<number>;
288
- readonly itemPath: ReadonlyArray<string>;
289
- }>;
290
- };
291
- readonly rowElementHandles?: ReadonlyArray<{
292
- readonly hostPath: ReadonlyArray<number>;
293
- readonly handleId: string;
294
- readonly name: string;
295
- readonly plural?: boolean;
296
- }>;
297
- readonly rowEvents: ReadonlyArray<{
298
- readonly hostPath: ReadonlyArray<number>;
299
- readonly eventName: string;
300
- readonly symbolIds: ReadonlyArray<string>;
301
- readonly syncPolicy?: ProtocolSyncPolicy;
302
- }>;
303
- }>;
304
- readonly branches?: ReadonlyArray<{
305
- readonly id: string;
306
- readonly startAnchor: {
307
- readonly strategy: 'dom-order-comment';
308
- readonly index: number;
309
- };
310
- readonly endAnchor: {
311
- readonly strategy: 'dom-order-comment';
312
- readonly index: number;
313
- };
314
- readonly symbolId?: string;
315
- readonly armTests?: ReadonlyArray<unknown>;
316
- readonly armRecords?: ReadonlyArray<{
317
- readonly events: ReadonlyArray<{
318
- readonly hostPath: ReadonlyArray<number>;
319
- readonly eventName: string;
320
- readonly symbolIds: ReadonlyArray<string>;
321
- readonly syncPolicy?: ProtocolSyncPolicy;
322
- readonly action?: ProtocolEventAction;
323
- }>;
324
- readonly domUpdates: ReadonlyArray<Record<string, unknown>>;
325
- readonly behaviors: ReadonlyArray<Record<string, unknown>>;
326
- readonly elementHandles: ReadonlyArray<Record<string, unknown>>;
327
- }>;
328
- readonly testReads?: ReadonlyArray<{
329
- readonly source: string;
330
- readonly graphNodeId: string;
331
- readonly path: ReadonlyArray<string>;
332
- }>;
333
- }>;
334
- readonly asyncBoundaries: ReadonlyArray<{
335
- readonly id: string;
336
- readonly runnerGraphNodeId: string | null;
337
- readonly initiallyServedArm: ProtocolAsyncBoundaryArm;
338
- readonly updateSymbolId?: string;
339
- readonly armRecords?: ProtocolArmRecordSet | ReadonlyArray<ProtocolArmRecordSet>;
340
- readonly startAnchor: {
341
- readonly strategy: 'dom-order-comment';
342
- readonly index: number;
343
- };
344
- readonly endAnchor: {
345
- readonly strategy: 'dom-order-comment';
346
- readonly index: number;
347
- };
348
- readonly asyncReads: ReadonlyArray<{
349
- readonly source: string;
350
- readonly graphNodeId: string;
351
- readonly path: ReadonlyArray<string>;
352
- readonly runnerSymbolId?: string;
353
- }>;
354
- }>;
355
- };
356
- type ProtocolPayloadScripts = {
357
- readonly state: ProtocolStatePayload;
358
- readonly view: ProtocolViewPayload;
359
- readonly stateScript: string;
360
- readonly viewScript: string;
361
- };
362
- //#endregion
363
- export { protocolInstanceQualifies as C, protocolStateVersion as D, protocolRowSegment as E, ASYNC_BOUNDARY_ARM as O, protocolInstancePath as S, protocolProjectionSegment as T, PROTOCOL_EVENT_ACTION_KIND as _, ProtocolEventActionKind as a, PROTOCOL_PROP_GRAPH_NODE_PREFIX as b, ProtocolStatePayload as c, ProtocolSyncPolicyBranch as d, ProtocolSyncPolicyCondition as f, ASYNC_PROTOCOL_VERSION as g, protocolEventDispatchesMarkless as h, ProtocolEventAction as i, ProtocolStreamedArmPatch as l, protocolEventActionKind as m, ProtocolArmRecordSet as n, ProtocolEventRecord as o, ProtocolViewPayload as p, ProtocolAsyncBoundaryArm as r, ProtocolPayloadScripts as s, ProtocolArmBranchRecord as t, ProtocolSyncPolicy as u, PROTOCOL_PAGE_SPACE_ID_PREFIXES as v, protocolInstanceSegment as w, STORAGE_PROTOCOL_VERSION as x, PROTOCOL_PROPS_GRAPH_NODE_ID as y };