jb-core 0.28.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/configs/tsconfig-react.json +7 -10
- package/configs/tsconfig-web-component.json +8 -11
- package/dist/index.cjs.js +109 -1
- package/dist/index.cjs.js.br +0 -0
- 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 +119 -1
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +113 -1
- package/dist/index.umd.js.br +0 -0
- package/dist/index.umd.js.gz +0 -0
- package/dist/index.umd.js.map +1 -1
- package/i18n/dist/index.cjs.js +57 -1
- 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 +58 -1
- 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 +61 -1
- 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/i18n/tsconfig.json +1 -1
- package/index.js +2 -1
- package/package.json +26 -3
- package/react/dist/index.cjs.js +29 -1
- package/react/dist/index.cjs.js.map +1 -1
- package/react/dist/index.d.ts +25 -2
- package/react/dist/index.js +29 -1
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.umd.js +32 -1
- package/react/dist/index.umd.js.map +1 -1
- package/react/lib/hooks/useLazyRef.ts +1 -3
- package/react/tsconfig.json +1 -1
- package/theme/dist/index.cjs.js +242 -1
- 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 +244 -1
- 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 +246 -1
- 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/colors.mdx +1 -1
- package/theme/stories/sizes.mdx +16 -6
- package/theme/tsconfig.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","names":[],"sources":["
|
|
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,2 +1,30 @@
|
|
|
1
|
-
import{useCallback as
|
|
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
|
+
t(() => {
|
|
7
|
+
const n = e.current;
|
|
8
|
+
return n && n.addEventListener(r, o, {
|
|
9
|
+
passive: u,
|
|
10
|
+
capture: !1
|
|
11
|
+
}), function() {
|
|
12
|
+
n && n.removeEventListener(r, o, {
|
|
13
|
+
passive: u,
|
|
14
|
+
capture: !1
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
}, [
|
|
18
|
+
e,
|
|
19
|
+
r,
|
|
20
|
+
c,
|
|
21
|
+
u
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
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
|
+
|
|
2
30
|
//# sourceMappingURL=index.js.map
|
package/react/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["
|
|
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,2 +1,33 @@
|
|
|
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) {
|
|
4
|
+
Object.defineProperty(e, Symbol.toStringTag, { value: "Module" });
|
|
5
|
+
const n = (e) => {
|
|
6
|
+
const n = (0, t.useRef)(null);
|
|
7
|
+
return null === n.current && (n.current = e()), n;
|
|
8
|
+
};
|
|
9
|
+
e.useEvent = function(e, n, r, u = !1) {
|
|
10
|
+
const o = (0, t.useCallback)((t) => {
|
|
11
|
+
e.current && "function" == typeof r && r(t);
|
|
12
|
+
}, [e, r]);
|
|
13
|
+
(0, t.useEffect)(() => {
|
|
14
|
+
const t = e.current;
|
|
15
|
+
return t && t.addEventListener(n, o, {
|
|
16
|
+
passive: u,
|
|
17
|
+
capture: !1
|
|
18
|
+
}), function() {
|
|
19
|
+
t && t.removeEventListener(n, o, {
|
|
20
|
+
passive: u,
|
|
21
|
+
capture: !1
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}, [
|
|
25
|
+
e,
|
|
26
|
+
n,
|
|
27
|
+
r,
|
|
28
|
+
u
|
|
29
|
+
]);
|
|
30
|
+
}, e.useInstance = (e, t) => n(() => new e(...t)).current, e.useLazyRef = n;
|
|
31
|
+
});
|
|
32
|
+
|
|
2
33
|
//# sourceMappingURL=index.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","names":[],"sources":["
|
|
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/react/tsconfig.json
CHANGED
package/theme/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,243 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
var e = class {
|
|
3
|
+
get value() {
|
|
4
|
+
return `oklch(${this.lightness} ${this.chroma} ${this.hue})`;
|
|
5
|
+
}
|
|
6
|
+
constructor(e, t) {
|
|
7
|
+
this.variableName = t, this.lightness = e.lightness, this.chroma = e.chroma, this.hue = e.hue;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
function t(t) {
|
|
11
|
+
return new e({
|
|
12
|
+
lightness: 6 * (3 + 1.3 * t) * .01,
|
|
13
|
+
chroma: .001 * (14 + .09 * t),
|
|
14
|
+
hue: 258.36
|
|
15
|
+
}, `--jb-neutral-${t}`);
|
|
16
|
+
}
|
|
17
|
+
function n(t) {
|
|
18
|
+
return new e({
|
|
19
|
+
lightness: t.lightness + .07,
|
|
20
|
+
chroma: t.chroma + .07,
|
|
21
|
+
hue: t.hue
|
|
22
|
+
}, `${t.variableName}-hover`);
|
|
23
|
+
}
|
|
24
|
+
function r(t) {
|
|
25
|
+
return new e({
|
|
26
|
+
lightness: t.lightness - .1,
|
|
27
|
+
chroma: t.chroma - .05,
|
|
28
|
+
hue: t.hue
|
|
29
|
+
}, `${t.variableName}-pressed`);
|
|
30
|
+
}
|
|
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
|
+
return new e({
|
|
34
|
+
lightness: n,
|
|
35
|
+
chroma: Number(r.toFixed(3)),
|
|
36
|
+
hue: t.hue
|
|
37
|
+
}, `${t.variableName}-l`);
|
|
38
|
+
}
|
|
39
|
+
function i(t) {
|
|
40
|
+
const n = Math.max(t.lightness - .12 * t.lightness, .02);
|
|
41
|
+
return new e({
|
|
42
|
+
lightness: n,
|
|
43
|
+
chroma: t.chroma * (1 - .15 * (n - t.lightness)),
|
|
44
|
+
hue: t.hue
|
|
45
|
+
}, `${t.variableName}-d`);
|
|
46
|
+
}
|
|
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
|
+
return new e({
|
|
50
|
+
lightness: n,
|
|
51
|
+
chroma: Number(r.toFixed(3)),
|
|
52
|
+
hue: i
|
|
53
|
+
}, `${t.variableName}-subtle`);
|
|
54
|
+
}
|
|
55
|
+
function o(t) {
|
|
56
|
+
const n = Math.max(t.lightness - .35, .22), r = Math.min(1.6 * t.chroma, .28);
|
|
57
|
+
return new e({
|
|
58
|
+
lightness: Number(n.toFixed(3)),
|
|
59
|
+
chroma: Number(r.toFixed(3)),
|
|
60
|
+
hue: t.hue
|
|
61
|
+
}, `${t.variableName}-contrast`);
|
|
62
|
+
}
|
|
63
|
+
function l(e) {
|
|
64
|
+
return {
|
|
65
|
+
main: e,
|
|
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
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const h = new e({
|
|
75
|
+
lightness: .6,
|
|
76
|
+
chroma: .26,
|
|
77
|
+
hue: 256
|
|
78
|
+
}, "--jb-primary"), u = new e({
|
|
79
|
+
lightness: .6,
|
|
80
|
+
chroma: .26,
|
|
81
|
+
hue: 286
|
|
82
|
+
}, "--jb-secondary"), c = new e({
|
|
83
|
+
lightness: .75,
|
|
84
|
+
chroma: .18,
|
|
85
|
+
hue: 70
|
|
86
|
+
}, "--jb-yellow"), g = new e({
|
|
87
|
+
lightness: .68,
|
|
88
|
+
chroma: .1484,
|
|
89
|
+
hue: 162.1
|
|
90
|
+
}, "--jb-green"), m = new e({
|
|
91
|
+
lightness: .6,
|
|
92
|
+
chroma: .22,
|
|
93
|
+
hue: 23.21
|
|
94
|
+
}, "--jb-red"), p = {
|
|
95
|
+
single: {
|
|
96
|
+
black: new e({
|
|
97
|
+
lightness: .14,
|
|
98
|
+
chroma: 0,
|
|
99
|
+
hue: 0
|
|
100
|
+
}, "--jb-black"),
|
|
101
|
+
white: new e({
|
|
102
|
+
lightness: 1,
|
|
103
|
+
chroma: 0,
|
|
104
|
+
hue: 0
|
|
105
|
+
}, "--jb-white"),
|
|
106
|
+
highlight: new e({
|
|
107
|
+
lightness: .93,
|
|
108
|
+
chroma: .2302,
|
|
109
|
+
hue: 125.18
|
|
110
|
+
}, "--jb-highlight")
|
|
111
|
+
},
|
|
112
|
+
neutral: [
|
|
113
|
+
t(0),
|
|
114
|
+
t(1),
|
|
115
|
+
t(2),
|
|
116
|
+
t(3),
|
|
117
|
+
t(4),
|
|
118
|
+
t(5),
|
|
119
|
+
t(6),
|
|
120
|
+
t(7),
|
|
121
|
+
t(8),
|
|
122
|
+
t(9),
|
|
123
|
+
t(10)
|
|
124
|
+
],
|
|
125
|
+
primary: l(h),
|
|
126
|
+
secondary: l(u),
|
|
127
|
+
yellow: l(c),
|
|
128
|
+
green: l(g),
|
|
129
|
+
red: l(m)
|
|
130
|
+
};
|
|
131
|
+
function x(e) {
|
|
132
|
+
try {
|
|
133
|
+
const { value: t, ...n } = e;
|
|
134
|
+
"function" == typeof window.CSS.registerProperty && window.CSS.registerProperty({ ...n }), b(e.name, t);
|
|
135
|
+
} catch (e) {}
|
|
136
|
+
}
|
|
137
|
+
function b(e, t) {
|
|
138
|
+
try {
|
|
139
|
+
t && (document.documentElement.style.getPropertyValue(e) || document.documentElement.style.setProperty(e, t));
|
|
140
|
+
} catch (e) {}
|
|
141
|
+
}
|
|
142
|
+
function d(e = "") {
|
|
143
|
+
return crypto?.randomUUID ? `${e}-${crypto.randomUUID()}` : `${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
144
|
+
}
|
|
145
|
+
function y(e, t) {
|
|
146
|
+
x({
|
|
147
|
+
name: t ?? e.variableName ?? `--${d()}`,
|
|
148
|
+
syntax: "<color>",
|
|
149
|
+
inherits: !0,
|
|
150
|
+
initialValue: e.value
|
|
151
|
+
});
|
|
152
|
+
}
|
|
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
|
+
}
|
|
156
|
+
function f() {
|
|
157
|
+
var e;
|
|
158
|
+
(function(e) {
|
|
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
|
+
}
|
|
163
|
+
function w() {
|
|
164
|
+
x({
|
|
165
|
+
name: "--jb-radius",
|
|
166
|
+
inherits: !0,
|
|
167
|
+
value: "1rem",
|
|
168
|
+
initialValue: "16px",
|
|
169
|
+
syntax: "<length-percentage>"
|
|
170
|
+
}), x({
|
|
171
|
+
name: "--jb-radius-xs",
|
|
172
|
+
inherits: !0,
|
|
173
|
+
value: "0.5rem",
|
|
174
|
+
initialValue: "8px",
|
|
175
|
+
syntax: "<length-percentage>"
|
|
176
|
+
}), x({
|
|
177
|
+
name: "--jb-radius-sm",
|
|
178
|
+
inherits: !0,
|
|
179
|
+
value: "0.75rem",
|
|
180
|
+
initialValue: "12px",
|
|
181
|
+
syntax: "<length-percentage>"
|
|
182
|
+
}), x({
|
|
183
|
+
name: "--jb-radius-lg",
|
|
184
|
+
inherits: !0,
|
|
185
|
+
value: "1.25rem",
|
|
186
|
+
initialValue: "20px",
|
|
187
|
+
syntax: "<length-percentage>"
|
|
188
|
+
}), x({
|
|
189
|
+
name: "--jb-radius-xl",
|
|
190
|
+
inherits: !0,
|
|
191
|
+
value: "1.5rem",
|
|
192
|
+
initialValue: "24px",
|
|
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>"
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
exports.JBColor = e, exports.createColorGroup = l, exports.createThemeColor = function(t) {
|
|
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();
|
|
233
|
+
}, exports.setColors = function(e) {
|
|
234
|
+
function t(e) {
|
|
235
|
+
document.documentElement.style.setProperty(e.variableName, e.value);
|
|
236
|
+
}
|
|
237
|
+
function n(e) {
|
|
238
|
+
t(e.main), t(e.light), t(e.dark), t(e.contrast), t(e.subtle), t(e.hover), t(e.pressed);
|
|
239
|
+
}
|
|
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);
|
|
241
|
+
}, exports.setCssProperty = b;
|
|
242
|
+
|
|
2
243
|
//# sourceMappingURL=index.cjs.js.map
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","names":[],"sources":["../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/modules/jb-core/theme/lib/color/jb-color.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/modules/jb-core/theme/lib/color/utils.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/modules/jb-core/theme/lib/color/constants.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/modules/jb-core/theme/lib/utils.ts","../../dist/index.js","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/modules/jb-core/theme/lib/color/define-colors.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/modules/jb-core/theme/lib/color/index.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/modules/jb-core/theme/lib/sizes/index.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/modules/jb-core/theme/lib/theme.ts"],"sourcesContent":["function e(e,t,o,n={}){document.addEventListener(t,t=>{t.composedPath().includes(e)&&(t.stopPropagation(),t.stopImmediatePropagation(),o(t))},{capture:!0,...n})}function t(e,t,o){const n={altKey:t.altKey,bubbles:t.bubbles,cancelable:t.cancelable,code:t.code,composed:t.composed,ctrlKey:t.ctrlKey,detail:t.detail,isComposing:t.isComposing,key:t.key,location:t.location,metaKey:t.metaKey,repeat:t.repeat,shiftKey:t.shiftKey,view:t.view,charCode:t.charCode,keyCode:t.keyCode,which:t.which,...o};return new KeyboardEvent(e,n)}function o(e,t,o){const n={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed,detail:t.detail,isComposing:t.isComposing,view:t.view,which:t.which,data:t.data,dataTransfer:t.dataTransfer,inputType:t.inputType,targetRanges:\"function\"==typeof t.getTargetRanges?t.getTargetRanges():[],...o};return new InputEvent(e,n)}function n(e,t,o){const n={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed,detail:t.detail,view:t.view,which:t.which,altKey:t.altKey,button:t.button,buttons:t.buttons,clientX:t.clientX,clientY:t.clientY,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey,movementX:t.movementX,movementY:t.movementY,screenX:t.screenX,screenY:t.screenY,relatedTarget:t.relatedTarget,modifierAltGraph:t.getModifierState(\"AltGraph\"),modifierCapsLock:t.getModifierState(\"CapsLock\"),modifierFn:t.getModifierState(\"Fn\"),modifierFnLock:t.getModifierState(\"FnLock\"),modifierHyper:t.getModifierState(\"Hyper\"),modifierNumLock:t.getModifierState(\"NumLock\"),modifierScrollLock:t.getModifierState(\"ScrollLock\"),modifierSuper:t.getModifierState(\"Super\"),modifierSymbol:t.getModifierState(\"Symbol\"),modifierSymbolLock:t.getModifierState(\"SymbolLock\"),...o};return new MouseEvent(e,n)}function i(e,t,o){const n={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed,detail:t.detail,view:t.view,which:t.which,relatedTarget:t.relatedTarget,...o};return new FocusEvent(e,n)}const r=()=>/Mobi/i.test(window.navigator.userAgent);function a(e){if(\"string\"!=typeof e)return\"\";return e.replace(/[۰-۹]/g,function(e){return String.fromCharCode(e.charCodeAt(0)-1728)})}function c(e){if(\"string\"!=typeof e&&isNaN(e))return\"\";return e.toString().replace(/[0-9]/g,function(e){return String.fromCharCode(e.charCodeAt(0)+1728)})}function l(e,t=document){const o=new CSSStyleSheet;return o.replaceSync(e),t.adoptedStyleSheets.push(o),o}function d(e=\"\"){return crypto?.randomUUID?`${e}-${crypto.randomUUID()}`:`${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`}function s(e,t=!1){return null===e?t:\"\"===e||\"true\"===e.toLowerCase()||\"false\"!==e.toLowerCase()&&Boolean(e)}export{i as createFocusEvent,o as createInputEvent,t as createKeyboardEvent,n as createMouseEvent,c as enToFaDigits,a as faToEnDigits,l as injectCss,r as isMobile,e as listenAndSilentEvent,s as parseBooleanAttribute,d as uniqueId};\n//# sourceMappingURL=index.js.map"],"mappings":"AAEA,IAAa,EAAb,MAKE,SAAI,GACF,MAAA,SAAgB,KAAK,aAAa,KAAK,UAAU,KAAK,MACvD,CACD,WAAA,CAAY,EAAyB,GACnC,KAAK,aAAe,EACpB,KAAK,UAAY,EAAY,UAC7B,KAAK,OAAS,EAAY,OAC1B,KAAK,IAAM,EAAY,GACxB,GCTH,SAAgB,EAAgB,GAC9B,OAAO,IAAI,EAAQ,CAAE,UAAY,GAAK,EAAY,IAAR,GAAgB,IAAM,OAAgC,MAAvB,GAAc,IAAR,GAAwB,IAAK,QAAQ,gBAAkB,IACvI,CACD,SAAgB,EAAc,GAC5B,OAAO,IAAI,EAAQ,CAAE,UAAW,EAAM,UAAY,IAAM,OAAQ,EAAM,OAAS,IAAM,IAAK,EAAM,KAAM,GAAK,EAAM,qBAClH,CACD,SAAgB,EAAgB,GAC9B,OAAO,IAAI,EAAQ,CAAE,UAAW,EAAM,UAAY,GAAK,OAAQ,EAAM,OAAS,IAAM,IAAK,EAAM,KAAM,GAAK,EAAM,uBACjH,CAED,SAAgB,EAAgB,GAE9B,MAAM,EAAO,KAAK,IAAI,EAAM,UAAY,KAAQ,EAAI,EAAM,WAAY,MAGhE,EAAO,EAAM,QAAU,EAAI,KAAQ,EAAO,EAAM,YAEtD,OAAO,IAAI,EAAQ,CA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M,YAAY,EAAM,aAAwB,EAAM,MAChF,CACD,SAAS,EAAc,GACrB,EAAS,EAAM,MACf,EAAS,EAAM,OACf,EAAS,EAAM,MACf,EAAS,EAAM,UACf,EAAS,EAAM,QACf,EAAS,EAAM,OACf,EAAS,EAAM,QAChB,CACD,EAAO,SAAW,EAAc,EAAO,SACvC,EAAO,WAAa,EAAc,EAAO,WACzC,EAAO,OAAS,EAAc,EAAO,OACrC,EAAO,KAAO,EAAc,EAAO,KACnC,EAAO,QAAU,EAAc,EAAO,OACvC"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","names":["uniqueId"],"sources":["../lib/color/jb-color.ts","../lib/color/utils.ts","../lib/color/constants.ts","../lib/utils.ts","../../dist/index.js","../lib/color/define-colors.ts","../lib/color/index.ts","../lib/sizes/index.ts","../lib/theme.ts"],"sourcesContent":["import type { OklchParams } from \"./types\";\r\n\r\nexport class JBColor {\r\n lightness:number;\r\n chroma:number;\r\n hue:number;\r\n variableName?:`--${string}`;\r\n get value(){\r\n return `oklch(${this.lightness} ${this.chroma} ${this.hue})`;\r\n }\r\n constructor(colorParams:OklchParams, variableName?:`--${string}`) {\r\n this.variableName = variableName;\r\n this.lightness = colorParams.lightness;\r\n this.chroma = colorParams.chroma;\r\n this.hue = colorParams.hue;\r\n }\r\n}\r\n","import { JBColor } from \"./jb-color\";\r\nimport type { JBColorGroup } from \"./types\";\r\n\r\n//TODO: add DarkMode and LightMode to all the utils functions.\r\n\r\n\r\nexport function getNeutralColor(index: number) {\r\n return new JBColor({ lightness: (6 * (3 + index * 1.3)) * 0.01, chroma: (14 + (index * 0.09)) * 0.001, hue: 258.36 }, `--jb-neutral-${index}`);\r\n}\r\nexport function getHoverColor(color: JBColor) {\r\n return new JBColor({ lightness: color.lightness + 0.07, chroma: color.chroma + 0.07, hue: color.hue, }, `${color.variableName!}-hover`);\r\n}\r\nexport function getPressedColor(color: JBColor) {\r\n return new JBColor({ lightness: color.lightness - 0.1, chroma: color.chroma - 0.05, hue: color.hue, }, `${color.variableName!}-pressed`);\r\n}\r\n\r\nexport function getLighterColor(color: JBColor) {\r\n // Perceptual lightness increase (curved adjustment)\r\n const newL = Math.min(color.lightness + 0.12 * (1 - color.lightness), 0.985);\r\n\r\n // Chroma preservation with gamut safety\r\n const newC = color.chroma * (1 - 0.15 * (newL - color.lightness));\r\n\r\n return new JBColor({ lightness: newL, chroma: Number(newC.toFixed(3)), hue: color.hue }, `${color.variableName!}-l`);\r\n}\r\n\r\nexport function getDarkerColor(color: JBColor) {\r\n // Perceptual lightness decrease (curved adjustment)\r\n const newL = Math.max(color.lightness - 0.12 * color.lightness, 0.02);\r\n\r\n // Chroma preservation with gamut safety (slightly increased chroma as we darken)\r\n const newC = color.chroma * (1 - 0.15 * (newL - color.lightness));\r\n\r\n return new JBColor({ lightness: newL, chroma: newC, hue: color.hue }, `${color.variableName!}-d`);\r\n}\r\nexport function getSubtleColor(color: JBColor) {\r\n // High lightness while maintaining color presence\r\n const newL = Math.min(color.lightness + 0.65 * (1 - color.lightness), 0.93);\r\n\r\n // Keep substantial chroma but adjusted for lighter tones\r\n const newC = color.chroma * 0.55 * (1 - 0.08 * (newL - color.lightness));\r\n\r\n // Optional slight hue tuning for pastel aesthetics\r\n const hueShift = color.hue >= 70 && color.hue <= 162 ? 5 : -3;\r\n const newHue = color.hue + hueShift;\r\n\r\n return new JBColor(\r\n { lightness: newL, chroma: Number(newC.toFixed(3)), hue: newHue },\r\n `${color.variableName!}-subtle`\r\n );\r\n}\r\n/**\r\n * contrast is the color mostly used for text on top of the background. in light mode it is really dark and in dark mode it is really light.\r\n * It is not the same as the text color, and can be used elsewhere too.\r\n */\r\nexport function getContrastColor(color: JBColor) {\r\n // Fixed contrast parameters\r\n const LIGHTNESS_DEPTH = 0.35; // How much darker we make the color\r\n const CHROMA_BOOST = 1.6; // Color intensity multiplier\r\n const MIN_LIGHTNESS = 0.22; // Darkest allowed value\r\n const MAX_CHROMA = 0.28;// Prevent over-saturation\r\n\r\n // Calculate new values\r\n const newLightness = Math.max(color.lightness - LIGHTNESS_DEPTH, MIN_LIGHTNESS);\r\n const newChroma = Math.min(color.chroma * CHROMA_BOOST, MAX_CHROMA);\r\n\r\n // Maintain original hue for color harmony\r\n return new JBColor(\r\n {\r\n lightness: Number(newLightness.toFixed(3)),\r\n chroma: Number(newChroma.toFixed(3)),\r\n hue: color.hue\r\n },\r\n `${color.variableName!}-contrast`\r\n );\r\n}\r\n\r\nexport function createColorGroup(color: JBColor): JBColorGroup {\r\n return {\r\n main: color,\r\n hover: getHoverColor(color),\r\n pressed: getPressedColor(color),\r\n light: getLighterColor(color),\r\n dark: getDarkerColor(color),\r\n subtle: getSubtleColor(color),\r\n contrast: getContrastColor(color)\r\n }\r\n}","import { JBColor } from \"./jb-color\";\r\nimport type { JBThemeColors } from \"./types\";\r\nimport { getNeutralColor, createColorGroup } from \"./utils\";\r\n\r\nconst primary = new JBColor({lightness:0.6,chroma:0.26,hue:256},'--jb-primary');\r\nconst secondary = new JBColor({lightness:0.6,chroma:0.26,hue:286},'--jb-secondary');\r\nconst yellow = new JBColor({lightness:0.75,chroma:0.18,hue:70},'--jb-yellow');\r\nconst green = new JBColor({lightness:0.68,chroma:0.1484,hue:162.1},'--jb-green');\r\nconst red = new JBColor({lightness:0.6,chroma:0.22,hue:23.21},'--jb-red');\r\n\r\nexport const defaultColors:JBThemeColors = {\r\n single:{\r\n black: new JBColor({lightness:0.14,chroma:0,hue:0},'--jb-black'),\r\n white: new JBColor({lightness:1,chroma:0,hue:0},'--jb-white'),\r\n highlight:new JBColor({lightness:0.93,chroma:0.2302,hue:125.18},'--jb-highlight'),\r\n },\r\n neutral: [getNeutralColor(0),getNeutralColor(1),getNeutralColor(2),getNeutralColor(3),getNeutralColor(4),getNeutralColor(5),getNeutralColor(6),getNeutralColor(7),getNeutralColor(8),getNeutralColor(9),getNeutralColor(10)],\r\n primary:createColorGroup(primary),\r\n secondary:createColorGroup(secondary),\r\n yellow:createColorGroup(yellow),\r\n green:createColorGroup(green),\r\n red:createColorGroup(red),\r\n} as const;\r\n\r\n","export type PropertyDefinitionParameter = PropertyDefinition & {\r\n value?: string,\r\n}\r\n\r\nexport function registerCssProperty(parameter: PropertyDefinitionParameter) {\r\n try {\r\n const { value, ...rest } = parameter;\r\n if (typeof window.CSS.registerProperty == \"function\") {\r\n window.CSS.registerProperty({\r\n ...rest\r\n });\r\n }\r\n setCssProperty(parameter.name, value);\r\n } catch (e) {\r\n // if property is already defined or any other type of error\r\n }\r\n}\r\n\r\nexport function setCssProperty(name: string, value?: string) {\r\n try {\r\n if (value) {\r\n if (!document.documentElement.style.getPropertyValue(name)) {\r\n document.documentElement.style.setProperty(name, value);\r\n }\r\n }\r\n } catch (e) {\r\n //\r\n }\r\n}","function e(e, t, o, n = {}) {\n\tdocument.addEventListener(t, (t) => {\n\t\tt.composedPath().includes(e) && (t.stopPropagation(), t.stopImmediatePropagation(), o(t));\n\t}, {\n\t\tcapture: !0,\n\t\t...n\n\t});\n}\nfunction t(e, t, o) {\n\tconst n = {\n\t\taltKey: t.altKey,\n\t\tbubbles: t.bubbles,\n\t\tcancelable: t.cancelable,\n\t\tcode: t.code,\n\t\tcomposed: t.composed,\n\t\tctrlKey: t.ctrlKey,\n\t\tdetail: t.detail,\n\t\tisComposing: t.isComposing,\n\t\tkey: t.key,\n\t\tlocation: t.location,\n\t\tmetaKey: t.metaKey,\n\t\trepeat: t.repeat,\n\t\tshiftKey: t.shiftKey,\n\t\tview: t.view,\n\t\tcharCode: t.charCode,\n\t\tkeyCode: t.keyCode,\n\t\twhich: t.which,\n\t\t...o\n\t};\n\treturn new KeyboardEvent(e, n);\n}\nfunction o(e, t, o) {\n\tconst n = {\n\t\tbubbles: t.bubbles,\n\t\tcancelable: t.cancelable,\n\t\tcomposed: t.composed,\n\t\tdetail: t.detail,\n\t\tisComposing: t.isComposing,\n\t\tview: t.view,\n\t\twhich: t.which,\n\t\tdata: t.data,\n\t\tdataTransfer: t.dataTransfer,\n\t\tinputType: t.inputType,\n\t\ttargetRanges: \"function\" == typeof t.getTargetRanges ? t.getTargetRanges() : [],\n\t\t...o\n\t};\n\treturn new InputEvent(e, n);\n}\nfunction n(e, t, o) {\n\tconst n = {\n\t\tbubbles: t.bubbles,\n\t\tcancelable: t.cancelable,\n\t\tcomposed: t.composed,\n\t\tdetail: t.detail,\n\t\tview: t.view,\n\t\twhich: t.which,\n\t\taltKey: t.altKey,\n\t\tbutton: t.button,\n\t\tbuttons: t.buttons,\n\t\tclientX: t.clientX,\n\t\tclientY: t.clientY,\n\t\tctrlKey: t.ctrlKey,\n\t\tmetaKey: t.metaKey,\n\t\tshiftKey: t.shiftKey,\n\t\tmovementX: t.movementX,\n\t\tmovementY: t.movementY,\n\t\tscreenX: t.screenX,\n\t\tscreenY: t.screenY,\n\t\trelatedTarget: t.relatedTarget,\n\t\tmodifierAltGraph: t.getModifierState(\"AltGraph\"),\n\t\tmodifierCapsLock: t.getModifierState(\"CapsLock\"),\n\t\tmodifierFn: t.getModifierState(\"Fn\"),\n\t\tmodifierFnLock: t.getModifierState(\"FnLock\"),\n\t\tmodifierHyper: t.getModifierState(\"Hyper\"),\n\t\tmodifierNumLock: t.getModifierState(\"NumLock\"),\n\t\tmodifierScrollLock: t.getModifierState(\"ScrollLock\"),\n\t\tmodifierSuper: t.getModifierState(\"Super\"),\n\t\tmodifierSymbol: t.getModifierState(\"Symbol\"),\n\t\tmodifierSymbolLock: t.getModifierState(\"SymbolLock\"),\n\t\t...o\n\t};\n\treturn new MouseEvent(e, n);\n}\nfunction i(e, t, o) {\n\tconst n = {\n\t\tbubbles: t.bubbles,\n\t\tcancelable: t.cancelable,\n\t\tcomposed: t.composed,\n\t\tdetail: t.detail,\n\t\tview: t.view,\n\t\twhich: t.which,\n\t\trelatedTarget: t.relatedTarget,\n\t\t...o\n\t};\n\treturn new FocusEvent(e, n);\n}\nconst r = () => /Mobi/i.test(window.navigator.userAgent);\nfunction a(e) {\n\treturn \"string\" != typeof e ? \"\" : e.replace(/[۰-۹]/g, function(e) {\n\t\treturn String.fromCharCode(e.charCodeAt(0) - 1728);\n\t});\n}\nfunction c(e) {\n\treturn \"string\" != typeof e && isNaN(e) ? \"\" : e.toString().replace(/[0-9]/g, function(e) {\n\t\treturn String.fromCharCode(e.charCodeAt(0) + 1728);\n\t});\n}\nfunction l(e, t = document) {\n\tconst o = new CSSStyleSheet();\n\treturn o.replaceSync(e), t.adoptedStyleSheets.push(o), o;\n}\nfunction d(e = \"\") {\n\treturn crypto?.randomUUID ? `${e}-${crypto.randomUUID()}` : `${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`;\n}\nfunction s(e, t = !1) {\n\treturn null === e ? t : \"\" === e || \"true\" === e.toLowerCase() || \"false\" !== e.toLowerCase() && Boolean(e);\n}\nexport { i as createFocusEvent, o as createInputEvent, t as createKeyboardEvent, n as createMouseEvent, c as enToFaDigits, a as faToEnDigits, l as injectCss, r as isMobile, e as listenAndSilentEvent, s as parseBooleanAttribute, d as uniqueId };\n\n//# sourceMappingURL=index.js.map","import { registerCssProperty } from \"../utils\";\r\nimport type { JBColor } from \"./jb-color\";\r\nimport { uniqueId } from \"jb-core\";\r\nimport type { JBColorGroup, JBThemeColors } from \"./types\";\r\n\r\nfunction defineColor(color:JBColor , name?:string){\r\nregisterCssProperty({\r\n name: name??color.variableName??`--${uniqueId()}`,\r\n syntax: \"<color>\",\r\n inherits: true,\r\n initialValue: color.value,\r\n });\r\n}\r\nfunction defineColorGroup(group:JBColorGroup){\r\n defineColor(group.main);\r\n defineColor(group.dark);\r\n defineColor(group.light);\r\n defineColor(group.contrast);\r\n defineColor(group.hover);\r\n defineColor(group.pressed);\r\n defineColor(group.subtle);\r\n}\r\nexport function defineColorCodes(colors:JBThemeColors){\r\n defineColor(colors.neutral[0],'--jb-neutral');\r\n defineColorGroup(colors.primary);\r\n defineColorGroup(colors.secondary);\r\n defineColorGroup(colors.red);\r\n defineColorGroup(colors.red);\r\n defineColorGroup(colors.green);\r\n defineColorGroup(colors.yellow);\r\n defineColor(colors.single.black);\r\n defineColor(colors.single.white);\r\n defineColor(colors.single.highlight);\r\n for(let i=1;i<=10;i++){\r\n defineColor(colors.neutral[i])\r\n }\r\n}\r\n\r\nexport function defineTextColors(colors:JBThemeColors) {\r\n defineColor(colors.single.black, \"--jb-text-primary\");\r\n defineColor(colors.neutral[7], \"--jb-text-secondary\");\r\n defineColor(colors.single.white, \"--jb-text-contrast\");\r\n}\r\n","import { defaultColors } from \"./constants\";\r\nimport { defineColorCodes, defineTextColors } from \"./define-colors\";\r\nimport { JBColor } from \"./jb-color\";\r\nimport type { ColorGroupsKey, JBColorGroup, JBThemeColors, OklchParams } from \"./types\";\r\nimport { createColorGroup } from \"./utils\";\r\nexport * from './utils';\r\nexport * from \"./jb-color\";\r\nexport * from \"./types\";\r\n\r\n\r\nexport { defaultColors };\r\n\r\nexport function defineColors() {\r\n defineColorCodes(defaultColors);\r\n defineTextColors(defaultColors);\r\n}\r\n\r\n\r\nexport type SetThemeColorParameter = {[key in ColorGroupsKey]?:JBColorGroup}\r\nexport function setColors(colors: SetThemeColorParameter) {\r\n function setColor(color: JBColor) {\r\n document.documentElement.style.setProperty(color.variableName as string, color.value);\r\n }\r\n function setColorGroup(group:JBColorGroup){\r\n setColor(group.main);\r\n setColor(group.light);\r\n setColor(group.dark);\r\n setColor(group.contrast);\r\n setColor(group.subtle);\r\n setColor(group.hover);\r\n setColor(group.pressed);\r\n }\r\n colors.primary && setColorGroup(colors.primary);\r\n colors.secondary && setColorGroup(colors.secondary);\r\n colors.green && setColorGroup(colors.green);\r\n colors.red && setColorGroup(colors.red);\r\n colors.yellow && setColorGroup(colors.yellow);\r\n}\r\n\r\nexport type CreateThemeColorParameter = {[key in ColorGroupsKey]?:OklchParams}\r\n\r\nexport function createThemeColor(parameter: CreateThemeColorParameter): Partial<JBThemeColors> {\r\n const themeColors: Partial<JBThemeColors> = {};\r\n Object.keys(parameter).forEach((key: string) => {\r\n const baseColor = new JBColor(parameter[key as ColorGroupsKey]!, `---jb-${key}`);\r\n const colorGroup = createColorGroup(baseColor);\r\n themeColors[key as ColorGroupsKey] = colorGroup;\r\n });\r\n return themeColors;\r\n}","import { registerCssProperty } from \"../utils.js\";\n\nexport function defineSizes() {\n defineRadiusVariables();\n defineControlHeightVariables();\n}\nfunction defineRadiusVariables() {\n // we use px instead of rem because css variables are not support rem as default value and we need to set rem value in a root element\n registerCssProperty({\n name: \"--jb-radius\",\n inherits: true,\n value: \"1rem\",\n // it define in @property so it should remain px not rem\n initialValue: \"16px\",\n syntax: \"<length-percentage>\",\n });\n registerCssProperty({\n name: \"--jb-radius-xs\",\n inherits: true,\n value: `0.5rem`,\n initialValue: \"8px\",\n syntax: \"<length-percentage>\",\n });\n registerCssProperty({\n name: \"--jb-radius-sm\",\n inherits: true,\n value: `0.75rem`,\n initialValue: \"12px\",\n syntax: \"<length-percentage>\",\n });\n registerCssProperty({\n name: \"--jb-radius-lg\",\n inherits: true,\n value: `1.25rem`,\n initialValue: \"20px\",\n syntax: \"<length-percentage>\",\n });\n registerCssProperty({\n name: \"--jb-radius-xl\",\n inherits: true,\n value: `1.5rem`,\n initialValue: \"24px\",\n syntax: \"<length-percentage>\",\n });\n}\n\nfunction defineControlHeightVariables() {\n registerCssProperty({\n name: \"--jb-control-height-xs\",\n inherits: true,\n value: \"1.5rem\",\n initialValue: \"24px\",\n syntax: \"<length-percentage>\",\n });\n registerCssProperty({\n name: \"--jb-control-height-sm\",\n inherits: true,\n value: \"2rem\",\n initialValue: \"32px\",\n syntax: \"<length-percentage>\",\n });\n registerCssProperty({\n name: \"--jb-control-height-md\",\n inherits: true,\n value: \"2.5rem\",\n initialValue: \"40px\",\n syntax: \"<length-percentage>\",\n });\n registerCssProperty({\n name: \"--jb-control-height-lg\",\n inherits: true,\n value: \"3rem\",\n initialValue: \"48px\",\n syntax: \"<length-percentage>\",\n });\n registerCssProperty({\n name: \"--jb-control-height-xl\",\n inherits: true,\n value: \"4rem\",\n initialValue: \"64px\",\n syntax: \"<length-percentage>\",\n });\n}\n","import { defineColors } from \"./color/index.js\";\r\nimport { defineSizes } from \"./sizes/index.js\";\r\n\r\nexport function registerDefaultVariables() {\r\n defineSizes();\r\n defineColors();\r\n}"],"mappings":";AAEA,IAAa,IAAb,MAAA;CAKE,IAAA,QAAI;EACF,OAAO,SAAS,KAAK,UAAA,GAAa,KAAK,OAAA,GAAU,KAAK,IAAA;CACxD;CACA,YAAY,GAAyB,GAAA;EACnC,KAAK,eAAe,GACpB,KAAK,YAAY,EAAY,WAC7B,KAAK,SAAS,EAAY,QAC1B,KAAK,MAAM,EAAY;CACzB;AAAA;ACTF,SAAgB,EAAgB,GAAA;CAC9B,OAAO,IAAI,EAAQ;EAAE,WAAY,KAAK,IAAY,MAAR,KAAgB;EAAM,QAAgC,QAAvB,KAAc,MAAR;EAAwB,KAAK;CAAA,GAAU,gBAAgB,GAAA;AACxI;AACA,SAAgB,EAAc,GAAA;CAC5B,OAAO,IAAI,EAAQ;EAAE,WAAW,EAAM,YAAY;EAAM,QAAQ,EAAM,SAAS;EAAM,KAAK,EAAM;CAAA,GAAQ,GAAG,EAAM,aAAA,OAAA;AACnH;AACA,SAAgB,EAAgB,GAAA;CAC9B,OAAO,IAAI,EAAQ;EAAE,WAAW,EAAM,YAAY;EAAK,QAAQ,EAAM,SAAS;EAAM,KAAK,EAAM;CAAA,GAAQ,GAAG,EAAM,aAAA,SAAA;AAClH;AAEA,SAAgB,EAAgB,GAAA;CAE9B,MAAM,IAAO,KAAK,IAAI,EAAM,YAAY,OAAQ,IAAI,EAAM,YAAY,IAAA,GAGhE,IAAO,EAAM,UAAU,IAAI,OAAQ,IAAO,EAAM;CAEtD,OAAO,IAAI,EAAQ;EAAE,WAAW;EAAM,QAAQ,OAAO,EAAK,QAAQ,CAAA,CAAA;EAAK,KAAK,EAAM;CAAA,GAAO,GAAG,EAAM,aAAA,GAAA;AACpG;AAEA,SAAgB,EAAe,GAAA;CAE7B,MAAM,IAAO,KAAK,IAAI,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,GAAA,QAAA,kBAAA,GAAA,QAAA,kBAAA,GAAA,QAAA,iBAAA,GAAA,QAAA,sBAAA,GAAA,QAAA,2BE9CA,WAAA;CACE,EAAA,GACA,EAAA;AACF,GAAA,QAAA,YFaA,SAA0B,GAAA;CACxB,SAAS,EAAS,GAAA;EAChB,SAAS,gBAAgB,MAAM,YAAY,EAAM,cAAwB,EAAM,KAAA;CACjF;CACA,SAAS,EAAc,GAAA;EACrB,EAAS,EAAM,IAAA,GACf,EAAS,EAAM,KAAA,GACf,EAAS,EAAM,IAAA,GACf,EAAS,EAAM,QAAA,GACf,EAAS,EAAM,MAAA,GACf,EAAS,EAAM,KAAA,GACf,EAAS,EAAM,OAAA;CACjB;CACA,EAAO,WAAW,EAAc,EAAO,OAAA,GACvC,EAAO,aAAa,EAAc,EAAO,SAAA,GACzC,EAAO,SAAS,EAAc,EAAO,KAAA,GACrC,EAAO,OAAO,EAAc,EAAO,GAAA,GACnC,EAAO,UAAU,EAAc,EAAO,MAAA;AACxC,GAAA,QAAA,iBAAA"}
|
package/theme/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region modules/jb-core/theme/lib/color/jb-color.d.ts
|
|
2
|
+
declare class JBColor {
|
|
3
|
+
lightness: number;
|
|
4
|
+
chroma: number;
|
|
5
|
+
hue: number;
|
|
6
|
+
variableName?: `--${string}`;
|
|
7
|
+
get value(): string;
|
|
8
|
+
constructor(colorParams: OklchParams, variableName?: `--${string}`);
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region modules/jb-core/theme/lib/color/types.d.ts
|
|
12
|
+
type OklchParams = {
|
|
13
|
+
lightness: number;
|
|
14
|
+
chroma: number;
|
|
15
|
+
hue: number;
|
|
16
|
+
};
|
|
17
|
+
type JBColorGroup = {
|
|
18
|
+
main: JBColor;
|
|
19
|
+
hover: JBColor;
|
|
20
|
+
pressed: JBColor;
|
|
21
|
+
light: JBColor;
|
|
22
|
+
dark: JBColor;
|
|
23
|
+
subtle: JBColor;
|
|
24
|
+
contrast: JBColor;
|
|
25
|
+
};
|
|
26
|
+
type ColorGroupsKey = 'primary' | 'secondary' | 'yellow' | 'green' | 'red';
|
|
27
|
+
type JBThemeColors = { [key in ColorGroupsKey]: JBColorGroup } & {
|
|
28
|
+
single: {
|
|
29
|
+
black: JBColor;
|
|
30
|
+
white: JBColor;
|
|
31
|
+
highlight: JBColor;
|
|
32
|
+
};
|
|
33
|
+
neutral: JBColor[];
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region modules/jb-core/theme/lib/color/constants.d.ts
|
|
37
|
+
declare const defaultColors: JBThemeColors;
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region modules/jb-core/theme/lib/color/utils.d.ts
|
|
40
|
+
declare function getNeutralColor(index: number): JBColor;
|
|
41
|
+
declare function getHoverColor(color: JBColor): JBColor;
|
|
42
|
+
declare function getPressedColor(color: JBColor): JBColor;
|
|
43
|
+
declare function getLighterColor(color: JBColor): JBColor;
|
|
44
|
+
declare function getDarkerColor(color: JBColor): JBColor;
|
|
45
|
+
declare function getSubtleColor(color: JBColor): JBColor;
|
|
46
|
+
/**
|
|
47
|
+
* contrast is the color mostly used for text on top of the background. in light mode it is really dark and in dark mode it is really light.
|
|
48
|
+
* It is not the same as the text color, and can be used elsewhere too.
|
|
49
|
+
*/
|
|
50
|
+
declare function getContrastColor(color: JBColor): JBColor;
|
|
51
|
+
declare function createColorGroup(color: JBColor): JBColorGroup;
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region modules/jb-core/theme/lib/color/index.d.ts
|
|
54
|
+
declare function defineColors(): void;
|
|
55
|
+
type SetThemeColorParameter = { [key in ColorGroupsKey]?: JBColorGroup };
|
|
56
|
+
declare function setColors(colors: SetThemeColorParameter): void;
|
|
57
|
+
type CreateThemeColorParameter = { [key in ColorGroupsKey]?: OklchParams };
|
|
58
|
+
declare function createThemeColor(parameter: CreateThemeColorParameter): Partial<JBThemeColors>;
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region modules/jb-core/theme/lib/sizes/index.d.ts
|
|
61
|
+
declare function defineSizes(): void;
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region modules/jb-core/theme/lib/utils.d.ts
|
|
64
|
+
type PropertyDefinitionParameter = PropertyDefinition & {
|
|
65
|
+
value?: string;
|
|
66
|
+
};
|
|
67
|
+
declare function registerCssProperty(parameter: PropertyDefinitionParameter): void;
|
|
68
|
+
declare function setCssProperty(name: string, value?: string): void;
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region modules/jb-core/theme/lib/theme.d.ts
|
|
71
|
+
declare function registerDefaultVariables(): void;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { ColorGroupsKey, CreateThemeColorParameter, JBColor, JBColorGroup, JBThemeColors, OklchParams, PropertyDefinitionParameter, SetThemeColorParameter, createColorGroup, createThemeColor, defaultColors, defineColors, defineSizes, getContrastColor, getDarkerColor, getHoverColor, getLighterColor, getNeutralColor, getPressedColor, getSubtleColor, registerCssProperty, registerDefaultVariables, setColors, setCssProperty };
|
|
5
74
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../lib/color/jb-color.ts","../lib/color/types.ts","../lib/color/constants.ts","../lib/color/utils.ts","../lib/color/index.ts","../lib/sizes/index.ts","../lib/utils.ts","../lib/theme.ts"],"mappings":";cAEa,OAAA;EACX,SAAA;EACA,MAAA;EACA,GAAA;EACA,YAAA;EAAA,IACI,KAAA;cAGQ,WAAA,EAAY,WAAW,EAAE,YAAA;AAAA;;;KCR3B,WAAA;EAAe,SAAA;EAAmB,MAAA;EAAgB,GAAA;AAAA;AAAA,KAClD,YAAA;EACR,IAAA,EAAM,OAAA;EACN,KAAA,EAAM,OAAA;EACN,OAAA,EAAQ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