@plitzi/sdk-elements 0.36.0 → 0.36.2

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 (38) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/Element/ElementParentContext.d.ts +13 -0
  3. package/dist/Element/ElementParentContext.mjs +6 -0
  4. package/dist/Element/LayoutBody.d.ts +21 -0
  5. package/dist/Element/LayoutBody.mjs +24 -0
  6. package/dist/Element/hocs/withElement.mjs +104 -87
  7. package/dist/Element/hooks/useElementInternal.mjs +24 -24
  8. package/dist/Element/hooks/useInternalItems.mjs +42 -39
  9. package/dist/Element/hooks/useLayoutChain.d.ts +10 -0
  10. package/dist/Element/hooks/useLayoutChain.mjs +20 -0
  11. package/dist/Element/hooks/useRootElementInteractions.mjs +45 -44
  12. package/dist/dataSource/GlobalSources.mjs +60 -59
  13. package/dist/dataSource/pathFields.d.ts +7 -0
  14. package/dist/dataSource/pathFields.mjs +8 -0
  15. package/dist/elements/advanced/Reference/Reference.mjs +93 -89
  16. package/dist/elements/advanced/Reference/declaration.d.ts +1 -1
  17. package/dist/elements/advanced/Reference/index.d.ts +1 -1
  18. package/dist/elements/declarations/index.d.ts +3 -1
  19. package/dist/elements/internal/LayoutContainer/LayoutContainer.d.ts +6 -0
  20. package/dist/elements/internal/LayoutContainer/LayoutContainer.mjs +31 -23
  21. package/dist/elements/internal/LayoutContainer/Settings.d.ts +4 -1
  22. package/dist/elements/internal/LayoutContainer/Settings.mjs +78 -64
  23. package/dist/elements/internal/LayoutContainer/declaration.d.ts +2 -0
  24. package/dist/elements/internal/LayoutContainer/index.d.ts +2 -0
  25. package/dist/elements/internal/LayoutPicker/LayoutPicker.d.ts +10 -0
  26. package/dist/elements/internal/LayoutPicker/LayoutPicker.mjs +35 -0
  27. package/dist/elements/internal/LayoutPicker/index.d.ts +3 -0
  28. package/dist/elements/internal/LayoutPicker/index.mjs +5 -0
  29. package/dist/elements/internal/Page/Page.mjs +49 -48
  30. package/dist/elements/internal/Page/Settings.mjs +101 -119
  31. package/dist/elements/provider/ApiContainer/ApiContainer.mjs +58 -66
  32. package/dist/elements/provider/ApiContainer/declaration.mjs +1 -1
  33. package/dist/elements/provider/ApiContainer/hooks/useApi.d.ts +8 -0
  34. package/dist/elements/provider/ApiContainer/hooks/useApi.mjs +52 -48
  35. package/dist/elements/structure/DialogContainer/DialogContainer.mjs +17 -25
  36. package/dist/elements/structure/ModalContainer/ModalContainer.mjs +15 -23
  37. package/dist/index.d.ts +3 -1
  38. package/package.json +38 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @plitzi/sdk-elements
2
2
 
3
+ ## 0.36.2
4
+
5
+ ### Patch Changes
6
+
7
+ - v0.36.2
8
+ - Updated dependencies
9
+ - @plitzi/sdk-auth@0.36.2
10
+ - @plitzi/sdk-dev-tools@0.36.2
11
+ - @plitzi/sdk-event-bridge@0.36.2
12
+ - @plitzi/sdk-interactions@0.36.2
13
+ - @plitzi/sdk-navigation@0.36.2
14
+ - @plitzi/sdk-schema@0.36.2
15
+ - @plitzi/sdk-shared@0.36.2
16
+
17
+ ## 0.36.1
18
+
19
+ ### Patch Changes
20
+
21
+ - v0.36.1
22
+ - Updated dependencies
23
+ - @plitzi/sdk-auth@0.36.1
24
+ - @plitzi/sdk-dev-tools@0.36.1
25
+ - @plitzi/sdk-event-bridge@0.36.1
26
+ - @plitzi/sdk-interactions@0.36.1
27
+ - @plitzi/sdk-navigation@0.36.1
28
+ - @plitzi/sdk-schema@0.36.1
29
+ - @plitzi/sdk-shared@0.36.1
30
+
3
31
  ## 0.36.0
