@dxtmisha/functional-basic 1.2.10 → 1.3.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.md +31 -0
- package/ai-doc.ru.txt +50 -1
- package/ai-doc.txt +50 -1
- package/dist/library.js +71 -61
- package/dist/src/classes/GeoFlag.d.ts +7 -0
- package/dist/src/functions/getLength.d.ts +10 -0
- package/dist/src/library.d.ts +1 -0
- package/dist/src/types/geoTypes.d.ts +2 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.3.1] - 2026-05-25
|
|
6
|
+
|
|
7
|
+
### Changed / Improved
|
|
8
|
+
- **Maintenance**: Incremented version to `1.3.1` to align with monorepo release updates.
|
|
9
|
+
|
|
10
|
+
## [1.3.0] - 2026-05-25
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **`getLength`**: Introduced a new `getLength` utility function to determine the length/size of strings, arrays, Maps, Sets, and objects reactively and safely, accompanied by complete bilingual JSDocs.
|
|
14
|
+
- **Tests**: Created a comprehensive unit test suite (`getLength.test.ts`) to validate length computation across all supported data types.
|
|
15
|
+
|
|
16
|
+
### Changed / Improved
|
|
17
|
+
- **Build System**: Added `ui-priority: 100` attribute to `package.json` to facilitate prioritized build sorting of foundational libraries.
|
|
18
|
+
|
|
19
|
+
## [1.2.11] - 2026-05-25
|
|
20
|
+
|
|
21
|
+
### Changed / Improved
|
|
22
|
+
- **Tests**: Configured the vitest runner command to execute with `NODE_OPTIONS="--no-webstorage"` in `package.json` to prevent environment-related web storage warnings.
|
|
23
|
+
|
|
24
|
+
## [1.2.10] - 2026-05-24
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- **isTab**: Introduced `isTab` utility function to reliably detect Tab key presses across different browser environments by checking `key`, `code`, and `keyCode`.
|
|
28
|
+
- **isTab**: Added comprehensive unit tests in `src/functions/__tests__/isTab.test.ts` to verify tab-detection behavior under multiple key configurations.
|
|
29
|
+
|
|
30
|
+
### Changed / Improved
|
|
31
|
+
- **isInput**: Refactored `isInput` helper to correctly return `false` for elements with `readonly` or `disabled` attributes.
|
|
32
|
+
- **getKey**: Updated return type of `getKey` helper function to return `string | number | undefined` instead of forcing a strict `string`.
|
|
33
|
+
- **ErrorCenter**: Enhanced `ErrorCenterCauseItem` type inside `errorCenter.ts` with generic parameter support (`ErrorCenterCauseItem<D = any>`) to support strictly-typed structures for error cause detail records.
|
|
34
|
+
- **Maintenance**: Excluded auto-generated AI description files from package assets, standardized type outputs and version bumped to `1.2.10`.
|
|
35
|
+
|
|
5
36
|
## [1.2.5] - 2026-05-17
|
|
6
37
|
|
|
7
38
|
### Changed / Improved
|
package/ai-doc.ru.txt
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
Esto базовая функциональная библиотека (@dxtmisha/functional-basic). Здесь собраны алгоритмы, утилиты и классы, независимые от фреймворка.
|
|
2
2
|
|
|
3
3
|
ВНИМАНИЕ ДЛЯ СРЕДЫ VUE:
|
|
4
4
|
Если вы разрабатываете под Vue, СНАЧАЛА всегда ищите нужный функционал (composables, реактивные классы) в библиотеке `@dxtmisha/functional`.
|
|
5
5
|
И ТОЛЬКО если там нет нужного реактивного/специфичного для Vue аналога, используйте функционал напрямую из этой библиотеки (@dxtmisha/functional-basic).
|
|
6
|
+
|
|
7
|
+
=============================================================================
|
|
8
|
+
СТРУКТУРА КЛАССОВ И СТАНДАРТЫ КОДА (ПРАВИЛА ДЛЯ AI)
|
|
9
|
+
=============================================================================
|
|
10
|
+
|
|
11
|
+
Для обеспечения согласованности и высокого промышленного качества кодовой базы dxt-ui, все классы TypeScript внутри `@dxtmisha/functional-basic` должны строго следовать следующим правилам относительно структуры, порядка членов и стилей.
|
|
12
|
+
|
|
13
|
+
1. ПОРЯДОК ЧЛЕНОВ ВНУТРИ КЛАССА
|
|
14
|
+
Члены каждого класса ДОЛЖНЫ быть упорядочены в следующей последовательности:
|
|
15
|
+
|
|
16
|
+
А. Свойства класса / Переменные-члены:
|
|
17
|
+
- Располагаются в самом верху тела класса.
|
|
18
|
+
- Сортируются по видимости: сначала Public, затем Protected и в конце Private.
|
|
19
|
+
- Внутри каждого уровня видимости группируются по смыслу или по алфавиту.
|
|
20
|
+
- Инициализируйте значения по умолчанию прямо при объявлении, если это возможно.
|
|
21
|
+
|
|
22
|
+
Б. Конструктор:
|
|
23
|
+
- Располагается сразу после объявлений всех свойств.
|
|
24
|
+
- Разрешено объявление свойств через параметры конструктора (например, `protected url: string`) для упрощения кода.
|
|
25
|
+
|
|
26
|
+
В. Публичные методы (Public Methods):
|
|
27
|
+
- Располагаются после конструктора.
|
|
28
|
+
- Группируются логически:
|
|
29
|
+
1. Геттеры, методы проверки состояния и статуса (например, `is*`, `get*`).
|
|
30
|
+
2. Сеттеры и методы конфигурации (например, `set*`).
|
|
31
|
+
3. Основные методы выполнения и экшены (например, `request()`, `fetch()`, `show()`).
|
|
32
|
+
|
|
33
|
+
Г. Защищенные методы (Protected Methods):
|
|
34
|
+
- Располагаются после всех публичных методов.
|
|
35
|
+
- Содержат внутреннюю вспомогательную логику, доступную для наследников класса.
|
|
36
|
+
|
|
37
|
+
Д. Приватные методы (Private Methods):
|
|
38
|
+
- Располагаются в самом конце класса.
|
|
39
|
+
- Строгая инкапсуляция внутренней логики.
|
|
40
|
+
|
|
41
|
+
2. СТИЛЬ И СОГЛАШЕНИЯ ПО НАПИСАНИЮ КОДА
|
|
42
|
+
- Именование:
|
|
43
|
+
* Классы: PascalCase (например, `LoadingInstance`).
|
|
44
|
+
* Методы и свойства: camelCase (например, `registrationEvent`, `registrationList`).
|
|
45
|
+
* Константы внутри файлов: UPPER_SNAKE_CASE (например, `LOADING_EVENT_NAME`).
|
|
46
|
+
- Безопасность TypeScript:
|
|
47
|
+
* Никогда не используйте тип `any`. Используйте дженерики или `unknown`, если тип динамический/неопределенный.
|
|
48
|
+
* Явно указывайте возвращаемые типы для ВСЕХ публичных, защищенных и приватных методов (включая `void`).
|
|
49
|
+
* Используйте интерфейсы/типы для определения структурных контрактов сложных входящих и исходящих данных.
|
|
50
|
+
- SSR Изоляция (Server-Side Rendering):
|
|
51
|
+
* Библиотека должна быть полностью изоморфной и безопасной для SSR.
|
|
52
|
+
* Избегайте прямого хранения специфичного для запроса состояния в глобальных/статических свойствах классов.
|
|
53
|
+
* Используйте `ServerStorage.get('key', () => new Instance())` для синглтонов, изолированных в рамках запроса.
|
|
54
|
+
* Используйте проверку `isDomRuntime()` перед обращением к браузерным API, таким как `window`, `document` или `location`.
|
package/ai-doc.txt
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
This is the basic functional library (@dxtmisha/functional-basic). It contains framework-agnostic algorithms, utilities, and classes.
|
|
2
2
|
|
|
3
|
-
ATTENTION FOR VUE
|
|
3
|
+
ATTENTION FOR VUE ENVIRONMENT:
|
|
4
4
|
If you are developing in Vue, ALWAYS look for the required functionality (composables, reactive wrappers) inside the `@dxtmisha/functional` library FIRST.
|
|
5
5
|
And ONLY if there is no reactive or Vue-specific analog there, you may use the functionality directly from this library (@dxtmisha/functional-basic).
|
|
6
|
+
|
|
7
|
+
=============================================================================
|
|
8
|
+
CLASS STRUCTURE & CODING STANDARDS (RULES FOR AI)
|
|
9
|
+
=============================================================================
|
|
10
|
+
|
|
11
|
+
To maintain consistency and high industrial quality across the dxt-ui codebase, all TypeScript classes inside `@dxtmisha/functional-basic` must strictly adhere to the following rules regarding structure, member ordering, and styles.
|
|
12
|
+
|
|
13
|
+
1. ORDER OF MEMBERS WITHIN A CLASS
|
|
14
|
+
Members in every class MUST be ordered in the following sequence:
|
|
15
|
+
|
|
16
|
+
A. Class Properties / Member Variables:
|
|
17
|
+
- Placed at the very top of the class body.
|
|
18
|
+
- Ordered by visibility: Public first, then Protected, and Private last.
|
|
19
|
+
- Within each visibility level, group by logical connection or alphabetically.
|
|
20
|
+
- Initialize default values directly on declaration when possible.
|
|
21
|
+
|
|
22
|
+
B. Constructor:
|
|
23
|
+
- Placed immediately after all property declarations.
|
|
24
|
+
- Parameter properties (e.g., `protected url: string`) are allowed to simplify declaration.
|
|
25
|
+
|
|
26
|
+
C. Public Methods:
|
|
27
|
+
- Placed after the constructor.
|
|
28
|
+
- Grouped logically:
|
|
29
|
+
1. Getters, checkers, and status-check methods (e.g., `is*`, `get*`).
|
|
30
|
+
2. Setters and configuration methods (e.g., `set*`).
|
|
31
|
+
3. Core executors and action methods (e.g., `request()`, `fetch()`, `show()`).
|
|
32
|
+
|
|
33
|
+
D. Protected Methods:
|
|
34
|
+
- Placed after all public methods.
|
|
35
|
+
- Contain internal utility and helper logic accessible to subclasses.
|
|
36
|
+
|
|
37
|
+
E. Private Methods:
|
|
38
|
+
- Placed at the very end of the class.
|
|
39
|
+
- Strict encapsulation of internal logic.
|
|
40
|
+
|
|
41
|
+
2. CODING & STYLE CONVENTIONS
|
|
42
|
+
- Naming:
|
|
43
|
+
* Classes: PascalCase (e.g., `LoadingInstance`).
|
|
44
|
+
* Methods & Properties: camelCase (e.g., `registrationEvent`, `registrationList`).
|
|
45
|
+
* Constants inside files: UPPER_SNAKE_CASE (e.g., `LOADING_EVENT_NAME`).
|
|
46
|
+
- TypeScript Safety:
|
|
47
|
+
* Never use `any`. Use generic parameters or `unknown` if the type is dynamic/undefined.
|
|
48
|
+
* Explicitly declare return types for ALL public, protected, and private methods (including `void`).
|
|
49
|
+
* Use interfaces/types to define structural contracts for complex inputs and outputs.
|
|
50
|
+
- SSR Isolation (Server-Side Rendering):
|
|
51
|
+
* The library must be fully isomorphic and safe for SSR.
|
|
52
|
+
* Avoid storing request-specific state in global/static class properties directly.
|
|
53
|
+
* Use `ServerStorage.get('key', () => new Instance())` for request-isolated singletons.
|
|
54
|
+
* Use `isDomRuntime()` checks before accessing browser-only APIs like `window`, `document`, or `location`.
|
package/dist/library.js
CHANGED
|
@@ -1245,7 +1245,8 @@ var Oe = class {
|
|
|
1245
1245
|
get(e, t = "application/json;charset=UTF-8") {
|
|
1246
1246
|
if (e === null) return;
|
|
1247
1247
|
let r = { ...S(this.headers) };
|
|
1248
|
-
|
|
1248
|
+
if (n(e)) for (let t in e) r[t.toLowerCase()] = e[t];
|
|
1249
|
+
return l(t) && (r["content-type"] = t), r;
|
|
1249
1250
|
}
|
|
1250
1251
|
getByRequest(e, t, n = "application/json;charset=UTF-8") {
|
|
1251
1252
|
return e instanceof FormData ? this.get(t, null) : this.get(t, n);
|
|
@@ -2645,7 +2646,7 @@ var H = /* @__PURE__ */ function(e) {
|
|
|
2645
2646
|
constructor(e = O.getLocation()) {
|
|
2646
2647
|
w(this, "code", void 0), this.code = e;
|
|
2647
2648
|
}
|
|
2648
|
-
get(t = this.
|
|
2649
|
+
get(t = this.getCode()) {
|
|
2649
2650
|
let n = O.find(t);
|
|
2650
2651
|
if (n) {
|
|
2651
2652
|
var r;
|
|
@@ -2656,11 +2657,15 @@ var H = /* @__PURE__ */ function(e) {
|
|
|
2656
2657
|
standard: n.standard,
|
|
2657
2658
|
icon: (r = e.flags) == null ? void 0 : r[n.country],
|
|
2658
2659
|
label: t,
|
|
2659
|
-
value: n.country
|
|
2660
|
+
value: n.country,
|
|
2661
|
+
phoneCode: n.phoneCode
|
|
2660
2662
|
};
|
|
2661
2663
|
}
|
|
2662
2664
|
}
|
|
2663
|
-
|
|
2665
|
+
getCode() {
|
|
2666
|
+
return this.code || O.getLocation();
|
|
2667
|
+
}
|
|
2668
|
+
getFlag(e = this.getCode()) {
|
|
2664
2669
|
var t;
|
|
2665
2670
|
return (t = this.get(e)) == null ? void 0 : t.icon;
|
|
2666
2671
|
}
|
|
@@ -4363,8 +4368,13 @@ function En(e) {
|
|
|
4363
4368
|
return (t = (n = e == null ? void 0 : e.key) == null ? e == null ? void 0 : e.code : n) == null ? e == null || (r = e.keyCode) == null ? void 0 : r.toString() : t;
|
|
4364
4369
|
}
|
|
4365
4370
|
//#endregion
|
|
4366
|
-
//#region src/functions/
|
|
4371
|
+
//#region src/functions/getLength.ts
|
|
4367
4372
|
function Dn(e) {
|
|
4373
|
+
return e == null ? 0 : typeof e == "string" || Array.isArray(e) ? e.length : e instanceof Map || e instanceof Set ? e.size : t(e) ? Object.keys(e).length : 0;
|
|
4374
|
+
}
|
|
4375
|
+
//#endregion
|
|
4376
|
+
//#region src/functions/getLengthOfAllArray.ts
|
|
4377
|
+
function On(e) {
|
|
4368
4378
|
return r(e, (e) => {
|
|
4369
4379
|
var t;
|
|
4370
4380
|
return (t = e == null ? void 0 : e.length) == null ? 0 : t;
|
|
@@ -4372,41 +4382,41 @@ function Dn(e) {
|
|
|
4372
4382
|
}
|
|
4373
4383
|
//#endregion
|
|
4374
4384
|
//#region src/functions/getMaxLengthAllArray.ts
|
|
4375
|
-
function
|
|
4385
|
+
function kn(e) {
|
|
4376
4386
|
if (!l(e)) return 0;
|
|
4377
|
-
let t =
|
|
4387
|
+
let t = On(e);
|
|
4378
4388
|
return t.length > 1e4 ? t.reduce((e, t) => Math.max(e, t)) : Math.max(...t);
|
|
4379
4389
|
}
|
|
4380
4390
|
//#endregion
|
|
4381
4391
|
//#region src/functions/getMinLengthAllArray.ts
|
|
4382
|
-
function
|
|
4392
|
+
function An(e) {
|
|
4383
4393
|
if (!l(e)) return 0;
|
|
4384
|
-
let t =
|
|
4394
|
+
let t = On(e);
|
|
4385
4395
|
return t.length > 1e4 ? t.reduce((e, t) => Math.min(e, t)) : Math.min(...t);
|
|
4386
4396
|
}
|
|
4387
4397
|
//#endregion
|
|
4388
4398
|
//#region src/functions/getMouseClientX.ts
|
|
4389
|
-
function
|
|
4399
|
+
function jn(e) {
|
|
4390
4400
|
var t, n;
|
|
4391
4401
|
return (e == null ? void 0 : e.clientX) || (e == null || (t = e.targetTouches) == null || (t = t[0]) == null ? void 0 : t.clientX) || (e == null || (n = e.touches) == null || (n = n[0]) == null ? void 0 : n.clientX) || 0;
|
|
4392
4402
|
}
|
|
4393
4403
|
//#endregion
|
|
4394
4404
|
//#region src/functions/getMouseClientY.ts
|
|
4395
|
-
function
|
|
4405
|
+
function Mn(e) {
|
|
4396
4406
|
var t, n;
|
|
4397
4407
|
return (e == null ? void 0 : e.clientY) || (e == null || (t = e.targetTouches) == null || (t = t[0]) == null ? void 0 : t.clientY) || (e == null || (n = e.touches) == null || (n = n[0]) == null ? void 0 : n.clientY) || 0;
|
|
4398
4408
|
}
|
|
4399
4409
|
//#endregion
|
|
4400
4410
|
//#region src/functions/getMouseClient.ts
|
|
4401
|
-
function
|
|
4411
|
+
function Nn(e) {
|
|
4402
4412
|
return {
|
|
4403
|
-
x:
|
|
4404
|
-
y:
|
|
4413
|
+
x: jn(e),
|
|
4414
|
+
y: Mn(e)
|
|
4405
4415
|
};
|
|
4406
4416
|
}
|
|
4407
4417
|
//#endregion
|
|
4408
4418
|
//#region src/functions/getObjectByKeys.ts
|
|
4409
|
-
function
|
|
4419
|
+
function Pn(e, t) {
|
|
4410
4420
|
let r = {};
|
|
4411
4421
|
return n(e) && t.forEach((t) => {
|
|
4412
4422
|
t in e && e[t] !== void 0 && (r[t] = e[t]);
|
|
@@ -4414,7 +4424,7 @@ function Nn(e, t) {
|
|
|
4414
4424
|
}
|
|
4415
4425
|
//#endregion
|
|
4416
4426
|
//#region src/functions/getObjectNoUndefined.ts
|
|
4417
|
-
function
|
|
4427
|
+
function Fn(e, t = void 0) {
|
|
4418
4428
|
let n = {};
|
|
4419
4429
|
return r(e, (e, r) => {
|
|
4420
4430
|
e !== t && (n[r] = e);
|
|
@@ -4422,42 +4432,42 @@ function Pn(e, t = void 0) {
|
|
|
4422
4432
|
}
|
|
4423
4433
|
//#endregion
|
|
4424
4434
|
//#region src/functions/getObjectOrNone.ts
|
|
4425
|
-
function
|
|
4435
|
+
function In(e) {
|
|
4426
4436
|
return n(e) ? e : {};
|
|
4427
4437
|
}
|
|
4428
4438
|
//#endregion
|
|
4429
4439
|
//#region src/functions/getOnlyText.ts
|
|
4430
|
-
function
|
|
4440
|
+
function Ln(e) {
|
|
4431
4441
|
return F(e).replace(/[^\p{L}\p{N}\s]+/gu, "").trim();
|
|
4432
4442
|
}
|
|
4433
4443
|
//#endregion
|
|
4434
4444
|
//#region src/functions/strFill.ts
|
|
4435
|
-
function
|
|
4445
|
+
function Rn(e, t) {
|
|
4436
4446
|
return String(e).repeat(t);
|
|
4437
4447
|
}
|
|
4438
4448
|
//#endregion
|
|
4439
4449
|
//#region src/functions/getRandomText.ts
|
|
4440
|
-
function
|
|
4450
|
+
function zn(e, t, n = "#", r = 2, i = 12) {
|
|
4441
4451
|
let a = f(e, t), o = [];
|
|
4442
|
-
for (let e = 0; e < a; e++) o.push(
|
|
4452
|
+
for (let e = 0; e < a; e++) o.push(Rn(n, f(r, i)));
|
|
4443
4453
|
return o.join(" ");
|
|
4444
4454
|
}
|
|
4445
4455
|
//#endregion
|
|
4446
4456
|
//#region src/functions/getStepPercent.ts
|
|
4447
|
-
function
|
|
4457
|
+
function Bn(e, t) {
|
|
4448
4458
|
let n = e == null ? 0 : e;
|
|
4449
4459
|
return t > n ? 100 / (t - n) : 0;
|
|
4450
4460
|
}
|
|
4451
4461
|
//#endregion
|
|
4452
4462
|
//#region src/functions/getStepValue.ts
|
|
4453
|
-
function
|
|
4463
|
+
function Vn(e, t) {
|
|
4454
4464
|
let n = e == null ? 0 : e;
|
|
4455
4465
|
return t > n ? (t - n) / 100 : 0;
|
|
4456
4466
|
}
|
|
4457
4467
|
//#endregion
|
|
4458
4468
|
//#region src/functions/goScroll.ts
|
|
4459
|
-
var
|
|
4460
|
-
function
|
|
4469
|
+
var Hn = 0;
|
|
4470
|
+
function Un(e, t, n) {
|
|
4461
4471
|
if (!s()) return;
|
|
4462
4472
|
let r = t == null ? void 0 : t.closest(e);
|
|
4463
4473
|
if (t && r && r.scrollHeight !== r.offsetHeight) {
|
|
@@ -4465,12 +4475,12 @@ function Hn(e, t, n) {
|
|
|
4465
4475
|
if (n) {
|
|
4466
4476
|
let a = n.getBoundingClientRect();
|
|
4467
4477
|
r.scrollTop = t.offsetTop - (a.top - e.top) - (a.height / 2 - i.height / 2), r.scrollTop + r.offsetHeight < t.offsetTop + t.offsetHeight && (r.scrollTop = t.offsetTop + t.offsetHeight - r.offsetHeight);
|
|
4468
|
-
} else r.scrollTop > t.offsetTop ? r.scrollTop = i.top - e.top -
|
|
4478
|
+
} else r.scrollTop > t.offsetTop ? r.scrollTop = i.top - e.top - Hn : r.scrollTop + r.offsetHeight < t.offsetTop + t.offsetHeight && (r.scrollTop = i.top - e.top + i.height - e.height + Hn);
|
|
4469
4479
|
}
|
|
4470
4480
|
}
|
|
4471
4481
|
//#endregion
|
|
4472
4482
|
//#region src/functions/goScrollSmooth.ts
|
|
4473
|
-
function
|
|
4483
|
+
function Wn(e, t, n = 0) {
|
|
4474
4484
|
if (!s()) return;
|
|
4475
4485
|
let r = (t == null ? void 0 : t.behavior) || "smooth";
|
|
4476
4486
|
if ("scrollIntoView" in e && !n) {
|
|
@@ -4492,7 +4502,7 @@ function Un(e, t, n = 0) {
|
|
|
4492
4502
|
}
|
|
4493
4503
|
//#endregion
|
|
4494
4504
|
//#region src/functions/goScrollTo.ts
|
|
4495
|
-
function
|
|
4505
|
+
function Gn(e, t, n = "smooth") {
|
|
4496
4506
|
if (!s() || !e || !t) return;
|
|
4497
4507
|
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect();
|
|
4498
4508
|
e.scrollBy({
|
|
@@ -4503,13 +4513,13 @@ function Wn(e, t, n = "smooth") {
|
|
|
4503
4513
|
}
|
|
4504
4514
|
//#endregion
|
|
4505
4515
|
//#region src/functions/isShare.ts
|
|
4506
|
-
function
|
|
4516
|
+
function Kn() {
|
|
4507
4517
|
return s() && typeof navigator < "u" && !!navigator.share;
|
|
4508
4518
|
}
|
|
4509
4519
|
//#endregion
|
|
4510
4520
|
//#region src/functions/handleShare.ts
|
|
4511
|
-
async function
|
|
4512
|
-
if (
|
|
4521
|
+
async function qn(e) {
|
|
4522
|
+
if (Kn() && navigator.canShare && navigator.canShare(e)) try {
|
|
4513
4523
|
return await navigator.share(e), !0;
|
|
4514
4524
|
} catch (e) {
|
|
4515
4525
|
T.on({
|
|
@@ -4522,12 +4532,12 @@ async function Kn(e) {
|
|
|
4522
4532
|
}
|
|
4523
4533
|
//#endregion
|
|
4524
4534
|
//#region src/functions/inArray.ts
|
|
4525
|
-
function
|
|
4535
|
+
function Jn(e, t) {
|
|
4526
4536
|
return e.includes(t);
|
|
4527
4537
|
}
|
|
4528
4538
|
//#endregion
|
|
4529
4539
|
//#region src/functions/initScrollbarOffset.ts
|
|
4530
|
-
async function
|
|
4540
|
+
async function Yn() {
|
|
4531
4541
|
if (s()) {
|
|
4532
4542
|
let e = await At.get();
|
|
4533
4543
|
document.body.style.setProperty("--sys-scrollbar-offset", `${e}px`);
|
|
@@ -4535,7 +4545,7 @@ async function Jn() {
|
|
|
4535
4545
|
}
|
|
4536
4546
|
//#endregion
|
|
4537
4547
|
//#region src/functions/intersectKey.ts
|
|
4538
|
-
function
|
|
4548
|
+
function Xn(e, n) {
|
|
4539
4549
|
let i = {};
|
|
4540
4550
|
return t(e) && t(n) && r(e, (e, t) => {
|
|
4541
4551
|
t in n && (i[t] = e);
|
|
@@ -4543,7 +4553,7 @@ function Yn(e, n) {
|
|
|
4543
4553
|
}
|
|
4544
4554
|
//#endregion
|
|
4545
4555
|
//#region src/functions/isDifferent.ts
|
|
4546
|
-
function
|
|
4556
|
+
function Zn(e, t) {
|
|
4547
4557
|
let n = Object.keys(e).length !== Object.keys(t).length;
|
|
4548
4558
|
return n || r(e, (e, r) => {
|
|
4549
4559
|
e !== (t == null ? void 0 : t[r]) && (n = !0);
|
|
@@ -4551,7 +4561,7 @@ function Xn(e, t) {
|
|
|
4551
4561
|
}
|
|
4552
4562
|
//#endregion
|
|
4553
4563
|
//#region src/functions/isElementVisible.ts
|
|
4554
|
-
function
|
|
4564
|
+
function Qn(e) {
|
|
4555
4565
|
if (!s()) return !1;
|
|
4556
4566
|
let t = k(e);
|
|
4557
4567
|
if (!t || "isConnected" in t && t.isConnected === !1) return !1;
|
|
@@ -4560,16 +4570,16 @@ function Zn(e) {
|
|
|
4560
4570
|
}
|
|
4561
4571
|
//#endregion
|
|
4562
4572
|
//#region src/functions/isInput.ts
|
|
4563
|
-
var
|
|
4573
|
+
var $n = (e) => {
|
|
4564
4574
|
if (e instanceof HTMLElement) {
|
|
4565
4575
|
let t = e.tagName.toLowerCase();
|
|
4566
4576
|
return !!(t === "input" || t === "textarea" || t === "select" || e.isContentEditable || e.getAttribute("contenteditable") === "true") && !(e != null && e.readOnly) && !(e != null && e.disabled);
|
|
4567
4577
|
}
|
|
4568
4578
|
return !1;
|
|
4569
|
-
},
|
|
4579
|
+
}, er = (e, t) => e.code === "Space" || e.code === "Enter" || e.key === " " || e.key === "Spacebar" || e.key === "Enter" || e.keyCode === 13 || e.keyCode === 32 ? t === void 0 ? !$n(e.target) : !t : !1;
|
|
4570
4580
|
//#endregion
|
|
4571
4581
|
//#region src/functions/isFloat.ts
|
|
4572
|
-
function
|
|
4582
|
+
function tr(e) {
|
|
4573
4583
|
switch (typeof e) {
|
|
4574
4584
|
case "number": return !0;
|
|
4575
4585
|
case "string": return /^-?\d+(\.\d+)?$/.test(e);
|
|
@@ -4578,21 +4588,21 @@ function er(e) {
|
|
|
4578
4588
|
}
|
|
4579
4589
|
//#endregion
|
|
4580
4590
|
//#region src/functions/isIntegerBetween.ts
|
|
4581
|
-
function
|
|
4591
|
+
function nr(e, t) {
|
|
4582
4592
|
let n = Math.floor(t);
|
|
4583
4593
|
return e >= n && e < n + 1;
|
|
4584
4594
|
}
|
|
4585
4595
|
//#endregion
|
|
4586
4596
|
//#region src/functions/isSelectedByList.ts
|
|
4587
|
-
function
|
|
4597
|
+
function rr(e, t) {
|
|
4588
4598
|
return Array.isArray(e) ? e.every((e) => b(e, t)) : b(e, t);
|
|
4589
4599
|
}
|
|
4590
4600
|
//#endregion
|
|
4591
4601
|
//#region src/functions/isTab.ts
|
|
4592
|
-
var
|
|
4602
|
+
var ir = (e) => e.key === "Tab" || e.code === "Tab" || e.keyCode === 9;
|
|
4593
4603
|
//#endregion
|
|
4594
4604
|
//#region src/functions/removeCommonPrefix.ts
|
|
4595
|
-
function
|
|
4605
|
+
function ar(e, t) {
|
|
4596
4606
|
if (e.startsWith(t)) return e.slice(t.length).trim();
|
|
4597
4607
|
let n = 0;
|
|
4598
4608
|
for (; e[n] === t[n] && n < e.length && n < t.length;) n++;
|
|
@@ -4600,13 +4610,13 @@ function ir(e, t) {
|
|
|
4600
4610
|
}
|
|
4601
4611
|
//#endregion
|
|
4602
4612
|
//#region src/functions/replaceComponentName.ts
|
|
4603
|
-
var
|
|
4613
|
+
var or = (e, t, n) => {
|
|
4604
4614
|
var r;
|
|
4605
4615
|
return e == null || (r = e.replace(RegExp(`<${t}`, "ig"), `<${n}`)) == null || (r = r.replace(RegExp(`</${t}`, "ig"), `</${n}`)) == null ? void 0 : r.trim();
|
|
4606
4616
|
};
|
|
4607
4617
|
//#endregion
|
|
4608
4618
|
//#region src/functions/uniqueArray.ts
|
|
4609
|
-
function
|
|
4619
|
+
function sr(e) {
|
|
4610
4620
|
return [...new Set(e)];
|
|
4611
4621
|
}
|
|
4612
4622
|
//#endregion
|
|
@@ -4615,12 +4625,12 @@ function $(e, n, i = !0) {
|
|
|
4615
4625
|
let a = Z(e);
|
|
4616
4626
|
return t(e) && t(n) && r(n, (n, r) => {
|
|
4617
4627
|
let o = e == null ? void 0 : e[r];
|
|
4618
|
-
t(o) && t(n) ? i && Array.isArray(o) && Array.isArray(n) ? a[r] = Z(
|
|
4628
|
+
t(o) && t(n) ? i && Array.isArray(o) && Array.isArray(n) ? a[r] = Z(sr([...o, ...n])) : a[r] = $(Array.isArray(o) ? { ...o } : o, n, i) : a[r] = t(n) ? Z(n) : n;
|
|
4619
4629
|
}), a;
|
|
4620
4630
|
}
|
|
4621
4631
|
//#endregion
|
|
4622
4632
|
//#region src/functions/replaceTemplate.ts
|
|
4623
|
-
function
|
|
4633
|
+
function cr(e, t) {
|
|
4624
4634
|
let n = e;
|
|
4625
4635
|
return r(t, (e, t) => {
|
|
4626
4636
|
n = n.replace(Lt(`[${t}]`), S(e));
|
|
@@ -4628,7 +4638,7 @@ function sr(e, t) {
|
|
|
4628
4638
|
}
|
|
4629
4639
|
//#endregion
|
|
4630
4640
|
//#region src/functions/secondToTime.ts
|
|
4631
|
-
function
|
|
4641
|
+
function lr(e, t) {
|
|
4632
4642
|
let n = y(e);
|
|
4633
4643
|
if (n > 0) {
|
|
4634
4644
|
let e = String(Math.floor(n / 60)).padStart(2, "0"), r = String(n % 60).padStart(2, "0");
|
|
@@ -4638,7 +4648,7 @@ function cr(e, t) {
|
|
|
4638
4648
|
}
|
|
4639
4649
|
//#endregion
|
|
4640
4650
|
//#region src/functions/setValues.ts
|
|
4641
|
-
function
|
|
4651
|
+
function ur(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: a = !0, notEmpty: o = !1 }) {
|
|
4642
4652
|
if (n) {
|
|
4643
4653
|
if (i(e)) {
|
|
4644
4654
|
let n = e.indexOf(t), i = [...e];
|
|
@@ -4650,7 +4660,7 @@ function lr(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: a = !0, no
|
|
|
4650
4660
|
}
|
|
4651
4661
|
//#endregion
|
|
4652
4662
|
//#region src/functions/splice.ts
|
|
4653
|
-
function
|
|
4663
|
+
function dr(e, n, i) {
|
|
4654
4664
|
if (t(e) && t(n)) {
|
|
4655
4665
|
if (i) {
|
|
4656
4666
|
let a = {}, o = !1;
|
|
@@ -4664,34 +4674,34 @@ function ur(e, n, i) {
|
|
|
4664
4674
|
}
|
|
4665
4675
|
//#endregion
|
|
4666
4676
|
//#region src/functions/toCamelCaseFirst.ts
|
|
4667
|
-
function
|
|
4677
|
+
function fr(e) {
|
|
4668
4678
|
return it(e).replace(/^([a-z])/, (e) => `${e.toUpperCase()}`);
|
|
4669
4679
|
}
|
|
4670
4680
|
//#endregion
|
|
4671
4681
|
//#region src/functions/toKebabCase.ts
|
|
4672
|
-
function
|
|
4682
|
+
function pr(e) {
|
|
4673
4683
|
return e.toString().trim().replace(/[^\w-. ]+/g, "").replace(/[ .]+/g, "-").replace(/(?<=[A-Z])([A-Z])/g, (e) => `${e.toLowerCase()}`).replace(/^[A-Z]/, (e) => e.toLowerCase()).replace(/(?<=[\w ])[A-Z]/g, (e) => `-${e.toLowerCase()}`).replace(/[A-Z]/g, (e) => e.toLowerCase());
|
|
4674
4684
|
}
|
|
4675
4685
|
//#endregion
|
|
4676
4686
|
//#region src/functions/toNumberByMax.ts
|
|
4677
|
-
function
|
|
4687
|
+
function mr(e, t, n, r) {
|
|
4678
4688
|
let i = y(e), a = y(t);
|
|
4679
|
-
return t && a < i ? `${
|
|
4689
|
+
return t && a < i ? `${hr(a, n, r)}+` : hr(i, n, r);
|
|
4680
4690
|
}
|
|
4681
|
-
var
|
|
4691
|
+
var hr = (e, t, n) => t ? new R(n).number(e) : e;
|
|
4682
4692
|
//#endregion
|
|
4683
4693
|
//#region src/functions/toPercent.ts
|
|
4684
|
-
function
|
|
4694
|
+
function gr(e, t) {
|
|
4685
4695
|
return e === 0 ? t : 1 / e * t;
|
|
4686
4696
|
}
|
|
4687
4697
|
//#endregion
|
|
4688
4698
|
//#region src/functions/toPercentBy100.ts
|
|
4689
|
-
function
|
|
4690
|
-
return
|
|
4699
|
+
function _r(e, t) {
|
|
4700
|
+
return gr(e, t) * 100;
|
|
4691
4701
|
}
|
|
4692
4702
|
//#endregion
|
|
4693
4703
|
//#region src/functions/uint8ArrayToBase64.ts
|
|
4694
|
-
function
|
|
4704
|
+
function vr(e) {
|
|
4695
4705
|
let t = "";
|
|
4696
4706
|
for (let n of e) t += String.fromCharCode(n);
|
|
4697
4707
|
if (s()) return window.btoa(t);
|
|
@@ -4703,7 +4713,7 @@ function _r(e) {
|
|
|
4703
4713
|
}
|
|
4704
4714
|
//#endregion
|
|
4705
4715
|
//#region src/functions/writeClipboardData.ts
|
|
4706
|
-
async function
|
|
4716
|
+
async function yr(e) {
|
|
4707
4717
|
if (s()) try {
|
|
4708
4718
|
await navigator.clipboard.writeText(e);
|
|
4709
4719
|
} catch (n) {
|
|
@@ -4712,4 +4722,4 @@ async function vr(e) {
|
|
|
4712
4722
|
}
|
|
4713
4723
|
}
|
|
4714
4724
|
//#endregion
|
|
4715
|
-
export { P as Api, M as ApiCache, Ae as ApiDataReturn, je as ApiDefault, Pe as ApiError, Me as ApiErrorItem, Ne as ApiErrorStorage, Fe as ApiHeaders, Le as ApiHydration, He as ApiInstance, N as ApiMethodItem, Re as ApiPreparation, Ve as ApiResponse, Oe as ApiStatus, Ue as BroadcastMessage, Ke as Cache, Ge as CacheItem, qe as CacheStatic, tt as Cookie, Qe as CookieBlock, Ze as CookieBlockInstance, I as CookieStorage, D as DataStorage, rt as Datetime, T as ErrorCenter, le as ErrorCenterHandler, ue as ErrorCenterInstance, Ce as EventItem, at as Formatters, H as FormattersType, ot as GEO_FLAG_ICON_NAME, O as Geo, st as GeoFlag, ye as GeoInstance, R as GeoIntl, ct as GeoPhone, lt as Global, dt as Hash, ut as HashInstance, mt as Icons, j as Loading, Te as LoadingInstance, Dt as Meta, G as MetaManager, Tt as MetaOg, St as MetaOpenGraphAge, bt as MetaOpenGraphAvailability, xt as MetaOpenGraphCondition, Ct as MetaOpenGraphGender, q as MetaOpenGraphTag, yt as MetaOpenGraphType, vt as MetaRobots, Ot as MetaStatic, K as MetaTag, Et as MetaTwitter, wt as MetaTwitterCard, J as MetaTwitterTag, kt as ResumableTimer, At as ScrollbarWidth, Ht as SearchList, Ft as SearchListData, It as SearchListItem, Bt as SearchListMatcher, Vt as SearchListOptions, E as ServerStorage, Wt as StorageCallback, Yt as TRANSLATE_GLOBAL_PREFIX, Xt as TRANSLATE_TIME_OUT, $t as Translate, Zt as TranslateFile, Qt as TranslateInstance, Pt as addTagHighlightMatch, F as anyToString, qt as applyTemplate, en as arrFill, on as blobToBase64, sn as capitalize, Z as copyObject, cn as copyObjectLite, U as createElement, ln as domQuerySelector, un as domQuerySelectorAll, W as encodeAttribute, ae as encodeLiteAttribute, mn as ensureMaxSize, Y as escapeExp, hn as eventStopPropagation, S as executeFunction, ze as executePromise, r as forEach, gn as frame, _n as getArrayHighlightMatch, vn as getAttributes, yn as getClipboardData, nt as getColumn, bn as getCurrentDate, xn as getCurrentTime, k as getElement, Cn as getElementId, dn as getElementImage, ht as getElementItem, xe as getElementOrWindow, fe as getElementSafeScript, Rt as getExactSearchExp, Lt as getExp, Tn as getFirst, pe as getHydrationData, V as getItemByPath, En as getKey, Dn as
|
|
4725
|
+
export { P as Api, M as ApiCache, Ae as ApiDataReturn, je as ApiDefault, Pe as ApiError, Me as ApiErrorItem, Ne as ApiErrorStorage, Fe as ApiHeaders, Le as ApiHydration, He as ApiInstance, N as ApiMethodItem, Re as ApiPreparation, Ve as ApiResponse, Oe as ApiStatus, Ue as BroadcastMessage, Ke as Cache, Ge as CacheItem, qe as CacheStatic, tt as Cookie, Qe as CookieBlock, Ze as CookieBlockInstance, I as CookieStorage, D as DataStorage, rt as Datetime, T as ErrorCenter, le as ErrorCenterHandler, ue as ErrorCenterInstance, Ce as EventItem, at as Formatters, H as FormattersType, ot as GEO_FLAG_ICON_NAME, O as Geo, st as GeoFlag, ye as GeoInstance, R as GeoIntl, ct as GeoPhone, lt as Global, dt as Hash, ut as HashInstance, mt as Icons, j as Loading, Te as LoadingInstance, Dt as Meta, G as MetaManager, Tt as MetaOg, St as MetaOpenGraphAge, bt as MetaOpenGraphAvailability, xt as MetaOpenGraphCondition, Ct as MetaOpenGraphGender, q as MetaOpenGraphTag, yt as MetaOpenGraphType, vt as MetaRobots, Ot as MetaStatic, K as MetaTag, Et as MetaTwitter, wt as MetaTwitterCard, J as MetaTwitterTag, kt as ResumableTimer, At as ScrollbarWidth, Ht as SearchList, Ft as SearchListData, It as SearchListItem, Bt as SearchListMatcher, Vt as SearchListOptions, E as ServerStorage, Wt as StorageCallback, Yt as TRANSLATE_GLOBAL_PREFIX, Xt as TRANSLATE_TIME_OUT, $t as Translate, Zt as TranslateFile, Qt as TranslateInstance, Pt as addTagHighlightMatch, F as anyToString, qt as applyTemplate, en as arrFill, on as blobToBase64, sn as capitalize, Z as copyObject, cn as copyObjectLite, U as createElement, ln as domQuerySelector, un as domQuerySelectorAll, W as encodeAttribute, ae as encodeLiteAttribute, mn as ensureMaxSize, Y as escapeExp, hn as eventStopPropagation, S as executeFunction, ze as executePromise, r as forEach, gn as frame, _n as getArrayHighlightMatch, vn as getAttributes, yn as getClipboardData, nt as getColumn, bn as getCurrentDate, xn as getCurrentTime, k as getElement, Cn as getElementId, dn as getElementImage, ht as getElementItem, xe as getElementOrWindow, fe as getElementSafeScript, Rt as getExactSearchExp, Lt as getExp, Tn as getFirst, pe as getHydrationData, V as getItemByPath, En as getKey, Dn as getLength, On as getLengthOfAllArray, kn as getMaxLengthAllArray, An as getMinLengthAllArray, Nn as getMouseClient, jn as getMouseClientX, Mn as getMouseClientY, Pn as getObjectByKeys, Fn as getObjectNoUndefined, In as getObjectOrNone, Ln as getOnlyText, zn as getRandomText, o as getRequestString, zt as getSearchExp, jt as getSeparatingSearchExp, Bn as getStepPercent, Vn as getStepValue, Un as goScroll, Wn as goScrollSmooth, Gn as goScrollTo, qn as handleShare, Jn as inArray, wn as initGetElementId, Yn as initScrollbarOffset, Xn as intersectKey, Jt as isApiSuccess, i as isArray, Zn as isDifferent, oe as isDomData, s as isDomRuntime, Qn as isElementVisible, er as isEnter, l as isFilled, tr as isFloat, x as isFunction, Se as isInDom, $n as isInput, nr as isIntegerBetween, c as isNull, p as isNumber, t as isObject, n as isObjectNotArray, u as isOnLine, b as isSelected, rr as isSelectedByList, Kn as isShare, d as isString, ir as isTab, be as isWindow, f as random, ar as removeCommonPrefix, or as replaceComponentName, $ as replaceRecursive, cr as replaceTemplate, pn as resizeImageByMax, lr as secondToTime, gt as setElementItem, ur as setValues, ee as sleep, dr as splice, Rn as strFill, Je as strSplit, A as toArray, it as toCamelCase, fr as toCamelCaseFirst, L as toDate, pr as toKebabCase, y as toNumber, mr as toNumberByMax, gr as toPercent, _r as toPercentBy100, a as toString, Ye as transformation, vr as uint8ArrayToBase64, sr as uniqueArray, yr as writeClipboardData };
|
|
@@ -30,6 +30,13 @@ export declare class GeoFlag {
|
|
|
30
30
|
* @returns country information / информация о стране
|
|
31
31
|
*/
|
|
32
32
|
get(code?: string): GeoFlagItem | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the country code.
|
|
35
|
+
*
|
|
36
|
+
* Возвращает код страны.
|
|
37
|
+
* @returns country code / код страны
|
|
38
|
+
*/
|
|
39
|
+
getCode(): string;
|
|
33
40
|
/**
|
|
34
41
|
* Returns the identifier of the flag icon.
|
|
35
42
|
*
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the length or size of various data types including Arrays, Objects, Maps, Sets, and Strings.
|
|
3
|
+
* If the value is null, undefined, or an unsupported type (e.g. number, boolean), it returns 0.
|
|
4
|
+
*
|
|
5
|
+
* Возвращает длину или размер различных типов данных, включая массивы, объекты, Map, Set и строки.
|
|
6
|
+
* Если значение равно null, undefined или имеет неподдерживаемый тип (например, число, булево), возвращает 0.
|
|
7
|
+
* @param value input value to measure / входное значение для измерения
|
|
8
|
+
* @returns the length or size of the value / длина или размер значения
|
|
9
|
+
*/
|
|
10
|
+
export declare function getLength(value: any): number;
|
package/dist/src/library.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ export * from './functions/getFirst';
|
|
|
92
92
|
export * from './functions/getHydrationData';
|
|
93
93
|
export * from './functions/getItemByPath';
|
|
94
94
|
export * from './functions/getKey';
|
|
95
|
+
export * from './functions/getLength';
|
|
95
96
|
export * from './functions/getLengthOfAllArray';
|
|
96
97
|
export * from './functions/getMaxLengthAllArray';
|
|
97
98
|
export * from './functions/getMinLengthAllArray';
|
|
@@ -53,6 +53,8 @@ export interface GeoFlagItem {
|
|
|
53
53
|
label: string;
|
|
54
54
|
/** Value for selection/ Значение для выбора */
|
|
55
55
|
value: string;
|
|
56
|
+
/** Phone country code/ Телефонный код страны */
|
|
57
|
+
phoneCode?: string;
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
60
|
* Extended geographic flag item with national language information/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/functional-basic",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Foundational utility library for modern web development — HTTP client, geolocation, i18n, SEO meta tags, caching, storage, DOM utilities, and more. Framework-agnostic, zero dependencies, TypeScript-first.",
|
|
7
7
|
"keywords": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dev": "vite",
|
|
52
52
|
"build": "vite build",
|
|
53
53
|
"preview": "vite preview",
|
|
54
|
-
"test": "vitest",
|
|
54
|
+
"test": "NODE_OPTIONS=\"--no-webstorage\" vitest",
|
|
55
55
|
"library": "dxt-library",
|
|
56
56
|
"types": "dxt-types",
|
|
57
57
|
"prepublishOnly": "npm run library && npm run build",
|
|
@@ -83,5 +83,6 @@
|
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"@dxtmisha/media": "*"
|
|
85
85
|
},
|
|
86
|
-
"sideEffects": false
|
|
86
|
+
"sideEffects": false,
|
|
87
|
+
"ui-priority": 100
|
|
87
88
|
}
|