phaser-wind 0.2.0 → 0.3.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.
Files changed (113) hide show
  1. package/README.md +124 -135
  2. package/dist/core/color.d.ts +287 -0
  3. package/dist/core/color.d.ts.map +1 -0
  4. package/dist/core/color.js +386 -0
  5. package/dist/core/color.js.map +1 -0
  6. package/dist/core/color.spec.d.ts +2 -0
  7. package/dist/core/color.spec.d.ts.map +1 -0
  8. package/dist/core/color.spec.js +252 -0
  9. package/dist/core/color.spec.js.map +1 -0
  10. package/dist/core/font-size.d.ts +34 -0
  11. package/dist/core/font-size.d.ts.map +1 -0
  12. package/dist/core/font-size.js +68 -0
  13. package/dist/core/font-size.js.map +1 -0
  14. package/dist/core/font-size.spec.d.ts +2 -0
  15. package/dist/core/font-size.spec.d.ts.map +1 -0
  16. package/dist/core/font-size.spec.js +73 -0
  17. package/dist/core/font-size.spec.js.map +1 -0
  18. package/dist/{font/font-picker.d.ts → core/font.d.ts} +22 -21
  19. package/dist/core/font.d.ts.map +1 -0
  20. package/dist/{font/font-picker.js → core/font.js} +28 -62
  21. package/dist/core/font.js.map +1 -0
  22. package/dist/core/font.spec.d.ts +2 -0
  23. package/dist/core/font.spec.d.ts.map +1 -0
  24. package/dist/core/font.spec.js +84 -0
  25. package/dist/core/font.spec.js.map +1 -0
  26. package/dist/core/index.d.ts +8 -0
  27. package/dist/core/index.d.ts.map +1 -0
  28. package/dist/core/index.js +8 -0
  29. package/dist/core/index.js.map +1 -0
  30. package/dist/{color → core}/pallete.d.ts.map +1 -1
  31. package/dist/core/pallete.js.map +1 -0
  32. package/dist/core/radius.d.ts +34 -0
  33. package/dist/core/radius.d.ts.map +1 -0
  34. package/dist/core/radius.js +46 -0
  35. package/dist/core/radius.js.map +1 -0
  36. package/dist/core/radius.spec.d.ts +2 -0
  37. package/dist/core/radius.spec.d.ts.map +1 -0
  38. package/dist/core/radius.spec.js +61 -0
  39. package/dist/core/radius.spec.js.map +1 -0
  40. package/dist/core/shadow.d.ts +23 -0
  41. package/dist/core/shadow.d.ts.map +1 -0
  42. package/dist/core/shadow.js +23 -0
  43. package/dist/core/shadow.js.map +1 -0
  44. package/dist/core/spacing.d.ts +39 -0
  45. package/dist/core/spacing.d.ts.map +1 -0
  46. package/dist/core/spacing.js +82 -0
  47. package/dist/core/spacing.js.map +1 -0
  48. package/dist/core/spacing.spec.d.ts +2 -0
  49. package/dist/core/spacing.spec.d.ts.map +1 -0
  50. package/dist/core/spacing.spec.js +49 -0
  51. package/dist/core/spacing.spec.js.map +1 -0
  52. package/dist/font/index.d.ts +2 -2
  53. package/dist/font/index.d.ts.map +1 -1
  54. package/dist/font/index.js +2 -2
  55. package/dist/font/index.js.map +1 -1
  56. package/dist/index.d.ts +2 -1
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +2 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/theme/theme-config.d.ts +31 -95
  61. package/dist/theme/theme-config.d.ts.map +1 -1
  62. package/dist/theme/theme-config.js +12 -52
  63. package/dist/theme/theme-config.js.map +1 -1
  64. package/dist/theme/theme-manager.d.ts +18 -6
  65. package/dist/theme/theme-manager.d.ts.map +1 -1
  66. package/dist/theme/theme-manager.js +25 -6
  67. package/dist/theme/theme-manager.js.map +1 -1
  68. package/dist/utils/index.d.ts +2 -0
  69. package/dist/utils/index.d.ts.map +1 -0
  70. package/dist/utils/index.js +2 -0
  71. package/dist/utils/index.js.map +1 -0
  72. package/dist/utils/is-valid-color.d.ts +13 -0
  73. package/dist/utils/is-valid-color.d.ts.map +1 -0
  74. package/dist/utils/is-valid-color.js +32 -0
  75. package/dist/utils/is-valid-color.js.map +1 -0
  76. package/dist/utils/is-valid-color.spec.d.ts +2 -0
  77. package/dist/utils/is-valid-color.spec.d.ts.map +1 -0
  78. package/dist/utils/is-valid-color.spec.js +82 -0
  79. package/dist/utils/is-valid-color.spec.js.map +1 -0
  80. package/package.json +5 -3
  81. package/dist/color/color-picker.d.ts +0 -23
  82. package/dist/color/color-picker.d.ts.map +0 -1
  83. package/dist/color/color-picker.js +0 -118
  84. package/dist/color/color-picker.js.map +0 -1
  85. package/dist/color/color-picker.spec.d.ts +0 -2
  86. package/dist/color/color-picker.spec.d.ts.map +0 -1
  87. package/dist/color/color-picker.spec.js +0 -60
  88. package/dist/color/color-picker.spec.js.map +0 -1
  89. package/dist/color/index.d.ts +0 -3
  90. package/dist/color/index.d.ts.map +0 -1
  91. package/dist/color/index.js +0 -3
  92. package/dist/color/index.js.map +0 -1
  93. package/dist/color/pallete.js.map +0 -1
  94. package/dist/examples/nested-theme-example.d.ts +0 -28
  95. package/dist/examples/nested-theme-example.d.ts.map +0 -1
  96. package/dist/examples/nested-theme-example.js +0 -313
  97. package/dist/examples/nested-theme-example.js.map +0 -1
  98. package/dist/examples/usage-example.d.ts +0 -17
  99. package/dist/examples/usage-example.d.ts.map +0 -1
  100. package/dist/examples/usage-example.js +0 -158
  101. package/dist/examples/usage-example.js.map +0 -1
  102. package/dist/font/font-picker.d.ts.map +0 -1
  103. package/dist/font/font-picker.js.map +0 -1
  104. package/dist/font/font-size-picker.d.ts +0 -19
  105. package/dist/font/font-size-picker.d.ts.map +0 -1
  106. package/dist/font/font-size-picker.js +0 -24
  107. package/dist/font/font-size-picker.js.map +0 -1
  108. package/dist/font/font-size-picker.spec.d.ts +0 -2
  109. package/dist/font/font-size-picker.spec.d.ts.map +0 -1
  110. package/dist/font/font-size-picker.spec.js +0 -48
  111. package/dist/font/font-size-picker.spec.js.map +0 -1
  112. /package/dist/{color → core}/pallete.d.ts +0 -0
  113. /package/dist/{color → core}/pallete.js +0 -0
