@memobit/libs 3.9.0 → 3.10.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.
- package/README.md +96 -95
- package/dist/components/Confetti/Confetti2.js +26 -25
- package/dist/components/ErrorBoundary/ErrorBoundary2.js +9 -8
- package/dist/components/InputDate/InputDate2.js +16 -15
- package/dist/components/InputEmail/InputEmail2.js +22 -21
- package/dist/components/InputFile/InputFile2.js +9 -8
- package/dist/components/InputNumber/InputNumber2.js +7 -6
- package/dist/components/InputPassword/InputPassword2.js +6 -5
- package/dist/components/InputSearch/InputSearch2.js +18 -17
- package/dist/components/InputText/InputText2.js +6 -5
- package/dist/components/InputTextarea/InputTextarea2.js +11 -10
- package/dist/components/InputTime/InputTime2.js +35 -34
- package/dist/components/InputUrl/InputUrl2.js +20 -19
- package/dist/components/QuantitySelector/QuantitySelector2.js +19 -18
- package/dist/errors.d.ts +78 -0
- package/dist/errors.js +9 -0
- package/dist/helpers/ErrorReporting.js +179 -0
- package/dist/helpers/Logger.js +31 -0
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/memobit-icons.json +1 -41
- package/dist/styles/highlight.scss +6 -6
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- package/package.json +12 -6
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
var b = 5e3, A = 10, U = 25, _ = 1e3, f = 4e3, m = 60, R = 3e3, T = [/ResizeObserver loop/, /^Script error\.?$/], l = null, u = !1, E = /* @__PURE__ */ new WeakSet(), d = {}, p = (e, r) => e.length > r ? `${e.slice(0, r)}…` : e, v = (e) => typeof e == "object" && e !== null && !Array.isArray(e), $ = (e) => v(e) && (e.enabled === void 0 || typeof e.enabled == "boolean"), s = (e) => {
|
|
2
|
+
if (e instanceof Error) return e.message ? `${e.name}: ${e.message}` : e.name;
|
|
3
|
+
if (typeof e == "string") return e;
|
|
4
|
+
try {
|
|
5
|
+
return p(JSON.stringify(e) ?? String(e), 500);
|
|
6
|
+
} catch {
|
|
7
|
+
return String(e);
|
|
8
|
+
}
|
|
9
|
+
}, C = (e) => {
|
|
10
|
+
const [r, ...n] = e;
|
|
11
|
+
return typeof r != "string" || !/%[sdifoOc]/.test(r) ? e.map(s).join(" ") : [r.replace(/%([sdifoOc%])/g, (t, o) => {
|
|
12
|
+
if (o === "%") return "%";
|
|
13
|
+
if (n.length === 0) return t;
|
|
14
|
+
const a = n.shift();
|
|
15
|
+
return o === "c" ? "" : s(a);
|
|
16
|
+
}), ...n.map(s)].join(" ");
|
|
17
|
+
}, O = (e) => {
|
|
18
|
+
if (e)
|
|
19
|
+
try {
|
|
20
|
+
const r = JSON.stringify(e);
|
|
21
|
+
if (r.length > f) return { truncated: p(r, f) };
|
|
22
|
+
const n = JSON.parse(r);
|
|
23
|
+
return v(n) ? n : void 0;
|
|
24
|
+
} catch {
|
|
25
|
+
return { unserializable: s(e) };
|
|
26
|
+
}
|
|
27
|
+
}, N = () => typeof location > "u" ? void 0 : location.origin + location.pathname, q = (e, r, n) => n?.includes("-extension://") ? !0 : e.ignore.some((t) => typeof t == "string" ? r.includes(t) : t.test(r)), h = (e, r) => {
|
|
28
|
+
e.pausedUntil = Date.now() + Math.max(30, r) * 1e3, e.queue.clear();
|
|
29
|
+
}, g = (e) => {
|
|
30
|
+
e.timer === null && (e.timer = setTimeout(() => {
|
|
31
|
+
c();
|
|
32
|
+
}, b));
|
|
33
|
+
}, y = (e, r) => {
|
|
34
|
+
(d[e] ?? console[e]).apply(console, r);
|
|
35
|
+
}, i = (e) => {
|
|
36
|
+
const r = l;
|
|
37
|
+
if (!(!r || u)) {
|
|
38
|
+
if (typeof e.error == "object" && e.error !== null) {
|
|
39
|
+
if (E.has(e.error)) return;
|
|
40
|
+
E.add(e.error);
|
|
41
|
+
}
|
|
42
|
+
if (!(Date.now() < r.pausedUntil || q(r, e.message, e.stack))) {
|
|
43
|
+
u = !0;
|
|
44
|
+
try {
|
|
45
|
+
const n = p(e.message, _), t = `${e.level}|${n}|${e.stack?.split(`
|
|
46
|
+
`, 2).join("|") ?? ""}`, o = r.queue.get(t);
|
|
47
|
+
if (o) {
|
|
48
|
+
o.count += 1;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (r.sent + r.queue.size >= r.maxEvents) {
|
|
52
|
+
r.capReached || (r.capReached = !0, y("warn", [`[memobit] Error reporting stopped for this session after ${r.maxEvents} events.`]));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
r.queue.set(t, {
|
|
56
|
+
level: e.level,
|
|
57
|
+
message: n,
|
|
58
|
+
stack: e.stack,
|
|
59
|
+
url: N(),
|
|
60
|
+
context: O(e.context),
|
|
61
|
+
count: 1
|
|
62
|
+
}), r.queue.size >= A ? c() : g(r);
|
|
63
|
+
} finally {
|
|
64
|
+
u = !1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, x = (e, r) => {
|
|
69
|
+
i({
|
|
70
|
+
level: "error",
|
|
71
|
+
message: s(e),
|
|
72
|
+
stack: e instanceof Error ? e.stack : void 0,
|
|
73
|
+
context: r,
|
|
74
|
+
error: e
|
|
75
|
+
});
|
|
76
|
+
}, c = async () => {
|
|
77
|
+
const e = l;
|
|
78
|
+
if (!e) return;
|
|
79
|
+
e.timer !== null && (clearTimeout(e.timer), e.timer = null);
|
|
80
|
+
const r = [...e.queue.entries()].slice(0, U);
|
|
81
|
+
if (r.length === 0) return;
|
|
82
|
+
r.forEach(([t]) => e.queue.delete(t)), e.sent += r.length;
|
|
83
|
+
const n = JSON.stringify({
|
|
84
|
+
app: e.appId,
|
|
85
|
+
source: e.source,
|
|
86
|
+
environment: e.environment,
|
|
87
|
+
release: e.release,
|
|
88
|
+
events: r.map(([, t]) => t)
|
|
89
|
+
});
|
|
90
|
+
try {
|
|
91
|
+
const t = await (await fetch(e.endpoint, {
|
|
92
|
+
method: "POST",
|
|
93
|
+
headers: { "Content-Type": "text/plain;charset=UTF-8" },
|
|
94
|
+
body: n,
|
|
95
|
+
credentials: "omit",
|
|
96
|
+
keepalive: n.length < 6e4
|
|
97
|
+
})).json().catch(() => null);
|
|
98
|
+
$(t) && t.enabled === !1 && h(e, t.retryAfter ?? m);
|
|
99
|
+
} catch {
|
|
100
|
+
h(e, m);
|
|
101
|
+
}
|
|
102
|
+
e.queue.size > 0 && g(e);
|
|
103
|
+
}, w = (e, r) => l || e.enabled === !1 || !e.appId || !e.endpoint ? !1 : (l = {
|
|
104
|
+
appId: e.appId,
|
|
105
|
+
endpoint: e.endpoint,
|
|
106
|
+
source: r,
|
|
107
|
+
environment: e.environment ?? "production",
|
|
108
|
+
release: e.release,
|
|
109
|
+
ignore: [...T, ...e.ignore ?? []],
|
|
110
|
+
maxEvents: e.maxEventsPerSession ?? 200,
|
|
111
|
+
queue: /* @__PURE__ */ new Map(),
|
|
112
|
+
sent: 0,
|
|
113
|
+
pausedUntil: 0,
|
|
114
|
+
capReached: !1,
|
|
115
|
+
timer: null
|
|
116
|
+
}, !0), S = () => {
|
|
117
|
+
const e = console.error, r = console.warn;
|
|
118
|
+
d.error = e, d.warn = r;
|
|
119
|
+
const n = (t, o) => {
|
|
120
|
+
const a = o.find((k) => k instanceof Error);
|
|
121
|
+
i({
|
|
122
|
+
level: t,
|
|
123
|
+
message: C(o),
|
|
124
|
+
stack: a instanceof Error ? a.stack : void 0,
|
|
125
|
+
error: a
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
console.error = (...t) => {
|
|
129
|
+
e.apply(console, t), n("error", t);
|
|
130
|
+
}, console.warn = (...t) => {
|
|
131
|
+
r.apply(console, t), n("warning", t);
|
|
132
|
+
};
|
|
133
|
+
}, I = (e) => {
|
|
134
|
+
if (typeof window > "u" || !w(e, "client")) return;
|
|
135
|
+
window.addEventListener("error", (n) => {
|
|
136
|
+
const t = n.error;
|
|
137
|
+
i({
|
|
138
|
+
level: "error",
|
|
139
|
+
message: t instanceof Error ? s(t) : n.message || "Unknown error",
|
|
140
|
+
stack: t instanceof Error ? t.stack : `at ${n.filename}:${n.lineno}:${n.colno}`,
|
|
141
|
+
error: t
|
|
142
|
+
});
|
|
143
|
+
}), window.addEventListener("unhandledrejection", (n) => {
|
|
144
|
+
const t = n.reason;
|
|
145
|
+
i({
|
|
146
|
+
level: "error",
|
|
147
|
+
message: `Unhandled rejection: ${s(t)}`,
|
|
148
|
+
stack: t instanceof Error ? t.stack : void 0,
|
|
149
|
+
error: t
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
const r = () => {
|
|
153
|
+
c();
|
|
154
|
+
};
|
|
155
|
+
window.addEventListener("pagehide", r), document.addEventListener("visibilitychange", () => {
|
|
156
|
+
document.visibilityState === "hidden" && r();
|
|
157
|
+
}), e.captureConsole !== !1 && S();
|
|
158
|
+
}, L = (e, r) => {
|
|
159
|
+
w(r, "server") && (e.on("uncaughtException", (n) => {
|
|
160
|
+
if (i({
|
|
161
|
+
level: "error",
|
|
162
|
+
message: `Uncaught ${s(n)}`,
|
|
163
|
+
stack: n.stack,
|
|
164
|
+
error: n
|
|
165
|
+
}), e.listenerCount("uncaughtException") > 1) return;
|
|
166
|
+
y("error", [n]);
|
|
167
|
+
const t = new Promise((o) => setTimeout(o, R));
|
|
168
|
+
Promise.race([c(), t]).finally(() => e.exit(1));
|
|
169
|
+
}), r.captureConsole !== !1 && S());
|
|
170
|
+
};
|
|
171
|
+
export {
|
|
172
|
+
i as captureEvent,
|
|
173
|
+
s as describeValue,
|
|
174
|
+
c as flushErrorReports,
|
|
175
|
+
I as installErrorReporting,
|
|
176
|
+
L as installNodeErrorReporting,
|
|
177
|
+
x as reportError,
|
|
178
|
+
y as writeNativeConsole
|
|
179
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { captureEvent as e, describeValue as d, writeNativeConsole as n } from "./ErrorReporting.js";
|
|
2
|
+
var v = (o, i, r) => {
|
|
3
|
+
const a = [o];
|
|
4
|
+
return r !== void 0 && a.push(r), i !== void 0 && a.push(i), a;
|
|
5
|
+
}, t = {
|
|
6
|
+
debug: (o, i) => {
|
|
7
|
+
n("debug", v(o, i));
|
|
8
|
+
},
|
|
9
|
+
info: (o, i) => {
|
|
10
|
+
n("info", v(o, i));
|
|
11
|
+
},
|
|
12
|
+
warn: (o, i) => {
|
|
13
|
+
n("warn", v(o, i)), e({
|
|
14
|
+
level: "warning",
|
|
15
|
+
message: o,
|
|
16
|
+
context: i
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
error: (o, i, r) => {
|
|
20
|
+
n("error", v(o, r, i)), e({
|
|
21
|
+
level: "error",
|
|
22
|
+
message: i === void 0 ? o : `${o}: ${d(i)}`,
|
|
23
|
+
stack: i instanceof Error ? i.stack : void 0,
|
|
24
|
+
context: r,
|
|
25
|
+
error: i
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
t as logger
|
|
31
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1481,8 +1481,8 @@ export declare interface ErrorBoundaryProps {
|
|
|
1481
1481
|
/** Label for the reset button. Defaults to "Try again". */
|
|
1482
1482
|
resetLabel?: string;
|
|
1483
1483
|
/**
|
|
1484
|
-
* Optional callback invoked when an error is caught.
|
|
1485
|
-
*
|
|
1484
|
+
* Optional callback invoked when an error is caught. Caught errors are already
|
|
1485
|
+
* reported to the hub once error reporting is installed, and always logged to the console.
|
|
1486
1486
|
*/
|
|
1487
1487
|
onError?: (error: Error, info: ErrorInfo) => void;
|
|
1488
1488
|
/**
|
|
@@ -3242,7 +3242,7 @@ export declare interface TimelineMarkerInfo {
|
|
|
3242
3242
|
dateLabel: string;
|
|
3243
3243
|
}
|
|
3244
3244
|
|
|
3245
|
-
export declare const TimelineMarkers: <T extends TimelineMarkersItem>({ items, renderItem, className
|
|
3245
|
+
export declare const TimelineMarkers: <T extends TimelineMarkersItem>({ items, renderItem, className }: TimelineMarkersProps<T>) => JSX.Element;
|
|
3246
3246
|
|
|
3247
3247
|
export declare interface TimelineMarkersItem {
|
|
3248
3248
|
id: string | number;
|
package/dist/memobit-icons.json
CHANGED
|
@@ -5,54 +5,14 @@
|
|
|
5
5
|
"arrow-left",
|
|
6
6
|
"arrow-right",
|
|
7
7
|
"arrow-up",
|
|
8
|
-
"bullet",
|
|
9
|
-
"burst",
|
|
10
|
-
"calendar",
|
|
11
8
|
"calendar-month",
|
|
12
9
|
"calendar-week",
|
|
13
10
|
"caret-down",
|
|
14
11
|
"caret-left",
|
|
15
12
|
"caret-right",
|
|
16
13
|
"caret-up",
|
|
17
|
-
"checkmark",
|
|
18
|
-
"clear",
|
|
19
|
-
"clipboard",
|
|
20
|
-
"comment",
|
|
21
|
-
"confetti",
|
|
22
14
|
"credit-card",
|
|
23
|
-
"empty",
|
|
24
|
-
"file",
|
|
25
|
-
"filters",
|
|
26
|
-
"fireworks",
|
|
27
|
-
"folder",
|
|
28
|
-
"food",
|
|
29
|
-
"gallery",
|
|
30
|
-
"grid",
|
|
31
|
-
"key",
|
|
32
|
-
"link",
|
|
33
|
-
"lock",
|
|
34
|
-
"logout",
|
|
35
|
-
"map",
|
|
36
15
|
"menu-hamburger",
|
|
37
|
-
"
|
|
38
|
-
"other",
|
|
39
|
-
"ownership",
|
|
40
|
-
"pin",
|
|
41
|
-
"plus",
|
|
42
|
-
"previous",
|
|
43
|
-
"radio",
|
|
44
|
-
"return",
|
|
45
|
-
"save",
|
|
46
|
-
"scss",
|
|
47
|
-
"search",
|
|
48
|
-
"sparkle",
|
|
49
|
-
"star",
|
|
50
|
-
"table",
|
|
51
|
-
"target",
|
|
52
|
-
"theme-picker",
|
|
53
|
-
"time",
|
|
54
|
-
"tree",
|
|
55
|
-
"tune",
|
|
56
|
-
"warning"
|
|
16
|
+
"theme-picker"
|
|
57
17
|
]
|
|
58
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
mark {
|
|
2
|
-
background-color: var(--button-warning-background-color);
|
|
3
|
-
color: var(--button-warning-color);
|
|
4
|
-
padding: var(--spacing-1) var(--spacing-4);
|
|
5
|
-
border-radius: var(--radius-sm);
|
|
6
|
-
}
|
|
1
|
+
mark {
|
|
2
|
+
background-color: var(--button-warning-background-color);
|
|
3
|
+
color: var(--button-warning-color);
|
|
4
|
+
padding: var(--spacing-1) var(--spacing-4);
|
|
5
|
+
border-radius: var(--radius-sm);
|
|
6
|
+
}
|
package/dist/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var I = "3.
|
|
1
|
+
var I = "3.10.0", B = 501, L = "a4994d2", _ = "2026-10-14T19:49:58.413Z", a = "501";
|
|
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.10.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",
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
"types": "./dist/http.d.ts",
|
|
49
49
|
"import": "./dist/http.js"
|
|
50
50
|
},
|
|
51
|
+
"./errors": {
|
|
52
|
+
"types": "./dist/errors.d.ts",
|
|
53
|
+
"import": "./dist/errors.js"
|
|
54
|
+
},
|
|
51
55
|
"./router": {
|
|
52
56
|
"types": "./dist/router.d.ts",
|
|
53
57
|
"import": "./dist/router.js"
|
|
@@ -74,10 +78,10 @@
|
|
|
74
78
|
"prepublishOnly": "vite build",
|
|
75
79
|
"dev": "vite build --watch",
|
|
76
80
|
"playground": "vite serve playground --config playground/vite.config.ts",
|
|
77
|
-
"lint": "eslint
|
|
78
|
-
"lint:fix": "eslint
|
|
79
|
-
"format": "prettier --write \"
|
|
80
|
-
"format:check": "prettier --check \"
|
|
81
|
+
"lint": "eslint .",
|
|
82
|
+
"lint:fix": "eslint . --fix",
|
|
83
|
+
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,mjs,cjs,css,scss}\"",
|
|
84
|
+
"format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,mjs,cjs,css,scss}\""
|
|
81
85
|
},
|
|
82
86
|
"peerDependencies": {
|
|
83
87
|
"@memobit/icons": "^1.5.0",
|
|
@@ -102,9 +106,11 @@
|
|
|
102
106
|
"esbuild": "0.28.2",
|
|
103
107
|
"eslint": "9.39.4",
|
|
104
108
|
"eslint-config-prettier": "10.1.8",
|
|
105
|
-
"eslint-plugin-import
|
|
109
|
+
"eslint-plugin-import": "2.32.0",
|
|
106
110
|
"eslint-plugin-prettier": "5.5.6",
|
|
107
111
|
"eslint-plugin-react": "7.37.5",
|
|
112
|
+
"eslint-plugin-react-hooks": "7.1.1",
|
|
113
|
+
"eslint-plugin-react-refresh": "0.5.7",
|
|
108
114
|
"eslint-plugin-simple-import-sort": "14.0.0",
|
|
109
115
|
"globals": "17.12.0",
|
|
110
116
|
"prettier": "3.9.9",
|