@plitzi/sdk-elements 0.38.9 → 0.38.10
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 +88 -0
- package/dist/Element/hooks/useElementInternal.mjs +67 -59
- package/dist/elements/advanced/BlockHtml/index.mjs +3 -3
- package/dist/elements/advanced/BlockJsx/index.mjs +3 -3
- package/dist/elements/advanced/Custom/index.mjs +3 -3
- package/dist/elements/basic/Button/index.mjs +3 -3
- package/dist/elements/basic/ThemeToggle/ThemeToggle.mjs +13 -13
- package/dist/elements/declarations/index.d.ts +22 -16
- package/dist/elements/declarations/index.mjs +6 -6
- package/dist/elements/form/Form/Form.mjs +19 -19
- package/dist/elements/form/FormControl/FormControl.mjs +10 -10
- package/dist/elements/form/FormControl/declaration.mjs +1 -1
- package/dist/elements/internal/NotFound/index.mjs +3 -3
- package/dist/elements/internal/Page/Page.d.ts +5 -0
- package/dist/elements/internal/Page/Page.mjs +26 -25
- package/dist/elements/internal/Page/PageHead.d.ts +12 -0
- package/dist/elements/internal/Page/PageHead.mjs +29 -0
- package/dist/elements/internal/Page/declaration.d.ts +2 -0
- package/dist/elements/internal/Page/declaration.mjs +5 -0
- package/dist/elements/internal/Page/index.d.ts +2 -0
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +187 -187
- package/dist/elements/provider/ApiContainer/declaration.d.ts +10 -9
- package/dist/elements/provider/ApiContainer/declaration.mjs +1 -0
- package/dist/elements/provider/ApiContainer/index.d.ts +10 -9
- package/dist/elements/provider/Channel/Channel.mjs +15 -15
- package/dist/elements/provider/Channel/declaration.d.ts +1 -1
- package/dist/elements/provider/Channel/index.d.ts +1 -1
- package/dist/elements/structure/Carousel/Carousel.mjs +72 -72
- package/dist/elements/structure/Carousel/CarouselTrack/index.mjs +3 -3
- package/dist/elements/structure/Carousel/declaration.d.ts +1 -1
- package/dist/elements/structure/Carousel/index.d.ts +1 -1
- package/dist/elements/structure/Container/Container.mjs +8 -8
- package/dist/elements/structure/DialogContainer/DialogContainer.mjs +14 -14
- package/dist/elements/structure/DialogContainer/declaration.d.ts +1 -2
- package/dist/elements/structure/DialogContainer/declaration.mjs +1 -2
- package/dist/elements/structure/DialogContainer/index.d.ts +1 -2
- package/dist/elements/structure/List/modes/ListControlled/ListControlled.mjs +8 -8
- package/dist/elements/structure/ModalContainer/ModalContainer.mjs +16 -16
- package/dist/elements/structure/ModalContainer/declaration.d.ts +2 -3
- package/dist/elements/structure/ModalContainer/declaration.mjs +2 -3
- package/dist/elements/structure/ModalContainer/index.d.ts +2 -3
- package/dist/elements/structure/Pagination/Pagination.mjs +10 -10
- package/dist/index.d.ts +17 -16
- package/package.json +11 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "../../../Element/
|
|
3
|
-
import
|
|
4
|
-
import r from "
|
|
1
|
+
import e from "./declaration.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
5
|
import { VISUALLY_HIDDEN as i } from "./components/visuallyHidden.mjs";
|
|
6
6
|
import a from "./components/Label.mjs";
|
|
7
7
|
import { isChecked as o } from "./helpers/isChecked.mjs";
|
|
@@ -17,8 +17,8 @@ import { createStoreHook as ee } from "@plitzi/nexus/react";
|
|
|
17
17
|
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
18
18
|
import y from "clsx";
|
|
19
19
|
//#region src/elements/form/FormControl/FormControl.tsx
|
|
20
|
-
var b = ({ ref:
|
|
21
|
-
let { id: I, rootId: L, visible: R, definition: { styleSelectors: z } } =
|
|
20
|
+
var b = ({ ref: t, className: s = "", subType: b = "text", name: x = "", label: S = "Label", hideLabel: C = !1, placeholder: w = "", autoComplete: T = !0, autoFocus: E = !1, disabled: D = !1, options: O = [], required: k = !1, maxLength: A = 0, readOnly: j = !1, value: M = "", error: N = "", handleChange: P, handleValidate: F }) => {
|
|
21
|
+
let { id: I, rootId: L, visible: R, definition: { styleSelectors: z } } = n(), { settings: { previewMode: B }, contexts: { InteractionsContext: V } } = g(), { interactionsManager: H } = p(V), { useStore: U } = ee(), [W] = U("runtime.sources.form"), G = m((e) => {
|
|
22
22
|
if (P?.(e), !B) return;
|
|
23
23
|
let { target: t } = e, n = t instanceof HTMLInputElement && t.type === "checkbox" ? t.checked : t.value;
|
|
24
24
|
H.interactionTrigger(I, "onChange", {
|
|
@@ -52,9 +52,9 @@ var b = ({ ref: e, className: s = "", subType: b = "text", name: x = "", label:
|
|
|
52
52
|
x,
|
|
53
53
|
K,
|
|
54
54
|
q
|
|
55
|
-
]), /* @__PURE__ */ v(
|
|
56
|
-
ref:
|
|
57
|
-
interactionTriggers:
|
|
55
|
+
]), /* @__PURE__ */ v(r, {
|
|
56
|
+
ref: t,
|
|
57
|
+
interactionTriggers: e.triggers,
|
|
58
58
|
className: y("plitzi-component__form-control", {
|
|
59
59
|
"form-control--invalid": N && B,
|
|
60
60
|
[`plitzi-component__form-control-${b}`]: b
|
|
@@ -161,6 +161,6 @@ var b = ({ ref: e, className: s = "", subType: b = "text", name: x = "", label:
|
|
|
161
161
|
})
|
|
162
162
|
]
|
|
163
163
|
});
|
|
164
|
-
}, x =
|
|
164
|
+
}, x = t(s(b));
|
|
165
165
|
//#endregion
|
|
166
166
|
export { b as FormControl, x as default };
|
|
@@ -202,7 +202,7 @@ var n = {
|
|
|
202
202
|
definition: {
|
|
203
203
|
label: "Form Control",
|
|
204
204
|
type: "formControl",
|
|
205
|
-
description: "A single labelled input (text/select/checkbox/… per its subType) inside a form; captures one field of user input. A select offers its `options`: `[{ label, value }, …]` — the text shown, and what the field takes. A `switch` is a checkbox announced and drawn as an on/off switch (`role=\"switch\"`), for a setting that applies at once; both hold `true`/`false`, and a `defaultValue` of `\"true\"` starts them on. Its slots: `label`, `requiredMark` (the `*` that ends the label of a required field), `input` (the box a typed field or a select is drawn in — a textarea, checkbox or switch is its own box), `field` (the `<input>` or `<select>` inside that box), `icon` (the show/hide button of a password) and `error`. The thumb of a switch is no element a class reaches: the class on its `input` slot sets `--plitzi-switch-thumb` (off), `--plitzi-switch-thumb-checked` (on, white by default) and `--plitzi-switch-thumb-shadow`.",
|
|
205
|
+
description: "A single labelled input (text/select/checkbox/… per its subType) inside a form; captures one field of user input. Optional unless `required: true`, as an HTML field is: a `requiredMessage` alone requires nothing. A select offers its `options`: `[{ label, value }, …]` — the text shown, and what the field takes. A `switch` is a checkbox announced and drawn as an on/off switch (`role=\"switch\"`), for a setting that applies at once; both hold `true`/`false`, and a `defaultValue` of `\"true\"` starts them on. Its slots: `label`, `requiredMark` (the `*` that ends the label of a required field), `input` (the box a typed field or a select is drawn in — a textarea, checkbox or switch is its own box), `field` (the `<input>` or `<select>` inside that box), `icon` (the show/hide button of a password) and `error`. The box is ringed (`2px solid currentColor`) while the field inside has keyboard focus: restyle it with a `focus-within` state on the `input` slot — the box never takes `focus` itself. The thumb of a switch is no element a class reaches: the class on its `input` slot sets `--plitzi-switch-thumb` (off), `--plitzi-switch-thumb-checked` (on, white by default) and `--plitzi-switch-thumb-shadow`.",
|
|
206
206
|
bindings: {},
|
|
207
207
|
styleSelectors: {
|
|
208
208
|
base: "",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import e from "./
|
|
2
|
-
import t from "./
|
|
1
|
+
import e from "./declaration.mjs";
|
|
2
|
+
import t from "./NotFound.mjs";
|
|
3
3
|
//#region src/elements/internal/NotFound/index.ts
|
|
4
|
-
var n = Object.assign(
|
|
4
|
+
var n = Object.assign(t, e);
|
|
5
5
|
//#endregion
|
|
6
6
|
export { n as NotFound, n as default };
|
|
@@ -4,6 +4,11 @@ export type PageProps = {
|
|
|
4
4
|
seoEnabled?: boolean;
|
|
5
5
|
seoPageTitle?: string;
|
|
6
6
|
seoPageDescription?: string;
|
|
7
|
+
/**
|
|
8
|
+
* A template over the page's server providers and `navigation` that says this address shows nothing — a record that
|
|
9
|
+
* is not there: the page server sends it with status 404, rendered as written. Read there only (`serverTemplates`).
|
|
10
|
+
*/
|
|
11
|
+
notFound?: string;
|
|
7
12
|
className?: string;
|
|
8
13
|
layout?: string;
|
|
9
14
|
layoutContainer?: string;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import e from "../../../Element/LayoutBody.mjs";
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "../../../Element/
|
|
4
|
-
import
|
|
5
|
-
import i from "
|
|
6
|
-
import a from "
|
|
2
|
+
import t from "./declaration.mjs";
|
|
3
|
+
import n from "../../../Element/hocs/withElement.mjs";
|
|
4
|
+
import r from "../../../Element/hooks/useElement.mjs";
|
|
5
|
+
import { RootElement as i } from "../../../Element/RootElement.mjs";
|
|
6
|
+
import a from "../LayoutContainer/index.mjs";
|
|
7
7
|
import o from "../../../Element/hooks/useLayoutChain.mjs";
|
|
8
|
-
import
|
|
9
|
-
import u from "
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import h from "
|
|
13
|
-
import
|
|
8
|
+
import s from "./PageHead.mjs";
|
|
9
|
+
import { use as c, useEffect as l, useMemo as u } from "react";
|
|
10
|
+
import d from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
11
|
+
import { useRenderSettings as f, useSdkStore as p } from "@plitzi/sdk-shared/store";
|
|
12
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
13
|
+
import g from "clsx";
|
|
14
14
|
//#region src/elements/internal/Page/Page.tsx
|
|
15
15
|
var _ = (e) => e.map((e) => ({
|
|
16
16
|
...e,
|
|
@@ -19,20 +19,20 @@ var _ = (e) => e.map((e) => ({
|
|
|
19
19
|
rootId: e.slot,
|
|
20
20
|
type: "layout"
|
|
21
21
|
}
|
|
22
|
-
})), v = (t, n, r) => t.reduce((t, { layout: r, slot:
|
|
23
|
-
bodies: { [
|
|
24
|
-
children: /* @__PURE__ */
|
|
22
|
+
})), v = (t, n, r) => t.reduce((t, { layout: r, slot: i, plitziElementLayout: o }) => /* @__PURE__ */ m(e, {
|
|
23
|
+
bodies: { [i]: t },
|
|
24
|
+
children: /* @__PURE__ */ m(a, { internalProps: {
|
|
25
25
|
id: r,
|
|
26
26
|
rootId: n,
|
|
27
27
|
plitziElementLayout: o
|
|
28
28
|
} })
|
|
29
|
-
},
|
|
30
|
-
let { id: w } =
|
|
29
|
+
}, i), r), y = ({ ref: e, seoEnabled: n = !1, seoPageTitle: a = "Title", seoPageDescription: y = "Description", className: b = "", layout: x = "", layoutContainer: S = "", children: C }) => {
|
|
30
|
+
let { id: w } = r(), { settings: { previewMode: T }, contexts: { InteractionsContext: E } } = d(), { interactionsManager: D } = c(E), { ownsHead: O } = f(), [[k, A]] = p(["navigation.routeParams", "navigation.queryParams"]), j = o(x, S), M = u(() => _(j), [j]), N = u(() => v(M, w, C), [
|
|
31
31
|
M,
|
|
32
32
|
w,
|
|
33
33
|
C
|
|
34
34
|
]);
|
|
35
|
-
return
|
|
35
|
+
return l(() => {
|
|
36
36
|
let e = !1;
|
|
37
37
|
return queueMicrotask(() => {
|
|
38
38
|
e || D.interactionTrigger(w, "onPageLoad", {
|
|
@@ -48,15 +48,16 @@ var _ = (e) => e.map((e) => ({
|
|
|
48
48
|
D,
|
|
49
49
|
A,
|
|
50
50
|
k
|
|
51
|
-
]), /* @__PURE__ */
|
|
51
|
+
]), /* @__PURE__ */ h(i, {
|
|
52
52
|
ref: e,
|
|
53
|
-
className:
|
|
54
|
-
interactionTriggers:
|
|
55
|
-
children: [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
className: g("plitzi-component__page", b),
|
|
54
|
+
interactionTriggers: t.triggers,
|
|
55
|
+
children: [n && T && O && /* @__PURE__ */ m(s, {
|
|
56
|
+
pageId: w,
|
|
57
|
+
title: a,
|
|
58
|
+
description: y
|
|
59
|
+
}), N]
|
|
59
60
|
});
|
|
60
|
-
}, b =
|
|
61
|
+
}, b = n(y);
|
|
61
62
|
//#endregion
|
|
62
63
|
export { y as Page, b as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type PageHeadProps = {
|
|
2
|
+
pageId: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The page's title and description in the head: its words, or its templates read against the answers of its server
|
|
8
|
+
* providers — `rsc.data`, what the server wrote the HTML's head from, and what a navigation fetches before it lands —
|
|
9
|
+
* so the tab says the record a detail page shows, on arrival and after every move.
|
|
10
|
+
*/
|
|
11
|
+
declare const PageHead: ({ pageId, title, description }: PageHeadProps) => import('react').JSX.Element;
|
|
12
|
+
export default PageHead;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useMemo as e } from "react";
|
|
2
|
+
import { useCommonStore as t } from "@plitzi/sdk-shared/store";
|
|
3
|
+
import { isRecord as n } from "@plitzi/sdk-shared/helpers/isRecord";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { Helmet as a } from "@dr.pogodin/react-helmet";
|
|
6
|
+
import { collectServerElements as o, pageSeoText as s, pageServerContext as c } from "@plitzi/sdk-shared/schema/serverElements";
|
|
7
|
+
//#region src/elements/internal/Page/PageHead.tsx
|
|
8
|
+
var l = ({ pageId: l, title: u, description: d }) => {
|
|
9
|
+
let [[f, p, m, h]] = t([
|
|
10
|
+
"schema.flat",
|
|
11
|
+
"rsc.data",
|
|
12
|
+
"navigation.routeParams",
|
|
13
|
+
"navigation.queryParams"
|
|
14
|
+
]), g = e(() => n(f) ? o({ flat: f }, l) : [], [f, l]), _ = e(() => c(g, p ?? {}, {
|
|
15
|
+
routeParams: m,
|
|
16
|
+
queryParams: h
|
|
17
|
+
}), [
|
|
18
|
+
g,
|
|
19
|
+
p,
|
|
20
|
+
m,
|
|
21
|
+
h
|
|
22
|
+
]), v = s(u, _), y = s(d, _);
|
|
23
|
+
return /* @__PURE__ */ i(a, { children: [!!v && /* @__PURE__ */ r("title", { children: v }), !!y && /* @__PURE__ */ r("meta", {
|
|
24
|
+
name: "description",
|
|
25
|
+
content: y
|
|
26
|
+
})] });
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { l as default };
|
|
@@ -4,6 +4,7 @@ import { AuthorableAttributes } from '@plitzi/sdk-shared/authoring/declare';
|
|
|
4
4
|
export type PageAttributes = AuthorableAttributes<PageProps>;
|
|
5
5
|
declare const declaration: {
|
|
6
6
|
readonly type: "page";
|
|
7
|
+
readonly serverTemplates: readonly ["seoPageTitle", "seoPageDescription", "notFound"];
|
|
7
8
|
readonly triggers: {
|
|
8
9
|
readonly onPageLoad: {
|
|
9
10
|
readonly action: "onPageLoad";
|
|
@@ -84,6 +85,7 @@ declare const declaration: {
|
|
|
84
85
|
};
|
|
85
86
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
86
87
|
layout?: string | undefined;
|
|
88
|
+
notFound?: string | undefined;
|
|
87
89
|
layoutContainer?: string | undefined;
|
|
88
90
|
seoEnabled?: boolean | undefined;
|
|
89
91
|
seoPageTitle?: string | undefined;
|
|
@@ -2,6 +2,11 @@ import { elementDeclaration as e } from "@plitzi/sdk-shared/authoring/declare";
|
|
|
2
2
|
//#region src/elements/internal/Page/declaration.ts
|
|
3
3
|
var t = e()({
|
|
4
4
|
type: "page",
|
|
5
|
+
serverTemplates: [
|
|
6
|
+
"seoPageTitle",
|
|
7
|
+
"seoPageDescription",
|
|
8
|
+
"notFound"
|
|
9
|
+
],
|
|
5
10
|
triggers: { onPageLoad: {
|
|
6
11
|
action: "onPageLoad",
|
|
7
12
|
title: "On Page Load",
|
|
@@ -3,6 +3,7 @@ declare const Page: {
|
|
|
3
3
|
displayName: string;
|
|
4
4
|
} & {
|
|
5
5
|
readonly type: "page";
|
|
6
|
+
readonly serverTemplates: readonly ["seoPageTitle", "seoPageDescription", "notFound"];
|
|
6
7
|
readonly triggers: {
|
|
7
8
|
readonly onPageLoad: {
|
|
8
9
|
readonly action: "onPageLoad";
|
|
@@ -83,6 +84,7 @@ declare const Page: {
|
|
|
83
84
|
};
|
|
84
85
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
85
86
|
layout?: string | undefined;
|
|
87
|
+
notFound?: string | undefined;
|
|
86
88
|
layoutContainer?: string | undefined;
|
|
87
89
|
seoEnabled?: boolean | undefined;
|
|
88
90
|
seoPageTitle?: string | undefined;
|