@plitzi/sdk-elements 0.38.6 → 0.38.7

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 (117) hide show
  1. package/CHANGELOG.md +205 -0
  2. package/dist/Element/hooks/useRscData.d.ts +1 -1
  3. package/dist/components/MarkdownDocument/MarkdownDocument.d.ts +32 -0
  4. package/dist/components/MarkdownDocument/MarkdownDocument.mjs +32 -0
  5. package/dist/components/MarkdownDocument/components/CodeBlock/CodeBlock.d.ts +14 -0
  6. package/dist/components/MarkdownDocument/components/CodeBlock/CodeBlock.mjs +34 -0
  7. package/dist/components/MarkdownDocument/components/CodeBlock/index.d.ts +3 -0
  8. package/dist/components/MarkdownDocument/components/CodeBlock/index.mjs +5 -0
  9. package/dist/components/MarkdownDocument/helpers/hastText.d.ts +10 -0
  10. package/dist/components/MarkdownDocument/helpers/hastText.mjs +4 -0
  11. package/dist/components/MarkdownDocument/helpers/markdownComponents.d.ts +10 -0
  12. package/dist/components/MarkdownDocument/helpers/markdownComponents.mjs +89 -0
  13. package/dist/components/MarkdownDocument/helpers/markdownParts.d.ts +16 -0
  14. package/dist/components/MarkdownDocument/helpers/markdownParts.mjs +4 -0
  15. package/dist/components/MarkdownDocument/helpers/rehypeHeadingAnchors.d.ts +8 -0
  16. package/dist/components/MarkdownDocument/helpers/rehypeHeadingAnchors.mjs +20 -0
  17. package/dist/components/MarkdownDocument/helpers/syntaxHighlighter.d.ts +3 -0
  18. package/dist/components/MarkdownDocument/helpers/syntaxHighlighter.mjs +24 -0
  19. package/dist/components/MarkdownDocument/index.d.ts +5 -0
  20. package/dist/components/MarkdownDocument/index.mjs +6 -0
  21. package/dist/dataSource/GlobalSources.mjs +101 -113
  22. package/dist/elements/advanced/Custom/declaration.d.ts +5 -1
  23. package/dist/elements/advanced/Custom/declaration.mjs +5 -1
  24. package/dist/elements/advanced/Custom/index.d.ts +5 -1
  25. package/dist/elements/basic/Button/declaration.d.ts +46 -34
  26. package/dist/elements/basic/Button/declaration.mjs +18 -42
  27. package/dist/elements/basic/Button/index.d.ts +46 -34
  28. package/dist/elements/basic/Dropdown/DropdownPopup/declaration.d.ts +2 -0
  29. package/dist/elements/basic/Dropdown/DropdownPopup/declaration.mjs +2 -0
  30. package/dist/elements/basic/Dropdown/DropdownPopup/index.d.ts +2 -0
  31. package/dist/elements/basic/Dropdown/index.d.ts +2 -0
  32. package/dist/elements/basic/Heading/declaration.d.ts +5 -1
  33. package/dist/elements/basic/Heading/declaration.mjs +5 -1
  34. package/dist/elements/basic/Heading/index.d.ts +5 -1
  35. package/dist/elements/basic/Link/Link.d.ts +7 -1
  36. package/dist/elements/basic/Link/Link.mjs +27 -27
  37. package/dist/elements/basic/Link/Settings.d.ts +2 -1
  38. package/dist/elements/basic/Link/Settings.mjs +42 -29
  39. package/dist/elements/basic/Link/ariaCurrent.d.ts +12 -0
  40. package/dist/elements/basic/Link/ariaCurrent.mjs +11 -0
  41. package/dist/elements/basic/Link/declaration.d.ts +5 -1
  42. package/dist/elements/basic/Link/declaration.mjs +7 -4
  43. package/dist/elements/basic/Link/index.d.ts +5 -1
  44. package/dist/elements/basic/Markdown/Markdown.d.ts +6 -1
  45. package/dist/elements/basic/Markdown/Markdown.mjs +19 -15
  46. package/dist/elements/basic/Markdown/Settings.d.ts +2 -1
  47. package/dist/elements/basic/Markdown/Settings.mjs +16 -10
  48. package/dist/elements/basic/Markdown/declaration.d.ts +32 -5
  49. package/dist/elements/basic/Markdown/declaration.mjs +37 -7
  50. package/dist/elements/basic/Markdown/hooks/useMarkdownClassNames.d.ts +7 -0
  51. package/dist/elements/basic/Markdown/hooks/useMarkdownClassNames.mjs +13 -0
  52. package/dist/elements/basic/Markdown/index.d.ts +32 -5
  53. package/dist/elements/basic/RichText/RichText.mjs +27 -20
  54. package/dist/elements/basic/RichText/classHtmlParts.d.ts +14 -0
  55. package/dist/elements/basic/RichText/classHtmlParts.mjs +48 -0
  56. package/dist/elements/basic/RichText/declaration.d.ts +28 -1
  57. package/dist/elements/basic/RichText/declaration.mjs +31 -2
  58. package/dist/elements/basic/RichText/index.d.ts +28 -1
  59. package/dist/elements/basic/Text/declaration.d.ts +0 -2
  60. package/dist/elements/basic/Text/declaration.mjs +1 -5
  61. package/dist/elements/basic/Text/index.d.ts +0 -2
  62. package/dist/elements/basic/ThemeToggle/ThemeToggle.mjs +20 -18
  63. package/dist/elements/basic/ThemeToggle/declaration.d.ts +48 -4
  64. package/dist/elements/basic/ThemeToggle/declaration.mjs +32 -8
  65. package/dist/elements/basic/ThemeToggle/index.d.ts +48 -4
  66. package/dist/elements/declarations/index.d.ts +781 -318
  67. package/dist/elements/form/FormControl/FormControl.mjs +51 -53
  68. package/dist/elements/form/FormControl/Settings.mjs +4 -0
  69. package/dist/elements/form/FormControl/components/Label.d.ts +3 -1
  70. package/dist/elements/form/FormControl/components/Label.mjs +5 -5
  71. package/dist/elements/form/FormControl/declaration.d.ts +479 -233
  72. package/dist/elements/form/FormControl/declaration.mjs +142 -76
  73. package/dist/elements/form/FormControl/helpers/isChecked.d.ts +8 -0
  74. package/dist/elements/form/FormControl/helpers/isChecked.mjs +4 -0
  75. package/dist/elements/form/FormControl/hocs/withFieldValue.mjs +2 -6
  76. package/dist/elements/form/FormControl/index.d.ts +479 -233
  77. package/dist/elements/form/FormControl/inputs/Checkbox.d.ts +7 -3
  78. package/dist/elements/form/FormControl/inputs/Checkbox.mjs +7 -6
  79. package/dist/elements/form/FormControl/inputs/Input.d.ts +6 -1
  80. package/dist/elements/form/FormControl/inputs/Input.mjs +29 -29
  81. package/dist/elements/form/FormControl/inputs/Select.d.ts +4 -1
  82. package/dist/elements/form/FormControl/inputs/Select.mjs +15 -15
  83. package/dist/elements/internal/NotFound/declaration.d.ts +5 -1
  84. package/dist/elements/internal/NotFound/declaration.mjs +5 -1
  85. package/dist/elements/internal/NotFound/index.d.ts +5 -1
  86. package/dist/elements/internal/Page/declaration.d.ts +1 -2
  87. package/dist/elements/internal/Page/declaration.mjs +2 -3
  88. package/dist/elements/internal/Page/index.d.ts +1 -2
  89. package/dist/elements/media/Image/declaration.d.ts +3 -2
  90. package/dist/elements/media/Image/declaration.mjs +3 -2
  91. package/dist/elements/media/Image/index.d.ts +3 -2
  92. package/dist/elements/provider/ApiContainer/ApiContainer.mjs +89 -80
  93. package/dist/elements/provider/ApiContainer/hooks/useApi.mjs +23 -23
  94. package/dist/elements/provider/ApiContainer/hooks/useProviderWrite.mjs +5 -5
  95. package/dist/elements/structure/Carousel/CarouselTrack/declaration.d.ts +4 -1
  96. package/dist/elements/structure/Carousel/CarouselTrack/declaration.mjs +4 -1
  97. package/dist/elements/structure/Carousel/CarouselTrack/index.d.ts +4 -1
  98. package/dist/elements/structure/Carousel/index.d.ts +4 -1
  99. package/dist/elements/structure/DialogContainer/DialogContainer.mjs +2 -2
  100. package/dist/elements/structure/DialogContainer/declaration.d.ts +72 -12
  101. package/dist/elements/structure/DialogContainer/declaration.mjs +58 -17
  102. package/dist/elements/structure/DialogContainer/index.d.ts +72 -12
  103. package/dist/elements/structure/List/declaration.d.ts +5 -1
  104. package/dist/elements/structure/List/declaration.mjs +5 -1
  105. package/dist/elements/structure/List/index.d.ts +5 -1
  106. package/dist/elements/structure/ModalContainer/declaration.d.ts +36 -16
  107. package/dist/elements/structure/ModalContainer/declaration.mjs +42 -24
  108. package/dist/elements/structure/ModalContainer/index.d.ts +36 -16
  109. package/dist/elements/structure/Pagination/Pagination.mjs +23 -23
  110. package/dist/elements/structure/Pagination/declaration.d.ts +5 -1
  111. package/dist/elements/structure/Pagination/declaration.mjs +8 -2
  112. package/dist/elements/structure/Pagination/index.d.ts +5 -1
  113. package/dist/elements/structure/TabContainer/TabContainerItem/TabContainerItem.mjs +2 -1
  114. package/dist/index.d.ts +781 -318
  115. package/package.json +77 -13
  116. package/dist/elements/basic/Link/isCurrentPage.d.ts +0 -5
  117. package/dist/elements/basic/Link/isCurrentPage.mjs +0 -12
