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
package/configs/global.d.ts
CHANGED
|
@@ -5,15 +5,19 @@ declare module '*.scss' {
|
|
|
5
5
|
const value: FileStringModules;
|
|
6
6
|
export default value;
|
|
7
7
|
}
|
|
8
|
-
declare module '*.css' {
|
|
9
|
-
const value: FileStringModules;
|
|
10
|
-
export default value;
|
|
11
|
-
}
|
|
12
|
-
declare module '*.
|
|
8
|
+
declare module '*.css' {
|
|
9
|
+
const value: FileStringModules;
|
|
10
|
+
export default value;
|
|
11
|
+
}
|
|
12
|
+
declare module '*.css?inline' {
|
|
13
|
+
const value: string;
|
|
14
|
+
export default value;
|
|
15
|
+
}
|
|
16
|
+
declare module '*.html' {
|
|
13
17
|
const value: FileStringModules;
|
|
14
18
|
export default value.default;
|
|
15
19
|
}
|
|
16
20
|
declare module '*.svg' {
|
|
17
21
|
const value: string;
|
|
18
22
|
export default value;
|
|
19
|
-
}
|
|
23
|
+
}
|
|
@@ -13,17 +13,14 @@
|
|
|
13
13
|
"noImplicitAny": false,
|
|
14
14
|
"noLib": false,
|
|
15
15
|
"declaration": true,
|
|
16
|
-
"declarationDir": "./",
|
|
17
|
-
"declarationMap": false,
|
|
18
|
-
"jsx": "react",
|
|
19
|
-
"
|
|
20
|
-
},
|
|
21
|
-
"
|
|
22
|
-
"global.d.ts",
|
|
23
|
-
],
|
|
24
|
-
"exclude": [
|
|
16
|
+
"declarationDir": "./",
|
|
17
|
+
"declarationMap": false,
|
|
18
|
+
"jsx": "react",
|
|
19
|
+
"types": ["jb-core/configs/global"],
|
|
20
|
+
},
|
|
21
|
+
"exclude": [
|
|
25
22
|
"node_modules",
|
|
26
23
|
"**/*.spec.ts",
|
|
27
24
|
],
|
|
28
25
|
"extends":"./tsconfig-base.json"
|
|
29
|
-
}
|
|
26
|
+
}
|
|
@@ -7,18 +7,15 @@
|
|
|
7
7
|
"preserveConstEnums": true,
|
|
8
8
|
"moduleResolution": "bundler",
|
|
9
9
|
"sourceMap": true,
|
|
10
|
-
"allowJs": true,
|
|
11
|
-
"target": "ES2020",
|
|
12
|
-
"
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"declarationMap": true,
|
|
15
|
-
},
|
|
16
|
-
"
|
|
17
|
-
"global.d.ts",
|
|
18
|
-
],
|
|
19
|
-
"exclude": [
|
|
10
|
+
"allowJs": true,
|
|
11
|
+
"target": "ES2020",
|
|
12
|
+
"types": ["jb-core/configs/global"],
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
},
|
|
16
|
+
"exclude": [
|
|
20
17
|
"node_modules",
|
|
21
18
|
"**/*.spec.ts",
|
|
22
19
|
],
|
|
23
20
|
"extends":"./tsconfig-base.json"
|
|
24
|
-
}
|
|
21
|
+
}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,110 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
exports.createFocusEvent = function(e, t, o) {
|
|
3
|
+
const n = {
|
|
4
|
+
bubbles: t.bubbles,
|
|
5
|
+
cancelable: t.cancelable,
|
|
6
|
+
composed: t.composed,
|
|
7
|
+
detail: t.detail,
|
|
8
|
+
view: t.view,
|
|
9
|
+
which: t.which,
|
|
10
|
+
relatedTarget: t.relatedTarget,
|
|
11
|
+
...o
|
|
12
|
+
};
|
|
13
|
+
return new FocusEvent(e, n);
|
|
14
|
+
}, exports.createInputEvent = function(e, t, o) {
|
|
15
|
+
const n = {
|
|
16
|
+
bubbles: t.bubbles,
|
|
17
|
+
cancelable: t.cancelable,
|
|
18
|
+
composed: t.composed,
|
|
19
|
+
detail: t.detail,
|
|
20
|
+
isComposing: t.isComposing,
|
|
21
|
+
view: t.view,
|
|
22
|
+
which: t.which,
|
|
23
|
+
data: t.data,
|
|
24
|
+
dataTransfer: t.dataTransfer,
|
|
25
|
+
inputType: t.inputType,
|
|
26
|
+
targetRanges: "function" == typeof t.getTargetRanges ? t.getTargetRanges() : [],
|
|
27
|
+
...o
|
|
28
|
+
};
|
|
29
|
+
return new InputEvent(e, n);
|
|
30
|
+
}, exports.createKeyboardEvent = function(e, t, o) {
|
|
31
|
+
const n = {
|
|
32
|
+
altKey: t.altKey,
|
|
33
|
+
bubbles: t.bubbles,
|
|
34
|
+
cancelable: t.cancelable,
|
|
35
|
+
code: t.code,
|
|
36
|
+
composed: t.composed,
|
|
37
|
+
ctrlKey: t.ctrlKey,
|
|
38
|
+
detail: t.detail,
|
|
39
|
+
isComposing: t.isComposing,
|
|
40
|
+
key: t.key,
|
|
41
|
+
location: t.location,
|
|
42
|
+
metaKey: t.metaKey,
|
|
43
|
+
repeat: t.repeat,
|
|
44
|
+
shiftKey: t.shiftKey,
|
|
45
|
+
view: t.view,
|
|
46
|
+
charCode: t.charCode,
|
|
47
|
+
keyCode: t.keyCode,
|
|
48
|
+
which: t.which,
|
|
49
|
+
...o
|
|
50
|
+
};
|
|
51
|
+
return new KeyboardEvent(e, n);
|
|
52
|
+
}, exports.createMouseEvent = function(e, t, o) {
|
|
53
|
+
const n = {
|
|
54
|
+
bubbles: t.bubbles,
|
|
55
|
+
cancelable: t.cancelable,
|
|
56
|
+
composed: t.composed,
|
|
57
|
+
detail: t.detail,
|
|
58
|
+
view: t.view,
|
|
59
|
+
which: t.which,
|
|
60
|
+
altKey: t.altKey,
|
|
61
|
+
button: t.button,
|
|
62
|
+
buttons: t.buttons,
|
|
63
|
+
clientX: t.clientX,
|
|
64
|
+
clientY: t.clientY,
|
|
65
|
+
ctrlKey: t.ctrlKey,
|
|
66
|
+
metaKey: t.metaKey,
|
|
67
|
+
shiftKey: t.shiftKey,
|
|
68
|
+
movementX: t.movementX,
|
|
69
|
+
movementY: t.movementY,
|
|
70
|
+
screenX: t.screenX,
|
|
71
|
+
screenY: t.screenY,
|
|
72
|
+
relatedTarget: t.relatedTarget,
|
|
73
|
+
modifierAltGraph: t.getModifierState("AltGraph"),
|
|
74
|
+
modifierCapsLock: t.getModifierState("CapsLock"),
|
|
75
|
+
modifierFn: t.getModifierState("Fn"),
|
|
76
|
+
modifierFnLock: t.getModifierState("FnLock"),
|
|
77
|
+
modifierHyper: t.getModifierState("Hyper"),
|
|
78
|
+
modifierNumLock: t.getModifierState("NumLock"),
|
|
79
|
+
modifierScrollLock: t.getModifierState("ScrollLock"),
|
|
80
|
+
modifierSuper: t.getModifierState("Super"),
|
|
81
|
+
modifierSymbol: t.getModifierState("Symbol"),
|
|
82
|
+
modifierSymbolLock: t.getModifierState("SymbolLock"),
|
|
83
|
+
...o
|
|
84
|
+
};
|
|
85
|
+
return new MouseEvent(e, n);
|
|
86
|
+
}, exports.enToFaDigits = function(e) {
|
|
87
|
+
return "string" != typeof e && isNaN(e) ? "" : e.toString().replace(/[0-9]/g, function(e) {
|
|
88
|
+
return String.fromCharCode(e.charCodeAt(0) + 1728);
|
|
89
|
+
});
|
|
90
|
+
}, exports.faToEnDigits = function(e) {
|
|
91
|
+
return "string" != typeof e ? "" : e.replace(/[۰-۹]/g, function(e) {
|
|
92
|
+
return String.fromCharCode(e.charCodeAt(0) - 1728);
|
|
93
|
+
});
|
|
94
|
+
}, exports.injectCss = function(e, t = document) {
|
|
95
|
+
const o = new CSSStyleSheet();
|
|
96
|
+
return o.replaceSync(e), t.adoptedStyleSheets.push(o), o;
|
|
97
|
+
}, exports.isMobile = () => /Mobi/i.test(window.navigator.userAgent), exports.listenAndSilentEvent = function(e, t, o, n = {}) {
|
|
98
|
+
document.addEventListener(t, (t) => {
|
|
99
|
+
t.composedPath().includes(e) && (t.stopPropagation(), t.stopImmediatePropagation(), o(t));
|
|
100
|
+
}, {
|
|
101
|
+
capture: !0,
|
|
102
|
+
...n
|
|
103
|
+
});
|
|
104
|
+
}, exports.parseBooleanAttribute = function(e, t = !1) {
|
|
105
|
+
return null === e ? t : "" === e || "true" === e.toLowerCase() || "false" !== e.toLowerCase() && Boolean(e);
|
|
106
|
+
}, exports.uniqueId = function(e = "") {
|
|
107
|
+
return crypto?.randomUUID ? `${e}-${crypto.randomUUID()}` : `${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
108
|
+
};
|
|
109
|
+
|
|
2
110
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.br
CHANGED
|
Binary file
|
package/dist/index.cjs.js.gz
CHANGED
|
Binary file
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"index.cjs.js","names":[],"sources":["../lib/events.ts","../lib/device-detection.ts","../lib/persian-tools.ts","../lib/style-tools.ts","../lib/utils.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 as keyof DocumentEventMap, (e: Event) => {\r\n if (e.composedPath().includes(element as unknown as EventTarget)) {\r\n e.stopPropagation();\r\n e.stopImmediatePropagation();\r\n handler(e as TEvent);\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\nexport function createMouseEvent(eventName: string, e: MouseEvent, initObj: MouseEventInit) {\r\n const initialObject: MouseEventInit = {\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 altKey:e.altKey,\r\n button:e.button,\r\n buttons:e.buttons,\r\n clientX:e.clientX, \r\n clientY:e.clientY,\r\n ctrlKey:e.ctrlKey,\r\n metaKey:e.metaKey,\r\n shiftKey:e.shiftKey,\r\n movementX:e.movementX,\r\n movementY:e.movementY,\r\n screenX:e.screenX,\r\n screenY:e.screenY,\r\n relatedTarget:e.relatedTarget,\r\n modifierAltGraph:e.getModifierState(\"AltGraph\"),\r\n modifierCapsLock:e.getModifierState(\"CapsLock\"),\r\n modifierFn:e.getModifierState(\"Fn\"),\r\n modifierFnLock:e.getModifierState(\"FnLock\"),\r\n modifierHyper:e.getModifierState(\"Hyper\"),\r\n modifierNumLock:e.getModifierState(\"NumLock\"),\r\n modifierScrollLock:e.getModifierState(\"ScrollLock\"),\r\n modifierSuper:e.getModifierState(\"Super\"),\r\n modifierSymbol:e.getModifierState(\"Symbol\"),\r\n modifierSymbolLock:e.getModifierState(\"SymbolLock\"),\r\n ...initObj\r\n };\r\n const event = new MouseEvent(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};","export function injectCss (css: string, mainDom: ShadowRoot|Document = document) {\r\n const stylesheet = new CSSStyleSheet();\r\n stylesheet.replaceSync(css);\r\n mainDom.adoptedStyleSheets.push(stylesheet);\r\n return stylesheet;\r\n}","export function uniqueId(prefix = '') {\n if (crypto?.randomUUID) return `${prefix}-${crypto.randomUUID()}`;\n return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2)}`;\n}\n/**\n * to convert string attribute value to boolean in web-component.\n */\nexport function parseBooleanAttribute(value: string | null, defaultValue = false): boolean {\n if (value === null) {\n return defaultValue;\n }\n if (value === \"\" || value.toLowerCase() === \"true\") {\n return true;\n }\n if (value.toLowerCase() === \"false\") {\n return false;\n }\n return Boolean(value);\n}\n"],"mappings":";2BA0GA,SAAiC,GAAmB,GAAe,GAAA;CACjE,MAAM,IAAgC;EACpC,SAAS,EAAE;EACX,YAAY,EAAE;EACd,UAAU,EAAE;EACZ,QAAQ,EAAE;EACV,MAAM,EAAE;EACR,OAAO,EAAE;EACT,eAAe,EAAE;EAAA,GACd;CAAA;CAGL,OAAO,IADW,WAAW,GAAW,CAAA;AAE1C,GAAA,QAAA,mBAvEA,SAAiC,GAAmB,GAAe,GAAA;CACjE,MAAM,IAAgC;EACpC,SAAS,EAAE;EACX,YAAY,EAAE;EACd,UAAU,EAAE;EACZ,QAAQ,EAAE;EACV,aAAa,EAAE;EACf,MAAM,EAAE;EACR,OAAO,EAAE;EACT,MAAM,EAAE;EACR,cAAc,EAAE;EAChB,WAAW,EAAE;EACb,cAA0C,cAAA,OAArB,EAAE,kBAAgC,EAAE,gBAAA,IAAoB,CAAA;EAAA,GAC1E;CAAA;CAGL,OAAO,IADW,WAAW,GAAW,CAAA;AAE1C,GAAA,QAAA,sBA5CA,SAAoC,GAAmB,GAAkB,GAAA;CACvE,MAAM,IAAmC;EACvC,QAAQ,EAAE;EACV,SAAS,EAAE;EACX,YAAY,EAAE;EACd,MAAM,EAAE;EACR,UAAU,EAAE;EACZ,SAAS,EAAE;EACX,QAAQ,EAAE;EACV,aAAa,EAAE;EACf,KAAK,EAAE;EACP,UAAU,EAAE;EACZ,SAAS,EAAE;EACX,QAA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KAGM,EAAM,QAAQ,UAAO,SAAU,GAAA;EAC5C,OAAO,OAAO,aAAa,EAAE,WAAW,CAAA,IAAK,IAAA;CAC/C,CAAA;AAGF,GAAA,QAAA,YCVA,SAA2B,GAAa,IAA+B,UAAA;CACrE,MAAM,IAAa,IAAI,cAAA;CAGvB,OAFA,EAAW,YAAY,CAAA,GACvB,EAAQ,mBAAmB,KAAK,CAAA,GACzB;AACT,GAAA,QAAA,iBFJS,QAAQ,KAAK,OAAO,UAAU,SAAA,GAAA,QAAA,uBDQvC,SAAoE,GAAkB,GAAmB,GAA6B,IAAmC,CAAC,GAAA;CACxK,SAAS,iBAAiB,IAAuC,MAAA;EAC3D,EAAE,aAAA,CAAA,CAAe,SAAS,CAAA,MAC5B,EAAE,gBAAA,GACF,EAAE,yBAAA,GACF,EAAQ,CAAA;CAAA,GAEV;EAAC,SAAA,CAAQ;EAAA,GAAQ;CAAA,CAAA;AACrB,GAAA,QAAA,wBIVA,SAAsC,GAAsB,IAAA,CAAe,GAAA;CACzE,OAAc,SAAV,IACK,IAEK,OAAV,KAAwC,WAAxB,EAAM,YAAA,KAGE,YAAxB,EAAM,YAAA,KAGH,QAAQ,CAAA;AACjB,GAAA,QAAA,WAlBA,SAAyB,IAAS,IAAA;CAChC,OAAI,QAAQ,aAAmB,GAAG,EAAA,GAAU,OAAO,WAAA,MAC5C,GAAG,EAAA,GAAU,KAAK,IAAA,EAAA,GAAS,KAAK,OAAA,CAAA,CAAS,SAAS,EAAA,CAAA,CAAI,MAAM,CAAA;AACrE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region modules/jb-core/lib/events.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* add type to event target for easier access to target
|
|
4
|
+
*/
|
|
5
|
+
type EventTypeWithTarget<TEvent, TTarget> = TEvent & {
|
|
6
|
+
target: TTarget;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* this function will stop event from propagate even in capturing phase and will call handler only if event target is the element
|
|
10
|
+
*/
|
|
11
|
+
declare function listenAndSilentEvent<TEvent extends Event, TTarget>(element: TTarget, eventName: string, handler: (e: TEvent) => void, options?: AddEventListenerOptions): void;
|
|
12
|
+
/**
|
|
13
|
+
* create a keyboardEvent based on `e` value and replace them with initObj
|
|
14
|
+
*/
|
|
15
|
+
declare function createKeyboardEvent(eventName: string, e: KeyboardEvent, initObj: KeyboardEventInit): KeyboardEvent;
|
|
16
|
+
/**
|
|
17
|
+
* create a InputEvent based on `e` value and replace them with initObj
|
|
18
|
+
*/
|
|
19
|
+
declare function createInputEvent(eventName: string, e: InputEvent, initObj: InputEventInit): InputEvent;
|
|
20
|
+
declare function createMouseEvent(eventName: string, e: MouseEvent, initObj: MouseEventInit): MouseEvent;
|
|
21
|
+
/**
|
|
22
|
+
* create a InputEvent based on `e` value and replace them with initObj
|
|
23
|
+
*/
|
|
24
|
+
declare function createFocusEvent(eventName: string, e: FocusEvent, initObj: FocusEventInit): FocusEvent;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region modules/jb-core/lib/device-detection.d.ts
|
|
27
|
+
declare const isMobile: () => boolean;
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region modules/jb-core/lib/persian-tools.d.ts
|
|
30
|
+
declare function faToEnDigits(input: string | number): string;
|
|
31
|
+
declare function enToFaDigits(input: string | number): string;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region modules/jb-core/lib/style-tools.d.ts
|
|
34
|
+
declare function injectCss(css: string, mainDom?: ShadowRoot | Document): CSSStyleSheet;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region modules/jb-core/lib/utils.d.ts
|
|
37
|
+
declare function uniqueId(prefix?: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* to convert string attribute value to boolean in web-component.
|
|
40
|
+
*/
|
|
41
|
+
declare function parseBooleanAttribute(value: string | null, defaultValue?: boolean): boolean;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { EventTypeWithTarget, createFocusEvent, createInputEvent, createKeyboardEvent, createMouseEvent, enToFaDigits, faToEnDigits, injectCss, isMobile, listenAndSilentEvent, parseBooleanAttribute, uniqueId };
|
|
6
44
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../lib/events.ts","../lib/device-detection.ts","../lib/persian-tools.ts","../lib/style-tools.ts","../lib/utils.ts"],"mappings":";;AAGA;;KAAY,mBAAA,oBAAuC,MAAA;EACjD,MAAA,EAAQ,OAAO;AAAA;;;;iBAKD,oBAAA,gBAAoC,KAAA,WAAgB,OAAA,EAAS,OAAA,EAAS,SAAA,UAAmB,OAAA,GAAU,CAAA,EAAE,MAAA,WAAiB,OAAA,GAAS,uBAAA;;AAL9H;AAKjB;iBAYgB,mBAAA,CAAoB,SAAA,UAAmB,CAAA,EAAG,aAAA,EAAe,OAAA,EAAS,iBAAA,GAAiB,aAAA;;;;iBA2BnF,gBAAA,CAAiB,SAAA,UAAmB,CAAA,EAAG,UAAA,EAAY,OAAA,EAAS,cAAA,GAAc,UAAA;AAAA,iBAkB1E,gBAAA,CAAiB,SAAA,UAAmB,CAAA,EAAG,UAAA,EAAY,OAAA,EAAS,cAAA,GAAc,UAAA;;;;iBAwC1E,gBAAA,CAAiB,SAAA,UAAmB,CAAA,EAAG,UAAA,EAAY,OAAA,EAAS,cAAA,GAAc,UAAA;;;cC1G7E,QAAA;;;iBCAJ,YAAA,CAAa,KAAqB;AAAA,iBAYlC,YAAA,CAAa,KAAqB;;;iBCZ3B,SAAA,CAAW,GAAA,UAAa,OAAA,GAAS,UAAA,GAAW,QAAA,GAAmB,aAAA;;;iBCA/D,QAAA,CAAS,MAAW;AJGpC;;;AAAA,iBIIgB,qBAAA,CAAsB,KAAA,iBAAsB,YAAoB"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,120 @@
|
|
|
1
|
-
function e(e,
|
|
1
|
+
function e(e, t, o, n = {}) {
|
|
2
|
+
document.addEventListener(t, (t) => {
|
|
3
|
+
t.composedPath().includes(e) && (t.stopPropagation(), t.stopImmediatePropagation(), o(t));
|
|
4
|
+
}, {
|
|
5
|
+
capture: !0,
|
|
6
|
+
...n
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function t(e, t, o) {
|
|
10
|
+
const n = {
|
|
11
|
+
altKey: t.altKey,
|
|
12
|
+
bubbles: t.bubbles,
|
|
13
|
+
cancelable: t.cancelable,
|
|
14
|
+
code: t.code,
|
|
15
|
+
composed: t.composed,
|
|
16
|
+
ctrlKey: t.ctrlKey,
|
|
17
|
+
detail: t.detail,
|
|
18
|
+
isComposing: t.isComposing,
|
|
19
|
+
key: t.key,
|
|
20
|
+
location: t.location,
|
|
21
|
+
metaKey: t.metaKey,
|
|
22
|
+
repeat: t.repeat,
|
|
23
|
+
shiftKey: t.shiftKey,
|
|
24
|
+
view: t.view,
|
|
25
|
+
charCode: t.charCode,
|
|
26
|
+
keyCode: t.keyCode,
|
|
27
|
+
which: t.which,
|
|
28
|
+
...o
|
|
29
|
+
};
|
|
30
|
+
return new KeyboardEvent(e, n);
|
|
31
|
+
}
|
|
32
|
+
function o(e, t, o) {
|
|
33
|
+
const n = {
|
|
34
|
+
bubbles: t.bubbles,
|
|
35
|
+
cancelable: t.cancelable,
|
|
36
|
+
composed: t.composed,
|
|
37
|
+
detail: t.detail,
|
|
38
|
+
isComposing: t.isComposing,
|
|
39
|
+
view: t.view,
|
|
40
|
+
which: t.which,
|
|
41
|
+
data: t.data,
|
|
42
|
+
dataTransfer: t.dataTransfer,
|
|
43
|
+
inputType: t.inputType,
|
|
44
|
+
targetRanges: "function" == typeof t.getTargetRanges ? t.getTargetRanges() : [],
|
|
45
|
+
...o
|
|
46
|
+
};
|
|
47
|
+
return new InputEvent(e, n);
|
|
48
|
+
}
|
|
49
|
+
function n(e, t, o) {
|
|
50
|
+
const n = {
|
|
51
|
+
bubbles: t.bubbles,
|
|
52
|
+
cancelable: t.cancelable,
|
|
53
|
+
composed: t.composed,
|
|
54
|
+
detail: t.detail,
|
|
55
|
+
view: t.view,
|
|
56
|
+
which: t.which,
|
|
57
|
+
altKey: t.altKey,
|
|
58
|
+
button: t.button,
|
|
59
|
+
buttons: t.buttons,
|
|
60
|
+
clientX: t.clientX,
|
|
61
|
+
clientY: t.clientY,
|
|
62
|
+
ctrlKey: t.ctrlKey,
|
|
63
|
+
metaKey: t.metaKey,
|
|
64
|
+
shiftKey: t.shiftKey,
|
|
65
|
+
movementX: t.movementX,
|
|
66
|
+
movementY: t.movementY,
|
|
67
|
+
screenX: t.screenX,
|
|
68
|
+
screenY: t.screenY,
|
|
69
|
+
relatedTarget: t.relatedTarget,
|
|
70
|
+
modifierAltGraph: t.getModifierState("AltGraph"),
|
|
71
|
+
modifierCapsLock: t.getModifierState("CapsLock"),
|
|
72
|
+
modifierFn: t.getModifierState("Fn"),
|
|
73
|
+
modifierFnLock: t.getModifierState("FnLock"),
|
|
74
|
+
modifierHyper: t.getModifierState("Hyper"),
|
|
75
|
+
modifierNumLock: t.getModifierState("NumLock"),
|
|
76
|
+
modifierScrollLock: t.getModifierState("ScrollLock"),
|
|
77
|
+
modifierSuper: t.getModifierState("Super"),
|
|
78
|
+
modifierSymbol: t.getModifierState("Symbol"),
|
|
79
|
+
modifierSymbolLock: t.getModifierState("SymbolLock"),
|
|
80
|
+
...o
|
|
81
|
+
};
|
|
82
|
+
return new MouseEvent(e, n);
|
|
83
|
+
}
|
|
84
|
+
function i(e, t, o) {
|
|
85
|
+
const n = {
|
|
86
|
+
bubbles: t.bubbles,
|
|
87
|
+
cancelable: t.cancelable,
|
|
88
|
+
composed: t.composed,
|
|
89
|
+
detail: t.detail,
|
|
90
|
+
view: t.view,
|
|
91
|
+
which: t.which,
|
|
92
|
+
relatedTarget: t.relatedTarget,
|
|
93
|
+
...o
|
|
94
|
+
};
|
|
95
|
+
return new FocusEvent(e, n);
|
|
96
|
+
}
|
|
97
|
+
const r = () => /Mobi/i.test(window.navigator.userAgent);
|
|
98
|
+
function a(e) {
|
|
99
|
+
return "string" != typeof e ? "" : e.replace(/[۰-۹]/g, function(e) {
|
|
100
|
+
return String.fromCharCode(e.charCodeAt(0) - 1728);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function c(e) {
|
|
104
|
+
return "string" != typeof e && isNaN(e) ? "" : e.toString().replace(/[0-9]/g, function(e) {
|
|
105
|
+
return String.fromCharCode(e.charCodeAt(0) + 1728);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function l(e, t = document) {
|
|
109
|
+
const o = new CSSStyleSheet();
|
|
110
|
+
return o.replaceSync(e), t.adoptedStyleSheets.push(o), o;
|
|
111
|
+
}
|
|
112
|
+
function d(e = "") {
|
|
113
|
+
return crypto?.randomUUID ? `${e}-${crypto.randomUUID()}` : `${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
114
|
+
}
|
|
115
|
+
function s(e, t = !1) {
|
|
116
|
+
return null === e ? t : "" === e || "true" === e.toLowerCase() || "false" !== e.toLowerCase() && Boolean(e);
|
|
117
|
+
}
|
|
118
|
+
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 };
|
|
119
|
+
|
|
2
120
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.br
CHANGED
|
Binary file
|
package/dist/index.js.gz
CHANGED
|
Binary file
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../lib/events.ts","../lib/device-detection.ts","../lib/persian-tools.ts","../lib/style-tools.ts","../lib/utils.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 as keyof DocumentEventMap, (e: Event) => {\r\n if (e.composedPath().includes(element as unknown as EventTarget)) {\r\n e.stopPropagation();\r\n e.stopImmediatePropagation();\r\n handler(e as TEvent);\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\nexport function createMouseEvent(eventName: string, e: MouseEvent, initObj: MouseEventInit) {\r\n const initialObject: MouseEventInit = {\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 altKey:e.altKey,\r\n button:e.button,\r\n buttons:e.buttons,\r\n clientX:e.clientX, \r\n clientY:e.clientY,\r\n ctrlKey:e.ctrlKey,\r\n metaKey:e.metaKey,\r\n shiftKey:e.shiftKey,\r\n movementX:e.movementX,\r\n movementY:e.movementY,\r\n screenX:e.screenX,\r\n screenY:e.screenY,\r\n relatedTarget:e.relatedTarget,\r\n modifierAltGraph:e.getModifierState(\"AltGraph\"),\r\n modifierCapsLock:e.getModifierState(\"CapsLock\"),\r\n modifierFn:e.getModifierState(\"Fn\"),\r\n modifierFnLock:e.getModifierState(\"FnLock\"),\r\n modifierHyper:e.getModifierState(\"Hyper\"),\r\n modifierNumLock:e.getModifierState(\"NumLock\"),\r\n modifierScrollLock:e.getModifierState(\"ScrollLock\"),\r\n modifierSuper:e.getModifierState(\"Super\"),\r\n modifierSymbol:e.getModifierState(\"Symbol\"),\r\n modifierSymbolLock:e.getModifierState(\"SymbolLock\"),\r\n ...initObj\r\n };\r\n const event = new MouseEvent(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};","export function injectCss (css: string, mainDom: ShadowRoot|Document = document) {\r\n const stylesheet = new CSSStyleSheet();\r\n stylesheet.replaceSync(css);\r\n mainDom.adoptedStyleSheets.push(stylesheet);\r\n return stylesheet;\r\n}","export function uniqueId(prefix = '') {\n if (crypto?.randomUUID) return `${prefix}-${crypto.randomUUID()}`;\n return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2)}`;\n}\n/**\n * to convert string attribute value to boolean in web-component.\n */\nexport function parseBooleanAttribute(value: string | null, defaultValue = false): boolean {\n if (value === null) {\n return defaultValue;\n }\n if (value === \"\" || value.toLowerCase() === \"true\") {\n return true;\n }\n if (value.toLowerCase() === \"false\") {\n return false;\n }\n return Boolean(value);\n}\n"],"mappings":"AASA,SAAgB,EAAoD,GAAkB,GAAmB,GAA6B,IAAmC,CAAC,GAAA;CACxK,SAAS,iBAAiB,IAAuC,MAAA;EAC3D,EAAE,aAAA,CAAA,CAAe,SAAS,CAAA,MAC5B,EAAE,gBAAA,GACF,EAAE,yBAAA,GACF,EAAQ,CAAA;CAAA,GAEV;EAAC,SAAA,CAAQ;EAAA,GAAQ;CAAA,CAAA;AACrB;AAIA,SAAgB,EAAoB,GAAmB,GAAkB,GAAA;CACvE,MAAM,IAAmC;EACvC,QAAQ,EAAE;EACV,SAAS,EAAE;EACX,YAAY,EAAE;EACd,MAAM,EAAE;EACR,UAAU,EAAE;EACZ,SA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AA;CACzE,OAAc,SAAV,IACK,IAEK,OAAV,KAAwC,WAAxB,EAAM,YAAA,KAGE,YAAxB,EAAM,YAAA,KAGH,QAAQ,CAAA;AACjB;AAAA,SAAA,KAAA,kBAAA,KAAA,kBAAA,KAAA,qBAAA,KAAA,kBAAA,KAAA,cAAA,KAAA,cAAA,KAAA,WAAA,KAAA,UAAA,KAAA,sBAAA,KAAA,uBAAA,KAAA"}
|
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,114 @@
|
|
|
1
|
-
|
|
1
|
+
(function(e, t) {
|
|
2
|
+
"object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).JBCore = {});
|
|
3
|
+
})(this, function(e) {
|
|
4
|
+
Object.defineProperty(e, Symbol.toStringTag, { value: "Module" });
|
|
5
|
+
e.createFocusEvent = function(e, t, o) {
|
|
6
|
+
const n = {
|
|
7
|
+
bubbles: t.bubbles,
|
|
8
|
+
cancelable: t.cancelable,
|
|
9
|
+
composed: t.composed,
|
|
10
|
+
detail: t.detail,
|
|
11
|
+
view: t.view,
|
|
12
|
+
which: t.which,
|
|
13
|
+
relatedTarget: t.relatedTarget,
|
|
14
|
+
...o
|
|
15
|
+
};
|
|
16
|
+
return new FocusEvent(e, n);
|
|
17
|
+
}, e.createInputEvent = function(e, t, o) {
|
|
18
|
+
const n = {
|
|
19
|
+
bubbles: t.bubbles,
|
|
20
|
+
cancelable: t.cancelable,
|
|
21
|
+
composed: t.composed,
|
|
22
|
+
detail: t.detail,
|
|
23
|
+
isComposing: t.isComposing,
|
|
24
|
+
view: t.view,
|
|
25
|
+
which: t.which,
|
|
26
|
+
data: t.data,
|
|
27
|
+
dataTransfer: t.dataTransfer,
|
|
28
|
+
inputType: t.inputType,
|
|
29
|
+
targetRanges: "function" == typeof t.getTargetRanges ? t.getTargetRanges() : [],
|
|
30
|
+
...o
|
|
31
|
+
};
|
|
32
|
+
return new InputEvent(e, n);
|
|
33
|
+
}, e.createKeyboardEvent = function(e, t, o) {
|
|
34
|
+
const n = {
|
|
35
|
+
altKey: t.altKey,
|
|
36
|
+
bubbles: t.bubbles,
|
|
37
|
+
cancelable: t.cancelable,
|
|
38
|
+
code: t.code,
|
|
39
|
+
composed: t.composed,
|
|
40
|
+
ctrlKey: t.ctrlKey,
|
|
41
|
+
detail: t.detail,
|
|
42
|
+
isComposing: t.isComposing,
|
|
43
|
+
key: t.key,
|
|
44
|
+
location: t.location,
|
|
45
|
+
metaKey: t.metaKey,
|
|
46
|
+
repeat: t.repeat,
|
|
47
|
+
shiftKey: t.shiftKey,
|
|
48
|
+
view: t.view,
|
|
49
|
+
charCode: t.charCode,
|
|
50
|
+
keyCode: t.keyCode,
|
|
51
|
+
which: t.which,
|
|
52
|
+
...o
|
|
53
|
+
};
|
|
54
|
+
return new KeyboardEvent(e, n);
|
|
55
|
+
}, e.createMouseEvent = function(e, t, o) {
|
|
56
|
+
const n = {
|
|
57
|
+
bubbles: t.bubbles,
|
|
58
|
+
cancelable: t.cancelable,
|
|
59
|
+
composed: t.composed,
|
|
60
|
+
detail: t.detail,
|
|
61
|
+
view: t.view,
|
|
62
|
+
which: t.which,
|
|
63
|
+
altKey: t.altKey,
|
|
64
|
+
button: t.button,
|
|
65
|
+
buttons: t.buttons,
|
|
66
|
+
clientX: t.clientX,
|
|
67
|
+
clientY: t.clientY,
|
|
68
|
+
ctrlKey: t.ctrlKey,
|
|
69
|
+
metaKey: t.metaKey,
|
|
70
|
+
shiftKey: t.shiftKey,
|
|
71
|
+
movementX: t.movementX,
|
|
72
|
+
movementY: t.movementY,
|
|
73
|
+
screenX: t.screenX,
|
|
74
|
+
screenY: t.screenY,
|
|
75
|
+
relatedTarget: t.relatedTarget,
|
|
76
|
+
modifierAltGraph: t.getModifierState("AltGraph"),
|
|
77
|
+
modifierCapsLock: t.getModifierState("CapsLock"),
|
|
78
|
+
modifierFn: t.getModifierState("Fn"),
|
|
79
|
+
modifierFnLock: t.getModifierState("FnLock"),
|
|
80
|
+
modifierHyper: t.getModifierState("Hyper"),
|
|
81
|
+
modifierNumLock: t.getModifierState("NumLock"),
|
|
82
|
+
modifierScrollLock: t.getModifierState("ScrollLock"),
|
|
83
|
+
modifierSuper: t.getModifierState("Super"),
|
|
84
|
+
modifierSymbol: t.getModifierState("Symbol"),
|
|
85
|
+
modifierSymbolLock: t.getModifierState("SymbolLock"),
|
|
86
|
+
...o
|
|
87
|
+
};
|
|
88
|
+
return new MouseEvent(e, n);
|
|
89
|
+
}, e.enToFaDigits = function(e) {
|
|
90
|
+
return "string" != typeof e && isNaN(e) ? "" : e.toString().replace(/[0-9]/g, function(e) {
|
|
91
|
+
return String.fromCharCode(e.charCodeAt(0) + 1728);
|
|
92
|
+
});
|
|
93
|
+
}, e.faToEnDigits = function(e) {
|
|
94
|
+
return "string" != typeof e ? "" : e.replace(/[۰-۹]/g, function(e) {
|
|
95
|
+
return String.fromCharCode(e.charCodeAt(0) - 1728);
|
|
96
|
+
});
|
|
97
|
+
}, e.injectCss = function(e, t = document) {
|
|
98
|
+
const o = new CSSStyleSheet();
|
|
99
|
+
return o.replaceSync(e), t.adoptedStyleSheets.push(o), o;
|
|
100
|
+
}, e.isMobile = () => /Mobi/i.test(window.navigator.userAgent), e.listenAndSilentEvent = function(e, t, o, n = {}) {
|
|
101
|
+
document.addEventListener(t, (t) => {
|
|
102
|
+
t.composedPath().includes(e) && (t.stopPropagation(), t.stopImmediatePropagation(), o(t));
|
|
103
|
+
}, {
|
|
104
|
+
capture: !0,
|
|
105
|
+
...n
|
|
106
|
+
});
|
|
107
|
+
}, e.parseBooleanAttribute = function(e, t = !1) {
|
|
108
|
+
return null === e ? t : "" === e || "true" === e.toLowerCase() || "false" !== e.toLowerCase() && Boolean(e);
|
|
109
|
+
}, e.uniqueId = function(e = "") {
|
|
110
|
+
return crypto?.randomUUID ? `${e}-${crypto.randomUUID()}` : `${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
|
|
2
114
|
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.br
CHANGED
|
Binary file
|
package/dist/index.umd.js.gz
CHANGED
|
Binary file
|