dphelper 4.5.0 → 4.5.2

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 (161) hide show
  1. package/README.md +9 -0
  2. package/index.cjs +1 -1
  3. package/index.js +1 -1
  4. package/modules/ai.cjs +1 -1
  5. package/modules/ai.d.ts +1 -0
  6. package/modules/ai.js +1 -1
  7. package/modules/anchor.cjs +1 -1
  8. package/modules/anchor.d.ts +1 -0
  9. package/modules/anchor.js +1 -1
  10. package/modules/array.cjs +1 -1
  11. package/modules/array.d.ts +1 -0
  12. package/modules/array.js +1 -1
  13. package/modules/audio.cjs +1 -1
  14. package/modules/audio.d.ts +1 -0
  15. package/modules/audio.js +1 -1
  16. package/modules/avoid.cjs +1 -1
  17. package/modules/avoid.d.ts +1 -0
  18. package/modules/avoid.js +1 -1
  19. package/modules/biometric.cjs +1 -1
  20. package/modules/biometric.d.ts +1 -0
  21. package/modules/biometric.js +1 -1
  22. package/modules/browser.cjs +1 -1
  23. package/modules/browser.d.ts +1 -0
  24. package/modules/browser.js +1 -1
  25. package/modules/check.cjs +1 -1
  26. package/modules/check.d.ts +1 -0
  27. package/modules/check.js +1 -1
  28. package/modules/color.cjs +1 -1
  29. package/modules/color.d.ts +1 -0
  30. package/modules/color.js +1 -1
  31. package/modules/compress.cjs +1 -1
  32. package/modules/compress.d.ts +1 -0
  33. package/modules/compress.js +1 -1
  34. package/modules/cookie.cjs +1 -1
  35. package/modules/cookie.d.ts +1 -0
  36. package/modules/cookie.js +1 -1
  37. package/modules/coords.cjs +1 -1
  38. package/modules/coords.d.ts +1 -0
  39. package/modules/coords.js +1 -1
  40. package/modules/credits.cjs +1 -1
  41. package/modules/credits.d.ts +1 -0
  42. package/modules/credits.js +1 -1
  43. package/modules/date.cjs +1 -1
  44. package/modules/date.d.ts +1 -0
  45. package/modules/date.js +1 -1
  46. package/modules/disable.cjs +1 -1
  47. package/modules/disable.d.ts +1 -0
  48. package/modules/disable.js +1 -1
  49. package/modules/dispatch.cjs +1 -1
  50. package/modules/dispatch.d.ts +1 -0
  51. package/modules/dispatch.js +1 -1
  52. package/modules/elements.cjs +1 -1
  53. package/modules/elements.d.ts +1 -0
  54. package/modules/elements.js +1 -1
  55. package/modules/events.cjs +1 -1
  56. package/modules/events.d.ts +1 -0
  57. package/modules/events.js +1 -1
  58. package/modules/fetch.cjs +1 -1
  59. package/modules/fetch.d.ts +1 -0
  60. package/modules/fetch.js +1 -1
  61. package/modules/form.cjs +1 -1
  62. package/modules/form.d.ts +1 -0
  63. package/modules/form.js +1 -1
  64. package/modules/format.cjs +1 -1
  65. package/modules/format.d.ts +1 -0
  66. package/modules/format.js +1 -1
  67. package/modules/i18n.cjs +1 -1
  68. package/modules/i18n.d.ts +1 -0
  69. package/modules/i18n.js +1 -1
  70. package/modules/image.cjs +1 -1
  71. package/modules/image.d.ts +1 -0
  72. package/modules/image.js +1 -1
  73. package/modules/json.cjs +1 -1
  74. package/modules/json.d.ts +1 -0
  75. package/modules/json.js +1 -1
  76. package/modules/load.cjs +1 -1
  77. package/modules/load.d.ts +1 -0
  78. package/modules/load.js +1 -1
  79. package/modules/logging.cjs +1 -1
  80. package/modules/logging.d.ts +1 -0
  81. package/modules/logging.js +1 -1
  82. package/modules/math.cjs +1 -1
  83. package/modules/math.d.ts +1 -0
  84. package/modules/math.js +1 -1
  85. package/modules/memory.cjs +1 -1
  86. package/modules/memory.d.ts +1 -0
  87. package/modules/memory.js +1 -1
  88. package/modules/navigation.cjs +1 -1
  89. package/modules/navigation.d.ts +1 -0
  90. package/modules/navigation.js +1 -1
  91. package/modules/net.cjs +1 -1
  92. package/modules/net.d.ts +1 -0
  93. package/modules/net.js +1 -1
  94. package/modules/objects.cjs +1 -1
  95. package/modules/objects.d.ts +1 -0
  96. package/modules/objects.js +1 -1
  97. package/modules/path.cjs +1 -1
  98. package/modules/path.d.ts +1 -0
  99. package/modules/path.js +1 -1
  100. package/modules/promise.cjs +1 -1
  101. package/modules/promise.d.ts +1 -0
  102. package/modules/promise.js +1 -1
  103. package/modules/sanitize.cjs +1 -1
  104. package/modules/sanitize.d.ts +1 -0
  105. package/modules/sanitize.js +1 -1
  106. package/modules/screen.cjs +1 -1
  107. package/modules/screen.d.ts +1 -0
  108. package/modules/screen.js +1 -1
  109. package/modules/scrollbar.cjs +1 -1
  110. package/modules/scrollbar.d.ts +1 -0
  111. package/modules/scrollbar.js +1 -1
  112. package/modules/security.cjs +1 -1
  113. package/modules/security.d.ts +1 -0
  114. package/modules/security.js +1 -1
  115. package/modules/shortcut.cjs +1 -1
  116. package/modules/shortcut.d.ts +1 -0
  117. package/modules/shortcut.js +1 -1
  118. package/modules/socket.cjs +1 -1
  119. package/modules/socket.d.ts +1 -0
  120. package/modules/socket.js +1 -1
  121. package/modules/sse.cjs +1 -1
  122. package/modules/sse.d.ts +1 -0
  123. package/modules/sse.js +1 -1
  124. package/modules/svg.cjs +1 -1
  125. package/modules/svg.d.ts +1 -0
  126. package/modules/svg.js +1 -1
  127. package/modules/sync.cjs +1 -1
  128. package/modules/sync.d.ts +1 -0
  129. package/modules/sync.js +1 -1
  130. package/modules/system.cjs +1 -1
  131. package/modules/system.d.ts +1 -0
  132. package/modules/system.js +1 -1
  133. package/modules/text.cjs +1 -1
  134. package/modules/text.d.ts +1 -0
  135. package/modules/text.js +1 -1
  136. package/modules/timer.cjs +1 -1
  137. package/modules/timer.d.ts +1 -0
  138. package/modules/timer.js +1 -1
  139. package/modules/tools.cjs +1 -1
  140. package/modules/tools.d.ts +1 -0
  141. package/modules/tools.js +1 -1
  142. package/modules/translators.cjs +1 -1
  143. package/modules/translators.d.ts +1 -0
  144. package/modules/translators.js +1 -1
  145. package/modules/triggers.cjs +1 -1
  146. package/modules/triggers.d.ts +1 -0
  147. package/modules/triggers.js +1 -1
  148. package/modules/types.cjs +1 -1
  149. package/modules/types.d.ts +1 -0
  150. package/modules/types.js +1 -1
  151. package/modules/ui.cjs +1 -1
  152. package/modules/ui.d.ts +1 -0
  153. package/modules/ui.js +1 -1
  154. package/modules/window.cjs +1 -1
  155. package/modules/window.d.ts +1 -0
  156. package/modules/window.js +1 -1
  157. package/modules/worker.cjs +1 -1
  158. package/modules/worker.d.ts +1 -0
  159. package/modules/worker.js +1 -1
  160. package/package.json +1 -1
  161. package/sbom.json +6 -6
