@plitzi/sdk-elements 0.38.2 → 0.38.4

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 (45) hide show
  1. package/CHANGELOG.md +335 -0
  2. package/dist/Element/RootElement.mjs +58 -50
  3. package/dist/Element/helpers/renderStaticTag.d.ts +8 -2
  4. package/dist/Element/helpers/renderStaticTag.mjs +5 -4
  5. package/dist/canvas/index.d.ts +6 -0
  6. package/dist/canvas/index.mjs +5 -0
  7. package/dist/canvas/shaders.d.ts +16 -0
  8. package/dist/canvas/shaders.mjs +25 -0
  9. package/dist/canvas/useAnimationFrame.d.ts +27 -0
  10. package/dist/canvas/useAnimationFrame.mjs +42 -0
  11. package/dist/canvas/useCanvas.d.ts +51 -0
  12. package/dist/canvas/useCanvas.mjs +133 -0
  13. package/dist/canvas/useReducedMotion.d.ts +6 -0
  14. package/dist/canvas/useReducedMotion.mjs +15 -0
  15. package/dist/elements/basic/Button/Button.d.ts +6 -1
  16. package/dist/elements/basic/Button/Button.mjs +9 -8
  17. package/dist/elements/basic/Button/declaration.d.ts +1 -0
  18. package/dist/elements/basic/Button/index.d.ts +1 -0
  19. package/dist/elements/declarations/index.d.ts +6 -2
  20. package/dist/elements/form/FormControl/FormControl.d.ts +5 -1
  21. package/dist/elements/form/FormControl/FormControl.mjs +3 -0
  22. package/dist/elements/form/FormControl/Settings.d.ts +1 -1
  23. package/dist/elements/form/FormControl/Settings.mjs +16 -1
  24. package/dist/elements/form/FormControl/declaration.mjs +3 -0
  25. package/dist/elements/media/Image/Image.d.ts +7 -1
  26. package/dist/elements/media/Image/Image.mjs +10 -10
  27. package/dist/elements/media/Image/declaration.d.ts +2 -1
  28. package/dist/elements/media/Image/declaration.mjs +1 -1
  29. package/dist/elements/media/Image/index.d.ts +2 -1
  30. package/dist/elements/provider/ApiContainer/ApiContainer.d.ts +1 -1
  31. package/dist/elements/provider/ApiContainer/ApiContainer.mjs +123 -131
  32. package/dist/elements/provider/ApiContainer/helpers/serverMock.d.ts +10 -0
  33. package/dist/elements/provider/ApiContainer/helpers/serverMock.mjs +17 -0
  34. package/dist/elements/structure/Container/Container.d.ts +8 -2
  35. package/dist/elements/structure/Container/Container.mjs +6 -5
  36. package/dist/elements/structure/Container/declaration.d.ts +3 -1
  37. package/dist/elements/structure/Container/declaration.mjs +31 -23
  38. package/dist/elements/structure/Container/index.d.ts +3 -1
  39. package/dist/elements/structure/List/List.mjs +1 -0
  40. package/dist/elements/structure/List/Settings.mjs +1 -1
  41. package/dist/elements/structure/List/declaration.mjs +1 -1
  42. package/dist/elements/structure/List/modes/ListControlled/ListControlled.d.ts +3 -1
  43. package/dist/elements/structure/List/modes/ListControlled/ListControlled.mjs +18 -17
  44. package/dist/index.d.ts +6 -2
  45. package/package.json +36 -8
@@ -7,132 +7,124 @@ import { isEmptyAnswer as ne } from "./helpers/isEmptyAnswer.mjs";
7
7
  import { childrenWhile as re } from "./helpers/loadingSlot.mjs";
8
8
  import ie from "./helpers/providerOutcome.mjs";
9
9
  import { queryInputOf as ae } from "./helpers/queryInput.mjs";
