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