@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.
Files changed (150) hide show
  1. package/README.md +136 -45
  2. package/dist/chunk-DMFVAZI2.js +16 -0
  3. package/dist/chunk-DMFVAZI2.js.map +1 -0
  4. package/dist/chunk-FMM5LVJW.js +833 -0
  5. package/dist/chunk-FMM5LVJW.js.map +1 -0
  6. package/dist/{chunk-S2JEDVWH.js → chunk-LRILEVKC.js} +6113 -6489
  7. package/dist/chunk-LRILEVKC.js.map +1 -0
  8. package/dist/chunk-SP234IY4.js +1363 -0
  9. package/dist/chunk-SP234IY4.js.map +1 -0
  10. package/dist/chunk-VUWNJXLJ.js +52 -0
  11. package/dist/chunk-VUWNJXLJ.js.map +1 -0
  12. package/dist/chunk-ZPRKWPEP.js +511 -0
  13. package/dist/chunk-ZPRKWPEP.js.map +1 -0
  14. package/dist/definition-BaHNPZol.d.ts +4639 -0
  15. package/dist/diagnostics-B0lgnuZ6.d.ts +65 -0
  16. package/dist/index.d.ts +3553 -1
  17. package/dist/index.js +1045 -6
  18. package/dist/index.js.map +1 -1
  19. package/dist/model-BHro6yXu.d.ts +288 -0
  20. package/dist/react.d.ts +32 -0
  21. package/dist/react.js +80 -0
  22. package/dist/react.js.map +1 -0
  23. package/dist/reducer.d.ts +1194 -79
  24. package/dist/reducer.js +4326 -121
  25. package/dist/reducer.js.map +1 -1
  26. package/dist/testing.d.ts +518 -564
  27. package/dist/testing.js +2448 -915
  28. package/dist/testing.js.map +1 -1
  29. package/dist/types-DimqnJBq.d.ts +86 -0
  30. package/package.json +26 -131
  31. package/dist/HandView-Bi2lxzQP.d.ts +0 -79
  32. package/dist/ResourceCounter-BFxJknqp.d.ts +0 -98
  33. package/dist/ThemeProvider-CElaL2ik.d.ts +0 -99
  34. package/dist/attributes-DbvyMbXw.d.ts +0 -68
  35. package/dist/browser-interaction.d.ts +0 -910
  36. package/dist/browser-interaction.js +0 -119
  37. package/dist/browser-interaction.js.map +0 -1
  38. package/dist/chunk-32PFKDV7.js +0 -11705
  39. package/dist/chunk-32PFKDV7.js.map +0 -1
  40. package/dist/chunk-3BAD4VC2.js +0 -263
  41. package/dist/chunk-3BAD4VC2.js.map +0 -1
  42. package/dist/chunk-3SKDNDPG.js +0 -104
  43. package/dist/chunk-3SKDNDPG.js.map +0 -1
  44. package/dist/chunk-5YV2WHJ4.js +0 -25
  45. package/dist/chunk-5YV2WHJ4.js.map +0 -1
  46. package/dist/chunk-ANRB4XKA.js +0 -90
  47. package/dist/chunk-ANRB4XKA.js.map +0 -1
  48. package/dist/chunk-BI4G3PM2.js +0 -1864
  49. package/dist/chunk-BI4G3PM2.js.map +0 -1
  50. package/dist/chunk-EVCLTY4Q.js +0 -935
  51. package/dist/chunk-EVCLTY4Q.js.map +0 -1
  52. package/dist/chunk-GDPKTBUR.js +0 -564
  53. package/dist/chunk-GDPKTBUR.js.map +0 -1
  54. package/dist/chunk-H6VDGFL5.js +0 -2903
  55. package/dist/chunk-H6VDGFL5.js.map +0 -1
  56. package/dist/chunk-LR3ZTWQF.js +0 -5960
  57. package/dist/chunk-LR3ZTWQF.js.map +0 -1
  58. package/dist/chunk-PF7L4BMG.js +0 -117
  59. package/dist/chunk-PF7L4BMG.js.map +0 -1
  60. package/dist/chunk-PN5O6GG2.js +0 -32
  61. package/dist/chunk-PN5O6GG2.js.map +0 -1
  62. package/dist/chunk-PZ5AY32C.js +0 -10
  63. package/dist/chunk-PZ5AY32C.js.map +0 -1
  64. package/dist/chunk-S2JEDVWH.js.map +0 -1
  65. package/dist/chunk-T3ZKNUZ7.js +0 -1
  66. package/dist/chunk-T3ZKNUZ7.js.map +0 -1
  67. package/dist/chunk-UGH54WZ2.js +0 -223
  68. package/dist/chunk-UGH54WZ2.js.map +0 -1
  69. package/dist/chunk-VCDWP5VL.js +0 -746
  70. package/dist/chunk-VCDWP5VL.js.map +0 -1
  71. package/dist/chunk-VDXOF4FW.js +0 -69
  72. package/dist/chunk-VDXOF4FW.js.map +0 -1
  73. package/dist/chunk-WHR5UW3F.js +0 -1988
  74. package/dist/chunk-WHR5UW3F.js.map +0 -1
  75. package/dist/chunk-Y75CFE77.js +0 -17
  76. package/dist/chunk-Y75CFE77.js.map +0 -1
  77. package/dist/chunk-Z7QCREWI.js +0 -3435
  78. package/dist/chunk-Z7QCREWI.js.map +0 -1
  79. package/dist/chunk-ZZGN2ATS.js +0 -1941
  80. package/dist/chunk-ZZGN2ATS.js.map +0 -1
  81. package/dist/components-gAbIz7hK.d.ts +0 -1284
  82. package/dist/definitions-BgmV_GhC.d.ts +0 -300
  83. package/dist/diagnostics-DIi3ina7.d.ts +0 -50
  84. package/dist/digest.d.ts +0 -8
  85. package/dist/game-CsZScpcn.d.ts +0 -763
  86. package/dist/hex-board-view-aKkblDp6.d.ts +0 -1228
  87. package/dist/index-CcT9Q7N7.d.ts +0 -193
  88. package/dist/index.d-DjzoK7zn.d.ts +0 -2101
  89. package/dist/package-set.d.ts +0 -13
  90. package/dist/package-set.js +0 -12
  91. package/dist/package-set.js.map +0 -1
  92. package/dist/player-state-Cqpyeql0.d.ts +0 -371
  93. package/dist/plugin-runtime-contract.d.ts +0 -17
  94. package/dist/plugin-runtime-contract.js +0 -92
  95. package/dist/plugin-runtime-contract.js.map +0 -1
  96. package/dist/primitive-props-BNHDkgd7.d.ts +0 -16
  97. package/dist/protocol-dYgafTYY.d.ts +0 -314
  98. package/dist/reducer/advanced.d.ts +0 -82
  99. package/dist/reducer/advanced.js +0 -51
  100. package/dist/reducer/advanced.js.map +0 -1
  101. package/dist/reducer-contract.d.ts +0 -11
  102. package/dist/reducer-contract.js +0 -16
  103. package/dist/reducer-contract.js.map +0 -1
  104. package/dist/reference-games/index.d.ts +0 -31
  105. package/dist/reference-games/index.js +0 -48
  106. package/dist/reference-games/index.js.map +0 -1
  107. package/dist/runtime/primitives.d.ts +0 -250
  108. package/dist/runtime/primitives.js +0 -189
  109. package/dist/runtime/primitives.js.map +0 -1
  110. package/dist/runtime/runtime-api.d.ts +0 -2
  111. package/dist/runtime/runtime-api.js +0 -1
  112. package/dist/runtime/runtime-api.js.map +0 -1
  113. package/dist/runtime/workspace-contract.d.ts +0 -392
  114. package/dist/runtime/workspace-contract.js +0 -28
  115. package/dist/runtime/workspace-contract.js.map +0 -1
  116. package/dist/runtime-RJ5orDJU.d.ts +0 -1699
  117. package/dist/runtime-api-Bz5pwNU_.d.ts +0 -296
  118. package/dist/runtime-json-CQ9QbLZ5.d.ts +0 -5
  119. package/dist/runtime.d.ts +0 -83
  120. package/dist/runtime.js +0 -242
  121. package/dist/runtime.js.map +0 -1
  122. package/dist/schema.d.ts +0 -379
  123. package/dist/stale-contract-artifact-error-XLaweZtF.d.ts +0 -18
  124. package/dist/testing-compiler.d.ts +0 -37
  125. package/dist/testing-compiler.js +0 -272
  126. package/dist/testing-compiler.js.map +0 -1
  127. package/dist/testing-runtime.d.ts +0 -119
  128. package/dist/testing-runtime.js +0 -212
  129. package/dist/testing-runtime.js.map +0 -1
  130. package/dist/types-DJj5MJkl.d.ts +0 -256
  131. package/dist/types-DR7DoB1x.d.ts +0 -28
  132. package/dist/types-JWCYHmu7.d.ts +0 -122
  133. package/dist/types.d.ts +0 -1958
  134. package/dist/types.js +0 -14
  135. package/dist/types.js.map +0 -1
  136. package/dist/ui/components.d.ts +0 -17
  137. package/dist/ui/components.js +0 -216
  138. package/dist/ui/components.js.map +0 -1
  139. package/dist/ui/defaults.d.ts +0 -19
  140. package/dist/ui/defaults.js +0 -104
  141. package/dist/ui/defaults.js.map +0 -1
  142. package/dist/ui/player-state.d.ts +0 -2
  143. package/dist/ui/player-state.js +0 -1
  144. package/dist/ui/player-state.js.map +0 -1
  145. package/dist/ui/plugin-styles.css +0 -2
  146. package/dist/ui-contract-GTUPkf8z.d.ts +0 -1168
  147. package/dist/ui.d.ts +0 -317
  148. package/dist/ui.js +0 -277
  149. package/dist/ui.js.map +0 -1
  150. package/dist/views-BpuWcOyN.d.ts +0 -1641
