handler-playable-sdk 0.2.7 → 0.3.2
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/ConfigOverride-6YH2ILBJ.mjs +1 -0
- package/dist/chunk-BDZGKN5O.mjs +1 -0
- package/dist/chunk-GYW3GFXA.mjs +830 -0
- package/dist/chunk-HN7I4BLB.mjs +1 -0
- package/dist/config-QLS2MDB6.mjs +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.mts +388 -2
- package/dist/index.d.ts +388 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/loader-object-centric-C1QteFfG.d.mts +81 -0
- package/dist/loader-object-centric-C1QteFfG.d.ts +81 -0
- package/dist/pixi/index.css +1 -0
- package/dist/pixi/index.d.mts +407 -93
- package/dist/pixi/index.d.ts +407 -93
- package/dist/pixi/index.js +9 -9
- package/dist/pixi/index.mjs +1 -11
- package/dist/three/index.css +1 -0
- package/dist/three/index.js +55 -55
- package/dist/three/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-UVBNGLP3.mjs +0 -17
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,389 @@
|
|
|
1
|
+
import { O as ObjectCentricConfig } from './loader-object-centric-C1QteFfG.js';
|
|
2
|
+
export { g as applyDefaults, c as loadAllObjectConfigs, a as loadComponentSchemas, d as loadEngineConfig, e as loadGamePromptConfig, l as loadObjectCentricConfig, b as loadObjectConfig, f as loadSceneConfig, t as toLegacyFormat, v as validateObjectConfig } from './loader-object-centric-C1QteFfG.js';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
cachedContainerSize?: {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
declare function setBootstrapDependencies(deps: {
|
|
13
|
+
initGame: any;
|
|
14
|
+
CustomAssets: any;
|
|
15
|
+
updateScreenState: any;
|
|
16
|
+
globalResponsiveMultipliers: any;
|
|
17
|
+
layout: any;
|
|
18
|
+
clearResponsiveElements: any;
|
|
19
|
+
}): void;
|
|
20
|
+
/**
|
|
21
|
+
* Bootstrap the Handler game
|
|
22
|
+
*/
|
|
23
|
+
declare const bootstrap: () => Promise<void>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Device Presets for Preview System
|
|
27
|
+
*
|
|
28
|
+
* Real device resolutions organized by category.
|
|
29
|
+
* The preview system will scale-to-fit these within the browser window.
|
|
30
|
+
*/
|
|
31
|
+
interface DevicePreset {
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
category: DeviceCategory;
|
|
37
|
+
ratio: string;
|
|
38
|
+
mraidScale?: number;
|
|
39
|
+
}
|
|
40
|
+
type DeviceCategory = 'iphone' | 'android' | 'tablet' | 'playable' | 'social';
|
|
41
|
+
interface DeviceGroup {
|
|
42
|
+
category: DeviceCategory;
|
|
43
|
+
label: string;
|
|
44
|
+
devices: DevicePreset[];
|
|
45
|
+
}
|
|
46
|
+
declare const devicePresets: DevicePreset[];
|
|
47
|
+
declare const deviceGroups: DeviceGroup[];
|
|
48
|
+
declare const defaultPreset: DevicePreset;
|
|
49
|
+
declare function getPresetById(id: string): DevicePreset;
|
|
50
|
+
declare function getPresetsByCategory(category: DeviceCategory): DevicePreset[];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Preview Shell
|
|
54
|
+
* Google Ads & Meta Style Preview System.
|
|
55
|
+
* Uses CSS transform scaling for device frame preview,
|
|
56
|
+
* and emits resize events so PIXI can reflow reliably.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
interface PreviewOptions {
|
|
60
|
+
defaultDevice?: string;
|
|
61
|
+
onDeviceChange?: (preset: DevicePreset) => void;
|
|
62
|
+
onRefresh?: () => void;
|
|
63
|
+
onRestart?: () => void;
|
|
64
|
+
}
|
|
65
|
+
declare class PreviewShell {
|
|
66
|
+
private container;
|
|
67
|
+
private previewContainer;
|
|
68
|
+
private singleStage;
|
|
69
|
+
private compareStage;
|
|
70
|
+
private frameDragger;
|
|
71
|
+
private frameWrapper;
|
|
72
|
+
private deviceFrame;
|
|
73
|
+
private gameContainer;
|
|
74
|
+
private currentPreset;
|
|
75
|
+
private isLandscape;
|
|
76
|
+
private autoScale;
|
|
77
|
+
private userScaleMultiplier;
|
|
78
|
+
private options;
|
|
79
|
+
private viewMode;
|
|
80
|
+
private lastSinglePresetId;
|
|
81
|
+
private comparePresets;
|
|
82
|
+
private activeCompareId;
|
|
83
|
+
private compareViewports;
|
|
84
|
+
private resizeObserver;
|
|
85
|
+
private rafFitHandle;
|
|
86
|
+
private ignoreNextWindowResize;
|
|
87
|
+
private frameDragOffsetX;
|
|
88
|
+
private frameDragOffsetY;
|
|
89
|
+
private frameDragActive;
|
|
90
|
+
private frameDragStartX;
|
|
91
|
+
private frameDragStartY;
|
|
92
|
+
private frameDragOriginX;
|
|
93
|
+
private frameDragOriginY;
|
|
94
|
+
private consolePanel;
|
|
95
|
+
private consoleMessages;
|
|
96
|
+
private isConsoleOpen;
|
|
97
|
+
private debugPanel;
|
|
98
|
+
private hasInitialFit;
|
|
99
|
+
private isMounted;
|
|
100
|
+
private isInitialized;
|
|
101
|
+
private gameReady;
|
|
102
|
+
private resizeListenersDisabled;
|
|
103
|
+
private compareSnapshotTimer;
|
|
104
|
+
constructor(options?: PreviewOptions);
|
|
105
|
+
mount(target?: HTMLElement): void;
|
|
106
|
+
destroy(): void;
|
|
107
|
+
getGameContainer(): HTMLElement;
|
|
108
|
+
getScreen(): {
|
|
109
|
+
width: number;
|
|
110
|
+
height: number;
|
|
111
|
+
};
|
|
112
|
+
getEffectivePreset(): DevicePreset;
|
|
113
|
+
notifyGameLoaded(): void;
|
|
114
|
+
notifyGameDestroyed(): void;
|
|
115
|
+
private disableResizeListeners;
|
|
116
|
+
private enableResizeListeners;
|
|
117
|
+
refresh(): void;
|
|
118
|
+
setDevice(deviceId: string, opts?: {
|
|
119
|
+
suppressCallback?: boolean;
|
|
120
|
+
}): void;
|
|
121
|
+
private createShell;
|
|
122
|
+
private setupEventListeners;
|
|
123
|
+
private applyDeviceFrameStyles;
|
|
124
|
+
private setupObserversAndListeners;
|
|
125
|
+
private onWindowResize;
|
|
126
|
+
private scheduleFit;
|
|
127
|
+
private applyPresetDimensions;
|
|
128
|
+
private fitToScreen;
|
|
129
|
+
private applyTransform;
|
|
130
|
+
private applyFrameDrag;
|
|
131
|
+
private setupFrameDragging;
|
|
132
|
+
private onFrameDragMove;
|
|
133
|
+
private onFrameDragEnd;
|
|
134
|
+
private adjustUserZoom;
|
|
135
|
+
private toggleRotation;
|
|
136
|
+
private emitScreenChange;
|
|
137
|
+
private safeStringify;
|
|
138
|
+
private setupConsoleInterceptor;
|
|
139
|
+
private appendConsoleMessage;
|
|
140
|
+
private escapeHtml;
|
|
141
|
+
private toggleConsole;
|
|
142
|
+
private clearConsole;
|
|
143
|
+
private setupCompareViewports;
|
|
144
|
+
private setViewMode;
|
|
145
|
+
private updateViewToggleUI;
|
|
146
|
+
private activateCompareViewport;
|
|
147
|
+
private applyCompareDimensions;
|
|
148
|
+
private fitCompareGhosts;
|
|
149
|
+
private captureCompareSnapshot;
|
|
150
|
+
private refreshCompareSnapshots;
|
|
151
|
+
private startCompareSnapshots;
|
|
152
|
+
private stopCompareSnapshots;
|
|
153
|
+
private getFitBounds;
|
|
154
|
+
private mustQuery;
|
|
155
|
+
}
|
|
156
|
+
declare function createPreviewShell(options?: PreviewOptions): PreviewShell;
|
|
157
|
+
|
|
158
|
+
declare class DebugPanel {
|
|
159
|
+
private debugOverlay;
|
|
160
|
+
private isDebugOpen;
|
|
161
|
+
private selectedObjectId;
|
|
162
|
+
private configViewer;
|
|
163
|
+
private container;
|
|
164
|
+
private objectAutoApplyTimer;
|
|
165
|
+
private objectDebugRaf;
|
|
166
|
+
private objectBoundsGfx;
|
|
167
|
+
private objectAnchorGfx;
|
|
168
|
+
private highlightObject;
|
|
169
|
+
private highlightAnchor;
|
|
170
|
+
private sceneObjectsPanel;
|
|
171
|
+
private sceneEditPanel;
|
|
172
|
+
private sceneToolsPanel;
|
|
173
|
+
private customizeSettingsPanel;
|
|
174
|
+
private libraryPanel;
|
|
175
|
+
private batchAiPanel;
|
|
176
|
+
private brandDnaPanel;
|
|
177
|
+
private activeTab;
|
|
178
|
+
initialize(container: HTMLElement): void;
|
|
179
|
+
selectObject(objectId: string): void;
|
|
180
|
+
getDebugOverlayHTML(): string;
|
|
181
|
+
setupDebugEventListeners(): void;
|
|
182
|
+
private updateWorkbenchTabs;
|
|
183
|
+
toggleDebug(force?: boolean): void;
|
|
184
|
+
private applyAssetChange;
|
|
185
|
+
private resetAsset;
|
|
186
|
+
updateDebugBadge(): void;
|
|
187
|
+
private setupDebugInputListeners;
|
|
188
|
+
private setupPanelLayout;
|
|
189
|
+
private saveWorkbenchState;
|
|
190
|
+
private loadWorkbenchState;
|
|
191
|
+
private setupCollapsiblePanels;
|
|
192
|
+
private handleObjectSelect;
|
|
193
|
+
private nudgeSelectedObject;
|
|
194
|
+
private startObjectVisuals;
|
|
195
|
+
private stopObjectVisuals;
|
|
196
|
+
private shouldRunObjectVisuals;
|
|
197
|
+
private updateObjectVisuals;
|
|
198
|
+
private getSelectedInstanceId;
|
|
199
|
+
private getDisplayObjectById;
|
|
200
|
+
private getSelectedObjectConfig;
|
|
201
|
+
private getConfigAnchorWorldPoint;
|
|
202
|
+
private getScreenSize;
|
|
203
|
+
private ensureBoundsGfx;
|
|
204
|
+
private ensureAnchorGfx;
|
|
205
|
+
private drawBounds;
|
|
206
|
+
private drawAnchor;
|
|
207
|
+
private clearBounds;
|
|
208
|
+
private clearAnchor;
|
|
209
|
+
private clearObjectVisuals;
|
|
210
|
+
private updateObjectInfo;
|
|
211
|
+
private scheduleObjectAutoApply;
|
|
212
|
+
private setupRangeInput;
|
|
213
|
+
private getNestedValue;
|
|
214
|
+
private setNestedValue;
|
|
215
|
+
private resetDebugConfig;
|
|
216
|
+
private applyDebugConfig;
|
|
217
|
+
private exportDebugConfig;
|
|
218
|
+
private loadObjectConfig;
|
|
219
|
+
private fillConfigViewer;
|
|
220
|
+
private copyConfigValues;
|
|
221
|
+
private applyObjectConfig;
|
|
222
|
+
private applyCustomizeSettings;
|
|
223
|
+
private shouldUseOffsetPosition;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Preview Live-Edit Bridge (SDK)
|
|
228
|
+
*
|
|
229
|
+
* Provides the window hooks used by preview panels + hot-reload systems.
|
|
230
|
+
* This is intentionally small and defensive: it does not assume any specific
|
|
231
|
+
* GameObject implementation beyond "getDisplayObject" or common PIXI fields.
|
|
232
|
+
*/
|
|
233
|
+
type LiveEditBridge = {
|
|
234
|
+
/** Apply a full object config (usually after reloading from disk) */
|
|
235
|
+
applyObjectConfig: (objectId: string, nextConfig: any) => Promise<void>;
|
|
236
|
+
/** Rebuild lookup tables used by panels */
|
|
237
|
+
rebuildIndexes: () => void;
|
|
238
|
+
};
|
|
239
|
+
type SetupLiveEditBridgeOptions = {
|
|
240
|
+
getConfig: () => any;
|
|
241
|
+
gameObjectManager: any;
|
|
242
|
+
assets?: any;
|
|
243
|
+
onObjectConfigApplied?: (objectId: string, nextConfig: any, instanceIds: string[]) => void;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Setup the live-edit bridge.
|
|
247
|
+
*
|
|
248
|
+
* Call this after you have a loaded config and an initialized gameObjectManager.
|
|
249
|
+
*/
|
|
250
|
+
declare function setupLiveEditBridge(options: SetupLiveEditBridgeOptions): LiveEditBridge;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Hot-Reload System for Object-Centric Config
|
|
254
|
+
*
|
|
255
|
+
* Enables live config editing during development.
|
|
256
|
+
* Edit your config JSON files and see changes instantly!
|
|
257
|
+
*/
|
|
258
|
+
interface HotReloadWatcher {
|
|
259
|
+
watch(configPath: string, callback: (event: ConfigChangeEvent) => void): void;
|
|
260
|
+
unwatch(configPath: string): void;
|
|
261
|
+
stop(): void;
|
|
262
|
+
}
|
|
263
|
+
interface ConfigChangeEvent {
|
|
264
|
+
type: 'object' | 'component' | 'engine' | 'scene';
|
|
265
|
+
path: string;
|
|
266
|
+
objectId?: string;
|
|
267
|
+
componentName?: string;
|
|
268
|
+
}
|
|
269
|
+
interface ReloadStrategy {
|
|
270
|
+
shouldFullReload(event: ConfigChangeEvent): boolean;
|
|
271
|
+
getAffectedObjects(event: ConfigChangeEvent): string[];
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Determines reload strategy based on config change type
|
|
275
|
+
*/
|
|
276
|
+
declare class DefaultReloadStrategy implements ReloadStrategy {
|
|
277
|
+
shouldFullReload(event: ConfigChangeEvent): boolean;
|
|
278
|
+
getAffectedObjects(event: ConfigChangeEvent): string[];
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* File watcher for config hot-reload
|
|
282
|
+
*/
|
|
283
|
+
declare class ConfigWatcher implements HotReloadWatcher {
|
|
284
|
+
private pollingInterval;
|
|
285
|
+
private fileHashes;
|
|
286
|
+
private callbacks;
|
|
287
|
+
private intervalMs;
|
|
288
|
+
constructor(intervalMs?: number);
|
|
289
|
+
watch(configPath: string, callback: (event: ConfigChangeEvent) => void): void;
|
|
290
|
+
private checkAllFiles;
|
|
291
|
+
private determineEventType;
|
|
292
|
+
private hashString;
|
|
293
|
+
unwatch(configPath: string): void;
|
|
294
|
+
stop(): void;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Diff utility for comparing configs
|
|
298
|
+
*/
|
|
299
|
+
declare function diffConfigs(oldConfig: any, newConfig: any): string[];
|
|
300
|
+
/**
|
|
301
|
+
* Rehydrate object with new config
|
|
302
|
+
*/
|
|
303
|
+
declare function rehydrateObject(objectId: string, oldConfig: any, newConfig: any, schemas: Map<string, any>): any;
|
|
304
|
+
|
|
305
|
+
interface HotReloadDependencies {
|
|
306
|
+
activeConfig: ObjectCentricConfig;
|
|
307
|
+
setActiveConfig: (config: ObjectCentricConfig) => void;
|
|
308
|
+
gameObjectManager: any;
|
|
309
|
+
CustomAssets: any;
|
|
310
|
+
audioSystem: any;
|
|
311
|
+
setAudioSystem: (audioSystem: any) => void;
|
|
312
|
+
liveEditBridge: any;
|
|
313
|
+
createAudioSystem: (config: ObjectCentricConfig) => any;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Setup hot reload for config files.
|
|
317
|
+
*
|
|
318
|
+
* SDK-owned plumbing so demo projects only provide dependencies.
|
|
319
|
+
*/
|
|
320
|
+
declare function setupHotReload(deps: HotReloadDependencies): void;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Config Override System
|
|
324
|
+
*
|
|
325
|
+
* Allows preview panel to override config values at runtime.
|
|
326
|
+
* Changes are applied immediately and can be:
|
|
327
|
+
* - persisted across restarts (in-memory, via window)
|
|
328
|
+
* - exported (diff/patch/json) via ConfigExport
|
|
329
|
+
*
|
|
330
|
+
* NOTE:
|
|
331
|
+
* In a pure-browser environment we cannot write back to disk.
|
|
332
|
+
* "Apply (real changes)" should be implemented via an optional dev-server endpoint
|
|
333
|
+
* (e.g. Vite plugin) that receives exported patches and writes config files.
|
|
334
|
+
*/
|
|
335
|
+
interface ConfigOverride {
|
|
336
|
+
objectId?: string;
|
|
337
|
+
path: string;
|
|
338
|
+
value: any;
|
|
339
|
+
}
|
|
340
|
+
interface ConfigChange {
|
|
341
|
+
objectId?: string;
|
|
342
|
+
path: string;
|
|
343
|
+
oldValue: any;
|
|
344
|
+
newValue: any;
|
|
345
|
+
ts: number;
|
|
346
|
+
}
|
|
347
|
+
interface ConfigOverrideOptions {
|
|
348
|
+
silent?: boolean;
|
|
349
|
+
persist?: boolean;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Apply a config override
|
|
353
|
+
*/
|
|
354
|
+
declare function applyConfigOverride(override: ConfigOverride, options?: ConfigOverrideOptions): void;
|
|
355
|
+
/**
|
|
356
|
+
* Apply multiple config overrides
|
|
357
|
+
*/
|
|
358
|
+
declare function applyConfigOverrides(overrides: ConfigOverride[], options?: ConfigOverrideOptions): void;
|
|
359
|
+
/**
|
|
360
|
+
* Clear all config overrides
|
|
361
|
+
*/
|
|
362
|
+
declare function clearConfigOverrides(): void;
|
|
363
|
+
/**
|
|
364
|
+
* Get all active overrides
|
|
365
|
+
*/
|
|
366
|
+
declare function getConfigOverrides(): ConfigOverride[];
|
|
367
|
+
/**
|
|
368
|
+
* SDK-facing manager used by ConfigExport.
|
|
369
|
+
* Kept minimal to avoid forcing consumers into a specific persistence strategy.
|
|
370
|
+
*/
|
|
371
|
+
declare const configOverrideManager: {
|
|
372
|
+
getCurrentConfig(): any | null;
|
|
373
|
+
getChanges(): ConfigChange[];
|
|
374
|
+
clearChanges(): void;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Base Layer - Lottie Instance
|
|
379
|
+
*
|
|
380
|
+
* Provides isolated lottie-web instance for base layer.
|
|
381
|
+
* Prevents conflicts with student layer's lottie instance.
|
|
382
|
+
*
|
|
383
|
+
* DO NOT EDIT - Base Layer
|
|
384
|
+
*/
|
|
385
|
+
declare const baseLottie: any;
|
|
386
|
+
|
|
1
387
|
declare global {
|
|
2
388
|
const mraid: any;
|
|
3
389
|
const dapi: any;
|
|
@@ -26,7 +412,7 @@ type InitOptions = {
|
|
|
26
412
|
declare const Handler: {
|
|
27
413
|
init(options?: InitOptions, callback?: (w: number, h: number) => void): void;
|
|
28
414
|
getRoot(): HTMLElement;
|
|
29
|
-
readonly version:
|
|
415
|
+
readonly version: string;
|
|
30
416
|
readonly maxWidth: number;
|
|
31
417
|
readonly maxHeight: number;
|
|
32
418
|
readonly isLandscape: boolean;
|
|
@@ -48,4 +434,4 @@ declare const Handler: {
|
|
|
48
434
|
resize(width?: number, height?: number): void;
|
|
49
435
|
};
|
|
50
436
|
|
|
51
|
-
export { Handler, Handler as default };
|
|
437
|
+
export { type ConfigChange, type ConfigChangeEvent, type ConfigOverride, type ConfigOverrideOptions, ConfigWatcher, DebugPanel, DefaultReloadStrategy, type DeviceCategory, type DeviceGroup, type DevicePreset, Handler, type HotReloadDependencies, type HotReloadWatcher, type LiveEditBridge, ObjectCentricConfig, type PreviewOptions, PreviewShell, type ReloadStrategy, type SetupLiveEditBridgeOptions, applyConfigOverride, applyConfigOverrides, baseLottie, bootstrap, clearConfigOverrides, configOverrideManager, createPreviewShell, Handler as default, defaultPreset, deviceGroups, devicePresets, diffConfigs, getConfigOverrides, getPresetById, getPresetsByCategory, rehydrateObject, setBootstrapDependencies, setupHotReload, setupLiveEditBridge };
|