yc-design-vue 1.5.1 → 1.5.2

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 (41) hide show
  1. package/es/Calendar/Calendar.vue.d.ts +1 -1
  2. package/es/Calendar/index.d.ts +3 -3
  3. package/es/Layout/hooks/useSiderContext.d.ts +1 -1
  4. package/es/Layout/hooks/useSiderContext.js +6 -22
  5. package/es/Layout/hooks/useTheme.d.ts +4 -0
  6. package/es/Layout/hooks/useTheme.js +34 -0
  7. package/es/Menu/hooks/useContext.js +4 -10
  8. package/es/Transfer/TransferPanel.vue2.js +2 -2
  9. package/es/Typography/TypographyBase.vue2.js +2 -2
  10. package/es/_shared/icons/IconCopy.vue.js +1 -16
  11. package/es/_shared/icons/IconCopy.vue2.js +16 -1
  12. package/es/_shared/icons/IconDelete.vue.js +1 -16
  13. package/es/_shared/icons/IconDelete.vue2.js +16 -1
  14. package/es/_shared/icons/IconEdit.vue.js +1 -16
  15. package/es/_shared/icons/IconEdit.vue2.js +16 -1
  16. package/es/_shared/icons/IconSearch.vue.js +1 -16
  17. package/es/_shared/icons/IconSearch.vue2.js +16 -1
  18. package/es/node_modules/@vueuse/core/index.js +4 -319
  19. package/es/node_modules/@vueuse/shared/index.js +2 -65
  20. package/es/style.css +1 -1
  21. package/lib/Calendar/Calendar.vue.d.ts +1 -1
  22. package/lib/Calendar/index.d.ts +3 -3
  23. package/lib/Layout/hooks/useSiderContext.d.ts +1 -1
  24. package/lib/Layout/hooks/useSiderContext.js +1 -1
  25. package/lib/Layout/hooks/useTheme.d.ts +4 -0
  26. package/lib/Layout/hooks/useTheme.js +1 -0
  27. package/lib/Menu/hooks/useContext.js +1 -1
  28. package/lib/Transfer/TransferPanel.vue2.js +1 -1
  29. package/lib/Typography/TypographyBase.vue2.js +1 -1
  30. package/lib/_shared/icons/IconCopy.vue.js +1 -1
  31. package/lib/_shared/icons/IconCopy.vue2.js +1 -1
  32. package/lib/_shared/icons/IconDelete.vue.js +1 -1
  33. package/lib/_shared/icons/IconDelete.vue2.js +1 -1
  34. package/lib/_shared/icons/IconEdit.vue.js +1 -1
  35. package/lib/_shared/icons/IconEdit.vue2.js +1 -1
  36. package/lib/_shared/icons/IconSearch.vue.js +1 -1
  37. package/lib/_shared/icons/IconSearch.vue2.js +1 -1
  38. package/lib/node_modules/@vueuse/core/index.js +1 -1
  39. package/lib/node_modules/@vueuse/shared/index.js +1 -1
  40. package/lib/style.css +1 -1
  41. package/package.json +1 -1
@@ -20,8 +20,8 @@ declare const __VLS_component: import('vue').DefineComponent<CalendarProps, {},
20
20
  mode: CalendarMode;
21
21
  modelValue: Date;
22
22
  defaultValue: Date;
23
- modes: CalendarMode[];
24
23
  defaultMode: CalendarMode;
24
+ modes: CalendarMode[];
25
25
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
26
26
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
27
27
  export default _default;
@@ -17,8 +17,8 @@ declare const Calendar: {
17
17
  mode: import('./type').CalendarMode;
18
18
  modelValue: Date;
19
19
  defaultValue: Date;
20
- modes: import('./type').CalendarMode[];
21
20
  defaultMode: import('./type').CalendarMode;
21
+ modes: import('./type').CalendarMode[];
22
22
  }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
23
23
  P: {};
24
24
  B: {};
@@ -35,8 +35,8 @@ declare const Calendar: {
35
35
  mode: import('./type').CalendarMode;
36
36
  modelValue: Date;
37
37
  defaultValue: Date;
38
- modes: import('./type').CalendarMode[];
39
38
  defaultMode: import('./type').CalendarMode;
39
+ modes: import('./type').CalendarMode[];
40
40
  }>;