10
+ import { serverMock as oe } from "./helpers/serverMock.mjs";
10
11
  import r from "./hooks/useApi.mjs";
11
- import i from "./hooks/useAutoRefresh.mjs";
12
- import oe from "./hooks/useProviderPagination.mjs";
13
- import se from "./hooks/useProviderWrite.mjs";
14
- import ce from "../../../dataSource/pathFields.mjs";
15
- import { use as le, useCallback as a, useEffect as ue, useMemo as o, useRef as de } from "react";
16
- import fe from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
17
- import { useSdkStore as pe } from "@plitzi/sdk-shared/store";
18
- import { StoreProvider as s } from "@plitzi/nexus/react";
19
- import { emptyObject as c } from "@plitzi/sdk-shared/helpers/utils";
20
- import { jsx as l } from "react/jsx-runtime";
21
- import { currentRscLocation as me } from "@plitzi/sdk-shared/server/rsc/refreshRsc";
22
- import he from "clsx";
23
- import ge from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
24
- import _e from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
25
- import { QueryBuilderEvaluator as ve } from "@plitzi/plitzi-ui/QueryBuilder";
12
+ import se from "./hooks/useAutoRefresh.mjs";
13
+ import ce from "./hooks/useProviderPagination.mjs";
14
+ import le from "./hooks/useProviderWrite.mjs";
15
+ import ue from "../../../dataSource/pathFields.mjs";
16
+ import { use as de, useCallback as i, useEffect as fe, useMemo as a, useRef as pe } from "react";
17
+ import me from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
18
+ import { useSdkStore as he } from "@plitzi/sdk-shared/store";
19
+ import { StoreProvider as ge } from "@plitzi/nexus/react";
20
+ import { emptyObject as o } from "@plitzi/sdk-shared/helpers/utils";
21
+ import { jsx as s } from "react/jsx-runtime";
22
+ import { currentRscLocation as _e } from "@plitzi/sdk-shared/server/rsc/refreshRsc";
23
+ import ve from "clsx";
24
+ import ye from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
25
+ import be from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
26
+ import { QueryBuilderEvaluator as xe } from "@plitzi/plitzi-ui/QueryBuilder";
26
27
  //#region src/elements/provider/ApiContainer/ApiContainer.tsx
