phaser-wind 0.1.0 → 0.2.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 +243 -10
- package/dist/color/color-picker.d.ts +12 -2
- package/dist/color/color-picker.d.ts.map +1 -1
- package/dist/color/color-picker.js +59 -2
- package/dist/color/color-picker.js.map +1 -1
- package/dist/color/color-picker.spec.js +19 -0
- package/dist/color/color-picker.spec.js.map +1 -1
- package/dist/examples/nested-theme-example.d.ts +28 -0
- package/dist/examples/nested-theme-example.d.ts.map +1 -0
- package/dist/examples/nested-theme-example.js +313 -0
- package/dist/examples/nested-theme-example.js.map +1 -0
- package/dist/examples/usage-example.d.ts +17 -0
- package/dist/examples/usage-example.d.ts.map +1 -0
- package/dist/examples/usage-example.js +158 -0
- package/dist/examples/usage-example.js.map +1 -0
- package/dist/font/font-picker.d.ts +93 -0
- package/dist/font/font-picker.d.ts.map +1 -0
- package/dist/font/font-picker.js +212 -0
- package/dist/font/font-picker.js.map +1 -0
- package/dist/font/index.d.ts +1 -0
- package/dist/font/index.d.ts.map +1 -1
- package/dist/font/index.js +1 -0
- package/dist/font/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +3 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/theme-config.d.ts +162 -0
- package/dist/theme/theme-config.d.ts.map +1 -0
- package/dist/theme/theme-config.js +196 -0
- package/dist/theme/theme-config.js.map +1 -0
- package/dist/theme/theme-manager.d.ts +96 -0
- package/dist/theme/theme-manager.d.ts.map +1 -0
- package/dist/theme/theme-manager.js +171 -0
- package/dist/theme/theme-manager.js.map +1 -0
- package/dist/theme/type.d.ts +1 -0
- package/dist/theme/type.d.ts.map +1 -0
- package/dist/theme/type.js +2 -0
- package/dist/theme/type.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,6 +58,9 @@ const title = this.add.text(200, 100, 'Game Title', {
|
|
|
58
58
|
|
|
59
59
|
- 🎨 **Complete Tailwind Color Palette** - All 22 color families with 11 shades each
|
|
60
60
|
- 📐 **Semantic Font Sizes** - From `xs` to `6xl`, just like Tailwind
|
|
61
|
+
- 🎨 **Structured Theme System** - Nested design tokens for colors, fonts, spacing, typography, and effects
|
|
62
|
+
- 🔄 **Dynamic Theme Switching** - Change themes at runtime with full type safety
|
|
63
|
+
- 🎯 **Smart Token Resolution** - Themes can reference other theme tokens automatically
|
|
61
64
|
- 🔧 **TypeScript First** - Full type safety and IntelliSense
|
|
62
65
|
- 🎮 **Phaser Ready** - Designed specifically for Phaser 3 games
|
|
63
66
|
- 🌈 **Consistent Design** - No more guessing colors and sizes
|
|
@@ -146,6 +149,234 @@ const responsiveText = FontSizePicker.rem('xl'); // 1.25
|
|
|
146
149
|
|
|
147
150
|
---
|
|
148
151
|
|
|
152
|
+
## 🎨 Theme System
|
|
153
|
+
|
|
154
|
+
Phaser Wind includes a powerful **structured theme system** that lets you organize your design tokens into logical categories and create consistent, reusable designs.
|
|
155
|
+
|
|
156
|
+
### 🏗️ **Theme Structure**
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
import { createTheme, ThemeManager } from 'phaser-wind';
|
|
160
|
+
|
|
161
|
+
const gameTheme = createTheme({
|
|
162
|
+
fonts: {
|
|
163
|
+
primary: 'Inter, system-ui, sans-serif',
|
|
164
|
+
display: 'Orbitron, monospace', // Sci-fi font for headers
|
|
165
|
+
ui: 'Roboto, Arial, sans-serif',
|
|
166
|
+
},
|
|
167
|
+
colors: {
|
|
168
|
+
primary: 'purple-600',
|
|
169
|
+
secondary: 'cyan-500',
|
|
170
|
+
'ui-background': 'slate-900',
|
|
171
|
+
'player-health': 'green-500',
|
|
172
|
+
'enemy-health': 'red-600',
|
|
173
|
+
},
|
|
174
|
+
spacing: {
|
|
175
|
+
xs: 4,
|
|
176
|
+
sm: 8,
|
|
177
|
+
md: 16,
|
|
178
|
+
lg: 24,
|
|
179
|
+
xl: 32,
|
|
180
|
+
},
|
|
181
|
+
typography: {
|
|
182
|
+
heading: {
|
|
183
|
+
fontSize: '2xl',
|
|
184
|
+
fontFamily: 'fonts.display', // 🔗 References fonts.display!
|
|
185
|
+
fontWeight: 600,
|
|
186
|
+
lineHeight: 1.2,
|
|
187
|
+
},
|
|
188
|
+
body: {
|
|
189
|
+
fontSize: 'md',
|
|
190
|
+
fontFamily: 'fonts.primary',
|
|
191
|
+
fontWeight: 400,
|
|
192
|
+
lineHeight: 1.5,
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
effects: {
|
|
196
|
+
'glow-primary': {
|
|
197
|
+
blur: 8,
|
|
198
|
+
color: 'colors.primary', // 🔗 References colors.primary!
|
|
199
|
+
alpha: 0.6,
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
// Custom categories work too!
|
|
203
|
+
animations: {
|
|
204
|
+
duration: 300,
|
|
205
|
+
easing: 'ease-out',
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Initialize your theme
|
|
210
|
+
ThemeManager.init(gameTheme);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 🎯 **Using Theme Tokens**
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
import {
|
|
217
|
+
ColorPicker,
|
|
218
|
+
FontPicker,
|
|
219
|
+
SpacingPicker,
|
|
220
|
+
TypographyPicker,
|
|
221
|
+
EffectPicker,
|
|
222
|
+
} from 'phaser-wind';
|
|
223
|
+
|
|
224
|
+
// Colors - automatically looks in colors.*
|
|
225
|
+
const primaryColor = ColorPicker.rgb('primary'); // Gets colors.primary
|
|
226
|
+
const uiBackground = ColorPicker.hex('ui-background'); // Gets colors.ui-background
|
|
227
|
+
|
|
228
|
+
// Fonts
|
|
229
|
+
const displayFont = FontPicker.family('display'); // Gets fonts.display
|
|
230
|
+
const primaryFont = FontPicker.family('primary'); // Gets fonts.primary
|
|
231
|
+
|
|
232
|
+
// Spacing
|
|
233
|
+
const mediumSpace = SpacingPicker.px('md'); // Gets spacing.md (16px)
|
|
234
|
+
const largeSpace = SpacingPicker.px('lg'); // Gets spacing.lg (24px)
|
|
235
|
+
|
|
236
|
+
// Complete typography styles
|
|
237
|
+
const headingStyle = TypographyPicker.phaserStyle('heading');
|
|
238
|
+
// Returns: { fontSize: '24px', fontFamily: 'Orbitron, monospace', fontStyle: 'bold' }
|
|
239
|
+
|
|
240
|
+
// Effects
|
|
241
|
+
const glowConfig = EffectPicker.config('glow-primary');
|
|
242
|
+
// Returns: { blur: 8, color: 'purple-600', alpha: 0.6 }
|
|
243
|
+
|
|
244
|
+
// Custom tokens
|
|
245
|
+
const animDuration = ThemeManager.getToken('animations.duration'); // 300
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### 🔄 **Dynamic Theme Switching**
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
// Register multiple themes
|
|
252
|
+
ThemeManager.registerTheme('light', lightTheme);
|
|
253
|
+
ThemeManager.registerTheme('dark', darkTheme);
|
|
254
|
+
ThemeManager.registerTheme('cyberpunk', cyberpunkTheme);
|
|
255
|
+
|
|
256
|
+
// Switch themes instantly
|
|
257
|
+
ThemeManager.setTheme('dark');
|
|
258
|
+
|
|
259
|
+
// Listen for theme changes
|
|
260
|
+
ThemeManager.onThemeChange(newTheme => {
|
|
261
|
+
console.log('Theme changed!', newTheme);
|
|
262
|
+
// Update your game UI here
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// Get available themes
|
|
266
|
+
const themes = ThemeManager.getRegisteredThemes(); // ['light', 'dark', 'cyberpunk']
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### 🎮 **Real Game Example**
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
export class GameScene extends Phaser.Scene {
|
|
273
|
+
create() {
|
|
274
|
+
// Player health bar with theme colors
|
|
275
|
+
const healthWidth = SpacingPicker.px('massive'); // 96px
|
|
276
|
+
const healthHeight = SpacingPicker.px('md'); // 16px
|
|
277
|
+
|
|
278
|
+
this.add.rectangle(
|
|
279
|
+
50,
|
|
280
|
+
50,
|
|
281
|
+
healthWidth,
|
|
282
|
+
healthHeight,
|
|
283
|
+
ColorPicker.hex('player-health')
|
|
284
|
+
); // Green from theme
|
|
285
|
+
|
|
286
|
+
// Game title with theme typography
|
|
287
|
+
const titleStyle = TypographyPicker.phaserStyle('heading');
|
|
288
|
+
this.add
|
|
289
|
+
.text(400, 50, 'CYBER QUEST', {
|
|
290
|
+
...titleStyle,
|
|
291
|
+
color: ColorPicker.rgb('primary'), // Purple from theme
|
|
292
|
+
})
|
|
293
|
+
.setOrigin(0.5);
|
|
294
|
+
|
|
295
|
+
// UI button with consistent spacing and colors
|
|
296
|
+
this.createButton(
|
|
297
|
+
400,
|
|
298
|
+
400,
|
|
299
|
+
'START GAME',
|
|
300
|
+
SpacingPicker.px('huge'), // 64px width
|
|
301
|
+
SpacingPicker.px('lg') // 24px height
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
createButton(
|
|
306
|
+
x: number,
|
|
307
|
+
y: number,
|
|
308
|
+
text: string,
|
|
309
|
+
width: number,
|
|
310
|
+
height: number
|
|
311
|
+
) {
|
|
312
|
+
const button = this.add
|
|
313
|
+
.rectangle(x, y, width, height, ColorPicker.hex('ui-background'))
|
|
314
|
+
.setInteractive()
|
|
315
|
+
.on('pointerover', () =>
|
|
316
|
+
button.setFillStyle(ColorPicker.hex('secondary'))
|
|
317
|
+
)
|
|
318
|
+
.on('pointerout', () =>
|
|
319
|
+
button.setFillStyle(ColorPicker.hex('ui-background'))
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
const buttonText = TypographyPicker.phaserStyle('body');
|
|
323
|
+
this.add
|
|
324
|
+
.text(x, y, text, {
|
|
325
|
+
...buttonText,
|
|
326
|
+
color: ColorPicker.rgb('primary'),
|
|
327
|
+
})
|
|
328
|
+
.setOrigin(0.5);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### 🎨 **Pre-built Themes**
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
import { defaultLightTheme, defaultDarkTheme } from 'phaser-wind';
|
|
337
|
+
|
|
338
|
+
// Light theme with professional colors
|
|
339
|
+
ThemeManager.init(defaultLightTheme);
|
|
340
|
+
|
|
341
|
+
// Dark theme perfect for games
|
|
342
|
+
ThemeManager.init(defaultDarkTheme);
|
|
343
|
+
|
|
344
|
+
// Create variations
|
|
345
|
+
const winterTheme = ThemeManager.extendCurrentTheme({
|
|
346
|
+
'colors.primary': 'blue-400',
|
|
347
|
+
'colors.secondary': 'cyan-300',
|
|
348
|
+
'colors.accent': 'white',
|
|
349
|
+
});
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### 🔗 **Smart Token References**
|
|
353
|
+
|
|
354
|
+
Themes can reference other tokens using dot notation:
|
|
355
|
+
|
|
356
|
+
```typescript
|
|
357
|
+
const theme = createTheme({
|
|
358
|
+
colors: {
|
|
359
|
+
brand: 'purple-600',
|
|
360
|
+
danger: 'red-500',
|
|
361
|
+
},
|
|
362
|
+
typography: {
|
|
363
|
+
title: {
|
|
364
|
+
fontSize: '4xl',
|
|
365
|
+
fontFamily: 'fonts.display', // 🔗 Auto-resolves to fonts.display
|
|
366
|
+
color: 'colors.brand', // 🔗 Auto-resolves to purple-600
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
effects: {
|
|
370
|
+
'brand-glow': {
|
|
371
|
+
color: 'colors.brand', // 🔗 Auto-resolves to purple-600
|
|
372
|
+
blur: 8,
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
149
380
|
## 💡 Real-World Examples
|
|
150
381
|
|
|
151
382
|
### Game UI Components
|
|
@@ -394,24 +625,26 @@ Plus, `phaser-wind` is way easier to type than `phaser-tailwind-css-design-token
|
|
|
394
625
|
|
|
395
626
|
## 📚 Compared to Raw Phaser
|
|
396
627
|
|
|
397
|
-
| Without Phaser Wind | With Phaser Wind
|
|
398
|
-
| ------------------------ |
|
|
399
|
-
| `fill: '#3B82F6'` | `fill: ColorPicker.rgb('
|
|
400
|
-
| `fontSize: '18px'` | `fontSize: FontSizePicker.css('lg')`
|
|
401
|
-
| `tint: 0x4ADE80` | `tint: ColorPicker.hex('
|
|
402
|
-
|
|
|
403
|
-
|
|
|
404
|
-
|
|
|
628
|
+
| Without Phaser Wind | With Phaser Wind |
|
|
629
|
+
| ------------------------ | ------------------------------------- |
|
|
630
|
+
| `fill: '#3B82F6'` | `fill: ColorPicker.rgb('primary')` |
|
|
631
|
+
| `fontSize: '18px'` | `fontSize: FontSizePicker.css('lg')` |
|
|
632
|
+
| `tint: 0x4ADE80` | `tint: ColorPicker.hex('success')` |
|
|
633
|
+
| `fontFamily: 'Arial'` | `fontFamily: FontPicker.family('ui')` |
|
|
634
|
+
| Magic numbers everywhere | Semantic, consistent tokens |
|
|
635
|
+
| Color picking hell | Harmonious color palettes |
|
|
636
|
+
| Inconsistent sizing | Perfect typography scale |
|
|
637
|
+
| No design system | Complete theme architecture |
|
|
405
638
|
|
|
406
639
|
---
|
|
407
640
|
|
|
408
641
|
## 🔮 Coming Soon
|
|
409
642
|
|
|
410
|
-
- 🎯 **Spacing System** - Consistent margins and padding tokens
|
|
411
643
|
- 📐 **Layout Utilities** - Flexbox-inspired alignment helpers
|
|
412
|
-
- 🎨 **Theme System** - Easy dark/light mode switching
|
|
413
644
|
- 📱 **Responsive Utilities** - Breakpoint-based design tokens
|
|
414
645
|
- ⚡ **Animation Presets** - Smooth, consistent transitions
|
|
646
|
+
- 🎮 **Component Library** - Pre-built Phaser components with theme support
|
|
647
|
+
- 🔧 **CLI Tool** - Generate themes and components from the command line
|
|
415
648
|
|
|
416
649
|
---
|
|
417
650
|
|
|
@@ -5,8 +5,18 @@ export type ColorToken = `${ColorKey}-${ShadeKey}` | 'black' | 'white';
|
|
|
5
5
|
export declare class ColorPicker {
|
|
6
6
|
private colorKey;
|
|
7
7
|
constructor(colorKey: ColorKey);
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Get RGB string for a color token or theme token
|
|
10
|
+
* @param color - Color token (e.g., 'blue-500') or theme token (e.g., 'primary', 'colors.primary')
|
|
11
|
+
* @returns RGB string format 'rgb(r, g, b)'
|
|
12
|
+
*/
|
|
13
|
+
static rgb(color: ColorToken | string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get hex number for a color token or theme token
|
|
16
|
+
* @param color - Color token (e.g., 'blue-500') or theme token (e.g., 'primary', 'colors.primary')
|
|
17
|
+
* @returns Hex number format 0xRRGGBB
|
|
18
|
+
*/
|
|
19
|
+
static hex(color: ColorToken | string): number;
|
|
10
20
|
getRgb(shade: ShadeKey): string;
|
|
11
21
|
getHex(shade: ShadeKey): number;
|
|
12
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.d.ts","sourceRoot":"","sources":["../../src/color/color-picker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"color-picker.d.ts","sourceRoot":"","sources":["../../src/color/color-picker.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,OAAO,CAAC;AAC5C,MAAM,MAAM,QAAQ,GAChB,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAC;AACV,MAAM,MAAM,UAAU,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,GAAG,OAAO,GAAG,OAAO,CAAC;AAEvE,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,QAAQ;IAEtC;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM;IAyC9C;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM;IA0C9C,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM;IAQ/B,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM;CAmBhC"}
|
|
@@ -1,21 +1,78 @@
|
|
|
1
1
|
/* eslint-disable no-magic-numbers */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
3
|
+
import { ThemeManager } from '../theme/theme-manager';
|
|
3
4
|
import { pallete } from './pallete';
|
|
4
5
|
export class ColorPicker {
|
|
5
6
|
colorKey;
|
|
6
7
|
constructor(colorKey) {
|
|
7
8
|
this.colorKey = colorKey;
|
|
8
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Get RGB string for a color token or theme token
|
|
12
|
+
* @param color - Color token (e.g., 'blue-500') or theme token (e.g., 'primary', 'colors.primary')
|
|
13
|
+
* @returns RGB string format 'rgb(r, g, b)'
|
|
14
|
+
*/
|
|
9
15
|
static rgb(color) {
|
|
16
|
+
// First check if it's a theme token (with or without colors. prefix)
|
|
17
|
+
const colorPath = color.includes('.') ? color : `colors.${color}`;
|
|
18
|
+
if (ThemeManager.hasToken(colorPath)) {
|
|
19
|
+
const themeValue = ThemeManager.getToken(colorPath);
|
|
20
|
+
if (themeValue) {
|
|
21
|
+
// Recursively resolve the theme token
|
|
22
|
+
const resolved = ThemeManager.resolveToken(themeValue);
|
|
23
|
+
return ColorPicker.rgb(resolved);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// Fallback: check if it's a direct theme token (backwards compatibility)
|
|
27
|
+
if (ThemeManager.hasToken(color)) {
|
|
28
|
+
const themeValue = ThemeManager.getToken(color);
|
|
29
|
+
if (themeValue) {
|
|
30
|
+
const resolved = ThemeManager.resolveToken(themeValue);
|
|
31
|
+
return ColorPicker.rgb(resolved);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Handle direct color tokens
|
|
10
35
|
const parts = color.split('-');
|
|
11
36
|
if (parts.length === 2) {
|
|
12
37
|
const colorKey = parts[0];
|
|
13
38
|
const shade = parts[1];
|
|
14
|
-
|
|
39
|
+
const colorValue = pallete[colorKey]?.[shade];
|
|
40
|
+
if (!colorValue) {
|
|
41
|
+
throw new Error(`Color token "${colorKey}-${shade}" not found`);
|
|
42
|
+
}
|
|
43
|
+
return colorValue;
|
|
44
|
+
}
|
|
45
|
+
const colorValue = pallete[color];
|
|
46
|
+
if (!colorValue) {
|
|
47
|
+
throw new Error(`Color token "${color}" not found`);
|
|
15
48
|
}
|
|
16
|
-
return
|
|
49
|
+
return colorValue;
|
|
17
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Get hex number for a color token or theme token
|
|
53
|
+
* @param color - Color token (e.g., 'blue-500') or theme token (e.g., 'primary', 'colors.primary')
|
|
54
|
+
* @returns Hex number format 0xRRGGBB
|
|
55
|
+
*/
|
|
18
56
|
static hex(color) {
|
|
57
|
+
// First check if it's a theme token (with or without colors. prefix)
|
|
58
|
+
const colorPath = color.includes('.') ? color : `colors.${color}`;
|
|
59
|
+
if (ThemeManager.hasToken(colorPath)) {
|
|
60
|
+
const themeValue = ThemeManager.getToken(colorPath);
|
|
61
|
+
if (themeValue) {
|
|
62
|
+
// Recursively resolve the theme token
|
|
63
|
+
const resolved = ThemeManager.resolveToken(themeValue);
|
|
64
|
+
return ColorPicker.hex(resolved);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Fallback: check if it's a direct theme token (backwards compatibility)
|
|
68
|
+
if (ThemeManager.hasToken(color)) {
|
|
69
|
+
const themeValue = ThemeManager.getToken(color);
|
|
70
|
+
if (themeValue) {
|
|
71
|
+
const resolved = ThemeManager.resolveToken(themeValue);
|
|
72
|
+
return ColorPicker.hex(resolved);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Handle direct color tokens
|
|
19
76
|
const parts = color.split('-');
|
|
20
77
|
if (parts.length === 2) {
|
|
21
78
|
const colorKey = parts[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.js","sourceRoot":"","sources":["../../src/color/color-picker.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,6DAA6D;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBpC,MAAM,OAAO,WAAW;IACF;IAApB,YAAoB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IAAG,CAAC;IAE1C,MAAM,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"color-picker.js","sourceRoot":"","sources":["../../src/color/color-picker.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,6DAA6D;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBpC,MAAM,OAAO,WAAW;IACF;IAApB,YAAoB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IAAG,CAAC;IAE1C;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,KAA0B;QACnC,qEAAqE;QACrE,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,EAAE,CAAC;QAElE,IAAI,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACrC,MAAM,UAAU,GAAG,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YACpD,IAAI,UAAU,EAAE,CAAC;gBACf,sCAAsC;gBACtC,MAAM,QAAQ,GAAG,YAAY,CAAC,YAAY,CA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AAC;QAED,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,CAAC;QAChC,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,CAAC;QAChC,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,CAAC;QAEhC,wCAAwC;QACxC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-magic-numbers */
|
|
2
2
|
/* eslint-disable max-lines-per-function */
|
|
3
3
|
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { createTheme, ThemeManager } from '../theme';
|
|
4
5
|
import { ColorPicker } from './color-picker';
|
|
5
6
|
describe('ColorPicker', () => {
|
|
6
7
|
it('should get the correct hex value for a shade', () => {
|
|
@@ -37,5 +38,23 @@ describe('ColorPicker', () => {
|
|
|
37
38
|
expect(ColorPicker.hex('slate-950')).toBe(0x020617);
|
|
38
39
|
expect(ColorPicker.hex('slate-800')).toBe(0x1e293b);
|
|
39
40
|
});
|
|
41
|
+
describe('with theme manager', () => {
|
|
42
|
+
const fakeTheme = createTheme({
|
|
43
|
+
colors: {
|
|
44
|
+
primary: 'red-500',
|
|
45
|
+
secondary: 'slate-50',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
ThemeManager.init(fakeTheme);
|
|
49
|
+
it('should get the correct hex in theme', () => {
|
|
50
|
+
expect(ColorPicker.rgb('colors.primary')).toBe('rgb(239, 68, 68)');
|
|
51
|
+
});
|
|
52
|
+
it('should get the correct hex in theme using color token', () => {
|
|
53
|
+
expect(ColorPicker.rgb('colors.secondary')).toBe('rgb(248, 250, 252)');
|
|
54
|
+
});
|
|
55
|
+
it('should throw an error if the color token is not found', () => {
|
|
56
|
+
expect(() => ColorPicker.rgb('colors.not-found')).toThrow('Color token "colors.not-found" not found');
|
|
57
|
+
});
|
|
58
|
+
});
|
|
40
59
|
});
|
|
41
60
|
//# sourceMappingURL=color-picker.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.spec.js","sourceRoot":"","sources":["../../src/color/color-picker.spec.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,2CAA2C;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAgC,MAAM,gBAAgB,CAAC;AAE3E,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,IAAI,CAAC;QACN,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC;QACzB,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC;QAC1B,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC;QACzB,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC;QAC5B,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC;QACzB,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC;QACzB,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC;QACzB,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC;KAC3B,CAAC,CAAC,gCAAgC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC9D,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,KAAiB,CAAC,CAA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C,CAAC,OAAO,CACvD,0CAA0C,CAC3C,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example usage of Phaser Wind with nested theme structure
|
|
3
|
+
* This file demonstrates the new complex theme system
|
|
4
|
+
*/
|
|
5
|
+
import Phaser from 'phaser';
|
|
6
|
+
import { type BaseThemeConfig } from '..';
|
|
7
|
+
export declare const createGameTheme: () => BaseThemeConfig;
|
|
8
|
+
export declare class AdvancedGameScene extends Phaser.Scene {
|
|
9
|
+
create(): void;
|
|
10
|
+
private createBackground;
|
|
11
|
+
private createHUD;
|
|
12
|
+
private createStatBar;
|
|
13
|
+
private createGameElements;
|
|
14
|
+
private createItem;
|
|
15
|
+
private createUI;
|
|
16
|
+
private createButton;
|
|
17
|
+
}
|
|
18
|
+
export declare const demonstrateThemeSwitching: () => void;
|
|
19
|
+
export declare const demonstrateAPIUsage: () => void;
|
|
20
|
+
export declare class ThemedButton {
|
|
21
|
+
private background;
|
|
22
|
+
private text;
|
|
23
|
+
constructor(scene: Phaser.Scene, x: number, y: number, label: string, variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'error');
|
|
24
|
+
private onHover;
|
|
25
|
+
private onLeave;
|
|
26
|
+
private onClick;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=nested-theme-example.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-theme-example.d.ts","sourceRoot":"","sources":["../../src/examples/nested-theme-example.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAWL,KAAK,eAAe,EACrB,MAAM,IAAI,CAAC;AAGZ,eAAO,MAAM,eAAe,QAAO,eA4G/B,CAAC;AAGL,qBAAa,iBAAkB,SAAQ,MAAM,CAAC,KAAK;IACjD,MAAM,IAAI,IAAI;IAWd,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,SAAS;IA8BjB,OAAO,CAAC,aAAa;IAsCrB,OAAO,CAAC,kBAAkB;IAoC1B,OAAO,CAAC,UAAU;IAqBlB,OAAO,CAAC,QAAQ;IAqBhB,OAAO,CAAC,YAAY;CAgCrB;AAGD,eAAO,MAAM,yBAAyB,QAAO,IAyB5C,CAAC;AAGF,eAAO,MAAM,mBAAmB,QAAO,IAqCtC,CAAC;AAGF,qBAAa,YAAY;IACvB,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,IAAI,CAA0B;gBAGpC,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,OAAO,GACH,SAAS,GACT,WAAW,GACX,SAAS,GACT,SAAS,GACT,OAAmB;IAuBzB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,OAAO;CAGhB"}
|