@plitzi/sdk-elements 0.32.25 → 0.33.0

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 (59) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/Element/ElementContext.d.ts +7 -0
  3. package/dist/Element/helpers/isVisible.d.ts +1 -0
  4. package/dist/Element/helpers/isVisible.mjs +4 -0
  5. package/dist/Element/hocs/withElement.mjs +86 -78
  6. package/dist/Element/hooks/useInternalClassName.mjs +21 -20
  7. package/dist/Element/hooks/useInternalItems.mjs +1 -1
  8. package/dist/Element/hooks/useRscData.d.ts +4 -3
  9. package/dist/Element/hooks/useRscData.mjs +15 -10
  10. package/dist/dataSource/GlobalSources.d.ts +1 -2
  11. package/dist/dataSource/GlobalSources.mjs +46 -62
  12. package/dist/elements/advanced/BlockJsx/BlockJsx.mjs +1 -1
  13. package/dist/elements/basic/Link/Link.mjs +47 -41
  14. package/dist/elements/basic/RichText/RichText.d.ts +20 -0
  15. package/dist/elements/basic/RichText/RichText.mjs +30 -0
  16. package/dist/elements/basic/RichText/Settings.d.ts +7 -0
  17. package/dist/elements/basic/RichText/Settings.mjs +51 -0
  18. package/dist/elements/{provider/CollectionContainer → basic/RichText}/index.d.ts +6 -7
  19. package/dist/elements/{provider/CollectionContainer → basic/RichText}/index.mjs +12 -13
  20. package/dist/elements/basic/RichText/sanitizeHtml.d.ts +21 -0
  21. package/dist/elements/basic/RichText/sanitizeHtml.mjs +8 -0
  22. package/dist/elements/form/FormControl/index.mjs +1 -1
  23. package/dist/elements/index.d.ts +5 -3
  24. package/dist/elements/index.mjs +30 -28
  25. package/dist/elements/internal/Page/Page.mjs +28 -26
  26. package/dist/elements/provider/ApiContainer/ApiContainer.d.ts +28 -1
  27. package/dist/elements/provider/ApiContainer/ApiContainer.mjs +201 -86
  28. package/dist/elements/provider/ApiContainer/Settings.d.ts +15 -3
  29. package/dist/elements/provider/ApiContainer/Settings.mjs +209 -92
  30. package/dist/elements/provider/ApiContainer/components/FiltersInput/FiltersInput.d.ts +22 -0
  31. package/dist/elements/provider/ApiContainer/components/FiltersInput/FiltersInput.mjs +75 -0
  32. package/dist/elements/provider/ApiContainer/components/FiltersInput/index.d.ts +3 -0
  33. package/dist/elements/provider/ApiContainer/components/FiltersInput/index.mjs +5 -0
  34. package/dist/elements/provider/ApiContainer/hooks/useProviderPagination.d.ts +31 -0
  35. package/dist/elements/provider/ApiContainer/hooks/useProviderPagination.mjs +51 -0
  36. package/dist/elements/provider/ApiContainer/hooks/useProviderWrite.d.ts +26 -0
  37. package/dist/elements/provider/ApiContainer/hooks/useProviderWrite.mjs +27 -0
  38. package/dist/elements/provider/ApiContainer/index.d.ts +8 -0
  39. package/dist/elements/provider/ApiContainer/index.mjs +9 -1
  40. package/dist/elements/settings.mjs +32 -30
  41. package/dist/elements/structure/Pagination/Pagination.d.ts +41 -0
  42. package/dist/elements/structure/Pagination/Pagination.mjs +83 -0
  43. package/dist/elements/structure/Pagination/Settings.d.ts +12 -0
  44. package/dist/elements/structure/Pagination/Settings.mjs +85 -0
  45. package/dist/elements/structure/Pagination/buildPageWindow.d.ts +9 -0
  46. package/dist/elements/structure/Pagination/buildPageWindow.mjs +8 -0
  47. package/dist/elements/structure/Pagination/index.d.ts +67 -0
  48. package/dist/elements/structure/Pagination/index.mjs +59 -0
  49. package/dist/index.d.ts +130 -57
  50. package/dist/index.mjs +32 -30
  51. package/package.json +76 -32
  52. package/dist/elements/internal/Page/helpers/UserHelper.d.ts +0 -4
  53. package/dist/elements/provider/CollectionContainer/CollectionContainer.d.ts +0 -18
  54. package/dist/elements/provider/CollectionContainer/CollectionContainer.mjs +0 -69
  55. package/dist/elements/provider/CollectionContainer/CollectionContainer.stories-pending.d.ts +0 -1
  56. package/dist/elements/provider/CollectionContainer/Settings.d.ts +0 -10
  57. package/dist/elements/provider/CollectionContainer/Settings.mjs +0 -74
  58. package/dist/elements/provider/CollectionContainer/hooks/useCollectionContext.d.ts +0 -19
  59. package/dist/elements/provider/CollectionContainer/hooks/useCollectionContext.mjs +0 -71
