@ankhorage/zora-tabletop 0.0.9 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +45 -1
  3. package/dist/features/game-presentations/adapters/inbound/PokerTrainingTable.d.ts +16 -0
  4. package/dist/features/game-presentations/adapters/inbound/PokerTrainingTable.d.ts.map +1 -0
  5. package/dist/features/game-presentations/adapters/inbound/PokerTrainingTable.js +20 -0
  6. package/dist/features/game-presentations/adapters/inbound/PokerTrainingTable.js.map +1 -0
  7. package/dist/features/game-presentations/adapters/inbound/createPokerTrainingTableState.d.ts +13 -0
  8. package/dist/features/game-presentations/adapters/inbound/createPokerTrainingTableState.d.ts.map +1 -0
  9. package/dist/features/game-presentations/adapters/inbound/createPokerTrainingTableState.js +98 -0
  10. package/dist/features/game-presentations/adapters/inbound/createPokerTrainingTableState.js.map +1 -0
  11. package/dist/features/game-presentations/adapters/inbound/pokerTrainingTableMeta.d.ts +110 -0
  12. package/dist/features/game-presentations/adapters/inbound/pokerTrainingTableMeta.d.ts.map +1 -0
  13. package/dist/features/game-presentations/adapters/inbound/pokerTrainingTableMeta.js +81 -0
  14. package/dist/features/game-presentations/adapters/inbound/pokerTrainingTableMeta.js.map +1 -0
  15. package/dist/features/game-presentations/domain/createTabletopGameSeats.d.ts +25 -0
  16. package/dist/features/game-presentations/domain/createTabletopGameSeats.d.ts.map +1 -0
  17. package/dist/features/game-presentations/domain/createTabletopGameSeats.js +33 -0
  18. package/dist/features/game-presentations/domain/createTabletopGameSeats.js.map +1 -0
  19. package/dist/index.d.ts +9 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +7 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/meta.d.ts +145 -0
  24. package/dist/meta.d.ts.map +1 -0
  25. package/dist/meta.js +115 -0
  26. package/dist/meta.js.map +1 -0
  27. package/dist/plugin.d.ts +277 -0
  28. package/dist/plugin.d.ts.map +1 -0
  29. package/dist/plugin.js +9 -0
  30. package/dist/plugin.js.map +1 -0
  31. package/dist/registry.d.ts +522 -0
  32. package/dist/registry.d.ts.map +1 -0
  33. package/dist/registry.js +22 -0
  34. package/dist/registry.js.map +1 -0
  35. package/dist/types/gamePresentation.d.ts +16 -0
  36. package/dist/types/gamePresentation.d.ts.map +1 -0
  37. package/dist/types/gamePresentation.js +2 -0
  38. package/dist/types/gamePresentation.js.map +1 -0
  39. package/dist/types/pokerTraining.d.ts +42 -0
  40. package/dist/types/pokerTraining.d.ts.map +1 -0
  41. package/dist/types/pokerTraining.js +2 -0
  42. package/dist/types/pokerTraining.js.map +1 -0
  43. package/package.json +12 -5
  44. package/src/features/game-presentations/adapters/inbound/PokerTrainingTable.tsx +41 -0
  45. package/src/features/game-presentations/adapters/inbound/createPokerTrainingTableState.test.ts +130 -0
  46. package/src/features/game-presentations/adapters/inbound/createPokerTrainingTableState.ts +133 -0
  47. package/src/features/game-presentations/adapters/inbound/pokerTrainingTableMeta.ts +80 -0
  48. package/src/features/game-presentations/domain/createTabletopGameSeats.test.ts +55 -0
  49. package/src/features/game-presentations/domain/createTabletopGameSeats.ts +43 -0
  50. package/src/index.ts +20 -0
  51. package/src/meta.test.ts +54 -0
  52. package/src/meta.ts +114 -0
  53. package/src/plugin.ts +10 -0
  54. package/src/registry.ts +23 -0
  55. package/src/types/gamePresentation.ts +19 -0
  56. package/src/types/pokerTraining.ts +51 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @ankhorage/zora-tabletop
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c1cbbcd: Add generic card-game seat mapping and a poker training table pattern.
8
+
9
+ ## 0.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 39484a1: Expose TabletopTable through the canonical ZORA plugin descriptor with Studio authoring metadata.
14
+
15
+ ### Patch Changes
16
+
17
+ - 91312b8: Update Ankhorage dependencies: `@ankhorage/zora`.
18
+
3
19
  ## 0.0.9
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/zora-tabletop
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v0.0.5](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v0.1.0](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
7
7
 
8
8
  Reusable tabletop, playing-card, seat, token, and card-game presentation components for React Native and React Native Web.
9
9
 
@@ -99,6 +99,7 @@ export default function BasicTabletopApp() {
99
99
  - [Export graph](././paradox/diagrams/export-graph.mmd)
100
100
  - [CardBack sequence](././paradox/diagrams/sequences/card-back.mmd)
101
101
  - [CardHand sequence](././paradox/diagrams/sequences/card-hand.mmd)
102
+ - [createPokerTrainingTableState sequence](././paradox/diagrams/sequences/create-poker-training-table-state.mmd)
102
103
  - [PlayingCard sequence](././paradox/diagrams/sequences/playing-card.mmd)
103
104
  - [TabletopTable sequence](././paradox/diagrams/sequences/tabletop-table.mmd)
104
105
 
@@ -318,3 +319,46 @@ Source: `src/colors.ts:73:1`
318
319
  Related symbols: `TabletopColorScheme`
319
320
 
320
321
  </details>
322
+
323
+ <details>
324
+ <summary>PokerTrainingTable</summary>
325
+
326
+ ```ts
327
+ PokerTrainingTable({
328
+ task = {},
329
+ defaultStackBigBlinds = 100,
330
+ accessibilityLabel,
331
+ ...tableProps
332
+ }: PokerTrainingTableProps) => React.JSX.Element
333
+ ```
334
+
335
+ Manifest-ready poker training pattern that reconstructs a complete table from task data.
336
+
337
+ Bind the raw training task object to `task`; the pattern maps sparse active-player data to a
338
+ full nine-seat presentation while leaving API execution in the generated application.
339
+
340
+ #### Training task binding
341
+
342
+ ```tsx
343
+ <PokerTrainingTable task={task} />
344
+ ```
345
+
346
+ Related types: `PokerTrainingTableProps`
347
+
348
+ <details>
349
+ <summary>Props</summary>
350
+
351
+ | Prop | Type | Required | Default | Description |
352
+ | --------------------- | ----------------------------------------- | -------- | ------- | ----------- |
353
+ | accessibilityLabel | `string \| undefined` | no | — | |
354
+ | cardSize | `TabletopCardSize \| undefined` | no | — | |
355
+ | colorScheme | `TabletopColorOverrides \| undefined` | no | — | |
356
+ | defaultStackBigBlinds | `number \| undefined` | no | `100` | |
357
+ | disabled | `boolean \| undefined` | no | — | |
358
+ | shape | `TabletopShape \| undefined` | no | — | |
359
+ | task | `PokerTrainingTaskTableData \| undefined` | no | `{}` | |
360
+ | testID | `string \| undefined` | no | — | |
361
+
362
+ </details>
363
+
364
+ </details>
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { PokerTrainingTableProps } from '../../../../types/pokerTraining';
3
+ /***
4
+ * Manifest-ready poker training pattern that reconstructs a complete table from task data.
5
+ *
6
+ * Bind the raw training task object to `task`; the pattern maps sparse active-player data to a
7
+ * full nine-seat presentation while leaving API execution in the generated application.
8
+ *
9
+ * @readme
10
+ * @example Training task binding
11
+ * ```tsx
12
+ * <PokerTrainingTable task={task} />
13
+ * ```
14
+ */
15
+ export declare function PokerTrainingTable({ task, defaultStackBigBlinds, accessibilityLabel, ...tableProps }: PokerTrainingTableProps): React.JSX.Element;
16
+ //# sourceMappingURL=PokerTrainingTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PokerTrainingTable.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentations/adapters/inbound/PokerTrainingTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG/E;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAS,EACT,qBAA2B,EAC3B,kBAAkB,EAClB,GAAG,UAAU,EACd,EAAE,uBAAuB,qBAiBzB"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { TabletopTable } from '../../../../components/tabletop-table';
3
+ import { createPokerTrainingTableState } from './createPokerTrainingTableState';
4
+ /***
5
+ * Manifest-ready poker training pattern that reconstructs a complete table from task data.
6
+ *
7
+ * Bind the raw training task object to `task`; the pattern maps sparse active-player data to a
8
+ * full nine-seat presentation while leaving API execution in the generated application.
9
+ *
10
+ * @readme
11
+ * @example Training task binding
12
+ * ```tsx
13
+ * <PokerTrainingTable task={task} />
14
+ * ```
15
+ */
16
+ export function PokerTrainingTable({ task = {}, defaultStackBigBlinds = 100, accessibilityLabel, ...tableProps }) {
17
+ const state = React.useMemo(() => createPokerTrainingTableState(task, { defaultStackBigBlinds }), [defaultStackBigBlinds, task]);
18
+ return (<TabletopTable {...tableProps} accessibilityLabel={accessibilityLabel ?? state.accessibilityLabel} centerCards={state.centerCards} centerLabel={state.centerLabel} centerSublabel={state.centerSublabel} seatCount={9} seats={state.seats}/>);
19
+ }
20
+ //# sourceMappingURL=PokerTrainingTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PokerTrainingTable.js","sourceRoot":"","sources":["../../../../../src/features/game-presentations/adapters/inbound/PokerTrainingTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,IAAI,GAAG,EAAE,EACT,qBAAqB,GAAG,GAAG,EAC3B,kBAAkB,EAClB,GAAG,UAAU,EACW;IACxB,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CACzB,GAAG,EAAE,CAAC,6BAA6B,CAAC,IAAI,EAAE,EAAE,qBAAqB,EAAE,CAAC,EACpE,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAC9B,CAAC;IAEF,OAAO,CACL,CAAC,aAAa,CACZ,IAAI,UAAU,CAAC,CACf,kBAAkB,CAAC,CAAC,kBAAkB,IAAI,KAAK,CAAC,kBAAkB,CAAC,CACnE,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAC/B,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAC/B,cAAc,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CACrC,SAAS,CAAC,CAAC,CAAC,CAAC,CACb,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EACnB,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { TabletopTable } from '../../../../components/tabletop-table';\nimport type { PokerTrainingTableProps } from '../../../../types/pokerTraining';\nimport { createPokerTrainingTableState } from './createPokerTrainingTableState';\n\n/***\n * Manifest-ready poker training pattern that reconstructs a complete table from task data.\n *\n * Bind the raw training task object to `task`; the pattern maps sparse active-player data to a\n * full nine-seat presentation while leaving API execution in the generated application.\n *\n * @readme\n * @example Training task binding\n * ```tsx\n * <PokerTrainingTable task={task} />\n * ```\n */\nexport function PokerTrainingTable({\n task = {},\n defaultStackBigBlinds = 100,\n accessibilityLabel,\n ...tableProps\n}: PokerTrainingTableProps) {\n const state = React.useMemo(\n () => createPokerTrainingTableState(task, { defaultStackBigBlinds }),\n [defaultStackBigBlinds, task],\n );\n\n return (\n <TabletopTable\n {...tableProps}\n accessibilityLabel={accessibilityLabel ?? state.accessibilityLabel}\n centerCards={state.centerCards}\n centerLabel={state.centerLabel}\n centerSublabel={state.centerSublabel}\n seatCount={9}\n seats={state.seats}\n />\n );\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { CreatePokerTrainingTableStateOptions, PokerTrainingTableState, PokerTrainingTaskTableData } from '../../../../types/pokerTraining';
2
+ /***
3
+ * Adapts the table-relevant subset of a poker training task to generic tabletop presentation state.
4
+ *
5
+ * The canonical poker ring is rotated so the hero occupies the first (bottom) tabletop seat.
6
+ * Players omitted by the task are reconstructed as folded with the configured default stack.
7
+ *
8
+ * @param task - Serializable poker training task data received by the generated application.
9
+ * @param options - Presentation defaults for task fields that are intentionally omitted.
10
+ * @returns Seats and shared-table content ready for `TabletopTable`.
11
+ */
12
+ export declare function createPokerTrainingTableState(task: PokerTrainingTaskTableData, { defaultStackBigBlinds }?: CreatePokerTrainingTableStateOptions): PokerTrainingTableState;
13
+ //# sourceMappingURL=createPokerTrainingTableState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPokerTrainingTableState.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentations/adapters/inbound/createPokerTrainingTableState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oCAAoC,EAEpC,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AAGzC;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,0BAA0B,EAChC,EAAE,qBAA2B,EAAE,GAAE,oCAAyC,GACzE,uBAAuB,CAkCzB"}
@@ -0,0 +1,98 @@
1
+ import { createTabletopGameSeats } from '../../domain/createTabletopGameSeats';
2
+ /***
3
+ * Adapts the table-relevant subset of a poker training task to generic tabletop presentation state.
4
+ *
5
+ * The canonical poker ring is rotated so the hero occupies the first (bottom) tabletop seat.
6
+ * Players omitted by the task are reconstructed as folded with the configured default stack.
7
+ *
8
+ * @param task - Serializable poker training task data received by the generated application.
9
+ * @param options - Presentation defaults for task fields that are intentionally omitted.
10
+ * @returns Seats and shared-table content ready for `TabletopTable`.
11
+ */
12
+ export function createPokerTrainingTableState(task, { defaultStackBigBlinds = 100 } = {}) {
13
+ const bigBlind = task.blinds?.big;
14
+ const heroPosition = task.heroPosition ?? task.players?.find((player) => player.isHero)?.position;
15
+ const orderedPositions = rotatePokerPositions(heroPosition);
16
+ const defaultStack = `${formatAmount(defaultStackBigBlinds)} BB`;
17
+ const participants = (task.players ?? []).map((player) => createPokerParticipantState(player, task, bigBlind));
18
+ const seats = createTabletopGameSeats({
19
+ seats: orderedPositions.map((position) => ({
20
+ id: position,
21
+ defaultState: {
22
+ label: position,
23
+ tokenLabel: position === 'BTN' ? 'D' : undefined,
24
+ },
25
+ })),
26
+ participants,
27
+ missingParticipantState: {
28
+ disabled: true,
29
+ muted: true,
30
+ sublabel: `${defaultStack} · Folded`,
31
+ },
32
+ });
33
+ return {
34
+ seats,
35
+ centerCards: task.communityCards ?? [],
36
+ centerLabel: task.pot === undefined ? undefined : `Pot ${formatAmount(task.pot)}`,
37
+ centerSublabel: task.blinds === undefined
38
+ ? undefined
39
+ : `Blinds ${formatAmount(task.blinds.small)} / ${formatAmount(task.blinds.big)}`,
40
+ accessibilityLabel: createPokerAccessibilityLabel(heroPosition, task),
41
+ };
42
+ }
43
+ const pokerPositions = ['BTN', 'SB', 'BB', 'UTG', 'UTG+1', 'MP', 'MP+1', 'HJ', 'CO'];
44
+ /*** Rotates the canonical nine-seat poker ring to place the hero at the bottom seat. */
45
+ function rotatePokerPositions(heroPosition) {
46
+ const heroIndex = pokerPositions.findIndex((position) => position === heroPosition);
47
+ if (heroIndex <= 0)
48
+ return pokerPositions;
49
+ return [...pokerPositions.slice(heroIndex), ...pokerPositions.slice(0, heroIndex)];
50
+ }
51
+ /*** Converts one poker participant record into a generic seat-state override. */
52
+ function createPokerParticipantState(player, task, bigBlind) {
53
+ const isHero = player.isHero === true || player.position === task.heroPosition;
54
+ const cards = player.cards ?? (isHero ? task.heroCards : undefined);
55
+ const folded = player.folded === true;
56
+ return {
57
+ seatId: player.position,
58
+ state: {
59
+ cards,
60
+ disabled: folded,
61
+ faceDownCards: cards === undefined && !folded && !isHero ? 2 : undefined,
62
+ muted: folded,
63
+ selected: isHero,
64
+ sublabel: formatPlayerSublabel(player, bigBlind),
65
+ },
66
+ };
67
+ }
68
+ /*** Formats stack and optional committed chips as a compact seat sublabel. */
69
+ function formatPlayerSublabel(player, bigBlind) {
70
+ const stack = player.stack === undefined ? undefined : formatChipStack(player.stack, bigBlind);
71
+ const bet = player.bet === undefined ? undefined : `Bet ${formatChipStack(player.bet, bigBlind)}`;
72
+ const parts = [stack, bet, player.folded === true ? 'Folded' : undefined].filter((part) => part !== undefined);
73
+ return parts.length === 0 ? undefined : parts.join(' · ');
74
+ }
75
+ /*** Formats chips as big blinds when a positive blind is known, otherwise as an amount. */
76
+ function formatChipStack(amount, bigBlind) {
77
+ if (bigBlind !== undefined && bigBlind > 0) {
78
+ return `${formatAmount(amount / bigBlind)} BB`;
79
+ }
80
+ return `${formatAmount(amount)} chips`;
81
+ }
82
+ /*** Formats a numeric poker amount consistently across native and web runtimes. */
83
+ function formatAmount(amount) {
84
+ return new Intl.NumberFormat('en-US', { maximumFractionDigits: 2 }).format(amount);
85
+ }
86
+ /*** Summarizes the reconstructed table for assistive technologies. */
87
+ function createPokerAccessibilityLabel(heroPosition, task) {
88
+ const parts = ['Nine-player poker table'];
89
+ if (heroPosition !== undefined)
90
+ parts.push(`Hero ${heroPosition}`);
91
+ if (task.pot !== undefined)
92
+ parts.push(`Pot ${formatAmount(task.pot)}`);
93
+ if (task.blinds !== undefined) {
94
+ parts.push(`Blinds ${formatAmount(task.blinds.small)} / ${formatAmount(task.blinds.big)}`);
95
+ }
96
+ return `${parts.join('. ')}.`;
97
+ }
98
+ //# sourceMappingURL=createPokerTrainingTableState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPokerTrainingTableState.js","sourceRoot":"","sources":["../../../../../src/features/game-presentations/adapters/inbound/createPokerTrainingTableState.ts"],"names":[],"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IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QAC3C,OAAO,GAAG,YAAY,CAAC,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC;IACjD,CAAC;IAED,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;AACzC,CAAC;AAED,mFAAmF;AACnF,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACrF,CAAC;AAED,sEAAsE;AACtE,SAAS,6BAA6B,CACpC,YAAgC,EAChC,IAAgC;IAEhC,MAAM,KAAK,GAAG,CAAC,yBAAyB,CAAC,CAAC;IAC1C,IAAI,YAAY,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,YAAY,EAAE,CAAC,CAAC;IACnE,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACxE,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,UAAU,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AAChC,CAAC","sourcesContent":["import type { TabletopGameParticipantState } from '../../../../types/gamePresentation';\nimport type {\n CreatePokerTrainingTableStateOptions,\n PokerTrainingPlayer,\n PokerTrainingTableState,\n PokerTrainingTaskTableData,\n} from '../../../../types/pokerTraining';\nimport { createTabletopGameSeats } from '../../domain/createTabletopGameSeats';\n\n/***\n * Adapts the table-relevant subset of a poker training task to generic tabletop presentation state.\n *\n * The canonical poker ring is rotated so the hero occupies the first (bottom) tabletop seat.\n * Players omitted by the task are reconstructed as folded with the configured default stack.\n *\n * @param task - Serializable poker training task data received by the generated application.\n * @param options - Presentation defaults for task fields that are intentionally omitted.\n * @returns Seats and shared-table content ready for `TabletopTable`.\n */\nexport function createPokerTrainingTableState(\n task: PokerTrainingTaskTableData,\n { defaultStackBigBlinds = 100 }: CreatePokerTrainingTableStateOptions = {},\n): PokerTrainingTableState {\n const bigBlind = task.blinds?.big;\n const heroPosition = task.heroPosition ?? task.players?.find((player) => player.isHero)?.position;\n const orderedPositions = rotatePokerPositions(heroPosition);\n const defaultStack = `${formatAmount(defaultStackBigBlinds)} BB`;\n const participants = (task.players ?? []).map((player) =>\n createPokerParticipantState(player, task, bigBlind),\n );\n const seats = createTabletopGameSeats({\n seats: orderedPositions.map((position) => ({\n id: position,\n defaultState: {\n label: position,\n tokenLabel: position === 'BTN' ? 'D' : undefined,\n },\n })),\n participants,\n missingParticipantState: {\n disabled: true,\n muted: true,\n sublabel: `${defaultStack} · Folded`,\n },\n });\n\n return {\n seats,\n centerCards: task.communityCards ?? [],\n centerLabel: task.pot === undefined ? undefined : `Pot ${formatAmount(task.pot)}`,\n centerSublabel:\n task.blinds === undefined\n ? undefined\n : `Blinds ${formatAmount(task.blinds.small)} / ${formatAmount(task.blinds.big)}`,\n accessibilityLabel: createPokerAccessibilityLabel(heroPosition, task),\n };\n}\n\nconst pokerPositions = ['BTN', 'SB', 'BB', 'UTG', 'UTG+1', 'MP', 'MP+1', 'HJ', 'CO'] as const;\n\n/*** Rotates the canonical nine-seat poker ring to place the hero at the bottom seat. */\nfunction rotatePokerPositions(heroPosition: string | undefined): readonly string[] {\n const heroIndex = pokerPositions.findIndex((position) => position === heroPosition);\n if (heroIndex <= 0) return pokerPositions;\n\n return [...pokerPositions.slice(heroIndex), ...pokerPositions.slice(0, heroIndex)];\n}\n\n/*** Converts one poker participant record into a generic seat-state override. */\nfunction createPokerParticipantState(\n player: PokerTrainingPlayer,\n task: PokerTrainingTaskTableData,\n bigBlind: number | undefined,\n): TabletopGameParticipantState {\n const isHero = player.isHero === true || player.position === task.heroPosition;\n const cards = player.cards ?? (isHero ? task.heroCards : undefined);\n const folded = player.folded === true;\n\n return {\n seatId: player.position,\n state: {\n cards,\n disabled: folded,\n faceDownCards: cards === undefined && !folded && !isHero ? 2 : undefined,\n muted: folded,\n selected: isHero,\n sublabel: formatPlayerSublabel(player, bigBlind),\n },\n };\n}\n\n/*** Formats stack and optional committed chips as a compact seat sublabel. */\nfunction formatPlayerSublabel(\n player: PokerTrainingPlayer,\n bigBlind: number | undefined,\n): string | undefined {\n const stack = player.stack === undefined ? undefined : formatChipStack(player.stack, bigBlind);\n const bet = player.bet === undefined ? undefined : `Bet ${formatChipStack(player.bet, bigBlind)}`;\n const parts = [stack, bet, player.folded === true ? 'Folded' : undefined].filter(\n (part): part is string => part !== undefined,\n );\n\n return parts.length === 0 ? undefined : parts.join(' · ');\n}\n\n/*** Formats chips as big blinds when a positive blind is known, otherwise as an amount. */\nfunction formatChipStack(amount: number, bigBlind: number | undefined): string {\n if (bigBlind !== undefined && bigBlind > 0) {\n return `${formatAmount(amount / bigBlind)} BB`;\n }\n\n return `${formatAmount(amount)} chips`;\n}\n\n/*** Formats a numeric poker amount consistently across native and web runtimes. */\nfunction formatAmount(amount: number): string {\n return new Intl.NumberFormat('en-US', { maximumFractionDigits: 2 }).format(amount);\n}\n\n/*** Summarizes the reconstructed table for assistive technologies. */\nfunction createPokerAccessibilityLabel(\n heroPosition: string | undefined,\n task: PokerTrainingTaskTableData,\n): string {\n const parts = ['Nine-player poker table'];\n if (heroPosition !== undefined) parts.push(`Hero ${heroPosition}`);\n if (task.pot !== undefined) parts.push(`Pot ${formatAmount(task.pot)}`);\n if (task.blinds !== undefined) {\n parts.push(`Blinds ${formatAmount(task.blinds.small)} / ${formatAmount(task.blinds.big)}`);\n }\n\n return `${parts.join('. ')}.`;\n}\n"]}
@@ -0,0 +1,110 @@
1
+ export declare const pokerTrainingTableMeta: {
2
+ readonly name: "PokerTrainingTable";
3
+ readonly category: "pattern";
4
+ readonly description: "Reconstructs a complete nine-seat poker table from sparse training task data.";
5
+ readonly directManifestNode: true;
6
+ readonly allowedChildren: readonly [];
7
+ readonly blueprint: {
8
+ readonly label: "Poker training table";
9
+ readonly defaultProps: {
10
+ readonly task: {};
11
+ readonly defaultStackBigBlinds: 100;
12
+ readonly shape: "oval";
13
+ readonly cardSize: "small";
14
+ };
15
+ };
16
+ readonly bindings: {
17
+ readonly props: {
18
+ readonly task: {
19
+ readonly label: "Poker training task";
20
+ readonly description: "Table-relevant fields from a poker training task.";
21
+ readonly value: {
22
+ readonly type: "object";
23
+ readonly fields: readonly [{
24
+ readonly path: "blinds";
25
+ readonly type: "object";
26
+ readonly label: "Blinds";
27
+ }, {
28
+ readonly path: "heroPosition";
29
+ readonly type: "string";
30
+ readonly label: "Hero position";
31
+ }, {
32
+ readonly path: "heroCards";
33
+ readonly type: "array";
34
+ readonly label: "Hero cards";
35
+ }, {
36
+ readonly path: "communityCards";
37
+ readonly type: "array";
38
+ readonly label: "Community cards";
39
+ }, {
40
+ readonly path: "pot";
41
+ readonly type: "number";
42
+ readonly label: "Pot";
43
+ }, {
44
+ readonly path: "players";
45
+ readonly type: "array";
46
+ readonly label: "Players";
47
+ }];
48
+ };
49
+ readonly acceptsFallback: true;
50
+ };
51
+ readonly disabled: {
52
+ readonly label: "Disabled";
53
+ readonly value: {
54
+ readonly type: "boolean";
55
+ };
56
+ readonly acceptsFallback: true;
57
+ readonly acceptsTransforms: true;
58
+ };
59
+ };
60
+ };
61
+ readonly props: {
62
+ readonly defaultStackBigBlinds: {
63
+ readonly type: "number";
64
+ readonly category: "Players";
65
+ readonly label: "Default stack in big blinds";
66
+ readonly default: 100;
67
+ readonly authoring: {
68
+ readonly authority: "instance";
69
+ };
70
+ };
71
+ readonly shape: {
72
+ readonly type: "enum";
73
+ readonly category: "Table";
74
+ readonly label: "Shape";
75
+ readonly enum: readonly ["circle", "oval", "rounded"];
76
+ readonly default: "oval";
77
+ readonly authoring: {
78
+ readonly authority: "instance";
79
+ };
80
+ };
81
+ readonly cardSize: {
82
+ readonly type: "enum";
83
+ readonly category: "Cards";
84
+ readonly label: "Card size";
85
+ readonly enum: readonly ["small", "medium", "large"];
86
+ readonly default: "small";
87
+ readonly authoring: {
88
+ readonly authority: "instance";
89
+ };
90
+ };
91
+ readonly disabled: {
92
+ readonly type: "boolean";
93
+ readonly category: "State";
94
+ readonly label: "Disabled";
95
+ readonly default: false;
96
+ readonly authoring: {
97
+ readonly authority: "instance";
98
+ };
99
+ };
100
+ readonly accessibilityLabel: {
101
+ readonly type: "string";
102
+ readonly category: "Accessibility";
103
+ readonly label: "Accessibility label";
104
+ readonly authoring: {
105
+ readonly authority: "instance";
106
+ };
107
+ };
108
+ };
109
+ };
110
+ //# sourceMappingURL=pokerTrainingTableMeta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pokerTrainingTableMeta.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentations/adapters/inbound/pokerTrainingTableMeta.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+EzB,CAAC"}
@@ -0,0 +1,81 @@
1
+ export const pokerTrainingTableMeta = {
2
+ name: 'PokerTrainingTable',
3
+ category: 'pattern',
4
+ description: 'Reconstructs a complete nine-seat poker table from sparse training task data.',
5
+ directManifestNode: true,
6
+ allowedChildren: [],
7
+ blueprint: {
8
+ label: 'Poker training table',
9
+ defaultProps: {
10
+ task: {},
11
+ defaultStackBigBlinds: 100,
12
+ shape: 'oval',
13
+ cardSize: 'small',
14
+ },
15
+ },
16
+ bindings: {
17
+ props: {
18
+ task: {
19
+ label: 'Poker training task',
20
+ description: 'Table-relevant fields from a poker training task.',
21
+ value: {
22
+ type: 'object',
23
+ fields: [
24
+ { path: 'blinds', type: 'object', label: 'Blinds' },
25
+ { path: 'heroPosition', type: 'string', label: 'Hero position' },
26
+ { path: 'heroCards', type: 'array', label: 'Hero cards' },
27
+ { path: 'communityCards', type: 'array', label: 'Community cards' },
28
+ { path: 'pot', type: 'number', label: 'Pot' },
29
+ { path: 'players', type: 'array', label: 'Players' },
30
+ ],
31
+ },
32
+ acceptsFallback: true,
33
+ },
34
+ disabled: {
35
+ label: 'Disabled',
36
+ value: { type: 'boolean' },
37
+ acceptsFallback: true,
38
+ acceptsTransforms: true,
39
+ },
40
+ },
41
+ },
42
+ props: {
43
+ defaultStackBigBlinds: {
44
+ type: 'number',
45
+ category: 'Players',
46
+ label: 'Default stack in big blinds',
47
+ default: 100,
48
+ authoring: { authority: 'instance' },
49
+ },
50
+ shape: {
51
+ type: 'enum',
52
+ category: 'Table',
53
+ label: 'Shape',
54
+ enum: ['circle', 'oval', 'rounded'],
55
+ default: 'oval',
56
+ authoring: { authority: 'instance' },
57
+ },
58
+ cardSize: {
59
+ type: 'enum',
60
+ category: 'Cards',
61
+ label: 'Card size',
62
+ enum: ['small', 'medium', 'large'],
63
+ default: 'small',
64
+ authoring: { authority: 'instance' },
65
+ },
66
+ disabled: {
67
+ type: 'boolean',
68
+ category: 'State',
69
+ label: 'Disabled',
70
+ default: false,
71
+ authoring: { authority: 'instance' },
72
+ },
73
+ accessibilityLabel: {
74
+ type: 'string',
75
+ category: 'Accessibility',
76
+ label: 'Accessibility label',
77
+ authoring: { authority: 'instance' },
78
+ },
79
+ },
80
+ };
81
+ //# sourceMappingURL=pokerTrainingTableMeta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pokerTrainingTableMeta.js","sourceRoot":"","sources":["../../../../../src/features/game-presentations/adapters/inbound/pokerTrainingTableMeta.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAC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AE;YACrB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,6BAA6B;YACpC,OAAO,EAAE,GAAG;YACZ,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,KAAK,EAAE;YACL,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;YACnC,OAAO,EAAE,MAAM;YACf,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC;YAClC,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,kBAAkB,EAAE;YAClB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,eAAe;YACzB,KAAK,EAAE,qBAAqB;YAC5B,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;KACF;CACO,CAAC","sourcesContent":["export const pokerTrainingTableMeta = {\n name: 'PokerTrainingTable',\n category: 'pattern',\n description: 'Reconstructs a complete nine-seat poker table from sparse training task data.',\n directManifestNode: true,\n allowedChildren: [],\n blueprint: {\n label: 'Poker training table',\n defaultProps: {\n task: {},\n defaultStackBigBlinds: 100,\n shape: 'oval',\n cardSize: 'small',\n },\n },\n bindings: {\n props: {\n task: {\n label: 'Poker training task',\n description: 'Table-relevant fields from a poker training task.',\n value: {\n type: 'object',\n fields: [\n { path: 'blinds', type: 'object', label: 'Blinds' },\n { path: 'heroPosition', type: 'string', label: 'Hero position' },\n { path: 'heroCards', type: 'array', label: 'Hero cards' },\n { path: 'communityCards', type: 'array', label: 'Community cards' },\n { path: 'pot', type: 'number', label: 'Pot' },\n { path: 'players', type: 'array', label: 'Players' },\n ],\n },\n acceptsFallback: true,\n },\n disabled: {\n label: 'Disabled',\n value: { type: 'boolean' },\n acceptsFallback: true,\n acceptsTransforms: true,\n },\n },\n },\n props: {\n defaultStackBigBlinds: {\n type: 'number',\n category: 'Players',\n label: 'Default stack in big blinds',\n default: 100,\n authoring: { authority: 'instance' },\n },\n shape: {\n type: 'enum',\n category: 'Table',\n label: 'Shape',\n enum: ['circle', 'oval', 'rounded'],\n default: 'oval',\n authoring: { authority: 'instance' },\n },\n cardSize: {\n type: 'enum',\n category: 'Cards',\n label: 'Card size',\n enum: ['small', 'medium', 'large'],\n default: 'small',\n authoring: { authority: 'instance' },\n },\n disabled: {\n type: 'boolean',\n category: 'State',\n label: 'Disabled',\n default: false,\n authoring: { authority: 'instance' },\n },\n accessibilityLabel: {\n type: 'string',\n category: 'Accessibility',\n label: 'Accessibility label',\n authoring: { authority: 'instance' },\n },\n },\n} as const;\n"]}
@@ -0,0 +1,25 @@
1
+ import type { TabletopSeatState } from '../../../types';
2
+ import type { CreateTabletopGameSeatsInput } from '../../../types/gamePresentation';
3
+ /***
4
+ * Joins an ordered game layout with the participant states currently present in a scene.
5
+ *
6
+ * Missing participants retain their seat definition and receive the configured fallback state,
7
+ * which lets card games represent folded, eliminated, disconnected, or otherwise inactive seats
8
+ * without embedding those game rules in the tabletop renderer.
9
+ *
10
+ * @param input - Ordered seats, participant overrides, and the fallback for missing participants.
11
+ * @returns Normalized tabletop seats in the same order as the supplied seat definitions.
12
+ * @example Generic four-seat game
13
+ * ```ts
14
+ * const seats = createTabletopGameSeats({
15
+ * seats: [
16
+ * { id: 'north', defaultState: { label: 'North' } },
17
+ * { id: 'east', defaultState: { label: 'East' } },
18
+ * ],
19
+ * participants: [{ seatId: 'east', state: { sublabel: 'Ready' } }],
20
+ * missingParticipantState: { muted: true },
21
+ * });
22
+ * ```
23
+ */
24
+ export declare function createTabletopGameSeats({ seats, participants, missingParticipantState, }: CreateTabletopGameSeatsInput): readonly TabletopSeatState[];
25
+ //# sourceMappingURL=createTabletopGameSeats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTabletopGameSeats.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentations/domain/createTabletopGameSeats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,YAAY,EACZ,uBAAyD,GAC1D,EAAE,4BAA4B,GAAG,SAAS,iBAAiB,EAAE,CAc7D"}
@@ -0,0 +1,33 @@
1
+ /***
2
+ * Joins an ordered game layout with the participant states currently present in a scene.
3
+ *
4
+ * Missing participants retain their seat definition and receive the configured fallback state,
5
+ * which lets card games represent folded, eliminated, disconnected, or otherwise inactive seats
6
+ * without embedding those game rules in the tabletop renderer.
7
+ *
8
+ * @param input - Ordered seats, participant overrides, and the fallback for missing participants.
9
+ * @returns Normalized tabletop seats in the same order as the supplied seat definitions.
10
+ * @example Generic four-seat game
11
+ * ```ts
12
+ * const seats = createTabletopGameSeats({
13
+ * seats: [
14
+ * { id: 'north', defaultState: { label: 'North' } },
15
+ * { id: 'east', defaultState: { label: 'East' } },
16
+ * ],
17
+ * participants: [{ seatId: 'east', state: { sublabel: 'Ready' } }],
18
+ * missingParticipantState: { muted: true },
19
+ * });
20
+ * ```
21
+ */
22
+ export function createTabletopGameSeats({ seats, participants, missingParticipantState = { disabled: true, muted: true }, }) {
23
+ const participantsBySeat = new Map(participants.map((participant) => [participant.seatId, participant]));
24
+ return seats.map((seat) => {
25
+ const participant = participantsBySeat.get(seat.id);
26
+ return {
27
+ id: seat.id,
28
+ ...seat.defaultState,
29
+ ...(participant === undefined ? missingParticipantState : participant.state),
30
+ };
31
+ });
32
+ }
33
+ //# sourceMappingURL=createTabletopGameSeats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTabletopGameSeats.js","sourceRoot":"","sources":["../../../../src/features/game-presentations/domain/createTabletopGameSeats.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,uBAAuB,CAAC,EACtC,KAAK,EACL,YAAY,EACZ,uBAAuB,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAC5B;IAC7B,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAChC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAU,CAAC,CAC9E,CAAC;IAEF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,WAAW,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEpD,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,GAAG,IAAI,CAAC,YAAY;YACpB,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC;SAC7E,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { TabletopSeatState } from '../../../types';\nimport type { CreateTabletopGameSeatsInput } from '../../../types/gamePresentation';\n\n/***\n * Joins an ordered game layout with the participant states currently present in a scene.\n *\n * Missing participants retain their seat definition and receive the configured fallback state,\n * which lets card games represent folded, eliminated, disconnected, or otherwise inactive seats\n * without embedding those game rules in the tabletop renderer.\n *\n * @param input - Ordered seats, participant overrides, and the fallback for missing participants.\n * @returns Normalized tabletop seats in the same order as the supplied seat definitions.\n * @example Generic four-seat game\n * ```ts\n * const seats = createTabletopGameSeats({\n * seats: [\n * { id: 'north', defaultState: { label: 'North' } },\n * { id: 'east', defaultState: { label: 'East' } },\n * ],\n * participants: [{ seatId: 'east', state: { sublabel: 'Ready' } }],\n * missingParticipantState: { muted: true },\n * });\n * ```\n */\nexport function createTabletopGameSeats({\n seats,\n participants,\n missingParticipantState = { disabled: true, muted: true },\n}: CreateTabletopGameSeatsInput): readonly TabletopSeatState[] {\n const participantsBySeat = new Map(\n participants.map((participant) => [participant.seatId, participant] as const),\n );\n\n return seats.map((seat) => {\n const participant = participantsBySeat.get(seat.id);\n\n return {\n id: seat.id,\n ...seat.defaultState,\n ...(participant === undefined ? missingParticipantState : participant.state),\n };\n });\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -8,5 +8,14 @@ export type { PlayingCardProps } from './components/playing-card';
8
8
  export { PlayingCard } from './components/playing-card';
9
9
  export type { TabletopTableProps } from './components/tabletop-table';
10
10
  export { TabletopTable } from './components/tabletop-table';
11
+ export { createPokerTrainingTableState } from './features/game-presentations/adapters/inbound/createPokerTrainingTableState';
12
+ export { PokerTrainingTable } from './features/game-presentations/adapters/inbound/PokerTrainingTable';
13
+ export { pokerTrainingTableMeta } from './features/game-presentations/adapters/inbound/pokerTrainingTableMeta';
14
+ export { createTabletopGameSeats } from './features/game-presentations/domain/createTabletopGameSeats';
15
+ export { tabletopTableMeta } from './meta';
16
+ export { ZORA_TABLETOP_COMPONENT_REGISTRY, ZORA_TABLETOP_PLUGIN } from './plugin';
17
+ export { ZORA_PLUGIN_METADATA, ZORA_TABLETOP_COMPONENT_META } from './registry';
11
18
  export type { PlayingCardSuit, PlayingCardValue, TabletopCardSize, TabletopSeatCount, TabletopSeatState, TabletopShape, } from './types';
19
+ export type { CreateTabletopGameSeatsInput, TabletopGameParticipantState, TabletopGameSeatDefinition, TabletopGameSeatPresentation, } from './types/gamePresentation';
20
+ export type { CreatePokerTrainingTableStateOptions, PokerTrainingPlayer, PokerTrainingTableProps, PokerTrainingTableState, PokerTrainingTaskTableData, } from './types/pokerTraining';
12
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,GACd,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,8EAA8E,CAAC;AAC7H,OAAO,EAAE,kBAAkB,EAAE,MAAM,mEAAmE,CAAC;AACvG,OAAO,EAAE,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAC/G,OAAO,EAAE,uBAAuB,EAAE,MAAM,8DAA8D,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,gCAAgC,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAChF,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,4BAA4B,EAC5B,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,oCAAoC,EACpC,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -3,4 +3,11 @@ export { CardBack } from './components/card-back';
3
3
  export { CardHand } from './components/card-hand';
4
4
  export { PlayingCard } from './components/playing-card';
5
5
  export { TabletopTable } from './components/tabletop-table';
6
+ export { createPokerTrainingTableState } from './features/game-presentations/adapters/inbound/createPokerTrainingTableState';
7
+ export { PokerTrainingTable } from './features/game-presentations/adapters/inbound/PokerTrainingTable';
8
+ export { pokerTrainingTableMeta } from './features/game-presentations/adapters/inbound/pokerTrainingTableMeta';
9
+ export { createTabletopGameSeats } from './features/game-presentations/domain/createTabletopGameSeats';
10
+ export { tabletopTableMeta } from './meta';
11
+ export { ZORA_TABLETOP_COMPONENT_REGISTRY, ZORA_TABLETOP_PLUGIN } from './plugin';
12
+ export { ZORA_PLUGIN_METADATA, ZORA_TABLETOP_COMPONENT_META } from './registry';
6
13
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["export type { TabletopColorOverrides, TabletopColorScheme } from './colors';\nexport { createTabletopColorScheme } from './colors';\nexport type { CardBackProps } from './components/card-back';\nexport { CardBack } from './components/card-back';\nexport type { CardHandProps } from './components/card-hand';\nexport { CardHand } from './components/card-hand';\nexport type { PlayingCardProps } from './components/playing-card';\nexport { PlayingCard } from './components/playing-card';\nexport type { TabletopTableProps } from './components/tabletop-table';\nexport { TabletopTable } from './components/tabletop-table';\nexport type {\n PlayingCardSuit,\n PlayingCardValue,\n TabletopCardSize,\n TabletopSeatCount,\n TabletopSeatState,\n TabletopShape,\n} from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,8EAA8E,CAAC;AAC7H,OAAO,EAAE,kBAAkB,EAAE,MAAM,mEAAmE,CAAC;AACvG,OAAO,EAAE,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAC/G,OAAO,EAAE,uBAAuB,EAAE,MAAM,8DAA8D,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,gCAAgC,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export type { TabletopColorOverrides, TabletopColorScheme } from './colors';\nexport { createTabletopColorScheme } from './colors';\nexport type { CardBackProps } from './components/card-back';\nexport { CardBack } from './components/card-back';\nexport type { CardHandProps } from './components/card-hand';\nexport { CardHand } from './components/card-hand';\nexport type { PlayingCardProps } from './components/playing-card';\nexport { PlayingCard } from './components/playing-card';\nexport type { TabletopTableProps } from './components/tabletop-table';\nexport { TabletopTable } from './components/tabletop-table';\nexport { createPokerTrainingTableState } from './features/game-presentations/adapters/inbound/createPokerTrainingTableState';\nexport { PokerTrainingTable } from './features/game-presentations/adapters/inbound/PokerTrainingTable';\nexport { pokerTrainingTableMeta } from './features/game-presentations/adapters/inbound/pokerTrainingTableMeta';\nexport { createTabletopGameSeats } from './features/game-presentations/domain/createTabletopGameSeats';\nexport { tabletopTableMeta } from './meta';\nexport { ZORA_TABLETOP_COMPONENT_REGISTRY, ZORA_TABLETOP_PLUGIN } from './plugin';\nexport { ZORA_PLUGIN_METADATA, ZORA_TABLETOP_COMPONENT_META } from './registry';\nexport type {\n PlayingCardSuit,\n PlayingCardValue,\n TabletopCardSize,\n TabletopSeatCount,\n TabletopSeatState,\n TabletopShape,\n} from './types';\nexport type {\n CreateTabletopGameSeatsInput,\n TabletopGameParticipantState,\n TabletopGameSeatDefinition,\n TabletopGameSeatPresentation,\n} from './types/gamePresentation';\nexport type {\n CreatePokerTrainingTableStateOptions,\n PokerTrainingPlayer,\n PokerTrainingTableProps,\n PokerTrainingTableState,\n PokerTrainingTaskTableData,\n} from './types/pokerTraining';\n"]}