@vielzeug/toolkit 1.0.11 → 1.0.12
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/function/retry.js
CHANGED
|
@@ -2,11 +2,11 @@ import { Logit as o } from "../logit/dist/logit.js";
|
|
|
2
2
|
import { sleep as w } from "./sleep.js";
|
|
3
3
|
async function l(n, {
|
|
4
4
|
times: e = 3,
|
|
5
|
-
delay:
|
|
6
|
-
backoff:
|
|
5
|
+
delay: y = 250,
|
|
6
|
+
backoff: i = 1,
|
|
7
7
|
signal: f
|
|
8
8
|
} = {}) {
|
|
9
|
-
let t =
|
|
9
|
+
let t = y;
|
|
10
10
|
for (let r = 1; r <= e; r++) {
|
|
11
11
|
if (f?.aborted)
|
|
12
12
|
throw o.warn(`retry() -> Aborted after ${r - 1} attempts`), new Error("Retry aborted");
|
|
@@ -14,7 +14,7 @@ async function l(n, {
|
|
|
14
14
|
return await n();
|
|
15
15
|
} catch (a) {
|
|
16
16
|
if (r === e) throw a;
|
|
17
|
-
o.warn(`retry() -> ${a}, attempt ${r}/${e}, retrying in ${t}ms`), t > 0 && await w(t), t *=
|
|
17
|
+
o.warn(`retry() -> ${a}, attempt ${r}/${e}, retrying in ${t}ms`), t > 0 && await w(t), t *= i;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
throw new Error("Retry failed unexpectedly");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w={}
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w={},v={debug:"log",success:"log"},y=()=>typeof window<"u"&&w?.NODE_ENV?!1:typeof process<"u"&&process.env?.NODE_ENV?process.env.NODE_ENV==="production":!1,x=y(),L=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,b={debug:{bg:"#616161",border:"#424242",color:"#fff",icon:"☕",symbol:"🅳"},error:{bg:"#d32f2f",border:"#c62828",color:"#fff",icon:"✘",symbol:"🅴"},group:{bg:"#546e7a",border:"#455a64",color:"#fff",icon:"⚭",symbol:"🅶"},info:{bg:"#1976d2",border:"#1565c0",color:"#fff",icon:"ℹ",symbol:"🅸"},ns:L?{bg:"#fafafa",border:"#c7c7c7",color:"#000"}:{bg:"#424242",border:"#212121",color:"#fff"},success:{bg:"#689f38",border:"#558b2f",color:"#fff",icon:"✔",symbol:"🆂"},time:{bg:"#0097a7",border:"#00838f",color:"#fff",icon:"⏲",symbol:"🆃"},trace:{bg:"#d81b60",border:"#c2185b",color:"#fff",icon:"⛢",symbol:"🆃"},warn:{bg:"#ffb300",border:"#ffa000",color:"#fff",icon:"⚠",symbol:"🆆"}},l={debug:0,trace:1,time:2,table:3,info:4,success:5,warn:6,error:7,off:8},r={environment:!0,logLevel:"debug",namespace:"",remote:{handler:void 0,logLevel:"off"},timestamp:!0,variant:"symbol"},i=e=>l[r.logLevel]<=l[e],u=()=>new Date().toISOString().slice(11,23),g=()=>x?"🄿":"🄳",E=(e,o)=>{r.remote.handler&&l[r.remote.logLevel]<=l[e]&&r.remote.handler(e,...o)},m=e=>v[e]||e,d="border: 1px solid",p="border-radius: 4px",$="border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter",f=(e,o="")=>{const{bg:t,color:c,border:n}=b[e],s=`color: ${t}; ${d} ${n}; ${p}`;switch(r.variant){case"symbol":return`${s}; padding: 1px 1px 0${o}`;case"icon":return`${s}; padding: 0 3px${o}`;default:return`background: ${t}; color: ${c}; ${d} ${n}; ${p}; font-weight: bold; padding: 0 3px${o}`}},h=e=>{const o=b[e],{variant:t}=r;return t==="text"||!o[t]?e.toUpperCase():o[t]};function O(e){const{namespace:o,timestamp:t,environment:c}=r;let n=`%c${h(e)}%c`;const s=[f(e),""];return o&&(n+=` %c${o}%c`,s.push(f("ns",`; ${$}`),"")),c&&(n+=` %c${g()}%c`,s.push("color: darkgray","")),t&&(n+=` %c${u()}%c`,s.push("color: gray","")),{format:n,parts:s}}const a=(e,...o)=>{if(typeof window>"u"){const s=console[m(e)];s(`${h(e)} | ${g()} |`,...o);return}if(!i(e))return;const{format:t,parts:c}=O(e),n=console[m(e)];n(t,...c,...o),E(e,o)},D=e=>{const o=Math.floor(Date.now()-e);return o?`${o}ms`:""},N={assert:(e,o,t)=>console.assert(e,o,t),debug:(...e)=>a("debug",...e),error:(...e)=>a("error",...e),getLevel:()=>r.logLevel,getPrefix:()=>r.namespace,getTimestamp:()=>r.timestamp,groupCollapsed:(e,o="GROUP",t=Date.now())=>{if(!i("success"))return;const c=D(t),n=g(),s=r.timestamp?u():"";console.groupCollapsed(`%c${o}%c${r.namespace}%c${n}%c${s}%c${c}%c${e}`,f("group","; margin-right: 6px; padding: 1px 3px 0"),f("ns",`; ${$}; margin-right: 6px`),"color: darkgray; margin-right: 6px","color: gray; font-weight: lighter; margin-right: 6px","color: gray; font-weight: lighter; margin-right: 6px","color: inherit; font-weight: lighter")},groupEnd:()=>{i("success")&&console.groupEnd()},info:(...e)=>a("info",...e),initialise:e=>{Object.assign(r,e)},setLogLevel:e=>{r.logLevel=e},setPrefix:e=>{r.namespace=e},setRemote:e=>{r.remote=e},setRemoteLogLevel:e=>{r.remote.logLevel=e},setVariant:e=>{r.variant=e},showEnvironment:e=>{r.environment=e},showTimestamp:e=>{r.timestamp=e},success:(...e)=>a("success",...e),table:(...e)=>{i("table")&&console.table(...e)},time:e=>{i("time")&&console.time(e)},timeEnd:e=>{i("time")&&console.timeEnd(e)},trace:(...e)=>a("trace",...e),warn:(...e)=>a("warn",...e)};exports.Logit=N;
|
|
2
2
|
//# sourceMappingURL=logit.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logit.cjs","sources":["../../../../logit/dist/logit.js"],"sourcesContent":["const
|
|
1
|
+
{"version":3,"file":"logit.cjs","sources":["../../../../logit/dist/logit.js"],"sourcesContent":["const $ = {};\nconst v = {\n debug: \"log\",\n success: \"log\"\n}, w = () => typeof window < \"u\" && $?.NODE_ENV ? !1 : typeof process < \"u\" && process.env?.NODE_ENV ? process.env.NODE_ENV === \"production\" : !1, _ = w(), L = typeof window < \"u\" && window.matchMedia?.(\"(prefers-color-scheme: dark)\").matches, b = {\n debug: { bg: \"#616161\", border: \"#424242\", color: \"#fff\", icon: \"☕\", symbol: \"🅳\" },\n error: { bg: \"#d32f2f\", border: \"#c62828\", color: \"#fff\", icon: \"✘\", symbol: \"🅴\" },\n group: { bg: \"#546e7a\", border: \"#455a64\", color: \"#fff\", icon: \"⚭\", symbol: \"🅶\" },\n info: { bg: \"#1976d2\", border: \"#1565c0\", color: \"#fff\", icon: \"ℹ\", symbol: \"🅸\" },\n ns: L ? { bg: \"#fafafa\", border: \"#c7c7c7\", color: \"#000\" } : { bg: \"#424242\", border: \"#212121\", color: \"#fff\" },\n success: { bg: \"#689f38\", border: \"#558b2f\", color: \"#fff\", icon: \"✔\", symbol: \"🆂\" },\n time: { bg: \"#0097a7\", border: \"#00838f\", color: \"#fff\", icon: \"⏲\", symbol: \"🆃\" },\n trace: { bg: \"#d81b60\", border: \"#c2185b\", color: \"#fff\", icon: \"⛢\", symbol: \"🆃\" },\n warn: { bg: \"#ffb300\", border: \"#ffa000\", color: \"#fff\", icon: \"⚠\", symbol: \"🆆\" }\n}, l = {\n debug: 0,\n trace: 1,\n time: 2,\n table: 3,\n info: 4,\n success: 5,\n warn: 6,\n error: 7,\n off: 8\n}, r = {\n environment: !0,\n logLevel: \"debug\",\n namespace: \"\",\n remote: { handler: void 0, logLevel: \"off\" },\n timestamp: !0,\n variant: \"symbol\"\n}, a = (e) => l[r.logLevel] <= l[e], u = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 23), d = () => _ ? \"🄿\" : \"🄳\", x = (e, o) => {\n r.remote.handler && l[r.remote.logLevel] <= l[e] && r.remote.handler(e, ...o);\n}, g = (e) => v[e] || e, m = \"border: 1px solid\", p = \"border-radius: 4px\", h = \"border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter\", f = (e, o = \"\") => {\n const { bg: t, color: c, border: n } = b[e], s = `color: ${t}; ${m} ${n}; ${p}`;\n switch (r.variant) {\n case \"symbol\":\n return `${s}; padding: 1px 1px 0${o}`;\n case \"icon\":\n return `${s}; padding: 0 3px${o}`;\n default:\n return `background: ${t}; color: ${c}; ${m} ${n}; ${p}; font-weight: bold; padding: 0 3px${o}`;\n }\n}, E = (e) => {\n const o = b[e], { variant: t } = r;\n return t === \"text\" || !o[t] ? e.toUpperCase() : o[t];\n};\nfunction D(e) {\n const { namespace: o, timestamp: t, environment: c } = r;\n let n = `%c${E(e)}%c`;\n const s = [f(e), \"\"];\n return o && (n += ` %c${o}%c`, s.push(f(\"ns\", `; ${h}`), \"\")), c && (n += ` %c${d()}%c`, s.push(\"color: darkgray\", \"\")), t && (n += ` %c${u()}%c`, s.push(\"color: gray\", \"\")), { format: n, parts: s };\n}\nconst i = (e, ...o) => {\n if (typeof window > \"u\") {\n const s = console[g(e)];\n s(`${E(e)} | ${d()} |`, ...o);\n return;\n }\n if (!a(e)) return;\n const { format: t, parts: c } = D(e), n = console[g(e)];\n n(t, ...c, ...o), x(e, o);\n}, O = (e) => {\n const o = Math.floor(Date.now() - e);\n return o ? `${o}ms` : \"\";\n}, y = {\n /**\n * Asserts a condition and logs an error if it's false.\n */\n assert: (e, o, t) => console.assert(e, o, t),\n debug: (...e) => i(\"debug\", ...e),\n error: (...e) => i(\"error\", ...e),\n /**\n * Gets the current log level.\n */\n getLevel: () => r.logLevel,\n /**\n * Gets the current namespace prefix.\n */\n getPrefix: () => r.namespace,\n /**\n * Gets whether timestamps are shown.\n */\n getTimestamp: () => r.timestamp,\n /**\n * Creates a collapsed group in the console.\n */\n groupCollapsed: (e, o = \"GROUP\", t = Date.now()) => {\n if (!a(\"success\")) return;\n const c = O(t), n = d(), s = r.timestamp ? u() : \"\";\n console.groupCollapsed(\n `%c${o}%c${r.namespace}%c${n}%c${s}%c${c}%c${e}`,\n f(\"group\", \"; margin-right: 6px; padding: 1px 3px 0\"),\n f(\"ns\", `; ${h}; margin-right: 6px`),\n \"color: darkgray; margin-right: 6px\",\n \"color: gray; font-weight: lighter; margin-right: 6px\",\n \"color: gray; font-weight: lighter; margin-right: 6px\",\n \"color: inherit; font-weight: lighter\"\n );\n },\n /**\n * Ends the current console group.\n */\n groupEnd: () => {\n a(\"success\") && console.groupEnd();\n },\n info: (...e) => i(\"info\", ...e),\n /**\n * Initializes Logit with custom options.\n */\n initialise: (e) => {\n Object.assign(r, e);\n },\n /**\n * Sets the minimum log level to display.\n */\n setLogLevel: (e) => {\n r.logLevel = e;\n },\n /**\n * Sets the namespace prefix for all logs.\n */\n setPrefix: (e) => {\n r.namespace = e;\n },\n /**\n * Configures remote logging options.\n */\n setRemote: (e) => {\n r.remote = e;\n },\n /**\n * Sets the log level for remote logging.\n */\n setRemoteLogLevel: (e) => {\n r.remote.logLevel = e;\n },\n /**\n * Sets the display variant (text, icon, or symbol).\n */\n setVariant: (e) => {\n r.variant = e;\n },\n /**\n * Shows or hides the environment indicator.\n */\n showEnvironment: (e) => {\n r.environment = e;\n },\n /**\n * Shows or hides timestamps in logs.\n */\n showTimestamp: (e) => {\n r.timestamp = e;\n },\n success: (...e) => i(\"success\", ...e),\n /**\n * Displays data in a table format.\n */\n table: (...e) => {\n a(\"table\") && console.table(...e);\n },\n /**\n * Starts a timer with the given label.\n */\n time: (e) => {\n a(\"time\") && console.time(e);\n },\n /**\n * Ends a timer with the given label.\n */\n timeEnd: (e) => {\n a(\"time\") && console.timeEnd(e);\n },\n trace: (...e) => i(\"trace\", ...e),\n warn: (...e) => i(\"warn\", ...e)\n};\nexport {\n y as Logit\n};\n//# sourceMappingURL=logit.js.map\n"],"names":["$","w","_","a","d","x","g","m","h","E","D","i","O","y"],"mappings":"gFAAA,MAAMA,EAAI,CAAA,EACJ,EAAI,CACR,MAAO,MACP,QAAS,KACX,EAAGC,EAAI,IAAM,OAAO,OAAS,KAAOD,GAAG,SAAW,G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EAIA,SAAU,IAAM,CACdL,EAAE,SAAS,GAAK,QAAQ,SAAQ,CAClC,EACA,KAAM,IAAI,IAAMQ,EAAE,OAAQ,GAAG,CAAC,EAI9B,WAAa,GAAM,CACjB,OAAO,OAAO,EAAG,CAAC,CACpB,EAIA,YAAc,GAAM,CAClB,EAAE,SAAW,CACf,EAIA,UAAY,GAAM,CAChB,EAAE,UAAY,CAChB,EAIA,UAAY,GAAM,CAChB,EAAE,OAAS,CACb,EAIA,kBAAoB,GAAM,CACxB,EAAE,OAAO,SAAW,CACtB,EAIA,WAAa,GAAM,CACjB,EAAE,QAAU,CACd,EAIA,gBAAkB,GAAM,CACtB,EAAE,YAAc,CAClB,EAIA,cAAgB,GAAM,CACpB,EAAE,UAAY,CAChB,EACA,QAAS,IAAI,IAAMA,EAAE,UAAW,GAAG,CAAC,EAIpC,MAAO,IAAI,IAAM,CACfR,EAAE,OAAO,GAAK,QAAQ,MAAM,GAAG,CAAC,CAClC,EAIA,KAAO,GAAM,CACXA,EAAE,MAAM,GAAK,QAAQ,KAAK,CAAC,CAC7B,EAIA,QAAU,GAAM,CACdA,EAAE,MAAM,GAAK,QAAQ,QAAQ,CAAC,CAChC,EACA,MAAO,IAAI,IAAMQ,EAAE,QAAS,GAAG,CAAC,EAChC,KAAM,IAAI,IAAMA,EAAE,OAAQ,GAAG,CAAC,CAChC"}
|
package/dist/logit/dist/logit.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const
|
|
1
|
+
const w = {}, v = {
|
|
2
2
|
debug: "log",
|
|
3
3
|
success: "log"
|
|
4
|
-
},
|
|
4
|
+
}, x = () => typeof window < "u" && w?.NODE_ENV ? !1 : typeof process < "u" && process.env?.NODE_ENV ? process.env.NODE_ENV === "production" : !1, y = x(), L = typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)").matches, b = {
|
|
5
5
|
debug: { bg: "#616161", border: "#424242", color: "#fff", icon: "☕", symbol: "🅳" },
|
|
6
6
|
error: { bg: "#d32f2f", border: "#c62828", color: "#fff", icon: "✘", symbol: "🅴" },
|
|
7
7
|
group: { bg: "#546e7a", border: "#455a64", color: "#fff", icon: "⚭", symbol: "🅶" },
|
|
8
8
|
info: { bg: "#1976d2", border: "#1565c0", color: "#fff", icon: "ℹ", symbol: "🅸" },
|
|
9
|
-
ns:
|
|
9
|
+
ns: L ? { bg: "#fafafa", border: "#c7c7c7", color: "#000" } : { bg: "#424242", border: "#212121", color: "#fff" },
|
|
10
10
|
success: { bg: "#689f38", border: "#558b2f", color: "#fff", icon: "✔", symbol: "🆂" },
|
|
11
11
|
time: { bg: "#0097a7", border: "#00838f", color: "#fff", icon: "⏲", symbol: "🆃" },
|
|
12
12
|
trace: { bg: "#d81b60", border: "#c2185b", color: "#fff", icon: "⛢", symbol: "🆃" },
|
|
13
13
|
warn: { bg: "#ffb300", border: "#ffa000", color: "#fff", icon: "⚠", symbol: "🆆" }
|
|
14
|
-
},
|
|
14
|
+
}, l = {
|
|
15
15
|
debug: 0,
|
|
16
16
|
trace: 1,
|
|
17
17
|
time: 2,
|
|
@@ -21,158 +21,160 @@ const h = {}, w = {
|
|
|
21
21
|
warn: 6,
|
|
22
22
|
error: 7,
|
|
23
23
|
off: 8
|
|
24
|
-
},
|
|
24
|
+
}, r = {
|
|
25
25
|
environment: !0,
|
|
26
26
|
logLevel: "debug",
|
|
27
27
|
namespace: "",
|
|
28
28
|
remote: { handler: void 0, logLevel: "off" },
|
|
29
29
|
timestamp: !0,
|
|
30
30
|
variant: "symbol"
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
const { bg: t, color:
|
|
35
|
-
switch (
|
|
31
|
+
}, i = (e) => l[r.logLevel] <= l[e], u = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 23), g = () => y ? "🄿" : "🄳", E = (e, o) => {
|
|
32
|
+
r.remote.handler && l[r.remote.logLevel] <= l[e] && r.remote.handler(e, ...o);
|
|
33
|
+
}, m = (e) => v[e] || e, d = "border: 1px solid", p = "border-radius: 4px", $ = "border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter", f = (e, o = "") => {
|
|
34
|
+
const { bg: t, color: c, border: n } = b[e], s = `color: ${t}; ${d} ${n}; ${p}`;
|
|
35
|
+
switch (r.variant) {
|
|
36
36
|
case "symbol":
|
|
37
|
-
return `${
|
|
37
|
+
return `${s}; padding: 1px 1px 0${o}`;
|
|
38
38
|
case "icon":
|
|
39
|
-
return `${
|
|
39
|
+
return `${s}; padding: 0 3px${o}`;
|
|
40
40
|
default:
|
|
41
|
-
return `background: ${t}; color: ${
|
|
41
|
+
return `background: ${t}; color: ${c}; ${d} ${n}; ${p}; font-weight: bold; padding: 0 3px${o}`;
|
|
42
42
|
}
|
|
43
|
+
}, h = (e) => {
|
|
44
|
+
const o = b[e], { variant: t } = r;
|
|
45
|
+
return t === "text" || !o[t] ? e.toUpperCase() : o[t];
|
|
43
46
|
};
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
let
|
|
47
|
-
const
|
|
48
|
-
return
|
|
47
|
+
function D(e) {
|
|
48
|
+
const { namespace: o, timestamp: t, environment: c } = r;
|
|
49
|
+
let n = `%c${h(e)}%c`;
|
|
50
|
+
const s = [f(e), ""];
|
|
51
|
+
return o && (n += ` %c${o}%c`, s.push(f("ns", `; ${$}`), "")), c && (n += ` %c${g()}%c`, s.push("color: darkgray", "")), t && (n += ` %c${u()}%c`, s.push("color: gray", "")), { format: n, parts: s };
|
|
49
52
|
}
|
|
50
|
-
const
|
|
53
|
+
const a = (e, ...o) => {
|
|
51
54
|
if (typeof window > "u") {
|
|
52
|
-
const
|
|
53
|
-
|
|
55
|
+
const s = console[m(e)];
|
|
56
|
+
s(`${h(e)} | ${g()} |`, ...o);
|
|
54
57
|
return;
|
|
55
58
|
}
|
|
56
|
-
if (!
|
|
57
|
-
const { format: t, parts:
|
|
58
|
-
n(t, ...
|
|
59
|
-
},
|
|
60
|
-
const
|
|
61
|
-
return
|
|
62
|
-
},
|
|
59
|
+
if (!i(e)) return;
|
|
60
|
+
const { format: t, parts: c } = D(e), n = console[m(e)];
|
|
61
|
+
n(t, ...c, ...o), E(e, o);
|
|
62
|
+
}, O = (e) => {
|
|
63
|
+
const o = Math.floor(Date.now() - e);
|
|
64
|
+
return o ? `${o}ms` : "";
|
|
65
|
+
}, N = {
|
|
63
66
|
/**
|
|
64
67
|
* Asserts a condition and logs an error if it's false.
|
|
65
68
|
*/
|
|
66
|
-
assert: (e,
|
|
67
|
-
debug: (...e) =>
|
|
68
|
-
error: (...e) =>
|
|
69
|
+
assert: (e, o, t) => console.assert(e, o, t),
|
|
70
|
+
debug: (...e) => a("debug", ...e),
|
|
71
|
+
error: (...e) => a("error", ...e),
|
|
69
72
|
/**
|
|
70
73
|
* Gets the current log level.
|
|
71
74
|
*/
|
|
72
|
-
getLevel: () =>
|
|
75
|
+
getLevel: () => r.logLevel,
|
|
73
76
|
/**
|
|
74
77
|
* Gets the current namespace prefix.
|
|
75
78
|
*/
|
|
76
|
-
getPrefix: () =>
|
|
79
|
+
getPrefix: () => r.namespace,
|
|
77
80
|
/**
|
|
78
81
|
* Gets whether timestamps are shown.
|
|
79
82
|
*/
|
|
80
|
-
getTimestamp: () =>
|
|
83
|
+
getTimestamp: () => r.timestamp,
|
|
81
84
|
/**
|
|
82
85
|
* Creates a collapsed group in the console.
|
|
83
86
|
*/
|
|
84
|
-
groupCollapsed: (e,
|
|
85
|
-
if (!
|
|
86
|
-
const
|
|
87
|
+
groupCollapsed: (e, o = "GROUP", t = Date.now()) => {
|
|
88
|
+
if (!i("success")) return;
|
|
89
|
+
const c = O(t), n = g(), s = r.timestamp ? u() : "";
|
|
87
90
|
console.groupCollapsed(
|
|
88
|
-
`%c${
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"color: darkgray; margin-right: 6px
|
|
92
|
-
"color: gray;font-weight: lighter;margin-right: 6px
|
|
93
|
-
"color: gray; font-weight: lighter;margin-right: 6px
|
|
94
|
-
"color: inherit;font-weight: lighter
|
|
91
|
+
`%c${o}%c${r.namespace}%c${n}%c${s}%c${c}%c${e}`,
|
|
92
|
+
f("group", "; margin-right: 6px; padding: 1px 3px 0"),
|
|
93
|
+
f("ns", `; ${$}; margin-right: 6px`),
|
|
94
|
+
"color: darkgray; margin-right: 6px",
|
|
95
|
+
"color: gray; font-weight: lighter; margin-right: 6px",
|
|
96
|
+
"color: gray; font-weight: lighter; margin-right: 6px",
|
|
97
|
+
"color: inherit; font-weight: lighter"
|
|
95
98
|
);
|
|
96
99
|
},
|
|
97
100
|
/**
|
|
98
101
|
* Ends the current console group.
|
|
99
102
|
*/
|
|
100
103
|
groupEnd: () => {
|
|
101
|
-
|
|
104
|
+
i("success") && console.groupEnd();
|
|
102
105
|
},
|
|
103
|
-
info: (...e) =>
|
|
106
|
+
info: (...e) => a("info", ...e),
|
|
104
107
|
/**
|
|
105
108
|
* Initializes Logit with custom options.
|
|
106
109
|
*/
|
|
107
110
|
initialise: (e) => {
|
|
108
|
-
Object.assign(
|
|
111
|
+
Object.assign(r, e);
|
|
109
112
|
},
|
|
110
113
|
/**
|
|
111
114
|
* Sets the minimum log level to display.
|
|
112
115
|
*/
|
|
113
116
|
setLogLevel: (e) => {
|
|
114
|
-
|
|
117
|
+
r.logLevel = e;
|
|
115
118
|
},
|
|
116
119
|
/**
|
|
117
120
|
* Sets the namespace prefix for all logs.
|
|
118
121
|
*/
|
|
119
122
|
setPrefix: (e) => {
|
|
120
|
-
|
|
123
|
+
r.namespace = e;
|
|
121
124
|
},
|
|
122
125
|
/**
|
|
123
126
|
* Configures remote logging options.
|
|
124
127
|
*/
|
|
125
128
|
setRemote: (e) => {
|
|
126
|
-
|
|
129
|
+
r.remote = e;
|
|
127
130
|
},
|
|
128
131
|
/**
|
|
129
132
|
* Sets the log level for remote logging.
|
|
130
133
|
*/
|
|
131
134
|
setRemoteLogLevel: (e) => {
|
|
132
|
-
|
|
135
|
+
r.remote.logLevel = e;
|
|
133
136
|
},
|
|
134
137
|
/**
|
|
135
138
|
* Sets the display variant (text, icon, or symbol).
|
|
136
139
|
*/
|
|
137
140
|
setVariant: (e) => {
|
|
138
|
-
|
|
141
|
+
r.variant = e;
|
|
139
142
|
},
|
|
140
143
|
/**
|
|
141
144
|
* Shows or hides the environment indicator.
|
|
142
145
|
*/
|
|
143
146
|
showEnvironment: (e) => {
|
|
144
|
-
|
|
147
|
+
r.environment = e;
|
|
145
148
|
},
|
|
146
149
|
/**
|
|
147
150
|
* Shows or hides timestamps in logs.
|
|
148
151
|
*/
|
|
149
152
|
showTimestamp: (e) => {
|
|
150
|
-
|
|
153
|
+
r.timestamp = e;
|
|
151
154
|
},
|
|
152
|
-
success: (...e) =>
|
|
155
|
+
success: (...e) => a("success", ...e),
|
|
153
156
|
/**
|
|
154
157
|
* Displays data in a table format.
|
|
155
158
|
*/
|
|
156
159
|
table: (...e) => {
|
|
157
|
-
|
|
160
|
+
i("table") && console.table(...e);
|
|
158
161
|
},
|
|
159
162
|
/**
|
|
160
163
|
* Starts a timer with the given label.
|
|
161
164
|
*/
|
|
162
165
|
time: (e) => {
|
|
163
|
-
|
|
166
|
+
i("time") && console.time(e);
|
|
164
167
|
},
|
|
165
168
|
/**
|
|
166
169
|
* Ends a timer with the given label.
|
|
167
170
|
*/
|
|
168
171
|
timeEnd: (e) => {
|
|
169
|
-
|
|
172
|
+
i("time") && console.timeEnd(e);
|
|
170
173
|
},
|
|
171
|
-
trace: (...e) =>
|
|
172
|
-
warn: (...e) =>
|
|
174
|
+
trace: (...e) => a("trace", ...e),
|
|
175
|
+
warn: (...e) => a("warn", ...e)
|
|
173
176
|
};
|
|
174
|
-
typeof window < "u" && (window.Logit = E);
|
|
175
177
|
export {
|
|
176
|
-
|
|
178
|
+
N as Logit
|
|
177
179
|
};
|
|
178
180
|
//# sourceMappingURL=logit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logit.js","sources":["../../../../logit/dist/logit.js"],"sourcesContent":["const h = {};\nconst w = {\n debug: \"log\",\n success: \"log\"\n}, v = () => h?.NODE_ENV === \"production\", $ = typeof window < \"u\" && window.matchMedia?.(\"(prefers-color-scheme: dark)\").matches, m = {\n debug: { bg: \"#616161\", border: \"#424242\", color: \"#fff\", icon: \"☕\", symbol: \"🅳\" },\n error: { bg: \"#d32f2f\", border: \"#c62828\", color: \"#fff\", icon: \"✘\", symbol: \"🅴\" },\n group: { bg: \"#546e7a\", border: \"#455a64\", color: \"#fff\", icon: \"⚭\", symbol: \"🅶\" },\n info: { bg: \"#1976d2\", border: \"#1565c0\", color: \"#fff\", icon: \"ℹ\", symbol: \"🅸\" },\n ns: $ ? { bg: \"#fafafa\", border: \"#c7c7c7\", color: \"#000\" } : { bg: \"#424242\", border: \"#212121\", color: \"#fff\" },\n success: { bg: \"#689f38\", border: \"#558b2f\", color: \"#fff\", icon: \"✔\", symbol: \"🆂\" },\n time: { bg: \"#0097a7\", border: \"#00838f\", color: \"#fff\", icon: \"⏲\", symbol: \"🆃\" },\n trace: { bg: \"#d81b60\", border: \"#c2185b\", color: \"#fff\", icon: \"⛢\", symbol: \"🆃\" },\n warn: { bg: \"#ffb300\", border: \"#ffa000\", color: \"#fff\", icon: \"⚠\", symbol: \"🆆\" }\n}, f = {\n debug: 0,\n trace: 1,\n time: 2,\n table: 3,\n info: 4,\n success: 5,\n warn: 6,\n error: 7,\n off: 8\n}, e = {\n environment: !0,\n logLevel: \"debug\",\n namespace: \"\",\n remote: { handler: void 0, logLevel: \"off\" },\n timestamp: !0,\n variant: \"symbol\"\n}, d = (o) => f[e.logLevel] <= f[o], u = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 23), b = () => v() ? \"🄿\" : \"🄳\", x = (o, r) => {\n e.remote.handler && f[e.remote.logLevel] <= f[o] && e.remote.handler(o, ...r);\n}, p = (o) => w[o] || o, g = (o, r = \"\") => {\n const { bg: t, color: s, border: n } = m[o], c = `color: ${t}; border: 1px solid ${n}; border-radius: 4px;`;\n switch (e.variant) {\n case \"symbol\":\n return `${c} padding: 1px 1px 0;${r};`;\n case \"icon\":\n return `${c} padding: 0 3px;${r};`;\n default:\n return `background: ${t}; color: ${s}; border: 1px solid ${n}; border-radius: 4px; font-weight: bold; padding: 0 3px;${r}`;\n }\n};\nfunction L(o) {\n const r = m[o], { namespace: t, variant: s, timestamp: n, environment: c } = e;\n let i = `%c${r[s] ?? o.toUpperCase()}%c`;\n const a = [g(o), \"\"];\n return t && (i += ` %c${t}%c`, a.push(g(\"ns\", \" border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter;\"), \"\")), c && (i += ` %c${b()}%c`, a.push(\"color: darkgray;\", \"\")), n && (i += ` %c${u()}%c`, a.push(\"color: gray;\", \"\")), { format: i, parts: a };\n}\nconst l = (o, ...r) => {\n if (typeof window > \"u\") {\n const c = m[o], { variant: i } = e, a = console[p(o)];\n a(`${c[i] ?? o.toUpperCase()} | ${b()} |`, ...r);\n return;\n }\n if (!d(o)) return;\n const { format: t, parts: s } = L(o), n = console[p(o)];\n n(t, ...s, ...r), x(o, r);\n}, E = (o) => {\n const r = Math.floor(Date.now() - o);\n return r ? `${r}ms` : \"\";\n}, _ = {\n /**\n * Asserts a condition and logs an error if it's false.\n */\n assert: (o, r, t) => console.assert(o, r, t),\n debug: (...o) => l(\"debug\", ...o),\n error: (...o) => l(\"error\", ...o),\n /**\n * Gets the current log level.\n */\n getLevel: () => e.logLevel,\n /**\n * Gets the current namespace prefix.\n */\n getPrefix: () => e.namespace,\n /**\n * Gets whether timestamps are shown.\n */\n getTimestamp: () => e.timestamp,\n /**\n * Creates a collapsed group in the console.\n */\n groupCollapsed: (o, r = \"GROUP\", t = Date.now()) => {\n if (!d(\"success\")) return;\n const s = E(t), n = b();\n console.groupCollapsed(\n `%c${r}%c${e.namespace}%c${n}%c${e.timestamp ? u() : \"\"}%c${s}%c${o}`,\n g(\"group\", \"margin-right: 6px; padding: 1px 3px 0\"),\n g(\"ns\", \" border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter;margin-right: 6px;\"),\n \"color: darkgray; margin-right: 6px;\",\n \"color: gray;font-weight: lighter;margin-right: 6px;\",\n \"color: gray; font-weight: lighter;margin-right: 6px;\",\n \"color: inherit;font-weight: lighter;\"\n );\n },\n /**\n * Ends the current console group.\n */\n groupEnd: () => {\n d(\"success\") && console.groupEnd();\n },\n info: (...o) => l(\"info\", ...o),\n /**\n * Initializes Logit with custom options.\n */\n initialise: (o) => {\n Object.assign(e, o);\n },\n /**\n * Sets the minimum log level to display.\n */\n setLogLevel: (o) => {\n e.logLevel = o;\n },\n /**\n * Sets the namespace prefix for all logs.\n */\n setPrefix: (o) => {\n e.namespace = o;\n },\n /**\n * Configures remote logging options.\n */\n setRemote: (o) => {\n e.remote = o;\n },\n /**\n * Sets the log level for remote logging.\n */\n setRemoteLogLevel: (o) => {\n e.remote.logLevel = o;\n },\n /**\n * Sets the display variant (text, icon, or symbol).\n */\n setVariant: (o) => {\n e.variant = o;\n },\n /**\n * Shows or hides the environment indicator.\n */\n showEnvironment: (o) => {\n e.environment = o;\n },\n /**\n * Shows or hides timestamps in logs.\n */\n showTimestamp: (o) => {\n e.timestamp = o;\n },\n success: (...o) => l(\"success\", ...o),\n /**\n * Displays data in a table format.\n */\n table: (...o) => {\n d(\"table\") && console.table(...o);\n },\n /**\n * Starts a timer with the given label.\n */\n time: (o) => {\n d(\"time\") && console.time(o);\n },\n /**\n * Ends a timer with the given label.\n */\n timeEnd: (o) => {\n d(\"time\") && console.timeEnd(o);\n },\n trace: (...o) => l(\"trace\", ...o),\n warn: (...o) => l(\"warn\", ...o)\n};\ntypeof window < \"u\" && (window.Logit = _);\nexport {\n _ as Logit\n};\n//# sourceMappingURL=logit.js.map\n"],"names":["v","$","e","d","o","b","x","p","g","L","i","a","E","_"],"mappings":"AAAA,MAAM,IAAI,CAAA,GACJ,IAAI;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AACX,GAAGA,IAAI,MAAM,GAAG,aAAa,cAAcC,IAAI,OAAO,S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AA,EAIA,MAAM,CAACA,MAAM;AACX,IAAAD,EAAE,MAAM,KAAK,QAAQ,KAAKC,CAAC;AAAA,EAC7B;AAAA;AAAA;AAAA;AAAA,EAIA,SAAS,CAACA,MAAM;AACd,IAAAD,EAAE,MAAM,KAAK,QAAQ,QAAQC,CAAC;AAAA,EAChC;AAAA,EACA,OAAO,IAAIA,MAAM,EAAE,SAAS,GAAGA,CAAC;AAAA,EAChC,MAAM,IAAIA,MAAM,EAAE,QAAQ,GAAGA,CAAC;AAChC;AACA,OAAO,SAAS,QAAQ,OAAO,QAAQS;"}
|
|
1
|
+
{"version":3,"file":"logit.js","sources":["../../../../logit/dist/logit.js"],"sourcesContent":["const $ = {};\nconst v = {\n debug: \"log\",\n success: \"log\"\n}, w = () => typeof window < \"u\" && $?.NODE_ENV ? !1 : typeof process < \"u\" && process.env?.NODE_ENV ? process.env.NODE_ENV === \"production\" : !1, _ = w(), L = typeof window < \"u\" && window.matchMedia?.(\"(prefers-color-scheme: dark)\").matches, b = {\n debug: { bg: \"#616161\", border: \"#424242\", color: \"#fff\", icon: \"☕\", symbol: \"🅳\" },\n error: { bg: \"#d32f2f\", border: \"#c62828\", color: \"#fff\", icon: \"✘\", symbol: \"🅴\" },\n group: { bg: \"#546e7a\", border: \"#455a64\", color: \"#fff\", icon: \"⚭\", symbol: \"🅶\" },\n info: { bg: \"#1976d2\", border: \"#1565c0\", color: \"#fff\", icon: \"ℹ\", symbol: \"🅸\" },\n ns: L ? { bg: \"#fafafa\", border: \"#c7c7c7\", color: \"#000\" } : { bg: \"#424242\", border: \"#212121\", color: \"#fff\" },\n success: { bg: \"#689f38\", border: \"#558b2f\", color: \"#fff\", icon: \"✔\", symbol: \"🆂\" },\n time: { bg: \"#0097a7\", border: \"#00838f\", color: \"#fff\", icon: \"⏲\", symbol: \"🆃\" },\n trace: { bg: \"#d81b60\", border: \"#c2185b\", color: \"#fff\", icon: \"⛢\", symbol: \"🆃\" },\n warn: { bg: \"#ffb300\", border: \"#ffa000\", color: \"#fff\", icon: \"⚠\", symbol: \"🆆\" }\n}, l = {\n debug: 0,\n trace: 1,\n time: 2,\n table: 3,\n info: 4,\n success: 5,\n warn: 6,\n error: 7,\n off: 8\n}, r = {\n environment: !0,\n logLevel: \"debug\",\n namespace: \"\",\n remote: { handler: void 0, logLevel: \"off\" },\n timestamp: !0,\n variant: \"symbol\"\n}, a = (e) => l[r.logLevel] <= l[e], u = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 23), d = () => _ ? \"🄿\" : \"🄳\", x = (e, o) => {\n r.remote.handler && l[r.remote.logLevel] <= l[e] && r.remote.handler(e, ...o);\n}, g = (e) => v[e] || e, m = \"border: 1px solid\", p = \"border-radius: 4px\", h = \"border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter\", f = (e, o = \"\") => {\n const { bg: t, color: c, border: n } = b[e], s = `color: ${t}; ${m} ${n}; ${p}`;\n switch (r.variant) {\n case \"symbol\":\n return `${s}; padding: 1px 1px 0${o}`;\n case \"icon\":\n return `${s}; padding: 0 3px${o}`;\n default:\n return `background: ${t}; color: ${c}; ${m} ${n}; ${p}; font-weight: bold; padding: 0 3px${o}`;\n }\n}, E = (e) => {\n const o = b[e], { variant: t } = r;\n return t === \"text\" || !o[t] ? e.toUpperCase() : o[t];\n};\nfunction D(e) {\n const { namespace: o, timestamp: t, environment: c } = r;\n let n = `%c${E(e)}%c`;\n const s = [f(e), \"\"];\n return o && (n += ` %c${o}%c`, s.push(f(\"ns\", `; ${h}`), \"\")), c && (n += ` %c${d()}%c`, s.push(\"color: darkgray\", \"\")), t && (n += ` %c${u()}%c`, s.push(\"color: gray\", \"\")), { format: n, parts: s };\n}\nconst i = (e, ...o) => {\n if (typeof window > \"u\") {\n const s = console[g(e)];\n s(`${E(e)} | ${d()} |`, ...o);\n return;\n }\n if (!a(e)) return;\n const { format: t, parts: c } = D(e), n = console[g(e)];\n n(t, ...c, ...o), x(e, o);\n}, O = (e) => {\n const o = Math.floor(Date.now() - e);\n return o ? `${o}ms` : \"\";\n}, y = {\n /**\n * Asserts a condition and logs an error if it's false.\n */\n assert: (e, o, t) => console.assert(e, o, t),\n debug: (...e) => i(\"debug\", ...e),\n error: (...e) => i(\"error\", ...e),\n /**\n * Gets the current log level.\n */\n getLevel: () => r.logLevel,\n /**\n * Gets the current namespace prefix.\n */\n getPrefix: () => r.namespace,\n /**\n * Gets whether timestamps are shown.\n */\n getTimestamp: () => r.timestamp,\n /**\n * Creates a collapsed group in the console.\n */\n groupCollapsed: (e, o = \"GROUP\", t = Date.now()) => {\n if (!a(\"success\")) return;\n const c = O(t), n = d(), s = r.timestamp ? u() : \"\";\n console.groupCollapsed(\n `%c${o}%c${r.namespace}%c${n}%c${s}%c${c}%c${e}`,\n f(\"group\", \"; margin-right: 6px; padding: 1px 3px 0\"),\n f(\"ns\", `; ${h}; margin-right: 6px`),\n \"color: darkgray; margin-right: 6px\",\n \"color: gray; font-weight: lighter; margin-right: 6px\",\n \"color: gray; font-weight: lighter; margin-right: 6px\",\n \"color: inherit; font-weight: lighter\"\n );\n },\n /**\n * Ends the current console group.\n */\n groupEnd: () => {\n a(\"success\") && console.groupEnd();\n },\n info: (...e) => i(\"info\", ...e),\n /**\n * Initializes Logit with custom options.\n */\n initialise: (e) => {\n Object.assign(r, e);\n },\n /**\n * Sets the minimum log level to display.\n */\n setLogLevel: (e) => {\n r.logLevel = e;\n },\n /**\n * Sets the namespace prefix for all logs.\n */\n setPrefix: (e) => {\n r.namespace = e;\n },\n /**\n * Configures remote logging options.\n */\n setRemote: (e) => {\n r.remote = e;\n },\n /**\n * Sets the log level for remote logging.\n */\n setRemoteLogLevel: (e) => {\n r.remote.logLevel = e;\n },\n /**\n * Sets the display variant (text, icon, or symbol).\n */\n setVariant: (e) => {\n r.variant = e;\n },\n /**\n * Shows or hides the environment indicator.\n */\n showEnvironment: (e) => {\n r.environment = e;\n },\n /**\n * Shows or hides timestamps in logs.\n */\n showTimestamp: (e) => {\n r.timestamp = e;\n },\n success: (...e) => i(\"success\", ...e),\n /**\n * Displays data in a table format.\n */\n table: (...e) => {\n a(\"table\") && console.table(...e);\n },\n /**\n * Starts a timer with the given label.\n */\n time: (e) => {\n a(\"time\") && console.time(e);\n },\n /**\n * Ends a timer with the given label.\n */\n timeEnd: (e) => {\n a(\"time\") && console.timeEnd(e);\n },\n trace: (...e) => i(\"trace\", ...e),\n warn: (...e) => i(\"warn\", ...e)\n};\nexport {\n y as Logit\n};\n//# sourceMappingURL=logit.js.map\n"],"names":["$","w","_","a","d","x","g","m","h","E","i","y"],"mappings":"AAAA,MAAMA,IAAI,CAAA,GACJ,IAAI;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AACX,GAAGC,IAAI,MAAM,OAAO,SAAS,OAAOD,GAAG,WAAW,KAAK,OAAO,UAAU,OAAO,QAAQ,KAAK,WAAW,QAAQ,IAAI,aAAa,eAAe,IAAIE,IAAID,EAAC,GAAI,IAAI,OAAO,SAAS,OAAO,OAAO,aAAa,8BAA8B,EAAE,SAAS,IAAI;AAAA,EACtP,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAI;AAAA,EACjF,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAI;AAAA,EACjF,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAI;AAAA,EACjF,MAAM,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAI;AAAA,EAChF,IAAI,IAAI,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,OAAM,IAAK,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,OAAM;AAAA,EAC/G,SAAS,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAI;AAAA,EACnF,MAAM,EAAE,IAAI,WAAW,QAAQ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