@stacksjs/utils 0.56.35 → 0.57.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.
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Throttle a function.
3
+ *
4
+ * @param fn
5
+ * @param wait
6
+ * @returns
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * // logs window dimensions at most every 250ms
11
+ * window.addEventListener(
12
+ * "resize",
13
+ * throttle(function (evt) {
14
+ * console.log(window.innerWidth)
15
+ * console.log(window.innerHeight)
16
+ * }, 250)
17
+ * )
18
+ */
19
+ export declare function throttle(fn: Function, wait?: number): (this: unknown, ...args: any[]) => void;
@@ -0,0 +1,20 @@
1
+ export function throttle(fn, wait = 300) {
2
+ let inThrottle;
3
+ let lastFn;
4
+ let lastTime;
5
+ return function(...args) {
6
+ if (!inThrottle) {
7
+ fn.apply(this, args);
8
+ lastTime = Date.now();
9
+ inThrottle = true;
10
+ } else {
11
+ clearTimeout(lastFn);
12
+ lastFn = setTimeout(() => {
13
+ if (Date.now() - lastTime >= wait) {
14
+ fn.apply(this, args);
15
+ lastTime = Date.now();
16
+ }
17
+ }, Math.max(wait - (Date.now() - lastTime), 0));
18
+ }
19
+ };
20
+ }
@@ -0,0 +1,3 @@
1
+ export { asyncComputed, breakpointsAntDesign, breakpointsBootstrapV5, breakpointsMasterCss, breakpointsQuasar, breakpointsSematic, breakpointsTailwind, breakpointsVuetify, cloneFnJSON, computedAsync, computedInject, createFetch, createReusableTemplate, createTemplatePromise, createUnrefFn, customStorageEventName, defaultDocument, defaultLocation, defaultNavigator, defaultWindow, executeTransition, formatTimeAgo, getSSRHandler, mapGamepadToXbox360Controller, onClickOutside, onKeyDown, onKeyPressed, onKeyStroke, onKeyUp, onLongPress, onStartTyping, setSSRHandler, templateRef, unrefElement, useActiveElement, useAnimate, useAsyncQueue, useAsyncState, useBase64, useBattery, useBluetooth, useBreakpoints, useBroadcastChannel, useBrowserLocation, useCached, useClipboard, useCloned, useColorMode, useConfirmDialog, useCssVar, useCurrentElement, useCycleList, useDark, useDebouncedRefHistory, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDisplayMedia, useDocumentVisibility, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementHover, useElementSize, useElementVisibility, useEventBus, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetch, useFileDialog, useFileSystemAccess, useFocus, useFocusWithin, useFps, useFullscreen, useGamepad, useGeolocation, useIdle, useImage, useInfiniteScroll, useIntersectionObserver, useKeyModifier, useLocalStorage, useMagicKeys, useManualRefHistory, useMediaControls, useMediaQuery, useMemoize, useMemory, useMounted, useMouse, useMouseInElement, useMousePressed, useMutationObserver, useNavigatorLanguage, useNetwork, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, useParallax, useParentElement, usePerformanceObserver, usePermission, usePointer, usePointerLock, usePointerSwipe, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePreferredReducedMotion, usePrevious, useRafFn, useRefHistory, useResizeObserver, useScreenOrientation, useScreenSafeArea, useScriptTag, useScroll, useScrollLock, useSessionStorage, useShare, useSorted, useSpeechRecognition, useSpeechSynthesis, useStepper, useStorage, useStorageAsync, useStyleTag, useSupported, useSwipe, useTemplateRefsList, useTextDirection, useTextSelection, useTextareaAutosize, useThrottledRefHistory, useTimeAgo, useTimeoutPoll, useTimestamp, useTitle, useTransition, useToggle, useUrlSearchParams, useUserMedia, useVModel, useVModels, useVibrate, useVirtualList, useWakeLock, useWebNotification, useWebSocket, useWebWorker, useWebWorkerFn, useWindowFocus, useWindowScroll, useWindowSize, useDateFormat, useNow, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever, syncRef, syncRefs, throttledRef, throttledWatch, toReactive, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, isDefined, ignorableWatch, extendRef, eagerComputed, debouncedRef, debouncedWatch, createReactiveFn, createSharedComposable, createInjectionState, createGlobalState, createEventHook, controlledRef, controlledComputed, computedEager, computedWithControl, autoResetRef, } from '@vueuse/core';
2
+ export type { HeadClient, HeadObject, HeadObjectPlain, HookBeforeDomUpdate, HookEntriesResolved, HookTagsResolved, LegacyHeadOptions, } from '@vueuse/head';
3
+ export { Head, HeadVuePlugin, createHead, renderHeadToString, } from '@vueuse/head';
@@ -0,0 +1,210 @@
1
+ export {
2
+ asyncComputed,
3
+ breakpointsAntDesign,
4
+ breakpointsBootstrapV5,
5
+ breakpointsMasterCss,
6
+ breakpointsQuasar,
7
+ breakpointsSematic,
8
+ breakpointsTailwind,
9
+ breakpointsVuetify,
10
+ cloneFnJSON,
11
+ computedAsync,
12
+ computedInject,
13
+ createFetch,
14
+ createReusableTemplate,
15
+ createTemplatePromise,
16
+ createUnrefFn,
17
+ customStorageEventName,
18
+ defaultDocument,
19
+ defaultLocation,
20
+ defaultNavigator,
21
+ defaultWindow,
22
+ executeTransition,
23
+ formatTimeAgo,
24
+ getSSRHandler,
25
+ mapGamepadToXbox360Controller,
26
+ onClickOutside,
27
+ onKeyDown,
28
+ onKeyPressed,
29
+ onKeyStroke,
30
+ onKeyUp,
31
+ onLongPress,
32
+ onStartTyping,
33
+ setSSRHandler,
34
+ templateRef,
35
+ unrefElement,
36
+ useActiveElement,
37
+ useAnimate,
38
+ useAsyncQueue,
39
+ useAsyncState,
40
+ useBase64,
41
+ useBattery,
42
+ useBluetooth,
43
+ useBreakpoints,
44
+ useBroadcastChannel,
45
+ useBrowserLocation,
46
+ useCached,
47
+ useClipboard,
48
+ useCloned,
49
+ useColorMode,
50
+ useConfirmDialog,
51
+ useCssVar,
52
+ useCurrentElement,
53
+ useCycleList,
54
+ useDark,
55
+ useDebouncedRefHistory,
56
+ useDeviceMotion,
57
+ useDeviceOrientation,
58
+ useDevicePixelRatio,
59
+ useDevicesList,
60
+ useDisplayMedia,
61
+ useDocumentVisibility,
62
+ useDraggable,
63
+ useDropZone,
64
+ useElementBounding,
65
+ useElementByPoint,
66
+ useElementHover,
67
+ useElementSize,
68
+ useElementVisibility,
69
+ useEventBus,
70
+ useEventListener,
71
+ useEventSource,
72
+ useEyeDropper,
73
+ useFavicon,
74
+ useFetch,
75
+ useFileDialog,
76
+ useFileSystemAccess,
77
+ useFocus,
78
+ useFocusWithin,
79
+ useFps,
80
+ useFullscreen,
81
+ useGamepad,
82
+ useGeolocation,
83
+ useIdle,
84
+ useImage,
85
+ useInfiniteScroll,
86
+ useIntersectionObserver,
87
+ useKeyModifier,
88
+ useLocalStorage,
89
+ useMagicKeys,
90
+ useManualRefHistory,
91
+ useMediaControls,
92
+ useMediaQuery,
93
+ useMemoize,
94
+ useMemory,
95
+ useMounted,
96
+ useMouse,
97
+ useMouseInElement,
98
+ useMousePressed,
99
+ useMutationObserver,
100
+ useNavigatorLanguage,
101
+ useNetwork,
102
+ useObjectUrl,
103
+ useOffsetPagination,
104
+ useOnline,
105
+ usePageLeave,
106
+ useParallax,
107
+ useParentElement,
108
+ usePerformanceObserver,
109
+ usePermission,
110
+ usePointer,
111
+ usePointerLock,
112
+ usePointerSwipe,
113
+ usePreferredColorScheme,
114
+ usePreferredContrast,
115
+ usePreferredDark,
116
+ usePreferredLanguages,
117
+ usePreferredReducedMotion,
118
+ usePrevious,
119
+ useRafFn,
120
+ useRefHistory,
121
+ useResizeObserver,
122
+ useScreenOrientation,
123
+ useScreenSafeArea,
124
+ useScriptTag,
125
+ useScroll,
126
+ useScrollLock,
127
+ useSessionStorage,
128
+ useShare,
129
+ useSorted,
130
+ useSpeechRecognition,
131
+ useSpeechSynthesis,
132
+ useStepper,
133
+ useStorage,
134
+ useStorageAsync,
135
+ useStyleTag,
136
+ useSupported,
137
+ useSwipe,
138
+ useTemplateRefsList,
139
+ useTextDirection,
140
+ useTextSelection,
141
+ useTextareaAutosize,
142
+ useThrottledRefHistory,
143
+ useTimeAgo,
144
+ useTimeoutPoll,
145
+ useTimestamp,
146
+ useTitle,
147
+ useTransition,
148
+ useToggle,
149
+ useUrlSearchParams,
150
+ useUserMedia,
151
+ useVModel,
152
+ useVModels,
153
+ useVibrate,
154
+ useVirtualList,
155
+ useWakeLock,
156
+ useWebNotification,
157
+ useWebSocket,
158
+ useWebWorker,
159
+ useWebWorkerFn,
160
+ useWindowFocus,
161
+ useWindowScroll,
162
+ useWindowSize,
163
+ useDateFormat,
164
+ useNow,
165
+ watchArray,
166
+ watchAtMost,
167
+ watchDebounced,
168
+ watchDeep,
169
+ watchIgnorable,
170
+ watchImmediate,
171
+ watchOnce,
172
+ watchPausable,
173
+ watchThrottled,
174
+ watchTriggerable,
175
+ watchWithFilter,
176
+ whenever,
177
+ syncRef,
178
+ syncRefs,
179
+ throttledRef,
180
+ throttledWatch,
181
+ toReactive,
182
+ tryOnBeforeMount,
183
+ tryOnBeforeUnmount,
184
+ tryOnMounted,
185
+ tryOnScopeDispose,
186
+ tryOnUnmounted,
187
+ until,
188
+ isDefined,
189
+ ignorableWatch,
190
+ extendRef,
191
+ eagerComputed,
192
+ debouncedRef,
193
+ debouncedWatch,
194
+ createReactiveFn,
195
+ createSharedComposable,
196
+ createInjectionState,
197
+ createGlobalState,
198
+ createEventHook,
199
+ controlledRef,
200
+ controlledComputed,
201
+ computedEager,
202
+ computedWithControl,
203
+ autoResetRef
204
+ } from "@vueuse/core";
205
+ export {
206
+ Head,
207
+ HeadVuePlugin,
208
+ createHead,
209
+ renderHeadToString
210
+ } from "@vueuse/head";
@@ -0,0 +1 @@
1
+ export * as semver from 'semver';
@@ -0,0 +1 @@
1
+ export * as semver from "semver";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/utils",
3
3
  "type": "module",
