@ankhorage/zora-game 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -2
  3. package/dist/ZORA_GAME_COMPONENT_META.d.ts +212 -0
  4. package/dist/ZORA_GAME_COMPONENT_META.d.ts.map +1 -1
  5. package/dist/ZORA_GAME_PLUGIN.d.ts +212 -0
  6. package/dist/ZORA_GAME_PLUGIN.d.ts.map +1 -1
  7. package/dist/ZORA_PLUGIN_METADATA.d.ts +212 -0
  8. package/dist/ZORA_PLUGIN_METADATA.d.ts.map +1 -1
  9. package/dist/features/game-presentation/adapters/inbound/GameEntity.d.ts +1 -1
  10. package/dist/features/game-presentation/adapters/inbound/GameEntity.d.ts.map +1 -1
  11. package/dist/features/game-presentation/adapters/inbound/GameEntity.js +15 -28
  12. package/dist/features/game-presentation/adapters/inbound/GameEntity.js.map +1 -1
  13. package/dist/features/game-presentation/meta/gameEntityMeta.d.ts +212 -0
  14. package/dist/features/game-presentation/meta/gameEntityMeta.d.ts.map +1 -1
  15. package/dist/features/game-presentation/meta/gameEntityMeta.js +114 -0
  16. package/dist/features/game-presentation/meta/gameEntityMeta.js.map +1 -1
  17. package/dist/features/game-presentation/public.d.ts +1 -1
  18. package/dist/features/game-presentation/public.d.ts.map +1 -1
  19. package/dist/features/game-presentation/public.js.map +1 -1
  20. package/dist/features/game-presentation/utils/resolveGameEntityMotionPlan.d.ts +15 -0
  21. package/dist/features/game-presentation/utils/resolveGameEntityMotionPlan.d.ts.map +1 -0
  22. package/dist/features/game-presentation/utils/resolveGameEntityMotionPlan.js +31 -0
  23. package/dist/features/game-presentation/utils/resolveGameEntityMotionPlan.js.map +1 -0
  24. package/dist/features/game-presentation/utils/useAnimatedGameEntityValue.d.ts +5 -0
  25. package/dist/features/game-presentation/utils/useAnimatedGameEntityValue.d.ts.map +1 -0
  26. package/dist/features/game-presentation/utils/useAnimatedGameEntityValue.js +33 -0
  27. package/dist/features/game-presentation/utils/useAnimatedGameEntityValue.js.map +1 -0
  28. package/dist/features/game-presentation/utils/useGameEntityAnimatedStyle.d.ts +16 -0
  29. package/dist/features/game-presentation/utils/useGameEntityAnimatedStyle.d.ts.map +1 -0
  30. package/dist/features/game-presentation/utils/useGameEntityAnimatedStyle.js +52 -0
  31. package/dist/features/game-presentation/utils/useGameEntityAnimatedStyle.js.map +1 -0
  32. package/dist/features/game-presentation/utils/useGameEntityMeasurement.d.ts +5 -0
  33. package/dist/features/game-presentation/utils/useGameEntityMeasurement.d.ts.map +1 -0
  34. package/dist/features/game-presentation/utils/useGameEntityMeasurement.js +14 -0
  35. package/dist/features/game-presentation/utils/useGameEntityMeasurement.js.map +1 -0
  36. package/dist/features/game-presentation/utils/useGameEntityMotionProgress.d.ts +5 -0
  37. package/dist/features/game-presentation/utils/useGameEntityMotionProgress.d.ts.map +1 -0
  38. package/dist/features/game-presentation/utils/useGameEntityMotionProgress.js +87 -0
  39. package/dist/features/game-presentation/utils/useGameEntityMotionProgress.js.map +1 -0
  40. package/dist/features/game-presentation/utils/useGameReducedMotion.d.ts +3 -0
  41. package/dist/features/game-presentation/utils/useGameReducedMotion.d.ts.map +1 -0
  42. package/dist/features/game-presentation/utils/useGameReducedMotion.js +13 -0
  43. package/dist/features/game-presentation/utils/useGameReducedMotion.js.map +1 -0
  44. package/dist/index.d.ts +1 -1
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/types/gamePresentation.d.ts +18 -1
  48. package/dist/types/gamePresentation.d.ts.map +1 -1
  49. package/dist/types/gamePresentation.js.map +1 -1
  50. package/package.json +1 -1
  51. package/src/ZORA_PLUGIN_METADATA.test.ts +17 -0
  52. package/src/features/game-presentation/adapters/inbound/GameEntity.tsx +19 -69
  53. package/src/features/game-presentation/meta/gameEntityMeta.ts +115 -0
  54. package/src/features/game-presentation/public.ts +2 -0
  55. package/src/features/game-presentation/utils/resolveGameEntityMotionPlan.test.ts +63 -0
  56. package/src/features/game-presentation/utils/resolveGameEntityMotionPlan.ts +53 -0
  57. package/src/features/game-presentation/utils/useAnimatedGameEntityValue.ts +41 -0
  58. package/src/features/game-presentation/utils/useGameEntityAnimatedStyle.ts +87 -0
  59. package/src/features/game-presentation/utils/useGameEntityMeasurement.ts +19 -0
  60. package/src/features/game-presentation/utils/useGameEntityMotionProgress.ts +114 -0
  61. package/src/features/game-presentation/utils/useGameReducedMotion.ts +15 -0
  62. package/src/index.ts +2 -0
  63. package/src/types/gamePresentation.ts +19 -1
