@ankhorage/zora-tabletop 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/features/game-presentations/adapters/inbound/PokerTrainingTable.d.ts +2 -2
  3. package/dist/features/game-presentations/adapters/inbound/PokerTrainingTable.js +3 -3
  4. package/dist/features/game-presentations/adapters/inbound/PokerTrainingTable.js.map +1 -1
  5. package/dist/features/game-presentations/adapters/inbound/createPokerTrainingTableState.d.ts +3 -2
  6. package/dist/features/game-presentations/adapters/inbound/createPokerTrainingTableState.d.ts.map +1 -1
  7. package/dist/features/game-presentations/adapters/inbound/createPokerTrainingTableState.js +27 -12
  8. package/dist/features/game-presentations/adapters/inbound/createPokerTrainingTableState.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/plugin.d.ts +2 -2
  13. package/dist/registry.d.ts +2 -2
  14. package/dist/registry.d.ts.map +1 -1
  15. package/dist/registry.js +3 -2
  16. package/dist/registry.js.map +1 -1
  17. package/dist/types/pokerTraining.d.ts +4 -1
  18. package/dist/types/pokerTraining.d.ts.map +1 -1
  19. package/dist/types/pokerTraining.js.map +1 -1
  20. package/package.json +2 -3
  21. package/src/features/game-presentations/adapters/inbound/PokerTrainingTable.tsx +3 -3
  22. package/src/features/game-presentations/adapters/inbound/createPokerTrainingTableState.test.ts +29 -3
  23. package/src/features/game-presentations/adapters/inbound/createPokerTrainingTableState.ts +31 -11
  24. package/src/index.ts +1 -0
  25. package/src/meta.test.ts +14 -1
  26. package/src/registry.ts +4 -2
  27. package/src/types/pokerTraining.ts +5 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ankhorage/zora-tabletop
2
2
 
3
+ ## 0.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - ef14cb6: Render poker training tables with the task's actual 6-max or 9-max seat ring.
8
+
9
+ ## 0.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 952a91d: Align plugin placement metadata with ZORA 19 extension hosts, validate composition against ZORA 19.0.1, and refresh the development dependency baseline.
14
+
3
15
  ## 0.1.1
4
16
 
5
17
  ### Patch Changes
@@ -3,8 +3,8 @@ import type { PokerTrainingTableProps } from '../../../../types/pokerTraining';
3
3
  /***
4
4
  * Manifest-ready poker training pattern that reconstructs a complete table from task data.
5
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.
6
+ * Bind the raw training task object to `task`; the pattern maps the task's 6-max or 9-max table
7
+ * state while leaving API execution in the generated application.
8
8
  *
9
9
  * @readme
10
10
  * @example Training task binding
@@ -4,8 +4,8 @@ import { createPokerTrainingTableState } from './createPokerTrainingTableState';
4
4
  /***
5
5
  * Manifest-ready poker training pattern that reconstructs a complete table from task data.
6
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.
7
+ * Bind the raw training task object to `task`; the pattern maps the task's 6-max or 9-max table
8
+ * state while leaving API execution in the generated application.
9
9
  *
10
10
  * @readme
11
11
  * @example Training task binding
@@ -15,6 +15,6 @@ import { createPokerTrainingTableState } from './createPokerTrainingTableState';
15
15
  */
16
16
  export function PokerTrainingTable({ task = {}, defaultStackBigBlinds = 100, accessibilityLabel, ...tableProps }) {
17
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}/>);
18
+ return (<TabletopTable {...tableProps} accessibilityLabel={accessibilityLabel ?? state.accessibilityLabel} centerCards={state.centerCards} centerLabel={state.centerLabel} centerSublabel={state.centerSublabel} seatCount={state.seatCount} seats={state.seats}/>);
19
19
  }
20
20
  //# sourceMappingURL=PokerTrainingTable.js.map
