jb-core 0.3.0 → 0.5.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.
Files changed (37) hide show
  1. package/configs/global.d.ts +15 -0
  2. package/configs/tsconfig-base.json +18 -0
  3. package/configs/tsconfig-react.json +31 -0
  4. package/configs/tsconfig-web-component.json +25 -0
  5. package/dist/{web-component/jb-core/lib/device-detection.d.ts → device-detection.d.ts} +2 -1
  6. package/dist/device-detection.d.ts.map +1 -0
  7. package/dist/{web-component/jb-core/lib/events.d.ts → events.d.ts} +23 -22
  8. package/dist/events.d.ts.map +1 -0
  9. package/dist/index.cjs.js.map +1 -1
  10. package/dist/{web-component/jb-core/lib/index.d.ts → index.d.ts} +4 -3
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.umd.js.map +1 -1
  14. package/dist/{web-component/jb-core/lib/persian-tools.d.ts → persian-tools.d.ts} +4 -3
  15. package/dist/persian-tools.d.ts.map +1 -0
  16. package/package.json +4 -2
  17. package/react/dist/hooks/index.d.ts +3 -0
  18. package/react/dist/hooks/use-event.d.ts +1 -0
  19. package/react/dist/hooks/useInstance.d.ts +10 -0
  20. package/react/dist/hooks/useLazyRef.d.ts +4 -0
  21. package/react/dist/index.cjs.js +1 -70
  22. package/react/dist/index.cjs.js.map +1 -1
  23. package/react/dist/index.d.ts +1 -0
  24. package/react/dist/index.js +1 -44
  25. package/react/dist/index.js.map +1 -1
  26. package/react/dist/index.umd.js +1 -76
  27. package/react/dist/index.umd.js.map +1 -1
  28. package/react/dist/lib/hooks/index.d.ts +3 -0
  29. package/react/dist/lib/hooks/use-event.d.ts +1 -0
  30. package/react/dist/lib/hooks/useInstance.d.ts +10 -0
  31. package/react/dist/lib/hooks/useLazyRef.d.ts +4 -0
  32. package/react/dist/lib/index.d.ts +1 -0
  33. package/react/package.json +1 -1
  34. package/react/tsconfig.json +3 -1
  35. package/styles/colors.scss +15 -0
  36. package/theme/colors.ts +39 -0
  37. package/dist/web-component/jb-core/lib/persian-helper.d.ts +0 -3
