pixifact 0.1.3 → 0.1.5

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
@@ -0,0 +1,45 @@
1
+ import { Container } from 'pixi.js';
2
+ import { Control } from './Control.js';
3
+ import { type Size } from './controlLayout.js';
4
+ export type FlexAlignSelf = 'auto' | 'start' | 'center' | 'end' | 'stretch';
5
+ export type FlexBasis = number | 'auto';
6
+ export interface FlexItemLayoutProps {
7
+ grow: number;
8
+ shrink: number;
9
+ basis: FlexBasis;
10
+ minWidth: number;
11
+ minHeight: number;
12
+ maxWidth: number;
13
+ maxHeight: number;
14
+ marginLeft: number;
15
+ marginRight: number;
16
+ marginTop: number;
17
+ marginBottom: number;
18
+ alignSelf: FlexAlignSelf;
19
+ }
20
+ export declare class FlexItem extends Control {
21
+ #private;
22
+ readonly default: Container;
23
+ get grow(): number;
24
+ set grow(value: number);
25
+ get shrink(): number;
26
+ set shrink(value: number);
27
+ get basis(): string | number;
28
+ set basis(value: string | number);
29
+ get maxWidth(): number;
30
+ set maxWidth(value: number);
31
+ get maxHeight(): number;
32
+ set maxHeight(value: number);
33
+ get marginLeft(): number;
34
+ set marginLeft(value: number);
35
+ get marginRight(): number;
36
+ set marginRight(value: number);
37
+ get marginTop(): number;
38
+ set marginTop(value: number);
39
+ get marginBottom(): number;
40
+ set marginBottom(value: number);
41
+ get alignSelf(): string;
42
+ set alignSelf(value: string);
43
+ getFlexItemLayoutProps(): FlexItemLayoutProps;
44
+ measureControlNaturalSize(): Size;
45
+ }
@@ -0,0 +1,164 @@
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 { prop, scene, slot } from 'pixifact/compiler';
8
+ import { Control } from './Control.js';
9
+ import { measureChildren } from './controlLayout.js';
10
+ let FlexItem = class FlexItem extends Control {
11
+ #grow = 0;
12
+ #shrink = 1;
13
+ #basis = 'auto';
14
+ #maxWidth = -1;
15
+ #maxHeight = -1;
16
+ #marginLeft = 0;
17
+ #marginRight = 0;
18
+ #marginTop = 0;
19
+ #marginBottom = 0;
20
+ #alignSelf = 'auto';
21
+ get grow() {
22
+ return this.#grow;
23
+ }
24
+ set grow(value) {
25
+ this.#grow = Math.max(0, finiteNumber(value, 0));
26
+ this.requestParentLayout();
27
+ }
28
+ get shrink() {
29
+ return this.#shrink;
30
+ }
31
+ set shrink(value) {
32
+ this.#shrink = Math.max(0, finiteNumber(value, 1));
33
+ this.requestParentLayout();
34
+ }
35
+ get basis() {
36
+ return this.#basis;
37
+ }
38
+ set basis(value) {
39
+ this.#basis = parseBasis(value);
40
+ this.requestParentLayout();
41
+ }
42
+ get maxWidth() {
43
+ return this.#maxWidth;
44
+ }
45
+ set maxWidth(value) {
46
+ this.#maxWidth = finiteNumber(value, -1);
47
+ this.requestParentLayout();
48
+ }
49
+ get maxHeight() {
50
+ return this.#maxHeight;
51
+ }
52
+ set maxHeight(value) {
53
+ this.#maxHeight = finiteNumber(value, -1);
54
+ this.requestParentLayout();
55
+ }
56
+ get marginLeft() {
57
+ return this.#marginLeft;
58
+ }
59
+ set marginLeft(value) {
60
+ this.#marginLeft = finiteNumber(value, 0);
61
+ this.requestParentLayout();
62
+ }
63
+ get marginRight() {
64
+ return this.#marginRight;
65
+ }
66
+ set marginRight(value) {
67
+ this.#marginRight = finiteNumber(value, 0);
68
+ this.requestParentLayout();
69
+ }
70
+ get marginTop() {
71
+ return this.#marginTop;
72
+ }
73
+ set marginTop(value) {
74
+ this.#marginTop = finiteNumber(value, 0);
75
+ this.requestParentLayout();
76
+ }
77
+ get marginBottom() {
78
+ return this.#marginBottom;
79
+ }
80
+ set marginBottom(value) {
81
+ this.#marginBottom = finiteNumber(value, 0);
82
+ this.requestParentLayout();
83
+ }
84
+ get alignSelf() {
85
+ return this.#alignSelf;
86
+ }
87
+ set alignSelf(value) {
88
+ this.#alignSelf = parseAlignSelf(value);
89
+ this.requestParentLayout();
90
+ }
91
+ getFlexItemLayoutProps() {
92
+ const controlProps = this.getControlLayoutProps();
93
+ return {
94
+ grow: this.#grow,
95
+ shrink: this.#shrink,
96
+ basis: this.#basis,
97
+ minWidth: controlProps.minWidth,
98
+ minHeight: controlProps.minHeight,
99
+ maxWidth: this.#maxWidth,
100
+ maxHeight: this.#maxHeight,
101
+ marginLeft: this.#marginLeft,
102
+ marginRight: this.#marginRight,
103
+ marginTop: this.#marginTop,
104
+ marginBottom: this.#marginBottom,
105
+ alignSelf: this.#alignSelf,
106
+ };
107
+ }
108
+ measureControlNaturalSize() {
109
+ return measureChildren(this.default ?? this);
110
+ }
111
+ };
112
+ __decorate([
113
+ slot()
114
+ ], FlexItem.prototype, "default", void 0);
115
+ __decorate([
116
+ prop({ type: Number, default: 0 })
117
+ ], FlexItem.prototype, "grow", null);
118
+ __decorate([
119
+ prop({ type: Number, default: 1 })
120
+ ], FlexItem.prototype, "shrink", null);
121
+ __decorate([
122
+ prop({ type: Number, default: -1 })
123
+ ], FlexItem.prototype, "basis", null);
124
+ __decorate([
125
+ prop({ type: Number, default: -1 })
126
+ ], FlexItem.prototype, "maxWidth", null);
127
+ __decorate([
128
+ prop({ type: Number, default: -1 })
129
+ ], FlexItem.prototype, "maxHeight", null);
130
+ __decorate([
131
+ prop({ type: Number, default: 0 })
132
+ ], FlexItem.prototype, "marginLeft", null);
133
+ __decorate([
134
+ prop({ type: Number, default: 0 })
135
+ ], FlexItem.prototype, "marginRight", null);
136
+ __decorate([
137
+ prop({ type: Number, default: 0 })
138
+ ], FlexItem.prototype, "marginTop", null);
139
+ __decorate([
140
+ prop({ type: Number, default: 0 })
141
+ ], FlexItem.prototype, "marginBottom", null);
142
+ __decorate([
143
+ prop({ type: String, default: 'auto' })
144
+ ], FlexItem.prototype, "alignSelf", null);
145
+ FlexItem = __decorate([
146
+ scene()
147
+ ], FlexItem);
148
+ export { FlexItem };
149
+ function parseBasis(value) {
150
+ if (value === 'auto') {
151
+ return 'auto';
152
+ }
153
+ const basis = finiteNumber(Number(value), -1);
154
+ return basis >= 0 ? basis : 'auto';
155
+ }
156
+ function parseAlignSelf(value) {
157
+ if (value === 'start' || value === 'center' || value === 'end' || value === 'stretch') {
158
+ return value;
159
+ }
160
+ return 'auto';
161
+ }
162
+ function finiteNumber(value, fallback) {
163
+ return Number.isFinite(value) ? value : fallback;
164
+ }
@@ -0,0 +1,3 @@
1
+ <Scene name="FlexItem">
2
+ <slot name="default" />
3
+ </Scene>
@@ -0,0 +1,180 @@
1
+ import { Container } from 'pixi.js';
2
+ import { prop, scene, slot } from 'pixifact/compiler';
3
+ import { Control } from './Control';
4
+ import { measureChildren, type Size } from './controlLayout';
5
+
6
+ export type FlexAlignSelf = 'auto' | 'start' | 'center' | 'end' | 'stretch';
7
+ export type FlexBasis = number | 'auto';
8
+
9
+ export interface FlexItemLayoutProps {
10
+ grow: number;
11
+ shrink: number;
12
+ basis: FlexBasis;
13
+ minWidth: number;
14
+ minHeight: number;
15
+ maxWidth: number;
16
+ maxHeight: number;
17
+ marginLeft: number;
18
+ marginRight: number;
19
+ marginTop: number;
20
+ marginBottom: number;
21
+ alignSelf: FlexAlignSelf;
22
+ }
23
+
24
+ @scene()
25
+ export class FlexItem extends Control {
26
+ @slot()
27
+ declare readonly default: Container;
28
+
29
+ #grow = 0;
30
+ #shrink = 1;
31
+ #basis: FlexBasis = 'auto';
32
+ #maxWidth = -1;
33
+ #maxHeight = -1;
34
+ #marginLeft = 0;
35
+ #marginRight = 0;
36
+ #marginTop = 0;
37
+ #marginBottom = 0;
38
+ #alignSelf: FlexAlignSelf = 'auto';
39
+
40
+ get grow() {
41
+ return this.#grow;
42
+ }
43
+
44
+ @prop({ type: Number, default: 0 })
45
+ set grow(value: number) {
46
+ this.#grow = Math.max(0, finiteNumber(value, 0));
47
+ this.requestParentLayout();
48
+ }
49
+
50
+ get shrink() {
51
+ return this.#shrink;
52
+ }
53
+
54
+ @prop({ type: Number, default: 1 })
55
+ set shrink(value: number) {
56
+ this.#shrink = Math.max(0, finiteNumber(value, 1));
57
+ this.requestParentLayout();
58
+ }
59
+
60
+ get basis() {
61
+ return this.#basis;
62
+ }
63
+
64
+ @prop({ type: Number, default: -1 })
65
+ set basis(value: string | number) {
66
+ this.#basis = parseBasis(value);
67
+ this.requestParentLayout();
68
+ }
69
+
70
+ get maxWidth() {
71
+ return this.#maxWidth;
72
+ }
73
+
74
+ @prop({ type: Number, default: -1 })
75
+ set maxWidth(value: number) {
76
+ this.#maxWidth = finiteNumber(value, -1);
77
+ this.requestParentLayout();
78
+ }
79
+
80
+ get maxHeight() {
81
+ return this.#maxHeight;
82
+ }
83
+
84
+ @prop({ type: Number, default: -1 })
85
+ set maxHeight(value: number) {
86
+ this.#maxHeight = finiteNumber(value, -1);
87
+ this.requestParentLayout();
88
+ }
89
+
90
+ get marginLeft() {
91
+ return this.#marginLeft;
92
+ }
93
+
94
+ @prop({ type: Number, default: 0 })
95
+ set marginLeft(value: number) {
96
+ this.#marginLeft = finiteNumber(value, 0);
97
+ this.requestParentLayout();
98
+ }
99
+
100
+ get marginRight() {
101
+ return this.#marginRight;
102
+ }
103
+
104
+ @prop({ type: Number, default: 0 })
105
+ set marginRight(value: number) {
106
+ this.#marginRight = finiteNumber(value, 0);
107
+ this.requestParentLayout();
108
+ }
109
+
110
+ get marginTop() {
111
+ return this.#marginTop;
112
+ }
113
+
114
+ @prop({ type: Number, default: 0 })
115
+ set marginTop(value: number) {
116
+ this.#marginTop = finiteNumber(value, 0);
117
+ this.requestParentLayout();
118
+ }
119
+
120
+ get marginBottom() {
121
+ return this.#marginBottom;
122
+ }
123
+
124
+ @prop({ type: Number, default: 0 })
125
+ set marginBottom(value: number) {
126
+ this.#marginBottom = finiteNumber(value, 0);
127
+ this.requestParentLayout();
128
+ }
129
+
130
+ get alignSelf() {
131
+ return this.#alignSelf;
132
+ }
133
+
134
+ @prop({ type: String, default: 'auto' })
135
+ set alignSelf(value: string) {
136
+ this.#alignSelf = parseAlignSelf(value);
137
+ this.requestParentLayout();
138
+ }
139
+
140
+ getFlexItemLayoutProps(): FlexItemLayoutProps {
141
+ const controlProps = this.getControlLayoutProps();
142
+ return {
143
+ grow: this.#grow,
144
+ shrink: this.#shrink,
145
+ basis: this.#basis,
146
+ minWidth: controlProps.minWidth,
147
+ minHeight: controlProps.minHeight,
148
+ maxWidth: this.#maxWidth,
149
+ maxHeight: this.#maxHeight,
150
+ marginLeft: this.#marginLeft,
151
+ marginRight: this.#marginRight,
152
+ marginTop: this.#marginTop,
153
+ marginBottom: this.#marginBottom,
154
+ alignSelf: this.#alignSelf,
155
+ };
156
+ }
157
+
158
+ override measureControlNaturalSize(): Size {
159
+ return measureChildren(this.default ?? this);
160
+ }
161
+ }
162
+
163
+ function parseBasis(value: string | number): FlexBasis {
164
+ if (value === 'auto') {
165
+ return 'auto';
166
+ }
167
+ const basis = finiteNumber(Number(value), -1);
168
+ return basis >= 0 ? basis : 'auto';
169
+ }
170
+
171
+ function parseAlignSelf(value: string): FlexAlignSelf {
172
+ if (value === 'start' || value === 'center' || value === 'end' || value === 'stretch') {
173
+ return value;
174
+ }
175
+ return 'auto';
176
+ }
177
+
178
+ function finiteNumber(value: number, fallback: number) {
179
+ return Number.isFinite(value) ? value : fallback;
180
+ }
@@ -0,0 +1,29 @@
1
+ import { Container } from 'pixi.js';
2
+ import { Control } from './Control.js';
3
+ import type { Size } from './controlLayout.js';
4
+ export declare class FlexLayout extends Control {
5
+ #private;
6
+ readonly default: Container;
7
+ get direction(): string;
8
+ set direction(value: string);
9
+ get align(): string;
10
+ set align(value: string);
11
+ get justify(): string;
12
+ set justify(value: string);
13
+ get gap(): number;
14
+ set gap(value: number);
15
+ get paddingX(): number;
16
+ set paddingX(value: number);
17
+ get paddingY(): number;
18
+ set paddingY(value: number);
19
+ get paddingLeft(): number;
20
+ set paddingLeft(value: number);
21
+ get paddingRight(): number;
22
+ set paddingRight(value: number);
23
+ get paddingTop(): number;
24
+ set paddingTop(value: number);
25
+ get paddingBottom(): number;
26
+ set paddingBottom(value: number);
27
+ layout(): void;
28
+ measureControlNaturalSize(): Size;
29
+ }