@udixio/tailwind 1.2.1 → 1.4.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/dist/node.js ADDED
@@ -0,0 +1,332 @@
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 { T as TailwindImplPluginBrowser, m as main } from "./tailwind.plugin-BqW8MAYp.js";
5
+ import { f, s } from "./tailwind.plugin-BqW8MAYp.js";
6
+ import { PluginAbstract, FontPlugin } from "@udixio/theme";
7
+ import * as fs from "fs";
8
+ import * as console from "node:console";
9
+ import { join, resolve, dirname, normalize } from "pathe";
10
+ import chalk from "chalk";
11
+ class TailwindPlugin extends PluginAbstract {
12
+ constructor() {
13
+ super(...arguments);
14
+ __publicField(this, "dependencies", [FontPlugin]);
15
+ __publicField(this, "name", "tailwind");
16
+ __publicField(this, "pluginClass", TailwindImplPlugin);
17
+ }
18
+ }
19
+ class TailwindImplPlugin extends TailwindImplPluginBrowser {
20
+ isNodeJs() {
21
+ return typeof process !== "undefined" && process.versions != null && process.versions.node != null;
22
+ }
23
+ async onLoad() {
24
+ var _a;
25
+ if (!this.isNodeJs()) {
26
+ await super.onLoad();
27
+ return;
28
+ }
29
+ const { join: join2, resolve: resolve2 } = await import("pathe");
30
+ const {
31
+ createOrUpdateFile: createOrUpdateFile2,
32
+ findProjectRoot: findProjectRoot2,
33
+ findTailwindCssFile: findTailwindCssFile2,
34
+ getFileContent: getFileContent2,
35
+ replaceFileContent: replaceFileContent2
36
+ } = await Promise.resolve().then(() => file);
37
+ this.colors = {};
38
+ for (const isDark of [false, true]) {
39
+ this.api.themes.update({ isDark });
40
+ for (const [key, value] of this.api.colors.getColors().entries()) {
41
+ const newKey = key.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
42
+ (_a = this.colors)[newKey] ?? (_a[newKey] = { light: "", dark: "" });
43
+ this.colors[newKey][isDark ? "dark" : "light"] = value.getHex();
44
+ }
45
+ }
46
+ let udixioCssPath = this.options.styleFilePath;
47
+ const projectRoot = await findProjectRoot2(resolve2());
48
+ if (!udixioCssPath) {
49
+ const searchPattern = /@import ["']tailwindcss["'];/;
50
+ const replacement = `@import 'tailwindcss';
51
+ @import "./udixio.css";`;
52
+ const tailwindCssPath = await findTailwindCssFile2(
53
+ projectRoot,
54
+ searchPattern
55
+ );
56
+ udixioCssPath = join2(tailwindCssPath, "../udixio.css");
57
+ if (!await getFileContent2(tailwindCssPath, /@import\s+"\.\/udixio\.css";/)) {
58
+ await replaceFileContent2(tailwindCssPath, searchPattern, replacement);
59
+ }
60
+ }
61
+ const { fontStyles, fontFamily } = this.api.plugins.getPlugin(FontPlugin).getInstance().getFonts();
62
+ const configCss = {
63
+ colorKeys: Object.keys(this.colors).join(", "),
64
+ fontStyles: Object.entries(fontStyles).map(
65
+ ([fontRole, fontStyle]) => Object.entries(fontStyle).map(
66
+ ([fontSize, fontStyle2]) => `${fontRole}-${fontSize} ${Object.entries(fontStyle2).map(([name, value]) => `${name}[${value}]`).join(" ")}`
67
+ ).join(", ")
68
+ ).join(", "),
69
+ responsiveBreakPoints: Object.entries(
70
+ this.options.responsiveBreakPoints ?? {}
71
+ ).map(([key, value]) => `${key} ${value}`).join(", ")
72
+ };
73
+ this.outputCss += `@plugin "@udixio/tailwind" {
74
+ colorKeys: ${configCss.colorKeys};
75
+ fontStyles: ${configCss.fontStyles};
76
+ responsiveBreakPoints: ${configCss.responsiveBreakPoints};
77
+ }`;
78
+ this.loadColor();
79
+ this.outputCss += `
80
+ @theme {
81
+ ${Object.entries(fontFamily).map(
82
+ ([key, values]) => `--font-${key}: ${values.map((value) => `"${value}"`).join(", ")};`
83
+ ).join("\n ")}
84
+ }`;
85
+ await createOrUpdateFile2(udixioCssPath, this.outputCss);
86
+ }
87
+ }
88
+ const normalizePath = async (filePath) => {
89
+ const { fileURLToPath } = await import("url");
90
+ try {
91
+ if (filePath.startsWith("file://")) {
92
+ return normalize(fileURLToPath(filePath));
93
+ }
94
+ return normalize(filePath);
95
+ } catch (error) {
96
+ console.warn(
97
+ chalk.yellow(
98
+ `⚠️ Could not process path ${filePath}, treating as regular path`
99
+ )
100
+ );
101
+ return normalize(filePath);
102
+ }
103
+ };
104
+ const safeExistsSync = async (filePath) => {
105
+ return fs.existsSync(await normalizePath(filePath));
106
+ };
107
+ const safeReadFileSync = async (filePath, encoding = "utf8") => {
108
+ return fs.readFileSync(await normalizePath(filePath), encoding);
109
+ };
110
+ const safeWriteFileSync = async (filePath, data) => {
111
+ const normalizedPath = await normalizePath(filePath);
112
+ const dirPath = dirname(normalizedPath);
113
+ if (!fs.existsSync(dirPath)) {
114
+ fs.mkdirSync(dirPath, { recursive: true });
115
+ }
116
+ fs.writeFileSync(normalizedPath, data);
117
+ };
118
+ const createOrUpdateFile = async (filePath, content) => {
119
+ try {
120
+ const normalizedPath = normalizePath(filePath);
121
+ if (!await safeExistsSync(filePath)) {
122
+ await safeWriteFileSync(filePath, content);
123
+ console.log(
124
+ chalk.green(`📄 Created`) + chalk.gray(` • `) + chalk.cyan(normalizedPath)
125
+ );
126
+ } else {
127
+ console.log(
128
+ chalk.blue(`📝 Exists`) + chalk.gray(` • `) + chalk.cyan(normalizedPath)
129
+ );
130
+ await replaceFileContent(filePath, /[\s\S]*/, content);
131
+ }
132
+ } catch (error) {
133
+ console.error(
134
+ chalk.red(`🚨 Failed to create file`) + chalk.gray(` • `) + chalk.cyan(filePath)
135
+ );
136
+ console.error(
137
+ chalk.gray(` `) + chalk.red(error instanceof Error ? error.message : error)
138
+ );
139
+ }
140
+ };
141
+ const getFileContent = async (filePath, searchPattern) => {
142
+ try {
143
+ const normalizedPath = normalizePath(filePath);
144
+ if (!await safeExistsSync(filePath)) {
145
+ console.error(
146
+ chalk.red(`❌ File not found`) + chalk.gray(` • `) + chalk.cyan(normalizedPath)
147
+ );
148
+ return null;
149
+ }
150
+ const fileContent = await safeReadFileSync(filePath);
151
+ if (searchPattern) {
152
+ if (typeof searchPattern === "string") {
153
+ const found = fileContent.includes(searchPattern) ? searchPattern : false;
154
+ if (found) {
155
+ console.log(
156
+ chalk.green(`🔍 Found`) + chalk.gray(` • `) + chalk.yellow(`"${searchPattern}"`)
157
+ );
158
+ } else {
159
+ console.log(
160
+ chalk.yellow(`🔍 Missing`) + chalk.gray(` • `) + chalk.yellow(`"${searchPattern}"`)
161
+ );
162
+ }
163
+ return found;
164
+ } else {
165
+ const match = fileContent.match(searchPattern);
166
+ if (match) {
167
+ console.log(
168
+ chalk.green(`🎯 Match`) + chalk.gray(` • `) + chalk.yellow(`"${match[0]}"`)
169
+ );
170
+ return match[0];
171
+ } else {
172
+ console.log(
173
+ chalk.yellow(`🎯 No match`) + chalk.gray(` • `) + chalk.magenta(searchPattern.toString())
174
+ );
175
+ return false;
176
+ }
177
+ }
178
+ }
179
+ console.log(
180
+ chalk.blue(`📖 Read`) + chalk.gray(` • `) + chalk.cyan(normalizedPath)
181
+ );
182
+ return fileContent;
183
+ } catch (error) {
184
+ console.error(
185
+ chalk.red(`🚨 Read failed`) + chalk.gray(` • `) + chalk.cyan(filePath)
186
+ );
187
+ console.error(
188
+ chalk.gray(` `) + chalk.red(error instanceof Error ? error.message : error)
189
+ );
190
+ return null;
191
+ }
192
+ };
193
+ const replaceFileContent = async (filePath, searchPattern, replacement) => {
194
+ try {
195
+ const { replaceInFileSync } = await import("replace-in-file");
196
+ const normalizedPath = await normalizePath(filePath);
197
+ const results = replaceInFileSync({
198
+ files: normalizedPath,
199
+ from: searchPattern,
200
+ to: replacement
201
+ });
202
+ if (results.length > 0 && results[0].hasChanged) {
203
+ console.log(
204
+ chalk.green(`✏️ Updated`) + chalk.gray(` • `) + chalk.cyan(normalizedPath)
205
+ );
206
+ } else {
207
+ console.log(
208
+ chalk.yellow(`⏭️ Skipped`) + chalk.gray(` • `) + chalk.cyan(normalizedPath) + chalk.gray(` (no changes needed)`)
209
+ );
210
+ }
211
+ } catch (error) {
212
+ console.error(
213
+ chalk.red(`🚨 Update failed`) + chalk.gray(` • `) + chalk.cyan(filePath)
214
+ );
215
+ console.error(
216
+ chalk.gray(` `) + chalk.red(error instanceof Error ? error.message : error)
217
+ );
218
+ }
219
+ };
220
+ const findTailwindCssFile = async (startDir, searchPattern) => {
221
+ const normalizedStartDir = await normalizePath(startDir);
222
+ console.log(chalk.blue(`🔎 Searching for CSS file...`));
223
+ console.log(
224
+ chalk.gray(` Starting from: `) + chalk.cyan(normalizedStartDir)
225
+ );
226
+ const stack = [normalizedStartDir];
227
+ let filesScanned = 0;
228
+ while (stack.length > 0) {
229
+ const currentDir = stack.pop();
230
+ let files;
231
+ try {
232
+ files = fs.readdirSync(currentDir);
233
+ } catch (error) {
234
+ console.error(
235
+ chalk.gray(` `) + chalk.red(`❌ Cannot read directory: `) + chalk.cyan(currentDir)
236
+ );
237
+ continue;
238
+ }
239
+ for (const file2 of files) {
240
+ const filePath = join(currentDir, file2);
241
+ let stats;
242
+ try {
243
+ stats = fs.statSync(filePath);
244
+ } catch (error) {
245
+ console.error(
246
+ chalk.gray(` `) + chalk.red(`❌ Cannot access: `) + chalk.cyan(filePath)
247
+ );
248
+ continue;
249
+ }
250
+ if (stats.isDirectory()) {
251
+ if (file2 !== "node_modules" && !file2.startsWith(".")) {
252
+ stack.push(filePath);
253
+ }
254
+ } else if (stats.isFile() && (file2.endsWith(".css") || file2.endsWith(".scss") || file2.endsWith(".sass"))) {
255
+ try {
256
+ filesScanned++;
257
+ process.stdout.write(
258
+ chalk.gray(` 📂 Scanning: `) + chalk.yellow(file2) + `\r`
259
+ );
260
+ const content = await safeReadFileSync(filePath);
261
+ const hasMatch = typeof searchPattern === "string" ? content.includes(searchPattern) : searchPattern.test(content);
262
+ if (hasMatch) {
263
+ console.log(chalk.green(`
264
+ 🎯 Found target file!`));
265
+ console.log(chalk.gray(` 📍 Location: `) + chalk.cyan(filePath));
266
+ return filePath;
267
+ }
268
+ } catch (readError) {
269
+ console.error(
270
+ chalk.gray(`
271
+ `) + chalk.red(`❌ Cannot read: `) + chalk.cyan(filePath)
272
+ );
273
+ }
274
+ }
275
+ }
276
+ }
277
+ console.log(
278
+ chalk.blue(`
279
+ 📊 Scanned `) + chalk.white.bold(filesScanned.toString()) + chalk.blue(` CSS files`)
280
+ );
281
+ const errorMsg = chalk.red(`❌ No file found containing `) + chalk.yellow(`"${searchPattern}"`) + chalk.red(` in `) + chalk.cyan(`"${normalizedStartDir}"`);
282
+ throw new Error(errorMsg);
283
+ };
284
+ async function findProjectRoot(startPath) {
285
+ const normalizedStartPath = await normalizePath(startPath);
286
+ let currentPath = resolve(normalizedStartPath);
287
+ let levels = 0;
288
+ console.log(chalk.blue(`🏠 Finding project root...`));
289
+ console.log(
290
+ chalk.gray(` Starting from: `) + chalk.cyan(normalizedStartPath)
291
+ );
292
+ while (!fs.existsSync(join(currentPath, "package.json"))) {
293
+ const parentPath = dirname(currentPath);
294
+ if (currentPath === parentPath) {
295
+ console.error(
296
+ chalk.red(`❌ Project root not found after checking `) + chalk.white.bold(levels.toString()) + chalk.red(` levels`)
297
+ );
298
+ throw new Error(
299
+ chalk.red("Unable to locate project root (no package.json found)")
300
+ );
301
+ }
302
+ currentPath = parentPath;
303
+ levels++;
304
+ if (levels > 10) {
305
+ console.error(
306
+ chalk.red(`❌ Stopped after `) + chalk.white.bold(levels.toString()) + chalk.red(` levels (too deep)`)
307
+ );
308
+ throw new Error(chalk.red("Project root search exceeded maximum depth"));
309
+ }
310
+ }
311
+ console.log(chalk.green(`📁 Project root: `) + chalk.cyan(currentPath));
312
+ return currentPath;
313
+ }
314
+ const file = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
315
+ __proto__: null,
316
+ createOrUpdateFile,
317
+ findProjectRoot,
318
+ findTailwindCssFile,
319
+ getFileContent,
320
+ replaceFileContent
321
+ }, Symbol.toStringTag, { value: "Module" }));
322
+ export {
323
+ TailwindPlugin,
324
+ createOrUpdateFile,
325
+ main as default,
326
+ findProjectRoot,
327
+ findTailwindCssFile,
328
+ f as font,
329
+ getFileContent,
330
+ replaceFileContent,
331
+ s as state
332
+ };
@@ -2,11 +2,6 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import plugin from "tailwindcss/plugin";
5
- import * as fs from "fs";
6
- import * as path from "path";
7
- import path__default from "path";
8
- import { replaceInFileSync } from "replace-in-file";
9
- import * as console from "node:console";
10
5
  import { PluginAbstract, FontPlugin, PluginImplAbstract } from "@udixio/theme";
