@ankhorage/zora-game 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/dist/ZORA_GAME_COMPONENT_META.d.ts +125 -1
  4. package/dist/ZORA_GAME_COMPONENT_META.d.ts.map +1 -1
  5. package/dist/ZORA_GAME_COMPONENT_META.js +2 -0
  6. package/dist/ZORA_GAME_COMPONENT_META.js.map +1 -1
  7. package/dist/ZORA_GAME_PLUGIN.d.ts +130 -1
  8. package/dist/ZORA_GAME_PLUGIN.d.ts.map +1 -1
  9. package/dist/ZORA_GAME_PLUGIN.js +2 -0
  10. package/dist/ZORA_GAME_PLUGIN.js.map +1 -1
  11. package/dist/ZORA_PLUGIN_METADATA.d.ts +128 -1
  12. package/dist/ZORA_PLUGIN_METADATA.d.ts.map +1 -1
  13. package/dist/ZORA_PLUGIN_METADATA.js +4 -0
  14. package/dist/ZORA_PLUGIN_METADATA.js.map +1 -1
  15. package/dist/features/game-presentation/adapters/inbound/Game.d.ts.map +1 -1
  16. package/dist/features/game-presentation/adapters/inbound/Game.js +4 -1
  17. package/dist/features/game-presentation/adapters/inbound/Game.js.map +1 -1
  18. package/dist/features/game-presentation/adapters/inbound/GameEntity.d.ts +2 -1
  19. package/dist/features/game-presentation/adapters/inbound/GameEntity.d.ts.map +1 -1
  20. package/dist/features/game-presentation/adapters/inbound/GameEntity.js +14 -4
  21. package/dist/features/game-presentation/adapters/inbound/GameEntity.js.map +1 -1
  22. package/dist/features/game-presentation/adapters/inbound/GameMeasurementProbe.d.ts +4 -0
  23. package/dist/features/game-presentation/adapters/inbound/GameMeasurementProbe.d.ts.map +1 -0
  24. package/dist/features/game-presentation/adapters/inbound/GameMeasurementProbe.js +52 -0
  25. package/dist/features/game-presentation/adapters/inbound/GameMeasurementProbe.js.map +1 -0
  26. package/dist/features/game-presentation/adapters/inbound/createGameMeasurementEvent.d.ts +14 -0
  27. package/dist/features/game-presentation/adapters/inbound/createGameMeasurementEvent.d.ts.map +1 -0
  28. package/dist/features/game-presentation/adapters/inbound/createGameMeasurementEvent.js +25 -0
  29. package/dist/features/game-presentation/adapters/inbound/createGameMeasurementEvent.js.map +1 -0
  30. package/dist/features/game-presentation/adapters/inbound/measureGameEntity.d.ts +5 -0
  31. package/dist/features/game-presentation/adapters/inbound/measureGameEntity.d.ts.map +1 -0
  32. package/dist/features/game-presentation/adapters/inbound/measureGameEntity.js +22 -0
  33. package/dist/features/game-presentation/adapters/inbound/measureGameEntity.js.map +1 -0
  34. package/dist/features/game-presentation/composition/createGameMeasurementRegistry.d.ts +4 -0
  35. package/dist/features/game-presentation/composition/createGameMeasurementRegistry.d.ts.map +1 -0
  36. package/dist/features/game-presentation/composition/createGameMeasurementRegistry.js +15 -0
  37. package/dist/features/game-presentation/composition/createGameMeasurementRegistry.js.map +1 -0
  38. package/dist/features/game-presentation/composition/useGameRuntime.d.ts +2 -2
  39. package/dist/features/game-presentation/composition/useGameRuntime.d.ts.map +1 -1
  40. package/dist/features/game-presentation/composition/useGameRuntime.js.map +1 -1
  41. package/dist/features/game-presentation/meta/gameEntityMeta.d.ts +14 -0
  42. package/dist/features/game-presentation/meta/gameEntityMeta.d.ts.map +1 -1
  43. package/dist/features/game-presentation/meta/gameEntityMeta.js +7 -0
  44. package/dist/features/game-presentation/meta/gameEntityMeta.js.map +1 -1
  45. package/dist/features/game-presentation/meta/gameMeasurementProbeMeta.d.ts +112 -0
  46. package/dist/features/game-presentation/meta/gameMeasurementProbeMeta.d.ts.map +1 -0
  47. package/dist/features/game-presentation/meta/gameMeasurementProbeMeta.js +70 -0
  48. package/dist/features/game-presentation/meta/gameMeasurementProbeMeta.js.map +1 -0
  49. package/dist/features/game-presentation/meta/gameMeta.d.ts +1 -1
  50. package/dist/features/game-presentation/meta/gameMeta.d.ts.map +1 -1
  51. package/dist/features/game-presentation/meta/gameMeta.js +9 -1
  52. package/dist/features/game-presentation/meta/gameMeta.js.map +1 -1
  53. package/dist/features/game-presentation/public.d.ts +2 -1
  54. package/dist/features/game-presentation/public.d.ts.map +1 -1
  55. package/dist/features/game-presentation/public.js +1 -0
  56. package/dist/features/game-presentation/public.js.map +1 -1
  57. package/dist/index.d.ts +2 -2
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/index.js.map +1 -1
  61. package/dist/types/gamePresentation.d.ts +9 -0
  62. package/dist/types/gamePresentation.d.ts.map +1 -1
  63. package/dist/types/gamePresentation.js.map +1 -1
  64. package/dist/types/gameRuntime.d.ts +16 -1
  65. package/dist/types/gameRuntime.d.ts.map +1 -1
  66. package/dist/types/gameRuntime.js.map +1 -1
  67. package/package.json +1 -1
  68. package/src/ZORA_GAME_COMPONENT_META.ts +2 -0
  69. package/src/ZORA_GAME_PLUGIN.ts +2 -0
  70. package/src/ZORA_PLUGIN_METADATA.test.ts +18 -0
  71. package/src/ZORA_PLUGIN_METADATA.ts +4 -0
  72. package/src/features/game-presentation/adapters/inbound/Game.tsx +7 -1
  73. package/src/features/game-presentation/adapters/inbound/GameEntity.tsx +15 -2
  74. package/src/features/game-presentation/adapters/inbound/GameMeasurementProbe.tsx +79 -0
  75. package/src/features/game-presentation/adapters/inbound/createGameMeasurementEvent.test.ts +56 -0
  76. package/src/features/game-presentation/adapters/inbound/createGameMeasurementEvent.ts +38 -0
  77. package/src/features/game-presentation/adapters/inbound/measureGameEntity.ts +28 -0
  78. package/src/features/game-presentation/composition/createGameMeasurementRegistry.test.ts +35 -0
  79. package/src/features/game-presentation/composition/createGameMeasurementRegistry.ts +16 -0
  80. package/src/features/game-presentation/composition/useGameRuntime.ts +3 -3
  81. package/src/features/game-presentation/meta/gameEntityMeta.ts +7 -0
  82. package/src/features/game-presentation/meta/gameMeasurementProbeMeta.ts +72 -0
  83. package/src/features/game-presentation/meta/gameMeta.ts +9 -1
  84. package/src/features/game-presentation/public.ts +2 -0
  85. package/src/index.ts +2 -0
  86. package/src/types/gamePresentation.ts +10 -0
  87. package/src/types/gameRuntime.ts +19 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Game.js","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/Game.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,kGAAkG;AAClG,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,CACxC,GAAG,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,wBAAwB,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EACrE,CAAC,OAAO,CAAC,OAAO,CAAC,CAClB,CAAC;IAEF,OAAO,CACL,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAC1C;MAAA,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAC,oBAAoB,CAAC,CACzD;QAAA,CAAC,SAAS,CACR,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAChF,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAC1E,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAC3D,IAAI,CAAC,KAAK,CAAC,kBAAkB,KAAK,SAAS;QACzC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,EAAE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC,CACtD,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAEjE;UAAA,CAAC,KAAK,CAAC,QAAQ,CACjB;QAAA,EAAE,SAAS,CACb;MAAA,EAAE,6BAA6B,CACjC;IAAA,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAC/B,CAAC;AACJ,CAAC","sourcesContent":["import { RuntimeRendererConfigProvider } from '@ankhorage/runtime';\nimport React from 'react';\n\nimport type { GameProps } from '../../../../types/gamePresentation';\nimport { createGameBindingContext } from '../../composition/createGameBindingContext';\nimport { GameRuntimeContext } from '../../composition/GameRuntimeContext';\nimport { useGameRuntime } from '../../composition/useGameRuntime';\nimport { GameField } from './GameField';\n\n/*** Bind one serializable game definition to a local transient session and presentation field. */\nexport function Game(props: GameProps) {\n const runtime = useGameRuntime(props);\n const runtimeBindingConfig = React.useMemo(\n () => ({ bindingContext: createGameBindingContext(runtime.session) }),\n [runtime.session],\n );\n\n return (\n <GameRuntimeContext.Provider value={runtime}>\n <RuntimeRendererConfigProvider value={runtimeBindingConfig}>\n <GameField\n {...(props.aspectRatio === undefined ? {} : { aspectRatio: props.aspectRatio })}\n {...(props.minHeight === undefined ? {} : { minHeight: props.minHeight })}\n {...(props.clip === undefined ? {} : { clip: props.clip })}\n {...(props.accessibilityLabel === undefined\n ? {}\n : { accessibilityLabel: props.accessibilityLabel })}\n {...(props.testID === undefined ? {} : { testID: props.testID })}\n >\n {props.children}\n </GameField>\n </RuntimeRendererConfigProvider>\n </GameRuntimeContext.Provider>\n );\n}\n"]}
