jb-core 0.0.3 → 0.0.4

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/dist/index.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";exports.createInputEvent=function(e,t,a){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():[],...a};return new InputEvent(e,o)},exports.createKeyboardEvent=function(e,t,a){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,...a};return new KeyboardEvent(e,o)};
1
+ "use strict";exports.createFocusEvent=function(e,t,a){const c={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed,detail:t.detail,view:t.view,which:t.which,relatedTarget:t.relatedTarget,...a};return new FocusEvent(e,c)},exports.createInputEvent=function(e,t,a){const c={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():[],...a};return new InputEvent(e,c)},exports.createKeyboardEvent=function(e,t,a){const c={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,...a};return new KeyboardEvent(e,c)};
2
2
  //# sourceMappingURL=index.cjs.js.map
Binary file
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../lib/events.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 * 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 keyboardEvent 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}"],"names":["eventName","e","initObj","initialObject","bubbles","cancelable","composed","detail","isComposing","view","which","data","dataTransfer","inputType","targetRanges","getTargetRanges","InputEvent","altKey","code","ctrlKey","key","location","metaKey","repeat","shiftKey","charCode","keyCode","KeyboardEvent"],"mappings":"+CAoCiCA,EAAiBC,EAAaC,GAC7D,MAAMC,EAAgC,CACpCC,QAAQH,EAAEG,QACVC,WAAWJ,EAAEI,WACbC,SAASL,EAAEK,SACXC,OAAON,EAAEM,OACTC,YAAYP,EAAEO,YACdC,KAAKR,EAAEQ,KACPC,MAAMT,EAAES,MACRC,KAAKV,EAAEU,KACPC,aAAaX,EAAEW,aACfC,UAAUZ,EAAEY,UACZC,aAA4C,mBAAvBb,EAAEc,kBAAgCd,EAAEc,kBAAkB,MACxEb,GAGL,OADc,IAAIc,WAAWhB,EAAWG,EAE1C,uCA5CoCH,EAAiBC,EAAgBC,GACnE,MAAMC,EAAmC,CACvCc,OAAOhB,EAAEgB,OACTb,QAAQH,EAAEG,QACVC,WAAWJ,EAAEI,WACba,KAAKjB,EAAEiB,KACPZ,SAASL,EAAEK,SACXa,QAAQlB,EAAEkB,QACVZ,OAAON,EAAEM,OACTC,YAAYP,EAAEO,YACdY,IAAInB,EAAEmB,IACNC,SAASpB,EAAEoB,SACXC,QAAQrB,EAAEqB,QACVC,OAAOtB,EAAEsB,OACTC,SAASvB,EAAEuB,SACXf,KAAKR,EAAEQ,KACPgB,SAASxB,EAAEwB,SACXC,QAAQzB,EAAEyB,QACVhB,MAAMT,EAAES,SACLR,GAGL,OADc,IAAIyB,cAAc3B,EAAWG,EAE7C"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../lib/events.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 * 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}"],"names":["eventName","e","initObj","initialObject","bubbles","cancelable","composed","detail","view","which","relatedTarget","FocusEvent","isComposing","data","dataTransfer","inputType","targetRanges","getTargetRanges","InputEvent","altKey","code","ctrlKey","key","location","metaKey","repeat","shiftKey","charCode","keyCode","KeyboardEvent"],"mappings":"+CA0DiCA,EAAiBC,EAAaC,GAC7D,MAAMC,EAAgC,CACpCC,QAAQH,EAAEG,QACVC,WAAWJ,EAAEI,WACbC,SAASL,EAAEK,SACXC,OAAON,EAAEM,OACTC,KAAKP,EAAEO,KACPC,MAAMR,EAAEQ,MACRC,cAAcT,EAAES,iBACbR,GAGL,OADc,IAAIS,WAAWX,EAAWG,EAE1C,oCAnCiCH,EAAiBC,EAAaC,GAC7D,MAAMC,EAAgC,CACpCC,QAAQH,EAAEG,QACVC,WAAWJ,EAAEI,WACbC,SAASL,EAAEK,SACXC,OAAON,EAAEM,OACTK,YAAYX,EAAEW,YACdJ,KAAKP,EAAEO,KACPC,MAAMR,EAAEQ,MACRI,KAAKZ,EAAEY,KACPC,aAAab,EAAEa,aACfC,UAAUd,EAAEc,UACZC,aAA4C,mBAAvBf,EAAEgB,kBAAgChB,EAAEgB,kBAAkB,MACxEf,GAGL,OADc,IAAIgB,WAAWlB,EAAWG,EAE1C,uCA5CoCH,EAAiBC,EAAgBC,GACnE,MAAMC,EAAmC,CACvCgB,OAAOlB,EAAEkB,OACTf,QAAQH,EAAEG,QACVC,WAAWJ,EAAEI,WACbe,KAAKnB,EAAEmB,KACPd,SAASL,EAAEK,SACXe,QAAQpB,EAAEoB,QACVd,OAAON,EAAEM,OACTK,YAAYX,EAAEW,YACdU,IAAIrB,EAAEqB,IACNC,SAAStB,EAAEsB,SACXC,QAAQvB,EAAEuB,QACVC,OAAOxB,EAAEwB,OACTC,SAASzB,EAAEyB,SACXlB,KAAKP,EAAEO,KACPmB,SAAS1B,EAAE0B,SACXC,QAAQ3B,EAAE2B,QACVnB,MAAMR,EAAEQ,SACLP,GAGL,OADc,IAAI2B,cAAc7B,EAAWG,EAE7C"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- function e(e,t,a){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,...a};return new KeyboardEvent(e,o)}function t(e,t,a){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():[],...a};return new InputEvent(e,o)}export{t as createInputEvent,e as createKeyboardEvent};
1
+ function e(e,t,a){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,...a};return new KeyboardEvent(e,o)}function t(e,t,a){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():[],...a};return new InputEvent(e,o)}function a(e,t,a){const o={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed,detail:t.detail,view:t.view,which:t.which,relatedTarget:t.relatedTarget,...a};return new FocusEvent(e,o)}export{a as createFocusEvent,t as createInputEvent,e as createKeyboardEvent};
2
2
  //# 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","sources":["../lib/events.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 * 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 keyboardEvent 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}"],"names":["createKeyboardEvent","eventName","e","initObj","initialObject","altKey","bubbles","cancelable","code","composed","ctrlKey","detail","isComposing","key","location","metaKey","repeat","shiftKey","view","charCode","keyCode","which","KeyboardEvent","createInputEvent","data","dataTransfer","inputType","targetRanges","getTargetRanges","InputEvent"],"mappings":"SASgBA,EAAoBC,EAAiBC,EAAgBC,GACnE,MAAMC,EAAmC,CACvCC,OAAOH,EAAEG,OACTC,QAAQJ,EAAEI,QACVC,WAAWL,EAAEK,WACbC,KAAKN,EAAEM,KACPC,SAASP,EAAEO,SACXC,QAAQR,EAAEQ,QACVC,OAAOT,EAAES,OACTC,YAAYV,EAAEU,YACdC,IAAIX,EAAEW,IACNC,SAASZ,EAAEY,SACXC,QAAQb,EAAEa,QACVC,OAAOd,EAAEc,OACTC,SAASf,EAAEe,SACXC,KAAKhB,EAAEgB,KACPC,SAASjB,EAAEiB,SACXC,QAAQlB,EAAEkB,QACVC,MAAMnB,EAAEmB,SACLlB,GAGL,OADc,IAAImB,cAAcrB,EAAWG,EAE7C,UAIgBmB,EAAiBtB,EAAiBC,EAAaC,GAC7D,MAAMC,EAAgC,CACpCE,QAAQJ,EAAEI,QACVC,WAAWL,EAAEK,WACbE,SAASP,EAAEO,SACXE,OAAOT,EAAES,OACTC,YAAYV,EAAEU,YACdM,KAAKhB,EAAEgB,KACPG,MAAMnB,EAAEmB,MACRG,KAAKtB,EAAEsB,KACPC,aAAavB,EAAEuB,aACfC,UAAUxB,EAAEwB,UACZC,aAA4C,mBAAvBzB,EAAE0B,kBAAgC1B,EAAE0B,kBAAkB,MACxEzB,GAGL,OADc,IAAI0B,WAAW5B,EAAWG,EAE1C"}