41
41
  __isFragment?: never;
42
42
  __isTeleport?: never;
@@ -55,8 +55,8 @@ declare const Calendar: {
55
55
  mode: import('./type').CalendarMode;
56
56
  modelValue: Date;
57
57
  defaultValue: Date;
58
- modes: import('./type').CalendarMode[];
59
58
  defaultMode: import('./type').CalendarMode;
59
+ modes: import('./type').CalendarMode[];
60
60
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
61
61
  $slots: Readonly<import('./type').CalendarSlots> & import('./type').CalendarSlots;
62
62
  }) & {
@@ -3,7 +3,7 @@ import { Props, Theme } from '../../_shared/type';
3
3
  import { LayoutSiderEmits } from '../type';
4
4
  export declare const LAYOUT_CONTEXT_KEY = "LAYOUT-CONTEXT";
5
5
  export type LayoutContext = {
6
- theme: Ref<Theme>;
6
+ theme: Ref<Theme | undefined>;
7
7
  collapsed: Ref<boolean>;
8
8
  };
9
9
  declare const _default: () => {
@@ -1,27 +1,16 @@
1
1
  import { toRefs, computed, provide, inject, ref } from "vue";
2
2
  import "../../node_modules/tinycolor2/esm/tinycolor.js";
3
3
  import "../../_shared/utils/dom.js";
4
- import { isUndefined } from "../../_shared/utils/is.js";
5
4
  import "../../_shared/utils/time.js";
6
5
  import "../../Empty/index.js";
7
6
  /* empty css */
8
7
  import useControlValue from "../../_shared/utils/control.js";
9
- import { useDark } from "../../node_modules/@vueuse/core/index.js";
10
8
  const LAYOUT_CONTEXT_KEY = "LAYOUT-CONTEXT";
11
9
  const useSiderContext = () => {
12
- const isDark = useDark({
13
- selector: "body",
14
- attribute: "yc-design-theme",
15
- valueDark: "dark",
16
- valueLight: "light",
17
- initialValue: "light"
18
- });
19
10
  const provide$1 = (props, emits) => {
20
- const {
21
- theme: _theme,
22
- collapsed,
23
- defaultCollapsed
24
- } = toRefs(props);
11
+ const { collapsed, defaultCollapsed, theme } = toRefs(
12
+ props
13
+ );
25
14
  const computedCollapsed = useControlValue(
26
15
  collapsed,
27
16
  defaultCollapsed.value,
@@ -29,24 +18,19 @@ const useSiderContext = () => {
29
18
  emits("update:collapsed", val);
30
19
  }
31
20
  );
32
- const theme = computed(() => {
33
- if (!isUndefined(_theme.value)) {
34
- return _theme.value;
35
- }
36
- return isDark.value ? "dark" : "light";
37
- });
21
+ const mergeTheme = computed(() => theme.value || "light");
38
22
  provide(LAYOUT_CONTEXT_KEY, {
39
23
  theme,
40
24
  collapsed: computedCollapsed
41
25
  });
42
26
  return {
43
- theme,
27
+ theme: mergeTheme,
44
28
  computedCollapsed
45
29
  };
46
30
  };
47
31
  const inject$1 = () => {
48
32
  return inject(LAYOUT_CONTEXT_KEY, {
49
- theme: computed(() => isDark.value ? "dark" : "light"),
33
+ theme: ref(void 0),
50
34
  collapsed: ref(false)
51
35
  });
52
36
  };
@@ -0,0 +1,4 @@
1
+ declare const _default: () => {
2
+ theme: import('vue').Ref<"light" | "dark", "light" | "dark">;
3
+ };
4
+ export default _default;
@@ -0,0 +1,34 @@
1
+ import { ref, onMounted } from "vue";
2
+ import { useMutationObserver } from "../../node_modules/@vueuse/core/index.js";
3
+ const useTheme = () => {
4
+ const theme = ref("light");
5
+ onMounted(() => {
6
+ const value = document.body.getAttribute("yc-design-theme");
7
+ theme.value = value === "dark" ? "dark" : "light";
8
+ });
9
+ useMutationObserver(
10
+ document.body,
11
+ (mutationsList) => {
12
+ for (const mutation of mutationsList) {
13
+ if (mutation.type === "attributes" && mutation.attributeName === "yc-design-theme") {
14
+ const value = mutation.target.getAttribute(
15
+ "yc-design-theme"
16
+ );
17
+ theme.value = value === "dark" ? "dark" : "light";
18
+ console.log(theme.value, "theme");
19
+ }
20
+ }
21
+ },
22
+ {
23
+ attributes: true,
24
+ // 明确告诉 MutationObserver 我们要监听属性的变化
25
+ attributeFilter: ["yc-design-theme"]
26
+ }
27
+ );
28
+ return {
29
+ theme
30
+ };
31
+ };
32
+ export {
33
+ useTheme as default
34
+ };
@@ -8,8 +8,9 @@ import "../../Empty/index.js";
8
8
  import useControlValue from "../../_shared/utils/control.js";
9
9
  import "../index.js";
10
10
  import { nanoid } from "../../node_modules/nanoid/index.browser.js";
11
- import { useResizeObserver, useDark } from "../../node_modules/@vueuse/core/index.js";
11
+ import { useResizeObserver } from "../../node_modules/@vueuse/core/index.js";
12
12
  import useSiderContext from "../../Layout/hooks/useSiderContext.js";
13
+ import useTheme from "../../Layout/hooks/useTheme.js";
13
14
  import SubMenu from "../SubMenu.vue.js";
14
15
  import MenuItem from "../MenuItem.vue.js";
15
16
  const MENU_CONTEXT_KEY = "menu-context";
@@ -115,6 +116,7 @@ const getPopupMaxHeight = (popupMaxHeight) => {
115
116
  }
116
117
  };
117
118
  const useMenuContext = () => {
119
+ const { theme: sysTheme } = useTheme();
118
120
  const provide$1 = (props, emits, menuRef) => {
119
121
  const {
120
122
  selectedKeys,
@@ -231,14 +233,6 @@ const useMenuContext = () => {
231
233
  };
232
234
  };
233
235
  const inject$1 = () => {
234
- const isDark = useDark({
235
- selector: "body",
236
- attribute: "yc-design-theme",
237
- valueDark: "dark",
238
- valueLight: "light",
239
- initialValue: "light"
240
- });
241
- console.log(isDark.value, "isDark");
242
236
  return inject(MENU_CONTEXT_KEY, {
243
237
  computedSelectedKeys: ref(""),
244
238
  computedOpenKeys: ref([]),
@@ -250,7 +244,7 @@ const useMenuContext = () => {
250
244
  triggerProps: ref({}),
251
245
  autoOpenSelected: ref(false),
252
246
  mode: ref("vertical"),
253
- theme: computed(() => isDark.value ? "dark" : "light"),
247
+ theme: sysTheme,
254
248
  popupMaxHeight: ref(),
255
249
  autoScrollIntoView: ref(false),
256
250
  scrollConfig: ref({}),
@@ -5,8 +5,8 @@ import "../_shared/utils/time.js";
5
5
  import { getGlobalConfig } from "../_shared/utils/global-config.js";
6
6
  /* empty css */
7
7
  import _sfc_main$3 from "../_shared/icons/IconClose.vue.js";
8
- import _sfc_main$1 from "../_shared/icons/IconDelete.vue.js";
9
- import _sfc_main$2 from "../_shared/icons/IconSearch.vue.js";
8
+ import _sfc_main$1 from "../_shared/icons/IconDelete.vue2.js";
9
+ import _sfc_main$2 from "../_shared/icons/IconSearch.vue2.js";
10
10
  import useContext from "./hooks/useContext.js";
11
11
  import Checkbox from "../Checkbox/index.js";
12
12
  import Scrollbar from "../Scrollbar/index.js";
@@ -5,8 +5,8 @@ import { getDomText, sleep } from "../_shared/utils/dom.js";
5
5
  import "../_shared/utils/time.js";
6
6
  import "../Empty/index.js";
7
7
  /* empty css */
8
- import _sfc_main$3 from "../_shared/icons/IconCopy.vue.js";
9
- import _sfc_main$1 from "../_shared/icons/IconEdit.vue.js";
8
+ import _sfc_main$3 from "../_shared/icons/IconCopy.vue2.js";
9
+ import _sfc_main$1 from "../_shared/icons/IconEdit.vue2.js";
10
10
  import _sfc_main$2 from "../_shared/icons/IconInfo.vue.js";
11
11
  import useControlValue from "../_shared/utils/control.js";
12
12
  import Input from "../Input/index.js";
@@ -1,19 +1,4 @@
1
- import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode } from "vue";
2
- import YcIcon from "../components/Icon.vue2.js";
3
- const _sfc_main = /* @__PURE__ */ defineComponent({
4
- __name: "IconCopy",
5
- setup(__props) {
6
- return (_ctx, _cache) => {
7
- return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
8
- default: withCtx(() => _cache[0] || (_cache[0] = [
9
- createElementVNode("path", { d: "M20 6h18a2 2 0 0 1 2 2v22M8 16v24c0 1.105.891 2 1.996 2h20.007A1.99 1.99 0 0 0 32 40.008V15.997A1.997 1.997 0 0 0 30 14H10a2 2 0 0 0-2 2Z" }, null, -1)
10
- ])),
11
- _: 1,
12
- __: [0]
13
- }, 16);
14
- };
15
- }
16
- });
1
+ import _sfc_main from "./IconCopy.vue2.js";
17
2
  export {
18
3
  _sfc_main as default
19
4
  };
@@ -1,4 +1,19 @@
1
- import _sfc_main from "./IconCopy.vue.js";
1
+ import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode } from "vue";
2
+ import YcIcon from "../components/Icon.vue2.js";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ __name: "IconCopy",
5
+ setup(__props) {
6
+ return (_ctx, _cache) => {
7
+ return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
8
+ default: withCtx(() => _cache[0] || (_cache[0] = [
9
+ createElementVNode("path", { d: "M20 6h18a2 2 0 0 1 2 2v22M8 16v24c0 1.105.891 2 1.996 2h20.007A1.99 1.99 0 0 0 32 40.008V15.997A1.997 1.997 0 0 0 30 14H10a2 2 0 0 0-2 2Z" }, null, -1)
10
+ ])),
11
+ _: 1,
12
+ __: [0]
13
+ }, 16);
14
+ };
15
+ }
16
+ });
2
17
  export {
3
18
  _sfc_main as default
4
19
  };
