@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.
- package/CHANGELOG.md +25 -0
- package/bin/main.ts +85 -0
- package/dist/API.d.ts +1 -0
- package/dist/API.d.ts.map +1 -1
- package/dist/bin.cjs +64 -0
- package/dist/bin.js +63 -0
- package/dist/browser.cjs +40 -0
- package/dist/browser.js +40 -0
- package/dist/config/config.interface.d.ts.map +1 -0
- package/dist/config/define-config.d.ts.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.node.d.ts +2 -0
- package/dist/config/index.node.d.ts.map +1 -0
- package/dist/config/resolver-config.d.ts +11 -0
- package/dist/config/resolver-config.d.ts.map +1 -0
- package/dist/define-config-BFo7Sy7c.cjs +399 -0
- package/dist/define-config-CGG8l3fb.js +400 -0
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.node.d.ts +4 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/load-from-path-BvdfXUD0.cjs +78 -0
- package/dist/load-from-path-CFpw2P_Y.js +39 -0
- package/dist/loader/index.d.ts +2 -0
- package/dist/loader/index.d.ts.map +1 -0
- package/dist/loader/index.node.d.ts +3 -0
- package/dist/loader/index.node.d.ts.map +1 -0
- package/dist/loader/load-from-path.d.ts +5 -0
- package/dist/loader/load-from-path.d.ts.map +1 -0
- package/dist/loader/loader.d.ts +3 -0
- package/dist/loader/loader.d.ts.map +1 -0
- package/dist/loader/unplugin.d.ts +16 -0
- package/dist/loader/unplugin.d.ts.map +1 -0
- package/dist/{index.js → loader-C_BIrsO2.js} +58 -557
- package/dist/{index.cjs → loader-TksB6_mM.cjs} +32 -572
- package/dist/node.cjs +192 -0
- package/dist/node.js +171 -0
- package/dist/plugin/plugin.api.d.ts +1 -1
- package/dist/plugin/plugin.api.d.ts.map +1 -1
- package/package.json +27 -10
- package/src/API.ts +4 -0
- package/src/config/index.node.ts +1 -0
- package/src/{adapter → config}/index.ts +0 -1
- package/src/config/resolver-config.ts +49 -0
- package/src/index.browser.ts +1 -0
- package/src/index.node.ts +3 -0
- package/src/index.ts +2 -2
- package/src/loader/index.node.ts +2 -0
- package/src/loader/index.ts +1 -0
- package/src/loader/load-from-path.ts +9 -0
- package/src/{adapter/adapter.abstract.ts → loader/loader.ts} +27 -28
- package/src/loader/unplugin.ts +158 -0
- package/src/plugin/plugin.api.ts +4 -4
- package/vite.config.ts +18 -4
- package/dist/adapter/adapter.abstract.d.ts +0 -10
- package/dist/adapter/adapter.abstract.d.ts.map +0 -1
- package/dist/adapter/config.interface.d.ts.map +0 -1
- package/dist/adapter/define-config.d.ts.map +0 -1
- package/dist/adapter/file-adapter.mixin.d.ts +0 -18
- package/dist/adapter/file-adapter.mixin.d.ts.map +0 -1
- package/dist/adapter/index.d.ts +0 -4
- package/dist/adapter/index.d.ts.map +0 -1
- package/dist/adapters/index.d.ts +0 -3
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/node.adapter.d.ts +0 -7
- package/dist/adapters/node.adapter.d.ts.map +0 -1
- package/dist/adapters/vite.adapter.d.ts +0 -3
- package/dist/adapters/vite.adapter.d.ts.map +0 -1
- package/src/adapter/file-adapter.mixin.ts +0 -72
- package/src/adapters/index.ts +0 -2
- package/src/adapters/node.adapter.ts +0 -57
- package/src/adapters/vite.adapter.ts +0 -79
- /package/dist/{adapter → config}/config.interface.d.ts +0 -0
- /package/dist/{adapter → config}/define-config.d.ts +0 -0
- /package/src/{adapter → config}/config.interface.ts +0 -0
- /package/src/{adapter → config}/define-config.ts +0 -0
package/dist/node.cjs
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
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
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
|
+
const loader = require("./loader-TksB6_mM.cjs");
|
|
26
|
+
const defineConfig = require("./define-config-BFo7Sy7c.cjs");
|
|
27
|
+
const loadFromPath = require("./load-from-path-BvdfXUD0.cjs");
|
|
28
|
+
let unpluginInstance = null;
|
|
29
|
+
const createUnpluginTheme = async () => {
|
|
30
|
+
if (unpluginInstance) {
|
|
31
|
+
return unpluginInstance;
|
|
32
|
+
}
|
|
33
|
+
const { createUnplugin } = await import("unplugin");
|
|
34
|
+
unpluginInstance = createUnplugin((options = {}) => {
|
|
35
|
+
const { configPath = "./theme.config", verbose = false } = options;
|
|
36
|
+
let resolvedConfigPath;
|
|
37
|
+
if (global.NX_GRAPH_CREATION) {
|
|
38
|
+
return {
|
|
39
|
+
name: "udixio-theme"
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const loadTheme = async () => {
|
|
43
|
+
try {
|
|
44
|
+
if (verbose) {
|
|
45
|
+
console.log(`🎨 Loading theme from: ${configPath}`);
|
|
46
|
+
}
|
|
47
|
+
const result = await loadFromPath.loadFromPath(configPath);
|
|
48
|
+
if (!resolvedConfigPath && (result == null ? void 0 : result.filePath)) {
|
|
49
|
+
resolvedConfigPath = result.filePath;
|
|
50
|
+
}
|
|
51
|
+
if (verbose) {
|
|
52
|
+
console.log(`✅ Theme loaded successfully!`);
|
|
53
|
+
}
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error(`❌ Theme loading failed:`, error);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
name: "udixio-theme",
|
|
61
|
+
// Hook appelé au début du build (tous les bundlers)
|
|
62
|
+
buildStart: async () => {
|
|
63
|
+
await loadTheme();
|
|
64
|
+
},
|
|
65
|
+
// Hook appelé pendant la génération (Rollup/Vite)
|
|
66
|
+
generateBundle: async () => {
|
|
67
|
+
await loadTheme();
|
|
68
|
+
},
|
|
69
|
+
// Support spécifique Vite pour HMR
|
|
70
|
+
vite: {
|
|
71
|
+
handleHotUpdate: async ({ server, file, modules }) => {
|
|
72
|
+
if (!resolvedConfigPath) {
|
|
73
|
+
const result = await loadFromPath.loadFromPath(configPath);
|
|
74
|
+
resolvedConfigPath = (result == null ? void 0 : result.filePath) || "";
|
|
75
|
+
}
|
|
76
|
+
if (resolvedConfigPath === file) {
|
|
77
|
+
if (verbose) {
|
|
78
|
+
console.log(`🔄 Theme config changed: ${file}`);
|
|
79
|
+
}
|
|
80
|
+
await loadTheme();
|
|
81
|
+
server.ws.send({ type: "full-reload", path: "*" });
|
|
82
|
+
return modules;
|
|
83
|
+
}
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
// Support spécifique Webpack pour HMR
|
|
88
|
+
webpack: (compiler) => {
|
|
89
|
+
if (compiler.options.mode === "development") {
|
|
90
|
+
compiler.hooks.watchRun.tapAsync(
|
|
91
|
+
"udixio-theme",
|
|
92
|
+
async (compilation, callback) => {
|
|
93
|
+
const changedFiles = compilation.modifiedFiles || /* @__PURE__ */ new Set();
|
|
94
|
+
if (!resolvedConfigPath) {
|
|
95
|
+
const result = await loadFromPath.loadFromPath(configPath);
|
|
96
|
+
resolvedConfigPath = (result == null ? void 0 : result.filePath) || "";
|
|
97
|
+
}
|
|
98
|
+
if (changedFiles.has(resolvedConfigPath)) {
|
|
99
|
+
if (verbose) {
|
|
100
|
+
console.log(`🔄 Theme config changed: ${resolvedConfigPath}`);
|
|
101
|
+
}
|
|
102
|
+
await loadTheme();
|
|
103
|
+
}
|
|
104
|
+
callback();
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
// Support spécifique Rollup
|
|
110
|
+
rollup: {
|
|
111
|
+
watchChange: async (id) => {
|
|
112
|
+
if (!resolvedConfigPath) {
|
|
113
|
+
const result = await loadFromPath.loadFromPath(configPath);
|
|
114
|
+
resolvedConfigPath = (result == null ? void 0 : result.filePath) || "";
|
|
115
|
+
}
|
|
116
|
+
if (resolvedConfigPath === id) {
|
|
117
|
+
if (verbose) {
|
|
118
|
+
console.log(`🔄 Theme config changed: ${id}`);
|
|
119
|
+
}
|
|
120
|
+
await loadTheme();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
return unpluginInstance;
|
|
127
|
+
};
|
|
128
|
+
const vitePlugin = async (options) => {
|
|
129
|
+
const plugin = await createUnpluginTheme();
|
|
130
|
+
return plugin.vite(options);
|
|
131
|
+
};
|
|
132
|
+
const webpackPlugin = async (options) => {
|
|
133
|
+
const plugin = await createUnpluginTheme();
|
|
134
|
+
return plugin.webpack(options);
|
|
135
|
+
};
|
|
136
|
+
const rollupPlugin = async (options) => {
|
|
137
|
+
const plugin = await createUnpluginTheme();
|
|
138
|
+
return plugin.rollup(options);
|
|
139
|
+
};
|
|
140
|
+
const esbuildPlugin = async (options) => {
|
|
141
|
+
const plugin = await createUnpluginTheme();
|
|
142
|
+
return plugin.esbuild(options);
|
|
143
|
+
};
|
|
144
|
+
const unpluginUdixioTheme = {
|
|
145
|
+
vite: vitePlugin,
|
|
146
|
+
webpack: webpackPlugin,
|
|
147
|
+
rollup: rollupPlugin,
|
|
148
|
+
esbuild: esbuildPlugin
|
|
149
|
+
};
|
|
150
|
+
exports.API = loader.API;
|
|
151
|
+
exports.AppContainer = loader.AppContainer;
|
|
152
|
+
exports.AppModule = loader.AppModule;
|
|
153
|
+
exports.ColorApi = loader.ColorApi;
|
|
154
|
+
exports.ColorManager = loader.ColorManager;
|
|
155
|
+
exports.ColorModule = loader.ColorModule;
|
|
156
|
+
exports.ConfigurableColor = loader.ConfigurableColor;
|
|
157
|
+
exports.ContrastCurve = loader.ContrastCurve;
|
|
158
|
+
exports.DynamicColor = loader.DynamicColor;
|
|
159
|
+
exports.PluginApi = loader.PluginApi;
|
|
160
|
+
exports.PluginModule = loader.PluginModule;
|
|
161
|
+
exports.Scheme = loader.Scheme;
|
|
162
|
+
exports.SchemeManager = loader.SchemeManager;
|
|
163
|
+
exports.ThemeApi = loader.ThemeApi;
|
|
164
|
+
exports.ThemeModule = loader.ThemeModule;
|
|
165
|
+
exports.ToneDeltaPair = loader.ToneDeltaPair;
|
|
166
|
+
exports.Variant = loader.Variant;
|
|
167
|
+
exports.VariantManager = loader.VariantManager;
|
|
168
|
+
exports.bootstrap = loader.bootstrap;
|
|
169
|
+
exports.defaultColors = loader.defaultColors;
|
|
170
|
+
exports.extendSpecVersion = loader.extendSpecVersion;
|
|
171
|
+
exports.getPiecewiseHue = loader.getPiecewiseHue;
|
|
172
|
+
exports.getRotatedHue = loader.getRotatedHue;
|
|
173
|
+
exports.highestSurface = loader.highestSurface;
|
|
174
|
+
exports.loader = loader.loader;
|
|
175
|
+
exports.registerModule = loader.registerModule;
|
|
176
|
+
exports.tonalSpotVariant = loader.tonalSpotVariant;
|
|
177
|
+
exports.FontFamily = defineConfig.FontFamily;
|
|
178
|
+
exports.FontPlugin = defineConfig.FontPlugin;
|
|
179
|
+
exports.PluginAbstract = defineConfig.PluginAbstract;
|
|
180
|
+
exports.PluginImplAbstract = defineConfig.PluginImplAbstract;
|
|
181
|
+
exports.Variants = defineConfig.Variants;
|
|
182
|
+
exports.defineConfig = defineConfig.defineConfig;
|
|
183
|
+
exports.expressiveVariant = defineConfig.expressiveVariant;
|
|
184
|
+
exports.neutralVariant = defineConfig.neutralVariant;
|
|
185
|
+
exports.vibrantVariant = defineConfig.vibrantVariant;
|
|
186
|
+
exports.loadFromPath = loadFromPath.loadFromPath;
|
|
187
|
+
exports.resolveConfig = loadFromPath.resolveConfig;
|
|
188
|
+
exports.esbuildPlugin = esbuildPlugin;
|
|
189
|
+
exports.rollupPlugin = rollupPlugin;
|
|
190
|
+
exports.unpluginUdixioTheme = unpluginUdixioTheme;
|
|
191
|
+
exports.vitePlugin = vitePlugin;
|
|
192
|
+
exports.webpackPlugin = webpackPlugin;
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { b, A, a, C, c, d, e, i, D, k, P, n, S, o, m, T, V, s, g, f, j, p, q, h, l, r, t } from "./loader-C_BIrsO2.js";
|
|
2
|
+
import { F, b as b2, P as P2, a as a2, V as V2, d as d2, e as e2, n as n2, v } from "./define-config-CGG8l3fb.js";
|
|
3
|
+
import { l as loadFromPath } from "./load-from-path-CFpw2P_Y.js";
|
|
4
|
+
import { r as r2 } from "./load-from-path-CFpw2P_Y.js";
|
|
5
|
+
let unpluginInstance = null;
|
|
6
|
+
const createUnpluginTheme = async () => {
|
|
7
|
+
if (unpluginInstance) {
|
|
8
|
+
return unpluginInstance;
|
|
9
|
+
}
|
|
10
|
+
const { createUnplugin } = await import("unplugin");
|
|
11
|
+
unpluginInstance = createUnplugin((options = {}) => {
|
|
12
|
+
const { configPath = "./theme.config", verbose = false } = options;
|
|
13
|
+
let resolvedConfigPath;
|
|
14
|
+
if (global.NX_GRAPH_CREATION) {
|
|
15
|
+
return {
|
|
16
|
+
name: "udixio-theme"
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const loadTheme = async () => {
|
|
20
|
+
try {
|
|
21
|
+
if (verbose) {
|
|
22
|
+
console.log(`🎨 Loading theme from: ${configPath}`);
|
|
23
|
+
}
|
|
24
|
+
const result = await loadFromPath(configPath);
|
|
25
|
+
if (!resolvedConfigPath && (result == null ? void 0 : result.filePath)) {
|
|
26
|
+
resolvedConfigPath = result.filePath;
|
|
27
|
+
}
|
|
28
|
+
if (verbose) {
|
|
29
|
+
console.log(`✅ Theme loaded successfully!`);
|
|
30
|
+
}
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error(`❌ Theme loading failed:`, error);
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
name: "udixio-theme",
|
|
38
|
+
// Hook appelé au début du build (tous les bundlers)
|
|
39
|
+
buildStart: async () => {
|
|
40
|
+
await loadTheme();
|
|
41
|
+
},
|
|
42
|
+
// Hook appelé pendant la génération (Rollup/Vite)
|
|
43
|
+
generateBundle: async () => {
|
|
44
|
+
await loadTheme();
|
|
45
|
+
},
|
|
46
|
+
// Support spécifique Vite pour HMR
|
|
47
|
+
vite: {
|
|
48
|
+
handleHotUpdate: async ({ server, file, modules }) => {
|
|
49
|
+
if (!resolvedConfigPath) {
|
|
50
|
+
const result = await loadFromPath(configPath);
|
|
51
|
+
resolvedConfigPath = (result == null ? void 0 : result.filePath) || "";
|
|
52
|
+
}
|
|
53
|
+
if (resolvedConfigPath === file) {
|
|
54
|
+
if (verbose) {
|
|
55
|
+
console.log(`🔄 Theme config changed: ${file}`);
|
|
56
|
+
}
|
|
57
|
+
await loadTheme();
|
|
58
|
+
server.ws.send({ type: "full-reload", path: "*" });
|
|
59
|
+
return modules;
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
// Support spécifique Webpack pour HMR
|
|
65
|
+
webpack: (compiler) => {
|
|
66
|
+
if (compiler.options.mode === "development") {
|
|
67
|
+
compiler.hooks.watchRun.tapAsync(
|
|
68
|
+
"udixio-theme",
|
|
69
|
+
async (compilation, callback) => {
|
|
70
|
+
const changedFiles = compilation.modifiedFiles || /* @__PURE__ */ new Set();
|
|
71
|
+
if (!resolvedConfigPath) {
|
|
72
|
+
const result = await loadFromPath(configPath);
|
|
73
|
+
resolvedConfigPath = (result == null ? void 0 : result.filePath) || "";
|
|
74
|
+
}
|
|
75
|
+
if (changedFiles.has(resolvedConfigPath)) {
|
|
76
|
+
if (verbose) {
|
|
77
|
+
console.log(`🔄 Theme config changed: ${resolvedConfigPath}`);
|
|
78
|
+
}
|
|
79
|
+
await loadTheme();
|
|
80
|
+
}
|
|
81
|
+
callback();
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
// Support spécifique Rollup
|
|
87
|
+
rollup: {
|
|
88
|
+
watchChange: async (id) => {
|
|
89
|
+
if (!resolvedConfigPath) {
|
|
90
|
+
const result = await loadFromPath(configPath);
|
|
91
|
+
resolvedConfigPath = (result == null ? void 0 : result.filePath) || "";
|
|
92
|
+
}
|
|
93
|
+
if (resolvedConfigPath === id) {
|
|
94
|
+
if (verbose) {
|
|
95
|
+
console.log(`🔄 Theme config changed: ${id}`);
|
|
96
|
+
}
|
|
97
|
+
await loadTheme();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
return unpluginInstance;
|
|
104
|
+
};
|
|
105
|
+
const vitePlugin = async (options) => {
|
|
106
|
+
const plugin = await createUnpluginTheme();
|
|
107
|
+
return plugin.vite(options);
|
|
108
|
+
};
|
|
109
|
+
const webpackPlugin = async (options) => {
|
|
110
|
+
const plugin = await createUnpluginTheme();
|
|
111
|
+
return plugin.webpack(options);
|
|
112
|
+
};
|
|
113
|
+
const rollupPlugin = async (options) => {
|
|
114
|
+
const plugin = await createUnpluginTheme();
|
|
115
|
+
return plugin.rollup(options);
|
|
116
|
+
};
|
|
117
|
+
const esbuildPlugin = async (options) => {
|
|
118
|
+
const plugin = await createUnpluginTheme();
|
|
119
|
+
return plugin.esbuild(options);
|
|
120
|
+
};
|
|
121
|
+
const unpluginUdixioTheme = {
|
|
122
|
+
vite: vitePlugin,
|
|
123
|
+
webpack: webpackPlugin,
|
|
124
|
+
rollup: rollupPlugin,
|
|
125
|
+
esbuild: esbuildPlugin
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
b as API,
|
|
129
|
+
A as AppContainer,
|
|
130
|
+
a as AppModule,
|
|
131
|
+
C as ColorApi,
|
|
132
|
+
c as ColorManager,
|
|
133
|
+
d as ColorModule,
|
|
134
|
+
e as ConfigurableColor,
|
|
135
|
+
i as ContrastCurve,
|
|
136
|
+
D as DynamicColor,
|
|
137
|
+
F as FontFamily,
|
|
138
|
+
b2 as FontPlugin,
|
|
139
|
+
P2 as PluginAbstract,
|
|
140
|
+
k as PluginApi,
|
|
141
|
+
a2 as PluginImplAbstract,
|
|
142
|
+
P as PluginModule,
|
|
143
|
+
n as Scheme,
|
|
144
|
+
S as SchemeManager,
|
|
145
|
+
o as ThemeApi,
|
|
146
|
+
m as ThemeModule,
|
|
147
|
+
T as ToneDeltaPair,
|
|
148
|
+
V as Variant,
|
|
149
|
+
s as VariantManager,
|
|
150
|
+
V2 as Variants,
|
|
151
|
+
g as bootstrap,
|
|
152
|
+
f as defaultColors,
|
|
153
|
+
d2 as defineConfig,
|
|
154
|
+
esbuildPlugin,
|
|
155
|
+
e2 as expressiveVariant,
|
|
156
|
+
j as extendSpecVersion,
|
|
157
|
+
p as getPiecewiseHue,
|
|
158
|
+
q as getRotatedHue,
|
|
159
|
+
h as highestSurface,
|
|
160
|
+
loadFromPath,
|
|
161
|
+
l as loader,
|
|
162
|
+
n2 as neutralVariant,
|
|
163
|
+
r as registerModule,
|
|
164
|
+
r2 as resolveConfig,
|
|
165
|
+
rollupPlugin,
|
|
166
|
+
t as tonalSpotVariant,
|
|
167
|
+
unpluginUdixioTheme,
|
|
168
|
+
v as vibrantVariant,
|
|
169
|
+
vitePlugin,
|
|
170
|
+
webpackPlugin
|
|
171
|
+
};
|
|
@@ -4,7 +4,7 @@ export declare class PluginApi {
|
|
|
4
4
|
private plugins;
|
|
5
5
|
addPlugin(plugin: PluginAbstract<any, any>): void;
|
|
6
6
|
initPlugins(api: API): void;
|
|
7
|
-
loadPlugins(): void
|
|
7
|
+
loadPlugins(): Promise<void>;
|
|
8
8
|
getPlugin<T extends PluginAbstract<any, any>>(plugin: new (...args: any) => T): T;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=plugin.api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.api.d.ts","sourceRoot":"","sources":["../../src/plugin/plugin.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAA+C;IAEvD,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC;IAI1C,WAAW,CAAC,GAAG,EAAE,GAAG;
|
|
1
|
+
{"version":3,"file":"plugin.api.d.ts","sourceRoot":"","sources":["../../src/plugin/plugin.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAA+C;IAEvD,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC;IAI1C,WAAW,CAAC,GAAG,EAAE,GAAG;IA2Bd,WAAW;IAMjB,SAAS,CAAC,CAAC,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EACjD,MAAM,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC,GAC9B,CAAC;CAKL"}
|
package/package.json
CHANGED
|
@@ -1,28 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@udixio/theme",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "./dist/
|
|
6
|
-
"module": "./dist/
|
|
7
|
-
"types": "./dist/
|
|
5
|
+
"main": "./dist/node.js",
|
|
6
|
+
"module": "./dist/node.js",
|
|
7
|
+
"types": "./dist/node.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
"./package.json": "./package.json",
|
|
10
10
|
".": {
|
|
11
|
-
"development": "./src/index.ts",
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
"development": "./src/index.node.ts",
|
|
12
|
+
"types": "./dist/index.node.d.ts",
|
|
13
|
+
"browser": {
|
|
14
|
+
"import": "./dist/browser.js",
|
|
15
|
+
"require": "./dist/browser.cjs"
|
|
16
|
+
},
|
|
17
|
+
"node": {
|
|
18
|
+
"import": "./dist/node.js",
|
|
19
|
+
"require": "./dist/node.cjs",
|
|
20
|
+
"default": "./dist/node.js"
|
|
21
|
+
},
|
|
22
|
+
"import": "./dist/node.js",
|
|
23
|
+
"require": "./dist/node.cjs"
|
|
16
24
|
}
|
|
17
25
|
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"udixio-theme": "./dist/bin.js"
|
|
28
|
+
},
|
|
18
29
|
"dependencies": {
|
|
19
30
|
"pathe": "^2.0.3",
|
|
20
31
|
"jiti": "^2.5.1",
|
|
21
32
|
"awilix": "^12.0.5",
|
|
22
33
|
"@material/material-color-utilities": "^0.3.0",
|
|
23
34
|
"replace-in-file": "^8.3.0",
|
|
24
|
-
"tailwindcss": "^4.1.11"
|
|
35
|
+
"tailwindcss": "^4.1.11",
|
|
36
|
+
"chokidar": "^4.0.3",
|
|
37
|
+
"mri": "^1.2.0",
|
|
38
|
+
"commander": "^14.0.0",
|
|
39
|
+
"chalk": "^5.6.0",
|
|
40
|
+
"unplugin": "^2.3.8"
|
|
25
41
|
},
|
|
42
|
+
"devDependencies": {},
|
|
26
43
|
"repository": {
|
|
27
44
|
"type": "git",
|
|
28
45
|
"url": "https://github.com/Udixio/UI.git"
|
package/src/API.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './resolver-config';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ConfigInterface } from './index';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
|
|
4
|
+
export interface ResolvedConfigResult {
|
|
5
|
+
config: ConfigInterface;
|
|
6
|
+
filePath: string; // absolute path of the loaded config file
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Resolve and load theme.config.{ts,js,mjs,cjs} using JITI, independent of any bundler.
|
|
11
|
+
* @param configPath base path without extension or full path with/without extension
|
|
12
|
+
*/
|
|
13
|
+
export async function resolveConfig(
|
|
14
|
+
configPath = './theme.config',
|
|
15
|
+
): Promise<ResolvedConfigResult> {
|
|
16
|
+
const { createJiti } = await import('jiti');
|
|
17
|
+
const { resolve } = await import('pathe');
|
|
18
|
+
|
|
19
|
+
const jiti = createJiti(import.meta.url, {
|
|
20
|
+
debug: process.env.NODE_ENV === 'development',
|
|
21
|
+
fsCache: true,
|
|
22
|
+
interopDefault: true,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// If user passed a path with extension, try it as-is first
|
|
26
|
+
const tryPaths: string[] = [];
|
|
27
|
+
const resolvedInput = resolve(configPath);
|
|
28
|
+
|
|
29
|
+
const extMatch = /\.(ts|js|mjs|cjs)$/.exec(resolvedInput);
|
|
30
|
+
if (extMatch) {
|
|
31
|
+
tryPaths.push(resolvedInput);
|
|
32
|
+
} else {
|
|
33
|
+
for (const ext of ['.ts', '.js', '.mjs', '.cjs']) {
|
|
34
|
+
tryPaths.push(resolvedInput + ext);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (const file of tryPaths) {
|
|
39
|
+
if (fs.existsSync(file)) {
|
|
40
|
+
const cfg = (await jiti.import(file, {
|
|
41
|
+
default: true,
|
|
42
|
+
})) as ConfigInterface;
|
|
43
|
+
|
|
44
|
+
return { config: cfg, filePath: file };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
throw new Error(`Configuration file not found for ${''}{.ts,.js,.mjs,.cjs}`);
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index"
|
package/src/index.ts
CHANGED
|
@@ -2,10 +2,10 @@ export * from './app.container';
|
|
|
2
2
|
export * from './app.module';
|
|
3
3
|
export * from './API';
|
|
4
4
|
export * from './color';
|
|
5
|
-
export * from './
|
|
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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './loader';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { loader } from './loader';
|
|
2
|
+
import { resolveConfig } from '../config/resolver-config';
|
|
3
|
+
|
|
4
|
+
export const loadFromPath = async (configPath = './theme.config') => {
|
|
5
|
+
const { config, filePath } = await resolveConfig(configPath);
|
|
6
|
+
const api = await loader(config);
|
|
7
|
+
|
|
8
|
+
return { filePath, api: api };
|
|
9
|
+
};
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
import { ConfigInterface } from './config.interface';
|
|
2
1
|
import { tonalSpotVariant } from '../theme';
|
|
3
2
|
import { defaultColors } from '../color';
|
|
4
3
|
import { bootstrap } from '../bootstrap';
|
|
5
|
-
import { API } from '../API';
|
|
6
4
|
import { registerModule } from '../app.container';
|
|
7
5
|
import { asValue } from 'awilix';
|
|
6
|
+
import { ConfigInterface } from '../config';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const initializeApi = () => {
|
|
9
|
+
const api = bootstrap();
|
|
10
|
+
registerModule({
|
|
11
|
+
adapter: asValue(this),
|
|
12
|
+
});
|
|
13
|
+
return api;
|
|
14
|
+
};
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
registerModule({
|
|
15
|
-
adapter: asValue(this),
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
abstract getConfig(): Promise<ConfigInterface>;
|
|
16
|
+
export const loader = async (config: ConfigInterface) => {
|
|
17
|
+
const api = initializeApi();
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
const config = await this.getConfig();
|
|
23
|
-
if (config == null) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
19
|
+
const init = () => {
|
|
26
20
|
const {
|
|
27
21
|
sourceColor,
|
|
28
22
|
contrastLevel = 0,
|
|
@@ -33,7 +27,7 @@ export abstract class AdapterAbstract {
|
|
|
33
27
|
useDefaultColors = true,
|
|
34
28
|
plugins,
|
|
35
29
|
} = config;
|
|
36
|
-
|
|
30
|
+
api.themes.create({
|
|
37
31
|
contrastLevel: contrastLevel,
|
|
38
32
|
isDark: isDark,
|
|
39
33
|
sourceColorHex: sourceColor,
|
|
@@ -41,24 +35,29 @@ export abstract class AdapterAbstract {
|
|
|
41
35
|
});
|
|
42
36
|
if (palettes) {
|
|
43
37
|
Object.entries(palettes).forEach(([key, value]) =>
|
|
44
|
-
|
|
38
|
+
api.themes.addCustomPalette(key, value),
|
|
45
39
|
);
|
|
46
40
|
}
|
|
47
41
|
if (useDefaultColors) {
|
|
48
|
-
|
|
42
|
+
api.colors.addColors(defaultColors);
|
|
49
43
|
}
|
|
50
44
|
if (colors) {
|
|
51
|
-
|
|
45
|
+
api.colors.addColors(colors);
|
|
52
46
|
}
|
|
53
47
|
if (plugins) {
|
|
54
48
|
plugins.forEach((plugin) => {
|
|
55
|
-
|
|
49
|
+
api.plugins.addPlugin(plugin);
|
|
56
50
|
});
|
|
57
|
-
|
|
51
|
+
api.plugins.initPlugins(api);
|
|
58
52
|
}
|
|
59
|
-
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const load = async () => {
|
|
56
|
+
await api.plugins.loadPlugins();
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
init();
|
|
60
|
+
await load();
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
}
|
|
62
|
+
return api;
|
|
63
|
+
};
|