@@ -0,0 +1,287 @@
1
+ import { pallete } from './pallete';
2
+ export type ColorKey = keyof typeof pallete;
3
+ export type ShadeKey = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | '950';
4
+ export type ColorToken = `${ColorKey}-${ShadeKey}` | 'black' | 'white';
5
+ /**
6
+ * Color utility functions
7
+ */
8
+ export declare const Color: {
9
+ readonly getValueFromTheme: (key: ColorToken | string) => string | null;
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
+ */
15
+ readonly rgb: (color: ColorToken | string) => string;
16
+ /**
17
+ * Get hex number for a color token or theme token
18
+ * @param color - Color token (e.g., 'blue-500') or theme token (e.g., 'primary', 'colors.primary')
19
+ * @returns Hex number format 0xRRGGBB
20
+ */
21
+ readonly hex: (color: ColorToken) => number;
22
+ /**
23
+ * Get RGB color value for slate color with specified shade
24
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
25
+ * @returns RGB color value in format 'rgb(R, G, B)'
26
+ */
27
+ readonly slate: (shade: ShadeKey) => string;
28
+ /**
29
+ * Get RGB color value for gray color with specified shade
30
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
31
+ * @returns RGB color value in format 'rgb(R, G, B)'
32
+ */
33
+ readonly gray: (shade: ShadeKey) => string;
34
+ /**
35
+ * Get RGB color value for zinc color with specified shade
36
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
37
+ * @returns RGB color value in format 'rgb(R, G, B)'
38
+ */
39
+ readonly zinc: (shade: ShadeKey) => string;
40
+ /**
41
+ * Get RGB color value for neutral color with specified shade
42
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
43
+ * @returns RGB color value in format 'rgb(R, G, B)'
44
+ */
45
+ readonly neutral: (shade: ShadeKey) => string;
46
+ /**
47
+ * Get hex number for slate color with specified shade
48
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
49
+ * @returns Hex number format 0xRRGGBB
50
+ */
51
+ readonly slateHex: (shade: ShadeKey) => number;
52
+ /**
53
+ * Get hex number for gray color with specified shade
54
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
55
+ * @returns Hex number format 0xRRGGBB
56
+ */
57
+ readonly grayHex: (shade: ShadeKey) => number;
58
+ /**
59
+ * Get hex number for zinc color with specified shade
60
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
61
+ * @returns Hex number format 0xRRGGBB
62
+ */
63
+ readonly zincHex: (shade: ShadeKey) => number;
64
+ /**
65
+ * Get hex number for neutral color with specified shade
66
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
67
+ * @returns Hex number format 0xRRGGBB
68
+ */
69
+ readonly neutralHex: (shade: ShadeKey) => number;
70
+ /**
71
+ * Get RGB color value for stone color with specified shade
72
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
73
+ * @returns RGB color value in format 'rgb(R, G, B)'
74
+ */
75
+ readonly stone: (shade: ShadeKey) => string;
76
+ /**
77
+ * Get RGB color value for red color with specified shade
78
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
79
+ * @returns RGB color value in format 'rgb(R, G, B)'
80
+ */
81
+ readonly red: (shade: ShadeKey) => string;
82
+ /**
83
+ * Get RGB color value for orange color with specified shade
84
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
85
+ * @returns RGB color value in format 'rgb(R, G, B)'
86
+ */
87
+ readonly orange: (shade: ShadeKey) => string;
88
+ /**
89
+ * Get RGB color value for amber color with specified shade
90
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
91
+ * @returns RGB color value in format 'rgb(R, G, B)'
92
+ */
93
+ readonly amber: (shade: ShadeKey) => string;
94
+ /**
95
+ * Get RGB color value for yellow color with specified shade
96
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
97
+ * @returns RGB color value in format 'rgb(R, G, B)'
98
+ */
99
+ readonly yellow: (shade: ShadeKey) => string;
100
+ /**
101
+ * Get RGB color value for lime color with specified shade
102
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
103
+ * @returns RGB color value in format 'rgb(R, G, B)'
104
+ */
105
+ readonly lime: (shade: ShadeKey) => string;
106
+ /**
107
+ * Get RGB color value for green color with specified shade
108
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
109
+ * @returns RGB color value in format 'rgb(R, G, B)'
110
+ */
111
+ readonly green: (shade: ShadeKey) => string;
112
+ /**
113
+ * Get RGB color value for emerald color with specified shade
114
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
115
+ * @returns RGB color value in format 'rgb(R, G, B)'
116
+ */
117
+ readonly emerald: (shade: ShadeKey) => string;
118
+ /**
119
+ * Get RGB color value for teal color with specified shade
120
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
121
+ * @returns RGB color value in format 'rgb(R, G, B)'
122
+ */
123
+ readonly teal: (shade: ShadeKey) => string;
124
+ /**
125
+ * Get RGB color value for cyan color with specified shade
126
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
127
+ * @returns RGB color value in format 'rgb(R, G, B)'
128
+ */
129
+ readonly cyan: (shade: ShadeKey) => string;
130
+ /**
131
+ * Get RGB color value for sky color with specified shade
132
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
133
+ * @returns RGB color value in format 'rgb(R, G, B)'
134
+ */
135
+ readonly sky: (shade: ShadeKey) => string;
136
+ /**
137
+ * Get RGB color value for blue color with specified shade
138
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
139
+ * @returns RGB color value in format 'rgb(R, G, B)'
140
+ */
141
+ readonly blue: (shade: ShadeKey) => string;
142
+ /**
143
+ * Get RGB color value for indigo color with specified shade
144
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
145
+ * @returns RGB color value in format 'rgb(R, G, B)'
146
+ */
147
+ readonly indigo: (shade: ShadeKey) => string;
148
+ /**
149
+ * Get RGB color value for violet color with specified shade
150
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
151
+ * @returns RGB color value in format 'rgb(R, G, B)'
152
+ */
153
+ readonly violet: (shade: ShadeKey) => string;
154
+ /**
155
+ * Get RGB color value for purple color with specified shade
156
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
157
+ * @returns RGB color value in format 'rgb(R, G, B)'
158
+ */
159
+ readonly purple: (shade: ShadeKey) => string;
160
+ /**
161
+ * Get RGB color value for fuchsia color with specified shade
162
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
163
+ * @returns RGB color value in format 'rgb(R, G, B)'
164
+ */
165
+ readonly fuchsia: (shade: ShadeKey) => string;
166
+ /**
167
+ * Get RGB color value for pink color with specified shade
168
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
169
+ * @returns RGB color value in format 'rgb(R, G, B)'
170
+ */
171
+ readonly pink: (shade: ShadeKey) => string;
172
+ /**
173
+ * Get RGB color value for rose color with specified shade
174
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
175
+ * @returns RGB color value in format 'rgb(R, G, B)'
176
+ */
177
+ readonly rose: (shade: ShadeKey) => string;
178
+ /**
179
+ * Get hex number for stone color with specified shade
180
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
181
+ * @returns Hex number format 0xRRGGBB
182
+ */
183
+ readonly stoneHex: (shade: ShadeKey) => number;
184
+ /**
185
+ * Get hex number for red color with specified shade
186
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
187
+ * @returns Hex number format 0xRRGGBB
188
+ */
189
+ readonly redHex: (shade: ShadeKey) => number;
190
+ /**
191
+ * Get hex number for orange color with specified shade
192
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
193
+ * @returns Hex number format 0xRRGGBB
194
+ */
195
+ readonly orangeHex: (shade: ShadeKey) => number;
196
+ /**
197
+ * Get hex number for amber color with specified shade
198
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
199
+ * @returns Hex number format 0xRRGGBB
200
+ */
201
+ readonly amberHex: (shade: ShadeKey) => number;
202
+ /**
203
+ * Get hex number for yellow color with specified shade
204
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
205
+ * @returns Hex number format 0xRRGGBB
206
+ */
207
+ readonly yellowHex: (shade: ShadeKey) => number;
208
+ /**
209
+ * Get hex number for lime color with specified shade
210
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
211
+ * @returns Hex number format 0xRRGGBB
212
+ */
213
+ readonly limeHex: (shade: ShadeKey) => number;
214
+ /**
215
+ * Get hex number for green color with specified shade
216
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
217
+ * @returns Hex number format 0xRRGGBB
218
+ */
219
+ readonly greenHex: (shade: ShadeKey) => number;
220
+ /**
221
+ * Get hex number for emerald color with specified shade
222
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
223
+ * @returns Hex number format 0xRRGGBB
224
+ */
225
+ readonly emeraldHex: (shade: ShadeKey) => number;
226
+ /**
227
+ * Get hex number for teal color with specified shade
228
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
229
+ * @returns Hex number format 0xRRGGBB
230
+ */
231
+ readonly tealHex: (shade: ShadeKey) => number;
232
+ /**
233
+ * Get hex number for cyan color with specified shade
234
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
235
+ * @returns Hex number format 0xRRGGBB
236
+ */
237
+ readonly cyanHex: (shade: ShadeKey) => number;
238
+ /**
239
+ * Get hex number for sky color with specified shade
240
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
241
+ * @returns Hex number format 0xRRGGBB
242
+ */
243
+ readonly skyHex: (shade: ShadeKey) => number;
244
+ /**
245
+ * Get hex number for blue color with specified shade
246
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
247
+ * @returns Hex number format 0xRRGGBB
248
+ */
249
+ readonly blueHex: (shade: ShadeKey) => number;
250
+ /**
251
+ * Get hex number for indigo color with specified shade
252
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
253
+ * @returns Hex number format 0xRRGGBB
254
+ */
255
+ readonly indigoHex: (shade: ShadeKey) => number;
256
+ /**
257
+ * Get hex number for violet color with specified shade
258
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
259
+ * @returns Hex number format 0xRRGGBB
260
+ */
261
+ readonly violetHex: (shade: ShadeKey) => number;
262
+ /**
263
+ * Get hex number for purple color with specified shade
264
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
265
+ * @returns Hex number format 0xRRGGBB
266
+ */
267
+ readonly purpleHex: (shade: ShadeKey) => number;
268
+ /**
269
+ * Get hex number for fuchsia color with specified shade
270
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
271
+ * @returns Hex number format 0xRRGGBB
272
+ */
273
+ readonly fuchsiaHex: (shade: ShadeKey) => number;
274
+ /**
275
+ * Get hex number for pink color with specified shade
276
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
277
+ * @returns Hex number format 0xRRGGBB
278
+ */
279
+ readonly pinkHex: (shade: ShadeKey) => number;
280
+ /**
281
+ * Get hex number for rose color with specified shade
282
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
283
+ * @returns Hex number format 0xRRGGBB
284
+ */
285
+ readonly roseHex: (shade: ShadeKey) => number;
286
+ };
287
+ //# sourceMappingURL=color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/core/color.ts"],"names":[],"mappings":"AAKA,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;AAEV,MAAM,MAAM,UAAU,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,GAAG,OAAO,GAAG,OAAO,CAAC;AAgDvE;;GAEG;AACH,eAAO,MAAM,KAAK;sCACS,UAAU,GAAG,MAAM,KAAG,MAAM,GAAG,IAAI;IAQ5D;;;;OAIG;0BACU,UAAU,GAAG,MAAM,KAAG,MAAM;IAiCzC;;;;OAIG;0BACU,UAAU,KAAG,MAAM;IA8BhC;;;;OAIG;4BACY,QAAQ;IAEvB;;;;OAIG;2BACW,QAAQ;IAEtB;;;;OAIG;2BACW,QAAQ;IAEtB;;;;OAIG;8BACc,QAAQ;IAEzB;;;;OAIG;+BACe,QAAQ;IAE1B;;;;OAIG;8BACc,QAAQ;IAEzB;;;;OAIG;8BACc,QAAQ;IAEzB;;;;OAIG;iCACiB,QAAQ;IAE5B;;;;OAIG;4BACY,QAAQ;IAEvB;;;;OAIG;0BACU,QAAQ;IAErB;;;;OAIG;6BACa,QAAQ;IAExB;;;;OAIG;4BACY,QAAQ;IAEvB;;;;OAIG;6BACa,QAAQ;IAExB;;;;OAIG;2BACW,QAAQ;IAEtB;;;;OAIG;4BACY,QAAQ;IAEvB;;;;OAIG;8BACc,QAAQ;IAEzB;;;;OAIG;2BACW,QAAQ;IAEtB;;;;OAIG;2BACW,QAAQ;IAEtB;;;;OAIG;0BACU,QAAQ;IAErB;;;;OAIG;2BACW,QAAQ;IAEtB;;;;OAIG;6BACa,QAAQ;IAExB;;;;OAIG;6BACa,QAAQ;IAExB;;;;OAIG;6BACa,QAAQ;IAExB;;;;OAIG;8BACc,QAAQ;IAEzB;;;;OAIG;2BACW,QAAQ;IAEtB;;;;OAIG;2BACW,QAAQ;IAEtB;;;;OAIG;+BACe,QAAQ;IAE1B;;;;OAIG;6BACa,QAAQ;IAExB;;;;OAIG;gCACgB,QAAQ;IAE3B;;;;OAIG;+BACe,QAAQ;IAE1B;;;;OAIG;gCACgB,QAAQ;IAE3B;;;;OAIG;8BACc,QAAQ;IAEzB;;;;OAIG;+BACe,QAAQ;IAE1B;;;;OAIG;iCACiB,QAAQ;IAE5B;;;;OAIG;8BACc,QAAQ;IAEzB;;;;OAIG;8BACc,QAAQ;IAEzB;;;;OAIG;6BACa,QAAQ;IAExB;;;;OAIG;8BACc,QAAQ;IAEzB;;;;OAIG;gCACgB,QAAQ;IAE3B;;;;OAIG;gCACgB,QAAQ;IAE3B;;;;OAIG;gCACgB,QAAQ;IAE3B;;;;OAIG;iCACiB,QAAQ;IAE5B;;;;OAIG;8BACc,QAAQ;IAEzB;;;;OAIG;8BACc,QAAQ;CACjB,CAAC"}
@@ -0,0 +1,386 @@
1
+ /* eslint-disable no-magic-numbers */
2
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
3
+ import { ThemeManager } from '../theme/theme-manager';
4
+ import { isValidColor } from '../utils';
5
+ import { pallete } from './pallete';
6
+ /**
7
+ * Convert hex color value to number
8
+ * @param hexValue - Hex color value (e.g., '#ff0000')
9
+ * @returns Number representation of hex color
10
+ */
11
+ const convertHexToNumber = (hexValue) => {
12
+ const hex = hexValue.slice(1);
13
+ if (hex.length === 3) {
14
+ const r = parseInt(hex[0] + hex[0], 16);
15
+ const g = parseInt(hex[1] + hex[1], 16);
16
+ const b = parseInt(hex[2] + hex[2], 16);
17
+ return (r << 16) + (g << 8) + b;
18
+ }
19
+ return parseInt(hex, 16);
20
+ };
21
+ /**
22
+ * Convert RGB color value to number
23
+ * @param rgbValue - RGB color value (e.g., 'rgb(255, 0, 0)')
24
+ * @returns Number representation of RGB color
25
+ */
26
+ const convertRgbToNumber = (rgbValue) => {
27
+ const matches = rgbValue.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
28
+ if (!matches) {
29
+ throw new Error(`Invalid RGB format: ${rgbValue}`);
30
+ }
31
+ const r = parseInt(matches[1]);
32
+ const g = parseInt(matches[2]);
33
+ const b = parseInt(matches[3]);
34
+ return (r << 16) + (g << 8) + b;
35
+ };
36
+ /**
37
+ * Convert color value to number
38
+ * @param colorValue - Color value (e.g., '#ff0000' or 'rgb(255, 0, 0)')
39
+ * @returns Number representation of color
40
+ */
41
+ const convertColorValueToNumber = (colorValue) => {
42
+ if (colorValue.startsWith('#')) {
43
+ return convertHexToNumber(colorValue);
44
+ }
45
+ return convertRgbToNumber(colorValue);
46
+ };
47
+ /**
48
+ * Color utility functions
49
+ */
50
+ export const Color = {
51
+ getValueFromTheme: (key) => {
52
+ const value = ThemeManager.getToken(`colors.${key}`);
53
+ if (value === undefined) {
54
+ return null;
55
+ }
56
+ return value;
57
+ },
58
+ /**
59
+ * Get RGB string for a color token or theme token
60
+ * @param color - Color token (e.g., 'blue-500') or theme token (e.g., 'primary', 'colors.primary')
61
+ * @returns RGB string format 'rgb(r, g, b)'
62
+ */
63
+ rgb: (color) => {
64
+ const colorFromTheme = Color.getValueFromTheme(color);
65
+ if (colorFromTheme) {
66
+ return Color.rgb(colorFromTheme);
67
+ }
68
+ // If the color is not a theme token, it must be a color token
69
+ const parts = color.split('-');
70
+ if (parts.length === 2) {
71
+ const colorKey = parts[0];
72
+ const shade = parts[1];
73
+ const colorValue = pallete[colorKey]?.[shade];
74
+ if (!colorValue) {
75
+ if (isValidColor(color)) {
76
+ return color;
77
+ }
78
+ throw new Error(`Color token "${colorKey}-${shade}" not found`);
79
+ }
80
+ return colorValue;
81
+ }
82
+ const colorValue = pallete[color];
83
+ if (!colorValue) {
84
+ if (isValidColor(color)) {
85
+ return color;
86
+ }
87
+ throw new Error(`Color token "${color}" not found`);
88
+ }
89
+ return colorValue;
90
+ },
91
+ /**
92
+ * Get hex number for a color token or theme token
93
+ * @param color - Color token (e.g., 'blue-500') or theme token (e.g., 'primary', 'colors.primary')
94
+ * @returns Hex number format 0xRRGGBB
95
+ */
96
+ hex: (color) => {
97
+ const colorFromTheme = Color.getValueFromTheme(color);
98
+ if (colorFromTheme) {
99
+ return Color.hex(colorFromTheme);
100
+ }
101
+ // If the color is not a theme token, it must be a color token
102
+ const parts = color.split('-');
103
+ if (parts.length === 2) {
104
+ const colorKey = parts[0];
105
+ const shade = parts[1];
106
+ const colorValue = pallete[colorKey]?.[shade];
107
+ if (!colorValue) {
108
+ if (isValidColor(color)) {
109
+ return convertColorValueToNumber(color);
110
+ }
111
+ throw new Error(`Color token "${colorKey}-${shade}" not found`);
112
+ }
113
+ return convertColorValueToNumber(colorValue);
114
+ }
115
+ const colorToConvert = pallete[color];
116
+ if (isValidColor(colorToConvert)) {
117
+ return convertColorValueToNumber(colorToConvert);
118
+ }
119
+ throw new Error(`Color token "${color}" not found`);
120
+ },
121
+ /**
122
+ * Get RGB color value for slate color with specified shade
123
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
124
+ * @returns RGB color value in format 'rgb(R, G, B)'
125
+ */
126
+ slate: (shade) => Color.rgb(`slate-${shade}`),
127
+ /**
128
+ * Get RGB color value for gray color with specified shade
129
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
130
+ * @returns RGB color value in format 'rgb(R, G, B)'
131
+ */
132
+ gray: (shade) => Color.rgb(`gray-${shade}`),
133
+ /**
134
+ * Get RGB color value for zinc color with specified shade
135
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
136
+ * @returns RGB color value in format 'rgb(R, G, B)'
137
+ */
138
+ zinc: (shade) => Color.rgb(`zinc-${shade}`),
139
+ /**
140
+ * Get RGB color value for neutral color with specified shade
141
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
142
+ * @returns RGB color value in format 'rgb(R, G, B)'
143
+ */
144
+ neutral: (shade) => Color.rgb(`neutral-${shade}`),
145
+ /**
146
+ * Get hex number for slate color with specified shade
147
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
148
+ * @returns Hex number format 0xRRGGBB
149
+ */
150
+ slateHex: (shade) => Color.hex(`slate-${shade}`),
151
+ /**
152
+ * Get hex number for gray color with specified shade
153
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
154
+ * @returns Hex number format 0xRRGGBB
155
+ */
156
+ grayHex: (shade) => Color.hex(`gray-${shade}`),
157
+ /**
158
+ * Get hex number for zinc color with specified shade
159
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
160
+ * @returns Hex number format 0xRRGGBB
161
+ */
162
+ zincHex: (shade) => Color.hex(`zinc-${shade}`),
163
+ /**
164
+ * Get hex number for neutral color with specified shade
165
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
166
+ * @returns Hex number format 0xRRGGBB
167
+ */
168
+ neutralHex: (shade) => Color.hex(`neutral-${shade}`),
169
+ /**
170
+ * Get RGB color value for stone color with specified shade
171
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
172
+ * @returns RGB color value in format 'rgb(R, G, B)'
173
+ */
174
+ stone: (shade) => Color.rgb(`stone-${shade}`),
175
+ /**
176
+ * Get RGB color value for red color with specified shade
177
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
178
+ * @returns RGB color value in format 'rgb(R, G, B)'
179
+ */
180
+ red: (shade) => Color.rgb(`red-${shade}`),
181
+ /**
182
+ * Get RGB color value for orange color with specified shade
183
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
184
+ * @returns RGB color value in format 'rgb(R, G, B)'
185
+ */
186
+ orange: (shade) => Color.rgb(`orange-${shade}`),
187
+ /**
188
+ * Get RGB color value for amber color with specified shade
189
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
190
+ * @returns RGB color value in format 'rgb(R, G, B)'
191
+ */
192
+ amber: (shade) => Color.rgb(`amber-${shade}`),
193
+ /**
194
+ * Get RGB color value for yellow color with specified shade
195
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
196
+ * @returns RGB color value in format 'rgb(R, G, B)'
197
+ */
198
+ yellow: (shade) => Color.rgb(`yellow-${shade}`),
199
+ /**
200
+ * Get RGB color value for lime color with specified shade
201
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
202
+ * @returns RGB color value in format 'rgb(R, G, B)'
203
+ */
204
+ lime: (shade) => Color.rgb(`lime-${shade}`),
205
+ /**
206
+ * Get RGB color value for green color with specified shade
207
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
208
+ * @returns RGB color value in format 'rgb(R, G, B)'
209
+ */
210
+ green: (shade) => Color.rgb(`green-${shade}`),
211
+ /**
212
+ * Get RGB color value for emerald color with specified shade
213
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
214
+ * @returns RGB color value in format 'rgb(R, G, B)'
215
+ */
216
+ emerald: (shade) => Color.rgb(`emerald-${shade}`),
217
+ /**
218
+ * Get RGB color value for teal color with specified shade
219
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
220
+ * @returns RGB color value in format 'rgb(R, G, B)'
221
+ */
222
+ teal: (shade) => Color.rgb(`teal-${shade}`),
223
+ /**
224
+ * Get RGB color value for cyan color with specified shade
225
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
226
+ * @returns RGB color value in format 'rgb(R, G, B)'
227
+ */
228
+ cyan: (shade) => Color.rgb(`cyan-${shade}`),
229
+ /**
230
+ * Get RGB color value for sky color with specified shade
231
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
232
+ * @returns RGB color value in format 'rgb(R, G, B)'
233
+ */
234
+ sky: (shade) => Color.rgb(`sky-${shade}`),
235
+ /**
236
+ * Get RGB color value for blue color with specified shade
237
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
238
+ * @returns RGB color value in format 'rgb(R, G, B)'
239
+ */
240
+ blue: (shade) => Color.rgb(`blue-${shade}`),
241
+ /**
242
+ * Get RGB color value for indigo color with specified shade
243
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
244
+ * @returns RGB color value in format 'rgb(R, G, B)'
245
+ */
246
+ indigo: (shade) => Color.rgb(`indigo-${shade}`),
247
+ /**
248
+ * Get RGB color value for violet color with specified shade
249
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
250
+ * @returns RGB color value in format 'rgb(R, G, B)'
251
+ */
252
+ violet: (shade) => Color.rgb(`violet-${shade}`),
253
+ /**
254
+ * Get RGB color value for purple color with specified shade
255
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
256
+ * @returns RGB color value in format 'rgb(R, G, B)'
257
+ */
258
+ purple: (shade) => Color.rgb(`purple-${shade}`),
259
+ /**
260
+ * Get RGB color value for fuchsia color with specified shade
261
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
262
+ * @returns RGB color value in format 'rgb(R, G, B)'
263
+ */
264
+ fuchsia: (shade) => Color.rgb(`fuchsia-${shade}`),
265
+ /**
266
+ * Get RGB color value for pink color with specified shade
267
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
268
+ * @returns RGB color value in format 'rgb(R, G, B)'
269
+ */
270
+ pink: (shade) => Color.rgb(`pink-${shade}`),
271
+ /**
272
+ * Get RGB color value for rose color with specified shade
273
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
274
+ * @returns RGB color value in format 'rgb(R, G, B)'
275
+ */
276
+ rose: (shade) => Color.rgb(`rose-${shade}`),
277
+ /**
278
+ * Get hex number for stone color with specified shade
279
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
280
+ * @returns Hex number format 0xRRGGBB
281
+ */
282
+ stoneHex: (shade) => Color.hex(`stone-${shade}`),
283
+ /**
284
+ * Get hex number for red color with specified shade
285
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
286
+ * @returns Hex number format 0xRRGGBB
287
+ */
288
+ redHex: (shade) => Color.hex(`red-${shade}`),
289
+ /**
290
+ * Get hex number for orange color with specified shade
291
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
292
+ * @returns Hex number format 0xRRGGBB
293
+ */
294
+ orangeHex: (shade) => Color.hex(`orange-${shade}`),
295
+ /**
296
+ * Get hex number for amber color with specified shade
297
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
298
+ * @returns Hex number format 0xRRGGBB
299
+ */
300
+ amberHex: (shade) => Color.hex(`amber-${shade}`),
301
+ /**
302
+ * Get hex number for yellow color with specified shade
303
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
304
+ * @returns Hex number format 0xRRGGBB
305
+ */
306
+ yellowHex: (shade) => Color.hex(`yellow-${shade}`),
307
+ /**
308
+ * Get hex number for lime color with specified shade
309
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
310
+ * @returns Hex number format 0xRRGGBB
311
+ */
312
+ limeHex: (shade) => Color.hex(`lime-${shade}`),
313
+ /**
314
+ * Get hex number for green color with specified shade
315
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
316
+ * @returns Hex number format 0xRRGGBB
317
+ */
318
+ greenHex: (shade) => Color.hex(`green-${shade}`),
319
+ /**
320
+ * Get hex number for emerald color with specified shade
321
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
322
+ * @returns Hex number format 0xRRGGBB
323
+ */
324
+ emeraldHex: (shade) => Color.hex(`emerald-${shade}`),
325
+ /**
326
+ * Get hex number for teal color with specified shade
327
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
328
+ * @returns Hex number format 0xRRGGBB
329
+ */
330
+ tealHex: (shade) => Color.hex(`teal-${shade}`),
331
+ /**
332
+ * Get hex number for cyan color with specified shade
333
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
334
+ * @returns Hex number format 0xRRGGBB
335
+ */
336
+ cyanHex: (shade) => Color.hex(`cyan-${shade}`),
337
+ /**
338
+ * Get hex number for sky color with specified shade
339
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
340
+ * @returns Hex number format 0xRRGGBB
341
+ */
342
+ skyHex: (shade) => Color.hex(`sky-${shade}`),
343
+ /**
344
+ * Get hex number for blue color with specified shade
345
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
346
+ * @returns Hex number format 0xRRGGBB
347
+ */
348
+ blueHex: (shade) => Color.hex(`blue-${shade}`),
349
+ /**
350
+ * Get hex number for indigo color with specified shade
351
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
352
+ * @returns Hex number format 0xRRGGBB
353
+ */
354
+ indigoHex: (shade) => Color.hex(`indigo-${shade}`),
355
+ /**
356
+ * Get hex number for violet color with specified shade
357
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
358
+ * @returns Hex number format 0xRRGGBB
359
+ */
360
+ violetHex: (shade) => Color.hex(`violet-${shade}`),
361
+ /**
362
+ * Get hex number for purple color with specified shade
363
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
364
+ * @returns Hex number format 0xRRGGBB
365
+ */
366
+ purpleHex: (shade) => Color.hex(`purple-${shade}`),
367
+ /**
368
+ * Get hex number for fuchsia color with specified shade
369
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
370
+ * @returns Hex number format 0xRRGGBB
371
+ */
372
+ fuchsiaHex: (shade) => Color.hex(`fuchsia-${shade}`),
373
+ /**
374
+ * Get hex number for pink color with specified shade
375
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
376
+ * @returns Hex number format 0xRRGGBB
377
+ */
378
+ pinkHex: (shade) => Color.hex(`pink-${shade}`),
379
+ /**
380
+ * Get hex number for rose color with specified shade
381
+ * @param shade - Shade key (e.g., '50', '100', '200', etc.)
382
+ * @returns Hex number format 0xRRGGBB
383
+ */
384
+ roseHex: (shade) => Color.hex(`rose-${shade}`),
385
+ };
386
+ //# sourceMappingURL=color.js.map