@oiij/naive-ui 0.0.1 → 0.0.3

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 (40) hide show
  1. package/README.md +4 -23
  2. package/dist/_virtual/rolldown_runtime.cjs +30 -0
  3. package/dist/components/_utils/cssr-bem.d.ts +1 -0
  4. package/dist/components/_utils/index.d.ts +3 -0
  5. package/dist/components/_utils/prismjs.d.ts +1 -0
  6. package/dist/components/_utils/transition.cssr.d.ts +10 -0
  7. package/dist/components/bubble/Bubble.vue.d.ts +26 -0
  8. package/dist/components/bubble/bubble.cssr.d.ts +2 -0
  9. package/dist/components/bubble/index.d.ts +16 -0
  10. package/dist/components/config-providers/ConfigProviders.vue.d.ts +18 -0
  11. package/dist/components/config-providers/index.d.ts +20 -0
  12. package/dist/components/copy-button/CopyButton.vue.d.ts +24 -0
  13. package/dist/components/copy-button/index.d.ts +9 -0
  14. package/dist/components/icons/MageCopyFill.vue.d.ts +2 -0
  15. package/dist/components/icons/RiSearch2Line.vue.d.ts +2 -0
  16. package/dist/components/index.d.ts +6 -0
  17. package/dist/components/search-input/SearchInput.vue.d.ts +23 -0
  18. package/dist/components/search-input/index.d.ts +10 -0
  19. package/dist/components/tooltip-button/TooltipButton.vue.d.ts +24 -0
  20. package/dist/components/tooltip-button/index.d.ts +7 -0
  21. package/dist/components/type-writer/TypeWriter.vue.d.ts +17 -0
  22. package/dist/components/type-writer/index.d.ts +9 -0
  23. package/dist/components/type-writer/type-writer.cssr.d.ts +2 -0
  24. package/dist/components.cjs +38 -0
  25. package/dist/components.d.ts +1 -0
  26. package/dist/components.js +5686 -0
  27. package/dist/components.umd.cjs +38 -0
  28. package/dist/composables/useNaiveForm.cjs +61 -0
  29. package/dist/composables/useNaiveForm.d.cts +36 -0
  30. package/dist/composables/useNaiveForm.d.ts +36 -0
  31. package/dist/composables/useNaiveForm.js +60 -0
  32. package/dist/composables/useNaiveTheme.cjs +120 -0
  33. package/dist/composables/useNaiveTheme.d.cts +165 -0
  34. package/dist/composables/useNaiveTheme.d.ts +165 -0
  35. package/dist/composables/useNaiveTheme.js +119 -0
  36. package/dist/index.cjs +4 -172
  37. package/dist/index.d.cts +3 -178
  38. package/dist/index.d.ts +3 -178
  39. package/dist/index.js +3 -150
  40. package/package.json +72 -93
