@ithinkdt/ui 4.0.0-102 → 4.0.0-110

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ithinkdt/ui",
3
- "version": "4.0.0-102",
3
+ "version": "4.0.0-110",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "iThinkDT UI",
@@ -64,7 +64,7 @@
64
64
  "sortablejs": "^1.15.6",
65
65
  "@types/sortablejs": "^1.15.9",
66
66
  "nanoid": "^5.1.6",
67
- "@ithinkdt/common": "^4.0.0-100"
67
+ "@ithinkdt/common": "^4.0.0-50"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@ithinkdt/page": ">=4.0",
@@ -89,7 +89,7 @@
89
89
  "vite": "npm:rolldown-vite@^7.1.20",
90
90
  "vue": "^3.5.22",
91
91
  "vue-router": "^4.6.3",
92
- "@ithinkdt/page": "^4.0.0-100"
92
+ "@ithinkdt/page": "^4.0.0-50"
93
93
  },
94
94
  "scripts": {
95
95
  "dev": "vite build --watch",
@@ -1,5 +1,5 @@
1
- import { Preset, PresetWind4Theme } from 'unocss'
1
+ import { PresetFactory, PresetUnoTheme } from 'unocss'
2
2
 
3
- declare const ithinkdt: (options?: { namespace?: string | undefined }) => Preset<PresetWind4Theme>[]
3
+ declare const ithinkdt: PresetFactory<PresetUnoTheme, {}>
4
4
 
5
5
  export default ithinkdt
package/unocss-preset.js CHANGED
@@ -1,96 +1,31 @@
1
- import { presetWind4, transformerDirectives, transformerVariantGroup } from 'unocss'
2
-
3
- const ithinkdt = (options = {}) => {
4
- const { namespace: ns } = options
5
-
6
- let wind4, postprocess
7
- if (ns) {
8
- wind4 = () => {
9
- const plugin = presetWind4({
10
- variablePrefix: `${ns}-`,
11
- preflights: {
12
- reset: false,
13
- property: {
14
- selector: `.${ns} :where(*, ::before, ::after)`,
15
- },
16
- },
17
- })
18
-
19
- return {
20
- ...plugin,
21
- preflights: plugin.preflights?.map((preflight) => {
22
- if (preflight.layer === 'theme') {
23
- return {
24
- ...preflight,
25
- async getCSS(ctx) {
26
- let result = await preflight.getCSS?.(ctx)
27
- if (result) {
28
- result = result.replace(':root, :host', `.${ns}`)
29
- }
30
- return result
31
- },
32
- }
33
- } else if (preflight.layer === 'properties') {
34
- return {
35
- ...preflight,
36
- async getCSS(ctx) {
37
- let result = await preflight.getCSS?.(ctx)
38
- if (result) {
39
- result = result
40
- .replaceAll('--un-', `--${ns}-`)
41
- }
42
- return result
43
- },
44
- }
45
- }
46
- return preflight
47
- }),
48
- }
49
- }
50
- postprocess = [
51
- (p) => {
52
- if (p.selector.includes('--un-')) {
53
- p.selector = p.selector.replaceAll('--un-', `--${ns}-`)
54
- } else if (p.selector.endsWith(String.raw`.\-`)) {
55
- if (p.selector.startsWith('.dark ')) {
56
- p.selector = `.dark & ${p.selector.slice(6)}`
57
- }
58
- } else {
59
- p.selector = p.selector.startsWith('.dark ') ? `.dark .${ns} ${p.selector.slice(6)}` : `.${ns} ${p.selector}`
60
- }
61
- },
62
- ]
63
- } else { wind4 = presetWind4 }
64
-
65
- const alphas = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
66
- const ithinkdt = {
1
+ const ithinkdt = () => {
2
+ return {
67
3
  name: 'preset-ithinkdt',
68
- options,
69
4
  theme: {
70
5
  colors: {
71
6
  ...Object.fromEntries(
72
7
  ['primary', 'success', 'warning', 'danger'].map(name => [
73
8
  name,
74
9
  {
75
- DEFAULT: `var(--color-${name})`,
76
- ...Object.fromEntries(alphas.map(alpha => [`${alpha}`, `color-mix(in oklab, var(--color-${name}) ${alpha / 10}%, #fff ${(1000 - alpha) / 10}%)`])),
10
+ DEFAULT: `rgb(var(--color-${name}-rgb) / <alpha-value>)`,
77
11
  ...Object.fromEntries(
78
- ['hover', 'active'].flatMap(level => [
79
- [level, `var(--color-${name}-${level})`],
80
- ...alphas.map(alpha => [`${level}-${alpha}`, `color-mix(in oklab, var(--color-${name}-${level}) ${alpha / 10}%, #fff ${(1000 - alpha) / 10}%)`]),
12
+ ['hover', 'active'].map(level => [
13
+ level,
14
+ `rgb(var(--color-${name}-${level}-rgb) / <alpha-value>)`,
81
15
  ]),
82
16
  ),
83
17
  },
84
18
  ]),
85
19
  ),
86
20
  text: {
87
- DEFAULT: `var(--color-text)`,
88
- ...Object.fromEntries(alphas.map(alpha => [`${alpha}`, `color-mix(in oklab, var(--color-text) ${alpha / 10}%, #fff ${(1000 - alpha) / 10}%)`])),
21
+ DEFAULT: `rgb(var(--color-text-rgb))`,
22
+ },
23
+ base: {
24
+ DEFAULT: `rgb(var(--color-base-rgb))`,
89
25
  },
90
- base: { DEFAULT: `var(--color-base)` },
91
26
  },
92
- radius: Object.fromEntries(
93
- ['xs', 'sm', 'md', 'lg'].map(size => [size, `var(--rounded-${size})`]),
27
+ borderRadius: Object.fromEntries(
28
+ ['tiny', 'small', 'medium', 'large'].map(size => [size, `var(--rounded-${size})`]),
94
29
  ),
95
30
  },
96
31
  variants: [
@@ -135,29 +70,25 @@ const ithinkdt = (options = {}) => {
135
70
  [
136
71
  /^card-(.*)$/,
137
72
  ([_, size]) => {
138
- const i = ['none', 'sm', 'md', 'lg'].indexOf(size)
73
+ const i = ['none', 'small', 'medium', 'large'].indexOf(size)
139
74
  if (i === -1) return
140
75
  const p = [0, 2, 4, 5][i]
141
76
  return `rounded-${size} px-${p + 1} py-${p} bg-white dark:bg-dark ease-in-out transition-shadow
142
77
  hover:shadow-[0_1px_2px_0_rgba(0_0_0_/_0.03),0_1px_6px_-1px_rgba(0_0_0_/_0.02),0_2px_4px_0_rgba(0_0_0_/_0.02)]`
143
78
  },
144
- { autocomplete: ['card-none', 'card-sm', 'card-md', 'card-lg'] },
79
+ { autocomplete: ['card-none', 'card-small', 'card-medium', 'card-large'] },
145
80
  ],
146
81
  {
147
82
  'ell': 'truncate',
148
83
  'ell-2': 'line-clamp-2',
149
84
  'ell-3': 'line-clamp-3',
85
+ 'flex-x-center': 'flex items-center',
86
+ 'flex-y-center': 'flex justify-center',
150
87
  'flex-center': 'flex justify-center items-center',
151
- 'card': `card-md`,
88
+ 'card': `card-medium`,
152
89
  },
153
90
  ],
154
- transformers: [transformerDirectives(), transformerVariantGroup()],
155
- postprocess: postprocess,
156
91
  }
157
- return [
158
- wind4(),
159
- ithinkdt,
160
- ]
161
92
  }
162
93
 
163
94
  export default ithinkdt