@pixi-ui-editor/runtime-pixi 0.1.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 (101) hide show
  1. package/dist/assets/fonts.d.ts +5 -0
  2. package/dist/assets/fonts.d.ts.map +1 -0
  3. package/dist/assets/fonts.js +50 -0
  4. package/dist/assets/fonts.js.map +1 -0
  5. package/dist/assets/sounds.d.ts +14 -0
  6. package/dist/assets/sounds.d.ts.map +1 -0
  7. package/dist/assets/sounds.js +156 -0
  8. package/dist/assets/sounds.js.map +1 -0
  9. package/dist/assets/spine.d.ts +18 -0
  10. package/dist/assets/spine.d.ts.map +1 -0
  11. package/dist/assets/spine.js +82 -0
  12. package/dist/assets/spine.js.map +1 -0
  13. package/dist/assets/textures.d.ts +15 -0
  14. package/dist/assets/textures.d.ts.map +1 -0
  15. package/dist/assets/textures.js +86 -0
  16. package/dist/assets/textures.js.map +1 -0
  17. package/dist/controls.d.ts +19 -0
  18. package/dist/controls.d.ts.map +1 -0
  19. package/dist/controls.js +55 -0
  20. package/dist/controls.js.map +1 -0
  21. package/dist/document.d.ts +8 -0
  22. package/dist/document.d.ts.map +1 -0
  23. package/dist/document.js +22 -0
  24. package/dist/document.js.map +1 -0
  25. package/dist/index.d.ts +22 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +19 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/index.test.d.ts +2 -0
  30. package/dist/index.test.d.ts.map +1 -0
  31. package/dist/index.test.js +315 -0
  32. package/dist/index.test.js.map +1 -0
  33. package/dist/layout.d.ts +32 -0
  34. package/dist/layout.d.ts.map +1 -0
  35. package/dist/layout.js +43 -0
  36. package/dist/layout.js.map +1 -0
  37. package/dist/layoutGroups.d.ts +31 -0
  38. package/dist/layoutGroups.d.ts.map +1 -0
  39. package/dist/layoutGroups.js +139 -0
  40. package/dist/layoutGroups.js.map +1 -0
  41. package/dist/particles.d.ts +139 -0
  42. package/dist/particles.d.ts.map +1 -0
  43. package/dist/particles.js +275 -0
  44. package/dist/particles.js.map +1 -0
  45. package/dist/particles.test.d.ts +2 -0
  46. package/dist/particles.test.d.ts.map +1 -0
  47. package/dist/particles.test.js +210 -0
  48. package/dist/particles.test.js.map +1 -0
  49. package/dist/scene.d.ts +41 -0
  50. package/dist/scene.d.ts.map +1 -0
  51. package/dist/scene.js +147 -0
  52. package/dist/scene.js.map +1 -0
  53. package/dist/scrollView.d.ts +28 -0
  54. package/dist/scrollView.d.ts.map +1 -0
  55. package/dist/scrollView.js +38 -0
  56. package/dist/scrollView.js.map +1 -0
  57. package/dist/test.setup.d.ts +2 -0
  58. package/dist/test.setup.d.ts.map +1 -0
  59. package/dist/test.setup.js +6 -0
  60. package/dist/test.setup.js.map +1 -0
  61. package/dist/views/ButtonNodeView.d.ts +36 -0
  62. package/dist/views/ButtonNodeView.d.ts.map +1 -0
  63. package/dist/views/ButtonNodeView.js +104 -0
  64. package/dist/views/ButtonNodeView.js.map +1 -0
  65. package/dist/views/InputNodeView.d.ts +36 -0
  66. package/dist/views/InputNodeView.d.ts.map +1 -0
  67. package/dist/views/InputNodeView.js +170 -0
  68. package/dist/views/InputNodeView.js.map +1 -0
  69. package/dist/views/NodeView.d.ts +53 -0
  70. package/dist/views/NodeView.d.ts.map +1 -0
  71. package/dist/views/NodeView.js +86 -0
  72. package/dist/views/NodeView.js.map +1 -0
  73. package/dist/views/ParticleEmitterNodeView.d.ts +26 -0
  74. package/dist/views/ParticleEmitterNodeView.d.ts.map +1 -0
  75. package/dist/views/ParticleEmitterNodeView.js +101 -0
  76. package/dist/views/ParticleEmitterNodeView.js.map +1 -0
  77. package/dist/views/ParticleEmitterNodeView.test.d.ts +2 -0
  78. package/dist/views/ParticleEmitterNodeView.test.d.ts.map +1 -0
  79. package/dist/views/ParticleEmitterNodeView.test.js +148 -0
  80. package/dist/views/ParticleEmitterNodeView.test.js.map +1 -0
  81. package/dist/views/ScrollViewNodeView.d.ts +29 -0
  82. package/dist/views/ScrollViewNodeView.d.ts.map +1 -0
  83. package/dist/views/ScrollViewNodeView.js +67 -0
  84. package/dist/views/ScrollViewNodeView.js.map +1 -0
  85. package/dist/views/SpineNodeView.d.ts +8 -0
  86. package/dist/views/SpineNodeView.d.ts.map +1 -0
  87. package/dist/views/SpineNodeView.js +30 -0
  88. package/dist/views/SpineNodeView.js.map +1 -0
  89. package/dist/views/ValueControlNodeViews.d.ts +37 -0
  90. package/dist/views/ValueControlNodeViews.d.ts.map +1 -0
  91. package/dist/views/ValueControlNodeViews.js +179 -0
  92. package/dist/views/ValueControlNodeViews.js.map +1 -0
  93. package/dist/views/basic.d.ts +29 -0
  94. package/dist/views/basic.d.ts.map +1 -0
  95. package/dist/views/basic.js +92 -0
  96. package/dist/views/basic.js.map +1 -0
  97. package/dist/views/createNodeView.d.ts +13 -0
  98. package/dist/views/createNodeView.d.ts.map +1 -0
  99. package/dist/views/createNodeView.js +89 -0
  100. package/dist/views/createNodeView.js.map +1 -0
  101. package/package.json +36 -0
