jb-core 0.29.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configs/global.d.ts +10 -6
- package/dist/index.cjs.js.gz +0 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +43 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js.gz +0 -0
- package/dist/index.umd.js.map +1 -1
- package/i18n/dist/index.cjs.js +35 -39
- package/i18n/dist/index.cjs.js.br +0 -0
- package/i18n/dist/index.cjs.js.gz +0 -0
- package/i18n/dist/index.cjs.js.map +1 -1
- package/i18n/dist/index.d.ts +39 -2
- package/i18n/dist/index.d.ts.map +1 -1
- package/i18n/dist/index.js +36 -39
- package/i18n/dist/index.js.br +0 -0
- package/i18n/dist/index.js.gz +0 -0
- package/i18n/dist/index.js.map +1 -1
- package/i18n/dist/index.umd.js +32 -36
- package/i18n/dist/index.umd.js.br +0 -0
- package/i18n/dist/index.umd.js.gz +0 -0
- package/i18n/dist/index.umd.js.map +1 -1
- package/index.js +2 -1
- package/package.json +1 -1
- package/react/dist/index.cjs.js +11 -11
- package/react/dist/index.cjs.js.map +1 -1
- package/react/dist/index.d.ts +25 -2
- package/react/dist/index.js +18 -18
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.umd.js +8 -7
- package/react/dist/index.umd.js.map +1 -1
- package/react/lib/hooks/useLazyRef.ts +1 -3
- package/theme/dist/index.cjs.js +82 -52
- package/theme/dist/index.cjs.js.br +0 -0
- package/theme/dist/index.cjs.js.gz +0 -0
- package/theme/dist/index.cjs.js.map +1 -1
- package/theme/dist/index.d.ts +73 -4
- package/theme/dist/index.d.ts.map +1 -1
- package/theme/dist/index.js +53 -23
- package/theme/dist/index.js.br +0 -0
- package/theme/dist/index.js.gz +0 -0
- package/theme/dist/index.js.map +1 -1
- package/theme/dist/index.umd.js +53 -23
- package/theme/dist/index.umd.js.br +0 -0
- package/theme/dist/index.umd.js.gz +0 -0
- package/theme/dist/index.umd.js.map +1 -1
- package/theme/lib/sizes/index.ts +83 -43
- package/theme/stories/sizes.mdx +15 -5
package/i18n/dist/index.umd.js
CHANGED
|
@@ -1,52 +1,48 @@
|
|
|
1
1
|
(function(e, t) {
|
|
2
2
|
"object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).JBCoreI18N = {});
|
|
3
3
|
})(this, function(e) {
|
|
4
|
-
function t(e, t, n, a) {
|
|
5
|
-
if ("a" === n && !a) throw new TypeError("Private accessor was defined without a getter");
|
|
6
|
-
if ("function" == typeof t ? e !== t || !a : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
7
|
-
return "m" === n ? a : "a" === n ? a.call(e) : a ? a.value : t.get(e);
|
|
8
|
-
}
|
|
9
|
-
var n, a, i, o;
|
|
10
4
|
Object.defineProperty(e, Symbol.toStringTag, { value: "Module" });
|
|
11
|
-
var
|
|
5
|
+
var t = class {
|
|
6
|
+
#e = { localeChange: [] };
|
|
12
7
|
constructor() {
|
|
13
|
-
|
|
8
|
+
this.#t(), this.#n();
|
|
9
|
+
}
|
|
10
|
+
#t() {
|
|
11
|
+
if ("fa" === (document?.documentElement?.lang || "en")) this.locale = new Intl.Locale("fa", {
|
|
12
|
+
calendar: "persian",
|
|
13
|
+
numeric: !1,
|
|
14
|
+
region: "IR"
|
|
15
|
+
});
|
|
16
|
+
else this.locale = new Intl.Locale("en", {
|
|
17
|
+
calendar: "gregory",
|
|
18
|
+
region: "US"
|
|
19
|
+
});
|
|
14
20
|
}
|
|
15
21
|
setLocale(e) {
|
|
16
22
|
this.locale = e, this.callListeners("localeChange");
|
|
17
23
|
}
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
#n() {
|
|
25
|
+
new MutationObserver((e) => {
|
|
26
|
+
e.forEach((e) => {
|
|
27
|
+
"lang" == e.attributeName && (this.#t(), this.callListeners("localeChange"));
|
|
28
|
+
});
|
|
29
|
+
}).observe(document.documentElement, {
|
|
30
|
+
attributeFilter: ["lang"],
|
|
31
|
+
childList: !1,
|
|
32
|
+
subtree: !1,
|
|
33
|
+
attributes: !0
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
addEventListener(e, t) {
|
|
37
|
+
this.#e[e].push(t);
|
|
20
38
|
}
|
|
21
39
|
callListeners(e) {
|
|
22
|
-
|
|
40
|
+
this.#e[e].forEach((e) => {
|
|
23
41
|
e();
|
|
24
42
|
});
|
|
25
43
|
}
|
|
26
44
|
};
|
|
27
|
-
|
|
28
|
-
if ("fa" === (document?.documentElement?.lang || "en")) this.locale = new Intl.Locale("fa", {
|
|
29
|
-
calendar: "persian",
|
|
30
|
-
numeric: !1,
|
|
31
|
-
region: "IR"
|
|
32
|
-
});
|
|
33
|
-
else this.locale = new Intl.Locale("en", {
|
|
34
|
-
calendar: "gregory",
|
|
35
|
-
region: "US"
|
|
36
|
-
});
|
|
37
|
-
}, o = function() {
|
|
38
|
-
new MutationObserver((e) => {
|
|
39
|
-
e.forEach((e) => {
|
|
40
|
-
"lang" == e.attributeName && (t(this, n, "m", i).call(this), this.callListeners("localeChange"));
|
|
41
|
-
});
|
|
42
|
-
}).observe(document.documentElement, {
|
|
43
|
-
attributeFilter: ["lang"],
|
|
44
|
-
childList: !1,
|
|
45
|
-
subtree: !1,
|
|
46
|
-
attributes: !0
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
const r = new l();
|
|
45
|
+
const n = new t();
|
|
50
46
|
e.JBDictionary = class {
|
|
51
47
|
constructor(e) {
|
|
52
48
|
this.dictionary = {}, this.dictionary = e;
|
|
@@ -58,9 +54,9 @@
|
|
|
58
54
|
const n = this.dictionary[e.locale.language] ? this.dictionary[e.locale.language] : this.dictionary.en;
|
|
59
55
|
return n[t] ? n[t] : this.dictionary.en[t];
|
|
60
56
|
}
|
|
61
|
-
}, e.JBI18N =
|
|
57
|
+
}, e.JBI18N = t, e.getRequiredMessage = function(e, t) {
|
|
62
58
|
return "fa" === e.locale.language ? t ? `لطفاً ${t} خود را وارد نمایید` : "لطفاً این قسمت را پر کنید" : t ? `Please enter your ${t}` : "Please complete this field";
|
|
63
|
-
}, e.i18n =
|
|
59
|
+
}, e.i18n = n;
|
|
64
60
|
});
|
|
65
61
|
|
|
66
62
|
//# sourceMappingURL=index.umd.js.map
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","names":[],"sources":["../../../../node_modules/tslib/tslib.es6.js","../lib/file:/A:/Home/NeveshtAfzar/work/Azad/source/design-system/design-system/modules/jb-core/i18n/lib/i18n.ts","../lib/file:/A:/Home/NeveshtAfzar/work/Azad/source/design-system/design-system/modules/jb-core/i18n/lib/dictionary.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\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\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n",null,null],"x_google_ignoreList":[0],"mappings":";;;CA8RA,SAAgB,EAAuB,GAAU,GAAO,GAAM,GAAA;EAC1D,IAAa,QAAT,KAAA,CAAiB,GAAG,MAAM,IAAI,UAAU,+CAAA;EAC5C,IAAqB,cAAA,OAAV,IAAuB,MAAa,KAAA,CAAU,IAAA,CAAK,EAAM,IAAI,CAAA,GAAW,MAAM,IAAI,UAAU,0EAAA;EACvG,OAAgB,QAAT,IAAe,IAAa,QAAT,IAAe,EAAE,KAAK,CAAA,IAAY,IAAI,EAAE,QAAQ,EAAM,IAAI,CAAA;CACxF;CAAA,IAAA,GAAA,GAAA,GAAA;CAAA,OAAA,eAAA,GAAA,OAAA,aAAA,EAAA,OAAA,SAAA,CAAA;CC3RA,IAAa,IAAb,MAAA;EAKE,cAAA;GAAA,EAAA,IAAA,IAAA,GAHA,EAAA,IAAA,MAAgC,EAC9B,cAAa,CAAA,EAAA,CAAA,GAGb,EAAA,MAAI,GAAA,KAAA,CAAA,CAAA,CAAU,KAAd,IAAA,GACA,EAAA,MAAI,GAAA,KAAA,CAAA,CAAA,CAA0B,KAA9B,IAAA;EACF;EAoBA,UAAU,GAAA;GACR,KAAK,SAAS,GACd,KAAK,cAAc,cAAA;EACrB;EAYA,iBAAqD,GAAO,GAAA;GAC1D,EAAA,MAAI,GAAA,GAAA,CAAA,CAAY,EAAA,CAAK,KAAK,CAAA;EAC5B;EACA,cAAc,GAAA;GACZ,EAAA,MAAI,GAAA,GAAA,CAAA,CAAY,EAAA,CAAK,SAAQ,MAAA;IAAI,EAAA;GAAA,CAAA;EACnC;CAAA;CAAA,oBAAA,IAAA,QAAA,GAAA,oBAAA,IAAA,QAAA,GAAA,IAAA,WAAA;EArCE,IACO,UAFM,UAAU,iBAAiB,QAAQ,OAG5C,KAAK,SAAS,IAAI,KAAK,OAAO,MAAM;GAClC,UAAU;GACV,SAAA,CAAS;GACT,QAAQ;EAAA,CAAA;OAKV,KAAK,SAAS,IAAI,KAAK,OAAO,MAAM;GAClC,UAAU;GACV,QAAQ;EAAA,CAAA;CAIhB,GAAC,IAAA,WAAA;EAcC,IARqB,kBAAkB,MAAA;GACrC,EAAU,SAAS,MAAA;IACY,UAA1B,EAAS,kBACV,EAAA,MAAI,GAAA,KAAA,CAAA,CAAA,CAAU,KAAd,IAAA,GACA,KAAK,cAAc,cAAA;GAAA,CAAA;EAAA,CAAA,CAAA,CAIhB,QAAQ,SAAS,iBAAgB;GAAC,iBAAgB,CAAC,MAAA;GAAQ,WAAA,CAAU;GAAM,SAAA,CAAQ;GAAM,YAAA,CAAW;EAAA,CAAA;CAC/G;CASF,MAAa,IAAO,IAAI;CAAA,EAAA,eC/CxB,MAAA;EAEE,YAAY,GAAA;GADZ,KAAA,aAA+B,CAAA,GAE7B,KAAK,aAAa;EACpB;EAMA,YAAY,GAAmB,GAAA;GAC7B,KAAK,WAAW,KAAe;EACjC;EAQA,IAAuB,GAAY,GAAA;GACjC,MAAM,IAAM,KAAK,WAAW,EAAK,OAAO,YAAU,KAAK,WAAW,EAAK,OAAO,YAAU,KAAK,WAAW;GACxG,OAAO,EAAI,KAAK,EAAI,KAAK,KAAK,WAAW,GAAM;EACjD;CAAA,GAAA,EAAA,SAAA,GAAA,EAAA,qBAhCF,SAAmC,GAAe,GAAA;EAChD,OACO,SADA,EAAQ,OAAO,WAEX,IAAM,SAAS,EAAA,uBAA2B,8BAG1C,IAAM,qBAAqB,MAAQ;CAEhD,GAAA,EAAA,OAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.umd.js","names":["#initLang","#listenForAttributeChange","#listeners"],"sources":["../lib/i18n.ts","../lib/dictionary.ts"],"sourcesContent":["/**\r\n this is the core module of i18n in jb design system its is just a main store for keeping data and change config.\r\n every helper method will implement as an independent functions and class, so modules only use instance of an this class as a input to each used function\r\n*/\r\ntype I18nEventListeners = {\r\n localeChange:VoidFunction[]\r\n}\r\nexport class JBI18N {\r\n locale!: Intl.Locale\r\n #listeners:I18nEventListeners = {\r\n localeChange:[]\r\n }\r\n constructor() {\r\n this.#initLang();\r\n this.#listenForAttributeChange()\r\n }\r\n #initLang(){\r\n const lang = document?.documentElement?.lang || \"en\"\r\n switch (lang) {\r\n case \"fa\":\r\n this.locale = new Intl.Locale(\"fa\", {\r\n calendar: \"persian\",\r\n numeric: false,\r\n region: \"IR\",\r\n })\r\n break;\r\n case \"en\":\r\n default:\r\n this.locale = new Intl.Locale(\"en\", {\r\n calendar: \"gregory\",\r\n region: \"US\",\r\n });\r\n break;\r\n }\r\n }\r\n setLocale(locale: Intl.Locale) {\r\n this.locale = locale;\r\n this.callListeners(\"localeChange\")\r\n }\r\n #listenForAttributeChange() {\r\n const observer = new MutationObserver((mutations) => {\r\n mutations.forEach((mutation)=>{\r\n if(mutation.attributeName == \"lang\"){\r\n this.#initLang();\r\n this.callListeners(\"localeChange\")\r\n }\r\n })\r\n });\r\n observer.observe(document.documentElement,{attributeFilter:[\"lang\"],childList:false,subtree:false,attributes:true})\r\n }\r\n addEventListener<K extends keyof I18nEventListeners>(key:K, callback:I18nEventListeners[K][0]){\r\n this.#listeners[key].push(callback)\r\n }\r\n callListeners(key:keyof I18nEventListeners){\r\n this.#listeners[key].forEach(x=>{x()});\r\n }\r\n}\r\n\r\nexport const i18n = new JBI18N();\r\n","import type { JBI18N } from \"./i18n\";\r\n\r\nexport function getRequiredMessage(context:JBI18N,label?:string|null){\r\n switch(context.locale.language){\r\n case 'fa':\r\n return label?`لطفاً ${label} خود را وارد نمایید`:'لطفاً این قسمت را پر کنید';\r\n case 'en':\r\n default:\r\n return label?`Please enter your ${label}`:'Please complete this field';\r\n }\r\n}\r\nexport class JBDictionary<T extends object> { \r\n dictionary: Record<string,T> = {}\r\n constructor(initialDictionary:Record<string,T>){\r\n this.dictionary = initialDictionary;\r\n }\r\n /**\r\n * add new or replace existing language with given dictionary\r\n * @param languageKey language standard key like \"fa\" or \"en\"\r\n * @param dictionary key value object of strings and messages\r\n */\r\n setLanguage(languageKey:string,dictionary:T){\r\n this.dictionary[languageKey] = dictionary;\r\n }\r\n //TODO: add support for nested path\r\n /**\r\n * get value of given key in dictionary with fallback to english dictionary\r\n * @param i18n instance of i18n config\r\n * @param key key of dictionary object\r\n * @returns value of the dictionary with \"en\" fallback\r\n */\r\n get<K extends keyof T>(i18n:JBI18N,key:K):T[K]{\r\n const obj = this.dictionary[i18n.locale.language]?this.dictionary[i18n.locale.language]:this.dictionary[\"en\"];\r\n return obj[key]?obj[key]:this.dictionary[\"en\"][key];\r\n }\r\n}"],"mappings":";;;;CAOA,IAAa,IAAb,MAAA;EAEE,KAAgC,EAC9B,cAAa,CAAA,EAAA;EAEf,cAAA;GACE,KAAA,GAAKA,GACL,KAAA,GAAKC;EACP;EACA,KAAA;GAEE,IACO,UAFM,UAAU,iBAAiB,QAAQ,OAG5C,KAAK,SAAS,IAAI,KAAK,OAAO,MAAM;IAClC,UAAU;IACV,SAAA,CAAS;IACT,QAAQ;GAAA,CAAA;QAKV,KAAK,SAAS,IAAI,KAAK,OAAO,MAAM;IAClC,UAAU;IACV,QAAQ;GAAA,CAAA;EAIhB;EACA,UAAU,GAAA;GACR,KAAK,SAAS,GACd,KAAK,cAAc,cAAA;EACrB;EACA,KAAA;GASE,IARqB,kBAAkB,MAAA;IACrC,EAAU,SAAS,MAAA;KACY,UAA1B,EAAS,kBACV,KAAA,GAAKD,GACL,KAAK,cAAc,cAAA;IAAA,CAAA;GAAA,CAAA,CAAA,CAIhB,QAAQ,SAAS,iBAAgB;IAAC,iBAAgB,CAAC,MAAA;IAAQ,WAAA,CAAU;IAAM,SAAA,CAAQ;IAAM,YAAA,CAAW;GAAA,CAAA;EAC/G;EACA,iBAAqD,GAAO,GAAA;GAC1D,KAAA,GAAgB,EAAA,CAAK,KAAK,CAAA;EAC5B;EACA,cAAc,GAAA;GACZ,KAAA,GAAgB,EAAA,CAAK,SAAQ,MAAA;IAAI,EAAA;GAAA,CAAA;EACnC;CAAA;CAGF,MAAa,IAAO,IAAI;CAAA,EAAA,eC/CxB,MAAA;EAEE,YAAY,GAAA;GAAA,KAAA,aADmB,CAAC,GAE9B,KAAK,aAAa;EACpB;EAMA,YAAY,GAAmB,GAAA;GAC7B,KAAK,WAAW,KAAe;EACjC;EAQA,IAAuB,GAAY,GAAA;GACjC,MAAM,IAAM,KAAK,WAAW,EAAK,OAAO,YAAU,KAAK,WAAW,EAAK,OAAO,YAAU,KAAK,WAAW;GACxG,OAAO,EAAI,KAAK,EAAI,KAAK,KAAK,WAAW,GAAM;EACjD;CAAA,GAAA,EAAA,SAAA,GAAA,EAAA,qBAhCF,SAAmC,GAAe,GAAA;EAChD,OACO,SADA,EAAQ,OAAO,WAEX,IAAM,SAAS,EAAA,uBAA2B,8BAG1C,IAAM,qBAAqB,MAAQ;CAEhD,GAAA,EAAA,OAAA;AAAA,CAAA"}
|
package/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from './dist/index.js';
|
|
1
|
+
export * from './dist/index.js';
|
|
2
|
+
|
package/package.json
CHANGED
package/react/dist/index.cjs.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let e = require("react");
|
|
3
3
|
const t = (t) => {
|
|
4
|
-
|
|
5
|
-
return null ===
|
|
4
|
+
const n = (0, e.useRef)(null);
|
|
5
|
+
return null === n.current && (n.current = t()), n;
|
|
6
6
|
};
|
|
7
|
-
exports.useEvent = function(t,
|
|
8
|
-
|
|
9
|
-
t.current && "function" == typeof
|
|
10
|
-
}, [t,
|
|
7
|
+
exports.useEvent = function(t, n, r, u = !1) {
|
|
8
|
+
const s = (0, e.useCallback)((e) => {
|
|
9
|
+
t.current && "function" == typeof r && r(e);
|
|
10
|
+
}, [t, r]);
|
|
11
11
|
(0, e.useEffect)(() => {
|
|
12
|
-
|
|
13
|
-
return e && e.addEventListener(
|
|
12
|
+
const e = t.current;
|
|
13
|
+
return e && e.addEventListener(n, s, {
|
|
14
14
|
passive: u,
|
|
15
15
|
capture: !1
|
|
16
16
|
}), function() {
|
|
17
|
-
e && e.removeEventListener(
|
|
17
|
+
e && e.removeEventListener(n, s, {
|
|
18
18
|
passive: u,
|
|
19
19
|
capture: !1
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
}, [
|
|
23
23
|
t,
|
|
24
|
-
r,
|
|
25
24
|
n,
|
|
25
|
+
r,
|
|
26
26
|
u
|
|
27
27
|
]);
|
|
28
|
-
}, exports.useInstance = (e,
|
|
28
|
+
}, exports.useInstance = (e, n) => t(() => new e(...n)).current, exports.useLazyRef = t;
|
|
29
29
|
|
|
30
30
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","names":[],"sources":["../lib/hooks/
|
|
1
|
+
{"version":3,"file":"index.cjs.js","names":["useCallback","useEffect","useEvent","ref","event","handler","passive","internalHandler","e","current","dom","addEventListener","capture","cleanup","removeEventListener","useRef","useLazyRef","initValFunc","ref","current","useLazyRef","useInstance","Store","initializers","vm","current"],"sources":["../lib/hooks/use-event.ts","../lib/hooks/useLazyRef.ts","../lib/hooks/useInstance.ts"],"sourcesContent":["import { useCallback, useEffect } from \"react\";\r\n\r\nexport function useEvent<TRef extends React.MutableRefObject<any|null>,TEvent>(ref:TRef, event:string, handler?:(e:TEvent)=>void, passive = false) {\r\n const internalHandler = useCallback((e:TEvent)=>{\r\n if(ref.current && typeof handler == \"function\"){\r\n handler(e);\r\n }\r\n },[ref,handler]);\r\n useEffect(() => {\r\n const dom = ref.current;\r\n if (dom) {\r\n // initiate the event handler\r\n dom.addEventListener(event, internalHandler, { passive, capture:false }); \r\n }\r\n // this will clean up the event every time the component is re-rendered\r\n return function cleanup() {\r\n if(dom){\r\n dom.removeEventListener(event, internalHandler, {passive, capture:false});\r\n }\r\n };\r\n },[ref,event,handler,passive]);\r\n}","import { useRef, type RefObject } from \"react\";\r\n\r\ntype InitFunc<T> = ()=>T\r\nexport const useLazyRef = <T>(initValFunc:InitFunc<T>) => {\r\n const ref:RefObject<T|null> = useRef(null);\r\n if (ref.current === null) {\r\n ref.current = initValFunc();\r\n }\r\n return ref;\r\n};","import { useLazyRef } from \"./useLazyRef.js\";\r\n\r\n\r\ntype BaseConstructableClass<T = any> = new (...args: any[]) => T;\r\n\r\n// Type to get the constructor parameters of a class\r\ntype Initializers<T extends BaseConstructableClass> = ConstructorParameters<T>;\r\n\r\n// useInstance function that accepts a Store class and its initializers\r\n/**\r\n * create a instance of an class with lazy initialization\r\n * @param Store class to create instance of\r\n * @param initializers initializers to pass to the class constructor\r\n * @returns instance of the class\r\n */\r\nexport const useInstance = <T extends BaseConstructableClass>(Store: T, initializers: Initializers<T>): InstanceType<T> => {\r\n const vm = useLazyRef(() => new Store(...initializers));\r\n return vm.current;\r\n};\r\n"],"mappings":";;ACGA,MAAagB,KAAiBC,MAAAA;CAC5B,MAAMC,KAAAA,GAAAA,EAAAA,OAAAA,CAA+B,IAAA;CAIrC,OAHoB,SAAhBA,EAAIC,YACND,EAAIC,UAAUF,EAAAA,IAETC;AAAAA;AAAAA,QAAAA,WDNT,SAA+Ef,GAAUC,GAAcC,GAA2BC,IAAAA,CAAU,GAAA;CAC1I,MAAMC,KAAAA,GAAAA,EAAAA,YAAAA,EAA+BC,MAAAA;EAChCL,EAAIM,WAA6B,cAAA,OAAXJ,KACvBA,EAAQG,CAAAA;CAAAA,GAEV,CAACL,GAAIE,CAAAA,CAAAA;CAAAA,CACPJ,GAAAA,EAAAA,UAAAA,OAAAA;EACE,MAAMS,IAAMP,EAAIM;EAMhB,OALIC,KAEFA,EAAIC,iBAAiBP,GAAOG,GAAiB;GAAED,SAAAA;GAASM,SAAAA,CAAQ;EAAA,CAAA,GAG3D,WAAA;GACFF,KACDA,EAAII,oBAAoBV,GAAOG,GAAiB;IAACD,SAAAA;IAASM,SAAAA,CAAQ;GAAA,CAAA;EAEtE;CAAA,GACA;EAACT;EAAIC;EAAMC;EAAQC;CAAAA,CAAAA;AACvB,GAAA,QAAA,eEN8DgB,GAAUC,MAC3DH,QAAiB,IAAIE,EAAAA,GAASC,CAAAA,CAAAA,CAAAA,CAC/BE,SAAAA,QAAAA,aAAAA"}
|
package/react/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { DetailedHTMLProps, RefObject } from "react";
|
|
2
|
+
|
|
3
|
+
//#region modules/jb-core/react/lib/hooks/use-event.d.ts
|
|
4
|
+
declare function useEvent<TRef extends React.MutableRefObject<any | null>, TEvent>(ref: TRef, event: string, handler?: (e: TEvent) => void, passive?: boolean): void;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region modules/jb-core/react/lib/hooks/useInstance.d.ts
|
|
7
|
+
type BaseConstructableClass<T = any> = new (...args: any[]) => T;
|
|
8
|
+
type Initializers<T extends BaseConstructableClass> = ConstructorParameters<T>;
|
|
9
|
+
/**
|
|
10
|
+
* create a instance of an class with lazy initialization
|
|
11
|
+
* @param Store class to create instance of
|
|
12
|
+
* @param initializers initializers to pass to the class constructor
|
|
13
|
+
* @returns instance of the class
|
|
14
|
+
*/
|
|
15
|
+
declare const useInstance: <T extends BaseConstructableClass>(Store: T, initializers: Initializers<T>) => InstanceType<T>;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region modules/jb-core/react/lib/hooks/useLazyRef.d.ts
|
|
18
|
+
type InitFunc<T> = () => T;
|
|
19
|
+
declare const useLazyRef: <T>(initValFunc: InitFunc<T>) => RefObject<T | null>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region modules/jb-core/react/lib/types/index.d.ts
|
|
22
|
+
type ReactElementStandardProps<TElement = HTMLElement> = DetailedHTMLProps<React.HTMLAttributes<TElement>, TElement>;
|
|
23
|
+
type JBElementStandardProps<TElement = HTMLElement, TOmit extends string = never> = Omit<ReactElementStandardProps<TElement>, 'ref' | 'key' | TOmit>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { JBElementStandardProps, useEvent, useInstance, useLazyRef };
|
package/react/dist/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
function r(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}, [
|
|
1
|
+
import { useCallback as n, useEffect as t, useRef as e } from "react";
|
|
2
|
+
function r(e, r, c, u = !1) {
|
|
3
|
+
const o = n((n) => {
|
|
4
|
+
e.current && "function" == typeof c && c(n);
|
|
5
|
+
}, [e, c]);
|
|
6
6
|
t(() => {
|
|
7
|
-
|
|
8
|
-
return
|
|
9
|
-
passive:
|
|
7
|
+
const n = e.current;
|
|
8
|
+
return n && n.addEventListener(r, o, {
|
|
9
|
+
passive: u,
|
|
10
10
|
capture: !1
|
|
11
11
|
}), function() {
|
|
12
|
-
|
|
13
|
-
passive:
|
|
12
|
+
n && n.removeEventListener(r, o, {
|
|
13
|
+
passive: u,
|
|
14
14
|
capture: !1
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
}, [
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
e,
|
|
19
|
+
r,
|
|
20
20
|
c,
|
|
21
|
-
|
|
21
|
+
u
|
|
22
22
|
]);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return null === t.current && (t.current =
|
|
27
|
-
},
|
|
28
|
-
export { r as useEvent,
|
|
24
|
+
const c = (n) => {
|
|
25
|
+
const t = e(null);
|
|
26
|
+
return null === t.current && (t.current = n()), t;
|
|
27
|
+
}, u = (n, t) => c(() => new n(...t)).current;
|
|
28
|
+
export { r as useEvent, u as useInstance, c as useLazyRef };
|
|
29
29
|
|
|
30
30
|
//# sourceMappingURL=index.js.map
|
package/react/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../lib/hooks/
|
|
1
|
+
{"version":3,"file":"index.js","names":["useCallback","useEffect","useEvent","ref","event","handler","passive","internalHandler","e","current","dom","addEventListener","capture","cleanup","removeEventListener","useRef","useLazyRef","initValFunc","ref","current","useLazyRef","useInstance","Store","initializers","vm","current"],"sources":["../lib/hooks/use-event.ts","../lib/hooks/useLazyRef.ts","../lib/hooks/useInstance.ts"],"sourcesContent":["import { useCallback, useEffect } from \"react\";\r\n\r\nexport function useEvent<TRef extends React.MutableRefObject<any|null>,TEvent>(ref:TRef, event:string, handler?:(e:TEvent)=>void, passive = false) {\r\n const internalHandler = useCallback((e:TEvent)=>{\r\n if(ref.current && typeof handler == \"function\"){\r\n handler(e);\r\n }\r\n },[ref,handler]);\r\n useEffect(() => {\r\n const dom = ref.current;\r\n if (dom) {\r\n // initiate the event handler\r\n dom.addEventListener(event, internalHandler, { passive, capture:false }); \r\n }\r\n // this will clean up the event every time the component is re-rendered\r\n return function cleanup() {\r\n if(dom){\r\n dom.removeEventListener(event, internalHandler, {passive, capture:false});\r\n }\r\n };\r\n },[ref,event,handler,passive]);\r\n}","import { useRef, type RefObject } from \"react\";\r\n\r\ntype InitFunc<T> = ()=>T\r\nexport const useLazyRef = <T>(initValFunc:InitFunc<T>) => {\r\n const ref:RefObject<T|null> = useRef(null);\r\n if (ref.current === null) {\r\n ref.current = initValFunc();\r\n }\r\n return ref;\r\n};","import { useLazyRef } from \"./useLazyRef.js\";\r\n\r\n\r\ntype BaseConstructableClass<T = any> = new (...args: any[]) => T;\r\n\r\n// Type to get the constructor parameters of a class\r\ntype Initializers<T extends BaseConstructableClass> = ConstructorParameters<T>;\r\n\r\n// useInstance function that accepts a Store class and its initializers\r\n/**\r\n * create a instance of an class with lazy initialization\r\n * @param Store class to create instance of\r\n * @param initializers initializers to pass to the class constructor\r\n * @returns instance of the class\r\n */\r\nexport const useInstance = <T extends BaseConstructableClass>(Store: T, initializers: Initializers<T>): InstanceType<T> => {\r\n const vm = useLazyRef(() => new Store(...initializers));\r\n return vm.current;\r\n};\r\n"],"mappings":";AAEA,SAAgBE,EAA+DC,GAAUC,GAAcC,GAA2BC,IAAAA,CAAU,GAAA;CAC1I,MAAMC,IAAkBP,GAAaQ,MAAAA;EAChCL,EAAIM,WAA6B,cAAA,OAAXJ,KACvBA,EAAQG,CAAAA;CAAAA,GAEV,CAACL,GAAIE,CAAAA,CAAAA;CACPJ,QAAAA;EACE,MAAMS,IAAMP,EAAIM;EAMhB,OALIC,KAEFA,EAAIC,iBAAiBP,GAAOG,GAAiB;GAAED,SAAAA;GAASM,SAAAA,CAAQ;EAAA,CAAA,GAG3D,WAAA;GACFF,KACDA,EAAII,oBAAoBV,GAAOG,GAAiB;IAACD,SAAAA;IAASM,SAAAA,CAAQ;GAAA,CAAA;EAEtE;CAAA,GACA;EAACT;EAAIC;EAAMC;EAAQC;CAAAA,CAAAA;AACvB;AClBA,MAAaU,KAAiBC,MAAAA;CAC5B,MAAMC,IAAwBH,EAAO,IAAA;CAIrC,OAHoB,SAAhBG,EAAIC,YACND,EAAIC,UAAUF,EAAAA,IAETC;AAAAA,GCOIG,KAAiDC,GAAUC,MAC3DH,QAAiB,IAAIE,EAAAA,GAASC,CAAAA,CAAAA,CAAAA,CAC/BE;AAAAA,SAAAA,KAAAA,UAAAA,KAAAA,aAAAA,KAAAA"}
|
package/react/dist/index.umd.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
(function(e, t) {
|
|
2
|
+
"object" == typeof exports && "undefined" != typeof module ? t(exports, require("react")) : "function" == typeof define && define.amd ? define(["exports", "react"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).JBCoreReact = {}, e.React);
|
|
3
|
+
})(this, function(e, t) {
|
|
2
4
|
Object.defineProperty(e, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
const n = (e) => {
|
|
6
|
+
const n = (0, t.useRef)(null);
|
|
5
7
|
return null === n.current && (n.current = e()), n;
|
|
6
8
|
};
|
|
7
9
|
e.useEvent = function(e, n, r, u = !1) {
|
|
8
|
-
|
|
10
|
+
const o = (0, t.useCallback)((t) => {
|
|
9
11
|
e.current && "function" == typeof r && r(t);
|
|
10
12
|
}, [e, r]);
|
|
11
13
|
(0, t.useEffect)(() => {
|
|
12
|
-
|
|
14
|
+
const t = e.current;
|
|
13
15
|
return t && t.addEventListener(n, o, {
|
|
14
16
|
passive: u,
|
|
15
17
|
capture: !1
|
|
@@ -26,7 +28,6 @@ var e = this, t = function(e, t) {
|
|
|
26
28
|
u
|
|
27
29
|
]);
|
|
28
30
|
}, e.useInstance = (e, t) => n(() => new e(...t)).current, e.useLazyRef = n;
|
|
29
|
-
};
|
|
30
|
-
"object" == typeof exports && "undefined" != typeof module ? t(exports, require("react")) : "function" == typeof define && define.amd ? define(["exports", "react"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).JBCoreReact = {}, e.React);
|
|
31
|
+
});
|
|
31
32
|
|
|
32
33
|
//# sourceMappingURL=index.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","names":[],"sources":["../lib/hooks/
|
|
1
|
+
{"version":3,"file":"index.umd.js","names":["useCallback","useEffect","useEvent","ref","event","handler","passive","internalHandler","e","current","dom","addEventListener","capture","cleanup","removeEventListener","useRef","useLazyRef","initValFunc","ref","current","useLazyRef","useInstance","Store","initializers","vm","current"],"sources":["../lib/hooks/use-event.ts","../lib/hooks/useLazyRef.ts","../lib/hooks/useInstance.ts"],"sourcesContent":["import { useCallback, useEffect } from \"react\";\r\n\r\nexport function useEvent<TRef extends React.MutableRefObject<any|null>,TEvent>(ref:TRef, event:string, handler?:(e:TEvent)=>void, passive = false) {\r\n const internalHandler = useCallback((e:TEvent)=>{\r\n if(ref.current && typeof handler == \"function\"){\r\n handler(e);\r\n }\r\n },[ref,handler]);\r\n useEffect(() => {\r\n const dom = ref.current;\r\n if (dom) {\r\n // initiate the event handler\r\n dom.addEventListener(event, internalHandler, { passive, capture:false }); \r\n }\r\n // this will clean up the event every time the component is re-rendered\r\n return function cleanup() {\r\n if(dom){\r\n dom.removeEventListener(event, internalHandler, {passive, capture:false});\r\n }\r\n };\r\n },[ref,event,handler,passive]);\r\n}","import { useRef, type RefObject } from \"react\";\r\n\r\ntype InitFunc<T> = ()=>T\r\nexport const useLazyRef = <T>(initValFunc:InitFunc<T>) => {\r\n const ref:RefObject<T|null> = useRef(null);\r\n if (ref.current === null) {\r\n ref.current = initValFunc();\r\n }\r\n return ref;\r\n};","import { useLazyRef } from \"./useLazyRef.js\";\r\n\r\n\r\ntype BaseConstructableClass<T = any> = new (...args: any[]) => T;\r\n\r\n// Type to get the constructor parameters of a class\r\ntype Initializers<T extends BaseConstructableClass> = ConstructorParameters<T>;\r\n\r\n// useInstance function that accepts a Store class and its initializers\r\n/**\r\n * create a instance of an class with lazy initialization\r\n * @param Store class to create instance of\r\n * @param initializers initializers to pass to the class constructor\r\n * @returns instance of the class\r\n */\r\nexport const useInstance = <T extends BaseConstructableClass>(Store: T, initializers: Initializers<T>): InstanceType<T> => {\r\n const vm = useLazyRef(() => new Store(...initializers));\r\n return vm.current;\r\n};\r\n"],"mappings":";;;;CCGA,MAAagB,KAAiBC,MAAAA;EAC5B,MAAMC,KAAAA,GAAAA,EAAAA,OAAAA,CAA+B,IAAA;EAIrC,OAHoB,SAAhBA,EAAIC,YACND,EAAIC,UAAUF,EAAAA,IAETC;CAAAA;CAAAA,EAAAA,WDNT,SAA+Ef,GAAUC,GAAcC,GAA2BC,IAAAA,CAAU,GAAA;EAC1I,MAAMC,KAAAA,GAAAA,EAAAA,YAAAA,EAA+BC,MAAAA;GAChCL,EAAIM,WAA6B,cAAA,OAAXJ,KACvBA,EAAQG,CAAAA;EAAAA,GAEV,CAACL,GAAIE,CAAAA,CAAAA;EAAAA,CACPJ,GAAAA,EAAAA,UAAAA,OAAAA;GACE,MAAMS,IAAMP,EAAIM;GAMhB,OALIC,KAEFA,EAAIC,iBAAiBP,GAAOG,GAAiB;IAAED,SAAAA;IAASM,SAAAA,CAAQ;GAAA,CAAA,GAG3D,WAAA;IACFF,KACDA,EAAII,oBAAoBV,GAAOG,GAAiB;KAACD,SAAAA;KAASM,SAAAA,CAAQ;IAAA,CAAA;GAEtE;EAAA,GACA;GAACT;GAAIC;GAAMC;GAAQC;EAAAA,CAAAA;CACvB,GAAA,EAAA,eEN8DgB,GAAUC,MAC3DH,QAAiB,IAAIE,EAAAA,GAASC,CAAAA,CAAAA,CAAAA,CAC/BE,SAAAA,EAAAA,aAAAA;AAAAA,CAAAA"}
|
package/theme/dist/index.cjs.js
CHANGED
|
@@ -14,61 +14,61 @@ function t(t) {
|
|
|
14
14
|
hue: 258.36
|
|
15
15
|
}, `--jb-neutral-${t}`);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function n(t) {
|
|
18
18
|
return new e({
|
|
19
19
|
lightness: t.lightness + .07,
|
|
20
20
|
chroma: t.chroma + .07,
|
|
21
21
|
hue: t.hue
|
|
22
22
|
}, `${t.variableName}-hover`);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function r(t) {
|
|
25
25
|
return new e({
|
|
26
26
|
lightness: t.lightness - .1,
|
|
27
27
|
chroma: t.chroma - .05,
|
|
28
28
|
hue: t.hue
|
|
29
29
|
}, `${t.variableName}-pressed`);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const
|
|
31
|
+
function a(t) {
|
|
32
|
+
const n = Math.min(t.lightness + .12 * (1 - t.lightness), .985), r = t.chroma * (1 - .15 * (n - t.lightness));
|
|
33
33
|
return new e({
|
|
34
|
-
lightness:
|
|
35
|
-
chroma: Number(
|
|
34
|
+
lightness: n,
|
|
35
|
+
chroma: Number(r.toFixed(3)),
|
|
36
36
|
hue: t.hue
|
|
37
37
|
}, `${t.variableName}-l`);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
const
|
|
39
|
+
function i(t) {
|
|
40
|
+
const n = Math.max(t.lightness - .12 * t.lightness, .02);
|
|
41
41
|
return new e({
|
|
42
|
-
lightness:
|
|
43
|
-
chroma: t.chroma * (1 - .15 * (
|
|
42
|
+
lightness: n,
|
|
43
|
+
chroma: t.chroma * (1 - .15 * (n - t.lightness)),
|
|
44
44
|
hue: t.hue
|
|
45
45
|
}, `${t.variableName}-d`);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
const
|
|
47
|
+
function s(t) {
|
|
48
|
+
const n = Math.min(t.lightness + .65 * (1 - t.lightness), .93), r = .55 * t.chroma * (1 - .08 * (n - t.lightness)), a = t.hue >= 70 && t.hue <= 162 ? 5 : -3, i = t.hue + a;
|
|
49
49
|
return new e({
|
|
50
|
-
lightness:
|
|
51
|
-
chroma: Number(
|
|
52
|
-
hue:
|
|
50
|
+
lightness: n,
|
|
51
|
+
chroma: Number(r.toFixed(3)),
|
|
52
|
+
hue: i
|
|
53
53
|
}, `${t.variableName}-subtle`);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
55
|
+
function o(t) {
|
|
56
|
+
const n = Math.max(t.lightness - .35, .22), r = Math.min(1.6 * t.chroma, .28);
|
|
57
57
|
return new e({
|
|
58
|
-
lightness: Number(
|
|
59
|
-
chroma: Number(
|
|
58
|
+
lightness: Number(n.toFixed(3)),
|
|
59
|
+
chroma: Number(r.toFixed(3)),
|
|
60
60
|
hue: t.hue
|
|
61
61
|
}, `${t.variableName}-contrast`);
|
|
62
62
|
}
|
|
63
63
|
function l(e) {
|
|
64
64
|
return {
|
|
65
65
|
main: e,
|
|
66
|
-
hover:
|
|
67
|
-
pressed:
|
|
68
|
-
light:
|
|
69
|
-
dark:
|
|
70
|
-
subtle:
|
|
71
|
-
contrast:
|
|
66
|
+
hover: n(e),
|
|
67
|
+
pressed: r(e),
|
|
68
|
+
light: a(e),
|
|
69
|
+
dark: i(e),
|
|
70
|
+
subtle: s(e),
|
|
71
|
+
contrast: o(e)
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
const h = new e({
|
|
@@ -128,10 +128,10 @@ const h = new e({
|
|
|
128
128
|
green: l(g),
|
|
129
129
|
red: l(m)
|
|
130
130
|
};
|
|
131
|
-
function
|
|
131
|
+
function x(e) {
|
|
132
132
|
try {
|
|
133
|
-
const { value: t, ...
|
|
134
|
-
"function" == typeof window.CSS.registerProperty && window.CSS.registerProperty({ ...
|
|
133
|
+
const { value: t, ...n } = e;
|
|
134
|
+
"function" == typeof window.CSS.registerProperty && window.CSS.registerProperty({ ...n }), b(e.name, t);
|
|
135
135
|
} catch (e) {}
|
|
136
136
|
}
|
|
137
137
|
function b(e, t) {
|
|
@@ -139,75 +139,105 @@ function b(e, t) {
|
|
|
139
139
|
t && (document.documentElement.style.getPropertyValue(e) || document.documentElement.style.setProperty(e, t));
|
|
140
140
|
} catch (e) {}
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function d(e = "") {
|
|
143
143
|
return crypto?.randomUUID ? `${e}-${crypto.randomUUID()}` : `${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
|
|
147
|
-
name: t ?? e.variableName ?? `--${
|
|
145
|
+
function y(e, t) {
|
|
146
|
+
x({
|
|
147
|
+
name: t ?? e.variableName ?? `--${d()}`,
|
|
148
148
|
syntax: "<color>",
|
|
149
149
|
inherits: !0,
|
|
150
150
|
initialValue: e.value
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
|
|
153
|
+
function v(e) {
|
|
154
|
+
y(e.main), y(e.dark), y(e.light), y(e.contrast), y(e.hover), y(e.pressed), y(e.subtle);
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function f() {
|
|
157
157
|
var e;
|
|
158
158
|
(function(e) {
|
|
159
|
-
|
|
160
|
-
for (let t = 1; t <= 10; t++)
|
|
161
|
-
})(p),
|
|
159
|
+
y(e.neutral[0], "--jb-neutral"), v(e.primary), v(e.secondary), v(e.red), v(e.red), v(e.green), v(e.yellow), y(e.single.black), y(e.single.white), y(e.single.highlight);
|
|
160
|
+
for (let t = 1; t <= 10; t++) y(e.neutral[t]);
|
|
161
|
+
})(p), y((e = p).single.black, "--jb-text-primary"), y(e.neutral[7], "--jb-text-secondary"), y(e.single.white, "--jb-text-contrast");
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
|
|
163
|
+
function w() {
|
|
164
|
+
x({
|
|
165
165
|
name: "--jb-radius",
|
|
166
166
|
inherits: !0,
|
|
167
167
|
value: "1rem",
|
|
168
168
|
initialValue: "16px",
|
|
169
169
|
syntax: "<length-percentage>"
|
|
170
|
-
}),
|
|
170
|
+
}), x({
|
|
171
171
|
name: "--jb-radius-xs",
|
|
172
172
|
inherits: !0,
|
|
173
173
|
value: "0.5rem",
|
|
174
174
|
initialValue: "8px",
|
|
175
175
|
syntax: "<length-percentage>"
|
|
176
|
-
}),
|
|
176
|
+
}), x({
|
|
177
177
|
name: "--jb-radius-sm",
|
|
178
178
|
inherits: !0,
|
|
179
179
|
value: "0.75rem",
|
|
180
180
|
initialValue: "12px",
|
|
181
181
|
syntax: "<length-percentage>"
|
|
182
|
-
}),
|
|
182
|
+
}), x({
|
|
183
183
|
name: "--jb-radius-lg",
|
|
184
184
|
inherits: !0,
|
|
185
185
|
value: "1.25rem",
|
|
186
186
|
initialValue: "20px",
|
|
187
187
|
syntax: "<length-percentage>"
|
|
188
|
-
}),
|
|
188
|
+
}), x({
|
|
189
189
|
name: "--jb-radius-xl",
|
|
190
190
|
inherits: !0,
|
|
191
191
|
value: "1.5rem",
|
|
192
192
|
initialValue: "24px",
|
|
193
193
|
syntax: "<length-percentage>"
|
|
194
|
+
}), x({
|
|
195
|
+
name: "--jb-control-height-xs",
|
|
196
|
+
inherits: !0,
|
|
197
|
+
value: "1.5rem",
|
|
198
|
+
initialValue: "24px",
|
|
199
|
+
syntax: "<length-percentage>"
|
|
200
|
+
}), x({
|
|
201
|
+
name: "--jb-control-height-sm",
|
|
202
|
+
inherits: !0,
|
|
203
|
+
value: "2rem",
|
|
204
|
+
initialValue: "32px",
|
|
205
|
+
syntax: "<length-percentage>"
|
|
206
|
+
}), x({
|
|
207
|
+
name: "--jb-control-height-md",
|
|
208
|
+
inherits: !0,
|
|
209
|
+
value: "2.5rem",
|
|
210
|
+
initialValue: "40px",
|
|
211
|
+
syntax: "<length-percentage>"
|
|
212
|
+
}), x({
|
|
213
|
+
name: "--jb-control-height-lg",
|
|
214
|
+
inherits: !0,
|
|
215
|
+
value: "3rem",
|
|
216
|
+
initialValue: "48px",
|
|
217
|
+
syntax: "<length-percentage>"
|
|
218
|
+
}), x({
|
|
219
|
+
name: "--jb-control-height-xl",
|
|
220
|
+
inherits: !0,
|
|
221
|
+
value: "4rem",
|
|
222
|
+
initialValue: "64px",
|
|
223
|
+
syntax: "<length-percentage>"
|
|
194
224
|
});
|
|
195
225
|
}
|
|
196
226
|
exports.JBColor = e, exports.createColorGroup = l, exports.createThemeColor = function(t) {
|
|
197
|
-
const
|
|
198
|
-
return Object.keys(t).forEach((
|
|
199
|
-
r
|
|
200
|
-
}),
|
|
201
|
-
}, exports.defaultColors = p, exports.defineColors =
|
|
202
|
-
|
|
227
|
+
const n = {};
|
|
228
|
+
return Object.keys(t).forEach((r) => {
|
|
229
|
+
n[r] = l(new e(t[r], `---jb-${r}`));
|
|
230
|
+
}), n;
|
|
231
|
+
}, exports.defaultColors = p, exports.defineColors = f, exports.defineSizes = w, exports.getContrastColor = o, exports.getDarkerColor = i, exports.getHoverColor = n, exports.getLighterColor = a, exports.getNeutralColor = t, exports.getPressedColor = r, exports.getSubtleColor = s, exports.registerCssProperty = x, exports.registerDefaultVariables = function() {
|
|
232
|
+
w(), f();
|
|
203
233
|
}, exports.setColors = function(e) {
|
|
204
234
|
function t(e) {
|
|
205
235
|
document.documentElement.style.setProperty(e.variableName, e.value);
|
|
206
236
|
}
|
|
207
|
-
function
|
|
237
|
+
function n(e) {
|
|
208
238
|
t(e.main), t(e.light), t(e.dark), t(e.contrast), t(e.subtle), t(e.hover), t(e.pressed);
|
|
209
239
|
}
|
|
210
|
-
e.primary &&
|
|
240
|
+
e.primary && n(e.primary), e.secondary && n(e.secondary), e.green && n(e.green), e.red && n(e.red), e.yellow && n(e.yellow);
|
|
211
241
|
}, exports.setCssProperty = b;
|
|
212
242
|
|
|
213
243
|
//# sourceMappingURL=index.cjs.js.map
|
|
Binary file
|
|
Binary file
|