@dreamboard-games/sdk 0.3.0-alpha.1 → 0.4.0-alpha.0
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 +19935 -0
- package/dist/{chunk-3RQEICD3.js → chunk-2LDZ5C3T.js} +2 -2
- package/dist/chunk-3OZMHZK3.js +40 -0
- package/dist/chunk-3OZMHZK3.js.map +1 -0
- package/dist/{chunk-TXXLS3OI.js → chunk-4G7552LO.js} +3 -3
- package/dist/{chunk-P7VMTJ5D.js → chunk-MNKDSGIA.js} +2 -2
- package/dist/{chunk-P7VMTJ5D.js.map → chunk-MNKDSGIA.js.map} +1 -1
- package/dist/{chunk-W6SGFWXH.js → chunk-NBAEEHAU.js} +101 -60
- package/dist/chunk-NBAEEHAU.js.map +1 -0
- package/dist/{chunk-ADYH6PVT.js → chunk-P7F4L2FF.js} +49 -25
- package/dist/chunk-P7F4L2FF.js.map +1 -0
- package/dist/{chunk-QZ6X4B5P.js → chunk-Q5O7GPVY.js} +1 -1
- package/dist/{chunk-QZ6X4B5P.js.map → chunk-Q5O7GPVY.js.map} +1 -1
- package/dist/chunk-U5KBV2BA.js +2654 -0
- package/dist/chunk-U5KBV2BA.js.map +1 -0
- package/dist/{chunk-Y2AFYBMB.js → chunk-Y6Y2YABD.js} +9 -5
- package/dist/chunk-Y6Y2YABD.js.map +1 -0
- package/dist/codegen.d.ts +44 -51
- package/dist/codegen.js +1 -1
- package/dist/{index.d-BGqVifr_.d.ts → index.d-BL3bT5lt.d.ts} +82 -3
- package/dist/index.js +1 -1
- package/dist/package-set.d.ts +2 -2
- package/dist/package-set.js +1 -1
- package/dist/reducer/advanced.d.ts +78 -0
- package/dist/reducer/advanced.js +139 -0
- package/dist/reducer/advanced.js.map +1 -0
- package/dist/reducer-contract.d.ts +1 -1
- package/dist/reducer-contract.js +2 -2
- package/dist/reducer.d.ts +363 -3263
- package/dist/reducer.js +2778 -4081
- package/dist/reducer.js.map +1 -1
- package/dist/runtime/primitives.d.ts +3 -3
- package/dist/runtime/primitives.js +3 -3
- package/dist/runtime/runtime-api.d.ts +1 -1
- package/dist/runtime/workspace-contract.d.ts +18 -4
- package/dist/runtime/workspace-contract.js +4 -4
- package/dist/{runtime-api-tGL3ArsB.d.ts → runtime-api-BXd70c2e.d.ts} +6 -0
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +85 -20
- package/dist/runtime.js.map +1 -1
- package/dist/stale-contract-artifact-error-BelRiIDR.d.ts +66 -0
- package/dist/testing.d.ts +59 -5
- package/dist/testing.js +170 -6
- package/dist/testing.js.map +1 -1
- package/dist/types.d.ts +112 -119
- package/dist/ui/components.js +1 -1
- package/dist/ui/plugin-styles.css +2 -250
- package/dist/{ui-contract-SctM4ibF.d.ts → ui-contract-BUC6iS3s.d.ts} +1 -1
- package/dist/ui.js +2 -2
- package/dist/views-B0hlW6IT.d.ts +3153 -0
- package/package.json +18 -10
- package/dist/chunk-ADYH6PVT.js.map +0 -1
- package/dist/chunk-W6SGFWXH.js.map +0 -1
- package/dist/chunk-Y2AFYBMB.js.map +0 -1
- /package/dist/{chunk-3RQEICD3.js.map → chunk-2LDZ5C3T.js.map} +0 -0
- /package/dist/{chunk-TXXLS3OI.js.map → chunk-4G7552LO.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useTheme
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Q5O7GPVY.js";
|
|
4
4
|
|
|
5
5
|
// src/ui/helpers/track-board.ts
|
|
6
6
|
function positionForLayout(layout, index, count) {
|
|
@@ -101,4 +101,4 @@ export {
|
|
|
101
101
|
parseHexColor,
|
|
102
102
|
hexColor
|
|
103
103
|
};
|
|
104
|
-
//# sourceMappingURL=chunk-
|
|
104
|
+
//# sourceMappingURL=chunk-2LDZ5C3T.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/reducer/stale-contract-artifact-error.ts
|
|
2
|
+
var DEFAULT_REMEDY_BY_ARTIFACT = {
|
|
3
|
+
"base-states": "run `dreamboard test generate`, then re-run the tests.",
|
|
4
|
+
"session-state": "reset the dev session or run `dreamboard test generate`."
|
|
5
|
+
};
|
|
6
|
+
function artifactLabel(artifact) {
|
|
7
|
+
return artifact === "base-states" ? "base states" : "session state";
|
|
8
|
+
}
|
|
9
|
+
function artifactVerb(artifact) {
|
|
10
|
+
return artifact === "base-states" ? "were" : "was";
|
|
11
|
+
}
|
|
12
|
+
var StaleContractArtifactError = class extends Error {
|
|
13
|
+
code = "STALE_CONTRACT_ARTIFACT";
|
|
14
|
+
artifact;
|
|
15
|
+
expected;
|
|
16
|
+
found;
|
|
17
|
+
remedy;
|
|
18
|
+
constructor(options) {
|
|
19
|
+
const remedy = options.remedy ?? DEFAULT_REMEDY_BY_ARTIFACT[options.artifact];
|
|
20
|
+
super(
|
|
21
|
+
`${artifactLabel(options.artifact)} ${artifactVerb(
|
|
22
|
+
options.artifact
|
|
23
|
+
)} generated for contract ${options.found} but the current contract is ${options.expected}. Your state or phase schemas changed since the artifact was created. Remedy: ${remedy}`
|
|
24
|
+
);
|
|
25
|
+
this.name = "StaleContractArtifactError";
|
|
26
|
+
this.artifact = options.artifact;
|
|
27
|
+
this.expected = options.expected;
|
|
28
|
+
this.found = options.found;
|
|
29
|
+
this.remedy = remedy;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
function isStaleContractArtifactError(error) {
|
|
33
|
+
return error instanceof StaleContractArtifactError || typeof error === "object" && error !== null && error.code === "STALE_CONTRACT_ARTIFACT";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
StaleContractArtifactError,
|
|
38
|
+
isStaleContractArtifactError
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=chunk-3OZMHZK3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/reducer/stale-contract-artifact-error.ts"],"sourcesContent":["export type StaleContractArtifactKind = \"base-states\" | \"session-state\";\n\nexport type StaleContractArtifactErrorOptions = {\n artifact: StaleContractArtifactKind;\n expected: string;\n found: string;\n remedy?: string;\n};\n\nconst DEFAULT_REMEDY_BY_ARTIFACT: Record<StaleContractArtifactKind, string> = {\n \"base-states\": \"run `dreamboard test generate`, then re-run the tests.\",\n \"session-state\": \"reset the dev session or run `dreamboard test generate`.\",\n};\n\nfunction artifactLabel(artifact: StaleContractArtifactKind): string {\n return artifact === \"base-states\" ? \"base states\" : \"session state\";\n}\n\nfunction artifactVerb(artifact: StaleContractArtifactKind): string {\n return artifact === \"base-states\" ? \"were\" : \"was\";\n}\n\nexport class StaleContractArtifactError extends Error {\n readonly code = \"STALE_CONTRACT_ARTIFACT\";\n readonly artifact: StaleContractArtifactKind;\n readonly expected: string;\n readonly found: string;\n readonly remedy: string;\n\n constructor(options: StaleContractArtifactErrorOptions) {\n const remedy =\n options.remedy ?? DEFAULT_REMEDY_BY_ARTIFACT[options.artifact];\n super(\n `${artifactLabel(options.artifact)} ${artifactVerb(\n options.artifact,\n )} generated for contract ${options.found} but the current contract is ${\n options.expected\n }. ` +\n `Your state or phase schemas changed since the artifact was created. ` +\n `Remedy: ${remedy}`,\n );\n this.name = \"StaleContractArtifactError\";\n this.artifact = options.artifact;\n this.expected = options.expected;\n this.found = options.found;\n this.remedy = remedy;\n }\n}\n\nexport function isStaleContractArtifactError(\n error: unknown,\n): error is StaleContractArtifactError {\n return (\n error instanceof StaleContractArtifactError ||\n (typeof error === \"object\" &&\n error !== null &&\n (error as { code?: unknown }).code === \"STALE_CONTRACT_ARTIFACT\")\n );\n}\n"],"mappings":";AASA,IAAM,6BAAwE;AAAA,EAC5E,eAAe;AAAA,EACf,iBAAiB;AACnB;AAEA,SAAS,cAAc,UAA6C;AAClE,SAAO,aAAa,gBAAgB,gBAAgB;AACtD;AAEA,SAAS,aAAa,UAA6C;AACjE,SAAO,aAAa,gBAAgB,SAAS;AAC/C;AAEO,IAAM,6BAAN,cAAyC,MAAM;AAAA,EAC3C,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,SAA4C;AACtD,UAAM,SACJ,QAAQ,UAAU,2BAA2B,QAAQ,QAAQ;AAC/D;AAAA,MACE,GAAG,cAAc,QAAQ,QAAQ,CAAC,IAAI;AAAA,QACpC,QAAQ;AAAA,MACV,CAAC,2BAA2B,QAAQ,KAAK,gCACvC,QAAQ,QACV,iFAEa,MAAM;AAAA,IACrB;AACA,SAAK,OAAO;AACZ,SAAK,WAAW,QAAQ;AACxB,SAAK,WAAW,QAAQ;AACxB,SAAK,QAAQ,QAAQ;AACrB,SAAK,SAAS;AAAA,EAChB;AACF;AAEO,SAAS,6BACd,OACqC;AACrC,SACE,iBAAiB,8BAChB,OAAO,UAAU,YAChB,UAAU,QACT,MAA6B,SAAS;AAE7C;","names":[]}
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
usePluginState,
|
|
18
18
|
useResolvedCardTargetValue,
|
|
19
19
|
useZoneCards
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-P7F4L2FF.js";
|
|
21
21
|
import {
|
|
22
22
|
CardFace,
|
|
23
23
|
MobileHandTrayProvider,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
createResourceCounter,
|
|
26
26
|
useIsMobile,
|
|
27
27
|
useRegisterMobileHand
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-Q5O7GPVY.js";
|
|
29
29
|
|
|
30
30
|
// src/runtime/workspace-contract/index.ts
|
|
31
31
|
import { createElement as createElement6 } from "react";
|
|
@@ -691,4 +691,4 @@ function createWorkspaceUIContract(options) {
|
|
|
691
691
|
export {
|
|
692
692
|
createWorkspaceUIContract
|
|
693
693
|
};
|
|
694
|
-
//# sourceMappingURL=chunk-
|
|
694
|
+
//# sourceMappingURL=chunk-4G7552LO.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/package-set.ts
|
|
2
|
-
var DREAMBOARD_SDK_VERSION = "0.
|
|
2
|
+
var DREAMBOARD_SDK_VERSION = "0.4.0-alpha.0";
|
|
3
3
|
var DREAMBOARD_SDK_PACKAGES = {
|
|
4
4
|
"@dreamboard-games/sdk": DREAMBOARD_SDK_VERSION
|
|
5
5
|
};
|
|
@@ -14,4 +14,4 @@ export {
|
|
|
14
14
|
DREAMBOARD_SDK_PACKAGES,
|
|
15
15
|
DREAMBOARD_SDK_PACKAGE_SET
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-MNKDSGIA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/package-set.ts"],"sourcesContent":["export const DREAMBOARD_SDK_VERSION = \"0.
|
|
1
|
+
{"version":3,"sources":["../src/package-set.ts"],"sourcesContent":["export const DREAMBOARD_SDK_VERSION = \"0.4.0-alpha.0\";\n\nexport const DREAMBOARD_SDK_PACKAGES = {\n \"@dreamboard-games/sdk\": DREAMBOARD_SDK_VERSION,\n} as const;\n\nexport type DreamboardSdkPackageName = keyof typeof DREAMBOARD_SDK_PACKAGES;\n\nexport type DreamboardSdkPackageSet = {\n version: 1;\n sdkVersion: string;\n packages: Record<DreamboardSdkPackageName, string>;\n};\n\nexport const DREAMBOARD_SDK_PACKAGE_SET: DreamboardSdkPackageSet = {\n version: 1,\n sdkVersion: DREAMBOARD_SDK_VERSION,\n packages: DREAMBOARD_SDK_PACKAGES,\n};\n"],"mappings":";AAAO,IAAM,yBAAyB;AAE/B,IAAM,0BAA0B;AAAA,EACrC,yBAAyB;AAC3B;AAUO,IAAM,6BAAsD;AAAA,EACjE,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,UAAU;AACZ;","names":[]}
|
|
@@ -186,6 +186,28 @@ function resolveHexVertexGeometryKey(ref, spacesById) {
|
|
|
186
186
|
return vertexKey;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
// ../workspace-codegen/src/manifest-static.ts
|
|
190
|
+
function createManifestStaticBoardsData(materializedTable) {
|
|
191
|
+
const boards = materializedTable.boards;
|
|
192
|
+
return {
|
|
193
|
+
byId: boards?.byId ?? {},
|
|
194
|
+
hex: boards?.hex ?? {},
|
|
195
|
+
square: boards?.square ?? {}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function createManifestStaticJsonEnvelope(staticBoards, initialTable) {
|
|
199
|
+
return {
|
|
200
|
+
formatVersion: 1,
|
|
201
|
+
generatedBy: "@dreamboard-games/sdk/codegen",
|
|
202
|
+
boards: staticBoards,
|
|
203
|
+
initialTable
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function renderManifestStaticJsonSource(envelope) {
|
|
207
|
+
return `${JSON.stringify(envelope, null, 2)}
|
|
208
|
+
`;
|
|
209
|
+
}
|
|
210
|
+
|
|
189
211
|
// ../workspace-codegen/src/manifest-contract.ts
|
|
190
212
|
function isCardPropertySchemaVariants(schema) {
|
|
191
213
|
return Boolean(schema && "variants" in schema);
|
|
@@ -3842,11 +3864,9 @@ function renderManifestContractSource(manifest) {
|
|
|
3842
3864
|
shuffleItems: (values) => [...values]
|
|
3843
3865
|
});
|
|
3844
3866
|
const initialTableBoards = initialTableTemplate.boards;
|
|
3845
|
-
const staticBoardsTemplate = {
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
square: initialTableBoards.square
|
|
3849
|
-
};
|
|
3867
|
+
const staticBoardsTemplate = createManifestStaticBoardsData({
|
|
3868
|
+
boards: initialTableBoards
|
|
3869
|
+
});
|
|
3850
3870
|
const sharedZoneIds = analysis.sharedZones.map((zone) => zone.id).sort();
|
|
3851
3871
|
const playerZoneIds = analysis.playerZones.map((zone) => zone.id).sort();
|
|
3852
3872
|
const zoneVisibilityById = Object.fromEntries(
|
|
@@ -3988,22 +4008,29 @@ import {
|
|
|
3988
4008
|
} from "@dreamboard-games/sdk/types";
|
|
3989
4009
|
import {
|
|
3990
4010
|
asPlayerId,
|
|
3991
|
-
assumeManifestSchema,
|
|
3992
4011
|
boardRef,
|
|
3993
4012
|
boardRefKey,
|
|
3994
4013
|
boardRefSchema,
|
|
3995
|
-
cloneManifestDefault,
|
|
3996
|
-
createManifestGameStateSchema,
|
|
3997
|
-
createManifestRuntimeSchema,
|
|
3998
|
-
createManifestStringLiteralSchema,
|
|
3999
|
-
dealToPlayerBoardContainer as createDealToPlayerBoardContainerStep,
|
|
4000
|
-
dealToPlayerZone as createDealToPlayerZoneStep,
|
|
4001
4014
|
perPlayer,
|
|
4002
4015
|
perPlayerEntries,
|
|
4003
4016
|
perPlayerGet,
|
|
4004
4017
|
perPlayerHas,
|
|
4005
4018
|
perPlayerKeys,
|
|
4006
4019
|
perPlayerSchema,
|
|
4020
|
+
type BoardRef,
|
|
4021
|
+
type PerPlayer,
|
|
4022
|
+
type PerPlayerBoardRef,
|
|
4023
|
+
type PlayerId,
|
|
4024
|
+
type SharedBoardRef,
|
|
4025
|
+
} from "@dreamboard-games/sdk/reducer";
|
|
4026
|
+
import {
|
|
4027
|
+
assumeManifestSchema,
|
|
4028
|
+
cloneManifestDefault,
|
|
4029
|
+
createManifestGameStateSchema,
|
|
4030
|
+
createManifestRuntimeSchema,
|
|
4031
|
+
createManifestStringLiteralSchema,
|
|
4032
|
+
dealToPlayerBoardContainer as createDealToPlayerBoardContainerStep,
|
|
4033
|
+
dealToPlayerZone as createDealToPlayerZoneStep,
|
|
4007
4034
|
markManifestScopedSchema,
|
|
4008
4035
|
resolveManifestPlayerIds,
|
|
4009
4036
|
seedSharedBoardContainer as createSeedSharedBoardContainerStep,
|
|
@@ -4012,10 +4039,6 @@ import {
|
|
|
4012
4039
|
type CardIdOfManifest,
|
|
4013
4040
|
type DieIdOfManifest,
|
|
4014
4041
|
type PieceIdOfManifest,
|
|
4015
|
-
type BoardRef,
|
|
4016
|
-
type PerPlayer,
|
|
4017
|
-
type PerPlayerBoardRef,
|
|
4018
|
-
type PlayerId,
|
|
4019
4042
|
type ReducerManifestContract,
|
|
4020
4043
|
type RuntimeCardData,
|
|
4021
4044
|
type RuntimeCardVisibility,
|
|
@@ -4030,9 +4053,8 @@ import {
|
|
|
4030
4053
|
type SetupBootstrapPerPlayerContainerTemplateRef,
|
|
4031
4054
|
type SetupBootstrapStep,
|
|
4032
4055
|
type SetupProfileDefinition,
|
|
4033
|
-
type SharedBoardRef,
|
|
4034
4056
|
type StaticBoards,
|
|
4035
|
-
} from "@dreamboard-games/sdk/reducer";
|
|
4057
|
+
} from "@dreamboard-games/sdk/reducer/advanced";
|
|
4036
4058
|
|
|
4037
4059
|
const unknownRecordSchema = assumeManifestSchema<RuntimeRecord>(
|
|
4038
4060
|
z.record(z.string(), z.unknown()),
|
|
@@ -5000,14 +5022,7 @@ export const defaults = {
|
|
|
5000
5022
|
export const staticBoards = ${renderJsonConst(staticBoardsTemplate)};
|
|
5001
5023
|
|
|
5002
5024
|
const baseInitialTable = ${renderJsonConst(initialTableTemplate)} as unknown as TableState;
|
|
5003
|
-
const baseDeckCardsByZoneId
|
|
5004
|
-
Object.fromEntries(
|
|
5005
|
-
sharedZoneIds.map((zoneId) => [
|
|
5006
|
-
zoneId,
|
|
5007
|
-
initialTableTemplate.decks[zoneId] ?? []
|
|
5008
|
-
])
|
|
5009
|
-
)
|
|
5010
|
-
)};
|
|
5025
|
+
const baseDeckCardsByZoneId = baseInitialTable.decks as Record<SharedZoneId, readonly CardId[]>;
|
|
5011
5026
|
|
|
5012
5027
|
export function createInitialTable(options: {
|
|
5013
5028
|
playerIds?: readonly string[];
|
|
@@ -5234,10 +5249,11 @@ function renderManifestRuntimeSource(legacySource) {
|
|
|
5234
5249
|
);
|
|
5235
5250
|
return withoutLiterals.replace(generatedFileBanner, `${generatedFileBanner}
|
|
5236
5251
|
// @ts-nocheck`).replace(
|
|
5237
|
-
`} from "@dreamboard-games/sdk/reducer";
|
|
5252
|
+
`} from "@dreamboard-games/sdk/reducer/advanced";
|
|
5238
5253
|
|
|
5239
5254
|
const unknownRecordSchema`,
|
|
5240
|
-
`} from "@dreamboard-games/sdk/reducer";
|
|
5255
|
+
`} from "@dreamboard-games/sdk/reducer/advanced";
|
|
5256
|
+
import staticBoardsData from "./manifest-static.json";
|
|
5241
5257
|
import { literals } from "./manifest-literals";
|
|
5242
5258
|
import type { PlayerId as PublicPlayerId, TableState as PublicTableState } from "./manifest-types";
|
|
5243
5259
|
|
|
@@ -5254,12 +5270,15 @@ const unknownRecordSchema`
|
|
|
5254
5270
|
).replaceAll(
|
|
5255
5271
|
"handId: handIdSchema as unknown as z.ZodType<HandId>,",
|
|
5256
5272
|
"handId: assumeManifestSchema<HandId>(handIdSchema),"
|
|
5273
|
+
).replace(
|
|
5274
|
+
" type StaticBoards,\n",
|
|
5275
|
+
" type StaticBoards,\n type StaticBoardsJsonEnvelope,\n"
|
|
5257
5276
|
).replace(
|
|
5258
5277
|
/export const staticBoards = ([\s\S]*?) as const;\n\nconst baseInitialTable = /,
|
|
5259
|
-
"
|
|
5278
|
+
'type GeneratedStaticBoards = Pick<PublicTableState["boards"], "byId" | "hex" | "square">;\ntype GeneratedStaticBoardsJsonEnvelope = Omit<StaticBoardsJsonEnvelope<TableState>, "boards"> & {\n boards: GeneratedStaticBoards;\n};\nconst manifestStaticData = staticBoardsData as unknown as GeneratedStaticBoardsJsonEnvelope;\nexport const staticBoards = manifestStaticData.boards;\n\nconst baseInitialTable = '
|
|
5260
5279
|
).replace(
|
|
5261
|
-
/const baseInitialTable = ([\s\S]*?) as const as unknown as TableState;\nconst baseDeckCardsByZoneId
|
|
5262
|
-
"const baseInitialTable = cloneManifestDefault<
|
|
5280
|
+
/const baseInitialTable = ([\s\S]*?) as const as unknown as TableState;\nconst baseDeckCardsByZoneId =/,
|
|
5281
|
+
"const baseInitialTable = cloneManifestDefault<TableState>(manifestStaticData.initialTable);\nconst baseDeckCardsByZoneId ="
|
|
5263
5282
|
).replace(
|
|
5264
5283
|
"staticBoards: staticBoards as unknown as StaticBoards<TableState>,",
|
|
5265
5284
|
"staticBoards,"
|
|
@@ -5406,8 +5425,8 @@ function renderManifestTypesSource(manifest) {
|
|
|
5406
5425
|
).join("\n");
|
|
5407
5426
|
return `${generatedFileBanner}
|
|
5408
5427
|
|
|
5428
|
+
import type { PerPlayer } from "@dreamboard-games/sdk/reducer";
|
|
5409
5429
|
import type {
|
|
5410
|
-
PerPlayer,
|
|
5411
5430
|
RuntimeCardData,
|
|
5412
5431
|
RuntimeCardVisibility,
|
|
5413
5432
|
RuntimeComponentLocation,
|
|
@@ -5416,7 +5435,7 @@ import type {
|
|
|
5416
5435
|
RuntimePieceData,
|
|
5417
5436
|
RuntimeRecord,
|
|
5418
5437
|
RuntimeTableRecord,
|
|
5419
|
-
} from "@dreamboard-games/sdk/reducer";
|
|
5438
|
+
} from "@dreamboard-games/sdk/reducer/advanced";
|
|
5420
5439
|
import { literals } from "./manifest-literals";
|
|
5421
5440
|
|
|
5422
5441
|
export type PlayerId = (typeof literals.playerIds)[number];
|
|
@@ -5643,9 +5662,19 @@ export { default } from "./manifest-runtime";
|
|
|
5643
5662
|
}
|
|
5644
5663
|
function generateManifestContractSources(manifest) {
|
|
5645
5664
|
const legacySource = renderManifestContractSource(manifest);
|
|
5665
|
+
const initialTableTemplate = materializeManifestTable({
|
|
5666
|
+
manifest,
|
|
5667
|
+
playerIds: analyzeManifest(manifest).playerIds,
|
|
5668
|
+
shuffleItems: (values) => [...values]
|
|
5669
|
+
});
|
|
5670
|
+
const staticBoardsEnvelope = createManifestStaticJsonEnvelope(
|
|
5671
|
+
createManifestStaticBoardsData(initialTableTemplate),
|
|
5672
|
+
initialTableTemplate
|
|
5673
|
+
);
|
|
5646
5674
|
return {
|
|
5647
5675
|
"shared/manifest-literals.ts": renderManifestLiteralsSource(legacySource),
|
|
5648
5676
|
"shared/manifest-types.ts": renderManifestTypesSource(manifest),
|
|
5677
|
+
"shared/manifest-static.json": renderManifestStaticJsonSource(staticBoardsEnvelope),
|
|
5649
5678
|
"shared/manifest-runtime.ts": renderManifestRuntimeSource(legacySource),
|
|
5650
5679
|
"shared/manifest-contract.ts": renderManifestContractBarrelSource(legacySource)
|
|
5651
5680
|
};
|
|
@@ -6277,7 +6306,7 @@ function validateManifestAuthoring(manifest) {
|
|
|
6277
6306
|
|
|
6278
6307
|
// ../workspace-codegen/src/ownership.ts
|
|
6279
6308
|
var WORKSPACE_CODEGEN_OWNERSHIP = {
|
|
6280
|
-
version:
|
|
6309
|
+
version: 30,
|
|
6281
6310
|
allowedPaths: {
|
|
6282
6311
|
rootFiles: [
|
|
6283
6312
|
".npmrc",
|
|
@@ -6294,6 +6323,7 @@ var WORKSPACE_CODEGEN_OWNERSHIP = {
|
|
|
6294
6323
|
generatedFiles: [
|
|
6295
6324
|
"shared/manifest-literals.ts",
|
|
6296
6325
|
"shared/manifest-types.ts",
|
|
6326
|
+
"shared/manifest-static.json",
|
|
6297
6327
|
"shared/manifest-runtime.ts",
|
|
6298
6328
|
"shared/manifest-contract.ts",
|
|
6299
6329
|
"shared/generated/ui-contract.ts",
|
|
@@ -6305,6 +6335,7 @@ var WORKSPACE_CODEGEN_OWNERSHIP = {
|
|
|
6305
6335
|
"app/README.md",
|
|
6306
6336
|
"ui/App.tsx",
|
|
6307
6337
|
"app/game-contract.ts",
|
|
6338
|
+
"app/authoring.ts",
|
|
6308
6339
|
"app/game.ts",
|
|
6309
6340
|
"app/setup-profiles.ts",
|
|
6310
6341
|
"app/reducer-support.ts",
|
|
@@ -6386,7 +6417,7 @@ function generateUiContractContent() {
|
|
|
6386
6417
|
import game from "../../app/game";
|
|
6387
6418
|
import {
|
|
6388
6419
|
createClientParamSchemasByPhase,
|
|
6389
|
-
} from "@dreamboard-games/sdk/reducer";
|
|
6420
|
+
} from "@dreamboard-games/sdk/reducer/advanced";
|
|
6390
6421
|
import type {
|
|
6391
6422
|
CardInputZoneIdsOfDefinition,
|
|
6392
6423
|
ClientParamsOfInteractionOfDefinition,
|
|
@@ -6398,7 +6429,7 @@ import type {
|
|
|
6398
6429
|
StageNamesOfDefinitionPhase,
|
|
6399
6430
|
ViewNamesOfDefinition,
|
|
6400
6431
|
ViewOfDefinition,
|
|
6401
|
-
} from "@dreamboard-games/sdk/reducer";
|
|
6432
|
+
} from "@dreamboard-games/sdk/reducer/advanced";
|
|
6402
6433
|
import {
|
|
6403
6434
|
type BoardSpaceIdOf,
|
|
6404
6435
|
type InteractionVisualState,
|
|
@@ -6514,7 +6545,7 @@ export type InteractionIdForPhase<Phase extends PhaseName> =
|
|
|
6514
6545
|
|
|
6515
6546
|
/**
|
|
6516
6547
|
* Client-facing params type for an interaction, inferred from its input
|
|
6517
|
-
* collectors. Engine-sampled collectors
|
|
6548
|
+
* collectors. Engine-sampled collectors are omitted
|
|
6518
6549
|
* \u2014 the trusted reducer bundle fills those fields during submit, so the
|
|
6519
6550
|
* client never supplies them.
|
|
6520
6551
|
*/
|
|
@@ -7633,6 +7664,7 @@ Use this layout while the game is small:
|
|
|
7633
7664
|
\`\`\`txt
|
|
7634
7665
|
app/
|
|
7635
7666
|
game-contract.ts
|
|
7667
|
+
authoring.ts
|
|
7636
7668
|
game.ts
|
|
7637
7669
|
derived.ts
|
|
7638
7670
|
reducer-support.ts
|
|
@@ -7645,7 +7677,7 @@ contents and split the implementation by game concept:
|
|
|
7645
7677
|
|
|
7646
7678
|
\`\`\`txt
|
|
7647
7679
|
app/phases/player-turn/
|
|
7648
|
-
index.ts #
|
|
7680
|
+
index.ts # bound phase assembly only
|
|
7649
7681
|
state.ts # phase-local constants and types
|
|
7650
7682
|
inputs.ts # shared input and presentation helpers
|
|
7651
7683
|
build.ts # build interactions
|
|
@@ -7655,7 +7687,7 @@ app/phases/player-turn/
|
|
|
7655
7687
|
|
|
7656
7688
|
Split a phase when it has multiple action families, shared input helpers, card
|
|
7657
7689
|
actions, or is roughly 250-300 lines. Keep \`index.ts\` as the assembly point
|
|
7658
|
-
that imports interactions and registers them with
|
|
7690
|
+
that imports interactions and registers them with its bound phase object.
|
|
7659
7691
|
|
|
7660
7692
|
Do not turn \`reducer-support.ts\` into a catch-all rule module. Keep it small
|
|
7661
7693
|
for shared reducer plumbing; put real game rules under \`app/rules/*\` once
|
|
@@ -7716,23 +7748,29 @@ export const gameContract = defineGameContract({
|
|
|
7716
7748
|
phases: {
|
|
7717
7749
|
setup: z.object({}),
|
|
7718
7750
|
},
|
|
7751
|
+
errors: {},
|
|
7719
7752
|
});
|
|
7720
7753
|
|
|
7721
7754
|
export type GameContract = typeof gameContract;
|
|
7722
7755
|
export type GameState = GameStateOf<GameContract>;
|
|
7723
7756
|
`;
|
|
7724
7757
|
}
|
|
7725
|
-
function
|
|
7726
|
-
return `import {
|
|
7758
|
+
function generateReducerAuthoringSeed() {
|
|
7759
|
+
return `import { createContractAuthoring } from "@dreamboard-games/sdk/reducer";
|
|
7727
7760
|
import { gameContract } from "./game-contract";
|
|
7761
|
+
|
|
7762
|
+
export const authoring = createContractAuthoring(gameContract);
|
|
7763
|
+
`;
|
|
7764
|
+
}
|
|
7765
|
+
function generateReducerGameSeed() {
|
|
7766
|
+
return `import { authoring } from "./authoring";
|
|
7728
7767
|
import { phases } from "./phases";
|
|
7729
7768
|
import setupProfiles from "./setup-profiles";
|
|
7730
7769
|
|
|
7731
7770
|
// Keep this file as the defineGame assembly point. Put rules in phases,
|
|
7732
7771
|
// projections in views/derived modules, and reusable domain helpers in
|
|
7733
7772
|
// app/rules/* once reducer-support.ts is no longer small.
|
|
7734
|
-
export default
|
|
7735
|
-
contract: gameContract,
|
|
7773
|
+
export default authoring.game({
|
|
7736
7774
|
initial: {
|
|
7737
7775
|
public: ({ playerIds }) => ({
|
|
7738
7776
|
currentPlayerId: playerIds[0] ?? null,
|
|
@@ -7773,34 +7811,28 @@ function isFrameworkOwnedSetupProfilesSeed(content) {
|
|
|
7773
7811
|
return false;
|
|
7774
7812
|
}
|
|
7775
7813
|
function generateSetupPhaseSeed() {
|
|
7776
|
-
return `import {
|
|
7777
|
-
import type { GameContract, GameState } from "../game-contract";
|
|
7778
|
-
import {
|
|
7779
|
-
defineInteraction,
|
|
7780
|
-
definePhase,
|
|
7781
|
-
formInput,
|
|
7782
|
-
} from "@dreamboard-games/sdk/reducer";
|
|
7814
|
+
return `import { authoring } from "../authoring";
|
|
7783
7815
|
import { edit } from "../reducer-support";
|
|
7784
7816
|
|
|
7817
|
+
const setup = authoring.phase("setup");
|
|
7818
|
+
|
|
7785
7819
|
const setupMoodChoices = [
|
|
7786
7820
|
{ value: "ready", label: "Ready" },
|
|
7787
7821
|
{ value: "exploring", label: "Exploring" },
|
|
7788
7822
|
] as const;
|
|
7789
7823
|
type SetupMood = (typeof setupMoodChoices)[number]["value"];
|
|
7790
|
-
const setupPhaseStateSchema = z.object({});
|
|
7791
7824
|
|
|
7792
7825
|
// A single phase file is fine while the phase is small. When a phase grows
|
|
7793
7826
|
// multiple action families, move it to app/phases/<phase>/index.ts and split
|
|
7794
7827
|
// interactions into neighboring concept files.
|
|
7795
|
-
export const
|
|
7828
|
+
export const setupPhase = setup.define({
|
|
7796
7829
|
kind: "player",
|
|
7797
|
-
state: setupPhaseStateSchema,
|
|
7798
7830
|
initialState: () => ({}),
|
|
7799
7831
|
actor: ({ state }) => state.publicState.currentPlayerId,
|
|
7800
7832
|
interactions: {
|
|
7801
|
-
submit:
|
|
7833
|
+
submit: setup.interaction({
|
|
7802
7834
|
inputs: {
|
|
7803
|
-
mood:
|
|
7835
|
+
mood: setup.inputs.form.choice<SetupMood>({
|
|
7804
7836
|
choices: setupMoodChoices,
|
|
7805
7837
|
defaultValue: "ready",
|
|
7806
7838
|
}),
|
|
@@ -7821,12 +7853,12 @@ export const setup = definePhase<GameContract>()({
|
|
|
7821
7853
|
`;
|
|
7822
7854
|
}
|
|
7823
7855
|
function generatePhaseIndexSeed() {
|
|
7824
|
-
return `import {
|
|
7856
|
+
return `import { setupPhase } from "./setup";
|
|
7825
7857
|
import type { GameContract } from "../game-contract";
|
|
7826
7858
|
import type { PhaseMapOf } from "@dreamboard-games/sdk/reducer";
|
|
7827
7859
|
|
|
7828
7860
|
export const phases = {
|
|
7829
|
-
setup,
|
|
7861
|
+
setup: setupPhase,
|
|
7830
7862
|
} satisfies PhaseMapOf<GameContract>;
|
|
7831
7863
|
`;
|
|
7832
7864
|
}
|
|
@@ -7844,6 +7876,7 @@ function generateAppFrameworkTsConfig() {
|
|
|
7844
7876
|
target: "ES2020",
|
|
7845
7877
|
module: "ESNext",
|
|
7846
7878
|
moduleResolution: "bundler",
|
|
7879
|
+
resolveJsonModule: true,
|
|
7847
7880
|
strict: true,
|
|
7848
7881
|
esModuleInterop: true,
|
|
7849
7882
|
skipLibCheck: false,
|
|
@@ -7861,7 +7894,8 @@ function generateAppFrameworkTsConfig() {
|
|
|
7861
7894
|
"./**/*.ts",
|
|
7862
7895
|
"./**/*.d.ts",
|
|
7863
7896
|
"../shared/manifest-*.ts",
|
|
7864
|
-
"../shared/manifest-*.d.ts"
|
|
7897
|
+
"../shared/manifest-*.d.ts",
|
|
7898
|
+
"../shared/manifest-*.json"
|
|
7865
7899
|
],
|
|
7866
7900
|
exclude: ["node_modules", "dist", "../shared/generated"]
|
|
7867
7901
|
},
|
|
@@ -7877,6 +7911,7 @@ function generateUiFrameworkTsConfig() {
|
|
|
7877
7911
|
target: "ES2020",
|
|
7878
7912
|
module: "ESNext",
|
|
7879
7913
|
moduleResolution: "bundler",
|
|
7914
|
+
resolveJsonModule: true,
|
|
7880
7915
|
jsx: "react-jsx",
|
|
7881
7916
|
strict: true,
|
|
7882
7917
|
esModuleInterop: true,
|
|
@@ -7888,7 +7923,12 @@ function generateUiFrameworkTsConfig() {
|
|
|
7888
7923
|
"@shared/*": ["../shared/*"]
|
|
7889
7924
|
}
|
|
7890
7925
|
},
|
|
7891
|
-
include: [
|
|
7926
|
+
include: [
|
|
7927
|
+
"./**/*.ts",
|
|
7928
|
+
"./**/*.tsx",
|
|
7929
|
+
"../shared/**/*.ts",
|
|
7930
|
+
"../shared/**/*.json"
|
|
7931
|
+
],
|
|
7892
7932
|
exclude: ["node_modules", "dist"]
|
|
7893
7933
|
},
|
|
7894
7934
|
null,
|
|
@@ -8031,6 +8071,7 @@ function generateSeedFiles(manifest) {
|
|
|
8031
8071
|
"ui/styles.ts": generateReducerUiStylesContent(),
|
|
8032
8072
|
"ui/ui-contract-typing-smoke.tsx": generateReducerUiContractTypingSmokeContent(),
|
|
8033
8073
|
"app/game-contract.ts": generateReducerGameContractSeed(),
|
|
8074
|
+
"app/authoring.ts": generateReducerAuthoringSeed(),
|
|
8034
8075
|
"app/game.ts": generateReducerGameSeed(),
|
|
8035
8076
|
"app/setup-profiles.ts": generateSetupProfilesSeed(manifest),
|
|
8036
8077
|
"app/reducer-support.ts": generateReducerSupportSeed(),
|
|
@@ -8086,4 +8127,4 @@ export {
|
|
|
8086
8127
|
generateAuthoritativeFiles,
|
|
8087
8128
|
generateDynamicGeneratedFiles
|
|
8088
8129
|
};
|
|
8089
|
-
//# sourceMappingURL=chunk-
|
|
8130
|
+
//# sourceMappingURL=chunk-NBAEEHAU.js.map
|