@@ -0,0 +1,86 @@
1
+ import { Store } from '@tanstack/store';
2
+ import { L as InteractionDescriptor$1, G as GameEvent, aI as SimultaneousPhaseProjection, aH as SeatProjectionBundle, d as BoardStaticProjection, av as RuntimeJson } from './definition-BaHNPZol.js';
3
+
4
+ type PlayerId = string;
5
+ interface GameplayBasis {
6
+ readonly version: number;
7
+ readonly actionSetVersion: string;
8
+ readonly perspectivePlayerId: PlayerId;
9
+ }
10
+ interface PluginPlayerSummary {
11
+ readonly playerId: PlayerId;
12
+ readonly displayName: string;
13
+ readonly color?: string;
14
+ }
15
+ interface PluginSessionDescriptor {
16
+ readonly sessionId: string;
17
+ /** Turn order is the order of this array. */
18
+ readonly players: readonly PluginPlayerSummary[];
19
+ }
20
+
21
+ type InteractionDescriptor<Interaction extends string = string> = Omit<InteractionDescriptor$1, "interactionKey"> & {
22
+ readonly interactionKey: Interaction;
23
+ };
24
+ type ActionInteractionDescriptor<Interaction extends string = string> = InteractionDescriptor<Interaction>;
25
+ interface ZoneHandlesSnapshot<Interaction extends string = string> {
26
+ readonly cardIds: readonly string[];
27
+ readonly cardViewsById: Readonly<Record<string, string>>;
28
+ readonly playableByCardId: Readonly<Record<string, readonly InteractionDescriptor<Interaction>[]>>;
29
+ }
30
+ type ReadonlyProjection<Value> = Value extends readonly (infer Item)[] ? readonly ReadonlyProjection<Item>[] : Value extends object ? {
31
+ readonly [Key in keyof Value]: ReadonlyProjection<Value[Key]>;
32
+ } : Value;
33
+ type SimultaneousPhaseSnapshot = ReadonlyProjection<SimultaneousPhaseProjection>;
34
+
35
+ interface PluginGameplayFrame<View = unknown, Phase extends string = string, Interaction extends string = string> {
36
+ /** Latest committed public display-event batch. Reading a snapshot does not replay notifications. */
37
+ readonly events: readonly GameEvent[];
38
+ readonly basis: GameplayBasis;
39
+ readonly view: View | null;
40
+ readonly flow: {
41
+ readonly currentPhase: Phase | null;
42
+ readonly activePlayers: readonly PlayerId[];
43
+ readonly simultaneousPhase: SimultaneousPhaseSnapshot | null;
44
+ };
45
+ readonly availableInteractions: ReadonlyArray<InteractionDescriptor<Interaction>>;
46
+ readonly zones: Readonly<Record<string, ZoneHandlesSnapshot<Interaction>>>;
47
+ }
48
+ type ReducerSeatProjectionBundle = ReadonlyProjection<SeatProjectionBundle>;
49
+ type ReducerBoardStaticProjection = Readonly<BoardStaticProjection>;
50
+
51
+ interface SourceSnapshot {
52
+ readonly me: string;
53
+ readonly players: readonly PluginPlayerSummary[];
54
+ readonly frame: Omit<PluginGameplayFrame, "basis">;
55
+ readonly version: number;
56
+ }
57
+ type SubmitResult = {
58
+ readonly accepted: true;
59
+ } | {
60
+ readonly accepted: false;
61
+ readonly errorCode: string;
62
+ readonly message?: string;
63
+ };
64
+ interface SourceState {
65
+ readonly snapshot: SourceSnapshot | null;
66
+ readonly connection: "connecting" | "ready" | "recovering" | "closed";
67
+ readonly request: {
68
+ readonly interactionId: string;
69
+ readonly operation: "submit" | "cancel";
70
+ readonly phase: "awaiting-result" | "awaiting-frame";
71
+ } | null;
72
+ }
73
+ interface GameSource {
74
+ readonly store: Pick<Store<SourceState>, "get" | "subscribe">;
75
+ dispose(): void;
76
+ }
77
+ interface CommandSource extends GameSource {
78
+ submit(interactionId: string, params: RuntimeJson): Promise<SubmitResult>;
79
+ cancel(interactionId: string): Promise<SubmitResult>;
80
+ }
81
+ /** Testing-owned sources can add local actions without widening hosted sources. */
82
+ interface ApplySource<Action, Result = void> extends GameSource {
83
+ apply(action: Action): Result;
84
+ }
85
+
86
+ export type { ActionInteractionDescriptor as A, CommandSource as C, GameSource as G, InteractionDescriptor as I, PlayerId as P, ReducerBoardStaticProjection as R, SimultaneousPhaseSnapshot as S, ZoneHandlesSnapshot as Z, ApplySource as a, GameplayBasis as b, PluginGameplayFrame as c, PluginPlayerSummary as d, PluginSessionDescriptor as e, ReducerSeatProjectionBundle as f, SourceSnapshot as g, SourceState as h, SubmitResult as i };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dreamboard-games/sdk",
3
- "version": "0.5.0-alpha.2",
4
- "description": "Dreamboard SDK package set metadata and public facade",
3
+ "version": "0.5.0-alpha.3",
4
+ "description": "Typed headless game instances, reducer authoring, React integration and testing",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -11,165 +11,54 @@
11
11
  "import": "./dist/index.js",