@@ -1,19 +1,4 @@
1
- import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode } from "vue";
2
- import YcIcon from "../components/Icon.vue2.js";
3
- const _sfc_main = /* @__PURE__ */ defineComponent({
4
- __name: "IconDelete",
5
- setup(__props) {
6
- return (_ctx, _cache) => {
7
- return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
8
- default: withCtx(() => _cache[0] || (_cache[0] = [
9
- createElementVNode("path", { d: "M5 11h5.5m0 0v29a1 1 0 0 0 1 1h25a1 1 0 0 0 1-1V11m-27 0H16m21.5 0H43m-5.5 0H32m-16 0V7h16v4m-16 0h16M20 18v15m8-15v15" }, null, -1)
10
- ])),
11
- _: 1,
12
- __: [0]
13
- }, 16);
14
- };
15
- }
16
- });
1
+ import _sfc_main from "./IconDelete.vue2.js";
17
2
  export {
18
3
  _sfc_main as default
19
4
  };
@@ -1,4 +1,19 @@
1
- import _sfc_main from "./IconDelete.vue.js";
1
+ import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode } from "vue";
2
+ import YcIcon from "../components/Icon.vue2.js";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ __name: "IconDelete",
5
+ setup(__props) {
6
+ return (_ctx, _cache) => {
7
+ return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
8
+ default: withCtx(() => _cache[0] || (_cache[0] = [
9
+ createElementVNode("path", { d: "M5 11h5.5m0 0v29a1 1 0 0 0 1 1h25a1 1 0 0 0 1-1V11m-27 0H16m21.5 0H43m-5.5 0H32m-16 0V7h16v4m-16 0h16M20 18v15m8-15v15" }, null, -1)
10
+ ])),
11
+ _: 1,
12
+ __: [0]
13
+ }, 16);
14
+ };
15
+ }
16
+ });
2
17
  export {
3
18
  _sfc_main as default
4
19
  };
