tiny-essentials 1.25.0 → 1.25.1
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.
- package/README.md +1 -1
- package/changelog/1/25/1.md +18 -0
- package/dist/v1/TinyAnalogClock.min.js +1 -0
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyTextDiffer.min.js +1 -0
- package/dist/v1/build/TinyAnalogClock.cjs +7 -0
- package/dist/v1/build/TinyAnalogClock.d.mts +3 -0
- package/dist/v1/build/TinyAnalogClock.mjs +2 -0
- package/dist/v1/build/TinyTextDiffer.cjs +7 -0
- package/dist/v1/build/TinyTextDiffer.d.mts +3 -0
- package/dist/v1/build/TinyTextDiffer.mjs +2 -0
- package/dist/v1/index.cjs +4 -0
- package/dist/v1/index.d.mts +3 -1
- package/dist/v1/index.mjs +3 -1
- package/dist/v1/libs/TinyAnalogClock.cjs +738 -0
- package/dist/v1/libs/TinyAnalogClock.d.mts +342 -0
- package/dist/v1/libs/TinyAnalogClock.mjs +653 -0
- package/dist/v1/libs/TinyTextDiffer.cjs +288 -0
- package/dist/v1/libs/TinyTextDiffer.d.mts +109 -0
- package/dist/v1/libs/TinyTextDiffer.mjs +255 -0
- package/docs/v1/README.md +2 -0
- package/docs/v1/libs/TinyAnalogClock.md +295 -0
- package/docs/v1/libs/TinyTextDiffer.md +114 -0
- package/package.json +9 -1
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
export default TinyAnalogClock;
|
|
2
|
+
/**
|
|
3
|
+
* Configuration object for the Analog Clock.
|
|
4
|
+
*/
|
|
5
|
+
export type ClockConfig = {
|
|
6
|
+
/**
|
|
7
|
+
* - The background color of the clock face (e.g., '#ffffff', 'rgb(0,0,0)').
|
|
8
|
+
*/
|
|
9
|
+
bgColor: string;
|
|
10
|
+
/**
|
|
11
|
+
* - The color of the clock's outer border.
|
|
12
|
+
*/
|
|
13
|
+
borderColor: string;
|
|
14
|
+
/**
|
|
15
|
+
* - The thickness of the outer border in pixels.
|
|
16
|
+
*/
|
|
17
|
+
borderWidth: number;
|
|
18
|
+
/**
|
|
19
|
+
* - The color of the minute/hour tick marks.
|
|
20
|
+
*/
|
|
21
|
+
markColor: string;
|
|
22
|
+
/**
|
|
23
|
+
* - The color of the hour hand.
|
|
24
|
+
*/
|
|
25
|
+
hourHandColor: string;
|
|
26
|
+
/**
|
|
27
|
+
* - The color of the minute hand.
|
|
28
|
+
*/
|
|
29
|
+
minuteHandColor: string;
|
|
30
|
+
/**
|
|
31
|
+
* - The color of the second hand.
|
|
32
|
+
*/
|
|
33
|
+
secondHandColor: string;
|
|
34
|
+
/**
|
|
35
|
+
* - The color of the numbers on the clock face.
|
|
36
|
+
*/
|
|
37
|
+
textColor: string;
|
|
38
|
+
/**
|
|
39
|
+
* - The URL of an image to use as the clock face background. Set to null to use bgColor.
|
|
40
|
+
*/
|
|
41
|
+
skinUrl: string | null;
|
|
42
|
+
/**
|
|
43
|
+
* - Whether to render the numbers (1-12) on the clock face.
|
|
44
|
+
*/
|
|
45
|
+
showNumbers: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* - Whether to display the second hand.
|
|
48
|
+
*/
|
|
49
|
+
showSeconds: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* - The total width and height of the clock in pixels.
|
|
52
|
+
*/
|
|
53
|
+
size: number;
|
|
54
|
+
/**
|
|
55
|
+
* - Scale factor for the font size of the numbers relative to the clock size.
|
|
56
|
+
*/
|
|
57
|
+
sizeAdjust: number;
|
|
58
|
+
/**
|
|
59
|
+
* - Padding in pixels between the clock edge and the tick marks.
|
|
60
|
+
*/
|
|
61
|
+
padding: number;
|
|
62
|
+
/**
|
|
63
|
+
* - Distance multiplier (0-1) for placing numbers relative to the radius.
|
|
64
|
+
*/
|
|
65
|
+
angleDistance: number;
|
|
66
|
+
/**
|
|
67
|
+
* - Hour tick width as a percentage of clock size (0.0 to 1.0).
|
|
68
|
+
*/
|
|
69
|
+
pwH: number;
|
|
70
|
+
/**
|
|
71
|
+
* - Hour tick height as a percentage of clock size (0.0 to 1.0).
|
|
72
|
+
*/
|
|
73
|
+
phH: number;
|
|
74
|
+
/**
|
|
75
|
+
* - Minute tick width as a percentage of clock size (0.0 to 1.0).
|
|
76
|
+
*/
|
|
77
|
+
pwM: number;
|
|
78
|
+
/**
|
|
79
|
+
* - Minute tick height as a percentage of clock size (0.0 to 1.0).
|
|
80
|
+
*/
|
|
81
|
+
phM: number;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Configuration object for the Analog Clock.
|
|
85
|
+
* @typedef {Object} ClockConfig
|
|
86
|
+
* @property {string} bgColor - The background color of the clock face (e.g., '#ffffff', 'rgb(0,0,0)').
|
|
87
|
+
* @property {string} borderColor - The color of the clock's outer border.
|
|
88
|
+
* @property {number} borderWidth - The thickness of the outer border in pixels.
|
|
89
|
+
* @property {string} markColor - The color of the minute/hour tick marks.
|
|
90
|
+
* @property {string} hourHandColor - The color of the hour hand.
|
|
91
|
+
* @property {string} minuteHandColor - The color of the minute hand.
|
|
92
|
+
* @property {string} secondHandColor - The color of the second hand.
|
|
93
|
+
* @property {string} textColor - The color of the numbers on the clock face.
|
|
94
|
+
* @property {string|null} skinUrl - The URL of an image to use as the clock face background. Set to null to use bgColor.
|
|
95
|
+
* @property {boolean} showNumbers - Whether to render the numbers (1-12) on the clock face.
|
|
96
|
+
* @property {boolean} showSeconds - Whether to display the second hand.
|
|
97
|
+
* @property {number} size - The total width and height of the clock in pixels.
|
|
98
|
+
* @property {number} sizeAdjust - Scale factor for the font size of the numbers relative to the clock size.
|
|
99
|
+
* @property {number} padding - Padding in pixels between the clock edge and the tick marks.
|
|
100
|
+
* @property {number} angleDistance - Distance multiplier (0-1) for placing numbers relative to the radius.
|
|
101
|
+
* @property {number} pwH - Hour tick width as a percentage of clock size (0.0 to 1.0).
|
|
102
|
+
* @property {number} phH - Hour tick height as a percentage of clock size (0.0 to 1.0).
|
|
103
|
+
* @property {number} pwM - Minute tick width as a percentage of clock size (0.0 to 1.0).
|
|
104
|
+
* @property {number} phM - Minute tick height as a percentage of clock size (0.0 to 1.0).
|
|
105
|
+
*/
|
|
106
|
+
declare class TinyAnalogClock {
|
|
107
|
+
/**
|
|
108
|
+
* Creates an instance of TinyAnalogClock.
|
|
109
|
+
* Initializes the DOM structure and starts the animation loop.
|
|
110
|
+
* @param {Partial<ClockConfig>} [options] - Optional configuration overrides.
|
|
111
|
+
*/
|
|
112
|
+
constructor(options?: Partial<ClockConfig>);
|
|
113
|
+
/**
|
|
114
|
+
* Retrieves the current date and extracts the specific hour, minute, and second components.
|
|
115
|
+
* @returns {{ now: Date, s: number, m: number, h: number }}
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
private _getDate;
|
|
119
|
+
/**
|
|
120
|
+
* Applies the current configuration to the DOM elements (colors, sizes, visibility).
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
private _applyConfig;
|
|
124
|
+
/**
|
|
125
|
+
* Renders the clock face, including tick marks and numbers, based on the current size and config.
|
|
126
|
+
* Uses trigonometry to position elements perfectly from the center.
|
|
127
|
+
* @private
|
|
128
|
+
*/
|
|
129
|
+
private _renderFace;
|
|
130
|
+
/**
|
|
131
|
+
* Starts the RequestAnimationFrame loop to update hand positions.
|
|
132
|
+
* @private
|
|
133
|
+
*/
|
|
134
|
+
private _startTicker;
|
|
135
|
+
/**
|
|
136
|
+
* Gets the main HTML element of the clock.
|
|
137
|
+
* @returns {HTMLElement} The clock container.
|
|
138
|
+
*/
|
|
139
|
+
get element(): HTMLElement;
|
|
140
|
+
/**
|
|
141
|
+
* Sets the size of the clock.
|
|
142
|
+
* @param {number} value - The new size in pixels. Must be a positive number.
|
|
143
|
+
* @throws {Error} If value is not a positive number.
|
|
144
|
+
*/
|
|
145
|
+
set size(value: number);
|
|
146
|
+
/** * Gets the clock size in pixels.
|
|
147
|
+
* @returns {number}
|
|
148
|
+
*/
|
|
149
|
+
get size(): number;
|
|
150
|
+
/**
|
|
151
|
+
* Sets the background image (skin) of the clock.
|
|
152
|
+
* @param {string|null} url - The URL string of the image, or null to remove the skin.
|
|
153
|
+
* @throws {Error} If value is not a string or null.
|
|
154
|
+
*/
|
|
155
|
+
set skinUrl(url: string | null);
|
|
156
|
+
/**
|
|
157
|
+
* Gets the skin URL.
|
|
158
|
+
* @returns {string|null}
|
|
159
|
+
*/
|
|
160
|
+
get skinUrl(): string | null;
|
|
161
|
+
/**
|
|
162
|
+
* Sets the primary border color.
|
|
163
|
+
* @param {string} color - A valid CSS color string.
|
|
164
|
+
* @throws {Error} If value is not a non-empty string.
|
|
165
|
+
*/
|
|
166
|
+
set borderColor(color: string);
|
|
167
|
+
/**
|
|
168
|
+
* Gets the border color.
|
|
169
|
+
* @returns {string}
|
|
170
|
+
*/
|
|
171
|
+
get borderColor(): string;
|
|
172
|
+
/**
|
|
173
|
+
* Sets the primary marks color.
|
|
174
|
+
* @param {string} color - A valid CSS color string.
|
|
175
|
+
* @throws {Error} If value is not a non-empty string.
|
|
176
|
+
*/
|
|
177
|
+
set markColor(color: string);
|
|
178
|
+
/**
|
|
179
|
+
* Gets the tick marks color.
|
|
180
|
+
* @returns {string}
|
|
181
|
+
*/
|
|
182
|
+
get markColor(): string;
|
|
183
|
+
/**
|
|
184
|
+
* Sets the primary text color.
|
|
185
|
+
* @param {string} color - A valid CSS color string.
|
|
186
|
+
* @throws {Error} If value is not a non-empty string.
|
|
187
|
+
*/
|
|
188
|
+
set textColor(color: string);
|
|
189
|
+
/**
|
|
190
|
+
* Gets the text color.
|
|
191
|
+
* @returns {string}
|
|
192
|
+
*/
|
|
193
|
+
get textColor(): string;
|
|
194
|
+
/**
|
|
195
|
+
* Toggles the visibility of numbers on the clock face.
|
|
196
|
+
* @param {boolean} value - True to show numbers, false to hide.
|
|
197
|
+
* @throws {Error} If value is not a boolean.
|
|
198
|
+
*/
|
|
199
|
+
set showNumbers(value: boolean);
|
|
200
|
+
/**
|
|
201
|
+
* Gets numbers visibility.
|
|
202
|
+
* @returns {boolean}
|
|
203
|
+
*/
|
|
204
|
+
get showNumbers(): boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Sets the background color.
|
|
207
|
+
* @param {string} value
|
|
208
|
+
*/
|
|
209
|
+
set bgColor(value: string);
|
|
210
|
+
/**
|
|
211
|
+
* Gets the background color.
|
|
212
|
+
* @returns {string}
|
|
213
|
+
*/
|
|
214
|
+
get bgColor(): string;
|
|
215
|
+
/**
|
|
216
|
+
* Sets the border thickness in pixels.
|
|
217
|
+
* @param {number} value
|
|
218
|
+
*/
|
|
219
|
+
set borderWidth(value: number);
|
|
220
|
+
/**
|
|
221
|
+
* Gets the border thickness.
|
|
222
|
+
* @returns {number}
|
|
223
|
+
*/
|
|
224
|
+
get borderWidth(): number;
|
|
225
|
+
/**
|
|
226
|
+
* Sets the hour hand color.
|
|
227
|
+
* @param {string} value
|
|
228
|
+
*/
|
|
229
|
+
set hourHandColor(value: string);
|
|
230
|
+
/**
|
|
231
|
+
* Gets the hour hand color.
|
|
232
|
+
* @returns {string}
|
|
233
|
+
*/
|
|
234
|
+
get hourHandColor(): string;
|
|
235
|
+
/**
|
|
236
|
+
* Sets the minute hand color.
|
|
237
|
+
* @param {string} value
|
|
238
|
+
*/
|
|
239
|
+
set minuteHandColor(value: string);
|
|
240
|
+
/**
|
|
241
|
+
* Gets the minute hand color.
|
|
242
|
+
* @returns {string}
|
|
243
|
+
*/
|
|
244
|
+
get minuteHandColor(): string;
|
|
245
|
+
/**
|
|
246
|
+
* Sets the second hand color.
|
|
247
|
+
* @param {string} value
|
|
248
|
+
*/
|
|
249
|
+
set secondHandColor(value: string);
|
|
250
|
+
/**
|
|
251
|
+
* Gets the second hand color.
|
|
252
|
+
* @returns {string}
|
|
253
|
+
*/
|
|
254
|
+
get secondHandColor(): string;
|
|
255
|
+
/**
|
|
256
|
+
* Toggle second hand visibility.
|
|
257
|
+
* @param {boolean} value
|
|
258
|
+
*/
|
|
259
|
+
set showSeconds(value: boolean);
|
|
260
|
+
/**
|
|
261
|
+
* Gets second hand visibility.
|
|
262
|
+
* @returns {boolean}
|
|
263
|
+
*/
|
|
264
|
+
get showSeconds(): boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Sets the font size adjustment factor.
|
|
267
|
+
* @param {number} value - Positive number.
|
|
268
|
+
*/
|
|
269
|
+
set sizeAdjust(value: number);
|
|
270
|
+
/**
|
|
271
|
+
* Gets the font size adjustment factor.
|
|
272
|
+
* @returns {number}
|
|
273
|
+
*/
|
|
274
|
+
get sizeAdjust(): number;
|
|
275
|
+
/**
|
|
276
|
+
* Sets the padding from edge to ticks.
|
|
277
|
+
* @param {number} value - Non-negative number in pixels.
|
|
278
|
+
*/
|
|
279
|
+
set padding(value: number);
|
|
280
|
+
/**
|
|
281
|
+
* Gets the padding.
|
|
282
|
+
* @returns {number}
|
|
283
|
+
*/
|
|
284
|
+
get padding(): number;
|
|
285
|
+
/**
|
|
286
|
+
* Sets the angle distance multiplier for numbers placement.
|
|
287
|
+
* @param {number} value - Positive number.
|
|
288
|
+
*/
|
|
289
|
+
set angleDistance(value: number);
|
|
290
|
+
/**
|
|
291
|
+
* Gets the angle distance multiplier.
|
|
292
|
+
* @returns {number}
|
|
293
|
+
*/
|
|
294
|
+
get angleDistance(): number;
|
|
295
|
+
/**
|
|
296
|
+
* Sets the Hour tick width percentage.
|
|
297
|
+
* @param {number} value - Positive number.
|
|
298
|
+
*/
|
|
299
|
+
set pwH(value: number);
|
|
300
|
+
/**
|
|
301
|
+
* Gets the Hour tick width percentage.
|
|
302
|
+
* @returns {number}
|
|
303
|
+
*/
|
|
304
|
+
get pwH(): number;
|
|
305
|
+
/**
|
|
306
|
+
* Sets the Hour tick height percentage.
|
|
307
|
+
* @param {number} value - Positive number.
|
|
308
|
+
*/
|
|
309
|
+
set phH(value: number);
|
|
310
|
+
/**
|
|
311
|
+
* Gets the Hour tick height percentage.
|
|
312
|
+
* @returns {number}
|
|
313
|
+
*/
|
|
314
|
+
get phH(): number;
|
|
315
|
+
/**
|
|
316
|
+
* Sets the Minute tick width percentage.
|
|
317
|
+
* @param {number} value - Positive number.
|
|
318
|
+
*/
|
|
319
|
+
set pwM(value: number);
|
|
320
|
+
/**
|
|
321
|
+
* Gets the Minute tick width percentage.
|
|
322
|
+
* @returns {number}
|
|
323
|
+
*/
|
|
324
|
+
get pwM(): number;
|
|
325
|
+
/**
|
|
326
|
+
* Sets the Minute tick height percentage.
|
|
327
|
+
* @param {number} value - Positive number.
|
|
328
|
+
*/
|
|
329
|
+
set phM(value: number);
|
|
330
|
+
/**
|
|
331
|
+
* Gets the Minute tick height percentage.
|
|
332
|
+
* @returns {number}
|
|
333
|
+
*/
|
|
334
|
+
get phM(): number;
|
|
335
|
+
/**
|
|
336
|
+
* Destroys the clock instance, stops animations, and removes the element from DOM.
|
|
337
|
+
* @returns {void}
|
|
338
|
+
*/
|
|
339
|
+
destroy(): void;
|
|
340
|
+
#private;
|
|
341
|
+
}
|
|
342
|
+
//# sourceMappingURL=TinyAnalogClock.d.mts.map
|