4
- "version": "0.56.35",
4
+ "version": "0.57.2",
5
5
  "packageManager": "pnpm@8.6.5",
6
6
  "description": "The Stacks helper functions.",
7
7
  "author": "Chris Breuer",
@@ -55,15 +55,15 @@
55
55
  "rimraf": "^5.0.1",
56
56
  "semver": "^7.5.3",
57
57
  "yaml": "^2.3.1",
58
- "@stacksjs/arrays": "0.56.35",
59
- "@stacksjs/cli": "0.56.35",
60
- "@stacksjs/config": "0.56.35",
61
- "@stacksjs/development": "0.56.35",
62
- "@stacksjs/lint": "0.56.35",
63
- "@stacksjs/path": "0.56.35",
64
- "@stacksjs/storage": "0.56.35",
65
- "@stacksjs/strings": "0.56.35",
66
- "@stacksjs/types": "0.56.35"
58
+ "@stacksjs/cli": "0.57.2",
59
+ "@stacksjs/config": "0.57.2",
60
+ "@stacksjs/arrays": "0.57.2",
61
+ "@stacksjs/development": "0.57.2",
62
+ "@stacksjs/lint": "0.57.2",
63
+ "@stacksjs/path": "0.57.2",
64
+ "@stacksjs/storage": "0.57.2",
65
+ "@stacksjs/strings": "0.57.2",
66
+ "@stacksjs/types": "0.57.2"
67
67
  },
