@oiij/naive-ui 0.0.58 → 0.0.60

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.
@@ -0,0 +1,29 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let colord = require("colord");
3
+ colord = require_rolldown_runtime.__toESM(colord);
4
+
5
+ //#region src/composables/_helper.ts
6
+ function getStatusColor(color) {
7
+ if (!color) return void 0;
8
+ const baseColor = (0, colord.colord)(color);
9
+ if (!baseColor.isValid()) return void 0;
10
+ return {
11
+ color,
12
+ hover: baseColor.lighten(.1).toHex(),
13
+ pressed: baseColor.darken(.1).toHex(),
14
+ suppl: baseColor.lighten(.1).toHex()
15
+ };
16
+ }
17
+ function getColors(colors) {
18
+ const { primary, info, success, warning, error } = colors ?? {};
19
+ return {
20
+ primary: getStatusColor(primary),
21
+ info: getStatusColor(info),
22
+ success: getStatusColor(success),
23
+ warning: getStatusColor(warning),
24
+ error: getStatusColor(error)
25
+ };
26
+ }
27
+
28
+ //#endregion
29
+ exports.getColors = getColors;
@@ -0,0 +1,10 @@
1
+ //#region src/composables/_helper.d.ts
2
+ type Colors = {
3
+ primary?: string;
4
+ info?: string;
5
+ success?: string;
6
+ warning?: string;
7
+ error?: string;
8
+ };
9
+ //#endregion
10
+ export { Colors };
@@ -0,0 +1,10 @@
1
+ //#region src/composables/_helper.d.ts
2
+ type Colors = {
3
+ primary?: string;
4
+ info?: string;
5
+ success?: string;
6
+ warning?: string;
7
+ error?: string;
8
+ };
9
+ //#endregion
10
+ export { Colors };
@@ -0,0 +1,27 @@
1
+ import { colord } from "colord";
2
+
3
+ //#region src/composables/_helper.ts
4
+ function getStatusColor(color) {
5
+ if (!color) return void 0;
6
+ const baseColor = colord(color);
7
+ if (!baseColor.isValid()) return void 0;
8
+ return {
9
+ color,
10
+ hover: baseColor.lighten(.1).toHex(),
11
+ pressed: baseColor.darken(.1).toHex(),
12
+ suppl: baseColor.lighten(.1).toHex()
13
+ };
14
+ }
15
+ function getColors(colors) {
16
+ const { primary, info, success, warning, error } = colors ?? {};
17
+ return {
18
+ primary: getStatusColor(primary),
19
+ info: getStatusColor(info),
20
+ success: getStatusColor(success),
21
+ warning: getStatusColor(warning),
22
+ error: getStatusColor(error)
23
+ };
24
+ }
25
+
26
+ //#endregion
27
+ export { getColors };
@@ -1,7 +1,10 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const __vueuse_core = require_rolldown_runtime.__toESM(require("@vueuse/core"));
3
- const vue = require_rolldown_runtime.__toESM(require("vue"));
4
- const vue_hooks_plus_es_useRequest = require_rolldown_runtime.__toESM(require("vue-hooks-plus/es/useRequest"));
2
+ let __vueuse_core = require("@vueuse/core");
3
+ __vueuse_core = require_rolldown_runtime.__toESM(__vueuse_core);
4
+ let vue = require("vue");
5
+ vue = require_rolldown_runtime.__toESM(vue);
6
+ let vue_hooks_plus_es_useRequest = require("vue-hooks-plus/es/useRequest");
7
+ vue_hooks_plus_es_useRequest = require_rolldown_runtime.__toESM(vue_hooks_plus_es_useRequest);
5
8
 
6
9
  //#region src/composables/useDataRequest.ts
