@pixi-ui-editor/runtime-pixi 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controls.d.ts +5 -1
- package/dist/controls.d.ts.map +1 -1
- package/dist/controls.js +9 -1
- package/dist/controls.js.map +1 -1
- package/dist/pageGroup.d.ts +5 -3
- package/dist/pageGroup.d.ts.map +1 -1
- package/dist/pageGroup.js +6 -4
- package/dist/pageGroup.js.map +1 -1
- package/dist/views/NodeView.d.ts +9 -2
- package/dist/views/NodeView.d.ts.map +1 -1
- package/dist/views/NodeView.js +10 -3
- package/dist/views/NodeView.js.map +1 -1
- package/package.json +2 -2
package/dist/controls.d.ts
CHANGED
|
@@ -42,8 +42,12 @@ export declare function getItemTableViewItem(view: Container, index: number): Co
|
|
|
42
42
|
export declare function setItemTableViewVisibleCount(view: Container, count: number | undefined): void;
|
|
43
43
|
/** Показывает или прячет все элементы разом; `undefined` возвращает управление вместимости. */
|
|
44
44
|
export declare function setItemTableViewItemsVisible(view: Container, visible: boolean | undefined): void;
|
|
45
|
-
/** Switches which direct child ("page") of a page group is shown; every other child is hidden. */
|
|
45
|
+
/** Switches which direct child ("page") of a page group is shown; every other child is hidden. Out-of-range indices clamp into range, so passing whatever a caller has on hand can never throw or leave the group blank. */
|
|
46
46
|
export declare function setPageGroupViewPage(view: Container, page: number): void;
|
|
47
|
+
/** Currently shown page index, or `undefined` if `view` is not a page group. */
|
|
48
|
+
export declare function getPageGroupViewPage(view: Container): number | undefined;
|
|
49
|
+
/** Total number of pages (authored children plus any appended via `addPageGroupViewPage`); `0` if `view` is not a page group. */
|
|
50
|
+
export declare function getPageGroupViewPageCount(view: Container): number;
|
|
47
51
|
/**
|
|
48
52
|
* Appends a page built at runtime (e.g. the `root` from `buildPrefabView`/`loadPrefabView`, or any
|
|
49
53
|
* hand-built `Container`) after the last one — for a dataset that grows during play (a spin history
|
package/dist/controls.d.ts.map
CHANGED
|
@@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AM,EAAE,SAAS,CAAC,GAAG,IAAI,CAE1F"}
|
package/dist/controls.js
CHANGED
|
@@ -111,11 +111,19 @@ export function setItemTableViewItemsVisible(view, visible) {
|
|
|
111
111
|
if (view instanceof ItemTableNodeView)
|
|
112
112
|
view.setItemsVisible(visible);
|
|
113
113
|
}
|
|
114
|
-
/** Switches which direct child ("page") of a page group is shown; every other child is hidden. */
|
|
114
|
+
/** Switches which direct child ("page") of a page group is shown; every other child is hidden. Out-of-range indices clamp into range, so passing whatever a caller has on hand can never throw or leave the group blank. */
|
|
115
115
|
export function setPageGroupViewPage(view, page) {
|
|
116
116
|
if (view instanceof PageGroupNodeView)
|
|
117
117
|
view.page = page;
|
|
118
118
|
}
|
|
119
|
+
/** Currently shown page index, or `undefined` if `view` is not a page group. */
|
|
120
|
+
export function getPageGroupViewPage(view) {
|
|
121
|
+
return view instanceof PageGroupNodeView ? view.page : undefined;
|
|
122
|
+
}
|
|
123
|
+
/** Total number of pages (authored children plus any appended via `addPageGroupViewPage`); `0` if `view` is not a page group. */
|
|
124
|
+
export function getPageGroupViewPageCount(view) {
|
|
125
|
+
return view instanceof PageGroupNodeView ? view.pageCount : 0;
|
|
126
|
+
}
|
|
119
127
|
/**
|
|
120
128
|
* Appends a page built at runtime (e.g. the `root` from `buildPrefabView`/`loadPrefabView`, or any
|
|
121
129
|
* hand-built `Container`) after the last one — for a dataset that grows during play (a spin history
|
package/dist/controls.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controls.js","sourceRoot":"","sources":["../src/controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAG3E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MA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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;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,IAAe,EAAE,OAA2B;IACrF,IAAI,IAAI,YAAY,oBAAoB;QAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACrE,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,oBAAoB,CAAC,IAAe,EAAE,QAAiB;IACrE,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;AACvD,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,4BAA4B,CAAC,IAAe,EAAE,MAAe;IAC3E,IAAI,IAAI,YAAY,aAAa;QAAE,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC;AACxE,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,0BAA0B,CAAC,SAAyC;IAClF,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,MAAM,EAAE;QAAE,IAAI,IAAI,YAAY,aAAa,IAAI,IAAI,CAAC,oBAAoB;YAAE,IAAI,CAAC,qBAAqB,EAAE,CAAC;AACtI,CAAC","sourcesContent":["import { type SkeletonData, Spine } from \"@esotericsoftware/spine-pixi-v8\";\nimport { type ButtonStateKey, type LayoutPadding } from \"@pixi-ui-editor/schema\";\nimport { Container } from \"pixi.js\";\nimport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\nimport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\nimport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\nimport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\nimport { PaginationNodeView } from \"./views/PaginationNodeView.js\";\nimport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\nimport { ImageNodeView, OpacityGroupNodeView } from \"./views/basic.js\";\nimport { NodeView } from \"./views/NodeView.js\";\nimport { ProgressBarNodeView, SliderNodeView } from \"./views/ValueControlNodeViews.js\";\nimport { SpineNodeView } from \"./views/SpineNodeView.js\";\n\nfunction findSpineChild(view: Container): Spine | undefined {\n if (view instanceof NodeView) return view.getSpine();\n return view instanceof Spine ? view : view.children.find((child): child is Spine => child instanceof Spine);\n}\n\n/** Reads the current 1-based animation frame for an editor Spine node. */\nexport function getSpineViewPlayback(view: Container, skeletonData: SkeletonData, animation: string): { current: number; total: number } | undefined {\n const spine = findSpineChild(view);\n const track = spine?.state.tracks[0];\n const duration = skeletonData.findAnimation(animation)?.duration;\n if (track === null || track === undefined || duration === undefined || duration <= 0) return undefined;\n const fps = skeletonData.fps && skeletonData.fps > 0 ? skeletonData.fps : 60;\n const total = Math.max(1, Math.round(duration * fps));\n const time = track.loop ? track.trackTime % duration : Math.min(track.trackTime, duration);\n return { current: Math.min(total, Math.floor(time * fps) + 1), total };\n}\n\n/** Seeks an editor Spine node to a 1-based animation frame without changing its serialized animation settings. */\nexport function setSpineViewFrame(view: Container, frame: number, skeletonData: SkeletonData, animation: string): void {\n const spine = findSpineChild(view);\n const track = spine?.state.tracks[0];\n const duration = skeletonData.findAnimation(animation)?.duration;\n if (track === null || track === undefined || duration === undefined || duration <= 0) return;\n const fps = skeletonData.fps && skeletonData.fps > 0 ? skeletonData.fps : 60;\n const total = Math.max(1, Math.round(duration * fps));\n track.trackTime = Math.min(total, Math.max(1, Math.round(frame)) - 1) / fps;\n spine?.update(0);\n}\n\n/** Forces an editor-only button state; the node's serialized `enabled` and states stay untouched. */\nexport function setButtonViewState(view: Container, state: ButtonStateKey): void {\n if (view instanceof ButtonNodeView) view.setState(state);\n}\n\n/** Forces an editor-only checkbox checked state; the node's serialized `defaultChecked` stays untouched. */\nexport function setCheckboxViewChecked(view: Container, checked: boolean): void {\n if (view instanceof CheckboxNodeView) view.forceCheck(checked);\n}\n\n/** Forces an editor-only staged button preview stage; the document's `stages`/current stage stay untouched. */\nexport function setStagedButtonViewStage(view: Container, index: number): void {\n if (view instanceof StagedButtonNodeView) view.forceStage(index);\n}\n\n/** Forces an editor-only staged button visual state; the node's serialized `enabled` stays untouched. */\nexport function setStagedButtonViewState(view: Container, state: ButtonStateKey): void {\n if (view instanceof StagedButtonNodeView) view.setState(state);\n}\n\n/** Live-previews nine-slice border edits while dragging the canvas gizmo; commits only on release. */\nexport function previewNineSlice(view: Container, nineSlice: LayoutPadding): void {\n if (view instanceof ImageNodeView || view instanceof ButtonNodeView || view instanceof StagedButtonNodeView) view.previewNineSlice(nineSlice);\n}\n\n/** Applies an editor-only slider preview value without touching the document. */\nexport function setSliderViewValue(view: Container, value: number): void {\n if (view instanceof SliderNodeView) view.value = value;\n}\n\n/** Applies an editor-only progress preview without touching the document. */\nexport function setProgressBarViewProgress(view: Container, progress: number): void {\n if (view instanceof ProgressBarNodeView) view.progress = progress;\n}\n\n/** One-way sync from game code (or editor preview) into the widget: highlights a dot without emitting `onPageChange`. */\nexport function setPaginationViewPage(view: Container, page: number): void {\n if (view instanceof PaginationNodeView) view.page = page;\n}\n\n/**\n * Rebuilds the widget's dots for a runtime-known page count, e.g. once actual content length is known.\n * Ignored while the widget pages through authored `items`: there the item list already fixes the count.\n */\nexport function setPaginationViewPageCount(view: Container, pageCount: number): void {\n if (view instanceof PaginationNodeView) view.pageCount = pageCount;\n}\n\n/**\n * Все элементы таблицы в порядке иерархии, включая скрытые вместимостью — «что вообще есть».\n * Возвращает пустой список, если `view` не item-table.\n */\nexport function getItemTableViewItems(view: Container): Container[] {\n return view instanceof ItemTableNodeView ? view.items : [];\n}\n\n/** Элементы, показанные прямо сейчас: столько, сколько влезает в текущем профиле. */\nexport function getItemTableViewVisibleItems(view: Container): Container[] {\n return view instanceof ItemTableNodeView ? view.visibleItems : [];\n}\n\n/** Один элемент по индексу — адресация, на которой игровой код раскладывает свои данные. */\nexport function getItemTableViewItem(view: Container, index: number): Container | undefined {\n return view instanceof ItemTableNodeView ? view.itemAt(index) : undefined;\n}\n\n/** Транзиентно меняет вместимость; `undefined` возвращает авторское значение профиля. */\nexport function setItemTableViewVisibleCount(view: Container, count: number | undefined): void {\n if (view instanceof ItemTableNodeView) view.visibleCount = count;\n}\n\n/** Показывает или прячет все элементы разом; `undefined` возвращает управление вместимости. */\nexport function setItemTableViewItemsVisible(view: Container, visible: boolean | undefined): void {\n if (view instanceof ItemTableNodeView) view.setItemsVisible(visible);\n}\n\n/** Switches which direct child (\"page\") of a page group is shown; every other child is hidden. */\nexport function setPageGroupViewPage(view: Container, page: number): void {\n if (view instanceof PageGroupNodeView) view.page = page;\n}\n\n/**\n * Appends a page built at runtime (e.g. the `root` from `buildPrefabView`/`loadPrefabView`, or any\n * hand-built `Container`) after the last one — for a dataset that grows during play (a spin history\n * list, a chat log, ...) rather than one fully known at authoring time. Fits the page to the group's\n * current rectangle and hides it until switched to. Returns the new page's index, or `undefined` if\n * `view` is not a page group. Keep `setPaginationViewPageCount` in sync with the resulting `pageCount`\n * if a `pagination` widget is showing this group's page count.\n */\nexport function addPageGroupViewPage(view: Container, page: Container): number | undefined {\n return view instanceof PageGroupNodeView ? view.addPage(page) : undefined;\n}\n\n/**\n * Fades a whole subtree by driving one opacity group, the cheap `CanvasGroup.alpha` equivalent: the\n * value multiplies into every descendant through PixiJS `worldAlpha`, so animating a fade is one write\n * per frame regardless of how many nodes are inside. The node's authored `opacity` stays untouched in\n * the document; pass `undefined` to hand control back to it. Tweening itself belongs to game code —\n * the runtime deliberately ships no animation engine, the same way `page-group` ships no swipe gesture.\n */\nexport function setOpacityGroupViewOpacity(view: Container, opacity: number | undefined): void {\n if (view instanceof OpacityGroupNodeView) view.setOpacity(opacity);\n}\n\n/** Enables or pauses editor-only automatic playback without affecting serialized node data. */\nexport function setSpineViewAutoplay(view: Container, autoplay: boolean): void {\n const spine = findSpineChild(view);\n if (spine !== undefined) spine.autoUpdate = autoplay;\n}\n\n/** Activates authored bone/slot part connectors on one Spine node without mutating the document. */\nexport function setSpineConnectorBonesActive(view: Container, active: boolean): void {\n if (view instanceof SpineNodeView) view.activeConnectorBones = active;\n}\n\n/** Reasserts active connector matrices after a host performs live node-view updates. */\nexport function refreshSpineConnectorBones(nodeViews: ReadonlyMap<string, Container>): void {\n for (const view of nodeViews.values()) if (view instanceof SpineNodeView && view.activeConnectorBones) view.refreshConnectorBones();\n}\n"]}
|
|
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,E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;;;;;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;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,IAAe,EAAE,OAA2B;IACrF,IAAI,IAAI,YAAY,oBAAoB;QAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACrE,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,oBAAoB,CAAC,IAAe,EAAE,QAAiB;IACrE,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;AACvD,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,4BAA4B,CAAC,IAAe,EAAE,MAAe;IAC3E,IAAI,IAAI,YAAY,aAAa;QAAE,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC;AACxE,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,0BAA0B,CAAC,SAAyC;IAClF,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,MAAM,EAAE;QAAE,IAAI,IAAI,YAAY,aAAa,IAAI,IAAI,CAAC,oBAAoB;YAAE,IAAI,CAAC,qBAAqB,EAAE,CAAC;AACtI,CAAC","sourcesContent":["import { type SkeletonData, Spine } from \"@esotericsoftware/spine-pixi-v8\";\nimport { type ButtonStateKey, type LayoutPadding } from \"@pixi-ui-editor/schema\";\nimport { Container } from \"pixi.js\";\nimport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\nimport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\nimport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\nimport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\nimport { PaginationNodeView } from \"./views/PaginationNodeView.js\";\nimport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\nimport { ImageNodeView, OpacityGroupNodeView } from \"./views/basic.js\";\nimport { NodeView } from \"./views/NodeView.js\";\nimport { ProgressBarNodeView, SliderNodeView } from \"./views/ValueControlNodeViews.js\";\nimport { SpineNodeView } from \"./views/SpineNodeView.js\";\n\nfunction findSpineChild(view: Container): Spine | undefined {\n if (view instanceof NodeView) return view.getSpine();\n return view instanceof Spine ? view : view.children.find((child): child is Spine => child instanceof Spine);\n}\n\n/** Reads the current 1-based animation frame for an editor Spine node. */\nexport function getSpineViewPlayback(view: Container, skeletonData: SkeletonData, animation: string): { current: number; total: number } | undefined {\n const spine = findSpineChild(view);\n const track = spine?.state.tracks[0];\n const duration = skeletonData.findAnimation(animation)?.duration;\n if (track === null || track === undefined || duration === undefined || duration <= 0) return undefined;\n const fps = skeletonData.fps && skeletonData.fps > 0 ? skeletonData.fps : 60;\n const total = Math.max(1, Math.round(duration * fps));\n const time = track.loop ? track.trackTime % duration : Math.min(track.trackTime, duration);\n return { current: Math.min(total, Math.floor(time * fps) + 1), total };\n}\n\n/** Seeks an editor Spine node to a 1-based animation frame without changing its serialized animation settings. */\nexport function setSpineViewFrame(view: Container, frame: number, skeletonData: SkeletonData, animation: string): void {\n const spine = findSpineChild(view);\n const track = spine?.state.tracks[0];\n const duration = skeletonData.findAnimation(animation)?.duration;\n if (track === null || track === undefined || duration === undefined || duration <= 0) return;\n const fps = skeletonData.fps && skeletonData.fps > 0 ? skeletonData.fps : 60;\n const total = Math.max(1, Math.round(duration * fps));\n track.trackTime = Math.min(total, Math.max(1, Math.round(frame)) - 1) / fps;\n spine?.update(0);\n}\n\n/** Forces an editor-only button state; the node's serialized `enabled` and states stay untouched. */\nexport function setButtonViewState(view: Container, state: ButtonStateKey): void {\n if (view instanceof ButtonNodeView) view.setState(state);\n}\n\n/** Forces an editor-only checkbox checked state; the node's serialized `defaultChecked` stays untouched. */\nexport function setCheckboxViewChecked(view: Container, checked: boolean): void {\n if (view instanceof CheckboxNodeView) view.forceCheck(checked);\n}\n\n/** Forces an editor-only staged button preview stage; the document's `stages`/current stage stay untouched. */\nexport function setStagedButtonViewStage(view: Container, index: number): void {\n if (view instanceof StagedButtonNodeView) view.forceStage(index);\n}\n\n/** Forces an editor-only staged button visual state; the node's serialized `enabled` stays untouched. */\nexport function setStagedButtonViewState(view: Container, state: ButtonStateKey): void {\n if (view instanceof StagedButtonNodeView) view.setState(state);\n}\n\n/** Live-previews nine-slice border edits while dragging the canvas gizmo; commits only on release. */\nexport function previewNineSlice(view: Container, nineSlice: LayoutPadding): void {\n if (view instanceof ImageNodeView || view instanceof ButtonNodeView || view instanceof StagedButtonNodeView) view.previewNineSlice(nineSlice);\n}\n\n/** Applies an editor-only slider preview value without touching the document. */\nexport function setSliderViewValue(view: Container, value: number): void {\n if (view instanceof SliderNodeView) view.value = value;\n}\n\n/** Applies an editor-only progress preview without touching the document. */\nexport function setProgressBarViewProgress(view: Container, progress: number): void {\n if (view instanceof ProgressBarNodeView) view.progress = progress;\n}\n\n/** One-way sync from game code (or editor preview) into the widget: highlights a dot without emitting `onPageChange`. */\nexport function setPaginationViewPage(view: Container, page: number): void {\n if (view instanceof PaginationNodeView) view.page = page;\n}\n\n/**\n * Rebuilds the widget's dots for a runtime-known page count, e.g. once actual content length is known.\n * Ignored while the widget pages through authored `items`: there the item list already fixes the count.\n */\nexport function setPaginationViewPageCount(view: Container, pageCount: number): void {\n if (view instanceof PaginationNodeView) view.pageCount = pageCount;\n}\n\n/**\n * Все элементы таблицы в порядке иерархии, включая скрытые вместимостью — «что вообще есть».\n * Возвращает пустой список, если `view` не item-table.\n */\nexport function getItemTableViewItems(view: Container): Container[] {\n return view instanceof ItemTableNodeView ? view.items : [];\n}\n\n/** Элементы, показанные прямо сейчас: столько, сколько влезает в текущем профиле. */\nexport function getItemTableViewVisibleItems(view: Container): Container[] {\n return view instanceof ItemTableNodeView ? view.visibleItems : [];\n}\n\n/** Один элемент по индексу — адресация, на которой игровой код раскладывает свои данные. */\nexport function getItemTableViewItem(view: Container, index: number): Container | undefined {\n return view instanceof ItemTableNodeView ? view.itemAt(index) : undefined;\n}\n\n/** Транзиентно меняет вместимость; `undefined` возвращает авторское значение профиля. */\nexport function setItemTableViewVisibleCount(view: Container, count: number | undefined): void {\n if (view instanceof ItemTableNodeView) view.visibleCount = count;\n}\n\n/** Показывает или прячет все элементы разом; `undefined` возвращает управление вместимости. */\nexport function setItemTableViewItemsVisible(view: Container, visible: boolean | undefined): void {\n if (view instanceof ItemTableNodeView) view.setItemsVisible(visible);\n}\n\n/** Switches which direct child (\"page\") of a page group is shown; every other child is hidden. Out-of-range indices clamp into range, so passing whatever a caller has on hand can never throw or leave the group blank. */\nexport function setPageGroupViewPage(view: Container, page: number): void {\n if (view instanceof PageGroupNodeView) view.page = page;\n}\n\n/** Currently shown page index, or `undefined` if `view` is not a page group. */\nexport function getPageGroupViewPage(view: Container): number | undefined {\n return view instanceof PageGroupNodeView ? view.page : undefined;\n}\n\n/** Total number of pages (authored children plus any appended via `addPageGroupViewPage`); `0` if `view` is not a page group. */\nexport function getPageGroupViewPageCount(view: Container): number {\n return view instanceof PageGroupNodeView ? view.pageCount : 0;\n}\n\n/**\n * Appends a page built at runtime (e.g. the `root` from `buildPrefabView`/`loadPrefabView`, or any\n * hand-built `Container`) after the last one — for a dataset that grows during play (a spin history\n * list, a chat log, ...) rather than one fully known at authoring time. Fits the page to the group's\n * current rectangle and hides it until switched to. Returns the new page's index, or `undefined` if\n * `view` is not a page group. Keep `setPaginationViewPageCount` in sync with the resulting `pageCount`\n * if a `pagination` widget is showing this group's page count.\n */\nexport function addPageGroupViewPage(view: Container, page: Container): number | undefined {\n return view instanceof PageGroupNodeView ? view.addPage(page) : undefined;\n}\n\n/**\n * Fades a whole subtree by driving one opacity group, the cheap `CanvasGroup.alpha` equivalent: the\n * value multiplies into every descendant through PixiJS `worldAlpha`, so animating a fade is one write\n * per frame regardless of how many nodes are inside. The node's authored `opacity` stays untouched in\n * the document; pass `undefined` to hand control back to it. Tweening itself belongs to game code —\n * the runtime deliberately ships no animation engine, the same way `page-group` ships no swipe gesture.\n */\nexport function setOpacityGroupViewOpacity(view: Container, opacity: number | undefined): void {\n if (view instanceof OpacityGroupNodeView) view.setOpacity(opacity);\n}\n\n/** Enables or pauses editor-only automatic playback without affecting serialized node data. */\nexport function setSpineViewAutoplay(view: Container, autoplay: boolean): void {\n const spine = findSpineChild(view);\n if (spine !== undefined) spine.autoUpdate = autoplay;\n}\n\n/** Activates authored bone/slot part connectors on one Spine node without mutating the document. */\nexport function setSpineConnectorBonesActive(view: Container, active: boolean): void {\n if (view instanceof SpineNodeView) view.activeConnectorBones = active;\n}\n\n/** Reasserts active connector matrices after a host performs live node-view updates. */\nexport function refreshSpineConnectorBones(nodeViews: ReadonlyMap<string, Container>): void {\n for (const view of nodeViews.values()) if (view instanceof SpineNodeView && view.activeConnectorBones) view.refreshConnectorBones();\n}\n"]}
|
package/dist/pageGroup.d.ts
CHANGED
|
@@ -5,9 +5,11 @@ import { NodeView } from "./views/NodeView.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* Runtime-only position owner for one direct page-group child: fills the group's whole resolved
|
|
7
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
|
|
9
|
-
*
|
|
10
|
-
* `
|
|
8
|
+
* job; the wrapped `NodeView` keeps its own pivot/rotation/scale contract via `updateManaged`, the
|
|
9
|
+
* same split a layout group's `LayoutItemContainer` and a scroll-view's `ScrollItemContainer` already
|
|
10
|
+
* use — except visibility is *not* split off to the child here: a page's own authored `visible` would
|
|
11
|
+
* otherwise be able to blank out the active page independently of which page the group has switched
|
|
12
|
+
* to, so `forceVisible` makes the group the single source of truth for whether a page's content shows.
|
|
11
13
|
*/
|
|
12
14
|
export declare class PageItemContainer extends Container {
|
|
13
15
|
readonly nodeView: NodeView;
|
package/dist/pageGroup.d.ts.map
CHANGED
|
@@ -1 +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
|
|
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;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,SAAS;IAClC,QAAQ,CAAC,QAAQ,EAAE,QAAQ;IAAvC,YAAqB,QAAQ,EAAE,QAAQ,EAGtC;IAED,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAEnE;CACF"}
|
package/dist/pageGroup.js
CHANGED
|
@@ -2,9 +2,11 @@ import { Container } from "pixi.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Runtime-only position owner for one direct page-group child: fills the group's whole resolved
|
|
4
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
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
5
|
+
* job; the wrapped `NodeView` keeps its own pivot/rotation/scale contract via `updateManaged`, the
|
|
6
|
+
* same split a layout group's `LayoutItemContainer` and a scroll-view's `ScrollItemContainer` already
|
|
7
|
+
* use — except visibility is *not* split off to the child here: a page's own authored `visible` would
|
|
8
|
+
* otherwise be able to blank out the active page independently of which page the group has switched
|
|
9
|
+
* to, so `forceVisible` makes the group the single source of truth for whether a page's content shows.
|
|
8
10
|
*/
|
|
9
11
|
export class PageItemContainer extends Container {
|
|
10
12
|
nodeView;
|
|
@@ -14,7 +16,7 @@ export class PageItemContainer extends Container {
|
|
|
14
16
|
super.addChild(nodeView);
|
|
15
17
|
}
|
|
16
18
|
sync(node, profile, size) {
|
|
17
|
-
this.nodeView.updateManaged(node, profile, size);
|
|
19
|
+
this.nodeView.updateManaged(node, profile, size, true);
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
//# sourceMappingURL=pageGroup.js.map
|
package/dist/pageGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageGroup.js","sourceRoot":"","sources":["../src/pageGroup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIpC
|
|
1
|
+
{"version":3,"file":"pageGroup.js","sourceRoot":"","sources":["../src/pageGroup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIpC;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAkB,SAAQ,SAAS;IACzB,QAAQ;IAA7B,YAAqB,QAAkB;QACrC,KAAK,EAAE,CAAC;wBADW,QAAQ;QAE3B,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,OAAwB,EAAE,IAAgB;QAC3D,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;CACF","sourcesContent":["import { type LayoutProfileId, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { Container } from \"pixi.js\";\r\nimport type { LayoutSize } from \"./layout.js\";\r\nimport { NodeView } from \"./views/NodeView.js\";\r\n\r\n/**\r\n * Runtime-only position owner for one direct page-group child: fills the group's whole resolved\r\n * rectangle and is shown only while it is the active page. Position and visibility are this wrapper's\r\n * job; the wrapped `NodeView` keeps its own pivot/rotation/scale contract via `updateManaged`, the\r\n * same split a layout group's `LayoutItemContainer` and a scroll-view's `ScrollItemContainer` already\r\n * use — except visibility is *not* split off to the child here: a page's own authored `visible` would\r\n * otherwise be able to blank out the active page independently of which page the group has switched\r\n * to, so `forceVisible` makes the group the single source of truth for whether a page's content shows.\r\n */\r\nexport class PageItemContainer extends Container {\r\n constructor(readonly nodeView: NodeView) {\r\n super();\r\n super.addChild(nodeView);\r\n }\r\n\r\n sync(node: UINode, profile: LayoutProfileId, size: LayoutSize): void {\r\n this.nodeView.updateManaged(node, profile, size, true);\r\n }\r\n}\r\n"]}
|
package/dist/views/NodeView.d.ts
CHANGED
|
@@ -64,8 +64,15 @@ export declare abstract class NodeView extends Container {
|
|
|
64
64
|
update(node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize): void;
|
|
65
65
|
/** Applies a transient editor rectangle without deriving it from content-dependent Pixi bounds. */
|
|
66
66
|
preview(node: UINode, transform: UINode["transform"], visible?: boolean, profile?: LayoutProfileId): void;
|
|
67
|
-
/**
|
|
68
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Applies the rectangle owned by a direct parent's layout solver.
|
|
69
|
+
*
|
|
70
|
+
* `forceVisible` lets an owner that already fully owns show/hide of this child (a page group's
|
|
71
|
+
* `PageItemContainer`, see `pageGroup.ts`) override the node's own authored `visible` — the same
|
|
72
|
+
* way it already overrides position: a page isn't a content item that can independently opt out of
|
|
73
|
+
* being shown, it's a whole sub-screen whose only visibility switch is "is it the active page".
|
|
74
|
+
*/
|
|
75
|
+
updateManaged(node: UINode, profile: LayoutProfileId, size: LayoutSize, forceVisible?: boolean): void;
|
|
69
76
|
get layoutRectangle(): LayoutSize;
|
|
70
77
|
/** Авторская видимость узла отдельно от `visible`, поверх которой применяется `hiddenByOwner`. */
|
|
71
78
|
get documentVisible(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeView.d.ts","sourceRoot":"","sources":["../../src/views/NodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAa,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAqD,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAElG;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,SAAS,CAAC;AAE3D;;;;GAIG;AACH,8BAAsB,QAAS,SAAQ,SAAS;IAC9C,SAAS,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC9B,4FAA4F;IAC5F,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACtE,6FAA6F;IAC7F,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,yGAAyG;IACzG,SAAS,CAAC,WAAW,SAAK;IAC1B,SAAS,CAAC,YAAY,SAAK;IAC3B;;;;;;;;OAQG;IACH,aAAa,UAAS;IACtB,4FAA4F;IAC5F,OAAO,CAAC,eAAe,CAAQ;IAE/B,YAAY,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,EAGlD;IAED,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAErE;IAED;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,KAAK,EAAE,SAAS,GAA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UAAU,CAEhC;IAED,kGAAkG;IAClG,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED,QAAQ,IAAI,KAAK,GAAG,SAAS,CAE5B;IAED;;;;;;OAMG;IACH,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAG;CACnD"}
|
package/dist/views/NodeView.js
CHANGED
|
@@ -96,10 +96,17 @@ export class NodeView extends Container {
|
|
|
96
96
|
preview(node, transform, visible = true, profile = "desktop") {
|
|
97
97
|
this.applyResolvedTransform(node, transform, visible, false, profile);
|
|
98
98
|
}
|
|
99
|
-
/**
|
|
100
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Applies the rectangle owned by a direct parent's layout solver.
|
|
101
|
+
*
|
|
102
|
+
* `forceVisible` lets an owner that already fully owns show/hide of this child (a page group's
|
|
103
|
+
* `PageItemContainer`, see `pageGroup.ts`) override the node's own authored `visible` — the same
|
|
104
|
+
* way it already overrides position: a page isn't a content item that can independently opt out of
|
|
105
|
+
* being shown, it's a whole sub-screen whose only visibility switch is "is it the active page".
|
|
106
|
+
*/
|
|
107
|
+
updateManaged(node, profile, size, forceVisible = false) {
|
|
101
108
|
const resolved = resolveProfileTransform(node, profile);
|
|
102
|
-
this.applyResolvedTransform(node, { ...resolved.transform, x: 0, y: 0, width: size.width, height: size.height }, resolved.visible, true, profile);
|
|
109
|
+
this.applyResolvedTransform(node, { ...resolved.transform, x: 0, y: 0, width: size.width, height: size.height }, forceVisible || resolved.visible, true, profile);
|
|
103
110
|
}
|
|
104
111
|
get layoutRectangle() {
|
|
105
112
|
return { width: this.layoutWidth, height: this.layoutHeight };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeView.js","sourceRoot":"","sources":["../../src/views/NodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,SAAS,EAA2B,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,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,YAAY,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACH,oBAAoB,CAAC,WAAmB,IAAS,CAAC;CACnD","sourcesContent":["import { Spine } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport { type LayoutProfileId, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { Container, Rectangle, Texture, type PointData } from \"pixi.js\";\r\nimport { resolveAnchoredTransform, resolveProfileTransform, type LayoutSize } from \"../layout.js\";\r\n\r\n/**\r\n * Whether a built scene is an inert authoring surface or a live one.\r\n * The editor canvas builds `authoring` scenes so controls never swallow selection and drag\r\n * gestures; Preview and the consuming app build `runtime` scenes with real pointer handling.\r\n */\r\nexport type SceneInteractionMode = \"authoring\" | \"runtime\";\r\n\r\n/**\r\n * Base display object for every schema node type. The whole layout contract — profile overrides,\r\n * anchors, pivot, position, scale, visibility — lives here once; subclasses only synchronize their\r\n * type-specific content against the resolved layout rectangle.\r\n */\r\nexport abstract class NodeView extends Container {\r\n protected content?: Container;\r\n /** A mutable scene texture map: assets may be loaded after this stable view was created. */\r\n protected readonly textures: ReadonlyMap<string, Texture> | undefined;\r\n /** Node's own grab rectangle in local space, kept equal to its resolved layout rectangle. */\r\n private readonly grabRect = new Rectangle();\r\n /** Authored/computed RectTransform-like rectangle; unlike Pixi bounds it also exists without content. */\r\n protected layoutWidth = 0;\r\n protected layoutHeight = 0;\r\n /**\r\n * Скрыт ли узел владельцем-вместимостью (`ItemTableNodeView`) поверх авторской видимости.\r\n *\r\n * Флаг живёт здесь, а не только в самом владельце, потому что `visible` заново выводится из\r\n * документа на каждом обновлении — в том числе в `updateManaged`, который для элемента внутри\r\n * layout-группы дёргает сам layout-движок своим колбэком `onLayout` (см. `LayoutItemContainer`),\r\n * то есть уже после того, как владелец закончил свой проход. Одно присваивание `visible` снаружи\r\n * пережило бы ровно до следующего пересчёта раскладки; сложение с этим флагом переживает любой.\r\n */\r\n hiddenByOwner = false;\r\n /** Visibility last resolved from the document, before `hiddenByOwner` is applied on top. */\r\n private authoredVisible = true;\r\n\r\n constructor(textures?: ReadonlyMap<string, Texture>) {\r\n super();\r\n this.textures = textures;\r\n }\r\n\r\n protected textureFor(assetId: string | undefined): Texture | undefined {\r\n return assetId === undefined ? undefined : this.textures?.get(assetId);\r\n }\r\n\r\n /**\r\n * Makes every node selectable and draggable by its layout rectangle, whatever it renders.\r\n *\r\n * Lives here rather than in a subclass because a bare `Container` has no `containsPoint` of its\r\n * own: without this, Pixi could only find a node through whatever content the subclass happens to\r\n * draw, so nodes that draw nothing (container) or keep their content out of hit testing (button,\r\n * whose `@pixi/ui` view is inert while authoring) would silently stop being selectable.\r\n *\r\n * Deliberately `containsPoint` and NOT `hitArea`: Pixi's `hitPruneFn` drops a container together\r\n * with its whole subtree once the point falls outside its `hitArea`, which would make any child\r\n * reaching past its parent's rectangle visible but unclickable. `containsPoint` never clips\r\n * children — they are hit-tested first and independently, so a child always stays grabbable.\r\n */\r\n containsPoint(point: PointData): boolean {\r\n return this.grabRect.contains(point.x, point.y);\r\n }\r\n\r\n /** Заменяет содержимое ноды: прежнее снимается со сцены и уничтожается, чтобы не копить сироты. */\r\n protected setContent(content: Container): void {\r\n if (this.content !== undefined) { this.removeChild(this.content); this.content.destroy(); }\r\n this.content = content;\r\n this.addChild(content);\r\n }\r\n\r\n /** Syncs type-specific content to the resolved layout rectangle; layout math itself is shared. */\r\n protected abstract syncContent(node: UINode, transform: UINode[\"transform\"], profile: LayoutProfileId): void;\r\n\r\n /**\r\n * Called after the view's own transform has been applied, before the next render. A subclass can\r\n * use it to recompute geometry that depends on the view's world transform (e.g. Spine connector\r\n * hosts) immediately, without waiting for the next ticker frame or document commit.\r\n */\r\n protected onLayoutTransformApplied(): void {}\r\n\r\n private applyResolvedTransform(node: UINode, transform: UINode[\"transform\"], visible: boolean, managedByLayout: boolean, profile: LayoutProfileId): void {\r\n this.syncContent(node, transform, profile);\r\n\r\n const pivotX = (transform.pivotX ?? 0) * transform.width;\r\n const pivotY = (transform.pivotY ?? 0) * transform.height;\r\n this.pivot.set(pivotX, pivotY);\r\n // x/y are the pivot offset from the resolved anchor. Thus a centred anchor and pivot at\r\n // zero offsets place the visual centre exactly at the parent's centre.\r\n // A managed child is positioned by its technical Yoga item. Its own NodeView keeps only the\r\n // pivot offset inside that computed rectangle; authored x/y and anchors do not participate.\r\n this.position.set(managedByLayout ? pivotX : transform.x, managedByLayout ? pivotY : transform.y);\r\n this.rotation = transform.rotation;\r\n this.scale.set(transform.scaleX, transform.scaleY);\r\n this.authoredVisible = visible;\r\n this.visible = visible && !this.hiddenByOwner;\r\n this.layoutWidth = transform.width;\r\n this.layoutHeight = transform.height;\r\n // Тот же прямоугольник, что видит пользователь: grab-зона не зависит от содержимого ноды.\r\n this.grabRect.x = 0;\r\n this.grabRect.y = 0;\r\n this.grabRect.width = transform.width;\r\n this.grabRect.height = transform.height;\r\n this.onLayoutTransformApplied();\r\n }\r\n\r\n update(node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize): void {\r\n const resolved = resolveProfileTransform(node, profile);\r\n this.applyResolvedTransform(node, resolveAnchoredTransform(resolved.transform, parentSize), resolved.visible, false, profile);\r\n }\r\n\r\n /** Applies a transient editor rectangle without deriving it from content-dependent Pixi bounds. */\r\n preview(node: UINode, transform: UINode[\"transform\"], visible = true, profile: LayoutProfileId = \"desktop\"): void {\r\n this.applyResolvedTransform(node, transform, visible, false, profile);\r\n }\r\n\r\n /** Applies the rectangle owned by a direct parent's layout solver. */\r\n updateManaged(node: UINode, profile: LayoutProfileId, size: LayoutSize): void {\r\n const resolved = resolveProfileTransform(node, profile);\r\n this.applyResolvedTransform(node, { ...resolved.transform, x: 0, y: 0, width: size.width, height: size.height }, resolved.visible, true, profile);\r\n }\r\n\r\n get layoutRectangle(): LayoutSize {\r\n return { width: this.layoutWidth, height: this.layoutHeight };\r\n }\r\n\r\n /** Авторская видимость узла отдельно от `visible`, поверх которой применяется `hiddenByOwner`. */\r\n get documentVisible(): boolean {\r\n return this.authoredVisible;\r\n }\r\n\r\n getSpine(): Spine | undefined {\r\n return this.content instanceof Spine ? this.content : undefined;\r\n }\r\n\r\n /**\r\n * Rasterizes canvas-based content (`TextNodeView`) at a higher pixel density than the renderer's\r\n * own backing resolution, so an authoring camera zoomed in doesn't magnify an already-rasterized\r\n * bitmap past its source resolution and read as blurred. A no-op base implementation: sprite/\r\n * graphics/bitmap-text content is either GPU-native (always crisp under zoom) or, for bitmap-text,\r\n * has its resolution fixed by the installed `BitmapFont` and can't be changed per instance.\r\n */\r\n setContentResolution(_resolution: number): void {}\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"NodeView.js","sourceRoot":"","sources":["../../src/views/NodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,SAAS,EAA2B,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAmB,MAAM,cAAc,CAAC;AASlG;;;;GAIG;AACH,MAAM,OAAgB,QAAS,SAAQ,SAAS;IACpC,OAAO,CAAa;IAC9B,4FAA4F;IACzE,QAAQ,CAA2C;IACtE,6FAA6F;IAC5E,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;IAC5C,yGAAyG;IAC/F,WAAW,GAAG,CAAC,CAAC;IAChB,YAAY,GAAG,CAAC,CAAC;IAC3B;;;;;;;;OAQG;IACH,aAAa,GAAG,KAAK,CAAC;IACtB,4FAA4F;IACpF,eAAe,GAAG,IAAI,CAAC;IAE/B,YAAY,QAAuC;QACjD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAES,UAAU,CAAC,OAA2B;QAC9C,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,E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CAAC,IAAY,EAAE,OAAwB,EAAE,IAAgB,EAAE,YAAY,GAAG,KAAK;QAC1F,MAAM,QAAQ,GAAG,uBAAuB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,sBAAsB,CAAC,IAAI,EAAE,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,YAAY,IAAI,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACpK,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;IAChE,CAAC;IAED,kGAAkG;IAClG,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACH,oBAAoB,CAAC,WAAmB,IAAS,CAAC;CACnD","sourcesContent":["import { Spine } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport { type LayoutProfileId, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { Container, Rectangle, Texture, type PointData } from \"pixi.js\";\r\nimport { resolveAnchoredTransform, resolveProfileTransform, type LayoutSize } from \"../layout.js\";\r\n\r\n/**\r\n * Whether a built scene is an inert authoring surface or a live one.\r\n * The editor canvas builds `authoring` scenes so controls never swallow selection and drag\r\n * gestures; Preview and the consuming app build `runtime` scenes with real pointer handling.\r\n */\r\nexport type SceneInteractionMode = \"authoring\" | \"runtime\";\r\n\r\n/**\r\n * Base display object for every schema node type. The whole layout contract — profile overrides,\r\n * anchors, pivot, position, scale, visibility — lives here once; subclasses only synchronize their\r\n * type-specific content against the resolved layout rectangle.\r\n */\r\nexport abstract class NodeView extends Container {\r\n protected content?: Container;\r\n /** A mutable scene texture map: assets may be loaded after this stable view was created. */\r\n protected readonly textures: ReadonlyMap<string, Texture> | undefined;\r\n /** Node's own grab rectangle in local space, kept equal to its resolved layout rectangle. */\r\n private readonly grabRect = new Rectangle();\r\n /** Authored/computed RectTransform-like rectangle; unlike Pixi bounds it also exists without content. */\r\n protected layoutWidth = 0;\r\n protected layoutHeight = 0;\r\n /**\r\n * Скрыт ли узел владельцем-вместимостью (`ItemTableNodeView`) поверх авторской видимости.\r\n *\r\n * Флаг живёт здесь, а не только в самом владельце, потому что `visible` заново выводится из\r\n * документа на каждом обновлении — в том числе в `updateManaged`, который для элемента внутри\r\n * layout-группы дёргает сам layout-движок своим колбэком `onLayout` (см. `LayoutItemContainer`),\r\n * то есть уже после того, как владелец закончил свой проход. Одно присваивание `visible` снаружи\r\n * пережило бы ровно до следующего пересчёта раскладки; сложение с этим флагом переживает любой.\r\n */\r\n hiddenByOwner = false;\r\n /** Visibility last resolved from the document, before `hiddenByOwner` is applied on top. */\r\n private authoredVisible = true;\r\n\r\n constructor(textures?: ReadonlyMap<string, Texture>) {\r\n super();\r\n this.textures = textures;\r\n }\r\n\r\n protected textureFor(assetId: string | undefined): Texture | undefined {\r\n return assetId === undefined ? undefined : this.textures?.get(assetId);\r\n }\r\n\r\n /**\r\n * Makes every node selectable and draggable by its layout rectangle, whatever it renders.\r\n *\r\n * Lives here rather than in a subclass because a bare `Container` has no `containsPoint` of its\r\n * own: without this, Pixi could only find a node through whatever content the subclass happens to\r\n * draw, so nodes that draw nothing (container) or keep their content out of hit testing (button,\r\n * whose `@pixi/ui` view is inert while authoring) would silently stop being selectable.\r\n *\r\n * Deliberately `containsPoint` and NOT `hitArea`: Pixi's `hitPruneFn` drops a container together\r\n * with its whole subtree once the point falls outside its `hitArea`, which would make any child\r\n * reaching past its parent's rectangle visible but unclickable. `containsPoint` never clips\r\n * children — they are hit-tested first and independently, so a child always stays grabbable.\r\n */\r\n containsPoint(point: PointData): boolean {\r\n return this.grabRect.contains(point.x, point.y);\r\n }\r\n\r\n /** Заменяет содержимое ноды: прежнее снимается со сцены и уничтожается, чтобы не копить сироты. */\r\n protected setContent(content: Container): void {\r\n if (this.content !== undefined) { this.removeChild(this.content); this.content.destroy(); }\r\n this.content = content;\r\n this.addChild(content);\r\n }\r\n\r\n /** Syncs type-specific content to the resolved layout rectangle; layout math itself is shared. */\r\n protected abstract syncContent(node: UINode, transform: UINode[\"transform\"], profile: LayoutProfileId): void;\r\n\r\n /**\r\n * Called after the view's own transform has been applied, before the next render. A subclass can\r\n * use it to recompute geometry that depends on the view's world transform (e.g. Spine connector\r\n * hosts) immediately, without waiting for the next ticker frame or document commit.\r\n */\r\n protected onLayoutTransformApplied(): void {}\r\n\r\n private applyResolvedTransform(node: UINode, transform: UINode[\"transform\"], visible: boolean, managedByLayout: boolean, profile: LayoutProfileId): void {\r\n this.syncContent(node, transform, profile);\r\n\r\n const pivotX = (transform.pivotX ?? 0) * transform.width;\r\n const pivotY = (transform.pivotY ?? 0) * transform.height;\r\n this.pivot.set(pivotX, pivotY);\r\n // x/y are the pivot offset from the resolved anchor. Thus a centred anchor and pivot at\r\n // zero offsets place the visual centre exactly at the parent's centre.\r\n // A managed child is positioned by its technical Yoga item. Its own NodeView keeps only the\r\n // pivot offset inside that computed rectangle; authored x/y and anchors do not participate.\r\n this.position.set(managedByLayout ? pivotX : transform.x, managedByLayout ? pivotY : transform.y);\r\n this.rotation = transform.rotation;\r\n this.scale.set(transform.scaleX, transform.scaleY);\r\n this.authoredVisible = visible;\r\n this.visible = visible && !this.hiddenByOwner;\r\n this.layoutWidth = transform.width;\r\n this.layoutHeight = transform.height;\r\n // Тот же прямоугольник, что видит пользователь: grab-зона не зависит от содержимого ноды.\r\n this.grabRect.x = 0;\r\n this.grabRect.y = 0;\r\n this.grabRect.width = transform.width;\r\n this.grabRect.height = transform.height;\r\n this.onLayoutTransformApplied();\r\n }\r\n\r\n update(node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize): void {\r\n const resolved = resolveProfileTransform(node, profile);\r\n this.applyResolvedTransform(node, resolveAnchoredTransform(resolved.transform, parentSize), resolved.visible, false, profile);\r\n }\r\n\r\n /** Applies a transient editor rectangle without deriving it from content-dependent Pixi bounds. */\r\n preview(node: UINode, transform: UINode[\"transform\"], visible = true, profile: LayoutProfileId = \"desktop\"): void {\r\n this.applyResolvedTransform(node, transform, visible, false, profile);\r\n }\r\n\r\n /**\r\n * Applies the rectangle owned by a direct parent's layout solver.\r\n *\r\n * `forceVisible` lets an owner that already fully owns show/hide of this child (a page group's\r\n * `PageItemContainer`, see `pageGroup.ts`) override the node's own authored `visible` — the same\r\n * way it already overrides position: a page isn't a content item that can independently opt out of\r\n * being shown, it's a whole sub-screen whose only visibility switch is \"is it the active page\".\r\n */\r\n updateManaged(node: UINode, profile: LayoutProfileId, size: LayoutSize, forceVisible = false): void {\r\n const resolved = resolveProfileTransform(node, profile);\r\n this.applyResolvedTransform(node, { ...resolved.transform, x: 0, y: 0, width: size.width, height: size.height }, forceVisible || resolved.visible, true, profile);\r\n }\r\n\r\n get layoutRectangle(): LayoutSize {\r\n return { width: this.layoutWidth, height: this.layoutHeight };\r\n }\r\n\r\n /** Авторская видимость узла отдельно от `visible`, поверх которой применяется `hiddenByOwner`. */\r\n get documentVisible(): boolean {\r\n return this.authoredVisible;\r\n }\r\n\r\n getSpine(): Spine | undefined {\r\n return this.content instanceof Spine ? this.content : undefined;\r\n }\r\n\r\n /**\r\n * Rasterizes canvas-based content (`TextNodeView`) at a higher pixel density than the renderer's\r\n * own backing resolution, so an authoring camera zoomed in doesn't magnify an already-rasterized\r\n * bitmap past its source resolution and read as blurred. A no-op base implementation: sprite/\r\n * graphics/bitmap-text content is either GPU-native (always crisp under zoom) or, for bitmap-text,\r\n * has its resolution fixed by the installed `BitmapFont` and can't be changed per instance.\r\n */\r\n setContentResolution(_resolution: number): void {}\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixi-ui-editor/runtime-pixi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "PixiJS runtime that renders Pixi UI Editor scene documents in a game.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"pixi.js": "^8.19.0",
|
|
31
31
|
"typed-signals": "^2.5.0",
|
|
32
32
|
"yoga-layout": "^3.2.1",
|
|
33
|
-
"@pixi-ui-editor/schema": "0.
|
|
33
|
+
"@pixi-ui-editor/schema": "0.11.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^26.2.0"
|