hudini 0.17.0 → 0.17.2

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 (62) hide show
  1. package/README.md +34 -0
  2. package/dist/components/card/card.d.ts +9 -0
  3. package/dist/components/card/card.d.ts.map +1 -1
  4. package/dist/components/card/card.js +44 -8
  5. package/dist/components/card/card.js.map +1 -1
  6. package/dist/components/card/card.spec.js +2 -7
  7. package/dist/components/card/card.spec.js.map +1 -1
  8. package/dist/components/circular-progress/circular-progress.d.ts +1 -1
  9. package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
  10. package/dist/components/circular-progress/circular-progress.js +11 -2
  11. package/dist/components/circular-progress/circular-progress.js.map +1 -1
  12. package/dist/components/index.d.ts +3 -2
  13. package/dist/components/index.d.ts.map +1 -1
  14. package/dist/components/index.js +3 -2
  15. package/dist/components/index.js.map +1 -1
  16. package/dist/components/panel/index.d.ts +2 -0
  17. package/dist/components/panel/index.d.ts.map +1 -0
  18. package/dist/components/panel/index.js +2 -0
  19. package/dist/components/panel/index.js.map +1 -0
  20. package/dist/components/panel/panel.d.ts.map +1 -1
  21. package/dist/components/panel/panel.js +5 -2
  22. package/dist/components/panel/panel.js.map +1 -1
  23. package/dist/components/text-button/text-button.d.ts.map +1 -1
  24. package/dist/components/text-button/text-button.js +1 -1
  25. package/dist/components/text-button/text-button.js.map +1 -1
  26. package/dist/hudini.js +1078 -839
  27. package/dist/hudini.min.js +1 -1
  28. package/dist/test-setup.js +31 -2
  29. package/dist/test-setup.js.map +1 -1
  30. package/package.json +2 -2
  31. package/dist/components/column/column.d.ts +0 -88
  32. package/dist/components/column/column.d.ts.map +0 -1
  33. package/dist/components/column/column.js +0 -143
  34. package/dist/components/column/column.js.map +0 -1
  35. package/dist/components/column/column.spec.d.ts +0 -2
  36. package/dist/components/column/column.spec.d.ts.map +0 -1
  37. package/dist/components/column/column.spec.js +0 -114
  38. package/dist/components/column/column.spec.js.map +0 -1
  39. package/dist/components/column/index.d.ts +0 -2
  40. package/dist/components/column/index.d.ts.map +0 -1
  41. package/dist/components/column/index.js +0 -2
  42. package/dist/components/column/index.js.map +0 -1
  43. package/dist/components/layout/layout-utils.d.ts +0 -13
  44. package/dist/components/layout/layout-utils.d.ts.map +0 -1
  45. package/dist/components/layout/layout-utils.js +0 -96
  46. package/dist/components/layout/layout-utils.js.map +0 -1
  47. package/dist/components/layout/layout-utils.spec.d.ts +0 -2
  48. package/dist/components/layout/layout-utils.spec.d.ts.map +0 -1
  49. package/dist/components/layout/layout-utils.spec.js +0 -70
  50. package/dist/components/layout/layout-utils.spec.js.map +0 -1
  51. package/dist/components/row/index.d.ts +0 -2
  52. package/dist/components/row/index.d.ts.map +0 -1
  53. package/dist/components/row/index.js +0 -2
  54. package/dist/components/row/index.js.map +0 -1
  55. package/dist/components/row/row.d.ts +0 -87
  56. package/dist/components/row/row.d.ts.map +0 -1
  57. package/dist/components/row/row.js +0 -146
  58. package/dist/components/row/row.js.map +0 -1
  59. package/dist/components/row/row.spec.d.ts +0 -2
  60. package/dist/components/row/row.spec.d.ts.map +0 -1
  61. package/dist/components/row/row.spec.js +0 -114
  62. package/dist/components/row/row.spec.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  // Global mock for Phaser in tests
2
2
  import { vi } from 'vitest';