1
+ {"version":3,"file":"index.js","sources":["../lib/events.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 * 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}"],"names":["createKeyboardEvent","eventName","e","initObj","initialObject","altKey","bubbles","cancelable","code","composed","ctrlKey","detail","isComposing","key","location","metaKey","repeat","shiftKey","view","charCode","keyCode","which","KeyboardEvent","createInputEvent","data","dataTransfer","inputType","targetRanges","getTargetRanges","InputEvent","createFocusEvent","relatedTarget","FocusEvent"],"mappings":"SASgBA,EAAoBC,EAAiBC,EAAgBC,GACnE,MAAMC,EAAmC,CACvCC,OAAOH,EAAEG,OACTC,QAAQJ,EAAEI,QACVC,WAAWL,EAAEK,WACbC,KAAKN,EAAEM,KACPC,SAASP,EAAEO,SACXC,QAAQR,EAAEQ,QACVC,OAAOT,EAAES,OACTC,YAAYV,EAAEU,YACdC,IAAIX,EAAEW,IACNC,SAASZ,EAAEY,SACXC,QAAQb,EAAEa,QACVC,OAAOd,EAAEc,OACTC,SAASf,EAAEe,SACXC,KAAKhB,EAAEgB,KACPC,SAASjB,EAAEiB,SACXC,QAAQlB,EAAEkB,QACVC,MAAMnB,EAAEmB,SACLlB,GAGL,OADc,IAAImB,cAAcrB,EAAWG,EAE7C,UAIgBmB,EAAiBtB,EAAiBC,EAAaC,GAC7D,MAAMC,EAAgC,CACpCE,QAAQJ,EAAEI,QACVC,WAAWL,EAAEK,WACbE,SAASP,EAAEO,SACXE,OAAOT,EAAES,OACTC,YAAYV,EAAEU,YACdM,KAAKhB,EAAEgB,KACPG,MAAMnB,EAAEmB,MACRG,KAAKtB,EAAEsB,KACPC,aAAavB,EAAEuB,aACfC,UAAUxB,EAAEwB,UACZC,aAA4C,mBAAvBzB,EAAE0B,kBAAgC1B,EAAE0B,kBAAkB,MACxEzB,GAGL,OADc,IAAI0B,WAAW5B,EAAWG,EAE1C,UAKgB0B,EAAiB7B,EAAiBC,EAAaC,GAC7D,MAAMC,EAAgC,CACpCE,QAAQJ,EAAEI,QACVC,WAAWL,EAAEK,WACbE,SAASP,EAAEO,SACXE,OAAOT,EAAES,OACTO,KAAKhB,EAAEgB,KACPG,MAAMnB,EAAEmB,MACRU,cAAc7B,EAAE6B,iBACb5B,GAGL,OADc,IAAI6B,WAAW/B,EAAWG,EAE1C"}
package/dist/index.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"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={})}(this,(function(e){"use strict";e.createInputEvent=function(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)},e.createKeyboardEvent=function(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)}}));
1
+ !function(e,t){"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={})}(this,(function(e){"use strict";e.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)},e.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)},e.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)}}));
2
2
  //# sourceMappingURL=index.umd.js.map
Binary file
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../lib/events.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 * 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 keyboardEvent 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}"],"names":["eventName","e","initObj","initialObject","bubbles","cancelable","composed","detail","isComposing","view","which","data","dataTransfer","inputType","targetRanges","getTargetRanges","InputEvent","altKey","code","ctrlKey","key","location","metaKey","repeat","shiftKey","charCode","keyCode","KeyboardEvent"],"mappings":"0QAoCiCA,EAAiBC,EAAaC,GAC7D,MAAMC,EAAgC,CACpCC,QAAQH,EAAEG,QACVC,WAAWJ,EAAEI,WACbC,SAASL,EAAEK,SACXC,OAAON,EAAEM,OACTC,YAAYP,EAAEO,YACdC,KAAKR,EAAEQ,KACPC,MAAMT,EAAES,MACRC,KAAKV,EAAEU,KACPC,aAAaX,EAAEW,aACfC,UAAUZ,EAAEY,UACZC,aAA4C,mBAAvBb,EAAEc,kBAAgCd,EAAEc,kBAAkB,MACxEb,GAGL,OADc,IAAIc,WAAWhB,EAAWG,EAE1C,iCA5CoCH,EAAiBC,EAAgBC,GACnE,MAAMC,EAAmC,CACvCc,OAAOhB,EAAEgB,OACTb,QAAQH,EAAEG,QACVC,WAAWJ,EAAEI,WACba,KAAKjB,EAAEiB,KACPZ,SAASL,EAAEK,SACXa,QAAQlB,EAAEkB,QACVZ,OAAON,EAAEM,OACTC,YAAYP,EAAEO,YACdY,IAAInB,EAAEmB,IACNC,SAASpB,EAAEoB,SACXC,QAAQrB,EAAEqB,QACVC,OAAOtB,EAAEsB,OACTC,SAASvB,EAAEuB,SACXf,KAAKR,EAAEQ,KACPgB,SAASxB,EAAEwB,SACXC,QAAQzB,EAAEyB,QACVhB,MAAMT,EAAES,SACLR,GAGL,OADc,IAAIyB,cAAc3B,EAAWG,EAE7C"}
1
+ {"version":3,"file":"index.umd.js","sources":["../lib/events.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 * 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}"],"names":["eventName","e","initObj","initialObject","bubbles","cancelable","composed","detail","view","which","relatedTarget","FocusEvent","isComposing","data","dataTransfer","inputType","targetRanges","getTargetRanges","InputEvent","altKey","code","ctrlKey","key","location","metaKey","repeat","shiftKey","charCode","keyCode","KeyboardEvent"],"mappings":"0QA0DiCA,EAAiBC,EAAaC,GAC7D,MAAMC,EAAgC,CACpCC,QAAQH,EAAEG,QACVC,WAAWJ,EAAEI,WACbC,SAASL,EAAEK,SACXC,OAAON,EAAEM,OACTC,KAAKP,EAAEO,KACPC,MAAMR,EAAEQ,MACRC,cAAcT,EAAES,iBACbR,GAGL,OADc,IAAIS,WAAWX,EAAWG,EAE1C,8BAnCiCH,EAAiBC,EAAaC,GAC7D,MAAMC,EAAgC,CACpCC,QAAQH,EAAEG,QACVC,WAAWJ,EAAEI,WACbC,SAASL,EAAEK,SACXC,OAAON,EAAEM,OACTK,YAAYX,EAAEW,YACdJ,KAAKP,EAAEO,KACPC,MAAMR,EAAEQ,MACRI,KAAKZ,EAAEY,KACPC,aAAab,EAAEa,aACfC,UAAUd,EAAEc,UACZC,aAA4C,mBAAvBf,EAAEgB,kBAAgChB,EAAEgB,kBAAkB,MACxEf,GAGL,OADc,IAAIgB,WAAWlB,EAAWG,EAE1C,iCA5CoCH,EAAiBC,EAAgBC,GACnE,MAAMC,EAAmC,CACvCgB,OAAOlB,EAAEkB,OACTf,QAAQH,EAAEG,QACVC,WAAWJ,EAAEI,WACbe,KAAKnB,EAAEmB,KACPd,SAASL,EAAEK,SACXe,QAAQpB,EAAEoB,QACVd,OAAON,EAAEM,OACTK,YAAYX,EAAEW,YACdU,IAAIrB,EAAEqB,IACNC,SAAStB,EAAEsB,SACXC,QAAQvB,EAAEuB,QACVC,OAAOxB,EAAEwB,OACTC,SAASzB,EAAEyB,SACXlB,KAAKP,EAAEO,KACPmB,SAAS1B,EAAE0B,SACXC,QAAQ3B,EAAE2B,QACVnB,MAAMR,EAAEQ,SACLP,GAGL,OADc,IAAI2B,cAAc7B,EAAWG,EAE7C"}
@@ -5,10 +5,14 @@ export type EventTypeWithTarget<TEvent, TTarget> = TEvent & {
5
5
  target: TTarget;
6
6
  };
