@pixi-ui-editor/runtime-pixi 0.5.0 → 0.6.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 (76) hide show
  1. package/dist/SceneViewport.js.map +1 -1
  2. package/dist/assets/bitmapFonts.js.map +1 -1
  3. package/dist/assets/cache.js.map +1 -1
  4. package/dist/assets/fonts.js.map +1 -1
  5. package/dist/assets/loadTexture.js.map +1 -1
  6. package/dist/assets/sounds.js.map +1 -1
  7. package/dist/assets/spine.js.map +1 -1
  8. package/dist/assets/textures.js.map +1 -1
  9. package/dist/controls.d.ts +19 -0
  10. package/dist/controls.d.ts.map +1 -1
  11. package/dist/controls.js +40 -0
  12. package/dist/controls.js.map +1 -1
  13. package/dist/document.js.map +1 -1
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +3 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/layout.js.map +1 -1
  19. package/dist/layoutGroups.js.map +1 -1
  20. package/dist/localization.js.map +1 -1
  21. package/dist/pageGroup.d.ts +17 -0
  22. package/dist/pageGroup.d.ts.map +1 -0
  23. package/dist/pageGroup.js +20 -0
  24. package/dist/pageGroup.js.map +1 -0
  25. package/dist/particles.js.map +1 -1
  26. package/dist/scene.d.ts.map +1 -1
  27. package/dist/scene.js +23 -0
  28. package/dist/scene.js.map +1 -1
  29. package/dist/scrollView.js.map +1 -1
  30. package/dist/views/ButtonNodeView.js.map +1 -1
  31. package/dist/views/CheckboxNodeView.js.map +1 -1
  32. package/dist/views/InputNodeView.js.map +1 -1
  33. package/dist/views/NodeView.js.map +1 -1
  34. package/dist/views/PageGroupNodeView.d.ts +42 -0
  35. package/dist/views/PageGroupNodeView.d.ts.map +1 -0
  36. package/dist/views/PageGroupNodeView.js +72 -0
  37. package/dist/views/PageGroupNodeView.js.map +1 -0
  38. package/dist/views/PaginationNodeView.d.ts +59 -0
  39. package/dist/views/PaginationNodeView.d.ts.map +1 -0
  40. package/dist/views/PaginationNodeView.js +238 -0
  41. package/dist/views/PaginationNodeView.js.map +1 -0
  42. package/dist/views/ParticleEmitterNodeView.js.map +1 -1
  43. package/dist/views/ScrollViewNodeView.js.map +1 -1
  44. package/dist/views/SpineNodeView.d.ts +23 -2
  45. package/dist/views/SpineNodeView.d.ts.map +1 -1
  46. package/dist/views/SpineNodeView.js +131 -2
  47. package/dist/views/SpineNodeView.js.map +1 -1
  48. package/dist/views/StagedButtonNodeView.js.map +1 -1
  49. package/dist/views/ValueControlNodeViews.js.map +1 -1
  50. package/dist/views/basic.d.ts.map +1 -1
  51. package/dist/views/basic.js +3 -1
  52. package/dist/views/basic.js.map +1 -1
  53. package/dist/views/createNodeView.d.ts.map +1 -1
  54. package/dist/views/createNodeView.js +9 -0
  55. package/dist/views/createNodeView.js.map +1 -1
  56. package/package.json +5 -3
  57. package/dist/assets/spine.test.d.ts +0 -2
  58. package/dist/assets/spine.test.d.ts.map +0 -1
  59. package/dist/assets/spine.test.js +0 -42
  60. package/dist/assets/spine.test.js.map +0 -1
  61. package/dist/index.test.d.ts +0 -2
  62. package/dist/index.test.d.ts.map +0 -1
  63. package/dist/index.test.js +0 -485
  64. package/dist/index.test.js.map +0 -1
  65. package/dist/particles.test.d.ts +0 -2
  66. package/dist/particles.test.d.ts.map +0 -1
  67. package/dist/particles.test.js +0 -210
  68. package/dist/particles.test.js.map +0 -1
  69. package/dist/test.setup.d.ts +0 -2
  70. package/dist/test.setup.d.ts.map +0 -1
  71. package/dist/test.setup.js +0 -6
  72. package/dist/test.setup.js.map +0 -1
  73. package/dist/views/ParticleEmitterNodeView.test.d.ts +0 -2
  74. package/dist/views/ParticleEmitterNodeView.test.d.ts.map +0 -1
  75. package/dist/views/ParticleEmitterNodeView.test.js +0 -148
  76. package/dist/views/ParticleEmitterNodeView.test.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SceneViewport.js","sourceRoot":"","sources":["../src/SceneViewport.ts"],"names":[],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,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAwC,MAAM,aAAa,CAAC;AAEtF;;;;;;GAMG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IACjC,iBAAiB,CAAa;IAC9B,OAAO,CAAY;IAE5B,YAAY,OAAkB,EAAE,iBAA6B,EAAE,IAAa;QAC1E,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,iBAAiB,GAAG,EAAE,GAAG,iBAAiB,EAAE,CAAC;QAElD,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,YAAY,GAAG,IAAI,QAAQ,EAAE;iBAChC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC;iBAC7D,IAAI,CAAC,QAAQ,CAAC,CAAC;YAClB,YAAY,CAAC,SAAS,GAAG,MAAM,CAAC;YAChC,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC;YAC5B,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC9B,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,sFAAsF;IACtF,MAAM,CAAC,IAAgB;QACrB,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAC/D,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { Container, Graphics } from \"pixi.js\";\nimport { fitViewportToHost, type FittedViewport, type LayoutSize } from \"./layout.js\";\n\n/**\n * The single host boundary for a built scene.\n *\n * Runtime scenes are clipped to the authored reference viewport and can only be fitted with one\n * uniform scale. Authoring scenes use the same wrapper without clipping so the editor can expose\n * off-viewport content while arranging it.\n */\nexport class SceneViewport extends Container {\n readonly referenceViewport: LayoutSize;\n readonly content: Container;\n\n constructor(content: Container, referenceViewport: LayoutSize, clip: boolean) {\n super();\n this.content = content;\n this.referenceViewport = { ...referenceViewport };\n\n if (clip) {\n const viewportMask = new Graphics()\n .rect(0, 0, referenceViewport.width, referenceViewport.height)\n .fill(0xffffff);\n viewportMask.eventMode = \"none\";\n content.mask = viewportMask;\n this.addChild(viewportMask);\n }\n\n this.addChild(content);\n }\n\n /** Uniformly contains and centers this authored viewport inside the physical host. */\n resize(host: LayoutSize): FittedViewport {\n const fitted = fitViewportToHost(this.referenceViewport, host);\n this.scale.set(fitted.scale);\n this.position.set(fitted.x, fitted.y);\n return fitted;\n }\n}\n"]}