4
32
 
5
33
  ### Minor Changes
@@ -0,0 +1,13 @@
1
+ /**
2
+ * What an element needs from the element around it: whether that one is on screen, and its tracing identity.
3
+ *
4
+ * Kept apart from `ElementContext` on purpose. That context carries the whole element — its attributes, its state,
5
+ * its style — so a parent whose state changed (a nav item lighting up on a navigation) re-rendered every child
6
+ * reading it, for two values that had not moved. Children read this; only the element itself reads the full one.
7
+ */
8
+ export type ElementParentContextValue = {
9
+ visible: boolean;
10
+ traceId: string;
11
+ };
12
+ declare const ElementParentContext: import('react').Context<ElementParentContextValue | undefined>;
13
+ export default ElementParentContext;
@@ -0,0 +1,6 @@
1
+ import { createContext as e } from "react";
2
+ //#region src/Element/ElementParentContext.ts
3
+ var t = e(void 0);
4
+ t.displayName = "ElementParentContext";
5
+ //#endregion
6
+ export { t as default };
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ export type LayoutBodyProps = {
3
+ /** What the slot of the shell below renders: the page's content, or the shell nested inside this one. */
4
+ body: ReactNode;
5
+ children: ReactNode;
6
+ };
7
+ /**
8
+ * Hands a shell's slot its body without handing it to every element of the shell.
9
+ *
10
+ * The body used to travel inside `plitziElementLayout`, which every element of the shell receives as a prop. The body
11
+ * is a new node on every navigation — it IS the page — so the whole shell rendered again each time, sidebar and all,
12
+ * to show the one container that holds the page. Here the value every element reads never changes; only the slot
13
+ * subscribes to what it holds.
14
+ *
15
+ * `current` is the body as of the first render, which is what the server renders and what hydration reads. Later
16
+ * bodies are announced after the commit, and the slot renders them before the browser paints.
17
+ */
18
+ declare const LayoutBody: ({ body, children }: LayoutBodyProps) => import("react").JSX.Element;
19
+ /** The body of the nearest shell, for the element that is its slot; nothing, and no subscription, for any other. */
20
+ export declare const useLayoutBody: (isSlot: boolean) => ReactNode;
21
+ export default LayoutBody;
@@ -0,0 +1,24 @@
1
+ import { createContext as e, use as t, useCallback as n, useLayoutEffect as r, useState as i, useSyncExternalStore as a } from "react";
2
+ import { jsx as o } from "react/jsx-runtime";
3
+ //#region src/Element/LayoutBody.tsx
4
+ var s = e(void 0);
5
+ s.displayName = "LayoutBodyContext";
6
+ var c = () => void 0, l = ({ body: e, children: t }) => {
7
+ let [n] = i(() => ({
8
+ current: e,
9
+ listeners: /* @__PURE__ */ new Set()
10
+ }));
11
+ return r(() => {
12
+ n.current !== e && (n.current = e, n.listeners.forEach((e) => e()));
13
+ }, [e, n]), /* @__PURE__ */ o(s, {
14
+ value: n,
15
+ children: t
16
+ });
17
+ }, u = (e) => {
18
+ let r = t(s), i = n((t) => !e || !r ? c : (r.listeners.add(t), () => {
19
+ r.listeners.delete(t);
20
+ }), [e, r]), o = n(() => e && r ? r.current : void 0, [e, r]);
21
+ return a(i, o, o);
22
+ };
23
+ //#endregion
24
+ export { l as default, u as useLayoutBody };
@@ -1,71 +1,85 @@
1
1
  import e from "../ElementContext.mjs";
