pixifact 0.1.3 → 0.1.4

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 (185) hide show
  1. package/README.md +3 -3
  2. package/dist/builtin-scenes/CenterContainer.d.ts +13 -0
  3. package/dist/builtin-scenes/CenterContainer.js +71 -0
  4. package/dist/builtin-scenes/CenterContainer.scene +3 -0
  5. package/dist/builtin-scenes/CenterContainer.ts +77 -0
  6. package/dist/builtin-scenes/Control.d.ts +44 -0
  7. package/dist/builtin-scenes/Control.js +206 -0
  8. package/dist/builtin-scenes/Control.scene +3 -0
  9. package/dist/builtin-scenes/Control.ts +233 -0
  10. package/dist/builtin-scenes/FlexItem.d.ts +45 -0
  11. package/dist/builtin-scenes/FlexItem.js +164 -0
  12. package/dist/builtin-scenes/FlexItem.scene +3 -0
  13. package/dist/builtin-scenes/FlexItem.ts +180 -0
  14. package/dist/builtin-scenes/FlexLayout.d.ts +29 -0
  15. package/dist/builtin-scenes/FlexLayout.js +358 -0
  16. package/dist/builtin-scenes/FlexLayout.scene +3 -0
  17. package/dist/builtin-scenes/FlexLayout.ts +409 -0
  18. package/dist/builtin-scenes/HBoxContainer.d.ts +15 -0
  19. package/dist/builtin-scenes/HBoxContainer.js +70 -0
  20. package/dist/builtin-scenes/HBoxContainer.scene +3 -0
  21. package/dist/builtin-scenes/HBoxContainer.ts +75 -0
  22. package/dist/builtin-scenes/MarginContainer.d.ts +23 -0
  23. package/dist/builtin-scenes/MarginContainer.js +131 -0
  24. package/dist/builtin-scenes/MarginContainer.scene +3 -0
  25. package/dist/builtin-scenes/MarginContainer.ts +139 -0
  26. package/dist/builtin-scenes/VBoxContainer.d.ts +15 -0
  27. package/dist/builtin-scenes/VBoxContainer.js +70 -0
  28. package/dist/builtin-scenes/VBoxContainer.scene +3 -0
  29. package/dist/builtin-scenes/VBoxContainer.ts +75 -0
  30. package/dist/builtin-scenes/controlLayout.d.ts +57 -0
  31. package/dist/builtin-scenes/controlLayout.js +202 -0
  32. package/dist/builtin-scenes/controlLayout.ts +270 -0
  33. package/dist/compiler/builtinScenes.d.ts +14 -0
  34. package/dist/compiler/builtinScenes.js +62 -0
  35. package/dist/compiler/compileScenes.js +126 -19
  36. package/dist/compiler/decorators.js +3 -0
  37. package/dist/compiler/index.d.ts +1 -0
  38. package/dist/compiler/index.js +1 -0
  39. package/dist/compiler/sceneAssetPair.js +19 -0
  40. package/dist/compiler/sceneRuntime.d.ts +5 -4
  41. package/dist/compiler/scriptInterfaceExtractor.d.ts +5 -0
  42. package/dist/compiler/scriptInterfaceExtractor.js +214 -8
  43. package/dist/compiler/spec.d.ts +2 -0
  44. package/dist/compiler/templateParser.js +4 -3
  45. package/dist/compiler/templateSerializer.js +2 -1
  46. package/dist/compiler/typescriptCompiler.js +87 -13
  47. package/dist/compiler-node/builtinSceneAssets.d.ts +8 -0
  48. package/dist/compiler-node/builtinSceneAssets.js +57 -0
  49. package/dist/compiler-node/index.d.ts +1 -0
  50. package/dist/compiler-node/index.js +1 -0
  51. package/dist/errors.d.ts +1 -0
  52. package/dist/errors.js +24 -0
  53. package/dist/index.d.ts +2 -5
  54. package/dist/index.js +2 -5
  55. package/dist/{authoring/ProjectConfig.d.ts → project/index.d.ts} +7 -0
  56. package/dist/{authoring/ProjectConfig.js → project/index.js} +22 -0
  57. package/dist/runtime/Group.d.ts +18 -0
  58. package/dist/runtime/Group.js +45 -0
  59. package/dist/runtime/index.d.ts +1 -9
  60. package/dist/runtime/index.js +1 -9
  61. package/package.json +4 -26
  62. package/dist/authoring/ActionRegistry.d.ts +0 -10
  63. package/dist/authoring/ActionRegistry.js +0 -26
  64. package/dist/authoring/ComponentPalette.d.ts +0 -16
  65. package/dist/authoring/ComponentPalette.js +0 -50
  66. package/dist/authoring/DesignToken.d.ts +0 -16
  67. package/dist/authoring/DesignToken.js +0 -33
  68. package/dist/authoring/DiffModel.d.ts +0 -10
  69. package/dist/authoring/DiffModel.js +0 -104
  70. package/dist/authoring/InspectorModel.d.ts +0 -27
  71. package/dist/authoring/InspectorModel.js +0 -139
  72. package/dist/authoring/LogicGraph.d.ts +0 -66
  73. package/dist/authoring/LogicGraph.js +0 -184
  74. package/dist/authoring/OverrideJournal.d.ts +0 -18
  75. package/dist/authoring/OverrideJournal.js +0 -23
  76. package/dist/authoring/PreferenceMemory.d.ts +0 -21
  77. package/dist/authoring/PreferenceMemory.js +0 -39
  78. package/dist/authoring/RuntimePreview.d.ts +0 -11
  79. package/dist/authoring/RuntimePreview.js +0 -25
  80. package/dist/authoring/SceneDocument.d.ts +0 -74
  81. package/dist/authoring/SceneDocument.js +0 -332
  82. package/dist/authoring/SceneProjectState.d.ts +0 -20
  83. package/dist/authoring/SceneProjectState.js +0 -8
  84. package/dist/authoring/SceneSelection.d.ts +0 -11
  85. package/dist/authoring/SceneSelection.js +0 -1
  86. package/dist/authoring/index.d.ts +0 -13
  87. package/dist/authoring/index.js +0 -13
  88. package/dist/commands/Command.d.ts +0 -63
  89. package/dist/commands/Command.js +0 -1
  90. package/dist/commands/CommandStack.d.ts +0 -14
  91. package/dist/commands/CommandStack.js +0 -45
  92. package/dist/commands/applyCommand.d.ts +0 -23
  93. package/dist/commands/applyCommand.js +0 -316
  94. package/dist/commands/index.d.ts +0 -4
  95. package/dist/commands/index.js +0 -4
  96. package/dist/commands/utils.d.ts +0 -17
  97. package/dist/commands/utils.js +0 -77
  98. package/dist/commands/validateCommand.d.ts +0 -12
  99. package/dist/commands/validateCommand.js +0 -285
  100. package/dist/nodes/Input.d.ts +0 -91
  101. package/dist/nodes/Input.js +0 -352
  102. package/dist/nodes/Textarea.d.ts +0 -10
  103. package/dist/nodes/Textarea.js +0 -38
  104. package/dist/nodes/components/Button.d.ts +0 -8
  105. package/dist/nodes/components/Button.js +0 -45
  106. package/dist/nodes/components/InputField.d.ts +0 -12
  107. package/dist/nodes/components/InputField.js +0 -53
  108. package/dist/nodes/components/ProgressBar.d.ts +0 -14
  109. package/dist/nodes/components/ProgressBar.js +0 -66
  110. package/dist/nodes/components/ScrollRect.d.ts +0 -23
  111. package/dist/nodes/components/ScrollRect.js +0 -108
  112. package/dist/nodes/components/Selectable.d.ts +0 -32
  113. package/dist/nodes/components/Selectable.js +0 -153
  114. package/dist/nodes/components/index.d.ts +0 -5
  115. package/dist/nodes/components/index.js +0 -5
  116. package/dist/nodes/graphics/Graphic.d.ts +0 -14
  117. package/dist/nodes/graphics/Graphic.js +0 -47
  118. package/dist/nodes/graphics/ImageGraphic.d.ts +0 -9
  119. package/dist/nodes/graphics/ImageGraphic.js +0 -42
  120. package/dist/nodes/graphics/RoundedRectGraphic.d.ts +0 -13
  121. package/dist/nodes/graphics/RoundedRectGraphic.js +0 -65
  122. package/dist/nodes/graphics/TextGraphic.d.ts +0 -13
  123. package/dist/nodes/graphics/TextGraphic.js +0 -70
  124. package/dist/nodes/graphics/index.d.ts +0 -4
  125. package/dist/nodes/graphics/index.js +0 -4
  126. package/dist/nodes/index.d.ts +0 -3
  127. package/dist/nodes/index.js +0 -3
  128. package/dist/runtime/Application.d.ts +0 -15
  129. package/dist/runtime/Application.js +0 -67
  130. package/dist/runtime/GameObject.d.ts +0 -100
  131. package/dist/runtime/GameObject.js +0 -297
  132. package/dist/runtime/GameObjectEvent.d.ts +0 -52
  133. package/dist/runtime/GameObjectEvent.js +0 -38
  134. package/dist/runtime/Transform.d.ts +0 -32
  135. package/dist/runtime/Transform.js +0 -157
  136. package/dist/runtime/component/Component.d.ts +0 -13
  137. package/dist/runtime/component/Component.js +0 -13
  138. package/dist/runtime/component/ComponentRegistry.d.ts +0 -49
  139. package/dist/runtime/component/ComponentRegistry.js +0 -25
  140. package/dist/runtime/component/Flex.d.ts +0 -6
  141. package/dist/runtime/component/Flex.js +0 -15
  142. package/dist/runtime/component/FlexGroup.d.ts +0 -26
  143. package/dist/runtime/component/FlexGroup.js +0 -136
  144. package/dist/runtime/component/GridLayout.d.ts +0 -47
  145. package/dist/runtime/component/GridLayout.js +0 -129
  146. package/dist/runtime/component/Layout.d.ts +0 -104
  147. package/dist/runtime/component/Layout.js +0 -248
  148. package/dist/runtime/component/decorators.d.ts +0 -4
  149. package/dist/runtime/component/decorators.js +0 -52
  150. package/dist/runtime/component/index.d.ts +0 -7
  151. package/dist/runtime/component/index.js +0 -7
  152. package/dist/runtime/graphics/index.d.ts +0 -11
  153. package/dist/runtime/graphics/index.js +0 -29
  154. package/dist/runtime/group/index.d.ts +0 -39
  155. package/dist/runtime/group/index.js +0 -102
  156. package/dist/runtime/image/Image.d.ts +0 -19
  157. package/dist/runtime/image/Image.js +0 -60
  158. package/dist/runtime/image/NineSliceImage.d.ts +0 -23
  159. package/dist/runtime/image/NineSliceImage.js +0 -64
  160. package/dist/runtime/image/index.d.ts +0 -2
  161. package/dist/runtime/image/index.js +0 -2
  162. package/dist/runtime/label/Label.d.ts +0 -11
  163. package/dist/runtime/label/Label.js +0 -26
  164. package/dist/runtime/label/LabelStyle.d.ts +0 -3
  165. package/dist/runtime/label/LabelStyle.js +0 -3
  166. package/dist/runtime/label/index.d.ts +0 -2
  167. package/dist/runtime/label/index.js +0 -2
  168. package/dist/runtime/utils/index.d.ts +0 -1
  169. package/dist/runtime/utils/index.js +0 -1
  170. package/dist/runtime/utils/onlyOnceQueueMicrotask.d.ts +0 -1
  171. package/dist/runtime/utils/onlyOnceQueueMicrotask.js +0 -12
  172. package/dist/runtime/utils/setProps.d.ts +0 -10
  173. package/dist/runtime/utils/setProps.js +0 -17
  174. package/dist/scene/dsl.d.ts +0 -25
  175. package/dist/scene/dsl.js +0 -112
  176. package/dist/scene/index.d.ts +0 -5
  177. package/dist/scene/index.js +0 -5
  178. package/dist/scene/instantiate.d.ts +0 -8
  179. package/dist/scene/instantiate.js +0 -208
  180. package/dist/scene/nodesDsl.d.ts +0 -42
  181. package/dist/scene/nodesDsl.js +0 -169
  182. package/dist/scene/spec.d.ts +0 -100
  183. package/dist/scene/spec.js +0 -1
  184. package/dist/scene/templates.d.ts +0 -21
  185. package/dist/scene/templates.js +0 -239