12
12
  "default": "./dist/index.js"
13
13
  },
14
- "./package-set": {
15
- "types": "./dist/package-set.d.ts",
16
- "import": "./dist/package-set.js",
17
- "default": "./dist/package-set.js"
18
- },
19
- "./plugin-runtime-contract": {
20
- "types": "./dist/plugin-runtime-contract.d.ts",
21
- "import": "./dist/plugin-runtime-contract.js",
22
- "default": "./dist/plugin-runtime-contract.js"
23
- },
24
- "./reference-games": {
25
- "types": "./dist/reference-games/index.d.ts",
26
- "import": "./dist/reference-games/index.js",
27
- "default": "./dist/reference-games/index.js"
28
- },
29
- "./types": {
30
- "types": "./dist/types.d.ts",
31
- "import": "./dist/types.js",
32
- "default": "./dist/types.js"
33
- },
34
14
  "./reducer": {
35
15
  "types": "./dist/reducer.d.ts",
36
16
  "import": "./dist/reducer.js",
37
17
  "default": "./dist/reducer.js"
38
18
  },
39
- "./reducer/advanced": {
40
- "types": "./dist/reducer/advanced.d.ts",
41
- "import": "./dist/reducer/advanced.js",
42
- "default": "./dist/reducer/advanced.js"
43
- },
44
- "./ui": {
45
- "types": "./dist/ui.d.ts",
46
- "import": "./dist/ui.js",
47
- "default": "./dist/ui.js"
48
- },
49
- "./ui/components": {
50
- "types": "./dist/ui/components.d.ts",
51
- "import": "./dist/ui/components.js",
52
- "default": "./dist/ui/components.js"
53
- },
54
- "./ui/defaults": {
55
- "types": "./dist/ui/defaults.d.ts",
56
- "import": "./dist/ui/defaults.js",
57
- "default": "./dist/ui/defaults.js"
58
- },
59
- "./ui/player-state": {
60
- "types": "./dist/ui/player-state.d.ts",
61
- "import": "./dist/ui/player-state.js",
62
- "default": "./dist/ui/player-state.js"
63
- },
64
- "./ui/plugin-styles.css": {
65
- "default": "./dist/ui/plugin-styles.css"
66
- },
67
- "./runtime": {
68
- "types": "./dist/runtime.d.ts",
69
- "import": "./dist/runtime.js",
70
- "default": "./dist/runtime.js"
71
- },
72
- "./runtime/primitives": {
73
- "types": "./dist/runtime/primitives.d.ts",
74
- "import": "./dist/runtime/primitives.js",
75
- "default": "./dist/runtime/primitives.js"
76
- },
77
- "./runtime/workspace-contract": {
78
- "types": "./dist/runtime/workspace-contract.d.ts",
79
- "import": "./dist/runtime/workspace-contract.js",
80
- "default": "./dist/runtime/workspace-contract.js"
81
- },
82
- "./runtime/runtime-api": {
83
- "types": "./dist/runtime/runtime-api.d.ts",
84
- "import": "./dist/runtime/runtime-api.js",
85
- "default": "./dist/runtime/runtime-api.js"
86
- },
87
- "./reducer-contract": {
88
- "types": "./dist/reducer-contract.d.ts",
89
- "import": "./dist/reducer-contract.js",
90
- "default": "./dist/reducer-contract.js"
91
- },
92
19
  "./testing": {
93
20
  "types": "./dist/testing.d.ts",
94
21
  "import": "./dist/testing.js",
95
22
  "default": "./dist/testing.js"
96
23
  },