27
- var u = ({ ref: e, className: u = "", children: d, query: f = "", method: p = "get", accessToken: m = "", when: h = c, headers: g = c, mockData: _ = "{}", subType: ye = "", credentials: be = "same-origin", singleRecord: v = !1, pagination: xe = "none", pageParam: Se = "page", renderWhileLoading: Ce = !1, loadingSlot: y = "", cache: we = !1, staleTime: Te = 30, gcTime: Ee = 300, refreshSeconds: De = 0 }) => {
28
- let { id: b, visible: x, definition: { label: S = "Api Container", runtime: Oe, items: ke } } = t(), C = Oe === "server", { loaded: w, stale: T, location: E, elementData: D, refresh: O } = ee(), k = ge(n.sourceType, b), { settings: { previewMode: A }, contexts: { InteractionsContext: Ae } } = fe(), { interactionsManager: j } = le(Ae), [[M, N, je]] = pe([
28
+ var c = ({ ref: e, className: c = "", children: l, query: u = "", method: d = "get", accessToken: f = "", when: p = o, headers: m = o, mockData: h = "{}", subType: Se = "", credentials: Ce = "same-origin", singleRecord: g = !1, pagination: we = "none", pageParam: Te = "page", renderWhileLoading: Ee = !1, loadingSlot: _ = "", cache: De = !1, staleTime: Oe = 30, gcTime: ke = 300, refreshSeconds: Ae = 0, connector: je = "", action: Me = "" }) => {
29
+ let { id: v, visible: y, definition: { label: b = "Api Container", runtime: x, items: Ne } } = t(), S = x === "server", { loaded: C, stale: w, location: T, elementData: E, refresh: D } = ee(), O = ye(n.sourceType, v), { settings: { previewMode: k }, contexts: { InteractionsContext: Pe } } = me(), { interactionsManager: A } = de(Pe), [[j, M, Fe]] = he([
29
30
  "navigation.routeParams",
30
31
  "navigation.queryParams",
31
32
  "navigation.navigate"
32
- ]), Me = o(() => m ? {
33
- ...g,
34
- Authorization: `Bearer ${m}`
35
- } : g, [g, m]), P = o(() => C || !x ? !1 : !!(A && f && (h === c || ve(h, {
36
- ...M,
37
- ...N
38
- })) || !A && (f || _ && _ !== "{}" && _ !== c)), [
39
- C,
40
- x,
41
- A,
42
- f,
43
- h,
33
+ ]), Ie = a(() => f ? {
34
+ ...m,
35
+ Authorization: `Bearer ${f}`
36
+ } : m, [m, f]), N = a(() => S || !y ? !1 : !!(k && u && (p === o || xe(p, {
37
+ ...j,
38
+ ...M
39
+ })) || !k && (u || h && h !== "{}" && h !== o)), [
40
+ S,
41
+ y,
42
+ k,
43
+ u,
44
+ p,
45
+ j,
44
46
  M,
45
- N,
46
- _
47
- ]), Ne = o(() => [b], [b]), { isLoading: Pe, isFetching: Fe, data: F, refetch: I, isSuccess: Ie, isError: Le } = r({
48
- url: f,
49
- method: p,
50
- credentials: be,
51
- mock: A ? void 0 : _,
52
- customHeaders: Me,
53
- enabled: P,
54
- cache: we,
55
- staleTime: Te,
56
- gcTime: Ee,
57
- tags: Ne
58
- }), L = C && !!E && E !== me(), R = C && w && !L && D === null, z = o(() => {
59
- if (!C) return F ?? c;
60
- if (D) return D;
61
- if (w) return c;
62
- if (typeof _ != "string") return _;
63
- try {
64
- return JSON.parse(_ || "{}");
65
- } catch {
66
- return c;
67
- }
68
- }, [
47
+ h
48
+ ]), Le = a(() => [v], [v]), { isLoading: Re, isFetching: ze, data: P, refetch: F, isSuccess: Be, isError: Ve } = r({
49
+ url: u,
50
+ method: d,
51
+ credentials: Ce,
52
+ mock: k ? void 0 : h,
53
+ customHeaders: Ie,
54
+ enabled: N,
55
+ cache: De,
56
+ staleTime: Oe,
57
+ gcTime: ke,
58
+ tags: Le
59
+ }), I = S && !!T && T !== _e(), L = S && C && !I && E === null, R = S && !je && !Me, z = a(() => S ? E || (C ? o : oe(h, R)) : P ?? o, [
60
+ S,
61
+ P,
62
+ E,
69
63
  C,
70
- F,
71
- D,
72
- w,
73
- _
74
- ]), B = C ? L : Fe, V = C ? L : Pe, H = de({}), U = a((e, t) => O(e, {
64
+ h,
65
+ R
66
+ ]), B = S ? I : ze, V = S ? I : Re, H = pe({}), U = i((e, t) => D(e, {
75
67
  ...H.current,
76
68
  ...t
77
- }), [O]), W = a(async () => {
78
- if (!C) {
79
- I();
69
+ }), [D]), W = i(async () => {
70
+ if (!S) {
71
+ F();
80
72
  return;
81
73
  }
82
- await U([b]);
74
+ await U([v]);
83
75
  }, [
84
- C,
85
- I,
76
+ S,
77
+ F,
86
78
  U,
87
- b
88
- ]), G = a(async ({ input: e } = {}) => {
79
+ v
80
+ ]), G = i(async ({ input: e } = {}) => {
89
81
  let t = ae(e);
90
82
  t && (H.current = t), await W();
91
83
  }, [W]);
92
- i({
93
- seconds: De,
94
- enabled: x && (C ? w && !L : P),
84
+ se({
85
+ seconds: Ae,
86
+ enabled: y && (S ? C && !I : N),
95
87
  refresh: W
96
88
  });
97
- let K = z, Re = o(() => Array.isArray(K.records) ? K.records : [], [K.records]), { records: q, isLoadingMore: J, goToPage: Y, loadMore: X } = oe({
98
- elementId: b,
99
- mode: xe,
100
- pageParam: Se,
101
- records: Re,
89
+ let K = z, He = a(() => Array.isArray(K.records) ? K.records : [], [K.records]), { records: q, isLoadingMore: J, goToPage: Y, loadMore: X } = ce({
90
+ elementId: v,
91
+ mode: we,
92
+ pageParam: Te,
93
+ records: He,
102
94
  page: K.pageInfo?.page ?? 1,
103
95
  refresh: U,
104
- navigate: je
96
+ navigate: Fe
105
97
  }), Z = ie({
106
- serverMode: C,
107
- isSuccess: Ie,
108
- isError: Le,
109
- rscResolved: w,
110
- rscPending: L,
111
- elementData: D
98
+ serverMode: S,
99
+ isSuccess: Be,
100
+ isError: Ve,
101
+ rscResolved: C,
102
+ rscPending: I,
103
+ elementData: E
112
104
  });
113
- ue(() => {
114
- !B && b && Z && j.interactionTrigger(b, Z === "success" ? "onApiSuccess" : "onApiError", {
115
- url: f,
116
- method: p,
105
+ fe(() => {
106
+ !B && v && Z && A.interactionTrigger(v, Z === "success" ? "onApiSuccess" : "onApiError", {
107
+ url: u,
108
+ method: d,
117
109
  ...z
118
110
  });
119
111
  }, [
120
112
  z,
121
- b,
122
- j,
113
+ v,
114
+ A,
123
115
  B,
124
- p,
116
+ d,
125
117
  Z,
126
- f
118
+ u
127
119
  ]);
128
- let Q = o(() => ({
120
+ let Q = a(() => ({
129
121
  ...z,
130
- ...Array.isArray(K.records) ? { records: q } : c,
122
+ ...Array.isArray(K.records) ? { records: q } : o,
131
123
  isLoading: B || J,
132
- isEmpty: ne(K, q, v),
133
- hasError: R,
134
- errorMessage: R ? "The data provider could not be reached" : "",
135
- isStale: C && T
124
+ isEmpty: ne(K, q, g),
125
+ hasError: L,
126
+ errorMessage: L ? "The data provider could not be reached" : "",
127
+ isStale: S && w
136
128
  }), [
137
129
  z,
138
130
  K.records,
@@ -140,70 +132,70 @@ var u = ({ ref: e, className: u = "", children: d, query: f = "", method: p = "g
140
132
  q,
141
133
  B,
142
134
  J,
143
- v,
144
- R,
145
- C,
146
- T
147
- ]), ze = a(() => ce(Q), [Q]);
148
- _e({
149
- id: b,
150
- source: k,
151
- name: S || `API - ${b}`,
152
- fields: ze
135
+ g,
136
+ L,
137
+ S,
138
+ w
139
+ ]), Ue = i(() => ue(Q), [Q]);
140
+ be({
141
+ id: v,
142
+ source: O,
143
+ name: b || `API - ${v}`,
144
+ fields: Ue
153
145
  });
154
- let { writeRecord: $ } = se({
155
- elementId: b,
156
- enabled: C,
146
+ let { writeRecord: $ } = le({
147
+ elementId: v,
148
+ enabled: S,
157
149
  onDone: W
158
- }), Be = o(() => {
150
+ }), We = a(() => {
159
151
  let e = {
160
152
  performQuery: {
161
153
  ...n.callbacks.performQuery,
162
- title: `Perform Query ${S}`,
154
+ title: `Perform Query ${b}`,
163
155
  callback: G
164
156
  },
165
157
  loadMore: {
166
158
  ...n.callbacks.loadMore,
167
- title: `Load More ${S}`,
159
+ title: `Load More ${b}`,
168
160
  callback: X
169
161
  },
170
162
  goToPage: {
171
163
  ...n.callbacks.goToPage,
172
- title: `Go To Page ${S}`,
164
+ title: `Go To Page ${b}`,
173
165
  callback: ({ page: e }) => Y(Number(e) || 1)
174
166
  }
175
167
  };
176
- return C && (e.writeRecord = {
168
+ return S && (e.writeRecord = {
177
169
  ...n.callbacks.writeRecord,
178
- title: `Write Record ${S}`,
170
+ title: `Write Record ${b}`,
179
171
  callback: $
180
172
  }), e;
181
173
  }, [
182
- S,
174
+ b,
183
175
  G,
184
176
  X,
185
177
  Y,
186
- C,
178
+ S,
187
179
  $
188
- ]), Ve = o(() => y && A ? re(d, y, V) : d, [
189
- d,
180
+ ]), Ge = a(() => _ && k ? re(l, _, V) : l, [
181
+ l,
190
182
  V,
191
- y,
192
- A
193
- ]), He = o(() => k ? { runtime: { sources: { [k]: Q } } } : c, [Q, k]);
194
- return /* @__PURE__ */ l(te, {
183
+ _,
184
+ k
185
+ ]), Ke = a(() => O ? { runtime: { sources: { [O]: Q } } } : o, [Q, O]);
186
+ return /* @__PURE__ */ s(te, {
195
187
  ref: e,
196
- tag: !A && !ke?.length ? "div" : ye,
197
- className: he("plitzi-component__api-container", u),
188
+ tag: !k && !Ne?.length ? "div" : Se,
189
+ className: ve("plitzi-component__api-container", c),
198
190
  interactionTriggers: n.triggers,
199
- interactionCallbacks: Be,
200
- children: (!V || Ce || y) && /* @__PURE__ */ l(s, {
191
+ interactionCallbacks: We,
192
+ children: (!V || Ee || _) && /* @__PURE__ */ s(ge, {
201
193
  inherit: "live",
202
- name: `Api:${b}`,
203
- value: He,
204
- children: Ve
194
+ name: `Api:${v}`,
195
+ value: Ke,
196
+ children: Ge
205
197
  })
206
198
  });
207
- }, d = e(u);
199
+ }, l = e(c);
208
200
  //#endregion
209
- export { u as ApiContainer, d as default };
201
+ export { c as ApiContainer, l as default };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * What a server provider renders from in the builder, which has no `/_rsc` to ask: its mock data, in the shape the
3
+ * server answers it with.
4
+ *
5
+ * A provider that only has a `query` is answered as a browser request publishes — `{ status, data }`, the body under
6
+ * `data` — so its mock is that body under `data` too: `<source>.data.<field>` in the browser, on the server and in the
7
+ * builder alike. A connector's or an action's answer is its own slice (`records`, an action's output), and so is its
8
+ * mock. Mock data that is not JSON renders nothing, as an empty answer would.
9
+ */
10
+ export declare const serverMock: (mockData: Record<string, unknown> | string, queryShaped: boolean) => Record<string, unknown>;
@@ -0,0 +1,17 @@
1
+ import { emptyObject as e } from "@plitzi/sdk-shared/helpers/utils";
2
+ //#region src/elements/provider/ApiContainer/helpers/serverMock.ts
3
+ var t = (t, n) => {
4
+ let r;
5
+ if (typeof t != "string") r = t;
6
+ else try {
7
+ r = JSON.parse(t || "{}");
8
+ } catch {
9
+ return e;
10
+ }
11
+ return n ? {
12
+ status: 200,
13
+ data: r
14
+ } : r;
15
+ };
16
+ //#endregion
17
+ export { t as serverMock };
@@ -2,7 +2,7 @@ import { ReactNode, RefObject } from 'react';
2
2
  export type ContainerProps = {
3
3
  ref?: RefObject<HTMLElement>;
4
4
  className?: string;
5
- subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure' | 'dl' | 'dt' | 'dd' | 'li' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';
5
+ subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure' | 'dl' | 'dt' | 'dd' | 'li' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span';
6
6
  /**
7
7
  * The name of the part of the page this is — "Main navigation", "Search results", "Your cart" — for screen readers
8
8
  * and browser agents, which list the page by its landmarks and regions and jump between them.
@@ -17,9 +17,15 @@ export type ContainerProps = {
17
17
  * control inside it can still be tabbed to, and is then announced as nothing.
18
18
  */
19
19
  decorative?: boolean;
20
+ /**
21
+ * A part of the page whose words change while somebody is on it — a count, a total, a status — said aloud when they
22
+ * do (`aria-live`): `polite` once the reader is idle, `assertive` at once, for what cannot wait. Left out, a change is
23
+ * silent to a screen reader, which reads only what it is moved to.
24
+ */
25
+ live?: 'polite' | 'assertive' | '';
20
26
  children?: ReactNode;
21
27
  };
22
- declare const Container: ({ ref, className, subType, label, decorative, children }: ContainerProps) => import('react').JSX.Element;
28
+ declare const Container: ({ ref, className, subType, label, decorative, live, children }: ContainerProps) => import('react').JSX.Element;
23
29
  declare const _default: {
24
30
  (props: import('../../../Element/hocs/withElement').WithElementProps<ContainerProps>): import('react').JSX.Element;
25
31
  displayName: string;
@@ -4,18 +4,19 @@ import { NAMEABLE_CONTAINER_TAGS as n } from "./declaration.mjs";
4
4
  import { jsx as r } from "react/jsx-runtime";
5
5
  import i from "clsx";
6
6
  //#region src/elements/structure/Container/Container.tsx
7
- var a = ({ ref: e, className: a = "", subType: o = "div", label: s = "", decorative: c = !1, children: l }) => {
8
- let u = !c && s && n.includes(o) ? {
7
+ var a = ({ ref: e, className: a = "", subType: o = "div", label: s = "", decorative: c = !1, live: l = "", children: u }) => {
8
+ let d = !c && s && n.includes(o) ? {
9
9
  "aria-label": s,
10
10
  ...o === "div" ? { role: "group" } : {}
11
- } : {}, d = c ? { "aria-hidden": !0 } : {};
11
+ } : {}, f = c ? { "aria-hidden": !0 } : {}, p = l ? { "aria-live": l } : {};
12
12
  return /* @__PURE__ */ r(t, {
13
13
  ref: e,
14
14
  tag: o,
15
15
  className: i(`plitzi-component__container plitzi-component__container-${o}`, a),
16
- ...u,
17
16
  ...d,
18
- children: l
17
+ ...f,
18
+ ...p,
19
+ children: u
19
20
  });
20
21
  }, o = e(a);
21
22
  //#endregion
@@ -12,6 +12,7 @@ declare const declaration: {
12
12
  readonly type: "container";
13
13
  readonly attributeValues: {
14
14
  readonly subType: readonly string[];
15
+ readonly live: readonly string[];
15
16
  };
16
17
  readonly content: {
17
18
  readonly attributes: {
@@ -62,7 +63,8 @@ declare const declaration: {
62
63
  };
63
64
  } & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
64
65
  label?: string | undefined;
65
- subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | undefined;
66
+ subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | undefined;
67
+ live?: "polite" | "assertive" | "" | undefined;
66
68
  decorative?: boolean | undefined;
67
69
  }>>;
68
70
  export default declaration;
@@ -12,29 +12,37 @@ var n = [
12
12
  "figure"
13
13
  ], r = e()({
14
14
  type: "container",
15
- attributeValues: { subType: t()([
16
- "div",
17
- "header",
18
- "footer",
19
- "nav",
20
- "main",
21
- "section",
22
- "article",
23
- "aside",
24
- "address",
25
- "figure",
26
- "dl",
27
- "dt",
28
- "dd",
29
- "li",
30
- "h1",
31
- "h2",
32
- "h3",
33
- "h4",
34
- "h5",
35
- "h6",
36
- "span"
37
- ]) },
15
+ attributeValues: {
16
+ subType: t()([
17
+ "div",
18
+ "header",
19
+ "footer",
20
+ "nav",
21
+ "main",
22
+ "section",
23
+ "article",
24
+ "aside",
25
+ "address",
26
+ "figure",
27
+ "dl",
28
+ "dt",
29
+ "dd",
30
+ "li",
31
+ "h1",
32
+ "h2",
33
+ "h3",
34
+ "h4",
35
+ "h5",
36
+ "h6",
37
+ "p",
38
+ "span"
39
+ ]),
40
+ live: t()([
41
+ "",
42
+ "polite",
43
+ "assertive"
44
+ ])
45
+ },
38
46
  content: {
39
47
  attributes: { subType: "div" },
40
48
  definition: {
@@ -5,6 +5,7 @@ declare const Container: {
5
5
  readonly type: "container";
6
6
  readonly attributeValues: {
7
7
  readonly subType: readonly string[];
8
+ readonly live: readonly string[];
8
9
  };
9
10
  readonly content: {
10
11
  readonly attributes: {
@@ -55,7 +56,8 @@ declare const Container: {
55
56
  };
56
57
  } & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
57
58
  label?: string | undefined;
58
- subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | undefined;
59
+ subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | undefined;
60
+ live?: "polite" | "assertive" | "" | undefined;
59
61
  decorative?: boolean | undefined;
60
62
  }>>;
61
63
  export default Container;
@@ -8,6 +8,7 @@ var i = ({ ref: e, className: i = "", subType: a = "ul", children: o, items: s =
8
8
  case "controlled": return /* @__PURE__ */ r(n, {
9
9
  ref: e,
10
10
  className: i,
11
+ subType: a,
11
12
  items: s,
12
13
  itemKey: l,
13
14
  children: o
@@ -29,7 +29,7 @@ var a = ({ subType: a = "ul", source: o = "none", itemKey: s = "", onUpdate: c }
29
29
  title: "The field of each item that names it, so a row stays with its item when the list is filtered.",
30
30
  onChange: l("itemKey")
31
31
  }),
32
- o === "none" && /* @__PURE__ */ n(i, {
32
+ /* @__PURE__ */ n(i, {
33
33
  label: "List Type",
34
34
  value: a,
35
35
  onChange: l("subType"),
@@ -16,7 +16,7 @@ var n = e()({
16
16
  definition: {
17
17
  label: "List",
18
18
  type: "list",
19
- description: "Repeats a template (its listItem/link child) once per entry of a data array — the way to render a dynamic collection. Bind its items to a data source (e.g. an apiContainer response).",
19
+ description: "Repeats a template (its row: a listItem, or a container with subType \"li\") once per entry of a data array — the way to render a dynamic collection, as a <ul> (subType \"ol\" for a numbered one). Bind its items to a data source (e.g. an apiContainer response).",
20
20
  items: [],
21
21
  bindings: {},
22
22
  styleSelectors: { base: "" },
@@ -2,9 +2,11 @@ import { ReactNode, RefObject } from 'react';
2
2
  export type ListControlledProps<T = unknown> = {
3
3
  ref?: RefObject<HTMLElement>;
4
4
  className: string;
5
+ /** The list's own tag: a list of data is a list, and each row — an `<li>` — renders straight into it. */
6
+ subType?: 'ul' | 'ol';
5
7
  children: ReactNode;
6
8
  items: T[];
7
9
  itemKey?: string;
8
10
  };
9
- declare const ListControlled: ({ ref, className, children, items, itemKey }: ListControlledProps) => import('react').JSX.Element;
11
+ declare const ListControlled: ({ ref, className, subType, children, items, itemKey }: ListControlledProps) => import('react').JSX.Element;
10
12
  export default ListControlled;
@@ -13,27 +13,28 @@ import m from "clsx";
13
13
  import h from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
14
14
  import g from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
15
15
  //#region src/elements/structure/List/modes/ListControlled/ListControlled.tsx
16
- var _ = ({ ref: _, className: v = "", children: y, items: b = [], itemKey: x }) => {
17
- let { id: S, definition: { label: C } } = e(), w = h(i.sourceType, S), { settings: { previewMode: T } } = s(), E = o(() => Array.isArray(b) ? b : [], [b]), D = o(() => n(E, x), [E, x]), O = a(() => d({
18
- item: c(E, "0", {}),
16
+ var _ = ({ ref: _, className: v = "", subType: y = "ul", children: b, items: x = [], itemKey: S }) => {
17
+ let { id: C, definition: { label: w } } = e(), T = h(i.sourceType, C), { settings: { previewMode: E } } = s(), D = o(() => Array.isArray(x) ? x : [], [x]), O = o(() => n(D, S), [D, S]), k = a(() => d({
18
+ item: c(D, "0", {}),
19
19
  index: 0
20
20
  }).reduce((e, t) => [...e, {
21
21
  path: t,
22
22
  name: t
23
- }], []), [E]), k = o(() => w ? { runtime: { sources: { [w]: { items: E } } } } : u, [w, E]);
23
+ }], []), [D]), A = o(() => T ? { runtime: { sources: { [T]: { items: D } } } } : u, [T, D]);
24
24
  return g({
25
- id: S,
26
- source: w,
27
- name: C || `List - ${S}`,
28
- fields: O
25
+ id: C,
26
+ source: T,
27
+ name: w || `List - ${C}`,
28
+ fields: k
29
29
  }), /* @__PURE__ */ p(t, {
30
30
  ref: _,
31
- className: m("plitzi-component__controlled-list", v, { "controlled-list--build-mode": !T }),
31
+ tag: y,
32
+ className: m("plitzi-component__controlled-list", v, { "controlled-list--build-mode": !E }),
32
33
  children: [/* @__PURE__ */ f(l, {
33
34
  inherit: "live",
34
- name: `List:${S}`,
35
- value: k,
36
- children: E.map((e, t) => !y || Array.isArray(y) && y.length === 0 ? /* @__PURE__ */ f("div", {
35
+ name: `List:${C}`,
36
+ value: A,
37
+ children: D.map((e, t) => !b || Array.isArray(b) && b.length === 0 ? /* @__PURE__ */ f("div", {
37
38
  className: "plitzi-component__controlled-list-item controlled-list--empty",
38
39
  children: /* @__PURE__ */ f("div", {
39
40
  className: "controlled-list-item__counter",
@@ -41,12 +42,12 @@ var _ = ({ ref: _, className: v = "", children: y, items: b = [], itemKey: x })
41
42
  })
42
43
  }, t) : /* @__PURE__ */ f(r, {
43
44
  index: t,
44
- isTemplate: t !== 0 && !T,
45
+ isTemplate: t !== 0 && !E,
45
46
  record: e,
46
- source: w,
47
- children: y
48
- }, D[t]))
49
- }), !T && E.length === 0 && /* @__PURE__ */ f("div", {
47
+ source: T,
48
+ children: b
49
+ }, O[t]))
50
+ }), !E && D.length === 0 && /* @__PURE__ */ f("div", {
50
51
  className: "controlled-list controlled-list--empty",
51
52
  children: "This list does not contain any items"
52
53
  })]