@removify/tailwind-preset 0.2.0 → 0.2.2
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/{chunk-QZWKJNXG.js → chunk-LHJY2ZQQ.js} +53 -15
- package/dist/cli/index.js +1 -1
- package/dist/index.cjs +56 -17
- package/dist/index.d.cts +13 -10
- package/dist/index.d.ts +13 -10
- package/dist/index.js +5 -3
- package/package.json +2 -2
|
@@ -340,28 +340,65 @@ var boxShadow = {
|
|
|
340
340
|
};
|
|
341
341
|
|
|
342
342
|
// src/theme/index.ts
|
|
343
|
-
function buildTheme(
|
|
343
|
+
function buildTheme(object, option = {}) {
|
|
344
|
+
const {
|
|
345
|
+
enabled = true,
|
|
346
|
+
prefix = ""
|
|
347
|
+
} = option;
|
|
348
|
+
if (!enabled) {
|
|
349
|
+
return null;
|
|
350
|
+
}
|
|
351
|
+
if (prefix) {
|
|
352
|
+
return Object.fromEntries(Object.entries(object).map(([k, v]) => [
|
|
353
|
+
`${prefix}${k}`,
|
|
354
|
+
v
|
|
355
|
+
]));
|
|
356
|
+
}
|
|
357
|
+
return object;
|
|
358
|
+
}
|
|
359
|
+
function factory(options = {}) {
|
|
344
360
|
const theme = {};
|
|
345
|
-
if (options.colors !== false) {
|
|
346
|
-
|
|
361
|
+
if (options.colors?.enabled !== false) {
|
|
362
|
+
const _colors = buildTheme(colors, options.colors);
|
|
363
|
+
if (_colors != null) {
|
|
364
|
+
theme.colors = _colors;
|
|
365
|
+
}
|
|
347
366
|
}
|
|
348
|
-
if (options.boxShadow !== false) {
|
|
349
|
-
|
|
367
|
+
if (options.boxShadow?.enabled !== false) {
|
|
368
|
+
const _boxShadow = buildTheme(boxShadow, options.boxShadow);
|
|
369
|
+
if (_boxShadow != null) {
|
|
370
|
+
theme.boxShadow = _boxShadow;
|
|
371
|
+
}
|
|
350
372
|
}
|
|
351
|
-
if (options.fontSize !== false) {
|
|
352
|
-
|
|
373
|
+
if (options.fontSize?.enabled !== false) {
|
|
374
|
+
const _fontSize = buildTheme(fontSize, options.fontSize);
|
|
375
|
+
if (_fontSize != null) {
|
|
376
|
+
theme.fontSize = _fontSize;
|
|
377
|
+
}
|
|
353
378
|
}
|
|
354
|
-
if (options.fontFamily !== false) {
|
|
355
|
-
|
|
379
|
+
if (options.fontFamily?.enabled !== false) {
|
|
380
|
+
const _fontFamily = buildTheme(customFontFamily, options.fontFamily);
|
|
381
|
+
if (_fontFamily != null) {
|
|
382
|
+
theme.fontFamily = _fontFamily;
|
|
383
|
+
}
|
|
356
384
|
}
|
|
357
|
-
if (options.animation !== false) {
|
|
358
|
-
|
|
385
|
+
if (options.animation?.enabled !== false) {
|
|
386
|
+
const _animation = buildTheme(animation, options.animation);
|
|
387
|
+
if (_animation != null) {
|
|
388
|
+
theme.animation = _animation;
|
|
389
|
+
}
|
|
359
390
|
}
|
|
360
|
-
if (options.keyframes !== false) {
|
|
361
|
-
|
|
391
|
+
if (options.keyframes?.enabled !== false) {
|
|
392
|
+
const _keyframes = buildTheme(keyframes, options.keyframes);
|
|
393
|
+
if (_keyframes != null) {
|
|
394
|
+
theme.keyframes = _keyframes;
|
|
395
|
+
}
|
|
362
396
|
}
|
|
363
|
-
if (options.screens !== false) {
|
|
364
|
-
|
|
397
|
+
if (options.screens?.enabled !== false) {
|
|
398
|
+
const _screens = buildTheme(screens, options.screens);
|
|
399
|
+
if (_screens != null) {
|
|
400
|
+
theme.screens = _screens;
|
|
401
|
+
}
|
|
365
402
|
}
|
|
366
403
|
return theme;
|
|
367
404
|
}
|
|
@@ -390,6 +427,7 @@ export {
|
|
|
390
427
|
screens,
|
|
391
428
|
boxShadow,
|
|
392
429
|
buildTheme,
|
|
430
|
+
factory,
|
|
393
431
|
defaultTheme,
|
|
394
432
|
unocssTheme
|
|
395
433
|
};
|
package/dist/cli/index.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -38,6 +38,7 @@ __export(src_exports, {
|
|
|
38
38
|
colorsNames: () => colorsNames,
|
|
39
39
|
default: () => src_default,
|
|
40
40
|
defaultTheme: () => defaultTheme,
|
|
41
|
+
factory: () => factory,
|
|
41
42
|
fontFamily: () => customFontFamily,
|
|
42
43
|
fontSize: () => fontSize,
|
|
43
44
|
keyframes: () => keyframes,
|
|
@@ -393,28 +394,65 @@ var boxShadow = {
|
|
|
393
394
|
};
|
|
394
395
|
|
|
395
396
|
// src/theme/index.ts
|
|
396
|
-
function buildTheme(
|
|
397
|
+
function buildTheme(object, option = {}) {
|
|
398
|
+
const {
|
|
399
|
+
enabled = true,
|
|
400
|
+
prefix = ""
|
|
401
|
+
} = option;
|
|
402
|
+
if (!enabled) {
|
|
403
|
+
return null;
|
|
404
|
+
}
|
|
405
|
+
if (prefix) {
|
|
406
|
+
return Object.fromEntries(Object.entries(object).map(([k, v]) => [
|
|
407
|
+
`${prefix}${k}`,
|
|
408
|
+
v
|
|
409
|
+
]));
|
|
410
|
+
}
|
|
411
|
+
return object;
|
|
412
|
+
}
|
|
413
|
+
function factory(options = {}) {
|
|
397
414
|
const theme = {};
|
|
398
|
-
if (options.colors !== false) {
|
|
399
|
-
|
|
415
|
+
if (options.colors?.enabled !== false) {
|
|
416
|
+
const _colors = buildTheme(colors, options.colors);
|
|
417
|
+
if (_colors != null) {
|
|
418
|
+
theme.colors = _colors;
|
|
419
|
+
}
|
|
400
420
|
}
|
|
401
|
-
if (options.boxShadow !== false) {
|
|
402
|
-
|
|
421
|
+
if (options.boxShadow?.enabled !== false) {
|
|
422
|
+
const _boxShadow = buildTheme(boxShadow, options.boxShadow);
|
|
423
|
+
if (_boxShadow != null) {
|
|
424
|
+
theme.boxShadow = _boxShadow;
|
|
425
|
+
}
|
|
403
426
|
}
|
|
404
|
-
if (options.fontSize !== false) {
|
|
405
|
-
|
|
427
|
+
if (options.fontSize?.enabled !== false) {
|
|
428
|
+
const _fontSize = buildTheme(fontSize, options.fontSize);
|
|
429
|
+
if (_fontSize != null) {
|
|
430
|
+
theme.fontSize = _fontSize;
|
|
431
|
+
}
|
|
406
432
|
}
|
|
407
|
-
if (options.fontFamily !== false) {
|
|
408
|
-
|
|
433
|
+
if (options.fontFamily?.enabled !== false) {
|
|
434
|
+
const _fontFamily = buildTheme(customFontFamily, options.fontFamily);
|
|
435
|
+
if (_fontFamily != null) {
|
|
436
|
+
theme.fontFamily = _fontFamily;
|
|
437
|
+
}
|
|
409
438
|
}
|
|
410
|
-
if (options.animation !== false) {
|
|
411
|
-
|
|
439
|
+
if (options.animation?.enabled !== false) {
|
|
440
|
+
const _animation = buildTheme(animation2, options.animation);
|
|
441
|
+
if (_animation != null) {
|
|
442
|
+
theme.animation = _animation;
|
|
443
|
+
}
|
|
412
444
|
}
|
|
413
|
-
if (options.keyframes !== false) {
|
|
414
|
-
|
|
445
|
+
if (options.keyframes?.enabled !== false) {
|
|
446
|
+
const _keyframes = buildTheme(keyframes, options.keyframes);
|
|
447
|
+
if (_keyframes != null) {
|
|
448
|
+
theme.keyframes = _keyframes;
|
|
449
|
+
}
|
|
415
450
|
}
|
|
416
|
-
if (options.screens !== false) {
|
|
417
|
-
|
|
451
|
+
if (options.screens?.enabled !== false) {
|
|
452
|
+
const _screens = buildTheme(screens, options.screens);
|
|
453
|
+
if (_screens != null) {
|
|
454
|
+
theme.screens = _screens;
|
|
455
|
+
}
|
|
418
456
|
}
|
|
419
457
|
return theme;
|
|
420
458
|
}
|
|
@@ -453,13 +491,13 @@ var colorsNames = [
|
|
|
453
491
|
function buildPreset(extend = true, buildOptions = {}) {
|
|
454
492
|
if (extend === false) {
|
|
455
493
|
return {
|
|
456
|
-
theme:
|
|
494
|
+
theme: factory(buildOptions),
|
|
457
495
|
plugins
|
|
458
496
|
};
|
|
459
497
|
}
|
|
460
498
|
return {
|
|
461
499
|
theme: {
|
|
462
|
-
extend:
|
|
500
|
+
extend: factory(buildOptions)
|
|
463
501
|
},
|
|
464
502
|
plugins
|
|
465
503
|
};
|
|
@@ -474,6 +512,7 @@ var src_default = buildPreset();
|
|
|
474
512
|
colors,
|
|
475
513
|
colorsNames,
|
|
476
514
|
defaultTheme,
|
|
515
|
+
factory,
|
|
477
516
|
fontFamily,
|
|
478
517
|
fontSize,
|
|
479
518
|
keyframes,
|
package/dist/index.d.cts
CHANGED
|
@@ -24,15 +24,15 @@ type Colors = DefaultColors & MainColors & Record<ColorsNames, {
|
|
|
24
24
|
}>;
|
|
25
25
|
type ColorString = `${ColorsNames}-${ColorsVariations}` | keyof DefaultColors | keyof MainColors;
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
animation?: boolean;
|
|
33
|
-
keyframes?: boolean;
|
|
34
|
-
screens?: boolean;
|
|
27
|
+
declare const configuredThemes: readonly ["colors", "boxShadow", "fontSize", "fontFamily", "animation", "keyframes", "screens"];
|
|
28
|
+
type ConfiguredThemes = typeof configuredThemes[number];
|
|
29
|
+
interface ThemeOptions {
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
prefix?: string;
|
|
35
32
|
}
|
|
33
|
+
type BuildThemeOptions = {
|
|
34
|
+
[k in ConfiguredThemes]?: ThemeOptions;
|
|
35
|
+
};
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Converts the given string from camel-case to kebab-case.
|
|
@@ -442,7 +442,10 @@ declare const boxShadow: {
|
|
|
442
442
|
'elevation-5': "0 12px 24px 0 rgba(0, 0, 0, 0.10)";
|
|
443
443
|
};
|
|
444
444
|
|
|
445
|
-
declare function buildTheme(
|
|
445
|
+
declare function buildTheme<T extends object>(object: T, option?: ThemeOptions): null | T | {
|
|
446
|
+
[K in keyof T as `${string}${string & K}`]: T[K];
|
|
447
|
+
};
|
|
448
|
+
declare function factory(options?: BuildThemeOptions): Config['theme'];
|
|
446
449
|
declare const defaultTheme: Config['theme'];
|
|
447
450
|
declare const unocssTheme: {
|
|
448
451
|
colors: {
|
|
@@ -639,4 +642,4 @@ declare const unocssTheme: {
|
|
|
639
642
|
declare function buildPreset(extend?: boolean, buildOptions?: BuildThemeOptions): Partial<Config>;
|
|
640
643
|
declare const _default: Partial<tailwindcss_types_config.Config>;
|
|
641
644
|
|
|
642
|
-
export { type BuildThemeOptions, type ColorString, type Colors, type ColorsNames, type FontSizes, type Screens, type ScreensNumber, type Shadows, type UnocssFontSizes, animation, boxShadow, buildPreset, buildTheme, colors, colorsNames, _default as default, defaultTheme, customFontFamily as fontFamily, fontSize, isDetailFont, keyframes, screenSizes, screens, screensNumber, unocssTheme };
|
|
645
|
+
export { type BuildThemeOptions, type ColorString, type Colors, type ColorsNames, type ConfiguredThemes, type FontSizes, type Screens, type ScreensNumber, type Shadows, type ThemeOptions, type UnocssFontSizes, animation, boxShadow, buildPreset, buildTheme, colors, colorsNames, configuredThemes, _default as default, defaultTheme, factory, customFontFamily as fontFamily, fontSize, isDetailFont, keyframes, screenSizes, screens, screensNumber, unocssTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -24,15 +24,15 @@ type Colors = DefaultColors & MainColors & Record<ColorsNames, {
|
|
|
24
24
|
}>;
|
|
25
25
|
type ColorString = `${ColorsNames}-${ColorsVariations}` | keyof DefaultColors | keyof MainColors;
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
animation?: boolean;
|
|
33
|
-
keyframes?: boolean;
|
|
34
|
-
screens?: boolean;
|
|
27
|
+
declare const configuredThemes: readonly ["colors", "boxShadow", "fontSize", "fontFamily", "animation", "keyframes", "screens"];
|
|
28
|
+
type ConfiguredThemes = typeof configuredThemes[number];
|
|
29
|
+
interface ThemeOptions {
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
prefix?: string;
|
|
35
32
|
}
|
|
33
|
+
type BuildThemeOptions = {
|
|
34
|
+
[k in ConfiguredThemes]?: ThemeOptions;
|
|
35
|
+
};
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Converts the given string from camel-case to kebab-case.
|
|
@@ -442,7 +442,10 @@ declare const boxShadow: {
|
|
|
442
442
|
'elevation-5': "0 12px 24px 0 rgba(0, 0, 0, 0.10)";
|
|
443
443
|
};
|
|
444
444
|
|
|
445
|
-
declare function buildTheme(
|
|
445
|
+
declare function buildTheme<T extends object>(object: T, option?: ThemeOptions): null | T | {
|
|
446
|
+
[K in keyof T as `${string}${string & K}`]: T[K];
|
|
447
|
+
};
|
|
448
|
+
declare function factory(options?: BuildThemeOptions): Config['theme'];
|
|
446
449
|
declare const defaultTheme: Config['theme'];
|
|
447
450
|
declare const unocssTheme: {
|
|
448
451
|
colors: {
|
|
@@ -639,4 +642,4 @@ declare const unocssTheme: {
|
|
|
639
642
|
declare function buildPreset(extend?: boolean, buildOptions?: BuildThemeOptions): Partial<Config>;
|
|
640
643
|
declare const _default: Partial<tailwindcss_types_config.Config>;
|
|
641
644
|
|
|
642
|
-
export { type BuildThemeOptions, type ColorString, type Colors, type ColorsNames, type FontSizes, type Screens, type ScreensNumber, type Shadows, type UnocssFontSizes, animation, boxShadow, buildPreset, buildTheme, colors, colorsNames, _default as default, defaultTheme, customFontFamily as fontFamily, fontSize, isDetailFont, keyframes, screenSizes, screens, screensNumber, unocssTheme };
|
|
645
|
+
export { type BuildThemeOptions, type ColorString, type Colors, type ColorsNames, type ConfiguredThemes, type FontSizes, type Screens, type ScreensNumber, type Shadows, type ThemeOptions, type UnocssFontSizes, animation, boxShadow, buildPreset, buildTheme, colors, colorsNames, configuredThemes, _default as default, defaultTheme, factory, customFontFamily as fontFamily, fontSize, isDetailFont, keyframes, screenSizes, screens, screensNumber, unocssTheme };
|
package/dist/index.js
CHANGED
|
@@ -5,12 +5,13 @@ import {
|
|
|
5
5
|
colors,
|
|
6
6
|
customFontFamily,
|
|
7
7
|
defaultTheme,
|
|
8
|
+
factory,
|
|
8
9
|
fontSize,
|
|
9
10
|
keyframes,
|
|
10
11
|
screens,
|
|
11
12
|
screensNumber,
|
|
12
13
|
unocssTheme
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LHJY2ZQQ.js";
|
|
14
15
|
|
|
15
16
|
// src/plugins/index.ts
|
|
16
17
|
import animation2 from "tailwindcss-animate";
|
|
@@ -36,13 +37,13 @@ var colorsNames = [
|
|
|
36
37
|
function buildPreset(extend = true, buildOptions = {}) {
|
|
37
38
|
if (extend === false) {
|
|
38
39
|
return {
|
|
39
|
-
theme:
|
|
40
|
+
theme: factory(buildOptions),
|
|
40
41
|
plugins
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
return {
|
|
44
45
|
theme: {
|
|
45
|
-
extend:
|
|
46
|
+
extend: factory(buildOptions)
|
|
46
47
|
},
|
|
47
48
|
plugins
|
|
48
49
|
};
|
|
@@ -57,6 +58,7 @@ export {
|
|
|
57
58
|
colorsNames,
|
|
58
59
|
src_default as default,
|
|
59
60
|
defaultTheme,
|
|
61
|
+
factory,
|
|
60
62
|
customFontFamily as fontFamily,
|
|
61
63
|
fontSize,
|
|
62
64
|
keyframes,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@removify/tailwind-preset",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"description": "Tailwind CSS preset for Removify",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tailwind"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"tsx": "^4.19.1",
|
|
48
48
|
"typescript": "^5.6.2",
|
|
49
49
|
"vitest": "^2.1.1",
|
|
50
|
-
"@removify/tailwind-preset": "0.2.
|
|
50
|
+
"@removify/tailwind-preset": "0.2.2"
|
|
51
51
|
},
|
|
52
52
|
"lint-staged": {
|
|
53
53
|
"**/*.{js,ts,vue,html}": [
|