97
- "./testing-runtime": {
98
- "types": "./dist/testing-runtime.d.ts",
99
- "import": "./dist/testing-runtime.js",
100
- "default": "./dist/testing-runtime.js"
101
- },
102
- "./testing-compiler": {
103
- "types": "./dist/testing-compiler.d.ts",
104
- "import": "./dist/testing-compiler.js",
105
- "default": "./dist/testing-compiler.js"
106
- },
107
- "./browser-interaction": {
108
- "types": "./dist/browser-interaction.d.ts",
109
- "import": "./dist/browser-interaction.js",
110
- "default": "./dist/browser-interaction.js"
111
- },
112
- "./package.json": "./package.json"
24
+ "./package.json": "./package.json",
25
+ "./react": {
26
+ "types": "./dist/react.d.ts",
27
+ "import": "./dist/react.js",
28
+ "default": "./dist/react.js"
29
+ }
113
30
  },
114
31
  "files": [
115
32
  "LICENSE.md",
116
33
  "dist",
117
34
  "README.md",
118
- "!.turbo/**",
119
35
  "!tsconfig.tsbuildinfo"
120
36
  ],
121
37
  "dependencies": {
122
- "@radix-ui/react-accordion": "^1.2.14",
123
- "@radix-ui/react-dialog": "^1.1.17",
124
- "@radix-ui/react-label": "^2.1.10",
125
- "@radix-ui/react-select": "^2.3.1",
126
- "@radix-ui/react-slot": "^1.3.0",
127
- "@radix-ui/react-tooltip": "^1.2.10",
128
38
  "@noble/hashes": "^2.2.0",
129
- "@use-gesture/react": "^10.3.1",
130
- "clsx": "^2.1.1",
131
- "esbuild": "^0.28.1",
132
- "lucide-react": "^1.20.0",
133
- "vaul": "^1.1.2",
134
- "zustand": "^5.0.14"
39
+ "@tanstack/store": "0.11.1",
40
+ "honeycomb-grid": "4.1.5"
135
41
  },
136
42
  "devDependencies": {
137
43
  "@happy-dom/global-registrator": "^20.9.0",
138
- "@playwright/test": "1.60.0",
139
- "@storybook/addon-a11y": "^10.4.6",
140
- "@storybook/addon-themes": "^10.4.6",
141
- "@storybook/react-vite": "^10.4.6",
142
- "@storybook/test-runner": "^0.24.4",
143
- "@tailwindcss/cli": "^4.3.1",
144
- "@tailwindcss/vite": "^4.3.1",
44
+ "@tanstack/react-store": "0.11.1",
145
45
  "@types/node": "^24.5.2",
146
46
  "@types/react": "^19.0.0",
147
47
  "@types/react-dom": "^19.0.0",
148
- "axe-playwright": "2.2.2",
149
- "concurrently": "^9.1.0",
150
48
  "eslint": "^9.39.1",
151
- "framer-motion": "^12.40.0",
152
- "http-server": "^14.1.1",
153
- "playwright": "1.60.0",
154
49
  "react": "^19.2.0",
155
50
  "react-dom": "^19.2.0",
156
- "storybook": "^10.4.6",
157
- "tailwindcss": "^4.3.1",
158
51
  "tsup": "^8.5.0",
159
52
  "typescript": "^5.9.3",
160
- "vite": "8.0.16",
161
53
  "vitest": "4.1.10",
162
- "wait-on": "^8.0.1",
163
54
  "zod": "4.4.3",
164
- "@dreamboard-games/plugin-runtime-contract": "0.1.0",
165
- "@dreamboard-games/sdk-types": "0.2.0",
166
- "@dreamboard-games/reducer-contract": "0.5.0"
55
+ "esbuild": "^0.28.1"
167
56
  },
