@ithinkdt/ui 4.0.0-110 → 4.0.0-120

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.
@@ -653,11 +653,11 @@ const DataForm = /* @__PURE__ */ defineComponent({
653
653
  }),
654
654
  b.showResetBtn === !1 ? void 0 : createVNode(NButton, {
655
655
  attrType: "reset",
656
- disabled: b.disabled || x,
656
+ disabled: b.disabled || x || G,
657
657
  type: b.showCancelBtn ? "primary" : "default",
658
658
  secondary: b.showCancelBtn
659
659
  }, { default: () => [b.resetText || C("common.page.form.resetText")] }),
660
- b.showCancelBtn === !1 ? void 0 : createVNode(NButton, {
660
+ b.showCancelBtn === !1 && !G ? void 0 : createVNode(NButton, {
661
661
  attrType: "button",
662
662
  disabled: b.disabled || x,
663
663
  onClick: D
@@ -1,5 +1,5 @@
1
1
  import "./use-i18n-Dx7V4KrY.js";
2
2
  import "./directives-DUuJW647.js";
3
3
  import "./use-style-DcT-1dj4.js";
4
- import { a as NRadios, c as DataSelection, d as useLocaleEdit, f as DataFilter, g as NCheckboxes, h as DataActions, i as renderUsers, l as DataPagination, m as DataCustom, n as DtUserDept, o as DataTable, p as DataForm, r as DtUserRender, s as useDataTableDrag, t as DtDeptRender, u as DataLocaleInput } from "./components-BdbuJNhZ.js";
4
+ import { a as NRadios, c as DataSelection, d as useLocaleEdit, f as DataFilter, g as NCheckboxes, h as DataActions, i as renderUsers, l as DataPagination, m as DataCustom, n as DtUserDept, o as DataTable, p as DataForm, r as DtUserRender, s as useDataTableDrag, t as DtDeptRender, u as DataLocaleInput } from "./components-DFllLyV9.js";
5
5
  export { DataActions, DataCustom, DataFilter, DataForm, DataLocaleInput, DataPagination, DataSelection, DataTable, DtDeptRender, DtUserDept, DtUserRender, NCheckboxes, NRadios, renderUsers, useDataTableDrag, useLocaleEdit };
package/dist/page.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as useI18n } from "./use-i18n-Dx7V4KrY.js";
2
2
  import "./directives-DUuJW647.js";
3
3
  import "./use-style-DcT-1dj4.js";
4
- import { a as NRadios, g as NCheckboxes, n as DtUserDept, p as DataForm, r as DtUserRender, t as DtDeptRender } from "./components-BdbuJNhZ.js";
4
+ import { a as NRadios, g as NCheckboxes, n as DtUserDept, p as DataForm, r as DtUserRender, t as DtDeptRender } from "./components-DFllLyV9.js";
5
5
  import { computed, createVNode, defineComponent, h, isVNode, mergeProps, ref, shallowRef, unref } from "vue";
6
6
  import { until } from "@vueuse/core";
7
7
  import { NButton, NCheckbox, NColorPicker, NDatePicker, NDrawer, NDrawerContent, NFlex, NInput, NInputNumber, NModal, NScrollbar, NSelect, NText, NUpload, useMessage } from "ithinkdt-ui";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ithinkdt/ui",
3
- "version": "4.0.0-110",
3
+ "version": "4.0.0-120",
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-50"
67
+ "@ithinkdt/common": "^4.0.0-101"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@ithinkdt/page": ">=4.0",
@@ -85,11 +85,11 @@
85
85
  "@vitejs/plugin-vue-jsx": "^5.1.1",
86
86
  "ithinkdt-ui": "^1.8.0",
87
87
  "typescript": "~5.9.3",
88
- "unocss": ">=66.5.4",
89
- "vite": "npm:rolldown-vite@^7.1.20",
90
- "vue": "^3.5.22",
88
+ "unocss": ">=66.5.5",
89
+ "vite": "npm:rolldown-vite@^7.2.2",
90
+ "vue": "^3.5.24",
91
91
  "vue-router": "^4.6.3",
92
- "@ithinkdt/page": "^4.0.0-50"
92
+ "@ithinkdt/page": "^4.0.0-100"
93
93
  },
94
94
  "scripts": {
95
95
  "dev": "vite build --watch",
@@ -1,5 +1,5 @@
1
- import { PresetFactory, PresetUnoTheme } from 'unocss'
1
+ import { Preset, PresetWind4Theme } from 'unocss'
2
2
 
3
- declare const ithinkdt: PresetFactory<PresetUnoTheme, {}>
3
+ declare const ithinkdt: (options?: { namespace?: string | undefined }) => Preset<PresetWind4Theme>[]
4
4
 
5
5
  export default ithinkdt
package/unocss-preset.js CHANGED
@@ -1,31 +1,96 @@
1
- const ithinkdt = () => {
2
- return {
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 = {
3
67
  name: 'preset-ithinkdt',
68
+ options,
4
69
  theme: {
5
70
  colors: {
6
71
  ...Object.fromEntries(
7
72
  ['primary', 'success', 'warning', 'danger'].map(name => [
8
73
  name,
9
74
  {
10
- DEFAULT: `rgb(var(--color-${name}-rgb) / <alpha-value>)`,
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}%)`])),
11
77
  ...Object.fromEntries(
12
- ['hover', 'active'].map(level => [
13
- level,
14
- `rgb(var(--color-${name}-${level}-rgb) / <alpha-value>)`,
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}%)`]),
15
81
  ]),
16
82
  ),
17
83
  },
18
84
  ]),
19
85
  ),
20
86
  text: {
21
- DEFAULT: `rgb(var(--color-text-rgb))`,
22
- },
23
- base: {
24
- DEFAULT: `rgb(var(--color-base-rgb))`,
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}%)`])),
25
89
  },
90
+ base: { DEFAULT: `var(--color-base)` },
26
91
  },
27
- borderRadius: Object.fromEntries(
28
- ['tiny', 'small', 'medium', 'large'].map(size => [size, `var(--rounded-${size})`]),
92
+ radius: Object.fromEntries(
93
+ ['xs', 'sm', 'md', 'lg'].map(size => [size, `var(--rounded-${size})`]),
29
94
  ),
30
95
  },
31
96
  variants: [
@@ -70,25 +135,29 @@ const ithinkdt = () => {
70
135
  [
71
136
  /^card-(.*)$/,
72
137
  ([_, size]) => {
73
- const i = ['none', 'small', 'medium', 'large'].indexOf(size)
138
+ const i = ['none', 'sm', 'md', 'lg'].indexOf(size)
74
139
  if (i === -1) return
75
140
  const p = [0, 2, 4, 5][i]
76
141
  return `rounded-${size} px-${p + 1} py-${p} bg-white dark:bg-dark ease-in-out transition-shadow
77
142
  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)]`
78
143
  },
79
- { autocomplete: ['card-none', 'card-small', 'card-medium', 'card-large'] },
144
+ { autocomplete: ['card-none', 'card-sm', 'card-md', 'card-lg'] },
80
145
  ],
81
146
  {
82
147
  'ell': 'truncate',
83
148
  'ell-2': 'line-clamp-2',
84
149
  'ell-3': 'line-clamp-3',
85
- 'flex-x-center': 'flex items-center',
86
- 'flex-y-center': 'flex justify-center',
87
150
  'flex-center': 'flex justify-center items-center',
88
- 'card': `card-medium`,
151
+ 'card': `card-md`,
89
152
  },
90
153
  ],
154
+ transformers: [transformerDirectives(), transformerVariantGroup()],
155
+ postprocess: postprocess,
91
156
  }
157
+ return [
158
+ wind4(),
159
+ ithinkdt,
160
+ ]
92
161
  }
93
162
 
94
163
  export default ithinkdt