@pubinfo/config 2.0.0-beta.3 → 2.0.0-beta.30

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 (57) hide show
  1. package/dist/eslint/index.d.ts +1 -1
  2. package/dist/eslint/index.mjs +1 -1
  3. package/dist/index.d.mts +2 -2
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.mjs +4 -5
  6. package/dist/shared/{config.DPEra-Xx.mjs → config.D4FYsBnQ.mjs} +0 -8
  7. package/dist/stylelint.d.ts +1 -1
  8. package/dist/themes/index.d.mts +2 -8
  9. package/dist/themes/index.d.ts +2 -8
  10. package/dist/themes/index.mjs +610 -3
  11. package/dist/unocss/index.d.mts +8 -0
  12. package/dist/unocss/index.d.ts +8 -0
  13. package/dist/unocss/index.mjs +103 -0
  14. package/package.json +16 -21
  15. package/src/eslint/config/ignores.ts +10 -0
  16. package/src/eslint/config/stylistic.ts +21 -0
  17. package/src/eslint/config/vue.ts +54 -0
  18. package/src/eslint/factory.ts +20 -0
  19. package/src/eslint/globs.ts +86 -0
  20. package/src/eslint/index.ts +3 -0
  21. package/src/index.ts +4 -0
  22. package/src/stylelint.ts +135 -0
  23. package/src/themes/index.ts +3 -0
  24. package/src/themes/system/dark/dark.ts +47 -0
  25. package/src/themes/system/dark/dracula.ts +47 -0
  26. package/src/themes/system/dark/luxury.ts +47 -0
  27. package/src/themes/system/dark/night.ts +47 -0
  28. package/src/themes/system/dark/stone.ts +47 -0
  29. package/src/themes/system/dark/synthwave.ts +47 -0
  30. package/src/themes/system/light/barbie.ts +47 -0
  31. package/src/themes/system/light/classic.ts +47 -0
  32. package/src/themes/system/light/cyberpunk.ts +47 -0
  33. package/src/themes/system/light/light.ts +47 -0
  34. package/src/themes/system/light/naive.ts +47 -0
  35. package/src/themes/system/light/winter.ts +47 -0
  36. package/src/themes/theme.ts +18 -0
  37. package/src/themes/unocss-utils.ts +52 -0
  38. package/src/themes/utils.ts +81 -0
  39. package/src/unocss/index.ts +61 -0
  40. package/src/unocss/presetThemes.ts +57 -0
  41. package/dist/eslint/index.cjs +0 -8
  42. package/dist/eslint/index.d.cts +0 -6
  43. package/dist/index.cjs +0 -21
  44. package/dist/index.d.cts +0 -6
  45. package/dist/shared/config.BDKVPKTO.mjs +0 -635
  46. package/dist/shared/config.CSqBb4YU.d.cts +0 -5
  47. package/dist/shared/config.YMrrkzU5.cjs +0 -641
  48. package/dist/shared/config.wdnazHMp.cjs +0 -147
  49. package/dist/stylelint.cjs +0 -139
  50. package/dist/stylelint.d.cts +0 -106
  51. package/dist/themes/index.cjs +0 -13
  52. package/dist/themes/index.d.cts +0 -33
  53. package/dist/unocss.cjs +0 -59
  54. package/dist/unocss.d.cts +0 -5
  55. package/dist/unocss.d.mts +0 -5
  56. package/dist/unocss.d.ts +0 -5
  57. package/dist/unocss.mjs +0 -57
