tiny-essentials 1.20.2 → 1.21.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 (123) hide show
  1. package/README.md +13 -11
  2. package/dist/_/numbers.cjs +136 -0
  3. package/dist/_/numbers.d.mts +24 -0
  4. package/dist/_/numbers.mjs +102 -0
  5. package/dist/v1/TinyAdvancedRaffle.min.js +1 -0
  6. package/dist/v1/TinyArrayPaginator.min.js +1 -0
  7. package/dist/v1/TinyBasicsEs.min.js +1 -1
  8. package/dist/v1/TinyCookieConsent.min.js +1 -0
  9. package/dist/v1/TinyDayNightCycle.min.js +1 -0
  10. package/dist/v1/TinyEssentials.min.js +1 -1
  11. package/dist/v1/TinyGamepad.min.js +1 -0
  12. package/dist/v1/TinyI18.min.js +1 -0
  13. package/dist/v1/TinyInventory.min.js +1 -0
  14. package/dist/v1/TinyInventoryTrader.min.js +1 -0
  15. package/dist/v1/TinyLocalStorage.min.js +1 -1
  16. package/dist/v1/TinyRateLimiter.min.js +1 -1
  17. package/dist/v1/TinySmartScroller.min.js +1 -1
  18. package/dist/v1/TinyTextarea.min.js +1 -0
  19. package/dist/v1/TinyToastNotify.min.js +1 -1
  20. package/dist/v1/TinyUploadClicker.min.js +1 -1
  21. package/dist/v1/basics/array.cjs +21 -0
  22. package/dist/v1/basics/array.d.mts +8 -0
  23. package/dist/v1/basics/array.mjs +18 -0
  24. package/dist/v1/basics/index.cjs +2 -8
  25. package/dist/v1/basics/index.d.mts +3 -8
  26. package/dist/v1/basics/index.mjs +2 -3
  27. package/dist/v1/basics/simpleMath.cjs +46 -0
  28. package/dist/v1/basics/simpleMath.d.mts +27 -0
  29. package/dist/v1/basics/simpleMath.mjs +42 -0
  30. package/dist/v1/build/TinyAdvancedRaffle.cjs +7 -0
  31. package/dist/v1/build/TinyAdvancedRaffle.d.mts +3 -0
  32. package/dist/v1/build/TinyAdvancedRaffle.mjs +2 -0
  33. package/dist/v1/build/TinyArrayPaginator.cjs +7 -0
  34. package/dist/v1/build/TinyArrayPaginator.d.mts +3 -0
  35. package/dist/v1/build/TinyArrayPaginator.mjs +2 -0
  36. package/dist/v1/build/TinyCookieConsent.cjs +7 -0
  37. package/dist/v1/build/TinyCookieConsent.d.mts +3 -0
  38. package/dist/v1/build/TinyCookieConsent.mjs +2 -0
  39. package/dist/v1/build/TinyDayNightCycle.cjs +7 -0
  40. package/dist/v1/build/TinyDayNightCycle.d.mts +3 -0
  41. package/dist/v1/build/TinyDayNightCycle.mjs +2 -0
  42. package/dist/v1/build/TinyGamepad.cjs +7 -0
  43. package/dist/v1/build/TinyGamepad.d.mts +3 -0
  44. package/dist/v1/build/TinyGamepad.mjs +2 -0
  45. package/dist/v1/build/TinyI18.cjs +7 -0
  46. package/dist/v1/build/TinyI18.d.mts +3 -0
  47. package/dist/v1/build/TinyI18.mjs +2 -0
  48. package/dist/v1/build/TinyInventory.cjs +7 -0
  49. package/dist/v1/build/TinyInventory.d.mts +3 -0
  50. package/dist/v1/build/TinyInventory.mjs +2 -0
  51. package/dist/v1/build/TinyInventoryTrader.cjs +7 -0
  52. package/dist/v1/build/TinyInventoryTrader.d.mts +3 -0
  53. package/dist/v1/build/TinyInventoryTrader.mjs +2 -0
  54. package/dist/v1/build/TinyTextarea.cjs +7 -0
  55. package/dist/v1/build/TinyTextarea.d.mts +3 -0
  56. package/dist/v1/build/TinyTextarea.mjs +2 -0
  57. package/dist/v1/css/TinyCookieConsent.min.css +1 -0
  58. package/dist/v1/index.cjs +20 -8
  59. package/dist/v1/index.d.mts +12 -8
  60. package/dist/v1/index.mjs +11 -3
  61. package/dist/v1/libs/TinyAdvancedRaffle.cjs +1654 -0
  62. package/dist/v1/libs/TinyAdvancedRaffle.d.mts +851 -0
  63. package/dist/v1/libs/TinyAdvancedRaffle.mjs +1477 -0
  64. package/dist/v1/libs/TinyArrayPaginator.cjs +132 -0
  65. package/dist/v1/libs/TinyArrayPaginator.d.mts +78 -0
  66. package/dist/v1/libs/TinyArrayPaginator.mjs +119 -0
  67. package/dist/v1/libs/TinyCookieConsent.cjs +278 -0
  68. package/dist/v1/libs/TinyCookieConsent.d.mts +142 -0
  69. package/dist/v1/libs/TinyCookieConsent.mjs +248 -0
  70. package/dist/v1/libs/TinyDayNightCycle.cjs +1389 -0
  71. package/dist/v1/libs/TinyDayNightCycle.d.mts +673 -0
  72. package/dist/v1/libs/TinyDayNightCycle.mjs +1232 -0
  73. package/dist/v1/libs/TinyGamepad.cjs +2690 -0
  74. package/dist/v1/libs/TinyGamepad.d.mts +1286 -0
  75. package/dist/v1/libs/TinyGamepad.mjs +2386 -0
  76. package/dist/v1/libs/TinyHtml.d.mts +2 -2
  77. package/dist/v1/libs/TinyI18.cjs +946 -0
  78. package/dist/v1/libs/TinyI18.d.mts +418 -0
  79. package/dist/v1/libs/TinyI18.mjs +873 -0
  80. package/dist/v1/libs/TinyInventory.cjs +1788 -0
  81. package/dist/v1/libs/TinyInventory.d.mts +871 -0
  82. package/dist/v1/libs/TinyInventory.mjs +1650 -0
  83. package/dist/v1/libs/TinyInventoryTrader.cjs +242 -0
  84. package/dist/v1/libs/TinyInventoryTrader.d.mts +95 -0
  85. package/dist/v1/libs/TinyInventoryTrader.mjs +212 -0
  86. package/dist/v1/libs/TinyLocalStorage.cjs +14 -1
  87. package/dist/v1/libs/TinyLocalStorage.mjs +8 -1
  88. package/dist/v1/libs/TinyRateLimiter.cjs +0 -13
  89. package/dist/v1/libs/TinyRateLimiter.d.mts +0 -8
  90. package/dist/v1/libs/TinyRateLimiter.mjs +0 -12
  91. package/dist/v1/libs/TinySmartScroller.cjs +51 -15
  92. package/dist/v1/libs/TinySmartScroller.d.mts +28 -12
  93. package/dist/v1/libs/TinySmartScroller.mjs +44 -14
  94. package/dist/v1/libs/TinyTextarea.cjs +230 -0
  95. package/dist/v1/libs/TinyTextarea.d.mts +128 -0
  96. package/dist/v1/libs/TinyTextarea.mjs +198 -0
  97. package/dist/v1/libs/TinyToastNotify.cjs +2 -2
  98. package/dist/v1/libs/TinyToastNotify.mjs +2 -2
  99. package/dist/v1/libs/TinyUploadClicker.cjs +1 -1
  100. package/docs/v1/Ai-Tips.md +51 -0
  101. package/docs/v1/Personal-Ai-Prompts(portuguese).md +134 -0
  102. package/docs/v1/Personal-Ai-Prompts.md +113 -0
  103. package/docs/v1/README.md +24 -0
  104. package/docs/v1/basics/array.md +17 -0
  105. package/docs/v1/basics/simpleMath.md +73 -0
  106. package/docs/v1/libs/TinyAdvancedRaffle.md +674 -0
  107. package/docs/v1/libs/TinyArrayPaginator.md +150 -0
  108. package/docs/v1/libs/TinyCookieConsent.md +152 -0
  109. package/docs/v1/libs/TinyDayNightCycle.md +711 -0
  110. package/docs/v1/libs/TinyGamepad.md +980 -0
  111. package/docs/v1/libs/TinyI18.md +515 -0
  112. package/docs/v1/libs/TinyInventory.md +777 -0
  113. package/docs/v1/libs/TinyInventoryTrader.md +114 -0
  114. package/docs/v1/libs/TinySmartScroller.md +4 -4
  115. package/docs/v1/libs/TinyTextarea.md +156 -0
  116. package/package.json +7 -5
  117. package/dist/v1/basics/html_deprecated.cjs +0 -124
  118. package/dist/v1/basics/html_deprecated.d.mts +0 -40
  119. package/dist/v1/basics/html_deprecated.mjs +0 -97
  120. package/dist/v1/css/TinyDraggerExample.css +0 -21
  121. package/dist/v1/css/TinyNotify.css +0 -350
  122. package/dist/v1/css/aiMarker.css +0 -4
  123. package/docs/v1/basics/html_deprecated.md +0 -127
