@stackone/malachite 2.88.0 → 2.88.2
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/dist/components/WizardLayout.js +49 -46
- package/dist/components/WizardLayout.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/theme.js +46 -45
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,77 +1,80 @@
|
|
|
1
1
|
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as j, useState as
|
|
3
|
-
import { Button as
|
|
4
|
-
import
|
|
5
|
-
import { GLASS_SURFACE_STYLE as
|
|
6
|
-
const
|
|
7
|
-
default: "px-6
|
|
8
|
-
large: "
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import { useRef as j, useState as A, useLayoutEffect as L } from "react";
|
|
3
|
+
import { Button as R } from "./Button.js";
|
|
4
|
+
import E from "./CustomIcons/ArrowLeftIcon.js";
|
|
5
|
+
import { GLASS_SURFACE_STYLE as T } from "./glassSurface.js";
|
|
6
|
+
const r = {
|
|
7
|
+
default: "px-6",
|
|
8
|
+
large: "px-[28px] max-sm:px-[16px]"
|
|
9
|
+
}, z = {
|
|
10
|
+
default: `${r.default} pt-4 min-h-[var(--malachite-control-height-small,28px)]`,
|
|
11
|
+
large: `h-[60px] ${r.large} max-sm:h-[52px]`
|
|
12
|
+
}, I = ({
|
|
13
|
+
showBack: d = !1,
|
|
14
|
+
onBack: h,
|
|
15
|
+
backDisabled: u = !1,
|
|
16
|
+
reserveBack: v = !0,
|
|
17
|
+
topBarSize: c = "default",
|
|
18
|
+
leading: g,
|
|
19
|
+
stepper: N,
|
|
17
20
|
trailing: w,
|
|
18
|
-
banner:
|
|
21
|
+
banner: n,
|
|
19
22
|
header: s,
|
|
20
23
|
footer: l,
|
|
21
|
-
footerGlass:
|
|
22
|
-
footerAlign:
|
|
23
|
-
center:
|
|
24
|
+
footerGlass: b = !1,
|
|
25
|
+
footerAlign: y = "full",
|
|
26
|
+
center: $ = !1,
|
|
24
27
|
contentWidth: a = 480,
|
|
25
|
-
minWidth:
|
|
28
|
+
minWidth: o,
|
|
26
29
|
children: k,
|
|
27
30
|
className: S = ""
|
|
28
31
|
}) => {
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
const i =
|
|
32
|
+
const m = j(null), [_, x] = A(0);
|
|
33
|
+
return L(() => {
|
|
34
|
+
const i = m.current;
|
|
32
35
|
if (!i) {
|
|
33
|
-
|
|
36
|
+
x(0);
|
|
34
37
|
return;
|
|
35
38
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
return
|
|
39
|
+
const f = () => x(i.offsetHeight);
|
|
40
|
+
f();
|
|
41
|
+
const p = new ResizeObserver(f);
|
|
42
|
+
return p.observe(i), () => p.disconnect();
|
|
40
43
|
}, [l]), /* @__PURE__ */ t(
|
|
41
44
|
"div",
|
|
42
45
|
{
|
|
43
46
|
className: `w-full h-screen flex flex-col overflow-hidden bg-[var(--malachite-card-sunken-background)] ${S}`,
|
|
44
|
-
style:
|
|
47
|
+
style: o ? { minWidth: `${o}px` } : void 0,
|
|
45
48
|
children: [
|
|
46
49
|
/* @__PURE__ */ t(
|
|
47
50
|
"div",
|
|
48
51
|
{
|
|
49
|
-
className: `w-full shrink-0 flex items-center justify-between ${
|
|
52
|
+
className: `w-full shrink-0 flex items-center justify-between ${z[c]}`,
|
|
50
53
|
children: [
|
|
51
54
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-[16px] min-w-0", children: [
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
d ? /* @__PURE__ */ e(
|
|
56
|
+
R,
|
|
54
57
|
{
|
|
55
58
|
variant: "outline",
|
|
56
59
|
size: "small",
|
|
57
60
|
iconOnly: !0,
|
|
58
|
-
icon: /* @__PURE__ */ e(
|
|
59
|
-
disabled:
|
|
60
|
-
onClick:
|
|
61
|
+
icon: /* @__PURE__ */ e(E, { size: 14 }),
|
|
62
|
+
disabled: u,
|
|
63
|
+
onClick: h,
|
|
61
64
|
"aria-label": "Back",
|
|
62
65
|
className: "w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0"
|
|
63
66
|
}
|
|
64
|
-
) :
|
|
65
|
-
|
|
67
|
+
) : v ? /* @__PURE__ */ e("span", { className: "w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0" }) : null,
|
|
68
|
+
g
|
|
66
69
|
] }),
|
|
67
70
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-[16px]", children: [
|
|
68
71
|
w ?? null,
|
|
69
|
-
|
|
72
|
+
N ?? null
|
|
70
73
|
] })
|
|
71
74
|
]
|
|
72
75
|
}
|
|
73
76
|
),
|
|
74
|
-
|
|
77
|
+
n ? /* @__PURE__ */ e("div", { className: `w-full shrink-0 pt-[12px] ${r[c]}`, children: n }) : null,
|
|
75
78
|
s ? /* @__PURE__ */ e("div", { className: "w-full shrink-0 flex flex-col items-center px-6 pt-8", children: /* @__PURE__ */ e(
|
|
76
79
|
"div",
|
|
77
80
|
{
|
|
@@ -84,12 +87,12 @@ const B = {
|
|
|
84
87
|
/* @__PURE__ */ e(
|
|
85
88
|
"div",
|
|
86
89
|
{
|
|
87
|
-
className: `absolute inset-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] flex flex-col items-center px-6 ${
|
|
90
|
+
className: `absolute inset-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] flex flex-col items-center px-6 ${$ ? "justify-center" : "justify-start"}`,
|
|
88
91
|
style: {
|
|
89
92
|
// Reserve the overlaid footer's height plus a gap, so the last item
|
|
90
93
|
// clears the footer with breathing room (not flush against it, which
|
|
91
94
|
// reads as hidden content continuing underneath).
|
|
92
|
-
paddingBottom: l ? `${
|
|
95
|
+
paddingBottom: l ? `${_ + 24}px` : "48px"
|
|
93
96
|
},
|
|
94
97
|
children: /* @__PURE__ */ e(
|
|
95
98
|
"div",
|
|
@@ -109,10 +112,10 @@ const B = {
|
|
|
109
112
|
l ? /* @__PURE__ */ e(
|
|
110
113
|
"div",
|
|
111
114
|
{
|
|
112
|
-
ref:
|
|
115
|
+
ref: m,
|
|
113
116
|
className: "absolute inset-x-0 bottom-0 z-20",
|
|
114
|
-
style:
|
|
115
|
-
children:
|
|
117
|
+
style: b ? T : void 0,
|
|
118
|
+
children: y === "content" ? /* @__PURE__ */ e("div", { className: "flex justify-center px-6 pt-4 pb-3", children: /* @__PURE__ */ e("div", { className: "w-full", style: { maxWidth: `${a}px` }, children: l }) }) : l
|
|
116
119
|
}
|
|
117
120
|
) : null
|
|
118
121
|
] })
|
|
@@ -121,7 +124,7 @@ const B = {
|
|
|
121
124
|
);
|
|
122
125
|
};
|
|
123
126
|
export {
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
I as WizardLayout,
|
|
128
|
+
I as default
|
|
126
129
|
};
|
|
127
130
|
//# sourceMappingURL=WizardLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardLayout.js","sources":["../../src/components/WizardLayout.tsx"],"sourcesContent":["import React, { useLayoutEffect, useRef, useState } from 'react';\nimport Button from './Button';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\n\nexport interface WizardLayoutProps {\n /** Renders the outline back button in the top-left slot. */\n showBack?: boolean;\n onBack?: () => void;\n backDisabled?: boolean;\n /** `false` drops the hidden back button's square, so `leading` sits at the same inset as `trailing`. */\n reserveBack?: boolean;\n /** `large`: a 60px bar with 28px insets (52px and 16px below 640px), items centred. */\n topBarSize?: 'default' | 'large';\n /** Top-left slot beside the back button — e.g. a user avatar menu. */\n leading?: React.ReactNode;\n /** Right top-bar slot (sits just before `stepper`) — e.g. a theme toggle. */\n stepper?: React.ReactNode;\n /** Far-right top-bar slot — e.g. a theme toggle. */\n trailing?: React.ReactNode;\n /** A page-wide notice under the top bar, above `header`. */\n banner?: React.ReactNode;\n /**\n * Pinned below the top bar and always visible while the content scrolls —\n * e.g. connection logos + a step title. Rendered in the same centred column\n * as the content (`contentWidth`).\n */\n header?: React.ReactNode;\n /** Pinned to the bottom of the screen — typically a <FooterNav /> or a primary CTA. */\n footer?: React.ReactNode;\n /**\n * Give the pinned footer a frosted-glass treatment (translucent background +\n * backdrop blur) so scrolling content shows through it. The footer already sits\n * above sticky body content, so it reads as glass over the scrolling list.\n */\n footerGlass?: boolean;\n /** `content` holds the footer to the content column, so a full-width action lines up with the list. */\n footerAlign?: 'full' | 'content';\n /** Vertically centre the content (used for terminal/success screens). */\n center?: boolean;\n /** Max width of the centered content column. */\n contentWidth?: number;\n /** Minimum width of the whole layout, below which it scrolls horizontally. */\n minWidth?: number;\n children?: React.ReactNode;\n className?: string;\n}\n\nconst TOP_BAR_CLASSES: Record<NonNullable<WizardLayoutProps['topBarSize']>, string> = {\n default: 'px-6 pt-4 min-h-[var(--malachite-control-height-small,28px)]',\n large: 'h-[60px] px-[28px] max-sm:h-[52px] max-sm:px-[16px]',\n};\n\nconst WizardLayout: React.FC<WizardLayoutProps> = ({\n showBack = false,\n onBack,\n backDisabled = false,\n reserveBack = true,\n topBarSize = 'default',\n leading,\n stepper,\n trailing,\n banner,\n header,\n footer,\n footerGlass = false,\n footerAlign = 'full',\n center = false,\n contentWidth = 480,\n minWidth,\n children,\n className = '',\n}) => {\n // The footer overlays the bottom of the scroll area (so content can glass under\n // it). Measure it so the scroll content reserves matching bottom space and the\n // last item is never hidden behind it.\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-run when the footer node mounts/unmounts so the observer attaches to the current element.\n useLayoutEffect(() => {\n const el = footerRef.current;\n if (!el) {\n setFooterHeight(0);\n return;\n }\n const update = () => setFooterHeight(el.offsetHeight);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(el);\n return () => observer.disconnect();\n }, [footer]);\n\n return (\n <div\n className={`w-full h-screen flex flex-col overflow-hidden bg-[var(--malachite-card-sunken-background)] ${className}`}\n style={minWidth ? { minWidth: `${minWidth}px` } : undefined}\n >\n <div\n className={`w-full shrink-0 flex items-center justify-between ${TOP_BAR_CLASSES[topBarSize]}`}\n >\n <div className=\"flex items-center gap-[16px] min-w-0\">\n {showBack ? (\n <Button\n variant=\"outline\"\n size=\"small\"\n iconOnly\n icon={<ArrowLeftIcon size={14} />}\n disabled={backDisabled}\n onClick={onBack}\n aria-label=\"Back\"\n className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\"\n />\n ) : reserveBack ? (\n <span className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\" />\n ) : null}\n {leading}\n </div>\n <div className=\"flex items-center gap-[16px]\">\n {trailing ?? null}\n {stepper ?? null}\n </div>\n </div>\n\n {banner ? <div className=\"w-full shrink-0 px-[12px] pt-[12px]\">{banner}</div> : null}\n\n {header ? (\n <div className=\"w-full shrink-0 flex flex-col items-center px-6 pt-8\">\n <div\n className=\"w-full flex flex-col items-center gap-[24px]\"\n style={{ maxWidth: `${contentWidth}px` }}\n >\n {header}\n </div>\n </div>\n ) : null}\n\n <div className=\"relative flex-1 min-h-0\">\n {/* The gutter is held on both edges so a classic scrollbar keeps the content\n centred on the page, in line with the pinned header and the overlaid footer. */}\n <div\n className={`absolute inset-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] flex flex-col items-center px-6 ${\n center ? 'justify-center' : 'justify-start'\n }`}\n style={{\n // Reserve the overlaid footer's height plus a gap, so the last item\n // clears the footer with breathing room (not flush against it, which\n // reads as hidden content continuing underneath).\n paddingBottom: footer ? `${footerHeight + 24}px` : '48px',\n }}\n >\n <div\n className=\"w-full flex flex-col items-center gap-[40px]\"\n style={{\n maxWidth: `${contentWidth}px`,\n // Top padding lives on the scrolling content — NOT the scrollport —\n // so a `position: sticky` child pins flush to the top with no gap.\n paddingTop: header ? '32px' : '48px',\n }}\n >\n {children}\n </div>\n </div>\n\n {footer ? (\n <div\n ref={footerRef}\n // z-20 keeps the pinned footer above sticky body content (e.g. a\n // sticky Accordion header at z-10) so it can't paint over the footer.\n className=\"absolute inset-x-0 bottom-0 z-20\"\n style={footerGlass ? GLASS_SURFACE_STYLE : undefined}\n >\n {footerAlign === 'content' ? (\n <div className=\"flex justify-center px-6 pt-4 pb-3\">\n <div className=\"w-full\" style={{ maxWidth: `${contentWidth}px` }}>\n {footer}\n </div>\n </div>\n ) : (\n footer\n )}\n </div>\n ) : null}\n </div>\n </div>\n );\n};\n\nexport default WizardLayout;\nexport { WizardLayout };\n"],"names":["TOP_BAR_CLASSES","WizardLayout","showBack","onBack","backDisabled","reserveBack","topBarSize","leading","stepper","trailing","banner","header","footer","footerGlass","footerAlign","center","contentWidth","minWidth","children","className","footerRef","useRef","footerHeight","setFooterHeight","useState","useLayoutEffect","el","update","observer","jsxs","jsx","Button","ArrowLeftIcon","GLASS_SURFACE_STYLE"],"mappings":";;;;;AAgDA,MAAMA,IAAgF;AAAA,EAClF,SAAS;AAAA,EACT,OAAO;AACX,GAEMC,IAA4C,CAAC;AAAA,EAC/C,UAAAC,IAAW;AAAA,EACX,QAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,cAAAC,IAAe;AAAA,EACf,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAChB,MAAM;AAIF,QAAMC,IAAYC,EAAuB,IAAI,GACvC,C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Ref, useState } from 'react';\nimport Button from './Button';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\n\nexport interface WizardLayoutProps {\n /** Renders the outline back button in the top-left slot. */\n showBack?: boolean;\n onBack?: () => void;\n backDisabled?: boolean;\n /** `false` drops the hidden back button's square, so `leading` sits at the same inset as `trailing`. */\n reserveBack?: boolean;\n /** `large`: a 60px bar with 28px insets (52px and 16px below 640px), items centred. */\n topBarSize?: 'default' | 'large';\n /** Top-left slot beside the back button — e.g. a user avatar menu. */\n leading?: React.ReactNode;\n /** Right top-bar slot (sits just before `stepper`) — e.g. a theme toggle. */\n stepper?: React.ReactNode;\n /** Far-right top-bar slot — e.g. a theme toggle. */\n trailing?: React.ReactNode;\n /** A page-wide notice under the top bar, above `header`. */\n banner?: React.ReactNode;\n /**\n * Pinned below the top bar and always visible while the content scrolls —\n * e.g. connection logos + a step title. Rendered in the same centred column\n * as the content (`contentWidth`).\n */\n header?: React.ReactNode;\n /** Pinned to the bottom of the screen — typically a <FooterNav /> or a primary CTA. */\n footer?: React.ReactNode;\n /**\n * Give the pinned footer a frosted-glass treatment (translucent background +\n * backdrop blur) so scrolling content shows through it. The footer already sits\n * above sticky body content, so it reads as glass over the scrolling list.\n */\n footerGlass?: boolean;\n /** `content` holds the footer to the content column, so a full-width action lines up with the list. */\n footerAlign?: 'full' | 'content';\n /** Vertically centre the content (used for terminal/success screens). */\n center?: boolean;\n /** Max width of the centered content column. */\n contentWidth?: number;\n /** Minimum width of the whole layout, below which it scrolls horizontally. */\n minWidth?: number;\n children?: React.ReactNode;\n className?: string;\n}\n\ntype TopBarSize = NonNullable<WizardLayoutProps['topBarSize']>;\n\n// Shared by the top bar and the banner under it, so the banner's edges line up with the bar's items.\nconst TOP_BAR_INSETS: Record<TopBarSize, string> = {\n default: 'px-6',\n large: 'px-[28px] max-sm:px-[16px]',\n};\n\nconst TOP_BAR_CLASSES: Record<TopBarSize, string> = {\n default: `${TOP_BAR_INSETS.default} pt-4 min-h-[var(--malachite-control-height-small,28px)]`,\n large: `h-[60px] ${TOP_BAR_INSETS.large} max-sm:h-[52px]`,\n};\n\nconst WizardLayout: React.FC<WizardLayoutProps> = ({\n showBack = false,\n onBack,\n backDisabled = false,\n reserveBack = true,\n topBarSize = 'default',\n leading,\n stepper,\n trailing,\n banner,\n header,\n footer,\n footerGlass = false,\n footerAlign = 'full',\n center = false,\n contentWidth = 480,\n minWidth,\n children,\n className = '',\n}) => {\n // The footer overlays the bottom of the scroll area (so content can glass under\n // it). Measure it so the scroll content reserves matching bottom space and the\n // last item is never hidden behind it.\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-run when the footer node mounts/unmounts so the observer attaches to the current element.\n useLayoutEffect(() => {\n const el = footerRef.current;\n if (!el) {\n setFooterHeight(0);\n return;\n }\n const update = () => setFooterHeight(el.offsetHeight);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(el);\n return () => observer.disconnect();\n }, [footer]);\n\n return (\n <div\n className={`w-full h-screen flex flex-col overflow-hidden bg-[var(--malachite-card-sunken-background)] ${className}`}\n style={minWidth ? { minWidth: `${minWidth}px` } : undefined}\n >\n <div\n className={`w-full shrink-0 flex items-center justify-between ${TOP_BAR_CLASSES[topBarSize]}`}\n >\n <div className=\"flex items-center gap-[16px] min-w-0\">\n {showBack ? (\n <Button\n variant=\"outline\"\n size=\"small\"\n iconOnly\n icon={<ArrowLeftIcon size={14} />}\n disabled={backDisabled}\n onClick={onBack}\n aria-label=\"Back\"\n className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\"\n />\n ) : reserveBack ? (\n <span className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\" />\n ) : null}\n {leading}\n </div>\n <div className=\"flex items-center gap-[16px]\">\n {trailing ?? null}\n {stepper ?? null}\n </div>\n </div>\n\n {banner ? (\n <div className={`w-full shrink-0 pt-[12px] ${TOP_BAR_INSETS[topBarSize]}`}>\n {banner}\n </div>\n ) : null}\n\n {header ? (\n <div className=\"w-full shrink-0 flex flex-col items-center px-6 pt-8\">\n <div\n className=\"w-full flex flex-col items-center gap-[24px]\"\n style={{ maxWidth: `${contentWidth}px` }}\n >\n {header}\n </div>\n </div>\n ) : null}\n\n <div className=\"relative flex-1 min-h-0\">\n {/* The gutter is held on both edges so a classic scrollbar keeps the content\n centred on the page, in line with the pinned header and the overlaid footer. */}\n <div\n className={`absolute inset-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] flex flex-col items-center px-6 ${\n center ? 'justify-center' : 'justify-start'\n }`}\n style={{\n // Reserve the overlaid footer's height plus a gap, so the last item\n // clears the footer with breathing room (not flush against it, which\n // reads as hidden content continuing underneath).\n paddingBottom: footer ? `${footerHeight + 24}px` : '48px',\n }}\n >\n <div\n className=\"w-full flex flex-col items-center gap-[40px]\"\n style={{\n maxWidth: `${contentWidth}px`,\n // Top padding lives on the scrolling content — NOT the scrollport —\n // so a `position: sticky` child pins flush to the top with no gap.\n paddingTop: header ? '32px' : '48px',\n }}\n >\n {children}\n </div>\n </div>\n\n {footer ? (\n <div\n ref={footerRef}\n // z-20 keeps the pinned footer above sticky body content (e.g. a\n // sticky Accordion header at z-10) so it can't paint over the footer.\n className=\"absolute inset-x-0 bottom-0 z-20\"\n style={footerGlass ? GLASS_SURFACE_STYLE : undefined}\n >\n {footerAlign === 'content' ? (\n <div className=\"flex justify-center px-6 pt-4 pb-3\">\n <div className=\"w-full\" style={{ maxWidth: `${contentWidth}px` }}>\n {footer}\n </div>\n </div>\n ) : (\n footer\n )}\n </div>\n ) : null}\n </div>\n </div>\n );\n};\n\nexport default WizardLayout;\nexport { WizardLayout };\n"],"names":["TOP_BAR_INSETS","TOP_BAR_CLASSES","WizardLayout","showBack","onBack","backDisabled","reserveBack","topBarSize","leading","stepper","trailing","banner","header","footer","footerGlass","footerAlign","center","contentWidth","minWidth","children","className","footerRef","useRef","footerHeight","setFooterHeight","useState","useLayoutEffect","el","update","observer","jsxs","jsx","Button","ArrowLeftIcon","GLASS_SURFACE_STYLE"],"mappings":";;;;;AAmDA,MAAMA,IAA6C;AAAA,EAC/C,SAAS;AAAA,EACT,OAAO;AACX,GAEMC,IAA8C;AAAA,EAChD,SAAS,GAAGD,EAAe,OAAO;AAAA,EAClC,OAAO,YAAYA,EAAe,KAAK;AAC3C,GAEME,IAA4C,CAAC;AAAA,EAC/C,UAAAC,IAAW;AAAA,EACX,QAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,cAAAC,IAAe;AAAA,EACf,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAChB,MAAM;AAIF,QAAMC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAcC,CAAe,IAAIC,EAAS,CAAC;AAGlD,SAAAC,EAAgB,MAAM;AAClB,UAAMC,IAAKN,EAAU;AACrB,QAAI,CAACM,GAAI;AACL,MAAAH,EAAgB,CAAC;AACjB;AAAA,IACJ;AACA,UAAMI,IAAS,MAAMJ,EAAgBG,EAAG,YAAY;AACpD,IAAAC,EAAA;AACA,UAAMC,IAAW,IAAI,eAAeD,CAAM;AAC1C,WAAAC,EAAS,QAAQF,CAAE,GACZ,MAAME,EAAS,WAAA;AAAA,EAC1B,GAAG,CAAChB,CAAM,CAAC,GAGP,gBAAAiB;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW,8FAA8FV,CAAS;AAAA,MAClH,OAAOF,IAAW,EAAE,UAAU,GAAGA,CA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AA;AAAA,gBAIH,eAAeH,IAAS,GAAGU,IAAe,EAAE,OAAO;AAAA,cAAA;AAAA,cAGvD,UAAA,gBAAAQ;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WAAU;AAAA,kBACV,OAAO;AAAA,oBACH,UAAU,GAAGd,CAAY;AAAA;AAAA;AAAA,oBAGzB,YAAYL,IAAS,SAAS;AAAA,kBAAA;AAAA,kBAGjC,UAAAO;AAAA,gBAAA;AAAA,cAAA;AAAA,YACL;AAAA,UAAA;AAAA,UAGHN,IACG,gBAAAkB;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,KAAKV;AAAA,cAGL,WAAU;AAAA,cACV,OAAOP,IAAcoB,IAAsB;AAAA,cAE1C,gBAAgB,YACb,gBAAAH,EAAC,SAAI,WAAU,sCACX,4BAAC,OAAA,EAAI,WAAU,UAAS,OAAO,EAAE,UAAU,GAAGd,CAAY,QACrD,UAAAJ,EAAA,CACL,GACJ,IAEAA;AAAA,YAAA;AAAA,UAAA,IAGR;AAAA,QAAA,EAAA,CACR;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2096,7 +2096,10 @@ export declare const ForwardArrowIcon: React.FC<IconProps_58>;
|
|
|
2096
2096
|
export declare function getCurrentTheme(): MalachiteTheme;
|
|
2097
2097
|
|
|
2098
2098
|
/**
|
|
2099
|
-
*
|
|
2099
|
+
* The mode this page is painted in. Once anything has painted it, that is read from the document,
|
|
2100
|
+
* not localStorage: every tab shares the stored mode, so a tab painted light would otherwise mount
|
|
2101
|
+
* dark components because another tab saved dark. Before the first paint it is the saved mode, so
|
|
2102
|
+
* a reload keeps the last choice.
|
|
2100
2103
|
*/
|
|
2101
2104
|
export declare function getCurrentThemeMode(): 'light' | 'dark';
|
|
2102
2105
|
|
package/dist/theme.js
CHANGED
|
@@ -1093,7 +1093,7 @@ const A = [
|
|
|
1093
1093
|
surfaceForeground: "rgb(134, 120, 186)"
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
|
-
}, O = "malachite-theme-mode", $ = "malachite-custom-theme",
|
|
1096
|
+
}, O = "malachite-theme-mode", $ = "malachite-custom-theme", G = /^--[A-Za-z0-9_-]+$/, L = /[{};]|\/\*|\*\//, _ = /^[A-Za-z0-9_-]+$/;
|
|
1097
1097
|
function T(r, l) {
|
|
1098
1098
|
if (typeof r == "string") {
|
|
1099
1099
|
if (L.test(r)) {
|
|
@@ -1108,7 +1108,7 @@ function T(r, l) {
|
|
|
1108
1108
|
const a = {};
|
|
1109
1109
|
for (const [o, n] of Object.entries(r)) {
|
|
1110
1110
|
const u = l ? `${l}.${o}` : o;
|
|
1111
|
-
if (!
|
|
1111
|
+
if (!_.test(o)) {
|
|
1112
1112
|
console.warn(
|
|
1113
1113
|
`Malachite: ignoring a theme key under ${l || "<root>"} — theme keys may contain only letters, digits, hyphens and underscores.`
|
|
1114
1114
|
);
|
|
@@ -1120,29 +1120,29 @@ function T(r, l) {
|
|
|
1120
1120
|
return a;
|
|
1121
1121
|
}
|
|
1122
1122
|
const x = /* @__PURE__ */ new Set();
|
|
1123
|
-
function
|
|
1123
|
+
function U(r) {
|
|
1124
1124
|
try {
|
|
1125
1125
|
if (x.has(r))
|
|
1126
1126
|
return;
|
|
1127
|
-
x.add(r),
|
|
1127
|
+
x.add(r), N(r);
|
|
1128
1128
|
} catch (l) {
|
|
1129
1129
|
console.error("Error registering shadow root:", l);
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1132
|
+
function J(r) {
|
|
1133
1133
|
try {
|
|
1134
1134
|
x.delete(r);
|
|
1135
1135
|
} catch (l) {
|
|
1136
1136
|
console.error("Error unregistering shadow root:", l);
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
|
-
const
|
|
1139
|
+
const D = {
|
|
1140
1140
|
rowVariant: "row-variant",
|
|
1141
1141
|
boxShadow: "box-shadow"
|
|
1142
1142
|
};
|
|
1143
1143
|
function E(r, l, a) {
|
|
1144
1144
|
Object.entries(r).forEach(([o, n]) => {
|
|
1145
|
-
const u =
|
|
1145
|
+
const u = D[o] ?? o;
|
|
1146
1146
|
typeof n == "object" && n !== null ? Object.entries(n).forEach(([b, t]) => {
|
|
1147
1147
|
const d = b.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
1148
1148
|
typeof t == "object" && t !== null ? Object.entries(t).forEach(([g, s]) => {
|
|
@@ -1241,10 +1241,10 @@ function p(r, l, a = "light") {
|
|
|
1241
1241
|
typeof c == "object" && c !== null ? Object.entries(c).forEach(([h, m]) => {
|
|
1242
1242
|
const B = h.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
1243
1243
|
typeof m == "object" && m !== null ? Object.entries(m).forEach(
|
|
1244
|
-
([
|
|
1245
|
-
const
|
|
1244
|
+
([Z, M]) => {
|
|
1245
|
+
const R = Z.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
1246
1246
|
t.push(
|
|
1247
|
-
`--malachite-text-${i}-${B}-${
|
|
1247
|
+
`--malachite-text-${i}-${B}-${R}: ${M}`
|
|
1248
1248
|
);
|
|
1249
1249
|
}
|
|
1250
1250
|
) : t.push(
|
|
@@ -1277,7 +1277,7 @@ function p(r, l, a = "light") {
|
|
|
1277
1277
|
});
|
|
1278
1278
|
const g = t.filter((s) => {
|
|
1279
1279
|
if (!L.test(s)) return !0;
|
|
1280
|
-
const c = s.split(":", 1)[0].trim(), i =
|
|
1280
|
+
const c = s.split(":", 1)[0].trim(), i = G.test(c) ? c : "an unnamed token";
|
|
1281
1281
|
return console.warn(`Malachite: dropped an unsafe theme declaration for ${i}`), !1;
|
|
1282
1282
|
});
|
|
1283
1283
|
b.textContent = `:host { color-scheme: ${a}; ${g.join("; ")} }`;
|
|
@@ -1402,7 +1402,7 @@ function p(r, l, a = "light") {
|
|
|
1402
1402
|
});
|
|
1403
1403
|
}));
|
|
1404
1404
|
}
|
|
1405
|
-
function
|
|
1405
|
+
function N(r) {
|
|
1406
1406
|
try {
|
|
1407
1407
|
const l = P(), a = V(), o = l === "dark" ? k : e, n = a ? w(o, a) : o;
|
|
1408
1408
|
p(n, r, l);
|
|
@@ -1410,8 +1410,9 @@ function D(r) {
|
|
|
1410
1410
|
console.error("Error applying theme to shadow root:", l);
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
|
+
let j = !1;
|
|
1413
1414
|
function P() {
|
|
1414
|
-
return typeof window > "u" ? "light" : localStorage.getItem(O) || "light";
|
|
1415
|
+
return typeof window > "u" ? "light" : j ? document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light" : localStorage.getItem(O) || "light";
|
|
1415
1416
|
}
|
|
1416
1417
|
function V() {
|
|
1417
1418
|
if (typeof window > "u") return null;
|
|
@@ -1423,10 +1424,10 @@ function V() {
|
|
|
1423
1424
|
return localStorage.removeItem($), null;
|
|
1424
1425
|
}
|
|
1425
1426
|
}
|
|
1426
|
-
function
|
|
1427
|
+
function H(r) {
|
|
1427
1428
|
typeof window < "u" && localStorage.setItem(O, r);
|
|
1428
1429
|
}
|
|
1429
|
-
function
|
|
1430
|
+
function I(r) {
|
|
1430
1431
|
typeof window < "u" && localStorage.setItem($, JSON.stringify(r));
|
|
1431
1432
|
}
|
|
1432
1433
|
function w(r, l) {
|
|
@@ -1501,45 +1502,45 @@ function w(r, l) {
|
|
|
1501
1502
|
}
|
|
1502
1503
|
return o;
|
|
1503
1504
|
}
|
|
1504
|
-
function
|
|
1505
|
-
|
|
1505
|
+
function W(r) {
|
|
1506
|
+
I(r);
|
|
1506
1507
|
const l = P(), o = w(l === "dark" ? k : e, r);
|
|
1507
1508
|
p(o, document.documentElement), x.forEach((n) => {
|
|
1508
1509
|
p(o, n, l);
|
|
1509
1510
|
}), C(l);
|
|
1510
1511
|
}
|
|
1511
|
-
function
|
|
1512
|
+
function q(r, l) {
|
|
1512
1513
|
const a = l === "dark" ? k : e, o = V(), n = o ? w(a, o) : a;
|
|
1513
1514
|
p(n, r, l);
|
|
1514
1515
|
}
|
|
1515
1516
|
const C = (r) => {
|
|
1516
|
-
r === "dark" ? document.documentElement.setAttribute("data-theme", "dark") : document.documentElement.removeAttribute("data-theme");
|
|
1517
|
+
j = !0, r === "dark" ? document.documentElement.setAttribute("data-theme", "dark") : document.documentElement.removeAttribute("data-theme");
|
|
1517
1518
|
};
|
|
1518
|
-
function
|
|
1519
|
-
|
|
1519
|
+
function K() {
|
|
1520
|
+
H("light"), C("light");
|
|
1520
1521
|
const r = V(), l = r ? w(e, r) : e;
|
|
1521
1522
|
p(l, document.documentElement), x.forEach((a) => {
|
|
1522
1523
|
p(l, a, "light");
|
|
1523
1524
|
});
|
|
1524
1525
|
}
|
|
1525
|
-
function
|
|
1526
|
-
|
|
1526
|
+
function z() {
|
|
1527
|
+
H("dark"), C("dark");
|
|
1527
1528
|
const r = V(), l = r ? w(k, r) : k;
|
|
1528
1529
|
p(l, document.documentElement), x.forEach((a) => {
|
|
1529
1530
|
p(l, a, "dark");
|
|
1530
1531
|
});
|
|
1531
1532
|
}
|
|
1532
|
-
function
|
|
1533
|
-
return P() === "dark" ? (
|
|
1533
|
+
function X() {
|
|
1534
|
+
return P() === "dark" ? (K(), "light") : (z(), "dark");
|
|
1534
1535
|
}
|
|
1535
|
-
function
|
|
1536
|
-
|
|
1536
|
+
function Q(r) {
|
|
1537
|
+
W(r);
|
|
1537
1538
|
}
|
|
1538
|
-
function
|
|
1539
|
+
function rr() {
|
|
1539
1540
|
const r = P();
|
|
1540
|
-
localStorage.removeItem($), r === "dark" ?
|
|
1541
|
+
localStorage.removeItem($), r === "dark" ? z() : K();
|
|
1541
1542
|
}
|
|
1542
|
-
function
|
|
1543
|
+
function Y() {
|
|
1543
1544
|
if (typeof window < "u") {
|
|
1544
1545
|
const r = P(), l = V();
|
|
1545
1546
|
if (r === "dark")
|
|
@@ -1556,7 +1557,7 @@ function W() {
|
|
|
1556
1557
|
C(r);
|
|
1557
1558
|
}
|
|
1558
1559
|
}
|
|
1559
|
-
function
|
|
1560
|
+
function er() {
|
|
1560
1561
|
const r = getComputedStyle(document.documentElement), l = {};
|
|
1561
1562
|
for (const a of A) {
|
|
1562
1563
|
const o = r.getPropertyValue(v(a)).trim();
|
|
@@ -1987,25 +1988,25 @@ function rr() {
|
|
|
1987
1988
|
};
|
|
1988
1989
|
}
|
|
1989
1990
|
let S = !1;
|
|
1990
|
-
const
|
|
1991
|
-
S || (S = !0,
|
|
1991
|
+
const or = () => {
|
|
1992
|
+
S || (S = !0, Y());
|
|
1992
1993
|
};
|
|
1993
1994
|
export {
|
|
1994
1995
|
f as CONTROL_HEIGHT,
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
1996
|
+
Q as applyCustomTheme,
|
|
1997
|
+
z as applyDarkTheme,
|
|
1998
|
+
K as applyLightTheme,
|
|
1999
|
+
W as applyTheme,
|
|
2000
|
+
q as applyThemeVars,
|
|
2000
2001
|
k as darkTheme,
|
|
2001
2002
|
e as defaultTheme,
|
|
2002
|
-
|
|
2003
|
-
|
|
2003
|
+
or as ensureThemeInitialized,
|
|
2004
|
+
er as getCurrentTheme,
|
|
2004
2005
|
P as getCurrentThemeMode,
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2006
|
+
Y as initializeTheme,
|
|
2007
|
+
U as registerShadowRoot,
|
|
2008
|
+
rr as resetTheme,
|
|
2009
|
+
X as toggleTheme,
|
|
2010
|
+
J as unregisterShadowRoot
|
|
2010
2011
|
};
|
|
2011
2012
|
//# sourceMappingURL=theme.js.map
|