@public-ui/theme-default 2.0.5 → 2.0.6
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/index.cjs +43 -37
- package/dist/index.mjs +43 -37
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -611,57 +611,63 @@ var TagEnum = /* @__PURE__ */ ((TagEnum2) => {
|
|
|
611
611
|
TagEnum2[TagEnum2["tree-item"] = 49] = "tree-item";
|
|
612
612
|
return TagEnum2;
|
|
613
613
|
})(TagEnum || {});
|
|
614
|
-
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
614
|
+
let DEV_MODE = null;
|
|
615
|
+
const getDevMode = () => DEV_MODE === true;
|
|
616
|
+
const LOG_STYLE = "color: white; background: #666; font-weight: bold; padding: .25em .5em; border-radius: 3px; border: 1px solid #000";
|
|
617
|
+
const mapToArray = (msg) => {
|
|
618
|
+
return Array.isArray(msg) ? msg : [msg];
|
|
619
|
+
};
|
|
620
|
+
const getLogLabel = (label) => {
|
|
621
|
+
return `%c${label}`;
|
|
622
|
+
};
|
|
623
|
+
const handleClassifier = (label, classifier) => {
|
|
624
|
+
if (typeof classifier === "string" && classifier.length > 0) {
|
|
625
|
+
return `${getLogLabel(label)} | ${classifier}`;
|
|
626
|
+
} else {
|
|
627
|
+
return getLogLabel(label);
|
|
625
628
|
}
|
|
626
|
-
|
|
627
|
-
|
|
629
|
+
};
|
|
630
|
+
const getShield = (label, options) => {
|
|
631
|
+
return [handleClassifier(label, options?.classifier), `${LOG_STYLE};${options?.overwriteStyle || ""}`];
|
|
632
|
+
};
|
|
633
|
+
const isDevModeOrForceLog = (devMode, forceLog) => devMode() || forceLog === true;
|
|
634
|
+
class Logger {
|
|
635
|
+
constructor(label, devMode) {
|
|
636
|
+
this.label = label;
|
|
637
|
+
this.devMode = devMode;
|
|
628
638
|
}
|
|
629
|
-
|
|
630
|
-
if (options?.forceLog
|
|
631
|
-
console.debug(...
|
|
639
|
+
debug(msg, options) {
|
|
640
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
641
|
+
console.debug(...getShield(this.label, options), ...mapToArray(msg));
|
|
632
642
|
}
|
|
633
643
|
}
|
|
634
|
-
|
|
635
|
-
if (options?.forceLog
|
|
636
|
-
console.info(...
|
|
644
|
+
info(msg, options) {
|
|
645
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
646
|
+
console.info(...getShield(this.label, options), ...mapToArray(msg));
|
|
637
647
|
}
|
|
638
648
|
}
|
|
639
|
-
|
|
640
|
-
if (options?.forceLog
|
|
641
|
-
console.trace(...
|
|
649
|
+
trace(msg, options) {
|
|
650
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
651
|
+
console.trace(...getShield(this.label, options), ...mapToArray(msg));
|
|
642
652
|
}
|
|
643
653
|
}
|
|
644
|
-
|
|
645
|
-
if (options?.forceLog
|
|
646
|
-
console.warn(...
|
|
654
|
+
warn(msg, options) {
|
|
655
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
656
|
+
console.warn(...getShield(this.label, options), ...mapToArray(msg));
|
|
647
657
|
}
|
|
648
658
|
}
|
|
649
|
-
|
|
650
|
-
if (options?.forceLog
|
|
651
|
-
console.error(...
|
|
659
|
+
error(msg, options) {
|
|
660
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
661
|
+
console.error(...getShield(this.label, options), ...mapToArray(msg));
|
|
652
662
|
}
|
|
653
663
|
}
|
|
654
|
-
|
|
655
|
-
if (options?.forceLog
|
|
656
|
-
throw new Error(...
|
|
664
|
+
throw(msg, options) {
|
|
665
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
666
|
+
throw new Error(...getShield(this.label, options), ...mapToArray(msg));
|
|
657
667
|
}
|
|
658
668
|
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
Log.shield = {
|
|
662
|
-
label: "%cKoliBri",
|
|
663
|
-
style: "color: white; background: #666; font-weight: bold; padding: .25em .5em; border-radius: 3px; border: 1px solid #000"
|
|
664
|
-
};
|
|
669
|
+
}
|
|
670
|
+
const Log = new Logger("KoliBri", getDevMode);
|
|
665
671
|
const devCache = /* @__PURE__ */ new Set();
|
|
666
672
|
const devHint = (msg, options) => {
|
|
667
673
|
if (devCache.has(msg) === false || !!options?.force) {
|
package/dist/index.mjs
CHANGED
|
@@ -609,57 +609,63 @@ var TagEnum = /* @__PURE__ */ ((TagEnum2) => {
|
|
|
609
609
|
TagEnum2[TagEnum2["tree-item"] = 49] = "tree-item";
|
|
610
610
|
return TagEnum2;
|
|
611
611
|
})(TagEnum || {});
|
|
612
|
-
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
612
|
+
let DEV_MODE = null;
|
|
613
|
+
const getDevMode = () => DEV_MODE === true;
|
|
614
|
+
const LOG_STYLE = "color: white; background: #666; font-weight: bold; padding: .25em .5em; border-radius: 3px; border: 1px solid #000";
|
|
615
|
+
const mapToArray = (msg) => {
|
|
616
|
+
return Array.isArray(msg) ? msg : [msg];
|
|
617
|
+
};
|
|
618
|
+
const getLogLabel = (label) => {
|
|
619
|
+
return `%c${label}`;
|
|
620
|
+
};
|
|
621
|
+
const handleClassifier = (label, classifier) => {
|
|
622
|
+
if (typeof classifier === "string" && classifier.length > 0) {
|
|
623
|
+
return `${getLogLabel(label)} | ${classifier}`;
|
|
624
|
+
} else {
|
|
625
|
+
return getLogLabel(label);
|
|
623
626
|
}
|
|
624
|
-
|
|
625
|
-
|
|
627
|
+
};
|
|
628
|
+
const getShield = (label, options) => {
|
|
629
|
+
return [handleClassifier(label, options?.classifier), `${LOG_STYLE};${options?.overwriteStyle || ""}`];
|
|
630
|
+
};
|
|
631
|
+
const isDevModeOrForceLog = (devMode, forceLog) => devMode() || forceLog === true;
|
|
632
|
+
class Logger {
|
|
633
|
+
constructor(label, devMode) {
|
|
634
|
+
this.label = label;
|
|
635
|
+
this.devMode = devMode;
|
|
626
636
|
}
|
|
627
|
-
|
|
628
|
-
if (options?.forceLog
|
|
629
|
-
console.debug(...
|
|
637
|
+
debug(msg, options) {
|
|
638
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
639
|
+
console.debug(...getShield(this.label, options), ...mapToArray(msg));
|
|
630
640
|
}
|
|
631
641
|
}
|
|
632
|
-
|
|
633
|
-
if (options?.forceLog
|
|
634
|
-
console.info(...
|
|
642
|
+
info(msg, options) {
|
|
643
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
644
|
+
console.info(...getShield(this.label, options), ...mapToArray(msg));
|
|
635
645
|
}
|
|
636
646
|
}
|
|
637
|
-
|
|
638
|
-
if (options?.forceLog
|
|
639
|
-
console.trace(...
|
|
647
|
+
trace(msg, options) {
|
|
648
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
649
|
+
console.trace(...getShield(this.label, options), ...mapToArray(msg));
|
|
640
650
|
}
|
|
641
651
|
}
|
|
642
|
-
|
|
643
|
-
if (options?.forceLog
|
|
644
|
-
console.warn(...
|
|
652
|
+
warn(msg, options) {
|
|
653
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
654
|
+
console.warn(...getShield(this.label, options), ...mapToArray(msg));
|
|
645
655
|
}
|
|
646
656
|
}
|
|
647
|
-
|
|
648
|
-
if (options?.forceLog
|
|
649
|
-
console.error(...
|
|
657
|
+
error(msg, options) {
|
|
658
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
659
|
+
console.error(...getShield(this.label, options), ...mapToArray(msg));
|
|
650
660
|
}
|
|
651
661
|
}
|
|
652
|
-
|
|
653
|
-
if (options?.forceLog
|
|
654
|
-
throw new Error(...
|
|
662
|
+
throw(msg, options) {
|
|
663
|
+
if (isDevModeOrForceLog(this.devMode, options?.forceLog)) {
|
|
664
|
+
throw new Error(...getShield(this.label, options), ...mapToArray(msg));
|
|
655
665
|
}
|
|
656
666
|
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
Log.shield = {
|
|
660
|
-
label: "%cKoliBri",
|
|
661
|
-
style: "color: white; background: #666; font-weight: bold; padding: .25em .5em; border-radius: 3px; border: 1px solid #000"
|
|
662
|
-
};
|
|
667
|
+
}
|
|
668
|
+
const Log = new Logger("KoliBri", getDevMode);
|
|
663
669
|
const devCache = /* @__PURE__ */ new Set();
|
|
664
670
|
const devHint = (msg, options) => {
|
|
665
671
|
if (devCache.has(msg) === false || !!options?.force) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@public-ui/theme-default",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"homepage": "https://public-ui.github.io",
|
|
6
6
|
"repository": "https://github.com/public-ui/kolibri",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"wcag"
|
|
39
39
|
],
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@public-ui/schema": "2.0.
|
|
42
|
-
"@public-ui/visual-tests": "2.0.
|
|
41
|
+
"@public-ui/schema": "2.0.6",
|
|
42
|
+
"@public-ui/visual-tests": "2.0.6",
|
|
43
43
|
"@types/node": "ts5.3",
|
|
44
44
|
"@typescript-eslint/eslint-plugin": "7.0.1",
|
|
45
45
|
"@typescript-eslint/parser": "7.0.1",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"unbuild": "1.2.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@public-ui/components": "2.0.
|
|
53
|
+
"@public-ui/components": "2.0.6"
|
|
54
54
|
},
|
|
55
55
|
"sideEffects": false,
|
|
56
56
|
"type": "module",
|