@udixio/theme 1.1.0 → 1.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 (98) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/bin/main.ts +85 -0
  3. package/dist/API.d.ts +1 -0
  4. package/dist/API.d.ts.map +1 -1
  5. package/dist/bin.cjs +64 -0
  6. package/dist/bin.js +63 -0
  7. package/dist/browser.cjs +39 -0
  8. package/dist/browser.js +39 -0
  9. package/dist/color/color.manager.d.ts.map +1 -1
  10. package/dist/color/default-color.d.ts.map +1 -1
  11. package/dist/config/config.interface.d.ts.map +1 -0
  12. package/dist/config/define-config.d.ts.map +1 -0
  13. package/dist/config/index.d.ts +3 -0
  14. package/dist/config/index.d.ts.map +1 -0
  15. package/dist/config/index.node.d.ts +2 -0
  16. package/dist/config/index.node.d.ts.map +1 -0
  17. package/dist/config/resolver-config.d.ts +11 -0
  18. package/dist/config/resolver-config.d.ts.map +1 -0
  19. package/dist/define-config-B1QPKKY_.js +430 -0
  20. package/dist/define-config-BGgVazsr.cjs +429 -0
  21. package/dist/index.browser.d.ts +2 -0
  22. package/dist/index.browser.d.ts.map +1 -0
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.node.d.ts +4 -0
  26. package/dist/index.node.d.ts.map +1 -0
  27. package/dist/load-from-path-BSrT4DOj.js +39 -0
  28. package/dist/load-from-path-BuN8RpOs.cjs +78 -0
  29. package/dist/loader/index.d.ts +2 -0
  30. package/dist/loader/index.d.ts.map +1 -0
  31. package/dist/loader/index.node.d.ts +3 -0
  32. package/dist/loader/index.node.d.ts.map +1 -0
  33. package/dist/loader/load-from-path.d.ts +5 -0
  34. package/dist/loader/load-from-path.d.ts.map +1 -0
  35. package/dist/loader/loader.d.ts +3 -0
  36. package/dist/loader/loader.d.ts.map +1 -0
  37. package/dist/loader/unplugin.d.ts +16 -0
  38. package/dist/loader/unplugin.d.ts.map +1 -0
  39. package/dist/{index.js → loader-Bc0bstAD.js} +172 -661
  40. package/dist/{index.cjs → loader-YNN5hAF3.cjs} +148 -678
  41. package/dist/material-color-utilities/dynamic_color.d.ts +9 -15
  42. package/dist/material-color-utilities/dynamic_color.d.ts.map +1 -1
  43. package/dist/material-color-utilities/toneDeltaPair.d.ts +9 -2
  44. package/dist/material-color-utilities/toneDeltaPair.d.ts.map +1 -1
  45. package/dist/node.cjs +191 -0
  46. package/dist/node.js +170 -0
  47. package/dist/plugin/plugin.api.d.ts +1 -1
  48. package/dist/plugin/plugin.api.d.ts.map +1 -1
  49. package/dist/theme/scheme.d.ts +1 -1
  50. package/dist/theme/scheme.d.ts.map +1 -1
  51. package/dist/theme/variants/fidelity.variant.d.ts +3 -0
  52. package/dist/theme/variants/fidelity.variant.d.ts.map +1 -0
  53. package/dist/theme/variants/index.d.ts +1 -0
  54. package/dist/theme/variants/index.d.ts.map +1 -1
  55. package/package.json +27 -10
  56. package/src/API.ts +4 -0
  57. package/src/color/color.manager.ts +10 -8
  58. package/src/color/default-color.ts +82 -34
  59. package/src/config/index.node.ts +1 -0
  60. package/src/{adapter → config}/index.ts +0 -1
  61. package/src/config/resolver-config.ts +49 -0
  62. package/src/index.browser.ts +1 -0
  63. package/src/index.node.ts +3 -0
  64. package/src/index.ts +2 -2
  65. package/src/loader/index.node.ts +2 -0
  66. package/src/loader/index.ts +1 -0
  67. package/src/loader/load-from-path.ts +9 -0
  68. package/src/{adapter/adapter.abstract.ts → loader/loader.ts} +23 -28
  69. package/src/loader/unplugin.ts +158 -0
  70. package/src/material-color-utilities/dynamic_color.ts +18 -120
  71. package/src/material-color-utilities/toneDeltaPair.ts +91 -2
  72. package/src/plugin/plugin.api.ts +4 -4
  73. package/src/theme/scheme.ts +7 -1
  74. package/src/theme/variants/fidelity.variant.ts +38 -0
  75. package/src/theme/variants/index.ts +2 -0
  76. package/vite.config.ts +18 -4
  77. package/dist/adapter/adapter.abstract.d.ts +0 -10
  78. package/dist/adapter/adapter.abstract.d.ts.map +0 -1
  79. package/dist/adapter/config.interface.d.ts.map +0 -1
  80. package/dist/adapter/define-config.d.ts.map +0 -1
  81. package/dist/adapter/file-adapter.mixin.d.ts +0 -18
  82. package/dist/adapter/file-adapter.mixin.d.ts.map +0 -1
  83. package/dist/adapter/index.d.ts +0 -4
  84. package/dist/adapter/index.d.ts.map +0 -1
  85. package/dist/adapters/index.d.ts +0 -3
  86. package/dist/adapters/index.d.ts.map +0 -1
  87. package/dist/adapters/node.adapter.d.ts +0 -7
  88. package/dist/adapters/node.adapter.d.ts.map +0 -1
  89. package/dist/adapters/vite.adapter.d.ts +0 -3
  90. package/dist/adapters/vite.adapter.d.ts.map +0 -1
  91. package/src/adapter/file-adapter.mixin.ts +0 -72
  92. package/src/adapters/index.ts +0 -2
  93. package/src/adapters/node.adapter.ts +0 -57
  94. package/src/adapters/vite.adapter.ts +0 -79
  95. /package/dist/{adapter → config}/config.interface.d.ts +0 -0
  96. /package/dist/{adapter → config}/define-config.d.ts +0 -0
  97. /package/src/{adapter → config}/config.interface.ts +0 -0
  98. /package/src/{adapter → config}/define-config.ts +0 -0