package/dist/index.cjs CHANGED
@@ -1,173 +1,5 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ const require_useNaiveForm = require('./composables/useNaiveForm.cjs');
2
+ const require_useNaiveTheme = require('./composables/useNaiveTheme.cjs');
19
3
 
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- useNaiveForm: () => useNaiveForm,
24
- useNaiveTheme: () => useNaiveTheme
25
- });
26
- module.exports = __toCommonJS(index_exports);
27
-
28
- // src/useNaiveForm.ts
29
- var import_mixte = require("mixte");
30
- var import_vue = require("vue");
31
- function useNaiveForm(options) {
32
- const { value, rules } = options ?? {};
33
- const userFormValue = (0, import_vue.ref)(value);
34
- const userFormRules = rules;
35
- const formRef = (0, import_vue.ref)();
36
- const formProps = {
37
- model: (0, import_vue.reactive)((0, import_vue.toValue)(userFormValue)),
38
- rules: userFormRules
39
- };
40
- const formInitialValues = (0, import_mixte.deepClone)(value);
41
- function validate() {
42
- return formRef.value?.validate();
43
- }
44
- function resetValidation() {
45
- formRef.value?.restoreValidation();
46
- }
47
- function clear() {
48
- Object.keys(userFormValue.value).forEach((key) => {
49
- userFormValue.value[key] = Array.isArray(userFormValue.value[key]) ? [] : (0, import_mixte.isObject)(userFormValue.value[key]) ? {} : null;
50
- });
51
- }
52
- function resetForm() {
53
- clear();
54
- (0, import_vue.nextTick)(() => {
55
- Object.assign(userFormValue.value, formInitialValues);
56
- });
57
- }
58
- function reset() {
59
- resetValidation();
60
- resetForm();
61
- }
62
- return {
63
- formRef,
64
- formProps,
65
- formValue: userFormValue,
66
- rules: userFormRules,
67
- validate,
68
- resetValidation,
69
- resetForm,
70
- reset,
71
- clear
72
- };
73
- }
74
-
75
- // src/useNaiveTheme.ts
76
- var import_colord = require("colord");
77
- var import_naive_ui = require("naive-ui");
78
- var import_vue2 = require("vue");
79
- function getStatusColor(color = "#ff461f") {
80
- return {
81
- color,
82
- hover: (0, import_colord.colord)(color).lighten(0.1).toHex(),
83
- pressed: (0, import_colord.colord)(color).darken(0.1).toHex(),
84
- suppl: (0, import_colord.colord)(color).lighten(0.1).toHex()
85
- };
86
- }
87
- var naiveLocaleMap = {
88
- "zh-CN": {
89
- name: "\u7B80\u4F53\u4E2D\u6587",
90
- dateLocale: import_naive_ui.dateZhCN,
91
- locale: import_naive_ui.zhCN
92
- },
93
- "en-US": {
94
- name: "English",
95
- dateLocale: import_naive_ui.dateEnUS,
96
- locale: import_naive_ui.enUS
97
- }
98
- };
99
- function useNaiveTheme(darkMode, language, globalThemeOverrides) {
100
- const { common, Dialog, ...extra } = globalThemeOverrides || {};
101
- const color = (0, import_vue2.ref)({
102
- primary: "#64748B",
103
- info: "#06b6d4",
104
- success: "#10b981",
105
- warning: "#fbbf24",
106
- error: "#f43f5e"
107
- });
108
- function setColor(v) {
109
- color.value = v;
110
- }
111
- const theme = (0, import_vue2.computed)(() => {
112
- return darkMode?.value ? import_naive_ui.darkTheme : void 0;
113
- });
114
- const themeOverrides = (0, import_vue2.computed)(() => {
115
- return {
116
- common: {
117
- bodyColor: darkMode?.value ? "#1f1f1f" : "#f5f5f5",
118
- primaryColor: color.value.primary,
119
- primaryColorHover: getStatusColor(color.value.primary).hover,
120
- primaryColorPressed: getStatusColor(color.value.primary).pressed,
121
- primaryColorSuppl: getStatusColor(color.value.primary).suppl,
122
- infoColor: color.value.info,
123
- infoColorHover: getStatusColor(color.value.info).hover,
124
- infoColorPressed: getStatusColor(color.value.info).pressed,
125
- infoColorSuppl: getStatusColor(color.value.info).suppl,
126
- successColor: color.value.success,
127
- successColorHover: getStatusColor(color.value.success).hover,
128
- successColorPressed: getStatusColor(color.value.success).pressed,
129
- successColorSuppl: getStatusColor(color.value.success).suppl,
130
- warningColor: color.value.warning,
131
- warningColorHover: getStatusColor(color.value.warning).hover,
132
- warningColorPressed: getStatusColor(color.value.warning).pressed,
133
- warningColorSuppl: getStatusColor(color.value.warning).suppl,
134
- errorColor: color.value.error,
135
- errorColorHover: getStatusColor(color.value.error).hover,
136
- errorColorPressed: getStatusColor(color.value.error).pressed,
137
- errorColorSuppl: getStatusColor(color.value.error).suppl,
138
- borderRadius: "6px",
139
- ...common
140
- },
141
- Dialog: {
142
- borderRadius: "12px",
143
- padding: "20px",
144
- closeMargin: "20px 20px 0 0",
145
- ...Dialog
146
- },
147
- ...extra
148
- };
149
- });
150
- const locale = (0, import_vue2.computed)(() => {
151
- if (!language?.value || !naiveLocaleMap[language.value])
152
- return naiveLocaleMap["zh-CN"].locale;
153
- return naiveLocaleMap[language.value].locale;
154
- });
155
- const dateLocale = (0, import_vue2.computed)(() => {
156
- if (!language?.value || !naiveLocaleMap[language.value])
157
- return naiveLocaleMap["zh-CN"].dateLocale;
158
- return naiveLocaleMap[language.value].dateLocale;
159
- });
160
- return {
161
- theme,
162
- themeOverrides,
163
- locale,
164
- dateLocale,
165
- color,
166
- setColor
167
- };
168
- }
169
- // Annotate the CommonJS export names for ESM import in node:
170
- 0 && (module.exports = {
171
- useNaiveForm,
172
- useNaiveTheme
173
- });
4
+ exports.useNaiveForm = require_useNaiveForm.useNaiveForm;
5
+ exports.useNaiveTheme = require_useNaiveTheme.useNaiveTheme;
package/dist/index.d.cts CHANGED
@@ -1,178 +1,3 @@
1
- import * as async_validator from 'async-validator';
2
- import * as vue from 'vue';
3
- import { Ref, ComputedRef } from 'vue';
4
- import { FormRules, FormItemRule, FormInst, GlobalThemeOverrides, NDateLocale } from 'naive-ui';
5
- import * as naive_ui_es_themes_interface from 'naive-ui/es/themes/interface';
6
-
7
- interface NaiveFormOptions<T extends object = Record<string, any>> {
8
- value?: T;
9
- rules?: Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>;
10
- }
11
- declare function useNaiveForm<T extends Record<string, any>>(options?: NaiveFormOptions<T>): {
12
- formRef: Ref<FormInst | undefined, FormInst | undefined>;
13
- formProps: {
14
- model: vue.Reactive<T>;
15
- rules: Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>> | undefined;
16
- };
17
- formValue: Ref<T>;
18
- rules: Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>> | undefined;
19
- validate: () => Promise<{
20
- warnings: async_validator.ValidateError[][] | undefined;
21
- }> | undefined;
22
- resetValidation: () => void;
23
- resetForm: () => void;
24
- reset: () => void;
25
- clear: () => void;
26
- };
27
-
28
- interface Color {
29
- primary: string;
30
- info: string;
31
- success: string;
32
- warning: string;
33
- error: string;
34
- }
35
- declare function useNaiveTheme(darkMode?: ComputedRef<boolean>, language?: ComputedRef<'zh-CN' | 'en-US'>, globalThemeOverrides?: GlobalThemeOverrides): {
36
- theme: ComputedRef<naive_ui_es_themes_interface.BuiltInGlobalTheme | undefined>;
37
- themeOverrides: ComputedRef<GlobalThemeOverrides>;
38
- locale: ComputedRef<{
39
- name: string;
40
- global: {
41
- undo: string;
42
- redo: string;
43
- confirm: string;
44
- clear: string;
45
- };
46
- Popconfirm: {
47
- positiveText: string;
48
- negativeText: string;
49
- };
50
- Cascader: {
51
- placeholder: string;
52
- loading: string;
53
- loadingRequiredMessage: (label: string) => string;
54
- };
55
- Time: {
56
- dateFormat: string;
57
- dateTimeFormat: string;
58
- };
59
- DatePicker: {
60
- yearFormat: string;
61
- monthFormat: string;
62
- dayFormat: string;
63
- yearTypeFormat: string;
64
- monthTypeFormat: string;
65
- dateFormat: string;
66
- dateTimeFormat: string;
67
- quarterFormat: string;
68
- weekFormat: string;
69
- clear: string;
70
- now: string;
71
- confirm: string;
72
- selectTime: string;
73
- selectDate: string;
74
- datePlaceholder: string;
75
- datetimePlaceholder: string;
76
- monthPlaceholder: string;
77
- yearPlaceholder: string;
78
- quarterPlaceholder: string;
79
- weekPlaceholder: string;
80
- startDatePlaceholder: string;
81
- endDatePlaceholder: string;
82
- startDatetimePlaceholder: string;
83
- endDatetimePlaceholder: string;
84
- startMonthPlaceholder: string;
85
- endMonthPlaceholder: string;
86
- monthBeforeYear: boolean;
87
- firstDayOfWeek: 0 | 1 | 2 | 3 | 4 | 5 | 6;
88
- today: string;
89
- };
90
- DataTable: {
91
- checkTableAll: string;
92
- uncheckTableAll: string;
93
- confirm: string;
94
- clear: string;
95
- };
96
- LegacyTransfer: {
97
- sourceTitle: string;
98
- targetTitle: string;
99
- };
100
- Transfer: {
101
- selectAll: string;
102
- unselectAll: string;
103
- clearAll: string;
104
- total: (num: number) => string;
105
- selected: (num: number) => string;
106
- };
107
- Empty: {
108
- description: string;
109
- };
110
- Select: {
111
- placeholder: string;
112
- };
113
- TimePicker: {
114
- placeholder: string;
115
- positiveText: string;
116
- negativeText: string;
117
- now: string;
118
- clear: string;
119
- };
120
- Pagination: {
121
- goto: string;
122
- selectionSuffix: string;
123
- };
124
- DynamicTags: {
125
- add: string;
126
- };
127
- Log: {
128
- loading: string;
129
- };
130
- Input: {
131
- placeholder: string;
132
- };
133
- InputNumber: {
134
- placeholder: string;
135
- };
136
- DynamicInput: {
137
- create: string;
138
- };
139
- ThemeEditor: {
140
- title: string;
141
- clearAllVars: string;
142
- clearSearch: string;
143
- filterCompName: string;
144
- filterVarName: string;
145
- import: string;
146
- export: string;
147
- restore: string;
148
- };
149
- Image: {
150
- tipPrevious: string;
151
- tipNext: string;
152
- tipCounterclockwise: string;
153
- tipClockwise: string;
154
- tipZoomOut: string;
155
- tipZoomIn: string;
156
- tipDownload: string;
157
- tipClose: string;
158
- tipOriginalSize: string;
159
- };
160
- }>;
161
- dateLocale: ComputedRef<NDateLocale>;
162
- color: vue.Ref<{
163
- primary: string;
164
- info: string;
165
- success: string;
166
- warning: string;
167
- error: string;
168
- }, Color | {
169
- primary: string;
170
- info: string;
171
- success: string;
172
- warning: string;
173
- error: string;
174
- }>;
175
- setColor: (v: Color) => void;
176
- };
177
-
178
- export { type NaiveFormOptions, useNaiveForm, useNaiveTheme };
1
+ import { NaiveFormOptions, NaiveFormReturns, NaiveFormRules, useNaiveForm } from "./composables/useNaiveForm.cjs";
2
+ import { NaiveThemeReturns, useNaiveTheme } from "./composables/useNaiveTheme.cjs";
3
+ export { NaiveFormOptions, NaiveFormReturns, NaiveFormRules, NaiveThemeReturns, useNaiveForm, useNaiveTheme };
package/dist/index.d.ts CHANGED
@@ -1,178 +1,3 @@
1
- import * as async_validator from 'async-validator';
2
- import * as vue from 'vue';
3
- import { Ref, ComputedRef } from 'vue';
4
- import { FormRules, FormItemRule, FormInst, GlobalThemeOverrides, NDateLocale } from 'naive-ui';
5
- import * as naive_ui_es_themes_interface from 'naive-ui/es/themes/interface';
6
-
7
- interface NaiveFormOptions<T extends object = Record<string, any>> {
8
- value?: T;
9
- rules?: Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>;
10
- }
11
- declare function useNaiveForm<T extends Record<string, any>>(options?: NaiveFormOptions<T>): {
12
- formRef: Ref<FormInst | undefined, FormInst | undefined>;
13
- formProps: {
14
- model: vue.Reactive<T>;
15
- rules: Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>> | undefined;
16
- };
17
- formValue: Ref<T>;
18
- rules: Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>> | undefined;
19
- validate: () => Promise<{
20
- warnings: async_validator.ValidateError[][] | undefined;
21
- }> | undefined;
22
- resetValidation: () => void;
23
- resetForm: () => void;
24
- reset: () => void;
25
- clear: () => void;
26
- };
27
-
28
- interface Color {
29
- primary: string;
30
- info: string;
31
- success: string;
32
- warning: string;
33
- error: string;
34
- }
35
- declare function useNaiveTheme(darkMode?: ComputedRef<boolean>, language?: ComputedRef<'zh-CN' | 'en-US'>, globalThemeOverrides?: GlobalThemeOverrides): {
36
- theme: ComputedRef<naive_ui_es_themes_interface.BuiltInGlobalTheme | undefined>;
37
- themeOverrides: ComputedRef<GlobalThemeOverrides>;
38
- locale: ComputedRef<{
39
- name: string;
40
- global: {
41
- undo: string;
42
- redo: string;
43
- confirm: string;
44
- clear: string;
45
- };
46
- Popconfirm: {
47
- positiveText: string;
48
- negativeText: string;
49
- };
50
- Cascader: {
51
- placeholder: string;
52
- loading: string;
53
- loadingRequiredMessage: (label: string) => string;
54
- };
55
- Time: {
56
- dateFormat: string;
57
- dateTimeFormat: string;
58
- };
59
- DatePicker: {
60
- yearFormat: string;
61
- monthFormat: string;
62
- dayFormat: string;
63
- yearTypeFormat: string;
64
- monthTypeFormat: string;
65
- dateFormat: string;
66
- dateTimeFormat: string;
67
- quarterFormat: string;
68
- weekFormat: string;
69
- clear: string;
70
- now: string;
71
- confirm: string;
72
- selectTime: string;
73
- selectDate: string;
74
- datePlaceholder: string;
75
- datetimePlaceholder: string;
76
- monthPlaceholder: string;
77
- yearPlaceholder: string;
78
- quarterPlaceholder: string;
79
- weekPlaceholder: string;
80
- startDatePlaceholder: string;
81
- endDatePlaceholder: string;
82
- startDatetimePlaceholder: string;
83
- endDatetimePlaceholder: string;
84
- startMonthPlaceholder: string;
85
- endMonthPlaceholder: string;
86
- monthBeforeYear: boolean;
87
- firstDayOfWeek: 0 | 1 | 2 | 3 | 4 | 5 | 6;
88
- today: string;
89
- };
90
- DataTable: {
91
- checkTableAll: string;
92
- uncheckTableAll: string;
93
- confirm: string;
94
- clear: string;
95
- };
96
- LegacyTransfer: {
97
- sourceTitle: string;
98
- targetTitle: string;
99
- };
100
- Transfer: {
101
- selectAll: string;
102
- unselectAll: string;
103
- clearAll: string;
104
- total: (num: number) => string;
105
- selected: (num: number) => string;
106
- };
107
- Empty: {
108
- description: string;
109
- };
110
- Select: {
111
- placeholder: string;
112
- };
113
- TimePicker: {
114
- placeholder: string;
115
- positiveText: string;
116
- negativeText: string;
117
- now: string;
118
- clear: string;
119
- };
120
- Pagination: {
121
- goto: string;
122
- selectionSuffix: string;
123
- };
124
- DynamicTags: {
125
- add: string;
126
- };
127
- Log: {
128
- loading: string;
129
- };
130
- Input: {
131
- placeholder: string;
132
- };
133
- InputNumber: {
134
- placeholder: string;
135
- };
136
- DynamicInput: {
137
- create: string;
138
- };
139
- ThemeEditor: {
140
- title: string;
141
- clearAllVars: string;
142
- clearSearch: string;
143
- filterCompName: string;
144
- filterVarName: string;
145
- import: string;
146
- export: string;
147
- restore: string;
148
- };
149
- Image: {
150
- tipPrevious: string;
151
- tipNext: string;
152
- tipCounterclockwise: string;
153
- tipClockwise: string;
154
- tipZoomOut: string;
155
- tipZoomIn: string;
156
- tipDownload: string;
157
- tipClose: string;
158
- tipOriginalSize: string;
159
- };
160
- }>;
161
- dateLocale: ComputedRef<NDateLocale>;
162
- color: vue.Ref<{
163
- primary: string;
164
- info: string;
165
- success: string;
166
- warning: string;
167
- error: string;
168
- }, Color | {
169
- primary: string;
170
- info: string;
171
- success: string;
172
- warning: string;
173
- error: string;
174
- }>;
175
- setColor: (v: Color) => void;
176
- };
177
-
178
- export { type NaiveFormOptions, useNaiveForm, useNaiveTheme };
1
+ import { NaiveFormOptions, NaiveFormReturns, NaiveFormRules, useNaiveForm } from "./composables/useNaiveForm.js";
2
+ import { NaiveThemeReturns, useNaiveTheme } from "./composables/useNaiveTheme.js";
3
+ export { NaiveFormOptions, NaiveFormReturns, NaiveFormRules, NaiveThemeReturns, useNaiveForm, useNaiveTheme };
package/dist/index.js CHANGED
@@ -1,151 +1,4 @@
1
- // src/useNaiveForm.ts
2
- import { deepClone, isObject } from "mixte";
3
- import { nextTick, reactive, ref, toValue } from "vue";
4
- function useNaiveForm(options) {
5
- const { value, rules } = options ?? {};
6
- const userFormValue = ref(value);
7
- const userFormRules = rules;
8
- const formRef = ref();
9
- const formProps = {
10
- model: reactive(toValue(userFormValue)),
11
- rules: userFormRules
12
- };
13
- const formInitialValues = deepClone(value);
14
- function validate() {
15
- return formRef.value?.validate();
16
- }
17
- function resetValidation() {
18
- formRef.value?.restoreValidation();
19
- }
20
- function clear() {
21
- Object.keys(userFormValue.value).forEach((key) => {
22
- userFormValue.value[key] = Array.isArray(userFormValue.value[key]) ? [] : isObject(userFormValue.value[key]) ? {} : null;
23
- });
24
- }
25
- function resetForm() {
26
- clear();
27
- nextTick(() => {
28
- Object.assign(userFormValue.value, formInitialValues);
29
- });
30
- }
31
- function reset() {
32
- resetValidation();
33
- resetForm();
34
- }
35
- return {
36
- formRef,
37
- formProps,
38
- formValue: userFormValue,
39
- rules: userFormRules,
40
- validate,
41
- resetValidation,
42
- resetForm,
43
- reset,
44
- clear
45
- };
46
- }
1
+ import { useNaiveForm } from "./composables/useNaiveForm.js";
2
+ import { useNaiveTheme } from "./composables/useNaiveTheme.js";
47
3
 