@@ -0,0 +1,20 @@
1
+ import { RefObject } from 'react';
2
+ export type RichTextProps = {
3
+ ref?: RefObject<HTMLElement>;
4
+ className?: string;
5
+ /** The body, bound from the provider. Whatever shape the CMS returns — see `format`. */
6
+ content?: string;
7
+ /** CMSs disagree on this and each one is right for itself: Strapi returns HTML or markdown depending on the
8
+ * editor, Contentful and Ghost return HTML, and plenty of fields are just text. One element, three readings. */
9
+ format?: 'html' | 'markdown' | 'text';
10
+ /** Prefix for relative `src`/`href` inside the body. A connector rebases record fields, but the markup inside a
11
+ * body field is opaque to it. */
12
+ mediaBaseUrl?: string;
13
+ };
14
+ declare const RichText: ({ ref, className, content, format, mediaBaseUrl }: RichTextProps) => import("react").JSX.Element;
15
+ declare const _default: {
16
+ (props: import('../../../Element/hocs/withElement').WithElementProps<RichTextProps>): import("react").JSX.Element;
17
+ displayName: string;
18
+ };
19
+ export default _default;
20
+ export { RichText };
@@ -0,0 +1,30 @@
1
+ import { RootElement as e } from "../../../Element/RootElement.mjs";
2
+ import { rebaseHtmlMedia as t, sanitizeHtml as n } from "./sanitizeHtml.mjs";
3
+ import r from "../../../Element/hocs/withElement.mjs";
4
+ import { useMemo as i } from "react";
5
+ import a from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
6
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ import c from "clsx";
8
+ import l from "@plitzi/plitzi-ui/Markdown";
9
+ //#region src/elements/basic/RichText/RichText.tsx
10
+ var u = ({ ref: r, className: u = "", content: d = "", format: f = "html", mediaBaseUrl: p = "" }) => {
11
+ let { settings: { previewMode: m } } = a(), h = i(() => f === "html" ? t(n(d), p) : "", [
12
+ f,
13
+ d,
14
+ p
15
+ ]);
16
+ return /* @__PURE__ */ s(e, {
17
+ ref: r,
18
+ className: c("plitzi-component__rich-text", { "plitzi-component__rich-text--edit-mode": !m }, u),
19
+ children: [
20
+ f === "html" && /* @__PURE__ */ o("div", { dangerouslySetInnerHTML: { __html: h } }),
21
+ f === "markdown" && /* @__PURE__ */ o(l, { children: d }),
22
+ f === "text" && /* @__PURE__ */ o("div", {
23
+ className: "plitzi-component__rich-text-plain",
24
+ children: d
25
+ })
26
+ ]
27
+ });
28
+ }, d = r(u);
29
+ //#endregion
30
+ export { u as RichText, d as default };
@@ -0,0 +1,7 @@
1
+ type SettingsProps = {
2
+ format?: 'html' | 'markdown' | 'text';
3
+ mediaBaseUrl?: string;
4
+ onUpdate?: (key: string, value: string | boolean | number | object) => void;
5
+ };
6
+ declare const Settings: ({ format, mediaBaseUrl, onUpdate }: SettingsProps) => import("react").JSX.Element;
7
+ export default Settings;
@@ -0,0 +1,51 @@
1
+ import { useCallback as e } from "react";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import r from "@plitzi/plitzi-ui/Input";
4
+ import i from "@plitzi/plitzi-ui/Select";
5
+ //#region src/elements/basic/RichText/Settings.tsx
6
+ var a = ({ format: a = "html", mediaBaseUrl: o = "", onUpdate: s }) => {
7
+ let c = e((e) => (t) => s?.(e, t), [s]);
8
+ return /* @__PURE__ */ n("div", {
9
+ className: "flex grow flex-col gap-4 py-2",
10
+ children: [
11
+ /* @__PURE__ */ n(i, {
12
+ value: a,
13
+ label: "Content Format",
14
+ onChange: c("format"),
15
+ size: "xs",
16
+ children: [
17
+ /* @__PURE__ */ t("option", {
18
+ value: "html",
19
+ children: "HTML"
20
+ }),
21
+ /* @__PURE__ */ t("option", {
22
+ value: "markdown",
23
+ children: "Markdown"
24
+ }),
25
+ /* @__PURE__ */ t("option", {
26
+ value: "text",
27
+ children: "Plain text"
28
+ })
29
+ ]
30
+ }),
31
+ /* @__PURE__ */ t(r, {
32
+ value: o,
33
+ label: "Media Base URL",
34
+ placeholder: "https://cms.example.com",
35
+ title: "Prefix for relative image and link paths inside the body.",
36
+ onChange: c("mediaBaseUrl"),
37
+ size: "xs"
38
+ }),
39
+ /* @__PURE__ */ n("span", {
40
+ className: "text-xs text-gray-500",
41
+ children: [
42
+ "Bind ",
43
+ /* @__PURE__ */ t("strong", { children: "content" }),
44
+ " to the body field of your record. Scripts, event handlers and javascript: URLs are removed before rendering."
45
+ ]
46
+ })
47
+ ]
48
+ });
49
+ };
50
+ //#endregion
51
+ export { a as default };
@@ -1,14 +1,13 @@
1
- declare const CollectionContainer: {
2
- (props: import('../../../Element/hocs/withElement').WithElementProps<import('./CollectionContainer').CollectionContainerProps>): import("react").JSX.Element;
1
+ declare const RichText: {
2
+ (props: import('../../../Element/hocs/withElement').WithElementProps<import('./RichText').RichTextProps>): import("react").JSX.Element;
3
3
  displayName: string;
4
4
  } & {
5
5
  type: string;
6
6
  content: {
7
7
  attributes: {
8
- limit: string;
9
- query: string;
10
- source: undefined;
11
- singleRecord: boolean;
8
+ content: string;
9
+ format: string;
10
+ mediaBaseUrl: string;
12
11
  };
13
12
  definition: {
14
13
  label: string;
@@ -57,4 +56,4 @@ declare const CollectionContainer: {
57
56
  settings: {};
58
57
  };
59
58
  };
60
- export default CollectionContainer;
59
+ export default RichText;
@@ -1,18 +1,17 @@
1
- import e from "./CollectionContainer.mjs";
2
- //#region src/elements/provider/CollectionContainer/index.ts
1
+ import e from "./RichText.mjs";
2
+ //#region src/elements/basic/RichText/index.ts
3
3
  var t = Object.assign(e, {
4
- type: "collectionContainer",
4
+ type: "richText",
5
5
  content: {
6
6
  attributes: {
7
- limit: "10",
8
- query: "",
9
- source: void 0,
10
- singleRecord: !1
7
+ content: "",
8
+ format: "html",
9
+ mediaBaseUrl: ""
11
10
  },
12
11
  definition: {
13
- label: "Collection Container",
14
- type: "collectionContainer",
15
- description: "",
12
+ label: "Rich Text",
13
+ type: "richText",
14
+ description: "Renders a body field coming from a CMS — HTML, markdown or plain text. Scripts and event handlers are stripped before rendering, so third-party content cannot execute.",
16
15
  items: [],
17
16
  bindings: {},
18
17
  styleSelectors: { base: "" },
@@ -28,16 +27,16 @@ var t = Object.assign(e, {
28
27
  itemsNotAllowed: []
29
28
  },
30
29
  market: {
31
- category: "provider",
30
+ category: "basic",
32
31
  owner: "Plitzi",
33
32
  verified: !0,
34
33
  license: "MIT",
35
34
  website: "https://plitzi.com",
36
35
  backgroundColor: "#4422ee",
37
- icon: "fa-solid fa-database"
36
+ icon: "fa-solid fa-align-left"
38
37
  },
39
38
  defaultStyle: {
40
- name: "Collection Container",
39
+ name: "Rich Text",
41
40
  displayMode: "desktop",
42
41
  style: { base: { default: {
43
42
  "min-width": "50px",
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Strips everything executable out of third-party HTML.
3
+ *
4
+ * This exists because `BlockHtml` deliberately does the opposite: it extracts `<script>` tags and runs them, which
5
+ * is correct for an embed the site's own author pasted in and unacceptable for a body field that arrives from a
6
+ * CMS — where the author of the content and the author of the site are, by design, different people.
7
+ *
8
+ * Deny-list sanitizing in a regex is not equivalent to parsing, and it is not claimed to be: it is the last line,
9
+ * not the only one. The provider is trusted (the site owner connected it), the content is not, and the markup a
10
+ * CMS body field produces is ordinary prose markup. `data:` is refused in URLs for the same reason as
11
+ * `javascript:` — an `data:text/html` navigation is script by another name.
12
+ */
13
+ export declare const sanitizeHtml: (html: string) => string;
14
+ /**
15
+ * Rewrites relative media paths in already-sanitized markup.
16
+ *
17
+ * A connector rebases the URLs it finds in a record's *fields*, but a body field is one opaque string — the
18
+ * `<img src="/uploads/x.png">` inside it is invisible to that pass and has to be handled where the markup is
19
+ * finally read.
20
+ */
21
+ export declare const rebaseHtmlMedia: (html: string, baseUrl: string) => string;
@@ -0,0 +1,8 @@
1
+ //#region src/elements/basic/RichText/sanitizeHtml.ts
2
+ var e = /<\s*(script|style|iframe|object|embed|link|meta|base|form)\b[^>]*>[\s\S]*?<\s*\/\s*\1\s*>/gi, t = /<\s*\/?\s*(script|style|iframe|object|embed|link|meta|base|form)\b[^>]*>/gi, n = /\son[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, r = /\s(href|src|xlink:href)\s*=\s*(?:"\s*(?:javascript|data|vbscript)\s*:[^"]*"|'\s*(?:javascript|data|vbscript)\s*:[^']*'|(?:javascript|data|vbscript)\s*:[^\s>]*)/gi, i = (i) => i.replace(e, "").replace(t, "").replace(n, "").replace(r, ""), a = (e, t) => {
3
+ if (!t) return e;
4
+ let n = t.replace(/\/+$/, "");
5
+ return e.replace(/\s(src|href)\s*=\s*"(\/(?!\/)[^"]*)"/gi, (e, t, r) => ` ${t}="${n}${r}"`);
6
+ };
7
+ //#endregion
8
+ export { a as rebaseHtmlMedia, i as sanitizeHtml };
@@ -1,6 +1,6 @@
1
1
  import e from "./FormControl.mjs";
2
2
  import { jsx as t } from "react/jsx-runtime";
3
- import { omit as n } from "@plitzi/plitzi-ui";
3
+ import { omit as n } from "@plitzi/plitzi-ui/helpers/lodash";
4
4
  import r from "@plitzi/plitzi-ui/icons/Form";
5
5
  //#region src/elements/form/FormControl/index.tsx
6
6
  var i = {
@@ -9,6 +9,7 @@ import { default as Heading } from './basic/Heading';
9
9
  import { default as Link } from './basic/Link';
10
10
  import { default as Markdown } from './basic/Markdown';
11
11
  import { default as Paragraph } from './basic/Paragraph';
12
+ import { default as RichText } from './basic/RichText';
12
13
  import { default as Text } from './basic/Text';
13
14
  import { default as Form } from './form/Form';
14
15
  import { default as FormControl } from './form/FormControl';
@@ -20,11 +21,11 @@ import { default as FontAwesome } from './media/FontAwesome';
20
21
  import { default as Image } from './media/Image';
21
22
  import { default as Video } from './media/Video';
22
23
  import { default as ApiContainer } from './provider/ApiContainer';
23
- import { default as CollectionContainer } from './provider/CollectionContainer';
24
24
  import { default as Container } from './structure/Container';
25
25
  import { default as DialogContainer } from './structure/DialogContainer';
26
26
  import { default as List } from './structure/List';
27
27
  import { default as ModalContainer } from './structure/ModalContainer';
28
+ import { default as Pagination } from './structure/Pagination';
28
29
  import { default as TabContainer } from './structure/TabContainer';
29
30
  export * from './advanced/BlockHtml';
30
31
  export * from './advanced/BlockJsx';
@@ -37,6 +38,7 @@ export * from './basic/Heading';
37
38
  export * from './basic/Link';
38
39
  export * from './basic/Markdown';
39
40
  export * from './basic/Paragraph';
41
+ export * from './basic/RichText';
40
42
  export * from './basic/Text';
41
43
  export * from './form/Form';
42
44
  export * from './form/FormControl';
@@ -47,10 +49,10 @@ export * from './media/FontAwesome';
47
49
  export * from './media/Image';
48
50
  export * from './media/Video';
49
51
  export * from './provider/ApiContainer';
50
- export * from './provider/CollectionContainer';
51
52
  export * from './structure/Container';
52
53
  export * from './structure/DialogContainer';
53
54
  export * from './structure/List';
54
55
  export * from './structure/ModalContainer';
56
+ export * from './structure/Pagination';
55
57
  export * from './structure/TabContainer';
56
- export { NodeHtml, Dropdown, NotFound, Loading, Custom, Reference, BlockHtml, BlockJsx, Page, Container, LayoutContainer, DialogContainer, ModalContainer, TabContainer, Heading, Image, Video, FontAwesome, Button, Paragraph, Text, List, Link, Markdown, Form, FormControl, ApiContainer, CollectionContainer };
58
+ export { NodeHtml, Dropdown, NotFound, Loading, Custom, Reference, BlockHtml, BlockJsx, Page, Container, LayoutContainer, DialogContainer, ModalContainer, TabContainer, Heading, Image, Video, FontAwesome, Button, Paragraph, RichText, Text, List, Link, Markdown, Pagination, Form, FormControl, ApiContainer };
@@ -10,53 +10,55 @@ import c from "./basic/Heading/index.mjs";
10
10
  import l from "./basic/Link/index.mjs";
11
11
  import u from "./basic/Markdown/index.mjs";
12
12
  import d from "./basic/Paragraph/index.mjs";
13
- import f from "./basic/Text/index.mjs";
14
- import p from "./form/Form/index.mjs";
15
- import m from "./form/FormControl/index.mjs";
16
- import h from "./internal/LayoutContainer/index.mjs";
17
- import g from "./internal/Loading/index.mjs";
18
- import { NotFound as _ } from "./internal/NotFound/index.mjs";
19
- import v from "./internal/Page/index.mjs";
20
- import y from "./media/FontAwesome/index.mjs";
21
- import b from "./media/Image/index.mjs";
22
- import x from "./media/Video/index.mjs";
23
- import S from "./provider/ApiContainer/index.mjs";
24
- import C from "./provider/CollectionContainer/index.mjs";
13
+ import f from "./basic/RichText/index.mjs";
14
+ import p from "./basic/Text/index.mjs";
15
+ import m from "./form/Form/index.mjs";
16
+ import h from "./form/FormControl/index.mjs";
17
+ import g from "./internal/LayoutContainer/index.mjs";
18
+ import _ from "./internal/Loading/index.mjs";
19
+ import { NotFound as v } from "./internal/NotFound/index.mjs";
20
+ import y from "./internal/Page/index.mjs";
21
+ import b from "./media/FontAwesome/index.mjs";
22
+ import x from "./media/Image/index.mjs";
23
+ import S from "./media/Video/index.mjs";
24
+ import C from "./provider/ApiContainer/index.mjs";
25
25
  import w from "./structure/Container/index.mjs";
26
26
  import T from "./structure/DialogContainer/index.mjs";
27
27
  import E from "./structure/List/index.mjs";
28
28
  import D from "./structure/ModalContainer/index.mjs";
29
- import O from "./structure/TabContainer/index.mjs";
29
+ import O from "./structure/Pagination/index.mjs";
30
+ import k from "./structure/TabContainer/index.mjs";
30
31
  //#region src/elements/index.ts
31
- var k = /* @__PURE__ */ e({
32
- ApiContainer: () => S,
32
+ var A = /* @__PURE__ */ e({
33
+ ApiContainer: () => C,
33
34
  BlockHtml: () => t,
34
35
  BlockJsx: () => n,
35
36
  Button: () => o,
36
- CollectionContainer: () => C,
37
37
  Container: () => w,
38
38
  Custom: () => r,
39
39
  DialogContainer: () => T,
40
40
  Dropdown: () => s,
41
- FontAwesome: () => y,
42
- Form: () => p,
43
- FormControl: () => m,
41
+ FontAwesome: () => b,
42
+ Form: () => m,
43
+ FormControl: () => h,
44
44
  Heading: () => c,
45
- Image: () => b,
46
- LayoutContainer: () => h,
45
+ Image: () => x,
46
+ LayoutContainer: () => g,
47
47
  Link: () => l,
48
48
  List: () => E,
49
- Loading: () => g,
49
+ Loading: () => _,
50
50
  Markdown: () => u,
51
51
  ModalContainer: () => D,
52
52
  NodeHtml: () => i,
53
- NotFound: () => _,
54
- Page: () => v,
53
+ NotFound: () => v,
54
+ Page: () => y,
55
+ Pagination: () => O,
55
56
  Paragraph: () => d,
56
57
  Reference: () => a,
57
- TabContainer: () => O,
58
- Text: () => f,
59
- Video: () => x
58
+ RichText: () => f,
59
+ TabContainer: () => k,
60
+ Text: () => p,
61
+ Video: () => S
60
62
  });
61
63
  //#endregion
62
- export { S as ApiContainer, t as BlockHtml, n as BlockJsx, o as Button, C as CollectionContainer, w as Container, r as Custom, T as DialogContainer, s as Dropdown, y as FontAwesome, p as Form, m as FormControl, c as Heading, b as Image, h as LayoutContainer, l as Link, E as List, g as Loading, u as Markdown, D as ModalContainer, i as NodeHtml, _ as NotFound, v as Page, d as Paragraph, a as Reference, O as TabContainer, f as Text, x as Video, k as elements_exports };
64
+ export { C as ApiContainer, t as BlockHtml, n as BlockJsx, o as Button, w as Container, r as Custom, T as DialogContainer, s as Dropdown, b as FontAwesome, m as Form, h as FormControl, c as Heading, x as Image, g as LayoutContainer, l as Link, E as List, _ as Loading, u as Markdown, D as ModalContainer, i as NodeHtml, v as NotFound, y as Page, O as Pagination, d as Paragraph, a as Reference, f as RichText, k as TabContainer, p as Text, S as Video, A as elements_exports };
@@ -4,25 +4,27 @@ import n from "../LayoutContainer/index.mjs";
4
4
  import r from "../../../Element/hocs/withElement.mjs";
5
5
  import { use as i, useEffect as a, useMemo as o } from "react";
6
6
  import s from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
7
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
- import u from "clsx";
7
+ import { useSdkStore as c } from "@plitzi/sdk-shared/store";
8
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
+ import d from "clsx";
10
+ import { Helmet as f } from "@dr.pogodin/react-helmet";
9
11
  //#region src/elements/internal/Page/Page.tsx
10
- var d = ({ ref: r, seoEnabled: d = !1, seoPageTitle: f = "Title", seoPageDescription: p = "Description", className: m = "", layout: h = "", layoutContainer: g = "", children: _ }) => {
11
- let { id: v, idRef: y } = e(), { settings: { previewMode: b }, contexts: { NavigationContext: x, InteractionsContext: S } } = s(), { interactionsManager: C } = i(S), { Helmet: w, routeParams: T, queryParams: E } = i(x), D = o(() => ({
12
- id: h,
13
- rootId: v,
12
+ var p = ({ ref: r, seoEnabled: p = !1, seoPageTitle: m = "Title", seoPageDescription: h = "Description", className: g = "", layout: _ = "", layoutContainer: v = "", children: y }) => {
13
+ let { id: b, idRef: x } = e(), { settings: { previewMode: S }, contexts: { InteractionsContext: C } } = s(), { interactionsManager: w } = i(C), [[T, E]] = c(["navigation.routeParams", "navigation.queryParams"]), D = o(() => ({
14
+ id: _,
15
+ rootId: b,
14
16
  plitziElementLayout: {
15
- bodyChildren: _,
16
- containerId: g || h,
17
- referenceId: v,
18
- rootId: g || h,
17
+ bodyChildren: y,
18
+ containerId: v || _,
19
+ referenceId: b,
20
+ rootId: v || _,
19
21
  type: "layout"
20
22
  }
21
23
  }), [
22
- g,
23
- h,
24
24
  v,
25
- _
25
+ _,
26
+ b,
27
+ y
26
28
  ]), O = o(() => ({ onPageLoad: {
27
29
  action: "onPageLoad",
28
30
  title: "On Page Load",
@@ -35,30 +37,30 @@ var d = ({ ref: r, seoEnabled: d = !1, seoPageTitle: f = "Title", seoPageDescrip
35
37
  }
36
38
  } }), []);
37
39
  return a(() => {
38
- C.interactionTrigger(y, "onPageLoad", {
39
- pageId: v,
40
+ w.interactionTrigger(x, "onPageLoad", {
41
+ pageId: b,
40
42
  routeParams: T,
41
43
  queryParams: E
42
44
  });
43
45
  }, [
44
- v,
45
- y,
46
- C,
46
+ b,
47
+ x,
48
+ w,
47
49
  E,
48
50
  T
49
- ]), /* @__PURE__ */ l(t, {
51
+ ]), /* @__PURE__ */ u(t, {
50
52
  ref: r,
51
- className: u("plitzi-component__page", m),
53
+ className: d("plitzi-component__page", g),
52
54
  interactionTriggers: O,
53
55
  children: [
54
- d && b && w && /* @__PURE__ */ l(w, { children: [!!f && /* @__PURE__ */ c("title", { children: f }), !!p && /* @__PURE__ */ c("meta", {
56
+ p && S && /* @__PURE__ */ u(f, { children: [!!m && /* @__PURE__ */ l("title", { children: m }), !!h && /* @__PURE__ */ l("meta", {
55
57
  name: "description",
56
- content: p
58
+ content: h
57
59
  })] }),
58
- h && /* @__PURE__ */ c(n, { internalProps: D }),
59
- !h && _
60
+ _ && /* @__PURE__ */ l(n, { internalProps: D }),
61
+ !_ && y
60
62
  ]
61
63
  });
62
- }, f = r(d);
64
+ }, m = r(p);
63
65
  //#endregion
64
- export { d as Page, f as default };
66
+ export { p as Page, m as default };
@@ -1,3 +1,4 @@
1
+ import { ProviderPagination } from './hooks/useProviderPagination';
1
2
  import { RuleGroup } from '@plitzi/plitzi-ui/QueryBuilder';
2
3
  import { ReactNode, RefObject } from 'react';
3
4
  export type ApiContainerProps = {
@@ -6,14 +7,40 @@ export type ApiContainerProps = {
6
7
  children?: ReactNode;
7
8
  query?: string;
8
9
  method?: 'get' | 'post' | 'put' | 'delete' | 'patch';
10
+ /** Client-side bearer token. Meant to arrive through a binding (e.g. the signed-in user's token), which resolves
11
+ * at runtime and never enters the schema. A static value typed here is persisted and therefore public — use a
12
+ * server connector (`runtime: 'server'`) for anything secret. */
9
13
  accessToken?: string;
10
14
  when?: RuleGroup;
11
15
  headers?: Record<string, string>;
12
16
  mockData?: Record<string, unknown> | string;
13
17
  subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure';
14
18
  credentials?: RequestCredentials;
19
+ /** Identifier of the server-side connector that feeds this provider. Only meaningful with `runtime: 'server'`. */
20
+ connector?: string;
21
+ /** Which of the connector's read endpoints to execute. Defaults to `list`. */
22
+ endpoint?: string;
23
+ /** Content type / collection read through the connector. */
24
+ resource?: string;
25
+ /** Records per window. Read server-side; a single-record provider is capped at one regardless. */
26
+ limit?: string;
27
+ /** Feeds a detail page: publishes `record` instead of `records`, filtered down to one entry. */
28
+ singleRecord?: boolean;
29
+ /** Field / operator / value rows applied to the connector query. Values are templates resolved server-side, so
30
+ * `{{routeParams.slug}}` is what turns a page into a detail page. */
31
+ filters?: {
32
+ field: string;
33
+ operator: string;
34
+ value: string;
35
+ }[];
36
+ /** `url` pages through the address bar and stays indexable; `append` accumulates in the browser for a "load
37
+ * more" list. Append needs a server-driven provider — a client-side query has no window to ask the server for. */
38
+ pagination?: ProviderPagination;
39
+ pageParam?: string;
40
+ /** Renders children while the first client-side request is still in flight, so a loading state can be bound. */
41
+ renderWhileLoading?: boolean;
15
42
  };
16
- declare const ApiContainer: ({ ref, className, children, query, method, accessToken, when, headers, mockData, subType, credentials }: ApiContainerProps) => import("react").JSX.Element;
43
+ declare const ApiContainer: ({ ref, className, children, query, method, accessToken, when, headers, mockData, subType, credentials, singleRecord, pagination, pageParam, renderWhileLoading }: ApiContainerProps) => import("react").JSX.Element;
17
44
  declare const _default: {
18
45
  (props: import('../../../Element/hocs/withElement').WithElementProps<ApiContainerProps>): import("react").JSX.Element;
19
46
  displayName: string;