@plitzi/sdk-elements 0.39.4 → 0.39.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.
- package/CHANGELOG.md +39 -0
- package/dist/components/ElementAdvancedEditor.mjs +4 -4
- package/dist/components/SettingsSection/SettingsSection.d.ts +19 -0
- package/dist/components/SettingsSection/SettingsSection.mjs +37 -0
- package/dist/components/SettingsSection/index.d.ts +2 -0
- package/dist/components/SettingsSection/index.mjs +1 -0
- package/dist/elements/advanced/BlockJsx/declaration.d.ts +1 -1
- package/dist/elements/advanced/BlockJsx/declaration.mjs +1 -1
- package/dist/elements/advanced/BlockJsx/index.d.ts +1 -1
- package/dist/elements/basic/Link/Settings.mjs +1 -1
- package/dist/elements/basic/RichText/Settings.mjs +1 -1
- package/dist/elements/declarations/index.d.ts +7 -3
- package/dist/elements/internal/LayoutContainer/Settings.mjs +1 -1
- package/dist/elements/internal/Page/Settings.mjs +323 -285
- package/dist/elements/internal/Page/settingsSummary.d.ts +26 -0
- package/dist/elements/internal/Page/settingsSummary.mjs +22 -0
- package/dist/elements/media/Image/Settings.mjs +2 -2
- package/dist/elements/media/Video/Settings.mjs +2 -2
- package/dist/elements/provider/ApiContainer/Settings.mjs +6 -6
- package/dist/elements/provider/ApiContainer/components/FiltersInput/FiltersInput.mjs +1 -1
- package/dist/elements/structure/Pagination/Settings.mjs +1 -1
- package/dist/elements/structure/TabContainer/TabContainer.mjs +15 -11
- package/dist/elements/structure/TabContainer/TabContainerItem/Settings.d.ts +6 -1
- package/dist/elements/structure/TabContainer/TabContainerItem/Settings.mjs +24 -3
- package/dist/elements/structure/TabContainer/TabContainerItem/TabContainerItem.d.ts +7 -1
- package/dist/elements/structure/TabContainer/TabContainerItem/TabContainerItem.mjs +66 -38
- package/dist/elements/structure/TabContainer/TabContainerItem/declaration.d.ts +6 -2
- package/dist/elements/structure/TabContainer/TabContainerItem/declaration.mjs +1 -1
- package/dist/elements/structure/TabContainer/TabContainerItem/index.d.ts +6 -2
- package/dist/elements/structure/TabContainer/TabContainerItem/openTabFromHash.d.ts +10 -0
- package/dist/elements/structure/TabContainer/TabContainerItem/openTabFromHash.mjs +18 -0
- package/dist/elements/structure/TabContainer/index.d.ts +6 -2
- package/dist/index.d.ts +7 -3
- package/package.json +12 -12
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DocumentScroll } from './declaration';
|
|
2
|
+
/**
|
|
3
|
+
* What each section of a page's settings says on its header, and the one line of help under its fields — of the state
|
|
4
|
+
* it is in, never of every state it could be in: a page's form wrote a notice under each field, and grew longer than
|
|
5
|
+
* the panel showed.
|
|
6
|
+
*/
|
|
7
|
+
export type AccessSettings = {
|
|
8
|
+
accessLevel: 'public' | 'authenticated' | '';
|
|
9
|
+
permissions: string[];
|
|
10
|
+
unauthorizedBehaviour: '' | 'redirect' | 'notFound';
|
|
11
|
+
/** The page a refused visitor is sent to, by name, when one is chosen. */
|
|
12
|
+
redirectName: string;
|
|
13
|
+
};
|
|
14
|
+
/** Who a page is for, and what anybody else gets: `Signed-in visitors · 404 to others`. */
|
|
15
|
+
export declare const accessSummary: ({ accessLevel, permissions, unauthorizedBehaviour, redirectName }: AccessSettings) => string;
|
|
16
|
+
/** Whether a page is kept from anybody: what its section's header draws in the accent. */
|
|
17
|
+
export declare const isRestricted: ({ accessLevel, permissions }: Pick<AccessSettings, "accessLevel" | "permissions">) => boolean;
|
|
18
|
+
/** The one line under the access fields, of the state they are in. */
|
|
19
|
+
export declare const accessHelp: ({ accessLevel, permissions, unauthorizedBehaviour }: AccessSettings) => string;
|
|
20
|
+
/** How the page scrolls, in a word, and what that means. */
|
|
21
|
+
export declare const scrollOf: (documentScroll: DocumentScroll | "") => {
|
|
22
|
+
label: string;
|
|
23
|
+
help: string;
|
|
24
|
+
};
|
|
25
|
+
/** What the search and sharing section holds: off, or the title a search result shows. */
|
|
26
|
+
export declare const seoSummary: (seoEnabled: boolean, title: string) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/elements/internal/Page/settingsSummary.ts
|
|
2
|
+
var e = ({ accessLevel: e, permissions: t, unauthorizedBehaviour: n, redirectName: r }) => {
|
|
3
|
+
let i = t.length > 0 ? `Needs ${t.join(", ")}` : e === "authenticated" ? "Signed-in visitors" : e === "public" ? "Signed-out visitors only" : "Anyone";
|
|
4
|
+
return i === "Anyone" ? i : `${i}${n === "notFound" ? " · 404 to others" : n === "redirect" ? ` · others to ${r || "a page"}` : ""}`;
|
|
5
|
+
}, t = ({ accessLevel: e, permissions: t }) => e !== "" || t.length > 0, n = ({ accessLevel: e, permissions: n, unauthorizedBehaviour: r }) => t({
|
|
6
|
+
accessLevel: e,
|
|
7
|
+
permissions: n
|
|
8
|
+
}) ? e === "public" && n.length === 0 ? "Only visitors who are not signed in can open this page." : `${n.length > 0 ? "Only signed-in visitors holding every one of these permissions see this page." : "Only signed-in visitors see this page."}${r === "notFound" ? " Anybody else gets the space’s 404, and nothing of it — not its name nor its path: for a back-office, whose refusal would tell a prober something is there." : r === "redirect" ? " Anybody else is sent to the redirect page." : " Anybody else is answered 401 or 403, and the server never sends them its content."}` : "Anyone on the internet can open this page.", r = {
|
|
9
|
+
"": {
|
|
10
|
+
label: "Scrolls",
|
|
11
|
+
help: "The page scrolls as any page does."
|
|
12
|
+
},
|
|
13
|
+
noBounce: {
|
|
14
|
+
label: "No bounce",
|
|
15
|
+
help: "The page scrolls, but a finger pulled past either end no longer bounces it or reloads it."
|
|
16
|
+
},
|
|
17
|
+
locked: {
|
|
18
|
+
label: "Locked",
|
|
19
|
+
help: "The page holds still: only the parts set to scroll on their own (overflow auto) move. For a screen that fills the window — a dashboard, a board."
|
|
20
|
+
}
|
|
21
|
+
}, i = (e) => r[e], a = (e, t) => e ? t || "On" : "Off";
|
|
22
|
+
export { n as accessHelp, e as accessSummary, t as isRestricted, i as scrollOf, a as seoSummary };
|
|
@@ -19,9 +19,9 @@ var l = ({ src: l = "", alt: u = "", decorative: d = !1, variables: f, fetchPrio
|
|
|
19
19
|
onChange: b.text("src"),
|
|
20
20
|
size: "xs"
|
|
21
21
|
}), y && /* @__PURE__ */ a("div", {
|
|
22
|
-
className: "relative mt-2 flex items-center justify-center rounded-sm border
|
|
22
|
+
className: "border-ui-line-strong relative mt-2 flex items-center justify-center rounded-sm border p-2",
|
|
23
23
|
children: [/* @__PURE__ */ i("div", {
|
|
24
|
-
className: "absolute top-2 left-2 rounded-tl rounded-br border
|
|
24
|
+
className: "border-ui-line-strong bg-ui-panel absolute top-2 left-2 rounded-tl rounded-br border p-1 text-xs",
|
|
25
25
|
children: "Preview"
|
|
26
26
|
}), /* @__PURE__ */ i("img", {
|
|
27
27
|
src: y,
|
|
@@ -15,9 +15,9 @@ var a = ({ src: a = "", autoPlay: o = !1, playsInline: s = !1, loop: c = !1, mut
|
|
|
15
15
|
label: "Url",
|
|
16
16
|
onChange: d.text("src")
|
|
17
17
|
}), a && /* @__PURE__ */ n("div", {
|
|
18
|
-
className: "relative mt-2 flex items-center justify-center rounded-sm border
|
|
18
|
+
className: "border-ui-line-strong relative mt-2 flex items-center justify-center rounded-sm border p-2",
|
|
19
19
|
children: [/* @__PURE__ */ t("div", {
|
|
20
|
-
className: "absolute top-2 left-2 rounded-tl rounded-br border
|
|
20
|
+
className: "border-ui-line-strong bg-ui-panel absolute top-2 left-2 rounded-tl rounded-br border p-1 text-xs",
|
|
21
21
|
children: "Preview"
|
|
22
22
|
}), /* @__PURE__ */ t("video", {
|
|
23
23
|
className: "h-full w-full rounded-sm",
|
|
@@ -56,7 +56,7 @@ var _ = [], v = ({ query: v = "", method: y = "get", accessToken: b = "", header
|
|
|
56
56
|
]
|
|
57
57
|
}),
|
|
58
58
|
/* @__PURE__ */ u("span", {
|
|
59
|
-
className: "text-
|
|
59
|
+
className: "text-ui-fg-subtle text-xs",
|
|
60
60
|
children: [
|
|
61
61
|
G === "connector" && "The server calls the API and hands the page its records. The endpoint and the credential never reach the browser, and the content is in the HTML search engines see.",
|
|
62
62
|
G === "action" && "A flow runs on the server and hands the page whatever its output step returns — for the read a connector cannot express: two calls joined, a computed field, a shape that depends on who is looking. It is fed this page’s route and query params.",
|
|
@@ -64,7 +64,7 @@ var _ = [], v = ({ query: v = "", method: y = "get", accessToken: b = "", header
|
|
|
64
64
|
]
|
|
65
65
|
}),
|
|
66
66
|
G === "action" && /* @__PURE__ */ u(c, { children: [B?.length === 0 && /* @__PURE__ */ l("div", {
|
|
67
|
-
className: "
|
|
67
|
+
className: "border-ui-line-strong text-ui-fg-subtle rounded-sm border p-2 text-xs",
|
|
68
68
|
children: "No actions yet. Add one in the Actions panel and give it a “While a page renders” trigger — that is the way in this element uses."
|
|
69
69
|
}), /* @__PURE__ */ u(p, {
|
|
70
70
|
value: T,
|
|
@@ -85,7 +85,7 @@ var _ = [], v = ({ query: v = "", method: y = "get", accessToken: b = "", header
|
|
|
85
85
|
}),
|
|
86
86
|
G === "connector" && /* @__PURE__ */ u(c, { children: [
|
|
87
87
|
X.length === 0 && /* @__PURE__ */ l("div", {
|
|
88
|
-
className: "
|
|
88
|
+
className: "border-ui-line-strong text-ui-fg-subtle rounded-sm border p-2 text-xs",
|
|
89
89
|
children: "No connectors yet. Add one in the Connectors panel — it holds the API endpoints, and the credential stays on the server."
|
|
90
90
|
}),
|
|
91
91
|
/* @__PURE__ */ u(p, {
|
|
@@ -170,7 +170,7 @@ var _ = [], v = ({ query: v = "", method: y = "get", accessToken: b = "", header
|
|
|
170
170
|
/* @__PURE__ */ u("div", {
|
|
171
171
|
className: "flex flex-col",
|
|
172
172
|
children: [/* @__PURE__ */ l("label", { children: "Query" }), /* @__PURE__ */ l(d, {
|
|
173
|
-
className: "min-h-6.5 basis-auto rounded-sm border
|
|
173
|
+
className: "border-ui-line-strong min-h-6.5 basis-auto rounded-sm border px-1 text-xs",
|
|
174
174
|
value: v,
|
|
175
175
|
theme: L,
|
|
176
176
|
mode: "text",
|
|
@@ -242,7 +242,7 @@ var _ = [], v = ({ query: v = "", method: y = "get", accessToken: b = "", header
|
|
|
242
242
|
size: "xs"
|
|
243
243
|
}),
|
|
244
244
|
/* @__PURE__ */ l("div", {
|
|
245
|
-
className: "
|
|
245
|
+
className: "border-ui-line-strong text-ui-fg-subtle rounded-sm border p-2 text-xs",
|
|
246
246
|
children: "A completed server action refreshes every cached request, in case it changed what they read. On its step, “Refresh cached requests” can name only the containers it affects, or none for an action that only reads. A webhook step can do the same."
|
|
247
247
|
})
|
|
248
248
|
] }),
|
|
@@ -344,7 +344,7 @@ var _ = [], v = ({ query: v = "", method: y = "get", accessToken: b = "", header
|
|
|
344
344
|
})
|
|
345
345
|
]
|
|
346
346
|
}),
|
|
347
|
-
/* @__PURE__ */ l("div", { className: "my-2 h-px w-full border
|
|
347
|
+
/* @__PURE__ */ l("div", { className: "border-ui-line-strong bg-ui-line-strong my-2 h-px w-full border" }),
|
|
348
348
|
/* @__PURE__ */ u("div", {
|
|
349
349
|
className: "flex min-h-50 grow flex-col",
|
|
350
350
|
children: [/* @__PURE__ */ l("label", { children: "Mock Data (Build Mode)" }), /* @__PURE__ */ l(d, {
|
|
@@ -75,7 +75,7 @@ var o = ({ mode: o = "pages", target: s = "url", pageParam: c = "page", windowSi
|
|
|
75
75
|
size: "xs"
|
|
76
76
|
}),
|
|
77
77
|
/* @__PURE__ */ r("span", {
|
|
78
|
-
className: "text-
|
|
78
|
+
className: "text-ui-fg-subtle text-xs",
|
|
79
79
|
children: [
|
|
80
80
|
"Bind ",
|
|
81
81
|
/* @__PURE__ */ n("strong", { children: "pageInfo" }),
|
|
@@ -6,19 +6,23 @@ import { useMemo as i, useState as a } from "react";
|
|
|
6
6
|
import { jsx as o } from "react/jsx-runtime";
|
|
7
7
|
import s from "clsx";
|
|
8
8
|
// src/elements/structure/TabContainer/TabContainer.tsx
|
|
9
|
-
var c = (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}), [m,
|
|
9
|
+
var c = (e) => {
|
|
10
|
+
if (typeof document > "u") return 0;
|
|
11
|
+
let t = document.querySelector(`[id^="${CSS.escape(`${e}_tab_`)}"][aria-selected="true"]`), n = t ? Number(t.id.slice(`${e}_tab_`.length)) : 0;
|
|
12
|
+
return Number.isInteger(n) && n >= 0 ? n : 0;
|
|
13
|
+
}, l = ({ ref: t, className: l = "", children: u }) => {
|
|
14
|
+
let { id: d, rootId: f } = n(), p = `${f}_${d}`, [m, h] = a(() => c(p)), g = i(() => ({
|
|
15
|
+
baseId: p,
|
|
16
|
+
tabSelected: m,
|
|
17
|
+
onSelect: h
|
|
18
|
+
}), [p, m]);
|
|
15
19
|
return /* @__PURE__ */ o(r, {
|
|
16
20
|
ref: t,
|
|
17
|
-
className: s("plitzi-component__tab-container",
|
|
21
|
+
className: s("plitzi-component__tab-container", l),
|
|
18
22
|
children: /* @__PURE__ */ o(e, {
|
|
19
|
-
value:
|
|
20
|
-
children:
|
|
23
|
+
value: g,
|
|
24
|
+
children: u
|
|
21
25
|
})
|
|
22
26
|
});
|
|
23
|
-
},
|
|
24
|
-
export {
|
|
27
|
+
}, u = t(l);
|
|
28
|
+
export { l as TabContainer, u as default };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
type SettingsProps = {
|
|
2
|
+
hash?: string;
|
|
3
|
+
onUpdate?: (key: string, value: string | boolean | number) => void;
|
|
4
|
+
};
|
|
5
|
+
/** A tab's settings: the address hash that opens it (`#domains`), which choosing it writes. */
|
|
6
|
+
declare const Settings: ({ hash, onUpdate }: SettingsProps) => import('react').JSX.Element;
|
|
2
7
|
export default Settings;
|
|
@@ -1,4 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from "../../../useSettingsUpdate.mjs";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import r from "@plitzi/plitzi-ui/Input";
|
|
2
4
|
// src/elements/structure/TabContainer/TabContainerItem/Settings.tsx
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
+
var i = ({ hash: i = "", onUpdate: a }) => {
|
|
6
|
+
let o = e(a);
|
|
7
|
+
return /* @__PURE__ */ n("div", {
|
|
8
|
+
className: "flex flex-col gap-4 py-2",
|
|
9
|
+
children: [/* @__PURE__ */ t(r, {
|
|
10
|
+
value: i,
|
|
11
|
+
label: "Address hash",
|
|
12
|
+
placeholder: "domains",
|
|
13
|
+
onChange: o.text("hash"),
|
|
14
|
+
size: "xs"
|
|
15
|
+
}), /* @__PURE__ */ n("span", {
|
|
16
|
+
className: "text-ui-fg-subtle text-xs",
|
|
17
|
+
children: [
|
|
18
|
+
"A link to the page ending in #",
|
|
19
|
+
i || "domains",
|
|
20
|
+
" opens on this tab, and choosing the tab writes it in the address. Set it on the header’s tab."
|
|
21
|
+
]
|
|
22
|
+
})]
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export { i as default };
|
|
@@ -3,6 +3,12 @@ export type TabContainerItemProps = {
|
|
|
3
3
|
ref: RefObject<HTMLElement>;
|
|
4
4
|
className: string;
|
|
5
5
|
children: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* The address's hash that opens this tab — `domains` for `#domains`: a link to the page with it opens on this tab,
|
|
8
|
+
* and choosing the tab writes it in the address (replacing it, so Back leaves the page rather than the tab). Only a tab
|
|
9
|
+
* of the header reads it.
|
|
10
|
+
*/
|
|
11
|
+
hash?: string;
|
|
6
12
|
baseId?: string;
|
|
7
13
|
tabSelected?: number;
|
|
8
14
|
/** The item's position among its siblings — not the HTML attribute, which the tabs set themselves. */
|
|
@@ -12,7 +18,7 @@ export type TabContainerItemProps = {
|
|
|
12
18
|
isHeader?: boolean;
|
|
13
19
|
onSelect?: Dispatch<SetStateAction<number>>;
|
|
14
20
|
};
|
|
15
|
-
declare const TabContainerItem: ({ className, children, ref, baseId, tabSelected, tabIndex: position, tabCount, isHeader, onSelect }: TabContainerItemProps) => import('react').JSX.Element;
|
|
21
|
+
declare const TabContainerItem: ({ className, children, ref, baseId, tabSelected, tabIndex: position, tabCount, isHeader, onSelect, hash }: TabContainerItemProps) => import('react').JSX.Element;
|
|
16
22
|
declare const _default: import('react').FC<import('../../../..').WithElementProps<TabContainerItemProps>>;
|
|
17
23
|
export default _default;
|
|
18
24
|
export { TabContainerItem };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
import { openTabFromHash as e } from "./openTabFromHash.mjs";
|
|
2
|
+
import t from "../../../../Element/hocs/withElement.mjs";
|
|
3
|
+
import { RootElement as n } from "../../../../Element/RootElement.mjs";
|
|
4
|
+
import { useCallback as r, useEffect as i, useLayoutEffect as a, useRef as o } from "react";
|
|
5
|
+
import { usePrePaint as s } from "@plitzi/sdk-shared/hooks";
|
|
6
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
7
|
+
import l from "clsx";
|
|
6
8
|
// src/elements/structure/TabContainer/TabContainerItem/TabContainerItem.tsx
|
|
7
|
-
var
|
|
9
|
+
var u = (e, t, n) => {
|
|
8
10
|
switch (e) {
|
|
9
11
|
case "ArrowRight":
|
|
10
12
|
case "ArrowDown": return (t + 1) % n;
|
|
@@ -14,46 +16,72 @@ var a = (e, t, n) => {
|
|
|
14
16
|
case "End": return n - 1;
|
|
15
17
|
default: return;
|
|
16
18
|
}
|
|
17
|
-
},
|
|
18
|
-
let
|
|
19
|
-
|
|
19
|
+
}, d = ({ className: t = "", children: d, ref: f, baseId: p = "", tabSelected: m, tabIndex: h = 0, tabCount: g = 0, isHeader: _, onSelect: v, hash: y = "" }) => {
|
|
20
|
+
let b = m === h, x = y.replace(/^#/, "").trim(), S = !!(_ && x);
|
|
21
|
+
s("tab-hash", e, S), a(() => {
|
|
22
|
+
if (!S || typeof window > "u") return;
|
|
23
|
+
let e = () => {
|
|
24
|
+
decodeURIComponent(window.location.hash.slice(1)) === x && v?.(h);
|
|
25
|
+
};
|
|
26
|
+
return e(), window.addEventListener("hashchange", e), () => window.removeEventListener("hashchange", e);
|
|
20
27
|
}, [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
])
|
|
28
|
+
S,
|
|
29
|
+
x,
|
|
30
|
+
v,
|
|
31
|
+
h
|
|
32
|
+
]);
|
|
33
|
+
let C = o(void 0);
|
|
34
|
+
i(() => {
|
|
35
|
+
let e = C.current;
|
|
36
|
+
if (C.current = b, S && b && e === !1 && typeof window < "u" && decodeURIComponent(window.location.hash.slice(1)) !== x) {
|
|
37
|
+
let { pathname: e, search: t } = window.location;
|
|
38
|
+
window.history.replaceState(window.history.state, "", `${e}${t}#${encodeURIComponent(x)}`);
|
|
39
|
+
}
|
|
40
|
+
}, [
|
|
41
|
+
S,
|
|
42
|
+
x,
|
|
43
|
+
b
|
|
44
|
+
]);
|
|
45
|
+
let w = `${p}_tab_${h}`, T = `${p}_panel_${h}`, E = r(() => {
|
|
46
|
+
_ && !b && v?.(h);
|
|
47
|
+
}, [
|
|
48
|
+
_,
|
|
49
|
+
b,
|
|
50
|
+
h,
|
|
51
|
+
v
|
|
52
|
+
]), D = r((e) => {
|
|
26
53
|
if (e.key === "Enter" || e.key === " ") {
|
|
27
|
-
e.preventDefault(),
|
|
54
|
+
e.preventDefault(), v?.(h);
|
|
28
55
|
return;
|
|
29
56
|
}
|
|
30
|
-
let t =
|
|
31
|
-
t !== void 0 &&
|
|
57
|
+
let t = u(e.key, h, g);
|
|
58
|
+
t !== void 0 && g !== 0 && (e.preventDefault(), v?.(t), e.currentTarget.ownerDocument.getElementById(`${p}_tab_${t}`)?.focus());
|
|
32
59
|
}, [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
]),
|
|
38
|
-
id:
|
|
60
|
+
p,
|
|
61
|
+
h,
|
|
62
|
+
g,
|
|
63
|
+
v
|
|
64
|
+
]), O = _ ? {
|
|
65
|
+
id: w,
|
|
39
66
|
role: "tab",
|
|
40
|
-
"aria-selected":
|
|
41
|
-
"aria-controls":
|
|
42
|
-
tabIndex:
|
|
43
|
-
onKeyDown:
|
|
67
|
+
"aria-selected": b,
|
|
68
|
+
"aria-controls": T,
|
|
69
|
+
tabIndex: b ? 0 : -1,
|
|
70
|
+
onKeyDown: D,
|
|
71
|
+
...S ? { "data-tab-hash": x } : {}
|
|
44
72
|
} : {
|
|
45
|
-
id:
|
|
73
|
+
id: T,
|
|
46
74
|
role: "tabpanel",
|
|
47
|
-
"aria-labelledby":
|
|
75
|
+
"aria-labelledby": w,
|
|
48
76
|
tabIndex: 0,
|
|
49
|
-
hidden: !
|
|
77
|
+
hidden: !b
|
|
50
78
|
};
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
ref:
|
|
53
|
-
onClick:
|
|
54
|
-
className:
|
|
55
|
-
...
|
|
56
|
-
children:
|
|
79
|
+
return /* @__PURE__ */ c(n, {
|
|
80
|
+
ref: f,
|
|
81
|
+
onClick: E,
|
|
82
|
+
className: l("plitzi-component__tab-container-item", t, { active: b }),
|
|
83
|
+
...p ? O : {},
|
|
84
|
+
children: d
|
|
57
85
|
});
|
|
58
|
-
},
|
|
59
|
-
export {
|
|
86
|
+
}, f = t(d);
|
|
87
|
+
export { d as TabContainerItem, f as default };
|
|
@@ -11,7 +11,9 @@ declare const declaration: import('@plitzi/sdk-shared/authoring').DeclaredElemen
|
|
|
11
11
|
readonly tabindex: "roving: 0 on the open tab, -1 on the rest — the arrow keys move between them";
|
|
12
12
|
};
|
|
13
13
|
readonly content: {
|
|
14
|
-
readonly attributes: {
|
|
14
|
+
readonly attributes: {
|
|
15
|
+
readonly hash: "";
|
|
16
|
+
};
|
|
15
17
|
readonly definition: {
|
|
16
18
|
readonly label: "Tab Container Item";
|
|
17
19
|
readonly description: "One selectable tab (trigger + panel) inside a tabContainer.";
|
|
@@ -33,5 +35,7 @@ declare const declaration: import('@plitzi/sdk-shared/authoring').DeclaredElemen
|
|
|
33
35
|
readonly subTypes: {};
|
|
34
36
|
};
|
|
35
37
|
};
|
|
36
|
-
},
|
|
38
|
+
}, Partial<{
|
|
39
|
+
hash?: string | undefined;
|
|
40
|
+
}>>;
|
|
37
41
|
export default declaration;
|
|
@@ -9,7 +9,7 @@ var t = e()({
|
|
|
9
9
|
tabindex: "roving: 0 on the open tab, -1 on the rest — the arrow keys move between them"
|
|
10
10
|
},
|
|
11
11
|
content: {
|
|
12
|
-
attributes: {},
|
|
12
|
+
attributes: { hash: "" },
|
|
13
13
|
definition: {
|
|
14
14
|
label: "Tab Container Item",
|
|
15
15
|
description: "One selectable tab (trigger + panel) inside a tabContainer.",
|
|
@@ -7,7 +7,9 @@ declare const TabContainerItem: import('react').FC<import('../../../..').WithEle
|
|
|
7
7
|
readonly tabindex: "roving: 0 on the open tab, -1 on the rest — the arrow keys move between them";
|
|
8
8
|
};
|
|
9
9
|
readonly content: {
|
|
10
|
-
readonly attributes: {
|
|
10
|
+
readonly attributes: {
|
|
11
|
+
readonly hash: "";
|
|
12
|
+
};
|
|
11
13
|
readonly definition: {
|
|
12
14
|
readonly label: "Tab Container Item";
|
|
13
15
|
readonly description: "One selectable tab (trigger + panel) inside a tabContainer.";
|
|
@@ -31,5 +33,7 @@ declare const TabContainerItem: import('react').FC<import('../../../..').WithEle
|
|
|
31
33
|
};
|
|
32
34
|
} & {
|
|
33
35
|
content: import('@plitzi/sdk-shared/authoring').ElementContentDefaults;
|
|
34
|
-
} & import('@plitzi/sdk-shared/authoring').ElementAttributesBrand<
|
|
36
|
+
} & import('@plitzi/sdk-shared/authoring').ElementAttributesBrand<Partial<{
|
|
37
|
+
hash?: string | undefined;
|
|
38
|
+
}>>;
|
|
35
39
|
export default TabContainerItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tab the address names (`#domains`, a tab's `hash`), opened as the page is parsed — run by the page before it
|
|
3
|
+
* paints (`usePrePaint`), because the server never sees the hash and draws a page's tabs on their first. It sets the
|
|
4
|
+
* tabs' attributes and their panels' as the tabs would draw them, and the container hydrates on the tab the document
|
|
5
|
+
* shows (`TabContainer`'s first state), so React finds what it would have drawn.
|
|
6
|
+
*
|
|
7
|
+
* Its source is what the page runs: it reads the document and the window alone, closes over nothing and declares no
|
|
8
|
+
* function inside it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const openTabFromHash: () => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/elements/structure/TabContainer/TabContainerItem/openTabFromHash.ts
|
|
2
|
+
var e = () => {
|
|
3
|
+
let e = "";
|
|
4
|
+
try {
|
|
5
|
+
e = decodeURIComponent(window.location.hash.slice(1));
|
|
6
|
+
} catch {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (e) {
|
|
10
|
+
for (let t of document.querySelectorAll("[role=\"tab\"][data-tab-hash]")) if (t.getAttribute("data-tab-hash") === e && t.getAttribute("aria-selected") !== "true" && t.parentElement) for (let e of t.parentElement.querySelectorAll(":scope > [role=\"tab\"]")) {
|
|
11
|
+
let n = e === t;
|
|
12
|
+
e.setAttribute("aria-selected", String(n)), e.setAttribute("tabindex", n ? "0" : "-1"), e.classList.toggle("active", n);
|
|
13
|
+
let r = document.getElementById(e.getAttribute("aria-controls") ?? "");
|
|
14
|
+
r && (r.hidden = !n, r.classList.toggle("active", n));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export { e as openTabFromHash };
|
|
@@ -77,7 +77,9 @@ declare const TabContainer: import('react').FC<import('../../..').WithElementPro
|
|
|
77
77
|
readonly tabindex: "roving: 0 on the open tab, -1 on the rest — the arrow keys move between them";
|
|
78
78
|
};
|
|
79
79
|
readonly content: {
|
|
80
|
-
readonly attributes: {
|
|
80
|
+
readonly attributes: {
|
|
81
|
+
readonly hash: "";
|
|
82
|
+
};
|
|
81
83
|
readonly definition: {
|
|
82
84
|
readonly label: "Tab Container Item";
|
|
83
85
|
readonly description: "One selectable tab (trigger + panel) inside a tabContainer.";
|
|
@@ -101,7 +103,9 @@ declare const TabContainer: import('react').FC<import('../../..').WithElementPro
|
|
|
101
103
|
};
|
|
102
104
|
} & {
|
|
103
105
|
content: import('@plitzi/sdk-shared/authoring').ElementContentDefaults;
|
|
104
|
-
} & import('@plitzi/sdk-shared/authoring').ElementAttributesBrand<
|
|
106
|
+
} & import('@plitzi/sdk-shared/authoring').ElementAttributesBrand<Partial<{
|
|
107
|
+
hash?: string | undefined;
|
|
108
|
+
}>>;
|
|
105
109
|
};
|
|
106
110
|
type: "tabContainer";
|
|
107
111
|
content: {
|
package/dist/index.d.ts
CHANGED
|
@@ -619,7 +619,7 @@ export declare const defaultElements: {
|
|
|
619
619
|
readonly type: "blockJsx";
|
|
620
620
|
readonly content: {
|
|
621
621
|
readonly attributes: {
|
|
622
|
-
readonly content: "import { useCallback } from \"react\";\nimport { JsxManager } from \"@plitzi/plitzi-sdk\";\n\nconst BlockJsx = ({ internalProps, content, content2 }) => {\n
|
|
622
|
+
readonly content: "import { useCallback } from \"react\";\nimport { JsxManager } from \"@plitzi/plitzi-sdk\";\n\nconst BlockJsx = ({ internalProps, content, content2 }) => {\n const handleClick = useCallback(() => {\n alert(\"Hello World\");\n }, []);\n\n return (\n <div style={{ display: \"flex\", gap: \"4px\" }}>\n <JsxManager\n as=\"Heading\"\n internalProps={internalProps}\n content={`${content} ${content2}`}\n />\n <button onClick={handleClick} style={{ border: \"1px gray solid\", cursor: \"pointer\" }}>\n Click Me\n </button>\n </div>\n );\n};\n\nexport default BlockJsx;";
|
|
623
623
|
readonly props: "{\"content\": \"Hello\", \"content2\": \"World\"}";
|
|
624
624
|
readonly contentCache: "aW1wb3J0ICogYXMgUmVhY3QgZnJvbSAncmVhY3QnOwppbXBvcnQgeyB1c2VDYWxsYmFjayB9IGZyb20gInJlYWN0IjsKaW1wb3J0IHsgSnN4TWFuYWdlciB9IGZyb20gIkBwbGl0emkvcGxpdHppLXNkayI7CnZhciBCbG9ja0pzeCA9IGZ1bmN0aW9uIEJsb2NrSnN4KF9yZWYpIHsKICB2YXIgaW50ZXJuYWxQcm9wcyA9IF9yZWYuaW50ZXJuYWxQcm9wcywKICAgIGNvbnRlbnQgPSBfcmVmLmNvbnRlbnQsCiAgICBjb250ZW50MiA9IF9yZWYuY29udGVudDI7CiAgdmFyIGhhbmRsZUNsaWNrID0gdXNlQ2FsbGJhY2soZnVuY3Rpb24gKCkgewogICAgYWxlcnQoIkhlbGxvIFdvcmxkIik7CiAgfSwgW10pOwogIHJldHVybiAvKiNfX1BVUkVfXyovUmVhY3QuY3JlYXRlRWxlbWVudCgiZGl2IiwgewogICAgc3R5bGU6IHsKICAgICAgZGlzcGxheTogImZsZXgiLAogICAgICBnYXA6ICI0cHgiCiAgICB9CiAgfSwgLyojX19QVVJFX18qL1JlYWN0LmNyZWF0ZUVsZW1lbnQoSnN4TWFuYWdlciwgewogICAgYXM6ICJIZWFkaW5nIiwKICAgIGludGVybmFsUHJvcHM6IGludGVybmFsUHJvcHMsCiAgICBjb250ZW50OiAiIi5jb25jYXQoY29udGVudCwgIiAiKS5jb25jYXQoY29udGVudDIpCiAgfSksIC8qI19fUFVSRV9fKi9SZWFjdC5jcmVhdGVFbGVtZW50KCJidXR0b24iLCB7CiAgICBvbkNsaWNrOiBoYW5kbGVDbGljaywKICAgIHN0eWxlOiB7CiAgICAgIGJvcmRlcjogIjFweCBncmF5IHNvbGlkIiwKICAgICAgY3Vyc29yOiAncG9pbnRlcicKICAgIH0KICB9LCAiQ2xpY2sgTWUiKSk7Cn07CmV4cG9ydCBkZWZhdWx0IEJsb2NrSnN4Ow==";
|
|
625
625
|
readonly allowEmptyRender: false;
|
|
@@ -1371,7 +1371,9 @@ export declare const defaultElements: {
|
|
|
1371
1371
|
readonly tabindex: "roving: 0 on the open tab, -1 on the rest — the arrow keys move between them";
|
|
1372
1372
|
};
|
|
1373
1373
|
readonly content: {
|
|
1374
|
-
readonly attributes: {
|
|
1374
|
+
readonly attributes: {
|
|
1375
|
+
readonly hash: "";
|
|
1376
|
+
};
|
|
1375
1377
|
readonly definition: {
|
|
1376
1378
|
readonly label: "Tab Container Item";
|
|
1377
1379
|
readonly description: "One selectable tab (trigger + panel) inside a tabContainer.";
|
|
@@ -1395,7 +1397,9 @@ export declare const defaultElements: {
|
|
|
1395
1397
|
};
|
|
1396
1398
|
} & {
|
|
1397
1399
|
content: import('@plitzi/sdk-shared/authoring').ElementContentDefaults;
|
|
1398
|
-
} & import('@plitzi/sdk-shared/authoring').ElementAttributesBrand<
|
|
1400
|
+
} & import('@plitzi/sdk-shared/authoring').ElementAttributesBrand<Partial<{
|
|
1401
|
+
hash?: string | undefined;
|
|
1402
|
+
}>>;
|
|
1399
1403
|
};
|
|
1400
1404
|
type: "tabContainer";
|
|
1401
1405
|
content: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-elements",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.7",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"sideEffects": false,
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@dr.pogodin/react-helmet": "^3.3.2",
|
|
36
|
-
"@plitzi/nexus": "^1.
|
|
37
|
-
"@plitzi/plitzi-ui": "^1.6.
|
|
38
|
-
"@plitzi/sdk-auth": "0.39.
|
|
39
|
-
"@plitzi/sdk-event-bridge": "0.39.
|
|
40
|
-
"@plitzi/sdk-interactions": "0.39.
|
|
41
|
-
"@plitzi/sdk-navigation": "0.39.
|
|
42
|
-
"@plitzi/sdk-schema": "0.39.
|
|
43
|
-
"@plitzi/sdk-shared": "0.39.
|
|
36
|
+
"@plitzi/nexus": "^1.5.1",
|
|
37
|
+
"@plitzi/plitzi-ui": "^1.6.40",
|
|
38
|
+
"@plitzi/sdk-auth": "0.39.7",
|
|
39
|
+
"@plitzi/sdk-event-bridge": "0.39.7",
|
|
40
|
+
"@plitzi/sdk-interactions": "0.39.7",
|
|
41
|
+
"@plitzi/sdk-navigation": "0.39.7",
|
|
42
|
+
"@plitzi/sdk-schema": "0.39.7",
|
|
43
|
+
"@plitzi/sdk-shared": "0.39.7",
|
|
44
44
|
"clsx": "^2.1.1",
|
|
45
|
-
"dompurify": "^3.4.
|
|
46
|
-
"immer": "^11.2.
|
|
45
|
+
"dompurify": "^3.4.18",
|
|
46
|
+
"immer": "^11.2.10",
|
|
47
47
|
"react-markdown": "^10.1.0",
|
|
48
48
|
"react-syntax-highlighter": "^16.1.2",
|
|
49
49
|
"remark-gfm": "^4.0.1"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"eslint": "^9.39.5",
|
|
58
58
|
"react": "^19.3.1",
|
|
59
59
|
"typescript": "^6.0.3",
|
|
60
|
-
"vite": "^8.3.
|
|
60
|
+
"vite": "^8.3.8",
|
|
61
61
|
"vitest": "^5.1.0"
|
|
62
62
|
}
|
|
63
63
|
}
|