@react-shimeji/core 0.2.3 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -43,6 +43,8 @@ interface Pose {
43
43
  interface AnimationDefinition {
44
44
  /** Optional Shimeji expression controlling whether this animation applies. */
45
45
  condition?: string;
46
+ /** Whether this animation is the turning variant of a Move action. */
47
+ turn?: boolean;
46
48
  /** Ordered pose frames. */
47
49
  poses: Pose[];
48
50
  }
@@ -82,6 +84,12 @@ interface ActionDefinition {
82
84
  x?: string | number;
83
85
  /** Vertical offset expression. */
84
86
  y?: string | number;
87
+ /** Dragging/carrying horizontal offset expression. */
88
+ offsetX?: string | number;
89
+ /** Dragging/carrying vertical offset expression. */
90
+ offsetY?: string | number;
91
+ /** Whether offsets are measured from the image origin or anchor. */
92
+ offsetType?: string;
85
93
  /** Initial horizontal velocity expression. */
86
94
  initialVx?: string | number;
87
95
  /** Initial vertical velocity expression. */
@@ -98,6 +106,12 @@ interface ActionDefinition {
98
106
  bornY?: string | number;
99
107
  /** Behavior assigned to a spawned child. */
100
108
  bornBehavior?: string;
109
+ /** Optional character identifier assigned to a spawned child. */
110
+ bornMascot?: string;
111
+ /** Number of children produced by breeding actions. */
112
+ bornCount?: string | number;
113
+ /** Tick interval used by repeating breeding actions. */
114
+ bornInterval?: string | number;
101
115
  /** Carried-element horizontal offset expression. */
102
116
  ieOffsetX?: string | number;
103
117
  /** Carried-element vertical offset expression. */
@@ -119,6 +133,10 @@ interface BehaviorDefinition {
119
133
  conditions: string[];
120
134
  /** Candidates considered after this behavior completes. */
121
135
  nextBehaviors: BehaviorDefinition[];
136
+ /** Whether normal global candidates are retained alongside next behaviors. */
137
+ nextAdditive?: boolean;
138
+ /** Action name when it differs from the behavior name. */
139
+ actionName?: string;
122
140
  /** Menu grouping value retained from legacy packs. */
123
141
  groupIndex: number;
124
142
  /** Whether user interfaces should hide the behavior. */
@@ -260,11 +278,11 @@ interface MascotEnvironment {
260
278
  dx: number;
261
279
  dy: number;
262
280
  };
263
- /** Current viewport dimensions. */
281
+ /** Current container dimensions and, at runtime, its local edge geometry. */
264
282
  screen: {
265
283
  width: number;
266
284
  height: number;
267
- };
285
+ } & Partial<EnvironmentRectangle>;
268
286
  /** Current work-area bounds and edge predicates. */
269
287
  workArea: EnvironmentRectangle;
270
288
  /** Alias for the work-area bottom edge. */
@@ -289,6 +307,10 @@ interface MascotEnvironment {
289
307
  footX?: number;
290
308
  /** Dragging animation foot y-coordinate. */
291
309
  footY?: number;
310
+ /** Current horizontal action velocity. */
311
+ velocityX?: number;
312
+ /** Current vertical action velocity. */
313
+ velocityY?: number;
292
314
  }
293
315
  /** Edge predicate exposed to legacy expressions. */
294
316
  interface EnvironmentEdge {
@@ -333,9 +355,12 @@ declare class ShimejiEngine {
333
355
  private destroyed;
334
356
  private initialized;
335
357
  private platformSource;
358
+ private additionalPlatformElements;
359
+ private readonly movedPlatforms;
360
+ private readonly platformRectangles;
336
361
  /** Creates and initializes an engine inside a host DOM element. */
337
362
  constructor(container: HTMLElement, options?: ShimejiEngineOptions);
338
- /** Starts the clock and global listeners. Calling this method more than once is harmless. */
363
+ /** Starts the clock and container-aware listeners. Calling this method more than once is harmless. */
339
364
  initialize(): void;
340
365
  /** Registers or replaces a parsed or legacy character specification. */
341
366
  registerCharacter(spec: CharacterSpec | unknown): string;
@@ -353,8 +378,8 @@ declare class ShimejiEngine {
353
378
  getState(): MascotState[];
354
379
  /** Subscribes to a typed engine event and returns an unsubscribe function. */
355
380
  on<K extends keyof ShimejiEngineEventMap>(event: K, listener: ShimejiEventListener<K>): () => void;
356
- /** Replaces the DOM elements (or selector) exposed to mascots as platforms. */
357
- setPlatforms(platforms: string | readonly HTMLElement[]): void;
381
+ /** Replaces the primary platform source and any additional registered elements. */
382
+ setPlatforms(platforms: string | readonly HTMLElement[], additionalPlatforms?: readonly HTMLElement[]): void;
358
383
  /** Stops animation and timers, removes listeners and DOM, and revokes all object URLs. */
359
384
  destroy(): void;
360
385
  /** Returns whether this engine has completed permanent teardown. */
@@ -362,6 +387,7 @@ declare class ShimejiEngine {
362
387
  private readonly onAnimationFrame;
363
388
  private renderAll;
364
389
  private readFrameGeometry;
390
+ private movePlatform;
365
391
  private emitState;
366
392
  private listen;
367
393
  private assertAlive;
@@ -377,11 +403,11 @@ declare function normalizeCharacterSpec(input: CharacterSpec | LegacyCharacterPa
377
403
  declare function loadCharacter(source: CharacterSource): Promise<CharacterSpec>;
378
404
 
379
405
  /** Safely evaluates a legacy Shimeji expression without using `eval` or `Function`. */
380
- declare function evaluateExpression(expression: string | number | boolean | undefined, environment: MascotEnvironment, fallback: number): number;
406
+ declare function evaluateExpression(expression: string | number | boolean | undefined, environment: MascotEnvironment, fallback: number, random?: () => number): number;
381
407
  /** Safely evaluates a legacy Shimeji expression without using `eval` or `Function`. */
382
- declare function evaluateExpression(expression: string | number | boolean | undefined, environment: MascotEnvironment, fallback: boolean): boolean;
408
+ declare function evaluateExpression(expression: string | number | boolean | undefined, environment: MascotEnvironment, fallback: boolean, random?: () => number): boolean;
383
409
  /** Returns true when every condition in a behavior or action is satisfied. */
384
- declare function conditionsMatch(conditions: readonly string[], environment: MascotEnvironment): boolean;
410
+ declare function conditionsMatch(conditions: readonly string[], environment: MascotEnvironment, random?: () => number): boolean;
385
411
  /** Chooses one item with probability proportional to its non-negative weight. */
386
412
  declare function selectWeighted<T>(items: readonly T[], weight: (item: T) => number, random?: () => number): T | undefined;
387
413
  /** Selects applicable behaviors and resolves legacy behavior references. */
@@ -389,30 +415,44 @@ declare class BehaviorController {
389
415
  private readonly spec;
390
416
  private readonly random;
391
417
  private previous;
418
+ private fallbackSelected;
392
419
  /** Creates a behavior selector for a normalized character specification. */
393
420
  constructor(spec: CharacterSpec, random?: () => number);
394
421
  /** Selects an initial behavior, honoring an explicit requested name when possible. */
395
422
  selectInitial(environment: MascotEnvironment, requestedName?: string): BehaviorDefinition | undefined;
396
423
  /** Selects the weighted transition following the current behavior. */
397
424
  selectNext(environment: MascotEnvironment): BehaviorDefinition | undefined;
425
+ /** Whether the most recent transition had no effective weighted candidate. */
426
+ usedFallback(): boolean;
398
427
  /** Replaces selection history so an external interaction can force a behavior. */
399
428
  force(name: string): BehaviorDefinition | undefined;
400
429
  private choose;
401
430
  private resolve;
402
431
  private findFallBehavior;
403
- private isOnAnyBoundary;
404
432
  }
405
433
 
434
+ /** A platform rectangle paired with the DOM element that produced it. */
435
+ interface PlatformRectangle extends Rectangle {
436
+ element: HTMLElement;
437
+ }
438
+ /** Resolves a platform option into connected DOM elements contained by the supplied root. */
439
+ declare function resolvePlatformElements(source: string | readonly HTMLElement[], root: Document | HTMLElement, excludedRoot?: HTMLElement): HTMLElement[];
440
+ /** Reads platform bounds once and converts viewport coordinates to the supplied origin. */
441
+ declare function readPlatformRectangles(elements: readonly HTMLElement[], workAreaRectangle: Pick<DOMRect, "left" | "top">): PlatformRectangle[];
442
+
406
443
  /** Callbacks through which embedded actions request engine-level operations. */
407
444
  interface ActionExecutorCallbacks {
408
- /** Spawns another mascot from the same character. */
445
+ /** Spawns another mascot, optionally from another registered character. */
409
446
  spawn(position: {
410
447
  x: number;
411
448
  y: number;
412
449
  behaviorName?: string;
413
- }): void;
450
+ lookRight?: boolean;
451
+ }, characterId?: string): void;
414
452
  /** Removes the mascot owning this executor. */
415
453
  remove(): void;
454
+ /** Moves a DOM platform for the legacy IE-carrying actions. */
455
+ movePlatform?(element: HTMLElement, point: Point): void;
416
456
  }
417
457
  /** Settings used while interpreting actions. */
418
458
  interface ActionExecutorOptions {
@@ -420,20 +460,30 @@ interface ActionExecutorOptions {
420
460
  frameDuration: number;
421
461
  /** Gravity used when a Fall action does not define one. */
422
462
  gravity: number;
463
+ /** Optional deterministic random-number source. */
464
+ random?: (() => number) | undefined;
423
465
  }
424
- /** Executes normalized action trees independently from DOM rendering. */
466
+ type ActionTickResult = "running" | "complete" | "lost-ground";
467
+ /** Executes normalized action trees using Shimeji-ee's discrete action lifecycle. */
425
468
  declare class ActionExecutor {
426
469
  private readonly spec;
427
470
  private readonly state;
428
471
  private readonly options;
429
472
  private readonly callbacks;
430
473
  private runtime;
431
- /** Creates an executor bound to one mascot's mutable internal state. */
474
+ private accumulator;
475
+ private readonly random;
432
476
  constructor(spec: CharacterSpec, state: MascotState, options: ActionExecutorOptions, callbacks: ActionExecutorCallbacks);
433
477
  /** Starts the action whose name matches a selected behavior. */
434
- start(actionName: string, environment: MascotEnvironment): boolean;
435
- /** Advances the current action and returns true when it has completed. */
436
- tick(deltaMs: number, environment: MascotEnvironment, bounds: Rectangle): boolean;
478
+ start(actionName: string, environment: MascotEnvironment, _preserveLookRight?: boolean, bounds?: Rectangle, platforms?: readonly PlatformRectangle[]): boolean;
479
+ /** Advances by elapsed milliseconds and reports completion. */
480
+ tick(deltaMs: number, environment: MascotEnvironment, bounds: Rectangle, platforms?: readonly PlatformRectangle[]): boolean;
481
+ /** Advances exactly one legacy frame. */
482
+ step(environment: MascotEnvironment, bounds: Rectangle, platforms?: readonly PlatformRectangle[]): ActionTickResult;
483
+ /** Returns whether the current action can execute another legacy frame. */
484
+ hasNext(environment: MascotEnvironment, bounds: Rectangle, platforms?: readonly PlatformRectangle[]): boolean;
485
+ /** Retained for source compatibility with the previous collision API. */
486
+ consumeViewportWallCollision(): boolean;
437
487
  /** Cancels the current action tree. */
438
488
  cancel(): void;
439
489
  private createRuntime;
@@ -451,20 +501,14 @@ declare function isOnLeft(point: Point, rectangle: Rectangle, tolerance?: number
451
501
  declare function isOnRight(point: Point, rectangle: Rectangle, tolerance?: number): boolean;
452
502
  /** Returns whether an anchor satisfies an action's boundary requirement. */
453
503
  declare function isOnBorder(state: MascotState, bounds: Rectangle, border: "Floor" | "Wall" | "Ceiling" | undefined, platform?: Rectangle): boolean;
454
- /** Advances ballistic motion and clamps the mascot to the work-area boundaries. */
504
+ /**
505
+ * Advances one legacy Fall tick. Velocity is damped and accelerated before
506
+ * movement, then the path is sampled one pixel at a time just like Shimeji-ee.
507
+ */
455
508
  declare function applyGravity(state: MascotState, bounds: Rectangle, frameScale: number, gravity: number, resistanceX?: number, resistanceY?: number, platform?: Rectangle): boolean;
456
509
  /** Moves a mascot toward a target without overshooting it. */
457
510
  declare function moveToward(state: MascotState, target: Point, speed: number, frameScale: number): boolean;
458
511
 
459
- /** A platform rectangle paired with the DOM element that produced it. */
460
- interface PlatformRectangle extends Rectangle {
461
- element: HTMLElement;
462
- }
463
- /** Resolves a platform option into DOM elements, excluding engine-owned nodes. */
464
- declare function resolvePlatformElements(source: string | readonly HTMLElement[], document: Document, excludedRoot?: HTMLElement): HTMLElement[];
465
- /** Reads platform bounds once and converts viewport coordinates to the supplied origin. */
466
- declare function readPlatformRectangles(elements: readonly HTMLElement[], workAreaRectangle: Pick<DOMRect, "left" | "top">): PlatformRectangle[];
467
-
468
512
  /** A resolved image and optional atlas crop for one sprite frame. */
469
513
  interface ResolvedSprite {
470
514
  /** Browser-loadable image URL. */
@@ -494,7 +538,7 @@ declare function isIndividualSprite(sprite: SpriteRectangle | IndividualSprite |
494
538
 
495
539
  /** DOM nodes and resources owned by one mascot. */
496
540
  interface MascotDomHandle {
497
- /** Fixed, pointer-transparent mascot wrapper. */
541
+ /** Absolutely positioned, pointer-transparent mascot wrapper. */
498
542
  element: HTMLDivElement;
499
543
  /** Pointer-interactive child element on which sprite images are painted. */
500
544
  spriteElement: HTMLDivElement;
@@ -515,6 +559,8 @@ interface MascotCallbacks {
515
559
  spawn(characterId: string, options: SpawnOptions): void;
516
560
  /** Requests removal of this mascot. */
517
561
  remove(id: string): void;
562
+ /** Moves a registered platform for legacy IE interaction actions. */
563
+ movePlatform?(element: HTMLElement, point: Point): void;
518
564
  /** Reports a click without a drag gesture. */
519
565
  click(state: MascotState): void;
520
566
  /** Reports a recoverable runtime failure. */
package/dist/index.d.ts CHANGED
@@ -43,6 +43,8 @@ interface Pose {
43
43
  interface AnimationDefinition {
44
44
  /** Optional Shimeji expression controlling whether this animation applies. */
45
45
  condition?: string;
46
+ /** Whether this animation is the turning variant of a Move action. */
47
+ turn?: boolean;
46
48
  /** Ordered pose frames. */
47
49
  poses: Pose[];
48
50
  }
@@ -82,6 +84,12 @@ interface ActionDefinition {
82
84
  x?: string | number;
83
85
  /** Vertical offset expression. */
84
86
  y?: string | number;
87
+ /** Dragging/carrying horizontal offset expression. */
88
+ offsetX?: string | number;
89
+ /** Dragging/carrying vertical offset expression. */
90
+ offsetY?: string | number;
91
+ /** Whether offsets are measured from the image origin or anchor. */
92
+ offsetType?: string;
85
93
  /** Initial horizontal velocity expression. */
86
94
  initialVx?: string | number;
87
95
  /** Initial vertical velocity expression. */
@@ -98,6 +106,12 @@ interface ActionDefinition {
98
106
  bornY?: string | number;
99
107
  /** Behavior assigned to a spawned child. */
100
108
  bornBehavior?: string;
109
+ /** Optional character identifier assigned to a spawned child. */
110
+ bornMascot?: string;
111
+ /** Number of children produced by breeding actions. */
112
+ bornCount?: string | number;
113
+ /** Tick interval used by repeating breeding actions. */
114
+ bornInterval?: string | number;
101
115
  /** Carried-element horizontal offset expression. */
102
116
  ieOffsetX?: string | number;
103
117
  /** Carried-element vertical offset expression. */
@@ -119,6 +133,10 @@ interface BehaviorDefinition {
119
133
  conditions: string[];
120
134
  /** Candidates considered after this behavior completes. */
121
135
  nextBehaviors: BehaviorDefinition[];
136
+ /** Whether normal global candidates are retained alongside next behaviors. */
137
+ nextAdditive?: boolean;
138
+ /** Action name when it differs from the behavior name. */
139
+ actionName?: string;
122
140
  /** Menu grouping value retained from legacy packs. */
123
141
  groupIndex: number;
124
142
  /** Whether user interfaces should hide the behavior. */
@@ -260,11 +278,11 @@ interface MascotEnvironment {
260
278
  dx: number;
261
279
  dy: number;
262
280
  };
263
- /** Current viewport dimensions. */
281
+ /** Current container dimensions and, at runtime, its local edge geometry. */
264
282
  screen: {
265
283
  width: number;
266
284
  height: number;
267
- };
285
+ } & Partial<EnvironmentRectangle>;
268
286
  /** Current work-area bounds and edge predicates. */
269
287
  workArea: EnvironmentRectangle;
270
288
  /** Alias for the work-area bottom edge. */
@@ -289,6 +307,10 @@ interface MascotEnvironment {
289
307
  footX?: number;
290
308
  /** Dragging animation foot y-coordinate. */
291
309
  footY?: number;
310
+ /** Current horizontal action velocity. */
311
+ velocityX?: number;
312
+ /** Current vertical action velocity. */
313
+ velocityY?: number;
292
314
  }
293
315
  /** Edge predicate exposed to legacy expressions. */
294
316
  interface EnvironmentEdge {
@@ -333,9 +355,12 @@ declare class ShimejiEngine {
333
355
  private destroyed;
334
356
  private initialized;
335
357
  private platformSource;
358
+ private additionalPlatformElements;
359
+ private readonly movedPlatforms;
360
+ private readonly platformRectangles;
336
361
  /** Creates and initializes an engine inside a host DOM element. */
337
362
  constructor(container: HTMLElement, options?: ShimejiEngineOptions);
338
- /** Starts the clock and global listeners. Calling this method more than once is harmless. */
363
+ /** Starts the clock and container-aware listeners. Calling this method more than once is harmless. */
339
364
  initialize(): void;
340
365
  /** Registers or replaces a parsed or legacy character specification. */
341
366
  registerCharacter(spec: CharacterSpec | unknown): string;
@@ -353,8 +378,8 @@ declare class ShimejiEngine {
353
378
  getState(): MascotState[];
354
379
  /** Subscribes to a typed engine event and returns an unsubscribe function. */
355
380
  on<K extends keyof ShimejiEngineEventMap>(event: K, listener: ShimejiEventListener<K>): () => void;
356
- /** Replaces the DOM elements (or selector) exposed to mascots as platforms. */
357
- setPlatforms(platforms: string | readonly HTMLElement[]): void;
381
+ /** Replaces the primary platform source and any additional registered elements. */
382
+ setPlatforms(platforms: string | readonly HTMLElement[], additionalPlatforms?: readonly HTMLElement[]): void;
358
383
  /** Stops animation and timers, removes listeners and DOM, and revokes all object URLs. */
359
384
  destroy(): void;
360
385
  /** Returns whether this engine has completed permanent teardown. */
@@ -362,6 +387,7 @@ declare class ShimejiEngine {
362
387
  private readonly onAnimationFrame;
363
388
  private renderAll;
364
389
  private readFrameGeometry;
390
+ private movePlatform;
365
391
  private emitState;
366
392
  private listen;
367
393
  private assertAlive;
@@ -377,11 +403,11 @@ declare function normalizeCharacterSpec(input: CharacterSpec | LegacyCharacterPa
377
403
  declare function loadCharacter(source: CharacterSource): Promise<CharacterSpec>;
378
404
 
379
405
  /** Safely evaluates a legacy Shimeji expression without using `eval` or `Function`. */
380
- declare function evaluateExpression(expression: string | number | boolean | undefined, environment: MascotEnvironment, fallback: number): number;
406
+ declare function evaluateExpression(expression: string | number | boolean | undefined, environment: MascotEnvironment, fallback: number, random?: () => number): number;
381
407
  /** Safely evaluates a legacy Shimeji expression without using `eval` or `Function`. */
382
- declare function evaluateExpression(expression: string | number | boolean | undefined, environment: MascotEnvironment, fallback: boolean): boolean;
408
+ declare function evaluateExpression(expression: string | number | boolean | undefined, environment: MascotEnvironment, fallback: boolean, random?: () => number): boolean;
383
409
  /** Returns true when every condition in a behavior or action is satisfied. */
384
- declare function conditionsMatch(conditions: readonly string[], environment: MascotEnvironment): boolean;
410
+ declare function conditionsMatch(conditions: readonly string[], environment: MascotEnvironment, random?: () => number): boolean;
385
411
  /** Chooses one item with probability proportional to its non-negative weight. */
386
412
  declare function selectWeighted<T>(items: readonly T[], weight: (item: T) => number, random?: () => number): T | undefined;
387
413
  /** Selects applicable behaviors and resolves legacy behavior references. */
@@ -389,30 +415,44 @@ declare class BehaviorController {
389
415
  private readonly spec;
390
416
  private readonly random;
391
417
  private previous;
418
+ private fallbackSelected;
392
419
  /** Creates a behavior selector for a normalized character specification. */
393
420
  constructor(spec: CharacterSpec, random?: () => number);
394
421
  /** Selects an initial behavior, honoring an explicit requested name when possible. */
395
422
  selectInitial(environment: MascotEnvironment, requestedName?: string): BehaviorDefinition | undefined;
396
423
  /** Selects the weighted transition following the current behavior. */
397
424
  selectNext(environment: MascotEnvironment): BehaviorDefinition | undefined;
425
+ /** Whether the most recent transition had no effective weighted candidate. */
426
+ usedFallback(): boolean;
398
427
  /** Replaces selection history so an external interaction can force a behavior. */
399
428
  force(name: string): BehaviorDefinition | undefined;
400
429
  private choose;
401
430
  private resolve;
402
431
  private findFallBehavior;
403
- private isOnAnyBoundary;
404
432
  }
405
433
 
434
+ /** A platform rectangle paired with the DOM element that produced it. */
435
+ interface PlatformRectangle extends Rectangle {
436
+ element: HTMLElement;
437
+ }
438
+ /** Resolves a platform option into connected DOM elements contained by the supplied root. */
439
+ declare function resolvePlatformElements(source: string | readonly HTMLElement[], root: Document | HTMLElement, excludedRoot?: HTMLElement): HTMLElement[];
440
+ /** Reads platform bounds once and converts viewport coordinates to the supplied origin. */
441
+ declare function readPlatformRectangles(elements: readonly HTMLElement[], workAreaRectangle: Pick<DOMRect, "left" | "top">): PlatformRectangle[];
442
+
406
443
  /** Callbacks through which embedded actions request engine-level operations. */
407
444
  interface ActionExecutorCallbacks {
408
- /** Spawns another mascot from the same character. */
445
+ /** Spawns another mascot, optionally from another registered character. */
409
446
  spawn(position: {
410
447
  x: number;
411
448
  y: number;
412
449
  behaviorName?: string;
413
- }): void;
450
+ lookRight?: boolean;
451
+ }, characterId?: string): void;
414
452
  /** Removes the mascot owning this executor. */
415
453
  remove(): void;
454
+ /** Moves a DOM platform for the legacy IE-carrying actions. */
455
+ movePlatform?(element: HTMLElement, point: Point): void;
416
456
  }
417
457
  /** Settings used while interpreting actions. */
418
458
  interface ActionExecutorOptions {
@@ -420,20 +460,30 @@ interface ActionExecutorOptions {
420
460
  frameDuration: number;
421
461
  /** Gravity used when a Fall action does not define one. */
422
462
  gravity: number;
463
+ /** Optional deterministic random-number source. */
464
+ random?: (() => number) | undefined;
423
465
  }
424
- /** Executes normalized action trees independently from DOM rendering. */
466
+ type ActionTickResult = "running" | "complete" | "lost-ground";
467
+ /** Executes normalized action trees using Shimeji-ee's discrete action lifecycle. */
425
468
  declare class ActionExecutor {
426
469
  private readonly spec;
427
470
  private readonly state;
428
471
  private readonly options;
429
472
  private readonly callbacks;
430
473
  private runtime;
431
- /** Creates an executor bound to one mascot's mutable internal state. */
474
+ private accumulator;
475
+ private readonly random;
432
476
  constructor(spec: CharacterSpec, state: MascotState, options: ActionExecutorOptions, callbacks: ActionExecutorCallbacks);
433
477
  /** Starts the action whose name matches a selected behavior. */
434
- start(actionName: string, environment: MascotEnvironment): boolean;
435
- /** Advances the current action and returns true when it has completed. */
436
- tick(deltaMs: number, environment: MascotEnvironment, bounds: Rectangle): boolean;
478
+ start(actionName: string, environment: MascotEnvironment, _preserveLookRight?: boolean, bounds?: Rectangle, platforms?: readonly PlatformRectangle[]): boolean;
479
+ /** Advances by elapsed milliseconds and reports completion. */
480
+ tick(deltaMs: number, environment: MascotEnvironment, bounds: Rectangle, platforms?: readonly PlatformRectangle[]): boolean;
481
+ /** Advances exactly one legacy frame. */
482
+ step(environment: MascotEnvironment, bounds: Rectangle, platforms?: readonly PlatformRectangle[]): ActionTickResult;
483
+ /** Returns whether the current action can execute another legacy frame. */
484
+ hasNext(environment: MascotEnvironment, bounds: Rectangle, platforms?: readonly PlatformRectangle[]): boolean;
485
+ /** Retained for source compatibility with the previous collision API. */
486
+ consumeViewportWallCollision(): boolean;
437
487
  /** Cancels the current action tree. */
438
488
  cancel(): void;
439
489
  private createRuntime;
@@ -451,20 +501,14 @@ declare function isOnLeft(point: Point, rectangle: Rectangle, tolerance?: number
451
501
  declare function isOnRight(point: Point, rectangle: Rectangle, tolerance?: number): boolean;
452
502
  /** Returns whether an anchor satisfies an action's boundary requirement. */
453
503
  declare function isOnBorder(state: MascotState, bounds: Rectangle, border: "Floor" | "Wall" | "Ceiling" | undefined, platform?: Rectangle): boolean;
454
- /** Advances ballistic motion and clamps the mascot to the work-area boundaries. */
504
+ /**
505
+ * Advances one legacy Fall tick. Velocity is damped and accelerated before
506
+ * movement, then the path is sampled one pixel at a time just like Shimeji-ee.
507
+ */
455
508
  declare function applyGravity(state: MascotState, bounds: Rectangle, frameScale: number, gravity: number, resistanceX?: number, resistanceY?: number, platform?: Rectangle): boolean;
456
509
  /** Moves a mascot toward a target without overshooting it. */
457
510
  declare function moveToward(state: MascotState, target: Point, speed: number, frameScale: number): boolean;
458
511
 
459
- /** A platform rectangle paired with the DOM element that produced it. */
460
- interface PlatformRectangle extends Rectangle {
461
- element: HTMLElement;
462
- }
463
- /** Resolves a platform option into DOM elements, excluding engine-owned nodes. */
464
- declare function resolvePlatformElements(source: string | readonly HTMLElement[], document: Document, excludedRoot?: HTMLElement): HTMLElement[];
465
- /** Reads platform bounds once and converts viewport coordinates to the supplied origin. */
466
- declare function readPlatformRectangles(elements: readonly HTMLElement[], workAreaRectangle: Pick<DOMRect, "left" | "top">): PlatformRectangle[];
467
-
468
512
  /** A resolved image and optional atlas crop for one sprite frame. */
469
513
  interface ResolvedSprite {
470
514
  /** Browser-loadable image URL. */
@@ -494,7 +538,7 @@ declare function isIndividualSprite(sprite: SpriteRectangle | IndividualSprite |
494
538
 
495
539
  /** DOM nodes and resources owned by one mascot. */
496
540
  interface MascotDomHandle {
497
- /** Fixed, pointer-transparent mascot wrapper. */
541
+ /** Absolutely positioned, pointer-transparent mascot wrapper. */
498
542
  element: HTMLDivElement;
499
543
  /** Pointer-interactive child element on which sprite images are painted. */
500
544
  spriteElement: HTMLDivElement;
@@ -515,6 +559,8 @@ interface MascotCallbacks {
515
559
  spawn(characterId: string, options: SpawnOptions): void;
516
560
  /** Requests removal of this mascot. */
517
561
  remove(id: string): void;
562
+ /** Moves a registered platform for legacy IE interaction actions. */
563
+ movePlatform?(element: HTMLElement, point: Point): void;
518
564
  /** Reports a click without a drag gesture. */
519
565
  click(state: MascotState): void;
520
566
  /** Reports a recoverable runtime failure. */