@memobit/libs 3.1.0 → 3.1.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.
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import './Icon.css';
|
|
2
2
|
/* empty css */
|
|
3
3
|
import "react";
|
|
4
|
-
import { iconMap as
|
|
5
|
-
import { jsx as
|
|
6
|
-
var
|
|
7
|
-
|
|
4
|
+
import { iconMap as h } from "@memobit/icons/map";
|
|
5
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
6
|
+
var t = /* @__PURE__ */ new Set(), x = ({ className: s = "", fade: c, fadeOnHover: r, name: o, pulse: a, pulseOnHover: p, size: n, spin: l, spinOnHover: d, variant: i }) => {
|
|
7
|
+
const m = [
|
|
8
8
|
"icon",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
n ? `icon--${n}` : "",
|
|
10
|
+
i && i !== "default" ? `icon--${i}` : "",
|
|
11
|
+
l ? "icon--spin" : "",
|
|
12
12
|
c ? "icon--fade" : "",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
].filter(Boolean).join(" "),
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
a ? "icon--pulse" : "",
|
|
14
|
+
d ? "icon--spin-hover" : "",
|
|
15
|
+
r ? "icon--fade-hover" : "",
|
|
16
|
+
p ? "icon--pulse-hover" : "",
|
|
17
|
+
s
|
|
18
|
+
].filter(Boolean).join(" "), e = h[o];
|
|
19
|
+
return e === void 0 && !t.has(o) && (t.add(o), console.warn(`[@memobit/libs] No icon named "${o}". If this app trims icons with @memobit/icons/vite, add it to the plugin's \`include\` option — a name that only exists at runtime cannot be found by the source scan.`)), /* @__PURE__ */ f("span", {
|
|
20
|
+
className: m,
|
|
21
|
+
children: e
|
|
22
|
+
});
|
|
23
|
+
};
|
|
21
24
|
export {
|
|
22
|
-
|
|
25
|
+
x as Icon
|
|
23
26
|
};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { ThemeContext as
|
|
2
|
-
import { Tooltip as
|
|
3
|
-
import { THEME_CONFIGS as c, getThemeConfig as
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { jsx as
|
|
6
|
-
var
|
|
7
|
-
const [d, l] =
|
|
8
|
-
|
|
9
|
-
document.documentElement.setAttribute("data-theme",
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
let e = document.getElementById(
|
|
13
|
-
e || (e = document.createElement("link"), e.id =
|
|
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";
|
|
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
|
+
_(() => {
|
|
9
|
+
document.documentElement.setAttribute("data-theme", o);
|
|
10
|
+
const i = (typeof __MEMOBIT_THEME_URLS__ > "u" ? void 0 : __MEMOBIT_THEME_URLS__)?.[o];
|
|
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));
|
|
14
|
+
const t = new URL(i, import.meta.url).href;
|
|
15
|
+
e.href !== t && (e.href = t);
|
|
14
16
|
}
|
|
15
|
-
const r =
|
|
17
|
+
const r = R(o);
|
|
16
18
|
if (r) {
|
|
17
19
|
let e = document.getElementById(k);
|
|
18
20
|
e || (e = document.createElement("link"), e.id = k, e.rel = "stylesheet", document.head.appendChild(e)), e.href = r.fontUrl;
|
|
@@ -21,55 +23,55 @@ var _ = "theme-stylesheet", k = "theme-font-link", b = "theme-font-link-display"
|
|
|
21
23
|
let n = document.getElementById(w);
|
|
22
24
|
r.fontUrlMono ? (n || (n = document.createElement("link"), n.id = w, n.rel = "stylesheet", document.head.appendChild(n)), n.href = r.fontUrlMono) : n?.remove();
|
|
23
25
|
}
|
|
24
|
-
}, [
|
|
25
|
-
const S =
|
|
26
|
-
l(
|
|
27
|
-
}, []),
|
|
28
|
-
a(
|
|
29
|
-
}, []),
|
|
26
|
+
}, [o]);
|
|
27
|
+
const S = m((i) => {
|
|
28
|
+
l(i);
|
|
29
|
+
}, []), D = m((i) => {
|
|
30
|
+
a(i);
|
|
31
|
+
}, []), O = m(() => {
|
|
30
32
|
l(null), a(null);
|
|
31
33
|
}, []);
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
+
_(() => {
|
|
35
|
+
const i = (e) => {
|
|
34
36
|
if (!(e instanceof HTMLElement)) return !1;
|
|
35
37
|
const t = e.tagName;
|
|
36
38
|
return t === "INPUT" || t === "TEXTAREA" || t === "SELECT" || e.isContentEditable;
|
|
37
39
|
}, r = (e) => {
|
|
38
|
-
if (!(e.ctrlKey || e.metaKey || e.altKey) && !
|
|
40
|
+
if (!(e.ctrlKey || e.metaKey || e.altKey) && !i(e.target))
|
|
39
41
|
if (e.key === "[" || e.key === "]") {
|
|
40
42
|
e.preventDefault();
|
|
41
43
|
const t = c.map((u) => u.value), n = s && s.length > 0 ? t.filter((u) => s.includes(u)) : t;
|
|
42
44
|
if (n.length === 0) return;
|
|
43
|
-
const T = n.indexOf(
|
|
45
|
+
const T = n.indexOf(o), K = ((T === -1 ? 0 : T) + (e.key === "]" ? 1 : -1) + n.length) % n.length;
|
|
44
46
|
l(n[K]);
|
|
45
47
|
} else e.key === "Escape" && d && (e.preventDefault(), l(null), a(null));
|
|
46
48
|
};
|
|
47
49
|
return window.addEventListener("keydown", r), () => window.removeEventListener("keydown", r);
|
|
48
50
|
}, [
|
|
49
|
-
|
|
51
|
+
o,
|
|
50
52
|
d,
|
|
51
53
|
s
|
|
52
54
|
]);
|
|
53
|
-
const h = c.findIndex((
|
|
55
|
+
const h = c.findIndex((i) => i.value === o), x = h >= 0 ? c[h].label : o, U = m(() => {
|
|
54
56
|
y?.({
|
|
55
|
-
theme:
|
|
57
|
+
theme: o,
|
|
56
58
|
effects: p
|
|
57
59
|
}), l(null), a(null);
|
|
58
60
|
}, [
|
|
59
|
-
|
|
61
|
+
o,
|
|
60
62
|
p,
|
|
61
63
|
y
|
|
62
64
|
]);
|
|
63
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ E(B.Provider, {
|
|
64
66
|
value: {
|
|
65
|
-
theme:
|
|
67
|
+
theme: o,
|
|
66
68
|
effects: p,
|
|
67
69
|
setPreviewTheme: S,
|
|
68
|
-
setPreviewEffects:
|
|
69
|
-
commitPreview:
|
|
70
|
-
clearPreview:
|
|
70
|
+
setPreviewEffects: D,
|
|
71
|
+
commitPreview: U,
|
|
72
|
+
clearPreview: O
|
|
71
73
|
},
|
|
72
|
-
children: [L, d && /* @__PURE__ */
|
|
74
|
+
children: [L, d && /* @__PURE__ */ E("div", {
|
|
73
75
|
style: {
|
|
74
76
|
position: "fixed",
|
|
75
77
|
bottom: 16,
|
|
@@ -83,9 +85,9 @@ var _ = "theme-stylesheet", k = "theme-font-link", b = "theme-font-link-display"
|
|
|
83
85
|
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.3)"
|
|
84
86
|
},
|
|
85
87
|
children: [
|
|
86
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ f(H, {
|
|
87
89
|
title: "Copy theme name",
|
|
88
|
-
children: /* @__PURE__ */
|
|
90
|
+
children: /* @__PURE__ */ f("span", {
|
|
89
91
|
onClick: () => {
|
|
90
92
|
navigator.clipboard.writeText(x), g(!0), window.setTimeout(() => g(!1), 1500);
|
|
91
93
|
},
|
|
@@ -93,7 +95,7 @@ var _ = "theme-stylesheet", k = "theme-font-link", b = "theme-font-link-display"
|
|
|
93
95
|
children: x
|
|
94
96
|
})
|
|
95
97
|
}),
|
|
96
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ E("span", {
|
|
97
99
|
style: {
|
|
98
100
|
opacity: 0.6,
|
|
99
101
|
marginLeft: 8,
|
|
@@ -105,7 +107,7 @@ var _ = "theme-stylesheet", k = "theme-font-link", b = "theme-font-link-display"
|
|
|
105
107
|
c.length
|
|
106
108
|
]
|
|
107
109
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ f("div", {
|
|
109
111
|
style: {
|
|
110
112
|
opacity: 0.5,
|
|
111
113
|
fontSize: 11,
|
|
@@ -114,7 +116,7 @@ var _ = "theme-stylesheet", k = "theme-font-link", b = "theme-font-link-display"
|
|
|
114
116
|
},
|
|
115
117
|
children: "[ prev · ] next · Esc revert"
|
|
116
118
|
}),
|
|
117
|
-
P && /* @__PURE__ */
|
|
119
|
+
P && /* @__PURE__ */ f("div", {
|
|
118
120
|
style: {
|
|
119
121
|
position: "absolute",
|
|
120
122
|
bottom: "calc(100% + 6px)",
|
package/dist/memobit-icons.json
CHANGED
|
@@ -5,21 +5,52 @@
|
|
|
5
5
|
"arrow-left",
|
|
6
6
|
"arrow-right",
|
|
7
7
|
"arrow-up",
|
|
8
|
-
"
|
|
8
|
+
"bullet",
|
|
9
|
+
"burst",
|
|
9
10
|
"calendar",
|
|
11
|
+
"calendar-month",
|
|
12
|
+
"calendar-week",
|
|
10
13
|
"caret-down",
|
|
14
|
+
"caret-left",
|
|
11
15
|
"caret-right",
|
|
12
16
|
"caret-up",
|
|
13
17
|
"checkmark",
|
|
14
18
|
"clear",
|
|
15
|
-
"
|
|
19
|
+
"clipboard",
|
|
20
|
+
"comment",
|
|
21
|
+
"confetti",
|
|
22
|
+
"credit-card",
|
|
23
|
+
"empty",
|
|
24
|
+
"file",
|
|
25
|
+
"filters",
|
|
26
|
+
"fireworks",
|
|
16
27
|
"folder",
|
|
28
|
+
"food",
|
|
29
|
+
"gallery",
|
|
30
|
+
"grid",
|
|
31
|
+
"key",
|
|
17
32
|
"link",
|
|
33
|
+
"lock",
|
|
34
|
+
"map",
|
|
35
|
+
"menu-hamburger",
|
|
18
36
|
"next",
|
|
37
|
+
"other",
|
|
38
|
+
"ownership",
|
|
19
39
|
"pin",
|
|
20
40
|
"plus",
|
|
41
|
+
"previous",
|
|
42
|
+
"radio",
|
|
43
|
+
"return",
|
|
44
|
+
"save",
|
|
45
|
+
"scss",
|
|
21
46
|
"search",
|
|
22
47
|
"sparkle",
|
|
23
|
-
"
|
|
48
|
+
"star",
|
|
49
|
+
"table",
|
|
50
|
+
"target",
|
|
51
|
+
"time",
|
|
52
|
+
"tree",
|
|
53
|
+
"tune",
|
|
54
|
+
"warning"
|
|
24
55
|
]
|
|
25
56
|
}
|
package/dist/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var I = "3.1.
|
|
1
|
+
var I = "3.1.2", B = 439, L = "1cdcc0c", _ = "2026-10-02T05:56:33.724Z", r = "439";
|
|
2
2
|
export {
|
|
3
3
|
_ as LIB_BUILD_DATE,
|
|
4
|
-
|
|
4
|
+
r 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.1.
|
|
3
|
+
"version": "3.1.2",
|
|
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",
|