@mittwald/flow-react-components 0.1.0-alpha.272 → 0.1.0-alpha.274
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/List.js +1 -1
- package/dist/{SettingsProvider-54X6WkBH.js → SettingsProvider-D9oDS5r9.js} +19 -24
- package/dist/SettingsProvider.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/components/SettingsProvider/models/SettingsStore.d.ts +1 -1
- package/dist/types/components/SettingsProvider/models/SettingsStore.test.d.ts +1 -0
- package/dist/types/lib/mobx/mobxMapToObject.d.ts +1 -1
- package/package.json +4 -4
package/dist/List.js
CHANGED
|
@@ -39,7 +39,7 @@ import { useReactTable as yt, getCoreRowModel as Et, getSortedRowModel as Ft, ge
|
|
|
39
39
|
import ye from "invariant";
|
|
40
40
|
import { getAsyncResource as he } from "@mittwald/react-use-promise";
|
|
41
41
|
import { u as ge } from "./useSelector-DpU7_HMO.js";
|
|
42
|
-
import { u as Lt } from "./SettingsProvider-
|
|
42
|
+
import { u as Lt } from "./SettingsProvider-D9oDS5r9.js";
|
|
43
43
|
import * as _ from "react-aria-components";
|
|
44
44
|
import { S as B } from "./SkeletonText-B5ZghZhO.js";
|
|
45
45
|
import { I as Pt } from "./IllustratedMessage-B3MHD01M.js";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
var
|
|
4
|
-
var J = (s, t, e) => t in s ?
|
|
3
|
+
var y = Object.defineProperty;
|
|
4
|
+
var J = (s, t, e) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
5
5
|
var c = (s, t, e) => J(s, typeof t != "symbol" ? t + "" : t, e);
|
|
6
|
-
import O, { createContext as b, useContext as
|
|
7
|
-
import {
|
|
8
|
-
import { getAsyncResource as
|
|
6
|
+
import O, { createContext as b, useContext as v, useRef as x, useMemo as K, useEffect as j } from "react";
|
|
7
|
+
import { makeAutoObservable as l, ObservableMap as a, toJS as E, autorun as P } from "mobx";
|
|
8
|
+
import { getAsyncResource as R } from "@mittwald/react-use-promise";
|
|
9
9
|
import { mapValues as g } from "remeda";
|
|
10
|
-
const
|
|
10
|
+
const h = (s) => Object.fromEntries(s.entries());
|
|
11
11
|
class i {
|
|
12
12
|
constructor(t = new a()) {
|
|
13
13
|
c(this, "settings");
|
|
14
|
-
this.settings = t,
|
|
14
|
+
this.settings = t, l(this);
|
|
15
15
|
}
|
|
16
16
|
set(t, e, n) {
|
|
17
|
-
this.settings.set(t, e.parse(
|
|
17
|
+
this.settings.set(t, e.parse(E(n)));
|
|
18
18
|
}
|
|
19
19
|
get(t, e) {
|
|
20
20
|
return e.parse(this.settings.get(t));
|
|
@@ -23,7 +23,7 @@ class i {
|
|
|
23
23
|
this.settings.delete(t);
|
|
24
24
|
}
|
|
25
25
|
get asJson() {
|
|
26
|
-
return g(
|
|
26
|
+
return g(h(this.settings), (t) => JSON.stringify(t));
|
|
27
27
|
}
|
|
28
28
|
static fromJson(t) {
|
|
29
29
|
return new i(
|
|
@@ -36,7 +36,7 @@ class i {
|
|
|
36
36
|
class u {
|
|
37
37
|
constructor(t = new a()) {
|
|
38
38
|
c(this, "componentSettings");
|
|
39
|
-
this.componentSettings = t,
|
|
39
|
+
this.componentSettings = t, l(this);
|
|
40
40
|
}
|
|
41
41
|
set(t, e, n, o) {
|
|
42
42
|
const r = this.componentSettings.get(t) ?? new i();
|
|
@@ -50,19 +50,14 @@ class u {
|
|
|
50
50
|
(n = this.componentSettings.get(t)) == null || n.clear(e);
|
|
51
51
|
}
|
|
52
52
|
get asJson() {
|
|
53
|
-
return
|
|
54
|
-
Array.from(this.componentSettings.entries()).map(([t, e]) => [
|
|
55
|
-
t,
|
|
56
|
-
e.asJson
|
|
57
|
-
])
|
|
58
|
-
);
|
|
53
|
+
return g(h(this.componentSettings), (t) => t.asJson);
|
|
59
54
|
}
|
|
60
55
|
static fromJson(t) {
|
|
61
56
|
const e = g(t, (n) => i.fromJson(n));
|
|
62
57
|
return new u(new a(e));
|
|
63
58
|
}
|
|
64
59
|
}
|
|
65
|
-
class
|
|
60
|
+
class A {
|
|
66
61
|
constructor(t) {
|
|
67
62
|
c(this, "storageKey");
|
|
68
63
|
this.storageKey = t;
|
|
@@ -80,22 +75,22 @@ const I = (s) => {
|
|
|
80
75
|
case "custom":
|
|
81
76
|
return s.store;
|
|
82
77
|
case "localStorage":
|
|
83
|
-
return new
|
|
78
|
+
return new A(s.storageKey);
|
|
84
79
|
}
|
|
85
80
|
throw new Error(`Unsupported setting backend: ${s}`);
|
|
86
|
-
},
|
|
87
|
-
const { children: t, id: e, ...n } = s, o = I(n), r =
|
|
81
|
+
}, p = b(void 0), F = () => v(p), L = (s) => {
|
|
82
|
+
const { children: t, id: e, ...n } = s, o = I(n), r = R(() => o.load(), [], {
|
|
88
83
|
loaderId: e
|
|
89
|
-
}), f = r.use(), m =
|
|
84
|
+
}), f = r.use(), m = x(Promise.resolve()), S = K(
|
|
90
85
|
() => u.fromJson(f),
|
|
91
86
|
[e]
|
|
92
87
|
), d = () => {
|
|
93
|
-
const
|
|
88
|
+
const w = S.asJson;
|
|
94
89
|
m.current = m.current.then(async () => {
|
|
95
|
-
await o.store(
|
|
90
|
+
await o.store(w), r.refresh();
|
|
96
91
|
});
|
|
97
92
|
};
|
|
98
|
-
return
|
|
93
|
+
return j(() => P(d), [e]), /* @__PURE__ */ O.createElement(p.Provider, { value: S }, t);
|
|
99
94
|
};
|
|
100
95
|
export {
|
|
101
96
|
L as S,
|