@dreamboard-games/sdk 0.5.0-alpha.1 → 0.5.0-alpha.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 (166) hide show
  1. package/README.md +143 -47
  2. package/dist/chunk-DMFVAZI2.js +16 -0
  3. package/dist/chunk-DMFVAZI2.js.map +1 -0
  4. package/dist/chunk-FMM5LVJW.js +833 -0
  5. package/dist/chunk-FMM5LVJW.js.map +1 -0
  6. package/dist/{chunk-7M3N5DFJ.js → chunk-LRILEVKC.js} +6113 -6489
  7. package/dist/chunk-LRILEVKC.js.map +1 -0
  8. package/dist/chunk-SP234IY4.js +1363 -0
  9. package/dist/chunk-SP234IY4.js.map +1 -0
  10. package/dist/chunk-VUWNJXLJ.js +52 -0
  11. package/dist/chunk-VUWNJXLJ.js.map +1 -0
  12. package/dist/chunk-ZPRKWPEP.js +511 -0
  13. package/dist/chunk-ZPRKWPEP.js.map +1 -0
  14. package/dist/definition-BaHNPZol.d.ts +4639 -0
  15. package/dist/diagnostics-B0lgnuZ6.d.ts +65 -0
  16. package/dist/index.d.ts +3553 -1
  17. package/dist/index.js +1045 -7
  18. package/dist/index.js.map +1 -1
  19. package/dist/model-BHro6yXu.d.ts +288 -0
  20. package/dist/react.d.ts +32 -0
  21. package/dist/react.js +80 -0
  22. package/dist/react.js.map +1 -0
  23. package/dist/reducer.d.ts +1194 -76
  24. package/dist/reducer.js +4326 -117
  25. package/dist/reducer.js.map +1 -1
  26. package/dist/testing.d.ts +518 -564
  27. package/dist/testing.js +2448 -915
  28. package/dist/testing.js.map +1 -1
  29. package/dist/types-DimqnJBq.d.ts +86 -0
  30. package/package.json +26 -150
  31. package/dist/HandView-Bi2lxzQP.d.ts +0 -79
  32. package/dist/ResourceCounter-BFxJknqp.d.ts +0 -98
  33. package/dist/ThemeProvider-CElaL2ik.d.ts +0 -99
  34. package/dist/attributes-DbvyMbXw.d.ts +0 -68
  35. package/dist/authoring/index.d.ts +0 -59
  36. package/dist/authoring/index.js +0 -24
  37. package/dist/authoring/index.js.map +0 -1
  38. package/dist/authoring-compiler.d.ts +0 -27
  39. package/dist/authoring-compiler.js +0 -11
  40. package/dist/authoring-compiler.js.map +0 -1
  41. package/dist/authoring-generate-cli.d.ts +0 -1
  42. package/dist/authoring-generate-cli.js +0 -45
  43. package/dist/authoring-generate-cli.js.map +0 -1
  44. package/dist/browser-interaction.d.ts +0 -910
  45. package/dist/browser-interaction.js +0 -119
  46. package/dist/browser-interaction.js.map +0 -1
  47. package/dist/chunk-2WJSQQT7.js +0 -166
  48. package/dist/chunk-2WJSQQT7.js.map +0 -1
  49. package/dist/chunk-32PFKDV7.js +0 -11705
  50. package/dist/chunk-32PFKDV7.js.map +0 -1
  51. package/dist/chunk-3BAD4VC2.js +0 -263
  52. package/dist/chunk-3BAD4VC2.js.map +0 -1
  53. package/dist/chunk-3SKDNDPG.js +0 -104
  54. package/dist/chunk-3SKDNDPG.js.map +0 -1
  55. package/dist/chunk-4ZKTGZZK.js +0 -5960
  56. package/dist/chunk-4ZKTGZZK.js.map +0 -1
  57. package/dist/chunk-7M3N5DFJ.js.map +0 -1
  58. package/dist/chunk-EHPEMPRZ.js +0 -2903
  59. package/dist/chunk-EHPEMPRZ.js.map +0 -1
  60. package/dist/chunk-EY2LL5WD.js +0 -9
  61. package/dist/chunk-EY2LL5WD.js.map +0 -1
  62. package/dist/chunk-GDPKTBUR.js +0 -564
  63. package/dist/chunk-GDPKTBUR.js.map +0 -1
  64. package/dist/chunk-JUGQ6F3N.js +0 -7538
  65. package/dist/chunk-JUGQ6F3N.js.map +0 -1
  66. package/dist/chunk-K2JGSRMD.js +0 -90
  67. package/dist/chunk-K2JGSRMD.js.map +0 -1
  68. package/dist/chunk-M2S3QC32.js +0 -21
  69. package/dist/chunk-M2S3QC32.js.map +0 -1
  70. package/dist/chunk-MIKC4Y67.js +0 -922
  71. package/dist/chunk-MIKC4Y67.js.map +0 -1
  72. package/dist/chunk-MYKS6MTR.js +0 -1347
  73. package/dist/chunk-MYKS6MTR.js.map +0 -1
  74. package/dist/chunk-PF7L4BMG.js +0 -117
  75. package/dist/chunk-PF7L4BMG.js.map +0 -1
  76. package/dist/chunk-PZ5AY32C.js +0 -10
  77. package/dist/chunk-PZ5AY32C.js.map +0 -1
  78. package/dist/chunk-QLSK3DYO.js +0 -532
  79. package/dist/chunk-QLSK3DYO.js.map +0 -1
  80. package/dist/chunk-T3ZKNUZ7.js +0 -1
  81. package/dist/chunk-T3ZKNUZ7.js.map +0 -1
  82. package/dist/chunk-UGH54WZ2.js +0 -223
  83. package/dist/chunk-UGH54WZ2.js.map +0 -1
  84. package/dist/chunk-VCDWP5VL.js +0 -746
  85. package/dist/chunk-VCDWP5VL.js.map +0 -1
  86. package/dist/chunk-VDXOF4FW.js +0 -69
  87. package/dist/chunk-VDXOF4FW.js.map +0 -1
  88. package/dist/chunk-VZ7N6WAQ.js +0 -32
  89. package/dist/chunk-VZ7N6WAQ.js.map +0 -1
  90. package/dist/chunk-WHR5UW3F.js +0 -1988
  91. package/dist/chunk-WHR5UW3F.js.map +0 -1
  92. package/dist/chunk-XRS4AZFK.js +0 -1864
  93. package/dist/chunk-XRS4AZFK.js.map +0 -1
  94. package/dist/codegen.d.ts +0 -939
  95. package/dist/codegen.js +0 -40
  96. package/dist/codegen.js.map +0 -1
  97. package/dist/components-CuBO6rev.d.ts +0 -1284
  98. package/dist/definitions-1Hj-pQU8.d.ts +0 -300
  99. package/dist/diagnostics-DIi3ina7.d.ts +0 -50
  100. package/dist/digest.d.ts +0 -8
  101. package/dist/game-g9dDFYyU.d.ts +0 -546
  102. package/dist/hex-board-view-aKkblDp6.d.ts +0 -1228
  103. package/dist/index-Bxbv3c9W.d.ts +0 -193
  104. package/dist/index.d-DjzoK7zn.d.ts +0 -2101
  105. package/dist/package-set.d.ts +0 -13
  106. package/dist/package-set.js +0 -13
  107. package/dist/package-set.js.map +0 -1
  108. package/dist/player-state-Cqpyeql0.d.ts +0 -371
  109. package/dist/plugin-runtime-contract.d.ts +0 -17
  110. package/dist/plugin-runtime-contract.js +0 -92
  111. package/dist/plugin-runtime-contract.js.map +0 -1
  112. package/dist/primitive-props-BNHDkgd7.d.ts +0 -16
  113. package/dist/protocol-dYgafTYY.d.ts +0 -314
  114. package/dist/reducer/advanced.d.ts +0 -82
  115. package/dist/reducer/advanced.js +0 -49
  116. package/dist/reducer/advanced.js.map +0 -1
  117. package/dist/reducer-contract.d.ts +0 -3
  118. package/dist/reducer-contract.js +0 -16
  119. package/dist/reducer-contract.js.map +0 -1
  120. package/dist/reference-games/index.d.ts +0 -31
  121. package/dist/reference-games/index.js +0 -48
  122. package/dist/reference-games/index.js.map +0 -1
  123. package/dist/runtime/primitives.d.ts +0 -249
  124. package/dist/runtime/primitives.js +0 -189
  125. package/dist/runtime/primitives.js.map +0 -1
  126. package/dist/runtime/runtime-api.d.ts +0 -1
  127. package/dist/runtime/runtime-api.js +0 -1
  128. package/dist/runtime/runtime-api.js.map +0 -1
  129. package/dist/runtime/workspace-contract.d.ts +0 -363
  130. package/dist/runtime/workspace-contract.js +0 -24
  131. package/dist/runtime/workspace-contract.js.map +0 -1
  132. package/dist/runtime-DksMTWtC.d.ts +0 -1706
  133. package/dist/runtime-api-C9bDgp63.d.ts +0 -293
  134. package/dist/runtime-json-CQ9QbLZ5.d.ts +0 -5
  135. package/dist/runtime.d.ts +0 -83
  136. package/dist/runtime.js +0 -241
  137. package/dist/runtime.js.map +0 -1
  138. package/dist/schema.d.ts +0 -379
  139. package/dist/stale-contract-artifact-error-XLaweZtF.d.ts +0 -18
  140. package/dist/testing-compiler.d.ts +0 -37
  141. package/dist/testing-compiler.js +0 -272
  142. package/dist/testing-compiler.js.map +0 -1
  143. package/dist/testing-runtime.d.ts +0 -119
  144. package/dist/testing-runtime.js +0 -212
  145. package/dist/testing-runtime.js.map +0 -1
  146. package/dist/types-DJj5MJkl.d.ts +0 -256
  147. package/dist/types-DR7DoB1x.d.ts +0 -28
  148. package/dist/types-Dlh4GsNp.d.ts +0 -122
  149. package/dist/types.d.ts +0 -1958
  150. package/dist/types.js +0 -26
  151. package/dist/types.js.map +0 -1
  152. package/dist/ui/components.d.ts +0 -17
  153. package/dist/ui/components.js +0 -216
  154. package/dist/ui/components.js.map +0 -1
  155. package/dist/ui/defaults.d.ts +0 -19
  156. package/dist/ui/defaults.js +0 -104
  157. package/dist/ui/defaults.js.map +0 -1
  158. package/dist/ui/player-state.d.ts +0 -2
  159. package/dist/ui/player-state.js +0 -1
  160. package/dist/ui/player-state.js.map +0 -1
  161. package/dist/ui/plugin-styles.css +0 -2
  162. package/dist/ui-contract-Mgx_k9gm.d.ts +0 -1168
  163. package/dist/ui.d.ts +0 -317
  164. package/dist/ui.js +0 -277
  165. package/dist/ui.js.map +0 -1
  166. package/dist/views-B4lD4fT0.d.ts +0 -1641
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @dreamboard-games/sdk
2
2
 