3
- // Mock Phaser globally
3
+ // Mock Phaser globally first (must be before phaser-wind mock)
4
4
  vi.mock('phaser', () => {
5
5
  class Scene {
6
6
  }
@@ -30,6 +30,35 @@ vi.mock('phaser', () => {
30
30
  }
31
31
  }
32
32
  const GameObjects = { Container };
33
- return { GameObjects, Scene };
33
+ return { GameObjects, Scene, default: { GameObjects, Scene } };
34
+ });
35
+ // Mock phaser-wind globally (after Phaser mock)
36
+ vi.mock('phaser-wind', () => {
37
+ return {
38
+ Color: {
39
+ rgb: vi.fn((color) => `rgb-${color}`),
40
+ hex: vi.fn((color) => `hex-${color}`),
41
+ },
42
+ getDisplayWidthOf: vi.fn((child) => {
43
+ if (typeof child.displayWidth === 'number')
44
+ return child.displayWidth;
45
+ if (typeof child.width === 'number')
46
+ return child.width;
47
+ const bounds = child.getBounds?.();
48
+ return bounds ? bounds.width : 0;
49
+ }),
50
+ getDisplayHeightOf: vi.fn((child) => {
51
+ if (typeof child.displayHeight === 'number')
52
+ return child.displayHeight;
53
+ if (typeof child.height === 'number')
54
+ return child.height;
55
+ const bounds = child.getBounds?.();
56
+ return bounds ? bounds.height : 0;
57
+ }),
58
+ PhaserWindPlugin: class PhaserWindPlugin {
59
+ },
60
+ SceneWithPhaserWind: class SceneWithPhaserWind {
61
+ },
62
+ };
34
63
  });
35
64
  //# sourceMappingURL=test-setup.js.map
@@ -1 +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,OAA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AC,CAAC,CAAC;QACpC,CAAC,CAAC;QACF,gBAAgB,EAAE,MAAM,gBAAgB;SAAI;QAC5C,mBAAmB,EAAE,MAAM,mBAAmB;SAAI;KACnD,CAAC;AACJ,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hudini",
3
- "version": "0.17.0",
3
+ "version": "0.17.2",
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",
@@ -62,7 +62,7 @@
62
62
  "vitest": "^3.2.4"
63
63
  },
64
64
  "dependencies": {
65
- "phaser-wind": "0.7.0",
65
+ "phaser-wind": "0.8.0",
66
66
  "font-awesome-for-phaser": "0.9.0"
67
67
  },
