@exactjs/core 0.6.3 → 0.6.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.
Files changed (55) hide show
  1. package/dist/client/component/resumption.js +5 -1
  2. package/dist/client/component/resumption.js.map +1 -1
  3. package/dist/client/framework/fragment-target-projection-plan.d.ts +9 -0
  4. package/dist/client/framework/fragment-target-projection-plan.d.ts.map +1 -0
  5. package/dist/client/framework/fragment-target-projection-plan.js +99 -0
  6. package/dist/client/framework/fragment-target-projection-plan.js.map +1 -0
  7. package/dist/client/framework/fragment-target-projection.d.ts +1 -5
  8. package/dist/client/framework/fragment-target-projection.d.ts.map +1 -1
  9. package/dist/client/framework/fragment-target-projection.js +5 -95
  10. package/dist/client/framework/fragment-target-projection.js.map +1 -1
  11. package/dist/client/framework/server-fragment-target-projection.d.ts +4 -0
  12. package/dist/client/framework/server-fragment-target-projection.d.ts.map +1 -0
  13. package/dist/client/framework/server-fragment-target-projection.js +7 -0
  14. package/dist/client/framework/server-fragment-target-projection.js.map +1 -0
  15. package/dist/client/framework/server-render-structure.d.ts +1 -0
  16. package/dist/client/framework/server-render-structure.d.ts.map +1 -1
  17. package/dist/client/framework/server-render-structure.js +1 -0
  18. package/dist/client/framework/server-render-structure.js.map +1 -1
  19. package/dist/component/resumption.js +5 -1
  20. package/dist/component/resumption.js.map +1 -1
  21. package/dist/framework/fragment-target-projection-plan.d.ts +9 -0
  22. package/dist/framework/fragment-target-projection-plan.d.ts.map +1 -0
  23. package/dist/framework/fragment-target-projection-plan.js +99 -0
  24. package/dist/framework/fragment-target-projection-plan.js.map +1 -0
  25. package/dist/framework/fragment-target-projection.d.ts +1 -5
  26. package/dist/framework/fragment-target-projection.d.ts.map +1 -1
  27. package/dist/framework/fragment-target-projection.js +5 -95
  28. package/dist/framework/fragment-target-projection.js.map +1 -1
  29. package/dist/framework/server-fragment-target-projection.d.ts +4 -0
  30. package/dist/framework/server-fragment-target-projection.d.ts.map +1 -0
  31. package/dist/framework/server-fragment-target-projection.js +7 -0
  32. package/dist/framework/server-fragment-target-projection.js.map +1 -0
  33. package/dist/framework/server-render-structure.d.ts +1 -0
  34. package/dist/framework/server-render-structure.d.ts.map +1 -1
  35. package/dist/framework/server-render-structure.js +1 -0
  36. package/dist/framework/server-render-structure.js.map +1 -1
  37. package/dist/server/component/resumption.js +5 -1
  38. package/dist/server/component/resumption.js.map +1 -1
  39. package/dist/server/framework/fragment-target-projection-plan.d.ts +9 -0
  40. package/dist/server/framework/fragment-target-projection-plan.d.ts.map +1 -0
  41. package/dist/server/framework/fragment-target-projection-plan.js +99 -0
  42. package/dist/server/framework/fragment-target-projection-plan.js.map +1 -0
  43. package/dist/server/framework/fragment-target-projection.d.ts +1 -5
  44. package/dist/server/framework/fragment-target-projection.d.ts.map +1 -1
  45. package/dist/server/framework/fragment-target-projection.js +5 -95
  46. package/dist/server/framework/fragment-target-projection.js.map +1 -1
  47. package/dist/server/framework/server-fragment-target-projection.d.ts +4 -0
  48. package/dist/server/framework/server-fragment-target-projection.d.ts.map +1 -0
  49. package/dist/server/framework/server-fragment-target-projection.js +7 -0
  50. package/dist/server/framework/server-fragment-target-projection.js.map +1 -0
  51. package/dist/server/framework/server-render-structure.d.ts +1 -0
  52. package/dist/server/framework/server-render-structure.d.ts.map +1 -1
  53. package/dist/server/framework/server-render-structure.js +1 -0
  54. package/dist/server/framework/server-render-structure.js.map +1 -1
  55. package/package.json +1 -1
@@ -32,7 +32,11 @@ function writePath(target, path, value) {
32
32
  cursor = created;
33
33
  }
34
34
  }
35
- cursor[segments.at(-1)] = value;
35
+ const key = segments.at(-1);
36
+ // A captured collection already restores derived reads such as Map/Set.size.
37
+ // Reassigning that identical read would attempt to write a native getter-only property.
38
+ if (!Object.is(cursor[key], value))
39
+ cursor[key] = value;
36
40
  }
37
41
  /** Rejects prototype-bearing path segments before touching reactive state. */