7
10
  function useDataRequest(api, options) {
@@ -1,6 +1,8 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const __vueuse_core = require_rolldown_runtime.__toESM(require("@vueuse/core"));
3
- const vue = require_rolldown_runtime.__toESM(require("vue"));
2
+ let __vueuse_core = require("@vueuse/core");
3
+ __vueuse_core = require_rolldown_runtime.__toESM(__vueuse_core);
4
+ let vue = require("vue");
5
+ vue = require_rolldown_runtime.__toESM(vue);
4
6
 
5
7
  //#region src/composables/useNaiveForm.ts
6
8
  function isObject(value) {
@@ -1,17 +1,11 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const vue = require_rolldown_runtime.__toESM(require("vue"));
3
- const colord = require_rolldown_runtime.__toESM(require("colord"));
4
- const naive_ui = require_rolldown_runtime.__toESM(require("naive-ui"));
2
+ const require__helper = require('./_helper.cjs');
3
+ let vue = require("vue");
4
+ vue = require_rolldown_runtime.__toESM(vue);
5
+ let naive_ui = require("naive-ui");
6
+ naive_ui = require_rolldown_runtime.__toESM(naive_ui);
5
7
 
6
8
  //#region src/composables/useNaiveTheme.ts
7
- function getStatusColor(color = "#ff461f") {
8
- return {
9
- color,
10
- hover: (0, colord.colord)(color).lighten(.1).toHex(),
11
- pressed: (0, colord.colord)(color).darken(.1).toHex(),
12
- suppl: (0, colord.colord)(color).lighten(.1).toHex()
13
- };
14
- }
15
9
  const naiveLocaleMap = {
16
10
  "zh-CN": {
17
11
  name: "简体中文",
@@ -24,18 +18,8 @@ const naiveLocaleMap = {
24
18
  locale: naive_ui.enUS
25
19
  }
26
20
  };
27
- function getColors(color) {
28
- const { primary, info, success, warning, error } = color;
29
- return {
30
- primary: getStatusColor(primary),
31
- info: getStatusColor(info),
32
- success: getStatusColor(success),
33
- warning: getStatusColor(warning),
34
- error: getStatusColor(error)
35
- };
36
- }
37
21
  function useNaiveTheme(options) {
38
- const { language, darkMode, color, globalThemeOverrides } = options ?? {};
22
+ const { language, darkMode, colors, globalThemeOverrides } = options ?? {};
39
23
  const languageRef = (0, vue.ref)((0, vue.toValue)(language));
40
24
  (0, vue.watchEffect)(() => {
41
25
  languageRef.value = (0, vue.toValue)(language);
@@ -44,55 +28,44 @@ function useNaiveTheme(options) {
44
28
  (0, vue.watchEffect)(() => {
45
29
  darkModeRef.value = (0, vue.toValue)(darkMode);
46
30
  });
47
- const { common, Dialog,...extra } = globalThemeOverrides ?? {};
48
- const colorRef = (0, vue.ref)({
49
- primary: "#64748B",
50
- info: "#06b6d4",
51
- success: "#10b981",
52
- warning: "#fbbf24",
53
- error: "#f43f5e",
54
- ...color
55
- });
31
+ const { common,...extra } = globalThemeOverrides ?? {};
32
+ const colorRef = (0, vue.ref)({ ...colors });
56
33
  function setColor(v) {
57
- colorRef.value = v;
34
+ colorRef.value = {
35
+ ...colorRef.value,
36
+ ...v
37
+ };
58
38
  }
59
39
  const theme = (0, vue.computed)(() => {
60
40
  return darkModeRef?.value ? naive_ui.darkTheme : void 0;
61
41
  });
62
42
  const themeOverrides = (0, vue.computed)(() => {
63
- const { primary, info, success, warning, error } = getColors(colorRef.value);
43
+ const { primary, info, success, warning, error } = require__helper.getColors(colorRef.value);
64
44
  return {
65
45
  common: {
66
46
  bodyColor: darkModeRef?.value ? "#1f1f1f" : "#f5f5f5",
67
- primaryColor: primary.color,
68
- primaryColorHover: primary.hover,
69
- primaryColorPressed: primary.pressed,
70
- primaryColorSuppl: primary.suppl,
71
- infoColor: info.color,
72
- infoColorHover: info.hover,
73
- infoColorPressed: info.pressed,
74
- infoColorSuppl: info.suppl,
75
- successColor: success.color,
76
- successColorHover: success.hover,
77
- successColorPressed: success.pressed,
78
- successColorSuppl: success.suppl,
79
- warningColor: warning.color,
80
- warningColorHover: warning.hover,
81
- warningColorPressed: warning.pressed,
82
- warningColorSuppl: warning.suppl,
83
- errorColor: error.color,
84
- errorColorHover: error.hover,
85
- errorColorPressed: error.pressed,
86
- errorColorSuppl: error.suppl,
87
- borderRadius: "6px",
47
+ primaryColor: primary?.color,
48
+ primaryColorHover: primary?.hover,
49
+ primaryColorPressed: primary?.pressed,
50
+ primaryColorSuppl: primary?.suppl,
51
+ infoColor: info?.color,
52
+ infoColorHover: info?.hover,
53
+ infoColorPressed: info?.pressed,
54
+ infoColorSuppl: info?.suppl,
55
+ successColor: success?.color,
56
+ successColorHover: success?.hover,
57
+ successColorPressed: success?.pressed,
58
+ successColorSuppl: success?.suppl,
59
+ warningColor: warning?.color,
60
+ warningColorHover: warning?.hover,
61
+ warningColorPressed: warning?.pressed,
62
+ warningColorSuppl: warning?.suppl,
63
+ errorColor: error?.color,
64
+ errorColorHover: error?.hover,
65
+ errorColorPressed: error?.pressed,
66
+ errorColorSuppl: error?.suppl,
88
67
  ...common
89
68
  },
90
- Dialog: {
91
- borderRadius: "12px",
92
- padding: "20px",
93
- closeMargin: "20px 20px 0 0",
94
- ...Dialog
95
- },
96
69
  ...extra
97
70
  };
98
71
  });
@@ -1,19 +1,13 @@
1
+ import { Colors } from "./_helper.cjs";
1
2
  import { ComputedRef, Ref } from "vue";
2
3
  import { GlobalThemeOverrides, NDateLocale } from "naive-ui";
3
4
  import * as naive_ui_es_themes_interface0 from "naive-ui/es/themes/interface";
4
5
 
5
6
  //#region src/composables/useNaiveTheme.d.ts
6
- interface Color {
7
- primary: string;
8
- info: string;
9
- success: string;
10
- warning: string;
11
- error: string;
12
- }
13
7
  interface NaiveThemeOptions {
14
8
  language?: string | Ref<string>;
15
9
  darkMode?: boolean | Ref<boolean>;
16
- color?: Color;
10
+ colors?: Colors;
17
11
  globalThemeOverrides?: GlobalThemeOverrides;
18
12
  }
19
13
  declare function useNaiveTheme(options?: NaiveThemeOptions): {
@@ -143,22 +137,34 @@ declare function useNaiveTheme(options?: NaiveThemeOptions): {
143
137
  tipClose: string;
144
138
  tipOriginalSize: string;
145
139
  };
140
+ Heatmap: {
141
+ less: string;
142
+ more: string;
143
+ monthFormat: string;
144
+ weekdayFormat: string;
145
+ };
146
146
  }>;
147
147
  dateLocale: ComputedRef<NDateLocale>;
148
148
  color: Ref<{
149
- primary: string;
150
- info: string;
151
- success: string;
152
- warning: string;
153
- error: string;
154
- }, Color | {
155
- primary: string;
156
- info: string;
157
- success: string;
158
- warning: string;
159
- error: string;
149
+ primary?: string | undefined;
150
+ info?: string | undefined;
151
+ success?: string | undefined;
152
+ warning?: string | undefined;
153
+ error?: string | undefined;
154
+ }, {
155
+ primary?: string;
156
+ info?: string;
157
+ success?: string;
158
+ warning?: string;
159
+ error?: string;
160
+ } | {
161
+ primary?: string | undefined;
162
+ info?: string | undefined;
163
+ success?: string | undefined;
164
+ warning?: string | undefined;
165
+ error?: string | undefined;
160
166
  }>;
161
- setColor: (v: Color) => void;
167
+ setColor: (v: Partial<Colors>) => void;
162
168
  };
163
169
  type NaiveThemeReturns = ReturnType<typeof useNaiveTheme>;
164
170
  //#endregion
@@ -1,19 +1,13 @@
1
+ import { Colors } from "./_helper.js";
1
2
  import { ComputedRef, Ref } from "vue";
2
3
  import { GlobalThemeOverrides, NDateLocale } from "naive-ui";
3
4
  import * as naive_ui_es_themes_interface0 from "naive-ui/es/themes/interface";
4
5
 
5
6
  //#region src/composables/useNaiveTheme.d.ts
6
- interface Color {
7
- primary: string;
8
- info: string;
9
- success: string;
10
- warning: string;
11
- error: string;
12
- }
13
7
  interface NaiveThemeOptions {
14
8
  language?: string | Ref<string>;
15
9
  darkMode?: boolean | Ref<boolean>;
16
- color?: Color;
10
+ colors?: Colors;
17
11
  globalThemeOverrides?: GlobalThemeOverrides;
18
12
  }
19
13
  declare function useNaiveTheme(options?: NaiveThemeOptions): {
@@ -143,22 +137,34 @@ declare function useNaiveTheme(options?: NaiveThemeOptions): {
143
137
  tipClose: string;
144
138
  tipOriginalSize: string;
145
139
  };
140
+ Heatmap: {
141
+ less: string;
142
+ more: string;
143
+ monthFormat: string;
144
+ weekdayFormat: string;
145
+ };
146
146
  }>;
147
147
  dateLocale: ComputedRef<NDateLocale>;
148
148
  color: Ref<{
149
- primary: string;
150
- info: string;
151
- success: string;
152
- warning: string;
153
- error: string;
154
- }, Color | {
155
- primary: string;
156
- info: string;
157
- success: string;
158
- warning: string;
159
- error: string;
149
+ primary?: string | undefined;
150
+ info?: string | undefined;
151
+ success?: string | undefined;
152
+ warning?: string | undefined;
153
+ error?: string | undefined;
154
+ }, {
155
+ primary?: string;
156
+ info?: string;
157
+ success?: string;
158
+ warning?: string;
159
+ error?: string;
160
+ } | {
161
+ primary?: string | undefined;
162
+ info?: string | undefined;
163
+ success?: string | undefined;
164
+ warning?: string | undefined;
165
+ error?: string | undefined;
160
166
  }>;
161
- setColor: (v: Color) => void;
167
+ setColor: (v: Partial<Colors>) => void;
162
168
  };
163
169
  type NaiveThemeReturns = ReturnType<typeof useNaiveTheme>;
164
170
  //#endregion
@@ -1,16 +1,8 @@
1
+ import { getColors } from "./_helper.js";
1
2
  import { computed, ref, toValue, watchEffect } from "vue";
2
- import { colord } from "colord";
3
3
  import { darkTheme, dateEnUS, dateZhCN, enUS, zhCN } from "naive-ui";
4
4
 
5
5
  //#region src/composables/useNaiveTheme.ts
6
- function getStatusColor(color = "#ff461f") {
7
- return {
8
- color,
9
- hover: colord(color).lighten(.1).toHex(),
10
- pressed: colord(color).darken(.1).toHex(),
11
- suppl: colord(color).lighten(.1).toHex()
12
- };
13
- }
14
6
  const naiveLocaleMap = {
15
7
  "zh-CN": {
16
8
  name: "简体中文",
@@ -23,18 +15,8 @@ const naiveLocaleMap = {
23
15
  locale: enUS
24
16
  }
25
17
  };
26
- function getColors(color) {
27
- const { primary, info, success, warning, error } = color;
28
- return {
29
- primary: getStatusColor(primary),
30
- info: getStatusColor(info),
31
- success: getStatusColor(success),
32
- warning: getStatusColor(warning),
33
- error: getStatusColor(error)
34
- };
35
- }
36
18
  function useNaiveTheme(options) {
37
- const { language, darkMode, color, globalThemeOverrides } = options ?? {};
19
+ const { language, darkMode, colors, globalThemeOverrides } = options ?? {};
38
20
  const languageRef = ref(toValue(language));
39
21
  watchEffect(() => {
40
22
  languageRef.value = toValue(language);
@@ -43,17 +25,13 @@ function useNaiveTheme(options) {
43
25
  watchEffect(() => {
44
26
  darkModeRef.value = toValue(darkMode);
45
27
  });
46
- const { common, Dialog,...extra } = globalThemeOverrides ?? {};
47
- const colorRef = ref({
48
- primary: "#64748B",
49
- info: "#06b6d4",
50
- success: "#10b981",
51
- warning: "#fbbf24",
52
- error: "#f43f5e",
53
- ...color
54
- });
28
+ const { common,...extra } = globalThemeOverrides ?? {};
29
+ const colorRef = ref({ ...colors });
55
30
  function setColor(v) {
56
- colorRef.value = v;
31
+ colorRef.value = {
32
+ ...colorRef.value,
33
+ ...v
34
+ };
57
35
  }
58
36
  const theme = computed(() => {
59
37
  return darkModeRef?.value ? darkTheme : void 0;
@@ -63,35 +41,28 @@ function useNaiveTheme(options) {
63
41
  return {
64
42
  common: {
65
43
  bodyColor: darkModeRef?.value ? "#1f1f1f" : "#f5f5f5",
66
- primaryColor: primary.color,
67
- primaryColorHover: primary.hover,
68
- primaryColorPressed: primary.pressed,
69
- primaryColorSuppl: primary.suppl,
70
- infoColor: info.color,
71
- infoColorHover: info.hover,
72
- infoColorPressed: info.pressed,
73
- infoColorSuppl: info.suppl,
74
- successColor: success.color,
75
- successColorHover: success.hover,
76
- successColorPressed: success.pressed,
77
- successColorSuppl: success.suppl,
78
- warningColor: warning.color,
79
- warningColorHover: warning.hover,
80
- warningColorPressed: warning.pressed,
81
- warningColorSuppl: warning.suppl,
82
- errorColor: error.color,
83
- errorColorHover: error.hover,
84
- errorColorPressed: error.pressed,
85
- errorColorSuppl: error.suppl,
86
- borderRadius: "6px",
44
+ primaryColor: primary?.color,
45
+ primaryColorHover: primary?.hover,
46
+ primaryColorPressed: primary?.pressed,
47
+ primaryColorSuppl: primary?.suppl,
48
+ infoColor: info?.color,
49
+ infoColorHover: info?.hover,
50
+ infoColorPressed: info?.pressed,
51
+ infoColorSuppl: info?.suppl,
52
+ successColor: success?.color,
53
+ successColorHover: success?.hover,
54
+ successColorPressed: success?.pressed,
55
+ successColorSuppl: success?.suppl,
56
+ warningColor: warning?.color,
57
+ warningColorHover: warning?.hover,
58
+ warningColorPressed: warning?.pressed,
59
+ warningColorSuppl: warning?.suppl,
60
+ errorColor: error?.color,
61
+ errorColorHover: error?.hover,
62
+ errorColorPressed: error?.pressed,
63
+ errorColorSuppl: error?.suppl,
87
64
  ...common
88
65
  },
89
- Dialog: {
90
- borderRadius: "12px",
91
- padding: "20px",
92
- closeMargin: "20px 20px 0 0",
93
- ...Dialog
94
- },
95
66
  ...extra
96
67
  };
97
68
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oiij/naive-ui",
3
3
  "type": "module",
4
- "version": "0.0.58",
4
+ "version": "0.0.60",
5
5
  "description": "Some Composable Functions And Components for Vue 3",
6
6
  "author": "oiij",
7
7
  "license": "MIT",
@@ -38,30 +38,30 @@
38
38
  "package.json"
39
39
  ],
40
40
  "peerDependencies": {
41
- "@vueuse/core": "^13.7.0",
41
+ "@vueuse/core": "^13.9.0",
42
42
  "async-validator": "^4.2.5",
43
43
  "colord": "^2.9.3",
44
- "naive-ui": "^2.42.0",
44
+ "naive-ui": "^2.43.1",
45
45
  "prismjs": "^1.30.0",
46
- "vue": "^3.5.18",
47
- "vue-hooks-plus": "^2.4.0",
48
- "@oiij/css-render": "0.0.3",
49
- "@oiij/markdown-it": "0.0.5",
50
- "@oiij/use": "0.0.22"
46
+ "vue": "^3.5.21",
47
+ "vue-hooks-plus": "^2.4.1",
48
+ "@oiij/css-render": "0.0.4",
49
+ "@oiij/markdown-it": "0.0.6",
50
+ "@oiij/use": "0.0.24"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/prismjs": "^1.26.5",
54
- "@vueuse/core": "^13.7.0",
54
+ "@vueuse/core": "^13.9.0",
55
55
  "async-validator": "^4.2.5",
56
56
  "colord": "^2.9.3",
57
- "naive-ui": "^2.42.0",
57
+ "naive-ui": "^2.43.1",
58
58
  "prismjs": "^1.30.0",
59
- "vue": "^3.5.18",
60
- "vue-component-type-helpers": "^3.0.5",
61
- "vue-hooks-plus": "^2.4.0",
62
- "@oiij/markdown-it": "0.0.5",
63
- "@oiij/css-render": "0.0.3",
64
- "@oiij/use": "0.0.22"
59
+ "vue": "^3.5.21",
60
+ "vue-component-type-helpers": "^3.0.7",
61
+ "vue-hooks-plus": "^2.4.1",
62
+ "@oiij/css-render": "0.0.4",
63
+ "@oiij/use": "0.0.24",
64
+ "@oiij/markdown-it": "0.0.6"
65
65
  },
66
66
  "publishConfig": {
67
67
  "access": "public"