tiny-essentials 1.29.1 → 1.29.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 (128) hide show
  1. package/changelog/1/29/2.md +82 -0
  2. package/dist/v1/TinyBasicsEs.min.js +1 -1
  3. package/dist/v1/TinyEssentials.min.js +1 -1
  4. package/dist/v1/TinyFetchLoader.min.js +1 -0
  5. package/dist/v1/TinyImageLoader.min.js +1 -0
  6. package/dist/v1/TinyMediaCache.min.js +1 -0
  7. package/dist/v1/TinyMediaLoader.min.js +1 -0
  8. package/dist/v1/basics/index.cjs +5 -0
  9. package/dist/v1/basics/index.d.mts +2 -1
  10. package/dist/v1/basics/index.d.mts.map +1 -1
  11. package/dist/v1/basics/index.mjs +2 -1
  12. package/dist/v1/basics/media/youtube.cjs +275 -0
  13. package/dist/v1/basics/media/youtube.d.mts +107 -0
  14. package/dist/v1/basics/media/youtube.d.mts.map +1 -0
  15. package/dist/v1/basics/media/youtube.mjs +214 -0
  16. package/dist/v1/index.cjs +13 -0
  17. package/dist/v1/index.d.mts +6 -1
  18. package/dist/v1/index.d.mts.map +1 -1
  19. package/dist/v1/index.mjs +7 -2
  20. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.cjs +0 -1
  21. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts +0 -1
  22. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts.map +1 -1
  23. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.mjs +0 -1
  24. package/dist/v1/libs/fs/plugins/OPFS/index.cjs +0 -8
  25. package/dist/v1/libs/fs/plugins/OPFS/index.d.mts +0 -8
  26. package/dist/v1/libs/fs/plugins/OPFS/index.d.mts.map +1 -1
  27. package/dist/v1/libs/fs/plugins/OPFS/index.mjs +0 -8
  28. package/dist/v1/libs/html/TinyHtml.cjs +1 -1
  29. package/dist/v1/libs/html/TinyHtml.d.mts +2 -2
  30. package/dist/v1/libs/html/TinyHtml.d.mts.map +1 -1
  31. package/dist/v1/libs/html/TinyHtml.mjs +1 -1
  32. package/dist/v1/libs/html/loader/TinyMediaLoader.cjs +1999 -0
  33. package/dist/v1/libs/html/loader/TinyMediaLoader.d.mts +999 -0
  34. package/dist/v1/libs/html/loader/TinyMediaLoader.d.mts.map +1 -0
  35. package/dist/v1/libs/html/loader/TinyMediaLoader.mjs +1852 -0
  36. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.cjs +77 -0
  37. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.d.mts +103 -0
  38. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.d.mts.map +1 -0
  39. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.mjs +67 -0
  40. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.cjs +630 -0
  41. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.d.mts +138 -0
  42. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.d.mts.map +1 -0
  43. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.mjs +576 -0
  44. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.cjs +70 -0
  45. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.d.mts +100 -0
  46. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.d.mts.map +1 -0
  47. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.mjs +60 -0
  48. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.cjs +946 -0
  49. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.d.mts +67 -0
  50. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.d.mts.map +1 -0
  51. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.mjs +896 -0
  52. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.cjs +225 -0
  53. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.d.mts +149 -0
  54. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.d.mts.map +1 -0
  55. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.mjs +197 -0
  56. package/dist/v1/libs/html/loader/formats/TinyImageLoader.cjs +1454 -0
  57. package/dist/v1/libs/html/loader/formats/TinyImageLoader.d.mts +200 -0
  58. package/dist/v1/libs/html/loader/formats/TinyImageLoader.d.mts.map +1 -0
  59. package/dist/v1/libs/html/loader/formats/TinyImageLoader.mjs +1317 -0
  60. package/dist/v1/libs/html/loader/probe/TinyImageProbe.cjs +668 -0
  61. package/dist/v1/libs/html/loader/probe/TinyImageProbe.d.mts +83 -0
  62. package/dist/v1/libs/html/loader/probe/TinyImageProbe.d.mts.map +1 -0
  63. package/dist/v1/libs/html/loader/probe/TinyImageProbe.mjs +626 -0
  64. package/dist/v1/libs/html/loader/utils/TinyBufferReader.cjs +277 -0
  65. package/dist/v1/libs/html/loader/utils/TinyBufferReader.d.mts +118 -0
  66. package/dist/v1/libs/html/loader/utils/TinyBufferReader.d.mts.map +1 -0
  67. package/dist/v1/libs/html/loader/utils/TinyBufferReader.mjs +247 -0
  68. package/dist/v1/libs/html/loader/utils/TinyIsoBox.cjs +128 -0
  69. package/dist/v1/libs/html/loader/utils/TinyIsoBox.d.mts +49 -0
  70. package/dist/v1/libs/html/loader/utils/TinyIsoBox.d.mts.map +1 -0
  71. package/dist/v1/libs/html/loader/utils/TinyIsoBox.mjs +116 -0
  72. package/dist/v1/libs/html/loader/utils/TinyMediaCache.cjs +796 -0
  73. package/dist/v1/libs/html/loader/utils/TinyMediaCache.d.mts +354 -0
  74. package/dist/v1/libs/html/loader/utils/TinyMediaCache.d.mts.map +1 -0
  75. package/dist/v1/libs/html/loader/utils/TinyMediaCache.mjs +734 -0
  76. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.cjs +302 -0
  77. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.d.mts +256 -0
  78. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.d.mts.map +1 -0
  79. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.mjs +280 -0
  80. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.cjs +194 -0
  81. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.d.mts +138 -0
  82. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.d.mts.map +1 -0
  83. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.mjs +175 -0
  84. package/dist/v1/libs/tools/TinyPkgExportValidator.cjs +359 -55
  85. package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts +64 -6
  86. package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts.map +1 -1
  87. package/dist/v1/libs/tools/TinyPkgExportValidator.mjs +320 -57
  88. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.cjs +0 -1
  89. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts +0 -1
  90. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts.map +1 -1
  91. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.mjs +0 -1
  92. package/dist/v1/webTemplates/bootstrap/5.3/scss/background/_background-grid.scss +15 -0
  93. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/buttons/_buttons-contrast.scss +208 -0
  94. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/buttons/_buttons-ghost.scss +89 -0
  95. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/icon/_cube-icon.scss +65 -0
  96. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/icon/_sphere-pulse.scss +39 -0
  97. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_badges.scss +90 -0
  98. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_bootstrap-overrides.scss +495 -0
  99. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_buttons.scss +390 -0
  100. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_colors.scss +213 -0
  101. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_effects.scss +153 -0
  102. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_forms-tones.scss +69 -0
  103. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_forms.scss +323 -0
  104. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_global.scss +31 -0
  105. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_links.scss +47 -0
  106. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_tables.scss +25 -0
  107. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_theme.scss +21 -0
  108. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_tokens.scss +161 -0
  109. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_utilities.scss +81 -0
  110. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_variables.scss +63 -0
  111. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_form-tone-mixins.scss +236 -0
  112. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_sizing.scss +68 -0
  113. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_tone-mixins.scss +392 -0
  114. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_typography.scss +112 -0
  115. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/background/_tiny_gradient_1.scss +131 -0
  116. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/colors/_pink.scss +47 -0
  117. package/docs/v1/Exports.md +33 -2
  118. package/docs/v1/README.md +9 -0
  119. package/docs/v1/basics/youtube.md +204 -0
  120. package/docs/v1/libs/html/loader/TinyFetchLoader.md +114 -0
  121. package/docs/v1/libs/html/loader/TinyImageLoader.md +141 -0
  122. package/docs/v1/libs/html/loader/TinyMediaCache.md +166 -0
  123. package/docs/v1/libs/html/loader/TinyMediaLoader.md +300 -0
  124. package/docs/v1/libs/tools/TinyPkgExportValidator.md +55 -0
  125. package/docs/v1/webTemplates/bootstrap/5.3/DeepStrap.md +177 -0
  126. package/package.json +244 -8
  127. /package/dist/v1/webTemplates/bootstrap/5.3/scss/input/{Placeholder-Colors-Fix.scss → _placeholder-colors-fix.scss} +0 -0
  128. /package/dist/v1/webTemplates/bootstrap/5.3/scss/spacing/{Spacing-Plus.scss → _spacing-plus.scss} +0 -0
