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
@@ -1,6 +1,6 @@
1
- import { tryOnScopeDispose, toArray, watchImmediate, isClient, isObject, makeDestructurable, camelize, tryOnMounted, toRefs, noop, isIOS, notNullish, useThrottleFn, useDebounceFn, pxValue, toRef, injectLocal, pausableWatch as watchPausable, useTimeoutFn, createSingletonPromise } from "../shared/index.js";
2
- import { bypassFilter, createFilterWrapper, debounceFilter, getLifeCycleTarget, pausableFilter, throttleFilter, watchWithFilter } from "../shared/index.js";
3
- import { computed, toValue, watch, shallowRef, getCurrentInstance, onMounted, unref, defineComponent, ref, reactive, watchEffect, hasInjectionContext, nextTick, toRaw } from "vue";
1
+ import { tryOnScopeDispose, toArray, watchImmediate, isClient, isObject, makeDestructurable, camelize, tryOnMounted, toRefs, noop, isIOS, notNullish, useThrottleFn, useDebounceFn, pxValue, injectLocal, useTimeoutFn, createSingletonPromise } from "../shared/index.js";
2
+ import { createFilterWrapper, debounceFilter, getLifeCycleTarget, throttleFilter } from "../shared/index.js";
3
+ import { computed, toValue, watch, shallowRef, getCurrentInstance, onMounted, unref, defineComponent, ref, reactive, watchEffect, hasInjectionContext, toRaw } from "vue";
4
4
  function createReusableTemplate(options = {}) {
5
5
  const {
6
6
  inheritAttrs = true
@@ -439,308 +439,6 @@ function useClipboard(options = {}) {
439
439
  copy
440
440
  };
441
441
  }
442
- const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
443
- const globalKey = "__vueuse_ssr_handlers__";
444
- const handlers = /* @__PURE__ */ getHandlers();
445
- function getHandlers() {
446
- if (!(globalKey in _global))
447
- _global[globalKey] = _global[globalKey] || {};
448
- return _global[globalKey];
449
- }
450
- function getSSRHandler(key, fallback) {
451
- return handlers[key] || fallback;
452
- }
453
- function usePreferredDark(options) {
454
- return useMediaQuery("(prefers-color-scheme: dark)", options);
455
- }
456
- function guessSerializerType(rawInit) {
457
- return rawInit == null ? "any" : rawInit instanceof Set ? "set" : rawInit instanceof Map ? "map" : rawInit instanceof Date ? "date" : typeof rawInit === "boolean" ? "boolean" : typeof rawInit === "string" ? "string" : typeof rawInit === "object" ? "object" : !Number.isNaN(rawInit) ? "number" : "any";
458
- }
459
- const StorageSerializers = {
460
- boolean: {
461
- read: (v) => v === "true",
462
- write: (v) => String(v)
463
- },
464
- object: {
465
- read: (v) => JSON.parse(v),
466
- write: (v) => JSON.stringify(v)
467
- },
468
- number: {
469
- read: (v) => Number.parseFloat(v),
470
- write: (v) => String(v)
471
- },
472
- any: {
473
- read: (v) => v,
474
- write: (v) => String(v)
475
- },
476
- string: {
477
- read: (v) => v,
478
- write: (v) => String(v)
479
- },
480
- map: {
481
- read: (v) => new Map(JSON.parse(v)),
482
- write: (v) => JSON.stringify(Array.from(v.entries()))
483
- },
484
- set: {
485
- read: (v) => new Set(JSON.parse(v)),
486
- write: (v) => JSON.stringify(Array.from(v))
487
- },
488
- date: {
489
- read: (v) => new Date(v),
490
- write: (v) => v.toISOString()
491
- }
492
- };
493
- const customStorageEventName = "vueuse-storage";
494
- function useStorage(key, defaults, storage, options = {}) {
495
- var _a;
496
- const {
497
- flush = "pre",
498
- deep = true,
499
- listenToStorageChanges = true,
500
- writeDefaults = true,
501
- mergeDefaults = false,
502
- shallow,
503
- window: window2 = defaultWindow,
504
- eventFilter,
505
- onError = (e) => {
506
- console.error(e);
507
- },
508
- initOnMounted
509
- } = options;
510
- const data = (shallow ? shallowRef : ref)(typeof defaults === "function" ? defaults() : defaults);
511
- const keyComputed = computed(() => toValue(key));
512
- if (!storage) {
513
- try {
514
- storage = getSSRHandler("getDefaultStorage", () => {
515
- var _a2;
516
- return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;
517
- })();
518
- } catch (e) {
519
- onError(e);
520
- }
521
- }
522
- if (!storage)
523
- return data;
524
- const rawInit = toValue(defaults);
525
- const type = guessSerializerType(rawInit);
526
- const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];
527
- const { pause: pauseWatch, resume: resumeWatch } = watchPausable(
528
- data,
529
- () => write(data.value),
530
- { flush, deep, eventFilter }
531
- );
532
- watch(keyComputed, () => update(), { flush });
533
- if (window2 && listenToStorageChanges) {
534
- tryOnMounted(() => {
535
- if (storage instanceof Storage)
536
- useEventListener(window2, "storage", update, { passive: true });
537
- else
538
- useEventListener(window2, customStorageEventName, updateFromCustomEvent);
539
- if (initOnMounted)
540
- update();
541
- });
542
- }
543
- if (!initOnMounted)
544
- update();
545
- function dispatchWriteEvent(oldValue, newValue) {
546
- if (window2) {
547
- const payload = {
548
- key: keyComputed.value,
549
- oldValue,
550
- newValue,
551
- storageArea: storage
552
- };
553
- window2.dispatchEvent(storage instanceof Storage ? new StorageEvent("storage", payload) : new CustomEvent(customStorageEventName, {
554
- detail: payload
555
- }));
556
- }
557
- }
558
- function write(v) {
559
- try {
560
- const oldValue = storage.getItem(keyComputed.value);
561
- if (v == null) {
562
- dispatchWriteEvent(oldValue, null);
563
- storage.removeItem(keyComputed.value);
564
- } else {
565
- const serialized = serializer.write(v);
566
- if (oldValue !== serialized) {
567
- storage.setItem(keyComputed.value, serialized);
568
- dispatchWriteEvent(oldValue, serialized);
569
- }
570
- }
571
- } catch (e) {
572
- onError(e);
573
- }
574
- }
575
- function read(event) {
576
- const rawValue = event ? event.newValue : storage.getItem(keyComputed.value);
577
- if (rawValue == null) {
578
- if (writeDefaults && rawInit != null)
579
- storage.setItem(keyComputed.value, serializer.write(rawInit));
580
- return rawInit;
581
- } else if (!event && mergeDefaults) {
582
- const value = serializer.read(rawValue);
583
- if (typeof mergeDefaults === "function")
584
- return mergeDefaults(value, rawInit);
585
- else if (type === "object" && !Array.isArray(value))
586
- return { ...rawInit, ...value };
587
- return value;
588
- } else if (typeof rawValue !== "string") {
589
- return rawValue;
590
- } else {
591
- return serializer.read(rawValue);
592
- }
593
- }
594
- function update(event) {
595
- if (event && event.storageArea !== storage)
596
- return;
597
- if (event && event.key == null) {
598
- data.value = rawInit;
599
- return;
600
- }
601
- if (event && event.key !== keyComputed.value)
602
- return;
603
- pauseWatch();
604
- try {
605
- if ((event == null ? void 0 : event.newValue) !== serializer.write(data.value))
606
- data.value = read(event);
607
- } catch (e) {
608
- onError(e);
609
- } finally {
610
- if (event)
611
- nextTick(resumeWatch);
612
- else
613
- resumeWatch();
614
- }
615
- }
616
- function updateFromCustomEvent(event) {
617
- update(event.detail);
618
- }
619
- return data;
620
- }
621
- const CSS_DISABLE_TRANS = "*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";
622
- function useColorMode(options = {}) {
623
- const {
624
- selector = "html",
625
- attribute = "class",
626
- initialValue = "auto",
627
- window: window2 = defaultWindow,
628
- storage,
629
- storageKey = "vueuse-color-scheme",
630
- listenToStorageChanges = true,
631
- storageRef,
632
- emitAuto,
633
- disableTransition = true
634
- } = options;
635
- const modes = {
636
- auto: "",
637
- light: "light",
638
- dark: "dark",
639
- ...options.modes || {}
640
- };
641
- const preferredDark = usePreferredDark({ window: window2 });
642
- const system = computed(() => preferredDark.value ? "dark" : "light");
643
- const store = storageRef || (storageKey == null ? toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window: window2, listenToStorageChanges }));
644
- const state = computed(() => store.value === "auto" ? system.value : store.value);
645
- const updateHTMLAttrs = getSSRHandler(
646
- "updateHTMLAttrs",
647
- (selector2, attribute2, value) => {
648
- const el = typeof selector2 === "string" ? window2 == null ? void 0 : window2.document.querySelector(selector2) : unrefElement(selector2);
649
- if (!el)
650
- return;
651
- const classesToAdd = /* @__PURE__ */ new Set();
652
- const classesToRemove = /* @__PURE__ */ new Set();
653
- let attributeToChange = null;
654
- if (attribute2 === "class") {
655
- const current = value.split(/\s/g);
656
- Object.values(modes).flatMap((i) => (i || "").split(/\s/g)).filter(Boolean).forEach((v) => {
657
- if (current.includes(v))
658
- classesToAdd.add(v);
659
- else
660
- classesToRemove.add(v);
661
- });
662
- } else {
663
- attributeToChange = { key: attribute2, value };
664
- }
665
- if (classesToAdd.size === 0 && classesToRemove.size === 0 && attributeToChange === null)
666
- return;
667
- let style;
668
- if (disableTransition) {
669
- style = window2.document.createElement("style");
670
- style.appendChild(document.createTextNode(CSS_DISABLE_TRANS));
671
- window2.document.head.appendChild(style);
672
- }
673
- for (const c of classesToAdd) {
674
- el.classList.add(c);
675
- }
676
- for (const c of classesToRemove) {
677
- el.classList.remove(c);
678
- }
679
- if (attributeToChange) {
680
- el.setAttribute(attributeToChange.key, attributeToChange.value);
681
- }
682
- if (disableTransition) {
683
- window2.getComputedStyle(style).opacity;
684
- document.head.removeChild(style);
685
- }
686
- }
687
- );
688
- function defaultOnChanged(mode) {
689
- var _a;
690
- updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
691
- }
692
- function onChanged(mode) {
693
- if (options.onChanged)
694
- options.onChanged(mode, defaultOnChanged);
695
- else
696
- defaultOnChanged(mode);
697
- }
698
- watch(state, onChanged, { flush: "post", immediate: true });
699
- tryOnMounted(() => onChanged(state.value));
700
- const auto = computed({
701
- get() {
702
- return emitAuto ? store.value : state.value;
703
- },
704
- set(v) {
705
- store.value = v;
706
- }
707
- });
708
- return Object.assign(auto, { store, system, state });
709
- }
710
- function useDark(options = {}) {
711
- const {
712
- valueDark = "dark",
713
- valueLight = ""
714
- } = options;
715
- const mode = useColorMode({
716
- ...options,
717
- onChanged: (mode2, defaultHandler) => {
718
- var _a;
719
- if (options.onChanged)
720
- (_a = options.onChanged) == null ? void 0 : _a.call(options, mode2 === "dark", defaultHandler, mode2);
721
- else
722
- defaultHandler(mode2);
723
- },
724
- modes: {
725
- dark: valueDark,
726
- light: valueLight
727
- }
728
- });
729
- const system = computed(() => mode.system.value);
730
- const isDark = computed({
731
- get() {
732
- return mode.value === "dark";
733
- },
734
- set(v) {
735
- const modeVal = v ? "dark" : "light";
736
- if (system.value === modeVal)
737
- mode.value = "auto";
738
- else
739
- mode.value = modeVal;
740
- }
741
- });
742
- return isDark;
743
- }
744
442
  function useDraggable(target, options = {}) {
745
443
  var _a;
746
444
  const {
@@ -1352,18 +1050,14 @@ function useVerticalVirtualList(options, list) {
1352
1050
  };
1353
1051
  }
1354
1052
  export {
1355
- StorageSerializers,
1356
- bypassFilter,
1357
1053
  camelize,
1358
1054
  createFilterWrapper,
1359
1055
  createReusableTemplate,
1360
1056
  createSingletonPromise,
1361
- customStorageEventName,
1362
1057
  debounceFilter,
1363
1058
  defaultNavigator,
1364
1059
  defaultWindow,
1365
1060
  getLifeCycleTarget,
1366
- getSSRHandler,
1367
1061
  injectLocal,
1368
1062
  isClient,
1369
1063
  isIOS,
@@ -1373,19 +1067,14 @@ export {
1373
1067
  notNullish,
1374
1068
  onClickOutside,
1375
1069
  onKeyStroke,
1376
- pausableFilter,
1377
- watchPausable as pausableWatch,
1378
1070
  pxValue,
1379
1071
  throttleFilter,
1380
1072
  toArray,
1381
- toRef,
1382
1073
  toRefs,
1383
1074
  tryOnMounted,
1384
1075
  tryOnScopeDispose,
1385
1076
  unrefElement,
1386
1077
  useClipboard,
1387
- useColorMode,
1388
- useDark,
1389
1078
  useDebounceFn,
1390
1079
  useDraggable,
1391
1080
  useElementBounding,
@@ -1395,16 +1084,12 @@ export {
1395
1084
  useMounted,
1396
1085
  useMutationObserver,
1397
1086
  usePermission,
1398
- usePreferredDark,
1399
1087
  useResizeObserver,
1400
1088
  useSSRWidth,
1401
1089
  useScroll,
1402
- useStorage,
1403
1090
  useSupported,
1404
1091
  useThrottleFn,
1405
1092
  useTimeoutFn,
1406
1093
  useVirtualList,
1407
- watchImmediate,
1408
- watchPausable,
1409
- watchWithFilter
1094
+ watchImmediate
1410
1095
  };
@@ -1,4 +1,4 @@
1
- import { getCurrentScope, onScopeDispose, watch, onMounted, nextTick, isRef, toRefs as toRefs$1, customRef, toValue, getCurrentInstance, toRef as toRef$1, readonly, ref, hasInjectionContext, inject, shallowRef } from "vue";
1
+ import { getCurrentScope, onScopeDispose, watch, onMounted, nextTick, isRef, toRefs as toRefs$1, customRef, toValue, getCurrentInstance, hasInjectionContext, inject, shallowRef, readonly } from "vue";
2
2
  function tryOnScopeDispose(fn) {
3
3
  if (getCurrentScope()) {
4
4
  onScopeDispose(fn);
@@ -57,9 +57,6 @@ function createFilterWrapper(filter, fn) {
57
57
  }
58
58
  return wrapper;
59
59
  }
60
- const bypassFilter = (invoke) => {
61
- return invoke();
62
- };
63
60
  function debounceFilter(ms, options = {}) {
64
61
  let timer;
65
62
  let maxTimer;
@@ -157,23 +154,6 @@ function throttleFilter(...args) {
157
154
  };
158
155
  return filter;
159
156
  }
160
- function pausableFilter(extendFilter = bypassFilter, options = {}) {
161
- const {
162
- initialState = "active"
163
- } = options;
164
- const isActive = toRef(initialState === "active");
165
- function pause() {
166
- isActive.value = false;
167
- }
168
- function resume() {
169
- isActive.value = true;
170
- }
171
- const eventFilter = (...args) => {
172
- if (isActive.value)
173
- extendFilter(...args);
174
- };
175
- return { isActive: readonly(isActive), pause, resume, eventFilter };
176
- }
177
157
  function cacheStringFunction(fn) {
178
158
  const cache = /* @__PURE__ */ Object.create(null);
179
159
  return (str) => {
@@ -209,12 +189,6 @@ function getLifeCycleTarget(target) {
209
189
  function toArray(value) {
210
190
  return Array.isArray(value) ? value : [value];
211
191
  }
212
- function toRef(...args) {
213
- if (args.length !== 1)
214
- return toRef$1(...args);
215
- const r = args[0];
216
- return typeof r === "function" ? readonly(customRef(() => ({ get: r, set: noop }))) : ref(r);
217
- }
218
192
  function useDebounceFn(fn, ms = 200, options = {}) {
219
193
  return createFilterWrapper(
220
194
  debounceFilter(ms, options),
@@ -227,37 +201,6 @@ function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnC
227
201
  fn
228
202
  );
229
203
  }
230
- function watchWithFilter(source, cb, options = {}) {
231
- const {
232
- eventFilter = bypassFilter,
233
- ...watchOptions
234
- } = options;
235
- return watch(
236
- source,
237
- createFilterWrapper(
238
- eventFilter,
239
- cb
240
- ),
241
- watchOptions
242
- );
243
- }
244
- function watchPausable(source, cb, options = {}) {
245
- const {
246
- eventFilter: filter,
247
- initialState = "active",
248
- ...watchOptions
249
- } = options;
250
- const { eventFilter, pause, resume, isActive } = pausableFilter(filter, { initialState });
251
- const stop = watchWithFilter(
252
- source,
253
- cb,
254
- {
255
- ...watchOptions,
256
- eventFilter
257
- }
258
- );
259
- return { stop, pause, resume, isActive };
260
- }
261
204
  function toRefs(objectRef, options = {}) {
262
205
  if (!isRef(objectRef))
263
206
  return toRefs$1(objectRef);
@@ -348,7 +291,6 @@ function watchImmediate(source, cb, options) {
348
291
  );
349
292
  }
350
293
  export {
351
- bypassFilter,
352
294
  camelize,
353
295
  createFilterWrapper,
354
296
  createSingletonPromise,
@@ -361,19 +303,14 @@ export {
361
303
  makeDestructurable,
362
304
  noop,
363
305
  notNullish,
364
- pausableFilter,
365
- watchPausable as pausableWatch,
366
306
  pxValue,
367
307
  throttleFilter,
368
308
  toArray,
369
- toRef,
370
309
  toRefs,
371
310
  tryOnMounted,
372
311
  tryOnScopeDispose,
373
312
  useDebounceFn,
374
313
  useThrottleFn,
375
314
  useTimeoutFn,
376
- watchImmediate,
377
- watchPausable,
378
- watchWithFilter
315
+ watchImmediate
379
316
  };