@@ -0,0 +1,15 @@
1
+ type FileStringModules = {
2
+ readonly default: string;
3
+ }
4
+ declare module '*.scss' {
5
+ const value: FileStringModules;
6
+ export default value;
7
+ }
8
+ declare module '*.html' {
9
+ const value: FileStringModules;
10
+ export default value.default;
11
+ }
12
+ declare module '*.svg' {
13
+ const value: string;
14
+ export default value;
15
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "react",
4
+ "noImplicitAny": true,
5
+ "removeComments": false,
6
+ "sourceMap": true,
7
+ "allowJs": true,
8
+ "target": "ES2020",
9
+ "declaration": true,
10
+ "declarationMap":true,
11
+ "incremental": false
12
+ },
13
+ "exclude": [
14
+ "stories",
15
+ "node_modules",
16
+ "**/*.spec.ts",
17
+ ]
18
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "module": "ESNext",
5
+ "moduleResolution": "node",
6
+ "removeComments": false,
7
+ "preserveConstEnums": true,
8
+ "sourceMap": true,
9
+ "allowJs": true,
10
+ "target": "ES2020",
11
+ "allowSyntheticDefaultImports": true,
12
+ "emitDecoratorMetadata": true,
13
+ "experimentalDecorators": true,
14
+ "noImplicitAny": false,
15
+ "noLib": false,
16
+ "esModuleInterop": false,
17
+ "declaration": true,
18
+ "declarationDir": "./",
19
+ "declarationMap": false,
20
+ "jsx": "react",
21
+ "typeRoots" : ["../node_modules/@types", "./global.d.ts"],
22
+ },
23
+ "include": [
24
+ "global.d.ts",
25
+ ],
26
+ "exclude": [
27
+ "node_modules",
28
+ "**/*.spec.ts",
29
+ ],
30
+ "extends":"./tsconfig-base.json"
31
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "useTsconfigDeclarationDir": true,
3
+ "compilerOptions": {
4
+ "baseUrl": ".",
5
+ "module": "ES2020",
6
+ "noImplicitAny": true,
7
+ "removeComments": false,
8
+ "preserveConstEnums": true,
9
+ "moduleResolution": "node",
10
+ "sourceMap": true,
11
+ "allowJs": true,
12
+ "target": "ES2020",
13
+ "typeRoots" : ["../node_modules/@types", "./global.d.ts"],
14
+ "declaration": true,
15
+ "declarationMap": true,
16
+ },
17
+ "include": [
18
+ "global.d.ts",
19
+ ],
20
+ "exclude": [
21
+ "node_modules",
22
+ "**/*.spec.ts",
23
+ ],
24
+ "extends":"./tsconfig-base.json"
25
+ }
@@ -1 +1,2 @@
1
- export declare const isMobile: () => boolean;
1
+ export declare const isMobile: () => boolean;
2
+ //# sourceMappingURL=device-detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-detection.d.ts","sourceRoot":"","sources":["../lib/device-detection.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,eAEpB,CAAC"}
@@ -1,22 +1,23 @@
1
- /**
2
- * add type to event target for easier access to target
3
- */
4
- export type EventTypeWithTarget<TEvent, TTarget> = TEvent & {
5
- target: TTarget;
6
- };
7
- /**
8
- * this function will stop event from propagate even in capturing phase and will call handler only if event target is the element
9
- */
10
- export declare function listenAndSilentEvent<TEvent extends Event, TTarget>(element: TTarget, eventName: string, handler: (e: TEvent) => void, options?: AddEventListenerOptions): void;
11
- /**
12
- * create a keyboardEvent based on `e` value and replace them with initObj
13
- */
14
- export declare function createKeyboardEvent(eventName: string, e: KeyboardEvent, initObj: KeyboardEventInit): KeyboardEvent;
15
- /**
16
- * create a InputEvent based on `e` value and replace them with initObj
17
- */
18
- export declare function createInputEvent(eventName: string, e: InputEvent, initObj: InputEventInit): InputEvent;
19
- /**
20
- * create a InputEvent based on `e` value and replace them with initObj
21
- */
22
- export declare function createFocusEvent(eventName: string, e: FocusEvent, initObj: FocusEventInit): FocusEvent;
1
+ /**
2
+ * add type to event target for easier access to target
3
+ */
4
+ export type EventTypeWithTarget<TEvent, TTarget> = TEvent & {
5
+ target: TTarget;
6
+ };
7
+ /**
8
+ * this function will stop event from propagate even in capturing phase and will call handler only if event target is the element
9
+ */
10
+ export declare function listenAndSilentEvent<TEvent extends Event, TTarget>(element: TTarget, eventName: string, handler: (e: TEvent) => void, options?: AddEventListenerOptions): void;
11
+ /**
12
+ * create a keyboardEvent based on `e` value and replace them with initObj
13
+ */
14
+ export declare function createKeyboardEvent(eventName: string, e: KeyboardEvent, initObj: KeyboardEventInit): KeyboardEvent;
15
+ /**
16
+ * create a InputEvent based on `e` value and replace them with initObj
17
+ */
18
+ export declare function createInputEvent(eventName: string, e: InputEvent, initObj: InputEventInit): InputEvent;
19
+ /**
20
+ * create a InputEvent based on `e` value and replace them with initObj
21
+ */
22
+ export declare function createFocusEvent(eventName: string, e: FocusEvent, initObj: FocusEventInit): FocusEvent;
23
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../lib/events.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,MAAM,EAAE,OAAO,IAAI,MAAM,GAAG;IAC1D,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AACF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,SAAS,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,EAAC,MAAM,KAAK,IAAI,EAAE,OAAO,GAAE,uBAA4B,QAQ1K;AACD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,iBAuBlG;AACD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,cAiBzF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,cAazF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","names":[],"sources":["../lib/events.ts","../lib/device-detection.ts","../lib/persian-tools.ts"],"sourcesContent":["/**\r\n * add type to event target for easier access to target\r\n */\r\nexport type EventTypeWithTarget<TEvent, TTarget> = TEvent & {\r\n target: TTarget;\r\n};\r\n/**\r\n * this function will stop event from propagate even in capturing phase and will call handler only if event target is the element\r\n */\r\nexport function listenAndSilentEvent<TEvent extends Event, TTarget>(element: TTarget, eventName: string, handler: (e:TEvent) => void, options: AddEventListenerOptions = {}) {\r\n document.addEventListener(eventName, (e: TEvent) => {\r\n if (e.composedPath().includes(element as unknown as EventTarget)) {\r\n e.stopPropagation();\r\n e.stopImmediatePropagation();\r\n handler(e);\r\n }\r\n },{capture:true,...options});\r\n}\r\n/**\r\n * create a keyboardEvent based on `e` value and replace them with initObj\r\n */\r\nexport function createKeyboardEvent(eventName: string, e: KeyboardEvent, initObj: KeyboardEventInit) {\r\n const initialObject: KeyboardEventInit = {\r\n altKey: e.altKey,\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n code: e.code,\r\n composed: e.composed,\r\n ctrlKey: e.ctrlKey,\r\n detail: e.detail,\r\n isComposing: e.isComposing,\r\n key: e.key,\r\n location: e.location,\r\n metaKey: e.metaKey,\r\n repeat: e.repeat,\r\n shiftKey: e.shiftKey,\r\n view: e.view,\r\n charCode: e.charCode,\r\n keyCode: e.keyCode,\r\n which: e.which,\r\n ...initObj\r\n };\r\n const event = new KeyboardEvent(eventName, initialObject);\r\n return event;\r\n}\r\n/**\r\n * create a InputEvent based on `e` value and replace them with initObj\r\n */\r\nexport function createInputEvent(eventName: string, e: InputEvent, initObj: InputEventInit) {\r\n const initialObject: InputEventInit = {\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n composed: e.composed,\r\n detail: e.detail,\r\n isComposing: e.isComposing,\r\n view: e.view,\r\n which: e.which,\r\n data: e.data,\r\n dataTransfer: e.dataTransfer,\r\n inputType: e.inputType,\r\n targetRanges: typeof e.getTargetRanges() == \"function\" ? e.getTargetRanges() : [],\r\n ...initObj\r\n };\r\n const event = new InputEvent(eventName, initialObject);\r\n return event;\r\n}\r\n\r\n/**\r\n * create a InputEvent based on `e` value and replace them with initObj\r\n */\r\nexport function createFocusEvent(eventName: string, e: FocusEvent, initObj: FocusEventInit) {\r\n const initialObject: FocusEventInit = {\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n composed: e.composed,\r\n detail: e.detail,\r\n view: e.view,\r\n which: e.which,\r\n relatedTarget: e.relatedTarget,\r\n ...initObj\r\n };\r\n const event = new FocusEvent(eventName, initialObject);\r\n return event;\r\n}","export const isMobile = ()=>{\r\n return /Mobi/i.test(window.navigator.userAgent);\r\n};","function faToEnDigits(input:string | number):string{\r\n if (typeof input !== \"string\"){\r\n return '';\r\n }\r\n const regex = /[۰-۹]/g;\r\n const result = input.replace(regex, function (w) {\r\n return String.fromCharCode(w.charCodeAt(0) - 1728);\r\n }\r\n );\r\n return result;\r\n}\r\n\r\nfunction enToFaDigits(input:string | number):string{\r\n if (typeof input !== \"string\" && isNaN(input)){\r\n return '';\r\n }\r\n const regex = /[0-9]/g;\r\n const result = input.toString().replace(regex, function (w) {\r\n return String.fromCharCode(w.charCodeAt(0) + 1728);\r\n }\r\n );\r\n return result;\r\n}\r\nexport {enToFaDigits, faToEnDigits};"],"mappings":"sCAsEM,SAA2B,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,KAAM,EAAE,KACR,MAAO,EAAE,MACT,cAAe,EAAE,iBACd,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,2BAnCK,SAA2B,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,KAAM,EAAE,KACR,MAAO,EAAE,MACT,KAAM,EAAE,KACR,aAAc,EAAE,aAChB,UAAW,EAAE,UACb,aAA4C,mBAAvB,EAAE,kBAAkC,EAAE,kBAAoB,MAC5E,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,8BA5CK,SAA8B,EAAmB,EAAkB,GACvE,MAAM,EAAmC,CACvC,OAAQ,EAAE,OACV,QAAS,EAAE,QACX,WAAY,EAAE,WACd,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,IAAK,EAAE,IACP,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,SAAU,EAAE,SACZ,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,MAAO,EAAE,SACN,GAGL,OADc,IAAI,cAAc,EAAW,EAE5C,uBEhCD,SAAsB,GACpB,MAAqB,iBAAV,GAAsB,MAAM,GAC9B,GAGM,EAAM,WAAW,QADlB,UACiC,SAAU,GACvD,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF,uBAtBD,SAAsB,GACpB,MAAqB,iBAAV,EACF,GAGM,EAAM,QADP,UACsB,SAAU,GAC5C,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF,mBDVuB,IACf,QAAQ,KAAK,OAAO,UAAU,wCDQjC,SAA8D,EAAkB,EAAmB,EAA6B,EAAmC,CAAE,GACzK,SAAS,iBAAiB,GAAY,IAChC,EAAE,eAAe,SAAS,KAC5B,EAAE,kBACF,EAAE,2BACF,EAAQ,GACT,GACD,CAAC,SAAQ,KAAQ,GACpB"}
1
+ {"version":3,"file":"index.cjs.js","names":[],"sources":["../lib/events.ts","../lib/device-detection.ts","../lib/persian-tools.ts"],"sourcesContent":["","",""],"mappings":"sCAsEM,SAA2B,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,KAAM,EAAE,KACR,MAAO,EAAE,MACT,cAAe,EAAE,iBACd,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,2BAnCK,SAA2B,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,KAAM,EAAE,KACR,MAAO,EAAE,MACT,KAAM,EAAE,KACR,aAAc,EAAE,aAChB,UAAW,EAAE,UACb,aAA4C,mBAAvB,EAAE,kBAAkC,EAAE,kBAAoB,MAC5E,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,8BA5CK,SAA8B,EAAmB,EAAkB,GACvE,MAAM,EAAmC,CACvC,OAAQ,EAAE,OACV,QAAS,EAAE,QACX,WAAY,EAAE,WACd,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,IAAK,EAAE,IACP,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,SAAU,EAAE,SACZ,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,MAAO,EAAE,SACN,GAGL,OADc,IAAI,cAAc,EAAW,EAE5C,uBEhCD,SAAsB,GACpB,MAAqB,iBAAV,GAAsB,MAAM,GAC9B,GAGM,EAAM,WAAW,QADlB,UACiC,SAAU,GACvD,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF,uBAtBD,SAAsB,GACpB,MAAqB,iBAAV,EACF,GAGM,EAAM,QADP,UACsB,SAAU,GAC5C,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF,mBDVuB,IACf,QAAQ,KAAK,OAAO,UAAU,wCDQjC,SAA8D,EAAkB,EAAmB,EAA6B,EAAmC,CAAE,GACzK,SAAS,iBAAiB,GAAY,IAChC,EAAE,eAAe,SAAS,KAC5B,EAAE,kBACF,EAAE,2BACF,EAAQ,GACT,GACD,CAAC,SAAQ,KAAQ,GACpB"}
@@ -1,3 +1,4 @@
1
- export * from "./events.js";
2
- export * from "./device-detection.js";
3
- export * from "./persian-tools.js";
1
+ export * from "./events.js";
2
+ export * from "./device-detection.js";
3
+ export * from "./persian-tools.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../lib/events.ts","../lib/device-detection.ts","../lib/persian-tools.ts"],"sourcesContent":["/**\r\n * add type to event target for easier access to target\r\n */\r\nexport type EventTypeWithTarget<TEvent, TTarget> = TEvent & {\r\n target: TTarget;\r\n};\r\n/**\r\n * this function will stop event from propagate even in capturing phase and will call handler only if event target is the element\r\n */\r\nexport function listenAndSilentEvent<TEvent extends Event, TTarget>(element: TTarget, eventName: string, handler: (e:TEvent) => void, options: AddEventListenerOptions = {}) {\r\n document.addEventListener(eventName, (e: TEvent) => {\r\n if (e.composedPath().includes(element as unknown as EventTarget)) {\r\n e.stopPropagation();\r\n e.stopImmediatePropagation();\r\n handler(e);\r\n }\r\n },{capture:true,...options});\r\n}\r\n/**\r\n * create a keyboardEvent based on `e` value and replace them with initObj\r\n */\r\nexport function createKeyboardEvent(eventName: string, e: KeyboardEvent, initObj: KeyboardEventInit) {\r\n const initialObject: KeyboardEventInit = {\r\n altKey: e.altKey,\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n code: e.code,\r\n composed: e.composed,\r\n ctrlKey: e.ctrlKey,\r\n detail: e.detail,\r\n isComposing: e.isComposing,\r\n key: e.key,\r\n location: e.location,\r\n metaKey: e.metaKey,\r\n repeat: e.repeat,\r\n shiftKey: e.shiftKey,\r\n view: e.view,\r\n charCode: e.charCode,\r\n keyCode: e.keyCode,\r\n which: e.which,\r\n ...initObj\r\n };\r\n const event = new KeyboardEvent(eventName, initialObject);\r\n return event;\r\n}\r\n/**\r\n * create a InputEvent based on `e` value and replace them with initObj\r\n */\r\nexport function createInputEvent(eventName: string, e: InputEvent, initObj: InputEventInit) {\r\n const initialObject: InputEventInit = {\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n composed: e.composed,\r\n detail: e.detail,\r\n isComposing: e.isComposing,\r\n view: e.view,\r\n which: e.which,\r\n data: e.data,\r\n dataTransfer: e.dataTransfer,\r\n inputType: e.inputType,\r\n targetRanges: typeof e.getTargetRanges() == \"function\" ? e.getTargetRanges() : [],\r\n ...initObj\r\n };\r\n const event = new InputEvent(eventName, initialObject);\r\n return event;\r\n}\r\n\r\n/**\r\n * create a InputEvent based on `e` value and replace them with initObj\r\n */\r\nexport function createFocusEvent(eventName: string, e: FocusEvent, initObj: FocusEventInit) {\r\n const initialObject: FocusEventInit = {\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n composed: e.composed,\r\n detail: e.detail,\r\n view: e.view,\r\n which: e.which,\r\n relatedTarget: e.relatedTarget,\r\n ...initObj\r\n };\r\n const event = new FocusEvent(eventName, initialObject);\r\n return event;\r\n}","export const isMobile = ()=>{\r\n return /Mobi/i.test(window.navigator.userAgent);\r\n};","function faToEnDigits(input:string | number):string{\r\n if (typeof input !== \"string\"){\r\n return '';\r\n }\r\n const regex = /[۰-۹]/g;\r\n const result = input.replace(regex, function (w) {\r\n return String.fromCharCode(w.charCodeAt(0) - 1728);\r\n }\r\n );\r\n return result;\r\n}\r\n\r\nfunction enToFaDigits(input:string | number):string{\r\n if (typeof input !== \"string\" && isNaN(input)){\r\n return '';\r\n }\r\n const regex = /[0-9]/g;\r\n const result = input.toString().replace(regex, function (w) {\r\n return String.fromCharCode(w.charCodeAt(0) + 1728);\r\n }\r\n );\r\n return result;\r\n}\r\nexport {enToFaDigits, faToEnDigits};"],"mappings":"AASM,SAAU,EAAoD,EAAkB,EAAmB,EAA6B,EAAmC,CAAE,GACzK,SAAS,iBAAiB,GAAY,IAChC,EAAE,eAAe,SAAS,KAC5B,EAAE,kBACF,EAAE,2BACF,EAAQ,GACT,GACD,CAAC,SAAQ,KAAQ,GACpB,CAIK,SAAU,EAAoB,EAAmB,EAAkB,GACvE,MAAM,EAAmC,CACvC,OAAQ,EAAE,OACV,QAAS,EAAE,QACX,WAAY,EAAE,WACd,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,IAAK,EAAE,IACP,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,SAAU,EAAE,SACZ,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,MAAO,EAAE,SACN,GAGL,OADc,IAAI,cAAc,EAAW,EAE5C,CAIK,SAAU,EAAiB,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,KAAM,EAAE,KACR,MAAO,EAAE,MACT,KAAM,EAAE,KACR,aAAc,EAAE,aAChB,UAAW,EAAE,UACb,aAA4C,mBAAvB,EAAE,kBAAkC,EAAE,kBAAoB,MAC5E,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,CAKK,SAAU,EAAiB,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,KAAM,EAAE,KACR,MAAO,EAAE,MACT,cAAe,EAAE,iBACd,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,OCnFY,EAAW,IACf,QAAQ,KAAK,OAAO,UAAU,WCDvC,SAAS,EAAa,GACpB,GAAqB,iBAAV,EACT,MAAO,GAOT,OAJe,EAAM,QADP,UACsB,SAAU,GAC5C,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF,CAED,SAAS,EAAa,GACpB,GAAqB,iBAAV,GAAsB,MAAM,GACrC,MAAO,GAOT,OAJe,EAAM,WAAW,QADlB,UACiC,SAAU,GACvD,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../lib/events.ts","../lib/device-detection.ts","../lib/persian-tools.ts"],"sourcesContent":["","",""],"mappings":"AASM,SAAU,EAAoD,EAAkB,EAAmB,EAA6B,EAAmC,CAAE,GACzK,SAAS,iBAAiB,GAAY,IAChC,EAAE,eAAe,SAAS,KAC5B,EAAE,kBACF,EAAE,2BACF,EAAQ,GACT,GACD,CAAC,SAAQ,KAAQ,GACpB,CAIK,SAAU,EAAoB,EAAmB,EAAkB,GACvE,MAAM,EAAmC,CACvC,OAAQ,EAAE,OACV,QAAS,EAAE,QACX,WAAY,EAAE,WACd,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,IAAK,EAAE,IACP,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,SAAU,EAAE,SACZ,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,MAAO,EAAE,SACN,GAGL,OADc,IAAI,cAAc,EAAW,EAE5C,CAIK,SAAU,EAAiB,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,KAAM,EAAE,KACR,MAAO,EAAE,MACT,KAAM,EAAE,KACR,aAAc,EAAE,aAChB,UAAW,EAAE,UACb,aAA4C,mBAAvB,EAAE,kBAAkC,EAAE,kBAAoB,MAC5E,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,CAKK,SAAU,EAAiB,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,KAAM,EAAE,KACR,MAAO,EAAE,MACT,cAAe,EAAE,iBACd,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,OCnFY,EAAW,IACf,QAAQ,KAAK,OAAO,UAAU,WCDvC,SAAS,EAAa,GACpB,GAAqB,iBAAV,EACT,MAAO,GAOT,OAJe,EAAM,QADP,UACsB,SAAU,GAC5C,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF,CAED,SAAS,EAAa,GACpB,GAAqB,iBAAV,GAAsB,MAAM,GACrC,MAAO,GAOT,OAJe,EAAM,WAAW,QADlB,UACiC,SAAU,GACvD,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","names":[],"sources":["../lib/events.ts","../lib/device-detection.ts","../lib/persian-tools.ts"],"sourcesContent":["/**\r\n * add type to event target for easier access to target\r\n */\r\nexport type EventTypeWithTarget<TEvent, TTarget> = TEvent & {\r\n target: TTarget;\r\n};\r\n/**\r\n * this function will stop event from propagate even in capturing phase and will call handler only if event target is the element\r\n */\r\nexport function listenAndSilentEvent<TEvent extends Event, TTarget>(element: TTarget, eventName: string, handler: (e:TEvent) => void, options: AddEventListenerOptions = {}) {\r\n document.addEventListener(eventName, (e: TEvent) => {\r\n if (e.composedPath().includes(element as unknown as EventTarget)) {\r\n e.stopPropagation();\r\n e.stopImmediatePropagation();\r\n handler(e);\r\n }\r\n },{capture:true,...options});\r\n}\r\n/**\r\n * create a keyboardEvent based on `e` value and replace them with initObj\r\n */\r\nexport function createKeyboardEvent(eventName: string, e: KeyboardEvent, initObj: KeyboardEventInit) {\r\n const initialObject: KeyboardEventInit = {\r\n altKey: e.altKey,\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n code: e.code,\r\n composed: e.composed,\r\n ctrlKey: e.ctrlKey,\r\n detail: e.detail,\r\n isComposing: e.isComposing,\r\n key: e.key,\r\n location: e.location,\r\n metaKey: e.metaKey,\r\n repeat: e.repeat,\r\n shiftKey: e.shiftKey,\r\n view: e.view,\r\n charCode: e.charCode,\r\n keyCode: e.keyCode,\r\n which: e.which,\r\n ...initObj\r\n };\r\n const event = new KeyboardEvent(eventName, initialObject);\r\n return event;\r\n}\r\n/**\r\n * create a InputEvent based on `e` value and replace them with initObj\r\n */\r\nexport function createInputEvent(eventName: string, e: InputEvent, initObj: InputEventInit) {\r\n const initialObject: InputEventInit = {\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n composed: e.composed,\r\n detail: e.detail,\r\n isComposing: e.isComposing,\r\n view: e.view,\r\n which: e.which,\r\n data: e.data,\r\n dataTransfer: e.dataTransfer,\r\n inputType: e.inputType,\r\n targetRanges: typeof e.getTargetRanges() == \"function\" ? e.getTargetRanges() : [],\r\n ...initObj\r\n };\r\n const event = new InputEvent(eventName, initialObject);\r\n return event;\r\n}\r\n\r\n/**\r\n * create a InputEvent based on `e` value and replace them with initObj\r\n */\r\nexport function createFocusEvent(eventName: string, e: FocusEvent, initObj: FocusEventInit) {\r\n const initialObject: FocusEventInit = {\r\n bubbles: e.bubbles,\r\n cancelable: e.cancelable,\r\n composed: e.composed,\r\n detail: e.detail,\r\n view: e.view,\r\n which: e.which,\r\n relatedTarget: e.relatedTarget,\r\n ...initObj\r\n };\r\n const event = new FocusEvent(eventName, initialObject);\r\n return event;\r\n}","export const isMobile = ()=>{\r\n return /Mobi/i.test(window.navigator.userAgent);\r\n};","function faToEnDigits(input:string | number):string{\r\n if (typeof input !== \"string\"){\r\n return '';\r\n }\r\n const regex = /[۰-۹]/g;\r\n const result = input.replace(regex, function (w) {\r\n return String.fromCharCode(w.charCodeAt(0) - 1728);\r\n }\r\n );\r\n return result;\r\n}\r\n\r\nfunction enToFaDigits(input:string | number):string{\r\n if (typeof input !== \"string\" && isNaN(input)){\r\n return '';\r\n }\r\n const regex = /[0-9]/g;\r\n const result = input.toString().replace(regex, function (w) {\r\n return String.fromCharCode(w.charCodeAt(0) + 1728);\r\n }\r\n );\r\n return result;\r\n}\r\nexport {enToFaDigits, faToEnDigits};"],"mappings":"iQAsEM,SAA2B,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,KAAM,EAAE,KACR,MAAO,EAAE,MACT,cAAe,EAAE,iBACd,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,qBAnCK,SAA2B,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,KAAM,EAAE,KACR,MAAO,EAAE,MACT,KAAM,EAAE,KACR,aAAc,EAAE,aAChB,UAAW,EAAE,UACb,aAA4C,mBAAvB,EAAE,kBAAkC,EAAE,kBAAoB,MAC5E,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,wBA5CK,SAA8B,EAAmB,EAAkB,GACvE,MAAM,EAAmC,CACvC,OAAQ,EAAE,OACV,QAAS,EAAE,QACX,WAAY,EAAE,WACd,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,IAAK,EAAE,IACP,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,SAAU,EAAE,SACZ,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,MAAO,EAAE,SACN,GAGL,OADc,IAAI,cAAc,EAAW,EAE5C,iBEhCD,SAAsB,GACpB,MAAqB,iBAAV,GAAsB,MAAM,GAC9B,GAGM,EAAM,WAAW,QADlB,UACiC,SAAU,GACvD,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF,iBAtBD,SAAsB,GACpB,MAAqB,iBAAV,EACF,GAGM,EAAM,QADP,UACsB,SAAU,GAC5C,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF,aDVuB,IACf,QAAQ,KAAK,OAAO,UAAU,kCDQjC,SAA8D,EAAkB,EAAmB,EAA6B,EAAmC,CAAE,GACzK,SAAS,iBAAiB,GAAY,IAChC,EAAE,eAAe,SAAS,KAC5B,EAAE,kBACF,EAAE,2BACF,EAAQ,GACT,GACD,CAAC,SAAQ,KAAQ,GACpB"}
1
+ {"version":3,"file":"index.umd.js","names":[],"sources":["../lib/events.ts","../lib/device-detection.ts","../lib/persian-tools.ts"],"sourcesContent":["","",""],"mappings":"iQAsEM,SAA2B,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,KAAM,EAAE,KACR,MAAO,EAAE,MACT,cAAe,EAAE,iBACd,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,qBAnCK,SAA2B,EAAmB,EAAe,GACjE,MAAM,EAAgC,CACpC,QAAS,EAAE,QACX,WAAY,EAAE,WACd,SAAU,EAAE,SACZ,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,KAAM,EAAE,KACR,MAAO,EAAE,MACT,KAAM,EAAE,KACR,aAAc,EAAE,aAChB,UAAW,EAAE,UACb,aAA4C,mBAAvB,EAAE,kBAAkC,EAAE,kBAAoB,MAC5E,GAGL,OADc,IAAI,WAAW,EAAW,EAEzC,wBA5CK,SAA8B,EAAmB,EAAkB,GACvE,MAAM,EAAmC,CACvC,OAAQ,EAAE,OACV,QAAS,EAAE,QACX,WAAY,EAAE,WACd,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,YAAa,EAAE,YACf,IAAK,EAAE,IACP,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,OAAQ,EAAE,OACV,SAAU,EAAE,SACZ,KAAM,EAAE,KACR,SAAU,EAAE,SACZ,QAAS,EAAE,QACX,MAAO,EAAE,SACN,GAGL,OADc,IAAI,cAAc,EAAW,EAE5C,iBEhCD,SAAsB,GACpB,MAAqB,iBAAV,GAAsB,MAAM,GAC9B,GAGM,EAAM,WAAW,QADlB,UACiC,SAAU,GACvD,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF,iBAtBD,SAAsB,GACpB,MAAqB,iBAAV,EACF,GAGM,EAAM,QADP,UACsB,SAAU,GAC5C,OAAO,OAAO,aAAa,EAAE,WAAW,GAAK,KAC9C,GAGF,aDVuB,IACf,QAAQ,KAAK,OAAO,UAAU,kCDQjC,SAA8D,EAAkB,EAAmB,EAA6B,EAAmC,CAAE,GACzK,SAAS,iBAAiB,GAAY,IAChC,EAAE,eAAe,SAAS,KAC5B,EAAE,kBACF,EAAE,2BACF,EAAQ,GACT,GACD,CAAC,SAAQ,KAAQ,GACpB"}
@@ -1,3 +1,4 @@
1
- declare function faToEnDigits(input: string | number): string;
2
- declare function enToFaDigits(input: string | number): string;
3
- export { enToFaDigits, faToEnDigits };
1
+ declare function faToEnDigits(input: string | number): string;
2
+ declare function enToFaDigits(input: string | number): string;
3
+ export { enToFaDigits, faToEnDigits };
4
+ //# sourceMappingURL=persian-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persian-tools.d.ts","sourceRoot":"","sources":["../lib/persian-tools.ts"],"names":[],"mappings":"AAAA,iBAAS,YAAY,CAAC,KAAK,EAAC,MAAM,GAAG,MAAM,GAAE,MAAM,CAUlD;AAED,iBAAS,YAAY,CAAC,KAAK,EAAC,MAAM,GAAG,MAAM,GAAE,MAAM,CAUlD;AACD,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,CAAC"}
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "react component",
15
15
  "event"
