@plitzi/sdk-elements 0.39.8 → 0.39.9

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @plitzi/sdk-elements
2
2
 
3
+ ## 0.39.9
4
+
5
+ ### Patch Changes
6
+
7
+ - f04c646: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
8
+ `@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
9
+ - Updated dependencies [f04c646]
10
+ - @plitzi/sdk-auth@0.39.9
11
+ - @plitzi/sdk-event-bridge@0.39.9
12
+ - @plitzi/sdk-interactions@0.39.9
13
+ - @plitzi/sdk-navigation@0.39.9
14
+ - @plitzi/sdk-schema@0.39.9
15
+ - @plitzi/sdk-shared@0.39.9
16
+
3
17
  ## 0.39.8
4
18
 
5
19
  ### Patch Changes
@@ -1,26 +1,22 @@
1
1
  import { ReactNode } from 'react';
2
2
  /**
3
- * Renders a runtime:'server' element as frozen server HTML.
3
+ * Keeps a `runtime: 'server'` element this browser cannot draw as the server's own HTML, frozen.
4
4
  *
5
- * During the initial client render (hydrateRoot), React calls useState initializers
6
- * synchronously before it has modified the DOM. We use this window to read the
7
- * server-rendered element from the DOM via its data-plitzi-id attribute, capture its
8
- * tag, attributes, and innerHTML, then render it back via dangerouslySetInnerHTML.
5
+ * During the initial client render (hydrateRoot), React calls useState initializers synchronously before it has
6
+ * modified the DOM. We use this window to read the server-rendered element from the DOM via its `data-rsc-id`
7
+ * attribute, capture its tag, attributes, and innerHTML, then render it back via dangerouslySetInnerHTML: React
8
+ * hydrates the snapshot element without touching its children.
9
9
  *
10
- * The actual plugin component is never mounted in the browser, so no useEffect or
11
- * useState from the plugin ever runs. React hydrates the snapshot element without
12
- * touching its children (dangerouslySetInnerHTML takes ownership of innerHTML).
10
+ * `frozen` is whether there is anything to freeze for: true for an element with no component in this browser — a
11
+ * plugin registered on the server alone — which has nothing else to show, for the life of the page. Every other
12
+ * server element is `children`, drawn here from the payload the server drew it with and hydrated over its markup like
13
+ * any element: frozen first and swapped for itself once hydration was over, its DOM was rebuilt on every load.
13
14
  *
14
- * When there is nothing to freeze, `children` — the element itself — is rendered instead. That is not the
15
- * hydration case, where the server always sent the markup; it is the SPA one: a route change mounts a page whose
16
- * server elements were never in this document, and freezing an element against markup that does not exist used to
17
- * render nothing at all. The element then resolves the way it does anywhere else, from the payload `useRscSync`
18
- * fetches for the new location.
15
+ * When there is nothing to freeze against, `children` is rendered too. That is the SPA case: a route change mounts a
16
+ * page whose server elements were never in this document, and freezing an element against markup that does not exist
17
+ * used to render nothing at all.
19
18
  *
20
- * `frozen` is whether the snapshot is still what is shown: true while hydrating, false once the element can take
21
- * over. The shell itself stays where it is either way, so the element under it keeps its identity — an element that
22
- * had nothing to freeze (a provider that draws no markup of its own) is the same element before hydration ends and
23
- * after, and nothing under it mounts twice.
19
+ * The shell itself stays where it is either way, so the element under it keeps its identity.
24
20
  */
25
21
  declare const ServerStaticShell: ({ id, frozen, children }: {
26
22
  id: string;
@@ -40,10 +40,10 @@ var _ = typeof window > "u", v = "#layout-body", y = "#children", b = () => () =
40
40
  let n = t.definition.runtime ?? "shared";
41
41
  return !(!f && n === "client");
42
42
  }).map(({ itemId: n, el: i }) => {
43
- let { rootId: a, type: o, runtime: s } = i.definition, l = c ? c.rootId : a, p = o in x.current || !!t({
43
+ let { rootId: a, type: o, runtime: s } = i.definition, l = c ? c.rootId : a, f = o in x.current || !!t({
44
44
  type: o,
45
45
  plugins: S
46
- }), h = e({
46
+ }), p = e({
47
47
  key: !u && c ? `${n}_${m}` : n,
48
48
  type: o,
49
49
  internalProps: k(i, n, l, c),
@@ -52,9 +52,9 @@ var _ = typeof window > "u", v = "#layout-body", y = "#children", b = () => () =
52
52
  });
53
53
  return d && s === "server" && !_ && u ? /* @__PURE__ */ g(r, {
54
54
  id: n,
55
- frozen: !(f && p),
56
- children: h
57
- }, n) : h;
55
+ frozen: !f,
56
+ children: p
57
+ }, n) : p;
58
58
  });
59
59
  if (h && C.push(/* @__PURE__ */ g(i, { children: b }, v)), Array.isArray(l) ? C.push(...l.filter(a)) : a(l) && C.push(/* @__PURE__ */ g(i, { children: l }, y)), n) return C.length === 1 ? C[0] : C;
60
60
  }, j = _ ? ({ id: e, store: t, flags: r, definition: i, plitziElementLayout: a, children: s, previewMode: c, visible: l = !0 }) => {
@@ -79,7 +79,7 @@ var _ = typeof window > "u", v = "#layout-body", y = "#children", b = () => () =
79
79
  T(g.current, h) || (g.current = h);
80
80
  let _ = g.current, v = t.getPath("rsc.enabled") === !0, y = o(m), O = d === !0 ? y : void 0, k = O !== void 0, j = _.map((e) => e?.definition.type ?? "").join("|"), M = () => O ? C(j, O.get()) : "", N = l(O ? O.subscribe : b, M, M), { components: P, componentDefinitions: F, plugins: I } = w(O), L = a || u || p?.length, R = c(!1);
81
81
  f && (R.current = !0);
82
- let z = E(i, F, d, f, R.current), B = D(a), V = d === !0 && v && _.some((e) => e?.definition.runtime === "client" || e?.definition.runtime === "server"), H = l(b, V ? x : S, S), U = a?.slots.includes(e) ?? !1, W = n(U ? e : void 0), G = c({
82
+ let z = E(i, F, d, f, R.current), B = D(a), V = d === !0 && v && _.some((e) => e?.definition.runtime === "client"), H = l(b, V ? x : S, S), U = a?.slots.includes(e) ?? !1, W = n(U ? e : void 0), G = c({
83
83
  components: P,
84
84
  plugins: I
85
85
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-elements",
3
- "version": "0.39.8",
3
+ "version": "0.39.9",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist"
@@ -35,12 +35,12 @@
35
35
  "@dr.pogodin/react-helmet": "^3.3.2",
36
36
  "@plitzi/nexus": "^1.5.1",
37
37
  "@plitzi/plitzi-ui": "^1.6.40",
38
- "@plitzi/sdk-auth": "0.39.8",
39
- "@plitzi/sdk-event-bridge": "0.39.8",
40
- "@plitzi/sdk-interactions": "0.39.8",
41
- "@plitzi/sdk-navigation": "0.39.8",
42
- "@plitzi/sdk-schema": "0.39.8",
43
- "@plitzi/sdk-shared": "0.39.8",
38
+ "@plitzi/sdk-auth": "0.39.9",
39
+ "@plitzi/sdk-event-bridge": "0.39.9",
40
+ "@plitzi/sdk-interactions": "0.39.9",
41
+ "@plitzi/sdk-navigation": "0.39.9",
42
+ "@plitzi/sdk-schema": "0.39.9",
43
+ "@plitzi/sdk-shared": "0.39.9",
44
44
  "clsx": "^2.1.1",
45
45
  "dompurify": "^3.4.18",
46
46
  "immer": "^11.2.10",