tiny-essentials 1.28.1 → 1.28.3
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/changelog/1/28/2.md +43 -0
- package/changelog/1/28/3.md +9 -0
- package/dist/_/numbers.d.mts +91 -16
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -1
- package/dist/v1/basics/array.d.mts +14 -14
- package/dist/v1/basics/clock.cjs +15 -15
- package/dist/v1/basics/clock.d.mts +21 -21
- package/dist/v1/basics/clock.mjs +15 -15
- package/dist/v1/basics/collision.d.mts +245 -104
- package/dist/v1/basics/deprecated/html.d.mts +33 -33
- package/dist/v1/basics/extendObjType/Buffer.d.mts +1 -1
- package/dist/v1/basics/fullScreen.d.mts +47 -7
- package/dist/v1/basics/html.d.mts +52 -61
- package/dist/v1/basics/index.cjs +2 -0
- package/dist/v1/basics/index.d.mts +11 -67
- package/dist/v1/basics/index.mjs +2 -2
- package/dist/v1/basics/mediaContent.cjs +65 -23
- package/dist/v1/basics/mediaContent.d.mts +144 -73
- package/dist/v1/basics/mediaContent.mjs +65 -23
- package/dist/v1/basics/objChecker.d.mts +2 -2
- package/dist/v1/basics/objFilter.cjs +50 -16
- package/dist/v1/basics/objFilter.d.mts +34 -13
- package/dist/v1/basics/objFilter.mjs +48 -16
- package/dist/v1/basics/simpleMath.d.mts +21 -21
- package/dist/v1/basics/text.d.mts +34 -46
- package/dist/v1/build/ColorSafeStringify.d.mts +1 -1
- package/dist/v1/build/TinyAdvancedRaffle.d.mts +1 -1
- package/dist/v1/build/TinyAfterScrollWatcher.d.mts +1 -1
- package/dist/v1/build/TinyAnalogClock.d.mts +1 -1
- package/dist/v1/build/TinyArrayComparator.d.mts +1 -1
- package/dist/v1/build/TinyArrayPaginator.d.mts +1 -1
- package/dist/v1/build/TinyClassManager.d.mts +1 -1
- package/dist/v1/build/TinyClipboard.d.mts +1 -1
- package/dist/v1/build/TinyColorConverter.d.mts +1 -1
- package/dist/v1/build/TinyColorValidator.d.mts +1 -1
- package/dist/v1/build/TinyCookieConsent.d.mts +1 -1
- package/dist/v1/build/TinyDayNightCycle.d.mts +1 -1
- package/dist/v1/build/TinyDomReadyManager.d.mts +1 -1
- package/dist/v1/build/TinyDragDropDetector.d.mts +1 -1
- package/dist/v1/build/TinyDragger.d.mts +1 -1
- package/dist/v1/build/TinyElementObserver.d.mts +1 -1
- package/dist/v1/build/TinyGamepad.d.mts +1 -1
- package/dist/v1/build/TinyHtml.d.mts +1 -1
- package/dist/v1/build/TinyI18.d.mts +1 -1
- package/dist/v1/build/TinyIframeEvents.d.mts +1 -1
- package/dist/v1/build/TinyInventory.d.mts +1 -1
- package/dist/v1/build/TinyInventoryTrader.d.mts +1 -1
- package/dist/v1/build/TinyLevelUp.d.mts +1 -1
- package/dist/v1/build/TinyLoadingScreen.d.mts +1 -1
- package/dist/v1/build/TinyLocalStorage.d.mts +1 -1
- package/dist/v1/build/TinyMediaPlayer.d.mts +1 -1
- package/dist/v1/build/TinyNeedBar.d.mts +1 -1
- package/dist/v1/build/TinyNewWinEvents.d.mts +1 -1
- package/dist/v1/build/TinyNotifications.d.mts +1 -1
- package/dist/v1/build/TinyNotifyCenter.d.mts +1 -1
- package/dist/v1/build/TinyPromiseQueue.d.mts +1 -1
- package/dist/v1/build/TinyRadioFm.d.mts +1 -1
- package/dist/v1/build/TinyRateLimiter.d.mts +1 -1
- package/dist/v1/build/TinySimpleDice.d.mts +1 -1
- package/dist/v1/build/TinySmartScroller.d.mts +1 -1
- package/dist/v1/build/TinyTextDiffer.d.mts +1 -1
- package/dist/v1/build/TinyTextRangeEditor.d.mts +1 -1
- package/dist/v1/build/TinyTextarea.d.mts +1 -1
- package/dist/v1/build/TinyTimeout.d.mts +1 -1
- package/dist/v1/build/TinyToastNotify.d.mts +1 -1
- package/dist/v1/build/TinyUploadClicker.d.mts +1 -1
- package/dist/v1/build/UltraRandomMsgGen.d.mts +1 -1
- package/dist/v1/fileManager/asyncFuncs.d.mts +13 -13
- package/dist/v1/fileManager/index.d.mts +3 -29
- package/dist/v1/fileManager/normalFuncs.d.mts +22 -22
- package/dist/v1/index.cjs +2 -0
- package/dist/v1/index.d.mts +53 -139
- package/dist/v1/index.mjs +2 -2
- package/dist/v1/libs/ColorSafeStringify.d.mts +3 -12
- package/dist/v1/libs/TinyAdvancedRaffle.d.mts +60 -103
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +11 -18
- package/dist/v1/libs/TinyAnalogClock.d.mts +8 -11
- package/dist/v1/libs/TinyArrayComparator.d.mts +14 -20
- package/dist/v1/libs/TinyArrayPaginator.d.mts +22 -26
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +8 -8
- package/dist/v1/libs/TinyClassManager.cjs +5 -7
- package/dist/v1/libs/TinyClassManager.d.mts +16 -16
- package/dist/v1/libs/TinyClassManager.mjs +5 -6
- package/dist/v1/libs/TinyClipboard.d.mts +8 -3
- package/dist/v1/libs/TinyColorConverter.d.mts +8 -31
- package/dist/v1/libs/TinyColorValidator.d.mts +145 -184
- package/dist/v1/libs/TinyCookieConsent.d.mts +17 -17
- package/dist/v1/libs/TinyDayNightCycle.d.mts +85 -110
- package/dist/v1/libs/TinyDomReadyManager.d.mts +8 -16
- package/dist/v1/libs/TinyDragDropDetector.d.mts +30 -30
- package/dist/v1/libs/TinyDragger.d.mts +82 -81
- package/dist/v1/libs/TinyElementObserver.d.mts +25 -28
- package/dist/v1/libs/TinyGamepad.cjs +0 -1
- package/dist/v1/libs/TinyGamepad.d.mts +50 -122
- package/dist/v1/libs/TinyGamepad.mjs +0 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.cjs +2 -25
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.d.mts +19 -25
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.mjs +3 -27
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.cjs +2 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.d.mts +55 -55
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.mjs +2 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlCanvas.d.mts +6 -6
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.cjs +8 -4
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.d.mts +19 -21
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.mjs +7 -4
- package/dist/v1/libs/TinyHtml/TinyHtmlEmbed.d.mts +8 -8
- package/dist/v1/libs/TinyHtml/TinyHtmlForm.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +5 -6
- package/dist/v1/libs/TinyHtml/TinyHtmlIframe.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.cjs +0 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.d.mts +22 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.mjs +1 -27
- package/dist/v1/libs/TinyHtml/TinyHtmlInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/TinyHtmlLink.d.mts +23 -23
- package/dist/v1/libs/TinyHtml/TinyHtmlMedia.d.mts +26 -26
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.cjs +4 -30
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.d.mts +20 -26
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.mjs +5 -32
- package/dist/v1/libs/TinyHtml/TinyHtmlSelect.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/TinyHtmlStyle.d.mts +8 -8
- package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +26 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.cjs +14 -15
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +32 -32
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.mjs +15 -15
- package/dist/v1/libs/TinyHtml/index.d.mts +102 -45
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.cjs +11 -9
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.d.mts +21 -21
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.mjs +11 -9
- package/dist/v1/libs/TinyHtml/input/TinyHtmlFileInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.cjs +4 -4
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.d.mts +17 -13
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.mjs +4 -4
- package/dist/v1/libs/TinyHtml/input/TinyHtmlImageInput.d.mts +21 -21
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.cjs +5 -4
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.mjs +5 -4
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.d.mts +10 -10
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.cjs +5 -4
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.mjs +5 -4
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.d.mts +15 -11
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.cjs +49 -21
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.d.mts +34 -20
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.mjs +45 -20
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.cjs +48 -25
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.d.mts +27 -21
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.mjs +40 -27
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/number/TinyHtmlNumberInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/number/TinyHtmlRangeInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlEmailInput.d.mts +25 -21
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlPasswordInput.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlSearchInput.d.mts +33 -29
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTelInput.d.mts +22 -22
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTextInput.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlUrlInput.d.mts +31 -27
- package/dist/v1/libs/TinyHtml/media/TinyHtmlAudio.d.mts +35 -11
- package/dist/v1/libs/TinyHtml/media/TinyHtmlObject.d.mts +10 -10
- package/dist/v1/libs/TinyHtml/media/TinyHtmlSource.d.mts +12 -12
- package/dist/v1/libs/TinyHtml/media/TinyHtmlVideo.d.mts +35 -27
- package/dist/v1/libs/TinyHtml.cjs +3 -4
- package/dist/v1/libs/TinyHtml.d.mts +1503 -1731
- package/dist/v1/libs/TinyHtml.mjs +3 -4
- package/dist/v1/libs/TinyI18.d.mts +23 -61
- package/dist/v1/libs/TinyIframeEvents.cjs +1 -1
- package/dist/v1/libs/TinyIframeEvents.d.mts +29 -38
- package/dist/v1/libs/TinyIframeEvents.mjs +1 -1
- package/dist/v1/libs/TinyInventory.d.mts +78 -141
- package/dist/v1/libs/TinyInventoryTrader.d.mts +19 -22
- package/dist/v1/libs/TinyLevelUp.d.mts +10 -13
- package/dist/v1/libs/TinyLoadingScreen.d.mts +21 -31
- package/dist/v1/libs/TinyLocalStorage.d.mts +11 -36
- package/dist/v1/libs/TinyMamdaniInferenceSystem.d.mts +37 -23
- package/dist/v1/libs/TinyMediaPlayer.cjs +5 -3
- package/dist/v1/libs/TinyMediaPlayer.d.mts +102 -109
- package/dist/v1/libs/TinyMediaPlayer.mjs +5 -3
- package/dist/v1/libs/TinyNeedBar.d.mts +25 -37
- package/dist/v1/libs/TinyNewWinEvents.d.mts +29 -32
- package/dist/v1/libs/TinyNotifications.d.mts +6 -6
- package/dist/v1/libs/TinyNotifyCenter.d.mts +15 -21
- package/dist/v1/libs/TinyPromiseQueue.d.mts +11 -11
- package/dist/v1/libs/TinyRadioFm.cjs +32 -12
- package/dist/v1/libs/TinyRadioFm.d.mts +44 -80
- package/dist/v1/libs/TinyRadioFm.mjs +29 -12
- package/dist/v1/libs/TinyRateLimiter.d.mts +26 -39
- package/dist/v1/libs/TinySimpleDice.d.mts +17 -36
- package/dist/v1/libs/TinySmartScroller.d.mts +50 -60
- package/dist/v1/libs/TinyTextDiffer.d.mts +11 -14
- package/dist/v1/libs/TinyTextRangeEditor.d.mts +8 -8
- package/dist/v1/libs/TinyTextarea.d.mts +31 -31
- package/dist/v1/libs/TinyTimeout.d.mts +14 -14
- package/dist/v1/libs/TinyToastNotify.cjs +1 -1
- package/dist/v1/libs/TinyToastNotify.d.mts +15 -23
- package/dist/v1/libs/TinyToastNotify.mjs +1 -1
- package/dist/v1/libs/TinyUploadClicker.d.mts +38 -14
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +44 -84
- package/dist/v1/libs/utils.d.mts +5 -1
- package/docs/v1/basics/deprecated/objFilter.md +14 -0
- package/docs/v1/basics/objFilter.md +31 -17
- package/package.json +2 -2
|
@@ -333,7 +333,6 @@ class TinyHtml {
|
|
|
333
333
|
* Enables or disables debug output.
|
|
334
334
|
* @param {boolean} value True to enable debug output; false to disable.
|
|
335
335
|
* @throws {TypeError} Thrown if the provided value is not a boolean.
|
|
336
|
-
* @returns {void}
|
|
337
336
|
*/
|
|
338
337
|
static set elemDebug(value) {
|
|
339
338
|
if (typeof value !== 'boolean')
|
|
@@ -511,7 +510,7 @@ class TinyHtml {
|
|
|
511
510
|
*
|
|
512
511
|
* @param {string} url - The URL of the HTML file.
|
|
513
512
|
* @param {RequestInit} [ops] - Optional fetch configuration (e.g., method, headers, cache, etc).
|
|
514
|
-
*
|
|
513
|
+
* Returns the promise that resolves with the TinyHtml instances.
|
|
515
514
|
*/
|
|
516
515
|
static async fetchHtmlTinyElems(url, ops) {
|
|
517
516
|
const nodes = await TinyHtml.fetchHtmlNodes(url, ops);
|
|
@@ -1437,7 +1436,7 @@ class TinyHtml {
|
|
|
1437
1436
|
* of the input form.
|
|
1438
1437
|
*
|
|
1439
1438
|
* @param {TinyElement|Text|(TinyElement|Text)[]} elems - A single element or an array of elements (DOM or TinyHtml).
|
|
1440
|
-
*
|
|
1439
|
+
* Returns the array of TinyHtml instances corresponding to the input elements.
|
|
1441
1440
|
*/
|
|
1442
1441
|
static toTinyElm(elems) {
|
|
1443
1442
|
/** @param {(TinyElement|Text)[]} item */
|
|
@@ -3706,7 +3705,7 @@ class TinyHtml {
|
|
|
3706
3705
|
// TITLE: Animate DOM (cssExpand)
|
|
3707
3706
|
/**
|
|
3708
3707
|
* CSS expansion shorthand used by genStyleFx to include margin/padding values.
|
|
3709
|
-
* @
|
|
3708
|
+
* @type {['Top', 'Right', 'Bottom', 'Left']}
|
|
3710
3709
|
*/
|
|
3711
3710
|
static #cssExpand = ['Top', 'Right', 'Bottom', 'Left'];
|
|
3712
3711
|
// TITLE: Animate DOM (styleEffects)
|
|
@@ -1,34 +1,11 @@
|
|
|
1
|
-
export default TinyI18;
|
|
2
|
-
/**
|
|
3
|
-
* Supported operating modes for TinyI18.
|
|
4
|
-
* - `"local"` → All translations are managed entirely in memory (browser + Node.js).
|
|
5
|
-
* - `"file"` → Translations are loaded from JSON files on disk (Node.js only).
|
|
6
|
-
*/
|
|
7
1
|
export type ModeTypes = "local" | "file";
|
|
8
|
-
/**
|
|
9
|
-
* Dictionary of translation keys mapped to values.
|
|
10
|
-
*/
|
|
11
2
|
export type Dict = Record<string, any>;
|
|
12
|
-
/**
|
|
13
|
-
* `$pattern` - Regex string (will be compiled into RegExp).
|
|
14
|
-
*
|
|
15
|
-
* `$fn` - Helper function name associated with this entry.
|
|
16
|
-
*
|
|
17
|
-
* `[key]` - Additional key-value pairs for interpolation or extra metadata.
|
|
18
|
-
*/
|
|
19
3
|
export type FileValue = {
|
|
20
4
|
$pattern: string;
|
|
21
5
|
$fn: string;
|
|
22
6
|
[key: string]: string;
|
|
23
7
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Represents a valid locale code string.
|
|
26
|
-
* Example: "en", "pt-BR", "fr".
|
|
27
|
-
*/
|
|
28
8
|
export type LocaleCode = string;
|
|
29
|
-
/**
|
|
30
|
-
* Represents a single regex-based translation entry.
|
|
31
|
-
*/
|
|
32
9
|
export type PatternEntry = {
|
|
33
10
|
/**
|
|
34
11
|
* - Compiled regular expression used for matching.
|
|
@@ -47,7 +24,7 @@ export type FileModeEntryJSON = {
|
|
|
47
24
|
/**
|
|
48
25
|
* - regex as string e.g. "^user\\.(\\d+)$"
|
|
49
26
|
*/
|
|
50
|
-
$pattern?: string
|
|
27
|
+
$pattern?: string;
|
|
51
28
|
/**
|
|
52
29
|
* - string or { $fn: string, args?: any }
|
|
53
30
|
*/
|
|
@@ -63,25 +40,22 @@ export type TinyI18Options = {
|
|
|
63
40
|
/**
|
|
64
41
|
* - Required in file mode. Directory with <locale>.json
|
|
65
42
|
*/
|
|
66
|
-
basePath?: string
|
|
43
|
+
basePath?: string;
|
|
67
44
|
/**
|
|
68
45
|
* - Optional initial map { locale: dict } for local mode
|
|
69
46
|
*/
|
|
70
|
-
localResources?: Dict
|
|
47
|
+
localResources?: Dict;
|
|
71
48
|
/**
|
|
72
49
|
* - If true, throws on missing keys; else returns key
|
|
73
50
|
*/
|
|
74
|
-
strict?: boolean
|
|
51
|
+
strict?: boolean;
|
|
75
52
|
};
|
|
76
53
|
export type ResolveOptions = {
|
|
77
54
|
/**
|
|
78
55
|
* - force resolve using a specific locale first
|
|
79
56
|
*/
|
|
80
|
-
locale?:
|
|
57
|
+
locale?: LocaleCode;
|
|
81
58
|
};
|
|
82
|
-
/**
|
|
83
|
-
* Represents statistics for a specific locale.
|
|
84
|
-
*/
|
|
85
59
|
export type StatLocale = {
|
|
86
60
|
/**
|
|
87
61
|
* - The locale code (e.g., "en", "pt-BR").
|
|
@@ -104,30 +78,17 @@ export type StatLocale = {
|
|
|
104
78
|
*/
|
|
105
79
|
isCurrent: boolean;
|
|
106
80
|
};
|
|
107
|
-
|
|
108
|
-
* Read-only view of registered helpers, exposed to function-based entries.
|
|
109
|
-
*
|
|
110
|
-
* Provides safe access to:
|
|
111
|
-
* - check if a helper exists by name
|
|
112
|
-
* - call a helper by name, passing arguments
|
|
113
|
-
*/
|
|
114
|
-
export type HelpersReadonly<T extends unknown, R extends unknown> = {
|
|
81
|
+
export type HelpersReadonly<T extends any, R extends any> = {
|
|
115
82
|
/**
|
|
116
83
|
* - Check if a helper with given name is registered.
|
|
117
84
|
*/
|
|
118
|
-
has?: (
|
|
85
|
+
has?: (name: string) => boolean;
|
|
119
86
|
/**
|
|
120
87
|
* -
|
|
121
88
|
* Invoke a helper by name with an argument and optional extras.
|
|
122
89
|
*/
|
|
123
|
-
call?: (
|
|
90
|
+
call?: (name: string, arg: T, extras?: HelpersReadonly<T, R>) => R;
|
|
124
91
|
};
|
|
125
|
-
/**
|
|
126
|
-
* A helper callback function used in translations.
|
|
127
|
-
*
|
|
128
|
-
* - Receives user-supplied parameters and a read-only facade for calling other helpers.
|
|
129
|
-
* - Must return a string (e.g. processed, interpolated, or formatted output).
|
|
130
|
-
*/
|
|
131
92
|
export type HelperCallback = (params: Dict, helpers: HelpersReadonly<any, any>) => string;
|
|
132
93
|
/**
|
|
133
94
|
* Supported operating modes for TinyI18.
|
|
@@ -241,6 +202,7 @@ export type HelperCallback = (params: Dict, helpers: HelpersReadonly<any, any>)
|
|
|
241
202
|
* - Safe: no dynamic code eval from files; functions in file mode are referenced by name ("$fn").
|
|
242
203
|
*/
|
|
243
204
|
declare class TinyI18 {
|
|
205
|
+
#private;
|
|
244
206
|
/**
|
|
245
207
|
* Merges multiple JSON locale files into a single file for TinyI18 usage.
|
|
246
208
|
* @param {Object} options
|
|
@@ -253,20 +215,8 @@ declare class TinyI18 {
|
|
|
253
215
|
static mergeLocaleFiles({ files, output, spaces }: {
|
|
254
216
|
files: string[];
|
|
255
217
|
output: string;
|
|
256
|
-
spaces?: number
|
|
218
|
+
spaces?: number;
|
|
257
219
|
}): Promise<void>;
|
|
258
|
-
/**
|
|
259
|
-
* Creates a new TinyI18 instance for managing localized strings and patterns.
|
|
260
|
-
*
|
|
261
|
-
* Supports two modes:
|
|
262
|
-
* - "local": loads translations directly from provided objects.
|
|
263
|
-
* - "file": loads translations from JSON files on demand.
|
|
264
|
-
*
|
|
265
|
-
* Ensures the default locale is always initialized. In "file" mode, `basePath` is required.
|
|
266
|
-
*
|
|
267
|
-
* @param {TinyI18Options} options - Configuration options for the instance.
|
|
268
|
-
*/
|
|
269
|
-
constructor(options: TinyI18Options);
|
|
270
220
|
/**
|
|
271
221
|
* Gets the current destruction status of the instance.
|
|
272
222
|
*
|
|
@@ -334,6 +284,18 @@ declare class TinyI18 {
|
|
|
334
284
|
* @returns {Record<string, RegExp>}
|
|
335
285
|
*/
|
|
336
286
|
get regexCache(): Record<string, RegExp>;
|
|
287
|
+
/**
|
|
288
|
+
* Creates a new TinyI18 instance for managing localized strings and patterns.
|
|
289
|
+
*
|
|
290
|
+
* Supports two modes:
|
|
291
|
+
* - "local": loads translations directly from provided objects.
|
|
292
|
+
* - "file": loads translations from JSON files on demand.
|
|
293
|
+
*
|
|
294
|
+
* Ensures the default locale is always initialized. In "file" mode, `basePath` is required.
|
|
295
|
+
*
|
|
296
|
+
* @param {TinyI18Options} options - Configuration options for the instance.
|
|
297
|
+
*/
|
|
298
|
+
constructor(options: TinyI18Options);
|
|
337
299
|
/**
|
|
338
300
|
* Clears the internal regex cache.
|
|
339
301
|
*
|
|
@@ -427,6 +389,6 @@ declare class TinyI18 {
|
|
|
427
389
|
* @returns {void}
|
|
428
390
|
*/
|
|
429
391
|
destroy(): void;
|
|
430
|
-
#private;
|
|
431
392
|
}
|
|
393
|
+
export default TinyI18;
|
|
432
394
|
//# sourceMappingURL=TinyI18.d.mts.map
|
|
@@ -97,7 +97,7 @@ class TinyIframeEvents extends events.EventEmitter {
|
|
|
97
97
|
* Executes the provided callback when the secure MessageChannel connection is fully established.
|
|
98
98
|
* If the connection is already ready, the callback is executed immediately.
|
|
99
99
|
*
|
|
100
|
-
* @param {
|
|
100
|
+
* @param {() => void} handler - The callback function to execute.
|
|
101
101
|
*/
|
|
102
102
|
onReady(handler) {
|
|
103
103
|
checkDestroy(this.#isDestroyed);
|
|
@@ -1,41 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* A function to handle incoming event payloads.
|
|
4
|
-
*/
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
5
2
|
export type handler = (payload: any, event: MessageEvent<any>) => any;
|
|
6
|
-
/**
|
|
7
|
-
* Configuration object for initializing TinyIframeEvents.
|
|
8
|
-
*/
|
|
9
3
|
export type TinyIframeEventsConfig = {
|
|
10
4
|
/**
|
|
11
5
|
* - The target iframe element to post messages to. Required if instantiated in the parent window.
|
|
12
6
|
*/
|
|
13
|
-
targetIframe?: HTMLIFrameElement
|
|
7
|
+
targetIframe?: HTMLIFrameElement;
|
|
14
8
|
/**
|
|
15
9
|
* - The target origin to restrict messages to. Defaults to `window.location.origin`.
|
|
16
10
|
*/
|
|
17
|
-
targetOrigin?: string
|
|
11
|
+
targetOrigin?: string;
|
|
18
12
|
/**
|
|
19
13
|
* - Custom internal name used to validate standard routing messages.
|
|
20
14
|
*/
|
|
21
|
-
secretEventName?: string
|
|
15
|
+
secretEventName?: string;
|
|
22
16
|
/**
|
|
23
17
|
* - Custom internal name used for the initial MessageChannel handshake.
|
|
24
18
|
*/
|
|
25
|
-
handshakeEventName?: string
|
|
19
|
+
handshakeEventName?: string;
|
|
26
20
|
/**
|
|
27
21
|
* - Custom internal name used for the ready event trigger.
|
|
28
22
|
*/
|
|
29
|
-
readyEventName?: string
|
|
23
|
+
readyEventName?: string;
|
|
30
24
|
};
|
|
31
|
-
/**
|
|
32
|
-
* Internal message structure for routed communication.
|
|
33
|
-
*/
|
|
34
25
|
export type IframeEventBase = {
|
|
35
26
|
/**
|
|
36
27
|
* - Dynamic key based on secretEventName to validate the message.
|
|
37
28
|
*/
|
|
38
|
-
secretIndicator?: boolean
|
|
29
|
+
secretIndicator?: boolean;
|
|
39
30
|
/**
|
|
40
31
|
* - The name of the custom event route.
|
|
41
32
|
*/
|
|
@@ -47,7 +38,7 @@ export type IframeEventBase = {
|
|
|
47
38
|
/**
|
|
48
39
|
* - Indicates the sender: 'iframe' or 'parent'.
|
|
49
40
|
*/
|
|
50
|
-
direction:
|
|
41
|
+
direction: 'iframe' | 'parent';
|
|
51
42
|
};
|
|
52
43
|
/**
|
|
53
44
|
* @callback handler
|
|
@@ -86,14 +77,10 @@ export type IframeEventBase = {
|
|
|
86
77
|
* - Queue management for messages sent before the connection is established.
|
|
87
78
|
* - Auto-reconnects and resets ports if the target iframe is reloaded.
|
|
88
79
|
*/
|
|
89
|
-
declare class TinyIframeEvents extends EventEmitter
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
*
|
|
94
|
-
* @param {TinyIframeEventsConfig} config - Configuration object.
|
|
95
|
-
*/
|
|
96
|
-
constructor({ targetIframe, targetOrigin, secretEventName, handshakeEventName, readyEventName, }?: TinyIframeEventsConfig);
|
|
80
|
+
declare class TinyIframeEvents extends EventEmitter {
|
|
81
|
+
#private;
|
|
82
|
+
_boundWindowMessage: (event: MessageEvent<any>) => void;
|
|
83
|
+
_boundPortMessage: (event: MessageEvent<any>) => void;
|
|
97
84
|
get targetWindow(): Window;
|
|
98
85
|
get targetIframeElement(): HTMLIFrameElement | undefined;
|
|
99
86
|
get targetOrigin(): string;
|
|
@@ -103,44 +90,49 @@ declare class TinyIframeEvents extends EventEmitter<any> {
|
|
|
103
90
|
* Executes the provided callback when the secure MessageChannel connection is fully established.
|
|
104
91
|
* If the connection is already ready, the callback is executed immediately.
|
|
105
92
|
*
|
|
106
|
-
* @param {
|
|
93
|
+
* @param {() => void} handler - The callback function to execute.
|
|
107
94
|
*/
|
|
108
95
|
onReady(handler: () => void): void;
|
|
109
|
-
_boundWindowMessage: (event: MessageEvent<any>) => void;
|
|
110
|
-
_boundPortMessage: (event: MessageEvent<any>) => void;
|
|
111
96
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
97
|
+
* Creates a new TinyIframeEvents instance to manage secure communication.
|
|
98
|
+
* Automatically establishes a MessageChannel connection between contexts.
|
|
99
|
+
*
|
|
100
|
+
* @param {TinyIframeEventsConfig} config - Configuration object.
|
|
115
101
|
*/
|
|
116
|
-
|
|
102
|
+
constructor({ targetIframe, targetOrigin, secretEventName, handshakeEventName, readyEventName, }?: TinyIframeEventsConfig);
|
|
117
103
|
/**
|
|
118
104
|
* Gets the internal secret iframe event name used for validation.
|
|
119
105
|
* @returns {string}
|
|
120
106
|
*/
|
|
121
107
|
get secretEventName(): string;
|
|
122
108
|
/**
|
|
123
|
-
* Sets the internal
|
|
109
|
+
* Sets the internal secret iframe event name.
|
|
124
110
|
* @param {string} name
|
|
125
111
|
* @throws {TypeError} If the value is not a string.
|
|
126
112
|
*/
|
|
127
|
-
set
|
|
113
|
+
set secretEventName(name: string);
|
|
128
114
|
/**
|
|
129
115
|
* Gets the internal handshake event name used for establishing the MessageChannel.
|
|
130
116
|
* @returns {string}
|
|
131
117
|
*/
|
|
132
118
|
get handshakeEventName(): string;
|
|
133
119
|
/**
|
|
134
|
-
* Sets the internal
|
|
120
|
+
* Sets the internal handshake event name.
|
|
135
121
|
* @param {string} name
|
|
136
122
|
* @throws {TypeError} If the value is not a string.
|
|
137
123
|
*/
|
|
138
|
-
set
|
|
124
|
+
set handshakeEventName(name: string);
|
|
139
125
|
/**
|
|
140
126
|
* Gets the internal ready event name used when the connection is fully established.
|
|
141
127
|
* @returns {string}
|
|
142
128
|
*/
|
|
143
129
|
get readyEventName(): string;
|
|
130
|
+
/**
|
|
131
|
+
* Sets the internal ready event name.
|
|
132
|
+
* @param {string} name
|
|
133
|
+
* @throws {TypeError} If the value is not a string.
|
|
134
|
+
*/
|
|
135
|
+
set readyEventName(name: string);
|
|
144
136
|
/**
|
|
145
137
|
* Sends an event to the target window through the secure MessageChannel.
|
|
146
138
|
*
|
|
@@ -161,7 +153,6 @@ declare class TinyIframeEvents extends EventEmitter<any> {
|
|
|
161
153
|
* Call this when the instance is no longer needed to prevent memory leaks.
|
|
162
154
|
*/
|
|
163
155
|
destroy(): void;
|
|
164
|
-
#private;
|
|
165
156
|
}
|
|
166
|
-
|
|
157
|
+
export default TinyIframeEvents;
|
|
167
158
|
//# sourceMappingURL=TinyIframeEvents.d.mts.map
|
|
@@ -78,7 +78,7 @@ class TinyIframeEvents extends EventEmitter {
|
|
|
78
78
|
* Executes the provided callback when the secure MessageChannel connection is fully established.
|
|
79
79
|
* If the connection is already ready, the callback is executed immediately.
|
|
80
80
|
*
|
|
81
|
-
* @param {
|
|
81
|
+
* @param {() => void} handler - The callback function to execute.
|
|
82
82
|
*/
|
|
83
83
|
onReady(handler) {
|
|
84
84
|
checkDestroy(this.#isDestroyed);
|