tiny-essentials 1.11.0 โ†’ 1.12.0

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 (72) hide show
  1. package/README.md +12 -3
  2. package/dist/node_modules/firebase-functions/lib/common/trace.cjs +82 -0
  3. package/dist/node_modules/firebase-functions/lib/logger/common.cjs +57 -0
  4. package/dist/node_modules/firebase-functions/lib/logger/index.cjs +158 -0
  5. package/dist/v1/TinyBasicsEs.js +1653 -1
  6. package/dist/v1/TinyBasicsEs.min.js +1 -1
  7. package/dist/v1/TinyDragDropDetector.js +307 -0
  8. package/dist/v1/TinyDragDropDetector.min.js +1 -0
  9. package/dist/v1/TinyDragger.js +3563 -0
  10. package/dist/v1/TinyDragger.min.js +2 -0
  11. package/dist/v1/TinyDragger.min.js.LICENSE.txt +8 -0
  12. package/dist/v1/TinyEssentials.js +2783 -2
  13. package/dist/v1/TinyEssentials.min.js +1 -1
  14. package/dist/v1/TinyNotifyCenter.js +32 -0
  15. package/dist/v1/TinyNotifyCenter.min.js +1 -1
  16. package/dist/v1/TinyToastNotify.js +24 -0
  17. package/dist/v1/TinyToastNotify.min.js +1 -1
  18. package/dist/v1/TinyUploadClicker.js +5235 -0
  19. package/dist/v1/TinyUploadClicker.min.js +2 -0
  20. package/dist/v1/TinyUploadClicker.min.js.LICENSE.txt +8 -0
  21. package/dist/v1/basics/fileManager.cjs +524 -0
  22. package/dist/v1/basics/fileManager.d.mts +209 -0
  23. package/dist/v1/basics/fileManager.mjs +443 -0
  24. package/dist/v1/basics/fullScreen.cjs +134 -0
  25. package/dist/v1/basics/fullScreen.d.mts +8 -0
  26. package/dist/v1/basics/fullScreen.mjs +121 -0
  27. package/dist/v1/basics/html.cjs +262 -0
  28. package/dist/v1/basics/html.d.mts +63 -0
  29. package/dist/v1/basics/html.mjs +208 -0
  30. package/dist/v1/basics/index.cjs +40 -0
  31. package/dist/v1/basics/index.d.mts +38 -1
  32. package/dist/v1/basics/index.mjs +4 -1
  33. package/dist/v1/build/TinyDragDropDetector.cjs +7 -0
  34. package/dist/v1/build/TinyDragDropDetector.d.mts +3 -0
  35. package/dist/v1/build/TinyDragDropDetector.mjs +2 -0
  36. package/dist/v1/build/TinyDragger.cjs +7 -0
  37. package/dist/v1/build/TinyDragger.d.mts +3 -0
  38. package/dist/v1/build/TinyDragger.mjs +2 -0
  39. package/dist/v1/build/TinyUploadClicker.cjs +7 -0
  40. package/dist/v1/build/TinyUploadClicker.d.mts +3 -0
  41. package/dist/v1/build/TinyUploadClicker.mjs +2 -0
  42. package/dist/v1/css/TinyDraggerExample.css +21 -0
  43. package/dist/v1/css/TinyDraggerExample.min.css +1 -0
  44. package/dist/v1/index.cjs +44 -0
  45. package/dist/v1/index.d.mts +40 -1
  46. package/dist/v1/index.mjs +6 -1
  47. package/dist/v1/libs/TinyDragDropDetector.cjs +268 -0
  48. package/dist/v1/libs/TinyDragDropDetector.d.mts +123 -0
  49. package/dist/v1/libs/TinyDragDropDetector.mjs +228 -0
  50. package/dist/v1/libs/TinyDragger.cjs +801 -0
  51. package/dist/v1/libs/TinyDragger.d.mts +300 -0
  52. package/dist/v1/libs/TinyDragger.mjs +689 -0
  53. package/dist/v1/libs/TinyNotifyCenter.cjs +32 -0
  54. package/dist/v1/libs/TinyNotifyCenter.d.mts +9 -0
  55. package/dist/v1/libs/TinyNotifyCenter.mjs +28 -0
  56. package/dist/v1/libs/TinyToastNotify.cjs +24 -0
  57. package/dist/v1/libs/TinyToastNotify.d.mts +8 -0
  58. package/dist/v1/libs/TinyToastNotify.mjs +20 -0
  59. package/dist/v1/libs/TinyUploadClicker.cjs +223 -0
  60. package/dist/v1/libs/TinyUploadClicker.d.mts +80 -0
  61. package/dist/v1/libs/TinyUploadClicker.mjs +182 -0
  62. package/docs/v1/README.md +8 -2
  63. package/docs/v1/basics/fileManager.md +222 -0
  64. package/docs/v1/basics/fullScreen.md +183 -0
  65. package/docs/v1/basics/html.md +243 -0
  66. package/docs/v1/libs/TinyDragDropDetector.md +143 -0
  67. package/docs/v1/libs/TinyDragger.md +415 -0
  68. package/docs/v1/libs/TinyLevelUp.md +1 -1
  69. package/docs/v1/libs/TinyNotifyCenter.md +20 -0
  70. package/docs/v1/libs/TinyToastNotify.md +19 -0
  71. package/docs/v1/libs/TinyUploadClicker.md +108 -0
  72. package/package.json +12 -2