168
57
  "peerDependencies": {
169
- "framer-motion": "^11.0.0 || ^12.0.0",
170
58
  "react": "^19.0.0",
171
59
  "react-dom": "^19.0.0",
172
- "zod": "^4.4.3"
60
+ "zod": "^4.4.3",
61
+ "@tanstack/react-store": "0.11.1"
173
62
  },
174
63
  "publishConfig": {
175
64
  "access": "public"
@@ -189,15 +78,21 @@
189
78
  "package-set"
190
79
  ],
191
80
  "license": "SEE LICENSE IN LICENSE.md",
81
+ "peerDependenciesMeta": {
82
+ "react": {
83
+ "optional": true
84
+ },
85
+ "react-dom": {
86
+ "optional": true
87
+ },
88
+ "@tanstack/react-store": {
89
+ "optional": true
90
+ }
91
+ },
192
92
  "scripts": {
193
- "build": "tsup && node ../../scripts/package.ts copy-declarations && mkdir -p dist/ui && tailwindcss -i src/ui/plugin-styles.css -o dist/ui/plugin-styles.css --minify",
93
+ "build": "tsup",
194
94
  "typecheck": "tsc --noEmit && tsc -p tsconfig.testing-contract.json",
195
95
  "lint": "eslint 'src/**/*.{ts,tsx}'",
196
- "storybook": "storybook dev -p 6006 --host 127.0.0.1 --no-open",
197
- "storybook:build": "storybook build -o storybook-static",
198
- "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\"",
199
- "storybook:test:visual": "playwright test --config .storybook/visual-runner.config.ts",
200
- "storybook:test:visual:update": "playwright test --config .storybook/visual-runner.config.ts --update-snapshots",
201
96
  "test": "vitest run src"
202
97
  }
203
98
  }
