@pixi-ui-editor/runtime-pixi 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SceneViewport.js.map +1 -1
- package/dist/assets/bitmapFonts.d.ts +2 -0
- package/dist/assets/bitmapFonts.d.ts.map +1 -1
- package/dist/assets/bitmapFonts.js +3 -1
- package/dist/assets/bitmapFonts.js.map +1 -1
- package/dist/assets/sounds.d.ts +1 -7
- package/dist/assets/sounds.d.ts.map +1 -1
- package/dist/assets/sounds.js +7 -90
- package/dist/assets/sounds.js.map +1 -1
- package/dist/assets/textures.d.ts +10 -0
- package/dist/assets/textures.d.ts.map +1 -1
- package/dist/assets/textures.js +10 -2
- package/dist/assets/textures.js.map +1 -1
- package/dist/audio/bus.d.ts +60 -0
- package/dist/audio/bus.d.ts.map +1 -0
- package/dist/audio/bus.js +38 -0
- package/dist/audio/bus.js.map +1 -0
- package/dist/audio/director.d.ts +35 -0
- package/dist/audio/director.d.ts.map +1 -0
- package/dist/audio/director.js +137 -0
- package/dist/audio/director.js.map +1 -0
- package/dist/controls.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/layout.js.map +1 -1
- package/dist/particles.js.map +1 -1
- package/dist/scene.d.ts +6 -2
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +5 -2
- package/dist/scene.js.map +1 -1
- package/dist/transformSpace.d.ts +119 -0
- package/dist/transformSpace.d.ts.map +1 -0
- package/dist/transformSpace.js +487 -0
- package/dist/transformSpace.js.map +1 -0
- package/dist/views/ButtonNodeView.d.ts +4 -3
- package/dist/views/ButtonNodeView.d.ts.map +1 -1
- package/dist/views/ButtonNodeView.js +9 -8
- package/dist/views/ButtonNodeView.js.map +1 -1
- package/dist/views/CheckboxNodeView.d.ts +4 -3
- package/dist/views/CheckboxNodeView.d.ts.map +1 -1
- package/dist/views/CheckboxNodeView.js +7 -7
- package/dist/views/CheckboxNodeView.js.map +1 -1
- package/dist/views/ItemTableNodeView.js.map +1 -1
- package/dist/views/PaginationNodeView.js.map +1 -1
- package/dist/views/ParticleEmitterNodeView.js.map +1 -1
- package/dist/views/StagedButtonNodeView.d.ts +4 -3
- package/dist/views/StagedButtonNodeView.d.ts.map +1 -1
- package/dist/views/StagedButtonNodeView.js +7 -9
- package/dist/views/StagedButtonNodeView.js.map +1 -1
- package/dist/views/basic.js.map +1 -1
- package/dist/views/createNodeView.d.ts +2 -2
- package/dist/views/createNodeView.d.ts.map +1 -1
- package/dist/views/createNodeView.js +4 -4
- package/dist/views/createNodeView.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { loadProjectSounds, loadSceneSounds } from "../assets/sounds.js";
|
|
2
|
+
import { createAudioBus, soundRefFor } from "./bus.js";
|
|
3
|
+
/** Owns one scene's looping background track and retries browser-blocked autoplay on first input. */
|
|
4
|
+
function createMusicPlayback() {
|
|
5
|
+
let assetId;
|
|
6
|
+
let currentSound;
|
|
7
|
+
let currentInstance;
|
|
8
|
+
let currentVolume = 1;
|
|
9
|
+
let pendingStart;
|
|
10
|
+
const removePendingStart = () => {
|
|
11
|
+
if (pendingStart !== undefined && typeof window !== "undefined")
|
|
12
|
+
window.removeEventListener("pointerdown", pendingStart);
|
|
13
|
+
pendingStart = undefined;
|
|
14
|
+
};
|
|
15
|
+
const stopCurrent = () => {
|
|
16
|
+
removePendingStart();
|
|
17
|
+
currentSound?.stop();
|
|
18
|
+
currentInstance = undefined;
|
|
19
|
+
currentSound = undefined;
|
|
20
|
+
assetId = undefined;
|
|
21
|
+
};
|
|
22
|
+
const audioContextIsSuspended = (sound) => {
|
|
23
|
+
const context = sound.context;
|
|
24
|
+
return context.audioContext?.state === "suspended";
|
|
25
|
+
};
|
|
26
|
+
const scheduleRetry = (start) => {
|
|
27
|
+
if (typeof window === "undefined" || pendingStart !== undefined)
|
|
28
|
+
return;
|
|
29
|
+
pendingStart = () => {
|
|
30
|
+
pendingStart = undefined;
|
|
31
|
+
currentInstance?.stop();
|
|
32
|
+
currentInstance = undefined;
|
|
33
|
+
const context = currentSound?.context?.audioContext;
|
|
34
|
+
if (context?.resume !== undefined)
|
|
35
|
+
void context.resume().finally(start);
|
|
36
|
+
else
|
|
37
|
+
start();
|
|
38
|
+
};
|
|
39
|
+
window.addEventListener("pointerdown", pendingStart, { once: true });
|
|
40
|
+
};
|
|
41
|
+
const playback = {
|
|
42
|
+
update(nextAssetId, nextSound, volume) {
|
|
43
|
+
currentVolume = volume;
|
|
44
|
+
if (nextAssetId === undefined || nextSound === undefined) {
|
|
45
|
+
stopCurrent();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (assetId === nextAssetId && currentSound === nextSound) {
|
|
49
|
+
if (currentInstance !== undefined)
|
|
50
|
+
currentInstance.volume = currentVolume;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
stopCurrent();
|
|
54
|
+
assetId = nextAssetId;
|
|
55
|
+
currentSound = nextSound;
|
|
56
|
+
const start = () => {
|
|
57
|
+
if (assetId !== nextAssetId || currentSound !== nextSound)
|
|
58
|
+
return;
|
|
59
|
+
removePendingStart();
|
|
60
|
+
try {
|
|
61
|
+
const result = nextSound.play({ loop: true, volume: currentVolume });
|
|
62
|
+
if (result instanceof Promise) {
|
|
63
|
+
void result.then((instance) => {
|
|
64
|
+
if (assetId === nextAssetId && currentSound === nextSound) {
|
|
65
|
+
currentInstance = instance;
|
|
66
|
+
instance.volume = currentVolume;
|
|
67
|
+
}
|
|
68
|
+
else
|
|
69
|
+
instance.stop();
|
|
70
|
+
}).catch(() => scheduleRetry(start));
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
currentInstance = result;
|
|
74
|
+
if (audioContextIsSuspended(nextSound))
|
|
75
|
+
scheduleRetry(start);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
scheduleRetry(start);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
start();
|
|
83
|
+
},
|
|
84
|
+
stop: stopCurrent,
|
|
85
|
+
};
|
|
86
|
+
return playback;
|
|
87
|
+
}
|
|
88
|
+
export function createRuntimeAudio(options) {
|
|
89
|
+
const bus = createAudioBus();
|
|
90
|
+
const music = createMusicPlayback();
|
|
91
|
+
// assetId -> разобранный Sound. Кэш ассетов ключуется URI файла и переживает смену сцен, а эта
|
|
92
|
+
// карта — просто «что директор уже умеет играть».
|
|
93
|
+
const sounds = new Map();
|
|
94
|
+
// Один кэш на весь слой: без него каждая загрузка заново скачивала и декодировала те же файлы.
|
|
95
|
+
const cache = (options.director === "builtin" ? options.cache : undefined) ?? new Map();
|
|
96
|
+
const handle = (event) => {
|
|
97
|
+
if (event.type === "cue") {
|
|
98
|
+
const result = event.sound === undefined ? undefined : sounds.get(event.sound.assetId)?.play();
|
|
99
|
+
if (result instanceof Promise)
|
|
100
|
+
void result.catch(() => undefined);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (event.action === "stop") {
|
|
104
|
+
music.update(undefined, undefined, 1);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
music.update(event.sound.assetId, sounds.get(event.sound.assetId), event.volume);
|
|
108
|
+
};
|
|
109
|
+
const unsubscribe = options.director === "builtin" ? bus.subscribe(handle) : undefined;
|
|
110
|
+
return {
|
|
111
|
+
emit: (event) => bus.emit(event),
|
|
112
|
+
subscribe: (listener) => bus.subscribe(listener),
|
|
113
|
+
async load(document, sceneId) {
|
|
114
|
+
if (options.director !== "builtin")
|
|
115
|
+
return;
|
|
116
|
+
const loaded = sceneId === undefined
|
|
117
|
+
? await loadProjectSounds(document, options.resolveFileUrl, cache)
|
|
118
|
+
: await loadSceneSounds(document, sceneId, options.resolveFileUrl, cache);
|
|
119
|
+
for (const [assetId, sound] of loaded)
|
|
120
|
+
sounds.set(assetId, sound);
|
|
121
|
+
},
|
|
122
|
+
setScene(document, sceneId) {
|
|
123
|
+
const scene = document.scenes.find((candidate) => candidate.id === sceneId);
|
|
124
|
+
if (scene === undefined)
|
|
125
|
+
throw new Error(`Scene '${sceneId}' does not exist in the project document.`);
|
|
126
|
+
const sound = soundRefFor(document, scene.audio?.backgroundMusicAssetId);
|
|
127
|
+
bus.emit(sound === undefined
|
|
128
|
+
? { type: "music", action: "stop" }
|
|
129
|
+
: { type: "music", action: "play", sound, loop: true, volume: scene.audio?.volume ?? 1 });
|
|
130
|
+
},
|
|
131
|
+
dispose() {
|
|
132
|
+
unsubscribe?.();
|
|
133
|
+
music.stop();
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=director.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"director.js","sourceRoot":"","sources":["../../src/audio/director.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAsD,MAAM,UAAU,CAAC;AAO3G,qGAAqG;AACrG,SAAS,mBAAmB;IAC1B,IAAI,OAA2B,CAAC;IAChC,IAAI,YAA+B,CAAC;IACpC,IAAI,eAA2C,CAAC;IAChD,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,IAAI,YAAsC,CAAC;IAE3C,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC9B,IAAI,YAAY,KAAK,SAAS,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;QACzH,YAAY,GAAG,SAAS,CAAC;IAC3B,CAAC,CAAC;IACF,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,kBAAkB,EAAE,CAAC;QACrB,YAAY,EAAE,IAAI,EAAE,CAAC;QACrB,eAAe,GAAG,SAAS,CAAC;QAC5B,YAAY,GAAG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AW,EAAE,EAAE,CAAC;YAChB,KAAK,CAAC,IAAI,EAAE,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Sound, IMediaInstance } from \"@pixi/sound\";\r\nimport type { ProjectDocument } from \"@pixi-ui-editor/schema\";\r\nimport type { FileUrlResolver } from \"../assets/textures.js\";\r\nimport { loadProjectSounds, loadSceneSounds } from \"../assets/sounds.js\";\r\nimport { createAudioBus, soundRefFor, type AudioBus, type AudioEvent, type AudioListener } from \"./bus.js\";\r\n\r\ntype MusicPlayback = {\r\n update(assetId: string | undefined, sound: Sound | undefined, volume: number): void;\r\n stop(): void;\r\n};\r\n\r\n/** Owns one scene's looping background track and retries browser-blocked autoplay on first input. */\r\nfunction createMusicPlayback(): MusicPlayback {\r\n let assetId: string | undefined;\r\n let currentSound: Sound | undefined;\r\n let currentInstance: IMediaInstance | undefined;\r\n let currentVolume = 1;\r\n let pendingStart: (() => void) | undefined;\r\n\r\n const removePendingStart = () => {\r\n if (pendingStart !== undefined && typeof window !== \"undefined\") window.removeEventListener(\"pointerdown\", pendingStart);\r\n pendingStart = undefined;\r\n };\r\n const stopCurrent = () => {\r\n removePendingStart();\r\n currentSound?.stop();\r\n currentInstance = undefined;\r\n currentSound = undefined;\r\n assetId = undefined;\r\n };\r\n const audioContextIsSuspended = (sound: Sound) => {\r\n const context = sound.context as { audioContext?: { state?: string } };\r\n return context.audioContext?.state === \"suspended\";\r\n };\r\n const scheduleRetry = (start: () => void) => {\r\n if (typeof window === \"undefined\" || pendingStart !== undefined) return;\r\n pendingStart = () => {\r\n pendingStart = undefined;\r\n currentInstance?.stop();\r\n currentInstance = undefined;\r\n const context = (currentSound?.context as { audioContext?: { resume?: () => Promise<void> } } | undefined)?.audioContext;\r\n if (context?.resume !== undefined) void context.resume().finally(start);\r\n else start();\r\n };\r\n window.addEventListener(\"pointerdown\", pendingStart, { once: true });\r\n };\r\n\r\n const playback: MusicPlayback = {\r\n update(nextAssetId, nextSound, volume) {\r\n currentVolume = volume;\r\n if (nextAssetId === undefined || nextSound === undefined) {\r\n stopCurrent();\r\n return;\r\n }\r\n if (assetId === nextAssetId && currentSound === nextSound) {\r\n if (currentInstance !== undefined) currentInstance.volume = currentVolume;\r\n return;\r\n }\r\n\r\n stopCurrent();\r\n assetId = nextAssetId;\r\n currentSound = nextSound;\r\n const start = () => {\r\n if (assetId !== nextAssetId || currentSound !== nextSound) return;\r\n removePendingStart();\r\n try {\r\n const result = nextSound.play({ loop: true, volume: currentVolume });\r\n if (result instanceof Promise) {\r\n void result.then((instance) => {\r\n if (assetId === nextAssetId && currentSound === nextSound) { currentInstance = instance; instance.volume = currentVolume; }\r\n else instance.stop();\r\n }).catch(() => scheduleRetry(start));\r\n } else {\r\n currentInstance = result;\r\n if (audioContextIsSuspended(nextSound)) scheduleRetry(start);\r\n }\r\n } catch {\r\n scheduleRetry(start);\r\n }\r\n };\r\n start();\r\n },\r\n stop: stopCurrent,\r\n };\r\n return playback;\r\n}\r\n\r\n/**\r\n * Явная инициализация звукового слоя рантайма.\r\n *\r\n * `director: \"none\"` — рантайм только публикует события в шину и не трогает `@pixi/sound`: звуковые\r\n * файлы не скачиваются и не декодируются вовсе, всё это делает звуковая система хоста.\r\n * `director: \"builtin\"` — те же события дополнительно слушает встроенный директор, который грузит\r\n * ассеты проекта и играет их сам (так работает Preview редактора и пример `examples/pixi-app`).\r\n */\r\nexport type RuntimeAudioOptions =\r\n | { readonly director: \"none\" }\r\n | {\r\n readonly director: \"builtin\";\r\n /** Как превратить `asset.source.uri` в загружаемый URL — тот же резолвер, что у текстур. */\r\n readonly resolveFileUrl: FileUrlResolver;\r\n /** Общий кэш разобранных звуков, обычно `SceneAssetCache.sounds`. */\r\n readonly cache?: Map<string, Sound>;\r\n };\r\n\r\nexport interface RuntimeAudio extends AudioBus {\r\n /**\r\n * Готовит звуки для встроенного директора: со `sceneId` — только те, что нужны сцене, без него —\r\n * все звуки проекта (редактору так удобнее: назначения меняются на лету). С `director: \"none\"`\r\n * ничего не делает.\r\n */\r\n load(document: ProjectDocument, sceneId?: string): Promise<void>;\r\n /** Объявляет активную сцену: публикует её фоновую музыку (или её отсутствие) в шину. */\r\n setScene(document: ProjectDocument, sceneId: string): void;\r\n /** Останавливает встроенное воспроизведение и отписывает директора от шины. */\r\n dispose(): void;\r\n}\r\n\r\nexport function createRuntimeAudio(options: RuntimeAudioOptions): RuntimeAudio {\r\n const bus = createAudioBus();\r\n const music = createMusicPlayback();\r\n // assetId -> разобранный Sound. Кэш ассетов ключуется URI файла и переживает смену сцен, а эта\r\n // карта — просто «что директор уже умеет играть».\r\n const sounds = new Map<string, Sound>();\r\n // Один кэш на весь слой: без него каждая загрузка заново скачивала и декодировала те же файлы.\r\n const cache = (options.director === \"builtin\" ? options.cache : undefined) ?? new Map<string, Sound>();\r\n\r\n const handle: AudioListener = (event: AudioEvent) => {\r\n if (event.type === \"cue\") {\r\n const result = event.sound === undefined ? undefined : sounds.get(event.sound.assetId)?.play();\r\n if (result instanceof Promise) void result.catch(() => undefined);\r\n return;\r\n }\r\n if (event.action === \"stop\") {\r\n music.update(undefined, undefined, 1);\r\n return;\r\n }\r\n music.update(event.sound.assetId, sounds.get(event.sound.assetId), event.volume);\r\n };\r\n\r\n const unsubscribe = options.director === \"builtin\" ? bus.subscribe(handle) : undefined;\r\n\r\n return {\r\n emit: (event) => bus.emit(event),\r\n subscribe: (listener) => bus.subscribe(listener),\r\n async load(document, sceneId) {\r\n if (options.director !== \"builtin\") return;\r\n const loaded = sceneId === undefined\r\n ? await loadProjectSounds(document, options.resolveFileUrl, cache)\r\n : await loadSceneSounds(document, sceneId, options.resolveFileUrl, cache);\r\n for (const [assetId, sound] of loaded) sounds.set(assetId, sound);\r\n },\r\n setScene(document, sceneId) {\r\n const scene = document.scenes.find((candidate) => candidate.id === sceneId);\r\n if (scene === undefined) throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\r\n const sound = soundRefFor(document, scene.audio?.backgroundMusicAssetId);\r\n bus.emit(sound === undefined\r\n ? { type: \"music\", action: \"stop\" }\r\n : { type: \"music\", action: \"play\", sound, loop: true, volume: scene.audio?.volume ?? 1 });\r\n },\r\n dispose() {\r\n unsubscribe?.();\r\n music.stop();\r\n },\r\n };\r\n}\r\n"]}
|
package/dist/controls.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controls.js","sourceRoot":"","sources":["../src/controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAG3E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,SAAS,cAAc,CAAC,IAAe;IACrC,IAAI,IAAI,YAAY,QAAQ;QAAE,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACrD,OAAO,IAAI,YAAY,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,EAAkB,EAAE,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC;AAC9G,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,oBAAoB,CAAC,IAAe,EAAE,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A2B;IACrF,IAAI,IAAI,YAAY,oBAAoB;QAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACrE,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,oBAAoB,CAAC,IAAe,EAAE,QAAiB;IACrE,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;AACvD,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,4BAA4B,CAAC,IAAe,EAAE,MAAe;IAC3E,IAAI,IAAI,YAAY,aAAa;QAAE,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC;AACxE,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,0BAA0B,CAAC,SAAyC;IAClF,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,MAAM,EAAE;QAAE,IAAI,IAAI,YAAY,aAAa,IAAI,IAAI,CAAC,oBAAoB;YAAE,IAAI,CAAC,qBAAqB,EAAE,CAAC;AACtI,CAAC","sourcesContent":["import { type SkeletonData, Spine } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport { type ButtonStateKey, type LayoutPadding } from \"@pixi-ui-editor/schema\";\r\nimport { Container } from \"pixi.js\";\r\nimport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\r\nimport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\r\nimport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\r\nimport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\r\nimport { PaginationNodeView } from \"./views/PaginationNodeView.js\";\r\nimport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\r\nimport { ImageNodeView, OpacityGroupNodeView } from \"./views/basic.js\";\r\nimport { NodeView } from \"./views/NodeView.js\";\r\nimport { ProgressBarNodeView, SliderNodeView } from \"./views/ValueControlNodeViews.js\";\r\nimport { SpineNodeView } from \"./views/SpineNodeView.js\";\r\n\r\nfunction findSpineChild(view: Container): Spine | undefined {\r\n if (view instanceof NodeView) return view.getSpine();\r\n return view instanceof Spine ? view : view.children.find((child): child is Spine => child instanceof Spine);\r\n}\r\n\r\n/** Reads the current 1-based animation frame for an editor Spine node. */\r\nexport function getSpineViewPlayback(view: Container, skeletonData: SkeletonData, animation: string): { current: number; total: number } | undefined {\r\n const spine = findSpineChild(view);\r\n const track = spine?.state.tracks[0];\r\n const duration = skeletonData.findAnimation(animation)?.duration;\r\n if (track === null || track === undefined || duration === undefined || duration <= 0) return undefined;\r\n const fps = skeletonData.fps && skeletonData.fps > 0 ? skeletonData.fps : 60;\r\n const total = Math.max(1, Math.round(duration * fps));\r\n const time = track.loop ? track.trackTime % duration : Math.min(track.trackTime, duration);\r\n return { current: Math.min(total, Math.floor(time * fps) + 1), total };\r\n}\r\n\r\n/** Seeks an editor Spine node to a 1-based animation frame without changing its serialized animation settings. */\r\nexport function setSpineViewFrame(view: Container, frame: number, skeletonData: SkeletonData, animation: string): void {\r\n const spine = findSpineChild(view);\r\n const track = spine?.state.tracks[0];\r\n const duration = skeletonData.findAnimation(animation)?.duration;\r\n if (track === null || track === undefined || duration === undefined || duration <= 0) return;\r\n const fps = skeletonData.fps && skeletonData.fps > 0 ? skeletonData.fps : 60;\r\n const total = Math.max(1, Math.round(duration * fps));\r\n track.trackTime = Math.min(total, Math.max(1, Math.round(frame)) - 1) / fps;\r\n spine?.update(0);\r\n}\r\n\r\n/** Forces an editor-only button state; the node's serialized `enabled` and states stay untouched. */\r\nexport function setButtonViewState(view: Container, state: ButtonStateKey): void {\r\n if (view instanceof ButtonNodeView) view.setState(state);\r\n}\r\n\r\n/** Forces an editor-only checkbox checked state; the node's serialized `defaultChecked` stays untouched. */\r\nexport function setCheckboxViewChecked(view: Container, checked: boolean): void {\r\n if (view instanceof CheckboxNodeView) view.forceCheck(checked);\r\n}\r\n\r\n/** Forces an editor-only staged button preview stage; the document's `stages`/current stage stay untouched. */\r\nexport function setStagedButtonViewStage(view: Container, index: number): void {\r\n if (view instanceof StagedButtonNodeView) view.forceStage(index);\r\n}\r\n\r\n/** Forces an editor-only staged button visual state; the node's serialized `enabled` stays untouched. */\r\nexport function setStagedButtonViewState(view: Container, state: ButtonStateKey): void {\r\n if (view instanceof StagedButtonNodeView) view.setState(state);\r\n}\r\n\r\n/** Live-previews nine-slice border edits while dragging the canvas gizmo; commits only on release. */\r\nexport function previewNineSlice(view: Container, nineSlice: LayoutPadding): void {\r\n if (view instanceof ImageNodeView || view instanceof ButtonNodeView || view instanceof StagedButtonNodeView) view.previewNineSlice(nineSlice);\r\n}\r\n\r\n/** Applies an editor-only slider preview value without touching the document. */\r\nexport function setSliderViewValue(view: Container, value: number): void {\r\n if (view instanceof SliderNodeView) view.value = value;\r\n}\r\n\r\n/** Applies an editor-only progress preview without touching the document. */\r\nexport function setProgressBarViewProgress(view: Container, progress: number): void {\r\n if (view instanceof ProgressBarNodeView) view.progress = progress;\r\n}\r\n\r\n/** One-way sync from game code (or editor preview) into the widget: highlights a dot without emitting `onPageChange`. */\r\nexport function setPaginationViewPage(view: Container, page: number): void {\r\n if (view instanceof PaginationNodeView) view.page = page;\r\n}\r\n\r\n/**\r\n * Rebuilds the widget's dots for a runtime-known page count, e.g. once actual content length is known.\r\n * Ignored while the widget pages through authored `items`: there the item list already fixes the count.\r\n */\r\nexport function setPaginationViewPageCount(view: Container, pageCount: number): void {\r\n if (view instanceof PaginationNodeView) view.pageCount = pageCount;\r\n}\r\n\r\n/**\r\n * Все элементы таблицы в порядке иерархии, включая скрытые вместимостью — «что вообще есть».\r\n * Возвращает пустой список, если `view` не item-table.\r\n */\r\nexport function getItemTableViewItems(view: Container): Container[] {\r\n return view instanceof ItemTableNodeView ? view.items : [];\r\n}\r\n\r\n/** Элементы, показанные прямо сейчас: столько, сколько влезает в текущем профиле. */\r\nexport function getItemTableViewVisibleItems(view: Container): Container[] {\r\n return view instanceof ItemTableNodeView ? view.visibleItems : [];\r\n}\r\n\r\n/** Один элемент по индексу — адресация, на которой игровой код раскладывает свои данные. */\r\nexport function getItemTableViewItem(view: Container, index: number): Container | undefined {\r\n return view instanceof ItemTableNodeView ? view.itemAt(index) : undefined;\r\n}\r\n\r\n/** Транзиентно меняет вместимость; `undefined` возвращает авторское значение профиля. */\r\nexport function setItemTableViewVisibleCount(view: Container, count: number | undefined): void {\r\n if (view instanceof ItemTableNodeView) view.visibleCount = count;\r\n}\r\n\r\n/** Показывает или прячет все элементы разом; `undefined` возвращает управление вместимости. */\r\nexport function setItemTableViewItemsVisible(view: Container, visible: boolean | undefined): void {\r\n if (view instanceof ItemTableNodeView) view.setItemsVisible(visible);\r\n}\r\n\r\n/** Switches which direct child (\"page\") of a page group is shown; every other child is hidden. Out-of-range indices clamp into range, so passing whatever a caller has on hand can never throw or leave the group blank. */\r\nexport function setPageGroupViewPage(view: Container, page: number): void {\r\n if (view instanceof PageGroupNodeView) view.page = page;\r\n}\r\n\r\n/** Currently shown page index, or `undefined` if `view` is not a page group. */\r\nexport function getPageGroupViewPage(view: Container): number | undefined {\r\n return view instanceof PageGroupNodeView ? view.page : undefined;\r\n}\r\n\r\n/** Total number of pages (authored children plus any appended via `addPageGroupViewPage`); `0` if `view` is not a page group. */\r\nexport function getPageGroupViewPageCount(view: Container): number {\r\n return view instanceof PageGroupNodeView ? view.pageCount : 0;\r\n}\r\n\r\n/**\r\n * Appends a page built at runtime (e.g. the `root` from `buildPrefabView`/`loadPrefabView`, or any\r\n * hand-built `Container`) after the last one — for a dataset that grows during play (a spin history\r\n * list, a chat log, ...) rather than one fully known at authoring time. Fits the page to the group's\r\n * current rectangle and hides it until switched to. Returns the new page's index, or `undefined` if\r\n * `view` is not a page group. Keep `setPaginationViewPageCount` in sync with the resulting `pageCount`\r\n * if a `pagination` widget is showing this group's page count.\r\n */\r\nexport function addPageGroupViewPage(view: Container, page: Container): number | undefined {\r\n return view instanceof PageGroupNodeView ? view.addPage(page) : undefined;\r\n}\r\n\r\n/**\r\n * Fades a whole subtree by driving one opacity group, the cheap `CanvasGroup.alpha` equivalent: the\r\n * value multiplies into every descendant through PixiJS `worldAlpha`, so animating a fade is one write\r\n * per frame regardless of how many nodes are inside. The node's authored `opacity` stays untouched in\r\n * the document; pass `undefined` to hand control back to it. Tweening itself belongs to game code —\r\n * the runtime deliberately ships no animation engine, the same way `page-group` ships no swipe gesture.\r\n */\r\nexport function setOpacityGroupViewOpacity(view: Container, opacity: number | undefined): void {\r\n if (view instanceof OpacityGroupNodeView) view.setOpacity(opacity);\r\n}\r\n\r\n/** Enables or pauses editor-only automatic playback without affecting serialized node data. */\r\nexport function setSpineViewAutoplay(view: Container, autoplay: boolean): void {\r\n const spine = findSpineChild(view);\r\n if (spine !== undefined) spine.autoUpdate = autoplay;\r\n}\r\n\r\n/** Activates authored bone/slot part connectors on one Spine node without mutating the document. */\r\nexport function setSpineConnectorBonesActive(view: Container, active: boolean): void {\r\n if (view instanceof SpineNodeView) view.activeConnectorBones = active;\r\n}\r\n\r\n/** Reasserts active connector matrices after a host performs live node-view updates. */\r\nexport function refreshSpineConnectorBones(nodeViews: ReadonlyMap<string, Container>): void {\r\n for (const view of nodeViews.values()) if (view instanceof SpineNodeView && view.activeConnectorBones) view.refreshConnectorBones();\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"controls.js","sourceRoot":"","sources":["../src/controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAG3E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EA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AAC","sourcesContent":["import { type SkeletonData, Spine } from \"@esotericsoftware/spine-pixi-v8\";\nimport { type ButtonStateKey, type LayoutPadding } from \"@pixi-ui-editor/schema\";\nimport { Container } from \"pixi.js\";\nimport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\nimport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\nimport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\nimport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\nimport { PaginationNodeView } from \"./views/PaginationNodeView.js\";\nimport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\nimport { ImageNodeView, OpacityGroupNodeView } from \"./views/basic.js\";\nimport { NodeView } from \"./views/NodeView.js\";\nimport { ProgressBarNodeView, SliderNodeView } from \"./views/ValueControlNodeViews.js\";\nimport { SpineNodeView } from \"./views/SpineNodeView.js\";\n\nfunction findSpineChild(view: Container): Spine | undefined {\n if (view instanceof NodeView) return view.getSpine();\n return view instanceof Spine ? view : view.children.find((child): child is Spine => child instanceof Spine);\n}\n\n/** Reads the current 1-based animation frame for an editor Spine node. */\nexport function getSpineViewPlayback(view: Container, skeletonData: SkeletonData, animation: string): { current: number; total: number } | undefined {\n const spine = findSpineChild(view);\n const track = spine?.state.tracks[0];\n const duration = skeletonData.findAnimation(animation)?.duration;\n if (track === null || track === undefined || duration === undefined || duration <= 0) return undefined;\n const fps = skeletonData.fps && skeletonData.fps > 0 ? skeletonData.fps : 60;\n const total = Math.max(1, Math.round(duration * fps));\n const time = track.loop ? track.trackTime % duration : Math.min(track.trackTime, duration);\n return { current: Math.min(total, Math.floor(time * fps) + 1), total };\n}\n\n/** Seeks an editor Spine node to a 1-based animation frame without changing its serialized animation settings. */\nexport function setSpineViewFrame(view: Container, frame: number, skeletonData: SkeletonData, animation: string): void {\n const spine = findSpineChild(view);\n const track = spine?.state.tracks[0];\n const duration = skeletonData.findAnimation(animation)?.duration;\n if (track === null || track === undefined || duration === undefined || duration <= 0) return;\n const fps = skeletonData.fps && skeletonData.fps > 0 ? skeletonData.fps : 60;\n const total = Math.max(1, Math.round(duration * fps));\n track.trackTime = Math.min(total, Math.max(1, Math.round(frame)) - 1) / fps;\n spine?.update(0);\n}\n\n/** Forces an editor-only button state; the node's serialized `enabled` and states stay untouched. */\nexport function setButtonViewState(view: Container, state: ButtonStateKey): void {\n if (view instanceof ButtonNodeView) view.setState(state);\n}\n\n/** Forces an editor-only checkbox checked state; the node's serialized `defaultChecked` stays untouched. */\nexport function setCheckboxViewChecked(view: Container, checked: boolean): void {\n if (view instanceof CheckboxNodeView) view.forceCheck(checked);\n}\n\n/** Forces an editor-only staged button preview stage; the document's `stages`/current stage stay untouched. */\nexport function setStagedButtonViewStage(view: Container, index: number): void {\n if (view instanceof StagedButtonNodeView) view.forceStage(index);\n}\n\n/** Forces an editor-only staged button visual state; the node's serialized `enabled` stays untouched. */\nexport function setStagedButtonViewState(view: Container, state: ButtonStateKey): void {\n if (view instanceof StagedButtonNodeView) view.setState(state);\n}\n\n/** Live-previews nine-slice border edits while dragging the canvas gizmo; commits only on release. */\nexport function previewNineSlice(view: Container, nineSlice: LayoutPadding): void {\n if (view instanceof ImageNodeView || view instanceof ButtonNodeView || view instanceof StagedButtonNodeView) view.previewNineSlice(nineSlice);\n}\n\n/** Applies an editor-only slider preview value without touching the document. */\nexport function setSliderViewValue(view: Container, value: number): void {\n if (view instanceof SliderNodeView) view.value = value;\n}\n\n/** Applies an editor-only progress preview without touching the document. */\nexport function setProgressBarViewProgress(view: Container, progress: number): void {\n if (view instanceof ProgressBarNodeView) view.progress = progress;\n}\n\n/** One-way sync from game code (or editor preview) into the widget: highlights a dot without emitting `onPageChange`. */\nexport function setPaginationViewPage(view: Container, page: number): void {\n if (view instanceof PaginationNodeView) view.page = page;\n}\n\n/**\n * Rebuilds the widget's dots for a runtime-known page count, e.g. once actual content length is known.\n * Ignored while the widget pages through authored `items`: there the item list already fixes the count.\n */\nexport function setPaginationViewPageCount(view: Container, pageCount: number): void {\n if (view instanceof PaginationNodeView) view.pageCount = pageCount;\n}\n\n/**\n * Все элементы таблицы в порядке иерархии, включая скрытые вместимостью — «что вообще есть».\n * Возвращает пустой список, если `view` не item-table.\n */\nexport function getItemTableViewItems(view: Container): Container[] {\n return view instanceof ItemTableNodeView ? view.items : [];\n}\n\n/** Элементы, показанные прямо сейчас: столько, сколько влезает в текущем профиле. */\nexport function getItemTableViewVisibleItems(view: Container): Container[] {\n return view instanceof ItemTableNodeView ? view.visibleItems : [];\n}\n\n/** Один элемент по индексу — адресация, на которой игровой код раскладывает свои данные. */\nexport function getItemTableViewItem(view: Container, index: number): Container | undefined {\n return view instanceof ItemTableNodeView ? view.itemAt(index) : undefined;\n}\n\n/** Транзиентно меняет вместимость; `undefined` возвращает авторское значение профиля. */\nexport function setItemTableViewVisibleCount(view: Container, count: number | undefined): void {\n if (view instanceof ItemTableNodeView) view.visibleCount = count;\n}\n\n/** Показывает или прячет все элементы разом; `undefined` возвращает управление вместимости. */\nexport function setItemTableViewItemsVisible(view: Container, visible: boolean | undefined): void {\n if (view instanceof ItemTableNodeView) view.setItemsVisible(visible);\n}\n\n/** Switches which direct child (\"page\") of a page group is shown; every other child is hidden. Out-of-range indices clamp into range, so passing whatever a caller has on hand can never throw or leave the group blank. */\nexport function setPageGroupViewPage(view: Container, page: number): void {\n if (view instanceof PageGroupNodeView) view.page = page;\n}\n\n/** Currently shown page index, or `undefined` if `view` is not a page group. */\nexport function getPageGroupViewPage(view: Container): number | undefined {\n return view instanceof PageGroupNodeView ? view.page : undefined;\n}\n\n/** Total number of pages (authored children plus any appended via `addPageGroupViewPage`); `0` if `view` is not a page group. */\nexport function getPageGroupViewPageCount(view: Container): number {\n return view instanceof PageGroupNodeView ? view.pageCount : 0;\n}\n\n/**\n * Appends a page built at runtime (e.g. the `root` from `buildPrefabView`/`loadPrefabView`, or any\n * hand-built `Container`) after the last one — for a dataset that grows during play (a spin history\n * list, a chat log, ...) rather than one fully known at authoring time. Fits the page to the group's\n * current rectangle and hides it until switched to. Returns the new page's index, or `undefined` if\n * `view` is not a page group. Keep `setPaginationViewPageCount` in sync with the resulting `pageCount`\n * if a `pagination` widget is showing this group's page count.\n */\nexport function addPageGroupViewPage(view: Container, page: Container): number | undefined {\n return view instanceof PageGroupNodeView ? view.addPage(page) : undefined;\n}\n\n/**\n * Fades a whole subtree by driving one opacity group, the cheap `CanvasGroup.alpha` equivalent: the\n * value multiplies into every descendant through PixiJS `worldAlpha`, so animating a fade is one write\n * per frame regardless of how many nodes are inside. The node's authored `opacity` stays untouched in\n * the document; pass `undefined` to hand control back to it. Tweening itself belongs to game code —\n * the runtime deliberately ships no animation engine, the same way `page-group` ships no swipe gesture.\n */\nexport function setOpacityGroupViewOpacity(view: Container, opacity: number | undefined): void {\n if (view instanceof OpacityGroupNodeView) view.setOpacity(opacity);\n}\n\n/** Enables or pauses editor-only automatic playback without affecting serialized node data. */\nexport function setSpineViewAutoplay(view: Container, autoplay: boolean): void {\n const spine = findSpineChild(view);\n if (spine !== undefined) spine.autoUpdate = autoplay;\n}\n\n/** Activates authored bone/slot part connectors on one Spine node without mutating the document. */\nexport function setSpineConnectorBonesActive(view: Container, active: boolean): void {\n if (view instanceof SpineNodeView) view.activeConnectorBones = active;\n}\n\n/** Reasserts active connector matrices after a host performs live node-view updates. */\nexport function refreshSpineConnectorBones(nodeViews: ReadonlyMap<string, Container>): void {\n for (const view of nodeViews.values()) if (view instanceof SpineNodeView && view.activeConnectorBones) view.refreshConnectorBones();\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./document.js";
|
|
|
4
4
|
export * from "./layout.js";
|
|
5
5
|
export { SceneViewport } from "./SceneViewport.js";
|
|
6
6
|
export * from "./layoutGroups.js";
|
|
7
|
+
export * from "./transformSpace.js";
|
|
7
8
|
export * from "./scrollView.js";
|
|
8
9
|
export * from "./pageGroup.js";
|
|
9
10
|
export * from "./views/NodeView.js";
|
|
@@ -33,4 +34,6 @@ export * from "./assets/spine.js";
|
|
|
33
34
|
export * from "./assets/fonts.js";
|
|
34
35
|
export * from "./assets/bitmapFonts.js";
|
|
35
36
|
export * from "./assets/sounds.js";
|
|
37
|
+
export * from "./audio/bus.js";
|
|
38
|
+
export * from "./audio/director.js";
|
|
36
39
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,cAAc,gBAAg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AClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./document.js";
|
|
|
2
2
|
export * from "./layout.js";
|
|
3
3
|
export { SceneViewport } from "./SceneViewport.js";
|
|
4
4
|
export * from "./layoutGroups.js";
|
|
5
|
+
export * from "./transformSpace.js";
|
|
5
6
|
export * from "./scrollView.js";
|
|
6
7
|
export * from "./pageGroup.js";
|
|
7
8
|
export * from "./views/NodeView.js";
|
|
@@ -28,4 +29,6 @@ export * from "./assets/spine.js";
|
|
|
28
29
|
export * from "./assets/fonts.js";
|
|
29
30
|
export * from "./assets/bitmapFonts.js";
|
|
30
31
|
export * from "./assets/sounds.js";
|
|
32
|
+
export * from "./audio/bus.js";
|
|
33
|
+
export * from "./audio/director.js";
|
|
31
34
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEvH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,oBAAoB,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3K,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC","sourcesContent":["export type { SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\r\nexport type { Sound } from \"@pixi/sound\";\r\nexport * from \"./document.js\";\r\nexport * from \"./layout.js\";\r\nexport { SceneViewport } from \"./SceneViewport.js\";\r\nexport * from \"./layoutGroups.js\";\r\nexport * from \"./scrollView.js\";\r\nexport * from \"./pageGroup.js\";\r\nexport * from \"./views/NodeView.js\";\r\nexport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\r\nexport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\r\nexport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\r\nexport { InputNodeView } from \"./views/InputNodeView.js\";\r\nexport { ScrollViewNodeView } from \"./views/ScrollViewNodeView.js\";\r\nexport { SpineNodeView } from \"./views/SpineNodeView.js\";\r\nexport { ProgressBarNodeView, SliderNodeView } from \"./views/ValueControlNodeViews.js\";\r\nexport { PaginationNodeView } from \"./views/PaginationNodeView.js\";\r\nexport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\r\nexport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\r\nexport { ParticleEmitterNodeView } from \"./views/ParticleEmitterNodeView.js\";\r\nexport * from \"./particles.js\";\r\nexport { collectNodeAssetIds } from \"./views/createNodeView.js\";\r\nexport { SceneLocalization } from \"./localization.js\";\r\nexport type { SceneLocalizationOptions } from \"./localization.js\";\r\nexport { BitmapTextNodeView, ImageNodeView, MaskNodeView, OpacityGroupNodeView, TextNodeView } from \"./views/basic.js\";\r\nexport type { BuildSceneViewOptions, PrefabViewConfiguration, SceneViewResult } from \"./scene.js\";\r\nexport { buildPrefabView, buildSceneView, collectRenderedNodes, loadPrefabView, previewNodeView, updateNodeView, updateParticleEmitters, loadSceneView } from \"./scene.js\";\r\nexport * from \"./controls.js\";\r\nexport { createSceneAssetCache } from \"./assets/cache.js\";\r\nexport type { SceneAssetCache } from \"./assets/cache.js\";\r\nexport * from \"./assets/textures.js\";\r\nexport * from \"./assets/spine.js\";\r\nexport * from \"./assets/fonts.js\";\r\nexport * from \"./assets/bitmapFonts.js\";\r\nexport * from \"./assets/sounds.js\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,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B,CAAC;AAC/B,cAAc,qBAAqB,CAAC","sourcesContent":["export type { SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\r\nexport type { Sound } from \"@pixi/sound\";\r\nexport * from \"./document.js\";\r\nexport * from \"./layout.js\";\r\nexport { SceneViewport } from \"./SceneViewport.js\";\r\nexport * from \"./layoutGroups.js\";\r\nexport * from \"./transformSpace.js\";\r\nexport * from \"./scrollView.js\";\r\nexport * from \"./pageGroup.js\";\r\nexport * from \"./views/NodeView.js\";\r\nexport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\r\nexport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\r\nexport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\r\nexport { InputNodeView } from \"./views/InputNodeView.js\";\r\nexport { ScrollViewNodeView } from \"./views/ScrollViewNodeView.js\";\r\nexport { SpineNodeView } from \"./views/SpineNodeView.js\";\r\nexport { ProgressBarNodeView, SliderNodeView } from \"./views/ValueControlNodeViews.js\";\r\nexport { PaginationNodeView } from \"./views/PaginationNodeView.js\";\r\nexport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\r\nexport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\r\nexport { ParticleEmitterNodeView } from \"./views/ParticleEmitterNodeView.js\";\r\nexport * from \"./particles.js\";\r\nexport { collectNodeAssetIds } from \"./views/createNodeView.js\";\r\nexport { SceneLocalization } from \"./localization.js\";\r\nexport type { SceneLocalizationOptions } from \"./localization.js\";\r\nexport { BitmapTextNodeView, ImageNodeView, MaskNodeView, OpacityGroupNodeView, TextNodeView } from \"./views/basic.js\";\r\nexport type { BuildSceneViewOptions, PrefabViewConfiguration, SceneViewResult } from \"./scene.js\";\r\nexport { buildPrefabView, buildSceneView, collectRenderedNodes, loadPrefabView, previewNodeView, updateNodeView, updateParticleEmitters, loadSceneView } from \"./scene.js\";\r\nexport * from \"./controls.js\";\r\nexport { createSceneAssetCache } from \"./assets/cache.js\";\r\nexport type { SceneAssetCache } from \"./assets/cache.js\";\r\nexport * from \"./assets/textures.js\";\r\nexport * from \"./assets/spine.js\";\r\nexport * from \"./assets/fonts.js\";\r\nexport * from \"./assets/bitmapFonts.js\";\r\nexport * from \"./assets/sounds.js\";\r\nexport * from \"./audio/bus.js\";\r\nexport * from \"./audio/director.js\";\r\n"]}
|
package/dist/layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS;IAC7F,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;CAC1F,CAAC;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,CAAC;AAEvD,wGAAwG;AACxG,MAAM,UAAU,iBAAiB,CAAC,QAAoB,EAAE,IAAgB;IACtE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnF,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;IACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC;IACvC,OAAO;QACL,KAAK;QACL,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC;QAC3B,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC;QAC7B,KAAK;QACL,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;;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C,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;QACnF,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE;QAClE,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC","sourcesContent":["import { type BitmapTextNode, type BitmapTextStyle, type LayoutProfileId, type ProjectDocument, type SpineReferenceFrame, type TextNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\r\n\r\nexport type ResolvedProfileTransform = {\r\n transform: UINode[\"transform\"];\r\n visible: boolean;\r\n};\r\n\r\nexport type LayoutSize = { width: number; height: number };\r\n\r\nexport type FittedViewport = {\r\n scale: number;\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n};\r\n\r\ntype SpineNode = Extract<UINode, { type: \"spine\" }>;\r\nexport type ResolvedSpineSettings = { animation: string | undefined; autoplay: boolean; loop: boolean; animationSpeed: number };\r\n\r\nexport const DEFAULT_TEXT_STYLE: TextStyleDefinition = {\r\n fontFamily: \"Arial\", fontSize: 24, fontWeight: \"normal\", fontStyle: \"normal\", fill: \"#FFFFFF\",\r\n align: \"left\", verticalAlign: \"top\", wordWrap: false, breakWords: false, letterSpacing: 0,\r\n};\r\n\r\nexport const CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT = 0.5;\r\n\r\n/** Uniformly contains an authored viewport inside a physical host without changing its aspect ratio. */\r\nexport function fitViewportToHost(viewport: LayoutSize, host: LayoutSize): FittedViewport {\r\n const scale = Math.min(host.width / viewport.width, host.height / viewport.height);\r\n const width = viewport.width * scale;\r\n const height = viewport.height * scale;\r\n return {\r\n scale,\r\n x: (host.width - width) / 2,\r\n y: (host.height - height) / 2,\r\n width,\r\n height,\r\n };\r\n}\r\n\r\n/**\r\n * Unity Canvas Scaler's `Scale With Screen Size / Match Width Or Height` calculation.\r\n * Width and height are blended in logarithmic space, producing one uniform scale for the Canvas.\r\n */\r\nexport function getCanvasScale(\r\n screenSize: LayoutSize,\r\n referenceResolution: LayoutSize,\r\n matchWidthOrHeight = CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT,\r\n): number {\r\n const widthScale = screenSize.width / referenceResolution.width;\r\n const heightScale = screenSize.height / referenceResolution.height;\r\n const logWidth = Math.log2(widthScale);\r\n const logHeight = Math.log2(heightScale);\r\n return 2 ** (logWidth + (logHeight - logWidth) * matchWidthOrHeight);\r\n}\r\n\r\n/** Logical RectTransform space exposed by a scaled Canvas at the current screen aspect ratio. */\r\nexport function getCanvasLogicalSize(screenSize: LayoutSize, referenceResolution: LayoutSize): LayoutSize {\r\n const scale = getCanvasScale(screenSize, referenceResolution);\r\n return { width: screenSize.width / scale, height: screenSize.height / scale };\r\n}\r\n\r\n/** Resolves a node's base transform with a profile override applied field by field. */\r\nexport function resolveProfileTransform(node: UINode, profile: LayoutProfileId): ResolvedProfileTransform {\r\n const override = node.layoutOverrides?.[profile];\r\n\r\n return {\r\n transform: { ...node.transform, ...override?.transform },\r\n visible: override?.visible ?? node.visible,\r\n };\r\n}\r\n\r\n/** Resolves a text node's optional base style with the active profile's sparse style override. */\r\nexport function resolveTextStyle(node: TextNode, profile: LayoutProfileId): TextStyleDefinition | undefined {\r\n const override = node.textStyleOverrides?.[profile];\r\n if (node.style === undefined && override === undefined) return undefined;\r\n return { ...DEFAULT_TEXT_STYLE, ...node.style, ...override };\r\n}\r\n\r\n/** Resolves bitmap text's base visual presentation with the active sparse profile override. */\r\nexport function resolveBitmapTextStyle(node: BitmapTextNode, profile: LayoutProfileId): BitmapTextStyle {\r\n return {\r\n assetId: node.assetId,\r\n fontSize: node.fontSize,\r\n fill: node.fill,\r\n align: node.align,\r\n verticalAlign: node.verticalAlign,\r\n letterSpacing: node.letterSpacing,\r\n wordWrap: node.wordWrap,\r\n ...node.bitmapTextOverrides?.[profile],\r\n };\r\n}\r\n\r\n/** Resolves the authored initial Spine presentation; `null` explicitly clears a base animation. */\r\nexport function resolveSpineSettings(node: SpineNode, profile: LayoutProfileId): ResolvedSpineSettings {\r\n const override = node.spineOverrides?.[profile];\r\n return {\r\n animation: override?.animation === null ? undefined : override?.animation ?? node.animation,\r\n autoplay: override?.autoplay ?? node.autoplay ?? true,\r\n loop: override?.loop ?? node.loop ?? true,\r\n animationSpeed: override?.animationSpeed ?? node.animationSpeed ?? 1,\r\n };\r\n}\r\n\r\n/**\r\n * Resolves a Unity-style RectTransform in logical Canvas units.\r\n *\r\n * `x/y` are anchoredPosition (the pivot offset from the anchor reference), while `width/height`\r\n * are sizeDelta. A point anchor therefore keeps an absolute logical size; a split anchor adds its\r\n * share of the parent rectangle. Canvas Scaler is deliberately outside this function.\r\n */\r\nexport function resolveAnchoredTransform(transform: UINode[\"transform\"], parentSize?: LayoutSize): UINode[\"transform\"] {\r\n if (parentSize === undefined) return transform;\r\n const minX = transform.anchorMinX ?? 0;\r\n const minY = transform.anchorMinY ?? 0;\r\n const maxX = transform.anchorMaxX ?? minX;\r\n const maxY = transform.anchorMaxY ?? minY;\r\n const pivotX = transform.pivotX ?? 0;\r\n const pivotY = transform.pivotY ?? 0;\r\n return {\r\n ...transform,\r\n x: (minX + (maxX - minX) * pivotX) * parentSize.width + transform.x,\r\n y: (minY + (maxY - minY) * pivotY) * parentSize.height + transform.y,\r\n width: (maxX - minX) * parentSize.width + transform.width,\r\n height: (maxY - minY) * parentSize.height + transform.height,\r\n };\r\n}\r\n\r\n/** Picks the layout profile for a viewport using the document's aspect-ratio rule; the breakpoint itself is mobile. */\r\nexport function resolveProfileForViewport(settings: ProjectDocument[\"settings\"], width: number, height: number): LayoutProfileId {\r\n return width / height <= settings.layoutProfileSelection.mobileMaxAspectRatio ? \"mobile\" : \"desktop\";\r\n}\r\n\r\nexport function fitSpineToTransform(\r\n bounds: { x: number; y: number; width: number; height: number },\r\n transform: UINode[\"transform\"],\r\n referenceFrame?: SpineReferenceFrame,\r\n): { scaleX: number; scaleY: number; x: number; y: number } | undefined {\r\n const fitBounds = referenceFrame ?? bounds;\r\n if (!Number.isFinite(fitBounds.x) || !Number.isFinite(fitBounds.y) || !Number.isFinite(fitBounds.width) || !Number.isFinite(fitBounds.height) || fitBounds.width <= 0 || fitBounds.height <= 0) return undefined;\r\n if (referenceFrame !== undefined) {\r\n const scale = Math.min(transform.width / referenceFrame.width, transform.height / referenceFrame.height);\r\n return Number.isFinite(scale) && scale > 0\r\n ? {\r\n scaleX: scale,\r\n scaleY: scale,\r\n x: (transform.width - referenceFrame.width * scale) / 2 - referenceFrame.x * scale,\r\n y: (transform.height - referenceFrame.height * scale) / 2 - referenceFrame.y * scale,\r\n }\r\n : undefined;\r\n }\r\n const scaleX = transform.width / bounds.width;\r\n const scaleY = transform.height / bounds.height;\r\n return Number.isFinite(scaleX) && scaleX > 0 && Number.isFinite(scaleY) && scaleY > 0\r\n ? { scaleX, scaleY, x: -bounds.x * scaleX, y: -bounds.y * scaleY }\r\n : undefined;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS;IAC7F,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;CAC1F,CAAC;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,CAAC;AAEvD,wGAAwG;AACxG,MAAM,UAAU,iBAAiB,CAAC,QAAoB,EAAE,IAAgB;IACtE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,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AAE,CAAC,SAAS,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,GAAG,KAAK;aACrF;YACH,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC9C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;QACnF,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE;QAClE,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC","sourcesContent":["import { type BitmapTextNode, type BitmapTextStyle, type LayoutProfileId, type ProjectDocument, type SpineReferenceFrame, type TextNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\n\r\nexport type ResolvedProfileTransform = {\r\n transform: UINode[\"transform\"];\r\n visible: boolean;\r\n};\r\n\r\nexport type LayoutSize = { width: number; height: number };\n\nexport type FittedViewport = {\n scale: number;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\r\ntype SpineNode = Extract<UINode, { type: \"spine\" }>;\r\nexport type ResolvedSpineSettings = { animation: string | undefined; autoplay: boolean; loop: boolean; animationSpeed: number };\r\n\r\nexport const DEFAULT_TEXT_STYLE: TextStyleDefinition = {\r\n fontFamily: \"Arial\", fontSize: 24, fontWeight: \"normal\", fontStyle: \"normal\", fill: \"#FFFFFF\",\r\n align: \"left\", verticalAlign: \"top\", wordWrap: false, breakWords: false, letterSpacing: 0,\r\n};\r\n\r\nexport const CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT = 0.5;\n\n/** Uniformly contains an authored viewport inside a physical host without changing its aspect ratio. */\nexport function fitViewportToHost(viewport: LayoutSize, host: LayoutSize): FittedViewport {\n const scale = Math.min(host.width / viewport.width, host.height / viewport.height);\n const width = viewport.width * scale;\n const height = viewport.height * scale;\n return {\n scale,\n x: (host.width - width) / 2,\n y: (host.height - height) / 2,\n width,\n height,\n };\n}\n\r\n/**\r\n * Unity Canvas Scaler's `Scale With Screen Size / Match Width Or Height` calculation.\r\n * Width and height are blended in logarithmic space, producing one uniform scale for the Canvas.\r\n */\r\nexport function getCanvasScale(\r\n screenSize: LayoutSize,\r\n referenceResolution: LayoutSize,\r\n matchWidthOrHeight = CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT,\r\n): number {\r\n const widthScale = screenSize.width / referenceResolution.width;\r\n const heightScale = screenSize.height / referenceResolution.height;\r\n const logWidth = Math.log2(widthScale);\r\n const logHeight = Math.log2(heightScale);\r\n return 2 ** (logWidth + (logHeight - logWidth) * matchWidthOrHeight);\r\n}\r\n\r\n/** Logical RectTransform space exposed by a scaled Canvas at the current screen aspect ratio. */\r\nexport function getCanvasLogicalSize(screenSize: LayoutSize, referenceResolution: LayoutSize): LayoutSize {\r\n const scale = getCanvasScale(screenSize, referenceResolution);\r\n return { width: screenSize.width / scale, height: screenSize.height / scale };\r\n}\r\n\r\n/** Resolves a node's base transform with a profile override applied field by field. */\r\nexport function resolveProfileTransform(node: UINode, profile: LayoutProfileId): ResolvedProfileTransform {\r\n const override = node.layoutOverrides?.[profile];\r\n\r\n return {\r\n transform: { ...node.transform, ...override?.transform },\r\n visible: override?.visible ?? node.visible,\r\n };\r\n}\r\n\r\n/** Resolves a text node's optional base style with the active profile's sparse style override. */\r\nexport function resolveTextStyle(node: TextNode, profile: LayoutProfileId): TextStyleDefinition | undefined {\n const override = node.textStyleOverrides?.[profile];\r\n if (node.style === undefined && override === undefined) return undefined;\r\n return { ...DEFAULT_TEXT_STYLE, ...node.style, ...override };\r\n}\n\n/** Resolves bitmap text's base visual presentation with the active sparse profile override. */\nexport function resolveBitmapTextStyle(node: BitmapTextNode, profile: LayoutProfileId): BitmapTextStyle {\n return {\n assetId: node.assetId,\n fontSize: node.fontSize,\n fill: node.fill,\n align: node.align,\n verticalAlign: node.verticalAlign,\n letterSpacing: node.letterSpacing,\n wordWrap: node.wordWrap,\n ...node.bitmapTextOverrides?.[profile],\n };\n}\n\r\n/** Resolves the authored initial Spine presentation; `null` explicitly clears a base animation. */\r\nexport function resolveSpineSettings(node: SpineNode, profile: LayoutProfileId): ResolvedSpineSettings {\r\n const override = node.spineOverrides?.[profile];\r\n return {\r\n animation: override?.animation === null ? undefined : override?.animation ?? node.animation,\r\n autoplay: override?.autoplay ?? node.autoplay ?? true,\r\n loop: override?.loop ?? node.loop ?? true,\r\n animationSpeed: override?.animationSpeed ?? node.animationSpeed ?? 1,\r\n };\r\n}\r\n\r\n/**\r\n * Resolves a Unity-style RectTransform in logical Canvas units.\r\n *\r\n * `x/y` are anchoredPosition (the pivot offset from the anchor reference), while `width/height`\r\n * are sizeDelta. A point anchor therefore keeps an absolute logical size; a split anchor adds its\r\n * share of the parent rectangle. Canvas Scaler is deliberately outside this function.\r\n */\r\nexport function resolveAnchoredTransform(transform: UINode[\"transform\"], parentSize?: LayoutSize): UINode[\"transform\"] {\r\n if (parentSize === undefined) return transform;\r\n const minX = transform.anchorMinX ?? 0;\r\n const minY = transform.anchorMinY ?? 0;\r\n const maxX = transform.anchorMaxX ?? minX;\r\n const maxY = transform.anchorMaxY ?? minY;\r\n const pivotX = transform.pivotX ?? 0;\r\n const pivotY = transform.pivotY ?? 0;\r\n return {\r\n ...transform,\r\n x: (minX + (maxX - minX) * pivotX) * parentSize.width + transform.x,\r\n y: (minY + (maxY - minY) * pivotY) * parentSize.height + transform.y,\r\n width: (maxX - minX) * parentSize.width + transform.width,\r\n height: (maxY - minY) * parentSize.height + transform.height,\r\n };\r\n}\r\n\r\n/** Picks the layout profile for a viewport using the document's aspect-ratio rule; the breakpoint itself is mobile. */\r\nexport function resolveProfileForViewport(settings: ProjectDocument[\"settings\"], width: number, height: number): LayoutProfileId {\r\n return width / height <= settings.layoutProfileSelection.mobileMaxAspectRatio ? \"mobile\" : \"desktop\";\r\n}\r\n\r\nexport function fitSpineToTransform(\r\n bounds: { x: number; y: number; width: number; height: number },\r\n transform: UINode[\"transform\"],\r\n referenceFrame?: SpineReferenceFrame,\r\n): { scaleX: number; scaleY: number; x: number; y: number } | undefined {\r\n const fitBounds = referenceFrame ?? bounds;\r\n if (!Number.isFinite(fitBounds.x) || !Number.isFinite(fitBounds.y) || !Number.isFinite(fitBounds.width) || !Number.isFinite(fitBounds.height) || fitBounds.width <= 0 || fitBounds.height <= 0) return undefined;\r\n if (referenceFrame !== undefined) {\r\n const scale = Math.min(transform.width / referenceFrame.width, transform.height / referenceFrame.height);\r\n return Number.isFinite(scale) && scale > 0\r\n ? {\r\n scaleX: scale,\r\n scaleY: scale,\r\n x: (transform.width - referenceFrame.width * scale) / 2 - referenceFrame.x * scale,\r\n y: (transform.height - referenceFrame.height * scale) / 2 - referenceFrame.y * scale,\r\n }\r\n : undefined;\r\n }\r\n const scaleX = transform.width / bounds.width;\r\n const scaleY = transform.height / bounds.height;\r\n return Number.isFinite(scaleX) && scaleX > 0 && Number.isFinite(scaleY) && scaleY > 0\r\n ? { scaleX, scaleY, x: -bounds.x * scaleX, y: -bounds.y * scaleY }\r\n : undefined;\r\n}\r\n"]}
|
package/dist/particles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particles.js","sourceRoot":"","sources":["../src/particles.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAEjC,gFAAgF;AAChF,MAAM,OAAO,YAAY;IACf,KAAK,CAAS;IACtB,YAAY,IAAY,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,KA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AC;QACnC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF","sourcesContent":["import type { ParticleEffectDefinition } from \"@pixi-ui-editor/schema\";\r\n\r\nconst DEG_TO_RAD = Math.PI / 180;\r\n\r\n/** Deterministic xorshift32 generator; it has no DOM/Pixi/ticker dependency. */\r\nexport class SeededRandom {\r\n private state: number;\r\n constructor(seed: number) { this.state = seed === 0 ? 0x9e3779b9 : seed >>> 0; }\r\n next(): number { this.state ^= this.state << 13; this.state ^= this.state >>> 17; this.state ^= this.state << 5; return (this.state >>> 0) / 0x1_0000_0000; }\r\n range(min: number, max: number): number { return min + (max - min) * this.next(); }\r\n /** A uniform index in `[0, length)`; used to pick a random asset/frame. */\r\n index(length: number): number { return Math.min(length - 1, Math.floor(this.next() * length)); }\r\n}\r\n\r\nexport function lerp(a: number, b: number, t: number): number { return a + (b - a) * t; }\r\n\r\nfunction hexChannel(hex: string, offset: number): number { return parseInt(hex.slice(offset, offset + 2), 16); }\r\n/** Lerps two `#RRGGBB[AA]` strings channel-by-channel; a trailing alpha byte, if any, is ignored. */\r\nexport function lerpColorHex(start: string, end: string, t: number): string {\r\n const channel = (offset: number) => Math.round(lerp(hexChannel(start, offset), hexChannel(end, offset), t)).toString(16).padStart(2, \"0\");\r\n return `#${channel(1)}${channel(3)}${channel(5)}`;\r\n}\r\n\r\nexport type ParticleSpawnShape = \"point\" | \"rectangle\" | \"circle\";\r\n\r\n/** `point` returns the rect centre; `rectangle` is uniform over the area; `circle` is uniform over the ellipse inscribed in the rect. */\r\nexport function sampleSpawnPoint(shape: ParticleSpawnShape, width: number, height: number, random: SeededRandom): { x: number; y: number } {\r\n const cx = width / 2, cy = height / 2;\r\n if (shape === \"point\") return { x: cx, y: cy };\r\n if (shape === \"rectangle\") return { x: random.next() * width, y: random.next() * height };\r\n const angle = random.next() * Math.PI * 2;\r\n const radius = Math.sqrt(random.next());\r\n return { x: cx + Math.cos(angle) * radius * cx, y: cy + Math.sin(angle) * radius * cy };\r\n}\r\n\r\n/** A prewarmed pool entry: `render` is an opaque adapter-owned renderer object created by the same factory as the simulation slot. */\r\nexport type ParticleSlot<TRender> = {\r\n render: TRender;\r\n /** Adapter-owned static attributes must be uploaded once after this slot is (re)spawned. */\r\n renderDirty: boolean;\r\n age: number;\r\n lifetime: number;\r\n x: number;\r\n y: number;\r\n vx: number;\r\n vy: number;\r\n /** Spawn-local position; used to derive the physics delta for world-space reprojection. */\r\n spawnX: number;\r\n spawnY: number;\r\n rotationDegrees: number;\r\n angularVelocityDegrees: number;\r\n scaleStart: number;\r\n scaleEnd: number;\r\n /** Index into `random`/`sequence` source `assetIds`, picked once at spawn. */\r\n sourceIndex: number;\r\n /** Starting frame offset for a `sequence` source with `randomStartFrame`. */\r\n sequenceStart: number;\r\n /** World-space spawn position and the linear (rotate+scale) part of the emitter's world transform at spawn time; only meaningful for `world` space particles. */\r\n worldSpawnX: number;\r\n worldSpawnY: number;\r\n spawnMatrixA: number;\r\n spawnMatrixB: number;\r\n spawnMatrixC: number;\r\n spawnMatrixD: number;\r\n};\r\n\r\nfunction createZeroedSlot<TRender>(render: TRender): ParticleSlot<TRender> {\r\n return { render, renderDirty: false, age: 0, lifetime: 0, x: 0, y: 0, vx: 0, vy: 0, spawnX: 0, spawnY: 0, rotationDegrees: 0, angularVelocityDegrees: 0, scaleStart: 1, scaleEnd: 1, sourceIndex: 0, sequenceStart: 0, worldSpawnX: 0, worldSpawnY: 0, spawnMatrixA: 1, spawnMatrixB: 0, spawnMatrixC: 0, spawnMatrixD: 1 };\r\n}\r\nfunction resetSlot<TRender>(slot: ParticleSlot<TRender>): void {\r\n // Hot release path: reset in place instead of allocating a temporary zeroed slot for Object.assign.\r\n slot.renderDirty = false; slot.age = 0; slot.lifetime = 0; slot.x = 0; slot.y = 0; slot.vx = 0; slot.vy = 0;\r\n slot.spawnX = 0; slot.spawnY = 0; slot.rotationDegrees = 0; slot.angularVelocityDegrees = 0;\r\n slot.scaleStart = 1; slot.scaleEnd = 1; slot.sourceIndex = 0; slot.sequenceStart = 0;\r\n slot.worldSpawnX = 0; slot.worldSpawnY = 0;\r\n slot.spawnMatrixA = 1; slot.spawnMatrixB = 0; slot.spawnMatrixC = 0; slot.spawnMatrixD = 1;\r\n}\r\n\r\n/**\r\n * Prewarmed object pool. `acquire`/`release` never call the factory; only `resize` does, and only for\r\n * the capacity delta. Shrinking removes idle free slots immediately; active slots beyond the new\r\n * capacity keep running and are permanently destroyed (via `onRemove`, never recycled) the next time\r\n * they are released instead of returning to the free list.\r\n */\r\nexport class ParticlePool<T> {\r\n private readonly free: T[] = [];\r\n private readonly active = new Set<T>();\r\n private capacity: number;\r\n public dropped = 0;\r\n constructor(private readonly factory: () => T, capacity: number, private readonly onRemove?: (value: T) => void) {\r\n this.capacity = capacity;\r\n for (let i = 0; i < capacity; i++) this.free.push(factory());\r\n }\r\n acquire(): T | undefined {\r\n const value = this.free.pop();\r\n if (value === undefined) { this.dropped++; return undefined; }\r\n this.active.add(value);\r\n return value;\r\n }\r\n release(value: T): void {\r\n if (!this.active.has(value)) return;\r\n const overCapacity = this.free.length + this.active.size > this.capacity;\r\n this.active.delete(value);\r\n if (overCapacity) this.onRemove?.(value);\r\n else this.free.push(value);\r\n }\r\n resize(capacity: number): void {\r\n if (capacity > this.capacity) {\r\n const total = this.free.length + this.active.size;\r\n for (let i = total; i < capacity; i++) this.free.push(this.factory());\r\n } else if (capacity < this.capacity) {\r\n while (this.free.length + this.active.size > capacity && this.free.length > 0) this.onRemove?.(this.free.pop()!);\r\n }\r\n this.capacity = capacity;\r\n }\r\n /** Permanently destroys every slot, free and active alike; used by `dispose()`. */\r\n clear(): void {\r\n for (const value of this.free.splice(0, this.free.length)) this.onRemove?.(value);\r\n for (const value of this.active) this.onRemove?.(value);\r\n this.active.clear();\r\n this.capacity = 0;\r\n }\r\n get values(): ReadonlySet<T> { return this.active; }\r\n get limit(): number { return this.capacity; }\r\n}\r\n\r\nexport type ParticleSpawnContext = { width: number; height: number; space: \"local\" | \"world\" };\r\nexport type ParticleDiagnostics = { active: number; dropped: number; playing: boolean; stopped: boolean; disposed: boolean };\r\n\r\n/** Adapter-supplied, renderer-specific operations. The simulator never imports Pixi. */\r\nexport type ParticleRenderHooks<TRender> = {\r\n createRender(): TRender;\r\n hideRender(render: TRender): void;\r\n destroyRender(render: TRender): void;\r\n /** The emitter's current world transform linear part `{a,b,c,d}` and translation `{tx,ty}`; read only when a `world`-space particle spawns. */\r\n getWorldTransform(): { a: number; b: number; c: number; d: number; tx: number; ty: number };\r\n};\r\n\r\n/**\r\n * Schema-neutral, deterministic particle simulation over a prewarmed pool. Owns lifecycle\r\n * (`play`/`pause`/`step`/`restart`/`stop`/`dispose`), fixed-step ticking, seeded spawn parameters and\r\n * burst/rate scheduling. Rendering (texture, tint, local/world projection) is the adapter's job; this\r\n * class only exposes the pool's active slots and the effect definition for it to read.\r\n */\r\nexport class ParticleSimulator<TRender> {\r\n static readonly stepSeconds = 1 / 60;\r\n private readonly pool: ParticlePool<ParticleSlot<TRender>>;\r\n private random: SeededRandom;\r\n private elapsed = 0;\r\n private stepAccumulator = 0;\r\n private emissionAccumulator = 0;\r\n private burstCursors: number[];\r\n private multiplier = 1;\r\n private emitting = false;\r\n private simulating = false;\r\n private stopped = false;\r\n private disposed = false;\r\n private context: ParticleSpawnContext = { width: 0, height: 0, space: \"local\" };\r\n\r\n constructor(public definition: ParticleEffectDefinition, private readonly hooks: ParticleRenderHooks<TRender>) {\r\n this.random = new SeededRandom(definition.seed);\r\n this.burstCursors = definition.emission.bursts.map(() => 0);\r\n this.pool = new ParticlePool<ParticleSlot<TRender>>(\r\n () => createZeroedSlot(hooks.createRender()),\r\n definition.maxParticles,\r\n (slot) => hooks.destroyRender(slot.render),\r\n );\r\n }\r\n\r\n get activeSlots(): ReadonlySet<ParticleSlot<TRender>> { return this.pool.values; }\r\n\r\n setEmissionMultiplier(value: number): void {\r\n if (!Number.isFinite(value) || value < 0) throw new RangeError(\"Emission multiplier must be finite and non-negative.\");\r\n this.multiplier = value;\r\n }\r\n\r\n /** Adopts a new definition reference without ever comparing identity: unrelated edits, seed changes and texture changes never reset accumulator, PRNG or live particles. Only `maxParticles` triggers a pool resize. */\r\n syncEffect(effect: ParticleEffectDefinition): void {\r\n this.definition = effect;\r\n if (this.pool.limit !== effect.maxParticles) this.pool.resize(effect.maxParticles);\r\n const cursors = effect.emission.bursts.map((_, index) => this.burstCursors[index] ?? 0);\r\n this.burstCursors = cursors;\r\n }\r\n\r\n play(): void { if (this.disposed) return; this.emitting = true; this.simulating = true; this.stopped = false; }\r\n /** Freezes emission and every live particle without resetting time or PRNG. */\r\n pause(): void { if (this.disposed) return; this.emitting = false; this.simulating = false; this.stopped = false; }\r\n /** Stops new spawns; already-emitted particles keep simulating to their natural death. */\r\n stop(): void {\r\n if (this.disposed) return;\r\n this.emitting = false;\r\n this.simulating = this.pool.values.size > 0;\r\n this.stopped = true;\r\n }\r\n\r\n restart(): void {\r\n if (this.disposed) return;\r\n for (const slot of [...this.pool.values]) this.releaseSlot(slot);\r\n this.elapsed = 0;\r\n this.stepAccumulator = 0;\r\n this.emissionAccumulator = 0;\r\n this.burstCursors = this.definition.emission.bursts.map(() => 0);\r\n this.pool.dropped = 0;\r\n this.random = new SeededRandom(this.definition.seed);\r\n this.emitting = true;\r\n this.simulating = true;\r\n this.stopped = false;\r\n }\r\n\r\n /** Idempotent terminal cleanup: destroys every pooled render object and excludes the view from further updates. */\r\n dispose(): void {\r\n if (this.disposed) return;\r\n this.disposed = true;\r\n this.emitting = false;\r\n this.simulating = false;\r\n this.stopped = false;\r\n this.pool.clear();\r\n }\r\n\r\n /** Advances exactly one fixed step regardless of paused/stopped state, and never changes it. */\r\n step(context: ParticleSpawnContext): boolean {\r\n if (this.disposed) return false;\r\n this.context = context;\r\n this.tick(ParticleSimulator.stepSeconds);\r\n return true;\r\n }\r\n\r\n update(deltaSeconds: number, context: ParticleSpawnContext): boolean {\r\n if (this.disposed || !this.simulating) return false;\r\n this.context = context;\r\n this.stepAccumulator = Math.min(this.stepAccumulator + Math.max(0, deltaSeconds), ParticleSimulator.stepSeconds * 8);\r\n let advanced = false;\r\n while (this.stepAccumulator >= ParticleSimulator.stepSeconds) {\r\n this.stepAccumulator -= ParticleSimulator.stepSeconds;\r\n this.tick(ParticleSimulator.stepSeconds);\r\n advanced = true;\r\n }\r\n return advanced;\r\n }\r\n\r\n getDiagnostics(): ParticleDiagnostics {\r\n return { active: this.pool.values.size, dropped: this.pool.dropped, playing: this.emitting, stopped: this.stopped && !this.disposed, disposed: this.disposed };\r\n }\r\n\r\n private tick(dt: number): void {\r\n // Age and move existing particles before spawning: a particle created this tick starts at age 0\r\n // and receives its first dt on the next tick, instead of being silently pre-aged by one step.\r\n const movement = this.definition.particle.movement;\r\n const drag = Math.max(0, 1 - movement.drag * dt);\r\n for (const slot of this.pool.values) {\r\n slot.age += dt;\r\n if (slot.age >= slot.lifetime) { this.releaseSlot(slot); continue; }\r\n slot.vx = (slot.vx + movement.accelerationX * dt) * drag;\r\n slot.vy = (slot.vy + movement.accelerationY * dt) * drag;\r\n slot.x += slot.vx * dt;\r\n slot.y += slot.vy * dt;\r\n slot.rotationDegrees += slot.angularVelocityDegrees * dt;\r\n }\r\n\r\n const e = this.definition.emission;\r\n const cycle = e.duration + e.delay;\r\n this.elapsed += dt;\r\n if (this.emitting) {\r\n const cycleElapsed = e.loop ? this.elapsed % cycle : this.elapsed;\r\n const inWindow = cycleElapsed >= e.delay && cycleElapsed <= e.delay + e.duration;\r\n if (inWindow && e.rate > 0) {\r\n this.emissionAccumulator += e.rate * this.multiplier * dt;\r\n while (this.emissionAccumulator >= 1) { this.emissionAccumulator -= 1; this.spawnParticle(); }\r\n }\r\n for (let index = 0; index < e.bursts.length; index++) {\r\n const burst = e.bursts[index]!;\r\n const triggerBase = e.delay + burst.time;\r\n for (;;) {\r\n const cursor = this.burstCursors[index] ?? 0;\r\n if (!e.loop && cursor >= 1) break;\r\n const triggerAt = e.loop ? cursor * cycle + triggerBase : triggerBase;\r\n if (this.elapsed < triggerAt) break;\r\n for (let i = 0; i < burst.count; i++) this.spawnParticle();\r\n this.burstCursors[index] = cursor + 1;\r\n }\r\n }\r\n if (!e.loop && this.elapsed >= e.delay + e.duration) {\r\n this.emitting = false;\r\n this.stopped = true;\r\n }\r\n }\r\n // A completed one-shot or a graceful stop must not keep an otherwise idle emitter on the hot\r\n // ticker path forever. Preserve the stopped diagnostic while putting simulation fully to sleep.\r\n if (!this.emitting && this.pool.values.size === 0) this.simulating = false;\r\n }\r\n\r\n private spawnParticle(): void {\r\n const slot = this.pool.acquire();\r\n if (!slot) return;\r\n const p = this.definition.particle;\r\n const rand = this.random;\r\n const point = sampleSpawnPoint(p.spawnShape.type, this.context.width, this.context.height, rand);\r\n slot.renderDirty = true;\r\n slot.age = 0;\r\n slot.lifetime = rand.range(p.lifetime.min, p.lifetime.max);\r\n slot.spawnX = point.x;\r\n slot.spawnY = point.y;\r\n slot.x = point.x;\r\n slot.y = point.y;\r\n const speed = rand.range(p.movement.speed.min, p.movement.speed.max);\r\n const angle = (p.movement.directionDegrees + (rand.next() - 0.5) * p.movement.spreadDegrees) * DEG_TO_RAD;\r\n slot.vx = Math.cos(angle) * speed;\r\n slot.vy = Math.sin(angle) * speed;\r\n slot.rotationDegrees = rand.range(p.visual.rotation.initialDegrees.min, p.visual.rotation.initialDegrees.max);\r\n slot.angularVelocityDegrees = rand.range(p.visual.rotation.angularVelocityDegrees.min, p.visual.rotation.angularVelocityDegrees.max);\r\n slot.scaleStart = rand.range(p.visual.scale.start.min, p.visual.scale.start.max);\r\n slot.scaleEnd = rand.range(p.visual.scale.end.min, p.visual.scale.end.max);\r\n const source = p.visual.source;\r\n slot.sourceIndex = source.type === \"single\" ? 0 : rand.index(source.assetIds.length);\r\n slot.sequenceStart = source.type === \"sequence\" && source.randomStartFrame ? rand.index(source.assetIds.length) : 0;\r\n if (this.context.space === \"world\") {\r\n const m = this.hooks.getWorldTransform();\r\n slot.worldSpawnX = m.a * point.x + m.c * point.y + m.tx;\r\n slot.worldSpawnY = m.b * point.x + m.d * point.y + m.ty;\r\n slot.spawnMatrixA = m.a;\r\n slot.spawnMatrixB = m.b;\r\n slot.spawnMatrixC = m.c;\r\n slot.spawnMatrixD = m.d;\r\n }\r\n }\r\n\r\n private releaseSlot(slot: ParticleSlot<TRender>): void {\r\n resetSlot(slot);\r\n this.hooks.hideRender(slot.render);\r\n this.pool.release(slot);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"particles.js","sourceRoot":"","sources":["../src/particles.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAEjC,gFAAgF;AAChF,MAAM,OAAO,YAAY;IACf,KAAK,CAAS;IACtB,YAAY,IAAY,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IAChF,IAAI,KAAa,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IAC7J,KAAK,CAAC,GAAW,EAAE,GAAW,IAAY,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACnF,2EAA2E;IAC3E,KAAK,CAAC,MAAc,IAAY,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EA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,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YACxD,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YACxD,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAEO,WAAW,CAAC,IAA2B;QAC7C,SAAS,CAAC,IAAI,CAAC,CAAC;QAChB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF","sourcesContent":["import type { ParticleEffectDefinition } from \"@pixi-ui-editor/schema\";\r\n\r\nconst DEG_TO_RAD = Math.PI / 180;\r\n\r\n/** Deterministic xorshift32 generator; it has no DOM/Pixi/ticker dependency. */\r\nexport class SeededRandom {\r\n private state: number;\r\n constructor(seed: number) { this.state = seed === 0 ? 0x9e3779b9 : seed >>> 0; }\r\n next(): number { this.state ^= this.state << 13; this.state ^= this.state >>> 17; this.state ^= this.state << 5; return (this.state >>> 0) / 0x1_0000_0000; }\r\n range(min: number, max: number): number { return min + (max - min) * this.next(); }\r\n /** A uniform index in `[0, length)`; used to pick a random asset/frame. */\r\n index(length: number): number { return Math.min(length - 1, Math.floor(this.next() * length)); }\r\n}\r\n\r\nexport function lerp(a: number, b: number, t: number): number { return a + (b - a) * t; }\r\n\r\nfunction hexChannel(hex: string, offset: number): number { return parseInt(hex.slice(offset, offset + 2), 16); }\r\n/** Lerps two `#RRGGBB[AA]` strings channel-by-channel; a trailing alpha byte, if any, is ignored. */\r\nexport function lerpColorHex(start: string, end: string, t: number): string {\r\n const channel = (offset: number) => Math.round(lerp(hexChannel(start, offset), hexChannel(end, offset), t)).toString(16).padStart(2, \"0\");\r\n return `#${channel(1)}${channel(3)}${channel(5)}`;\r\n}\r\n\r\nexport type ParticleSpawnShape = \"point\" | \"rectangle\" | \"circle\";\r\n\r\n/** `point` returns the rect centre; `rectangle` is uniform over the area; `circle` is uniform over the ellipse inscribed in the rect. */\r\nexport function sampleSpawnPoint(shape: ParticleSpawnShape, width: number, height: number, random: SeededRandom): { x: number; y: number } {\r\n const cx = width / 2, cy = height / 2;\r\n if (shape === \"point\") return { x: cx, y: cy };\r\n if (shape === \"rectangle\") return { x: random.next() * width, y: random.next() * height };\r\n const angle = random.next() * Math.PI * 2;\r\n const radius = Math.sqrt(random.next());\r\n return { x: cx + Math.cos(angle) * radius * cx, y: cy + Math.sin(angle) * radius * cy };\r\n}\r\n\r\n/** A prewarmed pool entry: `render` is an opaque adapter-owned renderer object created by the same factory as the simulation slot. */\r\nexport type ParticleSlot<TRender> = {\n render: TRender;\n /** Adapter-owned static attributes must be uploaded once after this slot is (re)spawned. */\n renderDirty: boolean;\n age: number;\r\n lifetime: number;\r\n x: number;\r\n y: number;\r\n vx: number;\r\n vy: number;\r\n /** Spawn-local position; used to derive the physics delta for world-space reprojection. */\r\n spawnX: number;\r\n spawnY: number;\r\n rotationDegrees: number;\r\n angularVelocityDegrees: number;\r\n scaleStart: number;\r\n scaleEnd: number;\r\n /** Index into `random`/`sequence` source `assetIds`, picked once at spawn. */\r\n sourceIndex: number;\r\n /** Starting frame offset for a `sequence` source with `randomStartFrame`. */\r\n sequenceStart: number;\r\n /** World-space spawn position and the linear (rotate+scale) part of the emitter's world transform at spawn time; only meaningful for `world` space particles. */\r\n worldSpawnX: number;\r\n worldSpawnY: number;\r\n spawnMatrixA: number;\r\n spawnMatrixB: number;\r\n spawnMatrixC: number;\r\n spawnMatrixD: number;\r\n};\r\n\r\nfunction createZeroedSlot<TRender>(render: TRender): ParticleSlot<TRender> {\n return { render, renderDirty: false, age: 0, lifetime: 0, x: 0, y: 0, vx: 0, vy: 0, spawnX: 0, spawnY: 0, rotationDegrees: 0, angularVelocityDegrees: 0, scaleStart: 1, scaleEnd: 1, sourceIndex: 0, sequenceStart: 0, worldSpawnX: 0, worldSpawnY: 0, spawnMatrixA: 1, spawnMatrixB: 0, spawnMatrixC: 0, spawnMatrixD: 1 };\n}\nfunction resetSlot<TRender>(slot: ParticleSlot<TRender>): void {\n // Hot release path: reset in place instead of allocating a temporary zeroed slot for Object.assign.\n slot.renderDirty = false; slot.age = 0; slot.lifetime = 0; slot.x = 0; slot.y = 0; slot.vx = 0; slot.vy = 0;\n slot.spawnX = 0; slot.spawnY = 0; slot.rotationDegrees = 0; slot.angularVelocityDegrees = 0;\n slot.scaleStart = 1; slot.scaleEnd = 1; slot.sourceIndex = 0; slot.sequenceStart = 0;\n slot.worldSpawnX = 0; slot.worldSpawnY = 0;\n slot.spawnMatrixA = 1; slot.spawnMatrixB = 0; slot.spawnMatrixC = 0; slot.spawnMatrixD = 1;\n}\n\r\n/**\r\n * Prewarmed object pool. `acquire`/`release` never call the factory; only `resize` does, and only for\r\n * the capacity delta. Shrinking removes idle free slots immediately; active slots beyond the new\r\n * capacity keep running and are permanently destroyed (via `onRemove`, never recycled) the next time\r\n * they are released instead of returning to the free list.\r\n */\r\nexport class ParticlePool<T> {\r\n private readonly free: T[] = [];\r\n private readonly active = new Set<T>();\r\n private capacity: number;\r\n public dropped = 0;\r\n constructor(private readonly factory: () => T, capacity: number, private readonly onRemove?: (value: T) => void) {\r\n this.capacity = capacity;\r\n for (let i = 0; i < capacity; i++) this.free.push(factory());\r\n }\r\n acquire(): T | undefined {\r\n const value = this.free.pop();\r\n if (value === undefined) { this.dropped++; return undefined; }\r\n this.active.add(value);\r\n return value;\r\n }\r\n release(value: T): void {\r\n if (!this.active.has(value)) return;\r\n const overCapacity = this.free.length + this.active.size > this.capacity;\r\n this.active.delete(value);\r\n if (overCapacity) this.onRemove?.(value);\r\n else this.free.push(value);\r\n }\r\n resize(capacity: number): void {\r\n if (capacity > this.capacity) {\r\n const total = this.free.length + this.active.size;\r\n for (let i = total; i < capacity; i++) this.free.push(this.factory());\r\n } else if (capacity < this.capacity) {\r\n while (this.free.length + this.active.size > capacity && this.free.length > 0) this.onRemove?.(this.free.pop()!);\r\n }\r\n this.capacity = capacity;\r\n }\r\n /** Permanently destroys every slot, free and active alike; used by `dispose()`. */\r\n clear(): void {\r\n for (const value of this.free.splice(0, this.free.length)) this.onRemove?.(value);\r\n for (const value of this.active) this.onRemove?.(value);\r\n this.active.clear();\r\n this.capacity = 0;\r\n }\r\n get values(): ReadonlySet<T> { return this.active; }\r\n get limit(): number { return this.capacity; }\r\n}\r\n\r\nexport type ParticleSpawnContext = { width: number; height: number; space: \"local\" | \"world\" };\r\nexport type ParticleDiagnostics = { active: number; dropped: number; playing: boolean; stopped: boolean; disposed: boolean };\r\n\r\n/** Adapter-supplied, renderer-specific operations. The simulator never imports Pixi. */\r\nexport type ParticleRenderHooks<TRender> = {\n createRender(): TRender;\r\n hideRender(render: TRender): void;\r\n destroyRender(render: TRender): void;\r\n /** The emitter's current world transform linear part `{a,b,c,d}` and translation `{tx,ty}`; read only when a `world`-space particle spawns. */\r\n getWorldTransform(): { a: number; b: number; c: number; d: number; tx: number; ty: number };\r\n};\n\r\n/**\r\n * Schema-neutral, deterministic particle simulation over a prewarmed pool. Owns lifecycle\r\n * (`play`/`pause`/`step`/`restart`/`stop`/`dispose`), fixed-step ticking, seeded spawn parameters and\r\n * burst/rate scheduling. Rendering (texture, tint, local/world projection) is the adapter's job; this\r\n * class only exposes the pool's active slots and the effect definition for it to read.\r\n */\r\nexport class ParticleSimulator<TRender> {\n static readonly stepSeconds = 1 / 60;\r\n private readonly pool: ParticlePool<ParticleSlot<TRender>>;\r\n private random: SeededRandom;\r\n private elapsed = 0;\r\n private stepAccumulator = 0;\r\n private emissionAccumulator = 0;\r\n private burstCursors: number[];\r\n private multiplier = 1;\r\n private emitting = false;\n private simulating = false;\n private stopped = false;\n private disposed = false;\n private context: ParticleSpawnContext = { width: 0, height: 0, space: \"local\" };\r\n\r\n constructor(public definition: ParticleEffectDefinition, private readonly hooks: ParticleRenderHooks<TRender>) {\r\n this.random = new SeededRandom(definition.seed);\r\n this.burstCursors = definition.emission.bursts.map(() => 0);\r\n this.pool = new ParticlePool<ParticleSlot<TRender>>(\r\n () => createZeroedSlot(hooks.createRender()),\r\n definition.maxParticles,\r\n (slot) => hooks.destroyRender(slot.render),\r\n );\r\n }\r\n\r\n get activeSlots(): ReadonlySet<ParticleSlot<TRender>> { return this.pool.values; }\r\n\r\n setEmissionMultiplier(value: number): void {\r\n if (!Number.isFinite(value) || value < 0) throw new RangeError(\"Emission multiplier must be finite and non-negative.\");\r\n this.multiplier = value;\r\n }\r\n\r\n /** Adopts a new definition reference without ever comparing identity: unrelated edits, seed changes and texture changes never reset accumulator, PRNG or live particles. Only `maxParticles` triggers a pool resize. */\r\n syncEffect(effect: ParticleEffectDefinition): void {\r\n this.definition = effect;\r\n if (this.pool.limit !== effect.maxParticles) this.pool.resize(effect.maxParticles);\r\n const cursors = effect.emission.bursts.map((_, index) => this.burstCursors[index] ?? 0);\r\n this.burstCursors = cursors;\r\n }\r\n\r\n play(): void { if (this.disposed) return; this.emitting = true; this.simulating = true; this.stopped = false; }\n /** Freezes emission and every live particle without resetting time or PRNG. */\n pause(): void { if (this.disposed) return; this.emitting = false; this.simulating = false; this.stopped = false; }\n /** Stops new spawns; already-emitted particles keep simulating to their natural death. */\n stop(): void {\n if (this.disposed) return;\n this.emitting = false;\n this.simulating = this.pool.values.size > 0;\n this.stopped = true;\n }\n\r\n restart(): void {\r\n if (this.disposed) return;\r\n for (const slot of [...this.pool.values]) this.releaseSlot(slot);\r\n this.elapsed = 0;\r\n this.stepAccumulator = 0;\r\n this.emissionAccumulator = 0;\r\n this.burstCursors = this.definition.emission.bursts.map(() => 0);\n this.pool.dropped = 0;\n this.random = new SeededRandom(this.definition.seed);\n this.emitting = true;\n this.simulating = true;\n this.stopped = false;\n }\r\n\r\n /** Idempotent terminal cleanup: destroys every pooled render object and excludes the view from further updates. */\r\n dispose(): void {\r\n if (this.disposed) return;\r\n this.disposed = true;\n this.emitting = false;\n this.simulating = false;\n this.stopped = false;\n this.pool.clear();\r\n }\r\n\r\n /** Advances exactly one fixed step regardless of paused/stopped state, and never changes it. */\r\n step(context: ParticleSpawnContext): boolean {\n if (this.disposed) return false;\n this.context = context;\n this.tick(ParticleSimulator.stepSeconds);\n return true;\n }\n\n update(deltaSeconds: number, context: ParticleSpawnContext): boolean {\n if (this.disposed || !this.simulating) return false;\n this.context = context;\n this.stepAccumulator = Math.min(this.stepAccumulator + Math.max(0, deltaSeconds), ParticleSimulator.stepSeconds * 8);\n let advanced = false;\n while (this.stepAccumulator >= ParticleSimulator.stepSeconds) {\n this.stepAccumulator -= ParticleSimulator.stepSeconds;\n this.tick(ParticleSimulator.stepSeconds);\n advanced = true;\n }\n return advanced;\n }\n\n getDiagnostics(): ParticleDiagnostics {\n return { active: this.pool.values.size, dropped: this.pool.dropped, playing: this.emitting, stopped: this.stopped && !this.disposed, disposed: this.disposed };\n }\r\n\r\n private tick(dt: number): void {\r\n // Age and move existing particles before spawning: a particle created this tick starts at age 0\r\n // and receives its first dt on the next tick, instead of being silently pre-aged by one step.\r\n const movement = this.definition.particle.movement;\r\n const drag = Math.max(0, 1 - movement.drag * dt);\r\n for (const slot of this.pool.values) {\n slot.age += dt;\r\n if (slot.age >= slot.lifetime) { this.releaseSlot(slot); continue; }\r\n slot.vx = (slot.vx + movement.accelerationX * dt) * drag;\r\n slot.vy = (slot.vy + movement.accelerationY * dt) * drag;\r\n slot.x += slot.vx * dt;\r\n slot.y += slot.vy * dt;\r\n slot.rotationDegrees += slot.angularVelocityDegrees * dt;\r\n }\r\n\r\n const e = this.definition.emission;\r\n const cycle = e.duration + e.delay;\r\n this.elapsed += dt;\r\n if (this.emitting) {\r\n const cycleElapsed = e.loop ? this.elapsed % cycle : this.elapsed;\r\n const inWindow = cycleElapsed >= e.delay && cycleElapsed <= e.delay + e.duration;\r\n if (inWindow && e.rate > 0) {\r\n this.emissionAccumulator += e.rate * this.multiplier * dt;\r\n while (this.emissionAccumulator >= 1) { this.emissionAccumulator -= 1; this.spawnParticle(); }\r\n }\r\n for (let index = 0; index < e.bursts.length; index++) {\n const burst = e.bursts[index]!;\n const triggerBase = e.delay + burst.time;\n for (;;) {\r\n const cursor = this.burstCursors[index] ?? 0;\r\n if (!e.loop && cursor >= 1) break;\r\n const triggerAt = e.loop ? cursor * cycle + triggerBase : triggerBase;\r\n if (this.elapsed < triggerAt) break;\r\n for (let i = 0; i < burst.count; i++) this.spawnParticle();\r\n this.burstCursors[index] = cursor + 1;\n }\n }\n if (!e.loop && this.elapsed >= e.delay + e.duration) {\n this.emitting = false;\n this.stopped = true;\n }\n }\n // A completed one-shot or a graceful stop must not keep an otherwise idle emitter on the hot\n // ticker path forever. Preserve the stopped diagnostic while putting simulation fully to sleep.\n if (!this.emitting && this.pool.values.size === 0) this.simulating = false;\n }\r\n\r\n private spawnParticle(): void {\r\n const slot = this.pool.acquire();\r\n if (!slot) return;\r\n const p = this.definition.particle;\n const rand = this.random;\r\n const point = sampleSpawnPoint(p.spawnShape.type, this.context.width, this.context.height, rand);\n slot.renderDirty = true;\n slot.age = 0;\r\n slot.lifetime = rand.range(p.lifetime.min, p.lifetime.max);\r\n slot.spawnX = point.x;\r\n slot.spawnY = point.y;\r\n slot.x = point.x;\r\n slot.y = point.y;\r\n const speed = rand.range(p.movement.speed.min, p.movement.speed.max);\r\n const angle = (p.movement.directionDegrees + (rand.next() - 0.5) * p.movement.spreadDegrees) * DEG_TO_RAD;\r\n slot.vx = Math.cos(angle) * speed;\r\n slot.vy = Math.sin(angle) * speed;\r\n slot.rotationDegrees = rand.range(p.visual.rotation.initialDegrees.min, p.visual.rotation.initialDegrees.max);\r\n slot.angularVelocityDegrees = rand.range(p.visual.rotation.angularVelocityDegrees.min, p.visual.rotation.angularVelocityDegrees.max);\r\n slot.scaleStart = rand.range(p.visual.scale.start.min, p.visual.scale.start.max);\r\n slot.scaleEnd = rand.range(p.visual.scale.end.min, p.visual.scale.end.max);\r\n const source = p.visual.source;\r\n slot.sourceIndex = source.type === \"single\" ? 0 : rand.index(source.assetIds.length);\r\n slot.sequenceStart = source.type === \"sequence\" && source.randomStartFrame ? rand.index(source.assetIds.length) : 0;\r\n if (this.context.space === \"world\") {\r\n const m = this.hooks.getWorldTransform();\r\n slot.worldSpawnX = m.a * point.x + m.c * point.y + m.tx;\r\n slot.worldSpawnY = m.b * point.x + m.d * point.y + m.ty;\r\n slot.spawnMatrixA = m.a;\r\n slot.spawnMatrixB = m.b;\r\n slot.spawnMatrixC = m.c;\r\n slot.spawnMatrixD = m.d;\r\n }\r\n }\r\n\r\n private releaseSlot(slot: ParticleSlot<TRender>): void {\r\n resetSlot(slot);\r\n this.hooks.hideRender(slot.render);\r\n this.pool.release(slot);\r\n }\r\n}\r\n"]}
|
package/dist/scene.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { type LayoutSize } from "./layout.js";
|
|
|
7
7
|
import { type SceneInteractionMode } from "./views/NodeView.js";
|
|
8
8
|
import { SceneLocalization, type SceneLocalizationOptions } from "./localization.js";
|
|
9
9
|
import { SceneViewport } from "./SceneViewport.js";
|
|
10
|
-
import type
|
|
10
|
+
import { type AudioBus } from "./audio/bus.js";
|
|
11
11
|
export type BuildSceneViewOptions = {
|
|
12
12
|
/** Explicit: an editor canvas must pass "authoring", Preview and the consuming app "runtime". */
|
|
13
13
|
interaction: SceneInteractionMode;
|
|
@@ -15,7 +15,11 @@ export type BuildSceneViewOptions = {
|
|
|
15
15
|
spines?: ReadonlyMap<string, SkeletonData>;
|
|
16
16
|
fonts?: ReadonlyMap<string, string>;
|
|
17
17
|
bitmapFonts?: ReadonlyMap<string, string>;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Шина звуковых событий (обычно `createRuntimeAudio(...)`). Без неё сцена не публикует звуковые
|
|
20
|
+
* события вовсе — ровно так строится инертный authoring-канвас редактора.
|
|
21
|
+
*/
|
|
22
|
+
audio?: AudioBus;
|
|
19
23
|
/**
|
|
20
24
|
* The host's own Application ticker, driving self-updating content such as Spine skeletons.
|
|
21
25
|
* Without it they fall back to `Ticker.shared`, which runs a second rAF loop independent of the
|
package/dist/scene.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../src/scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAsG,KAAK,gBAAgB,EAA2B,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,KAAK,EAAE,KAAK,mBAAmB,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3R,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAA2F,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACvI,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAe1E,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../src/scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAsG,KA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E,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,qBAAqB,EAAE,aAAa,GAAE,uBAA4B,GAAG,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAG5N;AAED,wGAAwG;AACxG,wBAAsB,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE;IAAE,WAAW,EAAE,oBAAoB,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,wBAAwB,CAAC;IAAC,UAAU,CAAC,EAAE,eAAe,CAAA;CAAE,EAAE,aAAa,GAAE,uBAA4B,GAAG,OAAO,CAAC,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAGnX;AAED,yFAAyF;AACzF,wBAAsB,aAAa,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,eAAe,EACxB,cAAc,EAAE,eAAe,EAC/B,OAAO,EAAE;IAAE,WAAW,EAAE,oBAAoB,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,wBAAwB,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,eAAe,CAAA;CAAE,GAC/J,OAAO,CAAC,eAAe,CAAC,CAY1B"}
|
package/dist/scene.js
CHANGED
|
@@ -22,6 +22,7 @@ import { SpineNodeView } from "./views/SpineNodeView.js";
|
|
|
22
22
|
import { ParticleEmitterNodeView } from "./views/ParticleEmitterNodeView.js";
|
|
23
23
|
import { SceneLocalization } from "./localization.js";
|
|
24
24
|
import { SceneViewport } from "./SceneViewport.js";
|
|
25
|
+
import { createSceneAudio } from "./audio/bus.js";
|
|
25
26
|
const particleEmitterRegistry = new WeakMap();
|
|
26
27
|
function spineReferenceFrameFor(document, node) {
|
|
27
28
|
if (node.type !== "spine")
|
|
@@ -32,13 +33,15 @@ function spineReferenceFrameFor(document, node) {
|
|
|
32
33
|
/** Builds a PixiJS display tree for a scene without depending on DOM or editor state. */
|
|
33
34
|
export function buildSceneView(document, sceneId, profile, options) {
|
|
34
35
|
initializePixiLayout();
|
|
35
|
-
const { interaction, textures, spines, fonts, bitmapFonts,
|
|
36
|
+
const { interaction, textures, spines, fonts, bitmapFonts, ticker, onLayout } = options;
|
|
36
37
|
const scene = document.scenes.find((candidate) => candidate.id === sceneId);
|
|
37
38
|
if (scene === undefined) {
|
|
38
39
|
throw new Error(`Scene '${sceneId}' does not exist in the project document.`);
|
|
39
40
|
}
|
|
40
41
|
const nodeViews = new Map();
|
|
41
42
|
const particleEmitters = [];
|
|
43
|
+
// Резолв «id ассета → имя звука» живёт здесь: вьюхи знают только id, а документ — только эта функция.
|
|
44
|
+
const sceneAudio = options.audio === undefined ? undefined : createSceneAudio(document, options.audio);
|
|
42
45
|
// Materialized prefab children use instance-scoped IDs, so authoring and runtime can address
|
|
43
46
|
// multiple instances independently without changing canonical definition IDs.
|
|
44
47
|
const screenSize = scene.layout.referenceViewports[profile];
|
|
@@ -57,7 +60,7 @@ export function buildSceneView(document, sceneId, profile, options) {
|
|
|
57
60
|
}
|
|
58
61
|
const resolved = resolveProfileTransform(node, profile);
|
|
59
62
|
const transform = resolveAnchoredTransform(resolved.transform, parentSize);
|
|
60
|
-
const view = createNodeView(node, interaction, textures, spines, (prefabId) => prefabIds.has(prefabId), fonts,
|
|
63
|
+
const view = createNodeView(node, interaction, textures, spines, (prefabId) => prefabIds.has(prefabId), fonts, sceneAudio, node.type === "particle-emitter" ? document.effects.find((effect) => effect.id === node.effectId && isParticleEffect(effect)) : undefined, spineReferenceFrameFor(document, node), ticker, bitmapFonts);
|
|
61
64
|
if (isLayoutGroup(node))
|
|
62
65
|
applyLayoutGroup(view, node, profile, parentSize);
|
|
63
66
|
// Yoga owns only the group's inner layoutContent; the outer NodeView keeps authored transform.
|