@markless/serializer 0.3.3 → 0.5.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.
@@ -0,0 +1,647 @@
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-event-names.d.ts
9
+ declare const PROTOCOL_VISIBLE_EVENT_NAME = "visible";
10
+ declare const PROTOCOL_IDLE_EVENT_NAME = "idle";
11
+ //#endregion
12
+ //#region src/protocol-locator-paths.d.ts
13
+ /**
14
+ * The container attribute that lets resume find each located element by its
15
+ * position under its parent, so a node a third-party script adds or swaps
16
+ * elsewhere cannot shift it. Format: protocol-locator-paths-format.ts.
17
+ */
18
+ declare const PROTOCOL_LOCATOR_PATHS_ATTRIBUTE = "data-markless-paths";
19
+ //#endregion
20
+ //#region src/protocol-sync-policy-host.d.ts
21
+ /**
22
+ * The attribute the server writes on each element whose event record carries a
23
+ * sync policy (preventDefault, stopPropagation), valued with that record's
24
+ * hostNodeId. The inline boot finds the policy from the event's own target up
25
+ * to the nearest marked element, so it never needs the element's position.
26
+ */
27
+ declare const PROTOCOL_SYNC_POLICY_HOST_ATTRIBUTE = "data-markless-sync";
28
+ //#endregion
29
+ //#region src/protocol-constants.d.ts
30
+ declare const ASYNC_PROTOCOL_VERSION = 1;
31
+ declare const STORAGE_PROTOCOL_VERSION = 2;
32
+ declare function protocolStateVersion(storage: readonly unknown[] | undefined): typeof ASYNC_PROTOCOL_VERSION | typeof STORAGE_PROTOCOL_VERSION;
33
+ declare const PROTOCOL_EVENT_ACTION_KIND: {
34
+ readonly event: "event";
35
+ readonly externalDelegate: "external-delegate";
36
+ };
37
+ declare function protocolInstanceSegment(edgeIndex: number): string;
38
+ declare function protocolProjectionSegment(edgeIndex: number): string;
39
+ /** One keyed `@for` row's identity segment. The key is identity, never the index. */
40
+ declare function protocolRowSegment(key: unknown): string;
41
+ /** The leading instance path of a composed id, or '' when the id is page-local. */
42
+ declare function protocolInstancePath(id: string): string;
43
+ declare const PROTOCOL_PROPS_GRAPH_NODE_ID = "prop:props";
44
+ declare const PROTOCOL_PROP_GRAPH_NODE_PREFIX = "prop:";
45
+ declare const PROTOCOL_PAGE_SPACE_ID_PREFIXES: string[];
46
+ declare function protocolInstanceQualifies(graphNodeId: string): boolean | undefined;
47
+ //#endregion
48
+ //#region src/protocol.d.ts
49
+ type ProtocolAsyncBoundaryArm = (typeof ASYNC_BOUNDARY_ARM)[keyof typeof ASYNC_BOUNDARY_ARM];
50
+ type ProtocolSyncPolicyCondition = {
51
+ readonly type: 'and';
52
+ readonly conditions: ReadonlyArray<ProtocolSyncPolicyCondition>;
53
+ } | {
54
+ readonly type: 'or';
55
+ readonly conditions: ReadonlyArray<ProtocolSyncPolicyCondition>;
56
+ } | {
57
+ readonly type: 'not';
58
+ readonly condition: ProtocolSyncPolicyCondition;
59
+ } | {
60
+ readonly type: 'graph-truthy';
61
+ readonly graphNodeId: string;
62
+ readonly path?: ReadonlyArray<string>;
63
+ } | {
64
+ readonly type: 'constant-truthy';
65
+ readonly value: unknown;
66
+ } | {
67
+ readonly type: 'event-equals';
68
+ readonly field: string;
69
+ readonly value: unknown;
70
+ };
71
+ type ProtocolSyncPolicyBranch = {
72
+ readonly when: ProtocolSyncPolicyCondition;
73
+ readonly actions: ReadonlyArray<'preventDefault' | 'stopPropagation'>;
74
+ };
75
+ type ProtocolSyncPolicy = ProtocolSyncPolicyBranch | {
76
+ readonly branches: ReadonlyArray<ProtocolSyncPolicyBranch>;
77
+ };
78
+ type ProtocolEventActionKind = (typeof PROTOCOL_EVENT_ACTION_KIND)[keyof typeof PROTOCOL_EVENT_ACTION_KIND];
79
+ type ProtocolEventAction = {
80
+ readonly kind: typeof PROTOCOL_EVENT_ACTION_KIND.externalDelegate;
81
+ readonly owner: string;
82
+ };
83
+ type ProtocolEventRecord = {
84
+ readonly hostNodeId: string;
85
+ readonly eventName: string;
86
+ readonly syncPolicy?: ProtocolSyncPolicy;
87
+ readonly symbolIds: ReadonlyArray<string>;
88
+ readonly action?: ProtocolEventAction;
89
+ };
90
+ declare function protocolEventActionKind(record: Pick<ProtocolEventRecord, 'action'>): ProtocolEventActionKind;
91
+ declare function protocolEventDispatchesMarkless(record: Pick<ProtocolEventRecord, 'action'>): boolean;
92
+ type ProtocolStatePayload = {
93
+ readonly version: typeof ASYNC_PROTOCOL_VERSION | typeof STORAGE_PROTOCOL_VERSION;
94
+ readonly cells: ReadonlyArray<{
95
+ readonly graphNodeId: string;
96
+ readonly name: string;
97
+ readonly valueKind: 'scalar' | 'object' | 'array' | 'unknown';
98
+ readonly value?: unknown;
99
+ readonly directValue?: unknown;
100
+ }>;
101
+ readonly computed: ReadonlyArray<{
102
+ readonly graphNodeId: string;
103
+ readonly name: string;
104
+ readonly async: boolean;
105
+ readonly deriveSymbolId?: string;
106
+ readonly value?: unknown;
107
+ readonly directValue?: unknown;
108
+ readonly dependencies?: ReadonlyArray<{
109
+ readonly graphNodeId: string;
110
+ readonly path: ReadonlyArray<string>;
111
+ }>;
112
+ readonly snapshot?: {
113
+ readonly status: 'idle';
114
+ readonly version: 0;
115
+ } | {
116
+ readonly status: 'pending';
117
+ readonly version: number;
118
+ readonly key: unknown;
119
+ } | {
120
+ readonly status: 'fulfilled';
121
+ readonly version: number;
122
+ readonly key: unknown;
123
+ readonly value: unknown;
124
+ } | {
125
+ readonly status: 'rejected';
126
+ readonly version: number;
127
+ readonly key: unknown;
128
+ readonly error: unknown;
129
+ };
130
+ }>;
131
+ readonly sharedSeeds?: ReadonlyArray<{
132
+ readonly graphNodeId: string;
133
+ readonly deriveSymbolId: string;
134
+ readonly dependencies: ReadonlyArray<{
135
+ readonly graphNodeId: string;
136
+ readonly path: ReadonlyArray<string>;
137
+ readonly reads: {
138
+ readonly graphNodeId: string;
139
+ readonly path: ReadonlyArray<string>;
140
+ };
141
+ }>;
142
+ }>;
143
+ readonly sharedDefinitions?: ReadonlyArray<{
144
+ readonly id: string;
145
+ readonly name: string;
146
+ readonly exportedName: string;
147
+ readonly scope?: 'request' | 'container' | 'page' | 'widget';
148
+ readonly version: number;
149
+ readonly graphNodeIds: ReadonlyArray<string>;
150
+ readonly projectionIds?: ReadonlyArray<string>;
151
+ readonly dependencies?: ReadonlyArray<{
152
+ readonly definitionId: string;
153
+ readonly definitionName: string;
154
+ }>;
155
+ readonly returnProperties?: ReadonlyArray<{
156
+ readonly kind: 'graph';
157
+ readonly name: string;
158
+ readonly graphNodeId: string;
159
+ readonly path: ReadonlyArray<string>;
160
+ } | {
161
+ readonly kind: 'method';
162
+ readonly name: string;
163
+ }>;
164
+ }>;
165
+ readonly storage?: ReadonlyArray<{
166
+ readonly graphNodeId: string;
167
+ readonly key: string;
168
+ }>;
169
+ };
170
+ type ProtocolBranchContentRead = {
171
+ readonly graphNodeId: string;
172
+ readonly path: ReadonlyArray<string>;
173
+ readonly source: string;
174
+ };
175
+ /**
176
+ * One prop a composed part's own arm-update symbol can read: the name the part
177
+ * spells and the graph node the caller passed it. Only props with a live route
178
+ * are listed; a name missing from the table was passed statically, so the value
179
+ * the part mounted with is already its final one.
180
+ */
181
+ type ProtocolComposedGraphProp = {
182
+ readonly name: string;
183
+ readonly graphNodeId: string;
184
+ readonly path?: ReadonlyArray<string>;
185
+ };
186
+ /**
187
+ * The graph read id an arm-update symbol asks under for a minted element() id.
188
+ *
189
+ * A minted id is `idPrefix + handle` where the prefix is the rendered widget's
190
+ * instance token, a seed-map value no flip can reach. The render that served the
191
+ * arm resolves the id and files it on the branch record under this key; the
192
+ * symbol asks for it through the read channel it already has, so the mint keeps
193
+ * exactly one spelling. Resume matches the key as a SUFFIX of the id it is
194
+ * handed, because a composed symbol's reads arrive with the instance path
195
+ * prepended — that is why the key carries the namespace and not the bare handle.
196
+ */
197
+ declare function protocolElementHandleReadId(handleGraphNodeId: string): string;
198
+ /**
199
+ * One IDREF position naming a handle some branch arm binds. `armIndex` is the
200
+ * arm that binds it: the attribute is earned exactly while that arm is the
201
+ * painted one, which is the only test that also answers for an arm the render
202
+ * already served and no flip ever re-materializes. `handleReadId` is the same
203
+ * key the branch record's `elementHandleIds` uses.
204
+ */
205
+ type ProtocolBranchIdrefSite = {
206
+ readonly hostNodeId: string;
207
+ readonly attributeName: string;
208
+ readonly handleReadId: string;
209
+ readonly armIndex: number;
210
+ };
211
+ type ProtocolArmBranchRecord = {
212
+ readonly id: string;
213
+ readonly testReads: ReadonlyArray<{
214
+ readonly source: string;
215
+ readonly graphNodeId: string;
216
+ readonly path: ReadonlyArray<string>;
217
+ }>;
218
+ readonly contentReads?: ReadonlyArray<ProtocolBranchContentRead>;
219
+ readonly symbolId?: string;
220
+ readonly armTests?: ReadonlyArray<unknown>;
221
+ readonly declaredEmptyArms?: ReadonlyArray<number>;
222
+ readonly startAnchor?: {
223
+ readonly strategy: 'arm-branch-comment' | 'dom-order-comment';
224
+ readonly index: number;
225
+ };
226
+ readonly endAnchor?: {
227
+ readonly strategy: 'arm-branch-comment' | 'dom-order-comment';
228
+ readonly index: number;
229
+ };
230
+ readonly armRecords?: NonNullable<ProtocolViewPayload['branches']>[number]['armRecords'];
231
+ readonly composedInstancePath?: string;
232
+ readonly composedGraphProps?: ReadonlyArray<ProtocolComposedGraphProp>;
233
+ };
234
+ type ProtocolArmRecordSet = {
235
+ readonly locators: ReadonlyArray<{
236
+ readonly hostNodeId: string;
237
+ readonly index: number;
238
+ readonly tagName: string;
239
+ }>;
240
+ readonly events: ProtocolViewPayload['events'];
241
+ readonly domUpdates?: ProtocolViewPayload['domUpdates'];
242
+ readonly behaviors: ProtocolViewPayload['behaviors'];
243
+ readonly elementHandles: ProtocolViewPayload['elementHandles'];
244
+ readonly keyedRepeats?: ProtocolViewPayload['keyedRepeats'];
245
+ readonly branches?: ReadonlyArray<ProtocolArmBranchRecord>;
246
+ };
247
+ type ProtocolStreamedArmPatch = readonly [arm: ProtocolAsyncBoundaryArm, records: ProtocolArmRecordSet];
248
+ /**
249
+ * Where one row-template slot's value comes from: the repeated item, a graph
250
+ * node the page already holds, or an authored expression.
251
+ *
252
+ * Exactly one of the three. `itemPath` is a property path off the item the mint
253
+ * was handed. The `graphNodeId`/`graphPath` pair is a read of the page's own
254
+ * state - a row spelling `name={list.name}`. `source` is an authored expression
255
+ * - `\`Edit ${row.name}\``, `format(row.at)` - that the owning component's
256
+ * render-data reader answers for the row, under the same key the server render
257
+ * used; `reads` names the graph nodes outside the row it reads, omitted when none.
258
+ *
259
+ * A row rebuilds when any slot value moves: its item changed under its key, or a
260
+ * graph node a slot reads was written.
261
+ */
262
+ type ProtocolRowTemplateSlotValue = {
263
+ readonly itemPath: ReadonlyArray<string>;
264
+ } | {
265
+ readonly graphNodeId: string;
266
+ readonly graphPath: ReadonlyArray<string>;
267
+ } | {
268
+ readonly source: string;
269
+ readonly reads?: ReadonlyArray<{
270
+ readonly graphNodeId: string;
271
+ readonly path: ReadonlyArray<string>;
272
+ }>;
273
+ };
274
+ type ProtocolViewPayload = {
275
+ readonly version: typeof ASYNC_PROTOCOL_VERSION;
276
+ readonly asyncRunners?: Readonly<Record<string, string>>;
277
+ readonly locators: ReadonlyArray<{
278
+ readonly hostNodeId: string;
279
+ readonly strategy: 'dom-order';
280
+ readonly index: number;
281
+ readonly tagName: string;
282
+ }>;
283
+ readonly events: ReadonlyArray<ProtocolEventRecord>;
284
+ readonly domUpdates: ReadonlyArray<{
285
+ readonly hostNodeId: string;
286
+ readonly source: string;
287
+ readonly graphNodeId: string;
288
+ readonly path: ReadonlyArray<string>;
289
+ readonly target?: {
290
+ readonly kind: 'text';
291
+ readonly prefix?: string;
292
+ readonly suffix?: string;
293
+ readonly trueValue?: string;
294
+ readonly falseValue?: string;
295
+ /**
296
+ * The host's child-node position of the one text node this write owns,
297
+ * present only when the text shares its element with other children.
298
+ * Negative counts back from the end: -1 is the last child node.
299
+ */
300
+ readonly textNode?: number;
301
+ } | {
302
+ readonly kind: 'attribute';
303
+ readonly name: string;
304
+ } | {
305
+ readonly kind: 'property';
306
+ readonly name: string;
307
+ } | {
308
+ readonly kind: 'class';
309
+ readonly trueValue?: string;
310
+ readonly falseValue?: string;
311
+ /** Class names every write must keep — the module's style scope, which the runtime would otherwise overwrite. */
312
+ readonly constantClass?: string;
313
+ /** Class names every write keeps in front of the value — a part's own style scope, which its markup writes before the class its consumer handed it. */
314
+ readonly leadingClass?: string;
315
+ } | {
316
+ readonly kind: 'style';
317
+ };
318
+ readonly symbolId?: string;
319
+ }>;
320
+ readonly behaviors: ReadonlyArray<{
321
+ readonly hostNodeId: string;
322
+ readonly source: string;
323
+ readonly functionSource: string;
324
+ readonly inputSources: ReadonlyArray<string>;
325
+ readonly inputValues?: ReadonlyArray<unknown>;
326
+ readonly inputGraphReads?: ReadonlyArray<{
327
+ readonly inputIndex: number;
328
+ readonly source: string;
329
+ readonly graphNodeId: string;
330
+ readonly path: ReadonlyArray<string>;
331
+ }>;
332
+ readonly symbolId?: string;
333
+ /** The behavior reads or writes page state, so it runs against the page's graph. */
334
+ readonly usesGraph?: true;
335
+ }>;
336
+ readonly elementHandles: ReadonlyArray<{
337
+ readonly hostNodeId: string;
338
+ readonly handleId: string;
339
+ readonly name: string;
340
+ /** Declared `element<T[]>()`: this handle names an ordered set, and a read answers an array. */
341
+ readonly plural?: boolean;
342
+ }>;
343
+ readonly keyedRepeats?: ReadonlyArray<{
344
+ readonly id: string;
345
+ readonly parentHostNodeId: string;
346
+ /**
347
+ * Where the OWNER's own markup put the rows, when `parentHostNodeId` names
348
+ * an element the owner never wrote: a `@for` inside a child's `{children}`
349
+ * renders into the element that child wraps its hole in, so the parent above
350
+ * is the child's, and this is the host the projecting markup sat in. Only a
351
+ * reader that needs the owner's own id space reads it.
352
+ */
353
+ readonly ownerHostNodeId?: string;
354
+ /**
355
+ * The graph instance path of the component that AUTHORED this `@for`, as
356
+ * composition spells it (`c<n>:`/`p<n>:` segments, outermost first).
357
+ *
358
+ * A row key is only unique within one rendered repeat, and the repeat's own
359
+ * path is the only thing that tells two renderings of one `@for` apart: two
360
+ * family roots over ONE page-level collection read a collection node in page
361
+ * space, so a row keyed off the collection is spelled the same by both. The
362
+ * mint keys a minted row's segment on this plus the row key.
363
+ *
364
+ * Pay-per-use: a repeat the root module authored itself stands at no
365
+ * instance and omits the field, so its record is byte-identical to what it
366
+ * was before this existed. Only composition writes it.
367
+ */
368
+ readonly instancePath?: string;
369
+ /**
370
+ * Present on a `@for` written inside another `@for`'s row. Its rows render
371
+ * once per enclosing row, so the browser wires one instance of this record in
372
+ * each enclosing row. Its own parent has no single host, so `parentHostNodeId`
373
+ * names the outermost enclosing repeat's parent: whatever keeps or moves that
374
+ * repeat's record by host keeps or moves this one with it.
375
+ *
376
+ * `parentHostPath` walks from an enclosing row's root to this repeat's parent,
377
+ * ROW-ROOT-relative like `rowEvents[].hostPath`. `itemPath` is present when
378
+ * the collection is a path on the enclosing row's item (`group.items`); the
379
+ * collection then reads the outermost enclosing collection with a `'*'`
380
+ * segment for each enclosing row (`['*', 'items']`), which reads nothing on
381
+ * its own and which each instance replaces with its enclosing row's index.
382
+ * `repeatId` is spelled as the authoring module spells it: composition
383
+ * prefixes a record's `id` but not this, so it resolves under the record's
384
+ * own prefix.
385
+ *
386
+ * Pay-per-use: a repeat inside no other repeat omits the field.
387
+ */
388
+ readonly enclosingRow?: {
389
+ readonly repeatId: string;
390
+ readonly parentHostPath: ReadonlyArray<number>;
391
+ readonly itemPath?: ReadonlyArray<string>;
392
+ };
393
+ readonly collectionGraphNodeId?: string;
394
+ readonly collectionPath: ReadonlyArray<string>;
395
+ readonly keyPath: ReadonlyArray<string>;
396
+ /**
397
+ * `key i`: a row's key is its position, not a value read off the item.
398
+ * Pay-per-use: a repeat keyed by item data omits the field.
399
+ */
400
+ readonly indexKey?: true;
401
+ /**
402
+ * Rows written straight into an `@if`/`@switch` arm or an `@try`/`@pending`/
403
+ * `@catch` arm, with no element of the arm around them: they stand between
404
+ * that range's anchors, and only while `arm` is the one shown. `branchId` is
405
+ * the branch site or async boundary id as the authoring module spells it;
406
+ * composition prefixes it the way it prefixes this record's `id`.
407
+ */
408
+ readonly branchArm?: {
409
+ readonly branchId: string;
410
+ readonly arm: number;
411
+ };
412
+ readonly itemName: string;
413
+ readonly rowElementCount: number;
414
+ /**
415
+ * Element children of the parent that stand before the rows. Rows occupy
416
+ * `[rowStartOffset, rowStartOffset + items.length)` among the parent's child
417
+ * elements; a repeat whose rows begin at 0 omits the field. A repeat whose
418
+ * prefix has no compile-time element count ships no record at all.
419
+ */
420
+ readonly rowStartOffset?: number;
421
+ /**
422
+ * The `@empty` arm's finished markup, for the mint that raises it when the
423
+ * collection empties after resume and takes it back out when a row returns.
424
+ * Carried only for a repeat that HAS an `@empty` arm whose markup is fully
425
+ * static and whose elements no record names: everything else would need
426
+ * wiring the mint cannot do, so it ships nothing and the served behaviour
427
+ * stands. A repeat with no `@empty` arm omits the field entirely.
428
+ */
429
+ readonly emptyArm?: {
430
+ readonly html: string;
431
+ };
432
+ /**
433
+ * One row's compiled markup, for the mint that builds a row the server never
434
+ * rendered - an item appended to the collection after resume.
435
+ *
436
+ * `html` is the row chunk's statics joined, slot markers KEPT: the marker
437
+ * comments are where the row's own text lives, so the mint finds each text
438
+ * position by walking to it rather than by re-parsing. `textSlots` names
439
+ * those positions - `path` is FRAGMENT-relative (`[0]` is the row root),
440
+ * the value channel is `ProtocolRowTemplateSlotValue` - and is omitted
441
+ * when the row has none, which is the fully static row.
442
+ *
443
+ * `attributeSlots` names the row's dynamic attributes the same way, with the
444
+ * attribute `name` to write and a `path` addressing the ELEMENT that carries
445
+ * it. The attribute's value is not in the html at all: the statics join
446
+ * around it, and the mint writes it under the presence rule every other
447
+ * render path uses (absent for null, undefined and false).
448
+ *
449
+ * Carried only for a row the client can finish alone: static markup, or
450
+ * markup whose every slot - text or attribute - reads off the repeated item,
451
+ * off the items of the rows enclosing it, off a graph node the page already
452
+ * holds, or off an authored expression over those and the owning
453
+ * component's props (a `source` slot, `class` and `style` included; the
454
+ * html keeps a slot attribute's static part, such as the scope class). A row
455
+ * holding anything else - an element handle's id, a value only the render
456
+ * produces, a nested construct - needs wiring the mint cannot do, so it
457
+ * ships nothing and the served behaviour stands. One child component is the exception: a
458
+ * row element wrapping one is markup here plus identity in `rowComponent`,
459
+ * whose `slotPath` names the marker in this html the child's rendered nodes
460
+ * replace.
461
+ *
462
+ * Pay-per-use: a repeat whose row is not mintable emits no field at all, so
463
+ * its record is byte-identical to what it was before this existed, and a row
464
+ * with no dynamic attributes omits `attributeSlots` for the same reason.
465
+ */
466
+ readonly rowTemplate?: {
467
+ readonly html: string;
468
+ /** The component whose render-data reader answers `source` slots; present exactly when one is. */
469
+ readonly componentName?: string;
470
+ readonly textSlots?: ReadonlyArray<{
471
+ readonly path: ReadonlyArray<number>;
472
+ } & ProtocolRowTemplateSlotValue>;
473
+ readonly attributeSlots?: ReadonlyArray<{
474
+ readonly path: ReadonlyArray<number>;
475
+ readonly name: string;
476
+ } & ProtocolRowTemplateSlotValue>;
477
+ };
478
+ /**
479
+ * The parent graph node each prop a `rowTemplate` source slot reads follows,
480
+ * by prop name. The owning component's reader reads a prop under the
481
+ * child's own id, which holds the served value; the row reads the node the
482
+ * parent passed instead. Only composition writes it, and only for a prop
483
+ * passed as a live graph reference.
484
+ *
485
+ * Pay-per-use: a row reading no routed prop omits the field.
486
+ */
487
+ readonly propRoutes?: ReadonlyArray<{
488
+ readonly name: string;
489
+ readonly graphNodeId: string;
490
+ readonly path: ReadonlyArray<string>;
491
+ }>;
492
+ /**
493
+ * The component a row of this repeat roots, named by identity alone.
494
+ *
495
+ * A child component cannot ship markup the way `rowTemplate` does: it has a
496
+ * graph, not a template, and one instance per rendered row. So this carries
497
+ * identifiers and nothing else - the client builds the row by running the
498
+ * same one-edge render the server ran, under ids qualified by the row's key.
499
+ *
500
+ * `componentName` is the component that OWNS the edge (the one whose markup
501
+ * holds the `@for`), not the child: the child's name already rides on the
502
+ * edge. `itemPropName` is the prop the row's item crosses under, carried
503
+ * only when exactly one prop is the bare `@for` binding.
504
+ *
505
+ * `slotPath` appears when a row ELEMENT wraps the component rather than the
506
+ * row being the component. The wrapper's markup then rides in `rowTemplate`,
507
+ * and this FRAGMENT-relative path (`[0]` is the row root) names the marker
508
+ * comment inside it that the child's rendered nodes replace. Its absence is
509
+ * the row that IS the component, which has no wrapper and ships no
510
+ * `rowTemplate` - the shape this field had before wrappers were minted, so
511
+ * such a record stays byte-identical.
512
+ *
513
+ * Carried only for a key-identified repeat whose row start is known and
514
+ * whose child is declared in the same module; anything else is refused, so
515
+ * the served behaviour stands and the record is byte-identical.
516
+ *
517
+ * `rowChunkId` replaces `componentEdgeId` for a row whose markup an @if or
518
+ * @switch over the row item picks: the client renders that owner chunk
519
+ * whole, the way the server did, instead of one edge.
520
+ */
521
+ readonly rowComponent?: {
522
+ readonly componentEdgeId?: string;
523
+ readonly componentName: string;
524
+ readonly itemPropName?: string;
525
+ readonly slotPath?: ReadonlyArray<number>;
526
+ readonly rowChunkId?: string;
527
+ };
528
+ readonly rowElementHandles?: ReadonlyArray<{
529
+ readonly hostPath: ReadonlyArray<number>;
530
+ readonly handleId: string;
531
+ readonly name: string;
532
+ readonly plural?: boolean;
533
+ }>;
534
+ readonly rowEvents: ReadonlyArray<{
535
+ readonly hostPath: ReadonlyArray<number>;
536
+ readonly eventName: string;
537
+ readonly symbolIds: ReadonlyArray<string>;
538
+ readonly syncPolicy?: ProtocolSyncPolicy;
539
+ }>;
540
+ }>;
541
+ readonly branches?: ReadonlyArray<{
542
+ readonly id: string;
543
+ readonly startAnchor: {
544
+ readonly strategy: 'dom-order-comment';
545
+ readonly index: number;
546
+ };
547
+ readonly endAnchor: {
548
+ readonly strategy: 'dom-order-comment';
549
+ readonly index: number;
550
+ };
551
+ readonly symbolId?: string;
552
+ readonly armTests?: ReadonlyArray<unknown>;
553
+ readonly armRecords?: ReadonlyArray<{
554
+ readonly events: ReadonlyArray<{
555
+ readonly hostPath: ReadonlyArray<number>;
556
+ readonly eventName: string;
557
+ readonly symbolIds: ReadonlyArray<string>;
558
+ readonly syncPolicy?: ProtocolSyncPolicy;
559
+ readonly action?: ProtocolEventAction;
560
+ }>;
561
+ readonly domUpdates: ReadonlyArray<Record<string, unknown>>;
562
+ readonly behaviors: ReadonlyArray<Record<string, unknown>>;
563
+ readonly elementHandles: ReadonlyArray<Record<string, unknown>>;
564
+ }>;
565
+ readonly testReads?: ReadonlyArray<{
566
+ readonly source: string;
567
+ readonly graphNodeId: string;
568
+ readonly path: ReadonlyArray<string>;
569
+ }>;
570
+ /**
571
+ * Reads an arm renders with no element of its own to bind to. Writing one
572
+ * through an element update would erase both arms' markers, so these
573
+ * refresh the arm's own marker range through the branch's update symbol.
574
+ */
575
+ readonly contentReads?: ReadonlyArray<ProtocolBranchContentRead>;
576
+ /**
577
+ * Marks a branch whose arms hold a component that has to run, so a flip
578
+ * re-renders the page through the prerender evaluator instead of rebuilding
579
+ * markup from `armRecords`. Absent on every branch the compiler could build
580
+ * arm parts for, which keeps those payloads byte-identical.
581
+ */
582
+ readonly escalates?: true;
583
+ /**
584
+ * Arm-relative records for the arm THIS render served, moved out of the
585
+ * page-absolute streams. Only an escalating branch carries one; `armRecords`
586
+ * above stays the compiler's per-arm plan for every other branch.
587
+ */
588
+ readonly servedArmRecords?: ProtocolArmRecordSet;
589
+ /**
590
+ * The instance path of the part that authored this branch, present on
591
+ * every branch that travelled through composition and absent on every
592
+ * branch that did not. An arm's own update symbol reads the part-local
593
+ * prop ids its module spells, and only the two fields here say which
594
+ * instance it is running as and where its props now live: the record's
595
+ * `testReads`/`contentReads` were rewritten to the caller's nodes, but
596
+ * the symbol's own read has no other route.
597
+ */
598
+ readonly composedInstancePath?: string;
599
+ readonly composedGraphProps?: ReadonlyArray<ProtocolComposedGraphProp>;
600
+ /**
601
+ * Minted element() ids for the handles this branch's arms bind, resolved by
602
+ * the render that served the branch. The token they were minted from is a
603
+ * seed-map value, so a flip has no second way to spell them. Keyed by
604
+ * `protocolElementHandleReadId`, the whole read id the arm symbol asks
605
+ * under, so the resume side answers by matching a key it was handed rather
606
+ * than re-deriving the namespace. Absent on every branch whose arms bind no
607
+ * handle an IDREF names, which keeps those payloads byte-identical.
608
+ */
609
+ readonly elementHandleIds?: Readonly<Record<string, string>>;
610
+ /**
611
+ * IDREF positions OUTSIDE the arms that name a handle an arm binds. The
612
+ * element they sit on outlives the flip, so the attribute is written when
613
+ * the arm files its handle and removed when the arm takes it away, rather
614
+ * than served naming an element that is not there.
615
+ */
616
+ readonly idrefSites?: ReadonlyArray<ProtocolBranchIdrefSite>;
617
+ }>;
618
+ readonly asyncBoundaries: ReadonlyArray<{
619
+ readonly id: string;
620
+ readonly runnerGraphNodeId: string | null;
621
+ readonly initiallyServedArm: ProtocolAsyncBoundaryArm;
622
+ readonly updateSymbolId?: string;
623
+ readonly armRecords?: ProtocolArmRecordSet | ReadonlyArray<ProtocolArmRecordSet>;
624
+ readonly startAnchor: {
625
+ readonly strategy: 'dom-order-comment';
626
+ readonly index: number;
627
+ };
628
+ readonly endAnchor: {
629
+ readonly strategy: 'dom-order-comment';
630
+ readonly index: number;
631
+ };
632
+ readonly asyncReads: ReadonlyArray<{
633
+ readonly source: string;
634
+ readonly graphNodeId: string;
635
+ readonly path: ReadonlyArray<string>;
636
+ readonly runnerSymbolId?: string;
637
+ }>;
638
+ }>;
639
+ };
640
+ type ProtocolPayloadScripts = {
641
+ readonly state: ProtocolStatePayload;
642
+ readonly view: ProtocolViewPayload;
643
+ readonly stateScript: string;
644
+ readonly viewScript: string;
645
+ };
646
+ //#endregion
647
+ export { protocolProjectionSegment as A, PROTOCOL_PAGE_SPACE_ID_PREFIXES as C, protocolInstancePath as D, STORAGE_PROTOCOL_VERSION as E, PROTOCOL_IDLE_EVENT_NAME as F, PROTOCOL_VISIBLE_EVENT_NAME as I, ASYNC_BOUNDARY_ARM as L, protocolStateVersion as M, PROTOCOL_SYNC_POLICY_HOST_ATTRIBUTE as N, protocolInstanceQualifies as O, PROTOCOL_LOCATOR_PATHS_ATTRIBUTE as P, PROTOCOL_EVENT_ACTION_KIND as S, PROTOCOL_PROP_GRAPH_NODE_PREFIX as T, ProtocolViewPayload as _, ProtocolBranchIdrefSite as a, protocolEventDispatchesMarkless as b, ProtocolEventActionKind as c, ProtocolRowTemplateSlotValue as d, ProtocolStatePayload as f, ProtocolSyncPolicyCondition as g, ProtocolSyncPolicyBranch as h, ProtocolBranchContentRead as i, protocolRowSegment as j, protocolInstanceSegment as k, ProtocolEventRecord as l, ProtocolSyncPolicy as m, ProtocolArmRecordSet as n, ProtocolComposedGraphProp as o, ProtocolStreamedArmPatch as p, ProtocolAsyncBoundaryArm as r, ProtocolEventAction as s, ProtocolArmBranchRecord as t, ProtocolPayloadScripts as u, protocolElementHandleReadId as v, PROTOCOL_PROPS_GRAPH_NODE_ID as w, ASYNC_PROTOCOL_VERSION as x, protocolEventActionKind as y };