@plitzi/sdk-elements 0.36.1 → 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.
- package/CHANGELOG.md +14 -0
- package/dist/Element/ElementParentContext.d.ts +13 -0
- package/dist/Element/ElementParentContext.mjs +6 -0
- package/dist/Element/LayoutBody.d.ts +21 -0
- package/dist/Element/LayoutBody.mjs +24 -0
- package/dist/Element/hocs/withElement.mjs +104 -87
- package/dist/Element/hooks/useElementInternal.mjs +24 -24
- package/dist/Element/hooks/useInternalItems.mjs +42 -39
- package/dist/Element/hooks/useLayoutChain.d.ts +10 -0
- package/dist/Element/hooks/useLayoutChain.mjs +20 -0
- package/dist/Element/hooks/useRootElementInteractions.mjs +45 -44
- package/dist/dataSource/GlobalSources.mjs +60 -59
- package/dist/dataSource/pathFields.d.ts +7 -0
- package/dist/dataSource/pathFields.mjs +8 -0
- package/dist/elements/advanced/Reference/Reference.mjs +93 -89
- package/dist/elements/advanced/Reference/declaration.d.ts +1 -1
- package/dist/elements/advanced/Reference/index.d.ts +1 -1
- package/dist/elements/declarations/index.d.ts +3 -1
- package/dist/elements/internal/LayoutContainer/LayoutContainer.d.ts +6 -0
- package/dist/elements/internal/LayoutContainer/LayoutContainer.mjs +31 -23
- package/dist/elements/internal/LayoutContainer/Settings.d.ts +4 -1
- package/dist/elements/internal/LayoutContainer/Settings.mjs +78 -64
- package/dist/elements/internal/LayoutContainer/declaration.d.ts +2 -0
- package/dist/elements/internal/LayoutContainer/index.d.ts +2 -0
- package/dist/elements/internal/LayoutPicker/LayoutPicker.d.ts +10 -0
- package/dist/elements/internal/LayoutPicker/LayoutPicker.mjs +35 -0
- package/dist/elements/internal/LayoutPicker/index.d.ts +3 -0
- package/dist/elements/internal/LayoutPicker/index.mjs +5 -0
- package/dist/elements/internal/Page/Page.mjs +49 -48
- package/dist/elements/internal/Page/Settings.mjs +101 -119
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +58 -66
- package/dist/elements/provider/ApiContainer/declaration.mjs +1 -1
- package/dist/elements/provider/ApiContainer/hooks/useApi.d.ts +8 -0
- package/dist/elements/provider/ApiContainer/hooks/useApi.mjs +52 -48
- package/dist/elements/structure/DialogContainer/DialogContainer.mjs +17 -25
- package/dist/elements/structure/ModalContainer/ModalContainer.mjs +15 -23
- package/dist/index.d.ts +3 -1
- package/package.json +38 -10
|
@@ -1,73 +1,87 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import a from "
|
|
5
|
-
import o from "@plitzi/plitzi-ui/
|
|
1
|
+
import e from "../LayoutPicker/index.mjs";
|
|
2
|
+
import { useCallback as t, useMemo as n } from "react";
|
|
3
|
+
import { useCommonStore as r } from "@plitzi/sdk-shared/store";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import o from "@plitzi/plitzi-ui/Select";
|
|
6
|
+
import s from "@plitzi/plitzi-ui/Select2";
|
|
6
7
|
//#region src/elements/internal/LayoutContainer/Settings.tsx
|
|
7
|
-
var
|
|
8
|
-
let [
|
|
8
|
+
var c = ({ id: c, layout: l = "", layoutContainer: u = "", subType: d = "div", folder: f = "", onUpdate: p }) => {
|
|
9
|
+
let [m] = r("schema.pageFolders"), h = t((e) => p?.("subType", e), [p]), g = t((e) => p?.("folder", e?.value ?? ""), [p]), _ = n(() => [{
|
|
9
10
|
value: "",
|
|
10
11
|
label: "None"
|
|
11
|
-
}, ...
|
|
12
|
+
}, ...m.map(({ id: e, name: t }) => ({
|
|
12
13
|
value: e,
|
|
13
14
|
label: t
|
|
14
|
-
}))], [
|
|
15
|
-
return /* @__PURE__ */
|
|
15
|
+
}))], [m]);
|
|
16
|
+
return /* @__PURE__ */ a("div", {
|
|
16
17
|
className: "flex flex-col gap-4 py-2",
|
|
17
|
-
children: [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ a(o, {
|
|
20
|
+
value: d,
|
|
21
|
+
label: "Container Tag",
|
|
22
|
+
onChange: h,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ i("option", {
|
|
25
|
+
value: "div",
|
|
26
|
+
children: "Div"
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ i("option", {
|
|
29
|
+
value: "header",
|
|
30
|
+
children: "Header"
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ i("option", {
|
|
33
|
+
value: "footer",
|
|
34
|
+
children: "Footer"
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ i("option", {
|
|
37
|
+
value: "nav",
|
|
38
|
+
children: "Nav"
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ i("option", {
|
|
41
|
+
value: "main",
|
|
42
|
+
children: "Main"
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ i("option", {
|
|
45
|
+
value: "section",
|
|
46
|
+
children: "Section"
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ i("option", {
|
|
49
|
+
value: "article",
|
|
50
|
+
children: "Article"
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ i("option", {
|
|
53
|
+
value: "aside",
|
|
54
|
+
children: "Aside"
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ i("option", {
|
|
57
|
+
value: "address",
|
|
58
|
+
children: "Address"
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ i("option", {
|
|
61
|
+
value: "figure",
|
|
62
|
+
children: "Figure"
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ i(s, {
|
|
67
|
+
label: "Folder",
|
|
68
|
+
value: f,
|
|
69
|
+
options: _,
|
|
70
|
+
placeholder: "None",
|
|
71
|
+
onChange: g
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ i(e, {
|
|
74
|
+
layout: l,
|
|
75
|
+
layoutContainer: u,
|
|
76
|
+
ownLayoutId: c,
|
|
77
|
+
onUpdate: p
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ i("span", {
|
|
80
|
+
className: "text-xs text-gray-500 dark:text-zinc-400",
|
|
81
|
+
children: "A layout can sit inside another one: pages using this layout are shown inside it, and it inside the one picked here — the outer shell stays mounted while moving between pages that share it."
|
|
82
|
+
})
|
|
83
|
+
]
|
|
70
84
|
});
|
|
71
85
|
};
|
|
72
86
|
//#endregion
|
|
73
|
-
export {
|
|
87
|
+
export { c as default };
|
|
@@ -52,6 +52,8 @@ declare const declaration: {
|
|
|
52
52
|
readonly settings: {};
|
|
53
53
|
};
|
|
54
54
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
55
|
+
layout?: string | undefined;
|
|
55
56
|
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | undefined;
|
|
57
|
+
layoutContainer?: string | undefined;
|
|
56
58
|
}>>;
|
|
57
59
|
export default declaration;
|
|
@@ -51,6 +51,8 @@ declare const LayoutContainer: {
|
|
|
51
51
|
readonly settings: {};
|
|
52
52
|
};
|
|
53
53
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
54
|
+
layout?: string | undefined;
|
|
54
55
|
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | undefined;
|
|
56
|
+
layoutContainer?: string | undefined;
|
|
55
57
|
}>>;
|
|
56
58
|
export default LayoutContainer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type LayoutPickerProps = {
|
|
2
|
+
layout?: string;
|
|
3
|
+
layoutContainer?: string;
|
|
4
|
+
/** The layout being edited, when it is one: it cannot sit in itself, nor in a shell that already sits in it. */
|
|
5
|
+
ownLayoutId?: string;
|
|
6
|
+
onUpdate?: (key: string, value: string) => void;
|
|
7
|
+
};
|
|
8
|
+
/** Which shell something is rendered inside, and the container in that shell its content goes into. */
|
|
9
|
+
declare const LayoutPicker: ({ layout, layoutContainer, ownLayoutId, onUpdate }: LayoutPickerProps) => import("react").JSX.Element;
|
|
10
|
+
export default LayoutPicker;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useCallback as e, useMemo as t } from "react";
|
|
2
|
+
import { useCommonStore as n } from "@plitzi/sdk-shared/store";
|
|
3
|
+
import { get as r } from "@plitzi/plitzi-ui/helpers";
|
|
4
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
import { resolveLayoutChain as s } from "@plitzi/sdk-shared/schema/layoutChain";
|
|
6
|
+
import c from "@plitzi/plitzi-ui/Select";
|
|
7
|
+
//#region src/elements/internal/LayoutPicker/LayoutPicker.tsx
|
|
8
|
+
var l = ({ layout: l = "", layoutContainer: u = "", ownLayoutId: d, onUpdate: f }) => {
|
|
9
|
+
let [p] = n("schema.flat"), m = t(() => Object.values(p).filter((e) => r(e, "definition.type", "") === "layoutContainer" && (!d || !s((e) => p[e], e.id, "").some((e) => e.layout === d))), [p, d]), h = t(() => l ? Object.values(p).filter((e) => r(e, "definition.type", "") === "container" && r(e, "definition.rootId", "") === l) : [], [p, l]), g = e((e) => {
|
|
10
|
+
f?.("layout", e), f?.("layoutContainer", "");
|
|
11
|
+
}, [f]), _ = e((e) => f?.("layoutContainer", e), [f]);
|
|
12
|
+
return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(c, {
|
|
13
|
+
value: l,
|
|
14
|
+
placeholder: "None",
|
|
15
|
+
label: "Layout",
|
|
16
|
+
onChange: g,
|
|
17
|
+
size: "xs",
|
|
18
|
+
children: m.map(({ id: e, definition: { label: t } }) => /* @__PURE__ */ a("option", {
|
|
19
|
+
value: e,
|
|
20
|
+
children: t
|
|
21
|
+
}, e))
|
|
22
|
+
}), l && /* @__PURE__ */ a(c, {
|
|
23
|
+
value: u,
|
|
24
|
+
placeholder: "None",
|
|
25
|
+
label: "Layout Container Body",
|
|
26
|
+
onChange: _,
|
|
27
|
+
size: "xs",
|
|
28
|
+
children: h.map(({ id: e, definition: { label: t } }) => /* @__PURE__ */ a("option", {
|
|
29
|
+
value: e,
|
|
30
|
+
children: t
|
|
31
|
+
}, e))
|
|
32
|
+
})] });
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { l as default };
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
import e from "../../../Element/
|
|
2
|
-
import t from "../../../Element/
|
|
3
|
-
import
|
|
4
|
-
import r from "
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
1
|
+
import e from "../../../Element/LayoutBody.mjs";
|
|
2
|
+
import t from "../../../Element/hocs/withElement.mjs";
|
|
3
|
+
import n from "../../../Element/hooks/useElement.mjs";
|
|
4
|
+
import { RootElement as r } from "../../../Element/RootElement.mjs";
|
|
5
|
+
import i from "../LayoutContainer/index.mjs";
|
|
6
|
+
import a from "../../../Element/hooks/useLayoutChain.mjs";
|
|
7
|
+
import { use as o, useEffect as s, useMemo as c } from "react";
|
|
8
|
+
import l from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
9
|
+
import { useSdkStore as u } from "@plitzi/sdk-shared/store";
|
|
10
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
|
+
import p from "clsx";
|
|
12
|
+
import { Helmet as m } from "@dr.pogodin/react-helmet";
|
|
11
13
|
//#region src/elements/internal/Page/Page.tsx
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
var h = (e) => e.map((e) => ({
|
|
15
|
+
...e,
|
|
16
|
+
plitziElementLayout: {
|
|
17
|
+
containerId: e.slot,
|
|
18
|
+
rootId: e.slot,
|
|
19
|
+
type: "layout"
|
|
20
|
+
}
|
|
21
|
+
})), g = (t, n, r) => t.reduce((t, { layout: r, slot: a, plitziElementLayout: o }) => /* @__PURE__ */ d(e, {
|
|
22
|
+
body: t,
|
|
23
|
+
children: /* @__PURE__ */ d(i, { internalProps: {
|
|
24
|
+
id: r,
|
|
25
|
+
rootId: n,
|
|
26
|
+
plitziElementLayout: o
|
|
27
|
+
} })
|
|
28
|
+
}, a), r), _ = ({ ref: e, seoEnabled: t = !1, seoPageTitle: i = "Title", seoPageDescription: _ = "Description", className: v = "", layout: y = "", layoutContainer: b = "", children: x }) => {
|
|
29
|
+
let { id: S } = n(), { settings: { previewMode: C }, contexts: { InteractionsContext: w } } = l(), { interactionsManager: T } = o(w), [[E, D]] = u(["navigation.routeParams", "navigation.queryParams"]), O = a(y, b), k = c(() => h(O), [O]), A = c(() => g(k, S, x), [
|
|
30
|
+
k,
|
|
31
|
+
S,
|
|
32
|
+
x
|
|
33
|
+
]), j = c(() => ({ onPageLoad: {
|
|
29
34
|
action: "onPageLoad",
|
|
30
35
|
title: "On Page Load",
|
|
31
36
|
type: "trigger",
|
|
@@ -36,35 +41,31 @@ var p = ({ ref: e, seoEnabled: p = !1, seoPageTitle: m = "Title", seoPageDescrip
|
|
|
36
41
|
queryParams: ""
|
|
37
42
|
}
|
|
38
43
|
} }), []);
|
|
39
|
-
return
|
|
44
|
+
return s(() => {
|
|
40
45
|
let e = !1;
|
|
41
46
|
return queueMicrotask(() => {
|
|
42
|
-
e ||
|
|
43
|
-
pageId:
|
|
44
|
-
routeParams:
|
|
45
|
-
queryParams:
|
|
47
|
+
e || T.interactionTrigger(S, "onPageLoad", {
|
|
48
|
+
pageId: S,
|
|
49
|
+
routeParams: E,
|
|
50
|
+
queryParams: D
|
|
46
51
|
});
|
|
47
52
|
}), () => {
|
|
48
53
|
e = !0;
|
|
49
54
|
};
|
|
50
55
|
}, [
|
|
51
|
-
|
|
52
|
-
C,
|
|
56
|
+
S,
|
|
53
57
|
T,
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
D,
|
|
59
|
+
E
|
|
60
|
+
]), /* @__PURE__ */ f(r, {
|
|
56
61
|
ref: e,
|
|
57
|
-
className:
|
|
58
|
-
interactionTriggers:
|
|
59
|
-
children: [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
})] }),
|
|
64
|
-
_ && /* @__PURE__ */ l(r, { internalProps: E }, v || _),
|
|
65
|
-
!_ && y
|
|
66
|
-
]
|
|
62
|
+
className: p("plitzi-component__page", v),
|
|
63
|
+
interactionTriggers: j,
|
|
64
|
+
children: [t && C && /* @__PURE__ */ f(m, { children: [!!i && /* @__PURE__ */ d("title", { children: i }), !!_ && /* @__PURE__ */ d("meta", {
|
|
65
|
+
name: "description",
|
|
66
|
+
content: _
|
|
67
|
+
})] }), A]
|
|
67
68
|
});
|
|
68
|
-
},
|
|
69
|
+
}, v = t(_);
|
|
69
70
|
//#endregion
|
|
70
|
-
export {
|
|
71
|
+
export { _ as Page, v as default };
|