@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/dist/game-CsZScpcn.d.ts
DELETED
|
@@ -1,763 +0,0 @@
|
|
|
1
|
-
import { aT as ReducerManifestContractLike, bW as RuntimeTableRecord, cD as StateDefinition, c2 as SchemaLike, ab as ManifestContractOf, N as ErrorCodeOfContract, ae as ManifestIdSchema, aS as ReducerManifestContract, aF as PlayerIdOfState, cL as TableQueriesOfState, aa as ManifestContract, cJ as TableOfState, cU as TiledVertexIdOfTable, cI as TableOfManifest, cM as TiledBoardIdOfTable, cO as TiledEdgeIdOfTable, cS as TiledSpaceIdOfTable, n as CardIdOfManifest, O as ExactManifestContractOf, au as PhaseNameOfContract, aH as PlayerZoneIdOfManifest, ck as SetupSelectionOfManifest, ay as PhaseSchemasOfContract, bt as RuntimeHexBoardState, bE as RuntimeRecord, bB as RuntimePayload, aD as PlayerId, bR as RuntimeSquareBoardState, bq as RuntimeGenericBoardState, bj as RuntimeBoardState, ao as PerPlayer, bk as RuntimeCardData, bD as RuntimePieceData, bp as RuntimeDieData } from './runtime-RJ5orDJU.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { j as BaseGameStateOfContract, aG as ReducerGameContract, Z as InputCollector, y as CollectorState, K as DerivedResolver, f as AnyInteractionSpec, d as AnyCardActionSpec, aZ as SharedViewDefinition, aB as PlayerViewDefinition, W as EmptyViewDefinition, b7 as StaticViewDefinition, aN as ReducerTransaction, au as PhaseMapOf, bc as ViewMapOf, aI as ReducerGameDefinition, af as InteractionSpec, aY as ScopedPhaseState, p as CardActionSpec, ad as InteractionRule, R as EffectMap, aa as InteractionMap, b4 as StageMap, ay as PhaseZoneList, C as CardActionMap, aq as PhaseDefinition } from './views-BpuWcOyN.js';
|
|
4
|
-
import { GameTopologyManifest, ObjectSchema, PropertySchema } from './types.js';
|
|
5
|
-
|
|
6
|
-
type AnyReducerGameContract = {
|
|
7
|
-
manifest: ReducerManifestContractLike<RuntimeTableRecord>;
|
|
8
|
-
state: StateDefinition<SchemaLike<object>, SchemaLike<object>, SchemaLike<object>>;
|
|
9
|
-
};
|
|
10
|
-
type PhaseStateInput = SchemaLike<object> | object;
|
|
11
|
-
type InferPhaseState<Input extends PhaseStateInput> = Input extends SchemaLike<infer Output> ? Output extends object ? Output : object : Input extends object ? Input : object;
|
|
12
|
-
type ContractState<Contract extends AnyReducerGameContract> = BaseGameStateOfContract<Contract>;
|
|
13
|
-
type ContractManifest<Contract extends AnyReducerGameContract> = ManifestContractOf<Contract>;
|
|
14
|
-
type ContractErrorCode<Contract extends AnyReducerGameContract> = ErrorCodeOfContract<Contract>;
|
|
15
|
-
|
|
16
|
-
type ManifestIdSchemasOf<Ids extends Record<string, SchemaLike<unknown>>> = {
|
|
17
|
-
readonly [Key in keyof Ids]: Ids[Key] extends SchemaLike<infer Output> ? Ids[Key] & ManifestIdSchema<Output> : Ids[Key];
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Narrows a manifest's `literals.phaseNames` and `ids.phaseName` to the
|
|
22
|
-
* author-supplied phase-name tuple. Lets `defineGameContract` override the
|
|
23
|
-
* codegen-emitted `phaseNames: readonly string[]` / `phaseName: z.string()`
|
|
24
|
-
* placeholders so `PhaseNameOfContract<Contract>` resolves to a literal
|
|
25
|
-
* union and flows through `fx.transition`, `PhaseMapOf`, and the flow
|
|
26
|
-
* state's `currentPhase`.
|
|
27
|
-
*/
|
|
28
|
-
type NarrowManifestPhaseNames<Manifest, PhaseNames extends readonly string[]> = Manifest & {
|
|
29
|
-
literals: Manifest extends {
|
|
30
|
-
literals: infer L;
|
|
31
|
-
} ? Omit<L, "phaseNames"> & {
|
|
32
|
-
phaseNames: PhaseNames;
|
|
33
|
-
} : {
|
|
34
|
-
phaseNames: PhaseNames;
|
|
35
|
-
};
|
|
36
|
-
ids: Manifest extends {
|
|
37
|
-
ids: infer I;
|
|
38
|
-
} ? Omit<I, "phaseName"> & {
|
|
39
|
-
phaseName: z.ZodType<PhaseNames[number]>;
|
|
40
|
-
} : {
|
|
41
|
-
phaseName: z.ZodType<PhaseNames[number]>;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
type ReducerGameContractInput<Table extends RuntimeTableRecord, Manifest extends ReducerManifestContract<Table, string, string, string, string, string>, PublicSchema extends SchemaLike<object>, PrivateSchema extends SchemaLike<object>, HiddenSchema extends SchemaLike<object>, Phases extends Record<string, SchemaLike<object>>, Errors extends Record<string, string> | undefined = undefined> = {
|
|
45
|
-
manifest: Manifest;
|
|
46
|
-
state: StateDefinition<PublicSchema, PrivateSchema, HiddenSchema>;
|
|
47
|
-
phases: Phases;
|
|
48
|
-
errors?: Errors;
|
|
49
|
-
};
|
|
50
|
-
type DefinedGameContract<Table extends RuntimeTableRecord, Manifest extends ReducerManifestContract<Table, string, string, string, string, string>, PublicSchema extends SchemaLike<object>, PrivateSchema extends SchemaLike<object>, HiddenSchema extends SchemaLike<object>, Phases extends Record<string, SchemaLike<object>>, Errors extends Record<string, string> | undefined = undefined> = ReducerGameContract<Table, NarrowManifestPhaseNames<Manifest, readonly (keyof Phases & string)[]>, PublicSchema, PrivateSchema, HiddenSchema, Phases, Errors> & {
|
|
51
|
-
readonly phases: Phases;
|
|
52
|
-
readonly errors: Errors;
|
|
53
|
-
readonly phaseNames: readonly (keyof Phases & string)[];
|
|
54
|
-
readonly schemas: ManifestIdSchemasOf<NarrowManifestPhaseNames<Manifest, readonly (keyof Phases & string)[]>["ids"]>;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
type InputFieldRef<Key extends string = string, Value = unknown, Collector extends InputCollector = InputCollector> = {
|
|
58
|
-
readonly key: Key;
|
|
59
|
-
readonly collector: Collector;
|
|
60
|
-
readonly __value?: Value;
|
|
61
|
-
};
|
|
62
|
-
type RefValue<Ref> = Ref extends InputFieldRef<string, infer Value, InputCollector> ? Value : never;
|
|
63
|
-
type CollectorOfRef<Ref> = Ref extends InputFieldRef<string, unknown, infer Collector> ? Collector : never;
|
|
64
|
-
type CollectorValue<Collector> = Collector extends InputCollector<infer Schema> ? z.infer<Schema> : never;
|
|
65
|
-
type DependencyValues<Dependencies extends readonly InputFieldRef<string, unknown, InputCollector>[]> = {
|
|
66
|
-
readonly [Ref in Dependencies[number] as Ref["key"]]: RefValue<Ref>;
|
|
67
|
-
};
|
|
68
|
-
type DefinedInputRefs = Record<string, InputFieldRef<string, unknown, InputCollector>>;
|
|
69
|
-
type DefinedInputs<Refs extends DefinedInputRefs> = {
|
|
70
|
-
readonly [Key in keyof Refs]: CollectorOfRef<Refs[Key]>;
|
|
71
|
-
};
|
|
72
|
-
declare class InputBuilder {
|
|
73
|
-
add<const Key extends string, Collector extends InputCollector<SchemaLike<unknown>>>(key: Key, collector: Collector): InputFieldRef<Key, CollectorValue<Collector>, Collector>;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Define an interaction's inputs with typed field references. Field refs can be
|
|
77
|
-
* passed to dependent input domains, and the returned collector map preserves
|
|
78
|
-
* the original key/value types for interaction params.
|
|
79
|
-
*/
|
|
80
|
-
declare function defineInputs<const Refs extends DefinedInputRefs>(define: (input: InputBuilder) => Refs): DefinedInputs<Refs>;
|
|
81
|
-
|
|
82
|
-
type DomainContext<State extends CollectorState, Values extends Readonly<Record<string, unknown>> = Record<string, never>> = {
|
|
83
|
-
state: State;
|
|
84
|
-
playerId: PlayerIdOfState<State>;
|
|
85
|
-
q: TableQueriesOfState<State>;
|
|
86
|
-
derived: DerivedResolver;
|
|
87
|
-
values: Values;
|
|
88
|
-
};
|
|
89
|
-
type ManifestFormInputSchema = ManifestIdSchema<unknown> | z.ZodOptional<ManifestIdSchema<unknown>> | z.ZodNullable<ManifestIdSchema<unknown>>;
|
|
90
|
-
type DomainNumber<State extends CollectorState> = number | ((context: DomainContext<State>) => number);
|
|
91
|
-
type ResourceMapInputOptions<State extends CollectorState> = {
|
|
92
|
-
resources: ReadonlyArray<{
|
|
93
|
-
resourceId: string;
|
|
94
|
-
label?: string;
|
|
95
|
-
icon?: string;
|
|
96
|
-
min?: DomainNumber<State>;
|
|
97
|
-
max: DomainNumber<State>;
|
|
98
|
-
}>;
|
|
99
|
-
};
|
|
100
|
-
type ChoiceValue = string | null;
|
|
101
|
-
type DomainChoice<Value extends ChoiceValue> = {
|
|
102
|
-
value: Value;
|
|
103
|
-
label: string;
|
|
104
|
-
icon?: string;
|
|
105
|
-
badge?: string;
|
|
106
|
-
description?: string;
|
|
107
|
-
disabled?: boolean;
|
|
108
|
-
disabledReason?: string;
|
|
109
|
-
};
|
|
110
|
-
type DomainChoicePresentation = {
|
|
111
|
-
badge?: string;
|
|
112
|
-
description?: string;
|
|
113
|
-
disabled?: boolean;
|
|
114
|
-
disabledReason?: string;
|
|
115
|
-
};
|
|
116
|
-
type ResourceMapChoiceDecorator<State extends CollectorState> = (context: DomainContext<State> & {
|
|
117
|
-
resourceId: string;
|
|
118
|
-
label: string;
|
|
119
|
-
icon?: string;
|
|
120
|
-
}) => DomainChoicePresentation | null | undefined;
|
|
121
|
-
type ResourceMapChoiceSource<State extends CollectorState> = "resourceMap" | {
|
|
122
|
-
source: "resourceMap";
|
|
123
|
-
decorate?: ResourceMapChoiceDecorator<State>;
|
|
124
|
-
};
|
|
125
|
-
type DomainChoices<Value extends ChoiceValue, State extends CollectorState> = ReadonlyArray<DomainChoice<Value>> | ResourceMapChoiceSource<State> | ((context: DomainContext<State>) => ReadonlyArray<DomainChoice<Value>>);
|
|
126
|
-
type DependentDomainChoices<Value extends ChoiceValue, State extends CollectorState, Dependencies extends readonly InputFieldRef<string, unknown>[]> = ReadonlyArray<DomainChoice<Value>> | ((context: DomainContext<State, DependencyValues<Dependencies>>) => ReadonlyArray<DomainChoice<Value>>);
|
|
127
|
-
type ChoiceListDefaultValue<Value extends string, State extends CollectorState> = Value[] | "all" | ((context: DomainContext<State> & {
|
|
128
|
-
choices: ReadonlyArray<DomainChoice<Value>>;
|
|
129
|
-
}) => Value[]);
|
|
130
|
-
type ChoiceDefaultResolver<Value extends ChoiceValue, State extends CollectorState, Values extends Readonly<Record<string, unknown>> = Record<string, never>> = (context: DomainContext<State, Values> & {
|
|
131
|
-
choices: ReadonlyArray<DomainChoice<Value>>;
|
|
132
|
-
}) => Value | undefined;
|
|
133
|
-
declare function baseFormInput<Schema extends ManifestFormInputSchema & SchemaLike<unknown>, State extends CollectorState = CollectorState>(schema: Schema): InputCollector<Schema, State, "form">;
|
|
134
|
-
declare function baseFormInput<Schema extends ManifestFormInputSchema & SchemaLike<unknown>, State extends CollectorState = CollectorState>(schema: Schema, options: {
|
|
135
|
-
defaultValue: z.infer<Schema>;
|
|
136
|
-
}): InputCollector<Schema, State, "form"> & {
|
|
137
|
-
readonly defaultValue: z.infer<Schema>;
|
|
138
|
-
};
|
|
139
|
-
declare function resourceMapInput<State extends CollectorState = CollectorState>(options: ResourceMapInputOptions<State>): InputCollector<z.ZodRecord<z.ZodString, z.ZodNumber>, State, "form">;
|
|
140
|
-
declare function resourceMapInput<State extends CollectorState = CollectorState>(options: ResourceMapInputOptions<State> & {
|
|
141
|
-
defaultValue: Record<string, number>;
|
|
142
|
-
}): InputCollector<z.ZodRecord<z.ZodString, z.ZodNumber>, State, "form"> & {
|
|
143
|
-
readonly defaultValue: Record<string, number>;
|
|
144
|
-
};
|
|
145
|
-
declare function numberInput<State extends CollectorState = CollectorState>(options: {
|
|
146
|
-
min: DomainNumber<State>;
|
|
147
|
-
max: DomainNumber<State>;
|
|
148
|
-
step?: DomainNumber<State>;
|
|
149
|
-
}): InputCollector<z.ZodNumber, State, "form">;
|
|
150
|
-
declare function numberInput<State extends CollectorState = CollectorState>(options: {
|
|
151
|
-
min: DomainNumber<State>;
|
|
152
|
-
max: DomainNumber<State>;
|
|
153
|
-
step?: DomainNumber<State>;
|
|
154
|
-
defaultValue: number;
|
|
155
|
-
}): InputCollector<z.ZodNumber, State, "form"> & {
|
|
156
|
-
readonly defaultValue: number;
|
|
157
|
-
};
|
|
158
|
-
declare function choiceInput<const Dependencies extends readonly InputFieldRef<string, unknown>[], Value extends ChoiceValue = string, State extends CollectorState = CollectorState>(options: {
|
|
159
|
-
dependsOn: Dependencies;
|
|
160
|
-
choices: DependentDomainChoices<Value, State, Dependencies>;
|
|
161
|
-
defaultValue: Value;
|
|
162
|
-
}): InputCollector<SchemaLike<Value>, State, "form"> & {
|
|
163
|
-
readonly defaultValue: Value;
|
|
164
|
-
};
|
|
165
|
-
declare function choiceInput<const Dependencies extends readonly InputFieldRef<string, unknown>[], Value extends ChoiceValue = string, State extends CollectorState = CollectorState>(options: {
|
|
166
|
-
dependsOn: Dependencies;
|
|
167
|
-
choices: DependentDomainChoices<Value, State, Dependencies>;
|
|
168
|
-
defaultValue: ChoiceDefaultResolver<Value, State, DependencyValues<Dependencies>>;
|
|
169
|
-
}): InputCollector<SchemaLike<Value>, State, "form">;
|
|
170
|
-
declare function choiceInput<Value extends ChoiceValue, State extends CollectorState = CollectorState>(options: {
|
|
171
|
-
choices: DomainChoices<Value, State>;
|
|
172
|
-
defaultValue: Value;
|
|
173
|
-
}): InputCollector<SchemaLike<Value>, State, "form"> & {
|
|
174
|
-
readonly defaultValue: Value;
|
|
175
|
-
};
|
|
176
|
-
declare function choiceInput<Value extends ChoiceValue, State extends CollectorState = CollectorState>(options: {
|
|
177
|
-
choices: DomainChoices<Value, State>;
|
|
178
|
-
defaultValue: ChoiceDefaultResolver<Value, State>;
|
|
179
|
-
}): InputCollector<SchemaLike<Value>, State, "form">;
|
|
180
|
-
declare function choiceInput<Value extends ChoiceValue, State extends CollectorState = CollectorState, const Dependencies extends readonly InputFieldRef<string, unknown>[] = readonly InputFieldRef<string, unknown>[]>(options: {
|
|
181
|
-
dependsOn: Dependencies;
|
|
182
|
-
choices: DependentDomainChoices<Value, State, Dependencies>;
|
|
183
|
-
defaultValue: Value;
|
|
184
|
-
}): InputCollector<SchemaLike<Value>, State, "form"> & {
|
|
185
|
-
readonly defaultValue: Value;
|
|
186
|
-
};
|
|
187
|
-
declare function choiceInput<Value extends ChoiceValue, State extends CollectorState = CollectorState, const Dependencies extends readonly InputFieldRef<string, unknown>[] = readonly InputFieldRef<string, unknown>[]>(options: {
|
|
188
|
-
dependsOn: Dependencies;
|
|
189
|
-
choices: DependentDomainChoices<Value, State, Dependencies>;
|
|
190
|
-
defaultValue: ChoiceDefaultResolver<Value, State, DependencyValues<Dependencies>>;
|
|
191
|
-
}): InputCollector<SchemaLike<Value>, State, "form">;
|
|
192
|
-
declare function choiceListInput<Value extends string, State extends CollectorState = CollectorState>(options: {
|
|
193
|
-
choices: DomainChoices<Value, State>;
|
|
194
|
-
min?: DomainNumber<State>;
|
|
195
|
-
max?: DomainNumber<State>;
|
|
196
|
-
defaultValue: Value[];
|
|
197
|
-
}): InputCollector<SchemaLike<Value[]>, State, "form"> & {
|
|
198
|
-
readonly defaultValue: Value[];
|
|
199
|
-
};
|
|
200
|
-
declare function choiceListInput<Value extends string, State extends CollectorState = CollectorState>(options: {
|
|
201
|
-
choices: DomainChoices<Value, State>;
|
|
202
|
-
min?: DomainNumber<State>;
|
|
203
|
-
max?: DomainNumber<State>;
|
|
204
|
-
defaultValue?: ChoiceListDefaultValue<Value, State>;
|
|
205
|
-
}): InputCollector<SchemaLike<Value[]>, State, "form">;
|
|
206
|
-
type FormInputForState<State extends CollectorState> = {
|
|
207
|
-
<Schema extends ManifestFormInputSchema & SchemaLike<unknown>>(schema: Schema): InputCollector<Schema, State, "form">;
|
|
208
|
-
<Schema extends ManifestFormInputSchema & SchemaLike<unknown>>(schema: Schema, options: {
|
|
209
|
-
defaultValue: z.infer<Schema>;
|
|
210
|
-
}): InputCollector<Schema, State, "form"> & {
|
|
211
|
-
readonly defaultValue: z.infer<Schema>;
|
|
212
|
-
};
|
|
213
|
-
resourceMap(options: ResourceMapInputOptions<State>): InputCollector<z.ZodRecord<z.ZodString, z.ZodNumber>, State, "form">;
|
|
214
|
-
resourceMap(options: ResourceMapInputOptions<State> & {
|
|
215
|
-
defaultValue: Record<string, number>;
|
|
216
|
-
}): InputCollector<z.ZodRecord<z.ZodString, z.ZodNumber>, State, "form"> & {
|
|
217
|
-
readonly defaultValue: Record<string, number>;
|
|
218
|
-
};
|
|
219
|
-
resourceChoices(options?: {
|
|
220
|
-
decorate?: ResourceMapChoiceDecorator<State>;
|
|
221
|
-
}): ResourceMapChoiceSource<State>;
|
|
222
|
-
number(options: Parameters<typeof numberInput<State>>[0]): ReturnType<typeof numberInput<State>>;
|
|
223
|
-
choice<Value extends ChoiceValue, const Dependencies extends readonly InputFieldRef<string, unknown>[]>(options: {
|
|
224
|
-
dependsOn: Dependencies;
|
|
225
|
-
choices: DependentDomainChoices<Value, State, Dependencies>;
|
|
226
|
-
defaultValue: Value;
|
|
227
|
-
}): InputCollector<SchemaLike<Value>, State, "form"> & {
|
|
228
|
-
readonly defaultValue: Value;
|
|
229
|
-
};
|
|
230
|
-
choice<Value extends ChoiceValue, const Dependencies extends readonly InputFieldRef<string, unknown>[]>(options: {
|
|
231
|
-
dependsOn: Dependencies;
|
|
232
|
-
choices: DependentDomainChoices<Value, State, Dependencies>;
|
|
233
|
-
defaultValue: ChoiceDefaultResolver<Value, State, DependencyValues<Dependencies>>;
|
|
234
|
-
}): InputCollector<SchemaLike<Value>, State, "form">;
|
|
235
|
-
choice<Value extends ChoiceValue>(options: {
|
|
236
|
-
choices: DomainChoices<Value, State>;
|
|
237
|
-
defaultValue: Value;
|
|
238
|
-
}): InputCollector<SchemaLike<Value>, State, "form"> & {
|
|
239
|
-
readonly defaultValue: Value;
|
|
240
|
-
};
|
|
241
|
-
choice<Value extends ChoiceValue>(options: {
|
|
242
|
-
choices: DomainChoices<Value, State>;
|
|
243
|
-
defaultValue: ChoiceDefaultResolver<Value, State>;
|
|
244
|
-
}): InputCollector<SchemaLike<Value>, State, "form">;
|
|
245
|
-
choiceList<Value extends string>(options: {
|
|
246
|
-
choices: DomainChoices<Value, State>;
|
|
247
|
-
min?: DomainNumber<State>;
|
|
248
|
-
max?: DomainNumber<State>;
|
|
249
|
-
defaultValue: Value[];
|
|
250
|
-
}): InputCollector<SchemaLike<Value[]>, State, "form"> & {
|
|
251
|
-
readonly defaultValue: Value[];
|
|
252
|
-
};
|
|
253
|
-
choiceList<Value extends string>(options: {
|
|
254
|
-
choices: DomainChoices<Value, State>;
|
|
255
|
-
min?: DomainNumber<State>;
|
|
256
|
-
max?: DomainNumber<State>;
|
|
257
|
-
defaultValue?: ChoiceListDefaultValue<Value, State>;
|
|
258
|
-
}): InputCollector<SchemaLike<Value[]>, State, "form">;
|
|
259
|
-
};
|
|
260
|
-
declare function formInputForState<State extends CollectorState>(): FormInputForState<State>;
|
|
261
|
-
/**
|
|
262
|
-
* Manifest-backed id input. Free-form Zod schemas are intentionally explicit:
|
|
263
|
-
* if the runtime cannot disclose valid values or numeric bounds through a
|
|
264
|
-
* manifest id or domain helper, use a custom interaction surface with an
|
|
265
|
-
* explicit `paramsSchema` instead of the default form renderer.
|
|
266
|
-
*/
|
|
267
|
-
declare const formInput: typeof baseFormInput & {
|
|
268
|
-
resourceMap: typeof resourceMapInput;
|
|
269
|
-
resourceChoices: <State extends CollectorState = CollectorState>(options?: {
|
|
270
|
-
decorate?: ResourceMapChoiceDecorator<State>;
|
|
271
|
-
}) => ResourceMapChoiceSource<State>;
|
|
272
|
-
number: typeof numberInput;
|
|
273
|
-
choice: typeof choiceInput;
|
|
274
|
-
choiceList: typeof choiceListInput;
|
|
275
|
-
forState: typeof formInputForState;
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
type TargetContext<State extends CollectorState> = {
|
|
279
|
-
state: State;
|
|
280
|
-
playerId: PlayerIdOfState<State>;
|
|
281
|
-
q: TableQueriesOfState<State>;
|
|
282
|
-
values?: Readonly<Record<string, unknown>>;
|
|
283
|
-
};
|
|
284
|
-
type TargetPredicateArgs<State extends CollectorState, Target> = TargetContext<State> & {
|
|
285
|
-
targetId: Target;
|
|
286
|
-
target: Target;
|
|
287
|
-
};
|
|
288
|
-
type TargetPredicate<State extends CollectorState, Target> = {
|
|
289
|
-
id: string;
|
|
290
|
-
errorCode: string;
|
|
291
|
-
message?: string;
|
|
292
|
-
test: (args: TargetPredicateArgs<State, Target>) => boolean;
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
type BoardTargetPredicate<State extends CollectorState, Target> = TargetPredicate<State, Target>;
|
|
296
|
-
type PlayerBoardSpaceTarget<BoardId extends string, SpaceId extends string, PlayerId extends string> = {
|
|
297
|
-
readonly boardId: BoardId;
|
|
298
|
-
readonly playerId: PlayerId;
|
|
299
|
-
readonly spaceId: SpaceId;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
type PlayerSpaceInputSchema<BoardId extends string, SpaceId extends string, PlayerId extends string> = z.ZodObject<{
|
|
303
|
-
boardId: z.ZodLiteral<BoardId>;
|
|
304
|
-
playerId: ManifestIdSchema<PlayerId, "playerId">;
|
|
305
|
-
spaceId: z.ZodType<SpaceId>;
|
|
306
|
-
}>;
|
|
307
|
-
|
|
308
|
-
type ChoiceTargetOption<Id extends string> = {
|
|
309
|
-
id: Id;
|
|
310
|
-
label?: string;
|
|
311
|
-
};
|
|
312
|
-
type ChoiceOptionsFactory<State extends CollectorState, Id extends string> = (state: State, playerId: PlayerIdOfState<State>, q: TableQueriesOfState<State>) => ReadonlyArray<ChoiceTargetOption<Id>>;
|
|
313
|
-
type ChoiceTargetPredicate<State extends CollectorState, Id extends string> = TargetPredicate<State, Id>;
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* `rngInput.*` helpers produce collectors whose value is *sampled by the
|
|
317
|
-
* engine on submit* rather than supplied by the client. The schema pins
|
|
318
|
-
* the exact output shape so `ParamsOf<Collectors>` sees precisely typed
|
|
319
|
-
* results.
|
|
320
|
-
*
|
|
321
|
-
* Determinism:
|
|
322
|
-
* Sampling happens inside `submitInteraction` only, never inside
|
|
323
|
-
* reducer validation. This lets clients check a submission without
|
|
324
|
-
* burning RNG state.
|
|
325
|
-
*/
|
|
326
|
-
type DieRoll = z.ZodObject<{
|
|
327
|
-
values: z.ZodArray<z.ZodNumber>;
|
|
328
|
-
}>;
|
|
329
|
-
type CoinFlip = z.ZodObject<{
|
|
330
|
-
value: z.ZodEnum<{
|
|
331
|
-
heads: "heads";
|
|
332
|
-
tails: "tails";
|
|
333
|
-
}>;
|
|
334
|
-
}>;
|
|
335
|
-
type RngCollector<Schema extends DieRoll | CoinFlip, State extends CollectorState> = InputCollector<Schema, State, "rng">;
|
|
336
|
-
/**
|
|
337
|
-
* Roll `count` d6s. The submitted value is `{ values: number[] }` with
|
|
338
|
-
* `values.length === count` and each face `1..6`.
|
|
339
|
-
*/
|
|
340
|
-
declare function d6<State extends CollectorState = CollectorState>(count?: number): RngCollector<DieRoll, State>;
|
|
341
|
-
/** Flip a coin. The submitted value is `{ value: "heads" | "tails" }`. */
|
|
342
|
-
declare function coin<State extends CollectorState = CollectorState>(): RngCollector<CoinFlip, State>;
|
|
343
|
-
declare const rngInput: {
|
|
344
|
-
d6: typeof d6;
|
|
345
|
-
coin: typeof coin;
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
type StepPhaseState<PhaseStateSchema extends SchemaLike<object>, Steps extends readonly string[]> = z.infer<PhaseStateSchema> & {
|
|
349
|
-
step: Steps[number];
|
|
350
|
-
};
|
|
351
|
-
type StepPhaseInteractionEntry<Step extends string, Interaction> = {
|
|
352
|
-
steps: readonly Step[];
|
|
353
|
-
interaction: Interaction;
|
|
354
|
-
};
|
|
355
|
-
type StepPhaseCardActionEntry<Step extends string, Action> = {
|
|
356
|
-
steps: readonly Step[];
|
|
357
|
-
action: Action;
|
|
358
|
-
};
|
|
359
|
-
type StepPhaseInteractionMap<Step extends string, State extends {
|
|
360
|
-
table: RuntimeTableRecord;
|
|
361
|
-
flow: {
|
|
362
|
-
currentPhase: string;
|
|
363
|
-
};
|
|
364
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = Record<string, StepPhaseInteractionEntry<Step, AnyInteractionSpec<State, Manifest>>>;
|
|
365
|
-
type StepPhaseCardActionMap<Step extends string, State extends {
|
|
366
|
-
table: RuntimeTableRecord;
|
|
367
|
-
flow: {
|
|
368
|
-
currentPhase: string;
|
|
369
|
-
};
|
|
370
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = Record<string, StepPhaseCardActionEntry<Step, AnyCardActionSpec<State, Manifest>>>;
|
|
371
|
-
type UnwrappedStepInteractions<State extends {
|
|
372
|
-
table: RuntimeTableRecord;
|
|
373
|
-
flow: {
|
|
374
|
-
currentPhase: string;
|
|
375
|
-
};
|
|
376
|
-
}, Manifest extends ManifestContract<TableOfState<State>>, Interactions extends Record<string, StepPhaseInteractionEntry<string, AnyInteractionSpec<State, Manifest>>>> = {
|
|
377
|
-
[Key in keyof Interactions]: Interactions[Key]["interaction"];
|
|
378
|
-
};
|
|
379
|
-
type UnwrappedStepCardActions<State extends {
|
|
380
|
-
table: RuntimeTableRecord;
|
|
381
|
-
flow: {
|
|
382
|
-
currentPhase: string;
|
|
383
|
-
};
|
|
384
|
-
}, Manifest extends ManifestContract<TableOfState<State>>, CardActions extends Record<string, StepPhaseCardActionEntry<string, AnyCardActionSpec<State, Manifest>>>> = {
|
|
385
|
-
[Key in keyof CardActions]: CardActions[Key]["action"];
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
type ContractWithPhases = AnyReducerGameContract & {
|
|
389
|
-
readonly phases: Record<string, SchemaLike<object>>;
|
|
390
|
-
};
|
|
391
|
-
type BoundState<Contract extends ContractWithPhases> = ContractState<Contract>;
|
|
392
|
-
type BoundManifest<Contract extends ContractWithPhases> = ContractManifest<Contract>;
|
|
393
|
-
type BoundTable<Contract extends ContractWithPhases> = TableOfManifest<BoundManifest<Contract>>;
|
|
394
|
-
type BoundPhaseState<Contract extends ContractWithPhases, PhaseStateSchema extends SchemaLike<object>> = ScopedPhaseState<BoundState<Contract>, z.infer<PhaseStateSchema>>;
|
|
395
|
-
type BoundFormInputs<Contract extends ContractWithPhases> = ReturnType<typeof formInput.forState<BoundState<Contract>>>;
|
|
396
|
-
/** Board element collector options: the board and the predicates that filter it. */
|
|
397
|
-
type BoundBoardInputOptions<Contract extends ContractWithPhases, Id> = {
|
|
398
|
-
boardId: string;
|
|
399
|
-
where?: BoundWhere<Contract, Id>;
|
|
400
|
-
dependsOn?: readonly InputFieldRef<string, unknown>[];
|
|
401
|
-
};
|
|
402
|
-
type BoundBoardInputs<Contract extends ContractWithPhases> = {
|
|
403
|
-
vertex<Id extends string = TiledVertexIdOfTable<BoundTable<Contract>, TiledBoardIdOfTable<BoundTable<Contract>>>>(options: BoundBoardInputOptions<Contract, Id>): InputCollector<z.ZodType<Id>, BoundState<Contract>, "board-vertex">;
|
|
404
|
-
edge<Id extends string = TiledEdgeIdOfTable<BoundTable<Contract>, TiledBoardIdOfTable<BoundTable<Contract>>>>(options: BoundBoardInputOptions<Contract, Id>): InputCollector<z.ZodType<Id>, BoundState<Contract>, "board-edge">;
|
|
405
|
-
tile<Id extends string = string>(options: BoundBoardInputOptions<Contract, Id>): InputCollector<z.ZodType<Id>, BoundState<Contract>, "board-tile">;
|
|
406
|
-
space<Id extends string = TiledSpaceIdOfTable<BoundTable<Contract>, TiledBoardIdOfTable<BoundTable<Contract>>>>(options: BoundBoardInputOptions<Contract, Id>): InputCollector<z.ZodType<Id>, BoundState<Contract>, "board-space">;
|
|
407
|
-
playerSpace<BoardId extends string = string, SpaceId extends string = string, PlayerId extends string = PlayerIdOfState<BoundState<Contract>>>(options: {
|
|
408
|
-
boardId: BoardId;
|
|
409
|
-
where?: BoundWhere<Contract, PlayerBoardSpaceTarget<BoardId, SpaceId, PlayerId>>;
|
|
410
|
-
dependsOn?: readonly InputFieldRef<string, unknown>[];
|
|
411
|
-
}): InputCollector<PlayerSpaceInputSchema<BoardId, SpaceId, PlayerId>, BoundState<Contract>, "board-space">;
|
|
412
|
-
};
|
|
413
|
-
/**
|
|
414
|
-
* An eligibility predicate whose `errorCode` is checked against the model's
|
|
415
|
-
* declared error codes. The unbound `TargetPredicate` accepts any string.
|
|
416
|
-
*/
|
|
417
|
-
type BoundTargetPredicate<Contract extends ContractWithPhases, Target> = Omit<TargetPredicate<BoundState<Contract>, Target>, "errorCode"> & {
|
|
418
|
-
errorCode: ContractErrorCode<Contract>;
|
|
419
|
-
};
|
|
420
|
-
type BoundWhere<Contract extends ContractWithPhases, Target> = BoundTargetPredicate<Contract, Target> | readonly BoundTargetPredicate<Contract, Target>[];
|
|
421
|
-
type BoundCardCollector<Contract extends ContractWithPhases, Id extends string, ZoneIds extends readonly string[]> = InputCollector<z.ZodType<Id>, BoundState<Contract>, "card"> & {
|
|
422
|
-
readonly meta: {
|
|
423
|
-
readonly zoneId: ZoneIds[number];
|
|
424
|
-
readonly zoneIds: ZoneIds;
|
|
425
|
-
readonly targetKind: "card";
|
|
426
|
-
};
|
|
427
|
-
};
|
|
428
|
-
/**
|
|
429
|
-
* Card collector: the zones to draw candidates from and the predicates that
|
|
430
|
-
* filter them. The target rule is built internally.
|
|
431
|
-
*/
|
|
432
|
-
type BoundCardInput<Contract extends ContractWithPhases> = <Id extends string = CardIdOfManifest<BoundManifest<Contract>>, const ZoneIds extends readonly string[] = readonly string[]>(options: {
|
|
433
|
-
from: ZoneIds;
|
|
434
|
-
where?: BoundWhere<Contract, Id>;
|
|
435
|
-
dependsOn?: readonly InputFieldRef<string, unknown>[];
|
|
436
|
-
}) => BoundCardCollector<Contract, Id, ZoneIds>;
|
|
437
|
-
/**
|
|
438
|
-
* Prompt collector. `choices` names the option domain (a list or a factory
|
|
439
|
-
* over state) and `where` filters it; the target rule is built internally.
|
|
440
|
-
*/
|
|
441
|
-
type BoundPromptInput<Contract extends ContractWithPhases> = <Schema extends SchemaLike<unknown>>(options: {
|
|
442
|
-
schema: Schema;
|
|
443
|
-
choices?: ReadonlyArray<ChoiceTargetOption<Extract<Schema extends z.ZodType<infer Value> ? Value : never, string>>> | ChoiceOptionsFactory<BoundState<Contract>, Extract<Schema extends z.ZodType<infer Value> ? Value : never, string>>;
|
|
444
|
-
where?: BoundWhere<Contract, Extract<Schema extends z.ZodType<infer Value> ? Value : never, string>>;
|
|
445
|
-
}) => InputCollector<Schema, BoundState<Contract>, "prompt">;
|
|
446
|
-
type BoundRngInputs<Contract extends ContractWithPhases> = {
|
|
447
|
-
d6(count?: number): ReturnType<typeof rngInput.d6<BoundState<Contract>>>;
|
|
448
|
-
coin(): ReturnType<typeof rngInput.coin<BoundState<Contract>>>;
|
|
449
|
-
};
|
|
450
|
-
type BoundInputBuilders<Contract extends ContractWithPhases> = {
|
|
451
|
-
readonly board: BoundBoardInputs<Contract>;
|
|
452
|
-
readonly card: BoundCardInput<Contract>;
|
|
453
|
-
readonly form: BoundFormInputs<Contract>;
|
|
454
|
-
readonly prompt: BoundPromptInput<Contract>;
|
|
455
|
-
readonly rng: BoundRngInputs<Contract>;
|
|
456
|
-
};
|
|
457
|
-
type StepPhaseInput<Contract extends ContractWithPhases, PhaseStateSchema extends SchemaLike<object>, Steps extends readonly [string, ...string[]], SubmitCollectors extends Record<string, InputCollector>, Effects extends EffectMap<BoundState<Contract>, BoundManifest<Contract>>, Interactions extends StepPhaseInteractionMap<Steps[number], ScopedPhaseState<BoundState<Contract>, StepPhaseState<PhaseStateSchema, Steps>>, BoundManifest<Contract>>, Stages extends StageMap<ScopedPhaseState<BoundState<Contract>, StepPhaseState<PhaseStateSchema, Steps>>, BoundManifest<Contract>>, Zones extends PhaseZoneList<BoundManifest<Contract>>, CardActions extends StepPhaseCardActionMap<Steps[number], ScopedPhaseState<BoundState<Contract>, StepPhaseState<PhaseStateSchema, Steps>>, BoundManifest<Contract>>> = Omit<PhaseDefinition<PhaseStateSchema, BoundState<Contract>, BoundManifest<Contract>, SubmitCollectors, Effects, UnwrappedStepInteractions<ScopedPhaseState<BoundState<Contract>, StepPhaseState<PhaseStateSchema, Steps>>, BoundManifest<Contract>, Interactions>, Stages, Zones, UnwrappedStepCardActions<ScopedPhaseState<BoundState<Contract>, StepPhaseState<PhaseStateSchema, Steps>>, BoundManifest<Contract>, CardActions>, ContractErrorCode<Contract>>, "state" | "initialState" | "interactions" | "cardActions"> & {
|
|
458
|
-
steps: Steps;
|
|
459
|
-
state?: never;
|
|
460
|
-
initialState?: (ctx: {
|
|
461
|
-
manifest: BoundManifest<Contract>;
|
|
462
|
-
state: BoundState<Contract>;
|
|
463
|
-
playerIds: PlayerIdOfState<BoundState<Contract>>[];
|
|
464
|
-
setup: SetupSelectionOfManifest<BoundManifest<Contract>> | null;
|
|
465
|
-
}) => InferPhaseState<PhaseStateSchema>;
|
|
466
|
-
interactions?: Interactions;
|
|
467
|
-
cardActions?: CardActions;
|
|
468
|
-
};
|
|
469
|
-
type PhaseAuthoring<Contract extends ContractWithPhases, PhaseStateSchema extends SchemaLike<object>> = {
|
|
470
|
-
interaction<Collectors extends Record<string, InputCollector>>(spec: InteractionSpec<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, ContractErrorCode<Contract>>): InteractionSpec<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, ContractErrorCode<Contract>>;
|
|
471
|
-
cardAction<Collectors extends Record<string, InputCollector> = Record<string, never>, const PlayFrom extends PlayerZoneIdOfManifest<BoundManifest<Contract>> = PlayerZoneIdOfManifest<BoundManifest<Contract>>>(spec: CardActionSpec<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, PlayFrom, ContractErrorCode<Contract>>): CardActionSpec<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, PlayFrom, ContractErrorCode<Contract>>;
|
|
472
|
-
rule<Collectors extends Record<string, InputCollector> = Record<string, InputCollector>>(rule: InteractionRule<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, ContractErrorCode<Contract>>): InteractionRule<Collectors, BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>, ContractErrorCode<Contract>>;
|
|
473
|
-
define<SubmitCollectors extends Record<string, InputCollector> = Record<string, InputCollector>, Effects extends EffectMap<BoundState<Contract>, BoundManifest<Contract>> = Record<string, never>, Interactions extends InteractionMap<BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>> = Record<string, never>, Stages extends StageMap<BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>> = Record<string, never>, const Zones extends PhaseZoneList<BoundManifest<Contract>> = readonly [], CardActions extends CardActionMap<BoundPhaseState<Contract, PhaseStateSchema>, BoundManifest<Contract>> = Record<string, never>>(definition: Omit<PhaseDefinition<PhaseStateSchema, BoundState<Contract>, BoundManifest<Contract>, SubmitCollectors, Effects, Interactions, Stages, Zones, CardActions, ContractErrorCode<Contract>>, "state">): PhaseDefinition<PhaseStateSchema, BoundState<Contract>, BoundManifest<Contract>, SubmitCollectors, Effects, Interactions, Stages, Zones, CardActions, ContractErrorCode<Contract>>;
|
|
474
|
-
stepPhase<const Steps extends readonly [string, ...string[]], SubmitCollectors extends Record<string, InputCollector> = Record<string, InputCollector>, Effects extends EffectMap<BoundState<Contract>, BoundManifest<Contract>> = Record<string, never>, Interactions extends StepPhaseInteractionMap<Steps[number], ScopedPhaseState<BoundState<Contract>, StepPhaseState<PhaseStateSchema, Steps>>, BoundManifest<Contract>> = Record<string, never>, Stages extends StageMap<ScopedPhaseState<BoundState<Contract>, StepPhaseState<PhaseStateSchema, Steps>>, BoundManifest<Contract>> = Record<string, never>, const Zones extends PhaseZoneList<BoundManifest<Contract>> = readonly [], CardActions extends StepPhaseCardActionMap<Steps[number], ScopedPhaseState<BoundState<Contract>, StepPhaseState<PhaseStateSchema, Steps>>, BoundManifest<Contract>> = Record<string, never>>(definition: StepPhaseInput<Contract, PhaseStateSchema, Steps, SubmitCollectors, Effects, Interactions, Stages, Zones, CardActions>): PhaseDefinition<SchemaLike<StepPhaseState<PhaseStateSchema, Steps>>, BoundState<Contract>, BoundManifest<Contract>, SubmitCollectors, Effects, UnwrappedStepInteractions<ScopedPhaseState<BoundState<Contract>, StepPhaseState<PhaseStateSchema, Steps>>, BoundManifest<Contract>, Interactions>, Stages, Zones, UnwrappedStepCardActions<ScopedPhaseState<BoundState<Contract>, StepPhaseState<PhaseStateSchema, Steps>>, BoundManifest<Contract>, CardActions>, ContractErrorCode<Contract>>;
|
|
475
|
-
readonly inputs: BoundInputBuilders<Contract>;
|
|
476
|
-
/** Compile-time only. Reading any member at runtime throws. */
|
|
477
|
-
readonly types: PhaseTypes<Contract, PhaseStateSchema>;
|
|
478
|
-
};
|
|
479
|
-
/**
|
|
480
|
-
* Phantom type carriers for one phase: `typeof playing.types.State` is the
|
|
481
|
-
* phase-scoped game state (`state.phase` narrowed to this phase's schema).
|
|
482
|
-
*/
|
|
483
|
-
type PhaseTypes<Contract extends ContractWithPhases, PhaseStateSchema extends SchemaLike<object>> = {
|
|
484
|
-
readonly State: BoundPhaseState<Contract, PhaseStateSchema>;
|
|
485
|
-
readonly PhaseState: z.infer<PhaseStateSchema>;
|
|
486
|
-
readonly Tx: ReducerTransaction<BoundPhaseState<Contract, PhaseStateSchema>, ContractErrorCode<Contract>>;
|
|
487
|
-
};
|
|
488
|
-
/**
|
|
489
|
-
* Phantom type carriers for the whole game. These replace the
|
|
490
|
-
* `GameStateOf<GameContractOf<typeof model>>` chain: a module that has the
|
|
491
|
-
* bound game value can write `typeof game.types.State` and stop there.
|
|
492
|
-
*/
|
|
493
|
-
type ContractTypes<Contract extends ContractWithPhases> = {
|
|
494
|
-
readonly Contract: Contract;
|
|
495
|
-
readonly State: BoundState<Contract>;
|
|
496
|
-
readonly Manifest: BoundManifest<Contract>;
|
|
497
|
-
readonly ErrorCode: ContractErrorCode<Contract>;
|
|
498
|
-
readonly PlayerId: PlayerIdOfState<BoundState<Contract>>;
|
|
499
|
-
readonly Queries: TableQueriesOfState<BoundState<Contract>>;
|
|
500
|
-
readonly Tx: ReducerTransaction<BoundState<Contract>, ContractErrorCode<Contract>>;
|
|
501
|
-
};
|
|
502
|
-
/**
|
|
503
|
-
* View factories bound to the contract's state and manifest. Grouped under
|
|
504
|
-
* `game.views` so the assembled `views: { shared, player }` map reads the same
|
|
505
|
-
* way it is authored.
|
|
506
|
-
*/
|
|
507
|
-
type BoundViewBuilders<Contract extends ContractWithPhases> = {
|
|
508
|
-
shared<Projection>(definition: SharedViewDefinition<BoundState<Contract>, BoundManifest<Contract>, Projection>): SharedViewDefinition<BoundState<Contract>, BoundManifest<Contract>, Projection>;
|
|
509
|
-
player<SharedProjection = unknown, Projection = unknown>(definition: PlayerViewDefinition<BoundState<Contract>, BoundManifest<Contract>, SharedProjection, Projection>): PlayerViewDefinition<BoundState<Contract>, BoundManifest<Contract>, SharedProjection, Projection>;
|
|
510
|
-
empty(): EmptyViewDefinition<BoundState<Contract>, BoundManifest<Contract>>;
|
|
511
|
-
static<Projection>(definition: StaticViewDefinition<ExactManifestContractOf<Contract>, Projection>): StaticViewDefinition<ExactManifestContractOf<Contract>, Projection>;
|
|
512
|
-
};
|
|
513
|
-
/**
|
|
514
|
-
* Rejects phase keys the model did not declare. `PhaseMapOf<Contract>` already
|
|
515
|
-
* requires every declared phase; this closes the other direction so an extra
|
|
516
|
-
* key fails at `assemble` instead of at runtime.
|
|
517
|
-
*/
|
|
518
|
-
type NoUndeclaredPhases<Contract, Definitions> = {
|
|
519
|
-
[Name in Exclude<keyof Definitions, PhaseNameOfContract<Contract>>]: `Phase '${Name & string}' is not declared in model.phases`;
|
|
520
|
-
};
|
|
521
|
-
type GameAuthoring<Contract extends ContractWithPhases> = {
|
|
522
|
-
readonly contract: Contract;
|
|
523
|
-
readonly views: BoundViewBuilders<Contract>;
|
|
524
|
-
/** Compile-time only. Reading any member at runtime throws. */
|
|
525
|
-
readonly types: ContractTypes<Contract>;
|
|
526
|
-
/** Assemble the final game definition from phases and views. */
|
|
527
|
-
assemble<Definitions extends PhaseMapOf<Contract>, Views extends ViewMapOf<Contract>>(definition: Omit<ReducerGameDefinition<Contract, Definitions, Views>, "contract"> & {
|
|
528
|
-
phases: NoUndeclaredPhases<Contract, Definitions>;
|
|
529
|
-
}): ReducerGameDefinition<Contract, Definitions, Views>;
|
|
530
|
-
phase<Name extends PhaseNameOfContract<Contract>>(name: Name): PhaseAuthoring<Contract, PhaseSchemasOfContract<Contract>[Name]>;
|
|
531
|
-
};
|
|
532
|
-
|
|
533
|
-
type ReadonlyValue<T> = T extends readonly (infer V)[] ? readonly ReadonlyValue<V>[] : T extends object ? {
|
|
534
|
-
readonly [K in keyof T]: ReadonlyValue<T[K]>;
|
|
535
|
-
} : T;
|
|
536
|
-
type AuthoredManifest = ReadonlyValue<GameTopologyManifest>;
|
|
537
|
-
type Entry<T> = T extends readonly (infer V)[] ? V : never;
|
|
538
|
-
type Get<T, K extends PropertyKey> = T extends unknown ? K extends keyof T ? T[K] : never : never;
|
|
539
|
-
type Entries<M, K extends PropertyKey> = Entry<Get<M, K>>;
|
|
540
|
-
type Id<T> = T extends {
|
|
541
|
-
id: infer I extends string;
|
|
542
|
-
} ? I : never;
|
|
543
|
-
type NumberRange<N extends number, A extends number[] = []> = number extends N ? number : A["length"] extends 64 ? number : A["length"] extends N ? A[number] | N : NumberRange<N, [...A, A["length"]]>;
|
|
544
|
-
type InstanceIds<Base extends string, Count> = [Count] extends [never] ? Base : Count extends number ? number extends Count ? Base | `${Base}-${number}` : Count extends 0 | 1 ? Base : `${Base}-${Exclude<NumberRange<Count>, 0>}` : Base;
|
|
545
|
-
type SeedIds<S> = S extends {
|
|
546
|
-
typeId: infer T extends string;
|
|
547
|
-
} ? InstanceIds<S extends {
|
|
548
|
-
id: infer I extends string;
|
|
549
|
-
} ? I : T, Get<S, "count">> : never;
|
|
550
|
-
type CardIds<C> = C extends {
|
|
551
|
-
type: infer T extends string;
|
|
552
|
-
} ? InstanceIds<T, Get<C, "count">> : never;
|
|
553
|
-
type StandardSuit = "SPADES" | "HEARTS" | "CLUBS" | "DIAMONDS";
|
|
554
|
-
type StandardRank = "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "J" | "Q" | "K" | "A";
|
|
555
|
-
type ResolvedCardSet<S> = S extends {
|
|
556
|
-
type: "preset";
|
|
557
|
-
presetId: "standard_52_deck";
|
|
558
|
-
} ? Omit<S, "type"> & {
|
|
559
|
-
type: "manual";
|
|
560
|
-
cards: readonly {
|
|
561
|
-
type: `${StandardSuit}_${StandardRank}`;
|
|
562
|
-
count: 1;
|
|
563
|
-
}[];
|
|
564
|
-
cardSchema: {
|
|
565
|
-
properties: {
|
|
566
|
-
suit: {
|
|
567
|
-
type: "enum";
|
|
568
|
-
enums: readonly StandardSuit[];
|
|
569
|
-
};
|
|
570
|
-
rank: {
|
|
571
|
-
type: "string";
|
|
572
|
-
};
|
|
573
|
-
};
|
|
574
|
-
};
|
|
575
|
-
} : S;
|
|
576
|
-
type CardSets<M> = ResolvedCardSet<Entries<M, "cardSets">>;
|
|
577
|
-
type Cards<M> = CardSets<M> extends infer S ? S extends {
|
|
578
|
-
cards: infer C;
|
|
579
|
-
} ? Entry<C> : never : never;
|
|
580
|
-
type Zone<M, Scope> = Id<Extract<Entries<M, "zones">, {
|
|
581
|
-
scope: Scope;
|
|
582
|
-
}>>;
|
|
583
|
-
type BoardLike<M> = Boards<M> extends infer B ? B extends unknown ? ResolveBoard<M, B> : never : never;
|
|
584
|
-
type Boards<M> = Entries<M, "boards">;
|
|
585
|
-
type RuntimeBoardId<B> = B extends {
|
|
586
|
-
id: infer I extends string;
|
|
587
|
-
} ? B extends {
|
|
588
|
-
scope: "perPlayer";
|
|
589
|
-
} ? `${I}:${string}` : I : never;
|
|
590
|
-
type CardTypeOf<C> = C extends {
|
|
591
|
-
cardType: infer T extends string;
|
|
592
|
-
} ? T : Extract<Get<C, "type">, string>;
|
|
593
|
-
type ManifestIdsOf<M> = {
|
|
594
|
-
playerId: PlayerId;
|
|
595
|
-
phaseName: string;
|
|
596
|
-
boardLayout: "generic" | "hex" | "square";
|
|
597
|
-
setupOptionId: Id<Entries<M, "setupOptions">>;
|
|
598
|
-
setupProfileId: Id<Entries<M, "setupProfiles">>;
|
|
599
|
-
cardSetId: Id<Entries<M, "cardSets">>;
|
|
600
|
-
cardType: CardTypeOf<Cards<M>>;
|
|
601
|
-
cardId: CardIds<Cards<M>>;
|
|
602
|
-
deckId: Zone<M, "shared">;
|
|
603
|
-
handId: Zone<M, "perPlayer">;
|
|
604
|
-
sharedZoneId: Zone<M, "shared">;
|
|
605
|
-
playerZoneId: Zone<M, "perPlayer">;
|
|
606
|
-
zoneId: Id<Entries<M, "zones">>;
|
|
607
|
-
resourceId: Id<Entries<M, "resources">>;
|
|
608
|
-
pieceTypeId: Id<Entries<M, "pieceTypes">>;
|
|
609
|
-
pieceId: SeedIds<Entries<M, "pieceSeeds">>;
|
|
610
|
-
dieTypeId: Id<Entries<M, "dieTypes">>;
|
|
611
|
-
dieId: SeedIds<Entries<M, "dieSeeds">>;
|
|
612
|
-
boardTypeId: Extract<Get<BoardLike<M>, "typeId">, string>;
|
|
613
|
-
boardBaseId: Id<Boards<M>>;
|
|
614
|
-
boardId: RuntimeBoardId<Boards<M>>;
|
|
615
|
-
boardContainerId: Id<Entry<Get<BoardLike<M>, "containers">>>;
|
|
616
|
-
relationTypeId: Extract<Get<Entry<Get<BoardLike<M>, "relations">>, "typeId">, string>;
|
|
617
|
-
edgeId: string;
|
|
618
|
-
edgeTypeId: Extract<Get<Entry<Get<BoardLike<M>, "edges">>, "typeId">, string>;
|
|
619
|
-
vertexId: string;
|
|
620
|
-
vertexTypeId: Extract<Get<Entry<Get<BoardLike<M>, "vertices">>, "typeId">, string>;
|
|
621
|
-
spaceId: Id<Entry<Get<BoardLike<M>, "spaces">>>;
|
|
622
|
-
spaceTypeId: Extract<Get<Entry<Get<BoardLike<M>, "spaces">>, "typeId">, string>;
|
|
623
|
-
};
|
|
624
|
-
type PropertyValue<P, M> = PropertySchema extends P ? RuntimePayload : P extends {
|
|
625
|
-
type: infer T;
|
|
626
|
-
} ? T extends keyof ManifestIdsOf<M> ? ManifestIdsOf<M>[T] : T extends "string" ? string : T extends "number" | "integer" ? number : T extends "boolean" ? boolean : T extends "enum" ? Entry<Get<P, "enums">> : T extends "array" ? PropertyOutput<Get<P, "items">, M>[] : T extends "record" ? Record<string, PropertyOutput<Get<P, "values">, M>> : T extends "object" ? ObjectProperties<Get<P, "properties">, M> : never : never;
|
|
627
|
-
type PropertyOutput<P, M> = PropertyValue<P, M> | (P extends {
|
|
628
|
-
nullable: true;
|
|
629
|
-
} ? null : never);
|
|
630
|
-
type OptionalKeys<P> = {
|
|
631
|
-
[K in keyof P]: P[K] extends {
|
|
632
|
-
optional: true;
|
|
633
|
-
} ? P[K] extends {
|
|
634
|
-
default: unknown;
|
|
635
|
-
} ? never : K : never;
|
|
636
|
-
}[keyof P];
|
|
637
|
-
type ObjectProperties<P, M> = {
|
|
638
|
-
[K in Exclude<keyof P, OptionalKeys<P>>]: PropertyOutput<P[K], M>;
|
|
639
|
-
} & {
|
|
640
|
-
[K in OptionalKeys<P>]?: PropertyOutput<P[K], M>;
|
|
641
|
-
};
|
|
642
|
-
type ObjectFields<S, M> = [S] extends [never] ? RuntimeRecord : ObjectSchema extends S ? RuntimeRecord : S extends {
|
|
643
|
-
properties: infer P;
|
|
644
|
-
} ? ObjectProperties<P, M> : RuntimeRecord;
|
|
645
|
-
type CardFields<S, M> = S extends {
|
|
646
|
-
variants: infer V;
|
|
647
|
-
} ? ObjectProperties<Get<S, "shared">, M> & ObjectFields<V[keyof V], M> : ObjectFields<S, M>;
|
|
648
|
-
type CardState<M> = CardSets<M> extends infer S ? S extends {
|
|
649
|
-
id: infer I;
|
|
650
|
-
cards: unknown;
|
|
651
|
-
} ? Omit<RuntimeCardData, "id" | "cardSetId" | "cardType" | "properties"> & {
|
|
652
|
-
id: ManifestIdsOf<M>["cardId"];
|
|
653
|
-
cardSetId: I;
|
|
654
|
-
cardType: ManifestIdsOf<M>["cardType"];
|
|
655
|
-
properties: CardFields<Get<S, "cardSchema">, M>;
|
|
656
|
-
} : never : never;
|
|
657
|
-
type ResolveBoard<M, B> = B & (B extends {
|
|
658
|
-
templateId: infer I;
|
|
659
|
-
} ? Omit<Extract<Entries<M, "boardTemplates">, {
|
|
660
|
-
id: I;
|
|
661
|
-
}>, keyof B> : unknown);
|
|
662
|
-
type BoardField<B, K extends PropertyKey, M> = ObjectFields<Get<B, K>, M>;
|
|
663
|
-
type BoardParts<M, B> = {
|
|
664
|
-
id: RuntimeBoardId<B>;
|
|
665
|
-
baseId: Id<B>;
|
|
666
|
-
fields: BoardField<ResolveBoard<M, B>, "boardFieldsSchema", M>;
|
|
667
|
-
spaces: Record<Id<Entry<Get<ResolveBoard<M, B>, "spaces">>>, (B extends {
|
|
668
|
-
layout: "hex";
|
|
669
|
-
} ? {
|
|
670
|
-
q: number;
|
|
671
|
-
r: number;
|
|
672
|
-
} : B extends {
|
|
673
|
-
layout: "square";
|
|
674
|
-
} ? {
|
|
675
|
-
row: number;
|
|
676
|
-
col: number;
|
|
677
|
-
} : unknown) & {
|
|
678
|
-
id: Id<Entry<Get<ResolveBoard<M, B>, "spaces">>>;
|
|
679
|
-
name?: string | null;
|
|
680
|
-
typeId?: string | null;
|
|
681
|
-
fields: BoardField<ResolveBoard<M, B>, "spaceFieldsSchema", M>;
|
|
682
|
-
zoneId?: string | null;
|
|
683
|
-
}>;
|
|
684
|
-
};
|
|
685
|
-
type BoardState<M, B> = B extends {
|
|
686
|
-
layout: "hex";
|
|
687
|
-
} ? Omit<RuntimeHexBoardState, "id" | "baseId" | "fields"> & BoardParts<M, B> : B extends {
|
|
688
|
-
layout: "square";
|
|
689
|
-
} ? Omit<RuntimeSquareBoardState, "id" | "baseId" | "fields"> & BoardParts<M, B> : Omit<RuntimeGenericBoardState, "id" | "baseId" | "fields"> & BoardParts<M, B>;
|
|
690
|
-
type BoardMap<M> = {
|
|
691
|
-
[B in Boards<M> as RuntimeBoardId<B>]: Extract<BoardState<M, B>, RuntimeBoardState>;
|
|
692
|
-
};
|
|
693
|
-
type InferredBoards<M> = {
|
|
694
|
-
byId: BoardMap<M>;
|
|
695
|
-
hex: {
|
|
696
|
-
[B in Extract<Boards<M>, {
|
|
697
|
-
layout: "hex";
|
|
698
|
-
}> as RuntimeBoardId<B>]: Extract<BoardState<M, B>, RuntimeHexBoardState>;
|
|
699
|
-
};
|
|
700
|
-
square: {
|
|
701
|
-
[B in Extract<Boards<M>, {
|
|
702
|
-
layout: "square";
|
|
703
|
-
}> as RuntimeBoardId<B>]: Extract<BoardState<M, B>, RuntimeSquareBoardState>;
|
|
704
|
-
};
|
|
705
|
-
network: Record<string, RuntimeRecord>;
|
|
706
|
-
track: Record<string, RuntimeRecord>;
|
|
707
|
-
};
|
|
708
|
-
type ManifestTable<M> = AuthoredManifest extends M ? RuntimeTableRecord : Omit<RuntimeTableRecord, "playerOrder" | "decks" | "hands" | "cards" | "pieces" | "dice" | "boards" | "resources"> & {
|
|
709
|
-
boards: InferredBoards<M>;
|
|
710
|
-
playerOrder: PlayerId[];
|
|
711
|
-
decks: Record<ManifestIdsOf<M>["deckId"], ManifestIdsOf<M>["cardId"][]>;
|
|
712
|
-
hands: Record<ManifestIdsOf<M>["handId"], PerPlayer<ManifestIdsOf<M>["cardId"][]>>;
|
|
713
|
-
cards: Record<ManifestIdsOf<M>["cardId"], CardState<M>>;
|
|
714
|
-
pieces: Record<ManifestIdsOf<M>["pieceId"], RuntimePieceData>;
|
|
715
|
-
dice: Record<ManifestIdsOf<M>["dieId"], RuntimeDieData>;
|
|
716
|
-
resources: PerPlayer<Record<ManifestIdsOf<M>["resourceId"], number>>;
|
|
717
|
-
};
|
|
718
|
-
type CompiledManifest<M extends AuthoredManifest> = Omit<ReducerManifestContract<ManifestTable<M>, string, PlayerId, ManifestIdsOf<M>["deckId"], ManifestIdsOf<M>["handId"], ManifestIdsOf<M>["cardId"]>, "ids" | "literals" | "staticBoards"> & {
|
|
719
|
-
staticBoards: Pick<InferredBoards<M>, "byId" | "hex" | "square">;
|
|
720
|
-
literals: Omit<ReducerManifestContract<RuntimeTableRecord, string, string, string, string, string>["literals"], `${keyof ManifestIdsOf<M>}s`> & {
|
|
721
|
-
[K in keyof ManifestIdsOf<M> as `${K}s`]: readonly ManifestIdsOf<M>[K][];
|
|
722
|
-
};
|
|
723
|
-
records: {
|
|
724
|
-
[K in keyof ManifestIdsOf<M> as `${K}s`]: <V>(initial: V | ((id: ManifestIdsOf<M>[K]) => V)) => Record<ManifestIdsOf<M>[K], V>;
|
|
725
|
-
};
|
|
726
|
-
ids: {
|
|
727
|
-
[K in keyof ManifestIdsOf<M>]: ManifestIdSchema<ManifestIdsOf<M>[K], K>;
|
|
728
|
-
};
|
|
729
|
-
schemas: {
|
|
730
|
-
table: z.ZodType<ManifestTable<M>>;
|
|
731
|
-
runtime: z.ZodTypeAny;
|
|
732
|
-
};
|
|
733
|
-
createInitialTable(options?: {
|
|
734
|
-
playerIds?: readonly string[];
|
|
735
|
-
shuffleItems?: <V>(values: readonly V[]) => V[];
|
|
736
|
-
}): ManifestTable<M>;
|
|
737
|
-
};
|
|
738
|
-
|
|
739
|
-
declare function defineGameDefinition<const Contract extends AnyReducerGameContract, Definitions extends PhaseMapOf<Contract>, Views extends ViewMapOf<Contract>>(definition: {
|
|
740
|
-
contract: Contract;
|
|
741
|
-
} & Omit<ReducerGameDefinition<NoInfer<Contract>, Definitions, Views>, "contract">): ReducerGameDefinition<Contract, Definitions, Views>;
|
|
742
|
-
/**
|
|
743
|
-
* Creates the bound authoring object for a model without assembling the game.
|
|
744
|
-
*
|
|
745
|
-
* This is the module-level primitive behind {@link defineGame}: the returned
|
|
746
|
-
* value is the type leaf (`typeof game.types.State`), the factory namespace
|
|
747
|
-
* (`game.phase(name)`, `game.views.*`), and the assembler (`game.assemble`).
|
|
748
|
-
* Phase files import it directly, so no factory wrappers or `*AuthoringOf`
|
|
749
|
-
* parameter types are needed.
|
|
750
|
-
*/
|
|
751
|
-
declare function createGame<const Manifest extends AuthoredManifest, PublicSchema extends SchemaLike<object>, PrivateSchema extends SchemaLike<object>, HiddenSchema extends SchemaLike<object>, const Phases extends Record<string, SchemaLike<object>>, const Errors extends Record<string, string> | undefined = undefined>(model: {
|
|
752
|
-
manifest: Manifest;
|
|
753
|
-
state: {
|
|
754
|
-
public: PublicSchema;
|
|
755
|
-
private: PrivateSchema;
|
|
756
|
-
hidden: HiddenSchema;
|
|
757
|
-
};
|
|
758
|
-
phases: Phases;
|
|
759
|
-
errors?: Errors;
|
|
760
|
-
}): GameAuthoring<DefinedGameContract<ManifestTable<Manifest>, CompiledManifest<Manifest>, PublicSchema, PrivateSchema, HiddenSchema, Phases, Errors>>;
|
|
761
|
-
declare function createGame<Table extends RuntimeTableRecord, const Manifest extends ReducerManifestContract<Table, string, string, string, string, string>, PublicSchema extends SchemaLike<object>, PrivateSchema extends SchemaLike<object>, HiddenSchema extends SchemaLike<object>, const Phases extends Record<string, SchemaLike<object>>, const Errors extends Record<string, string> | undefined = undefined>(model: ReducerGameContractInput<Table, Manifest, PublicSchema, PrivateSchema, HiddenSchema, Phases, Errors>): GameAuthoring<DefinedGameContract<Table, Manifest, PublicSchema, PrivateSchema, HiddenSchema, Phases, Errors>>;
|
|
762
|
-
|
|
763
|
-
export { type AnyReducerGameContract as A, type BoardTargetPredicate as B, type ChoiceOptionsFactory as C, type DefinedInputs as D, type GameAuthoring as G, type InputFieldRef as I, type ManifestIdsOf as M, type PhaseAuthoring as P, type TargetContext as T, type AuthoredManifest as a, type BoundInputBuilders as b, type BoundTargetPredicate as c, type BoundViewBuilders as d, type ChoiceTargetOption as e, type ChoiceTargetPredicate as f, type CompiledManifest as g, type ContractManifest as h, type ContractState as i, type ContractTypes as j, type DependencyValues as k, type ManifestTable as l, type PhaseTypes as m, type PlayerBoardSpaceTarget as n, type TargetPredicate as o, type TargetPredicateArgs as p, createGame as q, defineGameDefinition as r, defineInputs as s };
|