@dreamboard-games/sdk 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +96 -0
- package/README.md +12 -0
- package/dist/HandView-ncJIVLhN.d.ts +193 -0
- package/dist/ResourceCounter-CTREyF73.d.ts +102 -0
- package/dist/ThemeProvider-fy0_QzgO.d.ts +99 -0
- package/dist/bundle-TIZcw8LB.d.ts +281 -0
- package/dist/cards-Sl3b40Mv.d.ts +13 -0
- package/dist/chunk-7YAHLYBR.js +481 -0
- package/dist/chunk-7YAHLYBR.js.map +1 -0
- package/dist/chunk-FDNZTDD6.js +8085 -0
- package/dist/chunk-FDNZTDD6.js.map +1 -0
- package/dist/chunk-GKKBPPSW.js +598 -0
- package/dist/chunk-GKKBPPSW.js.map +1 -0
- package/dist/chunk-I46YJSOD.js +1 -0
- package/dist/chunk-I46YJSOD.js.map +1 -0
- package/dist/chunk-KAELH4KC.js +104 -0
- package/dist/chunk-KAELH4KC.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-T3ZKNUZ7.js +1 -0
- package/dist/chunk-T3ZKNUZ7.js.map +1 -0
- package/dist/chunk-T52J5RMF.js +1 -0
- package/dist/chunk-T52J5RMF.js.map +1 -0
- package/dist/chunk-TDSWKVZ4.js +5401 -0
- package/dist/chunk-TDSWKVZ4.js.map +1 -0
- package/dist/chunk-U5C6BONG.js +34 -0
- package/dist/chunk-U5C6BONG.js.map +1 -0
- package/dist/chunk-VDXOF4FW.js +69 -0
- package/dist/chunk-VDXOF4FW.js.map +1 -0
- package/dist/chunk-VFTAA4WO.js +115 -0
- package/dist/chunk-VFTAA4WO.js.map +1 -0
- package/dist/chunk-WN74KVNY.js +17 -0
- package/dist/chunk-WN74KVNY.js.map +1 -0
- package/dist/chunk-WYPQ3GG5.js +10990 -0
- package/dist/chunk-WYPQ3GG5.js.map +1 -0
- package/dist/components-D5ZRE2Hl.d.ts +1451 -0
- package/dist/generated/runtime/primitives.d.ts +12 -0
- package/dist/generated/runtime/primitives.js +180 -0
- package/dist/generated/runtime/primitives.js.map +1 -0
- package/dist/generated/runtime-api.d.ts +3 -0
- package/dist/generated/runtime-api.js +2 -0
- package/dist/generated/runtime-api.js.map +1 -0
- package/dist/generated/runtime.d.ts +14 -0
- package/dist/generated/runtime.js +18 -0
- package/dist/generated/runtime.js.map +1 -0
- package/dist/generated/workspace-contract.d.ts +14 -0
- package/dist/generated/workspace-contract.js +14 -0
- package/dist/generated/workspace-contract.js.map +1 -0
- package/dist/hex-board-view-D_07hO6O.d.ts +933 -0
- package/dist/hex-color-MhOyuY-o.d.ts +8 -0
- package/dist/index-BwqPQtBu.d.ts +1433 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/reducer-bundle-abi.d.ts +1083 -0
- package/dist/infrastructure/reducer-bundle-abi.js +14 -0
- package/dist/infrastructure/reducer-bundle-abi.js.map +1 -0
- package/dist/infrastructure/workspace-codegen.d.ts +53 -0
- package/dist/infrastructure/workspace-codegen.js +44 -0
- package/dist/infrastructure/workspace-codegen.js.map +1 -0
- package/dist/manifest-contract-BNHVGFtU.d.ts +9 -0
- package/dist/package-set.d.ts +13 -0
- package/dist/package-set.js +12 -0
- package/dist/package-set.js.map +1 -0
- package/dist/primitive-props-DpKs-GCr.d.ts +11 -0
- package/dist/reducer.d.ts +3786 -0
- package/dist/reducer.js +8131 -0
- package/dist/reducer.js.map +1 -0
- package/dist/runtime/primitives.d.ts +226 -0
- package/dist/runtime/primitives.js +180 -0
- package/dist/runtime/primitives.js.map +1 -0
- package/dist/runtime/types/runtime-api.d.ts +1 -0
- package/dist/runtime/types/runtime-api.js +2 -0
- package/dist/runtime/types/runtime-api.js.map +1 -0
- package/dist/runtime/workspace-contract.d.ts +172 -0
- package/dist/runtime/workspace-contract.js +14 -0
- package/dist/runtime/workspace-contract.js.map +1 -0
- package/dist/runtime-api-3dshj6kK.d.ts +101 -0
- package/dist/runtime-api-DWxvTr-O.d.ts +379 -0
- package/dist/runtime.d.ts +58 -0
- package/dist/runtime.js +13 -0
- package/dist/runtime.js.map +1 -0
- package/dist/slots-1GPGihk8.d.ts +8 -0
- package/dist/testing.d.ts +149 -0
- package/dist/testing.js +513 -0
- package/dist/testing.js.map +1 -0
- package/dist/types.d.ts +496 -0
- package/dist/types.js +28 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/components.d.ts +16 -0
- package/dist/ui/components.js +192 -0
- package/dist/ui/components.js.map +1 -0
- package/dist/ui/defaults.d.ts +19 -0
- package/dist/ui/defaults.js +104 -0
- package/dist/ui/defaults.js.map +1 -0
- package/dist/ui/plugin-styles.css +250 -0
- package/dist/ui/types/player-state.d.ts +365 -0
- package/dist/ui/types/player-state.js +1 -0
- package/dist/ui/types/player-state.js.map +1 -0
- package/dist/ui-contract-iQfTtUSL.d.ts +1161 -0
- package/dist/ui.d.ts +320 -0
- package/dist/ui.js +253 -0
- package/dist/ui.js.map +1 -0
- package/package.json +199 -0
- package/src/generated/reducer-contract/builders.ts +90 -0
- package/src/generated/reducer-contract/version.ts +9 -0
- package/src/generated/reducer-contract/wire.ts +100 -0
- package/src/generated/reducer-contract/zod.ts +101 -0
- package/src/generated/runtime/primitives.ts +2 -0
- package/src/generated/runtime-api.ts +5 -0
- package/src/generated/runtime.ts +35 -0
- package/src/generated/workspace-contract.ts +2 -0
- package/src/index.ts +7 -0
- package/src/infrastructure/reducer-bundle-abi.ts +8 -0
- package/src/infrastructure/reducer-contract/bundle.ts +37 -0
- package/src/infrastructure/workspace-codegen/hex-geometry.ts +69 -0
- package/src/infrastructure/workspace-codegen/index.ts +64 -0
- package/src/infrastructure/workspace-codegen/manifest-contract.ts +6632 -0
- package/src/infrastructure/workspace-codegen/manifest-validation.ts +795 -0
- package/src/infrastructure/workspace-codegen/ownership.ts +131 -0
- package/src/infrastructure/workspace-codegen/preset-card-sets.ts +169 -0
- package/src/infrastructure/workspace-codegen/seeds.ts +1705 -0
- package/src/infrastructure/workspace-codegen.ts +1 -0
- package/src/package-set.ts +19 -0
- package/src/reducer/authoring/contract.ts +157 -0
- package/src/reducer/authoring/effect.ts +224 -0
- package/src/reducer/authoring/game.ts +23 -0
- package/src/reducer/authoring/interaction.ts +98 -0
- package/src/reducer/authoring/phase.ts +300 -0
- package/src/reducer/authoring/types.ts +70 -0
- package/src/reducer/authoring/validation.ts +382 -0
- package/src/reducer/authoring/view-stage.ts +68 -0
- package/src/reducer/authoring.ts +29 -0
- package/src/reducer/bundle/ingress-bundle.ts +491 -0
- package/src/reducer/bundle/trusted/engine-instruction-resolver.ts +254 -0
- package/src/reducer/bundle/trusted/flow-instruction-resolver.ts +73 -0
- package/src/reducer/bundle/trusted/instruction-runner.ts +414 -0
- package/src/reducer/bundle/trusted/interaction-authorization.ts +137 -0
- package/src/reducer/bundle/trusted/interaction-collectors.ts +859 -0
- package/src/reducer/bundle/trusted/interaction-decision.ts +747 -0
- package/src/reducer/bundle/trusted/interaction-resolver.ts +95 -0
- package/src/reducer/bundle/trusted/interaction-types.ts +171 -0
- package/src/reducer/bundle/trusted/lifecycle-runner.ts +427 -0
- package/src/reducer/bundle/trusted/projection-builder.ts +356 -0
- package/src/reducer/bundle/trusted/projection-context.ts +39 -0
- package/src/reducer/bundle/trusted/rng-sampler.ts +150 -0
- package/src/reducer/bundle/trusted/runtime-registry.ts +120 -0
- package/src/reducer/bundle/trusted/runtime-scope.ts +336 -0
- package/src/reducer/bundle/trusted/simultaneous-player.ts +97 -0
- package/src/reducer/bundle/trusted/stage-resolver.ts +87 -0
- package/src/reducer/bundle/trusted/static-projection.ts +116 -0
- package/src/reducer/bundle/trusted/trusted-runtime-args.ts +97 -0
- package/src/reducer/bundle/trusted/trusted-runtime-result.ts +39 -0
- package/src/reducer/bundle/trusted/trusted-setup-profiles.ts +43 -0
- package/src/reducer/bundle/trusted/trusted-state-codec.ts +48 -0
- package/src/reducer/bundle/trusted-bundle.ts +97 -0
- package/src/reducer/bundle/types.ts +171 -0
- package/src/reducer/bundle.ts +2 -0
- package/src/reducer/client-param-schemas.ts +57 -0
- package/src/reducer/compose.ts +34 -0
- package/src/reducer/core/runtime-input.ts +30 -0
- package/src/reducer/core/runtime-instruction.ts +59 -0
- package/src/reducer/core/types.ts +62 -0
- package/src/reducer/definition-index.ts +277 -0
- package/src/reducer/derived.ts +106 -0
- package/src/reducer/effects.ts +92 -0
- package/src/reducer/engine/runtime-instruction-engine.ts +155 -0
- package/src/reducer/ingress/decode-runtime-input.ts +7 -0
- package/src/reducer/ingress/decode-session-state.ts +9 -0
- package/src/reducer/ingress/encode-session-state.ts +6 -0
- package/src/reducer/ingress/input-codec.ts +18 -0
- package/src/reducer/ingress/phase-schemas.ts +62 -0
- package/src/reducer/ingress/raw-types.ts +107 -0
- package/src/reducer/ingress/runtime-codec.ts +14 -0
- package/src/reducer/ingress/runtime-payload.ts +13 -0
- package/src/reducer/ingress/session-codec.ts +392 -0
- package/src/reducer/ingress/types.ts +6 -0
- package/src/reducer/inputs/boardInput.ts +217 -0
- package/src/reducer/inputs/boardTarget.ts +190 -0
- package/src/reducer/inputs/cardInput.ts +86 -0
- package/src/reducer/inputs/cardTarget.ts +101 -0
- package/src/reducer/inputs/choiceTarget.ts +104 -0
- package/src/reducer/inputs/defineInputs.ts +71 -0
- package/src/reducer/inputs/formInput.ts +809 -0
- package/src/reducer/inputs/many.ts +120 -0
- package/src/reducer/inputs/promptInput.ts +87 -0
- package/src/reducer/inputs/rngInput.ts +58 -0
- package/src/reducer/inputs/targetRule.ts +123 -0
- package/src/reducer/inputs.ts +41 -0
- package/src/reducer/model/definition.ts +1072 -0
- package/src/reducer/model/extract.ts +745 -0
- package/src/reducer/model/manifest.ts +570 -0
- package/src/reducer/model/queries.ts +641 -0
- package/src/reducer/model/runtime.ts +264 -0
- package/src/reducer/model/spec.ts +1386 -0
- package/src/reducer/model/table.ts +260 -0
- package/src/reducer/model.ts +7 -0
- package/src/reducer/ops.ts +1034 -0
- package/src/reducer/parse-utils.ts +28 -0
- package/src/reducer/per-player.ts +422 -0
- package/src/reducer/rng.ts +69 -0
- package/src/reducer/schema-helpers.ts +185 -0
- package/src/reducer/setup-bootstrap-helpers.ts +171 -0
- package/src/reducer/setup-bootstrap.ts +481 -0
- package/src/reducer/table-ops.ts +2671 -0
- package/src/reducer/table-queries.ts +372 -0
- package/src/reducer/transaction.ts +120 -0
- package/src/reducer.ts +314 -0
- package/src/runtime/primitives.ts +1 -0
- package/src/runtime/types/runtime-api.ts +1 -0
- package/src/runtime/workspace-contract.ts +32 -0
- package/src/runtime-internal/components/InteractionForm.tsx +1309 -0
- package/src/runtime-internal/components/PluginRuntime.tsx +103 -0
- package/src/runtime-internal/components/board/target-layer.ts +70 -0
- package/src/runtime-internal/context/ClientParamSchemaContext.tsx +44 -0
- package/src/runtime-internal/context/InteractionDraftContext.tsx +279 -0
- package/src/runtime-internal/context/PluginSessionContext.tsx +47 -0
- package/src/runtime-internal/context/PluginStateContext.tsx +262 -0
- package/src/runtime-internal/context/RuntimeContext.tsx +96 -0
- package/src/runtime-internal/defaults/components.tsx +409 -0
- package/src/runtime-internal/defaults/index.ts +11 -0
- package/src/runtime-internal/errors/ValidationError.ts +29 -0
- package/src/runtime-internal/hooks/useActivePlayers.ts +33 -0
- package/src/runtime-internal/hooks/useBoardInteractions.ts +665 -0
- package/src/runtime-internal/hooks/useGameSelector.ts +105 -0
- package/src/runtime-internal/hooks/useGameView.ts +9 -0
- package/src/runtime-internal/hooks/useInteractionByKey.ts +354 -0
- package/src/runtime-internal/hooks/useInteractionHandle.ts +438 -0
- package/src/runtime-internal/hooks/useIsMyTurn.ts +20 -0
- package/src/runtime-internal/hooks/useLobby.ts +76 -0
- package/src/runtime-internal/hooks/useMe.ts +48 -0
- package/src/runtime-internal/hooks/usePlayerInfo.ts +28 -0
- package/src/runtime-internal/hooks/usePlayerTurnOrder.ts +23 -0
- package/src/runtime-internal/hooks/usePluginRuntime.ts +147 -0
- package/src/runtime-internal/hooks/useSeatInbox.ts +61 -0
- package/src/runtime-internal/hooks/useSimultaneousPhase.ts +10 -0
- package/src/runtime-internal/index.ts +42 -0
- package/src/runtime-internal/internal.ts +43 -0
- package/src/runtime-internal/plugin-styles.css +250 -0
- package/src/runtime-internal/primitives/board.tsx +459 -0
- package/src/runtime-internal/primitives/dialog-lifecycle.ts +58 -0
- package/src/runtime-internal/primitives/dice.tsx +79 -0
- package/src/runtime-internal/primitives/game-ui-provider.tsx +35 -0
- package/src/runtime-internal/primitives/game.tsx +387 -0
- package/src/runtime-internal/primitives/hand-intent-adapter.ts +147 -0
- package/src/runtime-internal/primitives/hand-surface.tsx +594 -0
- package/src/runtime-internal/primitives/index.ts +196 -0
- package/src/runtime-internal/primitives/interaction-form-binding.tsx +56 -0
- package/src/runtime-internal/primitives/interaction-submit.ts +90 -0
- package/src/runtime-internal/primitives/interaction.tsx +987 -0
- package/src/runtime-internal/primitives/phase.tsx +43 -0
- package/src/runtime-internal/primitives/player-roster.tsx +302 -0
- package/src/runtime-internal/primitives/primitive-props.tsx +101 -0
- package/src/runtime-internal/primitives/prompt.tsx +255 -0
- package/src/runtime-internal/primitives/ui.tsx +60 -0
- package/src/runtime-internal/primitives/zone.tsx +791 -0
- package/src/runtime-internal/reducer.ts +30 -0
- package/src/runtime-internal/runtime/createPluginRuntimeAPI.ts +605 -0
- package/src/runtime-internal/types/plugin-state.ts +508 -0
- package/src/runtime-internal/types/reducer-state.ts +24 -0
- package/src/runtime-internal/types/runtime-api.ts +114 -0
- package/src/runtime-internal/ui-contract.ts +519 -0
- package/src/runtime-internal/utils/card-intent-adapter.ts +546 -0
- package/src/runtime-internal/utils/interaction-inputs.ts +492 -0
- package/src/runtime-internal/utils/interaction-labels.ts +23 -0
- package/src/runtime-internal/utils/interaction-router.ts +273 -0
- package/src/runtime-internal/utils/interaction-status.ts +74 -0
- package/src/runtime-internal/workspace-contract.ts +1170 -0
- package/src/runtime.ts +34 -0
- package/src/testing/create-expect-api.ts +352 -0
- package/src/testing/create-test-runtime.ts +381 -0
- package/src/testing/definitions.ts +127 -0
- package/src/testing/index.ts +3 -0
- package/src/testing.ts +1 -0
- package/src/type-stubs/manifest-contract.d.ts +42 -0
- package/src/type-stubs/manifest-contract.js +72 -0
- package/src/type-stubs/ui-contract.d.ts +5 -0
- package/src/type-stubs/ui-contract.js +1 -0
- package/src/types/authoring-card-properties.type-test.ts +266 -0
- package/src/types/authoring.ts +1282 -0
- package/src/types/cards.ts +19 -0
- package/src/types/contracts.ts +1550 -0
- package/src/types/generated-helpers.ts +35 -0
- package/src/types/index.ts +147 -0
- package/src/types/slots.ts +11 -0
- package/src/types.ts +1 -0
- package/src/ui/components/ActionButton.tsx +97 -0
- package/src/ui/components/ActionPanel.tsx +315 -0
- package/src/ui/components/Card.tsx +378 -0
- package/src/ui/components/CardDragSurface.tsx +1076 -0
- package/src/ui/components/ChromeSuppressionContext.tsx +70 -0
- package/src/ui/components/CostDisplay.tsx +145 -0
- package/src/ui/components/DiceRoller.tsx +581 -0
- package/src/ui/components/Drawer.tsx +180 -0
- package/src/ui/components/ErrorBoundary.tsx +275 -0
- package/src/ui/components/GameEndDisplay.tsx +398 -0
- package/src/ui/components/GameSkeleton.tsx +260 -0
- package/src/ui/components/Hand.tsx +468 -0
- package/src/ui/components/HandDock.tsx +299 -0
- package/src/ui/components/HandView.tsx +441 -0
- package/src/ui/components/MobileHandTray.tsx +381 -0
- package/src/ui/components/MoreActions.tsx +143 -0
- package/src/ui/components/PhaseIndicator.tsx +341 -0
- package/src/ui/components/PlayArea.tsx +146 -0
- package/src/ui/components/PrimaryActionButton.tsx +336 -0
- package/src/ui/components/PrimaryButton.tsx +45 -0
- package/src/ui/components/ResourceCounter.tsx +270 -0
- package/src/ui/components/StagingZone.tsx +134 -0
- package/src/ui/components/ThemedButton.tsx +113 -0
- package/src/ui/components/Toast.tsx +264 -0
- package/src/ui/components/board/HexGrid.tsx +1294 -0
- package/src/ui/components/board/NetworkGraph.tsx +476 -0
- package/src/ui/components/board/SlotSystem.tsx +388 -0
- package/src/ui/components/board/SquareGrid.tsx +1165 -0
- package/src/ui/components/board/TrackBoard.tsx +496 -0
- package/src/ui/components/board/ZoneMap.tsx +448 -0
- package/src/ui/components/board/hex-board-view.ts +123 -0
- package/src/ui/components/board/index.ts +142 -0
- package/src/ui/components/board/interaction-accessibility.ts +21 -0
- package/src/ui/components/board/target-layer.ts +66 -0
- package/src/ui/components/card-render-content.type-test.ts +27 -0
- package/src/ui/components/hand-layout-math.ts +163 -0
- package/src/ui/components/hand-pointer-engine.ts +413 -0
- package/src/ui/components/index.ts +245 -0
- package/src/ui/components.ts +1 -0
- package/src/ui/defaults/components.tsx +106 -0
- package/src/ui/defaults/index.ts +8 -0
- package/src/ui/defaults.ts +1 -0
- package/src/ui/errors/ValidationError.ts +29 -0
- package/src/ui/helpers/cards.ts +19 -0
- package/src/ui/helpers/track-board.ts +211 -0
- package/src/ui/hooks/useBoardTopology.ts +316 -0
- package/src/ui/hooks/useCards.ts +10 -0
- package/src/ui/hooks/useHandCardPointer.ts +381 -0
- package/src/ui/hooks/useHandLayout.ts +378 -0
- package/src/ui/hooks/useHandPresentation.ts +121 -0
- package/src/ui/hooks/useHexBoard.ts +74 -0
- package/src/ui/hooks/useHexGrid.ts +185 -0
- package/src/ui/hooks/useIsMobile.ts +35 -0
- package/src/ui/hooks/usePanZoom.ts +278 -0
- package/src/ui/hooks/useSquareBoard.ts +124 -0
- package/src/ui/hooks/useSquareGrid.ts +328 -0
- package/src/ui/index.ts +98 -0
- package/src/ui/internal/ui/alert.tsx +51 -0
- package/src/ui/internal/ui/button.tsx +58 -0
- package/src/ui/internal/ui/dialog.tsx +134 -0
- package/src/ui/internal/ui/input.tsx +21 -0
- package/src/ui/internal/ui/label.tsx +21 -0
- package/src/ui/internal/ui/select.tsx +129 -0
- package/src/ui/internal/ui/tooltip.tsx +54 -0
- package/src/ui/internal/ui/utils.ts +5 -0
- package/src/ui/plugin-styles.css +250 -0
- package/src/ui/primitives/dialog-lifecycle.ts +58 -0
- package/src/ui/primitives/dice.tsx +79 -0
- package/src/ui/primitives/primitive-props.tsx +101 -0
- package/src/ui/theme/ThemeProvider.tsx +252 -0
- package/src/ui/theme/board.ts +61 -0
- package/src/ui/theme/css-vars.ts +105 -0
- package/src/ui/theme/derive.ts +240 -0
- package/src/ui/theme/index.ts +61 -0
- package/src/ui/theme/presets/arcade.ts +261 -0
- package/src/ui/theme/presets/studio.ts +261 -0
- package/src/ui/theme/presets/tabletop.ts +266 -0
- package/src/ui/theme/tokens.ts +392 -0
- package/src/ui/types/hex-color.ts +20 -0
- package/src/ui/types/player-state.ts +463 -0
- package/src/ui/types/tiled-board.ts +785 -0
- package/src/ui/types/visual-state.ts +137 -0
- package/src/ui.ts +1 -0
|
@@ -0,0 +1,1161 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode, AriaAttributes, HTMLAttributes, JSX, ReactElement, ButtonHTMLAttributes, InputHTMLAttributes } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { _ as Theme, a0 as ThemeOverride, A as AnyHexBoardInput, d as BoardSpaceIdOf, u as HexGridBoardProps, r as HexBoardView } from './hex-board-view-D_07hO6O.js';
|
|
5
|
+
import { a as ThemePresetId } from './ThemeProvider-fy0_QzgO.js';
|
|
6
|
+
import { a as InteractionDescriptor, Z as ZoneHandlesSnapshot, I as InputDomain, b as InteractionInputDescriptor } from './runtime-api-DWxvTr-O.js';
|
|
7
|
+
import { V as ViewCard } from './cards-Sl3b40Mv.js';
|
|
8
|
+
import { a as PluginSessionState, P as PlayerId } from './runtime-api-3dshj6kK.js';
|
|
9
|
+
import { Player } from './ui/types/player-state.js';
|
|
10
|
+
import { H as HexColor } from './hex-color-MhOyuY-o.js';
|
|
11
|
+
|
|
12
|
+
interface UIRootProps {
|
|
13
|
+
/**
|
|
14
|
+
* Preset id, a full Theme, or omitted to defer to the host-mounted theme.
|
|
15
|
+
* When omitted, no provider is mounted and existing parent themes apply.
|
|
16
|
+
*/
|
|
17
|
+
theme?: ThemePresetId | Theme;
|
|
18
|
+
/** Deep-partial overrides forwarded to the SDK ThemeProvider. */
|
|
19
|
+
themeOverride?: ThemeOverride;
|
|
20
|
+
/** Forwarded to the SDK ThemeProvider. */
|
|
21
|
+
reducedMotion?: "auto" | "force" | "ignore";
|
|
22
|
+
/** Forwarded to the SDK ThemeProvider wrapper. */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Forwarded to the SDK ThemeProvider wrapper style. */
|
|
25
|
+
style?: CSSProperties;
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Root provider for generated UI contracts.
|
|
30
|
+
*
|
|
31
|
+
* Composes the SDK `ThemeProvider` so authors can write
|
|
32
|
+
* `<UI.Root theme="tabletop">` and have presentation tokens applied without
|
|
33
|
+
* importing `@dreamboard-games/sdk/ui` themselves. The runtime workspace contract
|
|
34
|
+
* stacks plugin-state, toast and mobile-hand providers around this.
|
|
35
|
+
*/
|
|
36
|
+
declare function UIRoot({ theme, themeOverride, reducedMotion, className, style, children, }: UIRootProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare const UI: {
|
|
38
|
+
Root: typeof UIRoot;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type PrimitiveDataAttributes = Record<`data-${string}`, string | boolean | number | undefined>;
|
|
42
|
+
type PrimitiveCommonProps = {
|
|
43
|
+
asChild?: boolean;
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
className?: string;
|
|
46
|
+
style?: CSSProperties;
|
|
47
|
+
} & AriaAttributes & PrimitiveDataAttributes;
|
|
48
|
+
type EventHandler<Event> = (event: Event) => void;
|
|
49
|
+
declare function composeEventHandlers<Event extends {
|
|
50
|
+
defaultPrevented: boolean;
|
|
51
|
+
}>(authorHandler: EventHandler<Event> | undefined, primitiveHandler: EventHandler<Event> | undefined): EventHandler<Event> | undefined;
|
|
52
|
+
declare function renderPrimitive<ElementProps extends HTMLAttributes<HTMLElement>>(tagName: keyof JSX.IntrinsicElements, props: ElementProps & PrimitiveCommonProps): ReactElement;
|
|
53
|
+
|
|
54
|
+
interface ZoneContextValue {
|
|
55
|
+
zone: string;
|
|
56
|
+
snapshot: ZoneHandlesSnapshot | null;
|
|
57
|
+
}
|
|
58
|
+
interface ZoneCardContextValue {
|
|
59
|
+
zone: string;
|
|
60
|
+
cardId: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* An item rendered by a zone primitive. Discriminated by `hidden`:
|
|
64
|
+
*
|
|
65
|
+
* - `hidden: false` — fully hydrated from the zone projection. Carries the
|
|
66
|
+
* authored card type, properties, and reducer-projected interaction state.
|
|
67
|
+
* - `hidden: true` — the zone snapshot exposes the card id but withholds its
|
|
68
|
+
* contents (e.g. opponent zones, or a zone that is projected count-only).
|
|
69
|
+
* The render contract is honest about not knowing the type; authors must
|
|
70
|
+
* narrow on `hidden` before reading `cardType` / `properties`.
|
|
71
|
+
*
|
|
72
|
+
* Replaces the previous silent fallback that widened `cardType` to the
|
|
73
|
+
* untyped string `"unknown"` — see SDK Design Principles §2 (strong contracts
|
|
74
|
+
* over comments).
|
|
75
|
+
*/
|
|
76
|
+
type ZoneCardRenderItem<CardIdValue extends string = string, CardTypeValue extends string = string, Properties extends Record<string, unknown> = Record<string, unknown>> = HydratedZoneCardRenderItem<CardIdValue, CardTypeValue, Properties> | HiddenZoneCardRenderItem<CardIdValue>;
|
|
77
|
+
interface HydratedZoneCardRenderItem<CardIdValue extends string = string, CardTypeValue extends string = string, Properties extends Record<string, unknown> = Record<string, unknown>> extends ViewCard<CardIdValue, CardTypeValue, Properties> {
|
|
78
|
+
zone: string;
|
|
79
|
+
index: number;
|
|
80
|
+
hidden: false;
|
|
81
|
+
playable: boolean;
|
|
82
|
+
interactions: readonly InteractionDescriptor[];
|
|
83
|
+
}
|
|
84
|
+
interface HiddenZoneCardRenderItem<CardIdValue extends string = string> {
|
|
85
|
+
id: CardIdValue;
|
|
86
|
+
zone: string;
|
|
87
|
+
index: number;
|
|
88
|
+
hidden: true;
|
|
89
|
+
}
|
|
90
|
+
interface ZonePileContextValue {
|
|
91
|
+
zone: string;
|
|
92
|
+
label: string;
|
|
93
|
+
count: number;
|
|
94
|
+
cards: readonly string[];
|
|
95
|
+
items: readonly ZoneCardRenderItem[];
|
|
96
|
+
hasVisibleCards: boolean;
|
|
97
|
+
isHidden: boolean;
|
|
98
|
+
description: string | null;
|
|
99
|
+
}
|
|
100
|
+
declare function useZonePrimitiveContext(): ZoneContextValue;
|
|
101
|
+
declare function useOptionalZonePrimitiveContext(): ZoneContextValue | null;
|
|
102
|
+
declare function useZoneCardContext(): ZoneCardContextValue | null;
|
|
103
|
+
declare function useZonePileContext(): ZonePileContextValue;
|
|
104
|
+
interface ZoneRootProps<Zone extends string = ZoneKey> extends PrimitiveCommonProps, HTMLAttributes<HTMLElement> {
|
|
105
|
+
zone: Zone;
|
|
106
|
+
}
|
|
107
|
+
declare function ZoneRoot<Zone extends string = ZoneKey>({ zone, children, ...props }: ZoneRootProps<Zone>): react_jsx_runtime.JSX.Element;
|
|
108
|
+
interface ZoneListProps extends Omit<PrimitiveCommonProps, "children">, Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
109
|
+
children?: ReactNode | ((card: ZoneCardRenderItem) => ReactNode);
|
|
110
|
+
empty?: ReactNode;
|
|
111
|
+
sort?: (a: ZoneCardRenderItem, b: ZoneCardRenderItem) => number;
|
|
112
|
+
}
|
|
113
|
+
declare function ZoneList({ children, empty, sort, ...props }: ZoneListProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
114
|
+
interface UseZoneCardsOptions {
|
|
115
|
+
sort?: (a: ZoneCardRenderItem, b: ZoneCardRenderItem) => number;
|
|
116
|
+
}
|
|
117
|
+
interface UseZoneCardsResult {
|
|
118
|
+
zone: string;
|
|
119
|
+
items: readonly ZoneCardRenderItem[];
|
|
120
|
+
count: number;
|
|
121
|
+
isEmpty: boolean;
|
|
122
|
+
}
|
|
123
|
+
declare function useZoneCards({ sort, }?: UseZoneCardsOptions): UseZoneCardsResult;
|
|
124
|
+
interface ZoneItemProps extends PrimitiveCommonProps, HTMLAttributes<HTMLElement> {
|
|
125
|
+
card: string | ZoneCardRenderItem;
|
|
126
|
+
}
|
|
127
|
+
declare function ZoneItem({ card, children, ...props }: ZoneItemProps): react_jsx_runtime.JSX.Element;
|
|
128
|
+
interface ZoneCardAtProps<Zone extends string = ZoneKey> extends Omit<ZoneItemProps, "card" | "children"> {
|
|
129
|
+
zone?: Zone;
|
|
130
|
+
index: number;
|
|
131
|
+
children?: ReactNode | ((card: ZoneCardRenderItem) => ReactNode);
|
|
132
|
+
empty?: ReactNode;
|
|
133
|
+
}
|
|
134
|
+
declare function ZoneCardAt<Zone extends string = ZoneKey>({ zone, ...props }: ZoneCardAtProps<Zone>): react_jsx_runtime.JSX.Element;
|
|
135
|
+
type ZoneTopCardProps<Zone extends string = ZoneKey> = Omit<ZoneCardAtProps<Zone>, "index">;
|
|
136
|
+
declare function ZoneTopCard<Zone extends string = ZoneKey>(props: ZoneTopCardProps<Zone>): react_jsx_runtime.JSX.Element;
|
|
137
|
+
type ZoneCardActionExtraInputs = Record<string, unknown> | ((cardId: string) => Record<string, unknown>);
|
|
138
|
+
interface ZoneCardActionProps<Card extends string = string> extends PrimitiveCommonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onSelect"> {
|
|
139
|
+
card?: Card;
|
|
140
|
+
interaction?: string;
|
|
141
|
+
input?: string;
|
|
142
|
+
extraInputs?: ZoneCardActionExtraInputs;
|
|
143
|
+
onSelect?: (result: ZoneCardActionResult) => void;
|
|
144
|
+
onSelectError?: (error: unknown) => void;
|
|
145
|
+
}
|
|
146
|
+
type ZoneCardActionResult = {
|
|
147
|
+
status: "none";
|
|
148
|
+
} | {
|
|
149
|
+
status: "pending";
|
|
150
|
+
interactionKey: string;
|
|
151
|
+
descriptor: InteractionDescriptor;
|
|
152
|
+
missingInputs: readonly string[];
|
|
153
|
+
} | {
|
|
154
|
+
status: "submitted";
|
|
155
|
+
interactionKey: string;
|
|
156
|
+
descriptor: InteractionDescriptor;
|
|
157
|
+
};
|
|
158
|
+
declare function ZoneCardAction<Card extends string = string>({ card, interaction, input, extraInputs, onSelect, onSelectError, disabled, onClick, children, ...props }: ZoneCardActionProps<Card>): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
159
|
+
interface ZonePileRootProps<Zone extends string = ZoneKey> extends Omit<ZoneRootProps<Zone>, "children"> {
|
|
160
|
+
label: string;
|
|
161
|
+
children?: ReactNode;
|
|
162
|
+
hiddenDescription?: string | null;
|
|
163
|
+
emptyDescription?: string | null;
|
|
164
|
+
visibleDescription?: ((count: number) => string) | null;
|
|
165
|
+
}
|
|
166
|
+
declare function ZonePileRoot<Zone extends string = ZoneKey>({ zone, label, hiddenDescription, emptyDescription, visibleDescription, children, ...props }: ZonePileRootProps<Zone>): react_jsx_runtime.JSX.Element;
|
|
167
|
+
interface ZonePileTriggerProps extends PrimitiveCommonProps, ButtonHTMLAttributes<HTMLButtonElement> {
|
|
168
|
+
}
|
|
169
|
+
declare function ZonePileTrigger({ children, ...props }: ZonePileTriggerProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
170
|
+
type ZonePileLabelProps = PrimitiveCommonProps & HTMLAttributes<HTMLElement>;
|
|
171
|
+
declare function ZonePileLabel({ children, ...props }: ZonePileLabelProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
172
|
+
type ZonePileCountProps = PrimitiveCommonProps & HTMLAttributes<HTMLElement>;
|
|
173
|
+
declare function ZonePileCount({ children, ...props }: ZonePileCountProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
174
|
+
type ZonePileDescriptionProps = PrimitiveCommonProps & HTMLAttributes<HTMLElement>;
|
|
175
|
+
declare function ZonePileDescription({ children, ...props }: ZonePileDescriptionProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
|
|
176
|
+
interface ZonePileCardsProps extends Omit<ZoneListProps, "children"> {
|
|
177
|
+
renderCard: (card: ZoneCardRenderItem) => ReactNode;
|
|
178
|
+
}
|
|
179
|
+
declare function ZonePileCards({ renderCard, ...props }: ZonePileCardsProps): react_jsx_runtime.JSX.Element | null;
|
|
180
|
+
declare function createZoneCardRenderItem(zone: string, snapshot: ZoneHandlesSnapshot | null, cardId: string, index: number): ZoneCardRenderItem;
|
|
181
|
+
declare const Zone: {
|
|
182
|
+
Root: typeof ZoneRoot;
|
|
183
|
+
List: typeof ZoneList;
|
|
184
|
+
Item: typeof ZoneItem;
|
|
185
|
+
CardAt: typeof ZoneCardAt;
|
|
186
|
+
TopCard: typeof ZoneTopCard;
|
|
187
|
+
CardAction: typeof ZoneCardAction;
|
|
188
|
+
PileRoot: typeof ZonePileRoot;
|
|
189
|
+
PileTrigger: typeof ZonePileTrigger;
|
|
190
|
+
PileLabel: typeof ZonePileLabel;
|
|
191
|
+
PileCount: typeof ZonePileCount;
|
|
192
|
+
PileDescription: typeof ZonePileDescription;
|
|
193
|
+
PileCards: typeof ZonePileCards;
|
|
194
|
+
useZoneCards: typeof useZoneCards;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
type BoardTargetKind = "edge" | "vertex" | "space" | "tile";
|
|
198
|
+
|
|
199
|
+
interface InteractiveTargetState {
|
|
200
|
+
kind?: BoardTargetKind;
|
|
201
|
+
id: string;
|
|
202
|
+
eligible: boolean;
|
|
203
|
+
selectable: boolean;
|
|
204
|
+
hovered: boolean;
|
|
205
|
+
interactionKey?: string;
|
|
206
|
+
interactionId?: string;
|
|
207
|
+
inputKey?: string;
|
|
208
|
+
pending: boolean;
|
|
209
|
+
conflict: boolean;
|
|
210
|
+
conflictInteractionKeys?: readonly string[];
|
|
211
|
+
unavailableReason?: string;
|
|
212
|
+
select?: () => unknown | Promise<unknown>;
|
|
213
|
+
}
|
|
214
|
+
interface InteractiveTargetLayer {
|
|
215
|
+
enabled?: boolean;
|
|
216
|
+
eligible?: ReadonlySet<string>;
|
|
217
|
+
selectTargetId?: (targetId: string) => unknown | Promise<unknown>;
|
|
218
|
+
targetState?: (targetId: string) => Partial<InteractiveTargetState>;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
type BoardEligibleTargets = Readonly<Record<BoardTargetKind, ReadonlySet<string>>>;
|
|
222
|
+
interface BoardTargetLayerOptions {
|
|
223
|
+
enabled?: boolean;
|
|
224
|
+
interactionKeys?: readonly string[];
|
|
225
|
+
extraInputs?: Record<string, unknown> | ((targetId: string) => Record<string, unknown>);
|
|
226
|
+
onBeforeSelect?: () => void;
|
|
227
|
+
onError?: (error: unknown) => void;
|
|
228
|
+
}
|
|
229
|
+
type BoardTargetLayerFactory = (options?: BoardTargetLayerOptions) => InteractiveTargetLayer;
|
|
230
|
+
type BoardSelectionResult<I extends string = string> = {
|
|
231
|
+
status: "none";
|
|
232
|
+
} | {
|
|
233
|
+
status: "pending";
|
|
234
|
+
interactionKey: I;
|
|
235
|
+
descriptor: InteractionDescriptor<I>;
|
|
236
|
+
missingInputs: readonly string[];
|
|
237
|
+
} | {
|
|
238
|
+
status: "submitted";
|
|
239
|
+
interactionKey: I;
|
|
240
|
+
descriptor: InteractionDescriptor<I>;
|
|
241
|
+
};
|
|
242
|
+
interface BoardPendingInteraction<I extends string = string> {
|
|
243
|
+
interactionKey: I;
|
|
244
|
+
descriptor: InteractionDescriptor<I>;
|
|
245
|
+
missingInputs: readonly string[];
|
|
246
|
+
clear(): void;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Opinionated board-level dispatch context. Collapses the repeated
|
|
250
|
+
* "collect every board handle, merge target domains across them,
|
|
251
|
+
* route each click into the right interaction" pattern that advanced
|
|
252
|
+
* board games (Catan-class) otherwise have to re-implement by hand.
|
|
253
|
+
*/
|
|
254
|
+
interface BoardInteractionsContext<I extends string = string> {
|
|
255
|
+
/**
|
|
256
|
+
* All board-surface interactions projected onto the controlling seat
|
|
257
|
+
* — both available and unavailable. Rendered greyed-out states can
|
|
258
|
+
* key off this even when the interaction isn't dispatchable yet.
|
|
259
|
+
*/
|
|
260
|
+
interactions: ReadonlyArray<InteractionDescriptor<I>>;
|
|
261
|
+
/**
|
|
262
|
+
* Per-target-kind eligibility sets merged across every currently-
|
|
263
|
+
* available board interaction. `eligible.vertex` answers "which
|
|
264
|
+
* vertex ids can be clicked right now?" without the caller manually
|
|
265
|
+
* unioning descriptor eligibility across handles or knowing the
|
|
266
|
+
* authored input key.
|
|
267
|
+
*/
|
|
268
|
+
eligible: BoardEligibleTargets;
|
|
269
|
+
/**
|
|
270
|
+
* True when `targetId` is eligible for at least one available
|
|
271
|
+
* interaction. Pass `kind` to scope the check to a specific
|
|
272
|
+
* board target kind.
|
|
273
|
+
*/
|
|
274
|
+
isEligible(targetId: string, kind?: BoardTargetKind): boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Target-kind dispatch. Routes by board geometry (`edge`, `vertex`,
|
|
277
|
+
* `space`, `tile`) rather than authored input-key strings.
|
|
278
|
+
*/
|
|
279
|
+
pendingInteraction: BoardPendingInteraction<I> | null;
|
|
280
|
+
select: {
|
|
281
|
+
edge(targetId: string, extraInputs?: Record<string, unknown>): Promise<BoardSelectionResult<I>>;
|
|
282
|
+
vertex(targetId: string, extraInputs?: Record<string, unknown>): Promise<BoardSelectionResult<I>>;
|
|
283
|
+
space(targetId: string, extraInputs?: Record<string, unknown>): Promise<BoardSelectionResult<I>>;
|
|
284
|
+
tile(targetId: string, extraInputs?: Record<string, unknown>): Promise<BoardSelectionResult<I>>;
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Reducer-aware target layers for board primitives. Pass these directly
|
|
288
|
+
* to grids so eligibility, dispatch, and submit error handling stay in
|
|
289
|
+
* one place instead of being re-wired per component.
|
|
290
|
+
*/
|
|
291
|
+
targetLayers: {
|
|
292
|
+
edge: BoardTargetLayerFactory;
|
|
293
|
+
vertex: BoardTargetLayerFactory;
|
|
294
|
+
space: BoardTargetLayerFactory;
|
|
295
|
+
tile: BoardTargetLayerFactory;
|
|
296
|
+
};
|
|
297
|
+
targetState(targetKind: BoardTargetKind, targetId: string, options?: Pick<BoardTargetLayerOptions, "enabled" | "interactionKeys">): InteractiveTargetState;
|
|
298
|
+
selectTarget(descriptor: InteractionDescriptor<I>, targetKind: BoardTargetKind, targetId: string, inputKey: string, extraInputs?: Record<string, unknown>): Promise<BoardSelectionResult<I>>;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
type BoardContextValue = BoardInteractionsContext;
|
|
302
|
+
declare function useBoardPrimitiveContext(): BoardContextValue;
|
|
303
|
+
interface BoardRootProps extends PrimitiveCommonProps {
|
|
304
|
+
children: ReactNode;
|
|
305
|
+
targetKinds?: readonly BoardTargetKind[];
|
|
306
|
+
}
|
|
307
|
+
declare function BoardRoot({ children, targetKinds, ...props }: BoardRootProps): react_jsx_runtime.JSX.Element;
|
|
308
|
+
interface BoardStateProps {
|
|
309
|
+
children: (board: BoardInteractionsContext) => ReactNode;
|
|
310
|
+
}
|
|
311
|
+
declare function BoardState({ children }: BoardStateProps): react_jsx_runtime.JSX.Element;
|
|
312
|
+
interface BoardHexViewProps<TBoard extends AnyHexBoardInput, TSpaceView extends {
|
|
313
|
+
id: BoardSpaceIdOf<TBoard>;
|
|
314
|
+
}> {
|
|
315
|
+
board: TBoard;
|
|
316
|
+
spaces: readonly TSpaceView[];
|
|
317
|
+
children: (view: HexBoardView<TBoard, TSpaceView>) => ReactNode;
|
|
318
|
+
}
|
|
319
|
+
declare function BoardHexView<const TBoard extends AnyHexBoardInput, const TSpaceView extends {
|
|
320
|
+
id: BoardSpaceIdOf<TBoard>;
|
|
321
|
+
}>({ board, spaces, children }: BoardHexViewProps<TBoard, TSpaceView>): react_jsx_runtime.JSX.Element;
|
|
322
|
+
interface BoardHexGridInteractions {
|
|
323
|
+
edge?: BoardTargetLayerOptions;
|
|
324
|
+
vertex?: BoardTargetLayerOptions;
|
|
325
|
+
space?: BoardTargetLayerOptions;
|
|
326
|
+
}
|
|
327
|
+
type BoardHexGridInteractionFilter = "auto" | false | {
|
|
328
|
+
edge?: readonly string[];
|
|
329
|
+
vertex?: readonly string[];
|
|
330
|
+
space?: readonly string[];
|
|
331
|
+
};
|
|
332
|
+
type BoardHexGridView<TBoard extends AnyHexBoardInput, TSpaceView extends {
|
|
333
|
+
id: BoardSpaceIdOf<TBoard>;
|
|
334
|
+
}> = HexBoardView<TBoard, TSpaceView> & AnyHexBoardInput;
|
|
335
|
+
type BoardHexGridProps<TBoard extends AnyHexBoardInput, TSpaceView extends {
|
|
336
|
+
id: BoardSpaceIdOf<TBoard>;
|
|
337
|
+
}> = Omit<HexGridBoardProps<BoardHexGridView<TBoard, TSpaceView>>, "board" | "interactiveEdges" | "interactiveVertices" | "interactiveSpaces"> & Omit<BoardHexViewProps<TBoard, TSpaceView>, "children"> & {
|
|
338
|
+
interactions?: BoardHexGridInteractionFilter;
|
|
339
|
+
};
|
|
340
|
+
declare function BoardHexGrid<const TBoard extends AnyHexBoardInput, const TSpaceView extends {
|
|
341
|
+
id: BoardSpaceIdOf<TBoard>;
|
|
342
|
+
}>({ board, spaces, interactions, ...props }: BoardHexGridProps<TBoard, TSpaceView>): react_jsx_runtime.JSX.Element;
|
|
343
|
+
type BoardTargetExtraInputs = Record<string, unknown> | ((targetId: string) => Record<string, unknown>);
|
|
344
|
+
type BoardTargetProps<Target extends string = BoardTargetKey> = PrimitiveCommonProps & ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
345
|
+
kind: BoardTargetKind;
|
|
346
|
+
value: Target;
|
|
347
|
+
interaction?: string;
|
|
348
|
+
input?: string;
|
|
349
|
+
extraInputs?: BoardTargetExtraInputs;
|
|
350
|
+
onSelect?: (result: BoardSelectionResult) => void;
|
|
351
|
+
onSelectError?: (error: unknown) => void;
|
|
352
|
+
};
|
|
353
|
+
declare function BoardTarget<Target extends string = BoardTargetKey>({ interaction, input, ...props }: BoardTargetProps<Target>): react_jsx_runtime.JSX.Element;
|
|
354
|
+
type BoardSpaceTargetProps<Target extends string = BoardTargetKey> = Omit<BoardTargetProps<Target>, "kind">;
|
|
355
|
+
declare function BoardSpaceTarget<Target extends string = BoardTargetKey>(props: BoardSpaceTargetProps<Target>): react_jsx_runtime.JSX.Element;
|
|
356
|
+
type BoardEdgeTargetProps<Target extends string = BoardTargetKey> = Omit<BoardTargetProps<Target>, "kind">;
|
|
357
|
+
declare function BoardEdgeTarget<Target extends string = BoardTargetKey>(props: BoardEdgeTargetProps<Target>): react_jsx_runtime.JSX.Element;
|
|
358
|
+
type BoardVertexTargetProps<Target extends string = BoardTargetKey> = Omit<BoardTargetProps<Target>, "kind">;
|
|
359
|
+
declare function BoardVertexTarget<Target extends string = BoardTargetKey>(props: BoardVertexTargetProps<Target>): react_jsx_runtime.JSX.Element;
|
|
360
|
+
declare const Board: {
|
|
361
|
+
Root: typeof BoardRoot;
|
|
362
|
+
State: typeof BoardState;
|
|
363
|
+
HexGrid: typeof BoardHexGrid;
|
|
364
|
+
HexView: typeof BoardHexView;
|
|
365
|
+
Target: typeof BoardTarget;
|
|
366
|
+
SpaceTarget: typeof BoardSpaceTarget;
|
|
367
|
+
EdgeTarget: typeof BoardEdgeTarget;
|
|
368
|
+
VertexTarget: typeof BoardVertexTarget;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Hook to access plugin session metadata.
|
|
373
|
+
* Returns session initialization status and IDs.
|
|
374
|
+
*
|
|
375
|
+
* @returns Plugin session state with status, sessionId, controllablePlayerIds, and controllingPlayerId
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* ```tsx
|
|
379
|
+
* function MyPluginComponent() {
|
|
380
|
+
* const { status, sessionId, controllablePlayerIds, controllingPlayerId } = usePluginSession();
|
|
381
|
+
*
|
|
382
|
+
* if (status === "loading") {
|
|
383
|
+
* return <div>Initializing...</div>;
|
|
384
|
+
* }
|
|
385
|
+
*
|
|
386
|
+
* return (
|
|
387
|
+
* <div>
|
|
388
|
+
* <p>Session: {sessionId}</p>
|
|
389
|
+
* <p>Can control: {controllablePlayerIds.join(", ")}</p>
|
|
390
|
+
* <p>Currently controlling: {controllingPlayerId}</p>
|
|
391
|
+
* </div>
|
|
392
|
+
* );
|
|
393
|
+
* }
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
declare function usePluginSession(): PluginSessionState;
|
|
397
|
+
|
|
398
|
+
type GamePlayer<PlayerIdValue extends string = PlayerId> = Omit<Player, "playerId"> & {
|
|
399
|
+
playerId: PlayerIdValue;
|
|
400
|
+
};
|
|
401
|
+
type GamePlayerEntry<PlayerIdValue extends string = PlayerId> = GamePlayer<PlayerIdValue> & {
|
|
402
|
+
index: number;
|
|
403
|
+
isActive: boolean;
|
|
404
|
+
isCurrentPlayer: boolean;
|
|
405
|
+
isControllable: boolean;
|
|
406
|
+
};
|
|
407
|
+
interface GamePlayersState<PlayerIdValue extends string = PlayerId> {
|
|
408
|
+
byId: ReadonlyMap<PlayerIdValue, GamePlayer<PlayerIdValue>>;
|
|
409
|
+
order: readonly PlayerIdValue[];
|
|
410
|
+
entries: ReadonlyArray<GamePlayerEntry<PlayerIdValue>>;
|
|
411
|
+
active: readonly PlayerIdValue[];
|
|
412
|
+
current: GamePlayer<PlayerIdValue> | null;
|
|
413
|
+
}
|
|
414
|
+
interface GameMeState<PlayerIdValue extends string = PlayerId> {
|
|
415
|
+
playerId: PlayerIdValue | null;
|
|
416
|
+
player: GamePlayer<PlayerIdValue> | null;
|
|
417
|
+
controllablePlayerIds: readonly PlayerIdValue[];
|
|
418
|
+
canAct: boolean;
|
|
419
|
+
}
|
|
420
|
+
interface GameTurnState<PlayerIdValue extends string = PlayerId, PhaseValue extends string = string> {
|
|
421
|
+
phase: PhaseValue | null;
|
|
422
|
+
stage: string | null;
|
|
423
|
+
activePlayerIds: readonly PlayerIdValue[];
|
|
424
|
+
currentPlayerId: PlayerIdValue | null;
|
|
425
|
+
order: readonly PlayerIdValue[];
|
|
426
|
+
isMine: boolean;
|
|
427
|
+
}
|
|
428
|
+
interface GameRenderState<ViewValue = unknown, PlayerIdValue extends string = PlayerId, PhaseValue extends string = string> {
|
|
429
|
+
view: ViewValue;
|
|
430
|
+
phase: PhaseValue | null;
|
|
431
|
+
stage: string | null;
|
|
432
|
+
session: ReturnType<typeof usePluginSession>;
|
|
433
|
+
me: GameMeState<PlayerIdValue>;
|
|
434
|
+
turn: GameTurnState<PlayerIdValue, PhaseValue>;
|
|
435
|
+
players: GamePlayersState<PlayerIdValue>;
|
|
436
|
+
}
|
|
437
|
+
interface GamePendingInputState {
|
|
438
|
+
key: string;
|
|
439
|
+
kind: string;
|
|
440
|
+
domain: InputDomain;
|
|
441
|
+
title: string;
|
|
442
|
+
}
|
|
443
|
+
interface GameActiveActionState<Interaction extends string = string, Params extends Record<string, unknown> = Record<string, unknown>> {
|
|
444
|
+
interaction: Interaction;
|
|
445
|
+
interactionId: string;
|
|
446
|
+
descriptor: InteractionDescriptor<Interaction>;
|
|
447
|
+
title: string;
|
|
448
|
+
draft: Readonly<Partial<Params>>;
|
|
449
|
+
values: Partial<Params>;
|
|
450
|
+
missingInputs: readonly string[];
|
|
451
|
+
readyFrontier: readonly string[];
|
|
452
|
+
pendingInput: GamePendingInputState | null;
|
|
453
|
+
}
|
|
454
|
+
interface GameChromeState<ViewValue = unknown, PlayerIdValue extends string = PlayerId, PhaseValue extends string = string, Interaction extends string = string> extends GameRenderState<ViewValue, PlayerIdValue, PhaseValue> {
|
|
455
|
+
activePlayers: readonly PlayerIdValue[];
|
|
456
|
+
activeAction: GameActiveActionState<Interaction> | null;
|
|
457
|
+
cancel: (() => void) | null;
|
|
458
|
+
}
|
|
459
|
+
interface GameRootProps<ViewValue = unknown, PlayerIdValue extends string = PlayerId, PhaseValue extends string = string> {
|
|
460
|
+
onActionError?: (error: unknown) => void;
|
|
461
|
+
children: (state: GameRenderState<ViewValue, PlayerIdValue, PhaseValue>) => ReactNode;
|
|
462
|
+
}
|
|
463
|
+
interface GameChromeProps<ViewValue = unknown, PlayerIdValue extends string = PlayerId, PhaseValue extends string = string, Interaction extends string = string> {
|
|
464
|
+
children: (state: GameChromeState<ViewValue, PlayerIdValue, PhaseValue, Interaction>) => ReactNode;
|
|
465
|
+
}
|
|
466
|
+
type GameActionErrorHandler = (error: unknown) => void;
|
|
467
|
+
declare function useGameActionError(): GameActionErrorHandler | null;
|
|
468
|
+
declare function GameRoot<ViewValue = unknown, PlayerIdValue extends string = PlayerId, PhaseValue extends string = string>({ children, onActionError, }: GameRootProps<ViewValue, PlayerIdValue, PhaseValue>): react_jsx_runtime.JSX.Element;
|
|
469
|
+
declare function GameChrome<ViewValue = unknown, PlayerIdValue extends string = PlayerId, PhaseValue extends string = string, Interaction extends string = string>({ children, }: GameChromeProps<ViewValue, PlayerIdValue, PhaseValue, Interaction>): react_jsx_runtime.JSX.Element;
|
|
470
|
+
declare const Game: {
|
|
471
|
+
Root: typeof GameRoot;
|
|
472
|
+
Chrome: typeof GameChrome;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Anything that can be used as a submit params object. Subset of TS
|
|
477
|
+
* objects so generic defaults and `keyof Params & string` hold.
|
|
478
|
+
*/
|
|
479
|
+
type InteractionParamsShape = Record<string, unknown>;
|
|
480
|
+
type InteractionHandleStatus = "open" | "submitting" | "submitted";
|
|
481
|
+
type DraftValidation<Params extends InteractionParamsShape = InteractionParamsShape> = {
|
|
482
|
+
ok: true;
|
|
483
|
+
params: Params;
|
|
484
|
+
fieldErrors: Partial<Record<keyof Params & string, readonly string[]>>;
|
|
485
|
+
formErrors: readonly string[];
|
|
486
|
+
missing: ReadonlyArray<keyof Params & string>;
|
|
487
|
+
} | {
|
|
488
|
+
ok: false;
|
|
489
|
+
fieldErrors: Partial<Record<keyof Params & string, readonly string[]>>;
|
|
490
|
+
formErrors: readonly string[];
|
|
491
|
+
missing: ReadonlyArray<keyof Params & string>;
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* Bound handle around an {@link InteractionDescriptor}. Surfaces call into
|
|
495
|
+
* this hook to submit/validate an interaction, track draft input state for
|
|
496
|
+
* multi-step prompts, and arm/disarm themselves on a surface.
|
|
497
|
+
*
|
|
498
|
+
* Availability flags are mirrored from the authoritative descriptor; UI
|
|
499
|
+
* MUST NOT recompute eligibility locally.
|
|
500
|
+
*
|
|
501
|
+
* When the surrounding workspace knows the concrete params shape (e.g.
|
|
502
|
+
* obtained from the generated `InteractionParamsOf<Id>` alias), parameterise
|
|
503
|
+
* this handle on `Params` so `submit`, `draft`, and `setInput` are all
|
|
504
|
+
* statically typed. The default `Record<string, unknown>` preserves the
|
|
505
|
+
* loosely-typed fallback for generic infrastructure.
|
|
506
|
+
*/
|
|
507
|
+
interface InteractionHandle<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never> {
|
|
508
|
+
descriptor: InteractionDescriptor;
|
|
509
|
+
/** Draft commit policy projected by the reducer. */
|
|
510
|
+
commit: InteractionDescriptor["commit"];
|
|
511
|
+
/**
|
|
512
|
+
* Submit the interaction. When `params` is omitted the current draft (as
|
|
513
|
+
* mutated by {@link InteractionHandle.setInput}) is used instead, which is
|
|
514
|
+
* the common case for multi-input prompts.
|
|
515
|
+
*/
|
|
516
|
+
submit: (params?: Params) => Promise<void>;
|
|
517
|
+
/** Run server validation using `params` (or the current draft by default). */
|
|
518
|
+
validate: (params?: Params) => Promise<void>;
|
|
519
|
+
/** Run local generated client-schema validation against the current draft. */
|
|
520
|
+
validateDraft: () => DraftValidation<Params>;
|
|
521
|
+
/** Run server validation against the current draft. */
|
|
522
|
+
validateDraftServer: () => Promise<void>;
|
|
523
|
+
/**
|
|
524
|
+
* Validate the current draft locally, submit parsed params, then clear the
|
|
525
|
+
* draft only when submission succeeds.
|
|
526
|
+
*/
|
|
527
|
+
submitDraft: () => Promise<void>;
|
|
528
|
+
/** Derived from `descriptor.availability`. */
|
|
529
|
+
available: boolean;
|
|
530
|
+
/** Derived from `descriptor.availability`. */
|
|
531
|
+
unavailableReason?: string;
|
|
532
|
+
/** Local/authoritative progress for this interaction. */
|
|
533
|
+
status: InteractionHandleStatus;
|
|
534
|
+
/** Live draft values for this interaction. Empty object when unset. */
|
|
535
|
+
draft: Readonly<Partial<Params>>;
|
|
536
|
+
/**
|
|
537
|
+
* Draft values with authored input defaults applied. Fields with declared
|
|
538
|
+
* defaults are typed as present; other draft fields remain partial.
|
|
539
|
+
*/
|
|
540
|
+
values: Readonly<Partial<Params> & Pick<Params, DefaultedKeys>>;
|
|
541
|
+
/** Set a single input on the draft. */
|
|
542
|
+
setInput: <K extends keyof Params & string>(key: K, value: Params[K]) => void;
|
|
543
|
+
/** Clear a single input (or the whole draft when `key` is omitted). */
|
|
544
|
+
clearInput: (key?: keyof Params & string) => void;
|
|
545
|
+
/**
|
|
546
|
+
* True when every key declared on `descriptor.inputs` has a value in
|
|
547
|
+
* the draft. Falls back to `true` when the descriptor declares no inputs.
|
|
548
|
+
*/
|
|
549
|
+
isReady: boolean;
|
|
550
|
+
/**
|
|
551
|
+
* True when this interaction is the currently armed one on its surface.
|
|
552
|
+
* Armed interactions are the ones that board primitives use
|
|
553
|
+
* to highlight eligible targets and route clicks.
|
|
554
|
+
*/
|
|
555
|
+
isArmed: boolean;
|
|
556
|
+
/** Arm this interaction on its surface (disarms any previously armed). */
|
|
557
|
+
arm: () => void;
|
|
558
|
+
/** Disarm this interaction (if it was armed). */
|
|
559
|
+
disarm: () => void;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Bind an {@link InteractionDescriptor} to submit/validate helpers plus
|
|
563
|
+
* draft + arming state. Use this from any surface; draft state is shared
|
|
564
|
+
* across components through {@link InteractionUiProvider}, which
|
|
565
|
+
* `PluginRuntime` auto-mounts.
|
|
566
|
+
*
|
|
567
|
+
* Example:
|
|
568
|
+
* ```tsx
|
|
569
|
+
* const handle = useInteractionHandle(placeThing);
|
|
570
|
+
* handle.setInput("cardId", card.id);
|
|
571
|
+
* handle.setInput("ringId", ring.id);
|
|
572
|
+
* if (handle.isReady) await handle.submit();
|
|
573
|
+
* ```
|
|
574
|
+
*/
|
|
575
|
+
declare function useInteractionHandle<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never>(descriptor: InteractionDescriptor): InteractionHandle<Params, DefaultedKeys>;
|
|
576
|
+
|
|
577
|
+
interface InteractionFieldRenderProps<Params extends InteractionParamsShape = InteractionParamsShape, Key extends keyof Params & string = keyof Params & string> {
|
|
578
|
+
descriptor: InteractionDescriptor;
|
|
579
|
+
input: InteractionInputDescriptor & {
|
|
580
|
+
key: Key;
|
|
581
|
+
};
|
|
582
|
+
handle: InteractionHandle<Params>;
|
|
583
|
+
value: Params[Key] | undefined;
|
|
584
|
+
setValue: (value: Params[Key]) => void;
|
|
585
|
+
clearValue: () => void;
|
|
586
|
+
errors: readonly string[];
|
|
587
|
+
missing: boolean;
|
|
588
|
+
disabled: boolean;
|
|
589
|
+
}
|
|
590
|
+
type InteractionFieldRenderMap<Params extends InteractionParamsShape = InteractionParamsShape> = Partial<{
|
|
591
|
+
[K in keyof Params & string]: (props: InteractionFieldRenderProps<Params, K>) => ReactNode;
|
|
592
|
+
}>;
|
|
593
|
+
interface InteractionSlotComponentProps {
|
|
594
|
+
children?: ReactNode;
|
|
595
|
+
}
|
|
596
|
+
type InteractionButtonSlotProps = InteractionSlotComponentProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "disabled" | "type" | "value">;
|
|
597
|
+
interface InteractionTargetSlotProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "disabled" | "aria-disabled" | "aria-pressed" | "onClick" | "type" | "value"> {
|
|
598
|
+
value: string;
|
|
599
|
+
children?: ReactNode;
|
|
600
|
+
}
|
|
601
|
+
interface InteractionOptionsSlotProps {
|
|
602
|
+
children: (option: {
|
|
603
|
+
value: string | null;
|
|
604
|
+
label: string;
|
|
605
|
+
}) => ReactNode;
|
|
606
|
+
}
|
|
607
|
+
interface InteractionCardsSlotProps {
|
|
608
|
+
children: (card: {
|
|
609
|
+
id: string;
|
|
610
|
+
}) => ReactNode;
|
|
611
|
+
}
|
|
612
|
+
interface InteractionValueSlotProps {
|
|
613
|
+
children: (value: unknown) => ReactNode;
|
|
614
|
+
}
|
|
615
|
+
interface InteractionInputSlot {
|
|
616
|
+
Field: (props: InteractionSlotComponentProps) => ReactNode;
|
|
617
|
+
Default: (props: InteractionSlotComponentProps) => ReactNode;
|
|
618
|
+
Target: (props: InteractionTargetSlotProps) => ReactNode;
|
|
619
|
+
Card: (props: InteractionTargetSlotProps) => ReactNode;
|
|
620
|
+
Cards: (props: InteractionCardsSlotProps) => ReactNode;
|
|
621
|
+
Options: (props: InteractionOptionsSlotProps) => ReactNode;
|
|
622
|
+
Value: (props: InteractionValueSlotProps) => ReactNode;
|
|
623
|
+
Label: (props: InteractionSlotComponentProps) => ReactNode;
|
|
624
|
+
Message: (props: InteractionSlotComponentProps) => ReactNode;
|
|
625
|
+
}
|
|
626
|
+
type InteractionInputRenderMap = Record<string, (slot: InteractionInputSlot) => ReactNode>;
|
|
627
|
+
interface InteractionSubmitSlot {
|
|
628
|
+
Button: (props: InteractionButtonSlotProps) => ReactNode;
|
|
629
|
+
}
|
|
630
|
+
interface InteractionFieldProps<Params extends InteractionParamsShape = InteractionParamsShape, Key extends keyof Params & string = keyof Params & string> {
|
|
631
|
+
descriptor: InteractionDescriptor;
|
|
632
|
+
inputKey: Key;
|
|
633
|
+
handle: InteractionHandle<Params>;
|
|
634
|
+
errors?: readonly string[];
|
|
635
|
+
missing?: boolean;
|
|
636
|
+
disabled?: boolean;
|
|
637
|
+
render?: InteractionFieldRenderMap<Params>[Key];
|
|
638
|
+
}
|
|
639
|
+
interface InteractionFormProps<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never> {
|
|
640
|
+
descriptor: InteractionDescriptor;
|
|
641
|
+
handle: InteractionHandle<Params, DefaultedKeys>;
|
|
642
|
+
fields?: ReadonlyArray<keyof Params & string>;
|
|
643
|
+
hiddenFields?: ReadonlyArray<keyof Params & string>;
|
|
644
|
+
renderFields?: InteractionFieldRenderMap<Params>;
|
|
645
|
+
inputs?: InteractionInputRenderMap;
|
|
646
|
+
submit?: (slot: InteractionSubmitSlot, descriptor: InteractionDescriptor) => ReactNode;
|
|
647
|
+
title?: ReactNode;
|
|
648
|
+
description?: ReactNode;
|
|
649
|
+
submitLabel?: ReactNode;
|
|
650
|
+
cancelLabel?: ReactNode;
|
|
651
|
+
onCancel?: () => void;
|
|
652
|
+
onSubmitSuccess?: () => void;
|
|
653
|
+
disabled?: boolean;
|
|
654
|
+
accordion?: boolean;
|
|
655
|
+
defaultOpen?: boolean;
|
|
656
|
+
style?: CSSProperties;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
type BoundInteractionFormProps<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never> = Omit<InteractionFormProps<Params, DefaultedKeys>, "descriptor" | "handle">;
|
|
660
|
+
|
|
661
|
+
interface InteractionSubmitCallbacks {
|
|
662
|
+
onSubmitSuccess?: () => void;
|
|
663
|
+
onSubmitError?: (error: unknown) => void;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
type DialogLifecycleState = "open" | "minimized" | "dismissed";
|
|
667
|
+
|
|
668
|
+
interface InteractionContextValue {
|
|
669
|
+
interaction: string;
|
|
670
|
+
descriptor: InteractionDescriptor | null;
|
|
671
|
+
handle: ReturnType<typeof useInteractionHandle> | null;
|
|
672
|
+
}
|
|
673
|
+
declare function useInteractionPrimitiveContext(): InteractionContextValue;
|
|
674
|
+
/**
|
|
675
|
+
* Live draft value for the active interaction's card-target input, resolved
|
|
676
|
+
* from the surrounding `<Interaction.Root>`. Returns the selected card-id array
|
|
677
|
+
* for `selection: "many"` inputs and the single id for `selection: "one"`.
|
|
678
|
+
* Returns `undefined` when there is no interaction context or no card-target
|
|
679
|
+
* input (so it is safe to render outside a root). Reactive: `handle.values`
|
|
680
|
+
* updates as the draft changes. Backs the card surface `slot.card.Value`.
|
|
681
|
+
*/
|
|
682
|
+
declare function useResolvedCardTargetValue(): unknown;
|
|
683
|
+
interface InteractionRootProps<Interaction extends string = InteractionKey> {
|
|
684
|
+
interaction: Interaction;
|
|
685
|
+
children: ReactNode;
|
|
686
|
+
unavailable?: "render" | "hide";
|
|
687
|
+
}
|
|
688
|
+
declare function InteractionRoot<Interaction extends string = InteractionKey>({ interaction, children, unavailable, }: InteractionRootProps<Interaction>): react_jsx_runtime.JSX.Element | null;
|
|
689
|
+
type InteractionDialogState = DialogLifecycleState;
|
|
690
|
+
interface InteractionDialogRenderState<Interaction extends string = InteractionKey> {
|
|
691
|
+
interaction: Interaction;
|
|
692
|
+
state: InteractionDialogState;
|
|
693
|
+
open: boolean;
|
|
694
|
+
minimized: boolean;
|
|
695
|
+
dismissed: boolean;
|
|
696
|
+
setOpen: (open: boolean) => void;
|
|
697
|
+
restore: () => void;
|
|
698
|
+
minimize: () => void;
|
|
699
|
+
dismiss: () => void;
|
|
700
|
+
}
|
|
701
|
+
interface InteractionDialogProps<Interaction extends string = InteractionKey> {
|
|
702
|
+
defaultOpen?: boolean;
|
|
703
|
+
onStateChange?: (state: InteractionDialogState) => void;
|
|
704
|
+
children: (state: InteractionDialogRenderState<Interaction>) => ReactNode;
|
|
705
|
+
}
|
|
706
|
+
declare function InteractionDialog<Interaction extends string = InteractionKey>({ defaultOpen, onStateChange, children, }: InteractionDialogProps<Interaction>): react_jsx_runtime.JSX.Element;
|
|
707
|
+
interface InteractionSwitchRenderState<Interaction extends string = InteractionKey> {
|
|
708
|
+
interaction: Interaction;
|
|
709
|
+
descriptor: InteractionDescriptor<Interaction>;
|
|
710
|
+
}
|
|
711
|
+
type InteractionSwitchRouteMap<Interaction extends string = InteractionKey> = {
|
|
712
|
+
[Key in Interaction]?: (state: InteractionSwitchRenderState<Key>) => ReactNode;
|
|
713
|
+
};
|
|
714
|
+
interface InteractionRoute {
|
|
715
|
+
readonly collect: Record<string, unknown>;
|
|
716
|
+
}
|
|
717
|
+
type InteractionRoutesMap<Interaction extends string = InteractionKey> = {
|
|
718
|
+
[Key in Interaction]: InteractionRoute;
|
|
719
|
+
};
|
|
720
|
+
interface InteractionSwitchProps<Interaction extends string = InteractionKey> {
|
|
721
|
+
interaction?: Interaction;
|
|
722
|
+
routes: InteractionSwitchRouteMap<Interaction>;
|
|
723
|
+
fallback?: ReactNode;
|
|
724
|
+
}
|
|
725
|
+
declare function InteractionSwitch<Interaction extends string = InteractionKey>({ interaction, routes, fallback, }: InteractionSwitchProps<Interaction>): react_jsx_runtime.JSX.Element;
|
|
726
|
+
interface InteractionRoutesProps<Interaction extends string = InteractionKey> {
|
|
727
|
+
routes: InteractionRoutesMap<Interaction>;
|
|
728
|
+
fallback?: ReactNode;
|
|
729
|
+
includeUnavailable?: boolean | null;
|
|
730
|
+
}
|
|
731
|
+
declare function InteractionRoutes<Interaction extends string = InteractionKey>({ routes, fallback, includeUnavailable, }: InteractionRoutesProps<Interaction>): react_jsx_runtime.JSX.Element | null;
|
|
732
|
+
type InteractionPartProps = PrimitiveCommonProps & HTMLAttributes<HTMLElement>;
|
|
733
|
+
declare function InteractionLabel({ children, ...props }: InteractionPartProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
734
|
+
declare function InteractionDescription({ children, ...props }: InteractionPartProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
|
|
735
|
+
declare function InteractionUnavailableMessage({ children, ...props }: InteractionPartProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
|
|
736
|
+
declare function InteractionValidationMessage({ children, ...props }: InteractionPartProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
|
|
737
|
+
type InteractionTriggerProps = PrimitiveCommonProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
738
|
+
declare function InteractionTrigger({ disabled, onClick, ...props }: InteractionTriggerProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
739
|
+
interface InteractionStateSnapshot<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never> {
|
|
740
|
+
interaction: string;
|
|
741
|
+
descriptor: InteractionDescriptor;
|
|
742
|
+
handle: InteractionHandle<Params, DefaultedKeys>;
|
|
743
|
+
draft: InteractionHandle<Params, DefaultedKeys>["draft"];
|
|
744
|
+
values: InteractionHandle<Params, DefaultedKeys>["values"];
|
|
745
|
+
status: InteractionHandle<Params, DefaultedKeys>["status"];
|
|
746
|
+
available: boolean;
|
|
747
|
+
isReady: boolean;
|
|
748
|
+
isArmed: boolean;
|
|
749
|
+
inputKeys: readonly string[];
|
|
750
|
+
missingInputs: readonly string[];
|
|
751
|
+
readyFrontier: readonly string[];
|
|
752
|
+
blockedInputs: readonly string[];
|
|
753
|
+
hasInputs: boolean;
|
|
754
|
+
}
|
|
755
|
+
interface InteractionStateProps<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never> {
|
|
756
|
+
unavailable: ReactNode;
|
|
757
|
+
children: (state: InteractionStateSnapshot<Params, DefaultedKeys>) => ReactNode;
|
|
758
|
+
}
|
|
759
|
+
declare function InteractionState<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never>({ children, unavailable }: InteractionStateProps<Params, DefaultedKeys>): react_jsx_runtime.JSX.Element;
|
|
760
|
+
type InteractionFormPrimitiveProps<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never> = BoundInteractionFormProps<Params, DefaultedKeys>;
|
|
761
|
+
declare function InteractionFormPrimitive<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never>(props: InteractionFormPrimitiveProps<Params, DefaultedKeys>): react_jsx_runtime.JSX.Element | null;
|
|
762
|
+
type InteractionFieldPrimitiveProps<Params extends InteractionParamsShape = InteractionParamsShape, Input extends keyof Params & string = keyof Params & string> = Omit<InteractionFieldProps<Params, Input>, "descriptor" | "handle" | "inputKey"> & {
|
|
763
|
+
input: Input;
|
|
764
|
+
};
|
|
765
|
+
declare function InteractionFieldPrimitive<Params extends InteractionParamsShape = InteractionParamsShape, Input extends keyof Params & string = keyof Params & string>({ input, ...props }: InteractionFieldPrimitiveProps<Params, Input>): react_jsx_runtime.JSX.Element | null;
|
|
766
|
+
type InteractionSubmitProps = PrimitiveCommonProps & ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
767
|
+
params?: InteractionParamsShape | (() => InteractionParamsShape | null | undefined);
|
|
768
|
+
onSubmitSuccess?: InteractionSubmitCallbacks["onSubmitSuccess"];
|
|
769
|
+
onSubmitError?: InteractionSubmitCallbacks["onSubmitError"];
|
|
770
|
+
};
|
|
771
|
+
declare function InteractionSubmit({ disabled, onClick, params, onSubmitSuccess, onSubmitError, ...props }: InteractionSubmitProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
772
|
+
type InteractionInputProps = PrimitiveCommonProps & Omit<InputHTMLAttributes<HTMLInputElement>, "name"> & {
|
|
773
|
+
name: string;
|
|
774
|
+
parse?: (value: string) => unknown;
|
|
775
|
+
};
|
|
776
|
+
declare function InteractionInput({ name, parse, onChange, disabled, ...props }: InteractionInputProps): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
777
|
+
type InteractionCardInputProps<Input extends string = InteractionInputKey> = PrimitiveCommonProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> & {
|
|
778
|
+
input: Input;
|
|
779
|
+
unsafeCardId?: string;
|
|
780
|
+
selected?: boolean;
|
|
781
|
+
onSelectedChange?: (selected: boolean) => void;
|
|
782
|
+
children?: ReactNode | ((state: InteractionCardInputRenderState) => ReactNode);
|
|
783
|
+
};
|
|
784
|
+
interface InteractionCardInputRenderState {
|
|
785
|
+
cardId: string | undefined;
|
|
786
|
+
zone: string | undefined;
|
|
787
|
+
selected: boolean;
|
|
788
|
+
disabled: boolean;
|
|
789
|
+
eligible: boolean;
|
|
790
|
+
targetValid: boolean;
|
|
791
|
+
selectable: boolean;
|
|
792
|
+
cardAvailable: boolean;
|
|
793
|
+
invalid: boolean;
|
|
794
|
+
}
|
|
795
|
+
declare function InteractionCardInput<Input extends string = InteractionInputKey>({ input, unsafeCardId, selected, onSelectedChange, onClick, disabled, children, ...props }: InteractionCardInputProps<Input>): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
796
|
+
declare const Interaction: {
|
|
797
|
+
Root: typeof InteractionRoot;
|
|
798
|
+
State: typeof InteractionState;
|
|
799
|
+
Switch: typeof InteractionSwitch;
|
|
800
|
+
Routes: typeof InteractionRoutes;
|
|
801
|
+
Dialog: typeof InteractionDialog;
|
|
802
|
+
Trigger: typeof InteractionTrigger;
|
|
803
|
+
Label: typeof InteractionLabel;
|
|
804
|
+
Description: typeof InteractionDescription;
|
|
805
|
+
UnavailableMessage: typeof InteractionUnavailableMessage;
|
|
806
|
+
ValidationMessage: typeof InteractionValidationMessage;
|
|
807
|
+
Input: typeof InteractionInput;
|
|
808
|
+
Field: typeof InteractionFieldPrimitive;
|
|
809
|
+
CardInput: typeof InteractionCardInput;
|
|
810
|
+
Form: typeof InteractionFormPrimitive;
|
|
811
|
+
Submit: typeof InteractionSubmit;
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
type PhaseRouteMap<Phase extends string = PhaseKey> = {
|
|
815
|
+
readonly [Key in Phase]: () => ReactNode;
|
|
816
|
+
};
|
|
817
|
+
type PhaseFallback = ReactNode | ((phase: string | null) => ReactNode);
|
|
818
|
+
interface PhaseSwitchProps<Phase extends string = PhaseKey> {
|
|
819
|
+
routes: PhaseRouteMap<Phase>;
|
|
820
|
+
fallback?: PhaseFallback;
|
|
821
|
+
}
|
|
822
|
+
declare function PhaseSwitch<Phase extends string = PhaseKey>({ routes, fallback, }: PhaseSwitchProps<Phase>): ReactElement | null;
|
|
823
|
+
declare const Phase: {
|
|
824
|
+
Switch: typeof PhaseSwitch;
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
interface PlayerRosterBadge {
|
|
828
|
+
key: string;
|
|
829
|
+
label?: ReactNode;
|
|
830
|
+
icon?: ReactNode;
|
|
831
|
+
tooltip?: string;
|
|
832
|
+
}
|
|
833
|
+
interface PlayerRosterEntry {
|
|
834
|
+
playerId: PlayerId;
|
|
835
|
+
name: string;
|
|
836
|
+
color?: HexColor;
|
|
837
|
+
index: number;
|
|
838
|
+
isActive: boolean;
|
|
839
|
+
isCurrentPlayer: boolean;
|
|
840
|
+
isControllable: boolean;
|
|
841
|
+
canSwitchToPlayer: boolean;
|
|
842
|
+
score?: number;
|
|
843
|
+
scoreLabel?: string;
|
|
844
|
+
badges: readonly PlayerRosterBadge[];
|
|
845
|
+
metadata?: Record<string, unknown>;
|
|
846
|
+
}
|
|
847
|
+
interface PlayerRosterRootProps {
|
|
848
|
+
children: ReactNode;
|
|
849
|
+
order?: "turn" | "self-first";
|
|
850
|
+
include?: "all" | "self" | "opponents";
|
|
851
|
+
score?: (playerId: PlayerId) => number | undefined;
|
|
852
|
+
scoreLabel?: string | ((playerId: PlayerId) => string | undefined);
|
|
853
|
+
badges?: (playerId: PlayerId) => ReadonlyArray<PlayerRosterBadge | null | false | undefined>;
|
|
854
|
+
metadata?: (playerId: PlayerId) => Record<string, unknown> | undefined;
|
|
855
|
+
}
|
|
856
|
+
declare function PlayerRosterRoot({ children, order, include, score, scoreLabel, badges, metadata, }: PlayerRosterRootProps): react_jsx_runtime.JSX.Element;
|
|
857
|
+
type PlayerRosterListProps = Omit<PrimitiveCommonProps, "children"> & Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
858
|
+
children?: (player: PlayerRosterEntry) => ReactNode;
|
|
859
|
+
};
|
|
860
|
+
declare function PlayerRosterList({ children, ...props }: PlayerRosterListProps): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
861
|
+
declare function PlayerRosterEmpty({ children }: {
|
|
862
|
+
children?: ReactNode;
|
|
863
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
864
|
+
type PlayerRosterSwitchButtonProps = Omit<PrimitiveCommonProps, "children"> & ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
865
|
+
player: PlayerRosterEntry;
|
|
866
|
+
children?: ReactNode;
|
|
867
|
+
};
|
|
868
|
+
declare function PlayerRosterSwitchButton({ player, disabled, onClick, ...props }: PlayerRosterSwitchButtonProps): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
869
|
+
type PlayerRosterPartProps = PrimitiveCommonProps & HTMLAttributes<HTMLElement> & {
|
|
870
|
+
player: PlayerRosterEntry;
|
|
871
|
+
};
|
|
872
|
+
interface PlayerRosterComponents {
|
|
873
|
+
Root(props: PlayerRosterRootProps): ReactElement | null;
|
|
874
|
+
List(props: PlayerRosterListProps): ReactElement;
|
|
875
|
+
Empty(props: {
|
|
876
|
+
children?: ReactNode;
|
|
877
|
+
}): ReactElement | null;
|
|
878
|
+
SwitchButton(props: PlayerRosterSwitchButtonProps): ReactElement;
|
|
879
|
+
Name(props: PlayerRosterPartProps): ReactElement;
|
|
880
|
+
Score(props: PlayerRosterPartProps): ReactElement | null;
|
|
881
|
+
Badges(props: PlayerRosterPartProps): ReactElement | null;
|
|
882
|
+
}
|
|
883
|
+
declare function PlayerRosterName({ player, children, ...props }: PlayerRosterPartProps): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
884
|
+
declare function PlayerRosterScore({ player, children, ...props }: PlayerRosterPartProps): ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
|
|
885
|
+
declare function PlayerRosterBadges({ player, children, ...props }: PlayerRosterPartProps): ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
|
|
886
|
+
declare const PlayerRoster: PlayerRosterComponents;
|
|
887
|
+
|
|
888
|
+
type PromptRootProps<Prompt extends string = PromptKey> = InteractionRootProps<Prompt>;
|
|
889
|
+
declare function PromptRoot<Prompt extends string = PromptKey>(props: PromptRootProps<Prompt>): react_jsx_runtime.JSX.Element;
|
|
890
|
+
declare function PromptTitle(props: InteractionPartProps): react_jsx_runtime.JSX.Element;
|
|
891
|
+
declare function PromptMessage(props: InteractionPartProps): react_jsx_runtime.JSX.Element | null;
|
|
892
|
+
type PromptOptionProps<Option extends string = PromptOptionKey> = PrimitiveCommonProps & ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
893
|
+
value: Option;
|
|
894
|
+
disableWhenUnavailable?: boolean;
|
|
895
|
+
onSubmitError?: InteractionSubmitCallbacks["onSubmitError"];
|
|
896
|
+
onSubmitSuccess?: InteractionSubmitCallbacks["onSubmitSuccess"];
|
|
897
|
+
};
|
|
898
|
+
declare function PromptOption<Option extends string = PromptOptionKey>({ value, disabled, disableWhenUnavailable, onClick, onSubmitError, onSubmitSuccess, children, ...props }: PromptOptionProps<Option>): react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
899
|
+
interface PromptOptionRenderItem {
|
|
900
|
+
id: string;
|
|
901
|
+
label?: string;
|
|
902
|
+
}
|
|
903
|
+
interface PromptOptionsProps {
|
|
904
|
+
children: (option: PromptOptionRenderItem) => ReactNode;
|
|
905
|
+
}
|
|
906
|
+
declare function PromptOptions({ children }: PromptOptionsProps): react_jsx_runtime.JSX.Element;
|
|
907
|
+
type PromptDialogState = DialogLifecycleState;
|
|
908
|
+
interface PromptDialogRenderState<Prompt extends string = PromptKey> {
|
|
909
|
+
prompt: Prompt;
|
|
910
|
+
state: PromptDialogState;
|
|
911
|
+
open: boolean;
|
|
912
|
+
minimized: boolean;
|
|
913
|
+
dismissed: boolean;
|
|
914
|
+
setOpen: (open: boolean) => void;
|
|
915
|
+
restore: () => void;
|
|
916
|
+
minimize: () => void;
|
|
917
|
+
dismiss: () => void;
|
|
918
|
+
}
|
|
919
|
+
interface PromptDialogProps<Prompt extends string = PromptKey> {
|
|
920
|
+
prompt: Prompt;
|
|
921
|
+
defaultOpen?: boolean;
|
|
922
|
+
onStateChange?: (state: PromptDialogState) => void;
|
|
923
|
+
children: (state: PromptDialogRenderState<Prompt>) => ReactNode;
|
|
924
|
+
}
|
|
925
|
+
declare function PromptDialog<Prompt extends string = PromptKey>({ prompt, defaultOpen, onStateChange, children, }: PromptDialogProps<Prompt>): react_jsx_runtime.JSX.Element;
|
|
926
|
+
declare function PromptInboxRoot({ children }: {
|
|
927
|
+
children: ReactNode;
|
|
928
|
+
}): react_jsx_runtime.JSX.Element;
|
|
929
|
+
declare function PromptInboxEmpty({ children }: {
|
|
930
|
+
children?: ReactNode;
|
|
931
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
932
|
+
interface PromptInboxItemsProps {
|
|
933
|
+
children: (prompt: InteractionDescriptor) => ReactNode;
|
|
934
|
+
}
|
|
935
|
+
declare function PromptInboxItems({ children }: PromptInboxItemsProps): react_jsx_runtime.JSX.Element;
|
|
936
|
+
declare const Prompt: {
|
|
937
|
+
Root: typeof PromptRoot;
|
|
938
|
+
Title: typeof PromptTitle;
|
|
939
|
+
Message: typeof PromptMessage;
|
|
940
|
+
Option: typeof PromptOption;
|
|
941
|
+
Options: typeof PromptOptions;
|
|
942
|
+
Dialog: typeof PromptDialog;
|
|
943
|
+
};
|
|
944
|
+
declare const PromptInbox: {
|
|
945
|
+
Root: typeof PromptInboxRoot;
|
|
946
|
+
Empty: typeof PromptInboxEmpty;
|
|
947
|
+
Items: typeof PromptInboxItems;
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
type DiceValue = number | null | undefined;
|
|
951
|
+
interface DiceState {
|
|
952
|
+
values: ReadonlyArray<number | undefined> | undefined;
|
|
953
|
+
/** Undefined if any die has not been rolled yet. */
|
|
954
|
+
sum: number | undefined;
|
|
955
|
+
diceCount: number;
|
|
956
|
+
allRolled: boolean;
|
|
957
|
+
}
|
|
958
|
+
interface DiceRootProps {
|
|
959
|
+
values?: readonly DiceValue[] | null;
|
|
960
|
+
/** Used when values are not provided. */
|
|
961
|
+
count?: number;
|
|
962
|
+
children: ReactNode;
|
|
963
|
+
}
|
|
964
|
+
interface DiceValuesProps {
|
|
965
|
+
children: (state: DiceState) => ReactNode;
|
|
966
|
+
}
|
|
967
|
+
interface DiceComponents {
|
|
968
|
+
Root(props: DiceRootProps): ReactNode;
|
|
969
|
+
Values(props: DiceValuesProps): ReactNode;
|
|
970
|
+
}
|
|
971
|
+
declare function normalizeDiceState({ values, count, }: {
|
|
972
|
+
values?: readonly DiceValue[] | null;
|
|
973
|
+
count?: number;
|
|
974
|
+
}): DiceState;
|
|
975
|
+
declare function DiceRoot({ values, count, children }: DiceRootProps): react_jsx_runtime.JSX.Element;
|
|
976
|
+
declare function useDicePrimitiveContext(): DiceState;
|
|
977
|
+
declare function DiceValues({ children }: DiceValuesProps): ReactNode;
|
|
978
|
+
declare const Dice: DiceComponents;
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Workspace-aware UI typing extension point.
|
|
982
|
+
*
|
|
983
|
+
* Generated workspaces will augment this interface with their concrete UI
|
|
984
|
+
* contract. The unregistered SDK keeps all public keys string-compatible so
|
|
985
|
+
* package-local tests and generic consumers can still import ui-sdk directly.
|
|
986
|
+
*/
|
|
987
|
+
interface DreamboardUIRegister {
|
|
988
|
+
}
|
|
989
|
+
type UIContractBucket = Record<string, unknown>;
|
|
990
|
+
interface UIContract {
|
|
991
|
+
interactions?: UIContractBucket;
|
|
992
|
+
inputs?: UIContractBucket;
|
|
993
|
+
prompts?: UIContractBucket;
|
|
994
|
+
promptOptions?: UIContractBucket;
|
|
995
|
+
players?: UIContractBucket;
|
|
996
|
+
zones?: UIContractBucket;
|
|
997
|
+
cards?: UIContractBucket;
|
|
998
|
+
phases?: UIContractBucket;
|
|
999
|
+
boardTargets?: UIContractBucket;
|
|
1000
|
+
}
|
|
1001
|
+
type RegisteredUIContract = DreamboardUIRegister extends {
|
|
1002
|
+
ui: infer Registered extends UIContract;
|
|
1003
|
+
} ? Registered : UIContract;
|
|
1004
|
+
type BucketOf<Contract extends UIContract, Key extends keyof UIContract> = NonNullable<Contract[Key]> extends UIContractBucket ? NonNullable<Contract[Key]> : UIContractBucket;
|
|
1005
|
+
type StringKeyOf<Bucket extends UIContractBucket> = Extract<keyof Bucket, string>;
|
|
1006
|
+
type StringKeysOrFallback<Bucket extends UIContractBucket> = [
|
|
1007
|
+
StringKeyOf<Bucket>
|
|
1008
|
+
] extends [never] ? string : string extends StringKeyOf<Bucket> ? string : StringKeyOf<Bucket>;
|
|
1009
|
+
type RegisteredUI = RegisteredUIContract;
|
|
1010
|
+
type InteractionKey<Contract extends UIContract = RegisteredUI> = StringKeysOrFallback<BucketOf<Contract, "interactions">>;
|
|
1011
|
+
type InteractionInputKey<Contract extends UIContract = RegisteredUI> = StringKeysOrFallback<BucketOf<Contract, "inputs">>;
|
|
1012
|
+
type PromptKey<Contract extends UIContract = RegisteredUI> = StringKeysOrFallback<BucketOf<Contract, "prompts">>;
|
|
1013
|
+
type PromptOptionKey<Contract extends UIContract = RegisteredUI> = StringKeysOrFallback<BucketOf<Contract, "promptOptions">>;
|
|
1014
|
+
type PlayerKey<Contract extends UIContract = RegisteredUI> = StringKeysOrFallback<BucketOf<Contract, "players">>;
|
|
1015
|
+
type ZoneKey<Contract extends UIContract = RegisteredUI> = StringKeysOrFallback<BucketOf<Contract, "zones">>;
|
|
1016
|
+
type CardKey<Contract extends UIContract = RegisteredUI> = StringKeysOrFallback<BucketOf<Contract, "cards">>;
|
|
1017
|
+
type PhaseKey<Contract extends UIContract = RegisteredUI> = StringKeysOrFallback<BucketOf<Contract, "phases">>;
|
|
1018
|
+
type BoardTargetKey<Contract extends UIContract = RegisteredUI> = StringKeysOrFallback<BucketOf<Contract, "boardTargets">>;
|
|
1019
|
+
type TypedZoneCardRenderItem<Contract extends UIContract> = ZoneCardRenderItem<CardKey<Contract> & string> extends infer Item ? Item extends {
|
|
1020
|
+
id: string;
|
|
1021
|
+
zone: string;
|
|
1022
|
+
} ? Omit<Item, "id" | "zone"> & {
|
|
1023
|
+
id: CardKey<Contract>;
|
|
1024
|
+
zone: ZoneKey<Contract>;
|
|
1025
|
+
} : never : never;
|
|
1026
|
+
type TypedInteraction<Contract extends UIContract> = Omit<typeof Interaction, "Root" | "CardInput" | "Dialog" | "Field" | "Form" | "Switch"> & {
|
|
1027
|
+
Root<Interaction extends InteractionKey<Contract>>(props: InteractionRootProps<Interaction>): ReactElement | null;
|
|
1028
|
+
Switch(props: Omit<InteractionSwitchProps<InteractionKey<Contract>>, "routes"> & {
|
|
1029
|
+
routes: InteractionSwitchRouteMap<InteractionKey<Contract>>;
|
|
1030
|
+
}): ReactElement;
|
|
1031
|
+
Routes(props: Omit<InteractionRoutesProps<InteractionKey<Contract>>, "routes"> & {
|
|
1032
|
+
routes: InteractionRoutesMap<InteractionKey<Contract>>;
|
|
1033
|
+
}): ReactElement;
|
|
1034
|
+
CardInput<Input extends InteractionInputKey<Contract>>(props: Omit<InteractionCardInputProps, "input" | "unsafeCardId"> & {
|
|
1035
|
+
input: Input;
|
|
1036
|
+
unsafeCardId?: CardKey<Contract>;
|
|
1037
|
+
}): ReactElement;
|
|
1038
|
+
Dialog<Interaction extends InteractionKey<Contract>>(props: InteractionDialogProps<Interaction>): ReactElement;
|
|
1039
|
+
Field<Input extends InteractionInputKey<Contract>>(props: Omit<InteractionFieldPrimitiveProps, "input"> & {
|
|
1040
|
+
input: Input;
|
|
1041
|
+
}): ReactElement | null;
|
|
1042
|
+
Form(props: InteractionFormPrimitiveProps): ReactElement | null;
|
|
1043
|
+
};
|
|
1044
|
+
type TypedPrompt<Contract extends UIContract> = Omit<typeof Prompt, "Root" | "Option" | "Options" | "Dialog"> & {
|
|
1045
|
+
Root<Prompt extends PromptKey<Contract>>(props: PromptRootProps<Prompt>): ReactElement | null;
|
|
1046
|
+
Option<Option extends PromptOptionKey<Contract>>(props: Omit<PromptOptionProps, "value"> & {
|
|
1047
|
+
value: Option;
|
|
1048
|
+
}): ReactElement;
|
|
1049
|
+
Options(props: Omit<PromptOptionsProps, "children"> & {
|
|
1050
|
+
children: (option: Omit<PromptOptionRenderItem, "id"> & {
|
|
1051
|
+
id: PromptOptionKey<Contract>;
|
|
1052
|
+
}) => ReactNode;
|
|
1053
|
+
}): ReactElement;
|
|
1054
|
+
Dialog<Prompt extends PromptKey<Contract>>(props: PromptDialogProps<Prompt>): ReactElement;
|
|
1055
|
+
};
|
|
1056
|
+
type TypedPromptInbox<Contract extends UIContract> = Omit<typeof PromptInbox, "Items"> & {
|
|
1057
|
+
Items(props: Omit<PromptInboxItemsProps, "children"> & {
|
|
1058
|
+
children: (prompt: Omit<InteractionDescriptor, "interactionKey"> & {
|
|
1059
|
+
interactionKey: PromptKey<Contract>;
|
|
1060
|
+
}) => ReactNode;
|
|
1061
|
+
}): ReactElement;
|
|
1062
|
+
};
|
|
1063
|
+
type TypedPlayerRosterEntry<Player extends string> = Omit<PlayerRosterEntry, "playerId"> & {
|
|
1064
|
+
playerId: Player;
|
|
1065
|
+
};
|
|
1066
|
+
type TypedPlayerRosterRootProps<Player extends string> = Omit<PlayerRosterRootProps, "score" | "scoreLabel" | "badges" | "metadata"> & {
|
|
1067
|
+
score?: (playerId: Player) => number | undefined;
|
|
1068
|
+
scoreLabel?: string | ((playerId: Player) => string | undefined);
|
|
1069
|
+
badges?: (playerId: Player) => ReadonlyArray<PlayerRosterBadge | null | false | undefined>;
|
|
1070
|
+
metadata?: (playerId: Player) => Record<string, unknown> | undefined;
|
|
1071
|
+
};
|
|
1072
|
+
type TypedPlayerRosterListProps<Player extends string> = Omit<PlayerRosterListProps, "children"> & {
|
|
1073
|
+
children?: (player: TypedPlayerRosterEntry<Player>) => ReactNode;
|
|
1074
|
+
};
|
|
1075
|
+
type TypedPlayerRosterPartProps<Player extends string> = Omit<PlayerRosterPartProps, "player"> & {
|
|
1076
|
+
player: TypedPlayerRosterEntry<Player>;
|
|
1077
|
+
};
|
|
1078
|
+
type TypedPlayerRosterSwitchButtonProps<Player extends string> = Omit<PlayerRosterSwitchButtonProps, "player"> & {
|
|
1079
|
+
player: TypedPlayerRosterEntry<Player>;
|
|
1080
|
+
};
|
|
1081
|
+
type TypedPlayerRoster<Contract extends UIContract> = Omit<PlayerRosterComponents, "Root" | "List" | "SwitchButton" | "Name" | "Score" | "Badges"> & {
|
|
1082
|
+
Root(props: TypedPlayerRosterRootProps<PlayerKey<Contract>>): ReactElement | null;
|
|
1083
|
+
List(props: TypedPlayerRosterListProps<PlayerKey<Contract>>): ReactElement;
|
|
1084
|
+
SwitchButton(props: TypedPlayerRosterSwitchButtonProps<PlayerKey<Contract>>): ReactElement;
|
|
1085
|
+
Name(props: TypedPlayerRosterPartProps<PlayerKey<Contract>>): ReactElement;
|
|
1086
|
+
Score(props: TypedPlayerRosterPartProps<PlayerKey<Contract>>): ReactElement | null;
|
|
1087
|
+
Badges(props: TypedPlayerRosterPartProps<PlayerKey<Contract>>): ReactElement | null;
|
|
1088
|
+
};
|
|
1089
|
+
type TypedPhase<Contract extends UIContract> = Omit<typeof Phase, "Switch"> & {
|
|
1090
|
+
Switch(props: PhaseSwitchProps<PhaseKey<Contract>>): ReactElement | null;
|
|
1091
|
+
};
|
|
1092
|
+
type TypedZone<Contract extends UIContract> = Omit<typeof Zone, "Root" | "Item" | "CardAt" | "TopCard" | "CardAction" | "List" | "PileRoot" | "PileCards"> & {
|
|
1093
|
+
Root<Zone extends ZoneKey<Contract>>(props: Omit<ZoneRootProps, "zone"> & {
|
|
1094
|
+
zone: Zone;
|
|
1095
|
+
}): ReactElement;
|
|
1096
|
+
Item<Card extends CardKey<Contract>>(props: Omit<ZoneItemProps, "card"> & {
|
|
1097
|
+
card: Card;
|
|
1098
|
+
}): ReactElement;
|
|
1099
|
+
CardAction<Card extends CardKey<Contract>>(props: Omit<ZoneCardActionProps, "card"> & {
|
|
1100
|
+
card?: Card;
|
|
1101
|
+
}): ReactElement;
|
|
1102
|
+
CardAt<Zone extends ZoneKey<Contract>>(props: Omit<ZoneCardAtProps<Zone>, "zone" | "children"> & {
|
|
1103
|
+
zone?: Zone;
|
|
1104
|
+
children?: ReactNode | ((card: TypedZoneCardRenderItem<Contract>) => ReactNode);
|
|
1105
|
+
}): ReactElement | null;
|
|
1106
|
+
TopCard<Zone extends ZoneKey<Contract>>(props: Omit<ZoneCardAtProps<Zone>, "zone" | "index" | "children"> & {
|
|
1107
|
+
zone?: Zone;
|
|
1108
|
+
children?: ReactNode | ((card: TypedZoneCardRenderItem<Contract>) => ReactNode);
|
|
1109
|
+
}): ReactElement | null;
|
|
1110
|
+
List(props: Omit<ZoneListProps, "children"> & {
|
|
1111
|
+
children?: ReactNode | ((card: TypedZoneCardRenderItem<Contract>) => ReactNode);
|
|
1112
|
+
}): ReactElement;
|
|
1113
|
+
PileRoot<Zone extends ZoneKey<Contract>>(props: Omit<ZonePileRootProps<Zone>, "zone"> & {
|
|
1114
|
+
zone: Zone;
|
|
1115
|
+
}): ReactElement;
|
|
1116
|
+
PileCards(props: Omit<ZonePileCardsProps, "renderCard"> & {
|
|
1117
|
+
renderCard: (card: TypedZoneCardRenderItem<Contract>) => ReactNode;
|
|
1118
|
+
}): ReactElement | null;
|
|
1119
|
+
};
|
|
1120
|
+
type TypedBoard<Contract extends UIContract> = Omit<typeof Board, "Target" | "SpaceTarget" | "EdgeTarget" | "VertexTarget" | "HexGrid"> & {
|
|
1121
|
+
Target<Target extends BoardTargetKey<Contract>>(props: Omit<BoardTargetProps, "value"> & {
|
|
1122
|
+
value: Target;
|
|
1123
|
+
}): ReactElement;
|
|
1124
|
+
SpaceTarget<Target extends BoardTargetKey<Contract>>(props: Omit<BoardSpaceTargetProps, "value"> & {
|
|
1125
|
+
value: Target;
|
|
1126
|
+
}): ReactElement;
|
|
1127
|
+
EdgeTarget<Target extends BoardTargetKey<Contract>>(props: Omit<BoardEdgeTargetProps, "value"> & {
|
|
1128
|
+
value: Target;
|
|
1129
|
+
}): ReactElement;
|
|
1130
|
+
VertexTarget<Target extends BoardTargetKey<Contract>>(props: Omit<BoardVertexTargetProps, "value"> & {
|
|
1131
|
+
value: Target;
|
|
1132
|
+
}): ReactElement;
|
|
1133
|
+
HexGrid<TBoard extends AnyHexBoardInput, TSpaceView extends {
|
|
1134
|
+
id: BoardSpaceIdOf<TBoard>;
|
|
1135
|
+
}>(props: Omit<BoardHexGridProps<TBoard, TSpaceView>, "interactions"> & {
|
|
1136
|
+
interactions?: Exclude<BoardHexGridInteractionFilter, object> | {
|
|
1137
|
+
edge?: ReadonlyArray<InteractionKey<Contract>>;
|
|
1138
|
+
vertex?: ReadonlyArray<InteractionKey<Contract>>;
|
|
1139
|
+
space?: ReadonlyArray<InteractionKey<Contract>>;
|
|
1140
|
+
};
|
|
1141
|
+
}): ReactElement;
|
|
1142
|
+
};
|
|
1143
|
+
type TypedGame<_Contract extends UIContract, View = unknown, Player extends string = PlayerKey<_Contract>, Phase extends string = PhaseKey<_Contract>> = Omit<typeof Game, "Root"> & {
|
|
1144
|
+
Root(props: GameRootProps<View, Player, Phase>): ReactElement;
|
|
1145
|
+
Chrome(props: GameChromeProps<View, Player, Phase, InteractionKey<_Contract>>): ReactElement;
|
|
1146
|
+
};
|
|
1147
|
+
interface DreamboardUI<Contract extends UIContract = RegisteredUI> {
|
|
1148
|
+
readonly contract: Contract;
|
|
1149
|
+
Root(props: UIRootProps): ReactElement;
|
|
1150
|
+
readonly Game: TypedGame<Contract>;
|
|
1151
|
+
readonly Interaction: TypedInteraction<Contract>;
|
|
1152
|
+
readonly Prompt: TypedPrompt<Contract>;
|
|
1153
|
+
readonly PromptInbox: TypedPromptInbox<Contract>;
|
|
1154
|
+
readonly PlayerRoster: TypedPlayerRoster<Contract>;
|
|
1155
|
+
readonly Dice: DiceComponents;
|
|
1156
|
+
readonly Phase: TypedPhase<Contract>;
|
|
1157
|
+
readonly Zone: TypedZone<Contract>;
|
|
1158
|
+
readonly Board: TypedBoard<Contract>;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
export { InteractionFormPrimitive as $, type DreamboardUI as A, Board as B, type GameActiveActionState as C, Dice as D, GameChrome as E, type GameChromeProps as F, Game as G, type GameChromeState as H, type GameMeState as I, type GamePendingInputState as J, type GamePlayer as K, type GamePlayerEntry as L, type GamePlayersState as M, type GameRenderState as N, GameRoot as O, type GameRootProps as P, type GameTurnState as Q, Interaction as R, InteractionCardInput as S, type InteractionCardInputProps as T, type InteractionCardInputRenderState as U, InteractionDescription as V, InteractionDialog as W, type InteractionDialogProps as X, type InteractionDialogRenderState as Y, type InteractionDialogState as Z, type InteractionFieldPrimitiveProps as _, BoardEdgeTarget as a, type PromptRootProps as a$, type InteractionFormPrimitiveProps as a0, InteractionInput as a1, type InteractionInputProps as a2, InteractionLabel as a3, type InteractionPartProps as a4, InteractionRoot as a5, type InteractionRootProps as a6, type InteractionRoute as a7, InteractionRoutes as a8, type InteractionRoutesMap as a9, type PlayerRosterListProps as aA, PlayerRosterName as aB, type PlayerRosterPartProps as aC, PlayerRosterRoot as aD, type PlayerRosterRootProps as aE, PlayerRosterScore as aF, PlayerRosterSwitchButton as aG, type PlayerRosterSwitchButtonProps as aH, type PrimitiveCommonProps as aI, type PrimitiveDataAttributes as aJ, Prompt as aK, PromptDialog as aL, type PromptDialogProps as aM, type PromptDialogRenderState as aN, type PromptDialogState as aO, PromptInbox as aP, PromptInboxEmpty as aQ, PromptInboxItems as aR, type PromptInboxItemsProps as aS, PromptInboxRoot as aT, PromptMessage as aU, PromptOption as aV, type PromptOptionProps as aW, type PromptOptionRenderItem as aX, PromptOptions as aY, type PromptOptionsProps as aZ, PromptRoot as a_, type InteractionRoutesProps as aa, InteractionState as ab, type InteractionStateProps as ac, type InteractionStateSnapshot as ad, InteractionSubmit as ae, type InteractionSubmitProps as af, InteractionSwitch as ag, type InteractionSwitchProps as ah, type InteractionSwitchRenderState as ai, type InteractionSwitchRouteMap as aj, InteractionTrigger as ak, type InteractionTriggerProps as al, InteractionUnavailableMessage as am, InteractionValidationMessage as an, Phase as ao, type PhaseFallback as ap, type PhaseRouteMap as aq, PhaseSwitch as ar, type PhaseSwitchProps as as, PlayerRoster as at, type PlayerRosterBadge as au, PlayerRosterBadges as av, type PlayerRosterComponents as aw, PlayerRosterEmpty as ax, type PlayerRosterEntry as ay, PlayerRosterList as az, type BoardEdgeTargetProps as b, PromptTitle as b0, type TypedGame as b1, UI as b2, type UIContract as b3, UIRoot as b4, type UIRootProps as b5, type UseZoneCardsOptions as b6, type UseZoneCardsResult as b7, Zone as b8, ZoneCardAction as b9, type ZoneTopCardProps as bA, composeEventHandlers as bB, createZoneCardRenderItem as bC, normalizeDiceState as bD, renderPrimitive as bE, useBoardPrimitiveContext as bF, useDicePrimitiveContext as bG, useGameActionError as bH, useInteractionPrimitiveContext as bI, useOptionalZonePrimitiveContext as bJ, useResolvedCardTargetValue as bK, useZoneCardContext as bL, useZoneCards as bM, useZonePileContext as bN, useZonePrimitiveContext as bO, type ZoneCardActionExtraInputs as ba, type ZoneCardActionProps as bb, type ZoneCardActionResult as bc, ZoneCardAt as bd, type ZoneCardAtProps as be, type ZoneCardRenderItem as bf, ZoneItem as bg, type ZoneItemProps as bh, ZoneList as bi, type ZoneListProps as bj, ZonePileCards as bk, type ZonePileCardsProps as bl, type ZonePileContextValue as bm, ZonePileCount as bn, type ZonePileCountProps as bo, ZonePileDescription as bp, type ZonePileDescriptionProps as bq, ZonePileLabel as br, type ZonePileLabelProps as bs, ZonePileRoot as bt, type ZonePileRootProps as bu, ZonePileTrigger as bv, type ZonePileTriggerProps as bw, ZoneRoot as bx, type ZoneRootProps as by, ZoneTopCard as bz, BoardHexGrid as c, type BoardHexGridInteractionFilter as d, type BoardHexGridInteractions as e, type BoardHexGridProps as f, BoardHexView as g, type BoardHexViewProps as h, BoardRoot as i, type BoardRootProps as j, BoardSpaceTarget as k, type BoardSpaceTargetProps as l, BoardState as m, type BoardStateProps as n, BoardTarget as o, type BoardTargetExtraInputs as p, type BoardTargetProps as q, BoardVertexTarget as r, type BoardVertexTargetProps as s, type DiceComponents as t, DiceRoot as u, type DiceRootProps as v, type DiceState as w, type DiceValue as x, DiceValues as y, type DiceValuesProps as z };
|