hudini 0.13.2 → 0.14.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 CHANGED
@@ -1,4 +1,11 @@
1
- <img src="data/hudini.png" style="max-width: 500px" alt="hudini" />
1
+ <p align="center">
2
+ <img src="data/hudini.png" style="max-width: 500px" alt="hudini" />
3
+ </p>
4
+
5
+ [![NPM Version](https://img.shields.io/npm/v/phaser-wind)](https://www.npmjs.com/package/phaser-wind)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
8
+
2
9
 
3
10
  # 🎩 Hudini
4
11
 
@@ -195,6 +202,41 @@ Notes:
195
202
  - Hover scales the icon subtly, click animates press/release.
196
203
  - Colors and sizes integrate with `phaser-wind` theme tokens.
197
204
 
205
+ ### SizedBox
206
+
207
+ A simple invisible rectangle component for spacing and layout purposes. It occupies space without any visual appearance.
208
+
209
+ ```ts
210
+ import { SizedBox } from 'hudini';
211
+ // inside a Phaser.Scene (e.g., in create())
212
+
213
+ const spacer = new SizedBox({
214
+ scene: this,
215
+ x: 0,
216
+ y: 0,
217
+ width: 0, // horizontal spacing
218
+ height: 20, // vertical spacing
219
+ });
220
+
221
+ // Use in layouts for precise spacing control
222
+ const column = new Column({
223
+ scene: this,
224
+ x: 400,
225
+ y: 300,
226
+ children: [
227
+ new TextButton({ scene: this, x: 0, y: 0, text: 'Button 1' }),
228
+ new SizedBox({ scene: this, x: 0, y: 0, width: 0, height: 20 }),
229
+ new TextButton({ scene: this, x: 0, y: 0, text: 'Button 2' }),
230
+ ]
231
+ });
232
+ ```
233
+
234
+ Notes:
235
+
236
+ - Extends `Phaser.GameObjects.Rectangle` for native width/height support.
237
+ - Default values: `width: 1px`, `height: 1px` if not specified.
238
+ - Perfect for creating custom spacing in layouts where gap isn't sufficient.
239
+
198
240
  ## 📦 API Surfaces
199
241
 
200
242
  - `Column` and `Row` are `Phaser.GameObjects.Container` subclasses. Useful methods:
@@ -203,6 +245,10 @@ Notes:
203
245
  - `addChild(child, relayout = true): this`
204
246
  - `addChildren(children, relayout = true): this`
205
247
  - `IconButton` constructor accepts `{ scene, x, y, icon, size?, color?, onClick? }`.
248
+ - `SizedBox` extends `Phaser.GameObjects.Rectangle`. Useful methods:
249
+ - `setWidth(width: number): this`
250
+ - `setHeight(height: number): this`
251
+ - `setSize(width: number, height: number): this`
206
252
 
207
253
  ## 🔗 Storybook
208
254
 
@@ -7,5 +7,6 @@ export * from './linear-progress';
7
7
  export * from './radial-progress';
8
8
  export * from './row';
9
9
  export * from './section-header';
10
+ export * from './sized-box';
10
11
  export * from './text-button';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -7,5 +7,6 @@ export * from './linear-progress';
7
7
  export * from './radial-progress';
8
8
  export * from './row';
9
9
  export * from './section-header';
10
+ export * from './sized-box';
10
11
  export * from './text-button';
11
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './sized-box';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/sized-box/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './sized-box';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/sized-box/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { GameObjects, Scene } from 'phaser';
2
+ /**
3
+ * Parameters for creating a SizedBox.
4
+ */
5
+ export type SizedBoxParams = {
6
+ /** Phaser scene where the SizedBox will be added. */
7
+ scene: Scene;
8
+ /** X position of the SizedBox. */
9
+ x: number;
10
+ /** Y position of the SizedBox. */
11
+ y: number;
12
+ /** Width of the SizedBox in pixels. If not provided, defaults to 1px. */
13
+ width?: number;
14
+ /** Height of the SizedBox in pixels. If not provided, defaults to 1px. */
15
+ height?: number;
16
+ };
17
+ /**
18
+ * SizedBox is a simple invisible rectangle component that can be used for spacing
19
+ * and layout purposes. It has no visual appearance but occupies space.
20
+ */
21
+ export declare class SizedBox extends GameObjects.Rectangle {
22
+ /**
23
+ * Creates a new SizedBox instance.
24
+ * @param params SizedBoxParams
25
+ */
26
+ constructor({ scene, x, y, width, height }: SizedBoxParams);
27
+ /**
28
+ * Sets the width of the SizedBox.
29
+ * @param width New width in pixels.
30
+ * @returns This SizedBox instance.
31
+ */
32
+ setWidth(width: number): this;
33
+ /**
34
+ * Sets the height of the SizedBox.
35
+ * @param height New height in pixels.
36
+ * @returns This SizedBox instance.
37
+ */
38
+ setHeight(height: number): this;
39
+ /**
40
+ * Sets both width and height of the SizedBox.
41
+ * @param width New width in pixels.
42
+ * @param height New height in pixels.
43
+ * @returns This SizedBox instance.
44
+ */
45
+ setSize(width: number, height: number): this;
46
+ }
47
+ //# sourceMappingURL=sized-box.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sized-box.d.ts","sourceRoot":"","sources":["../../../src/components/sized-box/sized-box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,qDAAqD;IACrD,KAAK,EAAE,KAAK,CAAC;IACb,kCAAkC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,kCAAkC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,qBAAa,QAAS,SAAQ,WAAW,CAAC,SAAS;IACjD;;;OAGG;gBACS,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,KAAS,EAAE,MAAU,EAAE,EAAE,cAAc;IAalE;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKpC;;;;OAIG;IACI,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAKtC;;;;;OAKG;IACa,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAK7D"}
@@ -0,0 +1,51 @@
1
+ import { GameObjects } from 'phaser';
2
+ /**
3
+ * SizedBox is a simple invisible rectangle component that can be used for spacing
4
+ * and layout purposes. It has no visual appearance but occupies space.
5
+ */
6
+ export class SizedBox extends GameObjects.Rectangle {
7
+ /**
8
+ * Creates a new SizedBox instance.
9
+ * @param params SizedBoxParams
10
+ */
11
+ constructor({ scene, x, y, width = 1, height = 1 }) {
12
+ // Validate that at least one dimension is provided
13
+ if (width === undefined && height === undefined) {
14
+ throw new Error('SizedBox must have at least width or height specified');
15
+ }
16
+ const finalWidth = width ?? 1;
17
+ const finalHeight = height ?? 1;
18
+ // Create invisible rectangle (no fill, no stroke)
19
+ super(scene, x, y, finalWidth, finalHeight, 0x000000, 0);
20
+ }
21
+ /**
22
+ * Sets the width of the SizedBox.
23
+ * @param width New width in pixels.
24
+ * @returns This SizedBox instance.
25
+ */
26
+ setWidth(width) {
27
+ this.width = width;
28
+ return this;
29
+ }
30
+ /**
31
+ * Sets the height of the SizedBox.
32
+ * @param height New height in pixels.
33
+ * @returns This SizedBox instance.
34
+ */
35
+ setHeight(height) {
36
+ this.height = height;
37
+ return this;
38
+ }
39
+ /**
40
+ * Sets both width and height of the SizedBox.
41
+ * @param width New width in pixels.
42
+ * @param height New height in pixels.
43
+ * @returns This SizedBox instance.
44
+ */
45
+ setSize(width, height) {
46
+ this.width = width;
47
+ this.height = height;
48
+ return this;
49
+ }
50
+ }
51
+ //# sourceMappingURL=sized-box.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sized-box.js","sourceRoot":"","sources":["../../../src/components/sized-box/sized-box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAS,MAAM,QAAQ,CAAC;AAkB5C;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW,CAAC,SAAS;IACjD;;;OAGG;IACH,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAkB;QAChE,mDAAmD;QACnD,IAAI,KAAK,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QAC3E,CAAC;QAED,MAAM,UAAU,GAAG,KAAK,IAAI,CAAC,CAAC;QAC9B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,CAAC;QAEhC,kDAAkD;QAClD,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,KAAa;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,MAAc;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACa,OAAO,CAAC,KAAa,EAAE,MAAc;QACnD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hudini",
3
- "version": "0.13.2",
3
+ "version": "0.14.0",
4
4
  "description": "🎩 Magical Phaser UI components - Reusable HUD elements for game development. Is magic, like a wizard",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "phaser-wind": "0.6.0",
61
- "font-awesome-for-phaser": "0.6.0"
61
+ "font-awesome-for-phaser": "0.7.0"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "phaser": "*"