dphelper 4.3.5 → 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 (162) hide show
  1. package/README.md +39 -29
  2. package/SECURITY.md +26 -26
  3. package/index.cjs +11 -11
  4. package/index.js +11 -11
  5. package/modules/ai.cjs +7 -0
  6. package/modules/ai.d.ts +15 -0
  7. package/modules/ai.js +7 -0
  8. package/modules/anchor.cjs +4 -0
  9. package/modules/anchor.d.ts +10 -0
  10. package/modules/anchor.js +4 -0
  11. package/modules/array.cjs +1 -0
  12. package/modules/array.d.ts +25 -0
  13. package/modules/array.js +1 -0
  14. package/modules/audio.cjs +1 -0
  15. package/modules/audio.d.ts +14 -0
  16. package/modules/audio.js +1 -0
  17. package/modules/avoid.cjs +1 -0
  18. package/modules/avoid.d.ts +6 -0
  19. package/modules/avoid.js +1 -0
  20. package/modules/biometric.cjs +2 -0
  21. package/modules/biometric.d.ts +18 -0
  22. package/modules/biometric.js +2 -0
  23. package/modules/browser.cjs +37 -0
  24. package/modules/browser.d.ts +14 -0
  25. package/modules/browser.js +37 -0
  26. package/modules/check.cjs +1 -0
  27. package/modules/check.d.ts +8 -0
  28. package/modules/check.js +1 -0
  29. package/modules/color.cjs +1 -0
  30. package/modules/color.d.ts +10 -0
  31. package/modules/color.js +1 -0
  32. package/modules/compress.cjs +1 -0
  33. package/modules/compress.d.ts +17 -0
  34. package/modules/compress.js +1 -0
  35. package/modules/cookie.cjs +1 -0
  36. package/modules/cookie.d.ts +16 -0
  37. package/modules/cookie.js +1 -0
  38. package/modules/coords.cjs +8 -0
  39. package/modules/coords.d.ts +12 -0
  40. package/modules/coords.js +8 -0
  41. package/modules/credits.cjs +1 -0
  42. package/modules/credits.d.ts +15 -0
  43. package/modules/credits.js +1 -0
  44. package/modules/date.cjs +12 -0
  45. package/modules/date.d.ts +29 -0
  46. package/modules/date.js +12 -0
  47. package/modules/disable.cjs +1 -0
  48. package/modules/disable.d.ts +12 -0
  49. package/modules/disable.js +1 -0
  50. package/modules/dispatch.cjs +1 -0
  51. package/modules/dispatch.d.ts +8 -0
  52. package/modules/dispatch.js +1 -0
  53. package/modules/elements.cjs +1 -0
  54. package/modules/elements.d.ts +7 -0
  55. package/modules/elements.js +1 -0
  56. package/modules/events.cjs +1 -0
  57. package/modules/events.d.ts +10 -0
  58. package/modules/events.js +1 -0
  59. package/modules/fetch.cjs +2 -0
  60. package/modules/fetch.d.ts +19 -0
  61. package/modules/fetch.js +2 -0
  62. package/modules/form.cjs +1 -0
  63. package/modules/form.d.ts +17 -0
  64. package/modules/form.js +1 -0
  65. package/modules/format.cjs +1 -0
  66. package/modules/format.d.ts +7 -0
  67. package/modules/format.js +1 -0
  68. package/modules/i18n.cjs +1 -0
  69. package/modules/i18n.d.ts +15 -0
  70. package/modules/i18n.js +1 -0
  71. package/modules/image.cjs +1 -0
  72. package/modules/image.d.ts +17 -0
  73. package/modules/image.js +1 -0
  74. package/modules/json.cjs +3 -0
  75. package/modules/json.d.ts +12 -0
  76. package/modules/json.js +3 -0
  77. package/modules/load.cjs +1 -0
  78. package/modules/load.d.ts +12 -0
  79. package/modules/load.js +1 -0
  80. package/modules/logging.cjs +1 -0
  81. package/modules/logging.d.ts +12 -0
  82. package/modules/logging.js +1 -0
  83. package/modules/math.cjs +1 -0
  84. package/modules/math.d.ts +17 -0
  85. package/modules/math.js +1 -0
  86. package/modules/memory.cjs +1 -0
  87. package/modules/memory.d.ts +7 -0
  88. package/modules/memory.js +1 -0
  89. package/modules/navigation.cjs +2 -0
  90. package/modules/navigation.d.ts +8 -0
  91. package/modules/navigation.js +2 -0
  92. package/modules/net.cjs +1 -0
  93. package/modules/net.d.ts +14 -0
  94. package/modules/net.js +1 -0
  95. package/modules/objects.cjs +4 -0
  96. package/modules/objects.d.ts +19 -0
  97. package/modules/objects.js +4 -0
  98. package/modules/path.cjs +1 -0
  99. package/modules/path.d.ts +8 -0
  100. package/modules/path.js +1 -0
  101. package/modules/promise.cjs +1 -0
  102. package/modules/promise.d.ts +7 -0
  103. package/modules/promise.js +1 -0
  104. package/modules/sanitize.cjs +2 -0
  105. package/modules/sanitize.d.ts +6 -0
  106. package/modules/sanitize.js +2 -0
  107. package/modules/screen.cjs +1 -0
  108. package/modules/screen.d.ts +15 -0
  109. package/modules/screen.js +1 -0
  110. package/modules/scrollbar.cjs +65 -0
  111. package/modules/scrollbar.d.ts +13 -0
  112. package/modules/scrollbar.js +65 -0
  113. package/modules/security.cjs +1 -0
  114. package/modules/security.d.ts +19 -0
  115. package/modules/security.js +1 -0
  116. package/modules/shortcut.cjs +1 -0
  117. package/modules/shortcut.d.ts +6 -0
  118. package/modules/shortcut.js +1 -0
  119. package/modules/socket.cjs +2 -0
  120. package/modules/socket.d.ts +17 -0
  121. package/modules/socket.js +2 -0
  122. package/modules/sse.cjs +2 -0
  123. package/modules/sse.d.ts +12 -0
  124. package/modules/sse.js +2 -0
  125. package/modules/svg.cjs +2 -0
  126. package/modules/svg.d.ts +16 -0
  127. package/modules/svg.js +2 -0
  128. package/modules/sync.cjs +1 -0
  129. package/modules/sync.d.ts +17 -0
  130. package/modules/sync.js +1 -0
  131. package/modules/system.cjs +1 -0
  132. package/modules/system.d.ts +6 -0
  133. package/modules/system.js +1 -0
  134. package/modules/text.cjs +15 -0
  135. package/modules/text.d.ts +16 -0
  136. package/modules/text.js +15 -0
  137. package/modules/timer.cjs +1 -0
  138. package/modules/timer.d.ts +7 -0
  139. package/modules/timer.js +1 -0
  140. package/modules/tools.cjs +1 -0
  141. package/modules/tools.d.ts +9 -0
  142. package/modules/tools.js +1 -0
  143. package/modules/translators.cjs +1 -0
  144. package/modules/translators.d.ts +6 -0
  145. package/modules/translators.js +1 -0
  146. package/modules/triggers.cjs +1 -0
  147. package/modules/triggers.d.ts +47 -0
  148. package/modules/triggers.js +1 -0
  149. package/modules/types.cjs +1 -0
  150. package/modules/types.d.ts +9 -0
  151. package/modules/types.js +1 -0
  152. package/modules/ui.cjs +6 -0
  153. package/modules/ui.d.ts +7 -0
  154. package/modules/ui.js +6 -0
  155. package/modules/window.cjs +7 -0
  156. package/modules/window.d.ts +13 -0
  157. package/modules/window.js +7 -0
  158. package/modules/worker.cjs +2 -0
  159. package/modules/worker.d.ts +20 -0
  160. package/modules/worker.js +2 -0
  161. package/package.json +277 -4
  162. package/sbom.json +48 -0