2
- import { isVisible as t } from "../helpers/isVisible.mjs";
3
- import { omitKeys as n } from "../helpers/omitKeys.mjs";
4
- import r from "../hooks/useElementInternal.mjs";
5
- import i from "@plitzi/plitzi-ui/ErrorBoundary";
6
- import { Profiler as a, use as o, useId as s, useMemo as c, useRef as l } from "react";
7
- import u from "@plitzi/sdk-event-bridge/hooks/useEventBridge";
8
- import d from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
9
- import { useCommonStore as f } from "@plitzi/sdk-shared/store";
10
- import { diffProps as p, tracingCollector as m } from "@plitzi/sdk-shared/store/tracing";
11
- import { jsx as h } from "react/jsx-runtime";
2
+ import t from "../ElementParentContext.mjs";
3
+ import { isVisible as n } from "../helpers/isVisible.mjs";
4
+ import { omitKeys as r } from "../helpers/omitKeys.mjs";
5
+ import i from "../hooks/useElementInternal.mjs";
6
+ import a from "@plitzi/plitzi-ui/ErrorBoundary";
7
+ import { Profiler as o, use as s, useEffect as c, useId as l, useMemo as u, useRef as d } from "react";
8
+ import f from "@plitzi/sdk-event-bridge/hooks/useEventBridge";
9
+ import p from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
10
+ import { useCommonStore as m } from "@plitzi/sdk-shared/store";
11
+ import { diffProps as h, tracingCollector as g } from "@plitzi/sdk-shared/store/tracing";
12
+ import { jsx as _ } from "react/jsx-runtime";
12
13
  //#region src/Element/hocs/withElement.tsx