16
16
  ],
17
- "version": "0.3.0",
17
+ "version": "0.5.0",
18
18
  "bugs": "https://github.com/javadbat/jb-core/issues",
19
19
  "license": "MIT",
20
20
  "files": [
@@ -23,11 +23,13 @@
23
23
  "lib/",
24
24
  "dist/",
25
25
  "styles/",
26
+ "configs/",
27
+ "theme/",
26
28
  "react/",
27
29
  "react/dist/"
28
30
  ],
29
31
  "main": "index.js",
30
- "types": "./dist/web-component/jb-core/lib/index.d.ts",
32
+ "types": "./dist/index.d.ts",
31
33
  "repository": {
32
34
  "type": "git",
33
35
  "url": "git@github.com:javadbat/jb-core.git"
@@ -0,0 +1,3 @@
1
+ export * from './use-event.js';
2
+ export * from './useInstance.js';
3
+ export * from './useLazyRef.js';
@@ -0,0 +1 @@
1
+ export declare function useEvent<TRef extends React.MutableRefObject<any | null>, TEvent>(ref: TRef, event: string, handler?: (e: TEvent) => void, passive?: boolean): void;
@@ -0,0 +1,10 @@
1
+ type BaseConstructableClass<T = any> = new (...args: any[]) => T;
2
+ type Initializers<T extends BaseConstructableClass> = ConstructorParameters<T>;
3
+ /**
4
+ * create a instance of an class with lazy initialization
5
+ * @param Store class to create instance of
6
+ * @param initializers initializers to pass to the class constructor
7
+ * @returns instance of the class
8
+ */
9
+ export declare const useInstance: <T extends BaseConstructableClass>(Store: T, initializers: Initializers<T>) => InstanceType<T>;
10
+ export {};
@@ -0,0 +1,4 @@
1
+ import { MutableRefObject } from "react";
2
+ type InitFunc<T> = () => T;
3
+ export declare const useLazyRef: <T>(initValFunc: InitFunc<T>) => MutableRefObject<any>;
4
+ export {};
@@ -1,71 +1,2 @@
1
- "use strict";
2
- //#region rolldown:runtime
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
- get: ((k) => from[k]).bind(null, key),
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
- value: mod,
21
- enumerable: true
22
- }) : target, mod));
23
-
24
- //#endregion
25
- const react = __toESM(require("react"));
26
-
27
- //#region web-component/jb-core/react/lib/hooks/use-event.ts
28
- function useEvent(ref, event, handler, passive = false) {
29
- const internalHandler = (0, react.useCallback)((e) => {
30
- if (ref.current && typeof handler == "function") handler(e);
31
- }, [ref, handler]);
32
- (0, react.useEffect)(() => {
33
- const dom = ref.current;
34
- if (dom) dom.addEventListener(event, internalHandler, {
35
- passive,
36
- capture: false
37
- });
38
- return function cleanup() {
39
- if (dom) dom.removeEventListener(event, internalHandler, {
40
- passive,
41
- capture: false
42
- });
43
- };
44
- }, [
45
- ref,
46
- event,
47
- handler,
48
- passive
49
- ]);
50
- }
51
-
52
- //#endregion
53
- //#region web-component/jb-core/react/lib/hooks/useLazyRef.ts
54
- const useLazyRef = (initValFunc) => {
55
- const ref = (0, react.useRef)(null);
56
- if (ref.current === null) ref.current = initValFunc();
57
- return ref;
58
- };
59
-
60
- //#endregion
61
- //#region web-component/jb-core/react/lib/hooks/useInstance.ts
62
- const useInstance = (Store, initializers) => {
63
- const vm = useLazyRef(() => new Store(...initializers));
64
- return vm.current;
65
- };
66
-
67
- //#endregion
68
- exports.useEvent = useEvent
69
- exports.useInstance = useInstance
70
- exports.useLazyRef = useLazyRef
1
+ "use strict";let e,t;var r=Object.create,n=Object.defineProperty,u=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,o=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;const a=(t=null!=(e=require("react"))?r(o(e)):{},((e,t,r,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,s=c(t),f=0,p=s.length;f<p;f++)a=s[f],l.call(e,a)||void 0===a||n(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(o=u(t,a))||o.enumerable});return e})(e&&e.__esModule?t:n(t,"default",{value:e,enumerable:!0}),e)),s=e=>{let t=(0,a.useRef)(null);return null===t.current&&(t.current=e()),t};exports.useEvent=function(e,t,r,n=!1){let u=(0,a.useCallback)(t=>{e.current&&"function"==typeof r&&r(t)},[e,r]);(0,a.useEffect)(()=>{let r=e.current;return r&&r.addEventListener(t,u,{passive:n,capture:!1}),function(){r&&r.removeEventListener(t,u,{passive:n,capture:!1})}},[e,t,r,n])},exports.useInstance=(e,t)=>s(()=>new e(...t)).current,exports.useLazyRef=s;
71
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","names":[],"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 { MutableRefObject, useRef } from \"react\";\r\n\r\ntype InitFunc<T> = ()=>T\r\nexport const useLazyRef = <T>(initValFunc:InitFunc<T>) => {\r\n const ref:MutableRefObject<any> = useRef(null);\r\n if (ref.current === null) {\r\n ref.current = initValFunc();\r\n }\r\n return ref;\r\n};\r\n\r\n// used by: useMobx","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEM,SAAU,SAA+D,KAAU,OAAc,SAA2B,UAAU,OAAK;CAC/I,MAAM,kBAAkB,uBAAY,CAAC,MAAW;AAC9C,MAAG,IAAI,kBAAkB,WAAW,WAClC,SAAQ,EAAE;CAEb,GAAC,CAAC,KAAI,OAAQ,EAAC;AAChB,sBAAU,MAAK;EACb,MAAM,MAAM,IAAI;AAChB,MAAI,IAEF,KAAI,iBAAiB,OAAO,iBAAiB;GAAE;GAAS,SAAQ;EAAO,EAAC;AAG1E,SAAO,SAAS,UAAO;AACrB,OAAG,IACD,KAAI,oBAAoB,OAAO,iBAAiB;IAAC;IAAS,SAAQ;GAAM,EAAC;EAE5E;CACF,GAAC;EAAC;EAAI;EAAM;EAAQ;CAAQ,EAAC;AAC/B;;;;MClBY,aAAa,CAAI,gBAA2B;CACvD,MAAM,MAA4B,kBAAO,KAAK;AAC9C,KAAI,IAAI,YAAY,KAClB,KAAI,UAAU,aAAa;AAE7B,QAAO;AACR;;;;MCMY,cAAc,CAAmC,OAAU,iBAAkD;CACxH,MAAM,KAAK,WAAW,MAAM,IAAI,MAAM,GAAG,cAAc;AACvD,QAAO,GAAG;AACX"}
1
+ {"version":3,"file":"index.cjs.js","names":[],"sources":["../lib/hooks/use-event.ts","../lib/hooks/useLazyRef.ts","../lib/hooks/useInstance.ts"],"sourcesContent":["","",""],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEM,SAAU,SAA+D,KAAU,OAAc,SAA2B,UAAU,OAAK;CAC/I,MAAM,kBAAkB,uBAAY,CAAC,MAAS;AAC5C,MAAG,IAAI,kBAAkB,WAAW,WAClC,SAAQ,EAAE;CAEb,GAAC,CACF,KACE;sBAEE,MAAA;QACA,MAAI,IAAA;AACN,MAAA,IAEA,KAAO,iBAAgB,OAAA,iBAAA;GAClB;GACD,SAAI;EACN,EAAA;AAGN,SAAA,SAAA,UAAA;;;;;;;;;;;;;;;;MClBa,aAAa,CAAI,gBAAyB;CACrD,MAAM,MAA4B,kBAAO,KAAK;AAC9C,KAAI,IAAI,YAAY,KAClB,KAAI,UAAU,aAAa;AAE7B,QAAO;AACR;;;;;CCMD,MAAO,KAAM,WAAW,MAAsC,IAAQ,MAAE,GAAA,cAAkD;AACxH,QAAM,GAAE"}
@@ -0,0 +1 @@
1
+ export * from './hooks/index.js';
@@ -1,45 +1,2 @@
1
- import { useCallback, useEffect, useRef } from "react";
2
-
3
- //#region web-component/jb-core/react/lib/hooks/use-event.ts
4
- function useEvent(ref, event, handler, passive = false) {
5
- const internalHandler = useCallback((e) => {
6
- if (ref.current && typeof handler == "function") handler(e);
7
- }, [ref, handler]);
8
- useEffect(() => {
9
- const dom = ref.current;
10
- if (dom) dom.addEventListener(event, internalHandler, {
11
- passive,
12
- capture: false
13
- });
14
- return function cleanup() {
15
- if (dom) dom.removeEventListener(event, internalHandler, {
16
- passive,
17
- capture: false
18
- });
19
- };
20
- }, [
21
- ref,
22
- event,
23
- handler,
24
- passive
25
- ]);
26
- }
27
-
28
- //#endregion
29
- //#region web-component/jb-core/react/lib/hooks/useLazyRef.ts
30
- const useLazyRef = (initValFunc) => {
31
- const ref = useRef(null);
32
- if (ref.current === null) ref.current = initValFunc();
33
- return ref;
34
- };
35
-
36
- //#endregion
37
- //#region web-component/jb-core/react/lib/hooks/useInstance.ts
38
- const useInstance = (Store, initializers) => {
39
- const vm = useLazyRef(() => new Store(...initializers));
40
- return vm.current;
41
- };
42
-
43
- //#endregion
44
- export { useEvent, useInstance, useLazyRef };
1
+ import{useCallback as e,useEffect as t,useRef as n}from"react";function r(n,u,c,l=!1){let o=e(e=>{n.current&&"function"==typeof c&&c(e)},[n,c]);t(()=>{let e=n.current;return e&&e.addEventListener(u,o,{passive:l,capture:!1}),function(){e&&e.removeEventListener(u,o,{passive:l,capture:!1})}},[n,u,c,l])}let u=e=>{let t=n(null);return null===t.current&&(t.current=e()),t},c=(e,t)=>u(()=>new e(...t)).current;export{r as useEvent,c as useInstance,u as useLazyRef};
45
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"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 { MutableRefObject, useRef } from \"react\";\r\n\r\ntype InitFunc<T> = ()=>T\r\nexport const useLazyRef = <T>(initValFunc:InitFunc<T>) => {\r\n const ref:MutableRefObject<any> = useRef(null);\r\n if (ref.current === null) {\r\n ref.current = initValFunc();\r\n }\r\n return ref;\r\n};\r\n\r\n// used by: useMobx","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":";;;AAEM,SAAU,SAA+D,KAAU,OAAc,SAA2B,UAAU,OAAK;CAC/I,MAAM,kBAAkB,YAAY,CAAC,MAAW;AAC9C,MAAG,IAAI,kBAAkB,WAAW,WAClC,SAAQ,EAAE;CAEb,GAAC,CAAC,KAAI,OAAQ,EAAC;AAChB,WAAU,MAAK;EACb,MAAM,MAAM,IAAI;AAChB,MAAI,IAEF,KAAI,iBAAiB,OAAO,iBAAiB;GAAE;GAAS,SAAQ;EAAO,EAAC;AAG1E,SAAO,SAAS,UAAO;AACrB,OAAG,IACD,KAAI,oBAAoB,OAAO,iBAAiB;IAAC;IAAS,SAAQ;GAAM,EAAC;EAE5E;CACF,GAAC;EAAC;EAAI;EAAM;EAAQ;CAAQ,EAAC;AAC/B;;;;MClBY,aAAa,CAAI,gBAA2B;CACvD,MAAM,MAA4B,OAAO,KAAK;AAC9C,KAAI,IAAI,YAAY,KAClB,KAAI,UAAU,aAAa;AAE7B,QAAO;AACR;;;;MCMY,cAAc,CAAmC,OAAU,iBAAkD;CACxH,MAAM,KAAK,WAAW,MAAM,IAAI,MAAM,GAAG,cAAc;AACvD,QAAO,GAAG;AACX"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../lib/hooks/use-event.ts","../lib/hooks/useLazyRef.ts","../lib/hooks/useInstance.ts"],"sourcesContent":["","",""],"mappings":";;;AAEM,SAAU,SAA+D,KAAU,OAAc,SAA2B,UAAU,OAAK;CAC/I,MAAM,kBAAkB,YAAY,CAAC,MAAS;AAC5C,MAAG,IAAI,kBAAkB,WAAW,WAClC,SAAQ,EAAE;CAEb,GAAC,CACF,KACE;WAEE,MAAA;QACA,MAAI,IAAA;AACN,MAAA,IAEA,KAAO,iBAAgB,OAAA,iBAAA;GAClB;GACD,SAAI;EACN,EAAA;AAGN,SAAA,SAAA,UAAA;;;;;;;;;;;;;;;;MClBa,aAAa,CAAI,gBAAyB;CACrD,MAAM,MAA4B,OAAO,KAAK;AAC9C,KAAI,IAAI,YAAY,KAClB,KAAI,UAAU,aAAa;AAE7B,QAAO;AACR;;;;;CCMD,MAAO,KAAM,WAAW,MAAsC,IAAQ,MAAE,GAAA,cAAkD;AACxH,QAAM,GAAE"}
@@ -1,77 +1,2 @@
1
- (function(global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.JBCoreReact = {}), global.React));
5
- })(this, function(exports, react) {
6
- "use strict";
7
- //#region rolldown:runtime
8
- var __create = Object.create;
9
- var __defProp = Object.defineProperty;
10
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
- var __getOwnPropNames = Object.getOwnPropertyNames;
12
- var __getProtoOf = Object.getPrototypeOf;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
16
- key = keys[i];
17
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: ((k) => from[k]).bind(null, key),
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
- value: mod,
26
- enumerable: true
27
- }) : target, mod));
28
-
29
- //#endregion
30
- react = __toESM(react);
31
-
32
- //#region web-component/jb-core/react/lib/hooks/use-event.ts
33
- function useEvent(ref, event, handler, passive = false) {
34
- const internalHandler = (0, react.useCallback)((e) => {
35
- if (ref.current && typeof handler == "function") handler(e);
36
- }, [ref, handler]);
37
- (0, react.useEffect)(() => {
38
- const dom = ref.current;
39
- if (dom) dom.addEventListener(event, internalHandler, {
40
- passive,
41
- capture: false
42
- });
43
- return function cleanup() {
44
- if (dom) dom.removeEventListener(event, internalHandler, {
45
- passive,
46
- capture: false
47
- });
48
- };
49
- }, [
50
- ref,
51
- event,
52
- handler,
53
- passive
54
- ]);
55
- }
56
-
57
- //#endregion
58
- //#region web-component/jb-core/react/lib/hooks/useLazyRef.ts
59
- const useLazyRef = (initValFunc) => {
60
- const ref = (0, react.useRef)(null);
61
- if (ref.current === null) ref.current = initValFunc();
62
- return ref;
63
- };
64
-
65
- //#endregion
66
- //#region web-component/jb-core/react/lib/hooks/useInstance.ts
67
- const useInstance = (Store, initializers) => {
68
- const vm = useLazyRef(() => new Store(...initializers));
69
- return vm.current;
70
- };
71
-
72
- //#endregion
73
- exports.useEvent = useEvent
74
- exports.useInstance = useInstance
75
- exports.useLazyRef = useLazyRef
76
- });
1
+ var e,t;e=this,t=function(e,t){"use strict";let r,n;var u=Object.create,o=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,f=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty;n=null!=(r=t)?u(f(r)):{},t=((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var u,f=l(t),i=0,s=f.length;i<s;i++)u=f[i],a.call(e,u)||void 0===u||o(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(n=c(t,u))||n.enumerable});return e})(r&&r.__esModule?n:o(n,"default",{value:r,enumerable:!0}),r);let i=e=>{let r=(0,t.useRef)(null);return null===r.current&&(r.current=e()),r};e.useEvent=function(e,r,n,u=!1){let o=(0,t.useCallback)(t=>{e.current&&"function"==typeof n&&n(t)},[e,n]);(0,t.useEffect)(()=>{let t=e.current;return t&&t.addEventListener(r,o,{passive:u,capture:!1}),function(){t&&t.removeEventListener(r,o,{passive:u,capture:!1})}},[e,r,n,u])},e.useInstance=(e,t)=>i(()=>new e(...t)).current,e.useLazyRef=i},"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);
77
2
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","names":[],"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 { MutableRefObject, useRef } from \"react\";\r\n\r\ntype InitFunc<T> = ()=>T\r\nexport const useLazyRef = <T>(initValFunc:InitFunc<T>) => {\r\n const ref:MutableRefObject<any> = useRef(null);\r\n if (ref.current === null) {\r\n ref.current = initValFunc();\r\n }\r\n return ref;\r\n};\r\n\r\n// used by: useMobx","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEM,SAAU,SAA+D,KAAU,OAAc,SAA2B,UAAU,OAAK;CAC/I,MAAM,kBAAkB,uBAAY,CAAC,MAAW;AAC9C,MAAG,IAAI,kBAAkB,WAAW,WAClC,SAAQ,EAAE;CAEb,GAAC,CAAC,KAAI,OAAQ,EAAC;AAChB,sBAAU,MAAK;EACb,MAAM,MAAM,IAAI;AAChB,MAAI,IAEF,KAAI,iBAAiB,OAAO,iBAAiB;GAAE;GAAS,SAAQ;EAAO,EAAC;AAG1E,SAAO,SAAS,UAAO;AACrB,OAAG,IACD,KAAI,oBAAoB,OAAO,iBAAiB;IAAC;IAAS,SAAQ;GAAM,EAAC;EAE5E;CACF,GAAC;EAAC;EAAI;EAAM;EAAQ;CAAQ,EAAC;AAC/B;;;;MClBY,aAAa,CAAI,gBAA2B;CACvD,MAAM,MAA4B,kBAAO,KAAK;AAC9C,KAAI,IAAI,YAAY,KAClB,KAAI,UAAU,aAAa;AAE7B,QAAO;AACR;;;;MCMY,cAAc,CAAmC,OAAU,iBAAkD;CACxH,MAAM,KAAK,WAAW,MAAM,IAAI,MAAM,GAAG,cAAc;AACvD,QAAO,GAAG;AACX"}
1
+ {"version":3,"file":"index.umd.js","names":[],"sources":["../lib/hooks/use-event.ts","../lib/hooks/useLazyRef.ts","../lib/hooks/useInstance.ts"],"sourcesContent":["","",""],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEM,SAAU,SAA+D,KAAU,OAAc,SAA2B,UAAU,OAAK;CAC/I,MAAM,kBAAkB,uBAAY,CAAC,MAAS;AAC5C,MAAG,IAAI,kBAAkB,WAAW,WAClC,SAAQ,EAAE;CAEb,GAAC,CACF,KACE;sBAEE,MAAA;QACA,MAAI,IAAA;AACN,MAAA,IAEA,KAAO,iBAAgB,OAAA,iBAAA;GAClB;GACD,SAAI;EACN,EAAA;AAGN,SAAA,SAAA,UAAA;;;;;;;;;;;;;;;;MClBa,aAAa,CAAI,gBAAyB;CACrD,MAAM,MAA4B,kBAAO,KAAK;AAC9C,KAAI,IAAI,YAAY,KAClB,KAAI,UAAU,aAAa;AAE7B,QAAO;AACR;;;;;CCMD,MAAO,KAAM,WAAW,MAAsC,IAAQ,MAAE,GAAA,cAAkD;AACxH,QAAM,GAAE"}
@@ -0,0 +1,3 @@
1
+ export * from './use-event.js';
2
+ export * from './useInstance.js';
3
+ export * from './useLazyRef.js';
@@ -0,0 +1 @@
1
+ export declare function useEvent<TRef extends React.MutableRefObject<any | null>, TEvent>(ref: TRef, event: string, handler?: (e: TEvent) => void, passive?: boolean): void;
@@ -0,0 +1,10 @@
1
+ type BaseConstructableClass<T = any> = new (...args: any[]) => T;
2
+ type Initializers<T extends BaseConstructableClass> = ConstructorParameters<T>;
3
+ /**
4
+ * create a instance of an class with lazy initialization
5
+ * @param Store class to create instance of
6
+ * @param initializers initializers to pass to the class constructor
7
+ * @returns instance of the class
8
+ */
9
+ export declare const useInstance: <T extends BaseConstructableClass<any>>(Store: T, initializers: ConstructorParameters<T>) => InstanceType<T>;
10
+ export {};
@@ -0,0 +1,4 @@
1
+ import { MutableRefObject } from "react";
2
+ type InitFunc<T> = () => T;
3
+ export declare const useLazyRef: <T>(initValFunc: InitFunc<T>) => MutableRefObject<any>;
4
+ export {};
@@ -0,0 +1 @@
1
+ export * from './hooks/index.js';
@@ -19,7 +19,7 @@
19
19
  "dist/"
20
20
  ],
