@udixio/theme 1.1.0 → 1.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +25 -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 +40 -0
  8. package/dist/browser.js +40 -0
  9. package/dist/config/config.interface.d.ts.map +1 -0
  10. package/dist/config/define-config.d.ts.map +1 -0
  11. package/dist/config/index.d.ts +3 -0
  12. package/dist/config/index.d.ts.map +1 -0
  13. package/dist/config/index.node.d.ts +2 -0
  14. package/dist/config/index.node.d.ts.map +1 -0
  15. package/dist/config/resolver-config.d.ts +11 -0
  16. package/dist/config/resolver-config.d.ts.map +1 -0
  17. package/dist/define-config-BFo7Sy7c.cjs +399 -0
  18. package/dist/define-config-CGG8l3fb.js +400 -0
  19. package/dist/index.browser.d.ts +2 -0
  20. package/dist/index.browser.d.ts.map +1 -0
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.node.d.ts +4 -0
  24. package/dist/index.node.d.ts.map +1 -0
  25. package/dist/load-from-path-BvdfXUD0.cjs +78 -0
  26. package/dist/load-from-path-CFpw2P_Y.js +39 -0
  27. package/dist/loader/index.d.ts +2 -0
  28. package/dist/loader/index.d.ts.map +1 -0
  29. package/dist/loader/index.node.d.ts +3 -0
  30. package/dist/loader/index.node.d.ts.map +1 -0
  31. package/dist/loader/load-from-path.d.ts +5 -0
  32. package/dist/loader/load-from-path.d.ts.map +1 -0
  33. package/dist/loader/loader.d.ts +3 -0
  34. package/dist/loader/loader.d.ts.map +1 -0
  35. package/dist/loader/unplugin.d.ts +16 -0
  36. package/dist/loader/unplugin.d.ts.map +1 -0
  37. package/dist/{index.js → loader-C_BIrsO2.js} +58 -557
  38. package/dist/{index.cjs → loader-TksB6_mM.cjs} +32 -572
  39. package/dist/node.cjs +192 -0
  40. package/dist/node.js +171 -0
  41. package/dist/plugin/plugin.api.d.ts +1 -1
  42. package/dist/plugin/plugin.api.d.ts.map +1 -1
  43. package/package.json +27 -10
  44. package/src/API.ts +4 -0
  45. package/src/config/index.node.ts +1 -0
  46. package/src/{adapter → config}/index.ts +0 -1
  47. package/src/config/resolver-config.ts +49 -0
  48. package/src/index.browser.ts +1 -0
  49. package/src/index.node.ts +3 -0
  50. package/src/index.ts +2 -2
  51. package/src/loader/index.node.ts +2 -0
  52. package/src/loader/index.ts +1 -0
  53. package/src/loader/load-from-path.ts +9 -0
  54. package/src/{adapter/adapter.abstract.ts → loader/loader.ts} +27 -28
  55. package/src/loader/unplugin.ts +158 -0
  56. package/src/plugin/plugin.api.ts +4 -4
  57. package/vite.config.ts +18 -4
  58. package/dist/adapter/adapter.abstract.d.ts +0 -10
  59. package/dist/adapter/adapter.abstract.d.ts.map +0 -1
  60. package/dist/adapter/config.interface.d.ts.map +0 -1
  61. package/dist/adapter/define-config.d.ts.map +0 -1
  62. package/dist/adapter/file-adapter.mixin.d.ts +0 -18
  63. package/dist/adapter/file-adapter.mixin.d.ts.map +0 -1
  64. package/dist/adapter/index.d.ts +0 -4
  65. package/dist/adapter/index.d.ts.map +0 -1
  66. package/dist/adapters/index.d.ts +0 -3
  67. package/dist/adapters/index.d.ts.map +0 -1
  68. package/dist/adapters/node.adapter.d.ts +0 -7
  69. package/dist/adapters/node.adapter.d.ts.map +0 -1
  70. package/dist/adapters/vite.adapter.d.ts +0 -3
  71. package/dist/adapters/vite.adapter.d.ts.map +0 -1
  72. package/src/adapter/file-adapter.mixin.ts +0 -72
  73. package/src/adapters/index.ts +0 -2
  74. package/src/adapters/node.adapter.ts +0 -57
  75. package/src/adapters/vite.adapter.ts +0 -79
  76. /package/dist/{adapter → config}/config.interface.d.ts +0 -0
  77. /package/dist/{adapter → config}/define-config.d.ts +0 -0
  78. /package/src/{adapter → config}/config.interface.ts +0 -0
  79. /package/src/{adapter → config}/define-config.ts +0 -0
