@ox0/hooks 0.2.1 → 0.3.0
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.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +138 -100
- package/dist/use-controllable-state.d.ts.map +1 -1
- package/dist/use-deferred-presence.d.ts.map +1 -1
- package/dist/use-long-press.d.ts.map +1 -1
- package/dist/use-previous.d.ts.map +1 -1
- package/dist/use-search-history.d.ts +24 -0
- package/dist/use-search-history.d.ts.map +1 -0
- package/dist/use-search-history.test.d.ts +2 -0
- package/dist/use-search-history.test.d.ts.map +1 -0
- package/dist/use-stored-state.d.ts +1 -1
- package/dist/use-stored-state.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./use-hover";
|
|
|
11
11
|
export * from "./use-interval";
|
|
12
12
|
export * from "./use-key-down";
|
|
13
13
|
export * from "./use-stored-state";
|
|
14
|
+
export * from "./use-search-history";
|
|
14
15
|
export * from "./use-long-press";
|
|
15
16
|
export * from "./use-press";
|
|
16
17
|
export * from "./use-media-query";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE__react_aria_interactions_8422cce9__ from "@react-aria/interactions";
|
|
1
|
+
import { createContext, createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
2
|
function useBeforeUnloadWarning(enabled) {
|
|
4
|
-
|
|
5
|
-
if (!enabled || "
|
|
3
|
+
useEffect(()=>{
|
|
4
|
+
if (!enabled || "u" < typeof window) return;
|
|
6
5
|
const handle = (event)=>{
|
|
7
6
|
event.preventDefault();
|
|
8
7
|
event.returnValue = "";
|
|
@@ -16,7 +15,7 @@ function useBeforeUnloadWarning(enabled) {
|
|
|
16
15
|
const MOBILE_MAX = 767;
|
|
17
16
|
const TABLET_MAX = 1023;
|
|
18
17
|
function getBreakpoint() {
|
|
19
|
-
if ("
|
|
18
|
+
if ("u" < typeof window) return "desktop";
|
|
20
19
|
if (window.matchMedia(`(max-width: ${MOBILE_MAX}px)`).matches) return "mobile";
|
|
21
20
|
if (window.matchMedia(`(max-width: ${TABLET_MAX}px)`).matches) return "tablet";
|
|
22
21
|
return "desktop";
|
|
@@ -32,9 +31,9 @@ function toState(breakpoint) {
|
|
|
32
31
|
};
|
|
33
32
|
}
|
|
34
33
|
function useBreakpoint() {
|
|
35
|
-
const [state, setState] =
|
|
36
|
-
|
|
37
|
-
if ("
|
|
34
|
+
const [state, setState] = useState(()=>toState(getBreakpoint()));
|
|
35
|
+
useEffect(()=>{
|
|
36
|
+
if ("u" < typeof window) return;
|
|
38
37
|
const mobileQuery = window.matchMedia(`(max-width: ${MOBILE_MAX}px)`);
|
|
39
38
|
const tabletQuery = window.matchMedia(`(max-width: ${TABLET_MAX}px)`);
|
|
40
39
|
const handleChange = ()=>{
|
|
@@ -54,12 +53,12 @@ function useBreakpoint() {
|
|
|
54
53
|
return state;
|
|
55
54
|
}
|
|
56
55
|
function useContainerSize() {
|
|
57
|
-
const ref =
|
|
58
|
-
const [size, setSize] =
|
|
56
|
+
const ref = useRef(null);
|
|
57
|
+
const [size, setSize] = useState({
|
|
59
58
|
width: 0,
|
|
60
59
|
height: 0
|
|
61
60
|
});
|
|
62
|
-
|
|
61
|
+
useEffect(()=>{
|
|
63
62
|
const el = ref.current;
|
|
64
63
|
if (!el) return;
|
|
65
64
|
const observer = new ResizeObserver((entries)=>{
|
|
@@ -84,10 +83,10 @@ function useContainerSize() {
|
|
|
84
83
|
}
|
|
85
84
|
function useControllableState(options) {
|
|
86
85
|
const { defaultValue, onChange, value } = options;
|
|
87
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
86
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
88
87
|
const isControlled = void 0 !== value;
|
|
89
88
|
const currentValue = void 0 !== value ? value : uncontrolledValue;
|
|
90
|
-
|
|
89
|
+
useEffect(()=>{
|
|
91
90
|
if (!isControlled) setUncontrolledValue(defaultValue);
|
|
92
91
|
}, [
|
|
93
92
|
defaultValue,
|
|
@@ -103,12 +102,12 @@ function useControllableState(options) {
|
|
|
103
102
|
];
|
|
104
103
|
}
|
|
105
104
|
function useCopyToClipboard(resetMs = 2000) {
|
|
106
|
-
const [copied, setCopied] =
|
|
107
|
-
const timerRef =
|
|
108
|
-
|
|
105
|
+
const [copied, setCopied] = useState(false);
|
|
106
|
+
const timerRef = useRef(null);
|
|
107
|
+
useEffect(()=>()=>{
|
|
109
108
|
if (null !== timerRef.current) clearTimeout(timerRef.current);
|
|
110
109
|
}, []);
|
|
111
|
-
const copy =
|
|
110
|
+
const copy = useCallback(async (text)=>{
|
|
112
111
|
try {
|
|
113
112
|
await navigator.clipboard.writeText(text);
|
|
114
113
|
setCopied(true);
|
|
@@ -124,8 +123,8 @@ function useCopyToClipboard(resetMs = 2000) {
|
|
|
124
123
|
};
|
|
125
124
|
}
|
|
126
125
|
function useDebouncedValue(value, delay = 200) {
|
|
127
|
-
const [debouncedValue, setDebouncedValue] =
|
|
128
|
-
|
|
126
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
127
|
+
useEffect(()=>{
|
|
129
128
|
const timeoutId = window.setTimeout(()=>{
|
|
130
129
|
setDebouncedValue(value);
|
|
131
130
|
}, delay);
|
|
@@ -139,21 +138,18 @@ function useDebouncedValue(value, delay = 200) {
|
|
|
139
138
|
return debouncedValue;
|
|
140
139
|
}
|
|
141
140
|
function useDeferredPresence(isPresent, { delayMs, exitMs, minimumVisibleMs }) {
|
|
142
|
-
const [state, setState] =
|
|
141
|
+
const [state, setState] = useState({
|
|
143
142
|
phase: "hidden"
|
|
144
143
|
});
|
|
145
|
-
const timerRef =
|
|
146
|
-
|
|
144
|
+
const timerRef = useRef(void 0);
|
|
145
|
+
useEffect(()=>{
|
|
147
146
|
clearTimeout(timerRef.current);
|
|
148
147
|
if (isPresent) {
|
|
149
148
|
if ("visible" === state.phase) return;
|
|
150
|
-
if ("exiting" === state.phase) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
});
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
149
|
+
if ("exiting" === state.phase) return void setState({
|
|
150
|
+
phase: "visible",
|
|
151
|
+
shownAt: state.shownAt
|
|
152
|
+
});
|
|
157
153
|
timerRef.current = window.setTimeout(()=>{
|
|
158
154
|
setState({
|
|
159
155
|
phase: "visible",
|
|
@@ -183,14 +179,14 @@ function useDeferredPresence(isPresent, { delayMs, exitMs, minimumVisibleMs }) {
|
|
|
183
179
|
return state.phase;
|
|
184
180
|
}
|
|
185
181
|
function useDisclosure(initialOpen = false) {
|
|
186
|
-
const [isOpen, setIsOpen] =
|
|
187
|
-
const onClose =
|
|
182
|
+
const [isOpen, setIsOpen] = useState(initialOpen);
|
|
183
|
+
const onClose = useCallback(()=>{
|
|
188
184
|
setIsOpen(false);
|
|
189
185
|
}, []);
|
|
190
|
-
const onOpen =
|
|
186
|
+
const onOpen = useCallback(()=>{
|
|
191
187
|
setIsOpen(true);
|
|
192
188
|
}, []);
|
|
193
|
-
const onToggle =
|
|
189
|
+
const onToggle = useCallback(()=>{
|
|
194
190
|
setIsOpen((value)=>!value);
|
|
195
191
|
}, []);
|
|
196
192
|
return {
|
|
@@ -201,13 +197,13 @@ function useDisclosure(initialOpen = false) {
|
|
|
201
197
|
};
|
|
202
198
|
}
|
|
203
199
|
function useEventListener(type, listener, target) {
|
|
204
|
-
const listenerRef =
|
|
205
|
-
|
|
200
|
+
const listenerRef = useRef(listener);
|
|
201
|
+
useEffect(()=>{
|
|
206
202
|
listenerRef.current = listener;
|
|
207
203
|
}, [
|
|
208
204
|
listener
|
|
209
205
|
]);
|
|
210
|
-
|
|
206
|
+
useEffect(()=>{
|
|
211
207
|
const el = void 0 === target ? window : target && "current" in target ? target.current : target;
|
|
212
208
|
if (!el) return;
|
|
213
209
|
const handler = (e)=>listenerRef.current(e);
|
|
@@ -219,9 +215,9 @@ function useEventListener(type, listener, target) {
|
|
|
219
215
|
]);
|
|
220
216
|
}
|
|
221
217
|
function useHover() {
|
|
222
|
-
const ref =
|
|
223
|
-
const [hovered, setHovered] =
|
|
224
|
-
|
|
218
|
+
const ref = useRef(null);
|
|
219
|
+
const [hovered, setHovered] = useState(false);
|
|
220
|
+
useEffect(()=>{
|
|
225
221
|
const el = ref.current;
|
|
226
222
|
if (!el) return;
|
|
227
223
|
const enter = ()=>setHovered(true);
|
|
@@ -239,13 +235,13 @@ function useHover() {
|
|
|
239
235
|
];
|
|
240
236
|
}
|
|
241
237
|
function useInterval(callback, delay) {
|
|
242
|
-
const callbackRef =
|
|
243
|
-
|
|
238
|
+
const callbackRef = useRef(callback);
|
|
239
|
+
useEffect(()=>{
|
|
244
240
|
callbackRef.current = callback;
|
|
245
241
|
}, [
|
|
246
242
|
callback
|
|
247
243
|
]);
|
|
248
|
-
|
|
244
|
+
useEffect(()=>{
|
|
249
245
|
if (null === delay) return;
|
|
250
246
|
const id = window.setInterval(()=>callbackRef.current(), delay);
|
|
251
247
|
return ()=>window.clearInterval(id);
|
|
@@ -254,13 +250,13 @@ function useInterval(callback, delay) {
|
|
|
254
250
|
]);
|
|
255
251
|
}
|
|
256
252
|
function useKeyDown(key, callback, { ctrl = false, meta = false, shift = false, alt = false, enabled = true } = {}) {
|
|
257
|
-
const callbackRef =
|
|
258
|
-
|
|
253
|
+
const callbackRef = useRef(callback);
|
|
254
|
+
useEffect(()=>{
|
|
259
255
|
callbackRef.current = callback;
|
|
260
256
|
}, [
|
|
261
257
|
callback
|
|
262
258
|
]);
|
|
263
|
-
|
|
259
|
+
useEffect(()=>{
|
|
264
260
|
if (!enabled) return;
|
|
265
261
|
const handler = (e)=>{
|
|
266
262
|
if (e.key !== key) return;
|
|
@@ -302,7 +298,7 @@ function tabNotify(key, value) {
|
|
|
302
298
|
const crossTabSubscribers = new Map();
|
|
303
299
|
let broadcastChannel = null;
|
|
304
300
|
function getChannel() {
|
|
305
|
-
if ("
|
|
301
|
+
if ("u" < typeof window || "u" < typeof BroadcastChannel) return null;
|
|
306
302
|
if (!broadcastChannel) {
|
|
307
303
|
broadcastChannel = new BroadcastChannel("ox0:storage");
|
|
308
304
|
broadcastChannel.addEventListener("message", (e)=>{
|
|
@@ -326,7 +322,7 @@ function crossTabSubscribe(key, fn) {
|
|
|
326
322
|
};
|
|
327
323
|
}
|
|
328
324
|
function getTabId() {
|
|
329
|
-
if ("
|
|
325
|
+
if ("u" < typeof sessionStorage) return instanceId;
|
|
330
326
|
const existing = sessionStorage.getItem("ox0:tab-id");
|
|
331
327
|
if (existing) return existing;
|
|
332
328
|
const next = `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
@@ -334,7 +330,7 @@ function getTabId() {
|
|
|
334
330
|
return next;
|
|
335
331
|
}
|
|
336
332
|
function getStorage(kind) {
|
|
337
|
-
if ("
|
|
333
|
+
if ("u" < typeof window) return null;
|
|
338
334
|
return "persistent" === kind ? window.localStorage : window.sessionStorage;
|
|
339
335
|
}
|
|
340
336
|
function makeStorageKey(key, kind, shared, scope) {
|
|
@@ -354,7 +350,7 @@ function readSafe(raw, parser, defaultValue, version, migrate) {
|
|
|
354
350
|
migrated: false
|
|
355
351
|
};
|
|
356
352
|
if (parsed.v !== version) return migrate ? {
|
|
357
|
-
value: migrate(parsed.value, parsed.v),
|
|
353
|
+
value: parser.parse(migrate(parsed.value, parsed.v)),
|
|
358
354
|
migrated: true
|
|
359
355
|
} : {
|
|
360
356
|
value: defaultValue,
|
|
@@ -382,49 +378,49 @@ function writeStorage(storage, key, value, version) {
|
|
|
382
378
|
} catch {}
|
|
383
379
|
return raw;
|
|
384
380
|
}
|
|
385
|
-
const StorageScopeContext =
|
|
381
|
+
const StorageScopeContext = createContext(void 0);
|
|
386
382
|
function StorageProvider({ scope, children }) {
|
|
387
|
-
return
|
|
383
|
+
return createElement(StorageScopeContext.Provider, {
|
|
388
384
|
value: scope
|
|
389
385
|
}, children);
|
|
390
386
|
}
|
|
391
387
|
function useStorageScope() {
|
|
392
|
-
const scope =
|
|
388
|
+
const scope = useContext(StorageScopeContext);
|
|
393
389
|
if (void 0 === scope) throw new Error("useStoredState: no StorageProvider found. Wrap your app with <StorageProvider scope={userId ?? null}>.");
|
|
394
390
|
return scope;
|
|
395
391
|
}
|
|
396
392
|
function useStoredState(kind, key, parser, { defaultValue, version = 1, migrate }, shared) {
|
|
397
393
|
const scope = useStorageScope();
|
|
398
394
|
const storage = getStorage(kind);
|
|
399
|
-
const storageKey =
|
|
395
|
+
const storageKey = useMemo(()=>makeStorageKey(key, kind, shared, scope), [
|
|
400
396
|
key,
|
|
401
397
|
kind,
|
|
402
398
|
shared,
|
|
403
399
|
scope
|
|
404
400
|
]);
|
|
405
|
-
const parserRef =
|
|
406
|
-
const defaultValueRef =
|
|
407
|
-
const versionRef =
|
|
408
|
-
const migrateRef =
|
|
409
|
-
|
|
401
|
+
const parserRef = useRef(parser);
|
|
402
|
+
const defaultValueRef = useRef(defaultValue);
|
|
403
|
+
const versionRef = useRef(version);
|
|
404
|
+
const migrateRef = useRef(migrate);
|
|
405
|
+
useEffect(()=>{
|
|
410
406
|
parserRef.current = parser;
|
|
411
407
|
defaultValueRef.current = defaultValue;
|
|
412
408
|
versionRef.current = version;
|
|
413
409
|
migrateRef.current = migrate;
|
|
414
410
|
});
|
|
415
|
-
const [value, setValueState] =
|
|
411
|
+
const [value, setValueState] = useState(()=>{
|
|
416
412
|
const raw = storage?.getItem(storageKey) ?? null;
|
|
417
413
|
const result = readSafe(raw, parser, defaultValue, version, migrate);
|
|
418
414
|
if (result.migrated) writeStorage(storage, storageKey, result.value, version);
|
|
419
415
|
return result.value;
|
|
420
416
|
});
|
|
421
|
-
const valueRef =
|
|
422
|
-
|
|
417
|
+
const valueRef = useRef(value);
|
|
418
|
+
useEffect(()=>{
|
|
423
419
|
valueRef.current = value;
|
|
424
420
|
}, [
|
|
425
421
|
value
|
|
426
422
|
]);
|
|
427
|
-
|
|
423
|
+
useEffect(()=>{
|
|
428
424
|
const raw = storage?.getItem(storageKey) ?? null;
|
|
429
425
|
const result = readSafe(raw, parserRef.current, defaultValueRef.current, versionRef.current, migrateRef.current);
|
|
430
426
|
setValueState((prev)=>Object.is(prev, result.value) ? prev : result.value);
|
|
@@ -433,12 +429,12 @@ function useStoredState(kind, key, parser, { defaultValue, version = 1, migrate
|
|
|
433
429
|
storage,
|
|
434
430
|
storageKey
|
|
435
431
|
]);
|
|
436
|
-
|
|
432
|
+
useEffect(()=>tabSubscribe(storageKey, (next)=>{
|
|
437
433
|
setValueState((prev)=>Object.is(prev, next) ? prev : next);
|
|
438
434
|
}), [
|
|
439
435
|
storageKey
|
|
440
436
|
]);
|
|
441
|
-
|
|
437
|
+
useEffect(()=>{
|
|
442
438
|
if (!shared) return;
|
|
443
439
|
return crossTabSubscribe(storageKey, (msg)=>{
|
|
444
440
|
if (msg.storage !== kind || msg.sourceId === instanceId) return;
|
|
@@ -453,8 +449,8 @@ function useStoredState(kind, key, parser, { defaultValue, version = 1, migrate
|
|
|
453
449
|
storage,
|
|
454
450
|
storageKey
|
|
455
451
|
]);
|
|
456
|
-
|
|
457
|
-
if (!shared || "persistent" !== kind || "
|
|
452
|
+
useEffect(()=>{
|
|
453
|
+
if (!shared || "persistent" !== kind || "u" < typeof window) return;
|
|
458
454
|
const handler = (event)=>{
|
|
459
455
|
if (event.key !== storageKey) return;
|
|
460
456
|
const result = readSafe(event.newValue, parserRef.current, defaultValueRef.current, versionRef.current, migrateRef.current);
|
|
@@ -470,7 +466,7 @@ function useStoredState(kind, key, parser, { defaultValue, version = 1, migrate
|
|
|
470
466
|
storage,
|
|
471
467
|
storageKey
|
|
472
468
|
]);
|
|
473
|
-
const setValue =
|
|
469
|
+
const setValue = useCallback((next)=>{
|
|
474
470
|
const resolved = "function" == typeof next ? next(valueRef.current) : next;
|
|
475
471
|
if (Object.is(valueRef.current, resolved)) return;
|
|
476
472
|
valueRef.current = resolved;
|
|
@@ -506,11 +502,54 @@ function useSessionState(key, parser, options) {
|
|
|
506
502
|
function useSessionSharedState(key, parser, options) {
|
|
507
503
|
return useStoredState("session", key, parser, options, true);
|
|
508
504
|
}
|
|
505
|
+
const entriesParser = {
|
|
506
|
+
parse (value) {
|
|
507
|
+
if (!Array.isArray(value)) throw new Error("search history is not a list");
|
|
508
|
+
return value.filter((entry)=>"string" == typeof entry);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
function searchHistoryIdentity(entry) {
|
|
512
|
+
return entry.trim().replace(/\s+/g, " ").toLowerCase();
|
|
513
|
+
}
|
|
514
|
+
function useSearchHistory(key, options = {}) {
|
|
515
|
+
const { limit = 15, storage = "persistent" } = options;
|
|
516
|
+
const storageKey = `search-history:${key}`;
|
|
517
|
+
const persistent = usePersistentSharedState(storageKey, entriesParser, {
|
|
518
|
+
defaultValue: []
|
|
519
|
+
});
|
|
520
|
+
const session = useSessionSharedState(storageKey, entriesParser, {
|
|
521
|
+
defaultValue: []
|
|
522
|
+
});
|
|
523
|
+
const [entries, setEntries] = "session" === storage ? session : persistent;
|
|
524
|
+
return useMemo(()=>({
|
|
525
|
+
entries,
|
|
526
|
+
add (entry) {
|
|
527
|
+
const text = entry.trim();
|
|
528
|
+
if ("" === text) return;
|
|
529
|
+
const identity = searchHistoryIdentity(text);
|
|
530
|
+
setEntries((previous)=>[
|
|
531
|
+
text,
|
|
532
|
+
...previous.filter((existing)=>searchHistoryIdentity(existing) !== identity)
|
|
533
|
+
].slice(0, limit));
|
|
534
|
+
},
|
|
535
|
+
remove (entry) {
|
|
536
|
+
const identity = searchHistoryIdentity(entry);
|
|
537
|
+
setEntries((previous)=>previous.filter((existing)=>searchHistoryIdentity(existing) !== identity));
|
|
538
|
+
},
|
|
539
|
+
clear () {
|
|
540
|
+
setEntries([]);
|
|
541
|
+
}
|
|
542
|
+
}), [
|
|
543
|
+
entries,
|
|
544
|
+
limit,
|
|
545
|
+
setEntries
|
|
546
|
+
]);
|
|
547
|
+
}
|
|
509
548
|
function useLongPress({ delayMs = 500, moveThresholdPx = 8, disabled = false, onLongPress }) {
|
|
510
|
-
const timerRef =
|
|
511
|
-
const pointerIdRef =
|
|
512
|
-
const startRef =
|
|
513
|
-
const triggeredRef =
|
|
549
|
+
const timerRef = useRef(null);
|
|
550
|
+
const pointerIdRef = useRef(null);
|
|
551
|
+
const startRef = useRef(null);
|
|
552
|
+
const triggeredRef = useRef(false);
|
|
514
553
|
const clearTimer = ()=>{
|
|
515
554
|
if (null == timerRef.current) return;
|
|
516
555
|
window.clearTimeout(timerRef.current);
|
|
@@ -521,7 +560,7 @@ function useLongPress({ delayMs = 500, moveThresholdPx = 8, disabled = false, on
|
|
|
521
560
|
pointerIdRef.current = null;
|
|
522
561
|
startRef.current = null;
|
|
523
562
|
};
|
|
524
|
-
|
|
563
|
+
useEffect(()=>{
|
|
525
564
|
if (disabled) {
|
|
526
565
|
triggeredRef.current = false;
|
|
527
566
|
reset();
|
|
@@ -529,7 +568,7 @@ function useLongPress({ delayMs = 500, moveThresholdPx = 8, disabled = false, on
|
|
|
529
568
|
}, [
|
|
530
569
|
disabled
|
|
531
570
|
]);
|
|
532
|
-
|
|
571
|
+
useEffect(()=>()=>clearTimer(), []);
|
|
533
572
|
return {
|
|
534
573
|
onPointerDown (event) {
|
|
535
574
|
if (disabled || 0 !== event.button) return;
|
|
@@ -571,10 +610,10 @@ function useLongPress({ delayMs = 500, moveThresholdPx = 8, disabled = false, on
|
|
|
571
610
|
};
|
|
572
611
|
}
|
|
573
612
|
function useMediaQuery(query) {
|
|
574
|
-
const getMatches = ()=>"
|
|
575
|
-
const [matches, setMatches] =
|
|
576
|
-
|
|
577
|
-
if ("
|
|
613
|
+
const getMatches = ()=>"u" > typeof window && window.matchMedia(query).matches;
|
|
614
|
+
const [matches, setMatches] = useState(getMatches);
|
|
615
|
+
useEffect(()=>{
|
|
616
|
+
if ("u" < typeof window) return;
|
|
578
617
|
const mediaQuery = window.matchMedia(query);
|
|
579
618
|
const update = ()=>{
|
|
580
619
|
setMatches(mediaQuery.matches);
|
|
@@ -590,9 +629,9 @@ function useMediaQuery(query) {
|
|
|
590
629
|
return matches;
|
|
591
630
|
}
|
|
592
631
|
function useNavigatorOnline() {
|
|
593
|
-
const [isOnline, setIsOnline] =
|
|
594
|
-
|
|
595
|
-
if ("
|
|
632
|
+
const [isOnline, setIsOnline] = useState(()=>"u" < typeof navigator ? true : navigator.onLine);
|
|
633
|
+
useEffect(()=>{
|
|
634
|
+
if ("u" < typeof window) return;
|
|
596
635
|
const sync = ()=>setIsOnline(navigator.onLine);
|
|
597
636
|
window.addEventListener("online", sync);
|
|
598
637
|
window.addEventListener("offline", sync);
|
|
@@ -604,8 +643,8 @@ function useNavigatorOnline() {
|
|
|
604
643
|
return isOnline;
|
|
605
644
|
}
|
|
606
645
|
function useNow({ update = 1000 } = {}) {
|
|
607
|
-
const [now, setNow] =
|
|
608
|
-
|
|
646
|
+
const [now, setNow] = useState(()=>Date.now());
|
|
647
|
+
useEffect(()=>{
|
|
609
648
|
if (false === update) return;
|
|
610
649
|
const id = window.setInterval(()=>setNow(Date.now()), update);
|
|
611
650
|
return ()=>window.clearInterval(id);
|
|
@@ -615,7 +654,7 @@ function useNow({ update = 1000 } = {}) {
|
|
|
615
654
|
return now;
|
|
616
655
|
}
|
|
617
656
|
function detectOS() {
|
|
618
|
-
if ("
|
|
657
|
+
if ("u" < typeof navigator) return "windows";
|
|
619
658
|
const ua = navigator.userAgent.toLowerCase();
|
|
620
659
|
const platform = (navigator.platform ?? "").toLowerCase();
|
|
621
660
|
const combined = `${ua} ${platform}`;
|
|
@@ -626,7 +665,7 @@ function detectOS() {
|
|
|
626
665
|
return "windows";
|
|
627
666
|
}
|
|
628
667
|
function useOS(override) {
|
|
629
|
-
return
|
|
668
|
+
return useMemo(()=>override ?? detectOS(), [
|
|
630
669
|
override
|
|
631
670
|
]);
|
|
632
671
|
}
|
|
@@ -637,8 +676,8 @@ function usePrefersReducedMotion() {
|
|
|
637
676
|
return useMediaQuery("(prefers-reduced-motion: reduce)");
|
|
638
677
|
}
|
|
639
678
|
function usePrevious(value) {
|
|
640
|
-
const ref =
|
|
641
|
-
|
|
679
|
+
const ref = useRef(void 0);
|
|
680
|
+
useEffect(()=>{
|
|
642
681
|
ref.current = value;
|
|
643
682
|
}, [
|
|
644
683
|
value
|
|
@@ -646,13 +685,13 @@ function usePrevious(value) {
|
|
|
646
685
|
return ref.current;
|
|
647
686
|
}
|
|
648
687
|
function useTimeout(callback, delay) {
|
|
649
|
-
const callbackRef =
|
|
650
|
-
|
|
688
|
+
const callbackRef = useRef(callback);
|
|
689
|
+
useEffect(()=>{
|
|
651
690
|
callbackRef.current = callback;
|
|
652
691
|
}, [
|
|
653
692
|
callback
|
|
654
693
|
]);
|
|
655
|
-
|
|
694
|
+
useEffect(()=>{
|
|
656
695
|
if (null === delay) return;
|
|
657
696
|
const id = window.setTimeout(()=>callbackRef.current(), delay);
|
|
658
697
|
return ()=>window.clearTimeout(id);
|
|
@@ -662,7 +701,7 @@ function useTimeout(callback, delay) {
|
|
|
662
701
|
}
|
|
663
702
|
const KEYBOARD_OPEN_DELTA = 150;
|
|
664
703
|
function getViewportState() {
|
|
665
|
-
if ("
|
|
704
|
+
if ("u" < typeof window) return {
|
|
666
705
|
visualViewportHeight: 0,
|
|
667
706
|
keyboardOpen: false
|
|
668
707
|
};
|
|
@@ -674,9 +713,9 @@ function getViewportState() {
|
|
|
674
713
|
};
|
|
675
714
|
}
|
|
676
715
|
function useViewport() {
|
|
677
|
-
const [state, setState] =
|
|
678
|
-
|
|
679
|
-
if ("
|
|
716
|
+
const [state, setState] = useState(()=>getViewportState());
|
|
717
|
+
useEffect(()=>{
|
|
718
|
+
if ("u" < typeof window) return;
|
|
680
719
|
const target = window.visualViewport ?? window;
|
|
681
720
|
const handleChange = ()=>{
|
|
682
721
|
setState((prev)=>{
|
|
@@ -695,7 +734,7 @@ function useViewport() {
|
|
|
695
734
|
return state;
|
|
696
735
|
}
|
|
697
736
|
function getWindowSize() {
|
|
698
|
-
if ("
|
|
737
|
+
if ("u" < typeof window) return {
|
|
699
738
|
width: 0,
|
|
700
739
|
height: 0
|
|
701
740
|
};
|
|
@@ -705,9 +744,9 @@ function getWindowSize() {
|
|
|
705
744
|
};
|
|
706
745
|
}
|
|
707
746
|
function useWindowSize() {
|
|
708
|
-
const [size, setSize] =
|
|
709
|
-
|
|
710
|
-
if ("
|
|
747
|
+
const [size, setSize] = useState(getWindowSize);
|
|
748
|
+
useEffect(()=>{
|
|
749
|
+
if ("u" < typeof window) return;
|
|
711
750
|
const handleResize = ()=>{
|
|
712
751
|
setSize((prev)=>{
|
|
713
752
|
const next = getWindowSize();
|
|
@@ -720,6 +759,5 @@ function useWindowSize() {
|
|
|
720
759
|
}, []);
|
|
721
760
|
return size;
|
|
722
761
|
}
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
export { StorageProvider, useBeforeUnloadWarning, useBreakpoint, useContainerSize, useControllableState, useCopyToClipboard, useDebouncedValue, useDeferredPresence, useDisclosure, useEventListener, useHover, useInterval, useKeyDown, useLongPress, useMediaQuery, useNavigatorOnline, useNow, useOS, usePersistentSharedState, usePersistentState, usePointerCoarse, usePrefersReducedMotion, usePrevious, useSessionSharedState, useSessionState, useTimeout, useViewport, useWindowSize, __webpack_exports__isFocusVisible as isFocusVisible, __webpack_exports__usePress as usePress };
|
|
762
|
+
export { isFocusVisible, usePress } from "@react-aria/interactions";
|
|
763
|
+
export { StorageProvider, useBeforeUnloadWarning, useBreakpoint, useContainerSize, useControllableState, useCopyToClipboard, useDebouncedValue, useDeferredPresence, useDisclosure, useEventListener, useHover, useInterval, useKeyDown, useLongPress, useMediaQuery, useNavigatorOnline, useNow, useOS, usePersistentSharedState, usePersistentState, usePointerCoarse, usePrefersReducedMotion, usePrevious, useSearchHistory, useSessionSharedState, useSessionState, useTimeout, useViewport, useWindowSize };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-controllable-state.d.ts","sourceRoot":"","sources":["../src/use-controllable-state.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,2BAA2B,CAAC,MAAM;IACjD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EACzC,OAAO,EAAE,2BAA2B,CAAC,MAAM,CAAC,GAC3C,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"use-controllable-state.d.ts","sourceRoot":"","sources":["../src/use-controllable-state.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,2BAA2B,CAAC,MAAM;IACjD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EACzC,OAAO,EAAE,2BAA2B,CAAC,MAAM,CAAC,GAC3C,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC,CAqBvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-deferred-presence.d.ts","sourceRoot":"","sources":["../src/use-deferred-presence.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAA;AAIpE,MAAM,WAAW,uBAAuB;IACtC,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,OAAO,EAClB,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,uBAAuB,GAC7D,qBAAqB,
|
|
1
|
+
{"version":3,"file":"use-deferred-presence.d.ts","sourceRoot":"","sources":["../src/use-deferred-presence.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAA;AAIpE,MAAM,WAAW,uBAAuB;IACtC,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,OAAO,EAClB,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,uBAAuB,GAC7D,qBAAqB,CA+BvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-long-press.d.ts","sourceRoot":"","sources":["../src/use-long-press.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,eAAe,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAG7F,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,MAAM,IAAI,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAAa,EACb,eAAmB,EACnB,QAAgB,EAChB,WAAW,GACZ,EAAE,mBAAmB;
|
|
1
|
+
{"version":3,"file":"use-long-press.d.ts","sourceRoot":"","sources":["../src/use-long-press.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,eAAe,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAG7F,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,MAAM,IAAI,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAAa,EACb,eAAmB,EACnB,QAAgB,EAChB,WAAW,GACZ,EAAE,mBAAmB;IA8BlB,aAAa,QAAQ,iBAAiB,CAAC,WAAW,CAAC;IAcnD,aAAa,QAAQ,iBAAiB,CAAC,WAAW,CAAC;IAMnD,WAAW,QAAQ,iBAAiB,CAAC,WAAW,CAAC;IAIjD,eAAe,QAAQ,iBAAiB,CAAC,WAAW,CAAC;IAIrD,cAAc,QAAQ,eAAe,CAAC,WAAW,CAAC;EAQrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-previous.d.ts","sourceRoot":"","sources":["../src/use-previous.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"use-previous.d.ts","sourceRoot":"","sources":["../src/use-previous.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAOtD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Recent searches, newest first. Pass it to a search box (`QueryBar`, `GlobalSearch`) as `history`. */
|
|
2
|
+
export type SearchHistory = {
|
|
3
|
+
readonly entries: readonly string[];
|
|
4
|
+
/** Records a search: moves it (or an earlier copy of it) to the top, and trims to the limit. */
|
|
5
|
+
readonly add: (entry: string) => void;
|
|
6
|
+
readonly remove: (entry: string) => void;
|
|
7
|
+
readonly clear: () => void;
|
|
8
|
+
};
|
|
9
|
+
export type SearchHistoryOptions = {
|
|
10
|
+
/** How many entries to keep. Default 15. */
|
|
11
|
+
readonly limit?: number;
|
|
12
|
+
/**
|
|
13
|
+
* `"persistent"` (default): kept across sessions in localStorage. `"session"`: forgotten when the
|
|
14
|
+
* tab closes — consider it when searches can contain personal data.
|
|
15
|
+
*/
|
|
16
|
+
readonly storage?: "persistent" | "session";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Recent searches for one search box, kept per user through `StorageProvider` and shared between
|
|
20
|
+
* tabs. Entries are deduplicated ignoring case and spacing; blank searches aren't recorded. Use a
|
|
21
|
+
* key per box (`"payments"`, `"global-search"`) so their histories stay apart.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useSearchHistory(key: string, options?: SearchHistoryOptions): SearchHistory;
|
|
24
|
+
//# sourceMappingURL=use-search-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-search-history.d.ts","sourceRoot":"","sources":["../src/use-search-history.ts"],"names":[],"mappings":"AAIA,wGAAwG;AACxG,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,gGAAgG;IAChG,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CAC5C,CAAA;AAcD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAiC/F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-search-history.test.d.ts","sourceRoot":"","sources":["../src/use-search-history.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
/** Anything with a `.parse` method — Zod schemas
|
|
2
|
+
/** Anything with a `.parse` method that throws on invalid input — `@ox0/schema` and Zod schemas fit. */
|
|
3
3
|
export type Parser<T> = {
|
|
4
4
|
parse: (value: unknown) => T;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-stored-state.d.ts","sourceRoot":"","sources":["../src/use-stored-state.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,
|
|
1
|
+
{"version":3,"file":"use-stored-state.d.ts","sourceRoot":"","sources":["../src/use-stored-state.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,wGAAwG;AACxG,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IAAE,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,CAAA;CAAE,CAAA;AAExD,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI;IAClC,YAAY,EAAE,CAAC,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC,CAAA;CACrD,CAAA;AA2HD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,SAAS,CAAA;CACpB,sGAEA;AAuID,iCAAiC;AACjC,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EACjB,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,uCAzHO,IAAI,EA4H1C;AAED,wCAAwC;AACxC,wBAAgB,wBAAwB,CAAC,CAAC,EACxC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EACjB,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,uCAlIO,IAAI,EAqI1C;AAED,mCAAmC;AACnC,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,uCAxI1D,IAAI,EA0I1C;AAED,yCAAyC;AACzC,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EACjB,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,uCAhJO,IAAI,EAmJ1C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox0/hooks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/esturcke/ox0-platform.git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"react": "^19.0.0"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build": "rslib build -c ../../rslib.config.ts &&
|
|
30
|
+
"build": "rslib build -c ../../rslib.config.ts && rm -f tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json",
|
|
31
31
|
"typecheck": "tsc -p tsconfig.json",
|
|
32
32
|
"lint": "oxlint .",
|
|
33
33
|
"test": "vitest run"
|