1
+ {"version":3,"file":"Game.js","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/Game.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,kGAAkG;AAClG,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;IAC5E,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAClC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,mBAAmB,EAAE,CAAC,EAC9C,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAC/B,CAAC;IACF,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,CACxC,GAAG,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,wBAAwB,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EACrE,CAAC,OAAO,CAAC,OAAO,CAAC,CAClB,CAAC;IAEF,OAAO,CACL,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CACjD;MAAA,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAC,oBAAoB,CAAC,CACzD;QAAA,CAAC,SAAS,CACR,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAChF,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAC1E,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAC3D,IAAI,CAAC,KAAK,CAAC,kBAAkB,KAAK,SAAS;QACzC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,EAAE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC,CACtD,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAEjE;UAAA,CAAC,KAAK,CAAC,QAAQ,CACjB;QAAA,EAAE,SAAS,CACb;MAAA,EAAE,6BAA6B,CACjC;IAAA,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAC/B,CAAC;AACJ,CAAC","sourcesContent":["import { RuntimeRendererConfigProvider } from '@ankhorage/runtime';\nimport React from 'react';\n\nimport type { GameProps } from '../../../../types/gamePresentation';\nimport { createGameBindingContext } from '../../composition/createGameBindingContext';\nimport { createGameMeasurementRegistry } from '../../composition/createGameMeasurementRegistry';\nimport { GameRuntimeContext } from '../../composition/GameRuntimeContext';\nimport { useGameRuntime } from '../../composition/useGameRuntime';\nimport { GameField } from './GameField';\n\n/*** Bind one serializable game definition to a local transient session and presentation field. */\nexport function Game(props: GameProps) {\n const runtime = useGameRuntime(props);\n const [measurementRegistry] = React.useState(createGameMeasurementRegistry);\n const runtimeContext = React.useMemo(\n () => ({ ...runtime, ...measurementRegistry }),\n [measurementRegistry, runtime],\n );\n const runtimeBindingConfig = React.useMemo(\n () => ({ bindingContext: createGameBindingContext(runtime.session) }),\n [runtime.session],\n );\n\n return (\n <GameRuntimeContext.Provider value={runtimeContext}>\n <RuntimeRendererConfigProvider value={runtimeBindingConfig}>\n <GameField\n {...(props.aspectRatio === undefined ? {} : { aspectRatio: props.aspectRatio })}\n {...(props.minHeight === undefined ? {} : { minHeight: props.minHeight })}\n {...(props.clip === undefined ? {} : { clip: props.clip })}\n {...(props.accessibilityLabel === undefined\n ? {}\n : { accessibilityLabel: props.accessibilityLabel })}\n {...(props.testID === undefined ? {} : { testID: props.testID })}\n >\n {props.children}\n </GameField>\n </RuntimeRendererConfigProvider>\n </GameRuntimeContext.Provider>\n );\n}\n"]}
@@ -1,4 +1,5 @@
1
+ import React from 'react';
1
2
  import type { GameEntityProps } from '../../../../types/gamePresentation';
2
3
  /*** Render one generic positioned game entity without owning gameplay semantics. */
3
- export declare function GameEntity({ children, x, y, width, height, opacity, scale, rotation, zIndex, hidden, pointerEvents, accessibilityLabel, testID, }: GameEntityProps): import("react").JSX.Element;
4
+ export declare function GameEntity({ children, x, y, width, height, opacity, scale, rotation, zIndex, hidden, pointerEvents, measurementId, accessibilityLabel, testID, }: GameEntityProps): React.JSX.Element;
4
5
  //# sourceMappingURL=GameEntity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GameEntity.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAG1E,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,CAAK,EACL,CAAK,EACL,KAAK,EACL,MAAM,EACN,OAAW,EACX,KAAS,EACT,QAAY,EACZ,MAAU,EACV,MAAc,EACd,aAAsB,EACtB,kBAAkB,EAClB,MAAM,GACP,EAAE,eAAe,+BAcjB"}
1
+ {"version":3,"file":"GameEntity.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAK1E,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,CAAK,EACL,CAAK,EACL,KAAK,EACL,MAAM,EACN,OAAW,EACX,KAAS,EACT,QAAY,EACZ,MAAU,EACV,MAAc,EACd,aAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,MAAM,GACP,EAAE,eAAe,qBAwBjB"}
@@ -1,9 +1,19 @@
1
- import { View } from '@ankhorage/zora';
2
- import { StyleSheet } from 'react-native';
1
+ import React from 'react';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import { GameRuntimeContext } from '../../composition/GameRuntimeContext';
3
4
  import { toGamePercentage } from '../../utils/toGamePercentage';
5
+ import { measureGameEntity } from './measureGameEntity';
4
6
  /*** Render one generic positioned game entity without owning gameplay semantics. */