68
68
  "peerDependencies": {
@@ -1,88 +0,0 @@
1
- import { GameObjects, Scene } from 'phaser';
2
- /** Horizontal alignment options for column items */
3
- export type HorizontalAlign = 'left' | 'center' | 'right';
4
- /** Parameters for creating a Column container */
5
- export type ColumnParams = {
6
- /** The scene this column belongs to */
7
- scene: Scene;
8
- /** X coordinate of the column */
9
- x: number;
10
- /** Y coordinate of the column */
11
- y: number;
12
- /** Gap between elements in pixels */
13
- gap?: number;
14
- /** Horizontal alignment of elements */
15
- align?: HorizontalAlign;
16
- /** Initial child elements */
17
- children?: GameObjects.GameObject[];
18
- /** Vertical origin point of the column */
19
- verticalOrigin?: 'top' | 'center' | 'bottom';
20
- };
21
- /**
22
- * Column is a layout container that stacks children vertically with a gap.
23
- * The container position (x, y) represents the center of the whole column.
24
- */
25
- export declare class Column extends GameObjects.Container {
26
- /** Gap between elements in pixels */
27
- private gap;
28
- /** Horizontal alignment of elements */
29
- private align;
30
- /** Vertical origin point of the column */
31
- private verticalOrigin;
32
- /**
33
- * Creates a new Column container
34
- * @param params Configuration parameters for the column
35
- */
36
- constructor({ scene, x, y, gap, align, children, verticalOrigin, }: ColumnParams);
37
- /**
38
- * Sets the spacing between children and relayouts
39
- * @param gap Gap in pixels between elements
40
- */
41
- setGap(gap: number): void;
42
- /**
43
- * Sets the horizontal alignment and relayouts
44
- * @param align New horizontal alignment
45
- */
46
- setAlign(align: HorizontalAlign): void;
47
- /**
48
- * Adds a child game object to the column
49
- * @param child Game object to add
50
- * @param relayout Whether to relayout after adding (default: true)
51
- * @returns This column instance for chaining
52
- */
53
- addChild(child: GameObjects.GameObject, relayout?: boolean): this;
54
- /**
55
- * Adds multiple children to the column
56
- * @param children Array of game objects to add
57
- * @param relayout Whether to relayout after adding (default: true)
58
- * @returns This column instance for chaining
59
- */
60
- addChildren(children: GameObjects.GameObject[], relayout?: boolean): this;
61
- /**
62
- * Recomputes children's positions and updates this container size
63
- * Positions are calculated based on alignment, origins and gaps
64
- */
65
- layout(): void;
66
- /**
67
- * Gets the display width of a game object
68
- * @param child GameObject to measure
69
- * @returns Display width in pixels
70
- */
71
- getDisplayWidth(child: GameObjects.GameObject): number;
72
- /**
73
- * Gets the display height of a game object
74
- * @param child GameObject to measure
75
- * @returns Display height in pixels
76
- */
77
- getDisplayHeight(child: GameObjects.GameObject): number;
78
- /**
79
- * Gets the normalized origin point of a game object
80
- * @param child GameObject to get origin from
81
- * @returns Object with normalized x,y coordinates of the origin point
82
- */
83
- getNormalizedOrigin(child: GameObjects.GameObject): {
84
- x: number;
85
- y: number;
86
- };
87
- }
88
- //# sourceMappingURL=column.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"column.d.ts","sourceRoot":"","sources":["../../../src/components/column/column.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAS5C,oDAAoD;AACpD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1D,iDAAiD;AACjD,MAAM,MAAM,YAAY,GAAG;IACzB,uCAAuC;IACvC,KAAK,EAAE,KAAK,CAAC;IACb,iCAAiC;IACjC,CAAC,EAAE,MA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GAAG;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;CAGpF"}
@@ -1,143 +0,0 @@
1
- /* eslint-disable max-lines-per-function */
2
- /* eslint-disable complexity */
3
- import { GameObjects } from 'phaser';
4
- import { DEFAULT_GAP, getDisplayHeightOf, getDisplayWidthOf, getNormalizedOriginOf, } from '../layout/layout-utils';
5
- /**
6
- * Column is a layout container that stacks children vertically with a gap.
7
- * The container position (x, y) represents the center of the whole column.
8
- */
9
- export class Column extends GameObjects.Container {
10
- /** Gap between elements in pixels */
11
- gap;
12
- /** Horizontal alignment of elements */
13
- align;
14
- /** Vertical origin point of the column */
15
- verticalOrigin;
16
- /**
17
- * Creates a new Column container
18
- * @param params Configuration parameters for the column
19
- */
20
- constructor({ scene, x, y, gap = DEFAULT_GAP, align = 'center', children = [], verticalOrigin = 'center', }) {
21
- super(scene, x, y);
22
- this.gap = gap;
23
- this.align = align;
24
- this.verticalOrigin = verticalOrigin;
25
- if (children.length > 0) {
26
- this.add(children);
27
- }
28
- this.layout();
29
- }
30
- /**
31
- * Sets the spacing between children and relayouts
32
- * @param gap Gap in pixels between elements
33
- */
34
- setGap(gap) {
35
- this.gap = gap;
36
- this.layout();
37
- }
38
- /**
39
- * Sets the horizontal alignment and relayouts
40
- * @param align New horizontal alignment
41
- */
42
- setAlign(align) {
43
- this.align = align;
44
- this.layout();
45
- }
46
- /**
47
- * Adds a child game object to the column
48
- * @param child Game object to add
49
- * @param relayout Whether to relayout after adding (default: true)
50
- * @returns This column instance for chaining
51
- */
52
- addChild(child, relayout = true) {
53
- this.add(child);
54
- if (relayout)
55
- this.layout();
56
- return this;
57
- }
58
- /**
59
- * Adds multiple children to the column
60
- * @param children Array of game objects to add
61
- * @param relayout Whether to relayout after adding (default: true)
62
- * @returns This column instance for chaining
63
- */
64
- addChildren(children, relayout = true) {
65
- if (children.length > 0)
66
- this.add(children);
67
- if (relayout)
68
- this.layout();
69
- return this;
70
- }
71
- /**
72
- * Recomputes children's positions and updates this container size
73
- * Positions are calculated based on alignment, origins and gaps
74
- */
75
- layout() {
76
- const children = this.list;
77
- if (children.length === 0) {
78
- // Reset size when empty
79
- this.setSize(0, 0);
80
- return;
81
- }
82
- // Measure sizes and origins
83
- const entries = children.map((child) => ({
84
- child,
85
- width: this.getDisplayWidth(child),
86
- height: this.getDisplayHeight(child),
87
- origin: this.getNormalizedOrigin(child),
88
- }));
89
- const maxWidth = entries.reduce((m, s) => Math.max(m, s.width), 0);
90
- const totalHeight = entries.reduce((sum, s) => sum + s.height, 0) + this.gap * (entries.length - 1);
91
- // Determine top of content based on verticalOrigin
92
- const contentTopY = this.verticalOrigin === 'top' ? 0 : this.verticalOrigin === 'center' ? -totalHeight / 2 : -totalHeight;
93
- // Walk from top to bottom, aligning considering each child's origin
94
- let cursorTopY = contentTopY;
95
- for (const { child, width, height, origin } of entries) {
96
- // Horizontal alignment: align left/right edges or centers correctly using origin
97
- let x = 0;
98
- if (this.align === 'left') {
99
- // place child's left edge at content left
100
- x = -maxWidth / 2 + origin.x * width;
101
- }
102
- else if (this.align === 'right') {
103
- // place child's right edge at content right
104
- x = maxWidth / 2 - (1 - origin.x) * width;
105
- }
106
- else {
107
- // center alignment: center of child at 0 accounting for origin
108
- x = (origin.x - 0.5) * width;
109
- }
110
- // Vertical position so that child's top is at cursorTopY
111
- const y = cursorTopY + origin.y * height;
112
- child.setPosition(x, y);
113
- cursorTopY += height + this.gap;
114
- }
115
- // Update this container size to match content bounds
116
- this.setSize(maxWidth, totalHeight);
117
- }
118
- /**
119
- * Gets the display width of a game object
120
- * @param child GameObject to measure
121
- * @returns Display width in pixels
122
- */
123
- getDisplayWidth(child) {
124
- return getDisplayWidthOf(child);
125
- }
126
- /**
127
- * Gets the display height of a game object
128
- * @param child GameObject to measure
129
- * @returns Display height in pixels
130
- */
131
- getDisplayHeight(child) {
132
- return getDisplayHeightOf(child);
133
- }
134
- /**
135
- * Gets the normalized origin point of a game object
136
- * @param child GameObject to get origin from
137
- * @returns Object with normalized x,y coordinates of the origin point
138
- */
139
- getNormalizedOrigin(child) {
140
- return getNormalizedOriginOf(child);
141
- }
142
- }
143
- //# sourceMappingURL=column.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"column.js","sourceRoot":"","sources":["../../../src/components/column/column.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,+BAA+B;AAC/B,OAAO,EAAE,WAAW,EAAS,MAAM,QAAQ,CAAC;AAE5C,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAuBhC;;;GAGG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW,CAAC,SAAS;IAC/C,qCAAqC;IAC7B,GAAG,CAAS;IACpB,uCAAuC;IAC/B,KAAK,CAAkB;IAC/B,0CAA0C;IAClC,cAAc,CAA8B;IAEpD;;;OAGG;IACH,YAAY,EACV,KAAK,EACL,CAAC,EACD,CAAC,EACD,GAAG,GAAG,WAAW,EACjB,KAAK,GAAG,QAAQ,EAChB,QAAQ,GAAG,EAAE,EACb,cAAc,GAAG,QAAQ,GACZ;QACb,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAEnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,GAAW;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAC,KAAsB;QAC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AAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAExF,UAAU,IAAI,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC;QAClC,CAAC;QAED,qDAAqD;QACrD,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,eAAe,CAAC,KAA6B;QAClD,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,gBAAgB,CAAC,KAA6B;QACnD,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,KAA6B;QACtD,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=column.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"column.spec.d.ts","sourceRoot":"","sources":["../../../src/components/column/column.spec.ts"],"names":[],"mappings":""}
@@ -1,114 +0,0 @@
1
- /* eslint-disable no-magic-numbers */
2
- /* eslint-disable max-lines-per-function */
3
- import { Scene } from 'phaser';
4
- import { beforeEach, describe, expect, it } from 'vitest';
5
- import { Column } from './column';
6
- class TestChild {
7
- displayWidth;
8
- width;
9
- displayHeight;
10
- height;
11
- originX;
12
- originY;
13
- displayOriginX;
14
- displayOriginY;
15
- lastPosition = null;
16
- constructor(params = {}) {
17
- Object.assign(this, params);
18
- }
19
- setPosition(x, y) {
20
- this.lastPosition = { x, y };
21
- }
22
- getBounds() {
23
- return {
24
- width: this.width ?? this.displayWidth ?? 0,
25
- height: this.height ?? this.displayHeight ?? 0,
26
- };
27
- }
28
- }
29
- let scene;
30
- beforeEach(() => {
31
- scene = new Scene();
32
- });
33
- describe('Column layout', () => {
34
- it('centers children by default with verticalOrigin top', () => {
35
- const a = new TestChild({ displayWidth: 100, displayHeight: 50 });
36
- const b = new TestChild({ displayWidth: 200, displayHeight: 100 });
37
- const col = new Column({ scene, x: 0, y: 0, gap: 10, align: 'center', verticalOrigin: 'top', children: [] });
38
- col.addChildren([a, b]);
39
- // After construction or addition, layout is applied
40
- expect(a.lastPosition).toEqual({ x: 0, y: 25 }); // 0 + 0.5*50
41
- expect(b.lastPosition).toEqual({ x: 0, y: 110 }); // (50 + 10) + 0.5*100
42
- // width = max child width; height = sum + gaps
43
- // maxWidth = 200; totalHeight = 50 + 100 + 10 = 160
44
- expect(col.width).toBe(200);
45
- expect(col.height).toBe(160);
46
- });
47
- it('align left positions children at content left edge', () => {
48
- const a = new TestChild({ displayWidth: 100, displayHeight: 50 });
49
- const b = new TestChild({ displayWidth: 200, displayHeight: 100 });
50
- const col = new Column({ scene, x: 0, y: 0, gap: 10, align: 'left', verticalOrigin: 'top', children: [a, b] });
51
- // maxWidth = 200
52
- expect(a.lastPosition?.x).toBe(-50); // -maxWidth/2 + 0.5*100 = -100 + 50
53
- expect(b.lastPosition?.x).toBe(0); // -100 + 0.5*200 = 0
54
- expect(col.width).toBe(200);
55
- expect(col.height).toBe(160);
56
- });
57
- it('align right positions children at content right edge', () => {
58
- const a = new TestChild({ displayWidth: 100, displayHeight: 50 });
59
- const b = new TestChild({ displayWidth: 200, displayHeight: 100 });
60
- new Column({ scene, x: 0, y: 0, gap: 10, align: 'right', verticalOrigin: 'top', children: [a, b] });
61
- expect(a.lastPosition?.x).toBe(50); // +maxWidth/2 - (1-0.5)*100 = 100 - 50
62
- expect(b.lastPosition?.x).toBe(0); // 100 - (1-0.5)*200 = 0
63
- });
64
- it('verticalOrigin center shifts content up by half height', () => {
65
- const a = new TestChild({ displayWidth: 100, displayHeight: 50 });
66
- const b = new TestChild({ displayWidth: 200, displayHeight: 100 });
67
- // totalHeight = 50 + 100 + 10 = 160; top starts at -80
68
- new Column({ scene, x: 0, y: 0, gap: 10, align: 'center', verticalOrigin: 'center', children: [a, b] });
69
- expect(a.lastPosition?.y).toBe(-80 + 0.5 * 50); // -55
70
- expect(b.lastPosition?.y).toBe(-80 + 50 + 10 + 0.5 * 100); // -80 + 60 + 50 = 30
71
- });
72
- it('respects per-child origin when computing alignment and positions', () => {
73
- const a = new TestChild({ displayWidth: 100, displayHeight: 50, originX: 0.0, originY: 0.0 });
74
- const b = new TestChild({ displayWidth: 200, displayHeight: 100, originX: 1.0, originY: 1.0 });
75
- // maxWidth = 200; totalHeight = 160; top = 0 (verticalOrigin top)
76
- new Column({ scene, x: 0, y: 0, gap: 10, align: 'left', verticalOrigin: 'top', children: [a, b] });
77
- // a: x = -100 + 0*100 = -100; y = 0 + 0*50 = 0
78
- expect(a.lastPosition).toEqual({ x: -100, y: 0 });
79
- // cursor = 50 + 10 = 60; b: x = -100 + 1*200 = 100; y = 60 + 1*100 = 160
80
- expect(b.lastPosition).toEqual({ x: 100, y: 160 });
81
- });
82
- it('setGap and setAlign trigger relayout', () => {
83
- const a = new TestChild({ displayWidth: 100, displayHeight: 50 });
84
- const b = new TestChild({ displayWidth: 200, displayHeight: 100 });
85
- const col = new Column({ scene, x: 0, y: 0, verticalOrigin: 'top', children: [a, b] }); // default gap=8, align=center, verticalOrigin=top
86
- // Initial state with gap=8
87
- expect(b.lastPosition?.y).toBe(50 + 8 + 50); // 108
88
- col.setGap(20); // changes layout
89
- expect(b.lastPosition?.y).toBe(50 + 20 + 50); // 120
90
- col.setAlign('left');
91
- // maxWidth=200 => a.x = -100 + 0.5*100 = -50; b.x = -100 + 0.5*200 = 0
92
- expect(a.lastPosition?.x).toBe(-50);
93
- expect(b.lastPosition?.x).toBe(0);
94
- });
95
- it('addChild/addChildren optionally avoid relayout when requested', () => {
96
- const a = new TestChild({ displayWidth: 100, displayHeight: 50 });
97
- const b = new TestChild({ displayWidth: 200, displayHeight: 100 });
98
- const col = new Column({ scene, x: 0, y: 0, children: [a] });
99
- // b added without relayout
100
- col.addChild(b, false);
101
- const before = b.lastPosition;
102
- expect(before).toBeNull();
103
- // When calling layout, positions are calculated
104
- col.layout();
105
- expect(b.lastPosition).not.toBeNull();
106
- });
107
- it('empty column has size 0,0', () => {
108
- const col = new Column({ scene, x: 0, y: 0, children: [] });
109
- // After constructor, layout runs and sizes to 0,0
110
- expect(col.width).toBe(0);
111
- expect(col.height).toBe(0);
112
- });
113
- });
114
- //# sourceMappingURL=column.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"column.spec.js","sourceRoot":"","sources":["../../../src/components/column/column.spec.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,2CAA2C;AAC3C,OAAO,EAAe,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,SAAS;IACN,YAAY,CAAU;IACtB,KAAK,CAAU;IACf,aAAa,CAAU;IACvB,MAAM,CAAU;IAChB,OAAO,CAAU;IACjB,OAAO,CAAU;IACjB,cAAc,CAAU;IACxB,cAAc,CAAU;IAExB,YAAY,GAAoC,IAAI,CAAC;IAE5D,YAAY,SAYR,EAAE;QACJ,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,WAAW,CAAC,CAAS,EAAE,CAAS;QAC9B,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC/B,CAAC;IAED,SAAS;QACP,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC;YAC3C,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC;SAC/C,CAAC;IACJ,CAAC;CACF;AAED,IAAI,KAAY,CAAC;AAEjB,UAAU,CAAC,GAAG,EAAE;IACd,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;AACtB,CAAC,CAAC,CAAC;AAEH,QAAQ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EAAE,CAAC;QAE1B,gDAAgD;QAChD,GAAG,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAyC,EAAE,CAAC,CAAC;QACnG,kDAAkD;QAClD,MAAM,CAAE,GAAoC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5D,MAAM,CAAE,GAAqC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './column';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/column/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './column';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/column/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,13 +0,0 @@
1
- import { GameObjects } from 'phaser';
2
- /** Default gap between elements in pixels */
3
- export declare const DEFAULT_GAP = 8;
4
- /** Measures the display width of a game object, with fallbacks */
5
- export declare const getDisplayWidthOf: (child: GameObjects.GameObject) => number;
6
- /** Measures the display height of a game object, with fallbacks */
7
- export declare const getDisplayHeightOf: (child: GameObjects.GameObject) => number;
8
- /** Returns normalized origin (0..1) for a game object */
9
- export declare const getNormalizedOriginOf: (child: GameObjects.GameObject) => {
10
- x: number;
11
- y: number;
12
- };
13
- //# sourceMappingURL=layout-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout-utils.d.ts","sourceRoot":"","sources":["../../../src/components/layout/layout-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,6CAA6C;AAC7C,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B,kEAAkE;AAClE,eAAO,MAAM,iBAAiB,GAAI,OAAO,WAAW,CAAC,UAAU,KAAG,MA0CjE,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,GAAI,OAAO,WAAW,CAAC,UAAU,KAAG,MA0ClE,CAAC;AAEF,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,GAChC,OAAO,WAAW,CAAC,UAAU,KAC5B;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAgCxB,CAAC"}
@@ -1,96 +0,0 @@
1
- /** Default gap between elements in pixels */
2
- export const DEFAULT_GAP = 8;
3
- /** Measures the display width of a game object, with fallbacks */
4
- export const getDisplayWidthOf = (child) => {
5
- const childTyped = child;
6
- // Check if it's a Container-like object (has list property and width/height)
7
- if (child && typeof child === 'object' && 'list' in child && Array.isArray(child.list)) {
8
- if (typeof childTyped.displayWidth === 'number' && childTyped.displayWidth > 0) {
9
- return childTyped.displayWidth;
10
- }
11
- if (typeof childTyped.width === 'number' && childTyped.width > 0) {
12
- return childTyped.width;
13
- }
14
- const container = child;
15
- if (typeof container.displayWidth === 'number' && container.displayWidth > 0) {
16
- return container.displayWidth;
17
- }
18
- if (typeof container.width === 'number' && container.width > 0) {
19
- if (typeof container.scale === 'number' && container.scale > 0) {
20
- return container.width / container.scale;
21
- }
22
- return container.width;
23
- }
24
- let w = 0;
25
- for (const sub of container.list) {
26
- const size = getDisplayWidthOf(sub);
27
- w = Math.max(w, size);
28
- }
29
- return w;
30
- }
31
- if (typeof childTyped.displayWidth === 'number') {
32
- return childTyped.displayWidth;
33
- }
34
- if (typeof childTyped.width === 'number') {
35
- return childTyped.width;
36
- }
37
- const bounds = childTyped.getBounds?.();
38
- return bounds ? bounds.width : 0;
39
- };
40
- /** Measures the display height of a game object, with fallbacks */
41
- export const getDisplayHeightOf = (child) => {
42
- const childTyped = child;
43
- // Check if it's a Container-like object (has list property and width/height)
44
- if (child && typeof child === 'object' && 'list' in child && Array.isArray(child.list)) {
45
- if (typeof childTyped.displayHeight === 'number' && childTyped.displayHeight > 0) {
46
- return childTyped.displayHeight;
47
- }
48
- if (typeof childTyped.height === 'number' && childTyped.height > 0) {
49
- return childTyped.height;
50
- }
51
- const container = child;
52
- if (typeof container.displayHeight === 'number' && container.displayHeight > 0) {
53
- return container.displayHeight;
54
- }
55
- if (typeof container.height === 'number' && container.height > 0) {
56
- if (typeof container.scale === 'number' && container.scale > 0) {
57
- return container.height / container.scale;
58
- }
59
- return container.height;
60
- }
61
- let h = 0;
62
- for (const sub of container.list) {
63
- const size = getDisplayHeightOf(sub);
64
- h = Math.max(h, size);
65
- }
66
- return h;
67
- }
68
- if (typeof childTyped.displayHeight === 'number') {
69
- return childTyped.displayHeight;
70
- }
71
- if (typeof childTyped.height === 'number') {
72
- return childTyped.height;
73
- }
74
- const bounds = childTyped.getBounds?.();
75
- return bounds ? bounds.height : 0;
76
- };
77
- /** Returns normalized origin (0..1) for a game object */
78
- export const getNormalizedOriginOf = (child) => {
79
- const width = getDisplayWidthOf(child);
80
- const height = getDisplayHeightOf(child);
81
- const childTyped = child;
82
- let ox = typeof childTyped.originX === 'number' ? childTyped.originX : undefined;
83
- let oy = typeof childTyped.originY === 'number' ? childTyped.originY : undefined;
84
- if (ox === undefined &&
85
- typeof childTyped.displayOriginX === 'number' &&
86
- width > 0) {
87
- ox = childTyped.displayOriginX / width;
88
- }
89
- if (oy === undefined &&
90
- typeof childTyped.displayOriginY === 'number' &&
91
- height > 0) {
92
- oy = childTyped.displayOriginY / height;
93
- }
94
- return { x: ox ?? 0.5, y: oy ?? 0.5 };
95
- };
96
- //# sourceMappingURL=layout-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout-utils.js","sourceRoot":"","sources":["../../../src/components/layout/layout-utils.ts"],"names":[],"mappings":"AAIA,6CAA6C;AAC7C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B,kEAAkE;AAClE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAU,EAAE;IACzE,MAAM,UAAU,GAAG,KAIlB,CAAC;IACF,6EAA6E;IAC7E,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,CAAE,KAAwC,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3H,IAAI,OAAO,UAAU,CAAC,YAAY,KAAK,QAAQ,IAAI,UAAU,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;YAC/E,OAAO,UAAU,CAAC,YAAY,CAAC;QACjC,CAAC;QAED,IAAI,OAAO,UAAU,CAAC,KAAK,KAAK,QAAQ,IAAI,UAAU,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;YACjE,OAAO,UAAU,CAAC,KAAK,CAAC;QAC1B,CAAC;QAED,MAAM,SAAS,GAAG,KAA8F,CAAC;QACjH,IAAI,OAAO,SAAS,CAAC,YAAY,KAAK,QAAQ,IAAI,SAAS,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;YAC7E,OAAO,SAAS,CAAC,YAAY,CAAC;QAChC,CAAC;QAED,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;YAC/D,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;gBAC/D,OAAO,SAAS,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;YAC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qB,GAAG,CACnC,KAA6B,EACH,EAAE;IAC5B,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAEzC,MAAM,UAAU,GAAG,KAKlB,CAAC;IAEF,IAAI,EAAE,GACJ,OAAO,UAAU,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1E,IAAI,EAAE,GACJ,OAAO,UAAU,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAE1E,IACE,EAAE,KAAK,SAAS;QAChB,OAAO,UAAU,CAAC,cAAc,KAAK,QAAQ;QAC7C,KAAK,GAAG,CAAC,EACT,CAAC;QACD,EAAE,GAAG,UAAU,CAAC,cAAc,GAAG,KAAK,CAAC;IACzC,CAAC;IACD,IACE,EAAE,KAAK,SAAS;QAChB,OAAO,UAAU,CAAC,cAAc,KAAK,QAAQ;QAC7C,MAAM,GAAG,CAAC,EACV,CAAC;QACD,EAAE,GAAG,UAAU,CAAC,cAAc,GAAG,MAAM,CAAC;IAC1C,CAAC;IAED,OAAO,EAAE,CAAC,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC;AACxC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=layout-utils.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout-utils.spec.d.ts","sourceRoot":"","sources":["../../../src/components/layout/layout-utils.spec.ts"],"names":[],"mappings":""}