hudini 0.19.0 → 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 +1 -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 +2842 -4529
- 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/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,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,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC;QAC7C,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC;KAC9C;CACF,CAAC,CAAC,CAAC;AAEJ,kCAAkC;AAClC,EAAE,CAAC,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9C,cAAc,EAAE,EAAE,CAAC,EAAE,C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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"}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { GameObjects, Scene } from 'phaser';
|
|
2
|
-
import { type ColorKey, type FontKey, type FontSizeKey, type RadiusKey, type SpacingKey } from 'phaser-wind';
|
|
3
|
-
import { ContainerInteractive } from '../container-interactive';
|
|
4
|
-
/**
|
|
5
|
-
* Parameters for creating a FlatTextButton.
|
|
6
|
-
*/
|
|
7
|
-
export type FlatTextButtonParams = {
|
|
8
|
-
/** Phaser scene where the button will be added. */
|
|
9
|
-
scene: Scene;
|
|
10
|
-
/** X position of the button. */
|
|
11
|
-
x: number;
|
|
12
|
-
/** Y position of the button. */
|
|
13
|
-
y: number;
|
|
14
|
-
/** Button text. */
|
|
15
|
-
text: string;
|
|
16
|
-
/**
|
|
17
|
-
* Font size in px (number) or a Phaser Wind font size token (string).
|
|
18
|
-
* Defaults to 'lg'.
|
|
19
|
-
*/
|
|
20
|
-
fontSize?: FontSizeKey | number;
|
|
21
|
-
/**
|
|
22
|
-
* Font family. Defaults to 'Bebas Neue'.
|
|
23
|
-
*/
|
|
24
|
-
font?: FontKey | string;
|
|
25
|
-
/**
|
|
26
|
-
* Background color. Defaults to 'blue'.
|
|
27
|
-
*/
|
|
28
|
-
color?: ColorKey | string;
|
|
29
|
-
/**
|
|
30
|
-
* Text color. Defaults to 'white'.
|
|
31
|
-
*/
|
|
32
|
-
textColor?: ColorKey | string;
|
|
33
|
-
/**
|
|
34
|
-
* Border radius in px (number) or a Phaser Wind radius token (string).
|
|
35
|
-
* Defaults to 'md'.
|
|
36
|
-
*/
|
|
37
|
-
borderRadius?: RadiusKey | number;
|
|
38
|
-
/**
|
|
39
|
-
* Padding in px (number) or a Phaser Wind spacing token (string).
|
|
40
|
-
* Defaults to '4'.
|
|
41
|
-
*/
|
|
42
|
-
padding?: SpacingKey | number;
|
|
43
|
-
/**
|
|
44
|
-
* Callback function for click event.
|
|
45
|
-
*/
|
|
46
|
-
onClick?: () => void;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* A customizable flat text button component for Phaser, supporting auto-sizing,
|
|
50
|
-
* design tokens, and interactive effects.
|
|
51
|
-
*/
|
|
52
|
-
export declare class FlatTextButton extends ContainerInteractive<Phaser.GameObjects.Sprite> {
|
|
53
|
-
/** The background sprite of the button. */
|
|
54
|
-
backgroundSprite: GameObjects.Sprite;
|
|
55
|
-
/** The white border sprite of the button. */
|
|
56
|
-
whiteBorderSprite: GameObjects.Sprite;
|
|
57
|
-
/** The text object of the button. */
|
|
58
|
-
buttonText: GameObjects.Text;
|
|
59
|
-
private pw;
|
|
60
|
-
private fontSizePx;
|
|
61
|
-
private paddingPx;
|
|
62
|
-
private borderRadiusPx;
|
|
63
|
-
private colorButton;
|
|
64
|
-
private textColorValue;
|
|
65
|
-
private fontFamily;
|
|
66
|
-
private textValue;
|
|
67
|
-
/**
|
|
68
|
-
* Creates a new FlatTextButton instance.
|
|
69
|
-
* @param params FlatTextButtonParams
|
|
70
|
-
*/
|
|
71
|
-
constructor({ scene, x, y, text, fontSize, font, color, textColor, borderRadius, padding, onClick, }: FlatTextButtonParams);
|
|
72
|
-
/**
|
|
73
|
-
* Sets the button text.
|
|
74
|
-
* @param text The new text.
|
|
75
|
-
* @returns This FlatTextButton instance.
|
|
76
|
-
*/
|
|
77
|
-
setText(text: string): this;
|
|
78
|
-
/**
|
|
79
|
-
* Sets the font size.
|
|
80
|
-
* @param fontSize Font size in px or token.
|
|
81
|
-
* @returns This FlatTextButton instance.
|
|
82
|
-
*/
|
|
83
|
-
setFontSize(fontSize: FontSizeKey | number): this;
|
|
84
|
-
/**
|
|
85
|
-
* Sets the font family.
|
|
86
|
-
* @param font Font family as string or token.
|
|
87
|
-
* @returns This FlatTextButton instance.
|
|
88
|
-
*/
|
|
89
|
-
setFont(font: FontKey | string): this;
|
|
90
|
-
/**
|
|
91
|
-
* Sets the background color.
|
|
92
|
-
* @param color Color as token or CSS string.
|
|
93
|
-
* @returns This FlatTextButton instance.
|
|
94
|
-
*/
|
|
95
|
-
setColor(color: ColorKey | string): this;
|
|
96
|
-
/**
|
|
97
|
-
* Sets the text color.
|
|
98
|
-
* @param color Color as token or CSS string.
|
|
99
|
-
* @returns This FlatTextButton instance.
|
|
100
|
-
*/
|
|
101
|
-
setTextColor(color: ColorKey | string): this;
|
|
102
|
-
/**
|
|
103
|
-
* Sets the border radius.
|
|
104
|
-
* @param borderRadius Border radius in px or token.
|
|
105
|
-
* @returns This FlatTextButton instance.
|
|
106
|
-
*/
|
|
107
|
-
setBorderRadius(borderRadius: RadiusKey | number): this;
|
|
108
|
-
/**
|
|
109
|
-
* Sets the padding.
|
|
110
|
-
* @param padding Padding in px or token.
|
|
111
|
-
* @returns This FlatTextButton instance.
|
|
112
|
-
*/
|
|
113
|
-
setPadding(padding: SpacingKey | number): this;
|
|
114
|
-
/**
|
|
115
|
-
* Creates the button text GameObject.
|
|
116
|
-
* @param scene Phaser scene.
|
|
117
|
-
*/
|
|
118
|
-
private createButtonText;
|
|
119
|
-
/**
|
|
120
|
-
* Creates the white border sprite for the button.
|
|
121
|
-
* @param scene Phaser scene.
|
|
122
|
-
*/
|
|
123
|
-
private createWhiteBorderSprite;
|
|
124
|
-
/**
|
|
125
|
-
* Creates the background sprite for the button.
|
|
126
|
-
* @param scene Phaser scene.
|
|
127
|
-
*/
|
|
128
|
-
private createBackgroundSprite;
|
|
129
|
-
/**
|
|
130
|
-
* Regenerates the background texture based on current state.
|
|
131
|
-
*/
|
|
132
|
-
private regenerateSprites;
|
|
133
|
-
/**
|
|
134
|
-
* Calculates the button's width and height based on text and padding.
|
|
135
|
-
* @returns Object with width and height.
|
|
136
|
-
*/
|
|
137
|
-
private getButtonDimensions;
|
|
138
|
-
/**
|
|
139
|
-
* Creates a texture for the button's white border.
|
|
140
|
-
* @param scene Phaser scene.
|
|
141
|
-
* @returns The texture key.
|
|
142
|
-
*/
|
|
143
|
-
private createWhiteBorderTexture;
|
|
144
|
-
/**
|
|
145
|
-
* Creates a texture for the button's background.
|
|
146
|
-
* @param scene Phaser scene.
|
|
147
|
-
* @returns The texture key.
|
|
148
|
-
*/
|
|
149
|
-
private createBackgroundTexture;
|
|
150
|
-
/**
|
|
151
|
-
* Adds the button's visual elements to the container.
|
|
152
|
-
*/
|
|
153
|
-
private setupContainer;
|
|
154
|
-
/**
|
|
155
|
-
* Sets up interactivity for the button, including hover and click effects.
|
|
156
|
-
* @param onClick Optional click callback.
|
|
157
|
-
*/
|
|
158
|
-
private setupInteractivity;
|
|
159
|
-
/**
|
|
160
|
-
* Gets the interactive sprite of the icon button
|
|
161
|
-
* @returns The interactive sprite
|
|
162
|
-
*/
|
|
163
|
-
get interactive(): Pick<GameObjects.Sprite, 'on' | 'off' | 'setInteractive' | 'setInteractive' | 'once'>;
|
|
164
|
-
}
|
|
165
|
-
//# sourceMappingURL=flat-text-button.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flat-text-button.d.ts","sourceRoot":"","sources":["../../../src/components/flat-text-button/flat-text-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,mDAAmD;IACnD,KAAK,EAAE,KAAK,CAAC;IACb,gCAAgC;IAChC,CAAC,EAAE,MAAM,CAAC;IAC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