@@ -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,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EA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;;;;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 +1 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/assets/cache.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,EAAuC,CAAC;AAE9E,gHAAgH;AAChH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAA2C,CAAC;AAExF,sHAAsH;AACtH,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,QAAQ,EAAE,IAAI,GAAG,EAAE;QACnB,YAAY,EAAE,IAAI,GAAG,EAAE;QACvB,MAAM,EAAE,IAAI,GAAG,EAAE;QACjB,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,qBAAqB;QAClC,MAAM,EAAE,IAAI,GAAG,EAAE;KAClB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/assets/cache.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,EAAuC,CAAC;AAE9E,gHAAgH;AAChH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAA2C,CAAC;AAExF,sHAAsH;AACtH,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,QAAQ,EAAE,IAAI,GAAG,EAAE;QACnB,YAAY,EAAE,IAAI,GAAG,EAAE;QACvB,MAAM,EAAE,IAAI,GAAG,EAAE;QACjB,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,qBAAqB;QAClC,MAAM,EAAE,IAAI,GAAG,EAAE;KAClB,CAAC;AACJ,CAAC","sourcesContent":["import type { SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport type { Sound } from \"@pixi/sound\";\r\nimport type { BitmapFont, Spritesheet, Texture } from \"pixi.js\";\r\n\r\n/**\r\n * Разобранные ассеты, переиспользуемые между загрузками сцен и пресетов. Каждая карта ключуется URI\r\n * файла ассета, а не его id: один и тот же файл, назначенный разным ассетам, скачивается и парсится один раз.\r\n *\r\n * Владелец кэша — вызывающая сторона: время жизни задаёт она (сессия сцены в игре, открытый проект в\r\n * редакторе), поэтому глобального состояния и скрытого сброса здесь нет.\r\n */\r\nexport interface SceneAssetCache {\r\n textures: Map<string, Texture>;\r\n spritesheets: Map<string, Spritesheet>;\r\n spines: Map<string, SkeletonData>;\r\n /** Обещание, а не готовое имя family: параллельные загрузки одного файла должны ждать один и тот же `FontFace.load()`. */\r\n fonts: Map<string, Promise<string | undefined>>;\r\n /** Обещание, а не готовый `BitmapFont`: по той же причине, что `fonts` — см. ниже. */\r\n bitmapFonts: Map<string, Promise<BitmapFont | undefined>>;\r\n sounds: Map<string, Sound>;\r\n}\r\n\r\n/**\r\n * Шрифты кэшируются глобально, потому что `loadSceneFonts` регистрирует `FontFace` в общем для документа\r\n * `document.fonts`: повторная загрузка того же файла добавила бы туда дубликат, независимо от того, чей\r\n * это кэш. Остальные ассеты живут в GPU-памяти вызывающей стороны и такого общего реестра не имеют.\r\n */\r\nexport const sharedFontCache = new Map<string, Promise<string | undefined>>();\r\n\r\n/** Та же причина, что у `sharedFontCache`: `loadSceneBitmapFonts` регистрирует шрифт в общем PixiJS `Cache`. */\r\nexport const sharedBitmapFontCache = new Map<string, Promise<BitmapFont | undefined>>();\r\n\r\n/** Создаёт пустой кэш ассетов. Шрифты по умолчанию разделяются со всеми остальными кэшами — см. `sharedFontCache`. */\r\nexport function createSceneAssetCache(): SceneAssetCache {\r\n return {\r\n textures: new Map(),\r\n spritesheets: new Map(),\r\n spines: new Map(),\r\n fonts: sharedFontCache,\r\n bitmapFonts: sharedBitmapFontCache,\r\n sounds: new Map(),\r\n };\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,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,WAAW;QAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC7F,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,cAAc,EAAE,WAAW;QAAE,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACzG,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC,CAAC;AAEH,8GAA8G;AAC9G,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAyB,EACzB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AAC,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":"loadTexture.js","sourceRoot":"","sources":["../../src/assets/loadTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;;GAIG;AAEH,0DAA0D;AAC1D,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW;IAC3C,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;IAC1B,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;IAChB,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC;IACrB,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
1
+ {"version":3,"file":"loadTexture.js","sourceRoot":"","sources":["../../src/assets/loadTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;;GAIG;AAEH,0DAA0D;AAC1D,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW;IAC3C,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;IAC1B,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;IAChB,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC;IACrB,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import { Texture } from \"pixi.js\";\r\n\r\n/**\r\n * Its own module (not `textures.ts`) so `textures.ts` and `bitmapFonts.ts` can both depend on it\r\n * without importing from each other: `textures.ts` resolves bitmap font glyph frames through\r\n * `bitmapFonts.ts`, which itself needs this same texture loader.\r\n */\r\n\r\n/** Loads one texture from a data URI or a regular URL. */\r\nexport async function loadTexture(url: string): Promise<Texture> {\r\n const image = new Image();\r\n image.src = url;\r\n await image.decode();\r\n return Texture.from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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,EA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AM,KAAK,GAAG,IAAI,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACzC,IAAI,YAA0B,CAAC;IAC/B,IAAI,CAAC;QACH,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACnG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,WAAW,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAC;QACtD,OAAO,CAAC,KAAK,CAAC,gBAAgB,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,EAAE,0BAA0B,WAAW,EAAE,CAAC,CAAC;QAC/F,MAAM,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,oBAA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AAC,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"]}
@@ -22,6 +22,25 @@ export declare function previewNineSlice(view: Container, nineSlice: LayoutPaddi
22
22
  export declare function setSliderViewValue(view: Container, value: number): void;
23
23
  /** Applies an editor-only progress preview without touching the document. */
24
24
  export declare function setProgressBarViewProgress(view: Container, progress: number): void;
25
+ /** One-way sync from game code (or editor preview) into the widget: highlights a dot without emitting `onPageChange`. */
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. */
28
+ export declare function setPaginationViewPageCount(view: Container, pageCount: number): void;
29
+ /** Switches which direct child ("page") of a page group is shown; every other child is hidden. */
30
+ export declare function setPageGroupViewPage(view: Container, page: number): void;
31
+ /**
32
+ * Appends a page built at runtime (e.g. the `root` from `buildPrefabView`/`loadPrefabView`, or any
33
+ * hand-built `Container`) after the last one — for a dataset that grows during play (a spin history
34
+ * list, a chat log, ...) rather than one fully known at authoring time. Fits the page to the group's
35
+ * current rectangle and hides it until switched to. Returns the new page's index, or `undefined` if
36
+ * `view` is not a page group. Keep `setPaginationViewPageCount` in sync with the resulting `pageCount`
37
+ * if a `pagination` widget is showing this group's page count.
38
+ */
39
+ export declare function addPageGroupViewPage(view: Container, page: Container): number | undefined;
25
40
  /** Enables or pauses editor-only automatic playback without affecting serialized node data. */
26
41
  export declare function setSpineViewAutoplay(view: Container, autoplay: boolean): void;
42
+ /** Activates authored bone/slot part connectors on one Spine node without mutating the document. */
43
+ export declare function setSpineConnectorBonesActive(view: Container, active: boolean): void;
44
+ /** Reasserts active connector matrices after a host performs live node-view updates. */
45
+ export declare function refreshSpineConnectorBones(nodeViews: ReadonlyMap<string, Container>): void;
27
46
  //# sourceMappingURL=controls.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,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iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEvE;AAED,6EAA6E;AAC7E,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAElF;AAED,yHAAyH;AACzH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAEzE;AAED,2GAA2G;AAC3G,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAEnF;AAED,kGAAkG;AAClG,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAExE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAEzF;AAED,+FAA+F;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,13 @@
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 { PageGroupNodeView } from "./views/PageGroupNodeView.js";
5
+ import { PaginationNodeView } from "./views/PaginationNodeView.js";
4
6
  import { StagedButtonNodeView } from "./views/StagedButtonNodeView.js";
5
7
  import { ImageNodeView } from "./views/basic.js";
6
8
  import { NodeView } from "./views/NodeView.js";
7
9
  import { ProgressBarNodeView, SliderNodeView } from "./views/ValueControlNodeViews.js";
10
+ import { SpineNodeView } from "./views/SpineNodeView.js";
8
11
  function findSpineChild(view) {
9
12
  if (view instanceof NodeView)
10
13
  return view.getSpine();
@@ -69,10 +72,47 @@ export function setProgressBarViewProgress(view, progress) {
69
72
  if (view instanceof ProgressBarNodeView)
70
73
  view.progress = progress;
71
74
  }
75
+ /** One-way sync from game code (or editor preview) into the widget: highlights a dot without emitting `onPageChange`. */
76
+ export function setPaginationViewPage(view, page) {
77
+ if (view instanceof PaginationNodeView)
78
+ view.page = page;
79
+ }
80
+ /** Rebuilds the widget's dots for a runtime-known page count, e.g. once actual content length is known. */
81
+ export function setPaginationViewPageCount(view, pageCount) {
82
+ if (view instanceof PaginationNodeView)
83
+ view.pageCount = pageCount;
84
+ }
85
+ /** Switches which direct child ("page") of a page group is shown; every other child is hidden. */
86
+ export function setPageGroupViewPage(view, page) {
87
+ if (view instanceof PageGroupNodeView)
88
+ view.page = page;
89
+ }
90
+ /**
91
+ * Appends a page built at runtime (e.g. the `root` from `buildPrefabView`/`loadPrefabView`, or any
92
+ * hand-built `Container`) after the last one — for a dataset that grows during play (a spin history
93
+ * list, a chat log, ...) rather than one fully known at authoring time. Fits the page to the group's
94
+ * current rectangle and hides it until switched to. Returns the new page's index, or `undefined` if
95
+ * `view` is not a page group. Keep `setPaginationViewPageCount` in sync with the resulting `pageCount`
96
+ * if a `pagination` widget is showing this group's page count.
97
+ */
98
+ export function addPageGroupViewPage(view, page) {
99
+ return view instanceof PageGroupNodeView ? view.addPage(page) : undefined;
100
+ }
72
101
  /** Enables or pauses editor-only automatic playback without affecting serialized node data. */
73
102
  export function setSpineViewAutoplay(view, autoplay) {
74
103
  const spine = findSpineChild(view);
75
104
  if (spine !== undefined)
76
105
  spine.autoUpdate = autoplay;
77
106
  }
107
+ /** Activates authored bone/slot part connectors on one Spine node without mutating the document. */
108
+ export function setSpineConnectorBonesActive(view, active) {
109
+ if (view instanceof SpineNodeView)
110
+ view.activeConnectorBones = active;
111
+ }
112
+ /** Reasserts active connector matrices after a host performs live node-view updates. */
113
+ export function refreshSpineConnectorBones(nodeViews) {
114
+ for (const view of nodeViews.values())
115
+ if (view instanceof SpineNodeView && view.activeConnectorBones)
116
+ view.refreshConnectorBones();
117
+ }
78
118
  //# sourceMappingURL=controls.js.map
@@ -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,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;AAEvF,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,CA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AI,CAAC,SAAS,GAAG,SAAS,CAAC;AACrE,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,oBAAoB,CAAC,IAAe,EAAE,IAAY;IAChE,IAAI,IAAI,YAAY,iBAAiB;QAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AAC1D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAe,EAAE,IAAe;IACnE,OAAO,IAAI,YAAY,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5E,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,oBAAoB,CAAC,IAAe,EAAE,QAAiB;IACrE,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;AACvD,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,4BAA4B,CAAC,IAAe,EAAE,MAAe;IAC3E,IAAI,IAAI,YAAY,aAAa;QAAE,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC;AACxE,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,0BAA0B,CAAC,SAAyC;IAClF,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,MAAM,EAAE;QAAE,IAAI,IAAI,YAAY,aAAa,IAAI,IAAI,CAAC,oBAAoB;YAAE,IAAI,CAAC,qBAAqB,EAAE,CAAC;AACtI,CAAC","sourcesContent":["import { type SkeletonData, Spine } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport { type ButtonStateKey, type LayoutPadding } from \"@pixi-ui-editor/schema\";\r\nimport { Container } from \"pixi.js\";\r\nimport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\r\nimport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\r\nimport { 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 +1 @@
1
- {"version":3,"file":"document.js","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAwB,MAAM,wBAAwB,CAAC;AAEtF,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAC7C,IAAI,GAAG,cAAc,CAAC;IAE/B,YAAY,OAAe,EAAE,OAAsB;QACjD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAC9C,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACnD,IAAI,CAAC;QACH,OAAO,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,WAAW;YAAE,MAAM,IAAI,6BAA6B,CAAC,uCAAuC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrI,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"document.js","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAwB,MAAM,wBAAwB,CAAC;AAEtF,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAC7C,IAAI,GAAG,cAAc,CAAC;IAE/B,YAAY,OAAe,EAAE,OAAsB;QACjD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAC9C,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACnD,IAAI,CAAC;QACH,OAAO,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,WAAW;YAAE,MAAM,IAAI,6BAA6B,CAAC,uCAAuC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrI,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { migrateProjectDocument, type ProjectDocument } from \"@pixi-ui-editor/schema\";\r\n\r\nexport class ProjectDocumentJsonParseError extends Error {\r\n readonly code = \"INVALID_JSON\";\r\n\r\n constructor(message: string, options?: ErrorOptions) {\r\n super(message, options);\r\n this.name = \"ProjectDocumentJsonParseError\";\r\n }\r\n}\r\n\r\nexport function loadProjectDocument(input: unknown): ProjectDocument {\r\n return migrateProjectDocument(input);\r\n}\r\n\r\nexport function parseProjectDocumentJson(json: string): ProjectDocument {\r\n try {\r\n return loadProjectDocument(JSON.parse(json));\r\n } catch (error) {\r\n if (error instanceof SyntaxError) throw new ProjectDocumentJsonParseError(\"Unable to parse ProjectDocument JSON.\", { cause: error });\r\n throw error;\r\n }\r\n}\r\n"]}
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from "./layout.js";
5
5
  export { SceneViewport } from "./SceneViewport.js";
6
6
  export * from "./layoutGroups.js";
7
7
  export * from "./scrollView.js";
8
+ export * from "./pageGroup.js";
8
9
  export * from "./views/NodeView.js";
9
10
  export { ButtonNodeView } from "./views/ButtonNodeView.js";
10
11
  export { StagedButtonNodeView } from "./views/StagedButtonNodeView.js";
@@ -13,6 +14,8 @@ export { InputNodeView } from "./views/InputNodeView.js";
13
14
  export { ScrollViewNodeView } from "./views/ScrollViewNodeView.js";
14
15
  export { SpineNodeView } from "./views/SpineNodeView.js";
15
16
  export { ProgressBarNodeView, SliderNodeView } from "./views/ValueControlNodeViews.js";
17
+ export { PaginationNodeView } from "./views/PaginationNodeView.js";
18
+ export { PageGroupNodeView } from "./views/PageGroupNodeView.js";
16
19
  export { ParticleEmitterNodeView } from "./views/ParticleEmitterNodeView.js";
17
20
  export * from "./particles.js";
18
21
  export { collectNodeAssetIds } from "./views/createNodeView.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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AAC7E,YAAY,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClG,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;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
@@ -3,6 +3,7 @@ export * from "./layout.js";
3
3
  export { SceneViewport } from "./SceneViewport.js";
4
4
  export * from "./layoutGroups.js";
5
5
  export * from "./scrollView.js";
6
+ export * from "./pageGroup.js";
6
7
  export * from "./views/NodeView.js";
7
8
  export { ButtonNodeView } from "./views/ButtonNodeView.js";
8
9
  export { StagedButtonNodeView } from "./views/StagedButtonNodeView.js";
@@ -11,6 +12,8 @@ export { InputNodeView } from "./views/InputNodeView.js";
11
12
  export { ScrollViewNodeView } from "./views/ScrollViewNodeView.js";
12
13
  export { SpineNodeView } from "./views/SpineNodeView.js";
13
14
  export { ProgressBarNodeView, SliderNodeView } from "./views/ValueControlNodeViews.js";
15
+ export { PaginationNodeView } from "./views/PaginationNodeView.js";
16
+ export { PageGroupNodeView } from "./views/PageGroupNodeView.js";
14
17
  export { ParticleEmitterNodeView } from "./views/ParticleEmitterNodeView.js";
15
18
  export * from "./particles.js";
16
19
  export { collectNodeAssetIds } from "./views/createNodeView.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;AAC9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ClC,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 { 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 +1 @@
1
- {"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS;IAC7F,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;CAC1F,CAAC;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,CAAC;AAEvD,wGAAwG;AACxG,MAAM,UAAU,iBAAiB,CAAC,QAAoB,EAAE,IAAgB;IACtE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnF,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;IACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC;IACvC,OAAO;QACL,KAAK;QACL,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC;QAC3B,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC;QAC7B,KAAK;QACL,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,UAAsB,EACtB,mBAA+B,EAC/B,kBAAkB,GAAG,mCAAmC;IAExD,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,GAAG,mBAAmB,CAAC,KAAK,CAAC;IA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AAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC9C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;QACnF,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE;QAClE,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC","sourcesContent":["import { type LayoutProfileId, type ProjectDocument, type SpineReferenceFrame, type TextNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\r\n\r\nexport type ResolvedProfileTransform = {\r\n transform: UINode[\"transform\"];\r\n visible: boolean;\r\n};\r\n\r\nexport type LayoutSize = { width: number; height: number };\n\nexport type FittedViewport = {\n scale: number;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\r\ntype SpineNode = Extract<UINode, { type: \"spine\" }>;\r\nexport type ResolvedSpineSettings = { animation: string | undefined; autoplay: boolean; loop: boolean; animationSpeed: number };\r\n\r\nexport const DEFAULT_TEXT_STYLE: TextStyleDefinition = {\r\n fontFamily: \"Arial\", fontSize: 24, fontWeight: \"normal\", fontStyle: \"normal\", fill: \"#FFFFFF\",\r\n align: \"left\", verticalAlign: \"top\", wordWrap: false, breakWords: false, letterSpacing: 0,\r\n};\r\n\r\nexport const CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT = 0.5;\n\n/** Uniformly contains an authored viewport inside a physical host without changing its aspect ratio. */\nexport function fitViewportToHost(viewport: LayoutSize, host: LayoutSize): FittedViewport {\n const scale = Math.min(host.width / viewport.width, host.height / viewport.height);\n const width = viewport.width * scale;\n const height = viewport.height * scale;\n return {\n scale,\n x: (host.width - width) / 2,\n y: (host.height - height) / 2,\n width,\n height,\n };\n}\n\r\n/**\r\n * Unity Canvas Scaler's `Scale With Screen Size / Match Width Or Height` calculation.\r\n * Width and height are blended in logarithmic space, producing one uniform scale for the Canvas.\r\n */\r\nexport function getCanvasScale(\r\n screenSize: LayoutSize,\r\n referenceResolution: LayoutSize,\r\n matchWidthOrHeight = CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT,\r\n): number {\r\n const widthScale = screenSize.width / referenceResolution.width;\r\n const heightScale = screenSize.height / referenceResolution.height;\r\n const logWidth = Math.log2(widthScale);\r\n const logHeight = Math.log2(heightScale);\r\n return 2 ** (logWidth + (logHeight - logWidth) * matchWidthOrHeight);\r\n}\r\n\r\n/** Logical RectTransform space exposed by a scaled Canvas at the current screen aspect ratio. */\r\nexport function getCanvasLogicalSize(screenSize: LayoutSize, referenceResolution: LayoutSize): LayoutSize {\r\n const scale = getCanvasScale(screenSize, referenceResolution);\r\n return { width: screenSize.width / scale, height: screenSize.height / scale };\r\n}\r\n\r\n/** Resolves a node's base transform with a profile override applied field by field. */\r\nexport function resolveProfileTransform(node: UINode, profile: LayoutProfileId): ResolvedProfileTransform {\r\n const override = node.layoutOverrides?.[profile];\r\n\r\n return {\r\n transform: { ...node.transform, ...override?.transform },\r\n visible: override?.visible ?? node.visible,\r\n };\r\n}\r\n\r\n/** Resolves a text node's optional base style with the active profile's sparse style override. */\r\nexport function resolveTextStyle(node: TextNode, profile: LayoutProfileId): TextStyleDefinition | undefined {\r\n const override = node.textStyleOverrides?.[profile];\r\n if (node.style === undefined && override === undefined) return undefined;\r\n return { ...DEFAULT_TEXT_STYLE, ...node.style, ...override };\r\n}\r\n\r\n/** Resolves the authored initial Spine presentation; `null` explicitly clears a base animation. */\r\nexport function resolveSpineSettings(node: SpineNode, profile: LayoutProfileId): ResolvedSpineSettings {\r\n const override = node.spineOverrides?.[profile];\r\n return {\r\n animation: override?.animation === null ? undefined : override?.animation ?? node.animation,\r\n autoplay: override?.autoplay ?? node.autoplay ?? true,\r\n loop: override?.loop ?? node.loop ?? true,\r\n animationSpeed: override?.animationSpeed ?? node.animationSpeed ?? 1,\r\n };\r\n}\r\n\r\n/**\r\n * Resolves a Unity-style RectTransform in logical Canvas units.\r\n *\r\n * `x/y` are anchoredPosition (the pivot offset from the anchor reference), while `width/height`\r\n * are sizeDelta. A point anchor therefore keeps an absolute logical size; a split anchor adds its\r\n * share of the parent rectangle. Canvas Scaler is deliberately outside this function.\r\n */\r\nexport function resolveAnchoredTransform(transform: UINode[\"transform\"], parentSize?: LayoutSize): UINode[\"transform\"] {\r\n if (parentSize === undefined) return transform;\r\n const minX = transform.anchorMinX ?? 0;\r\n const minY = transform.anchorMinY ?? 0;\r\n const maxX = transform.anchorMaxX ?? minX;\r\n const maxY = transform.anchorMaxY ?? minY;\r\n const pivotX = transform.pivotX ?? 0;\r\n const pivotY = transform.pivotY ?? 0;\r\n return {\r\n ...transform,\r\n x: (minX + (maxX - minX) * pivotX) * parentSize.width + transform.x,\r\n y: (minY + (maxY - minY) * pivotY) * parentSize.height + transform.y,\r\n width: (maxX - minX) * parentSize.width + transform.width,\r\n height: (maxY - minY) * parentSize.height + transform.height,\r\n };\r\n}\r\n\r\n/** Picks the layout profile for a viewport using the document's aspect-ratio rule; the breakpoint itself is mobile. */\r\nexport function resolveProfileForViewport(settings: ProjectDocument[\"settings\"], width: number, height: number): LayoutProfileId {\r\n return width / height <= settings.layoutProfileSelection.mobileMaxAspectRatio ? \"mobile\" : \"desktop\";\r\n}\r\n\r\nexport function fitSpineToTransform(\r\n bounds: { x: number; y: number; width: number; height: number },\r\n transform: UINode[\"transform\"],\r\n referenceFrame?: SpineReferenceFrame,\r\n): { scaleX: number; scaleY: number; x: number; y: number } | undefined {\r\n const fitBounds = referenceFrame ?? bounds;\r\n if (!Number.isFinite(fitBounds.x) || !Number.isFinite(fitBounds.y) || !Number.isFinite(fitBounds.width) || !Number.isFinite(fitBounds.height) || fitBounds.width <= 0 || fitBounds.height <= 0) return undefined;\r\n if (referenceFrame !== undefined) {\r\n const scale = Math.min(transform.width / referenceFrame.width, transform.height / referenceFrame.height);\r\n return Number.isFinite(scale) && scale > 0\r\n ? {\r\n scaleX: scale,\r\n scaleY: scale,\r\n x: (transform.width - referenceFrame.width * scale) / 2 - referenceFrame.x * scale,\r\n y: (transform.height - referenceFrame.height * scale) / 2 - referenceFrame.y * scale,\r\n }\r\n : undefined;\r\n }\r\n const scaleX = transform.width / bounds.width;\r\n const scaleY = transform.height / bounds.height;\r\n return Number.isFinite(scaleX) && scaleX > 0 && Number.isFinite(scaleY) && scaleY > 0\r\n ? { scaleX, scaleY, x: -bounds.x * scaleX, y: -bounds.y * scaleY }\r\n : undefined;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"layoutGroups.js","sourceRoot":"","sources":["../src/layoutGroups.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAiF,MAAM,wBAAwB,CAAC;AAClK,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAmB,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,iHAAiH;AACjH,MAAM,UAAU,oBAAoB,KAAyE,CAAC;AAE9G,SAAS,cAAc,CAAC,SAA0B;IAChD,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAgE,CAAC;IACnH,OAAO;QACL,UAAU,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ;QACjG,QAAQ,EAAE,QAAQ,KAAK,OAAO,CA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E;QACjD,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAU,CAAC;IAC9D,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,KAAwB;IACzE,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,IAAI,CAAC,QAAQ,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;AAC7M,CAAC","sourcesContent":["import \"@pixi/layout\";\r\nimport { isLayoutGroup, resolveLayoutGroupSettings, type LayoutAlignment, type LayoutGroupNode, type LayoutProfileId, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { Container } from \"pixi.js\";\r\nimport { resolveAnchoredTransform, resolveProfileTransform, type LayoutSize } from \"./layout.js\";\r\nimport { LayoutGroupNodeView } from \"./views/basic.js\";\r\nimport { NodeView } from \"./views/NodeView.js\";\r\n\r\n/** Importing @pixi/layout installs its renderer extension. Kept as a shared explicit contract for every host. */\r\nexport function initializePixiLayout(): void { /* @pixi/layout is installed by this module's side effect. */ }\r\n\r\nfunction alignmentParts(alignment: LayoutAlignment) {\r\n const [vertical, horizontal] = alignment.split(\"-\") as [\"upper\" | \"middle\" | \"lower\", \"left\" | \"center\" | \"right\"];\r\n return {\r\n horizontal: horizontal === \"left\" ? \"flex-start\" : horizontal === \"right\" ? \"flex-end\" : \"center\",\r\n vertical: vertical === \"upper\" ? \"flex-start\" : vertical === \"lower\" ? \"flex-end\" : \"center\",\r\n };\r\n}\r\n\r\nfunction layoutSize(node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize): LayoutSize {\n const transform = resolveAnchoredTransform(resolveProfileTransform(node, profile).transform, parentSize);\n return { width: transform.width, height: transform.height };\n}\n\n/** Applies one declarative document group to Pixi Layout; no computed Yoga data crosses the document boundary. */\nexport function applyLayoutGroup(view: Container, node: LayoutGroupNode, profile: LayoutProfileId, parentSize?: LayoutSize, managedSize?: LayoutSize): void {\n const settings = resolveLayoutGroupSettings(node, profile) as LayoutGroupNode[\"layoutGroup\"][\"base\"];\n const size = managedSize ?? layoutSize(node, profile, parentSize);\n const common = { width: size.width, height: size.height, display: \"flex\" as const };\r\n if (node.type === \"horizontal-layout\" || node.type === \"vertical-layout\") {\r\n const linear = settings as Extract<LayoutGroupNode, { type: \"horizontal-layout\" | \"vertical-layout\" }> [\"layoutGroup\"][\"base\"];\r\n const target = view instanceof LayoutGroupNodeView ? view.layoutTarget : view;\r\n const alignment = alignmentParts(linear.childAlignment);\r\n target.layout = {\r\n ...common,\r\n justifyContent: node.type === \"horizontal-layout\" ? alignment.horizontal : alignment.vertical,\r\n alignItems: node.type === \"horizontal-layout\" ? alignment.vertical : alignment.horizontal,\r\n flexDirection: node.type === \"horizontal-layout\" ? (linear.reverseOrder ? \"row-reverse\" : \"row\") : (linear.reverseOrder ? \"column-reverse\" : \"column\"),\r\n gap: linear.spacing,\r\n paddingLeft: linear.padding.left, paddingRight: linear.padding.right, paddingTop: linear.padding.top, paddingBottom: linear.padding.bottom,\r\n } as never;\r\n return;\r\n }\r\n const grid = settings as Extract<LayoutGroupNode, { type: \"grid-layout\" }> [\"layoutGroup\"][\"base\"];\r\n const reverseX = grid.startCorner.endsWith(\"right\");\r\n const reverseY = grid.startCorner.startsWith(\"lower\");\r\n const fillsByRow = grid.constraint === \"fixed-column-count\" || (grid.constraint === \"flexible\" && grid.startAxis === \"horizontal\");\r\n const target = view instanceof LayoutGroupNodeView ? view.layoutTarget : view;\r\n const alignment = alignmentParts(grid.childAlignment);\r\n target.layout = {\r\n ...common,\r\n justifyContent: fillsByRow ? alignment.horizontal : alignment.vertical,\r\n alignItems: fillsByRow ? alignment.vertical : alignment.horizontal,\r\n alignContent: fillsByRow ? alignment.vertical : alignment.horizontal,\r\n flexDirection: fillsByRow ? (reverseX ? \"row-reverse\" : \"row\") : (reverseY ? \"column-reverse\" : \"column\"),\r\n flexWrap: reverseY && fillsByRow ? \"wrap-reverse\" : \"wrap\",\r\n columnGap: grid.spacingX, rowGap: grid.spacingY,\n paddingLeft: grid.padding.left, paddingRight: grid.padding.right, paddingTop: grid.padding.top, paddingBottom: grid.padding.bottom,\r\n } as never;\r\n}\r\n\r\n/**\r\n * Runtime-only Yoga owner for one direct child. The wrapper receives Yoga coordinates while the\r\n * serializable NodeView keeps the shared pivot/rotation/scale/content/hit-test contract.\r\n */\r\nexport class LayoutItemContainer extends Container {\r\n private node?: UINode;\r\n private profile: LayoutProfileId = \"desktop\";\r\n private fallbackSize: LayoutSize = { width: 0, height: 0 };\r\n\r\n constructor(readonly nodeView: NodeView, private readonly onLayoutChanged?: () => void) {\r\n super();\r\n super.addChild(nodeView);\r\n this.onLayout = () => this.applyComputedSize();\r\n }\r\n\r\n sync(node: UINode, profile: LayoutProfileId, fallbackSize: LayoutSize): void {\r\n this.node = node;\r\n this.profile = profile;\r\n this.fallbackSize = fallbackSize;\r\n this.visible = resolveProfileTransform(node, profile).visible;\r\n this.applyComputedSize();\r\n }\r\n\r\n private applyComputedSize(): void {\r\n if (this.node === undefined) return;\r\n const computed = this.layout?.computedLayout;\r\n const size = computed === undefined || computed.width <= 0 || computed.height <= 0\r\n ? this.fallbackSize\r\n : { width: computed.width, height: computed.height };\r\n if (isLayoutGroup(this.node)) applyLayoutGroup(this.nodeView, this.node, this.profile, undefined, size);\n this.nodeView.updateManaged(this.node, this.profile, size);\r\n this.onLayoutChanged?.();\r\n }\r\n}\r\n\r\n/** Marks a direct child's technical wrapper as layout-managed. */\r\nexport function applyLayoutItem(view: LayoutItemContainer, node: UINode, parent: LayoutGroupNode, profile: LayoutProfileId): void {\r\n // Anchors belong to authored positioning and are deliberately ignored while a parent layout owns\r\n // the rectangle. Width/height remain the child's logical intrinsic size, never Pixi content bounds.\r\n const transform = resolveProfileTransform(node, profile).transform;\r\n const own = { width: transform.width, height: transform.height };\r\n const item = node.layoutItem;\r\n const settings = resolveLayoutGroupSettings(parent, profile);\r\n const base = { position: \"relative\" as const, flexGrow: item?.flexGrow ?? 0, flexShrink: item?.flexShrink ?? 0, flexBasis: item?.flexBasis, alignSelf: item?.alignSelf };\r\n view.sync(node, profile, own);\r\n if (parent.type === \"grid-layout\") {\n const grid = settings as Extract<LayoutGroupNode, { type: \"grid-layout\" }> [\"layoutGroup\"][\"base\"];\n view.layout = { ...base, width: grid.cellWidth, height: grid.cellHeight } as never;\n return;\n }\n const linear = settings as Extract<LayoutGroupNode, { type: \"horizontal-layout\" | \"vertical-layout\" }> [\"layoutGroup\"][\"base\"];\r\n const horizontal = parent.type === \"horizontal-layout\";\r\n const expandsMain = horizontal\r\n ? linear.controlChildWidth && linear.forceExpandWidth\r\n : linear.controlChildHeight && linear.forceExpandHeight;\r\n const expandsCross = horizontal\r\n ? linear.controlChildHeight && linear.forceExpandHeight\r\n : linear.controlChildWidth && linear.forceExpandWidth;\r\n view.layout = {\r\n ...base,\r\n // The schema has no separate min/preferred size yet, so the logical authored rect is the safe\r\n // intrinsic fallback for both control modes. Force-expand may then replace the relevant axis.\r\n width: expandsCross && !horizontal ? undefined : own.width,\r\n height: expandsCross && horizontal ? undefined : own.height,\r\n ...(expandsMain ? { flexGrow: Math.max(1, item?.flexGrow ?? 0) } : {}),\r\n ...(expandsCross ? { alignSelf: item?.alignSelf ?? \"stretch\" } : {}),\r\n } as never;\r\n}\r\n\r\n/** A zero-visual Yoga flex item. Fixed Unity grid constraints need explicit line breaks; this is still solved entirely by Yoga. */\r\nexport function createGridLineBreak(parent: Extract<LayoutGroupNode, { type: \"grid-layout\" }>, profile: LayoutProfileId): Container | undefined {\r\n const grid = resolveLayoutGroupSettings(parent, profile) as Extract<LayoutGroupNode, { type: \"grid-layout\" }> [\"layoutGroup\"][\"base\"];\r\n if (grid.constraint === \"flexible\" || grid.constraintCount === undefined) return undefined;\r\n const lineBreak = new Container({ label: \"__layout-grid-line-break__\" });\r\n lineBreak.layout = (grid.constraint === \"fixed-column-count\"\r\n ? { flexBasis: \"100%\", width: \"100%\", height: 0 }\r\n : { flexBasis: \"100%\", height: \"100%\", width: 0 }) as never;\r\n return lineBreak;\r\n}\r\n\r\nexport function isLayoutManagedChild(node: UINode, nodes: readonly UINode[]): boolean {\r\n return node.parentId !== null && isLayoutGroup(nodes.find((candidate) => candidate.id === node.parentId) ?? node) && nodes.some((candidate) => candidate.id === node.parentId && isLayoutGroup(candidate));\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"localization.js","sourceRoot":"","sources":["../src/localization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,qBAAqB,EAAwH,MAAM,wBAAwB,CAAC;AAExN,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAUhD;;;;;;;GAOG;AACH,MAAM,OAAO,iBAAiB;IACpB,QAAQ,CAAkB;IACjB,KAAK,CAAQ;IACb,KAAK,CAAiC;IAC/C,KAAK,CAAa;IAClB,eAAe,CAAqB;IACpC,SAAS,CAA0B;IACnC,MAAM,CAAiC;IAE/C,YAAY,QAAyB,EAAE,KAAY,EAAE,KAAqC,EAAE,UAAoC,EAAE;QAChI,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS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,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC;IACxF,OAAO,qBAAqB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["import { describeLocalizedText, isTextNode, resolveOwnerNodeGraph, type LocalizationCatalog, type LocalizationParams, type ProjectDocument, type Scene, type TextNode, type TranslateFn } from \"@pixi-ui-editor/schema\";\r\nimport type { Container } from \"pixi.js\";\r\nimport { TextNodeView } from \"./views/basic.js\";\r\n\r\nexport type SceneLocalizationOptions = {\r\n /** Requested locale; без неё применяется base locale каталога. */\r\n locale?: string;\r\n /** Внешний переводчик игры: он приоритетнее документа и может заменить строку без переэкспорта. */\r\n translate?: TranslateFn;\r\n params?: LocalizationParams;\r\n};\r\n\r\n/**\r\n * Локализация уже построенной сцены.\r\n *\r\n * Контроллер владеет только строками: он мутирует существующие `TextNodeView` через их\r\n * инкрементальный `setText`, поэтому смена локали, внешнего переводчика, параметров или самой копии\r\n * документа не пересобирает root, не меняет identity `NodeView` и не трогает live-состояние\r\n * контролов. Fallback и интерполяция целиком принадлежат `@pixi-ui-editor/schema`.\r\n */\r\nexport class SceneLocalization {\r\n private document: ProjectDocument;\r\n private readonly scene: Scene;\r\n private readonly views: ReadonlyMap<string, Container>;\r\n private nodes: TextNode[];\r\n private requestedLocale: string | undefined;\r\n private translate: TranslateFn | undefined;\r\n private params: LocalizationParams | undefined;\r\n\r\n constructor(document: ProjectDocument, scene: Scene, views: ReadonlyMap<string, Container>, options: SceneLocalizationOptions = {}) {\r\n this.document = document;\r\n this.scene = scene;\r\n this.views = views;\r\n this.nodes = collectTextNodes(document, scene);\r\n this.requestedLocale = options.locale;\r\n this.translate = options.translate;\r\n this.params = options.params;\r\n this.refresh();\r\n }\r\n\r\n get catalog(): LocalizationCatalog { return this.document.localization; }\r\n get baseLocale(): string { return this.document.localization.baseLocale; }\r\n get locale(): string { return this.requestedLocale ?? this.baseLocale; }\r\n\r\n /** Полный каталог документа: словари всех локалей, а не только активной. */\r\n entries(): Readonly<Record<string, Readonly<Record<string, string>>>> { return this.document.localization.entries; }\r\n\r\n setLocale(locale: string | undefined): void { this.requestedLocale = locale; this.refresh(); }\r\n setTranslate(translate: TranslateFn | undefined): void { this.translate = translate; this.refresh(); }\r\n setParams(params: LocalizationParams | undefined): void { this.params = params; this.refresh(); }\r\n\r\n /**\r\n * Новая иммутабельная копия документа: редакторский store заменяет документ целиком, и переводы\r\n * вместе с key references обязаны обновиться без пересборки сцены.\r\n */\r\n syncDocument(document: ProjectDocument): void {\r\n this.document = document;\r\n this.nodes = collectTextNodes(document, this.scene);\r\n this.refresh();\r\n }\r\n\r\n refresh(): void {\r\n for (const node of this.nodes) {\r\n const view = this.views.get(node.id);\r\n if (!(view instanceof TextNodeView)) continue;\r\n // Вся цепочка, включая случай «ключа нет», принадлежит резолверу схемы: `source: \"literal\"`\r\n // и означает, что нода локализацию не запрашивает и снова показывает авторскую строку.\r\n const resolution = describeLocalizedText({ text: node.text, textKey: node.textKey, catalog: this.document.localization, locale: this.locale, translate: this.translate, params: this.params });\r\n if (resolution.source === \"literal\") {\r\n view.setLocalizedText(undefined);\r\n view.setText(resolution.value);\r\n continue;\r\n }\r\n view.setLocalizedText(resolution.value);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Текстовые ноды сцены, включая развёрнутые пресеты.\r\n *\r\n * Синтетическая сцена prefab-view в присланном документе отсутствует, поэтому её описание берётся\r\n * из захваченного объекта: определения пресетов при этом всё равно читаются из нового документа.\r\n */\r\nfunction collectTextNodes(document: ProjectDocument, scene: Scene): TextNode[] {\r\n const current = document.scenes.find((candidate) => candidate.id === scene.id) ?? scene;\r\n return resolveOwnerNodeGraph(document, current).nodes.filter(isTextNode);\r\n}\r\n"]}
@@ -0,0 +1,17 @@
1
+ import { type LayoutProfileId, type UINode } from "@pixi-ui-editor/schema";
2
+ import { Container } from "pixi.js";
3
+ import type { LayoutSize } from "./layout.js";
4
+ import { NodeView } from "./views/NodeView.js";
5
+ /**
6
+ * Runtime-only position owner for one direct page-group child: fills the group's whole resolved
7
+ * rectangle and is shown only while it is the active page. Position and visibility are this wrapper's
8
+ * job; the wrapped `NodeView` keeps its own pivot/rotation/scale/visibility contract via
9
+ * `updateManaged`, the same split a layout group's `LayoutItemContainer` and a scroll-view's
10
+ * `ScrollItemContainer` already use.
11
+ */
12
+ export declare class PageItemContainer extends Container {
13
+ readonly nodeView: NodeView;
14
+ constructor(nodeView: NodeView);
15
+ sync(node: UINode, profile: LayoutProfileId, size: LayoutSize): void;
16
+ }
17
+ //# sourceMappingURL=pageGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageGroup.d.ts","sourceRoot":"","sources":["../src/pageGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C;;;;;;GAMG;AACH,qBAAa,iBAAkB,SAAQ,SAAS;IAClC,QAAQ,CAAC,QAAQ,EAAE,QAAQ;gBAAlB,QAAQ,EAAE,QAAQ;IAKvC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;CAGrE"}
@@ -0,0 +1,20 @@
1
+ import { Container } from "pixi.js";
2
+ /**
3
+ * Runtime-only position owner for one direct page-group child: fills the group's whole resolved
4
+ * rectangle and is shown only while it is the active page. Position and visibility are this wrapper's
5
+ * job; the wrapped `NodeView` keeps its own pivot/rotation/scale/visibility contract via
6
+ * `updateManaged`, the same split a layout group's `LayoutItemContainer` and a scroll-view's
7
+ * `ScrollItemContainer` already use.
8
+ */
9
+ export class PageItemContainer extends Container {
10
+ nodeView;
11
+ constructor(nodeView) {
12
+ super();
13
+ this.nodeView = nodeView;
14
+ super.addChild(nodeView);
15
+ }
16
+ sync(node, profile, size) {
17
+ this.nodeView.updateManaged(node, profile, size);
18
+ }
19
+ }
20
+ //# sourceMappingURL=pageGroup.js.map