@@ -1,19 +1,4 @@
1
- import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode } from "vue";
2
- import YcIcon from "../components/Icon.vue2.js";
3
- const _sfc_main = /* @__PURE__ */ defineComponent({
4
- __name: "IconEdit",
5
- setup(__props) {
6
- return (_ctx, _cache) => {
7
- return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
8
- default: withCtx(() => _cache[0] || (_cache[0] = [
9
- createElementVNode("path", { d: "m30.48 19.038 5.733-5.734a1 1 0 0 0 0-1.414l-5.586-5.586a1 1 0 0 0-1.414 0l-5.734 5.734m7 7L15.763 33.754a1 1 0 0 1-.59.286l-6.048.708a1 1 0 0 1-1.113-1.069l.477-6.31a1 1 0 0 1 .29-.631l14.7-14.7m7 7-7-7M6 42h36" }, null, -1)
10
- ])),
11
- _: 1,
12
- __: [0]
13
- }, 16);
14
- };
15
- }
16
- });
1
+ import _sfc_main from "./IconEdit.vue2.js";
17
2
  export {
18
3
  _sfc_main as default
19
4
  };
@@ -1,4 +1,19 @@
1
- import _sfc_main from "./IconEdit.vue.js";
1
+ import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode } from "vue";
2
+ import YcIcon from "../components/Icon.vue2.js";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ __name: "IconEdit",
5
+ setup(__props) {
6
+ return (_ctx, _cache) => {
7
+ return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
8
+ default: withCtx(() => _cache[0] || (_cache[0] = [
9
+ createElementVNode("path", { d: "m30.48 19.038 5.733-5.734a1 1 0 0 0 0-1.414l-5.586-5.586a1 1 0 0 0-1.414 0l-5.734 5.734m7 7L15.763 33.754a1 1 0 0 1-.59.286l-6.048.708a1 1 0 0 1-1.113-1.069l.477-6.31a1 1 0 0 1 .29-.631l14.7-14.7m7 7-7-7M6 42h36" }, null, -1)
10
+ ])),
11
+ _: 1,
12
+ __: [0]
13
+ }, 16);
14
+ };
15
+ }
16
+ });
2
17
  export {
3
18
  _sfc_main as default
4
19
  };
