phaser-wind 0.7.0 → 0.8.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.
- package/README.md +24 -0
- package/dist/components/column/column.d.ts +88 -0
- package/dist/components/column/column.d.ts.map +1 -0
- package/dist/components/column/column.js +143 -0
- package/dist/components/column/column.js.map +1 -0
- package/dist/components/column/column.spec.d.ts +2 -0
- package/dist/components/column/column.spec.d.ts.map +1 -0
- package/dist/components/column/column.spec.js +114 -0
- package/dist/components/column/column.spec.js.map +1 -0
- package/dist/components/column/index.d.ts +2 -0
- package/dist/components/column/index.d.ts.map +1 -0
- package/dist/components/column/index.js +2 -0
- package/dist/components/column/index.js.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/index.d.ts.map +1 -0
- package/dist/components/layout/index.js +2 -0
- package/dist/components/layout/index.js.map +1 -0
- package/dist/components/layout/layout-utils.d.ts +13 -0
- package/dist/components/layout/layout-utils.d.ts.map +1 -0
- package/dist/components/layout/layout-utils.js +96 -0
- package/dist/components/layout/layout-utils.js.map +1 -0
- package/dist/components/layout/layout-utils.spec.d.ts +2 -0
- package/dist/components/layout/layout-utils.spec.d.ts.map +1 -0
- package/dist/components/layout/layout-utils.spec.js +70 -0
- package/dist/components/layout/layout-utils.spec.js.map +1 -0
- package/dist/components/row/index.d.ts +2 -0
- package/dist/components/row/index.d.ts.map +1 -0
- package/dist/components/row/index.js +2 -0
- package/dist/components/row/index.js.map +1 -0
- package/dist/components/row/row.d.ts +87 -0
- package/dist/components/row/row.d.ts.map +1 -0
- package/dist/components/row/row.js +146 -0
- package/dist/components/row/row.js.map +1 -0
- package/dist/components/row/row.spec.d.ts +2 -0
- package/dist/components/row/row.spec.d.ts.map +1 -0
- package/dist/components/row/row.spec.js +114 -0
- package/dist/components/row/row.spec.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/phaser-wind.js +391 -0
- package/dist/phaser-wind.min.js +1 -1
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +35 -0
- package/dist/test-setup.js.map +1 -0
- package/package.json +1 -1
- package/dist/components/column.d.ts +0 -2
- package/dist/components/column.d.ts.map +0 -1
- package/dist/components/column.js +0 -2
- package/dist/components/column.js.map +0 -1
package/dist/phaser-wind.js
CHANGED
|
@@ -61,6 +61,391 @@
|
|
|
61
61
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
+
/** Default gap between elements in pixels */
|
|
65
|
+
var DEFAULT_GAP = 8;
|
|
66
|
+
/** Measures the display width of a game object, with fallbacks */
|
|
67
|
+
var getDisplayWidthOf = function (child) {
|
|
68
|
+
var _a;
|
|
69
|
+
var childTyped = child;
|
|
70
|
+
// Check if it's a Container-like object (has list property and width/height)
|
|
71
|
+
if (child && typeof child === 'object' && 'list' in child && Array.isArray(child.list)) {
|
|
72
|
+
if (typeof childTyped.displayWidth === 'number' && childTyped.displayWidth > 0) {
|
|
73
|
+
return childTyped.displayWidth;
|
|
74
|
+
}
|
|
75
|
+
if (typeof childTyped.width === 'number' && childTyped.width > 0) {
|
|
76
|
+
return childTyped.width;
|
|
77
|
+
}
|
|
78
|
+
var container = child;
|
|
79
|
+
if (typeof container.displayWidth === 'number' && container.displayWidth > 0) {
|
|
80
|
+
return container.displayWidth;
|
|
81
|
+
}
|
|
82
|
+
if (typeof container.width === 'number' && container.width > 0) {
|
|
83
|
+
if (typeof container.scale === 'number' && container.scale > 0) {
|
|
84
|
+
return container.width / container.scale;
|
|
85
|
+
}
|
|
86
|
+
return container.width;
|
|
87
|
+
}
|
|
88
|
+
var w = 0;
|
|
89
|
+
for (var _i = 0, _b = container.list; _i < _b.length; _i++) {
|
|
90
|
+
var sub = _b[_i];
|
|
91
|
+
var size = getDisplayWidthOf(sub);
|
|
92
|
+
w = Math.max(w, size);
|
|
93
|
+
}
|
|
94
|
+
return w;
|
|
95
|
+
}
|
|
96
|
+
if (typeof childTyped.displayWidth === 'number') {
|
|
97
|
+
return childTyped.displayWidth;
|
|
98
|
+
}
|
|
99
|
+
if (typeof childTyped.width === 'number') {
|
|
100
|
+
return childTyped.width;
|
|
101
|
+
}
|
|
102
|
+
var bounds = (_a = childTyped.getBounds) === null || _a === void 0 ? void 0 : _a.call(childTyped);
|
|
103
|
+
return bounds ? bounds.width : 0;
|
|
104
|
+
};
|
|
105
|
+
/** Measures the display height of a game object, with fallbacks */
|
|
106
|
+
var getDisplayHeightOf = function (child) {
|
|
107
|
+
var _a;
|
|
108
|
+
var childTyped = child;
|
|
109
|
+
// Check if it's a Container-like object (has list property and width/height)
|
|
110
|
+
if (child && typeof child === 'object' && 'list' in child && Array.isArray(child.list)) {
|
|
111
|
+
if (typeof childTyped.displayHeight === 'number' && childTyped.displayHeight > 0) {
|
|
112
|
+
return childTyped.displayHeight;
|
|
113
|
+
}
|
|
114
|
+
if (typeof childTyped.height === 'number' && childTyped.height > 0) {
|
|
115
|
+
return childTyped.height;
|
|
116
|
+
}
|
|
117
|
+
var container = child;
|
|
118
|
+
if (typeof container.displayHeight === 'number' && container.displayHeight > 0) {
|
|
119
|
+
return container.displayHeight;
|
|
120
|
+
}
|
|
121
|
+
if (typeof container.height === 'number' && container.height > 0) {
|
|
122
|
+
if (typeof container.scale === 'number' && container.scale > 0) {
|
|
123
|
+
return container.height / container.scale;
|
|
124
|
+
}
|
|
125
|
+
return container.height;
|
|
126
|
+
}
|
|
127
|
+
var h = 0;
|
|
128
|
+
for (var _i = 0, _b = container.list; _i < _b.length; _i++) {
|
|
129
|
+
var sub = _b[_i];
|
|
130
|
+
var size = getDisplayHeightOf(sub);
|
|
131
|
+
h = Math.max(h, size);
|
|
132
|
+
}
|
|
133
|
+
return h;
|
|
134
|
+
}
|
|
135
|
+
if (typeof childTyped.displayHeight === 'number') {
|
|
136
|
+
return childTyped.displayHeight;
|
|
137
|
+
}
|
|
138
|
+
if (typeof childTyped.height === 'number') {
|
|
139
|
+
return childTyped.height;
|
|
140
|
+
}
|
|
141
|
+
var bounds = (_a = childTyped.getBounds) === null || _a === void 0 ? void 0 : _a.call(childTyped);
|
|
142
|
+
return bounds ? bounds.height : 0;
|
|
143
|
+
};
|
|
144
|
+
/** Returns normalized origin (0..1) for a game object */
|
|
145
|
+
var getNormalizedOriginOf = function (child) {
|
|
146
|
+
var width = getDisplayWidthOf(child);
|
|
147
|
+
var height = getDisplayHeightOf(child);
|
|
148
|
+
var childTyped = child;
|
|
149
|
+
var ox = typeof childTyped.originX === 'number' ? childTyped.originX : undefined;
|
|
150
|
+
var oy = typeof childTyped.originY === 'number' ? childTyped.originY : undefined;
|
|
151
|
+
if (ox === undefined &&
|
|
152
|
+
typeof childTyped.displayOriginX === 'number' &&
|
|
153
|
+
width > 0) {
|
|
154
|
+
ox = childTyped.displayOriginX / width;
|
|
155
|
+
}
|
|
156
|
+
if (oy === undefined &&
|
|
157
|
+
typeof childTyped.displayOriginY === 'number' &&
|
|
158
|
+
height > 0) {
|
|
159
|
+
oy = childTyped.displayOriginY / height;
|
|
160
|
+
}
|
|
161
|
+
return { x: ox !== null && ox !== void 0 ? ox : 0.5, y: oy !== null && oy !== void 0 ? oy : 0.5 };
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Column is a layout container that stacks children vertically with a gap.
|
|
166
|
+
* The container position (x, y) represents the center of the whole column.
|
|
167
|
+
*/
|
|
168
|
+
var Column = /** @class */ (function (_super) {
|
|
169
|
+
__extends(Column, _super);
|
|
170
|
+
/**
|
|
171
|
+
* Creates a new Column container
|
|
172
|
+
* @param params Configuration parameters for the column
|
|
173
|
+
*/
|
|
174
|
+
function Column(_a) {
|
|
175
|
+
var scene = _a.scene, x = _a.x, y = _a.y, _b = _a.gap, gap = _b === void 0 ? DEFAULT_GAP : _b, _c = _a.align, align = _c === void 0 ? 'center' : _c, _d = _a.children, children = _d === void 0 ? [] : _d, _e = _a.verticalOrigin, verticalOrigin = _e === void 0 ? 'center' : _e;
|
|
176
|
+
var _this = _super.call(this, scene, x, y) || this;
|
|
177
|
+
_this.gap = gap;
|
|
178
|
+
_this.align = align;
|
|
179
|
+
_this.verticalOrigin = verticalOrigin;
|
|
180
|
+
if (children.length > 0) {
|
|
181
|
+
_this.add(children);
|
|
182
|
+
}
|
|
183
|
+
_this.layout();
|
|
184
|
+
return _this;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Sets the spacing between children and relayouts
|
|
188
|
+
* @param gap Gap in pixels between elements
|
|
189
|
+
*/
|
|
190
|
+
Column.prototype.setGap = function (gap) {
|
|
191
|
+
this.gap = gap;
|
|
192
|
+
this.layout();
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Sets the horizontal alignment and relayouts
|
|
196
|
+
* @param align New horizontal alignment
|
|
197
|
+
*/
|
|
198
|
+
Column.prototype.setAlign = function (align) {
|
|
199
|
+
this.align = align;
|
|
200
|
+
this.layout();
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Adds a child game object to the column
|
|
204
|
+
* @param child Game object to add
|
|
205
|
+
* @param relayout Whether to relayout after adding (default: true)
|
|
206
|
+
* @returns This column instance for chaining
|
|
207
|
+
*/
|
|
208
|
+
Column.prototype.addChild = function (child, relayout) {
|
|
209
|
+
if (relayout === void 0) { relayout = true; }
|
|
210
|
+
this.add(child);
|
|
211
|
+
if (relayout)
|
|
212
|
+
this.layout();
|
|
213
|
+
return this;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Adds multiple children to the column
|
|
217
|
+
* @param children Array of game objects to add
|
|
218
|
+
* @param relayout Whether to relayout after adding (default: true)
|
|
219
|
+
* @returns This column instance for chaining
|
|
220
|
+
*/
|
|
221
|
+
Column.prototype.addChildren = function (children, relayout) {
|
|
222
|
+
if (relayout === void 0) { relayout = true; }
|
|
223
|
+
if (children.length > 0)
|
|
224
|
+
this.add(children);
|
|
225
|
+
if (relayout)
|
|
226
|
+
this.layout();
|
|
227
|
+
return this;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Recomputes children's positions and updates this container size
|
|
231
|
+
* Positions are calculated based on alignment, origins and gaps
|
|
232
|
+
*/
|
|
233
|
+
Column.prototype.layout = function () {
|
|
234
|
+
var _this = this;
|
|
235
|
+
var children = this.list;
|
|
236
|
+
if (children.length === 0) {
|
|
237
|
+
// Reset size when empty
|
|
238
|
+
this.setSize(0, 0);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
// Measure sizes and origins
|
|
242
|
+
var entries = children.map(function (child) { return ({
|
|
243
|
+
child: child,
|
|
244
|
+
width: _this.getDisplayWidth(child),
|
|
245
|
+
height: _this.getDisplayHeight(child),
|
|
246
|
+
origin: _this.getNormalizedOrigin(child),
|
|
247
|
+
}); });
|
|
248
|
+
var maxWidth = entries.reduce(function (m, s) { return Math.max(m, s.width); }, 0);
|
|
249
|
+
var totalHeight = entries.reduce(function (sum, s) { return sum + s.height; }, 0) + this.gap * (entries.length - 1);
|
|
250
|
+
// Determine top of content based on verticalOrigin
|
|
251
|
+
var contentTopY = this.verticalOrigin === 'top' ? 0 : this.verticalOrigin === 'center' ? -totalHeight / 2 : -totalHeight;
|
|
252
|
+
// Walk from top to bottom, aligning considering each child's origin
|
|
253
|
+
var cursorTopY = contentTopY;
|
|
254
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
255
|
+
var _a = entries_1[_i], child = _a.child, width = _a.width, height = _a.height, origin_1 = _a.origin;
|
|
256
|
+
// Horizontal alignment: align left/right edges or centers correctly using origin
|
|
257
|
+
var x = 0;
|
|
258
|
+
if (this.align === 'left') {
|
|
259
|
+
// place child's left edge at content left
|
|
260
|
+
x = -maxWidth / 2 + origin_1.x * width;
|
|
261
|
+
}
|
|
262
|
+
else if (this.align === 'right') {
|
|
263
|
+
// place child's right edge at content right
|
|
264
|
+
x = maxWidth / 2 - (1 - origin_1.x) * width;
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
// center alignment: center of child at 0 accounting for origin
|
|
268
|
+
x = (origin_1.x - 0.5) * width;
|
|
269
|
+
}
|
|
270
|
+
// Vertical position so that child's top is at cursorTopY
|
|
271
|
+
var y = cursorTopY + origin_1.y * height;
|
|
272
|
+
child.setPosition(x, y);
|
|
273
|
+
cursorTopY += height + this.gap;
|
|
274
|
+
}
|
|
275
|
+
// Update this container size to match content bounds
|
|
276
|
+
this.setSize(maxWidth, totalHeight);
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Gets the display width of a game object
|
|
280
|
+
* @param child GameObject to measure
|
|
281
|
+
* @returns Display width in pixels
|
|
282
|
+
*/
|
|
283
|
+
Column.prototype.getDisplayWidth = function (child) {
|
|
284
|
+
return getDisplayWidthOf(child);
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Gets the display height of a game object
|
|
288
|
+
* @param child GameObject to measure
|
|
289
|
+
* @returns Display height in pixels
|
|
290
|
+
*/
|
|
291
|
+
Column.prototype.getDisplayHeight = function (child) {
|
|
292
|
+
return getDisplayHeightOf(child);
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* Gets the normalized origin point of a game object
|
|
296
|
+
* @param child GameObject to get origin from
|
|
297
|
+
* @returns Object with normalized x,y coordinates of the origin point
|
|
298
|
+
*/
|
|
299
|
+
Column.prototype.getNormalizedOrigin = function (child) {
|
|
300
|
+
return getNormalizedOriginOf(child);
|
|
301
|
+
};
|
|
302
|
+
return Column;
|
|
303
|
+
}(phaser.GameObjects.Container));
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Row is a layout container that arranges children horizontally with a gap.
|
|
307
|
+
* The container position (x, y) represents the center of the whole row.
|
|
308
|
+
*/
|
|
309
|
+
var Row = /** @class */ (function (_super) {
|
|
310
|
+
__extends(Row, _super);
|
|
311
|
+
/**
|
|
312
|
+
* Creates a new Row container
|
|
313
|
+
* @param params Configuration parameters for the row
|
|
314
|
+
*/
|
|
315
|
+
function Row(_a) {
|
|
316
|
+
var scene = _a.scene, x = _a.x, y = _a.y, _b = _a.gap, gap = _b === void 0 ? DEFAULT_GAP : _b, _c = _a.align, align = _c === void 0 ? 'center' : _c, _d = _a.children, children = _d === void 0 ? [] : _d, _e = _a.horizontalOrigin, horizontalOrigin = _e === void 0 ? 'center' : _e;
|
|
317
|
+
var _this = _super.call(this, scene, x, y) || this;
|
|
318
|
+
_this.gap = gap;
|
|
319
|
+
_this.align = align;
|
|
320
|
+
_this.horizontalOrigin = horizontalOrigin;
|
|
321
|
+
if (children.length > 0) {
|
|
322
|
+
_this.add(children);
|
|
323
|
+
}
|
|
324
|
+
_this.layout();
|
|
325
|
+
return _this;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Sets the gap between elements and updates layout
|
|
329
|
+
* @param gap Gap size in pixels
|
|
330
|
+
*/
|
|
331
|
+
Row.prototype.setGap = function (gap) {
|
|
332
|
+
this.gap = gap;
|
|
333
|
+
this.layout();
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
336
|
+
* Sets the vertical alignment and updates layout
|
|
337
|
+
* @param align New vertical alignment
|
|
338
|
+
*/
|
|
339
|
+
Row.prototype.setAlign = function (align) {
|
|
340
|
+
this.align = align;
|
|
341
|
+
this.layout();
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* Adds a single child to the row
|
|
345
|
+
* @param child GameObject to add
|
|
346
|
+
* @param relayout Whether to update layout after adding
|
|
347
|
+
* @returns This row instance for chaining
|
|
348
|
+
*/
|
|
349
|
+
Row.prototype.addChild = function (child, relayout) {
|
|
350
|
+
if (relayout === void 0) { relayout = true; }
|
|
351
|
+
this.add(child);
|
|
352
|
+
if (relayout) {
|
|
353
|
+
this.layout();
|
|
354
|
+
}
|
|
355
|
+
return this;
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* Adds multiple children to the row
|
|
359
|
+
* @param children Array of GameObjects to add
|
|
360
|
+
* @param relayout Whether to update layout after adding
|
|
361
|
+
* @returns This row instance for chaining
|
|
362
|
+
*/
|
|
363
|
+
Row.prototype.addChildren = function (children, relayout) {
|
|
364
|
+
if (relayout === void 0) { relayout = true; }
|
|
365
|
+
if (children.length > 0)
|
|
366
|
+
this.add(children);
|
|
367
|
+
if (relayout)
|
|
368
|
+
this.layout();
|
|
369
|
+
return this;
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* Recomputes children's positions and updates this container size
|
|
373
|
+
*/
|
|
374
|
+
Row.prototype.layout = function () {
|
|
375
|
+
var _this = this;
|
|
376
|
+
var children = this.list;
|
|
377
|
+
if (children.length === 0) {
|
|
378
|
+
this.setSize(0, 0);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
// Measure sizes and origins
|
|
382
|
+
var entries = children.map(function (child) { return ({
|
|
383
|
+
child: child,
|
|
384
|
+
width: _this.getDisplayWidth(child),
|
|
385
|
+
height: _this.getDisplayHeight(child),
|
|
386
|
+
origin: _this.getNormalizedOrigin(child),
|
|
387
|
+
}); });
|
|
388
|
+
var maxHeight = entries.reduce(function (m, s) { return Math.max(m, s.height); }, 0);
|
|
389
|
+
var totalWidth = entries.reduce(function (sum, s) { return sum + s.width; }, 0) +
|
|
390
|
+
this.gap * (entries.length - 1);
|
|
391
|
+
// Determine left of content based on horizontalOrigin
|
|
392
|
+
var contentLeftX = this.horizontalOrigin === 'left'
|
|
393
|
+
? 0
|
|
394
|
+
: this.horizontalOrigin === 'center'
|
|
395
|
+
? -totalWidth / 2
|
|
396
|
+
: -totalWidth;
|
|
397
|
+
// Walk left to right, aligning considering each child's origin
|
|
398
|
+
var cursorLeftX = contentLeftX;
|
|
399
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
400
|
+
var _a = entries_1[_i], child = _a.child, width = _a.width, height = _a.height, origin_1 = _a.origin;
|
|
401
|
+
// Vertical alignment: align top/bottom edges or centers correctly using origin
|
|
402
|
+
var y = 0;
|
|
403
|
+
if (this.align === 'top') {
|
|
404
|
+
// place child's top edge at content top
|
|
405
|
+
y = -maxHeight / 2 + origin_1.y * height;
|
|
406
|
+
}
|
|
407
|
+
else if (this.align === 'bottom') {
|
|
408
|
+
// place child's bottom edge at content bottom
|
|
409
|
+
y = maxHeight / 2 - (1 - origin_1.y) * height;
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
// center alignment
|
|
413
|
+
y = (origin_1.y - 0.5) * height;
|
|
414
|
+
}
|
|
415
|
+
// Horizontal position so that child's left is at cursorLeftX
|
|
416
|
+
var x = cursorLeftX + origin_1.x * width;
|
|
417
|
+
child.setPosition(x, y);
|
|
418
|
+
cursorLeftX += width + this.gap;
|
|
419
|
+
}
|
|
420
|
+
this.setSize(totalWidth, maxHeight);
|
|
421
|
+
};
|
|
422
|
+
/**
|
|
423
|
+
* Gets the display width of a game object
|
|
424
|
+
* @param child GameObject to measure
|
|
425
|
+
* @returns Display width in pixels
|
|
426
|
+
*/
|
|
427
|
+
Row.prototype.getDisplayWidth = function (child) {
|
|
428
|
+
return getDisplayWidthOf(child);
|
|
429
|
+
};
|
|
430
|
+
/**
|
|
431
|
+
* Gets the display height of a game object
|
|
432
|
+
* @param child GameObject to measure
|
|
433
|
+
* @returns Display height in pixels
|
|
434
|
+
*/
|
|
435
|
+
Row.prototype.getDisplayHeight = function (child) {
|
|
436
|
+
return getDisplayHeightOf(child);
|
|
437
|
+
};
|
|
438
|
+
/**
|
|
439
|
+
* Gets the normalized origin point of a game object
|
|
440
|
+
* @param child GameObject to get origin from
|
|
441
|
+
* @returns Object with normalized x,y coordinates of the origin point
|
|
442
|
+
*/
|
|
443
|
+
Row.prototype.getNormalizedOrigin = function (child) {
|
|
444
|
+
return getNormalizedOriginOf(child);
|
|
445
|
+
};
|
|
446
|
+
return Row;
|
|
447
|
+
}(phaser.GameObjects.Container));
|
|
448
|
+
|
|
64
449
|
/**
|
|
65
450
|
* Deep merge utility function that recursively merges objects
|
|
66
451
|
* Similar to lodash.merge but implemented natively
|
|
@@ -1199,10 +1584,13 @@
|
|
|
1199
1584
|
}(Phaser.Scene));
|
|
1200
1585
|
|
|
1201
1586
|
exports.Color = Color;
|
|
1587
|
+
exports.Column = Column;
|
|
1588
|
+
exports.DEFAULT_GAP = DEFAULT_GAP;
|
|
1202
1589
|
exports.FontSize = FontSize;
|
|
1203
1590
|
exports.PHASER_WIND_KEY = PHASER_WIND_KEY;
|
|
1204
1591
|
exports.PhaserWindPlugin = PhaserWindPlugin;
|
|
1205
1592
|
exports.Radius = Radius;
|
|
1593
|
+
exports.Row = Row;
|
|
1206
1594
|
exports.SceneWithPhaserWind = SceneWithPhaserWind;
|
|
1207
1595
|
exports.Shadow = Shadow;
|
|
1208
1596
|
exports.Spacing = Spacing;
|
|
@@ -1218,6 +1606,9 @@
|
|
|
1218
1606
|
exports.defaultShadowMap = defaultShadowMap;
|
|
1219
1607
|
exports.fontMap = fontMap;
|
|
1220
1608
|
exports.fontSizeMap = fontSizeMap;
|
|
1609
|
+
exports.getDisplayHeightOf = getDisplayHeightOf;
|
|
1610
|
+
exports.getDisplayWidthOf = getDisplayWidthOf;
|
|
1611
|
+
exports.getNormalizedOriginOf = getNormalizedOriginOf;
|
|
1221
1612
|
exports.isValidColor = isValidColor;
|
|
1222
1613
|
exports.merge = merge;
|
|
1223
1614
|
exports.mergeDeep = mergeDeep;
|
package/dist/phaser-wind.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("phaser")):"function"==typeof define&&define.amd?define(["exports","phaser"],n):n((r="undefined"!=typeof globalThis?globalThis:r||self).PhaserWind={},r.Phaser)}(this,function(r,n){"use strict";var t=function(r,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])},t(r,n)};function e(r,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var o=function(){return o=Object.assign||function(r){for(var n,t=1,e=arguments.length;t<e;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o]);return r},o.apply(this,arguments)};function a(r,n,t){if(t||2===arguments.length)for(var e,o=0,a=n.length;o<a;o++)!e&&o in n||(e||(e=Array.prototype.slice.call(n,0,o)),e[o]=n[o]);return r.concat(e||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var i=function(r){return null!==r&&"object"==typeof r&&!Array.isArray(r)&&"[object Object]"===Object.prototype.toString.call(r)},c=function(r){if(null===r||"object"!=typeof r)return r;if(Array.isArray(r))return r.map(function(r){return c(r)});if(i(r)){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=c(r[t]));return n}return r},g=function(r){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!i(r))return r;for(var e=c(r),o=0,a=n;o<a.length;o++){var b=a[o];if(i(b)){var u=c(b);for(var s in u)if(Object.prototype.hasOwnProperty.call(u,s)){var f=u[s],l=e[s];i(f)&&i(l)?e[s]=g(l,f):void 0!==f&&(e[s]=f)}}}return e},b=function(r){if("string"!=typeof r)return!1;var n=r.trim();return!!/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(n)||(!!/^rgb\(\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*\)$/.test(n)||(!!/^rgba\(\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*([01]|0?\.\d+)\s*\)$/.test(n)||!!/^oklch\(\s*(\d*\.?\d+%?)\s+(\d*\.?\d+)\s+(\d*\.?\d+)(?:\s*\/\s*([01]|0?\.\d+))?\s*\)$/.test(n)))},u={black:"#000",white:"#fff",slate:{50:"rgb(248, 250, 252)",100:"rgb(241, 245, 249)",200:"rgb(226, 232, 240)",300:"rgb(203, 213, 225)",400:"rgb(148, 163, 184)",500:"rgb(100, 116, 139)",600:"rgb(71, 85, 105)",700:"rgb(51, 65, 85)",800:"rgb(30, 41, 59)",900:"rgb(15, 23, 42)",950:"rgb(2, 6, 23)"},gray:{50:"rgb(249, 250, 251)",100:"rgb(243, 244, 246)",200:"rgb(229, 231, 235)",300:"rgb(209, 213, 219)",400:"rgb(156, 163, 175)",500:"rgb(107, 114, 128)",600:"rgb(75, 85, 99)",700:"rgb(55, 65, 81)",800:"rgb(31, 41, 55)",900:"rgb(17, 24, 39)",950:"rgb(3, 7, 18)"},zinc:{50:"rgb(250, 250, 250)",100:"rgb(244, 244, 245)",200:"rgb(228, 228, 231)",300:"rgb(212, 212, 216)",400:"rgb(161, 161, 170)",500:"rgb(113, 113, 122)",600:"rgb(82, 82, 91)",700:"rgb(63, 63, 70)",800:"rgb(39, 39, 42)",900:"rgb(24, 24, 27)",950:"rgb(9, 9, 11)"},neutral:{50:"rgb(250, 250, 250)",100:"rgb(245, 245, 245)",200:"rgb(229, 229, 229)",300:"rgb(212, 212, 212)",400:"rgb(163, 163, 163)",500:"rgb(115, 115, 115)",600:"rgb(82, 82, 82)",700:"rgb(64, 64, 64)",800:"rgb(38, 38, 38)",900:"rgb(23, 23, 23)",950:"rgb(10, 10, 10)"},stone:{50:"rgb(250, 250, 249)",100:"rgb(245, 245, 244)",200:"rgb(231, 229, 228)",300:"rgb(214, 211, 209)",400:"rgb(168, 162, 158)",500:"rgb(120, 113, 108)",600:"rgb(87, 83, 78)",700:"rgb(68, 64, 60)",800:"rgb(41, 37, 36)",900:"rgb(28, 25, 23)",950:"rgb(12, 10, 9)"},red:{50:"rgb(254, 242, 242)",100:"rgb(254, 226, 226)",200:"rgb(254, 202, 202)",300:"rgb(252, 165, 165)",400:"rgb(248, 113, 113)",500:"rgb(239, 68, 68)",600:"rgb(220, 38, 38)",700:"rgb(185, 28, 28)",800:"rgb(153, 27, 27)",900:"rgb(127, 29, 29)",950:"rgb(69, 10, 10)"},orange:{50:"rgb(255, 247, 237)",100:"rgb(255, 237, 213)",200:"rgb(254, 215, 170)",300:"rgb(253, 186, 116)",400:"rgb(251, 146, 60)",500:"rgb(249, 115, 22)",600:"rgb(234, 88, 12)",700:"rgb(194, 65, 12)",800:"rgb(154, 52, 18)",900:"rgb(124, 45, 18)",950:"rgb(67, 20, 7)"},amber:{50:"rgb(255, 251, 235)",100:"rgb(254, 243, 199)",200:"rgb(253, 230, 138)",300:"rgb(252, 211, 77)",400:"rgb(251, 191, 36)",500:"rgb(245, 158, 11)",600:"rgb(217, 119, 6)",700:"rgb(180, 83, 9)",800:"rgb(146, 64, 14)",900:"rgb(120, 53, 15)",950:"rgb(69, 26, 3)"},yellow:{50:"rgb(254, 252, 232)",100:"rgb(254, 249, 195)",200:"rgb(254, 240, 138)",300:"rgb(253, 224, 71)",400:"rgb(250, 204, 21)",500:"rgb(234, 179, 8)",600:"rgb(202, 138, 4)",700:"rgb(161, 98, 7)",800:"rgb(133, 77, 14)",900:"rgb(113, 63, 18)",950:"rgb(66, 32, 6)"},lime:{50:"rgb(247, 254, 231)",100:"rgb(236, 252, 203)",200:"rgb(217, 249, 157)",300:"rgb(190, 242, 100)",400:"rgb(163, 230, 53)",500:"rgb(132, 204, 22)",600:"rgb(101, 163, 13)",700:"rgb(77, 124, 15)",800:"rgb(63, 98, 18)",900:"rgb(54, 83, 20)",950:"rgb(26, 46, 5)"},green:{50:"rgb(240, 253, 244)",100:"rgb(220, 252, 231)",200:"rgb(187, 247, 208)",300:"rgb(134, 239, 172)",400:"rgb(74, 222, 128)",500:"rgb(34, 197, 94)",600:"rgb(22, 163, 74)",700:"rgb(21, 128, 61)",800:"rgb(22, 101, 52)",900:"rgb(20, 83, 45)",950:"rgb(5, 46, 22)"},emerald:{50:"rgb(236, 253, 245)",100:"rgb(209, 250, 229)",200:"rgb(167, 243, 208)",300:"rgb(110, 231, 183)",400:"rgb(52, 211, 153)",500:"rgb(16, 185, 129)",600:"rgb(5, 150, 105)",700:"rgb(4, 120, 87)",800:"rgb(6, 95, 70)",900:"rgb(6, 78, 59)",950:"rgb(2, 44, 34)"},teal:{50:"rgb(240, 253, 250)",100:"rgb(204, 251, 241)",200:"rgb(153, 246, 228)",300:"rgb(94, 234, 212)",400:"rgb(45, 212, 191)",500:"rgb(20, 184, 166)",600:"rgb(13, 148, 136)",700:"rgb(15, 118, 110)",800:"rgb(17, 94, 89)",900:"rgb(19, 78, 74)",950:"rgb(4, 47, 46)"},cyan:{50:"rgb(236, 254, 255)",100:"rgb(207, 250, 254)",200:"rgb(165, 243, 252)",300:"rgb(103, 232, 249)",400:"rgb(34, 211, 238)",500:"rgb(6, 182, 212)",600:"rgb(8, 145, 178)",700:"rgb(14, 116, 144)",800:"rgb(21, 94, 117)",900:"rgb(22, 78, 99)",950:"rgb(8, 51, 68)"},sky:{50:"rgb(240, 249, 255)",100:"rgb(224, 242, 254)",200:"rgb(186, 230, 253)",300:"rgb(125, 211, 252)",400:"rgb(56, 189, 248)",500:"rgb(14, 165, 233)",600:"rgb(2, 132, 199)",700:"rgb(3, 105, 161)",800:"rgb(7, 89, 133)",900:"rgb(12, 74, 110)",950:"rgb(8, 47, 73)"},blue:{50:"rgb(239, 246, 255)",100:"rgb(219, 234, 254)",200:"rgb(191, 219, 254)",300:"rgb(147, 197, 253)",400:"rgb(96, 165, 250)",500:"rgb(59, 130, 246)",600:"rgb(37, 99, 235)",700:"rgb(29, 78, 216)",800:"rgb(30, 64, 175)",900:"rgb(30, 58, 138)",950:"rgb(23, 37, 84)"},indigo:{50:"rgb(238, 242, 255)",100:"rgb(224, 231, 255)",200:"rgb(199, 210, 254)",300:"rgb(165, 180, 252)",400:"rgb(129, 140, 248)",500:"rgb(99, 102, 241)",600:"rgb(79, 70, 229)",700:"rgb(67, 56, 202)",800:"rgb(55, 48, 163)",900:"rgb(49, 46, 129)",950:"rgb(30, 27, 75)"},violet:{50:"rgb(245, 243, 255)",100:"rgb(237, 233, 254)",200:"rgb(221, 214, 254)",300:"rgb(196, 181, 253)",400:"rgb(167, 139, 250)",500:"rgb(139, 92, 246)",600:"rgb(124, 58, 237)",700:"rgb(109, 40, 217)",800:"rgb(91, 33, 182)",900:"rgb(76, 29, 149)",950:"rgb(46, 16, 101)"},purple:{50:"rgb(250, 245, 255)",100:"rgb(243, 232, 255)",200:"rgb(233, 213, 255)",300:"rgb(216, 180, 254)",400:"rgb(192, 132, 252)",500:"rgb(168, 85, 247)",600:"rgb(147, 51, 234)",700:"rgb(126, 34, 206)",800:"rgb(107, 33, 168)",900:"rgb(88, 28, 135)",950:"rgb(59, 7, 100)"},fuchsia:{50:"rgb(253, 244, 255)",100:"rgb(250, 232, 255)",200:"rgb(245, 208, 254)",300:"rgb(240, 171, 252)",400:"rgb(232, 121, 249)",500:"rgb(217, 70, 239)",600:"rgb(192, 38, 211)",700:"rgb(162, 28, 175)",800:"rgb(134, 25, 143)",900:"rgb(112, 26, 117)",950:"rgb(74, 4, 78)"},pink:{50:"rgb(253, 242, 248)",100:"rgb(252, 231, 243)",200:"rgb(251, 207, 232)",300:"rgb(249, 168, 212)",400:"rgb(244, 114, 182)",500:"rgb(236, 72, 153)",600:"rgb(219, 39, 119)",700:"rgb(190, 24, 93)",800:"rgb(157, 23, 77)",900:"rgb(131, 24, 67)",950:"rgb(80, 7, 36)"},rose:{50:"rgb(255, 241, 242)",100:"rgb(255, 228, 230)",200:"rgb(254, 205, 211)",300:"rgb(253, 164, 175)",400:"rgb(251, 113, 133)",500:"rgb(244, 63, 94)",600:"rgb(225, 29, 72)",700:"rgb(190, 18, 60)",800:"rgb(159, 18, 57)",900:"rgb(136, 19, 55)",950:"rgb(76, 5, 25)"}},s=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/,f=function(r){return r.startsWith("#")?3===(n=r.slice(1)).length?(parseInt(n[0]+n[0],16)<<16)+(parseInt(n[1]+n[1],16)<<8)+parseInt(n[2]+n[2],16):parseInt(n,16):function(r){var n=r.match(s);if(!n)throw new Error("Invalid RGB format: ".concat(r));return(parseInt(n[1])<<16)+(parseInt(n[2])<<8)+parseInt(n[3])}(r);var n},l=function(r){var n=function(n){return r&&n in r?r[n]:null},t=function(r){var e;if("string"==typeof r&&b(r))return r;var o=n(r);if(o)return t(o);var a=r.split("-");if(2===a.length){var i=a[0],c=a[1],g=null===(e=u[i])||void 0===e?void 0:e[c];if(!g){if(b(r))return r;throw new Error('Color token "'.concat(i,"-").concat(c,'" not found'))}return g}var s=u[r];if(!s){if(b(r))return r;throw new Error('Color token "'.concat(r,'" not found'))}return s},e=function(r){var t;if("string"==typeof r&&b(r))return f(r);var o=n(r);if(o)return e(o);var a=r.split("-");if(2===a.length){var i=a[0],c=a[1],g=null===(t=u[i])||void 0===t?void 0:t[c];if(!g){if(b(r))return f(r);throw new Error('Color token "'.concat(i,"-").concat(c,'" not found'))}return f(g)}var s=u[r];if(b(s))return f(s);throw new Error('Color token "'.concat(r,'" not found'))};return{rgb:t,hex:e,black:function(){return t("black")},white:function(){return t("white")},slate:function(r){return t("slate-".concat(r))},gray:function(r){return t("gray-".concat(r))},zinc:function(r){return t("zinc-".concat(r))},neutral:function(r){return t("neutral-".concat(r))},stone:function(r){return t("stone-".concat(r))},red:function(r){return t("red-".concat(r))},orange:function(r){return t("orange-".concat(r))},amber:function(r){return t("amber-".concat(r))},yellow:function(r){return t("yellow-".concat(r))},lime:function(r){return t("lime-".concat(r))},green:function(r){return t("green-".concat(r))},emerald:function(r){return t("emerald-".concat(r))},teal:function(r){return t("teal-".concat(r))},cyan:function(r){return t("cyan-".concat(r))},sky:function(r){return t("sky-".concat(r))},blue:function(r){return t("blue-".concat(r))},indigo:function(r){return t("indigo-".concat(r))},violet:function(r){return t("violet-".concat(r))},purple:function(r){return t("purple-".concat(r))},fuchsia:function(r){return t("fuchsia-".concat(r))},pink:function(r){return t("pink-".concat(r))},rose:function(r){return t("rose-".concat(r))},blackHex:function(){return e("black")},whiteHex:function(){return e("white")},slateHex:function(r){return e("slate-".concat(r))},grayHex:function(r){return e("gray-".concat(r))},zincHex:function(r){return e("zinc-".concat(r))},neutralHex:function(r){return e("neutral-".concat(r))},stoneHex:function(r){return e("stone-".concat(r))},redHex:function(r){return e("red-".concat(r))},orangeHex:function(r){return e("orange-".concat(r))},amberHex:function(r){return e("amber-".concat(r))},yellowHex:function(r){return e("yellow-".concat(r))},limeHex:function(r){return e("lime-".concat(r))},greenHex:function(r){return e("green-".concat(r))},emeraldHex:function(r){return e("emerald-".concat(r))},tealHex:function(r){return e("teal-".concat(r))},cyanHex:function(r){return e("cyan-".concat(r))},skyHex:function(r){return e("sky-".concat(r))},blueHex:function(r){return e("blue-".concat(r))},indigoHex:function(r){return e("indigo-".concat(r))},violetHex:function(r){return e("violet-".concat(r))},purpleHex:function(r){return e("purple-".concat(r))},fuchsiaHex:function(r){return e("fuchsia-".concat(r))},pinkHex:function(r){return e("pink-".concat(r))},roseHex:function(r){return e("rose-".concat(r))}}},p=l({}),h={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48,"6xl":60,"7xl":72,"8xl":96,"9xl":128},d=function(r){var n=o(o({},h),r);return{px:function(r){var t=n[r];return"number"==typeof t?t:0},rem:function(r){var t=n[r];return"number"==typeof t?t/16:0},css:function(r){var t=n[r];return"number"==typeof t?"".concat(t,"px"):"0px"}}},y=d(void 0),m={primary:"Inter, system-ui, sans-serif",secondary:"Roboto, Arial, sans-serif",monospace:"Fira Code, Consolas, monospace",display:"Poppins, Inter, sans-serif"},v=function(r,n){var t=o(o({},m),r),e=d(n),i=function(r){if(r.includes(".")){var n=r.split(".")[1];if(n&&"string"==typeof t[n])return t[n]}return"string"==typeof t[r]?t[r]:r};return{size:function(r){var n;return null!==(n=e.px(r))&&void 0!==n?n:0},format:function(r){var n,t=r.size,o=r.family,a=null!==(n=e.px(t))&&void 0!==n?n:0;return"".concat(a,"px '").concat(i(o),"'")},family:function(r){return i(r)},getAvailableFonts:function(){return Array.from(new Set(a(a([],Object.keys(m),!0),Object.keys(t),!0)))}}},x={none:0,sm:2,default:4,md:6,lg:8,xl:12,"2xl":16,"3xl":24,full:9999},w=function(r){var n=o(o({},x),r),t=function(r){return"number"==typeof n[r]?n[r]:0};return{px:function(r){return t(r)},rem:function(r){return t(r)/16},css:function(r){return"".concat(t(r),"px")}}},H=w(void 0),I={sm:{blur:2,offsetX:1,offsetY:1,alpha:.15},md:{blur:4,offsetX:2,offsetY:2,alpha:.2},lg:{blur:6,offsetX:4,offsetY:4,alpha:.25},xl:{blur:8,offsetX:6,offsetY:6,alpha:.3},"2xl":{blur:12,offsetX:8,offsetY:8,alpha:.35},inner:{blur:4,offsetX:-2,offsetY:-2,alpha:.2}},S=function(r){var n=o(o({},I),r);return{get:function(r){return function(r){var t=n[r];return t&&"object"==typeof t?t:I.md}(r)}}},k=S(void 0),z={0:0,px:1,.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,52:208,56:224,60:240,64:256,72:288,80:320,96:384},P=function(r){var n=o(o({},z),r),t=function(r){return"number"==typeof n[r]?n[r]:0};return{px:function(r){return t(r)},rem:function(r){return t(r)/16},css:function(r){return"".concat(t(r),"px")}}},j=P(void 0),O={fonts:{primary:"Inter, system-ui, sans-serif",secondary:"Roboto, Arial, sans-serif",monospace:"Fira Code, Consolas, monospace",display:"Poppins, Inter, sans-serif"},fontSizes:o({},h),colors:{primary:"blue-600",secondary:"gray-600",success:"green-500",warning:"yellow-500",error:"red-500",info:"blue-400",background:"white",text:"gray-900",shadow:"black",overlay:"black"},spacing:o({},z),typography:{heading:{fontSize:"2xl",fontFamily:"fonts.display",fontWeight:600,lineHeight:1.2},"heading-large":{fontSize:"4xl",fontFamily:"fonts.display",fontWeight:700,lineHeight:1.1},body:{fontSize:"base",fontFamily:"fonts.primary",fontWeight:400,lineHeight:1.5},caption:{fontSize:"sm",fontFamily:"fonts.primary",fontWeight:400,lineHeight:1.4}},effects:{"shadow-sm":{blur:2,offsetY:1,color:"colors.shadow",alpha:.05},"shadow-md":{blur:4,offsetY:2,color:"colors.shadow",alpha:.1},"shadow-lg":{blur:8,offsetY:4,color:"colors.shadow",alpha:.1}},custom:{}},F={fonts:{primary:"Inter, system-ui, sans-serif",secondary:"Roboto, Arial, sans-serif",monospace:"Fira Code, Consolas, monospace",display:"Poppins, Inter, sans-serif"},fontSizes:o({},h),radius:o({},x),colors:{primary:"blue-400",secondary:"gray-400",success:"green-400",warning:"yellow-400",error:"red-400",info:"blue-300",background:"gray-900",text:"white",shadow:"black",overlay:"black"},spacing:o({},z),typography:{heading:{fontSize:"2xl",fontFamily:"fonts.display",fontWeight:600,lineHeight:1.2},"heading-large":{fontSize:"4xl",fontFamily:"fonts.display",fontWeight:700,lineHeight:1.1},body:{fontSize:"base",fontFamily:"fonts.primary",fontWeight:400,lineHeight:1.5},caption:{fontSize:"sm",fontFamily:"fonts.primary",fontWeight:400,lineHeight:1.4}},effects:{"shadow-sm":{blur:2,offsetY:1,color:"colors.shadow",alpha:.1},"shadow-md":{blur:4,offsetY:2,color:"colors.shadow",alpha:.15},"shadow-lg":{blur:8,offsetY:4,color:"colors.shadow",alpha:.2}},custom:{}},A=function(r){function n(n){var t=r.call(this,n)||this;return t.colorInstance=null,t.fontSizeInstance=null,t.spacingInstance=null,t.radiusInstance=null,t.fontInstance=null,t.shadowInstance=null,t.theme=O,t}return e(n,r),n.prototype.init=function(r){var n=r.theme,t=r.darkMode,e=void 0!==t&&t;n?(this.theme=n,this.colorInstance=l(this.theme.colors),this.fontSizeInstance=d(this.theme.fontSizes),this.spacingInstance=P(this.theme.spacing),this.radiusInstance=w(this.theme.radius),this.fontInstance=v(this.theme.fonts,this.theme.fontSizes),this.shadowInstance=S(this.theme.effects)):this.theme=e?F:O},n.prototype.getTheme=function(){return this.theme},Object.defineProperty(n.prototype,"color",{get:function(){return this.colorInstance},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fontSize",{get:function(){return this.fontSizeInstance},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"spacing",{get:function(){return this.spacingInstance},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"radius",{get:function(){return this.radiusInstance},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"font",{get:function(){return this.fontInstance},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"shadow",{get:function(){return this.shadowInstance},enumerable:!1,configurable:!0}),n}(n.Plugins.BasePlugin),C=function(r){function n(n){return r.call(this,n)||this}return e(n,r),n}(Phaser.Scene);r.Color=p,r.FontSize=y,r.PHASER_WIND_KEY="pw",r.PhaserWindPlugin=A,r.Radius=H,r.SceneWithPhaserWind=C,r.Shadow=k,r.Spacing=j,r.createColor=l,r.createFont=v,r.createFontSize=d,r.createRadius=w,r.createShadow=S,r.createSpacing=P,r.createTheme=function(r){return g({},O,r)},r.defaultDarkTheme=F,r.defaultLightTheme=O,r.defaultShadowMap=I,r.fontMap=m,r.fontSizeMap=h,r.isValidColor=b,r.merge=g,r.mergeDeep=function(r){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return g.apply(void 0,a([{},r],n,!1))},r.palette=u,r.radiusMap=x,r.spacingMap=z});
|
|
1
|
+
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("phaser")):"function"==typeof define&&define.amd?define(["exports","phaser"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).PhaserWind={},r.Phaser)}(this,function(r,t){"use strict";var n=function(r,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])},n(r,t)};function e(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=r}n(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}var i=function(){return i=Object.assign||function(r){for(var t,n=1,e=arguments.length;n<e;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);return r},i.apply(this,arguments)};function o(r,t,n){if(n||2===arguments.length)for(var e,i=0,o=t.length;i<o;i++)!e&&i in t||(e||(e=Array.prototype.slice.call(t,0,i)),e[i]=t[i]);return r.concat(e||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var a=function(r){var t,n=r;if(r&&"object"==typeof r&&"list"in r&&Array.isArray(r.list)){if("number"==typeof n.displayWidth&&n.displayWidth>0)return n.displayWidth;if("number"==typeof n.width&&n.width>0)return n.width;var e=r;if("number"==typeof e.displayWidth&&e.displayWidth>0)return e.displayWidth;if("number"==typeof e.width&&e.width>0)return"number"==typeof e.scale&&e.scale>0?e.width/e.scale:e.width;for(var i=0,o=0,g=e.list;o<g.length;o++){var c=g[o],u=a(c);i=Math.max(i,u)}return i}if("number"==typeof n.displayWidth)return n.displayWidth;if("number"==typeof n.width)return n.width;var s=null===(t=n.getBounds)||void 0===t?void 0:t.call(n);return s?s.width:0},g=function(r){var t,n=r;if(r&&"object"==typeof r&&"list"in r&&Array.isArray(r.list)){if("number"==typeof n.displayHeight&&n.displayHeight>0)return n.displayHeight;if("number"==typeof n.height&&n.height>0)return n.height;var e=r;if("number"==typeof e.displayHeight&&e.displayHeight>0)return e.displayHeight;if("number"==typeof e.height&&e.height>0)return"number"==typeof e.scale&&e.scale>0?e.height/e.scale:e.height;for(var i=0,o=0,a=e.list;o<a.length;o++){var c=a[o],u=g(c);i=Math.max(i,u)}return i}if("number"==typeof n.displayHeight)return n.displayHeight;if("number"==typeof n.height)return n.height;var s=null===(t=n.getBounds)||void 0===t?void 0:t.call(n);return s?s.height:0},c=function(r){var t=a(r),n=g(r),e=r,i="number"==typeof e.originX?e.originX:void 0,o="number"==typeof e.originY?e.originY:void 0;return void 0===i&&"number"==typeof e.displayOriginX&&t>0&&(i=e.displayOriginX/t),void 0===o&&"number"==typeof e.displayOriginY&&n>0&&(o=e.displayOriginY/n),{x:null!=i?i:.5,y:null!=o?o:.5}},u=function(r){function t(t){var n=t.scene,e=t.x,i=t.y,o=t.gap,a=void 0===o?8:o,g=t.align,c=void 0===g?"center":g,u=t.children,s=void 0===u?[]:u,l=t.verticalOrigin,f=void 0===l?"center":l,b=r.call(this,n,e,i)||this;return b.gap=a,b.align=c,b.verticalOrigin=f,s.length>0&&b.add(s),b.layout(),b}return e(t,r),t.prototype.setGap=function(r){this.gap=r,this.layout()},t.prototype.setAlign=function(r){this.align=r,this.layout()},t.prototype.addChild=function(r,t){return void 0===t&&(t=!0),this.add(r),t&&this.layout(),this},t.prototype.addChildren=function(r,t){return void 0===t&&(t=!0),r.length>0&&this.add(r),t&&this.layout(),this},t.prototype.layout=function(){var r=this,t=this.list;if(0!==t.length){for(var n=t.map(function(t){return{child:t,width:r.getDisplayWidth(t),height:r.getDisplayHeight(t),origin:r.getNormalizedOrigin(t)}}),e=n.reduce(function(r,t){return Math.max(r,t.width)},0),i=n.reduce(function(r,t){return r+t.height},0)+this.gap*(n.length-1),o="top"===this.verticalOrigin?0:"center"===this.verticalOrigin?-i/2:-i,a=0,g=n;a<g.length;a++){var c=g[a],u=c.child,s=c.width,l=c.height,f=c.origin,b=0;b="left"===this.align?-e/2+f.x*s:"right"===this.align?e/2-(1-f.x)*s:(f.x-.5)*s;var h=o+f.y*l;u.setPosition(b,h),o+=l+this.gap}this.setSize(e,i)}else this.setSize(0,0)},t.prototype.getDisplayWidth=function(r){return a(r)},t.prototype.getDisplayHeight=function(r){return g(r)},t.prototype.getNormalizedOrigin=function(r){return c(r)},t}(t.GameObjects.Container),s=function(r){function t(t){var n=t.scene,e=t.x,i=t.y,o=t.gap,a=void 0===o?8:o,g=t.align,c=void 0===g?"center":g,u=t.children,s=void 0===u?[]:u,l=t.horizontalOrigin,f=void 0===l?"center":l,b=r.call(this,n,e,i)||this;return b.gap=a,b.align=c,b.horizontalOrigin=f,s.length>0&&b.add(s),b.layout(),b}return e(t,r),t.prototype.setGap=function(r){this.gap=r,this.layout()},t.prototype.setAlign=function(r){this.align=r,this.layout()},t.prototype.addChild=function(r,t){return void 0===t&&(t=!0),this.add(r),t&&this.layout(),this},t.prototype.addChildren=function(r,t){return void 0===t&&(t=!0),r.length>0&&this.add(r),t&&this.layout(),this},t.prototype.layout=function(){var r=this,t=this.list;if(0!==t.length){for(var n=t.map(function(t){return{child:t,width:r.getDisplayWidth(t),height:r.getDisplayHeight(t),origin:r.getNormalizedOrigin(t)}}),e=n.reduce(function(r,t){return Math.max(r,t.height)},0),i=n.reduce(function(r,t){return r+t.width},0)+this.gap*(n.length-1),o="left"===this.horizontalOrigin?0:"center"===this.horizontalOrigin?-i/2:-i,a=0,g=n;a<g.length;a++){var c=g[a],u=c.child,s=c.width,l=c.height,f=c.origin,b=0;b="top"===this.align?-e/2+f.y*l:"bottom"===this.align?e/2-(1-f.y)*l:(f.y-.5)*l;var h=o+f.x*s;u.setPosition(h,b),o+=s+this.gap}this.setSize(i,e)}else this.setSize(0,0)},t.prototype.getDisplayWidth=function(r){return a(r)},t.prototype.getDisplayHeight=function(r){return g(r)},t.prototype.getNormalizedOrigin=function(r){return c(r)},t}(t.GameObjects.Container),l=function(r){return null!==r&&"object"==typeof r&&!Array.isArray(r)&&"[object Object]"===Object.prototype.toString.call(r)},f=function(r){if(null===r||"object"!=typeof r)return r;if(Array.isArray(r))return r.map(function(r){return f(r)});if(l(r)){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=f(r[n]));return t}return r},b=function(r){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(!l(r))return r;for(var e=f(r),i=0,o=t;i<o.length;i++){var a=o[i];if(l(a)){var g=f(a);for(var c in g)if(Object.prototype.hasOwnProperty.call(g,c)){var u=g[c],s=e[c];l(u)&&l(s)?e[c]=b(s,u):void 0!==u&&(e[c]=u)}}}return e},h=function(r){if("string"!=typeof r)return!1;var t=r.trim();return!!/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(t)||(!!/^rgb\(\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*\)$/.test(t)||(!!/^rgba\(\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*([01]|0?\.\d+)\s*\)$/.test(t)||!!/^oklch\(\s*(\d*\.?\d+%?)\s+(\d*\.?\d+)\s+(\d*\.?\d+)(?:\s*\/\s*([01]|0?\.\d+))?\s*\)$/.test(t)))},p={black:"#000",white:"#fff",slate:{50:"rgb(248, 250, 252)",100:"rgb(241, 245, 249)",200:"rgb(226, 232, 240)",300:"rgb(203, 213, 225)",400:"rgb(148, 163, 184)",500:"rgb(100, 116, 139)",600:"rgb(71, 85, 105)",700:"rgb(51, 65, 85)",800:"rgb(30, 41, 59)",900:"rgb(15, 23, 42)",950:"rgb(2, 6, 23)"},gray:{50:"rgb(249, 250, 251)",100:"rgb(243, 244, 246)",200:"rgb(229, 231, 235)",300:"rgb(209, 213, 219)",400:"rgb(156, 163, 175)",500:"rgb(107, 114, 128)",600:"rgb(75, 85, 99)",700:"rgb(55, 65, 81)",800:"rgb(31, 41, 55)",900:"rgb(17, 24, 39)",950:"rgb(3, 7, 18)"},zinc:{50:"rgb(250, 250, 250)",100:"rgb(244, 244, 245)",200:"rgb(228, 228, 231)",300:"rgb(212, 212, 216)",400:"rgb(161, 161, 170)",500:"rgb(113, 113, 122)",600:"rgb(82, 82, 91)",700:"rgb(63, 63, 70)",800:"rgb(39, 39, 42)",900:"rgb(24, 24, 27)",950:"rgb(9, 9, 11)"},neutral:{50:"rgb(250, 250, 250)",100:"rgb(245, 245, 245)",200:"rgb(229, 229, 229)",300:"rgb(212, 212, 212)",400:"rgb(163, 163, 163)",500:"rgb(115, 115, 115)",600:"rgb(82, 82, 82)",700:"rgb(64, 64, 64)",800:"rgb(38, 38, 38)",900:"rgb(23, 23, 23)",950:"rgb(10, 10, 10)"},stone:{50:"rgb(250, 250, 249)",100:"rgb(245, 245, 244)",200:"rgb(231, 229, 228)",300:"rgb(214, 211, 209)",400:"rgb(168, 162, 158)",500:"rgb(120, 113, 108)",600:"rgb(87, 83, 78)",700:"rgb(68, 64, 60)",800:"rgb(41, 37, 36)",900:"rgb(28, 25, 23)",950:"rgb(12, 10, 9)"},red:{50:"rgb(254, 242, 242)",100:"rgb(254, 226, 226)",200:"rgb(254, 202, 202)",300:"rgb(252, 165, 165)",400:"rgb(248, 113, 113)",500:"rgb(239, 68, 68)",600:"rgb(220, 38, 38)",700:"rgb(185, 28, 28)",800:"rgb(153, 27, 27)",900:"rgb(127, 29, 29)",950:"rgb(69, 10, 10)"},orange:{50:"rgb(255, 247, 237)",100:"rgb(255, 237, 213)",200:"rgb(254, 215, 170)",300:"rgb(253, 186, 116)",400:"rgb(251, 146, 60)",500:"rgb(249, 115, 22)",600:"rgb(234, 88, 12)",700:"rgb(194, 65, 12)",800:"rgb(154, 52, 18)",900:"rgb(124, 45, 18)",950:"rgb(67, 20, 7)"},amber:{50:"rgb(255, 251, 235)",100:"rgb(254, 243, 199)",200:"rgb(253, 230, 138)",300:"rgb(252, 211, 77)",400:"rgb(251, 191, 36)",500:"rgb(245, 158, 11)",600:"rgb(217, 119, 6)",700:"rgb(180, 83, 9)",800:"rgb(146, 64, 14)",900:"rgb(120, 53, 15)",950:"rgb(69, 26, 3)"},yellow:{50:"rgb(254, 252, 232)",100:"rgb(254, 249, 195)",200:"rgb(254, 240, 138)",300:"rgb(253, 224, 71)",400:"rgb(250, 204, 21)",500:"rgb(234, 179, 8)",600:"rgb(202, 138, 4)",700:"rgb(161, 98, 7)",800:"rgb(133, 77, 14)",900:"rgb(113, 63, 18)",950:"rgb(66, 32, 6)"},lime:{50:"rgb(247, 254, 231)",100:"rgb(236, 252, 203)",200:"rgb(217, 249, 157)",300:"rgb(190, 242, 100)",400:"rgb(163, 230, 53)",500:"rgb(132, 204, 22)",600:"rgb(101, 163, 13)",700:"rgb(77, 124, 15)",800:"rgb(63, 98, 18)",900:"rgb(54, 83, 20)",950:"rgb(26, 46, 5)"},green:{50:"rgb(240, 253, 244)",100:"rgb(220, 252, 231)",200:"rgb(187, 247, 208)",300:"rgb(134, 239, 172)",400:"rgb(74, 222, 128)",500:"rgb(34, 197, 94)",600:"rgb(22, 163, 74)",700:"rgb(21, 128, 61)",800:"rgb(22, 101, 52)",900:"rgb(20, 83, 45)",950:"rgb(5, 46, 22)"},emerald:{50:"rgb(236, 253, 245)",100:"rgb(209, 250, 229)",200:"rgb(167, 243, 208)",300:"rgb(110, 231, 183)",400:"rgb(52, 211, 153)",500:"rgb(16, 185, 129)",600:"rgb(5, 150, 105)",700:"rgb(4, 120, 87)",800:"rgb(6, 95, 70)",900:"rgb(6, 78, 59)",950:"rgb(2, 44, 34)"},teal:{50:"rgb(240, 253, 250)",100:"rgb(204, 251, 241)",200:"rgb(153, 246, 228)",300:"rgb(94, 234, 212)",400:"rgb(45, 212, 191)",500:"rgb(20, 184, 166)",600:"rgb(13, 148, 136)",700:"rgb(15, 118, 110)",800:"rgb(17, 94, 89)",900:"rgb(19, 78, 74)",950:"rgb(4, 47, 46)"},cyan:{50:"rgb(236, 254, 255)",100:"rgb(207, 250, 254)",200:"rgb(165, 243, 252)",300:"rgb(103, 232, 249)",400:"rgb(34, 211, 238)",500:"rgb(6, 182, 212)",600:"rgb(8, 145, 178)",700:"rgb(14, 116, 144)",800:"rgb(21, 94, 117)",900:"rgb(22, 78, 99)",950:"rgb(8, 51, 68)"},sky:{50:"rgb(240, 249, 255)",100:"rgb(224, 242, 254)",200:"rgb(186, 230, 253)",300:"rgb(125, 211, 252)",400:"rgb(56, 189, 248)",500:"rgb(14, 165, 233)",600:"rgb(2, 132, 199)",700:"rgb(3, 105, 161)",800:"rgb(7, 89, 133)",900:"rgb(12, 74, 110)",950:"rgb(8, 47, 73)"},blue:{50:"rgb(239, 246, 255)",100:"rgb(219, 234, 254)",200:"rgb(191, 219, 254)",300:"rgb(147, 197, 253)",400:"rgb(96, 165, 250)",500:"rgb(59, 130, 246)",600:"rgb(37, 99, 235)",700:"rgb(29, 78, 216)",800:"rgb(30, 64, 175)",900:"rgb(30, 58, 138)",950:"rgb(23, 37, 84)"},indigo:{50:"rgb(238, 242, 255)",100:"rgb(224, 231, 255)",200:"rgb(199, 210, 254)",300:"rgb(165, 180, 252)",400:"rgb(129, 140, 248)",500:"rgb(99, 102, 241)",600:"rgb(79, 70, 229)",700:"rgb(67, 56, 202)",800:"rgb(55, 48, 163)",900:"rgb(49, 46, 129)",950:"rgb(30, 27, 75)"},violet:{50:"rgb(245, 243, 255)",100:"rgb(237, 233, 254)",200:"rgb(221, 214, 254)",300:"rgb(196, 181, 253)",400:"rgb(167, 139, 250)",500:"rgb(139, 92, 246)",600:"rgb(124, 58, 237)",700:"rgb(109, 40, 217)",800:"rgb(91, 33, 182)",900:"rgb(76, 29, 149)",950:"rgb(46, 16, 101)"},purple:{50:"rgb(250, 245, 255)",100:"rgb(243, 232, 255)",200:"rgb(233, 213, 255)",300:"rgb(216, 180, 254)",400:"rgb(192, 132, 252)",500:"rgb(168, 85, 247)",600:"rgb(147, 51, 234)",700:"rgb(126, 34, 206)",800:"rgb(107, 33, 168)",900:"rgb(88, 28, 135)",950:"rgb(59, 7, 100)"},fuchsia:{50:"rgb(253, 244, 255)",100:"rgb(250, 232, 255)",200:"rgb(245, 208, 254)",300:"rgb(240, 171, 252)",400:"rgb(232, 121, 249)",500:"rgb(217, 70, 239)",600:"rgb(192, 38, 211)",700:"rgb(162, 28, 175)",800:"rgb(134, 25, 143)",900:"rgb(112, 26, 117)",950:"rgb(74, 4, 78)"},pink:{50:"rgb(253, 242, 248)",100:"rgb(252, 231, 243)",200:"rgb(251, 207, 232)",300:"rgb(249, 168, 212)",400:"rgb(244, 114, 182)",500:"rgb(236, 72, 153)",600:"rgb(219, 39, 119)",700:"rgb(190, 24, 93)",800:"rgb(157, 23, 77)",900:"rgb(131, 24, 67)",950:"rgb(80, 7, 36)"},rose:{50:"rgb(255, 241, 242)",100:"rgb(255, 228, 230)",200:"rgb(254, 205, 211)",300:"rgb(253, 164, 175)",400:"rgb(251, 113, 133)",500:"rgb(244, 63, 94)",600:"rgb(225, 29, 72)",700:"rgb(190, 18, 60)",800:"rgb(159, 18, 57)",900:"rgb(136, 19, 55)",950:"rgb(76, 5, 25)"}},d=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/,y=function(r){return r.startsWith("#")?3===(t=r.slice(1)).length?(parseInt(t[0]+t[0],16)<<16)+(parseInt(t[1]+t[1],16)<<8)+parseInt(t[2]+t[2],16):parseInt(t,16):function(r){var t=r.match(d);if(!t)throw new Error("Invalid RGB format: ".concat(r));return(parseInt(t[1])<<16)+(parseInt(t[2])<<8)+parseInt(t[3])}(r);var t},m=function(r){var t=function(t){return r&&t in r?r[t]:null},n=function(r){var e;if("string"==typeof r&&h(r))return r;var i=t(r);if(i)return n(i);var o=r.split("-");if(2===o.length){var a=o[0],g=o[1],c=null===(e=p[a])||void 0===e?void 0:e[g];if(!c){if(h(r))return r;throw new Error('Color token "'.concat(a,"-").concat(g,'" not found'))}return c}var u=p[r];if(!u){if(h(r))return r;throw new Error('Color token "'.concat(r,'" not found'))}return u},e=function(r){var n;if("string"==typeof r&&h(r))return y(r);var i=t(r);if(i)return e(i);var o=r.split("-");if(2===o.length){var a=o[0],g=o[1],c=null===(n=p[a])||void 0===n?void 0:n[g];if(!c){if(h(r))return y(r);throw new Error('Color token "'.concat(a,"-").concat(g,'" not found'))}return y(c)}var u=p[r];if(h(u))return y(u);throw new Error('Color token "'.concat(r,'" not found'))};return{rgb:n,hex:e,black:function(){return n("black")},white:function(){return n("white")},slate:function(r){return n("slate-".concat(r))},gray:function(r){return n("gray-".concat(r))},zinc:function(r){return n("zinc-".concat(r))},neutral:function(r){return n("neutral-".concat(r))},stone:function(r){return n("stone-".concat(r))},red:function(r){return n("red-".concat(r))},orange:function(r){return n("orange-".concat(r))},amber:function(r){return n("amber-".concat(r))},yellow:function(r){return n("yellow-".concat(r))},lime:function(r){return n("lime-".concat(r))},green:function(r){return n("green-".concat(r))},emerald:function(r){return n("emerald-".concat(r))},teal:function(r){return n("teal-".concat(r))},cyan:function(r){return n("cyan-".concat(r))},sky:function(r){return n("sky-".concat(r))},blue:function(r){return n("blue-".concat(r))},indigo:function(r){return n("indigo-".concat(r))},violet:function(r){return n("violet-".concat(r))},purple:function(r){return n("purple-".concat(r))},fuchsia:function(r){return n("fuchsia-".concat(r))},pink:function(r){return n("pink-".concat(r))},rose:function(r){return n("rose-".concat(r))},blackHex:function(){return e("black")},whiteHex:function(){return e("white")},slateHex:function(r){return e("slate-".concat(r))},grayHex:function(r){return e("gray-".concat(r))},zincHex:function(r){return e("zinc-".concat(r))},neutralHex:function(r){return e("neutral-".concat(r))},stoneHex:function(r){return e("stone-".concat(r))},redHex:function(r){return e("red-".concat(r))},orangeHex:function(r){return e("orange-".concat(r))},amberHex:function(r){return e("amber-".concat(r))},yellowHex:function(r){return e("yellow-".concat(r))},limeHex:function(r){return e("lime-".concat(r))},greenHex:function(r){return e("green-".concat(r))},emeraldHex:function(r){return e("emerald-".concat(r))},tealHex:function(r){return e("teal-".concat(r))},cyanHex:function(r){return e("cyan-".concat(r))},skyHex:function(r){return e("sky-".concat(r))},blueHex:function(r){return e("blue-".concat(r))},indigoHex:function(r){return e("indigo-".concat(r))},violetHex:function(r){return e("violet-".concat(r))},purpleHex:function(r){return e("purple-".concat(r))},fuchsiaHex:function(r){return e("fuchsia-".concat(r))},pinkHex:function(r){return e("pink-".concat(r))},roseHex:function(r){return e("rose-".concat(r))}}},v=m({}),w={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48,"6xl":60,"7xl":72,"8xl":96,"9xl":128},x=function(r){var t=i(i({},w),r);return{px:function(r){var n=t[r];return"number"==typeof n?n:0},rem:function(r){var n=t[r];return"number"==typeof n?n/16:0},css:function(r){var n=t[r];return"number"==typeof n?"".concat(n,"px"):"0px"}}},H=x(void 0),O={primary:"Inter, system-ui, sans-serif",secondary:"Roboto, Arial, sans-serif",monospace:"Fira Code, Consolas, monospace",display:"Poppins, Inter, sans-serif"},z=function(r,t){var n=i(i({},O),r),e=x(t),a=function(r){if(r.includes(".")){var t=r.split(".")[1];if(t&&"string"==typeof n[t])return n[t]}return"string"==typeof n[r]?n[r]:r};return{size:function(r){var t;return null!==(t=e.px(r))&&void 0!==t?t:0},format:function(r){var t,n=r.size,i=r.family,o=null!==(t=e.px(n))&&void 0!==t?t:0;return"".concat(o,"px '").concat(a(i),"'")},family:function(r){return a(r)},getAvailableFonts:function(){return Array.from(new Set(o(o([],Object.keys(O),!0),Object.keys(n),!0)))}}},S={none:0,sm:2,default:4,md:6,lg:8,xl:12,"2xl":16,"3xl":24,full:9999},I=function(r){var t=i(i({},S),r),n=function(r){return"number"==typeof t[r]?t[r]:0};return{px:function(r){return n(r)},rem:function(r){return n(r)/16},css:function(r){return"".concat(n(r),"px")}}},k=I(void 0),W={sm:{blur:2,offsetX:1,offsetY:1,alpha:.15},md:{blur:4,offsetX:2,offsetY:2,alpha:.2},lg:{blur:6,offsetX:4,offsetY:4,alpha:.25},xl:{blur:8,offsetX:6,offsetY:6,alpha:.3},"2xl":{blur:12,offsetX:8,offsetY:8,alpha:.35},inner:{blur:4,offsetX:-2,offsetY:-2,alpha:.2}},j=function(r){var t=i(i({},W),r);return{get:function(r){return function(r){var n=t[r];return n&&"object"==typeof n?n:W.md}(r)}}},P=j(void 0),A={0:0,px:1,.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,52:208,56:224,60:240,64:256,72:288,80:320,96:384},C=function(r){var t=i(i({},A),r),n=function(r){return"number"==typeof t[r]?t[r]:0};return{px:function(r){return n(r)},rem:function(r){return n(r)/16},css:function(r){return"".concat(n(r),"px")}}},F=C(void 0),Y={fonts:{primary:"Inter, system-ui, sans-serif",secondary:"Roboto, Arial, sans-serif",monospace:"Fira Code, Consolas, monospace",display:"Poppins, Inter, sans-serif"},fontSizes:i({},w),colors:{primary:"blue-600",secondary:"gray-600",success:"green-500",warning:"yellow-500",error:"red-500",info:"blue-400",background:"white",text:"gray-900",shadow:"black",overlay:"black"},spacing:i({},A),typography:{heading:{fontSize:"2xl",fontFamily:"fonts.display",fontWeight:600,lineHeight:1.2},"heading-large":{fontSize:"4xl",fontFamily:"fonts.display",fontWeight:700,lineHeight:1.1},body:{fontSize:"base",fontFamily:"fonts.primary",fontWeight:400,lineHeight:1.5},caption:{fontSize:"sm",fontFamily:"fonts.primary",fontWeight:400,lineHeight:1.4}},effects:{"shadow-sm":{blur:2,offsetY:1,color:"colors.shadow",alpha:.05},"shadow-md":{blur:4,offsetY:2,color:"colors.shadow",alpha:.1},"shadow-lg":{blur:8,offsetY:4,color:"colors.shadow",alpha:.1}},custom:{}},D={fonts:{primary:"Inter, system-ui, sans-serif",secondary:"Roboto, Arial, sans-serif",monospace:"Fira Code, Consolas, monospace",display:"Poppins, Inter, sans-serif"},fontSizes:i({},w),radius:i({},S),colors:{primary:"blue-400",secondary:"gray-400",success:"green-400",warning:"yellow-400",error:"red-400",info:"blue-300",background:"gray-900",text:"white",shadow:"black",overlay:"black"},spacing:i({},A),typography:{heading:{fontSize:"2xl",fontFamily:"fonts.display",fontWeight:600,lineHeight:1.2},"heading-large":{fontSize:"4xl",fontFamily:"fonts.display",fontWeight:700,lineHeight:1.1},body:{fontSize:"base",fontFamily:"fonts.primary",fontWeight:400,lineHeight:1.5},caption:{fontSize:"sm",fontFamily:"fonts.primary",fontWeight:400,lineHeight:1.4}},effects:{"shadow-sm":{blur:2,offsetY:1,color:"colors.shadow",alpha:.1},"shadow-md":{blur:4,offsetY:2,color:"colors.shadow",alpha:.15},"shadow-lg":{blur:8,offsetY:4,color:"colors.shadow",alpha:.2}},custom:{}},E=function(r){function t(t){var n=r.call(this,t)||this;return n.colorInstance=null,n.fontSizeInstance=null,n.spacingInstance=null,n.radiusInstance=null,n.fontInstance=null,n.shadowInstance=null,n.theme=Y,n}return e(t,r),t.prototype.init=function(r){var t=r.theme,n=r.darkMode,e=void 0!==n&&n;t?(this.theme=t,this.colorInstance=m(this.theme.colors),this.fontSizeInstance=x(this.theme.fontSizes),this.spacingInstance=C(this.theme.spacing),this.radiusInstance=I(this.theme.radius),this.fontInstance=z(this.theme.fonts,this.theme.fontSizes),this.shadowInstance=j(this.theme.effects)):this.theme=e?D:Y},t.prototype.getTheme=function(){return this.theme},Object.defineProperty(t.prototype,"color",{get:function(){return this.colorInstance},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this.fontSizeInstance},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spacing",{get:function(){return this.spacingInstance},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this.radiusInstance},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"font",{get:function(){return this.fontInstance},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadow",{get:function(){return this.shadowInstance},enumerable:!1,configurable:!0}),t}(t.Plugins.BasePlugin),_=function(r){function t(t){return r.call(this,t)||this}return e(t,r),t}(Phaser.Scene);r.Color=v,r.Column=u,r.DEFAULT_GAP=8,r.FontSize=H,r.PHASER_WIND_KEY="pw",r.PhaserWindPlugin=E,r.Radius=k,r.Row=s,r.SceneWithPhaserWind=_,r.Shadow=P,r.Spacing=F,r.createColor=m,r.createFont=z,r.createFontSize=x,r.createRadius=I,r.createShadow=j,r.createSpacing=C,r.createTheme=function(r){return b({},Y,r)},r.defaultDarkTheme=D,r.defaultLightTheme=Y,r.defaultShadowMap=W,r.fontMap=O,r.fontSizeMap=w,r.getDisplayHeightOf=g,r.getDisplayWidthOf=a,r.getNormalizedOriginOf=c,r.isValidColor=h,r.merge=b,r.mergeDeep=function(r){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return b.apply(void 0,o([{},r],t,!1))},r.palette=p,r.radiusMap=S,r.spacingMap=A});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Global mock for Phaser in tests
|
|
2
|
+
import { vi } from 'vitest';
|
|
3
|
+
// Mock Phaser globally
|
|
4
|
+
vi.mock('phaser', () => {
|
|
5
|
+
class Scene {
|
|
6
|
+
}
|
|
7
|
+
class Container {
|
|
8
|
+
list = [];
|
|
9
|
+
x;
|
|
10
|
+
y;
|
|
11
|
+
width = 0;
|
|
12
|
+
height = 0;
|
|
13
|
+
constructor(_scene, x, y) {
|
|
14
|
+
this.x = x;
|
|
15
|
+
this.y = y;
|
|
16
|
+
}
|
|
17
|
+
add(child) {
|
|
18
|
+
if (Array.isArray(child)) {
|
|
19
|
+
this.list.push(...child);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.list.push(child);
|
|
23
|
+
}
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
setSize(width, height) {
|
|
27
|
+
this.width = width;
|
|
28
|
+
this.height = height;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const GameObjects = { Container };
|
|
33
|
+
return { GameObjects, Scene };
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=test-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.js","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B,uBAAuB;AACvB,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;IACrB,MAAM,KAAK;KAAI;IAIf,MAAM,SAAS;QACN,IAAI,GAAc,EAAE,CAAC;QACrB,CAAC,CAAS;QACV,CAAC,CAAS;QACV,KAAK,GAAG,CAAC,CAAC;QACV,MAAM,GAAG,CAAC,CAAC;QAElB,YAAY,MAAa,EAAE,CAAS,EAAE,CAAS;YAC7C,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;QAED,GAAG,CAAC,KAAoC;YACtC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACxB,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,CAAC,KAAa,EAAE,MAAc;YACnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;KACF;IAED,MAAM,WAAW,GAAG,EAAE,SAAS,EAAW,CAAC;IAC3C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAChC,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column.d.ts","sourceRoot":"","sources":["../../src/components/column.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column.js","sourceRoot":"","sources":["../../src/components/column.ts"],"names":[],"mappings":""}
|