@dreamboard-games/sdk 0.4.0-alpha.4 → 0.4.0-alpha.6
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 +1089 -123
- package/dist/{HandView-x8MhbhFl.d.ts → HandView-Bi2lxzQP.d.ts} +3 -3
- package/dist/{ThemeProvider-DRalAWzY.d.ts → ThemeProvider-CElaL2ik.d.ts} +1 -1
- package/dist/authoring/index.js +2 -2
- package/dist/browser-interaction.js +1 -1
- package/dist/{chunk-E3X552YM.js → chunk-2TRZSZGD.js} +1061 -425
- package/dist/chunk-2TRZSZGD.js.map +1 -0
- package/dist/{chunk-CP35NPPY.js → chunk-52DH7VQF.js} +61 -7
- package/dist/chunk-52DH7VQF.js.map +1 -0
- package/dist/{chunk-N6ZDIMRB.js → chunk-B2YBS3SG.js} +1 -1
- package/dist/chunk-B2YBS3SG.js.map +1 -0
- package/dist/{chunk-LKJLAGND.js → chunk-DDST4U2P.js} +2 -2
- package/dist/{chunk-SUMZ5OEH.js → chunk-HK3WN4U7.js} +2 -2
- package/dist/{chunk-SUMZ5OEH.js.map → chunk-HK3WN4U7.js.map} +1 -1
- package/dist/{chunk-QOFFRHZR.js → chunk-OV6JC2BM.js} +64 -28
- package/dist/chunk-OV6JC2BM.js.map +1 -0
- package/dist/{chunk-K5ZRJTZZ.js → chunk-PAPIAMYX.js} +6 -3
- package/dist/chunk-PAPIAMYX.js.map +1 -0
- package/dist/{chunk-TTISZQNI.js → chunk-SOBNI363.js} +39 -28
- package/dist/chunk-SOBNI363.js.map +1 -0
- package/dist/{chunk-Y6Y2YABD.js → chunk-TGMXBRKY.js} +22 -6
- package/dist/chunk-TGMXBRKY.js.map +1 -0
- package/dist/{chunk-XZ667T4K.js → chunk-UC2UXAC6.js} +2 -2
- package/dist/{chunk-O6M6PN4E.js → chunk-UUQNOGZV.js} +94 -53
- package/dist/chunk-UUQNOGZV.js.map +1 -0
- package/dist/{chunk-WUIVY2KE.js → chunk-WHR5UW3F.js} +1 -1
- package/dist/chunk-WHR5UW3F.js.map +1 -0
- package/dist/codegen.d.ts +13 -0
- package/dist/codegen.js +1 -1
- package/dist/{components-B7hFaEn_.d.ts → components-BTwSIjXj.d.ts} +77 -206
- package/dist/{hex-board-view-BFlWDb9k.d.ts → hex-board-view-aKkblDp6.d.ts} +180 -1
- package/dist/{index-gjxQichK.d.ts → index-CFTjJIXd.d.ts} +5 -4
- package/dist/{index.d-BL3bT5lt.d.ts → index.d-DMASeF6M.d.ts} +294 -27
- package/dist/index.js +2 -2
- package/dist/package-set.d.ts +2 -2
- package/dist/package-set.js +2 -2
- package/dist/{runtime-api-BJharVaj.d.ts → plugin-state-BRH3UiUp.d.ts} +19 -3
- package/dist/{protocol-BP193lva.d.ts → protocol-835hEGne.d.ts} +42 -1
- package/dist/reducer/advanced.d.ts +4 -2
- package/dist/reducer/advanced.js +1 -1
- package/dist/reducer-contract.d.ts +1 -1
- package/dist/reducer-contract.js +2 -2
- package/dist/reducer.d.ts +10 -4
- package/dist/reducer.js +317 -15
- package/dist/reducer.js.map +1 -1
- package/dist/runtime/primitives.d.ts +32 -7
- package/dist/runtime/primitives.js +9 -5
- package/dist/runtime/runtime-api.d.ts +1 -1
- package/dist/runtime/workspace-contract.d.ts +7 -7
- package/dist/runtime/workspace-contract.js +6 -6
- package/dist/runtime-Dkfm1x2r.d.ts +1670 -0
- package/dist/runtime.d.ts +10 -9
- package/dist/runtime.js +240 -16
- package/dist/runtime.js.map +1 -1
- package/dist/testing.d.ts +78 -15
- package/dist/testing.js +69 -8
- package/dist/testing.js.map +1 -1
- package/dist/{types-CYeN0wLK.d.ts → types-aI4V9CWe.d.ts} +5 -5
- package/dist/types.d.ts +13 -0
- package/dist/ui/components.d.ts +6 -3
- package/dist/ui/components.js +15 -3
- package/dist/ui/plugin-styles.css +2 -2
- package/dist/{ui-contract-B4NjRlvC.d.ts → ui-contract-Ue6SywvO.d.ts} +24 -10
- package/dist/ui.d.ts +9 -6
- package/dist/ui.js +16 -4
- package/dist/views-32rSsfeU.d.ts +1559 -0
- package/package.json +21 -20
- package/dist/chunk-CP35NPPY.js.map +0 -1
- package/dist/chunk-E3X552YM.js.map +0 -1
- package/dist/chunk-K5ZRJTZZ.js.map +0 -1
- package/dist/chunk-N6ZDIMRB.js.map +0 -1
- package/dist/chunk-O6M6PN4E.js.map +0 -1
- package/dist/chunk-QOFFRHZR.js.map +0 -1
- package/dist/chunk-TTISZQNI.js.map +0 -1
- package/dist/chunk-WUIVY2KE.js.map +0 -1
- package/dist/chunk-Y6Y2YABD.js.map +0 -1
- package/dist/views-fn2RuXOx.d.ts +0 -3168
- /package/dist/{chunk-LKJLAGND.js.map → chunk-DDST4U2P.js.map} +0 -0
- /package/dist/{chunk-XZ667T4K.js.map → chunk-UC2UXAC6.js.map} +0 -0
package/dist/runtime.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { C as ClientParamSchemaMap, W as WorkspaceBoardSurface, a as WorkspaceBoardSurfaceDescriptor, b as WorkspaceBoardTargetInputSlot, c as WorkspaceCardCollectionSurface, d as WorkspaceCardCollectionSurfaceDescriptor, e as WorkspaceCardInputSlot, f as WorkspaceFormInputSlot, g as WorkspaceHandSurface, h as WorkspaceHandSurfaceDescriptor, i as WorkspaceInteractionFormDescriptor, j as WorkspaceInteractionFormsDescriptor, k as WorkspaceInteractionSlotComponent, l as WorkspacePileSurface, m as WorkspacePileSurfaceDescriptor, n as WorkspacePilesSurfaceDescriptor, o as WorkspaceSurfaceSpec, p as createWorkspaceUIContract } from './index-
|
|
1
|
+
import { b5 as UIContract$1, G as DreamboardUI$1, b3 as TypedGame$1 } from './ui-contract-Ue6SywvO.js';
|
|
2
|
+
export { c as BoardGridInteractionFilter, g as BoardHexGridProps, i as BoardHexViewProps, m as BoardSpaceTargetProps, o as BoardSquareGridInteractionFilter, p as BoardSquareGridProps, M as GameMeState, Q as GamePlayersState, R as GameRenderState, U as GameTurnState, b7 as UIRootProps, bh as ZoneCardRenderItem, bl as ZoneListProps } from './ui-contract-Ue6SywvO.js';
|
|
3
|
+
export { C as ClientParamSchemaMap, W as WorkspaceBoardSurface, a as WorkspaceBoardSurfaceDescriptor, b as WorkspaceBoardTargetInputSlot, c as WorkspaceCardCollectionSurface, d as WorkspaceCardCollectionSurfaceDescriptor, e as WorkspaceCardInputSlot, f as WorkspaceFormInputSlot, g as WorkspaceHandSurface, h as WorkspaceHandSurfaceDescriptor, i as WorkspaceInteractionFormDescriptor, j as WorkspaceInteractionFormsDescriptor, k as WorkspaceInteractionSlotComponent, l as WorkspacePileSurface, m as WorkspacePileSurfaceDescriptor, n as WorkspacePilesSurfaceDescriptor, o as WorkspaceSurfaceSpec, p as createWorkspaceUIContract } from './index-CFTjJIXd.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import react__default from 'react';
|
|
6
6
|
import { c as RuntimeDiagnosticHandler } from './runtime-api-C6aWo9c0.js';
|
|
7
|
-
import { P as PluginRuntimeClient, a as PluginRuntimeClientOptions, b as PluginTransport } from './types-
|
|
8
|
-
export { R as RuntimeClock, c as RuntimeIdFactory } from './types-
|
|
9
|
-
export { a as InteractionDescriptor } from './
|
|
7
|
+
import { P as PluginRuntimeClient, a as PluginRuntimeClientOptions, b as PluginTransport } from './types-aI4V9CWe.js';
|
|
8
|
+
export { R as RuntimeClock, c as RuntimeIdFactory } from './types-aI4V9CWe.js';
|
|
9
|
+
export { G as GameEvent, a as GameEventDetail, b as InteractionDescriptor, P as ProjectedGameEvent, S as SystemActionEvent } from './plugin-state-BRH3UiUp.js';
|
|
10
10
|
export { b as ResourceCounterComponents } from './ResourceCounter-BFxJknqp.js';
|
|
11
|
-
import './hex-board-view-
|
|
11
|
+
import './hex-board-view-aKkblDp6.js';
|
|
12
12
|
import './player-state-Cqpyeql0.js';
|
|
13
13
|
import './types.js';
|
|
14
|
-
import './ThemeProvider-
|
|
14
|
+
import './ThemeProvider-CElaL2ik.js';
|
|
15
15
|
import './primitive-props-BNHDkgd7.js';
|
|
16
16
|
import './attributes-DbvyMbXw.js';
|
|
17
17
|
import './types-DJj5MJkl.js';
|
|
18
|
-
import './protocol-
|
|
18
|
+
import './protocol-835hEGne.js';
|
|
19
19
|
|
|
20
20
|
interface PluginRuntimeProps {
|
|
21
21
|
/** Child components to render after gameplay frame has started */
|
|
@@ -64,6 +64,7 @@ declare function createPluginRuntimeClient(options: PluginRuntimeClientOptions):
|
|
|
64
64
|
interface PostMessagePluginTransportOptions {
|
|
65
65
|
readonly targetWindow?: Window;
|
|
66
66
|
readonly parentWindow?: Window;
|
|
67
|
+
readonly bundledSdkVersion?: string;
|
|
67
68
|
readonly onInvalidMessage?: (reason: string, value: unknown) => void;
|
|
68
69
|
}
|
|
69
70
|
declare function createPostMessagePluginTransport(options?: PostMessagePluginTransportOptions): PluginTransport;
|
package/dist/runtime.js
CHANGED
|
@@ -1,35 +1,253 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createWorkspaceUIContract
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-SOBNI363.js";
|
|
4
|
+
import "./chunk-OV6JC2BM.js";
|
|
5
|
+
import "./chunk-UC2UXAC6.js";
|
|
6
6
|
import "./chunk-T3ZKNUZ7.js";
|
|
7
7
|
import {
|
|
8
8
|
GameSkeleton
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2TRZSZGD.js";
|
|
10
10
|
import "./chunk-VDXOF4FW.js";
|
|
11
11
|
import {
|
|
12
12
|
PluginRuntimeBoundary,
|
|
13
13
|
createPluginRuntimeClient
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PAPIAMYX.js";
|
|
15
15
|
import {
|
|
16
16
|
DREAMBOARD_PLUGIN_PROTOCOL,
|
|
17
17
|
DREAMBOARD_PLUGIN_PROTOCOL_VERSION,
|
|
18
18
|
HostToPluginEnvelopeSchema
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-UUQNOGZV.js";
|
|
20
|
+
import "./chunk-WHR5UW3F.js";
|
|
21
21
|
import "./chunk-PF7L4BMG.js";
|
|
22
22
|
import "./chunk-PZ5AY32C.js";
|
|
23
23
|
|
|
24
24
|
// src/runtime/hooks/usePluginRuntime.ts
|
|
25
25
|
import { useState, useEffect, useRef } from "react";
|
|
26
26
|
|
|
27
|
+
// package.json
|
|
28
|
+
var package_default = {
|
|
29
|
+
name: "@dreamboard-games/sdk",
|
|
30
|
+
version: "0.4.0-alpha.6",
|
|
31
|
+
description: "Dreamboard SDK package set metadata and public facade",
|
|
32
|
+
type: "module",
|
|
33
|
+
main: "./dist/index.js",
|
|
34
|
+
types: "./dist/index.d.ts",
|
|
35
|
+
exports: {
|
|
36
|
+
".": {
|
|
37
|
+
types: "./dist/index.d.ts",
|
|
38
|
+
import: "./dist/index.js",
|
|
39
|
+
default: "./dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./package-set": {
|
|
42
|
+
types: "./dist/package-set.d.ts",
|
|
43
|
+
import: "./dist/package-set.js",
|
|
44
|
+
default: "./dist/package-set.js"
|
|
45
|
+
},
|
|
46
|
+
"./types": {
|
|
47
|
+
types: "./dist/types.d.ts",
|
|
48
|
+
import: "./dist/types.js",
|
|
49
|
+
default: "./dist/types.js"
|
|
50
|
+
},
|
|
51
|
+
"./reducer": {
|
|
52
|
+
types: "./dist/reducer.d.ts",
|
|
53
|
+
import: "./dist/reducer.js",
|
|
54
|
+
default: "./dist/reducer.js"
|
|
55
|
+
},
|
|
56
|
+
"./reducer/advanced": {
|
|
57
|
+
types: "./dist/reducer/advanced.d.ts",
|
|
58
|
+
import: "./dist/reducer/advanced.js",
|
|
59
|
+
default: "./dist/reducer/advanced.js"
|
|
60
|
+
},
|
|
61
|
+
"./ui": {
|
|
62
|
+
types: "./dist/ui.d.ts",
|
|
63
|
+
import: "./dist/ui.js",
|
|
64
|
+
default: "./dist/ui.js"
|
|
65
|
+
},
|
|
66
|
+
"./ui/components": {
|
|
67
|
+
types: "./dist/ui/components.d.ts",
|
|
68
|
+
import: "./dist/ui/components.js",
|
|
69
|
+
default: "./dist/ui/components.js"
|
|
70
|
+
},
|
|
71
|
+
"./ui/defaults": {
|
|
72
|
+
types: "./dist/ui/defaults.d.ts",
|
|
73
|
+
import: "./dist/ui/defaults.js",
|
|
74
|
+
default: "./dist/ui/defaults.js"
|
|
75
|
+
},
|
|
76
|
+
"./ui/player-state": {
|
|
77
|
+
types: "./dist/ui/player-state.d.ts",
|
|
78
|
+
import: "./dist/ui/player-state.js",
|
|
79
|
+
default: "./dist/ui/player-state.js"
|
|
80
|
+
},
|
|
81
|
+
"./ui/plugin-styles.css": {
|
|
82
|
+
default: "./dist/ui/plugin-styles.css"
|
|
83
|
+
},
|
|
84
|
+
"./runtime": {
|
|
85
|
+
types: "./dist/runtime.d.ts",
|
|
86
|
+
import: "./dist/runtime.js",
|
|
87
|
+
default: "./dist/runtime.js"
|
|
88
|
+
},
|
|
89
|
+
"./runtime/primitives": {
|
|
90
|
+
types: "./dist/runtime/primitives.d.ts",
|
|
91
|
+
import: "./dist/runtime/primitives.js",
|
|
92
|
+
default: "./dist/runtime/primitives.js"
|
|
93
|
+
},
|
|
94
|
+
"./runtime/workspace-contract": {
|
|
95
|
+
types: "./dist/runtime/workspace-contract.d.ts",
|
|
96
|
+
import: "./dist/runtime/workspace-contract.js",
|
|
97
|
+
default: "./dist/runtime/workspace-contract.js"
|
|
98
|
+
},
|
|
99
|
+
"./runtime/runtime-api": {
|
|
100
|
+
types: "./dist/runtime/runtime-api.d.ts",
|
|
101
|
+
import: "./dist/runtime/runtime-api.js",
|
|
102
|
+
default: "./dist/runtime/runtime-api.js"
|
|
103
|
+
},
|
|
104
|
+
"./codegen": {
|
|
105
|
+
types: "./dist/codegen.d.ts",
|
|
106
|
+
import: "./dist/codegen.js",
|
|
107
|
+
default: "./dist/codegen.js"
|
|
108
|
+
},
|
|
109
|
+
"./authoring": {
|
|
110
|
+
types: "./dist/authoring/index.d.ts",
|
|
111
|
+
import: "./dist/authoring/index.js",
|
|
112
|
+
default: "./dist/authoring/index.js"
|
|
113
|
+
},
|
|
114
|
+
"./reducer-contract": {
|
|
115
|
+
types: "./dist/reducer-contract.d.ts",
|
|
116
|
+
import: "./dist/reducer-contract.js",
|
|
117
|
+
default: "./dist/reducer-contract.js"
|
|
118
|
+
},
|
|
119
|
+
"./testing": {
|
|
120
|
+
types: "./dist/testing.d.ts",
|
|
121
|
+
import: "./dist/testing.js",
|
|
122
|
+
default: "./dist/testing.js"
|
|
123
|
+
},
|
|
124
|
+
"./browser-interaction": {
|
|
125
|
+
bun: "./src/browser-interaction.ts",
|
|
126
|
+
types: "./dist/browser-interaction.d.ts",
|
|
127
|
+
import: "./dist/browser-interaction.js",
|
|
128
|
+
default: "./dist/browser-interaction.js"
|
|
129
|
+
},
|
|
130
|
+
"./package.json": "./package.json"
|
|
131
|
+
},
|
|
132
|
+
files: [
|
|
133
|
+
"LICENSE.md",
|
|
134
|
+
"dist",
|
|
135
|
+
"README.md",
|
|
136
|
+
"REFERENCE.md",
|
|
137
|
+
"!.turbo/**",
|
|
138
|
+
"!tsconfig.tsbuildinfo"
|
|
139
|
+
],
|
|
140
|
+
scripts: {
|
|
141
|
+
build: "pnpm --dir ../.. --filter @dreamboard-games/plugin-runtime-contract build && pnpm --dir ../.. authoring-metadata:generate && tsup && node ../../scripts/copy-sdk-private-dts.mjs && mkdir -p dist/ui && tailwindcss -i src/ui/plugin-styles.css -o dist/ui/plugin-styles.css --minify",
|
|
142
|
+
typecheck: "tsc --noEmit",
|
|
143
|
+
lint: "eslint 'src/**/*.{ts,tsx}'",
|
|
144
|
+
storybook: "storybook dev -p 6006 --host 127.0.0.1 --no-open",
|
|
145
|
+
"storybook:build": "storybook build -o storybook-static",
|
|
146
|
+
"storybook:test": 'concurrently -k -s first -n storybook,test "http-server storybook-static -p 6006 -s --silent" "wait-on tcp:6006 && test-storybook --url http://127.0.0.1:6006"',
|
|
147
|
+
"storybook:test:visual": "playwright test --config .storybook/visual-runner.config.ts",
|
|
148
|
+
"storybook:test:visual:update": "playwright test --config .storybook/visual-runner.config.ts --update-snapshots",
|
|
149
|
+
test: "bun test src"
|
|
150
|
+
},
|
|
151
|
+
dependencies: {
|
|
152
|
+
"@radix-ui/react-accordion": "^1.2.14",
|
|
153
|
+
"@radix-ui/react-dialog": "^1.1.17",
|
|
154
|
+
"@radix-ui/react-label": "^2.1.10",
|
|
155
|
+
"@radix-ui/react-select": "^2.3.1",
|
|
156
|
+
"@radix-ui/react-slot": "^1.3.0",
|
|
157
|
+
"@radix-ui/react-tooltip": "^1.2.10",
|
|
158
|
+
"@use-gesture/react": "^10.3.1",
|
|
159
|
+
clsx: "^2.1.1",
|
|
160
|
+
"lucide-react": "^1.20.0",
|
|
161
|
+
vaul: "^1.1.2",
|
|
162
|
+
zustand: "^5.0.14"
|
|
163
|
+
},
|
|
164
|
+
devDependencies: {
|
|
165
|
+
"@dreamboard-games/plugin-runtime-contract": "workspace:*",
|
|
166
|
+
"@dreamboard-games/reducer-contract": "workspace:*",
|
|
167
|
+
"@dreamboard-games/sdk-types": "workspace:*",
|
|
168
|
+
"@dreamboard-games/workspace-codegen": "workspace:*",
|
|
169
|
+
"@happy-dom/global-registrator": "^20.9.0",
|
|
170
|
+
"@playwright/test": "1.60.0",
|
|
171
|
+
"@storybook/addon-a11y": "^10.4.6",
|
|
172
|
+
"@storybook/addon-themes": "^10.4.6",
|
|
173
|
+
"@storybook/react-vite": "^10.4.6",
|
|
174
|
+
"@storybook/test-runner": "^0.24.4",
|
|
175
|
+
"@tailwindcss/cli": "^4.3.1",
|
|
176
|
+
"@tailwindcss/vite": "^4.3.1",
|
|
177
|
+
"@types/node": "^24.5.2",
|
|
178
|
+
"@types/react": "^19.0.0",
|
|
179
|
+
"@types/react-dom": "^19.0.0",
|
|
180
|
+
"axe-playwright": "2.2.2",
|
|
181
|
+
concurrently: "^9.1.0",
|
|
182
|
+
eslint: "^9.39.0",
|
|
183
|
+
"framer-motion": "^12.40.0",
|
|
184
|
+
"http-server": "^14.1.1",
|
|
185
|
+
playwright: "1.60.0",
|
|
186
|
+
react: "^19.2.0",
|
|
187
|
+
"react-dom": "^19.2.0",
|
|
188
|
+
storybook: "^10.4.6",
|
|
189
|
+
tailwindcss: "^4.3.1",
|
|
190
|
+
tsup: "^8.5.0",
|
|
191
|
+
typescript: "^5.9.2",
|
|
192
|
+
vite: "8.0.16",
|
|
193
|
+
"wait-on": "^8.0.1",
|
|
194
|
+
zod: "4.4.3"
|
|
195
|
+
},
|
|
196
|
+
peerDependencies: {
|
|
197
|
+
"framer-motion": "^11.0.0 || ^12.0.0",
|
|
198
|
+
react: "^19.0.0",
|
|
199
|
+
"react-dom": "^19.0.0",
|
|
200
|
+
zod: "^4.4.3"
|
|
201
|
+
},
|
|
202
|
+
publishConfig: {
|
|
203
|
+
access: "public"
|
|
204
|
+
},
|
|
205
|
+
repository: {
|
|
206
|
+
type: "git",
|
|
207
|
+
url: "git+https://github.com/dreamboard-games/dreamboard-sdk.git",
|
|
208
|
+
directory: "packages/sdk"
|
|
209
|
+
},
|
|
210
|
+
bugs: {
|
|
211
|
+
url: "https://github.com/dreamboard-games/dreamboard-sdk/issues"
|
|
212
|
+
},
|
|
213
|
+
homepage: "https://github.com/dreamboard-games/dreamboard-sdk#readme",
|
|
214
|
+
keywords: [
|
|
215
|
+
"dreamboard",
|
|
216
|
+
"sdk",
|
|
217
|
+
"package-set"
|
|
218
|
+
],
|
|
219
|
+
license: "SEE LICENSE IN LICENSE.md"
|
|
220
|
+
};
|
|
221
|
+
|
|
27
222
|
// src/runtime/browser/post-message-transport.ts
|
|
28
223
|
function createPostMessagePluginTransport(options = {}) {
|
|
29
224
|
const targetWindow = options.targetWindow ?? window;
|
|
30
225
|
const parentWindow = options.parentWindow ?? targetWindow.parent;
|
|
226
|
+
const bundledSdkVersion = options.bundledSdkVersion?.trim() || "unknown";
|
|
31
227
|
let channel = null;
|
|
32
228
|
let outboundSequence = 0;
|
|
229
|
+
let invalidEnvelopeReported = false;
|
|
230
|
+
const reportInvalidEnvelope = (reason, value) => {
|
|
231
|
+
options.onInvalidMessage?.(reason, value);
|
|
232
|
+
if (!channel || invalidEnvelopeReported) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
invalidEnvelopeReported = true;
|
|
236
|
+
channel.hostWindow.postMessage(
|
|
237
|
+
{
|
|
238
|
+
protocol: DREAMBOARD_PLUGIN_PROTOCOL,
|
|
239
|
+
version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,
|
|
240
|
+
channelId: channel.channelId,
|
|
241
|
+
sequence: ++outboundSequence,
|
|
242
|
+
payload: {
|
|
243
|
+
type: "runtime.error",
|
|
244
|
+
code: "host-runtime-protocol-mismatch",
|
|
245
|
+
message: `Plugin runtime rejected a host message (${reason}). Bundled @dreamboard-games/sdk version: ${bundledSdkVersion}. The host and plugin bundle may have incompatible SDK/runtime contract versions.`
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
channel.hostOrigin
|
|
249
|
+
);
|
|
250
|
+
};
|
|
33
251
|
return {
|
|
34
252
|
start(onMessage) {
|
|
35
253
|
const handleMessage = (event) => {
|
|
@@ -38,7 +256,7 @@ function createPostMessagePluginTransport(options = {}) {
|
|
|
38
256
|
}
|
|
39
257
|
const parseResult = HostToPluginEnvelopeSchema.safeParse(event.data);
|
|
40
258
|
if (!parseResult.success) {
|
|
41
|
-
|
|
259
|
+
reportInvalidEnvelope("invalid-envelope", event.data);
|
|
42
260
|
return;
|
|
43
261
|
}
|
|
44
262
|
const envelope = parseResult.data;
|
|
@@ -53,7 +271,7 @@ function createPostMessagePluginTransport(options = {}) {
|
|
|
53
271
|
};
|
|
54
272
|
}
|
|
55
273
|
if (envelope.channelId !== channel.channelId || event.origin !== channel.hostOrigin || event.source !== channel.hostWindow) {
|
|
56
|
-
|
|
274
|
+
reportInvalidEnvelope("channel-mismatch", event.data);
|
|
57
275
|
return;
|
|
58
276
|
}
|
|
59
277
|
onMessage(envelope);
|
|
@@ -83,26 +301,32 @@ function createPostMessagePluginTransport(options = {}) {
|
|
|
83
301
|
}
|
|
84
302
|
|
|
85
303
|
// src/runtime/hooks/usePluginRuntime.ts
|
|
304
|
+
var BUNDLED_SDK_VERSION = typeof package_default.version === "string" ? package_default.version : "unknown";
|
|
86
305
|
function hasProjectedView(runtime) {
|
|
87
306
|
const frame = runtime.getFrame();
|
|
88
307
|
return frame !== null && frame.view !== null && typeof frame.view !== "undefined";
|
|
89
308
|
}
|
|
90
309
|
function usePluginRuntime(options = {}) {
|
|
91
310
|
const { timeout = 1e4, onDiagnostic } = options;
|
|
311
|
+
const [error, setError] = useState(null);
|
|
92
312
|
const [runtime] = useState(
|
|
93
313
|
() => createPluginRuntimeClient({
|
|
94
314
|
transport: createPostMessagePluginTransport({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
message
|
|
99
|
-
|
|
100
|
-
|
|
315
|
+
bundledSdkVersion: BUNDLED_SDK_VERSION,
|
|
316
|
+
onInvalidMessage: (reason, value) => {
|
|
317
|
+
const message = `Plugin runtime rejected a host message (${reason}). Bundled @dreamboard-games/sdk version: ${BUNDLED_SDK_VERSION}. The host and plugin bundle may have incompatible SDK/runtime contract versions.`;
|
|
318
|
+
setError(message);
|
|
319
|
+
onDiagnostic?.({
|
|
320
|
+
type: "runtimeLog",
|
|
321
|
+
level: "warn",
|
|
322
|
+
message,
|
|
323
|
+
details: [value]
|
|
324
|
+
});
|
|
325
|
+
}
|
|
101
326
|
})
|
|
102
327
|
})
|
|
103
328
|
);
|
|
104
329
|
const [isReady, setIsReady] = useState(() => hasProjectedView(runtime));
|
|
105
|
-
const [error, setError] = useState(null);
|
|
106
330
|
const hasBeenReadyRef = useRef(false);
|
|
107
331
|
if (isReady) hasBeenReadyRef.current = true;
|
|
108
332
|
useEffect(() => {
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/runtime/hooks/usePluginRuntime.ts","../src/runtime/browser/post-message-transport.ts","../src/runtime/components/PluginRuntime.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from \"react\";\nimport { createPostMessagePluginTransport } from \"../browser/post-message-transport.js\";\nimport { createPluginRuntimeClient } from \"../core/create-plugin-runtime-client.js\";\nimport type { PluginRuntimeClient } from \"../core/types.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\n\nexport interface UsePluginRuntimeOptions {\n /**\n * Timeout in milliseconds to wait for the first gameplay frame.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\nexport interface UsePluginRuntimeResult {\n /** The transport-agnostic plugin runtime client. */\n runtime: PluginRuntimeClient;\n /** Whether the initial reducer-native snapshot is available and ready */\n isReady: boolean;\n /**\n * True when the plugin was ready before but the current snapshot has no\n * projected view — e.g. you've acted and are waiting on the rest of the\n * table in a simultaneous phase. Lets the loading affordance read as a\n * mid-game wait rather than a cold \"still loading\" stall.\n */\n waiting: boolean;\n /** Error message if initialization failed */\n error: string | null;\n}\n\nfunction hasProjectedView(runtime: PluginRuntimeClient): boolean {\n const frame = runtime.getFrame();\n return (\n frame !== null && frame.view !== null && typeof frame.view !== \"undefined\"\n );\n}\n\n/**\n * Hook that creates and manages a PluginRuntimeClient instance.\n *\n * This hook handles:\n * 1. Creating the runtime client\n * 2. Waiting for the first gameplay frame before setting isReady\n *\n * In the new architecture, the host only renders the plugin when a reducer-native\n * snapshot is available, so isReady should become true quickly after init.\n *\n * @example\n * ```tsx\n * function PluginRuntime({ children }: { children: React.ReactNode }) {\n * const { runtime, isReady, error } = usePluginRuntime();\n *\n * if (error) {\n * return <div>Error: {error}</div>;\n * }\n *\n * if (!isReady) {\n * return <GameSkeleton message=\"Waiting for game state...\" />;\n * }\n *\n * return <RuntimeProvider runtime={runtime}>{children}</RuntimeProvider>;\n * }\n * ```\n */\nexport function usePluginRuntime(\n options: UsePluginRuntimeOptions = {},\n): UsePluginRuntimeResult {\n const { timeout = 10000, onDiagnostic } = options;\n\n // Create runtime once and keep stable reference\n const [runtime] = useState<PluginRuntimeClient>(() =>\n createPluginRuntimeClient({\n transport: createPostMessagePluginTransport({\n onInvalidMessage: (reason, value) =>\n onDiagnostic?.({\n type: \"runtimeLog\",\n level: \"warn\",\n message: `[PluginRuntime] Ignored invalid host message: ${reason}`,\n details: [value],\n }),\n }),\n }),\n );\n const [isReady, setIsReady] = useState(() => hasProjectedView(runtime));\n const [error, setError] = useState<string | null>(null);\n // Latches once we've shown a view, so a later view-less snapshot reads as a\n // mid-game wait rather than a fresh load. (A ref, so it never re-triggers a\n // render on its own.)\n const hasBeenReadyRef = useRef(false);\n if (isReady) hasBeenReadyRef.current = true;\n\n useEffect(() => {\n void onDiagnostic;\n }, [onDiagnostic]);\n\n // Subscribe to gameplay frames and set isReady when the first projected view arrives.\n useEffect(() => {\n const markReadyFromFrame = () => {\n if (!hasProjectedView(runtime)) {\n return false;\n }\n setError(null);\n setIsReady(true);\n return true;\n };\n\n if (markReadyFromFrame()) {\n return;\n }\n\n // Set up timeout\n const timeoutId = setTimeout(() => {\n if (!markReadyFromFrame()) {\n setError(\n `Timed out waiting for the initial projected view after ${timeout}ms. ` +\n \"Ensure the host sends a gameplay frame with a seat view.\",\n );\n }\n }, timeout);\n\n // Fallback poll for dev/HMR flows where the runtime frame may already\n // exist but the first subscribe callback is missed.\n const pollId = setInterval(() => {\n if (markReadyFromFrame()) {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n }\n }, 100);\n\n const unsubscribe = runtime.subscribeFrame(() => {\n if (!hasProjectedView(runtime)) {\n setIsReady(false);\n return;\n }\n clearInterval(pollId);\n clearTimeout(timeoutId);\n setError(null);\n setIsReady(true);\n });\n\n return () => {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n unsubscribe?.();\n };\n }, [runtime, timeout]);\n\n return {\n runtime,\n isReady,\n waiting: hasBeenReadyRef.current && !isReady,\n error,\n };\n}\n","import {\n DREAMBOARD_PLUGIN_PROTOCOL,\n DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n HostToPluginEnvelopeSchema,\n type HostToPluginEnvelope,\n type PluginToHostPayload,\n} from \"@dreamboard-games/plugin-runtime-contract\";\nimport type { PluginTransport } from \"../core/types.js\";\n\nexport interface PostMessagePluginTransportOptions {\n readonly targetWindow?: Window;\n readonly parentWindow?: Window;\n readonly onInvalidMessage?: (reason: string, value: unknown) => void;\n}\n\nexport function createPostMessagePluginTransport(\n options: PostMessagePluginTransportOptions = {},\n): PluginTransport {\n const targetWindow = options.targetWindow ?? window;\n const parentWindow = options.parentWindow ?? targetWindow.parent;\n let channel:\n | {\n readonly channelId: string;\n readonly hostOrigin: string;\n readonly hostWindow: Window;\n }\n | null = null;\n let outboundSequence = 0;\n\n return {\n start(onMessage) {\n const handleMessage = (event: MessageEvent) => {\n if (event.source !== parentWindow) {\n return;\n }\n const parseResult = HostToPluginEnvelopeSchema.safeParse(event.data);\n if (!parseResult.success) {\n options.onInvalidMessage?.(\"invalid-envelope\", event.data);\n return;\n }\n const envelope = parseResult.data;\n if (!channel) {\n if (envelope.payload.type !== \"runtime.init\") {\n return;\n }\n channel = {\n channelId: envelope.channelId,\n hostOrigin: event.origin,\n hostWindow: event.source as Window,\n };\n }\n if (\n envelope.channelId !== channel.channelId ||\n event.origin !== channel.hostOrigin ||\n event.source !== channel.hostWindow\n ) {\n options.onInvalidMessage?.(\"channel-mismatch\", event.data);\n return;\n }\n onMessage(envelope as HostToPluginEnvelope);\n };\n\n targetWindow.addEventListener(\"message\", handleMessage);\n return () => {\n targetWindow.removeEventListener(\"message\", handleMessage);\n channel = null;\n };\n },\n send(payload: PluginToHostPayload) {\n if (!channel) {\n throw new Error(\"Plugin transport is not initialized.\");\n }\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload,\n },\n channel.hostOrigin,\n );\n },\n };\n}\n","import React from \"react\";\nimport { usePluginRuntime } from \"../hooks/usePluginRuntime.js\";\nimport { GameSkeleton } from \"../../ui.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\nimport { PluginRuntimeBoundary } from \"./PluginRuntimeBoundary.js\";\n\nexport interface PluginRuntimeProps {\n /** Child components to render after gameplay frame has started */\n children: React.ReactNode;\n /**\n * Timeout in milliseconds to wait for the first gameplay-frame snapshot.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n /** Custom loading component to show while waiting for gameplay frame */\n loadingComponent?: React.ReactNode;\n /** Custom error component to show when initialization fails */\n errorComponent?: (error: string) => React.ReactNode;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\n/**\n * PluginRuntime provides the RuntimeContext for plugin components.\n *\n * This component:\n * - Creates a transport-backed runtime client\n * - Waits for the first projected gameplay frame before rendering children\n * - Provides runtime commands plus session/frame state to all child components\n *\n * @example\n * ```tsx\n * // In your plugin's index.tsx\n * import { PluginRuntime } from \"./components/dreamboard\";\n * import App from './App';\n *\n * ReactDOM.createRoot(document.getElementById('root')!).render(\n * <PluginRuntime>\n * <App />\n * </PluginRuntime>\n * );\n * ```\n */\nexport function PluginRuntime({\n children,\n timeout = 10000,\n loadingComponent,\n errorComponent,\n onDiagnostic,\n}: PluginRuntimeProps) {\n const { runtime, isReady, waiting, error } = usePluginRuntime({\n timeout,\n onDiagnostic,\n });\n\n if (error) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n return (\n <div className=\"flex h-full w-full items-center justify-center bg-gray-50\">\n <div className=\"text-center p-6\">\n <p className=\"text-red-600 font-medium mb-2\">Failed to load game</p>\n <p className=\"text-gray-600 text-sm\">{error}</p>\n </div>\n </div>\n );\n }\n\n if (!isReady) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Once the game has rendered, a view-less snapshot is a mid-game wait (you\n // acted and are waiting on the table), not a cold load — say so rather than\n // reading as a stalled \"Waiting for game state\".\n return (\n <GameSkeleton\n message={\n waiting\n ? \"Waiting for the other players…\"\n : \"Waiting for game state...\"\n }\n />\n );\n }\n\n return (\n <PluginRuntimeBoundary runtime={runtime}>{children}</PluginRuntimeBoundary>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,WAAW,cAAc;;;ACerC,SAAS,iCACd,UAA6C,CAAC,GAC7B;AACjB,QAAM,eAAe,QAAQ,gBAAgB;AAC7C,QAAM,eAAe,QAAQ,gBAAgB,aAAa;AAC1D,MAAI,UAMO;AACX,MAAI,mBAAmB;AAEvB,SAAO;AAAA,IACL,MAAM,WAAW;AACf,YAAM,gBAAgB,CAAC,UAAwB;AAC7C,YAAI,MAAM,WAAW,cAAc;AACjC;AAAA,QACF;AACA,cAAM,cAAc,2BAA2B,UAAU,MAAM,IAAI;AACnE,YAAI,CAAC,YAAY,SAAS;AACxB,kBAAQ,mBAAmB,oBAAoB,MAAM,IAAI;AACzD;AAAA,QACF;AACA,cAAM,WAAW,YAAY;AAC7B,YAAI,CAAC,SAAS;AACZ,cAAI,SAAS,QAAQ,SAAS,gBAAgB;AAC5C;AAAA,UACF;AACA,oBAAU;AAAA,YACR,WAAW,SAAS;AAAA,YACpB,YAAY,MAAM;AAAA,YAClB,YAAY,MAAM;AAAA,UACpB;AAAA,QACF;AACA,YACE,SAAS,cAAc,QAAQ,aAC/B,MAAM,WAAW,QAAQ,cACzB,MAAM,WAAW,QAAQ,YACzB;AACA,kBAAQ,mBAAmB,oBAAoB,MAAM,IAAI;AACzD;AAAA,QACF;AACA,kBAAU,QAAgC;AAAA,MAC5C;AAEA,mBAAa,iBAAiB,WAAW,aAAa;AACtD,aAAO,MAAM;AACX,qBAAa,oBAAoB,WAAW,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AEA,MAAI,CAAC,SAAS;AACZ,QAAI,kBAAkB;AACpB,aAAO,gCAAG,4BAAiB;AAAA,IAC7B;AAIA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SACE,UACI,wCACA;AAAA;AAAA,IAER;AAAA,EAEJ;AAEA,SACE,oBAAC,yBAAsB,SAAmB,UAAS;AAEvD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/runtime/hooks/usePluginRuntime.ts","../package.json","../src/runtime/browser/post-message-transport.ts","../src/runtime/components/PluginRuntime.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from \"react\";\nimport packageJson from \"../../../package.json\";\nimport { createPostMessagePluginTransport } from \"../browser/post-message-transport.js\";\nimport { createPluginRuntimeClient } from \"../core/create-plugin-runtime-client.js\";\nimport type { PluginRuntimeClient } from \"../core/types.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\n\nconst BUNDLED_SDK_VERSION =\n typeof packageJson.version === \"string\" ? packageJson.version : \"unknown\";\n\nexport interface UsePluginRuntimeOptions {\n /**\n * Timeout in milliseconds to wait for the first gameplay frame.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\nexport interface UsePluginRuntimeResult {\n /** The transport-agnostic plugin runtime client. */\n runtime: PluginRuntimeClient;\n /** Whether the initial reducer-native snapshot is available and ready */\n isReady: boolean;\n /**\n * True when the plugin was ready before but the current snapshot has no\n * projected view — e.g. you've acted and are waiting on the rest of the\n * table in a simultaneous phase. Lets the loading affordance read as a\n * mid-game wait rather than a cold \"still loading\" stall.\n */\n waiting: boolean;\n /** Error message if initialization failed */\n error: string | null;\n}\n\nfunction hasProjectedView(runtime: PluginRuntimeClient): boolean {\n const frame = runtime.getFrame();\n return (\n frame !== null && frame.view !== null && typeof frame.view !== \"undefined\"\n );\n}\n\n/**\n * Hook that creates and manages a PluginRuntimeClient instance.\n *\n * This hook handles:\n * 1. Creating the runtime client\n * 2. Waiting for the first gameplay frame before setting isReady\n *\n * In the new architecture, the host only renders the plugin when a reducer-native\n * snapshot is available, so isReady should become true quickly after init.\n *\n * @example\n * ```tsx\n * function PluginRuntime({ children }: { children: React.ReactNode }) {\n * const { runtime, isReady, error } = usePluginRuntime();\n *\n * if (error) {\n * return <div>Error: {error}</div>;\n * }\n *\n * if (!isReady) {\n * return <GameSkeleton message=\"Waiting for game state...\" />;\n * }\n *\n * return <RuntimeProvider runtime={runtime}>{children}</RuntimeProvider>;\n * }\n * ```\n */\nexport function usePluginRuntime(\n options: UsePluginRuntimeOptions = {},\n): UsePluginRuntimeResult {\n const { timeout = 10000, onDiagnostic } = options;\n const [error, setError] = useState<string | null>(null);\n\n // Create runtime once and keep stable reference\n const [runtime] = useState<PluginRuntimeClient>(() =>\n createPluginRuntimeClient({\n transport: createPostMessagePluginTransport({\n bundledSdkVersion: BUNDLED_SDK_VERSION,\n onInvalidMessage: (reason, value) => {\n const message =\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${BUNDLED_SDK_VERSION}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\";\n setError(message);\n onDiagnostic?.({\n type: \"runtimeLog\",\n level: \"warn\",\n message,\n details: [value],\n });\n },\n }),\n }),\n );\n const [isReady, setIsReady] = useState(() => hasProjectedView(runtime));\n // Latches once we've shown a view, so a later view-less snapshot reads as a\n // mid-game wait rather than a fresh load. (A ref, so it never re-triggers a\n // render on its own.)\n const hasBeenReadyRef = useRef(false);\n if (isReady) hasBeenReadyRef.current = true;\n\n useEffect(() => {\n void onDiagnostic;\n }, [onDiagnostic]);\n\n // Subscribe to gameplay frames and set isReady when the first projected view arrives.\n useEffect(() => {\n const markReadyFromFrame = () => {\n if (!hasProjectedView(runtime)) {\n return false;\n }\n setError(null);\n setIsReady(true);\n return true;\n };\n\n if (markReadyFromFrame()) {\n return;\n }\n\n // Set up timeout\n const timeoutId = setTimeout(() => {\n if (!markReadyFromFrame()) {\n setError(\n `Timed out waiting for the initial projected view after ${timeout}ms. ` +\n \"Ensure the host sends a gameplay frame with a seat view.\",\n );\n }\n }, timeout);\n\n // Fallback poll for dev/HMR flows where the runtime frame may already\n // exist but the first subscribe callback is missed.\n const pollId = setInterval(() => {\n if (markReadyFromFrame()) {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n }\n }, 100);\n\n const unsubscribe = runtime.subscribeFrame(() => {\n if (!hasProjectedView(runtime)) {\n setIsReady(false);\n return;\n }\n clearInterval(pollId);\n clearTimeout(timeoutId);\n setError(null);\n setIsReady(true);\n });\n\n return () => {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n unsubscribe?.();\n };\n }, [runtime, timeout]);\n\n return {\n runtime,\n isReady,\n waiting: hasBeenReadyRef.current && !isReady,\n error,\n };\n}\n","{\n \"name\": \"@dreamboard-games/sdk\",\n \"version\": \"0.4.0-alpha.6\",\n \"description\": \"Dreamboard SDK package set metadata and public facade\",\n \"type\": \"module\",\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\",\n \"default\": \"./dist/index.js\"\n },\n \"./package-set\": {\n \"types\": \"./dist/package-set.d.ts\",\n \"import\": \"./dist/package-set.js\",\n \"default\": \"./dist/package-set.js\"\n },\n \"./types\": {\n \"types\": \"./dist/types.d.ts\",\n \"import\": \"./dist/types.js\",\n \"default\": \"./dist/types.js\"\n },\n \"./reducer\": {\n \"types\": \"./dist/reducer.d.ts\",\n \"import\": \"./dist/reducer.js\",\n \"default\": \"./dist/reducer.js\"\n },\n \"./reducer/advanced\": {\n \"types\": \"./dist/reducer/advanced.d.ts\",\n \"import\": \"./dist/reducer/advanced.js\",\n \"default\": \"./dist/reducer/advanced.js\"\n },\n \"./ui\": {\n \"types\": \"./dist/ui.d.ts\",\n \"import\": \"./dist/ui.js\",\n \"default\": \"./dist/ui.js\"\n },\n \"./ui/components\": {\n \"types\": \"./dist/ui/components.d.ts\",\n \"import\": \"./dist/ui/components.js\",\n \"default\": \"./dist/ui/components.js\"\n },\n \"./ui/defaults\": {\n \"types\": \"./dist/ui/defaults.d.ts\",\n \"import\": \"./dist/ui/defaults.js\",\n \"default\": \"./dist/ui/defaults.js\"\n },\n \"./ui/player-state\": {\n \"types\": \"./dist/ui/player-state.d.ts\",\n \"import\": \"./dist/ui/player-state.js\",\n \"default\": \"./dist/ui/player-state.js\"\n },\n \"./ui/plugin-styles.css\": {\n \"default\": \"./dist/ui/plugin-styles.css\"\n },\n \"./runtime\": {\n \"types\": \"./dist/runtime.d.ts\",\n \"import\": \"./dist/runtime.js\",\n \"default\": \"./dist/runtime.js\"\n },\n \"./runtime/primitives\": {\n \"types\": \"./dist/runtime/primitives.d.ts\",\n \"import\": \"./dist/runtime/primitives.js\",\n \"default\": \"./dist/runtime/primitives.js\"\n },\n \"./runtime/workspace-contract\": {\n \"types\": \"./dist/runtime/workspace-contract.d.ts\",\n \"import\": \"./dist/runtime/workspace-contract.js\",\n \"default\": \"./dist/runtime/workspace-contract.js\"\n },\n \"./runtime/runtime-api\": {\n \"types\": \"./dist/runtime/runtime-api.d.ts\",\n \"import\": \"./dist/runtime/runtime-api.js\",\n \"default\": \"./dist/runtime/runtime-api.js\"\n },\n \"./codegen\": {\n \"types\": \"./dist/codegen.d.ts\",\n \"import\": \"./dist/codegen.js\",\n \"default\": \"./dist/codegen.js\"\n },\n \"./authoring\": {\n \"types\": \"./dist/authoring/index.d.ts\",\n \"import\": \"./dist/authoring/index.js\",\n \"default\": \"./dist/authoring/index.js\"\n },\n \"./reducer-contract\": {\n \"types\": \"./dist/reducer-contract.d.ts\",\n \"import\": \"./dist/reducer-contract.js\",\n \"default\": \"./dist/reducer-contract.js\"\n },\n \"./testing\": {\n \"types\": \"./dist/testing.d.ts\",\n \"import\": \"./dist/testing.js\",\n \"default\": \"./dist/testing.js\"\n },\n \"./browser-interaction\": {\n \"bun\": \"./src/browser-interaction.ts\",\n \"types\": \"./dist/browser-interaction.d.ts\",\n \"import\": \"./dist/browser-interaction.js\",\n \"default\": \"./dist/browser-interaction.js\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"LICENSE.md\",\n \"dist\",\n \"README.md\",\n \"REFERENCE.md\",\n \"!.turbo/**\",\n \"!tsconfig.tsbuildinfo\"\n ],\n \"scripts\": {\n \"build\": \"pnpm --dir ../.. --filter @dreamboard-games/plugin-runtime-contract build && pnpm --dir ../.. authoring-metadata:generate && tsup && node ../../scripts/copy-sdk-private-dts.mjs && mkdir -p dist/ui && tailwindcss -i src/ui/plugin-styles.css -o dist/ui/plugin-styles.css --minify\",\n \"typecheck\": \"tsc --noEmit\",\n \"lint\": \"eslint 'src/**/*.{ts,tsx}'\",\n \"storybook\": \"storybook dev -p 6006 --host 127.0.0.1 --no-open\",\n \"storybook:build\": \"storybook build -o storybook-static\",\n \"storybook:test\": \"concurrently -k -s first -n storybook,test \\\"http-server storybook-static -p 6006 -s --silent\\\" \\\"wait-on tcp:6006 && test-storybook --url http://127.0.0.1:6006\\\"\",\n \"storybook:test:visual\": \"playwright test --config .storybook/visual-runner.config.ts\",\n \"storybook:test:visual:update\": \"playwright test --config .storybook/visual-runner.config.ts --update-snapshots\",\n \"test\": \"bun test src\"\n },\n \"dependencies\": {\n \"@radix-ui/react-accordion\": \"^1.2.14\",\n \"@radix-ui/react-dialog\": \"^1.1.17\",\n \"@radix-ui/react-label\": \"^2.1.10\",\n \"@radix-ui/react-select\": \"^2.3.1\",\n \"@radix-ui/react-slot\": \"^1.3.0\",\n \"@radix-ui/react-tooltip\": \"^1.2.10\",\n \"@use-gesture/react\": \"^10.3.1\",\n \"clsx\": \"^2.1.1\",\n \"lucide-react\": \"^1.20.0\",\n \"vaul\": \"^1.1.2\",\n \"zustand\": \"^5.0.14\"\n },\n \"devDependencies\": {\n \"@dreamboard-games/plugin-runtime-contract\": \"workspace:*\",\n \"@dreamboard-games/reducer-contract\": \"workspace:*\",\n \"@dreamboard-games/sdk-types\": \"workspace:*\",\n \"@dreamboard-games/workspace-codegen\": \"workspace:*\",\n \"@happy-dom/global-registrator\": \"^20.9.0\",\n \"@playwright/test\": \"1.60.0\",\n \"@storybook/addon-a11y\": \"^10.4.6\",\n \"@storybook/addon-themes\": \"^10.4.6\",\n \"@storybook/react-vite\": \"^10.4.6\",\n \"@storybook/test-runner\": \"^0.24.4\",\n \"@tailwindcss/cli\": \"^4.3.1\",\n \"@tailwindcss/vite\": \"^4.3.1\",\n \"@types/node\": \"^24.5.2\",\n \"@types/react\": \"^19.0.0\",\n \"@types/react-dom\": \"^19.0.0\",\n \"axe-playwright\": \"2.2.2\",\n \"concurrently\": \"^9.1.0\",\n \"eslint\": \"^9.39.0\",\n \"framer-motion\": \"^12.40.0\",\n \"http-server\": \"^14.1.1\",\n \"playwright\": \"1.60.0\",\n \"react\": \"^19.2.0\",\n \"react-dom\": \"^19.2.0\",\n \"storybook\": \"^10.4.6\",\n \"tailwindcss\": \"^4.3.1\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.9.2\",\n \"vite\": \"8.0.16\",\n \"wait-on\": \"^8.0.1\",\n \"zod\": \"4.4.3\"\n },\n \"peerDependencies\": {\n \"framer-motion\": \"^11.0.0 || ^12.0.0\",\n \"react\": \"^19.0.0\",\n \"react-dom\": \"^19.0.0\",\n \"zod\": \"^4.4.3\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/dreamboard-games/dreamboard-sdk.git\",\n \"directory\": \"packages/sdk\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/dreamboard-games/dreamboard-sdk/issues\"\n },\n \"homepage\": \"https://github.com/dreamboard-games/dreamboard-sdk#readme\",\n \"keywords\": [\n \"dreamboard\",\n \"sdk\",\n \"package-set\"\n ],\n \"license\": \"SEE LICENSE IN LICENSE.md\"\n}\n","import {\n DREAMBOARD_PLUGIN_PROTOCOL,\n DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n HostToPluginEnvelopeSchema,\n type HostToPluginEnvelope,\n type PluginToHostPayload,\n} from \"@dreamboard-games/plugin-runtime-contract\";\nimport type { PluginTransport } from \"../core/types.js\";\n\nexport interface PostMessagePluginTransportOptions {\n readonly targetWindow?: Window;\n readonly parentWindow?: Window;\n readonly bundledSdkVersion?: string;\n readonly onInvalidMessage?: (reason: string, value: unknown) => void;\n}\n\nexport function createPostMessagePluginTransport(\n options: PostMessagePluginTransportOptions = {},\n): PluginTransport {\n const targetWindow = options.targetWindow ?? window;\n const parentWindow = options.parentWindow ?? targetWindow.parent;\n const bundledSdkVersion = options.bundledSdkVersion?.trim() || \"unknown\";\n let channel: {\n readonly channelId: string;\n readonly hostOrigin: string;\n readonly hostWindow: Window;\n } | null = null;\n let outboundSequence = 0;\n let invalidEnvelopeReported = false;\n\n const reportInvalidEnvelope = (reason: string, value: unknown) => {\n options.onInvalidMessage?.(reason, value);\n\n if (!channel || invalidEnvelopeReported) {\n return;\n }\n\n invalidEnvelopeReported = true;\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload: {\n type: \"runtime.error\",\n code: \"host-runtime-protocol-mismatch\",\n message:\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${bundledSdkVersion}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\",\n },\n },\n channel.hostOrigin,\n );\n };\n\n return {\n start(onMessage) {\n const handleMessage = (event: MessageEvent) => {\n if (event.source !== parentWindow) {\n return;\n }\n const parseResult = HostToPluginEnvelopeSchema.safeParse(event.data);\n if (!parseResult.success) {\n reportInvalidEnvelope(\"invalid-envelope\", event.data);\n return;\n }\n const envelope = parseResult.data;\n if (!channel) {\n if (envelope.payload.type !== \"runtime.init\") {\n return;\n }\n channel = {\n channelId: envelope.channelId,\n hostOrigin: event.origin,\n hostWindow: event.source as Window,\n };\n }\n if (\n envelope.channelId !== channel.channelId ||\n event.origin !== channel.hostOrigin ||\n event.source !== channel.hostWindow\n ) {\n reportInvalidEnvelope(\"channel-mismatch\", event.data);\n return;\n }\n onMessage(envelope as HostToPluginEnvelope);\n };\n\n targetWindow.addEventListener(\"message\", handleMessage);\n return () => {\n targetWindow.removeEventListener(\"message\", handleMessage);\n channel = null;\n };\n },\n send(payload: PluginToHostPayload) {\n if (!channel) {\n throw new Error(\"Plugin transport is not initialized.\");\n }\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload,\n },\n channel.hostOrigin,\n );\n },\n };\n}\n","import React from \"react\";\nimport { usePluginRuntime } from \"../hooks/usePluginRuntime.js\";\nimport { GameSkeleton } from \"../../ui.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\nimport { PluginRuntimeBoundary } from \"./PluginRuntimeBoundary.js\";\n\nexport interface PluginRuntimeProps {\n /** Child components to render after gameplay frame has started */\n children: React.ReactNode;\n /**\n * Timeout in milliseconds to wait for the first gameplay-frame snapshot.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n /** Custom loading component to show while waiting for gameplay frame */\n loadingComponent?: React.ReactNode;\n /** Custom error component to show when initialization fails */\n errorComponent?: (error: string) => React.ReactNode;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\n/**\n * PluginRuntime provides the RuntimeContext for plugin components.\n *\n * This component:\n * - Creates a transport-backed runtime client\n * - Waits for the first projected gameplay frame before rendering children\n * - Provides runtime commands plus session/frame state to all child components\n *\n * @example\n * ```tsx\n * // In your plugin's index.tsx\n * import { PluginRuntime } from \"./components/dreamboard\";\n * import App from './App';\n *\n * ReactDOM.createRoot(document.getElementById('root')!).render(\n * <PluginRuntime>\n * <App />\n * </PluginRuntime>\n * );\n * ```\n */\nexport function PluginRuntime({\n children,\n timeout = 10000,\n loadingComponent,\n errorComponent,\n onDiagnostic,\n}: PluginRuntimeProps) {\n const { runtime, isReady, waiting, error } = usePluginRuntime({\n timeout,\n onDiagnostic,\n });\n\n if (error) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n return (\n <div className=\"flex h-full w-full items-center justify-center bg-gray-50\">\n <div className=\"text-center p-6\">\n <p className=\"text-red-600 font-medium mb-2\">Failed to load game</p>\n <p className=\"text-gray-600 text-sm\">{error}</p>\n </div>\n </div>\n );\n }\n\n if (!isReady) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Once the game has rendered, a view-less snapshot is a mid-game wait (you\n // acted and are waiting on the table), not a cold load — say so rather than\n // reading as a stalled \"Waiting for game state\".\n return (\n <GameSkeleton\n message={\n waiting\n ? \"Waiting for the other players…\"\n : \"Waiting for game state...\"\n }\n />\n );\n }\n\n return (\n <PluginRuntimeBoundary runtime={runtime}>{children}</PluginRuntimeBoundary>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,WAAW,cAAc;;;ACA5C;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,MAAQ;AAAA,EACR,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,iBAAiB;AAAA,MACf,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,WAAW;AAAA,MACT,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,aAAa;AAAA,MACX,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,sBAAsB;AAAA,MACpB,OAAS;AAAA,MACT,QAAU;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