@@ -1,79 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode, CSSProperties } from 'react';
3
- import { ViewCard } from './types.js';
4
- import { P as InteractionVisualState, f as CardIntent } from './hex-board-view-aKkblDp6.js';
5
-
6
- /**
7
- * Pure layout math for the controlled `HandView`.
8
- *
9
- * The functions here are independent of React and DOM measurement so they can
10
- * be unit-tested directly. {@link computeFanLayout} matches the algorithm
11
- * documented in `docs/reference/ui-sdk-mobile-hand-and-card-interactions.md`,
12
- * and {@link chooseHandLayoutMode} translates a measured container width and a
13
- * caller policy into the actual presentation mode the hand should render.
14
- */
15
- type HandPresentationMode = "fan" | "compressed-fan" | "strip" | "tray";
16
-
17
- /**
18
- * Deterministic pointer recognizer for the controlled hand view.
19
- *
20
- * The engine is independent from React: it consumes pointer events and a
21
- * caller-supplied callbacks bag, and produces semantic gesture events. It
22
- * owns no DOM, emits no `CardIntent`, and does not track the drag-lifecycle
23
- * `phase` — that responsibility lives in `CardDragSurface`. The engine only
24
- * recognizes `tap`, `previewStart`/`previewEnd`, `liftStart`/`liftMove`/
25
- * `liftEnd`/`liftCancel`, and a `horizontalBrowse` informational signal.
26
- *
27
- * The thresholds match
28
- * `docs/reference/ui-sdk-mobile-hand-and-card-interactions.md`:
29
- *
30
- * | Threshold | Default |
31
- * | ------------------------- | ----------- |
32
- * | Press preview delay | `220ms` |
33
- * | Movement slop | `8px` |
34
- * | Axis bias | `1.25` |
35
- * | Drag lift distance | `28px` |
36
- *
37
- * Callers wire the engine's `handlePointerDown` / `handlePointerMove` /
38
- * `handlePointerUp` / `handlePointerCancel` to the matching DOM events on
39
- * each interactive card.
40
- */
41
- type HandInteractionPolicy = "direct-activate" | "drag-to-target";
42
-
43
- type HandLayoutKind = HandPresentationMode | "stack";
44
- interface HandLayoutPolicy {
45
- desktop?: HandLayoutKind;
46
- mobile?: HandLayoutKind;
47
- }
48
- interface HandViewProps<CardData extends ViewCard = ViewCard> {
49
- cards: readonly CardData[];
50
- /**
51
- * Layout policy. Pass a single layout kind to use the same layout in every
52
- * viewport, or pass `{ desktop, mobile }` for a measured-width decision.
53
- * Defaults to `{ desktop: "fan", mobile: "tray" }`.
54
- */
55
- layout?: HandLayoutKind | HandLayoutPolicy;
56
- /**
57
- * Mobile interaction policy. Defaults to `direct-activate`. Use
58
- * `drag-to-target` together with a surrounding `CardDragSurface` and one
59
- * or more `CardDropTargetView` children.
60
- */
61
- mobileInteraction?: HandInteractionPolicy;
62
- /** Returns the controlled visual state for a card. */
63
- stateForCard?: (card: CardData, index: number) => InteractionVisualState | undefined;
64
- /** Visual surface renderer. */
65
- renderCard: (card: CardData, state: InteractionVisualState, index: number) => ReactNode;
66
- /** Generic UI intent callback. */
67
- onCardIntent?: (intent: CardIntent<CardData["id"] & string>) => void;
68
- /** Card width hint for fan geometry. */
69
- cardSize?: "sm" | "md" | "lg";
70
- /** Slot for the empty state. Defaults to nothing rendered. */
71
- renderEmpty?: () => ReactNode;
72
- /** ARIA label for the hand region. */
73
- "aria-label"?: string;
74
- className?: string;
75
- style?: CSSProperties;
76
- }
77
- declare function HandView<CardData extends ViewCard = ViewCard>({ cards, layout, mobileInteraction, stateForCard, renderCard, onCardIntent, cardSize, renderEmpty, "aria-label": ariaLabel, className, style, }: HandViewProps<CardData>): react_jsx_runtime.JSX.Element;
78
-
79
- export { type HandInteractionPolicy as H, type HandLayoutKind as a, type HandLayoutPolicy as b, HandView as c, type HandViewProps as d };
@@ -1,98 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as react from 'react';
3
- import { ReactNode, HTMLAttributes, ComponentType, ReactElement } from 'react';
4
- import { P as PrimitiveCommonProps } from './primitive-props-BNHDkgd7.js';
5
-
6
- type HandRole = "primary" | "auxiliary" | "task";
7
- interface MobileHandRegistration {
8
- id: string;
9
- zone: string;
10
- label: string;
11
- role: HandRole;
12
- order?: number;
13
- version: string;
14
- count: number;
15
- active: boolean;
16
- autoOpen: boolean;
17
- content: ReactNode;
18
- }
19
- declare function MobileHandTrayProvider({ children }: {
20
- children: ReactNode;
21
- }): react_jsx_runtime.JSX.Element;
22
- declare function useRegisterMobileHand(hand: MobileHandRegistration): void;
23
- declare function useOverlayInsets(): {
24
- bottom: number;
25
- };
26
- declare function useRegisterBottomOverlayInset(id: string, height: number): void;
27
-
28
- type ResourceId = string;
29
- interface ResourceDisplayConfig<Resource extends string = ResourceId> {
30
- type: Resource;
31
- label: string;
32
- icon: ReactNode | ComponentType<{
33
- className?: string;
34
- strokeWidth?: number;
35
- "aria-hidden"?: boolean | "true" | "false";
36
- }>;
37
- iconColor?: string;
38
- bgColor?: string;
39
- textColor?: string;
40
- }
41
- interface ResourceCounterItemState<Resource extends string = ResourceId> {
42
- type: Resource;
43
- label: string;
44
- icon: ResourceDisplayConfig<Resource>["icon"];
45
- iconColor?: string;
46
- bgColor?: string;
47
- textColor?: string;
48
- count: number;
49
- isZero: boolean;
50
- interactive: boolean;
51
- select: () => void;
52
- renderIcon: (props?: ResourceIconProps) => ReactNode;
53
- dataAttributes: {
54
- "data-resource-id": Resource;
55
- "data-resource-count": number;
56
- "data-resource-zero": boolean | undefined;
57
- "data-interactive": boolean | undefined;
58
- };
59
- }
60
- interface ResourceIconProps {
61
- className?: string;
62
- strokeWidth?: number;
63
- "aria-hidden"?: boolean | "true" | "false";
64
- }
65
- type ResourceCounterRootProps<Resource extends string = ResourceId> = Omit<PrimitiveCommonProps, "children"> & Omit<HTMLAttributes<HTMLElement>, "children"> & {
66
- resources: ReadonlyArray<ResourceDisplayConfig<Resource>>;
67
- counts: Partial<Record<Resource, number>>;
68
- zero?: "show" | "hide";
69
- onResourceClick?: (resourceType: Resource) => void;
70
- children: ReactNode;
71
- };
72
- type BoundResourceCounterRootProps<Resource extends string = ResourceId> = Omit<ResourceCounterRootProps<Resource>, "resources">;
73
- type ResourceCounterProps<Resource extends string = ResourceId> = ResourceCounterRootProps<Resource>;
74
- type ResourceCounterPartProps<Resource extends string = ResourceId> = Omit<PrimitiveCommonProps, "children"> & Omit<HTMLAttributes<HTMLElement>, "children"> & {
75
- children?: ReactNode | ((resource: ResourceCounterItemState<Resource>) => ReactNode);
76
- };
77
- declare function ResourceCounterRoot<Resource extends string = ResourceId>({ resources, counts, zero, onResourceClick, children, "aria-label": ariaLabel, ...props }: ResourceCounterRootProps<Resource>): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
78
- declare function ResourceCounterItem<Resource extends string = ResourceId>({ children, onClick, "aria-label": ariaLabel, ...props }: ResourceCounterPartProps<Resource>): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
79
- declare function ResourceCounterIcon<Resource extends string = ResourceId>({ className, strokeWidth, "aria-hidden": ariaHidden, }: ResourceIconProps): ReactNode;
80
- declare function ResourceCounterCount<Resource extends string = ResourceId>({ children, ...props }: ResourceCounterPartProps<Resource>): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
81
- declare function ResourceCounterLabel<Resource extends string = ResourceId>({ children, ...props }: ResourceCounterPartProps<Resource>): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
82
- interface ResourceCounterComponents<Resource extends string = ResourceId> {
83
- Root(props: BoundResourceCounterRootProps<Resource>): ReactElement;
84
- Item(props: ResourceCounterPartProps<Resource>): ReactElement;
85
- Icon(props: ResourceIconProps): ReactNode;
86
- Count(props: ResourceCounterPartProps<Resource>): ReactElement;
87
- Label(props: ResourceCounterPartProps<Resource>): ReactElement;
88
- }
89
- declare function createResourceCounter<Resource extends string>(resources: ReadonlyArray<ResourceDisplayConfig<Resource>>): ResourceCounterComponents<Resource>;
90
- declare const ResourceCounter: {
91
- Root: typeof ResourceCounterRoot;
92
- Item: typeof ResourceCounterItem;
93
- Icon: typeof ResourceCounterIcon;
94
- Count: typeof ResourceCounterCount;
95
- Label: typeof ResourceCounterLabel;
96
- };
97
-
98
- export { type BoundResourceCounterRootProps as B, type HandRole as H, type MobileHandRegistration as M, ResourceCounter as R, MobileHandTrayProvider as a, type ResourceCounterComponents as b, ResourceCounterCount as c, ResourceCounterIcon as d, ResourceCounterItem as e, type ResourceCounterItemState as f, ResourceCounterLabel as g, type ResourceCounterPartProps as h, type ResourceCounterProps as i, ResourceCounterRoot as j, type ResourceCounterRootProps as k, type ResourceDisplayConfig as l, type ResourceIconProps as m, createResourceCounter as n, useRegisterBottomOverlayInset as o, useRegisterMobileHand as p, useOverlayInsets as u };
@@ -1,99 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { CSSProperties, ReactNode } from 'react';
3
- import { ag as Theme, ai as ThemeOverride } from './hex-board-view-aKkblDp6.js';
4
-
5
- /**
6
- * The set of preset theme ids ships in `@dreamboard-games/sdk/ui`. Authors
7
- * may register additional ones by passing a fully-resolved {@link Theme}
8
- * instead of an id.
9
- */
10
- type ThemePresetId = "tabletop" | "arcade" | "studio";
11
- /**
12
- * Resolve a preset id (or a full theme) into a {@link Theme}.
13
- *
14
- * Used internally by {@link ThemeProvider}; exported so authors who
15
- * compose at the call site (e.g. for a side-by-side preview) can do
16
- * the same resolution without mounting a provider.
17
- */
18
- declare function resolveTheme(input: ThemePresetId | Theme | undefined): Theme;
19
- /** Look up a registered preset by id. Returns `undefined` if missing. */
20
- declare function getThemePreset(id: ThemePresetId): Theme | undefined;
21
- /**
22
- * Subset returned by {@link useTheme} — the resolved theme plus a
23
- * stable copy of its CSS-variable map so consumers can reuse it (for
24
- * example, to apply tokens to a portal that escapes the provider).
25
- */
26
- interface ThemeContextValue {
27
- /** Fully resolved theme. */
28
- readonly theme: Theme;
29
- /** CSS-var map consumable as `style` on a wrapper. */
30
- readonly cssVars: CSSProperties;
31
- }
32
- interface ThemeProviderProps {
33
- /**
34
- * Preset id, a full {@link Theme}, or omitted to use the `tabletop`
35
- * default.
36
- */
37
- theme?: ThemePresetId | Theme;
38
- /**
39
- * Deep-partial overrides merged onto the resolved base theme. Use
40
- * for one-off tweaks (e.g. swapping the player palette per game)
41
- * without writing a full theme.
42
- */
43
- override?: ThemeOverride;
44
- /**
45
- * Render mode for reduced-motion enforcement.
46
- *
47
- * - `auto` (default): respect the user's OS-level preference via
48
- * `prefers-reduced-motion: reduce`.
49
- * - `force`: force `motion.reducedMotion = "true"` regardless of the
50
- * OS preference (useful for screenshot CI).
51
- * - `ignore`: never override motion (use only when the embedding
52
- * shell already decides motion behaviour).
53
- */
54
- reducedMotion?: "auto" | "force" | "ignore";
55
- /**
56
- * Where to mount the wrapper. `block` (default) renders a `div` and
57
- * applies the CSS variables to it. `none` skips the wrapper entirely
58
- * — only useful when the parent is already a Dreamboard provider and
59
- * just needs to publish a different sub-tree (rare).
60
- */
61
- as?: "block" | "none";
62
- /** Extra style merged after the CSS-var map. */
63
- style?: CSSProperties;
64
- /** Extra className for the wrapper. */
65
- className?: string;
66
- children: ReactNode;
67
- }
68
- /**
69
- * Mounts a Dreamboard theme. The provider:
70
- *
71
- * 1. Resolves the preset (or accepts a full theme).
72
- * 2. Applies any deep-partial `override`.
73
- * 3. Optionally clamps `motion.reducedMotion` to `"true"` based on the
74
- * OS-level preference (or a forced override).
75
- * 4. Serialises the resolved theme into CSS variables on a wrapper
76
- * element so descendants can read tokens via `useTheme()` *or* via
77
- * `var(--db-...)` references in their own CSS / Tailwind.
78
- *
79
- * Defaults such as `<GameLayout>` mount this for you with the configured
80
- * theme; mount it manually only when you need a sub-tree to use a different
81
- * theme (e.g. a dark sheet over a light layout).
82
- */
83
- declare function ThemeProvider({ theme: themeInput, override, reducedMotion, as, style, className, children, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
84
- /**
85
- * Read the active {@link Theme} from a {@link ThemeProvider} ancestor.
86
- *
87
- * Falls back to the `tabletop` preset (with no overrides) when called
88
- * outside a provider — components remain renderable in isolated tests
89
- * and Storybook/Cosmos fixtures without a wrapping shell.
90
- */
91
- declare function useTheme(): Theme;
92
- /**
93
- * Read the {@link CSSProperties} that publish the active theme as CSS
94
- * variables. Useful when porting a theme into a portal or drawer that
95
- * is rendered outside the provider's DOM subtree.
96
- */
97
- declare function useThemeCssVars(): CSSProperties;
98
-
99
- export { type ThemeContextValue as T, type ThemePresetId as a, ThemeProvider as b, type ThemeProviderProps as c, useThemeCssVars as d, getThemePreset as g, resolveTheme as r, useTheme as u };
@@ -1,68 +0,0 @@
1
- import { q as BrowserInteractionIntent, i as BrowserInteractionCandidateState, h as BrowserInteractionActuatorKind, K as BrowserInteractionSurfaceEffect, k as BrowserInteractionEffectPattern, w as BrowserInteractionPreparationTarget, z as BrowserInteractionReadiness, V as GameplayBrowserInteractionIntent, X as GameplaySemanticEffect, Y as GameplaySemanticEffectPattern } from './types-DJj5MJkl.js';
2
-
3
- type BrowserInteractionAttributeMap = Record<string, string | boolean>;
4
- interface BrowserInteractionRootAttributesInput {
5
- readonly surface: string;
6
- readonly scopeId: string;
7
- readonly interactionKey: string;
8
- readonly interactionId: string;
9
- readonly descriptorDigest?: string;
10
- readonly draftDigest?: string;
11
- readonly readiness: BrowserInteractionReadiness;
12
- }
13
- interface BrowserInteractionActuatorAttributesInput {
14
- readonly surface: string;
15
- readonly scopeId: string;
16
- readonly interactionKey: string;
17
- readonly interactionId: string;
18
- readonly descriptorDigest?: string;
19
- readonly draftDigest?: string;
20
- readonly intent: BrowserInteractionIntent;
21
- readonly inputKey?: string;
22
- readonly candidateValue?: unknown;
23
- readonly candidateState?: BrowserInteractionCandidateState;
24
- readonly enabled?: boolean;
25
- readonly actuatorKind: BrowserInteractionActuatorKind;
26
- readonly actuatorId?: string;
27
- readonly semanticEffects?: readonly BrowserInteractionSurfaceEffect[];
28
- readonly acceptedEffectPatterns?: readonly BrowserInteractionEffectPattern[];
29
- readonly preparationPatterns?: readonly BrowserInteractionEffectPattern[];
30
- readonly prepares?: BrowserInteractionPreparationTarget;
31
- }
32
- interface BrowserInteractionPointerTargetAttributesInput {
33
- readonly surface: string;
34
- readonly scopeId: string;
35
- readonly interactionKey: string;
36
- readonly interactionId: string;
37
- readonly descriptorDigest?: string;
38
- readonly targetId: string;
39
- readonly enabled?: boolean;
40
- readonly acceptedEffectPatterns: readonly BrowserInteractionEffectPattern[];
41
- }
42
- declare function createBrowserInteractionRootAttributes(input: BrowserInteractionRootAttributesInput): BrowserInteractionAttributeMap;
43
- declare function createBrowserInteractionActuatorAttributes(input: BrowserInteractionActuatorAttributesInput): BrowserInteractionAttributeMap;
44
- declare function createBrowserInteractionPointerTargetAttributes(input: BrowserInteractionPointerTargetAttributesInput): BrowserInteractionAttributeMap;
45
- type GameplayInteractionRootAttributesInput = Omit<BrowserInteractionRootAttributesInput, "surface">;
46
- type GameplayActuatorAttributesInput = Omit<BrowserInteractionActuatorAttributesInput, "surface" | "intent" | "semanticEffects" | "acceptedEffectPatterns" | "preparationPatterns"> & {
47
- readonly intent: GameplayBrowserInteractionIntent;
48
- readonly semanticEffects?: readonly GameplaySemanticEffect[];
49
- readonly acceptedEffectPatterns?: readonly GameplaySemanticEffectPattern[];
50
- readonly preparationPatterns?: readonly GameplaySemanticEffectPattern[];
51
- };
52
- type GameplayPointerTargetAttributesInput = Omit<BrowserInteractionPointerTargetAttributesInput, "surface" | "acceptedEffectPatterns"> & {
53
- readonly acceptedEffectPatterns: readonly GameplaySemanticEffectPattern[];
54
- };
55
- declare function createGameplayInteractionRootAttributes(input: GameplayInteractionRootAttributesInput): BrowserInteractionAttributeMap;
56
- declare function createGameplayActuatorAttributes(input: GameplayActuatorAttributesInput): BrowserInteractionAttributeMap;
57
- declare function createGameplayPointerTargetAttributes(input: GameplayPointerTargetAttributesInput): BrowserInteractionAttributeMap;
58
- declare function createBrowserInteractionActuatorKey(input: {
59
- readonly surface: string;
60
- readonly scopeId: string;
61
- readonly interactionKey: string;
62
- readonly intent: BrowserInteractionIntent;
63
- readonly inputKey?: string;
64
- readonly candidateValueKey?: string;
65
- readonly actuatorKind: BrowserInteractionActuatorKind;
66
- }): string;
67
-
68
- export { type BrowserInteractionActuatorAttributesInput as B, type GameplayActuatorAttributesInput as G, type BrowserInteractionAttributeMap as a, type BrowserInteractionPointerTargetAttributesInput as b, type BrowserInteractionRootAttributesInput as c, type GameplayInteractionRootAttributesInput as d, type GameplayPointerTargetAttributesInput as e, createBrowserInteractionActuatorAttributes as f, createBrowserInteractionActuatorKey as g, createBrowserInteractionPointerTargetAttributes as h, createBrowserInteractionRootAttributes as i, createGameplayActuatorAttributes as j, createGameplayInteractionRootAttributes as k, createGameplayPointerTargetAttributes as l };