11
6
  const defaultConfig = {
12
7
  statePrefix: "state",
@@ -166,202 +161,59 @@ const main = plugin.withOptions((args) => {
166
161
  shadow.handler(api);
167
162
  };
168
163
  });
169
- const createOrUpdateFile = (filePath, content) => {
170
- try {
171
- if (!fs.existsSync(filePath)) {
172
- const dirPath = path.dirname(filePath);
173
- if (!fs.existsSync(dirPath)) {
174
- fs.mkdirSync(dirPath, { recursive: true });
175
- }
176
- fs.writeFileSync(filePath, content);
177
- console.log(`✅ File successfully created: ${filePath}`);
178
- } else {
179
- console.log(`⚠️ File already exists: ${filePath}`);
180
- replaceFileContent(filePath, /[\s\S]*/, content);
181
- }
182
- } catch (error) {
183
- console.error("❌ Error while creating the file:", error);
184
- }
185
- };
186
- const getFileContent = (filePath, searchPattern) => {
187
- try {
188
- if (!fs.existsSync(filePath)) {
189
- console.error(`❌ The specified file does not exist: ${filePath}`);
190
- return null;
191
- }
192
- const fileContent = fs.readFileSync(filePath, "utf8");
193
- if (searchPattern) {
194
- if (typeof searchPattern === "string") {
195
- const found = fileContent.includes(searchPattern) ? searchPattern : false;
196
- console.log(
197
- found ? `✅ The file contains the specified string: "${searchPattern}"` : `⚠️ The file does NOT contain the specified string: "${searchPattern}"`
198
- );
199
- return found;
200
- } else {
201
- const match = fileContent.match(searchPattern);
202
- if (match) {
203
- console.log(`✅ Found match: "${match[0]}"`);
204
- return match[0];
205
- } else {
206
- console.log(
207
- `⚠️ No match found for the pattern: "${searchPattern.toString()}"`
208
- );
209
- return false;
210
- }
211
- }
212
- }
213
- console.log(`✅ File content successfully retrieved.`);
214
- return fileContent;
215
- } catch (error) {
216
- console.error("❌ An error occurred while processing the file:", error);
217
- return null;
218
- }
219
- };
220
- const replaceFileContent = (filePath, searchPattern, replacement) => {
221
- try {
222
- const results = replaceInFileSync({
223
- files: filePath,
224
- from: searchPattern,
225
- to: replacement
226
- });
227
- if (results.length > 0 && results[0].hasChanged) {
228
- console.log(`✅ Content successfully replaced in the file: ${filePath}`);
229
- } else {
230
- console.log(
231
- `⚠️ No replacement made. Here are some possible reasons:
232
- - The pattern ${searchPattern} was not found.
233
- - The file might already contain the expected content.`
234
- );
235
- }
236
- } catch (error) {
237
- console.error("❌ Error while replacing the file content:", error);
238
- }
239
- };
240
- const findTailwindCssFile = (startDir, searchPattern) => {
241
- console.log("Recherche du fichier contenant le motif...", startDir);
242
- const stack = [startDir];
243
- while (stack.length > 0) {
244
- const currentDir = stack.pop();
245
- const files = fs.readdirSync(currentDir);
246
- for (const file of files) {
247
- const filePath = path.join(currentDir, file);
248
- let stats;
249
- try {
250
- stats = fs.statSync(filePath);
251
- } catch (error) {
252
- console.error(`Erreur lors de l'accès à ${filePath}:`, error);
253
- continue;
254
- }
255
- if (stats.isDirectory()) {
256
- if (file !== "node_modules") stack.push(filePath);
257
- } else if (stats.isFile() && (file.endsWith(".css") || file.endsWith(".scss") || file.endsWith(".sass"))) {
258
- try {
259
- console.log(`Analyse du fichier : ${filePath}`);
260
- const content = fs.readFileSync(filePath, "utf8");
261
- if (content.match(searchPattern)) {
262
- console.log("Fichier trouvé :", filePath);
263
- return filePath;
264
- }
265
- } catch (readError) {
266
- console.error(`Erreur lors de la lecture de ${filePath}:`, readError);
267
- }
268
- }
269
- }
270
- }
271
- throw new Error(
272
- `Impossible de trouver un fichier contenant "${searchPattern}" dans "${startDir}".`
273
- );
274
- };
275
- function findProjectRoot(startPath) {
276
- let currentPath = startPath;
277
- while (!fs.existsSync(path.join(currentPath, "package.json"))) {
278
- const parentPath = path.dirname(currentPath);
279
- if (currentPath === parentPath) {
280
- throw new Error("Impossible de localiser la racine du projet.");
281
- }
282
- currentPath = parentPath;
283
- }
284
- return currentPath;
285
- }
286
164
  class TailwindPlugin extends PluginAbstract {
287
165
  constructor() {
288
166
  super(...arguments);
289
167
  __publicField(this, "dependencies", [FontPlugin]);
290
168
  __publicField(this, "name", "tailwind");
291
- __publicField(this, "pluginClass", TailwindImplPlugin);
169
+ __publicField(this, "pluginClass", TailwindImplPluginBrowser);
292
170
  }
293
171
  }