@@ -0,0 +1,429 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ const loader = require("./loader-YNN5hAF3.cjs");
6
+ const materialColorUtilities = require("@material/material-color-utilities");
7
+ const getExpressiveNeutralHue = (sourceColorHct) => {
8
+ const hue = loader.getRotatedHue(
9
+ sourceColorHct,
10
+ [0, 71, 124, 253, 278, 300, 360],
11
+ [10, 0, 10, 0, 10, 0]
12
+ );
13
+ return hue;
14
+ };
15
+ const getExpressiveNeutralChroma = (sourceColorHct, isDark) => {
16
+ const neutralHue = getExpressiveNeutralHue(sourceColorHct);
17
+ return isDark ? loader.Hct.isYellow(neutralHue) ? 6 : 14 : 18;
18
+ };
19
+ const expressiveVariant = {
20
+ name: "expressive",
21
+ palettes: {
22
+ primary: ({ sourceColorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, isDark ? 36 : 48),
23
+ secondary: ({ sourceColorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
24
+ loader.getRotatedHue(
25
+ sourceColorHct,
26
+ [0, 105, 140, 204, 253, 278, 300, 333, 360],
27
+ [-160, 155, -100, 96, -96, -156, -165, -160]
28
+ ),
29
+ isDark ? 16 : 24
30
+ ),
31
+ tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
32
+ loader.getRotatedHue(
33
+ sourceColorHct,
34
+ [0, 105, 140, 204, 253, 278, 300, 333, 360],
35
+ [-165, 160, -105, 101, -101, -160, -170, -165]
36
+ ),
37
+ 48
38
+ ),
39
+ neutral: ({ sourceColorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
40
+ getExpressiveNeutralHue(sourceColorHct),
41
+ getExpressiveNeutralChroma(sourceColorHct, isDark)
42
+ ),
43
+ neutralVariant: ({ sourceColorHct, isDark }) => {
44
+ const expressiveNeutralHue = getExpressiveNeutralHue(sourceColorHct);
45
+ const expressiveNeutralChroma = getExpressiveNeutralChroma(
46
+ sourceColorHct,
47
+ isDark
48
+ );
49
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(
50
+ expressiveNeutralHue,
51
+ expressiveNeutralChroma * (expressiveNeutralHue >= 105 && expressiveNeutralHue < 125 ? 1.6 : 2.3)
52
+ );
53
+ },
54
+ error: ({ sourceColorHct }) => {
55
+ const errorHue = loader.getPiecewiseHue(
56
+ sourceColorHct,
57
+ [0, 3, 13, 23, 33, 43, 153, 273, 360],
58
+ [12, 22, 32, 12, 22, 32, 22, 12]
59
+ );
60
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 64);
61
+ }
62
+ },
63
+ customPalettes: ({ colorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
64
+ loader.getRotatedHue(
65
+ colorHct,
66
+ [0, 105, 140, 204, 253, 278, 300, 333, 360],
67
+ [-160, 155, -100, 96, -96, -156, -165, -160]
68
+ ),
69
+ isDark ? 16 : 24
70
+ )
71
+ };
72
+ const neutralVariant = {
73
+ name: "neutral",
74
+ palettes: {
75
+ primary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
76
+ sourceColorHct.hue,
77
+ loader.Hct.isBlue(sourceColorHct.hue) ? 12 : 8
78
+ ),
79
+ secondary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
80
+ sourceColorHct.hue,
81
+ loader.Hct.isBlue(sourceColorHct.hue) ? 6 : 4
82
+ ),
83
+ tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
84
+ loader.getRotatedHue(
85
+ sourceColorHct,
86
+ [0, 38, 105, 161, 204, 278, 333, 360],
87
+ [-32, 26, 10, -39, 24, -15, -32]
88
+ ),
89
+ 20
90
+ ),
91
+ neutral: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 1.4),
92
+ neutralVariant: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 1.4 * 2.2),
93
+ error: ({ sourceColorHct }) => {
94
+ const errorHue = loader.getPiecewiseHue(
95
+ sourceColorHct,
96
+ [0, 3, 13, 23, 33, 43, 153, 273, 360],
97
+ [12, 22, 32, 12, 22, 32, 22, 12]
98
+ );
99
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 50);
100
+ }
101
+ },
102
+ customPalettes: ({ colorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
103
+ colorHct.hue,
104
+ loader.Hct.isBlue(colorHct.hue) ? 6 : 4
105
+ )
106
+ };
107
+ const getVibrantNeutralHue = (sourceColorHct) => {
108
+ return loader.getRotatedHue(
109
+ sourceColorHct,
110
+ [0, 38, 105, 140, 333, 360],
111
+ [-14, 10, -14, 10, -14]
112
+ );
113
+ };
114
+ const getVibrantNeutralChroma = (sourceColorHct) => {
115
+ getVibrantNeutralHue(sourceColorHct);
116
+ return 28;
117
+ };
118
+ const vibrantVariant = {
119
+ name: "vibrant",
120
+ palettes: {
121
+ primary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 74),
122
+ secondary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
123
+ loader.getRotatedHue(
124
+ sourceColorHct,
125
+ [0, 38, 105, 140, 333, 360],
126
+ [-14, 10, -14, 10, -14]
127
+ ),
128
+ 56
129
+ ),
130
+ tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
131
+ loader.getRotatedHue(
132
+ sourceColorHct,
133
+ [0, 38, 71, 105, 140, 161, 253, 333, 360],
134
+ [-72, 35, 24, -24, 62, 50, 62, -72]
135
+ ),
136
+ 56
137
+ ),
138
+ neutral: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
139
+ getVibrantNeutralHue(sourceColorHct),
140
+ getVibrantNeutralChroma(sourceColorHct)
141
+ ),
142
+ neutralVariant: ({ sourceColorHct }) => {
143
+ const vibrantNeutralHue = getVibrantNeutralHue(sourceColorHct);
144
+ const vibrantNeutralChroma = getVibrantNeutralChroma(sourceColorHct);
145
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(
146
+ vibrantNeutralHue,
147
+ vibrantNeutralChroma * 1.29
148
+ );
149
+ },
150
+ error: ({ sourceColorHct }) => {
151
+ const errorHue = loader.getPiecewiseHue(
152
+ sourceColorHct,
153
+ [0, 3, 13, 23, 33, 43, 153, 273, 360],
154
+ [12, 22, 32, 12, 22, 32, 22, 12]
155
+ );
156
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 80);
157
+ }
158
+ },
159
+ customPalettes: ({ colorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
160
+ loader.getRotatedHue(
161
+ colorHct,
162
+ [0, 38, 105, 140, 333, 360],
163
+ [-14, 10, -14, 10, -14]
164
+ ),
165
+ 56
166
+ )
167
+ };
168
+ const fidelityVariant = {
169
+ name: "fidelity",
170
+ palettes: {
171
+ primary: ({ sourceColorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, sourceColorHct.chroma),
172
+ secondary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
173
+ sourceColorHct.hue,
174
+ sourceColorHct.chroma * 0.5
175
+ ),
176
+ tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
177
+ loader.getRotatedHue(
178
+ sourceColorHct,
179
+ [0, 20, 71, 161, 333, 360],
180
+ [-40, 48, -32, 40, -32]
181
+ ),
182
+ sourceColorHct.chroma
183
+ ),
184
+ neutral: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5),
185
+ neutralVariant: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5 * 1.7),
186
+ error: ({ sourceColorHct }) => {
187
+ const errorHue = loader.getPiecewiseHue(
188
+ sourceColorHct,
189
+ [0, 3, 13, 23, 33, 43, 153, 273, 360],
190
+ [12, 22, 32, 12, 22, 32, 22, 12]
191
+ );
192
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 60);
193
+ }
194
+ },
195
+ customPalettes: ({ colorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(colorHct.hue, colorHct.chroma)
196
+ };
197
+ const Variants = {
198
+ Expressive: expressiveVariant,
199
+ Neutral: neutralVariant,
200
+ TonalSpot: loader.tonalSpotVariant,
201
+ Vibrant: vibrantVariant,
202
+ Fidelity: fidelityVariant
203
+ };
204
+ class PluginAbstract {
205
+ constructor(options) {
206
+ __publicField(this, "options");
207
+ __publicField(this, "pluginInstance");
208
+ this.options = options;
209
+ }
210
+ init(api) {
211
+ var _a, _b;
212
+ this.pluginInstance = new this.pluginClass(api, this.options);
213
+ (_b = (_a = this.pluginInstance).onInit) == null ? void 0 : _b.call(_a);
214
+ return this;
215
+ }
216
+ getInstance() {
217
+ if (!this.pluginInstance) {
218
+ throw new Error(`Plugin ${this.name} is not initialized`);
219
+ }
220
+ return this.pluginInstance;
221
+ }
222
+ }
223
+ class PluginImplAbstract {
224
+ constructor(api, options) {
225
+ var _a;
226
+ this.api = api;
227
+ this.options = options;
228
+ (_a = this.onInit) == null ? void 0 : _a.call(this);
229
+ }
230
+ }
231
+ var FontFamily = /* @__PURE__ */ ((FontFamily2) => {
232
+ FontFamily2["Expressive"] = "expressive";
233
+ FontFamily2["Neutral"] = "neutral";
234
+ return FontFamily2;
235
+ })(FontFamily || {});
236
+ class FontPlugin extends PluginAbstract {
237
+ constructor() {
238
+ super(...arguments);
239
+ __publicField(this, "dependencies", []);
240
+ __publicField(this, "name", "font");
241
+ __publicField(this, "pluginClass", FontPluginImpl);
242
+ }
243
+ }
244
+ class FontPluginImpl extends PluginImplAbstract {
245
+ constructor() {
246
+ super(...arguments);
247
+ __publicField(this, "_fontFamily");
248
+ __publicField(this, "_fontStyles");
249
+ }
250
+ get fontFamily() {
251
+ if (!this._fontFamily) throw new Error("Font family not initialized");
252
+ return this._fontFamily;
253
+ }
254
+ set fontFamily(value) {
255
+ this._fontFamily = value;
256
+ }
257
+ get fontStyles() {
258
+ if (!this._fontStyles) throw new Error("Font styles not initialized");
259
+ return this._fontStyles;
260
+ }
261
+ set fontStyles(value) {
262
+ this._fontStyles = value;
263
+ }
264
+ getFonts() {
265
+ return {
266
+ fontStyles: this.fontStyles,
267
+ fontFamily: this.fontFamily
268
+ };
269
+ }
270
+ onInit() {
271
+ var _a, _b, _c, _d;
272
+ this.fontFamily = {
273
+ expressive: ((_b = (_a = this.options) == null ? void 0 : _a.fontFamily) == null ? void 0 : _b.expressive) ?? [
274
+ "Roboto",
275
+ "sans-serif"
276
+ ],
277
+ neutral: ((_d = (_c = this.options) == null ? void 0 : _c.fontFamily) == null ? void 0 : _d.neutral) ?? ["Roboto", "sans-serif"]
278
+ };
279
+ this.fontStyles = {
280
+ display: {
281
+ large: {
282
+ fontWeight: 400,
283
+ fontSize: 3.5625,
284
+ lineHeight: 4,
285
+ letterSpacing: -0.015625,
286
+ fontFamily: "expressive"
287
+ /* Expressive */
288
+ },
289
+ medium: {
290
+ fontWeight: 400,
291
+ fontSize: 2.8125,
292
+ lineHeight: 3.25,
293
+ fontFamily: "expressive"
294
+ /* Expressive */
295
+ },
296
+ small: {
297
+ fontWeight: 400,
298
+ fontSize: 2.25,
299
+ lineHeight: 2.75,
300
+ fontFamily: "expressive"
301
+ /* Expressive */
302
+ }
303
+ },
304
+ headline: {
305
+ large: {
306
+ fontWeight: 400,
307
+ fontSize: 2,
308
+ lineHeight: 2.5,
309
+ fontFamily: "expressive"
310
+ /* Expressive */
311
+ },
312
+ medium: {
313
+ fontWeight: 400,
314
+ fontSize: 1.75,
315
+ lineHeight: 2.25,
316
+ fontFamily: "expressive"
317
+ /* Expressive */
318
+ },
319
+ small: {
320
+ fontWeight: 400,
321
+ fontSize: 1.5,
322
+ lineHeight: 2,
323
+ fontFamily: "expressive"
324
+ /* Expressive */
325
+ }
326
+ },
327
+ title: {
328
+ large: {
329
+ fontWeight: 400,
330
+ fontSize: 1.375,
331
+ lineHeight: 1.75,
332
+ fontFamily: "neutral"
333
+ /* Neutral */
334
+ },
335
+ medium: {
336
+ fontWeight: 500,
337
+ fontSize: 1,
338
+ lineHeight: 1.5,
339
+ fontFamily: "neutral",
340
+ letterSpacing: 9375e-6
341
+ },
342
+ small: {
343
+ fontWeight: 500,
344
+ fontSize: 0.875,
345
+ lineHeight: 1.25,
346
+ fontFamily: "neutral",
347
+ letterSpacing: 625e-5
348
+ }
349
+ },
350
+ label: {
351
+ large: {
352
+ fontWeight: 500,
353
+ fontSize: 0.875,
354
+ lineHeight: 1.25,
355
+ fontFamily: "neutral",
356
+ letterSpacing: 625e-5
357
+ },
358
+ medium: {
359
+ fontWeight: 500,
360
+ fontSize: 0.75,
361
+ lineHeight: 1,
362
+ fontFamily: "neutral",
363
+ letterSpacing: 0.03125
364
+ },
365
+ small: {
366
+ fontWeight: 500,
367
+ fontSize: 0.6875,
368
+ lineHeight: 1,
369
+ fontFamily: "neutral",
370
+ letterSpacing: 0.03125
371
+ }
372
+ },
373
+ body: {
374
+ large: {
375
+ fontWeight: 400,
376
+ fontSize: 1,
377
+ lineHeight: 1.5625,
378
+ fontFamily: "neutral",
379
+ letterSpacing: 0.03125
380
+ },
381
+ medium: {
382
+ fontWeight: 400,
383
+ fontSize: 0.875,
384
+ lineHeight: 1.25,
385
+ fontFamily: "neutral",
386
+ letterSpacing: 0.015625
387
+ },
388
+ small: {
389
+ fontWeight: 400,
390
+ fontSize: 0.75,
391
+ lineHeight: 1,
392
+ fontFamily: "neutral",
393
+ letterSpacing: 0.025
394
+ }
395
+ }
396
+ };
397
+ if (this.options && this.options.fontStyles)
398
+ Object.entries(this.options.fontStyles).forEach(([key, fontParam]) => {
399
+ const fontRole = key;
400
+ Object.entries(fontParam).forEach(([size, fontStyle]) => {
401
+ const fontSize = size;
402
+ if (fontStyle) {
403
+ this.fontStyles[fontRole][fontSize] = {
404
+ ...this.fontStyles[fontRole][fontSize],
405
+ ...fontStyle
406
+ };
407
+ }
408
+ });
409
+ });
410
+ }
411
+ }
412
+ function defineConfig(configObject) {
413
+ if (!configObject || typeof configObject !== "object") {
414
+ throw new Error("The configuration is missing or not an object");
415
+ }
416
+ if (!("sourceColor" in configObject)) {
417
+ throw new Error("Invalid configuration");
418
+ }
419
+ return configObject;
420
+ }
421
+ exports.FontFamily = FontFamily;
422
+ exports.FontPlugin = FontPlugin;
423
+ exports.PluginAbstract = PluginAbstract;
424
+ exports.PluginImplAbstract = PluginImplAbstract;
425
+ exports.Variants = Variants;
426
+ exports.defineConfig = defineConfig;
427
+ exports.expressiveVariant = expressiveVariant;
428
+ exports.neutralVariant = neutralVariant;
429
+ exports.vibrantVariant = vibrantVariant;
@@ -0,0 +1,2 @@
1
+ export * from './index';
2
+ //# sourceMappingURL=index.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
package/dist/index.d.ts CHANGED
@@ -2,11 +2,11 @@ export * from './app.container';
2
2
  export * from './app.module';
3
3
  export * from './API';
4
4
  export * from './color';
5
- export * from './adapter';
6
- export * from './adapters';
5
+ export * from './loader';
7
6
  export * from './bootstrap';
8
7
  export * from './material-color-utilities';
9
8
  export * from './plugin';
10
9
  export * from './plugins';
11
10
  export * from './theme';
11
+ export * from './config';
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './index';
2
+ export * from './loader/index.node';
3
+ export * from './config/index.node';
4
+ //# sourceMappingURL=index.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { l as loader } from "./loader-Bc0bstAD.js";
2
+ import * as fs from "node:fs";
3
+ async function resolveConfig(configPath = "./theme.config") {
4
+ const { createJiti } = await import("jiti");
5
+ const { resolve } = await import("pathe");
6
+ const jiti = createJiti(import.meta.url, {
7
+ debug: process.env.NODE_ENV === "development",
8
+ fsCache: true,
9
+ interopDefault: true
10
+ });
11
+ const tryPaths = [];
12
+ const resolvedInput = resolve(configPath);
13
+ const extMatch = /\.(ts|js|mjs|cjs)$/.exec(resolvedInput);
14
+ if (extMatch) {
15
+ tryPaths.push(resolvedInput);
16
+ } else {
17
+ for (const ext of [".ts", ".js", ".mjs", ".cjs"]) {
18
+ tryPaths.push(resolvedInput + ext);
19
+ }
20
+ }
21
+ for (const file of tryPaths) {
22
+ if (fs.existsSync(file)) {
23
+ const cfg = await jiti.import(file, {
24
+ default: true
25
+ });
26
+ return { config: cfg, filePath: file };
27
+ }
28
+ }
29
+ throw new Error(`Configuration file not found for ${""}{.ts,.js,.mjs,.cjs}`);
30
+ }
31
+ const loadFromPath = async (configPath = "./theme.config") => {
32
+ const { config, filePath } = await resolveConfig(configPath);
33
+ const api = await loader(config);
34
+ return { filePath, api };
35
+ };
36
+ export {
37
+ loadFromPath as l,
38
+ resolveConfig as r
39
+ };
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ const loader = require("./loader-YNN5hAF3.cjs");
25
+ const fs = require("node:fs");
26
+ var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
27
+ function _interopNamespaceDefault(e) {
28
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
29
+ if (e) {
30
+ for (const k in e) {
31
+ if (k !== "default") {
32
+ const d = Object.getOwnPropertyDescriptor(e, k);
33
+ Object.defineProperty(n, k, d.get ? d : {
34
+ enumerable: true,
35
+ get: () => e[k]
36
+ });
37
+ }
38
+ }
39
+ }
40
+ n.default = e;
41
+ return Object.freeze(n);
42
+ }
43
+ const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
44
+ async function resolveConfig(configPath = "./theme.config") {
45
+ const { createJiti } = await import("jiti");
46
+ const { resolve } = await import("pathe");
47
+ const jiti = createJiti(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("load-from-path-BuN8RpOs.cjs", document.baseURI).href, {
48
+ debug: process.env.NODE_ENV === "development",
49
+ fsCache: true,
50
+ interopDefault: true
51
+ });
52
+ const tryPaths = [];
53
+ const resolvedInput = resolve(configPath);
54
+ const extMatch = /\.(ts|js|mjs|cjs)$/.exec(resolvedInput);
55
+ if (extMatch) {
56
+ tryPaths.push(resolvedInput);
57
+ } else {
58
+ for (const ext of [".ts", ".js", ".mjs", ".cjs"]) {
59
+ tryPaths.push(resolvedInput + ext);
60
+ }
61
+ }
62
+ for (const file of tryPaths) {
63
+ if (fs__namespace.existsSync(file)) {
64
+ const cfg = await jiti.import(file, {
65
+ default: true
66
+ });
67
+ return { config: cfg, filePath: file };
68
+ }
69
+ }
70
+ throw new Error(`Configuration file not found for ${""}{.ts,.js,.mjs,.cjs}`);
71
+ }
72
+ const loadFromPath = async (configPath = "./theme.config") => {
73
+ const { config, filePath } = await resolveConfig(configPath);
74
+ const api = await loader.loader(config);
75
+ return { filePath, api };
76
+ };
77
+ exports.loadFromPath = loadFromPath;
78
+ exports.resolveConfig = resolveConfig;
@@ -0,0 +1,2 @@
1
+ export * from './loader';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loader/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './unplugin';
2
+ export * from './load-from-path';
3
+ //# sourceMappingURL=index.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../../src/loader/index.node.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const loadFromPath: (configPath?: string) => Promise<{
2
+ filePath: string;
3
+ api: import('..').API;
4
+ }>;
5
+ //# sourceMappingURL=load-from-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-from-path.d.ts","sourceRoot":"","sources":["../../src/loader/load-from-path.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GAAU,mBAA6B;;;EAK/D,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ConfigInterface } from '../config';
2
+ export declare const loader: (config: ConfigInterface) => Promise<import('..').API>;
3
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAU5C,eAAO,MAAM,MAAM,GAAU,QAAQ,eAAe,8BA2CnD,CAAC"}
@@ -0,0 +1,16 @@
1
+ export interface UdixioThemeOptions {
2
+ configPath?: string;
3
+ verbose?: boolean;
4
+ }
5
+ export declare const vitePlugin: (options?: UdixioThemeOptions) => Promise<any>;
6
+ export declare const webpackPlugin: (options?: UdixioThemeOptions) => Promise<any>;
7
+ export declare const rollupPlugin: (options?: UdixioThemeOptions) => Promise<any>;
8
+ export declare const esbuildPlugin: (options?: UdixioThemeOptions) => Promise<any>;
9
+ export declare const unpluginUdixioTheme: {
10
+ vite: (options?: UdixioThemeOptions) => Promise<any>;
11
+ webpack: (options?: UdixioThemeOptions) => Promise<any>;
12
+ rollup: (options?: UdixioThemeOptions) => Promise<any>;
13
+ esbuild: (options?: UdixioThemeOptions) => Promise<any>;
14
+ };
15
+ export default unpluginUdixioTheme;
16
+ //# sourceMappingURL=unplugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unplugin.d.ts","sourceRoot":"","sources":["../../src/loader/unplugin.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA2HD,eAAO,MAAM,UAAU,GAAU,UAAU,kBAAkB,iBAG5D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAU,UAAU,kBAAkB,iBAG/D,CAAC;AAEF,eAAO,MAAM,YAAY,GAAU,UAAU,kBAAkB,iBAG9D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAU,UAAU,kBAAkB,iBAG/D,CAAC;AAGF,eAAO,MAAM,mBAAmB;qBArBW,kBAAkB;wBAKf,kBAAkB;uBAKnB,kBAAkB;wBAKjB,kBAAkB;CAW/D,CAAC;AAGF,eAAe,mBAAmB,CAAC"}