@histoire/protocol 0.0.0-stage → 1.0.0-beta.3

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 (114) hide show
  1. package/LICENSE +21 -0
  2. package/dist/bridge/catalog.d.ts +12 -0
  3. package/dist/bridge/catalog.d.ts.map +1 -0
  4. package/dist/bridge/envelope.d.ts +18 -0
  5. package/dist/bridge/envelope.d.ts.map +1 -0
  6. package/dist/bridge/events.d.ts +9 -0
  7. package/dist/bridge/events.d.ts.map +1 -0
  8. package/dist/bridge/handshake.d.ts +42 -0
  9. package/dist/bridge/handshake.d.ts.map +1 -0
  10. package/dist/bridge/limits.d.ts +41 -0
  11. package/dist/bridge/limits.d.ts.map +1 -0
  12. package/dist/bridge/payload.d.ts +9 -0
  13. package/dist/bridge/payload.d.ts.map +1 -0
  14. package/dist/bridge/project-test-collection.d.ts +5 -0
  15. package/dist/bridge/project-test-collection.d.ts.map +1 -0
  16. package/dist/bridge/results.d.ts +12 -0
  17. package/dist/bridge/results.d.ts.map +1 -0
  18. package/dist/bridge/size.d.ts +23 -0
  19. package/dist/bridge/size.d.ts.map +1 -0
  20. package/dist/bridge/snapshot.d.ts +27 -0
  21. package/dist/bridge/snapshot.d.ts.map +1 -0
  22. package/dist/bridge/source-descriptor.d.ts +5 -0
  23. package/dist/bridge/source-descriptor.d.ts.map +1 -0
  24. package/dist/bridge/string-size.d.ts +12 -0
  25. package/dist/bridge/string-size.d.ts.map +1 -0
  26. package/dist/bridge/test-execution.d.ts +4 -0
  27. package/dist/bridge/test-execution.d.ts.map +1 -0
  28. package/dist/bridge/types.d.ts +83 -0
  29. package/dist/bridge/types.d.ts.map +1 -0
  30. package/dist/bridge/validation.d.ts +14 -0
  31. package/dist/bridge/validation.d.ts.map +1 -0
  32. package/dist/channels.d.ts +42 -0
  33. package/dist/channels.d.ts.map +1 -0
  34. package/dist/geometry.d.ts +9 -0
  35. package/dist/geometry.d.ts.map +1 -0
  36. package/dist/helpers/matrix-numeric.d.ts +18 -0
  37. package/dist/helpers/matrix-numeric.d.ts.map +1 -0
  38. package/dist/helpers/matrix.d.ts +22 -0
  39. package/dist/helpers/matrix.d.ts.map +1 -0
  40. package/dist/helpers/meta.d.ts +26 -0
  41. package/dist/helpers/meta.d.ts.map +1 -0
  42. package/dist/helpers/story-frame.d.ts +4 -0
  43. package/dist/helpers/story-frame.d.ts.map +1 -0
  44. package/dist/helpers/story-route.d.ts +25 -0
  45. package/dist/helpers/story-route.d.ts.map +1 -0
  46. package/dist/index.d.ts +51 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +3295 -0
  49. package/dist/inspection/capabilities.d.ts +24 -0
  50. package/dist/inspection/capabilities.d.ts.map +1 -0
  51. package/dist/inspection/debug-buffer.d.ts +21 -0
  52. package/dist/inspection/debug-buffer.d.ts.map +1 -0
  53. package/dist/inspection/extensions.d.ts +5 -0
  54. package/dist/inspection/extensions.d.ts.map +1 -0
  55. package/dist/inspection/rows.d.ts +5 -0
  56. package/dist/inspection/rows.d.ts.map +1 -0
  57. package/dist/inspection/validation.d.ts +23 -0
  58. package/dist/inspection/validation.d.ts.map +1 -0
  59. package/dist/plugin-channels.d.ts +84 -0
  60. package/dist/plugin-channels.d.ts.map +1 -0
  61. package/dist/serialization/controls-revision.d.ts +12 -0
  62. package/dist/serialization/controls-revision.d.ts.map +1 -0
  63. package/dist/serialization/state.d.ts +12 -0
  64. package/dist/serialization/state.d.ts.map +1 -0
  65. package/dist/serialization/test-errors.d.ts +8 -0
  66. package/dist/serialization/test-errors.d.ts.map +1 -0
  67. package/dist/theme/color.d.ts +17 -0
  68. package/dist/theme/color.d.ts.map +1 -0
  69. package/dist/theme/semantic.d.ts +32 -0
  70. package/dist/theme/semantic.d.ts.map +1 -0
  71. package/dist/types/catalog.d.ts +172 -0
  72. package/dist/types/catalog.d.ts.map +1 -0
  73. package/dist/types/common.d.ts +59 -0
  74. package/dist/types/common.d.ts.map +1 -0
  75. package/dist/types/content.d.ts +34 -0
  76. package/dist/types/content.d.ts.map +1 -0
  77. package/dist/types/controls.d.ts +132 -0
  78. package/dist/types/controls.d.ts.map +1 -0
  79. package/dist/types/debug.d.ts +64 -0
  80. package/dist/types/debug.d.ts.map +1 -0
  81. package/dist/types/embed-presentation.d.ts +25 -0
  82. package/dist/types/embed-presentation.d.ts.map +1 -0
  83. package/dist/types/error.d.ts +23 -0
  84. package/dist/types/error.d.ts.map +1 -0
  85. package/dist/types/inspection-accessibility.d.ts +43 -0
  86. package/dist/types/inspection-accessibility.d.ts.map +1 -0
  87. package/dist/types/inspection-components.d.ts +69 -0
  88. package/dist/types/inspection-components.d.ts.map +1 -0
  89. package/dist/types/inspection.d.ts +221 -0
  90. package/dist/types/inspection.d.ts.map +1 -0
  91. package/dist/types/isolated-inspection.d.ts +69 -0
  92. package/dist/types/isolated-inspection.d.ts.map +1 -0
  93. package/dist/types/preview-message.d.ts +179 -0
  94. package/dist/types/preview-message.d.ts.map +1 -0
  95. package/dist/types/readonly.d.ts +5 -0
  96. package/dist/types/readonly.d.ts.map +1 -0
  97. package/dist/types/settings.d.ts +31 -0
  98. package/dist/types/settings.d.ts.map +1 -0
  99. package/dist/types/snapshot.d.ts +94 -0
  100. package/dist/types/snapshot.d.ts.map +1 -0
  101. package/dist/types/source-descriptor.d.ts +72 -0
  102. package/dist/types/source-descriptor.d.ts.map +1 -0
  103. package/dist/types/source-search.d.ts +20 -0
  104. package/dist/types/source-search.d.ts.map +1 -0
  105. package/dist/types/test.d.ts +208 -0
  106. package/dist/types/test.d.ts.map +1 -0
  107. package/dist/url/embed-origins.d.ts +16 -0
  108. package/dist/url/embed-origins.d.ts.map +1 -0
  109. package/dist/url/embed.d.ts +30 -0
  110. package/dist/url/embed.d.ts.map +1 -0
  111. package/dist/url/preview.d.ts +14 -0
  112. package/dist/url/preview.d.ts.map +1 -0
  113. package/package.json +32 -3
  114. package/README.md +0 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Guillaume Chau
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,12 @@
1
+ import type { HistoireCatalog, HistoireCatalogStory, HistoireSourceDescriptor } from '../types/catalog.js';
2
+ /** Validates complete availability maps before framework/UI code consumes them. */
3
+ export declare function validateHistoireCapabilities(value: unknown): void;
4
+ /** Validates projected story/variant metadata without importing story modules. */
5
+ export declare function validateHistoireCatalogStory(value: unknown): HistoireCatalogStory;
6
+ /** Validates complete catalog tree and diagnostics at shared transport boundary. */
7
+ export declare function validateHistoireCatalog(value: unknown): HistoireCatalog;
8
+ /** Validates diagnostics independently when projected alongside catalog in view snapshot. */
9
+ export declare function validateHistoireDiagnostics(value: unknown): void;
10
+ /** Handshake descriptor validation is data-only and shares catalog limits. */
11
+ export declare function validateHistoireSourceDescriptor(value: unknown): HistoireSourceDescriptor;
12
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/bridge/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAgB1G,mFAAmF;AACnF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAkBjE;AAeD,kFAAkF;AAClF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CA0CjF;AAED,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAsBvE;AAED,6FAA6F;AAC7F,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAShE;AAED,8EAA8E;AAC9E,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAUzF"}
@@ -0,0 +1,18 @@
1
+ import type { HistoireBridgeCommand, HistoireBridgeEnvelope, HistoireBridgeIdentity, HistoirePortRole } from './types.js';
2
+ /** Bridge message direction relative to parent document. */
3
+ type BridgeDirection = 'parent-to-child' | 'child-to-parent';
4
+ /**
5
+ * Validates envelope before use; expected response command comes from pending request.
6
+ * Metadata and body are each traversed once; `metadataOnly` stops after owner/identity checks
7
+ * so callers can gate (rate, correlation) before running {@link validateBridgeEnvelopeBody}.
8
+ */
9
+ export declare function validateBridgeEnvelope(value: unknown, owner: HistoireBridgeIdentity, role: HistoirePortRole, responseCommand?: HistoireBridgeCommand, direction?: BridgeDirection, metadataOnly?: boolean): HistoireBridgeEnvelope;
10
+ /**
11
+ * Validates payload/result/error and role authority of an envelope whose metadata
12
+ * already passed `validateBridgeEnvelope(..., metadataOnly = true)` for the same object.
13
+ * Each payload is measured once here; nested validators receive `measured` so they skip
14
+ * re-measuring the same subtree under an identical or looser budget.
15
+ */
16
+ export declare function validateBridgeEnvelopeBody(value: unknown, role: HistoirePortRole, responseCommand?: HistoireBridgeCommand, direction?: BridgeDirection): HistoireBridgeEnvelope;
17
+ export {};
18
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/bridge/envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAuB,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAQ9I,4DAA4D;AAC5D,KAAK,eAAe,GAAG,iBAAiB,GAAG,iBAAiB,CAAA;AAmC5D;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,CAAC,EAAE,qBAAqB,EAAE,SAAS,GAAE,eAAmC,EAAE,YAAY,UAAQ,GAAG,sBAAsB,CAGnP;AA8ED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,CAAC,EAAE,qBAAqB,EAAE,SAAS,GAAE,eAAmC,GAAG,sBAAsB,CAsClM"}
@@ -0,0 +1,9 @@
1
+ import type { HistoireBridgeEvent } from './types.js';
2
+ /**
3
+ * Validates every finite publication before parent observers/framework rendering.
4
+ * @param event Publication discriminator.
5
+ * @param value Untrusted payload.
6
+ * @param measured Caller already ran `validateWireValue(value, { kind: 'event', name: event })`.
7
+ */
8
+ export declare function validateBridgeEventPayload(event: HistoireBridgeEvent, value: unknown, measured?: boolean): void;
9
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/bridge/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AA6CrD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,UAAQ,GAAG,IAAI,CA8D7G"}
@@ -0,0 +1,42 @@
1
+ import type { HistoireSourceDescriptor } from '../types/catalog.js';
2
+ import type { HistoireErrorData } from '../types/error.js';
3
+ import type { HistoireBridgeIdentity, HistoirePortRole, HistoireProtocolRange } from './types.js';
4
+ /** Exact frame bootstrap; hints authorize nothing until actual message origin/source match. */
5
+ export interface HistoireBridgeHello {
6
+ /** Window-message discriminator. */
7
+ kind: 'histoire:hello';
8
+ /** Supported host protocol range. */
9
+ protocolRange: HistoireProtocolRange;
10
+ /** Fresh challenge tied to one transferred port. */
11
+ nonce: string;
12
+ /** Host controller identity. */
13
+ sessionId: string;
14
+ /** Bridge or surface attachment identity. */
15
+ mountId: string;
16
+ /** Exact actual parent origin. */
17
+ parentOrigin: string;
18
+ /** Port authority derived from requested first-party document. */
19
+ role: HistoirePortRole;
20
+ }
21
+ /** Port-only acknowledgment; unsolicited global messages cannot create connections. */
22
+ export type HistoireBridgeAck = {
23
+ kind: 'histoire:ack';
24
+ nonce: string;
25
+ protocolRange: HistoireProtocolRange;
26
+ } & ({
27
+ ok: true;
28
+ owner: HistoireBridgeIdentity;
29
+ descriptor: HistoireSourceDescriptor;
30
+ } | {
31
+ ok: false;
32
+ error: HistoireErrorData;
33
+ });
34
+ /** Requires finite positive supported protocol interval. */
35
+ export declare function validateHistoireProtocolRange(value: unknown): HistoireProtocolRange;
36
+ /** Chooses highest common version, with both ranges in typed failure. */
37
+ export declare function negotiateHistoireProtocol(host: HistoireProtocolRange, book: HistoireProtocolRange): number;
38
+ /** Validates bounded hello before accessing any untrusted bootstrap fields. */
39
+ export declare function validateHistoireHello(value: unknown): HistoireBridgeHello;
40
+ /** Validates descriptor separately from small handshake metadata. */
41
+ export declare function validateHistoireAck(value: unknown, hello: HistoireBridgeHello): HistoireBridgeAck;
42
+ //# sourceMappingURL=handshake.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../../src/bridge/handshake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAOjG,+FAA+F;AAC/F,MAAM,WAAW,mBAAmB;IAClC,oCAAoC;IACpC,IAAI,EAAE,gBAAgB,CAAA;IACtB,qCAAqC;IACrC,aAAa,EAAE,qBAAqB,CAAA;IACpC,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;IACb,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAA;IACf,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,IAAI,EAAE,gBAAgB,CAAA;CACvB;AAED,uFAAuF;AACvF,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,qBAAqB,CAAA;CAAE,GAAG,CAC9G;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,sBAAsB,CAAC;IAAC,UAAU,EAAE,wBAAwB,CAAA;CAAE,GAC/E;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,CAC1C,CAAA;AAED,4DAA4D;AAC5D,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAInF;AAED,yEAAyE;AACzE,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,qBAAqB,GAAG,MAAM,CAM1G;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAUzE;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,GAAG,iBAAiB,CAwBjG"}
@@ -0,0 +1,41 @@
1
+ /** Hard traversal bounds for all untrusted payloads. */
2
+ export declare const HISTOIRE_WIRE_LIMITS: {
3
+ readonly metadata: number;
4
+ readonly request: number;
5
+ readonly event: number;
6
+ readonly catalog: number;
7
+ readonly state: number;
8
+ readonly error: number;
9
+ readonly depth: 128;
10
+ readonly containers: 100000;
11
+ readonly edges: 200000;
12
+ };
13
+ /** Per-test bound of plugin data attached to a test result (`HistoireTestCaseResult.data`). */
14
+ export declare const HISTOIRE_TEST_DATA_LIMIT: number;
15
+ /** Sizing policy selected from validated command and captured role. */
16
+ export interface HistoireWirePolicy {
17
+ /** Request, successful result, event, metadata or error representation. */
18
+ kind: 'request' | 'response' | 'event' | 'metadata' | 'error' | 'descriptor';
19
+ /** Validated command or event discriminator. */
20
+ name: string;
21
+ }
22
+ /** Specific limits override generic caps; catalog is never constrained to 1 MiB. */
23
+ export declare function getHistoireWireLimit(policy: HistoireWirePolicy): number;
24
+ /**
25
+ * Bounds of story/variant `meta` published in the catalog. Per-meta bounds stop the copy early;
26
+ * catalog-wide bounds keep many valid metas from pushing the whole catalog past
27
+ * `HISTOIRE_WIRE_LIMITS.catalog` / `containers` / `edges`.
28
+ */
29
+ export declare const HISTOIRE_META_LIMITS: {
30
+ /** JSON bytes of one `meta`. */
31
+ readonly bytes: number;
32
+ /** Nesting depth inside one `meta` (root is 0); deeper values are dropped. */
33
+ readonly depth: 32;
34
+ /** JSON values (containers and leaves, each shared reference counted again) of one `meta`. */
35
+ readonly nodes: 8192;
36
+ /** JSON bytes of all `meta` in one catalog. */
37
+ readonly catalogBytes: number;
38
+ /** JSON values of all `meta` in one catalog. */
39
+ readonly catalogNodes: 40000;
40
+ };
41
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/bridge/limits.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,eAAO,MAAM,oBAAoB;aAAK,QAAQ;aAAa,OAAO;aAAe,KAAK;aAAa,OAAO;aAAmB,KAAK;aAAe,KAAK;aAAa,KAAK,EAAE,GAAG;aAAE,UAAU,EAAE,MAAO;aAAE,KAAK,EAAE,MAAO;CAAW,CAAA;AAE7N,+FAA+F;AAC/F,eAAO,MAAM,wBAAwB,QAAY,CAAA;AAEjD,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CAAA;IAC5E,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;CACb;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAWvE;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;IAC/B,gCAAgC;aAChC,KAAK;IACL,8EAA8E;aAC9E,KAAK,EAAE,EAAE;IACT,8FAA8F;aAC9F,KAAK,EAAE,IAAI;IACX,+CAA+C;aAC/C,YAAY;IACZ,gDAAgD;aAChD,YAAY,EAAE,KAAM;CACZ,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { HistoireBridgeCommand } from './types.js';
2
+ /**
3
+ * Validates finite command arguments; transport signals never cross wire.
4
+ * @param command Request command.
5
+ * @param value Untrusted arguments.
6
+ * @param measured Caller already ran `validateWireValue(value, { kind: 'request', name: command })`.
7
+ */
8
+ export declare function validateBridgePayload(command: HistoireBridgeCommand, value: unknown, measured?: boolean): void;
9
+ //# sourceMappingURL=payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/bridge/payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAQvD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,UAAQ,GAAG,IAAI,CA6D5G"}
@@ -0,0 +1,5 @@
1
+ import type { HistoireTarget } from '../types/common.js';
2
+ import type { HistoireProjectTestCollectionResult } from '../types/test.js';
3
+ /** Validate bounded collection evidence, optionally requiring the complete admitted target inventory. */
4
+ export declare function validateProjectTestCollection(value: unknown, targets?: readonly HistoireTarget[]): asserts value is HistoireProjectTestCollectionResult;
5
+ //# sourceMappingURL=project-test-collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-test-collection.d.ts","sourceRoot":"","sources":["../../src/bridge/project-test-collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,kBAAkB,CAAA;AAO3E,yGAAyG;AACzG,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,SAAS,cAAc,EAAE,GAAG,OAAO,CAAC,KAAK,IAAI,mCAAmC,CAqBvJ"}
@@ -0,0 +1,12 @@
1
+ import type { HistoireBridgeCommand } from './types.js';
2
+ /** JSON-safe bounded error; uncontrolled Error instances cannot enter callbacks. */
3
+ export declare function validateHistoireErrorData(value: unknown): void;
4
+ /** Plugin-keyed JSON attached to one test result, bounded per test. */
5
+ export declare function validateHistoireTestData(value: unknown): void;
6
+ /** Existing wire-safe definition/summary fields retain names and assertion semantics. */
7
+ export declare function validateHistoireTestResult(value: unknown, summary: boolean): void;
8
+ /** Lazy content has captured identity and finite origin/format semantics. */
9
+ export declare function validateHistoireContent(value: unknown, docs: boolean): void;
10
+ /** Correlated successful result must match requested command before observers see it. */
11
+ export declare function validateBridgeResult(command: HistoireBridgeCommand, value: unknown): void;
12
+ //# sourceMappingURL=results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../src/bridge/results.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAUvD,oFAAoF;AACpF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAI9D;AAYD,uEAAuE;AACvE,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAG7D;AAED,yFAAyF;AACzF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAkCjF;AAED,6EAA6E;AAC7E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAW3E;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CA+EzF"}
@@ -0,0 +1,23 @@
1
+ import type { HistoireWirePolicy } from './limits.js';
2
+ /** Portable graph budget, distinct from browser-native structured-clone byte size. */
3
+ export interface HistoireWireSizeOptions {
4
+ /** JSON DTOs repeat aliases; state graphs preserve cycles and cloneable primitives. */
5
+ mode?: 'json' | 'state';
6
+ /** Command-specific byte budget. */
7
+ maxBytes?: number;
8
+ /** Maximum nesting depth. */
9
+ maxDepth?: number;
10
+ /** Maximum visited containers/JSON occurrences. */
11
+ maxContainers?: number;
12
+ /** Maximum property edges, including sparse array slots. */
13
+ maxEdges?: number;
14
+ }
15
+ /**
16
+ * Counts and validates one bounded wire value, stopping before expensive allocation.
17
+ * Traversal is iterative over two parallel stacks (value, depth) to avoid per-node frame
18
+ * objects; an `EXIT` depth marks where a JSON container leaves the ancestry.
19
+ */
20
+ export declare function measureWireValue(value: unknown, options?: HistoireWireSizeOptions): number;
21
+ /** Applies registry precedence; view.sync independently validates state/catalog fields. */
22
+ export declare function validateWireValue(value: unknown, policy: HistoireWirePolicy): number;
23
+ //# sourceMappingURL=size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/bridge/size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAKrD,sFAAsF;AACtF,MAAM,WAAW,uBAAuB;IACtC,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAqCD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,uBAA4B,GAAG,MAAM,CAuJ9F;AAED,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAUpF"}
@@ -0,0 +1,27 @@
1
+ import type { HistoireEvent, HistoireRuntimeSnapshot, HistoireSnapshot, HistoireStateSnapshot } from '../types/snapshot.js';
2
+ /** Ready visible variant geometry, finite and target-attributed. */
3
+ export declare function validateHistoireViewports(value: unknown): void;
4
+ /** Validates primary lifecycle before state/control/dynamic operations become ready. */
5
+ export declare function validateHistoireRuntimeSnapshot(value: unknown): HistoireRuntimeSnapshot;
6
+ /**
7
+ * Cyclic cleaned state root remains structured-clone data and never runtime callbacks.
8
+ * @param value Untrusted value.
9
+ * @param measured Caller already measured `value` with the `state.changed` event policy
10
+ * (identical to the `view.sync` state sub-budget).
11
+ */
12
+ export declare function validateHistoireStateSnapshot(value: unknown, measured?: boolean): HistoireStateSnapshot;
13
+ /**
14
+ * Every event retains exact target/document ownership and finite chronology.
15
+ * @param value Untrusted value.
16
+ * @param measured Caller already measured an enclosing JSON value under a budget no larger
17
+ * than the default request budget (e.g. the `events.appended` batch), which covers this payload.
18
+ */
19
+ export declare function validateHistoireEvent(value: unknown, measured?: boolean): HistoireEvent;
20
+ /**
21
+ * Complete projected view snapshot; event history arrives in separate bounded batches.
22
+ * @param value Untrusted value.
23
+ * @param measured Caller already ran `validateWireValue(value, { kind: 'request', name: 'view.sync' })`,
24
+ * which also measures the `catalog` and `state` sub-budgets.
25
+ */
26
+ export declare function validateHistoireSnapshot(value: unknown, measured?: boolean): HistoireSnapshot;
27
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/bridge/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAM3H,oEAAoE;AACpE,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAa9D;AAED,wFAAwF;AACxF,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,uBAAuB,CAWvF;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,UAAQ,GAAG,qBAAqB,CAMrG;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,UAAQ,GAAG,aAAa,CAMrF;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,UAAQ,GAAG,gBAAgB,CAiC3F"}
@@ -0,0 +1,5 @@
1
+ /** Strict same-base opaque reference; URL normalization must never hide traversal. */
2
+ export declare function validateSourceAssetReference(value: unknown): string;
3
+ /** Validates optional portable config/policy/lazy assets; legacy bare descriptors remain valid. */
4
+ export declare function validateSourceDescriptorFields(input: Record<string, unknown>): void;
5
+ //# sourceMappingURL=source-descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-descriptor.d.ts","sourceRoot":"","sources":["../../src/bridge/source-descriptor.ts"],"names":[],"mappings":"AAMA,sFAAsF;AACtF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAGnE;AAOD,mGAAmG;AACnG,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CA0DnF"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Counts UTF-8 bytes of one string; JSON mode adds quotes and escapes, including
3
+ * well-formed `\uXXXX` escapes for lone surrogates.
4
+ * Stops as soon as the running count exceeds `limit`, so callers can reject oversized
5
+ * strings without scanning them fully. Any returned value above `limit` means "over budget".
6
+ * @param value String to count.
7
+ * @param json Whether JSON quoting/escaping applies.
8
+ * @param limit Remaining byte budget.
9
+ * @returns Exact byte count, or a partial count already greater than `limit`.
10
+ */
11
+ export declare function countWireString(value: string, json: boolean, limit: number): number;
12
+ //# sourceMappingURL=string-size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-size.d.ts","sourceRoot":"","sources":["../../src/bridge/string-size.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAwBnF"}
@@ -0,0 +1,4 @@
1
+ import type { HistoireTestExecutionIdentity } from '../types/test.js';
2
+ /** Finite attribution DTO excludes callbacks, loaders, private paths and arbitrary metadata. */
3
+ export declare function validateHistoireTestExecution(value: unknown): asserts value is HistoireTestExecutionIdentity;
4
+ //# sourceMappingURL=test-execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-execution.d.ts","sourceRoot":"","sources":["../../src/bridge/test-execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAGrE,gGAAgG;AAChG,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,6BAA6B,CAY5G"}
@@ -0,0 +1,83 @@
1
+ import type { HistoireTarget } from '../types/common.js';
2
+ import type { HistoireErrorData } from '../types/error.js';
3
+ /** Initial portable descriptor and bridge versions. */
4
+ export declare const HISTOIRE_PROTOCOL_VERSION = 1;
5
+ export declare const HISTOIRE_DESCRIPTOR_VERSION = 1;
6
+ /** Finite request registry; no arbitrary plugin/code/URL execution. */
7
+ export declare const HISTOIRE_BRIDGE_COMMANDS: readonly ['catalog.list', 'catalog.getStory', 'catalog.search', 'selection.select', 'state.get', 'state.patch', 'state.reset', 'settings.update', 'events.clear', 'docs.get', 'source.get', 'tests.collect', 'tests.run', 'tests.cancel', 'openInEditor', 'subscriptions.add', 'subscriptions.remove', 'view.sync', 'controls.configure', 'controls.preset', 'channel.post', 'plugin.post', 'inspection.variant', 'inspection.dom', 'inspection.highlight', 'inspection.debug', 'inspection.components', 'inspection.component', 'inspection.componentForElement', 'inspection.accessibility', 'inspection.pick', 'inspection.highlightLease', 'inspection.highlightClear', 'inspection.cancel'];
8
+ /** Finite publication registry. */
9
+ export declare const HISTOIRE_BRIDGE_EVENTS: readonly ['catalog.changed', 'content.changed', 'selection.changed', 'state.changed', 'settings.changed', 'events.appended', 'readiness.changed', 'layout.changed', 'tests.progress', 'source.disconnected', 'overlay.open', 'overlay.update', 'overlay.close', 'overlay.result', 'controls.height', 'focus.changed', 'channel.message', 'plugin.message'];
10
+ /** Validated method intent. */
11
+ export type HistoireBridgeCommand = typeof HISTOIRE_BRIDGE_COMMANDS[number];
12
+ /** Validated publication. */
13
+ export type HistoireBridgeEvent = typeof HISTOIRE_BRIDGE_EVENTS[number];
14
+ /** Captured port role controls dispatch authority. */
15
+ export type HistoirePortRole = 'data' | 'primary' | 'controls' | 'view';
16
+ /** Identity captured at handshake/request dispatch, never inferred from frame load. */
17
+ export interface HistoireBridgeIdentity {
18
+ /** Negotiated application protocol. */
19
+ protocolVersion: number;
20
+ /** Parent session lifetime. */
21
+ sessionId: string;
22
+ /** Negotiated port lifetime. */
23
+ connectionId: string;
24
+ /** Attachment lifetime. */
25
+ mountId: string;
26
+ /** Stable book identity. */
27
+ sourceId: string;
28
+ /** Source generation. */
29
+ epoch: string;
30
+ /** Completed source publication. */
31
+ revision: string;
32
+ /** Runtime document for targeted traffic. */
33
+ runtimeId?: string;
34
+ /** Exact captured target for targeted traffic. */
35
+ target?: HistoireTarget;
36
+ /** Parent-owned selection generation; repeated target visits remain distinct. */
37
+ selectionVersion?: number;
38
+ }
39
+ /** Request envelope; payload shape depends on finite command. */
40
+ export interface HistoireBridgeRequest extends HistoireBridgeIdentity {
41
+ /** Envelope discriminator. */
42
+ kind: 'request';
43
+ /** Correlation ID scoped to bound port. */
44
+ requestId: string;
45
+ /** Finite command discriminator. */
46
+ command: HistoireBridgeCommand;
47
+ /** Validated command arguments. */
48
+ payload: unknown;
49
+ /** Exact child intent which caused parent view.sync; never part of replies. */
50
+ selectionRequestId?: string;
51
+ }
52
+ /** Correlated reply retains exact captured owner. */
53
+ export type HistoireBridgeResponse = HistoireBridgeIdentity & {
54
+ kind: 'response';
55
+ requestId: string;
56
+ } & ({
57
+ ok: true;
58
+ result: unknown;
59
+ } | {
60
+ ok: false;
61
+ error: HistoireErrorData;
62
+ });
63
+ /** Future publication with monotonic sequence per port. */
64
+ export interface HistoireBridgePublication extends HistoireBridgeIdentity {
65
+ /** Envelope discriminator. */
66
+ kind: 'event';
67
+ /** Validated event name. */
68
+ event: HistoireBridgeEvent;
69
+ /** Monotonic per-port sequence. */
70
+ sequence: number;
71
+ /** Validated event payload. */
72
+ payload: unknown;
73
+ }
74
+ /** Only these envelope variants enter dispatch. */
75
+ export type HistoireBridgeEnvelope = HistoireBridgeRequest | HistoireBridgeResponse | HistoireBridgePublication;
76
+ /** Supported protocol range in initial frame handshake. */
77
+ export interface HistoireProtocolRange {
78
+ /** Oldest accepted protocol version. */
79
+ min: number;
80
+ /** Newest accepted protocol version. */
81
+ max: number;
82
+ }
83
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bridge/types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,14 @@
1
+ import type { HistoireSettingsPatch } from '../types/settings.js';
2
+ /** Throws typed validation failure without retaining untrusted payload. */
3
+ export declare function invalid(message: string): never;
4
+ /** Requires plain data record, rejecting accessors before any field reads. */
5
+ export declare function wireRecord(value: unknown): Record<string, unknown>;
6
+ /** Nonempty bounded opaque identity, preserving exact contents. */
7
+ export declare function wireId(value: unknown): value is string;
8
+ /** Structured target input; no concatenated identity parsing. */
9
+ export declare function validateHistoireTarget(value: unknown, optionalVariant?: boolean): void;
10
+ /** Exact additional HTTP(S) origin, rejecting paths, wildcards and opaque authority. */
11
+ export declare function validateEmbedOrigin(value: unknown): string;
12
+ /** Validates host-owned settings before forwarding to any runtime. */
13
+ export declare function validateSettingsPatch(value: unknown): HistoireSettingsPatch;
14
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/bridge/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAIjE,2EAA2E;AAC3E,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAE9C;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASlE;AAED,mEAAmE;AACnE,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEtD;AAED,iEAAiE;AACjE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,eAAe,UAAQ,GAAG,IAAI,CAGpF;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAc1D;AAED,sEAAsE;AACtE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CA0B3E"}
@@ -0,0 +1,42 @@
1
+ import type { HistoireJsonValue, HistoireTarget } from './types/common.js';
2
+ /** Application data only; Histoire never interprets message type or body. */
3
+ export interface HistoireHostChannelPayload {
4
+ /** Explicitly configured channel name. */
5
+ name: string;
6
+ /** Application-owned message discriminator. */
7
+ type: string;
8
+ /** Bounded JSON, without callbacks, classes or DOM objects. */
9
+ data: HistoireJsonValue;
10
+ }
11
+ /** Exact originating actor. */
12
+ export interface HistoireHostChannelMessage extends HistoireHostChannelPayload {
13
+ /** Actual runtime document, never a WindowProxy identity. */
14
+ runtimeId: string;
15
+ /** Structured origin captured by story handle at initialization. */
16
+ target: HistoireTarget;
17
+ }
18
+ /** Local story API; callbacks stay inside runtime and never become wire data. */
19
+ export interface HistoireStoryHostChannel {
20
+ /** Admit bounded JSON to owning document; rejected promises are observed internally. */
21
+ post: (type: string, data: HistoireJsonValue) => Promise<void>;
22
+ /** Listen for application type on captured variant; returns unsubscribe. */
23
+ on: (type: string, listener: (data: HistoireJsonValue, message: HistoireHostChannelMessage) => void) => () => void;
24
+ /** Saturated local rate, inbound validation, and listener failure count. */
25
+ getDroppedCount: () => number;
26
+ }
27
+ /** Validate and copy opt-in names; duplicate names confer no extra authority. */
28
+ export declare function validateHostChannelNames(value: unknown): string[];
29
+ /** One canonical JSON traversal also limits UTF-8 wire bytes and rejects accessors. */
30
+ export declare function validateHostChannelPayload(value: unknown, attributed?: boolean): HistoireHostChannelPayload;
31
+ /** Bounded sliding window shared by each owner/direction; no timers or replay queue. */
32
+ export declare function createHostChannelRateLimiter(now?: () => number): {
33
+ /** Count saturates, so hostile traffic cannot overflow portable integers. */
34
+ readonly droppedCount: number;
35
+ /** Record local schema/callback failures as well as rate overflow. */
36
+ drop(): void;
37
+ /** Admit at most 50 messages in any elapsed second across all names. */
38
+ accept(): boolean;
39
+ /** A replacement document never inherits pending messages or old rate tokens. */
40
+ reset(): void;
41
+ };
42
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../src/channels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAI1E,6EAA6E;AAC7E,MAAM,WAAW,0BAA0B;IACzC,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAA;IACZ,+DAA+D;IAC/D,IAAI,EAAE,iBAAiB,CAAA;CACxB;AAED,+BAA+B;AAC/B,MAAM,WAAW,0BAA2B,SAAQ,0BAA0B;IAC5E,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAA;IACjB,oEAAoE;IACpE,MAAM,EAAE,cAAc,CAAA;CACvB;AAED,iFAAiF;AACjF,MAAM,WAAW,wBAAwB;IACvC,wFAAwF;IACxF,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9D,4EAA4E;IAC5E,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,0BAA0B,KAAK,IAAI,KAAK,MAAM,IAAI,CAAA;IAClH,4EAA4E;IAC5E,eAAe,EAAE,MAAM,MAAM,CAAA;CAC9B;AAED,iFAAiF;AACjF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAGjE;AAED,uFAAuF;AACvF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,UAAQ,GAAG,0BAA0B,CAYzG;AAED,wFAAwF;AACxF,wBAAgB,4BAA4B,CAAC,GAAG,GAAE,MAAM,MAAiB;IAIrE,6EAA6E;aACzE,YAAY;IAChB,sEAAsE;IACtE,IAAI;IACJ,wEAAwE;IACxE,MAAM;IAUN,iFAAiF;IACjF,KAAK;EAKR"}
@@ -0,0 +1,9 @@
1
+ import type { HistoireRect, HistoireViewport } from './types/snapshot.js';
2
+ /** Positive intersection; fully clipped content has no published viewport. */
3
+ export declare function intersectRuntimeRects(left: HistoireRect, right: HistoireRect): HistoireRect | null;
4
+ /** Compose sandbox offsets/scales into source surface padding-box coordinates. */
5
+ export declare function mapRuntimeViewport(viewport: HistoireViewport, frame: HistoireRect, logical: {
6
+ width: number;
7
+ height: number;
8
+ }, clip: HistoireRect): HistoireViewport | null;
9
+ //# sourceMappingURL=geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../src/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEzE,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,GAAG,IAAI,CAMlG;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB,GAAG,IAAI,CAS3K"}
@@ -0,0 +1,18 @@
1
+ /** Built-in samples for open numeric props; these are not complete prop domains. */
2
+ export declare const HISTOIRE_MATRIX_NUMERIC_VALUES: readonly number[];
3
+ /** Declarative increasing numeric samples, bounded by an inclusive maximum. */
4
+ export interface HistoireMatrixRange {
5
+ /** First value. */
6
+ min: number;
7
+ /** Inclusive upper bound; an off-step endpoint is not appended. */
8
+ max: number;
9
+ /** Positive interval between values. */
10
+ step: number;
11
+ }
12
+ /** Validate a complete numeric list without silently dropping invalid members. */
13
+ export declare function getHistoireNumericMatrixValues(input: unknown): number[] | undefined;
14
+ /** Expand decimal ranges exactly before converting each bounded result to Number. */
15
+ export declare function getHistoireMatrixRangeValues(input: unknown): number[] | undefined;
16
+ /** Infer range inputs only if exact decimal expansion reproduces the entire domain. */
17
+ export declare function getHistoireMatrixRange(input: readonly number[]): HistoireMatrixRange | undefined;
18
+ //# sourceMappingURL=matrix-numeric.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrix-numeric.d.ts","sourceRoot":"","sources":["../../src/helpers/matrix-numeric.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,eAAO,MAAM,8BAA8B,EAAE,SAAS,MAAM,EAAoC,CAAA;AAEhG,+EAA+E;AAC/E,MAAM,WAAW,mBAAmB;IAClC,mBAAmB;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAA;IACX,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAA;CACb;AAED,kFAAkF;AAClF,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAQnF;AASD,qFAAqF;AACrF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAajF;AAED,uFAAuF;AACvF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,mBAAmB,GAAG,SAAS,CAQhG"}
@@ -0,0 +1,22 @@
1
+ import type { HistoireMatrixRange } from './matrix-numeric.js';
2
+ /** Serializable finite prop value supported by matrix axes. */
3
+ export type HistoireMatrixValue = string | number | boolean | null;
4
+ /** Optional additive metadata for frameworks without runtime enum definitions. */
5
+ export interface HistoireMatrixHint {
6
+ /** Ordered finite values keyed by exact component prop name. */
7
+ axes: Record<string, readonly HistoireMatrixValue[]>;
8
+ }
9
+ /** Story authoring input; ranges become arrays before catalog publication. */
10
+ export interface HistoireMatrixDeclaration {
11
+ /** Ordered values or numeric ranges keyed by exact prop name. */
12
+ axes: Record<string, readonly HistoireMatrixValue[] | HistoireMatrixRange>;
13
+ }
14
+ /** Matrix names never select internal controls or prototype properties. */
15
+ export declare function isHistoireMatrixPropName(name: string): boolean;
16
+ /** Normalize bounded finite scalars without evaluating validators or source code. */
17
+ export declare function getHistoireMatrixValues(value: unknown): HistoireMatrixValue[] | undefined;
18
+ /** Automatic domains must describe their complete finite set, never a sanitized subset. */
19
+ export declare function getHistoireFiniteMatrixValues(value: unknown): HistoireMatrixValue[] | undefined;
20
+ /** Project untrusted declaration data to immutable portable catalog metadata. */
21
+ export declare function normalizeHistoireMatrixHint(value: unknown): HistoireMatrixHint | undefined;
22
+ //# sourceMappingURL=matrix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../src/helpers/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAG9D,+DAA+D;AAC/D,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;AAElE,kFAAkF;AAClF,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC,CAAA;CACrD;AAED,8EAA8E;AAC9E,MAAM,WAAW,yBAAyB;IACxC,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,GAAG,mBAAmB,CAAC,CAAA;CAC3E;AAED,2EAA2E;AAC3E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,qFAAqF;AACrF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,EAAE,GAAG,SAAS,CAIzF;AAED,2FAA2F;AAC3F,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,EAAE,GAAG,SAAS,CAG/F;AAED,iFAAiF;AACjF,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAQ1F"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Portable story/variant `meta` published in the catalog for workbench plugins: frozen JSON
3
+ * values. Values are typed `unknown` because recursive JSON types are too deep for snapshot
4
+ * readonly mapping; consumers validate the keys they own.
5
+ */
6
+ export type HistoireMeta = Readonly<Record<string, unknown>>;
7
+ /** Outcome of {@link normalizeHistoireMeta}. */
8
+ export interface HistoireMetaResult {
9
+ /** Frozen JSON copy; absent when nothing JSON remained or the copy was abandoned. */
10
+ meta?: HistoireMeta;
11
+ /** The copy exceeded `HISTOIRE_META_LIMITS` bytes or nodes and was abandoned. */
12
+ tooLarge?: true;
13
+ /** Upper bound of the JSON bytes of `meta`. */
14
+ bytes?: number;
15
+ /** JSON values (containers and leaves) in `meta`. */
16
+ nodes?: number;
17
+ }
18
+ /**
19
+ * Projects collected `meta` to immutable JSON data without evaluating it. Non-JSON entries
20
+ * (callbacks, components), cycles and values deeper than `HISTOIRE_META_LIMITS.depth` are
21
+ * dropped; an empty or non-object result has no `meta`. The copy stops as soon as it exceeds
22
+ * `HISTOIRE_META_LIMITS` bytes or nodes and reports `tooLarge`, so callers can warn.
23
+ * @param value Story or variant `meta` as collected.
24
+ */
25
+ export declare function normalizeHistoireMeta(value: unknown): HistoireMetaResult;
26
+ //# sourceMappingURL=meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/helpers/meta.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAE5D,gDAAgD;AAChD,MAAM,WAAW,kBAAkB;IACjC,qFAAqF;IACrF,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,IAAI,CAAA;IACf,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAgGD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAYxE"}
@@ -0,0 +1,4 @@
1
+ import type { HistoireStoryFrame } from '../types/catalog.js';
2
+ /** Width and height must be positive CSS pixels. Padding can also be zero. */
3
+ export declare function isHistoireStoryFrameValue(key: keyof HistoireStoryFrame, value: unknown): value is number;
4
+ //# sourceMappingURL=story-frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"story-frame.d.ts","sourceRoot":"","sources":["../../src/helpers/story-frame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAE7D,8EAA8E;AAC9E,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,kBAAkB,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExG"}
@@ -0,0 +1,25 @@
1
+ /** Resolve exact route identity, preferring normal path over dot-ID query fallback. */
2
+ export declare function resolveStoryRouteId(params: {
3
+ storyId?: unknown;
4
+ }, query: {
5
+ storyId?: unknown;
6
+ }): string | undefined;
7
+ /** Parsed URL query retains bare values and repeated parameters, matching router input semantics. */
8
+ export type StoryRouteQuery = Record<string, string | null | readonly (string | null)[]>;
9
+ /** Decode URL query once without collapsing bare `?variantId` into an empty string. */
10
+ export declare function parseStoryRouteQuery(search: string): StoryRouteQuery;
11
+ /** Resolve shared path/query identity and keep omitted variants distinct from explicit null. */
12
+ export declare function resolveStoryRouteSelection(params: {
13
+ storyId?: unknown;
14
+ }, query: {
15
+ storyId?: unknown;
16
+ variantId?: unknown;
17
+ }): {
18
+ storyId: string;
19
+ variantId?: string | null;
20
+ } | undefined;
21
+ /** Hash routes support both normal path IDs and dot-only query identities. */
22
+ export declare function isStoryRouteHash(hash: string): boolean;
23
+ /** Named story route supports safe query selection for dot-only identities. */
24
+ export declare const STORY_ROUTE_PATH = "/story/:storyId?";
25
+ //# sourceMappingURL=story-route.d.ts.map