@@ -0,0 +1,175 @@
1
+ /**
2
+ * @fileoverview Tracks byte-level progress for a media download. It is a plain
3
+ * value object: the loader pushes chunks in and reads snapshots out.
4
+ */
5
+ /**
6
+ * A point-in-time snapshot of the download progress. It exposes both the raw
7
+ * byte counters and the derived metrics (rate, ETA and completion percentage)
8
+ * so that consumers can render progress without recalculating anything.
9
+ *
10
+ * @typedef {Object} MediaProgressSnapshot
11
+ * @property {number} loaded - The number of bytes downloaded so far.
12
+ * @property {number} total - The total number of bytes (0 when unknown).
13
+ * @property {number} remaining - The number of bytes left to download.
14
+ * @property {number} percent - The completion percentage between 0 and 100.
15
+ * @property {number} rate - The smoothed download rate in bytes per second.
16
+ * @property {number} elapsed - The elapsed time in milliseconds.
17
+ * @property {number} eta - The estimated time remaining in milliseconds.
18
+ * @property {number} chunks - The number of chunks received so far.
19
+ * @property {number} [width] - The intrinsic width of the media.
20
+ * @property {number} [height] - The intrinsic height of the media.
21
+ */
22
+ /**
23
+ * Accumulates download chunks and derives rate, ETA and percentage.
24
+ */
25
+ class TinyMediaProgress {
26
+ /** @type {number} */
27
+ #total;
28
+ /** @type {number} */
29
+ #loaded = 0;
30
+ /** @type {number} */
31
+ #chunks = 0;
32
+ /** @type {number} */
33
+ #startTime = 0;
34
+ /** @type {number} */
35
+ #lastTime = 0;
36
+ /** @type {number} */
37
+ #lastLoaded = 0;
38
+ /** @type {number} */
39
+ #rate = 0;
40
+ /**
41
+ * Initializes a new progress tracker.
42
+ * @param {number} [total] - The total number of bytes (0 when unknown).
43
+ * @throws {RangeError} If `total` is not a positive number.
44
+ */
45
+ constructor(total = 0) {
46
+ if (typeof total !== 'number' || Number.isNaN(total) || total < 0) {
47
+ throw new RangeError('The "total" argument must be a positive number.');
48
+ }
49
+ this.#total = total;
50
+ }
51
+ /**
52
+ * The total number of bytes (0 when unknown).
53
+ * @returns {number}
54
+ */
55
+ get total() {
56
+ return this.#total;
57
+ }
58
+ /**
59
+ * Updates the total size of the media being loaded.
60
+ * @param {number} value - The new total in bytes.
61
+ * @throws {RangeError} If `value` is not a positive number.
62
+ */
63
+ set total(value) {
64
+ if (typeof value !== 'number' || Number.isNaN(value) || value < 0) {
65
+ throw new RangeError('The "total" value must be a positive number.');
66
+ }
67
+ this.#total = value;
68
+ }
69
+ /**
70
+ * @returns {number} The number of bytes downloaded so far.
71
+ */
72
+ get loaded() {
73
+ return this.#loaded;
74
+ }
75
+ /**
76
+ * @returns {number} The number of bytes left to download.
77
+ */
78
+ get remaining() {
79
+ return this.#total > 0 ? Math.max(0, this.#total - this.#loaded) : 0;
80
+ }
81
+ /**
82
+ * @returns {number} The completion percentage between 0 and 100.
83
+ */
84
+ get percent() {
85
+ return this.#total > 0 ? Math.min(100, (this.#loaded / this.#total) * 100) : 0;
86
+ }
87
+ /**
88
+ * @returns {number} The smoothed download rate in bytes per second.
89
+ */
90
+ get rate() {
91
+ return this.#rate;
92
+ }
93
+ /**
94
+ * @returns {number} The number of chunks received so far.
95
+ */
96
+ get chunks() {
97
+ return this.#chunks;
98
+ }
99
+ /**
100
+ * @returns {number} The elapsed time in milliseconds.
101
+ */
102
+ get elapsed() {
103
+ return this.#startTime === 0 ? 0 : performance.now() - this.#startTime;
104
+ }
105
+ /**
106
+ * @returns {number} The estimated time remaining in milliseconds.
107
+ */
108
+ get eta() {
109
+ if (this.#rate <= 0 || this.#total <= 0) {
110
+ return 0;
111
+ }
112
+ return (this.remaining / this.#rate) * 1000;
113
+ }
114
+ /**
115
+ * Marks the start of the download.
116
+ * @returns {TinyMediaProgress} The current instance for chaining.
117
+ */
118
+ start() {
119
+ this.#startTime = performance.now();
120
+ this.#lastTime = this.#startTime;
121
+ return this;
122
+ }
123
+ /**
124
+ * Registers a new chunk and updates the smoothed rate.
125
+ * @param {number} bytes - The size of the chunk in bytes.
126
+ * @returns {TinyMediaProgress} The current instance for chaining.
127
+ * @throws {RangeError} If `bytes` is not a positive number.
128
+ */
129
+ push(bytes) {
130
+ if (typeof bytes !== 'number' || Number.isNaN(bytes) || bytes < 0) {
131
+ throw new RangeError('The "bytes" argument must be a positive number.');
132
+ }
133
+ const now = performance.now();
134
+ this.#loaded += bytes;
135
+ this.#chunks += 1;
136
+ const deltaTime = now - this.#lastTime;
137
+ if (deltaTime > 0) {
138
+ const instantRate = ((this.#loaded - this.#lastLoaded) / deltaTime) * 1000;
139
+ this.#rate = this.#rate === 0 ? instantRate : this.#rate * 0.7 + instantRate * 0.3;
140
+ }
141
+ this.#lastTime = now;
142
+ this.#lastLoaded = this.#loaded;
143
+ return this;
144
+ }
145
+ /**
146
+ * Resets every counter so the instance can be reused.
147
+ * @returns {TinyMediaProgress} The current instance for chaining.
148
+ */
149
+ reset() {
150
+ this.#loaded = 0;
151
+ this.#chunks = 0;
152
+ this.#rate = 0;
153
+ this.#lastLoaded = 0;
154
+ this.#startTime = 0;
155
+ this.#lastTime = 0;
156
+ return this;
157
+ }
158
+ /**
159
+ * Returns a read-only snapshot of the current progress and derived metrics.
160
+ * @returns {MediaProgressSnapshot} An immutable snapshot of the current state.
161
+ */
162
+ snapshot() {
163
+ return {
164
+ loaded: this.#loaded,
165
+ total: this.#total,
166
+ remaining: this.remaining,
167
+ percent: this.percent,
168
+ rate: this.#rate,
169
+ elapsed: this.elapsed,
170
+ eta: this.eta,
171
+ chunks: this.#chunks,
172
+ };
173
+ }
174
+ }
175
+ export default TinyMediaProgress;