@mittwald/flow-react-components 0.1.0-alpha.271 → 0.1.0-alpha.272
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-BkPyYqsz.js → SettingsProvider-54X6WkBH.js} +31 -27
- package/dist/SettingsProvider.js +1 -1
- package/dist/types/components/SettingsProvider/models/ComponentSettings.d.ts +2 -2
- package/dist/types/components/SettingsProvider/models/SettingsStore.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-54X6WkBH.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
|
|
5
|
-
var c = (s, t, e) =>
|
|
6
|
-
import
|
|
7
|
-
import { toJS as
|
|
8
|
-
import { getAsyncResource as
|
|
9
|
-
import { mapValues as
|
|
10
|
-
const P = (s) => Object.fromEntries(
|
|
3
|
+
var w = Object.defineProperty;
|
|
4
|
+
var J = (s, t, e) => t in s ? w(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
5
|
+
var c = (s, t, e) => J(s, typeof t != "symbol" ? t + "" : t, e);
|
|
6
|
+
import O, { createContext as b, useContext as j, useRef as v, useMemo as x, useEffect as E } from "react";
|
|
7
|
+
import { toJS as l, makeAutoObservable as p, ObservableMap as a, autorun as K } from "mobx";
|
|
8
|
+
import { getAsyncResource as A } from "@mittwald/react-use-promise";
|
|
9
|
+
import { mapValues as g } from "remeda";
|
|
10
|
+
const P = (s) => Object.fromEntries(l(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, p(this);
|
|
15
15
|
}
|
|
16
16
|
set(t, e, n) {
|
|
17
|
-
this.settings.set(t, e.parse(n));
|
|
17
|
+
this.settings.set(t, e.parse(l(n)));
|
|
18
18
|
}
|
|
19
19
|
get(t, e) {
|
|
20
20
|
return e.parse(this.settings.get(t));
|
|
@@ -23,16 +23,20 @@ class i {
|
|
|
23
23
|
this.settings.delete(t);
|
|
24
24
|
}
|
|
25
25
|
get asJson() {
|
|
26
|
-
return P(this.settings);
|
|
26
|
+
return g(P(this.settings), (t) => JSON.stringify(t));
|
|
27
27
|
}
|
|
28
28
|
static fromJson(t) {
|
|
29
|
-
return new i(
|
|
29
|
+
return new i(
|
|
30
|
+
new a(
|
|
31
|
+
g(t, (e) => typeof e == "string" ? JSON.parse(e) : e)
|
|
32
|
+
)
|
|
33
|
+
);
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
|
-
class
|
|
36
|
+
class u {
|
|
33
37
|
constructor(t = new a()) {
|
|
34
38
|
c(this, "componentSettings");
|
|
35
|
-
this.componentSettings = t,
|
|
39
|
+
this.componentSettings = t, p(this);
|
|
36
40
|
}
|
|
37
41
|
set(t, e, n, o) {
|
|
38
42
|
const r = this.componentSettings.get(t) ?? new i();
|
|
@@ -54,8 +58,8 @@ class g {
|
|
|
54
58
|
);
|
|
55
59
|
}
|
|
56
60
|
static fromJson(t) {
|
|
57
|
-
const e =
|
|
58
|
-
return new
|
|
61
|
+
const e = g(t, (n) => i.fromJson(n));
|
|
62
|
+
return new u(new a(e));
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
class R {
|
|
@@ -79,21 +83,21 @@ const I = (s) => {
|
|
|
79
83
|
return new R(s.storageKey);
|
|
80
84
|
}
|
|
81
85
|
throw new Error(`Unsupported setting backend: ${s}`);
|
|
82
|
-
},
|
|
83
|
-
const { children: t, id: e, ...n } = s, o = I(n), r =
|
|
86
|
+
}, h = b(void 0), F = () => j(h), L = (s) => {
|
|
87
|
+
const { children: t, id: e, ...n } = s, o = I(n), r = A(() => o.load(), [], {
|
|
84
88
|
loaderId: e
|
|
85
|
-
}),
|
|
86
|
-
() =>
|
|
89
|
+
}), f = r.use(), m = v(Promise.resolve()), S = x(
|
|
90
|
+
() => u.fromJson(f),
|
|
87
91
|
[e]
|
|
88
|
-
),
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
await o.store(
|
|
92
|
+
), d = () => {
|
|
93
|
+
const y = S.asJson;
|
|
94
|
+
m.current = m.current.then(async () => {
|
|
95
|
+
await o.store(y), r.refresh();
|
|
92
96
|
});
|
|
93
97
|
};
|
|
94
|
-
return
|
|
98
|
+
return E(() => K(d), [e]), /* @__PURE__ */ O.createElement(h.Provider, { value: S }, t);
|
|
95
99
|
};
|
|
96
100
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
L as S,
|
|
102
|
+
F as u
|
|
99
103
|
};
|
package/dist/SettingsProvider.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ObservableMap } from 'mobx';
|
|
2
2
|
import { ZodSchema, default as z } from 'zod';
|
|
3
|
+
export type ComponentSettingsJson = Record<string, string>;
|
|
3
4
|
export declare class ComponentSettings {
|
|
4
5
|
readonly settings: ObservableMap<string, unknown>;
|
|
5
6
|
constructor(settings?: ObservableMap<string, unknown>);
|
|
6
7
|
set<T extends ZodSchema>(settingKey: string, schema: T, value: z.infer<T>): void;
|
|
7
8
|
get<T extends ZodSchema>(settingKey: string, schema: T): z.infer<T>;
|
|
8
9
|
clear(settingKey: string): void;
|
|
9
|
-
get asJson():
|
|
10
|
+
get asJson(): ComponentSettingsJson;
|
|
10
11
|
static fromJson(json: ComponentSettingsJson): ComponentSettings;
|
|
11
12
|
}
|
|
12
|
-
export type ComponentSettingsJson = ComponentSettings["asJson"];
|
|
@@ -9,7 +9,7 @@ export declare class SettingsStore {
|
|
|
9
9
|
get<T extends ZodSchema>(componentName: FlowComponentName, settingKey: string, schema: T): z.infer<T>;
|
|
10
10
|
clear(componentName: FlowComponentName, settingKey: string): void;
|
|
11
11
|
get asJson(): {
|
|
12
|
-
[k: string]:
|
|
12
|
+
[k: string]: import('./ComponentSettings').ComponentSettingsJson;
|
|
13
13
|
};
|
|
14
14
|
static fromJson(json: SettingsJson): SettingsStore;
|
|
15
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.272",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
"@chakra-ui/live-region": "^2.1.0",
|
|
314
314
|
"@internationalized/date": "^3.5.5",
|
|
315
315
|
"@internationalized/string-compiler": "^3.2.4",
|
|
316
|
-
"@mittwald/react-tunnel": "^0.1.0-alpha.
|
|
316
|
+
"@mittwald/react-tunnel": "^0.1.0-alpha.272",
|
|
317
317
|
"@mittwald/react-use-promise": "^2.5.0",
|
|
318
318
|
"@react-aria/utils": "^3.25.2",
|
|
319
319
|
"@react-types/shared": "^3.24.1",
|
|
@@ -340,7 +340,7 @@
|
|
|
340
340
|
},
|
|
341
341
|
"devDependencies": {
|
|
342
342
|
"@faker-js/faker": "^9.0.1",
|
|
343
|
-
"@mittwald/flow-design-tokens": "^0.1.0-alpha.
|
|
343
|
+
"@mittwald/flow-design-tokens": "^0.1.0-alpha.272",
|
|
344
344
|
"@mittwald/react-use-promise": "^2.5.0",
|
|
345
345
|
"@nx/storybook": "^19.7.4",
|
|
346
346
|
"@storybook/addon-a11y": "^8.3.2",
|
|
@@ -418,5 +418,5 @@
|
|
|
418
418
|
"optional": true
|
|
419
419
|
}
|
|
420
420
|
},
|
|
421
|
-
"gitHead": "
|
|
421
|
+
"gitHead": "1bf74b18757552785ad57081d87353e3fe6c61b0"
|
|
422
422
|
}
|