@@ -1,3 +1,4 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
1
2
  export interface DisableTool {
2
3
  select: (el?: string) => void
3
4
  spellCheck: (tmr?: number) => void
@@ -1 +1 @@
1
- var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var d={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:d.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(t,e,n)=>{Object.defineProperty(t,e.name,n||{writable:false,configurable:false,enumerable:false}),n?.lock&&Object.freeze(t[e.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(t,e)=>{Object.defineProperties(o,{[t.name]:{value:e,writable:false,configurable:false,enumerable:false}}),Object.keys(e).map(n=>(Object.defineProperties(o[t.name],{[n]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,t,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(t);}});var m={name:"disable",active:true,subCommand:[{name:"select",version:"0.0.2",example:"dphelper.disable.select([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable text selection on the specified element.",env:"client",subCommand:[]},{name:"spellCheck",version:"0.0.2",example:"dphelper.disable.spellCheck([tmr = 5000])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable spell check on the specified element after a delay.",env:"client",subCommand:[]},{name:"rightClick",version:"0.0.2",example:"dphelper.disable.rightClick([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable right-click context menu on the specified element.",env:"client",subCommand:[]},{name:"copy",version:"0.0.2",example:"dphelper.disable.copy([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable copy functionality on the specified element.",env:"client",subCommand:[]},{name:"paste",version:"0.0.2",example:"dphelper.disable.paste([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable paste functionality on the specified element.",env:"client",subCommand:[]},{name:"cut",version:"0.0.2",example:"dphelper.disable.cut([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable cut functionality on the specified element.",env:"client",subCommand:[]},{name:"drag",version:"0.0.2",example:"dphelper.disable.drag([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable drag functionality on the specified element.",env:"client",subCommand:[]}]},h={select:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;if(!e||typeof e.addEventListener!="function")return;let n=r=>{let s=r.target,p=s.tagName.toLowerCase();if(!["input","button","select","textarea"].includes(p)&&!s.classList.contains("selectable"))return document.querySelectorAll("*").forEach(a=>a.blur()),r.preventDefault(),!1;document.querySelectorAll("img, a, input, button").forEach(a=>{a.addEventListener("dragstart",u=>(u.preventDefault(),!1));});};e.addEventListener("mousedown",n),console.debug("%cSelection Disabled: %ctrue","color:orange","");}catch(e){console.debug("dphelper.disable.select:",e);}},spellCheck:(t=5e3)=>{setInterval(()=>{let n=document.querySelectorAll("input[type=text], textarea, code");for(let r of n)r.getAttribute("spellcheck")||r.setAttribute("spellcheck","false");},t);},rightClick:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;e&&typeof e.addEventListener=="function"&&e.addEventListener("contextmenu",n=>n.preventDefault());}catch(e){console.debug("dphelper.disable.rightClick:",e);}},copy:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;e&&typeof e.addEventListener=="function"&&e.addEventListener("copy",n=>n.preventDefault());}catch(e){console.debug("dphelper.disable.copy:",e);}},paste:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;e&&typeof e.addEventListener=="function"&&e.addEventListener("paste",n=>n.preventDefault());}catch(e){console.debug("dphelper.disable.paste:",e);}},cut:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;e&&typeof e.addEventListener=="function"&&e.addEventListener("cut",n=>n.preventDefault());}catch(e){console.debug("dphelper.disable.cut:",e);}},drag:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;e&&typeof e.addEventListener=="function"&&e.addEventListener("dragstart",n=>n.preventDefault());}catch(e){console.debug("dphelper.disable.drag:",e);}}};dphelper?.setDescription?.(m,h);var x=dphelper.disable;export{x as disable};
1
+ var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var d={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:d.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(t,e,n)=>{Object.defineProperty(t,e.name,n||{writable:false,configurable:false,enumerable:false}),n?.lock&&Object.freeze(t[e.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(t,e)=>{Object.defineProperties(o,{[t.name]:{value:e,writable:false,configurable:false,enumerable:false}}),Object.keys(e).map(n=>(Object.defineProperties(o[t.name],{[n]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,t,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(t);}});var m={name:"disable",active:true,subCommand:[{name:"select",version:"0.0.2",example:"dphelper.disable.select([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable text selection on the specified element.",env:"client",subCommand:[]},{name:"spellCheck",version:"0.0.2",example:"dphelper.disable.spellCheck([tmr = 5000])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable spell check on the specified element after a delay.",env:"client",subCommand:[]},{name:"rightClick",version:"0.0.2",example:"dphelper.disable.rightClick([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable right-click context menu on the specified element.",env:"client",subCommand:[]},{name:"copy",version:"0.0.2",example:"dphelper.disable.copy([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable copy functionality on the specified element.",env:"client",subCommand:[]},{name:"paste",version:"0.0.2",example:"dphelper.disable.paste([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable paste functionality on the specified element.",env:"client",subCommand:[]},{name:"cut",version:"0.0.2",example:"dphelper.disable.cut([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable cut functionality on the specified element.",env:"client",subCommand:[]},{name:"drag",version:"0.0.2",example:"dphelper.disable.drag([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Disable drag functionality on the specified element.",env:"client",subCommand:[]}]},h={select:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;if(!e||typeof e.addEventListener!="function")return;let n=r=>{let s=r.target,p=s.tagName.toLowerCase();if(!["input","button","select","textarea"].includes(p)&&!s.classList.contains("selectable"))return document.querySelectorAll("*").forEach(a=>a.blur()),r.preventDefault(),!1;document.querySelectorAll("img, a, input, button").forEach(a=>{a.addEventListener("dragstart",u=>(u.preventDefault(),!1));});};e.addEventListener("mousedown",n),console.debug("%cSelection Disabled: %ctrue","color:orange","");}catch(e){console.debug("dphelper.disable.select:",e);}},spellCheck:(t=5e3)=>{setInterval(()=>{let n=document.querySelectorAll("input[type=text], textarea, code");for(let r of n)r.getAttribute("spellcheck")||r.setAttribute("spellcheck","false");},t);},rightClick:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;e&&typeof e.addEventListener=="function"&&e.addEventListener("contextmenu",n=>n.preventDefault());}catch(e){console.debug("dphelper.disable.rightClick:",e);}},copy:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;e&&typeof e.addEventListener=="function"&&e.addEventListener("copy",n=>n.preventDefault());}catch(e){console.debug("dphelper.disable.copy:",e);}},paste:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;e&&typeof e.addEventListener=="function"&&e.addEventListener("paste",n=>n.preventDefault());}catch(e){console.debug("dphelper.disable.paste:",e);}},cut:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;e&&typeof e.addEventListener=="function"&&e.addEventListener("cut",n=>n.preventDefault());}catch(e){console.debug("dphelper.disable.cut:",e);}},drag:(t="body")=>{try{if(typeof document>"u")return;let e=typeof t=="string"?document.querySelector(t):t;e&&typeof e.addEventListener=="function"&&e.addEventListener("dragstart",n=>n.preventDefault());}catch(e){console.debug("dphelper.disable.drag:",e);}}};dphelper?.setDescription?.(m,h);var x=dphelper.disable;export{x as disable};
@@ -1 +1 @@
1
- 'use strict';var l={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var o={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...l},configurable:true,writable:true},version:{value:o.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(i[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var s={},u={name:"dispatch",active:true,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.dispatch.set([name, value])",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Dispatches a custom event with the specified name and value.",env:"client",subCommand:[]},{name:"listen",version:"0.0.2",example:"dphelper.dispatch.listen([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Listens for the specified event names and executes the callback when the event is triggered.",env:"client",subCommand:[]},{name:"remove",version:"0.0.2",example:"dphelper.dispatch.remove([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Removes the event listener for the specified event names.",env:"client",subCommand:[]}]},d={set:(e,t={})=>dispatchEvent(new CustomEvent(String(e),t)),listen:(e,t)=>{s[e]&&s[e].length>0&&dphelper.dispatch.remove(e);let r=n=>t?setTimeout(()=>t(n),0):null;window.addEventListener(e,r),s[e]||(s[e]=[]),s[e].push(r);},remove:e=>{let t=s[e];t&&(t.forEach(r=>window.removeEventListener(e,r)),delete s[e]);}};dphelper?.setDescription(u,d);var D=dphelper.dispatch;exports.dispatch=D;
1
+ 'use strict';var l={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var o={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...l},configurable:true,writable:true},version:{value:o.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(i[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var s={},u={name:"dispatch",active:true,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.dispatch.set([name, value])",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Dispatches a custom event with the specified name and value.",env:"client",subCommand:[]},{name:"listen",version:"0.0.2",example:"dphelper.dispatch.listen([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Listens for the specified event names and executes the callback when the event is triggered.",env:"client",subCommand:[]},{name:"remove",version:"0.0.2",example:"dphelper.dispatch.remove([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Removes the event listener for the specified event names.",env:"client",subCommand:[]}]},d={set:(e,t={})=>dispatchEvent(new CustomEvent(String(e),t)),listen:(e,t)=>{s[e]&&s[e].length>0&&dphelper.dispatch.remove(e);let r=n=>t?setTimeout(()=>t(n),0):null;window.addEventListener(e,r),s[e]||(s[e]=[]),s[e].push(r);},remove:e=>{let t=s[e];t&&(t.forEach(r=>window.removeEventListener(e,r)),delete s[e]);}};dphelper?.setDescription(u,d);var D=dphelper.dispatch;exports.dispatch=D;
@@ -1,3 +1,4 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
1
2
  export interface DispatchTool {
2
3
  set: (name: string, value?: any) => void
3
4
  listen: (name: string, cb?: (e: Event) => void, flag?: boolean) => void
@@ -1 +1 @@
1
- var o={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var n={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...o},configurable:true,writable:true},version:{value:n.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(i[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var s={},d={name:"dispatch",active:true,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.dispatch.set([name, value])",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Dispatches a custom event with the specified name and value.",env:"client",subCommand:[]},{name:"listen",version:"0.0.2",example:"dphelper.dispatch.listen([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Listens for the specified event names and executes the callback when the event is triggered.",env:"client",subCommand:[]},{name:"remove",version:"0.0.2",example:"dphelper.dispatch.remove([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Removes the event listener for the specified event names.",env:"client",subCommand:[]}]},h={set:(e,t={})=>dispatchEvent(new CustomEvent(String(e),t)),listen:(e,t)=>{s[e]&&s[e].length>0&&dphelper.dispatch.remove(e);let r=c=>t?setTimeout(()=>t(c),0):null;window.addEventListener(e,r),s[e]||(s[e]=[]),s[e].push(r);},remove:e=>{let t=s[e];t&&(t.forEach(r=>window.removeEventListener(e,r)),delete s[e]);}};dphelper?.setDescription(d,h);var k=dphelper.dispatch;export{k as dispatch};
1
+ var o={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var n={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...o},configurable:true,writable:true},version:{value:n.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(i[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var s={},d={name:"dispatch",active:true,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.dispatch.set([name, value])",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Dispatches a custom event with the specified name and value.",env:"client",subCommand:[]},{name:"listen",version:"0.0.2",example:"dphelper.dispatch.listen([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Listens for the specified event names and executes the callback when the event is triggered.",env:"client",subCommand:[]},{name:"remove",version:"0.0.2",example:"dphelper.dispatch.remove([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:true,description:"Removes the event listener for the specified event names.",env:"client",subCommand:[]}]},h={set:(e,t={})=>dispatchEvent(new CustomEvent(String(e),t)),listen:(e,t)=>{s[e]&&s[e].length>0&&dphelper.dispatch.remove(e);let r=c=>t?setTimeout(()=>t(c),0):null;window.addEventListener(e,r),s[e]||(s[e]=[]),s[e].push(r);},remove:e=>{let t=s[e];t&&(t.forEach(r=>window.removeEventListener(e,r)),delete s[e]);}};dphelper?.setDescription(d,h);var k=dphelper.dispatch;export{k as dispatch};
@@ -1 +1 @@
1
- 'use strict';var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var p={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...s},configurable:true,writable:true},version:{value:p.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var l=dphelper;Object.defineProperty(l,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(l[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var b={name:"element",active:true,subCommand:[{name:"fitScale",version:"0.0.2",example:"dphelper.element.fitScale([el = 'root', scale = 1, fit = false])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Scales an element based on the window size.",env:"client",subCommand:[]}]},h={fitScale:(e,t=1,r=false)=>addEventListener("resize",a=>dphelper.element.scaleBasedOnWindow(e,t,r)),scaleBasedOnWindow:(e,t,r)=>{if(!e)return;let a=typeof e=="string"?document.querySelector(e):e;if(!a)return;let n=a.offsetWidth||1,i=a.offsetHeight||1,c=r?t/Math.max(n/window.innerWidth,i/window.innerHeight):t/Math.min(n/window.innerWidth,i/window.innerHeight);a.style.transform=`scale(${c})`;}};dphelper?.setDescription(b,h);var x=dphelper.element;exports.element=x;
1
+ 'use strict';var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var p={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...s},configurable:true,writable:true},version:{value:p.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var l=dphelper;Object.defineProperty(l,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(l[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var b={name:"element",active:true,subCommand:[{name:"fitScale",version:"0.0.2",example:"dphelper.element.fitScale([el = 'root', scale = 1, fit = false])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Scales an element based on the window size.",env:"client",subCommand:[]}]},h={fitScale:(e,t=1,r=false)=>addEventListener("resize",a=>dphelper.element.scaleBasedOnWindow(e,t,r)),scaleBasedOnWindow:(e,t,r)=>{if(!e)return;let a=typeof e=="string"?document.querySelector(e):e;if(!a)return;let n=a.offsetWidth||1,i=a.offsetHeight||1,c=r?t/Math.max(n/window.innerWidth,i/window.innerHeight):t/Math.min(n/window.innerWidth,i/window.innerHeight);a.style.transform=`scale(${c})`;}};dphelper?.setDescription(b,h);var x=dphelper.element;exports.element=x;
@@ -1,3 +1,4 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
1
2
  export interface ElementsTool {
2
3
  fitScale: (el: any, scale?: number, fit?: boolean) => void
3
4
  scaleBasedOnWindow: (elm: any, scale: number, fit: boolean) => void
@@ -1 +1 @@
1
- var p={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var c={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...p},configurable:true,writable:true},version:{value:c.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var l=dphelper;Object.defineProperty(l,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(l[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var h={name:"element",active:true,subCommand:[{name:"fitScale",version:"0.0.2",example:"dphelper.element.fitScale([el = 'root', scale = 1, fit = false])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Scales an element based on the window size.",env:"client",subCommand:[]}]},d={fitScale:(e,t=1,r=false)=>addEventListener("resize",a=>dphelper.element.scaleBasedOnWindow(e,t,r)),scaleBasedOnWindow:(e,t,r)=>{if(!e)return;let a=typeof e=="string"?document.querySelector(e):e;if(!a)return;let i=a.offsetWidth||1,s=a.offsetHeight||1,u=r?t/Math.max(i/window.innerWidth,s/window.innerHeight):t/Math.min(i/window.innerWidth,s/window.innerHeight);a.style.transform=`scale(${u})`;}};dphelper?.setDescription(h,d);var D=dphelper.element;export{D as element};
1
+ var p={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var c={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...p},configurable:true,writable:true},version:{value:c.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var l=dphelper;Object.defineProperty(l,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(l[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var h={name:"element",active:true,subCommand:[{name:"fitScale",version:"0.0.2",example:"dphelper.element.fitScale([el = 'root', scale = 1, fit = false])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Scales an element based on the window size.",env:"client",subCommand:[]}]},d={fitScale:(e,t=1,r=false)=>addEventListener("resize",a=>dphelper.element.scaleBasedOnWindow(e,t,r)),scaleBasedOnWindow:(e,t,r)=>{if(!e)return;let a=typeof e=="string"?document.querySelector(e):e;if(!a)return;let i=a.offsetWidth||1,s=a.offsetHeight||1,u=r?t/Math.max(i/window.innerWidth,s/window.innerHeight):t/Math.min(i/window.innerWidth,s/window.innerHeight);a.style.transform=`scale(${u})`;}};dphelper?.setDescription(h,d);var D=dphelper.element;export{D as element};
@@ -1 +1 @@
1
- 'use strict';var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var c={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...s},configurable:true,writable:true},version:{value:c.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(e,t)=>{Object.defineProperties(o,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(o[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,e,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(e);}});var b={name:"event",active:true,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.event.list([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Show attached events.",env:"client",subCommand:[]},{name:"multi",version:"0.0.2",example:"dphelper.event.multi([element, eventNames, listener])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Attach multiple event listeners to an element.",env:"client",subCommand:[]},{name:"copy",version:"0.0.2",example:"dphelper.event.copy([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Copy text content of an element to the clipboard.",env:"client",subCommand:[]},{name:"onDrag",version:"0.0.2",example:"dphelper.event.onDrag([element])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Handle dragging functionality for elements.",env:"client",subCommand:[]},{name:"keys",version:"0.0.2",example:"dphelper.event.keys(e)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Return key event properties.",env:"client",subCommand:[]}]},h={list:e=>window.getEventListeners(e),multi:(e,t,r)=>{let n=t.split(" ");for(let a of n)e.addEventListener(a,r,false);},copy:e=>{let t=document.querySelector(e);t&&t.addEventListener("click",async r=>{if(navigator.clipboard)try{let n=r.target;n&&(await navigator.clipboard.writeText(n.textContent||""),alert("Copied"));}catch(n){console.error("Can't copy the value",n);}});},onDrag:e=>{let t=`.popup_overflow_${e}`,r=document.querySelector(t);if(!r)return;let n=a=>{let i=document.querySelector(t),p=i?.offsetHeight||0,u=i?.offsetWidth||0,m=Math.max(a.pageY,0)-p/2,d=Math.max(a.pageX,0)-u/2;localStorage.setItem(e,JSON.stringify([m,d]));};r.addEventListener("mousedown",()=>{window.addEventListener("mousemove",n);}),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",n);});},keys:e=>({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})};dphelper?.setDescription(b,h);var L=dphelper.events;exports.events=L;
1
+ 'use strict';var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var c={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...s},configurable:true,writable:true},version:{value:c.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(e,t)=>{Object.defineProperties(o,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(o[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,e,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(e);}});var b={name:"event",active:true,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.event.list([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Show attached events.",env:"client",subCommand:[]},{name:"multi",version:"0.0.2",example:"dphelper.event.multi([element, eventNames, listener])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Attach multiple event listeners to an element.",env:"client",subCommand:[]},{name:"copy",version:"0.0.2",example:"dphelper.event.copy([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Copy text content of an element to the clipboard.",env:"client",subCommand:[]},{name:"onDrag",version:"0.0.2",example:"dphelper.event.onDrag([element])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Handle dragging functionality for elements.",env:"client",subCommand:[]},{name:"keys",version:"0.0.2",example:"dphelper.event.keys(e)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Return key event properties.",env:"client",subCommand:[]}]},h={list:e=>window.getEventListeners(e),multi:(e,t,r)=>{let n=t.split(" ");for(let a of n)e.addEventListener(a,r,false);},copy:e=>{let t=document.querySelector(e);t&&t.addEventListener("click",async r=>{if(navigator.clipboard)try{let n=r.target;n&&(await navigator.clipboard.writeText(n.textContent||""),alert("Copied"));}catch(n){console.error("Can't copy the value",n);}});},onDrag:e=>{let t=`.popup_overflow_${e}`,r=document.querySelector(t);if(!r)return;let n=a=>{let i=document.querySelector(t),p=i?.offsetHeight||0,u=i?.offsetWidth||0,m=Math.max(a.pageY,0)-p/2,d=Math.max(a.pageX,0)-u/2;localStorage.setItem(e,JSON.stringify([m,d]));};r.addEventListener("mousedown",()=>{window.addEventListener("mousemove",n);}),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",n);});},keys:e=>({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})};dphelper?.setDescription(b,h);var L=dphelper.events;exports.events=L;
@@ -1,3 +1,4 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
1
2
  export interface EventsTool {
2
3
  list: (el: Element) => any
3
4
  multi: (element: Element, eventNames: string, listener: EventListener) => void
package/modules/events.js CHANGED
@@ -1 +1 @@
1
- var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var p={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:p.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(e,t)=>{Object.defineProperties(o,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(o[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,e,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(e);}});var h={name:"event",active:true,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.event.list([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Show attached events.",env:"client",subCommand:[]},{name:"multi",version:"0.0.2",example:"dphelper.event.multi([element, eventNames, listener])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Attach multiple event listeners to an element.",env:"client",subCommand:[]},{name:"copy",version:"0.0.2",example:"dphelper.event.copy([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Copy text content of an element to the clipboard.",env:"client",subCommand:[]},{name:"onDrag",version:"0.0.2",example:"dphelper.event.onDrag([element])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Handle dragging functionality for elements.",env:"client",subCommand:[]},{name:"keys",version:"0.0.2",example:"dphelper.event.keys(e)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Return key event properties.",env:"client",subCommand:[]}]},g={list:e=>window.getEventListeners(e),multi:(e,t,r)=>{let n=t.split(" ");for(let a of n)e.addEventListener(a,r,false);},copy:e=>{let t=document.querySelector(e);t&&t.addEventListener("click",async r=>{if(navigator.clipboard)try{let n=r.target;n&&(await navigator.clipboard.writeText(n.textContent||""),alert("Copied"));}catch(n){console.error("Can't copy the value",n);}});},onDrag:e=>{let t=`.popup_overflow_${e}`,r=document.querySelector(t);if(!r)return;let n=a=>{let s=document.querySelector(t),u=s?.offsetHeight||0,m=s?.offsetWidth||0,d=Math.max(a.pageY,0)-u/2,f=Math.max(a.pageX,0)-m/2;localStorage.setItem(e,JSON.stringify([d,f]));};r.addEventListener("mousedown",()=>{window.addEventListener("mousemove",n);}),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",n);});},keys:e=>({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})};dphelper?.setDescription(h,g);var M=dphelper.events;export{M as events};
1
+ var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var p={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:p.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var o=dphelper;Object.defineProperty(o,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(e,t)=>{Object.defineProperties(o,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(o[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,e,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(e);}});var h={name:"event",active:true,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.event.list([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Show attached events.",env:"client",subCommand:[]},{name:"multi",version:"0.0.2",example:"dphelper.event.multi([element, eventNames, listener])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Attach multiple event listeners to an element.",env:"client",subCommand:[]},{name:"copy",version:"0.0.2",example:"dphelper.event.copy([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Copy text content of an element to the clipboard.",env:"client",subCommand:[]},{name:"onDrag",version:"0.0.2",example:"dphelper.event.onDrag([element])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Handle dragging functionality for elements.",env:"client",subCommand:[]},{name:"keys",version:"0.0.2",example:"dphelper.event.keys(e)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Return key event properties.",env:"client",subCommand:[]}]},g={list:e=>window.getEventListeners(e),multi:(e,t,r)=>{let n=t.split(" ");for(let a of n)e.addEventListener(a,r,false);},copy:e=>{let t=document.querySelector(e);t&&t.addEventListener("click",async r=>{if(navigator.clipboard)try{let n=r.target;n&&(await navigator.clipboard.writeText(n.textContent||""),alert("Copied"));}catch(n){console.error("Can't copy the value",n);}});},onDrag:e=>{let t=`.popup_overflow_${e}`,r=document.querySelector(t);if(!r)return;let n=a=>{let s=document.querySelector(t),u=s?.offsetHeight||0,m=s?.offsetWidth||0,d=Math.max(a.pageY,0)-u/2,f=Math.max(a.pageX,0)-m/2;localStorage.setItem(e,JSON.stringify([d,f]));};r.addEventListener("mousedown",()=>{window.addEventListener("mousemove",n);}),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",n);});},keys:e=>({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})};dphelper?.setDescription(h,g);var M=dphelper.events;export{M as events};
package/modules/fetch.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var f={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var h={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...f},configurable:true,writable:true},version:{value:h.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(t,e,r)=>{Object.defineProperty(t,e.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[e.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(t,e)=>{Object.defineProperties(a,{[t.name]:{value:e,writable:false,configurable:false,enumerable:false}}),Object.keys(e).map(r=>(Object.defineProperties(a[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,t,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(t);}});var w={name:"fetch",active:true,subCommand:[{name:"get",version:"0.0.2",example:"dphelper.fetch.get('https://api.example.com')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260513",type:"function",active:true,description:"Perform a GET request with automatic retries and exponential backoff. HTTPS required for Zero Trust. Supports timeout and CSRF.",env:"both",subCommand:[]},{name:"post",version:"0.0.2",example:"dphelper.fetch.post('/api', { data: 123 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260513",type:"function",active:true,description:"Perform a POST request with JSON support. HTTPS required for Zero Trust. Supports timeout and CSRF.",env:"both",subCommand:[]}]},g=1e4,T=t=>{try{let e=new URL(t);return e.protocol!=="https:"&&e.protocol!=="http:"?(console.error("[dphelper] Only HTTP/HTTPS protocols allowed"),!1):!0}catch{return true}},i=async(t,e={},r=3,n=1e3,s=g)=>{if(!T(t))throw new Error("Invalid protocol - HTTPS required");let l=new AbortController,u=setTimeout(()=>l.abort(),s);try{let o=await fetch(t,{...e,signal:l.signal});if(clearTimeout(u),!o.ok&&r>0)throw new Error(o.statusText);return o}catch(o){if(clearTimeout(u),o.name==="AbortError")throw new Error(`[dphelper] Request timeout after ${s}ms`,{cause:o});if(r===0)throw o;return console.warn(`[dphelper] Fetch failed, retrying in ${n}ms... (${r} retries left)`),await new Promise(m=>setTimeout(m,n)),i(t,e,r-1,n*2,s)}},c=(t,e)=>i(t,e);c.get=(t,e)=>i(t,{...e,method:"GET"});c.post=(t,e,r={})=>{let n=typeof e=="object"&&e!==null,l=(typeof document<"u"?document.querySelector("meta[name='csrf-token']"):null)?.getAttribute("content")||"";return i(t,{...r,method:"POST",headers:{...n?{"Content-Type":"application/json"}:{},...l?{"X-CSRF-Token":l}:{},...r.headers||{}},body:n?JSON.stringify(e):e})};var y=c;typeof dphelper?.setDescription=="function"&&dphelper.setDescription(w,y);var R=dphelper.fetch;
1
+ 'use strict';var f={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var h={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...f},configurable:true,writable:true},version:{value:h.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(t,e,r)=>{Object.defineProperty(t,e.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[e.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(t,e)=>{Object.defineProperties(a,{[t.name]:{value:e,writable:false,configurable:false,enumerable:false}}),Object.keys(e).map(r=>(Object.defineProperties(a[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,t,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(t);}});var w={name:"fetch",active:true,subCommand:[{name:"get",version:"0.0.2",example:"dphelper.fetch.get('https://api.example.com')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260513",type:"function",active:true,description:"Perform a GET request with automatic retries and exponential backoff. HTTPS required for Zero Trust. Supports timeout and CSRF.",env:"both",subCommand:[]},{name:"post",version:"0.0.2",example:"dphelper.fetch.post('/api', { data: 123 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260513",type:"function",active:true,description:"Perform a POST request with JSON support. HTTPS required for Zero Trust. Supports timeout and CSRF.",env:"both",subCommand:[]}]},g=1e4,T=t=>{try{let e=new URL(t);return e.protocol!=="https:"&&e.protocol!=="http:"?(console.error("[dphelper] Only HTTP/HTTPS protocols allowed"),!1):!0}catch{return true}},i=async(t,e={},r=3,n=1e3,s=g)=>{if(!T(t))throw new Error("Invalid protocol - HTTPS required");let l=new AbortController,u=setTimeout(()=>l.abort(),s);try{let o=await fetch(t,{...e,signal:l.signal});if(clearTimeout(u),!o.ok&&r>0)throw new Error(o.statusText);return o}catch(o){if(clearTimeout(u),o.name==="AbortError")throw new Error(`[dphelper] Request timeout after ${s}ms`,{cause:o});if(r===0)throw o;return console.warn(`[dphelper] Fetch failed, retrying in ${n}ms... (${r} retries left)`),await new Promise(m=>setTimeout(m,n)),i(t,e,r-1,n*2,s)}},c=(t,e)=>i(t,e);c.get=(t,e)=>i(t,{...e,method:"GET"});c.post=(t,e,r={})=>{let n=typeof e=="object"&&e!==null,l=(typeof document<"u"?document.querySelector("meta[name='csrf-token']"):null)?.getAttribute("content")||"";return i(t,{...r,method:"POST",headers:{...n?{"Content-Type":"application/json"}:{},...l?{"X-CSRF-Token":l}:{},...r.headers||{}},body:n?JSON.stringify(e):e})};var y=c;typeof dphelper?.setDescription=="function"&&dphelper.setDescription(w,y);var R=dphelper.fetch;
2
2
  exports.fetch=R;
@@ -1,3 +1,4 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
1
2
  export interface FetchTool {
2
3
  /**
3
4
  * Perform a resilient fetch with automatic retries and exponential backoff.
package/modules/fetch.js CHANGED
@@ -1,2 +1,2 @@
1
- var h={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var m={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...h},configurable:true,writable:true},version:{value:m.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(t,e,r)=>{Object.defineProperty(t,e.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[e.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(t,e)=>{Object.defineProperties(a,{[t.name]:{value:e,writable:false,configurable:false,enumerable:false}}),Object.keys(e).map(r=>(Object.defineProperties(a[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,t,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(t);}});var g={name:"fetch",active:true,subCommand:[{name:"get",version:"0.0.2",example:"dphelper.fetch.get('https://api.example.com')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260513",type:"function",active:true,description:"Perform a GET request with automatic retries and exponential backoff. HTTPS required for Zero Trust. Supports timeout and CSRF.",env:"both",subCommand:[]},{name:"post",version:"0.0.2",example:"dphelper.fetch.post('/api', { data: 123 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260513",type:"function",active:true,description:"Perform a POST request with JSON support. HTTPS required for Zero Trust. Supports timeout and CSRF.",env:"both",subCommand:[]}]},T=1e4,y=t=>{try{let e=new URL(t);return e.protocol!=="https:"&&e.protocol!=="http:"?(console.error("[dphelper] Only HTTP/HTTPS protocols allowed"),!1):!0}catch{return true}},i=async(t,e={},r=3,n=1e3,s=T)=>{if(!y(t))throw new Error("Invalid protocol - HTTPS required");let l=new AbortController,f=setTimeout(()=>l.abort(),s);try{let o=await fetch(t,{...e,signal:l.signal});if(clearTimeout(f),!o.ok&&r>0)throw new Error(o.statusText);return o}catch(o){if(clearTimeout(f),o.name==="AbortError")throw new Error(`[dphelper] Request timeout after ${s}ms`,{cause:o});if(r===0)throw o;return console.warn(`[dphelper] Fetch failed, retrying in ${n}ms... (${r} retries left)`),await new Promise(b=>setTimeout(b,n)),i(t,e,r-1,n*2,s)}},u=(t,e)=>i(t,e);u.get=(t,e)=>i(t,{...e,method:"GET"});u.post=(t,e,r={})=>{let n=typeof e=="object"&&e!==null,l=(typeof document<"u"?document.querySelector("meta[name='csrf-token']"):null)?.getAttribute("content")||"";return i(t,{...r,method:"POST",headers:{...n?{"Content-Type":"application/json"}:{},...l?{"X-CSRF-Token":l}:{},...r.headers||{}},body:n?JSON.stringify(e):e})};var v=u;typeof dphelper?.setDescription=="function"&&dphelper.setDescription(g,v);var H=dphelper.fetch;
1
+ var h={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var m={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...h},configurable:true,writable:true},version:{value:m.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(t,e,r)=>{Object.defineProperty(t,e.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[e.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(t,e)=>{Object.defineProperties(a,{[t.name]:{value:e,writable:false,configurable:false,enumerable:false}}),Object.keys(e).map(r=>(Object.defineProperties(a[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,t,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(t);}});var g={name:"fetch",active:true,subCommand:[{name:"get",version:"0.0.2",example:"dphelper.fetch.get('https://api.example.com')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260513",type:"function",active:true,description:"Perform a GET request with automatic retries and exponential backoff. HTTPS required for Zero Trust. Supports timeout and CSRF.",env:"both",subCommand:[]},{name:"post",version:"0.0.2",example:"dphelper.fetch.post('/api', { data: 123 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260513",type:"function",active:true,description:"Perform a POST request with JSON support. HTTPS required for Zero Trust. Supports timeout and CSRF.",env:"both",subCommand:[]}]},T=1e4,y=t=>{try{let e=new URL(t);return e.protocol!=="https:"&&e.protocol!=="http:"?(console.error("[dphelper] Only HTTP/HTTPS protocols allowed"),!1):!0}catch{return true}},i=async(t,e={},r=3,n=1e3,s=T)=>{if(!y(t))throw new Error("Invalid protocol - HTTPS required");let l=new AbortController,f=setTimeout(()=>l.abort(),s);try{let o=await fetch(t,{...e,signal:l.signal});if(clearTimeout(f),!o.ok&&r>0)throw new Error(o.statusText);return o}catch(o){if(clearTimeout(f),o.name==="AbortError")throw new Error(`[dphelper] Request timeout after ${s}ms`,{cause:o});if(r===0)throw o;return console.warn(`[dphelper] Fetch failed, retrying in ${n}ms... (${r} retries left)`),await new Promise(b=>setTimeout(b,n)),i(t,e,r-1,n*2,s)}},u=(t,e)=>i(t,e);u.get=(t,e)=>i(t,{...e,method:"GET"});u.post=(t,e,r={})=>{let n=typeof e=="object"&&e!==null,l=(typeof document<"u"?document.querySelector("meta[name='csrf-token']"):null)?.getAttribute("content")||"";return i(t,{...r,method:"POST",headers:{...n?{"Content-Type":"application/json"}:{},...l?{"X-CSRF-Token":l}:{},...r.headers||{}},body:n?JSON.stringify(e):e})};var v=u;typeof dphelper?.setDescription=="function"&&dphelper.setDescription(g,v);var H=dphelper.fetch;
2
2
  export{H as fetch};
package/modules/form.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var d={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var h={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...d},configurable:true,writable:true},version:{value:h.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(t,a,r)=>{Object.defineProperty(t,a.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[a.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(t,a)=>{Object.defineProperties(s,{[t.name]:{value:a,writable:false,configurable:false,enumerable:false}}),Object.keys(a).map(r=>(Object.defineProperties(s[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,t,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(t);}});var v={email:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/},y={name:"form",active:true,subCommand:[{name:"serialize",version:"0.0.2",example:"dphelper.form.serialize([form])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Serialize form data into an object.",env:"client",subCommand:[]},{name:"confirmType",version:"0.0.2",example:"dphelper.form.confirmType([type, value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Confirm the type of a value.",env:"client",subCommand:[]},{name:"required",version:"0.0.2",example:"dphelper.form.required([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is required.",env:"client",subCommand:[]},{name:"minLength",version:"0.0.2",example:"dphelper.form.minLength([value, num = 1])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value meets the minimum length.",env:"client",subCommand:[]},{name:"maxLength",version:"0.0.2",example:"dphelper.form.maxLength([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value exceeds the maximum length.",env:"client",subCommand:[]},{name:"maxPhoneNumber",version:"0.0.2",example:"dphelper.form.maxPhoneNumber([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a phone number exceeds the maximum length.",env:"client",subCommand:[]},{name:"isNumeric",version:"0.0.2",example:"dphelper.form.isNumeric([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is numeric.",env:"client",subCommand:[]},{name:"isEmail",version:"0.0.2",example:"dphelper.form.isEmail([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Validate an email format.",env:"client",subCommand:[]},{name:"pattern",version:"0.0.2",example:"dphelper.form.pattern(event)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pattern validation using onChange on inputs when you provide a pattern.",env:"client",subCommand:[]},{name:"noSpecialChars",version:"0.0.2",example:"dphelper.form.noSpecialChars(event)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Avoid special characters in an input.",env:"client",subCommand:[]},{name:"table",version:"0.0.2",example:"dphelper.form.table(size = [7, 24], id, elem)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Generate a table (default 7x24).",env:"client",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.form.sanitize(input)",author:"Dario Passariello",creationDate:"20240318",lastMod:"20240318",type:"function",active:true,description:"Sanitize input value to avoid injection.",env:"client",subCommand:[]}]},x={serialize:t=>{let a=typeof t=="string"?document.querySelector(t):t;if(!a)return {};let r={};if(!{validate:/^[a-zA-Z][a-zA-Z0-9-_.]{0,199}$/}.validate.test(a.name))return;let m=e=>(e===""&&(e=null),e==="null"&&(e=null),e==="undefined"&&(e=void 0),e==="false"&&(e=false),e==="true"&&(e=true),e==="off"&&(e=false),e==="on"&&(e=true),e==="[]"&&(e=Array),e==="{}"&&(e=Object),["null","undefined","false","true","on","off"].filter(o=>o.includes(e)).length===0&&!Number.isNaN(e)&&(e=Number(e)),e),c=(e,n)=>{let i=[...e],o=i[0];o.slice(-1)==="]"&&(o=o.slice(0,-1));let p={};return i.length===1?p[o]=m(n):(i.shift(),p[o]=c(i,n)),p},l;a instanceof HTMLFormElement?l=Array.from(new FormData(a)).map(([e,n])=>({name:String(e),value:typeof n=="object"&&n!==null?n:JSON.stringify(n)})):typeof a.serializeArray=="function"?l=a.serializeArray():(l=[],a.querySelectorAll("input, select, textarea").forEach(n=>{n.name&&l.push({name:n.name,value:n.value||""});}));for(let e of l){let n=e.value,i=e.name.split("["),o=c(i,n);Object.assign(r,o);}return r},confirmType:(t,a)=>t==="number"?/^\d+$/.test(a.toString()):t==="email"?/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(a.toString().toLowerCase()):true,required:t=>t==null?"Required":void 0,minLength:(t,a=1)=>!t||t.length<a?"Must Enter a Value":void 0,maxLength:(t,a=10)=>t.length>a?"Exceeds Max Length":void 0,maxPhoneNumber:(t,a=10)=>t.toString().length>a?"Exceeds Max Length":void 0,isNumeric:t=>!Number.isNaN(t),isEmail:t=>v.email.test(t.toString().toLowerCase()),pattern:t=>{let a=t.target;if(!(a.type&&a.value))return;let r;switch(a.type){case "text":case "password":r=/^[a-zA-Z0-9.\- !$@]+$/;break;case "email":r=/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/;break;case "number":r=/^[0-9\-+]*$/;break;case "tel":r=/^[0-9\s()\-+]*$/;break;default:return}a.value.match(r)||(a.value=a.value.slice(0,-1),t.preventDefault());},noSpecialChars:t=>{let a=t.target,r=a.value.trim(),u=/[^\w\s]/gi;r.length>2&&(a.value=r.replace(u,""));},table:(t,a,r)=>{let u=t[0]||7,m=t[1]||24,c=n=>String(n).replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i]||i),e=`<form id='${c(a||`table_${Date.now()}`)}'>`;e+="<div class='table'>",e+="<div class='title'>";for(let n=1;n<=u;n++)e+=`<span>${n}</span>`;e+="</div>";for(let n=1;n<=m;n++){e+=`<div class='row'><span>${n}</span>`;for(let i=1;i<=u;i++){let o=c(`${i} to ${n}`);e+=`<input name='data[${i}][${n}]' tabindex='${i.toString().padStart(2,"0")}${n.toString().padStart(2,"0")}' type='number' onclick="this.select()" value='${Math.floor(Math.random()*100)}' title='${o}' />`;}e+="</div>";}e+="</div>",e+="</form>",r&&(r.innerHTML=e);},sanitize:t=>{if(t)return t.replace(/[^\w ]/g,"").replace(/[&/\\#, +()$~%.'":*?<>{}]/g,"")}};dphelper?.setDescription(y,x);var S=dphelper.form;exports.form=S;
1
+ 'use strict';var d={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var h={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...d},configurable:true,writable:true},version:{value:h.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(t,a,r)=>{Object.defineProperty(t,a.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[a.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(t,a)=>{Object.defineProperties(s,{[t.name]:{value:a,writable:false,configurable:false,enumerable:false}}),Object.keys(a).map(r=>(Object.defineProperties(s[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,t,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(t);}});var v={email:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/},y={name:"form",active:true,subCommand:[{name:"serialize",version:"0.0.2",example:"dphelper.form.serialize([form])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Serialize form data into an object.",env:"client",subCommand:[]},{name:"confirmType",version:"0.0.2",example:"dphelper.form.confirmType([type, value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Confirm the type of a value.",env:"client",subCommand:[]},{name:"required",version:"0.0.2",example:"dphelper.form.required([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is required.",env:"client",subCommand:[]},{name:"minLength",version:"0.0.2",example:"dphelper.form.minLength([value, num = 1])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value meets the minimum length.",env:"client",subCommand:[]},{name:"maxLength",version:"0.0.2",example:"dphelper.form.maxLength([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value exceeds the maximum length.",env:"client",subCommand:[]},{name:"maxPhoneNumber",version:"0.0.2",example:"dphelper.form.maxPhoneNumber([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a phone number exceeds the maximum length.",env:"client",subCommand:[]},{name:"isNumeric",version:"0.0.2",example:"dphelper.form.isNumeric([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is numeric.",env:"client",subCommand:[]},{name:"isEmail",version:"0.0.2",example:"dphelper.form.isEmail([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Validate an email format.",env:"client",subCommand:[]},{name:"pattern",version:"0.0.2",example:"dphelper.form.pattern(event)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pattern validation using onChange on inputs when you provide a pattern.",env:"client",subCommand:[]},{name:"noSpecialChars",version:"0.0.2",example:"dphelper.form.noSpecialChars(event)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Avoid special characters in an input.",env:"client",subCommand:[]},{name:"table",version:"0.0.2",example:"dphelper.form.table(size = [7, 24], id, elem)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Generate a table (default 7x24).",env:"client",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.form.sanitize(input)",author:"Dario Passariello",creationDate:"20240318",lastMod:"20240318",type:"function",active:true,description:"Sanitize input value to avoid injection.",env:"client",subCommand:[]}]},x={serialize:t=>{let a=typeof t=="string"?document.querySelector(t):t;if(!a)return {};let r={};if(!{validate:/^[a-zA-Z][a-zA-Z0-9-_.]{0,199}$/}.validate.test(a.name))return;let m=e=>(e===""&&(e=null),e==="null"&&(e=null),e==="undefined"&&(e=void 0),e==="false"&&(e=false),e==="true"&&(e=true),e==="off"&&(e=false),e==="on"&&(e=true),e==="[]"&&(e=Array),e==="{}"&&(e=Object),["null","undefined","false","true","on","off"].filter(o=>o.includes(e)).length===0&&!Number.isNaN(e)&&(e=Number(e)),e),c=(e,n)=>{let i=[...e],o=i[0];o.slice(-1)==="]"&&(o=o.slice(0,-1));let p={};return i.length===1?p[o]=m(n):(i.shift(),p[o]=c(i,n)),p},l;a instanceof HTMLFormElement?l=Array.from(new FormData(a)).map(([e,n])=>({name:String(e),value:typeof n=="object"&&n!==null?n:JSON.stringify(n)})):typeof a.serializeArray=="function"?l=a.serializeArray():(l=[],a.querySelectorAll("input, select, textarea").forEach(n=>{n.name&&l.push({name:n.name,value:n.value||""});}));for(let e of l){let n=e.value,i=e.name.split("["),o=c(i,n);Object.assign(r,o);}return r},confirmType:(t,a)=>t==="number"?/^\d+$/.test(a.toString()):t==="email"?/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(a.toString().toLowerCase()):true,required:t=>t==null?"Required":void 0,minLength:(t,a=1)=>!t||t.length<a?"Must Enter a Value":void 0,maxLength:(t,a=10)=>t.length>a?"Exceeds Max Length":void 0,maxPhoneNumber:(t,a=10)=>t.toString().length>a?"Exceeds Max Length":void 0,isNumeric:t=>!Number.isNaN(t),isEmail:t=>v.email.test(t.toString().toLowerCase()),pattern:t=>{let a=t.target;if(!(a.type&&a.value))return;let r;switch(a.type){case "text":case "password":r=/^[a-zA-Z0-9.\- !$@]+$/;break;case "email":r=/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/;break;case "number":r=/^[0-9\-+]*$/;break;case "tel":r=/^[0-9\s()\-+]*$/;break;default:return}a.value.match(r)||(a.value=a.value.slice(0,-1),t.preventDefault());},noSpecialChars:t=>{let a=t.target,r=a.value.trim(),u=/[^\w\s]/gi;r.length>2&&(a.value=r.replace(u,""));},table:(t,a,r)=>{let u=t[0]||7,m=t[1]||24,c=n=>String(n).replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i]||i),e=`<form id='${c(a||`table_${Date.now()}`)}'>`;e+="<div class='table'>",e+="<div class='title'>";for(let n=1;n<=u;n++)e+=`<span>${n}</span>`;e+="</div>";for(let n=1;n<=m;n++){e+=`<div class='row'><span>${n}</span>`;for(let i=1;i<=u;i++){let o=c(`${i} to ${n}`);e+=`<input name='data[${i}][${n}]' tabindex='${i.toString().padStart(2,"0")}${n.toString().padStart(2,"0")}' type='number' onclick="this.select()" value='${Math.floor(Math.random()*100)}' title='${o}' />`;}e+="</div>";}e+="</div>",e+="</form>",r&&(r.innerHTML=e);},sanitize:t=>{if(t)return t.replace(/[^\w ]/g,"").replace(/[&/\\#, +()$~%.'":*?<>{}]/g,"")}};dphelper?.setDescription(y,x);var S=dphelper.form;exports.form=S;
package/modules/form.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
1
2
  export interface FormTool {
2
3
  serialize: (form: HTMLFormElement) => { [key: string]: any }
3
4
  confirmType: (type: string, value: any) => boolean
package/modules/form.js CHANGED
@@ -1 +1 @@
1
- var h={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var b={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...h},configurable:true,writable:true},version:{value:b.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(t,a,r)=>{Object.defineProperty(t,a.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[a.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(t,a)=>{Object.defineProperties(s,{[t.name]:{value:a,writable:false,configurable:false,enumerable:false}}),Object.keys(a).map(r=>(Object.defineProperties(s[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,t,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(t);}});var y={email:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/},x={name:"form",active:true,subCommand:[{name:"serialize",version:"0.0.2",example:"dphelper.form.serialize([form])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Serialize form data into an object.",env:"client",subCommand:[]},{name:"confirmType",version:"0.0.2",example:"dphelper.form.confirmType([type, value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Confirm the type of a value.",env:"client",subCommand:[]},{name:"required",version:"0.0.2",example:"dphelper.form.required([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is required.",env:"client",subCommand:[]},{name:"minLength",version:"0.0.2",example:"dphelper.form.minLength([value, num = 1])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value meets the minimum length.",env:"client",subCommand:[]},{name:"maxLength",version:"0.0.2",example:"dphelper.form.maxLength([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value exceeds the maximum length.",env:"client",subCommand:[]},{name:"maxPhoneNumber",version:"0.0.2",example:"dphelper.form.maxPhoneNumber([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a phone number exceeds the maximum length.",env:"client",subCommand:[]},{name:"isNumeric",version:"0.0.2",example:"dphelper.form.isNumeric([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is numeric.",env:"client",subCommand:[]},{name:"isEmail",version:"0.0.2",example:"dphelper.form.isEmail([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Validate an email format.",env:"client",subCommand:[]},{name:"pattern",version:"0.0.2",example:"dphelper.form.pattern(event)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pattern validation using onChange on inputs when you provide a pattern.",env:"client",subCommand:[]},{name:"noSpecialChars",version:"0.0.2",example:"dphelper.form.noSpecialChars(event)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Avoid special characters in an input.",env:"client",subCommand:[]},{name:"table",version:"0.0.2",example:"dphelper.form.table(size = [7, 24], id, elem)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Generate a table (default 7x24).",env:"client",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.form.sanitize(input)",author:"Dario Passariello",creationDate:"20240318",lastMod:"20240318",type:"function",active:true,description:"Sanitize input value to avoid injection.",env:"client",subCommand:[]}]},w={serialize:t=>{let a=typeof t=="string"?document.querySelector(t):t;if(!a)return {};let r={};if(!{validate:/^[a-zA-Z][a-zA-Z0-9-_.]{0,199}$/}.validate.test(a.name))return;let m=e=>(e===""&&(e=null),e==="null"&&(e=null),e==="undefined"&&(e=void 0),e==="false"&&(e=false),e==="true"&&(e=true),e==="off"&&(e=false),e==="on"&&(e=true),e==="[]"&&(e=Array),e==="{}"&&(e=Object),["null","undefined","false","true","on","off"].filter(o=>o.includes(e)).length===0&&!Number.isNaN(e)&&(e=Number(e)),e),c=(e,n)=>{let i=[...e],o=i[0];o.slice(-1)==="]"&&(o=o.slice(0,-1));let p={};return i.length===1?p[o]=m(n):(i.shift(),p[o]=c(i,n)),p},l;a instanceof HTMLFormElement?l=Array.from(new FormData(a)).map(([e,n])=>({name:String(e),value:typeof n=="object"&&n!==null?n:JSON.stringify(n)})):typeof a.serializeArray=="function"?l=a.serializeArray():(l=[],a.querySelectorAll("input, select, textarea").forEach(n=>{n.name&&l.push({name:n.name,value:n.value||""});}));for(let e of l){let n=e.value,i=e.name.split("["),o=c(i,n);Object.assign(r,o);}return r},confirmType:(t,a)=>t==="number"?/^\d+$/.test(a.toString()):t==="email"?/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(a.toString().toLowerCase()):true,required:t=>t==null?"Required":void 0,minLength:(t,a=1)=>!t||t.length<a?"Must Enter a Value":void 0,maxLength:(t,a=10)=>t.length>a?"Exceeds Max Length":void 0,maxPhoneNumber:(t,a=10)=>t.toString().length>a?"Exceeds Max Length":void 0,isNumeric:t=>!Number.isNaN(t),isEmail:t=>y.email.test(t.toString().toLowerCase()),pattern:t=>{let a=t.target;if(!(a.type&&a.value))return;let r;switch(a.type){case "text":case "password":r=/^[a-zA-Z0-9.\- !$@]+$/;break;case "email":r=/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/;break;case "number":r=/^[0-9\-+]*$/;break;case "tel":r=/^[0-9\s()\-+]*$/;break;default:return}a.value.match(r)||(a.value=a.value.slice(0,-1),t.preventDefault());},noSpecialChars:t=>{let a=t.target,r=a.value.trim(),u=/[^\w\s]/gi;r.length>2&&(a.value=r.replace(u,""));},table:(t,a,r)=>{let u=t[0]||7,m=t[1]||24,c=n=>String(n).replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i]||i),e=`<form id='${c(a||`table_${Date.now()}`)}'>`;e+="<div class='table'>",e+="<div class='title'>";for(let n=1;n<=u;n++)e+=`<span>${n}</span>`;e+="</div>";for(let n=1;n<=m;n++){e+=`<div class='row'><span>${n}</span>`;for(let i=1;i<=u;i++){let o=c(`${i} to ${n}`);e+=`<input name='data[${i}][${n}]' tabindex='${i.toString().padStart(2,"0")}${n.toString().padStart(2,"0")}' type='number' onclick="this.select()" value='${Math.floor(Math.random()*100)}' title='${o}' />`;}e+="</div>";}e+="</div>",e+="</form>",r&&(r.innerHTML=e);},sanitize:t=>{if(t)return t.replace(/[^\w ]/g,"").replace(/[&/\\#, +()$~%.'":*?<>{}]/g,"")}};dphelper?.setDescription(x,w);var E=dphelper.form;export{E as form};
1
+ var h={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var b={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...h},configurable:true,writable:true},version:{value:b.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(t,a,r)=>{Object.defineProperty(t,a.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(t[a.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(t,a)=>{Object.defineProperties(s,{[t.name]:{value:a,writable:false,configurable:false,enumerable:false}}),Object.keys(a).map(r=>(Object.defineProperties(s[t.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,t,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(t);}});var y={email:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/},x={name:"form",active:true,subCommand:[{name:"serialize",version:"0.0.2",example:"dphelper.form.serialize([form])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Serialize form data into an object.",env:"client",subCommand:[]},{name:"confirmType",version:"0.0.2",example:"dphelper.form.confirmType([type, value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Confirm the type of a value.",env:"client",subCommand:[]},{name:"required",version:"0.0.2",example:"dphelper.form.required([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is required.",env:"client",subCommand:[]},{name:"minLength",version:"0.0.2",example:"dphelper.form.minLength([value, num = 1])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value meets the minimum length.",env:"client",subCommand:[]},{name:"maxLength",version:"0.0.2",example:"dphelper.form.maxLength([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value exceeds the maximum length.",env:"client",subCommand:[]},{name:"maxPhoneNumber",version:"0.0.2",example:"dphelper.form.maxPhoneNumber([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a phone number exceeds the maximum length.",env:"client",subCommand:[]},{name:"isNumeric",version:"0.0.2",example:"dphelper.form.isNumeric([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a value is numeric.",env:"client",subCommand:[]},{name:"isEmail",version:"0.0.2",example:"dphelper.form.isEmail([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Validate an email format.",env:"client",subCommand:[]},{name:"pattern",version:"0.0.2",example:"dphelper.form.pattern(event)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pattern validation using onChange on inputs when you provide a pattern.",env:"client",subCommand:[]},{name:"noSpecialChars",version:"0.0.2",example:"dphelper.form.noSpecialChars(event)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:true,description:"Avoid special characters in an input.",env:"client",subCommand:[]},{name:"table",version:"0.0.2",example:"dphelper.form.table(size = [7, 24], id, elem)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:true,description:"Generate a table (default 7x24).",env:"client",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.form.sanitize(input)",author:"Dario Passariello",creationDate:"20240318",lastMod:"20240318",type:"function",active:true,description:"Sanitize input value to avoid injection.",env:"client",subCommand:[]}]},w={serialize:t=>{let a=typeof t=="string"?document.querySelector(t):t;if(!a)return {};let r={};if(!{validate:/^[a-zA-Z][a-zA-Z0-9-_.]{0,199}$/}.validate.test(a.name))return;let m=e=>(e===""&&(e=null),e==="null"&&(e=null),e==="undefined"&&(e=void 0),e==="false"&&(e=false),e==="true"&&(e=true),e==="off"&&(e=false),e==="on"&&(e=true),e==="[]"&&(e=Array),e==="{}"&&(e=Object),["null","undefined","false","true","on","off"].filter(o=>o.includes(e)).length===0&&!Number.isNaN(e)&&(e=Number(e)),e),c=(e,n)=>{let i=[...e],o=i[0];o.slice(-1)==="]"&&(o=o.slice(0,-1));let p={};return i.length===1?p[o]=m(n):(i.shift(),p[o]=c(i,n)),p},l;a instanceof HTMLFormElement?l=Array.from(new FormData(a)).map(([e,n])=>({name:String(e),value:typeof n=="object"&&n!==null?n:JSON.stringify(n)})):typeof a.serializeArray=="function"?l=a.serializeArray():(l=[],a.querySelectorAll("input, select, textarea").forEach(n=>{n.name&&l.push({name:n.name,value:n.value||""});}));for(let e of l){let n=e.value,i=e.name.split("["),o=c(i,n);Object.assign(r,o);}return r},confirmType:(t,a)=>t==="number"?/^\d+$/.test(a.toString()):t==="email"?/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(a.toString().toLowerCase()):true,required:t=>t==null?"Required":void 0,minLength:(t,a=1)=>!t||t.length<a?"Must Enter a Value":void 0,maxLength:(t,a=10)=>t.length>a?"Exceeds Max Length":void 0,maxPhoneNumber:(t,a=10)=>t.toString().length>a?"Exceeds Max Length":void 0,isNumeric:t=>!Number.isNaN(t),isEmail:t=>y.email.test(t.toString().toLowerCase()),pattern:t=>{let a=t.target;if(!(a.type&&a.value))return;let r;switch(a.type){case "text":case "password":r=/^[a-zA-Z0-9.\- !$@]+$/;break;case "email":r=/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/;break;case "number":r=/^[0-9\-+]*$/;break;case "tel":r=/^[0-9\s()\-+]*$/;break;default:return}a.value.match(r)||(a.value=a.value.slice(0,-1),t.preventDefault());},noSpecialChars:t=>{let a=t.target,r=a.value.trim(),u=/[^\w\s]/gi;r.length>2&&(a.value=r.replace(u,""));},table:(t,a,r)=>{let u=t[0]||7,m=t[1]||24,c=n=>String(n).replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i]||i),e=`<form id='${c(a||`table_${Date.now()}`)}'>`;e+="<div class='table'>",e+="<div class='title'>";for(let n=1;n<=u;n++)e+=`<span>${n}</span>`;e+="</div>";for(let n=1;n<=m;n++){e+=`<div class='row'><span>${n}</span>`;for(let i=1;i<=u;i++){let o=c(`${i} to ${n}`);e+=`<input name='data[${i}][${n}]' tabindex='${i.toString().padStart(2,"0")}${n.toString().padStart(2,"0")}' type='number' onclick="this.select()" value='${Math.floor(Math.random()*100)}' title='${o}' />`;}e+="</div>";}e+="</div>",e+="</form>",r&&(r.innerHTML=e);},sanitize:t=>{if(t)return t.replace(/[^\w ]/g,"").replace(/[&/\\#, +()$~%.'":*?<>{}]/g,"")}};dphelper?.setDescription(x,w);var E=dphelper.form;export{E as form};
@@ -1 +1 @@
1
- 'use strict';var n={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var s={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...n},configurable:true,writable:true},version:{value:s.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(e,t)=>{Object.defineProperties(a,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(a[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var p={name:"format",active:true,subCommand:[{name:"currency",version:"0.0.2",example:"dphelper.format.currency(value, locale, currency)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a number as currency.",env:"both",subCommand:[]},{name:"phoneNumber",version:"0.0.2",example:"dphelper.format.phoneNumber(value, countryCode)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a string as a phone number.",env:"both",subCommand:[]}]},u={currency:(e,t="en-US",r="USD")=>new Intl.NumberFormat(t,{style:"currency",currency:r}).format(e),phoneNumber:(e,t="US")=>{let r=`${e}`.replace(/\D/g,""),o;return t==="US"&&(o=r.match(/^(\d{3})(\d{3})(\d{4})$/),o)?`(${o[1]}) ${o[2]}-${o[3]}`:e}};typeof dphelper?.setDescription=="function"&&dphelper.setDescription(p,u);var D=dphelper.format;exports.format=D;
1
+ 'use strict';var n={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var s={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...n},configurable:true,writable:true},version:{value:s.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(e,t)=>{Object.defineProperties(a,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(a[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var p={name:"format",active:true,subCommand:[{name:"currency",version:"0.0.2",example:"dphelper.format.currency(value, locale, currency)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a number as currency.",env:"both",subCommand:[]},{name:"phoneNumber",version:"0.0.2",example:"dphelper.format.phoneNumber(value, countryCode)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a string as a phone number.",env:"both",subCommand:[]}]},u={currency:(e,t="en-US",r="USD")=>new Intl.NumberFormat(t,{style:"currency",currency:r}).format(e),phoneNumber:(e,t="US")=>{let r=`${e}`.replace(/\D/g,""),o;return t==="US"&&(o=r.match(/^(\d{3})(\d{3})(\d{4})$/),o)?`(${o[1]}) ${o[2]}-${o[3]}`:e}};typeof dphelper?.setDescription=="function"&&dphelper.setDescription(p,u);var D=dphelper.format;exports.format=D;
@@ -1,3 +1,4 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
1
2
  export interface FormatTool {
2
3
  currency: (value: number, locale?: string, currency?: string) => string
3
4
  phoneNumber: (value: string, countryCode?: string) => string
package/modules/format.js CHANGED
@@ -1 +1 @@
1
- var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var i={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...s},configurable:true,writable:true},version:{value:i.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(e,t)=>{Object.defineProperties(a,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(a[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var u={name:"format",active:true,subCommand:[{name:"currency",version:"0.0.2",example:"dphelper.format.currency(value, locale, currency)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a number as currency.",env:"both",subCommand:[]},{name:"phoneNumber",version:"0.0.2",example:"dphelper.format.phoneNumber(value, countryCode)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a string as a phone number.",env:"both",subCommand:[]}]},b={currency:(e,t="en-US",r="USD")=>new Intl.NumberFormat(t,{style:"currency",currency:r}).format(e),phoneNumber:(e,t="US")=>{let r=`${e}`.replace(/\D/g,""),o;return t==="US"&&(o=r.match(/^(\d{3})(\d{3})(\d{4})$/),o)?`(${o[1]}) ${o[2]}-${o[3]}`:e}};typeof dphelper?.setDescription=="function"&&dphelper.setDescription(u,b);var O=dphelper.format;export{O as format};
1
+ var s={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var i={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...s},configurable:true,writable:true},version:{value:i.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var a=dphelper;Object.defineProperty(a,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(e,t)=>{Object.defineProperties(a,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(a[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,e,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(e);}});var u={name:"format",active:true,subCommand:[{name:"currency",version:"0.0.2",example:"dphelper.format.currency(value, locale, currency)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a number as currency.",env:"both",subCommand:[]},{name:"phoneNumber",version:"0.0.2",example:"dphelper.format.phoneNumber(value, countryCode)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Format a string as a phone number.",env:"both",subCommand:[]}]},b={currency:(e,t="en-US",r="USD")=>new Intl.NumberFormat(t,{style:"currency",currency:r}).format(e),phoneNumber:(e,t="US")=>{let r=`${e}`.replace(/\D/g,""),o;return t==="US"&&(o=r.match(/^(\d{3})(\d{3})(\d{4})$/),o)?`(${o[1]}) ${o[2]}-${o[3]}`:e}};typeof dphelper?.setDescription=="function"&&dphelper.setDescription(u,b);var O=dphelper.format;export{O as format};
package/modules/i18n.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var g={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var v={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...g},configurable:true,writable:true},version:{value:v.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(i[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var M={name:"i18n",active:true,subCommand:[{name:"setLocale",version:"0.0.1",example:"dphelper.i18n.setLocale('it')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Set the current locale",env:"both",subCommand:[]},{name:"t",version:"0.0.1",example:"dphelper.i18n.t('hello', { name: 'World' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Translate a key with optional interpolation",env:"both",subCommand:[]},{name:"addTranslations",version:"0.0.1",example:"dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Add translation strings for a locale",env:"both",subCommand:[]},{name:"getLocale",version:"0.0.1",example:"dphelper.i18n.getLocale()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get the current locale",env:"both",subCommand:[]},{name:"pluralize",version:"0.0.1",example:"dphelper.i18n.pluralize(5, { one: 'item', other: 'items' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get pluralized string based on count",env:"both",subCommand:[]},{name:"number",version:"0.0.1",example:"dphelper.i18n.number(1234.56, 'de-DE', { style: 'currency', currency: 'EUR' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a number according to locale",env:"both",subCommand:[]},{name:"date",version:"0.0.1",example:"dphelper.i18n.date(new Date(), 'en-US', { dateStyle: 'long' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a date according to locale",env:"both",subCommand:[]},{name:"relativeTime",version:"0.0.1",example:"dphelper.i18n.relativeTime(Date.now() - 3600000)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get relative time string (e.g., '2 hours ago')",env:"both",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.i18n.list(['a', 'b', 'c'], 'en')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a list according to locale",env:"both",subCommand:[]},{name:"getSupportedLocales",version:"0.0.1",example:"dphelper.i18n.getSupportedLocales()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get list of supported locales",env:"both",subCommand:[]}]},s=new Map,a="en";s.set("en",{hello:"Hello {name}!",goodbye:"Goodbye!",welcome:"Welcome to our app!",loading:"Loading...",error:"An error occurred",success:"Success!",confirm:"Are you sure?",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",close:"Close"});var P=e=>{a=e,e==="auto"&&typeof navigator<"u"&&(a=navigator.language.split("-")[0]||"en");},x=()=>a,j=(e,t)=>{let r=s.get(e)||{};s.set(e,{...r,...t});},C=(e,t={})=>{let o=(s.get(a)||s.get("en")||{})[e]||e;return Object.entries(t).forEach(([l,u])=>{o=o.replace(new RegExp(`\\{${l}\\}`,"g"),String(u));}),o},L=(e,t,r)=>{let o=r||a;if(e===0&&t.zero)return t.zero;if(e===1)return t.one||t.other||"";if(e===2&&t.two)return t.two;if(o==="pl"&&e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||"";if(o==="ru"||o==="uk"){if(e%10===1&&e%100!==11)return t.one||t.other||"";if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||""}return t.other||String(e)},O=(e,t,r)=>{let o=t||a;return new Intl.NumberFormat(o,r).format(e)},S=(e,t,r)=>{let o=t||a,l=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(o,r).format(l)},T=(e,t)=>{let r=t||a,o=Date.now(),l=typeof e=="number"?e:e.getTime(),u=o-l,n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}),p=Math.floor(u/1e3),m=Math.floor(p/60),d=Math.floor(m/60),c=Math.floor(d/24),h=Math.floor(c/7),b=Math.floor(c/30),w=Math.floor(c/365);return Math.abs(p)<60?n.format(-p,"second"):Math.abs(m)<60?n.format(-m,"minute"):Math.abs(d)<24?n.format(-d,"hour"):Math.abs(c)<7?n.format(-c,"day"):Math.abs(h)<4?n.format(-h,"week"):Math.abs(b)<12?n.format(-b,"month"):n.format(-w,"year")},k=(e,t,r)=>{let o=t||a;return new Intl.ListFormat(o,r).format(e)},F=()=>Array.from(s.keys()),z={setLocale:P,getLocale:x,addTranslations:j,t:C,pluralize:L,number:O,date:S,relativeTime:T,list:k,getSupportedLocales:F};dphelper?.setDescription(M,z);var H=dphelper.i18n;exports.i18n=H;
1
+ 'use strict';var g={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var v={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...g},configurable:true,writable:true},version:{value:v.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(i[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var M={name:"i18n",active:true,subCommand:[{name:"setLocale",version:"0.0.1",example:"dphelper.i18n.setLocale('it')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Set the current locale",env:"both",subCommand:[]},{name:"t",version:"0.0.1",example:"dphelper.i18n.t('hello', { name: 'World' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Translate a key with optional interpolation",env:"both",subCommand:[]},{name:"addTranslations",version:"0.0.1",example:"dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Add translation strings for a locale",env:"both",subCommand:[]},{name:"getLocale",version:"0.0.1",example:"dphelper.i18n.getLocale()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get the current locale",env:"both",subCommand:[]},{name:"pluralize",version:"0.0.1",example:"dphelper.i18n.pluralize(5, { one: 'item', other: 'items' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get pluralized string based on count",env:"both",subCommand:[]},{name:"number",version:"0.0.1",example:"dphelper.i18n.number(1234.56, 'de-DE', { style: 'currency', currency: 'EUR' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a number according to locale",env:"both",subCommand:[]},{name:"date",version:"0.0.1",example:"dphelper.i18n.date(new Date(), 'en-US', { dateStyle: 'long' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a date according to locale",env:"both",subCommand:[]},{name:"relativeTime",version:"0.0.1",example:"dphelper.i18n.relativeTime(Date.now() - 3600000)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get relative time string (e.g., '2 hours ago')",env:"both",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.i18n.list(['a', 'b', 'c'], 'en')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a list according to locale",env:"both",subCommand:[]},{name:"getSupportedLocales",version:"0.0.1",example:"dphelper.i18n.getSupportedLocales()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get list of supported locales",env:"both",subCommand:[]}]},s=new Map,a="en";s.set("en",{hello:"Hello {name}!",goodbye:"Goodbye!",welcome:"Welcome to our app!",loading:"Loading...",error:"An error occurred",success:"Success!",confirm:"Are you sure?",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",close:"Close"});var P=e=>{a=e,e==="auto"&&typeof navigator<"u"&&(a=navigator.language.split("-")[0]||"en");},x=()=>a,j=(e,t)=>{let r=s.get(e)||{};s.set(e,{...r,...t});},C=(e,t={})=>{let o=(s.get(a)||s.get("en")||{})[e]||e;return Object.entries(t).forEach(([l,u])=>{o=o.replace(new RegExp(`\\{${l}\\}`,"g"),String(u));}),o},L=(e,t,r)=>{let o=r||a;if(e===0&&t.zero)return t.zero;if(e===1)return t.one||t.other||"";if(e===2&&t.two)return t.two;if(o==="pl"&&e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||"";if(o==="ru"||o==="uk"){if(e%10===1&&e%100!==11)return t.one||t.other||"";if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||""}return t.other||String(e)},O=(e,t,r)=>{let o=t||a;return new Intl.NumberFormat(o,r).format(e)},S=(e,t,r)=>{let o=t||a,l=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(o,r).format(l)},T=(e,t)=>{let r=t||a,o=Date.now(),l=typeof e=="number"?e:e.getTime(),u=o-l,n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}),p=Math.floor(u/1e3),m=Math.floor(p/60),d=Math.floor(m/60),c=Math.floor(d/24),h=Math.floor(c/7),b=Math.floor(c/30),w=Math.floor(c/365);return Math.abs(p)<60?n.format(-p,"second"):Math.abs(m)<60?n.format(-m,"minute"):Math.abs(d)<24?n.format(-d,"hour"):Math.abs(c)<7?n.format(-c,"day"):Math.abs(h)<4?n.format(-h,"week"):Math.abs(b)<12?n.format(-b,"month"):n.format(-w,"year")},k=(e,t,r)=>{let o=t||a;return new Intl.ListFormat(o,r).format(e)},F=()=>Array.from(s.keys()),z={setLocale:P,getLocale:x,addTranslations:j,t:C,pluralize:L,number:O,date:S,relativeTime:T,list:k,getSupportedLocales:F};dphelper?.setDescription(M,z);var H=dphelper.i18n;exports.i18n=H;
package/modules/i18n.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
1
2
  export interface I18nTool {
2
3
  setLocale: (locale: string) => void
3
4
  getLocale: () => string
package/modules/i18n.js CHANGED
@@ -1 +1 @@
1
- var v={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var w={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...v},configurable:true,writable:true},version:{value:w.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(i[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var P={name:"i18n",active:true,subCommand:[{name:"setLocale",version:"0.0.1",example:"dphelper.i18n.setLocale('it')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Set the current locale",env:"both",subCommand:[]},{name:"t",version:"0.0.1",example:"dphelper.i18n.t('hello', { name: 'World' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Translate a key with optional interpolation",env:"both",subCommand:[]},{name:"addTranslations",version:"0.0.1",example:"dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Add translation strings for a locale",env:"both",subCommand:[]},{name:"getLocale",version:"0.0.1",example:"dphelper.i18n.getLocale()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get the current locale",env:"both",subCommand:[]},{name:"pluralize",version:"0.0.1",example:"dphelper.i18n.pluralize(5, { one: 'item', other: 'items' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get pluralized string based on count",env:"both",subCommand:[]},{name:"number",version:"0.0.1",example:"dphelper.i18n.number(1234.56, 'de-DE', { style: 'currency', currency: 'EUR' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a number according to locale",env:"both",subCommand:[]},{name:"date",version:"0.0.1",example:"dphelper.i18n.date(new Date(), 'en-US', { dateStyle: 'long' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a date according to locale",env:"both",subCommand:[]},{name:"relativeTime",version:"0.0.1",example:"dphelper.i18n.relativeTime(Date.now() - 3600000)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get relative time string (e.g., '2 hours ago')",env:"both",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.i18n.list(['a', 'b', 'c'], 'en')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a list according to locale",env:"both",subCommand:[]},{name:"getSupportedLocales",version:"0.0.1",example:"dphelper.i18n.getSupportedLocales()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get list of supported locales",env:"both",subCommand:[]}]},s=new Map,a="en";s.set("en",{hello:"Hello {name}!",goodbye:"Goodbye!",welcome:"Welcome to our app!",loading:"Loading...",error:"An error occurred",success:"Success!",confirm:"Are you sure?",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",close:"Close"});var x=e=>{a=e,e==="auto"&&typeof navigator<"u"&&(a=navigator.language.split("-")[0]||"en");},j=()=>a,C=(e,t)=>{let r=s.get(e)||{};s.set(e,{...r,...t});},L=(e,t={})=>{let o=(s.get(a)||s.get("en")||{})[e]||e;return Object.entries(t).forEach(([l,u])=>{o=o.replace(new RegExp(`\\{${l}\\}`,"g"),String(u));}),o},O=(e,t,r)=>{let o=r||a;if(e===0&&t.zero)return t.zero;if(e===1)return t.one||t.other||"";if(e===2&&t.two)return t.two;if(o==="pl"&&e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||"";if(o==="ru"||o==="uk"){if(e%10===1&&e%100!==11)return t.one||t.other||"";if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||""}return t.other||String(e)},S=(e,t,r)=>{let o=t||a;return new Intl.NumberFormat(o,r).format(e)},T=(e,t,r)=>{let o=t||a,l=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(o,r).format(l)},k=(e,t)=>{let r=t||a,o=Date.now(),l=typeof e=="number"?e:e.getTime(),u=o-l,n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}),p=Math.floor(u/1e3),m=Math.floor(p/60),d=Math.floor(m/60),c=Math.floor(d/24),b=Math.floor(c/7),g=Math.floor(c/30),y=Math.floor(c/365);return Math.abs(p)<60?n.format(-p,"second"):Math.abs(m)<60?n.format(-m,"minute"):Math.abs(d)<24?n.format(-d,"hour"):Math.abs(c)<7?n.format(-c,"day"):Math.abs(b)<4?n.format(-b,"week"):Math.abs(g)<12?n.format(-g,"month"):n.format(-y,"year")},F=(e,t,r)=>{let o=t||a;return new Intl.ListFormat(o,r).format(e)},z=()=>Array.from(s.keys()),I={setLocale:x,getLocale:j,addTranslations:C,t:L,pluralize:O,number:S,date:T,relativeTime:k,list:F,getSupportedLocales:z};dphelper?.setDescription(P,I);var $=dphelper.i18n;export{$ as i18n};
1
+ var v={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var w={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...v},configurable:true,writable:true},version:{value:w.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var i=dphelper;Object.defineProperty(i,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(i[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var P={name:"i18n",active:true,subCommand:[{name:"setLocale",version:"0.0.1",example:"dphelper.i18n.setLocale('it')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Set the current locale",env:"both",subCommand:[]},{name:"t",version:"0.0.1",example:"dphelper.i18n.t('hello', { name: 'World' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Translate a key with optional interpolation",env:"both",subCommand:[]},{name:"addTranslations",version:"0.0.1",example:"dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Add translation strings for a locale",env:"both",subCommand:[]},{name:"getLocale",version:"0.0.1",example:"dphelper.i18n.getLocale()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get the current locale",env:"both",subCommand:[]},{name:"pluralize",version:"0.0.1",example:"dphelper.i18n.pluralize(5, { one: 'item', other: 'items' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get pluralized string based on count",env:"both",subCommand:[]},{name:"number",version:"0.0.1",example:"dphelper.i18n.number(1234.56, 'de-DE', { style: 'currency', currency: 'EUR' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a number according to locale",env:"both",subCommand:[]},{name:"date",version:"0.0.1",example:"dphelper.i18n.date(new Date(), 'en-US', { dateStyle: 'long' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a date according to locale",env:"both",subCommand:[]},{name:"relativeTime",version:"0.0.1",example:"dphelper.i18n.relativeTime(Date.now() - 3600000)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get relative time string (e.g., '2 hours ago')",env:"both",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.i18n.list(['a', 'b', 'c'], 'en')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Format a list according to locale",env:"both",subCommand:[]},{name:"getSupportedLocales",version:"0.0.1",example:"dphelper.i18n.getSupportedLocales()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get list of supported locales",env:"both",subCommand:[]}]},s=new Map,a="en";s.set("en",{hello:"Hello {name}!",goodbye:"Goodbye!",welcome:"Welcome to our app!",loading:"Loading...",error:"An error occurred",success:"Success!",confirm:"Are you sure?",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",close:"Close"});var x=e=>{a=e,e==="auto"&&typeof navigator<"u"&&(a=navigator.language.split("-")[0]||"en");},j=()=>a,C=(e,t)=>{let r=s.get(e)||{};s.set(e,{...r,...t});},L=(e,t={})=>{let o=(s.get(a)||s.get("en")||{})[e]||e;return Object.entries(t).forEach(([l,u])=>{o=o.replace(new RegExp(`\\{${l}\\}`,"g"),String(u));}),o},O=(e,t,r)=>{let o=r||a;if(e===0&&t.zero)return t.zero;if(e===1)return t.one||t.other||"";if(e===2&&t.two)return t.two;if(o==="pl"&&e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||"";if(o==="ru"||o==="uk"){if(e%10===1&&e%100!==11)return t.one||t.other||"";if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||""}return t.other||String(e)},S=(e,t,r)=>{let o=t||a;return new Intl.NumberFormat(o,r).format(e)},T=(e,t,r)=>{let o=t||a,l=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(o,r).format(l)},k=(e,t)=>{let r=t||a,o=Date.now(),l=typeof e=="number"?e:e.getTime(),u=o-l,n=new Intl.RelativeTimeFormat(r,{numeric:"auto"}),p=Math.floor(u/1e3),m=Math.floor(p/60),d=Math.floor(m/60),c=Math.floor(d/24),b=Math.floor(c/7),g=Math.floor(c/30),y=Math.floor(c/365);return Math.abs(p)<60?n.format(-p,"second"):Math.abs(m)<60?n.format(-m,"minute"):Math.abs(d)<24?n.format(-d,"hour"):Math.abs(c)<7?n.format(-c,"day"):Math.abs(b)<4?n.format(-b,"week"):Math.abs(g)<12?n.format(-g,"month"):n.format(-y,"year")},F=(e,t,r)=>{let o=t||a;return new Intl.ListFormat(o,r).format(e)},z=()=>Array.from(s.keys()),I={setLocale:x,getLocale:j,addTranslations:C,t:L,pluralize:O,number:S,date:T,relativeTime:k,list:F,getSupportedLocales:z};dphelper?.setDescription(P,I);var $=dphelper.i18n;export{$ as i18n};
package/modules/image.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var h={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var d={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...h},configurable:true,writable:true},version:{value:d.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,t)=>{Object.defineProperties(s,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(s[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var v={name:"image",active:true,subCommand:[{name:"resize",version:"0.0.1",example:"dphelper.image.resize(img, 100, 100)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Resize an image to specified dimensions",env:"client",subCommand:[]},{name:"crop",version:"0.0.1",example:"dphelper.image.crop(img, { x: 0, y: 0, width: 100, height: 100 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Crop an image to specified region",env:"client",subCommand:[]},{name:"toDataURL",version:"0.0.1",example:"dphelper.image.toDataURL(img, 'image/webp', 0.8)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to data URL with optional format and quality",env:"client",subCommand:[]},{name:"fromDataURL",version:"0.0.1",example:"dphelper.image.fromDataURL(dataUrl)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Create an Image element from a data URL",env:"client",subCommand:[]},{name:"filter",version:"0.0.1",example:"dphelper.image.filter(img, { brightness: 1.2, contrast: 1.1 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply CSS filters to an image",env:"client",subCommand:[]},{name:"rotate",version:"0.0.1",example:"dphelper.image.rotate(img, 90)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Rotate an image by degrees",env:"client",subCommand:[]},{name:"flip",version:"0.0.1",example:"dphelper.image.flip(img, 'horizontal')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Flip an image horizontally or vertically",env:"client",subCommand:[]},{name:"grayscale",version:"0.0.1",example:"dphelper.image.grayscale(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to grayscale",env:"client",subCommand:[]},{name:"blur",version:"0.0.1",example:"dphelper.image.blur(img, 5)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply blur effect to an image",env:"client",subCommand:[]},{name:"getDimensions",version:"0.0.1",example:"dphelper.image.getDimensions(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get image dimensions",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.image.load('image.jpg')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Load an image from URL",env:"client",subCommand:[]},{name:"composite",version:"0.0.1",example:"dphelper.image.composite(img1, img2, 'multiply')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Composite two images together",env:"client",subCommand:[]}]},l=(e,t)=>{let a=document.createElement("canvas");return a.width=e,a.height=t,a},w=e=>({width:e.width,height:e.height}),g=e=>new Promise((t,a)=>{let n=new Image;n.onload=()=>t(n),n.onerror=a,n.src=e;}),y=(e,t,a,n="auto")=>{let r=l(t,a),i=r.getContext("2d");return i.imageSmoothingEnabled=n!=="pixelated",i.imageSmoothingQuality="high",i.drawImage(e,0,0,t,a),r.toDataURL("image/png")},D=(e,t)=>{let a=l(t.width,t.height);return a.getContext("2d").drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),a.toDataURL("image/png")},x=(e,t="image/png",a=.92)=>{let n=l(e.width,e.height),r=n.getContext("2d");return r.drawImage(e,0,0),n.toDataURL(t,a)},M=e=>g(e),p=(e,t)=>{let a=[];t.brightness!==void 0&&a.push(`brightness(${t.brightness})`),t.contrast!==void 0&&a.push(`contrast(${t.contrast})`),t.saturate!==void 0&&a.push(`saturate(${t.saturate})`),t.hueRotate!==void 0&&a.push(`hue-rotate(${t.hueRotate}deg)`),t.invert!==void 0&&a.push(`invert(${t.invert})`),t.sepia!==void 0&&a.push(`sepia(${t.sepia})`),t.blur!==void 0&&a.push(`blur(${t.blur}px)`),t.grayscale!==void 0&&a.push(`grayscale(${t.grayscale})`);let n=l(e.width,e.height),r=n.getContext("2d");return r.filter=a.join(" "),r.drawImage(e,0,0),n.toDataURL("image/png")},L=(e,t)=>{let a=t*Math.PI/180,n=Math.abs(Math.sin(a)),r=Math.abs(Math.cos(a)),i=e.width*r+e.height*n,m=e.width*n+e.height*r,c=l(i,m),o=c.getContext("2d");return o.translate(i/2,m/2),o.rotate(a),o.drawImage(e,-e.width/2,-e.height/2),c.toDataURL("image/png")},C=(e,t)=>{let a=l(e.width,e.height),n=a.getContext("2d");return t==="horizontal"?(n.translate(e.width,0),n.scale(-1,1)):(n.translate(0,e.height),n.scale(1,-1)),n.drawImage(e,0,0),a.toDataURL("image/png")},I=e=>p(e,{grayscale:1}),P=(e,t)=>p(e,{blur:t}),R=(e,t,a="source-over",n=0,r=0)=>{let i=Math.max(e.width,t.width+n),m=Math.max(e.height,t.height+r),c=l(i,m),o=c.getContext("2d");return o.drawImage(e,0,0),o.globalCompositeOperation=a,o.drawImage(t,n,r),c.toDataURL("image/png")},E={resize:y,crop:D,toDataURL:x,fromDataURL:M,filter:p,rotate:L,flip:C,grayscale:I,blur:P,getDimensions:w,load:g,composite:R};dphelper?.setDescription(v,E);var A=dphelper.image;exports.image=A;
1
+ 'use strict';var h={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var d={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...h},configurable:true,writable:true},version:{value:d.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,t)=>{Object.defineProperties(s,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(s[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var v={name:"image",active:true,subCommand:[{name:"resize",version:"0.0.1",example:"dphelper.image.resize(img, 100, 100)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Resize an image to specified dimensions",env:"client",subCommand:[]},{name:"crop",version:"0.0.1",example:"dphelper.image.crop(img, { x: 0, y: 0, width: 100, height: 100 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Crop an image to specified region",env:"client",subCommand:[]},{name:"toDataURL",version:"0.0.1",example:"dphelper.image.toDataURL(img, 'image/webp', 0.8)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to data URL with optional format and quality",env:"client",subCommand:[]},{name:"fromDataURL",version:"0.0.1",example:"dphelper.image.fromDataURL(dataUrl)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Create an Image element from a data URL",env:"client",subCommand:[]},{name:"filter",version:"0.0.1",example:"dphelper.image.filter(img, { brightness: 1.2, contrast: 1.1 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply CSS filters to an image",env:"client",subCommand:[]},{name:"rotate",version:"0.0.1",example:"dphelper.image.rotate(img, 90)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Rotate an image by degrees",env:"client",subCommand:[]},{name:"flip",version:"0.0.1",example:"dphelper.image.flip(img, 'horizontal')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Flip an image horizontally or vertically",env:"client",subCommand:[]},{name:"grayscale",version:"0.0.1",example:"dphelper.image.grayscale(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to grayscale",env:"client",subCommand:[]},{name:"blur",version:"0.0.1",example:"dphelper.image.blur(img, 5)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply blur effect to an image",env:"client",subCommand:[]},{name:"getDimensions",version:"0.0.1",example:"dphelper.image.getDimensions(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get image dimensions",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.image.load('image.jpg')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Load an image from URL",env:"client",subCommand:[]},{name:"composite",version:"0.0.1",example:"dphelper.image.composite(img1, img2, 'multiply')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Composite two images together",env:"client",subCommand:[]}]},l=(e,t)=>{let a=document.createElement("canvas");return a.width=e,a.height=t,a},w=e=>({width:e.width,height:e.height}),g=e=>new Promise((t,a)=>{let n=new Image;n.onload=()=>t(n),n.onerror=a,n.src=e;}),y=(e,t,a,n="auto")=>{let r=l(t,a),i=r.getContext("2d");return i.imageSmoothingEnabled=n!=="pixelated",i.imageSmoothingQuality="high",i.drawImage(e,0,0,t,a),r.toDataURL("image/png")},D=(e,t)=>{let a=l(t.width,t.height);return a.getContext("2d").drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),a.toDataURL("image/png")},x=(e,t="image/png",a=.92)=>{let n=l(e.width,e.height),r=n.getContext("2d");return r.drawImage(e,0,0),n.toDataURL(t,a)},M=e=>g(e),p=(e,t)=>{let a=[];t.brightness!==void 0&&a.push(`brightness(${t.brightness})`),t.contrast!==void 0&&a.push(`contrast(${t.contrast})`),t.saturate!==void 0&&a.push(`saturate(${t.saturate})`),t.hueRotate!==void 0&&a.push(`hue-rotate(${t.hueRotate}deg)`),t.invert!==void 0&&a.push(`invert(${t.invert})`),t.sepia!==void 0&&a.push(`sepia(${t.sepia})`),t.blur!==void 0&&a.push(`blur(${t.blur}px)`),t.grayscale!==void 0&&a.push(`grayscale(${t.grayscale})`);let n=l(e.width,e.height),r=n.getContext("2d");return r.filter=a.join(" "),r.drawImage(e,0,0),n.toDataURL("image/png")},L=(e,t)=>{let a=t*Math.PI/180,n=Math.abs(Math.sin(a)),r=Math.abs(Math.cos(a)),i=e.width*r+e.height*n,m=e.width*n+e.height*r,c=l(i,m),o=c.getContext("2d");return o.translate(i/2,m/2),o.rotate(a),o.drawImage(e,-e.width/2,-e.height/2),c.toDataURL("image/png")},C=(e,t)=>{let a=l(e.width,e.height),n=a.getContext("2d");return t==="horizontal"?(n.translate(e.width,0),n.scale(-1,1)):(n.translate(0,e.height),n.scale(1,-1)),n.drawImage(e,0,0),a.toDataURL("image/png")},I=e=>p(e,{grayscale:1}),P=(e,t)=>p(e,{blur:t}),R=(e,t,a="source-over",n=0,r=0)=>{let i=Math.max(e.width,t.width+n),m=Math.max(e.height,t.height+r),c=l(i,m),o=c.getContext("2d");return o.drawImage(e,0,0),o.globalCompositeOperation=a,o.drawImage(t,n,r),c.toDataURL("image/png")},E={resize:y,crop:D,toDataURL:x,fromDataURL:M,filter:p,rotate:L,flip:C,grayscale:I,blur:P,getDimensions:w,load:g,composite:R};dphelper?.setDescription(v,E);var A=dphelper.image;exports.image=A;
@@ -1,3 +1,4 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
1
2
  export interface ImageTool {
2
3
  resize: (img: HTMLImageElement, width: number, height: number, quality?: "pixelated" | "auto") => string
3
4
  crop: (img: HTMLImageElement, region: { x: number; y: number; width: number; height: number }) => string
package/modules/image.js CHANGED
@@ -1 +1 @@
1
- var d={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var g={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...d},configurable:true,writable:true},version:{value:g.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,t)=>{Object.defineProperties(s,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(s[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var w={name:"image",active:true,subCommand:[{name:"resize",version:"0.0.1",example:"dphelper.image.resize(img, 100, 100)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Resize an image to specified dimensions",env:"client",subCommand:[]},{name:"crop",version:"0.0.1",example:"dphelper.image.crop(img, { x: 0, y: 0, width: 100, height: 100 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Crop an image to specified region",env:"client",subCommand:[]},{name:"toDataURL",version:"0.0.1",example:"dphelper.image.toDataURL(img, 'image/webp', 0.8)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to data URL with optional format and quality",env:"client",subCommand:[]},{name:"fromDataURL",version:"0.0.1",example:"dphelper.image.fromDataURL(dataUrl)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Create an Image element from a data URL",env:"client",subCommand:[]},{name:"filter",version:"0.0.1",example:"dphelper.image.filter(img, { brightness: 1.2, contrast: 1.1 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply CSS filters to an image",env:"client",subCommand:[]},{name:"rotate",version:"0.0.1",example:"dphelper.image.rotate(img, 90)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Rotate an image by degrees",env:"client",subCommand:[]},{name:"flip",version:"0.0.1",example:"dphelper.image.flip(img, 'horizontal')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Flip an image horizontally or vertically",env:"client",subCommand:[]},{name:"grayscale",version:"0.0.1",example:"dphelper.image.grayscale(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to grayscale",env:"client",subCommand:[]},{name:"blur",version:"0.0.1",example:"dphelper.image.blur(img, 5)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply blur effect to an image",env:"client",subCommand:[]},{name:"getDimensions",version:"0.0.1",example:"dphelper.image.getDimensions(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get image dimensions",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.image.load('image.jpg')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Load an image from URL",env:"client",subCommand:[]},{name:"composite",version:"0.0.1",example:"dphelper.image.composite(img1, img2, 'multiply')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Composite two images together",env:"client",subCommand:[]}]},l=(e,t)=>{let a=document.createElement("canvas");return a.width=e,a.height=t,a},y=e=>({width:e.width,height:e.height}),b=e=>new Promise((t,a)=>{let n=new Image;n.onload=()=>t(n),n.onerror=a,n.src=e;}),D=(e,t,a,n="auto")=>{let r=l(t,a),i=r.getContext("2d");return i.imageSmoothingEnabled=n!=="pixelated",i.imageSmoothingQuality="high",i.drawImage(e,0,0,t,a),r.toDataURL("image/png")},x=(e,t)=>{let a=l(t.width,t.height);return a.getContext("2d").drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),a.toDataURL("image/png")},M=(e,t="image/png",a=.92)=>{let n=l(e.width,e.height),r=n.getContext("2d");return r.drawImage(e,0,0),n.toDataURL(t,a)},L=e=>b(e),h=(e,t)=>{let a=[];t.brightness!==void 0&&a.push(`brightness(${t.brightness})`),t.contrast!==void 0&&a.push(`contrast(${t.contrast})`),t.saturate!==void 0&&a.push(`saturate(${t.saturate})`),t.hueRotate!==void 0&&a.push(`hue-rotate(${t.hueRotate}deg)`),t.invert!==void 0&&a.push(`invert(${t.invert})`),t.sepia!==void 0&&a.push(`sepia(${t.sepia})`),t.blur!==void 0&&a.push(`blur(${t.blur}px)`),t.grayscale!==void 0&&a.push(`grayscale(${t.grayscale})`);let n=l(e.width,e.height),r=n.getContext("2d");return r.filter=a.join(" "),r.drawImage(e,0,0),n.toDataURL("image/png")},C=(e,t)=>{let a=t*Math.PI/180,n=Math.abs(Math.sin(a)),r=Math.abs(Math.cos(a)),i=e.width*r+e.height*n,m=e.width*n+e.height*r,c=l(i,m),o=c.getContext("2d");return o.translate(i/2,m/2),o.rotate(a),o.drawImage(e,-e.width/2,-e.height/2),c.toDataURL("image/png")},I=(e,t)=>{let a=l(e.width,e.height),n=a.getContext("2d");return t==="horizontal"?(n.translate(e.width,0),n.scale(-1,1)):(n.translate(0,e.height),n.scale(1,-1)),n.drawImage(e,0,0),a.toDataURL("image/png")},P=e=>h(e,{grayscale:1}),R=(e,t)=>h(e,{blur:t}),E=(e,t,a="source-over",n=0,r=0)=>{let i=Math.max(e.width,t.width+n),m=Math.max(e.height,t.height+r),c=l(i,m),o=c.getContext("2d");return o.drawImage(e,0,0),o.globalCompositeOperation=a,o.drawImage(t,n,r),c.toDataURL("image/png")},H={resize:D,crop:x,toDataURL:M,fromDataURL:L,filter:h,rotate:C,flip:I,grayscale:P,blur:R,getDimensions:y,load:b,composite:E};dphelper?.setDescription(w,H);var q=dphelper.image;export{q as image};
1
+ var d={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var g={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...d},configurable:true,writable:true},version:{value:g.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var s=dphelper;Object.defineProperty(s,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,t)=>{Object.defineProperties(s,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(s[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var w={name:"image",active:true,subCommand:[{name:"resize",version:"0.0.1",example:"dphelper.image.resize(img, 100, 100)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Resize an image to specified dimensions",env:"client",subCommand:[]},{name:"crop",version:"0.0.1",example:"dphelper.image.crop(img, { x: 0, y: 0, width: 100, height: 100 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Crop an image to specified region",env:"client",subCommand:[]},{name:"toDataURL",version:"0.0.1",example:"dphelper.image.toDataURL(img, 'image/webp', 0.8)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to data URL with optional format and quality",env:"client",subCommand:[]},{name:"fromDataURL",version:"0.0.1",example:"dphelper.image.fromDataURL(dataUrl)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Create an Image element from a data URL",env:"client",subCommand:[]},{name:"filter",version:"0.0.1",example:"dphelper.image.filter(img, { brightness: 1.2, contrast: 1.1 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply CSS filters to an image",env:"client",subCommand:[]},{name:"rotate",version:"0.0.1",example:"dphelper.image.rotate(img, 90)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Rotate an image by degrees",env:"client",subCommand:[]},{name:"flip",version:"0.0.1",example:"dphelper.image.flip(img, 'horizontal')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Flip an image horizontally or vertically",env:"client",subCommand:[]},{name:"grayscale",version:"0.0.1",example:"dphelper.image.grayscale(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Convert image to grayscale",env:"client",subCommand:[]},{name:"blur",version:"0.0.1",example:"dphelper.image.blur(img, 5)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Apply blur effect to an image",env:"client",subCommand:[]},{name:"getDimensions",version:"0.0.1",example:"dphelper.image.getDimensions(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Get image dimensions",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.image.load('image.jpg')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Load an image from URL",env:"client",subCommand:[]},{name:"composite",version:"0.0.1",example:"dphelper.image.composite(img1, img2, 'multiply')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Composite two images together",env:"client",subCommand:[]}]},l=(e,t)=>{let a=document.createElement("canvas");return a.width=e,a.height=t,a},y=e=>({width:e.width,height:e.height}),b=e=>new Promise((t,a)=>{let n=new Image;n.onload=()=>t(n),n.onerror=a,n.src=e;}),D=(e,t,a,n="auto")=>{let r=l(t,a),i=r.getContext("2d");return i.imageSmoothingEnabled=n!=="pixelated",i.imageSmoothingQuality="high",i.drawImage(e,0,0,t,a),r.toDataURL("image/png")},x=(e,t)=>{let a=l(t.width,t.height);return a.getContext("2d").drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),a.toDataURL("image/png")},M=(e,t="image/png",a=.92)=>{let n=l(e.width,e.height),r=n.getContext("2d");return r.drawImage(e,0,0),n.toDataURL(t,a)},L=e=>b(e),h=(e,t)=>{let a=[];t.brightness!==void 0&&a.push(`brightness(${t.brightness})`),t.contrast!==void 0&&a.push(`contrast(${t.contrast})`),t.saturate!==void 0&&a.push(`saturate(${t.saturate})`),t.hueRotate!==void 0&&a.push(`hue-rotate(${t.hueRotate}deg)`),t.invert!==void 0&&a.push(`invert(${t.invert})`),t.sepia!==void 0&&a.push(`sepia(${t.sepia})`),t.blur!==void 0&&a.push(`blur(${t.blur}px)`),t.grayscale!==void 0&&a.push(`grayscale(${t.grayscale})`);let n=l(e.width,e.height),r=n.getContext("2d");return r.filter=a.join(" "),r.drawImage(e,0,0),n.toDataURL("image/png")},C=(e,t)=>{let a=t*Math.PI/180,n=Math.abs(Math.sin(a)),r=Math.abs(Math.cos(a)),i=e.width*r+e.height*n,m=e.width*n+e.height*r,c=l(i,m),o=c.getContext("2d");return o.translate(i/2,m/2),o.rotate(a),o.drawImage(e,-e.width/2,-e.height/2),c.toDataURL("image/png")},I=(e,t)=>{let a=l(e.width,e.height),n=a.getContext("2d");return t==="horizontal"?(n.translate(e.width,0),n.scale(-1,1)):(n.translate(0,e.height),n.scale(1,-1)),n.drawImage(e,0,0),a.toDataURL("image/png")},P=e=>h(e,{grayscale:1}),R=(e,t)=>h(e,{blur:t}),E=(e,t,a="source-over",n=0,r=0)=>{let i=Math.max(e.width,t.width+n),m=Math.max(e.height,t.height+r),c=l(i,m),o=c.getContext("2d");return o.drawImage(e,0,0),o.globalCompositeOperation=a,o.drawImage(t,n,r),c.toDataURL("image/png")},H={resize:D,crop:x,toDataURL:M,fromDataURL:L,filter:h,rotate:C,flip:I,grayscale:P,blur:R,getDimensions:y,load:b,composite:E};dphelper?.setDescription(w,H);var q=dphelper.image;export{q as image};
package/modules/json.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var u={version:"4.5.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:u.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var l=dphelper;Object.defineProperty(l,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(l[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var f={name:"json",active:true,subCommand:[{name:"counter",version:"0.0.2",example:"dphelper.json.counter()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Count occurrences of a key-value pair in a JSON object.",env:"both",subCommand:[]},{name:"toCsv",version:"0.0.2",example:"dphelper.json.toCsv()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Convert JSON data to CSV format.",env:"both",subCommand:[]},{name:"saveCsvAs",version:"0.0.2",example:"dphelper.json.saveCsvAs()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Save CSV data as a file.",env:"both",subCommand:[]},{name:"is",version:"0.0.2",example:"dphelper.json.is()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a string is valid JSON.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.json.parse()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Parse a JSON string.",env:"both",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.json.sanitize()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize a JSON string.",env:"both",subCommand:[]},{name:"sanitizeJsonValue",version:"0.0.2",example:"dphelper.json.sanitizeJsonValue()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize individual JSON values.",env:"both",subCommand:[]}]},h={counter:(e,t,a)=>e?t&&a?e.items&&Array.isArray(e.items)?e.items.filter(n=>n[t]===a).length:Object.keys(e).length:0:null,toCsv:e=>{let t=e,a=(o,s)=>s===null?"":s,n=Object.keys(t[0]),i=t.map(o=>n.map(s=>JSON.stringify(o[s],a)).join(","));return i.unshift(n.join(",")),i.join(`\r
1
+ 'use strict';var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var u={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:u.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var l=dphelper;Object.defineProperty(l,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(l,"setDescription",{value:(e,t)=>{Object.defineProperties(l,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(l[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),l.setProps(l,e,{writable:false,configurable:false,enumerable:false}),l._list.scripts.push(e);}});var f={name:"json",active:true,subCommand:[{name:"counter",version:"0.0.2",example:"dphelper.json.counter()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Count occurrences of a key-value pair in a JSON object.",env:"both",subCommand:[]},{name:"toCsv",version:"0.0.2",example:"dphelper.json.toCsv()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Convert JSON data to CSV format.",env:"both",subCommand:[]},{name:"saveCsvAs",version:"0.0.2",example:"dphelper.json.saveCsvAs()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Save CSV data as a file.",env:"both",subCommand:[]},{name:"is",version:"0.0.2",example:"dphelper.json.is()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Check if a string is valid JSON.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.json.parse()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Parse a JSON string.",env:"both",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.json.sanitize()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize a JSON string.",env:"both",subCommand:[]},{name:"sanitizeJsonValue",version:"0.0.2",example:"dphelper.json.sanitizeJsonValue()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:true,description:"Sanitize individual JSON values.",env:"both",subCommand:[]}]},h={counter:(e,t,a)=>e?t&&a?e.items&&Array.isArray(e.items)?e.items.filter(n=>n[t]===a).length:Object.keys(e).length:0:null,toCsv:e=>{let t=e,a=(o,s)=>s===null?"":s,n=Object.keys(t[0]),i=t.map(o=>n.map(s=>JSON.stringify(o[s],a)).join(","));return i.unshift(n.join(",")),i.join(`\r
2
2
  `)},saveCsvAs:(e,t)=>{let a=new Blob([e],{type:"text/csv;charset=utf-8;"}),n=document.createElement("a"),i=dphelper.date.dateTimeToString(new Date(Date.now())),o=`${t}_${i}.csv`,s=URL.createObjectURL(a);n.setAttribute("href",s),n.setAttribute("download",o),n.style.visibility="hidden",document.body.appendChild(n),n.click(),document.body.removeChild(n);},is:e=>{try{JSON.parse(e);}catch(t){return console.warn(t),false}return true},parse:e=>{try{return JSON.parse(e)}catch(t){return console.warn(t),"Json not parsable"}},sanitize:e=>e?"{"+e.trim().replace(/^\{/,"").replace(/\}$/,"").split(/,(?=(?:[^"]*"[^"]*")*[^"]*$)/).map(i=>{let[o,...s]=i.split(":"),d=dphelper.json.sanitizeJsonValue(o?.trim()??"");if(!o)return "";let r=s.join(":");return r?(r=r.trim(),r==="null"?r='""':r==="true"||r==="false"?r=`"${r}"`:/^\d+$/.test(r)?r=`"${r}"`:r=dphelper.json.sanitizeJsonValue(r)):r='""',`${d}:${r}`}).filter(i=>i!=="").join(",")+"}":"{}",sanitizeJsonValue:e=>e?`"${e.replace(/^"(.*)"$/,"$1").replace(/\\/g,"").replace(/\//g,"/").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/"/g,'\\"').replace(/\t/g," ").trim()}"`:'""'};dphelper?.setDescription(f,h);var J=dphelper.json;
3
3
  exports.json=J;
package/modules/json.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
1
2
  export interface JsonTool {
2
3
  counter: (json: any, key?: string, val?: any) => number | null
3
4
  toCsv: (jsonInput: any) => string