@@ -0,0 +1,108 @@
1
+ # ๐Ÿ“ฆ TinyUploadClicker
2
+
3
+ A tiny but good JavaScript utility that lets you bind any clickable element (buttons, icons, divs, etc.) to trigger a hidden `<input type="file">`. This allows full control over file upload behavior, visual customization, and events โ€” without ever showing the native file input element.
4
+
5
+ ---
6
+
7
+ ## ๐Ÿš€ Features
8
+
9
+ * ๐ŸŽฏ **Use any HTML element** as a file input trigger
10
+ * ๐ŸŽจ **Custom attributes and styles** for the input element
11
+ * ๐Ÿ” **Multiple file selection** support
12
+ * ๐Ÿง  **Strong runtime validations** with helpful errors
13
+ * ๐Ÿช **Lifecycle hooks** for click and file selection
14
+ * ๐Ÿงน **Clean `destroy()` method** to remove everything
15
+ * ๐Ÿ” **No dependencies**, pure JS
16
+
17
+ ---
18
+
19
+ ## โœจ Example
20
+
21
+ ```js
22
+ const uploader = new TinyUploadClicker({
23
+ triggers: '#uploadBtn',
24
+ accept: ['.png', '.jpg'],
25
+ multiple: true,
26
+ inputAttributes: { 'data-role': 'upload' },
27
+ inputStyles: { display: 'none' },
28
+ onClick: (el) => console.log('Trigger clicked:', el),
29
+ onFileLoad: (files, el) => console.log('Files selected:', files)
30
+ });
31
+
32
+ // Later, cleanup:
33
+ uploader.destroy();
34
+ ```
35
+
36
+ ---
37
+
38
+ ## ๐Ÿงฑ Constructor
39
+
40
+ ### `new TinyUploadClicker(options)`
41
+
42
+ Creates a new instance of the upload click manager.
43
+
44
+ #### ๐Ÿ” Throws
45
+
46
+ * `TypeError` if any part of the config is invalid
47
+ * `Error` if a trigger selector resolves to no element
48
+
49
+ #### ๐Ÿ’ก Parameters
50
+
51
+ | Name | Type | Required | Description |
52
+ | --------- | ----------------------------------------- | -------- | ------------------------------------------- |
53
+ | `options` | [`UploaderConfig`](#-uploaderconfig-type) | โœ… Yes | Configuration object for the upload clicker |
54
+
55
+ ---
56
+
57
+ ## ๐Ÿงฉ `UploaderConfig` Type
58
+
59
+ ```ts
60
+ type UploaderConfig = {
61
+ triggers: string | HTMLElement | Array<string | HTMLElement>,
62
+ multiple?: boolean,
63
+ accept?: string | string[],
64
+ inputAttributes?: Record<string, string>,
65
+ inputStyles?: Partial<CSSStyleDeclaration>,
66
+ onClick?: ((triggerElement: HTMLElement) => void) | null,
67
+ onFileLoad?: ((files: FileList, triggerElement: HTMLElement) => void) | null
68
+ }
69
+ ```
70
+
71
+ | Property | Type | Default | Description |
72
+ | ----------------- | ------------------------------------------------------- | --------------------- | --------------------------------------------------------------------- |
73
+ | `triggers` | `string \| HTMLElement \| Array<string \| HTMLElement>` | โ€” | Elements (or selectors) that will trigger file selection when clicked |
74
+ | `multiple` | `boolean` | `false` | Whether multiple files can be selected |
75
+ | `accept` | `string \| string[]` | `""` | Accepted file types (e.g., `".png"` or `"image/*"`) |
76
+ | `inputAttributes` | `Record<string, string>` | `{}` | Extra attributes to apply to the `<input type="file">` |
77
+ | `inputStyles` | `Partial<CSSStyleDeclaration>` | `{ display: 'none' }` | Custom inline styles for the hidden input |
78
+ | `onClick` | `(HTMLElement) => void \| null` | `null` | Hook triggered when a trigger is clicked (before file dialog opens) |
79
+ | `onFileLoad` | `(FileList, HTMLElement) => void \| null` | `null` | Hook triggered after files are selected |
80
+
81
+ ---
82
+
83
+ ## ๐Ÿ”ง Methods
84
+
85
+ ### `destroy(): void`
86
+
87
+ Destroys all internal listeners and DOM elements created by the instance.
88
+ Cleans up memory and detaches everything from the DOM.
89
+
90
+ ---
91
+
92
+ ## ๐Ÿ›ก๏ธ Runtime Validations
93
+
94
+ The constructor performs strict type validation and helpful error reporting:
95
+
96
+ * โŒ Missing or invalid `triggers` throws immediately.
97
+ * โŒ Selectors that resolve to `null` will throw.
98
+ * โŒ Invalid types for `accept`, `onClick`, `onFileLoad`, `inputStyles`, and `inputAttributes` are rejected.
99
+ * โœ… Supports string or array for `accept`.
100
+
101
+ ---
102
+
103
+ ## ๐Ÿ› ๏ธ Internal Design
104
+
105
+ * Each trigger gets its own file input.
106
+ * Inputs are stored in a `WeakMap<HTMLElement, HTMLInputElement>`.
107
+ * After a file is selected, the input is reset so the same file can be selected again.
108
+ * All inputs are appended to `document.body` and styled invisibly by default.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-essentials",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.",
5
5
  "scripts": {
6
6
  "test": "npm run test:mjs && npm run test:cjs && npm run test:js",
@@ -12,6 +12,7 @@
12
12
  "test:mjs:jsoncolor": "node test/index.mjs colorStringify",
13
13
  "test:mjs:ratelimit": "node test/index.mjs rateLimit",
14
14
  "test:mjs:levelup": "node test/index.mjs levelUp",
15
+ "test:mjs:filemanager": "node test/index.mjs fileManager",
15
16
  "fix:prettier": "npm run fix:prettier:src && npm run fix:prettier:test && npm run fix:prettier:rollup.config && npm run fix:prettier:webpack.config",
16
17
  "fix:prettier:src": "prettier --write ./src/*",
17
18
  "fix:prettier:test": "prettier --write ./test/*",
@@ -22,7 +23,8 @@
22
23
  "build:js": "tsc -p tsconfig.json && rollup -c && webpack --mode production",
23
24
  "build-clean": "npm run clean && npm run build",
24
25
  "build-dist": "npm run build",
25
- "build:css": "npm run build:css:aimaker && npm run build:css:tinynotify",
26
+ "build:css": "npm run build:css:aimaker && npm run build:css:tinynotify && npm run build:css:tinydragger:example",
27
+ "build:css:tinydragger:example": "sass src/v1/scss/TinyDraggerExample.scss dist/v1/css/TinyDraggerExample.css --no-source-map && sass src/v1/scss/TinyDraggerExample.scss dist/v1/css/TinyDraggerExample.min.css --no-source-map --style=compressed",
26
28
  "build:css:aimaker": "sass src/v1/scss/aiMarker.scss dist/v1/css/aiMarker.css --no-source-map && sass src/v1/scss/aiMarker.scss dist/v1/css/aiMarker.min.css --no-source-map --style=compressed",
27
29
  "build:css:tinynotify": "sass src/v1/scss/TinyNotify.scss dist/v1/css/TinyNotify.css --no-source-map && sass src/v1/scss/TinyNotify.scss dist/v1/css/TinyNotify.min.css --no-source-map --style=compressed",
28
30
  "clean": "rm -rf dist",
@@ -36,6 +38,14 @@
36
38
  ".": {
37
39
  "require": "./dist/v1/index.cjs",
38
40
  "import": "./dist/v1/index.mjs"
41
+ },
42
+ "./libs": {
43
+ "require": "./dist/v1/libs/index.cjs",
44
+ "import": "./dist/v1/libs/index.mjs"
45
+ },
46
+ "./basics": {
47
+ "require": "./dist/v1/basics/index.cjs",
48
+ "import": "./dist/v1/basics/index.mjs"
39
49
  }
40
50
  },
41
51
  "repository": {