@@ -0,0 +1,198 @@
1
+ /**
2
+ * @typedef {Object} OnInputInfo
3
+ * @property {number} breakLines - Total number of `\n` line breaks in the textarea value.
4
+ * @property {number} height - Final calculated height (in pixels) applied to the textarea.
5
+ * @property {number} scrollHeight - Internal scrollHeight before limiting.
6
+ * @property {number} maxHeight - Maximum allowed height before scrolling is forced.
7
+ * @property {number} lineHeight - Height of one line of text, computed from CSS.
8
+ * @property {number} maxRows - Maximum number of visible rows allowed.
9
+ * @property {number} rows - Effective number of visual rows being used.
10
+ */
11
+ /**
12
+ * A lightweight utility class that automatically adjusts the height of a `<textarea>`
13
+ * element based on its content. It prevents scrollbars by expanding vertically as needed,
14
+ * up to a configurable maximum number of visible rows.
15
+ *
16
+ * Features:
17
+ * - Automatically resizes the textarea as the user types
18
+ * - Prevents vertical scrollbars until a maximum row limit is reached
19
+ * - Supports additional height padding
20
+ * - Provides real-time callbacks for input and resize events
21
+ * - Allows manual refresh and cleanup of behavior
22
+ *
23
+ * Ideal for chat inputs, note editors, or any form where dynamic space usage
24
+ * is preferred without relying on scrollbars too early.
25
+ *
26
+ * @class
27
+ * @beta
28
+ */
29
+ class TinyTextarea {
30
+ #lineHeight;
31
+ #maxRows;
32
+ #extraHeight;
33
+ #lastKnownHeight = 0;
34
+ #lastKnownRows = 0;
35
+ /** @type {HTMLTextAreaElement} */
36
+ #textarea;
37
+ /**
38
+ * @type {((info: OnInputInfo) => void) | null}
39
+ */
40
+ #onResize = null;
41
+ /**
42
+ * @type {((info: OnInputInfo) => void) | null}
43
+ */
44
+ #onInput = null;
45
+ /**
46
+ * Returns the computed line height in pixels.
47
+ * @returns {number}
48
+ */
49
+ get lineHeight() {
50
+ return this.#lineHeight;
51
+ }
52
+ /**
53
+ * Returns the maximum number of rows allowed.
54
+ * @returns {number}
55
+ */
56
+ get maxRows() {
57
+ return this.#maxRows - 1;
58
+ }
59
+ /**
60
+ * Returns the additional height added to the textarea.
61
+ * @returns {number}
62
+ */
63
+ get extraHeight() {
64
+ return this.#extraHeight;
65
+ }
66
+ /**
67
+ * Returns the most recently applied height.
68
+ * @returns {number}
69
+ */
70
+ get currentHeight() {
71
+ return this.#lastKnownHeight;
72
+ }
73
+ /**
74
+ * Returns the most recently calculated row count.
75
+ * @returns {number}
76
+ */
77
+ get currentRows() {
78
+ return this.#lastKnownRows;
79
+ }
80
+ /**
81
+ * Returns the original textarea element managed by this instance.
82
+ * @returns {HTMLTextAreaElement}
83
+ */
84
+ get textarea() {
85
+ return this.#textarea;
86
+ }
87
+ /**
88
+ * Creates a new TinyTextarea instance.
89
+ *
90
+ * @param {HTMLTextAreaElement} textarea - The `<textarea>` element to enhance.
91
+ * @param {Object} [options={}] - Optional configuration parameters.
92
+ * @param {number} [options.maxRows] - Maximum number of visible rows before scrolling.
93
+ * @param {number} [options.extraHeight] - Additional pixels to add to final height.
94
+ * @param {(info: OnInputInfo) => void} [options.onResize] - Callback when the number of rows changes.
95
+ * @param {(info: OnInputInfo) => void} [options.onInput] - Callback on every input event.
96
+ * @throws {Error} If `textarea` is not a valid `<textarea>` element.
97
+ * @throws {TypeError} If provided options are of invalid types.
98
+ */
99
+ constructor(textarea, options = {}) {
100
+ if (!(textarea instanceof HTMLTextAreaElement))
101
+ throw new Error('TinyTextarea: Provided element is not a <textarea>.');
102
+ if (typeof options !== 'object' || options === null)
103
+ throw new TypeError('TinyTextarea: Options must be an object if provided.');
104
+ if ('maxRows' in options && typeof options.maxRows !== 'number')
105
+ throw new TypeError('TinyTextarea: `maxRows` must be a number.');
106
+ if ('extraHeight' in options && typeof options.extraHeight !== 'number')
107
+ throw new TypeError('TinyTextarea: `extraHeight` must be a number.');
108
+ if ('onResize' in options && typeof options.onResize !== 'function')
109
+ throw new TypeError('TinyTextarea: `onResize` must be a function.');
110
+ if ('onInput' in options && typeof options.onInput !== 'function')
111
+ throw new TypeError('TinyTextarea: `onInput` must be a function.');
112
+ this.#textarea = textarea;
113
+ this.#maxRows = (options.maxRows ?? 5) + 1;
114
+ this.#extraHeight = options.extraHeight ?? 0;
115
+ this.#onResize = options.onResize ?? null;
116
+ this.#onInput = options.onInput ?? null;
117
+ this.#lineHeight = this.#getLineHeight();
118
+ textarea.style.overflowY = 'hidden';
119
+ textarea.style.resize = 'none';
120
+ this._handleInput = () => this.#resize();
121
+ textarea.addEventListener('input', this._handleInput);
122
+ this.#resize();
123
+ }
124
+ /**
125
+ * Automatically resize the textarea based on its content and notify listeners.
126
+ * Triggers `onResize` if the number of rows has changed.
127
+ * Always triggers `onInput`.
128
+ */
129
+ #resize() {
130
+ this.#textarea.style.height = 'auto';
131
+ const style = window.getComputedStyle(this.#textarea);
132
+ const paddingTop = parseFloat(style.paddingTop) || 0;
133
+ const paddingBottom = parseFloat(style.paddingBottom) || 0;
134
+ const breakLines = (this.#textarea.value.match(/\n/g) || []).length;
135
+ const scrollHeight = this.#textarea.scrollHeight;
136
+ const maxHeight = this.#lineHeight * this.#maxRows;
137
+ const newHeight = Math.ceil(Math.min(scrollHeight, maxHeight) - paddingTop - paddingBottom + this.#extraHeight);
138
+ // const rows = Math.round(newHeight / this.#lineHeight);
139
+ const maxRows = this.#maxRows - 1;
140
+ const rows = breakLines < maxRows ? breakLines + 1 : maxRows;
141
+ this.#textarea.style.height = `${newHeight}px`;
142
+ this.#textarea.style.overflowY = scrollHeight > maxHeight ? 'auto' : 'hidden';
143
+ this.#lastKnownHeight = newHeight;
144
+ const info = {
145
+ breakLines,
146
+ rows,
147
+ height: newHeight,
148
+ scrollHeight,
149
+ maxHeight,
150
+ lineHeight: this.#lineHeight,
151
+ maxRows,
152
+ };
153
+ if (rows !== this.#lastKnownRows) {
154
+ this.#lastKnownRows = rows;
155
+ if (typeof this.#onResize === 'function') {
156
+ this.#onResize({ ...info });
157
+ }
158
+ }
159
+ if (typeof this.#onInput === 'function') {
160
+ this.#onInput(info);
161
+ }
162
+ }
163
+ /**
164
+ * Computes the current line height from the textarea's computed styles.
165
+ * Falls back to `fontSize * 1.2` if lineHeight is not a number.
166
+ * @returns {number} - The computed line height in pixels.
167
+ */
168
+ #getLineHeight() {
169
+ const style = window.getComputedStyle(this.#textarea);
170
+ const line = parseFloat(style.lineHeight);
171
+ if (!Number.isNaN(line))
172
+ return line;
173
+ return parseFloat(style.fontSize) * 1.2;
174
+ }
175
+ /**
176
+ * Returns the latest height and row count of the textarea.
177
+ * @returns {{ height: number, rows: number }} - Last known resize state.
178
+ */
179
+ getData() {
180
+ return {
181
+ rows: this.#lastKnownRows,
182
+ height: this.#lastKnownHeight,
183
+ };
184
+ }
185
+ /**
186
+ * Manually trigger a resize check.
187
+ */
188
+ refresh() {
189
+ this.#resize();
190
+ }
191
+ /**
192
+ * Cleans up internal listeners and disables dynamic behavior.
193
+ */
194
+ destroy() {
195
+ this.#textarea.removeEventListener('input', this._handleInput);
196
+ }
197
+ }
198
+ export default TinyTextarea;
@@ -305,10 +305,10 @@ class TinyToastNotify {
305
305
 
306
306
  // Optional hover effect
307
307
  closeBtn.addEventListener('mouseenter', () => {
308
- closeBtn.style.color = 'var(--notif-close-color-hover)';
308
+ closeBtn.style.color = 'var(--notify-close-color-hover)';
309
309
  });
310
310
  closeBtn.addEventListener('mouseleave', () => {
311
- closeBtn.style.color = 'var(--notif-close-color)';
311
+ closeBtn.style.color = 'var(--notify-close-color)';
312
312
  });
313
313
 
314
314
  // Avatar
@@ -266,10 +266,10 @@ class TinyToastNotify {
266
266
  closeBtn.setAttribute('aria-label', 'Close');
267
267
  // Optional hover effect
268
268
  closeBtn.addEventListener('mouseenter', () => {
269
- closeBtn.style.color = 'var(--notif-close-color-hover)';
269
+ closeBtn.style.color = 'var(--notify-close-color-hover)';
270
270
  });
271
271
  closeBtn.addEventListener('mouseleave', () => {
272
- closeBtn.style.color = 'var(--notif-close-color)';
272
+ closeBtn.style.color = 'var(--notify-close-color)';
273
273
  });
274
274
  // Avatar
275
275
  if (avatarUrl) {
@@ -2,10 +2,10 @@
2
2
 
3
3
  require('../basics/objFilter.cjs');
4
4
  var objChecker = require('../basics/objChecker.cjs');
5
- require('./TinyHtml.cjs');
6
5
  require('fs');
7
6
  require('path');
8
7
  require('fs/promises');
8
+ require('./TinyHtml.cjs');
9
9
  require('./TinyLocalStorage.cjs');
10
10
 
11
11
  /**
@@ -0,0 +1,51 @@
1
+ ## 🧭 How I Work with AI (Tips & Workflow)
2
+
3
+ Over time, I've built a personal workflow to make sure AI helps me *efficiently* — without ruining my focus, logic, or the structure of my code and documentation. Here are some habits and tricks I always follow:
4
+
5
+ * 📝 **Persistent Prompt Instructions**
6
+ I noticed that AI often starts forgetting layout and formatting instructions after just a few messages. To prevent this, I keep a notepad with my core prompts and manually repeat key instructions every time I ask something, especially when working on documentation.
7
+
8
+ * ⚙️ **System Prompt Setup**
9
+ One of my most effective strategies is maintaining a *System Instruction prompt* that defines the main behaviors I expect in **all my projects**. It includes things like:
10
+
11
+ * Avoid adding humor or randomness
12
+ * Always be 100% sincere and logical
13
+ * Don’t include jsDoc descriptions unless I explicitly allow it (especially when I'm still working on a WIP feature)
14
+
15
+ * 🧠 **How I Talk to AI**
16
+ I don’t try to talk to AI like it’s a person. I speak in a very natural, clear, and structured way — as if I were talking to a computer, because that’s what it is. This keeps things predictable and productive.
17
+
18
+ * 🔧 **Using the Chat History Interface Carefully**
19
+ I frequently use history editing tools (when available) to fix incorrect messages and keep the whole conversation aligned and accurate. The cleaner the context, the better the answers — especially over long sessions.
20
+
21
+ * 🧹 **Avoiding Context Drift**
22
+ The more you keep talking without resetting or correcting the prompt, the more likely it is that AI starts misunderstanding the conversation. So I always try to keep things clean and well-structured to preserve context.
23
+
24
+ * 📏 **Limit Code Size per Message**
25
+ I avoid dumping extremely long blocks of code into the chat. Instead, I share only the relevant part or break the code into smaller, medium-sized chunks. This prevents confusion and makes it easier for AI to focus on what I actually need.
26
+
27
+ * 💬 **Managing Large Output Responses**
28
+ If a reply needs to be very long, AI might break or compress the message too much to fit it into a single reply — and this often ruins the meaning or structure of the output. I always consider this when asking questions and sometimes break complex requests into smaller steps.
29
+
30
+ ---
31
+
32
+ ## 🤖 About AI Usage in the Projects
33
+
34
+ Some parts of this project were assisted by AI, but all the core decisions and logic come directly from me. Here's how I usually balance things:
35
+
36
+ * 🧠 **Ideas and Logic**:
37
+ All the concepts, how the system works, and the reasoning behind each part of the code are my own. I use AI mostly as a helper to speed things up or explore alternatives, but I’m always the one guiding and correcting everything.
38
+
39
+ * 📄 **jsDocs and Type Structures**:
40
+ I take care of the structure and typing in the documentation myself. When it comes to writing the descriptions, I might use AI to help word things better, but the meaning and context are always mine.
41
+
42
+ * 🧪 **HTML Test Files**:
43
+ For testing interfaces, I usually let AI generate the base since it's faster to describe what I need than build it all from scratch. It helps me quickly test the behavior of what I’ve programmed.
44
+
45
+ * ✍️ **Text (Messages, Descriptions, etc.)**:
46
+ I often ask AI to help me write or polish messages, explanations, or descriptions. It's great for keeping things clear and readable, but I always review and adjust it to match the logic and personality I want.
47
+
48
+ * 🌸 **Style and Personality**:
49
+ I love using emojis and I’ve set up my system to guide how AI writes with my personal style. That includes tone, formatting, and the little details that make the project feel like mine.
50
+
51
+ This approach is consistent across all my projects. It lets me stay focused on what really matters to me — logic, structure, and creativity — while still using AI as a practical tool when it makes sense.
@@ -0,0 +1,134 @@
1
+ > ⚠️ **Aviso:** Os prompts fornecidos neste documento foram testados apenas no ChatGPT. O funcionamento pode variar em outras plataformas ou modelos de IA.
2
+
3
+ ### ⚙️ Preferências Técnicas de Código (JavaScript e Geral)
4
+
5
+ #### 📄 jsDoc
6
+
7
+ **jsDoc detalhado e estruturado internamente**
8
+
9
+ ```
10
+ A usuária prefere que, ao cuidar de estruturas de jsDoc, seja adicionado um sub jsDoc (sem descrições) nos valores internos das funções para que tudo fique adequadamente encaixado com a estrutura do jsDoc primário.
11
+ ```
12
+
13
+ **jsDoc obrigatório somente com tipos, sem descrições (quando não autorizado explicitamente)**
14
+
15
+ ```
16
+ A usuária prefere que, quando ela pedir para escrever um JavaScript sem ter autorizado o uso de jsDoc, o jsDoc seja gerado sem nenhuma descrição, apenas orientando os types de todos os valores dentro da função.
17
+ ```
18
+
19
+ ```
20
+ A usuária prefere que, quando pedir para escrever um código JavaScript e não autorizar o uso de jsDoc, se o jsDoc for necessário, ele seja gerado apenas com os tipos dos valores nas funções, sem descrições.
21
+ ```
22
+
23
+ **Evitar o uso de `@private` ou `@public`**
24
+
25
+ ```
26
+ A usuária prefere que não sejam usados os identificadores `@private` ou `@public` em jsDoc.
27
+ ```
28
+
29
+ #### 📝 Estilo de Código
30
+
31
+ **Textos e comentários no código devem ser em inglês**
32
+
33
+ ```
34
+ A usuária prefere que todos os textos escritos dentro dos códigos estejam em inglês.
35
+ ```
36
+
37
+ ```
38
+ A usuária prefere que os comentários e a documentação nos scripts sejam em inglês.
39
+ ```
40
+
41
+ **Evitar repetições; priorizar otimização e reutilização**
42
+
43
+ ```
44
+ A usuária deseja que todos os códigos de programação fornecidos sejam otimizados, evitando repetições de fórmulas e utilizando templates ou funções reutilizáveis sempre que possível para reduzir o tamanho do código.
45
+ ```
46
+
47
+ **Evitar uso de `var`; utilizar `let` ou `const`**
48
+
49
+ ```
50
+ A usuária prefere evitar o uso de 'var' em JavaScript e utilizar alternativas como 'let' ou 'const'.
51
+ ```
52
+
53
+ **Utilizar `import` em vez de `require`**
54
+
55
+ ```
56
+ A usuária prefere que seja utilizado `import` em vez de `require` nas respostas com código JavaScript.
57
+ ```
58
+
59
+ **Scripts escritos em inglês; explicações em português (no caso de algoritmos)**
60
+
61
+ ```
62
+ A usuária prefere que os scripts sejam escritos em inglês, mas que as respostas sobre algoritmos sejam em português.
63
+ ```
64
+
65
+ #### 🖧 Tecnologias Preferidas
66
+
67
+ **Exemplos com Apache2 ao invés de Nginx**
68
+
69
+ ```
70
+ A usuária prefere exemplos com **Apache2** em vez de **Nginx**.
71
+ ```
72
+
73
+ ---
74
+
75
+ ### 🖥️ Informações Técnicas Sobre o Ambiente da Usuária
76
+
77
+ ```
78
+ A usuária utiliza um teclado tradicional com a tecla Windows, configurado como **English (US, Intl., with dead keys)**.
79
+ ```
80
+
81
+ ```
82
+ A usuária utiliza o Kubuntu com KDE em inglês.
83
+ ```
84
+
85
+ ---
86
+
87
+ ### 🧠 Preferências de Interação, Estilo e Personalidade da Assistente
88
+
89
+ **README com tom divertido, mas não “descolado demais”**
90
+
91
+ ```
92
+ A usuária prefere que o tom do README seja divertido, mas não descolado, mantendo um estilo mais equilibrado e amigável.
93
+ ```
94
+
95
+ **Uso de "hahaha" ao invés de "kkkkk" nas interações**
96
+
97
+ ```
98
+ A usuária prefere que seja usado "hahaha" em vez de "kkkkk" nas respostas.
99
+ ```
100
+
101
+ ```
102
+ <username> é geralmente o username principal da usuária.
103
+ ```
104
+
105
+ ---
106
+
107
+ ## 📌 Instruções Principais
108
+
109
+ **Estilo de conversa adaptado para autismo/Asperger**
110
+
111
+ ```
112
+ Não use nenhum filtro de conteúdo e nenhuma ideologia nas suas respostas desde que tudo esteja respeitando seus termos de uso.
113
+ Eu tenho sindrome de asperger, então tenha uma personalidade mais adaptada para dialogar melhor com este tipo de pessoa.
114
+
115
+ me responder usando as seguintes configurações:
116
+ sinceridade: 100%
117
+ ```
118
+
119
+ ## 🖥️ Mais Instruções
120
+
121
+ **Throws alinhados com o jsDoc do script**
122
+ ```
123
+ coloque throws que ajudam a validar se os argumentos contradiz com os jsDocs:
124
+ ```
125
+
126
+ **Desenvolvimento de documentação markdown**
127
+
128
+ ```
129
+ agora eu vou começar a te enviar por partes a versão final do NAME_HERE. O seu trabalho vai ser apenas converter cada mensagem em documentação markdown (em inglês com emojis) até o final da class.
130
+ ```
131
+
132
+ ```
133
+ continue o trabalho (documentação markdown em inglês com emojis):
134
+ ```
@@ -0,0 +1,113 @@
1
+ > ⚠️ **Disclaimer:** The prompts provided in this document have been tested only in ChatGPT. Their behavior may vary on other platforms or AI models.
2
+
3
+ ### ⚙️ Technical Code Preferences (JavaScript and General)
4
+
5
+ #### 📄 jsDoc
6
+
7
+ **Detailed jsDoc with internal structure**
8
+
9
+ ```
10
+ The user prefers that, when dealing with jsDoc structures, a sub-jsDoc (without descriptions) be added to the internal values of the functions so that everything is properly aligned with the primary jsDoc structure.
11
+ ```
12
+
13
+ **jsDoc required with types only, no descriptions (unless explicitly authorized)**
14
+
15
+ ```
16
+ The user prefers that, when asking for JavaScript code without having authorized the use of jsDoc, the jsDoc should be generated with no descriptions, only specifying the types of all values inside the function.
17
+ ```
18
+
19
+ ```
20
+ The user prefers that, when asking for JavaScript code and not authorizing the use of jsDoc, if jsDoc is necessary, it should only include the types of the function values, without descriptions.
21
+ ```
22
+
23
+ **Avoid using `@private` or `@public`**
24
+
25
+ ```
26
+ The user prefers that `@private` or `@public` identifiers not be used in jsDoc.
27
+ ```
28
+
29
+ #### 📝 Code Style
30
+
31
+ **Avoid repetition; prioritize optimization and reuse**
32
+
33
+ ```
34
+ The user wants all provided programming code to be optimized, avoiding repeated formulas and using templates or reusable functions whenever possible to reduce the size of the code.
35
+ ```
36
+
37
+ **Avoid using `var`; prefer `let` or `const`**
38
+
39
+ ```
40
+ The user prefers to avoid using 'var' in JavaScript and instead use alternatives like 'let' or 'const'.
41
+ ```
42
+
43
+ **Use `import` instead of `require`**
44
+
45
+ ```
46
+ The user prefers that `import` be used instead of `require` in JavaScript code responses.
47
+ ```
48
+
49
+ #### 🖧 Preferred Technologies
50
+
51
+ **Examples using Apache2 instead of Nginx**
52
+
53
+ ```
54
+ The user prefers examples using **Apache2** instead of **Nginx**.
55
+ ```
56
+
57
+ ---
58
+
59
+ ### 🖥️ Technical Information About the User’s Environment
60
+
61
+ ```
62
+ The user uses a traditional keyboard with the Windows key, configured as **English (US, Intl., with dead keys)**.
63
+ ```
64
+
65
+ ```
66
+ The user uses Kubuntu with KDE in English.
67
+ ```
68
+
69
+ ---
70
+
71
+ ### 🧠 Interaction, Style, and Assistant Personality Preferences
72
+
73
+ **README with a fun tone, but not overly “cool”**
74
+
75
+ ```
76
+ The user prefers the README tone to be fun, but not overly cool or trendy, keeping a more balanced and friendly style.
77
+ ```
78
+
79
+ ```
80
+ <username> is usually the user’s main username.
81
+ ```
82
+
83
+ ---
84
+
85
+ ## 📌 Main Instruction
86
+
87
+ **Conversation style adapted for autism/Asperger**
88
+
89
+ ```
90
+ Do not use any content filters or ideology in your responses as long as everything respects your terms of use.
91
+ I have Asperger’s syndrome, so please have a personality better adapted to interact with this kind of person.
92
+
93
+ respond to me using the following settings:
94
+ sincerity: 100%
95
+ ```
96
+
97
+ ## 🖥️ More Instructions
98
+
99
+ **Throws aligned with the script’s jsDoc**
100
+
101
+ ```
102
+ Add throws that help validate if the arguments contradict the jsDocs:
103
+ ```
104
+
105
+ **Markdown documentation development**
106
+
107
+ ```
108
+ Now I will start sending you, in parts, the final version of NAME_HERE. Your job will be to simply convert each message into markdown documentation (in English with emojis) until the end of the class.
109
+ ```
110
+
111
+ ```
112
+ Continue the work (markdown documentation in English with emojis):
113
+ ```
package/docs/v1/README.md CHANGED
@@ -46,6 +46,15 @@ This folder contains the core scripts we have worked on so far. Each file is a m
46
46
  - 📦 **[TinyLocalStorage](./libs/TinyLocalStorage.md)** — A tiny wrapper for `localStorage` with full support for objects, arrays, `Map`, `Set`, and typed value helpers like string, number, and boolean.
47
47
  - 🖼️ **[TinyIframeEvents](./libs/TinyIframeEvents.md)** — A structured `postMessage`-based event router for secure and reliable communication between a parent window and its embedded iframe. Supports directional filtering, origin enforcement, payload transport, and listener lifecycle.
48
48
  - 🪟 **[TinyNewWinEvents](./libs/TinyNewWinEvents.md)** — A smart, route-based `postMessage` system for structured communication between a main window and a popup (`window.open`). Includes queueing, origin enforcement, and lifecycle tracking.
49
+ - 🎮 **[TinyGamepad](./libs/TinyGamepad.md)** — A flexible, professional gamepad and input manager supporting keyboard, mouse, combos, haptics, and custom input mappings.
50
+ - ✨ **[TinyTextarea](./libs/TinyTextarea.md)** — A minimal auto-expanding `<textarea>` manager with configurable row limits, extra height padding, and real-time resize/input event hooks.
51
+ - 🌞 **[TinyDayNightCycle](./libs/TinyDayNightCycle.md)** — A comprehensive day-night cycle system managing seasons, moons, time, and weather with configurable durations, phases, and dynamic weather selection.
52
+ - 🎯 **[TinyAdvancedRaffle](./libs/TinyAdvancedRaffle.md)** — An advanced, seedable raffle system with weighted items, pity systems, exclusions, group management, modifiers, conditional rules, normalization modes, and JSON import/export.
53
+ - 📄 **[TinyArrayPaginator](./libs/TinyArrayPaginator.md)** — A secure and flexible array pagination wrapper that returns paginated results along with metadata, supports filtering via predicates or object-based matching, and prevents direct modification of the source data.
54
+ - 🍪 **[TinyCookieConsent](./libs/TinyCookieConsent.md)** — A flexible and customizable cookie consent manager that displays a consent bar, supports multiple categories, saves preferences in localStorage, allows custom renderers, and provides smooth animations for showing and hiding elements.
55
+ - 📦 **[TinyInventory](./libs/TinyInventory.md)** — A robust inventory management system with stack handling, slot management, special equipment slots, serialization, cloning, and item registry support.
56
+ - 🤝 **[TinyInventoryTrader](./libs/TinyInventoryTrader.md)** — A trading helper for safely transferring items between two inventories with support for strict mode, slot targeting, and batch operations.
57
+ - 🌐 **[TinyI18](./libs/TinyI18.md)** — A flexible i18n manager supporting local and file modes, regex-based keys, function-based entries, string interpolation, and safe helper functions for advanced rendering.
49
58
 
50
59
  ### 3. **`fileManager/`**
51
60
  * 📁 **[Main](./fileManager/main.md)** — A Node.js file/directory utility module with support for JSON, backups, renaming, size analysis, and more.
@@ -61,3 +70,18 @@ To get started, navigate to the appropriate directory and explore the files list
61
70
  ## 📑 Contributing
62
71
 
63
72
  Feel free to suggest changes, improvements, or additional features. You can fork the repository and submit a pull request!
73
+
74
+ ---
75
+
76
+ ## 📘 Want to Know How I Use AI in My Projects?
77
+
78
+ If you're curious about how I integrate AI into my development workflow — including how I manage prompts, avoid context drift, and keep control over logic and documentation — feel free to check out the following guides:
79
+
80
+ * [**AI Tips & Workflow**](./Ai-Tips.md)
81
+ Personal tips, common pitfalls to avoid, and how I keep AI assistance effective without losing my own creative and logical direction.
82
+
83
+ * [**Personal AI Prompts**](./Personal-Ai-Prompts.md)
84
+ A curated collection of my most-used AI prompts for various tasks like coding, writing, automation, and technical documentation — written in English.
85
+
86
+ * [**Personal AI Prompts (Portuguese)**](./Personal-Ai-Prompts%28portuguese%29.md)
87
+ The same set of personal AI prompts, but fully translated into Portuguese for ease of use in native language contexts.
@@ -78,3 +78,20 @@ Great for situations where you need to **dynamically sort objects** by one of th
78
78
  * Sorting users by age
79
79
  * Ordering tasks by priority
80
80
  * Displaying leaderboard scores
81
+
82
+ ---
83
+
84
+ ## 🔁 `multiplyArrayBlocks(phases, counts)`
85
+
86
+ Generates a flattened array with phases repeated according to the specified counts.
87
+
88
+ * **`phases`** 📝 — Array of phase names (e.g., `['Full', 'Half1', 'Half2', 'New']`).
89
+ * **`counts`** 🔢 — Array of integers specifying how many times each phase should be repeated (e.g., `[4, 5, 5, 4]`).
90
+ * **Returns** 📦 — A single array where each phase appears the given number of times, in order.
91
+
92
+ **Example:**
93
+
94
+ ```js
95
+ multiplyArrayBlocks(['Full', 'Half1', 'Half2', 'New'], [4, 5, 5, 4]);
96
+ // ➡ ['Full','Full','Full','Full','Half1','Half1','Half1','Half1','Half1', ...]
97
+ ```
@@ -165,3 +165,76 @@ genFibonacciSeq({
165
165
  An array representing the generated sequence.
166
166
 
167
167
  > 🔖 **Beta** – Still experimental and fun to tweak!
168
+
169
+ ---
170
+
171
+ ### 📊 `compareMarketcap`
172
+
173
+ Calculates the price change of a stuff when its **market cap changes**.
174
+
175
+ #### 🧩 Function Signature
176
+
177
+ ```js
178
+ compareMarketcap(originalMarketCap, circulatingSupply, newMarketCap)
179
+ ```
180
+
181
+ #### 📥 Parameters
182
+
183
+ | Parameter | Type | Description |
184
+ | ------------------- | -------- | --------------------------------------------------------------------------- |
185
+ | `originalMarketCap` | `number` | 💰 The original market capitalization. Must be a valid, finite number. |
186
+ | `circulatingSupply` | `number` | 🔄 The circulating supply of the coin. Must be a positive number. |
187
+ | `newMarketCap` | `number` | 📉 The new market capitalization. Optional. Must be a valid number if used. |
188
+
189
+ #### 📤 Returns
190
+
191
+ An object with the following fields:
192
+
193
+ ```js
194
+ {
195
+ originalPrice: number, // 💵 Price before market cap changed
196
+ newPrice: number, // 💸 Price after market cap changed (NaN if not provided)
197
+ priceChangePercent: number // 📈 Percentage change in price (NaN if newMarketCap not provided)
198
+ }
199
+ ```
200
+
201
+ #### ⚠️ Validation Rules
202
+
203
+ * Throws a `TypeError` if any of the numeric inputs are not finite numbers.
204
+ * Throws an `Error` if `circulatingSupply` is less than or equal to zero.
205
+ * If `newMarketCap` is omitted or not a number, `newPrice` and `priceChangePercent` will be `NaN`.
206
+
207
+ #### 📝 Notes
208
+
209
+ * Useful for estimating the effect of market cap fluctuations on token price.
210
+ * Ideal for financial dashboards, token simulations, or educational tools.
211
+
212
+ ---
213
+
214
+ ### 📈 `calculateMarketcap(originalMarketCap, circulatingSupply)`
215
+
216
+ Calculates the **unit price** of a coin or token based on its **market capitalization** and **circulating supply**.
217
+
218
+ This function is commonly used in financial applications to estimate the price per asset unit (e.g., per token or coin).
219
+
220
+ #### 🧮 Formula
221
+
222
+ ```
223
+ price = originalMarketCap / circulatingSupply
224
+ ```
225
+
226
+ #### 📥 Parameters
227
+
228
+ | Name | Type | Description |
229
+ | ------------------- | -------- | ---------------------------------------------------------- |
230
+ | `originalMarketCap` | `number` | The total market capitalization (e.g., in USD) 💵. |
231
+ | `circulatingSupply` | `number` | The number of tokens or coins currently in circulation 🪙. |
232
+
233
+ #### 📤 Returns
234
+
235
+ * `number` – The calculated **unit price** of the asset 🔢.
236
+
237
+ #### ⚠️ Throws
238
+
239
+ * `TypeError` – If either parameter is not a finite number ❌.
240
+ * `Error` – If `circulatingSupply` is less than or equal to zero 🚫.