@@ -1,352 +0,0 @@
1
- import { Matrix, Rectangle, Graphics as PIXIGraphics } from "pixi.js";
2
- import { GameObject, Graphics, Group, Label, LabelStyle } from "../runtime/index.js";
3
- export class Input extends Group {
4
- /**
5
- * 背景样式
6
- */
7
- graphics;
8
- /**
9
- * 使用html标签进行输入处理
10
- */
11
- element;
12
- /**
13
- * 输入框失去焦点时显示的内容
14
- */
15
- valueLabel;
16
- /**
17
- * HTML 输入元素对齐的 canvas。默认取文档中的第一个 canvas。
18
- */
19
- canvas;
20
- _mask;
21
- _value = '';
22
- _destroyed = false;
23
- _isFocused = false;
24
- _textColor = '#23272a';
25
- _focusedBorderColor = 0x0000ff;
26
- _blurredBorderColor = 0x828282;
27
- _globalTransform = new Matrix();
28
- _isUpdateTransform = false;
29
- set width(val) {
30
- super.width = val;
31
- this._isResize = true;
32
- }
33
- get width() {
34
- return super.width;
35
- }
36
- set height(val) {
37
- super.height = val;
38
- this._isResize = true;
39
- }
40
- get height() {
41
- return super.height;
42
- }
43
- /**
44
- * 更新mask,条件:1、padding改变 2、宽高改变
45
- */
46
- updateMask() {
47
- if (!this._mask) {
48
- return;
49
- }
50
- this._mask.x = this.paddingLeft;
51
- this._mask.y = this.paddingTop;
52
- this._mask.width = this.contentWidth;
53
- this._mask.height = this.contentHeight;
54
- }
55
- _isUpdateElementSize = false;
56
- updateElementSize() {
57
- this._isUpdateElementSize = false;
58
- this.element.style.width = this.width + 'px';
59
- this.element.style.height = this.height + 'px';
60
- this.element.style.padding = this._padding.map((value) => value + 'px').join(' ');
61
- this.element.style.borderWidth = '0';
62
- this.element.style.fontSize = this.fontSize + 'px';
63
- this.updateElementLineHeight();
64
- this.updateMask();
65
- }
66
- updateElementLineHeight() {
67
- this.element.style.lineHeight = this.contentHeight + 'px';
68
- }
69
- updateHitArea() {
70
- this.display.hitArea = new Rectangle(0, 0, this.width, this.height);
71
- }
72
- /**
73
- * 更新2d变换,位置,缩放,斜切,旋转
74
- */
75
- updateTransform() {
76
- const { a, b, c, d, tx, ty } = this.display.getGlobalTransform(this._globalTransform);
77
- const offset = this.getCanvasOffset();
78
- this.element.style.transform = `matrix(${a}, ${b}, ${c}, ${d}, ${tx + offset.x}, ${ty + offset.y})`;
79
- this.element.style.transformOrigin = `${this.anchorX * 100}% ${this.anchorY * 100}%`;
80
- this.element.style.opacity = String(this.display.alpha);
81
- this._isUpdateTransform = false;
82
- this.updateMask();
83
- }
84
- getCanvasOffset() {
85
- const view = this.getCanvasView();
86
- if (!view) {
87
- return { x: 0, y: 0 };
88
- }
89
- const rect = view.getBoundingClientRect();
90
- return { x: rect.left, y: rect.top };
91
- }
92
- getCanvasView() {
93
- return this.canvas ?? document.querySelector('canvas') ?? undefined;
94
- }
95
- _isResize = false;
96
- /**
97
- * 更新大小
98
- */
99
- resize() {
100
- this._isResize = false;
101
- this._isUpdateElementSize = true;
102
- this._isUpdateTransform = true;
103
- this.updateHitArea();
104
- this.valueLabel.x = this.paddingLeft;
105
- this.valueLabel.y = this.paddingTop;
106
- this._labelStyle.lineHeight = this.contentHeight;
107
- this.updateMask();
108
- }
109
- createElement() {
110
- const element = document.createElement('input');
111
- element.type = 'text';
112
- this.element = element;
113
- }
114
- render() {
115
- const mask = new PIXIGraphics();
116
- mask.rect(0, 0, 100, 50);
117
- mask.fill(0x0000ff);
118
- this.display.addChild(mask);
119
- this._mask = mask;
120
- this.createElement();
121
- this.element.className = 'textarea';
122
- this.element.style.boxSizing = 'border-box';
123
- this.element.style.position = 'fixed';
124
- this.element.style.left = '0';
125
- this.element.style.top = '0';
126
- this.element.style.zIndex = '10';
127
- this.element.style.margin = '0';
128
- this.element.style.borderStyle = 'solid';
129
- this.element.style.borderRadius = '0';
130
- this.element.style.display = 'none';
131
- this.element.style.color = 'transparent';
132
- this.element.style.background = 'transparent';
133
- this.element.style.caretColor = this._textColor;
134
- this.element.style.outline = 'none';
135
- this.element.style.padding = '0 6px';
136
- this.element.style.fontFamily = Array.isArray(this._labelStyle.fontFamily)
137
- ? this._labelStyle.fontFamily.join(',')
138
- : this._labelStyle.fontFamily;
139
- this.element.style.fontSize = this._labelStyle.fontSize + 'px';
140
- this.element.onfocus = this.onFocus.bind(this);
141
- this.element.onblur = this.onBlur.bind(this);
142
- this.element.oninput = this.onInput.bind(this);
143
- this.fontFamily = this._labelStyle.fontFamily;
144
- this.fontSize = this._labelStyle.fontSize;
145
- window.document.body.append(this.element);
146
- this.graphics = GameObject.instantiate(Graphics, this);
147
- this.valueLabel = GameObject.instantiate(Label, this, {
148
- style: this._labelStyle,
149
- x: this.paddingLeft
150
- });
151
- this.valueLabel.display.mask = mask;
152
- this.value = this._value;
153
- this.display.eventMode = 'static';
154
- this.display.interactiveChildren = false;
155
- this.display.cursor = 'text';
156
- this.display.on('pointerdown', this.focus, this);
157
- this.display.once('destroyed', this.onDestroy, this);
158
- this.emitter.on(GameObject.Event.TRANSFORM_CHANGE, this.handleTransformChange, this);
159
- window.addEventListener('resize', this.handleViewportChange);
160
- window.addEventListener('scroll', this.handleViewportChange, true);
161
- this._isResize = true;
162
- this._isDrawStyle = true;
163
- this._isUpdateElementSize = true;
164
- this._isUpdateTransform = true;
165
- }
166
- update() {
167
- if (this._isResize) {
168
- this.resize();
169
- }
170
- if (this._isDrawStyle) {
171
- this.drawStyle();
172
- }
173
- if (this._isUpdateElementSize) {
174
- this.updateElementSize();
175
- }
176
- if (this._isUpdateTransform || this.element.style.display !== 'none') {
177
- this.updateTransform();
178
- }
179
- }
180
- handleViewportChange = () => {
181
- this._isUpdateTransform = true;
182
- };
183
- handleTransformChange = () => {
184
- this._isUpdateTransform = true;
185
- };
186
- _stokeStyle = { width: 1, color: this._blurredBorderColor };
187
- _backgroundColor = 0xffffff;
188
- set backgroundColor(val) {
189
- this._backgroundColor = val;
190
- this._isDrawStyle = true;
191
- }
192
- set borderColor(val) {
193
- this._stokeStyle.color = val;
194
- this._isDrawStyle = true;
195
- }
196
- set borderSize(val) {
197
- this._stokeStyle.width = val;
198
- this._isDrawStyle = true;
199
- }
200
- _labelStyle = new LabelStyle({
201
- fontSize: 16,
202
- lineHeight: 16
203
- });
204
- set fontFamily(val) {
205
- this._labelStyle.fontFamily = val;
206
- if (this.element) {
207
- this.element.style.fontFamily = Array.isArray(val) ? val.join(',') : val;
208
- }
209
- }
210
- get fontFamily() {
211
- return this._labelStyle.fontFamily;
212
- }
213
- set fontSize(val) {
214
- this._labelStyle.fontSize = val;
215
- if (this.element) {
216
- this.element.style.fontSize = val + 'px';
217
- }
218
- this._isUpdateElementSize = true;
219
- this._isUpdateTransform = true;
220
- }
221
- get fontSize() {
222
- return this._labelStyle.fontSize;
223
- }
224
- _isDrawStyle = true;
225
- /**
226
- * 绘制背景样式
227
- */
228
- drawStyle() {
229
- this._isDrawStyle = false;
230
- this.graphics.clear();
231
- this.graphics.rect(0, 0, this.width, this.height);
232
- this.graphics.fill(this._backgroundColor);
233
- this.graphics.stroke(this._stokeStyle);
234
- }
235
- _padding = [0, 6, 0, 6];
236
- get contentWidth() {
237
- return Math.max(0, this.width - this.paddingLeft - this.paddingRight);
238
- }
239
- get contentHeight() {
240
- return Math.max(0, this.height - this.paddingTop - this.paddingBottom);
241
- }
242
- set paddingLeft(val) {
243
- this._padding[3] = val;
244
- this._isResize = true;
245
- this._isUpdateElementSize = true;
246
- }
247
- get paddingLeft() {
248
- return this._padding[3];
249
- }
250
- set paddingRight(val) {
251
- this._padding[1] = val;
252
- this._isResize = true;
253
- this._isUpdateElementSize = true;
254
- }
255
- get paddingRight() {
256
- return this._padding[1];
257
- }
258
- set paddingTop(val) {
259
- this._padding[0] = val;
260
- this._isResize = true;
261
- this._isUpdateElementSize = true;
262
- }
263
- get paddingTop() {
264
- return this._padding[0];
265
- }
266
- set paddingBottom(val) {
267
- this._padding[2] = val;
268
- this._isResize = true;
269
- this._isUpdateElementSize = true;
270
- }
271
- get paddingBottom() {
272
- return this._padding[2];
273
- }
274
- get value() {
275
- return this._value;
276
- }
277
- set value(val) {
278
- this._value = val;
279
- if (this.element && this.element.value !== val) {
280
- this.element.value = val;
281
- }
282
- if (this.valueLabel) {
283
- this.valueLabel.value = val;
284
- }
285
- }
286
- onFocus() {
287
- this._isFocused = true;
288
- this.valueLabel.display.visible = false;
289
- this.element.style.color = this._textColor;
290
- this.borderColor = this._focusedBorderColor;
291
- this.borderSize = 2;
292
- this.emitter.emit('focus');
293
- }
294
- focus(event) {
295
- if (event?.pointerType !== 'touch') {
296
- event?.preventDefault();
297
- }
298
- event?.stopPropagation();
299
- if (this._isResize) {
300
- this.resize();
301
- }
302
- if (this._isDrawStyle) {
303
- this.drawStyle();
304
- }
305
- if (this._isUpdateElementSize) {
306
- this.updateElementSize();
307
- }
308
- this.updateTransform();
309
- this.element.style.display = 'block';
310
- if (!this._destroyed && this.element.isConnected) {
311
- this.element.focus();
312
- }
313
- }
314
- onInput() {
315
- this._value = this.element.value;
316
- }
317
- onBlur() {
318
- if (!this._isFocused && this.element.style.display === 'none') {
319
- return;
320
- }
321
- this._isFocused = false;
322
- this.value = this.element.value;
323
- this.borderColor = this._blurredBorderColor;
324
- this.borderSize = 1;
325
- this.element.style.color = 'transparent';
326
- this.element.style.display = 'none';
327
- this.valueLabel.display.visible = true;
328
- this.emitter.emit('blur');
329
- }
330
- blur() {
331
- this.element.blur();
332
- if (this._isFocused || this.element.style.display !== 'none') {
333
- this.onBlur();
334
- }
335
- }
336
- onDestroy() {
337
- if (this._destroyed) {
338
- return;
339
- }
340
- this._destroyed = true;
341
- this.display.off('pointerdown', this.focus, this);
342
- this.emitter.off(GameObject.Event.TRANSFORM_CHANGE, this.handleTransformChange, this);
343
- window.removeEventListener('resize', this.handleViewportChange);
344
- window.removeEventListener('scroll', this.handleViewportChange, true);
345
- if (this.element) {
346
- this.element.onfocus = null;
347
- this.element.onblur = null;
348
- this.element.oninput = null;
349
- this.element.remove();
350
- }
351
- }
352
- }
@@ -1,10 +0,0 @@
1
- import { Input } from "./Input.js";
2
- export declare class Textarea extends Input {
3
- set lineHeight(val: number);
4
- get lineHeight(): number;
5
- protected updateElementLineHeight(): void;
6
- protected _padding: number[];
7
- protected createElement(): void;
8
- render(): void;
9
- resize(): void;
10
- }
@@ -1,38 +0,0 @@
1
- import { Input } from "./Input.js";
2
- export class Textarea extends Input {
3
- set lineHeight(val) {
4
- this._labelStyle.lineHeight = val;
5
- if (this.element) {
6
- this.element.style.lineHeight = val + 'px';
7
- }
8
- this._isUpdateElementSize = true;
9
- }
10
- get lineHeight() {
11
- return this._labelStyle.lineHeight;
12
- }
13
- updateElementLineHeight() {
14
- this.element.style.lineHeight = this._labelStyle.lineHeight + 'px';
15
- }
16
- _padding = [6, 6, 6, 6];
17
- createElement() {
18
- this.element = document.createElement('textarea');
19
- this.element.style.resize = 'none';
20
- this.element.style.overflow = 'hidden';
21
- }
22
- render() {
23
- super.render();
24
- this.lineHeight = this._labelStyle.lineHeight;
25
- this._labelStyle.wordWrap = true;
26
- this._labelStyle.breakWords = true;
27
- }
28
- resize() {
29
- this._isResize = false;
30
- this._isUpdateElementSize = true;
31
- this._isUpdateTransform = true;
32
- this.updateHitArea();
33
- this.valueLabel.x = this.paddingLeft;
34
- this.valueLabel.y = this.paddingTop;
35
- this._labelStyle.wordWrapWidth = this.contentWidth;
36
- this.updateMask();
37
- }
38
- }
@@ -1,8 +0,0 @@
1
- import type { FederatedPointerEvent } from "pixi.js";
2
- import { Selectable } from "./Selectable.js";
3
- export declare class Button extends Selectable {
4
- onClick?: string | ((event: FederatedPointerEvent) => void);
5
- awake(): void;
6
- private handlePointerTap;
7
- onDestroy(): void;
8
- }
@@ -1,45 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { ComponentMeta, Prop } from "../../runtime/index.js";
8
- import { Selectable } from "./Selectable.js";
9
- let Button = class Button extends Selectable {
10
- onClick;
11
- awake() {
12
- super.awake();
13
- this.gameObject.display.on('pointertap', this.handlePointerTap, this);
14
- }
15
- handlePointerTap(event) {
16
- if (!this.interactable) {
17
- return;
18
- }
19
- if (typeof this.onClick === 'function') {
20
- this.onClick(event);
21
- }
22
- this.gameObject.emitter.emit('tap', event);
23
- }
24
- onDestroy() {
25
- this.gameObject.display.off('pointertap', this.handlePointerTap, this);
26
- super.onDestroy();
27
- }
28
- };
29
- __decorate([
30
- Prop({
31
- type: 'event',
32
- description: 'Action invoked when the button receives a pointer tap.',
33
- })
34
- ], Button.prototype, "onClick", void 0);
35
- Button = __decorate([
36
- ComponentMeta({
37
- type: 'ui.Button',
38
- displayName: 'Button',
39
- category: 'UI/Interaction',
40
- icon: 'mouse-pointer',
41
- description: 'Handles pointer interaction and invokes an action when clicked.',
42
- disallowMultiple: true,
43
- })
44
- ], Button);
45
- export { Button };
@@ -1,12 +0,0 @@
1
- import { Component } from "../../runtime/index.js";
2
- import type { Group } from "../../runtime/index.js";
3
- import type { TextGraphic } from "../graphics/index.js";
4
- export declare class InputField extends Component<Group> {
5
- value: string;
6
- placeholder: string;
7
- multiline: boolean;
8
- textGraphic?: TextGraphic;
9
- awake(): void;
10
- setValue(value: string): void;
11
- applyText(): void;
12
- }
@@ -1,53 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Component, ComponentMeta, Prop } from "../../runtime/index.js";
8
- let InputField = class InputField extends Component {
9
- value = '';
10
- placeholder = '';
11
- multiline = false;
12
- textGraphic;
13
- awake() {
14
- this.applyText();
15
- }
16
- setValue(value) {
17
- this.value = value;
18
- this.applyText();
19
- }
20
- applyText() {
21
- if (!this.textGraphic) {
22
- return;
23
- }
24
- this.textGraphic.text = this.value || this.placeholder;
25
- this.textGraphic.setDirty();
26
- }
27
- };
28
- __decorate([
29
- Prop({ type: 'string', default: '' })
30
- ], InputField.prototype, "value", void 0);
31
- __decorate([
32
- Prop({ type: 'string', default: '' })
33
- ], InputField.prototype, "placeholder", void 0);
34
- __decorate([
35
- Prop({ type: 'boolean', default: false })
36
- ], InputField.prototype, "multiline", void 0);
37
- __decorate([
38
- Prop({
39
- type: 'componentRef',
40
- component: 'ui.TextGraphic',
41
- description: 'Text graphic used to display the current value or placeholder.',
42
- })
43
- ], InputField.prototype, "textGraphic", void 0);
44
- InputField = __decorate([
45
- ComponentMeta({
46
- type: 'ui.InputField',
47
- displayName: 'Input Field',
48
- category: 'UI/Input',
49
- description: 'Stores editable text state and can drive text graphic placeholders.',
50
- disallowMultiple: true,
51
- })
52
- ], InputField);
53
- export { InputField };
@@ -1,14 +0,0 @@
1
- import { Component } from "../../runtime/index.js";
2
- import type { Group } from "../../runtime/index.js";
3
- import type { RoundedRectGraphic } from "../graphics/index.js";
4
- export declare class ProgressBar extends Component<Group> {
5
- value: number;
6
- min: number;
7
- max: number;
8
- fillNode?: Group;
9
- fillGraphic?: RoundedRectGraphic;
10
- awake(): void;
11
- setValue(value: number): void;
12
- applyValue: () => void;
13
- onDestroy(): void;
14
- }
@@ -1,66 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Component, ComponentMeta, GameObject, Prop } from "../../runtime/index.js";
8
- let ProgressBar = class ProgressBar extends Component {
9
- value = 0;
10
- min = 0;
11
- max = 1;
12
- fillNode;
13
- fillGraphic;
14
- awake() {
15
- this.gameObject.emitter.on(GameObject.Event.RESIZE, this.applyValue, this);
16
- this.applyValue();
17
- }
18
- setValue(value) {
19
- this.value = value;
20
- this.applyValue();
21
- }
22
- applyValue = () => {
23
- const range = this.max - this.min;
24
- const normalized = range === 0 ? 0 : Math.min(1, Math.max(0, (this.value - this.min) / range));
25
- if (this.fillNode) {
26
- this.fillNode.width = this.gameObject.width * normalized;
27
- this.fillNode.height = this.gameObject.height;
28
- }
29
- this.fillGraphic?.setDirty();
30
- };
31
- onDestroy() {
32
- this.gameObject.emitter.off(GameObject.Event.RESIZE, this.applyValue, this);
33
- }
34
- };
35
- __decorate([
36
- Prop({ type: 'number', default: 0, min: 0, max: 1 })
37
- ], ProgressBar.prototype, "value", void 0);
38
- __decorate([
39
- Prop({ type: 'number', default: 0 })
40
- ], ProgressBar.prototype, "min", void 0);
41
- __decorate([
42
- Prop({ type: 'number', default: 1 })
43
- ], ProgressBar.prototype, "max", void 0);
44
- __decorate([
45
- Prop({
46
- type: 'nodeRef',
47
- description: 'Node resized horizontally to represent the current value.',
48
- })
49
- ], ProgressBar.prototype, "fillNode", void 0);
50
- __decorate([
51
- Prop({
52
- type: 'componentRef',
53
- component: 'ui.Graphic',
54
- description: 'Optional fill graphic redrawn when value changes.',
55
- })
56
- ], ProgressBar.prototype, "fillGraphic", void 0);
57
- ProgressBar = __decorate([
58
- ComponentMeta({
59
- type: 'ui.ProgressBar',
60
- displayName: 'Progress Bar',
61
- category: 'UI/Display',
62
- description: 'Controls a fill node or graphic based on a normalized value.',
63
- disallowMultiple: true,
64
- })
65
- ], ProgressBar);
66
- export { ProgressBar };
@@ -1,23 +0,0 @@
1
- import { Component } from "../../runtime/index.js";
2
- import type { Group } from "../../runtime/index.js";
3
- export declare class ScrollRect extends Component<Group> {
4
- viewport?: Group;
5
- content?: Group;
6
- contentHeight: number;
7
- wheelSensitivity: number;
8
- dragEnabled: boolean;
9
- private scrollY;
10
- private dragging;
11
- private dragStartY;
12
- private dragStartScrollY;
13
- awake(): void;
14
- get maxScrollY(): number;
15
- scrollTo(y: number): void;
16
- scrollBy(deltaY: number): void;
17
- private applyScroll;
18
- private handleWheel;
19
- private handlePointerDown;
20
- private handleGlobalPointerMove;
21
- private handlePointerUp;
22
- onDestroy(): void;
23
- }