@dxtmisha/functional-basic 1.1.0 → 1.1.6
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 +81 -0
- package/ai-description.txt +1 -0
- package/ai-types.txt +1062 -951
- package/dist/classes/Api.d.ts +201 -0
- package/dist/classes/ApiCache.d.ts +152 -0
- package/dist/classes/ApiDataReturn.d.ts +76 -0
- package/dist/classes/ApiDefault.d.ts +49 -0
- package/dist/classes/ApiHeaders.d.ts +37 -0
- package/dist/classes/ApiHydration.d.ts +39 -0
- package/dist/classes/ApiInstance.d.ts +283 -0
- package/dist/classes/ApiPreparation.d.ts +58 -0
- package/dist/classes/ApiResponse.d.ts +154 -0
- package/dist/classes/ApiStatus.d.ts +130 -0
- package/dist/classes/BroadcastMessage.d.ts +75 -0
- package/dist/classes/Cache.d.ts +38 -0
- package/dist/classes/CacheItem.d.ts +62 -0
- package/dist/classes/CacheStatic.d.ts +36 -0
- package/dist/classes/Cookie.d.ts +54 -0
- package/dist/classes/CookieBlock.d.ts +30 -0
- package/dist/classes/CookieBlockInstance.d.ts +23 -0
- package/dist/classes/CookieStorage.d.ts +174 -0
- package/dist/classes/DataStorage.d.ts +107 -0
- package/dist/classes/Datetime.d.ts +570 -0
- package/dist/classes/ErrorCenter.d.ts +72 -0
- package/dist/classes/ErrorCenterHandler.d.ts +64 -0
- package/dist/classes/ErrorCenterInstance.d.ts +85 -0
- package/dist/classes/EventItem.d.ts +251 -0
- package/dist/classes/Formatters.d.ts +161 -0
- package/dist/classes/Geo.d.ts +151 -0
- package/dist/classes/GeoFlag.d.ts +98 -0
- package/dist/classes/GeoInstance.d.ts +215 -0
- package/dist/classes/GeoIntl.d.ts +304 -0
- package/dist/classes/GeoPhone.d.ts +108 -0
- package/dist/classes/Global.d.ts +29 -0
- package/dist/classes/Hash.d.ts +57 -0
- package/dist/classes/HashInstance.d.ts +95 -0
- package/dist/classes/Icons.d.ts +128 -0
- package/dist/classes/Loading.d.ts +66 -0
- package/dist/classes/LoadingInstance.d.ts +99 -0
- package/dist/classes/Meta.d.ts +186 -0
- package/dist/classes/MetaManager.d.ts +121 -0
- package/dist/classes/MetaOg.d.ts +115 -0
- package/dist/classes/MetaStatic.d.ts +179 -0
- package/dist/classes/MetaTwitter.d.ts +115 -0
- package/dist/classes/ResumableTimer.d.ts +81 -0
- package/dist/classes/ScrollbarWidth.d.ts +51 -0
- package/dist/classes/SearchList.d.ts +128 -0
- package/dist/classes/SearchListData.d.ts +143 -0
- package/dist/classes/SearchListItem.d.ts +49 -0
- package/dist/classes/SearchListMatcher.d.ts +57 -0
- package/dist/classes/SearchListOptions.d.ts +66 -0
- package/dist/classes/ServerStorage.d.ts +106 -0
- package/dist/classes/StorageCallback.d.ts +84 -0
- package/dist/classes/Translate.d.ts +119 -0
- package/dist/classes/TranslateFile.d.ts +81 -0
- package/dist/classes/TranslateInstance.d.ts +206 -0
- package/dist/functions/addTagHighlightMatch.d.ts +11 -0
- package/dist/functions/anyToString.d.ts +10 -0
- package/dist/functions/applyTemplate.d.ts +10 -0
- package/dist/functions/arrFill.d.ts +9 -0
- package/dist/functions/blobToBase64.d.ts +9 -0
- package/dist/functions/capitalize.d.ts +9 -0
- package/dist/functions/copyObject.d.ts +10 -0
- package/dist/functions/copyObjectLite.d.ts +9 -0
- package/dist/functions/createElement.d.ts +21 -0
- package/dist/functions/domQuerySelector.d.ts +8 -0
- package/dist/functions/domQuerySelectorAll.d.ts +8 -0
- package/dist/functions/encodeAttribute.d.ts +8 -0
- package/dist/functions/encodeLiteAttribute.d.ts +8 -0
- package/dist/functions/ensureMaxSize.d.ts +10 -0
- package/dist/functions/escapeExp.d.ts +7 -0
- package/dist/functions/eventStopPropagation.d.ts +7 -0
- package/dist/functions/executeFunction.d.ts +12 -0
- package/dist/functions/executePromise.d.ts +11 -0
- package/dist/functions/forEach.d.ts +14 -0
- package/dist/functions/frame.d.ts +10 -0
- package/dist/functions/getArrayHighlightMatch.d.ts +10 -0
- package/dist/functions/getAttributes.d.ts +9 -0
- package/dist/functions/getClipboardData.d.ts +9 -0
- package/dist/functions/getColumn.d.ts +10 -0
- package/dist/functions/getCurrentDate.d.ts +19 -0
- package/dist/functions/getCurrentTime.d.ts +15 -0
- package/dist/functions/getElement.d.ts +9 -0
- package/dist/functions/getElementId.d.ts +26 -0
- package/dist/functions/getElementImage.d.ts +8 -0
- package/dist/functions/getElementItem.d.ts +12 -0
- package/dist/functions/getElementOrWindow.d.ts +8 -0
- package/dist/functions/getElementSafeScript.d.ts +9 -0
- package/dist/functions/getExactSearchExp.d.ts +8 -0
- package/dist/functions/getExp.d.ts +14 -0
- package/dist/functions/getHydrationData.d.ts +10 -0
- package/dist/functions/getItemByPath.d.ts +9 -0
- package/dist/functions/getKey.d.ts +8 -0
- package/dist/functions/getLengthOfAllArray.d.ts +8 -0
- package/dist/functions/getMaxLengthAllArray.d.ts +9 -0
- package/dist/functions/getMinLengthAllArray.d.ts +8 -0
- package/dist/functions/getMouseClient.d.ts +9 -0
- package/dist/functions/getMouseClientX.d.ts +8 -0
- package/dist/functions/getMouseClientY.d.ts +8 -0
- package/dist/functions/getObjectByKeys.d.ts +8 -0
- package/dist/functions/getObjectNoUndefined.d.ts +9 -0
- package/dist/functions/getObjectOrNone.d.ts +8 -0
- package/dist/functions/getOnlyText.d.ts +8 -0
- package/dist/functions/getRandomText.d.ts +12 -0
- package/dist/functions/getRequestString.d.ts +11 -0
- package/dist/functions/getSearchExp.d.ts +12 -0
- package/dist/functions/getSeparatingSearchExp.d.ts +9 -0
- package/dist/functions/getStepPercent.d.ts +9 -0
- package/dist/functions/getStepValue.d.ts +9 -0
- package/dist/functions/goScroll.d.ts +10 -0
- package/dist/functions/goScrollSmooth.d.ts +10 -0
- package/dist/functions/goScrollTo.d.ts +10 -0
- package/dist/functions/handleShare.d.ts +10 -0
- package/dist/functions/inArray.d.ts +9 -0
- package/dist/functions/initScrollbarOffset.d.ts +7 -0
- package/dist/functions/intersectKey.d.ts +9 -0
- package/dist/functions/isApiSuccess.d.ts +9 -0
- package/dist/functions/isArray.d.ts +8 -0
- package/dist/functions/isDifferent.d.ts +10 -0
- package/dist/functions/isDomData.d.ts +7 -0
- package/dist/functions/isDomRuntime.d.ts +10 -0
- package/dist/functions/isElementVisible.d.ts +11 -0
- package/dist/functions/isEnter.d.ts +9 -0
- package/dist/functions/isFilled.d.ts +10 -0
- package/dist/functions/isFloat.d.ts +8 -0
- package/dist/functions/isFunction.d.ts +9 -0
- package/dist/functions/isInDom.d.ts +9 -0
- package/dist/functions/isInput.d.ts +8 -0
- package/dist/functions/isIntegerBetween.d.ts +9 -0
- package/dist/functions/isNull.d.ts +9 -0
- package/dist/functions/isNumber.d.ts +8 -0
- package/dist/functions/isObject.d.ts +8 -0
- package/dist/functions/isObjectNotArray.d.ts +8 -0
- package/dist/functions/isOnLine.d.ts +7 -0
- package/dist/functions/isSelected.d.ts +9 -0
- package/dist/functions/isSelectedByList.d.ts +9 -0
- package/dist/functions/isShare.d.ts +7 -0
- package/dist/functions/isString.d.ts +8 -0
- package/dist/functions/isWindow.d.ts +7 -0
- package/dist/functions/random.d.ts +9 -0
- package/dist/functions/removeCommonPrefix.d.ts +9 -0
- package/dist/functions/replaceComponentName.d.ts +9 -0
- package/dist/functions/replaceRecursive.d.ts +11 -0
- package/dist/functions/replaceTemplate.d.ts +10 -0
- package/dist/functions/resizeImageByMax.d.ts +19 -0
- package/dist/functions/secondToTime.d.ts +9 -0
- package/dist/functions/setElementItem.d.ts +11 -0
- package/dist/functions/setValues.d.ts +18 -0
- package/dist/functions/sleep.d.ts +8 -0
- package/dist/functions/splice.d.ts +13 -0
- package/dist/functions/strFill.d.ts +9 -0
- package/dist/functions/strSplit.d.ts +12 -0
- package/dist/functions/toArray.d.ts +17 -0
- package/dist/functions/toCamelCase.d.ts +8 -0
- package/dist/functions/toCamelCaseFirst.d.ts +8 -0
- package/dist/functions/toDate.d.ts +8 -0
- package/dist/functions/toKebabCase.d.ts +15 -0
- package/dist/functions/toNumber.d.ts +19 -0
- package/dist/functions/toNumberByMax.d.ts +11 -0
- package/dist/functions/toPercent.d.ts +9 -0
- package/dist/functions/toPercentBy100.d.ts +9 -0
- package/dist/functions/toString.d.ts +8 -0
- package/dist/functions/transformation.d.ts +21 -0
- package/dist/functions/uint8ArrayToBase64.d.ts +8 -0
- package/dist/functions/uniqueArray.d.ts +8 -0
- package/dist/functions/writeClipboardData.d.ts +8 -0
- package/dist/library.d.ts +171 -8722
- package/dist/library.js +416 -338
- package/dist/media/errorCauseList.d.ts +2 -0
- package/dist/types/apiTypes.d.ts +217 -0
- package/dist/types/basicTypes.d.ts +131 -0
- package/dist/types/errorCenter.d.ts +42 -0
- package/dist/types/formattersTypes.d.ts +224 -0
- package/dist/types/geoTypes.d.ts +86 -0
- package/dist/types/metaTypes.d.ts +586 -0
- package/dist/types/searchTypes.d.ts +53 -0
- package/dist/types/translateTypes.d.ts +54 -0
- package/package.json +7 -5
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.1.6] - 2026-05-08
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **ApiResponse**: Added `emulatorAsync()` method for synchronous response emulation.
|
|
9
|
+
- **Meta**: Added `setSuffix()` and `getSuffix()` for managing page title suffixes.
|
|
10
|
+
- **Meta**: Added `htmlTitle()` for generating HTML-safe title strings.
|
|
11
|
+
|
|
12
|
+
### Changed / Improved
|
|
13
|
+
- **Api**: Refactored `ApiInstance` and `makeQuery` for more explicit base path handling (`pathToApi`).
|
|
14
|
+
- **Api**: Improved SSR hydration stability and internal emulation logic.
|
|
15
|
+
- **MetaManager**: Optimized `set()` method to avoid redundant updates when content is identical.
|
|
16
|
+
- **getElementId**: Simplified ID generation logic by removing the `id-server-` prefix from server-side IDs.
|
|
17
|
+
- **Documentation**: Completed a massive bilingual (EN/RU) JSDoc overhaul for all functions and classes.
|
|
18
|
+
- **Tests**: Added unit tests for `ApiResponse.emulatorAsync` and improved general test coverage.
|
|
19
|
+
|
|
20
|
+
## [1.1.5] - 2026-04-26
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- **Api**: Added `setOrigin()` and `getOrigin()` methods for managing the protocol and domain of the base URL.
|
|
24
|
+
- **Api**: Added `setConfig()` method for bulk configuration of API settings.
|
|
25
|
+
- **Api**: Added support for `endResetLimit` in `ApiFetch` to control recursive retries via `setEnd`.
|
|
26
|
+
- **Api**: Added support for jittered retry delays to prevent request thundering herds.
|
|
27
|
+
- **ServerStorage**: Added `remove()` method for deleting items from storage.
|
|
28
|
+
- **ServerStorage**: Added `setErrorStatus()` method to toggle visibility of context-missing errors.
|
|
29
|
+
|
|
30
|
+
## [1.1.4] - 2026-04-25
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- **Meta**: Added `htmlTitle()` method to `Meta`, `MetaStatic`, and `MetaManager` classes for generating HTML-safe title strings.
|
|
34
|
+
|
|
35
|
+
### Changed / Improved
|
|
36
|
+
- **MetaManager**: The `toHtml()` method now excludes the `<title>` tag, allowing for more flexible title management via `htmlTitle()`.
|
|
37
|
+
- **Package**: Added `CHANGELOG.md` to the list of files included in the package distribution.
|
|
38
|
+
|
|
39
|
+
## [1.1.3] - 2026-04-24
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
- **ResumableTimer**: Added a new class for managing timers with pause and resume functionality.
|
|
43
|
+
- **ApiDataReturn**: Implemented a class for standardizing API responses with support for descriptions and texts.
|
|
44
|
+
- **MetaStatic**: Added a class for managing static meta-data.
|
|
45
|
+
- **Datetime**: Added functionality for working with dates and times.
|
|
46
|
+
- **Translate**: Implemented a localization and translation system.
|
|
47
|
+
- **GeoInstance**: Added an instance for advanced geolocation data handling.
|
|
48
|
+
- **ApiHydration**: Added support for API data hydration for SSR.
|
|
49
|
+
- **StorageCallback**: Added a callback mechanism for tracking storage changes.
|
|
50
|
+
- **New Functions**:
|
|
51
|
+
- `getCurrentTime` — returns the current time.
|
|
52
|
+
- `getArrayHighlightMatch` — searches for and highlights matches in arrays.
|
|
53
|
+
|
|
54
|
+
### Changed / Improved
|
|
55
|
+
- **Refactoring**: Major refactoring of the `functional-basic` package to improve architecture.
|
|
56
|
+
- **SSR**: Adapted the API and related modules for full Server-Side Rendering support.
|
|
57
|
+
- **API**:
|
|
58
|
+
- Improved the core `Api` class.
|
|
59
|
+
- Refined `ApiCache` and caching systems.
|
|
60
|
+
- **Cookie**:
|
|
61
|
+
- Completely redesigned the Cookie handling mechanics, including `CookieBlock` and `CookieStorage`.
|
|
62
|
+
- Added `getListenerRaw` support to `CookieStorage.init()` for initializing from raw cookie strings (essential for SSR).
|
|
63
|
+
- Extracted cookie parsing and formatting logic into protected `parse()` and `format()` methods.
|
|
64
|
+
- Expanded `CookieOptions` to support modern attributes: `path`, `domain`, `secure`, `httpOnly`, and `partitioned` (CHIPS).
|
|
65
|
+
- Updated `setListener` signature to include the fully formatted cookie string as a third parameter, facilitating easier SSR header management.
|
|
66
|
+
- **Function Optimization**:
|
|
67
|
+
- `getSearchExp` and `getSeparatingSearchExp` — refined search mechanisms.
|
|
68
|
+
- `getRequestString` — improved query string generation.
|
|
69
|
+
- `addTagHighlightMatch` — optimized tag highlighting.
|
|
70
|
+
- `applyTemplate` — expanded template support.
|
|
71
|
+
- `forEach`, `frame`, `blobToBase64`, `getElementId` — technical improvements and optimization.
|
|
72
|
+
|
|
73
|
+
### Fixed
|
|
74
|
+
- **Testing**: Fixed and updated all unit tests (`vitest`) for stability and coverage.
|
|
75
|
+
- **Geo**: Fixed logic errors in geolocation functions and their tests.
|
|
76
|
+
- Fixed type definition errors and minor bugs in core functions.
|
|
77
|
+
|
|
78
|
+
### Documentation
|
|
79
|
+
- **JSDoc**: Completed a full revision and standardization of JSDoc comments for all classes and functions.
|
|
80
|
+
- **ServerStorage**: Added detailed descriptions of methods and operating principles.
|
|
81
|
+
- Updated `ApiDataReturn` documentation.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This library is a high-level infrastructure and utility toolkit designed for isomorphic TypeScript applications. Its primary function is to provide structured abstractions for networking, state persistence, internationalization, and localized data formatting. The networking layer features an advanced Fetch API wrapper (Api, ApiInstance) with built-in support for singleton or isolated instances, automated retries with jitter, request/response interceptors, global status management, and SSR-to-client hydration (ApiHydration). Storage utilities encompass request-isolated ServerStorage for SSR, prefix-supported Local/Session storage (DataStorage), reactive URL Hash management (Hash), and standardized Cookie handling. The internationalization suite includes wrappers for the Intl API (GeoIntl) to handle complex formatting for currencies, dates, and plurals, alongside country-specific logic for phone masks (GeoPhone) and flag identification (GeoFlag). It also contains a specialized translation engine (Translate) supporting batch asynchronous loading and fallback mechanisms. Additionally, it provides advanced UI logic utilities like SearchList for regex-based filtering with text highlighting and EventItem for managed DOM event lifecycles. An AI should study this library when implementing robust API clients, managing cross-platform storage, handling multi-locale UI components, or developing isomorphic applications requiring data consistency between server and client. It integrates directly with standard web APIs (Fetch, Intl, BroadcastChannel, ResizeObserver) and provides a centralized error reporting system (ErrorCenter) and global loading state (Loading).
|