@@ -1,19 +1,4 @@
1
- import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode } from "vue";
2
- import YcIcon from "../components/Icon.vue2.js";
3
- const _sfc_main = /* @__PURE__ */ defineComponent({
4
- __name: "IconSearch",
5
- setup(__props) {
6
- return (_ctx, _cache) => {
7
- return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
8
- default: withCtx(() => _cache[0] || (_cache[0] = [
9
- createElementVNode("path", { d: "M33.072 33.071c6.248-6.248 6.248-16.379 0-22.627-6.249-6.249-16.38-6.249-22.628 0-6.248 6.248-6.248 16.379 0 22.627 6.248 6.248 16.38 6.248 22.628 0Zm0 0 8.485 8.485" }, null, -1)
10
- ])),
11
- _: 1,
12
- __: [0]
13
- }, 16);
14
- };
15
- }
16
- });
1
+ import _sfc_main from "./IconSearch.vue2.js";
17
2
  export {
18
3
  _sfc_main as default
19
4
  };
@@ -1,4 +1,19 @@
1
- import _sfc_main from "./IconSearch.vue.js";
1
+ import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode } from "vue";
2
+ import YcIcon from "../components/Icon.vue2.js";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ __name: "IconSearch",
5
+ setup(__props) {
6
+ return (_ctx, _cache) => {
7
+ return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
8
+ default: withCtx(() => _cache[0] || (_cache[0] = [
9
+ createElementVNode("path", { d: "M33.072 33.071c6.248-6.248 6.248-16.379 0-22.627-6.249-6.249-16.38-6.249-22.628 0-6.248 6.248-6.248 16.379 0 22.627 6.248 6.248 16.38 6.248 22.628 0Zm0 0 8.485 8.485" }, null, -1)
10
+ ])),
11
+ _: 1,
12
+ __: [0]
13
+ }, 16);
14
+ };
15
+ }
16
+ });
2
17
  export {
3
18
  _sfc_main as default
4
19
  };