@pixi-ui-editor/runtime-pixi 0.6.1 → 0.7.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.
@@ -1,4 +1,5 @@
1
1
  import { type ButtonStateKey, type LayoutPadding, type StagedButtonNode, type UINode } from "@pixi-ui-editor/schema";
2
+ import { FancyButton } from "@pixi/ui";
2
3
  import type { Sound } from "@pixi/sound";
3
4
  import { Texture } from "pixi.js";
4
5
  import { Signal } from "typed-signals";
@@ -29,6 +30,12 @@ export declare class StagedButtonNodeView extends NodeView {
29
30
  private enabledState;
30
31
  /** Последнее editor-only визуальное состояние из `setState`: переживает пересборку `FancyButton`. */
31
32
  private forcedState;
33
+ /** Stable public signals: subscriptions survive an internal `FancyButton` rebuild. */
34
+ readonly onPress: FancyButton["onPress"];
35
+ readonly onDown: FancyButton["onDown"];
36
+ readonly onUp: FancyButton["onUp"];
37
+ readonly onHover: FancyButton["onHover"];
38
+ readonly onOut: FancyButton["onOut"];
32
39
  readonly onStageChange: Signal<(stage: {
33
40
  index: number;
34
41
  value: string;
@@ -1 +1 @@
1
- {"version":3,"file":"StagedButtonNodeView.d.ts","sourceRoot":"","sources":["../../src/views/StagedButtonNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAExI,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAgD,OAAO,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEpE,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAKjC;;;;;;;;;;GAUG;AACH,qBAAa,oBAAqB,SAAQ,QAAQ;IAChD,OAAO,CA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AAa,GAAG,IAAI;IAWhD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAEzB;IAED,IAAI,KAAK,IAAI,MAAM,CAGlB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,iGAAiG;IACjG,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAO7B,uGAAuG;IACvG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM/B,mFAAmF;IACnF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM7B,8EAA8E;IAC9E,IAAI,IAAI,IAAI;IAUZ,6DAA6D;IAC7D,KAAK,IAAI,IAAI;IAKb,0GAA0G;IAC1G,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;CAItC"}
@@ -29,6 +29,12 @@ export class StagedButtonNodeView extends NodeView {
29
29
  enabledState;
30
30
  /** Последнее editor-only визуальное состояние из `setState`: переживает пересборку `FancyButton`. */
31
31
  forcedState;
32
+ /** Stable public signals: subscriptions survive an internal `FancyButton` rebuild. */
33
+ onPress = new Signal();
34
+ onDown = new Signal();
35
+ onUp = new Signal();
36
+ onHover = new Signal();
37
+ onOut = new Signal();
32
38
  onStageChange = new Signal();
33
39
  constructor(node, textures, interaction, sounds) {
34
40
  super(textures);
@@ -79,17 +85,22 @@ export class StagedButtonNodeView extends NodeView {
79
85
  if (this.interaction === "authoring")
80
86
  button.eventMode = "none";
81
87
  else {
82
- button.onPress.connect(() => {
88
+ button.onPress.connect((source, event) => {
83
89
  this.next();
84
90
  const result = this.soundAssetIds?.pressAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.pressAssetId)?.play();
85
91
  if (result instanceof Promise)
86
92
  void result.catch(() => undefined);
93
+ this.onPress.emit(source, event);
87
94
  });
88
- button.onHover.connect(() => {
95
+ button.onDown.connect((source, event) => this.onDown.emit(source, event));
96
+ button.onUp.connect((source, event) => this.onUp.emit(source, event));
97
+ button.onHover.connect((source, event) => {
89
98
  const result = this.soundAssetIds?.hoverAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.hoverAssetId)?.play();
90
99
  if (result instanceof Promise)
91
100
  void result.catch(() => undefined);
101
+ this.onHover.emit(source, event);
92
102
  });
103
+ button.onOut.connect((source, event) => this.onOut.emit(source, event));
93
104
  }
94
105
  this.button = button;
95
106
  this.stateViews = stateViews;
@@ -1 +1 @@
1
- {"version":3,"file":"StagedButtonNodeView.js","sourceRoot":"","sources":["../../src/views/StagedButtonNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+E,MAAM,wBAAwB,CAAC;AACxI,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAa,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAW,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AAKpE,MAAM,kBAAkB,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAW,CAAC;AAEpH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,oBAAqB,SAAQ,QAAQ;IACxC,MAAM,CAAe;IACrB,UAAU,CAAqC;IACtC,WAAW,CAAuB;IAClC,MAAM,CAAyC;IACxD,aAAa,CAA6B;IAC1C,SAAS,CAA4B;IACrC,UAAU,CAAsB;IAChC,cAAc,CAAS;IACvB,cAAc,CAAS;IACvB,SAAS,CAAU;IACnB,YAAY,CAAU;IAC9B,qGAAqG;IAC7F,WAAW,CAA6B;IAEvC,aAAa,GAAG,IAAI,MAAM,EAAqD,CAAC;IAEzF,YAAY,IAAsB,EAAE,QAAkD,EAAE,WAAiC,EAAE,MAAmC;QAC5J,KA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S, type ButtonStateKey, type LayoutPadding, type StagedButtonNode, type UINode } from \"@pixi-ui-editor/schema\";\nimport { FancyButton } from \"@pixi/ui\";\nimport type { Sound } from \"@pixi/sound\";\nimport { Container, Graphics, NineSliceSprite, Sprite, Texture } from \"pixi.js\";\nimport { Signal } from \"typed-signals\";\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\n\nexport type { StagedButtonNode };\ntype StagedButtonStage = StagedButtonNode[\"stages\"][number];\n\nconst FANCY_STATE_BY_KEY = { normal: \"default\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\n\n/**\n * Adapts a staged-button node to `@pixi/ui`'s `FancyButton`, exactly like `ButtonNodeView` does for a\n * plain button — this class never reimplements its pointer state machine either. It is a deliberately\n * separate component (see TASK-057): it does not extend or share behavior with `ButtonNodeView`.\n *\n * A click at runtime advances the current stage (`next()`), which respects `wrap`. Four state views\n * are created once and reused across stages: changing stage only reassigns their textures/size, never\n * replacing the view type — a full `FancyButton` rebuild only happens when a view's required *type*\n * changes (nine-slice toggled, or a texture just finished loading), because `FancyButton` gives no way\n * to swap a view after construction.\n */\nexport class StagedButtonNodeView extends NodeView {\n private button!: FancyButton;\n private stateViews!: Record<ButtonStateKey, Container>;\n private readonly interaction: SceneInteractionMode;\n private readonly sounds: ReadonlyMap<string, Sound> | undefined;\n private soundAssetIds: StagedButtonNode[\"sounds\"];\n private nineSlice: LayoutPadding | undefined;\n private stagesData: StagedButtonStage[];\n private currentStageId: string;\n private defaultStageId: string;\n private wrapState: boolean;\n private enabledState: boolean;\n /** Последнее editor-only визуальное состояние из `setState`: переживает пересборку `FancyButton`. */\n private forcedState: ButtonStateKey | undefined;\n\n readonly onStageChange = new Signal<(stage: { index: number; value: string }) => void>();\n\n constructor(node: StagedButtonNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, sounds?: ReadonlyMap<string, Sound>) {\n super(textures);\n this.interaction = interaction;\n this.sounds = sounds;\n this.soundAssetIds = node.sounds;\n this.nineSlice = node.nineSlice;\n this.stagesData = node.stages;\n this.wrapState = node.wrap;\n this.defaultStageId = node.defaultStageId;\n this.currentStageId = node.stages.some((stage) => stage.id === node.defaultStageId) ? node.defaultStageId : node.stages[0]!.id;\n this.enabledState = node.enabled;\n this.buildButton();\n }\n\n private currentStage(): StagedButtonStage {\n return this.stagesData.find((stage) => stage.id === this.currentStageId) ?? this.stagesData[0]!;\n }\n\n private static createStateView(texture: Texture | undefined, nineSlice: LayoutPadding | undefined): Container {\n if (texture === undefined) return new Graphics();\n return nineSlice === undefined\n ? new Sprite(texture)\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\n }\n\n /**\n * (Re)builds `FancyButton` and its four state views for the current stage. `size`, when provided,\n * sizes the freshly built views immediately — needed because a stage change may happen well outside\n * a `syncContent` pass (e.g. a runtime click), where nothing else would resize them afterwards.\n */\n private buildButton(size?: { width: number; height: number }): void {\n const stage = this.currentStage();\n const normalTexture = this.textureFor(stage.states.normalAssetId);\n const stateViews = {} as Record<ButtonStateKey, Container>;\n const viewFor = (state: ButtonStateKey, assetId: string | undefined): Container => {\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\n const view = StagedButtonNodeView.createStateView(texture, this.nineSlice);\n stateViews[state] = view;\n return view;\n };\n\n const button = new FancyButton({\n defaultView: viewFor(\"normal\", stage.states.normalAssetId),\n hoverView: viewFor(\"hover\", stage.states.hoverAssetId),\n pressedView: viewFor(\"pressed\", stage.states.pressedAssetId),\n disabledView: viewFor(\"disabled\", stage.states.disabledAssetId),\n });\n // Authoring-сцена инертна, как и у обычной кнопки: клики не должны крутить стадию, а попадание по\n // ноде остаётся ответственностью NodeView.containsPoint.\n if (this.interaction === \"authoring\") button.eventMode = \"none\";\n else {\n button.onPress.connect(() => {\n this.next();\n const result = this.soundAssetIds?.pressAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.pressAssetId)?.play();\n if (result instanceof Promise) void result.catch(() => undefined);\n });\n button.onHover.connect(() => {\n const result = this.soundAssetIds?.hoverAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.hoverAssetId)?.play();\n if (result instanceof Promise) void result.catch(() => undefined);\n });\n }\n this.button = button;\n this.stateViews = stateViews;\n this.setContent(button);\n\n const resolved = size ?? this.layoutRectangle;\n this.applySizes(resolved.width, resolved.height);\n\n // Пересборка — деталь реализации `FancyButton`, а не действие пользователя: transient enabled и\n // визуальное состояние восстанавливаются на новом инстансе, иначе переключение nine-slice или\n // догрузка текстуры сбрасывали бы их.\n this.applyEnabled(this.enabledState);\n if (this.forcedState !== undefined) this.button.setState(FANCY_STATE_BY_KEY[this.forcedState]);\n }\n\n /**\n * Sizes the four state views to the resolved layout rectangle without touching their textures.\n *\n * `NineSliceSprite` проверяется отдельно: в PixiJS 8 он наследуется от `ViewContainer`, а не от\n * `Sprite`, поэтому одна ветка `instanceof Sprite` его молча пропускает.\n */\n private applySizes(width: number, height: number): void {\n for (const state of BUTTON_STATE_KEYS) {\n const view = this.stateViews[state];\n if (view instanceof NineSliceSprite) view.setSize(width, height);\n else if (view instanceof Sprite) view.setSize(width, height);\n else if (view instanceof Graphics) view.clear().rect(0, 0, width, height).fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\n }\n }\n\n /**\n * Applies the current stage's textures/border to the existing state views (or rebuilds them if a\n * view's required type no longer matches, the same rule `ButtonNodeView.syncContent` follows).\n */\n private refreshStateViews(width: number, height: number): void {\n const stage = this.currentStage();\n const normalTexture = this.textureFor(stage.states.normalAssetId);\n\n let needsRebuild = false;\n for (const state of BUTTON_STATE_KEYS) {\n const assetId = stage.states[`${state}AssetId`];\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\n const view = this.stateViews[state];\n const wantsNineSlice = texture !== undefined && this.nineSlice !== undefined;\n // `NineSliceSprite` не наследуется от `Sprite` в PixiJS 8, поэтому ветки не пересекаются.\n const matches = texture === undefined ? view instanceof Graphics : wantsNineSlice ? view instanceof NineSliceSprite : view instanceof Sprite;\n if (!matches) { needsRebuild = true; break; }\n }\n\n if (needsRebuild) {\n this.buildButton({ width, height });\n return;\n }\n\n for (const state of BUTTON_STATE_KEYS) {\n const view = this.stateViews[state];\n const assetId = stage.states[`${state}AssetId`];\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\n // Set the texture before the layout size: Sprite/NineSliceSprite preserve scale when their\n // texture changes, so sizing first would shift visual bounds for a differently-sized source.\n if (view instanceof NineSliceSprite) {\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\n if (this.nineSlice !== undefined) {\n view.leftWidth = this.nineSlice.left;\n view.topHeight = this.nineSlice.top;\n view.rightWidth = this.nineSlice.right;\n view.bottomHeight = this.nineSlice.bottom;\n }\n } else if (view instanceof Sprite) {\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\n }\n }\n this.applySizes(width, height);\n }\n\n private applyStage(stageId: string): void {\n this.currentStageId = stageId;\n const { width, height } = this.layoutRectangle;\n this.refreshStateViews(width, height);\n }\n\n /** In authoring mode `enabled` may only drive the visuals: `FancyButton` couples it to `eventMode`. */\n private applyEnabled(enabled: boolean): void {\n this.enabledState = enabled;\n if (this.interaction === \"runtime\") this.button.enabled = enabled;\n else this.button.setState(enabled ? \"default\" : \"disabled\");\n }\n\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\n if (node.type !== \"staged-button\") return;\n this.soundAssetIds = node.sounds;\n this.nineSlice = node.nineSlice;\n this.wrapState = node.wrap;\n this.defaultStageId = node.defaultStageId;\n\n // Сохраняет текущую стадию, если она ещё существует после изменения документа; если стадию\n // удалили — переходит на ближайшую валидную по прежнему индексу.\n const previousIndex = this.stagesData.findIndex((stage) => stage.id === this.currentStageId);\n this.stagesData = node.stages;\n if (!node.stages.some((stage) => stage.id === this.currentStageId)) {\n const clampedIndex = Math.min(Math.max(previousIndex, 0), node.stages.length - 1);\n this.currentStageId = node.stages[clampedIndex]!.id;\n }\n\n this.refreshStateViews(transform.width, transform.height);\n\n // Только на изменение документа: иначе любой пересчёт layout сбрасывал бы transient preview state.\n if (node.enabled !== this.enabledState) this.applyEnabled(node.enabled);\n }\n\n /** Editor-only live preview of nine-slice border edits while dragging the canvas gizmo. */\n previewNineSlice(nineSlice: LayoutPadding): void {\n for (const state of BUTTON_STATE_KEYS) {\n const view = this.stateViews[state];\n if (!(view instanceof NineSliceSprite)) continue;\n view.leftWidth = nineSlice.left;\n view.topHeight = nineSlice.top;\n view.rightWidth = nineSlice.right;\n view.bottomHeight = nineSlice.bottom;\n }\n }\n\n get enabled(): boolean {\n return this.enabledState;\n }\n\n set enabled(value: boolean) {\n this.applyEnabled(value);\n }\n\n get stage(): number {\n const index = this.stagesData.findIndex((stage) => stage.id === this.currentStageId);\n return index === -1 ? 0 : index;\n }\n\n get value(): string {\n return this.currentStage().value;\n }\n\n get stageCount(): number {\n return this.stagesData.length;\n }\n\n /** Moves to the stage at `index` and emits `onStageChange`; an out-of-range index is a no-op. */\n setStage(index: number): void {\n const target = this.stagesData[index];\n if (target === undefined) return;\n this.applyStage(target.id);\n this.onStageChange.emit({ index, value: target.value });\n }\n\n /** Moves to the stage at `index` without emitting — used by editor preview to avoid feedback loops. */\n forceStage(index: number): void {\n const target = this.stagesData[index];\n if (target === undefined) return;\n this.applyStage(target.id);\n }\n\n /** Moves to the first stage whose `value` matches; an unknown value is ignored. */\n setValue(value: string): void {\n const index = this.stagesData.findIndex((stage) => stage.value === value);\n if (index === -1) return;\n this.setStage(index);\n }\n\n /** Advances one stage, as a click does; respects `wrap` at the last stage. */\n next(): void {\n const nextIndex = this.stage + 1;\n if (nextIndex >= this.stagesData.length) {\n if (!this.wrapState) return;\n this.setStage(0);\n return;\n }\n this.setStage(nextIndex);\n }\n\n /** Returns to `defaultStageId`, emitting `onStageChange`. */\n reset(): void {\n const index = this.stagesData.findIndex((stage) => stage.id === this.defaultStageId);\n this.setStage(index === -1 ? 0 : index);\n }\n\n /** Forces an editor-only visual state without changing `enabled`, mirroring `ButtonNodeView.setState`. */\n setState(state: ButtonStateKey): void {\n this.forcedState = state;\n this.button.setState(FANCY_STATE_BY_KEY[state]);\n }\n}\n"]}
1
+ {"version":3,"file":"StagedButtonNodeView.js","sourceRoot":"","sources":["../../src/views/StagedButtonNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+E,MAAM,wBAAwB,CAAC;AACxI,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAa,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAW,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AAMpE,MAAM,kBAAkB,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAW,CAAC;AAEpH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,oBAAqB,SAAQ,QAAQ;IACxC,MAAM,CAAe;IACrB,UAAU,CAAqC;IACtC,WAAW,CAAuB;IAClC,MAAM,CAAyC;IACxD,aAAa,CAA6B;IAC1C,SAAS,CAA4B;IACrC,UAAU,CAAsB;IAChC,cAAc,CAAS;IACvB,cAAc,CAAS;IACvB,SAAS,CAAU;IACnB,YAAY,CAAU;IAC9B,qGAAqG;IAC7F,WAAW,CAA6B;IAEhD,sFAAsF;IAC7E,OAAO,GAA2B,IAAI,MAAM,EAA2B,CAAC;IACxE,MAAM,GAA0B,IAAI,MAAM,EAA2B,CAAC;IACtE,IAAI,GAAwB,IAAI,MAAM,EAA2B,CAAC;IAClE,OAAO,GAA2B,IAAI,MAAM,EAA2B,CAAC;IACxE,KAAK,GAAyB,IAAI,MAAM,EAA2B,CAAC;IACpE,aAAa,GAAG,IAAI,M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AAI,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,OAAO;YAC5B,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YACjB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,6DAA6D;IAC7D,KAAK;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC;QACrF,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,0GAA0G;IAC1G,QAAQ,CAAC,KAAqB;QAC5B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["import { BUTTON_STATE_KEYS, type ButtonStateKey, type LayoutPadding, type StagedButtonNode, type UINode } from \"@pixi-ui-editor/schema\";\nimport { FancyButton } from \"@pixi/ui\";\nimport type { Sound } from \"@pixi/sound\";\nimport { Container, Graphics, NineSliceSprite, Sprite, Texture } from \"pixi.js\";\nimport { Signal } from \"typed-signals\";\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\n\nexport type { StagedButtonNode };\ntype StagedButtonStage = StagedButtonNode[\"stages\"][number];\ntype FancyButtonEventHandler = Parameters<FancyButton[\"onPress\"][\"connect\"]>[0];\n\nconst FANCY_STATE_BY_KEY = { normal: \"default\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\n\n/**\n * Adapts a staged-button node to `@pixi/ui`'s `FancyButton`, exactly like `ButtonNodeView` does for a\n * plain button — this class never reimplements its pointer state machine either. It is a deliberately\n * separate component (see TASK-057): it does not extend or share behavior with `ButtonNodeView`.\n *\n * A click at runtime advances the current stage (`next()`), which respects `wrap`. Four state views\n * are created once and reused across stages: changing stage only reassigns their textures/size, never\n * replacing the view type — a full `FancyButton` rebuild only happens when a view's required *type*\n * changes (nine-slice toggled, or a texture just finished loading), because `FancyButton` gives no way\n * to swap a view after construction.\n */\nexport class StagedButtonNodeView extends NodeView {\n private button!: FancyButton;\n private stateViews!: Record<ButtonStateKey, Container>;\n private readonly interaction: SceneInteractionMode;\n private readonly sounds: ReadonlyMap<string, Sound> | undefined;\n private soundAssetIds: StagedButtonNode[\"sounds\"];\n private nineSlice: LayoutPadding | undefined;\n private stagesData: StagedButtonStage[];\n private currentStageId: string;\n private defaultStageId: string;\n private wrapState: boolean;\n private enabledState: boolean;\n /** Последнее editor-only визуальное состояние из `setState`: переживает пересборку `FancyButton`. */\n private forcedState: ButtonStateKey | undefined;\n\n /** Stable public signals: subscriptions survive an internal `FancyButton` rebuild. */\n readonly onPress: FancyButton[\"onPress\"] = new Signal<FancyButtonEventHandler>();\n readonly onDown: FancyButton[\"onDown\"] = new Signal<FancyButtonEventHandler>();\n readonly onUp: FancyButton[\"onUp\"] = new Signal<FancyButtonEventHandler>();\n readonly onHover: FancyButton[\"onHover\"] = new Signal<FancyButtonEventHandler>();\n readonly onOut: FancyButton[\"onOut\"] = new Signal<FancyButtonEventHandler>();\n readonly onStageChange = new Signal<(stage: { index: number; value: string }) => void>();\n\n constructor(node: StagedButtonNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, sounds?: ReadonlyMap<string, Sound>) {\n super(textures);\n this.interaction = interaction;\n this.sounds = sounds;\n this.soundAssetIds = node.sounds;\n this.nineSlice = node.nineSlice;\n this.stagesData = node.stages;\n this.wrapState = node.wrap;\n this.defaultStageId = node.defaultStageId;\n this.currentStageId = node.stages.some((stage) => stage.id === node.defaultStageId) ? node.defaultStageId : node.stages[0]!.id;\n this.enabledState = node.enabled;\n this.buildButton();\n }\n\n private currentStage(): StagedButtonStage {\n return this.stagesData.find((stage) => stage.id === this.currentStageId) ?? this.stagesData[0]!;\n }\n\n private static createStateView(texture: Texture | undefined, nineSlice: LayoutPadding | undefined): Container {\n if (texture === undefined) return new Graphics();\n return nineSlice === undefined\n ? new Sprite(texture)\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\n }\n\n /**\n * (Re)builds `FancyButton` and its four state views for the current stage. `size`, when provided,\n * sizes the freshly built views immediately — needed because a stage change may happen well outside\n * a `syncContent` pass (e.g. a runtime click), where nothing else would resize them afterwards.\n */\n private buildButton(size?: { width: number; height: number }): void {\n const stage = this.currentStage();\n const normalTexture = this.textureFor(stage.states.normalAssetId);\n const stateViews = {} as Record<ButtonStateKey, Container>;\n const viewFor = (state: ButtonStateKey, assetId: string | undefined): Container => {\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\n const view = StagedButtonNodeView.createStateView(texture, this.nineSlice);\n stateViews[state] = view;\n return view;\n };\n\n const button = new FancyButton({\n defaultView: viewFor(\"normal\", stage.states.normalAssetId),\n hoverView: viewFor(\"hover\", stage.states.hoverAssetId),\n pressedView: viewFor(\"pressed\", stage.states.pressedAssetId),\n disabledView: viewFor(\"disabled\", stage.states.disabledAssetId),\n });\n // Authoring-сцена инертна, как и у обычной кнопки: клики не должны крутить стадию, а попадание по\n // ноде остаётся ответственностью NodeView.containsPoint.\n if (this.interaction === \"authoring\") button.eventMode = \"none\";\n else {\n button.onPress.connect((source, event) => {\n this.next();\n const result = this.soundAssetIds?.pressAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.pressAssetId)?.play();\n if (result instanceof Promise) void result.catch(() => undefined);\n this.onPress.emit(source, event);\n });\n button.onDown.connect((source, event) => this.onDown.emit(source, event));\n button.onUp.connect((source, event) => this.onUp.emit(source, event));\n button.onHover.connect((source, event) => {\n const result = this.soundAssetIds?.hoverAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.hoverAssetId)?.play();\n if (result instanceof Promise) void result.catch(() => undefined);\n this.onHover.emit(source, event);\n });\n button.onOut.connect((source, event) => this.onOut.emit(source, event));\n }\n this.button = button;\n this.stateViews = stateViews;\n this.setContent(button);\n\n const resolved = size ?? this.layoutRectangle;\n this.applySizes(resolved.width, resolved.height);\n\n // Пересборка — деталь реализации `FancyButton`, а не действие пользователя: transient enabled и\n // визуальное состояние восстанавливаются на новом инстансе, иначе переключение nine-slice или\n // догрузка текстуры сбрасывали бы их.\n this.applyEnabled(this.enabledState);\n if (this.forcedState !== undefined) this.button.setState(FANCY_STATE_BY_KEY[this.forcedState]);\n }\n\n /**\n * Sizes the four state views to the resolved layout rectangle without touching their textures.\n *\n * `NineSliceSprite` проверяется отдельно: в PixiJS 8 он наследуется от `ViewContainer`, а не от\n * `Sprite`, поэтому одна ветка `instanceof Sprite` его молча пропускает.\n */\n private applySizes(width: number, height: number): void {\n for (const state of BUTTON_STATE_KEYS) {\n const view = this.stateViews[state];\n if (view instanceof NineSliceSprite) view.setSize(width, height);\n else if (view instanceof Sprite) view.setSize(width, height);\n else if (view instanceof Graphics) view.clear().rect(0, 0, width, height).fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\n }\n }\n\n /**\n * Applies the current stage's textures/border to the existing state views (or rebuilds them if a\n * view's required type no longer matches, the same rule `ButtonNodeView.syncContent` follows).\n */\n private refreshStateViews(width: number, height: number): void {\n const stage = this.currentStage();\n const normalTexture = this.textureFor(stage.states.normalAssetId);\n\n let needsRebuild = false;\n for (const state of BUTTON_STATE_KEYS) {\n const assetId = stage.states[`${state}AssetId`];\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\n const view = this.stateViews[state];\n const wantsNineSlice = texture !== undefined && this.nineSlice !== undefined;\n // `NineSliceSprite` не наследуется от `Sprite` в PixiJS 8, поэтому ветки не пересекаются.\n const matches = texture === undefined ? view instanceof Graphics : wantsNineSlice ? view instanceof NineSliceSprite : view instanceof Sprite;\n if (!matches) { needsRebuild = true; break; }\n }\n\n if (needsRebuild) {\n this.buildButton({ width, height });\n return;\n }\n\n for (const state of BUTTON_STATE_KEYS) {\n const view = this.stateViews[state];\n const assetId = stage.states[`${state}AssetId`];\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\n // Set the texture before the layout size: Sprite/NineSliceSprite preserve scale when their\n // texture changes, so sizing first would shift visual bounds for a differently-sized source.\n if (view instanceof NineSliceSprite) {\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\n if (this.nineSlice !== undefined) {\n view.leftWidth = this.nineSlice.left;\n view.topHeight = this.nineSlice.top;\n view.rightWidth = this.nineSlice.right;\n view.bottomHeight = this.nineSlice.bottom;\n }\n } else if (view instanceof Sprite) {\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\n }\n }\n this.applySizes(width, height);\n }\n\n private applyStage(stageId: string): void {\n this.currentStageId = stageId;\n const { width, height } = this.layoutRectangle;\n this.refreshStateViews(width, height);\n }\n\n /** In authoring mode `enabled` may only drive the visuals: `FancyButton` couples it to `eventMode`. */\n private applyEnabled(enabled: boolean): void {\n this.enabledState = enabled;\n if (this.interaction === \"runtime\") this.button.enabled = enabled;\n else this.button.setState(enabled ? \"default\" : \"disabled\");\n }\n\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\n if (node.type !== \"staged-button\") return;\n this.soundAssetIds = node.sounds;\n this.nineSlice = node.nineSlice;\n this.wrapState = node.wrap;\n this.defaultStageId = node.defaultStageId;\n\n // Сохраняет текущую стадию, если она ещё существует после изменения документа; если стадию\n // удалили — переходит на ближайшую валидную по прежнему индексу.\n const previousIndex = this.stagesData.findIndex((stage) => stage.id === this.currentStageId);\n this.stagesData = node.stages;\n if (!node.stages.some((stage) => stage.id === this.currentStageId)) {\n const clampedIndex = Math.min(Math.max(previousIndex, 0), node.stages.length - 1);\n this.currentStageId = node.stages[clampedIndex]!.id;\n }\n\n this.refreshStateViews(transform.width, transform.height);\n\n // Только на изменение документа: иначе любой пересчёт layout сбрасывал бы transient preview state.\n if (node.enabled !== this.enabledState) this.applyEnabled(node.enabled);\n }\n\n /** Editor-only live preview of nine-slice border edits while dragging the canvas gizmo. */\n previewNineSlice(nineSlice: LayoutPadding): void {\n for (const state of BUTTON_STATE_KEYS) {\n const view = this.stateViews[state];\n if (!(view instanceof NineSliceSprite)) continue;\n view.leftWidth = nineSlice.left;\n view.topHeight = nineSlice.top;\n view.rightWidth = nineSlice.right;\n view.bottomHeight = nineSlice.bottom;\n }\n }\n\n get enabled(): boolean {\n return this.enabledState;\n }\n\n set enabled(value: boolean) {\n this.applyEnabled(value);\n }\n\n get stage(): number {\n const index = this.stagesData.findIndex((stage) => stage.id === this.currentStageId);\n return index === -1 ? 0 : index;\n }\n\n get value(): string {\n return this.currentStage().value;\n }\n\n get stageCount(): number {\n return this.stagesData.length;\n }\n\n /** Moves to the stage at `index` and emits `onStageChange`; an out-of-range index is a no-op. */\n setStage(index: number): void {\n const target = this.stagesData[index];\n if (target === undefined) return;\n this.applyStage(target.id);\n this.onStageChange.emit({ index, value: target.value });\n }\n\n /** Moves to the stage at `index` without emitting — used by editor preview to avoid feedback loops. */\n forceStage(index: number): void {\n const target = this.stagesData[index];\n if (target === undefined) return;\n this.applyStage(target.id);\n }\n\n /** Moves to the first stage whose `value` matches; an unknown value is ignored. */\n setValue(value: string): void {\n const index = this.stagesData.findIndex((stage) => stage.value === value);\n if (index === -1) return;\n this.setStage(index);\n }\n\n /** Advances one stage, as a click does; respects `wrap` at the last stage. */\n next(): void {\n const nextIndex = this.stage + 1;\n if (nextIndex >= this.stagesData.length) {\n if (!this.wrapState) return;\n this.setStage(0);\n return;\n }\n this.setStage(nextIndex);\n }\n\n /** Returns to `defaultStageId`, emitting `onStageChange`. */\n reset(): void {\n const index = this.stagesData.findIndex((stage) => stage.id === this.defaultStageId);\n this.setStage(index === -1 ? 0 : index);\n }\n\n /** Forces an editor-only visual state without changing `enabled`, mirroring `ButtonNodeView.setState`. */\n setState(state: ButtonStateKey): void {\n this.forcedState = state;\n this.button.setState(FANCY_STATE_BY_KEY[state]);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixi-ui-editor/runtime-pixi",
3
- "version": "0.6.1",
3
+ "version": "0.7.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.6.1"
33
+ "@pixi-ui-editor/schema": "0.7.0"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsc -p tsconfig.json",