@@ -0,0 +1,57 @@
1
+ import type { globalTheme } from '../themes';
2
+ import { definePreset, entriesToCss, toArray } from '@unocss/core';
3
+ import { getThemes } from '../themes';
4
+
5
+ type colorScheme = 'light' | 'dark';
6
+
7
+ const suffix = [['', ' *', '::before', '::after'], ['::backdrop']];
8
+
9
+ function createCssVar(key: colorScheme, themeName: string) {
10
+ function createSuffixScheme(preSuffix: string, suffixMap = suffix) {
11
+ return suffixMap.reduce<string[]>((acc, suffix) => acc.concat(suffix.map(s => `${preSuffix}${s}`).join(',')), []);
12
+ }
13
+ const map = {
14
+ light(key: string) {
15
+ const preSuffix = `[data-theme="${key}"]`;
16
+ return createSuffixScheme(preSuffix);
17
+ },
18
+ dark(key: string) {
19
+ const preSuffix = `html.dark [data-theme="${key}"]`;
20
+ return createSuffixScheme(preSuffix);
21
+ },
22
+ };
23
+ return map[key](themeName);
24
+ }
25
+
26
+ function mergeTheme(themes: globalTheme[]): globalTheme {
27
+ const themeColor = Object.assign({}, ...themes);
28
+ return themeColor;
29
+ }
30
+
31
+ function normalizePreflights(_themes: globalTheme[] = []) {
32
+ return {
33
+ getCSS: () => {
34
+ const injectionCss: string[] = [];
35
+ const themes = Object.assign(getThemes(), mergeTheme(_themes));
36
+ Object.keys(themes).forEach((key) => {
37
+ delete themes[key].label;
38
+ const css = entriesToCss(Object.entries(themes[key]));
39
+ const themeColorScheme = themes[key]['color-scheme'] as colorScheme;
40
+ const roots = toArray(
41
+ createCssVar(themeColorScheme, key),
42
+ );
43
+ injectionCss.push(roots.map(root => `${root}{${css}}`).join(''));
44
+ });
45
+ return injectionCss.join('');
46
+ },
47
+ };
48
+ }
49
+
50
+ export const presetThemes = definePreset<{ themes?: globalTheme[] }>((options) => {
51
+ return {
52
+ name: '@wsys/preset-themes',
53
+ preflights: [
54
+ normalizePreflights(options?.themes),
55
+ ],
56
+ };
57
+ });
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- const factory = require('../shared/config.wdnazHMp.cjs');
4
- require('@antfu/eslint-config');
5
-
6
-
7
-
8
- module.exports = factory.pubinfo;
@@ -1,6 +0,0 @@
1
- import { p as pubinfo } from '../shared/config.CSqBb4YU.cjs';
2
- import '@antfu/eslint-config';
3
-
4
-
5
-
6
- export = pubinfo;
package/dist/index.cjs DELETED
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- const factory = require('./shared/config.wdnazHMp.cjs');
4
- const stylelint = require('./stylelint.cjs');
5
- const presetThemes = require('./shared/config.YMrrkzU5.cjs');
6
- const unocss = require('./unocss.cjs');
7
- require('@antfu/eslint-config');
8
- require('@unocss/core');
9
- require('@unocss/preset-mini/utils');
10
- require('unocss');
11
-
12
-
13
-
14
- exports.eslint = factory.pubinfo;
15
- exports.stylelint = stylelint;
16
- exports.customColorKey = presetThemes.customColorKey;
17
- exports.defineTheme = presetThemes.defineTheme;
18
- exports.mergeTheme = presetThemes.mergeTheme;
19
- exports.presetThemes = presetThemes.presetThemes;
20
- exports.themes = presetThemes.themes;
21
- exports.presetPubinfo = unocss;
package/dist/index.d.cts DELETED
@@ -1,6 +0,0 @@
1
- export { p as eslint } from './shared/config.CSqBb4YU.cjs';
2
- export { default as stylelint } from './stylelint.cjs';
3
- export { colorScheme, cssVarKey, customColorKey, defineTheme, globalTheme, mergeTheme, presetThemes, themeOptions, themes } from './themes/index.cjs';
4
- export { default as presetPubinfo } from './unocss.cjs';
5
- import '@antfu/eslint-config';
6
- import 'unocss';