7
7
  /**
8
- * create a keyboardEvent based on e value and replace them with initObj
8
+ * create a keyboardEvent based on `e` value and replace them with initObj
9
9
  */
10
10
  export declare function createKeyboardEvent(eventName: string, e: KeyboardEvent, initObj: KeyboardEventInit): KeyboardEvent;
11
11
  /**
12
- * create a keyboardEvent based on e value and replace them with initObj
12
+ * create a InputEvent based on `e` value and replace them with initObj
13
13
  */
14
14
  export declare function createInputEvent(eventName: string, e: InputEvent, initObj: InputEventInit): InputEvent;
15
+ /**
16
+ * create a InputEvent based on `e` value and replace them with initObj
17
+ */
18
+ export declare function createFocusEvent(eventName: string, e: FocusEvent, initObj: FocusEventInit): FocusEvent;
package/lib/events.ts CHANGED
@@ -5,7 +5,7 @@ export type EventTypeWithTarget<TEvent,TTarget> = TEvent & {
5
5
  target: TTarget;
6
6
  };
7
7
  /**
8
- * create a keyboardEvent based on e value and replace them with initObj
8
+ * create a keyboardEvent based on `e` value and replace them with initObj
9
9
  */
10
10
  export function createKeyboardEvent(eventName:string,e:KeyboardEvent,initObj:KeyboardEventInit){
11
11
  const initialObject: KeyboardEventInit = {
@@ -32,7 +32,7 @@ export function createKeyboardEvent(eventName:string,e:KeyboardEvent,initObj:Key
32
32
  return event;
33
33
  }
34
34
  /**
35
- * create a keyboardEvent based on e value and replace them with initObj
35
+ * create a InputEvent based on `e` value and replace them with initObj
36
36
  */
37
37
  export function createInputEvent(eventName:string,e:InputEvent,initObj:InputEventInit){
38
38
  const initialObject: InputEventInit = {
@@ -51,4 +51,22 @@ export function createInputEvent(eventName:string,e:InputEvent,initObj:InputEven
51
51
  };
52
52
  const event = new InputEvent(eventName, initialObject);
53
53
  return event;
54
+ }
55
+
56
+ /**
57
+ * create a InputEvent based on `e` value and replace them with initObj
58
+ */
59
+ export function createFocusEvent(eventName:string,e:FocusEvent,initObj:FocusEventInit){
60
+ const initialObject: FocusEventInit = {
61
+ bubbles:e.bubbles,
62
+ cancelable:e.cancelable,
63
+ composed:e.composed,
64
+ detail:e.detail,
65
+ view:e.view,
66
+ which:e.which,
67
+ relatedTarget:e.relatedTarget,
68
+ ...initObj
69
+ };
70
+ const event = new FocusEvent(eventName, initialObject);
71
+ return event;
54
72
  }
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "react component",
14
14
  "event"
15
15
  ],
16
- "version": "0.0.3",
16
+ "version": "0.0.4",
17
17
  "bugs": "https://github.com/javadbat/jb-core/issues",
18
18
  "license": "MIT",
19
19
  "files": [