@@ -0,0 +1 @@
1
+ var m={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:[],...m},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 a=dphelper;Object.defineProperty(a,"setProps",{value:(t,r,e)=>{Object.defineProperty(t,r.name,e||{writable:false,configurable:false,enumerable:false}),e?.lock&&Object.freeze(t[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(a,"setDescription",{value:(t,r)=>{Object.defineProperties(a,{[t.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(e=>(Object.defineProperties(a[t.name],{[e]:{writable:false,configurable:false,enumerable:false}}),null)),a.setProps(a,t,{writable:false,configurable:false,enumerable:false}),a._list.scripts.push(t);}});var h={name:"compress",active:true,subCommand:[{name:"gzip",version:"0.0.1",example:"dphelper.compress.gzip('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using gzip",env:"both",subCommand:[]},{name:"gunzip",version:"0.0.1",example:"dphelper.compress.gunzip(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress gzip data",env:"both",subCommand:[]},{name:"deflate",version:"0.0.1",example:"dphelper.compress.deflate('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using deflate",env:"both",subCommand:[]},{name:"inflate",version:"0.0.1",example:"dphelper.compress.inflate(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress deflate data",env:"both",subCommand:[]},{name:"compress",version:"0.0.1",example:"dphelper.compress.compress('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Compress data using LZW algorithm (JavaScript compatible)",env:"both",subCommand:[]},{name:"decompress",version:"0.0.1",example:"dphelper.compress.decompress(compressedString)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decompress LZW compressed data",env:"both",subCommand:[]},{name:"base64Encode",version:"0.0.1",example:"dphelper.compress.base64Encode('Hello')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Encode string to base64",env:"both",subCommand:[]},{name:"base64Decode",version:"0.0.1",example:"dphelper.compress.base64Decode('SGVsbG8=')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"Decode base64 string",env:"both",subCommand:[]},{name:"urlEncode",version:"0.0.1",example:"dphelper.compress.urlEncode('Hello World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"URL encode a string",env:"both",subCommand:[]},{name:"urlDecode",version:"0.0.1",example:"dphelper.compress.urlDecode('Hello%20World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"URL decode a string",env:"both",subCommand:[]},{name:"htmlEncode",version:"0.0.1",example:"dphelper.compress.htmlEncode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"HTML encode a string",env:"both",subCommand:[]},{name:"htmlDecode",version:"0.0.1",example:"dphelper.compress.htmlDecode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:true,description:"HTML decode a string",env:"both",subCommand:[]}]},g=async t=>{let r=typeof t=="string"?new TextEncoder().encode(t):t,e=new CompressionStream("gzip"),o=e.writable.getWriter();return o.write(r.buffer),o.close(),new Response(e.readable).blob()},v=async t=>{let r=new DecompressionStream("gzip"),e=r.writable.getWriter();e.write(await t.arrayBuffer()),e.close();let o=await new Response(r.readable).arrayBuffer();return new TextDecoder().decode(o)},w=async t=>{let r=typeof t=="string"?new TextEncoder().encode(t):t,e=new CompressionStream("deflate"),o=e.writable.getWriter();return o.write(r.buffer),o.close(),new Response(e.readable).blob()},D=async t=>{let r=new DecompressionStream("deflate"),e=r.writable.getWriter();e.write(await t.arrayBuffer()),e.close();let o=await new Response(r.readable).arrayBuffer();return new TextDecoder().decode(o)},y=t=>{let r={},e="",o=[],i=256;for(let s=0;s<256;s++)r[String.fromCharCode(s)]=s;for(let s=0;s<t.length;s++){let n=t[s],l=e+n;r[l]!==void 0?e=l:(o.push(String(r[e])),r[l]=i++,e=n);}return e!==""&&o.push(String(r[e])),String.fromCharCode(...o.map(Number))},C=t=>{let r={},e=[],o=256;for(let n=0;n<256;n++)r[n]=String.fromCharCode(n);let i=t.split("").map(n=>n.charCodeAt(0)),s=r[i[0]];e.push(s);for(let n=1;n<i.length;n++){let l=i[n],c=r[l];c===void 0&&(c=s+s[0]),e.push(c),r[o++]=s+c[0],s=c;}return e.join("")},P=t=>{let r=new TextEncoder().encode(t),e="";return r.forEach(o=>e+=String.fromCharCode(o)),btoa(e)},x=t=>{let r=atob(t),e=new Uint8Array(r.length);for(let o=0;o<r.length;o++)e[o]=r.charCodeAt(o);return new TextDecoder().decode(e)},S=t=>encodeURIComponent(t),j=t=>decodeURIComponent(t),E=t=>{let r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return t.replace(/[&<>"']/g,e=>r[e]||e)},M=t=>{let r={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};return t.replace(/&(amp|lt|gt|quot|#39);/g,(e,o)=>r[`&${o};`]||e)},z={gzip:g,gunzip:v,deflate:w,inflate:D,compress:y,decompress:C,base64Encode:P,base64Decode:x,urlEncode:S,urlDecode:j,htmlEncode:E,htmlDecode:M};dphelper?.setDescription(h,z);var q=dphelper.compress;export{q as compress};
@@ -0,0 +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.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 r=dphelper;Object.defineProperty(r,"setProps",{value:(e,t,o)=>{Object.defineProperty(e,t.name,o||{writable:false,configurable:false,enumerable:false}),o?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(o=>(Object.defineProperties(r[e.name],{[o]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var v={name:"cookie",active:true,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.cookie.set({name, value, time, path = '/'})",description:"Creates a cookie with specified properties.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"get",version:"0.0.2",example:"dphelper.cookie.get(name)",description:"Retrieves the value of a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"delete",version:"0.0.2",example:"dphelper.cookie.delete(name)",description:"Deletes a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"removeAll",version:"0.0.2",example:"dphelper.cookie.removeAll()",description:"Clears all cookies.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]}]},g={set:e=>{let t=new Date;if(t.setTime(t.getTime()+3600*1e3*24*365),!e.name)return;let{name:o,value:i,time:a=e.time||t.toUTCString(),path:l=e.path||"/",sameSite:p=e.sameSite||"Lax",secure:u=e.secure??location.protocol==="https:"}=e,m=encodeURIComponent(i),d=u?"Secure":"",f=p;document.cookie=`${o}=${m}; expires=${a}; path=${l}; SameSite=${f}; ${d}`;},get:e=>{let t=document.cookie.split(";"),o=t.length;for(let i=0;i<o;i++){let a=t[i];if(!a)continue;let l=a.trim().split("=");if(e===l[0])return decodeURIComponent(l[1]||"")}return null},delete:e=>dphelper.cookie.set({name:e,value:"",time:"Thu, 01 Jan 1970 00:00:00 GMT"}),removeAll:()=>{let e=document.cookie.split(";"),t=e.length;for(let o=0;o<t;o++){let i=e[o];if(!i)continue;let a=i.indexOf("="),l=a>-1?i.slice(0,a):i;dphelper.cookie.delete(l.trim());}}};dphelper?.setDescription(v,g);var T=dphelper.cookie;exports.cookie=T;
@@ -0,0 +1,16 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface CookieTool {
3
+ set: (pars: {
4
+ name: any,
5
+ value: any,
6
+ time?: any,
7
+ path?: string,
8
+ sameSite?: string,
9
+ secure?: string
10
+ }) => any
11
+ get: (name: string) => any
12
+ delete: (name: string) => any
13
+ removeAll: () => any
14
+ }
15
+
16
+ export const cookie: CookieTool
@@ -0,0 +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.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 r=dphelper;Object.defineProperty(r,"setProps",{value:(e,t,o)=>{Object.defineProperty(e,t.name,o||{writable:false,configurable:false,enumerable:false}),o?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(o=>(Object.defineProperties(r[e.name],{[o]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var g={name:"cookie",active:true,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.cookie.set({name, value, time, path = '/'})",description:"Creates a cookie with specified properties.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"get",version:"0.0.2",example:"dphelper.cookie.get(name)",description:"Retrieves the value of a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"delete",version:"0.0.2",example:"dphelper.cookie.delete(name)",description:"Deletes a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]},{name:"removeAll",version:"0.0.2",example:"dphelper.cookie.removeAll()",description:"Clears all cookies.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:true,env:"client",subCommand:[]}]},k={set:e=>{let t=new Date;if(t.setTime(t.getTime()+3600*1e3*24*365),!e.name)return;let{name:o,value:i,time:a=e.time||t.toUTCString(),path:l=e.path||"/",sameSite:u=e.sameSite||"Lax",secure:m=e.secure??location.protocol==="https:"}=e,d=encodeURIComponent(i),f=m?"Secure":"",b=u;document.cookie=`${o}=${d}; expires=${a}; path=${l}; SameSite=${b}; ${f}`;},get:e=>{let t=document.cookie.split(";"),o=t.length;for(let i=0;i<o;i++){let a=t[i];if(!a)continue;let l=a.trim().split("=");if(e===l[0])return decodeURIComponent(l[1]||"")}return null},delete:e=>dphelper.cookie.set({name:e,value:"",time:"Thu, 01 Jan 1970 00:00:00 GMT"}),removeAll:()=>{let e=document.cookie.split(";"),t=e.length;for(let o=0;o<t;o++){let i=e[o];if(!i)continue;let a=i.indexOf("="),l=a>-1?i.slice(0,a):i;dphelper.cookie.delete(l.trim());}}};dphelper?.setDescription(g,k);var $=dphelper.cookie;export{$ as cookie};
@@ -0,0 +1,8 @@
1
+ 'use strict';var b={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:[],...b},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 s=dphelper;Object.defineProperty(s,"setProps",{value:(e,r,t)=>{Object.defineProperty(e,r.name,t||{writable:false,configurable:false,enumerable:false}),t?.lock&&Object.freeze(e[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,r)=>{Object.defineProperties(s,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(s[e.name],{[t]:{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:"coords",active:true,subCommand:[{name:"degreesToRadians",version:"0.0.2",example:"dphelper.coords.degreesToRadians(45)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert degrees to radians",env:"client",subCommand:[]},{name:"latToMeters",version:"0.0.2",example:"dphelper.coords.latToMeters([40.689202777778, -74.044219444444])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert latitude to meters",env:"client",subCommand:[]},{name:"toVector",version:"0.0.2",example:"dphelper.coords.toVector([40.689202777778, -74.044219444444, 1])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to vector",env:"client",subCommand:[]},{name:"convertToDecDegrees",version:"0.0.2",example:"dphelper.coords.convertToDecDegrees([39, 5, 59, 'N'])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to decimal degrees",env:"client",subCommand:[]},{name:"distance",version:"0.0.2",example:"dphelper.coords.distance([40.718788808171105, -74.0114768663747],[38.909309636475875, -77.01712459058946])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:`
2
+ Haversine formula:
3
+ a = sin\xB2(\u0394\u03C6/2) + cos \u03C61 \u22C5 cos \u03C62 \u22C5 sin\xB2(\u0394\u03BB/2)
4
+ c = 2 \u22C5 atan2( \u221Aa, \u221A(1-a) )
5
+ d = R \u22C5 c
6
+ where \u03C6 is latitude, \u03BB is longitude, R is earth's radius (mean radius = 6,371km);
7
+ note that angles need to be in radians to pass to trig functions!
8
+ `,env:"client",subCommand:[]},{name:"polarToCartesian",version:"0.0.2",example:"dphelper.coords.polarToCartesian([centerX, centerY, radius, angleInDegrees])",author:"Dario Passariello",creationDate:"2024-09-28",lastMod:"2024-09-28",type:"function",active:true,description:"Convert polar coordinates to Cartesian coordinates",env:"client",subCommand:[]},{name:"mapDegreesToPixels",version:"0.0.2",example:"dphelper.coords.mapDegreesToPixels([degree, minDegree, maxDegree, minPixel, maxPixel, padding])",author:"Dario Passariello",creationDate:"2024-09-28",lastMod:"2024-09-28",type:"function",active:true,description:"Map degrees to pixels",env:"client",subCommand:[]}]},l=6371e3,g={degreesToRadians:e=>e*Math.PI/180,latToMeters:e=>Array.isArray(e)?l*Math.cos(e[0])*Math.cos(e[1])/1e3:void 0,toVector:e=>{if(!Array.isArray(e))return;let r=l*Math.cos(e[1]*Math.PI/180)*Math.cos(e[0]*Math.PI/180),t=l*Math.cos(e[1]*Math.PI/180)*Math.sin(e[0]*Math.PI/180),a=l*Math.sin(e[2]*Math.PI/180);return [r,t,a]},convertToDecDegrees:(e,r,t,a)=>{let o=e+r/60+t/3600;return (a==="S"||a==="W")&&(o*=-1),o},distance:(e,r)=>{if(!(Array.isArray(e)&&Array.isArray(r)))return;let t=e[0]*Math.PI/180,a=r[0]*Math.PI/180,o=(r[0]-e[0])*Math.PI/180,n=(r[1]-e[1])*Math.PI/180,c=Math.sin(o/2)*Math.sin(o/2)+Math.cos(t)*Math.cos(a)*Math.sin(n/2)*Math.sin(n/2),u=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i=l*u;return {km:Number((i/1e3).toFixed(2)),mi:Number((i/1e3*.621371).toFixed(2)),nMi:Number((i/1e3/1.852).toFixed(2))}},polarToCartesian:(e,r,t,a)=>{let o=(a-90)*Math.PI/180;return {x:e+t*Math.cos(o),y:r+t*Math.sin(o)}},mapDegreesToPixels:(e,r,t,a,o,n)=>{let c=(e-r)/(t-r),u=a+c*(o-a),i=n/20,d=o-(u-n)-i;return d<n?n:d}};dphelper?.setDescription(v,g);var O=dphelper.coords;exports.coords=O;
@@ -0,0 +1,12 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface CoordsTool {
3
+ degreesToRadians: (degrees: any) => any
4
+ latToMeters: (points: any) => any
5
+ toVector: (points: any) => any
6
+ convertToDecDegrees: (deg: any, minutes: any, sec: any, direction: any) => any
7
+ distance: (point1: any, point2: any) => any
8
+ polarToCartesian: (centerX: any, centerY: any, radius: any, angleInDegrees: any) => any
9
+ mapDegreesToPixels: (degree: number, minDegree: number, maxDegree: number, minPixel: number, maxPixel: number, padding: number) => number
10
+ }
11
+
12
+ export const coords: CoordsTool
@@ -0,0 +1,8 @@
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 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:[],...p},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:(e,r,t)=>{Object.defineProperty(e,r.name,t||{writable:false,configurable:false,enumerable:false}),t?.lock&&Object.freeze(e[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(s,"setDescription",{value:(e,r)=>{Object.defineProperties(s,{[e.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(t=>(Object.defineProperties(s[e.name],{[t]:{writable:false,configurable:false,enumerable:false}}),null)),s.setProps(s,e,{writable:false,configurable:false,enumerable:false}),s._list.scripts.push(e);}});var g={name:"coords",active:true,subCommand:[{name:"degreesToRadians",version:"0.0.2",example:"dphelper.coords.degreesToRadians(45)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert degrees to radians",env:"client",subCommand:[]},{name:"latToMeters",version:"0.0.2",example:"dphelper.coords.latToMeters([40.689202777778, -74.044219444444])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert latitude to meters",env:"client",subCommand:[]},{name:"toVector",version:"0.0.2",example:"dphelper.coords.toVector([40.689202777778, -74.044219444444, 1])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to vector",env:"client",subCommand:[]},{name:"convertToDecDegrees",version:"0.0.2",example:"dphelper.coords.convertToDecDegrees([39, 5, 59, 'N'])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:"Convert coordinates to decimal degrees",env:"client",subCommand:[]},{name:"distance",version:"0.0.2",example:"dphelper.coords.distance([40.718788808171105, -74.0114768663747],[38.909309636475875, -77.01712459058946])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:true,description:`
2
+ Haversine formula:
3
+ a = sin\xB2(\u0394\u03C6/2) + cos \u03C61 \u22C5 cos \u03C62 \u22C5 sin\xB2(\u0394\u03BB/2)
4
+ c = 2 \u22C5 atan2( \u221Aa, \u221A(1-a) )
5
+ d = R \u22C5 c
6
+ where \u03C6 is latitude, \u03BB is longitude, R is earth's radius (mean radius = 6,371km);
7
+ note that angles need to be in radians to pass to trig functions!
8
+ `,env:"client",subCommand:[]},{name:"polarToCartesian",version:"0.0.2",example:"dphelper.coords.polarToCartesian([centerX, centerY, radius, angleInDegrees])",author:"Dario Passariello",creationDate:"2024-09-28",lastMod:"2024-09-28",type:"function",active:true,description:"Convert polar coordinates to Cartesian coordinates",env:"client",subCommand:[]},{name:"mapDegreesToPixels",version:"0.0.2",example:"dphelper.coords.mapDegreesToPixels([degree, minDegree, maxDegree, minPixel, maxPixel, padding])",author:"Dario Passariello",creationDate:"2024-09-28",lastMod:"2024-09-28",type:"function",active:true,description:"Map degrees to pixels",env:"client",subCommand:[]}]},l=6371e3,M={degreesToRadians:e=>e*Math.PI/180,latToMeters:e=>Array.isArray(e)?l*Math.cos(e[0])*Math.cos(e[1])/1e3:void 0,toVector:e=>{if(!Array.isArray(e))return;let r=l*Math.cos(e[1]*Math.PI/180)*Math.cos(e[0]*Math.PI/180),t=l*Math.cos(e[1]*Math.PI/180)*Math.sin(e[0]*Math.PI/180),a=l*Math.sin(e[2]*Math.PI/180);return [r,t,a]},convertToDecDegrees:(e,r,t,a)=>{let o=e+r/60+t/3600;return (a==="S"||a==="W")&&(o*=-1),o},distance:(e,r)=>{if(!(Array.isArray(e)&&Array.isArray(r)))return;let t=e[0]*Math.PI/180,a=r[0]*Math.PI/180,o=(r[0]-e[0])*Math.PI/180,n=(r[1]-e[1])*Math.PI/180,c=Math.sin(o/2)*Math.sin(o/2)+Math.cos(t)*Math.cos(a)*Math.sin(n/2)*Math.sin(n/2),u=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i=l*u;return {km:Number((i/1e3).toFixed(2)),mi:Number((i/1e3*.621371).toFixed(2)),nMi:Number((i/1e3/1.852).toFixed(2))}},polarToCartesian:(e,r,t,a)=>{let o=(a-90)*Math.PI/180;return {x:e+t*Math.cos(o),y:r+t*Math.sin(o)}},mapDegreesToPixels:(e,r,t,a,o,n)=>{let c=(e-r)/(t-r),u=a+c*(o-a),i=n/20,b=o-(u-n)-i;return b<n?n:b}};dphelper?.setDescription(g,M);var k=dphelper.coords;export{k as coords};
@@ -0,0 +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 e={codeName:"dphelper",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:e.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,r,l)=>{Object.defineProperty(t,r.name,l||{writable:false,configurable:false,enumerable:false}),l?.lock&&Object.freeze(t[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(t,r)=>{Object.defineProperties(o,{[t.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(l=>(Object.defineProperties(o[t.name],{[l]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,t,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(t);}});var c={name:"credits",active:true,subCommand:[]},p=()=>{console.groupCollapsed(`%c${e.codeName} v${e.version}%c`,"color:orange",""),console.debug(`%c${e.codeName} v${e.version}%c by Dario Passariello started`,"color:orange",""),console.debug(`name: %c${e.codeName}`,"color:orange",""),console.debug(`version: %c${e.version}`,"color:orange",""),console.groupEnd();},u=dphelper;u?.setDescription?.(c,p);var O=dphelper.credits;exports.credits=O;
@@ -0,0 +1,15 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface Credits {
3
+ name: string
4
+ version: string
5
+ description: string
6
+ license: string
7
+ author: {
8
+ name: string
9
+ email: string
10
+ }
11
+ }
12
+
13
+ type CreditsTool = (props: Credits) => void
14
+
15
+ export const credits: CreditsTool
@@ -0,0 +1 @@
1
+ var i={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var e={codeName:"dphelper",version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...i},configurable:true,writable:true},version:{value:e.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,r,l)=>{Object.defineProperty(t,r.name,l||{writable:false,configurable:false,enumerable:false}),l?.lock&&Object.freeze(t[r.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(o,"setDescription",{value:(t,r)=>{Object.defineProperties(o,{[t.name]:{value:r,writable:false,configurable:false,enumerable:false}}),Object.keys(r).map(l=>(Object.defineProperties(o[t.name],{[l]:{writable:false,configurable:false,enumerable:false}}),null)),o.setProps(o,t,{writable:false,configurable:false,enumerable:false}),o._list.scripts.push(t);}});var p={name:"credits",active:true,subCommand:[]},u=()=>{console.groupCollapsed(`%c${e.codeName} v${e.version}%c`,"color:orange",""),console.debug(`%c${e.codeName} v${e.version}%c by Dario Passariello started`,"color:orange",""),console.debug(`name: %c${e.codeName}`,"color:orange",""),console.debug(`version: %c${e.version}`,"color:orange",""),console.groupEnd();},b=dphelper;b?.setDescription?.(p,u);var k=dphelper.credits;export{k as credits};
@@ -0,0 +1,12 @@
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 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:[],...d},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 i=dphelper;Object.defineProperty(i,"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(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(i[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var m={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]};var b={name:"date",active:true,subCommand:[{name:"toIso",version:"0.0.2",example:"dphelper.date.toIso(value, 'en')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to ISO format.",env:"both",subCommand:[]},{name:"toMMDDYYYY",version:"0.0.2",example:"dphelper.date.toMMDDYYYY(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to MMDDYYYY format.",env:"both",subCommand:[]},{name:"toYYYYMMDD",version:"0.0.2",example:"dphelper.date.toYYYYMMDD(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to YYYYMMDD format.",env:"both",subCommand:[]},{name:"toHuman",version:"0.0.2",example:"dphelper.date.toHuman(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a human-readable format.",env:"both",subCommand:[]},{name:"convert",version:"0.0.2",example:"dphelper.date.convert(value, format)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a specified format.",env:"both",subCommand:[]},{name:"iso2Epoch",version:"0.0.2",example:"dphelper.date.iso2Epoch(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to epoch time.",env:"both",subCommand:[]},{name:"localIsoTime",version:"0.0.2",example:"dphelper.date.localIsoTime(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the local ISO time for a given date value.",env:"both",subCommand:[]},{name:"utc",version:"0.0.2",example:"dphelper.date.utc()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current UTC time.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.date.parse(value, '/')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Parses a date value with a specified separator.",env:"both",subCommand:[]},{name:"year",version:"0.0.2",example:"dphelper.date.year()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current year.",env:"both",subCommand:[]},{name:"addDays",version:"0.0.2",example:"dphelper.date.addDays(date, days)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Adds a specified number of days to a date.",env:"both",subCommand:[]},{name:"dateTimeToString",version:"0.0.2",example:"dphelper.date.dateTimeToString(dateObject)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date object to a string.",env:"both",subCommand:[]},{name:"isoToHuman",version:"0.0.2",example:"dphelper.date.isoToHuman(value, '@')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to a human-readable format with a specified symbol.",env:"both",subCommand:[]},{name:"fullDate",version:"0.0.2",example:"dphelper.date.fullDate()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the full date and time in the format DD-MM-YYYY HH:MM:SS.",env:"both",subCommand:[]},{name:"epoch",version:"0.0.2",example:"dphelper.date.epoch()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current epoch time.",env:"both",subCommand:[]},{name:"diffInDays",version:"0.0.2",example:"dphelper.date.diffInDays(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in days between two dates.",env:"both",subCommand:[]},{name:"diffInWeeks",version:"0.0.2",example:"dphelper.date.diffInWeeks(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in weeks between two dates.",env:"both",subCommand:[]},{name:"diffInMonths",version:"0.0.2",example:"dphelper.date.diffInMonths(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in months between two dates.",env:"both",subCommand:[]},{name:"diffInYears",version:"0.0.2",example:"dphelper.date.diffInYears(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in years between two dates.",env:"both",subCommand:[]},{name:"dateToYMD",version:"0.0.2",example:"dphelper.date.dateToYMD(date)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date to the format YYYY-MM-DD.",env:"both",subCommand:[]},{name:"collection",version:"0.0.2",example:"dphelper.date.collection()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets various date representations based on the type and locale.",env:"both",subCommand:[]},{name:"timeZones",version:"0.0.2",example:"dphelper.date.timeZones()",author:"Dario Passariello",creationDate:"20240901",lastMod:"20260220",type:"function",active:true,description:"Returns an array of all supported timezones.",env:"both",subCommand:[]}]},g={days:(e="en")=>({en:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],it:["luned\xEC","marted\xEC","mercoled\xEC","gioved\xEC","venerd\xEC","sabato","domenica"]})[e],months:(e="en")=>m[e],year:()=>new Date().getFullYear(),toIso:(e,t="en")=>{e||(e="");let a=new Date(e);return String(a)==="Invalid Date"?null:new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"numeric"}).format(a)},toMMDDYYYY:e=>{try{let t=new Date(e);return isNaN(t.getTime())?"":`0${t.getMonth()+1}`.slice(-2)+""+`0${t.getDate()}`.slice(-2)+t.getFullYear()}catch{return ""}},toYYYYMMDD:e=>{if(e)return e.toISOString().split("T")[0].replaceAll("-","")},toHuman:e=>{let t={weekday:"long",year:"numeric",month:"long",day:"numeric"};return e.toLocaleDateString(void 0,t)},convert:(e,t)=>{if(!e)return null;t||(t=dphelper.date.months("en"));let a=e.substring(0,2).replace("0",""),o=e.substring(2,4),n=e.substring(e.length-4);return `${o} ${t[Number(a)-1]} ${n}`},iso2Epoch:e=>(e||(e=""),new Date(e).getTime()),localIsoTime:e=>{e||(e=new Date);let t=new Date(e);if(isNaN(t.getTime()))return "";let a=t.getTimezoneOffset()*6e4;return new Date(Date.now()-a).toISOString().slice(0,-1)},utc:()=>new Date().toUTCString(),parse:(e,t="/")=>{if(!e)return null;let a=e.substring(0,2),o=e.substring(2,4),n=e.substring(4,8);return a+t+o+t+n},addDays:(e,t)=>{let a=new Date(Number(e));return a.setDate(e.getDate()+t),a},dateTimeToString:e=>{try{return `${e.getFullYear()}${e.getMonth().toString().length>1?e.getMonth()+1:`0${e.getMonth()+1}`}
2
+ ${e.getDate().toString().length>1?e.getDate():`0${e.getDate()}`}_${e.getHours()}${e.getMinutes()}${e.getSeconds()}`}catch(t){return console.error(t),e}},isoToHuman:(e,t="@")=>{if(!e)return null;let a=dphelper.date.months("en"),o=new Date(e),n=o.getFullYear(),s=e.split("T")[1].split(":").slice(0,2).join(":"),r=(o.getMonth()+1).toString(),l=o.getDate().toString();return l.length<2&&(l=`0${l}`),r.length<2&&(r=`0${r}`),`${l} ${a[Number(r)-1]} ${n} ${t} ${s}`},fullDate:()=>{let e=new Date,t=Number(e.getDate()),a=Number(e.getMonth()+1),o=Number(e.getFullYear()),n=Number(e.getHours()),s=Number(e.getMinutes()),r=Number(e.getSeconds());return (t<10?`0${t}`:t)+"-"+(a<10?`0${a}`:a)+"-"+o+" "+(n<10?`0${n}`:n)+":"+(s<10?`0${s}`:s)+":"+(r<10?`0${r}`:r)},epoch:()=>Date.now(),diffInDays:(e,t)=>{let a=t.getTime(),o=e.getTime();return Math.floor((a-o)/(24*3600*1e3))},diffInWeeks:(e,t)=>{let a=t.getTime(),o=e.getTime();return Number(Number.parseInt(String((a-o)/(24*3600*1e3*7)),10))},diffInMonths:(e,t)=>{let a=e.getFullYear(),o=t.getFullYear(),n=e.getMonth();return t.getMonth()+12*o-(n+12*a)},diffInYears:(e,t)=>t.getFullYear()-e.getFullYear(),dateToYMD:e=>{let t=e.getDate(),a=e.getMonth()+1;return `${e.getFullYear()}-${a<=9?`0${a}`:a}-${t<=9?`0${t}`:t}`},collection:({date:e=new Date,type:t="",locale:a="en-US"})=>{!e&&t&&a&&console.debug(`
3
+ "toDateString" -> Tue Jan 02 2024
4
+ "toISOString" -> 2024-01-02T18:44:43.590Z
5
+ "toJSON" -> 2024-01-02T18:44:43.590Z
6
+ "toLocaleDateString" -> 1/2/2024
7
+ "toLocaleString" -> 1/2/2024, 11:44:43 AM
8
+ "toLocaleTimeString" -> 11:44:43 AM
9
+ "toString" -> Tue Jan 02 2024 11:44:43 GMT-0700 (Mountain Standard Time)
10
+ "toISOStringShort" -> 2024-01-02
11
+ "toLocaleString (en-GB)" -> 02/01/2024, 11:47:56 am
12
+ `);let o;switch(t){case "toDateString":o=e.toDateString();break;case "toISOString":o=e.toISOString();break;case "toJSON":o=e.toJSON();break;case "toLocaleDateString":o=e.toLocaleDateString(a);break;case "toLocaleString":o=e.toLocaleString(a);break;case "toLocaleTimeString":o=e.toLocaleTimeString(a);break;case "toString":o=e.toString();break;case "toISOStringShort":o=e.toISOString().slice(0,10);break}return o},timeZones:()=>{let e=[],t=Intl.supportedValuesOf("timeZone");for(let a of t)e.push(a);return e}};dphelper?.setDescription(b,g);var x=dphelper.date;exports.date=x;
@@ -0,0 +1,29 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface DateTool {
3
+ days: (lang?: string) => string[]
4
+ months: (lang?: string) => string[]
5
+ year: () => number
6
+ toIso: (value: any, int?: string) => string | null
7
+ toMMDDYYYY: (value: any) => string
8
+ toYYYYMMDD: (value: any) => string | undefined
9
+ toHuman: (value: any) => string
10
+ convert: (value: any, format: string[]) => string | null
11
+ iso2Epoch: (value: any) => number
12
+ localIsoTime: (value: any) => string
13
+ utc: () => string
14
+ parse: (value: any, separator?: string) => string | null
15
+ addDays: (date: any, days: number) => Date
16
+ dateTimeToString: (dateObject: any) => string
17
+ isoToHuman: (value: any, symbol?: string) => string | null
18
+ fullDate: () => string
19
+ epoch: () => number
20
+ diffInDays: (d1: any, d2: any) => number
21
+ diffInWeeks: (d1: any, d2: any) => number
22
+ diffInMonths: (d1: any, d2: any) => number
23
+ diffInYears: (d1: any, d2: any) => number
24
+ dateToYMD: (date: any) => string
25
+ collection: (params: { date?: Date; type: string; locale?: string }) => string | undefined
26
+ timeZones: () => string[]
27
+ }
28
+
29
+ export const date: DateTool
@@ -0,0 +1,12 @@
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 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:[],...c},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 i=dphelper;Object.defineProperty(i,"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(i,"setDescription",{value:(e,t)=>{Object.defineProperties(i,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(i[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),i.setProps(i,e,{writable:false,configurable:false,enumerable:false}),i._list.scripts.push(e);}});var p={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]};var g={name:"date",active:true,subCommand:[{name:"toIso",version:"0.0.2",example:"dphelper.date.toIso(value, 'en')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to ISO format.",env:"both",subCommand:[]},{name:"toMMDDYYYY",version:"0.0.2",example:"dphelper.date.toMMDDYYYY(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to MMDDYYYY format.",env:"both",subCommand:[]},{name:"toYYYYMMDD",version:"0.0.2",example:"dphelper.date.toYYYYMMDD(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to YYYYMMDD format.",env:"both",subCommand:[]},{name:"toHuman",version:"0.0.2",example:"dphelper.date.toHuman(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a human-readable format.",env:"both",subCommand:[]},{name:"convert",version:"0.0.2",example:"dphelper.date.convert(value, format)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date value to a specified format.",env:"both",subCommand:[]},{name:"iso2Epoch",version:"0.0.2",example:"dphelper.date.iso2Epoch(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to epoch time.",env:"both",subCommand:[]},{name:"localIsoTime",version:"0.0.2",example:"dphelper.date.localIsoTime(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the local ISO time for a given date value.",env:"both",subCommand:[]},{name:"utc",version:"0.0.2",example:"dphelper.date.utc()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current UTC time.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.date.parse(value, '/')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Parses a date value with a specified separator.",env:"both",subCommand:[]},{name:"year",version:"0.0.2",example:"dphelper.date.year()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current year.",env:"both",subCommand:[]},{name:"addDays",version:"0.0.2",example:"dphelper.date.addDays(date, days)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Adds a specified number of days to a date.",env:"both",subCommand:[]},{name:"dateTimeToString",version:"0.0.2",example:"dphelper.date.dateTimeToString(dateObject)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date object to a string.",env:"both",subCommand:[]},{name:"isoToHuman",version:"0.0.2",example:"dphelper.date.isoToHuman(value, '@')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts an ISO date value to a human-readable format with a specified symbol.",env:"both",subCommand:[]},{name:"fullDate",version:"0.0.2",example:"dphelper.date.fullDate()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the full date and time in the format DD-MM-YYYY HH:MM:SS.",env:"both",subCommand:[]},{name:"epoch",version:"0.0.2",example:"dphelper.date.epoch()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets the current epoch time.",env:"both",subCommand:[]},{name:"diffInDays",version:"0.0.2",example:"dphelper.date.diffInDays(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in days between two dates.",env:"both",subCommand:[]},{name:"diffInWeeks",version:"0.0.2",example:"dphelper.date.diffInWeeks(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in weeks between two dates.",env:"both",subCommand:[]},{name:"diffInMonths",version:"0.0.2",example:"dphelper.date.diffInMonths(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in months between two dates.",env:"both",subCommand:[]},{name:"diffInYears",version:"0.0.2",example:"dphelper.date.diffInYears(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the difference in years between two dates.",env:"both",subCommand:[]},{name:"dateToYMD",version:"0.0.2",example:"dphelper.date.dateToYMD(date)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a date to the format YYYY-MM-DD.",env:"both",subCommand:[]},{name:"collection",version:"0.0.2",example:"dphelper.date.collection()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Gets various date representations based on the type and locale.",env:"both",subCommand:[]},{name:"timeZones",version:"0.0.2",example:"dphelper.date.timeZones()",author:"Dario Passariello",creationDate:"20240901",lastMod:"20260220",type:"function",active:true,description:"Returns an array of all supported timezones.",env:"both",subCommand:[]}]},D={days:(e="en")=>({en:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],it:["luned\xEC","marted\xEC","mercoled\xEC","gioved\xEC","venerd\xEC","sabato","domenica"]})[e],months:(e="en")=>p[e],year:()=>new Date().getFullYear(),toIso:(e,t="en")=>{e||(e="");let a=new Date(e);return String(a)==="Invalid Date"?null:new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"numeric"}).format(a)},toMMDDYYYY:e=>{try{let t=new Date(e);return isNaN(t.getTime())?"":`0${t.getMonth()+1}`.slice(-2)+""+`0${t.getDate()}`.slice(-2)+t.getFullYear()}catch{return ""}},toYYYYMMDD:e=>{if(e)return e.toISOString().split("T")[0].replaceAll("-","")},toHuman:e=>{let t={weekday:"long",year:"numeric",month:"long",day:"numeric"};return e.toLocaleDateString(void 0,t)},convert:(e,t)=>{if(!e)return null;t||(t=dphelper.date.months("en"));let a=e.substring(0,2).replace("0",""),o=e.substring(2,4),n=e.substring(e.length-4);return `${o} ${t[Number(a)-1]} ${n}`},iso2Epoch:e=>(e||(e=""),new Date(e).getTime()),localIsoTime:e=>{e||(e=new Date);let t=new Date(e);if(isNaN(t.getTime()))return "";let a=t.getTimezoneOffset()*6e4;return new Date(Date.now()-a).toISOString().slice(0,-1)},utc:()=>new Date().toUTCString(),parse:(e,t="/")=>{if(!e)return null;let a=e.substring(0,2),o=e.substring(2,4),n=e.substring(4,8);return a+t+o+t+n},addDays:(e,t)=>{let a=new Date(Number(e));return a.setDate(e.getDate()+t),a},dateTimeToString:e=>{try{return `${e.getFullYear()}${e.getMonth().toString().length>1?e.getMonth()+1:`0${e.getMonth()+1}`}
2
+ ${e.getDate().toString().length>1?e.getDate():`0${e.getDate()}`}_${e.getHours()}${e.getMinutes()}${e.getSeconds()}`}catch(t){return console.error(t),e}},isoToHuman:(e,t="@")=>{if(!e)return null;let a=dphelper.date.months("en"),o=new Date(e),n=o.getFullYear(),s=e.split("T")[1].split(":").slice(0,2).join(":"),r=(o.getMonth()+1).toString(),l=o.getDate().toString();return l.length<2&&(l=`0${l}`),r.length<2&&(r=`0${r}`),`${l} ${a[Number(r)-1]} ${n} ${t} ${s}`},fullDate:()=>{let e=new Date,t=Number(e.getDate()),a=Number(e.getMonth()+1),o=Number(e.getFullYear()),n=Number(e.getHours()),s=Number(e.getMinutes()),r=Number(e.getSeconds());return (t<10?`0${t}`:t)+"-"+(a<10?`0${a}`:a)+"-"+o+" "+(n<10?`0${n}`:n)+":"+(s<10?`0${s}`:s)+":"+(r<10?`0${r}`:r)},epoch:()=>Date.now(),diffInDays:(e,t)=>{let a=t.getTime(),o=e.getTime();return Math.floor((a-o)/(24*3600*1e3))},diffInWeeks:(e,t)=>{let a=t.getTime(),o=e.getTime();return Number(Number.parseInt(String((a-o)/(24*3600*1e3*7)),10))},diffInMonths:(e,t)=>{let a=e.getFullYear(),o=t.getFullYear(),n=e.getMonth();return t.getMonth()+12*o-(n+12*a)},diffInYears:(e,t)=>t.getFullYear()-e.getFullYear(),dateToYMD:e=>{let t=e.getDate(),a=e.getMonth()+1;return `${e.getFullYear()}-${a<=9?`0${a}`:a}-${t<=9?`0${t}`:t}`},collection:({date:e=new Date,type:t="",locale:a="en-US"})=>{!e&&t&&a&&console.debug(`
3
+ "toDateString" -> Tue Jan 02 2024
4
+ "toISOString" -> 2024-01-02T18:44:43.590Z
5
+ "toJSON" -> 2024-01-02T18:44:43.590Z
6
+ "toLocaleDateString" -> 1/2/2024
7
+ "toLocaleString" -> 1/2/2024, 11:44:43 AM
8
+ "toLocaleTimeString" -> 11:44:43 AM
9
+ "toString" -> Tue Jan 02 2024 11:44:43 GMT-0700 (Mountain Standard Time)
10
+ "toISOStringShort" -> 2024-01-02
11
+ "toLocaleString (en-GB)" -> 02/01/2024, 11:47:56 am
12
+ `);let o;switch(t){case "toDateString":o=e.toDateString();break;case "toISOString":o=e.toISOString();break;case "toJSON":o=e.toJSON();break;case "toLocaleDateString":o=e.toLocaleDateString(a);break;case "toLocaleString":o=e.toLocaleString(a);break;case "toLocaleTimeString":o=e.toLocaleTimeString(a);break;case "toString":o=e.toString();break;case "toISOStringShort":o=e.toISOString().slice(0,10);break}return o},timeZones:()=>{let e=[],t=Intl.supportedValuesOf("timeZone");for(let a of t)e.push(a);return e}};dphelper?.setDescription(g,D);var O=dphelper.date;export{O as date};
@@ -0,0 +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.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:(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 b={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:[]}]},m={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 i=r.target,d=i.tagName.toLowerCase();if(!["input","button","select","textarea"].includes(d)&&!i.classList.contains("selectable"))return document.querySelectorAll("*").forEach(a=>a.blur()),r.preventDefault(),!1;document.querySelectorAll("img, a, input, button").forEach(a=>{a.addEventListener("dragstart",p=>(p.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?.(b,m);var P=dphelper.disable;exports.disable=P;
@@ -0,0 +1,12 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface DisableTool {
3
+ select: (el?: string) => void
4
+ spellCheck: (tmr?: number) => void
5
+ rightClick: (el?: string) => void
6
+ copy: (el?: string) => void
7
+ paste: (el?: string) => void
8
+ cut: (el?: string) => void
9
+ drag: (el?: string) => void
10
+ }
11
+
12
+ export const disable: DisableTool
@@ -0,0 +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.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};
@@ -0,0 +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.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;
@@ -0,0 +1,8 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface DispatchTool {
3
+ set: (name: string, value?: any) => void
4
+ listen: (name: string, cb?: (e: Event) => void, flag?: boolean) => void
5
+ remove: (name: string) => void
6
+ }
7
+
8
+ export const dispatch: DispatchTool
@@ -0,0 +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.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};
@@ -0,0 +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.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;
@@ -0,0 +1,7 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface ElementsTool {
3
+ fitScale: (el: any, scale?: number, fit?: boolean) => void
4
+ scaleBasedOnWindow: (elm: any, scale: number, fit: boolean) => void
5
+ }
6
+
7
+ export const element: ElementsTool
@@ -0,0 +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.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};
@@ -0,0 +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.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;
@@ -0,0 +1,10 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface EventsTool {
3
+ list: (el: Element) => any
4
+ multi: (element: Element, eventNames: string, listener: EventListener) => void
5
+ copy: (el: string) => void
6
+ onDrag: (elem: string) => void
7
+ keys: (e: KeyboardEvent) => { key: string; ctrl: boolean; alt: boolean; shift: boolean }
8
+ }
9
+
10
+ export const events: EventsTool
@@ -0,0 +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.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};
@@ -0,0 +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.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
+ exports.fetch=R;
@@ -0,0 +1,19 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface FetchTool {
3
+ /**
4
+ * Perform a resilient fetch with automatic retries and exponential backoff.
5
+ */
6
+ (url: string, options?: any, retries?: number, backoff?: number): Promise<Response>
7
+
8
+ /**
9
+ * Perform a GET request.
10
+ */
11
+ get: (url: string, options?: any) => Promise<Response>
12
+
13
+ /**
14
+ * Perform a POST request with optional JSON body auto-serialization.
15
+ */
16
+ post: (url: string, body: any, options?: any) => Promise<Response>
17
+ }
18
+
19
+ export const fetch: FetchTool
@@ -0,0 +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.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
+ export{H as fetch};
@@ -0,0 +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.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;
@@ -0,0 +1,17 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface FormTool {
3
+ serialize: (form: HTMLFormElement) => { [key: string]: any }
4
+ confirmType: (type: string, value: any) => boolean
5
+ required: (value: any) => string | undefined
6
+ minLength: (value: any, num?: number) => string | undefined
7
+ maxLength: (value: any, num?: number) => string | undefined
8
+ maxPhoneNumber: (value: any, num?: number) => string | undefined
9
+ isNumeric: (value: any) => boolean
10
+ isEmail: (value: any) => boolean
11
+ pattern: (e: Event) => void
12
+ noSpecialChars: (e: Event) => void
13
+ table: (size: [number, number], id: string, elem: HTMLElement) => void
14
+ sanitize: (str: string) => string | undefined
15
+ }
16
+
17
+ export const form: FormTool
@@ -0,0 +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.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};
@@ -0,0 +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.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;
@@ -0,0 +1,7 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface FormatTool {
3
+ currency: (value: number, locale?: string, currency?: string) => string
4
+ phoneNumber: (value: string, countryCode?: string) => string
5
+ }
6
+
7
+ export const format: FormatTool
@@ -0,0 +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.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};
@@ -0,0 +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.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;
@@ -0,0 +1,15 @@
1
+ /// <reference path="../types/dphelper.d.ts" />
2
+ export interface I18nTool {
3
+ setLocale: (locale: string) => void
4
+ getLocale: () => string
5
+ addTranslations: (locale: string, strings: Record<string, string>) => void
6
+ t: (key: string, vars?: Record<string, any>) => string
7
+ pluralize: (count: number, options: { zero?: string; one?: string; two?: string; few?: string; many?: string; other?: string }, locale?: string) => string
8
+ number: (value: number, locale?: string, options?: Intl.NumberFormatOptions) => string
9
+ date: (value: Date | number, locale?: string, options?: Intl.DateTimeFormatOptions) => string
10
+ relativeTime: (timestamp: number | Date, locale?: string) => string
11
+ list: (items: string[], locale?: string, options?: Intl.ListFormatOptions) => string
12
+ getSupportedLocales: () => string[]
13
+ }
14
+
15
+ export const i18n: I18nTool