@@ -0,0 +1,104 @@
1
+ import { BUTTON_STATE_KEYS } from "@pixi-ui-editor/schema";
2
+ import { FancyButton } from "@pixi/ui";
3
+ import { Graphics, Sprite } from "pixi.js";
4
+ import { NodeView } from "./NodeView.js";
5
+ const FANCY_STATE_BY_KEY = { normal: "default", hover: "hover", pressed: "pressed", disabled: "disabled" };
6
+ const KEY_BY_FANCY_STATE = { default: "normal", hover: "hover", pressed: "pressed", disabled: "disabled" };
7
+ /**
8
+ * Adapts a button node to `@pixi/ui`'s `FancyButton`, which owns the pointer state machine —
9
+ * this class never reimplements it. Optional states fall back to the normal image, and runtime
10
+ * changes to `enabled` or the current state stay in the view: they never touch the document.
11
+ */
12
+ export class ButtonNodeView extends NodeView {
13
+ button;
14
+ stateViews;
15
+ interaction;
16
+ sounds;
17
+ soundAssetIds;
18
+ enabledState;
19
+ constructor(node, textures, interaction, sounds) {
20
+ super(textures);
21
+ this.interaction = interaction;
22
+ this.sounds = sounds;
23
+ this.soundAssetIds = node.sounds;
24
+ const stateViews = {};
25
+ const normalTexture = textures?.get(node.states.normalAssetId);
26
+ const viewFor = (state, assetId) => {
27
+ const texture = (assetId === undefined ? undefined : textures?.get(assetId)) ?? normalTexture;
28
+ const view = texture === undefined ? new Graphics() : new Sprite(texture);
29
+ stateViews[state] = view;
30
+ return view;
31
+ };
32
+ this.button = new FancyButton({
33
+ defaultView: viewFor("normal", node.states.normalAssetId),
34
+ hoverView: viewFor("hover", node.states.hoverAssetId),
35
+ pressedView: viewFor("pressed", node.states.pressedAssetId),
36
+ disabledView: viewFor("disabled", node.states.disabledAssetId),
37
+ });
38
+ this.stateViews = stateViews;
39
+ // Authoring-сцена инертна: FancyButton уже включил себе eventMode "static", снимаем его до applyEnabled.
40
+ // Выделение и drag при этом не страдают: попадание ловит hitArea базового NodeView, а не это поддерево.
41
+ if (interaction === "authoring")
42
+ this.button.eventMode = "none";
43
+ else if (sounds !== undefined) {
44
+ this.button.onPress.connect(() => { const result = this.soundAssetIds?.pressAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.pressAssetId)?.play(); if (result instanceof Promise)
45
+ void result.catch(() => undefined); });
46
+ this.button.onHover.connect(() => { const result = this.soundAssetIds?.hoverAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.hoverAssetId)?.play(); if (result instanceof Promise)
47
+ void result.catch(() => undefined); });
48
+ }
49
+ this.enabledState = node.enabled;
50
+ this.applyEnabled(node.enabled);
51
+ this.setContent(this.button);
52
+ }
53
+ /** In authoring mode `enabled` may only drive the visuals: `FancyButton` couples it to `eventMode`. */
54
+ applyEnabled(enabled) {
55
+ this.enabledState = enabled;
56
+ if (this.interaction === "runtime")
57
+ this.button.enabled = enabled;
58
+ else
59
+ this.button.setState(enabled ? "default" : "disabled");
60
+ }
61
+ syncContent(node, transform) {
62
+ if (node.type !== "button")
63
+ return;
64
+ this.soundAssetIds = node.sounds;
65
+ const normalTexture = this.textures?.get(node.states.normalAssetId);
66
+ for (const state of BUTTON_STATE_KEYS) {
67
+ const view = this.stateViews[state];
68
+ const assetId = node.states[`${state}AssetId`];
69
+ const texture = (assetId === undefined ? undefined : this.textures?.get(assetId)) ?? normalTexture;
70
+ // State views are stable Sprite instances: changing an asset must not rebuild the scene
71
+ // or replace FancyButton's display tree. Set the texture before the layout size: Sprite
72
+ // preserves scale when its texture changes, so sizing it first would shift its visual bounds
73
+ // for source images with different dimensions.
74
+ if (view instanceof Sprite && texture !== undefined && view.texture !== texture)
75
+ view.texture = texture;
76
+ if (view instanceof Sprite)
77
+ view.setSize(transform.width, transform.height);
78
+ else if (view instanceof Graphics)
79
+ view.clear().rect(0, 0, transform.width, transform.height).fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });
80
+ }
81
+ // Только на изменение документа: иначе любой пересчёт layout сбрасывал бы transient preview state.
82
+ if (node.enabled !== this.enabledState)
83
+ this.applyEnabled(node.enabled);
84
+ }
85
+ get enabled() {
86
+ return this.enabledState;
87
+ }
88
+ set enabled(value) {
89
+ this.applyEnabled(value);
90
+ }
91
+ get state() {
92
+ return KEY_BY_FANCY_STATE[this.button.state];
93
+ }
94
+ /** Forces a visual state without changing `enabled`, so a disabled button still emits no press. */
95
+ setState(state) {
96
+ this.button.setState(FANCY_STATE_BY_KEY[state]);
97
+ }
98
+ get onPress() { return this.button.onPress; }
99
+ get onDown() { return this.button.onDown; }
100
+ get onUp() { return this.button.onUp; }
101
+ get onHover() { return this.button.onHover; }
102
+ get onOut() { return this.button.onOut; }
103
+ }
104
+ //# sourceMappingURL=ButtonNodeView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonNodeView.js","sourceRoot":"","sources":["../../src/views/ButtonNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAoC,MAAM,wBAAwB,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAa,QAAQ,EAAE,MAAM,EAAW,MAAM,SAAS,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IAAI,OAAO,KAA6B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,IAAI,MAAM,KAA4B,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,IAAI,IAAI,KAA0B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,IAAI,OAAO,KAA6B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,IAAI,KAAK,KAA2B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAChE"}
@@ -0,0 +1,36 @@
1
+ import { type UINode } from "@pixi-ui-editor/schema";
2
+ import { Input } from "@pixi/ui";
3
+ import { Texture } from "pixi.js";
4
+ import { NodeView, type SceneInteractionMode } from "./NodeView.js";
5
+ export type InputNode = Extract<UINode, {
6
+ type: "input";
7
+ }>;
8
+ /**
9
+ * Adapts an input node to `@pixi/ui`'s `Input`, which already owns the single-line text/placeholder/
10
+ * cursor content and the DOM `<input>` bridge used to read real keyboard input — this class never
11
+ * reimplements any of that. `clipText` is the one field without a safe live-update path: enabling it
12
+ * builds `Input`'s internal mask only when its background is (re)assigned, and there is no supported
13
+ * way to remove that mask again once added, so toggling it rebuilds the scene like Spine's
14
+ * `animation`/`loop` and ScrollView's `direction`/`easingEnabled` (see `nodeStructure` in
15
+ * `SceneCanvas.tsx`). Everything else here — background, placeholder, defaultValue, maxLength,
16
+ * secure, align, padding, cleanOnFocus, textStyle, size — stays incremental through `syncContent`.
17
+ */
18
+ export declare class InputNodeView extends NodeView {
19
+ private readonly control;
20
+ private readonly fonts;
21
+ private readonly interaction;
22
+ private backgroundTexture;
23
+ private readonly backgroundFallback;
24
+ constructor(node: InputNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, fonts: ReadonlyMap<string, string> | undefined);
25
+ protected syncContent(node: UINode, transform: UINode["transform"]): void;
26
+ /** Current text value. Runtime input never writes back to the document — only this live view holds it. */
27
+ get value(): string;
28
+ set value(text: string);
29
+ /** Programmatically starts editing, e.g. from game code reacting to some other UI event. */
30
+ focus(): void;
31
+ /** Programmatically ends editing without discarding the current value. */
32
+ blur(): void;
33
+ get onChange(): Input["onChange"];
34
+ get onEnter(): Input["onEnter"];
35
+ }
36
+ //# sourceMappingURL=InputNodeView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InputNodeView.d.ts","sourceRoot":"","sources":["../../src/views/InputNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAqB,MAAM,UAAU,CAAC;AACpD,OAAO,EAAoB,OAAO,EAAyB,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAgF3D;;;;;;;;;GASG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0C;IAChE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuB;IACnD,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAkB;gBAEzC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,WAAW,EAAE,oBAAoB,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS;IA8BlK,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI;IA6BzE,0GAA0G;IAC1G,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM,EAErB;IAED,4FAA4F;IAC5F,KAAK,IAAI,IAAI;IAIb,0EAA0E;IAC1E,IAAI,IAAI,IAAI;IAIZ,IAAI,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,CAEhC;IAED,IAAI,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC,CAE9B;CACF"}
@@ -0,0 +1,170 @@
1
+ import { Input } from "@pixi/ui";
2
+ import { Graphics, Sprite } from "pixi.js";
3
+ import { NodeView } from "./NodeView.js";
4
+ /**
5
+ * `@pixi/ui`'s `Input` keeps almost everything we need to live-update (`focus`/`blur`, live-update,
6
+ * safe teardown) behind `protected` members. Subclassing — instead of composing around the public
7
+ * surface, like `ButtonNodeView` does with `FancyButton` — is the only way to reach them without
8
+ * reimplementing the DOM bridge (the actual `<input>` element, its listeners, and the pointer/window
9
+ * activation dance) that `Input` already owns.
10
+ */
11
+ class InputControl extends Input {
12
+ /** Programmatic focus for runtime/game code: starts editing without requiring a real pointer tap. */
13
+ focusNow() {
14
+ this._startEditing();
15
+ }
16
+ /** Programmatic blur: also how we guarantee the live DOM `<input>` is gone before `destroy()`. */
17
+ blurNow() {
18
+ this.stopEditing();
19
+ }
20
+ setPlaceholderText(text) {
21
+ if (this.placeholder === undefined)
22
+ return;
23
+ this.placeholder.text = text;
24
+ this.placeholder.visible = this.value.length === 0 && !this.editing;
25
+ }
26
+ setTextStyle(style) {
27
+ if (this.inputField !== undefined)
28
+ this.inputField.style = style;
29
+ if (this.placeholder !== undefined)
30
+ this.placeholder.style = style;
31
+ this.align();
32
+ }
33
+ setAlign(align) {
34
+ this.options.align = align;
35
+ this.align();
36
+ }
37
+ setMaxLength(maxLength) {
38
+ this.options.maxLength = maxLength;
39
+ }
40
+ setCleanOnFocus(cleanOnFocus) {
41
+ this.options.cleanOnFocus = cleanOnFocus;
42
+ }
43
+ /** Re-reads `_bg`'s current size: used after resizing the background view directly. */
44
+ realign() {
45
+ this.align();
46
+ }
47
+ refreshMaskSize() {
48
+ this.updateInputMaskSize();
49
+ }
50
+ destroy(options) {
51
+ // `Input.destroy()` only removes its own listeners/window binding; if this view is torn down
52
+ // mid-edit it never blurs, so the live DOM `<input>` (appended to `document.body`) would leak.
53
+ // `stopEditing()` blurs, removes the element, and clears our reference before we call super.
54
+ this.blurNow();
55
+ super.destroy(options);
56
+ }
57
+ }
58
+ /** Neutral placeholder used while no background image asset is assigned; never a hidden asset. */
59
+ function drawNeutralBackground(graphics, width, height) {
60
+ return graphics.clear().rect(0, 0, width, height).fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });
61
+ }
62
+ function resolveTextStyle(style, fonts) {
63
+ return {
64
+ fontFamily: style.fontAssetId === undefined ? style.fontFamily : fonts?.get(style.fontAssetId) ?? style.fontFamily,
65
+ fontSize: style.fontSize,
66
+ fontWeight: style.fontWeight,
67
+ fontStyle: style.fontStyle,
68
+ fill: style.fill,
69
+ letterSpacing: style.letterSpacing,
70
+ stroke: style.stroke === undefined ? undefined : { color: style.stroke.color, width: style.stroke.width },
71
+ };
72
+ }
73
+ /**
74
+ * Adapts an input node to `@pixi/ui`'s `Input`, which already owns the single-line text/placeholder/
75
+ * cursor content and the DOM `<input>` bridge used to read real keyboard input — this class never
76
+ * reimplements any of that. `clipText` is the one field without a safe live-update path: enabling it
77
+ * builds `Input`'s internal mask only when its background is (re)assigned, and there is no supported
78
+ * way to remove that mask again once added, so toggling it rebuilds the scene like Spine's
79
+ * `animation`/`loop` and ScrollView's `direction`/`easingEnabled` (see `nodeStructure` in
80
+ * `SceneCanvas.tsx`). Everything else here — background, placeholder, defaultValue, maxLength,
81
+ * secure, align, padding, cleanOnFocus, textStyle, size — stays incremental through `syncContent`.
82
+ */
83
+ export class InputNodeView extends NodeView {
84
+ control;
85
+ fonts;
86
+ interaction;
87
+ backgroundTexture;
88
+ backgroundFallback = new Graphics();
89
+ constructor(node, textures, interaction, fonts) {
90
+ super(textures);
91
+ this.fonts = fonts;
92
+ this.interaction = interaction;
93
+ this.backgroundTexture = node.backgroundAssetId === undefined ? undefined : this.textureFor(node.backgroundAssetId);
94
+ const initialBg = this.backgroundTexture !== undefined
95
+ ? new Sprite(this.backgroundTexture)
96
+ : drawNeutralBackground(this.backgroundFallback, node.transform.width, node.transform.height);
97
+ this.control = new InputControl({
98
+ bg: initialBg,
99
+ textStyle: resolveTextStyle(node.textStyle, fonts),
100
+ placeholder: node.placeholder,
101
+ value: node.defaultValue,
102
+ maxLength: node.maxLength,
103
+ secure: node.secure,
104
+ align: node.align,
105
+ padding: node.padding,
106
+ cleanOnFocus: node.cleanOnFocus,
107
+ // Fixed at construction: see the class comment on rebuild-on-change for `clipText`.
108
+ addMask: node.clipText,
109
+ });
110
+ // Authoring-канвас инертен: без реального pointer eventMode 'none' `Input` никогда не активирует
111
+ // свой глобальный window click listener в `this.activation`, поэтому DOM <input> не создаётся и
112
+ // клавиатурные шорткаты редактора не перехватываются. Selection/drag остаются за grab-прямоугольником
113
+ // базового NodeView.
114
+ if (interaction === "authoring")
115
+ this.control.eventMode = "none";
116
+ this.setContent(this.control);
117
+ }
118
+ syncContent(node, transform) {
119
+ if (node.type !== "input")
120
+ return;
121
+ const texture = node.backgroundAssetId === undefined ? undefined : this.textureFor(node.backgroundAssetId);
122
+ if (texture !== this.backgroundTexture) {
123
+ this.backgroundTexture = texture;
124
+ this.control.bg = texture !== undefined ? new Sprite(texture) : drawNeutralBackground(new Graphics(), transform.width, transform.height);
125
+ }
126
+ const bg = this.control.bg;
127
+ if (bg instanceof Sprite)
128
+ bg.setSize(transform.width, transform.height);
129
+ else if (bg instanceof Graphics)
130
+ drawNeutralBackground(bg, transform.width, transform.height);
131
+ this.control.refreshMaskSize();
132
+ this.control.setPlaceholderText(node.placeholder);
133
+ this.control.setMaxLength(node.maxLength);
134
+ this.control.secure = node.secure;
135
+ this.control.setAlign(node.align);
136
+ this.control.padding = node.padding;
137
+ this.control.setCleanOnFocus(node.cleanOnFocus);
138
+ this.control.setTextStyle(resolveTextStyle(node.textStyle, this.fonts));
139
+ // `defaultValue` is only a presentation default. In authoring, editing is impossible, so the
140
+ // shown value can never diverge and re-applying it every sync is both safe and required (e.g.
141
+ // after a text/document change). In runtime, a consuming app may call this repeatedly for
142
+ // unrelated reasons (a parent's own layout loop, etc.); overwriting `value` here would silently
143
+ // discard whatever the player already typed, so runtime only ever seeds it once at construction.
144
+ if (this.interaction === "authoring")
145
+ this.control.value = node.defaultValue;
146
+ this.control.realign();
147
+ }
148
+ /** Current text value. Runtime input never writes back to the document — only this live view holds it. */
149
+ get value() {
150
+ return this.control.value;
151
+ }
152
+ set value(text) {
153
+ this.control.value = text;
154
+ }
155
+ /** Programmatically starts editing, e.g. from game code reacting to some other UI event. */
156
+ focus() {
157
+ this.control.focusNow();
158
+ }
159
+ /** Programmatically ends editing without discarding the current value. */
160
+ blur() {
161
+ this.control.blurNow();
162
+ }
163
+ get onChange() {
164
+ return this.control.onChange;
165
+ }
166
+ get onEnter() {
167
+ return this.control.onEnter;
168
+ }
169
+ }
170
+ //# sourceMappingURL=InputNodeView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InputNodeView.js","sourceRoot":"","sources":["../../src/views/InputNodeView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAqB,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAkC,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AAIpE;;;;;;GAMG;AACH,MAAM,YAAa,SAAQ,KAAK;IAC9B,qGAAqG;IACrG,QAAQ;QACN,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAED,kGAAkG;IAClG,OAAO;QACL,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,kBAAkB,CAAC,IAAY;QAC7B,IAAI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CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACxE,6FAA6F;QAC7F,8FAA8F;QAC9F,0FAA0F;QAC1F,gGAAgG;QAChG,iGAAiG;QACjG,IAAI,IAAI,CAAC,WAAW,KAAK,WAAW;YAAE,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;QAC7E,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;IAED,0GAA0G;IAC1G,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED,IAAI,KAAK,CAAC,IAAY;QACpB,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED,4FAA4F;IAC5F,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,0EAA0E;IAC1E,IAAI;QACF,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC9B,CAAC;CACF"}
@@ -0,0 +1,53 @@
1
+ import { Spine } from "@esotericsoftware/spine-pixi-v8";
2
+ import { type LayoutProfileId, type UINode } from "@pixi-ui-editor/schema";
3
+ import { Container, Texture, type PointData } from "pixi.js";
4
+ import { type LayoutSize } from "../layout.js";
5
+ /**
6
+ * Whether a built scene is an inert authoring surface or a live one.
7
+ * The editor canvas builds `authoring` scenes so controls never swallow selection and drag
8
+ * gestures; Preview and the consuming app build `runtime` scenes with real pointer handling.
9
+ */
10
+ export type SceneInteractionMode = "authoring" | "runtime";
11
+ /**
12
+ * Base display object for every schema node type. The whole layout contract — profile overrides,
13
+ * anchors, pivot, position, scale, visibility — lives here once; subclasses only synchronize their
14
+ * type-specific content against the resolved layout rectangle.
15
+ */
16
+ export declare abstract class NodeView extends Container {
17
+ protected content?: Container;
18
+ /** A mutable scene texture map: assets may be loaded after this stable view was created. */
19
+ protected readonly textures: ReadonlyMap<string, Texture> | undefined;
20
+ /** Node's own grab rectangle in local space, kept equal to its resolved layout rectangle. */
21
+ private readonly grabRect;
22
+ /** Authored/computed RectTransform-like rectangle; unlike Pixi bounds it also exists without content. */
23
+ private layoutWidth;
24
+ private layoutHeight;
25
+ constructor(textures?: ReadonlyMap<string, Texture>);
26
+ protected textureFor(assetId: string): Texture | undefined;
27
+ /**
28
+ * Makes every node selectable and draggable by its layout rectangle, whatever it renders.
29
+ *
30
+ * Lives here rather than in a subclass because a bare `Container` has no `containsPoint` of its
31
+ * own: without this, Pixi could only find a node through whatever content the subclass happens to
32
+ * draw, so nodes that draw nothing (container) or keep their content out of hit testing (button,
33
+ * whose `@pixi/ui` view is inert while authoring) would silently stop being selectable.
34
+ *
35
+ * Deliberately `containsPoint` and NOT `hitArea`: Pixi's `hitPruneFn` drops a container together
36
+ * with its whole subtree once the point falls outside its `hitArea`, which would make any child
37
+ * reaching past its parent's rectangle visible but unclickable. `containsPoint` never clips
38
+ * children — they are hit-tested first and independently, so a child always stays grabbable.
39
+ */
40
+ containsPoint(point: PointData): boolean;
41
+ protected setContent(content: Container): void;
42
+ /** Syncs type-specific content to the resolved layout rectangle; layout math itself is shared. */
43
+ protected abstract syncContent(node: UINode, transform: UINode["transform"]): void;
44
+ private applyResolvedTransform;
45
+ update(node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize): void;
46
+ /** Applies a transient editor rectangle without deriving it from content-dependent Pixi bounds. */
47
+ preview(node: UINode, transform: UINode["transform"], visible?: boolean): void;
48
+ /** Applies the rectangle owned by a direct parent's layout solver. */
49
+ updateManaged(node: UINode, profile: LayoutProfileId, size: LayoutSize): void;
50
+ get layoutRectangle(): LayoutSize;
51
+ getSpine(): Spine | undefined;
52
+ }
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sB;IAuB9B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI;IAK7E,mGAAmG;IACnG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,UAAO,GAAG,IAAI;IAI3E,sEAAsE;IACtE,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IAK7E,IAAI,eAAe,IAAI,UAAU,CAEhC;IAED,QAAQ,IAAI,KAAK,GAAG,SAAS;CAG9B"}
@@ -0,0 +1,86 @@
1
+ import { Spine } from "@esotericsoftware/spine-pixi-v8";
2
+ import { Container, Rectangle } from "pixi.js";
3
+ import { resolveAnchoredTransform, resolveProfileTransform } from "../layout.js";
4
+ /**
5
+ * Base display object for every schema node type. The whole layout contract — profile overrides,
6
+ * anchors, pivot, position, scale, visibility — lives here once; subclasses only synchronize their
7
+ * type-specific content against the resolved layout rectangle.
8
+ */
9
+ export class NodeView extends Container {
10
+ content;
11
+ /** A mutable scene texture map: assets may be loaded after this stable view was created. */
12
+ textures;
13
+ /** Node's own grab rectangle in local space, kept equal to its resolved layout rectangle. */
14
+ grabRect = new Rectangle();
15
+ /** Authored/computed RectTransform-like rectangle; unlike Pixi bounds it also exists without content. */
16
+ layoutWidth = 0;
17
+ layoutHeight = 0;
18
+ constructor(textures) {
19
+ super();
20
+ this.textures = textures;
21
+ }
22
+ textureFor(assetId) {
23
+ return this.textures?.get(assetId);
24
+ }
25
+ /**
26
+ * Makes every node selectable and draggable by its layout rectangle, whatever it renders.
27
+ *
28
+ * Lives here rather than in a subclass because a bare `Container` has no `containsPoint` of its
29
+ * own: without this, Pixi could only find a node through whatever content the subclass happens to
30
+ * draw, so nodes that draw nothing (container) or keep their content out of hit testing (button,
31
+ * whose `@pixi/ui` view is inert while authoring) would silently stop being selectable.
32
+ *
33
+ * Deliberately `containsPoint` and NOT `hitArea`: Pixi's `hitPruneFn` drops a container together
34
+ * with its whole subtree once the point falls outside its `hitArea`, which would make any child
35
+ * reaching past its parent's rectangle visible but unclickable. `containsPoint` never clips
36
+ * children — they are hit-tested first and independently, so a child always stays grabbable.
37
+ */
38
+ containsPoint(point) {
39
+ return this.grabRect.contains(point.x, point.y);
40
+ }
41
+ setContent(content) {
42
+ this.content = content;
43
+ this.addChild(content);
44
+ }
45
+ applyResolvedTransform(node, transform, visible, managedByLayout) {
46
+ this.syncContent(node, transform);
47
+ const pivotX = (transform.pivotX ?? 0) * transform.width;
48
+ const pivotY = (transform.pivotY ?? 0) * transform.height;
49
+ this.pivot.set(pivotX, pivotY);
50
+ // x/y are the pivot offset from the resolved anchor. Thus a centred anchor and pivot at
51
+ // zero offsets place the visual centre exactly at the parent's centre.
52
+ // A managed child is positioned by its technical Yoga item. Its own NodeView keeps only the
53
+ // pivot offset inside that computed rectangle; authored x/y and anchors do not participate.
54
+ this.position.set(managedByLayout ? pivotX : transform.x, managedByLayout ? pivotY : transform.y);
55
+ this.rotation = transform.rotation;
56
+ this.scale.set(transform.scaleX, transform.scaleY);
57
+ this.visible = visible;
58
+ this.layoutWidth = transform.width;
59
+ this.layoutHeight = transform.height;
60
+ // Тот же прямоугольник, что видит пользователь: grab-зона не зависит от содержимого ноды.
61
+ this.grabRect.x = 0;
62
+ this.grabRect.y = 0;
63
+ this.grabRect.width = transform.width;
64
+ this.grabRect.height = transform.height;
65
+ }
66
+ update(node, profile, parentSize) {
67
+ const resolved = resolveProfileTransform(node, profile);
68
+ this.applyResolvedTransform(node, resolveAnchoredTransform(resolved.transform, parentSize), resolved.visible, false);
69
+ }
70
+ /** Applies a transient editor rectangle without deriving it from content-dependent Pixi bounds. */
71
+ preview(node, transform, visible = true) {
72
+ this.applyResolvedTransform(node, transform, visible, false);
73
+ }
74
+ /** Applies the rectangle owned by a direct parent's layout solver. */
75
+ updateManaged(node, profile, size) {
76
+ const resolved = resolveProfileTransform(node, profile);
77
+ this.applyResolvedTransform(node, { ...resolved.transform, x: 0, y: 0, width: size.width, height: size.height }, resolved.visible, true);
78
+ }
79
+ get layoutRectangle() {
80
+ return { width: this.layoutWidth, height: this.layoutHeight };
81
+ }
82
+ getSpine() {
83
+ return this.content instanceof Spine ? this.content : undefined;
84
+ }
85
+ }
86
+ //# sourceMappingURL=NodeView.js.map
@@ -0,0 +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,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;IACjG,WAAW,GAAG,CAAC,CAAC;IAChB,YAAY,GAAG,CAAC,CAAC;IAEzB,YAAY,QAAuC;QACjD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAES,UAAU,CAAC,OAAe;QAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,KAAgB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC;IAES,UAAU,CAAC,OAAkB;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,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from "pixi.js";
3
+ import { NodeView } from "./NodeView.js";
4
+ /** Thin Pixi adapter: NodeView continues to own transforms, layout and hit testing. */
5
+ export declare class ParticleEmitterNodeView extends NodeView {
6
+ private readonly contentRoot;
7
+ private readonly simulator;
8
+ private simulationSpace;
9
+ private autoplayHandled;
10
+ constructor(effect: ParticleEffectDefinition, textures?: ReadonlyMap<string, Texture>);
11
+ updateParticles(deltaSeconds: number): void;
12
+ play(): void;
13
+ pause(): void;
14
+ restart(): void;
15
+ stop(): void;
16
+ /** Advances exactly one fixed step even while paused, preserving the current playing/paused state. */
17
+ step(): void;
18
+ dispose(): void;
19
+ setEmissionMultiplier(value: number): void;
20
+ getDiagnostics(): import("../particles.js").ParticleDiagnostics;
21
+ syncEffect(effect: ParticleEffectDefinition): void;
22
+ destroy(options?: DestroyOptions): void;
23
+ protected syncContent(node: UINode): void;
24
+ private syncRender;
25
+ }
26
+ //# sourceMappingURL=ParticleEmitterNodeView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParticleEmitterNodeView.d.ts","sourceRoot":"","sources":["../../src/views/ParticleEmitterNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAqB,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAE1E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,uFAAuF;AACvF,qBAAa,uBAAwB,SAAQ,QAAQ;IACnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;IACtD,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,eAAe,CAAS;gBAEpB,MAAM,EAAE,wBAAwB,EAAE,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC;IAiBrF,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAM3C,IAAI,IAAI,IAAI;IACZ,KAAK,IAAI,IAAI;IACb,OAAO,IAAI,IAAI;IACf,IAAI,IAAI,IAAI;IACZ,sGAAsG;IACtG,IAAI,IAAI,IAAI;IAKZ,OAAO,IAAI,IAAI;IACf,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAC1C,cAAc;IAEd,UAAU,CAAC,MAAM,EAAE,wBAAwB,GAAG,IAAI;IAEzC,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IAKhD,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAYzC,OAAO,CAAC,UAAU;CA8BnB"}
@@ -0,0 +1,101 @@
1
+ import { Container, Sprite, Texture } from "pixi.js";
2
+ import { lerp, lerpColorHex, ParticleSimulator } from "../particles.js";
3
+ import { NodeView } from "./NodeView.js";
4
+ const DEG_TO_RAD = Math.PI / 180;
5
+ /** Thin Pixi adapter: NodeView continues to own transforms, layout and hit testing. */
6
+ export class ParticleEmitterNodeView extends NodeView {
7
+ contentRoot = new Container();
8
+ simulator;
9
+ simulationSpace = "local";
10
+ autoplayHandled = false;
11
+ constructor(effect, textures) {
12
+ super(textures);
13
+ this.setContent(this.contentRoot);
14
+ this.simulator = new ParticleSimulator(effect, {
15
+ createRender: () => {
16
+ const sprite = new Sprite(Texture.EMPTY);
17
+ sprite.anchor.set(0.5);
18
+ sprite.visible = false;
19
+ this.contentRoot.addChild(sprite);
20
+ return sprite;
21
+ },
22
+ hideRender: (sprite) => { sprite.visible = false; },
23
+ destroyRender: (sprite) => { this.contentRoot.removeChild(sprite); sprite.destroy(); },
24
+ getWorldTransform: () => this.worldTransform,
25
+ });
26
+ }
27
+ updateParticles(deltaSeconds) {
28
+ const rect = this.layoutRectangle;
29
+ this.simulator.update(deltaSeconds, { width: rect.width, height: rect.height, space: this.simulationSpace });
30
+ this.syncRender();
31
+ }
32
+ play() { this.simulator.play(); }
33
+ pause() { this.simulator.pause(); }
34
+ restart() { this.simulator.restart(); }
35
+ stop() { this.simulator.stop(); }
36
+ /** Advances exactly one fixed step even while paused, preserving the current playing/paused state. */
37
+ step() {
38
+ const rect = this.layoutRectangle;
39
+ this.simulator.step({ width: rect.width, height: rect.height, space: this.simulationSpace });
40
+ this.syncRender();
41
+ }
42
+ dispose() { this.simulator.dispose(); }
43
+ setEmissionMultiplier(value) { this.simulator.setEmissionMultiplier(value); }
44
+ getDiagnostics() { return this.simulator.getDiagnostics(); }
45
+ syncEffect(effect) { this.simulator.syncEffect(effect); }
46
+ destroy(options) {
47
+ this.dispose();
48
+ super.destroy(options);
49
+ }
50
+ syncContent(node) {
51
+ if (node.type !== "particle-emitter")
52
+ return;
53
+ this.simulationSpace = node.simulationSpace;
54
+ // Autoplay only fires once, right after construction: syncContent also runs on every unrelated
55
+ // document edit (via the shared node-sync pass), and re-arming play() there would silently
56
+ // override an explicit pause()/stop() the moment the author touches anything else in the project.
57
+ if (!this.autoplayHandled) {
58
+ this.autoplayHandled = true;
59
+ if (node.autoplay)
60
+ this.simulator.play();
61
+ }
62
+ }
63
+ syncRender() {
64
+ const p = this.simulator.definition.particle;
65
+ const source = p.visual.source;
66
+ const space = this.simulationSpace;
67
+ const inverse = space === "world" ? this.worldTransform : undefined;
68
+ for (const slot of this.simulator.activeSlots) {
69
+ const sprite = slot.render;
70
+ const t = slot.lifetime > 0 ? Math.min(1, slot.age / slot.lifetime) : 1;
71
+ sprite.alpha = lerp(p.visual.alpha.start, p.visual.alpha.end, t);
72
+ sprite.tint = lerpColorHex(p.visual.tint.start, p.visual.tint.end, t);
73
+ sprite.scale.set(lerp(slot.scaleStart, slot.scaleEnd, t));
74
+ sprite.rotation = slot.rotationDegrees * DEG_TO_RAD;
75
+ sprite.blendMode = p.visual.blendMode;
76
+ const assetId = source.type === "single" ? source.assetId
77
+ : source.type === "random" ? source.assetIds[slot.sourceIndex]
78
+ : source.assetIds[sequenceFrame(source, slot)];
79
+ const texture = this.textureFor(assetId);
80
+ if (texture)
81
+ sprite.texture = texture;
82
+ if (space === "world" && inverse !== undefined) {
83
+ const dx = slot.x - slot.spawnX, dy = slot.y - slot.spawnY;
84
+ const worldX = slot.worldSpawnX + slot.spawnMatrixA * dx + slot.spawnMatrixC * dy;
85
+ const worldY = slot.worldSpawnY + slot.spawnMatrixB * dx + slot.spawnMatrixD * dy;
86
+ const local = inverse.applyInverse({ x: worldX, y: worldY });
87
+ sprite.position.set(local.x, local.y);
88
+ }
89
+ else {
90
+ sprite.position.set(slot.x, slot.y);
91
+ }
92
+ sprite.visible = true;
93
+ }
94
+ }
95
+ }
96
+ function sequenceFrame(source, slot) {
97
+ const length = source.assetIds.length;
98
+ const raw = slot.sequenceStart + Math.floor(slot.age * source.fps);
99
+ return source.loop ? ((raw % length) + length) % length : Math.min(raw, length - 1);
100
+ }
101
+ //# sourceMappingURL=ParticleEmitterNodeView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParticleEmitterNodeView.js","sourceRoot":"","sources":["../../src/views/ParticleEmitterNodeView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAuB,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,iBAAiB,EAAqB,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAEjC,uFAAuF;AACvF,MAAM,OAAO,uBAAwB,SAAQ,QAAQ;IAClC,WAAW,GAAG,IAAI,SAAS,EAAE,CAAC;IAC9B,SAAS,CAA4B;IAC9C,eAAe,GAAsB,OAAO,CAAC;IAC7C,eAAe,GAAG,KAAK,CAAC;IAEhC,YAAY,MAAgC,EAAE,QAAuC;QACnF,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,UAAU,CAAC,IAAI,CA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