68
68
  "dependencies": {
69
69
  "@dinero.js/currencies": "2.0.0-alpha.14",
@@ -82,16 +82,16 @@
82
82
  "rimraf": "^5.0.1",
83
83
  "semver": "^7.5.3",
84
84
  "yaml": "^2.3.1",
85
- "@stacksjs/arrays": "0.56.35",
86
- "@stacksjs/cli": "0.56.35",
87
- "@stacksjs/config": "0.56.35",
88
- "@stacksjs/lint": "0.56.35",
89
- "@stacksjs/path": "0.56.35",
90
- "@stacksjs/storage": "0.56.35",
91
- "@stacksjs/types": "0.56.35"
85
+ "@stacksjs/arrays": "0.57.2",
86
+ "@stacksjs/config": "0.57.2",
87
+ "@stacksjs/lint": "0.57.2",
88
+ "@stacksjs/cli": "0.57.2",
89
+ "@stacksjs/path": "0.57.2",
90
+ "@stacksjs/storage": "0.57.2",
91
+ "@stacksjs/types": "0.57.2"
92
92
  },
93
93
  "devDependencies": {
94
- "@stacksjs/development": "0.56.35"
94
+ "@stacksjs/development": "0.57.2"
95
95
  },
96
96
  "scripts": {
97
97
  "build": "unbuild",