@@ -200,6 +200,90 @@ export declare const ZORA_PLUGIN_METADATA: {
200
200
  };
201
201
  readonly acceptsFallback: true;
202
202
  };
203
+ readonly transitionDurationMs: {
204
+ readonly value: {
205
+ readonly type: "number";
206
+ };
207
+ readonly acceptsFallback: true;
208
+ };
209
+ readonly transitionEasing: {
210
+ readonly value: {
211
+ readonly type: "string";
212
+ };
213
+ readonly acceptsFallback: true;
214
+ };
215
+ readonly motionOffsetX: {
216
+ readonly value: {
217
+ readonly type: "number";
218
+ };
219
+ readonly acceptsFallback: true;
220
+ };
221
+ readonly motionOffsetY: {
222
+ readonly value: {
223
+ readonly type: "number";
224
+ };
225
+ readonly acceptsFallback: true;
226
+ };
227
+ readonly motionOpacityDelta: {
228
+ readonly value: {
229
+ readonly type: "number";
230
+ };
231
+ readonly acceptsFallback: true;
232
+ };
233
+ readonly motionScaleDelta: {
234
+ readonly value: {
235
+ readonly type: "number";
236
+ };
237
+ readonly acceptsFallback: true;
238
+ };
239
+ readonly motionRotationDelta: {
240
+ readonly value: {
241
+ readonly type: "number";
242
+ };
243
+ readonly acceptsFallback: true;
244
+ };
245
+ readonly motionDurationMs: {
246
+ readonly value: {
247
+ readonly type: "number";
248
+ };
249
+ readonly acceptsFallback: true;
250
+ };
251
+ readonly motionDelayMs: {
252
+ readonly value: {
253
+ readonly type: "number";
254
+ };
255
+ readonly acceptsFallback: true;
256
+ };
257
+ readonly motionEasing: {
258
+ readonly value: {
259
+ readonly type: "string";
260
+ };
261
+ readonly acceptsFallback: true;
262
+ };
263
+ readonly motionRepeat: {
264
+ readonly value: {
265
+ readonly type: "boolean";
266
+ };
267
+ readonly acceptsFallback: true;
268
+ };
269
+ readonly motionAlternate: {
270
+ readonly value: {
271
+ readonly type: "boolean";
272
+ };
273
+ readonly acceptsFallback: true;
274
+ };
275
+ readonly motionPaused: {
276
+ readonly value: {
277
+ readonly type: "boolean";
278
+ };
279
+ readonly acceptsFallback: true;
280
+ };
281
+ readonly motionEssential: {
282
+ readonly value: {
283
+ readonly type: "boolean";
284
+ };
285
+ readonly acceptsFallback: true;
286
+ };
203
287
  };
