@plitzi/sdk-shared 0.37.9 → 0.38.1
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/CHANGELOG.md +601 -0
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.mjs +3 -3
- package/dist/actions/triggerParams.mjs +7 -6
- package/dist/actions/validateDocument.d.ts +3 -0
- package/dist/actions/validateDocument.mjs +89 -88
- package/dist/authoring/elementCallbacks.d.ts +65 -0
- package/dist/authoring/elementCallbacks.mjs +72 -8
- package/dist/authoring/index.mjs +3 -3
- package/dist/builder/contexts/BuilderContext.d.ts +18 -7
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.mjs +2 -2
- package/dist/connectors/validateManifest.d.ts +3 -0
- package/dist/connectors/validateManifest.mjs +77 -76
- package/dist/dataSource/computed.mjs +25 -29
- package/dist/dataSource/globalSources.d.ts +15 -0
- package/dist/dataSource/globalSources.mjs +13 -0
- package/dist/dataSource/index.d.ts +2 -0
- package/dist/dataSource/index.mjs +8 -7
- package/dist/devTools/utils/PlitziConsole.d.ts +9 -0
- package/dist/devTools/utils/PlitziConsole.mjs +27 -7
- package/dist/flags/flagsCookie.d.ts +26 -0
- package/dist/flags/flagsCookie.mjs +20 -0
- package/dist/flags/index.d.ts +3 -0
- package/dist/flags/index.mjs +4 -0
- package/dist/flags/resolveFlags.d.ts +60 -0
- package/dist/flags/resolveFlags.mjs +38 -0
- package/dist/flags/schemaFlag.d.ts +11 -0
- package/dist/flags/schemaFlag.mjs +9 -0
- package/dist/flags/useFlagResolution.d.ts +13 -0
- package/dist/flags/useFlagResolution.mjs +43 -0
- package/dist/helpers/eventTarget.d.ts +10 -0
- package/dist/helpers/eventTarget.mjs +4 -0
- package/dist/helpers/images.d.ts +18 -0
- package/dist/helpers/images.mjs +13 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.mjs +21 -18
- package/dist/helpers/interval.d.ts +18 -0
- package/dist/helpers/interval.mjs +7 -0
- package/dist/helpers/isRecord.d.ts +2 -0
- package/dist/helpers/isRecord.mjs +4 -0
- package/dist/helpers/scroll.d.ts +42 -0
- package/dist/helpers/scroll.mjs +30 -0
- package/dist/helpers/twigWrapper/TemplateCache/TemplateCache.mjs +1 -1
- package/dist/helpers/twigWrapper/filters/filters.mjs +38 -2
- package/dist/history/describe.mjs +3 -1
- package/dist/history/diff.d.ts +1 -1
- package/dist/history/diff.mjs +1 -0
- package/dist/history/types.d.ts +1 -1
- package/dist/hooks/index.mjs +5 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +90 -76
- package/dist/navigation/routes.mjs +6 -4
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddSnippetMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddSnippetMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.d.ts +12 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceRemoveFlagMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceRemoveFlagMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceSetFlagMutation.d.ts +3 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceSetFlagMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/index.d.ts +5 -1
- package/dist/network/graphql/builder/Mutations/index.mjs +122 -116
- package/dist/network/graphql/builder/Queries/InitQuery.d.ts +3 -1
- package/dist/network/graphql/builder/Queries/InitQuery.mjs +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.d.ts +16 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.mjs +1 -1
- package/dist/network/graphql/builder/Queries/index.d.ts +1 -1
- package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +1 -1
- package/dist/network/graphql/sdk/Queries/InitQuery.mjs +1 -1
- package/dist/network/index.mjs +8 -7
- package/dist/network/spaceEvents.d.ts +12 -6
- package/dist/network/spaceEvents.mjs +153 -154
- package/dist/realtime/client.mjs +123 -95
- package/dist/realtime/topics.mjs +18 -17
- package/dist/schema/anchor.d.ts +8 -0
- package/dist/schema/anchor.mjs +4 -0
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.mjs +6 -4
- package/dist/schema/serverElements.d.ts +6 -2
- package/dist/schema/serverElements.mjs +17 -16
- package/dist/schema/snippet.d.ts +7 -0
- package/dist/schema/snippet.mjs +9 -0
- package/dist/schema/wire.d.ts +11 -0
- package/dist/schema/wire.mjs +27 -0
- package/dist/server/actions/useImagesSync.d.ts +9 -0
- package/dist/server/actions/useImagesSync.mjs +7 -0
- package/dist/server/rsc/refreshRsc.mjs +8 -8
- package/dist/source/snapshot.mjs +23 -22
- package/dist/state/paintedState.mjs +13 -12
- package/dist/state/runtimeStatePersist.mjs +50 -49
- package/dist/store/index.d.ts +45 -45
- package/dist/style/breakpoints.d.ts +11 -0
- package/dist/style/breakpoints.mjs +8 -0
- package/dist/style/displayModes.d.ts +5 -0
- package/dist/style/displayModes.mjs +8 -0
- package/dist/style/fontValidation.mjs +52 -51
- package/dist/style/fonts.d.ts +0 -12
- package/dist/style/fonts.mjs +11 -11
- package/dist/style/index.d.ts +4 -0
- package/dist/style/index.mjs +11 -7
- package/dist/style/layoutGrid.d.ts +30 -0
- package/dist/style/layoutGrid.mjs +33 -0
- package/dist/style/notifications.d.ts +52 -0
- package/dist/style/notifications.mjs +55 -0
- package/dist/style/snippetStyle.d.ts +23 -0
- package/dist/style/snippetStyle.mjs +32 -0
- package/dist/style/styleConstants.d.ts +7 -2
- package/dist/style/styleConstants.mjs +10 -0
- package/dist/style/styleStates.d.ts +11 -2
- package/dist/style/styleStates.mjs +12 -9
- package/dist/theme/ThemeProvider.mjs +20 -20
- package/dist/types/CommonTypes.d.ts +3 -0
- package/dist/types/DevToolsTypes.d.ts +29 -4
- package/dist/types/EventBridgeTypes.d.ts +2 -2
- package/dist/types/PluginTypes.d.ts +1 -1
- package/dist/types/ResourceTypes.d.ts +2 -2
- package/dist/types/SchemaTypes.d.ts +62 -3
- package/dist/types/ServerTypes.d.ts +47 -0
- package/dist/types/SnippetTypes.d.ts +28 -0
- package/dist/types/StoreTypes.d.ts +25 -0
- package/dist/types/StyleTypes.d.ts +2 -1
- package/dist/types/StyleTypes.mjs +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.mjs +2 -2
- package/dist/websockets/RTCodec.d.ts +1 -0
- package/dist/websockets/RTCodec.mjs +14 -12
- package/dist/websockets/index.mjs +2 -2
- package/package.json +115 -19
- package/tailwind.config.js +1 -6
- package/vite.config.ts +16 -4
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddTemplateMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddTemplateMutation.mjs +0 -4
- package/dist/types/TemplateTypes.d.ts +0 -20
- /package/dist/types/{TemplateTypes.mjs → SnippetTypes.mjs} +0 -0
package/dist/source/snapshot.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { isRecord as e } from "../helpers/isRecord.mjs";
|
|
1
2
|
//#region src/source/snapshot.ts
|
|
2
|
-
var
|
|
3
|
+
var t = 1, n = {
|
|
3
4
|
files: 2e3,
|
|
4
5
|
fileBytes: 4194304,
|
|
5
6
|
totalBytes: 25165824
|
|
6
|
-
},
|
|
7
|
+
}, r = ["plugin", "runtime"], i = [
|
|
7
8
|
/(^|\/)\.env(\.|$)/,
|
|
8
9
|
/\.(pem|key|p12|pfx)$/i,
|
|
9
10
|
/(^|\/)id_(rsa|dsa|ecdsa|ed25519)$/
|
|
10
|
-
],
|
|
11
|
+
], a = [
|
|
11
12
|
{
|
|
12
13
|
what: "a private key",
|
|
13
14
|
pattern: /-----BEGIN (?:[A-Z]+ )?PRIVATE KEY-----/
|
|
@@ -28,47 +29,47 @@ var e = 1, t = {
|
|
|
28
29
|
what: "a Slack token",
|
|
29
30
|
pattern: /\bxox[baprs]-[A-Za-z0-9-]{10,}\b/
|
|
30
31
|
}
|
|
31
|
-
],
|
|
32
|
+
], o = (e) => {
|
|
32
33
|
let t = e.split("/");
|
|
33
34
|
if (!e || e.startsWith("/") || /^[a-zA-Z]:/.test(e) || e.includes("\\")) return `"${e}" is not a path relative to the project, with forward slashes`;
|
|
34
35
|
if (t.some((e) => e === "" || e === "." || e === "..")) return `"${e}" climbs out of the project, or has an empty part`;
|
|
35
36
|
if (t.some((e) => e === "node_modules" || e === ".git")) return `"${e}" is in node_modules or .git: a package is a dependency, not a file of the project`;
|
|
36
|
-
if (
|
|
37
|
-
},
|
|
38
|
-
if (!
|
|
37
|
+
if (i.some((t) => t.test(e))) return `"${e}" is a file of credentials: they stay where the project runs, never in what Plitzi keeps`;
|
|
38
|
+
}, s = (e) => a.find(({ pattern: t }) => t.test(e))?.what, c = (e) => typeof e == "string" && r.some((t) => t === e), l = (e) => typeof e == "string" && /^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(e), u = (e) => Array.isArray(e) && e.length > 0 && e.every((e) => typeof e == "string"), d = (t) => e(t) && Object.values(t).every((e) => typeof e == "string"), f = (e) => Math.floor(e.length * 3 / 4) - (e.endsWith("==") ? 2 : +!!e.endsWith("=")), p = (t, i) => {
|
|
39
|
+
if (!e(t) || t.format !== 1) return {
|
|
39
40
|
ok: !1,
|
|
40
41
|
problems: ["Not a source snapshot of format 1"]
|
|
41
42
|
};
|
|
42
|
-
let { kind:
|
|
43
|
-
if (
|
|
43
|
+
let { kind: a, name: p, entries: m, files: h, dependencies: g } = t, _ = [];
|
|
44
|
+
if (c(a) || _.push(`Its kind is one of ${r.join(", ")}`), l(p) || _.push("Its name is a plugin type or \"runtime\": letters, digits, dashes and underscores"), !d(h) || !d(g)) return {
|
|
44
45
|
ok: !1,
|
|
45
46
|
problems: [..._, "Its files and dependencies are maps of text"]
|
|
46
47
|
};
|
|
47
|
-
|
|
48
|
+
u(m) ? m.filter((e) => !Object.hasOwn(h, e)).forEach((e) => _.push(`Its entry "${e}" is not among its files`)) : _.push("It names at least one entry");
|
|
48
49
|
let v = Object.keys(h);
|
|
49
|
-
v.length >
|
|
50
|
+
v.length > n.files && _.push(`It holds ${String(v.length)} files; a snapshot holds at most ${String(n.files)}`);
|
|
50
51
|
let y = 0;
|
|
51
52
|
return v.forEach((e) => {
|
|
52
|
-
let
|
|
53
|
-
if (
|
|
54
|
-
_.push(
|
|
53
|
+
let t = o(e);
|
|
54
|
+
if (t) {
|
|
55
|
+
_.push(t);
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
let
|
|
58
|
-
if (y +=
|
|
59
|
-
_.push(`"${e}" is ${(
|
|
58
|
+
let r = f(h[e]);
|
|
59
|
+
if (y += r, r > n.fileBytes) {
|
|
60
|
+
_.push(`"${e}" is ${(r / 1024 / 1024).toFixed(1)} MB; a file of source is at most 4 MB`);
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
let
|
|
63
|
-
|
|
64
|
-
}), y >
|
|
63
|
+
let a = s(i(h[e]));
|
|
64
|
+
a && _.push(`"${e}" holds ${a}: take it out of the code and give it to the project as a variable`);
|
|
65
|
+
}), y > n.totalBytes && _.push(`It holds ${(y / 1024 / 1024).toFixed(1)} MB of files; a snapshot holds at most 24 MB`), _.length > 0 || !c(a) || !l(p) || !u(m) ? {
|
|
65
66
|
ok: !1,
|
|
66
67
|
problems: _
|
|
67
68
|
} : {
|
|
68
69
|
ok: !0,
|
|
69
70
|
snapshot: {
|
|
70
71
|
format: 1,
|
|
71
|
-
kind:
|
|
72
|
+
kind: a,
|
|
72
73
|
name: p,
|
|
73
74
|
entries: m,
|
|
74
75
|
files: h,
|
|
@@ -77,4 +78,4 @@ var e = 1, t = {
|
|
|
77
78
|
};
|
|
78
79
|
};
|
|
79
80
|
//#endregion
|
|
80
|
-
export {
|
|
81
|
+
export { t as SOURCE_SNAPSHOT_FORMAT, n as SOURCE_SNAPSHOT_LIMITS, p as readSourceSnapshot, s as secretIn, o as sourcePathProblem };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isRecord as e } from "../helpers/isRecord.mjs";
|
|
2
|
+
import { cookieFromHeader as t, documentCookies as n } from "../helpers/cookies.mjs";
|
|
2
3
|
//#region src/state/paintedState.ts
|
|
3
|
-
var
|
|
4
|
+
var r = 3072, i = 31536e3, a = (e, t) => {
|
|
4
5
|
let n = t?.split(":")[1];
|
|
5
6
|
return n ? `plitzi_${e}_painted_${n}` : `plitzi_${e}_painted`;
|
|
6
|
-
},
|
|
7
|
-
let
|
|
8
|
-
if (
|
|
9
|
-
let
|
|
10
|
-
return
|
|
11
|
-
owner:
|
|
12
|
-
values:
|
|
7
|
+
}, o = (e) => new Set(Array.isArray(e?.paintedState) ? e.paintedState.filter((e) => typeof e == "string" && e !== "") : []), s = (t, n) => e(t) ? Object.fromEntries(Object.entries(t).filter(([e, t]) => n.has(e) && t !== void 0)) : {}, c = (n, r) => {
|
|
8
|
+
let i = t(n, r);
|
|
9
|
+
if (i !== void 0) try {
|
|
10
|
+
let t = JSON.parse(i);
|
|
11
|
+
return e(t) && typeof t.owner == "string" && e(t.values) ? {
|
|
12
|
+
owner: t.owner,
|
|
13
|
+
values: t.values
|
|
13
14
|
} : void 0;
|
|
14
15
|
} catch {
|
|
15
16
|
return;
|
|
@@ -20,11 +21,11 @@ var n = 3072, r = 31536e3, i = (e, t) => {
|
|
|
20
21
|
if (!r) return;
|
|
21
22
|
let i = s(r.values, n);
|
|
22
23
|
return Object.keys(i).length > 0 ? i : void 0;
|
|
23
|
-
}, u = (e) => c(
|
|
24
|
+
}, u = (e) => c(n(), e), d = (e, t) => {
|
|
24
25
|
let n = encodeURIComponent(JSON.stringify(t));
|
|
25
26
|
if (n.length > 3072) return f(e), "too-large";
|
|
26
27
|
try {
|
|
27
|
-
return document.cookie = `${e}=${n};path=/;max-age=${
|
|
28
|
+
return document.cookie = `${e}=${n};path=/;max-age=${i};SameSite=Lax`, "written";
|
|
28
29
|
} catch {
|
|
29
30
|
return "unavailable";
|
|
30
31
|
}
|
|
@@ -34,4 +35,4 @@ var n = 3072, r = 31536e3, i = (e, t) => {
|
|
|
34
35
|
} catch {}
|
|
35
36
|
};
|
|
36
37
|
//#endregion
|
|
37
|
-
export {
|
|
38
|
+
export { r as PAINTED_STATE_BUDGET, f as clearPaintedEntry, c as paintedEntryFromCookies, o as paintedKeys, a as paintedStateCookieName, l as paintedStateFor, s as pickPainted, u as readPaintedEntry, d as writePaintedEntry };
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { isRecord as e } from "../helpers/isRecord.mjs";
|
|
2
|
+
import { pConsole as t } from "../devTools/utils/PlitziConsole.mjs";
|
|
3
|
+
import { clearPaintedEntry as n, paintedKeys as r, paintedStateCookieName as i, pickPainted as a, readPaintedEntry as o, writePaintedEntry as s } from "./paintedState.mjs";
|
|
4
|
+
import { persistMiddleware as c } from "@plitzi/nexus";
|
|
4
5
|
//#region src/state/runtimeStatePersist.ts
|
|
5
|
-
var
|
|
6
|
+
var l = /* @__PURE__ */ new Set([
|
|
6
7
|
"init",
|
|
7
8
|
"initLoading",
|
|
8
9
|
"authenticating"
|
|
9
|
-
]),
|
|
10
|
+
]), u = (e) => {
|
|
10
11
|
let t = e.runtime?.sources.auth;
|
|
11
12
|
if (t) {
|
|
12
13
|
if (t.status === void 0) return { kind: "browser" };
|
|
13
|
-
if (!
|
|
14
|
+
if (!l.has(t.status)) return t.isAuthenticated && t.details?.id !== void 0 ? {
|
|
14
15
|
kind: "account",
|
|
15
16
|
id: String(t.details.id)
|
|
16
17
|
} : { kind: "guest" };
|
|
17
18
|
}
|
|
18
|
-
},
|
|
19
|
+
}, d = (e) => {
|
|
19
20
|
switch (e.kind) {
|
|
20
21
|
case "account": return `user:${e.id}`;
|
|
21
22
|
case "guest": return "guest";
|
|
22
23
|
case "browser": return "";
|
|
23
24
|
}
|
|
24
|
-
},
|
|
25
|
+
}, f = (e, t) => ({
|
|
25
26
|
getItem: (n) => {
|
|
26
27
|
let r = e.getItem(n);
|
|
27
28
|
if (r === null) return null;
|
|
@@ -36,39 +37,39 @@ var c = /* @__PURE__ */ new Set([
|
|
|
36
37
|
payload: r
|
|
37
38
|
})),
|
|
38
39
|
removeItem: (t) => e.removeItem(t)
|
|
39
|
-
}),
|
|
40
|
+
}), p = "runtime.state", m = (e, t) => Object.fromEntries(Object.entries(e).filter(([e]) => !t.has(e))), h = (t, n) => e(t) ? Object.fromEntries(Object.entries(t).filter(([e]) => n.has(e))) : {}, g = (e) => e.schema?.settings, _ = (e) => new Set((e?.transientState ?? []).filter((e) => typeof e == "string" && e !== "")), v = (e) => {
|
|
40
41
|
try {
|
|
41
42
|
return e === "session" ? globalThis.sessionStorage : globalThis.localStorage;
|
|
42
43
|
} catch {
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
|
-
}, y = (
|
|
46
|
-
let
|
|
46
|
+
}, y = (c, l) => {
|
|
47
|
+
let f = i(l, typeof window > "u" ? void 0 : window.location.host), p = !1, h;
|
|
47
48
|
return () => {
|
|
48
|
-
let
|
|
49
|
-
if (typeof document > "u" ||
|
|
50
|
-
let
|
|
51
|
-
if (!
|
|
52
|
-
let y =
|
|
53
|
-
if (!
|
|
54
|
-
|
|
55
|
-
let
|
|
56
|
-
if (
|
|
57
|
-
|
|
49
|
+
let i = c.getState();
|
|
50
|
+
if (typeof document > "u" || i.render?.isHydrating && !i.render.hydrated) return;
|
|
51
|
+
let l = g(i), _ = r(l), v = u(i);
|
|
52
|
+
if (!l?.keepState || _.size === 0 || v === void 0) return;
|
|
53
|
+
let y = d(v), b = i.runtime?.state;
|
|
54
|
+
if (!p) {
|
|
55
|
+
p = !0;
|
|
56
|
+
let t = o(f);
|
|
57
|
+
if (t && t.owner !== y && (n(f), e(b) && [..._].some((e) => e in b))) {
|
|
58
|
+
c.setState("runtime.state", m(b, _));
|
|
58
59
|
return;
|
|
59
60
|
}
|
|
60
|
-
h =
|
|
61
|
+
h = t?.owner === y ? JSON.stringify(a(t.values, _)) : void 0;
|
|
61
62
|
}
|
|
62
|
-
let x =
|
|
63
|
+
let x = a(b, _), S = JSON.stringify(x);
|
|
63
64
|
if (S !== h) {
|
|
64
65
|
if (h = S, Object.keys(x).length === 0) {
|
|
65
|
-
|
|
66
|
+
n(f);
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
+
s(f, {
|
|
69
70
|
owner: y,
|
|
70
71
|
values: x
|
|
71
|
-
}) === "too-large" &&
|
|
72
|
+
}) === "too-large" && t.warning("store", `settings.paintedState holds more than a cookie can carry — the first paint uses the space's defaults for ${[..._].join(", ")}. Declare only what the first paint shows.`, {
|
|
72
73
|
storeName: "runtime",
|
|
73
74
|
path: "runtime.state",
|
|
74
75
|
prev: void 0,
|
|
@@ -76,41 +77,41 @@ var c = /* @__PURE__ */ new Set([
|
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
};
|
|
79
|
-
}, b = (
|
|
80
|
-
let
|
|
81
|
-
key: `plitzi_${
|
|
82
|
-
paths: [
|
|
83
|
-
partializePath: (
|
|
84
|
-
mergePath: (
|
|
85
|
-
let
|
|
86
|
-
return
|
|
87
|
-
...m(
|
|
88
|
-
...h(
|
|
89
|
-
} :
|
|
80
|
+
}, b = (t) => {
|
|
81
|
+
let n = c({
|
|
82
|
+
key: `plitzi_${t}_state`,
|
|
83
|
+
paths: [p],
|
|
84
|
+
partializePath: (t, n, r) => e(n) ? m(n, _(g(r))) : n,
|
|
85
|
+
mergePath: (t, n, r, i) => {
|
|
86
|
+
let a = _(g(i));
|
|
87
|
+
return a.size > 0 && e(n) ? {
|
|
88
|
+
...m(n, a),
|
|
89
|
+
...h(r, a)
|
|
90
|
+
} : n;
|
|
90
91
|
},
|
|
91
92
|
storage: (e) => {
|
|
92
93
|
let { render: t } = e;
|
|
93
94
|
if (t?.isHydrating && !t.hydrated) return !1;
|
|
94
|
-
let n = g(e), r =
|
|
95
|
+
let n = g(e), r = u(e);
|
|
95
96
|
if (!n?.keepState || r === void 0) return !1;
|
|
96
97
|
let i = v(n.stateStorage === "sessionStorage" ? "session" : "local");
|
|
97
|
-
return i ?
|
|
98
|
+
return i ? f(i, d(r)) : !1;
|
|
98
99
|
}
|
|
99
100
|
});
|
|
100
|
-
return (
|
|
101
|
-
let
|
|
101
|
+
return (i) => {
|
|
102
|
+
let a = n(i), o = i.getState().runtime?.state, s = u(i.getState()), c = y(i, t);
|
|
102
103
|
return {
|
|
103
|
-
...
|
|
104
|
-
onChange: (
|
|
105
|
-
let
|
|
106
|
-
if (
|
|
107
|
-
let
|
|
108
|
-
|
|
104
|
+
...a,
|
|
105
|
+
onChange: (t) => {
|
|
106
|
+
let n = s, l = u(i.getState());
|
|
107
|
+
if (l !== void 0 && (s = l), n?.kind === "account" && l !== void 0 && d(l) !== d(n)) {
|
|
108
|
+
let t = e(o) ? m(o, r(g(i.getState()))) : o;
|
|
109
|
+
i.setState("runtime.state", t);
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
+
a?.onChange?.(t), c();
|
|
111
112
|
}
|
|
112
113
|
};
|
|
113
114
|
};
|
|
114
115
|
};
|
|
115
116
|
//#endregion
|
|
116
|
-
export { b as runtimeStatePersist,
|
|
117
|
+
export { b as runtimeStatePersist, u as stateOwner };
|