@dreamboard-games/sdk 0.4.0-alpha.2 → 0.4.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/REFERENCE.md +33 -22
- package/dist/HandView-x8MhbhFl.d.ts +79 -0
- package/dist/{ResourceCounter-BuiNstXs.d.ts → ResourceCounter-BFxJknqp.d.ts} +1 -9
- package/dist/{ThemeProvider-B1sIoBlX.d.ts → ThemeProvider-DRalAWzY.d.ts} +1 -1
- package/dist/authoring/index.js +1 -1
- package/dist/{chunk-45FI6XII.js → chunk-E3X552YM.js} +3 -11
- package/dist/chunk-E3X552YM.js.map +1 -0
- package/dist/{chunk-HWJS3VOJ.js → chunk-LKJLAGND.js} +2 -2
- package/dist/{chunk-WOWFONLZ.js → chunk-QOFFRHZR.js} +6 -6
- package/dist/chunk-QOFFRHZR.js.map +1 -0
- package/dist/{chunk-ZAS2SENW.js → chunk-SUMZ5OEH.js} +2 -2
- package/dist/{chunk-ZAS2SENW.js.map → chunk-SUMZ5OEH.js.map} +1 -1
- package/dist/{chunk-6JQFGSLD.js → chunk-TTISZQNI.js} +13 -15
- package/dist/{chunk-6JQFGSLD.js.map → chunk-TTISZQNI.js.map} +1 -1
- package/dist/{chunk-FWVV2X74.js → chunk-XZ667T4K.js} +2 -2
- package/dist/{components-BbWPnZCF.d.ts → components-B7hFaEn_.d.ts} +3 -3
- package/dist/{hex-board-view-Kz9Q_zsv.d.ts → hex-board-view-BFlWDb9k.d.ts} +116 -1
- package/dist/index-gjxQichK.d.ts +192 -0
- package/dist/index.js +2 -2
- package/dist/package-set.d.ts +2 -2
- package/dist/package-set.js +2 -2
- package/dist/runtime/primitives.d.ts +20 -23
- package/dist/runtime/primitives.js +3 -3
- package/dist/runtime/workspace-contract.d.ts +16 -173
- package/dist/runtime/workspace-contract.js +4 -4
- package/dist/runtime.d.ts +6 -6
- package/dist/runtime.js +4 -4
- package/dist/ui/components.d.ts +4 -4
- package/dist/ui/components.js +1 -3
- package/dist/ui/plugin-styles.css +1 -1
- package/dist/{ui-contract-CY7cxsCC.d.ts → ui-contract-B4NjRlvC.d.ts} +2 -2
- package/dist/ui.d.ts +7 -7
- package/dist/ui.js +2 -4
- package/package.json +1 -1
- package/dist/HandView-PYDmehVD.d.ts +0 -193
- package/dist/chunk-45FI6XII.js.map +0 -1
- package/dist/chunk-WOWFONLZ.js.map +0 -1
- /package/dist/{chunk-HWJS3VOJ.js.map → chunk-LKJLAGND.js.map} +0 -0
- /package/dist/{chunk-FWVV2X74.js.map → chunk-XZ667T4K.js.map} +0 -0
|
@@ -524,6 +524,121 @@ type NormalizedSquareBoard<TBoard extends AnySquareBoardInput> = Pick<SquareBoar
|
|
|
524
524
|
declare function normalizeHexBoardInput<TBoard extends AnyHexBoardInput>(board: TBoard): NormalizedHexBoard<TBoard>;
|
|
525
525
|
declare function normalizeSquareBoardInput<TBoard extends AnySquareBoardInput>(board: TBoard): NormalizedSquareBoard<TBoard>;
|
|
526
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
|
+
|
|
527
642
|
type BoardTargetKind = "edge" | "vertex" | "space" | "tile";
|
|
528
643
|
interface InteractiveTargetState {
|
|
529
644
|
kind?: BoardTargetKind;
|
|
@@ -931,4 +1046,4 @@ declare function createHexBoardView<const TBoard extends AnyHexBoardInput, const
|
|
|
931
1046
|
id: BoardSpaceIdOf<TBoard>;
|
|
932
1047
|
}>(board: TBoard, options: CreateHexBoardViewOptions<TSpaceView>): HexBoardView<TBoard, TSpaceView>;
|
|
933
1048
|
|
|
934
|
-
export { type
|
|
1049
|
+
export { type SemanticColor as $, type AnyHexBoardInput as A, type BoardEdgeIdOf as B, type CardDropTargetVisualState as C, DefaultHexEdge as D, type EdgePosition as E, type FoundationColor as F, type GeneratedHexBoardInput as G, type HexBoardInput as H, type IntentColor as I, type InteractionVisualState as J, type InteractiveHexEdge as K, type InteractiveHexVertex as L, type InteractiveTargetLayer as M, type InteractiveTargetRenderState as N, type InteractiveTargetState as O, type Motion as P, type NormalizedHexBoard as Q, type NormalizedHexEdgeOf as R, type NormalizedHexTileOf as S, type NormalizedHexVertexOf as T, type NormalizedSquareBoard as U, type NormalizedSquareCellOf as V, type NormalizedSquareEdgeOf as W, type NormalizedSquarePieceOf as X, type NormalizedSquareVertexOf as Y, type PlayerColor as Z, type Radius as _, type AnySquareBoardInput as a, type Space as a0, type SquareBoardInput as a1, type TargetIntent as a2, type Theme as a3, type ThemeMeta as a4, type ThemeOverride as a5, type Typography as a6, createHexBoardView as a7, dropTargetVisualStateDataAttributes as a8, hexUtils as a9, mergeTheme as aa, normalizeHexBoardInput as ab, normalizeSquareBoardInput as ac, visualStateDataAttributes as ad, 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 DefaultHexEdgeProps as i, DefaultHexTile as j, type DefaultHexTileProps as k, DefaultHexVertex as l, type DefaultHexVertexProps as m, type Elevation as n, type GeneratedHexSpaceStateLike as o, type GeneratedSquareBoardInput as p, type GeneratedSquareSpaceStateLike as q, type GeneratedTiledEdgeStateLike as r, type GeneratedTiledVertexStateLike as s, type HexBoardView as t, type HexBoardViewTile as u, HexGrid as v, type HexGridBoardProps as w, type HexGridProps as x, type HexOrientation as y, type HexTileGeometry as z };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { ReactNode, ReactElement, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { l as BoardSpaceTargetProps, bh as ZoneListProps, b1 as UIContract } from './ui-contract-B4NjRlvC.js';
|
|
3
|
+
import { J as InteractionVisualState } from './hex-board-view-BFlWDb9k.js';
|
|
4
|
+
import { H as HandRole } from './ResourceCounter-BFxJknqp.js';
|
|
5
|
+
|
|
6
|
+
interface ClientParamSchema {
|
|
7
|
+
safeParse: (value: unknown) => {
|
|
8
|
+
success: true;
|
|
9
|
+
data: Record<string, unknown>;
|
|
10
|
+
} | {
|
|
11
|
+
success: false;
|
|
12
|
+
error: {
|
|
13
|
+
issues: ReadonlyArray<{
|
|
14
|
+
path: readonly PropertyKey[];
|
|
15
|
+
message: string;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
type ClientParamSchemaMap = Readonly<Record<string, Readonly<Record<string, ClientParamSchema>>>>;
|
|
21
|
+
|
|
22
|
+
type WorkspaceInteractionSlotComponent<Props = object> = (props: Props extends {
|
|
23
|
+
children: unknown;
|
|
24
|
+
} ? Props : Props & {
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
}) => ReactElement | null;
|
|
27
|
+
interface WorkspaceFormInputSlot<Input extends string = string> {
|
|
28
|
+
readonly Field: WorkspaceInteractionSlotComponent;
|
|
29
|
+
readonly Options: WorkspaceInteractionSlotComponent<{
|
|
30
|
+
children?: (option: {
|
|
31
|
+
value: unknown;
|
|
32
|
+
label: string;
|
|
33
|
+
}) => ReactNode;
|
|
34
|
+
}>;
|
|
35
|
+
readonly Value: WorkspaceInteractionSlotComponent<{
|
|
36
|
+
children: (value: unknown | undefined) => ReactNode;
|
|
37
|
+
}>;
|
|
38
|
+
readonly Default: WorkspaceInteractionSlotComponent;
|
|
39
|
+
readonly __input?: Input;
|
|
40
|
+
}
|
|
41
|
+
interface WorkspaceCardInputSlot<Card extends string = string> {
|
|
42
|
+
readonly Card: WorkspaceInteractionSlotComponent<{
|
|
43
|
+
value: Card;
|
|
44
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "disabled" | "aria-disabled" | "aria-pressed" | "onClick" | "type" | "value">>;
|
|
45
|
+
readonly Cards: WorkspaceInteractionSlotComponent<{
|
|
46
|
+
children: (card: {
|
|
47
|
+
id: Card;
|
|
48
|
+
}) => ReactNode;
|
|
49
|
+
}>;
|
|
50
|
+
readonly Value: WorkspaceInteractionSlotComponent<{
|
|
51
|
+
children: (value: unknown | undefined) => ReactNode;
|
|
52
|
+
}>;
|
|
53
|
+
readonly Default: WorkspaceInteractionSlotComponent;
|
|
54
|
+
}
|
|
55
|
+
interface WorkspaceBoardTargetInputSlot<Kind extends "space" | "edge" | "vertex" | "tile", Target extends string = string> {
|
|
56
|
+
readonly Target: WorkspaceInteractionSlotComponent<{
|
|
57
|
+
value: Target;
|
|
58
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "disabled" | "aria-disabled" | "aria-pressed" | "onClick" | "type" | "value">>;
|
|
59
|
+
readonly Value: WorkspaceInteractionSlotComponent<{
|
|
60
|
+
children: (value: unknown | undefined) => ReactNode;
|
|
61
|
+
}>;
|
|
62
|
+
readonly Default: WorkspaceInteractionSlotComponent;
|
|
63
|
+
readonly __kind?: Kind;
|
|
64
|
+
}
|
|
65
|
+
interface WorkspaceBoardSurface<Space extends string = string, Edge extends string = string, Vertex extends string = string, Tile extends string = string> {
|
|
66
|
+
readonly Root: WorkspaceInteractionSlotComponent;
|
|
67
|
+
readonly Space: <Target extends Space>(props: BoardSpaceTargetProps<Target>) => ReactElement | null;
|
|
68
|
+
readonly slot: {
|
|
69
|
+
readonly space: WorkspaceBoardTargetInputSlot<"space", Space>;
|
|
70
|
+
readonly playerSpace: WorkspaceBoardTargetInputSlot<"space", Space>;
|
|
71
|
+
readonly edge: WorkspaceBoardTargetInputSlot<"edge", Edge>;
|
|
72
|
+
readonly vertex: WorkspaceBoardTargetInputSlot<"vertex", Vertex>;
|
|
73
|
+
readonly tile: WorkspaceBoardTargetInputSlot<"tile", Tile>;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
type WorkspaceZoneCardsComponent<Card> = WorkspaceInteractionSlotComponent<Omit<ZoneListProps, "children" | "empty"> & {
|
|
77
|
+
empty?: ReactNode;
|
|
78
|
+
children: (card: Card) => ReactNode;
|
|
79
|
+
}>;
|
|
80
|
+
type WorkspaceZoneCardComponent<Card> = WorkspaceInteractionSlotComponent<Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "value"> & {
|
|
81
|
+
card: Card;
|
|
82
|
+
}>;
|
|
83
|
+
type WorkspaceZoneStagingComponent<Card> = WorkspaceInteractionSlotComponent<{
|
|
84
|
+
children: (card: Card) => ReactNode;
|
|
85
|
+
label?: ReactNode;
|
|
86
|
+
renderEmptySlot?: (index: number) => ReactNode;
|
|
87
|
+
cardSize?: "sm" | "md" | "lg";
|
|
88
|
+
ariaLabel?: string;
|
|
89
|
+
className?: string;
|
|
90
|
+
}>;
|
|
91
|
+
type WorkspaceHandCardsComponent<Card> = WorkspaceInteractionSlotComponent<{
|
|
92
|
+
children: (card: Card, state: unknown) => ReactNode;
|
|
93
|
+
}>;
|
|
94
|
+
type WorkspaceHandSummaryComponent = WorkspaceInteractionSlotComponent<{
|
|
95
|
+
children?: ReactNode | ((summary: unknown) => ReactNode);
|
|
96
|
+
}>;
|
|
97
|
+
interface WorkspaceHandSurface<Zone extends string, Card> {
|
|
98
|
+
readonly Hand: WorkspaceInteractionSlotComponent<{
|
|
99
|
+
children: ReactNode | ((card: Card, state: InteractionVisualState) => ReactNode);
|
|
100
|
+
}>;
|
|
101
|
+
readonly Cards: WorkspaceHandCardsComponent<Card>;
|
|
102
|
+
readonly Summary: WorkspaceHandSummaryComponent;
|
|
103
|
+
readonly Actions: WorkspaceHandSummaryComponent;
|
|
104
|
+
readonly Card: WorkspaceZoneCardComponent<Card>;
|
|
105
|
+
readonly Staging: WorkspaceZoneStagingComponent<Card>;
|
|
106
|
+
readonly slot: {
|
|
107
|
+
readonly card: WorkspaceCardInputSlot<Zone>;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
interface WorkspacePileSurface<Card> {
|
|
111
|
+
readonly Pile: WorkspaceZoneCardsComponent<Card>;
|
|
112
|
+
readonly Card: WorkspaceZoneCardComponent<Card>;
|
|
113
|
+
}
|
|
114
|
+
interface WorkspaceCardCollectionSurface<Zone extends string, Card> {
|
|
115
|
+
readonly Collection: WorkspaceZoneCardsComponent<Card>;
|
|
116
|
+
readonly Card: WorkspaceZoneCardComponent<Card>;
|
|
117
|
+
readonly slot: {
|
|
118
|
+
readonly card: WorkspaceCardInputSlot<Zone>;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
interface WorkspaceBoardSurfaceDescriptor<Board extends string = string> {
|
|
122
|
+
readonly kind: "board";
|
|
123
|
+
readonly board: Board;
|
|
124
|
+
}
|
|
125
|
+
interface WorkspaceHandSurfaceDescriptor<Zone extends string = string> {
|
|
126
|
+
readonly kind: "hand";
|
|
127
|
+
readonly zone: Zone;
|
|
128
|
+
readonly role: HandRole;
|
|
129
|
+
readonly label: string;
|
|
130
|
+
readonly order?: number;
|
|
131
|
+
}
|
|
132
|
+
interface WorkspacePileSurfaceDescriptor<Zone extends string = string> {
|
|
133
|
+
readonly kind: "pile";
|
|
134
|
+
readonly zone: Zone;
|
|
135
|
+
}
|
|
136
|
+
interface WorkspacePilesSurfaceDescriptor<Zones extends readonly string[] = readonly string[]> {
|
|
137
|
+
readonly kind: "piles";
|
|
138
|
+
readonly zones: Zones;
|
|
139
|
+
}
|
|
140
|
+
interface WorkspaceCardCollectionSurfaceDescriptor<Zones extends readonly string[] = readonly string[]> {
|
|
141
|
+
readonly kind: "cardCollection";
|
|
142
|
+
readonly zones: Zones;
|
|
143
|
+
readonly mode?: "all" | "top-card";
|
|
144
|
+
}
|
|
145
|
+
interface WorkspaceInteractionFormsDescriptor<Interactions extends Readonly<Record<string, string>> = Readonly<Record<string, string>>> {
|
|
146
|
+
readonly kind: "forms";
|
|
147
|
+
readonly interactions: Interactions;
|
|
148
|
+
}
|
|
149
|
+
interface WorkspaceInteractionFormDescriptor<Interaction extends string = string> {
|
|
150
|
+
readonly kind: "form";
|
|
151
|
+
readonly interaction: Interaction;
|
|
152
|
+
}
|
|
153
|
+
type WorkspaceSurfaceDescriptor = WorkspaceBoardSurfaceDescriptor | WorkspaceHandSurfaceDescriptor | WorkspacePileSurfaceDescriptor | WorkspacePilesSurfaceDescriptor | WorkspaceCardCollectionSurfaceDescriptor | WorkspaceInteractionFormDescriptor | WorkspaceInteractionFormsDescriptor;
|
|
154
|
+
interface WorkspaceSurfaceSpec {
|
|
155
|
+
readonly [key: string]: WorkspaceSurfaceDescriptor | WorkspaceSurfaceSpec;
|
|
156
|
+
}
|
|
157
|
+
interface WorkspaceContractOptions<Contract extends UIContract, Resource extends string, Card, HexBoards extends Record<string, unknown>> {
|
|
158
|
+
readonly uiContract: Contract;
|
|
159
|
+
readonly clientParamSchemasByPhase?: ClientParamSchemaMap;
|
|
160
|
+
readonly formInputKeysForInteraction: (interaction: string) => ReadonlySet<string>;
|
|
161
|
+
readonly resourceIds: readonly Resource[];
|
|
162
|
+
readonly resourcePresentationById?: Partial<Record<string, {
|
|
163
|
+
label?: string;
|
|
164
|
+
icon?: string;
|
|
165
|
+
}>>;
|
|
166
|
+
readonly hexStaticBoards: HexBoards;
|
|
167
|
+
readonly cardIdFromZoneCard: (card: Card) => string;
|
|
168
|
+
readonly zoneIdFromZoneCard: (card: Card) => string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
interface DefineGameUIConfig<GameState, Surfaces> {
|
|
172
|
+
useSurfaces: () => Surfaces;
|
|
173
|
+
interactionRoutes?: (context: {
|
|
174
|
+
game: GameState;
|
|
175
|
+
surfaces: Surfaces;
|
|
176
|
+
}) => Record<string, {
|
|
177
|
+
collect: Record<string, unknown>;
|
|
178
|
+
}>;
|
|
179
|
+
phases: Record<string, (context: {
|
|
180
|
+
game: GameState;
|
|
181
|
+
surfaces: Surfaces;
|
|
182
|
+
}) => ReactNode>;
|
|
183
|
+
renderInteractions?: (context: {
|
|
184
|
+
game: GameState;
|
|
185
|
+
surfaces: Surfaces;
|
|
186
|
+
}) => ReactNode;
|
|
187
|
+
fallback?: ReactNode | ((phase: string | null) => ReactNode);
|
|
188
|
+
includeUnavailableInteractions?: boolean | null;
|
|
189
|
+
}
|
|
190
|
+
declare function createWorkspaceUIContract<WorkspaceUI, Contract extends UIContract, Resource extends string, Card, HexBoards extends Record<string, unknown>>(options: WorkspaceContractOptions<Contract, Resource, Card, HexBoards>): WorkspaceUI;
|
|
191
|
+
|
|
192
|
+
export { type ClientParamSchemaMap as C, type DefineGameUIConfig as D, type WorkspaceBoardSurface as W, type WorkspaceBoardSurfaceDescriptor as a, type WorkspaceBoardTargetInputSlot as b, type WorkspaceCardCollectionSurface as c, type WorkspaceCardCollectionSurfaceDescriptor as d, type WorkspaceCardInputSlot as e, type WorkspaceFormInputSlot as f, type WorkspaceHandSurface as g, type WorkspaceHandSurfaceDescriptor as h, type WorkspaceInteractionFormDescriptor as i, type WorkspaceInteractionFormsDescriptor as j, type WorkspaceInteractionSlotComponent as k, type WorkspacePileSurface as l, type WorkspacePileSurfaceDescriptor as m, type WorkspacePilesSurfaceDescriptor as n, type WorkspaceSurfaceSpec as o, createWorkspaceUIContract as p };
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
DREAMBOARD_SDK_PACKAGES,
|
|
3
3
|
DREAMBOARD_SDK_PACKAGE_SET,
|
|
4
4
|
DREAMBOARD_SDK_VERSION
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-LKJLAGND.js";
|
|
6
|
+
import "./chunk-SUMZ5OEH.js";
|
|
7
7
|
import "./chunk-PZ5AY32C.js";
|
|
8
8
|
export {
|
|
9
9
|
DREAMBOARD_SDK_PACKAGES,
|
package/dist/package-set.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare const DREAMBOARD_SDK_VERSION: "0.4.0-alpha.
|
|
1
|
+
declare const DREAMBOARD_SDK_VERSION: "0.4.0-alpha.4";
|
|
2
2
|
declare const DREAMBOARD_SDK_PACKAGES: {
|
|
3
|
-
readonly "@dreamboard-games/sdk": "0.4.0-alpha.
|
|
3
|
+
readonly "@dreamboard-games/sdk": "0.4.0-alpha.4";
|
|
4
4
|
};
|
|
5
5
|
type DreamboardSdkPackageName = keyof typeof DREAMBOARD_SDK_PACKAGES;
|
|
6
6
|
type DreamboardSdkPackageSet = {
|
package/dist/package-set.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
DREAMBOARD_SDK_PACKAGES,
|
|
3
3
|
DREAMBOARD_SDK_PACKAGE_SET,
|
|
4
4
|
DREAMBOARD_SDK_VERSION
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-LKJLAGND.js";
|
|
6
|
+
import "./chunk-SUMZ5OEH.js";
|
|
7
7
|
import "./chunk-PZ5AY32C.js";
|
|
8
8
|
export {
|
|
9
9
|
DREAMBOARD_SDK_PACKAGES,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { bd as ZoneCardRenderItem } from '../ui-contract-
|
|
2
|
-
export { B as Board, a as BoardEdgeTarget, b as BoardEdgeTargetProps, c as BoardHexGrid, d as BoardHexGridInteractionFilter, e as BoardHexGridInteractions, f as BoardHexGridProps, g as BoardHexView, h as BoardHexViewProps, i as BoardRoot, j as BoardRootProps, k as BoardSpaceTarget, l as BoardSpaceTargetProps, m as BoardState, n as BoardStateProps, o as BoardTarget, p as BoardTargetExtraInputs, q as BoardTargetProps, r as BoardVertexTarget, s as BoardVertexTargetProps, D as Dice, t as DiceComponents, u as DiceRoot, v as DiceRootProps, w as DiceState, x as DiceValue, y as DiceValues, z as DiceValuesProps, G as Game, C as GameActiveActionState, E as GameChrome, F as GameChromeProps, H as GameChromeState, I as GameMeState, J as GamePendingInputState, K as GamePlayer, L as GamePlayerEntry, M as GamePlayersState, N as GameRenderState, O as GameRoot, P as GameRootProps, Q as GameTurnState, R as GameViewport, S as GameViewportProps, T as Interaction, U as InteractionCardInput, V as InteractionCardInputProps, W as InteractionCardInputRenderState, X as InteractionDescription, Y as InteractionDialog, Z as InteractionDialogProps, _ as InteractionDialogRenderState, $ as InteractionDialogState, a0 as InteractionFieldPrimitiveProps, a1 as InteractionFormPrimitive, a2 as InteractionFormPrimitiveProps, a3 as InteractionInput, a4 as InteractionInputProps, a5 as InteractionLabel, a6 as InteractionPartProps, a7 as InteractionRoot, a8 as InteractionRootProps, a9 as InteractionRoute, aa as InteractionRoutes, ab as InteractionRoutesMap, ac as InteractionRoutesProps, ad as InteractionState, ae as InteractionStateProps, af as InteractionStateSnapshot, ag as InteractionSubmit, ah as InteractionSubmitProps, ai as InteractionSwitch, aj as InteractionSwitchProps, ak as InteractionSwitchRenderState, al as InteractionSwitchRouteMap, am as InteractionTrigger, an as InteractionTriggerProps, ao as InteractionUnavailableMessage, ap as InteractionValidationMessage, aq as Phase, ar as PhaseFallback, as as PhaseRouteMap, at as PhaseSwitch, au as PhaseSwitchProps, av as PlayerRoster, aw as PlayerRosterBadge, ax as PlayerRosterBadges, ay as PlayerRosterComponents, az as PlayerRosterEmpty, aA as PlayerRosterEntry, aB as PlayerRosterList, aC as PlayerRosterListProps, aD as PlayerRosterName, aE as PlayerRosterPartProps, aF as PlayerRosterRoot, aG as PlayerRosterRootProps, aH as PlayerRosterScore, aI as Prompt, aJ as PromptDialog, aK as PromptDialogProps, aL as PromptDialogRenderState, aM as PromptDialogState, aN as PromptInbox, aO as PromptInboxEmpty, aP as PromptInboxItems, aQ as PromptInboxItemsProps, aR as PromptInboxRoot, aS as PromptMessage, aT as PromptOption, aU as PromptOptionProps, aV as PromptOptionRenderItem, aW as PromptOptions, aX as PromptOptionsProps, aY as PromptRoot, aZ as PromptRootProps, a_ as PromptTitle, b0 as UI, b2 as UIRoot, b3 as UIRootProps, b4 as UseZoneCardsOptions, b5 as UseZoneCardsResult, b6 as Zone, b7 as ZoneCardAction, b8 as ZoneCardActionExtraInputs, b9 as ZoneCardActionProps, ba as ZoneCardActionResult, bb as ZoneCardAt, bc as ZoneCardAtProps, be as ZoneItem, bf as ZoneItemProps, bg as ZoneList, bh as ZoneListProps, bi as ZonePileCards, bj as ZonePileCardsProps, bk as ZonePileContextValue, bl as ZonePileCount, bm as ZonePileCountProps, bn as ZonePileDescription, bo as ZonePileDescriptionProps, bp as ZonePileLabel, bq as ZonePileLabelProps, br as ZonePileRoot, bs as ZonePileRootProps, bt as ZonePileTrigger, bu as ZonePileTriggerProps, bv as ZoneRoot, bw as ZoneRootProps, bx as ZoneTopCard, by as ZoneTopCardProps, bz as createZoneCardRenderItem, bA as normalizeDiceState, bB as useBoardPrimitiveContext, bC as useDicePrimitiveContext, bD as useGameActionError, bE as useInteractionPrimitiveContext, bF as useOptionalZonePrimitiveContext, bG as useResolvedCardTargetValue, bH as useZoneCardContext, bI as useZoneCards, bJ as useZonePileContext, bK as useZonePrimitiveContext } from '../ui-contract-
|
|
1
|
+
import { bd as ZoneCardRenderItem } from '../ui-contract-B4NjRlvC.js';
|
|
2
|
+
export { B as Board, a as BoardEdgeTarget, b as BoardEdgeTargetProps, c as BoardHexGrid, d as BoardHexGridInteractionFilter, e as BoardHexGridInteractions, f as BoardHexGridProps, g as BoardHexView, h as BoardHexViewProps, i as BoardRoot, j as BoardRootProps, k as BoardSpaceTarget, l as BoardSpaceTargetProps, m as BoardState, n as BoardStateProps, o as BoardTarget, p as BoardTargetExtraInputs, q as BoardTargetProps, r as BoardVertexTarget, s as BoardVertexTargetProps, D as Dice, t as DiceComponents, u as DiceRoot, v as DiceRootProps, w as DiceState, x as DiceValue, y as DiceValues, z as DiceValuesProps, G as Game, C as GameActiveActionState, E as GameChrome, F as GameChromeProps, H as GameChromeState, I as GameMeState, J as GamePendingInputState, K as GamePlayer, L as GamePlayerEntry, M as GamePlayersState, N as GameRenderState, O as GameRoot, P as GameRootProps, Q as GameTurnState, R as GameViewport, S as GameViewportProps, T as Interaction, U as InteractionCardInput, V as InteractionCardInputProps, W as InteractionCardInputRenderState, X as InteractionDescription, Y as InteractionDialog, Z as InteractionDialogProps, _ as InteractionDialogRenderState, $ as InteractionDialogState, a0 as InteractionFieldPrimitiveProps, a1 as InteractionFormPrimitive, a2 as InteractionFormPrimitiveProps, a3 as InteractionInput, a4 as InteractionInputProps, a5 as InteractionLabel, a6 as InteractionPartProps, a7 as InteractionRoot, a8 as InteractionRootProps, a9 as InteractionRoute, aa as InteractionRoutes, ab as InteractionRoutesMap, ac as InteractionRoutesProps, ad as InteractionState, ae as InteractionStateProps, af as InteractionStateSnapshot, ag as InteractionSubmit, ah as InteractionSubmitProps, ai as InteractionSwitch, aj as InteractionSwitchProps, ak as InteractionSwitchRenderState, al as InteractionSwitchRouteMap, am as InteractionTrigger, an as InteractionTriggerProps, ao as InteractionUnavailableMessage, ap as InteractionValidationMessage, aq as Phase, ar as PhaseFallback, as as PhaseRouteMap, at as PhaseSwitch, au as PhaseSwitchProps, av as PlayerRoster, aw as PlayerRosterBadge, ax as PlayerRosterBadges, ay as PlayerRosterComponents, az as PlayerRosterEmpty, aA as PlayerRosterEntry, aB as PlayerRosterList, aC as PlayerRosterListProps, aD as PlayerRosterName, aE as PlayerRosterPartProps, aF as PlayerRosterRoot, aG as PlayerRosterRootProps, aH as PlayerRosterScore, aI as Prompt, aJ as PromptDialog, aK as PromptDialogProps, aL as PromptDialogRenderState, aM as PromptDialogState, aN as PromptInbox, aO as PromptInboxEmpty, aP as PromptInboxItems, aQ as PromptInboxItemsProps, aR as PromptInboxRoot, aS as PromptMessage, aT as PromptOption, aU as PromptOptionProps, aV as PromptOptionRenderItem, aW as PromptOptions, aX as PromptOptionsProps, aY as PromptRoot, aZ as PromptRootProps, a_ as PromptTitle, b0 as UI, b2 as UIRoot, b3 as UIRootProps, b4 as UseZoneCardsOptions, b5 as UseZoneCardsResult, b6 as Zone, b7 as ZoneCardAction, b8 as ZoneCardActionExtraInputs, b9 as ZoneCardActionProps, ba as ZoneCardActionResult, bb as ZoneCardAt, bc as ZoneCardAtProps, be as ZoneItem, bf as ZoneItemProps, bg as ZoneList, bh as ZoneListProps, bi as ZonePileCards, bj as ZonePileCardsProps, bk as ZonePileContextValue, bl as ZonePileCount, bm as ZonePileCountProps, bn as ZonePileDescription, bo as ZonePileDescriptionProps, bp as ZonePileLabel, bq as ZonePileLabelProps, br as ZonePileRoot, bs as ZonePileRootProps, bt as ZonePileTrigger, bu as ZonePileTriggerProps, bv as ZoneRoot, bw as ZoneRootProps, bx as ZoneTopCard, by as ZoneTopCardProps, bz as createZoneCardRenderItem, bA as normalizeDiceState, bB as useBoardPrimitiveContext, bC as useDicePrimitiveContext, bD as useGameActionError, bE as useInteractionPrimitiveContext, bF as useOptionalZonePrimitiveContext, bG as useResolvedCardTargetValue, bH as useZoneCardContext, bI as useZoneCards, bJ as useZonePileContext, bK as useZonePrimitiveContext } from '../ui-contract-B4NjRlvC.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { f as CardIntent, J as InteractionVisualState, C as CardDropTargetVisualState } from '../hex-board-view-BFlWDb9k.js';
|
|
6
|
+
import { a as HandLayoutKind, b as HandLayoutPolicy, H as HandInteractionPolicy } from '../HandView-x8MhbhFl.js';
|
|
6
7
|
import { a as InteractionDescriptor } from '../runtime-api-BJharVaj.js';
|
|
7
8
|
export { P as PrimitiveCommonProps, a as PrimitiveDataAttributes, c as composeEventHandlers, r as renderPrimitive } from '../primitive-props-BNHDkgd7.js';
|
|
8
|
-
import '../
|
|
9
|
-
import '../player-state-Cqpyeql0.js';
|
|
9
|
+
import '../ThemeProvider-DRalAWzY.js';
|
|
10
10
|
import '../types.js';
|
|
11
|
-
import '../ThemeProvider-B1sIoBlX.js';
|
|
12
11
|
import '../attributes-DbvyMbXw.js';
|
|
13
12
|
import '../types-DJj5MJkl.js';
|
|
14
13
|
import '../runtime-api-C6aWo9c0.js';
|
|
14
|
+
import '../player-state-Cqpyeql0.js';
|
|
15
15
|
|
|
16
16
|
interface InteractionDraftReadiness {
|
|
17
17
|
values: Record<string, unknown>;
|
|
@@ -142,29 +142,26 @@ interface HandSurfaceViewProps<Card extends ZoneCardRenderItem> {
|
|
|
142
142
|
/** Visual surface for a single card. */
|
|
143
143
|
renderCard: (card: Card, state: InteractionVisualState, index: number) => ReactNode;
|
|
144
144
|
/**
|
|
145
|
-
* Render-safe slot for selection summary content. Fires during render
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
145
|
+
* Render-safe slot for selection summary content. Fires during render with
|
|
146
|
+
* the latest projected summary so authors can compose count chrome inline.
|
|
147
|
+
* The returned node is hoisted above the hand region. Use this for visible
|
|
148
|
+
* UI; use `onSelectionSummary` only for analytics or external state mirrors
|
|
149
|
+
* that need an effect.
|
|
150
150
|
*/
|
|
151
|
-
|
|
151
|
+
summarySlot?: (summary: HandSelectionSummary) => ReactNode;
|
|
152
152
|
/**
|
|
153
153
|
* Optional selection summary observer. Invoked from a layout effect so
|
|
154
|
-
* consumers may safely call `setState` in response. Use `
|
|
155
|
-
*
|
|
156
|
-
* surprises.
|
|
154
|
+
* consumers may safely call `setState` in response. Use `summarySlot` for
|
|
155
|
+
* inline rendering instead — that path avoids effect-timing surprises.
|
|
157
156
|
*/
|
|
158
157
|
onSelectionSummary?: (summary: HandSelectionSummary) => void;
|
|
159
158
|
/**
|
|
160
|
-
* Render-safe slot for the hand's commit/action chrome
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* the hand is docked. Use this instead of anchoring the action elsewhere on
|
|
165
|
-
* the board, where the dock would otherwise hide it.
|
|
159
|
+
* Render-safe slot for the hand's commit/action chrome. Receives the same
|
|
160
|
+
* live summary as `summarySlot`. Rendered below the hand inline on desktop
|
|
161
|
+
* and pinned as a sticky footer inside the mobile dock, so the action stays
|
|
162
|
+
* reachable while the hand is docked.
|
|
166
163
|
*/
|
|
167
|
-
|
|
164
|
+
actionsSlot?: (summary: HandSelectionSummary) => ReactNode;
|
|
168
165
|
/** Layout policy forwarded to the SDK HandView. */
|
|
169
166
|
layout?: HandLayoutKind | HandLayoutPolicy;
|
|
170
167
|
/** Mobile interaction policy. Defaults to `direct-activate`. */
|
|
@@ -208,7 +205,7 @@ interface HandSurfaceViewProps<Card extends ZoneCardRenderItem> {
|
|
|
208
205
|
* pieces (`HandView`, `CardDragSurface`, `CardDropTargetView`) come from
|
|
209
206
|
* `@dreamboard-games/sdk/ui` and stay descriptor/draft unaware.
|
|
210
207
|
*/
|
|
211
|
-
declare function HandSurfaceView<Card extends ZoneCardRenderItem>({ zone, cards, renderCard, layout, mobileInteraction, dropTargets, renderDropTargets, cardSize, renderEmpty, ariaLabel, onIntentRouted, onSelectionSummary,
|
|
208
|
+
declare function HandSurfaceView<Card extends ZoneCardRenderItem>({ zone, cards, renderCard, layout, mobileInteraction, dropTargets, renderDropTargets, cardSize, renderEmpty, ariaLabel, onIntentRouted, onSelectionSummary, summarySlot, actionsSlot, className, }: HandSurfaceViewProps<Card>): react_jsx_runtime.JSX.Element;
|
|
212
209
|
/**
|
|
213
210
|
* Convenience helper for builders of generated hand surfaces. Encodes a
|
|
214
211
|
* typed target kind plus value into the opaque `targetId` that the SDK
|
|
@@ -82,10 +82,10 @@ import {
|
|
|
82
82
|
useZoneCards,
|
|
83
83
|
useZonePileContext,
|
|
84
84
|
useZonePrimitiveContext
|
|
85
|
-
} from "../chunk-
|
|
86
|
-
import "../chunk-
|
|
85
|
+
} from "../chunk-QOFFRHZR.js";
|
|
86
|
+
import "../chunk-XZ667T4K.js";
|
|
87
87
|
import "../chunk-T3ZKNUZ7.js";
|
|
88
|
-
import "../chunk-
|
|
88
|
+
import "../chunk-E3X552YM.js";
|
|
89
89
|
import {
|
|
90
90
|
composeEventHandlers,
|
|
91
91
|
renderPrimitive
|