5
- export function GameEntity({ children, x = 0, y = 0, width, height, opacity = 1, scale = 1, rotation = 0, zIndex = 0, hidden = false, pointerEvents = 'auto', accessibilityLabel, testID, }) {
6
- return (<View {...(accessibilityLabel === undefined ? {} : { accessibilityLabel })} {...(testID === undefined ? {} : { testID })} pointerEvents={pointerEvents} style={[
7
+ export function GameEntity({ children, x = 0, y = 0, width, height, opacity = 1, scale = 1, rotation = 0, zIndex = 0, hidden = false, pointerEvents = 'auto', measurementId, accessibilityLabel, testID, }) {
8
+ const elementRef = React.useRef(null);
9
+ const runtime = React.useContext(GameRuntimeContext);
10
+ const registerMeasurement = runtime?.registerMeasurement;
11
+ React.useEffect(() => {
12
+ if (measurementId === undefined || registerMeasurement === undefined)
13
+ return undefined;
14
+ return registerMeasurement(measurementId, () => measureGameEntity(elementRef.current));
15
+ }, [measurementId, registerMeasurement]);
16
+ return (<View ref={elementRef} {...(accessibilityLabel === undefined ? {} : { accessibilityLabel })} {...(testID === undefined ? {} : { testID })} pointerEvents={pointerEvents} style={[
7
17
  styles.root,
8
18
  createEntityStyle({ x, y, width, height, opacity, scale, rotation, zIndex, hidden }),
9
19
  ]}>
@@ -1 +1 @@
1
- {"version":3,"file":"GameEntity.js","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,oFAAoF;AACpF,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,CAAC,GAAG,CAAC,EACL,CAAC,GAAG,CAAC,EACL,KAAK,EACL,MAAM,EACN,OAAO,GAAG,CAAC,EACX,KAAK,GAAG,CAAC,EACT,QAAQ,GAAG,CAAC,EACZ,MAAM,GAAG,CAAC,EACV,MAAM,GAAG,KAAK,EACd,aAAa,GAAG,MAAM,EACtB,kBAAkB,EAClB,MAAM,GACU;IAChB,OAAO,CACL,CAAC,IAAI,CACH,IAAI,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC,CACrE,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAC7C,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,KAAK,CAAC,CAAC;YACL,MAAM,CAAC,IAAI;YACX,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;SACrF,CAAC,CAEF;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAcD,sFAAsF;AACtF,SAAS,iBAAiB,CAAC,EACzB,CAAC,EACD,CAAC,EACD,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,MAAM,GACe;IACrB,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;QACjC,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;QACzB,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAC1C,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC;QACxB,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,QAAQ,KAAK,EAAE,CAAC;QACpD,MAAM;QACN,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3C,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC,CAAC","sourcesContent":["import { View } from '@ankhorage/zora';\nimport { StyleSheet, type ViewStyle } from 'react-native';\n\nimport type { GameEntityProps } from '../../../../types/gamePresentation';\nimport { toGamePercentage } from '../../utils/toGamePercentage';\n\n/*** Render one generic positioned game entity without owning gameplay semantics. */\nexport function GameEntity({\n children,\n x = 0,\n y = 0,\n width,\n height,\n opacity = 1,\n scale = 1,\n rotation = 0,\n zIndex = 0,\n hidden = false,\n pointerEvents = 'auto',\n accessibilityLabel,\n testID,\n}: GameEntityProps) {\n return (\n <View\n {...(accessibilityLabel === undefined ? {} : { accessibilityLabel })}\n {...(testID === undefined ? {} : { testID })}\n pointerEvents={pointerEvents}\n style={[\n styles.root,\n createEntityStyle({ x, y, width, height, opacity, scale, rotation, zIndex, hidden }),\n ]}\n >\n {children}\n </View>\n );\n}\n\ninterface GameEntityStyleInput {\n readonly x: number;\n readonly y: number;\n readonly width: number | undefined;\n readonly height: number | undefined;\n readonly opacity: number;\n readonly scale: number;\n readonly rotation: number;\n readonly zIndex: number;\n readonly hidden: boolean;\n}\n\n/*** Convert serializable entity presentation props into a React Native view style. */\nfunction createEntityStyle({\n x,\n y,\n width,\n height,\n opacity,\n scale,\n rotation,\n zIndex,\n hidden,\n}: GameEntityStyleInput): ViewStyle {\n return {\n display: hidden ? 'none' : 'flex',\n left: toGamePercentage(x),\n opacity: Math.min(1, Math.max(0, opacity)),\n position: 'absolute',\n top: toGamePercentage(y),\n transform: [{ scale }, { rotate: `${rotation}deg` }],\n zIndex,\n ...(height === undefined ? {} : { height }),\n ...(width === undefined ? {} : { width }),\n };\n}\n\nconst styles = StyleSheet.create({\n root: {\n position: 'absolute',\n },\n});\n"]}
1
+ {"version":3,"file":"GameEntity.js","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAGhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA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AAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;SACrF,CAAC,CAEF;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAcD,sFAAsF;AACtF,SAAS,iBAAiB,CAAC,EACzB,CAAC,EACD,CAAC,EACD,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,MAAM,GACe;IACrB,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;QACjC,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;QACzB,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAC1C,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC;QACxB,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,QAAQ,KAAK,EAAE,CAAC;QACpD,MAAM;QACN,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3C,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { StyleSheet, View, type ViewStyle } from 'react-native';\n\nimport type { GameEntityProps } from '../../../../types/gamePresentation';\nimport { GameRuntimeContext } from '../../composition/GameRuntimeContext';\nimport { toGamePercentage } from '../../utils/toGamePercentage';\nimport { measureGameEntity } from './measureGameEntity';\n\n/*** Render one generic positioned game entity without owning gameplay semantics. */\nexport function GameEntity({\n children,\n x = 0,\n y = 0,\n width,\n height,\n opacity = 1,\n scale = 1,\n rotation = 0,\n zIndex = 0,\n hidden = false,\n pointerEvents = 'auto',\n measurementId,\n accessibilityLabel,\n testID,\n}: GameEntityProps) {\n const elementRef = React.useRef<View | null>(null);\n const runtime = React.useContext(GameRuntimeContext);\n const registerMeasurement = runtime?.registerMeasurement;\n\n React.useEffect(() => {\n if (measurementId === undefined || registerMeasurement === undefined) return undefined;\n return registerMeasurement(measurementId, () => measureGameEntity(elementRef.current));\n }, [measurementId, registerMeasurement]);\n\n return (\n <View\n ref={elementRef}\n {...(accessibilityLabel === undefined ? {} : { accessibilityLabel })}\n {...(testID === undefined ? {} : { testID })}\n pointerEvents={pointerEvents}\n style={[\n styles.root,\n createEntityStyle({ x, y, width, height, opacity, scale, rotation, zIndex, hidden }),\n ]}\n >\n {children}\n </View>\n );\n}\n\ninterface GameEntityStyleInput {\n readonly x: number;\n readonly y: number;\n readonly width: number | undefined;\n readonly height: number | undefined;\n readonly opacity: number;\n readonly scale: number;\n readonly rotation: number;\n readonly zIndex: number;\n readonly hidden: boolean;\n}\n\n/*** Convert serializable entity presentation props into a React Native view style. */\nfunction createEntityStyle({\n x,\n y,\n width,\n height,\n opacity,\n scale,\n rotation,\n zIndex,\n hidden,\n}: GameEntityStyleInput): ViewStyle {\n return {\n display: hidden ? 'none' : 'flex',\n left: toGamePercentage(x),\n opacity: Math.min(1, Math.max(0, opacity)),\n position: 'absolute',\n top: toGamePercentage(y),\n transform: [{ scale }, { rotate: `${rotation}deg` }],\n zIndex,\n ...(height === undefined ? {} : { height }),\n ...(width === undefined ? {} : { width }),\n };\n}\n\nconst styles = StyleSheet.create({\n root: {\n position: 'absolute',\n },\n});\n"]}
@@ -0,0 +1,4 @@
1
+ import type { GameMeasurementProbeProps } from '../../../../types/gamePresentation';
2
+ /*** Measure two registered game entities and dispatch only their raw rendered geometry. */
3
+ export declare function GameMeasurementProbe({ sourceId, targetId, eventType, entityId, delayMs, enabled, }: GameMeasurementProbeProps): null;
4
+ //# sourceMappingURL=GameMeasurementProbe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GameMeasurementProbe.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/GameMeasurementProbe.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAKpF,2FAA2F;AAC3F,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,QAAQ,EACR,SAA8B,EAC9B,QAAQ,EACR,OAAW,EACX,OAAc,GACf,EAAE,yBAAyB,QAkC3B"}
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { GameRuntimeContext } from '../../composition/GameRuntimeContext';
3
+ import { createGameMeasurementEvent } from './createGameMeasurementEvent';
4
+ /*** Measure two registered game entities and dispatch only their raw rendered geometry. */
5
+ export function GameMeasurementProbe({ sourceId, targetId, eventType = 'game.measurement', entityId, delayMs = 0, enabled = true, }) {
6
+ const runtime = React.useContext(GameRuntimeContext);
7
+ if (runtime === null)
8
+ throw new Error('GameMeasurementProbe must be rendered inside Game.');
9
+ React.useEffect(() => {
10
+ if (!enabled)
11
+ return undefined;
12
+ const timer = setTimeout(() => {
13
+ void dispatchGameMeasurement({
14
+ dispatch: runtime.dispatch,
15
+ measure: runtime.measure,
16
+ sourceId,
17
+ targetId,
18
+ eventType,
19
+ ...(entityId === undefined ? {} : { entityId }),
20
+ });
21
+ }, Math.max(0, delayMs));
22
+ return () => clearTimeout(timer);
23
+ }, [
24
+ delayMs,
25
+ enabled,
26
+ entityId,
27
+ eventType,
28
+ runtime.dispatch,
29
+ runtime.measure,
30
+ sourceId,
31
+ targetId,
32
+ ]);
33
+ return null;
34
+ }
35
+ /*** Resolve both registered entity measurements before dispatching one Game event. */
36
+ async function dispatchGameMeasurement(input) {
37
+ const [source, target] = await Promise.all([
38
+ input.measure(input.sourceId),
39
+ input.measure(input.targetId),
40
+ ]);
41
+ if (source === undefined || target === undefined)
42
+ return;
43
+ input.dispatch(createGameMeasurementEvent({
44
+ eventType: input.eventType,
45
+ ...(input.entityId === undefined ? {} : { entityId: input.entityId }),
46
+ sourceId: input.sourceId,
47
+ targetId: input.targetId,
48
+ source,
49
+ target,
50
+ }));
51
+ }
52
+ //# sourceMappingURL=GameMeasurementProbe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GameMeasurementProbe.js","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/GameMeasurementProbe.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,2FAA2F;AAC3F,MAAM,UAAU,oBAAoB,CAAC,EACnC,QAAQ,EACR,QAAQ,EACR,SAAS,GAAG,kBAAkB,EAC9B,QAAQ,EACR,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,IAAI,GACY;IAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACrD,IAAI,OAAO,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAE5F,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAE/B,MAAM,KAAK,GAAG,UAAU,CACtB,GAAG,EAAE;YACH,KAAK,uBAAuB,CAAC;gBAC3B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,QAAQ;gBACR,QAAQ;gBACR,SAAS;gBACT,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;aAChD,CAAC,CAAC;QACL,CAAC,EACD,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CACrB,CAAC;QAEF,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,EAAE;QACD,OAAO;QACP,OAAO;QACP,QAAQ;QACR,SAAS;QACT,OAAO,CAAC,QAAQ;QAChB,OAAO,CAAC,OAAO;QACf,QAAQ;QACR,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC;AAWD,sFAAsF;AACtF,KAAK,UAAU,uBAAuB,CAAC,KAAmC;IACxE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACzC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC7B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;KAC9B,CAAC,CAAC;IACH,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO;IAEzD,KAAK,CAAC,QAAQ,CACZ,0BAA0B,CAAC;QACzB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,GAAG,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;QACrE,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM;QACN,MAAM;KACP,CAAC,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport type { GameMeasurementProbeProps } from '../../../../types/gamePresentation';\nimport type { GameRuntimeContextValue } from '../../../../types/gameRuntime';\nimport { GameRuntimeContext } from '../../composition/GameRuntimeContext';\nimport { createGameMeasurementEvent } from './createGameMeasurementEvent';\n\n/*** Measure two registered game entities and dispatch only their raw rendered geometry. */\nexport function GameMeasurementProbe({\n sourceId,\n targetId,\n eventType = 'game.measurement',\n entityId,\n delayMs = 0,\n enabled = true,\n}: GameMeasurementProbeProps) {\n const runtime = React.useContext(GameRuntimeContext);\n if (runtime === null) throw new Error('GameMeasurementProbe must be rendered inside Game.');\n\n React.useEffect(() => {\n if (!enabled) return undefined;\n\n const timer = setTimeout(\n () => {\n void dispatchGameMeasurement({\n dispatch: runtime.dispatch,\n measure: runtime.measure,\n sourceId,\n targetId,\n eventType,\n ...(entityId === undefined ? {} : { entityId }),\n });\n },\n Math.max(0, delayMs),\n );\n\n return () => clearTimeout(timer);\n }, [\n delayMs,\n enabled,\n entityId,\n eventType,\n runtime.dispatch,\n runtime.measure,\n sourceId,\n targetId,\n ]);\n\n return null;\n}\n\ninterface DispatchGameMeasurementInput {\n readonly dispatch: GameRuntimeContextValue['dispatch'];\n readonly measure: GameRuntimeContextValue['measure'];\n readonly sourceId: string;\n readonly targetId: string;\n readonly eventType: string;\n readonly entityId?: string;\n}\n\n/*** Resolve both registered entity measurements before dispatching one Game event. */\nasync function dispatchGameMeasurement(input: DispatchGameMeasurementInput): Promise<void> {\n const [source, target] = await Promise.all([\n input.measure(input.sourceId),\n input.measure(input.targetId),\n ]);\n if (source === undefined || target === undefined) return;\n\n input.dispatch(\n createGameMeasurementEvent({\n eventType: input.eventType,\n ...(input.entityId === undefined ? {} : { entityId: input.entityId }),\n sourceId: input.sourceId,\n targetId: input.targetId,\n source,\n target,\n }),\n );\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import type { GameEvent } from '@ankhorage/game';
2
+ import type { GameMeasurementBounds } from '../../../../types/gameRuntime';
3
+ /*** Create one raw geometry event without deciding collision semantics. */
4
+ export declare function createGameMeasurementEvent(input: CreateGameMeasurementEventInput): GameEvent;
5
+ interface CreateGameMeasurementEventInput {
6
+ readonly eventType: string;
7
+ readonly entityId?: string;
8
+ readonly sourceId: string;
9
+ readonly targetId: string;
10
+ readonly source: GameMeasurementBounds;
11
+ readonly target: GameMeasurementBounds;
12
+ }
13
+ export {};
14
+ //# sourceMappingURL=createGameMeasurementEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createGameMeasurementEvent.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/createGameMeasurementEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,2EAA2E;AAC3E,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,GAAG,SAAS,CAW5F;AAED,UAAU,+BAA+B;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;CACxC"}
@@ -0,0 +1,25 @@
1
+ /*** Create one raw geometry event without deciding collision semantics. */
2
+ export function createGameMeasurementEvent(input) {
3
+ return {
4
+ type: input.eventType,
5
+ entityId: input.entityId ?? input.sourceId,
6
+ payload: {
7
+ sourceId: input.sourceId,
8
+ targetId: input.targetId,
9
+ source: toGameMeasurementRecord(input.source),
10
+ target: toGameMeasurementRecord(input.target),
11
+ },
12
+ };
13
+ }
14
+ /*** Convert measured geometry into a serializable Game record. */
15
+ function toGameMeasurementRecord(bounds) {
16
+ return {
17
+ left: bounds.left,
18
+ right: bounds.right,
19
+ top: bounds.top,
20
+ bottom: bounds.bottom,
21
+ width: bounds.width,
22
+ height: bounds.height,
23
+ };
24
+ }
25
+ //# sourceMappingURL=createGameMeasurementEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createGameMeasurementEvent.js","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/createGameMeasurementEvent.ts"],"names":[],"mappings":"AAIA,2EAA2E;AAC3E,MAAM,UAAU,0BAA0B,CAAC,KAAsC;IAC/E,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,SAAS;QACrB,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ;QAC1C,OAAO,EAAE;YACP,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,MAAM,EAAE,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC;YAC7C,MAAM,EAAE,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC;SAC9C;KACF,CAAC;AACJ,CAAC;AAWD,kEAAkE;AAClE,SAAS,uBAAuB,CAAC,MAA6B;IAC5D,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC;AACJ,CAAC","sourcesContent":["import type { GameEvent, GameRecord } from '@ankhorage/game';\n\nimport type { GameMeasurementBounds } from '../../../../types/gameRuntime';\n\n/*** Create one raw geometry event without deciding collision semantics. */\nexport function createGameMeasurementEvent(input: CreateGameMeasurementEventInput): GameEvent {\n return {\n type: input.eventType,\n entityId: input.entityId ?? input.sourceId,\n payload: {\n sourceId: input.sourceId,\n targetId: input.targetId,\n source: toGameMeasurementRecord(input.source),\n target: toGameMeasurementRecord(input.target),\n },\n };\n}\n\ninterface CreateGameMeasurementEventInput {\n readonly eventType: string;\n readonly entityId?: string;\n readonly sourceId: string;\n readonly targetId: string;\n readonly source: GameMeasurementBounds;\n readonly target: GameMeasurementBounds;\n}\n\n/*** Convert measured geometry into a serializable Game record. */\nfunction toGameMeasurementRecord(bounds: GameMeasurementBounds): GameRecord {\n return {\n left: bounds.left,\n right: bounds.right,\n top: bounds.top,\n bottom: bounds.bottom,\n width: bounds.width,\n height: bounds.height,\n };\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { View } from 'react-native';
2
+ import type { GameMeasurementBounds } from '../../../../types/gameRuntime';
3
+ /*** Measure one rendered React Native or React Native Web game entity in window coordinates. */
4
+ export declare function measureGameEntity(element: View | null): Promise<GameMeasurementBounds | undefined>;
5
+ //# sourceMappingURL=measureGameEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measureGameEntity.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/measureGameEntity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,gGAAgG;AAChG,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,GAAG,IAAI,GACnB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAoB5C"}
@@ -0,0 +1,22 @@
1
+ /*** Measure one rendered React Native or React Native Web game entity in window coordinates. */
2
+ export function measureGameEntity(element) {
3
+ if (element === null)
4
+ return Promise.resolve(undefined);
5
+ return new Promise((resolve) => {
6
+ element.measureInWindow((left, top, width, height) => {
7
+ if (![left, top, width, height].every(Number.isFinite) || width < 0 || height < 0) {
8
+ resolve(undefined);
9
+ return;
10
+ }
11
+ resolve({
12
+ left,
13
+ right: left + width,
14
+ top,
15
+ bottom: top + height,
16
+ width,
17
+ height,
18
+ });
19
+ });
20
+ });
21
+ }
22
+ //# sourceMappingURL=measureGameEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measureGameEntity.js","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/measureGameEntity.ts"],"names":[],"mappings":"AAIA,gGAAgG;AAChG,MAAM,UAAU,iBAAiB,CAC/B,OAAoB;IAEpB,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAExD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACnD,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClF,OAAO,CAAC,SAAS,CAAC,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,OAAO,CAAC;gBACN,IAAI;gBACJ,KAAK,EAAE,IAAI,GAAG,KAAK;gBACnB,GAAG;gBACH,MAAM,EAAE,GAAG,GAAG,MAAM;gBACpB,KAAK;gBACL,MAAM;aACP,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { View } from 'react-native';\n\nimport type { GameMeasurementBounds } from '../../../../types/gameRuntime';\n\n/*** Measure one rendered React Native or React Native Web game entity in window coordinates. */\nexport function measureGameEntity(\n element: View | null,\n): Promise<GameMeasurementBounds | undefined> {\n if (element === null) return Promise.resolve(undefined);\n\n return new Promise((resolve) => {\n element.measureInWindow((left, top, width, height) => {\n if (![left, top, width, height].every(Number.isFinite) || width < 0 || height < 0) {\n resolve(undefined);\n return;\n }\n\n resolve({\n left,\n right: left + width,\n top,\n bottom: top + height,\n width,\n height,\n });\n });\n });\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { GameMeasurementRegistry } from '../../../types/gameRuntime';
2
+ /*** Create one isolated measurement registry for an embeddable Game instance. */
3
+ export declare function createGameMeasurementRegistry(): GameMeasurementRegistry;
4
+ //# sourceMappingURL=createGameMeasurementRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createGameMeasurementRegistry.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/composition/createGameMeasurementRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAEjG,iFAAiF;AACjF,wBAAgB,6BAA6B,IAAI,uBAAuB,CAYvE"}
@@ -0,0 +1,15 @@
1
+ /*** Create one isolated measurement registry for an embeddable Game instance. */
2
+ export function createGameMeasurementRegistry() {
3
+ const readers = new Map();
4
+ return {
5
+ registerMeasurement: (id, reader) => {
6
+ readers.set(id, reader);
7
+ return () => {
8
+ if (readers.get(id) === reader)
9
+ readers.delete(id);
10
+ };
11
+ },
12
+ measure: (id) => readers.get(id)?.() ?? Promise.resolve(undefined),
13
+ };
14
+ }
15
+ //# sourceMappingURL=createGameMeasurementRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createGameMeasurementRegistry.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/composition/createGameMeasurementRegistry.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,MAAM,UAAU,6BAA6B;IAC3C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAiC,CAAC;IAEzD,OAAO;QACL,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE;YAClC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;YACxB,OAAO,GAAG,EAAE;gBACV,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,MAAM;oBAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACrD,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;KACnE,CAAC;AACJ,CAAC","sourcesContent":["import type { GameMeasurementReader, GameMeasurementRegistry } from '../../../types/gameRuntime';\n\n/*** Create one isolated measurement registry for an embeddable Game instance. */\nexport function createGameMeasurementRegistry(): GameMeasurementRegistry {\n const readers = new Map<string, GameMeasurementReader>();\n\n return {\n registerMeasurement: (id, reader) => {\n readers.set(id, reader);\n return () => {\n if (readers.get(id) === reader) readers.delete(id);\n };\n },\n measure: (id) => readers.get(id)?.() ?? Promise.resolve(undefined),\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { GameProps } from '../../../types/gamePresentation';
2
- import type { GameRuntimeContextValue } from '../../../types/gameRuntime';
2
+ import type { GameRuntimeValue } from '../../../types/gameRuntime';
3
3
  /*** Own one local transient Game session while delegating all domain transitions to @ankhorage/game. */
4
- export declare function useGameRuntime(props: GameProps): GameRuntimeContextValue;
4
+ export declare function useGameRuntime(props: GameProps): GameRuntimeValue;
5
5
  //# sourceMappingURL=useGameRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useGameRuntime.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/composition/useGameRuntime.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAoB,MAAM,4BAA4B,CAAC;AAK5F,wGAAwG;AACxG,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,uBAAuB,CAqDxE"}
1
+ {"version":3,"file":"useGameRuntime.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/composition/useGameRuntime.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAoB,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAKrF,wGAAwG;AACxG,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,gBAAgB,CAqDjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"useGameRuntime.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/composition/useGameRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,GAGlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,gBAAgB,GAAc,EAAE,CAAC;AAEvC,wGAAwG;AACxG,MAAM,UAAU,cAAc,CAAC,KAAgB;IAC7C,MAAM,EAAE,UAAU,EAAE,KAAK,GAAG,gBAAgB,EAAE,IAAI,GAAG,CAAC,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;IAChF,MAAM,aAAa,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,IAAI,CAAC;IACtD,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACjC,MAAM,UAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IACnE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAmB,GAAG,EAAE,CAClE,kBAAkB,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAC3D,CAAC;IAEF,mBAAmB,CAAC;QAClB,QAAQ;QACR,aAAa;QACb,QAAQ;QACR,UAAU;QACV,IAAI;QACJ,UAAU;KACX,CAA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KAAa;IAC3C,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import {\n advanceGameTime,\n applyGameEvent,\n createGameSession,\n type GameInput,\n type GameOutput,\n} from '@ankhorage/game';\nimport React from 'react';\n\nimport type { GameProps } from '../../../types/gamePresentation';\nimport type { GameRuntimeContextValue, GameRuntimeState } from '../../../types/gameRuntime';\nimport { useGameScheduledEffects } from './useGameScheduledEffects';\n\nconst EMPTY_GAME_INPUT: GameInput = {};\n\n/*** Own one local transient Game session while delegating all domain transitions to @ankhorage/game. */\nexport function useGameRuntime(props: GameProps): GameRuntimeContextValue {\n const { definition, input = EMPTY_GAME_INPUT, seed = 0, resetKey = '' } = props;\n const definitionRef = useLatestValue(definition);\n const inputRef = useLatestValue(input);\n const outputRef = useLatestValue(props.onOutput);\n const autoAdvanceTime = props.autoAdvanceTime ?? true;\n const clockRef = React.useRef(0);\n const runtimeKey = createRuntimeKey(definition.id, resetKey, seed);\n const [runtime, setRuntime] = React.useState<GameRuntimeState>(() =>\n createRuntimeState(definition, input, seed, runtimeKey, 0),\n );\n\n useGameRuntimeReset({\n clockRef,\n definitionRef,\n inputRef,\n runtimeKey,\n seed,\n setRuntime,\n });\n useGameOutputEmitter(runtime, outputRef);\n\n const dispatch = React.useCallback<GameRuntimeContextValue['dispatch']>(\n (event) => {\n const now = Date.now();\n setRuntime((current) =>\n applyRuntimeEvent({\n autoAdvanceTime,\n current,\n definition: definitionRef.current,\n elapsedMs: Math.max(0, now - clockRef.current),\n event,\n input: inputRef.current,\n runtimeKey,\n seed,\n }),\n );\n clockRef.current = now;\n },\n [autoAdvanceTime, definitionRef, inputRef, runtimeKey, seed],\n );\n\n useGameScheduledEffects({\n clockRef,\n definitionRef,\n enabled: autoAdvanceTime,\n inputRef,\n runtimeKey,\n scheduled: runtime.session.scheduled,\n setRuntime,\n });\n\n return React.useMemo(() => ({ session: runtime.session, dispatch }), [dispatch, runtime.session]);\n}\n\ninterface GameRuntimeResetArgs {\n readonly clockRef: React.RefObject<number>;\n readonly definitionRef: React.RefObject<GameProps['definition']>;\n readonly inputRef: React.RefObject<GameInput>;\n readonly runtimeKey: string;\n readonly seed: number;\n readonly setRuntime: React.Dispatch<React.SetStateAction<GameRuntimeState>>;\n}\n\n/*** Reset the transient session only when its explicit serializable runtime identity changes. */\nfunction useGameRuntimeReset({\n clockRef,\n definitionRef,\n inputRef,\n runtimeKey,\n seed,\n setRuntime,\n}: GameRuntimeResetArgs): void {\n React.useEffect(() => {\n clockRef.current = Date.now();\n setRuntime((current) =>\n current.key === runtimeKey\n ? current\n : createRuntimeState(\n definitionRef.current,\n inputRef.current,\n seed,\n runtimeKey,\n current.revision + 1,\n ),\n );\n }, [clockRef, definitionRef, inputRef, runtimeKey, seed, setRuntime]);\n}\n\n/*** Emit each runtime output exactly when one execution revision becomes current. */\nfunction useGameOutputEmitter(\n runtime: GameRuntimeState,\n outputRef: React.RefObject<GameProps['onOutput']>,\n): void {\n React.useEffect(() => {\n emitGameOutputs(runtime.outputs, outputRef.current);\n }, [outputRef, runtime.outputs, runtime.revision]);\n}\n\ninterface ApplyRuntimeEventArgs {\n readonly autoAdvanceTime: boolean;\n readonly current: GameRuntimeState;\n readonly definition: GameProps['definition'];\n readonly elapsedMs: number;\n readonly event: Parameters<typeof applyGameEvent>[2];\n readonly input: GameInput;\n readonly runtimeKey: string;\n readonly seed: number;\n}\n\n/*** Apply elapsed time and one explicit game event against the matching local session. */\nfunction applyRuntimeEvent(args: ApplyRuntimeEventArgs): GameRuntimeState {\n const base =\n args.current.key === args.runtimeKey\n ? args.current\n : createRuntimeState(\n args.definition,\n args.input,\n args.seed,\n args.runtimeKey,\n args.current.revision,\n );\n const timed = args.autoAdvanceTime\n ? advanceGameTime(args.definition, base.session, args.elapsedMs, args.input)\n : { session: base.session, outputs: [] };\n const result = applyGameEvent(args.definition, timed.session, args.event, args.input);\n return {\n key: args.runtimeKey,\n session: result.session,\n outputs: [...(base === args.current ? [] : base.outputs), ...timed.outputs, ...result.outputs],\n revision: args.current.revision + 1,\n };\n}\n\n/*** Create one transient runtime state through the published Game owner API. */\nfunction createRuntimeState(\n definition: GameProps['definition'],\n input: GameInput,\n seed: number,\n key: string,\n revision: number,\n): GameRuntimeState {\n const result = createGameSession(definition, { input, seed });\n return { key, session: result.session, outputs: result.outputs, revision };\n}\n\n/*** Create one runtime identity from serializable definition/session initialization inputs. */\nfunction createRuntimeKey(definitionId: string, resetKey: string, seed: number): string {\n return `${definitionId}:${resetKey}:${seed}`;\n}\n\n/*** Emit runtime outputs through the ZORA event callback boundary. */\nfunction emitGameOutputs(outputs: readonly GameOutput[], onOutput: GameProps['onOutput']): void {\n if (onOutput === undefined) return;\n outputs.forEach((output) => onOutput(output));\n}\n\n/*** Keep a stable ref object updated with the latest adapter input. */\nfunction useLatestValue<TValue>(value: TValue): React.RefObject<TValue> {\n const ref = React.useRef(value);\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref;\n}\n"]}
1
+ {"version":3,"file":"useGameRuntime.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/composition/useGameRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,GAGlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,gBAAgB,GAAc,EAAE,CAAC;AAEvC,wGAAwG;AACxG,MAAM,UAAU,cAAc,CAAC,KAAgB;IAC7C,MAAM,EAAE,UAAU,EAAE,KAAK,GAAG,gBAAgB,EAAE,IAAI,GAAG,CAAC,EAAE,QAAQ,GAAG,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ChF,SAAS,kBAAkB,CACzB,UAAmC,EACnC,KAAgB,EAChB,IAAY,EACZ,GAAW,EACX,QAAgB;IAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC7E,CAAC;AAED,+FAA+F;AAC/F,SAAS,gBAAgB,CAAC,YAAoB,EAAE,QAAgB,EAAE,IAAY;IAC5E,OAAO,GAAG,YAAY,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED,sEAAsE;AACtE,SAAS,eAAe,CAAC,OAA8B,EAAE,QAA+B;IACtF,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO;IACnC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAChD,CAAC;AAED,uEAAuE;AACvE,SAAS,cAAc,CAAS,KAAa;IAC3C,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import {\n advanceGameTime,\n applyGameEvent,\n createGameSession,\n type GameInput,\n type GameOutput,\n} from '@ankhorage/game';\nimport React from 'react';\n\nimport type { GameProps } from '../../../types/gamePresentation';\nimport type { GameRuntimeState, GameRuntimeValue } from '../../../types/gameRuntime';\nimport { useGameScheduledEffects } from './useGameScheduledEffects';\n\nconst EMPTY_GAME_INPUT: GameInput = {};\n\n/*** Own one local transient Game session while delegating all domain transitions to @ankhorage/game. */\nexport function useGameRuntime(props: GameProps): GameRuntimeValue {\n const { definition, input = EMPTY_GAME_INPUT, seed = 0, resetKey = '' } = props;\n const definitionRef = useLatestValue(definition);\n const inputRef = useLatestValue(input);\n const outputRef = useLatestValue(props.onOutput);\n const autoAdvanceTime = props.autoAdvanceTime ?? true;\n const clockRef = React.useRef(0);\n const runtimeKey = createRuntimeKey(definition.id, resetKey, seed);\n const [runtime, setRuntime] = React.useState<GameRuntimeState>(() =>\n createRuntimeState(definition, input, seed, runtimeKey, 0),\n );\n\n useGameRuntimeReset({\n clockRef,\n definitionRef,\n inputRef,\n runtimeKey,\n seed,\n setRuntime,\n });\n useGameOutputEmitter(runtime, outputRef);\n\n const dispatch = React.useCallback<GameRuntimeValue['dispatch']>(\n (event) => {\n const now = Date.now();\n setRuntime((current) =>\n applyRuntimeEvent({\n autoAdvanceTime,\n current,\n definition: definitionRef.current,\n elapsedMs: Math.max(0, now - clockRef.current),\n event,\n input: inputRef.current,\n runtimeKey,\n seed,\n }),\n );\n clockRef.current = now;\n },\n [autoAdvanceTime, definitionRef, inputRef, runtimeKey, seed],\n );\n\n useGameScheduledEffects({\n clockRef,\n definitionRef,\n enabled: autoAdvanceTime,\n inputRef,\n runtimeKey,\n scheduled: runtime.session.scheduled,\n setRuntime,\n });\n\n return React.useMemo(() => ({ session: runtime.session, dispatch }), [dispatch, runtime.session]);\n}\n\ninterface GameRuntimeResetArgs {\n readonly clockRef: React.RefObject<number>;\n readonly definitionRef: React.RefObject<GameProps['definition']>;\n readonly inputRef: React.RefObject<GameInput>;\n readonly runtimeKey: string;\n readonly seed: number;\n readonly setRuntime: React.Dispatch<React.SetStateAction<GameRuntimeState>>;\n}\n\n/*** Reset the transient session only when its explicit serializable runtime identity changes. */\nfunction useGameRuntimeReset({\n clockRef,\n definitionRef,\n inputRef,\n runtimeKey,\n seed,\n setRuntime,\n}: GameRuntimeResetArgs): void {\n React.useEffect(() => {\n clockRef.current = Date.now();\n setRuntime((current) =>\n current.key === runtimeKey\n ? current\n : createRuntimeState(\n definitionRef.current,\n inputRef.current,\n seed,\n runtimeKey,\n current.revision + 1,\n ),\n );\n }, [clockRef, definitionRef, inputRef, runtimeKey, seed, setRuntime]);\n}\n\n/*** Emit each runtime output exactly when one execution revision becomes current. */\nfunction useGameOutputEmitter(\n runtime: GameRuntimeState,\n outputRef: React.RefObject<GameProps['onOutput']>,\n): void {\n React.useEffect(() => {\n emitGameOutputs(runtime.outputs, outputRef.current);\n }, [outputRef, runtime.outputs, runtime.revision]);\n}\n\ninterface ApplyRuntimeEventArgs {\n readonly autoAdvanceTime: boolean;\n readonly current: GameRuntimeState;\n readonly definition: GameProps['definition'];\n readonly elapsedMs: number;\n readonly event: Parameters<typeof applyGameEvent>[2];\n readonly input: GameInput;\n readonly runtimeKey: string;\n readonly seed: number;\n}\n\n/*** Apply elapsed time and one explicit game event against the matching local session. */\nfunction applyRuntimeEvent(args: ApplyRuntimeEventArgs): GameRuntimeState {\n const base =\n args.current.key === args.runtimeKey\n ? args.current\n : createRuntimeState(\n args.definition,\n args.input,\n args.seed,\n args.runtimeKey,\n args.current.revision,\n );\n const timed = args.autoAdvanceTime\n ? advanceGameTime(args.definition, base.session, args.elapsedMs, args.input)\n : { session: base.session, outputs: [] };\n const result = applyGameEvent(args.definition, timed.session, args.event, args.input);\n return {\n key: args.runtimeKey,\n session: result.session,\n outputs: [...(base === args.current ? [] : base.outputs), ...timed.outputs, ...result.outputs],\n revision: args.current.revision + 1,\n };\n}\n\n/*** Create one transient runtime state through the published Game owner API. */\nfunction createRuntimeState(\n definition: GameProps['definition'],\n input: GameInput,\n seed: number,\n key: string,\n revision: number,\n): GameRuntimeState {\n const result = createGameSession(definition, { input, seed });\n return { key, session: result.session, outputs: result.outputs, revision };\n}\n\n/*** Create one runtime identity from serializable definition/session initialization inputs. */\nfunction createRuntimeKey(definitionId: string, resetKey: string, seed: number): string {\n return `${definitionId}:${resetKey}:${seed}`;\n}\n\n/*** Emit runtime outputs through the ZORA event callback boundary. */\nfunction emitGameOutputs(outputs: readonly GameOutput[], onOutput: GameProps['onOutput']): void {\n if (onOutput === undefined) return;\n outputs.forEach((output) => onOutput(output));\n}\n\n/*** Keep a stable ref object updated with the latest adapter input. */\nfunction useLatestValue<TValue>(value: TValue): React.RefObject<TValue> {\n const ref = React.useRef(value);\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref;\n}\n"]}
@@ -72,6 +72,12 @@ export declare const gameEntityMeta: {
72
72
  };
73
73
  readonly acceptsFallback: true;
74
74
  };
75
+ readonly measurementId: {
76
+ readonly value: {
77
+ readonly type: "string";
78
+ };
79
+ readonly acceptsFallback: true;
80
+ };
75
81
  };
76
82
  };
77
83
  readonly props: {
@@ -164,6 +170,14 @@ export declare const gameEntityMeta: {
164
170
  readonly authority: "instance";
165
171
  };
166
172
  };
173
+ readonly measurementId: {
174
+ readonly type: "string";
175
+ readonly category: "Measurement";
176
+ readonly label: "Measurement id";
177
+ readonly authoring: {
178
+ readonly authority: "instance";
179
+ };
180
+ };
167
181
  readonly accessibilityLabel: {
168
182
  readonly type: "string";
169
183
  readonly category: "Accessibility";
@@ -1 +1 @@
1
- {"version":3,"file":"gameEntityMeta.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/meta/gameEntityMeta.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoGW,CAAC"}
1
+ {"version":3,"file":"gameEntityMeta.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/meta/gameEntityMeta.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GW,CAAC"}
@@ -20,6 +20,7 @@ export const gameEntityMeta = {
20
20
  rotation: { value: { type: 'number' }, acceptsFallback: true },
21
21
  zIndex: { value: { type: 'number' }, acceptsFallback: true },
22
22
  hidden: { value: { type: 'boolean' }, acceptsFallback: true },
23
+ measurementId: { value: { type: 'string' }, acceptsFallback: true },
23
24
  },
24
25
  },
25
26
  props: {
@@ -92,6 +93,12 @@ export const gameEntityMeta = {
92
93
  default: 'auto',
93
94
  authoring: { authority: 'instance' },
94
95
  },
96
+ measurementId: {
97
+ type: 'string',
98
+ category: 'Measurement',
99
+ label: 'Measurement id',
100
+ authoring: { authority: 'instance' },
101
+ },
95
102
  accessibilityLabel: {
96
103
  type: 'string',
97
104
  category: 'Accessibility',
@@ -1 +1 @@
1
- {"version":3,"file":"gameEntityMeta.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/meta/gameEntityMeta.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,WAAW;IACrB,WAAW,EAAE,kFAAkF;IAC/F,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;IAC3D,SAAS,EAAE;QACT,KAAK,EAAE,aAAa;QACpB,YAAY,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;K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vB,KAAK,EAAE,gBAAgB;YACvB,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC;YAC9C,OAAO,EAAE,MAAM;YACf,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;CACmC,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '@ankhorage/zora/metadata';\n\n/*** Describe one positioned generic game entity for ZORA authoring tools. */\nexport const gameEntityMeta = {\n name: 'GameEntity',\n category: 'component',\n description: 'Positions arbitrary visual content inside a GameField without owning game rules.',\n directManifestNode: true,\n allowedChildren: ['Badge', 'Icon', 'Image', 'Text', 'View'],\n blueprint: {\n label: 'Game entity',\n defaultProps: { x: 0, y: 0, opacity: 1, scale: 1, rotation: 0, zIndex: 0 },\n },\n bindings: {\n props: {\n x: { value: { type: 'number' }, acceptsFallback: true },\n y: { value: { type: 'number' }, acceptsFallback: true },\n width: { value: { type: 'number' }, acceptsFallback: true },\n height: { value: { type: 'number' }, acceptsFallback: true },\n opacity: { value: { type: 'number' }, acceptsFallback: true },\n scale: { value: { type: 'number' }, acceptsFallback: true },\n rotation: { value: { type: 'number' }, acceptsFallback: true },\n zIndex: { value: { type: 'number' }, acceptsFallback: true },\n hidden: { value: { type: 'boolean' }, acceptsFallback: true },\n },\n },\n props: {\n x: {\n type: 'number',\n category: 'Position',\n label: 'X (%)',\n default: 0,\n authoring: { authority: 'instance' },\n },\n y: {\n type: 'number',\n category: 'Position',\n label: 'Y (%)',\n default: 0,\n authoring: { authority: 'instance' },\n },\n width: {\n type: 'number',\n category: 'Size',\n label: 'Width',\n authoring: { authority: 'instance' },\n },\n height: {\n type: 'number',\n category: 'Size',\n label: 'Height',\n authoring: { authority: 'instance' },\n },\n opacity: {\n type: 'number',\n category: 'Appearance',\n label: 'Opacity',\n default: 1,\n authoring: { authority: 'instance' },\n },\n scale: {\n type: 'number',\n category: 'Transform',\n label: 'Scale',\n default: 1,\n authoring: { authority: 'instance' },\n },\n rotation: {\n type: 'number',\n category: 'Transform',\n label: 'Rotation',\n default: 0,\n authoring: { authority: 'instance' },\n },\n zIndex: {\n type: 'number',\n category: 'Position',\n label: 'Z index',\n default: 0,\n authoring: { authority: 'instance' },\n },\n hidden: {\n type: 'boolean',\n category: 'State',\n label: 'Hidden',\n default: false,\n authoring: { authority: 'instance' },\n },\n pointerEvents: {\n type: 'enum',\n category: 'Interaction',\n label: 'Pointer events',\n enum: ['auto', 'box-none', 'box-only', 'none'],\n default: 'auto',\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 satisfies ZoraComponentMeta;\n"]}
1
+ {"version":3,"file":"gameEntityMeta.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/meta/gameEntityMeta.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,WAAW;IACrB,WAAW,EAAE,kFAAkF;IAC/F,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;IAC3D,SAAS,EAAE;QACT,KAAK,EAAE,aAAa;QACpB,YAAY,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;KAC3E;IACD,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,IAA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AE,aAAa;YACvB,KAAK,EAAE,gBAAgB;YACvB,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC;YAC9C,OAAO,EAAE,MAAM;YACf,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,aAAa;YACvB,KAAK,EAAE,gBAAgB;YACvB,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;CACmC,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '@ankhorage/zora/metadata';\n\n/*** Describe one positioned generic game entity for ZORA authoring tools. */\nexport const gameEntityMeta = {\n name: 'GameEntity',\n category: 'component',\n description: 'Positions arbitrary visual content inside a GameField without owning game rules.',\n directManifestNode: true,\n allowedChildren: ['Badge', 'Icon', 'Image', 'Text', 'View'],\n blueprint: {\n label: 'Game entity',\n defaultProps: { x: 0, y: 0, opacity: 1, scale: 1, rotation: 0, zIndex: 0 },\n },\n bindings: {\n props: {\n x: { value: { type: 'number' }, acceptsFallback: true },\n y: { value: { type: 'number' }, acceptsFallback: true },\n width: { value: { type: 'number' }, acceptsFallback: true },\n height: { value: { type: 'number' }, acceptsFallback: true },\n opacity: { value: { type: 'number' }, acceptsFallback: true },\n scale: { value: { type: 'number' }, acceptsFallback: true },\n rotation: { value: { type: 'number' }, acceptsFallback: true },\n zIndex: { value: { type: 'number' }, acceptsFallback: true },\n hidden: { value: { type: 'boolean' }, acceptsFallback: true },\n measurementId: { value: { type: 'string' }, acceptsFallback: true },\n },\n },\n props: {\n x: {\n type: 'number',\n category: 'Position',\n label: 'X (%)',\n default: 0,\n authoring: { authority: 'instance' },\n },\n y: {\n type: 'number',\n category: 'Position',\n label: 'Y (%)',\n default: 0,\n authoring: { authority: 'instance' },\n },\n width: {\n type: 'number',\n category: 'Size',\n label: 'Width',\n authoring: { authority: 'instance' },\n },\n height: {\n type: 'number',\n category: 'Size',\n label: 'Height',\n authoring: { authority: 'instance' },\n },\n opacity: {\n type: 'number',\n category: 'Appearance',\n label: 'Opacity',\n default: 1,\n authoring: { authority: 'instance' },\n },\n scale: {\n type: 'number',\n category: 'Transform',\n label: 'Scale',\n default: 1,\n authoring: { authority: 'instance' },\n },\n rotation: {\n type: 'number',\n category: 'Transform',\n label: 'Rotation',\n default: 0,\n authoring: { authority: 'instance' },\n },\n zIndex: {\n type: 'number',\n category: 'Position',\n label: 'Z index',\n default: 0,\n authoring: { authority: 'instance' },\n },\n hidden: {\n type: 'boolean',\n category: 'State',\n label: 'Hidden',\n default: false,\n authoring: { authority: 'instance' },\n },\n pointerEvents: {\n type: 'enum',\n category: 'Interaction',\n label: 'Pointer events',\n enum: ['auto', 'box-none', 'box-only', 'none'],\n default: 'auto',\n authoring: { authority: 'instance' },\n },\n measurementId: {\n type: 'string',\n category: 'Measurement',\n label: 'Measurement id',\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 satisfies ZoraComponentMeta;\n"]}
@@ -0,0 +1,112 @@
1
+ /*** Describe a non-visual source/target geometry sampling adapter for one Game instance. */
2
+ export declare const gameMeasurementProbeMeta: {
3
+ readonly name: "GameMeasurementProbe";
4
+ readonly category: "component";
5
+ readonly description: "Measures two registered game entities and reports their raw rendered bounds through a generic Game event.";
6
+ readonly directManifestNode: true;
7
+ readonly allowedChildren: readonly [];
8
+ readonly blueprint: {
9
+ readonly label: "Game measurement probe";
10
+ readonly defaultProps: {
11
+ readonly sourceId: "source";
12
+ readonly targetId: "target";
13
+ readonly eventType: "game.measurement";
14
+ readonly delayMs: 0;
15
+ readonly enabled: true;
16
+ };
17
+ };
18
+ readonly bindings: {
19
+ readonly props: {
20
+ readonly sourceId: {
21
+ readonly value: {
22
+ readonly type: "string";
23
+ };
24
+ readonly acceptsFallback: true;
25
+ };
26
+ readonly targetId: {
27
+ readonly value: {
28
+ readonly type: "string";
29
+ };
30
+ readonly acceptsFallback: true;
31
+ };
32
+ readonly eventType: {
33
+ readonly value: {
34
+ readonly type: "string";
35
+ };
36
+ readonly acceptsFallback: true;
37
+ };
38
+ readonly entityId: {
39
+ readonly value: {
40
+ readonly type: "string";
41
+ };
42
+ readonly acceptsFallback: true;
43
+ };
44
+ readonly delayMs: {
45
+ readonly value: {
46
+ readonly type: "number";
47
+ };
48
+ readonly acceptsFallback: true;
49
+ };
50
+ readonly enabled: {
51
+ readonly value: {
52
+ readonly type: "boolean";
53
+ };
54
+ readonly acceptsFallback: true;
55
+ };
56
+ };
57
+ };
58
+ readonly props: {
59
+ readonly sourceId: {
60
+ readonly type: "string";
61
+ readonly category: "Measurement";
62
+ readonly label: "Source id";
63
+ readonly authoring: {
64
+ readonly authority: "instance";
65
+ };
66
+ };
67
+ readonly targetId: {
68
+ readonly type: "string";
69
+ readonly category: "Measurement";
70
+ readonly label: "Target id";
71
+ readonly authoring: {
72
+ readonly authority: "instance";
73
+ };
74
+ };
75
+ readonly eventType: {
76
+ readonly type: "string";
77
+ readonly category: "Measurement";
78
+ readonly label: "Event type";
79
+ readonly default: "game.measurement";
80
+ readonly authoring: {
81
+ readonly authority: "instance";
82
+ };
83
+ };
84
+ readonly entityId: {
85
+ readonly type: "string";
86
+ readonly category: "Measurement";
87
+ readonly label: "Game entity id";
88
+ readonly authoring: {
89
+ readonly authority: "instance";
90
+ };
91
+ };
92
+ readonly delayMs: {
93
+ readonly type: "number";
94
+ readonly category: "Measurement";
95
+ readonly label: "Delay (ms)";
96
+ readonly default: 0;
97
+ readonly authoring: {
98
+ readonly authority: "instance";
99
+ };
100
+ };
101
+ readonly enabled: {
102
+ readonly type: "boolean";
103
+ readonly category: "State";
104
+ readonly label: "Enabled";
105
+ readonly default: true;
106
+ readonly authoring: {
107
+ readonly authority: "instance";
108
+ };
109
+ };
110
+ };
111
+ };
112
+ //# sourceMappingURL=gameMeasurementProbeMeta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gameMeasurementProbeMeta.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/meta/gameMeasurementProbeMeta.ts"],"names":[],"mappings":"AAEA,4FAA4F;AAC5F,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoEC,CAAC"}