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
package/README.md CHANGED
@@ -37,7 +37,7 @@
37
37
 
38
38
  ## About
39
39
 
40
- **dphelper** is a powerful, zero-dependency utility library that brings together **303 production-ready tools** for web developers, AI engineers, and DevTools creators.
40
+ **dphelper** is a powerful, zero-dependency utility library that brings together **production-ready tools** for web developers, AI engineers, and DevTools creators.
41
41
 
42
42
  Think of it as your **universal toolbox** - from DOM manipulation to cryptographic operations, from real-time WebSocket handling to AI-powered token optimization. No more juggling multiple packages. One import, infinite possibilities.
43
43
 
@@ -87,6 +87,43 @@ Import it precisely **once** in your entry point (e.g., `index.js`, `main.ts`, o
87
87
  import "dphelper";
88
88
  ```
89
89
 
90
+ ### Modular imports
91
+
92
+ For a smaller bundle or cleaner tree-shaking, import only the tool you need. Each modular entry point exposes the tool both as a **named export** and on the **global `dphelper`** object, so existing global-usage code keeps working unchanged.
93
+
94
+ ```ts
95
+ import { sanitize } from "dphelper/sanitize"
96
+ import { format } from "dphelper/format"
97
+ import { fetch } from "dphelper/fetch"
98
+ import { security } from "dphelper/security"
99
+
100
+ sanitize.html("<strong>safe text</strong>")
101
+ format.currency(1234.56, "en-US", "USD")
102
+ await fetch.get("https://api.example.com")
103
+ security.ulid()
104
+ ```
105
+
106
+ The same tool is also available on the global after import:
107
+
108
+ ```ts
109
+ import "dphelper/format"
110
+
111
+ // Identical to the named export above
112
+ dphelper.format.currency(1234.56, "en-US", "USD")
113
+ ```
114
+
115
+ > [!NOTE]
116
+ > Every tool under `tools/` is published as `dphelper/<tool>` (e.g. `dphelper/array`, `dphelper/i18n`, `dphelper/worker`). The full list is generated automatically from the `tools/` directory at build time, so adding a new tool creates its modular entry point with no extra configuration.
117
+
118
+ > [!IMPORTANT]
119
+ > **TypeScript + `resolvePackageJsonExports`:** Modular subpath imports (e.g. `import { sanitize } from "dphelper/sanitize"`) are resolved through the `exports` map in `dphelper`'s `package.json`. If your `tsconfig.json` sets `"resolvePackageJsonExports": false`, TypeScript will fall back to physical path resolution and fail with `Cannot find module 'dphelper/<tool>' or its corresponding type declarations` (TS2307), because the tool actually lives under `modules/<tool>` rather than at the package root.
120
+ >
121
+ > To fix it, either:
122
+ > - keep `"resolvePackageJsonExports": true` (the default for `moduleResolution: "bundler"`), or
123
+ > - import from the physical path: `import { sanitize } from "dphelper/modules/sanitize"`.
124
+ >
125
+ > Note: this is a TypeScript-only resolution issue. Vite and other bundlers resolve the subpath correctly at build/runtime via the `exports` map regardless of that flag.
126
+
90
127
  For plain HTML/CDN:
91
128
 
92
129
  ```html
@@ -95,7 +132,7 @@ For plain HTML/CDN:
95
132
  <!-- Optional check -->
96
133
  <script>
97
134
  console.debug(dphelper.version); // latest version
98
- console.debud(dphelper.isBrowser); // true
135
+ console.debug(dphelper.isBrowser); // true
99
136
  </script>
100
137
  ```
101
138
 
@@ -148,33 +185,6 @@ dphelper.i18n.number(1234.56, 'de-DE', { style: 'currency', currency: 'EUR' });
148
185
  // Relative time
149
186
  dphelper.i18n.relativeTime(Date.now() - 3600000); // "1 hour ago"
150
187
  ```
151
-
152
- ---
153
-
154
- ## 🖼️ Image Module
155
-
156
- ```javascript
157
- // Load image
158
- const img = await dphelper.image.load('photo.jpg');
159
-
160
- // Resize
161
- const resized = dphelper.image.resize(img, 100, 100);
162
-
163
- // Crop
164
- const cropped = dphelper.image.crop(img, { x: 0, y: 0, width: 50, height: 50 });
165
-
166
- // Apply filters
167
- const filtered = dphelper.image.filter(img, { brightness: 1.2, sepia: 0.5 });
168
-
169
- // Rotate/Flip
170
- const rotated = dphelper.image.rotate(img, 90);
171
- const flipped = dphelper.image.flip(img, 'horizontal');
172
-
173
- // Grayscale/Blur
174
- const gray = dphelper.image.grayscale(img);
175
- const blurred = dphelper.image.blur(img, 5);
176
- ```
177
-
178
188
  ---
179
189
 
180
190
  ## 🗜️ Compression Module
package/SECURITY.md CHANGED
@@ -1,27 +1,27 @@
1
- # Security Policy
2
-
3
- ## Supported Versions
4
-
5
- | Version | Supported |
6
- | ------- | --------- |
7
- | 3.9.x | ✅ |
8
- | < 3.5 | ❌ |
9
-
10
- ## Security Standards
11
-
12
- - **NIST SP 800-53:** 98% compliance
13
- - **OWASP Top 10:** 100% compliance
14
- - **Socket.dev:** 90%+ target
15
-
16
- ## Reporting a Vulnerability
17
-
18
- Email: architecture@biglogic.ca
19
- Response: Within 24 hours
20
-
21
- ## Security Features
22
-
23
- - PBKDF2 310k iterations (OWASP 2023)
24
- - AES-GCM 256-bit encryption
25
- - TLS 1.2+ enforcement
26
- - WebSocket wss:// only
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------- | --------- |
7
+ | 3.9.x | ✅ |
8
+ | < 3.5 | ❌ |
9
+
10
+ ## Security Standards
11
+
12
+ - **NIST SP 800-53:** 98% compliance
13
+ - **OWASP Top 10:** 100% compliance
14
+ - **Socket.dev:** 90%+ target
15
+
16
+ ## Reporting a Vulnerability
17
+
18
+ Email: architecture@biglogic.ca
19
+ Response: Within 24 hours
20
+
21
+ ## Security Features
22
+
23
+ - PBKDF2 310k iterations (OWASP 2023)
24
+ - AES-GCM 256-bit encryption
25
+ - TLS 1.2+ enforcement
26
+ - WebSocket wss:// only
27
27
  - Input validation on all endpoints