@ankhorage/zora-game 0.2.0 → 0.4.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.
- package/CHANGELOG.md +14 -0
- package/README.md +2 -1
- package/dist/ZORA_GAME_COMPONENT_META.d.ts +169 -1
- package/dist/ZORA_GAME_COMPONENT_META.d.ts.map +1 -1
- package/dist/ZORA_GAME_COMPONENT_META.js +2 -0
- package/dist/ZORA_GAME_COMPONENT_META.js.map +1 -1
- package/dist/ZORA_GAME_PLUGIN.d.ts +175 -2
- package/dist/ZORA_GAME_PLUGIN.d.ts.map +1 -1
- package/dist/ZORA_GAME_PLUGIN.js +2 -0
- package/dist/ZORA_GAME_PLUGIN.js.map +1 -1
- package/dist/ZORA_PLUGIN_METADATA.d.ts +173 -2
- package/dist/ZORA_PLUGIN_METADATA.d.ts.map +1 -1
- package/dist/ZORA_PLUGIN_METADATA.js +5 -1
- package/dist/ZORA_PLUGIN_METADATA.js.map +1 -1
- package/dist/features/game-presentation/adapters/inbound/Game.d.ts.map +1 -1
- package/dist/features/game-presentation/adapters/inbound/Game.js +8 -3
- package/dist/features/game-presentation/adapters/inbound/Game.js.map +1 -1
- package/dist/features/game-presentation/adapters/inbound/GameEntity.d.ts.map +1 -1
- package/dist/features/game-presentation/adapters/inbound/GameEntity.js +4 -11
- package/dist/features/game-presentation/adapters/inbound/GameEntity.js.map +1 -1
- package/dist/features/game-presentation/adapters/inbound/GameInputZone.d.ts +4 -0
- package/dist/features/game-presentation/adapters/inbound/GameInputZone.d.ts.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/GameInputZone.js +35 -0
- package/dist/features/game-presentation/adapters/inbound/GameInputZone.js.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/createGamePointerEvent.d.ts +17 -0
- package/dist/features/game-presentation/adapters/inbound/createGamePointerEvent.d.ts.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/createGamePointerEvent.js +20 -0
- package/dist/features/game-presentation/adapters/inbound/createGamePointerEvent.js.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/useGameInputZoneResponder.d.ts +9 -0
- package/dist/features/game-presentation/adapters/inbound/useGameInputZoneResponder.d.ts.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/useGameInputZoneResponder.js +37 -0
- package/dist/features/game-presentation/adapters/inbound/useGameInputZoneResponder.js.map +1 -0
- package/dist/features/game-presentation/composition/createGameBindingContext.d.ts +4 -0
- package/dist/features/game-presentation/composition/createGameBindingContext.d.ts.map +1 -0
- package/dist/features/game-presentation/composition/createGameBindingContext.js +9 -0
- package/dist/features/game-presentation/composition/createGameBindingContext.js.map +1 -0
- package/dist/features/game-presentation/meta/gameEntityMeta.d.ts +58 -0
- package/dist/features/game-presentation/meta/gameEntityMeta.d.ts.map +1 -1
- package/dist/features/game-presentation/meta/gameEntityMeta.js +13 -0
- package/dist/features/game-presentation/meta/gameEntityMeta.js.map +1 -1
- package/dist/features/game-presentation/meta/gameInputZoneMeta.d.ts +112 -0
- package/dist/features/game-presentation/meta/gameInputZoneMeta.d.ts.map +1 -0
- package/dist/features/game-presentation/meta/gameInputZoneMeta.js +92 -0
- package/dist/features/game-presentation/meta/gameInputZoneMeta.js.map +1 -0
- package/dist/features/game-presentation/meta/gameMeta.d.ts +1 -1
- package/dist/features/game-presentation/meta/gameMeta.js +1 -1
- package/dist/features/game-presentation/meta/gameMeta.js.map +1 -1
- package/dist/features/game-presentation/public.d.ts +2 -1
- package/dist/features/game-presentation/public.d.ts.map +1 -1
- package/dist/features/game-presentation/public.js +1 -0
- package/dist/features/game-presentation/public.js.map +1 -1
- package/dist/features/game-presentation/utils/clampGamePercentage.d.ts +3 -0
- package/dist/features/game-presentation/utils/clampGamePercentage.d.ts.map +1 -0
- package/dist/features/game-presentation/utils/clampGamePercentage.js +5 -0
- package/dist/features/game-presentation/utils/clampGamePercentage.js.map +1 -0
- package/dist/features/game-presentation/utils/toGamePercentage.d.ts +3 -0
- package/dist/features/game-presentation/utils/toGamePercentage.d.ts.map +1 -0
- package/dist/features/game-presentation/utils/toGamePercentage.js +6 -0
- package/dist/features/game-presentation/utils/toGamePercentage.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/gamePresentation.d.ts +13 -0
- package/dist/types/gamePresentation.d.ts.map +1 -1
- package/dist/types/gamePresentation.js.map +1 -1
- package/package.json +3 -2
- package/src/ZORA_GAME_COMPONENT_META.ts +2 -0
- package/src/ZORA_GAME_PLUGIN.ts +2 -0
- package/src/ZORA_PLUGIN_METADATA.test.ts +20 -0
- package/src/ZORA_PLUGIN_METADATA.ts +5 -1
- package/src/features/game-presentation/adapters/inbound/Game.tsx +19 -11
- package/src/features/game-presentation/adapters/inbound/GameEntity.tsx +4 -13
- package/src/features/game-presentation/adapters/inbound/GameInputZone.tsx +70 -0
- package/src/features/game-presentation/adapters/inbound/createGamePointerEvent.test.ts +56 -0
- package/src/features/game-presentation/adapters/inbound/createGamePointerEvent.ts +39 -0
- package/src/features/game-presentation/adapters/inbound/useGameInputZoneResponder.ts +49 -0
- package/src/features/game-presentation/composition/createGameBindingContext.test.ts +47 -0
- package/src/features/game-presentation/composition/createGameBindingContext.ts +10 -0
- package/src/features/game-presentation/meta/gameEntityMeta.ts +13 -0
- package/src/features/game-presentation/meta/gameInputZoneMeta.ts +94 -0
- package/src/features/game-presentation/meta/gameMeta.ts +1 -1
- package/src/features/game-presentation/public.ts +2 -0
- package/src/features/game-presentation/utils/clampGamePercentage.ts +4 -0
- package/src/features/game-presentation/utils/toGamePercentage.ts +6 -0
- package/src/index.ts +8 -1
- package/src/types/gamePresentation.ts +14 -0
|
@@ -9,6 +9,19 @@ export const gameEntityMeta = {
|
|
|
9
9
|
label: 'Game entity',
|
|
10
10
|
defaultProps: { x: 0, y: 0, opacity: 1, scale: 1, rotation: 0, zIndex: 0 },
|
|
11
11
|
},
|
|
12
|
+
bindings: {
|
|
13
|
+
props: {
|
|
14
|
+
x: { value: { type: 'number' }, acceptsFallback: true },
|
|
15
|
+
y: { value: { type: 'number' }, acceptsFallback: true },
|
|
16
|
+
width: { value: { type: 'number' }, acceptsFallback: true },
|
|
17
|
+
height: { value: { type: 'number' }, acceptsFallback: true },
|
|
18
|
+
opacity: { value: { type: 'number' }, acceptsFallback: true },
|
|
19
|
+
scale: { value: { type: 'number' }, acceptsFallback: true },
|
|
20
|
+
rotation: { value: { type: 'number' }, acceptsFallback: true },
|
|
21
|
+
zIndex: { value: { type: 'number' }, acceptsFallback: true },
|
|
22
|
+
hidden: { value: { type: 'boolean' }, acceptsFallback: true },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
12
25
|
props: {
|
|
13
26
|
x: {
|
|
14
27
|
type: 'number',
|
|
@@ -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;KAC3E;IACD,KAAK,EAAE;QACL,CAAC,EAAE;YACD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,CAAC;YACV,SAAS,EAAE,EAAE,SAAS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,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,aAAa,EAAE;YACb,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,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,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 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,IAAI,EAAE,QAAQ,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;YACvD,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;YACvD,KAAK,EAAE,EAA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AAE,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"]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*** Describe a field-relative pointer/touch input adapter for one embeddable Game session. */
|
|
2
|
+
export declare const gameInputZoneMeta: {
|
|
3
|
+
readonly name: "GameInputZone";
|
|
4
|
+
readonly category: "component";
|
|
5
|
+
readonly description: "Normalizes pointer and touch positions into field-relative percentages and dispatches a generic game event.";
|
|
6
|
+
readonly directManifestNode: true;
|
|
7
|
+
readonly allowedChildren: readonly [];
|
|
8
|
+
readonly blueprint: {
|
|
9
|
+
readonly label: "Game input zone";
|
|
10
|
+
readonly defaultProps: {
|
|
11
|
+
readonly eventType: "game.pointer";
|
|
12
|
+
readonly x: 0;
|
|
13
|
+
readonly y: 0;
|
|
14
|
+
readonly width: 100;
|
|
15
|
+
readonly height: 100;
|
|
16
|
+
readonly zIndex: 1;
|
|
17
|
+
readonly enabled: true;
|
|
18
|
+
readonly continuous: true;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
readonly props: {
|
|
22
|
+
readonly eventType: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly category: "Input";
|
|
25
|
+
readonly label: "Game event type";
|
|
26
|
+
readonly default: "game.pointer";
|
|
27
|
+
readonly authoring: {
|
|
28
|
+
readonly authority: "instance";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
readonly entityId: {
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
readonly category: "Input";
|
|
34
|
+
readonly label: "Entity id";
|
|
35
|
+
readonly authoring: {
|
|
36
|
+
readonly authority: "instance";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly x: {
|
|
40
|
+
readonly type: "number";
|
|
41
|
+
readonly category: "Position";
|
|
42
|
+
readonly label: "X (%)";
|
|
43
|
+
readonly default: 0;
|
|
44
|
+
readonly authoring: {
|
|
45
|
+
readonly authority: "instance";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
readonly y: {
|
|
49
|
+
readonly type: "number";
|
|
50
|
+
readonly category: "Position";
|
|
51
|
+
readonly label: "Y (%)";
|
|
52
|
+
readonly default: 0;
|
|
53
|
+
readonly authoring: {
|
|
54
|
+
readonly authority: "instance";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly width: {
|
|
58
|
+
readonly type: "number";
|
|
59
|
+
readonly category: "Size";
|
|
60
|
+
readonly label: "Width (%)";
|
|
61
|
+
readonly default: 100;
|
|
62
|
+
readonly authoring: {
|
|
63
|
+
readonly authority: "instance";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
readonly height: {
|
|
67
|
+
readonly type: "number";
|
|
68
|
+
readonly category: "Size";
|
|
69
|
+
readonly label: "Height (%)";
|
|
70
|
+
readonly default: 100;
|
|
71
|
+
readonly authoring: {
|
|
72
|
+
readonly authority: "instance";
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
readonly zIndex: {
|
|
76
|
+
readonly type: "number";
|
|
77
|
+
readonly category: "Position";
|
|
78
|
+
readonly label: "Z index";
|
|
79
|
+
readonly default: 1;
|
|
80
|
+
readonly authoring: {
|
|
81
|
+
readonly authority: "instance";
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
readonly enabled: {
|
|
85
|
+
readonly type: "boolean";
|
|
86
|
+
readonly category: "State";
|
|
87
|
+
readonly label: "Enabled";
|
|
88
|
+
readonly default: true;
|
|
89
|
+
readonly authoring: {
|
|
90
|
+
readonly authority: "instance";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
readonly continuous: {
|
|
94
|
+
readonly type: "boolean";
|
|
95
|
+
readonly category: "Input";
|
|
96
|
+
readonly label: "Dispatch while moving";
|
|
97
|
+
readonly default: true;
|
|
98
|
+
readonly authoring: {
|
|
99
|
+
readonly authority: "instance";
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
readonly accessibilityLabel: {
|
|
103
|
+
readonly type: "string";
|
|
104
|
+
readonly category: "Accessibility";
|
|
105
|
+
readonly label: "Accessibility label";
|
|
106
|
+
readonly authoring: {
|
|
107
|
+
readonly authority: "instance";
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=gameInputZoneMeta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gameInputZoneMeta.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/meta/gameInputZoneMeta.ts"],"names":[],"mappings":"AAEA,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0FQ,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*** Describe a field-relative pointer/touch input adapter for one embeddable Game session. */
|
|
2
|
+
export const gameInputZoneMeta = {
|
|
3
|
+
name: 'GameInputZone',
|
|
4
|
+
category: 'component',
|
|
5
|
+
description: 'Normalizes pointer and touch positions into field-relative percentages and dispatches a generic game event.',
|
|
6
|
+
directManifestNode: true,
|
|
7
|
+
allowedChildren: [],
|
|
8
|
+
blueprint: {
|
|
9
|
+
label: 'Game input zone',
|
|
10
|
+
defaultProps: {
|
|
11
|
+
eventType: 'game.pointer',
|
|
12
|
+
x: 0,
|
|
13
|
+
y: 0,
|
|
14
|
+
width: 100,
|
|
15
|
+
height: 100,
|
|
16
|
+
zIndex: 1,
|
|
17
|
+
enabled: true,
|
|
18
|
+
continuous: true,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
eventType: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
category: 'Input',
|
|
25
|
+
label: 'Game event type',
|
|
26
|
+
default: 'game.pointer',
|
|
27
|
+
authoring: { authority: 'instance' },
|
|
28
|
+
},
|
|
29
|
+
entityId: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
category: 'Input',
|
|
32
|
+
label: 'Entity id',
|
|
33
|
+
authoring: { authority: 'instance' },
|
|
34
|
+
},
|
|
35
|
+
x: {
|
|
36
|
+
type: 'number',
|
|
37
|
+
category: 'Position',
|
|
38
|
+
label: 'X (%)',
|
|
39
|
+
default: 0,
|
|
40
|
+
authoring: { authority: 'instance' },
|
|
41
|
+
},
|
|
42
|
+
y: {
|
|
43
|
+
type: 'number',
|
|
44
|
+
category: 'Position',
|
|
45
|
+
label: 'Y (%)',
|
|
46
|
+
default: 0,
|
|
47
|
+
authoring: { authority: 'instance' },
|
|
48
|
+
},
|
|
49
|
+
width: {
|
|
50
|
+
type: 'number',
|
|
51
|
+
category: 'Size',
|
|
52
|
+
label: 'Width (%)',
|
|
53
|
+
default: 100,
|
|
54
|
+
authoring: { authority: 'instance' },
|
|
55
|
+
},
|
|
56
|
+
height: {
|
|
57
|
+
type: 'number',
|
|
58
|
+
category: 'Size',
|
|
59
|
+
label: 'Height (%)',
|
|
60
|
+
default: 100,
|
|
61
|
+
authoring: { authority: 'instance' },
|
|
62
|
+
},
|
|
63
|
+
zIndex: {
|
|
64
|
+
type: 'number',
|
|
65
|
+
category: 'Position',
|
|
66
|
+
label: 'Z index',
|
|
67
|
+
default: 1,
|
|
68
|
+
authoring: { authority: 'instance' },
|
|
69
|
+
},
|
|
70
|
+
enabled: {
|
|
71
|
+
type: 'boolean',
|
|
72
|
+
category: 'State',
|
|
73
|
+
label: 'Enabled',
|
|
74
|
+
default: true,
|
|
75
|
+
authoring: { authority: 'instance' },
|
|
76
|
+
},
|
|
77
|
+
continuous: {
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
category: 'Input',
|
|
80
|
+
label: 'Dispatch while moving',
|
|
81
|
+
default: true,
|
|
82
|
+
authoring: { authority: 'instance' },
|
|
83
|
+
},
|
|
84
|
+
accessibilityLabel: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
category: 'Accessibility',
|
|
87
|
+
label: 'Accessibility label',
|
|
88
|
+
authoring: { authority: 'instance' },
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=gameInputZoneMeta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gameInputZoneMeta.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/meta/gameInputZoneMeta.ts"],"names":[],"mappings":"AAEA,8FAA8F;AAC9F,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,WAAW;IACrB,WAAW,EACT,6GAA6G;IAC/G,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,EAAE;IACnB,SAAS,EAAE;QACT,KAAK,EAAE,iBAAiB;QACxB,YAAY,EAAE;YACZ,SAAS,EAAE,cAAc;YACzB,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC;YACJ,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;YACX,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI;SACjB;KACF;IACD,KAAK,EAAE;QACL,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,iBAAiB;YACxB,OAAO,EAAE,cAAc;YACvB,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QA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E,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 a field-relative pointer/touch input adapter for one embeddable Game session. */\nexport const gameInputZoneMeta = {\n name: 'GameInputZone',\n category: 'component',\n description:\n 'Normalizes pointer and touch positions into field-relative percentages and dispatches a generic game event.',\n directManifestNode: true,\n allowedChildren: [],\n blueprint: {\n label: 'Game input zone',\n defaultProps: {\n eventType: 'game.pointer',\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n zIndex: 1,\n enabled: true,\n continuous: true,\n },\n },\n props: {\n eventType: {\n type: 'string',\n category: 'Input',\n label: 'Game event type',\n default: 'game.pointer',\n authoring: { authority: 'instance' },\n },\n entityId: {\n type: 'string',\n category: 'Input',\n label: 'Entity id',\n authoring: { authority: 'instance' },\n },\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 default: 100,\n authoring: { authority: 'instance' },\n },\n height: {\n type: 'number',\n category: 'Size',\n label: 'Height (%)',\n default: 100,\n authoring: { authority: 'instance' },\n },\n zIndex: {\n type: 'number',\n category: 'Position',\n label: 'Z index',\n default: 1,\n authoring: { authority: 'instance' },\n },\n enabled: {\n type: 'boolean',\n category: 'State',\n label: 'Enabled',\n default: true,\n authoring: { authority: 'instance' },\n },\n continuous: {\n type: 'boolean',\n category: 'Input',\n label: 'Dispatch while moving',\n default: true,\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"]}
|
|
@@ -4,7 +4,7 @@ export declare const gameMeta: {
|
|
|
4
4
|
readonly category: "pattern";
|
|
5
5
|
readonly description: "Embeds one config-driven game session inside ordinary ZORA layout and emits domain-neutral game outputs.";
|
|
6
6
|
readonly directManifestNode: true;
|
|
7
|
-
readonly allowedChildren: readonly ["GameEntity", "GameOverlay", "Gradient", "Image", "View"];
|
|
7
|
+
readonly allowedChildren: readonly ["GameEntity", "GameInputZone", "GameOverlay", "Gradient", "Image", "View"];
|
|
8
8
|
readonly blueprint: {
|
|
9
9
|
readonly label: "Game";
|
|
10
10
|
readonly defaultProps: {
|
|
@@ -4,7 +4,7 @@ export const gameMeta = {
|
|
|
4
4
|
category: 'pattern',
|
|
5
5
|
description: 'Embeds one config-driven game session inside ordinary ZORA layout and emits domain-neutral game outputs.',
|
|
6
6
|
directManifestNode: true,
|
|
7
|
-
allowedChildren: ['GameEntity', 'GameOverlay', 'Gradient', 'Image', 'View'],
|
|
7
|
+
allowedChildren: ['GameEntity', 'GameInputZone', 'GameOverlay', 'Gradient', 'Image', 'View'],
|
|
8
8
|
blueprint: {
|
|
9
9
|
label: 'Game',
|
|
10
10
|
defaultProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gameMeta.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/meta/gameMeta.ts"],"names":[],"mappings":"AAEA,oGAAoG;AACpG,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,SAAS;IACnB,WAAW,EACT,0GAA0G;IAC5G,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"gameMeta.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/meta/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YACrB,OAAO,EAAE,CAAC;YACV,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,eAAe,EAAE;YACf,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,2BAA2B;YAClC,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,cAAc;YACrB,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,gBAAgB;YACvB,OAAO,EAAE,GAAG;YACZ,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,eAAe;YACtB,OAAO,EAAE,IAAI;YACb,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 the embeddable config-driven Game runtime/presentation boundary for ZORA authoring. */\nexport const gameMeta = {\n name: 'Game',\n category: 'pattern',\n description:\n 'Embeds one config-driven game session inside ordinary ZORA layout and emits domain-neutral game outputs.',\n directManifestNode: true,\n allowedChildren: ['GameEntity', 'GameInputZone', 'GameOverlay', 'Gradient', 'Image', 'View'],\n blueprint: {\n label: 'Game',\n defaultProps: {\n definition: {\n id: 'game',\n initialPhase: 'playing',\n stages: [{ id: 'main' }],\n rules: [],\n },\n seed: 0,\n resetKey: '',\n autoAdvanceTime: true,\n minHeight: 320,\n clip: true,\n },\n },\n bindings: {\n props: {\n definition: {\n value: { type: 'object' },\n acceptsFallback: true,\n },\n input: {\n value: { type: 'record' },\n acceptsFallback: true,\n },\n },\n },\n events: {\n output: {\n label: 'Game output',\n eventType: 'game.output',\n description: 'Emitted when the platform-neutral game runtime produces an app/domain output.',\n payloadFields: [\n { path: 'type', type: 'string' },\n { path: 'payload', type: 'record' },\n ],\n },\n },\n props: {\n seed: {\n type: 'number',\n category: 'Runtime',\n label: 'Initial seed',\n default: 0,\n authoring: { authority: 'instance' },\n },\n resetKey: {\n type: 'string',\n category: 'Runtime',\n label: 'Reset key',\n default: '',\n authoring: { authority: 'instance' },\n },\n autoAdvanceTime: {\n type: 'boolean',\n category: 'Runtime',\n label: 'Advance scheduled effects',\n default: true,\n authoring: { authority: 'instance' },\n },\n aspectRatio: {\n type: 'number',\n category: 'Layout',\n label: 'Aspect ratio',\n authoring: { authority: 'instance' },\n },\n minHeight: {\n type: 'number',\n category: 'Layout',\n label: 'Minimum height',\n default: 320,\n authoring: { authority: 'instance' },\n },\n clip: {\n type: 'boolean',\n category: 'Layout',\n label: 'Clip overflow',\n default: true,\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,6 +1,7 @@
|
|
|
1
|
-
export type { GameEntityProps, GameFieldProps, GameOverlayPlacement, GameOverlayProps, GamePointerEvents, GameProps, } from '../../types/gamePresentation';
|
|
1
|
+
export type { GameEntityProps, GameFieldProps, GameInputZoneProps, GameOverlayPlacement, GameOverlayProps, GamePointerEvents, GameProps, } from '../../types/gamePresentation';
|
|
2
2
|
export { Game } from './adapters/inbound/Game';
|
|
3
3
|
export { GameEntity } from './adapters/inbound/GameEntity';
|
|
4
4
|
export { GameField } from './adapters/inbound/GameField';
|
|
5
|
+
export { GameInputZone } from './adapters/inbound/GameInputZone';
|
|
5
6
|
export { GameOverlay } from './adapters/inbound/GameOverlay';
|
|
6
7
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/game-presentation/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,GACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/game-presentation/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,GACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { Game } from './adapters/inbound/Game';
|
|
2
2
|
export { GameEntity } from './adapters/inbound/GameEntity';
|
|
3
3
|
export { GameField } from './adapters/inbound/GameField';
|
|
4
|
+
export { GameInputZone } from './adapters/inbound/GameInputZone';
|
|
4
5
|
export { GameOverlay } from './adapters/inbound/GameOverlay';
|
|
5
6
|
//# sourceMappingURL=public.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/game-presentation/public.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/game-presentation/public.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["export type {\n GameEntityProps,\n GameFieldProps,\n GameInputZoneProps,\n GameOverlayPlacement,\n GameOverlayProps,\n GamePointerEvents,\n GameProps,\n} from '../../types/gamePresentation';\nexport { Game } from './adapters/inbound/Game';\nexport { GameEntity } from './adapters/inbound/GameEntity';\nexport { GameField } from './adapters/inbound/GameField';\nexport { GameInputZone } from './adapters/inbound/GameInputZone';\nexport { GameOverlay } from './adapters/inbound/GameOverlay';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clampGamePercentage.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/utils/clampGamePercentage.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clampGamePercentage.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/utils/clampGamePercentage.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/*** Clamp one game presentation coordinate to the inclusive field-percentage range. */\nexport function clampGamePercentage(value: number): number {\n return Math.min(100, Math.max(0, value));\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toGamePercentage.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/utils/toGamePercentage.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,MAAM,GAAG,CAE5D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { clampGamePercentage } from './clampGamePercentage';
|
|
2
|
+
/*** Convert one game percentage coordinate to React Native percentage style syntax. */
|
|
3
|
+
export function toGamePercentage(value) {
|
|
4
|
+
return `${clampGamePercentage(value)}%`;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=toGamePercentage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toGamePercentage.js","sourceRoot":"","sources":["../../../../src/features/game-presentation/utils/toGamePercentage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,uFAAuF;AACvF,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC;AAC1C,CAAC","sourcesContent":["import { clampGamePercentage } from './clampGamePercentage';\n\n/*** Convert one game percentage coordinate to React Native percentage style syntax. */\nexport function toGamePercentage(value: number): `${number}%` {\n return `${clampGamePercentage(value)}%`;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { GameEntityProps, GameFieldProps, GameOverlayPlacement, GameOverlayProps, GamePointerEvents, GameProps, } from './features/game-presentation/public';
|
|
2
|
-
export { Game, GameEntity, GameField, GameOverlay } from './features/game-presentation/public';
|
|
1
|
+
export type { GameEntityProps, GameFieldProps, GameInputZoneProps, GameOverlayPlacement, GameOverlayProps, GamePointerEvents, GameProps, } from './features/game-presentation/public';
|
|
2
|
+
export { Game, GameEntity, GameField, GameInputZone, GameOverlay, } from './features/game-presentation/public';
|
|
3
3
|
export { ZORA_GAME_PLUGIN } from './ZORA_GAME_PLUGIN';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,GACV,MAAM,qCAAqC,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,GACV,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,aAAa,EACb,WAAW,GACZ,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Game, GameEntity, GameField, GameOverlay } from './features/game-presentation/public';
|
|
1
|
+
export { Game, GameEntity, GameField, GameInputZone, GameOverlay, } from './features/game-presentation/public';
|
|
2
2
|
export { ZORA_GAME_PLUGIN } from './ZORA_GAME_PLUGIN';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,aAAa,EACb,WAAW,GACZ,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export type {\n GameEntityProps,\n GameFieldProps,\n GameInputZoneProps,\n GameOverlayPlacement,\n GameOverlayProps,\n GamePointerEvents,\n GameProps,\n} from './features/game-presentation/public';\nexport {\n Game,\n GameEntity,\n GameField,\n GameInputZone,\n GameOverlay,\n} from './features/game-presentation/public';\nexport { ZORA_GAME_PLUGIN } from './ZORA_GAME_PLUGIN';\n"]}
|
|
@@ -26,6 +26,19 @@ export interface GameEntityProps {
|
|
|
26
26
|
readonly accessibilityLabel?: string;
|
|
27
27
|
readonly testID?: string;
|
|
28
28
|
}
|
|
29
|
+
export interface GameInputZoneProps {
|
|
30
|
+
readonly eventType: string;
|
|
31
|
+
readonly entityId?: string;
|
|
32
|
+
readonly x?: number;
|
|
33
|
+
readonly y?: number;
|
|
34
|
+
readonly width?: number;
|
|
35
|
+
readonly height?: number;
|
|
36
|
+
readonly zIndex?: number;
|
|
37
|
+
readonly enabled?: boolean;
|
|
38
|
+
readonly continuous?: boolean;
|
|
39
|
+
readonly accessibilityLabel?: string;
|
|
40
|
+
readonly testID?: string;
|
|
41
|
+
}
|
|
29
42
|
export interface GameOverlayProps {
|
|
30
43
|
readonly children?: React.ReactNode;
|
|
31
44
|
readonly placement?: GameOverlayPlacement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gamePresentation.d.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ACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CAClD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gamePresentation.js","sourceRoot":"","sources":["../../src/types/gamePresentation.ts"],"names":[],"mappings":"","sourcesContent":["import type { GameDefinition, GameInput, GameOutput } from '@ankhorage/game';\nimport type React from 'react';\n\ntype GameOverlayCornerPlacement = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\n\nexport type GamePointerEvents = 'auto' | 'box-none' | 'box-only' | 'none';\nexport type GameOverlayPlacement =\n 'fill' | 'center' | 'top' | 'bottom' | GameOverlayCornerPlacement;\n\nexport interface GameFieldProps {\n readonly children?: React.ReactNode;\n readonly aspectRatio?: number;\n readonly minHeight?: number;\n readonly clip?: boolean;\n readonly accessibilityLabel?: string;\n readonly testID?: string;\n}\n\nexport interface GameEntityProps {\n readonly children?: React.ReactNode;\n readonly x?: number;\n readonly y?: number;\n readonly width?: number;\n readonly height?: number;\n readonly opacity?: number;\n readonly scale?: number;\n readonly rotation?: number;\n readonly zIndex?: number;\n readonly hidden?: boolean;\n readonly pointerEvents?: GamePointerEvents;\n readonly accessibilityLabel?: string;\n readonly testID?: string;\n}\n\nexport interface GameOverlayProps {\n readonly children?: React.ReactNode;\n readonly placement?: GameOverlayPlacement;\n readonly blocking?: boolean;\n readonly padding?: number;\n readonly accessibilityLabel?: string;\n readonly testID?: string;\n}\n\nexport interface GameProps extends GameFieldProps {\n readonly definition: GameDefinition;\n readonly input?: GameInput;\n readonly seed?: number;\n readonly resetKey?: string;\n readonly autoAdvanceTime?: boolean;\n readonly onOutput?: (output: GameOutput) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"gamePresentation.js","sourceRoot":"","sources":["../../src/types/gamePresentation.ts"],"names":[],"mappings":"","sourcesContent":["import type { GameDefinition, GameInput, GameOutput } from '@ankhorage/game';\nimport type React from 'react';\n\ntype GameOverlayCornerPlacement = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\n\nexport type GamePointerEvents = 'auto' | 'box-none' | 'box-only' | 'none';\nexport type GameOverlayPlacement =\n 'fill' | 'center' | 'top' | 'bottom' | GameOverlayCornerPlacement;\n\nexport interface GameFieldProps {\n readonly children?: React.ReactNode;\n readonly aspectRatio?: number;\n readonly minHeight?: number;\n readonly clip?: boolean;\n readonly accessibilityLabel?: string;\n readonly testID?: string;\n}\n\nexport interface GameEntityProps {\n readonly children?: React.ReactNode;\n readonly x?: number;\n readonly y?: number;\n readonly width?: number;\n readonly height?: number;\n readonly opacity?: number;\n readonly scale?: number;\n readonly rotation?: number;\n readonly zIndex?: number;\n readonly hidden?: boolean;\n readonly pointerEvents?: GamePointerEvents;\n readonly accessibilityLabel?: string;\n readonly testID?: string;\n}\n\nexport interface GameInputZoneProps {\n readonly eventType: string;\n readonly entityId?: string;\n readonly x?: number;\n readonly y?: number;\n readonly width?: number;\n readonly height?: number;\n readonly zIndex?: number;\n readonly enabled?: boolean;\n readonly continuous?: boolean;\n readonly accessibilityLabel?: string;\n readonly testID?: string;\n}\n\nexport interface GameOverlayProps {\n readonly children?: React.ReactNode;\n readonly placement?: GameOverlayPlacement;\n readonly blocking?: boolean;\n readonly padding?: number;\n readonly accessibilityLabel?: string;\n readonly testID?: string;\n}\n\nexport interface GameProps extends GameFieldProps {\n readonly definition: GameDefinition;\n readonly input?: GameInput;\n readonly seed?: number;\n readonly resetKey?: string;\n readonly autoAdvanceTime?: boolean;\n readonly onOutput?: (output: GameOutput) => void;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/zora-game",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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",
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
},
|
|
94
94
|
"packageManager": "bun@1.4.2",
|
|
95
95
|
"dependencies": {
|
|
96
|
-
"@ankhorage/game": "^0.1.0"
|
|
96
|
+
"@ankhorage/game": "^0.1.0",
|
|
97
|
+
"@ankhorage/runtime": "^2.3.1"
|
|
97
98
|
}
|
|
98
99
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { gameEntityMeta } from './features/game-presentation/meta/gameEntityMeta';
|
|
2
2
|
import { gameFieldMeta } from './features/game-presentation/meta/gameFieldMeta';
|
|
3
|
+
import { gameInputZoneMeta } from './features/game-presentation/meta/gameInputZoneMeta';
|
|
3
4
|
import { gameMeta } from './features/game-presentation/meta/gameMeta';
|
|
4
5
|
import { gameOverlayMeta } from './features/game-presentation/meta/gameOverlayMeta';
|
|
5
6
|
|
|
@@ -8,5 +9,6 @@ export const ZORA_GAME_COMPONENT_META = {
|
|
|
8
9
|
Game: gameMeta,
|
|
9
10
|
GameEntity: gameEntityMeta,
|
|
10
11
|
GameField: gameFieldMeta,
|
|
12
|
+
GameInputZone: gameInputZoneMeta,
|
|
11
13
|
GameOverlay: gameOverlayMeta,
|
|
12
14
|
} as const;
|
package/src/ZORA_GAME_PLUGIN.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Game } from './features/game-presentation/adapters/inbound/Game';
|
|
2
2
|
import { GameEntity } from './features/game-presentation/adapters/inbound/GameEntity';
|
|
3
3
|
import { GameField } from './features/game-presentation/adapters/inbound/GameField';
|
|
4
|
+
import { GameInputZone } from './features/game-presentation/adapters/inbound/GameInputZone';
|
|
4
5
|
import { GameOverlay } from './features/game-presentation/adapters/inbound/GameOverlay';
|
|
5
6
|
import { ZORA_PLUGIN_METADATA } from './ZORA_PLUGIN_METADATA';
|
|
6
7
|
|
|
@@ -11,6 +12,7 @@ export const ZORA_GAME_PLUGIN = {
|
|
|
11
12
|
Game,
|
|
12
13
|
GameEntity,
|
|
13
14
|
GameField,
|
|
15
|
+
GameInputZone,
|
|
14
16
|
GameOverlay,
|
|
15
17
|
},
|
|
16
18
|
} as const;
|
|
@@ -18,9 +18,20 @@ describe('ZORA game plugin metadata', () => {
|
|
|
18
18
|
expect(gameField.allowedChildren).toContain('GameEntity');
|
|
19
19
|
expect(gameField.allowedChildren).toContain('GameOverlay');
|
|
20
20
|
expect(game.allowedChildren).toContain('GameEntity');
|
|
21
|
+
expect(game.allowedChildren).toContain('GameInputZone');
|
|
21
22
|
expect(game.allowedChildren).toContain('GameOverlay');
|
|
22
23
|
});
|
|
23
24
|
|
|
25
|
+
test('keeps Game input zones scoped to runtime-owning Game parents', () => {
|
|
26
|
+
const catalog = composeZoraPluginMetadata([ZORA_CORE_PLUGIN_METADATA, ZORA_PLUGIN_METADATA]);
|
|
27
|
+
const gameInputZone = readComponentMeta(catalog.componentMeta.GameInputZone, 'GameInputZone');
|
|
28
|
+
|
|
29
|
+
expect(gameInputZone.props.eventType?.type).toBe('string');
|
|
30
|
+
expect(gameInputZone.props.continuous?.type).toBe('boolean');
|
|
31
|
+
expect(catalog.componentMeta.Game?.allowedChildren).toContain('GameInputZone');
|
|
32
|
+
expect(catalog.componentMeta.GameField?.allowedChildren).not.toContain('GameInputZone');
|
|
33
|
+
});
|
|
34
|
+
|
|
24
35
|
test('describes bindable Game inputs and domain-neutral outputs', () => {
|
|
25
36
|
const catalog = composeZoraPluginMetadata([ZORA_CORE_PLUGIN_METADATA, ZORA_PLUGIN_METADATA]);
|
|
26
37
|
const game = readComponentMeta(catalog.componentMeta.Game, 'Game');
|
|
@@ -30,6 +41,15 @@ describe('ZORA game plugin metadata', () => {
|
|
|
30
41
|
expect(game.events?.output?.eventType).toBe('game.output');
|
|
31
42
|
});
|
|
32
43
|
|
|
44
|
+
test('exposes GameEntity presentation props to canonical ZORA bindings', () => {
|
|
45
|
+
const catalog = composeZoraPluginMetadata([ZORA_CORE_PLUGIN_METADATA, ZORA_PLUGIN_METADATA]);
|
|
46
|
+
const gameEntity = readComponentMeta(catalog.componentMeta.GameEntity, 'GameEntity');
|
|
47
|
+
|
|
48
|
+
expect(gameEntity.bindings?.props?.x?.value.type).toBe('number');
|
|
49
|
+
expect(gameEntity.bindings?.props?.y?.value.type).toBe('number');
|
|
50
|
+
expect(gameEntity.bindings?.props?.hidden?.value.type).toBe('boolean');
|
|
51
|
+
});
|
|
52
|
+
|
|
33
53
|
test('keeps the generic presentation vocabulary free of product-specific concepts', () => {
|
|
34
54
|
const serialized = JSON.stringify(ZORA_PLUGIN_METADATA).toLowerCase();
|
|
35
55
|
|
|
@@ -7,7 +7,7 @@ export const ZORA_PLUGIN_METADATA = {
|
|
|
7
7
|
packageName: '@ankhorage/zora-game',
|
|
8
8
|
displayName: 'ZORA Game',
|
|
9
9
|
componentMeta: ZORA_GAME_COMPONENT_META,
|
|
10
|
-
extensionHosts: ['Game', 'GameField', '
|
|
10
|
+
extensionHosts: ['Game', 'GameEntity', 'GameField', 'GameInputZone', 'GameOverlay'],
|
|
11
11
|
placements: [
|
|
12
12
|
{
|
|
13
13
|
child: 'Game',
|
|
@@ -21,6 +21,10 @@ export const ZORA_PLUGIN_METADATA = {
|
|
|
21
21
|
child: 'GameEntity',
|
|
22
22
|
parents: ['Game', 'GameField', 'GameOverlay'],
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
child: 'GameInputZone',
|
|
26
|
+
parents: ['Game'],
|
|
27
|
+
},
|
|
24
28
|
{
|
|
25
29
|
child: 'GameOverlay',
|
|
26
30
|
parents: ['Game', 'GameField'],
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { RuntimeRendererConfigProvider } from '@ankhorage/runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
import type { GameProps } from '../../../../types/gamePresentation';
|
|
5
|
+
import { createGameBindingContext } from '../../composition/createGameBindingContext';
|
|
4
6
|
import { GameRuntimeContext } from '../../composition/GameRuntimeContext';
|
|
5
7
|
import { useGameRuntime } from '../../composition/useGameRuntime';
|
|
6
8
|
import { GameField } from './GameField';
|
|
@@ -8,20 +10,26 @@ import { GameField } from './GameField';
|
|
|
8
10
|
/*** Bind one serializable game definition to a local transient session and presentation field. */
|
|
9
11
|
export function Game(props: GameProps) {
|
|
10
12
|
const runtime = useGameRuntime(props);
|
|
13
|
+
const runtimeBindingConfig = React.useMemo(
|
|
14
|
+
() => ({ bindingContext: createGameBindingContext(runtime.session) }),
|
|
15
|
+
[runtime.session],
|
|
16
|
+
);
|
|
11
17
|
|
|
12
18
|
return (
|
|
13
19
|
<GameRuntimeContext.Provider value={runtime}>
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
<RuntimeRendererConfigProvider value={runtimeBindingConfig}>
|
|
21
|
+
<GameField
|
|
22
|
+
{...(props.aspectRatio === undefined ? {} : { aspectRatio: props.aspectRatio })}
|
|
23
|
+
{...(props.minHeight === undefined ? {} : { minHeight: props.minHeight })}
|
|
24
|
+
{...(props.clip === undefined ? {} : { clip: props.clip })}
|
|
25
|
+
{...(props.accessibilityLabel === undefined
|
|
26
|
+
? {}
|
|
27
|
+
: { accessibilityLabel: props.accessibilityLabel })}
|
|
28
|
+
{...(props.testID === undefined ? {} : { testID: props.testID })}
|
|
29
|
+
>
|
|
30
|
+
{props.children}
|
|
31
|
+
</GameField>
|
|
32
|
+
</RuntimeRendererConfigProvider>
|
|
25
33
|
</GameRuntimeContext.Provider>
|
|
26
34
|
);
|
|
27
35
|
}
|