@plitzi/sdk-elements 0.38.6 → 0.38.8

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 (120) hide show
  1. package/CHANGELOG.md +397 -0
  2. package/dist/Element/ServerStaticShell.d.ts +7 -1
  3. package/dist/Element/ServerStaticShell.mjs +11 -11
  4. package/dist/Element/hooks/useInternalItems.mjs +2 -1
  5. package/dist/Element/hooks/useRscData.d.ts +1 -1
  6. package/dist/components/MarkdownDocument/MarkdownDocument.d.ts +32 -0
  7. package/dist/components/MarkdownDocument/MarkdownDocument.mjs +32 -0
  8. package/dist/components/MarkdownDocument/components/CodeBlock/CodeBlock.d.ts +14 -0
  9. package/dist/components/MarkdownDocument/components/CodeBlock/CodeBlock.mjs +34 -0
  10. package/dist/components/MarkdownDocument/components/CodeBlock/index.d.ts +3 -0
  11. package/dist/components/MarkdownDocument/components/CodeBlock/index.mjs +5 -0
  12. package/dist/components/MarkdownDocument/helpers/hastText.d.ts +10 -0
  13. package/dist/components/MarkdownDocument/helpers/hastText.mjs +4 -0
  14. package/dist/components/MarkdownDocument/helpers/markdownComponents.d.ts +10 -0
  15. package/dist/components/MarkdownDocument/helpers/markdownComponents.mjs +89 -0
  16. package/dist/components/MarkdownDocument/helpers/markdownParts.d.ts +16 -0
  17. package/dist/components/MarkdownDocument/helpers/markdownParts.mjs +4 -0
  18. package/dist/components/MarkdownDocument/helpers/rehypeHeadingAnchors.d.ts +8 -0
  19. package/dist/components/MarkdownDocument/helpers/rehypeHeadingAnchors.mjs +20 -0
  20. package/dist/components/MarkdownDocument/helpers/syntaxHighlighter.d.ts +3 -0
  21. package/dist/components/MarkdownDocument/helpers/syntaxHighlighter.mjs +24 -0
  22. package/dist/components/MarkdownDocument/index.d.ts +5 -0
  23. package/dist/components/MarkdownDocument/index.mjs +6 -0
  24. package/dist/dataSource/GlobalSources.mjs +101 -113
  25. package/dist/elements/advanced/Custom/declaration.d.ts +5 -1
  26. package/dist/elements/advanced/Custom/declaration.mjs +5 -1
  27. package/dist/elements/advanced/Custom/index.d.ts +5 -1
  28. package/dist/elements/basic/Button/declaration.d.ts +46 -34
  29. package/dist/elements/basic/Button/declaration.mjs +18 -42
  30. package/dist/elements/basic/Button/index.d.ts +46 -34
  31. package/dist/elements/basic/Dropdown/DropdownPopup/declaration.d.ts +2 -0
  32. package/dist/elements/basic/Dropdown/DropdownPopup/declaration.mjs +2 -0
  33. package/dist/elements/basic/Dropdown/DropdownPopup/index.d.ts +2 -0
  34. package/dist/elements/basic/Dropdown/index.d.ts +2 -0
  35. package/dist/elements/basic/Heading/declaration.d.ts +5 -1
  36. package/dist/elements/basic/Heading/declaration.mjs +5 -1
  37. package/dist/elements/basic/Heading/index.d.ts +5 -1
  38. package/dist/elements/basic/Link/Link.d.ts +7 -1
  39. package/dist/elements/basic/Link/Link.mjs +27 -27
  40. package/dist/elements/basic/Link/Settings.d.ts +2 -1
  41. package/dist/elements/basic/Link/Settings.mjs +42 -29
  42. package/dist/elements/basic/Link/ariaCurrent.d.ts +12 -0
  43. package/dist/elements/basic/Link/ariaCurrent.mjs +11 -0
  44. package/dist/elements/basic/Link/declaration.d.ts +5 -1
  45. package/dist/elements/basic/Link/declaration.mjs +7 -4
  46. package/dist/elements/basic/Link/index.d.ts +5 -1
  47. package/dist/elements/basic/Markdown/Markdown.d.ts +6 -1
  48. package/dist/elements/basic/Markdown/Markdown.mjs +19 -15
  49. package/dist/elements/basic/Markdown/Settings.d.ts +2 -1
  50. package/dist/elements/basic/Markdown/Settings.mjs +16 -10
  51. package/dist/elements/basic/Markdown/declaration.d.ts +32 -5
  52. package/dist/elements/basic/Markdown/declaration.mjs +37 -7
  53. package/dist/elements/basic/Markdown/hooks/useMarkdownClassNames.d.ts +7 -0
  54. package/dist/elements/basic/Markdown/hooks/useMarkdownClassNames.mjs +13 -0
  55. package/dist/elements/basic/Markdown/index.d.ts +32 -5
  56. package/dist/elements/basic/RichText/RichText.mjs +27 -20
  57. package/dist/elements/basic/RichText/classHtmlParts.d.ts +14 -0
  58. package/dist/elements/basic/RichText/classHtmlParts.mjs +48 -0
  59. package/dist/elements/basic/RichText/declaration.d.ts +28 -1
  60. package/dist/elements/basic/RichText/declaration.mjs +31 -2
  61. package/dist/elements/basic/RichText/index.d.ts +28 -1
  62. package/dist/elements/basic/Text/declaration.d.ts +0 -2
  63. package/dist/elements/basic/Text/declaration.mjs +1 -5
  64. package/dist/elements/basic/Text/index.d.ts +0 -2
  65. package/dist/elements/basic/ThemeToggle/ThemeToggle.mjs +20 -18
  66. package/dist/elements/basic/ThemeToggle/declaration.d.ts +48 -4
  67. package/dist/elements/basic/ThemeToggle/declaration.mjs +32 -8
  68. package/dist/elements/basic/ThemeToggle/index.d.ts +48 -4
  69. package/dist/elements/declarations/index.d.ts +781 -318
  70. package/dist/elements/form/FormControl/FormControl.mjs +51 -53
  71. package/dist/elements/form/FormControl/Settings.mjs +4 -0
  72. package/dist/elements/form/FormControl/components/Label.d.ts +3 -1
  73. package/dist/elements/form/FormControl/components/Label.mjs +5 -5
  74. package/dist/elements/form/FormControl/declaration.d.ts +479 -233
  75. package/dist/elements/form/FormControl/declaration.mjs +142 -76
  76. package/dist/elements/form/FormControl/helpers/isChecked.d.ts +8 -0
  77. package/dist/elements/form/FormControl/helpers/isChecked.mjs +4 -0
  78. package/dist/elements/form/FormControl/hocs/withFieldValue.mjs +2 -6
  79. package/dist/elements/form/FormControl/index.d.ts +479 -233
  80. package/dist/elements/form/FormControl/inputs/Checkbox.d.ts +7 -3
  81. package/dist/elements/form/FormControl/inputs/Checkbox.mjs +7 -6
  82. package/dist/elements/form/FormControl/inputs/Input.d.ts +6 -1
  83. package/dist/elements/form/FormControl/inputs/Input.mjs +29 -29
  84. package/dist/elements/form/FormControl/inputs/Select.d.ts +4 -1
  85. package/dist/elements/form/FormControl/inputs/Select.mjs +15 -15
  86. package/dist/elements/internal/NotFound/declaration.d.ts +5 -1
  87. package/dist/elements/internal/NotFound/declaration.mjs +5 -1
  88. package/dist/elements/internal/NotFound/index.d.ts +5 -1
  89. package/dist/elements/internal/Page/declaration.d.ts +1 -2
  90. package/dist/elements/internal/Page/declaration.mjs +2 -3
  91. package/dist/elements/internal/Page/index.d.ts +1 -2
  92. package/dist/elements/media/Image/declaration.d.ts +3 -2
  93. package/dist/elements/media/Image/declaration.mjs +3 -2
  94. package/dist/elements/media/Image/index.d.ts +3 -2
  95. package/dist/elements/provider/ApiContainer/ApiContainer.mjs +89 -80
  96. package/dist/elements/provider/ApiContainer/hooks/useApi.mjs +23 -23
  97. package/dist/elements/provider/ApiContainer/hooks/useProviderWrite.mjs +5 -5
  98. package/dist/elements/structure/Carousel/CarouselTrack/declaration.d.ts +4 -1
  99. package/dist/elements/structure/Carousel/CarouselTrack/declaration.mjs +4 -1
  100. package/dist/elements/structure/Carousel/CarouselTrack/index.d.ts +4 -1
  101. package/dist/elements/structure/Carousel/index.d.ts +4 -1
  102. package/dist/elements/structure/DialogContainer/DialogContainer.mjs +2 -2
  103. package/dist/elements/structure/DialogContainer/declaration.d.ts +72 -12
  104. package/dist/elements/structure/DialogContainer/declaration.mjs +58 -17
  105. package/dist/elements/structure/DialogContainer/index.d.ts +72 -12
  106. package/dist/elements/structure/List/declaration.d.ts +5 -1
  107. package/dist/elements/structure/List/declaration.mjs +5 -1
  108. package/dist/elements/structure/List/index.d.ts +5 -1
  109. package/dist/elements/structure/ModalContainer/declaration.d.ts +36 -16
  110. package/dist/elements/structure/ModalContainer/declaration.mjs +42 -24
  111. package/dist/elements/structure/ModalContainer/index.d.ts +36 -16
  112. package/dist/elements/structure/Pagination/Pagination.mjs +23 -23
  113. package/dist/elements/structure/Pagination/declaration.d.ts +5 -1
  114. package/dist/elements/structure/Pagination/declaration.mjs +8 -2
  115. package/dist/elements/structure/Pagination/index.d.ts +5 -1
  116. package/dist/elements/structure/TabContainer/TabContainerItem/TabContainerItem.mjs +2 -1
  117. package/dist/index.d.ts +781 -318
  118. package/package.json +77 -13
  119. package/dist/elements/basic/Link/isCurrentPage.d.ts +0 -5
  120. package/dist/elements/basic/Link/isCurrentPage.mjs +0 -12
