@ankhorage/zora-game 0.4.1 → 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.
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/ZORA_GAME_COMPONENT_META.d.ts +177 -2
- 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 +182 -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 +180 -2
- package/dist/ZORA_PLUGIN_METADATA.d.ts.map +1 -1
- package/dist/ZORA_PLUGIN_METADATA.js +4 -0
- 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 +4 -1
- package/dist/features/game-presentation/adapters/inbound/Game.js.map +1 -1
- package/dist/features/game-presentation/adapters/inbound/GameEntity.d.ts +2 -1
- package/dist/features/game-presentation/adapters/inbound/GameEntity.d.ts.map +1 -1
- package/dist/features/game-presentation/adapters/inbound/GameEntity.js +14 -4
- package/dist/features/game-presentation/adapters/inbound/GameEntity.js.map +1 -1
- package/dist/features/game-presentation/adapters/inbound/GameInputZone.d.ts +2 -2
- package/dist/features/game-presentation/adapters/inbound/GameInputZone.d.ts.map +1 -1
- package/dist/features/game-presentation/adapters/inbound/GameInputZone.js +19 -5
- package/dist/features/game-presentation/adapters/inbound/GameInputZone.js.map +1 -1
- package/dist/features/game-presentation/adapters/inbound/GameMeasurementProbe.d.ts +4 -0
- package/dist/features/game-presentation/adapters/inbound/GameMeasurementProbe.d.ts.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/GameMeasurementProbe.js +52 -0
- package/dist/features/game-presentation/adapters/inbound/GameMeasurementProbe.js.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/createGameKeyboardEvent.d.ts +16 -0
- package/dist/features/game-presentation/adapters/inbound/createGameKeyboardEvent.d.ts.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/createGameKeyboardEvent.js +16 -0
- package/dist/features/game-presentation/adapters/inbound/createGameKeyboardEvent.js.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/createGameMeasurementEvent.d.ts +14 -0
- package/dist/features/game-presentation/adapters/inbound/createGameMeasurementEvent.d.ts.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/createGameMeasurementEvent.js +25 -0
- package/dist/features/game-presentation/adapters/inbound/createGameMeasurementEvent.js.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/measureGameEntity.d.ts +5 -0
- package/dist/features/game-presentation/adapters/inbound/measureGameEntity.d.ts.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/measureGameEntity.js +22 -0
- package/dist/features/game-presentation/adapters/inbound/measureGameEntity.js.map +1 -0
- package/dist/features/game-presentation/adapters/inbound/useGameInputZoneResponder.d.ts +6 -0
- package/dist/features/game-presentation/adapters/inbound/useGameInputZoneResponder.d.ts.map +1 -1
- package/dist/features/game-presentation/adapters/inbound/useGameInputZoneResponder.js +15 -0
- package/dist/features/game-presentation/adapters/inbound/useGameInputZoneResponder.js.map +1 -1
- package/dist/features/game-presentation/composition/createGameMeasurementRegistry.d.ts +4 -0
- package/dist/features/game-presentation/composition/createGameMeasurementRegistry.d.ts.map +1 -0
- package/dist/features/game-presentation/composition/createGameMeasurementRegistry.js +15 -0
- package/dist/features/game-presentation/composition/createGameMeasurementRegistry.js.map +1 -0
- package/dist/features/game-presentation/composition/useGameRuntime.d.ts +2 -2
- package/dist/features/game-presentation/composition/useGameRuntime.d.ts.map +1 -1
- package/dist/features/game-presentation/composition/useGameRuntime.js.map +1 -1
- package/dist/features/game-presentation/meta/gameEntityMeta.d.ts +14 -0
- package/dist/features/game-presentation/meta/gameEntityMeta.d.ts.map +1 -1
- package/dist/features/game-presentation/meta/gameEntityMeta.js +7 -0
- package/dist/features/game-presentation/meta/gameEntityMeta.js.map +1 -1
- package/dist/features/game-presentation/meta/gameInputZoneMeta.d.ts +52 -1
- package/dist/features/game-presentation/meta/gameInputZoneMeta.d.ts.map +1 -1
- package/dist/features/game-presentation/meta/gameInputZoneMeta.js +47 -1
- package/dist/features/game-presentation/meta/gameInputZoneMeta.js.map +1 -1
- package/dist/features/game-presentation/meta/gameMeasurementProbeMeta.d.ts +112 -0
- package/dist/features/game-presentation/meta/gameMeasurementProbeMeta.d.ts.map +1 -0
- package/dist/features/game-presentation/meta/gameMeasurementProbeMeta.js +70 -0
- package/dist/features/game-presentation/meta/gameMeasurementProbeMeta.js.map +1 -0
- package/dist/features/game-presentation/meta/gameMeta.d.ts +1 -1
- package/dist/features/game-presentation/meta/gameMeta.d.ts.map +1 -1
- package/dist/features/game-presentation/meta/gameMeta.js +9 -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/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 +16 -0
- package/dist/types/gamePresentation.d.ts.map +1 -1
- package/dist/types/gamePresentation.js.map +1 -1
- package/dist/types/gameRuntime.d.ts +16 -1
- package/dist/types/gameRuntime.d.ts.map +1 -1
- package/dist/types/gameRuntime.js.map +1 -1
- package/package.json +1 -1
- package/src/ZORA_GAME_COMPONENT_META.ts +2 -0
- package/src/ZORA_GAME_PLUGIN.ts +2 -0
- package/src/ZORA_PLUGIN_METADATA.test.ts +37 -10
- package/src/ZORA_PLUGIN_METADATA.ts +4 -0
- package/src/features/game-presentation/adapters/inbound/Game.tsx +7 -1
- package/src/features/game-presentation/adapters/inbound/GameEntity.tsx +15 -2
- package/src/features/game-presentation/adapters/inbound/GameInputZone.tsx +36 -9
- package/src/features/game-presentation/adapters/inbound/GameMeasurementProbe.tsx +79 -0
- package/src/features/game-presentation/adapters/inbound/createGameKeyboardEvent.test.ts +51 -0
- package/src/features/game-presentation/adapters/inbound/createGameKeyboardEvent.ts +33 -0
- package/src/features/game-presentation/adapters/inbound/createGameMeasurementEvent.test.ts +56 -0
- package/src/features/game-presentation/adapters/inbound/createGameMeasurementEvent.ts +38 -0
- package/src/features/game-presentation/adapters/inbound/measureGameEntity.ts +28 -0
- package/src/features/game-presentation/adapters/inbound/useGameInputZoneResponder.ts +22 -0
- package/src/features/game-presentation/composition/createGameMeasurementRegistry.test.ts +35 -0
- package/src/features/game-presentation/composition/createGameMeasurementRegistry.ts +16 -0
- package/src/features/game-presentation/composition/useGameRuntime.ts +3 -3
- package/src/features/game-presentation/meta/gameEntityMeta.ts +7 -0
- package/src/features/game-presentation/meta/gameInputZoneMeta.ts +47 -1
- package/src/features/game-presentation/meta/gameMeasurementProbeMeta.ts +72 -0
- package/src/features/game-presentation/meta/gameMeta.ts +9 -1
- package/src/features/game-presentation/public.ts +3 -0
- package/src/index.ts +3 -0
- package/src/types/gamePresentation.ts +18 -0
- package/src/types/gameRuntime.ts +19 -1
|
@@ -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"]}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { GestureResponderEvent, LayoutChangeEvent } from 'react-native';
|
|
2
2
|
import type { GameInputZoneProps } from '../../../../types/gamePresentation';
|
|
3
|
+
interface GameKeyboardInputEvent {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
preventDefault(): void;
|
|
6
|
+
}
|
|
3
7
|
/*** Own React Native responder measurement and event dispatch for one Game input zone. */
|
|
4
8
|
export declare function useGameInputZoneResponder(props: GameInputZoneProps): {
|
|
9
|
+
dispatchKeyboard: (event: GameKeyboardInputEvent) => void;
|
|
5
10
|
dispatchPointer: (event: GestureResponderEvent) => void;
|
|
6
11
|
handleLayout: (event: LayoutChangeEvent) => void;
|
|
7
12
|
shouldSetResponder: () => boolean;
|
|
8
13
|
};
|
|
14
|
+
export {};
|
|
9
15
|
//# sourceMappingURL=useGameInputZoneResponder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGameInputZoneResponder.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/useGameInputZoneResponder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"useGameInputZoneResponder.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/useGameInputZoneResponder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAK7E,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,cAAc,IAAI,IAAI,CAAC;CACxB;AAOD,0FAA0F;AAC1F,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,kBAAkB;8BA+BvD,sBAAsB;6BApBtB,qBAAqB;0BANgB,iBAAiB;;EA8CjE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { GameRuntimeContext } from '../../composition/GameRuntimeContext';
|
|
3
|
+
import { createGameKeyboardEvent } from './createGameKeyboardEvent';
|
|
3
4
|
import { createGamePointerEvent } from './createGamePointerEvent';
|
|
4
5
|
/*** Own React Native responder measurement and event dispatch for one Game input zone. */
|
|
5
6
|
export function useGameInputZoneResponder(props) {
|
|
@@ -28,7 +29,21 @@ export function useGameInputZoneResponder(props) {
|
|
|
28
29
|
if (gameEvent !== undefined)
|
|
29
30
|
runtime.dispatch(gameEvent);
|
|
30
31
|
}, [props.entityId, props.eventType, props.height, props.width, props.x, props.y, runtime]);
|
|
32
|
+
const dispatchKeyboard = React.useCallback((event) => {
|
|
33
|
+
const result = createGameKeyboardEvent({
|
|
34
|
+
bindings: props.keyboardBindings ?? [],
|
|
35
|
+
fallbackEventType: props.eventType,
|
|
36
|
+
...(props.entityId === undefined ? {} : { fallbackEntityId: props.entityId }),
|
|
37
|
+
key: event.key,
|
|
38
|
+
});
|
|
39
|
+
if (result === undefined)
|
|
40
|
+
return;
|
|
41
|
+
if (result.preventDefault)
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
runtime.dispatch(result.event);
|
|
44
|
+
}, [props.entityId, props.eventType, props.keyboardBindings, runtime]);
|
|
31
45
|
return {
|
|
46
|
+
dispatchKeyboard,
|
|
32
47
|
dispatchPointer,
|
|
33
48
|
handleLayout,
|
|
34
49
|
shouldSetResponder: () => props.enabled ?? true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGameInputZoneResponder.js","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/useGameInputZoneResponder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"useGameInputZoneResponder.js","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/useGameInputZoneResponder.ts"],"names":[],"mappings":"AAAA,OAAO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F,OAAO;QACL,gBAAgB;QAChB,eAAe;QACf,YAAY;QACZ,kBAAkB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI;KAChD,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport type { GestureResponderEvent, LayoutChangeEvent } from 'react-native';\n\nimport type { GameInputZoneProps } from '../../../../types/gamePresentation';\nimport { GameRuntimeContext } from '../../composition/GameRuntimeContext';\nimport { createGameKeyboardEvent } from './createGameKeyboardEvent';\nimport { createGamePointerEvent } from './createGamePointerEvent';\n\ninterface GameKeyboardInputEvent {\n readonly key: string;\n preventDefault(): void;\n}\n\ninterface MeasuredSize {\n readonly width: number;\n readonly height: number;\n}\n\n/*** Own React Native responder measurement and event dispatch for one Game input zone. */\nexport function useGameInputZoneResponder(props: GameInputZoneProps) {\n const runtime = React.useContext(GameRuntimeContext);\n if (runtime === null) throw new Error('GameInputZone must be rendered inside Game.');\n\n const measuredSizeRef = React.useRef<MeasuredSize>({ width: 0, height: 0 });\n const handleLayout = React.useCallback((event: LayoutChangeEvent) => {\n const { width, height } = event.nativeEvent.layout;\n measuredSizeRef.current = { width, height };\n }, []);\n\n const dispatchPointer = React.useCallback(\n (event: GestureResponderEvent) => {\n const measured = measuredSizeRef.current;\n const gameEvent = createGamePointerEvent({\n eventType: props.eventType,\n ...(props.entityId === undefined ? {} : { entityId: props.entityId }),\n localX: event.nativeEvent.locationX,\n localY: event.nativeEvent.locationY,\n measuredWidth: measured.width,\n measuredHeight: measured.height,\n zoneX: props.x ?? 0,\n zoneY: props.y ?? 0,\n zoneWidth: props.width ?? 100,\n zoneHeight: props.height ?? 100,\n });\n if (gameEvent !== undefined) runtime.dispatch(gameEvent);\n },\n [props.entityId, props.eventType, props.height, props.width, props.x, props.y, runtime],\n );\n\n const dispatchKeyboard = React.useCallback(\n (event: GameKeyboardInputEvent) => {\n const result = createGameKeyboardEvent({\n bindings: props.keyboardBindings ?? [],\n fallbackEventType: props.eventType,\n ...(props.entityId === undefined ? {} : { fallbackEntityId: props.entityId }),\n key: event.key,\n });\n if (result === undefined) return;\n if (result.preventDefault) event.preventDefault();\n runtime.dispatch(result.event);\n },\n [props.entityId, props.eventType, props.keyboardBindings, runtime],\n );\n\n return {\n dispatchKeyboard,\n dispatchPointer,\n handleLayout,\n shouldSetResponder: () => props.enabled ?? true,\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 {
|
|
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):
|
|
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,
|
|
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,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AAC;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 { 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":"useGameRu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,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
|
|
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 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,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"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const gameInputZoneMeta: {
|
|
3
3
|
readonly name: "GameInputZone";
|
|
4
4
|
readonly category: "component";
|
|
5
|
-
readonly description: "Normalizes pointer
|
|
5
|
+
readonly description: "Normalizes pointer/touch positions and optional keyboard bindings into generic game events.";
|
|
6
6
|
readonly directManifestNode: true;
|
|
7
7
|
readonly allowedChildren: readonly [];
|
|
8
8
|
readonly blueprint: {
|
|
@@ -99,6 +99,57 @@ export declare const gameInputZoneMeta: {
|
|
|
99
99
|
readonly authority: "instance";
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
|
+
readonly keyboardBindings: {
|
|
103
|
+
readonly type: "array";
|
|
104
|
+
readonly category: "Input";
|
|
105
|
+
readonly label: "Keyboard bindings";
|
|
106
|
+
readonly default: readonly [];
|
|
107
|
+
readonly itemSchema: readonly [{
|
|
108
|
+
readonly key: "key";
|
|
109
|
+
readonly schema: {
|
|
110
|
+
readonly type: "string";
|
|
111
|
+
readonly category: "Input";
|
|
112
|
+
readonly label: "Key";
|
|
113
|
+
readonly authoring: {
|
|
114
|
+
readonly authority: "instance";
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}, {
|
|
118
|
+
readonly key: "eventType";
|
|
119
|
+
readonly schema: {
|
|
120
|
+
readonly type: "string";
|
|
121
|
+
readonly category: "Input";
|
|
122
|
+
readonly label: "Event type";
|
|
123
|
+
readonly authoring: {
|
|
124
|
+
readonly authority: "instance";
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
}, {
|
|
128
|
+
readonly key: "entityId";
|
|
129
|
+
readonly schema: {
|
|
130
|
+
readonly type: "string";
|
|
131
|
+
readonly category: "Input";
|
|
132
|
+
readonly label: "Entity id";
|
|
133
|
+
readonly authoring: {
|
|
134
|
+
readonly authority: "instance";
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
}, {
|
|
138
|
+
readonly key: "preventDefault";
|
|
139
|
+
readonly schema: {
|
|
140
|
+
readonly type: "boolean";
|
|
141
|
+
readonly category: "Input";
|
|
142
|
+
readonly label: "Prevent browser default";
|
|
143
|
+
readonly default: false;
|
|
144
|
+
readonly authoring: {
|
|
145
|
+
readonly authority: "instance";
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
}];
|
|
149
|
+
readonly authoring: {
|
|
150
|
+
readonly authority: "instance";
|
|
151
|
+
};
|
|
152
|
+
};
|
|
102
153
|
readonly accessibilityLabel: {
|
|
103
154
|
readonly type: "string";
|
|
104
155
|
readonly category: "Accessibility";
|
|
@@ -1 +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
|
|
1
|
+
{"version":3,"file":"gameInputZoneMeta.d.ts","sourceRoot":"","sources":["../../../../src/features/game-presentation/meta/gameInputZoneMeta.ts"],"names":[],"mappings":"AAEA,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwIQ,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export const gameInputZoneMeta = {
|
|
3
3
|
name: 'GameInputZone',
|
|
4
4
|
category: 'component',
|
|
5
|
-
description: 'Normalizes pointer
|
|
5
|
+
description: 'Normalizes pointer/touch positions and optional keyboard bindings into generic game events.',
|
|
6
6
|
directManifestNode: true,
|
|
7
7
|
allowedChildren: [],
|
|
8
8
|
blueprint: {
|
|
@@ -81,6 +81,52 @@ export const gameInputZoneMeta = {
|
|
|
81
81
|
default: true,
|
|
82
82
|
authoring: { authority: 'instance' },
|
|
83
83
|
},
|
|
84
|
+
keyboardBindings: {
|
|
85
|
+
type: 'array',
|
|
86
|
+
category: 'Input',
|
|
87
|
+
label: 'Keyboard bindings',
|
|
88
|
+
default: [],
|
|
89
|
+
itemSchema: [
|
|
90
|
+
{
|
|
91
|
+
key: 'key',
|
|
92
|
+
schema: {
|
|
93
|
+
type: 'string',
|
|
94
|
+
category: 'Input',
|
|
95
|
+
label: 'Key',
|
|
96
|
+
authoring: { authority: 'instance' },
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
key: 'eventType',
|
|
101
|
+
schema: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
category: 'Input',
|
|
104
|
+
label: 'Event type',
|
|
105
|
+
authoring: { authority: 'instance' },
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: 'entityId',
|
|
110
|
+
schema: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
category: 'Input',
|
|
113
|
+
label: 'Entity id',
|
|
114
|
+
authoring: { authority: 'instance' },
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: 'preventDefault',
|
|
119
|
+
schema: {
|
|
120
|
+
type: 'boolean',
|
|
121
|
+
category: 'Input',
|
|
122
|
+
label: 'Prevent browser default',
|
|
123
|
+
default: false,
|
|
124
|
+
authoring: { authority: 'instance' },
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
authoring: { authority: 'instance' },
|
|
129
|
+
},
|
|
84
130
|
accessibilityLabel: {
|
|
85
131
|
type: 'string',
|
|
86
132
|
category: 'Accessibility',
|
|
@@ -1 +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,
|
|
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,6FAA6F;IAC/F,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,E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AAS,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/touch positions and optional keyboard bindings into generic game events.',\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 keyboardBindings: {\n type: 'array',\n category: 'Input',\n label: 'Keyboard bindings',\n default: [],\n itemSchema: [\n {\n key: 'key',\n schema: {\n type: 'string',\n category: 'Input',\n label: 'Key',\n authoring: { authority: 'instance' },\n },\n },\n {\n key: 'eventType',\n schema: {\n type: 'string',\n category: 'Input',\n label: 'Event type',\n authoring: { authority: 'instance' },\n },\n },\n {\n key: 'entityId',\n schema: {\n type: 'string',\n category: 'Input',\n label: 'Entity id',\n authoring: { authority: 'instance' },\n },\n },\n {\n key: 'preventDefault',\n schema: {\n type: 'boolean',\n category: 'Input',\n label: 'Prevent browser default',\n default: false,\n authoring: { authority: 'instance' },\n },\n },\n ],\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"}
|