@memobit/libs 3.30.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,37 +1,37 @@
|
|
|
1
|
-
import { ThemeContext as
|
|
2
|
-
import { Tooltip as
|
|
3
|
-
import { THEME_CONFIGS as c, getThemeConfig as
|
|
4
|
-
import { useCallback as m, useEffect as
|
|
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
|
|
7
|
-
const [d, l] = v(null), [
|
|
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(
|
|
13
|
-
e || (e = document.createElement("link"), e.id =
|
|
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 =
|
|
17
|
+
const r = k(o);
|
|
18
18
|
if (r) {
|
|
19
|
-
let e = document.getElementById(
|
|
20
|
-
e || (e = document.createElement("link"), e.id =
|
|
21
|
-
let t = document.getElementById(
|
|
22
|
-
r.fontUrlDisplay ? (t || (t = document.createElement("link"), t.id =
|
|
23
|
-
let n = document.getElementById(
|
|
24
|
-
r.fontUrlMono ? (n || (n = document.createElement("link"), n.id =
|
|
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
|
|
27
|
+
const U = m((i) => {
|
|
28
28
|
l(i);
|
|
29
|
-
}, []),
|
|
29
|
+
}, []), K = m((i) => {
|
|
30
30
|
a(i);
|
|
31
|
-
}, []),
|
|
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
|
|
46
|
-
l(n[
|
|
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,
|
|
56
|
-
|
|
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
|
-
|
|
63
|
+
g
|
|
64
64
|
]);
|
|
65
|
-
return /* @__PURE__ */ E(
|
|
65
|
+
return /* @__PURE__ */ E(A.Provider, {
|
|
66
66
|
value: {
|
|
67
67
|
theme: o,
|
|
68
68
|
effects: p,
|
|
69
|
-
setPreviewTheme:
|
|
70
|
-
setPreviewEffects:
|
|
71
|
-
commitPreview:
|
|
72
|
-
clearPreview:
|
|
69
|
+
setPreviewTheme: U,
|
|
70
|
+
setPreviewEffects: K,
|
|
71
|
+
commitPreview: H,
|
|
72
|
+
clearPreview: B
|
|
73
73
|
},
|
|
74
|
-
children: [
|
|
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(
|
|
88
|
+
/* @__PURE__ */ f(F, {
|
|
89
89
|
title: "Copy theme name",
|
|
90
90
|
children: /* @__PURE__ */ f("span", {
|
|
91
91
|
onClick: () => {
|
|
92
|
-
navigator.clipboard.writeText(x),
|
|
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
|
-
|
|
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
|
-
|
|
139
|
+
q as ThemeProvider
|
|
140
140
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3770,7 +3770,7 @@ export declare interface TextFilterValue {
|
|
|
3770
3770
|
mode?: string;
|
|
3771
3771
|
}
|
|
3772
3772
|
|
|
3773
|
-
export declare type Theme = '
|
|
3773
|
+
export declare type Theme = 'arctic-blue' | 'asphalt-code' | 'atelier-media' | 'audit-ember' | 'azure-night' | 'blossom-meadow' | 'blueprint-clay' | 'carbon-velocity' | 'chalk-circuit' | 'chrono-atlas' | 'circuit-harbor' | 'cobalt-pulse' | 'citrus-vital' | 'crawler-dusk' | 'crimson-dusk' | 'cyber-forest' | 'dashdarkx' | 'emerald-ledger' | 'garden-harvest' | 'graphite-shell' | 'horizon-amber' | 'indigo-stitch' | 'ivory-serif' | 'kindred-ink' | 'lamplight' | 'lumen' | 'luna' | 'mesh-circuit' | 'midnight-atlas' | 'midnight-amber' | 'noir-marquee' | 'ocean-breeze' | 'ocean-depths' | 'orbital-night' | 'sandstone' | 'sandy-parchment' | 'screening-room' | 'signal-burst' | 'signal-clarity' | 'slate-focus' | 'slate-bazaar' | 'tailwind-vue-dark' | 'terminal-phosphor' | 'terracotta-kitchen' | 'vault-guard' | 'verdant-pulse' | 'vital-aurora' | 'vital-signal' | 'war-room';
|
|
3774
3774
|
|
|
3775
3775
|
export { THEME_CONFIGS }
|
|
3776
3776
|
|
|
@@ -3800,6 +3800,11 @@ export declare interface ThemeProviderProps {
|
|
|
3800
3800
|
effects: ThemeEffects;
|
|
3801
3801
|
onSave?: (value: ThemeSaveValue) => void;
|
|
3802
3802
|
allowedThemes?: string[];
|
|
3803
|
+
/**
|
|
3804
|
+
* Shown when `theme` is no longer in @memobit/themes (a saved choice of a removed theme).
|
|
3805
|
+
* Pass the app's own default, usually `getDefaultThemeForApp(appName)`.
|
|
3806
|
+
*/
|
|
3807
|
+
fallbackTheme?: Theme;
|
|
3803
3808
|
}
|
|
3804
3809
|
|
|
3805
3810
|
export declare interface ThemeSaveValue {
|
package/dist/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var I = "3.
|
|
1
|
+
var I = "3.31.0", B = 656, L = "4f487ea", _ = "2026-11-07T19:44:52.809Z", a = "656";
|
|
2
2
|
export {
|
|
3
3
|
_ as LIB_BUILD_DATE,
|
|
4
|
-
|
|
4
|
+
a as LIB_BUILD_ID,
|
|
5
5
|
B as LIB_BUILD_NUMBER,
|
|
6
6
|
L as LIB_COMMIT,
|
|
7
7
|
I as LIB_VERSION
|
package/dist/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memobit/libs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.31.0",
|
|
4
4
|
"description": "React component library powering the Memobit apps — 100+ components, helpers and hooks. Icons ship as @memobit/icons and themes as @memobit/themes. TypeScript-first, ESM-only, React 19.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"@memobit/core": "1.0.0",
|
|
84
84
|
"@memobit/icons": "^1.7.0",
|
|
85
|
-
"@memobit/themes": "^1.0.0",
|
|
85
|
+
"@memobit/themes": "^1.0.0 || ^2.0.0",
|
|
86
86
|
"react": "19.3.0",
|
|
87
87
|
"react-dom": "19.3.0",
|
|
88
88
|
"react-router": "8.4.0"
|