@design-edito/tools 0.0.33 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/agnostic/arrays/index.d.ts +11 -0
- package/{utils/agnostic → agnostic/arrays}/is-array-of/index.d.ts +2 -2
- package/agnostic/arrays/is-array-of/index.js +23 -0
- package/agnostic/async/index.d.ts +8 -0
- package/agnostic/async/index.js +20 -0
- package/agnostic/async/timeout-call/index.d.ts +1 -0
- package/agnostic/async/timeout-call/index.js +6 -0
- package/agnostic/async/transitions/index.d.ts +41 -0
- package/agnostic/async/transitions/index.js +7 -0
- package/agnostic/async/wait/index.d.ts +1 -0
- package/agnostic/async/wait/index.js +6 -0
- package/agnostic/booleans/index.d.ts +8 -0
- package/agnostic/booleans/index.js +17 -0
- package/{utils/agnostic → agnostic/booleans}/is-falsy/index.d.ts +1 -2
- package/agnostic/booleans/is-falsy/index.js +11 -0
- package/agnostic/css/bem/index.d.ts +7 -0
- package/agnostic/css/bem/index.js +9 -0
- package/{utils/agnostic → agnostic/css}/generate-nice-color/index.d.ts +0 -1
- package/agnostic/css/generate-nice-color/index.js +8 -0
- package/agnostic/css/index.d.ts +14 -0
- package/agnostic/css/index.js +177 -0
- package/agnostic/css/is-valid-css-class-name/index.d.ts +2 -0
- package/agnostic/css/is-valid-css-class-name/index.js +8 -0
- package/agnostic/css/styles-set/index.d.ts +37 -0
- package/agnostic/errors/index.d.ts +30 -0
- package/agnostic/errors/index.js +6 -0
- package/agnostic/html/get-node-ancestors/index.d.ts +1 -0
- package/agnostic/html/get-node-ancestors/index.js +6 -0
- package/agnostic/html/get-position-inside-parent/index.d.ts +1 -0
- package/agnostic/html/get-position-inside-parent/index.js +6 -0
- package/agnostic/html/index.d.ts +17 -0
- package/agnostic/html/index.js +39 -0
- package/agnostic/html/insert-node/index.d.ts +2 -0
- package/agnostic/html/insert-node/index.js +6 -0
- package/agnostic/html/placeholders/index.d.ts +9 -0
- package/agnostic/html/placeholders/index.js +6 -0
- package/agnostic/html/sanitize/index.d.ts +24 -0
- package/agnostic/html/sanitize/index.js +9 -0
- package/agnostic/html/selector-to-element/index.d.ts +1 -0
- package/agnostic/html/selector-to-element/index.js +9 -0
- package/agnostic/html/string-to-nodes/index.d.ts +7 -0
- package/agnostic/html/string-to-nodes/index.js +10 -0
- package/agnostic/index.d.ts +26 -0
- package/agnostic/misc/assert/index.d.ts +5 -0
- package/agnostic/misc/assert/index.js +6 -0
- package/agnostic/misc/cast/index.d.ts +9 -0
- package/agnostic/misc/cast/index.js +8 -0
- package/agnostic/misc/crossenv/index.d.ts +13 -0
- package/agnostic/misc/crossenv/index.js +6 -0
- package/agnostic/misc/get-current-downlink/index.d.ts +1 -0
- package/agnostic/misc/get-current-downlink/index.js +6 -0
- package/agnostic/misc/index.d.ts +22 -0
- package/agnostic/misc/index.js +45 -0
- package/{utils/agnostic → agnostic/misc}/is-constructor-function/index.d.ts +1 -1
- package/agnostic/misc/is-constructor-function/index.js +6 -0
- package/{utils/agnostic → agnostic/misc}/is-nullish/index.d.ts +0 -1
- package/agnostic/misc/is-nullish/index.js +10 -0
- package/agnostic/misc/logs/index.d.ts +55 -0
- package/agnostic/misc/logs/index.js +6 -0
- package/agnostic/misc/random/index.d.ts +10 -0
- package/agnostic/misc/random/index.js +6 -0
- package/agnostic/numbers/absolute-modulo/index.d.ts +1 -0
- package/agnostic/numbers/absolute-modulo/index.js +6 -0
- package/agnostic/numbers/clamp/index.d.ts +1 -0
- package/agnostic/numbers/clamp/index.js +6 -0
- package/agnostic/numbers/index.d.ts +13 -0
- package/agnostic/numbers/index.js +30 -0
- package/agnostic/numbers/interpolate/index.d.ts +1 -0
- package/agnostic/numbers/interpolate/index.js +6 -0
- package/agnostic/numbers/responsive-harmonics/index.js +9 -0
- package/agnostic/numbers/round/index.d.ts +1 -0
- package/agnostic/numbers/round/index.js +6 -0
- package/agnostic/objects/enums/index.d.ts +4 -0
- package/agnostic/objects/enums/index.js +7 -0
- package/{utils/agnostic → agnostic/objects/enums}/is-in-enum/index.d.ts +1 -1
- package/agnostic/objects/enums/is-in-enum/index.js +6 -0
- package/agnostic/objects/flatten-getters/index.d.ts +1 -0
- package/agnostic/objects/flatten-getters/index.js +9 -0
- package/agnostic/objects/index.d.ts +12 -0
- package/agnostic/objects/index.js +32 -0
- package/agnostic/objects/is-object/index.d.ts +1 -0
- package/agnostic/objects/is-object/index.js +6 -0
- package/agnostic/objects/is-record/index.d.ts +1 -0
- package/agnostic/objects/is-record/index.js +6 -0
- package/agnostic/objects/record-format/index.js +16 -0
- package/agnostic/objects/validation/index.d.ts +3 -0
- package/agnostic/objects/validation/index.js +6 -0
- package/agnostic/optim/index.d.ts +7 -0
- package/agnostic/optim/index.js +18 -0
- package/{utils/agnostic → agnostic/optim}/memoize/index.d.ts +1 -1
- package/agnostic/optim/memoize/index.js +6 -0
- package/agnostic/optim/throttle-debounce/index.js +8 -0
- package/{utils/agnostic → agnostic/optim}/throttle-debounce/types.d.ts +0 -1
- package/agnostic/regexps/index.d.ts +23 -0
- package/agnostic/regexps/index.js +89 -0
- package/agnostic/strings/char-codes/index.d.ts +17 -0
- package/agnostic/strings/char-codes/index.js +6 -0
- package/agnostic/strings/index.d.ts +14 -0
- package/agnostic/strings/index.js +32 -0
- package/agnostic/strings/matches/index.d.ts +3 -0
- package/agnostic/strings/matches/index.js +10 -0
- package/agnostic/strings/normalize-indent/index.d.ts +1 -0
- package/agnostic/strings/normalize-indent/index.js +6 -0
- package/{utils/agnostic → agnostic/strings}/replace-all/index.d.ts +1 -1
- package/agnostic/strings/replace-all/index.js +6 -0
- package/agnostic/strings/to-alphanum/index.d.ts +1 -0
- package/agnostic/strings/to-alphanum/index.js +6 -0
- package/chunks/chunk-32IRF4OP.js +9 -0
- package/chunks/chunk-34U4HX4V.js +73 -0
- package/chunks/chunk-4GDNHUCZ.js +162 -0
- package/chunks/chunk-4QQBKBYH.js +59 -0
- package/chunks/chunk-4VC5PT5T.js +13 -0
- package/chunks/chunk-5LNUCDQ6.js +132 -0
- package/chunks/chunk-7AWTHZLY.js +12 -0
- package/chunks/chunk-7DBNMU6N.js +14 -0
- package/chunks/chunk-7YW5HL6N.js +168 -0
- package/chunks/chunk-COVPTTAD.js +10 -0
- package/chunks/chunk-DNIOWD7K.js +8 -0
- package/chunks/chunk-DQNJQBC6.js +10 -0
- package/chunks/chunk-E6MSDKON.js +13 -0
- package/chunks/chunk-EDVNAV3G.js +72 -0
- package/chunks/chunk-EW46EXFB.js +8 -0
- package/chunks/chunk-FPEW3A27.js +14 -0
- package/chunks/chunk-GJOU3UAL.js +36 -0
- package/chunks/chunk-HC6ZOHCS.js +14 -0
- package/chunks/chunk-HGCG2J77.js +122 -0
- package/chunks/chunk-IFD7GSGK.js +130 -0
- package/chunks/chunk-JQXNEJAP.js +18 -0
- package/chunks/chunk-JWBDZPQG.js +18 -0
- package/chunks/chunk-K37RALUX.js +8 -0
- package/chunks/chunk-KQT5CTGF.js +21 -0
- package/chunks/chunk-LEXQ6E6L.js +31 -0
- package/chunks/chunk-LQFKUNVQ.js +19 -0
- package/chunks/chunk-MF56TTC5.js +15 -0
- package/chunks/chunk-MT74WIQR.js +41 -0
- package/chunks/chunk-NRITRUZW.js +10 -0
- package/chunks/chunk-NRJQKVQV.js +31 -0
- package/chunks/chunk-OSAXBA7G.js +10 -0
- package/chunks/chunk-PO3V3I57.js +23 -0
- package/chunks/chunk-QXAJXTXV.js +19 -0
- package/chunks/chunk-RCO57B6F.js +9 -0
- package/chunks/chunk-SQZGZ3VT.js +15 -0
- package/chunks/chunk-UYTXXUU7.js +54 -0
- package/chunks/chunk-VTPRO4NJ.js +10 -0
- package/chunks/chunk-VYW4IADX.js +35 -0
- package/chunks/chunk-VZDUZTW6.js +113 -0
- package/chunks/chunk-W5A2TON3.js +10 -0
- package/chunks/chunk-W7YBGJ4H.js +28 -0
- package/chunks/chunk-WLL3FNVL.js +40 -0
- package/chunks/chunk-WOAYU6LB.js +13 -0
- package/chunks/chunk-XA4HVHJ4.js +18 -0
- package/chunks/chunk-XN3PZIVL.js +38 -0
- package/chunks/chunk-YDIBNEGA.js +9 -0
- package/components/index.d.ts +4 -0
- package/index.d.ts +3 -0
- package/node/files/index.d.ts +9 -0
- package/node/files/index.js +21 -0
- package/node/files/is-in-directory/index.d.ts +1 -0
- package/node/files/is-in-directory/index.js +6 -0
- package/node/files/read-write/index.d.ts +9 -0
- package/node/files/read-write/index.js +6 -0
- package/node/files/subpaths/index.d.ts +34 -0
- package/node/files/subpaths/index.js +7 -0
- package/node/index.d.ts +6 -0
- package/node/process/index.d.ts +8 -0
- package/node/process/index.js +20 -0
- package/{utils/node/process-exit → node/process/on-exit}/index.d.ts +1 -1
- package/node/process/on-exit/index.js +14 -0
- package/package.json +12 -12
- package/shared/errors/index.d.ts +14 -0
- package/shared/index.d.ts +0 -0
- package/chunks/chunk-BEZTX3QU.js +0 -1
- package/chunks/chunk-BW5CY5YB.js +0 -1
- package/chunks/chunk-DIPJ73JH.js +0 -1
- package/chunks/chunk-EFFU6KXJ.js +0 -1
- package/chunks/chunk-KNE7WIIW.js +0 -1
- package/chunks/chunk-LCLAV6Q2.js +0 -1
- package/chunks/chunk-PCAKH6ZJ.js +0 -1
- package/chunks/chunk-QQRJPDR7.js +0 -1
- package/chunks/chunk-WZBNXYN3.js +0 -1
- package/chunks/chunk-XCKXCF4A.js +0 -1
- package/chunks/chunk-ZVJO36JU.js +0 -1
- package/components/Comp/index.js +0 -1
- package/index.js +0 -96
- package/utils/agnostic/absolute-modulo/index.d.ts +0 -1
- package/utils/agnostic/absolute-modulo/index.js +0 -1
- package/utils/agnostic/array/index.d.ts +0 -7
- package/utils/agnostic/array/index.js +0 -1
- package/utils/agnostic/assert/index.d.ts +0 -3
- package/utils/agnostic/assert/index.js +0 -1
- package/utils/agnostic/await-timeout/index.d.ts +0 -2
- package/utils/agnostic/await-timeout/index.js +0 -1
- package/utils/agnostic/bem/index.d.ts +0 -5
- package/utils/agnostic/bem/index.js +0 -1
- package/utils/agnostic/cast/index.d.ts +0 -7
- package/utils/agnostic/cast/index.js +0 -1
- package/utils/agnostic/charcode-string/index.d.ts +0 -2
- package/utils/agnostic/charcode-string/index.js +0 -1
- package/utils/agnostic/clamp/index.d.ts +0 -1
- package/utils/agnostic/clamp/index.js +0 -1
- package/utils/agnostic/clientside-html-sanitizer/index.d.ts +0 -22
- package/utils/agnostic/clientside-html-sanitizer/index.js +0 -1
- package/utils/agnostic/crossenv/index.d.ts +0 -11
- package/utils/agnostic/crossenv/index.js +0 -1
- package/utils/agnostic/flatten-getters/index.d.ts +0 -1
- package/utils/agnostic/flatten-getters/index.js +0 -1
- package/utils/agnostic/generate-html-placeholders/index.d.ts +0 -7
- package/utils/agnostic/generate-html-placeholders/index.js +0 -5
- package/utils/agnostic/generate-nice-color/index.js +0 -1
- package/utils/agnostic/insert-node/index.d.ts +0 -2
- package/utils/agnostic/insert-node/index.js +0 -1
- package/utils/agnostic/interpolate/index.d.ts +0 -3
- package/utils/agnostic/interpolate/index.js +0 -1
- package/utils/agnostic/is-array-of/index.js +0 -1
- package/utils/agnostic/is-constructor-function/index.js +0 -1
- package/utils/agnostic/is-falsy/index.js +0 -1
- package/utils/agnostic/is-in-enum/index.js +0 -1
- package/utils/agnostic/is-nullish/index.js +0 -1
- package/utils/agnostic/is-object/index.d.ts +0 -1
- package/utils/agnostic/is-object/index.js +0 -1
- package/utils/agnostic/is-record/index.d.ts +0 -1
- package/utils/agnostic/is-record/index.js +0 -1
- package/utils/agnostic/is-valid-css-class-name/index.d.ts +0 -2
- package/utils/agnostic/is-valid-css-class-name/index.js +0 -1
- package/utils/agnostic/memoize/index.js +0 -1
- package/utils/agnostic/object-validate-from-partial/index.d.ts +0 -1
- package/utils/agnostic/object-validate-from-partial/index.js +0 -1
- package/utils/agnostic/random/index.d.ts +0 -9
- package/utils/agnostic/random/index.js +0 -1
- package/utils/agnostic/record-format/index.js +0 -1
- package/utils/agnostic/regexp/index.d.ts +0 -21
- package/utils/agnostic/regexp/index.js +0 -1
- package/utils/agnostic/replace-all/index.js +0 -1
- package/utils/agnostic/responsive-harmonics/index.js +0 -1
- package/utils/agnostic/round-numbers/index.d.ts +0 -1
- package/utils/agnostic/round-numbers/index.js +0 -1
- package/utils/agnostic/selector-to-element/index.d.ts +0 -1
- package/utils/agnostic/selector-to-element/index.js +0 -1
- package/utils/agnostic/silent-log/index.d.ts +0 -53
- package/utils/agnostic/silent-log/index.js +0 -9
- package/utils/agnostic/str-to-nodes/index.d.ts +0 -7
- package/utils/agnostic/str-to-nodes/index.js +0 -1
- package/utils/agnostic/string-matches/index.d.ts +0 -4
- package/utils/agnostic/string-matches/index.js +0 -1
- package/utils/agnostic/string-normalize-indent/index.d.ts +0 -1
- package/utils/agnostic/string-normalize-indent/index.js +0 -3
- package/utils/agnostic/throttle-debounce/index.js +0 -1
- package/utils/agnostic/to-alphanum/index.d.ts +0 -1
- package/utils/agnostic/to-alphanum/index.js +0 -1
- package/utils/agnostic/transition/index.d.ts +0 -39
- package/utils/agnostic/transition/index.js +0 -1
- package/utils/agnostic/wait/index.d.ts +0 -1
- package/utils/agnostic/wait/index.js +0 -1
- package/utils/browser/dynamic-css/index.d.ts +0 -4
- package/utils/browser/dynamic-css/index.js +0 -2
- package/utils/browser/get-current-downlink/index.d.ts +0 -1
- package/utils/browser/get-current-downlink/index.js +0 -1
- package/utils/browser/get-node-ancestors/index.d.ts +0 -1
- package/utils/browser/get-node-ancestors/index.js +0 -1
- package/utils/node/is-in-directory/index.d.ts +0 -1
- package/utils/node/is-in-directory/index.js +0 -1
- package/utils/node/list-subpaths/index.d.ts +0 -33
- package/utils/node/list-subpaths/index.js +0 -1
- package/utils/node/process-exit/index.js +0 -1
- package/utils/node/read-write-file/index.d.ts +0 -12
- package/utils/node/read-write-file/index.js +0 -1
- /package/{utils/agnostic → agnostic/css}/bem/BEM.d.ts +0 -0
- /package/{utils/agnostic → agnostic/css}/bem/getNamesArr.d.ts +0 -0
- /package/{utils/agnostic → agnostic/numbers}/responsive-harmonics/index.d.ts +0 -0
- /package/{utils/agnostic → agnostic/objects}/record-format/index.d.ts +0 -0
- /package/{utils/agnostic → agnostic/optim}/throttle-debounce/index.d.ts +0 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
import { isArrayOf as isArrayOfFunc } from './is-array-of';
|
2
|
+
export declare namespace Arrays {
|
3
|
+
type Filler<T = any> = (pos?: number) => T;
|
4
|
+
export function make<T>(filler: Filler<T>, length: number): T[];
|
5
|
+
export function findDuplicates<T>(arr: T[], stopAtFirst?: boolean): T[];
|
6
|
+
export const randomPickErrorSybol: unique symbol;
|
7
|
+
export type RandomPickErrorSymbol = typeof randomPickErrorSybol;
|
8
|
+
export function randomPick<T>(arr: T[], exclude?: T[]): T | RandomPickErrorSymbol;
|
9
|
+
export const isArrayOf: typeof isArrayOfFunc;
|
10
|
+
export {};
|
11
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ConstructorFunction } from '~/
|
1
|
+
import { ConstructorFunction } from '~/agnostic/misc/is-constructor-function';
|
2
2
|
type TypeCheckerFunction = (input: unknown) => boolean;
|
3
3
|
type TypeChecker = ConstructorFunction | TypeCheckerFunction;
|
4
|
-
export
|
4
|
+
export declare function isArrayOf<T extends unknown = unknown>(input: unknown, _types?: TypeChecker | TypeChecker[]): input is T[];
|
5
5
|
export {};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import {
|
2
|
+
isConstructorFunction
|
3
|
+
} from "../../../chunks/chunk-RCO57B6F.js";
|
4
|
+
|
5
|
+
// src/agnostic/arrays/is-array-of/index.ts
|
6
|
+
function isArrayOf(input, _types = []) {
|
7
|
+
if (!Array.isArray(input)) return false;
|
8
|
+
const types = Array.isArray(_types) ? _types : [_types];
|
9
|
+
if (types.length === 0) return true;
|
10
|
+
return input.every((entry) => {
|
11
|
+
return types.some((typeChecker) => {
|
12
|
+
const isConstructor = isConstructorFunction(typeChecker);
|
13
|
+
if (!isConstructor) return typeChecker(entry);
|
14
|
+
if (typeChecker === Number) return typeof entry === "number";
|
15
|
+
if (typeChecker === String) return typeof entry === "string";
|
16
|
+
if (typeChecker === Boolean) return typeof entry === "boolean";
|
17
|
+
if (isConstructor) return entry instanceof typeChecker;
|
18
|
+
});
|
19
|
+
});
|
20
|
+
}
|
21
|
+
export {
|
22
|
+
isArrayOf
|
23
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { timeoutCall as timeoutCallFunc } from './timeout-call';
|
2
|
+
import { Transitions as TransitionsNamespace } from './transitions';
|
3
|
+
import { wait as waitFunc } from './wait';
|
4
|
+
export declare namespace Async {
|
5
|
+
const timeoutCall: typeof timeoutCallFunc;
|
6
|
+
export import Transitions = TransitionsNamespace;
|
7
|
+
const wait: typeof waitFunc;
|
8
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import {
|
2
|
+
timeoutCall
|
3
|
+
} from "../../chunks/chunk-4VC5PT5T.js";
|
4
|
+
import {
|
5
|
+
Transitions
|
6
|
+
} from "../../chunks/chunk-4GDNHUCZ.js";
|
7
|
+
import {
|
8
|
+
wait
|
9
|
+
} from "../../chunks/chunk-DQNJQBC6.js";
|
10
|
+
|
11
|
+
// src/agnostic/async/index.ts
|
12
|
+
var Async;
|
13
|
+
((Async2) => {
|
14
|
+
Async2.timeoutCall = timeoutCall;
|
15
|
+
Async2.Transitions = Transitions;
|
16
|
+
Async2.wait = wait;
|
17
|
+
})(Async || (Async = {}));
|
18
|
+
export {
|
19
|
+
Async
|
20
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function timeoutCall<T extends any>(callback: () => T, timeoutMs: number): Promise<unknown>;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
export declare namespace Transitions {
|
2
|
+
type Callback = (val: number, timeMs: number) => void;
|
3
|
+
enum Ease {
|
4
|
+
LINEAR = "linear",
|
5
|
+
EASE_IN_QUAD = "ease-in-quad",
|
6
|
+
EASE_OUT_QUAD = "ease-out-quad",
|
7
|
+
EASE_IN_OUT_QUAD = "ease-in-out-quad",
|
8
|
+
EASE_IN_CUBIC = "ease-in-cubic",
|
9
|
+
EASE_OUT_CUBIC = "ease-out-cubic",
|
10
|
+
EASE_IN_OUT_CUBIC = "ease-in-out-cubic",
|
11
|
+
EASE_IN_QUART = "ease-in-quart",
|
12
|
+
EASE_OUT_QUART = "ease-out-quart",
|
13
|
+
EASE_IN_OUT_QUART = "ease-in-out-quart",
|
14
|
+
EASE_IN_QUINT = "ease-in-quint",
|
15
|
+
EASE_OUT_QUINT = "ease-out-quint",
|
16
|
+
EASE_IN_OUT_QUINT = "ease-in-out-quint",
|
17
|
+
EASE_IN_SINE = "ease-in-sine",
|
18
|
+
EASE_OUT_SINE = "ease-out-sine",
|
19
|
+
EASE_IN_OUT_SINE = "ease-in-out-sine",
|
20
|
+
EASE_IN_EXPO = "ease-in-expo",
|
21
|
+
EASE_OUT_EXPO = "ease-out-expo",
|
22
|
+
EASE_IN_OUT_EXPO = "ease-in-out-expo",
|
23
|
+
EASE_IN_CIRC = "ease-in-circ",
|
24
|
+
EASE_OUT_CIRC = "ease-out-circ",
|
25
|
+
EASE_IN_OUT_CIRC = "ease-in-out-circ",
|
26
|
+
EASE_IN_BACK = "ease-in-back",
|
27
|
+
EASE_OUT_BACK = "ease-out-back",
|
28
|
+
EASE_IN_OUT_BACK = "ease-in-out-back",
|
29
|
+
EASE_IN_ELASTIC = "ease-in-elastic",
|
30
|
+
EASE_OUT_ELASTIC = "ease-out-elastic",
|
31
|
+
EASE_IN_OUT_ELASTIC = "ease-in-out-elastic",
|
32
|
+
EASE_IN_BOUNCE = "ease-in-bounce",
|
33
|
+
EASE_OUT_BOUNCE = "ease-out-bounce",
|
34
|
+
EASE_IN_OUT_BOUNCE = "ease-in-out-bounce"
|
35
|
+
}
|
36
|
+
type EasingFunction = (progress: number) => number;
|
37
|
+
type EasingDictionary = Record<string, EasingFunction>;
|
38
|
+
function transition(to: number, durationMs: number, callbackOrEase: Ease | Callback, callback?: Callback): Promise<void>;
|
39
|
+
const easingFunctions: EasingDictionary;
|
40
|
+
const easings: Record<Ease, ((ratio: number) => number) | undefined>;
|
41
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function wait(durationMs: number): Promise<unknown>;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { Falsy as FalsyType, NotFalsy as NotFalsyType, isFalsy as isFalsyFunc, isNotFalsy as isNotFalsyFunc } from './is-falsy';
|
2
|
+
export declare namespace Booleans {
|
3
|
+
type Falsy = FalsyType;
|
4
|
+
type NotFalsy<T> = NotFalsyType<T>;
|
5
|
+
const falsyValues: FalsyType[];
|
6
|
+
const isFalsy: typeof isFalsyFunc;
|
7
|
+
const isNotFalsy: typeof isNotFalsyFunc;
|
8
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import {
|
2
|
+
falsyValues,
|
3
|
+
isFalsy,
|
4
|
+
isNotFalsy
|
5
|
+
} from "../../chunks/chunk-QXAJXTXV.js";
|
6
|
+
import "../../chunks/chunk-HC6ZOHCS.js";
|
7
|
+
|
8
|
+
// src/agnostic/booleans/index.ts
|
9
|
+
var Booleans;
|
10
|
+
((Booleans2) => {
|
11
|
+
Booleans2.falsyValues = falsyValues;
|
12
|
+
Booleans2.isFalsy = isFalsy;
|
13
|
+
Booleans2.isNotFalsy = isNotFalsy;
|
14
|
+
})(Booleans || (Booleans = {}));
|
15
|
+
export {
|
16
|
+
Booleans
|
17
|
+
};
|
@@ -1,8 +1,7 @@
|
|
1
|
-
import { Nullish } from '~/
|
1
|
+
import { Nullish } from '~/agnostic/misc/is-nullish';
|
2
2
|
export type Falsy = Nullish | false | '' | 0 | -0 | typeof NaN | 0n;
|
3
3
|
export type NotFalsy<T> = Exclude<T, Exclude<Falsy, number>>;
|
4
4
|
declare const falsyValues: Falsy[];
|
5
5
|
export { falsyValues };
|
6
6
|
export declare function isFalsy<T>(val: T | Falsy): val is Falsy;
|
7
7
|
export declare function isNotFalsy<T>(val: T): val is NotFalsy<T>;
|
8
|
-
export default isFalsy;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Bem as BemNamespace } from './bem';
|
2
|
+
import { isValidClassName as isValidClassNameFunc } from './is-valid-css-class-name';
|
3
|
+
import { StylesSetItem as StylesSetItemType, StylesSet as StylesSetFunc, StylesSetCompProps as StylesSetCompPropsFype, StylesSetComp as StylesSetCompFunc } from './styles-set';
|
4
|
+
export declare namespace Css {
|
5
|
+
export import Bem = BemNamespace;
|
6
|
+
const niceColors: string[];
|
7
|
+
const generateNiceColor: () => string | undefined;
|
8
|
+
const classNameRegex: RegExp;
|
9
|
+
const isValidClassName: typeof isValidClassNameFunc;
|
10
|
+
type StylesSetItem = StylesSetItemType;
|
11
|
+
const StylesSet: typeof StylesSetFunc;
|
12
|
+
type StylesSetCompProps = StylesSetCompPropsFype;
|
13
|
+
const StylesSetComp: typeof StylesSetCompFunc;
|
14
|
+
}
|
@@ -0,0 +1,177 @@
|
|
1
|
+
import {
|
2
|
+
Random
|
3
|
+
} from "../../chunks/chunk-WLL3FNVL.js";
|
4
|
+
import {
|
5
|
+
register
|
6
|
+
} from "../../chunks/chunk-KQT5CTGF.js";
|
7
|
+
import {
|
8
|
+
Crossenv
|
9
|
+
} from "../../chunks/chunk-GJOU3UAL.js";
|
10
|
+
import "../../chunks/chunk-MT74WIQR.js";
|
11
|
+
import {
|
12
|
+
Bem
|
13
|
+
} from "../../chunks/chunk-7YW5HL6N.js";
|
14
|
+
import "../../chunks/chunk-QXAJXTXV.js";
|
15
|
+
import "../../chunks/chunk-HC6ZOHCS.js";
|
16
|
+
import {
|
17
|
+
generateNiceColor,
|
18
|
+
niceColors
|
19
|
+
} from "../../chunks/chunk-EDVNAV3G.js";
|
20
|
+
import {
|
21
|
+
classNameRegex,
|
22
|
+
isValidClassName
|
23
|
+
} from "../../chunks/chunk-W5A2TON3.js";
|
24
|
+
|
25
|
+
// src/agnostic/css/styles-set/index.tsx
|
26
|
+
import { Component } from "react";
|
27
|
+
import { render as reactRender } from "react-dom";
|
28
|
+
import {
|
29
|
+
createRoot as reactCreateRoot
|
30
|
+
} from "react-dom/client";
|
31
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
32
|
+
var StylesSet = class _StylesSet {
|
33
|
+
static defaultPrivateIDAttribute = "data-styleset-private-id";
|
34
|
+
static defaultPublicIDAttribute = "data-styleset-public-id";
|
35
|
+
_items = /* @__PURE__ */ new Map();
|
36
|
+
get items() {
|
37
|
+
const sortedItemsArray = Array.from(this._items).map(([privateId, item]) => {
|
38
|
+
return {
|
39
|
+
targetPosition: this.getTargetPosition(privateId) ?? 0,
|
40
|
+
privateId,
|
41
|
+
item
|
42
|
+
};
|
43
|
+
}).sort((a, b) => a.targetPosition - b.targetPosition).map(({ item, privateId }) => [privateId, item]);
|
44
|
+
const sortedItemsMap = new Map(sortedItemsArray);
|
45
|
+
return sortedItemsMap;
|
46
|
+
}
|
47
|
+
tagsPrivateIDAttribute = _StylesSet.defaultPrivateIDAttribute;
|
48
|
+
tagsPublicIDAttribute = _StylesSet.defaultPublicIDAttribute;
|
49
|
+
getTargetPosition(privateId) {
|
50
|
+
const orderedStyles = Array.from(this._items).map(([privateId2, data]) => ({ privateId: privateId2, data })).sort((a, b) => {
|
51
|
+
const aPos = a.data.position ?? 0;
|
52
|
+
const bPos = b.data.position ?? 0;
|
53
|
+
return aPos - bPos;
|
54
|
+
});
|
55
|
+
const foundIndex = orderedStyles.findIndex((item) => item.privateId === privateId);
|
56
|
+
return foundIndex === -1 ? null : foundIndex;
|
57
|
+
}
|
58
|
+
setTagsPrivateIDAttribute(str) {
|
59
|
+
this.tagsPrivateIDAttribute = str;
|
60
|
+
return this;
|
61
|
+
}
|
62
|
+
setTagsPublicIDAttribute(str) {
|
63
|
+
this.tagsPublicIDAttribute = str;
|
64
|
+
return this;
|
65
|
+
}
|
66
|
+
getById(id) {
|
67
|
+
const found = Array.from(this._items.values()).find((entry) => entry.id === id);
|
68
|
+
if (found === void 0) return void 0;
|
69
|
+
return found;
|
70
|
+
}
|
71
|
+
generateUniquePrivateId() {
|
72
|
+
const existingIds = Array.from(this._items.keys());
|
73
|
+
const generated = Random.randomHash(12);
|
74
|
+
if (existingIds.includes(generated)) return this.generateUniquePrivateId();
|
75
|
+
return generated;
|
76
|
+
}
|
77
|
+
getComp() {
|
78
|
+
const items = this.items;
|
79
|
+
const comp = /* @__PURE__ */ jsx(
|
80
|
+
StylesSetComp,
|
81
|
+
{
|
82
|
+
items,
|
83
|
+
privateIDAttribute: this.tagsPrivateIDAttribute,
|
84
|
+
publicIDAttribute: this.tagsPublicIDAttribute
|
85
|
+
}
|
86
|
+
);
|
87
|
+
return comp;
|
88
|
+
}
|
89
|
+
_rendered = /* @__PURE__ */ new Map();
|
90
|
+
render(element) {
|
91
|
+
const root = reactCreateRoot(element);
|
92
|
+
root.render(this.getComp());
|
93
|
+
this._rendered.set(element, root);
|
94
|
+
return this;
|
95
|
+
}
|
96
|
+
unmount(element) {
|
97
|
+
if (!this._rendered.has(element)) return this;
|
98
|
+
const root = this._rendered.get(element);
|
99
|
+
if (root === void 0) return this;
|
100
|
+
root.unmount();
|
101
|
+
this._rendered.delete(element);
|
102
|
+
return this;
|
103
|
+
}
|
104
|
+
updateRendered() {
|
105
|
+
this._rendered.forEach((root) => root.render(this.getComp()));
|
106
|
+
return this;
|
107
|
+
}
|
108
|
+
addItem(item, abortIfIdExists = true) {
|
109
|
+
const existing = Array.from(this._items.entries()).map(([privateId2, entry]) => ({ privateId: privateId2, entry })).find(({ entry }) => entry.id !== void 0 && entry.id === item.id);
|
110
|
+
if (existing !== void 0) {
|
111
|
+
if (abortIfIdExists) return this;
|
112
|
+
this._items.delete(existing.privateId);
|
113
|
+
}
|
114
|
+
const privateId = this.generateUniquePrivateId();
|
115
|
+
this._items.set(privateId, item);
|
116
|
+
this.updateRendered();
|
117
|
+
return this;
|
118
|
+
}
|
119
|
+
removeItem(idOrPosition) {
|
120
|
+
if (typeof idOrPosition === "string") {
|
121
|
+
const existing = Array.from(this._items.entries()).map(([privateId, entry]) => ({ privateId, entry })).find(({ entry }) => entry.id !== void 0 && entry.id === idOrPosition);
|
122
|
+
if (existing === void 0) return this;
|
123
|
+
this._items.delete(existing.privateId);
|
124
|
+
this.updateRendered();
|
125
|
+
return this;
|
126
|
+
}
|
127
|
+
const toRemove = Array.from(this._items).map(([privateId, entry]) => ({ privateId, entry })).at(idOrPosition);
|
128
|
+
if (toRemove === void 0) return this;
|
129
|
+
this._items.delete(toRemove.privateId);
|
130
|
+
this.updateRendered();
|
131
|
+
return this;
|
132
|
+
}
|
133
|
+
async getDomString(documentObj) {
|
134
|
+
const actualDocumentObj = documentObj ?? Crossenv.getDocument();
|
135
|
+
if (actualDocumentObj === null) throw register.getError("no-window-document-on-runtime" /* NO_DOCUMENT */);
|
136
|
+
return new Promise((resolve) => {
|
137
|
+
const tempElt = actualDocumentObj.createElement("div");
|
138
|
+
reactRender(this.getComp(), tempElt, () => resolve(tempElt.innerHTML));
|
139
|
+
});
|
140
|
+
}
|
141
|
+
};
|
142
|
+
var StylesSetComp = class extends Component {
|
143
|
+
render() {
|
144
|
+
const { props } = this;
|
145
|
+
const items = props.items ?? /* @__PURE__ */ new Map();
|
146
|
+
const pidAttr = props.privateIDAttribute ?? StylesSet.defaultPrivateIDAttribute;
|
147
|
+
const idAttr = props.publicIDAttribute ?? StylesSet.defaultPublicIDAttribute;
|
148
|
+
return /* @__PURE__ */ jsx(Fragment, { children: Array.from(items).map(([privateId, itemData]) => {
|
149
|
+
const customAttributes = { [pidAttr]: privateId, [idAttr]: itemData.id };
|
150
|
+
if (itemData.type === "url") return /* @__PURE__ */ jsx(
|
151
|
+
"link",
|
152
|
+
{
|
153
|
+
onLoad: itemData.onLoad,
|
154
|
+
rel: "stylesheet",
|
155
|
+
href: itemData.content,
|
156
|
+
...customAttributes
|
157
|
+
}
|
158
|
+
);
|
159
|
+
return /* @__PURE__ */ jsx("style", { ...customAttributes, children: itemData.content });
|
160
|
+
}) });
|
161
|
+
}
|
162
|
+
};
|
163
|
+
|
164
|
+
// src/agnostic/css/index.ts
|
165
|
+
var Css;
|
166
|
+
((Css2) => {
|
167
|
+
Css2.Bem = Bem;
|
168
|
+
Css2.niceColors = niceColors;
|
169
|
+
Css2.generateNiceColor = generateNiceColor;
|
170
|
+
Css2.classNameRegex = classNameRegex;
|
171
|
+
Css2.isValidClassName = isValidClassName;
|
172
|
+
Css2.StylesSet = StylesSet;
|
173
|
+
Css2.StylesSetComp = StylesSetComp;
|
174
|
+
})(Css || (Css = {}));
|
175
|
+
export {
|
176
|
+
Css
|
177
|
+
};
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { JSX, Component } from 'react';
|
2
|
+
export type StylesSetItem = {
|
3
|
+
type: 'string' | 'url';
|
4
|
+
content: string;
|
5
|
+
id?: string;
|
6
|
+
position?: number;
|
7
|
+
onLoad?: () => void;
|
8
|
+
};
|
9
|
+
export declare class StylesSet {
|
10
|
+
static defaultPrivateIDAttribute: string;
|
11
|
+
static defaultPublicIDAttribute: string;
|
12
|
+
private _items;
|
13
|
+
get items(): Map<string, StylesSetItem>;
|
14
|
+
tagsPrivateIDAttribute: string;
|
15
|
+
tagsPublicIDAttribute: string;
|
16
|
+
private getTargetPosition;
|
17
|
+
setTagsPrivateIDAttribute(str: string): this;
|
18
|
+
setTagsPublicIDAttribute(str: string): this;
|
19
|
+
getById(id: string): StylesSetItem | undefined;
|
20
|
+
generateUniquePrivateId(): string;
|
21
|
+
getComp(): JSX.Element;
|
22
|
+
private _rendered;
|
23
|
+
render(element: Element): this;
|
24
|
+
unmount(element: Element): this;
|
25
|
+
updateRendered(): this;
|
26
|
+
addItem(item: StylesSetItem, abortIfIdExists?: boolean): this;
|
27
|
+
removeItem(idOrPosition: string | number): this;
|
28
|
+
getDomString(documentObj?: Document): Promise<string>;
|
29
|
+
}
|
30
|
+
export type StylesSetCompProps = {
|
31
|
+
items?: StylesSet['items'];
|
32
|
+
privateIDAttribute?: StylesSet['tagsPrivateIDAttribute'];
|
33
|
+
publicIDAttribute?: StylesSet['tagsPublicIDAttribute'];
|
34
|
+
};
|
35
|
+
export declare class StylesSetComp extends Component<StylesSetCompProps> {
|
36
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
37
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
type AnyFunc = (...args: any[]) => any;
|
2
|
+
type ParamsOfNullableFunc<F extends AnyFunc | undefined | null> = F extends AnyFunc ? Parameters<F> : [];
|
3
|
+
type ReturnTypeOfNullableFunc<F extends AnyFunc | undefined | null> = F extends AnyFunc ? ReturnType<F> : undefined;
|
4
|
+
export declare namespace Errors {
|
5
|
+
type ErrFactory<Params extends any[] = any[], Details = any> = {
|
6
|
+
message: string;
|
7
|
+
makeDetails?: (...params: Params) => Details;
|
8
|
+
};
|
9
|
+
type ErrData<RS extends RegisterSource, C extends keyof RS> = {
|
10
|
+
code: C;
|
11
|
+
message: RS[C]['message'];
|
12
|
+
details: ReturnTypeOfNullableFunc<RS[C]['makeDetails']>;
|
13
|
+
};
|
14
|
+
type RegisterSource<P extends any[] = any[], D = any> = {
|
15
|
+
[code: string]: ErrFactory<P, D>;
|
16
|
+
};
|
17
|
+
class CustomError<RS extends RegisterSource, C extends keyof RS> extends Error {
|
18
|
+
code: ErrData<RS, C>['code'];
|
19
|
+
details: ErrData<RS, C>['details'];
|
20
|
+
constructor(data: ErrData<RS, C>);
|
21
|
+
}
|
22
|
+
class Register<RS extends RegisterSource> {
|
23
|
+
private _source;
|
24
|
+
constructor(source: RS);
|
25
|
+
getFactory<C extends keyof RS>(code: C): RS[C];
|
26
|
+
getData<C extends keyof RS>(code: C, ...params: ParamsOfNullableFunc<RS[C]['makeDetails']>): ErrData<RS, C>;
|
27
|
+
getError<C extends keyof RS>(code: C, ...params: ParamsOfNullableFunc<RS[C]['makeDetails']>): CustomError<RS, C>;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function getNodeAncestors(node: Node): Element[];
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function getPositionInsideParent(node: Node): number | null;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { getNodeAncestors as getNodeAncestorsFunc } from './get-node-ancestors';
|
2
|
+
import { getPositionInsideParent as getPositionInsideParentFunc } from './get-position-inside-parent';
|
3
|
+
import { InsertNodePosition as InsertNodePositionType, insertNode as insertNodeFunc } from './insert-node';
|
4
|
+
import { Placeholders as PlaceholdersNamespace } from './placeholders';
|
5
|
+
import { Sanitize as SanitizeNamespace } from './sanitize';
|
6
|
+
import { selectorToElement as selectorToElementFunc } from './selector-to-element';
|
7
|
+
import { stringToNodes as stringToNodesFunc } from './string-to-nodes';
|
8
|
+
export declare namespace Html {
|
9
|
+
const getNodeAncestors: typeof getNodeAncestorsFunc;
|
10
|
+
const getPositionInsideParent: typeof getPositionInsideParentFunc;
|
11
|
+
type InsertNodePosition = InsertNodePositionType;
|
12
|
+
const insertNode: typeof insertNodeFunc;
|
13
|
+
export import Placeholders = PlaceholdersNamespace;
|
14
|
+
export import Sanitize = SanitizeNamespace;
|
15
|
+
const selectorToElement: typeof selectorToElementFunc;
|
16
|
+
const stringToNodes: typeof stringToNodesFunc;
|
17
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import {
|
2
|
+
Placeholders
|
3
|
+
} from "../../chunks/chunk-VYW4IADX.js";
|
4
|
+
import {
|
5
|
+
selectorToElement
|
6
|
+
} from "../../chunks/chunk-XN3PZIVL.js";
|
7
|
+
import {
|
8
|
+
stringToNodes
|
9
|
+
} from "../../chunks/chunk-NRJQKVQV.js";
|
10
|
+
import {
|
11
|
+
getNodeAncestors
|
12
|
+
} from "../../chunks/chunk-SQZGZ3VT.js";
|
13
|
+
import {
|
14
|
+
Sanitize
|
15
|
+
} from "../../chunks/chunk-IFD7GSGK.js";
|
16
|
+
import {
|
17
|
+
getPositionInsideParent
|
18
|
+
} from "../../chunks/chunk-VTPRO4NJ.js";
|
19
|
+
import {
|
20
|
+
insertNode
|
21
|
+
} from "../../chunks/chunk-XA4HVHJ4.js";
|
22
|
+
import "../../chunks/chunk-KQT5CTGF.js";
|
23
|
+
import "../../chunks/chunk-GJOU3UAL.js";
|
24
|
+
import "../../chunks/chunk-MT74WIQR.js";
|
25
|
+
|
26
|
+
// src/agnostic/html/index.ts
|
27
|
+
var Html;
|
28
|
+
((Html2) => {
|
29
|
+
Html2.getNodeAncestors = getNodeAncestors;
|
30
|
+
Html2.getPositionInsideParent = getPositionInsideParent;
|
31
|
+
Html2.insertNode = insertNode;
|
32
|
+
Html2.Placeholders = Placeholders;
|
33
|
+
Html2.Sanitize = Sanitize;
|
34
|
+
Html2.selectorToElement = selectorToElement;
|
35
|
+
Html2.stringToNodes = stringToNodes;
|
36
|
+
})(Html || (Html = {}));
|
37
|
+
export {
|
38
|
+
Html
|
39
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export declare namespace Placeholders {
|
2
|
+
const EightKiloByteOfLoremIpsumSentences: string[];
|
3
|
+
const generateSentence: () => string | undefined;
|
4
|
+
const generateSentences: (amount?: number) => (string | undefined)[];
|
5
|
+
const generateTitle: () => string;
|
6
|
+
const generateIntertitle: () => string;
|
7
|
+
const generateParagraph: () => string;
|
8
|
+
const generateContentPage: (len?: number) => string;
|
9
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
export declare namespace Sanitize {
|
2
|
+
type AttributeNameValPair = {
|
3
|
+
attributeName: string | RegExp;
|
4
|
+
attributeValues?: Array<string | RegExp>;
|
5
|
+
};
|
6
|
+
type Options = {
|
7
|
+
inputFreeTransform?: (input: string) => string;
|
8
|
+
keepComments?: boolean;
|
9
|
+
allowedTags?: string[];
|
10
|
+
forbiddenTags?: string[];
|
11
|
+
allowedAttributes?: {
|
12
|
+
[tagName: string]: AttributeNameValPair[];
|
13
|
+
};
|
14
|
+
forbiddenAttributes?: {
|
15
|
+
[tagName: string]: AttributeNameValPair[];
|
16
|
+
};
|
17
|
+
depth?: number;
|
18
|
+
verbose?: boolean;
|
19
|
+
documentObj?: Document;
|
20
|
+
};
|
21
|
+
const defaultOptions: Options;
|
22
|
+
function sanitize(inputStr: string, options?: Options): string;
|
23
|
+
function sanitizeElement(element: Element, options?: Options): Element | null;
|
24
|
+
}
|