@ankhorage/zora-game 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @ankhorage/zora-game
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - bba6595: Expose the current local game entities as a repeatable binding array while preserving the canonical
8
+ map-shaped GameSession entity storage.
9
+
3
10
  ## 0.4.0
4
11
 
5
12
  ### Minor Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/zora-game
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v0.4.0](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v0.4.1](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
7
7
 
8
8
  Generic game presentation primitives for React Native and React Native Web apps built on ZORA.
9
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"createGameBindingContext.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/composition/createGameBindingContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,kFAAkF;AAClF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMtF"}
1
+ {"version":3,"file":"createGameBindingContext.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/composition/createGameBindingContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,kFAAkF;AAClF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOtF"}
@@ -2,6 +2,7 @@
2
2
  export function createGameBindingContext(session) {
3
3
  return {
4
4
  game: {
5
+ entities: Object.values(session.entities),
5
6
  session,
6
7
  },
7
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"createGameBindingContext.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/composition/createGameBindingContext.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,MAAM,UAAU,wBAAwB,CAAC,OAAoB;IAC3D,OAAO;QACL,IAAI,EAAE;YACJ,OAAO;SACR;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { GameSession } from '@ankhorage/game';\n\n/*** Create the canonical Runtime context namespace for one local game session. */\nexport function createGameBindingContext(session: GameSession): Record<string, unknown> {\n return {\n game: {\n session,\n },\n };\n}\n"]}
1
+ {"version":3,"file":"createGameBindingContext.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/composition/createGameBindingContext.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,MAAM,UAAU,wBAAwB,CAAC,OAAoB;IAC3D,OAAO;QACL,IAAI,EAAE;YACJ,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;YACzC,OAAO;SACR;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { GameSession } from '@ankhorage/game';\n\n/*** Create the canonical Runtime context namespace for one local game session. */\nexport function createGameBindingContext(session: GameSession): Record<string, unknown> {\n return {\n game: {\n entities: Object.values(session.entities),\n session,\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/zora-game",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "Generic game presentation primitives for React Native and React Native Web apps built on ZORA.",
6
6
  "homepage": "https://github.com/ankhorage/zora-game#readme",
@@ -15,6 +15,11 @@ const session: GameSession = {
15
15
  templateId: 'actor',
16
16
  state: { x: 42, y: 73, label: 'Player' },
17
17
  },
18
+ shot: {
19
+ id: 'shot',
20
+ templateId: 'projectile',
21
+ state: { x: 50, y: 60, label: 'A' },
22
+ },
18
23
  },
19
24
  scheduled: [],
20
25
  elapsedMs: 120,
@@ -39,9 +44,23 @@ describe('createGameBindingContext', () => {
39
44
  ).toBe(80);
40
45
  });
41
46
 
47
+ test('exposes current entities as a repeatable array with stable ids', () => {
48
+ const context = createGameBindingContext(session);
49
+ const entities = resolveRuntimeBindingValueSync(
50
+ { source: { kind: 'context', path: 'game.entities' } },
51
+ { context },
52
+ );
53
+
54
+ expect(Array.isArray(entities)).toBe(true);
55
+ expect(entities).toEqual(Object.values(session.entities));
56
+ });
57
+
42
58
  test('owns only the local game namespace', () => {
43
59
  expect(createGameBindingContext(session)).toEqual({
44
- game: { session },
60
+ game: {
61
+ entities: Object.values(session.entities),
62
+ session,
63
+ },
45
64
  });
46
65
  });
47
66
  });
@@ -4,6 +4,7 @@ import type { GameSession } from '@ankhorage/game';
4
4
  export function createGameBindingContext(session: GameSession): Record<string, unknown> {
5
5
  return {
6
6
  game: {
7
+ entities: Object.values(session.entities),
7
8
  session,
8
9
  },
9
10
  };