3
+ [Guides and API reference](../../docs/index.md) · [Registry](../../registry/README.md) · [Examples](../../examples/reference-games/README.md)
4
+
3
5
  The public TypeScript SDK for authoring, testing, and rendering Dreamboard
4
6
  games. Install this package rather than any of the repository's unpublished
5
7
  workspace inputs.
@@ -8,33 +10,15 @@ workspace inputs.
8
10
  pnpm add @dreamboard-games/sdk
9
11
  ```
10
12
 
11
- The package's declarations and export map are the API authority. Supported
12
- imports include the root module and explicit subpaths for authoring, runtime,
13
- reducer contracts, testing, browser interaction, UI, and reference-game
14
- metadata. Import only subpaths present in the installed package's `exports`
15
- field.
13
+ The package declarations and export map are the API authority. There are four entry points:
16
14
 
17
- ```ts
18
- import { DREAMBOARD_SDK_VERSION } from "@dreamboard-games/sdk";
19
- import type { ReducerWire } from "@dreamboard-games/sdk/reducer-contract";
20
- import {
21
- REFERENCE_GAME_MANIFEST_SCHEMA_VERSION,
22
- parseReferenceGameManifest,
23
- type ReferenceGameManifest,
24
- } from "@dreamboard-games/sdk/reference-games";
25
-
26
- const manifest: ReferenceGameManifest = parseReferenceGameManifest(input);
27
- console.log(REFERENCE_GAME_MANIFEST_SCHEMA_VERSION, manifest.id);
28
- ```
15
+ - `@dreamboard-games/sdk`: framework-free instances, sources, features and canonical host protocol schemas.
16
+ - `@dreamboard-games/sdk/react`: typed React provider, selector hook and subscription component.
17
+ - `@dreamboard-games/sdk/reducer`: game authoring, manifest compilation, execution and trusted worker admission.
18
+ - `@dreamboard-games/sdk/testing`: browser-safe local/scenario sources, replay, inspection and bounded exploration.
29
19
 
30
- Reference-game manifests use schema V5. They describe the game workspace,
31
- teaching purpose, mechanics, UI patterns, and substantive rights metadata.
32
-
33
- Include the packaged stylesheet when using SDK UI components:
34
-
35
- ```ts
36
- import "@dreamboard-games/sdk/ui/plugin-styles.css";
37
- ```
20
+ UI components are source-owned registry items installed into your application.
21
+ The SDK contains no styled components or stylesheet.
38
22
 
39
23
  ## Game authoring
40
24
 
@@ -45,20 +29,27 @@ codes. The returned value is three things at once:
45
29
  - the **type leaf**: `typeof game.types.State`, `.ErrorCode`, `.PlayerId`,
46
30
  `.Queries`, `.Tx` (phantom carriers; reading them at runtime throws),
47
31
  - the **factory namespace**: `game.phase(name)`, `phase.define`,
48
- `phase.interaction`, `phase.inputs.*`, `game.views.*`,
49
- - the **assembler**: `game.assemble({ initial, initialPhase, phases, views })`.
32
+ `phase.interaction`, `phase.inputs.*`, `game.view`,
33
+ - the **assembler**: `game.assemble({ initial, initialPhase, phases, view })`.
50
34
 
51
35
  Mutation callbacks (`enter`, `reduce`, `resolve`) receive an open transaction
52
36
  `tx`. Mutate through it and finish with a bare `return` (accept), or with
53
37
  `tx.transition(name)`, `tx.endGame(outcome)`, or `tx.reject(code)`. Events go
54
38
  through `tx.emit(...)`. `state` is the read-only snapshot the callback started
55
- from; `tx.state` is the current draft.
39
+ from; `tx.state` is the current draft. The transaction clones its table once;
40
+ all card, component, resource, and state-slice updates use that draft. Use
41
+ `tx.q` when a query must observe an earlier mutation in the same callback.
42
+ State patch callbacks return a replacement slice without mutating their input.
43
+ The former `ops`, `pipe`, flat `setActivePlayers`, and `tx.apply` APIs are removed;
44
+ call the named transaction methods directly.
56
45
 
57
46
  ```ts
