@reactuses/core 2.2.7 → 2.2.8
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.
- package/dist/index.cjs +243 -14
- package/dist/index.d.ts +42 -24
- package/dist/index.mjs +242 -15
- package/package.json +4 -20
package/dist/index.cjs
CHANGED
|
@@ -48,6 +48,7 @@ var index$4 = createUpdateEffect(React.useLayoutEffect);
|
|
|
48
48
|
|
|
49
49
|
var _a;
|
|
50
50
|
const isFunction$1 = (val) => typeof val === "function";
|
|
51
|
+
const isString = (val) => typeof val === "string";
|
|
51
52
|
const isDev = process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
52
53
|
const isBrowser = typeof window !== "undefined";
|
|
53
54
|
const isNavigator = typeof navigator !== "undefined";
|
|
@@ -4050,17 +4051,17 @@ function useDropZone(target, onDrop) {
|
|
|
4050
4051
|
}
|
|
4051
4052
|
|
|
4052
4053
|
var __defProp$1 = Object.defineProperty;
|
|
4053
|
-
var __getOwnPropSymbols$
|
|
4054
|
-
var __hasOwnProp$
|
|
4055
|
-
var __propIsEnum$
|
|
4054
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
4055
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
4056
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
4056
4057
|
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4057
4058
|
var __spreadValues$1 = (a, b) => {
|
|
4058
4059
|
for (var prop in b || (b = {}))
|
|
4059
|
-
if (__hasOwnProp$
|
|
4060
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
4060
4061
|
__defNormalProp$1(a, prop, b[prop]);
|
|
4061
|
-
if (__getOwnPropSymbols$
|
|
4062
|
-
for (var prop of __getOwnPropSymbols$
|
|
4063
|
-
if (__propIsEnum$
|
|
4062
|
+
if (__getOwnPropSymbols$2)
|
|
4063
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
4064
|
+
if (__propIsEnum$2.call(b, prop))
|
|
4064
4065
|
__defNormalProp$1(a, prop, b[prop]);
|
|
4065
4066
|
}
|
|
4066
4067
|
return a;
|
|
@@ -4179,17 +4180,17 @@ function useScroll(target, options = {}) {
|
|
|
4179
4180
|
var __defProp = Object.defineProperty;
|
|
4180
4181
|
var __defProps = Object.defineProperties;
|
|
4181
4182
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4182
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4183
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4184
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
4183
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
4184
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
4185
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
4185
4186
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4186
4187
|
var __spreadValues = (a, b) => {
|
|
4187
4188
|
for (var prop in b || (b = {}))
|
|
4188
|
-
if (__hasOwnProp.call(b, prop))
|
|
4189
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
4189
4190
|
__defNormalProp(a, prop, b[prop]);
|
|
4190
|
-
if (__getOwnPropSymbols)
|
|
4191
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
4192
|
-
if (__propIsEnum.call(b, prop))
|
|
4191
|
+
if (__getOwnPropSymbols$1)
|
|
4192
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
4193
|
+
if (__propIsEnum$1.call(b, prop))
|
|
4193
4194
|
__defNormalProp(a, prop, b[prop]);
|
|
4194
4195
|
}
|
|
4195
4196
|
return a;
|
|
@@ -5284,12 +5285,239 @@ function useEyeDropper() {
|
|
|
5284
5285
|
return [isSupported, open];
|
|
5285
5286
|
}
|
|
5286
5287
|
|
|
5288
|
+
/*! js-cookie v3.0.5 | MIT */
|
|
5289
|
+
/* eslint-disable no-var */
|
|
5290
|
+
function assign (target) {
|
|
5291
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5292
|
+
var source = arguments[i];
|
|
5293
|
+
for (var key in source) {
|
|
5294
|
+
target[key] = source[key];
|
|
5295
|
+
}
|
|
5296
|
+
}
|
|
5297
|
+
return target
|
|
5298
|
+
}
|
|
5299
|
+
/* eslint-enable no-var */
|
|
5300
|
+
|
|
5301
|
+
/* eslint-disable no-var */
|
|
5302
|
+
var defaultConverter = {
|
|
5303
|
+
read: function (value) {
|
|
5304
|
+
if (value[0] === '"') {
|
|
5305
|
+
value = value.slice(1, -1);
|
|
5306
|
+
}
|
|
5307
|
+
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
|
|
5308
|
+
},
|
|
5309
|
+
write: function (value) {
|
|
5310
|
+
return encodeURIComponent(value).replace(
|
|
5311
|
+
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
5312
|
+
decodeURIComponent
|
|
5313
|
+
)
|
|
5314
|
+
}
|
|
5315
|
+
};
|
|
5316
|
+
/* eslint-enable no-var */
|
|
5317
|
+
|
|
5318
|
+
/* eslint-disable no-var */
|
|
5319
|
+
|
|
5320
|
+
function init (converter, defaultAttributes) {
|
|
5321
|
+
function set (name, value, attributes) {
|
|
5322
|
+
if (typeof document === 'undefined') {
|
|
5323
|
+
return
|
|
5324
|
+
}
|
|
5325
|
+
|
|
5326
|
+
attributes = assign({}, defaultAttributes, attributes);
|
|
5327
|
+
|
|
5328
|
+
if (typeof attributes.expires === 'number') {
|
|
5329
|
+
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
|
|
5330
|
+
}
|
|
5331
|
+
if (attributes.expires) {
|
|
5332
|
+
attributes.expires = attributes.expires.toUTCString();
|
|
5333
|
+
}
|
|
5334
|
+
|
|
5335
|
+
name = encodeURIComponent(name)
|
|
5336
|
+
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
|
|
5337
|
+
.replace(/[()]/g, escape);
|
|
5338
|
+
|
|
5339
|
+
var stringifiedAttributes = '';
|
|
5340
|
+
for (var attributeName in attributes) {
|
|
5341
|
+
if (!attributes[attributeName]) {
|
|
5342
|
+
continue
|
|
5343
|
+
}
|
|
5344
|
+
|
|
5345
|
+
stringifiedAttributes += '; ' + attributeName;
|
|
5346
|
+
|
|
5347
|
+
if (attributes[attributeName] === true) {
|
|
5348
|
+
continue
|
|
5349
|
+
}
|
|
5350
|
+
|
|
5351
|
+
// Considers RFC 6265 section 5.2:
|
|
5352
|
+
// ...
|
|
5353
|
+
// 3. If the remaining unparsed-attributes contains a %x3B (";")
|
|
5354
|
+
// character:
|
|
5355
|
+
// Consume the characters of the unparsed-attributes up to,
|
|
5356
|
+
// not including, the first %x3B (";") character.
|
|
5357
|
+
// ...
|
|
5358
|
+
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
|
|
5359
|
+
}
|
|
5360
|
+
|
|
5361
|
+
return (document.cookie =
|
|
5362
|
+
name + '=' + converter.write(value, name) + stringifiedAttributes)
|
|
5363
|
+
}
|
|
5364
|
+
|
|
5365
|
+
function get (name) {
|
|
5366
|
+
if (typeof document === 'undefined' || (arguments.length && !name)) {
|
|
5367
|
+
return
|
|
5368
|
+
}
|
|
5369
|
+
|
|
5370
|
+
// To prevent the for loop in the first place assign an empty array
|
|
5371
|
+
// in case there are no cookies at all.
|
|
5372
|
+
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
|
5373
|
+
var jar = {};
|
|
5374
|
+
for (var i = 0; i < cookies.length; i++) {
|
|
5375
|
+
var parts = cookies[i].split('=');
|
|
5376
|
+
var value = parts.slice(1).join('=');
|
|
5377
|
+
|
|
5378
|
+
try {
|
|
5379
|
+
var found = decodeURIComponent(parts[0]);
|
|
5380
|
+
jar[found] = converter.read(value, found);
|
|
5381
|
+
|
|
5382
|
+
if (name === found) {
|
|
5383
|
+
break
|
|
5384
|
+
}
|
|
5385
|
+
} catch (e) {}
|
|
5386
|
+
}
|
|
5387
|
+
|
|
5388
|
+
return name ? jar[name] : jar
|
|
5389
|
+
}
|
|
5390
|
+
|
|
5391
|
+
return Object.create(
|
|
5392
|
+
{
|
|
5393
|
+
set,
|
|
5394
|
+
get,
|
|
5395
|
+
remove: function (name, attributes) {
|
|
5396
|
+
set(
|
|
5397
|
+
name,
|
|
5398
|
+
'',
|
|
5399
|
+
assign({}, attributes, {
|
|
5400
|
+
expires: -1
|
|
5401
|
+
})
|
|
5402
|
+
);
|
|
5403
|
+
},
|
|
5404
|
+
withAttributes: function (attributes) {
|
|
5405
|
+
return init(this.converter, assign({}, this.attributes, attributes))
|
|
5406
|
+
},
|
|
5407
|
+
withConverter: function (converter) {
|
|
5408
|
+
return init(assign({}, this.converter, converter), this.attributes)
|
|
5409
|
+
}
|
|
5410
|
+
},
|
|
5411
|
+
{
|
|
5412
|
+
attributes: { value: Object.freeze(defaultAttributes) },
|
|
5413
|
+
converter: { value: Object.freeze(converter) }
|
|
5414
|
+
}
|
|
5415
|
+
)
|
|
5416
|
+
}
|
|
5417
|
+
|
|
5418
|
+
var api = init(defaultConverter, { path: '/' });
|
|
5419
|
+
|
|
5420
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5421
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5422
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5423
|
+
var __objRest = (source, exclude) => {
|
|
5424
|
+
var target = {};
|
|
5425
|
+
for (var prop in source)
|
|
5426
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
5427
|
+
target[prop] = source[prop];
|
|
5428
|
+
if (source != null && __getOwnPropSymbols)
|
|
5429
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
5430
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
5431
|
+
target[prop] = source[prop];
|
|
5432
|
+
}
|
|
5433
|
+
return target;
|
|
5434
|
+
};
|
|
5435
|
+
function useCookie(key, options = {
|
|
5436
|
+
defaultValue: ""
|
|
5437
|
+
}) {
|
|
5438
|
+
const _a = options, { defaultValue, csrData } = _a, cookieOptions = __objRest(_a, ["defaultValue", "csrData"]);
|
|
5439
|
+
const [cookieValue, setCookieValue] = React.useState(defaultValue);
|
|
5440
|
+
useDeepCompareEffect(() => {
|
|
5441
|
+
const data = csrData ? isFunction$1(csrData) ? csrData() : csrData : isFunction$1(defaultValue) ? defaultValue() : defaultValue;
|
|
5442
|
+
const getStoredValue = () => {
|
|
5443
|
+
const raw = api.get(key);
|
|
5444
|
+
if (raw !== void 0 && raw !== null) {
|
|
5445
|
+
return raw;
|
|
5446
|
+
} else {
|
|
5447
|
+
if (data === void 0) {
|
|
5448
|
+
api.remove(key);
|
|
5449
|
+
} else {
|
|
5450
|
+
api.set(key, data, cookieOptions);
|
|
5451
|
+
}
|
|
5452
|
+
return data;
|
|
5453
|
+
}
|
|
5454
|
+
};
|
|
5455
|
+
setCookieValue(getStoredValue());
|
|
5456
|
+
}, [csrData, defaultValue, key, cookieOptions]);
|
|
5457
|
+
const updateCookie = React.useCallback(
|
|
5458
|
+
(newValue) => {
|
|
5459
|
+
const value = isFunction$1(newValue) ? newValue(cookieValue) : newValue;
|
|
5460
|
+
if (value === void 0) {
|
|
5461
|
+
api.remove(key);
|
|
5462
|
+
} else {
|
|
5463
|
+
api.set(key, value, cookieOptions);
|
|
5464
|
+
}
|
|
5465
|
+
setCookieValue(value);
|
|
5466
|
+
},
|
|
5467
|
+
[key, cookieValue]
|
|
5468
|
+
);
|
|
5469
|
+
const refreshCookie = React.useCallback(() => {
|
|
5470
|
+
const cookieValue2 = api.get(key);
|
|
5471
|
+
if (isString(cookieValue2)) {
|
|
5472
|
+
setCookieValue(cookieValue2);
|
|
5473
|
+
}
|
|
5474
|
+
}, [key]);
|
|
5475
|
+
return Object.freeze([cookieValue, updateCookie, refreshCookie]);
|
|
5476
|
+
}
|
|
5477
|
+
|
|
5478
|
+
function useDoubleClick({
|
|
5479
|
+
target,
|
|
5480
|
+
latency = 300,
|
|
5481
|
+
onSingleClick = () => {
|
|
5482
|
+
},
|
|
5483
|
+
onDoubleClick = () => {
|
|
5484
|
+
}
|
|
5485
|
+
}) {
|
|
5486
|
+
const element = useLatestElement(target);
|
|
5487
|
+
const handle = React.useCallback(
|
|
5488
|
+
(onSingleClick2, onDoubleClick2) => {
|
|
5489
|
+
let count = 0;
|
|
5490
|
+
return (e) => {
|
|
5491
|
+
if (e.type === "touchend") {
|
|
5492
|
+
e.stopPropagation();
|
|
5493
|
+
e.preventDefault();
|
|
5494
|
+
}
|
|
5495
|
+
count += 1;
|
|
5496
|
+
setTimeout(() => {
|
|
5497
|
+
if (count === 1) {
|
|
5498
|
+
onSingleClick2(e);
|
|
5499
|
+
} else if (count === 2) {
|
|
5500
|
+
onDoubleClick2(e);
|
|
5501
|
+
}
|
|
5502
|
+
count = 0;
|
|
5503
|
+
}, latency);
|
|
5504
|
+
};
|
|
5505
|
+
},
|
|
5506
|
+
[latency]
|
|
5507
|
+
);
|
|
5508
|
+
const handleClick = handle(onSingleClick, onDoubleClick);
|
|
5509
|
+
const handleTouchEnd = handle(onSingleClick, onDoubleClick);
|
|
5510
|
+
useEventListener("click", handleClick, element);
|
|
5511
|
+
useEventListener("touchend", handleTouchEnd, element, { passive: false });
|
|
5512
|
+
}
|
|
5513
|
+
|
|
5287
5514
|
exports.getHMSTime = getHMSTime;
|
|
5288
5515
|
exports.useActiveElement = useActiveElement;
|
|
5289
5516
|
exports.useAsyncEffect = useAsyncEffect;
|
|
5290
5517
|
exports.useClickOutside = useClickOutSide;
|
|
5291
5518
|
exports.useClipboard = useClipBorad;
|
|
5292
5519
|
exports.useControlled = useControlled;
|
|
5520
|
+
exports.useCookie = useCookie;
|
|
5293
5521
|
exports.useCountDown = useCountDown;
|
|
5294
5522
|
exports.useCounter = useCounter;
|
|
5295
5523
|
exports.useCustomCompareEffect = useCustomCompareEffect;
|
|
@@ -5299,6 +5527,7 @@ exports.useDebounce = useDebounce;
|
|
|
5299
5527
|
exports.useDebounceFn = useDebounceFn;
|
|
5300
5528
|
exports.useDeepCompareEffect = useDeepCompareEffect;
|
|
5301
5529
|
exports.useDocumentVisibility = useDocumentVisibility;
|
|
5530
|
+
exports.useDoubleClick = useDoubleClick;
|
|
5302
5531
|
exports.useDraggable = useDraggable;
|
|
5303
5532
|
exports.useDropZone = useDropZone;
|
|
5304
5533
|
exports.useElementBounding = useElementBounding;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default, { MutableRefObject, useEffect, useLayoutEffect, Dispatch, SetStateAction, DependencyList, EffectCallback, RefObject, CSSProperties } from 'react';
|
|
3
3
|
import * as lodash from 'lodash';
|
|
4
|
+
import Cookies from 'js-cookie';
|
|
4
5
|
|
|
5
6
|
declare function usePrevious<T>(state: T): T | undefined;
|
|
6
7
|
|
|
@@ -45,9 +46,9 @@ declare function useSessionStorage(key: string, defaults: boolean, options?: Use
|
|
|
45
46
|
declare function useSessionStorage<T>(key: string, defaults: T, options?: UseStorageOptions<T>): readonly [T | null, Dispatch<SetStateAction<T | null>>];
|
|
46
47
|
declare function useSessionStorage<T = unknown>(key: string, defaults: null, options?: UseStorageOptions<T>): readonly [T | null, Dispatch<SetStateAction<T | null>>];
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
type Fn = (this: any, ...args: any[]) => any;
|
|
50
|
+
type Stoppable = [boolean, Fn, Fn];
|
|
51
|
+
type PointerType = "mouse" | "touch" | "pen";
|
|
51
52
|
interface Position {
|
|
52
53
|
x: number;
|
|
53
54
|
y: number;
|
|
@@ -166,11 +167,11 @@ declare function useTimeout(ms?: number, options?: UseTimeoutFnOptions): Stoppab
|
|
|
166
167
|
|
|
167
168
|
declare function useMountedState(): () => boolean;
|
|
168
169
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
type TargetValue<T> = T | undefined | null;
|
|
171
|
+
type TargetType = HTMLElement | Element | Window | Document | EventTarget;
|
|
172
|
+
type BasicTarget<T extends TargetType = Element> = (() => TargetValue<T>) | TargetValue<T> | MutableRefObject<TargetValue<T>>;
|
|
172
173
|
|
|
173
|
-
|
|
174
|
+
type Target = BasicTarget<HTMLElement | Element | Window | Document | EventTarget>;
|
|
174
175
|
declare function useEventListener<K extends keyof WindowEventMap>(eventName: K, handler: (event: WindowEventMap[K]) => void, element?: Window, options?: boolean | AddEventListenerOptions): void;
|
|
175
176
|
declare function useEventListener<K extends keyof DocumentEventMap>(eventName: K, handler: (event: DocumentEventMap[K]) => void, element: Document, options?: boolean | AddEventListenerOptions): void;
|
|
176
177
|
declare function useEventListener<K extends keyof HTMLElementEventMap, T extends HTMLElement = HTMLDivElement>(eventName: K, handler: (event: HTMLElementEventMap[K]) => void, element: T, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -180,7 +181,7 @@ declare function useEventListener(eventName: string, handler: (...p: any) => voi
|
|
|
180
181
|
|
|
181
182
|
declare function useCounter(initialValue?: number | (() => number), max?: number | null, min?: number | null): readonly [number, (newState: number | ((prev: number) => number) | (() => number)) => void, (delta?: number) => void, (delta?: number) => void, () => void];
|
|
182
183
|
|
|
183
|
-
|
|
184
|
+
type RafLoopReturns = readonly [() => void, () => void, () => boolean];
|
|
184
185
|
declare function useRafFn(callback: FrameRequestCallback, initiallyActive?: boolean): RafLoopReturns;
|
|
185
186
|
|
|
186
187
|
interface IListener<T, U = void> {
|
|
@@ -218,7 +219,7 @@ declare function useFavicon(href: string, baseUrl?: string, rel?: string): void;
|
|
|
218
219
|
|
|
219
220
|
declare function useMutationObserver(callback: MutationCallback, target: BasicTarget, options?: MutationObserverInit): () => void;
|
|
220
221
|
|
|
221
|
-
|
|
222
|
+
type DepsEqualFnType<TDeps extends DependencyList> = (prevDeps: TDeps, nextDeps: TDeps) => boolean;
|
|
222
223
|
declare function useCustomCompareEffect<TDeps extends DependencyList>(effect: EffectCallback, deps: TDeps, depsEqual: DepsEqualFnType<TDeps>): void;
|
|
223
224
|
|
|
224
225
|
declare function useDeepCompareEffect(effect: EffectCallback, deps: DependencyList): void;
|
|
@@ -260,12 +261,12 @@ interface UseScriptTagOptions {
|
|
|
260
261
|
*/
|
|
261
262
|
attrs?: Record<string, string>;
|
|
262
263
|
}
|
|
263
|
-
|
|
264
|
+
type Status = "idle" | "loading" | "ready" | "error";
|
|
264
265
|
declare function useScriptTag(src: string, onLoaded?: (el: HTMLScriptElement) => void, options?: UseScriptTagOptions): readonly [HTMLScriptElement | null, Status, (waitForScriptLoad?: boolean) => Promise<HTMLScriptElement | boolean>, () => void];
|
|
265
266
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
type IState = PermissionState | "";
|
|
268
|
+
type DescriptorNamePolyfill = "accelerometer" | "accessibility-events" | "ambient-light-sensor" | "background-sync" | "camera" | "clipboard-read" | "clipboard-write" | "gyroscope" | "magnetometer" | "microphone" | "notifications" | "payment-handler" | "persistent-storage" | "push" | "speaker";
|
|
269
|
+
type GeneralPermissionDescriptor = PermissionDescriptor | {
|
|
269
270
|
name: DescriptorNamePolyfill;
|
|
270
271
|
};
|
|
271
272
|
declare function usePermission(permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor["name"]): IState;
|
|
@@ -296,7 +297,7 @@ declare function useMediaDevices(): {
|
|
|
296
297
|
};
|
|
297
298
|
declare const _default$3: typeof useMediaDevices;
|
|
298
299
|
|
|
299
|
-
|
|
300
|
+
type UseTextDirectionValue = "ltr" | "rtl" | "auto";
|
|
300
301
|
interface UseTextDirectionOptions {
|
|
301
302
|
/**
|
|
302
303
|
* CSS Selector for the target element applying to
|
|
@@ -539,7 +540,7 @@ interface UseInfiniteScrollOptions extends UseScrollOptions {
|
|
|
539
540
|
}
|
|
540
541
|
declare function useInfiniteScroll(target: BasicTarget<HTMLElement | SVGElement>, onLoadMore: (state: ReturnType<typeof useScroll>) => void | Promise<void>, options?: UseInfiniteScrollOptions): void;
|
|
541
542
|
|
|
542
|
-
|
|
543
|
+
type KeyModifier = "Alt" | "AltGraph" | "CapsLock" | "Control" | "Fn" | "FnLock" | "Meta" | "NumLock" | "ScrollLock" | "Shift" | "Symbol" | "SymbolLock";
|
|
543
544
|
interface UseModifierOptions {
|
|
544
545
|
/**
|
|
545
546
|
* Event names that will prompt update to modifier states
|
|
@@ -556,8 +557,8 @@ interface UseModifierOptions {
|
|
|
556
557
|
}
|
|
557
558
|
declare function useKeyModifier(modifier: KeyModifier, options?: UseModifierOptions): boolean;
|
|
558
559
|
|
|
559
|
-
|
|
560
|
-
|
|
560
|
+
type IHookStateInitialSetter<S> = () => S;
|
|
561
|
+
type IHookStateInitAction<S> = S | IHookStateInitialSetter<S>;
|
|
561
562
|
|
|
562
563
|
interface MousePressedOptions {
|
|
563
564
|
/**
|
|
@@ -579,7 +580,7 @@ interface MousePressedOptions {
|
|
|
579
580
|
*/
|
|
580
581
|
initialValue?: IHookStateInitAction<boolean>;
|
|
581
582
|
}
|
|
582
|
-
|
|
583
|
+
type MouseSourceType = "mouse" | "touch" | null;
|
|
583
584
|
declare function useMousePressed(target?: BasicTarget, options?: MousePressedOptions): readonly [boolean, MouseSourceType];
|
|
584
585
|
|
|
585
586
|
declare function useScrollLock(target: BasicTarget<HTMLElement>, initialState?: boolean): readonly [boolean, (flag: boolean) => void];
|
|
@@ -626,10 +627,10 @@ interface UseVirtualListReturn<T> {
|
|
|
626
627
|
}
|
|
627
628
|
declare function useVirtualList<T = any>(list: T[] | undefined, options: UseVirtualListOptions): UseVirtualListReturn<T>;
|
|
628
629
|
|
|
629
|
-
|
|
630
|
+
type ColorScheme = "dark" | "light" | "no-preference";
|
|
630
631
|
declare function usePreferredColorScheme(defaultState?: ColorScheme): ColorScheme;
|
|
631
632
|
|
|
632
|
-
|
|
633
|
+
type Contrast = "more" | "less" | "custom" | "no-preference";
|
|
633
634
|
declare function usePreferredContrast(defaultState?: Contrast): Contrast;
|
|
634
635
|
|
|
635
636
|
declare function useActiveElement<T extends Element>(): T | null;
|
|
@@ -751,7 +752,7 @@ declare function useClipBorad(): readonly [
|
|
|
751
752
|
(txt: string) => Promise<void>
|
|
752
753
|
];
|
|
753
754
|
|
|
754
|
-
|
|
755
|
+
type EventType = MouseEvent | TouchEvent;
|
|
755
756
|
declare function useClickOutSide(target: BasicTarget, handler: (evt: EventType) => void): void;
|
|
756
757
|
|
|
757
758
|
declare function useCycleList<T>(list: T[], i?: number): readonly [T, (i?: number) => void, (i?: number) => void];
|
|
@@ -814,7 +815,7 @@ declare const useSticky: ({ targetElement, scrollElement, axis, nav, }: UseStick
|
|
|
814
815
|
declare function useAsyncEffect<T extends void>(effect: () => Promise<T> | T, cleanup?: typeof effect, deps?: DependencyList): void;
|
|
815
816
|
|
|
816
817
|
declare const getHMSTime: (timeDiff: number) => [string, string, string];
|
|
817
|
-
declare const useCountDown: (time: number, format?: (
|
|
818
|
+
declare const useCountDown: (time: number, format?: (num: number) => [string, string, string], callback?: () => void) => readonly [string, string, string];
|
|
818
819
|
|
|
819
820
|
declare function useSupported(callback: () => unknown, sync?: boolean): boolean;
|
|
820
821
|
|
|
@@ -827,6 +828,23 @@ interface EyeDropperOpenReturnType {
|
|
|
827
828
|
sRGBHex: string;
|
|
828
829
|
}
|
|
829
830
|
declare function useEyeDropper(): readonly [boolean, (options?: EyeDropperOpenOptions) => Promise<EyeDropperOpenReturnType>];
|
|
830
|
-
|
|
831
|
+
type UseEyeDropperReturn = ReturnType<typeof useEyeDropper>;
|
|
831
832
|
|
|
832
|
-
|
|
833
|
+
type CookieState = string | undefined;
|
|
834
|
+
interface CookieOptions extends Cookies.CookieAttributes {
|
|
835
|
+
defaultValue?: string | (() => string);
|
|
836
|
+
/**
|
|
837
|
+
* set to storage when nodata in effect, fallback to defaultValue
|
|
838
|
+
*/
|
|
839
|
+
csrData?: CookieState | (() => CookieState);
|
|
840
|
+
}
|
|
841
|
+
declare function useCookie(key: string, options?: CookieOptions): readonly [CookieState, (newValue: CookieState | ((prevState: CookieState) => CookieState)) => void, () => void];
|
|
842
|
+
|
|
843
|
+
declare function useDoubleClick({ target, latency, onSingleClick, onDoubleClick, }: {
|
|
844
|
+
target: BasicTarget;
|
|
845
|
+
latency?: number;
|
|
846
|
+
onSingleClick?: (e?: MouseEvent | TouchEvent) => void;
|
|
847
|
+
onDoubleClick?: (e?: MouseEvent | TouchEvent) => void;
|
|
848
|
+
}): void;
|
|
849
|
+
|
|
850
|
+
export { ColorScheme, Contrast, CookieOptions, CookieState, CursorState, EyeDropperOpenReturnType, GeneralPermissionDescriptor, IDisposable, IEvent, IEventOnce, IListener, INetworkInformation, IState, IUseNetworkState, KeyModifier, MousePressedOptions, MouseSourceType, OrientationState, RafLoopReturns, ScrollIntoViewAnimation, ScrollIntoViewParams, State, Status, Target, UseDarkOptions, UseDraggableOptions, UseElementBoundingOptions, UseEventEmitterReturn, UseEyeDropperReturn, UseFileDialogOptions, UseFpsOptions, UseFullScreenOptions, UseInfiniteScrollOptions, UseLongPressOptions, UseModifierOptions, UseScriptTagOptions, UseScrollOptions, UseStickyParams, UseTextDirectionOptions, UseTextDirectionValue, UseTimeoutFnOptions, UseVirtualListItem, UseVirtualListOptions, UseVirtualListReturn, WindowSize, getHMSTime, useActiveElement, useAsyncEffect, useClickOutSide as useClickOutside, useClipBorad as useClipboard, useControlled, useCookie, useCountDown, useCounter, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEyeDropper, useFavicon, useFileDialog, useFirstMountState, useFocus, _default$2 as useFps, useFullscreen, useGeolocation, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLongPress, _default$3 as useMediaDevices, useMediaQuery, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, _default$1 as useOnceEffect, _default as useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, _default$5 as useUpdateEffect, _default$4 as useUpdateLayoutEffect, useVirtualList, useWindowScroll, useWindowSize, useWindowsFocus };
|
package/dist/index.mjs
CHANGED
|
@@ -40,6 +40,7 @@ var index$4 = createUpdateEffect(useLayoutEffect);
|
|
|
40
40
|
|
|
41
41
|
var _a;
|
|
42
42
|
const isFunction$1 = (val) => typeof val === "function";
|
|
43
|
+
const isString = (val) => typeof val === "string";
|
|
43
44
|
const isDev = process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
44
45
|
const isBrowser = typeof window !== "undefined";
|
|
45
46
|
const isNavigator = typeof navigator !== "undefined";
|
|
@@ -4042,17 +4043,17 @@ function useDropZone(target, onDrop) {
|
|
|
4042
4043
|
}
|
|
4043
4044
|
|
|
4044
4045
|
var __defProp$1 = Object.defineProperty;
|
|
4045
|
-
var __getOwnPropSymbols$
|
|
4046
|
-
var __hasOwnProp$
|
|
4047
|
-
var __propIsEnum$
|
|
4046
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
4047
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
4048
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
4048
4049
|
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4049
4050
|
var __spreadValues$1 = (a, b) => {
|
|
4050
4051
|
for (var prop in b || (b = {}))
|
|
4051
|
-
if (__hasOwnProp$
|
|
4052
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
4052
4053
|
__defNormalProp$1(a, prop, b[prop]);
|
|
4053
|
-
if (__getOwnPropSymbols$
|
|
4054
|
-
for (var prop of __getOwnPropSymbols$
|
|
4055
|
-
if (__propIsEnum$
|
|
4054
|
+
if (__getOwnPropSymbols$2)
|
|
4055
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
4056
|
+
if (__propIsEnum$2.call(b, prop))
|
|
4056
4057
|
__defNormalProp$1(a, prop, b[prop]);
|
|
4057
4058
|
}
|
|
4058
4059
|
return a;
|
|
@@ -4171,17 +4172,17 @@ function useScroll(target, options = {}) {
|
|
|
4171
4172
|
var __defProp = Object.defineProperty;
|
|
4172
4173
|
var __defProps = Object.defineProperties;
|
|
4173
4174
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4174
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4175
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4176
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
4175
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
4176
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
4177
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
4177
4178
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4178
4179
|
var __spreadValues = (a, b) => {
|
|
4179
4180
|
for (var prop in b || (b = {}))
|
|
4180
|
-
if (__hasOwnProp.call(b, prop))
|
|
4181
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
4181
4182
|
__defNormalProp(a, prop, b[prop]);
|
|
4182
|
-
if (__getOwnPropSymbols)
|
|
4183
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
4184
|
-
if (__propIsEnum.call(b, prop))
|
|
4183
|
+
if (__getOwnPropSymbols$1)
|
|
4184
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
4185
|
+
if (__propIsEnum$1.call(b, prop))
|
|
4185
4186
|
__defNormalProp(a, prop, b[prop]);
|
|
4186
4187
|
}
|
|
4187
4188
|
return a;
|
|
@@ -5276,4 +5277,230 @@ function useEyeDropper() {
|
|
|
5276
5277
|
return [isSupported, open];
|
|
5277
5278
|
}
|
|
5278
5279
|
|
|
5279
|
-
|
|
5280
|
+
/*! js-cookie v3.0.5 | MIT */
|
|
5281
|
+
/* eslint-disable no-var */
|
|
5282
|
+
function assign (target) {
|
|
5283
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5284
|
+
var source = arguments[i];
|
|
5285
|
+
for (var key in source) {
|
|
5286
|
+
target[key] = source[key];
|
|
5287
|
+
}
|
|
5288
|
+
}
|
|
5289
|
+
return target
|
|
5290
|
+
}
|
|
5291
|
+
/* eslint-enable no-var */
|
|
5292
|
+
|
|
5293
|
+
/* eslint-disable no-var */
|
|
5294
|
+
var defaultConverter = {
|
|
5295
|
+
read: function (value) {
|
|
5296
|
+
if (value[0] === '"') {
|
|
5297
|
+
value = value.slice(1, -1);
|
|
5298
|
+
}
|
|
5299
|
+
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
|
|
5300
|
+
},
|
|
5301
|
+
write: function (value) {
|
|
5302
|
+
return encodeURIComponent(value).replace(
|
|
5303
|
+
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
5304
|
+
decodeURIComponent
|
|
5305
|
+
)
|
|
5306
|
+
}
|
|
5307
|
+
};
|
|
5308
|
+
/* eslint-enable no-var */
|
|
5309
|
+
|
|
5310
|
+
/* eslint-disable no-var */
|
|
5311
|
+
|
|
5312
|
+
function init (converter, defaultAttributes) {
|
|
5313
|
+
function set (name, value, attributes) {
|
|
5314
|
+
if (typeof document === 'undefined') {
|
|
5315
|
+
return
|
|
5316
|
+
}
|
|
5317
|
+
|
|
5318
|
+
attributes = assign({}, defaultAttributes, attributes);
|
|
5319
|
+
|
|
5320
|
+
if (typeof attributes.expires === 'number') {
|
|
5321
|
+
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
|
|
5322
|
+
}
|
|
5323
|
+
if (attributes.expires) {
|
|
5324
|
+
attributes.expires = attributes.expires.toUTCString();
|
|
5325
|
+
}
|
|
5326
|
+
|
|
5327
|
+
name = encodeURIComponent(name)
|
|
5328
|
+
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
|
|
5329
|
+
.replace(/[()]/g, escape);
|
|
5330
|
+
|
|
5331
|
+
var stringifiedAttributes = '';
|
|
5332
|
+
for (var attributeName in attributes) {
|
|
5333
|
+
if (!attributes[attributeName]) {
|
|
5334
|
+
continue
|
|
5335
|
+
}
|
|
5336
|
+
|
|
5337
|
+
stringifiedAttributes += '; ' + attributeName;
|
|
5338
|
+
|
|
5339
|
+
if (attributes[attributeName] === true) {
|
|
5340
|
+
continue
|
|
5341
|
+
}
|
|
5342
|
+
|
|
5343
|
+
// Considers RFC 6265 section 5.2:
|
|
5344
|
+
// ...
|
|
5345
|
+
// 3. If the remaining unparsed-attributes contains a %x3B (";")
|
|
5346
|
+
// character:
|
|
5347
|
+
// Consume the characters of the unparsed-attributes up to,
|
|
5348
|
+
// not including, the first %x3B (";") character.
|
|
5349
|
+
// ...
|
|
5350
|
+
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
|
|
5351
|
+
}
|
|
5352
|
+
|
|
5353
|
+
return (document.cookie =
|
|
5354
|
+
name + '=' + converter.write(value, name) + stringifiedAttributes)
|
|
5355
|
+
}
|
|
5356
|
+
|
|
5357
|
+
function get (name) {
|
|
5358
|
+
if (typeof document === 'undefined' || (arguments.length && !name)) {
|
|
5359
|
+
return
|
|
5360
|
+
}
|
|
5361
|
+
|
|
5362
|
+
// To prevent the for loop in the first place assign an empty array
|
|
5363
|
+
// in case there are no cookies at all.
|
|
5364
|
+
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
|
5365
|
+
var jar = {};
|
|
5366
|
+
for (var i = 0; i < cookies.length; i++) {
|
|
5367
|
+
var parts = cookies[i].split('=');
|
|
5368
|
+
var value = parts.slice(1).join('=');
|
|
5369
|
+
|
|
5370
|
+
try {
|
|
5371
|
+
var found = decodeURIComponent(parts[0]);
|
|
5372
|
+
jar[found] = converter.read(value, found);
|
|
5373
|
+
|
|
5374
|
+
if (name === found) {
|
|
5375
|
+
break
|
|
5376
|
+
}
|
|
5377
|
+
} catch (e) {}
|
|
5378
|
+
}
|
|
5379
|
+
|
|
5380
|
+
return name ? jar[name] : jar
|
|
5381
|
+
}
|
|
5382
|
+
|
|
5383
|
+
return Object.create(
|
|
5384
|
+
{
|
|
5385
|
+
set,
|
|
5386
|
+
get,
|
|
5387
|
+
remove: function (name, attributes) {
|
|
5388
|
+
set(
|
|
5389
|
+
name,
|
|
5390
|
+
'',
|
|
5391
|
+
assign({}, attributes, {
|
|
5392
|
+
expires: -1
|
|
5393
|
+
})
|
|
5394
|
+
);
|
|
5395
|
+
},
|
|
5396
|
+
withAttributes: function (attributes) {
|
|
5397
|
+
return init(this.converter, assign({}, this.attributes, attributes))
|
|
5398
|
+
},
|
|
5399
|
+
withConverter: function (converter) {
|
|
5400
|
+
return init(assign({}, this.converter, converter), this.attributes)
|
|
5401
|
+
}
|
|
5402
|
+
},
|
|
5403
|
+
{
|
|
5404
|
+
attributes: { value: Object.freeze(defaultAttributes) },
|
|
5405
|
+
converter: { value: Object.freeze(converter) }
|
|
5406
|
+
}
|
|
5407
|
+
)
|
|
5408
|
+
}
|
|
5409
|
+
|
|
5410
|
+
var api = init(defaultConverter, { path: '/' });
|
|
5411
|
+
|
|
5412
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5413
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5414
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5415
|
+
var __objRest = (source, exclude) => {
|
|
5416
|
+
var target = {};
|
|
5417
|
+
for (var prop in source)
|
|
5418
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
5419
|
+
target[prop] = source[prop];
|
|
5420
|
+
if (source != null && __getOwnPropSymbols)
|
|
5421
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
5422
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
5423
|
+
target[prop] = source[prop];
|
|
5424
|
+
}
|
|
5425
|
+
return target;
|
|
5426
|
+
};
|
|
5427
|
+
function useCookie(key, options = {
|
|
5428
|
+
defaultValue: ""
|
|
5429
|
+
}) {
|
|
5430
|
+
const _a = options, { defaultValue, csrData } = _a, cookieOptions = __objRest(_a, ["defaultValue", "csrData"]);
|
|
5431
|
+
const [cookieValue, setCookieValue] = useState(defaultValue);
|
|
5432
|
+
useDeepCompareEffect(() => {
|
|
5433
|
+
const data = csrData ? isFunction$1(csrData) ? csrData() : csrData : isFunction$1(defaultValue) ? defaultValue() : defaultValue;
|
|
5434
|
+
const getStoredValue = () => {
|
|
5435
|
+
const raw = api.get(key);
|
|
5436
|
+
if (raw !== void 0 && raw !== null) {
|
|
5437
|
+
return raw;
|
|
5438
|
+
} else {
|
|
5439
|
+
if (data === void 0) {
|
|
5440
|
+
api.remove(key);
|
|
5441
|
+
} else {
|
|
5442
|
+
api.set(key, data, cookieOptions);
|
|
5443
|
+
}
|
|
5444
|
+
return data;
|
|
5445
|
+
}
|
|
5446
|
+
};
|
|
5447
|
+
setCookieValue(getStoredValue());
|
|
5448
|
+
}, [csrData, defaultValue, key, cookieOptions]);
|
|
5449
|
+
const updateCookie = useCallback(
|
|
5450
|
+
(newValue) => {
|
|
5451
|
+
const value = isFunction$1(newValue) ? newValue(cookieValue) : newValue;
|
|
5452
|
+
if (value === void 0) {
|
|
5453
|
+
api.remove(key);
|
|
5454
|
+
} else {
|
|
5455
|
+
api.set(key, value, cookieOptions);
|
|
5456
|
+
}
|
|
5457
|
+
setCookieValue(value);
|
|
5458
|
+
},
|
|
5459
|
+
[key, cookieValue]
|
|
5460
|
+
);
|
|
5461
|
+
const refreshCookie = useCallback(() => {
|
|
5462
|
+
const cookieValue2 = api.get(key);
|
|
5463
|
+
if (isString(cookieValue2)) {
|
|
5464
|
+
setCookieValue(cookieValue2);
|
|
5465
|
+
}
|
|
5466
|
+
}, [key]);
|
|
5467
|
+
return Object.freeze([cookieValue, updateCookie, refreshCookie]);
|
|
5468
|
+
}
|
|
5469
|
+
|
|
5470
|
+
function useDoubleClick({
|
|
5471
|
+
target,
|
|
5472
|
+
latency = 300,
|
|
5473
|
+
onSingleClick = () => {
|
|
5474
|
+
},
|
|
5475
|
+
onDoubleClick = () => {
|
|
5476
|
+
}
|
|
5477
|
+
}) {
|
|
5478
|
+
const element = useLatestElement(target);
|
|
5479
|
+
const handle = useCallback(
|
|
5480
|
+
(onSingleClick2, onDoubleClick2) => {
|
|
5481
|
+
let count = 0;
|
|
5482
|
+
return (e) => {
|
|
5483
|
+
if (e.type === "touchend") {
|
|
5484
|
+
e.stopPropagation();
|
|
5485
|
+
e.preventDefault();
|
|
5486
|
+
}
|
|
5487
|
+
count += 1;
|
|
5488
|
+
setTimeout(() => {
|
|
5489
|
+
if (count === 1) {
|
|
5490
|
+
onSingleClick2(e);
|
|
5491
|
+
} else if (count === 2) {
|
|
5492
|
+
onDoubleClick2(e);
|
|
5493
|
+
}
|
|
5494
|
+
count = 0;
|
|
5495
|
+
}, latency);
|
|
5496
|
+
};
|
|
5497
|
+
},
|
|
5498
|
+
[latency]
|
|
5499
|
+
);
|
|
5500
|
+
const handleClick = handle(onSingleClick, onDoubleClick);
|
|
5501
|
+
const handleTouchEnd = handle(onSingleClick, onDoubleClick);
|
|
5502
|
+
useEventListener("click", handleClick, element);
|
|
5503
|
+
useEventListener("touchend", handleTouchEnd, element, { passive: false });
|
|
5504
|
+
}
|
|
5505
|
+
|
|
5506
|
+
export { getHMSTime, useActiveElement, useAsyncEffect, useClickOutSide as useClickOutside, useClipBorad as useClipboard, useControlled, useCookie, useCountDown, useCounter, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEyeDropper, useFavicon, useFileDialog, useFirstMountState, useFocus, index$2 as useFps, useFullscreen, useGeolocation, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLongPress, index$3 as useMediaDevices, useMediaQuery, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, index$1 as useOnceEffect, index as useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, index$4 as useUpdateLayoutEffect, useVirtualList, useWindowScroll, useWindowSize, useWindowsFocus };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactuses/core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
4
4
|
"license": "Unlicense",
|
|
5
5
|
"homepage": "https://www.reactuse.com/",
|
|
6
6
|
"repository": {
|
|
@@ -52,44 +52,28 @@
|
|
|
52
52
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
+
"js-cookie": "^3.0.5",
|
|
55
56
|
"lodash-es": "^4.17.21",
|
|
56
57
|
"screenfull": "^5.0.0"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"@types/lodash-es": "^4.17.7",
|
|
60
|
-
"lodash": "^4.17.21",
|
|
61
|
-
"@babel/cli": "^7.19.3",
|
|
62
|
-
"@babel/core": "^7.20.2",
|
|
63
|
-
"@babel/preset-env": "^7.20.2",
|
|
64
|
-
"@babel/preset-react": "^7.18.6",
|
|
65
|
-
"@babel/preset-typescript": "^7.18.6",
|
|
66
60
|
"@jsdevtools/version-bump-prompt": "^6.1.0",
|
|
67
61
|
"@rollup/plugin-commonjs": "^22.0.2",
|
|
68
62
|
"@rollup/plugin-json": "^4.1.0",
|
|
69
63
|
"@rollup/plugin-node-resolve": "^14.1.0",
|
|
70
64
|
"@rollup/plugin-replace": "^4.0.0",
|
|
71
65
|
"@testing-library/react": "^13.4.0",
|
|
72
|
-
"@types/fs-extra": "^9.0.13",
|
|
73
66
|
"@types/jest": "^27.5.2",
|
|
74
|
-
"@types/lodash": "^4.14.184",
|
|
75
|
-
"@types/node": "^18.11.9",
|
|
76
|
-
"@types/react": "^18.0.25",
|
|
77
67
|
"babel-jest": "^29.0.2",
|
|
78
68
|
"consola": "^2.15.3",
|
|
79
|
-
"cross-env": "^7.0.3",
|
|
80
69
|
"esbuild": "^0.17.15",
|
|
81
70
|
"esbuild-register": "^3.4.1",
|
|
82
|
-
"esno": "^0.16.3",
|
|
83
|
-
"fast-glob": "^3.2.12",
|
|
84
|
-
"fs-extra": "^10.1.0",
|
|
85
71
|
"jest": "^29.0.2",
|
|
86
72
|
"jest-environment-jsdom": "^29.0.2",
|
|
73
|
+
"lodash": "^4.17.21",
|
|
87
74
|
"react": "^18.2.0",
|
|
88
|
-
"react-dom": "^18.2.0",
|
|
89
75
|
"rollup": "^2.79.0",
|
|
90
76
|
"rollup-plugin-dts": "^4.2.2",
|
|
91
|
-
"rollup-plugin-esbuild": "^4.10.1"
|
|
92
|
-
"ts-node": "^10.9.1",
|
|
93
|
-
"typescript": "^4.8.2"
|
|
77
|
+
"rollup-plugin-esbuild": "^4.10.1"
|
|
94
78
|
}
|
|
95
79
|
}
|