48
- // src/useNaiveTheme.ts
49
- import { colord } from "colord";
50
- import {
51
- darkTheme,
52
- dateEnUS,
53
- dateZhCN,
54
- enUS,
55
- zhCN
56
- } from "naive-ui";
57
- import { computed, ref as ref2 } from "vue";
58
- function getStatusColor(color = "#ff461f") {
59
- return {
60
- color,
61
- hover: colord(color).lighten(0.1).toHex(),
62
- pressed: colord(color).darken(0.1).toHex(),
63
- suppl: colord(color).lighten(0.1).toHex()
64
- };
65
- }
66
- var naiveLocaleMap = {
67
- "zh-CN": {
68
- name: "\u7B80\u4F53\u4E2D\u6587",
69
- dateLocale: dateZhCN,
70
- locale: zhCN
71
- },
72
- "en-US": {
73
- name: "English",
74
- dateLocale: dateEnUS,
75
- locale: enUS
76
- }
77
- };
78
- function useNaiveTheme(darkMode, language, globalThemeOverrides) {
79
- const { common, Dialog, ...extra } = globalThemeOverrides || {};
80
- const color = ref2({
81
- primary: "#64748B",
82
- info: "#06b6d4",
83
- success: "#10b981",
84
- warning: "#fbbf24",
85
- error: "#f43f5e"
86
- });
87
- function setColor(v) {
88
- color.value = v;
89
- }
90
- const theme = computed(() => {
91
- return darkMode?.value ? darkTheme : void 0;
92
- });
93
- const themeOverrides = computed(() => {
94
- return {
95
- common: {
96
- bodyColor: darkMode?.value ? "#1f1f1f" : "#f5f5f5",
97
- primaryColor: color.value.primary,
98
- primaryColorHover: getStatusColor(color.value.primary).hover,
99
- primaryColorPressed: getStatusColor(color.value.primary).pressed,
100
- primaryColorSuppl: getStatusColor(color.value.primary).suppl,
101
- infoColor: color.value.info,
102
- infoColorHover: getStatusColor(color.value.info).hover,
103
- infoColorPressed: getStatusColor(color.value.info).pressed,
104
- infoColorSuppl: getStatusColor(color.value.info).suppl,
105
- successColor: color.value.success,
106
- successColorHover: getStatusColor(color.value.success).hover,
107
- successColorPressed: getStatusColor(color.value.success).pressed,
108
- successColorSuppl: getStatusColor(color.value.success).suppl,
109
- warningColor: color.value.warning,
110
- warningColorHover: getStatusColor(color.value.warning).hover,
111
- warningColorPressed: getStatusColor(color.value.warning).pressed,
112
- warningColorSuppl: getStatusColor(color.value.warning).suppl,
113
- errorColor: color.value.error,
114
- errorColorHover: getStatusColor(color.value.error).hover,
115
- errorColorPressed: getStatusColor(color.value.error).pressed,
116
- errorColorSuppl: getStatusColor(color.value.error).suppl,
117
- borderRadius: "6px",
118
- ...common
119
- },
120
- Dialog: {
121
- borderRadius: "12px",
122
- padding: "20px",
123
- closeMargin: "20px 20px 0 0",
124
- ...Dialog
125
- },
126
- ...extra
127
- };
128
- });
129
- const locale = computed(() => {
130
- if (!language?.value || !naiveLocaleMap[language.value])
131
- return naiveLocaleMap["zh-CN"].locale;
132
- return naiveLocaleMap[language.value].locale;
133
- });
134
- const dateLocale = computed(() => {
135
- if (!language?.value || !naiveLocaleMap[language.value])
136
- return naiveLocaleMap["zh-CN"].dateLocale;
137
- return naiveLocaleMap[language.value].dateLocale;
138
- });
139
- return {
140
- theme,
141
- themeOverrides,
142
- locale,
143
- dateLocale,
144
- color,
145
- setColor
146
- };
147
- }
148
- export {
149
- useNaiveForm,
150
- useNaiveTheme
151
- };
4
+ export { useNaiveForm, useNaiveTheme };