58
47
  // app/game-model.ts — the model, bound once
59
48
  import { z } from "zod";
60
- import { createGame } from "@dreamboard-games/sdk/reducer";
61
- import { ids, manifestContract } from "../shared/manifest-contract";
49
+ import { compileManifest, createGame } from "@dreamboard-games/sdk/reducer";
50
+ import manifest from "../manifest";
51
+ const manifestContract = compileManifest(manifest);
52
+ const { ids } = manifestContract;
62
53
 
63
54
  export const game = createGame({
64
55
  manifest: manifestContract,
@@ -112,8 +103,11 @@ export default play.define({
112
103
  });
113
104
  tx.patchPhaseState({ leadCardId: input.params.cardId });
114
105
  const next = q.player.nextInOrder(input.playerId);
115
- if (next) tx.setActivePlayers([next]);
116
- if (q.zone.playerCards(input.playerId, "hand").length === 0) {
106
+ if (next) {
107
+ tx.patchPublicState({ currentPlayerId: next });
108
+ tx.setActivePlayers([next]);
109
+ }
110
+ if (tx.q.zone.playerCards(input.playerId, "hand").length === 0) {
117
111
  return tx.transition("setup");
118
112
  }
119
113
  },
@@ -122,6 +116,42 @@ export default play.define({
122
116
  });
123
117
  ```
124
118
 
119
+ Dependent choices use `phase.steps()` instead of `inputs`. Each accepted command
120
+ commits exactly one current value. Factories receive only earlier parsed
121
+ `selected` values; descriptors expose only the current input. The final commit
122
+ runs complete-parameter validation and the reducer once. Use explicit `null`
123
+ for a no-target choice, and `many(...)` for one atomic multi-selection.
124
+
125
+ ```ts
126
+ const choose = play.interaction({
127
+ steps: play
128
+ .steps()
129
+ .input(
130
+ "kind",
131
+ play.inputs.form.choice({
132
+ choices: [{ value: "single", label: "Single" }],
133
+ defaultValue: () => undefined,
134
+ }),
135
+ )
136
+ .input("count", ({ selected }) =>
137
+ play.inputs.form.number({
138
+ min: 1,
139
+ max: selected.kind === "single" ? 1 : 3,
140
+ defaultValue: 1,
141
+ }),
142
+ ),
143
+ reduce({ input }) {
144
+ // input.params contains both kind and count here.
145
+ },
146
+ });
147
+ ```
148
+
149
+ `rules.available` controls action eligibility; `rules.validate` checks a final
150
+ submission. Accepted state changes reconcile pending prefixes, while phase
151
+ entry clears them. A rejected final submission keeps the prior prefix. The
152
+ actor can cancel an unsealed prefix with `interaction.cancel`, using the same
153
+ transport basis and action identity as submission.
154
+
125
155
  ```ts
126
156
  // app/game.ts — assembly
127
157
  import { game } from "./game-model";
@@ -136,16 +166,11 @@ export default game.assemble({
136
166
  },
137
167
  initialPhase: "setup",
138
168
  phases: { setup, play },
139
- views: {
140
- shared: game.views.empty(),
141
- player: game.views.player({
142
- project: ({ state, playerId, q }) => ({
143
- me: playerId,
144
- hand: q.zone.playerCards(playerId, "hand"),
145
- current: state.publicState.currentPlayerId,
146
- }),
147
- }),
148
- },
169
+ view: game.view(({ state, playerId, q }) => ({
170
+ me: playerId,
171
+ hand: q.zone.playerCards(playerId, "hand"),
172
+ current: state.publicState.currentPlayerId,
173
+ })),
149
174
  });
150
175
  ```
151
176
 
@@ -155,17 +180,30 @@ or at `game.phase(name)`. Rules, views, and tests import `GameState` and
155
180
  imports the assembled game, so there is no import cycle.
156
181
 
157
182
  New workspaces keep authored starter code in `app/game.ts` and `ui/App.tsx`.
158
- Run the package-local `pnpm generate` command to refresh framework-owned
159
- manifest and UI contracts; generated files are not authoring surfaces.
183
+ Import the manifest directly. `compileManifest(manifest)` provides inferred ID schemas,
184
+ table schemas, fresh initial tables, and board metadata in memory. `createGame`
185
+ also accepts the authored manifest directly. Bind a typed React hook with
186
+ `createGameHook<Game>()({ features, coverage })` from `@dreamboard-games/sdk/react`,
187
+ and pass a source to its `GameProvider`. The hosted UI imports `Game` only as a type;
188
+ `iframeSource()` supplies authoritative frames and handles commands.
189
+ No authoring generation step or shared workspace files are needed.
160
190
 
161
191
  ## Reducer runner contract
162
192
 
163
193
  `createReducerBundle(game)` returns exactly the contract version and four
164
194
  operations: `boardStatic()`, `initialize(input)`, `dispatch({ state, input })`,
165
- and `project({ state, playerIds })`. The runner contract is `0.5.0`; hosts must
166
- require that exact version. Dispatch includes validation and effect execution. Initialization returns
195
+ and `project({ state, playerIds })`. The runner contract is `0.6.0`; hosts must
196
+ require that exact version. Dispatch includes validation, direct transaction mutations, and phase entry.
197
+ Initialization returns
167
198
  `{ state, terminal?, events? }`, preserving outcomes and events from initial
168
- phase entry and automatic continuations.
199
+ phase entry and returned transitions.
200
+
201
+ Mutation callbacks use `tx.roll(dieId)`, `tx.shuffle({ zoneId, playerId? })`, and
202
+ `tx.deal({ fromZoneId, toZoneId, playerId, count })` directly. Return
203
+ `tx.transition(phaseName)` to enter a phase, including reentering the current
204
+ phase. An unreturned outcome schedules no work. Entry chains are bounded to
205
+ 1,000 entries per dispatch. `tx.endGame(outcome, { transition })` enters the
206
+ final phase once; that entry must not return another transition.
169
207
 
170
208
  The authoritative state is explicit on every dispatch and projection. A host
171
209
  may retain a warm worker and SDK caches, but replaying the same state and input
@@ -177,3 +215,61 @@ owns the monotonically increasing version, perspective, and action-set identity.
177
215
  The plugin frame basis contains `version`, `actionSetVersion`, and
178
216
  `perspectivePlayerId`; it has no generation counter. Hosts merge the separately
179
217
  cached board static projection when materializing plugin gameplay frames.
218
+
219
+ ### Initialization options and actors
220
+
221
+ Declare lobby options once on `createGame({ options: z.strictObject({ ... }), ... })`.
222
+ The bundle accepts JSON-safe `options` at initialization, validates them with that
223
+ schema, persists the parsed values, and supplies them to initial state and phase
224
+ initializers. Without a schema, only `{}` is accepted. Options schemas must be
225
+ JSON-native: transforms, preprocessing, and coercion are rejected. Restored
226
+ sessions validate their stored options with the same schema.
227
+
228
+ Perform shuffle, deal, and other initialization mutations in an ordinary phase
229
+ entry callback. Setup profiles and bootstrap instructions are removed.
230
+ Interactions use `actor` to override their phase actor; only authorized seats
231
+ receive their input domains. Use ordinary form choices for responses and explicit
232
+ rules plus transaction resource mutations for affordability. Prompt collectors,
233
+ implicit costs, guidance metadata, and phase zone declarations are removed.
234
+
235
+ A game authors one `view` for each requested seat. Public and private fields
236
+ compose in that function; the transport never uses a seat view as a spectator
237
+ payload. Static boards come directly from the compiled manifest.
238
+
239
+ Use `memoize((input: SomeImmutableObject) => result)` for shared pure calculations.
240
+ It caches by object identity with a WeakMap, including `undefined` results. Pass
241
+ immutable snapshots (or stable immutable branches), not an open mutable transaction.
242
+ There is no injected derived-value resolver.
243
+
244
+ ## React adapter dependency
245
+
246
+ Framework-free consumers can import the package root without React. Applications
247
+ using `@dreamboard-games/sdk/react` must install the maintained React store adapter
248
+ alongside React:
249
+
250
+ ```sh
251
+ pnpm add @dreamboard-games/sdk react@^19 react-dom@^19 @tanstack/react-store@0.11.1
252
+ ```
253
+
254
+ `@tanstack/react-store` is an optional peer of the SDK so headless consumers do not
255
+ install the React adapter. The `/react` entry delegates selectors to that package;
256
+ the application bundler resolves its supported React subscription dependencies.
257
+
258
+ ## Local development and tests
259
+
260
+ `localSource(game, { players, seed, as, options })` executes the production reducer
261
+ and materializes the selected seat. `scenarioSource` starts from authored scenario
262
+ checkpoints. Keep these executable game imports in your local development entry;
263
+ the hosted entry uses only `iframeSource()` and type imports.
264
+
265
+ Local sources expose `inspect`, bounded `explore`, typed explicit-actor `apply`,
266
+ `switchSeat`, `checkpoint`, and validated `restore`. A JSON checkpoint preserves
267
+ pending selections and terminal state; restoring does not replay commands.
268
+ `createTestSource(snapshot)` supplies controlled frames and acknowledgements for
269
+ instance and React tests. Static and hosted sources do not expose `apply`.
270
+
271
+ Hosts import `assertReducerBundleContract`, `REDUCER_CONTRACT_VERSION`,
272
+ `ReducerWire` types and `ReducerWireZod` schemas from `/reducer`. Canonical iframe
273
+ and gameplay websocket schemas plus `materializePluginGameplayFrame` live at the
274
+ root. Materialize the seat projection with static board data before publishing it;
275
+ sources publish the canonical seat view and keep command bases private.
@@ -0,0 +1,16 @@
1
+ // src/headless/sources/immutable.ts
2
+ function immutableCopy(value) {
3
+ return freeze(structuredClone(value));
4
+ }
5
+ function freeze(value) {
6
+ if (value !== null && typeof value === "object") {
7
+ for (const child of Object.values(value)) freeze(child);
8
+ Object.freeze(value);
9
+ }
10
+ return value;
11
+ }
12
+
13
+ export {
14
+ immutableCopy
15
+ };
16
+ //# sourceMappingURL=chunk-DMFVAZI2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/headless/sources/immutable.ts"],"sourcesContent":["/** Source-owned snapshots and commands cannot be changed by their caller. */\nexport function immutableCopy<T>(value: T): T {\n return freeze(structuredClone(value));\n}\nfunction freeze<T>(value: T): T {\n if (value !== null && typeof value === \"object\") {\n for (const child of Object.values(value)) freeze(child);\n Object.freeze(value);\n }\n return value;\n}\n"],"mappings":";AACO,SAAS,cAAiB,OAAa;AAC5C,SAAO,OAAO,gBAAgB,KAAK,CAAC;AACtC;AACA,SAAS,OAAU,OAAa;AAC9B,MAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;AAC/C,eAAW,SAAS,OAAO,OAAO,KAAK,EAAG,QAAO,KAAK;AACtD,WAAO,OAAO,KAAK;AAAA,EACrB;AACA,SAAO;AACT;","names":[]}