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,358 @@
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
+ let FlexLayout = class FlexLayout extends Control {
10
+ #direction = 'row';
11
+ #align = 'start';
12
+ #justify = 'start';
13
+ #gap = 0;
14
+ #paddingX = 0;
15
+ #paddingY = 0;
16
+ #paddingLeft;
17
+ #paddingRight;
18
+ #paddingTop;
19
+ #paddingBottom;
20
+ #baseSizes = new WeakMap();
21
+ get direction() {
22
+ return this.#direction;
23
+ }
24
+ set direction(value) {
25
+ this.#direction = value === 'column' ? 'column' : 'row';
26
+ this.refreshControlLayout();
27
+ }
28
+ get align() {
29
+ return this.#align;
30
+ }
31
+ set align(value) {
32
+ this.#align = parseAlign(value);
33
+ this.layout();
34
+ }
35
+ get justify() {
36
+ return this.#justify;
37
+ }
38
+ set justify(value) {
39
+ this.#justify = parseJustify(value);
40
+ this.layout();
41
+ }
42
+ get gap() {
43
+ return this.#gap;
44
+ }
45
+ set gap(value) {
46
+ this.#gap = Math.max(0, finiteNumber(value, 0));
47
+ this.refreshControlLayout();
48
+ }
49
+ get paddingX() {
50
+ return this.#paddingX;
51
+ }
52
+ set paddingX(value) {
53
+ this.#paddingX = Math.max(0, finiteNumber(value, 0));
54
+ this.refreshControlLayout();
55
+ }
56
+ get paddingY() {
57
+ return this.#paddingY;
58
+ }
59
+ set paddingY(value) {
60
+ this.#paddingY = Math.max(0, finiteNumber(value, 0));
61
+ this.refreshControlLayout();
62
+ }
63
+ get paddingLeft() {
64
+ return this.#paddingLeft ?? this.#paddingX;
65
+ }
66
+ set paddingLeft(value) {
67
+ this.#paddingLeft = Math.max(0, finiteNumber(value, 0));
68
+ this.refreshControlLayout();
69
+ }
70
+ get paddingRight() {
71
+ return this.#paddingRight ?? this.#paddingX;
72
+ }
73
+ set paddingRight(value) {
74
+ this.#paddingRight = Math.max(0, finiteNumber(value, 0));
75
+ this.refreshControlLayout();
76
+ }
77
+ get paddingTop() {
78
+ return this.#paddingTop ?? this.#paddingY;
79
+ }
80
+ set paddingTop(value) {
81
+ this.#paddingTop = Math.max(0, finiteNumber(value, 0));
82
+ this.refreshControlLayout();
83
+ }
84
+ get paddingBottom() {
85
+ return this.#paddingBottom ?? this.#paddingY;
86
+ }
87
+ set paddingBottom(value) {
88
+ this.#paddingBottom = Math.max(0, finiteNumber(value, 0));
89
+ this.refreshControlLayout();
90
+ }
91
+ layout() {
92
+ const children = this.default?.children;
93
+ if (!children || children.length === 0) {
94
+ this.syncControlBoxSize();
95
+ return;
96
+ }
97
+ for (const child of children) {
98
+ this.#rememberBaseSize(child);
99
+ }
100
+ const horizontal = this.#direction === 'row';
101
+ const mainAxis = horizontal ? 'row' : 'column';
102
+ const crossAxis = horizontal ? 'column' : 'row';
103
+ const paddingMainStart = horizontal ? this.paddingLeft : this.paddingTop;
104
+ const paddingMainEnd = horizontal ? this.paddingRight : this.paddingBottom;
105
+ const paddingCrossStart = horizontal ? this.paddingTop : this.paddingLeft;
106
+ const paddingCrossEnd = horizontal ? this.paddingBottom : this.paddingRight;
107
+ const items = children.map((child) => this.#createLayoutItem(child, mainAxis, crossAxis));
108
+ const gapTotal = this.#gap * Math.max(0, items.length - 1);
109
+ const naturalMain = items.reduce((sum, item) => sum + item.baseMain + marginMain(item.props, horizontal), 0);
110
+ const naturalCross = items.reduce((max, item) => Math.max(max, item.baseCross + marginCross(item.props, horizontal)), 0);
111
+ const naturalWidth = horizontal
112
+ ? naturalMain + gapTotal + paddingMainStart + paddingMainEnd
113
+ : naturalCross + paddingCrossStart + paddingCrossEnd;
114
+ const naturalHeight = horizontal
115
+ ? naturalCross + paddingCrossStart + paddingCrossEnd
116
+ : naturalMain + gapTotal + paddingMainStart + paddingMainEnd;
117
+ const assigned = this.getAssignedControlBoxSize();
118
+ const containerWidth = assigned.width ?? naturalWidth;
119
+ const containerHeight = assigned.height ?? naturalHeight;
120
+ const containerMain = horizontal ? containerWidth : containerHeight;
121
+ const containerCross = horizontal ? containerHeight : containerWidth;
122
+ const innerMain = Math.max(0, containerMain - paddingMainStart - paddingMainEnd - gapTotal);
123
+ const innerCross = Math.max(0, containerCross - paddingCrossStart - paddingCrossEnd);
124
+ const freeMain = innerMain - naturalMain;
125
+ this.#resolveMainSizes(items, freeMain, horizontal);
126
+ this.#resolveCrossSizes(items, innerCross, horizontal);
127
+ this.#placeItems(items, containerMain, paddingMainStart, paddingMainEnd, paddingCrossStart, innerCross, horizontal);
128
+ this.syncControlBoxSize();
129
+ }
130
+ measureControlNaturalSize() {
131
+ const children = this.default?.children;
132
+ if (!children || children.length === 0) {
133
+ return { width: 0, height: 0 };
134
+ }
135
+ const gapTotal = this.#gap * Math.max(0, children.length - 1);
136
+ const sizes = children.map((child) => this.#naturalSize(child));
137
+ if (this.#direction === 'row') {
138
+ return {
139
+ width: this.paddingLeft + this.paddingRight + gapTotal + sizes.reduce((sum, size) => sum + size.width, 0),
140
+ height: this.paddingTop + this.paddingBottom + sizes.reduce((max, size) => Math.max(max, size.height), 0),
141
+ };
142
+ }
143
+ return {
144
+ width: this.paddingLeft + this.paddingRight + sizes.reduce((max, size) => Math.max(max, size.width), 0),
145
+ height: this.paddingTop + this.paddingBottom + gapTotal + sizes.reduce((sum, size) => sum + size.height, 0),
146
+ };
147
+ }
148
+ #createLayoutItem(child, mainAxis, crossAxis) {
149
+ const props = child.getFlexItemLayoutProps?.() ?? defaultItemProps;
150
+ const natural = this.#naturalSize(child);
151
+ const naturalMain = mainAxis === 'row' ? natural.width : natural.height;
152
+ const naturalCross = crossAxis === 'row' ? natural.width : natural.height;
153
+ const minMain = mainAxis === 'row' ? props.minWidth : props.minHeight;
154
+ const maxMain = maxSize(mainAxis === 'row' ? props.maxWidth : props.maxHeight);
155
+ const minCross = crossAxis === 'row' ? props.minWidth : props.minHeight;
156
+ const maxCross = maxSize(crossAxis === 'row' ? props.maxWidth : props.maxHeight);
157
+ const basis = basisSize(props.basis, naturalMain);
158
+ const baseMain = clamp(basis, minMain, maxMain);
159
+ const baseCross = clamp(naturalCross, minCross, maxCross);
160
+ return {
161
+ child,
162
+ props,
163
+ baseMain,
164
+ baseCross,
165
+ mainSize: baseMain,
166
+ crossSize: baseCross,
167
+ };
168
+ }
169
+ #resolveMainSizes(items, freeMain, horizontal) {
170
+ if (freeMain > 0) {
171
+ const totalGrow = items.reduce((sum, item) => sum + item.props.grow, 0);
172
+ if (totalGrow > 0) {
173
+ for (const item of items) {
174
+ item.mainSize = clampMain(item.baseMain + freeMain * (item.props.grow / totalGrow), item.props, horizontal);
175
+ }
176
+ }
177
+ return;
178
+ }
179
+ if (freeMain < 0) {
180
+ const totalShrink = items.reduce((sum, item) => sum + item.props.shrink * item.baseMain, 0);
181
+ if (totalShrink > 0) {
182
+ for (const item of items) {
183
+ const weighted = item.props.shrink * item.baseMain;
184
+ item.mainSize = clampMain(item.baseMain + freeMain * (weighted / totalShrink), item.props, horizontal);
185
+ }
186
+ }
187
+ }
188
+ }
189
+ #resolveCrossSizes(items, innerCross, horizontal) {
190
+ for (const item of items) {
191
+ const alignSelf = item.props.alignSelf === 'auto' ? this.#align : item.props.alignSelf;
192
+ if (alignSelf === 'stretch') {
193
+ item.crossSize = clampCross(innerCross - marginCross(item.props, horizontal), item.props, horizontal);
194
+ }
195
+ }
196
+ }
197
+ #placeItems(items, containerMain, paddingMainStart, paddingMainEnd, paddingCrossStart, innerCross, horizontal) {
198
+ const usedMain = items.reduce((sum, item) => sum + item.mainSize + marginMain(item.props, horizontal), 0);
199
+ const remaining = Math.max(0, containerMain - paddingMainStart - paddingMainEnd - usedMain - this.#gap * Math.max(0, items.length - 1));
200
+ const actualGap = this.#justify === 'space-between' && items.length > 1
201
+ ? this.#gap + remaining / (items.length - 1)
202
+ : this.#gap;
203
+ let cursor = paddingMainStart + justifyOffset(this.#justify, remaining);
204
+ for (const item of items) {
205
+ const mainStartMargin = horizontal ? item.props.marginLeft : item.props.marginTop;
206
+ const mainEndMargin = horizontal ? item.props.marginRight : item.props.marginBottom;
207
+ const crossStartMargin = horizontal ? item.props.marginTop : item.props.marginLeft;
208
+ const crossEndMargin = horizontal ? item.props.marginBottom : item.props.marginRight;
209
+ const alignSelf = item.props.alignSelf === 'auto' ? this.#align : item.props.alignSelf;
210
+ const crossFree = Math.max(0, innerCross - item.crossSize - crossStartMargin - crossEndMargin);
211
+ const main = cursor + mainStartMargin;
212
+ const cross = paddingCrossStart + crossStartMargin + alignOffset(alignSelf, crossFree);
213
+ const x = horizontal ? main : cross;
214
+ const y = horizontal ? cross : main;
215
+ const width = horizontal ? item.mainSize : item.crossSize;
216
+ const height = horizontal ? item.crossSize : item.mainSize;
217
+ setChildBox(item.child, x, y, width, height);
218
+ cursor = main + item.mainSize + mainEndMargin + actualGap;
219
+ }
220
+ }
221
+ #rememberBaseSize(child) {
222
+ if (!this.#baseSizes.has(child)) {
223
+ this.#baseSizes.set(child, {
224
+ width: child.width,
225
+ height: child.height,
226
+ });
227
+ }
228
+ }
229
+ #naturalSize(child) {
230
+ const measured = child.measureControlNaturalSize?.();
231
+ if (measured) {
232
+ return measured;
233
+ }
234
+ return this.#baseSizes.get(child) ?? { width: child.width, height: child.height };
235
+ }
236
+ };
237
+ __decorate([
238
+ slot()
239
+ ], FlexLayout.prototype, "default", void 0);
240
+ __decorate([
241
+ prop({ type: String, default: 'row' })
242
+ ], FlexLayout.prototype, "direction", null);
243
+ __decorate([
244
+ prop({ type: String, default: 'start' })
245
+ ], FlexLayout.prototype, "align", null);
246
+ __decorate([
247
+ prop({ type: String, default: 'start' })
248
+ ], FlexLayout.prototype, "justify", null);
249
+ __decorate([
250
+ prop({ type: Number, default: 0 })
251
+ ], FlexLayout.prototype, "gap", null);
252
+ __decorate([
253
+ prop({ type: Number, default: 0 })
254
+ ], FlexLayout.prototype, "paddingX", null);
255
+ __decorate([
256
+ prop({ type: Number, default: 0 })
257
+ ], FlexLayout.prototype, "paddingY", null);
258
+ __decorate([
259
+ prop({ type: Number })
260
+ ], FlexLayout.prototype, "paddingLeft", null);
261
+ __decorate([
262
+ prop({ type: Number })
263
+ ], FlexLayout.prototype, "paddingRight", null);
264
+ __decorate([
265
+ prop({ type: Number })
266
+ ], FlexLayout.prototype, "paddingTop", null);
267
+ __decorate([
268
+ prop({ type: Number })
269
+ ], FlexLayout.prototype, "paddingBottom", null);
270
+ FlexLayout = __decorate([
271
+ scene()
272
+ ], FlexLayout);
273
+ export { FlexLayout };
274
+ const defaultItemProps = {
275
+ grow: 0,
276
+ shrink: 1,
277
+ basis: 'auto',
278
+ minWidth: 0,
279
+ minHeight: 0,
280
+ maxWidth: -1,
281
+ maxHeight: -1,
282
+ marginLeft: 0,
283
+ marginRight: 0,
284
+ marginTop: 0,
285
+ marginBottom: 0,
286
+ alignSelf: 'auto',
287
+ };
288
+ function setChildBox(child, x, y, width, height) {
289
+ if (child.setControlLayoutBox) {
290
+ child.setControlLayoutBox(x, y, width, height);
291
+ return;
292
+ }
293
+ child.position.set(x, y);
294
+ child.width = width;
295
+ child.height = height;
296
+ }
297
+ function marginMain(props, horizontal) {
298
+ return horizontal
299
+ ? props.marginLeft + props.marginRight
300
+ : props.marginTop + props.marginBottom;
301
+ }
302
+ function marginCross(props, horizontal) {
303
+ return horizontal
304
+ ? props.marginTop + props.marginBottom
305
+ : props.marginLeft + props.marginRight;
306
+ }
307
+ function clampMain(value, props, horizontal) {
308
+ return horizontal
309
+ ? clamp(value, props.minWidth, maxSize(props.maxWidth))
310
+ : clamp(value, props.minHeight, maxSize(props.maxHeight));
311
+ }
312
+ function clampCross(value, props, horizontal) {
313
+ return horizontal
314
+ ? clamp(value, props.minHeight, maxSize(props.maxHeight))
315
+ : clamp(value, props.minWidth, maxSize(props.maxWidth));
316
+ }
317
+ function basisSize(basis, naturalSize) {
318
+ return basis === 'auto' ? naturalSize : basis;
319
+ }
320
+ function maxSize(value) {
321
+ return value >= 0 ? value : Number.POSITIVE_INFINITY;
322
+ }
323
+ function clamp(value, min, max) {
324
+ return Math.min(max, Math.max(min, value));
325
+ }
326
+ function justifyOffset(justify, remaining) {
327
+ if (justify === 'center') {
328
+ return remaining / 2;
329
+ }
330
+ if (justify === 'end') {
331
+ return remaining;
332
+ }
333
+ return 0;
334
+ }
335
+ function alignOffset(align, remaining) {
336
+ if (align === 'center') {
337
+ return remaining / 2;
338
+ }
339
+ if (align === 'end') {
340
+ return remaining;
341
+ }
342
+ return 0;
343
+ }
344
+ function parseAlign(value) {
345
+ if (value === 'center' || value === 'end' || value === 'stretch') {
346
+ return value;
347
+ }
348
+ return 'start';
349
+ }
350
+ function parseJustify(value) {
351
+ if (value === 'center' || value === 'end' || value === 'space-between') {
352
+ return value;
353
+ }
354
+ return 'start';
355
+ }
356
+ function finiteNumber(value, fallback) {
357
+ return Number.isFinite(value) ? value : fallback;
358
+ }
@@ -0,0 +1,3 @@
1
+ <Scene name="FlexLayout">
2
+ <slot name="default" />
3
+ </Scene>