@ithinkdt/ui 4.0.0-20 → 4.0.0-201

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 (60) hide show
  1. package/auto-imports.js +1 -1
  2. package/dist/components-Ceazjkie.js +1736 -0
  3. package/dist/components.js +5 -0
  4. package/dist/directives-DUuJW647.js +183 -0
  5. package/dist/directives.js +3 -0
  6. package/dist/index.js +1224 -0
  7. package/dist/page.js +519 -0
  8. package/dist/use-i18n-Dx7V4KrY.js +6 -0
  9. package/dist/use-style-DcT-1dj4.js +29 -0
  10. package/dist/use-style.js +2 -0
  11. package/{src → esm}/components.d.ts +63 -17
  12. package/esm/components.js +1 -0
  13. package/{src → esm}/design.d.ts +9 -0
  14. package/esm/directives.js +1 -0
  15. package/esm/index.js +1 -0
  16. package/{src → esm}/page.d.ts +43 -26
  17. package/esm/page.js +1 -0
  18. package/esm/use-style.js +1 -0
  19. package/locale.d.ts +4 -0
  20. package/package.json +31 -28
  21. package/unocss-preset.d.ts +5 -0
  22. package/unocss-preset.js +163 -0
  23. package/src/components/Checkboxes.jsx +0 -130
  24. package/src/components/DataActions.jsx +0 -105
  25. package/src/components/DataCustom.jsx +0 -172
  26. package/src/components/DataFilter.jsx +0 -113
  27. package/src/components/DataForm.jsx +0 -264
  28. package/src/components/DataLocaleInput.jsx +0 -121
  29. package/src/components/DataPagination.jsx +0 -62
  30. package/src/components/DataSelection.jsx +0 -57
  31. package/src/components/DataTable.jsx +0 -255
  32. package/src/components/Radios.jsx +0 -134
  33. package/src/components/UserDept.jsx +0 -643
  34. package/src/components/assets.jsx +0 -274
  35. package/src/components/index.js +0 -11
  36. package/src/design/Account.jsx +0 -152
  37. package/src/design/Appearance.jsx +0 -89
  38. package/src/design/Breadcrumb.jsx +0 -67
  39. package/src/design/Fullscreen.jsx +0 -65
  40. package/src/design/Language.jsx +0 -45
  41. package/src/design/Layout.jsx +0 -241
  42. package/src/design/Logo.jsx +0 -92
  43. package/src/design/Menu.jsx +0 -133
  44. package/src/design/MultiTabs.jsx +0 -501
  45. package/src/design/Notification.jsx +0 -311
  46. package/src/design/common.jsx +0 -21
  47. package/src/design/index.js +0 -10
  48. package/src/directives/index.js +0 -2
  49. package/src/directives/spin.js +0 -181
  50. package/src/directives/tooltip.jsx +0 -121
  51. package/src/index.js +0 -18
  52. package/src/page.jsx +0 -628
  53. package/src/use-i18n.js +0 -8
  54. package/src/use-style.js +0 -58
  55. package/src/utils.js +0 -20
  56. package/unocss.d.ts +0 -5
  57. package/unocss.js +0 -94
  58. /package/{src → esm}/directives.d.ts +0 -0
  59. /package/{src → esm}/index.d.ts +0 -0
  60. /package/{src → esm}/use-style.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import {
2
- CheckboxGroupProps, DataTableInst as NDataTableInst, DataTableProps as NDataTableProps,
2
+ CheckboxGroupProps, DataTableInst as NDataTableInst, DataTableProps as NDataTableProps, FlexProps,
3
3
  FormItemGiProps as NFormItemGiProps, FormProps as NFormProps, GridItemProps as NGridItemProps, GridProps as NGridProps,
4
4
  PopoverProps,
5
5
  RadioGroupProps, TransferProps,
@@ -16,6 +16,12 @@ declare module '@ithinkdt/page' {
16
16
 
17
17
  interface FormRenderExtraOptions {
18
18
  showColon?: MaybeRef<boolean | undefined>
19
+ labelWidth?: MaybeRef<string | number | undefined>
20
+ labelAlign?: MaybeRef<'left' | 'right' | 'center' | undefined>
21
+ labelPlacement?: MaybeRef<'left' | 'top' | undefined>
22
+ showRequireMark?: MaybeRef<boolean | undefined>
23
+ requireMarkPlacement?: MaybeRef<'left' | 'right' | 'right-hanging' | undefined>
24
+ showFeedback?: MaybeRef<boolean | undefined>
19
25
  }
20
26
 
21
27
  type FormItemOptionKeys = 'size' | 'showLabel' | 'labelWidth' | 'labelStyle' | 'labelAlign' | 'labelPlacement' | 'labelProps'
@@ -48,16 +54,9 @@ declare module '@ithinkdt/page' {
48
54
 
49
55
  }
50
56
 
51
- export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules' | 'onSubmit' | 'validateMessages'> & {
52
- items: FormItem<Data>[]
53
- model: Data
54
- readonly?: boolean | undefined
55
- grid?: boolean | NGridProps | undefined
56
- validation?: { [k in keyof Data]?: ValidationResults } | undefined
57
- showColon?: boolean | undefined
58
- loading?: boolean | undefined
59
- showAction?: boolean | NGridItemProps & AllowedComponentProps | undefined
60
- actionAlign?: 'start' | 'center' | 'end'
57
+ export type DataFormActionsProps = Pick<FlexProps, 'align' | 'justify' | 'vertical' | 'reverse'> & {
58
+ size?: 'small' | 'medium' | 'large' | undefined
59
+ gap?: number | string | undefined
61
60
  submitText?: VNodeChild | undefined
62
61
  resetText?: VNodeChild | undefined
63
62
  cancelText?: VNodeChild | undefined
@@ -65,21 +64,61 @@ export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules'
65
64
  showResetBtn?: boolean | undefined
66
65
  showCancelBtn?: boolean | undefined
67
66
  submitDisabled?: boolean | undefined
67
+ submitLoading?: boolean | undefined
68
68
  succeeded?: boolean | undefined
69
69
  successText?: VNodeChild | undefined
70
-
71
- tooltipPlacement?: 'bottom' | 'icon' | undefined
72
- onSubmit?: MaybeArray<(model: Data) => void> | undefined
70
+ failureText?: VNodeChild | undefined
71
+ onSubmit?: MaybeArray<() => void> | undefined
73
72
  onRest?: MaybeArray<() => void> | undefined
73
+ onCancel?: MaybeArray<() => void> | undefined
74
+ nativeButtonType?: boolean | undefined
75
+ }
76
+
77
+ export type DataFormActionsEmits = {
78
+ (e: 'submit'): void
79
+ (e: 'reset'): void
80
+ (e: 'cancel'): void
74
81
  }
75
82
 
83
+ export type DataFormActionsSlots = {
84
+ prefix?: () => VNodeChild
85
+ suffix?: () => VNodeChild
86
+ }
87
+
88
+ export declare function DataFormActions(
89
+ props: DataFormActionsProps & PublicProps,
90
+ ctx?: Pick<GenericCtx<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>, 'attrs' | 'emit' | 'slots'>,
91
+ expose?: (exposed?: GenericExposed) => void,
92
+ setup?: GenericCtx<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>,
93
+ ): GenericReturn<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>
94
+
95
+ export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules' | 'onSubmit' | 'validateMessages'>
96
+ & Omit<DataFormActionsProps, 'onSubmit' | 'size' | 'gap' | 'justify' | 'direction' | 'submitloading'> & {
97
+ items: FormItem<Data>[]
98
+ model: Data
99
+ readonly?: boolean | undefined
100
+ grid?: boolean | NGridProps | undefined
101
+ validation?: { [k in keyof Data]?: ValidationResults } | undefined
102
+ showColon?: boolean | undefined
103
+ tooltipPlacement?: 'bottom' | 'icon' | undefined
104
+ loading?: boolean | undefined
105
+ showAction?: boolean | NGridItemProps & AllowedComponentProps | undefined
106
+ actionJustify?: DataFormActionsProps['justify']
107
+ actionAlign?: DataFormActionsProps['align']
108
+ actionGap?: DataFormActionsProps['gap']
109
+ onSubmit?: MaybeArray<(model: Data) => void> | undefined
110
+ }
111
+
76
112
  export type DataFormEmits<Data extends {}> = {
77
113
  (e: 'submit', model: Data): void
78
114
  (e: 'reset'): void
115
+ (e: 'cancel'): void
79
116
  }
80
117
 
81
118
  export type DataFormSlots<_Data extends {}> = {
82
119
  action?: (params: { cols: number, spans: number, overflow: boolean }) => VNodeChild
120
+ actionPrefix?: () => VNodeChild
121
+ actionSuffix?: () => VNodeChild
83
122
  }
84
123
 
85
124
  export type DataFormInst = {
@@ -149,6 +188,7 @@ export type DataTableProps<Data extends {}, KeyField extends keyof Data>
149
188
  data?: Data[] | undefined
150
189
  keyField?: KeyField | undefined
151
190
  selectedKeys?: Data[KeyField][] | undefined
191
+ highlight?: boolean | Data[KeyField] | undefined
152
192
  sorter?: SortParams<Data> | undefined
153
193
  onSort?: MaybeArray<(param: SortParams<Data>) => void> | undefined
154
194
  onSelect?: MaybeArray<(param: NonNullable<Data[KeyField]>[]) => void> | undefined
@@ -157,6 +197,8 @@ export type DataTableProps<Data extends {}, KeyField extends keyof Data>
157
197
  export type DataTableEmits<Data extends {}, KeyField extends keyof Data> = {
158
198
  (e: 'sort', param: SortParams<Data>): void
159
199
  (e: 'select', param: Data[KeyField][]): void
200
+ (e: 'highlight', rowKey: Data[KeyField]): void
201
+ (e: 'custom', params: { key: string, width: number }): void
160
202
  }
161
203
 
162
204
  export type DataTableInst<Data extends {}, KeyField extends keyof Data> = NDataTableInst & {
@@ -182,7 +224,7 @@ export declare function useDataTableDrag<T>(
182
224
  { data, onSort, ...options }: {
183
225
  data: MaybeRef<T[]>
184
226
  onSort: (info: { from: number, to: number }) => void
185
- } & Omit<Sortable.Options, 'onSort'>
227
+ } & Omit<Sortable.Options, 'onSort'>,
186
228
  ): void
187
229
 
188
230
  export type DataPaginationProps = (PageParams | { page: PageParams }) & {
@@ -232,6 +274,8 @@ export type DataCustomProps<Data extends {}> = {
232
274
  disabledField?: keyof Data | undefined
233
275
  visiblityField?: keyof Data | undefined
234
276
  labelTitle?: VNodeChild | undefined
277
+ size?: number | undefined
278
+ type?: 'primary' | 'default' | undefined
235
279
  onCustom?: MaybeArray<
236
280
  ((reset: true) => void)
237
281
  | ((sort: string[]) => void)
@@ -300,7 +344,7 @@ export declare function DataLocaleInput(
300
344
  export declare function useLocaleEdit(
301
345
  title: VNodeChild | (() => VNodeChild),
302
346
  onSubmit: (data: Record<string, string | undefined>) => void,
303
- defaultRows?: MaybeRef<number | undefined>
347
+ defaultRows?: MaybeRef<number | undefined>,
304
348
  ): {
305
349
  open(this: void, data: MaybePromise<Record<string, string | undefined>>, readonly?: boolean): PromiseLike<Record<string, string | undefined>>
306
350
  setSupports(this: void, supports: { label: string, value: string, required?: boolean }[]): void
@@ -362,6 +406,7 @@ export interface UserGroupOption {
362
406
  name: string
363
407
  }
364
408
  export interface DeptOption {
409
+ id?: string | undefined
365
410
  code: string
366
411
  name: string
367
412
  children?: DeptOption[]
@@ -377,7 +422,8 @@ interface UserDeptProps<Multiple extends boolean> {
377
422
  'filterable'?: boolean | undefined
378
423
  'disabled'?: boolean | undefined
379
424
  'size'?: TransferProps['size'] | undefined
380
- 'users'?: { username: string, nickname: string }[] | undefined
425
+ 'valueField'?: 'id' | 'username' | 'code' | undefined
426
+ 'users'?: { id?: string | undefined, username: string, nickname: string }[] | undefined
381
427
  'groups'?: UserGroupOption[] | undefined
382
428
  'depts'?: DeptOption[] | undefined
383
429
  'getUsersByGroup'?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
@@ -0,0 +1 @@
1
+ export * from '../dist/components.js'
@@ -154,6 +154,7 @@ export declare const AppAccount: (
154
154
  },
155
155
  context: {
156
156
  slots: {
157
+ extra?: (() => VNode) | undefined
157
158
  logoutButton?: (() => VNode) | undefined
158
159
  dropdown?: ((binding: { ChangePwd: Component, Logout: Component }) => VNode) | undefined
159
160
  dropdownExtra?: (() => VNode) | undefined
@@ -232,3 +233,11 @@ export interface NotificationProps {
232
233
  }
233
234
 
234
235
  export declare const AppNotification: (props: PublicProps & NotificationProps) => VNode
236
+
237
+ export interface TenantProps {
238
+ 'options': { id: string, name: string, shotName?: string | undefined, icon?: () => VNodeChild }[] | undefined
239
+ 'current': string | undefined
240
+ 'onUpdate:current'?: ((current: string) => void) | undefined
241
+ }
242
+
243
+ export declare const AppTenant: (props: PublicProps & TenantProps) => VNode
@@ -0,0 +1 @@
1
+ export * from '../dist/directives.js'
package/esm/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../dist/index.js'
@@ -1,44 +1,46 @@
1
1
  import {
2
- CheckboxProps, DatePickerProps, DatePickerSlots,
2
+ CheckboxProps,
3
+ DatePickerProps, DatePickerSlots,
3
4
  DrawerContentProps, DrawerProps,
4
5
  InputNumberProps, InputNumberSlots, InputProps, InputSlots,
5
6
  ModalOptions,
6
7
  SelectGroupOption, SelectOption, SelectProps, SelectSlots,
7
- UploadFileInfo,
8
+ UploadFileInfo, UploadProps,
8
9
  } from 'ithinkdt-ui'
9
- import { MaybeRef, VNode, VNodeProps } from 'vue'
10
+ import { MaybeRef, VNode } from 'vue'
10
11
 
12
+ import { PublicProps } from '@ithinkdt/common'
11
13
  import { DictItem, DictTypeKey } from '@ithinkdt/common/dict'
12
14
  import { PageOptions } from '@ithinkdt/page'
13
15
 
14
16
  import { CheckboxesProps, RadiosProps, UserDeptProps, UserGroupOption } from './components'
15
17
 
16
- type DeepMaybeRef<T extends {}> = {
18
+ type ShallowMaybeRef<T extends {}> = {
17
19
  [Key in (keyof T)]: MaybeRef<T[Key]>
18
20
  }
19
21
 
20
22
  declare module '@ithinkdt/page' {
21
23
  interface FormComponentPresets {
22
24
  input: {
23
- props?: DeepMaybeRef<Omit<InputProps, 'value' | 'onUpdate:value' | 'disabled'>> & VNodeProps
24
- slots?: InputSlots
25
+ inputProps?: ShallowMaybeRef<Omit<InputProps, 'value' | 'onUpdate:value' | 'disabled'>> & PublicProps
26
+ inputSlots?: InputSlots
25
27
  }
26
28
  number: {
27
- props?: DeepMaybeRef<Omit<InputNumberProps, 'value' | 'onUpdate:value' | 'disabled'>> & VNodeProps
28
- slots?: InputNumberSlots
29
+ numberProps?: ShallowMaybeRef<Omit<InputNumberProps, 'value' | 'onUpdate:value' | 'disabled'>> & PublicProps
30
+ numberSlots?: InputNumberSlots
29
31
  }
30
32
  select: {
31
- props?: DeepMaybeRef<Omit<SelectProps, 'options' | 'value' | 'onUpdate:value' | 'disabled'> & VNodeProps
33
+ selectProps?: ShallowMaybeRef<Omit<SelectProps, 'options' | 'value' | 'onUpdate:value' | 'disabled'> & PublicProps
32
34
  & {
33
35
  dictType?: DictTypeKey | undefined
34
36
  options?: DictItem[] | (SelectOption | SelectGroupOption)[] | undefined
35
37
  }>
36
- slots?: SelectSlots
38
+ selectSlots?: SelectSlots
37
39
  }
38
40
 
39
41
  checkbox: {
40
- props?: DeepMaybeRef<Omit<CheckboxProps, 'checked' | 'onUpdate:checked' | 'disabled'>> & VNodeProps
41
- slots?: {
42
+ checkboxProps?: ShallowMaybeRef<Omit<CheckboxProps, 'checked' | 'onUpdate:checked' | 'disabled'>> & PublicProps
43
+ checkboxSlots?: {
42
44
  default?: (() => VNode[]) | undefined
43
45
  checked?: (() => VNode[]) | undefined
44
46
  unchecked?: (() => VNode[]) | undefined
@@ -46,45 +48,59 @@ declare module '@ithinkdt/page' {
46
48
  }
47
49
 
48
50
  checkboxes: {
49
- props?: DeepMaybeRef<Omit<CheckboxesProps, 'disabled'> & VNodeProps
51
+ checkboxesProps?: ShallowMaybeRef<Omit<CheckboxesProps, 'disabled'> & PublicProps
50
52
  & {
51
53
  dictType?: DictTypeKey | undefined
52
54
  options?: DictItem[] | undefined
53
55
  }>
54
- slots?: { }
56
+ checkboxesSlots?: { }
55
57
  }
56
58
 
57
59
  radios: {
58
- props?: DeepMaybeRef<Omit<RadiosProps, 'disabled'> & VNodeProps
60
+ radiosProps?: ShallowMaybeRef<Omit<RadiosProps, 'disabled'> & PublicProps
59
61
  & {
60
62
  dictType?: DictTypeKey | undefined
61
63
  options?: DictItem[] | undefined
62
64
  }>
63
- slots?: { }
65
+ radiosSlots?: { }
64
66
  }
65
67
 
66
68
  datepicker: {
67
- props?: DeepMaybeRef<Omit<DatePickerProps, 'value' | 'onUpdate:value' | 'disabled'>> & VNodeProps
68
- slots?: DatePickerSlots
69
+ datepickerProps?: ShallowMaybeRef<Omit<DatePickerProps, 'value' | 'onUpdate:value' | 'disabled'>> & PublicProps
70
+ datepickerSlots?: DatePickerSlots
69
71
  }
70
72
 
71
73
  file: {
72
- props?: DeepMaybeRef<{
74
+ fileProps?: ShallowMaybeRef<{
73
75
  type?: 'file' | 'image' | undefined
74
76
  multiple?: boolean | undefined
75
77
  max?: number | undefined
76
78
  accept?: string | undefined
77
79
  maxSize?: number | undefined
78
- } & VNodeProps>
79
- slots?: {
80
+ onBeforeUpload?: UploadProps['onBeforeUpload']
81
+ } & PublicProps>
82
+ fileSlots?: {
83
+ default?: (() => VNode[]) | undefined
84
+ }
85
+ }
86
+ upload: {
87
+ uploadProps?: ShallowMaybeRef<{
88
+ type?: 'file' | 'image' | undefined
89
+ multiple?: boolean | undefined
90
+ max?: number | undefined
91
+ accept?: string | undefined
92
+ maxSize?: number | undefined
93
+ onBeforeUpload?: UploadProps['onBeforeUpload']
94
+ } & PublicProps>
95
+ uploadSlots?: {
80
96
  default?: (() => VNode[]) | undefined
81
97
  }
82
98
  }
83
99
 
84
100
  user: {
85
- props?: DeepMaybeRef<Omit<UserDeptProps<boolean>, 'modelValue' | 'onUpdate:modelValue' | 'disabled'
86
- | 'users' | 'groups' | 'depts' | 'getUsersByGroup' | 'getUsersByDept'>> & VNodeProps
87
- slots?: {}
101
+ userProps?: ShallowMaybeRef<Omit<UserDeptProps<boolean>, 'modelValue' | 'onUpdate:modelValue' | 'disabled'
102
+ | 'users' | 'groups' | 'depts' | 'getUsersByGroup' | 'getUsersByDept'>> & PublicProps
103
+ userSlots?: {}
88
104
  }
89
105
  }
90
106
 
@@ -128,9 +144,9 @@ declare module '@ithinkdt/page' {
128
144
  }
129
145
 
130
146
  type ModalOptionsKey = 'type' | keyof import('@ithinkdt/page').ModalOptions
131
- interface ModalDrawerOptions extends DeepMaybeRef<Omit<DrawerContentProps, ModalOptionsKey>>, DeepMaybeRef<Omit<DrawerProps, ModalOptionsKey>> { }
147
+ interface ModalDrawerOptions extends ShallowMaybeRef<Omit<DrawerContentProps, ModalOptionsKey>>, ShallowMaybeRef<Omit<DrawerProps, ModalOptionsKey>> { }
132
148
 
133
- interface ModalDialogOptions extends DeepMaybeRef<Omit<ModalOptions, ModalOptionsKey>> {}
149
+ interface ModalDialogOptions extends ShallowMaybeRef<Omit<ModalOptions, ModalOptionsKey>> {}
134
150
  }
135
151
 
136
152
  export declare function createPageFormHelper(options?: {
@@ -142,6 +158,7 @@ export declare function createPageFormHelper(options?: {
142
158
  uploadFile?: (file: File, options?: {
143
159
  onProgress?: ((percent: number) => void) | undefined
144
160
  }) => Promise<string>
161
+ getFileInfos?: (files: string[]) => Promise<UploadFileInfo[]>
145
162
  }): PageOptions['getFormItemRenderer']
146
163
  export declare function createPageTableHelper(options?: {
147
164
  getUsersByUsername?: (usernames: string[]) => Promise<{ username: string, nickname: string }[]>
package/esm/page.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../dist/page.js'
@@ -0,0 +1 @@
1
+ export { c, cB, cE, cM, default, useClsPrefix } from '../dist/use-style.js'
package/locale.d.ts CHANGED
@@ -29,6 +29,7 @@ export interface UILocale {
29
29
  account: {
30
30
  logout: string
31
31
  changePwd: string
32
+ changeTenant: string
32
33
  }
33
34
  notification: {
34
35
  tip: (params: { count?: number | null }) => string
@@ -61,6 +62,9 @@ export interface UILocale {
61
62
  resetText: string
62
63
  cancelText: string
63
64
  selectFileText: string
65
+ validate: {
66
+ fileErrorMessage: string
67
+ }
64
68
  }
65
69
  filter: {
66
70
  submitText: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ithinkdt/ui",
3
- "version": "4.0.0-20",
3
+ "version": "4.0.0-201",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "iThinkDT UI",
@@ -10,34 +10,35 @@
10
10
  "ui"
11
11
  ],
12
12
  "files": [
13
- "src",
13
+ "dist",
14
+ "esm",
14
15
  "auto-imports.*",
15
16
  "locale.*",
16
- "unocss.*"
17
+ "unocss*"
17
18
  ],
18
- "main": "./src/index.js",
19
- "module": "./src/index.js",
20
- "types": "./src/index.d.ts",
19
+ "main": "./esm/index.js",
20
+ "module": "./esm/index.js",
21
+ "types": "./esm/index.d.ts",
21
22
  "exports": {
22
23
  ".": {
23
- "types": "./src/index.d.ts",
24
- "default": "./src/index.js"
24
+ "types": "./esm/index.d.ts",
25
+ "default": "./esm/index.js"
25
26
  },
26
27
  "./directives": {
27
- "types": "./src/directives.d.ts",
28
- "default": "./src/directives/index.js"
28
+ "types": "./esm/directives.d.ts",
29
+ "default": "./esm/directives.js"
29
30
  },
30
31
  "./components": {
31
- "types": "./src/components.d.ts",
32
- "default": "./src/components/index.js"
32
+ "types": "./esm/components.d.ts",
33
+ "default": "./esm/components.js"
33
34
  },
34
35
  "./use-style": {
35
- "types": "./src/use-style.d.ts",
36
- "default": "./src/use-style.js"
36
+ "types": "./esm/use-style.d.ts",
37
+ "default": "./esm/use-style.js"
37
38
  },
38
39
  "./page": {
39
- "types": "./src/page.d.ts",
40
- "default": "./src/page.jsx"
40
+ "types": "./esm/page.d.ts",
41
+ "default": "./esm/page.js"
41
42
  },
42
43
  "./package.json": {
43
44
  "default": "./package.json"
@@ -47,8 +48,8 @@
47
48
  "default": "./auto-imports.js"
48
49
  },
49
50
  "./unocss": {
50
- "types": "./unocss.d.ts",
51
- "default": "./unocss.js"
51
+ "types": "./unocss-preset.d.ts",
52
+ "default": "./unocss-preset.js"
52
53
  }
53
54
  },
54
55
  "publishConfig": {
@@ -57,13 +58,13 @@
57
58
  },
58
59
  "sideEffects": false,
59
60
  "dependencies": {
60
- "@vueuse/core": "^13.9.0",
61
+ "@vueuse/core": "^14.0.0",
61
62
  "date-fns": "^4.1.0",
62
63
  "vueuc": "^0.4.65",
63
64
  "sortablejs": "^1.15.6",
64
- "@types/sortablejs": "^1.15.8",
65
+ "@types/sortablejs": "^1.15.9",
65
66
  "nanoid": "^5.1.6",
66
- "@ithinkdt/common": "^4.0.0-12"
67
+ "@ithinkdt/common": "^4.0.0-201"
67
68
  },
68
69
  "peerDependencies": {
69
70
  "@ithinkdt/page": ">=4.0",
@@ -82,15 +83,17 @@
82
83
  },
83
84
  "devDependencies": {
84
85
  "@vitejs/plugin-vue-jsx": "^5.1.1",
85
- "ithinkdt-ui": "^1.7.3",
86
+ "ithinkdt-ui": "^1.8.0",
86
87
  "typescript": "~5.9.3",
87
- "unocss": ">=66.5.3",
88
- "vite": "npm:rolldown-vite@^7.1.16",
89
- "vue": "^3.5.22",
90
- "vue-router": "^4.5.1",
91
- "@ithinkdt/page": "^4.0.0-12"
88
+ "unocss": ">=66.5.6",
89
+ "vite": "npm:rolldown-vite@^7.2.5",
90
+ "vue": "^3.5.24",
91
+ "vue-router": "^4.6.3",
92
+ "@ithinkdt/page": "^4.0.0-200"
92
93
  },
93
94
  "scripts": {
94
- "release": "pnpm publish --no-git-checks"
95
+ "dev": "vite build --watch",
96
+ "build": "vite build",
97
+ "release": "pnpm run build && pnpm publish --no-git-checks"
95
98
  }
96
99
  }
@@ -0,0 +1,5 @@
1
+ import { Preset, PresetWind4Theme } from 'unocss'
2
+
3
+ declare const ithinkdt: (options?: { namespace?: string | undefined }) => Preset<PresetWind4Theme>[]
4
+
5
+ export default ithinkdt
@@ -0,0 +1,163 @@
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 = {
67
+ name: 'preset-ithinkdt',
68
+ options,
69
+ theme: {
70
+ colors: {
71
+ ...Object.fromEntries(
72
+ ['primary', 'success', 'warning', 'danger'].map(name => [
73
+ name,
74
+ {
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}%)`])),
77
+ ...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}%)`]),
81
+ ]),
82
+ ),
83
+ },
84
+ ]),
85
+ ),
86
+ 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}%)`])),
89
+ },
90
+ base: { DEFAULT: `var(--color-base)` },
91
+ },
92
+ radius: Object.fromEntries(
93
+ ['xs', 'sm', 'md', 'lg'].map(size => [size, `var(--rounded-${size})`]),
94
+ ),
95
+ },
96
+ variants: [
97
+ // stuck:
98
+ (matcher) => {
99
+ const array = ['top', 'right', 'bottom', 'left']
100
+ const index = array.findIndex(it => matcher.startsWith(`stuck-${it}:`))
101
+ if (index === -1)
102
+ return matcher
103
+ return {
104
+ matcher: matcher.slice(7 + array[index].length),
105
+ handle: (input, next) => next({
106
+ ...input,
107
+ parent: `${input.parent ? `${input.parent} $$ ` : ''} @container scroll-state(stuck: ${array[index]})`,
108
+ }),
109
+ }
110
+ },
111
+ ],
112
+ rules: [
113
+ ['scroll-state', { 'container-type': 'scroll-state' }],
114
+ [
115
+ /^bg-img-(.*)$/,
116
+ ([_, r]) => {
117
+ return {
118
+ 'background-image': r[0] === '[' && r.at(-1) === ']' ? r.slice(1, -1) : r,
119
+ }
120
+ },
121
+ ],
122
+ [
123
+ /^mask-(.*)$/,
124
+ ([_, r]) => {
125
+ const mask = `var(--un-icon) no-repeat`
126
+ return {
127
+ '--un-icon': r[0] === '[' && r.at(-1) === ']' ? r.slice(1, -1) : r,
128
+ mask,
129
+ 'mask-size': '100% 100%',
130
+ }
131
+ },
132
+ ],
133
+ ],
134
+ shortcuts: [
135
+ [
136
+ /^card-(.*)$/,
137
+ ([_, size]) => {
138
+ const i = ['none', 'sm', 'md', 'lg'].indexOf(size)
139
+ if (i === -1) return
140
+ const p = [0, 2, 4, 5][i]
141
+ return `rounded-${size} px-${p + 1} py-${p} bg-white dark:bg-dark ease-in-out transition-shadow
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)]`
143
+ },
144
+ { autocomplete: ['card-none', 'card-sm', 'card-md', 'card-lg'] },
145
+ ],
146
+ {
147
+ 'ell': 'truncate',
148
+ 'ell-2': 'line-clamp-2',
149
+ 'ell-3': 'line-clamp-3',
150
+ 'flex-center': 'flex justify-center items-center',
151
+ 'card': `card-md`,
152
+ },
153
+ ],
154
+ transformers: [transformerDirectives(), transformerVariantGroup()],
155
+ postprocess: postprocess,
156
+ }
157
+ return [
158
+ wind4(),
159
+ ithinkdt,
160
+ ]
161
+ }
162
+
163
+ export default ithinkdt