jb-core
Version:
jb design system core modules
2 lines • 1.58 kB
JavaScript
;exports.createFocusEvent=function(e,t,n){const o={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed,detail:t.detail,view:t.view,which:t.which,relatedTarget:t.relatedTarget,...n};return new FocusEvent(e,o)},exports.createInputEvent=function(e,t,n){const o={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():[],...n};return new InputEvent(e,o)},exports.createKeyboardEvent=function(e,t,n){const o={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,...n};return new KeyboardEvent(e,o)},exports.enToFaDigits=function(e){return"string"!=typeof e&&isNaN(e)?"":e.toString().replace(/[0-9]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+1728)}))},exports.faToEnDigits=function(e){return"string"!=typeof e?"":e.replace(/[۰-۹]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)-1728)}))},exports.isMobile=()=>/Mobi/i.test(window.navigator.userAgent),exports.listenAndSilentEvent=function(e,t,n,o={}){document.addEventListener(t,(t=>{t.composedPath().includes(e)&&(t.stopPropagation(),t.stopImmediatePropagation(),n(t))}),{capture:!0,...o})};
//# sourceMappingURL=index.cjs.js.map