@@ -1,30 +1,37 @@
1
1
  import e from "../../../Element/hocs/withElement.mjs";
2
- import { RootElement as t } from "../../../Element/RootElement.mjs";
3
- import { rebaseHtmlMedia as n, sanitizeHtml as r } from "./sanitizeHtml.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";
2
+ import t from "../../../Element/hooks/useElement.mjs";
3
+ import { RootElement as n } from "../../../Element/RootElement.mjs";
4
+ import r from "../../../components/MarkdownDocument/index.mjs";
5
+ import i from "../Markdown/hooks/useMarkdownClassNames.mjs";
6
+ import { classHtmlParts as a } from "./classHtmlParts.mjs";
7
+ import { rebaseHtmlMedia as o, sanitizeHtml as s } from "./sanitizeHtml.mjs";
8
+ import { useMemo as c } from "react";
9
+ import l from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
10
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
11
+ import f from "clsx";
9
12
  //#region src/elements/basic/RichText/RichText.tsx
10
- var u = ({ ref: e, className: u = "", content: d = "", format: f = "html", mediaBaseUrl: p = "" }) => {
11
- let { settings: { previewMode: m } } = a(), h = i(() => f === "html" ? n(r(d), p) : "", [
12
- f,
13
- d,
14
- p
13
+ var p = ({ ref: e, className: p = "", content: m = "", format: h = "html", mediaBaseUrl: g = "" }) => {
14
+ let { settings: { previewMode: _ } } = l(), { definition: { styleSelectors: v } } = t(), y = i(v), b = c(() => h === "html" ? a(o(s(m), g), y) : "", [
15
+ h,
16
+ m,
17
+ g,
18
+ y
15
19
  ]);
16
- return /* @__PURE__ */ s(t, {
20
+ return /* @__PURE__ */ d(n, {
17
21
  ref: e,
18
- className: c("plitzi-component__rich-text", { "plitzi-component__rich-text--edit-mode": !m }, u),
22
+ className: f("plitzi-component__rich-text", { "plitzi-component__rich-text--edit-mode": !_ }, p),
19
23
  children: [
20
- f === "html" && /* @__PURE__ */ o("div", { dangerouslySetInnerHTML: { __html: h } }),
21
- f === "markdown" && /* @__PURE__ */ o(l, { children: d }),
22
- f === "text" && /* @__PURE__ */ o("div", {
24
+ h === "html" && /* @__PURE__ */ u("div", { dangerouslySetInnerHTML: { __html: b } }),
25
+ h === "markdown" && /* @__PURE__ */ u(r, {
26
+ classNames: y,
27
+ children: m
28
+ }),
29
+ h === "text" && /* @__PURE__ */ u("div", {
23
30
  className: "plitzi-component__rich-text-plain",
24
- children: d
31
+ children: m
25
32
  })
26
33
  ]
27
34
  });
28
- }, d = e(u);
35
+ }, m = e(p);
29
36
  //#endregion
30
- export { u as RichText, d as default };
37
+ export { p as RichText, m as default };
@@ -0,0 +1,14 @@
1
+ import { MarkdownClassNames, MarkdownPart } from '../../../components/MarkdownDocument';
2
+ /**
3
+ * The part each tag of a body's HTML is, named as the parts of a Markdown document are, so one set of slots dresses
4
+ * a body whichever format the CMS returns it in. `b` and `i` are the `strong` and `emphasis` an older editor writes.
5
+ */
6
+ export declare const HTML_TAG_PARTS: Readonly<Partial<Record<string, readonly MarkdownPart[]>>>;
7
+ /**
8
+ * A body's HTML with the class of each of its parts on the tags that are that part.
9
+ *
10
+ * Read off the markup as a string, as the sanitizer reads it, so the server renders the same classes the browser does.
11
+ * `code` is inline code, as in a Markdown document: the `code` of a `pre` is the block's, and the `pre` takes
12
+ * `codeBlock`.
13
+ */
14
+ export declare const classHtmlParts: (html: string, classNames: MarkdownClassNames) => string;
@@ -0,0 +1,48 @@
1
+ import e from "clsx";
2
+ //#region src/elements/basic/RichText/classHtmlParts.ts
3
+ var t = {
4
+ h1: ["heading", "heading1"],
5
+ h2: ["heading", "heading2"],
6
+ h3: ["heading", "heading3"],
7
+ h4: ["heading", "heading4"],
8
+ h5: ["heading", "heading5"],
9
+ h6: ["heading", "heading6"],
10
+ p: ["paragraph"],
11
+ a: ["link"],
12
+ strong: ["strong"],
13
+ b: ["strong"],
14
+ em: ["emphasis"],
15
+ i: ["emphasis"],
16
+ ul: ["list"],
17
+ ol: ["list"],
18
+ li: ["listItem"],
19
+ blockquote: ["quote"],
20
+ hr: ["divider"],
21
+ code: ["code"],
22
+ pre: ["codeBlock"],
23
+ img: ["image"],
24
+ table: ["table"],
25
+ thead: ["tableHead"],
26
+ tr: ["tableRow"],
27
+ th: ["tableHeaderCell"],
28
+ td: ["tableCell"]
29
+ }, n = /<(\/?)([a-zA-Z][a-zA-Z0-9]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g, r = /\sclass\s*=\s*("[^"]*"|'[^']*'|[^\s"'>]+)/i, i = /^["']|["']$/g, a = /\s*\/$/, o = (t, n) => {
30
+ let o = r.exec(t);
31
+ if (o) {
32
+ let a = o[1].replace(i, "");
33
+ return t.replace(r, ` class="${e(a, n)}"`);
34
+ }
35
+ let s = a.exec(t)?.[0] ?? "";
36
+ return `${t.slice(0, t.length - s.length)} class="${n}"${s}`;
37
+ }, s = (r, i) => {
38
+ if (!Object.values(i).some(Boolean)) return r;
39
+ let a = 0;
40
+ return r.replace(n, (n, r, s, c) => {
41
+ let l = s.toLowerCase();
42
+ if (l === "pre" && (a = Math.max(a + (r ? -1 : 1), 0)), r || l === "code" && a > 0) return n;
43
+ let u = e((t[l] ?? []).map((e) => i[e]));
44
+ return u ? `<${s}${o(c, u)}>` : n;
45
+ });
46
+ };
47
+ //#endregion
48
+ export { t as HTML_TAG_PARTS, s as classHtmlParts };
@@ -16,11 +16,38 @@ declare const declaration: {
16
16
  readonly definition: {
17
17
  readonly label: "Rich Text";
18
18
  readonly type: "richText";
19
- readonly 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.";
19
+ readonly description: string;
20
20
  readonly items: readonly [];
21
21
  readonly bindings: {};
22
22
  readonly styleSelectors: {
23
23
  readonly base: "";
24
+ readonly heading: "";
25
+ readonly heading1: "";
26
+ readonly heading2: "";
27
+ readonly heading3: "";
28
+ readonly heading4: "";
29
+ readonly heading5: "";
30
+ readonly heading6: "";
31
+ readonly paragraph: "";
32
+ readonly link: "";
33
+ readonly strong: "";
34
+ readonly emphasis: "";
35
+ readonly list: "";
36
+ readonly listItem: "";
37
+ readonly quote: "";
38
+ readonly divider: "";
39
+ readonly code: "";
40
+ readonly codeBlock: "";
41
+ readonly codeBlockFrame: "";
42
+ readonly codeBlockHeader: "";
43
+ readonly codeBlockLanguage: "";
44
+ readonly codeBlockCopy: "";
45
+ readonly image: "";
46
+ readonly table: "";
47
+ readonly tableHead: "";
48
+ readonly tableRow: "";
49
+ readonly tableHeaderCell: "";
50
+ readonly tableCell: "";
24
51
  };
25
52
  readonly initialState: {
26
53
  readonly visibility: true;
@@ -16,10 +16,39 @@ var n = e()({
16
16
  definition: {
17
17
  label: "Rich Text",
18
18
  type: "richText",
19
- 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.",
19
+ 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. The parts of an HTML or markdown body take a class through the slots a `markdown` has, by the same names: `heading` and `heading1`…`heading6` (a property on one of the two, never both), `paragraph`, `link`, `strong` (`strong`/`b`), `emphasis` (`em`/`i`), `list`, `listItem`, `quote`, `divider`, `code` (inline), `codeBlock` (`pre`), `image`, `table`, `tableHead`, `tableRow`, `tableHeaderCell`, `tableCell`; the fenced block of a markdown body also sits in `codeBlockFrame`, under `codeBlockHeader` with `codeBlockLanguage` and `codeBlockCopy`. Unstyled, a body reads as a document from the base layer of the SDK, which a class on the slot of a part replaces property by property.",
20
20
  items: [],
21
21
  bindings: {},
22
- styleSelectors: { base: "" },
22
+ styleSelectors: {
23
+ base: "",
24
+ heading: "",
25
+ heading1: "",
26
+ heading2: "",
27
+ heading3: "",
28
+ heading4: "",
29
+ heading5: "",
30
+ heading6: "",
31
+ paragraph: "",
32
+ link: "",
33
+ strong: "",
34
+ emphasis: "",
35
+ list: "",
36
+ listItem: "",
37
+ quote: "",
38
+ divider: "",
39
+ code: "",
40
+ codeBlock: "",
41
+ codeBlockFrame: "",
42
+ codeBlockHeader: "",
43
+ codeBlockLanguage: "",
44
+ codeBlockCopy: "",
45
+ image: "",
46
+ table: "",
47
+ tableHead: "",
48
+ tableRow: "",
49
+ tableHeaderCell: "",
50
+ tableCell: ""
51
+ },
23
52
  initialState: { visibility: !0 }
24
53
  },
25
54
  builder: {
@@ -15,11 +15,38 @@ declare const RichText: {
15
15
  readonly definition: {
16
16
  readonly label: "Rich Text";
17
17
  readonly type: "richText";
18
- readonly 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.";
18
+ readonly description: string;
19
19
  readonly items: readonly [];
20
20
  readonly bindings: {};
21
21
  readonly styleSelectors: {
22
22
  readonly base: "";
23
+ readonly heading: "";
24
+ readonly heading1: "";
25
+ readonly heading2: "";
26
+ readonly heading3: "";
27
+ readonly heading4: "";
28
+ readonly heading5: "";
29
+ readonly heading6: "";
30
+ readonly paragraph: "";
31
+ readonly link: "";
32
+ readonly strong: "";
33
+ readonly emphasis: "";
34
+ readonly list: "";
35
+ readonly listItem: "";
36
+ readonly quote: "";
37
+ readonly divider: "";
38
+ readonly code: "";
39
+ readonly codeBlock: "";
40
+ readonly codeBlockFrame: "";
41
+ readonly codeBlockHeader: "";
42
+ readonly codeBlockLanguage: "";
43
+ readonly codeBlockCopy: "";
44
+ readonly image: "";
45
+ readonly table: "";
46
+ readonly tableHead: "";
47
+ readonly tableRow: "";
48
+ readonly tableHeaderCell: "";
49
+ readonly tableCell: "";
23
50
  };
24
51
  readonly initialState: {
25
52
  readonly visibility: true;
@@ -44,8 +44,6 @@ declare const declaration: {
44
44
  readonly style: {
45
45
  readonly base: {
46
46
  readonly default: {
47
- readonly 'font-size': "14px";
48
- readonly 'line-height': "1.714";
49
47
  readonly display: "inline";
50
48
  };
51
49
  };
@@ -33,11 +33,7 @@ var t = e()({
33
33
  defaultStyle: {
34
34
  name: "Text",
35
35
  displayMode: "desktop",
36
- style: { base: { default: {
37
- "font-size": "14px",
38
- "line-height": "1.714",
39
- display: "inline"
40
- } } }
36
+ style: { base: { default: { display: "inline" } } }
41
37
  },
42
38
  settings: {}
43
39
  }
@@ -43,8 +43,6 @@ declare const Text: {
43
43
  readonly style: {
44
44
  readonly base: {
45
45
  readonly default: {
46
- readonly 'font-size': "14px";
47
- readonly 'line-height': "1.714";
48
46
  readonly display: "inline";
49
47
  };
50
48
  };
@@ -37,11 +37,11 @@ var h = () => () => {}, g = () => !0, _ = () => !1, v = () => /* @__PURE__ */ f(
37
37
  d: "M20.5 14.3A8.6 8.6 0 0 1 9.7 3.5a8.6 8.6 0 1 0 10.8 10.8Z"
38
38
  })
39
39
  }), b = ({ ref: e, className: b = "", subType: x = "switch", lightLabel: S = "Light", darkLabel: C = "Dark", systemLabel: w = "System", showSystem: T = !1 }) => {
40
- let { theme: E, setTheme: D, toggleTheme: O } = m(), { id: k, definition: { styleSelectors: A } } = t(), { settings: { previewMode: j }, contexts: { InteractionsContext: M } } = u(), { interactionsManager: N } = i(M), P = l(h, g, _), F = a((e) => (t) => {
41
- t.preventDefault(), j && D(e);
42
- }, [j, D]), I = a((e) => {
43
- e.preventDefault(), j && O();
44
- }, [j, O]), L = s(() => [
40
+ let { theme: E, resolvedTheme: D, setTheme: O, toggleTheme: k } = m(), { id: A, definition: { styleSelectors: j } } = t(), { settings: { previewMode: M }, contexts: { InteractionsContext: N } } = u(), { interactionsManager: P } = i(N), F = l(h, g, _), I = a((e) => (t) => {
41
+ t.preventDefault(), M && O(e);
42
+ }, [M, O]), L = a((e) => {
43
+ e.preventDefault(), M && k();
44
+ }, [M, k]), R = s(() => [
45
45
  ...T ? [{
46
46
  value: "system",
47
47
  label: w,
@@ -62,14 +62,14 @@ var h = () => () => {}, g = () => !0, _ = () => !1, v = () => /* @__PURE__ */ f(
62
62
  w,
63
63
  S,
64
64
  C
65
- ]), R = c(null);
65
+ ]), z = c(null);
66
66
  return o(() => {
67
- let e = R.current;
68
- R.current = E, e !== null && e !== E && N.interactionTrigger(k, "onThemeChange", { theme: E });
67
+ let e = z.current;
68
+ z.current = E, e !== null && e !== E && P.interactionTrigger(A, "onThemeChange", { theme: E });
69
69
  }, [
70
70
  E,
71
- N,
72
- k
71
+ P,
72
+ A
73
73
  ]), x === "segmented" ? /* @__PURE__ */ d(n, {
74
74
  ref: e,
75
75
  tag: "div",
@@ -77,13 +77,13 @@ var h = () => () => {}, g = () => !0, _ = () => !1, v = () => /* @__PURE__ */ f(
77
77
  "aria-label": `${S} / ${C}`,
78
78
  className: p("plitzi-component__theme-toggle plitzi-component__theme-toggle--segmented", b),
79
79
  interactionTriggers: r.triggers,
80
- children: L.map((e) => /* @__PURE__ */ f("button", {
80
+ children: R.map((e) => /* @__PURE__ */ f("button", {
81
81
  type: "button",
82
- className: p("plitzi-component__theme-toggle-option", A.option),
83
- "data-active": P && E === e.value ? "true" : void 0,
84
- "aria-pressed": P ? E === e.value : void 0,
82
+ className: p("plitzi-component__theme-toggle-option", j.option),
83
+ "data-active": F && E === e.value ? "true" : void 0,
84
+ "aria-pressed": F ? E === e.value : void 0,
85
85
  "data-theme-option": e.value,
86
- onClick: F(e.value),
86
+ onClick: I(e.value),
87
87
  children: [e.icon, /* @__PURE__ */ d("span", { children: e.label })]
88
88
  }, e.value))
89
89
  }) : /* @__PURE__ */ f(n, {
@@ -92,16 +92,18 @@ var h = () => () => {}, g = () => !0, _ = () => !1, v = () => /* @__PURE__ */ f(
92
92
  className: p("plitzi-component__theme-toggle plitzi-component__theme-toggle--switch", b),
93
93
  interactionTriggers: r.triggers,
94
94
  type: "button",
95
- onClick: I,
95
+ onClick: L,
96
96
  "aria-label": `${S} / ${C}`,
97
97
  title: `${S} / ${C}`,
98
98
  children: [/* @__PURE__ */ d("span", {
99
- className: p("plitzi-component__theme-toggle-icon", A.icon),
99
+ className: p("plitzi-component__theme-toggle-icon", j.icon),
100
100
  "data-theme-icon": "light",
101
+ "aria-current": F && D === "light" ? "true" : void 0,
101
102
  children: /* @__PURE__ */ d(v, {})
102
103
  }), /* @__PURE__ */ d("span", {
103
- className: p("plitzi-component__theme-toggle-icon", A.icon),
104
+ className: p("plitzi-component__theme-toggle-icon", j.icon),
104
105
  "data-theme-icon": "dark",
106
+ "aria-current": F && D === "dark" ? "true" : void 0,
105
107
  children: /* @__PURE__ */ d(y, {})
106
108
  })]
107
109
  });
@@ -29,7 +29,7 @@ declare const declaration: {
29
29
  readonly definition: {
30
30
  readonly label: "Theme Toggle";
31
31
  readonly type: "themeToggle";
32
- readonly description: "Lets a visitor choose light or dark. It writes the choice on the document root, where a space stylesheet is already looking for it, and remembers it — so the machine decides until somebody says otherwise. It ships no colours of its own: style it with the space own classes. It shows the icon of the scheme in use by default; key a rule off `data-theme-icon` to change that.";
32
+ readonly description: string;
33
33
  readonly items: readonly [];
34
34
  readonly bindings: {};
35
35
  readonly styleSelectors: {
@@ -65,9 +65,53 @@ declare const declaration: {
65
65
  readonly style: {
66
66
  readonly base: {
67
67
  readonly default: {
68
- readonly display: "inline-flex";
69
- readonly 'align-items': "center";
70
- readonly cursor: "pointer";
68
+ 'margin-top': string;
69
+ 'margin-right': string;
70
+ 'margin-bottom': string;
71
+ 'margin-left': string;
72
+ 'padding-top': string;
73
+ 'padding-right': string;
74
+ 'padding-bottom': string;
75
+ 'padding-left': string;
76
+ display: string;
77
+ 'align-items': string;
78
+ 'background-color': string;
79
+ color: string;
80
+ 'font-family': string;
81
+ 'font-size': string;
82
+ 'font-style': string;
83
+ 'font-weight': string;
84
+ 'line-height': string;
85
+ 'letter-spacing': string;
86
+ cursor: string;
87
+ };
88
+ };
89
+ readonly icon: {
90
+ readonly default: {};
91
+ };
92
+ readonly option: {
93
+ readonly default: {
94
+ readonly 'row-gap': "4px";
95
+ readonly 'column-gap': "4px";
96
+ readonly 'margin-top': string;
97
+ readonly 'margin-right': string;
98
+ readonly 'margin-bottom': string;
99
+ readonly 'margin-left': string;
100
+ readonly 'padding-top': string;
101
+ readonly 'padding-right': string;
102
+ readonly 'padding-bottom': string;
103
+ readonly 'padding-left': string;
104
+ readonly display: string;
105
+ readonly 'align-items': string;
106
+ readonly 'background-color': string;
107
+ readonly color: string;
108
+ readonly 'font-family': string;
109
+ readonly 'font-size': string;
110
+ readonly 'font-style': string;
111
+ readonly 'font-weight': string;
112
+ readonly 'line-height': string;
113
+ readonly 'letter-spacing': string;
114
+ readonly cursor: string;
71
115
  };
72
116
  };
73
117
  };
@@ -1,6 +1,26 @@
1
1
  import { elementDeclaration as e, valuesOf as t } from "@plitzi/sdk-shared/authoring/declare";
2
2
  //#region src/elements/basic/ThemeToggle/declaration.ts
3
- var n = e()({
3
+ var n = {
4
+ "margin-top": "0px",
5
+ "margin-right": "0px",
6
+ "margin-bottom": "0px",
7
+ "margin-left": "0px",
8
+ "padding-top": "0px",
9
+ "padding-right": "0px",
10
+ "padding-bottom": "0px",
11
+ "padding-left": "0px",
12
+ display: "inline-flex",
13
+ "align-items": "center",
14
+ "background-color": "transparent",
15
+ color: "inherit",
16
+ "font-family": "inherit",
17
+ "font-size": "inherit",
18
+ "font-style": "inherit",
19
+ "font-weight": "inherit",
20
+ "line-height": "inherit",
21
+ "letter-spacing": "inherit",
22
+ cursor: "pointer"
23
+ }, r = e()({
4
24
  type: "themeToggle",
5
25
  attributeValues: { subType: t()(["switch", "segmented"]) },
6
26
  triggers: { onThemeChange: {
@@ -21,7 +41,7 @@ var n = e()({
21
41
  definition: {
22
42
  label: "Theme Toggle",
23
43
  type: "themeToggle",
24
- description: "Lets a visitor choose light or dark. It writes the choice on the document root, where a space stylesheet is already looking for it, and remembers it — so the machine decides until somebody says otherwise. It ships no colours of its own: style it with the space own classes. It shows the icon of the scheme in use by default; key a rule off `data-theme-icon` to change that.",
44
+ description: "Lets a visitor choose light or dark. It writes the choice on the document root, where a space stylesheet is already looking for it, and remembers it — so the machine decides until somebody says otherwise. It ships no colours of its own: its buttons carry no browser look and take the colour and type around them — style them with the space own classes. A `segmented` one marks the chosen option with `aria-pressed`, which is the `current` state of its `option` slot. It shows the icon of the scheme in use by default; key a rule off `data-theme-icon` to change that. A `switch` marks the icon of the scheme in use — the one chosen, or the machine one while none is — with `aria-current`, the `current` state of its `icon` slot.",
25
45
  items: [],
26
46
  bindings: {},
27
47
  styleSelectors: {
@@ -52,15 +72,19 @@ var n = e()({
52
72
  defaultStyle: {
53
73
  name: "Theme Toggle",
54
74
  displayMode: "desktop",
55
- style: { base: { default: {
56
- display: "inline-flex",
57
- "align-items": "center",
58
- cursor: "pointer"
59
- } } },
75
+ style: {
76
+ base: { default: n },
77
+ icon: { default: {} },
78
+ option: { default: {
79
+ ...n,
80
+ "row-gap": "4px",
81
+ "column-gap": "4px"
82
+ } }
83
+ },
60
84
  subTypes: {}
61
85
  },
62
86
  settings: {}
63
87
  }
64
88
  });
65
89
  //#endregion
66
- export { n as default };
90
+ export { r as default };
@@ -28,7 +28,7 @@ declare const ThemeToggle: {
28
28
  readonly definition: {
29
29
  readonly label: "Theme Toggle";
30
30
  readonly type: "themeToggle";
31
- readonly description: "Lets a visitor choose light or dark. It writes the choice on the document root, where a space stylesheet is already looking for it, and remembers it — so the machine decides until somebody says otherwise. It ships no colours of its own: style it with the space own classes. It shows the icon of the scheme in use by default; key a rule off `data-theme-icon` to change that.";
31
+ readonly description: string;
32
32
  readonly items: readonly [];
33
33
  readonly bindings: {};
34
34
  readonly styleSelectors: {
@@ -64,9 +64,53 @@ declare const ThemeToggle: {
64
64
  readonly style: {
65
65
  readonly base: {
66
66
  readonly default: {
67
- readonly display: "inline-flex";
68
- readonly 'align-items': "center";
69
- readonly cursor: "pointer";
67
+ 'margin-top': string;
68
+ 'margin-right': string;
69
+ 'margin-bottom': string;
70
+ 'margin-left': string;
71
+ 'padding-top': string;
72
+ 'padding-right': string;
73
+ 'padding-bottom': string;
74
+ 'padding-left': string;
75
+ display: string;
76
+ 'align-items': string;
77
+ 'background-color': string;
78
+ color: string;
79
+ 'font-family': string;
80
+ 'font-size': string;
81
+ 'font-style': string;
82
+ 'font-weight': string;
83
+ 'line-height': string;
84
+ 'letter-spacing': string;
85
+ cursor: string;
86
+ };
87
+ };
88
+ readonly icon: {
89
+ readonly default: {};
90
+ };
91
+ readonly option: {
92
+ readonly default: {
93
+ readonly 'row-gap': "4px";
94
+ readonly 'column-gap': "4px";
95
+ readonly 'margin-top': string;
96
+ readonly 'margin-right': string;
97
+ readonly 'margin-bottom': string;
98
+ readonly 'margin-left': string;
99
+ readonly 'padding-top': string;
100
+ readonly 'padding-right': string;
101
+ readonly 'padding-bottom': string;
102
+ readonly 'padding-left': string;
103
+ readonly display: string;
104
+ readonly 'align-items': string;
105
+ readonly 'background-color': string;
106
+ readonly color: string;
107
+ readonly 'font-family': string;
108
+ readonly 'font-size': string;
109
+ readonly 'font-style': string;
110
+ readonly 'font-weight': string;
111
+ readonly 'line-height': string;
112
+ readonly 'letter-spacing': string;
113
+ readonly cursor: string;
70
114
  };
71
115
  };
72
116
  };