handler-playable-sdk 0.3.2 → 0.3.4

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 (36) hide show
  1. package/dist/AssetEditorModal-DBAGQINC.js +1 -0
  2. package/dist/AssetTextures-AZY5VKWH.js +1 -0
  3. package/dist/ConfigOverride-DFTDUTRQ.js +1 -0
  4. package/dist/chunk-C2CEUBBT.js +1325 -0
  5. package/dist/chunk-DEUORFXE.js +1 -0
  6. package/dist/chunk-DHSGG7NF.js +1 -0
  7. package/dist/chunk-E6WJCS24.js +46 -0
  8. package/dist/chunk-PWGHKK3J.js +1 -0
  9. package/dist/chunk-Q7FPWOA3.js +1 -0
  10. package/dist/config-7DI6U2YD.js +1 -0
  11. package/dist/index.cjs +1360 -0
  12. package/dist/index.css +4537 -1
  13. package/dist/index.d.cts +892 -0
  14. package/dist/index.d.ts +494 -39
  15. package/dist/index.js +1 -1
  16. package/dist/{loader-object-centric-C1QteFfG.d.mts → loader-object-centric-Ce6MVkQw.d.cts} +1 -1
  17. package/dist/{loader-object-centric-C1QteFfG.d.ts → loader-object-centric-Ce6MVkQw.d.ts} +1 -1
  18. package/dist/pixi/index.cjs +256 -0
  19. package/dist/pixi/index.css +4537 -1
  20. package/dist/pixi/{index.d.mts → index.d.cts} +156 -144
  21. package/dist/pixi/index.d.ts +156 -144
  22. package/dist/pixi/index.js +1 -27
  23. package/dist/three/index.cjs +363 -0
  24. package/dist/three/index.css +4537 -1
  25. package/dist/three/index.js +1 -134
  26. package/package.json +29 -18
  27. package/dist/ConfigOverride-6YH2ILBJ.mjs +0 -1
  28. package/dist/chunk-BDZGKN5O.mjs +0 -1
  29. package/dist/chunk-GYW3GFXA.mjs +0 -830
  30. package/dist/chunk-HN7I4BLB.mjs +0 -1
  31. package/dist/config-QLS2MDB6.mjs +0 -1
  32. package/dist/index.d.mts +0 -437
  33. package/dist/index.mjs +0 -1
  34. package/dist/pixi/index.mjs +0 -1
  35. package/dist/three/index.mjs +0 -118
  36. /package/dist/three/{index.d.mts → index.d.cts} +0 -0
@@ -1,6 +1,6 @@
1
1
  import * as PixiJS from 'pixi.js';
2
- import { Application, Container, Texture, Sprite, Text, Graphics, Point } from 'pixi.js';
3
- import { O as ObjectCentricConfig$1 } from '../loader-object-centric-C1QteFfG.mjs';
2
+ import { Application, Container, Sprite, Texture, Text } from 'pixi.js';
3
+ import { O as ObjectCentricConfig$1 } from '../loader-object-centric-Ce6MVkQw.cjs';
4
4
 
5
5
  /**
6
6
  * Handler SDK - PixiJS Base Context
@@ -110,7 +110,7 @@ declare class Renderer {
110
110
  visible?: boolean;
111
111
  tint?: number | null;
112
112
  }): void;
113
- syncToPixi(pixiObject: Container | any): void;
113
+ syncToPixi(pixiObject: Container | any, instanceId?: string): void;
114
114
  }
115
115
  /**
116
116
  * Base GameObject class - Unity-style entity with components
@@ -129,11 +129,21 @@ declare class GameObject {
129
129
  transform: Transform;
130
130
  renderer: Renderer;
131
131
  private _config;
132
+ private _tickerCleanup;
133
+ onRebuildRequired: ((gameObject: GameObject, nextConfig: any) => void) | null;
132
134
  constructor(instanceId: string, objectConfig: string, pixiObject: Container | any, config: any);
133
135
  /**
134
136
  * Sync all components to PixiJS object
135
137
  */
