@memobit/libs 3.29.0 → 3.31.0

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.
@@ -1,139 +1,142 @@
1
- import { Icon as b } from "../Icon/Icon2.js";
2
- import { libMessages as B } from "../../contexts/LanguageContext/libMessages.js";
3
- import { useMessages as M } from "../../hooks/useLanguage.js";
4
- import { Button as C } from "../Button/Button2.js";
5
- import { InputSearch as j } from "../InputSearch/InputSearch2.js";
6
- import { useAppFrame as I } from "./useAppFrame.js";
7
- import { countActiveFilters as L } from "./filterRules.js";
8
- import { AppliedFilters as P, FilterSections as z } from "./FilterSections.js";
9
- import { toMenuItems as O } from "./menuItems.js";
10
- import { getHeadingText as W, getResultLabel as D } from "./shellText.js";
11
- import { AppMark as V, PageMenu as H, PagePager as R, SortSheetBody as T } from "./PageParts.js";
12
- import { BottomSheet as k } from "./BottomSheet.js";
13
- import { useCallback as $, useState as q } from "react";
14
- import { jsx as e, jsxs as a } from "react/jsx-runtime";
15
- var ne = (i) => {
16
- const { title: N, counts: c, primaryAction: t, actions: w = [], search: n, sort: o, view: p, filters: s = [], values: h = {}, onFilterChange: _ = () => {
17
- }, onClearFilters: m, pagination: d, children: S } = i, l = M(B), u = I(), [v, g] = q(null), r = $(() => g(null), []), f = L(s, h), A = D(i, l), y = o?.fields.find((x) => x.value === o.value.field)?.label, F = [W(i, l), y].filter(Boolean).join(" · ");
18
- return /* @__PURE__ */ a("div", {
1
+ import { Icon as v } from "../Icon/Icon2.js";
2
+ import { libMessages as j } from "../../contexts/LanguageContext/libMessages.js";
3
+ import { useMessages as L } from "../../hooks/useLanguage.js";
4
+ import { Button as N } from "../Button/Button2.js";
5
+ import { InputSearch as P } from "../InputSearch/InputSearch2.js";
6
+ import { useAppFrame as T } from "./useAppFrame.js";
7
+ import { countActiveFilters as z } from "./filterRules.js";
8
+ import { getHeadingText as O, getResultLabel as W } from "./shellText.js";
9
+ import { AppMark as D, PageMenu as V, PagePager as H, SortSheetBody as R } from "./PageParts.js";
10
+ import { TabBar as $ } from "./AppNav.js";
11
+ import { AppliedFilters as q, FilterSections as E } from "./FilterSections.js";
12
+ import { getMenuItems as G, navToMenuItems as J } from "./menuItems.js";
13
+ import { BottomSheet as w } from "./BottomSheet.js";
14
+ import { useCallback as K, useState as Q } from "react";
15
+ import { jsx as e, jsxs as o } from "react/jsx-runtime";
16
+ var pe = (h) => {
17
+ const { title: S, counts: p, primaryAction: l, actions: A = [], search: n, sort: a, view: m, filters: s = [], values: d = {}, onFilterChange: C = () => {
18
+ }, onClearFilters: u, pagination: g, children: y } = h, t = L(j), r = T(), [k, f] = Q(null), i = K(() => f(null), []), b = z(s, d), B = W(h, t), F = a?.fields.find((x) => x.value === a.value.field)?.label, I = [O(h, t), F].filter(Boolean).join(" · "), c = r?.nav ?? [], _ = c.length > 1 && c.length <= 5, M = [..._ ? [] : J(c), ...G(A, r?.menuItems ?? [], !0)];
19
+ return /* @__PURE__ */ o("div", {
19
20
  className: [
20
21
  "page-shell",
21
22
  "page-shell--workbench",
22
23
  "page-shell--phone",
23
- t?.variant ? `page-shell--fab-${t.variant}` : ""
24
+ _ ? "page-shell--with-tabs" : "",
25
+ l?.variant ? `page-shell--fab-${l.variant}` : ""
24
26
  ].filter(Boolean).join(" "),
25
27
  children: [
26
- /* @__PURE__ */ a("header", {
28
+ /* @__PURE__ */ o("header", {
27
29
  className: "page-shell__topbar",
28
30
  children: [
29
- u && /* @__PURE__ */ e(V, {
30
- app: u.app,
31
+ r && /* @__PURE__ */ e(D, {
32
+ app: r.app,
31
33
  logoOnly: !0
32
34
  }),
33
35
  /* @__PURE__ */ e("h1", {
34
36
  className: "page-shell__title",
35
- children: N
37
+ children: S
36
38
  }),
37
39
  /* @__PURE__ */ e("span", { className: "page-shell__spacer" }),
38
- s.length > 0 && /* @__PURE__ */ a("button", {
40
+ s.length > 0 && /* @__PURE__ */ o("button", {
39
41
  type: "button",
40
42
  className: "page-shell__icon-button",
41
- onClick: () => g("filters"),
42
- children: [/* @__PURE__ */ e(b, {
43
+ onClick: () => f("filters"),
44
+ children: [/* @__PURE__ */ e(v, {
43
45
  name: "tune",
44
46
  size: "md"
45
- }), f > 0 && /* @__PURE__ */ e("span", {
47
+ }), b > 0 && /* @__PURE__ */ e("span", {
46
48
  className: "page-shell__badge page-shell__badge--corner",
47
- children: f
49
+ children: b
48
50
  })]
49
51
  }),
50
- /* @__PURE__ */ e(H, { items: [...O(w), ...u?.menuItems ?? []] })
52
+ /* @__PURE__ */ e(V, { items: M })
51
53
  ]
52
54
  }),
53
55
  n && /* @__PURE__ */ e("div", {
54
56
  className: "page-shell__search-row",
55
- children: /* @__PURE__ */ e(j, {
57
+ children: /* @__PURE__ */ e(P, {
56
58
  value: n.value,
57
- placeholder: n.placeholder ?? l.search,
59
+ placeholder: n.placeholder ?? t.search,
58
60
  onChange: n.onChange
59
61
  })
60
62
  }),
61
- /* @__PURE__ */ e(P, {
63
+ /* @__PURE__ */ e(q, {
62
64
  filters: s,
63
- values: h,
64
- onFilterChange: _,
65
- onClearFilters: m,
65
+ values: d,
66
+ onFilterChange: C,
67
+ onClearFilters: u,
66
68
  scroll: !0
67
69
  }),
68
- (o || p || d && d.pageCount > 1) && /* @__PURE__ */ a("div", {
70
+ (a || m || g && g.pageCount > 1) && /* @__PURE__ */ o("div", {
69
71
  className: "page-shell__result-row",
70
- children: [(o || p) && /* @__PURE__ */ a("button", {
72
+ children: [(a || m) && /* @__PURE__ */ o("button", {
71
73
  type: "button",
72
74
  className: "page-shell__result-line",
73
- onClick: () => g("sort"),
74
- children: [/* @__PURE__ */ e("span", { children: F || l.pageSortAndView }), /* @__PURE__ */ e(b, {
75
+ onClick: () => f("sort"),
76
+ children: [/* @__PURE__ */ e("span", { children: I || t.pageSortAndView }), /* @__PURE__ */ e(v, {
75
77
  name: "caret-down",
76
78
  size: "sm"
77
79
  })]
78
- }), /* @__PURE__ */ e(R, { pagination: d })]
80
+ }), /* @__PURE__ */ e(H, { pagination: g })]
79
81
  }),
80
82
  /* @__PURE__ */ e("div", {
81
83
  className: "page-shell__content",
82
- children: S
84
+ children: y
83
85
  }),
84
- t && /* @__PURE__ */ e("button", {
86
+ l && /* @__PURE__ */ e("button", {
85
87
  type: "button",
86
88
  className: "page-shell__fab",
87
- disabled: t.disabled,
88
- onClick: t.onClick,
89
- children: /* @__PURE__ */ e(b, {
90
- name: t.icon ?? "plus",
89
+ disabled: l.disabled,
90
+ onClick: l.onClick,
91
+ children: /* @__PURE__ */ e(v, {
92
+ name: l.icon ?? "plus",
91
93
  size: "lg"
92
94
  })
93
95
  }),
94
- /* @__PURE__ */ e(k, {
95
- isOpen: v === "filters",
96
+ _ && /* @__PURE__ */ e($, { nav: c }),
97
+ /* @__PURE__ */ e(w, {
98
+ isOpen: k === "filters",
96
99
  tall: !0,
97
- title: l.filters,
98
- onClose: r,
99
- end: f > 0 && m ? /* @__PURE__ */ e("button", {
100
+ title: t.filters,
101
+ onClose: i,
102
+ end: b > 0 && u ? /* @__PURE__ */ e("button", {
100
103
  type: "button",
101
104
  className: "page-shell__link",
102
- onClick: m,
103
- children: l.pageClearAll
105
+ onClick: u,
106
+ children: t.pageClearAll
104
107
  }) : void 0,
105
- footer: /* @__PURE__ */ e(C, {
108
+ footer: /* @__PURE__ */ e(N, {
106
109
  variant: "info",
107
110
  fullWidth: !0,
108
- disabled: c?.shown === 0,
109
- onClick: r,
110
- children: c ? A(c.shown) : l.pageDone
111
+ disabled: p?.shown === 0,
112
+ onClick: i,
113
+ children: p ? B(p.shown) : t.pageDone
111
114
  }),
112
- children: /* @__PURE__ */ e(z, {
115
+ children: /* @__PURE__ */ e(E, {
113
116
  filters: s,
114
- values: h,
117
+ values: d,
115
118
  context: "sheet",
116
- onFilterChange: _
119
+ onFilterChange: C
117
120
  })
118
121
  }),
119
- /* @__PURE__ */ e(k, {
120
- isOpen: v === "sort",
121
- title: l.pageSortAndView,
122
- onClose: r,
123
- footer: /* @__PURE__ */ e(C, {
122
+ /* @__PURE__ */ e(w, {
123
+ isOpen: k === "sort",
124
+ title: t.pageSortAndView,
125
+ onClose: i,
126
+ footer: /* @__PURE__ */ e(N, {
124
127
  variant: "info",
125
128
  fullWidth: !0,
126
- onClick: r,
127
- children: l.pageDone
129
+ onClick: i,
130
+ children: t.pageDone
128
131
  }),
129
- children: /* @__PURE__ */ e(T, {
130
- sort: o,
131
- view: p
132
+ children: /* @__PURE__ */ e(R, {
133
+ sort: a,
134
+ view: m
132
135
  })
133
136
  })
134
137
  ]
135
138
  });
136
139
  };
137
140
  export {
138
- ne as WorkbenchPhone
141
+ pe as WorkbenchPhone
139
142
  };
@@ -1,30 +1,31 @@
1
- import { libMessages as W } from "../../contexts/LanguageContext/libMessages.js";
2
- import { useMessages as j } from "../../hooks/useLanguage.js";
1
+ import { libMessages as V } from "../../contexts/LanguageContext/libMessages.js";
2
+ import { useMessages as L } from "../../hooks/useLanguage.js";
3
3
  import { Button as _ } from "../Button/Button2.js";
4
- import { InputSearch as B } from "../InputSearch/InputSearch2.js";
5
- import { useBreakpoint as L } from "../../hooks/useBreakpoint.js";
6
- import { Drawer as V } from "../Drawer/Drawer2.js";
7
- import { useAppFrame as H } from "./useAppFrame.js";
8
- import { countActiveFilters as R } from "./filterRules.js";
9
- import { AppliedFilters as q, FilterSections as z } from "./FilterSections.js";
10
- import { toMenuItems as E } from "./menuItems.js";
4
+ import { InputSearch as R } from "../InputSearch/InputSearch2.js";
5
+ import { useBreakpoint as E } from "../../hooks/useBreakpoint.js";
6
+ import { Drawer as H } from "../Drawer/Drawer2.js";
7
+ import { useAppFrame as q } from "./useAppFrame.js";
8
+ import { countActiveFilters as z } from "./filterRules.js";
11
9
  import { getHeadingText as G, getResultLabel as J } from "./shellText.js";
12
- import { ActionButton as u, AppMark as M, PageMenu as x, PagePager as K, SortDropdown as Q, ViewOptions as I, ViewToggle as U } from "./PageParts.js";
13
- import { WorkbenchPhone as X } from "./WorkbenchPhone.js";
14
- import { useState as Y } from "react";
10
+ import { ActionButton as v, AppMark as B, PageMenu as M, PagePager as K, SortDropdown as Q, ViewOptions as S, ViewToggle as U } from "./PageParts.js";
11
+ import { NavRail as X, SideNav as Y } from "./AppNav.js";
12
+ import { AppliedFilters as Z, FilterSections as $ } from "./FilterSections.js";
13
+ import { getButtonActions as ee, getMenuItems as y } from "./menuItems.js";
14
+ import { WorkbenchPhone as le } from "./WorkbenchPhone.js";
15
+ import { useState as ae } from "react";
15
16
  import { jsx as e, jsxs as a } from "react/jsx-runtime";
16
- var de = (o) => {
17
- const { isMobile: O, isTablet: l } = L(), s = j(W), r = H(), [S, m] = Y(!1);
18
- if (O) return /* @__PURE__ */ e(X, { ...o });
19
- const { title: y, counts: f, primaryAction: n, actions: v = [], search: c, sort: N, view: t, filters: p = [], values: d = {}, onFilterChange: b = () => {
20
- }, onClearFilters: i, pagination: D, children: P } = o, k = G(o, s), T = J(o, s), h = R(p, d), g = p.length > 0, w = r?.menuItems ?? [], C = /* @__PURE__ */ e(z, {
21
- filters: p,
22
- values: d,
17
+ var Ne = (n) => {
18
+ const { isMobile: I, isTablet: l } = E(), t = L(V), r = q(), [O, g] = ae(!1);
19
+ if (I) return /* @__PURE__ */ e(le, { ...n });
20
+ const { title: D, counts: N, primaryAction: c, actions: d = [], search: p, sort: b, view: s, filters: h = [], values: u = {}, onFilterChange: w = () => {
21
+ }, onClearFilters: i, pagination: P, children: T } = n, k = G(n, t), W = J(n, t), m = z(h, u), f = h.length > 0, C = r?.menuItems ?? [], o = r?.nav ?? [], j = !!(s && (s.columns || s.groupBy || s.toggles?.length)), A = /* @__PURE__ */ e($, {
22
+ filters: h,
23
+ values: u,
23
24
  context: "panel",
24
- onFilterChange: b
25
- }), A = h > 0 && /* @__PURE__ */ e("span", {
25
+ onFilterChange: w
26
+ }), F = m > 0 && /* @__PURE__ */ e("span", {
26
27
  className: "page-shell__badge",
27
- children: h
28
+ children: m
28
29
  });
29
30
  return /* @__PURE__ */ a("div", {
30
31
  className: [
@@ -36,47 +37,52 @@ var de = (o) => {
36
37
  !l && /* @__PURE__ */ a("aside", {
37
38
  className: "page-shell__side",
38
39
  children: [
39
- r && /* @__PURE__ */ e(M, { app: r.app }),
40
- n && /* @__PURE__ */ e(u, {
41
- action: n,
40
+ r && /* @__PURE__ */ e(B, { app: r.app }),
41
+ c && /* @__PURE__ */ e(v, {
42
+ action: c,
42
43
  fullWidth: !0
43
44
  }),
44
- g && /* @__PURE__ */ a("div", {
45
+ o.length > 1 && /* @__PURE__ */ e(Y, { nav: o }),
46
+ f && /* @__PURE__ */ a("div", {
45
47
  className: "page-shell__side-group",
46
48
  children: [/* @__PURE__ */ a("div", {
47
49
  className: "page-shell__side-head",
48
50
  children: [
49
51
  /* @__PURE__ */ e("span", {
50
52
  className: "page-shell__group-title",
51
- children: s.filters
53
+ children: t.filters
52
54
  }),
53
- A,
55
+ F,
54
56
  /* @__PURE__ */ e("span", { className: "page-shell__spacer" }),
55
- h > 0 && i && /* @__PURE__ */ e("button", {
57
+ m > 0 && i && /* @__PURE__ */ e("button", {
56
58
  type: "button",
57
59
  className: "page-shell__link",
58
60
  onClick: i,
59
- children: s.pageClearAll
61
+ children: t.pageClearAll
60
62
  })
61
63
  ]
62
- }), C]
64
+ }), A]
63
65
  }),
64
- t && /* @__PURE__ */ e(I, { view: t })
66
+ s && /* @__PURE__ */ e(S, { view: s })
65
67
  ]
66
68
  }),
69
+ l && o.length > 1 && /* @__PURE__ */ e(X, {
70
+ app: r?.app,
71
+ nav: o
72
+ }),
67
73
  /* @__PURE__ */ a("div", {
68
74
  className: "page-shell__main",
69
75
  children: [
70
76
  /* @__PURE__ */ a("header", {
71
77
  className: "page-shell__toolbar",
72
78
  children: [
73
- l && g && /* @__PURE__ */ a(_, {
79
+ l && f && /* @__PURE__ */ a(_, {
74
80
  icon: "tune",
75
81
  variant: "default",
76
- onClick: () => m(!0),
77
- children: [s.filters, A]
82
+ onClick: () => g(!0),
83
+ children: [t.filters, F]
78
84
  }),
79
- l && r && /* @__PURE__ */ e(M, {
85
+ l && r && o.length <= 1 && /* @__PURE__ */ e(B, {
80
86
  app: r.app,
81
87
  logoOnly: !0
82
88
  }),
@@ -84,64 +90,64 @@ var de = (o) => {
84
90
  className: "page-shell__titles",
85
91
  children: [/* @__PURE__ */ e("h1", {
86
92
  className: "page-shell__title",
87
- children: y
93
+ children: D
88
94
  }), k && /* @__PURE__ */ e("p", {
89
95
  className: "page-shell__heading",
90
96
  children: k
91
97
  })]
92
98
  }),
93
- l && n && /* @__PURE__ */ e(u, { action: n }),
94
- l && /* @__PURE__ */ e(x, { items: [...E(v), ...w] }),
99
+ l && c && /* @__PURE__ */ e(v, { action: c }),
100
+ l && /* @__PURE__ */ e(M, { items: y(d, C, !0) }),
95
101
  l && /* @__PURE__ */ e("span", { className: "page-shell__break" }),
96
- c && /* @__PURE__ */ e(B, {
102
+ p && /* @__PURE__ */ e(R, {
97
103
  className: "page-shell__search",
98
- value: c.value,
99
- placeholder: c.placeholder ?? s.search,
100
- onChange: c.onChange
104
+ value: p.value,
105
+ placeholder: p.placeholder ?? t.search,
106
+ onChange: p.onChange
101
107
  }),
102
- N && /* @__PURE__ */ e(Q, { sort: N }),
103
- l && t && /* @__PURE__ */ e(U, { view: t }),
104
- !l && v.map((F) => /* @__PURE__ */ e(u, { action: F }, F.id)),
105
- !l && /* @__PURE__ */ e(x, { items: w })
108
+ b && /* @__PURE__ */ e(Q, { sort: b }),
109
+ l && s && /* @__PURE__ */ e(U, { view: s }),
110
+ !l && ee(d).map((x) => /* @__PURE__ */ e(v, { action: x }, x.id)),
111
+ !l && /* @__PURE__ */ e(M, { items: y(d, C, !1) })
106
112
  ]
107
113
  }),
108
114
  /* @__PURE__ */ a("div", {
109
115
  className: "page-shell__status",
110
- children: [/* @__PURE__ */ e(q, {
111
- filters: p,
112
- values: d,
113
- onFilterChange: b,
116
+ children: [/* @__PURE__ */ e(Z, {
117
+ filters: h,
118
+ values: u,
119
+ onFilterChange: w,
114
120
  onClearFilters: i
115
- }), /* @__PURE__ */ e(K, { pagination: D })]
121
+ }), /* @__PURE__ */ e(K, { pagination: P })]
116
122
  }),
117
123
  /* @__PURE__ */ e("div", {
118
124
  className: "page-shell__content",
119
- children: P
125
+ children: T
120
126
  })
121
127
  ]
122
128
  }),
123
- l && g && /* @__PURE__ */ e(V, {
124
- isOpen: S,
125
- onClose: () => m(!1),
129
+ l && f && /* @__PURE__ */ e(H, {
130
+ isOpen: O,
131
+ onClose: () => g(!1),
126
132
  position: "left",
127
- title: s.filters,
133
+ title: t.filters,
128
134
  footer: /* @__PURE__ */ a("div", {
129
135
  className: "page-shell__drawer-footer",
130
- children: [h > 0 && i && /* @__PURE__ */ e(_, {
136
+ children: [m > 0 && i && /* @__PURE__ */ e(_, {
131
137
  variant: "default",
132
138
  onClick: i,
133
- children: s.pageClearAll
134
- }), f && /* @__PURE__ */ e(_, {
139
+ children: t.pageClearAll
140
+ }), N && /* @__PURE__ */ e(_, {
135
141
  variant: "info",
136
142
  fullWidth: !0,
137
- onClick: () => m(!1),
138
- children: T(f.shown)
143
+ onClick: () => g(!1),
144
+ children: W(N.shown)
139
145
  })]
140
146
  }),
141
147
  children: /* @__PURE__ */ a("div", {
142
148
  className: "page-shell__drawer-body",
143
- children: [C, t?.columns && /* @__PURE__ */ e(I, {
144
- view: t,
149
+ children: [A, s && j && /* @__PURE__ */ e(S, {
150
+ view: s,
145
151
  showToggle: !1
146
152
  })]
147
153
  })
@@ -150,5 +156,5 @@ var de = (o) => {
150
156
  });
151
157
  };
152
158
  export {
153
- de as WorkbenchShell
159
+ Ne as WorkbenchShell
154
160
  };
@@ -1,9 +1,17 @@
1
- var i = (l) => l.map((e) => ({
1
+ var o = (l) => l.map((e) => ({
2
2
  label: e.label,
3
3
  icon: e.icon,
4
4
  onClick: e.onClick,
5
- isActive: !1
5
+ isActive: !1,
6
+ separator: e.separator
7
+ })), r = (l) => l.filter((e) => !e.menu), t = (l, e, a) => [...o(a ? l : l.filter((n) => n.menu)), ...e], i = (l) => l.map((e) => ({
8
+ label: e.label,
9
+ icon: e.icon,
10
+ onClick: e.onSelect,
11
+ isActive: e.isActive
6
12
  }));
7
13
  export {
8
- i as toMenuItems
14
+ r as getButtonActions,
15
+ t as getMenuItems,
16
+ i as navToMenuItems
9
17
  };
@@ -0,0 +1,37 @@
1
+ import { AppFrame as m } from "../PageShell/AppFrame.js";
2
+ import { useMemo as p } from "react";
3
+ import { jsx as s } from "react/jsx-runtime";
4
+ import { matchPath as l, useLocation as u, useNavigate as d } from "react-router";
5
+ var g = ({ nav: n, app: e, ...r }) => {
6
+ const { pathname: t } = u(), a = d(), h = p(() => n.map((o) => ({
7
+ id: o.path,
8
+ label: o.label,
9
+ icon: o.icon,
10
+ count: o.count,
11
+ isActive: l({
12
+ path: o.path,
13
+ end: o.end ?? o.path === "/"
14
+ }, t) !== null,
15
+ onSelect: () => a(o.path)
16
+ })), [
17
+ n,
18
+ t,
19
+ a
20
+ ]), c = n[0]?.path ?? "/", i = p(() => ({
21
+ ...e,
22
+ onHomeClick: e.onHomeClick ?? (t === c ? void 0 : () => a(c))
23
+ }), [
24
+ e,
25
+ t,
26
+ c,
27
+ a
28
+ ]);
29
+ return /* @__PURE__ */ s(m, {
30
+ ...r,
31
+ app: i,
32
+ nav: h
33
+ });
34
+ };
35
+ export {
36
+ g as RouterAppFrame
37
+ };
@@ -1 +1 @@
1
- .scroll-to-top{bottom:var(--spacing-24);right:var(--spacing-24);z-index:999;width:var(--spacing-48);height:var(--spacing-48);border-radius:var(--radius-full);background-color:var(--card-background-color);color:var(--body-accent-color);border:var(--spacing-1) solid var(--card-border-color);cursor:pointer;box-shadow:0 var(--spacing-4) var(--spacing-12) var(--box-shadow);transition:transform var(--transition-fast);animation:scrollToTopFadeIn var(--transition-moderate);justify-content:center;align-items:center;display:flex;position:fixed}.scroll-to-top:hover{transform:scale(1.1)}.scroll-to-top:active{transform:scale(.95)}body:has(.float-button-container) .scroll-to-top{right:calc(var(--spacing-24) + var(--spacing-4));bottom:calc(var(--spacing-24) + 66px)}body:has(.page-shell__fab) .scroll-to-top{right:calc(var(--spacing-16) + var(--spacing-6));bottom:calc(var(--spacing-16) + var(--spacing-60) + var(--spacing-12) + env(safe-area-inset-bottom,0px))}@keyframes scrollToTopFadeIn{0%{opacity:0;transform:translateY(var(--spacing-12))}to{opacity:1;transform:translateY(0)}}@media (width<=768px){.scroll-to-top{bottom:var(--spacing-16);right:var(--spacing-16)}body:has(.float-button-container) .scroll-to-top{bottom:calc(var(--spacing-16) + 58px)}}
1
+ .scroll-to-top{bottom:var(--spacing-24);right:var(--spacing-24);z-index:999;width:var(--spacing-48);height:var(--spacing-48);border-radius:var(--radius-full);background-color:var(--card-background-color);color:var(--body-accent-color);border:var(--spacing-1) solid var(--card-border-color);cursor:pointer;box-shadow:0 var(--spacing-4) var(--spacing-12) var(--box-shadow);transition:transform var(--transition-fast);animation:scrollToTopFadeIn var(--transition-moderate);justify-content:center;align-items:center;display:flex;position:fixed}.scroll-to-top:hover{transform:scale(1.1)}.scroll-to-top:active{transform:scale(.95)}body:has(.float-button-container) .scroll-to-top{right:calc(var(--spacing-24) + var(--spacing-4));bottom:calc(var(--spacing-24) + 66px)}body:has(.page-shell__fab) .scroll-to-top{right:calc(var(--spacing-16) + var(--spacing-6));bottom:calc(var(--spacing-16) + var(--spacing-60) + var(--spacing-12) + env(safe-area-inset-bottom,0px))}@keyframes scrollToTopFadeIn{0%{opacity:0;transform:translateY(var(--spacing-12))}to{opacity:1;transform:translateY(0)}}@media (width<=768px){.scroll-to-top{bottom:var(--spacing-16);right:var(--spacing-16)}body:has(.float-button-container) .scroll-to-top{bottom:calc(var(--spacing-16) + 58px)}}body:has(.page-shell--with-tabs) .scroll-to-top{bottom:calc(var(--spacing-60) + var(--spacing-16) + env(safe-area-inset-bottom,0px))}body:has(.page-shell--with-tabs .page-shell__fab) .scroll-to-top{bottom:calc(var(--spacing-60) + var(--spacing-16) + var(--spacing-60) + var(--spacing-12) + env(safe-area-inset-bottom,0px))}
@@ -1,37 +1,37 @@
1
- import { ThemeContext as B } from "./ThemeContextValue.js";
2
- import { Tooltip as H } from "../Tooltip/Tooltip2.js";
3
- import { THEME_CONFIGS as c, getThemeConfig as R } from "./themeConfig.js";
4
- import { useCallback as m, useEffect as _, useState as v } from "react";
1
+ import { ThemeContext as A } from "./ThemeContextValue.js";
2
+ import { Tooltip as F } from "../Tooltip/Tooltip2.js";
3
+ import { THEME_CONFIGS as c, getThemeConfig as k } from "./themeConfig.js";
4
+ import { useCallback as m, useEffect as I, useState as v } from "react";
5
5
  import { jsx as f, jsxs as E } from "react/jsx-runtime";
6
- var I = "theme-stylesheet", k = "theme-font-link", b = "theme-font-link-display", w = "theme-font-link-mono", X = ({ children: L, theme: C, effects: M, onSave: y, allowedThemes: s }) => {
7
- const [d, l] = v(null), [N, a] = v(null), [P, g] = v(!1), o = d ?? C, p = N ?? M;
8
- _(() => {
6
+ var b = "theme-stylesheet", w = "theme-font-link", L = "theme-font-link-display", C = "theme-font-link-mono", q = ({ children: M, theme: y, effects: N, onSave: g, allowedThemes: s, fallbackTheme: P = "luna" }) => {
7
+ const [d, l] = v(null), [S, a] = v(null), [D, T] = v(!1), O = k(y) === void 0 ? P : y, o = d ?? O, p = S ?? N;
8
+ I(() => {
9
9
  document.documentElement.setAttribute("data-theme", o);
10
10
  const i = (typeof __MEMOBIT_THEME_URLS__ > "u" ? void 0 : __MEMOBIT_THEME_URLS__)?.[o];
11
11
  if (i !== void 0) {
12
- let e = document.getElementById(I);
13
- e || (e = document.createElement("link"), e.id = I, e.rel = "stylesheet", document.head.appendChild(e));
12
+ let e = document.getElementById(b);
13
+ e || (e = document.createElement("link"), e.id = b, e.rel = "stylesheet", document.head.appendChild(e));
14
14
  const t = new URL(i, import.meta.url).href;
15
15
  e.href !== t && (e.href = t);
16
16
  }
17
- const r = R(o);
17
+ const r = k(o);
18
18
  if (r) {
19
- let e = document.getElementById(k);
20
- e || (e = document.createElement("link"), e.id = k, e.rel = "stylesheet", document.head.appendChild(e)), e.href = r.fontUrl;
21
- let t = document.getElementById(b);
22
- r.fontUrlDisplay ? (t || (t = document.createElement("link"), t.id = b, t.rel = "stylesheet", document.head.appendChild(t)), t.href = r.fontUrlDisplay) : t?.remove();
23
- let n = document.getElementById(w);
24
- r.fontUrlMono ? (n || (n = document.createElement("link"), n.id = w, n.rel = "stylesheet", document.head.appendChild(n)), n.href = r.fontUrlMono) : n?.remove();
19
+ let e = document.getElementById(w);
20
+ e || (e = document.createElement("link"), e.id = w, e.rel = "stylesheet", document.head.appendChild(e)), e.href = r.fontUrl;
21
+ let t = document.getElementById(L);
22
+ r.fontUrlDisplay ? (t || (t = document.createElement("link"), t.id = L, t.rel = "stylesheet", document.head.appendChild(t)), t.href = r.fontUrlDisplay) : t?.remove();
23
+ let n = document.getElementById(C);
24
+ r.fontUrlMono ? (n || (n = document.createElement("link"), n.id = C, n.rel = "stylesheet", document.head.appendChild(n)), n.href = r.fontUrlMono) : n?.remove();
25
25
  }
26
26
  }, [o]);
27
- const S = m((i) => {
27
+ const U = m((i) => {
28
28
  l(i);
29
- }, []), D = m((i) => {
29
+ }, []), K = m((i) => {
30
30
  a(i);
31
- }, []), O = m(() => {
31
+ }, []), B = m(() => {
32
32
  l(null), a(null);
33
33
  }, []);
34
- _(() => {
34
+ I(() => {
35
35
  const i = (e) => {
36
36
  if (!(e instanceof HTMLElement)) return !1;
37
37
  const t = e.tagName;
@@ -42,8 +42,8 @@ var I = "theme-stylesheet", k = "theme-font-link", b = "theme-font-link-display"
42
42
  e.preventDefault();
43
43
  const t = c.map((u) => u.value), n = s && s.length > 0 ? t.filter((u) => s.includes(u)) : t;
44
44
  if (n.length === 0) return;
45
- const T = n.indexOf(o), K = ((T === -1 ? 0 : T) + (e.key === "]" ? 1 : -1) + n.length) % n.length;
46
- l(n[K]);
45
+ const _ = n.indexOf(o), R = ((_ === -1 ? 0 : _) + (e.key === "]" ? 1 : -1) + n.length) % n.length;
46
+ l(n[R]);
47
47
  } else e.key === "Escape" && d && (e.preventDefault(), l(null), a(null));
48
48
  };
49
49
  return window.addEventListener("keydown", r), () => window.removeEventListener("keydown", r);
@@ -52,26 +52,26 @@ var I = "theme-stylesheet", k = "theme-font-link", b = "theme-font-link-display"
52
52
  d,
53
53
  s
54
54
  ]);
55
- const h = c.findIndex((i) => i.value === o), x = h >= 0 ? c[h].label : o, U = m(() => {
56
- y?.({
55
+ const h = c.findIndex((i) => i.value === o), x = h >= 0 ? c[h].label : o, H = m(() => {
56
+ g?.({
57
57
  theme: o,
58
58
  effects: p
59
59
  }), l(null), a(null);
60
60
  }, [
61
61
  o,
62
62
  p,
63
- y
63
+ g
64
64
  ]);
65
- return /* @__PURE__ */ E(B.Provider, {
65
+ return /* @__PURE__ */ E(A.Provider, {
66
66
  value: {
67
67
  theme: o,
68
68
  effects: p,
69
- setPreviewTheme: S,
70
- setPreviewEffects: D,
71
- commitPreview: U,
72
- clearPreview: O
69
+ setPreviewTheme: U,
70
+ setPreviewEffects: K,
71
+ commitPreview: H,
72
+ clearPreview: B
73
73
  },
74
- children: [L, d && /* @__PURE__ */ E("div", {
74
+ children: [M, d && /* @__PURE__ */ E("div", {
75
75
  style: {
76
76
  position: "fixed",
77
77
  bottom: 16,
@@ -85,11 +85,11 @@ var I = "theme-stylesheet", k = "theme-font-link", b = "theme-font-link-display"
85
85
  boxShadow: "0 4px 16px rgba(0, 0, 0, 0.3)"
86
86
  },
87
87
  children: [
88
- /* @__PURE__ */ f(H, {
88
+ /* @__PURE__ */ f(F, {
89
89
  title: "Copy theme name",
90
90
  children: /* @__PURE__ */ f("span", {
91
91
  onClick: () => {
92
- navigator.clipboard.writeText(x), g(!0), window.setTimeout(() => g(!1), 1500);
92
+ navigator.clipboard.writeText(x), T(!0), window.setTimeout(() => T(!1), 1500);
93
93
  },
94
94
  style: { cursor: "pointer" },
95
95
  children: x
@@ -116,7 +116,7 @@ var I = "theme-stylesheet", k = "theme-font-link", b = "theme-font-link-display"
116
116
  },
117
117
  children: "[ prev · ] next · Esc revert"
118
118
  }),
119
- P && /* @__PURE__ */ f("div", {
119
+ D && /* @__PURE__ */ f("div", {
120
120
  style: {
121
121
  position: "absolute",
122
122
  bottom: "calc(100% + 6px)",
@@ -136,5 +136,5 @@ var I = "theme-stylesheet", k = "theme-font-link", b = "theme-font-link-display"
136
136
  });
137
137
  };
138
138
  export {
139
- X as ThemeProvider
139
+ q as ThemeProvider
140
140
  };