@arkitektbedriftene/fe-lib 0.4.37 → 0.4.38
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/hooks.es.js +2 -3
- package/dist/icons.es.js +2 -2
- package/dist/{index.esm-e4db0c1f.js → index.esm-67eba761.js} +5 -5
- package/dist/{index.esm-55efa2d1.js → index.esm-ab03d8db.js} +1 -1
- package/dist/oidc.es.js +102 -2778
- package/dist/rich-text.es.js +2611 -645
- package/dist/stitches.config-00c23cdb.js +136 -0
- package/dist/ui.es.js +77 -76
- package/package.json +1 -1
- package/dist/stitches.config-543644f4.js +0 -2919
- package/dist/useLocalStorageState-b4fb2a60.js +0 -100
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { useSyncExternalStore as S, useState as v, useRef as w, useCallback as m, useEffect as h, useMemo as I } from "react";
|
|
2
|
-
const o = /* @__PURE__ */ new Map();
|
|
3
|
-
function L(e, t) {
|
|
4
|
-
if (S === void 0)
|
|
5
|
-
throw new TypeError('You are using React 17 or below. Install with "npm install use-local-storage-state@17".');
|
|
6
|
-
const [s] = v(t == null ? void 0 : t.defaultValue);
|
|
7
|
-
if (typeof window > "u")
|
|
8
|
-
return [
|
|
9
|
-
s,
|
|
10
|
-
() => {
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
isPersistent: !0,
|
|
14
|
-
removeItem: () => {
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
];
|
|
18
|
-
const a = t == null ? void 0 : t.serializer;
|
|
19
|
-
return p(e, s, t == null ? void 0 : t.storageSync, a == null ? void 0 : a.parse, a == null ? void 0 : a.stringify);
|
|
20
|
-
}
|
|
21
|
-
function p(e, t, s = !0, a = b, i = JSON.stringify) {
|
|
22
|
-
if (!o.has(e) && t !== void 0 && localStorage.getItem(e) === null)
|
|
23
|
-
try {
|
|
24
|
-
localStorage.setItem(e, i(t));
|
|
25
|
-
} catch {
|
|
26
|
-
}
|
|
27
|
-
const c = w({
|
|
28
|
-
item: null,
|
|
29
|
-
parsed: t
|
|
30
|
-
}), l = S(
|
|
31
|
-
m((r) => {
|
|
32
|
-
const n = (u) => {
|
|
33
|
-
e === u && r();
|
|
34
|
-
};
|
|
35
|
-
return f.add(n), () => {
|
|
36
|
-
f.delete(n);
|
|
37
|
-
};
|
|
38
|
-
}, [e]),
|
|
39
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
|
-
() => {
|
|
41
|
-
const r = localStorage.getItem(e);
|
|
42
|
-
if (o.has(e))
|
|
43
|
-
c.current = {
|
|
44
|
-
item: r,
|
|
45
|
-
parsed: o.get(e)
|
|
46
|
-
};
|
|
47
|
-
else if (r !== c.current.item) {
|
|
48
|
-
let n;
|
|
49
|
-
try {
|
|
50
|
-
n = r === null ? t : a(r);
|
|
51
|
-
} catch {
|
|
52
|
-
n = t;
|
|
53
|
-
}
|
|
54
|
-
c.current = {
|
|
55
|
-
item: r,
|
|
56
|
-
parsed: n
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
return c.current.parsed;
|
|
60
|
-
},
|
|
61
|
-
// istanbul ignore next
|
|
62
|
-
() => t
|
|
63
|
-
), g = m((r) => {
|
|
64
|
-
const n = r instanceof Function ? r(c.current.parsed) : r;
|
|
65
|
-
try {
|
|
66
|
-
localStorage.setItem(e, i(n)), o.delete(e);
|
|
67
|
-
} catch {
|
|
68
|
-
o.set(e, n);
|
|
69
|
-
}
|
|
70
|
-
d(e);
|
|
71
|
-
}, [e, i]);
|
|
72
|
-
return h(() => {
|
|
73
|
-
if (!s)
|
|
74
|
-
return;
|
|
75
|
-
const r = (n) => {
|
|
76
|
-
n.storageArea === localStorage && n.key === e && d(e);
|
|
77
|
-
};
|
|
78
|
-
return window.addEventListener("storage", r), () => window.removeEventListener("storage", r);
|
|
79
|
-
}, [e, s]), I(() => [
|
|
80
|
-
l,
|
|
81
|
-
g,
|
|
82
|
-
{
|
|
83
|
-
isPersistent: l === t || !o.has(e),
|
|
84
|
-
removeItem() {
|
|
85
|
-
o.delete(e), localStorage.removeItem(e), d(e);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
], [e, g, l, t]);
|
|
89
|
-
}
|
|
90
|
-
const f = /* @__PURE__ */ new Set();
|
|
91
|
-
function d(e) {
|
|
92
|
-
for (const t of [...f])
|
|
93
|
-
t(e);
|
|
94
|
-
}
|
|
95
|
-
function b(e) {
|
|
96
|
-
return e === "undefined" ? void 0 : JSON.parse(e);
|
|
97
|
-
}
|
|
98
|
-
export {
|
|
99
|
-
L as u
|
|
100
|
-
};
|