@dreamboard-games/sdk 0.5.0-alpha.2 → 0.5.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -45
- package/dist/chunk-DMFVAZI2.js +16 -0
- package/dist/chunk-DMFVAZI2.js.map +1 -0
- package/dist/chunk-FMM5LVJW.js +833 -0
- package/dist/chunk-FMM5LVJW.js.map +1 -0
- package/dist/{chunk-S2JEDVWH.js → chunk-LRILEVKC.js} +6113 -6489
- package/dist/chunk-LRILEVKC.js.map +1 -0
- package/dist/chunk-SP234IY4.js +1363 -0
- package/dist/chunk-SP234IY4.js.map +1 -0
- package/dist/chunk-VUWNJXLJ.js +52 -0
- package/dist/chunk-VUWNJXLJ.js.map +1 -0
- package/dist/chunk-ZPRKWPEP.js +511 -0
- package/dist/chunk-ZPRKWPEP.js.map +1 -0
- package/dist/definition-BaHNPZol.d.ts +4639 -0
- package/dist/diagnostics-B0lgnuZ6.d.ts +65 -0
- package/dist/index.d.ts +3553 -1
- package/dist/index.js +1045 -6
- package/dist/index.js.map +1 -1
- package/dist/model-BHro6yXu.d.ts +288 -0
- package/dist/react.d.ts +32 -0
- package/dist/react.js +80 -0
- package/dist/react.js.map +1 -0
- package/dist/reducer.d.ts +1194 -79
- package/dist/reducer.js +4326 -121
- package/dist/reducer.js.map +1 -1
- package/dist/testing.d.ts +518 -564
- package/dist/testing.js +2448 -915
- package/dist/testing.js.map +1 -1
- package/dist/types-DimqnJBq.d.ts +86 -0
- package/package.json +26 -131
- package/dist/HandView-Bi2lxzQP.d.ts +0 -79
- package/dist/ResourceCounter-BFxJknqp.d.ts +0 -98
- package/dist/ThemeProvider-CElaL2ik.d.ts +0 -99
- package/dist/attributes-DbvyMbXw.d.ts +0 -68
- package/dist/browser-interaction.d.ts +0 -910
- package/dist/browser-interaction.js +0 -119
- package/dist/browser-interaction.js.map +0 -1
- package/dist/chunk-32PFKDV7.js +0 -11705
- package/dist/chunk-32PFKDV7.js.map +0 -1
- package/dist/chunk-3BAD4VC2.js +0 -263
- package/dist/chunk-3BAD4VC2.js.map +0 -1
- package/dist/chunk-3SKDNDPG.js +0 -104
- package/dist/chunk-3SKDNDPG.js.map +0 -1
- package/dist/chunk-5YV2WHJ4.js +0 -25
- package/dist/chunk-5YV2WHJ4.js.map +0 -1
- package/dist/chunk-ANRB4XKA.js +0 -90
- package/dist/chunk-ANRB4XKA.js.map +0 -1
- package/dist/chunk-BI4G3PM2.js +0 -1864
- package/dist/chunk-BI4G3PM2.js.map +0 -1
- package/dist/chunk-EVCLTY4Q.js +0 -935
- package/dist/chunk-EVCLTY4Q.js.map +0 -1
- package/dist/chunk-GDPKTBUR.js +0 -564
- package/dist/chunk-GDPKTBUR.js.map +0 -1
- package/dist/chunk-H6VDGFL5.js +0 -2903
- package/dist/chunk-H6VDGFL5.js.map +0 -1
- package/dist/chunk-LR3ZTWQF.js +0 -5960
- package/dist/chunk-LR3ZTWQF.js.map +0 -1
- package/dist/chunk-PF7L4BMG.js +0 -117
- package/dist/chunk-PF7L4BMG.js.map +0 -1
- package/dist/chunk-PN5O6GG2.js +0 -32
- package/dist/chunk-PN5O6GG2.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/chunk-PZ5AY32C.js.map +0 -1
- package/dist/chunk-S2JEDVWH.js.map +0 -1
- package/dist/chunk-T3ZKNUZ7.js +0 -1
- package/dist/chunk-T3ZKNUZ7.js.map +0 -1
- package/dist/chunk-UGH54WZ2.js +0 -223
- package/dist/chunk-UGH54WZ2.js.map +0 -1
- package/dist/chunk-VCDWP5VL.js +0 -746
- package/dist/chunk-VCDWP5VL.js.map +0 -1
- package/dist/chunk-VDXOF4FW.js +0 -69
- package/dist/chunk-VDXOF4FW.js.map +0 -1
- package/dist/chunk-WHR5UW3F.js +0 -1988
- package/dist/chunk-WHR5UW3F.js.map +0 -1
- package/dist/chunk-Y75CFE77.js +0 -17
- package/dist/chunk-Y75CFE77.js.map +0 -1
- package/dist/chunk-Z7QCREWI.js +0 -3435
- package/dist/chunk-Z7QCREWI.js.map +0 -1
- package/dist/chunk-ZZGN2ATS.js +0 -1941
- package/dist/chunk-ZZGN2ATS.js.map +0 -1
- package/dist/components-gAbIz7hK.d.ts +0 -1284
- package/dist/definitions-BgmV_GhC.d.ts +0 -300
- package/dist/diagnostics-DIi3ina7.d.ts +0 -50
- package/dist/digest.d.ts +0 -8
- package/dist/game-CsZScpcn.d.ts +0 -763
- package/dist/hex-board-view-aKkblDp6.d.ts +0 -1228
- package/dist/index-CcT9Q7N7.d.ts +0 -193
- package/dist/index.d-DjzoK7zn.d.ts +0 -2101
- package/dist/package-set.d.ts +0 -13
- package/dist/package-set.js +0 -12
- package/dist/package-set.js.map +0 -1
- package/dist/player-state-Cqpyeql0.d.ts +0 -371
- package/dist/plugin-runtime-contract.d.ts +0 -17
- package/dist/plugin-runtime-contract.js +0 -92
- package/dist/plugin-runtime-contract.js.map +0 -1
- package/dist/primitive-props-BNHDkgd7.d.ts +0 -16
- package/dist/protocol-dYgafTYY.d.ts +0 -314
- package/dist/reducer/advanced.d.ts +0 -82
- package/dist/reducer/advanced.js +0 -51
- package/dist/reducer/advanced.js.map +0 -1
- package/dist/reducer-contract.d.ts +0 -11
- package/dist/reducer-contract.js +0 -16
- package/dist/reducer-contract.js.map +0 -1
- package/dist/reference-games/index.d.ts +0 -31
- package/dist/reference-games/index.js +0 -48
- package/dist/reference-games/index.js.map +0 -1
- package/dist/runtime/primitives.d.ts +0 -250
- package/dist/runtime/primitives.js +0 -189
- package/dist/runtime/primitives.js.map +0 -1
- package/dist/runtime/runtime-api.d.ts +0 -2
- package/dist/runtime/runtime-api.js +0 -1
- package/dist/runtime/runtime-api.js.map +0 -1
- package/dist/runtime/workspace-contract.d.ts +0 -392
- package/dist/runtime/workspace-contract.js +0 -28
- package/dist/runtime/workspace-contract.js.map +0 -1
- package/dist/runtime-RJ5orDJU.d.ts +0 -1699
- package/dist/runtime-api-Bz5pwNU_.d.ts +0 -296
- package/dist/runtime-json-CQ9QbLZ5.d.ts +0 -5
- package/dist/runtime.d.ts +0 -83
- package/dist/runtime.js +0 -242
- package/dist/runtime.js.map +0 -1
- package/dist/schema.d.ts +0 -379
- package/dist/stale-contract-artifact-error-XLaweZtF.d.ts +0 -18
- package/dist/testing-compiler.d.ts +0 -37
- package/dist/testing-compiler.js +0 -272
- package/dist/testing-compiler.js.map +0 -1
- package/dist/testing-runtime.d.ts +0 -119
- package/dist/testing-runtime.js +0 -212
- package/dist/testing-runtime.js.map +0 -1
- package/dist/types-DJj5MJkl.d.ts +0 -256
- package/dist/types-DR7DoB1x.d.ts +0 -28
- package/dist/types-JWCYHmu7.d.ts +0 -122
- package/dist/types.d.ts +0 -1958
- package/dist/types.js +0 -14
- package/dist/types.js.map +0 -1
- package/dist/ui/components.d.ts +0 -17
- package/dist/ui/components.js +0 -216
- package/dist/ui/components.js.map +0 -1
- package/dist/ui/defaults.d.ts +0 -19
- package/dist/ui/defaults.js +0 -104
- package/dist/ui/defaults.js.map +0 -1
- package/dist/ui/player-state.d.ts +0 -2
- package/dist/ui/player-state.js +0 -1
- package/dist/ui/player-state.js.map +0 -1
- package/dist/ui/plugin-styles.css +0 -2
- package/dist/ui-contract-GTUPkf8z.d.ts +0 -1168
- package/dist/ui.d.ts +0 -317
- package/dist/ui.js +0 -277
- package/dist/ui.js.map +0 -1
- package/dist/views-BpuWcOyN.d.ts +0 -1641
|
@@ -1,1228 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import { a as BoardId, l as HexTileState, k as HexEdgeState, E as EdgeTypeId, u as PlayerId, m as HexVertexState, V as VertexTypeId, w as SpaceTypeId, y as SquareCellState, z as SquareEdgeState, F as SquareVertexState, A as SquarePieceState, H as HexBoardState, x as SquareBoardState } from './player-state-Cqpyeql0.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Token contract for `@dreamboard-games/sdk/ui`.
|
|
7
|
-
*
|
|
8
|
-
* The {@link Theme} object is the only thing components consume for
|
|
9
|
-
* visual styling. Every preset (tabletop, arcade, studio) is just a
|
|
10
|
-
* different fully-resolved {@link Theme}; every author override is a
|
|
11
|
-
* deep partial of it. Components never inline hex codes, font stacks,
|
|
12
|
-
* or shadow strings — they read from `useTheme()` (or, when written in
|
|
13
|
-
* Tailwind, from CSS variables that the {@link ThemeProvider} writes
|
|
14
|
-
* onto its wrapper element).
|
|
15
|
-
*
|
|
16
|
-
* Architectural rules:
|
|
17
|
-
*
|
|
18
|
-
* 1. **Foundation → Semantic → Component.** Foundation palette ramps
|
|
19
|
-
* (`color.neutral`, `color.brand`, …) are never read directly by
|
|
20
|
-
* components. Components read `semantic.*` (e.g. `surface.card`,
|
|
21
|
-
* `intent.primary`) which the preset maps from foundation tokens.
|
|
22
|
-
* 2. **No optional deep keys.** Presets must supply every leaf so
|
|
23
|
-
* components don't need fallbacks. Author-supplied overrides are
|
|
24
|
-
* `DeepPartial<Theme>` and merged before the provider mounts.
|
|
25
|
-
* 3. **Scalar leaves only.** Every leaf is a string (CSS-ready) so the
|
|
26
|
-
* serializer can emit a CSS variable for it without per-token
|
|
27
|
-
* formatting logic.
|
|
28
|
-
*/
|
|
29
|
-
/** Identity-only metadata. */
|
|
30
|
-
interface ThemeMeta {
|
|
31
|
-
/** Stable id used by `data-dreamboard-theme` and CSS-var scoping. */
|
|
32
|
-
readonly id: string;
|
|
33
|
-
/** Human-readable name for dev tools. */
|
|
34
|
-
readonly name: string;
|
|
35
|
-
/**
|
|
36
|
-
* Render mode hint for components that need to choose between light
|
|
37
|
-
* and dark sub-tokens. Presets pick one; authors don't toggle this.
|
|
38
|
-
*/
|
|
39
|
-
readonly mode: "light" | "dark";
|
|
40
|
-
}
|
|
41
|
-
/** Foundation color ramp. Six stops keeps presets compact. */
|
|
42
|
-
interface ColorRamp {
|
|
43
|
-
readonly 50: string;
|
|
44
|
-
readonly 100: string;
|
|
45
|
-
readonly 200: string;
|
|
46
|
-
readonly 400: string;
|
|
47
|
-
readonly 600: string;
|
|
48
|
-
readonly 800: string;
|
|
49
|
-
readonly 950: string;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Per-player color tokens. The {@link Theme.player} array is indexed by
|
|
53
|
-
* 0-based seat slot (`player[0]` = first seat). Each entry carries a
|
|
54
|
-
* `solid` brand color, a `soft` tint usable as a background, and `on`
|
|
55
|
-
* — the recommended foreground when text sits on `solid`.
|
|
56
|
-
*/
|
|
57
|
-
interface PlayerColor {
|
|
58
|
-
readonly solid: string;
|
|
59
|
-
readonly soft: string;
|
|
60
|
-
readonly on: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Foundation palette. Components never read this directly; presets map
|
|
64
|
-
* these into {@link SemanticTokens}. Exposed so authors who write a
|
|
65
|
-
* full theme can compose without inventing their own palette type.
|
|
66
|
-
*/
|
|
67
|
-
interface FoundationColor {
|
|
68
|
-
readonly neutral: ColorRamp;
|
|
69
|
-
readonly brand: ColorRamp;
|
|
70
|
-
readonly accent: ColorRamp;
|
|
71
|
-
readonly success: ColorRamp;
|
|
72
|
-
readonly warning: ColorRamp;
|
|
73
|
-
readonly danger: ColorRamp;
|
|
74
|
-
readonly info: ColorRamp;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Semantic colors consumed by every component. These are the *only*
|
|
78
|
-
* color tokens components should reference. Names describe role
|
|
79
|
-
* ("the surface a player card sits on"), not appearance ("light grey").
|
|
80
|
-
*/
|
|
81
|
-
interface SemanticColor {
|
|
82
|
-
readonly surface: {
|
|
83
|
-
/** Outermost shell background. */
|
|
84
|
-
readonly app: string;
|
|
85
|
-
/** Board canvas background (behind tiles). */
|
|
86
|
-
readonly board: string;
|
|
87
|
-
/** HUD chrome panels (top bar, action bar, side rails). */
|
|
88
|
-
readonly hud: string;
|
|
89
|
-
/** Standalone cards (player cards, action cards, hand cards). */
|
|
90
|
-
readonly card: string;
|
|
91
|
-
/** Modal/sheet body. */
|
|
92
|
-
readonly sheet: string;
|
|
93
|
-
/** Scrim behind a blocker overlay. */
|
|
94
|
-
readonly overlay: string;
|
|
95
|
-
/** Subtle inset (resource pills, count badges, …). */
|
|
96
|
-
readonly inset: string;
|
|
97
|
-
};
|
|
98
|
-
readonly text: {
|
|
99
|
-
/** Default body and headline text on light surfaces. */
|
|
100
|
-
readonly primary: string;
|
|
101
|
-
/** De-emphasised metadata, hint copy, captions. */
|
|
102
|
-
readonly muted: string;
|
|
103
|
-
/** Text used on `intent.primary` solid backgrounds. */
|
|
104
|
-
readonly onIntent: string;
|
|
105
|
-
/** Brand-tinted text for emphasis (links, key numbers). */
|
|
106
|
-
readonly accent: string;
|
|
107
|
-
/** Disabled text (button labels in disabled state). */
|
|
108
|
-
readonly disabled: string;
|
|
109
|
-
};
|
|
110
|
-
readonly border: {
|
|
111
|
-
/** Hairline divider between sibling rows. */
|
|
112
|
-
readonly subtle: string;
|
|
113
|
-
/** Standard card / panel border. */
|
|
114
|
-
readonly default: string;
|
|
115
|
-
/** Outlined emphasis (hovered tiles, selected card). */
|
|
116
|
-
readonly strong: string;
|
|
117
|
-
/** Focus ring (keyboard nav). */
|
|
118
|
-
readonly focus: string;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Intent colours map to action emphasis. Components pick a slot
|
|
122
|
-
* (`primary` for "do the main thing now", `danger` for destructive
|
|
123
|
-
* confirms, etc.) and read both the surface and on-color from it.
|
|
124
|
-
*/
|
|
125
|
-
readonly intent: {
|
|
126
|
-
readonly primary: IntentColor;
|
|
127
|
-
readonly secondary: IntentColor;
|
|
128
|
-
readonly success: IntentColor;
|
|
129
|
-
readonly danger: IntentColor;
|
|
130
|
-
readonly warning: IntentColor;
|
|
131
|
-
readonly info: IntentColor;
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
/** A semantic intent (button background + matching foreground + soft tint). */
|
|
135
|
-
interface IntentColor {
|
|
136
|
-
/** Solid fill (button bg, badge bg). */
|
|
137
|
-
readonly solid: string;
|
|
138
|
-
/** Recommended text/icon color sitting on `solid`. */
|
|
139
|
-
readonly on: string;
|
|
140
|
-
/** Subtle tint (e.g. badge bg with `text` for foreground). */
|
|
141
|
-
readonly soft: string;
|
|
142
|
-
/** Suitable foreground when sitting on `soft`. */
|
|
143
|
-
readonly onSoft: string;
|
|
144
|
-
/** Border tint matched to this intent (e.g. focus ring on intent). */
|
|
145
|
-
readonly border: string;
|
|
146
|
-
}
|
|
147
|
-
/** Border-radius ramp. */
|
|
148
|
-
interface Radius {
|
|
149
|
-
readonly none: string;
|
|
150
|
-
readonly sm: string;
|
|
151
|
-
readonly md: string;
|
|
152
|
-
readonly lg: string;
|
|
153
|
-
/** HUD chrome (top bar pieces, action-bar bar). */
|
|
154
|
-
readonly hud: string;
|
|
155
|
-
/** Fully-round badges/pills. */
|
|
156
|
-
readonly pill: string;
|
|
157
|
-
}
|
|
158
|
-
/** Spacing ramp (rem-based by default). */
|
|
159
|
-
interface Space {
|
|
160
|
-
readonly 0: string;
|
|
161
|
-
readonly 0.5: string;
|
|
162
|
-
readonly 1: string;
|
|
163
|
-
readonly 1.5: string;
|
|
164
|
-
readonly 2: string;
|
|
165
|
-
readonly 3: string;
|
|
166
|
-
readonly 4: string;
|
|
167
|
-
readonly 6: string;
|
|
168
|
-
readonly 8: string;
|
|
169
|
-
readonly 12: string;
|
|
170
|
-
}
|
|
171
|
-
/** Typography tokens. */
|
|
172
|
-
interface Typography {
|
|
173
|
-
readonly fontFamily: {
|
|
174
|
-
/** Hero text — phase name, scoreboard headline, winner banner. */
|
|
175
|
-
readonly display: string;
|
|
176
|
-
/** Default UI body text. */
|
|
177
|
-
readonly body: string;
|
|
178
|
-
/** Numeric runs (scores, counters, tabular data). Tabular figures preferred. */
|
|
179
|
-
readonly tabular: string;
|
|
180
|
-
/** Source/code/raw-id rendering. */
|
|
181
|
-
readonly mono: string;
|
|
182
|
-
};
|
|
183
|
-
readonly fontSize: {
|
|
184
|
-
readonly xs: string;
|
|
185
|
-
readonly sm: string;
|
|
186
|
-
readonly md: string;
|
|
187
|
-
readonly lg: string;
|
|
188
|
-
readonly xl: string;
|
|
189
|
-
readonly "2xl": string;
|
|
190
|
-
readonly "3xl": string;
|
|
191
|
-
};
|
|
192
|
-
readonly fontWeight: {
|
|
193
|
-
readonly regular: string;
|
|
194
|
-
readonly medium: string;
|
|
195
|
-
readonly bold: string;
|
|
196
|
-
};
|
|
197
|
-
readonly lineHeight: {
|
|
198
|
-
readonly tight: string;
|
|
199
|
-
readonly normal: string;
|
|
200
|
-
readonly relaxed: string;
|
|
201
|
-
};
|
|
202
|
-
readonly letterSpacing: {
|
|
203
|
-
readonly tight: string;
|
|
204
|
-
readonly normal: string;
|
|
205
|
-
readonly wide: string;
|
|
206
|
-
/** All-caps labels ("YOUR TURN"). */
|
|
207
|
-
readonly caps: string;
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
/** Drop-shadow elevation ramp. */
|
|
211
|
-
interface Elevation {
|
|
212
|
-
/** Resting state (cards, panels). */
|
|
213
|
-
readonly rest: string;
|
|
214
|
-
/** Hover-lift (interactive cards). */
|
|
215
|
-
readonly hover: string;
|
|
216
|
-
/** Selected / dragged element. */
|
|
217
|
-
readonly lifted: string;
|
|
218
|
-
/** Modal / overlay stack. */
|
|
219
|
-
readonly overlay: string;
|
|
220
|
-
/** Inner shadow (board canvas inset, resource pill well). */
|
|
221
|
-
readonly inset: string;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Motion tokens. Components import durations and easings from here so a
|
|
225
|
-
* single `prefers-reduced-motion` switch zeroes everything out at the
|
|
226
|
-
* provider, not per-component.
|
|
227
|
-
*/
|
|
228
|
-
interface Motion {
|
|
229
|
-
readonly duration: {
|
|
230
|
-
/** Hover, focus, micro-press (~80ms). */
|
|
231
|
-
readonly fast: string;
|
|
232
|
-
/** Default — most state changes (~160ms). */
|
|
233
|
-
readonly normal: string;
|
|
234
|
-
/** Layout shifts, drawer open/close (~280ms). */
|
|
235
|
-
readonly slow: string;
|
|
236
|
-
/**
|
|
237
|
-
* Looping ambient pulses — active-player breath, dice glow.
|
|
238
|
-
* Components should respect `motion.reducedMotion` before kicking
|
|
239
|
-
* off looping animations.
|
|
240
|
-
*/
|
|
241
|
-
readonly ambient: string;
|
|
242
|
-
};
|
|
243
|
-
readonly easing: {
|
|
244
|
-
/** Default for entering / settling. */
|
|
245
|
-
readonly out: string;
|
|
246
|
-
/** Default for exiting. */
|
|
247
|
-
readonly in: string;
|
|
248
|
-
/** Symmetric. */
|
|
249
|
-
readonly inOut: string;
|
|
250
|
-
/** Springy — selected card lift, active-player wobble. */
|
|
251
|
-
readonly spring: string;
|
|
252
|
-
};
|
|
253
|
-
/**
|
|
254
|
-
* `"true"` when the active client requests reduced motion. Components
|
|
255
|
-
* should branch on this rather than forcing animations off via CSS,
|
|
256
|
-
* because some animations (e.g. dice roll, shuffle) are critical for
|
|
257
|
-
* conveying state and need a static fallback.
|
|
258
|
-
*/
|
|
259
|
-
readonly reducedMotion: "true" | "false";
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Component-level token slots derived from semantic + foundation tokens.
|
|
263
|
-
* Kept intentionally tiny — a slot is added here only when a component
|
|
264
|
-
* needs to deviate from the semantic mapping in a way that authors
|
|
265
|
-
* should be able to customise without re-skinning the whole intent
|
|
266
|
-
* scale.
|
|
267
|
-
*/
|
|
268
|
-
interface ComponentTokens {
|
|
269
|
-
readonly board: {
|
|
270
|
-
/** Outer ring around the board canvas. */
|
|
271
|
-
readonly frameBorder: string;
|
|
272
|
-
/** Inner board surface tint (overlays the canvas tile renderer). */
|
|
273
|
-
readonly frameBackground: string;
|
|
274
|
-
/** Highlight ring drawn on hovered interactive targets. */
|
|
275
|
-
readonly hoverRing: string;
|
|
276
|
-
/** Idle hint colour for eligible-but-unhovered targets. */
|
|
277
|
-
readonly eligibleHint: string;
|
|
278
|
-
};
|
|
279
|
-
readonly card: {
|
|
280
|
-
/** Border drawn around face-up cards. */
|
|
281
|
-
readonly border: string;
|
|
282
|
-
/** Border drawn around face-down cards. */
|
|
283
|
-
readonly backBorder: string;
|
|
284
|
-
/** Card-back fill colour. */
|
|
285
|
-
readonly backBackground: string;
|
|
286
|
-
/** Selected outline. */
|
|
287
|
-
readonly selectedRing: string;
|
|
288
|
-
};
|
|
289
|
-
readonly playerCard: {
|
|
290
|
-
/** Background of the active-player card. */
|
|
291
|
-
readonly activeBackground: string;
|
|
292
|
-
/** Border of the active-player card. */
|
|
293
|
-
readonly activeBorder: string;
|
|
294
|
-
/** Glow colour radiated by the active-player card. */
|
|
295
|
-
readonly activeGlow: string;
|
|
296
|
-
/** Background of the "you" badge. */
|
|
297
|
-
readonly youBadgeBackground: string;
|
|
298
|
-
/** Foreground of the "you" badge. */
|
|
299
|
-
readonly youBadgeForeground: string;
|
|
300
|
-
};
|
|
301
|
-
readonly toast: {
|
|
302
|
-
readonly successBackground: string;
|
|
303
|
-
readonly errorBackground: string;
|
|
304
|
-
readonly infoBackground: string;
|
|
305
|
-
readonly foreground: string;
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* The complete theme contract. Every leaf is a CSS-ready string so the
|
|
310
|
-
* provider can emit a CSS variable for each path without per-leaf
|
|
311
|
-
* formatting. {@link DeepPartial} is exported for author overrides.
|
|
312
|
-
*/
|
|
313
|
-
interface Theme {
|
|
314
|
-
readonly meta: ThemeMeta;
|
|
315
|
-
readonly color: FoundationColor;
|
|
316
|
-
readonly semantic: SemanticColor;
|
|
317
|
-
readonly radius: Radius;
|
|
318
|
-
readonly space: Space;
|
|
319
|
-
readonly typography: Typography;
|
|
320
|
-
readonly elevation: Elevation;
|
|
321
|
-
readonly motion: Motion;
|
|
322
|
-
readonly player: readonly [
|
|
323
|
-
PlayerColor,
|
|
324
|
-
PlayerColor,
|
|
325
|
-
PlayerColor,
|
|
326
|
-
PlayerColor,
|
|
327
|
-
PlayerColor,
|
|
328
|
-
PlayerColor
|
|
329
|
-
];
|
|
330
|
-
readonly component: ComponentTokens;
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Recursive partial for theme overrides. Authors pass this to
|
|
334
|
-
* `<ThemeProvider override={...}/>` (or to a preset's `extend`
|
|
335
|
-
* helper) to tweak individual tokens without re-declaring the whole
|
|
336
|
-
* tree.
|
|
337
|
-
*/
|
|
338
|
-
type ThemeOverride = DeepPartial<Theme>;
|
|
339
|
-
type DeepPartial<T> = T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends object ? {
|
|
340
|
-
readonly [K in keyof T]?: DeepPartial<T[K]>;
|
|
341
|
-
} : T;
|
|
342
|
-
/**
|
|
343
|
-
* Deep merge for {@link Theme} overrides. Arrays (notably
|
|
344
|
-
* {@link Theme.player}) are *replaced* rather than merged so callers
|
|
345
|
-
* can't accidentally end up with mixed-preset palettes.
|
|
346
|
-
*/
|
|
347
|
-
declare function mergeTheme(base: Theme, override?: ThemeOverride): Theme;
|
|
348
|
-
|
|
349
|
-
type RuntimeFields = Record<string, unknown>;
|
|
350
|
-
interface GeneratedTiledEdgeStateLike<SpaceIdValue extends string = string, EdgeIdValue extends string = string, Fields = RuntimeFields> {
|
|
351
|
-
id: EdgeIdValue;
|
|
352
|
-
spaceIds: readonly SpaceIdValue[];
|
|
353
|
-
typeId?: EdgeTypeId | null;
|
|
354
|
-
label?: string | null;
|
|
355
|
-
ownerId?: PlayerId | null;
|
|
356
|
-
fields?: Fields;
|
|
357
|
-
}
|
|
358
|
-
interface GeneratedTiledVertexStateLike<SpaceIdValue extends string = string, VertexIdValue extends string = string, Fields = RuntimeFields> {
|
|
359
|
-
id: VertexIdValue;
|
|
360
|
-
spaceIds: readonly SpaceIdValue[];
|
|
361
|
-
typeId?: VertexTypeId | null;
|
|
362
|
-
label?: string | null;
|
|
363
|
-
ownerId?: PlayerId | null;
|
|
364
|
-
fields?: Fields;
|
|
365
|
-
}
|
|
366
|
-
interface GeneratedHexSpaceStateLike<SpaceIdValue extends string = string, Fields = RuntimeFields> {
|
|
367
|
-
id: SpaceIdValue;
|
|
368
|
-
q: number;
|
|
369
|
-
r: number;
|
|
370
|
-
typeId?: SpaceTypeId | null;
|
|
371
|
-
label?: string | null;
|
|
372
|
-
ownerId?: PlayerId | null;
|
|
373
|
-
fields?: Fields;
|
|
374
|
-
}
|
|
375
|
-
interface GeneratedSquareSpaceStateLike<SpaceIdValue extends string = string, Fields = RuntimeFields> {
|
|
376
|
-
id: SpaceIdValue;
|
|
377
|
-
row: number;
|
|
378
|
-
col: number;
|
|
379
|
-
typeId?: SpaceTypeId | null;
|
|
380
|
-
label?: string | null;
|
|
381
|
-
ownerId?: PlayerId | null;
|
|
382
|
-
fields?: Fields;
|
|
383
|
-
}
|
|
384
|
-
interface GeneratedHexBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields> {
|
|
385
|
-
id: BoardIdValue;
|
|
386
|
-
layout?: "hex";
|
|
387
|
-
orientation?: "pointy-top" | "flat-top";
|
|
388
|
-
spaces: Readonly<Record<SpaceIdValue, GeneratedHexSpaceStateLike<SpaceIdValue, SpaceFields>>>;
|
|
389
|
-
edges: ReadonlyArray<HexEdgeState<BoardIdValue, SpaceIdValue, EdgeIdValue, EdgeFields> | GeneratedTiledEdgeStateLike<SpaceIdValue, EdgeIdValue, EdgeFields>>;
|
|
390
|
-
vertices: ReadonlyArray<HexVertexState<BoardIdValue, SpaceIdValue, VertexIdValue, VertexFields> | GeneratedTiledVertexStateLike<SpaceIdValue, VertexIdValue, VertexFields>>;
|
|
391
|
-
}
|
|
392
|
-
interface AuthoredHexBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields, SpaceView = unknown> {
|
|
393
|
-
id: BoardIdValue;
|
|
394
|
-
layout?: "hex";
|
|
395
|
-
orientation?: "pointy-top" | "flat-top";
|
|
396
|
-
tiles: ReadonlyArray<HexTileState<BoardIdValue, SpaceIdValue, SpaceFields, SpaceView>>;
|
|
397
|
-
edges: ReadonlyArray<HexEdgeState<BoardIdValue, SpaceIdValue, EdgeIdValue, EdgeFields> | GeneratedTiledEdgeStateLike<SpaceIdValue, EdgeIdValue, EdgeFields>>;
|
|
398
|
-
vertices: ReadonlyArray<HexVertexState<BoardIdValue, SpaceIdValue, VertexIdValue, VertexFields> | GeneratedTiledVertexStateLike<SpaceIdValue, VertexIdValue, VertexFields>>;
|
|
399
|
-
}
|
|
400
|
-
type HexBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields> = AuthoredHexBoardInput<BoardIdValue, SpaceIdValue, EdgeIdValue, VertexIdValue, SpaceFields, EdgeFields, VertexFields> | GeneratedHexBoardInput<BoardIdValue, SpaceIdValue, EdgeIdValue, VertexIdValue, SpaceFields, EdgeFields, VertexFields>;
|
|
401
|
-
interface GeneratedSquareBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, PieceIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields, PieceFields = RuntimeFields> {
|
|
402
|
-
id: BoardIdValue;
|
|
403
|
-
layout?: "square";
|
|
404
|
-
spaces: Readonly<Record<SpaceIdValue, GeneratedSquareSpaceStateLike<SpaceIdValue, SpaceFields>>>;
|
|
405
|
-
edges: ReadonlyArray<SquareEdgeState<SpaceIdValue, EdgeIdValue, EdgeFields> | GeneratedTiledEdgeStateLike<SpaceIdValue, EdgeIdValue, EdgeFields>>;
|
|
406
|
-
vertices: ReadonlyArray<SquareVertexState<SpaceIdValue, VertexIdValue, VertexFields> | GeneratedTiledVertexStateLike<SpaceIdValue, VertexIdValue, VertexFields>>;
|
|
407
|
-
pieces?: ReadonlyArray<SquarePieceState<PieceIdValue, PieceFields>>;
|
|
408
|
-
}
|
|
409
|
-
interface AuthoredSquareBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, PieceIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields, PieceFields = RuntimeFields> {
|
|
410
|
-
id: BoardIdValue;
|
|
411
|
-
layout?: "square";
|
|
412
|
-
rows: number;
|
|
413
|
-
cols: number;
|
|
414
|
-
cells: ReadonlyArray<SquareCellState<SpaceIdValue, SpaceFields>>;
|
|
415
|
-
edges: ReadonlyArray<SquareEdgeState<SpaceIdValue, EdgeIdValue, EdgeFields> | GeneratedTiledEdgeStateLike<SpaceIdValue, EdgeIdValue, EdgeFields>>;
|
|
416
|
-
vertices: ReadonlyArray<SquareVertexState<SpaceIdValue, VertexIdValue, VertexFields> | GeneratedTiledVertexStateLike<SpaceIdValue, VertexIdValue, VertexFields>>;
|
|
417
|
-
pieces: ReadonlyArray<SquarePieceState<PieceIdValue, PieceFields>>;
|
|
418
|
-
}
|
|
419
|
-
type SquareBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, PieceIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields, PieceFields = RuntimeFields> = AuthoredSquareBoardInput<BoardIdValue, SpaceIdValue, EdgeIdValue, VertexIdValue, PieceIdValue, SpaceFields, EdgeFields, VertexFields, PieceFields> | GeneratedSquareBoardInput<BoardIdValue, SpaceIdValue, EdgeIdValue, VertexIdValue, PieceIdValue, SpaceFields, EdgeFields, VertexFields, PieceFields>;
|
|
420
|
-
type AnyHexBoardInput = HexBoardInput<string, string, string, string, RuntimeFields, RuntimeFields, RuntimeFields>;
|
|
421
|
-
type AnySquareBoardInput = SquareBoardInput<string, string, string, string, string, RuntimeFields, RuntimeFields, RuntimeFields, RuntimeFields>;
|
|
422
|
-
type BoardIdOf<TBoard> = TBoard extends {
|
|
423
|
-
id: infer Id extends string;
|
|
424
|
-
} ? Id : string;
|
|
425
|
-
type SpaceRecordValueOf<TBoard> = TBoard extends {
|
|
426
|
-
spaces: Readonly<Record<string, infer Space>>;
|
|
427
|
-
} ? Space : never;
|
|
428
|
-
type TileValueOf<TBoard> = TBoard extends {
|
|
429
|
-
tiles: ReadonlyArray<infer Tile>;
|
|
430
|
-
} ? Tile : never;
|
|
431
|
-
type CellValueOf<TBoard> = TBoard extends {
|
|
432
|
-
cells: ReadonlyArray<infer Cell>;
|
|
433
|
-
} ? Cell : never;
|
|
434
|
-
type EdgeValueOf<TBoard> = TBoard extends {
|
|
435
|
-
edges: ReadonlyArray<infer Edge>;
|
|
436
|
-
} ? Edge : never;
|
|
437
|
-
type VertexValueOf<TBoard> = TBoard extends {
|
|
438
|
-
vertices: ReadonlyArray<infer Vertex>;
|
|
439
|
-
} ? Vertex : never;
|
|
440
|
-
type PieceValueOf<TBoard> = TBoard extends {
|
|
441
|
-
pieces?: ReadonlyArray<infer Piece>;
|
|
442
|
-
} ? Piece : never;
|
|
443
|
-
type BoardSpaceIdOf<TBoard> = SpaceRecordValueOf<TBoard> extends {
|
|
444
|
-
id: infer Id extends string;
|
|
445
|
-
} ? Id : TileValueOf<TBoard> extends {
|
|
446
|
-
id: infer Id extends string;
|
|
447
|
-
} ? Id : CellValueOf<TBoard> extends {
|
|
448
|
-
id: infer Id extends string;
|
|
449
|
-
} ? Id : never;
|
|
450
|
-
type BoardEdgeIdOf<TBoard> = EdgeValueOf<TBoard> extends {
|
|
451
|
-
id: infer Id extends string;
|
|
452
|
-
} ? Id : never;
|
|
453
|
-
type BoardVertexIdOf<TBoard> = VertexValueOf<TBoard> extends {
|
|
454
|
-
id: infer Id extends string;
|
|
455
|
-
} ? Id : never;
|
|
456
|
-
type HexTilePropertiesOf<TBoard> = SpaceRecordValueOf<TBoard> extends {
|
|
457
|
-
fields?: infer Fields;
|
|
458
|
-
} ? Fields : TileValueOf<TBoard> extends {
|
|
459
|
-
properties?: infer Properties;
|
|
460
|
-
} ? Properties : RuntimeFields;
|
|
461
|
-
type HexTileViewOf<TBoard> = TileValueOf<TBoard> extends {
|
|
462
|
-
view: infer View;
|
|
463
|
-
} ? View : TileValueOf<TBoard> extends {
|
|
464
|
-
view?: infer View;
|
|
465
|
-
} ? View | undefined : unknown;
|
|
466
|
-
type HexEdgePropertiesOf<TBoard> = EdgeValueOf<TBoard> extends {
|
|
467
|
-
fields?: infer Fields;
|
|
468
|
-
} ? Fields : EdgeValueOf<TBoard> extends {
|
|
469
|
-
properties?: infer Properties;
|
|
470
|
-
} ? Properties : RuntimeFields;
|
|
471
|
-
type HexVertexPropertiesOf<TBoard> = VertexValueOf<TBoard> extends {
|
|
472
|
-
fields?: infer Fields;
|
|
473
|
-
} ? Fields : VertexValueOf<TBoard> extends {
|
|
474
|
-
properties?: infer Properties;
|
|
475
|
-
} ? Properties : RuntimeFields;
|
|
476
|
-
type SquareCellPropertiesOf<TBoard> = SpaceRecordValueOf<TBoard> extends {
|
|
477
|
-
fields?: infer Fields;
|
|
478
|
-
} ? Fields : CellValueOf<TBoard> extends {
|
|
479
|
-
properties?: infer Properties;
|
|
480
|
-
} ? Properties : RuntimeFields;
|
|
481
|
-
type SquareEdgePropertiesOf<TBoard> = EdgeValueOf<TBoard> extends {
|
|
482
|
-
fields?: infer Fields;
|
|
483
|
-
} ? Fields : EdgeValueOf<TBoard> extends {
|
|
484
|
-
properties?: infer Properties;
|
|
485
|
-
} ? Properties : RuntimeFields;
|
|
486
|
-
type SquareVertexPropertiesOf<TBoard> = VertexValueOf<TBoard> extends {
|
|
487
|
-
fields?: infer Fields;
|
|
488
|
-
} ? Fields : VertexValueOf<TBoard> extends {
|
|
489
|
-
properties?: infer Properties;
|
|
490
|
-
} ? Properties : RuntimeFields;
|
|
491
|
-
type SquarePiecePropertiesOf<TBoard> = PieceValueOf<TBoard> extends {
|
|
492
|
-
properties?: infer Properties;
|
|
493
|
-
} ? Properties : RuntimeFields;
|
|
494
|
-
/**
|
|
495
|
-
* Normalized hex tile shape for a given board input.
|
|
496
|
-
*
|
|
497
|
-
* `view` is always present (required) on the result so consumers can
|
|
498
|
-
* read overlay fields without a null-check. For boards that do not
|
|
499
|
-
* statically declare a `view` shape (the generic case), `view` falls
|
|
500
|
-
* back to `unknown`, which still admits any value.
|
|
501
|
-
*
|
|
502
|
-
* The runtime normalizer injects `view: undefined` for inputs that
|
|
503
|
-
* do not author a `view` field, keeping the runtime contract aligned
|
|
504
|
-
* with this static shape.
|
|
505
|
-
*/
|
|
506
|
-
type NormalizedHexTileOf<TBoard extends AnyHexBoardInput> = Omit<HexTileState<BoardIdOf<TBoard>, BoardSpaceIdOf<TBoard>, HexTilePropertiesOf<TBoard>, HexTileViewOf<TBoard>>, "view"> & {
|
|
507
|
-
view: HexTileViewOf<TBoard>;
|
|
508
|
-
};
|
|
509
|
-
type NormalizedHexEdgeOf<TBoard extends AnyHexBoardInput> = HexEdgeState<BoardIdOf<TBoard>, BoardSpaceIdOf<TBoard>, BoardEdgeIdOf<TBoard>, HexEdgePropertiesOf<TBoard>>;
|
|
510
|
-
type NormalizedHexVertexOf<TBoard extends AnyHexBoardInput> = HexVertexState<BoardIdOf<TBoard>, BoardSpaceIdOf<TBoard>, BoardVertexIdOf<TBoard>, HexVertexPropertiesOf<TBoard>>;
|
|
511
|
-
type NormalizedSquareCellOf<TBoard extends AnySquareBoardInput> = SquareCellState<BoardSpaceIdOf<TBoard>, SquareCellPropertiesOf<TBoard>>;
|
|
512
|
-
type NormalizedSquareEdgeOf<TBoard extends AnySquareBoardInput> = SquareEdgeState<BoardSpaceIdOf<TBoard>, BoardEdgeIdOf<TBoard>, SquareEdgePropertiesOf<TBoard>>;
|
|
513
|
-
type NormalizedSquareVertexOf<TBoard extends AnySquareBoardInput> = SquareVertexState<BoardSpaceIdOf<TBoard>, BoardVertexIdOf<TBoard>, SquareVertexPropertiesOf<TBoard>>;
|
|
514
|
-
type NormalizedSquarePieceOf<TBoard extends AnySquareBoardInput> = SquarePieceState<PieceValueOf<TBoard> extends {
|
|
515
|
-
id: infer PieceIdValue extends string;
|
|
516
|
-
} ? PieceIdValue : string, SquarePiecePropertiesOf<TBoard>>;
|
|
517
|
-
type NormalizedHexBoard<TBoard extends AnyHexBoardInput> = Omit<Pick<HexBoardState<BoardIdOf<TBoard>, BoardSpaceIdOf<TBoard>, BoardEdgeIdOf<TBoard>, BoardVertexIdOf<TBoard>, HexTilePropertiesOf<TBoard>, HexEdgePropertiesOf<TBoard>, HexVertexPropertiesOf<TBoard>>, "id" | "tiles" | "edges" | "vertices">, "tiles"> & {
|
|
518
|
-
tiles: ReadonlyArray<NormalizedHexTileOf<TBoard>>;
|
|
519
|
-
orientation?: "pointy-top" | "flat-top";
|
|
520
|
-
};
|
|
521
|
-
type NormalizedSquareBoard<TBoard extends AnySquareBoardInput> = Pick<SquareBoardState<BoardIdOf<TBoard>, BoardSpaceIdOf<TBoard>, BoardEdgeIdOf<TBoard>, BoardVertexIdOf<TBoard>, PieceValueOf<TBoard> extends {
|
|
522
|
-
id: infer PieceIdValue extends string;
|
|
523
|
-
} ? PieceIdValue : string, SquareCellPropertiesOf<TBoard>, SquareEdgePropertiesOf<TBoard>, SquareVertexPropertiesOf<TBoard>, SquarePiecePropertiesOf<TBoard>>, "id" | "rows" | "cols" | "cells" | "edges" | "vertices" | "pieces">;
|
|
524
|
-
declare function normalizeHexBoardInput<TBoard extends AnyHexBoardInput>(board: TBoard): NormalizedHexBoard<TBoard>;
|
|
525
|
-
declare function normalizeSquareBoardInput<TBoard extends AnySquareBoardInput>(board: TBoard): NormalizedSquareBoard<TBoard>;
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* Controlled visual state contract for `@dreamboard-games/sdk/ui` components.
|
|
529
|
-
*
|
|
530
|
-
* The SDK is Dreamboard-interaction unaware: components consume `display data`
|
|
531
|
-
* and `controlled semantic states`. Runtime adapters compute these states from
|
|
532
|
-
* descriptors/drafts and pass them in as plain props.
|
|
533
|
-
*/
|
|
534
|
-
/**
|
|
535
|
-
* Generic semantic state attached to a presentational component.
|
|
536
|
-
*
|
|
537
|
-
* Every flag is optional and renders as a stable `data-*` attribute on the
|
|
538
|
-
* underlying element so that selectors, snapshot diffs and accessibility
|
|
539
|
-
* announcements can react to state without inspecting class strings.
|
|
540
|
-
*/
|
|
541
|
-
interface InteractionVisualState {
|
|
542
|
-
/** Caller may activate this surface right now. */
|
|
543
|
-
eligible?: boolean;
|
|
544
|
-
/**
|
|
545
|
-
* Eligible *and* a meaningful subset — i.e. at least one peer surface is not
|
|
546
|
-
* eligible. Use this (rather than `eligible`) to drive a "highlight the
|
|
547
|
-
* playable cards" affordance: when every card in a hand is a legal target
|
|
548
|
-
* (e.g. a pass where any card may be chosen, or a turn where you may play
|
|
549
|
-
* anything) the highlight carries no information, so `distinctlyEligible` is
|
|
550
|
-
* `false` for all of them and the ring naturally disappears. `eligible`
|
|
551
|
-
* keeps its literal meaning ("is a legal target") for dimming/logic.
|
|
552
|
-
*/
|
|
553
|
-
distinctlyEligible?: boolean;
|
|
554
|
-
/** Currently chosen as part of a draft selection or focus state. */
|
|
555
|
-
selected?: boolean;
|
|
556
|
-
/** Surface is non-interactive and visually muted. */
|
|
557
|
-
disabled?: boolean;
|
|
558
|
-
/** Caller's draft is invalid — render an error tint without removing the surface. */
|
|
559
|
-
invalid?: boolean;
|
|
560
|
-
/** Action has been submitted; render a settled/locked feedback state. */
|
|
561
|
-
submitted?: boolean;
|
|
562
|
-
/** Surface is being previewed (long-press, hover hold) without commitment. */
|
|
563
|
-
previewing?: boolean;
|
|
564
|
-
/**
|
|
565
|
-
* Optional 0..1 progress reading for an in-flight UI intent (swipe, hold,
|
|
566
|
-
* etc.). Components may render this as a fill, scale or halo without owning
|
|
567
|
-
* the gesture pipeline themselves.
|
|
568
|
-
*/
|
|
569
|
-
intentProgress?: number;
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* Generic UI intent emitted by SDK components.
|
|
573
|
-
*
|
|
574
|
-
* Components do not know what `activate`/`drop` mean in Dreamboard terms —
|
|
575
|
-
* that mapping belongs to a runtime adapter. They only emit when a generic
|
|
576
|
-
* pointer/keyboard gesture completes.
|
|
577
|
-
*
|
|
578
|
-
* - `activate` is a single-target commit produced by a desktop click or a
|
|
579
|
-
* keyboard activation in `direct-activate` mode.
|
|
580
|
-
* - `drop` is a card→target commit produced by mobile drag or keyboard drop
|
|
581
|
-
* in `drag-to-target` mode. The opaque `targetId` is registered by a
|
|
582
|
-
* `CardDropTargetView` and resolved against pointer geometry inside the
|
|
583
|
-
* `CardDragSurface`.
|
|
584
|
-
* - `previewStart`/`previewEnd` bracket a long-press inspection that does
|
|
585
|
-
* not commit.
|
|
586
|
-
*/
|
|
587
|
-
type CardIntent<CardId extends string = string, TargetId extends string = string> = {
|
|
588
|
-
type: "activate";
|
|
589
|
-
cardId: CardId;
|
|
590
|
-
source: "tap" | "keyboard";
|
|
591
|
-
} | {
|
|
592
|
-
type: "previewStart";
|
|
593
|
-
cardId: CardId;
|
|
594
|
-
} | {
|
|
595
|
-
type: "previewEnd";
|
|
596
|
-
cardId: CardId;
|
|
597
|
-
} | {
|
|
598
|
-
type: "drop";
|
|
599
|
-
cardId: CardId;
|
|
600
|
-
targetId: TargetId;
|
|
601
|
-
source: "pointer" | "keyboard";
|
|
602
|
-
};
|
|
603
|
-
/**
|
|
604
|
-
* Generic UI intent emitted for a board target (space/edge/vertex).
|
|
605
|
-
*/
|
|
606
|
-
type TargetIntent<TargetId extends string = string> = {
|
|
607
|
-
type: "activate";
|
|
608
|
-
targetId: TargetId;
|
|
609
|
-
source: "tap" | "keyboard";
|
|
610
|
-
} | {
|
|
611
|
-
type: "previewStart";
|
|
612
|
-
targetId: TargetId;
|
|
613
|
-
} | {
|
|
614
|
-
type: "previewEnd";
|
|
615
|
-
targetId: TargetId;
|
|
616
|
-
};
|
|
617
|
-
/**
|
|
618
|
-
* Controlled visual state for a card drop target rendered through
|
|
619
|
-
* `CardDropTargetView`.
|
|
620
|
-
*
|
|
621
|
-
* `active` is `true` when any card is currently being dragged anywhere on
|
|
622
|
-
* the surface (eligible target should advertise itself). `over` is `true`
|
|
623
|
-
* only for the target that the lifted pointer would currently drop on.
|
|
624
|
-
*/
|
|
625
|
-
interface CardDropTargetVisualState extends InteractionVisualState {
|
|
626
|
-
active?: boolean;
|
|
627
|
-
over?: boolean;
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* Build the `data-*` attribute bag for an {@link InteractionVisualState} so
|
|
631
|
-
* that components apply a single consistent attribute surface.
|
|
632
|
-
*
|
|
633
|
-
* `undefined` values are emitted (rather than `false`) so that CSS
|
|
634
|
-
* `[data-…="true"]` selectors do not match by mistake.
|
|
635
|
-
*/
|
|
636
|
-
declare function visualStateDataAttributes(state: InteractionVisualState | undefined): Readonly<Record<string, string | undefined>>;
|
|
637
|
-
/**
|
|
638
|
-
* Build the `data-*` attribute bag for a {@link CardDropTargetVisualState}.
|
|
639
|
-
*/
|
|
640
|
-
declare function dropTargetVisualStateDataAttributes(state: CardDropTargetVisualState | undefined): Readonly<Record<string, string | undefined>>;
|
|
641
|
-
|
|
642
|
-
type BoardTargetKind = "edge" | "vertex" | "space" | "tile";
|
|
643
|
-
interface InteractiveTargetState {
|
|
644
|
-
kind?: BoardTargetKind;
|
|
645
|
-
id: string;
|
|
646
|
-
eligible: boolean;
|
|
647
|
-
selectable: boolean;
|
|
648
|
-
hovered: boolean;
|
|
649
|
-
pending: boolean;
|
|
650
|
-
conflict: boolean;
|
|
651
|
-
unavailableReason?: string;
|
|
652
|
-
browserAttributes?: Record<string, string | boolean>;
|
|
653
|
-
select?: () => unknown | Promise<unknown>;
|
|
654
|
-
}
|
|
655
|
-
interface InteractiveTargetLayer {
|
|
656
|
-
enabled?: boolean;
|
|
657
|
-
eligible?: ReadonlySet<string>;
|
|
658
|
-
selectTargetId?: (targetId: string) => unknown | Promise<unknown>;
|
|
659
|
-
targetState?: (targetId: string) => Partial<InteractiveTargetState>;
|
|
660
|
-
}
|
|
661
|
-
interface InteractiveTargetRenderState extends InteractiveTargetState {
|
|
662
|
-
isEnabled: boolean;
|
|
663
|
-
isEligible: boolean;
|
|
664
|
-
isHovered: boolean;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
interface SquareEdgePosition {
|
|
668
|
-
x1: number;
|
|
669
|
-
y1: number;
|
|
670
|
-
x2: number;
|
|
671
|
-
y2: number;
|
|
672
|
-
midX: number;
|
|
673
|
-
midY: number;
|
|
674
|
-
angle: number;
|
|
675
|
-
}
|
|
676
|
-
interface SquareVertexPosition {
|
|
677
|
-
x: number;
|
|
678
|
-
y: number;
|
|
679
|
-
}
|
|
680
|
-
interface InteractiveSquareEdge<TBoard extends AnySquareBoardInput = AnySquareBoardInput> extends NormalizedSquareEdgeOf<TBoard> {
|
|
681
|
-
position: SquareEdgePosition;
|
|
682
|
-
}
|
|
683
|
-
interface InteractiveSquareVertex<TBoard extends AnySquareBoardInput = AnySquareBoardInput> extends NormalizedSquareVertexOf<TBoard> {
|
|
684
|
-
position: SquareVertexPosition;
|
|
685
|
-
}
|
|
686
|
-
type InteractiveSquareSpace<TBoard extends AnySquareBoardInput = AnySquareBoardInput> = NormalizedSquareCellOf<TBoard>;
|
|
687
|
-
interface SquareGeneratedGridInputProps {
|
|
688
|
-
id?: string;
|
|
689
|
-
layout?: "square";
|
|
690
|
-
spaces: Extract<AnySquareBoardInput, {
|
|
691
|
-
spaces: unknown;
|
|
692
|
-
}>["spaces"];
|
|
693
|
-
pieces?: AnySquareBoardInput["pieces"];
|
|
694
|
-
edges?: AnySquareBoardInput["edges"];
|
|
695
|
-
vertices?: AnySquareBoardInput["vertices"];
|
|
696
|
-
}
|
|
697
|
-
interface SquareAuthoredGridInputProps {
|
|
698
|
-
id?: string;
|
|
699
|
-
layout?: "square";
|
|
700
|
-
rows?: number;
|
|
701
|
-
cols?: number;
|
|
702
|
-
cells: Extract<AnySquareBoardInput, {
|
|
703
|
-
cells: unknown;
|
|
704
|
-
}>["cells"];
|
|
705
|
-
pieces?: readonly SquarePieceState[];
|
|
706
|
-
edges?: AnySquareBoardInput["edges"];
|
|
707
|
-
vertices?: AnySquareBoardInput["vertices"];
|
|
708
|
-
}
|
|
709
|
-
type SquareGridInputProps = SquareGeneratedGridInputProps | SquareAuthoredGridInputProps;
|
|
710
|
-
type ResolvedSquareArrayProp<Value> = Exclude<Value, undefined> extends readonly unknown[] ? Exclude<Value, undefined> : readonly [];
|
|
711
|
-
type SquareBoardLikeOfProps<TProps extends SquareGridInputProps> = TProps extends {
|
|
712
|
-
id?: infer Id;
|
|
713
|
-
layout?: infer Layout;
|
|
714
|
-
spaces: infer Spaces;
|
|
715
|
-
pieces?: infer Pieces;
|
|
716
|
-
edges?: infer Edges;
|
|
717
|
-
vertices?: infer Vertices;
|
|
718
|
-
} ? {
|
|
719
|
-
id: Extract<Id, string> extends never ? string : Extract<Id, string>;
|
|
720
|
-
layout?: Extract<Layout, "square">;
|
|
721
|
-
spaces: Spaces;
|
|
722
|
-
pieces: ResolvedSquareArrayProp<Pieces>;
|
|
723
|
-
edges: ResolvedSquareArrayProp<Edges>;
|
|
724
|
-
vertices: ResolvedSquareArrayProp<Vertices>;
|
|
725
|
-
} & GeneratedSquareBoardInput : TProps extends {
|
|
726
|
-
id?: infer Id;
|
|
727
|
-
layout?: infer Layout;
|
|
728
|
-
rows?: infer Rows;
|
|
729
|
-
cols?: infer Cols;
|
|
730
|
-
cells: infer Cells;
|
|
731
|
-
pieces?: infer Pieces;
|
|
732
|
-
edges?: infer Edges;
|
|
733
|
-
vertices?: infer Vertices;
|
|
734
|
-
} ? {
|
|
735
|
-
id: Extract<Id, string> extends never ? string : Extract<Id, string>;
|
|
736
|
-
layout?: Extract<Layout, "square">;
|
|
737
|
-
rows: Extract<Rows, number> extends never ? number : Extract<Rows, number>;
|
|
738
|
-
cols: Extract<Cols, number> extends never ? number : Extract<Cols, number>;
|
|
739
|
-
cells: Cells;
|
|
740
|
-
pieces: ResolvedSquareArrayProp<Pieces>;
|
|
741
|
-
edges: ResolvedSquareArrayProp<Edges>;
|
|
742
|
-
vertices: ResolvedSquareArrayProp<Vertices>;
|
|
743
|
-
} & AuthoredSquareBoardInput : never;
|
|
744
|
-
type SquareGridProps<TProps extends SquareGridInputProps = SquareGridInputProps> = TProps & {
|
|
745
|
-
cellSize?: number;
|
|
746
|
-
/** Receives row/col with transform centered at cell position */
|
|
747
|
-
renderCell: (row: number, col: number) => ReactNode;
|
|
748
|
-
/** Receives piece with transform centered at cell center */
|
|
749
|
-
renderPiece: (piece: NormalizedSquarePieceOf<NoInfer<SquareBoardLikeOfProps<TProps>>>) => ReactNode;
|
|
750
|
-
renderEdge?: (edge: NormalizedSquareEdgeOf<NoInfer<SquareBoardLikeOfProps<TProps>>>, position: SquareEdgePosition) => ReactNode;
|
|
751
|
-
renderVertex?: (vertex: NormalizedSquareVertexOf<NoInfer<SquareBoardLikeOfProps<TProps>>>, position: SquareVertexPosition) => ReactNode;
|
|
752
|
-
showCoordinates?: boolean;
|
|
753
|
-
coordinateStyle?: "algebraic" | "numeric" | "none";
|
|
754
|
-
width?: number | string;
|
|
755
|
-
height?: number | string;
|
|
756
|
-
enablePanZoom?: boolean;
|
|
757
|
-
initialZoom?: number;
|
|
758
|
-
minZoom?: number;
|
|
759
|
-
maxZoom?: number;
|
|
760
|
-
className?: string;
|
|
761
|
-
interactiveSpaces?: InteractiveTargetLayer;
|
|
762
|
-
interactiveEdges?: InteractiveTargetLayer;
|
|
763
|
-
interactiveVertices?: InteractiveTargetLayer;
|
|
764
|
-
renderInteractiveSpace?: (space: InteractiveSquareSpace<NoInfer<SquareBoardLikeOfProps<TProps>>>, state: InteractiveTargetRenderState) => ReactNode;
|
|
765
|
-
renderInteractiveEdge?: (edge: InteractiveSquareEdge<NoInfer<SquareBoardLikeOfProps<TProps>>>, position: SquareEdgePosition, state: InteractiveTargetRenderState) => ReactNode;
|
|
766
|
-
renderInteractiveVertex?: (vertex: InteractiveSquareVertex<NoInfer<SquareBoardLikeOfProps<TProps>>>, position: SquareVertexPosition, state: InteractiveTargetRenderState) => ReactNode;
|
|
767
|
-
};
|
|
768
|
-
interface SquareGridBoardProps<TBoard extends AnySquareBoardInput = AnySquareBoardInput> {
|
|
769
|
-
board: TBoard;
|
|
770
|
-
cellSize?: number;
|
|
771
|
-
renderCell: (row: number, col: number) => ReactNode;
|
|
772
|
-
renderPiece: (piece: NormalizedSquarePieceOf<NoInfer<TBoard>>) => ReactNode;
|
|
773
|
-
renderEdge?: (edge: NormalizedSquareEdgeOf<NoInfer<TBoard>>, position: SquareEdgePosition) => ReactNode;
|
|
774
|
-
renderVertex?: (vertex: NormalizedSquareVertexOf<NoInfer<TBoard>>, position: SquareVertexPosition) => ReactNode;
|
|
775
|
-
showCoordinates?: boolean;
|
|
776
|
-
coordinateStyle?: "algebraic" | "numeric" | "none";
|
|
777
|
-
width?: number | string;
|
|
778
|
-
height?: number | string;
|
|
779
|
-
enablePanZoom?: boolean;
|
|
780
|
-
initialZoom?: number;
|
|
781
|
-
minZoom?: number;
|
|
782
|
-
maxZoom?: number;
|
|
783
|
-
className?: string;
|
|
784
|
-
interactiveSpaces?: InteractiveTargetLayer;
|
|
785
|
-
interactiveEdges?: InteractiveTargetLayer;
|
|
786
|
-
interactiveVertices?: InteractiveTargetLayer;
|
|
787
|
-
renderInteractiveSpace?: (space: InteractiveSquareSpace<NoInfer<TBoard>>, state: InteractiveTargetRenderState) => ReactNode;
|
|
788
|
-
renderInteractiveEdge?: (edge: InteractiveSquareEdge<NoInfer<TBoard>>, position: SquareEdgePosition, state: InteractiveTargetRenderState) => ReactNode;
|
|
789
|
-
renderInteractiveVertex?: (vertex: InteractiveSquareVertex<NoInfer<TBoard>>, position: SquareVertexPosition, state: InteractiveTargetRenderState) => ReactNode;
|
|
790
|
-
}
|
|
791
|
-
interface DefaultGridCellProps {
|
|
792
|
-
size: number;
|
|
793
|
-
isLight?: boolean;
|
|
794
|
-
lightColor?: string;
|
|
795
|
-
darkColor?: string;
|
|
796
|
-
isHighlighted?: boolean;
|
|
797
|
-
highlightColor?: string;
|
|
798
|
-
isSelected?: boolean;
|
|
799
|
-
selectedColor?: string;
|
|
800
|
-
isValidMove?: boolean;
|
|
801
|
-
isCapture?: boolean;
|
|
802
|
-
onClick?: () => void;
|
|
803
|
-
onPointerEnter?: () => void;
|
|
804
|
-
onPointerLeave?: () => void;
|
|
805
|
-
className?: string;
|
|
806
|
-
}
|
|
807
|
-
/** Pre-built grid cell component for use in `renderCell`. */
|
|
808
|
-
declare function DefaultGridCell({ size, isLight, lightColor, darkColor, isHighlighted, highlightColor, isSelected, selectedColor, isValidMove, isCapture, onClick, onPointerEnter, onPointerLeave, className, }: DefaultGridCellProps): react_jsx_runtime.JSX.Element;
|
|
809
|
-
interface DefaultGridPieceProps {
|
|
810
|
-
size: number;
|
|
811
|
-
color?: string;
|
|
812
|
-
strokeColor?: string;
|
|
813
|
-
label?: string;
|
|
814
|
-
isDragging?: boolean;
|
|
815
|
-
onClick?: () => void;
|
|
816
|
-
onPointerDown?: (e: React.PointerEvent) => void;
|
|
817
|
-
className?: string;
|
|
818
|
-
}
|
|
819
|
-
/** Pre-built grid piece component for use in `renderPiece`. */
|
|
820
|
-
declare function DefaultGridPiece({ size, color, strokeColor, label, isDragging, onClick, onPointerDown, className, }: DefaultGridPieceProps): react_jsx_runtime.JSX.Element;
|
|
821
|
-
interface DefaultChessPieceProps {
|
|
822
|
-
size: number;
|
|
823
|
-
type: string;
|
|
824
|
-
owner: "white" | "black";
|
|
825
|
-
onClick?: () => void;
|
|
826
|
-
onPointerDown?: (e: React.PointerEvent) => void;
|
|
827
|
-
className?: string;
|
|
828
|
-
}
|
|
829
|
-
/** Pre-built chess piece component using Unicode symbols. */
|
|
830
|
-
declare function DefaultChessPiece({ size, type, owner, onClick, onPointerDown, className, }: DefaultChessPieceProps): react_jsx_runtime.JSX.Element;
|
|
831
|
-
/**
|
|
832
|
-
* Convert row/col to algebraic notation (a1, b2, etc.)
|
|
833
|
-
*/
|
|
834
|
-
declare function toAlgebraic(row: number, col: number, totalRows: number): string;
|
|
835
|
-
/**
|
|
836
|
-
* Convert row/col to numeric notation (1,1, 2,3, etc.)
|
|
837
|
-
*/
|
|
838
|
-
declare function toNumeric(row: number, col: number): string;
|
|
839
|
-
interface SquareGridComponent {
|
|
840
|
-
<const TBoard extends AnySquareBoardInput>(props: SquareGridBoardProps<TBoard>): ReactNode;
|
|
841
|
-
<const TProps extends SquareGeneratedGridInputProps>(props: SquareGridProps<TProps>): ReactNode;
|
|
842
|
-
<const TProps extends SquareAuthoredGridInputProps>(props: SquareGridProps<TProps>): ReactNode;
|
|
843
|
-
}
|
|
844
|
-
declare const SquareGrid: SquareGridComponent;
|
|
845
|
-
|
|
846
|
-
type HexOrientation = "pointy-top" | "flat-top";
|
|
847
|
-
/**
|
|
848
|
-
* Geometry context passed to `renderTile`.
|
|
849
|
-
*
|
|
850
|
-
* `corners`, `points`, and `bounds` are expressed in tile-local
|
|
851
|
-
* coordinates because each tile is rendered inside a `<g>` translated
|
|
852
|
-
* to its center. Use `position` if you need the resolved center in the
|
|
853
|
-
* board's absolute SVG coordinates.
|
|
854
|
-
*
|
|
855
|
-
* The `inset` option shrinks the polygon toward the center by that many
|
|
856
|
-
* pixels, which is useful for layered effects such as borders, frames,
|
|
857
|
-
* or inner highlights without re-deriving the hex math yourself.
|
|
858
|
-
*/
|
|
859
|
-
interface HexTileGeometry {
|
|
860
|
-
size: number;
|
|
861
|
-
orientation: HexOrientation;
|
|
862
|
-
center: {
|
|
863
|
-
x: 0;
|
|
864
|
-
y: 0;
|
|
865
|
-
};
|
|
866
|
-
position: {
|
|
867
|
-
x: number;
|
|
868
|
-
y: number;
|
|
869
|
-
};
|
|
870
|
-
corners: (options?: {
|
|
871
|
-
inset?: number;
|
|
872
|
-
}) => Array<{
|
|
873
|
-
x: number;
|
|
874
|
-
y: number;
|
|
875
|
-
}>;
|
|
876
|
-
points: (options?: {
|
|
877
|
-
inset?: number;
|
|
878
|
-
}) => string;
|
|
879
|
-
bounds: {
|
|
880
|
-
minX: number;
|
|
881
|
-
minY: number;
|
|
882
|
-
maxX: number;
|
|
883
|
-
maxY: number;
|
|
884
|
-
width: number;
|
|
885
|
-
height: number;
|
|
886
|
-
};
|
|
887
|
-
}
|
|
888
|
-
interface EdgePosition {
|
|
889
|
-
/** Absolute SVG start point of the visible edge line. */
|
|
890
|
-
x1: number;
|
|
891
|
-
y1: number;
|
|
892
|
-
/** Absolute SVG end point of the visible edge line. */
|
|
893
|
-
x2: number;
|
|
894
|
-
y2: number;
|
|
895
|
-
/** Absolute SVG midpoint of the edge. */
|
|
896
|
-
midX: number;
|
|
897
|
-
midY: number;
|
|
898
|
-
/**
|
|
899
|
-
* Angle in degrees from hex1 center to hex2 center.
|
|
900
|
-
* This is perpendicular to the visible edge line.
|
|
901
|
-
*/
|
|
902
|
-
centerAngle: number;
|
|
903
|
-
/** Angle in degrees of the visible edge line itself. */
|
|
904
|
-
edgeAngle: number;
|
|
905
|
-
}
|
|
906
|
-
interface InteractiveHexVertex<TBoard extends AnyHexBoardInput = AnyHexBoardInput> extends NormalizedHexVertexOf<TBoard> {
|
|
907
|
-
position: {
|
|
908
|
-
x: number;
|
|
909
|
-
y: number;
|
|
910
|
-
};
|
|
911
|
-
spaceIds: ReadonlyArray<BoardSpaceIdOf<TBoard>>;
|
|
912
|
-
}
|
|
913
|
-
interface InteractiveHexEdge<TBoard extends AnyHexBoardInput = AnyHexBoardInput> extends NormalizedHexEdgeOf<TBoard> {
|
|
914
|
-
position: EdgePosition;
|
|
915
|
-
spaceIds: ReadonlyArray<BoardSpaceIdOf<TBoard>>;
|
|
916
|
-
}
|
|
917
|
-
type InteractiveHexSpace<TBoard extends AnyHexBoardInput = AnyHexBoardInput> = NormalizedHexTileOf<TBoard>;
|
|
918
|
-
interface HexGeneratedGridInputProps {
|
|
919
|
-
id?: string;
|
|
920
|
-
layout?: "hex";
|
|
921
|
-
orientation?: HexOrientation;
|
|
922
|
-
spaces: Extract<AnyHexBoardInput, {
|
|
923
|
-
spaces: unknown;
|
|
924
|
-
}>["spaces"];
|
|
925
|
-
edges?: AnyHexBoardInput["edges"];
|
|
926
|
-
vertices?: AnyHexBoardInput["vertices"];
|
|
927
|
-
}
|
|
928
|
-
interface HexAuthoredGridInputProps {
|
|
929
|
-
id?: string;
|
|
930
|
-
layout?: "hex";
|
|
931
|
-
orientation?: HexOrientation;
|
|
932
|
-
tiles: Extract<AnyHexBoardInput, {
|
|
933
|
-
tiles: unknown;
|
|
934
|
-
}>["tiles"];
|
|
935
|
-
edges?: AnyHexBoardInput["edges"];
|
|
936
|
-
vertices?: AnyHexBoardInput["vertices"];
|
|
937
|
-
}
|
|
938
|
-
type HexGridInputProps = HexGeneratedGridInputProps | HexAuthoredGridInputProps;
|
|
939
|
-
type ResolvedArrayProp<Value> = Exclude<Value, undefined> extends readonly unknown[] ? Exclude<Value, undefined> : readonly [];
|
|
940
|
-
type HexBoardLikeOfProps<TProps extends HexGridInputProps> = TProps extends {
|
|
941
|
-
id?: infer Id;
|
|
942
|
-
layout?: infer Layout;
|
|
943
|
-
orientation?: infer Orientation;
|
|
944
|
-
spaces: infer Spaces;
|
|
945
|
-
edges?: infer Edges;
|
|
946
|
-
vertices?: infer Vertices;
|
|
947
|
-
} ? {
|
|
948
|
-
id: Extract<Id, string> extends never ? string : Extract<Id, string>;
|
|
949
|
-
layout?: Extract<Layout, "hex">;
|
|
950
|
-
orientation?: Extract<Orientation, HexOrientation>;
|
|
951
|
-
spaces: Spaces;
|
|
952
|
-
edges: ResolvedArrayProp<Edges>;
|
|
953
|
-
vertices: ResolvedArrayProp<Vertices>;
|
|
954
|
-
} & GeneratedHexBoardInput : TProps extends {
|
|
955
|
-
id?: infer Id;
|
|
956
|
-
layout?: infer Layout;
|
|
957
|
-
orientation?: infer Orientation;
|
|
958
|
-
tiles: infer Tiles;
|
|
959
|
-
edges?: infer Edges;
|
|
960
|
-
vertices?: infer Vertices;
|
|
961
|
-
} ? {
|
|
962
|
-
id: Extract<Id, string> extends never ? string : Extract<Id, string>;
|
|
963
|
-
layout?: Extract<Layout, "hex">;
|
|
964
|
-
orientation?: Extract<Orientation, HexOrientation>;
|
|
965
|
-
tiles: Tiles;
|
|
966
|
-
edges: ResolvedArrayProp<Edges>;
|
|
967
|
-
vertices: ResolvedArrayProp<Vertices>;
|
|
968
|
-
} & AuthoredHexBoardInput : never;
|
|
969
|
-
type HexGridProps<TProps extends HexGridInputProps = HexGridInputProps> = TProps & {
|
|
970
|
-
orientation?: HexOrientation;
|
|
971
|
-
/** Hex radius in pixels */
|
|
972
|
-
hexSize?: number;
|
|
973
|
-
/**
|
|
974
|
-
* Receives tile data centered at (0,0) plus a `HexTileGeometry`
|
|
975
|
-
* helper. Use `geometry.points({ inset })` to draw custom polygons
|
|
976
|
-
* without duplicating `hexSize` / orientation in the consumer.
|
|
977
|
-
*/
|
|
978
|
-
renderTile: (tile: NormalizedHexTileOf<NoInfer<HexBoardLikeOfProps<TProps>>>, geometry: HexTileGeometry) => ReactNode;
|
|
979
|
-
/**
|
|
980
|
-
* Receives edge geometry in absolute SVG coordinates.
|
|
981
|
-
* Use `position.edgeAngle` to align artwork with the visible edge.
|
|
982
|
-
*/
|
|
983
|
-
renderEdge: (edge: NormalizedHexEdgeOf<NoInfer<HexBoardLikeOfProps<TProps>>>, position: EdgePosition) => ReactNode;
|
|
984
|
-
renderVertex: (vertex: NormalizedHexVertexOf<NoInfer<HexBoardLikeOfProps<TProps>>>, position: {
|
|
985
|
-
x: number;
|
|
986
|
-
y: number;
|
|
987
|
-
}) => ReactNode;
|
|
988
|
-
width?: number | string;
|
|
989
|
-
height?: number | string;
|
|
990
|
-
enablePanZoom?: boolean;
|
|
991
|
-
initialZoom?: number;
|
|
992
|
-
minZoom?: number;
|
|
993
|
-
maxZoom?: number;
|
|
994
|
-
className?: string;
|
|
995
|
-
/** Reducer-aware space target layer from `board.targetLayers.space(...)`. */
|
|
996
|
-
interactiveSpaces?: InteractiveTargetLayer;
|
|
997
|
-
/** Reducer-aware vertex target layer from `board.targetLayers.vertex(...)`. */
|
|
998
|
-
interactiveVertices?: InteractiveTargetLayer;
|
|
999
|
-
/** Reducer-aware edge target layer from `board.targetLayers.edge(...)`. */
|
|
1000
|
-
interactiveEdges?: InteractiveTargetLayer;
|
|
1001
|
-
/** Receives space geometry centered at (0,0). */
|
|
1002
|
-
renderInteractiveSpace?: (space: InteractiveHexSpace<NoInfer<HexBoardLikeOfProps<TProps>>>, state: InteractiveTargetRenderState) => ReactNode;
|
|
1003
|
-
/**
|
|
1004
|
-
* Receives vertex geometry in absolute SVG coordinates.
|
|
1005
|
-
*/
|
|
1006
|
-
renderInteractiveVertex?: (vertex: InteractiveHexVertex<NoInfer<HexBoardLikeOfProps<TProps>>>, position: {
|
|
1007
|
-
x: number;
|
|
1008
|
-
y: number;
|
|
1009
|
-
}, state: InteractiveTargetRenderState) => ReactNode;
|
|
1010
|
-
/**
|
|
1011
|
-
* Receives edge geometry in the same absolute SVG coordinates as `renderEdge`.
|
|
1012
|
-
*/
|
|
1013
|
-
renderInteractiveEdge?: (edge: InteractiveHexEdge<NoInfer<HexBoardLikeOfProps<TProps>>>, position: EdgePosition, state: InteractiveTargetRenderState) => ReactNode;
|
|
1014
|
-
interactiveVertexSize?: number;
|
|
1015
|
-
interactiveEdgeSize?: number;
|
|
1016
|
-
};
|
|
1017
|
-
interface HexGridBoardProps<TBoard extends AnyHexBoardInput = AnyHexBoardInput> {
|
|
1018
|
-
board: TBoard;
|
|
1019
|
-
orientation?: HexOrientation;
|
|
1020
|
-
hexSize?: number;
|
|
1021
|
-
/**
|
|
1022
|
-
* Receives tile data centered at (0,0) plus a `HexTileGeometry`
|
|
1023
|
-
* helper. Use `geometry.points({ inset })` to draw custom polygons
|
|
1024
|
-
* without duplicating `hexSize` / orientation in the consumer.
|
|
1025
|
-
*/
|
|
1026
|
-
renderTile: (tile: NormalizedHexTileOf<NoInfer<TBoard>>, geometry: HexTileGeometry) => ReactNode;
|
|
1027
|
-
/**
|
|
1028
|
-
* Receives edge geometry in absolute SVG coordinates.
|
|
1029
|
-
* Use `position.edgeAngle` to align artwork with the visible edge.
|
|
1030
|
-
*/
|
|
1031
|
-
renderEdge: (edge: NormalizedHexEdgeOf<NoInfer<TBoard>>, position: EdgePosition) => ReactNode;
|
|
1032
|
-
renderVertex: (vertex: NormalizedHexVertexOf<NoInfer<TBoard>>, position: {
|
|
1033
|
-
x: number;
|
|
1034
|
-
y: number;
|
|
1035
|
-
}) => ReactNode;
|
|
1036
|
-
width?: number | string;
|
|
1037
|
-
height?: number | string;
|
|
1038
|
-
enablePanZoom?: boolean;
|
|
1039
|
-
initialZoom?: number;
|
|
1040
|
-
minZoom?: number;
|
|
1041
|
-
maxZoom?: number;
|
|
1042
|
-
className?: string;
|
|
1043
|
-
interactiveSpaces?: InteractiveTargetLayer;
|
|
1044
|
-
interactiveVertices?: InteractiveTargetLayer;
|
|
1045
|
-
interactiveEdges?: InteractiveTargetLayer;
|
|
1046
|
-
/** Receives space geometry centered at (0,0). */
|
|
1047
|
-
renderInteractiveSpace?: (space: InteractiveHexSpace<NoInfer<TBoard>>, state: InteractiveTargetRenderState) => ReactNode;
|
|
1048
|
-
/**
|
|
1049
|
-
* Receives vertex geometry in absolute SVG coordinates.
|
|
1050
|
-
*/
|
|
1051
|
-
renderInteractiveVertex?: (vertex: InteractiveHexVertex<NoInfer<TBoard>>, position: {
|
|
1052
|
-
x: number;
|
|
1053
|
-
y: number;
|
|
1054
|
-
}, state: InteractiveTargetRenderState) => ReactNode;
|
|
1055
|
-
/**
|
|
1056
|
-
* Receives edge geometry in the same absolute SVG coordinates as `renderEdge`.
|
|
1057
|
-
*/
|
|
1058
|
-
renderInteractiveEdge?: (edge: InteractiveHexEdge<NoInfer<TBoard>>, position: EdgePosition, state: InteractiveTargetRenderState) => ReactNode;
|
|
1059
|
-
interactiveVertexSize?: number;
|
|
1060
|
-
interactiveEdgeSize?: number;
|
|
1061
|
-
}
|
|
1062
|
-
interface DefaultHexTileProps {
|
|
1063
|
-
/** Should match hexSize from HexGrid */
|
|
1064
|
-
size: number;
|
|
1065
|
-
fill: string;
|
|
1066
|
-
stroke?: string;
|
|
1067
|
-
strokeWidth?: number;
|
|
1068
|
-
isSelected?: boolean;
|
|
1069
|
-
isHighlighted?: boolean;
|
|
1070
|
-
label?: string;
|
|
1071
|
-
showCoordinates?: boolean;
|
|
1072
|
-
coordinates?: {
|
|
1073
|
-
q: number;
|
|
1074
|
-
r: number;
|
|
1075
|
-
};
|
|
1076
|
-
orientation?: HexOrientation;
|
|
1077
|
-
onClick?: () => void;
|
|
1078
|
-
onPointerEnter?: () => void;
|
|
1079
|
-
onPointerLeave?: () => void;
|
|
1080
|
-
className?: string;
|
|
1081
|
-
}
|
|
1082
|
-
/** Pre-built hexagon tile for use in `renderTile`. */
|
|
1083
|
-
declare function DefaultHexTile({ size, fill, stroke, strokeWidth, isSelected, isHighlighted, label, showCoordinates, coordinates, orientation, onClick, onPointerEnter, onPointerLeave, className, }: DefaultHexTileProps): react_jsx_runtime.JSX.Element;
|
|
1084
|
-
interface DefaultHexEdgeProps {
|
|
1085
|
-
position: EdgePosition;
|
|
1086
|
-
color: string;
|
|
1087
|
-
hasOwner?: boolean;
|
|
1088
|
-
strokeWidth?: number;
|
|
1089
|
-
touchTargetSize?: number;
|
|
1090
|
-
onClick?: () => void;
|
|
1091
|
-
className?: string;
|
|
1092
|
-
}
|
|
1093
|
-
/** Pre-built edge/road component for use in `renderEdge`. */
|
|
1094
|
-
declare function DefaultHexEdge({ position, color, hasOwner, strokeWidth, touchTargetSize, onClick, className, }: DefaultHexEdgeProps): react_jsx_runtime.JSX.Element;
|
|
1095
|
-
interface DefaultHexVertexProps {
|
|
1096
|
-
position: {
|
|
1097
|
-
x: number;
|
|
1098
|
-
y: number;
|
|
1099
|
-
};
|
|
1100
|
-
color: string;
|
|
1101
|
-
stroke?: string;
|
|
1102
|
-
strokeWidth?: number;
|
|
1103
|
-
hasOwner?: boolean;
|
|
1104
|
-
isSelected?: boolean;
|
|
1105
|
-
isHighlighted?: boolean;
|
|
1106
|
-
size?: number;
|
|
1107
|
-
touchTargetSize?: number;
|
|
1108
|
-
shape?: "circle" | "square";
|
|
1109
|
-
onClick?: () => void;
|
|
1110
|
-
onPointerEnter?: () => void;
|
|
1111
|
-
onPointerLeave?: () => void;
|
|
1112
|
-
className?: string;
|
|
1113
|
-
}
|
|
1114
|
-
/** Pre-built vertex/settlement component for use in `renderVertex`. */
|
|
1115
|
-
declare function DefaultHexVertex({ position, color, stroke, strokeWidth, hasOwner, isSelected, isHighlighted, size, touchTargetSize, shape, onClick, onPointerEnter, onPointerLeave, className, }: DefaultHexVertexProps): react_jsx_runtime.JSX.Element;
|
|
1116
|
-
declare const hexUtils: {
|
|
1117
|
-
/** Convert axial coordinates to pixel position. */
|
|
1118
|
-
axialToPixel(q: number, r: number, size: number, orientation: HexOrientation): {
|
|
1119
|
-
x: number;
|
|
1120
|
-
y: number;
|
|
1121
|
-
};
|
|
1122
|
-
getNeighbors(q: number, r: number): Array<{
|
|
1123
|
-
q: number;
|
|
1124
|
-
r: number;
|
|
1125
|
-
}>;
|
|
1126
|
-
getDistance(q1: number, r1: number, q2: number, r2: number): number;
|
|
1127
|
-
getHexCorners(centerX: number, centerY: number, size: number, orientation: HexOrientation): Array<{
|
|
1128
|
-
x: number;
|
|
1129
|
-
y: number;
|
|
1130
|
-
}>;
|
|
1131
|
-
getHexPoints(centerX: number, centerY: number, size: number, orientation: HexOrientation): string;
|
|
1132
|
-
getEdgePosition(hex1Pos: {
|
|
1133
|
-
x: number;
|
|
1134
|
-
y: number;
|
|
1135
|
-
}, hex2Pos: {
|
|
1136
|
-
x: number;
|
|
1137
|
-
y: number;
|
|
1138
|
-
}, size: number): EdgePosition;
|
|
1139
|
-
getVertexPosition(hex1Pos: {
|
|
1140
|
-
x: number;
|
|
1141
|
-
y: number;
|
|
1142
|
-
}, hex2Pos: {
|
|
1143
|
-
x: number;
|
|
1144
|
-
y: number;
|
|
1145
|
-
}, hex3Pos: {
|
|
1146
|
-
x: number;
|
|
1147
|
-
y: number;
|
|
1148
|
-
}): {
|
|
1149
|
-
x: number;
|
|
1150
|
-
y: number;
|
|
1151
|
-
};
|
|
1152
|
-
};
|
|
1153
|
-
interface HexGridComponent {
|
|
1154
|
-
<const TBoard extends AnyHexBoardInput>(props: HexGridBoardProps<TBoard>): ReactNode;
|
|
1155
|
-
<const TProps extends HexGeneratedGridInputProps>(props: HexGridProps<TProps>): ReactNode;
|
|
1156
|
-
<const TProps extends HexAuthoredGridInputProps>(props: HexGridProps<TProps>): ReactNode;
|
|
1157
|
-
}
|
|
1158
|
-
declare const HexGrid: HexGridComponent;
|
|
1159
|
-
|
|
1160
|
-
/**
|
|
1161
|
-
* Typed adapter for joining static hex-board topology with a dynamic
|
|
1162
|
-
* per-space view overlay. Use this to feed `HexGrid` a single board
|
|
1163
|
-
* value whose tiles carry both static geometry (`q`, `r`, `id`) and
|
|
1164
|
-
* the projected view fields the UI cares about (e.g. `terrain`,
|
|
1165
|
-
* `numberToken`).
|
|
1166
|
-
*
|
|
1167
|
-
* The runtime is intentionally strict: every static space must have
|
|
1168
|
-
* exactly one overlay, duplicates throw, and overlays for ids that
|
|
1169
|
-
* are not on the board throw. There is no relaxed fallback in v1 —
|
|
1170
|
-
* silent merge bugs are far more expensive than a loud throw at
|
|
1171
|
-
* dev/CI time.
|
|
1172
|
-
*/
|
|
1173
|
-
|
|
1174
|
-
/**
|
|
1175
|
-
* Per-tile result produced by {@link createHexBoardView}. Each tile
|
|
1176
|
-
* carries the static topology (`id`, `q`, `r`) plus the matched
|
|
1177
|
-
* overlay row in `view`.
|
|
1178
|
-
*
|
|
1179
|
-
* Static board fields/properties are preserved from `TBoard`.
|
|
1180
|
-
* Consumers should use `tile.properties` for authored static space
|
|
1181
|
-
* fields and `tile.view` for dynamic per-space projection data.
|
|
1182
|
-
*/
|
|
1183
|
-
type HexBoardViewTile<TBoard extends AnyHexBoardInput, TSpaceView extends {
|
|
1184
|
-
id: BoardSpaceIdOf<TBoard>;
|
|
1185
|
-
}> = Omit<NormalizedHexTileOf<TBoard>, "view"> & {
|
|
1186
|
-
view: TSpaceView;
|
|
1187
|
-
};
|
|
1188
|
-
/**
|
|
1189
|
-
* Result of {@link createHexBoardView}. Shaped like an authored hex
|
|
1190
|
-
* board so it can be passed straight to `<HexGrid board={...} />`
|
|
1191
|
-
* without any further adapter work.
|
|
1192
|
-
*
|
|
1193
|
-
* The type-level board id and space id are preserved from `TBoard`,
|
|
1194
|
-
* so `tile.id` stays narrow inside `renderTile`. `tile.view` is the
|
|
1195
|
-
* authored overlay row, fully typed.
|
|
1196
|
-
*/
|
|
1197
|
-
interface HexBoardView<TBoard extends AnyHexBoardInput, TSpaceView extends {
|
|
1198
|
-
id: BoardSpaceIdOf<TBoard>;
|
|
1199
|
-
}> {
|
|
1200
|
-
id: BoardIdOf<TBoard>;
|
|
1201
|
-
layout?: "hex";
|
|
1202
|
-
orientation?: "pointy-top" | "flat-top";
|
|
1203
|
-
tiles: ReadonlyArray<HexBoardViewTile<TBoard, TSpaceView>>;
|
|
1204
|
-
edges: TBoard["edges"];
|
|
1205
|
-
vertices: TBoard["vertices"];
|
|
1206
|
-
}
|
|
1207
|
-
interface CreateHexBoardViewOptions<TSpaceView> {
|
|
1208
|
-
spaces: readonly TSpaceView[];
|
|
1209
|
-
}
|
|
1210
|
-
/**
|
|
1211
|
-
* Join a static hex board topology with a dynamic per-space overlay.
|
|
1212
|
-
*
|
|
1213
|
-
* The result is suitable for direct use as the `board` prop on
|
|
1214
|
-
* `<HexGrid>`. Every overlay is enforced 1-to-1 against the board's
|
|
1215
|
-
* spaces:
|
|
1216
|
-
*
|
|
1217
|
-
* - missing overlay for a board space → throws
|
|
1218
|
-
* - duplicate overlay (same `id` twice) → throws
|
|
1219
|
-
* - overlay `id` not present on the board → throws
|
|
1220
|
-
*
|
|
1221
|
-
* Each tile in the result carries a `view` field with the matched
|
|
1222
|
-
* overlay row.
|
|
1223
|
-
*/
|
|
1224
|
-
declare function createHexBoardView<const TBoard extends AnyHexBoardInput, const TSpaceView extends {
|
|
1225
|
-
id: BoardSpaceIdOf<TBoard>;
|
|
1226
|
-
}>(board: TBoard, options: CreateHexBoardViewOptions<TSpaceView>): HexBoardView<TBoard, TSpaceView>;
|
|
1227
|
-
|
|
1228
|
-
export { type NormalizedHexVertexOf as $, type AnyHexBoardInput as A, type BoardEdgeIdOf as B, type CardDropTargetVisualState as C, DefaultChessPiece as D, type EdgePosition as E, type FoundationColor as F, type GeneratedHexBoardInput as G, type HexBoardInput as H, type HexBoardViewTile as I, HexGrid as J, type HexGridBoardProps as K, type HexGridProps as L, type HexOrientation as M, type HexTileGeometry as N, type IntentColor as O, type InteractionVisualState as P, type InteractiveHexEdge as Q, type InteractiveHexVertex as R, type InteractiveSquareEdge as S, type InteractiveSquareVertex as T, type InteractiveTargetLayer as U, type InteractiveTargetRenderState as V, type InteractiveTargetState as W, type Motion as X, type NormalizedHexBoard as Y, type NormalizedHexEdgeOf as Z, type NormalizedHexTileOf as _, type AnySquareBoardInput as a, type NormalizedSquareBoard as a0, type NormalizedSquareCellOf as a1, type NormalizedSquareEdgeOf as a2, type NormalizedSquarePieceOf as a3, type NormalizedSquareVertexOf as a4, type PlayerColor as a5, type Radius as a6, type SemanticColor as a7, type Space as a8, type SquareBoardInput as a9, type SquareEdgePosition as aa, SquareGrid as ab, type SquareGridBoardProps as ac, type SquareGridProps as ad, type SquareVertexPosition as ae, type TargetIntent as af, type Theme as ag, type ThemeMeta as ah, type ThemeOverride as ai, type Typography as aj, createHexBoardView as ak, dropTargetVisualStateDataAttributes as al, hexUtils as am, mergeTheme as an, normalizeHexBoardInput as ao, normalizeSquareBoardInput as ap, toAlgebraic as aq, toNumeric as ar, visualStateDataAttributes as as, type AuthoredHexBoardInput as b, type AuthoredSquareBoardInput as c, type BoardSpaceIdOf as d, type BoardVertexIdOf as e, type CardIntent as f, type ColorRamp as g, type ComponentTokens as h, type DefaultChessPieceProps as i, DefaultGridCell as j, type DefaultGridCellProps as k, DefaultGridPiece as l, type DefaultGridPieceProps as m, DefaultHexEdge as n, type DefaultHexEdgeProps as o, DefaultHexTile as p, type DefaultHexTileProps as q, DefaultHexVertex as r, type DefaultHexVertexProps as s, type Elevation as t, type GeneratedHexSpaceStateLike as u, type GeneratedSquareBoardInput as v, type GeneratedSquareSpaceStateLike as w, type GeneratedTiledEdgeStateLike as x, type GeneratedTiledVertexStateLike as y, type HexBoardView as z };
|