@@ -1 +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"]}
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,KAAK,CAAC,SAAS,CAAC,CAC3B,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 the task's 6-max or 9-max table\n * state 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={state.seatCount}\n seats={state.seats}\n />\n );\n}\n"]}
@@ -2,8 +2,9 @@ import type { CreatePokerTrainingTableStateOptions, PokerTrainingTableState, Pok
2
2
  /***
3
3
  * Adapts the table-relevant subset of a poker training task to generic tabletop presentation state.
4
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.
5
+ * The canonical poker ring for the task table size is rotated so the hero occupies the first
6
+ * (bottom) tabletop seat. Players omitted by the task are reconstructed as folded with the
7
+ * configured default stack.
7
8
  *
8
9
  * @param task - Serializable poker training task data received by the generated application.
9
10
  * @param options - Presentation defaults for task fields that are intentionally omitted.
@@ -1 +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"}
1
+ {"version":3,"file":"createPokerTrainingTableState.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentations/adapters/inbound/createPokerTrainingTableState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oCAAoC,EAGpC,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AAGzC;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,0BAA0B,EAChC,EAAE,qBAA2B,EAAE,GAAE,oCAAyC,GACzE,uBAAuB,CAqCzB"}
@@ -2,17 +2,20 @@ import { createTabletopGameSeats } from '../../domain/createTabletopGameSeats';
2
2
  /***
3
3
  * Adapts the table-relevant subset of a poker training task to generic tabletop presentation state.
4
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.
5
+ * The canonical poker ring for the task table size is rotated so the hero occupies the first
6
+ * (bottom) tabletop seat. Players omitted by the task are reconstructed as folded with the
7
+ * configured default stack.
7
8
  *
8
9
  * @param task - Serializable poker training task data received by the generated application.
9
10
  * @param options - Presentation defaults for task fields that are intentionally omitted.
10
11
  * @returns Seats and shared-table content ready for `TabletopTable`.
11
12
  */
12
13
  export function createPokerTrainingTableState(task, { defaultStackBigBlinds = 100 } = {}) {
14
+ const tableSize = task.tableSize ?? '9max';
15
+ const positions = tableSize === '6max' ? sixMaxPokerPositions : nineMaxPokerPositions;
13
16
  const bigBlind = task.blinds?.big;
14
17
  const heroPosition = task.heroPosition ?? task.players?.find((player) => player.isHero)?.position;
15
- const orderedPositions = rotatePokerPositions(heroPosition);
18
+ const orderedPositions = rotatePokerPositions(positions, heroPosition);
16
19
  const defaultStack = `${formatAmount(defaultStackBigBlinds)} BB`;
17
20
  const participants = (task.players ?? []).map((player) => createPokerParticipantState(player, task, bigBlind));
18
21
  const seats = createTabletopGameSeats({
@@ -31,22 +34,34 @@ export function createPokerTrainingTableState(task, { defaultStackBigBlinds = 10
31
34
  },
32
35
  });
33
36
  return {
37
+ seatCount: positions.length,
34
38
  seats,
35
39
  centerCards: task.communityCards ?? [],
36
40
  centerLabel: task.pot === undefined ? undefined : `Pot ${formatAmount(task.pot)}`,
37
41
  centerSublabel: task.blinds === undefined
38
42
  ? undefined
39
43
  : `Blinds ${formatAmount(task.blinds.small)} / ${formatAmount(task.blinds.big)}`,
40
- accessibilityLabel: createPokerAccessibilityLabel(heroPosition, task),
44
+ accessibilityLabel: createPokerAccessibilityLabel(tableSize, heroPosition, task),
41
45
  };
42
46
  }
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
+ const sixMaxPokerPositions = ['BTN', 'SB', 'BB', 'UTG', 'HJ', 'CO'];
48
+ const nineMaxPokerPositions = [
49
+ 'BTN',
50
+ 'SB',
51
+ 'BB',
52
+ 'UTG',
53
+ 'UTG+1',
54
+ 'UTG+2',
55
+ 'MP',
56
+ 'HJ',
57
+ 'CO',
58
+ ];
59
+ /*** Rotates one canonical poker ring to place the hero at the bottom seat. */
60
+ function rotatePokerPositions(positions, heroPosition) {
61
+ const heroIndex = positions.findIndex((position) => position === heroPosition);
47
62
  if (heroIndex <= 0)
48
- return pokerPositions;
49
- return [...pokerPositions.slice(heroIndex), ...pokerPositions.slice(0, heroIndex)];
63
+ return positions;
64
+ return [...positions.slice(heroIndex), ...positions.slice(0, heroIndex)];
50
65
  }
51
66
  /*** Converts one poker participant record into a generic seat-state override. */
52
67
  function createPokerParticipantState(player, task, bigBlind) {
@@ -84,8 +99,8 @@ function formatAmount(amount) {
84
99
  return new Intl.NumberFormat('en-US', { maximumFractionDigits: 2 }).format(amount);
85
100
  }
86
101
  /*** Summarizes the reconstructed table for assistive technologies. */
87
- function createPokerAccessibilityLabel(heroPosition, task) {
88
- const parts = ['Nine-player poker table'];
102
+ function createPokerAccessibilityLabel(tableSize, heroPosition, task) {
103
+ const parts = [`${tableSize === '6max' ? 'Six' : 'Nine'}-player poker table`];
89
104
  if (heroPosition !== undefined)
90
105
  parts.push(`Hero ${heroPosition}`);
91
106
  if (task.pot !== undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"createPokerTrainingTableState.js","sourceRoot":"","sources":["../../../../../src/features/game-presentations/adapters/inbound/createPokerTrainingTableState.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E;;;;;;;;;GASG;AACH,MAAM,UAAU,6BAA6B,CAC3C,IAAgC,EAChC,EAAE,qBAAqB,GAAG,GAAG,KAA2C,EAAE;IAE1E,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;IAClC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClG,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAC5D,MAAM,YAAY,GAAG,GAAG,YAAY,CAAC,qBAAqB,CAAC,KAAK,CAAC;IACjE,MAAM,YAAY,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,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AG,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"]}
1
+ {"version":3,"file":"createPokerTrainingTableState.js","sourceRoot":"","sources":["../../../../../src/features/game-presentations/adapters/inbound/createPokerTrainingTableState.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,6BAA6B,CAC3C,IAAgC,EAChC,EAAE,qBAAqB,GAAG,GAAG,KAA2C,EAAE;IAE1E,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC;IAC3C,MAAM,SAAS,GAAG,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,qBAAqB,CAAC;IACtF,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;IAClC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,E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,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,SAAiC,EACjC,YAAgC,EAChC,IAAgC;IAEhC,MAAM,KAAK,GAAG,CAAC,GAAG,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,qBAAqB,CAAC,CAAC;IAC9E,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 PokerTrainingTableSize,\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 for the task table size is rotated so the hero occupies the first\n * (bottom) tabletop seat. Players omitted by the task are reconstructed as folded with the\n * 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 tableSize = task.tableSize ?? '9max';\n const positions = tableSize === '6max' ? sixMaxPokerPositions : nineMaxPokerPositions;\n const bigBlind = task.blinds?.big;\n const heroPosition = task.heroPosition ?? task.players?.find((player) => player.isHero)?.position;\n const orderedPositions = rotatePokerPositions(positions, 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 seatCount: positions.length,\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(tableSize, heroPosition, task),\n };\n}\n\nconst sixMaxPokerPositions = ['BTN', 'SB', 'BB', 'UTG', 'HJ', 'CO'] as const;\nconst nineMaxPokerPositions = [\n 'BTN',\n 'SB',\n 'BB',\n 'UTG',\n 'UTG+1',\n 'UTG+2',\n 'MP',\n 'HJ',\n 'CO',\n] as const;\n\n/*** Rotates one canonical poker ring to place the hero at the bottom seat. */\nfunction rotatePokerPositions(\n positions: readonly string[],\n heroPosition: string | undefined,\n): readonly string[] {\n const heroIndex = positions.findIndex((position) => position === heroPosition);\n if (heroIndex <= 0) return positions;\n\n return [...positions.slice(heroIndex), ...positions.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 tableSize: PokerTrainingTableSize,\n heroPosition: string | undefined,\n task: PokerTrainingTaskTableData,\n): string {\n const parts = [`${tableSize === '6max' ? 'Six' : '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"]}
package/dist/index.d.ts CHANGED
@@ -17,5 +17,5 @@ export { ZORA_TABLETOP_COMPONENT_REGISTRY, ZORA_TABLETOP_PLUGIN } from './plugin
17
17
  export { ZORA_PLUGIN_METADATA, ZORA_TABLETOP_COMPONENT_META } from './registry';
18
18
  export type { PlayingCardSuit, PlayingCardValue, TabletopCardSize, TabletopSeatCount, TabletopSeatState, TabletopShape, } from './types';
19
19
  export type { CreateTabletopGameSeatsInput, TabletopGameParticipantState, TabletopGameSeatDefinition, TabletopGameSeatPresentation, } from './types/gamePresentation';
20
- export type { CreatePokerTrainingTableStateOptions, PokerTrainingPlayer, PokerTrainingTableProps, PokerTrainingTableState, PokerTrainingTaskTableData, } from './types/pokerTraining';
20
+ export type { CreatePokerTrainingTableStateOptions, PokerTrainingPlayer, PokerTrainingTableProps, PokerTrainingTableSize, PokerTrainingTableState, PokerTrainingTaskTableData, } from './types/pokerTraining';
21
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,MA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,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"]}
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 PokerTrainingTableSize,\n PokerTrainingTableState,\n PokerTrainingTaskTableData,\n} from './types/pokerTraining';\n"]}
package/dist/plugin.d.ts CHANGED
@@ -268,10 +268,10 @@ export declare const ZORA_TABLETOP_PLUGIN: {
268
268
  };
269
269
  readonly placements: readonly [{
270
270
  readonly child: "PokerTrainingTable";
271
- readonly parents: readonly ["Box", "Card", "Container", "Grid", "Panel", "Screen", "ScreenSection", "Stack"];
271
+ readonly parents: readonly ["Card", "Grid", "Screen", "ScreenSection", "View"];
272
272
  }, {
273
273
  readonly child: "TabletopTable";
274
- readonly parents: readonly ["Box", "Card", "Container", "Grid", "Panel", "Screen", "ScreenSection", "Stack"];
274
+ readonly parents: readonly ["Card", "Grid", "Screen", "ScreenSection", "View"];
275
275
  }];
276
276
  };
277
277
  //# sourceMappingURL=plugin.d.ts.map
@@ -513,10 +513,10 @@ export declare const ZORA_PLUGIN_METADATA: {
513
513
  };
514
514
  readonly placements: readonly [{
515
515
  readonly child: "PokerTrainingTable";
516
- readonly parents: readonly ["Box", "Card", "Container", "Grid", "Panel", "Screen", "ScreenSection", "Stack"];
516
+ readonly parents: readonly ["Card", "Grid", "Screen", "ScreenSection", "View"];
517
517
  }, {
518
518
  readonly child: "TabletopTable";
519
- readonly parents: readonly ["Box", "Card", "Container", "Grid", "Panel", "Screen", "ScreenSection", "Stack"];
519
+ readonly parents: readonly ["Card", "Grid", "Screen", "ScreenSection", "View"];
520
520
  }];
521
521
  };
522
522
  //# sourceMappingURL=registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG/B,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcvB,CAAC"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG/B,CAAC;AAIX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcvB,CAAC"}
package/dist/registry.js CHANGED
@@ -4,6 +4,7 @@ export const ZORA_TABLETOP_COMPONENT_META = {
4
4
  PokerTrainingTable: pokerTrainingTableMeta,
5
5
  TabletopTable: tabletopTableMeta,
6
6
  };
7
+ const TABLETOP_PLACEMENT_PARENTS = ['Card', 'Grid', 'Screen', 'ScreenSection', 'View'];
7
8
  export const ZORA_PLUGIN_METADATA = {
8
9
  packageName: '@ankhorage/zora-tabletop',
9
10
  displayName: 'ZORA Tabletop',
@@ -11,11 +12,11 @@ export const ZORA_PLUGIN_METADATA = {
11
12
  placements: [
12
13
  {
13
14
  child: 'PokerTrainingTable',
14
- parents: ['Box', 'Card', 'Container', 'Grid', 'Panel', 'Screen', 'ScreenSection', 'Stack'],
15
+ parents: TABLETOP_PLACEMENT_PARENTS,
15
16
  },
16
17
  {
17
18
  child: 'TabletopTable',
18
- parents: ['Box', 'Card', 'Container', 'Grid', 'Panel', 'Screen', 'ScreenSection', 'Stack'],
19
+ parents: TABLETOP_PLACEMENT_PARENTS,
19
20
  },
20
21
  ],
21
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,kBAAkB,EAAE,sBAAsB;IAC1C,aAAa,EAAE,iBAAiB;CACxB,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,eAAe;IAC5B,aAAa,EAAE,4BAA4B;IAC3C,UAAU,EAAE;QACV;YACE,KAAK,EAAE,oBAAoB;YAC3B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC;SAC3F;QACD;YACE,KAAK,EAAE,eAAe;YACtB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC;SAC3F;KACF;CACO,CAAC","sourcesContent":["import { pokerTrainingTableMeta } from './features/game-presentations/adapters/inbound/pokerTrainingTableMeta';\nimport { tabletopTableMeta } from './meta';\n\nexport const ZORA_TABLETOP_COMPONENT_META = {\n PokerTrainingTable: pokerTrainingTableMeta,\n TabletopTable: tabletopTableMeta,\n} as const;\n\nexport const ZORA_PLUGIN_METADATA = {\n packageName: '@ankhorage/zora-tabletop',\n displayName: 'ZORA Tabletop',\n componentMeta: ZORA_TABLETOP_COMPONENT_META,\n placements: [\n {\n child: 'PokerTrainingTable',\n parents: ['Box', 'Card', 'Container', 'Grid', 'Panel', 'Screen', 'ScreenSection', 'Stack'],\n },\n {\n child: 'TabletopTable',\n parents: ['Box', 'Card', 'Container', 'Grid', 'Panel', 'Screen', 'ScreenSection', 'Stack'],\n },\n ],\n} as const;\n"]}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,kBAAkB,EAAE,sBAAsB;IAC1C,aAAa,EAAE,iBAAiB;CACxB,CAAC;AAEX,MAAM,0BAA0B,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAU,CAAC;AAEhG,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,eAAe;IAC5B,aAAa,EAAE,4BAA4B;IAC3C,UAAU,EAAE;QACV;YACE,KAAK,EAAE,oBAAoB;YAC3B,OAAO,EAAE,0BAA0B;SACpC;QACD;YACE,KAAK,EAAE,eAAe;YACtB,OAAO,EAAE,0BAA0B;SACpC;KACF;CACO,CAAC","sourcesContent":["import { pokerTrainingTableMeta } from './features/game-presentations/adapters/inbound/pokerTrainingTableMeta';\nimport { tabletopTableMeta } from './meta';\n\nexport const ZORA_TABLETOP_COMPONENT_META = {\n PokerTrainingTable: pokerTrainingTableMeta,\n TabletopTable: tabletopTableMeta,\n} as const;\n\nconst TABLETOP_PLACEMENT_PARENTS = ['Card', 'Grid', 'Screen', 'ScreenSection', 'View'] as const;\n\nexport const ZORA_PLUGIN_METADATA = {\n packageName: '@ankhorage/zora-tabletop',\n displayName: 'ZORA Tabletop',\n componentMeta: ZORA_TABLETOP_COMPONENT_META,\n placements: [\n {\n child: 'PokerTrainingTable',\n parents: TABLETOP_PLACEMENT_PARENTS,\n },\n {\n child: 'TabletopTable',\n parents: TABLETOP_PLACEMENT_PARENTS,\n },\n ],\n} as const;\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { TabletopColorOverrides } from '../colors';
2
- import type { PlayingCardValue, TabletopCardSize, TabletopSeatState, TabletopShape } from '../types';
2
+ import type { PlayingCardValue, TabletopCardSize, TabletopSeatCount, TabletopSeatState, TabletopShape } from '../types';
3
3
  export interface PokerTrainingPlayer {
4
4
  readonly position: string;
5
5
  readonly stack?: number;
@@ -8,7 +8,9 @@ export interface PokerTrainingPlayer {
8
8
  readonly folded?: boolean;
9
9
  readonly isHero?: boolean;
10
10
  }
11
+ export type PokerTrainingTableSize = '6max' | '9max';
11
12
  export interface PokerTrainingTaskTableData {
13
+ readonly tableSize?: PokerTrainingTableSize;
12
14
  readonly blinds?: {
13
15
  readonly small: number;
14
16
  readonly big: number;
@@ -23,6 +25,7 @@ export interface CreatePokerTrainingTableStateOptions {
23
25
  readonly defaultStackBigBlinds?: number;
24
26
  }
25
27
  export interface PokerTrainingTableState {
28
+ readonly seatCount: TabletopSeatCount;
26
29
  readonly seats: readonly TabletopSeatState[];
27
30
  readonly centerCards: readonly PlayingCardValue[];
28
31
  readonly centerLabel?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"pokerTraining.d.ts","sourceRoot":"","sources":["../../src/types/pokerTraining.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC7C,QAAQ,CAAC,MA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Q,CAAC,OAAO,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;CACnD;AAED,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CACzC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC7C,QAAQ,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAClD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,0BAA0B,CAAC;IAC3C,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,sBAAsB,CAAC;IAC9C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"pokerTraining.js","sourceRoot":"","sources":["../../src/types/pokerTraining.ts"],"names":[],"mappings":"","sourcesContent":["import type { TabletopColorOverrides } from '../colors';\nimport type {\n PlayingCardValue,\n TabletopCardSize,\n TabletopSeatState,\n TabletopShape,\n} from '../types';\n\nexport interface PokerTrainingPlayer {\n readonly position: string;\n readonly stack?: number;\n readonly bet?: number;\n readonly cards?: readonly PlayingCardValue[];\n readonly folded?: boolean;\n readonly isHero?: boolean;\n}\n\nexport interface PokerTrainingTaskTableData {\n readonly blinds?: {\n readonly small: number;\n readonly big: number;\n };\n readonly heroPosition?: string;\n readonly heroCards?: readonly PlayingCardValue[];\n readonly communityCards?: readonly PlayingCardValue[];\n readonly pot?: number;\n readonly players?: readonly PokerTrainingPlayer[];\n}\n\nexport interface CreatePokerTrainingTableStateOptions {\n readonly defaultStackBigBlinds?: number;\n}\n\nexport interface PokerTrainingTableState {\n readonly seats: readonly TabletopSeatState[];\n readonly centerCards: readonly PlayingCardValue[];\n readonly centerLabel?: string;\n readonly centerSublabel?: string;\n readonly accessibilityLabel: string;\n}\n\nexport interface PokerTrainingTableProps {\n readonly task?: PokerTrainingTaskTableData;\n readonly defaultStackBigBlinds?: number;\n readonly shape?: TabletopShape;\n readonly cardSize?: TabletopCardSize;\n readonly disabled?: boolean;\n readonly colorScheme?: TabletopColorOverrides;\n readonly accessibilityLabel?: string;\n readonly testID?: string;\n}\n"]}
1
+ {"version":3,"file":"pokerTraining.js","sourceRoot":"","sources":["../../src/types/pokerTraining.ts"],"names":[],"mappings":"","sourcesContent":["import type { TabletopColorOverrides } from '../colors';\nimport type {\n PlayingCardValue,\n TabletopCardSize,\n TabletopSeatCount,\n TabletopSeatState,\n TabletopShape,\n} from '../types';\n\nexport interface PokerTrainingPlayer {\n readonly position: string;\n readonly stack?: number;\n readonly bet?: number;\n readonly cards?: readonly PlayingCardValue[];\n readonly folded?: boolean;\n readonly isHero?: boolean;\n}\n\nexport type PokerTrainingTableSize = '6max' | '9max';\n\nexport interface PokerTrainingTaskTableData {\n readonly tableSize?: PokerTrainingTableSize;\n readonly blinds?: {\n readonly small: number;\n readonly big: number;\n };\n readonly heroPosition?: string;\n readonly heroCards?: readonly PlayingCardValue[];\n readonly communityCards?: readonly PlayingCardValue[];\n readonly pot?: number;\n readonly players?: readonly PokerTrainingPlayer[];\n}\n\nexport interface CreatePokerTrainingTableStateOptions {\n readonly defaultStackBigBlinds?: number;\n}\n\nexport interface PokerTrainingTableState {\n readonly seatCount: TabletopSeatCount;\n readonly seats: readonly TabletopSeatState[];\n readonly centerCards: readonly PlayingCardValue[];\n readonly centerLabel?: string;\n readonly centerSublabel?: string;\n readonly accessibilityLabel: string;\n}\n\nexport interface PokerTrainingTableProps {\n readonly task?: PokerTrainingTaskTableData;\n readonly defaultStackBigBlinds?: number;\n readonly shape?: TabletopShape;\n readonly cardSize?: TabletopCardSize;\n readonly disabled?: boolean;\n readonly colorScheme?: TabletopColorOverrides;\n readonly accessibilityLabel?: string;\n readonly testID?: string;\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/zora-tabletop",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "description": "Tabletop and card-game UI primitives for React Native and React Native Web, built on ZORA.",
6
6
  "homepage": "https://github.com/ankhorage/zora-tabletop#readme",
7
7
  "bugs": {
@@ -76,8 +76,7 @@
76
76
  "devDependencies": {
77
77
  "@ankhorage/devtools": "^1.11.11",
78
78
  "@ankhorage/paradox": "^0.1.24",
79
- "@ankhorage/zora": "^4.2.2",
80
- "@react-native-picker/picker": "2.11.4",
79
+ "@ankhorage/zora": "^19.0.1",
81
80
  "@react-native-vector-icons/fontawesome": "^13.1.3",
82
81
  "@react-native-vector-icons/fontawesome5": "^13.1.3",
83
82
  "@react-native-vector-icons/fontawesome6": "^13.1.3",
@@ -7,8 +7,8 @@ import { createPokerTrainingTableState } from './createPokerTrainingTableState';
7
7
  /***
8
8
  * Manifest-ready poker training pattern that reconstructs a complete table from task data.
9
9
  *
10
- * Bind the raw training task object to `task`; the pattern maps sparse active-player data to a
11
- * full nine-seat presentation while leaving API execution in the generated application.
10
+ * Bind the raw training task object to `task`; the pattern maps the task's 6-max or 9-max table
11
+ * state while leaving API execution in the generated application.
12
12
  *
13
13
  * @readme
14
14
  * @example Training task binding
@@ -34,7 +34,7 @@ export function PokerTrainingTable({
34
34
  centerCards={state.centerCards}
35
35
  centerLabel={state.centerLabel}
36
36
  centerSublabel={state.centerSublabel}
37
- seatCount={9}
37
+ seatCount={state.seatCount}
38
38
  seats={state.seats}
39
39
  />
40
40
  );
@@ -4,6 +4,7 @@ import type { PokerTrainingTaskTableData } from '../../../../types/pokerTraining
4
4
  import { createPokerTrainingTableState } from './createPokerTrainingTableState';
5
5
 
6
6
  const liveTask: PokerTrainingTaskTableData = {
7
+ tableSize: '9max',
7
8
  blinds: { small: 50, big: 100 },
8
9
  heroPosition: 'BTN',
9
10
  heroCards: [
@@ -23,9 +24,10 @@ const liveTask: PokerTrainingTaskTableData = {
23
24
  ],
24
25
  };
25
26
 
26
- test('createPokerTrainingTableState reconstructs a sparse task as nine seats', () => {
27
+ test('createPokerTrainingTableState reconstructs a sparse 9-max task with gateway positions', () => {
27
28
  const state = createPokerTrainingTableState(liveTask);
28
29
 
30
+ expect(state.seatCount).toBe(9);
29
31
  expect(state.seats).toHaveLength(9);
30
32
  expect(state.seats.map((seat) => seat.id)).toEqual([
31
33
  'BTN',
@@ -33,8 +35,8 @@ test('createPokerTrainingTableState reconstructs a sparse task as nine seats', (
33
35
  'BB',
34
36
  'UTG',
35
37
  'UTG+1',
38
+ 'UTG+2',
36
39
  'MP',
37
- 'MP+1',
38
40
  'HJ',
39
41
  'CO',
40
42
  ]);
@@ -58,6 +60,29 @@ test('createPokerTrainingTableState reconstructs a sparse task as nine seats', (
58
60
  });
59
61
  });
60
62
 
63
+ test('createPokerTrainingTableState reconstructs the canonical 6-max ring', () => {
64
+ const state = createPokerTrainingTableState({
65
+ ...liveTask,
66
+ tableSize: '6max',
67
+ heroPosition: 'HJ',
68
+ players: [
69
+ { position: 'UTG', stack: 7500, folded: true },
70
+ { position: 'HJ', stack: 9200, isHero: true },
71
+ { position: 'CO', stack: 10100 },
72
+ { position: 'BTN', stack: 11000 },
73
+ { position: 'SB', stack: 9950, bet: 50 },
74
+ { position: 'BB', stack: 9900, bet: 100 },
75
+ ],
76
+ });
77
+
78
+ expect(state.seatCount).toBe(6);
79
+ expect(state.seats.map((seat) => seat.id)).toEqual(['HJ', 'CO', 'BTN', 'SB', 'BB', 'UTG']);
80
+ expect(state.seats[0]).toMatchObject({ id: 'HJ', cards: liveTask.heroCards, selected: true });
81
+ expect(state.accessibilityLabel).toBe(
82
+ 'Six-player poker table. Hero HJ. Pot 1,200. Blinds 50 / 100.',
83
+ );
84
+ });
85
+
61
86
  test('createPokerTrainingTableState maps shared live task state', () => {
62
87
  const state = createPokerTrainingTableState(liveTask);
63
88
 
@@ -88,8 +113,8 @@ test('createPokerTrainingTableState rotates another hero to the bottom seat', ()
88
113
  'BB',
89
114
  'UTG',
90
115
  'UTG+1',
116
+ 'UTG+2',
91
117
  'MP',
92
- 'MP+1',
93
118
  'HJ',
94
119
  ]);
95
120
  });
@@ -124,6 +149,7 @@ test('createPokerTrainingTableState maps folded and visible opponent state', ()
124
149
  test('createPokerTrainingTableState uses a configurable folded stack', () => {
125
150
  const state = createPokerTrainingTableState({}, { defaultStackBigBlinds: 75 });
126
151
 
152
+ expect(state.seatCount).toBe(9);
127
153
  expect(state.seats[0]?.sublabel).toBe('75 BB · Folded');
128
154
  expect(state.centerLabel).toBeUndefined();
129
155
  expect(state.centerSublabel).toBeUndefined();
@@ -2,6 +2,7 @@ import type { TabletopGameParticipantState } from '../../../../types/gamePresent
2
2
  import type {
3
3
  CreatePokerTrainingTableStateOptions,
4
4
  PokerTrainingPlayer,
5
+ PokerTrainingTableSize,
5
6
  PokerTrainingTableState,
6
7
  PokerTrainingTaskTableData,
7
8
  } from '../../../../types/pokerTraining';
@@ -10,8 +11,9 @@ import { createTabletopGameSeats } from '../../domain/createTabletopGameSeats';
10
11
  /***
11
12
  * Adapts the table-relevant subset of a poker training task to generic tabletop presentation state.
12
13
  *
13
- * The canonical poker ring is rotated so the hero occupies the first (bottom) tabletop seat.
14
- * Players omitted by the task are reconstructed as folded with the configured default stack.
14
+ * The canonical poker ring for the task table size is rotated so the hero occupies the first
15
+ * (bottom) tabletop seat. Players omitted by the task are reconstructed as folded with the
16
+ * configured default stack.
15
17
  *
16
18
  * @param task - Serializable poker training task data received by the generated application.
17
19
  * @param options - Presentation defaults for task fields that are intentionally omitted.
@@ -21,9 +23,11 @@ export function createPokerTrainingTableState(
21
23
  task: PokerTrainingTaskTableData,
22
24
  { defaultStackBigBlinds = 100 }: CreatePokerTrainingTableStateOptions = {},
23
25
  ): PokerTrainingTableState {
26
+ const tableSize = task.tableSize ?? '9max';
27
+ const positions = tableSize === '6max' ? sixMaxPokerPositions : nineMaxPokerPositions;
24
28
  const bigBlind = task.blinds?.big;
25
29
  const heroPosition = task.heroPosition ?? task.players?.find((player) => player.isHero)?.position;
26
- const orderedPositions = rotatePokerPositions(heroPosition);
30
+ const orderedPositions = rotatePokerPositions(positions, heroPosition);
27
31
  const defaultStack = `${formatAmount(defaultStackBigBlinds)} BB`;
28
32
  const participants = (task.players ?? []).map((player) =>
29
33
  createPokerParticipantState(player, task, bigBlind),
@@ -45,6 +49,7 @@ export function createPokerTrainingTableState(
45
49
  });
46
50
 
47
51
  return {
52
+ seatCount: positions.length,
48
53
  seats,
49
54
  centerCards: task.communityCards ?? [],
50
55
  centerLabel: task.pot === undefined ? undefined : `Pot ${formatAmount(task.pot)}`,
@@ -52,18 +57,32 @@ export function createPokerTrainingTableState(
52
57
  task.blinds === undefined
53
58
  ? undefined
54
59
  : `Blinds ${formatAmount(task.blinds.small)} / ${formatAmount(task.blinds.big)}`,
55
- accessibilityLabel: createPokerAccessibilityLabel(heroPosition, task),
60
+ accessibilityLabel: createPokerAccessibilityLabel(tableSize, heroPosition, task),
56
61
  };
57
62
  }
58
63
 
59
- const pokerPositions = ['BTN', 'SB', 'BB', 'UTG', 'UTG+1', 'MP', 'MP+1', 'HJ', 'CO'] as const;
64
+ const sixMaxPokerPositions = ['BTN', 'SB', 'BB', 'UTG', 'HJ', 'CO'] as const;
65
+ const nineMaxPokerPositions = [
66
+ 'BTN',
67
+ 'SB',
68
+ 'BB',
69
+ 'UTG',
70
+ 'UTG+1',
71
+ 'UTG+2',
72
+ 'MP',
73
+ 'HJ',
74
+ 'CO',
75
+ ] as const;
60
76
 
61
- /*** Rotates the canonical nine-seat poker ring to place the hero at the bottom seat. */
62
- function rotatePokerPositions(heroPosition: string | undefined): readonly string[] {
63
- const heroIndex = pokerPositions.findIndex((position) => position === heroPosition);
64
- if (heroIndex <= 0) return pokerPositions;
77
+ /*** Rotates one canonical poker ring to place the hero at the bottom seat. */
78
+ function rotatePokerPositions(
79
+ positions: readonly string[],
80
+ heroPosition: string | undefined,
81
+ ): readonly string[] {
82
+ const heroIndex = positions.findIndex((position) => position === heroPosition);
83
+ if (heroIndex <= 0) return positions;
65
84
 
66
- return [...pokerPositions.slice(heroIndex), ...pokerPositions.slice(0, heroIndex)];
85
+ return [...positions.slice(heroIndex), ...positions.slice(0, heroIndex)];
67
86
  }
68
87
 
69
88
  /*** Converts one poker participant record into a generic seat-state override. */
@@ -119,10 +138,11 @@ function formatAmount(amount: number): string {
119
138
 
120
139
  /*** Summarizes the reconstructed table for assistive technologies. */
121
140
  function createPokerAccessibilityLabel(
141
+ tableSize: PokerTrainingTableSize,
122
142
  heroPosition: string | undefined,
123
143
  task: PokerTrainingTaskTableData,
124
144
  ): string {
125
- const parts = ['Nine-player poker table'];
145
+ const parts = [`${tableSize === '6max' ? 'Six' : 'Nine'}-player poker table`];
126
146
  if (heroPosition !== undefined) parts.push(`Hero ${heroPosition}`);
127
147
  if (task.pot !== undefined) parts.push(`Pot ${formatAmount(task.pot)}`);
128
148
  if (task.blinds !== undefined) {
package/src/index.ts CHANGED
@@ -33,6 +33,7 @@ export type {
33
33
  CreatePokerTrainingTableStateOptions,
34
34
  PokerTrainingPlayer,
35
35
  PokerTrainingTableProps,
36
+ PokerTrainingTableSize,
36
37
  PokerTrainingTableState,
37
38
  PokerTrainingTaskTableData,
38
39
  } from './types/pokerTraining';
package/src/meta.test.ts CHANGED
@@ -1,8 +1,9 @@
1
+ import { composeZoraPluginMetadata, ZORA_CORE_PLUGIN_METADATA } from '@ankhorage/zora/metadata';
1
2
  import { describe, expect, test } from 'bun:test';
2
3
 
3
4
  import { pokerTrainingTableMeta } from './features/game-presentations/adapters/inbound/pokerTrainingTableMeta';
4
5
  import { tabletopTableMeta } from './meta';
5
- import { ZORA_TABLETOP_COMPONENT_META } from './registry';
6
+ import { ZORA_PLUGIN_METADATA, ZORA_TABLETOP_COMPONENT_META } from './registry';
6
7
 
7
8
  describe('ZORA tabletop component metadata', () => {
8
9
  test('exposes TabletopTable as a directly authorable manifest node', () => {
@@ -52,3 +53,15 @@ describe('ZORA tabletop component metadata', () => {
52
53
  ]);
53
54
  });
54
55
  });
56
+
57
+ describe('ZORA 19 plugin composition', () => {
58
+ test('uses only declared core extension hosts', () => {
59
+ expect(() =>
60
+ composeZoraPluginMetadata([ZORA_CORE_PLUGIN_METADATA, ZORA_PLUGIN_METADATA]),
61
+ ).not.toThrow();
62
+ expect(ZORA_PLUGIN_METADATA.placements.map((placement) => placement.parents)).toEqual([
63
+ ['Card', 'Grid', 'Screen', 'ScreenSection', 'View'],
64
+ ['Card', 'Grid', 'Screen', 'ScreenSection', 'View'],
65
+ ]);
66
+ });
67
+ });
package/src/registry.ts CHANGED
@@ -6,6 +6,8 @@ export const ZORA_TABLETOP_COMPONENT_META = {
6
6
  TabletopTable: tabletopTableMeta,
7
7
  } as const;
8
8
 
9
+ const TABLETOP_PLACEMENT_PARENTS = ['Card', 'Grid', 'Screen', 'ScreenSection', 'View'] as const;
10
+
9
11
  export const ZORA_PLUGIN_METADATA = {
10
12
  packageName: '@ankhorage/zora-tabletop',
11
13
  displayName: 'ZORA Tabletop',
@@ -13,11 +15,11 @@ export const ZORA_PLUGIN_METADATA = {
13
15
  placements: [
14
16
  {
15
17
  child: 'PokerTrainingTable',
16
- parents: ['Box', 'Card', 'Container', 'Grid', 'Panel', 'Screen', 'ScreenSection', 'Stack'],
18
+ parents: TABLETOP_PLACEMENT_PARENTS,
17
19
  },
18
20
  {
19
21
  child: 'TabletopTable',
20
- parents: ['Box', 'Card', 'Container', 'Grid', 'Panel', 'Screen', 'ScreenSection', 'Stack'],
22
+ parents: TABLETOP_PLACEMENT_PARENTS,
21
23
  },
22
24
  ],
23
25
  } as const;
@@ -2,6 +2,7 @@ import type { TabletopColorOverrides } from '../colors';
2
2
  import type {
3
3
  PlayingCardValue,
4
4
  TabletopCardSize,
5
+ TabletopSeatCount,
5
6
  TabletopSeatState,
6
7
  TabletopShape,
7
8
  } from '../types';
@@ -15,7 +16,10 @@ export interface PokerTrainingPlayer {
15
16
  readonly isHero?: boolean;
16
17
  }
17
18
 
19
+ export type PokerTrainingTableSize = '6max' | '9max';
20
+
18
21
  export interface PokerTrainingTaskTableData {
22
+ readonly tableSize?: PokerTrainingTableSize;
19
23
  readonly blinds?: {
20
24
  readonly small: number;
21
25
  readonly big: number;
@@ -32,6 +36,7 @@ export interface CreatePokerTrainingTableStateOptions {
32
36
  }
33
37
 
34
38
  export interface PokerTrainingTableState {
39
+ readonly seatCount: TabletopSeatCount;
35
40
  readonly seats: readonly TabletopSeatState[];
36
41
  readonly centerCards: readonly PlayingCardValue[];
37
42
  readonly centerLabel?: string;