38
42
  function safeSegment(segment) {
@@ -1 +1 @@
1
- {"version":3,"file":"resumption.js","sourceRoot":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,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QAChC,yEAAyE;QACzE,+EAA+E;QAC/E,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC5C,MAAM,GAAG,OAAkC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACP,MAAM,OAAO,GAA4B,EAAE,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;YAC1B,MAAM,GAAG,OAAO,CAAC;QAClB,CAAC;IACF,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,GAAG,KAAK,CAAC;AAClC,CAAC;AAED,8EAA8E;AAC9E,SAAS,WAAW,CAAC,OAAe;IACnC,OAAO,CACN,OAAO,CAAC,MAAM,GAAG,CAAC;QAClB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,aAAa,CACzB,CAAC;AACH,CAAC","sourcesContent":["import type { Reactive } from '@exactjs/reactive/framework/runtime';\nimport type { ComponentResumptionSource } from './contracts.js';\n\ntype IndexedResumptionField = readonly [field: number | string, value: unknown];\n\n/** Applies compiler-selected SSR state paths without replacing client-local setup state. */\nexport function applyComponentResumption(\n\tstate: Reactive<Record<string, unknown>>,\n\tresumption: ComponentResumptionSource\n): void {\n\tconst values = 'componentId' in resumption ? resumption.values : (resumption[1] ?? []);\n\tif (Array.isArray(values)) {\n\t\tfor (const [field, value] of values as unknown as readonly IndexedResumptionField[]) {\n\t\t\tif (typeof field !== 'string')\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`eXact indexed resumption was not prepared for ${'componentId' in resumption ? resumption.componentId : resumption[0]}`\n\t\t\t\t);\n\t\t\twritePath(state, field, value);\n\t\t}\n\t\treturn;\n\t}\n\tfor (const [path, value] of Object.entries(values)) writePath(state, path, value);\n}\n\n/** Materializes one validated dotted state path into the live reactive state object. */\nfunction writePath(target: Record<string, unknown>, path: string, value: unknown): void {\n\tconst segments = path.split('.');\n\tif (!segments.length || !segments.every(safeSegment)) {\n\t\tthrow new Error(`Malformed eXact component resumption state path ${path}`);\n\t}\n\tlet cursor = target;\n\tfor (const segment of segments.slice(0, -1)) {\n\t\tconst current = cursor[segment];\n\t\t// A child path can accompany its captured parent or a setup-owned array.\n\t\t// Traversing `.length` or an indexed item must preserve that array's identity.\n\t\tif (current && typeof current === 'object') {\n\t\t\tcursor = current as Record<string, unknown>;\n\t\t} else {\n\t\t\tconst created: Record<string, unknown> = {};\n\t\t\tcursor[segment] = created;\n\t\t\tcursor = created;\n\t\t}\n\t}\n\tcursor[segments.at(-1)!] = value;\n}\n\n/** Rejects prototype-bearing path segments before touching reactive state. */\nfunction safeSegment(segment: string): boolean {\n\treturn (\n\t\tsegment.length > 0 &&\n\t\tsegment !== '__proto__' &&\n\t\tsegment !== 'prototype' &&\n\t\tsegment !== 'constructor'\n\t);\n}\n"]}
1
+ {"version":3,"file":"resumption.js","sourceRoot":"","sources":["../../../src/component/resumption.ts"],"names":[],"mappings":"AAKA,4FAA4F;AAC5F,MAAM,UAAU,wBAAwB,CACvC,KAAwC,EACxC,UAAqC;IAErC,MAAM,MAAM,GAAG,aAAa,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvF,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAsD,EAAE,CAAC;YACrF,IAAI,OAAO,KAAK,KAAK,QAAQ;gBAC5B,MAAM,IAAI,KAAK,CACd,iDAAiD,aAAa,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CA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,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACzD,CAAC;AAED,8EAA8E;AAC9E,SAAS,WAAW,CAAC,OAAe;IACnC,OAAO,CACN,OAAO,CAAC,MAAM,GAAG,CAAC;QAClB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,aAAa,CACzB,CAAC;AACH,CAAC","sourcesContent":["import type { Reactive } from '@exactjs/reactive/framework/runtime';\nimport type { ComponentResumptionSource } from './contracts.js';\n\ntype IndexedResumptionField = readonly [field: number | string, value: unknown];\n\n/** Applies compiler-selected SSR state paths without replacing client-local setup state. */\nexport function applyComponentResumption(\n\tstate: Reactive<Record<string, unknown>>,\n\tresumption: ComponentResumptionSource\n): void {\n\tconst values = 'componentId' in resumption ? resumption.values : (resumption[1] ?? []);\n\tif (Array.isArray(values)) {\n\t\tfor (const [field, value] of values as unknown as readonly IndexedResumptionField[]) {\n\t\t\tif (typeof field !== 'string')\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`eXact indexed resumption was not prepared for ${'componentId' in resumption ? resumption.componentId : resumption[0]}`\n\t\t\t\t);\n\t\t\twritePath(state, field, value);\n\t\t}\n\t\treturn;\n\t}\n\tfor (const [path, value] of Object.entries(values)) writePath(state, path, value);\n}\n\n/** Materializes one validated dotted state path into the live reactive state object. */\nfunction writePath(target: Record<string, unknown>, path: string, value: unknown): void {\n\tconst segments = path.split('.');\n\tif (!segments.length || !segments.every(safeSegment)) {\n\t\tthrow new Error(`Malformed eXact component resumption state path ${path}`);\n\t}\n\tlet cursor = target;\n\tfor (const segment of segments.slice(0, -1)) {\n\t\tconst current = cursor[segment];\n\t\t// A child path can accompany its captured parent or a setup-owned array.\n\t\t// Traversing `.length` or an indexed item must preserve that array's identity.\n\t\tif (current && typeof current === 'object') {\n\t\t\tcursor = current as Record<string, unknown>;\n\t\t} else {\n\t\t\tconst created: Record<string, unknown> = {};\n\t\t\tcursor[segment] = created;\n\t\t\tcursor = created;\n\t\t}\n\t}\n\tconst key = segments.at(-1)!;\n\t// A captured collection already restores derived reads such as Map/Set.size.\n\t// Reassigning that identical read would attempt to write a native getter-only property.\n\tif (!Object.is(cursor[key], value)) cursor[key] = value;\n}\n\n/** Rejects prototype-bearing path segments before touching reactive state. */\nfunction safeSegment(segment: string): boolean {\n\treturn (\n\t\tsegment.length > 0 &&\n\t\tsegment !== '__proto__' &&\n\t\tsegment !== 'prototype' &&\n\t\tsegment !== 'constructor'\n\t);\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { AnyComponentInstance, Child } from '../component/contracts.js';
2
+ /**
3
+ * Projects only one enhancement owner's supplied placement, preserving its authored structure.
4
+ * Nested component implementations stay opaque. Each owner is a host-coalescing barrier; transparent
5
+ * consecutive owners are grouped before this path. The caller supplies range evaluation: clients
6
+ * retain invalidation, while servers resolve the current render attempt without subscriptions.
7
+ */
8
+ export declare function createFragmentTargetProjectionWithRanges(supplied: Child | (() => Child), tag: string, owner: AnyComponentInstance | undefined, projectRange: (read: () => Child, markerId?: string, mayReplaceSubtree?: boolean) => Child): (children: readonly Child[]) => Child[];
9
+ //# sourceMappingURL=fragment-target-projection-plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragment-target-projection-plan.d.ts","sourceRoot":"","sources":["../../../src/framework/fragment-target-projection-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AA6B7E;;;;;GAKG;AACH,wBAAgB,wCAAwC,CACvD,QAAQ,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,oBAAoB,GAAG,SAAS,EACvC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,KAAK,KAAK,GACxF,CAAC,QAAQ,EAAE,SAAS,KAAK,EAAE,KAAK,KAAK,EAAE,CAmGzC"}
@@ -0,0 +1,99 @@
1
+ import { unwrap } from '@exactjs/reactive/framework/values';
2
+ import { readCompiledTargetReceipt, createCompiledTargetReceipt } from '../component-abi/target-receipt.js';
3
+ import { readCompiledIntrinsicReceipt, withIntrinsicReceiptChildren } from '../component-abi/intrinsic-receipt.js';
4
+ import { readCompiledFragmentReceipt, createCompiledFragmentReceipt, createCompiledFragmentPresentation } from '../component-abi/fragment-receipt.js';
5
+ import { readChildRangeReceipt } from '../component-abi/child-range-receipt.js';
6
+ import { readPreparedServerChildRange, createPreparedServerChildRange } from '../component-abi/server-child-range.js';
7
+ import { readPreparedServerRenderProgram } from '../server-render-program.js';
8
+ import { readRenderProgramReceipt, createPreparedRenderProgram, readRenderProgramSlot } from '../render-program.js';
9
+ import { readPreparedTargetOutput } from './prepared-target-output.js';
10
+ import { FragmentPresentationHosts } from './fragment-hosts.js';
11
+ /**
12
+ * Projects only one enhancement owner's supplied placement, preserving its authored structure.
13
+ * Nested component implementations stay opaque. Each owner is a host-coalescing barrier; transparent
14
+ * consecutive owners are grouped before this path. The caller supplies range evaluation: clients
15
+ * retain invalidation, while servers resolve the current render attempt without subscriptions.
16
+ */
17
+ export function createFragmentTargetProjectionWithRanges(supplied, tag, owner, projectRange) {
18
+ const identity = Symbol('fragment contribution');
19
+ const hosts = new FragmentPresentationHosts();
20
+ const cache = new WeakMap();
21
+ const map = (raw) => {
22
+ const selected = typeof supplied === 'function' ? supplied() : supplied;
23
+ if (raw === selected)
24
+ return raw;
25
+ const value = unwrap(raw);
26
+ if (value === selected)
27
+ return value;
28
+ if (Array.isArray(value))
29
+ return value.map(map);
30
+ if (typeof value !== 'object' || value === null)
31
+ return value;
32
+ const retained = cache.get(value);
33
+ if (retained !== undefined)
34
+ return retained;
35
+ const target = readCompiledTargetReceipt(value);
36
+ let result = value;
37
+ if (target) {
38
+ const contribution = readPreparedTargetOutput([value], selected);
39
+ const presentation = createCompiledFragmentPresentation(selected, hosts
40
+ .reconcile([
41
+ {
42
+ owner: identity,
43
+ tag,
44
+ props: contribution.props,
45
+ declaredHostProps: contribution.declaredHostProps
46
+ }
47
+ ])
48
+ .map((host) => ({
49
+ identity: host.identity,
50
+ tag: host.tag,
51
+ contributions: [{ identity, props: contribution.props, owner }]
52
+ })));
53
+ result = createCompiledTargetReceipt(null, presentation);
54
+ }
55
+ else {
56
+ const intrinsic = readCompiledIntrinsicReceipt(value);
57
+ const fragment = readCompiledFragmentReceipt(value);
58
+ const range = readChildRangeReceipt(value);
59
+ const serverRange = readPreparedServerChildRange(value);
60
+ const program = readRenderProgramReceipt(value);
61
+ const serverProgram = readPreparedServerRenderProgram(value);
62
+ if (intrinsic)
63
+ result = withIntrinsicReceiptChildren(value, intrinsic.children.map((child) => map(child)));
64
+ else if (fragment)
65
+ result = createCompiledFragmentReceipt({ ...fragment.props, key: fragment.key, __exactEnhancements: fragment.enhancement }, ...fragment.children.map(map));
66
+ else if (range && !range.dynamicComponent)
67
+ result = projectRange(() => map(range.value), range.markerId, range.mayReplaceSubtree);
68
+ else if (serverRange)
69
+ result = createPreparedServerChildRange(map(serverRange.value), serverRange.markerId, serverRange.mayReplaceSubtree);
70
+ else if (program) {
71
+ const invocation = program.invocation;
72
+ const slots = new Set(invocation.program.targetSlots ?? []);
73
+ result = createPreparedRenderProgram(invocation.program, (index) => slots.has(index)
74
+ ? map(readRenderProgramSlot(invocation, index))
75
+ : readRenderProgramSlot(invocation, index), invocation.owner, invocation.propertyWriter, program.enhancement);
76
+ }
77
+ else if (serverProgram) {
78
+ const slots = new Set(serverProgram.program.targetSlots ?? []);
79
+ const values = (input) => input.map((entry, index) => (slots.has(index) ? map(entry) : entry));
80
+ result = {
81
+ ...serverProgram,
82
+ eagerValues: values(serverProgram.eagerValues),
83
+ ...(serverProgram.deferredValues
84
+ ? {
85
+ deferredValues: {
86
+ ...serverProgram.deferredValues,
87
+ read: () => values(serverProgram.deferredValues.read())
88
+ }
89
+ }
90
+ : {})
91
+ };
92
+ }
93
+ }
94
+ cache.set(value, result);
95
+ return result;
96
+ };
97
+ return (children) => children.map((child) => map(child));
98
+ }
99
+ //# sourceMappingURL=fragment-target-projection-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragment-target-projection-plan.js","sourceRoot":"","sources":["../../../src/framework/fragment-target-projection-plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EACN,yBAAyB,EACzB,2BAA2B,EAC3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,4BAA4B,EAC5B,4BAA4B,EAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,2BAA2B,EAC3B,6BAA6B,EAC7B,kCAAkC,EAClC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EACN,4BAA4B,EAC5B,8BAA8B,EAC9B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EACN,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,UAAU,wCAAwC,CACvD,QAA+B,EAC/B,GAAW,EACX,KAAuC,EACvC,YAA0F;IAE1F,MAAM,QAAQ,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,IAAI,yBAAyB,EAAE,CAAC;IAC9C,MAAM,KAAK,GAAG,IAAI,OAAO,EAAiB,CAAC;IAC3C,MAAM,GAAG,GAAG,CAAC,GAAY,EAAW,EAAE;QACrC,MAAM,QAAQ,GAAG,O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,CAAC;YACH,CAAC;QACF,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,MAAe,CAAC,CAAC;QAClC,OAAO,MAAM,CAAC;IACf,CAAC,CAAC;IACF,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAU,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import type { AnyComponentInstance, Child } from '../component/contracts.js';\nimport { unwrap } from '@exactjs/reactive/framework/values';\nimport {\n\treadCompiledTargetReceipt,\n\tcreateCompiledTargetReceipt\n} from '../component-abi/target-receipt.js';\nimport {\n\treadCompiledIntrinsicReceipt,\n\twithIntrinsicReceiptChildren\n} from '../component-abi/intrinsic-receipt.js';\nimport {\n\treadCompiledFragmentReceipt,\n\tcreateCompiledFragmentReceipt,\n\tcreateCompiledFragmentPresentation\n} from '../component-abi/fragment-receipt.js';\nimport { readChildRangeReceipt } from '../component-abi/child-range-receipt.js';\nimport {\n\treadPreparedServerChildRange,\n\tcreatePreparedServerChildRange\n} from '../component-abi/server-child-range.js';\nimport { readPreparedServerRenderProgram } from '../server-render-program.js';\nimport {\n\treadRenderProgramReceipt,\n\tcreatePreparedRenderProgram,\n\treadRenderProgramSlot\n} from '../render-program.js';\nimport { readPreparedTargetOutput } from './prepared-target-output.js';\nimport { FragmentPresentationHosts } from './fragment-hosts.js';\n\n/**\n * Projects only one enhancement owner's supplied placement, preserving its authored structure.\n * Nested component implementations stay opaque. Each owner is a host-coalescing barrier; transparent\n * consecutive owners are grouped before this path. The caller supplies range evaluation: clients\n * retain invalidation, while servers resolve the current render attempt without subscriptions.\n */\nexport function createFragmentTargetProjectionWithRanges(\n\tsupplied: Child | (() => Child),\n\ttag: string,\n\towner: AnyComponentInstance | undefined,\n\tprojectRange: (read: () => Child, markerId?: string, mayReplaceSubtree?: boolean) => Child\n): (children: readonly Child[]) => Child[] {\n\tconst identity = Symbol('fragment contribution');\n\tconst hosts = new FragmentPresentationHosts();\n\tconst cache = new WeakMap<object, Child>();\n\tconst map = (raw: unknown): unknown => {\n\t\tconst selected = typeof supplied === 'function' ? supplied() : supplied;\n\t\tif (raw === selected) return raw;\n\t\tconst value = unwrap(raw);\n\t\tif (value === selected) return value;\n\t\tif (Array.isArray(value)) return value.map(map);\n\t\tif (typeof value !== 'object' || value === null) return value;\n\t\tconst retained = cache.get(value);\n\t\tif (retained !== undefined) return retained;\n\t\tconst target = readCompiledTargetReceipt(value);\n\t\tlet result: unknown = value;\n\t\tif (target) {\n\t\t\tconst contribution = readPreparedTargetOutput([value as Child], selected)!;\n\t\t\tconst presentation = createCompiledFragmentPresentation(\n\t\t\t\tselected,\n\t\t\t\thosts\n\t\t\t\t\t.reconcile([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\towner: identity,\n\t\t\t\t\t\t\ttag,\n\t\t\t\t\t\t\tprops: contribution.props,\n\t\t\t\t\t\t\tdeclaredHostProps: contribution.declaredHostProps\n\t\t\t\t\t\t}\n\t\t\t\t\t])\n\t\t\t\t\t.map((host) => ({\n\t\t\t\t\t\tidentity: host.identity,\n\t\t\t\t\t\ttag: host.tag,\n\t\t\t\t\t\tcontributions: [{ identity, props: contribution.props, owner }]\n\t\t\t\t\t}))\n\t\t\t);\n\t\t\tresult = createCompiledTargetReceipt(null, presentation);\n\t\t} else {\n\t\t\tconst intrinsic = readCompiledIntrinsicReceipt(value);\n\t\t\tconst fragment = readCompiledFragmentReceipt(value);\n\t\t\tconst range = readChildRangeReceipt(value);\n\t\t\tconst serverRange = readPreparedServerChildRange(value);\n\t\t\tconst program = readRenderProgramReceipt(value);\n\t\t\tconst serverProgram = readPreparedServerRenderProgram(value);\n\t\t\tif (intrinsic)\n\t\t\t\tresult = withIntrinsicReceiptChildren(\n\t\t\t\t\tvalue,\n\t\t\t\t\tintrinsic.children.map((child) => map(child) as Child)\n\t\t\t\t);\n\t\t\telse if (fragment)\n\t\t\t\tresult = createCompiledFragmentReceipt(\n\t\t\t\t\t{ ...fragment.props, key: fragment.key, __exactEnhancements: fragment.enhancement },\n\t\t\t\t\t...fragment.children.map(map)\n\t\t\t\t);\n\t\t\telse if (range && !range.dynamicComponent)\n\t\t\t\tresult = projectRange(\n\t\t\t\t\t() => map(range.value) as Child,\n\t\t\t\t\trange.markerId,\n\t\t\t\t\trange.mayReplaceSubtree\n\t\t\t\t);\n\t\t\telse if (serverRange)\n\t\t\t\tresult = createPreparedServerChildRange(\n\t\t\t\t\tmap(serverRange.value) as Child,\n\t\t\t\t\tserverRange.markerId,\n\t\t\t\t\tserverRange.mayReplaceSubtree\n\t\t\t\t);\n\t\t\telse if (program) {\n\t\t\t\tconst invocation = program.invocation;\n\t\t\t\tconst slots = new Set(invocation.program.targetSlots ?? []);\n\t\t\t\tresult = createPreparedRenderProgram(\n\t\t\t\t\tinvocation.program,\n\t\t\t\t\t(index) =>\n\t\t\t\t\t\tslots.has(index)\n\t\t\t\t\t\t\t? map(readRenderProgramSlot(invocation, index))\n\t\t\t\t\t\t\t: readRenderProgramSlot(invocation, index),\n\t\t\t\t\tinvocation.owner,\n\t\t\t\t\tinvocation.propertyWriter,\n\t\t\t\t\tprogram.enhancement\n\t\t\t\t);\n\t\t\t} else if (serverProgram) {\n\t\t\t\tconst slots = new Set(serverProgram.program.targetSlots ?? []);\n\t\t\t\tconst values = (input: readonly unknown[]) =>\n\t\t\t\t\tinput.map((entry, index) => (slots.has(index) ? map(entry) : entry));\n\t\t\t\tresult = {\n\t\t\t\t\t...serverProgram,\n\t\t\t\t\teagerValues: values(serverProgram.eagerValues),\n\t\t\t\t\t...(serverProgram.deferredValues\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tdeferredValues: {\n\t\t\t\t\t\t\t\t\t...serverProgram.deferredValues,\n\t\t\t\t\t\t\t\t\tread: () => values(serverProgram.deferredValues!.read())\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {})\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tcache.set(value, result as Child);\n\t\treturn result;\n\t};\n\treturn (children) => children.map((child) => map(child) as Child);\n}\n"]}
@@ -1,8 +1,4 @@
1
1
  import type { AnyComponentInstance, Child } from '../component/contracts.js';
2
- /**
3
- * Projects only one enhancement owner's supplied placement, preserving its authored structure.
4
- * Nested component implementations stay opaque. Each owner is a host-coalescing barrier; transparent
5
- * consecutive owners are grouped before this path. Reactive ranges retain their existing invalidation.
6
- */
2
+ /** Projects fragment targets while retaining client range subscriptions and ownership. */
7
3
  export declare function createFragmentTargetProjection(supplied: Child | (() => Child), tag: string, owner?: AnyComponentInstance): (children: readonly Child[]) => Child[];
8
4
  //# sourceMappingURL=fragment-target-projection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fragment-target-projection.d.ts","sourceRoot":"","sources":["../../../src/framework/fragment-target-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAgC7E;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,oBAAoB,GAC1B,CAAC,QAAQ,EAAE,SAAS,KAAK,EAAE,KAAK,KAAK,EAAE,CAmGzC"}
1
+ {"version":3,"file":"fragment-target-projection.d.ts","sourceRoot":"","sources":["../../../src/framework/fragment-target-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAK7E,0FAA0F;AAC1F,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,oBAAoB,GAC1B,CAAC,QAAQ,EAAE,SAAS,KAAK,EAAE,KAAK,KAAK,EAAE,CAQzC"}
@@ -1,98 +1,8 @@
1
- import { computed, unwrap } from '@exactjs/reactive/framework/runtime';
2
- import { readCompiledTargetReceipt, createCompiledTargetReceipt } from '../component-abi/target-receipt.js';
3
- import { readCompiledIntrinsicReceipt, withIntrinsicReceiptChildren } from '../component-abi/intrinsic-receipt.js';
4
- import { readCompiledFragmentReceipt, createCompiledFragmentReceipt, createCompiledFragmentPresentation } from '../component-abi/fragment-receipt.js';
5
- import { readChildRangeReceipt, createChildRangeReceipt } from '../component-abi/child-range-receipt.js';
6
- import { readPreparedServerChildRange, createPreparedServerChildRange } from '../component-abi/server-child-range.js';
7
- import { readPreparedServerRenderProgram } from '../server-render-program.js';
8
- import { readRenderProgramReceipt, createPreparedRenderProgram, readRenderProgramSlot } from '../render-program.js';
9
- import { readPreparedTargetOutput } from './prepared-target-output.js';
10
- import { FragmentPresentationHosts } from './fragment-hosts.js';
11
- /**
12
- * Projects only one enhancement owner's supplied placement, preserving its authored structure.
13
- * Nested component implementations stay opaque. Each owner is a host-coalescing barrier; transparent
14
- * consecutive owners are grouped before this path. Reactive ranges retain their existing invalidation.
15
- */
1
+ import { computed } from '@exactjs/reactive/framework/runtime';
2
+ import { createChildRangeReceipt } from '../component-abi/child-range-receipt.js';
3
+ import { createFragmentTargetProjectionWithRanges } from './fragment-target-projection-plan.js';
4
+ /** Projects fragment targets while retaining client range subscriptions and ownership. */
16
5
  export function createFragmentTargetProjection(supplied, tag, owner) {
17
- const identity = Symbol('fragment contribution');
18
- const hosts = new FragmentPresentationHosts();
19
- const cache = new WeakMap();
20
- const map = (raw) => {
21
- const selected = typeof supplied === 'function' ? supplied() : supplied;
22
- if (raw === selected)
23
- return raw;
24
- const value = unwrap(raw);
25
- if (value === selected)
26
- return value;
27
- if (Array.isArray(value))
28
- return value.map(map);
29
- if (typeof value !== 'object' || value === null)
30
- return value;
31
- const retained = cache.get(value);
32
- if (retained !== undefined)
33
- return retained;
34
- const target = readCompiledTargetReceipt(value);
35
- let result = value;
36
- if (target) {
37
- const contribution = readPreparedTargetOutput([value], selected);
38
- const presentation = createCompiledFragmentPresentation(selected, hosts
39
- .reconcile([
40
- {
41
- owner: identity,
42
- tag,
43
- props: contribution.props,
44
- declaredHostProps: contribution.declaredHostProps
45
- }
46
- ])
47
- .map((host) => ({
48
- identity: host.identity,
49
- tag: host.tag,
50
- contributions: [{ identity, props: contribution.props, owner }]
51
- })));
52
- result = createCompiledTargetReceipt(null, presentation);
53
- }
54
- else {
55
- const intrinsic = readCompiledIntrinsicReceipt(value);
56
- const fragment = readCompiledFragmentReceipt(value);
57
- const range = readChildRangeReceipt(value);
58
- const serverRange = readPreparedServerChildRange(value);
59
- const program = readRenderProgramReceipt(value);
60
- const serverProgram = readPreparedServerRenderProgram(value);
61
- if (intrinsic)
62
- result = withIntrinsicReceiptChildren(value, intrinsic.children.map((child) => map(child)));
63
- else if (fragment)
64
- result = createCompiledFragmentReceipt({ ...fragment.props, key: fragment.key, __exactEnhancements: fragment.enhancement }, ...fragment.children.map(map));
65
- else if (range && !range.dynamicComponent)
66
- result = createChildRangeReceipt(computed(() => map(range.value)), range.markerId, range.mayReplaceSubtree);
67
- else if (serverRange)
68
- result = createPreparedServerChildRange(map(serverRange.value), serverRange.markerId, serverRange.mayReplaceSubtree);
69
- else if (program) {
70
- const invocation = program.invocation;
71
- const slots = new Set(invocation.program.targetSlots ?? []);
72
- result = createPreparedRenderProgram(invocation.program, (index) => slots.has(index)
73
- ? map(readRenderProgramSlot(invocation, index))
74
- : readRenderProgramSlot(invocation, index), invocation.owner, invocation.propertyWriter, program.enhancement);
75
- }
76
- else if (serverProgram) {
77
- const slots = new Set(serverProgram.program.targetSlots ?? []);
78
- const values = (input) => input.map((entry, index) => (slots.has(index) ? map(entry) : entry));
79
- result = {
80
- ...serverProgram,
81
- eagerValues: values(serverProgram.eagerValues),
82
- ...(serverProgram.deferredValues
83
- ? {
84
- deferredValues: {
85
- ...serverProgram.deferredValues,
86
- read: () => values(serverProgram.deferredValues.read())
87
- }
88
- }
89
- : {})
90
- };
91
- }
92
- }
93
- cache.set(value, result);
94
- return result;
95
- };
96
- return (children) => children.map((child) => map(child));
6
+ return createFragmentTargetProjectionWithRanges(supplied, tag, owner, (read, markerId, mayReplaceSubtree) => createChildRangeReceipt(computed(read), markerId, mayReplaceSubtree));
97
7
  }
98
8
  //# sourceMappingURL=fragment-target-projection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fragment-target-projection.js","sourceRoot":"","sources":["../../../src/framework/fragment-target-projection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EACN,yBAAyB,EACzB,2BAA2B,EAC3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,4BAA4B,EAC5B,4BAA4B,EAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,2BAA2B,EAC3B,6BAA6B,EAC7B,kCAAkC,EAClC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACN,4BAA4B,EAC5B,8BAA8B,EAC9B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EACN,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC7C,QAA+B,EAC/B,GAAW,EACX,KAA4B;IAE5B,MAAM,QAAQ,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,IAAI,yBAAyB,EAAE,CAAC;IAC9C,MAAM,KAAK,GAAG,IAAI,OA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EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,cAAe,CAAC,IAAI,EAAE,CAAC;6BACxD;yBACD;wBACF,CAAC,CAAC,EAAE,CAAC;iBACN,CAAC;YACH,CAAC;QACF,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,MAAe,CAAC,CAAC;QAClC,OAAO,MAAM,CAAC;IACf,CAAC,CAAC;IACF,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAU,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import type { AnyComponentInstance, Child } from '../component/contracts.js';\nimport { computed, unwrap } from '@exactjs/reactive/framework/runtime';\nimport {\n\treadCompiledTargetReceipt,\n\tcreateCompiledTargetReceipt\n} from '../component-abi/target-receipt.js';\nimport {\n\treadCompiledIntrinsicReceipt,\n\twithIntrinsicReceiptChildren\n} from '../component-abi/intrinsic-receipt.js';\nimport {\n\treadCompiledFragmentReceipt,\n\tcreateCompiledFragmentReceipt,\n\tcreateCompiledFragmentPresentation\n} from '../component-abi/fragment-receipt.js';\nimport {\n\treadChildRangeReceipt,\n\tcreateChildRangeReceipt\n} from '../component-abi/child-range-receipt.js';\nimport {\n\treadPreparedServerChildRange,\n\tcreatePreparedServerChildRange\n} from '../component-abi/server-child-range.js';\nimport { readPreparedServerRenderProgram } from '../server-render-program.js';\nimport {\n\treadRenderProgramReceipt,\n\tcreatePreparedRenderProgram,\n\treadRenderProgramSlot\n} from '../render-program.js';\nimport { readPreparedTargetOutput } from './prepared-target-output.js';\nimport { FragmentPresentationHosts } from './fragment-hosts.js';\n\n/**\n * Projects only one enhancement owner's supplied placement, preserving its authored structure.\n * Nested component implementations stay opaque. Each owner is a host-coalescing barrier; transparent\n * consecutive owners are grouped before this path. Reactive ranges retain their existing invalidation.\n */\nexport function createFragmentTargetProjection(\n\tsupplied: Child | (() => Child),\n\ttag: string,\n\towner?: AnyComponentInstance\n): (children: readonly Child[]) => Child[] {\n\tconst identity = Symbol('fragment contribution');\n\tconst hosts = new FragmentPresentationHosts();\n\tconst cache = new WeakMap<object, Child>();\n\tconst map = (raw: unknown): unknown => {\n\t\tconst selected = typeof supplied === 'function' ? supplied() : supplied;\n\t\tif (raw === selected) return raw;\n\t\tconst value = unwrap(raw);\n\t\tif (value === selected) return value;\n\t\tif (Array.isArray(value)) return value.map(map);\n\t\tif (typeof value !== 'object' || value === null) return value;\n\t\tconst retained = cache.get(value);\n\t\tif (retained !== undefined) return retained;\n\t\tconst target = readCompiledTargetReceipt(value);\n\t\tlet result: unknown = value;\n\t\tif (target) {\n\t\t\tconst contribution = readPreparedTargetOutput([value as Child], selected)!;\n\t\t\tconst presentation = createCompiledFragmentPresentation(\n\t\t\t\tselected,\n\t\t\t\thosts\n\t\t\t\t\t.reconcile([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\towner: identity,\n\t\t\t\t\t\t\ttag,\n\t\t\t\t\t\t\tprops: contribution.props,\n\t\t\t\t\t\t\tdeclaredHostProps: contribution.declaredHostProps\n\t\t\t\t\t\t}\n\t\t\t\t\t])\n\t\t\t\t\t.map((host) => ({\n\t\t\t\t\t\tidentity: host.identity,\n\t\t\t\t\t\ttag: host.tag,\n\t\t\t\t\t\tcontributions: [{ identity, props: contribution.props, owner }]\n\t\t\t\t\t}))\n\t\t\t);\n\t\t\tresult = createCompiledTargetReceipt(null, presentation);\n\t\t} else {\n\t\t\tconst intrinsic = readCompiledIntrinsicReceipt(value);\n\t\t\tconst fragment = readCompiledFragmentReceipt(value);\n\t\t\tconst range = readChildRangeReceipt(value);\n\t\t\tconst serverRange = readPreparedServerChildRange(value);\n\t\t\tconst program = readRenderProgramReceipt(value);\n\t\t\tconst serverProgram = readPreparedServerRenderProgram(value);\n\t\t\tif (intrinsic)\n\t\t\t\tresult = withIntrinsicReceiptChildren(\n\t\t\t\t\tvalue,\n\t\t\t\t\tintrinsic.children.map((child) => map(child) as Child)\n\t\t\t\t);\n\t\t\telse if (fragment)\n\t\t\t\tresult = createCompiledFragmentReceipt(\n\t\t\t\t\t{ ...fragment.props, key: fragment.key, __exactEnhancements: fragment.enhancement },\n\t\t\t\t\t...fragment.children.map(map)\n\t\t\t\t);\n\t\t\telse if (range && !range.dynamicComponent)\n\t\t\t\tresult = createChildRangeReceipt(\n\t\t\t\t\tcomputed(() => map(range.value)),\n\t\t\t\t\trange.markerId,\n\t\t\t\t\trange.mayReplaceSubtree\n\t\t\t\t);\n\t\t\telse if (serverRange)\n\t\t\t\tresult = createPreparedServerChildRange(\n\t\t\t\t\tmap(serverRange.value) as Child,\n\t\t\t\t\tserverRange.markerId,\n\t\t\t\t\tserverRange.mayReplaceSubtree\n\t\t\t\t);\n\t\t\telse if (program) {\n\t\t\t\tconst invocation = program.invocation;\n\t\t\t\tconst slots = new Set(invocation.program.targetSlots ?? []);\n\t\t\t\tresult = createPreparedRenderProgram(\n\t\t\t\t\tinvocation.program,\n\t\t\t\t\t(index) =>\n\t\t\t\t\t\tslots.has(index)\n\t\t\t\t\t\t\t? map(readRenderProgramSlot(invocation, index))\n\t\t\t\t\t\t\t: readRenderProgramSlot(invocation, index),\n\t\t\t\t\tinvocation.owner,\n\t\t\t\t\tinvocation.propertyWriter,\n\t\t\t\t\tprogram.enhancement\n\t\t\t\t);\n\t\t\t} else if (serverProgram) {\n\t\t\t\tconst slots = new Set(serverProgram.program.targetSlots ?? []);\n\t\t\t\tconst values = (input: readonly unknown[]) =>\n\t\t\t\t\tinput.map((entry, index) => (slots.has(index) ? map(entry) : entry));\n\t\t\t\tresult = {\n\t\t\t\t\t...serverProgram,\n\t\t\t\t\teagerValues: values(serverProgram.eagerValues),\n\t\t\t\t\t...(serverProgram.deferredValues\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tdeferredValues: {\n\t\t\t\t\t\t\t\t\t...serverProgram.deferredValues,\n\t\t\t\t\t\t\t\t\tread: () => values(serverProgram.deferredValues!.read())\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {})\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tcache.set(value, result as Child);\n\t\treturn result;\n\t};\n\treturn (children) => children.map((child) => map(child) as Child);\n}\n"]}
1
+ {"version":3,"file":"fragment-target-projection.js","sourceRoot":"","sources":["../../../src/framework/fragment-target-projection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,wCAAwC,EAAE,MAAM,sCAAsC,CAAC;AAEhG,0FAA0F;AAC1F,MAAM,UAAU,8BAA8B,CAC7C,QAA+B,EAC/B,GAAW,EACX,KAA4B;IAE5B,OAAO,wCAAwC,CAC9C,QAAQ,EACR,GAAG,EACH,KAAK,EACL,CAAC,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE,CACrC,uBAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CACrE,CAAC;AACH,CAAC","sourcesContent":["import type { AnyComponentInstance, Child } from '../component/contracts.js';\nimport { computed } from '@exactjs/reactive/framework/runtime';\nimport { createChildRangeReceipt } from '../component-abi/child-range-receipt.js';\nimport { createFragmentTargetProjectionWithRanges } from './fragment-target-projection-plan.js';\n\n/** Projects fragment targets while retaining client range subscriptions and ownership. */\nexport function createFragmentTargetProjection(\n\tsupplied: Child | (() => Child),\n\ttag: string,\n\towner?: AnyComponentInstance\n): (children: readonly Child[]) => Child[] {\n\treturn createFragmentTargetProjectionWithRanges(\n\t\tsupplied,\n\t\ttag,\n\t\towner,\n\t\t(read, markerId, mayReplaceSubtree) =>\n\t\t\tcreateChildRangeReceipt(computed(read), markerId, mayReplaceSubtree)\n\t);\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { AnyComponentInstance, Child } from '../component/contracts.js';
2
+ /** Projects one server render attempt without creating client subscriptions or effect scopes. */
3
+ export declare function createServerFragmentTargetProjection(supplied: Child | (() => Child), tag: string, owner?: AnyComponentInstance): (children: readonly Child[]) => Child[];
4
+ //# sourceMappingURL=server-fragment-target-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-fragment-target-projection.d.ts","sourceRoot":"","sources":["../../../src/framework/server-fragment-target-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAI7E,iGAAiG;AACjG,wBAAgB,oCAAoC,CACnD,QAAQ,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,oBAAoB,GAC1B,CAAC,QAAQ,EAAE,SAAS,KAAK,EAAE,KAAK,KAAK,EAAE,CAQzC"}
@@ -0,0 +1,7 @@
1
+ import { createPreparedServerChildRange } from '../component-abi/server-child-range.js';
2
+ import { createFragmentTargetProjectionWithRanges } from './fragment-target-projection-plan.js';
3
+ /** Projects one server render attempt without creating client subscriptions or effect scopes. */
4
+ export function createServerFragmentTargetProjection(supplied, tag, owner) {
5
+ return createFragmentTargetProjectionWithRanges(supplied, tag, owner, (read, markerId, mayReplaceSubtree) => createPreparedServerChildRange(read(), markerId, mayReplaceSubtree));
6
+ }
7
+ //# sourceMappingURL=server-fragment-target-projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-fragment-target-projection.js","sourceRoot":"","sources":["../../../src/framework/server-fragment-target-projection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AACxF,OAAO,EAAE,wCAAwC,EAAE,MAAM,sCAAsC,CAAC;AAEhG,iGAAiG;AACjG,MAAM,UAAU,oCAAoC,CACnD,QAA+B,EAC/B,GAAW,EACX,KAA4B;IAE5B,OAAO,wCAAwC,CAC9C,QAAQ,EACR,GAAG,EACH,KAAK,EACL,CAAC,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE,CACrC,8BAA8B,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CACpE,CAAC;AACH,CAAC","sourcesContent":["import type { AnyComponentInstance, Child } from '../component/contracts.js';\nimport { createPreparedServerChildRange } from '../component-abi/server-child-range.js';\nimport { createFragmentTargetProjectionWithRanges } from './fragment-target-projection-plan.js';\n\n/** Projects one server render attempt without creating client subscriptions or effect scopes. */\nexport function createServerFragmentTargetProjection(\n\tsupplied: Child | (() => Child),\n\ttag: string,\n\towner?: AnyComponentInstance\n): (children: readonly Child[]) => Child[] {\n\treturn createFragmentTargetProjectionWithRanges(\n\t\tsupplied,\n\t\ttag,\n\t\towner,\n\t\t(read, markerId, mayReplaceSubtree) =>\n\t\t\tcreatePreparedServerChildRange(read(), markerId, mayReplaceSubtree)\n\t);\n}\n"]}
@@ -16,4 +16,5 @@ export declare function createForwardedExpression<T>(compute: () => T): T;
16
16
  export declare function createDynamicChild(compute: () => RenderResult, markerId?: string, mayReplaceSubtree?: boolean): ExactPreparedServerChildRange;
17
17
  /** Creates the eager server operation for one compiler-owned dynamic child range. */
18
18
  export declare function createCompiledChildRangeReceipt(compute: () => RenderResult, markerId?: string, mayReplaceSubtree?: boolean): ExactPreparedServerChildRange;
19
+ export { createServerFragmentTargetProjection } from './server-fragment-target-projection.js';
19
20
  //# sourceMappingURL=server-render-structure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-render-structure.d.ts","sourceRoot":"","sources":["../../../src/framework/server-render-structure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAEN,KAAK,6BAA6B,EAClC,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAA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,MAAM,YAAY,EAC3B,QAAQ,CAAC,EAAE,MAAM,EACjB,iBAAiB,UAAO,GACtB,6BAA6B,CAE/B;AAED,qFAAqF;AACrF,wBAAgB,+BAA+B,CAC9C,OAAO,EAAE,MAAM,YAAY,EAC3B,QAAQ,CAAC,EAAE,MAAM,EACjB,iBAAiB,UAAO,GACtB,6BAA6B,CAE/B"}
1
+ {"version":3,"file":"server-render-structure.d.ts","sourceRoot":"","sources":["../../../src/framework/server-render-structure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAEN,KAAK,6BAA6B,EAClC,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EACN,2BAA2B,EAC3B,iCAAiC,EACjC,4BAA4B,EAC5B,+BAA+B,EAC/B,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,+BAA+B,EACpC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,EACpC,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACpC,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,sCAAsC,EACtC,oDAAoD,EACpD,oCAAoC,EACpC,KAAK,qCAAqC,EAC1C,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,4BAA4B,EAC5B,KAAK,6BAA6B,EAClC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,8BAA8B,EAC9B,4BAA4B,EAC5B,KAAK,6BAA6B,EAClC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,MAAM,+CAA+C,CAAC;AAEvD,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAEvD;AAED,2FAA2F;AAC3F,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAEhE;AAED,6FAA6F;AAC7F,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,MAAM,YAAY,EAC3B,QAAQ,CAAC,EAAE,MAAM,EACjB,iBAAiB,UAAO,GACtB,6BAA6B,CAE/B;AAED,qFAAqF;AACrF,wBAAgB,+BAA+B,CAC9C,OAAO,EAAE,MAAM,YAAY,EAC3B,QAAQ,CAAC,EAAE,MAAM,EACjB,iBAAiB,UAAO,GACtB,6BAA6B,CAE/B;AAED,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC"}
@@ -23,4 +23,5 @@ export function createDynamicChild(compute, markerId, mayReplaceSubtree = true)
23
23
  export function createCompiledChildRangeReceipt(compute, markerId, mayReplaceSubtree = true) {
24
24
  return createPreparedServerChildRange(compute(), markerId, mayReplaceSubtree);
25
25
  }
26
+ export { createServerFragmentTargetProjection } from './server-fragment-target-projection.js';
26
27
  //# sourceMappingURL=server-render-structure.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-render-structure.js","sourceRoot":"","sources":["../../../src/framework/server-render-structure.ts"],"names":[],"mappings":"AACA,OAAO,EACN,8BAA8B,EAE9B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE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ChildRange,\n\ttype ExactPreparedServerChildRange\n} from '../component-abi/server-child-range.js';\n\nexport { isFiniteClientBoundary, markFiniteClientBoundary } from '../hydration-boundary.js';\nexport { hasIndependentAsyncSiblings, markIndependentAsyncSiblings } from '../ssr-independence.js';\nexport { RenderProgram, ServerBoundary, ServerSlot } from '../symbols.js';\nexport {\n\tcreatePreparedRenderProgram,\n\tcreatePreparedServerRenderProgram,\n\tprepareCompiledRenderProgram,\n\treadPreparedServerRenderProgram,\n\treadRenderProgram,\n\treadRenderProgramReceipt,\n\treadRenderProgramSlot,\n\ttype ExactRenderProgram,\n\ttype ExactDirectRenderProgram,\n\ttype ExactDomRenderProgram,\n\ttype ExactRenderProgramBinding,\n\ttype ExactRenderProgramBinder,\n\ttype ExactRenderProgramBindingTarget,\n\ttype ExactRenderProgramInvocation,\n\ttype ExactRenderProgramReceipt,\n\ttype ExactRenderProgramReceiptData,\n\ttype ExactPreparedServerRenderProgram,\n\ttype ExactRenderProgramNode,\n\ttype ExactRenderProgramSlot,\n\ttype ExactRenderProgramSsrOperations,\n\ttype ExactRenderProgramSsrOutput,\n\ttype ExactRenderProgramSsrInvocation,\n\ttype ExactRenderProgramSsrWriter,\n\ttype ExactSsrRenderProgram,\n\ttype ExactTableRenderProgram\n} from '../render-program.js';\nexport {\n\tcreatePreparedServerComponentReference,\n\tcreatePreparedServerComponentReferenceFromPlainProps,\n\treadPreparedServerComponentReference,\n\ttype ExactPreparedServerComponentReference\n} from '../component-abi/receipt.js';\nexport {\n\treadPreparedServerChildRange,\n\ttype ExactPreparedServerChildRange\n} from '../component-abi/server-child-range.js';\nexport {\n\tcreatePreparedServerKeyedChild,\n\treadPreparedServerKeyedChild,\n\ttype ExactPreparedServerKeyedChild\n} from '../component-abi/server-keyed-child.js';\nexport {\n\tcreateKeyedServerSlot,\n\tcreateServerBoundary,\n\tcreateServerSlot\n} from '../component-abi/server-structure-receipts.js';\n\n/** Evaluates a compiler-known expression directly in a compiler-closed server component. */\nexport function createExpression<T>(compute: () => T): T {\n\treturn compute();\n}\n\n/** Evaluates a compiler-forwarded input directly in a compiler-closed server component. */\nexport function createForwardedExpression<T>(compute: () => T): T {\n\treturn compute();\n}\n\n/** Creates an eager focused child range for a direct server render or its local fallback. */\nexport function createDynamicChild(\n\tcompute: () => RenderResult,\n\tmarkerId?: string,\n\tmayReplaceSubtree = true\n): ExactPreparedServerChildRange {\n\treturn createPreparedServerChildRange(compute(), markerId, mayReplaceSubtree);\n}\n\n/** Creates the eager server operation for one compiler-owned dynamic child range. */\nexport function createCompiledChildRangeReceipt(\n\tcompute: () => RenderResult,\n\tmarkerId?: string,\n\tmayReplaceSubtree = true\n): ExactPreparedServerChildRange {\n\treturn createPreparedServerChildRange(compute(), markerId, mayReplaceSubtree);\n}\n"]}
1
+ {"version":3,"file":"server-render-structure.js","sourceRoot":"","sources":["../../../src/framework/server-render-structure.ts"],"names":[],"mappings":"AACA,OAAO,EACN,8BAA8B,EAE9B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EACN,2BAA2B,EAC3B,iCAAiC,EACjC,4BAA4B,EAC5B,+BAA+B,EAC/B,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EAmBrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,sCAAsC,EACtC,oDAAoD,EACpD,oCAAoC,EAEpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,4BAA4B,EAE5B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,8BAA8B,EAC9B,4BAA4B,EAE5B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,MAAM,+CAA+C,CAAC;AAEvD,4FAA4F;AAC5F,MAAM,UAAU,gBAAgB,CAAI,OAAgB;IACnD,OAAO,OAAO,EAAE,CAAC;AAClB,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,yBAAyB,CAAI,OAAgB;IAC5D,OAAO,OAAO,EAAE,CAAC;AAClB,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,kBAAkB,CACjC,OAA2B,EAC3B,QAAiB,EACjB,iBAAiB,GAAG,IAAI;IAExB,OAAO,8BAA8B,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAC/E,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,+BAA+B,CAC9C,OAA2B,EAC3B,QAAiB,EACjB,iBAAiB,GAAG,IAAI;IAExB,OAAO,8BAA8B,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAC/E,CAAC;AAED,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC","sourcesContent":["import type { RenderResult } from '../component/contracts.js';\nimport {\n\tcreatePreparedServerChildRange,\n\ttype ExactPreparedServerChildRange\n} from '../component-abi/server-child-range.js';\n\nexport { isFiniteClientBoundary, markFiniteClientBoundary } from '../hydration-boundary.js';\nexport { hasIndependentAsyncSiblings, markIndependentAsyncSiblings } from '../ssr-independence.js';\nexport { RenderProgram, ServerBoundary, ServerSlot } from '../symbols.js';\nexport {\n\tcreatePreparedRenderProgram,\n\tcreatePreparedServerRenderProgram,\n\tprepareCompiledRenderProgram,\n\treadPreparedServerRenderProgram,\n\treadRenderProgram,\n\treadRenderProgramReceipt,\n\treadRenderProgramSlot,\n\ttype ExactRenderProgram,\n\ttype ExactDirectRenderProgram,\n\ttype ExactDomRenderProgram,\n\ttype ExactRenderProgramBinding,\n\ttype ExactRenderProgramBinder,\n\ttype ExactRenderProgramBindingTarget,\n\ttype ExactRenderProgramInvocation,\n\ttype ExactRenderProgramReceipt,\n\ttype ExactRenderProgramReceiptData,\n\ttype ExactPreparedServerRenderProgram,\n\ttype ExactRenderProgramNode,\n\ttype ExactRenderProgramSlot,\n\ttype ExactRenderProgramSsrOperations,\n\ttype ExactRenderProgramSsrOutput,\n\ttype ExactRenderProgramSsrInvocation,\n\ttype ExactRenderProgramSsrWriter,\n\ttype ExactSsrRenderProgram,\n\ttype ExactTableRenderProgram\n} from '../render-program.js';\nexport {\n\tcreatePreparedServerComponentReference,\n\tcreatePreparedServerComponentReferenceFromPlainProps,\n\treadPreparedServerComponentReference,\n\ttype ExactPreparedServerComponentReference\n} from '../component-abi/receipt.js';\nexport {\n\treadPreparedServerChildRange,\n\ttype ExactPreparedServerChildRange\n} from '../component-abi/server-child-range.js';\nexport {\n\tcreatePreparedServerKeyedChild,\n\treadPreparedServerKeyedChild,\n\ttype ExactPreparedServerKeyedChild\n} from '../component-abi/server-keyed-child.js';\nexport {\n\tcreateKeyedServerSlot,\n\tcreateServerBoundary,\n\tcreateServerSlot\n} from '../component-abi/server-structure-receipts.js';\n\n/** Evaluates a compiler-known expression directly in a compiler-closed server component. */\nexport function createExpression<T>(compute: () => T): T {\n\treturn compute();\n}\n\n/** Evaluates a compiler-forwarded input directly in a compiler-closed server component. */\nexport function createForwardedExpression<T>(compute: () => T): T {\n\treturn compute();\n}\n\n/** Creates an eager focused child range for a direct server render or its local fallback. */\nexport function createDynamicChild(\n\tcompute: () => RenderResult,\n\tmarkerId?: string,\n\tmayReplaceSubtree = true\n): ExactPreparedServerChildRange {\n\treturn createPreparedServerChildRange(compute(), markerId, mayReplaceSubtree);\n}\n\n/** Creates the eager server operation for one compiler-owned dynamic child range. */\nexport function createCompiledChildRangeReceipt(\n\tcompute: () => RenderResult,\n\tmarkerId?: string,\n\tmayReplaceSubtree = true\n): ExactPreparedServerChildRange {\n\treturn createPreparedServerChildRange(compute(), markerId, mayReplaceSubtree);\n}\n\nexport { createServerFragmentTargetProjection } from './server-fragment-target-projection.js';\n"]}
@@ -32,7 +32,11 @@ function writePath(target, path, value) {
32
32
  cursor = created;
33
33
  }
34
34
  }
35
- cursor[segments.at(-1)] = value;
35
+ const key = segments.at(-1);
36
+ // A captured collection already restores derived reads such as Map/Set.size.
37
+ // Reassigning that identical read would attempt to write a native getter-only property.
38
+ if (!Object.is(cursor[key], value))
39
+ cursor[key] = value;
36
40
  }
37
41
  /** Rejects prototype-bearing path segments before touching reactive state. */
38
42
  function safeSegment(segment) {
@@ -1 +1 @@
1
- {"version":3,"file":"resumption.js","sourceRoot":"","sources":["../../src/component/resumption.ts"],"names":[],"mappings":"AAKA,4FAA4F;AAC5F,MAAM,UAAU,wBAAwB,CACvC,KAAwC,EACxC,UAAqC;IAErC,MAAM,MAAM,GAAG,aAAa,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvF,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAsD,EAAE,CAAC;YACrF,IAAI,OAAO,KAAK,KAAK,QAAQ;gBAC5B,MAAM,IAAI,KAAK,CACd,iDAAiD,aAAa,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CACvH,CAAC;YACH,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAChC,CAAC;QACD,OAAO;IACR,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACnF,CAAC;AAED,wFAAwF;AACxF,SAAS,SAAS,CAAC,MAA+B,EAAE,IAAY,EAAE,KAAc;IAC/E,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,mDAAmD,IAAI,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QAChC,yEAAyE;QACzE,+EAA+E;QAC/E,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC5C,MAAM,GAAG,OAAkC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACP,MAAM,OAAO,GAA4B,EAAE,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;YAC1B,MAAM,GAAG,OAAO,CAAC;QAClB,CAAC;IACF,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,GAAG,KAAK,CAAC;AAClC,CAAC;AAED,8EAA8E;AAC9E,SAAS,WAAW,CAAC,OAAe;IACnC,OAAO,CACN,OAAO,CAAC,MAAM,GAAG,CAAC;QAClB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,aAAa,CACzB,CAAC;AACH,CAAC","sourcesContent":["import type { Reactive } from '@exactjs/reactive/framework/runtime';\nimport type { ComponentResumptionSource } from './contracts.js';\n\ntype IndexedResumptionField = readonly [field: number | string, value: unknown];\n\n/** Applies compiler-selected SSR state paths without replacing client-local setup state. */\nexport function applyComponentResumption(\n\tstate: Reactive<Record<string, unknown>>,\n\tresumption: ComponentResumptionSource\n): void {\n\tconst values = 'componentId' in resumption ? resumption.values : (resumption[1] ?? []);\n\tif (Array.isArray(values)) {\n\t\tfor (const [field, value] of values as unknown as readonly IndexedResumptionField[]) {\n\t\t\tif (typeof field !== 'string')\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`eXact indexed resumption was not prepared for ${'componentId' in resumption ? resumption.componentId : resumption[0]}`\n\t\t\t\t);\n\t\t\twritePath(state, field, value);\n\t\t}\n\t\treturn;\n\t}\n\tfor (const [path, value] of Object.entries(values)) writePath(state, path, value);\n}\n\n/** Materializes one validated dotted state path into the live reactive state object. */\nfunction writePath(target: Record<string, unknown>, path: string, value: unknown): void {\n\tconst segments = path.split('.');\n\tif (!segments.length || !segments.every(safeSegment)) {\n\t\tthrow new Error(`Malformed eXact component resumption state path ${path}`);\n\t}\n\tlet cursor = target;\n\tfor (const segment of segments.slice(0, -1)) {\n\t\tconst current = cursor[segment];\n\t\t// A child path can accompany its captured parent or a setup-owned array.\n\t\t// Traversing `.length` or an indexed item must preserve that array's identity.\n\t\tif (current && typeof current === 'object') {\n\t\t\tcursor = current as Record<string, unknown>;\n\t\t} else {\n\t\t\tconst created: Record<string, unknown> = {};\n\t\t\tcursor[segment] = created;\n\t\t\tcursor = created;\n\t\t}\n\t}\n\tcursor[segments.at(-1)!] = value;\n}\n\n/** Rejects prototype-bearing path segments before touching reactive state. */\nfunction safeSegment(segment: string): boolean {\n\treturn (\n\t\tsegment.length > 0 &&\n\t\tsegment !== '__proto__' &&\n\t\tsegment !== 'prototype' &&\n\t\tsegment !== 'constructor'\n\t);\n}\n"]}
1
+ {"version":3,"file":"resumption.js","sourceRoot":"","sources":["../../src/component/resumption.ts"],"names":[],"mappings":"AAKA,4FAA4F;AAC5F,MAAM,UAAU,wBAAwB,CACvC,KAAwC,EACxC,UAAqC;IAErC,MAAM,MAAM,GAAG,aAAa,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,I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,CAAC;aAAM,CAAC;YACP,MAAM,OAAO,GAA4B,EAAE,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;YAC1B,MAAM,GAAG,OAAO,CAAC;QAClB,CAAC;IACF,CAAC;IACD,MAAM,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC;IAC7B,6EAA6E;IAC7E,wFAAwF;IACxF,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACzD,CAAC;AAED,8EAA8E;AAC9E,SAAS,WAAW,CAAC,OAAe;IACnC,OAAO,CACN,OAAO,CAAC,MAAM,GAAG,CAAC;QAClB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,aAAa,CACzB,CAAC;AACH,CAAC","sourcesContent":["import type { Reactive } from '@exactjs/reactive/framework/runtime';\nimport type { ComponentResumptionSource } from './contracts.js';\n\ntype IndexedResumptionField = readonly [field: number | string, value: unknown];\n\n/** Applies compiler-selected SSR state paths without replacing client-local setup state. */\nexport function applyComponentResumption(\n\tstate: Reactive<Record<string, unknown>>,\n\tresumption: ComponentResumptionSource\n): void {\n\tconst values = 'componentId' in resumption ? resumption.values : (resumption[1] ?? []);\n\tif (Array.isArray(values)) {\n\t\tfor (const [field, value] of values as unknown as readonly IndexedResumptionField[]) {\n\t\t\tif (typeof field !== 'string')\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`eXact indexed resumption was not prepared for ${'componentId' in resumption ? resumption.componentId : resumption[0]}`\n\t\t\t\t);\n\t\t\twritePath(state, field, value);\n\t\t}\n\t\treturn;\n\t}\n\tfor (const [path, value] of Object.entries(values)) writePath(state, path, value);\n}\n\n/** Materializes one validated dotted state path into the live reactive state object. */\nfunction writePath(target: Record<string, unknown>, path: string, value: unknown): void {\n\tconst segments = path.split('.');\n\tif (!segments.length || !segments.every(safeSegment)) {\n\t\tthrow new Error(`Malformed eXact component resumption state path ${path}`);\n\t}\n\tlet cursor = target;\n\tfor (const segment of segments.slice(0, -1)) {\n\t\tconst current = cursor[segment];\n\t\t// A child path can accompany its captured parent or a setup-owned array.\n\t\t// Traversing `.length` or an indexed item must preserve that array's identity.\n\t\tif (current && typeof current === 'object') {\n\t\t\tcursor = current as Record<string, unknown>;\n\t\t} else {\n\t\t\tconst created: Record<string, unknown> = {};\n\t\t\tcursor[segment] = created;\n\t\t\tcursor = created;\n\t\t}\n\t}\n\tconst key = segments.at(-1)!;\n\t// A captured collection already restores derived reads such as Map/Set.size.\n\t// Reassigning that identical read would attempt to write a native getter-only property.\n\tif (!Object.is(cursor[key], value)) cursor[key] = value;\n}\n\n/** Rejects prototype-bearing path segments before touching reactive state. */\nfunction safeSegment(segment: string): boolean {\n\treturn (\n\t\tsegment.length > 0 &&\n\t\tsegment !== '__proto__' &&\n\t\tsegment !== 'prototype' &&\n\t\tsegment !== 'constructor'\n\t);\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { AnyComponentInstance, Child } from '../component/contracts.js';
2
+ /**
3
+ * Projects only one enhancement owner's supplied placement, preserving its authored structure.
4
+ * Nested component implementations stay opaque. Each owner is a host-coalescing barrier; transparent
5
+ * consecutive owners are grouped before this path. The caller supplies range evaluation: clients
6
+ * retain invalidation, while servers resolve the current render attempt without subscriptions.
7
+ */
8
+ export declare function createFragmentTargetProjectionWithRanges(supplied: Child | (() => Child), tag: string, owner: AnyComponentInstance | undefined, projectRange: (read: () => Child, markerId?: string, mayReplaceSubtree?: boolean) => Child): (children: readonly Child[]) => Child[];
9
+ //# sourceMappingURL=fragment-target-projection-plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragment-target-projection-plan.d.ts","sourceRoot":"","sources":["../../src/framework/fragment-target-projection-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AA6B7E;;;;;GAKG;AACH,wBAAgB,wCAAwC,CACvD,QAAQ,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,oBAAoB,GAAG,SAAS,EACvC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,KAAK,KAAK,GACxF,CAAC,QAAQ,EAAE,SAAS,KAAK,EAAE,KAAK,KAAK,EAAE,CAmGzC"}
@@ -0,0 +1,99 @@
1
+ import { unwrap } from '@exactjs/reactive/framework/values';
2
+ import { readCompiledTargetReceipt, createCompiledTargetReceipt } from '../component-abi/target-receipt.js';
3
+ import { readCompiledIntrinsicReceipt, withIntrinsicReceiptChildren } from '../component-abi/intrinsic-receipt.js';
4
+ import { readCompiledFragmentReceipt, createCompiledFragmentReceipt, createCompiledFragmentPresentation } from '../component-abi/fragment-receipt.js';
5
+ import { readChildRangeReceipt } from '../component-abi/child-range-receipt.js';
6
+ import { readPreparedServerChildRange, createPreparedServerChildRange } from '../component-abi/server-child-range.js';
7
+ import { readPreparedServerRenderProgram } from '../server-render-program.js';
8
+ import { readRenderProgramReceipt, createPreparedRenderProgram, readRenderProgramSlot } from '../render-program.js';
9
+ import { readPreparedTargetOutput } from './prepared-target-output.js';
10
+ import { FragmentPresentationHosts } from './fragment-hosts.js';
11
+ /**
12
+ * Projects only one enhancement owner's supplied placement, preserving its authored structure.
13
+ * Nested component implementations stay opaque. Each owner is a host-coalescing barrier; transparent
14
+ * consecutive owners are grouped before this path. The caller supplies range evaluation: clients
15
+ * retain invalidation, while servers resolve the current render attempt without subscriptions.
16
+ */
17
+ export function createFragmentTargetProjectionWithRanges(supplied, tag, owner, projectRange) {
18
+ const identity = Symbol('fragment contribution');
19
+ const hosts = new FragmentPresentationHosts();
20
+ const cache = new WeakMap();
21
+ const map = (raw) => {
22
+ const selected = typeof supplied === 'function' ? supplied() : supplied;
23
+ if (raw === selected)
24
+ return raw;
25
+ const value = unwrap(raw);
26
+ if (value === selected)
27
+ return value;
28
+ if (Array.isArray(value))
29
+ return value.map(map);
30
+ if (typeof value !== 'object' || value === null)
31
+ return value;
32
+ const retained = cache.get(value);
33
+ if (retained !== undefined)
34
+ return retained;
35
+ const target = readCompiledTargetReceipt(value);
36
+ let result = value;
37
+ if (target) {
38
+ const contribution = readPreparedTargetOutput([value], selected);
39
+ const presentation = createCompiledFragmentPresentation(selected, hosts
40
+ .reconcile([
41
+ {
42
+ owner: identity,
43
+ tag,
44
+ props: contribution.props,
45
+ declaredHostProps: contribution.declaredHostProps
46
+ }
47
+ ])
48
+ .map((host) => ({
49
+ identity: host.identity,
50
+ tag: host.tag,
51
+ contributions: [{ identity, props: contribution.props, owner }]
52
+ })));
53
+ result = createCompiledTargetReceipt(null, presentation);
54
+ }
55
+ else {
56
+ const intrinsic = readCompiledIntrinsicReceipt(value);
57
+ const fragment = readCompiledFragmentReceipt(value);
58
+ const range = readChildRangeReceipt(value);
59
+ const serverRange = readPreparedServerChildRange(value);
60
+ const program = readRenderProgramReceipt(value);
61
+ const serverProgram = readPreparedServerRenderProgram(value);
62
+ if (intrinsic)
63
+ result = withIntrinsicReceiptChildren(value, intrinsic.children.map((child) => map(child)));
64
+ else if (fragment)
65
+ result = createCompiledFragmentReceipt({ ...fragment.props, key: fragment.key, __exactEnhancements: fragment.enhancement }, ...fragment.children.map(map));
66
+ else if (range && !range.dynamicComponent)
67
+ result = projectRange(() => map(range.value), range.markerId, range.mayReplaceSubtree);
68
+ else if (serverRange)
69
+ result = createPreparedServerChildRange(map(serverRange.value), serverRange.markerId, serverRange.mayReplaceSubtree);
70
+ else if (program) {
71
+ const invocation = program.invocation;
72
+ const slots = new Set(invocation.program.targetSlots ?? []);
73
+ result = createPreparedRenderProgram(invocation.program, (index) => slots.has(index)
74
+ ? map(readRenderProgramSlot(invocation, index))
75
+ : readRenderProgramSlot(invocation, index), invocation.owner, invocation.propertyWriter, program.enhancement);
76
+ }
77
+ else if (serverProgram) {
78
+ const slots = new Set(serverProgram.program.targetSlots ?? []);
79
+ const values = (input) => input.map((entry, index) => (slots.has(index) ? map(entry) : entry));
80
+ result = {
81
+ ...serverProgram,
82
+ eagerValues: values(serverProgram.eagerValues),
83
+ ...(serverProgram.deferredValues
84
+ ? {
85
+ deferredValues: {
86
+ ...serverProgram.deferredValues,
87
+ read: () => values(serverProgram.deferredValues.read())
88
+ }
89
+ }
90
+ : {})
91
+ };
92
+ }
93
+ }
94
+ cache.set(value, result);
95
+ return result;
96
+ };
97
+ return (children) => children.map((child) => map(child));
98
+ }
99
+ //# sourceMappingURL=fragment-target-projection-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragment-target-projection-plan.js","sourceRoot":"","sources":["../../src/framework/fragment-target-projection-plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EACN,yBAAyB,EACzB,2BAA2B,EAC3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,4BAA4B,EAC5B,4BAA4B,EAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,2BAA2B,EAC3B,6BAA6B,EAC7B,kCAAkC,EAClC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EACN,4BAA4B,EAC5B,8BAA8B,EAC9B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EACN,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;;;;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ACR,GAAG,aAAa;oBAChB,WAAW,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC;oBAC9C,GAAG,CAAC,aAAa,CAAC,cAAc;wBAC/B,CAAC,CAAC;4BACA,cAAc,EAAE;gCACf,GAAG,aAAa,CAAC,cAAc;gCAC/B,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,cAAe,CAAC,IAAI,EAAE,CAAC;6BACxD;yBACD;wBACF,CAAC,CAAC,EAAE,CAAC;iBACN,CAAC;YACH,CAAC;QACF,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,MAAe,CAAC,CAAC;QAClC,OAAO,MAAM,CAAC;IACf,CAAC,CAAC;IACF,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAU,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import type { AnyComponentInstance, Child } from '../component/contracts.js';\nimport { unwrap } from '@exactjs/reactive/framework/values';\nimport {\n\treadCompiledTargetReceipt,\n\tcreateCompiledTargetReceipt\n} from '../component-abi/target-receipt.js';\nimport {\n\treadCompiledIntrinsicReceipt,\n\twithIntrinsicReceiptChildren\n} from '../component-abi/intrinsic-receipt.js';\nimport {\n\treadCompiledFragmentReceipt,\n\tcreateCompiledFragmentReceipt,\n\tcreateCompiledFragmentPresentation\n} from '../component-abi/fragment-receipt.js';\nimport { readChildRangeReceipt } from '../component-abi/child-range-receipt.js';\nimport {\n\treadPreparedServerChildRange,\n\tcreatePreparedServerChildRange\n} from '../component-abi/server-child-range.js';\nimport { readPreparedServerRenderProgram } from '../server-render-program.js';\nimport {\n\treadRenderProgramReceipt,\n\tcreatePreparedRenderProgram,\n\treadRenderProgramSlot\n} from '../render-program.js';\nimport { readPreparedTargetOutput } from './prepared-target-output.js';\nimport { FragmentPresentationHosts } from './fragment-hosts.js';\n\n/**\n * Projects only one enhancement owner's supplied placement, preserving its authored structure.\n * Nested component implementations stay opaque. Each owner is a host-coalescing barrier; transparent\n * consecutive owners are grouped before this path. The caller supplies range evaluation: clients\n * retain invalidation, while servers resolve the current render attempt without subscriptions.\n */\nexport function createFragmentTargetProjectionWithRanges(\n\tsupplied: Child | (() => Child),\n\ttag: string,\n\towner: AnyComponentInstance | undefined,\n\tprojectRange: (read: () => Child, markerId?: string, mayReplaceSubtree?: boolean) => Child\n): (children: readonly Child[]) => Child[] {\n\tconst identity = Symbol('fragment contribution');\n\tconst hosts = new FragmentPresentationHosts();\n\tconst cache = new WeakMap<object, Child>();\n\tconst map = (raw: unknown): unknown => {\n\t\tconst selected = typeof supplied === 'function' ? supplied() : supplied;\n\t\tif (raw === selected) return raw;\n\t\tconst value = unwrap(raw);\n\t\tif (value === selected) return value;\n\t\tif (Array.isArray(value)) return value.map(map);\n\t\tif (typeof value !== 'object' || value === null) return value;\n\t\tconst retained = cache.get(value);\n\t\tif (retained !== undefined) return retained;\n\t\tconst target = readCompiledTargetReceipt(value);\n\t\tlet result: unknown = value;\n\t\tif (target) {\n\t\t\tconst contribution = readPreparedTargetOutput([value as Child], selected)!;\n\t\t\tconst presentation = createCompiledFragmentPresentation(\n\t\t\t\tselected,\n\t\t\t\thosts\n\t\t\t\t\t.reconcile([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\towner: identity,\n\t\t\t\t\t\t\ttag,\n\t\t\t\t\t\t\tprops: contribution.props,\n\t\t\t\t\t\t\tdeclaredHostProps: contribution.declaredHostProps\n\t\t\t\t\t\t}\n\t\t\t\t\t])\n\t\t\t\t\t.map((host) => ({\n\t\t\t\t\t\tidentity: host.identity,\n\t\t\t\t\t\ttag: host.tag,\n\t\t\t\t\t\tcontributions: [{ identity, props: contribution.props, owner }]\n\t\t\t\t\t}))\n\t\t\t);\n\t\t\tresult = createCompiledTargetReceipt(null, presentation);\n\t\t} else {\n\t\t\tconst intrinsic = readCompiledIntrinsicReceipt(value);\n\t\t\tconst fragment = readCompiledFragmentReceipt(value);\n\t\t\tconst range = readChildRangeReceipt(value);\n\t\t\tconst serverRange = readPreparedServerChildRange(value);\n\t\t\tconst program = readRenderProgramReceipt(value);\n\t\t\tconst serverProgram = readPreparedServerRenderProgram(value);\n\t\t\tif (intrinsic)\n\t\t\t\tresult = withIntrinsicReceiptChildren(\n\t\t\t\t\tvalue,\n\t\t\t\t\tintrinsic.children.map((child) => map(child) as Child)\n\t\t\t\t);\n\t\t\telse if (fragment)\n\t\t\t\tresult = createCompiledFragmentReceipt(\n\t\t\t\t\t{ ...fragment.props, key: fragment.key, __exactEnhancements: fragment.enhancement },\n\t\t\t\t\t...fragment.children.map(map)\n\t\t\t\t);\n\t\t\telse if (range && !range.dynamicComponent)\n\t\t\t\tresult = projectRange(\n\t\t\t\t\t() => map(range.value) as Child,\n\t\t\t\t\trange.markerId,\n\t\t\t\t\trange.mayReplaceSubtree\n\t\t\t\t);\n\t\t\telse if (serverRange)\n\t\t\t\tresult = createPreparedServerChildRange(\n\t\t\t\t\tmap(serverRange.value) as Child,\n\t\t\t\t\tserverRange.markerId,\n\t\t\t\t\tserverRange.mayReplaceSubtree\n\t\t\t\t);\n\t\t\telse if (program) {\n\t\t\t\tconst invocation = program.invocation;\n\t\t\t\tconst slots = new Set(invocation.program.targetSlots ?? []);\n\t\t\t\tresult = createPreparedRenderProgram(\n\t\t\t\t\tinvocation.program,\n\t\t\t\t\t(index) =>\n\t\t\t\t\t\tslots.has(index)\n\t\t\t\t\t\t\t? map(readRenderProgramSlot(invocation, index))\n\t\t\t\t\t\t\t: readRenderProgramSlot(invocation, index),\n\t\t\t\t\tinvocation.owner,\n\t\t\t\t\tinvocation.propertyWriter,\n\t\t\t\t\tprogram.enhancement\n\t\t\t\t);\n\t\t\t} else if (serverProgram) {\n\t\t\t\tconst slots = new Set(serverProgram.program.targetSlots ?? []);\n\t\t\t\tconst values = (input: readonly unknown[]) =>\n\t\t\t\t\tinput.map((entry, index) => (slots.has(index) ? map(entry) : entry));\n\t\t\t\tresult = {\n\t\t\t\t\t...serverProgram,\n\t\t\t\t\teagerValues: values(serverProgram.eagerValues),\n\t\t\t\t\t...(serverProgram.deferredValues\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tdeferredValues: {\n\t\t\t\t\t\t\t\t\t...serverProgram.deferredValues,\n\t\t\t\t\t\t\t\t\tread: () => values(serverProgram.deferredValues!.read())\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {})\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tcache.set(value, result as Child);\n\t\treturn result;\n\t};\n\treturn (children) => children.map((child) => map(child) as Child);\n}\n"]}
@@ -1,8 +1,4 @@
1
1
  import type { AnyComponentInstance, Child } from '../component/contracts.js';
2
- /**
3
- * Projects only one enhancement owner's supplied placement, preserving its authored structure.
4
- * Nested component implementations stay opaque. Each owner is a host-coalescing barrier; transparent
5
- * consecutive owners are grouped before this path. Reactive ranges retain their existing invalidation.
6
- */
2
+ /** Projects fragment targets while retaining client range subscriptions and ownership. */
7
3
  export declare function createFragmentTargetProjection(supplied: Child | (() => Child), tag: string, owner?: AnyComponentInstance): (children: readonly Child[]) => Child[];
8
4
  //# sourceMappingURL=fragment-target-projection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fragment-target-projection.d.ts","sourceRoot":"","sources":["../../src/framework/fragment-target-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAgC7E;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,oBAAoB,GAC1B,CAAC,QAAQ,EAAE,SAAS,KAAK,EAAE,KAAK,KAAK,EAAE,CAmGzC"}
1
+ {"version":3,"file":"fragment-target-projection.d.ts","sourceRoot":"","sources":["../../src/framework/fragment-target-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAK7E,0FAA0F;AAC1F,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,oBAAoB,GAC1B,CAAC,QAAQ,EAAE,SAAS,KAAK,EAAE,KAAK,KAAK,EAAE,CAQzC"}