136
138
  sync(): void;
139
+ /**
140
+ * Sync Text-specific properties (ui.text, fontSize, color, etc.)
141
+ */
142
+ private syncTextProperties;
143
+ /**
144
+ * Cleanup GameObject and its tickers
145
+ */
146
+ destroy(): void;
137
147
  /**
138
148
  * Update config and sync (for hot-reload)
139
149
  */
@@ -146,6 +156,22 @@ declare class GameObject {
146
156
  * Apply optional non-uniform scale from effects (if provided)
147
157
  */
148
158
  private applyEffectsScale;
159
+ /**
160
+ * Apply visual effects (shadow, glow, blur, stroke, distortion)
161
+ *
162
+ * NOTE: Full-quality effects (drop shadow with offset, crisp outline stroke, distortion)
163
+ * require the optional `pixi-filters` package. Current implementation uses built-in
164
+ * PixiJS filters with some visual limitations.
165
+ */
166
+ private applyEffects;
167
+ /**
168
+ * Apply intro animation
169
+ */
170
+ private applyIntro;
171
+ /**
172
+ * Apply motion and animations (pulse, swing)
173
+ */
174
+ private applyMotion;
149
175
  /**
150
176
  * Get component value
151
177
  */
@@ -190,6 +216,7 @@ declare class GameObject {
190
216
  declare class GameObjectManager {
191
217
  private objects;
192
218
  private config;
219
+ onObjectRebuildRequired: ((instanceId: string, nextConfig: any) => Promise<GameObject>) | null;
193
220
  constructor(config: any);
194
221
  /**
195
222
  * Create a GameObject from config
@@ -264,139 +291,6 @@ declare function getRegisteredFontIds(): string[];
264
291
  */
265
292
  type ObjectCentricConfig = ObjectCentricConfig$1;
266
293
 
267
- /**
268
- * Handler SDK - EndGame UI Panel
269
- *
270
- * Success screen with logo, text, CTA button, and tutorial hand.
271
- * Fully configurable via UI config system.
272
- *
273
- * DO NOT EDIT - Handler SDK Core
274
- */
275
-
276
- interface EndGamePanelElements {
277
- panel: Container;
278
- logo: Sprite;
279
- title: Text;
280
- subtitle: Text;
281
- footer: Text;
282
- ctaButton: Graphics;
283
- ctaText: Text;
284
- ctaHint: Text;
285
- hand: Sprite;
286
- }
287
- /**
288
- * Create EndGame success panel with all UI elements
289
- */
290
- declare function createEndGamePanel(config: ObjectCentricConfig, handTexture: Texture | null, logoTexture: Texture | null): EndGamePanelElements;
291
- /**
292
- * Animate panel entrance with staggered animations
293
- */
294
- declare function animatePanelEntrance(elements: EndGamePanelElements, config: ObjectCentricConfig, onComplete?: () => void): void;
295
- /**
296
- * Animate tutorial hand clicking CTA button
297
- */
298
- declare function animateHandClick(hand: Sprite, ctaButton: Graphics, config: ObjectCentricConfig, onClick: () => void): void;
299
-
300
- interface SplashScreenConfig {
301
- enabled: boolean;
302
- show_on_start: boolean;
303
- background_color: string;
304
- background_alpha: number;
305
- title: string;
306
- subtitle: string;
307
- button_label: string;
308
- title_color: string;
309
- subtitle_color: string;
310
- button_bg: string;
311
- button_text: string;
312
- button_width: number;
313
- button_height: number;
314
- button_radius: number;
315
- loading_blur: boolean;
316
- loading_blur_strength: number;
317
- loading_overlay_alpha: number;
318
- font_family: string;
319
- title_size: number;
320
- subtitle_size: number;
321
- loading_text: string;
322
- loading_text_scale: number;
323
- }
324
- declare class SplashScreen {
325
- private app;
326
- private stage;
327
- private activeConfig;
328
- private splashConfig;
329
- private splashEnabled;
330
- private loadingBlurEnabled;
331
- private loadingBlurStrength;
332
- private loadingOverlayAlpha;
333
- private splashLayer;
334
- private splashBg;
335
- private splashTitle;
336
- private splashSubtitle;
337
- private splashButton;
338
- private splashButtonText;
339
- private loadingLayer;
340
- private loadingBg;
341
- private loadingText;
342
- private loadingTime;
343
- private tickLoadingHandler;
344
- constructor(app: Application, stage: Container, activeConfig: ObjectCentricConfig);
345
- private resolveLoadingTextStyle;
346
- syncConfig(next?: any): void;
347
- updateLayout(width: number, height: number): void;
348
- private updateSplashLayout;
349
- private updateLoadingLayout;
350
- show(): void;
351
- hide(): void;
352
- startLoadingAnimation(): void;
353
- stopLoadingAnimation(): void;
354
- destroyLoadingLayer(): void;
355
- applyLoadingBlur(background: Sprite | Graphics): any[] | null;
356
- removeLoadingBlur(background: Sprite | Graphics, prevFilters: any[] | null): void;
357
- setupWindowGlobals(): void;
358
- getSplashButton(): Graphics;
359
- shouldShowOnStart(): boolean;
360
- destroy(): void;
361
- }
362
-
363
- /**
364
- * Handler SDK - Tutorial UI Components
365
- *
366
- * Tutorial hand and label components for game tutorials.
367
- * Config requirement: All UI properties from object-centric config.
368
- *
369
- * DO NOT EDIT - Handler SDK Core
370
- */
371
-
372
- /**
373
- * Create hand tutorial sprite
374
- * Hand properties from object-centric config (hand_tutorial_1)
375
- *
376
- * @param handTexture - Texture for the hand sprite
377
- * @param config - Object-centric configuration
378
- * @param baseCharacterPos - Base position of the character for animation reference
379
- */
380
- declare function createHandTutorial(handTexture: Texture, config: ObjectCentricConfig, baseCharacterPos: Point): Sprite;
381
- /**
382
- * Create tutorial label text
383
- * Uses ui.tutorial config object with UI component schema
384
- *
385
- * @param config - Object-centric configuration
386
- */
387
- declare function createTutorialLabel(config: ObjectCentricConfig): Text;
388
- /**
389
- * Update hand animation
390
- * Animation parameters from object-centric config (hand_tutorial_1)
391
- *
392
- * @param hand - The hand sprite
393
- * @param baseCharacterPos - Base character position
394
- * @param time - Current time for animation
395
- * @param isDragging - Whether the user is currently dragging
396
- * @param config - Object-centric configuration
397
- */
398
- declare function updateHandAnimation(hand: Sprite, baseCharacterPos: Point, time: number, isDragging: boolean, config: ObjectCentricConfig): void;
399
-
400
294
  /**
401
295
  * Handler SDK - Lottie Overlay Helper
402
296
  *
@@ -452,7 +346,7 @@ type BuildSettings = {
452
346
  };
453
347
  declare global {
454
348
  interface Window {
455
- INLINE_ASSETS?: Record<string, string>;
349
+ INLINE_ASSETS?: Record<string, any>;
456
350
  __BUILD_SETTINGS__?: BuildSettings;
457
351
  }
458
352
  }
@@ -460,10 +354,10 @@ type AssetDefinition = {
460
354
  type: string;
461
355
  path: string;
462
356
  };
463
- type TypeLoader = (path: string, inlineData: string | undefined, objectId: string, app: any) => Promise<any>;
357
+ type TypeLoader = (path: string, inlineData: any | undefined, objectId: string, app: any) => Promise<any>;
464
358
  declare function registerType(type: string, loader: TypeLoader): void;
465
359
  declare class AssetLoader {
466
- static load(objectId: string, assetDef: AssetDefinition, app: any): Promise<any>;
360
+ static load(objectId: string, assetDef: AssetDefinition, app: any, configId?: string): Promise<any>;
467
361
  private static loadImage;
468
362
  private static loadJSON;
469
363
  private static handleFailure;
@@ -677,6 +571,125 @@ declare class RuntimeObjectRegistry {
677
571
 
678
572
  declare const basePixi: typeof PixiJS;
679
573
 
574
+ /**
575
+ * Handler SDK - Asset Texture Registry
576
+ *
577
+ * Clean texture-only registry for object-centric asset loading.
578
+ *
579
+ * RULES:
580
+ * - Stores ONLY Texture instances, not display objects
581
+ * - Keys are instance IDs from scene (e.g., 'key_1', 'background_1')
582
+ * - Used by spawnScene and game code to create sprites
583
+ * - Library panel updates textures here, onConfigUpdate propagates
584
+ *
585
+ * DO NOT EDIT - Handler SDK Core
586
+ */
587
+
588
+ /**
589
+ * Asset Texture Registry Implementation
590
+ */
591
+ declare class AssetTextureRegistry {
592
+ private textures;
593
+ private readyPromise;
594
+ private config;
595
+ private app;
596
+ /**
597
+ * Initialize with config and app instance
598
+ * CRITICAL: Clears previous state for Preview Restart support
599
+ */
600
+ init(config: ObjectCentricConfig, app: any): void;
601
+ /**
602
+ * Preload all image textures from config
603
+ * RULE: Resolves when all textures are loaded and ready for sprite creation
604
+ */
605
+ ready(): Promise<void>;
606
+ /**
607
+ * Get texture by instance ID
608
+ */
609
+ get(instanceId: string): Texture | undefined;
610
+ /**
611
+ * Set texture for instance ID (used by library panel)
612
+ */
613
+ set(instanceId: string, texture: Texture): void;
614
+ /**
615
+ * Clear all textures (for scene reset)
616
+ */
617
+ clear(): void;
618
+ /**
619
+ * Get all loaded texture IDs
620
+ */
621
+ getAllIds(): string[];
622
+ }
623
+ /**
624
+ * AssetTextures - Texture Registry
625
+ *
626
+ * Access textures by instance ID:
627
+ * @example
628
+ * // After AssetTextures.ready():
629
+ * const texture = AssetTextures.character_1;
630
+ * const sprite = new Sprite(texture);
631
+ *
632
+ * // Or explicit get:
633
+ * const texture = AssetTextures.get('character_1');
634
+ */
635
+ declare const AssetTextures: AssetTextureRegistry & {
636
+ [key: string]: Texture;
637
+ };
638
+ /**
639
+ * Initialize AssetTextures with config and app
640
+ * Must be called before AssetTextures.ready()
641
+ */
642
+ declare function initAssetTextures(config: ObjectCentricConfig, app: any): void;
643
+
644
+ /**
645
+ * Handler SDK - Scene Spawning Utility
646
+ *
647
+ * Automatically spawns PixiJS objects from ObjectCentricConfig.
648
+ * Uses AssetTextures for texture data, creates sprites/text objects.
649
+ *
650
+ * DO NOT EDIT - Handler SDK Core
651
+ */
652
+
653
+ type SpawnOptions = {
654
+ stage: Container;
655
+ mainContainer: Container;
656
+ activeConfig: ObjectCentricConfig;
657
+ gameObjectManager: any;
658
+ /**
659
+ * Optional: spawn only specific instance IDs
660
+ */
661
+ allowList?: Set<string>;
662
+ /**
663
+ * Optional: skip some instance IDs (for special handling)
664
+ */
665
+ denyList?: Set<string>;
666
+ };
667
+ type SpawnResult = {
668
+ objects: Record<string, any>;
669
+ sprites: Record<string, Sprite>;
670
+ texts: Record<string, Text>;
671
+ };
672
+ /**
673
+ * Spawn scene objects from config
674
+ *
675
+ * Uses AssetTextures to create sprites from texture data.
676
+ * Applies all transform and render properties from config.
677
+ *
678
+ * @param opts - Spawn options
679
+ * @returns Map of spawned objects organized by type
680
+ *
681
+ * @example
682
+ * // After AssetTextures.ready():
683
+ * const { objects, sprites, texts } = spawnSceneFromConfig({
684
+ * stage,
685
+ * mainContainer,
686
+ * activeConfig,
687
+ * gameObjectManager,
688
+ * denyList: new Set(['background_1', 'label_1'])
689
+ * });
690
+ */
691
+ declare function spawnSceneFromConfig(opts: SpawnOptions): SpawnResult;
692
+
680
693
  /**
681
694
  * Assets Proxy - Student-Facing API
682
695
  *
@@ -740,7 +753,6 @@ declare const Assets: AssetsCore & {
740
753
  declare function initAssets(config: ObjectCentricConfig$1, app: any): void;
741
754
 
742
755
  declare class AssetSystem extends BaseSystem {
743
- private splashScreen;
744
756
  init(): Promise<void>;
745
757
  onStart(): Promise<void>;
746
758
  onConfigUpdate(): void;
@@ -814,9 +826,9 @@ declare function applyScreenAnchor(element: any, screenWidth: number, screenHeig
814
826
  }): void;
815
827
  /**
816
828
  * Layout Manager
817
- * Strategy: ADAPTIVE ANCHOR
818
- * - Tall Screens: Show full rope (Anchor Top).
819
- * - Short Screens: Prioritize Character (Anchor Character Position).
829
+ * Generic layout system for all games.
830
+ * Positions objects based on their config transform.anchor and transform.position_ratio.
831
+ * Game-specific positioning (like rope physics) should be handled in game systems.
820
832
  */
821
833
  interface LayoutScreen {
822
834
  width: number;
@@ -853,4 +865,4 @@ interface InitSequenceOptions<State = unknown> {
853
865
  */
854
866
  declare function runInitSequence<State = unknown>(options: InitSequenceOptions<State>): void;
855
867
 
856
- export { AssetCache, type AssetDefinition, AssetLoader, AssetSystem, Assets, BaseSystem, type EndGamePanelElements, GameEngine, GameObject, GameObjectManager, type ObjectCentricConfig, ObjectFactory, type PixiBaseContext, type PixiTheme, Renderer, RuntimeObjectRegistry, SplashScreen, type SplashScreenConfig, type SystemContext, Transform, animateHandClick, animatePanelEntrance, applyScreenAnchor, basePixi, clearResponsiveElements, createEndGamePanel, createHandTutorial, createPixiBase, createTutorialLabel, getRegisteredFontIds, globalResponsiveMultipliers, initAssets, layout, playLottieOverlay, registerFont, registerType, resolveAnchorVec2, resolveFont, resolveFontWeight, resolveScreenAnchorPoint, resolveScreenRatioPoint, runInitSequence, setLottieInstance, updateHandAnimation, updateScreenState };
868
+ export { AssetCache, type AssetDefinition, AssetLoader, AssetSystem, AssetTextures, Assets, BaseSystem, GameEngine, GameObject, GameObjectManager, type ObjectCentricConfig, ObjectFactory, type PixiBaseContext, type PixiTheme, Renderer, RuntimeObjectRegistry, type SpawnOptions, type SpawnResult, type SystemContext, Transform, applyScreenAnchor, basePixi, clearResponsiveElements, createPixiBase, getRegisteredFontIds, globalResponsiveMultipliers, initAssetTextures, initAssets, layout, playLottieOverlay, registerFont, registerType, resolveAnchorVec2, resolveFont, resolveFontWeight, resolveScreenAnchorPoint, resolveScreenRatioPoint, runInitSequence, setLottieInstance, spawnSceneFromConfig, updateScreenState };