yc-design-vue 1.5.1 → 1.5.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.
@@ -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
  };