294
- class TailwindImplPlugin extends PluginImplAbstract {
172
+ class TailwindImplPluginBrowser extends PluginImplAbstract {
173
+ constructor() {
174
+ super(...arguments);
175
+ __publicField(this, "outputCss", "");
176
+ __publicField(this, "colors", {});
177
+ }
295
178
  onInit() {
296
179
  var _a;
297
180
  (_a = this.options).responsiveBreakPoints ?? (_a.responsiveBreakPoints = {
298
181
  lg: 1.125
299
182
  });
300
183
  }
301
- onLoad() {
302
- let udixioCssPath = this.options.styleFilePath;
303
- const projectRoot = findProjectRoot(path__default.resolve());
304
- if (!udixioCssPath) {
305
- const searchPattern = /@import ["']tailwindcss["'];/;
306
- const replacement = `@import 'tailwindcss';
307
- @import "./udixio.css";`;
308
- const tailwindCssPath = findTailwindCssFile(projectRoot, searchPattern);
309
- udixioCssPath = path__default.join(tailwindCssPath, "../udixio.css");
310
- if (!getFileContent(tailwindCssPath, /@import\s+"\.\/udixio\.css";/)) {
311
- replaceFileContent(tailwindCssPath, searchPattern, replacement);
312
- }
313
- }
314
- const colors = {};
315
- for (const isDark of [false, true]) {
316
- this.api.themes.update({ isDark });
317
- for (const [key, value] of this.api.colors.getColors().entries()) {
318
- const newKey = key.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
319
- colors[newKey] ?? (colors[newKey] = { light: "", dark: "" });
320
- colors[newKey][isDark ? "dark" : "light"] = value.getHex();
321
- }
322
- }
323
- const { fontStyles, fontFamily } = this.api.plugins.getPlugin(FontPlugin).getInstance().getFonts();
324
- const configCss = {
325
- colorKeys: Object.keys(colors).join(", "),
326
- fontStyles: Object.entries(fontStyles).map(
327
- ([fontRole, fontStyle]) => Object.entries(fontStyle).map(
328
- ([fontSize, fontStyle2]) => `${fontRole}-${fontSize} ${Object.entries(fontStyle2).map(([name, value]) => `${name}[${value}]`).join(" ")}`
329
- ).join(", ")
330
- ).join(", "),
331
- responsiveBreakPoints: Object.entries(
332
- this.options.responsiveBreakPoints ?? {}
333
- ).map(([key, value]) => `${key} ${value}`).join(", ")
334
- };
335
- createOrUpdateFile(
336
- udixioCssPath,
337
- `
338
- @plugin "@udixio/tailwind" {
339
- colorKeys: ${configCss.colorKeys};
340
- fontStyles: ${configCss.fontStyles};
341
- responsiveBreakPoints: ${configCss.responsiveBreakPoints};
342
- }
184
+ loadColor() {
185
+ this.outputCss += `
343
186
  @custom-variant dark (&:where(.dark, .dark *));
344
187
  @theme {
345
188
  --color-*: initial;
346
- ${Object.entries(colors).map(([key, value]) => `--color-${key}: ${value.light};`).join("\n ")}
189
+ ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.light};`).join("\n ")}
347
190
  }
348
191
  @layer theme {
349
192
  .dark {
350
- ${Object.entries(colors).map(([key, value]) => `--color-${key}: ${value.dark};`).join("\n ")}
193
+ ${Object.entries(this.colors).map(([key, value]) => `--color-${key}: ${value.dark};`).join("\n ")}
351
194
  }
352
195
  }
353
- @theme {
354
- ${Object.entries(fontFamily).map(
355
- ([key, values]) => `--font-${key}: ${values.map((value) => `"${value}"`).join(", ")};`
356
- ).join("\n ")}
357
- }
358
- `
359
- );
196
+ `;
197
+ }
198
+ async onLoad() {
199
+ var _a;
200
+ this.colors = {};
201
+ for (const isDark of [false, true]) {
202
+ this.api.themes.update({ isDark });
203
+ for (const [key, value] of this.api.colors.getColors().entries()) {
204
+ const newKey = key.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
205
+ (_a = this.colors)[newKey] ?? (_a[newKey] = { light: "", dark: "" });
206
+ this.colors[newKey][isDark ? "dark" : "light"] = value.getHex();
207
+ }
208
+ }
209
+ await import("@tailwindcss/browser");
210
+ this.loadColor();
360
211
  }
361
212
  }
362
213
  export {
363
- TailwindPlugin,
364
- main as default,
365
- font,
366
- state
214
+ TailwindImplPluginBrowser as T,
215
+ TailwindPlugin as a,
216
+ font as f,
217
+ main as m,
218
+ state as s
367
219
  };