13
- var g = (g) => {
14
- let _ = g.displayName || g.name, v = (_) => {
15
- let v = l(void 0), y = l(void 0), { id: b, rootId: x } = _.internalProps, S = o(e), C = S?.visible ?? !0, w = `${b}${s()}`, T = S?.traceId ?? w, E = c(() => ({
16
- id: b,
17
- rootId: x,
18
- visible: C,
19
- traceId: T,
14
+ var v = (v) => {
15
+ let y = v.displayName || v.name, b = (y) => {
16
+ let b = d(void 0), x = d(void 0), { id: S, rootId: C } = y.internalProps, w = s(t), T = w?.visible ?? !0, E = `${S}${l()}`, D = w?.traceId ?? E, O = u(() => ({
17
+ id: S,
18
+ rootId: C,
19
+ visible: T,
20
+ traceId: D,
20
21
  plitziJsxSkipHOC: !0
21
22
  }), [
22
- b,
23
- x,
23
+ S,
24
24
  C,
25
- T
26
- ]);
27
- if (_.plitziJsxSkipHOC) return /* @__PURE__ */ h(e, {
28
- value: E,
29
- children: /* @__PURE__ */ h(g, { ..._ })
25
+ T,
26
+ D
27
+ ]), k = u(() => ({
28
+ visible: T,
29
+ traceId: D
30
+ }), [T, D]);
31
+ if (y.plitziJsxSkipHOC) return /* @__PURE__ */ _(t, {
32
+ value: k,
33
+ children: /* @__PURE__ */ _(e, {
34
+ value: O,
35
+ children: /* @__PURE__ */ _(v, { ...y })
36
+ })
30
37
  });
31
- let { settings: { previewMode: D, debugMode: O }, root: { baseElementId: k } } = d(), [A] = f(`schema.flat.${b}`);
32
- if (!A) throw Error(`Element ${b} not found, Page ${k}`);
33
- let { internalProps: j, customProps: M, children: N } = r({
34
- element: A,
35
- internalProps: _.internalProps,
36
- children: _.children,
37
- previewMode: D,
38
- parentVisible: C
39
- }), { attributes: P, definition: F, style: I, plitziElementLayout: L, elementState: R, setElementState: z } = j, B = c(() => ({ [`${b}_setState`]: z }), [b, z]);
40
- u("element", B);
41
- let V = C && t(R.visibility), H = c(() => ({
42
- id: b,
43
- rootId: x,
44
- visible: V,
45
- traceId: w,
46
- attributes: P,
47
- definition: F,
48
- plitziElementLayout: L,
49
- style: I,
50
- elementState: R,
51
- setElementState: z
38
+ let { settings: { previewMode: A, debugMode: j }, root: { baseElementId: M } } = p();
39
+ c(() => {
40
+ if (j) return g.markMounted(E), () => g.markUnmounted(E);
41
+ }, [j, E]);
42
+ let [N] = m(`schema.flat.${S}`);
43
+ if (!N) throw Error(`Element ${S} not found, Page ${M}`);
44
+ let { internalProps: P, customProps: F, children: I } = i({
45
+ element: N,
46
+ internalProps: y.internalProps,
47
+ children: y.children,
48
+ previewMode: A,
49
+ parentVisible: T
50
+ }), { attributes: L, definition: R, style: z, plitziElementLayout: B, elementState: V, setElementState: H } = P, U = u(() => ({ [`${S}_setState`]: H }), [S, H]);
51
+ f("element", U);
52
+ let W = T && n(V.visibility), G = u(() => ({
53
+ id: S,
54
+ rootId: C,
55
+ visible: W,
56
+ traceId: E,
57
+ attributes: L,
58
+ definition: R,
59
+ plitziElementLayout: B,
60
+ style: z,
61
+ elementState: V,
62
+ setElementState: H
52
63
  }), [
53
- P,
54
- F,
55
- R,
56
- b,
57
64
  L,
58
- x,
59
- I,
60
- z,
65
+ R,
61
66
  V,
62
- w
63
- ]), U = c(() => {
67
+ S,
68
+ B,
69
+ C,
70
+ z,
71
+ H,
72
+ W,
73
+ E
74
+ ]), K = u(() => ({
75
+ visible: W,
76
+ traceId: E
77
+ }), [W, E]), q = u(() => {
64
78
  let e = {
65
- ...j.attributes,
66
- ..._.extraProps,
67
- ...M,
68
- ...n(_, [
79
+ ...P.attributes,
80
+ ...y.extraProps,
81
+ ...F,
82
+ ...r(y, [
69
83
  "plitziJsxSkipHOC",
70
84
  "internalProps",
71
85
  "className",
@@ -73,34 +87,37 @@ var g = (g) => {
73
87
  "extraProps"
74
88
  ])
75
89
  };
76
- return N && (e = {
90
+ return I && (e = {
77
91
  ...e,
78
- children: N
79
- }), /* @__PURE__ */ h(i, { children: /* @__PURE__ */ h(g, {
92
+ children: I
93
+ }), /* @__PURE__ */ _(a, { children: /* @__PURE__ */ _(v, {
80
94
  ...e,
81
- ref: v
95
+ ref: b
82
96
  }) });
83
97
  }, [
84
- j.attributes,
85
- _,
86
- M,
87
- N
88
- ]), W = /* @__PURE__ */ h(e, {
89
- value: H,
90
- children: U
98
+ P.attributes,
99
+ y,
100
+ F,
101
+ I
102
+ ]), J = /* @__PURE__ */ _(t, {
103
+ value: K,
104
+ children: /* @__PURE__ */ _(e, {
105
+ value: G,
106
+ children: q
107
+ })
91
108
  });
92
- if (O) {
93
- m.linkParent(w, S?.traceId, b);
109
+ if (j) {
110
+ g.linkParent(E, w?.traceId, S);
94
111
  let e = {
95
- attributes: P,
96
- definition: F,
97
- style: I,
98
- elementState: R,
99
- plitziElementLayout: L,
100
- children: N,
101
- ...M,
102
- ..._.extraProps,
103
- ...n(_, [
112
+ attributes: L,
113
+ definition: R,
114
+ style: z,
115
+ elementState: V,
116
+ plitziElementLayout: B,
117
+ children: I,
118
+ ...F,
119
+ ...y.extraProps,
120
+ ...r(y, [
104
121
  "plitziJsxSkipHOC",
105
122
  "internalProps",
106
123
  "className",
@@ -108,15 +125,15 @@ var g = (g) => {
108
125
  "extraProps"
109
126
  ])
110
127
  };
111
- return m.recordProps(w, p(y.current, e)), y.current = e, /* @__PURE__ */ h(a, {
112
- id: w,
113
- onRender: m.onRender,
114
- children: W
128
+ return g.recordProps(E, h(x.current, e)), x.current = e, /* @__PURE__ */ _(o, {
129
+ id: E,
130
+ onRender: g.onRender,
131
+ children: J
115
132
  });
116
133
  }
117
- return W;
134
+ return J;
118
135
  };
119
- return v.displayName = `withElement(${_})`, v;
136
+ return b.displayName = `withElement(${y})`, b;
120
137
  };
121
138
  //#endregion
122
- export { g as default };
139
+ export { v as default };
@@ -70,39 +70,39 @@ var f = (e, n, r = {}, i = {}) => {
70
70
  },
71
71
  style: o
72
72
  };
73
- }, p = ({ element: a, children: c, internalProps: l, previewMode: u = !1, parentVisible: d = !0 }) => {
74
- let { id: p } = l, { state: m, setElementState: h } = r({
75
- id: p,
73
+ }, p = ["variables"], m = (e) => Object.values(e ?? {}).some((e) => typeof e == "string" && u(e)), h = ({ element: a, children: c, internalProps: l, previewMode: u = !1, parentVisible: d = !0 }) => {
74
+ let { id: h } = l, { state: g, setElementState: _ } = r({
75
+ id: h,
76
76
  bindings: a.definition.bindings,
77
77
  previewMode: u
78
- }), [[g, _, v]] = s([
78
+ }), v = o(() => m(a.attributes) || m(l.attributes), [a.attributes, l.attributes]), [[y, b, x]] = s([
79
79
  "navigation.routeParams",
80
80
  "navigation.queryParams",
81
81
  "navigation.origin"
82
- ]), y = n({
82
+ ], { enabled: v }), S = n({
83
83
  bindings: a.definition.bindings,
84
- sources: ["variables"]
85
- }), b = o(() => ({
84
+ sources: v ? p : void 0
85
+ }), C = o(() => ({
86
86
  ...f(a, l, {
87
- ...y,
88
- routeParams: g,
89
- queryParams: _,
90
- origin: v
91
- }, m),
92
- setElementState: h
87
+ ...S,
88
+ routeParams: y,
89
+ queryParams: b,
90
+ origin: x
91
+ }, g),
92
+ setElementState: _
93
93
  }), [
94
94
  a,
95
95
  l,
96
+ S,
96
97
  y,
98
+ b,
99
+ x,
97
100
  g,
98
- _,
99
- v,
100
- m,
101
- h
101
+ _
102
102
  ]);
103
103
  return {
104
- internalProps: b,
105
- customProps: t(b, [
104
+ internalProps: C,
105
+ customProps: t(C, [
106
106
  "id",
107
107
  "rootId",
108
108
  "plitziElementLayout",
@@ -113,14 +113,14 @@ var f = (e, n, r = {}, i = {}) => {
113
113
  "setElementState"
114
114
  ]),
115
115
  children: i({
116
- id: p,
117
- definition: b.definition,
118
- plitziElementLayout: b.plitziElementLayout,
116
+ id: h,
117
+ definition: C.definition,
118
+ plitziElementLayout: C.plitziElementLayout,
119
119
  children: c,
120
120
  previewMode: u,
121
- visible: d && e(b.elementState.visibility)
121
+ visible: d && e(C.elementState.visibility)
122
122
  })
123
123
  };
124
124
  };
125
125
  //#endregion
126
- export { p as default, f as getProps };
126
+ export { h as default, f as getProps };
@@ -1,60 +1,63 @@
1
1
  import e, { getRemoteSettings as t } from "../helpers/pluginSelector.mjs";
2
- import n from "../ServerStaticShell.mjs";
3
- import { Fragment as r, isValidElement as i, use as a, useMemo as o, useRef as s, useSyncExternalStore as c } from "react";
4
- import { useCommonStore as l } from "@plitzi/sdk-shared/store";
5
- import { get as u } from "@plitzi/plitzi-ui/helpers";
6
- import { usePlitziServiceContext as d } from "@plitzi/sdk-shared";
7
- import f from "@plitzi/sdk-shared/elements/ComponentContext";
8
- import { jsx as p } from "react/jsx-runtime";
2
+ import { useLayoutBody as n } from "../LayoutBody.mjs";
3
+ import r from "../ServerStaticShell.mjs";
4
+ import { Fragment as i, isValidElement as a, use as o, useMemo as s, useRef as c, useSyncExternalStore as l } from "react";
5
+ import { useCommonStore as u } from "@plitzi/sdk-shared/store";
6
+ import { get as d } from "@plitzi/plitzi-ui/helpers";
7
+ import { usePlitziServiceContext as f } from "@plitzi/sdk-shared";
8
+ import p from "@plitzi/sdk-shared/elements/ComponentContext";
9
+ import { jsx as m } from "react/jsx-runtime";
9
10
  //#region src/Element/hooks/useInternalItems.tsx
10
- var m = typeof window > "u", h = "#layout-body", g = "#children", _ = () => () => {}, v = () => !0, y = () => !1, b = ({ id: b, definition: x, plitziElementLayout: S, children: C, previewMode: w, visible: T = !0 }) => {
11
- let [[E, D]] = l(["schema.flat", "rsc.enabled"], { mode: "mount" }), { components: O, componentDefinitions: k } = a(f), { contexts: { PluginsContext: A } } = d(), { plugins: j } = a(A), { items: M } = x, N = k.current[x.type], P = x.loadStrategy ?? N?.definition.loadStrategy ?? "eager", F = S || C || M?.length, I = s(!1);
12
- T && (I.current = !0);
13
- let L = !w || P === "eager" || T || P === "lazy" && I.current, R = S ? `${S.type}:${S.rootId}:${S.containerId}` : "", z = c(_, v, y);
14
- return o(() => {
15
- if (!F || !L) return;
16
- let a = (M ?? []).filter((e) => {
17
- let t = E[e];
11
+ var h = typeof window > "u", g = "#layout-body", _ = "#children", v = () => () => {}, y = () => !0, b = () => !1, x = ({ id: x, definition: S, plitziElementLayout: C, children: w, previewMode: T, visible: E = !0 }) => {
12
+ let [[D, O]] = u(["schema.flat", "rsc.enabled"], { mode: "mount" }), { components: k, componentDefinitions: A } = o(p), { contexts: { PluginsContext: j } } = f(), { plugins: M } = o(j), { items: N } = S, P = A.current[S.type], F = S.loadStrategy ?? P?.definition.loadStrategy ?? "eager", I = C || w || N?.length, L = c(!1);
13
+ E && (L.current = !0);
14
+ let R = !T || F === "eager" || E || F === "lazy" && L.current, z = C ? `${C.type}:${C.rootId}:${C.containerId}` : "", B = l(v, y, b), V = C?.containerId === x, H = n(V);
15
+ return s(() => {
16
+ if (!I || !R) return;
17
+ let n = (N ?? []).filter((e) => {
18
+ let t = D[e];
18
19
  if (!t) return !1;
19
- if (!w || !D) return !0;
20
+ if (!T || !O) return !0;
20
21
  let n = t.definition.runtime ?? "shared";
21
- return !(!z && n === "client");
22
- }).map((r) => {
23
- let { rootId: i, type: a, runtime: o } = u(E, `${r}.definition`, {}), s = u(S, "rootId", i), c = a in O.current || !!t({
22
+ return !(!B && n === "client");
23
+ }).map((n) => {
24
+ let { rootId: i, type: a, runtime: o } = d(D, `${n}.definition`, {}), s = d(C, "rootId", i), c = a in k.current || !!t({
24
25
  type: a,
25
- plugins: j
26
+ plugins: M
26
27
  }), l = e({
27
- key: !w && S ? `${r}_${R}` : r,
28
- plitziElementLayout: S,
28
+ key: !T && C ? `${n}_${z}` : n,
29
+ plitziElementLayout: C,
29
30
  type: a,
30
31
  internalProps: {
31
- id: r,
32
+ id: n,
32
33
  rootId: s
33
34
  },
34
- components: O.current,
35
- plugins: j
35
+ components: k.current,
36
+ plugins: M
36
37
  });
37
- return D && o === "server" && !m && w && !(z && c) ? /* @__PURE__ */ p(n, {
38
- id: r,
38
+ return O && o === "server" && !h && T && !(B && c) ? /* @__PURE__ */ m(r, {
39
+ id: n,
39
40
  children: l
40
- }, r) : l;
41
+ }, n) : l;
41
42
  });
42
- if (S?.containerId === b && a.push(/* @__PURE__ */ p(r, { children: S.bodyChildren }, h)), Array.isArray(C) ? a.push(...C.filter(i)) : i(C) && a.push(/* @__PURE__ */ p(r, { children: C }, g)), M) return a.length === 1 ? a[0] : a;
43
+ if (V && n.push(/* @__PURE__ */ m(i, { children: H }, g)), Array.isArray(w) ? n.push(...w.filter(a)) : a(w) && n.push(/* @__PURE__ */ m(i, { children: w }, _)), N) return n.length === 1 ? n[0] : n;
43
44
  }, [
44
- F,
45
- L,
46
- M,
47
- S,
45
+ I,
46
+ R,
47
+ N,
48
48
  C,
49
- E,
50
49
  w,
51
50
  D,
52
- z,
53
- R,
51
+ T,
54
52
  O,
55
- j,
56
- b
53
+ B,
54
+ z,
55
+ k,
56
+ M,
57
+ x,
58
+ V,
59
+ H
57
60
  ]);
58
61
  };
59
62
  //#endregion
60
- export { b as default };
63
+ export { x as default };
@@ -0,0 +1,10 @@
1
+ import { LayoutLink } from '@plitzi/sdk-shared/schema/layoutChain';
2
+ /**
3
+ * The shells around a page, innermost first — see `resolveLayoutChain`.
4
+ *
5
+ * Read from the store rather than from a subscription to the whole schema's value: a page re-rendered on every edit
6
+ * anywhere in the document would be the builder rebuilding the page on each keystroke. The chain is compared with the
7
+ * previous one, so the page renders again only when a shell in it changes which shell it sits in.
8
+ */
9
+ declare const useLayoutChain: (layout: string, layoutContainer: string) => LayoutLink[];
10
+ export default useLayoutChain;
@@ -0,0 +1,20 @@
1
+ import { useCallback as e, useContext as t, useRef as n, useSyncExternalStore as r } from "react";
2
+ import { StoreContext as i } from "@plitzi/nexus/react";
3
+ import { resolveLayoutChain as a } from "@plitzi/sdk-shared/schema/layoutChain";
4
+ //#region src/Element/hooks/useLayoutChain.ts
5
+ var o = [], s = (e, t) => e.length === t.length && e.every((e, n) => e.layout === t[n].layout && e.slot === t[n].slot), c = (e) => typeof e == "object" && !!e && "definition" in e && "attributes" in e, l = (e) => (t) => {
6
+ let n = e(`schema.flat.${t}`);
7
+ return c(n) ? n : void 0;
8
+ }, u = (c, u) => {
9
+ let d = t(i), f = n(o), p = e((e) => d ? d.subscribePath("schema.flat", e) : () => void 0, [d]), m = e(() => {
10
+ let e = c && d ? a(l((e) => d.getPath(e)), c, u) : o;
11
+ return s(f.current, e) || (f.current = e), f.current;
12
+ }, [
13
+ d,
14
+ c,
15
+ u
16
+ ]);
17
+ return r(p, m, m);
18
+ };
19
+ //#endregion
20
+ export { u as default };