@dreamboard-games/ui-sdk 0.0.42 → 0.0.45
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/dist/components/ActionButton.d.ts.map +1 -1
- package/dist/components/ActionButton.js +2 -1
- package/dist/components/Card.d.ts +1 -1
- package/dist/components/Card.d.ts.map +1 -1
- package/dist/components/DiceRoller.d.ts +3 -2
- package/dist/components/DiceRoller.d.ts.map +1 -1
- package/dist/components/DiceRoller.js +4 -13
- package/dist/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/components/ErrorBoundary.js +94 -2
- package/dist/components/InteractionForm.d.ts +1 -1
- package/dist/components/InteractionForm.d.ts.map +1 -1
- package/dist/components/InteractionForm.js +29 -15
- package/dist/components/PrimaryActionButton.d.ts.map +1 -1
- package/dist/components/PrimaryActionButton.js +7 -6
- package/dist/components/ResourceCounter.d.ts +59 -25
- package/dist/components/ResourceCounter.d.ts.map +1 -1
- package/dist/components/ResourceCounter.js +106 -115
- package/dist/components/Toast.d.ts +13 -6
- package/dist/components/Toast.d.ts.map +1 -1
- package/dist/components/Toast.js +10 -5
- package/dist/components/board/HexGrid.js +6 -6
- package/dist/components/board/target-layer.d.ts +18 -2
- package/dist/components/board/target-layer.d.ts.map +1 -1
- package/dist/components/board/target-layer.js +20 -3
- package/dist/components/index.d.ts +3 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -4
- package/dist/components/surfaces/InboxSurface.d.ts.map +1 -1
- package/dist/components/surfaces/InboxSurface.js +2 -6
- package/dist/components/surfaces/PlayerCardsSurface.js +2 -2
- package/dist/components/surfaces/internal/CardZoneRoutedForm.d.ts +7 -0
- package/dist/components/surfaces/internal/CardZoneRoutedForm.d.ts.map +1 -0
- package/dist/components/surfaces/internal/CardZoneRoutedForm.js +9 -0
- package/dist/components/surfaces/internal/DefaultInteractionButton.d.ts.map +1 -1
- package/dist/components/surfaces/internal/DefaultInteractionButton.js +5 -8
- package/dist/components/surfaces/internal/useCardZoneInteractions.d.ts +2 -2
- package/dist/components/surfaces/internal/useCardZoneInteractions.d.ts.map +1 -1
- package/dist/components/surfaces/internal/useCardZoneInteractions.js +19 -43
- package/dist/context/InteractionDraftContext.d.ts +11 -2
- package/dist/context/InteractionDraftContext.d.ts.map +1 -1
- package/dist/context/InteractionDraftContext.js +41 -4
- package/dist/defaults/components.d.ts +0 -5
- package/dist/defaults/components.d.ts.map +1 -1
- package/dist/defaults/components.js +7 -11
- package/dist/hooks/useBoardInteractions.d.ts +35 -12
- package/dist/hooks/useBoardInteractions.d.ts.map +1 -1
- package/dist/hooks/useBoardInteractions.js +186 -82
- package/dist/hooks/useInteractionHandle.d.ts +1 -1
- package/dist/hooks/useInteractionHandle.d.ts.map +1 -1
- package/dist/hooks/useInteractionHandle.js +12 -27
- package/dist/index.d.ts +11 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -14
- package/dist/primitives/board.d.ts +53 -3
- package/dist/primitives/board.d.ts.map +1 -1
- package/dist/primitives/board.js +65 -41
- package/dist/primitives/dialog-lifecycle.d.ts +17 -0
- package/dist/primitives/dialog-lifecycle.d.ts.map +1 -0
- package/dist/primitives/dialog-lifecycle.js +24 -0
- package/dist/primitives/dice.d.ts +31 -0
- package/dist/primitives/dice.d.ts.map +1 -0
- package/dist/primitives/dice.js +33 -0
- package/dist/primitives/game.d.ts +55 -0
- package/dist/primitives/game.d.ts.map +1 -0
- package/dist/primitives/game.js +101 -0
- package/dist/primitives/index.d.ts +7 -4
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +7 -4
- package/dist/primitives/interaction-form-binding.d.ts +12 -0
- package/dist/primitives/interaction-form-binding.d.ts.map +1 -0
- package/dist/primitives/interaction-form-binding.js +14 -0
- package/dist/primitives/interaction-submit.d.ts +23 -0
- package/dist/primitives/interaction-submit.d.ts.map +1 -0
- package/dist/primitives/interaction-submit.js +41 -0
- package/dist/primitives/interaction.d.ts +76 -6
- package/dist/primitives/interaction.d.ts.map +1 -1
- package/dist/primitives/interaction.js +210 -26
- package/dist/primitives/player-roster.d.ts +2 -1
- package/dist/primitives/player-roster.d.ts.map +1 -1
- package/dist/primitives/prompt.d.ts +36 -11
- package/dist/primitives/prompt.d.ts.map +1 -1
- package/dist/primitives/prompt.js +29 -17
- package/dist/primitives/ui.d.ts +9 -0
- package/dist/primitives/ui.d.ts.map +1 -0
- package/dist/primitives/ui.js +7 -0
- package/dist/primitives/zone.d.ts +111 -5
- package/dist/primitives/zone.d.ts.map +1 -1
- package/dist/primitives/zone.js +349 -9
- package/dist/reducer.d.ts +2 -14
- package/dist/reducer.d.ts.map +1 -1
- package/dist/reducer.js +1 -14
- package/dist/runtime/createPluginRuntimeAPI.js +1 -1
- package/dist/types/hex-color.d.ts +7 -0
- package/dist/types/hex-color.d.ts.map +1 -0
- package/dist/types/hex-color.js +13 -0
- package/dist/types/player-state.d.ts +28 -14
- package/dist/types/player-state.d.ts.map +1 -1
- package/dist/types/plugin-state.d.ts +9 -3
- package/dist/types/plugin-state.d.ts.map +1 -1
- package/dist/ui-contract.d.ts +119 -14
- package/dist/ui-contract.d.ts.map +1 -1
- package/dist/ui-contract.js +4 -3
- package/dist/ui-sdk.d.ts +1637 -1245
- package/dist/utils/interaction-inputs.d.ts +8 -5
- package/dist/utils/interaction-inputs.d.ts.map +1 -1
- package/dist/utils/interaction-inputs.js +82 -14
- package/dist/utils/interaction-router.d.ts +31 -0
- package/dist/utils/interaction-router.d.ts.map +1 -0
- package/dist/utils/interaction-router.js +114 -0
- package/package.json +2 -2
- package/src/components/ActionButton.tsx +2 -1
- package/src/components/Card.tsx +1 -1
- package/src/components/DiceRoller.tsx +13 -22
- package/src/components/ErrorBoundary.test.tsx +19 -0
- package/src/components/ErrorBoundary.tsx +113 -24
- package/src/components/InteractionForm.test.tsx +24 -0
- package/src/components/InteractionForm.tsx +48 -23
- package/src/components/PrimaryActionButton.tsx +19 -5
- package/src/components/ResourceCounter.test.tsx +13 -13
- package/src/components/ResourceCounter.tsx +238 -244
- package/src/components/Toast.tsx +23 -10
- package/src/components/__fixtures__/ResourceCounter.fixture.tsx +70 -169
- package/src/components/board/HexGrid.tsx +6 -6
- package/src/components/board/target-layer.ts +44 -5
- package/src/components/index.ts +17 -10
- package/src/components/surfaces/InboxSurface.tsx +7 -5
- package/src/components/surfaces/PlayerCardsSurface.tsx +6 -6
- package/src/components/surfaces/internal/CardZoneRoutedForm.tsx +35 -0
- package/src/components/surfaces/internal/DefaultInteractionButton.tsx +17 -7
- package/src/components/surfaces/internal/useCardZoneInteractions.ts +25 -67
- package/src/context/InteractionDraftContext.tsx +51 -5
- package/src/defaults/components.tsx +12 -50
- package/src/defaults/defaults.test.tsx +1 -50
- package/src/hooks/useBoardInteractions.test.tsx +240 -17
- package/src/hooks/useBoardInteractions.ts +330 -105
- package/src/hooks/useInteractionHandle.ts +23 -28
- package/src/index.test.ts +60 -40
- package/src/index.ts +30 -36
- package/src/primitives/board.test.tsx +73 -0
- package/src/primitives/board.tsx +191 -40
- package/src/primitives/dialog-lifecycle.ts +58 -0
- package/src/primitives/dice.test.tsx +47 -0
- package/src/primitives/dice.tsx +79 -0
- package/src/primitives/game.test.tsx +98 -0
- package/src/primitives/game.tsx +213 -0
- package/src/primitives/index.ts +84 -0
- package/src/primitives/interaction-form-binding.tsx +56 -0
- package/src/primitives/interaction-submit.ts +90 -0
- package/src/primitives/interaction.test.tsx +396 -0
- package/src/primitives/interaction.tsx +451 -31
- package/src/primitives/player-roster.tsx +2 -1
- package/src/primitives/prompt.test.tsx +94 -3
- package/src/primitives/prompt.tsx +87 -48
- package/src/primitives/ui.test.tsx +131 -0
- package/src/primitives/ui.tsx +13 -0
- package/src/primitives/zone.test.tsx +305 -0
- package/src/primitives/zone.tsx +660 -12
- package/src/reducer.ts +7 -20
- package/src/runtime/createPluginRuntimeAPI.ts +1 -1
- package/src/types/hex-color.ts +20 -0
- package/src/types/player-state.ts +36 -18
- package/src/types/plugin-state.ts +10 -3
- package/src/ui-contract.ts +253 -21
- package/src/utils/interaction-inputs.test.ts +400 -0
- package/src/utils/interaction-inputs.ts +113 -11
- package/src/utils/interaction-router.ts +200 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { InteractionHandle, InteractionParamsShape } from "../hooks/useInteractionHandle.js";
|
|
2
|
+
type UnhandledInteractionError = "throw" | "log" | "ignore";
|
|
3
|
+
interface RunInteractionActionOptions<Result> {
|
|
4
|
+
onSuccess?: (result: Result) => void;
|
|
5
|
+
onError?: (error: unknown) => void;
|
|
6
|
+
unhandledError?: UnhandledInteractionError;
|
|
7
|
+
}
|
|
8
|
+
export interface InteractionSubmitCallbacks {
|
|
9
|
+
onSubmitSuccess?: () => void;
|
|
10
|
+
onSubmitError?: (error: unknown) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function runInteractionAction<Result>(action: () => Promise<Result>, { onSuccess, onError, unhandledError, }?: RunInteractionActionOptions<Result>): Promise<void>;
|
|
13
|
+
export declare function submitInteractionDraft<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never>(handle: InteractionHandle<Params, DefaultedKeys>, callbacks?: InteractionSubmitCallbacks, options?: {
|
|
14
|
+
unhandledError?: UnhandledInteractionError;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
export declare function submitInteraction<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never>(handle: InteractionHandle<Params, DefaultedKeys>, callbacks?: InteractionSubmitCallbacks, options?: {
|
|
17
|
+
unhandledError?: UnhandledInteractionError;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
export declare function submitInteractionParams<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never>(handle: InteractionHandle<Params, DefaultedKeys>, params: Params, callbacks?: InteractionSubmitCallbacks, options?: {
|
|
20
|
+
unhandledError?: UnhandledInteractionError;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=interaction-submit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction-submit.d.ts","sourceRoot":"","sources":["../../src/primitives/interaction-submit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,kCAAkC,CAAC;AAE1C,KAAK,yBAAyB,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE5D,UAAU,2BAA2B,CAAC,MAAM;IAC1C,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,yBAAyB,CAAC;CAC5C;AAED,MAAM,WAAW,0BAA0B;IACzC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED,wBAAsB,oBAAoB,CAAC,MAAM,EAC/C,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAC7B,EACE,SAAS,EACT,OAAO,EACP,cAAwB,GACzB,GAAE,2BAA2B,CAAC,MAAM,CAAM,GAC1C,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAgB,sBAAsB,CACpC,MAAM,SAAS,sBAAsB,GAAG,sBAAsB,EAC9D,aAAa,SAAS,MAAM,MAAM,GAAG,MAAM,GAAG,KAAK,EAEnD,MAAM,EAAE,iBAAiB,CAAC,MAAM,EAAE,aAAa,CAAC,EAChD,SAAS,GAAE,0BAA+B,EAC1C,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,yBAAyB,CAAA;CAAO,GAC3D,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,SAAS,sBAAsB,GAAG,sBAAsB,EAC9D,aAAa,SAAS,MAAM,MAAM,GAAG,MAAM,GAAG,KAAK,EAEnD,MAAM,EAAE,iBAAiB,CAAC,MAAM,EAAE,aAAa,CAAC,EAChD,SAAS,GAAE,0BAA+B,EAC1C,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,yBAAyB,CAAA;CAAO,GAC3D,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAgB,uBAAuB,CACrC,MAAM,SAAS,sBAAsB,GAAG,sBAAsB,EAC9D,aAAa,SAAS,MAAM,MAAM,GAAG,MAAM,GAAG,KAAK,EAEnD,MAAM,EAAE,iBAAiB,CAAC,MAAM,EAAE,aAAa,CAAC,EAChD,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,0BAA+B,EAC1C,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,yBAAyB,CAAA;CAAO,GAC3D,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export async function runInteractionAction(action, { onSuccess, onError, unhandledError = "throw", } = {}) {
|
|
2
|
+
try {
|
|
3
|
+
const result = await action();
|
|
4
|
+
onSuccess?.(result);
|
|
5
|
+
}
|
|
6
|
+
catch (error) {
|
|
7
|
+
if (onError) {
|
|
8
|
+
onError(error);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (unhandledError === "log") {
|
|
12
|
+
console.error(error);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (unhandledError === "ignore") {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function submitInteractionDraft(handle, callbacks = {}, options = {}) {
|
|
22
|
+
return runInteractionAction(() => handle.submitDraft(), {
|
|
23
|
+
onSuccess: callbacks.onSubmitSuccess,
|
|
24
|
+
onError: callbacks.onSubmitError,
|
|
25
|
+
unhandledError: options.unhandledError,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function submitInteraction(handle, callbacks = {}, options = {}) {
|
|
29
|
+
return runInteractionAction(() => handle.submit(), {
|
|
30
|
+
onSuccess: callbacks.onSubmitSuccess,
|
|
31
|
+
onError: callbacks.onSubmitError,
|
|
32
|
+
unhandledError: options.unhandledError,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export function submitInteractionParams(handle, params, callbacks = {}, options = {}) {
|
|
36
|
+
return runInteractionAction(() => handle.submit(params), {
|
|
37
|
+
onSuccess: callbacks.onSubmitSuccess,
|
|
38
|
+
onError: callbacks.onSubmitError,
|
|
39
|
+
unhandledError: options.unhandledError,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes, type HTMLAttributes, type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
import { useInteractionHandle } from "../hooks/useInteractionHandle.js";
|
|
2
|
+
import { useInteractionHandle, type InteractionHandle, type InteractionParamsShape } from "../hooks/useInteractionHandle.js";
|
|
3
3
|
import type { InteractionInputKey, InteractionKey } from "../ui-contract.js";
|
|
4
4
|
import type { InteractionDescriptor } from "../types/plugin-state.js";
|
|
5
5
|
import { type PrimitiveCommonProps } from "./primitive-props.js";
|
|
6
|
+
import { type BoundInteractionFormProps } from "./interaction-form-binding.js";
|
|
7
|
+
import { type InteractionFieldProps as BaseInteractionFieldProps } from "../components/InteractionForm.js";
|
|
8
|
+
import { type InteractionSubmitCallbacks } from "./interaction-submit.js";
|
|
9
|
+
import { type DialogLifecycleState } from "./dialog-lifecycle.js";
|
|
6
10
|
interface InteractionContextValue {
|
|
7
11
|
interaction: string;
|
|
8
12
|
descriptor: InteractionDescriptor | null;
|
|
@@ -15,6 +19,37 @@ export interface InteractionRootProps<Interaction extends string = InteractionKe
|
|
|
15
19
|
unavailable?: "render" | "hide";
|
|
16
20
|
}
|
|
17
21
|
export declare function InteractionRoot<Interaction extends string = InteractionKey>({ interaction, children, unavailable, }: InteractionRootProps<Interaction>): import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
+
export type InteractionDialogState = DialogLifecycleState;
|
|
23
|
+
export interface InteractionDialogRenderState<Interaction extends string = InteractionKey> {
|
|
24
|
+
interaction: Interaction;
|
|
25
|
+
state: InteractionDialogState;
|
|
26
|
+
open: boolean;
|
|
27
|
+
minimized: boolean;
|
|
28
|
+
dismissed: boolean;
|
|
29
|
+
setOpen: (open: boolean) => void;
|
|
30
|
+
restore: () => void;
|
|
31
|
+
minimize: () => void;
|
|
32
|
+
dismiss: () => void;
|
|
33
|
+
}
|
|
34
|
+
export interface InteractionDialogProps<Interaction extends string = InteractionKey> {
|
|
35
|
+
defaultOpen?: boolean;
|
|
36
|
+
onStateChange?: (state: InteractionDialogState) => void;
|
|
37
|
+
children: (state: InteractionDialogRenderState<Interaction>) => ReactNode;
|
|
38
|
+
}
|
|
39
|
+
export declare function InteractionDialog<Interaction extends string = InteractionKey>({ defaultOpen, onStateChange, children, }: InteractionDialogProps<Interaction>): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export interface InteractionSwitchRenderState<Interaction extends string = InteractionKey> {
|
|
41
|
+
interaction: Interaction;
|
|
42
|
+
descriptor: InteractionDescriptor<Interaction>;
|
|
43
|
+
}
|
|
44
|
+
export type InteractionRouteMap<Interaction extends string = InteractionKey> = {
|
|
45
|
+
[Key in Interaction]?: (state: InteractionSwitchRenderState<Key>) => ReactNode;
|
|
46
|
+
};
|
|
47
|
+
export interface InteractionSwitchProps<Interaction extends string = InteractionKey> {
|
|
48
|
+
interaction?: Interaction;
|
|
49
|
+
routes: InteractionRouteMap<Interaction>;
|
|
50
|
+
fallback?: ReactNode;
|
|
51
|
+
}
|
|
52
|
+
export declare function InteractionSwitch<Interaction extends string = InteractionKey>({ interaction, routes, fallback, }: InteractionSwitchProps<Interaction>): import("react/jsx-runtime").JSX.Element;
|
|
18
53
|
export type InteractionPartProps = PrimitiveCommonProps & HTMLAttributes<HTMLElement>;
|
|
19
54
|
export declare function InteractionLabel({ children, ...props }: InteractionPartProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
20
55
|
export declare function InteractionDescription({ children, ...props }: InteractionPartProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
|
|
@@ -22,8 +57,39 @@ export declare function InteractionUnavailableMessage({ children, ...props }: In
|
|
|
22
57
|
export declare function InteractionValidationMessage({ children, ...props }: InteractionPartProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
|
|
23
58
|
export type InteractionTriggerProps = PrimitiveCommonProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
24
59
|
export declare function InteractionTrigger({ disabled, onClick, ...props }: InteractionTriggerProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
25
|
-
export
|
|
26
|
-
|
|
60
|
+
export interface InteractionStateSnapshot<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never> {
|
|
61
|
+
interaction: string;
|
|
62
|
+
descriptor: InteractionDescriptor;
|
|
63
|
+
handle: InteractionHandle<Params, DefaultedKeys>;
|
|
64
|
+
draft: InteractionHandle<Params, DefaultedKeys>["draft"];
|
|
65
|
+
values: InteractionHandle<Params, DefaultedKeys>["values"];
|
|
66
|
+
status: InteractionHandle<Params, DefaultedKeys>["status"];
|
|
67
|
+
available: boolean;
|
|
68
|
+
isReady: boolean;
|
|
69
|
+
isArmed: boolean;
|
|
70
|
+
inputKeys: readonly string[];
|
|
71
|
+
missingInputs: readonly string[];
|
|
72
|
+
readyFrontier: readonly string[];
|
|
73
|
+
blockedInputs: readonly string[];
|
|
74
|
+
hasInputs: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface InteractionStateProps<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never> {
|
|
77
|
+
unavailable: ReactNode;
|
|
78
|
+
children: (state: InteractionStateSnapshot<Params, DefaultedKeys>) => ReactNode;
|
|
79
|
+
}
|
|
80
|
+
export declare function InteractionState<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never>({ children, unavailable }: InteractionStateProps<Params, DefaultedKeys>): import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
export type InteractionFormPrimitiveProps<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never> = BoundInteractionFormProps<Params, DefaultedKeys>;
|
|
82
|
+
export declare function InteractionFormPrimitive<Params extends InteractionParamsShape = InteractionParamsShape, DefaultedKeys extends keyof Params & string = never>(props: InteractionFormPrimitiveProps<Params, DefaultedKeys>): import("react/jsx-runtime").JSX.Element | null;
|
|
83
|
+
export type InteractionFieldPrimitiveProps<Params extends InteractionParamsShape = InteractionParamsShape, Input extends keyof Params & string = keyof Params & string> = Omit<BaseInteractionFieldProps<Params, Input>, "descriptor" | "handle" | "inputKey"> & {
|
|
84
|
+
input: Input;
|
|
85
|
+
};
|
|
86
|
+
export declare function InteractionFieldPrimitive<Params extends InteractionParamsShape = InteractionParamsShape, Input extends keyof Params & string = keyof Params & string>({ input, ...props }: InteractionFieldPrimitiveProps<Params, Input>): import("react/jsx-runtime").JSX.Element | null;
|
|
87
|
+
export type InteractionSubmitProps = PrimitiveCommonProps & ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
88
|
+
params?: InteractionParamsShape | (() => InteractionParamsShape | null | undefined);
|
|
89
|
+
onSubmitSuccess?: InteractionSubmitCallbacks["onSubmitSuccess"];
|
|
90
|
+
onSubmitError?: InteractionSubmitCallbacks["onSubmitError"];
|
|
91
|
+
};
|
|
92
|
+
export declare function InteractionSubmit({ disabled, onClick, params, onSubmitSuccess, onSubmitError, ...props }: InteractionSubmitProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
27
93
|
export type InteractionInputProps = PrimitiveCommonProps & Omit<InputHTMLAttributes<HTMLInputElement>, "name"> & {
|
|
28
94
|
name: string;
|
|
29
95
|
parse?: (value: string) => unknown;
|
|
@@ -31,21 +97,25 @@ export type InteractionInputProps = PrimitiveCommonProps & Omit<InputHTMLAttribu
|
|
|
31
97
|
export declare function InteractionInput({ name, parse, onChange, disabled, ...props }: InteractionInputProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
32
98
|
export type InteractionCardInputProps<Input extends string = InteractionInputKey> = PrimitiveCommonProps & ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
33
99
|
input: Input;
|
|
34
|
-
|
|
35
|
-
card?: string;
|
|
100
|
+
unsafeCardId?: string;
|
|
36
101
|
selected?: boolean;
|
|
37
102
|
onSelectedChange?: (selected: boolean) => void;
|
|
38
103
|
};
|
|
39
|
-
export declare function InteractionCardInput<Input extends string = InteractionInputKey>({ input,
|
|
104
|
+
export declare function InteractionCardInput<Input extends string = InteractionInputKey>({ input, unsafeCardId, selected, onSelectedChange, onClick, disabled, children, ...props }: InteractionCardInputProps<Input>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
40
105
|
export declare const Interaction: {
|
|
41
106
|
Root: typeof InteractionRoot;
|
|
107
|
+
State: typeof InteractionState;
|
|
108
|
+
Switch: typeof InteractionSwitch;
|
|
109
|
+
Dialog: typeof InteractionDialog;
|
|
42
110
|
Trigger: typeof InteractionTrigger;
|
|
43
111
|
Label: typeof InteractionLabel;
|
|
44
112
|
Description: typeof InteractionDescription;
|
|
45
113
|
UnavailableMessage: typeof InteractionUnavailableMessage;
|
|
46
114
|
ValidationMessage: typeof InteractionValidationMessage;
|
|
47
115
|
Input: typeof InteractionInput;
|
|
116
|
+
Field: typeof InteractionFieldPrimitive;
|
|
48
117
|
CardInput: typeof InteractionCardInput;
|
|
118
|
+
Form: typeof InteractionFormPrimitive;
|
|
49
119
|
Submit: typeof InteractionSubmit;
|
|
50
120
|
};
|
|
51
121
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../src/primitives/interaction.tsx"],"names":[],"mappings":"AAAA,OA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,CAAC,EAAE,MAAM,CAAC,GAAG;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;CACpC,CAAC;AAEJ,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,qBAAqB,8FAkBvB;AAED,MAAM,MAAM,yBAAyB,CACnC,KAAK,SAAS,MAAM,GAAG,mBAAmB,IACxC,oBAAoB,GACtB,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACxC,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD,CAAC;AAEJ,wBAAgB,oBAAoB,CAClC,KAAK,SAAS,MAAM,GAAG,mBAAmB,EAC1C,EACA,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,yBAAyB,CAAC,KAAK,CAAC,8FAyIlC;AAoGD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;CAevB,CAAC"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext, useMemo, } from "react";
|
|
3
|
-
import { useInteractionHandle } from "../hooks/useInteractionHandle.js";
|
|
4
|
-
import { useInteractionUiStore } from "../context/InteractionDraftContext.js";
|
|
3
|
+
import { useInteractionHandle, } from "../hooks/useInteractionHandle.js";
|
|
4
|
+
import { useInteractionUiStore, usePendingInteractionKey, } from "../context/InteractionDraftContext.js";
|
|
5
5
|
import { usePluginState } from "../context/PluginStateContext.js";
|
|
6
|
-
import { inputByKey, isManyTargetSelectable, toggleManyValue, } from "../utils/interaction-inputs.js";
|
|
6
|
+
import { hasInteractionFieldErrors, inputByKey, isManyTargetSelectable, toggleManyValue, } from "../utils/interaction-inputs.js";
|
|
7
|
+
import { applyInteractionDraftMutation, getInteractionDraftReadiness, markInteractionPending, shouldRouteInteractionPending, } from "../utils/interaction-router.js";
|
|
7
8
|
import { interactionLabel } from "../utils/interaction-labels.js";
|
|
8
9
|
import { composeEventHandlers, renderPrimitive, } from "./primitive-props.js";
|
|
9
|
-
import {
|
|
10
|
+
import { BoundInteractionForm, castInteractionDraft, castInteractionHandle, } from "./interaction-form-binding.js";
|
|
11
|
+
import { InteractionField as BaseInteractionField, } from "../components/InteractionForm.js";
|
|
12
|
+
import { submitInteractionDraft, submitInteractionParams, } from "./interaction-submit.js";
|
|
13
|
+
import { useDialogLifecycle, } from "./dialog-lifecycle.js";
|
|
14
|
+
import { useGameActionError } from "./game.js";
|
|
15
|
+
import { useOptionalZonePrimitiveContext, useZoneCardContext } from "./zone.js";
|
|
10
16
|
const InteractionContext = createContext(null);
|
|
11
17
|
function humanizeInteraction(value) {
|
|
12
18
|
const parts = value.split(".");
|
|
@@ -50,6 +56,33 @@ export function InteractionRoot({ interaction, children, unavailable = "render",
|
|
|
50
56
|
}
|
|
51
57
|
return (_jsx(ResolvedInteractionRoot, { interaction: interaction, descriptor: descriptor, children: children }));
|
|
52
58
|
}
|
|
59
|
+
export function InteractionDialog({ defaultOpen = true, onStateChange, children, }) {
|
|
60
|
+
const { interaction } = useInteractionPrimitiveContext();
|
|
61
|
+
const lifecycle = useDialogLifecycle({ defaultOpen, onStateChange });
|
|
62
|
+
const renderState = useMemo(() => ({
|
|
63
|
+
interaction: interaction,
|
|
64
|
+
...lifecycle,
|
|
65
|
+
}), [interaction, lifecycle]);
|
|
66
|
+
return _jsx(_Fragment, { children: children(renderState) });
|
|
67
|
+
}
|
|
68
|
+
export function InteractionSwitch({ interaction, routes, fallback = null, }) {
|
|
69
|
+
const pendingInteractionKey = usePendingInteractionKey();
|
|
70
|
+
const descriptors = usePluginState((state) => state.gameplay.availableInteractions);
|
|
71
|
+
const routedInteraction = interaction ?? pendingInteractionKey;
|
|
72
|
+
const descriptor = routedInteraction
|
|
73
|
+
? descriptors.find((candidate) => candidate.interactionKey === routedInteraction)
|
|
74
|
+
: undefined;
|
|
75
|
+
if (!descriptor)
|
|
76
|
+
return _jsx(_Fragment, { children: fallback });
|
|
77
|
+
const route = routes[descriptor.interactionKey] ?? null;
|
|
78
|
+
if (!route)
|
|
79
|
+
return _jsx(_Fragment, { children: fallback });
|
|
80
|
+
const typedInteraction = descriptor.interactionKey;
|
|
81
|
+
return (_jsx(InteractionRoot, { interaction: typedInteraction, children: route({
|
|
82
|
+
interaction: typedInteraction,
|
|
83
|
+
descriptor: descriptor,
|
|
84
|
+
}) }));
|
|
85
|
+
}
|
|
53
86
|
export function InteractionLabel({ children, ...props }) {
|
|
54
87
|
const { descriptor, interaction } = useInteractionPrimitiveContext();
|
|
55
88
|
return renderPrimitive("span", {
|
|
@@ -118,12 +151,53 @@ export function InteractionTrigger({ disabled, onClick, ...props }) {
|
|
|
118
151
|
}),
|
|
119
152
|
});
|
|
120
153
|
}
|
|
121
|
-
export function
|
|
154
|
+
export function InteractionState({ children, unavailable }) {
|
|
155
|
+
const { interaction, descriptor, handle } = useInteractionPrimitiveContext();
|
|
156
|
+
const store = useInteractionUiStore();
|
|
157
|
+
if (!descriptor || !handle) {
|
|
158
|
+
return _jsx(_Fragment, { children: unavailable });
|
|
159
|
+
}
|
|
160
|
+
const typedHandle = castInteractionHandle(handle);
|
|
161
|
+
const liveDraft = castInteractionDraft(store.getDraft(descriptor.interactionKey));
|
|
162
|
+
const inputKeys = descriptor.inputs.map((input) => input.key);
|
|
163
|
+
const readiness = getInteractionDraftReadiness(descriptor, liveDraft);
|
|
164
|
+
return (_jsx(_Fragment, { children: children({
|
|
165
|
+
interaction,
|
|
166
|
+
descriptor,
|
|
167
|
+
handle: typedHandle,
|
|
168
|
+
draft: liveDraft,
|
|
169
|
+
values: typedHandle.values,
|
|
170
|
+
status: typedHandle.status,
|
|
171
|
+
available: typedHandle.available,
|
|
172
|
+
isReady: readiness.ready,
|
|
173
|
+
isArmed: typedHandle.isArmed,
|
|
174
|
+
inputKeys,
|
|
175
|
+
missingInputs: readiness.missingInputs,
|
|
176
|
+
readyFrontier: readiness.readyFrontier,
|
|
177
|
+
blockedInputs: readiness.blockedInputs,
|
|
178
|
+
hasInputs: inputKeys.length > 0,
|
|
179
|
+
}) }));
|
|
180
|
+
}
|
|
181
|
+
export function InteractionFormPrimitive(props) {
|
|
182
|
+
const { descriptor, handle } = useInteractionPrimitiveContext();
|
|
183
|
+
if (!descriptor || !handle)
|
|
184
|
+
return null;
|
|
185
|
+
return (_jsx(BoundInteractionForm, { descriptor: descriptor, handle: handle, ...props }));
|
|
186
|
+
}
|
|
187
|
+
export function InteractionFieldPrimitive({ input, ...props }) {
|
|
122
188
|
const { descriptor, handle } = useInteractionPrimitiveContext();
|
|
189
|
+
if (!descriptor || !handle)
|
|
190
|
+
return null;
|
|
191
|
+
return (_jsx(BaseInteractionField, { descriptor: descriptor, handle: castInteractionHandle(handle), inputKey: input, ...props }));
|
|
192
|
+
}
|
|
193
|
+
export function InteractionSubmit({ disabled, onClick, params, onSubmitSuccess, onSubmitError, ...props }) {
|
|
194
|
+
const { descriptor, handle } = useInteractionPrimitiveContext();
|
|
195
|
+
const gameActionError = useGameActionError();
|
|
123
196
|
const isSubmitting = handle?.status === "submitting";
|
|
197
|
+
const hasExplicitParams = params !== undefined;
|
|
124
198
|
const isDisabled = disabled === true ||
|
|
125
199
|
!descriptor?.available ||
|
|
126
|
-
!handle?.isReady ||
|
|
200
|
+
(!hasExplicitParams && !handle?.isReady) ||
|
|
127
201
|
isSubmitting;
|
|
128
202
|
return renderPrimitive("button", {
|
|
129
203
|
type: "button",
|
|
@@ -136,10 +210,25 @@ export function InteractionSubmit({ disabled, onClick, ...props }) {
|
|
|
136
210
|
"data-available": descriptor?.available ?? false,
|
|
137
211
|
"data-disabled": isDisabled || undefined,
|
|
138
212
|
"data-ready": handle?.isReady ?? false,
|
|
213
|
+
"data-has-inputs": descriptor ? descriptor.inputs.length > 0 : undefined,
|
|
214
|
+
"data-input-count": descriptor?.inputs.length,
|
|
139
215
|
"data-submitting": isSubmitting || undefined,
|
|
140
216
|
"data-state": handle?.status ?? "unavailable",
|
|
141
217
|
onClick: composeEventHandlers(onClick, () => {
|
|
142
|
-
|
|
218
|
+
if (isDisabled || !handle)
|
|
219
|
+
return;
|
|
220
|
+
const resolvedParams = typeof params === "function" ? params() : params;
|
|
221
|
+
if (resolvedParams === null || resolvedParams === undefined) {
|
|
222
|
+
void submitInteractionDraft(handle, {
|
|
223
|
+
onSubmitSuccess,
|
|
224
|
+
onSubmitError: onSubmitError ?? gameActionError ?? undefined,
|
|
225
|
+
});
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
void submitInteractionParams(handle, resolvedParams, {
|
|
229
|
+
onSubmitSuccess,
|
|
230
|
+
onSubmitError: onSubmitError ?? gameActionError ?? undefined,
|
|
231
|
+
});
|
|
143
232
|
}),
|
|
144
233
|
});
|
|
145
234
|
}
|
|
@@ -162,20 +251,40 @@ export function InteractionInput({ name, parse, onChange, disabled, ...props })
|
|
|
162
251
|
}),
|
|
163
252
|
});
|
|
164
253
|
}
|
|
165
|
-
export function InteractionCardInput({ input,
|
|
254
|
+
export function InteractionCardInput({ input, unsafeCardId, selected, onSelectedChange, onClick, disabled, children, ...props }) {
|
|
166
255
|
const { descriptor, handle } = useInteractionPrimitiveContext();
|
|
167
256
|
const store = useInteractionUiStore();
|
|
168
257
|
const zoneCard = useZoneCardContext();
|
|
169
|
-
const
|
|
258
|
+
const zoneContext = useOptionalZonePrimitiveContext();
|
|
259
|
+
const cardId = zoneCard?.cardId ?? unsafeCardId;
|
|
260
|
+
const validationZone = zoneCard?.zone ?? zoneContext?.zone;
|
|
261
|
+
const zoneSnapshot = usePluginState((state) => validationZone ? state.gameplay.zones[validationZone] : undefined);
|
|
170
262
|
const cardDescriptor = usePluginState((state) => {
|
|
171
|
-
if (!cardId || !
|
|
263
|
+
if (!cardId || !validationZone)
|
|
172
264
|
return undefined;
|
|
173
|
-
return state.gameplay.zones[
|
|
265
|
+
return state.gameplay.zones[validationZone]?.playableByCardId[cardId]?.find((candidate) => candidate.interactionKey === descriptor?.interactionKey &&
|
|
174
266
|
candidate.inputs.some((candidateInput) => candidateInput.key === input));
|
|
175
267
|
});
|
|
176
268
|
const inputDescriptor = descriptor
|
|
177
269
|
? inputByKey(descriptor, input)
|
|
178
270
|
: undefined;
|
|
271
|
+
const targetInvalidReason = cardTargetInvalidReason({
|
|
272
|
+
cardDescriptor,
|
|
273
|
+
cardId,
|
|
274
|
+
inputDescriptor,
|
|
275
|
+
unsafeCardId,
|
|
276
|
+
validationZone,
|
|
277
|
+
zoneCard,
|
|
278
|
+
zoneSnapshot,
|
|
279
|
+
});
|
|
280
|
+
const isTargetValid = targetInvalidReason === undefined;
|
|
281
|
+
throwCardInputDevMismatch({
|
|
282
|
+
cardId,
|
|
283
|
+
targetInvalidReason,
|
|
284
|
+
unsafeCardId,
|
|
285
|
+
validationZone,
|
|
286
|
+
zoneCard,
|
|
287
|
+
});
|
|
179
288
|
const liveDraft = descriptor ? store.getDraft(descriptor.interactionKey) : {};
|
|
180
289
|
const currentValue = liveDraft[input] ?? handle?.draft[input] ?? handle?.values[input];
|
|
181
290
|
const selection = inputDescriptor?.domain.selection;
|
|
@@ -186,25 +295,24 @@ export function InteractionCardInput({ input, value, card, selected, onSelectedC
|
|
|
186
295
|
cardId !== undefined &&
|
|
187
296
|
String(currentValue) === String(cardId);
|
|
188
297
|
const isSelected = selected ?? selectedByDraft;
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
isCardInput &&
|
|
196
|
-
(eligibleTargets === undefined || eligibleTargets.includes(cardId));
|
|
298
|
+
const isCardAvailable = cardDescriptor?.available ??
|
|
299
|
+
(isTargetValid && (descriptor?.available ?? false));
|
|
300
|
+
const cardUnavailableReason = cardDescriptor?.unavailableReason ??
|
|
301
|
+
(!descriptor?.available
|
|
302
|
+
? (descriptor?.unavailableReason ?? "interaction-unavailable")
|
|
303
|
+
: undefined);
|
|
197
304
|
const isSelectable = cardId !== undefined &&
|
|
198
305
|
inputDescriptor !== undefined &&
|
|
199
306
|
isManyTargetSelectable(inputDescriptor, currentValue, cardId);
|
|
200
|
-
const isCandidateAvailable = cardDescriptor?.available ?? true;
|
|
201
307
|
const validation = handle?.validateDraft();
|
|
202
308
|
const fieldErrors = validation?.fieldErrors[input] ?? [];
|
|
203
309
|
const isInvalid = fieldErrors.length > 0;
|
|
204
310
|
const isDisabled = disabled === true ||
|
|
205
311
|
!descriptor?.available ||
|
|
206
312
|
!cardId ||
|
|
207
|
-
!
|
|
313
|
+
!isTargetValid ||
|
|
314
|
+
!isCardAvailable ||
|
|
315
|
+
!isSelectable ||
|
|
208
316
|
!handle;
|
|
209
317
|
return renderPrimitive("button", {
|
|
210
318
|
type: "button",
|
|
@@ -216,11 +324,14 @@ export function InteractionCardInput({ input, value, card, selected, onSelectedC
|
|
|
216
324
|
"data-dreamboard-interaction-card-input": "",
|
|
217
325
|
"data-input-name": input,
|
|
218
326
|
"data-card-id": cardId,
|
|
219
|
-
"data-zone":
|
|
327
|
+
"data-zone": validationZone,
|
|
220
328
|
"data-selected": isSelected || undefined,
|
|
221
|
-
"data-eligible":
|
|
329
|
+
"data-eligible": isTargetValid && isCardAvailable,
|
|
330
|
+
"data-target-valid": isTargetValid,
|
|
331
|
+
"data-target-invalid-reason": targetInvalidReason,
|
|
222
332
|
"data-selectable": isSelectable,
|
|
223
|
-
"data-card-available":
|
|
333
|
+
"data-card-available": isCardAvailable,
|
|
334
|
+
"data-card-unavailable-reason": cardUnavailableReason,
|
|
224
335
|
"data-invalid": isInvalid || undefined,
|
|
225
336
|
"data-disabled": isDisabled || undefined,
|
|
226
337
|
"data-missing-resource": cardId ? undefined : true,
|
|
@@ -230,21 +341,94 @@ export function InteractionCardInput({ input, value, card, selected, onSelectedC
|
|
|
230
341
|
const nextValue = selection?.mode === "many"
|
|
231
342
|
? toggleManyValue(currentValue, cardId, selection)
|
|
232
343
|
: cardId;
|
|
233
|
-
|
|
344
|
+
const nextDraft = applyInteractionDraftMutation(store, descriptor, [
|
|
345
|
+
{ key: input, value: nextValue },
|
|
346
|
+
]);
|
|
347
|
+
const readiness = getInteractionDraftReadiness(descriptor, nextDraft);
|
|
348
|
+
const hasMissingSurfaceTarget = readiness.readyFrontier.some((key) => {
|
|
349
|
+
const candidate = inputByKey(descriptor, key);
|
|
350
|
+
return (candidate?.domain.type === "target" &&
|
|
351
|
+
candidate.domain.targetKind !== "card" &&
|
|
352
|
+
candidate.domain.selection?.mode !== "many");
|
|
353
|
+
});
|
|
354
|
+
const hasMissingFormInput = readiness.readyFrontier.some((key) => {
|
|
355
|
+
const candidate = inputByKey(descriptor, key);
|
|
356
|
+
return (candidate !== undefined &&
|
|
357
|
+
(candidate.domain.type !== "target" ||
|
|
358
|
+
candidate.domain.selection?.mode === "many"));
|
|
359
|
+
});
|
|
360
|
+
const hasFieldErrors = hasInteractionFieldErrors(readiness.fieldErrors);
|
|
361
|
+
if (shouldRouteInteractionPending(descriptor, readiness)) {
|
|
362
|
+
markInteractionPending(store, descriptor);
|
|
363
|
+
store.setPendingInteraction(!hasMissingSurfaceTarget && (hasMissingFormInput || hasFieldErrors)
|
|
364
|
+
? descriptor.interactionKey
|
|
365
|
+
: null);
|
|
366
|
+
}
|
|
234
367
|
onSelectedChange?.(selection?.mode === "many"
|
|
235
368
|
? Array.isArray(nextValue) && nextValue.includes(cardId)
|
|
236
369
|
: true);
|
|
237
370
|
}),
|
|
238
371
|
});
|
|
239
372
|
}
|
|
373
|
+
function cardTargetInvalidReason({ cardDescriptor, cardId, inputDescriptor, unsafeCardId, validationZone, zoneCard, zoneSnapshot, }) {
|
|
374
|
+
if (!cardId)
|
|
375
|
+
return "missing-card";
|
|
376
|
+
if (inputDescriptor?.domain.type !== "target" ||
|
|
377
|
+
inputDescriptor.domain.targetKind !== "card") {
|
|
378
|
+
return "not-in-domain";
|
|
379
|
+
}
|
|
380
|
+
if (zoneCard && unsafeCardId && unsafeCardId !== zoneCard.cardId) {
|
|
381
|
+
return "wrong-zone";
|
|
382
|
+
}
|
|
383
|
+
if (validationZone &&
|
|
384
|
+
zoneSnapshot &&
|
|
385
|
+
!zoneSnapshot.cardIds.includes(cardId)) {
|
|
386
|
+
return "not-in-zone";
|
|
387
|
+
}
|
|
388
|
+
if (validationZone &&
|
|
389
|
+
inputDescriptor.domain.zoneIds &&
|
|
390
|
+
!inputDescriptor.domain.zoneIds.includes(validationZone)) {
|
|
391
|
+
return "wrong-zone";
|
|
392
|
+
}
|
|
393
|
+
if (validationZone && !cardDescriptor) {
|
|
394
|
+
return zoneSnapshot?.cardIds[0] !== cardId
|
|
395
|
+
? "not-top-card"
|
|
396
|
+
: "not-in-domain";
|
|
397
|
+
}
|
|
398
|
+
if (!zoneCard &&
|
|
399
|
+
inputDescriptor.domain.eligibleTargets &&
|
|
400
|
+
!inputDescriptor.domain.eligibleTargets.includes(cardId)) {
|
|
401
|
+
return "not-in-domain";
|
|
402
|
+
}
|
|
403
|
+
return undefined;
|
|
404
|
+
}
|
|
405
|
+
function throwCardInputDevMismatch({ cardId, targetInvalidReason, unsafeCardId, validationZone, zoneCard, }) {
|
|
406
|
+
if (!isDevelopmentRuntime() || !validationZone)
|
|
407
|
+
return;
|
|
408
|
+
if (zoneCard && unsafeCardId && unsafeCardId !== zoneCard.cardId) {
|
|
409
|
+
throw new Error(`Interaction.CardInput unsafeCardId '${unsafeCardId}' does not match surrounding Zone.Item card '${zoneCard.cardId}'.`);
|
|
410
|
+
}
|
|
411
|
+
if (targetInvalidReason === "not-in-zone" && cardId) {
|
|
412
|
+
throw new Error(`Interaction.CardInput card '${cardId}' is not present in surrounding zone '${validationZone}'.`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
function isDevelopmentRuntime() {
|
|
416
|
+
const processLike = globalThis.process;
|
|
417
|
+
return processLike?.env?.NODE_ENV !== "production";
|
|
418
|
+
}
|
|
240
419
|
export const Interaction = {
|
|
241
420
|
Root: InteractionRoot,
|
|
421
|
+
State: InteractionState,
|
|
422
|
+
Switch: InteractionSwitch,
|
|
423
|
+
Dialog: InteractionDialog,
|
|
242
424
|
Trigger: InteractionTrigger,
|
|
243
425
|
Label: InteractionLabel,
|
|
244
426
|
Description: InteractionDescription,
|
|
245
427
|
UnavailableMessage: InteractionUnavailableMessage,
|
|
246
428
|
ValidationMessage: InteractionValidationMessage,
|
|
247
429
|
Input: InteractionInput,
|
|
430
|
+
Field: InteractionFieldPrimitive,
|
|
248
431
|
CardInput: InteractionCardInput,
|
|
432
|
+
Form: InteractionFormPrimitive,
|
|
249
433
|
Submit: InteractionSubmit,
|
|
250
434
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes, type HTMLAttributes, type ReactElement, type ReactNode } from "react";
|
|
2
2
|
import type { PlayerId } from "@dreamboard/manifest-contract";
|
|
3
3
|
import { type PrimitiveCommonProps } from "./primitive-props.js";
|
|
4
|
+
import type { HexColor } from "../types/hex-color.js";
|
|
4
5
|
export interface PlayerRosterBadge {
|
|
5
6
|
key: string;
|
|
6
7
|
label?: ReactNode;
|
|
@@ -10,7 +11,7 @@ export interface PlayerRosterBadge {
|
|
|
10
11
|
export interface PlayerRosterEntry {
|
|
11
12
|
playerId: PlayerId;
|
|
12
13
|
name: string;
|
|
13
|
-
color?:
|
|
14
|
+
color?: HexColor;
|
|
14
15
|
index: number;
|
|
15
16
|
isActive: boolean;
|
|
16
17
|
isCurrentPlayer: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"player-roster.d.ts","sourceRoot":"","sources":["../../src/primitives/player-roster.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAM9D,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"player-roster.d.ts","sourceRoot":"","sources":["../../src/primitives/player-roster.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAM9D,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACrC,QAA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