@pixi-ui-editor/runtime-pixi 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/SceneViewport.d.ts.map +1 -1
  2. package/dist/assets/bitmapFonts.js.map +1 -1
  3. package/dist/assets/fonts.js.map +1 -1
  4. package/dist/assets/sounds.js.map +1 -1
  5. package/dist/assets/spine.js.map +1 -1
  6. package/dist/assets/textures.js.map +1 -1
  7. package/dist/controls.d.ts +25 -1
  8. package/dist/controls.d.ts.map +1 -1
  9. package/dist/controls.js +42 -2
  10. package/dist/controls.js.map +1 -1
  11. package/dist/document.d.ts.map +1 -1
  12. package/dist/index.d.ts +2 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +2 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/layoutGroups.d.ts.map +1 -1
  17. package/dist/layoutGroups.js.map +1 -1
  18. package/dist/localization.d.ts.map +1 -1
  19. package/dist/localization.js.map +1 -1
  20. package/dist/pageGroup.d.ts.map +1 -1
  21. package/dist/pageGroup.js.map +1 -1
  22. package/dist/particles.d.ts.map +1 -1
  23. package/dist/particles.js.map +1 -1
  24. package/dist/scene.d.ts.map +1 -1
  25. package/dist/scene.js +36 -0
  26. package/dist/scene.js.map +1 -1
  27. package/dist/scrollView.d.ts.map +1 -1
  28. package/dist/scrollView.js.map +1 -1
  29. package/dist/views/ButtonNodeView.d.ts +12 -0
  30. package/dist/views/ButtonNodeView.d.ts.map +1 -1
  31. package/dist/views/ButtonNodeView.js +25 -7
  32. package/dist/views/ButtonNodeView.js.map +1 -1
  33. package/dist/views/CheckboxNodeView.d.ts.map +1 -1
  34. package/dist/views/InputNodeView.d.ts.map +1 -1
  35. package/dist/views/ItemTableNodeView.d.ts +57 -0
  36. package/dist/views/ItemTableNodeView.d.ts.map +1 -0
  37. package/dist/views/ItemTableNodeView.js +100 -0
  38. package/dist/views/ItemTableNodeView.js.map +1 -0
  39. package/dist/views/NodeView.d.ts +15 -1
  40. package/dist/views/NodeView.d.ts.map +1 -1
  41. package/dist/views/NodeView.js +19 -2
  42. package/dist/views/NodeView.js.map +1 -1
  43. package/dist/views/PageGroupNodeView.d.ts.map +1 -1
  44. package/dist/views/PaginationNodeView.d.ts +38 -2
  45. package/dist/views/PaginationNodeView.d.ts.map +1 -1
  46. package/dist/views/PaginationNodeView.js +85 -28
  47. package/dist/views/PaginationNodeView.js.map +1 -1
  48. package/dist/views/ParticleEmitterNodeView.d.ts.map +1 -1
  49. package/dist/views/ScrollViewNodeView.d.ts.map +1 -1
  50. package/dist/views/SpineNodeView.d.ts.map +1 -1
  51. package/dist/views/StagedButtonNodeView.d.ts +12 -1
  52. package/dist/views/StagedButtonNodeView.d.ts.map +1 -1
  53. package/dist/views/StagedButtonNodeView.js +27 -9
  54. package/dist/views/StagedButtonNodeView.js.map +1 -1
  55. package/dist/views/ValueControlNodeViews.d.ts.map +1 -1
  56. package/dist/views/basic.d.ts +27 -1
  57. package/dist/views/basic.d.ts.map +1 -1
  58. package/dist/views/basic.js +44 -0
  59. package/dist/views/basic.js.map +1 -1
  60. package/dist/views/createNodeView.d.ts.map +1 -1
  61. package/dist/views/createNodeView.js +8 -1
  62. package/dist/views/createNodeView.js.map +1 -1
  63. package/package.json +5 -2