@@ -43,6 +43,8 @@ declare const declaration: {
43
43
  readonly base: {
44
44
  readonly default: {
45
45
  readonly 'background-color': "light-dark(white, oklch(0.21 0.006 285.885))";
46
+ readonly 'min-height': "24px";
47
+ readonly 'min-width': "24px";
46
48
  readonly 'padding-right': "4px";
47
49
  readonly 'padding-bottom': "4px";
48
50
  readonly 'padding-left': "4px";
@@ -37,6 +37,8 @@ var t = e()({
37
37
  displayMode: "desktop",
38
38
  style: { base: { default: {
39
39
  "background-color": "light-dark(white, oklch(0.21 0.006 285.885))",
40
+ "min-height": "24px",
41
+ "min-width": "24px",
40
42
  "padding-right": "4px",
41
43
  "padding-bottom": "4px",
42
44
  "padding-left": "4px",
@@ -42,6 +42,8 @@ declare const DropdownPopup: {
42
42
  readonly base: {
43
43
  readonly default: {
44
44
  readonly 'background-color': "light-dark(white, oklch(0.21 0.006 285.885))";
45
+ readonly 'min-height': "24px";
46
+ readonly 'min-width': "24px";
45
47
  readonly 'padding-right': "4px";
46
48
  readonly 'padding-bottom': "4px";
47
49
  readonly 'padding-left': "4px";
@@ -47,6 +47,8 @@ declare const Dropdown: {
47
47
  readonly base: {
48
48
  readonly default: {
49
49
  readonly 'background-color': "light-dark(white, oklch(0.21 0.006 285.885))";
50
+ readonly 'min-height': "24px";
51
+ readonly 'min-width': "24px";
50
52
  readonly 'padding-right': "4px";
51
53
  readonly 'padding-bottom': "4px";
52
54
  readonly 'padding-left': "4px";
@@ -47,7 +47,11 @@ declare const declaration: {
47
47
  readonly displayMode: "desktop";
48
48
  readonly style: {
49
49
  readonly base: {
50
- readonly default: {};
50
+ readonly default: {
51
+ readonly 'margin-top': "25px";
52
+ readonly 'margin-bottom': "25px";
53
+ readonly 'font-weight': 700;
54
+ };
51
55
  };
52
56
  };
53
57
  readonly subTypes: {
@@ -44,7 +44,11 @@ var n = e()({
44
44
  defaultStyle: {
45
45
  name: "Heading",
46
46
  displayMode: "desktop",
47
- style: { base: { default: {} } },
47
+ style: { base: { default: {
48
+ "margin-top": "25px",
49
+ "margin-bottom": "25px",
50
+ "font-weight": 700
51
+ } } },
48
52
  subTypes: {
49
53
  h1: {
50
54
  name: "H1 Heading",
@@ -46,7 +46,11 @@ declare const Heading: {
46
46
  readonly displayMode: "desktop";
47
47
  readonly style: {
48
48
  readonly base: {
49
- readonly default: {};
49
+ readonly default: {
50
+ readonly 'margin-top': "25px";
51
+ readonly 'margin-bottom': "25px";
52
+ readonly 'font-weight': 700;
53
+ };
50
54
  };
51
55
  };
52
56
  readonly subTypes: {
@@ -32,8 +32,14 @@ export type LinkProps = {
32
32
  icon?: string;
33
33
  /** Which side of the words the icon sits on. */
34
34
  iconPlacement?: IconPlacement;
35
+ /**
36
+ * Where the link is current. `page` (the default): on the page it leads to and nowhere else. `section`: on that page
37
+ * and every page under its path — `/automations/runs` stays lit on `/automations/runs/42`, a journal's link on its
38
+ * articles — announced there as the current entry (`aria-current="true"`) rather than the current page.
39
+ */
40
+ current?: 'page' | 'section';
35
41
  };
36
- declare const Link: ({ ref, children, className, href, target, mode, hash, label, content, contentPlacement, icon, iconPlacement }: LinkProps) => import('react').JSX.Element;
42
+ declare const Link: ({ ref, children, className, href, target, mode, hash, label, content, contentPlacement, icon, iconPlacement, current }: LinkProps) => import('react').JSX.Element;
37
43
  declare const _default: {
38
44
  (props: import('../../../Element/hocs/withElement').WithElementProps<LinkProps>): import('react').JSX.Element;
39
45
  displayName: string;
@@ -2,7 +2,7 @@ import e from "../../../Element/hocs/withElement.mjs";
2
2
  import t from "../../../Element/hooks/useElement.mjs";
3
3
  import { RootElement as n } from "../../../Element/RootElement.mjs";
4
4
  import r from "../../../Element/ElementWords.mjs";
5
- import { isCurrentPage as i } from "./isCurrentPage.mjs";
5
+ import { ariaCurrent as i } from "./ariaCurrent.mjs";
6
6
  import { useMemo as a } from "react";
7
7
  import o from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
8
8
  import { useSdkStore as s } from "@plitzi/sdk-shared/store";
@@ -11,84 +11,84 @@ import { jsx as l, jsxs as u } from "react/jsx-runtime";
11
11
  import d from "clsx";
12
12
  import { getPageFullPath as f } from "@plitzi/sdk-navigation/NavigationHelper";
13
13
  //#region src/elements/basic/Link/Link.tsx
14
- var p = ({ ref: e, children: p, className: m = "", href: h = "#", target: g = "self", mode: _ = "page", hash: v = "", label: y = "", content: b = "", contentPlacement: x = "after", icon: S = "", iconPlacement: C = "before" }) => {
15
- let { style: w, definition: { styleSelectors: T } } = t(), { settings: { previewMode: E } } = o(), [[D, O, k, A, j, M]] = s([
14
+ var p = ({ ref: e, children: p, className: m = "", href: h = "#", target: g = "self", mode: _ = "page", hash: v = "", label: y = "", content: b = "", contentPlacement: x = "after", icon: S = "", iconPlacement: C = "before", current: w = "page" }) => {
15
+ let { style: T, definition: { styleSelectors: E } } = t(), { settings: { previewMode: D } } = o(), [[O, k, A, j, M, N]] = s([
16
16
  "pageDefinitions",
17
17
  "schema.pageFolders",
18
18
  "navigation.routeParams",
19
19
  "navigation.queryParams",
20
20
  "navigation.navigate",
21
21
  "navigation.href"
22
- ]), N = a(() => {
22
+ ]), P = a(() => {
23
23
  if (_ === "external") return h;
24
24
  if (_ === "internal") {
25
25
  let e = `/${h}`.replaceAll(/[/]+/gim, "/");
26
26
  try {
27
27
  let t = c(e, {
28
- ...A,
29
- ...k
28
+ ...j,
29
+ ...A
30
30
  }, !0);
31
31
  return typeof t == "string" ? t : e;
32
32
  } catch {}
33
33
  return e;
34
34
  }
35
- return f(D, O, h, !0);
35
+ return f(O, k, h, !0);
36
36
  }, [
37
37
  _,
38
38
  h,
39
- D,
40
39
  O,
41
- A,
42
- k
43
- ]), P = _ !== "external" && v ? `${N}#${v}` : N, F = _ !== "external" && i(N, M), I = (e) => {
44
- if (!E) return;
40
+ k,
41
+ j,
42
+ A
43
+ ]), F = _ !== "external" && v ? `${P}#${v}` : P, I = _ === "external" ? void 0 : i(P, N, w), L = (e) => {
44
+ if (!D) return;
45
45
  e.stopPropagation();
46
46
  let t = g !== "self" || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0;
47
- (_ === "page" || _ === "internal") && !t && (e.preventDefault(), j(P));
48
- }, L = a(() => {
47
+ (_ === "page" || _ === "internal") && !t && (e.preventDefault(), M(F));
48
+ }, R = a(() => {
49
49
  let t = {
50
50
  ref: e,
51
- style: w,
51
+ style: T,
52
52
  target: `_${g}`,
53
53
  ...g === "blank" ? { rel: "noopener noreferrer" } : {},
54
54
  "aria-label": y || void 0,
55
- "aria-current": F ? "page" : void 0,
55
+ "aria-current": I,
56
56
  className: d("plitzi-component__link", m)
57
57
  };
58
- return E ? {
58
+ return D ? {
59
59
  ...t,
60
- href: P
60
+ href: F
61
61
  } : {
62
62
  ...t,
63
- "href-disabled": P
63
+ "href-disabled": F
64
64
  };
65
65
  }, [
66
66
  e,
67
- w,
67
+ T,
68
68
  g,
69
69
  y,
70
- F,
70
+ I,
71
71
  m,
72
- E,
73
- P
72
+ D,
73
+ F
74
74
  ]);
75
75
  return /* @__PURE__ */ u(n, {
76
76
  tag: "a",
77
- ...L,
78
- onClick: I,
77
+ ...R,
78
+ onClick: L,
79
79
  children: [
80
80
  x === "before" && /* @__PURE__ */ l(r, {
81
81
  content: b,
82
82
  icon: S,
83
83
  iconPlacement: C,
84
- iconClassName: T.icon
84
+ iconClassName: E.icon
85
85
  }),
86
86
  p,
87
87
  x === "after" && /* @__PURE__ */ l(r, {
88
88
  content: b,
89
89
  icon: S,
90
90
  iconPlacement: C,
91
- iconClassName: T.icon
91
+ iconClassName: E.icon
92
92
  })
93
93
  ]
94
94
  });
@@ -8,7 +8,8 @@ type SettingsProps = {
8
8
  contentPlacement?: 'before' | 'after';
9
9
  icon?: string;
10
10
  iconPlacement?: 'before' | 'after';
11
+ current?: 'page' | 'section';
11
12
  onUpdate?: (key: string, value: string | boolean | number) => void;
12
13
  };
13
- declare const Settings: ({ mode, href, hash, target, label, content, contentPlacement, icon, iconPlacement, onUpdate }: SettingsProps) => import('react').JSX.Element;
14
+ declare const Settings: ({ mode, href, hash, target, label, content, contentPlacement, icon, iconPlacement, current, onUpdate }: SettingsProps) => import('react').JSX.Element;
14
15
  export default Settings;
@@ -8,13 +8,13 @@ import { getPageFullPath as d } from "@plitzi/sdk-navigation/NavigationHelper";
8
8
  import f from "@plitzi/plitzi-ui/Input";
9
9
  import p from "@plitzi/plitzi-ui/Select";
10
10
  //#region src/elements/basic/Link/Settings.tsx
11
- var m = ({ mode: m = "page", href: h = "#", hash: g = "", target: _ = "self", label: v = "", content: y = "", contentPlacement: b = "after", icon: x = "", iconPlacement: S = "before", onUpdate: C }) => {
12
- let { contexts: { NetworkContext: w } } = a(), [[T, E, D]] = o([
11
+ var m = ({ mode: m = "page", href: h = "#", hash: g = "", target: _ = "self", label: v = "", content: y = "", contentPlacement: b = "after", icon: x = "", iconPlacement: S = "before", current: C = "page", onUpdate: w }) => {
12
+ let { contexts: { NetworkContext: T } } = a(), [[E, D, O]] = o([
13
13
  "schema.flat",
14
14
  "schema.pages",
15
15
  "schema.pageFolders"
16
- ]), { server: O } = t(w), k = i(() => s(O, "domain", "https://subdomain.plitzi.app"), [O]), A = i(() => {
17
- let e = c(T, E);
16
+ ]), { server: k } = t(T), A = i(() => s(k, "domain", "https://subdomain.plitzi.app"), [k]), j = i(() => {
17
+ let e = c(E, D);
18
18
  return Object.keys(e).reduce((t, n) => {
19
19
  let r = e[n], i = s(r, "attributes.name", n), a = s(r, "attributes.default", !1);
20
20
  return [...t, {
@@ -23,31 +23,31 @@ var m = ({ mode: m = "page", href: h = "#", hash: g = "", target: _ = "self", la
23
23
  defaultPage: a
24
24
  }];
25
25
  }, []);
26
- }, [T, E]), j = n((e) => (t) => C?.(e, t), [C]), M = n((e) => C?.("href", e), [C]), N = n((e) => {
27
- if (C?.("mode", e), e !== "page") {
28
- C?.("href", "#");
26
+ }, [E, D]), M = n((e) => (t) => w?.(e, t), [w]), N = n((e) => w?.("href", e), [w]), P = n((e) => {
27
+ if (w?.("mode", e), e !== "page") {
28
+ w?.("href", "#");
29
29
  return;
30
30
  }
31
- let t = A.find((e) => e.defaultPage);
32
- t && C?.("href", t.key);
33
- }, [C, A]);
31
+ let t = j.find((e) => e.defaultPage);
32
+ t && w?.("href", t.key);
33
+ }, [w, j]);
34
34
  r(() => {
35
35
  if (m === "page" && h === "#") {
36
- let e = A.find((e) => e.defaultPage);
37
- e && C?.("href", e.key);
36
+ let e = j.find((e) => e.defaultPage);
37
+ e && w?.("href", e.key);
38
38
  }
39
39
  }, [
40
40
  m,
41
41
  h,
42
- A,
43
- C
42
+ j,
43
+ w
44
44
  ]);
45
- let P = i(() => m === "page" ? `${k}${d(T, D, h, !0)}` : h.replaceAll(/[/]+/gim, "/"), [
45
+ let F = i(() => m === "page" ? `${A}${d(E, O, h, !0)}` : h.replaceAll(/[/]+/gim, "/"), [
46
46
  m,
47
- T,
48
- D,
47
+ E,
48
+ O,
49
49
  h,
50
- k
50
+ A
51
51
  ]);
52
52
  return /* @__PURE__ */ u("div", {
53
53
  className: "flex h-full flex-col gap-4 py-2",
@@ -56,13 +56,13 @@ var m = ({ mode: m = "page", href: h = "#", hash: g = "", target: _ = "self", la
56
56
  value: y,
57
57
  label: "Content",
58
58
  placeholder: "The link's words, without a text inside it",
59
- onChange: j("content"),
59
+ onChange: M("content"),
60
60
  size: "sm"
61
61
  }),
62
62
  /* @__PURE__ */ u(p, {
63
63
  value: b,
64
64
  label: "Content Placement",
65
- onChange: j("contentPlacement"),
65
+ onChange: M("contentPlacement"),
66
66
  size: "sm",
67
67
  children: [/* @__PURE__ */ l("option", {
68
68
  value: "before",
@@ -75,7 +75,7 @@ var m = ({ mode: m = "page", href: h = "#", hash: g = "", target: _ = "self", la
75
75
  /* @__PURE__ */ u(p, {
76
76
  value: _,
77
77
  label: "Target",
78
- onChange: j("target"),
78
+ onChange: M("target"),
79
79
  size: "sm",
80
80
  children: [
81
81
  /* @__PURE__ */ l("option", {
@@ -99,7 +99,7 @@ var m = ({ mode: m = "page", href: h = "#", hash: g = "", target: _ = "self", la
99
99
  /* @__PURE__ */ u(p, {
100
100
  value: m,
101
101
  label: "Mode",
102
- onChange: N,
102
+ onChange: P,
103
103
  size: "sm",
104
104
  children: [
105
105
  /* @__PURE__ */ l("option", {
@@ -119,7 +119,7 @@ var m = ({ mode: m = "page", href: h = "#", hash: g = "", target: _ = "self", la
119
119
  m !== "page" && /* @__PURE__ */ l(f, {
120
120
  value: h,
121
121
  label: "Url",
122
- onChange: M,
122
+ onChange: N,
123
123
  size: "sm"
124
124
  }),
125
125
  m === "page" && /* @__PURE__ */ u("div", {
@@ -127,40 +127,53 @@ var m = ({ mode: m = "page", href: h = "#", hash: g = "", target: _ = "self", la
127
127
  children: [/* @__PURE__ */ u(p, {
128
128
  value: h,
129
129
  label: "Url",
130
- onChange: M,
130
+ onChange: N,
131
131
  className: { inputContainer: "rounded-t" },
132
132
  size: "sm",
133
133
  children: [/* @__PURE__ */ l("option", {
134
134
  value: "",
135
135
  disabled: !0,
136
136
  children: "Select a page"
137
- }), A.map((e) => /* @__PURE__ */ l("option", {
137
+ }), j.map((e) => /* @__PURE__ */ l("option", {
138
138
  value: e.key,
139
139
  children: e.label
140
140
  }, e.key))]
141
141
  }), /* @__PURE__ */ l("div", {
142
142
  className: "truncate rounded-b border-r border-b border-l border-gray-200 p-1 text-xs",
143
- children: P
143
+ children: F
144
+ })]
145
+ }),
146
+ m !== "external" && /* @__PURE__ */ u(p, {
147
+ value: C,
148
+ label: "Current On",
149
+ onChange: M("current"),
150
+ size: "sm",
151
+ children: [/* @__PURE__ */ l("option", {
152
+ value: "page",
153
+ children: "Its Page"
154
+ }), /* @__PURE__ */ l("option", {
155
+ value: "section",
156
+ children: "Its Page And The Pages Under It"
144
157
  })]
145
158
  }),
146
159
  m !== "external" && /* @__PURE__ */ l(f, {
147
160
  value: g,
148
161
  label: "Section",
149
162
  placeholder: "An element's anchor, without the #",
150
- onChange: j("hash"),
163
+ onChange: M("hash"),
151
164
  size: "sm"
152
165
  }),
153
166
  /* @__PURE__ */ l(f, {
154
167
  value: v,
155
168
  label: "Accessible Name",
156
169
  placeholder: "For a link that wraps a whole card",
157
- onChange: j("label"),
170
+ onChange: M("label"),
158
171
  size: "sm"
159
172
  }),
160
173
  /* @__PURE__ */ l(e, {
161
174
  icon: x,
162
175
  iconPlacement: S,
163
- onUpdate: C
176
+ onUpdate: w
164
177
  })
165
178
  ]
166
179
  });
@@ -0,0 +1,12 @@
1
+ import { LinkProps } from './Link';
2
+ /**
3
+ * What a link says of the page being shown, given its whole address (`navigation.href`): `'page'` when it leads to that
4
+ * page, `'true'` when it is the section that page is in — the entry of a menu lit for the pages under it — and nothing
5
+ * otherwise. The values `aria-current` takes: a screen reader announces the first as "current page" and the second as
6
+ * "current", since the link does not lead to the page itself.
7
+ *
8
+ * The fragment (`#plans`) is the same page, and so is any query the link does not name. A query it does name must be
9
+ * the one shown: `/?window=6h` and `/?window=24h` are one path, and with the path alone every window's link was the
10
+ * current one. Undefined while no address is known — nothing is current then.
11
+ */
12
+ export declare const ariaCurrent: (path: string, location: string | undefined, current: NonNullable<LinkProps["current"]>) => "page" | "true" | undefined;
@@ -0,0 +1,11 @@
1
+ //#region src/elements/basic/Link/ariaCurrent.ts
2
+ var e = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, t = (e, t, n) => t === e || n === "section" && t.startsWith(e === "/" ? "/" : `${e}/`), n = (n, r, i) => {
3
+ if (r && n.startsWith("/")) try {
4
+ let a = new URL(r), o = new URL(n, r), s = e(decodeURI(a.pathname)), c = e(decodeURI(o.pathname));
5
+ return ![...o.searchParams].every(([e, t]) => a.searchParams.getAll(e).includes(t)) || !t(c, s, i) ? void 0 : s === c ? "page" : "true";
6
+ } catch {
7
+ return;
8
+ }
9
+ };
10
+ //#endregion
11
+ export { n as ariaCurrent };
@@ -9,6 +9,7 @@ declare const declaration: {
9
9
  readonly target: readonly string[];
10
10
  readonly contentPlacement: readonly string[];
11
11
  readonly iconPlacement: readonly string[];
12
+ readonly current: readonly string[];
12
13
  };
13
14
  readonly content: {
14
15
  readonly attributes: {
@@ -21,6 +22,7 @@ declare const declaration: {
21
22
  readonly contentPlacement: "after";
22
23
  readonly icon: "";
23
24
  readonly iconPlacement: "before";
25
+ readonly current: "page";
24
26
  };
25
27
  readonly definition: {
26
28
  readonly label: "Link";
@@ -61,7 +63,8 @@ declare const declaration: {
61
63
  readonly base: {
62
64
  readonly default: {
63
65
  readonly display: "inline-block";
64
- readonly color: "#333";
66
+ readonly color: "light-dark(#333, oklch(0.92 0.004 286.32))";
67
+ readonly 'text-decoration': "none";
65
68
  readonly cursor: "pointer";
66
69
  };
67
70
  };
@@ -76,6 +79,7 @@ declare const declaration: {
76
79
  target?: "self" | "blank" | "parent" | "top" | undefined;
77
80
  content?: string | undefined;
78
81
  icon?: string | undefined;
82
+ current?: "page" | "section" | undefined;
79
83
  iconPlacement?: import('../../../Element/ElementWords').IconPlacement | undefined;
80
84
  contentPlacement?: "before" | "after" | undefined;
81
85
  hash?: string | undefined;
@@ -15,7 +15,8 @@ var n = e()({
15
15
  "top"
16
16
  ]),
17
17
  contentPlacement: t()(["before", "after"]),
18
- iconPlacement: t()(["before", "after"])
18
+ iconPlacement: t()(["before", "after"]),
19
+ current: t()(["page", "section"])
19
20
  },
20
21
  content: {
21
22
  attributes: {
@@ -27,12 +28,13 @@ var n = e()({
27
28
  content: "",
28
29
  contentPlacement: "after",
29
30
  icon: "",
30
- iconPlacement: "before"
31
+ iconPlacement: "before",
32
+ current: "page"
31
33
  },
32
34
  definition: {
33
35
  label: "Link",
34
36
  type: "link",
35
- description: "Navigation. Moves the user between pages of the site or to an external URL (its `mode`/`href` decide which). Use this to go page-to-page rather than a button + interaction. Its words are its own `content` and an icon beside them its `icon` (Font Awesome classes) — no text or fontAwesome element inside it for them.",
37
+ description: "Navigation. Moves the user between pages of the site or to an external URL (its `mode`/`href` decide which). Use this to go page-to-page rather than a button + interaction. Its words are its own `content` and an icon beside them its `icon` (Font Awesome classes) — no text or fontAwesome element inside it for them. It marks itself current on the page it leads to (`aria-current`, the `current` style state); its `current` set to `section` keeps it current on every page under its path too — a menu entry for a section and its pages.",
36
38
  items: [],
37
39
  bindings: {},
38
40
  styleSelectors: {
@@ -64,7 +66,8 @@ var n = e()({
64
66
  displayMode: "desktop",
65
67
  style: { base: { default: {
66
68
  display: "inline-block",
67
- color: "#333",
69
+ color: "light-dark(#333, oklch(0.92 0.004 286.32))",
70
+ "text-decoration": "none",
68
71
  cursor: "pointer"
69
72
  } } }
70
73
  },
@@ -8,6 +8,7 @@ declare const Link: {
8
8
  readonly target: readonly string[];
9
9
  readonly contentPlacement: readonly string[];
10
10
  readonly iconPlacement: readonly string[];
11
+ readonly current: readonly string[];
11
12
  };
12
13
  readonly content: {
13
14
  readonly attributes: {
@@ -20,6 +21,7 @@ declare const Link: {
20
21
  readonly contentPlacement: "after";
21
22
  readonly icon: "";
22
23
  readonly iconPlacement: "before";
24
+ readonly current: "page";
23
25
  };
24
26
  readonly definition: {
25
27
  readonly label: "Link";
@@ -60,7 +62,8 @@ declare const Link: {
60
62
  readonly base: {
61
63
  readonly default: {
62
64
  readonly display: "inline-block";
63
- readonly color: "#333";
65
+ readonly color: "light-dark(#333, oklch(0.92 0.004 286.32))";
66
+ readonly 'text-decoration': "none";
64
67
  readonly cursor: "pointer";
65
68
  };
66
69
  };
@@ -75,6 +78,7 @@ declare const Link: {
75
78
  target?: "self" | "blank" | "parent" | "top" | undefined;
76
79
  content?: string | undefined;
77
80
  icon?: string | undefined;
81
+ current?: "page" | "section" | undefined;
78
82
  iconPlacement?: import('../../../Element/ElementWords').IconPlacement | undefined;
79
83
  contentPlacement?: "before" | "after" | undefined;
80
84
  hash?: string | undefined;
@@ -3,8 +3,13 @@ export type MarkdownProps = {
3
3
  ref?: RefObject<HTMLElement>;
4
4
  className?: string;
5
5
  content?: string;
6
+ /**
7
+ * Whether a heading offers a link to itself (`a.anchor`) before its words. `false` leaves the link out and keeps the
8
+ * heading's id, so `/page#its-words` still lands on it.
9
+ */
10
+ headingLinks?: boolean;
6
11
  };
7
- declare const Markdown: ({ ref, content, className }: MarkdownProps) => import('react').JSX.Element;
12
+ declare const Markdown: ({ ref, content, className, headingLinks }: MarkdownProps) => import('react').JSX.Element;
8
13
  declare const _default: {
9
14
  (props: import('../../../Element/hocs/withElement').WithElementProps<MarkdownProps>): import('react').JSX.Element;
10
15
  displayName: string;
@@ -1,21 +1,25 @@
1
1
  import e from "../../../Element/hocs/withElement.mjs";
2
- import { RootElement as t } from "../../../Element/RootElement.mjs";
3
- import n from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
4
- import { jsx as r } from "react/jsx-runtime";
5
- import i from "clsx";
6
- import a from "@plitzi/plitzi-ui/Markdown";
7
- import { uniqueAnchor as o } from "@plitzi/sdk-shared/schema/anchor";
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 "./hooks/useMarkdownClassNames.mjs";
6
+ import a from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
7
+ import { jsx as o } from "react/jsx-runtime";
8
+ import s from "clsx";
9
+ import { uniqueAnchor as c } from "@plitzi/sdk-shared/schema/anchor";
8
10
  //#region src/elements/basic/Markdown/Markdown.tsx
9
- var s = ({ ref: e, content: s = "Markdown", className: c = "" }) => {
10
- let { settings: { previewMode: l } } = n();
11
- return /* @__PURE__ */ r(t, {
11
+ var l = ({ ref: e, content: l = "Markdown", className: u = "", headingLinks: d = !0 }) => {
12
+ let { settings: { previewMode: f } } = a(), { definition: { styleSelectors: p } } = t(), m = i(p);
13
+ return /* @__PURE__ */ o(n, {
12
14
  ref: e,
13
- className: i("plitzi-component__markdown", { "plitzi-component__markdown--edit-mode": !l }, c),
14
- children: /* @__PURE__ */ r(a, {
15
- headingAnchor: o,
16
- children: s
15
+ className: s("plitzi-component__markdown", { "plitzi-component__markdown--edit-mode": !f }, u),
16
+ children: /* @__PURE__ */ o(r, {
17
+ headingAnchor: c,
18
+ headingLinks: d,
19
+ classNames: m,
20
+ children: l
17
21
  })
18
22
  });
19
- }, c = e(s);
23
+ }, u = e(l);
20
24
  //#endregion
21
- export { s as Markdown, c as default };
25
+ export { l as Markdown, u as default };
@@ -1,6 +1,7 @@
1
1
  type SettingsProps = {
2
2
  content?: string;
3
+ headingLinks?: boolean;
3
4
  onUpdate?: (key: string, value: string | boolean | number) => void;
4
5
  };
5
- declare const Settings: ({ content, onUpdate }: SettingsProps) => import('react').JSX.Element;
6
+ declare const Settings: ({ content, headingLinks, onUpdate }: SettingsProps) => import('react').JSX.Element;
6
7
  export default Settings;
@@ -1,18 +1,24 @@
1
1
  import { useCallback as e } from "react";
2
- import { jsx as t } from "react/jsx-runtime";
3
- import n from "@plitzi/plitzi-ui/TextArea";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import r from "@plitzi/plitzi-ui/Checkbox";
4
+ import i from "@plitzi/plitzi-ui/TextArea";
4
5
  //#region src/elements/basic/Markdown/Settings.tsx
5
- var r = ({ content: r = "Markdown", onUpdate: i }) => {
6
- let a = e((e) => i?.("content", e), [i]);
7
- return /* @__PURE__ */ t("div", {
6
+ var a = ({ content: a = "Markdown", headingLinks: o = !0, onUpdate: s }) => {
7
+ let c = e((e) => s?.("content", e), [s]), l = e((e) => s?.("headingLinks", e.target.checked), [s]);
8
+ return /* @__PURE__ */ n("div", {
8
9
  className: "flex h-full flex-col gap-4 py-2",
9
- children: /* @__PURE__ */ t(n, {
10
- value: r,
10
+ children: [/* @__PURE__ */ t(r, {
11
+ checked: o,
12
+ label: "Link Each Heading To Itself",
13
+ onChange: l,
14
+ size: "xs"
15
+ }), /* @__PURE__ */ t(i, {
16
+ value: a,
11
17
  label: "Content",
12
18
  className: "h-full",
13
- onChange: a
14
- })
19
+ onChange: c
20
+ })]
15
21
  });
16
22
  };
17
23
  //#endregion
18
- export { r as default };
24
+ export { a as default };