204
288
  };
205
289
  readonly props: {
@@ -300,6 +384,134 @@ export declare const ZORA_PLUGIN_METADATA: {
300
384
  readonly authority: "instance";
301
385
  };
302
386
  };
387
+ readonly transitionDurationMs: {
388
+ readonly type: "number";
389
+ readonly category: "Motion";
390
+ readonly label: "Transition duration (ms)";
391
+ readonly default: 0;
392
+ readonly authoring: {
393
+ readonly authority: "instance";
394
+ };
395
+ };
396
+ readonly transitionEasing: {
397
+ readonly type: "enum";
398
+ readonly category: "Motion";
399
+ readonly label: "Transition easing";
400
+ readonly enum: readonly ["linear", "ease-in", "ease-out", "ease-in-out"];
401
+ readonly default: "linear";
402
+ readonly authoring: {
403
+ readonly authority: "instance";
404
+ };
405
+ };
406
+ readonly motionOffsetX: {
407
+ readonly type: "number";
408
+ readonly category: "Motion";
409
+ readonly label: "Motion X offset (%)";
410
+ readonly default: 0;
411
+ readonly authoring: {
412
+ readonly authority: "instance";
413
+ };
414
+ };
415
+ readonly motionOffsetY: {
416
+ readonly type: "number";
417
+ readonly category: "Motion";
418
+ readonly label: "Motion Y offset (%)";
419
+ readonly default: 0;
420
+ readonly authoring: {
421
+ readonly authority: "instance";
422
+ };
423
+ };
424
+ readonly motionOpacityDelta: {
425
+ readonly type: "number";
426
+ readonly category: "Motion";
427
+ readonly label: "Motion opacity delta";
428
+ readonly default: 0;
429
+ readonly authoring: {
430
+ readonly authority: "instance";
431
+ };
432
+ };
433
+ readonly motionScaleDelta: {
434
+ readonly type: "number";
435
+ readonly category: "Motion";
436
+ readonly label: "Motion scale delta";
437
+ readonly default: 0;
438
+ readonly authoring: {
439
+ readonly authority: "instance";
440
+ };
441
+ };
442
+ readonly motionRotationDelta: {
443
+ readonly type: "number";
444
+ readonly category: "Motion";
445
+ readonly label: "Motion rotation delta";
446
+ readonly default: 0;
447
+ readonly authoring: {
448
+ readonly authority: "instance";
449
+ };
450
+ };
451
+ readonly motionDurationMs: {
452
+ readonly type: "number";
453
+ readonly category: "Motion";
454
+ readonly label: "Motion duration (ms)";
455
+ readonly default: 0;
456
+ readonly authoring: {
457
+ readonly authority: "instance";
458
+ };
459
+ };
460
+ readonly motionDelayMs: {
461
+ readonly type: "number";
462
+ readonly category: "Motion";
463
+ readonly label: "Motion delay (ms)";
464
+ readonly default: 0;
465
+ readonly authoring: {
466
+ readonly authority: "instance";
467
+ };
468
+ };
469
+ readonly motionEasing: {
470
+ readonly type: "enum";
471
+ readonly category: "Motion";
472
+ readonly label: "Motion easing";
473
+ readonly enum: readonly ["linear", "ease-in", "ease-out", "ease-in-out"];
474
+ readonly default: "linear";
475
+ readonly authoring: {
476
+ readonly authority: "instance";
477
+ };
478
+ };
479
+ readonly motionRepeat: {
480
+ readonly type: "boolean";
481
+ readonly category: "Motion";
482
+ readonly label: "Repeat motion";
483
+ readonly default: false;
484
+ readonly authoring: {
485
+ readonly authority: "instance";
486
+ };
487
+ };
488
+ readonly motionAlternate: {
489
+ readonly type: "boolean";
490
+ readonly category: "Motion";
491
+ readonly label: "Alternate motion";
492
+ readonly default: false;
493
+ readonly authoring: {
494
+ readonly authority: "instance";
495
+ };
496
+ };
497
+ readonly motionPaused: {
498
+ readonly type: "boolean";
499
+ readonly category: "Motion";
500
+ readonly label: "Pause motion";
501
+ readonly default: false;
502
+ readonly authoring: {
503
+ readonly authority: "instance";
504
+ };
505
+ };
506
+ readonly motionEssential: {
507
+ readonly type: "boolean";
508
+ readonly category: "Motion";
509
+ readonly label: "Essential motion";
510
+ readonly default: false;
511
+ readonly authoring: {
512
+ readonly authority: "instance";
513
+ };
514
+ };
303
515
  readonly accessibilityLabel: {
304
516
  readonly type: "string";
305
517
  readonly category: "Accessibility";
@@ -1 +1 @@
1
- {"version":3,"file":"ZORA_PLUGIN_METADATA.d.ts","sourceRoot":"","sources":["../src/ZORA_PLUGIN_METADATA.ts"],"names":[],"mappings":"AAIA,sFAAsF;AACtF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BM,CAAC"}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;;;;;;;;;;;;CA+BM,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import type { GameEntityProps } from '../../../../types/gamePresentation';
3
3
  /*** Render one generic positioned game entity without owning gameplay semantics. */
4
- export declare function GameEntity({ children, x, y, width, height, opacity, scale, rotation, zIndex, hidden, pointerEvents, measurementId, accessibilityLabel, testID, }: GameEntityProps): React.JSX.Element;
4
+ export declare function GameEntity(props: GameEntityProps): React.JSX.Element;
5
5
  //# sourceMappingURL=GameEntity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GameEntity.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAK1E,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,CAAK,EACL,CAAK,EACL,KAAK,EACL,MAAM,EACN,OAAW,EACX,KAAS,EACT,QAAY,EACZ,MAAU,EACV,MAAc,EACd,aAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,MAAM,GACP,EAAE,eAAe,qBAwBjB"}
1
+ {"version":3,"file":"GameEntity.d.ts","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAI1E,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,qBAgBhD"}
@@ -1,37 +1,24 @@
1
1
  import React from 'react';
2
- import { StyleSheet, View } from 'react-native';
3
- import { GameRuntimeContext } from '../../composition/GameRuntimeContext';
4
- import { toGamePercentage } from '../../utils/toGamePercentage';
5
- import { measureGameEntity } from './measureGameEntity';
2
+ import { Animated, StyleSheet } from 'react-native';
3
+ import { useGameEntityAnimatedStyle } from '../../utils/useGameEntityAnimatedStyle';
4
+ import { useGameEntityMeasurement } from '../../utils/useGameEntityMeasurement';
6
5
  /*** Render one generic positioned game entity without owning gameplay semantics. */
7
- export function GameEntity({ children, x = 0, y = 0, width, height, opacity = 1, scale = 1, rotation = 0, zIndex = 0, hidden = false, pointerEvents = 'auto', measurementId, accessibilityLabel, testID, }) {
6
+ export function GameEntity(props) {
8
7
  const elementRef = React.useRef(null);
9
- const runtime = React.useContext(GameRuntimeContext);
10
- const registerMeasurement = runtime?.registerMeasurement;
11
- React.useEffect(() => {
12
- if (measurementId === undefined || registerMeasurement === undefined)
13
- return undefined;
14
- return registerMeasurement(measurementId, () => measureGameEntity(elementRef.current));
15
- }, [measurementId, registerMeasurement]);
16
- return (<View ref={elementRef} {...(accessibilityLabel === undefined ? {} : { accessibilityLabel })} {...(testID === undefined ? {} : { testID })} pointerEvents={pointerEvents} style={[
17
- styles.root,
18
- createEntityStyle({ x, y, width, height, opacity, scale, rotation, zIndex, hidden }),
19
- ]}>
20
- {children}
21
- </View>);
8
+ const animatedStyle = useGameEntityAnimatedStyle(props);
9
+ useGameEntityMeasurement(elementRef, props.measurementId);
10
+ return (<Animated.View ref={elementRef} accessibilityLabel={props.accessibilityLabel} testID={props.testID} pointerEvents={props.pointerEvents ?? 'auto'} style={[styles.root, createEntityStaticStyle(props), animatedStyle]}>
11
+ {props.children}
12
+ </Animated.View>);
22
13
  }
23
- /*** Convert serializable entity presentation props into a React Native view style. */
24
- function createEntityStyle({ x, y, width, height, opacity, scale, rotation, zIndex, hidden, }) {
14
+ /*** Convert non-animated GameEntity presentation props into a React Native view style. */
15
+ function createEntityStaticStyle(props) {
25
16
  return {
26
- display: hidden ? 'none' : 'flex',
27
- left: toGamePercentage(x),
28
- opacity: Math.min(1, Math.max(0, opacity)),
17
+ display: props.hidden === true ? 'none' : 'flex',
29
18
  position: 'absolute',
30
- top: toGamePercentage(y),
31
- transform: [{ scale }, { rotate: `${rotation}deg` }],
32
- zIndex,
33
- ...(height === undefined ? {} : { height }),
34
- ...(width === undefined ? {} : { width }),
19
+ zIndex: props.zIndex ?? 0,
20
+ ...(props.height === undefined ? {} : { height: props.height }),
21
+ ...(props.width === undefined ? {} : { width: props.width }),
35
22
  };
36
23
  }
37
24
  const styles = StyleSheet.create({
@@ -1 +1 @@
1
- {"version":3,"file":"GameEntity.js","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAGhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,oFAAoF;AACpF,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,CAAC,GAAG,CAAC,EACL,CAAC,GAAG,CAAC,EACL,KAAK,EACL,MAAM,EACN,OAAO,GAAG,CAAC,EACX,KAAK,GAAG,CAAC,EACT,QAAQ,GAAG,CAAC,EACZ,MAAM,GAAG,CAAC,EACV,MAAM,GAAG,KAAK,EACd,aAAa,GAAG,MAAM,EACtB,aAAa,EACb,kBAAkB,EAClB,MAAM,GACU;IAChB,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAc,IAAI,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACrD,MAAM,mBAAmB,GAAG,OAAO,EAAE,mBAAmB,CAAC;IAEzD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,aAAa,KAAK,SAAS,IAAI,mBAAmB,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QACvF,OAAO,mBAAmB,CAAC,aAAa,EAAE,GAAG,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,MAAM,EAAE,GAAG,QAAQ,KAAK,EAAE,CAAC;QACpD,MAAM;QACN,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3C,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { StyleSheet, View, type ViewStyle } from 'react-native';\n\nimport type { GameEntityProps } from '../../../../types/gamePresentation';\nimport { GameRuntimeContext } from '../../composition/GameRuntimeContext';\nimport { toGamePercentage } from '../../utils/toGamePercentage';\nimport { measureGameEntity } from './measureGameEntity';\n\n/*** Render one generic positioned game entity without owning gameplay semantics. */\nexport function GameEntity({\n children,\n x = 0,\n y = 0,\n width,\n height,\n opacity = 1,\n scale = 1,\n rotation = 0,\n zIndex = 0,\n hidden = false,\n pointerEvents = 'auto',\n measurementId,\n accessibilityLabel,\n testID,\n}: GameEntityProps) {\n const elementRef = React.useRef<View | null>(null);\n const runtime = React.useContext(GameRuntimeContext);\n const registerMeasurement = runtime?.registerMeasurement;\n\n React.useEffect(() => {\n if (measurementId === undefined || registerMeasurement === undefined) return undefined;\n return registerMeasurement(measurementId, () => measureGameEntity(elementRef.current));\n }, [measurementId, registerMeasurement]);\n\n return (\n <View\n ref={elementRef}\n {...(accessibilityLabel === undefined ? {} : { accessibilityLabel })}\n {...(testID === undefined ? {} : { testID })}\n pointerEvents={pointerEvents}\n style={[\n styles.root,\n createEntityStyle({ x, y, width, height, opacity, scale, rotation, zIndex, hidden }),\n ]}\n >\n {children}\n </View>\n );\n}\n\ninterface GameEntityStyleInput {\n readonly x: number;\n readonly y: number;\n readonly width: number | undefined;\n readonly height: number | undefined;\n readonly opacity: number;\n readonly scale: number;\n readonly rotation: number;\n readonly zIndex: number;\n readonly hidden: boolean;\n}\n\n/*** Convert serializable entity presentation props into a React Native view style. */\nfunction createEntityStyle({\n x,\n y,\n width,\n height,\n opacity,\n scale,\n rotation,\n zIndex,\n hidden,\n}: GameEntityStyleInput): ViewStyle {\n return {\n display: hidden ? 'none' : 'flex',\n left: toGamePercentage(x),\n opacity: Math.min(1, Math.max(0, opacity)),\n position: 'absolute',\n top: toGamePercentage(y),\n transform: [{ scale }, { rotate: `${rotation}deg` }],\n zIndex,\n ...(height === undefined ? {} : { height }),\n ...(width === undefined ? {} : { width }),\n };\n}\n\nconst styles = StyleSheet.create({\n root: {\n position: 'absolute',\n },\n});\n"]}
1
+ {"version":3,"file":"GameEntity.js","sourceRoot":"","sources":["../../../../../src/features/game-presentation/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAA6B,MAAM,cAAc,CAAC;AAG/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,oFAAoF;AACpF,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAc,IAAI,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAC;IACxD,wBAAwB,CAAC,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAE1D,OAAO,CACL,CAAC,QAAQ,CAAC,IAAI,CACZ,GAAG,CAAC,CAAC,UAAU,CAAC,CAChB,kBAAkB,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAC7C,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CACrB,aAAa,CAAC,CAAC,KAAK,CAAC,aAAa,IAAI,MAAM,CAAC,CAC7C,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,CAAC,CAEpE;MAAA,CAAC,KAAK,CAAC,QAAQ,CACjB;IAAA,EAAE,QAAQ,CAAC,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC;AAED,0FAA0F;AAC1F,SAAS,uBAAuB,CAAC,KAAsB;IACrD,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;QAChD,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC;QACzB,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;QAC/D,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;KAC7D,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Animated, StyleSheet, type View, type ViewStyle } from 'react-native';\n\nimport type { GameEntityProps } from '../../../../types/gamePresentation';\nimport { useGameEntityAnimatedStyle } from '../../utils/useGameEntityAnimatedStyle';\nimport { useGameEntityMeasurement } from '../../utils/useGameEntityMeasurement';\n\n/*** Render one generic positioned game entity without owning gameplay semantics. */\nexport function GameEntity(props: GameEntityProps) {\n const elementRef = React.useRef<View | null>(null);\n const animatedStyle = useGameEntityAnimatedStyle(props);\n useGameEntityMeasurement(elementRef, props.measurementId);\n\n return (\n <Animated.View\n ref={elementRef}\n accessibilityLabel={props.accessibilityLabel}\n testID={props.testID}\n pointerEvents={props.pointerEvents ?? 'auto'}\n style={[styles.root, createEntityStaticStyle(props), animatedStyle]}\n >\n {props.children}\n </Animated.View>\n );\n}\n\n/*** Convert non-animated GameEntity presentation props into a React Native view style. */\nfunction createEntityStaticStyle(props: GameEntityProps): ViewStyle {\n return {\n display: props.hidden === true ? 'none' : 'flex',\n position: 'absolute',\n zIndex: props.zIndex ?? 0,\n ...(props.height === undefined ? {} : { height: props.height }),\n ...(props.width === undefined ? {} : { width: props.width }),\n };\n}\n\nconst styles = StyleSheet.create({\n root: {\n position: 'absolute',\n },\n});\n"]}
@@ -78,6 +78,90 @@ export declare const gameEntityMeta: {
78
78
  };
79
79
  readonly acceptsFallback: true;
80
80
  };
81
+ readonly transitionDurationMs: {
82
+ readonly value: {
83
+ readonly type: "number";
84
+ };
85
+ readonly acceptsFallback: true;
86
+ };
87
+ readonly transitionEasing: {
88
+ readonly value: {
89
+ readonly type: "string";
90
+ };
91
+ readonly acceptsFallback: true;
92
+ };
93
+ readonly motionOffsetX: {
94
+ readonly value: {
95
+ readonly type: "number";
96
+ };
97
+ readonly acceptsFallback: true;
98
+ };
99
+ readonly motionOffsetY: {
100
+ readonly value: {
101
+ readonly type: "number";
102
+ };
103
+ readonly acceptsFallback: true;
104
+ };
105
+ readonly motionOpacityDelta: {
106
+ readonly value: {
107
+ readonly type: "number";
108
+ };
109
+ readonly acceptsFallback: true;
110
+ };
111
+ readonly motionScaleDelta: {
112
+ readonly value: {
113
+ readonly type: "number";
114
+ };
115
+ readonly acceptsFallback: true;
116
+ };
117
+ readonly motionRotationDelta: {
118
+ readonly value: {
119
+ readonly type: "number";
120
+ };
121
+ readonly acceptsFallback: true;
122
+ };
123
+ readonly motionDurationMs: {
124
+ readonly value: {
125
+ readonly type: "number";
126
+ };
127
+ readonly acceptsFallback: true;
128
+ };
129
+ readonly motionDelayMs: {
130
+ readonly value: {
131
+ readonly type: "number";
132
+ };
133
+ readonly acceptsFallback: true;
134
+ };
135
+ readonly motionEasing: {
136
+ readonly value: {
137
+ readonly type: "string";
138
+ };
139
+ readonly acceptsFallback: true;
140
+ };
141
+ readonly motionRepeat: {
142
+ readonly value: {
143
+ readonly type: "boolean";
144
+ };
145
+ readonly acceptsFallback: true;
146
+ };
147
+ readonly motionAlternate: {
148
+ readonly value: {
149
+ readonly type: "boolean";
150
+ };
151
+ readonly acceptsFallback: true;
152
+ };
153
+ readonly motionPaused: {
154
+ readonly value: {
155
+ readonly type: "boolean";
156
+ };
157
+ readonly acceptsFallback: true;
158
+ };
159
+ readonly motionEssential: {
160
+ readonly value: {
161
+ readonly type: "boolean";
162
+ };
163
+ readonly acceptsFallback: true;
164
+ };
81
165
  };
82
166
  };
83
167
  readonly props: {
@@ -178,6 +262,134 @@ export declare const gameEntityMeta: {
178
262
  readonly authority: "instance";
179
263
  };
180
264
  };
265
+ readonly transitionDurationMs: {
266
+ readonly type: "number";
267
+ readonly category: "Motion";
268
+ readonly label: "Transition duration (ms)";
269
+ readonly default: 0;
270
+ readonly authoring: {
271
+ readonly authority: "instance";
272
+ };
273
+ };
274
+ readonly transitionEasing: {
275
+ readonly type: "enum";
276
+ readonly category: "Motion";
277
+ readonly label: "Transition easing";
278
+ readonly enum: readonly ["linear", "ease-in", "ease-out", "ease-in-out"];
279
+ readonly default: "linear";
280
+ readonly authoring: {
281
+ readonly authority: "instance";
282
+ };
283
+ };
284
+ readonly motionOffsetX: {
285
+ readonly type: "number";
286
+ readonly category: "Motion";
287
+ readonly label: "Motion X offset (%)";
288
+ readonly default: 0;
289
+ readonly authoring: {
290
+ readonly authority: "instance";
291
+ };
292
+ };
293
+ readonly motionOffsetY: {
294
+ readonly type: "number";
295
+ readonly category: "Motion";
296
+ readonly label: "Motion Y offset (%)";
297
+ readonly default: 0;
298
+ readonly authoring: {
299
+ readonly authority: "instance";
300
+ };
301
+ };
302
+ readonly motionOpacityDelta: {
303
+ readonly type: "number";
304
+ readonly category: "Motion";
305
+ readonly label: "Motion opacity delta";
306
+ readonly default: 0;
307
+ readonly authoring: {
308
+ readonly authority: "instance";
309
+ };
310
+ };
311
+ readonly motionScaleDelta: {
312
+ readonly type: "number";
313
+ readonly category: "Motion";
314
+ readonly label: "Motion scale delta";
315
+ readonly default: 0;
316
+ readonly authoring: {
317
+ readonly authority: "instance";
318
+ };
319
+ };
320
+ readonly motionRotationDelta: {
321
+ readonly type: "number";
322
+ readonly category: "Motion";
323
+ readonly label: "Motion rotation delta";
324
+ readonly default: 0;
325
+ readonly authoring: {
326
+ readonly authority: "instance";
327
+ };
328
+ };
329
+ readonly motionDurationMs: {
330
+ readonly type: "number";
331
+ readonly category: "Motion";
332
+ readonly label: "Motion duration (ms)";
333
+ readonly default: 0;
334
+ readonly authoring: {
335
+ readonly authority: "instance";
336
+ };
337
+ };
338
+ readonly motionDelayMs: {
339
+ readonly type: "number";
340
+ readonly category: "Motion";
341
+ readonly label: "Motion delay (ms)";
342
+ readonly default: 0;
343
+ readonly authoring: {
344
+ readonly authority: "instance";
345
+ };
346
+ };
347
+ readonly motionEasing: {
348
+ readonly type: "enum";
349
+ readonly category: "Motion";
350
+ readonly label: "Motion easing";
351
+ readonly enum: readonly ["linear", "ease-in", "ease-out", "ease-in-out"];
352
+ readonly default: "linear";
353
+ readonly authoring: {
354
+ readonly authority: "instance";
355
+ };
356
+ };
357
+ readonly motionRepeat: {
358
+ readonly type: "boolean";
359
+ readonly category: "Motion";
360
+ readonly label: "Repeat motion";
361
+ readonly default: false;
362
+ readonly authoring: {
363
+ readonly authority: "instance";
364
+ };
365
+ };
366
+ readonly motionAlternate: {
367
+ readonly type: "boolean";
368
+ readonly category: "Motion";
369
+ readonly label: "Alternate motion";
370
+ readonly default: false;
371
+ readonly authoring: {
372
+ readonly authority: "instance";
373
+ };
374
+ };
375
+ readonly motionPaused: {
376
+ readonly type: "boolean";
377
+ readonly category: "Motion";
378
+ readonly label: "Pause motion";
379
+ readonly default: false;
380
+ readonly authoring: {
381
+ readonly authority: "instance";
382
+ };
383
+ };
384
+ readonly motionEssential: {
385
+ readonly type: "boolean";
386
+ readonly category: "Motion";
387
+ readonly label: "Essential motion";
388
+ readonly default: false;
389
+ readonly authoring: {
390
+ readonly authority: "instance";
391
+ };
392
+ };
181
393
  readonly accessibilityLabel: {
182
394
  readonly type: "string";
183
395
  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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GW,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8NW,CAAC"}