hudini 0.18.1 → 0.20.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 +58 -27
- package/dist/components/badge/badge.d.ts +94 -0
- package/dist/components/badge/badge.d.ts.map +1 -0
- package/dist/components/badge/badge.js +180 -0
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/badge/badge.spec.d.ts +2 -0
- package/dist/components/badge/badge.spec.d.ts.map +1 -0
- package/dist/components/badge/badge.spec.js +195 -0
- package/dist/components/badge/badge.spec.js.map +1 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.d.ts.map +1 -0
- package/dist/components/badge/index.js +2 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/icon-button/icon-button.d.ts +2 -8
- package/dist/components/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/icon-button/icon-button.js +10 -86
- package/dist/components/icon-button/icon-button.js.map +1 -1
- package/dist/components/index.d.ts +1 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/panel/panel.d.ts +8 -8
- package/dist/components/panel/panel.d.ts.map +1 -1
- package/dist/components/panel/panel.js +29 -30
- package/dist/components/panel/panel.js.map +1 -1
- package/dist/components/text/text.d.ts +21 -4
- package/dist/components/text/text.d.ts.map +1 -1
- package/dist/components/text/text.js +14 -14
- package/dist/components/text/text.js.map +1 -1
- package/dist/components/text-button/text-button.d.ts +9 -18
- package/dist/components/text-button/text-button.d.ts.map +1 -1
- package/dist/components/text-button/text-button.js +38 -81
- package/dist/components/text-button/text-button.js.map +1 -1
- package/dist/components/text-button/text-button.spec.js +55 -9
- package/dist/components/text-button/text-button.spec.js.map +1 -1
- package/dist/hudini.js +2375 -3881
- package/dist/hudini.min.js +1 -1
- package/dist/loaders/load-fonts.d.ts +29 -0
- package/dist/loaders/load-fonts.d.ts.map +1 -1
- package/dist/loaders/load-fonts.js +20 -1
- package/dist/loaders/load-fonts.js.map +1 -1
- package/dist/scene/index.d.ts +1 -0
- package/dist/scene/index.d.ts.map +1 -1
- package/dist/scene/index.js +1 -0
- package/dist/scene/index.js.map +1 -1
- package/dist/scene/scene-with-hudini.d.ts +24 -1
- package/dist/scene/scene-with-hudini.d.ts.map +1 -1
- package/dist/scene/scene-with-hudini.js +24 -1
- package/dist/scene/scene-with-hudini.js.map +1 -1
- package/dist/scene/with-hudini.d.ts +35 -0
- package/dist/scene/with-hudini.d.ts.map +1 -0
- package/dist/scene/with-hudini.js +33 -0
- package/dist/scene/with-hudini.js.map +1 -0
- package/dist/utils/button-style.d.ts +16 -0
- package/dist/utils/button-style.d.ts.map +1 -0
- package/dist/utils/button-style.js +35 -0
- package/dist/utils/button-style.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/number-to-rgb.d.ts +16 -0
- package/dist/utils/number-to-rgb.d.ts.map +1 -0
- package/dist/utils/number-to-rgb.js +20 -0
- package/dist/utils/number-to-rgb.js.map +1 -0
- package/package.json +2 -2
- package/dist/components/flat-icon-button/flat-icon-button.d.ts +0 -60
- package/dist/components/flat-icon-button/flat-icon-button.d.ts.map +0 -1
- package/dist/components/flat-icon-button/flat-icon-button.js +0 -279
- package/dist/components/flat-icon-button/flat-icon-button.js.map +0 -1
- package/dist/components/flat-icon-button/index.d.ts +0 -2
- package/dist/components/flat-icon-button/index.d.ts.map +0 -1
- package/dist/components/flat-icon-button/index.js +0 -2
- package/dist/components/flat-icon-button/index.js.map +0 -1
- package/dist/components/flat-section-header/flat-section-header.d.ts +0 -143
- package/dist/components/flat-section-header/flat-section-header.d.ts.map +0 -1
- package/dist/components/flat-section-header/flat-section-header.js +0 -275
- package/dist/components/flat-section-header/flat-section-header.js.map +0 -1
- package/dist/components/flat-section-header/flat-section-header.spec.d.ts +0 -2
- package/dist/components/flat-section-header/flat-section-header.spec.d.ts.map +0 -1
- package/dist/components/flat-section-header/flat-section-header.spec.js +0 -255
- package/dist/components/flat-section-header/flat-section-header.spec.js.map +0 -1
- package/dist/components/flat-section-header/index.d.ts +0 -2
- package/dist/components/flat-section-header/index.d.ts.map +0 -1
- package/dist/components/flat-section-header/index.js +0 -2
- package/dist/components/flat-section-header/index.js.map +0 -1
- package/dist/components/flat-text-button/flat-text-button.d.ts +0 -165
- package/dist/components/flat-text-button/flat-text-button.d.ts.map +0 -1
- package/dist/components/flat-text-button/flat-text-button.js +0 -325
- package/dist/components/flat-text-button/flat-text-button.js.map +0 -1
- package/dist/components/flat-text-button/flat-text-button.spec.d.ts +0 -2
- package/dist/components/flat-text-button/flat-text-button.spec.d.ts.map +0 -1
- package/dist/components/flat-text-button/flat-text-button.spec.js +0 -243
- package/dist/components/flat-text-button/flat-text-button.spec.js.map +0 -1
- package/dist/components/flat-text-button/index.d.ts +0 -2
- package/dist/components/flat-text-button/index.d.ts.map +0 -1
- package/dist/components/flat-text-button/index.js +0 -2
- package/dist/components/flat-text-button/index.js.map +0 -1
- package/dist/components/section-header/index.d.ts +0 -2
- package/dist/components/section-header/index.d.ts.map +0 -1
- package/dist/components/section-header/index.js +0 -2
- package/dist/components/section-header/index.js.map +0 -1
- package/dist/components/section-header/section-header.d.ts +0 -149
- package/dist/components/section-header/section-header.d.ts.map +0 -1
- package/dist/components/section-header/section-header.js +0 -292
- package/dist/components/section-header/section-header.js.map +0 -1
- package/dist/components/section-header/section-header.spec.d.ts +0 -2
- package/dist/components/section-header/section-header.spec.d.ts.map +0 -1
- package/dist/components/section-header/section-header.spec.js +0 -264
- package/dist/components/section-header/section-header.spec.js.map +0 -1
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-magic-numbers */
|
|
2
|
-
import { GameObjects } from 'phaser';
|
|
3
|
-
import { Color, } from 'phaser-wind';
|
|
4
|
-
import { getPWFromScene } from '../../utils/get-pw-from-scene';
|
|
5
|
-
import { Text } from '../text';
|
|
6
|
-
// Border constants
|
|
7
|
-
const BLACK_BORDER_THICKNESS = 2;
|
|
8
|
-
const WHITE_BORDER_EXTRA_PIXELS_PER_SIDE = 2;
|
|
9
|
-
const WHITE_BORDER_TOTAL_EXTRA_PIXELS = WHITE_BORDER_EXTRA_PIXELS_PER_SIDE * 3; // 6 pixels total
|
|
10
|
-
const WHITE_BORDER_RADIUS_EXTRA = 2;
|
|
11
|
-
/**
|
|
12
|
-
* A flat section header component without gradient overlays, with text stroke and auto-sizing
|
|
13
|
-
*/
|
|
14
|
-
export class FlatSectionHeader extends GameObjects.Container {
|
|
15
|
-
/** The white border sprite of the header */
|
|
16
|
-
whiteBorderSprite;
|
|
17
|
-
/** The background sprite of the header */
|
|
18
|
-
backgroundSprite;
|
|
19
|
-
/** The text object of the header */
|
|
20
|
-
headerText;
|
|
21
|
-
/** Reference to the PhaserWind plugin */
|
|
22
|
-
pw;
|
|
23
|
-
/** Font size in pixels */
|
|
24
|
-
fontSizePx;
|
|
25
|
-
/** Margin size in pixels */
|
|
26
|
-
marginPx;
|
|
27
|
-
/** Border radius in pixels */
|
|
28
|
-
borderRadiusPx;
|
|
29
|
-
/** Background color value */
|
|
30
|
-
colorButton;
|
|
31
|
-
/** Text color value */
|
|
32
|
-
textColorValue;
|
|
33
|
-
/** Font family value */
|
|
34
|
-
fontFamily;
|
|
35
|
-
/** Text content value */
|
|
36
|
-
textValue;
|
|
37
|
-
/**
|
|
38
|
-
* Creates a new FlatSectionHeader
|
|
39
|
-
* @param params Configuration parameters for the header
|
|
40
|
-
*/
|
|
41
|
-
constructor({ scene, x, y, text, fontSize, font, backgroundColor = 'blue-600', textColor = 'white', borderRadius = 'md', margin = '4', }) {
|
|
42
|
-
super(scene, x, y);
|
|
43
|
-
this.pw = getPWFromScene(scene);
|
|
44
|
-
// Store values
|
|
45
|
-
this.textValue = text;
|
|
46
|
-
this.fontSizePx =
|
|
47
|
-
typeof fontSize === 'number'
|
|
48
|
-
? fontSize
|
|
49
|
-
: this.pw.fontSize.px(fontSize ?? 'lg');
|
|
50
|
-
this.marginPx =
|
|
51
|
-
typeof margin === 'number'
|
|
52
|
-
? margin
|
|
53
|
-
: this.pw.spacing.px(margin ?? '4');
|
|
54
|
-
this.borderRadiusPx =
|
|
55
|
-
typeof borderRadius === 'number'
|
|
56
|
-
? borderRadius
|
|
57
|
-
: this.pw.radius.px(borderRadius ?? 'md');
|
|
58
|
-
this.colorButton = Color.rgb(backgroundColor);
|
|
59
|
-
this.textColorValue = Color.rgb(textColor);
|
|
60
|
-
this.fontFamily = font ? (typeof font === 'string' ? font : this.pw.font.family(font)) : 'Bebas Neue';
|
|
61
|
-
this.createHeaderText(scene);
|
|
62
|
-
this.createWhiteBorderSprite(scene);
|
|
63
|
-
this.createBackgroundSprite(scene);
|
|
64
|
-
this.setupContainer();
|
|
65
|
-
this.setupInteractivity();
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Sets the text content of the header
|
|
69
|
-
* @param text New text content
|
|
70
|
-
* @returns this for chaining
|
|
71
|
-
*/
|
|
72
|
-
setText(text) {
|
|
73
|
-
this.textValue = text;
|
|
74
|
-
this.headerText.setText(text);
|
|
75
|
-
this.regenerateGraphics();
|
|
76
|
-
return this;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Sets the font size of the header text
|
|
80
|
-
* @param fontSize New font size (number in px or FontSizeKey)
|
|
81
|
-
* @returns this for chaining
|
|
82
|
-
*/
|
|
83
|
-
setFontSize(fontSize) {
|
|
84
|
-
this.fontSizePx =
|
|
85
|
-
typeof fontSize === 'number'
|
|
86
|
-
? fontSize
|
|
87
|
-
: this.pw.fontSize.px(fontSize ?? 'lg');
|
|
88
|
-
this.headerText.setFontSize(this.fontSizePx);
|
|
89
|
-
this.regenerateGraphics();
|
|
90
|
-
return this;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Sets the font family of the header text
|
|
94
|
-
* @param font New font family (FontKey or string)
|
|
95
|
-
* @returns this for chaining
|
|
96
|
-
*/
|
|
97
|
-
setFont(font) {
|
|
98
|
-
this.fontFamily = font ? (typeof font === 'string' ? font : this.pw.font.family(font)) : 'Bebas Neue';
|
|
99
|
-
this.headerText.setFontFamily(this.fontFamily);
|
|
100
|
-
this.regenerateGraphics();
|
|
101
|
-
return this;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Sets the background color of the header
|
|
105
|
-
* @param color New background color (ColorKey or string)
|
|
106
|
-
* @returns this for chaining
|
|
107
|
-
*/
|
|
108
|
-
setBackgroundColor(color) {
|
|
109
|
-
this.colorButton = Color.rgb(color);
|
|
110
|
-
this.regenerateGraphics();
|
|
111
|
-
return this;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Sets the text color of the header
|
|
115
|
-
* @param color New text color (ColorKey or string)
|
|
116
|
-
* @returns this for chaining
|
|
117
|
-
*/
|
|
118
|
-
setTextColor(color) {
|
|
119
|
-
this.textColorValue = Color.rgb(color);
|
|
120
|
-
this.headerText.setColor(this.textColorValue);
|
|
121
|
-
return this;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Sets the border radius of the header
|
|
125
|
-
* @param borderRadius New border radius (number in px or RadiusKey)
|
|
126
|
-
* @returns this for chaining
|
|
127
|
-
*/
|
|
128
|
-
setBorderRadius(borderRadius) {
|
|
129
|
-
this.borderRadiusPx =
|
|
130
|
-
typeof borderRadius === 'number'
|
|
131
|
-
? borderRadius
|
|
132
|
-
: this.pw.radius.px(borderRadius ?? 'md');
|
|
133
|
-
this.regenerateGraphics();
|
|
134
|
-
return this;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Sets the margin/padding of the header
|
|
138
|
-
* @param margin New margin size (number in px or SpacingKey)
|
|
139
|
-
* @returns this for chaining
|
|
140
|
-
*/
|
|
141
|
-
setMargin(margin) {
|
|
142
|
-
this.marginPx =
|
|
143
|
-
typeof margin === 'number'
|
|
144
|
-
? margin
|
|
145
|
-
: this.pw.spacing.px(margin ?? '4');
|
|
146
|
-
this.regenerateGraphics();
|
|
147
|
-
return this;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Creates the header text game object
|
|
151
|
-
* @param scene The scene to add the text to
|
|
152
|
-
*/
|
|
153
|
-
createHeaderText(scene) {
|
|
154
|
-
this.headerText = new Text({
|
|
155
|
-
scene,
|
|
156
|
-
x: 0,
|
|
157
|
-
y: 0,
|
|
158
|
-
text: this.textValue,
|
|
159
|
-
size: this.fontSizePx,
|
|
160
|
-
fontFamily: this.fontFamily,
|
|
161
|
-
});
|
|
162
|
-
this.headerText.setOrigin(0.5, 0.5);
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Creates the white border sprite for the header
|
|
166
|
-
* @param scene The scene to add the sprite to
|
|
167
|
-
*/
|
|
168
|
-
createWhiteBorderSprite(scene) {
|
|
169
|
-
const whiteBorderTexture = this.createWhiteBorderTexture(scene);
|
|
170
|
-
this.whiteBorderSprite = scene.add.sprite(0, 0, whiteBorderTexture);
|
|
171
|
-
this.whiteBorderSprite.setOrigin(0.5, 0.5);
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Creates the background sprite for the header
|
|
175
|
-
* @param scene The scene to add the sprite to
|
|
176
|
-
*/
|
|
177
|
-
createBackgroundSprite(scene) {
|
|
178
|
-
const backgroundTexture = this.createBackgroundTexture(scene);
|
|
179
|
-
this.backgroundSprite = scene.add.sprite(0, 0, backgroundTexture);
|
|
180
|
-
this.backgroundSprite.setOrigin(0.5, 0.5);
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Regenerates all graphics after a property change
|
|
184
|
-
*/
|
|
185
|
-
regenerateGraphics() {
|
|
186
|
-
// Update text bounds after text/font changes
|
|
187
|
-
this.headerText.setText(this.textValue);
|
|
188
|
-
// Regenerate textures
|
|
189
|
-
const whiteBorderTexture = this.createWhiteBorderTexture(this.scene);
|
|
190
|
-
const backgroundTexture = this.createBackgroundTexture(this.scene);
|
|
191
|
-
this.whiteBorderSprite.setTexture(whiteBorderTexture);
|
|
192
|
-
this.backgroundSprite.setTexture(backgroundTexture);
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Creates a texture for the header's white border.
|
|
196
|
-
* @param scene Phaser scene.
|
|
197
|
-
* @returns The texture key.
|
|
198
|
-
*/
|
|
199
|
-
createWhiteBorderTexture(scene) {
|
|
200
|
-
const { width, height } = this.getHeaderDimensions();
|
|
201
|
-
const textureKey = `flatSectionHeader_whiteBorder_${this.borderRadiusPx}_${width}_${height}`;
|
|
202
|
-
// White border is larger on each side
|
|
203
|
-
const borderWidth = width + WHITE_BORDER_TOTAL_EXTRA_PIXELS;
|
|
204
|
-
const borderHeight = height + WHITE_BORDER_TOTAL_EXTRA_PIXELS;
|
|
205
|
-
// Add some padding for texture
|
|
206
|
-
const padding = 8;
|
|
207
|
-
const textureWidth = borderWidth + padding * 2;
|
|
208
|
-
const textureHeight = borderHeight + padding * 2;
|
|
209
|
-
const graphics = scene.add.graphics();
|
|
210
|
-
const maxRadius = Math.floor(Math.min(borderWidth / 2, borderHeight / 2));
|
|
211
|
-
const effectiveRadius = Math.min(this.borderRadiusPx + WHITE_BORDER_RADIUS_EXTRA, maxRadius);
|
|
212
|
-
const finalRadius = Math.max(0, effectiveRadius);
|
|
213
|
-
// White border (outer)
|
|
214
|
-
graphics.fillStyle(Color.hex('white'), 1);
|
|
215
|
-
graphics.fillRoundedRect(padding, padding, borderWidth, borderHeight, finalRadius);
|
|
216
|
-
graphics.generateTexture(textureKey, textureWidth, textureHeight);
|
|
217
|
-
graphics.destroy();
|
|
218
|
-
return textureKey;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Creates a texture for the header's background.
|
|
222
|
-
* @param scene Phaser scene.
|
|
223
|
-
* @returns The texture key.
|
|
224
|
-
*/
|
|
225
|
-
createBackgroundTexture(scene) {
|
|
226
|
-
const { width, height } = this.getHeaderDimensions();
|
|
227
|
-
const textureKey = `flatSectionHeader_bg_${this.colorButton}_${this.borderRadiusPx}_${width}_${height}`;
|
|
228
|
-
// Add some padding for texture
|
|
229
|
-
const padding = 8;
|
|
230
|
-
const textureWidth = width + padding * 2;
|
|
231
|
-
const textureHeight = height + padding * 2;
|
|
232
|
-
const graphics = scene.add.graphics();
|
|
233
|
-
const maxRadius = Math.floor(Math.min(width / 2, height / 2));
|
|
234
|
-
const effectiveRadius = Math.min(this.borderRadiusPx, maxRadius);
|
|
235
|
-
const finalRadius = Math.max(0, effectiveRadius);
|
|
236
|
-
// Main background (flat, no gradient)
|
|
237
|
-
graphics.fillStyle(Color.hex(this.colorButton), 1);
|
|
238
|
-
graphics.fillRoundedRect(padding, padding, width, height, finalRadius);
|
|
239
|
-
// Black stroke border
|
|
240
|
-
graphics.lineStyle(BLACK_BORDER_THICKNESS, Color.hex('black'), 1);
|
|
241
|
-
graphics.strokeRoundedRect(padding, padding, width, height, finalRadius);
|
|
242
|
-
graphics.generateTexture(textureKey, textureWidth, textureHeight);
|
|
243
|
-
graphics.destroy();
|
|
244
|
-
return textureKey;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Gets the dimensions of the header based on text content
|
|
248
|
-
* @returns Object containing width and height
|
|
249
|
-
*/
|
|
250
|
-
getHeaderDimensions() {
|
|
251
|
-
const textBounds = this.headerText.getBounds();
|
|
252
|
-
const width = textBounds.width + this.marginPx * 2;
|
|
253
|
-
const height = textBounds.height + this.marginPx * 2;
|
|
254
|
-
return { width, height };
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Sets up the container with all sprites in the correct order
|
|
258
|
-
*/
|
|
259
|
-
setupContainer() {
|
|
260
|
-
this.add([this.whiteBorderSprite, this.backgroundSprite, this.headerText]);
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Sets up interactivity for the header
|
|
264
|
-
*/
|
|
265
|
-
setupInteractivity() {
|
|
266
|
-
this.setInteractive();
|
|
267
|
-
this.on('pointerdown', () => {
|
|
268
|
-
this.setScale(0.95);
|
|
269
|
-
this.on('pointerup', () => {
|
|
270
|
-
this.setScale(1);
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
//# sourceMappingURL=flat-section-header.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flat-section-header.js","sourceRoot":"","sources":["../../../src/components/flat-section-header/flat-section-header.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,WAAW,EAAS,MAAM,QAAQ,CAAC;AAC5C,OAAO,EACL,KAAK,GAON,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAyB/B,mBAAmB;AACnB,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,kCAAkC,GAAG,CAAC,CAAC;AAC7C,MAAM,+BAA+B,GAAG,kCAAkC,GAAG,CAAC,CAAC,CAAC,iBAAiB;AACjG,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,WAAW,CAAC,SAAS;IAC1D,4CAA4C;IACrC,iBAAiB,CAAsB;IAC9C,0CAA0C;IACnC,gBAAgB,CAAsB;IAC7C,oCAAoC;IAC7B,UAAU,CAAoB;IAErC,yCAAyC;IACjC,EAAE,CAAuB;IACjC,0BAA0B;IAClB,UAAU,CAAU;IAC5B,4BAA4B;IACpB,QAAQ,CAAU;IAC1B,8BAA8B;IACtB,cAAc,CAAU;IAChC,6BAA6B;IACrB,WAAW,CAAU;IAC7B,uBAAuB;IACf,cAAc,CAAU;IAChC,wBAAwB;IAChB,UAAU,CAAU;IAC5B,yBAAyB;IACjB,SAAS,CAAU;IAE3B;;;OAGG;IACH,YAAY,EACV,KAAK,EACL,CAAC,EACD,CAA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aAAa,CAAC,CAAC;QAClE,QAAQ,CAAC,OAAO,EAAE,CAAC;QAEnB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;OAGG;IACK,mBAAmB;QACzB,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACK,cAAc;QACpB,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACK,kBAAkB;QACxB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;YAC1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACpB,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;gBACxB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YACnB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CAEF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flat-section-header.spec.d.ts","sourceRoot":"","sources":["../../../src/components/flat-section-header/flat-section-header.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-magic-numbers */
|
|
2
|
-
/* eslint-disable max-lines-per-function */
|
|
3
|
-
import { Scene } from 'phaser';
|
|
4
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
-
// Mock phaser-wind
|
|
6
|
-
vi.mock('phaser-wind', () => ({
|
|
7
|
-
Color: {
|
|
8
|
-
rgb: vi.fn((color) => `rgb-${color}`),
|
|
9
|
-
hex: vi.fn((color) => `hex-${color}`),
|
|
10
|
-
},
|
|
11
|
-
}));
|
|
12
|
-
// Mock the getPWFromScene utility
|
|
13
|
-
vi.mock('../../utils/get-pw-from-scene', () => ({
|
|
14
|
-
getPWFromScene: vi.fn(() => ({
|
|
15
|
-
fontSize: {
|
|
16
|
-
px: vi.fn((size) => {
|
|
17
|
-
const sizes = { xs: 12, sm: 14, md: 16, lg: 18, xl: 20 };
|
|
18
|
-
return sizes[size] || 18;
|
|
19
|
-
}),
|
|
20
|
-
},
|
|
21
|
-
spacing: {
|
|
22
|
-
px: vi.fn((spacing) => {
|
|
23
|
-
const spacings = { xs: 4, sm: 8, md: 12, lg: 16, xl: 20 };
|
|
24
|
-
return spacings[spacing] || 16;
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
27
|
-
radius: {
|
|
28
|
-
px: vi.fn((radius) => {
|
|
29
|
-
const radiuses = { none: 0, sm: 4, md: 8, lg: 12, xl: 16, full: 9999 };
|
|
30
|
-
return radiuses[radius] || 8;
|
|
31
|
-
}),
|
|
32
|
-
},
|
|
33
|
-
font: {
|
|
34
|
-
family: vi.fn((font) => {
|
|
35
|
-
const fonts = {
|
|
36
|
-
primary: 'Inter, sans-serif',
|
|
37
|
-
secondary: 'Roboto, Arial, sans-serif',
|
|
38
|
-
monospace: 'Courier, monospace',
|
|
39
|
-
display: 'Poppins, Inter, sans-serif',
|
|
40
|
-
};
|
|
41
|
-
return (fonts[font] || 'Poppins, Inter, sans-serif');
|
|
42
|
-
}),
|
|
43
|
-
},
|
|
44
|
-
})),
|
|
45
|
-
}));
|
|
46
|
-
// Mock the Text component
|
|
47
|
-
vi.mock('../text', () => {
|
|
48
|
-
class MockText {
|
|
49
|
-
text;
|
|
50
|
-
style;
|
|
51
|
-
constructor(params) {
|
|
52
|
-
this.text = params.text;
|
|
53
|
-
this.style = {
|
|
54
|
-
fontSize: params.size ?? 22,
|
|
55
|
-
fontFamily: params.fontFamily ?? 'Bebas Neue',
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
setText(text) {
|
|
59
|
-
this.text = text;
|
|
60
|
-
return this;
|
|
61
|
-
}
|
|
62
|
-
setOrigin() {
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
setFontSize(size) {
|
|
66
|
-
this.style['fontSize'] = size;
|
|
67
|
-
return this;
|
|
68
|
-
}
|
|
69
|
-
setFontFamily(family) {
|
|
70
|
-
this.style['fontFamily'] = family;
|
|
71
|
-
return this;
|
|
72
|
-
}
|
|
73
|
-
setColor(color) {
|
|
74
|
-
this.style['color'] = color;
|
|
75
|
-
return this;
|
|
76
|
-
}
|
|
77
|
-
getBounds() {
|
|
78
|
-
const charWidth = 10;
|
|
79
|
-
const lineHeight = parseInt(this.style['fontSize']) || 18;
|
|
80
|
-
return {
|
|
81
|
-
width: this.text.length * charWidth,
|
|
82
|
-
height: lineHeight,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return { Text: MockText };
|
|
87
|
-
});
|
|
88
|
-
// Mock Phaser
|
|
89
|
-
vi.mock('phaser', () => {
|
|
90
|
-
class MockSprite {
|
|
91
|
-
// eslint-disable-next-line no-unused-vars
|
|
92
|
-
constructor(_x, _y, _texture) { }
|
|
93
|
-
setOrigin() {
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
|
-
setTexture() {
|
|
97
|
-
return this;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
class MockGraphics {
|
|
101
|
-
clear() {
|
|
102
|
-
return this;
|
|
103
|
-
}
|
|
104
|
-
fillStyle() {
|
|
105
|
-
return this;
|
|
106
|
-
}
|
|
107
|
-
fillRoundedRect() {
|
|
108
|
-
return this;
|
|
109
|
-
}
|
|
110
|
-
lineStyle() {
|
|
111
|
-
return this;
|
|
112
|
-
}
|
|
113
|
-
strokeRoundedRect() {
|
|
114
|
-
return this;
|
|
115
|
-
}
|
|
116
|
-
generateTexture() {
|
|
117
|
-
return this;
|
|
118
|
-
}
|
|
119
|
-
destroy() {
|
|
120
|
-
return this;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
class Container {
|
|
124
|
-
scene;
|
|
125
|
-
// eslint-disable-next-line no-unused-vars
|
|
126
|
-
constructor(_scene, _x, _y) {
|
|
127
|
-
this.scene = _scene;
|
|
128
|
-
}
|
|
129
|
-
add() {
|
|
130
|
-
return this;
|
|
131
|
-
}
|
|
132
|
-
setInteractive() {
|
|
133
|
-
return this;
|
|
134
|
-
}
|
|
135
|
-
on() {
|
|
136
|
-
return this;
|
|
137
|
-
}
|
|
138
|
-
setScale() {
|
|
139
|
-
return this;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
class MockText {
|
|
143
|
-
text;
|
|
144
|
-
style;
|
|
145
|
-
constructor(_x, _y, text, style = {}) {
|
|
146
|
-
this.text = text;
|
|
147
|
-
this.style = style;
|
|
148
|
-
}
|
|
149
|
-
setText(text) {
|
|
150
|
-
this.text = text;
|
|
151
|
-
return this;
|
|
152
|
-
}
|
|
153
|
-
setOrigin() {
|
|
154
|
-
return this;
|
|
155
|
-
}
|
|
156
|
-
setFontSize(size) {
|
|
157
|
-
this.style['fontSize'] = size;
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
|
-
setFontFamily(family) {
|
|
161
|
-
this.style['fontFamily'] = family;
|
|
162
|
-
return this;
|
|
163
|
-
}
|
|
164
|
-
setColor(color) {
|
|
165
|
-
this.style['color'] = color;
|
|
166
|
-
return this;
|
|
167
|
-
}
|
|
168
|
-
getBounds() {
|
|
169
|
-
const charWidth = 10;
|
|
170
|
-
const lineHeight = parseInt(this.style['fontSize']) ?? 18;
|
|
171
|
-
return {
|
|
172
|
-
width: this.text.length * charWidth,
|
|
173
|
-
height: lineHeight,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
class Scene {
|
|
178
|
-
add = {
|
|
179
|
-
text: vi.fn((x, y, text, style) => new MockText(x, y, text, style)),
|
|
180
|
-
sprite: vi.fn((x, y, texture) => new MockSprite(x, y, texture)),
|
|
181
|
-
graphics: vi.fn(() => new MockGraphics()),
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
class BasePlugin {
|
|
185
|
-
constructor() { }
|
|
186
|
-
}
|
|
187
|
-
const GameObjects = { Container };
|
|
188
|
-
const Plugins = { BasePlugin };
|
|
189
|
-
return { GameObjects, Scene, Plugins };
|
|
190
|
-
});
|
|
191
|
-
import { FlatSectionHeader } from './flat-section-header';
|
|
192
|
-
describe('FlatSectionHeader', () => {
|
|
193
|
-
it('should create a FlatSectionHeader instance', () => {
|
|
194
|
-
const scene = new Scene();
|
|
195
|
-
const flatSectionHeader = new FlatSectionHeader({
|
|
196
|
-
scene,
|
|
197
|
-
x: 100,
|
|
198
|
-
y: 100,
|
|
199
|
-
text: 'Section Title',
|
|
200
|
-
});
|
|
201
|
-
expect(flatSectionHeader).toBeInstanceOf(FlatSectionHeader);
|
|
202
|
-
});
|
|
203
|
-
it('should create with custom properties', () => {
|
|
204
|
-
const scene = new Scene();
|
|
205
|
-
const flatSectionHeader = new FlatSectionHeader({
|
|
206
|
-
scene,
|
|
207
|
-
x: 100,
|
|
208
|
-
y: 100,
|
|
209
|
-
text: 'Custom Header',
|
|
210
|
-
fontSize: 'xl',
|
|
211
|
-
font: 'display',
|
|
212
|
-
backgroundColor: 'purple-600',
|
|
213
|
-
textColor: 'white',
|
|
214
|
-
borderRadius: 'lg',
|
|
215
|
-
margin: '6',
|
|
216
|
-
});
|
|
217
|
-
expect(flatSectionHeader).toBeInstanceOf(FlatSectionHeader);
|
|
218
|
-
});
|
|
219
|
-
it('should support method chaining for colors', () => {
|
|
220
|
-
const scene = new Scene();
|
|
221
|
-
const flatSectionHeader = new FlatSectionHeader({
|
|
222
|
-
scene,
|
|
223
|
-
x: 100,
|
|
224
|
-
y: 100,
|
|
225
|
-
text: 'Test Header',
|
|
226
|
-
});
|
|
227
|
-
const result = flatSectionHeader
|
|
228
|
-
.setTextColor('white')
|
|
229
|
-
.setBackgroundColor('blue-600');
|
|
230
|
-
expect(result).toBe(flatSectionHeader);
|
|
231
|
-
});
|
|
232
|
-
it('should handle borderRadius full correctly in constructor', () => {
|
|
233
|
-
const scene = new Scene();
|
|
234
|
-
const flatSectionHeader = new FlatSectionHeader({
|
|
235
|
-
scene,
|
|
236
|
-
x: 100,
|
|
237
|
-
y: 100,
|
|
238
|
-
text: 'Full Radius Header',
|
|
239
|
-
borderRadius: 'full',
|
|
240
|
-
});
|
|
241
|
-
expect(flatSectionHeader).toBeInstanceOf(FlatSectionHeader);
|
|
242
|
-
});
|
|
243
|
-
it('should use default display font', () => {
|
|
244
|
-
const scene = new Scene();
|
|
245
|
-
const flatSectionHeader = new FlatSectionHeader({
|
|
246
|
-
scene,
|
|
247
|
-
x: 100,
|
|
248
|
-
y: 100,
|
|
249
|
-
text: 'Default Style',
|
|
250
|
-
});
|
|
251
|
-
expect(flatSectionHeader).toBeInstanceOf(FlatSectionHeader);
|
|
252
|
-
expect(flatSectionHeader.headerText).toBeDefined();
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
//# sourceMappingURL=flat-section-header.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flat-section-header.spec.js","sourceRoot":"","sources":["../../../src/components/flat-section-header/flat-section-header.spec.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,2CAA2C;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAElD,mBAAmB;AACnB,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5B,KAAK,EAAE;QACL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C,KAAK;YACL,CAAC,EAAE,GAAG;YACN,CAAC,EAAE,GAAG;YACN,IAAI,EAAE,eAAe;SACtB,CAAC,CAAC;QAEH,MAAM,CAAC,iBAAiB,CAAC,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;QAC5D,MAAM,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/flat-section-header/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/flat-section-header/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|