21
21
  "main": "index.js",
22
- "types": "./dist/web-component/jb-core/react/lib/index.d.ts",
22
+ "types": "./dist/index.d.ts",
23
23
  "repository": {
24
24
  "type": "git",
25
25
  "url": "git@github.com:javadbat/jb-core.git"
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "baseUrl": ".",
4
+ "rootDir": "./lib",
5
+ "declarationDir": "./dist"
4
6
  },
5
7
  "include": [
6
8
  "lib/**/*.ts",
@@ -11,5 +13,5 @@
11
13
  "**/*.spec.ts",
12
14
  "dist",
13
15
  ],
14
- "extends":"../../tsconfig-react.json"
16
+ "extends":"../configs/tsconfig-react.json"
15
17
  }
@@ -0,0 +1,15 @@
1
+ //this is a schema for colors do not use it in your code base we will remove it later when pallet is ready in theme folder
2
+ root{
3
+ //recommended by teammate
4
+ --primary-c:blue,
5
+ --secondary-c:red,
6
+ --grey-c:#888,
7
+ // status
8
+ --error-c,
9
+ --success-c,
10
+ --warning-c,
11
+ --info-c
12
+ //and about shade
13
+ --primary-c-100:#44000000;
14
+ // we must have this color but use semantic color name in our code base
15
+ }
@@ -0,0 +1,39 @@
1
+ export function defineColors() {
2
+ setColorProperty({
3
+ name: "--jb-primary",
4
+ syntax: "<color>",
5
+ inherits: true,
6
+ initialValue: "oklch(0.6 0.26 256)",
7
+ });
8
+ setColorProperty({
9
+ name: "--jb-neutral",
10
+ syntax: "<color>",
11
+ inherits: true,
12
+ initialValue: "oklch(0.18 0.014 258.36)",
13
+ });
14
+ setColorProperty({
15
+ name: "--jb-black",
16
+ syntax: "<color>",
17
+ inherits: true,
18
+ initialValue: "oklch(0.14 0 0)",
19
+ });
20
+ setColorProperty({
21
+ name: "--jb-white",
22
+ syntax: "<color>",
23
+ inherits: true,
24
+ initialValue: "oklch(1 0 0)",
25
+ });
26
+ }
27
+ function setColorProperty(value: PropertyDefinition) {
28
+ try {
29
+ window.CSS.registerProperty({
30
+ ...value
31
+ });
32
+ } catch (e) {
33
+ // if property is already defined
34
+ }
35
+ }
36
+ //
37
+ export function getNeutralColor(index: number) {
38
+ return `oklch(${(6 * (3+index*1.3))*0.01} ${(14+(index*0.09))*0.001} 258.36)`;
39
+ }
@@ -1,3 +0,0 @@
1
- declare function faToEnDigits(input: string | number): string;
2
- declare function enToFaDigits(input: string | number): string;
3
- export { enToFaDigits, faToEnDigits };