@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.
- package/CHANGELOG.md +397 -0
- package/dist/Element/ServerStaticShell.d.ts +7 -1
- package/dist/Element/ServerStaticShell.mjs +11 -11
- package/dist/Element/hooks/useInternalItems.mjs +2 -1
- package/dist/Element/hooks/useRscData.d.ts +1 -1
- package/dist/components/MarkdownDocument/MarkdownDocument.d.ts +32 -0
- package/dist/components/MarkdownDocument/MarkdownDocument.mjs +32 -0
- package/dist/components/MarkdownDocument/components/CodeBlock/CodeBlock.d.ts +14 -0
- package/dist/components/MarkdownDocument/components/CodeBlock/CodeBlock.mjs +34 -0
- package/dist/components/MarkdownDocument/components/CodeBlock/index.d.ts +3 -0
- package/dist/components/MarkdownDocument/components/CodeBlock/index.mjs +5 -0
- package/dist/components/MarkdownDocument/helpers/hastText.d.ts +10 -0
- package/dist/components/MarkdownDocument/helpers/hastText.mjs +4 -0
- package/dist/components/MarkdownDocument/helpers/markdownComponents.d.ts +10 -0
- package/dist/components/MarkdownDocument/helpers/markdownComponents.mjs +89 -0
- package/dist/components/MarkdownDocument/helpers/markdownParts.d.ts +16 -0
- package/dist/components/MarkdownDocument/helpers/markdownParts.mjs +4 -0
- package/dist/components/MarkdownDocument/helpers/rehypeHeadingAnchors.d.ts +8 -0
- package/dist/components/MarkdownDocument/helpers/rehypeHeadingAnchors.mjs +20 -0
- package/dist/components/MarkdownDocument/helpers/syntaxHighlighter.d.ts +3 -0
- package/dist/components/MarkdownDocument/helpers/syntaxHighlighter.mjs +24 -0
- package/dist/components/MarkdownDocument/index.d.ts +5 -0
- package/dist/components/MarkdownDocument/index.mjs +6 -0
- package/dist/dataSource/GlobalSources.mjs +101 -113
- package/dist/elements/advanced/Custom/declaration.d.ts +5 -1
- package/dist/elements/advanced/Custom/declaration.mjs +5 -1
- package/dist/elements/advanced/Custom/index.d.ts +5 -1
- package/dist/elements/basic/Button/declaration.d.ts +46 -34
- package/dist/elements/basic/Button/declaration.mjs +18 -42
- package/dist/elements/basic/Button/index.d.ts +46 -34
- package/dist/elements/basic/Dropdown/DropdownPopup/declaration.d.ts +2 -0
- package/dist/elements/basic/Dropdown/DropdownPopup/declaration.mjs +2 -0
- package/dist/elements/basic/Dropdown/DropdownPopup/index.d.ts +2 -0
- package/dist/elements/basic/Dropdown/index.d.ts +2 -0
- package/dist/elements/basic/Heading/declaration.d.ts +5 -1
- package/dist/elements/basic/Heading/declaration.mjs +5 -1
- package/dist/elements/basic/Heading/index.d.ts +5 -1
- package/dist/elements/basic/Link/Link.d.ts +7 -1
- package/dist/elements/basic/Link/Link.mjs +27 -27
- package/dist/elements/basic/Link/Settings.d.ts +2 -1
- package/dist/elements/basic/Link/Settings.mjs +42 -29
- package/dist/elements/basic/Link/ariaCurrent.d.ts +12 -0
- package/dist/elements/basic/Link/ariaCurrent.mjs +11 -0
- package/dist/elements/basic/Link/declaration.d.ts +5 -1
- package/dist/elements/basic/Link/declaration.mjs +7 -4
- package/dist/elements/basic/Link/index.d.ts +5 -1
- package/dist/elements/basic/Markdown/Markdown.d.ts +6 -1
- package/dist/elements/basic/Markdown/Markdown.mjs +19 -15
- package/dist/elements/basic/Markdown/Settings.d.ts +2 -1
- package/dist/elements/basic/Markdown/Settings.mjs +16 -10
- package/dist/elements/basic/Markdown/declaration.d.ts +32 -5
- package/dist/elements/basic/Markdown/declaration.mjs +37 -7
- package/dist/elements/basic/Markdown/hooks/useMarkdownClassNames.d.ts +7 -0
- package/dist/elements/basic/Markdown/hooks/useMarkdownClassNames.mjs +13 -0
- package/dist/elements/basic/Markdown/index.d.ts +32 -5
- package/dist/elements/basic/RichText/RichText.mjs +27 -20
- package/dist/elements/basic/RichText/classHtmlParts.d.ts +14 -0
- package/dist/elements/basic/RichText/classHtmlParts.mjs +48 -0
- package/dist/elements/basic/RichText/declaration.d.ts +28 -1
- package/dist/elements/basic/RichText/declaration.mjs +31 -2
- package/dist/elements/basic/RichText/index.d.ts +28 -1
- package/dist/elements/basic/Text/declaration.d.ts +0 -2
- package/dist/elements/basic/Text/declaration.mjs +1 -5
- package/dist/elements/basic/Text/index.d.ts +0 -2
- package/dist/elements/basic/ThemeToggle/ThemeToggle.mjs +20 -18
- package/dist/elements/basic/ThemeToggle/declaration.d.ts +48 -4
- package/dist/elements/basic/ThemeToggle/declaration.mjs +32 -8
- package/dist/elements/basic/ThemeToggle/index.d.ts +48 -4
- package/dist/elements/declarations/index.d.ts +781 -318
- package/dist/elements/form/FormControl/FormControl.mjs +51 -53
- package/dist/elements/form/FormControl/Settings.mjs +4 -0
- package/dist/elements/form/FormControl/components/Label.d.ts +3 -1
- package/dist/elements/form/FormControl/components/Label.mjs +5 -5
- package/dist/elements/form/FormControl/declaration.d.ts +479 -233
- package/dist/elements/form/FormControl/declaration.mjs +142 -76
- package/dist/elements/form/FormControl/helpers/isChecked.d.ts +8 -0
- package/dist/elements/form/FormControl/helpers/isChecked.mjs +4 -0
- package/dist/elements/form/FormControl/hocs/withFieldValue.mjs +2 -6
- package/dist/elements/form/FormControl/index.d.ts +479 -233
- package/dist/elements/form/FormControl/inputs/Checkbox.d.ts +7 -3
- package/dist/elements/form/FormControl/inputs/Checkbox.mjs +7 -6
- package/dist/elements/form/FormControl/inputs/Input.d.ts +6 -1
- package/dist/elements/form/FormControl/inputs/Input.mjs +29 -29
- package/dist/elements/form/FormControl/inputs/Select.d.ts +4 -1
- package/dist/elements/form/FormControl/inputs/Select.mjs +15 -15
- package/dist/elements/internal/NotFound/declaration.d.ts +5 -1
- package/dist/elements/internal/NotFound/declaration.mjs +5 -1
- package/dist/elements/internal/NotFound/index.d.ts +5 -1
- package/dist/elements/internal/Page/declaration.d.ts +1 -2
- package/dist/elements/internal/Page/declaration.mjs +2 -3
- package/dist/elements/internal/Page/index.d.ts +1 -2
- package/dist/elements/media/Image/declaration.d.ts +3 -2
- package/dist/elements/media/Image/declaration.mjs +3 -2
- package/dist/elements/media/Image/index.d.ts +3 -2
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +89 -80
- package/dist/elements/provider/ApiContainer/hooks/useApi.mjs +23 -23
- package/dist/elements/provider/ApiContainer/hooks/useProviderWrite.mjs +5 -5
- package/dist/elements/structure/Carousel/CarouselTrack/declaration.d.ts +4 -1
- package/dist/elements/structure/Carousel/CarouselTrack/declaration.mjs +4 -1
- package/dist/elements/structure/Carousel/CarouselTrack/index.d.ts +4 -1
- package/dist/elements/structure/Carousel/index.d.ts +4 -1
- package/dist/elements/structure/DialogContainer/DialogContainer.mjs +2 -2
- package/dist/elements/structure/DialogContainer/declaration.d.ts +72 -12
- package/dist/elements/structure/DialogContainer/declaration.mjs +58 -17
- package/dist/elements/structure/DialogContainer/index.d.ts +72 -12
- package/dist/elements/structure/List/declaration.d.ts +5 -1
- package/dist/elements/structure/List/declaration.mjs +5 -1
- package/dist/elements/structure/List/index.d.ts +5 -1
- package/dist/elements/structure/ModalContainer/declaration.d.ts +36 -16
- package/dist/elements/structure/ModalContainer/declaration.mjs +42 -24
- package/dist/elements/structure/ModalContainer/index.d.ts +36 -16
- package/dist/elements/structure/Pagination/Pagination.mjs +23 -23
- package/dist/elements/structure/Pagination/declaration.d.ts +5 -1
- package/dist/elements/structure/Pagination/declaration.mjs +8 -2
- package/dist/elements/structure/Pagination/index.d.ts +5 -1
- package/dist/elements/structure/TabContainer/TabContainerItem/TabContainerItem.mjs +2 -1
- package/dist/index.d.ts +781 -318
- package/package.json +77 -13
- package/dist/elements/basic/Link/isCurrentPage.d.ts +0 -5
- package/dist/elements/basic/Link/isCurrentPage.mjs +0 -12
|
@@ -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",
|
|
12
|
-
let { contexts: { NetworkContext:
|
|
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:
|
|
17
|
-
let e = c(
|
|
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
|
-
}, [
|
|
27
|
-
if (
|
|
28
|
-
|
|
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 =
|
|
32
|
-
t &&
|
|
33
|
-
}, [
|
|
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 =
|
|
37
|
-
e &&
|
|
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
|
-
|
|
43
|
-
|
|
42
|
+
j,
|
|
43
|
+
w
|
|
44
44
|
]);
|
|
45
|
-
let
|
|
45
|
+
let F = i(() => m === "page" ? `${A}${d(E, O, h, !0)}` : h.replaceAll(/[/]+/gim, "/"), [
|
|
46
46
|
m,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
E,
|
|
48
|
+
O,
|
|
49
49
|
h,
|
|
50
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
}),
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
5
|
-
import i from "
|
|
6
|
-
import a from "@plitzi/
|
|
7
|
-
import {
|
|
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
|
|
10
|
-
let { settings: { previewMode:
|
|
11
|
-
return /* @__PURE__ */
|
|
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:
|
|
14
|
-
children: /* @__PURE__ */ r
|
|
15
|
-
headingAnchor:
|
|
16
|
-
|
|
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
|
-
},
|
|
23
|
+
}, u = e(l);
|
|
20
24
|
//#endregion
|
|
21
|
-
export {
|
|
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
|
|
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
|
|
6
|
-
let
|
|
7
|
-
return /* @__PURE__ */
|
|
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(
|
|
10
|
-
|
|
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:
|
|
14
|
-
})
|
|
19
|
+
onChange: c
|
|
20
|
+
})]
|
|
15
21
|
});
|
|
16
22
|
};
|
|
17
23
|
//#endregion
|
|
18
|
-
export {
|
|
24
|
+
export { a as default };
|
|
@@ -7,14 +7,43 @@ declare const declaration: {
|
|
|
7
7
|
readonly content: {
|
|
8
8
|
readonly attributes: {
|
|
9
9
|
readonly content: "Markdown";
|
|
10
|
+
readonly headingLinks: true;
|
|
10
11
|
};
|
|
11
12
|
readonly definition: {
|
|
12
13
|
readonly label: "Markdown";
|
|
13
14
|
readonly type: "markdown";
|
|
14
|
-
readonly description:
|
|
15
|
+
readonly description: string;
|
|
15
16
|
readonly bindings: {};
|
|
16
17
|
readonly styleSelectors: {
|
|
17
18
|
readonly base: "";
|
|
19
|
+
readonly heading: "";
|
|
20
|
+
readonly heading1: "";
|
|
21
|
+
readonly heading2: "";
|
|
22
|
+
readonly heading3: "";
|
|
23
|
+
readonly heading4: "";
|
|
24
|
+
readonly heading5: "";
|
|
25
|
+
readonly heading6: "";
|
|
26
|
+
readonly paragraph: "";
|
|
27
|
+
readonly link: "";
|
|
28
|
+
readonly strong: "";
|
|
29
|
+
readonly emphasis: "";
|
|
30
|
+
readonly list: "";
|
|
31
|
+
readonly listItem: "";
|
|
32
|
+
readonly quote: "";
|
|
33
|
+
readonly divider: "";
|
|
34
|
+
readonly code: "";
|
|
35
|
+
readonly codeBlock: "";
|
|
36
|
+
readonly codeBlockFrame: "";
|
|
37
|
+
readonly codeBlockHeader: "";
|
|
38
|
+
readonly codeBlockLanguage: "";
|
|
39
|
+
readonly codeBlockCopy: "";
|
|
40
|
+
readonly image: "";
|
|
41
|
+
readonly table: "";
|
|
42
|
+
readonly tableHead: "";
|
|
43
|
+
readonly tableRow: "";
|
|
44
|
+
readonly tableHeaderCell: "";
|
|
45
|
+
readonly tableCell: "";
|
|
46
|
+
readonly anchor: "";
|
|
18
47
|
};
|
|
19
48
|
readonly initialState: {
|
|
20
49
|
readonly visibility: true;
|
|
@@ -43,10 +72,7 @@ declare const declaration: {
|
|
|
43
72
|
readonly displayMode: "desktop";
|
|
44
73
|
readonly style: {
|
|
45
74
|
readonly base: {
|
|
46
|
-
readonly default: {
|
|
47
|
-
readonly 'font-size': "14px";
|
|
48
|
-
readonly 'line-height': "1.714";
|
|
49
|
-
};
|
|
75
|
+
readonly default: {};
|
|
50
76
|
};
|
|
51
77
|
};
|
|
52
78
|
};
|
|
@@ -54,5 +80,6 @@ declare const declaration: {
|
|
|
54
80
|
};
|
|
55
81
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
56
82
|
content?: string | undefined;
|
|
83
|
+
headingLinks?: boolean | undefined;
|
|
57
84
|
}>>;
|
|
58
85
|
export default declaration;
|
|
@@ -3,13 +3,46 @@ import { elementDeclaration as e } from "@plitzi/sdk-shared/authoring/declare";
|
|
|
3
3
|
var t = e()({
|
|
4
4
|
type: "markdown",
|
|
5
5
|
content: {
|
|
6
|
-
attributes: {
|
|
6
|
+
attributes: {
|
|
7
|
+
content: "Markdown",
|
|
8
|
+
headingLinks: !0
|
|
9
|
+
},
|
|
7
10
|
definition: {
|
|
8
11
|
label: "Markdown",
|
|
9
12
|
type: "markdown",
|
|
10
|
-
description: "Renders a Markdown source string as
|
|
13
|
+
description: "Renders a Markdown source string (GitHub-flavoured) as HTML, inside a `div.markdown`. Each part of it takes a class through the slot named for it: `heading` (every `h1`–`h6`) and `heading1`…`heading6` (that level only, beside it — a property goes on one of the two, never both), `paragraph`, `link`, `strong`, `emphasis` (`em`), `list` (`ul`/`ol`), `listItem`, `quote` (`blockquote`), `divider` (`hr`), `code` (inline), `image`, `table`, `tableHead` (`thead`), `tableRow`, `tableHeaderCell` (`th`) and `tableCell` (`td`). A fenced block is `codeBlock` (its `pre`) in `codeBlockFrame`, under `codeBlockHeader`, which holds `codeBlockLanguage` and the `codeBlockCopy` button. Every heading carries an id made of its words, which `/page#its-words` lands on, and starts with an empty link to itself — `a.anchor > span.octicon-link`, the `anchor` slot; `headingLinks: false` leaves the link out and keeps the id. Unstyled, it reads as a document — headings, lists, code, tables — from the base layer of the SDK, which a class on the slot of a part replaces property by property.",
|
|
11
14
|
bindings: {},
|
|
12
|
-
styleSelectors: {
|
|
15
|
+
styleSelectors: {
|
|
16
|
+
base: "",
|
|
17
|
+
heading: "",
|
|
18
|
+
heading1: "",
|
|
19
|
+
heading2: "",
|
|
20
|
+
heading3: "",
|
|
21
|
+
heading4: "",
|
|
22
|
+
heading5: "",
|
|
23
|
+
heading6: "",
|
|
24
|
+
paragraph: "",
|
|
25
|
+
link: "",
|
|
26
|
+
strong: "",
|
|
27
|
+
emphasis: "",
|
|
28
|
+
list: "",
|
|
29
|
+
listItem: "",
|
|
30
|
+
quote: "",
|
|
31
|
+
divider: "",
|
|
32
|
+
code: "",
|
|
33
|
+
codeBlock: "",
|
|
34
|
+
codeBlockFrame: "",
|
|
35
|
+
codeBlockHeader: "",
|
|
36
|
+
codeBlockLanguage: "",
|
|
37
|
+
codeBlockCopy: "",
|
|
38
|
+
image: "",
|
|
39
|
+
table: "",
|
|
40
|
+
tableHead: "",
|
|
41
|
+
tableRow: "",
|
|
42
|
+
tableHeaderCell: "",
|
|
43
|
+
tableCell: "",
|
|
44
|
+
anchor: ""
|
|
45
|
+
},
|
|
13
46
|
initialState: { visibility: !0 }
|
|
14
47
|
},
|
|
15
48
|
builder: {
|
|
@@ -33,10 +66,7 @@ var t = e()({
|
|
|
33
66
|
defaultStyle: {
|
|
34
67
|
name: "Markdown",
|
|
35
68
|
displayMode: "desktop",
|
|
36
|
-
style: { base: { default: {
|
|
37
|
-
"font-size": "14px",
|
|
38
|
-
"line-height": "1.714"
|
|
39
|
-
} } }
|
|
69
|
+
style: { base: { default: {} } }
|
|
40
70
|
},
|
|
41
71
|
settings: {}
|
|
42
72
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MarkdownClassNames } from '../../../../components/MarkdownDocument';
|
|
2
|
+
/**
|
|
3
|
+
* The class of each part of a Markdown document, read off the element's slots of the same names — the same object
|
|
4
|
+
* while the classes stay the same: a new one rebuilds every tag of the document.
|
|
5
|
+
*/
|
|
6
|
+
declare const useMarkdownClassNames: (styleSelectors: Readonly<Partial<Record<string, string>>>) => MarkdownClassNames;
|
|
7
|
+
export default useMarkdownClassNames;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MARKDOWN_PARTS as e } from "../../../../components/MarkdownDocument/helpers/markdownParts.mjs";
|
|
2
|
+
import t from "@plitzi/sdk-shared/hooks/useStableValue";
|
|
3
|
+
//#region src/elements/basic/Markdown/hooks/useMarkdownClassNames.ts
|
|
4
|
+
var n = (n) => {
|
|
5
|
+
let r = {};
|
|
6
|
+
for (let t of e) {
|
|
7
|
+
let e = n[t];
|
|
8
|
+
e && (r[t] = e);
|
|
9
|
+
}
|
|
10
|
+
return t(r);
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as default };
|
|
@@ -6,14 +6,43 @@ declare const Markdown: {
|
|
|
6
6
|
readonly content: {
|
|
7
7
|
readonly attributes: {
|
|
8
8
|
readonly content: "Markdown";
|
|
9
|
+
readonly headingLinks: true;
|
|
9
10
|
};
|
|
10
11
|
readonly definition: {
|
|
11
12
|
readonly label: "Markdown";
|
|
12
13
|
readonly type: "markdown";
|
|
13
|
-
readonly description:
|
|
14
|
+
readonly description: string;
|
|
14
15
|
readonly bindings: {};
|
|
15
16
|
readonly styleSelectors: {
|
|
16
17
|
readonly base: "";
|
|
18
|
+
readonly heading: "";
|
|
19
|
+
readonly heading1: "";
|
|
20
|
+
readonly heading2: "";
|
|
21
|
+
readonly heading3: "";
|
|
22
|
+
readonly heading4: "";
|
|
23
|
+
readonly heading5: "";
|
|
24
|
+
readonly heading6: "";
|
|
25
|
+
readonly paragraph: "";
|
|
26
|
+
readonly link: "";
|
|
27
|
+
readonly strong: "";
|
|
28
|
+
readonly emphasis: "";
|
|
29
|
+
readonly list: "";
|
|
30
|
+
readonly listItem: "";
|
|
31
|
+
readonly quote: "";
|
|
32
|
+
readonly divider: "";
|
|
33
|
+
readonly code: "";
|
|
34
|
+
readonly codeBlock: "";
|
|
35
|
+
readonly codeBlockFrame: "";
|
|
36
|
+
readonly codeBlockHeader: "";
|
|
37
|
+
readonly codeBlockLanguage: "";
|
|
38
|
+
readonly codeBlockCopy: "";
|
|
39
|
+
readonly image: "";
|
|
40
|
+
readonly table: "";
|
|
41
|
+
readonly tableHead: "";
|
|
42
|
+
readonly tableRow: "";
|
|
43
|
+
readonly tableHeaderCell: "";
|
|
44
|
+
readonly tableCell: "";
|
|
45
|
+
readonly anchor: "";
|
|
17
46
|
};
|
|
18
47
|
readonly initialState: {
|
|
19
48
|
readonly visibility: true;
|
|
@@ -42,10 +71,7 @@ declare const Markdown: {
|
|
|
42
71
|
readonly displayMode: "desktop";
|
|
43
72
|
readonly style: {
|
|
44
73
|
readonly base: {
|
|
45
|
-
readonly default: {
|
|
46
|
-
readonly 'font-size': "14px";
|
|
47
|
-
readonly 'line-height': "1.714";
|
|
48
|
-
};
|
|
74
|
+
readonly default: {};
|
|
49
75
|
};
|
|
50
76
|
};
|
|
51
77
|
};
|
|
@@ -53,5 +79,6 @@ declare const Markdown: {
|
|
|
53
79
|
};
|
|
54
80
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
55
81
|
content?: string | undefined;
|
|
82
|
+
headingLinks?: boolean | undefined;
|
|
56
83
|
}>>;
|
|
57
84
|
export default Markdown;
|