@dxtmisha/functional-basic 1.2.10 → 1.3.4

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 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
- Это базовая функциональная библиотека (@dxtmisha/functional-basic). Здесь собраны алгоритмы, утилиты и классы, независимые от фреймворка.
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 ENVIROMENT:
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
- return n(e) && Object.assign(r, e), l(t) && (r["Content-Type"] = t), r;
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.code) {
2649
+ get(t = this.getCode()) {
2649
2650
  let n = O.find(t);
2650
2651
  if (n) {
2651
2652
  var r;
@@ -2656,19 +2657,24 @@ 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
- getFlag(e = this.code) {
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
  }
2667
- getList(e) {
2668
- return r(this.getCodes(e), (e) => this.get(e));
2672
+ getList(e, t = !0) {
2673
+ let n = r(this.getCodes(e), (e) => this.get(e));
2674
+ return t ? new R().sort(n, (e, t) => [e.label, t.label]) : n;
2669
2675
  }
2670
- getNational(t) {
2671
- return r(this.getList(t), (t) => {
2676
+ getNational(t, n = !0) {
2677
+ let i = r(this.getList(t, !1), (t) => {
2672
2678
  let n = new e(t.standard).get(t.standard);
2673
2679
  return {
2674
2680
  ...t,
@@ -2677,6 +2683,7 @@ var H = /* @__PURE__ */ function(e) {
2677
2683
  nationalCountry: n == null ? void 0 : n.country
2678
2684
  };
2679
2685
  });
2686
+ return n ? new R().sort(i, (e, t) => [e.label, t.label]) : i;
2680
2687
  }
2681
2688
  setCode(e) {
2682
2689
  return this.code = e, this;
@@ -4363,8 +4370,13 @@ function En(e) {
4363
4370
  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
4371
  }
4365
4372
  //#endregion
4366
- //#region src/functions/getLengthOfAllArray.ts
4373
+ //#region src/functions/getLength.ts
4367
4374
  function Dn(e) {
4375
+ 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;
4376
+ }
4377
+ //#endregion
4378
+ //#region src/functions/getLengthOfAllArray.ts
4379
+ function On(e) {
4368
4380
  return r(e, (e) => {
4369
4381
  var t;
4370
4382
  return (t = e == null ? void 0 : e.length) == null ? 0 : t;
@@ -4372,41 +4384,41 @@ function Dn(e) {
4372
4384
  }
4373
4385
  //#endregion
4374
4386
  //#region src/functions/getMaxLengthAllArray.ts
4375
- function On(e) {
4387
+ function kn(e) {
4376
4388
  if (!l(e)) return 0;
4377
- let t = Dn(e);
4389
+ let t = On(e);
4378
4390
  return t.length > 1e4 ? t.reduce((e, t) => Math.max(e, t)) : Math.max(...t);
4379
4391
  }
4380
4392
  //#endregion
4381
4393
  //#region src/functions/getMinLengthAllArray.ts
4382
- function kn(e) {
4394
+ function An(e) {
4383
4395
  if (!l(e)) return 0;
4384
- let t = Dn(e);
4396
+ let t = On(e);
4385
4397
  return t.length > 1e4 ? t.reduce((e, t) => Math.min(e, t)) : Math.min(...t);
4386
4398
  }
4387
4399
  //#endregion
4388
4400
  //#region src/functions/getMouseClientX.ts
4389
- function An(e) {
4401
+ function jn(e) {
4390
4402
  var t, n;
4391
4403
  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
4404
  }
4393
4405
  //#endregion
4394
4406
  //#region src/functions/getMouseClientY.ts
4395
- function jn(e) {
4407
+ function Mn(e) {
4396
4408
  var t, n;
4397
4409
  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
4410
  }
4399
4411
  //#endregion
4400
4412
  //#region src/functions/getMouseClient.ts
4401
- function Mn(e) {
4413
+ function Nn(e) {
4402
4414
  return {
4403
- x: An(e),
4404
- y: jn(e)
4415
+ x: jn(e),
4416
+ y: Mn(e)
4405
4417
  };
4406
4418
  }
4407
4419
  //#endregion
4408
4420
  //#region src/functions/getObjectByKeys.ts
4409
- function Nn(e, t) {
4421
+ function Pn(e, t) {
4410
4422
  let r = {};
4411
4423
  return n(e) && t.forEach((t) => {
4412
4424
  t in e && e[t] !== void 0 && (r[t] = e[t]);
@@ -4414,7 +4426,7 @@ function Nn(e, t) {
4414
4426
  }
4415
4427
  //#endregion
4416
4428
  //#region src/functions/getObjectNoUndefined.ts
4417
- function Pn(e, t = void 0) {
4429
+ function Fn(e, t = void 0) {
4418
4430
  let n = {};
4419
4431
  return r(e, (e, r) => {
4420
4432
  e !== t && (n[r] = e);
@@ -4422,42 +4434,42 @@ function Pn(e, t = void 0) {
4422
4434
  }
4423
4435
  //#endregion
4424
4436
  //#region src/functions/getObjectOrNone.ts
4425
- function Fn(e) {
4437
+ function In(e) {
4426
4438
  return n(e) ? e : {};
4427
4439
  }
4428
4440
  //#endregion
4429
4441
  //#region src/functions/getOnlyText.ts
4430
- function In(e) {
4442
+ function Ln(e) {
4431
4443
  return F(e).replace(/[^\p{L}\p{N}\s]+/gu, "").trim();
4432
4444
  }
4433
4445
  //#endregion
4434
4446
  //#region src/functions/strFill.ts
4435
- function Ln(e, t) {
4447
+ function Rn(e, t) {
4436
4448
  return String(e).repeat(t);
4437
4449
  }
4438
4450
  //#endregion
4439
4451
  //#region src/functions/getRandomText.ts
4440
- function Rn(e, t, n = "#", r = 2, i = 12) {
4452
+ function zn(e, t, n = "#", r = 2, i = 12) {
4441
4453
  let a = f(e, t), o = [];
4442
- for (let e = 0; e < a; e++) o.push(Ln(n, f(r, i)));
4454
+ for (let e = 0; e < a; e++) o.push(Rn(n, f(r, i)));
4443
4455
  return o.join(" ");
4444
4456
  }
4445
4457
  //#endregion
4446
4458
  //#region src/functions/getStepPercent.ts
4447
- function zn(e, t) {
4459
+ function Bn(e, t) {
4448
4460
  let n = e == null ? 0 : e;
4449
4461
  return t > n ? 100 / (t - n) : 0;
4450
4462
  }
4451
4463
  //#endregion
4452
4464
  //#region src/functions/getStepValue.ts
4453
- function Bn(e, t) {
4465
+ function Vn(e, t) {
4454
4466
  let n = e == null ? 0 : e;
4455
4467
  return t > n ? (t - n) / 100 : 0;
4456
4468
  }
4457
4469
  //#endregion
4458
4470
  //#region src/functions/goScroll.ts
4459
- var Vn = 0;
4460
- function Hn(e, t, n) {
4471
+ var Hn = 0;
4472
+ function Un(e, t, n) {
4461
4473
  if (!s()) return;
4462
4474
  let r = t == null ? void 0 : t.closest(e);
4463
4475
  if (t && r && r.scrollHeight !== r.offsetHeight) {
@@ -4465,12 +4477,12 @@ function Hn(e, t, n) {
4465
4477
  if (n) {
4466
4478
  let a = n.getBoundingClientRect();
4467
4479
  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 - Vn : r.scrollTop + r.offsetHeight < t.offsetTop + t.offsetHeight && (r.scrollTop = i.top - e.top + i.height - e.height + Vn);
4480
+ } 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
4481
  }
4470
4482
  }
4471
4483
  //#endregion
4472
4484
  //#region src/functions/goScrollSmooth.ts
4473
- function Un(e, t, n = 0) {
4485
+ function Wn(e, t, n = 0) {
4474
4486
  if (!s()) return;
4475
4487
  let r = (t == null ? void 0 : t.behavior) || "smooth";
4476
4488
  if ("scrollIntoView" in e && !n) {
@@ -4492,7 +4504,7 @@ function Un(e, t, n = 0) {
4492
4504
  }
4493
4505
  //#endregion
4494
4506
  //#region src/functions/goScrollTo.ts
4495
- function Wn(e, t, n = "smooth") {
4507
+ function Gn(e, t, n = "smooth") {
4496
4508
  if (!s() || !e || !t) return;
4497
4509
  let r = e.getBoundingClientRect(), i = t.getBoundingClientRect();
4498
4510
  e.scrollBy({
@@ -4503,13 +4515,13 @@ function Wn(e, t, n = "smooth") {
4503
4515
  }
4504
4516
  //#endregion
4505
4517
  //#region src/functions/isShare.ts
4506
- function Gn() {
4518
+ function Kn() {
4507
4519
  return s() && typeof navigator < "u" && !!navigator.share;
4508
4520
  }
4509
4521
  //#endregion
4510
4522
  //#region src/functions/handleShare.ts
4511
- async function Kn(e) {
4512
- if (Gn() && navigator.canShare && navigator.canShare(e)) try {
4523
+ async function qn(e) {
4524
+ if (Kn() && navigator.canShare && navigator.canShare(e)) try {
4513
4525
  return await navigator.share(e), !0;
4514
4526
  } catch (e) {
4515
4527
  T.on({
@@ -4522,12 +4534,12 @@ async function Kn(e) {
4522
4534
  }
4523
4535
  //#endregion
4524
4536
  //#region src/functions/inArray.ts
4525
- function qn(e, t) {
4537
+ function Jn(e, t) {
4526
4538
  return e.includes(t);
4527
4539
  }
4528
4540
  //#endregion
4529
4541
  //#region src/functions/initScrollbarOffset.ts
4530
- async function Jn() {
4542
+ async function Yn() {
4531
4543
  if (s()) {
4532
4544
  let e = await At.get();
4533
4545
  document.body.style.setProperty("--sys-scrollbar-offset", `${e}px`);
@@ -4535,7 +4547,7 @@ async function Jn() {
4535
4547
  }
4536
4548
  //#endregion
4537
4549
  //#region src/functions/intersectKey.ts
4538
- function Yn(e, n) {
4550
+ function Xn(e, n) {
4539
4551
  let i = {};
4540
4552
  return t(e) && t(n) && r(e, (e, t) => {
4541
4553
  t in n && (i[t] = e);
@@ -4543,7 +4555,7 @@ function Yn(e, n) {
4543
4555
  }
4544
4556
  //#endregion
4545
4557
  //#region src/functions/isDifferent.ts
4546
- function Xn(e, t) {
4558
+ function Zn(e, t) {
4547
4559
  let n = Object.keys(e).length !== Object.keys(t).length;
4548
4560
  return n || r(e, (e, r) => {
4549
4561
  e !== (t == null ? void 0 : t[r]) && (n = !0);
@@ -4551,7 +4563,7 @@ function Xn(e, t) {
4551
4563
  }
4552
4564
  //#endregion
4553
4565
  //#region src/functions/isElementVisible.ts
4554
- function Zn(e) {
4566
+ function Qn(e) {
4555
4567
  if (!s()) return !1;
4556
4568
  let t = k(e);
4557
4569
  if (!t || "isConnected" in t && t.isConnected === !1) return !1;
@@ -4560,16 +4572,16 @@ function Zn(e) {
4560
4572
  }
4561
4573
  //#endregion
4562
4574
  //#region src/functions/isInput.ts
4563
- var Qn = (e) => {
4575
+ var $n = (e) => {
4564
4576
  if (e instanceof HTMLElement) {
4565
4577
  let t = e.tagName.toLowerCase();
4566
4578
  return !!(t === "input" || t === "textarea" || t === "select" || e.isContentEditable || e.getAttribute("contenteditable") === "true") && !(e != null && e.readOnly) && !(e != null && e.disabled);
4567
4579
  }
4568
4580
  return !1;
4569
- }, $n = (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 ? !Qn(e.target) : !t : !1;
4581
+ }, 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
4582
  //#endregion
4571
4583
  //#region src/functions/isFloat.ts
4572
- function er(e) {
4584
+ function tr(e) {
4573
4585
  switch (typeof e) {
4574
4586
  case "number": return !0;
4575
4587
  case "string": return /^-?\d+(\.\d+)?$/.test(e);
@@ -4578,21 +4590,21 @@ function er(e) {
4578
4590
  }
4579
4591
  //#endregion
4580
4592
  //#region src/functions/isIntegerBetween.ts
4581
- function tr(e, t) {
4593
+ function nr(e, t) {
4582
4594
  let n = Math.floor(t);
4583
4595
  return e >= n && e < n + 1;
4584
4596
  }
4585
4597
  //#endregion
4586
4598
  //#region src/functions/isSelectedByList.ts
4587
- function nr(e, t) {
4599
+ function rr(e, t) {
4588
4600
  return Array.isArray(e) ? e.every((e) => b(e, t)) : b(e, t);
4589
4601
  }
4590
4602
  //#endregion
4591
4603
  //#region src/functions/isTab.ts
4592
- var rr = (e) => e.key === "Tab" || e.code === "Tab" || e.keyCode === 9;
4604
+ var ir = (e) => e.key === "Tab" || e.code === "Tab" || e.keyCode === 9;
4593
4605
  //#endregion
4594
4606
  //#region src/functions/removeCommonPrefix.ts
4595
- function ir(e, t) {
4607
+ function ar(e, t) {
4596
4608
  if (e.startsWith(t)) return e.slice(t.length).trim();
4597
4609
  let n = 0;
4598
4610
  for (; e[n] === t[n] && n < e.length && n < t.length;) n++;
@@ -4600,13 +4612,13 @@ function ir(e, t) {
4600
4612
  }
4601
4613
  //#endregion
4602
4614
  //#region src/functions/replaceComponentName.ts
4603
- var ar = (e, t, n) => {
4615
+ var or = (e, t, n) => {
4604
4616
  var r;
4605
4617
  return e == null || (r = e.replace(RegExp(`<${t}`, "ig"), `<${n}`)) == null || (r = r.replace(RegExp(`</${t}`, "ig"), `</${n}`)) == null ? void 0 : r.trim();
4606
4618
  };
4607
4619
  //#endregion
4608
4620
  //#region src/functions/uniqueArray.ts
4609
- function or(e) {
4621
+ function sr(e) {
4610
4622
  return [...new Set(e)];
4611
4623
  }
4612
4624
  //#endregion
@@ -4615,12 +4627,12 @@ function $(e, n, i = !0) {
4615
4627
  let a = Z(e);
4616
4628
  return t(e) && t(n) && r(n, (n, r) => {
4617
4629
  let o = e == null ? void 0 : e[r];
4618
- t(o) && t(n) ? i && Array.isArray(o) && Array.isArray(n) ? a[r] = Z(or([...o, ...n])) : a[r] = $(Array.isArray(o) ? { ...o } : o, n, i) : a[r] = t(n) ? Z(n) : n;
4630
+ 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
4631
  }), a;
4620
4632
  }
4621
4633
  //#endregion
4622
4634
  //#region src/functions/replaceTemplate.ts
4623
- function sr(e, t) {
4635
+ function cr(e, t) {
4624
4636
  let n = e;
4625
4637
  return r(t, (e, t) => {
4626
4638
  n = n.replace(Lt(`[${t}]`), S(e));
@@ -4628,7 +4640,7 @@ function sr(e, t) {
4628
4640
  }
4629
4641
  //#endregion
4630
4642
  //#region src/functions/secondToTime.ts
4631
- function cr(e, t) {
4643
+ function lr(e, t) {
4632
4644
  let n = y(e);
4633
4645
  if (n > 0) {
4634
4646
  let e = String(Math.floor(n / 60)).padStart(2, "0"), r = String(n % 60).padStart(2, "0");
@@ -4638,7 +4650,7 @@ function cr(e, t) {
4638
4650
  }
4639
4651
  //#endregion
4640
4652
  //#region src/functions/setValues.ts
4641
- function lr(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: a = !0, notEmpty: o = !1 }) {
4653
+ function ur(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: a = !0, notEmpty: o = !1 }) {
4642
4654
  if (n) {
4643
4655
  if (i(e)) {
4644
4656
  let n = e.indexOf(t), i = [...e];
@@ -4650,7 +4662,7 @@ function lr(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: a = !0, no
4650
4662
  }
4651
4663
  //#endregion
4652
4664
  //#region src/functions/splice.ts
4653
- function ur(e, n, i) {
4665
+ function dr(e, n, i) {
4654
4666
  if (t(e) && t(n)) {
4655
4667
  if (i) {
4656
4668
  let a = {}, o = !1;
@@ -4664,34 +4676,34 @@ function ur(e, n, i) {
4664
4676
  }
4665
4677
  //#endregion
4666
4678
  //#region src/functions/toCamelCaseFirst.ts
4667
- function dr(e) {
4679
+ function fr(e) {
4668
4680
  return it(e).replace(/^([a-z])/, (e) => `${e.toUpperCase()}`);
4669
4681
  }
4670
4682
  //#endregion
4671
4683
  //#region src/functions/toKebabCase.ts
4672
- function fr(e) {
4684
+ function pr(e) {
4673
4685
  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
4686
  }
4675
4687
  //#endregion
4676
4688
  //#region src/functions/toNumberByMax.ts
4677
- function pr(e, t, n, r) {
4689
+ function mr(e, t, n, r) {
4678
4690
  let i = y(e), a = y(t);
4679
- return t && a < i ? `${mr(a, n, r)}+` : mr(i, n, r);
4691
+ return t && a < i ? `${hr(a, n, r)}+` : hr(i, n, r);
4680
4692
  }
4681
- var mr = (e, t, n) => t ? new R(n).number(e) : e;
4693
+ var hr = (e, t, n) => t ? new R(n).number(e) : e;
4682
4694
  //#endregion
4683
4695
  //#region src/functions/toPercent.ts
4684
- function hr(e, t) {
4696
+ function gr(e, t) {
4685
4697
  return e === 0 ? t : 1 / e * t;
4686
4698
  }
4687
4699
  //#endregion
4688
4700
  //#region src/functions/toPercentBy100.ts
4689
- function gr(e, t) {
4690
- return hr(e, t) * 100;
4701
+ function _r(e, t) {
4702
+ return gr(e, t) * 100;
4691
4703
  }
4692
4704
  //#endregion
4693
4705
  //#region src/functions/uint8ArrayToBase64.ts
4694
- function _r(e) {
4706
+ function vr(e) {
4695
4707
  let t = "";
4696
4708
  for (let n of e) t += String.fromCharCode(n);
4697
4709
  if (s()) return window.btoa(t);
@@ -4703,7 +4715,7 @@ function _r(e) {
4703
4715
  }
4704
4716
  //#endregion
4705
4717
  //#region src/functions/writeClipboardData.ts
4706
- async function vr(e) {
4718
+ async function yr(e) {
4707
4719
  if (s()) try {
4708
4720
  await navigator.clipboard.writeText(e);
4709
4721
  } catch (n) {
@@ -4712,4 +4724,4 @@ async function vr(e) {
4712
4724
  }
4713
4725
  }
4714
4726
  //#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 getLengthOfAllArray, On as getMaxLengthAllArray, kn as getMinLengthAllArray, Mn as getMouseClient, An as getMouseClientX, jn as getMouseClientY, Nn as getObjectByKeys, Pn as getObjectNoUndefined, Fn as getObjectOrNone, In as getOnlyText, Rn as getRandomText, o as getRequestString, zt as getSearchExp, jt as getSeparatingSearchExp, zn as getStepPercent, Bn as getStepValue, Hn as goScroll, Un as goScrollSmooth, Wn as goScrollTo, Kn as handleShare, qn as inArray, wn as initGetElementId, Jn as initScrollbarOffset, Yn as intersectKey, Jt as isApiSuccess, i as isArray, Xn as isDifferent, oe as isDomData, s as isDomRuntime, Zn as isElementVisible, $n as isEnter, l as isFilled, er as isFloat, x as isFunction, Se as isInDom, Qn as isInput, tr as isIntegerBetween, c as isNull, p as isNumber, t as isObject, n as isObjectNotArray, u as isOnLine, b as isSelected, nr as isSelectedByList, Gn as isShare, d as isString, rr as isTab, be as isWindow, f as random, ir as removeCommonPrefix, ar as replaceComponentName, $ as replaceRecursive, sr as replaceTemplate, pn as resizeImageByMax, cr as secondToTime, gt as setElementItem, lr as setValues, ee as sleep, ur as splice, Ln as strFill, Je as strSplit, A as toArray, it as toCamelCase, dr as toCamelCaseFirst, L as toDate, fr as toKebabCase, y as toNumber, pr as toNumberByMax, hr as toPercent, gr as toPercentBy100, a as toString, Ye as transformation, _r as uint8ArrayToBase64, or as uniqueArray, vr as writeClipboardData };
4727
+ 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
  *
@@ -45,17 +52,19 @@ export declare class GeoFlag {
45
52
  * Возвращает список стран на основе предоставленных кодов.
46
53
  * Если коды не переданы, возвращает все доступные страны.
47
54
  * @param codes array of country codes / массив кодов стран
55
+ * @param sort whether to sort the list / сортировать ли список
48
56
  * @returns list of countries / список стран
49
57
  */
50
- getList(codes?: string[]): GeoFlagItem[];
58
+ getList(codes?: string[], sort?: boolean): GeoFlagItem[];
51
59
  /**
52
60
  * Returns a list of countries in their national languages.
53
61
  *
54
62
  * Возвращает список стран на их национальных языках.
55
63
  * @param codes array of country codes / массив кодов стран
64
+ * @param sort whether to sort the list / сортировать ли список
56
65
  * @returns list of countries with national names / список стран с национальными названиями
57
66
  */
58
- getNational(codes?: string[]): GeoFlagNational[];
67
+ getNational(codes?: string[], sort?: boolean): GeoFlagNational[];
59
68
  /**
60
69
  * Changes the current locale/location.
61
70
  *
@@ -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;
@@ -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.2.10",
4
+ "version": "1.3.4",
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
  }