@@ -0,0 +1,400 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { q as getRotatedHue, p as getPiecewiseHue, H as Hct, t as tonalSpotVariant } from "./loader-C_BIrsO2.js";
5
+ import { TonalPalette } from "@material/material-color-utilities";
6
+ const getExpressiveNeutralHue = (sourceColorHct) => {
7
+ const hue = getRotatedHue(
8
+ sourceColorHct,
9
+ [0, 71, 124, 253, 278, 300, 360],
10
+ [10, 0, 10, 0, 10, 0]
11
+ );
12
+ return hue;
13
+ };
14
+ const getExpressiveNeutralChroma = (sourceColorHct, isDark) => {
15
+ const neutralHue = getExpressiveNeutralHue(sourceColorHct);
16
+ return isDark ? Hct.isYellow(neutralHue) ? 6 : 14 : 18;
17
+ };
18
+ const expressiveVariant = {
19
+ name: "expressive",
20
+ palettes: {
21
+ primary: ({ sourceColorHct, isDark }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, isDark ? 36 : 48),
22
+ secondary: ({ sourceColorHct, isDark }) => TonalPalette.fromHueAndChroma(
23
+ getRotatedHue(
24
+ sourceColorHct,
25
+ [0, 105, 140, 204, 253, 278, 300, 333, 360],
26
+ [-160, 155, -100, 96, -96, -156, -165, -160]
27
+ ),
28
+ isDark ? 16 : 24
29
+ ),
30
+ tertiary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(
31
+ getRotatedHue(
32
+ sourceColorHct,
33
+ [0, 105, 140, 204, 253, 278, 300, 333, 360],
34
+ [-165, 160, -105, 101, -101, -160, -170, -165]
35
+ ),
36
+ 48
37
+ ),
38
+ neutral: ({ sourceColorHct, isDark }) => TonalPalette.fromHueAndChroma(
39
+ getExpressiveNeutralHue(sourceColorHct),
40
+ getExpressiveNeutralChroma(sourceColorHct, isDark)
41
+ ),
42
+ neutralVariant: ({ sourceColorHct, isDark }) => {
43
+ const expressiveNeutralHue = getExpressiveNeutralHue(sourceColorHct);
44
+ const expressiveNeutralChroma = getExpressiveNeutralChroma(
45
+ sourceColorHct,
46
+ isDark
47
+ );
48
+ return TonalPalette.fromHueAndChroma(
49
+ expressiveNeutralHue,
50
+ expressiveNeutralChroma * (expressiveNeutralHue >= 105 && expressiveNeutralHue < 125 ? 1.6 : 2.3)
51
+ );
52
+ },
53
+ error: ({ sourceColorHct }) => {
54
+ const errorHue = getPiecewiseHue(
55
+ sourceColorHct,
56
+ [0, 3, 13, 23, 33, 43, 153, 273, 360],
57
+ [12, 22, 32, 12, 22, 32, 22, 12]
58
+ );
59
+ return TonalPalette.fromHueAndChroma(errorHue, 64);
60
+ }
61
+ },
62
+ customPalettes: ({ colorHct, isDark }) => TonalPalette.fromHueAndChroma(
63
+ getRotatedHue(
64
+ colorHct,
65
+ [0, 105, 140, 204, 253, 278, 300, 333, 360],
66
+ [-160, 155, -100, 96, -96, -156, -165, -160]
67
+ ),
68
+ isDark ? 16 : 24
69
+ )
70
+ };
71
+ const neutralVariant = {
72
+ name: "neutral",
73
+ palettes: {
74
+ primary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(
75
+ sourceColorHct.hue,
76
+ Hct.isBlue(sourceColorHct.hue) ? 12 : 8
77
+ ),
78
+ secondary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(
79
+ sourceColorHct.hue,
80
+ Hct.isBlue(sourceColorHct.hue) ? 6 : 4
81
+ ),
82
+ tertiary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(
83
+ getRotatedHue(
84
+ sourceColorHct,
85
+ [0, 38, 105, 161, 204, 278, 333, 360],
86
+ [-32, 26, 10, -39, 24, -15, -32]
87
+ ),
88
+ 20
89
+ ),
90
+ neutral: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, 1.4),
91
+ neutralVariant: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, 1.4 * 2.2),
92
+ error: ({ sourceColorHct }) => {
93
+ const errorHue = getPiecewiseHue(
94
+ sourceColorHct,
95
+ [0, 3, 13, 23, 33, 43, 153, 273, 360],
96
+ [12, 22, 32, 12, 22, 32, 22, 12]
97
+ );
98
+ return TonalPalette.fromHueAndChroma(errorHue, 50);
99
+ }
100
+ },
101
+ customPalettes: ({ colorHct }) => TonalPalette.fromHueAndChroma(
102
+ colorHct.hue,
103
+ Hct.isBlue(colorHct.hue) ? 6 : 4
104
+ )
105
+ };
106
+ const getVibrantNeutralHue = (sourceColorHct) => {
107
+ return getRotatedHue(
108
+ sourceColorHct,
109
+ [0, 38, 105, 140, 333, 360],
110
+ [-14, 10, -14, 10, -14]
111
+ );
112
+ };
113
+ const getVibrantNeutralChroma = (sourceColorHct) => {
114
+ getVibrantNeutralHue(sourceColorHct);
115
+ return 28;
116
+ };
117
+ const vibrantVariant = {
118
+ name: "vibrant",
119
+ palettes: {
120
+ primary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, 74),
121
+ secondary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(
122
+ getRotatedHue(
123
+ sourceColorHct,
124
+ [0, 38, 105, 140, 333, 360],
125
+ [-14, 10, -14, 10, -14]
126
+ ),
127
+ 56
128
+ ),
129
+ tertiary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(
130
+ getRotatedHue(
131
+ sourceColorHct,
132
+ [0, 38, 71, 105, 140, 161, 253, 333, 360],
133
+ [-72, 35, 24, -24, 62, 50, 62, -72]
134
+ ),
135
+ 56
136
+ ),
137
+ neutral: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(
138
+ getVibrantNeutralHue(sourceColorHct),
139
+ getVibrantNeutralChroma(sourceColorHct)
140
+ ),
141
+ neutralVariant: ({ sourceColorHct }) => {
142
+ const vibrantNeutralHue = getVibrantNeutralHue(sourceColorHct);
143
+ const vibrantNeutralChroma = getVibrantNeutralChroma(sourceColorHct);
144
+ return TonalPalette.fromHueAndChroma(
145
+ vibrantNeutralHue,
146
+ vibrantNeutralChroma * 1.29
147
+ );
148
+ },
149
+ error: ({ sourceColorHct }) => {
150
+ const errorHue = getPiecewiseHue(
151
+ sourceColorHct,
152
+ [0, 3, 13, 23, 33, 43, 153, 273, 360],
153
+ [12, 22, 32, 12, 22, 32, 22, 12]
154
+ );
155
+ return TonalPalette.fromHueAndChroma(errorHue, 80);
156
+ }
157
+ },
158
+ customPalettes: ({ colorHct }) => TonalPalette.fromHueAndChroma(
159
+ getRotatedHue(
160
+ colorHct,
161
+ [0, 38, 105, 140, 333, 360],
162
+ [-14, 10, -14, 10, -14]
163
+ ),
164
+ 56
165
+ )
166
+ };
167
+ const Variants = {
168
+ Expressive: expressiveVariant,
169
+ Neutral: neutralVariant,
170
+ TonalSpot: tonalSpotVariant,
171
+ Vibrant: vibrantVariant
172
+ };
173
+ class PluginAbstract {
174
+ constructor(options) {
175
+ __publicField(this, "options");
176
+ __publicField(this, "pluginInstance");
177
+ this.options = options;
178
+ }
179
+ init(api) {
180
+ var _a, _b;
181
+ this.pluginInstance = new this.pluginClass(api, this.options);
182
+ (_b = (_a = this.pluginInstance).onInit) == null ? void 0 : _b.call(_a);
183
+ return this;
184
+ }
185
+ getInstance() {
186
+ if (!this.pluginInstance) {
187
+ throw new Error(`Plugin ${this.name} is not initialized`);
188
+ }
189
+ return this.pluginInstance;
190
+ }
191
+ }
192
+ class PluginImplAbstract {
193
+ constructor(api, options) {
194
+ var _a;
195
+ this.api = api;
196
+ this.options = options;
197
+ (_a = this.onInit) == null ? void 0 : _a.call(this);
198
+ }
199
+ }
200
+ var FontFamily = /* @__PURE__ */ ((FontFamily2) => {
201
+ FontFamily2["Expressive"] = "expressive";
202
+ FontFamily2["Neutral"] = "neutral";
203
+ return FontFamily2;
204
+ })(FontFamily || {});
205
+ class FontPlugin extends PluginAbstract {
206
+ constructor() {
207
+ super(...arguments);
208
+ __publicField(this, "dependencies", []);
209
+ __publicField(this, "name", "font");
210
+ __publicField(this, "pluginClass", FontPluginImpl);
211
+ }
212
+ }
213
+ class FontPluginImpl extends PluginImplAbstract {
214
+ constructor() {
215
+ super(...arguments);
216
+ __publicField(this, "_fontFamily");
217
+ __publicField(this, "_fontStyles");
218
+ }
219
+ get fontFamily() {
220
+ if (!this._fontFamily) throw new Error("Font family not initialized");
221
+ return this._fontFamily;
222
+ }
223
+ set fontFamily(value) {
224
+ this._fontFamily = value;
225
+ }
226
+ get fontStyles() {
227
+ if (!this._fontStyles) throw new Error("Font styles not initialized");
228
+ return this._fontStyles;
229
+ }
230
+ set fontStyles(value) {
231
+ this._fontStyles = value;
232
+ }
233
+ getFonts() {
234
+ return {
235
+ fontStyles: this.fontStyles,
236
+ fontFamily: this.fontFamily
237
+ };
238
+ }
239
+ onInit() {
240
+ var _a, _b, _c, _d;
241
+ this.fontFamily = {
242
+ expressive: ((_b = (_a = this.options) == null ? void 0 : _a.fontFamily) == null ? void 0 : _b.expressive) ?? [
243
+ "Roboto",
244
+ "sans-serif"
245
+ ],
246
+ neutral: ((_d = (_c = this.options) == null ? void 0 : _c.fontFamily) == null ? void 0 : _d.neutral) ?? ["Roboto", "sans-serif"]
247
+ };
248
+ this.fontStyles = {
249
+ display: {
250
+ large: {
251
+ fontWeight: 400,
252
+ fontSize: 3.5625,
253
+ lineHeight: 4,
254
+ letterSpacing: -0.015625,
255
+ fontFamily: "expressive"
256
+ /* Expressive */
257
+ },
258
+ medium: {
259
+ fontWeight: 400,
260
+ fontSize: 2.8125,
261
+ lineHeight: 3.25,
262
+ fontFamily: "expressive"
263
+ /* Expressive */
264
+ },
265
+ small: {
266
+ fontWeight: 400,
267
+ fontSize: 2.25,
268
+ lineHeight: 2.75,
269
+ fontFamily: "expressive"
270
+ /* Expressive */
271
+ }
272
+ },
273
+ headline: {
274
+ large: {
275
+ fontWeight: 400,
276
+ fontSize: 2,
277
+ lineHeight: 2.5,
278
+ fontFamily: "expressive"
279
+ /* Expressive */
280
+ },
281
+ medium: {
282
+ fontWeight: 400,
283
+ fontSize: 1.75,
284
+ lineHeight: 2.25,
285
+ fontFamily: "expressive"
286
+ /* Expressive */
287
+ },
288
+ small: {
289
+ fontWeight: 400,
290
+ fontSize: 1.5,
291
+ lineHeight: 2,
292
+ fontFamily: "expressive"
293
+ /* Expressive */
294
+ }
295
+ },
296
+ title: {
297
+ large: {
298
+ fontWeight: 400,
299
+ fontSize: 1.375,
300
+ lineHeight: 1.75,
301
+ fontFamily: "neutral"
302
+ /* Neutral */
303
+ },
304
+ medium: {
305
+ fontWeight: 500,
306
+ fontSize: 1,
307
+ lineHeight: 1.5,
308
+ fontFamily: "neutral",
309
+ letterSpacing: 9375e-6
310
+ },
311
+ small: {
312
+ fontWeight: 500,
313
+ fontSize: 0.875,
314
+ lineHeight: 1.25,
315
+ fontFamily: "neutral",
316
+ letterSpacing: 625e-5
317
+ }
318
+ },
319
+ label: {
320
+ large: {
321
+ fontWeight: 500,
322
+ fontSize: 0.875,
323
+ lineHeight: 1.25,
324
+ fontFamily: "neutral",
325
+ letterSpacing: 625e-5
326
+ },
327
+ medium: {
328
+ fontWeight: 500,
329
+ fontSize: 0.75,
330
+ lineHeight: 1,
331
+ fontFamily: "neutral",
332
+ letterSpacing: 0.03125
333
+ },
334
+ small: {
335
+ fontWeight: 500,
336
+ fontSize: 0.6875,
337
+ lineHeight: 1,
338
+ fontFamily: "neutral",
339
+ letterSpacing: 0.03125
340
+ }
341
+ },
342
+ body: {
343
+ large: {
344
+ fontWeight: 400,
345
+ fontSize: 1,
346
+ lineHeight: 1.5625,
347
+ fontFamily: "neutral",
348
+ letterSpacing: 0.03125
349
+ },
350
+ medium: {
351
+ fontWeight: 400,
352
+ fontSize: 0.875,
353
+ lineHeight: 1.25,
354
+ fontFamily: "neutral",
355
+ letterSpacing: 0.015625
356
+ },
357
+ small: {
358
+ fontWeight: 400,
359
+ fontSize: 0.75,
360
+ lineHeight: 1,
361
+ fontFamily: "neutral",
362
+ letterSpacing: 0.025
363
+ }
364
+ }
365
+ };
366
+ if (this.options && this.options.fontStyles)
367
+ Object.entries(this.options.fontStyles).forEach(([key, fontParam]) => {
368
+ const fontRole = key;
369
+ Object.entries(fontParam).forEach(([size, fontStyle]) => {
370
+ const fontSize = size;
371
+ if (fontStyle) {
372
+ this.fontStyles[fontRole][fontSize] = {
373
+ ...this.fontStyles[fontRole][fontSize],
374
+ ...fontStyle
375
+ };
376
+ }
377
+ });
378
+ });
379
+ }
380
+ }
381
+ function defineConfig(configObject) {
382
+ if (!configObject || typeof configObject !== "object") {
383
+ throw new Error("The configuration is missing or not an object");
384
+ }
385
+ if (!("sourceColor" in configObject)) {
386
+ throw new Error("Invalid configuration");
387
+ }
388
+ return configObject;
389
+ }
390
+ export {
391
+ FontFamily as F,
392
+ PluginAbstract as P,
393
+ Variants as V,
394
+ PluginImplAbstract as a,
395
+ FontPlugin as b,
396
+ defineConfig as d,
397
+ expressiveVariant as e,
398
+ neutralVariant as n,
399
+ vibrantVariant as v
400
+ };
@@ -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,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-TksB6_mM.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-BvdfXUD0.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,39 @@
1
+ import { l as loader } from "./loader-C_BIrsO2.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,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,8BA+CnD,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"}