@dreamboard-games/sdk 0.5.0-alpha.2 → 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.
- package/README.md +136 -45
- package/dist/chunk-DMFVAZI2.js +16 -0
- package/dist/chunk-DMFVAZI2.js.map +1 -0
- package/dist/chunk-FMM5LVJW.js +833 -0
- package/dist/chunk-FMM5LVJW.js.map +1 -0
- package/dist/{chunk-S2JEDVWH.js → chunk-LRILEVKC.js} +6113 -6489
- package/dist/chunk-LRILEVKC.js.map +1 -0
- package/dist/chunk-SP234IY4.js +1363 -0
- package/dist/chunk-SP234IY4.js.map +1 -0
- package/dist/chunk-VUWNJXLJ.js +52 -0
- package/dist/chunk-VUWNJXLJ.js.map +1 -0
- package/dist/chunk-ZPRKWPEP.js +511 -0
- package/dist/chunk-ZPRKWPEP.js.map +1 -0
- package/dist/definition-BaHNPZol.d.ts +4639 -0
- package/dist/diagnostics-B0lgnuZ6.d.ts +65 -0
- package/dist/index.d.ts +3553 -1
- package/dist/index.js +1045 -6
- package/dist/index.js.map +1 -1
- package/dist/model-BHro6yXu.d.ts +288 -0
- package/dist/react.d.ts +32 -0
- package/dist/react.js +80 -0
- package/dist/react.js.map +1 -0
- package/dist/reducer.d.ts +1194 -79
- package/dist/reducer.js +4326 -121
- package/dist/reducer.js.map +1 -1
- package/dist/testing.d.ts +518 -564
- package/dist/testing.js +2448 -915
- package/dist/testing.js.map +1 -1
- package/dist/types-DimqnJBq.d.ts +86 -0
- package/package.json +26 -131
- package/dist/HandView-Bi2lxzQP.d.ts +0 -79
- package/dist/ResourceCounter-BFxJknqp.d.ts +0 -98
- package/dist/ThemeProvider-CElaL2ik.d.ts +0 -99
- package/dist/attributes-DbvyMbXw.d.ts +0 -68
- package/dist/browser-interaction.d.ts +0 -910
- package/dist/browser-interaction.js +0 -119
- package/dist/browser-interaction.js.map +0 -1
- package/dist/chunk-32PFKDV7.js +0 -11705
- package/dist/chunk-32PFKDV7.js.map +0 -1
- package/dist/chunk-3BAD4VC2.js +0 -263
- package/dist/chunk-3BAD4VC2.js.map +0 -1
- package/dist/chunk-3SKDNDPG.js +0 -104
- package/dist/chunk-3SKDNDPG.js.map +0 -1
- package/dist/chunk-5YV2WHJ4.js +0 -25
- package/dist/chunk-5YV2WHJ4.js.map +0 -1
- package/dist/chunk-ANRB4XKA.js +0 -90
- package/dist/chunk-ANRB4XKA.js.map +0 -1
- package/dist/chunk-BI4G3PM2.js +0 -1864
- package/dist/chunk-BI4G3PM2.js.map +0 -1
- package/dist/chunk-EVCLTY4Q.js +0 -935
- package/dist/chunk-EVCLTY4Q.js.map +0 -1
- package/dist/chunk-GDPKTBUR.js +0 -564
- package/dist/chunk-GDPKTBUR.js.map +0 -1
- package/dist/chunk-H6VDGFL5.js +0 -2903
- package/dist/chunk-H6VDGFL5.js.map +0 -1
- package/dist/chunk-LR3ZTWQF.js +0 -5960
- package/dist/chunk-LR3ZTWQF.js.map +0 -1
- package/dist/chunk-PF7L4BMG.js +0 -117
- package/dist/chunk-PF7L4BMG.js.map +0 -1
- package/dist/chunk-PN5O6GG2.js +0 -32
- package/dist/chunk-PN5O6GG2.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/chunk-PZ5AY32C.js.map +0 -1
- package/dist/chunk-S2JEDVWH.js.map +0 -1
- package/dist/chunk-T3ZKNUZ7.js +0 -1
- package/dist/chunk-T3ZKNUZ7.js.map +0 -1
- package/dist/chunk-UGH54WZ2.js +0 -223
- package/dist/chunk-UGH54WZ2.js.map +0 -1
- package/dist/chunk-VCDWP5VL.js +0 -746
- package/dist/chunk-VCDWP5VL.js.map +0 -1
- package/dist/chunk-VDXOF4FW.js +0 -69
- package/dist/chunk-VDXOF4FW.js.map +0 -1
- package/dist/chunk-WHR5UW3F.js +0 -1988
- package/dist/chunk-WHR5UW3F.js.map +0 -1
- package/dist/chunk-Y75CFE77.js +0 -17
- package/dist/chunk-Y75CFE77.js.map +0 -1
- package/dist/chunk-Z7QCREWI.js +0 -3435
- package/dist/chunk-Z7QCREWI.js.map +0 -1
- package/dist/chunk-ZZGN2ATS.js +0 -1941
- package/dist/chunk-ZZGN2ATS.js.map +0 -1
- package/dist/components-gAbIz7hK.d.ts +0 -1284
- package/dist/definitions-BgmV_GhC.d.ts +0 -300
- package/dist/diagnostics-DIi3ina7.d.ts +0 -50
- package/dist/digest.d.ts +0 -8
- package/dist/game-CsZScpcn.d.ts +0 -763
- package/dist/hex-board-view-aKkblDp6.d.ts +0 -1228
- package/dist/index-CcT9Q7N7.d.ts +0 -193
- package/dist/index.d-DjzoK7zn.d.ts +0 -2101
- package/dist/package-set.d.ts +0 -13
- package/dist/package-set.js +0 -12
- package/dist/package-set.js.map +0 -1
- package/dist/player-state-Cqpyeql0.d.ts +0 -371
- package/dist/plugin-runtime-contract.d.ts +0 -17
- package/dist/plugin-runtime-contract.js +0 -92
- package/dist/plugin-runtime-contract.js.map +0 -1
- package/dist/primitive-props-BNHDkgd7.d.ts +0 -16
- package/dist/protocol-dYgafTYY.d.ts +0 -314
- package/dist/reducer/advanced.d.ts +0 -82
- package/dist/reducer/advanced.js +0 -51
- package/dist/reducer/advanced.js.map +0 -1
- package/dist/reducer-contract.d.ts +0 -11
- package/dist/reducer-contract.js +0 -16
- package/dist/reducer-contract.js.map +0 -1
- package/dist/reference-games/index.d.ts +0 -31
- package/dist/reference-games/index.js +0 -48
- package/dist/reference-games/index.js.map +0 -1
- package/dist/runtime/primitives.d.ts +0 -250
- package/dist/runtime/primitives.js +0 -189
- package/dist/runtime/primitives.js.map +0 -1
- package/dist/runtime/runtime-api.d.ts +0 -2
- package/dist/runtime/runtime-api.js +0 -1
- package/dist/runtime/runtime-api.js.map +0 -1
- package/dist/runtime/workspace-contract.d.ts +0 -392
- package/dist/runtime/workspace-contract.js +0 -28
- package/dist/runtime/workspace-contract.js.map +0 -1
- package/dist/runtime-RJ5orDJU.d.ts +0 -1699
- package/dist/runtime-api-Bz5pwNU_.d.ts +0 -296
- package/dist/runtime-json-CQ9QbLZ5.d.ts +0 -5
- package/dist/runtime.d.ts +0 -83
- package/dist/runtime.js +0 -242
- package/dist/runtime.js.map +0 -1
- package/dist/schema.d.ts +0 -379
- package/dist/stale-contract-artifact-error-XLaweZtF.d.ts +0 -18
- package/dist/testing-compiler.d.ts +0 -37
- package/dist/testing-compiler.js +0 -272
- package/dist/testing-compiler.js.map +0 -1
- package/dist/testing-runtime.d.ts +0 -119
- package/dist/testing-runtime.js +0 -212
- package/dist/testing-runtime.js.map +0 -1
- package/dist/types-DJj5MJkl.d.ts +0 -256
- package/dist/types-DR7DoB1x.d.ts +0 -28
- package/dist/types-JWCYHmu7.d.ts +0 -122
- package/dist/types.d.ts +0 -1958
- package/dist/types.js +0 -14
- package/dist/types.js.map +0 -1
- package/dist/ui/components.d.ts +0 -17
- package/dist/ui/components.js +0 -216
- package/dist/ui/components.js.map +0 -1
- package/dist/ui/defaults.d.ts +0 -19
- package/dist/ui/defaults.js +0 -104
- package/dist/ui/defaults.js.map +0 -1
- package/dist/ui/player-state.d.ts +0 -2
- package/dist/ui/player-state.js +0 -1
- package/dist/ui/player-state.js.map +0 -1
- package/dist/ui/plugin-styles.css +0 -2
- package/dist/ui-contract-GTUPkf8z.d.ts +0 -1168
- package/dist/ui.d.ts +0 -317
- package/dist/ui.js +0 -277
- package/dist/ui.js.map +0 -1
- package/dist/views-BpuWcOyN.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
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
31
|
-
|
|
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,14 +29,19 @@ 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.
|
|
49
|
-
- the **assembler**: `game.assemble({ initial, initialPhase, phases,
|
|
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
|
|
@@ -114,8 +103,11 @@ export default play.define({
|
|
|
114
103
|
});
|
|
115
104
|
tx.patchPhaseState({ leadCardId: input.params.cardId });
|
|
116
105
|
const next = q.player.nextInOrder(input.playerId);
|
|
117
|
-
if (next)
|
|
118
|
-
|
|
106
|
+
if (next) {
|
|
107
|
+
tx.patchPublicState({ currentPlayerId: next });
|
|
108
|
+
tx.setActivePlayers([next]);
|
|
109
|
+
}
|
|
110
|
+
if (tx.q.zone.playerCards(input.playerId, "hand").length === 0) {
|
|
119
111
|
return tx.transition("setup");
|
|
120
112
|
}
|
|
121
113
|
},
|
|
@@ -124,6 +116,42 @@ export default play.define({
|
|
|
124
116
|
});
|
|
125
117
|
```
|
|
126
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
|
+
|
|
127
155
|
```ts
|
|
128
156
|
// app/game.ts — assembly
|
|
129
157
|
import { game } from "./game-model";
|
|
@@ -138,16 +166,11 @@ export default game.assemble({
|
|
|
138
166
|
},
|
|
139
167
|
initialPhase: "setup",
|
|
140
168
|
phases: { setup, play },
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
hand: q.zone.playerCards(playerId, "hand"),
|
|
147
|
-
current: state.publicState.currentPlayerId,
|
|
148
|
-
}),
|
|
149
|
-
}),
|
|
150
|
-
},
|
|
169
|
+
view: game.view(({ state, playerId, q }) => ({
|
|
170
|
+
me: playerId,
|
|
171
|
+
hand: q.zone.playerCards(playerId, "hand"),
|
|
172
|
+
current: state.publicState.currentPlayerId,
|
|
173
|
+
})),
|
|
151
174
|
});
|
|
152
175
|
```
|
|
153
176
|
|
|
@@ -159,18 +182,28 @@ imports the assembled game, so there is no import cycle.
|
|
|
159
182
|
New workspaces keep authored starter code in `app/game.ts` and `ui/App.tsx`.
|
|
160
183
|
Import the manifest directly. `compileManifest(manifest)` provides inferred ID schemas,
|
|
161
184
|
table schemas, fresh initial tables, and board metadata in memory. `createGame`
|
|
162
|
-
also accepts the authored manifest directly. Bind
|
|
163
|
-
`
|
|
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.
|
|
164
189
|
No authoring generation step or shared workspace files are needed.
|
|
165
190
|
|
|
166
191
|
## Reducer runner contract
|
|
167
192
|
|
|
168
193
|
`createReducerBundle(game)` returns exactly the contract version and four
|
|
169
194
|
operations: `boardStatic()`, `initialize(input)`, `dispatch({ state, input })`,
|
|
170
|
-
and `project({ state, playerIds })`. The runner contract is `0.
|
|
171
|
-
require that exact version. Dispatch includes validation and
|
|
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
|
|
172
198
|
`{ state, terminal?, events? }`, preserving outcomes and events from initial
|
|
173
|
-
phase entry and
|
|
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.
|
|
174
207
|
|
|
175
208
|
The authoritative state is explicit on every dispatch and projection. A host
|
|
176
209
|
may retain a warm worker and SDK caches, but replaying the same state and input
|
|
@@ -182,3 +215,61 @@ owns the monotonically increasing version, perspective, and action-set identity.
|
|
|
182
215
|
The plugin frame basis contains `version`, `actionSetVersion`, and
|
|
183
216
|
`perspectivePlayerId`; it has no generation counter. Hosts merge the separately
|
|
184
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":[]}
|