tiny-essentials 1.18.0 → 1.19.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.
- package/README.md +17 -3
- package/dist/legacy/get/countObj.cjs +2 -2
- package/dist/legacy/get/countObj.d.mts +1 -1
- package/dist/legacy/get/countObj.mjs +1 -1
- package/dist/legacy/index.cjs +2 -1
- package/dist/node_modules/firebase-functions/lib/common/trace.cjs +0 -1
- package/dist/node_modules/firebase-functions/lib/logger/index.cjs +1 -0
- package/dist/v1/ColorSafeStringify.min.js +1 -1
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
- package/dist/v1/TinyBasicsEs.js +402 -390
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyClipboard.min.js +1 -1
- package/dist/v1/TinyColorConverter.js +617 -0
- package/dist/v1/TinyColorConverter.min.js +1 -0
- package/dist/v1/TinyDomReadyManager.min.js +1 -1
- package/dist/v1/TinyDragger.js +6 -2433
- package/dist/v1/TinyDragger.min.js +1 -2
- package/dist/v1/TinyEssentials.js +3546 -1388
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyEvents.js +402 -0
- package/dist/v1/TinyEvents.min.js +1 -0
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyLocalStorage.js +1292 -0
- package/dist/v1/TinyLocalStorage.min.js +1 -0
- package/dist/v1/TinyNotifications.min.js +1 -1
- package/dist/v1/TinyNotifyCenter.min.js +1 -1
- package/dist/v1/TinyPromiseQueue.min.js +1 -1
- package/dist/v1/TinyRateLimiter.js +2 -1
- package/dist/v1/TinyRateLimiter.min.js +1 -1
- package/dist/v1/TinySmartScroller.js +570 -52
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyTextRangeEditor.min.js +1 -1
- package/dist/v1/TinyTimeout.js +233 -0
- package/dist/v1/TinyTimeout.min.js +1 -0
- package/dist/v1/TinyToastNotify.min.js +1 -1
- package/dist/v1/TinyUploadClicker.js +2087 -1129
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/html.cjs +16 -9
- package/dist/v1/basics/html.d.mts +12 -4
- package/dist/v1/basics/html.mjs +14 -7
- package/dist/v1/basics/index.cjs +3 -2
- package/dist/v1/basics/index.d.mts +2 -2
- package/dist/v1/basics/index.mjs +2 -1
- package/dist/v1/basics/objChecker.cjs +46 -0
- package/dist/v1/basics/objChecker.d.mts +29 -0
- package/dist/v1/basics/objChecker.mjs +45 -0
- package/dist/v1/basics/objFilter.cjs +4 -45
- package/dist/v1/basics/objFilter.d.mts +3 -28
- package/dist/v1/basics/objFilter.mjs +2 -45
- package/dist/v1/build/TinyColorConverter.cjs +7 -0
- package/dist/v1/build/TinyColorConverter.d.mts +3 -0
- package/dist/v1/build/TinyColorConverter.mjs +2 -0
- package/dist/v1/build/TinyEvents.cjs +7 -0
- package/dist/v1/build/TinyEvents.d.mts +3 -0
- package/dist/v1/build/TinyEvents.mjs +2 -0
- package/dist/v1/build/TinyLocalStorage.cjs +7 -0
- package/dist/v1/build/TinyLocalStorage.d.mts +3 -0
- package/dist/v1/build/TinyLocalStorage.mjs +2 -0
- package/dist/v1/build/TinyTimeout.cjs +7 -0
- package/dist/v1/build/TinyTimeout.d.mts +3 -0
- package/dist/v1/build/TinyTimeout.mjs +2 -0
- package/dist/v1/index.cjs +11 -2
- package/dist/v1/index.d.mts +7 -3
- package/dist/v1/index.mjs +7 -2
- package/dist/v1/libs/TinyColorConverter.cjs +578 -0
- package/dist/v1/libs/TinyColorConverter.d.mts +396 -0
- package/dist/v1/libs/TinyColorConverter.mjs +520 -0
- package/dist/v1/libs/TinyDragger.cjs +3 -3
- package/dist/v1/libs/TinyDragger.mjs +1 -1
- package/dist/v1/libs/TinyEvents.cjs +363 -0
- package/dist/v1/libs/TinyEvents.d.mts +160 -0
- package/dist/v1/libs/TinyEvents.mjs +328 -0
- package/dist/v1/libs/TinyLocalStorage.cjs +847 -0
- package/dist/v1/libs/TinyLocalStorage.d.mts +407 -0
- package/dist/v1/libs/TinyLocalStorage.mjs +740 -0
- package/dist/v1/libs/TinySmartScroller.cjs +207 -52
- package/dist/v1/libs/TinySmartScroller.d.mts +164 -16
- package/dist/v1/libs/TinySmartScroller.mjs +181 -52
- package/dist/v1/libs/TinyTimeout.cjs +194 -0
- package/dist/v1/libs/TinyTimeout.d.mts +89 -0
- package/dist/v1/libs/TinyTimeout.mjs +179 -0
- package/dist/v1/libs/TinyUploadClicker.cjs +6 -4
- package/docs/v1/README.md +5 -0
- package/docs/v1/basics/objChecker.md +47 -0
- package/docs/v1/basics/objFilter.md +0 -40
- package/docs/v1/libs/TinyColorConverter.md +220 -0
- package/docs/v1/libs/TinyEvents.md +199 -0
- package/docs/v1/libs/TinyLocalStorage.md +350 -0
- package/docs/v1/libs/TinyRateLimiter.md +0 -3
- package/docs/v1/libs/TinyTimeout.md +190 -0
- package/package.json +28 -5
- package/dist/v1/TinyDragger.min.js.LICENSE.txt +0 -8
package/dist/v1/TinyBasicsEs.js
CHANGED
|
@@ -2530,207 +2530,11 @@ function formatDayTimer(seconds) {
|
|
|
2530
2530
|
return formatCustomTimer(seconds, 'days', '{days}d {hours}:{minutes}:{seconds}');
|
|
2531
2531
|
}
|
|
2532
2532
|
|
|
2533
|
-
|
|
2534
|
-
var buffer = __webpack_require__(287);
|
|
2535
|
-
;// ./src/v1/basics/objFilter.mjs
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
2539
|
-
|
|
2540
|
-
/**
|
|
2541
|
-
* An object containing type validation functions and their evaluation order.
|
|
2542
|
-
*
|
|
2543
|
-
* Each item in `typeValidator.items` is a function that receives any value
|
|
2544
|
-
* and returns a boolean indicating whether the value matches the corresponding type.
|
|
2545
|
-
*
|
|
2546
|
-
* The `order` array defines the priority in which types should be checked,
|
|
2547
|
-
* which can be useful for functions that infer types in a consistent manner.
|
|
2548
|
-
*
|
|
2549
|
-
*/
|
|
2550
|
-
const typeValidator = {
|
|
2551
|
-
items: {},
|
|
2552
|
-
/**
|
|
2553
|
-
* Evaluation order of the type checkers.
|
|
2554
|
-
* @type {string[]}
|
|
2555
|
-
* */
|
|
2556
|
-
order: [],
|
|
2557
|
-
};
|
|
2558
|
-
|
|
2559
|
-
/** @typedef {Object.<string, (val: any) => *>} ExtendObjType */
|
|
2560
|
-
/** @typedef {Array<[string, (val: any) => *]>} ExtendObjTypeArray */
|
|
2561
|
-
|
|
2562
|
-
/**
|
|
2563
|
-
* Adds new type checkers to the typeValidator without overwriting existing ones.
|
|
2564
|
-
*
|
|
2565
|
-
* Accepts either an object with named functions or an array of [key, fn] arrays.
|
|
2566
|
-
* If no index is provided, the type is inserted just before 'object' (if it exists), or at the end.
|
|
2567
|
-
*
|
|
2568
|
-
* @param {ExtendObjType|ExtendObjTypeArray} newItems
|
|
2569
|
-
* - New type validators to be added.
|
|
2570
|
-
* @param {number} [index] - Optional. Position at which to insert each new type. Ignored if the type already exists.
|
|
2571
|
-
* @returns {string[]} - A list of successfully added type names.
|
|
2572
|
-
*
|
|
2573
|
-
* @example
|
|
2574
|
-
* extendObjType({
|
|
2575
|
-
* htmlElement2: val => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement
|
|
2576
|
-
* });
|
|
2577
|
-
*
|
|
2578
|
-
* @example
|
|
2579
|
-
* extendObjType([
|
|
2580
|
-
* ['alpha', val => typeof val === 'string'],
|
|
2581
|
-
* ['beta', val => Array.isArray(val)]
|
|
2582
|
-
* ]);
|
|
2583
|
-
*/
|
|
2584
|
-
function extendObjType(newItems, index) {
|
|
2585
|
-
const added = [];
|
|
2586
|
-
|
|
2587
|
-
const entries = Array.isArray(newItems) ? newItems : Object.entries(newItems);
|
|
2588
|
-
for (const [key, fn] of entries) {
|
|
2589
|
-
if (!typeValidator.items.hasOwnProperty(key)) {
|
|
2590
|
-
// @ts-ignore
|
|
2591
|
-
typeValidator.items[key] = fn;
|
|
2592
|
-
|
|
2593
|
-
let insertAt = typeof index === 'number' ? index : -1; // Default to -1 if index isn't provided
|
|
2594
|
-
|
|
2595
|
-
// Default to before 'object', or to the end
|
|
2596
|
-
if (insertAt === -1) {
|
|
2597
|
-
const objectIndex = typeValidator.order.indexOf('object');
|
|
2598
|
-
insertAt = objectIndex > -1 ? objectIndex : typeValidator.order.length;
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
|
-
// Ensure insertAt is a valid number and not out of bounds
|
|
2602
|
-
insertAt = Math.min(Math.max(0, insertAt), typeValidator.order.length);
|
|
2603
|
-
|
|
2604
|
-
typeValidator.order.splice(insertAt, 0, key);
|
|
2605
|
-
added.push(key);
|
|
2606
|
-
}
|
|
2607
|
-
}
|
|
2608
|
-
|
|
2609
|
-
return added;
|
|
2610
|
-
}
|
|
2611
|
-
|
|
2612
|
-
/**
|
|
2613
|
-
* Reorders the typeValidator.order array according to a custom new order.
|
|
2614
|
-
* All values in the new order must already exist in the current order.
|
|
2615
|
-
* The function does not mutate the original array structure directly.
|
|
2616
|
-
*
|
|
2617
|
-
* @param {string[]} newOrder - The new order of type names.
|
|
2618
|
-
* @returns {boolean} - Returns true if the reorder was successful, false if invalid keys were found.
|
|
2619
|
-
*
|
|
2620
|
-
* @example
|
|
2621
|
-
* reorderObjTypeOrder([
|
|
2622
|
-
* 'string', 'number', 'array', 'object'
|
|
2623
|
-
* ]);
|
|
2624
|
-
*/
|
|
2625
|
-
function reorderObjTypeOrder(newOrder) {
|
|
2626
|
-
const currentOrder = [...typeValidator.order]; // shallow clone
|
|
2627
|
-
|
|
2628
|
-
// All keys in newOrder must exist in currentOrder
|
|
2629
|
-
const isValid = newOrder.every((type) => currentOrder.includes(type));
|
|
2630
|
-
|
|
2631
|
-
if (!isValid) return false;
|
|
2632
|
-
|
|
2633
|
-
// Reassign only if valid
|
|
2634
|
-
typeValidator.order = newOrder.slice(); // assign shallow copy
|
|
2635
|
-
return true;
|
|
2636
|
-
}
|
|
2637
|
-
|
|
2638
|
-
/**
|
|
2639
|
-
* Returns a cloned version of the `typeValidator.order` array.
|
|
2640
|
-
* The cloned array will not be affected by future changes to the original `order`.
|
|
2641
|
-
*
|
|
2642
|
-
* @returns {string[]} - A new array with the same values as `typeValidator.order`.
|
|
2643
|
-
*/
|
|
2644
|
-
function cloneObjTypeOrder() {
|
|
2645
|
-
return [...typeValidator.order]; // Creates a shallow copy of the array
|
|
2646
|
-
}
|
|
2647
|
-
|
|
2648
|
-
/**
|
|
2649
|
-
* Returns the detected type name of a given value based on predefined type validators.
|
|
2650
|
-
*
|
|
2651
|
-
* This function uses `getType` with a predefined `typeValidator` to determine or compare types safely.
|
|
2652
|
-
* in the specified `typeValidator.order`. The first matching type is returned.
|
|
2653
|
-
*
|
|
2654
|
-
* If `val` is `null`, it immediately returns `'null'`.
|
|
2655
|
-
* If no match is found, it returns `'unknown'`.
|
|
2656
|
-
*
|
|
2657
|
-
* @param {any} val - The value whose type should be determined.
|
|
2658
|
-
* @returns {string} - The type name of the value (e.g., "array", "date", "map"), or "unknown" if no match is found.
|
|
2659
|
-
*
|
|
2660
|
-
* @example
|
|
2661
|
-
* getType([]); // "array"
|
|
2662
|
-
* getType(null); // "null"
|
|
2663
|
-
* getType(new Set()); // "set"
|
|
2664
|
-
* getType(() => {}); // "unknown"
|
|
2665
|
-
*/
|
|
2666
|
-
const getType = (val) => {
|
|
2667
|
-
if (val === null) return 'null';
|
|
2668
|
-
// @ts-ignore
|
|
2669
|
-
for (const name of typeValidator.order) {
|
|
2670
|
-
// @ts-ignore
|
|
2671
|
-
if (typeof typeValidator.items[name] !== 'function' || typeValidator.items[name](val))
|
|
2672
|
-
return name;
|
|
2673
|
-
}
|
|
2674
|
-
return 'unknown';
|
|
2675
|
-
};
|
|
2676
|
-
|
|
2677
|
-
/**
|
|
2678
|
-
* Checks the type of a given object or returns its type as a string.
|
|
2679
|
-
*
|
|
2680
|
-
* @param {*} obj - The object to check or identify.
|
|
2681
|
-
* @param {string} [type] - Optional. If provided, checks whether the object matches this type (e.g., "object", "array", "string").
|
|
2682
|
-
* @returns {boolean|string|null} - Returns `true` if the type matches, `false` if not,
|
|
2683
|
-
* the type string if no type is provided, or `null` if the object is `undefined`.
|
|
2684
|
-
*
|
|
2685
|
-
* @example
|
|
2686
|
-
* objType([], 'array'); // true
|
|
2687
|
-
* objType({}, 'object'); // true
|
|
2688
|
-
* objType('hello'); // "string"
|
|
2689
|
-
* objType(undefined); // null
|
|
2690
|
-
*/
|
|
2691
|
-
function objType(obj, type) {
|
|
2692
|
-
if (typeof obj === 'undefined') return null;
|
|
2693
|
-
const result = getType(obj);
|
|
2694
|
-
if (typeof type === 'string') return result === type.toLowerCase();
|
|
2695
|
-
return result;
|
|
2696
|
-
}
|
|
2697
|
-
|
|
2698
|
-
/**
|
|
2699
|
-
* Checks the type of a given object and returns the validation value if a known type is detected.
|
|
2700
|
-
*
|
|
2701
|
-
* @param {*} obj - The object to check or identify.
|
|
2702
|
-
* @returns {{ valid:*; type: string | null }} - Returns the type result.
|
|
2703
|
-
*/
|
|
2704
|
-
function checkObj(obj) {
|
|
2705
|
-
/** @type {{ valid:*; type: string | null }} */
|
|
2706
|
-
const data = { valid: null, type: null };
|
|
2707
|
-
for (const name of typeValidator.order) {
|
|
2708
|
-
// @ts-ignore
|
|
2709
|
-
if (typeof typeValidator.items[name] === 'function') {
|
|
2710
|
-
// @ts-ignore
|
|
2711
|
-
const result = typeValidator.items[name](obj);
|
|
2712
|
-
if (result) {
|
|
2713
|
-
data.valid = result;
|
|
2714
|
-
data.type = name;
|
|
2715
|
-
break;
|
|
2716
|
-
}
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
return data;
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
|
-
/**
|
|
2723
|
-
* Creates a clone of the functions from the `typeValidator` object.
|
|
2724
|
-
* It returns a new object where the keys are the same and the values are the cloned functions.
|
|
2725
|
-
*/
|
|
2726
|
-
function getCheckObj() {
|
|
2727
|
-
return Object.fromEntries(Object.entries(typeValidator.items).map(([key, fn]) => [key, fn]));
|
|
2728
|
-
}
|
|
2729
|
-
|
|
2533
|
+
;// ./src/v1/basics/objChecker.mjs
|
|
2730
2534
|
/**
|
|
2731
2535
|
* Counts the number of elements in an array or the number of properties in an object.
|
|
2732
2536
|
*
|
|
2733
|
-
* @param {Array<*>|Record<string|number, any>} obj - The array or object to count.
|
|
2537
|
+
* @param {Array<*>|Record<string | number | symbol, any>} obj - The array or object to count.
|
|
2734
2538
|
* @returns {number} - The count of items (array elements or object keys), or `0` if the input is neither an array nor an object.
|
|
2735
2539
|
*
|
|
2736
2540
|
* @example
|
|
@@ -2742,7 +2546,7 @@ function countObj(obj) {
|
|
|
2742
2546
|
// Is Array
|
|
2743
2547
|
if (Array.isArray(obj)) return obj.length;
|
|
2744
2548
|
// Object
|
|
2745
|
-
if (
|
|
2549
|
+
if (isJsonObject(obj)) return Object.keys(obj).length;
|
|
2746
2550
|
// Nothing
|
|
2747
2551
|
return 0;
|
|
2748
2552
|
}
|
|
@@ -2769,132 +2573,6 @@ function isJsonObject(value) {
|
|
|
2769
2573
|
return true;
|
|
2770
2574
|
}
|
|
2771
2575
|
|
|
2772
|
-
// Insert obj types
|
|
2773
|
-
|
|
2774
|
-
extendObjType([
|
|
2775
|
-
[
|
|
2776
|
-
'undefined',
|
|
2777
|
-
/** @param {*} val @returns {val is undefined} */
|
|
2778
|
-
(val) => typeof val === 'undefined',
|
|
2779
|
-
],
|
|
2780
|
-
[
|
|
2781
|
-
'null',
|
|
2782
|
-
/** @param {*} val @returns {val is null} */
|
|
2783
|
-
(val) => val === null,
|
|
2784
|
-
],
|
|
2785
|
-
[
|
|
2786
|
-
'boolean',
|
|
2787
|
-
/** @param {*} val @returns {val is boolean} */
|
|
2788
|
-
(val) => typeof val === 'boolean',
|
|
2789
|
-
],
|
|
2790
|
-
[
|
|
2791
|
-
'number',
|
|
2792
|
-
/** @param {*} val @returns {val is number} */
|
|
2793
|
-
(val) => typeof val === 'number' && !Number.isNaN(val),
|
|
2794
|
-
],
|
|
2795
|
-
[
|
|
2796
|
-
'bigint',
|
|
2797
|
-
/** @param {*} val @returns {val is bigint} */
|
|
2798
|
-
(val) => typeof val === 'bigint',
|
|
2799
|
-
],
|
|
2800
|
-
[
|
|
2801
|
-
'string',
|
|
2802
|
-
/** @param {*} val @returns {val is string} */
|
|
2803
|
-
(val) => typeof val === 'string',
|
|
2804
|
-
],
|
|
2805
|
-
[
|
|
2806
|
-
'symbol',
|
|
2807
|
-
/** @param {*} val @returns {val is symbol} */
|
|
2808
|
-
(val) => typeof val === 'symbol',
|
|
2809
|
-
],
|
|
2810
|
-
[
|
|
2811
|
-
'function',
|
|
2812
|
-
/** @param {*} val @returns {val is Function} */
|
|
2813
|
-
(val) => typeof val === 'function',
|
|
2814
|
-
],
|
|
2815
|
-
[
|
|
2816
|
-
'array',
|
|
2817
|
-
/** @param {*} val @returns {val is any[]} */
|
|
2818
|
-
(val) => Array.isArray(val),
|
|
2819
|
-
],
|
|
2820
|
-
]);
|
|
2821
|
-
|
|
2822
|
-
if (!isBrowser) {
|
|
2823
|
-
extendObjType([
|
|
2824
|
-
[
|
|
2825
|
-
'buffer',
|
|
2826
|
-
/** @param {*} val @returns {val is Buffer} */
|
|
2827
|
-
(val) => typeof buffer/* Buffer */.hp !== 'undefined' && buffer/* Buffer */.hp.isBuffer(val),
|
|
2828
|
-
],
|
|
2829
|
-
]);
|
|
2830
|
-
}
|
|
2831
|
-
|
|
2832
|
-
if (isBrowser) {
|
|
2833
|
-
extendObjType([
|
|
2834
|
-
[
|
|
2835
|
-
'file',
|
|
2836
|
-
/** @param {*} val @returns {val is File} */
|
|
2837
|
-
(val) => typeof File !== 'undefined' && val instanceof File,
|
|
2838
|
-
],
|
|
2839
|
-
]);
|
|
2840
|
-
}
|
|
2841
|
-
|
|
2842
|
-
extendObjType([
|
|
2843
|
-
[
|
|
2844
|
-
'date',
|
|
2845
|
-
/** @param {*} val @returns {val is Date} */
|
|
2846
|
-
(val) => val instanceof Date,
|
|
2847
|
-
],
|
|
2848
|
-
[
|
|
2849
|
-
'regexp',
|
|
2850
|
-
/** @param {*} val @returns {val is RegExp} */
|
|
2851
|
-
(val) => val instanceof RegExp,
|
|
2852
|
-
],
|
|
2853
|
-
[
|
|
2854
|
-
'map',
|
|
2855
|
-
/** @param {*} val @returns {val is Map<unknown, unknown>} */
|
|
2856
|
-
(val) => val instanceof Map,
|
|
2857
|
-
],
|
|
2858
|
-
[
|
|
2859
|
-
'set',
|
|
2860
|
-
/** @param {*} val @returns {val is Set<unknown>} */
|
|
2861
|
-
(val) => val instanceof Set,
|
|
2862
|
-
],
|
|
2863
|
-
[
|
|
2864
|
-
'weakmap',
|
|
2865
|
-
/** @param {*} val @returns {val is WeakMap<unknown, unknown>} */
|
|
2866
|
-
(val) => val instanceof WeakMap,
|
|
2867
|
-
],
|
|
2868
|
-
[
|
|
2869
|
-
'weakset',
|
|
2870
|
-
/** @param {*} val @returns {val is WeakSet<unknown>} */
|
|
2871
|
-
(val) => val instanceof WeakSet,
|
|
2872
|
-
],
|
|
2873
|
-
[
|
|
2874
|
-
'promise',
|
|
2875
|
-
/** @param {*} val @returns {val is Promise<unknown>} */
|
|
2876
|
-
(val) => val instanceof Promise,
|
|
2877
|
-
],
|
|
2878
|
-
]);
|
|
2879
|
-
|
|
2880
|
-
if (isBrowser) {
|
|
2881
|
-
extendObjType([
|
|
2882
|
-
[
|
|
2883
|
-
'htmlelement',
|
|
2884
|
-
/** @param {*} val @returns {val is HTMLElement} */
|
|
2885
|
-
(val) => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement,
|
|
2886
|
-
],
|
|
2887
|
-
]);
|
|
2888
|
-
}
|
|
2889
|
-
|
|
2890
|
-
extendObjType([
|
|
2891
|
-
[
|
|
2892
|
-
'object',
|
|
2893
|
-
/** @param {*} val @returns {val is Record<string | number | symbol, unknown>} */
|
|
2894
|
-
(val) => isJsonObject(val),
|
|
2895
|
-
],
|
|
2896
|
-
]);
|
|
2897
|
-
|
|
2898
2576
|
;// ./src/v1/basics/html.mjs
|
|
2899
2577
|
|
|
2900
2578
|
|
|
@@ -3179,8 +2857,8 @@ async function fetchBlob(url, allowedMimeTypes, options) {
|
|
|
3179
2857
|
* @param {Element} [settings.element=document.body] - The element to receive visibility classes.
|
|
3180
2858
|
* @param {string} [settings.hiddenClass='windowHidden'] - CSS class applied when the page is hidden.
|
|
3181
2859
|
* @param {string} [settings.visibleClass='windowVisible'] - CSS class applied when the page is visible.
|
|
3182
|
-
* @param {() => void} [settings.onVisible] - Callback called when page becomes visible.
|
|
3183
|
-
* @param {() => void} [settings.onHidden] - Callback called when page becomes hidden.
|
|
2860
|
+
* @param {(data: { type: string; oldType: string; oldClass: string; }) => void} [settings.onVisible] - Callback called when page becomes visible.
|
|
2861
|
+
* @param {(data: { type: string; oldType: string; oldClass: string; }) => void} [settings.onHidden] - Callback called when page becomes hidden.
|
|
3184
2862
|
* @returns {() => void} Function that removes all installed event listeners.
|
|
3185
2863
|
* @throws {TypeError} If any provided setting is invalid.
|
|
3186
2864
|
*/
|
|
@@ -3200,6 +2878,8 @@ function installWindowHiddenScript({
|
|
|
3200
2878
|
if (onHidden !== undefined && typeof onHidden !== 'function')
|
|
3201
2879
|
throw new TypeError(`"onHidden" must be a function if provided.`);
|
|
3202
2880
|
|
|
2881
|
+
let oldType = '';
|
|
2882
|
+
let oldClass = '';
|
|
3203
2883
|
const removeClass = () => {
|
|
3204
2884
|
element.classList.remove(hiddenClass);
|
|
3205
2885
|
element.classList.remove(visibleClass);
|
|
@@ -3237,19 +2917,24 @@ function installWindowHiddenScript({
|
|
|
3237
2917
|
|
|
3238
2918
|
if (visibleEvents.includes(type)) {
|
|
3239
2919
|
element.classList.add(visibleClass);
|
|
3240
|
-
onVisible?.();
|
|
2920
|
+
onVisible?.({ type, oldClass, oldType });
|
|
2921
|
+
oldClass = visibleClass;
|
|
3241
2922
|
} else if (hiddenEvents.includes(type)) {
|
|
3242
2923
|
element.classList.add(hiddenClass);
|
|
3243
|
-
onHidden?.();
|
|
2924
|
+
onHidden?.({ type, oldClass, oldType });
|
|
2925
|
+
oldClass = hiddenClass;
|
|
3244
2926
|
} else {
|
|
3245
2927
|
if (isHidden) {
|
|
3246
2928
|
element.classList.add(hiddenClass);
|
|
3247
|
-
onHidden?.();
|
|
2929
|
+
onHidden?.({ type, oldClass, oldType });
|
|
2930
|
+
oldClass = hiddenClass;
|
|
3248
2931
|
} else {
|
|
3249
2932
|
element.classList.add(visibleClass);
|
|
3250
|
-
onVisible?.();
|
|
2933
|
+
onVisible?.({ type, oldClass, oldType });
|
|
2934
|
+
oldClass = visibleClass;
|
|
3251
2935
|
}
|
|
3252
2936
|
}
|
|
2937
|
+
oldType = type;
|
|
3253
2938
|
};
|
|
3254
2939
|
|
|
3255
2940
|
/** @type {() => void} */
|
|
@@ -8791,94 +8476,420 @@ function areHtmlElsPerfColliding(elem1, elem2) {
|
|
|
8791
8476
|
return TinyHtml.isCollPerfWith(elem1, elem2);
|
|
8792
8477
|
}
|
|
8793
8478
|
|
|
8794
|
-
///////////////////////////////////////////////////////////////////////////
|
|
8479
|
+
///////////////////////////////////////////////////////////////////////////
|
|
8480
|
+
|
|
8481
|
+
/**
|
|
8482
|
+
* @typedef {import('../libs/TinyHtml.mjs').HtmlElBoxSides} HtmlElBoxSides
|
|
8483
|
+
*/
|
|
8484
|
+
|
|
8485
|
+
/**
|
|
8486
|
+
* Returns the total border width and individual sides from `border{Side}Width` CSS properties.
|
|
8487
|
+
*
|
|
8488
|
+
* @param {Element} el - The target DOM element.
|
|
8489
|
+
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border widths, and each side individually.
|
|
8490
|
+
* @deprecated - Use TinyHtml.borderWidth instead.
|
|
8491
|
+
*/
|
|
8492
|
+
const getHtmlElBordersWidth = (el) => {
|
|
8493
|
+
return libs_TinyHtml.borderWidth(el);
|
|
8494
|
+
};
|
|
8495
|
+
|
|
8496
|
+
/**
|
|
8497
|
+
* Returns the total border size and individual sides from `border{Side}` CSS properties.
|
|
8498
|
+
*
|
|
8499
|
+
* @param {Element} el - The target DOM element.
|
|
8500
|
+
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border sizes, and each side individually.
|
|
8501
|
+
* @deprecated - Use TinyHtml.border instead.
|
|
8502
|
+
*/
|
|
8503
|
+
const getHtmlElBorders = (el) => {
|
|
8504
|
+
return libs_TinyHtml.border(el);
|
|
8505
|
+
};
|
|
8506
|
+
|
|
8507
|
+
/**
|
|
8508
|
+
* Returns the total margin and individual sides from `margin{Side}` CSS properties.
|
|
8509
|
+
*
|
|
8510
|
+
* @param {Element} el - The target DOM element.
|
|
8511
|
+
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) margins, and each side individually.
|
|
8512
|
+
* @deprecated - Use TinyHtml.margin instead.
|
|
8513
|
+
*/
|
|
8514
|
+
const getHtmlElMargin = (el) => {
|
|
8515
|
+
return libs_TinyHtml.margin(el);
|
|
8516
|
+
};
|
|
8517
|
+
|
|
8518
|
+
/**
|
|
8519
|
+
* Returns the total padding and individual sides from `padding{Side}` CSS properties.
|
|
8520
|
+
*
|
|
8521
|
+
* @param {Element} el - The target DOM element.
|
|
8522
|
+
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) paddings, and each side individually.
|
|
8523
|
+
* @deprecated - Use TinyHtml.padding instead.
|
|
8524
|
+
*/
|
|
8525
|
+
const getHtmlElPadding = (el) => {
|
|
8526
|
+
return libs_TinyHtml.padding(el);
|
|
8527
|
+
};
|
|
8528
|
+
|
|
8529
|
+
/////////////////////////////////////////////////////////////
|
|
8530
|
+
|
|
8531
|
+
// The new version will receive great modifications, the deprecated code has been preserved for non-glitch designs that are using the original code.
|
|
8532
|
+
|
|
8533
|
+
/**
|
|
8534
|
+
* Checks if the given element is at least partially visible in the viewport.
|
|
8535
|
+
*
|
|
8536
|
+
* @param {HTMLElement} element - The DOM element to check.
|
|
8537
|
+
* @returns {boolean} True if the element is partially in the viewport, false otherwise.
|
|
8538
|
+
* @deprecated - Use TinyHtml.isInViewport instead.
|
|
8539
|
+
*/
|
|
8540
|
+
function isInViewport(element) {
|
|
8541
|
+
const elementTop = element.offsetTop;
|
|
8542
|
+
const elementBottom = elementTop + element.offsetHeight;
|
|
8543
|
+
|
|
8544
|
+
const viewportTop = window.scrollY;
|
|
8545
|
+
const viewportBottom = viewportTop + window.innerHeight;
|
|
8546
|
+
|
|
8547
|
+
return elementBottom > viewportTop && elementTop < viewportBottom;
|
|
8548
|
+
}
|
|
8549
|
+
|
|
8550
|
+
/**
|
|
8551
|
+
* Checks if the given element is fully visible in the viewport (top and bottom).
|
|
8552
|
+
*
|
|
8553
|
+
* @param {HTMLElement} element - The DOM element to check.
|
|
8554
|
+
* @returns {boolean} True if the element is fully visible in the viewport, false otherwise.
|
|
8555
|
+
* @deprecated - Use TinyHtml.isScrolledIntoView instead.
|
|
8556
|
+
*/
|
|
8557
|
+
function isScrolledIntoView(element) {
|
|
8558
|
+
const viewportTop = window.scrollY;
|
|
8559
|
+
const viewportBottom = viewportTop + window.innerHeight;
|
|
8560
|
+
|
|
8561
|
+
const elemTop = element.offsetTop;
|
|
8562
|
+
const elemBottom = elemTop + element.offsetHeight;
|
|
8563
|
+
|
|
8564
|
+
return elemBottom <= viewportBottom && elemTop >= viewportTop;
|
|
8565
|
+
}
|
|
8566
|
+
|
|
8567
|
+
// EXTERNAL MODULE: ./node_modules/buffer/index.js
|
|
8568
|
+
var buffer = __webpack_require__(287);
|
|
8569
|
+
;// ./src/v1/basics/objFilter.mjs
|
|
8570
|
+
|
|
8571
|
+
|
|
8572
|
+
|
|
8573
|
+
|
|
8574
|
+
|
|
8575
|
+
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
8576
|
+
|
|
8577
|
+
/**
|
|
8578
|
+
* An object containing type validation functions and their evaluation order.
|
|
8579
|
+
*
|
|
8580
|
+
* Each item in `typeValidator.items` is a function that receives any value
|
|
8581
|
+
* and returns a boolean indicating whether the value matches the corresponding type.
|
|
8582
|
+
*
|
|
8583
|
+
* The `order` array defines the priority in which types should be checked,
|
|
8584
|
+
* which can be useful for functions that infer types in a consistent manner.
|
|
8585
|
+
*
|
|
8586
|
+
*/
|
|
8587
|
+
const typeValidator = {
|
|
8588
|
+
items: {},
|
|
8589
|
+
/**
|
|
8590
|
+
* Evaluation order of the type checkers.
|
|
8591
|
+
* @type {string[]}
|
|
8592
|
+
* */
|
|
8593
|
+
order: [],
|
|
8594
|
+
};
|
|
8595
|
+
|
|
8596
|
+
/** @typedef {Object.<string, (val: any) => *>} ExtendObjType */
|
|
8597
|
+
/** @typedef {Array<[string, (val: any) => *]>} ExtendObjTypeArray */
|
|
8598
|
+
|
|
8599
|
+
/**
|
|
8600
|
+
* Adds new type checkers to the typeValidator without overwriting existing ones.
|
|
8601
|
+
*
|
|
8602
|
+
* Accepts either an object with named functions or an array of [key, fn] arrays.
|
|
8603
|
+
* If no index is provided, the type is inserted just before 'object' (if it exists), or at the end.
|
|
8604
|
+
*
|
|
8605
|
+
* @param {ExtendObjType|ExtendObjTypeArray} newItems
|
|
8606
|
+
* - New type validators to be added.
|
|
8607
|
+
* @param {number} [index] - Optional. Position at which to insert each new type. Ignored if the type already exists.
|
|
8608
|
+
* @returns {string[]} - A list of successfully added type names.
|
|
8609
|
+
*
|
|
8610
|
+
* @example
|
|
8611
|
+
* extendObjType({
|
|
8612
|
+
* htmlElement2: val => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement
|
|
8613
|
+
* });
|
|
8614
|
+
*
|
|
8615
|
+
* @example
|
|
8616
|
+
* extendObjType([
|
|
8617
|
+
* ['alpha', val => typeof val === 'string'],
|
|
8618
|
+
* ['beta', val => Array.isArray(val)]
|
|
8619
|
+
* ]);
|
|
8620
|
+
*/
|
|
8621
|
+
function extendObjType(newItems, index) {
|
|
8622
|
+
const added = [];
|
|
8623
|
+
|
|
8624
|
+
const entries = Array.isArray(newItems) ? newItems : Object.entries(newItems);
|
|
8625
|
+
for (const [key, fn] of entries) {
|
|
8626
|
+
if (!typeValidator.items.hasOwnProperty(key)) {
|
|
8627
|
+
// @ts-ignore
|
|
8628
|
+
typeValidator.items[key] = fn;
|
|
8629
|
+
|
|
8630
|
+
let insertAt = typeof index === 'number' ? index : -1; // Default to -1 if index isn't provided
|
|
8631
|
+
|
|
8632
|
+
// Default to before 'object', or to the end
|
|
8633
|
+
if (insertAt === -1) {
|
|
8634
|
+
const objectIndex = typeValidator.order.indexOf('object');
|
|
8635
|
+
insertAt = objectIndex > -1 ? objectIndex : typeValidator.order.length;
|
|
8636
|
+
}
|
|
8637
|
+
|
|
8638
|
+
// Ensure insertAt is a valid number and not out of bounds
|
|
8639
|
+
insertAt = Math.min(Math.max(0, insertAt), typeValidator.order.length);
|
|
8640
|
+
|
|
8641
|
+
typeValidator.order.splice(insertAt, 0, key);
|
|
8642
|
+
added.push(key);
|
|
8643
|
+
}
|
|
8644
|
+
}
|
|
8645
|
+
|
|
8646
|
+
return added;
|
|
8647
|
+
}
|
|
8648
|
+
|
|
8649
|
+
/**
|
|
8650
|
+
* Reorders the typeValidator.order array according to a custom new order.
|
|
8651
|
+
* All values in the new order must already exist in the current order.
|
|
8652
|
+
* The function does not mutate the original array structure directly.
|
|
8653
|
+
*
|
|
8654
|
+
* @param {string[]} newOrder - The new order of type names.
|
|
8655
|
+
* @returns {boolean} - Returns true if the reorder was successful, false if invalid keys were found.
|
|
8656
|
+
*
|
|
8657
|
+
* @example
|
|
8658
|
+
* reorderObjTypeOrder([
|
|
8659
|
+
* 'string', 'number', 'array', 'object'
|
|
8660
|
+
* ]);
|
|
8661
|
+
*/
|
|
8662
|
+
function reorderObjTypeOrder(newOrder) {
|
|
8663
|
+
const currentOrder = [...typeValidator.order]; // shallow clone
|
|
8664
|
+
|
|
8665
|
+
// All keys in newOrder must exist in currentOrder
|
|
8666
|
+
const isValid = newOrder.every((type) => currentOrder.includes(type));
|
|
8667
|
+
|
|
8668
|
+
if (!isValid) return false;
|
|
8795
8669
|
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8670
|
+
// Reassign only if valid
|
|
8671
|
+
typeValidator.order = newOrder.slice(); // assign shallow copy
|
|
8672
|
+
return true;
|
|
8673
|
+
}
|
|
8799
8674
|
|
|
8800
8675
|
/**
|
|
8801
|
-
* Returns
|
|
8676
|
+
* Returns a cloned version of the `typeValidator.order` array.
|
|
8677
|
+
* The cloned array will not be affected by future changes to the original `order`.
|
|
8802
8678
|
*
|
|
8803
|
-
* @
|
|
8804
|
-
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border widths, and each side individually.
|
|
8805
|
-
* @deprecated - Use TinyHtml.borderWidth instead.
|
|
8679
|
+
* @returns {string[]} - A new array with the same values as `typeValidator.order`.
|
|
8806
8680
|
*/
|
|
8807
|
-
|
|
8808
|
-
return
|
|
8809
|
-
}
|
|
8681
|
+
function cloneObjTypeOrder() {
|
|
8682
|
+
return [...typeValidator.order]; // Creates a shallow copy of the array
|
|
8683
|
+
}
|
|
8810
8684
|
|
|
8811
8685
|
/**
|
|
8812
|
-
* Returns the
|
|
8686
|
+
* Returns the detected type name of a given value based on predefined type validators.
|
|
8813
8687
|
*
|
|
8814
|
-
*
|
|
8815
|
-
*
|
|
8816
|
-
*
|
|
8688
|
+
* This function uses `getType` with a predefined `typeValidator` to determine or compare types safely.
|
|
8689
|
+
* in the specified `typeValidator.order`. The first matching type is returned.
|
|
8690
|
+
*
|
|
8691
|
+
* If `val` is `null`, it immediately returns `'null'`.
|
|
8692
|
+
* If no match is found, it returns `'unknown'`.
|
|
8693
|
+
*
|
|
8694
|
+
* @param {any} val - The value whose type should be determined.
|
|
8695
|
+
* @returns {string} - The type name of the value (e.g., "array", "date", "map"), or "unknown" if no match is found.
|
|
8696
|
+
*
|
|
8697
|
+
* @example
|
|
8698
|
+
* getType([]); // "array"
|
|
8699
|
+
* getType(null); // "null"
|
|
8700
|
+
* getType(new Set()); // "set"
|
|
8701
|
+
* getType(() => {}); // "unknown"
|
|
8817
8702
|
*/
|
|
8818
|
-
const
|
|
8819
|
-
|
|
8703
|
+
const getType = (val) => {
|
|
8704
|
+
if (val === null) return 'null';
|
|
8705
|
+
// @ts-ignore
|
|
8706
|
+
for (const name of typeValidator.order) {
|
|
8707
|
+
// @ts-ignore
|
|
8708
|
+
if (typeof typeValidator.items[name] !== 'function' || typeValidator.items[name](val))
|
|
8709
|
+
return name;
|
|
8710
|
+
}
|
|
8711
|
+
return 'unknown';
|
|
8820
8712
|
};
|
|
8821
8713
|
|
|
8822
8714
|
/**
|
|
8823
|
-
*
|
|
8715
|
+
* Checks the type of a given object or returns its type as a string.
|
|
8824
8716
|
*
|
|
8825
|
-
* @param {
|
|
8826
|
-
* @
|
|
8827
|
-
* @
|
|
8717
|
+
* @param {*} obj - The object to check or identify.
|
|
8718
|
+
* @param {string} [type] - Optional. If provided, checks whether the object matches this type (e.g., "object", "array", "string").
|
|
8719
|
+
* @returns {boolean|string|null} - Returns `true` if the type matches, `false` if not,
|
|
8720
|
+
* the type string if no type is provided, or `null` if the object is `undefined`.
|
|
8721
|
+
*
|
|
8722
|
+
* @example
|
|
8723
|
+
* objType([], 'array'); // true
|
|
8724
|
+
* objType({}, 'object'); // true
|
|
8725
|
+
* objType('hello'); // "string"
|
|
8726
|
+
* objType(undefined); // null
|
|
8828
8727
|
*/
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8728
|
+
function objType(obj, type) {
|
|
8729
|
+
if (typeof obj === 'undefined') return null;
|
|
8730
|
+
const result = getType(obj);
|
|
8731
|
+
if (typeof type === 'string') return result === type.toLowerCase();
|
|
8732
|
+
return result;
|
|
8733
|
+
}
|
|
8832
8734
|
|
|
8833
8735
|
/**
|
|
8834
|
-
*
|
|
8736
|
+
* Checks the type of a given object and returns the validation value if a known type is detected.
|
|
8835
8737
|
*
|
|
8836
|
-
* @param {
|
|
8837
|
-
* @returns {
|
|
8838
|
-
* @deprecated - Use TinyHtml.padding instead.
|
|
8738
|
+
* @param {*} obj - The object to check or identify.
|
|
8739
|
+
* @returns {{ valid:*; type: string | null }} - Returns the type result.
|
|
8839
8740
|
*/
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
};
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
//
|
|
8741
|
+
function checkObj(obj) {
|
|
8742
|
+
/** @type {{ valid:*; type: string | null }} */
|
|
8743
|
+
const data = { valid: null, type: null };
|
|
8744
|
+
for (const name of typeValidator.order) {
|
|
8745
|
+
// @ts-ignore
|
|
8746
|
+
if (typeof typeValidator.items[name] === 'function') {
|
|
8747
|
+
// @ts-ignore
|
|
8748
|
+
const result = typeValidator.items[name](obj);
|
|
8749
|
+
if (result) {
|
|
8750
|
+
data.valid = result;
|
|
8751
|
+
data.type = name;
|
|
8752
|
+
break;
|
|
8753
|
+
}
|
|
8754
|
+
}
|
|
8755
|
+
}
|
|
8756
|
+
return data;
|
|
8757
|
+
}
|
|
8847
8758
|
|
|
8848
8759
|
/**
|
|
8849
|
-
*
|
|
8850
|
-
*
|
|
8851
|
-
* @param {HTMLElement} element - The DOM element to check.
|
|
8852
|
-
* @returns {boolean} True if the element is partially in the viewport, false otherwise.
|
|
8853
|
-
* @deprecated - Use TinyHtml.isInViewport instead.
|
|
8760
|
+
* Creates a clone of the functions from the `typeValidator` object.
|
|
8761
|
+
* It returns a new object where the keys are the same and the values are the cloned functions.
|
|
8854
8762
|
*/
|
|
8855
|
-
function
|
|
8856
|
-
|
|
8857
|
-
|
|
8763
|
+
function getCheckObj() {
|
|
8764
|
+
return Object.fromEntries(Object.entries(typeValidator.items).map(([key, fn]) => [key, fn]));
|
|
8765
|
+
}
|
|
8858
8766
|
|
|
8859
|
-
|
|
8860
|
-
const viewportBottom = viewportTop + window.innerHeight;
|
|
8767
|
+
// Insert obj types
|
|
8861
8768
|
|
|
8862
|
-
|
|
8769
|
+
extendObjType([
|
|
8770
|
+
[
|
|
8771
|
+
'undefined',
|
|
8772
|
+
/** @param {*} val @returns {val is undefined} */
|
|
8773
|
+
(val) => typeof val === 'undefined',
|
|
8774
|
+
],
|
|
8775
|
+
[
|
|
8776
|
+
'null',
|
|
8777
|
+
/** @param {*} val @returns {val is null} */
|
|
8778
|
+
(val) => val === null,
|
|
8779
|
+
],
|
|
8780
|
+
[
|
|
8781
|
+
'boolean',
|
|
8782
|
+
/** @param {*} val @returns {val is boolean} */
|
|
8783
|
+
(val) => typeof val === 'boolean',
|
|
8784
|
+
],
|
|
8785
|
+
[
|
|
8786
|
+
'number',
|
|
8787
|
+
/** @param {*} val @returns {val is number} */
|
|
8788
|
+
(val) => typeof val === 'number' && !Number.isNaN(val),
|
|
8789
|
+
],
|
|
8790
|
+
[
|
|
8791
|
+
'bigint',
|
|
8792
|
+
/** @param {*} val @returns {val is bigint} */
|
|
8793
|
+
(val) => typeof val === 'bigint',
|
|
8794
|
+
],
|
|
8795
|
+
[
|
|
8796
|
+
'string',
|
|
8797
|
+
/** @param {*} val @returns {val is string} */
|
|
8798
|
+
(val) => typeof val === 'string',
|
|
8799
|
+
],
|
|
8800
|
+
[
|
|
8801
|
+
'symbol',
|
|
8802
|
+
/** @param {*} val @returns {val is symbol} */
|
|
8803
|
+
(val) => typeof val === 'symbol',
|
|
8804
|
+
],
|
|
8805
|
+
[
|
|
8806
|
+
'function',
|
|
8807
|
+
/** @param {*} val @returns {val is Function} */
|
|
8808
|
+
(val) => typeof val === 'function',
|
|
8809
|
+
],
|
|
8810
|
+
[
|
|
8811
|
+
'array',
|
|
8812
|
+
/** @param {*} val @returns {val is any[]} */
|
|
8813
|
+
(val) => Array.isArray(val),
|
|
8814
|
+
],
|
|
8815
|
+
]);
|
|
8816
|
+
|
|
8817
|
+
if (!isBrowser) {
|
|
8818
|
+
extendObjType([
|
|
8819
|
+
[
|
|
8820
|
+
'buffer',
|
|
8821
|
+
/** @param {*} val @returns {val is Buffer} */
|
|
8822
|
+
(val) => typeof buffer/* Buffer */.hp !== 'undefined' && buffer/* Buffer */.hp.isBuffer(val),
|
|
8823
|
+
],
|
|
8824
|
+
]);
|
|
8863
8825
|
}
|
|
8864
8826
|
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
const viewportBottom = viewportTop + window.innerHeight;
|
|
8827
|
+
if (isBrowser) {
|
|
8828
|
+
extendObjType([
|
|
8829
|
+
[
|
|
8830
|
+
'file',
|
|
8831
|
+
/** @param {*} val @returns {val is File} */
|
|
8832
|
+
(val) => typeof File !== 'undefined' && val instanceof File,
|
|
8833
|
+
],
|
|
8834
|
+
]);
|
|
8835
|
+
}
|
|
8875
8836
|
|
|
8876
|
-
|
|
8877
|
-
|
|
8837
|
+
extendObjType([
|
|
8838
|
+
[
|
|
8839
|
+
'date',
|
|
8840
|
+
/** @param {*} val @returns {val is Date} */
|
|
8841
|
+
(val) => val instanceof Date,
|
|
8842
|
+
],
|
|
8843
|
+
[
|
|
8844
|
+
'regexp',
|
|
8845
|
+
/** @param {*} val @returns {val is RegExp} */
|
|
8846
|
+
(val) => val instanceof RegExp,
|
|
8847
|
+
],
|
|
8848
|
+
[
|
|
8849
|
+
'map',
|
|
8850
|
+
/** @param {*} val @returns {val is Map<unknown, unknown>} */
|
|
8851
|
+
(val) => val instanceof Map,
|
|
8852
|
+
],
|
|
8853
|
+
[
|
|
8854
|
+
'set',
|
|
8855
|
+
/** @param {*} val @returns {val is Set<unknown>} */
|
|
8856
|
+
(val) => val instanceof Set,
|
|
8857
|
+
],
|
|
8858
|
+
[
|
|
8859
|
+
'weakmap',
|
|
8860
|
+
/** @param {*} val @returns {val is WeakMap<unknown, unknown>} */
|
|
8861
|
+
(val) => val instanceof WeakMap,
|
|
8862
|
+
],
|
|
8863
|
+
[
|
|
8864
|
+
'weakset',
|
|
8865
|
+
/** @param {*} val @returns {val is WeakSet<unknown>} */
|
|
8866
|
+
(val) => val instanceof WeakSet,
|
|
8867
|
+
],
|
|
8868
|
+
[
|
|
8869
|
+
'promise',
|
|
8870
|
+
/** @param {*} val @returns {val is Promise<unknown>} */
|
|
8871
|
+
(val) => val instanceof Promise,
|
|
8872
|
+
],
|
|
8873
|
+
]);
|
|
8878
8874
|
|
|
8879
|
-
|
|
8875
|
+
if (isBrowser) {
|
|
8876
|
+
extendObjType([
|
|
8877
|
+
[
|
|
8878
|
+
'htmlelement',
|
|
8879
|
+
/** @param {*} val @returns {val is HTMLElement} */
|
|
8880
|
+
(val) => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement,
|
|
8881
|
+
],
|
|
8882
|
+
]);
|
|
8880
8883
|
}
|
|
8881
8884
|
|
|
8885
|
+
extendObjType([
|
|
8886
|
+
[
|
|
8887
|
+
'object',
|
|
8888
|
+
/** @param {*} val @returns {val is Record<string | number | symbol, unknown>} */
|
|
8889
|
+
(val) => isJsonObject(val),
|
|
8890
|
+
],
|
|
8891
|
+
]);
|
|
8892
|
+
|
|
8882
8893
|
;// ./src/v1/basics/fullScreen.mjs
|
|
8883
8894
|
/**
|
|
8884
8895
|
* Checks if the document is currently in fullscreen mode.
|
|
@@ -9315,6 +9326,7 @@ export default KeyPressHandler;
|
|
|
9315
9326
|
|
|
9316
9327
|
|
|
9317
9328
|
|
|
9329
|
+
|
|
9318
9330
|
})();
|
|
9319
9331
|
|
|
9320
9332
|
window.TinyBasicsEs = __webpack_exports__;
|