@@ -1 +1 @@
1
- {"version":3,"file":"SceneViewport.d.ts","sourceRoot":"","sources":["../src/SceneViewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtF;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;gBAEhB,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO;IAiB5E,sFAAsF;IACtF,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc;CAMzC"}
1
+ {"version":3,"file":"SceneViewport.d.ts","sourceRoot":"","sources":["../src/SceneViewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtF;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAE5B,YAAY,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAe3E;IAED,sFAAsF;IACtF,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,CAKvC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"bitmapFonts.js","sourceRoot":"","sources":["../../src/assets/bitmapFonts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,EAAgB,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,MAAM,KAAK,GAAG,CAAC,KAAsB,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;AAC9F;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,eAAe,OAAO,EAAE,CAAC;AAC/D,MAAM,SAAS,GAAG,CAAC,KAAe,EAAE,EAAE,C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AC1D,IAAI,IAAI,KAAK,SAAS;YAAE,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC,CAAC;IACJ,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,KAAsB,EAAE,KAAa,EAAE,cAA+B,EAAE,QAAsD,qBAAqB;IAClM,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;IAC1D,OAAO,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;AACrC,CAAC","sourcesContent":["import type { Asset, ProjectDocument, UINode } from \"@pixi-ui-editor/schema\";\r\nimport { BitmapFont, Cache, bitmapFontXMLStringParser, type Texture } from \"pixi.js\";\r\nimport { collectRenderedNodes } from \"../scene.js\";\r\nimport { sharedBitmapFontCache } from \"./cache.js\";\r\nimport { loadTexture } from \"./loadTexture.js\";\r\n// Type-only: erased at compile time, so this does not create a runtime import cycle even though\r\n// `textures.ts` imports a value (`loadBitmapFontGlyphTexture`) from this file.\r\nimport type { FileUrlResolver } from \"./textures.js\";\r\n\r\ntype BitmapFontAsset = Extract<Asset, { type: \"bitmapFont\" }>;\r\n\r\nconst keyOf = (asset: BitmapFontAsset) => `${asset.files.xml.uri}#${asset.files.texture.uri}`;\r\n/**\r\n * The synthetic family every loaded font installs under — never whatever `<info face>` its XML\r\n * declares. Two uploaded bitmap fonts could share the same exporter-generated face name, and the\r\n * asset id is the only identity PixiJS's `${fontFamily}-bitmap` Cache key is guaranteed not to collide on.\r\n */\r\nconst familyOf = (assetId: string) => `bitmap-font-${assetId}`;\r\nconst fromNodes = (nodes: UINode[]) => nodes.flatMap((node) => (node.type === \"bitmap-text\" ? [node.assetId] : []));\r\n\r\n/**\r\n * Shared by `loadSceneFonts`'s reasoning (see `sharedFontCache`): a loaded `BitmapFont` registers into\r\n * PixiJS's own global `Cache`, so re-parsing the same asset under a caller-scoped cache would still\r\n * collide there. `cache` defaults to that shared map but accepts a `SceneAssetCache.bitmapFonts` from\r\n * the caller, the same override every other scene asset loader takes.\r\n */\r\nfunction loadFont(asset: BitmapFontAsset, resolveFileUrl: FileUrlResolver, cache: Map<string, Promise<BitmapFont | undefined>>): Promise<BitmapFont | undefined> {\r\n const key = keyOf(asset);\r\n let pending = cache.get(key);\r\n if (pending === undefined) {\r\n pending = (async () => {\r\n const xmlUrl = resolveFileUrl(asset.files.xml.uri);\r\n const textureUrl = resolveFileUrl(asset.files.texture.uri);\r\n if (xmlUrl === undefined || textureUrl === undefined) return undefined;\r\n try {\r\n const [xml, texture] = await Promise.all([fetch(xmlUrl).then((response) => response.text()), loadTexture(textureUrl)]);\r\n const font = new BitmapFont({ data: bitmapFontXMLStringParser.parse(xml), textures: [texture] });\r\n Cache.set(`${familyOf(asset.id)}-bitmap`, font);\r\n return font;\r\n } catch (error) { console.warn(`Unable to load bitmap font asset '${asset.id}'. Text using it will not render.`, error); return undefined; }\r\n })();\r\n cache.set(key, pending);\r\n }\r\n return pending;\r\n}\r\n\r\n/**\r\n * Loads scene bitmap fonts before views are built, mirroring `loadSceneFonts`. Unlike a regular\r\n * `FontFace`, PixiJS resolves a `BitmapText`'s font by looking up `Cache` for `${fontFamily}-bitmap`\r\n * (see `BitmapFontManager.getFont`), so loading here means parsing the XML, building one `BitmapFont`\r\n * from the already-fetched texture, and registering it in that cache — there is no URL-based loader\r\n * to delegate to, since our XML and texture live at unrelated asset URIs, not a fixed relative pair.\r\n */\r\nexport async function loadSceneBitmapFonts(document: ProjectDocument, sceneId: string, resolveFileUrl: FileUrlResolver, cache: Map<string, Promise<BitmapFont | undefined>> = sharedBitmapFontCache): Promise<Map<string, string>> {\r\n const scene = document.scenes.find((item) => item.id === sceneId);\r\n if (scene === undefined) throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\r\n const ids = new Set(fromNodes(collectRenderedNodes(document, scene)));\r\n const fonts = new Map<string, string>();\r\n await Promise.all([...ids].map(async (id) => {\r\n const asset = document.assets.find((item) => item.id === id);\r\n if (asset?.type !== \"bitmapFont\") return;\r\n const font = await loadFont(asset, resolveFileUrl, cache);\r\n if (font !== undefined) fonts.set(id, familyOf(asset.id));\r\n }));\r\n return fonts;\r\n}\r\n\r\n/**\r\n * Resolves one glyph's already-cropped `Texture` from a bitmap font asset, for reuse as a plain image\r\n * asset (an Image node, a Button/Checkbox state, ...) — see `BitmapFontAsset.frames`. `BitmapFont`\r\n * builds one `Texture` per character up front (see its constructor), so this is a lookup, not a crop.\r\n */\r\nexport async function loadBitmapFontGlyphTexture(asset: BitmapFontAsset, glyph: string, resolveFileUrl: FileUrlResolver, cache: Map<string, Promise<BitmapFont | undefined>> = sharedBitmapFontCache): Promise<Texture | undefined> {\r\n const font = await loadFont(asset, resolveFileUrl, cache);\r\n return font?.chars[glyph]?.texture;\r\n}\r\n"]}
1
+ {"version":3,"file":"bitmapFonts.js","sourceRoot":"","sources":["../../src/assets/bitmapFonts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,EAAgB,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,MAAM,KAAK,GAAG,CAAC,KAAsB,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;AAC9F;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,eAAe,OAAO,EAAE,CAAC;AAC/D,MAAM,SAAS,GAAG,CAAC,KAAe,EAAE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,CAAC,CAAC;QAC1D,IAAI,IAAI,KAAK,SAAS;YAAE,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC,CAAC;IACJ,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,KAAsB,EAAE,KAAa,EAAE,cAA+B,EAAE,KAAK,GAAiD,qBAAqB;IAClM,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;IAC1D,OAAO,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;AACrC,CAAC","sourcesContent":["import type { Asset, ProjectDocument, UINode } from \"@pixi-ui-editor/schema\";\r\nimport { BitmapFont, Cache, bitmapFontXMLStringParser, type Texture } from \"pixi.js\";\r\nimport { collectRenderedNodes } from \"../scene.js\";\r\nimport { sharedBitmapFontCache } from \"./cache.js\";\r\nimport { loadTexture } from \"./loadTexture.js\";\r\n// Type-only: erased at compile time, so this does not create a runtime import cycle even though\r\n// `textures.ts` imports a value (`loadBitmapFontGlyphTexture`) from this file.\r\nimport type { FileUrlResolver } from \"./textures.js\";\r\n\r\ntype BitmapFontAsset = Extract<Asset, { type: \"bitmapFont\" }>;\r\n\r\nconst keyOf = (asset: BitmapFontAsset) => `${asset.files.xml.uri}#${asset.files.texture.uri}`;\r\n/**\r\n * The synthetic family every loaded font installs under — never whatever `<info face>` its XML\r\n * declares. Two uploaded bitmap fonts could share the same exporter-generated face name, and the\r\n * asset id is the only identity PixiJS's `${fontFamily}-bitmap` Cache key is guaranteed not to collide on.\r\n */\r\nconst familyOf = (assetId: string) => `bitmap-font-${assetId}`;\r\nconst fromNodes = (nodes: UINode[]) => nodes.flatMap((node) => (node.type === \"bitmap-text\" ? [node.assetId] : []));\r\n\r\n/**\r\n * Shared by `loadSceneFonts`'s reasoning (see `sharedFontCache`): a loaded `BitmapFont` registers into\r\n * PixiJS's own global `Cache`, so re-parsing the same asset under a caller-scoped cache would still\r\n * collide there. `cache` defaults to that shared map but accepts a `SceneAssetCache.bitmapFonts` from\r\n * the caller, the same override every other scene asset loader takes.\r\n */\r\nfunction loadFont(asset: BitmapFontAsset, resolveFileUrl: FileUrlResolver, cache: Map<string, Promise<BitmapFont | undefined>>): Promise<BitmapFont | undefined> {\r\n const key = keyOf(asset);\r\n let pending = cache.get(key);\r\n if (pending === undefined) {\r\n pending = (async () => {\r\n const xmlUrl = resolveFileUrl(asset.files.xml.uri);\r\n const textureUrl = resolveFileUrl(asset.files.texture.uri);\r\n if (xmlUrl === undefined || textureUrl === undefined) return undefined;\r\n try {\r\n const [xml, texture] = await Promise.all([fetch(xmlUrl).then((response) => response.text()), loadTexture(textureUrl)]);\r\n const font = new BitmapFont({ data: bitmapFontXMLStringParser.parse(xml), textures: [texture] });\r\n Cache.set(`${familyOf(asset.id)}-bitmap`, font);\r\n return font;\r\n } catch (error) { console.warn(`Unable to load bitmap font asset '${asset.id}'. Text using it will not render.`, error); return undefined; }\r\n })();\r\n cache.set(key, pending);\r\n }\r\n return pending;\r\n}\r\n\r\n/**\r\n * Loads scene bitmap fonts before views are built, mirroring `loadSceneFonts`. Unlike a regular\r\n * `FontFace`, PixiJS resolves a `BitmapText`'s font by looking up `Cache` for `${fontFamily}-bitmap`\r\n * (see `BitmapFontManager.getFont`), so loading here means parsing the XML, building one `BitmapFont`\r\n * from the already-fetched texture, and registering it in that cache — there is no URL-based loader\r\n * to delegate to, since our XML and texture live at unrelated asset URIs, not a fixed relative pair.\r\n */\r\nexport async function loadSceneBitmapFonts(document: ProjectDocument, sceneId: string, resolveFileUrl: FileUrlResolver, cache: Map<string, Promise<BitmapFont | undefined>> = sharedBitmapFontCache): Promise<Map<string, string>> {\r\n const scene = document.scenes.find((item) => item.id === sceneId);\r\n if (scene === undefined) throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\r\n const ids = new Set(fromNodes(collectRenderedNodes(document, scene)));\r\n const fonts = new Map<string, string>();\r\n await Promise.all([...ids].map(async (id) => {\r\n const asset = document.assets.find((item) => item.id === id);\r\n if (asset?.type !== \"bitmapFont\") return;\r\n const font = await loadFont(asset, resolveFileUrl, cache);\r\n if (font !== undefined) fonts.set(id, familyOf(asset.id));\r\n }));\r\n return fonts;\r\n}\r\n\r\n/**\r\n * Resolves one glyph's already-cropped `Texture` from a bitmap font asset, for reuse as a plain image\r\n * asset (an Image node, a Button/Checkbox state, ...) — see `BitmapFontAsset.frames`. `BitmapFont`\r\n * builds one `Texture` per character up front (see its constructor), so this is a lookup, not a crop.\r\n */\r\nexport async function loadBitmapFontGlyphTexture(asset: BitmapFontAsset, glyph: string, resolveFileUrl: FileUrlResolver, cache: Map<string, Promise<BitmapFont | undefined>> = sharedBitmapFontCache): Promise<Texture | undefined> {\r\n const font = await loadFont(asset, resolveFileUrl, cache);\r\n return font?.chars[glyph]?.texture;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../src/assets/fonts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,KAAK,GAAG,CAAC,KAAuC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;AAC/G,MAAM,SAAS,GAAG,CAAC,KAAe,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;IAC5D,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,KAAK,EAAE,WAAW;QAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACrF,IA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lResolver } from \"./textures.js\";\r\nimport { sharedFontCache } from \"./cache.js\";\r\nimport { collectRenderedNodes } from \"../scene.js\";\r\n\r\nconst keyOf = (asset: Extract<Asset, { type: \"font\" }>) => `${asset.source.uri}#${asset.source.version ?? \"\"}`;\r\nconst fromNodes = (nodes: UINode[]) => nodes.flatMap((node) => {\r\n if (node.type === \"text\" && node.style?.fontAssetId) return [node.style.fontAssetId];\r\n if (node.type === \"input\" && node.textStyle.fontAssetId) return [node.textStyle.fontAssetId];\r\n if (node.type === \"slider\" && node.valueTextStyle?.fontAssetId) return [node.valueTextStyle.fontAssetId];\r\n return [];\r\n});\r\n\r\n/** Loads scene fonts before views are built. A load failure is a warning and keeps system fallback usable. */\r\nexport async function loadSceneFonts(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Promise<string | undefined>> = sharedFontCache,\r\n): Promise<Map<string, string>> {\r\n const scene = document.scenes.find((item) => item.id === sceneId);\r\n if (scene === undefined) throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\r\n const ids = new Set(fromNodes(collectRenderedNodes(document, scene)));\r\n const fonts = new Map<string, string>();\r\n await Promise.all([...ids].map(async (id) => {\r\n const asset = document.assets.find((item) => item.id === id);\r\n if (asset?.type !== \"font\") return;\r\n const key = keyOf(asset);\r\n let pending = cache.get(key);\r\n if (pending === undefined) {\r\n pending = (async () => {\r\n const url = resolveFileUrl(asset.source.uri);\r\n if (url === undefined || typeof FontFace === \"undefined\" || typeof globalThis.document === \"undefined\") return undefined;\r\n try { const face = new FontFace(asset.family, `url(${JSON.stringify(url)})`, { weight: asset.weight, style: asset.style }); await face.load(); globalThis.document.fonts.add(face); return asset.family; }\r\n catch (error) { console.warn(`Unable to load font asset '${asset.id}'. Using system fallback.`, error); return undefined; }\r\n })();\r\n cache.set(key, pending);\r\n }\r\n const family = await pending; if (family !== undefined) fonts.set(id, family);\r\n }));\r\n return fonts;\r\n}\r\n"]}
1
+ {"version":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AAO,KAAK,CAAC,MAAM,CAAC;gBAAC,CAAC;gBAC1M,OAAO,KAAK,EAAE,CAAC;oBAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,KAAK,CAAC,EAAE,2BAA2B,EAAE,KAAK,CAAC,CAAC;oBAAC,OAAO,SAAS,CAAC;gBAAC,CAAC;YAC7H,CAAC,CAAC,EAAE,CAAC;YACL,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC1B,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;QAAC,IAAI,MAAM,KAAK,SAAS;YAAE,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC,CAAC;IACJ,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { Asset, ProjectDocument, UINode } from \"@pixi-ui-editor/schema\";\r\nimport type { FileUrlResolver } from \"./textures.js\";\r\nimport { sharedFontCache } from \"./cache.js\";\r\nimport { collectRenderedNodes } from \"../scene.js\";\r\n\r\nconst keyOf = (asset: Extract<Asset, { type: \"font\" }>) => `${asset.source.uri}#${asset.source.version ?? \"\"}`;\r\nconst fromNodes = (nodes: UINode[]) => nodes.flatMap((node) => {\r\n if (node.type === \"text\" && node.style?.fontAssetId) return [node.style.fontAssetId];\r\n if (node.type === \"input\" && node.textStyle.fontAssetId) return [node.textStyle.fontAssetId];\r\n if (node.type === \"slider\" && node.valueTextStyle?.fontAssetId) return [node.valueTextStyle.fontAssetId];\r\n return [];\r\n});\r\n\r\n/** Loads scene fonts before views are built. A load failure is a warning and keeps system fallback usable. */\r\nexport async function loadSceneFonts(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Promise<string | undefined>> = sharedFontCache,\r\n): Promise<Map<string, string>> {\r\n const scene = document.scenes.find((item) => item.id === sceneId);\r\n if (scene === undefined) throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\r\n const ids = new Set(fromNodes(collectRenderedNodes(document, scene)));\r\n const fonts = new Map<string, string>();\r\n await Promise.all([...ids].map(async (id) => {\r\n const asset = document.assets.find((item) => item.id === id);\r\n if (asset?.type !== \"font\") return;\r\n const key = keyOf(asset);\r\n let pending = cache.get(key);\r\n if (pending === undefined) {\r\n pending = (async () => {\r\n const url = resolveFileUrl(asset.source.uri);\r\n if (url === undefined || typeof FontFace === \"undefined\" || typeof globalThis.document === \"undefined\") return undefined;\r\n try { const face = new FontFace(asset.family, `url(${JSON.stringify(url)})`, { weight: asset.weight, style: asset.style }); await face.load(); globalThis.document.fonts.add(face); return asset.family; }\r\n catch (error) { console.warn(`Unable to load font asset '${asset.id}'. Using system fallback.`, error); return undefined; }\r\n })();\r\n cache.set(key, pending);\r\n }\r\n const family = await pending; if (family !== undefined) fonts.set(id, family);\r\n }));\r\n return fonts;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sounds.js","sourceRoot":"","sources":["../../src/assets/sounds.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,KAAK,UAAU,SAAS,CAAC,MAAmB;IAC1C,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IAC9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,OAAc,CAAC;QACnB,IAAI,CAAC;YACH,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC;gBACnB,MAAM;gBACN,OAAO,EAAE,IAAI;gBACb,0FAA0F;gBAC1F,8FAA8F;gBAC9F,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC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port { collectRenderedNodes } from \"../scene.js\";\r\nimport { collectNodeAssetIds } from \"../views/createNodeView.js\";\r\nimport type { FileUrlResolver } from \"./textures.js\";\r\n\r\nasync function loadSound(source: ArrayBuffer): Promise<Sound> {\r\n const { Sound } = await import(\"@pixi/sound\");\r\n return new Promise((resolve, reject) => {\r\n let created: Sound;\r\n try {\r\n created = Sound.from({\r\n source,\r\n preload: true,\r\n // @pixi/sound's runtime uses the Node-style `null` success value although its declaration\r\n // only mentions Error. Accept both null and undefined or every successful decode is rejected.\r\n loaded: (error, loaded) => error == null ? resolve(loaded ?? created) : reject(error),\r\n });\r\n } catch (error) {\r\n reject(error);\r\n }\r\n });\r\n}\r\n\r\nasync function loadSoundAssets(\r\n document: ProjectDocument,\r\n ids: Iterable<string>,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Sound> = new Map(),\r\n): Promise<Map<string, Sound>> {\r\n const assetsById = new Map(document.assets.map((asset) => [asset.id, asset]));\r\n const sounds = new Map<string, Sound>();\r\n for (const assetId of ids) {\r\n const asset = assetsById.get(assetId);\r\n if (asset?.type !== \"sound\") continue;\r\n try {\r\n let loaded = cache.get(asset.source.uri);\r\n if (loaded === undefined) {\r\n const url = resolveFileUrl(asset.source.uri);\r\n if (url === undefined) continue;\r\n const response = await fetch(url);\r\n if (!response.ok) throw new Error(`Unable to fetch '${url}': ${response.status} ${response.statusText}`);\r\n loaded = await loadSound(await response.arrayBuffer());\r\n cache.set(asset.source.uri, loaded);\r\n }\r\n sounds.set(asset.id, loaded);\r\n } catch (error) {\r\n console.warn(`Unable to load sound for asset '${asset.id}'.`, error);\r\n }\r\n }\r\n return sounds;\r\n}\r\n\r\n/** Loads every sound asset up front, useful for an editor Preview whose assignments change live. */\r\nexport function loadProjectSounds(\r\n document: ProjectDocument,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Sound> = new Map(),\r\n): Promise<Map<string, Sound>> {\r\n return loadSoundAssets(document, document.assets.filter((asset) => asset.type === \"sound\").map((asset) => asset.id), resolveFileUrl, cache);\r\n}\r\n\r\n/** Loads the background track and button sounds used by one rendered scene. Failed assets stay silent. */\r\nexport async function loadSceneSounds(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Sound> = new Map(),\r\n): Promise<Map<string, Sound>> {\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 assetsById = new Map(document.assets.map((asset) => [asset.id, asset]));\r\n const ids = new Set<string>();\r\n if (scene.audio?.backgroundMusicAssetId !== undefined) ids.add(scene.audio.backgroundMusicAssetId);\r\n for (const node of collectRenderedNodes(document, scene)) {\r\n for (const assetId of collectNodeAssetIds(node)) if (assetsById.get(assetId)?.type === \"sound\") ids.add(assetId);\r\n }\r\n return loadSoundAssets(document, ids, resolveFileUrl, cache);\r\n}\r\n\r\nexport type SceneAudioPlayback = {\r\n update(audio: Scene[\"audio\"], sounds: ReadonlyMap<string, Sound>): 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\nexport function createSceneAudioPlayback(): SceneAudioPlayback {\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: SceneAudioPlayback = {\r\n update(audio, sounds) {\r\n const nextAssetId = audio?.backgroundMusicAssetId;\r\n const nextSound = nextAssetId === undefined ? undefined : sounds.get(nextAssetId);\r\n const volume = audio?.volume ?? 1;\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"]}
1
+ {"version":3,"file":"sounds.js","sourceRoot":"","sources":["../../src/assets/sounds.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,KAAK,UAAU,SAAS,CAAC,MAAmB;IAC1C,MAAM,EAAE,KAAK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,CAAC;yBAAM,CAAC;wBACN,eAAe,GAAG,MAAM,CAAC;wBACzB,IAAI,uBAAuB,CAAC,SAAS,CAAC;4BAAE,aAAa,CAAC,KAAK,CAAC,CAAC;oBAC/D,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;oBACP,aAAa,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC;YACH,CAAC,CAAC;YACF,KAAK,EAAE,CAAC;QACV,CAAC;QACD,IAAI,EAAE,WAAW;KAClB,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import type { Sound, IMediaInstance } from \"@pixi/sound\";\r\nimport type { ProjectDocument, Scene } from \"@pixi-ui-editor/schema\";\r\nimport { collectRenderedNodes } from \"../scene.js\";\r\nimport { collectNodeAssetIds } from \"../views/createNodeView.js\";\r\nimport type { FileUrlResolver } from \"./textures.js\";\r\n\r\nasync function loadSound(source: ArrayBuffer): Promise<Sound> {\r\n const { Sound } = await import(\"@pixi/sound\");\r\n return new Promise((resolve, reject) => {\r\n let created: Sound;\r\n try {\r\n created = Sound.from({\r\n source,\r\n preload: true,\r\n // @pixi/sound's runtime uses the Node-style `null` success value although its declaration\r\n // only mentions Error. Accept both null and undefined or every successful decode is rejected.\r\n loaded: (error, loaded) => error == null ? resolve(loaded ?? created) : reject(error),\r\n });\r\n } catch (error) {\r\n reject(error);\r\n }\r\n });\r\n}\r\n\r\nasync function loadSoundAssets(\r\n document: ProjectDocument,\r\n ids: Iterable<string>,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Sound> = new Map(),\r\n): Promise<Map<string, Sound>> {\r\n const assetsById = new Map(document.assets.map((asset) => [asset.id, asset]));\r\n const sounds = new Map<string, Sound>();\r\n for (const assetId of ids) {\r\n const asset = assetsById.get(assetId);\r\n if (asset?.type !== \"sound\") continue;\r\n try {\r\n let loaded = cache.get(asset.source.uri);\r\n if (loaded === undefined) {\r\n const url = resolveFileUrl(asset.source.uri);\r\n if (url === undefined) continue;\r\n const response = await fetch(url);\r\n if (!response.ok) throw new Error(`Unable to fetch '${url}': ${response.status} ${response.statusText}`);\r\n loaded = await loadSound(await response.arrayBuffer());\r\n cache.set(asset.source.uri, loaded);\r\n }\r\n sounds.set(asset.id, loaded);\r\n } catch (error) {\r\n console.warn(`Unable to load sound for asset '${asset.id}'.`, error);\r\n }\r\n }\r\n return sounds;\r\n}\r\n\r\n/** Loads every sound asset up front, useful for an editor Preview whose assignments change live. */\r\nexport function loadProjectSounds(\r\n document: ProjectDocument,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Sound> = new Map(),\r\n): Promise<Map<string, Sound>> {\r\n return loadSoundAssets(document, document.assets.filter((asset) => asset.type === \"sound\").map((asset) => asset.id), resolveFileUrl, cache);\r\n}\r\n\r\n/** Loads the background track and button sounds used by one rendered scene. Failed assets stay silent. */\r\nexport async function loadSceneSounds(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Sound> = new Map(),\r\n): Promise<Map<string, Sound>> {\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 assetsById = new Map(document.assets.map((asset) => [asset.id, asset]));\r\n const ids = new Set<string>();\r\n if (scene.audio?.backgroundMusicAssetId !== undefined) ids.add(scene.audio.backgroundMusicAssetId);\r\n for (const node of collectRenderedNodes(document, scene)) {\r\n for (const assetId of collectNodeAssetIds(node)) if (assetsById.get(assetId)?.type === \"sound\") ids.add(assetId);\r\n }\r\n return loadSoundAssets(document, ids, resolveFileUrl, cache);\r\n}\r\n\r\nexport type SceneAudioPlayback = {\r\n update(audio: Scene[\"audio\"], sounds: ReadonlyMap<string, Sound>): 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\nexport function createSceneAudioPlayback(): SceneAudioPlayback {\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: SceneAudioPlayback = {\r\n update(audio, sounds) {\r\n const nextAssetId = audio?.backgroundMusicAssetId;\r\n const nextSound = nextAssetId === undefined ? undefined : sounds.get(nextAssetId);\r\n const volume = audio?.volume ?? 1;\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"spine.js","sourceRoot":"","sources":["../../src/assets/spine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAqB,MAAM,iCAAiC,CAAC;AAG5I,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,WAAW,EAAwB,MAAM,eAAe,CAAC;AAElE,4QAA4Q;AAC5Q,MAAM,oCAAoC,GAAG,iDAAiD,CAAC;AAE/F,SAAS,0BAA0B,CAAC,KAAc;IAChD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,IAAI,oCAAoC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,OAAO,oCAAoC,OAAO,oLAAoL,CAAC;IACzO,CAAC;IACD,OAAO,kCAAkC,OAAO,EAAE,CAAC;AACrD,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,uBAAuB,CAAC,KAAmB,EAAE,QAAsC;IACjG,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,CAAC,IAAI,iCAAiC,CAAC,CAAC;QACtG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CA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CAAC,CAAC;IAClD,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { AtlasAttachmentLoader, SkeletonJson, Spine, SpineTexture, TextureAtlas, type SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport { type Asset, type ProjectDocument } from \"@pixi-ui-editor/schema\";\r\nimport { Texture, type Ticker } from \"pixi.js\";\r\nimport { collectRenderedNodes } from \"../scene.js\";\r\nimport { loadTexture, type FileUrlResolver } from \"./textures.js\";\r\n\r\n/** Matches spine-pixi-v8's \"unknown timeline/attachment/constraint type\" errors, thrown when a skeleton was exported by an incompatible Spine Editor version (e.g. pre-4.0 JSON, which names slot color timelines \"color\"/\"twoColor\" instead of the 4.x \"rgba\"/\"rgba2\"). */\r\nconst INCOMPATIBLE_SKELETON_FORMAT_PATTERN = /Invalid (?:timeline|attachment|constraint) type/;\r\n\r\nfunction describeSkeletonParseError(error: unknown): string {\r\n const message = error instanceof Error ? error.message : String(error);\r\n if (INCOMPATIBLE_SKELETON_FORMAT_PATTERN.test(message)) {\r\n return `Unsupported Spine export format (${message}). The skeleton was likely exported by a Spine Editor version incompatible with this runtime (spine-pixi-v8 4.2, Spine 4.0–4.2 JSON). Re-export it from Spine Editor 4.2 or older.`;\r\n }\r\n return `Failed to parse skeleton data: ${message}`;\r\n}\r\n\r\n/** Assigns atlas pages by their exported image filename, never by their array index. */\r\nexport function assignAtlasPageTextures(atlas: TextureAtlas, textures: ReadonlyMap<string, Texture>): void {\r\n for (const page of atlas.pages) {\r\n const texture = textures.get(page.name);\r\n if (texture === undefined) throw new Error(`Atlas page '${page.name}' has no matching texture file.`);\r\n page.setTexture(SpineTexture.from(texture.source));\r\n }\r\n}\r\n\r\n/** Creates a Spine display object, optionally assigning it to a specific renderer ticker. */\r\nexport function createSpineView(skeletonData: SkeletonData, animation?: string, options: { autoUpdate?: boolean; ticker?: Ticker } = {}): Spine {\r\n const spine = new Spine({ skeletonData, autoUpdate: options.autoUpdate ?? true, ticker: options.ticker });\r\n if (animation !== undefined && skeletonData.findAnimation(animation) !== null) spine.state.setAnimation(0, animation, true);\r\n return spine;\r\n}\r\n\r\n/** Loads the Spine data referenced by a scene. Failed assets are left out for placeholder rendering. */\r\nexport async function loadSceneSpines(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, SkeletonData> = new Map(),\r\n): Promise<Map<string, SkeletonData>> {\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\r\n const assetsById = new Map(document.assets.map((asset) => [asset.id, asset]));\r\n const spines = new Map<string, SkeletonData>();\r\n for (const node of collectRenderedNodes(document, scene)) {\r\n if (node.type !== \"spine\" || spines.has(node.assetId)) continue;\r\n const asset = assetsById.get(node.assetId);\r\n if (asset?.type !== \"spine\") continue;\r\n\r\n try { spines.set(asset.id, await loadSpineAsset(asset, resolveFileUrl, cache)); } catch (error) {\r\n console.warn(`Unable to load Spine asset '${asset.name}' (${asset.id}).`, error);\r\n }\r\n }\r\n return spines;\r\n}\r\n\r\n/** Loads one Spine asset, sharing parsed SkeletonData by skeleton file URI. */\r\nexport async function loadSpineAsset(asset: Extract<Asset, { type: \"spine\" }>, resolveFileUrl: FileUrlResolver, cache: Map<string, SkeletonData> = new Map()): Promise<SkeletonData> {\r\n const cached = cache.get(asset.files.skeleton.uri);\r\n if (cached !== undefined) return cached;\r\n const skeletonUrl = resolveFileUrl(asset.files.skeleton.uri);\r\n const atlasUrl = resolveFileUrl(asset.files.atlas.uri);\r\n if (skeletonUrl === undefined || atlasUrl === undefined) throw new Error(\"A Spine file URL could not be resolved.\");\r\n const [skeletonText, atlasText] = await Promise.all([fetch(skeletonUrl).then((response) => response.text()), fetch(atlasUrl).then((response) => response.text())]);\r\n const textures = new Map<string, Texture>();\r\n for (const file of asset.files.textures) {\r\n const url = resolveFileUrl(file.uri);\r\n if (url === undefined) throw new Error(`Texture '${file.name}' could not be resolved.`);\r\n textures.set(file.name, await loadTexture(url));\r\n }\r\n const atlas = new TextureAtlas(atlasText);\r\n assignAtlasPageTextures(atlas, textures);\r\n let skeletonData: SkeletonData;\r\n try {\r\n skeletonData = new SkeletonJson(new AtlasAttachmentLoader(atlas)).readSkeletonData(skeletonText);\r\n } catch (error) {\r\n const description = describeSkeletonParseError(error);\r\n console.error(`Spine asset '${asset.name}' (${asset.id}) could not be parsed: ${description}`);\r\n throw new Error(description, { cause: error });\r\n }\r\n cache.set(asset.files.skeleton.uri, skeletonData);\r\n return skeletonData;\r\n}\r\n"]}
1
+ {"version":3,"file":"spine.js","sourceRoot":"","sources":["../../src/assets/spine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAqB,MAAM,iCAAiC,CAAC;AAG5I,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,WAAW,EAAwB,MAAM,eAAe,CAAC;AAElE,4QAA4Q;AAC5Q,MAAM,oCAAoC,GAAG,iDAAiD,CAAC;AAE/F,SAAS,0BAA0B,CAAC,KAAc;IAChD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,IAAI,oCAAoC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,OAAO,oCAAoC,OAAO,oLAAoL,CAAC;IACzO,CAAC;IACD,OAAO,kCAAkC,OAAO,EAAE,CAAC;AACrD,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,uBAAuB,CAAC,KAAmB,EAAE,QAAsC;IACjG,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;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AAM,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAClD,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { AtlasAttachmentLoader, SkeletonJson, Spine, SpineTexture, TextureAtlas, type SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport { type Asset, type ProjectDocument } from \"@pixi-ui-editor/schema\";\r\nimport { Texture, type Ticker } from \"pixi.js\";\r\nimport { collectRenderedNodes } from \"../scene.js\";\r\nimport { loadTexture, type FileUrlResolver } from \"./textures.js\";\r\n\r\n/** Matches spine-pixi-v8's \"unknown timeline/attachment/constraint type\" errors, thrown when a skeleton was exported by an incompatible Spine Editor version (e.g. pre-4.0 JSON, which names slot color timelines \"color\"/\"twoColor\" instead of the 4.x \"rgba\"/\"rgba2\"). */\r\nconst INCOMPATIBLE_SKELETON_FORMAT_PATTERN = /Invalid (?:timeline|attachment|constraint) type/;\r\n\r\nfunction describeSkeletonParseError(error: unknown): string {\r\n const message = error instanceof Error ? error.message : String(error);\r\n if (INCOMPATIBLE_SKELETON_FORMAT_PATTERN.test(message)) {\r\n return `Unsupported Spine export format (${message}). The skeleton was likely exported by a Spine Editor version incompatible with this runtime (spine-pixi-v8 4.2, Spine 4.0–4.2 JSON). Re-export it from Spine Editor 4.2 or older.`;\r\n }\r\n return `Failed to parse skeleton data: ${message}`;\r\n}\r\n\r\n/** Assigns atlas pages by their exported image filename, never by their array index. */\r\nexport function assignAtlasPageTextures(atlas: TextureAtlas, textures: ReadonlyMap<string, Texture>): void {\r\n for (const page of atlas.pages) {\r\n const texture = textures.get(page.name);\r\n if (texture === undefined) throw new Error(`Atlas page '${page.name}' has no matching texture file.`);\r\n page.setTexture(SpineTexture.from(texture.source));\r\n }\r\n}\r\n\r\n/** Creates a Spine display object, optionally assigning it to a specific renderer ticker. */\r\nexport function createSpineView(skeletonData: SkeletonData, animation?: string, options: { autoUpdate?: boolean; ticker?: Ticker } = {}): Spine {\r\n const spine = new Spine({ skeletonData, autoUpdate: options.autoUpdate ?? true, ticker: options.ticker });\r\n if (animation !== undefined && skeletonData.findAnimation(animation) !== null) spine.state.setAnimation(0, animation, true);\r\n return spine;\r\n}\r\n\r\n/** Loads the Spine data referenced by a scene. Failed assets are left out for placeholder rendering. */\r\nexport async function loadSceneSpines(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, SkeletonData> = new Map(),\r\n): Promise<Map<string, SkeletonData>> {\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\r\n const assetsById = new Map(document.assets.map((asset) => [asset.id, asset]));\r\n const spines = new Map<string, SkeletonData>();\r\n for (const node of collectRenderedNodes(document, scene)) {\r\n if (node.type !== \"spine\" || spines.has(node.assetId)) continue;\r\n const asset = assetsById.get(node.assetId);\r\n if (asset?.type !== \"spine\") continue;\r\n\r\n try { spines.set(asset.id, await loadSpineAsset(asset, resolveFileUrl, cache)); } catch (error) {\r\n console.warn(`Unable to load Spine asset '${asset.name}' (${asset.id}).`, error);\r\n }\r\n }\r\n return spines;\r\n}\r\n\r\n/** Loads one Spine asset, sharing parsed SkeletonData by skeleton file URI. */\r\nexport async function loadSpineAsset(asset: Extract<Asset, { type: \"spine\" }>, resolveFileUrl: FileUrlResolver, cache: Map<string, SkeletonData> = new Map()): Promise<SkeletonData> {\r\n const cached = cache.get(asset.files.skeleton.uri);\r\n if (cached !== undefined) return cached;\r\n const skeletonUrl = resolveFileUrl(asset.files.skeleton.uri);\r\n const atlasUrl = resolveFileUrl(asset.files.atlas.uri);\r\n if (skeletonUrl === undefined || atlasUrl === undefined) throw new Error(\"A Spine file URL could not be resolved.\");\r\n const [skeletonText, atlasText] = await Promise.all([fetch(skeletonUrl).then((response) => response.text()), fetch(atlasUrl).then((response) => response.text())]);\r\n const textures = new Map<string, Texture>();\r\n for (const file of asset.files.textures) {\r\n const url = resolveFileUrl(file.uri);\r\n if (url === undefined) throw new Error(`Texture '${file.name}' could not be resolved.`);\r\n textures.set(file.name, await loadTexture(url));\r\n }\r\n const atlas = new TextureAtlas(atlasText);\r\n assignAtlasPageTextures(atlas, textures);\r\n let skeletonData: SkeletonData;\r\n try {\r\n skeletonData = new SkeletonJson(new AtlasAttachmentLoader(atlas)).readSkeletonData(skeletonText);\r\n } catch (error) {\r\n const description = describeSkeletonParseError(error);\r\n console.error(`Spine asset '${asset.name}' (${asset.id}) could not be parsed: ${description}`);\r\n throw new Error(description, { cause: error });\r\n }\r\n cache.set(asset.files.skeleton.uri, skeletonData);\r\n return skeletonData;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"textures.js","sourceRoot":"","sources":["../../src/assets/textures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAoC,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAuD,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,0FAA0F;AAC1F,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAiB,EACjB,cAA+B,EAC/B,QAAkC,IAAI,GAAG,EAAE;IAE3C,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,C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,OAAO,EAAE,CAAC;oBAC3B,MAAM,KAAK,GAAG,MAAM,oBAAoB,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAC;oBACxF,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;oBACrD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;wBAAC,OAAO,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,KAAK,CAAC,EAAE,mBAAmB,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC;wBAAC,SAAS;oBAAC,CAAC;oBAC3H,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;gBACtC,CAAC;qBAAM,CAAC;oBACN,MAAM,YAAY,GAAG,MAAM,0BAA0B,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;oBAC1H,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;wBAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,KAAK,CAAC,UAAU,CAAC,EAAE,mBAAmB,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC;wBAAC,SAAS;oBAAC,CAAC;oBACtI,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,qCAAqC,OAAO,IAAI,EAAE,KAAK,CAAC,CAAC;YACxE,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { collectEffectAssetIds, type Asset, type ProjectDocument } from \"@pixi-ui-editor/schema\";\r\nimport { Spritesheet, type BitmapFont, type Texture, type SpritesheetData } from \"pixi.js\";\r\nimport { collectRenderedNodes } from \"../scene.js\";\r\nimport { collectNodeAssetIds } from \"../views/createNodeView.js\";\r\nimport { loadBitmapFontGlyphTexture } from \"./bitmapFonts.js\";\r\nimport { sharedBitmapFontCache } from \"./cache.js\";\r\nimport { loadTexture } from \"./loadTexture.js\";\r\n\r\nexport type AssetUrlResolver = (asset: Asset) => string | undefined;\r\nexport type FileUrlResolver = (uri: string) => string | undefined;\r\ntype AtlasAsset = Extract<Asset, { type: \"atlas\" }>;\r\ntype BitmapFontAsset = Extract<Asset, { type: \"bitmapFont\" }>;\r\n\r\nexport { loadTexture };\r\n\r\n/** Loads and parses one atlas's Spritesheet, sharing the parse by the JSON file's URI. */\r\nexport async function loadAtlasSpritesheet(\r\n asset: AtlasAsset,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Spritesheet> = new Map(),\r\n): Promise<Spritesheet> {\r\n const cached = cache.get(asset.files.json.uri);\r\n if (cached !== undefined) return cached;\r\n\r\n const jsonUrl = resolveFileUrl(asset.files.json.uri);\r\n const textureUrl = resolveFileUrl(asset.files.texture.uri);\r\n if (jsonUrl === undefined || textureUrl === undefined) throw new Error(`Unable to resolve file URLs for atlas asset '${asset.id}'.`);\r\n\r\n const [data, texture] = await Promise.all([\r\n fetch(jsonUrl).then((response) => response.json() as Promise<SpritesheetData>),\r\n loadTexture(textureUrl),\r\n ]);\r\n const sheet = new Spritesheet(texture, data);\r\n await sheet.parse();\r\n cache.set(asset.files.json.uri, sheet);\r\n return sheet;\r\n}\r\n\r\n/** Loads textures for image nodes in a scene, resolving atlas frame ids through their Spritesheet. Leaves failed assets for placeholder rendering. */\r\nexport async function loadSceneTextures(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n resolveAssetUrl: AssetUrlResolver,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Texture> = new Map(),\r\n spritesheetCache: Map<string, Spritesheet> = new Map(),\r\n bitmapFontCache: Map<string, Promise<BitmapFont | undefined>> = sharedBitmapFontCache,\r\n): Promise<Map<string, Texture>> {\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\r\n const assetsById = new Map(document.assets.map((asset) => [asset.id, asset]));\r\n const framesById = new Map<string, { kind: \"atlas\"; atlas: AtlasAsset; frameName: string } | { kind: \"bitmapFont\"; bitmapFont: BitmapFontAsset; frameName: string }>();\r\n for (const asset of document.assets) {\r\n if (asset.type === \"atlas\") { for (const [frameName, frameId] of Object.entries(asset.frames)) framesById.set(frameId, { kind: \"atlas\", atlas: asset, frameName }); }\r\n else if (asset.type === \"bitmapFont\") { for (const [frameName, frameId] of Object.entries(asset.frames ?? {})) framesById.set(frameId, { kind: \"bitmapFont\", bitmapFont: asset, frameName }); }\r\n }\r\n\r\n const textures = new Map<string, Texture>();\r\n\r\n for (const node of collectRenderedNodes(document, scene)) {\r\n const effect = node.type === \"particle-emitter\" ? document.effects.find((candidate) => candidate.id === node.effectId) : undefined;\r\n for (const assetId of [...collectNodeAssetIds(node), ...(effect === undefined ? [] : collectEffectAssetIds(effect))]) {\r\n if (textures.has(assetId)) continue;\r\n\r\n const asset = assetsById.get(assetId);\r\n if (asset?.type === \"image\") {\r\n const url = resolveAssetUrl(asset);\r\n if (url === undefined) continue;\r\n try {\r\n const texture = cache.get(asset.source.uri) ?? await loadTexture(url);\r\n cache.set(asset.source.uri, texture);\r\n textures.set(asset.id, texture);\r\n } catch (error) {\r\n console.warn(`Unable to load texture for asset '${asset.id}'.`, error);\r\n }\r\n continue;\r\n }\r\n // Spine и atlas-ассеты сюда тоже попадают: spine-данные грузит loadSceneSpines, а atlas-фреймы резолвятся ниже.\r\n if (asset !== undefined) continue;\r\n\r\n const frame = framesById.get(assetId);\r\n if (frame === undefined) continue;\r\n try {\r\n if (frame.kind === \"atlas\") {\r\n const sheet = await loadAtlasSpritesheet(frame.atlas, resolveFileUrl, spritesheetCache);\r\n const frameTexture = sheet.textures[frame.frameName];\r\n if (frameTexture === undefined) { console.warn(`Atlas '${frame.atlas.id}' has no frame '${frame.frameName}'.`); continue; }\r\n textures.set(assetId, frameTexture);\r\n } else {\r\n const glyphTexture = await loadBitmapFontGlyphTexture(frame.bitmapFont, frame.frameName, resolveFileUrl, bitmapFontCache);\r\n if (glyphTexture === undefined) { console.warn(`Bitmap font '${frame.bitmapFont.id}' has no glyph '${frame.frameName}'.`); continue; }\r\n textures.set(assetId, glyphTexture);\r\n }\r\n } catch (error) {\r\n console.warn(`Unable to load frame texture for '${assetId}'.`, error);\r\n }\r\n }\r\n }\r\n\r\n return textures;\r\n}\r\n"]}
1
+ {"version":3,"file":"textures.js","sourceRoot":"","sources":["../../src/assets/textures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAoC,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAuD,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,0FAA0F;AAC1F,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAiB,EACjB,cAA+B,EAC/B,KAAK,GAA6B,IAAI,GAAG,EAAE;IAE3C,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAExC,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CA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rD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;wBAAC,OAAO,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,KAAK,CAAC,EAAE,mBAAmB,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC;wBAAC,SAAS;oBAAC,CAAC;oBAC3H,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;gBACtC,CAAC;qBAAM,CAAC;oBACN,MAAM,YAAY,GAAG,MAAM,0BAA0B,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;oBAC1H,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;wBAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,KAAK,CAAC,UAAU,CAAC,EAAE,mBAAmB,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC;wBAAC,SAAS;oBAAC,CAAC;oBACtI,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,qCAAqC,OAAO,IAAI,EAAE,KAAK,CAAC,CAAC;YACxE,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { collectEffectAssetIds, type Asset, type ProjectDocument } from \"@pixi-ui-editor/schema\";\r\nimport { Spritesheet, type BitmapFont, type Texture, type SpritesheetData } from \"pixi.js\";\r\nimport { collectRenderedNodes } from \"../scene.js\";\r\nimport { collectNodeAssetIds } from \"../views/createNodeView.js\";\r\nimport { loadBitmapFontGlyphTexture } from \"./bitmapFonts.js\";\r\nimport { sharedBitmapFontCache } from \"./cache.js\";\r\nimport { loadTexture } from \"./loadTexture.js\";\r\n\r\nexport type AssetUrlResolver = (asset: Asset) => string | undefined;\r\nexport type FileUrlResolver = (uri: string) => string | undefined;\r\ntype AtlasAsset = Extract<Asset, { type: \"atlas\" }>;\r\ntype BitmapFontAsset = Extract<Asset, { type: \"bitmapFont\" }>;\r\n\r\nexport { loadTexture };\r\n\r\n/** Loads and parses one atlas's Spritesheet, sharing the parse by the JSON file's URI. */\r\nexport async function loadAtlasSpritesheet(\r\n asset: AtlasAsset,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Spritesheet> = new Map(),\r\n): Promise<Spritesheet> {\r\n const cached = cache.get(asset.files.json.uri);\r\n if (cached !== undefined) return cached;\r\n\r\n const jsonUrl = resolveFileUrl(asset.files.json.uri);\r\n const textureUrl = resolveFileUrl(asset.files.texture.uri);\r\n if (jsonUrl === undefined || textureUrl === undefined) throw new Error(`Unable to resolve file URLs for atlas asset '${asset.id}'.`);\r\n\r\n const [data, texture] = await Promise.all([\r\n fetch(jsonUrl).then((response) => response.json() as Promise<SpritesheetData>),\r\n loadTexture(textureUrl),\r\n ]);\r\n const sheet = new Spritesheet(texture, data);\r\n await sheet.parse();\r\n cache.set(asset.files.json.uri, sheet);\r\n return sheet;\r\n}\r\n\r\n/** Loads textures for image nodes in a scene, resolving atlas frame ids through their Spritesheet. Leaves failed assets for placeholder rendering. */\r\nexport async function loadSceneTextures(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n resolveAssetUrl: AssetUrlResolver,\r\n resolveFileUrl: FileUrlResolver,\r\n cache: Map<string, Texture> = new Map(),\r\n spritesheetCache: Map<string, Spritesheet> = new Map(),\r\n bitmapFontCache: Map<string, Promise<BitmapFont | undefined>> = sharedBitmapFontCache,\r\n): Promise<Map<string, Texture>> {\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\r\n const assetsById = new Map(document.assets.map((asset) => [asset.id, asset]));\r\n const framesById = new Map<string, { kind: \"atlas\"; atlas: AtlasAsset; frameName: string } | { kind: \"bitmapFont\"; bitmapFont: BitmapFontAsset; frameName: string }>();\r\n for (const asset of document.assets) {\r\n if (asset.type === \"atlas\") { for (const [frameName, frameId] of Object.entries(asset.frames)) framesById.set(frameId, { kind: \"atlas\", atlas: asset, frameName }); }\r\n else if (asset.type === \"bitmapFont\") { for (const [frameName, frameId] of Object.entries(asset.frames ?? {})) framesById.set(frameId, { kind: \"bitmapFont\", bitmapFont: asset, frameName }); }\r\n }\r\n\r\n const textures = new Map<string, Texture>();\r\n\r\n for (const node of collectRenderedNodes(document, scene)) {\r\n const effect = node.type === \"particle-emitter\" ? document.effects.find((candidate) => candidate.id === node.effectId) : undefined;\r\n for (const assetId of [...collectNodeAssetIds(node), ...(effect === undefined ? [] : collectEffectAssetIds(effect))]) {\r\n if (textures.has(assetId)) continue;\r\n\r\n const asset = assetsById.get(assetId);\r\n if (asset?.type === \"image\") {\r\n const url = resolveAssetUrl(asset);\r\n if (url === undefined) continue;\r\n try {\r\n const texture = cache.get(asset.source.uri) ?? await loadTexture(url);\r\n cache.set(asset.source.uri, texture);\r\n textures.set(asset.id, texture);\r\n } catch (error) {\r\n console.warn(`Unable to load texture for asset '${asset.id}'.`, error);\r\n }\r\n continue;\r\n }\r\n // Spine и atlas-ассеты сюда тоже попадают: spine-данные грузит loadSceneSpines, а atlas-фреймы резолвятся ниже.\r\n if (asset !== undefined) continue;\r\n\r\n const frame = framesById.get(assetId);\r\n if (frame === undefined) continue;\r\n try {\r\n if (frame.kind === \"atlas\") {\r\n const sheet = await loadAtlasSpritesheet(frame.atlas, resolveFileUrl, spritesheetCache);\r\n const frameTexture = sheet.textures[frame.frameName];\r\n if (frameTexture === undefined) { console.warn(`Atlas '${frame.atlas.id}' has no frame '${frame.frameName}'.`); continue; }\r\n textures.set(assetId, frameTexture);\r\n } else {\r\n const glyphTexture = await loadBitmapFontGlyphTexture(frame.bitmapFont, frame.frameName, resolveFileUrl, bitmapFontCache);\r\n if (glyphTexture === undefined) { console.warn(`Bitmap font '${frame.bitmapFont.id}' has no glyph '${frame.frameName}'.`); continue; }\r\n textures.set(assetId, glyphTexture);\r\n }\r\n } catch (error) {\r\n console.warn(`Unable to load frame texture for '${assetId}'.`, error);\r\n }\r\n }\r\n }\r\n\r\n return textures;\r\n}\r\n"]}
@@ -24,8 +24,24 @@ export declare function setSliderViewValue(view: Container, value: number): void
24
24
  export declare function setProgressBarViewProgress(view: Container, progress: number): void;
25
25
  /** One-way sync from game code (or editor preview) into the widget: highlights a dot without emitting `onPageChange`. */
26
26
  export declare function setPaginationViewPage(view: Container, page: number): void;
27
- /** Rebuilds the widget's dots for a runtime-known page count, e.g. once actual content length is known. */
27
+ /**
28
+ * Rebuilds the widget's dots for a runtime-known page count, e.g. once actual content length is known.
29
+ * Ignored while the widget pages through authored `items`: there the item list already fixes the count.
30
+ */
28
31
  export declare function setPaginationViewPageCount(view: Container, pageCount: number): void;
32
+ /**
33
+ * Все элементы таблицы в порядке иерархии, включая скрытые вместимостью — «что вообще есть».
34
+ * Возвращает пустой список, если `view` не item-table.
35
+ */
36
+ export declare function getItemTableViewItems(view: Container): Container[];
37
+ /** Элементы, показанные прямо сейчас: столько, сколько влезает в текущем профиле. */
38
+ export declare function getItemTableViewVisibleItems(view: Container): Container[];
39
+ /** Один элемент по индексу — адресация, на которой игровой код раскладывает свои данные. */
40
+ export declare function getItemTableViewItem(view: Container, index: number): Container | undefined;
41
+ /** Транзиентно меняет вместимость; `undefined` возвращает авторское значение профиля. */
42
+ export declare function setItemTableViewVisibleCount(view: Container, count: number | undefined): void;
43
+ /** Показывает или прячет все элементы разом; `undefined` возвращает управление вместимости. */
44
+ export declare function setItemTableViewItemsVisible(view: Container, visible: boolean | undefined): void;
29
45
  /** Switches which direct child ("page") of a page group is shown; every other child is hidden. */
30
46
  export declare function setPageGroupViewPage(view: Container, page: number): void;
31
47
  /**
@@ -37,6 +53,14 @@ export declare function setPageGroupViewPage(view: Container, page: number): voi
37
53
  * if a `pagination` widget is showing this group's page count.
38
54
  */
39
55
  export declare function addPageGroupViewPage(view: Container, page: Container): number | undefined;
56
+ /**
57
+ * Fades a whole subtree by driving one opacity group, the cheap `CanvasGroup.alpha` equivalent: the
58
+ * value multiplies into every descendant through PixiJS `worldAlpha`, so animating a fade is one write
59
+ * per frame regardless of how many nodes are inside. The node's authored `opacity` stays untouched in
60
+ * the document; pass `undefined` to hand control back to it. Tweening itself belongs to game code —
61
+ * the runtime deliberately ships no animation engine, the same way `page-group` ships no swipe gesture.
62
+ */
63
+ export declare function setOpacityGroupViewOpacity(view: Container, opacity: number | undefined): void;
40
64
  /** Enables or pauses editor-only automatic playback without affecting serialized node data. */
41
65
  export declare function setSpineViewAutoplay(view: Container, autoplay: boolean): void;
42
66
  /** Activates authored bone/slot part connectors on one Spine node without mutating the document. */
@@ -1 +1 @@
1
- {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAgBpC,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CASnJ;AAED,kHAAkH;AAClH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CASrH;AAED,qGAAqG;AACrG,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,CAE/E;AAED,4GAA4G;AAC5G,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OA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;AAC/F,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAG7E;AAED,oGAAoG;AACpG,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAEnF;AAED,wFAAwF;AACxF,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,CAE1F"}
package/dist/controls.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { Spine } from "@esotericsoftware/spine-pixi-v8";
2
2
  import { ButtonNodeView } from "./views/ButtonNodeView.js";
3
3
  import { CheckboxNodeView } from "./views/CheckboxNodeView.js";
4
+ import { ItemTableNodeView } from "./views/ItemTableNodeView.js";
4
5
  import { PageGroupNodeView } from "./views/PageGroupNodeView.js";
5
6
  import { PaginationNodeView } from "./views/PaginationNodeView.js";
6
7
  import { StagedButtonNodeView } from "./views/StagedButtonNodeView.js";
7
- import { ImageNodeView } from "./views/basic.js";
8
+ import { ImageNodeView, OpacityGroupNodeView } from "./views/basic.js";
8
9
  import { NodeView } from "./views/NodeView.js";
9
10
  import { ProgressBarNodeView, SliderNodeView } from "./views/ValueControlNodeViews.js";
10
11
  import { SpineNodeView } from "./views/SpineNodeView.js";
@@ -77,11 +78,39 @@ export function setPaginationViewPage(view, page) {
77
78
  if (view instanceof PaginationNodeView)
78
79
  view.page = page;
79
80
  }
80
- /** Rebuilds the widget's dots for a runtime-known page count, e.g. once actual content length is known. */
81
+ /**
82
+ * Rebuilds the widget's dots for a runtime-known page count, e.g. once actual content length is known.
83
+ * Ignored while the widget pages through authored `items`: there the item list already fixes the count.
84
+ */
81
85
  export function setPaginationViewPageCount(view, pageCount) {
82
86
  if (view instanceof PaginationNodeView)
83
87
  view.pageCount = pageCount;
84
88
  }
89
+ /**
90
+ * Все элементы таблицы в порядке иерархии, включая скрытые вместимостью — «что вообще есть».
91
+ * Возвращает пустой список, если `view` не item-table.
92
+ */
93
+ export function getItemTableViewItems(view) {
94
+ return view instanceof ItemTableNodeView ? view.items : [];
95
+ }
96
+ /** Элементы, показанные прямо сейчас: столько, сколько влезает в текущем профиле. */
97
+ export function getItemTableViewVisibleItems(view) {
98
+ return view instanceof ItemTableNodeView ? view.visibleItems : [];
99
+ }
100
+ /** Один элемент по индексу — адресация, на которой игровой код раскладывает свои данные. */
101
+ export function getItemTableViewItem(view, index) {
102
+ return view instanceof ItemTableNodeView ? view.itemAt(index) : undefined;
103
+ }
104
+ /** Транзиентно меняет вместимость; `undefined` возвращает авторское значение профиля. */
105
+ export function setItemTableViewVisibleCount(view, count) {
106
+ if (view instanceof ItemTableNodeView)
107
+ view.visibleCount = count;
108
+ }
109
+ /** Показывает или прячет все элементы разом; `undefined` возвращает управление вместимости. */
110
+ export function setItemTableViewItemsVisible(view, visible) {
111
+ if (view instanceof ItemTableNodeView)
112
+ view.setItemsVisible(visible);
113
+ }
85
114
  /** Switches which direct child ("page") of a page group is shown; every other child is hidden. */
86
115
  export function setPageGroupViewPage(view, page) {
87
116
  if (view instanceof PageGroupNodeView)
@@ -98,6 +127,17 @@ export function setPageGroupViewPage(view, page) {
98
127
  export function addPageGroupViewPage(view, page) {
99
128
  return view instanceof PageGroupNodeView ? view.addPage(page) : undefined;
100
129
  }
130
+ /**
131
+ * Fades a whole subtree by driving one opacity group, the cheap `CanvasGroup.alpha` equivalent: the
132
+ * value multiplies into every descendant through PixiJS `worldAlpha`, so animating a fade is one write
133
+ * per frame regardless of how many nodes are inside. The node's authored `opacity` stays untouched in
134
+ * the document; pass `undefined` to hand control back to it. Tweening itself belongs to game code —
135
+ * the runtime deliberately ships no animation engine, the same way `page-group` ships no swipe gesture.
136
+ */
137
+ export function setOpacityGroupViewOpacity(view, opacity) {
138
+ if (view instanceof OpacityGroupNodeView)
139
+ view.setOpacity(opacity);
140
+ }
101
141
  /** Enables or pauses editor-only automatic playback without affecting serialized node data. */
102
142
  export function setSpineViewAutoplay(view, autoplay) {
103
143
  const spine = findSpineChild(view);
@@ -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,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,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,YAA0B,EAAE,SAAiB;IACjG,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,YAAY,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,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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 { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\r\nimport { PaginationNodeView } from \"./views/PaginationNodeView.js\";\r\nimport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\r\nimport { ImageNodeView } 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/** Rebuilds the widget's dots for a runtime-known page count, e.g. once actual content length is known. */\r\nexport function setPaginationViewPageCount(view: Container, pageCount: number): void {\r\n if (view instanceof PaginationNodeView) view.pageCount = pageCount;\r\n}\r\n\r\n/** Switches which direct child (\"page\") of a page group is shown; every other child is hidden. */\r\nexport function setPageGroupViewPage(view: Container, page: number): void {\r\n if (view instanceof PageGroupNodeView) view.page = page;\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/** 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,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,EAA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AAM,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. */\r\nexport function setPageGroupViewPage(view: Container, page: number): void {\r\n if (view instanceof PageGroupNodeView) view.page = page;\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 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEtF,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,QAAQ,CAAC,IAAI,kBAAkB;gBAEnB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAEnE;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAOtE"}
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEtF,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,QAAQ,CAAC,IAAI,kBAAkB;IAE/B,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAGlD;CACF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAEnE;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAOtE"}
package/dist/index.d.ts CHANGED
@@ -15,13 +15,14 @@ export { ScrollViewNodeView } from "./views/ScrollViewNodeView.js";
15
15
  export { SpineNodeView } from "./views/SpineNodeView.js";
16
16
  export { ProgressBarNodeView, SliderNodeView } from "./views/ValueControlNodeViews.js";
17
17
  export { PaginationNodeView } from "./views/PaginationNodeView.js";
18
+ export { ItemTableNodeView } from "./views/ItemTableNodeView.js";
18
19
  export { PageGroupNodeView } from "./views/PageGroupNodeView.js";
19
20
  export { ParticleEmitterNodeView } from "./views/ParticleEmitterNodeView.js";
20
21
  export * from "./particles.js";
21
22
  export { collectNodeAssetIds } from "./views/createNodeView.js";
22
23
  export { SceneLocalization } from "./localization.js";
23
24
  export type { SceneLocalizationOptions } from "./localization.js";
24
- export { BitmapTextNodeView, ImageNodeView, MaskNodeView, TextNodeView } from "./views/basic.js";
25
+ export { BitmapTextNodeView, ImageNodeView, MaskNodeView, OpacityGroupNodeView, TextNodeView } from "./views/basic.js";
25
26
  export type { BuildSceneViewOptions, PrefabViewConfiguration, SceneViewResult } from "./scene.js";
26
27
  export { buildPrefabView, buildSceneView, collectRenderedNodes, loadPrefabView, previewNodeView, updateNodeView, updateParticleEmitters, loadSceneView } from "./scene.js";
27
28
  export * from "./controls.js";
@@ -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,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AM,mBAAmB,CAAC;AAC1D,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -13,12 +13,13 @@ export { ScrollViewNodeView } from "./views/ScrollViewNodeView.js";
13
13
  export { SpineNodeView } from "./views/SpineNodeView.js";
14
14
  export { ProgressBarNodeView, SliderNodeView } from "./views/ValueControlNodeViews.js";
15
15
  export { PaginationNodeView } from "./views/PaginationNodeView.js";
16
+ export { ItemTableNodeView } from "./views/ItemTableNodeView.js";
16
17
  export { PageGroupNodeView } from "./views/PageGroupNodeView.js";
17
18
  export { ParticleEmitterNodeView } from "./views/ParticleEmitterNodeView.js";
18
19
  export * from "./particles.js";
19
20
  export { collectNodeAssetIds } from "./views/createNodeView.js";
20
21
  export { SceneLocalization } from "./localization.js";
21
- export { BitmapTextNodeView, ImageNodeView, MaskNodeView, TextNodeView } from "./views/basic.js";
22
+ export { BitmapTextNodeView, ImageNodeView, MaskNodeView, OpacityGroupNodeView, TextNodeView } from "./views/basic.js";
22
23
  export { buildPrefabView, buildSceneView, collectRenderedNodes, loadPrefabView, previewNodeView, updateNodeView, updateParticleEmitters, loadSceneView } from "./scene.js";
23
24
  export * from "./controls.js";
24
25
  export { createSceneAssetCache } from "./assets/cache.js";
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,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,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEjG,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 { 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, 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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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 +1 @@
1
- {"version":3,"file":"layoutGroups.d.ts","sourceRoot":"","sources":["../src/layoutGroups.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAmE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAClK,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAqD,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjG,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,iHAAiH;AACjH,wBAAgB,oBAAoB,IAAI,IAAI,CAAkE;AAe9G,kHAAkH;AAClH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,CAAC,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,UAAU,GAAG,IAAI,CAkC1J;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;IAKpC,QAAQ,CAAC,QAAQ,EAAE,QAAQ;IAAE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;IAJ1E,OAAO,CAAC,IAAI,CAAC,CAAS;IACtB,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,YAAY,CAAuC;gBAEtC,QAAQ,EAAE,QAAQ,EAAmB,eAAe,CAAC,GAAE,MAAM,IAAI,aAAA;IAMtF,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,GAAG,IAAI;I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