@plitzi/sdk-elements 0.39.12 → 0.39.14
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 +28 -0
- package/dist/Element/PluginManager.mjs +13 -13
- package/dist/Element/hooks/useElementState.d.ts +1 -1
- package/dist/Element/hooks/useFullscreenInteractions.d.ts +11 -0
- package/dist/Element/hooks/useFullscreenInteractions.mjs +14 -0
- package/dist/Element/hooks/useRootElementInteractions.mjs +93 -87
- package/dist/builder/ruleFields.d.ts +1 -1
- package/dist/builder/ruleFields.mjs +5 -0
- package/dist/dataSource/GlobalSources.mjs +121 -104
- package/dist/dataSource/useAudienceScope.mjs +2 -1
- package/dist/dataSource/usePageClock.d.ts +12 -0
- package/dist/dataSource/usePageClock.mjs +19 -0
- package/dist/elements/basic/Countdown/Countdown.d.ts +23 -0
- package/dist/elements/basic/Countdown/Countdown.mjs +58 -0
- package/dist/elements/basic/Countdown/Settings.d.ts +12 -0
- package/dist/elements/basic/Countdown/Settings.mjs +94 -0
- package/dist/elements/basic/Countdown/declaration.d.ts +72 -0
- package/dist/elements/basic/Countdown/declaration.mjs +58 -0
- package/dist/elements/basic/Countdown/index.d.ts +69 -0
- package/dist/elements/basic/Countdown/index.mjs +5 -0
- package/dist/elements/declarations/index.d.ts +508 -7
- package/dist/elements/declarations/index.mjs +84 -72
- package/dist/elements/index.d.ts +13 -3
- package/dist/elements/index.mjs +76 -66
- package/dist/elements/media/Image/Image.d.ts +6 -1
- package/dist/elements/media/Image/Image.mjs +44 -35
- package/dist/elements/media/Image/Settings.d.ts +2 -1
- package/dist/elements/media/Image/Settings.mjs +26 -19
- package/dist/elements/media/Image/declaration.d.ts +2 -0
- package/dist/elements/media/Image/declaration.mjs +2 -1
- package/dist/elements/media/Image/index.d.ts +2 -0
- package/dist/elements/settings.mjs +92 -80
- package/dist/elements/structure/Container/Container.d.ts +2 -4
- package/dist/elements/structure/Container/Container.mjs +5 -6
- package/dist/elements/structure/Container/Settings.d.ts +1 -2
- package/dist/elements/structure/Container/Settings.mjs +5 -19
- package/dist/elements/structure/Container/declaration.d.ts +1 -2
- package/dist/elements/structure/Container/declaration.mjs +1 -3
- package/dist/elements/structure/Container/index.d.ts +1 -2
- package/dist/elements/structure/Disclosure/Disclosure.d.ts +26 -0
- package/dist/elements/structure/Disclosure/Disclosure.mjs +49 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/DisclosureSummary.d.ts +16 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/DisclosureSummary.mjs +19 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/Settings.d.ts +7 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/Settings.mjs +20 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/declaration.d.ts +59 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/declaration.mjs +47 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/index.d.ts +57 -0
- package/dist/elements/structure/Disclosure/DisclosureSummary/index.mjs +5 -0
- package/dist/elements/structure/Disclosure/Settings.d.ts +10 -0
- package/dist/elements/structure/Disclosure/Settings.mjs +47 -0
- package/dist/elements/structure/Disclosure/declaration.d.ts +66 -0
- package/dist/elements/structure/Disclosure/declaration.mjs +55 -0
- package/dist/elements/structure/Disclosure/index.d.ts +121 -0
- package/dist/elements/structure/Disclosure/index.mjs +9 -0
- package/dist/elements/structure/Disclosure/useDetails.d.ts +27 -0
- package/dist/elements/structure/Disclosure/useDetails.mjs +49 -0
- package/dist/elements/structure/TimeWindow/TimeWindow.mjs +29 -25
- package/dist/elements/structure/TimeWindow/TimeWindowContext.d.ts +6 -0
- package/dist/elements/structure/TimeWindow/TimeWindowContext.mjs +4 -0
- package/dist/elements/{testing → structure}/Variants/Settings.mjs +1 -1
- package/dist/elements/{testing → structure}/Variants/VariantItem/Settings.mjs +1 -1
- package/dist/elements/{testing → structure}/Variants/VariantItem/VariantItem.mjs +1 -1
- package/dist/elements/{testing → structure}/Variants/VariantItem/declaration.d.ts +1 -1
- package/dist/elements/{testing → structure}/Variants/VariantItem/declaration.mjs +2 -2
- package/dist/elements/{testing → structure}/Variants/VariantItem/index.d.ts +1 -1
- package/dist/elements/{testing → structure}/Variants/VariantItem/index.mjs +1 -1
- package/dist/elements/{testing → structure}/Variants/Variants.mjs +12 -12
- package/dist/elements/{testing → structure/Variants}/childOfItem.mjs +1 -1
- package/dist/elements/{testing → structure}/Variants/declaration.d.ts +1 -1
- package/dist/elements/{testing → structure}/Variants/declaration.mjs +3 -3
- package/dist/elements/{testing → structure}/Variants/index.d.ts +2 -2
- package/dist/elements/{testing → structure}/Variants/index.mjs +1 -1
- package/dist/elements/user/Account/Account.d.ts +25 -0
- package/dist/elements/user/Account/Account.mjs +104 -0
- package/dist/elements/user/Account/Settings.d.ts +10 -0
- package/dist/elements/user/Account/Settings.mjs +47 -0
- package/dist/elements/user/Account/declaration.d.ts +143 -0
- package/dist/elements/user/Account/declaration.mjs +123 -0
- package/dist/elements/user/Account/index.d.ts +141 -0
- package/dist/elements/user/Account/index.mjs +5 -0
- package/dist/elements/user/Avatar/Avatar.d.ts +19 -0
- package/dist/elements/user/Avatar/Avatar.mjs +26 -0
- package/dist/elements/user/Avatar/AvatarFace.d.ts +15 -0
- package/dist/elements/user/Avatar/AvatarFace.mjs +28 -0
- package/dist/elements/user/Avatar/Settings.d.ts +9 -0
- package/dist/elements/user/Avatar/Settings.mjs +38 -0
- package/dist/elements/user/Avatar/declaration.d.ts +65 -0
- package/dist/elements/user/Avatar/declaration.mjs +53 -0
- package/dist/elements/user/Avatar/faces.d.ts +10 -0
- package/dist/elements/user/Avatar/faces.mjs +10 -0
- package/dist/elements/user/Avatar/index.d.ts +63 -0
- package/dist/elements/user/Avatar/index.mjs +5 -0
- package/dist/elements/user/SignInForm/Settings.d.ts +16 -0
- package/dist/elements/user/SignInForm/Settings.mjs +64 -0
- package/dist/elements/user/SignInForm/SignInForm.d.ts +34 -0
- package/dist/elements/user/SignInForm/SignInForm.mjs +112 -0
- package/dist/elements/user/SignInForm/declaration.d.ts +120 -0
- package/dist/elements/user/SignInForm/declaration.mjs +99 -0
- package/dist/elements/user/SignInForm/index.d.ts +118 -0
- package/dist/elements/user/SignInForm/index.mjs +5 -0
- package/dist/index.d.ts +514 -6
- package/dist/index.mjs +84 -74
- package/package.json +7 -7
- /package/dist/elements/{testing → structure}/Variants/Settings.d.ts +0 -0
- /package/dist/elements/{testing → structure}/Variants/VariantItem/Settings.d.ts +0 -0
- /package/dist/elements/{testing → structure}/Variants/VariantItem/VariantItem.d.ts +0 -0
- /package/dist/elements/{testing → structure}/Variants/Variants.d.ts +0 -0
- /package/dist/elements/{testing → structure/Variants}/childOfItem.d.ts +0 -0
|
@@ -2,7 +2,7 @@ import e from "../../../../Element/hocs/withElement.mjs";
|
|
|
2
2
|
import { RootElement as t } from "../../../../Element/RootElement.mjs";
|
|
3
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
4
|
import r from "clsx";
|
|
5
|
-
// src/elements/
|
|
5
|
+
// src/elements/structure/Variants/VariantItem/VariantItem.tsx
|
|
6
6
|
var i = ({ ref: e, className: i = "", children: a }) => /* @__PURE__ */ n(t, {
|
|
7
7
|
ref: e,
|
|
8
8
|
className: r("plitzi-component__variant-item", i),
|
|
@@ -19,7 +19,7 @@ declare const declaration: import('@plitzi/sdk-shared/authoring').DeclaredElemen
|
|
|
19
19
|
readonly itemsNotAllowed: ["variantItem"];
|
|
20
20
|
};
|
|
21
21
|
readonly market: {
|
|
22
|
-
readonly category: "
|
|
22
|
+
readonly category: "structure";
|
|
23
23
|
readonly icon: "fa-solid fa-code-branch";
|
|
24
24
|
};
|
|
25
25
|
readonly defaultStyle: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { elementDeclaration as e } from "@plitzi/sdk-shared/authoring";
|
|
2
2
|
import { VARIANTS_TYPE as t, VARIANT_ITEM_TYPE as n } from "@plitzi/sdk-shared/variants";
|
|
3
3
|
import { DEFAULT_VARIANT_WEIGHT as r } from "@plitzi/sdk-shared/experiments";
|
|
4
|
-
// src/elements/
|
|
4
|
+
// src/elements/structure/Variants/VariantItem/declaration.ts
|
|
5
5
|
var i = e()({
|
|
6
6
|
type: n,
|
|
7
7
|
ancestorType: t,
|
|
@@ -17,7 +17,7 @@ var i = e()({
|
|
|
17
17
|
itemsNotAllowed: [n]
|
|
18
18
|
},
|
|
19
19
|
market: {
|
|
20
|
-
category: "
|
|
20
|
+
category: "structure",
|
|
21
21
|
icon: "fa-solid fa-code-branch"
|
|
22
22
|
},
|
|
23
23
|
defaultStyle: {
|
|
@@ -15,7 +15,7 @@ declare const VariantItem: import('react').FC<import('../../../..').WithElementP
|
|
|
15
15
|
readonly itemsNotAllowed: ["variantItem"];
|
|
16
16
|
};
|
|
17
17
|
readonly market: {
|
|
18
|
-
readonly category: "
|
|
18
|
+
readonly category: "structure";
|
|
19
19
|
readonly icon: "fa-solid fa-code-branch";
|
|
20
20
|
};
|
|
21
21
|
readonly defaultStyle: {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "../../../
|
|
3
|
-
import n from "../../../Element/
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import { childOfItem as e } from "./childOfItem.mjs";
|
|
2
|
+
import t from "../../../dataSource/useAudienceScope.mjs";
|
|
3
|
+
import n from "../../../Element/hocs/withElement.mjs";
|
|
4
|
+
import r from "../../../Element/hooks/useElement.mjs";
|
|
5
|
+
import { RootElement as i } from "../../../Element/RootElement.mjs";
|
|
6
6
|
import { useCommonStore as a, useRenderSettings as o } from "@plitzi/sdk-shared/store";
|
|
7
7
|
import { jsx as s } from "react/jsx-runtime";
|
|
8
8
|
import { experimentNameOf as c, indexOfVariant as l, isExperimentVariant as u } from "@plitzi/sdk-shared/experiments";
|
|
9
9
|
import d from "clsx";
|
|
10
10
|
import { HIDDEN_CLASS as f } from "@plitzi/sdk-shared/style";
|
|
11
11
|
import { chooseAudienceVariant as p } from "@plitzi/sdk-shared/audiences";
|
|
12
|
-
// src/elements/
|
|
13
|
-
var m = ({ ref:
|
|
14
|
-
let { id: y, definition: b } =
|
|
12
|
+
// src/elements/structure/Variants/Variants.tsx
|
|
13
|
+
var m = ({ ref: n, className: m = "", children: h, chooseBy: g = "chance", experiment: _ = "", builderVariant: v = 0 }) => {
|
|
14
|
+
let { id: y, definition: b } = r(), x = b.items ?? [], { builder: S, previewMode: C } = o(), [w] = a("runtime.sources.experiments"), [T] = a(x.map((e) => `schema.flat.${e}.attributes.when`)), E = t(), D;
|
|
15
15
|
if (S && !C) D = v;
|
|
16
16
|
else if (g === "rules") D = p(T, E);
|
|
17
17
|
else {
|
|
@@ -21,11 +21,11 @@ var m = ({ ref: t, className: m = "", children: h, chooseBy: g = "chance", exper
|
|
|
21
21
|
}), t = e === void 0 ? void 0 : w?.[e];
|
|
22
22
|
D = u(t) ? l(t) : 0;
|
|
23
23
|
}
|
|
24
|
-
let O =
|
|
25
|
-
return /* @__PURE__ */ s(
|
|
26
|
-
ref:
|
|
24
|
+
let O = e(h, x[D]);
|
|
25
|
+
return /* @__PURE__ */ s(i, {
|
|
26
|
+
ref: n,
|
|
27
27
|
className: d("plitzi-component__variants", m, { [f]: !O }),
|
|
28
28
|
children: O
|
|
29
29
|
});
|
|
30
|
-
}, h =
|
|
30
|
+
}, h = n(m);
|
|
31
31
|
export { m as Variants, h as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Children as e, isValidElement as t } from "react";
|
|
2
|
-
// src/elements/
|
|
2
|
+
// src/elements/structure/Variants/childOfItem.ts
|
|
3
3
|
var n = (n, r) => {
|
|
4
4
|
if (r !== void 0) return e.toArray(n).filter(t).find((e) => {
|
|
5
5
|
let t = (e.key ?? "").replace(/^\.\$/, "");
|
|
@@ -23,7 +23,7 @@ declare const declaration: import('@plitzi/sdk-shared/authoring').DeclaredElemen
|
|
|
23
23
|
readonly itemsAllowed: ["variantItem"];
|
|
24
24
|
};
|
|
25
25
|
readonly market: {
|
|
26
|
-
readonly category: "
|
|
26
|
+
readonly category: "structure";
|
|
27
27
|
readonly icon: "fa-solid fa-shuffle";
|
|
28
28
|
};
|
|
29
29
|
readonly defaultStyle: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { elementDeclaration as e, valuesOf as t } from "@plitzi/sdk-shared/authoring";
|
|
2
2
|
import { CHOOSE_BY as n, VARIANTS_TYPE as r, VARIANT_ITEM_TYPE as i } from "@plitzi/sdk-shared/variants";
|
|
3
|
-
// src/elements/
|
|
3
|
+
// src/elements/structure/Variants/declaration.ts
|
|
4
4
|
var a = e()({
|
|
5
5
|
type: r,
|
|
6
6
|
attributeValues: { chooseBy: t()(n) },
|
|
@@ -12,12 +12,12 @@ var a = e()({
|
|
|
12
12
|
},
|
|
13
13
|
definition: {
|
|
14
14
|
label: "Variants",
|
|
15
|
-
description: "Shows each visitor one of its variants, chosen by chance or by who they are. By chance (`chooseBy: 'chance'`, an A/B test) it holds two to five `variantItem`s, A first: each is shown to its `weight` — the percent of the visitors it gets, the variants’ adding up to 100 — and a visitor keeps theirs when they reload or come back, through a cookie. Its `experiment` names it — left empty, the element’s id does — and `{{ experiments.<name> }}` reads the visitor's (`'a'`, `'b'`…). By rules (`chooseBy: 'rules'`) it shows the first variant whose `when` the visitor matches: a rule group over what a flag sees — `queryParams.<name>` (`utm_source`…), `user.authenticated`, `user.roles`… — and the visitor: `visitor.returning`, `visitor.language` (`es`), `visitor.device` (`mobile`, `tablet`, `desktop`); a variant with no conditions is for everybody else, last. Each variant keeps both, so switching how it chooses loses neither. The server draws only the variant shown.",
|
|
15
|
+
description: "Shows each visitor one of its variants, chosen by chance or by who they are. By chance (`chooseBy: 'chance'`, an A/B test) it holds two to five `variantItem`s, A first: each is shown to its `weight` — the percent of the visitors it gets, the variants’ adding up to 100 — and a visitor keeps theirs when they reload or come back, through a cookie. Its `experiment` names it — left empty, the element’s id does — and `{{ experiments.<name> }}` reads the visitor's (`'a'`, `'b'`…). By rules (`chooseBy: 'rules'`) it shows the first variant whose `when` the visitor matches: a rule group over what a flag sees — `queryParams.<name>` (`utm_source`…), `user.authenticated`, `user.roles`… — and the visitor: `visitor.returning`, `visitor.language` (`es`), `visitor.device` (`mobile`, `tablet`, `desktop`), `visitor.country` (`ES`, as the CDN in front says it); a variant with no conditions is for everybody else, last. Each variant keeps both, so switching how it chooses loses neither. The server draws only the variant shown.",
|
|
16
16
|
items: []
|
|
17
17
|
},
|
|
18
18
|
builder: { itemsAllowed: [i] },
|
|
19
19
|
market: {
|
|
20
|
-
category: "
|
|
20
|
+
category: "structure",
|
|
21
21
|
icon: "fa-solid fa-shuffle"
|
|
22
22
|
},
|
|
23
23
|
defaultStyle: {
|
|
@@ -17,7 +17,7 @@ declare const Variants: import('react').FC<import('../../..').WithElementProps<i
|
|
|
17
17
|
readonly itemsNotAllowed: ["variantItem"];
|
|
18
18
|
};
|
|
19
19
|
readonly market: {
|
|
20
|
-
readonly category: "
|
|
20
|
+
readonly category: "structure";
|
|
21
21
|
readonly icon: "fa-solid fa-code-branch";
|
|
22
22
|
};
|
|
23
23
|
readonly defaultStyle: {
|
|
@@ -55,7 +55,7 @@ declare const Variants: import('react').FC<import('../../..').WithElementProps<i
|
|
|
55
55
|
readonly itemsAllowed: ["variantItem"];
|
|
56
56
|
};
|
|
57
57
|
readonly market: {
|
|
58
|
-
readonly category: "
|
|
58
|
+
readonly category: "structure";
|
|
59
59
|
readonly icon: "fa-solid fa-shuffle";
|
|
60
60
|
};
|
|
61
61
|
readonly defaultStyle: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "./declaration.mjs";
|
|
2
2
|
import t from "./VariantItem/index.mjs";
|
|
3
3
|
import n from "./Variants.mjs";
|
|
4
|
-
// src/elements/
|
|
4
|
+
// src/elements/structure/Variants/index.ts
|
|
5
5
|
var r = Object.assign(n, {
|
|
6
6
|
...e,
|
|
7
7
|
plugins: { variantItem: t }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
export type AccountProps = {
|
|
3
|
+
ref?: RefObject<HTMLElement | null>;
|
|
4
|
+
className?: string;
|
|
5
|
+
/** What its menu offers besides signing out — the visitor's profile, their settings: links or buttons. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Where a guest signs in: the space's sign-in page — `/sign-in` — sent with `?redirect=` back to the page they were
|
|
9
|
+
* on. Empty, the provider's own: on Plitzi, out to "Sign in with Plitzi" and back.
|
|
10
|
+
*/
|
|
11
|
+
signInHref?: string;
|
|
12
|
+
signInLabel?: string;
|
|
13
|
+
signOutLabel?: string;
|
|
14
|
+
/** Where a visitor goes after signing out. Empty, they stay, and the page shows itself to a guest. */
|
|
15
|
+
signOutHref?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Who is signed in, where a page says it: a guest gets a way to sign in; somebody signed in, their face — a menu with
|
|
19
|
+
* their name and address, what the space offers them, and signing out. Nothing while the session is still being found
|
|
20
|
+
* out, so neither flashes before the other.
|
|
21
|
+
*/
|
|
22
|
+
declare const Account: ({ ref, className, children, signInHref, signInLabel, signOutLabel, signOutHref }: AccountProps) => import('react').JSX.Element;
|
|
23
|
+
declare const _default: import('react').FC<import('../../..').WithElementProps<AccountProps>>;
|
|
24
|
+
export default _default;
|
|
25
|
+
export { Account };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import e from "../../../Element/hocs/withElement.mjs";
|
|
2
|
+
import t from "../../../Element/hooks/useElement.mjs";
|
|
3
|
+
import { RootElement as n } from "../../../Element/RootElement.mjs";
|
|
4
|
+
import r from "../../structure/Disclosure/useDetails.mjs";
|
|
5
|
+
import i, { avatarHue as a } from "../Avatar/AvatarFace.mjs";
|
|
6
|
+
import { use as o, useCallback as s, useRef as c, useState as l } from "react";
|
|
7
|
+
import { usePlitzi as u } from "@plitzi/sdk-shared/hooks";
|
|
8
|
+
import { useCommonStore as d, useSdkStore as f } from "@plitzi/sdk-shared/store";
|
|
9
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
|
+
import h from "clsx";
|
|
11
|
+
import { AuthContext as g } from "@plitzi/sdk-auth";
|
|
12
|
+
// src/elements/user/Account/Account.tsx
|
|
13
|
+
var _ = {
|
|
14
|
+
username: "Your name",
|
|
15
|
+
email: "you@example.com"
|
|
16
|
+
}, v = (e) => {
|
|
17
|
+
try {
|
|
18
|
+
let t = new URL(e ?? "", "https://page.invalid");
|
|
19
|
+
return `${t.pathname}${t.search}`;
|
|
20
|
+
} catch {
|
|
21
|
+
return "/";
|
|
22
|
+
}
|
|
23
|
+
}, y = (e, t) => `${e}${e.includes("?") ? "&" : "?"}redirect=${encodeURIComponent(t)}`, b = ({ ref: e, className: b = "", children: x, signInHref: S = "", signInLabel: C = "Sign in", signOutLabel: w = "Sign out", signOutHref: T = "" }) => {
|
|
24
|
+
let { definition: { styleSelectors: E } } = t(), { settings: { previewMode: D } } = u(), O = o(g), [k] = d("navigation.href"), [A] = f("navigation.navigate"), j = c(null), [M, N] = l(!1), P = !D, F = r({
|
|
25
|
+
ref: j,
|
|
26
|
+
open: M,
|
|
27
|
+
setOpen: N,
|
|
28
|
+
editing: P,
|
|
29
|
+
closeOnClickOutside: !0,
|
|
30
|
+
closeOnNavigate: !0
|
|
31
|
+
}), I = s(async () => {
|
|
32
|
+
let e = await O.login?.({});
|
|
33
|
+
e && !e.ok && e.reason !== "mfa" && console.warn(`[plitzi] account: signing in here needs a form (${O.provider || "no provider"}): give it a signInHref, the space's sign-in page.`);
|
|
34
|
+
}, [O]), L = s(async () => {
|
|
35
|
+
N(!1), await O.logout?.(), T && A(T);
|
|
36
|
+
}, [
|
|
37
|
+
O,
|
|
38
|
+
A,
|
|
39
|
+
T
|
|
40
|
+
]), R = P ? _ : O.authenticated ? O.user?.details : void 0, z = P || O.state === "authenticated" || O.state === "guest", B = null;
|
|
41
|
+
if (R) {
|
|
42
|
+
let e = R.username || R.email;
|
|
43
|
+
B = /* @__PURE__ */ m("details", {
|
|
44
|
+
ref: (e) => {
|
|
45
|
+
j.current = e;
|
|
46
|
+
},
|
|
47
|
+
className: "plitzi-component__account-menu",
|
|
48
|
+
open: P || M,
|
|
49
|
+
...F,
|
|
50
|
+
children: [/* @__PURE__ */ m("summary", {
|
|
51
|
+
className: h("plitzi-component__account-trigger", E.trigger),
|
|
52
|
+
children: [/* @__PURE__ */ p("span", {
|
|
53
|
+
className: "plitzi-component__avatar",
|
|
54
|
+
style: a(e),
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
children: /* @__PURE__ */ p(i, { name: e })
|
|
57
|
+
}), /* @__PURE__ */ p("span", {
|
|
58
|
+
className: "plitzi-component__account-name",
|
|
59
|
+
children: e
|
|
60
|
+
})]
|
|
61
|
+
}), /* @__PURE__ */ m("div", {
|
|
62
|
+
className: h("plitzi-component__account-panel", E.panel),
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ m("div", {
|
|
65
|
+
className: h("plitzi-component__account-who", E.identity),
|
|
66
|
+
children: [/* @__PURE__ */ p("span", {
|
|
67
|
+
className: "plitzi-component__account-who-name",
|
|
68
|
+
children: e
|
|
69
|
+
}), R.email && R.email !== e && /* @__PURE__ */ p("span", {
|
|
70
|
+
className: "plitzi-component__account-who-email",
|
|
71
|
+
children: R.email
|
|
72
|
+
})]
|
|
73
|
+
}),
|
|
74
|
+
x,
|
|
75
|
+
/* @__PURE__ */ p("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
className: h("plitzi-component__account-sign-out", E.signOut),
|
|
78
|
+
onClick: () => void L(),
|
|
79
|
+
children: w
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
} else if (z) {
|
|
85
|
+
let e = h("plitzi-component__account-sign-in", E.signIn);
|
|
86
|
+
B = S ? /* @__PURE__ */ p("a", {
|
|
87
|
+
className: e,
|
|
88
|
+
href: y(S, v(k)),
|
|
89
|
+
children: C
|
|
90
|
+
}) : /* @__PURE__ */ p("button", {
|
|
91
|
+
type: "button",
|
|
92
|
+
className: e,
|
|
93
|
+
onClick: () => void I(),
|
|
94
|
+
children: C
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return /* @__PURE__ */ p(n, {
|
|
98
|
+
ref: e,
|
|
99
|
+
className: h("plitzi-component__account", b),
|
|
100
|
+
"aria-busy": !z || void 0,
|
|
101
|
+
children: B
|
|
102
|
+
});
|
|
103
|
+
}, x = e(b);
|
|
104
|
+
export { b as Account, x as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type SettingsProps = {
|
|
2
|
+
signInHref?: string;
|
|
3
|
+
signInLabel?: string;
|
|
4
|
+
signOutLabel?: string;
|
|
5
|
+
signOutHref?: string;
|
|
6
|
+
onUpdate?: (key: string, value: string | boolean | number) => void;
|
|
7
|
+
};
|
|
8
|
+
/** An account's settings: where a guest signs in, where a visitor goes once signed out, and the words for both. */
|
|
9
|
+
declare const Settings: ({ signInHref, signInLabel, signOutLabel, signOutHref, onUpdate }: SettingsProps) => import('react').JSX.Element;
|
|
10
|
+
export default Settings;
|
|
@@ -0,0 +1,47 @@
|
|
|
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";
|
|
4
|
+
// src/elements/user/Account/Settings.tsx
|
|
5
|
+
var i = ({ signInHref: i = "", signInLabel: a = "Sign in", signOutLabel: o = "Sign out", signOutHref: s = "", onUpdate: c }) => {
|
|
6
|
+
let l = e(c);
|
|
7
|
+
return /* @__PURE__ */ n("div", {
|
|
8
|
+
className: "flex flex-col gap-4 py-2",
|
|
9
|
+
children: [
|
|
10
|
+
/* @__PURE__ */ t(r, {
|
|
11
|
+
label: "Sign in label",
|
|
12
|
+
size: "xs",
|
|
13
|
+
value: a,
|
|
14
|
+
onChange: l.text("signInLabel")
|
|
15
|
+
}),
|
|
16
|
+
/* @__PURE__ */ t(r, {
|
|
17
|
+
label: "Sign-in page",
|
|
18
|
+
size: "xs",
|
|
19
|
+
placeholder: "/sign-in",
|
|
20
|
+
value: i,
|
|
21
|
+
onChange: l.text("signInHref")
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ t("span", {
|
|
24
|
+
className: "text-ui-fg-subtle text-xs",
|
|
25
|
+
children: "Sent there with ?redirect= back to the page they were on. Empty, the provider’s own sign-in — on Plitzi, “Sign in with Plitzi”."
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ t(r, {
|
|
28
|
+
label: "Sign out label",
|
|
29
|
+
size: "xs",
|
|
30
|
+
value: o,
|
|
31
|
+
onChange: l.text("signOutLabel")
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ t(r, {
|
|
34
|
+
label: "After signing out",
|
|
35
|
+
size: "xs",
|
|
36
|
+
placeholder: "Stay on the page",
|
|
37
|
+
value: s,
|
|
38
|
+
onChange: l.text("signOutHref")
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ t("span", {
|
|
41
|
+
className: "text-ui-fg-subtle text-xs",
|
|
42
|
+
children: "Its children are the menu’s entries — the profile, the settings — between the name and Sign out. While editing, the menu is shown open as somebody signed in sees it."
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
export { i as default };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { AccountProps } from './Account';
|
|
2
|
+
import { AuthorableAttributes } from '@plitzi/sdk-shared/authoring';
|
|
3
|
+
/** What this element can be authored with — its component's own props, minus what the runtime supplies. */
|
|
4
|
+
export type AccountAttributes = AuthorableAttributes<AccountProps>;
|
|
5
|
+
declare const declaration: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
|
|
6
|
+
readonly type: "account";
|
|
7
|
+
readonly contentAttributes: readonly ["signInLabel", "signOutLabel"];
|
|
8
|
+
readonly content: {
|
|
9
|
+
readonly attributes: {
|
|
10
|
+
readonly signInHref: "";
|
|
11
|
+
readonly signInLabel: "Sign in";
|
|
12
|
+
readonly signOutLabel: "Sign out";
|
|
13
|
+
readonly signOutHref: "";
|
|
14
|
+
};
|
|
15
|
+
readonly definition: {
|
|
16
|
+
readonly label: "Account";
|
|
17
|
+
readonly description: string;
|
|
18
|
+
readonly items: [];
|
|
19
|
+
readonly styleSelectors: {
|
|
20
|
+
readonly signIn: "";
|
|
21
|
+
readonly trigger: "";
|
|
22
|
+
readonly panel: "";
|
|
23
|
+
readonly identity: "";
|
|
24
|
+
readonly signOut: "";
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
readonly market: {
|
|
28
|
+
readonly category: "user";
|
|
29
|
+
readonly icon: "fa-solid fa-user-gear";
|
|
30
|
+
};
|
|
31
|
+
readonly defaultStyle: {
|
|
32
|
+
readonly style: {
|
|
33
|
+
readonly base: {
|
|
34
|
+
readonly default: {
|
|
35
|
+
readonly position: "relative";
|
|
36
|
+
readonly display: "inline-flex";
|
|
37
|
+
readonly 'align-items': "center";
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
readonly signIn: {
|
|
41
|
+
readonly default: {
|
|
42
|
+
readonly display: "inline-flex";
|
|
43
|
+
readonly 'align-items': "center";
|
|
44
|
+
readonly 'padding-top': "8px";
|
|
45
|
+
readonly 'padding-right': "14px";
|
|
46
|
+
readonly 'padding-bottom': "8px";
|
|
47
|
+
readonly 'padding-left': "14px";
|
|
48
|
+
readonly 'border-top-width': "0px";
|
|
49
|
+
readonly 'border-right-width': "0px";
|
|
50
|
+
readonly 'border-bottom-width': "0px";
|
|
51
|
+
readonly 'border-left-width': "0px";
|
|
52
|
+
readonly 'border-top-left-radius': "8px";
|
|
53
|
+
readonly 'border-top-right-radius': "8px";
|
|
54
|
+
readonly 'border-bottom-left-radius': "8px";
|
|
55
|
+
readonly 'border-bottom-right-radius': "8px";
|
|
56
|
+
readonly 'background-color': "light-dark(oklch(0.21 0.006 285.885), oklch(0.985 0 0))";
|
|
57
|
+
readonly color: "light-dark(oklch(0.985 0 0), oklch(0.21 0.006 285.885))";
|
|
58
|
+
readonly font: "inherit";
|
|
59
|
+
readonly 'font-weight': 600;
|
|
60
|
+
readonly 'text-decoration': "none";
|
|
61
|
+
readonly cursor: "pointer";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly trigger: {
|
|
65
|
+
readonly default: {
|
|
66
|
+
readonly display: "flex";
|
|
67
|
+
readonly 'border-top-left-radius': "50%";
|
|
68
|
+
readonly 'border-top-right-radius': "50%";
|
|
69
|
+
readonly 'border-bottom-left-radius': "50%";
|
|
70
|
+
readonly 'border-bottom-right-radius': "50%";
|
|
71
|
+
readonly cursor: "pointer";
|
|
72
|
+
readonly 'list-style': "none";
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
readonly panel: {
|
|
76
|
+
readonly default: {
|
|
77
|
+
readonly position: "absolute";
|
|
78
|
+
readonly top: "calc(100% + 8px)";
|
|
79
|
+
readonly right: "0px";
|
|
80
|
+
readonly 'z-index': 50;
|
|
81
|
+
readonly display: "flex";
|
|
82
|
+
readonly 'flex-direction': "column";
|
|
83
|
+
readonly gap: "2px";
|
|
84
|
+
readonly 'min-width': "220px";
|
|
85
|
+
readonly 'padding-top': "8px";
|
|
86
|
+
readonly 'padding-right': "8px";
|
|
87
|
+
readonly 'padding-bottom': "8px";
|
|
88
|
+
readonly 'padding-left': "8px";
|
|
89
|
+
readonly 'border-top-left-radius': "12px";
|
|
90
|
+
readonly 'border-top-right-radius': "12px";
|
|
91
|
+
readonly 'border-bottom-left-radius': "12px";
|
|
92
|
+
readonly 'border-bottom-right-radius': "12px";
|
|
93
|
+
readonly 'background-color': "light-dark(white, oklch(0.21 0.006 285.885))";
|
|
94
|
+
readonly 'box-shadow': "rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.12) 0px 8px 24px";
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
readonly identity: {
|
|
98
|
+
readonly default: {
|
|
99
|
+
readonly display: "flex";
|
|
100
|
+
readonly 'flex-direction': "column";
|
|
101
|
+
readonly gap: "2px";
|
|
102
|
+
readonly 'padding-top': "8px";
|
|
103
|
+
readonly 'padding-right': "10px";
|
|
104
|
+
readonly 'padding-bottom': "10px";
|
|
105
|
+
readonly 'padding-left': "10px";
|
|
106
|
+
readonly 'margin-bottom': "4px";
|
|
107
|
+
readonly 'border-bottom': "1px solid light-dark(oklch(0.92 0.004 286.32), oklch(0.32 0.006 285.885))";
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
readonly signOut: {
|
|
111
|
+
readonly default: {
|
|
112
|
+
readonly display: "flex";
|
|
113
|
+
readonly width: "100%";
|
|
114
|
+
readonly 'padding-top': "8px";
|
|
115
|
+
readonly 'padding-right': "10px";
|
|
116
|
+
readonly 'padding-bottom': "8px";
|
|
117
|
+
readonly 'padding-left': "10px";
|
|
118
|
+
readonly 'border-top-width': "0px";
|
|
119
|
+
readonly 'border-right-width': "0px";
|
|
120
|
+
readonly 'border-bottom-width': "0px";
|
|
121
|
+
readonly 'border-left-width': "0px";
|
|
122
|
+
readonly 'border-top-left-radius': "8px";
|
|
123
|
+
readonly 'border-top-right-radius': "8px";
|
|
124
|
+
readonly 'border-bottom-left-radius': "8px";
|
|
125
|
+
readonly 'border-bottom-right-radius': "8px";
|
|
126
|
+
readonly 'background-color': "transparent";
|
|
127
|
+
readonly color: "inherit";
|
|
128
|
+
readonly font: "inherit";
|
|
129
|
+
readonly 'text-align': "left";
|
|
130
|
+
readonly cursor: "pointer";
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
readonly subTypes: {};
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
}, Partial<{
|
|
138
|
+
signInHref?: string | undefined;
|
|
139
|
+
signInLabel?: string | undefined;
|
|
140
|
+
signOutLabel?: string | undefined;
|
|
141
|
+
signOutHref?: string | undefined;
|
|
142
|
+
}>>;
|
|
143
|
+
export default declaration;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { elementDeclaration as e } from "@plitzi/sdk-shared/authoring";
|
|
2
|
+
var t = e()({
|
|
3
|
+
type: "account",
|
|
4
|
+
contentAttributes: ["signInLabel", "signOutLabel"],
|
|
5
|
+
content: {
|
|
6
|
+
attributes: {
|
|
7
|
+
signInHref: "",
|
|
8
|
+
signInLabel: "Sign in",
|
|
9
|
+
signOutLabel: "Sign out",
|
|
10
|
+
signOutHref: ""
|
|
11
|
+
},
|
|
12
|
+
definition: {
|
|
13
|
+
label: "Account",
|
|
14
|
+
description: "The visitor’s way in and their menu, in a top bar’s corner. A guest gets a \"Sign in\": to `signInHref` (the space’s sign-in page, with `?redirect=` back to where they were), or — empty — the provider’s own (on Plitzi, \"Sign in with Plitzi\", out and back). A visitor with a session gets their initials, opening a menu with their name and address, what it holds (its children: links to their profile, their settings) and \"Sign out\" (`signOutHref` where they go then; empty, they stay). Nothing shows while the session is still being found out. Its slots style each part: `signIn`, `trigger`, `panel`, `identity`, `signOut`.",
|
|
15
|
+
items: [],
|
|
16
|
+
styleSelectors: {
|
|
17
|
+
signIn: "",
|
|
18
|
+
trigger: "",
|
|
19
|
+
panel: "",
|
|
20
|
+
identity: "",
|
|
21
|
+
signOut: ""
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
market: {
|
|
25
|
+
category: "user",
|
|
26
|
+
icon: "fa-solid fa-user-gear"
|
|
27
|
+
},
|
|
28
|
+
defaultStyle: {
|
|
29
|
+
style: {
|
|
30
|
+
base: { default: {
|
|
31
|
+
position: "relative",
|
|
32
|
+
display: "inline-flex",
|
|
33
|
+
"align-items": "center"
|
|
34
|
+
} },
|
|
35
|
+
signIn: { default: {
|
|
36
|
+
display: "inline-flex",
|
|
37
|
+
"align-items": "center",
|
|
38
|
+
"padding-top": "8px",
|
|
39
|
+
"padding-right": "14px",
|
|
40
|
+
"padding-bottom": "8px",
|
|
41
|
+
"padding-left": "14px",
|
|
42
|
+
"border-top-width": "0px",
|
|
43
|
+
"border-right-width": "0px",
|
|
44
|
+
"border-bottom-width": "0px",
|
|
45
|
+
"border-left-width": "0px",
|
|
46
|
+
"border-top-left-radius": "8px",
|
|
47
|
+
"border-top-right-radius": "8px",
|
|
48
|
+
"border-bottom-left-radius": "8px",
|
|
49
|
+
"border-bottom-right-radius": "8px",
|
|
50
|
+
"background-color": "light-dark(oklch(0.21 0.006 285.885), oklch(0.985 0 0))",
|
|
51
|
+
color: "light-dark(oklch(0.985 0 0), oklch(0.21 0.006 285.885))",
|
|
52
|
+
font: "inherit",
|
|
53
|
+
"font-weight": 600,
|
|
54
|
+
"text-decoration": "none",
|
|
55
|
+
cursor: "pointer"
|
|
56
|
+
} },
|
|
57
|
+
trigger: { default: {
|
|
58
|
+
display: "flex",
|
|
59
|
+
"border-top-left-radius": "50%",
|
|
60
|
+
"border-top-right-radius": "50%",
|
|
61
|
+
"border-bottom-left-radius": "50%",
|
|
62
|
+
"border-bottom-right-radius": "50%",
|
|
63
|
+
cursor: "pointer",
|
|
64
|
+
"list-style": "none"
|
|
65
|
+
} },
|
|
66
|
+
panel: { default: {
|
|
67
|
+
position: "absolute",
|
|
68
|
+
top: "calc(100% + 8px)",
|
|
69
|
+
right: "0px",
|
|
70
|
+
"z-index": 50,
|
|
71
|
+
display: "flex",
|
|
72
|
+
"flex-direction": "column",
|
|
73
|
+
gap: "2px",
|
|
74
|
+
"min-width": "220px",
|
|
75
|
+
"padding-top": "8px",
|
|
76
|
+
"padding-right": "8px",
|
|
77
|
+
"padding-bottom": "8px",
|
|
78
|
+
"padding-left": "8px",
|
|
79
|
+
"border-top-left-radius": "12px",
|
|
80
|
+
"border-top-right-radius": "12px",
|
|
81
|
+
"border-bottom-left-radius": "12px",
|
|
82
|
+
"border-bottom-right-radius": "12px",
|
|
83
|
+
"background-color": "light-dark(white, oklch(0.21 0.006 285.885))",
|
|
84
|
+
"box-shadow": "rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.12) 0px 8px 24px"
|
|
85
|
+
} },
|
|
86
|
+
identity: { default: {
|
|
87
|
+
display: "flex",
|
|
88
|
+
"flex-direction": "column",
|
|
89
|
+
gap: "2px",
|
|
90
|
+
"padding-top": "8px",
|
|
91
|
+
"padding-right": "10px",
|
|
92
|
+
"padding-bottom": "10px",
|
|
93
|
+
"padding-left": "10px",
|
|
94
|
+
"margin-bottom": "4px",
|
|
95
|
+
"border-bottom": "1px solid light-dark(oklch(0.92 0.004 286.32), oklch(0.32 0.006 285.885))"
|
|
96
|
+
} },
|
|
97
|
+
signOut: { default: {
|
|
98
|
+
display: "flex",
|
|
99
|
+
width: "100%",
|
|
100
|
+
"padding-top": "8px",
|
|
101
|
+
"padding-right": "10px",
|
|
102
|
+
"padding-bottom": "8px",
|
|
103
|
+
"padding-left": "10px",
|
|
104
|
+
"border-top-width": "0px",
|
|
105
|
+
"border-right-width": "0px",
|
|
106
|
+
"border-bottom-width": "0px",
|
|
107
|
+
"border-left-width": "0px",
|
|
108
|
+
"border-top-left-radius": "8px",
|
|
109
|
+
"border-top-right-radius": "8px",
|
|
110
|
+
"border-bottom-left-radius": "8px",
|
|
111
|
+
"border-bottom-right-radius": "8px",
|
|
112
|
+
"background-color": "transparent",
|
|
113
|
+
color: "inherit",
|
|
114
|
+
font: "inherit",
|
|
115
|
+
"text-align": "left",
|
|
116
|
+
cursor: "pointer"
|
|
117
|
+
} }
|
|
118
|
+
},
|
|
119
|
+
subTypes: {}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
export { t as default };
|