@dreamboard-games/sdk 0.4.0-alpha.1 → 0.4.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/REFERENCE.md +1318 -201
- package/dist/{ResourceCounter-BTXklCEZ.d.ts → ResourceCounter-BuiNstXs.d.ts} +5 -1
- package/dist/{ThemeProvider-DvMl17Ny.d.ts → ThemeProvider-B1sIoBlX.d.ts} +1 -1
- package/dist/{attributes-BrZtP9az.d.ts → attributes-DbvyMbXw.d.ts} +17 -2
- package/dist/authoring/index.d.ts +66 -0
- package/dist/authoring/index.js +560 -0
- package/dist/authoring/index.js.map +1 -0
- package/dist/browser-interaction.d.ts +205 -5
- package/dist/browser-interaction.js +14 -2
- package/dist/{chunk-7W6TQO3X.js → chunk-45FI6XII.js} +613 -366
- package/dist/chunk-45FI6XII.js.map +1 -0
- package/dist/{chunk-3K362ZKR.js → chunk-6JQFGSLD.js} +202 -38
- package/dist/chunk-6JQFGSLD.js.map +1 -0
- package/dist/{chunk-IUGKW2GS.js → chunk-BKD7XAWB.js} +6 -2
- package/dist/chunk-BKD7XAWB.js.map +1 -0
- package/dist/{chunk-XXBSIPJX.js → chunk-CP35NPPY.js} +131 -59
- package/dist/chunk-CP35NPPY.js.map +1 -0
- package/dist/chunk-DQ7GCD6C.js +12 -0
- package/dist/chunk-DQ7GCD6C.js.map +1 -0
- package/dist/{chunk-XJYUSD5F.js → chunk-FWVV2X74.js} +2 -2
- package/dist/chunk-K5ZRJTZZ.js +328 -0
- package/dist/chunk-K5ZRJTZZ.js.map +1 -0
- package/dist/{chunk-7LZZEI25.js → chunk-N6ZDIMRB.js} +1 -1
- package/dist/chunk-N6ZDIMRB.js.map +1 -0
- package/dist/chunk-O6M6PN4E.js +1225 -0
- package/dist/chunk-O6M6PN4E.js.map +1 -0
- package/dist/{chunk-AEUXCFGM.js → chunk-PF7L4BMG.js} +1 -8
- package/dist/{chunk-AEUXCFGM.js.map → chunk-PF7L4BMG.js.map} +1 -1
- package/dist/{chunk-CZMFAS3E.js → chunk-WOWFONLZ.js} +517 -1274
- package/dist/chunk-WOWFONLZ.js.map +1 -0
- package/dist/{chunk-MALRKLRR.js → chunk-WUIVY2KE.js} +301 -12
- package/dist/chunk-WUIVY2KE.js.map +1 -0
- package/dist/codegen.d.ts +11 -3
- package/dist/codegen.js +1 -1
- package/dist/{components-Dqr_LuZJ.d.ts → components-BbWPnZCF.d.ts} +37 -6
- package/dist/{hex-board-view-UCUjMALd.d.ts → hex-board-view-Kz9Q_zsv.d.ts} +1 -1
- package/dist/index-BLwlj7mO.d.ts +191 -0
- package/dist/index.js +2 -1
- package/dist/package-set.d.ts +2 -2
- package/dist/package-set.js +2 -1
- package/dist/player-state-Cqpyeql0.d.ts +371 -0
- package/dist/protocol-BP193lva.d.ts +267 -0
- package/dist/reducer/advanced.js +1 -1
- package/dist/reducer-contract.js +1 -1
- package/dist/reducer.js +2 -2
- package/dist/reducer.js.map +1 -1
- package/dist/runtime/primitives.d.ts +10 -10
- package/dist/runtime/primitives.js +9 -7
- package/dist/runtime/runtime-api.d.ts +2 -2
- package/dist/runtime/workspace-contract.d.ts +21 -167
- package/dist/runtime/workspace-contract.js +7 -6
- package/dist/runtime-api-BJharVaj.d.ts +198 -0
- package/dist/runtime-api-C6aWo9c0.d.ts +95 -0
- package/dist/runtime.d.ts +36 -32
- package/dist/runtime.js +87 -797
- package/dist/runtime.js.map +1 -1
- package/dist/testing.d.ts +254 -140
- package/dist/testing.js +964 -149
- package/dist/testing.js.map +1 -1
- package/dist/types-CYeN0wLK.d.ts +29 -0
- package/dist/{types-BqzHkNMA.d.ts → types-DJj5MJkl.d.ts} +32 -5
- package/dist/types.d.ts +13 -8
- package/dist/ui/components.d.ts +4 -5
- package/dist/ui/components.js +19 -1
- package/dist/ui/player-state.d.ts +2 -365
- package/dist/{ui-contract-W2-kxObe.d.ts → ui-contract-CY7cxsCC.d.ts} +16 -26
- package/dist/ui.d.ts +7 -8
- package/dist/ui.js +20 -2
- package/package.json +25 -19
- package/dist/chunk-3K362ZKR.js.map +0 -1
- package/dist/chunk-7LZZEI25.js.map +0 -1
- package/dist/chunk-7W6TQO3X.js.map +0 -1
- package/dist/chunk-CZMFAS3E.js.map +0 -1
- package/dist/chunk-IUGKW2GS.js.map +0 -1
- package/dist/chunk-MALRKLRR.js.map +0 -1
- package/dist/chunk-XXBSIPJX.js.map +0 -1
- package/dist/hex-color-MhOyuY-o.d.ts +0 -8
- package/dist/runtime-api-BXd70c2e.d.ts +0 -490
- /package/dist/{chunk-XJYUSD5F.js.map → chunk-FWVV2X74.js.map} +0 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
type RuntimeJson = null | boolean | number | string | RuntimeJson[] | {
|
|
2
|
+
[key: string]: RuntimeJson;
|
|
3
|
+
};
|
|
4
|
+
type CanonicalJson = null | boolean | number | string | CanonicalJson[] | {
|
|
5
|
+
[key: string]: CanonicalJson;
|
|
6
|
+
};
|
|
7
|
+
declare function canonicalizePluginRuntimeJson(value: unknown): CanonicalJson;
|
|
8
|
+
declare function encodeCanonicalPluginRuntimeJson(value: unknown): string;
|
|
9
|
+
declare function digestPluginRuntimeJson(value: unknown): string;
|
|
10
|
+
|
|
11
|
+
type PlayerId = string;
|
|
12
|
+
interface PluginPlayerSummary {
|
|
13
|
+
readonly playerId: PlayerId;
|
|
14
|
+
readonly displayName: string;
|
|
15
|
+
readonly color?: string;
|
|
16
|
+
}
|
|
17
|
+
interface PluginSessionDescriptor {
|
|
18
|
+
readonly sessionId: string;
|
|
19
|
+
/** Turn order is the order of this array. */
|
|
20
|
+
readonly players: readonly PluginPlayerSummary[];
|
|
21
|
+
}
|
|
22
|
+
interface InteractionCommitPolicy {
|
|
23
|
+
readonly mode: "manual" | "autoWhenReady";
|
|
24
|
+
}
|
|
25
|
+
type InputSelection = {
|
|
26
|
+
readonly mode: "single";
|
|
27
|
+
} | {
|
|
28
|
+
readonly mode: "many";
|
|
29
|
+
readonly min: number;
|
|
30
|
+
readonly max?: number;
|
|
31
|
+
readonly distinct?: boolean;
|
|
32
|
+
};
|
|
33
|
+
interface InputDomainDependencyCase {
|
|
34
|
+
readonly when: Readonly<Record<string, string>>;
|
|
35
|
+
readonly domain: InputDomain;
|
|
36
|
+
}
|
|
37
|
+
type InputDomainDependencies = {
|
|
38
|
+
readonly mode: "eager";
|
|
39
|
+
readonly dependentCases: readonly InputDomainDependencyCase[];
|
|
40
|
+
} | {
|
|
41
|
+
readonly mode: "lazy";
|
|
42
|
+
readonly dependsOn: readonly string[];
|
|
43
|
+
readonly resolver: {
|
|
44
|
+
readonly interactionKey?: string;
|
|
45
|
+
readonly inputKey: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
interface InputDomain {
|
|
49
|
+
readonly type: string;
|
|
50
|
+
readonly selection?: InputSelection;
|
|
51
|
+
readonly dependencies?: InputDomainDependencies;
|
|
52
|
+
readonly [key: string]: RuntimeJson | InputSelection | InputDomainDependencies | undefined;
|
|
53
|
+
}
|
|
54
|
+
interface InteractionChoiceOption {
|
|
55
|
+
readonly value: string | null;
|
|
56
|
+
readonly label: string;
|
|
57
|
+
readonly icon?: string;
|
|
58
|
+
readonly badge?: string;
|
|
59
|
+
readonly description?: string;
|
|
60
|
+
readonly disabled?: boolean;
|
|
61
|
+
readonly disabledReason?: string;
|
|
62
|
+
}
|
|
63
|
+
interface InteractionInputDescriptor {
|
|
64
|
+
readonly key: string;
|
|
65
|
+
readonly kind: string;
|
|
66
|
+
readonly domain: InputDomain;
|
|
67
|
+
readonly defaultValue?: RuntimeJson;
|
|
68
|
+
}
|
|
69
|
+
type InteractionAvailability = {
|
|
70
|
+
readonly status: "available";
|
|
71
|
+
} | {
|
|
72
|
+
readonly status: "notYourTurn";
|
|
73
|
+
readonly reason: string;
|
|
74
|
+
} | {
|
|
75
|
+
readonly status: "insufficientResources";
|
|
76
|
+
readonly reason: string;
|
|
77
|
+
readonly missingResources: Readonly<Record<string, number>>;
|
|
78
|
+
} | {
|
|
79
|
+
readonly status: "blocked";
|
|
80
|
+
readonly reason: string;
|
|
81
|
+
readonly code?: string;
|
|
82
|
+
};
|
|
83
|
+
interface InteractionDiagnosticReason {
|
|
84
|
+
readonly ruleId: string;
|
|
85
|
+
readonly errorCode: string;
|
|
86
|
+
}
|
|
87
|
+
interface InteractionDescriptorBase<Interaction extends string = string> {
|
|
88
|
+
readonly phaseName: string;
|
|
89
|
+
readonly interactionKey: Interaction;
|
|
90
|
+
readonly interactionId: string;
|
|
91
|
+
readonly zoneId?: string;
|
|
92
|
+
readonly zoneIds?: readonly string[];
|
|
93
|
+
readonly commit: InteractionCommitPolicy;
|
|
94
|
+
readonly descriptorDigest?: string;
|
|
95
|
+
readonly actorSeat?: number;
|
|
96
|
+
readonly draftDigest?: string;
|
|
97
|
+
readonly inputs: readonly InteractionInputDescriptor[];
|
|
98
|
+
readonly cost?: Readonly<Record<string, RuntimeJson>>;
|
|
99
|
+
readonly currentResources?: Readonly<Record<string, RuntimeJson>>;
|
|
100
|
+
readonly availability: InteractionAvailability;
|
|
101
|
+
readonly reasons?: readonly InteractionDiagnosticReason[];
|
|
102
|
+
}
|
|
103
|
+
type ActionInteractionDescriptor<Interaction extends string = string> = InteractionDescriptorBase<Interaction> & {
|
|
104
|
+
readonly kind: "action";
|
|
105
|
+
};
|
|
106
|
+
interface InteractionContextOption {
|
|
107
|
+
readonly id: string;
|
|
108
|
+
readonly label?: string;
|
|
109
|
+
}
|
|
110
|
+
interface InteractionContext {
|
|
111
|
+
readonly to: string;
|
|
112
|
+
readonly title?: string;
|
|
113
|
+
readonly payload?: Readonly<Record<string, RuntimeJson>>;
|
|
114
|
+
readonly options?: readonly InteractionContextOption[];
|
|
115
|
+
}
|
|
116
|
+
type PromptInteractionDescriptor<Interaction extends string = string> = InteractionDescriptorBase<Interaction> & {
|
|
117
|
+
readonly kind: "prompt";
|
|
118
|
+
readonly context: InteractionContext;
|
|
119
|
+
};
|
|
120
|
+
type InteractionDescriptor<Interaction extends string = string> = ActionInteractionDescriptor<Interaction> | PromptInteractionDescriptor<Interaction>;
|
|
121
|
+
interface ZoneHandlesSnapshot<Interaction extends string = string> {
|
|
122
|
+
readonly cardIds: readonly string[];
|
|
123
|
+
readonly cardViewsById: Readonly<Record<string, string>>;
|
|
124
|
+
readonly playableByCardId: Readonly<Record<string, readonly InteractionDescriptor<Interaction>[]>>;
|
|
125
|
+
}
|
|
126
|
+
interface SimultaneousPhaseSnapshot {
|
|
127
|
+
readonly phaseName: string;
|
|
128
|
+
readonly interactionId: string;
|
|
129
|
+
readonly actorIds: readonly PlayerId[];
|
|
130
|
+
readonly sealedPlayerIds: readonly PlayerId[];
|
|
131
|
+
readonly pendingPlayerIds: readonly PlayerId[];
|
|
132
|
+
}
|
|
133
|
+
interface PluginGameplayFrame<View = unknown, Phase extends string = string, Stage extends string = string, Interaction extends string = string> {
|
|
134
|
+
readonly gameVersion: number;
|
|
135
|
+
readonly actionSetVersion: string;
|
|
136
|
+
readonly perspectivePlayerId: PlayerId | null;
|
|
137
|
+
readonly view: View | null;
|
|
138
|
+
readonly flow: {
|
|
139
|
+
readonly currentPhase: Phase | null;
|
|
140
|
+
readonly currentStage: Stage | null;
|
|
141
|
+
readonly activePlayers: readonly PlayerId[];
|
|
142
|
+
readonly simultaneousPhase: SimultaneousPhaseSnapshot | null;
|
|
143
|
+
};
|
|
144
|
+
readonly availableInteractions: ReadonlyArray<InteractionDescriptor<Interaction>>;
|
|
145
|
+
readonly zones: Readonly<Record<string, ZoneHandlesSnapshot<Interaction>>>;
|
|
146
|
+
}
|
|
147
|
+
interface ReducerSeatProjectionBundle {
|
|
148
|
+
readonly currentStage?: string | null;
|
|
149
|
+
readonly stageSeats?: readonly string[];
|
|
150
|
+
readonly simultaneousPhase?: SimultaneousPhaseSnapshot | null;
|
|
151
|
+
readonly interactionsByRef?: unknown;
|
|
152
|
+
readonly seats: Readonly<Record<string, {
|
|
153
|
+
readonly view?: unknown;
|
|
154
|
+
readonly availableInteractionRefs?: unknown;
|
|
155
|
+
readonly zones?: unknown;
|
|
156
|
+
}>>;
|
|
157
|
+
}
|
|
158
|
+
interface ReducerBoardStaticProjection {
|
|
159
|
+
readonly view: RuntimeJson;
|
|
160
|
+
readonly hash?: string;
|
|
161
|
+
readonly manifestVersion?: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare const DREAMBOARD_PLUGIN_PROTOCOL: "dreamboard-plugin";
|
|
165
|
+
declare const DREAMBOARD_PLUGIN_PROTOCOL_VERSION: 3;
|
|
166
|
+
interface ValidationResult {
|
|
167
|
+
readonly valid: boolean;
|
|
168
|
+
readonly errorCode?: string;
|
|
169
|
+
readonly message?: string;
|
|
170
|
+
}
|
|
171
|
+
type SubmissionResult = {
|
|
172
|
+
readonly accepted: true;
|
|
173
|
+
} | {
|
|
174
|
+
readonly accepted: false;
|
|
175
|
+
readonly errorCode: string;
|
|
176
|
+
readonly message?: string;
|
|
177
|
+
};
|
|
178
|
+
interface PluginInteractionBasis {
|
|
179
|
+
readonly gameVersion: number;
|
|
180
|
+
readonly actionSetVersion: string;
|
|
181
|
+
readonly perspectivePlayerId: PlayerId | null;
|
|
182
|
+
}
|
|
183
|
+
interface ValidateInteractionCommand {
|
|
184
|
+
readonly type: "interaction.validate";
|
|
185
|
+
readonly requestId: string;
|
|
186
|
+
readonly basis: PluginInteractionBasis;
|
|
187
|
+
readonly interactionId: string;
|
|
188
|
+
readonly params: RuntimeJson;
|
|
189
|
+
}
|
|
190
|
+
interface SubmitInteractionCommand {
|
|
191
|
+
readonly type: "interaction.submit";
|
|
192
|
+
readonly requestId: string;
|
|
193
|
+
readonly basis: PluginInteractionBasis;
|
|
194
|
+
readonly interactionId: string;
|
|
195
|
+
readonly params: RuntimeJson;
|
|
196
|
+
}
|
|
197
|
+
type HostToPluginPayload = {
|
|
198
|
+
readonly type: "runtime.init";
|
|
199
|
+
readonly session: PluginSessionDescriptor;
|
|
200
|
+
} | {
|
|
201
|
+
readonly type: "gameplay.frame";
|
|
202
|
+
readonly frame: PluginGameplayFrame;
|
|
203
|
+
} | {
|
|
204
|
+
readonly type: "interaction.validation-result";
|
|
205
|
+
readonly requestId: string;
|
|
206
|
+
readonly result: ValidationResult;
|
|
207
|
+
} | {
|
|
208
|
+
readonly type: "interaction.submit-result";
|
|
209
|
+
readonly requestId: string;
|
|
210
|
+
readonly result: SubmissionResult;
|
|
211
|
+
};
|
|
212
|
+
type PluginToHostPayload = {
|
|
213
|
+
readonly type: "runtime.ready";
|
|
214
|
+
} | {
|
|
215
|
+
readonly type: "runtime.ack";
|
|
216
|
+
/** Echoes the host envelope sequence. It is delivery order only. */
|
|
217
|
+
readonly sequence: number;
|
|
218
|
+
readonly clientReceivedAtMs?: number;
|
|
219
|
+
readonly clientRenderedAtMs?: number;
|
|
220
|
+
} | ValidateInteractionCommand | SubmitInteractionCommand | {
|
|
221
|
+
readonly type: "runtime.error";
|
|
222
|
+
readonly message: string;
|
|
223
|
+
readonly code?: string;
|
|
224
|
+
};
|
|
225
|
+
interface PluginProtocolEnvelope<Payload> {
|
|
226
|
+
readonly protocol: typeof DREAMBOARD_PLUGIN_PROTOCOL;
|
|
227
|
+
readonly version: typeof DREAMBOARD_PLUGIN_PROTOCOL_VERSION;
|
|
228
|
+
readonly channelId: string;
|
|
229
|
+
/** Delivery order only. It is not a game revision. */
|
|
230
|
+
readonly sequence: number;
|
|
231
|
+
readonly payload: Payload;
|
|
232
|
+
}
|
|
233
|
+
type HostToPluginEnvelope = PluginProtocolEnvelope<HostToPluginPayload>;
|
|
234
|
+
type PluginToHostEnvelope = PluginProtocolEnvelope<PluginToHostPayload>;
|
|
235
|
+
interface PluginProtocolFrame {
|
|
236
|
+
readonly id: string;
|
|
237
|
+
readonly frame: PluginGameplayFrame;
|
|
238
|
+
readonly projectionDigest: string;
|
|
239
|
+
}
|
|
240
|
+
interface PluginProtocolTape {
|
|
241
|
+
readonly session: PluginSessionDescriptor;
|
|
242
|
+
readonly frames: readonly PluginProtocolFrame[];
|
|
243
|
+
readonly steps: readonly PluginProtocolStep[];
|
|
244
|
+
}
|
|
245
|
+
type PluginProtocolStep = {
|
|
246
|
+
readonly id: string;
|
|
247
|
+
readonly kind: "host.frame";
|
|
248
|
+
readonly frameId: string;
|
|
249
|
+
} | {
|
|
250
|
+
readonly id: string;
|
|
251
|
+
readonly kind: "client.validate";
|
|
252
|
+
readonly fromFrameId: string;
|
|
253
|
+
readonly requestDigest: string;
|
|
254
|
+
readonly response: ValidationResult;
|
|
255
|
+
} | {
|
|
256
|
+
readonly id: string;
|
|
257
|
+
readonly kind: "client.submit";
|
|
258
|
+
readonly fromFrameId: string;
|
|
259
|
+
readonly requestDigest: string;
|
|
260
|
+
readonly response: SubmissionResult;
|
|
261
|
+
};
|
|
262
|
+
type ActionSetVersionInput = {
|
|
263
|
+
readonly gameVersion: number;
|
|
264
|
+
readonly availableInteractions: readonly InteractionDescriptor[];
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export { type ActionInteractionDescriptor as A, type RuntimeJson as B, type CanonicalJson as C, DREAMBOARD_PLUGIN_PROTOCOL as D, type SubmissionResult as E, type SubmitInteractionCommand as F, type ValidationResult as G, type HostToPluginEnvelope as H, type InputDomain as I, canonicalizePluginRuntimeJson as J, digestPluginRuntimeJson as K, encodeCanonicalPluginRuntimeJson as L, type PlayerId as P, type ReducerBoardStaticProjection as R, type SimultaneousPhaseSnapshot as S, type ValidateInteractionCommand as V, type ZoneHandlesSnapshot as Z, type ActionSetVersionInput as a, DREAMBOARD_PLUGIN_PROTOCOL_VERSION as b, type HostToPluginPayload as c, type InputDomainDependencies as d, type InputDomainDependencyCase as e, type InputSelection as f, type InteractionAvailability as g, type InteractionChoiceOption as h, type InteractionCommitPolicy as i, type InteractionContext as j, type InteractionContextOption as k, type InteractionDescriptor as l, type InteractionDiagnosticReason as m, type InteractionInputDescriptor as n, type PluginGameplayFrame as o, type PluginInteractionBasis as p, type PluginPlayerSummary as q, type PluginProtocolEnvelope as r, type PluginProtocolFrame as s, type PluginProtocolStep as t, type PluginProtocolTape as u, type PluginSessionDescriptor as v, type PluginToHostEnvelope as w, type PluginToHostPayload as x, type PromptInteractionDescriptor as y, type ReducerSeatProjectionBundle as z };
|
package/dist/reducer/advanced.js
CHANGED
package/dist/reducer-contract.js
CHANGED
package/dist/reducer.js
CHANGED
|
@@ -128,7 +128,7 @@ import {
|
|
|
128
128
|
spendPlayerResourcesInPlace,
|
|
129
129
|
transferPlayerResources,
|
|
130
130
|
transferPlayerResourcesInPlace
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-N6ZDIMRB.js";
|
|
132
132
|
import {
|
|
133
133
|
REDUCER_CONTRACT_VERSION,
|
|
134
134
|
builders_exports,
|
|
@@ -141,7 +141,7 @@ import {
|
|
|
141
141
|
import {
|
|
142
142
|
RuntimeJsonSchema,
|
|
143
143
|
assertJsonWithinLimits
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-PF7L4BMG.js";
|
|
145
145
|
import "./chunk-PZ5AY32C.js";
|
|
146
146
|
|
|
147
147
|
// src/reducer/schema-helpers.ts
|