@briklab/lib 1.0.9 → 1.0.10
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/cli-john/index.js +58 -449
- package/dist/cli-john/index.js.map +7 -0
- package/dist/color/index.d.ts +21 -0
- package/dist/color/index.js +8 -153
- package/dist/color/index.js.map +7 -0
- package/dist/jstc/index.js +8 -89
- package/dist/jstc/index.js.map +7 -0
- package/dist/stylesheet/index.d.ts +2 -1
- package/dist/stylesheet/index.js +38 -186
- package/dist/stylesheet/index.js.map +7 -0
- package/package.json +6 -3
- package/pnpm-workspace.yaml +2 -0
- package/tsconfig.json +5 -5
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Easy way to use colors\n */\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _Color_instances, _Color_rgbToAnsi256Index, _Color_clamp, _Color_toHex, _Color_parseString, _Color_hslToRgb, _Color_rgbToHsl;\nconst NAMED_COLORS = {\n red: \"#ff0000\",\n blue: \"#0000ff\",\n green: \"#00ff00\",\n yellow: \"#ffff00\",\n orange: \"#ffa500\",\n black: \"#000000\",\n white: \"#ffffff\",\n gray: \"#808080\",\n};\nclass Color {\n constructor(input) {\n _Color_instances.add(this);\n this.r = 0;\n this.g = 0;\n this.b = 0;\n this.a = 1;\n if (typeof input === \"string\") {\n __classPrivateFieldGet(this, _Color_instances, \"m\", _Color_parseString).call(this, input);\n }\n else if (\"r\" in input && \"g\" in input && \"b\" in input) {\n this.r = __classPrivateFieldGet(this, _Color_instances, \"m\", _Color_clamp).call(this, input.r);\n this.g = __classPrivateFieldGet(this, _Color_instances, \"m\", _Color_clamp).call(this, input.g);\n this.b = __classPrivateFieldGet(this, _Color_instances, \"m\", _Color_clamp).call(this, input.b);\n this.a = input.a ?? 1;\n }\n else if (\"h\" in input && \"s\" in input && \"l\" in input) {\n const { r, g, b } = __classPrivateFieldGet(this, _Color_instances, \"m\", _Color_hslToRgb).call(this, input.h, input.s, input.l);\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = input.a ?? 1;\n }\n else {\n console.warn(`[Color.constructor] Invalid first argument!\r\n Hint: The first argument must be a valid color array\r\n Using black as fallback.`);\n }\n }\n // -----------------------\n // Public Methods\n // -----------------------\n hex() {\n return `#${__classPrivateFieldGet(this, _Color_instances, \"m\", _Color_toHex).call(this, this.r)}${__classPrivateFieldGet(this, _Color_instances, \"m\", _Color_toHex).call(this, this.g)}${__classPrivateFieldGet(this, _Color_instances, \"m\", _Color_toHex).call(this, this.b)}`;\n }\n rgb() {\n return `rgb(${this.r}, ${this.g}, ${this.b})`;\n }\n rgba() {\n return `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`;\n }\n hsl() {\n const { h, s, l } = __classPrivateFieldGet(this, _Color_instances, \"m\", _Color_rgbToHsl).call(this, this.r, this.g, this.b);\n return `hsl(${h}, ${s}%, ${l}%)`;\n }\n hsla() {\n const { h, s, l } = __classPrivateFieldGet(this, _Color_instances, \"m\", _Color_rgbToHsl).call(this, this.r, this.g, this.b);\n return `hsla(${h}, ${s}%, ${l}%, ${this.a})`;\n }\n css() {\n return this.a === 1 ? this.hex() : this.rgba();\n }\n /** Return a 24-bit (truecolor) ANSI sequence for this color (foreground) */\n ansiTruecolor() {\n return `\\x1b[38;2;${this.r};${this.g};${this.b}m`;\n }\n /** Return a 24-bit (truecolor) ANSI sequence for background */\n ansiTruecolorBg() {\n return `\\x1b[48;2;${this.r};${this.g};${this.b}m`;\n }\n /** Return a 256-color ANSI sequence for this color (foreground) */\n ansi256() {\n const idx = __classPrivateFieldGet(this, _Color_instances, \"m\", _Color_rgbToAnsi256Index).call(this, this.r, this.g, this.b);\n return `\\x1b[38;5;${idx}m`;\n }\n /** Return a 256-color ANSI sequence for background */\n ansi256Bg() {\n const idx = __classPrivateFieldGet(this, _Color_instances, \"m\", _Color_rgbToAnsi256Index).call(this, this.r, this.g, this.b);\n return `\\x1b[48;5;${idx}m`;\n }\n /** Wrap text with this color (truecolor by default). Options: {background?: boolean, use256?: boolean, bold?: boolean, underline?: boolean} */\n wrapAnsi(text, opts = {}) {\n const use256 = Boolean(opts.use256);\n const seq = opts.background\n ? use256\n ? this.ansi256Bg()\n : this.ansiTruecolorBg()\n : use256\n ? this.ansi256()\n : this.ansiTruecolor();\n const mods = `${opts.bold ? Color.BOLD : \"\"}${opts.underline ? Color.UNDERLINE : \"\"}`;\n return `${mods}${seq}${text}${Color.RESET}`;\n }\n}\n_Color_instances = new WeakSet(), _Color_rgbToAnsi256Index = function _Color_rgbToAnsi256Index(r, g, b) {\n // grayscale range\n if (r === g && g === b) {\n if (r < 8)\n return 16;\n if (r > 248)\n return 231;\n return Math.round(((r - 8) / 247) * 24) + 232;\n }\n const to6 = (v) => Math.round((v / 255) * 5);\n const ri = to6(r);\n const gi = to6(g);\n const bi = to6(b);\n return 16 + 36 * ri + 6 * gi + bi;\n}, _Color_clamp = function _Color_clamp(value) {\n return Math.max(0, Math.min(255, value));\n}, _Color_toHex = function _Color_toHex(value) {\n return value.toString(16).padStart(2, \"0\");\n}, _Color_parseString = function _Color_parseString(str) {\n str = str.trim().toLowerCase();\n if (NAMED_COLORS[str]) {\n str = NAMED_COLORS[str];\n }\n if (str.startsWith(\"#\")) {\n const hex = str.slice(1);\n if (hex.length === 3) {\n this.r = parseInt(hex[0] + hex[0], 16);\n this.g = parseInt(hex[1] + hex[1], 16);\n this.b = parseInt(hex[2] + hex[2], 16);\n }\n else if (hex.length === 6) {\n this.r = parseInt(hex.slice(0, 2), 16);\n this.g = parseInt(hex.slice(2, 4), 16);\n this.b = parseInt(hex.slice(4, 6), 16);\n }\n else {\n console.warn(`[Color class] @briklab/lib/color: Invalid hex! \r\n Hint: You must pass a valid hex color string!\r\n Using black as fallback.`);\n }\n }\n else if (str.startsWith(\"rgb\")) {\n const vals = str.match(/[\\d.]+/g)?.map(Number);\n if (vals && vals.length >= 3) {\n [this.r, this.g, this.b] = vals;\n this.a = vals[3] ?? 1;\n }\n }\n else if (str.startsWith(\"hsl\")) {\n const vals = str.match(/[\\d.]+/g)?.map(Number);\n if (vals && vals.length >= 3) {\n const { r, g, b } = __classPrivateFieldGet(this, _Color_instances, \"m\", _Color_hslToRgb).call(this, vals[0], vals[1], vals[2]);\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = vals[3] ?? 1;\n }\n }\n else {\n console.warn(`[Color class] @briklab/lib/color: Unknown color string \"${str}\"! \r\n Hint: The argument must be a valid color string!\r\n Using black as fallback.`);\n }\n}, _Color_hslToRgb = function _Color_hslToRgb(h, s, l) {\n s /= 100;\n l /= 100;\n const k = (n) => (n + h / 30) % 12;\n const a = s * Math.min(l, 1 - l);\n const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));\n return { r: Math.round(f(0) * 255), g: Math.round(f(8) * 255), b: Math.round(f(4) * 255) };\n}, _Color_rgbToHsl = function _Color_rgbToHsl(r, g, b) {\n r /= 255;\n g /= 255;\n b /= 255;\n const max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h = 0, s = 0, l = (max + min) / 2;\n if (max !== min) {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h *= 60;\n }\n return { h: Math.round(h), s: Math.round(s * 100), l: Math.round(l * 100) };\n};\n/**\n * ANSI / Terminal color helpers\n */\nColor.RESET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AKvB,EAAIC,EAAI,EAAI,GAC/B,MACJ,KAAKD,EACDE,GAAKD,EAAIF,GAAKwB,EAAI,EAClB,MACJ,KAAKtB,EACDC,GAAKH,EAAIC,GAAKuB,EAAI,EAClB,KACR,CACArB,GAAK,EACT,CACA,MAAO,CAAE,EAAG,KAAK,MAAMA,CAAC,EAAG,EAAG,KAAK,MAAMC,EAAI,GAAG,EAAG,EAAG,KAAK,MAAMC,EAAI,GAAG,CAAE,CAC9E,EAIAR,EAAM,MAAQ,UACdA,EAAM,KAAO,UACbA,EAAM,UAAY,UAClB,IAAO4B,EAAQ5B",
|
|
6
|
+
"names": ["__classPrivateFieldGet", "receiver", "state", "kind", "f", "_Color_instances", "_Color_rgbToAnsi256Index", "_Color_clamp", "_Color_toHex", "_Color_parseString", "_Color_hslToRgb", "_Color_rgbToHsl", "NAMED_COLORS", "Color", "_Color", "input", "r", "g", "b", "h", "s", "l", "text", "opts", "use256", "seq", "to6", "v", "ri", "gi", "bi", "value", "str", "hex", "vals", "k", "n", "a", "max", "min", "d", "index_default"]
|
|
7
|
+
}
|
package/dist/jstc/index.js
CHANGED
|
@@ -1,89 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _JSTypeChecker___CustomHandler;
|
|
13
|
-
export class JSTypeChecker {
|
|
14
|
-
constructor() {
|
|
15
|
-
_JSTypeChecker___CustomHandler.set(this, {
|
|
16
|
-
Array: (value) => Array.isArray(value),
|
|
17
|
-
"string[]": (value) => Array.isArray(value) && value.every((v) => typeof v === "string"),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* check if specific arguments are of a specific type, class, etc.
|
|
22
|
-
* @param {unknown[]} args
|
|
23
|
-
*/
|
|
24
|
-
for(args) {
|
|
25
|
-
if (!Array.isArray(args)) {
|
|
26
|
-
console.warn(`[JSTC.for] @briklab/lib/jstc: Invalid first argument!
|
|
27
|
-
Hint: The first argument must be a array.
|
|
28
|
-
Using [givenValue] as fallback`);
|
|
29
|
-
args = [args];
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
check: (types) => {
|
|
33
|
-
if (!Array.isArray(types)) {
|
|
34
|
-
console.warn(`[JSTC.for().check] @briklab/lib/jstc: Invalid first argument!
|
|
35
|
-
Hint: The first argument must be a valid array!
|
|
36
|
-
Using [givenValue] as fallback`);
|
|
37
|
-
types = [types];
|
|
38
|
-
}
|
|
39
|
-
if (args.length < types.length)
|
|
40
|
-
return false;
|
|
41
|
-
for (let i = 0; i < types.length; i++) {
|
|
42
|
-
const value = args[i];
|
|
43
|
-
const expected = types[i];
|
|
44
|
-
const expectedTypes = Array.isArray(expected) ? expected : [expected];
|
|
45
|
-
let matched = false;
|
|
46
|
-
for (const tRaw of expectedTypes) {
|
|
47
|
-
const unionTypes = typeof tRaw === "string" ? tRaw.split("|") : [tRaw];
|
|
48
|
-
for (const t of unionTypes) {
|
|
49
|
-
if (typeof t === "function") {
|
|
50
|
-
if (value instanceof t) {
|
|
51
|
-
matched = true;
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else if (typeof t === "string" && __classPrivateFieldGet(this, _JSTypeChecker___CustomHandler, "f")[t]) {
|
|
56
|
-
if (__classPrivateFieldGet(this, _JSTypeChecker___CustomHandler, "f")[t](value)) {
|
|
57
|
-
matched = true;
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else if (typeof value === t) {
|
|
62
|
-
matched = true;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (matched)
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
if (!matched)
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
return true;
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
addCustomHandler(name, handler) {
|
|
77
|
-
if (!(typeof name === "string" && typeof handler === "function")) {
|
|
78
|
-
console.warn(`[JSTC.addCustomHandler] @briklab/lib/jstc: Invalid Arguments!
|
|
79
|
-
Hint: The first argument must be a string, and the second argument must be a function
|
|
80
|
-
Using String(argument1) and ()=>false as fallbacks`);
|
|
81
|
-
name = String(name);
|
|
82
|
-
handler = () => false;
|
|
83
|
-
}
|
|
84
|
-
__classPrivateFieldGet(this, _JSTypeChecker___CustomHandler, "f")[name] = handler;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
_JSTypeChecker___CustomHandler = new WeakMap();
|
|
88
|
-
const JSTC = new JSTypeChecker();
|
|
89
|
-
export default JSTC;
|
|
1
|
+
var c=function(n,t,r,e){if(r==="a"&&!e)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!e:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?e:r==="a"?e.call(n):e?e.value:t.get(n)},s,u=class{constructor(){s.set(this,{Array:t=>Array.isArray(t),"string[]":t=>Array.isArray(t)&&t.every(r=>typeof r=="string")})}for(t){return Array.isArray(t)||(console.warn(`[JSTC.for] @briklab/lib/jstc: Invalid first argument!
|
|
2
|
+
Hint: The first argument must be a array.
|
|
3
|
+
Using [givenValue] as fallback`),t=[t]),{check:r=>{if(Array.isArray(r)||(console.warn(`[JSTC.for().check] @briklab/lib/jstc: Invalid first argument!
|
|
4
|
+
Hint: The first argument must be a valid array!
|
|
5
|
+
Using [givenValue] as fallback`),r=[r]),t.length<r.length)return!1;for(let e=0;e<r.length;e++){let o=t[e],f=r[e],b=Array.isArray(f)?f:[f],i=!1;for(let l of b){let d=typeof l=="string"?l.split("|"):[l];for(let a of d)if(typeof a=="function"){if(o instanceof a){i=!0;break}}else if(typeof a=="string"&&c(this,s,"f")[a]){if(c(this,s,"f")[a](o)){i=!0;break}}else if(typeof o===a){i=!0;break}if(i)break}if(!i)return!1}return!0}}}addCustomHandler(t,r){typeof t=="string"&&typeof r=="function"||(console.warn(`[JSTC.addCustomHandler] @briklab/lib/jstc: Invalid Arguments!
|
|
6
|
+
Hint: The first argument must be a string, and the second argument must be a function
|
|
7
|
+
Using String(argument1) and ()=>false as fallbacks`),t=String(t),r=()=>!1),c(this,s,"f")[t]=r}};s=new WeakMap;var g=new u,y=g;export{u as JSTypeChecker,y as default};
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * # JSTC\n * @packageDocumentation\n * Runtime JS Type Checker\n * @module JSTC\n */\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _JSTypeChecker___CustomHandler;\nexport class JSTypeChecker {\n constructor() {\n _JSTypeChecker___CustomHandler.set(this, {\n Array: (value) => Array.isArray(value),\n \"string[]\": (value) => Array.isArray(value) && value.every((v) => typeof v === \"string\"),\n });\n }\n /**\n * check if specific arguments are of a specific type, class, etc.\n * @param {unknown[]} args\n */\n for(args) {\n if (!Array.isArray(args)) {\n console.warn(`[JSTC.for] @briklab/lib/jstc: Invalid first argument!\r\n Hint: The first argument must be a array.\r\n Using [givenValue] as fallback`);\n args = [args];\n }\n return {\n check: (types) => {\n if (!Array.isArray(types)) {\n console.warn(`[JSTC.for().check] @briklab/lib/jstc: Invalid first argument!\r\n Hint: The first argument must be a valid array!\r\n Using [givenValue] as fallback`);\n types = [types];\n }\n if (args.length < types.length)\n return false;\n for (let i = 0; i < types.length; i++) {\n const value = args[i];\n const expected = types[i];\n const expectedTypes = Array.isArray(expected) ? expected : [expected];\n let matched = false;\n for (const tRaw of expectedTypes) {\n const unionTypes = typeof tRaw === \"string\" ? tRaw.split(\"|\") : [tRaw];\n for (const t of unionTypes) {\n if (typeof t === \"function\") {\n if (value instanceof t) {\n matched = true;\n break;\n }\n }\n else if (typeof t === \"string\" && __classPrivateFieldGet(this, _JSTypeChecker___CustomHandler, \"f\")[t]) {\n if (__classPrivateFieldGet(this, _JSTypeChecker___CustomHandler, \"f\")[t](value)) {\n matched = true;\n break;\n }\n }\n else if (typeof value === t) {\n matched = true;\n break;\n }\n }\n if (matched)\n break;\n }\n if (!matched)\n return false;\n }\n return true;\n },\n };\n }\n addCustomHandler(name, handler) {\n if (!(typeof name === \"string\" && typeof handler === \"function\")) {\n console.warn(`[JSTC.addCustomHandler] @briklab/lib/jstc: Invalid Arguments!\r\n Hint: The first argument must be a string, and the second argument must be a function\r\n Using String(argument1) and ()=>false as fallbacks`);\n name = String(name);\n handler = () => false;\n }\n __classPrivateFieldGet(this, _JSTypeChecker___CustomHandler, \"f\")[name] = handler;\n }\n}\n_JSTypeChecker___CustomHandler = new WeakMap();\nconst JSTC = new JSTypeChecker();\nexport default JSTC;\n"],
|
|
5
|
+
"mappings": "AAMA,IAAIA,EAAkE,SAAUC,EAAUC,EAAOC,EAAMC,EAAG,CACtG,GAAID,IAAS,KAAO,CAACC,EAAG,MAAM,IAAI,UAAU,+CAA+C,EAC3F,GAAI,OAAOF,GAAU,WAAaD,IAAaC,GAAS,CAACE,EAAI,CAACF,EAAM,IAAID,CAAQ,EAAG,MAAM,IAAI,UAAU,0EAA0E,EACjL,OAAOE,IAAS,IAAMC,EAAID,IAAS,IAAMC,EAAE,KAAKH,CAAQ,EAAIG,EAAIA,EAAE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D,GAAS,UAAY,OAAOC,GAAY,aACjD,QAAQ,KAAK;AAAA;AAAA,2DAEkC,EAC/CD,EAAO,OAAOA,CAAI,EAClBC,EAAU,IAAM,IAEpBnB,EAAuB,KAAMK,EAAgC,GAAG,EAAEa,CAAI,EAAIC,CAC9E,CACJ,EACAd,EAAiC,IAAI,QACrC,IAAMe,EAAO,IAAId,EACVe,EAAQD",
|
|
6
|
+
"names": ["__classPrivateFieldGet", "receiver", "state", "kind", "f", "_JSTypeChecker___CustomHandler", "JSTypeChecker", "value", "v", "args", "types", "i", "expected", "expectedTypes", "matched", "tRaw", "unionTypes", "t", "name", "handler", "JSTC", "index_default"]
|
|
7
|
+
}
|
|
@@ -18,9 +18,10 @@ export default class InlineStyle {
|
|
|
18
18
|
});
|
|
19
19
|
generate(): string;
|
|
20
20
|
get text(): string;
|
|
21
|
+
get ansi(): string;
|
|
21
22
|
addStyleWithObject(styleObject: object): this;
|
|
22
23
|
addStyleWithInlineCSS(inlineCSS: string): this;
|
|
23
|
-
removeStyle(styles: string[] | string): this
|
|
24
|
+
removeStyle(styles: string[] | string): this;
|
|
24
25
|
applyTo(element: HTMLElement): this;
|
|
25
26
|
}
|
|
26
27
|
export declare class StyleSheet {
|
package/dist/stylesheet/index.js
CHANGED
|
@@ -1,186 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* #
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class InlineStyle
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
__classPrivateFieldSet(this, _InlineStyle_styleObject, styleObject, "f");
|
|
40
|
-
__classPrivateFieldSet(this, _InlineStyle_cssStyleDec, new UUIII(), "f");
|
|
41
|
-
}
|
|
42
|
-
generate() {
|
|
43
|
-
let a = __classPrivateFieldGet(this, _InlineStyle_cssStyleDec, "f");
|
|
44
|
-
let b = __classPrivateFieldGet(this, _InlineStyle_styleObject, "f");
|
|
45
|
-
let c = Object.keys(b);
|
|
46
|
-
let d = Object.values(b);
|
|
47
|
-
for (let i = 0; i < c.length; i++) {
|
|
48
|
-
let e = c[i];
|
|
49
|
-
let f = d[i];
|
|
50
|
-
a.setProperty(e, f);
|
|
51
|
-
}
|
|
52
|
-
return a.cssText;
|
|
53
|
-
}
|
|
54
|
-
get text() {
|
|
55
|
-
return this.generate();
|
|
56
|
-
}
|
|
57
|
-
addStyleWithObject(styleObject) {
|
|
58
|
-
if (!JSTC.for([styleObject]).check(["object"])) {
|
|
59
|
-
console.warn(`[InlineStyle.addStyleWithObject] @briklab/lib/stylesheet: Invalid first argument!
|
|
60
|
-
Hint: The first argument must be a valid style object or not be given!
|
|
61
|
-
Using {"imeMode":givenValue} as fallback`);
|
|
62
|
-
styleObject = { imeMode: styleObject };
|
|
63
|
-
}
|
|
64
|
-
__classPrivateFieldSet(this, _InlineStyle_styleObject, { ...__classPrivateFieldGet(this, _InlineStyle_styleObject, "f"), ...styleObject }, "f");
|
|
65
|
-
this.generate();
|
|
66
|
-
return this;
|
|
67
|
-
}
|
|
68
|
-
addStyleWithInlineCSS(inlineCSS) {
|
|
69
|
-
if (!JSTC.for([inlineCSS]).check(["string"])) {
|
|
70
|
-
console.warn(`[InlineStyle.addStyleWithInlineCSS] @briklab/lib/stylesheet: Invalid first argument!
|
|
71
|
-
Hint: The first argument must be a valid inline css string!
|
|
72
|
-
Returned with no operations.`);
|
|
73
|
-
return this;
|
|
74
|
-
}
|
|
75
|
-
let s = new UUIII();
|
|
76
|
-
s.cssText = __classPrivateFieldGet(this, _InlineStyle_instances, "m", _InlineStyle_convertKeysToValidCSS).call(this, inlineCSS);
|
|
77
|
-
let o = {};
|
|
78
|
-
for (let i = 0; i < s.length; i++) {
|
|
79
|
-
const a = s[i];
|
|
80
|
-
const v = s.getPropertyValue(a);
|
|
81
|
-
o[a] = v;
|
|
82
|
-
}
|
|
83
|
-
this.addStyleWithObject(o);
|
|
84
|
-
return this;
|
|
85
|
-
}
|
|
86
|
-
removeStyle(styles) {
|
|
87
|
-
if (!JSTC.for([styles]).check(["string[]|string"])) {
|
|
88
|
-
console.warn(`[InlineStyle.removeStyle] @briklab/lib/stylesheet: Invalid first argument!
|
|
89
|
-
Hint: The first argument must be a array of valid css properties or a single valid css property [accepts any string though]
|
|
90
|
-
Returned with no operations.`);
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
if (typeof styles === "string") {
|
|
94
|
-
styles = [styles];
|
|
95
|
-
}
|
|
96
|
-
for (let i = 0; i < styles.length; i++) {
|
|
97
|
-
let a = styles[i];
|
|
98
|
-
delete __classPrivateFieldGet(this, _InlineStyle_styleObject, "f")[a];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
applyTo(element) {
|
|
102
|
-
element.style.cssText = this.generate();
|
|
103
|
-
return this;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
_InlineStyle_cssStyleDec = new WeakMap(), _InlineStyle_styleObject = new WeakMap(), _InlineStyle_instances = new WeakSet(), _InlineStyle_convertFieldToHyphenCase = function _InlineStyle_convertFieldToHyphenCase(string) {
|
|
107
|
-
return string.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`);
|
|
108
|
-
}, _InlineStyle_convertKeysToValidCSS = function _InlineStyle_convertKeysToValidCSS(string) {
|
|
109
|
-
let a = string.split(";");
|
|
110
|
-
let c = "";
|
|
111
|
-
for (let i = 0; i < a.length; i++) {
|
|
112
|
-
let b = a[i];
|
|
113
|
-
let [k, v] = b.split(":");
|
|
114
|
-
k = k.trim();
|
|
115
|
-
v = v.trim();
|
|
116
|
-
c += `${__classPrivateFieldGet(this, _InlineStyle_instances, "m", _InlineStyle_convertFieldToHyphenCase).call(this, k)}:${v};`;
|
|
117
|
-
}
|
|
118
|
-
return c;
|
|
119
|
-
};
|
|
120
|
-
export default InlineStyle;
|
|
121
|
-
export class StyleSheet {
|
|
122
|
-
constructor() {
|
|
123
|
-
_StyleSheet_styles.set(this, void 0);
|
|
124
|
-
__classPrivateFieldSet(this, _StyleSheet_styles, {}, "f");
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Add or update a rule in the stylesheet.
|
|
128
|
-
* @param name The rule name or selector (string).
|
|
129
|
-
* @param style An InlineStyle instance.
|
|
130
|
-
*/
|
|
131
|
-
set(name, style) {
|
|
132
|
-
if (!JSTC.for([name, style]).check(["string", "object"])) {
|
|
133
|
-
console.warn(`[StyleSheet.set] @briklab/lib/stylesheet: Invalid arguments! ` +
|
|
134
|
-
`Name must be string, style must be InlineStyle instance. Received: name=${name}, style=${style}`);
|
|
135
|
-
return this;
|
|
136
|
-
}
|
|
137
|
-
if (!(style instanceof InlineStyle)) {
|
|
138
|
-
console.warn(`[StyleSheet.set] @briklab/lib/stylesheet: Provided style is not an InlineStyle instance! ` +
|
|
139
|
-
`Received: ${style}`);
|
|
140
|
-
return this;
|
|
141
|
-
}
|
|
142
|
-
__classPrivateFieldGet(this, _StyleSheet_styles, "f")[name] = style;
|
|
143
|
-
return this;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Get a rule by name.
|
|
147
|
-
*/
|
|
148
|
-
get(name) {
|
|
149
|
-
if (!JSTC.for([name]).check(["string"])) {
|
|
150
|
-
console.warn(`[StyleSheet.get] @briklab/lib/stylesheet: Invalid argument! Name must be a string. Received: ${name}`);
|
|
151
|
-
return undefined;
|
|
152
|
-
}
|
|
153
|
-
return __classPrivateFieldGet(this, _StyleSheet_styles, "f")[name];
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Remove a rule by name.
|
|
157
|
-
*/
|
|
158
|
-
remove(name) {
|
|
159
|
-
if (!JSTC.for([name]).check(["string"])) {
|
|
160
|
-
console.warn(`[StyleSheet.remove] @briklab/lib/stylesheet: Invalid argument! Name must be a string. Received: ${name}`);
|
|
161
|
-
return this;
|
|
162
|
-
}
|
|
163
|
-
delete __classPrivateFieldGet(this, _StyleSheet_styles, "f")[name];
|
|
164
|
-
return this;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Generate CSS text for the whole stylesheet.
|
|
168
|
-
*/
|
|
169
|
-
generate() {
|
|
170
|
-
let css = "";
|
|
171
|
-
for (const key in __classPrivateFieldGet(this, _StyleSheet_styles, "f")) {
|
|
172
|
-
const style = __classPrivateFieldGet(this, _StyleSheet_styles, "f")[key];
|
|
173
|
-
if (style) {
|
|
174
|
-
css += `${key} { ${style.text} }\n`;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return css.trim();
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Export as a string for inline style usage or injection.
|
|
181
|
-
*/
|
|
182
|
-
toString() {
|
|
183
|
-
return this.generate();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
_StyleSheet_styles = new WeakMap();
|
|
1
|
+
var dt=Object.create;var Ue=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var bt=Object.getPrototypeOf,vt=Object.prototype.hasOwnProperty;var h=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var xt=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of mt(e))!vt.call(i,l)&&l!==t&&Ue(i,l,{get:()=>e[l],enumerable:!(r=gt(e,l))||r.enumerable});return i};var wt=(i,e,t)=>(t=i!=null?dt(bt(i)):{},xt(e||!i||!i.__esModule?Ue(t,"default",{value:i,enumerable:!0}):t,i));var we=h(Ne=>{var Ke={};Ke.StyleSheet=function(){this.parentStyleSheet=null};Ne.StyleSheet=Ke.StyleSheet});var d=h(je=>{var f={};f.CSSRule=function(){this.parentRule=null,this.parentStyleSheet=null};f.CSSRule.UNKNOWN_RULE=0;f.CSSRule.STYLE_RULE=1;f.CSSRule.CHARSET_RULE=2;f.CSSRule.IMPORT_RULE=3;f.CSSRule.MEDIA_RULE=4;f.CSSRule.FONT_FACE_RULE=5;f.CSSRule.PAGE_RULE=6;f.CSSRule.KEYFRAMES_RULE=7;f.CSSRule.KEYFRAME_RULE=8;f.CSSRule.MARGIN_RULE=9;f.CSSRule.NAMESPACE_RULE=10;f.CSSRule.COUNTER_STYLE_RULE=11;f.CSSRule.SUPPORTS_RULE=12;f.CSSRule.DOCUMENT_RULE=13;f.CSSRule.FONT_FEATURE_VALUES_RULE=14;f.CSSRule.VIEWPORT_RULE=15;f.CSSRule.REGION_STYLE_RULE=16;f.CSSRule.prototype={constructor:f.CSSRule};je.CSSRule=f.CSSRule});var Q=h(Ge=>{var g={CSSStyleDeclaration:V().CSSStyleDeclaration,CSSRule:d().CSSRule};g.CSSStyleRule=function(){g.CSSRule.call(this),this.selectorText="",this.style=new g.CSSStyleDeclaration,this.style.parentRule=this};g.CSSStyleRule.prototype=new g.CSSRule;g.CSSStyleRule.prototype.constructor=g.CSSStyleRule;g.CSSStyleRule.prototype.type=1;Object.defineProperty(g.CSSStyleRule.prototype,"cssText",{get:function(){var i;return this.selectorText?i=this.selectorText+" {"+this.style.cssText+"}":i="",i},set:function(i){var e=g.CSSStyleRule.parse(i);this.style=e.style,this.selectorText=e.selectorText}});g.CSSStyleRule.parse=function(i){for(var e=0,t="selector",r,l=e,s="",n={selector:!0,value:!0},o=new g.CSSStyleRule,S,u="",a;a=i.charAt(e);e++)switch(a){case" ":case" ":case"\r":case`
|
|
2
|
+
`:case"\f":if(n[t])switch(i.charAt(e-1)){case" ":case" ":case"\r":case`
|
|
3
|
+
`:case"\f":break;default:s+=" ";break}break;case'"':if(l=e+1,r=i.indexOf('"',l)+1,!r)throw'" is missing';s+=i.slice(e,r),e=r-1;break;case"'":if(l=e+1,r=i.indexOf("'",l)+1,!r)throw"' is missing";s+=i.slice(e,r),e=r-1;break;case"/":if(i.charAt(e+1)==="*"){if(e+=2,r=i.indexOf("*/",e),r===-1)throw new SyntaxError("Missing */");e=r+1}else s+=a;break;case"{":t==="selector"&&(o.selectorText=s.trim(),s="",t="name");break;case":":t==="name"?(S=s.trim(),s="",t="value"):s+=a;break;case"!":t==="value"&&i.indexOf("!important",e)===e?(u="important",e+=9):s+=a;break;case";":t==="value"?(o.style.setProperty(S,s.trim(),u),u="",s="",t="name"):s+=a;break;case"}":if(t==="value")o.style.setProperty(S,s.trim(),u),u="",s="";else{if(t==="name")break;s+=a}t="selector";break;default:s+=a;break}return o};Ge.CSSStyleRule=g.CSSStyleRule});var ee=h(We=>{var b={StyleSheet:we().StyleSheet,CSSStyleRule:Q().CSSStyleRule};b.CSSStyleSheet=function(){b.StyleSheet.call(this),this.cssRules=[]};b.CSSStyleSheet.prototype=new b.StyleSheet;b.CSSStyleSheet.prototype.constructor=b.CSSStyleSheet;b.CSSStyleSheet.prototype.insertRule=function(i,e){if(e<0||e>this.cssRules.length)throw new RangeError("INDEX_SIZE_ERR");var t=b.parse(i).cssRules[0];return t.parentStyleSheet=this,this.cssRules.splice(e,0,t),e};b.CSSStyleSheet.prototype.deleteRule=function(i){if(i<0||i>=this.cssRules.length)throw new RangeError("INDEX_SIZE_ERR");this.cssRules.splice(i,1)};b.CSSStyleSheet.prototype.toString=function(){for(var i="",e=this.cssRules,t=0;t<e.length;t++)i+=e[t].cssText+`
|
|
4
|
+
`;return i};We.CSSStyleSheet=b.CSSStyleSheet;b.parse=ne().parse});var ae=h(Be=>{var oe={};oe.MediaList=function(){this.length=0};oe.MediaList.prototype={constructor:oe.MediaList,get mediaText(){return Array.prototype.join.call(this,", ")},set mediaText(i){for(var e=i.split(","),t=this.length=e.length,r=0;r<t;r++)this[r]=e[r].trim()},appendMedium:function(i){Array.prototype.indexOf.call(this,i)===-1&&(this[this.length]=i,this.length++)},deleteMedium:function(i){var e=Array.prototype.indexOf.call(this,i);e!==-1&&Array.prototype.splice.call(this,e,1)}};Be.MediaList=oe.MediaList});var ke=h(Je=>{var w={CSSRule:d().CSSRule,CSSStyleSheet:ee().CSSStyleSheet,MediaList:ae().MediaList};w.CSSImportRule=function(){w.CSSRule.call(this),this.href="",this.media=new w.MediaList,this.styleSheet=new w.CSSStyleSheet};w.CSSImportRule.prototype=new w.CSSRule;w.CSSImportRule.prototype.constructor=w.CSSImportRule;w.CSSImportRule.prototype.type=3;Object.defineProperty(w.CSSImportRule.prototype,"cssText",{get:function(){var i=this.media.mediaText;return"@import url("+this.href+")"+(i?" "+i:"")+";"},set:function(i){for(var e=0,t="",r="",l,s;s=i.charAt(e);e++)switch(s){case" ":case" ":case"\r":case`
|
|
5
|
+
`:case"\f":t==="after-import"?t="url":r+=s;break;case"@":!t&&i.indexOf("@import",e)===e&&(t="after-import",e+=6,r="");break;case"u":if(t==="url"&&i.indexOf("url(",e)===e){if(l=i.indexOf(")",e+1),l===-1)throw e+': ")" not found';e+=4;var n=i.slice(e,l);n[0]===n[n.length-1]&&(n[0]==='"'||n[0]==="'")&&(n=n.slice(1,-1)),this.href=n,e=l,t="media"}break;case'"':if(t==="url"){if(l=i.indexOf('"',e+1),!l)throw e+`: '"' not found`;this.href=i.slice(e+1,l),e=l,t="media"}break;case"'":if(t==="url"){if(l=i.indexOf("'",e+1),!l)throw e+`: "'" not found`;this.href=i.slice(e+1,l),e=l,t="media"}break;case";":t==="media"&&r&&(this.media.mediaText=r.trim());break;default:t==="media"&&(r+=s);break}}});Je.CSSImportRule=w.CSSImportRule});var U=h(Ye=>{var _={CSSRule:d().CSSRule};_.CSSGroupingRule=function(){_.CSSRule.call(this),this.cssRules=[]};_.CSSGroupingRule.prototype=new _.CSSRule;_.CSSGroupingRule.prototype.constructor=_.CSSGroupingRule;_.CSSGroupingRule.prototype.insertRule=function(e,t){if(t<0||t>this.cssRules.length)throw new RangeError("INDEX_SIZE_ERR");var r=_.parse(e).cssRules[0];return r.parentRule=this,this.cssRules.splice(t,0,r),t};_.CSSGroupingRule.prototype.deleteRule=function(e){if(e<0||e>=this.cssRules.length)throw new RangeError("INDEX_SIZE_ERR");this.cssRules.splice(e,1)[0].parentRule=null};Ye.CSSGroupingRule=_.CSSGroupingRule});var N=h(Ze=>{var $={CSSRule:d().CSSRule,CSSGroupingRule:U().CSSGroupingRule};$.CSSConditionRule=function(){$.CSSGroupingRule.call(this),this.cssRules=[]};$.CSSConditionRule.prototype=new $.CSSGroupingRule;$.CSSConditionRule.prototype.constructor=$.CSSConditionRule;$.CSSConditionRule.prototype.conditionText="";$.CSSConditionRule.prototype.cssText="";Ze.CSSConditionRule=$.CSSConditionRule});var Se=h(Xe=>{var T={CSSRule:d().CSSRule,CSSGroupingRule:U().CSSGroupingRule,CSSConditionRule:N().CSSConditionRule,MediaList:ae().MediaList};T.CSSMediaRule=function(){T.CSSConditionRule.call(this),this.media=new T.MediaList};T.CSSMediaRule.prototype=new T.CSSConditionRule;T.CSSMediaRule.prototype.constructor=T.CSSMediaRule;T.CSSMediaRule.prototype.type=4;Object.defineProperties(T.CSSMediaRule.prototype,{conditionText:{get:function(){return this.media.mediaText},set:function(i){this.media.mediaText=i},configurable:!0,enumerable:!0},cssText:{get:function(){for(var i=[],e=0,t=this.cssRules.length;e<t;e++)i.push(this.cssRules[e].cssText);return"@media "+this.media.mediaText+" {"+i.join("")+"}"},configurable:!0,enumerable:!0}});Xe.CSSMediaRule=T.CSSMediaRule});var ue=h(ze=>{var q={CSSRule:d().CSSRule,CSSGroupingRule:U().CSSGroupingRule,CSSConditionRule:N().CSSConditionRule};q.CSSSupportsRule=function(){q.CSSConditionRule.call(this)};q.CSSSupportsRule.prototype=new q.CSSConditionRule;q.CSSSupportsRule.prototype.constructor=q.CSSSupportsRule;q.CSSSupportsRule.prototype.type=12;Object.defineProperty(q.CSSSupportsRule.prototype,"cssText",{get:function(){for(var i=[],e=0,t=this.cssRules.length;e<t;e++)i.push(this.cssRules[e].cssText);return"@supports "+this.conditionText+" {"+i.join("")+"}"}});ze.CSSSupportsRule=q.CSSSupportsRule});var _e=h(Qe=>{var M={CSSStyleDeclaration:V().CSSStyleDeclaration,CSSRule:d().CSSRule};M.CSSFontFaceRule=function(){M.CSSRule.call(this),this.style=new M.CSSStyleDeclaration,this.style.parentRule=this};M.CSSFontFaceRule.prototype=new M.CSSRule;M.CSSFontFaceRule.prototype.constructor=M.CSSFontFaceRule;M.CSSFontFaceRule.prototype.type=5;Object.defineProperty(M.CSSFontFaceRule.prototype,"cssText",{get:function(){return"@font-face {"+this.style.cssText+"}"}});Qe.CSSFontFaceRule=M.CSSFontFaceRule});var Te=h(et=>{var P={CSSRule:d().CSSRule};P.CSSHostRule=function(){P.CSSRule.call(this),this.cssRules=[]};P.CSSHostRule.prototype=new P.CSSRule;P.CSSHostRule.prototype.constructor=P.CSSHostRule;P.CSSHostRule.prototype.type=1001;Object.defineProperty(P.CSSHostRule.prototype,"cssText",{get:function(){for(var i=[],e=0,t=this.cssRules.length;e<t;e++)i.push(this.cssRules[e].cssText);return"@host {"+i.join("")+"}"}});et.CSSHostRule=P.CSSHostRule});var ce=h(tt=>{var E={CSSRule:d().CSSRule,CSSStyleDeclaration:V().CSSStyleDeclaration};E.CSSKeyframeRule=function(){E.CSSRule.call(this),this.keyText="",this.style=new E.CSSStyleDeclaration,this.style.parentRule=this};E.CSSKeyframeRule.prototype=new E.CSSRule;E.CSSKeyframeRule.prototype.constructor=E.CSSKeyframeRule;E.CSSKeyframeRule.prototype.type=8;Object.defineProperty(E.CSSKeyframeRule.prototype,"cssText",{get:function(){return this.keyText+" {"+this.style.cssText+"} "}});tt.CSSKeyframeRule=E.CSSKeyframeRule});var he=h(rt=>{var L={CSSRule:d().CSSRule};L.CSSKeyframesRule=function(){L.CSSRule.call(this),this.name="",this.cssRules=[]};L.CSSKeyframesRule.prototype=new L.CSSRule;L.CSSKeyframesRule.prototype.constructor=L.CSSKeyframesRule;L.CSSKeyframesRule.prototype.type=7;Object.defineProperty(L.CSSKeyframesRule.prototype,"cssText",{get:function(){for(var i=[],e=0,t=this.cssRules.length;e<t;e++)i.push(" "+this.cssRules[e].cssText);return"@"+(this._vendorPrefix||"")+"keyframes "+this.name+` {
|
|
6
|
+
`+i.join(`
|
|
7
|
+
`)+`
|
|
8
|
+
}`}});rt.CSSKeyframesRule=L.CSSKeyframesRule});var Me=h(it=>{var pe={};pe.CSSValue=function(){};pe.CSSValue.prototype={constructor:pe.CSSValue,set cssText(i){var e=this._getConstructorName();throw new Error('DOMException: property "cssText" of "'+e+'" is readonly and can not be replaced with "'+i+'"!')},get cssText(){var i=this._getConstructorName();throw new Error('getter "cssText" of "'+i+'" is not implemented!')},_getConstructorName:function(){var i=this.constructor.toString(),e=i.match(/function\s([^\(]+)/),t=e[1];return t}};it.CSSValue=pe.CSSValue});var Ee=h(st=>{var k={CSSValue:Me().CSSValue};k.CSSValueExpression=function(e,t){this._token=e,this._idx=t};k.CSSValueExpression.prototype=new k.CSSValue;k.CSSValueExpression.prototype.constructor=k.CSSValueExpression;k.CSSValueExpression.prototype.parse=function(){for(var i=this._token,e=this._idx,t="",r="",l="",s,n=[];;++e){if(t=i.charAt(e),t===""){l="css expression error: unfinished expression!";break}switch(t){case"(":n.push(t),r+=t;break;case")":n.pop(t),r+=t;break;case"/":(s=this._parseJSComment(i,e))?s.error?l="css expression error: unfinished comment in expression!":e=s.idx:(s=this._parseJSRexExp(i,e))?(e=s.idx,r+=s.text):r+=t;break;case"'":case'"':s=this._parseJSString(i,e,t),s?(e=s.idx,r+=s.text):r+=t;break;default:r+=t;break}if(l||n.length===0)break}var o;return l?o={error:l}:o={idx:e,expression:r},o};k.CSSValueExpression.prototype._parseJSComment=function(i,e){var t=i.charAt(e+1),r;if(t==="/"||t==="*"){var l=e,s,n;if(t==="/"?n=`
|
|
9
|
+
`:t==="*"&&(n="*/"),s=i.indexOf(n,l+1+1),s!==-1)return s=s+n.length-1,r=i.substring(e,s+1),{idx:s,text:r};var o="css expression error: unfinished comment in expression!";return{error:o}}else return!1};k.CSSValueExpression.prototype._parseJSString=function(i,e,t){var r=this._findMatchedIdx(i,e,t),l;return r===-1?!1:(l=i.substring(e,r+t.length),{idx:r,text:l})};k.CSSValueExpression.prototype._parseJSRexExp=function(i,e){var t=i.substring(0,e).replace(/\s+$/,""),r=[/^$/,/\($/,/\[$/,/\!$/,/\+$/,/\-$/,/\*$/,/\/\s+/,/\%$/,/\=$/,/\>$/,/<$/,/\&$/,/\|$/,/\^$/,/\~$/,/\?$/,/\,$/,/delete$/,/in$/,/instanceof$/,/new$/,/typeof$/,/void$/],l=r.some(function(n){return n.test(t)});if(l){var s="/";return this._parseJSString(i,e,s)}else return!1};k.CSSValueExpression.prototype._findMatchedIdx=function(i,e,t){for(var r=e,l,s=-1;;)if(l=i.indexOf(t,r+1),l===-1){l=s;break}else{var n=i.substring(e+1,l),o=n.match(/\\+$/);if(!o||o[0]%2===0)break;r=l}var S=i.indexOf(`
|
|
10
|
+
`,e+1);return S<l&&(l=s),l};st.CSSValueExpression=k.CSSValueExpression});var Ie=h(lt=>{var fe={};fe.MatcherList=function(){this.length=0};fe.MatcherList.prototype={constructor:fe.MatcherList,get matcherText(){return Array.prototype.join.call(this,", ")},set matcherText(i){for(var e=i.split(","),t=this.length=e.length,r=0;r<t;r++)this[r]=e[r].trim()},appendMatcher:function(i){Array.prototype.indexOf.call(this,i)===-1&&(this[this.length]=i,this.length++)},deleteMatcher:function(i){var e=Array.prototype.indexOf.call(this,i);e!==-1&&Array.prototype.splice.call(this,e,1)}};lt.MatcherList=fe.MatcherList});var Oe=h(nt=>{var I={CSSRule:d().CSSRule,MatcherList:Ie().MatcherList};I.CSSDocumentRule=function(){I.CSSRule.call(this),this.matcher=new I.MatcherList,this.cssRules=[]};I.CSSDocumentRule.prototype=new I.CSSRule;I.CSSDocumentRule.prototype.constructor=I.CSSDocumentRule;I.CSSDocumentRule.prototype.type=10;Object.defineProperty(I.CSSDocumentRule.prototype,"cssText",{get:function(){for(var i=[],e=0,t=this.cssRules.length;e<t;e++)i.push(this.cssRules[e].cssText);return"@-moz-document "+this.matcher.matcherText+" {"+i.join("")+"}"}});nt.CSSDocumentRule=I.CSSDocumentRule});var ne=h(ot=>{var c={};c.parse=function(e){for(var t=0,r="before-selector",l,s="",n=0,o={selector:!0,value:!0,"value-parenthesis":!0,atRule:!0,"importRule-begin":!0,importRule:!0,atBlock:!0,conditionBlock:!0,"documentRule-begin":!0},S=new c.CSSStyleSheet,u=S,a,x=[],D=!1,De,ve,W="",R,B,J,Y,Z,H,K,re,Ae=/@(-(?:\w+-)+)?keyframes/g,X=function(yt){var Fe=e.substring(0,t).split(`
|
|
11
|
+
`),He=Fe.length,Ve=Fe.pop().length+1,le=new Error(yt+" (line "+He+", char "+Ve+")");throw le.line=He,le.char=Ve,le.styleSheet=S,le},y;y=e.charAt(t);t++)switch(y){case" ":case" ":case"\r":case`
|
|
12
|
+
`:case"\f":o[r]&&(s+=y);break;case'"':l=t+1;do l=e.indexOf('"',l)+1,l||X('Unmatched "');while(e[l-2]==="\\");switch(s+=e.slice(t,l),t=l-1,r){case"before-value":r="value";break;case"importRule-begin":r="importRule";break}break;case"'":l=t+1;do l=e.indexOf("'",l)+1,l||X("Unmatched '");while(e[l-2]==="\\");switch(s+=e.slice(t,l),t=l-1,r){case"before-value":r="value";break;case"importRule-begin":r="importRule";break}break;case"/":e.charAt(t+1)==="*"?(t+=2,l=e.indexOf("*/",t),l===-1?X("Missing */"):t=l+1):s+=y,r==="importRule-begin"&&(s+=" ",r="importRule");break;case"@":if(e.indexOf("@-moz-document",t)===t){r="documentRule-begin",K=new c.CSSDocumentRule,K.__starts=t,t+=13,s="";break}else if(e.indexOf("@media",t)===t){r="atBlock",B=new c.CSSMediaRule,B.__starts=t,t+=5,s="";break}else if(e.indexOf("@supports",t)===t){r="conditionBlock",J=new c.CSSSupportsRule,J.__starts=t,t+=8,s="";break}else if(e.indexOf("@host",t)===t){r="hostRule-begin",t+=4,re=new c.CSSHostRule,re.__starts=t,s="";break}else if(e.indexOf("@import",t)===t){r="importRule-begin",t+=6,s+="@import";break}else if(e.indexOf("@font-face",t)===t){r="fontFaceRule-begin",t+=9,Z=new c.CSSFontFaceRule,Z.__starts=t,s="";break}else{Ae.lastIndex=t;var ie=Ae.exec(e);if(ie&&ie.index===t){r="keyframesRule-begin",H=new c.CSSKeyframesRule,H.__starts=t,H._vendorPrefix=ie[1],t+=ie[0].length-1,s="";break}else r==="selector"&&(r="atRule")}s+=y;break;case"{":r==="selector"||r==="atRule"?(R.selectorText=s.trim(),R.style.__starts=t,s="",r="before-name"):r==="atBlock"?(B.media.mediaText=s.trim(),a&&x.push(a),u=a=B,B.parentStyleSheet=S,s="",r="before-selector"):r==="conditionBlock"?(J.conditionText=s.trim(),a&&x.push(a),u=a=J,J.parentStyleSheet=S,s="",r="before-selector"):r==="hostRule-begin"?(a&&x.push(a),u=a=re,re.parentStyleSheet=S,s="",r="before-selector"):r==="fontFaceRule-begin"?(a&&(Z.parentRule=a),Z.parentStyleSheet=S,R=Z,s="",r="before-name"):r==="keyframesRule-begin"?(H.name=s.trim(),a&&(x.push(a),H.parentRule=a),H.parentStyleSheet=S,u=a=H,s="",r="keyframeRule-begin"):r==="keyframeRule-begin"?(R=new c.CSSKeyframeRule,R.keyText=s.trim(),R.__starts=t,s="",r="before-name"):r==="documentRule-begin"&&(K.matcher.matcherText=s.trim(),a&&(x.push(a),K.parentRule=a),u=a=K,K.parentStyleSheet=S,s="",r="before-selector");break;case":":r==="name"?(ve=s.trim(),s="",r="before-value"):s+=y;break;case"(":if(r==="value")if(s.trim()==="expression"){var se=new c.CSSValueExpression(e,t).parse();se.error?X(se.error):(s+=se.expression,t=se.idx)}else r="value-parenthesis",n=1,s+=y;else r==="value-parenthesis"&&n++,s+=y;break;case")":r==="value-parenthesis"&&(n--,n===0&&(r="value")),s+=y;break;case"!":r==="value"&&e.indexOf("!important",t)===t?(W="important",t+=9):s+=y;break;case";":switch(r){case"value":R.style.setProperty(ve,s.trim(),W),W="",s="",r="before-name";break;case"atRule":s="",r="before-selector";break;case"importRule":Y=new c.CSSImportRule,Y.parentStyleSheet=Y.styleSheet.parentStyleSheet=S,Y.cssText=s+y,S.cssRules.push(Y),s="",r="before-selector";break;default:s+=y;break}break;case"}":switch(r){case"value":R.style.setProperty(ve,s.trim(),W),W="";case"before-name":case"name":R.__ends=t+1,a&&(R.parentRule=a),R.parentStyleSheet=S,u.cssRules.push(R),s="",u.constructor===c.CSSKeyframesRule?r="keyframeRule-begin":r="before-selector";break;case"keyframeRule-begin":case"before-selector":case"selector":for(a||X("Unexpected }"),D=x.length>0;x.length>0;){if(a=x.pop(),a.constructor.name==="CSSMediaRule"||a.constructor.name==="CSSSupportsRule"){De=u,u=a,u.cssRules.push(De);break}x.length===0&&(D=!1)}D||(u.__ends=t+1,S.cssRules.push(u),u=S,a=null),s="",r="before-selector";break}break;default:switch(r){case"before-selector":r="selector",R=new c.CSSStyleRule,R.__starts=t;break;case"before-name":r="name";break;case"before-value":r="value";break;case"importRule-begin":r="importRule";break}s+=y;break}return S};ot.parse=c.parse;c.CSSStyleSheet=ee().CSSStyleSheet;c.CSSStyleRule=Q().CSSStyleRule;c.CSSImportRule=ke().CSSImportRule;c.CSSGroupingRule=U().CSSGroupingRule;c.CSSMediaRule=Se().CSSMediaRule;c.CSSConditionRule=N().CSSConditionRule;c.CSSSupportsRule=ue().CSSSupportsRule;c.CSSFontFaceRule=_e().CSSFontFaceRule;c.CSSHostRule=Te().CSSHostRule;c.CSSStyleDeclaration=V().CSSStyleDeclaration;c.CSSKeyframeRule=ce().CSSKeyframeRule;c.CSSKeyframesRule=he().CSSKeyframesRule;c.CSSValueExpression=Ee().CSSValueExpression;c.CSSDocumentRule=Oe().CSSDocumentRule});var V=h(at=>{var j={};j.CSSStyleDeclaration=function(){this.length=0,this.parentRule=null,this._importants={}};j.CSSStyleDeclaration.prototype={constructor:j.CSSStyleDeclaration,getPropertyValue:function(i){return this[i]||""},setProperty:function(i,e,t){if(this[i]){var r=Array.prototype.indexOf.call(this,i);r<0&&(this[this.length]=i,this.length++)}else this[this.length]=i,this.length++;this[i]=e+"",this._importants[i]=t},removeProperty:function(i){if(!(i in this))return"";var e=Array.prototype.indexOf.call(this,i);if(e<0)return"";var t=this[i];return this[i]="",Array.prototype.splice.call(this,e,1),t},getPropertyCSSValue:function(){},getPropertyPriority:function(i){return this._importants[i]||""},getPropertyShorthand:function(){},isPropertyImplicit:function(){},get cssText(){for(var i=[],e=0,t=this.length;e<t;++e){var r=this[e],l=this.getPropertyValue(r),s=this.getPropertyPriority(r);s&&(s=" !"+s),i[e]=r+": "+l+s+";"}return i.join(" ")},set cssText(i){var e,t;for(e=this.length;e--;)t=this[e],this[t]="";Array.prototype.splice.call(this,0,this.length),this._importants={};var r=j.parse("#bogus{"+i+"}").cssRules[0].style,l=r.length;for(e=0;e<l;++e)t=r[e],this.setProperty(r[e],r.getPropertyValue(t),r.getPropertyPriority(t))}};at.CSSStyleDeclaration=j.CSSStyleDeclaration;j.parse=ne().parse});var ut=h(St=>{var Ce={CSSStyleSheet:ee().CSSStyleSheet,CSSRule:d().CSSRule,CSSStyleRule:Q().CSSStyleRule,CSSGroupingRule:U().CSSGroupingRule,CSSConditionRule:N().CSSConditionRule,CSSMediaRule:Se().CSSMediaRule,CSSSupportsRule:ue().CSSSupportsRule,CSSStyleDeclaration:V().CSSStyleDeclaration,CSSKeyframeRule:ce().CSSKeyframeRule,CSSKeyframesRule:he().CSSKeyframesRule};Ce.clone=function i(e){var t=new Ce.CSSStyleSheet,r=e.cssRules;if(!r)return t;for(var l=0,s=r.length;l<s;l++){var n=r[l],o=t.cssRules[l]=new n.constructor,S=n.style;if(S){for(var u=o.style=new Ce.CSSStyleDeclaration,a=0,x=S.length;a<x;a++){var D=u[a]=S[a];u[D]=S[D],u._importants[D]=S.getPropertyPriority(D)}u.length=S.length}n.hasOwnProperty("keyText")&&(o.keyText=n.keyText),n.hasOwnProperty("selectorText")&&(o.selectorText=n.selectorText),n.hasOwnProperty("mediaText")&&(o.mediaText=n.mediaText),n.hasOwnProperty("conditionText")&&(o.conditionText=n.conditionText),n.hasOwnProperty("cssRules")&&(o.cssRules=i(n).cssRules)}return t};St.clone=Ce.clone});var ct=h(p=>{"use strict";p.CSSStyleDeclaration=V().CSSStyleDeclaration;p.CSSRule=d().CSSRule;p.CSSGroupingRule=U().CSSGroupingRule;p.CSSConditionRule=N().CSSConditionRule;p.CSSStyleRule=Q().CSSStyleRule;p.MediaList=ae().MediaList;p.CSSMediaRule=Se().CSSMediaRule;p.CSSSupportsRule=ue().CSSSupportsRule;p.CSSImportRule=ke().CSSImportRule;p.CSSFontFaceRule=_e().CSSFontFaceRule;p.CSSHostRule=Te().CSSHostRule;p.StyleSheet=we().StyleSheet;p.CSSStyleSheet=ee().CSSStyleSheet;p.CSSKeyframesRule=he().CSSKeyframesRule;p.CSSKeyframeRule=ce().CSSKeyframeRule;p.MatcherList=Ie().MatcherList;p.CSSDocumentRule=Oe().CSSDocumentRule;p.CSSValue=Me().CSSValue;p.CSSValueExpression=Ee().CSSValueExpression;p.parse=ne().parse;p.clone=ut().clone});var xe=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},z,kt=class{constructor(){z.set(this,{Array:i=>Array.isArray(i),"string[]":i=>Array.isArray(i)&&i.every(e=>typeof e=="string")})}for(i){return Array.isArray(i)||(console.warn(`[JSTC.for] @briklab/lib/jstc: Invalid first argument!
|
|
13
|
+
Hint: The first argument must be a array.
|
|
14
|
+
Using [givenValue] as fallback`),i=[i]),{check:e=>{if(Array.isArray(e)||(console.warn(`[JSTC.for().check] @briklab/lib/jstc: Invalid first argument!
|
|
15
|
+
Hint: The first argument must be a valid array!
|
|
16
|
+
Using [givenValue] as fallback`),e=[e]),i.length<e.length)return!1;for(let t=0;t<e.length;t++){let r=i[t],l=e[t],s=Array.isArray(l)?l:[l],n=!1;for(let o of s){let S=typeof o=="string"?o.split("|"):[o];for(let u of S)if(typeof u=="function"){if(r instanceof u){n=!0;break}}else if(typeof u=="string"&&xe(this,z,"f")[u]){if(xe(this,z,"f")[u](r)){n=!0;break}}else if(typeof r===u){n=!0;break}if(n)break}if(!n)return!1}return!0}}}addCustomHandler(i,e){typeof i=="string"&&typeof e=="function"||(console.warn(`[JSTC.addCustomHandler] @briklab/lib/jstc: Invalid Arguments!
|
|
17
|
+
Hint: The first argument must be a string, and the second argument must be a function
|
|
18
|
+
Using String(argument1) and ()=>false as fallbacks`),i=String(i),e=()=>!1),xe(this,z,"f")[i]=e}};z=new WeakMap;var _t=new kt,O=_t;var Le=wt(ct(),1);var m=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},C,$e,Re,ye,pt,qe,Pe,ht={red:"#ff0000",blue:"#0000ff",green:"#00ff00",yellow:"#ffff00",orange:"#ffa500",black:"#000000",white:"#ffffff",gray:"#808080"},G=class i{constructor(e){if(C.add(this),this.r=0,this.g=0,this.b=0,this.a=1,typeof e=="string")m(this,C,"m",pt).call(this,e);else if("r"in e&&"g"in e&&"b"in e)this.r=m(this,C,"m",Re).call(this,e.r),this.g=m(this,C,"m",Re).call(this,e.g),this.b=m(this,C,"m",Re).call(this,e.b),this.a=e.a??1;else if("h"in e&&"s"in e&&"l"in e){let{r:t,g:r,b:l}=m(this,C,"m",qe).call(this,e.h,e.s,e.l);this.r=t,this.g=r,this.b=l,this.a=e.a??1}else console.warn(`[Color.constructor] Invalid first argument!
|
|
19
|
+
Hint: The first argument must be a valid color array
|
|
20
|
+
Using black as fallback.`)}hex(){return`#${m(this,C,"m",ye).call(this,this.r)}${m(this,C,"m",ye).call(this,this.g)}${m(this,C,"m",ye).call(this,this.b)}`}rgb(){return`rgb(${this.r}, ${this.g}, ${this.b})`}rgba(){return`rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`}hsl(){let{h:e,s:t,l:r}=m(this,C,"m",Pe).call(this,this.r,this.g,this.b);return`hsl(${e}, ${t}%, ${r}%)`}hsla(){let{h:e,s:t,l:r}=m(this,C,"m",Pe).call(this,this.r,this.g,this.b);return`hsla(${e}, ${t}%, ${r}%, ${this.a})`}css(){return this.a===1?this.hex():this.rgba()}ansiTruecolor(){return`\x1B[38;2;${this.r};${this.g};${this.b}m`}ansiTruecolorBg(){return`\x1B[48;2;${this.r};${this.g};${this.b}m`}ansi256(){return`\x1B[38;5;${m(this,C,"m",$e).call(this,this.r,this.g,this.b)}m`}ansi256Bg(){return`\x1B[48;5;${m(this,C,"m",$e).call(this,this.r,this.g,this.b)}m`}wrapAnsi(e,t={}){let r=!!t.use256,l=t.background?r?this.ansi256Bg():this.ansiTruecolorBg():r?this.ansi256():this.ansiTruecolor();return`${`${t.bold?i.BOLD:""}${t.underline?i.UNDERLINE:""}`}${l}${e}${i.RESET}`}};C=new WeakSet,$e=function(e,t,r){if(e===t&&t===r)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;let l=S=>Math.round(S/255*5),s=l(e),n=l(t),o=l(r);return 16+36*s+6*n+o},Re=function(e){return Math.max(0,Math.min(255,e))},ye=function(e){return e.toString(16).padStart(2,"0")},pt=function(e){if(e=e.trim().toLowerCase(),ht[e]&&(e=ht[e]),e.startsWith("#")){let t=e.slice(1);t.length===3?(this.r=parseInt(t[0]+t[0],16),this.g=parseInt(t[1]+t[1],16),this.b=parseInt(t[2]+t[2],16)):t.length===6?(this.r=parseInt(t.slice(0,2),16),this.g=parseInt(t.slice(2,4),16),this.b=parseInt(t.slice(4,6),16)):console.warn(`[Color class] @briklab/lib/color: Invalid hex!
|
|
21
|
+
Hint: You must pass a valid hex color string!
|
|
22
|
+
Using black as fallback.`)}else if(e.startsWith("rgb")){let t=e.match(/[\d.]+/g)?.map(Number);t&&t.length>=3&&([this.r,this.g,this.b]=t,this.a=t[3]??1)}else if(e.startsWith("hsl")){let t=e.match(/[\d.]+/g)?.map(Number);if(t&&t.length>=3){let{r,g:l,b:s}=m(this,C,"m",qe).call(this,t[0],t[1],t[2]);this.r=r,this.g=l,this.b=s,this.a=t[3]??1}}else console.warn(`[Color class] @briklab/lib/color: Unknown color string "${e}"!
|
|
23
|
+
Hint: The argument must be a valid color string!
|
|
24
|
+
Using black as fallback.`)},qe=function(e,t,r){t/=100,r/=100;let l=o=>(o+e/30)%12,s=t*Math.min(r,1-r),n=o=>r-s*Math.max(-1,Math.min(l(o)-3,Math.min(9-l(o),1)));return{r:Math.round(n(0)*255),g:Math.round(n(8)*255),b:Math.round(n(4)*255)}},Pe=function(e,t,r){e/=255,t/=255,r/=255;let l=Math.max(e,t,r),s=Math.min(e,t,r),n=0,o=0,S=(l+s)/2;if(l!==s){let u=l-s;switch(o=S>.5?u/(2-l-s):u/(l+s),l){case e:n=(t-r)/u+(t<r?6:0);break;case t:n=(r-e)/u+2;break;case r:n=(e-t)/u+4;break}n*=60}return{h:Math.round(n),s:Math.round(o*100),l:Math.round(S*100)}};G.RESET="\x1B[0m";G.BOLD="\x1B[1m";G.UNDERLINE="\x1B[4m";var te=G;var de=function(i,e,t,r,l){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!l)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!l:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?l.call(i,t):l?l.value=t:e.set(i,t),t},v=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},me,ge,ft,Rt,A,F,be=class{constructor(e){me.add(this),ge.set(this,void 0),A.set(this,void 0),O.for([e]).check(["object|undefined"])||(console.warn(`[InlineStyle class] @briklab/lib/stylesheet: Invalid first argument!
|
|
25
|
+
Hint: The first argument must be a valid style object or not be given!
|
|
26
|
+
Using {"imeMode":givenValue} as fallback`),e={imeMode:`${e}`}),de(this,A,e,"f"),de(this,ge,new Le.CSSStyleDeclaration,"f")}generate(){let e=v(this,ge,"f"),t=v(this,A,"f"),r=Object.keys(t),l=Object.values(t);for(let s=0;s<r.length;s++){let n=r[s],o=l[s];if(o==null){console.warn(`[InlineStyle.generate] @briklab/lib/stylesheet: Skipping property "${n}" with ${String(o)} value. Hint: avoid null/undefined style values.`);continue}typeof o!="string"&&(console.warn(`[InlineStyle.generate] @briklab/lib/stylesheet: Non-string style value for "${n}" (type=${typeof o}). Coercing to string.`),o=String(o)),e.setProperty(n,o)}return e.cssText}get text(){return this.generate()}get ansi(){let e=v(this,A,"f")||{},t=[];(e["font-weight"]==="bold"||e.fontWeight==="bold")&&t.push(te.BOLD),(e["text-decoration"]||e.textDecoration||"").includes("underline")&&t.push(te.UNDERLINE);let r=e.color||e.color;if(r)try{let s=new te(String(r));t.push(s.ansiTruecolor())}catch{console.warn(`[InlineStyle.ansi] @briklab/lib/stylesheet: Invalid color value "${String(r)}" \u2014 ignoring. Hint: use a valid hex, rgb(), hsl() or named color.`)}let l=e["background-color"]||e.backgroundColor;if(l)try{let s=new te(String(l));t.push(s.ansiTruecolorBg())}catch{console.warn(`[InlineStyle.ansi] @briklab/lib/stylesheet: Invalid background-color value "${String(l)}" \u2014 ignoring. Hint: use a valid hex, rgb(), hsl() or named color.`)}return t.join("")}addStyleWithObject(e){return O.for([e]).check(["object"])?(de(this,A,{...v(this,A,"f"),...e},"f"),this.generate(),this):(console.warn(`[InlineStyle.addStyleWithObject] @briklab/lib/stylesheet: Invalid first argument!
|
|
27
|
+
Hint: expected a plain object with CSS properties. Received: ${String(e)}
|
|
28
|
+
Returned with no operations.`),this)}addStyleWithInlineCSS(e){if(!O.for([e]).check(["string"]))return console.warn(`[InlineStyle.addStyleWithInlineCSS] @briklab/lib/stylesheet: Invalid first argument!
|
|
29
|
+
Hint: The first argument must be a valid inline css string!
|
|
30
|
+
Returned with no operations.`),this;let t=new Le.CSSStyleDeclaration;t.cssText=v(this,me,"m",Rt).call(this,e);let r={};for(let l=0;l<t.length;l++){let s=t[l],n=t.getPropertyValue(s);r[s]=n}return this.addStyleWithObject(r),this}removeStyle(e){if(!O.for([e]).check(["string[]|string"]))return console.warn(`[InlineStyle.removeStyle] @briklab/lib/stylesheet: Invalid first argument!
|
|
31
|
+
Hint: expected a string or array of strings. Returned with no operations. Received: ${String(e)}`),this;typeof e=="string"&&(e=[e]);for(let t=0;t<e.length;t++){let r=e[t];if(typeof r!="string"){console.warn(`[InlineStyle.removeStyle] @briklab/lib/stylesheet: Ignoring non-string style name at index ${t}: ${String(r)}`);continue}delete v(this,A,"f")[r]}return this}applyTo(e){return O.for([e]).check(["object"])?!e||typeof e.style!="object"?(console.warn("[InlineStyle.applyTo] @briklab/lib/stylesheet: Given object does not look like an HTMLElement (missing .style). No operation was performed."),this):(e.style.cssText=this.generate(),this):(console.warn(`[InlineStyle.applyTo] @briklab/lib/stylesheet: Invalid first argument!
|
|
32
|
+
Hint: expected an HTMLElement. No operation was performed.`),this)}};ge=new WeakMap,A=new WeakMap,me=new WeakSet,ft=function(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)},Rt=function(e){let t=String(e).split(";"),r="";for(let l=0;l<t.length;l++){let s=t[l].trim();if(!s)continue;let n=s.split(":");if(n.length<2){console.warn(`[InlineStyle.#convertKeysToValidCSS] @briklab/lib/stylesheet: Skipping malformed rule: "${s}". Hint: expected "property: value" pairs separated by ";"`);continue}let o=n[0].trim(),S=n.slice(1).join(":").trim();if(!o||!S){console.warn(`[InlineStyle.#convertKeysToValidCSS] @briklab/lib/stylesheet: Skipping empty property or value in rule: "${s}".`);continue}r+=`${v(this,me,"m",ft).call(this,o)}:${S};`}return r};var tr=be,Ct=class{constructor(){F.set(this,void 0),de(this,F,{},"f")}set(e,t){return O.for([e,t]).check(["string","object"])?t instanceof be?(v(this,F,"f")[e]=t,this):(console.warn(`[StyleSheet.set] @briklab/lib/stylesheet: Provided style is not an InlineStyle instance!
|
|
33
|
+
Hint: create the style with new InlineStyle({...}). Received: ${String(t)}. Returned with no operations.`),this):(console.warn(`[StyleSheet.set] @briklab/lib/stylesheet: Invalid arguments!
|
|
34
|
+
Hint: call .set("ruleName", new InlineStyle({...})). Received name=${String(e)}, style=${String(t)}. Returned with no operations.`),this)}get(e){if(!O.for([e]).check(["string"])){console.warn(`[StyleSheet.get] @briklab/lib/stylesheet: Invalid argument!
|
|
35
|
+
Hint: name must be a string. Received: ${String(e)}. Returned undefined.`);return}return v(this,F,"f")[e]}remove(e){return O.for([e]).check(["string"])?(delete v(this,F,"f")[e],this):(console.warn(`[StyleSheet.remove] @briklab/lib/stylesheet: Invalid argument!
|
|
36
|
+
Hint: name must be a string. Received: ${String(e)}. No-op.`),this)}generate(){let e="";for(let t in v(this,F,"f")){let r=v(this,F,"f")[t];r&&(e+=`${t} { ${r.text} }
|
|
37
|
+
`)}return e.trim()}toString(){return this.generate()}};F=new WeakMap;export{Ct as StyleSheet,tr as default};
|
|
38
|
+
//# sourceMappingURL=index.js.map
|