@dxtmisha/wiki 0.39.6 → 0.39.8

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.
Files changed (194) hide show
  1. package/dist/defineProperty-Bjg6wMoX.js +39 -0
  2. package/dist/library.d.ts +0 -1
  3. package/dist/library.js +25 -25
  4. package/dist/media.js +12 -0
  5. package/dist/storybook.js +26929 -11
  6. package/package.json +1 -1
  7. package/src/library.ts +0 -1
  8. package/src/media/functional/functional-basic/api/api.en.mdx +45 -0
  9. package/src/media/functional/functional-basic/api/api.ru.mdx +45 -0
  10. package/src/media/functional/functional-basic/api/api.vi.mdx +45 -0
  11. package/src/media/functional/functional-basic/classes/Api/Api.en.mdx +54 -54
  12. package/src/media/functional/functional-basic/classes/Api/Api.ru.mdx +54 -54
  13. package/src/media/functional/functional-basic/classes/Api/Api.vi.mdx +54 -54
  14. package/src/media/functional/functional-basic/classes/ApiCache/ApiCache.en.mdx +111 -0
  15. package/src/media/functional/functional-basic/classes/ApiCache/ApiCache.ru.mdx +111 -0
  16. package/src/media/functional/functional-basic/classes/ApiCache/ApiCache.vi.mdx +111 -0
  17. package/src/media/functional/functional-basic/classes/ApiDataReturn/ApiDataReturn.en.mdx +32 -0
  18. package/src/media/functional/functional-basic/classes/ApiDataReturn/ApiDataReturn.ru.mdx +32 -0
  19. package/src/media/functional/functional-basic/classes/ApiDataReturn/ApiDataReturn.vi.mdx +32 -0
  20. package/src/media/functional/functional-basic/classes/ApiDefault/ApiDefault.en.mdx +24 -28
  21. package/src/media/functional/functional-basic/classes/ApiDefault/ApiDefault.ru.mdx +24 -28
  22. package/src/media/functional/functional-basic/classes/ApiDefault/ApiDefault.vi.mdx +24 -28
  23. package/src/media/functional/functional-basic/classes/ApiHeaders/ApiHeaders.en.mdx +28 -14
  24. package/src/media/functional/functional-basic/classes/ApiHeaders/ApiHeaders.ru.mdx +33 -19
  25. package/src/media/functional/functional-basic/classes/ApiHeaders/ApiHeaders.vi.mdx +33 -19
  26. package/src/media/functional/functional-basic/classes/ApiHydration/ApiHydration.en.mdx +56 -0
  27. package/src/media/functional/functional-basic/classes/ApiHydration/ApiHydration.ru.mdx +56 -0
  28. package/src/media/functional/functional-basic/classes/ApiHydration/ApiHydration.vi.mdx +55 -0
  29. package/src/media/functional/functional-basic/classes/ApiInstance/ApiInstance.en.mdx +101 -49
  30. package/src/media/functional/functional-basic/classes/ApiInstance/ApiInstance.ru.mdx +101 -49
  31. package/src/media/functional/functional-basic/classes/ApiInstance/ApiInstance.vi.mdx +98 -47
  32. package/src/media/functional/functional-basic/classes/ApiPreparation/ApiPreparation.en.mdx +44 -26
  33. package/src/media/functional/functional-basic/classes/ApiPreparation/ApiPreparation.ru.mdx +45 -27
  34. package/src/media/functional/functional-basic/classes/ApiPreparation/ApiPreparation.vi.mdx +44 -26
  35. package/src/media/functional/functional-basic/classes/ApiResponse/ApiResponse.en.mdx +50 -21
  36. package/src/media/functional/functional-basic/classes/ApiResponse/ApiResponse.ru.mdx +54 -25
  37. package/src/media/functional/functional-basic/classes/ApiResponse/ApiResponse.vi.mdx +55 -26
  38. package/src/media/functional/functional-basic/classes/ApiStatus/ApiStatus.en.mdx +29 -32
  39. package/src/media/functional/functional-basic/classes/ApiStatus/ApiStatus.ru.mdx +33 -36
  40. package/src/media/functional/functional-basic/classes/ApiStatus/ApiStatus.vi.mdx +33 -36
  41. package/src/media/functional/functional-basic/classes/BroadcastMessage/BroadcastMessage.en.mdx +34 -53
  42. package/src/media/functional/functional-basic/classes/BroadcastMessage/BroadcastMessage.ru.mdx +33 -52
  43. package/src/media/functional/functional-basic/classes/BroadcastMessage/BroadcastMessage.vi.mdx +39 -58
  44. package/src/media/functional/functional-basic/classes/Cache/Cache.en.mdx +7 -4
  45. package/src/media/functional/functional-basic/classes/Cache/Cache.ru.mdx +7 -4
  46. package/src/media/functional/functional-basic/classes/Cache/Cache.vi.mdx +28 -25
  47. package/src/media/functional/functional-basic/classes/CacheItem/CacheItem.en.mdx +45 -53
  48. package/src/media/functional/functional-basic/classes/CacheItem/CacheItem.ru.mdx +46 -54
  49. package/src/media/functional/functional-basic/classes/CacheItem/CacheItem.vi.mdx +47 -55
  50. package/src/media/functional/functional-basic/classes/CacheStatic/CacheStatic.en.mdx +13 -1
  51. package/src/media/functional/functional-basic/classes/CacheStatic/CacheStatic.ru.mdx +13 -1
  52. package/src/media/functional/functional-basic/classes/CacheStatic/CacheStatic.vi.mdx +13 -0
  53. package/src/media/functional/functional-basic/classes/Cookie/Cookie.en.mdx +88 -44
  54. package/src/media/functional/functional-basic/classes/Cookie/Cookie.ru.mdx +88 -44
  55. package/src/media/functional/functional-basic/classes/Cookie/Cookie.vi.mdx +85 -41
  56. package/src/media/functional/functional-basic/classes/CookieBlock/CookieBlock.en.mdx +43 -22
  57. package/src/media/functional/functional-basic/classes/CookieBlock/CookieBlock.ru.mdx +46 -25
  58. package/src/media/functional/functional-basic/classes/CookieBlock/CookieBlock.vi.mdx +43 -22
  59. package/src/media/functional/functional-basic/classes/CookieBlockInstance/CookieBlockInstance.en.mdx +84 -0
  60. package/src/media/functional/functional-basic/classes/CookieBlockInstance/CookieBlockInstance.ru.mdx +84 -0
  61. package/src/media/functional/functional-basic/classes/CookieBlockInstance/CookieBlockInstance.vi.mdx +100 -0
  62. package/src/media/functional/functional-basic/classes/CookieStorage/CookieStorage.en.mdx +153 -0
  63. package/src/media/functional/functional-basic/classes/CookieStorage/CookieStorage.ru.mdx +153 -0
  64. package/src/media/functional/functional-basic/classes/CookieStorage/CookieStorage.vi.mdx +153 -0
  65. package/src/media/functional/functional-basic/classes/DataStorage/DataStorage.en.mdx +32 -25
  66. package/src/media/functional/functional-basic/classes/DataStorage/DataStorage.ru.mdx +32 -25
  67. package/src/media/functional/functional-basic/classes/DataStorage/DataStorage.vi.mdx +32 -27
  68. package/src/media/functional/functional-basic/classes/Datetime/Datetime.en.mdx +36 -4
  69. package/src/media/functional/functional-basic/classes/Datetime/Datetime.ru.mdx +36 -4
  70. package/src/media/functional/functional-basic/classes/Datetime/Datetime.vi.mdx +36 -4
  71. package/src/media/functional/functional-basic/classes/ErrorCenter/ErrorCenter.en.mdx +101 -70
  72. package/src/media/functional/functional-basic/classes/ErrorCenter/ErrorCenter.ru.mdx +100 -69
  73. package/src/media/functional/functional-basic/classes/ErrorCenter/ErrorCenter.vi.mdx +101 -70
  74. package/src/media/functional/functional-basic/classes/ErrorCenterHandler/ErrorCenterHandler.en.mdx +46 -42
  75. package/src/media/functional/functional-basic/classes/ErrorCenterHandler/ErrorCenterHandler.ru.mdx +46 -42
  76. package/src/media/functional/functional-basic/classes/ErrorCenterHandler/ErrorCenterHandler.vi.mdx +46 -42
  77. package/src/media/functional/functional-basic/classes/ErrorCenterInstance/ErrorCenterInstance.en.mdx +44 -96
  78. package/src/media/functional/functional-basic/classes/ErrorCenterInstance/ErrorCenterInstance.ru.mdx +44 -96
  79. package/src/media/functional/functional-basic/classes/ErrorCenterInstance/ErrorCenterInstance.vi.mdx +44 -96
  80. package/src/media/functional/functional-basic/classes/EventItem/EventItem.en.mdx +49 -28
  81. package/src/media/functional/functional-basic/classes/EventItem/EventItem.ru.mdx +21 -0
  82. package/src/media/functional/functional-basic/classes/EventItem/EventItem.vi.mdx +63 -42
  83. package/src/media/functional/functional-basic/classes/Formatters/Formatters.en.mdx +97 -109
  84. package/src/media/functional/functional-basic/classes/Formatters/Formatters.ru.mdx +86 -98
  85. package/src/media/functional/functional-basic/classes/Formatters/Formatters.vi.mdx +99 -111
  86. package/src/media/functional/functional-basic/classes/Geo/Geo.en.mdx +3 -3
  87. package/src/media/functional/functional-basic/classes/Geo/Geo.ru.mdx +5 -5
  88. package/src/media/functional/functional-basic/classes/Geo/Geo.vi.mdx +5 -5
  89. package/src/media/functional/functional-basic/classes/GeoFlag/GeoFlag.en.mdx +83 -40
  90. package/src/media/functional/functional-basic/classes/GeoFlag/GeoFlag.ru.mdx +83 -40
  91. package/src/media/functional/functional-basic/classes/GeoFlag/GeoFlag.vi.mdx +87 -44
  92. package/src/media/functional/functional-basic/classes/GeoInstance/GeoInstance.en.mdx +81 -0
  93. package/src/media/functional/functional-basic/classes/GeoInstance/GeoInstance.ru.mdx +81 -0
  94. package/src/media/functional/functional-basic/classes/GeoInstance/GeoInstance.vi.mdx +81 -0
  95. package/src/media/functional/functional-basic/classes/GeoPhone/GeoPhone.en.mdx +56 -105
  96. package/src/media/functional/functional-basic/classes/GeoPhone/GeoPhone.ru.mdx +53 -102
  97. package/src/media/functional/functional-basic/classes/GeoPhone/GeoPhone.vi.mdx +55 -105
  98. package/src/media/functional/functional-basic/classes/Hash/Hash.en.mdx +18 -7
  99. package/src/media/functional/functional-basic/classes/Hash/Hash.ru.mdx +18 -7
  100. package/src/media/functional/functional-basic/classes/Hash/Hash.vi.mdx +18 -7
  101. package/src/media/functional/functional-basic/classes/HashInstance/HashInstance.en.mdx +54 -0
  102. package/src/media/functional/functional-basic/classes/HashInstance/HashInstance.ru.mdx +54 -0
  103. package/src/media/functional/functional-basic/classes/HashInstance/HashInstance.vi.mdx +54 -0
  104. package/src/media/functional/functional-basic/classes/MetaStatic/MetaStatic.en.mdx +78 -0
  105. package/src/media/functional/functional-basic/classes/MetaStatic/MetaStatic.ru.mdx +78 -0
  106. package/src/media/functional/functional-basic/classes/MetaStatic/MetaStatic.vi.mdx +78 -0
  107. package/src/media/functional/functional-basic/classes/ResumableTimer/ResumableTimer.en.mdx +50 -0
  108. package/src/media/functional/functional-basic/classes/ResumableTimer/ResumableTimer.ru.mdx +50 -0
  109. package/src/media/functional/functional-basic/classes/ResumableTimer/ResumableTimer.vi.mdx +50 -0
  110. package/src/media/functional/functional-basic/classes/ServerStorage/ServerStorage.en.mdx +131 -0
  111. package/src/media/functional/functional-basic/classes/ServerStorage/ServerStorage.ru.mdx +131 -0
  112. package/src/media/functional/functional-basic/classes/ServerStorage/ServerStorage.vi.mdx +131 -0
  113. package/src/media/functional/functional-basic/classes/StorageCallback/StorageCallback.en.mdx +97 -0
  114. package/src/media/functional/functional-basic/classes/StorageCallback/StorageCallback.ru.mdx +97 -0
  115. package/src/media/functional/functional-basic/classes/StorageCallback/StorageCallback.vi.mdx +97 -0
  116. package/src/media/functional/functional-basic/functions/addTagHighlightMatch/addTagHighlightMatch.en.mdx +13 -5
  117. package/src/media/functional/functional-basic/functions/addTagHighlightMatch/addTagHighlightMatch.ru.mdx +13 -5
  118. package/src/media/functional/functional-basic/functions/addTagHighlightMatch/addTagHighlightMatch.vi.mdx +13 -5
  119. package/src/media/functional/functional-basic/functions/anyToString/anyToString.en.mdx +37 -19
  120. package/src/media/functional/functional-basic/functions/anyToString/anyToString.ru.mdx +37 -19
  121. package/src/media/functional/functional-basic/functions/anyToString/anyToString.vi.mdx +35 -17
  122. package/src/media/functional/functional-basic/functions/applyTemplate/applyTemplate.en.mdx +31 -19
  123. package/src/media/functional/functional-basic/functions/applyTemplate/applyTemplate.ru.mdx +31 -19
  124. package/src/media/functional/functional-basic/functions/applyTemplate/applyTemplate.vi.mdx +32 -20
  125. package/src/media/functional/functional-basic/functions/blobToBase64/blobToBase64.en.mdx +29 -15
  126. package/src/media/functional/functional-basic/functions/blobToBase64/blobToBase64.ru.mdx +28 -14
  127. package/src/media/functional/functional-basic/functions/blobToBase64/blobToBase64.vi.mdx +28 -14
  128. package/src/media/functional/functional-basic/functions/capitalize/capitalize.en.mdx +7 -3
  129. package/src/media/functional/functional-basic/functions/capitalize/capitalize.ru.mdx +7 -3
  130. package/src/media/functional/functional-basic/functions/capitalize/capitalize.vi.mdx +7 -3
  131. package/src/media/functional/functional-basic/functions/copyObject/copyObject.en.mdx +17 -13
  132. package/src/media/functional/functional-basic/functions/copyObject/copyObject.ru.mdx +17 -13
  133. package/src/media/functional/functional-basic/functions/copyObject/copyObject.vi.mdx +17 -13
  134. package/src/media/functional/functional-basic/functions/createElement/createElement.en.mdx +2 -0
  135. package/src/media/functional/functional-basic/functions/createElement/createElement.ru.mdx +2 -0
  136. package/src/media/functional/functional-basic/functions/createElement/createElement.vi.mdx +2 -0
  137. package/src/media/functional/functional-basic/functions/encodeAttribute/encodeAttribute.en.mdx +1 -3
  138. package/src/media/functional/functional-basic/functions/encodeAttribute/encodeAttribute.ru.mdx +1 -3
  139. package/src/media/functional/functional-basic/functions/encodeAttribute/encodeAttribute.vi.mdx +1 -3
  140. package/src/media/functional/functional-basic/functions/executeFunction/executeFunction.en.mdx +13 -10
  141. package/src/media/functional/functional-basic/functions/executeFunction/executeFunction.ru.mdx +14 -11
  142. package/src/media/functional/functional-basic/functions/executeFunction/executeFunction.vi.mdx +12 -9
  143. package/src/media/functional/functional-basic/functions/executePromise/executePromise.en.mdx +14 -13
  144. package/src/media/functional/functional-basic/functions/executePromise/executePromise.ru.mdx +15 -14
  145. package/src/media/functional/functional-basic/functions/executePromise/executePromise.vi.mdx +14 -13
  146. package/src/media/functional/functional-basic/functions/forEach/forEach.en.mdx +1 -1
  147. package/src/media/functional/functional-basic/functions/forEach/forEach.ru.mdx +1 -1
  148. package/src/media/functional/functional-basic/functions/forEach/forEach.vi.mdx +1 -1
  149. package/src/media/functional/functional-basic/functions/frame/frame.en.mdx +7 -4
  150. package/src/media/functional/functional-basic/functions/frame/frame.ru.mdx +6 -3
  151. package/src/media/functional/functional-basic/functions/frame/frame.vi.mdx +7 -4
  152. package/src/media/functional/functional-basic/functions/getArrayHighlightMatch/getArrayHighlightMatch.en.mdx +34 -0
  153. package/src/media/functional/functional-basic/functions/getArrayHighlightMatch/getArrayHighlightMatch.ru.mdx +34 -0
  154. package/src/media/functional/functional-basic/functions/getArrayHighlightMatch/getArrayHighlightMatch.vi.mdx +35 -0
  155. package/src/media/functional/functional-basic/functions/getCurrentDate/getCurrentDate.en.mdx +2 -0
  156. package/src/media/functional/functional-basic/functions/getCurrentDate/getCurrentDate.ru.mdx +2 -0
  157. package/src/media/functional/functional-basic/functions/getCurrentDate/getCurrentDate.vi.mdx +2 -0
  158. package/src/media/functional/functional-basic/functions/getCurrentTime/getCurrentTime.en.mdx +21 -0
  159. package/src/media/functional/functional-basic/functions/getCurrentTime/getCurrentTime.ru.mdx +21 -0
  160. package/src/media/functional/functional-basic/functions/getCurrentTime/getCurrentTime.vi.mdx +21 -0
  161. package/src/media/functional/functional-basic/functions/getElementId/getElementId.en.mdx +17 -3
  162. package/src/media/functional/functional-basic/functions/getElementId/getElementId.ru.mdx +17 -3
  163. package/src/media/functional/functional-basic/functions/getElementId/getElementId.vi.mdx +18 -4
  164. package/src/media/functional/functional-basic/functions/getElementSafeScript/getElementSafeScript.en.mdx +31 -0
  165. package/src/media/functional/functional-basic/functions/getElementSafeScript/getElementSafeScript.ru.mdx +31 -0
  166. package/src/media/functional/functional-basic/functions/getElementSafeScript/getElementSafeScript.vi.mdx +31 -0
  167. package/src/media/functional/functional-basic/functions/getOnlyText/getOnlyText.en.mdx +25 -0
  168. package/src/media/functional/functional-basic/functions/getOnlyText/getOnlyText.ru.mdx +25 -0
  169. package/src/media/functional/functional-basic/functions/getOnlyText/getOnlyText.vi.mdx +25 -0
  170. package/src/media/functional/functional-basic/functions/getSearchExp/getSearchExp.en.mdx +11 -4
  171. package/src/media/functional/functional-basic/functions/getSearchExp/getSearchExp.ru.mdx +14 -7
  172. package/src/media/functional/functional-basic/functions/getSearchExp/getSearchExp.vi.mdx +13 -6
  173. package/src/media/functional/functional-basic/functions/getSeparatingSearchExp/getSeparatingSearchExp.en.mdx +3 -2
  174. package/src/media/functional/functional-basic/functions/getSeparatingSearchExp/getSeparatingSearchExp.ru.mdx +3 -2
  175. package/src/media/functional/functional-basic/functions/getSeparatingSearchExp/getSeparatingSearchExp.vi.mdx +3 -2
  176. package/src/media/functional/functional-basic/functions/toNumber/toNumber.en.mdx +25 -9
  177. package/src/media/functional/functional-basic/functions/toNumber/toNumber.ru.mdx +25 -9
  178. package/src/media/functional/functional-basic/functions/toNumber/toNumber.vi.mdx +25 -9
  179. package/src/media/functional/functional-basic/functions/toString/toString.en.mdx +28 -0
  180. package/src/media/functional/functional-basic/functions/toString/toString.ru.mdx +28 -0
  181. package/src/media/functional/functional-basic/functions/toString/toString.vi.mdx +28 -0
  182. package/src/media/functional/ui/about/about.en.mdx +45 -0
  183. package/src/media/functional/ui/about/about.ru.mdx +45 -0
  184. package/src/media/functional/ui/about/about.vi.mdx +45 -0
  185. package/src/media/functional/ui/component/component.en.mdx +104 -0
  186. package/src/media/functional/ui/component/component.ru.mdx +106 -0
  187. package/src/media/functional/ui/component/component.vi.mdx +104 -0
  188. package/src/media/functional/ui/setup/setup.en.mdx +72 -0
  189. package/src/media/functional/ui/setup/setup.ru.mdx +72 -0
  190. package/src/media/functional/ui/setup/setup.vi.mdx +72 -0
  191. package/src/media/functional/ui/wiki-data.en.mdx +114 -0
  192. package/src/media/functional/ui/wiki-data.ru.mdx +114 -0
  193. package/src/media/functional/ui/wiki-data.vi.mdx +114 -0
  194. package/dist/WikiStorybookDescriptions-IKMchHA-.js +0 -26959
@@ -4,31 +4,31 @@ import {Meta} from '@storybook/addon-docs/blocks'
4
4
 
5
5
  # EventItem Class
6
6
 
7
- A powerful wrapper for managing event listeners on DOM elements or the `window` object. This class simplifies the lifecycle of events (adding, removing, toggling), supports automatic DOM presence checks, and provides built-in optimization for heavy events like `resize` and `scroll`.
7
+ A powerful wrapper for managing event listeners on DOM elements or the `window` object. The class simplifies working with the event lifecycle (add, remove, toggle), supports automatic checking of the element's presence in the DOM, and provides built-in optimization for heavy events such as `resize` and `scroll`.
8
8
 
9
9
  ## Key Features
10
10
 
11
- - **Lifecycle Management** — convenient `start`, `stop`, `toggle`, and `reset` methods for precise control over event listening.
12
- - **DOM Safety** — automatic `isInDom` check before executing the listener (can be configured with a control element).
13
- - **ResizeObserver Support** — built-in handling of the `resize` event for any HTML element using the modern API.
14
- - **Scroll Optimization** — special `scroll-sync` event type using `requestAnimationFrame` for high performance.
15
- - **Chaining and Flexibility** — support for method chaining and dynamic target, type, or listener replacement.
16
- - **Custom Data** — ability to pass and dispatch custom data via `CustomEvent`.
11
+ - **Lifecycle Management** — convenient `start`, `stop`, `toggle`, and `reset` methods to control event listening.
12
+ - **DOM Safety** — automatic `isInDom` check before executing the handler (a control element can be configured).
13
+ - **ResizeObserver Support** — built-in handling of the `resize` event for any HTML elements via a modern API.
14
+ - **Scroll Optimization** — a special `scroll-sync` event type using `requestAnimationFrame` for high performance.
15
+ - **Chaining and Flexibility** — support for call chaining and dynamic changing of the target, type, or event handler.
16
+ - **Custom Data** — the ability to pass and dispatch custom data via `CustomEvent`.
17
17
 
18
18
  ## Initialization
19
19
 
20
- To initialize the object, call the `EventItem(elementSelector, type, listener, options, detail)` constructor.
20
+ To initialize the object, call the constructor `EventItem(elementSelector, type, listener, options, detail)`.
21
21
 
22
22
  ### Generic Constraints
23
23
 
24
24
  To ensure strict typing, the class supports the following generics:
25
- - `E extends ElementOrWindow` — The type of the element on which events are listened to.
26
- - `O extends Event` — The event object type.
27
- - `D extends Record<string, any>` — The structure for additional data.
25
+ - `E extends ElementOrWindow` — The type of element on which events are listened.
26
+ - `O extends Event` — The type of the event object.
27
+ - `D extends Record<string, any>` — The structure of additional data.
28
28
 
29
29
  **Parameters:**
30
- - `elementSelector?: ElementOrString<E>` — the target element where the listener is attached.
31
- - `type: string | string[] = 'click'` — the event type, an array of types, or special types (`'resize'`, `'scroll-sync'`).
30
+ - `elementSelector?: ElementOrString<E>` — the target element on which the listener is attached.
31
+ - `type: string | string[] = 'click'` — event type, array of types, or special types (`'resize'`, `'scroll-sync'`).
32
32
  - `listener?: EventListenerDetail<O, D>` — the event handler function.
33
33
  - `options?: EventOptions` — standard `addEventListener` options.
34
34
  - `detail?: D` — custom data that will be available in the handler.
@@ -36,7 +36,7 @@ To ensure strict typing, the class supports the following generics:
36
36
  ```typescript
37
37
  import { EventItem } from '@dxtmisha/functional-basic'
38
38
 
39
- // 1. Simple initialization
39
+ // 1. Basic initialization
40
40
  const myEvent = new EventItem(
41
41
  '.my-button',
42
42
  'click',
@@ -49,13 +49,13 @@ const customEvent = new EventItem<Window, MouseEvent, MyData>(
49
49
  window,
50
50
  'mousedown',
51
51
  (event, detail) => {
52
- console.log('Window clicked, data ID:', detail?.id)
52
+ console.log('Window click, data ID:', detail?.id)
53
53
  },
54
54
  { passive: true },
55
55
  { id: 42 }
56
56
  )
57
57
 
58
- // 3. Activating listeners
58
+ // 3. Activating listening
59
59
  myEvent.start()
60
60
  customEvent.start()
61
61
  ```
@@ -72,27 +72,48 @@ customEvent.start()
72
72
  All methods in this group support chaining and automatically call `reset()` if the event is active.
73
73
 
74
74
  - `setElement(elementSelector?: ElementOrString): this` — Changes the target element.
75
- - `setElementControl(elementSelector?: ElementOrString): this` — Sets a control element (if missing in DOM, the event won't trigger).
75
+ - `setElementControl(elementSelector?: ElementOrString): this` — Sets the control element (if it is not in the DOM, the event will not fire).
76
76
  - `setType(type: string | string[]): this` — Changes the event type.
77
- - `setListener(listener: Function): this` — Changes the callback function.
78
- - `setOptions(options?: EventOptions): this` — Changes the listener options.
79
- - `setDetail(detail?: D): this` — Changes the custom detail data.
77
+ - `setListener(listener: Function): this` — Changes the handler function.
78
+ - `setOptions(options?: EventOptions): this` — Changes the listener parameters.
79
+ - `setDetail(detail?: D): this` — Changes the custom event data.
80
80
 
81
- ### Control
81
+ ### Management
82
82
 
83
- - `start(): this` — Starts listening for events.
84
- - `stop(): this` — Stops listening for events.
85
- - `toggle(activity: boolean): this` — Enables or disables listening based on the flag.
83
+ - `start(): this` — Starts event listening.
84
+ - `stop(): this` — Stops event listening.
85
+ - `toggle(activity: boolean): this` — Enables or disables listening depending on the flag.
86
86
  - `reset(): this` — Restarts the event (useful after changing settings).
87
- - `dispatch(detail?: D): this` — Triggers the event on the target element with data transmission.
87
+ - `dispatch(detail?: D): this` — Triggers the event on the target element with data transfer.
88
+
89
+ ## Types
90
+
91
+ #### `ElementOrWindow`
92
+ Element on which an event can be attached: `HTMLElement | Window`.
93
+
94
+ #### `ElementOrString<E>`
95
+ Type for passing an element or its selector: `E | string`.
96
+
97
+ #### `EventListenerDetail<O, D>`
98
+ Event listener function: `(event: O, detail?: D) => void`.
99
+
100
+ #### `EventOptions`
101
+ Listening options: `AddEventListenerOptions | boolean | undefined`.
102
+
103
+ #### `EventActivityItem<E>`
104
+ Internal interface for tracking active listeners.
105
+ - `element: E | undefined` — Target element.
106
+ - `type: string` — Event type.
107
+ - `listener?: (event: any) => void` — Active function.
108
+ - `observer?: ResizeObserver` — Observer instance (for `resize`).
88
109
 
89
110
  ## Special Events
90
111
 
91
112
  ### `resize`
92
- If the event type is set to `resize`, the class automatically uses `ResizeObserver` to track element size changes (even if it's not the `window`).
113
+ If the event type is set to `resize`, the class automatically uses `ResizeObserver` to track changes in the size of the element (even if it is not `window`).
93
114
 
94
115
  ### `scroll-sync`
95
- A special type for optimized scrolling. It uses `requestAnimationFrame` internally, preventing redundant handler calls and improving performance.
116
+ A special type for optimized scrolling. Internally uses `requestAnimationFrame`, preventing unnecessary handler calls and increasing performance.
96
117
 
97
118
  ## Examples
98
119
 
@@ -104,7 +125,7 @@ const tracker = new EventItem('.item-1', 'mousemove', (e) => {
104
125
 
105
126
  tracker.start()
106
127
 
107
- // ... later switch to another element
128
+ // ... switch to another element later
108
129
  tracker.setElement('.item-2')
109
130
  ```
110
131
 
@@ -86,6 +86,27 @@ customEvent.start()
86
86
  - `reset(): this` — Перезапускает событие (полезно после смены настроек).
87
87
  - `dispatch(detail?: D): this` — Вызывает событие на целевом элементе с передачей данных.
88
88
 
89
+ ## Типы
90
+
91
+ #### `ElementOrWindow`
92
+ Элемент, на котором может висеть событие: `HTMLElement | Window`.
93
+
94
+ #### `ElementOrString<E>`
95
+ Тип для передачи элемента или его селектора: `E | string`.
96
+
97
+ #### `EventListenerDetail<O, D>`
98
+ Функция-обработчик события: `(event: O, detail?: D) => void`.
99
+
100
+ #### `EventOptions`
101
+ Опции прослушивания: `AddEventListenerOptions | boolean | undefined`.
102
+
103
+ #### `EventActivityItem<E>`
104
+ Внутренний интерфейс для отслеживания активных слушателей.
105
+ - `element: E | undefined` — Целевой элемент.
106
+ - `type: string` — Тип события.
107
+ - `listener?: (event: any) => void` — Активная функция.
108
+ - `observer?: ResizeObserver` — Инстанс наблюдателя (для `resize`).
109
+
89
110
  ## Специальные события
90
111
 
91
112
  ### `resize`
@@ -1,34 +1,34 @@
1
1
  import {Meta} from '@storybook/addon-docs/blocks'
2
2
 
3
- <Meta title='@dxtmisha/vi/functional-basic/Classes/EventItem - Quản lý Sự kiện Nâng cao'/>
3
+ <Meta title='@dxtmisha/vi/functional-basic/Classes/EventItem - Quản lý sự kiện nâng cao'/>
4
4
 
5
5
  # Lớp EventItem
6
6
 
7
- Một bộ khung (wrapper) mạnh mẽ để quản lý các trình lắng nghe sự kiện (event listeners) trên các phần tử DOM hoặc đối tượng `window`. Lớp này đơn giản hóa vòng đời của sự kiện (thêm, xóa, bật/tắt), hỗ trợ kiểm tra sự tồn tại của phần tử trong DOM và cung cấp các tối ưu hóa tích hợp cho các sự kiện nặng như `resize` và `scroll`.
7
+ Một vỏ bọc mạnh mẽ để quản lý các trình lắng nghe sự kiện trên các phần tử DOM hoặc đối tượng `window`. Lớp này đơn giản hóa việc làm việc với vòng đời sự kiện (thêm, xóa, chuyển đổi), hỗ trợ tự động kiểm tra sự hiện diện của phần tử trong DOM và cung cấp tối ưu hóa tích hợp cho các sự kiện nặng như `resize` và `scroll`.
8
8
 
9
- ## Tính năng chính
9
+ ## Các tính năng chính
10
10
 
11
- - **Quản lý vòng đời** — các phương thức `start`, `stop`, `toggle` và `reset` tiện lợi để kiểm soát chính xác việc lắng nghe sự kiện.
12
- - **An toàn DOM** — tự động kiểm tra `isInDom` trước khi thực hiện trình xử lý (có thể cấu hình phần tử kiểm soát).
13
- - **Hỗ trợ ResizeObserver** — xử lý tích hợp sự kiện `resize` cho bất kỳ phần tử HTML nào bằng API hiện đại.
14
- - **Tối ưu hóa cuộn** — loại sự kiện đặc biệt `scroll-sync` sử dụng `requestAnimationFrame` để đạt hiệu suất cao.
15
- - **Chuỗi lệnh và linh hoạt** — hỗ trợ chuỗi lệnh (chaining) và thay đổi động mục tiêu, loại hoặc trình xử lý sự kiện.
16
- - **Dữ liệu tùy chỉnh** — khả năng truyền và phát tán dữ liệu tùy chỉnh thông qua `CustomEvent`.
11
+ - **Quản lý vòng đời** — các phương thức `start`, `stop`, `toggle` và `reset` thuận tiện để kiểm soát việc lắng nghe sự kiện.
12
+ - **An toàn DOM** — tự động kiểm tra `isInDom` trước khi thực thi trình xử lý (có thể cấu hình phần tử điều khiển).
13
+ - **Hỗ trợ ResizeObserver** — xử lý tích hợp sự kiện `resize` cho bất kỳ phần tử HTML nào thông qua API hiện đại.
14
+ - **Tối ưu hóa cuộn** — kiểu sự kiện `scroll-sync` đặc biệt sử dụng `requestAnimationFrame` cho hiệu suất cao.
15
+ - **Chaining và linh hoạt** — hỗ trợ nối chuỗi cuộc gọi và thay đổi động đích, kiểu hoặc trình xử lý sự kiện.
16
+ - **Dữ liệu tùy chỉnh** — khả năng truyền và điều phối dữ liệu tùy chỉnh thông qua `CustomEvent`.
17
17
 
18
18
  ## Khởi tạo
19
19
 
20
- Để khởi tạo đối tượng, hãy gọi hàm khởi tạo `EventItem(elementSelector, type, listener, options, detail)`.
20
+ Để khởi tạo đối tượng, hãy gọi constructor `EventItem(elementSelector, type, listener, options, detail)`.
21
21
 
22
- ### Ràng buộc Generic (Generic Constraints)
22
+ ### Các ràng buộc Generic (Generic Constraints)
23
23
 
24
- Để đảm bảo định kiểu nghiêm ngặt, lớp này hỗ trợ các generic sau:
25
- - `E extends ElementOrWindow` — Kiểu của phần tử nơi các sự kiện được lắng nghe.
26
- - `O extends Event` — Kiểu đối tượng sự kiện.
27
- - `D extends Record<string, any>` — Cấu trúc dữ liệu bổ sung.
24
+ Để đảm bảo kiểu nghiêm ngặt, lớp hỗ trợ các generic sau:
25
+ - `E extends ElementOrWindow` — Kiểu phần tử các sự kiện được lắng nghe.
26
+ - `O extends Event` — Kiểu của đối tượng sự kiện.
27
+ - `D extends Record<string, any>` — Cấu trúc của dữ liệu bổ sung.
28
28
 
29
29
  **Tham số:**
30
- - `elementSelector?: ElementOrString<E>` — phần tử đích nơi trình lắng nghe được gắn vào.
31
- - `type: string | string[] = 'click'` — loại sự kiện, một mảng các loại hoặc các loại đặc biệt (`'resize'`, `'scroll-sync'`).
30
+ - `elementSelector?: ElementOrString<E>` — phần tử đích trình lắng nghe được đính kèm.
31
+ - `type: string | string[] = 'click'` — kiểu sự kiện, mảng các kiểu hoặc các kiểu đặc biệt (`'resize'`, `'scroll-sync'`).
32
32
  - `listener?: EventListenerDetail<O, D>` — hàm xử lý sự kiện.
33
33
  - `options?: EventOptions` — các tùy chọn `addEventListener` tiêu chuẩn.
34
34
  - `detail?: D` — dữ liệu tùy chỉnh sẽ có sẵn trong trình xử lý.
@@ -36,63 +36,84 @@ Một bộ khung (wrapper) mạnh mẽ để quản lý các trình lắng nghe
36
36
  ```typescript
37
37
  import { EventItem } from '@dxtmisha/functional-basic'
38
38
 
39
- // 1. Khởi tạo đơn giản
39
+ // 1. Khởi tạo bản
40
40
  const myEvent = new EventItem(
41
41
  '.my-button',
42
42
  'click',
43
- (event) => console.log('Sự kiện được kích hoạt:', event.type)
43
+ (event) => console.log('Sự kiện đã kích hoạt:', event.type)
44
44
  )
45
45
 
46
- // 2. Sử dụng generic để định kiểu nghiêm ngặt
46
+ // 2. Sử dụng generic cho kiểu nghiêm ngặt
47
47
  interface MyData { id: number }
48
48
  const customEvent = new EventItem<Window, MouseEvent, MyData>(
49
49
  window,
50
50
  'mousedown',
51
51
  (event, detail) => {
52
- console.log('Cửa sổ được nhấn, ID dữ liệu:', detail?.id)
52
+ console.log('Nhấp vào cửa sổ, ID dữ liệu:', detail?.id)
53
53
  },
54
54
  { passive: true },
55
55
  { id: 42 }
56
56
  )
57
57
 
58
- // 3. Kích hoạt trình lắng nghe
58
+ // 3. Kích hoạt lắng nghe
59
59
  myEvent.start()
60
60
  customEvent.start()
61
61
  ```
62
62
 
63
- ## Phương thức
63
+ ## Các phương thức
64
64
 
65
65
  ### Thông tin
66
66
 
67
- - `isActive(): boolean` — Kiểm tra xem việc lắng nghe sự kiện có đang hoạt động hay không.
68
- - `getElement(): E | undefined` — Trả về phần tử mục tiêu hiện tại.
67
+ - `isActive(): boolean` — Kiểm tra xem việc lắng nghe sự kiện hiện có đang hoạt động hay không.
68
+ - `getElement(): E | undefined` — Trả về phần tử đích hiện tại.
69
69
 
70
70
  ### Cấu hình (Setters)
71
71
 
72
- Tất cả các phương thức trong nhóm này đều hỗ trợ chuỗi lệnh và tự động gọi `reset()` nếu sự kiện đang hoạt động.
72
+ Tất cả các phương thức trong nhóm này đều hỗ trợ nối chuỗi và tự động gọi `reset()` nếu sự kiện đang hoạt động.
73
73
 
74
- - `setElement(elementSelector?: ElementOrString): this` — Thay đổi phần tử mục tiêu.
75
- - `setElementControl(elementSelector?: ElementOrString): this` — Thiết lập phần tử kiểm soát (nếu thiếu trong DOM, sự kiện sẽ không kích hoạt).
76
- - `setType(type: string | string[]): this` — Thay đổi loại sự kiện.
74
+ - `setElement(elementSelector?: ElementOrString): this` — Thay đổi phần tử đích.
75
+ - `setElementControl(elementSelector?: ElementOrString): this` — Thiết lập phần tử điều khiển (nếu không có trong DOM, sự kiện sẽ không kích hoạt).
76
+ - `setType(type: string | string[]): this` — Thay đổi kiểu sự kiện.
77
77
  - `setListener(listener: Function): this` — Thay đổi hàm xử lý.
78
- - `setOptions(options?: EventOptions): this` — Thay đổi các tùy chọn của trình lắng nghe.
79
- - `setDetail(detail?: D): this` — Thay đổi dữ liệu tùy chỉnh của sự kiện.
78
+ - `setOptions(options?: EventOptions): this` — Thay đổi các tham số trình lắng nghe.
79
+ - `setDetail(detail?: D): this` — Thay đổi dữ liệu sự kiện tùy chỉnh.
80
80
 
81
- ### Điều khiển
81
+ ### Quản
82
82
 
83
- - `start(): this` — Bắt đầu lắng nghe các sự kiện.
84
- - `stop(): this` — Dừng lắng nghe các sự kiện.
85
- - `toggle(activity: boolean): this` — Bật hoặc tắt việc lắng nghe dựa trên cờ hiệu.
83
+ - `start(): this` — Bắt đầu lắng nghe sự kiện.
84
+ - `stop(): this` — Dừng lắng nghe sự kiện.
85
+ - `toggle(activity: boolean): this` — Bật hoặc tắt lắng nghe tùy thuộc vào cờ.
86
86
  - `reset(): this` — Khởi động lại sự kiện (hữu ích sau khi thay đổi cài đặt).
87
- - `dispatch(detail?: D): this` — Kích hoạt sự kiện trên phần tử mục tiêu với việc truyền dữ liệu.
87
+ - `dispatch(detail?: D): this` — Kích hoạt sự kiện trên phần tử đích với việc truyền dữ liệu.
88
+
89
+ ## Các kiểu dữ liệu
90
+
91
+ #### `ElementOrWindow`
92
+ Phần tử mà sự kiện có thể được đính kèm: `HTMLElement | Window`.
93
+
94
+ #### `ElementOrString<E>`
95
+ Kiểu để truyền một phần tử hoặc bộ chọn của nó: `E | string`.
96
+
97
+ #### `EventListenerDetail<O, D>`
98
+ Hàm lắng nghe sự kiện: `(event: O, detail?: D) => void`.
99
+
100
+ #### `EventOptions`
101
+ Các tùy chọn lắng nghe: `AddEventListenerOptions | boolean | undefined`.
102
+
103
+ #### `EventActivityItem<E>`
104
+ Giao diện nội bộ để theo dõi các trình lắng nghe đang hoạt động.
105
+ - `element: E | undefined` — Phần tử đích.
106
+ - `type: string` — Kiểu sự kiện.
107
+ - `listener?: (event: any) => void` — Hàm đang hoạt động.
108
+ - `observer?: ResizeObserver` — Thực thể observer (cho `resize`).
88
109
 
89
110
  ## Các sự kiện đặc biệt
90
111
 
91
112
  ### `resize`
92
- Nếu loại sự kiện được đặt `resize`, lớp sẽ tự động sử dụng `ResizeObserver` để theo dõi các thay đổi kích thước của phần tử (ngay cả khi đó không phải là `window`).
113
+ Nếu kiểu sự kiện được đặt thành `resize`, lớp sẽ tự động sử dụng `ResizeObserver` để theo dõi những thay đổi về kích thước của phần tử (ngay cả khi đó không phải là `window`).
93
114
 
94
115
  ### `scroll-sync`
95
- Một loại đặc biệt để tối ưu hóa việc cuộn. sử dụng `requestAnimationFrame` nội bộ, ngăn chặn các cuộc gọi trình xử lý thừacải thiện hiệu suất.
116
+ Một kiểu đặc biệt cho việc cuộn tối ưu hóa. Bên trong sử dụng `requestAnimationFrame`, ngăn chặn các cuộc gọi trình xử lý không cần thiết tăng hiệu suất.
96
117
 
97
118
  ## Ví dụ
98
119
 
@@ -104,20 +125,20 @@ const tracker = new EventItem('.item-1', 'mousemove', (e) => {
104
125
 
105
126
  tracker.start()
106
127
 
107
- // ... sau đó chuyển sang phần tử khác
128
+ // ... chuyển sang phần tử khác sau đó
108
129
  tracker.setElement('.item-2')
109
130
  ```
110
131
 
111
- ### Sử dụng CustomEvent với Dữ liệu
132
+ ### Sử dụng CustomEvent với dữ liệu
112
133
  ```javascript
113
134
  const emitter = new EventItem(window, 'my-custom-event')
114
135
 
115
136
  emitter.setListener((e, detail) => {
116
- console.log('Dữ liệu nhận được:', e.detail) // dữ liệu từ CustomEvent
137
+ console.log('Dữ liệu đã nhận:', e.detail) // dữ liệu từ CustomEvent
117
138
  })
118
139
 
119
140
  emitter.start()
120
141
 
121
- // Phát tán sự kiện
142
+ // Điều phối sự kiện
122
143
  emitter.dispatch({ userId: 123, action: 'refresh' })
123
144
  ```
@@ -4,34 +4,34 @@ import {Meta} from '@storybook/addon-docs/blocks'
4
4
 
5
5
  # Formatters Class
6
6
 
7
- A specialized class for formatting lists of data based on provided configuration. It acts as a bridge between raw data and localized, human-readable strings, leveraging the `GeoIntl` singleton for consistent formatting across different locales.
7
+ A specialized class for formatting data lists based on a provided configuration. It serves as a bridge between raw data and localized, human-readable strings, utilizing the `GeoIntl` singleton for consistent formatting across different locales.
8
8
 
9
9
  ## Key Features
10
10
 
11
- - **Declarative Configuration** — Define formatting rules once and apply them to an entire dataset.
12
- - **Support for Multiple Types** — Built-in support for currency, dates, names, numbers, plurals, and units.
13
- - **Custom Transformations** — Ability to provide custom functions for unique formatting needs.
14
- - **Type Safety** — Full TypeScript support for items, options, and resulting formatted lists.
15
- - **Automatic Key Generation** — Automatically adds formatted values to items with a `Format` suffix (e.g., `price` becomes `priceFormat`).
11
+ - **Declarative Configuration** — Define formatting rules once and apply them to the entire dataset.
12
+ - **Support for Multiple Types** — Built-in support for currencies, dates, names, numbers, plurals, and units.
13
+ - **Custom Transformations** — The ability to provide your own functions for unique formatting needs.
14
+ - **Typing** — Full TypeScript support for items, parameters, and resulting formatted lists.
15
+ - **Automatic Key Generation** — Automatically adds formatted values to items with the `Format` suffix (e.g., `price` becomes `priceFormat`).
16
16
 
17
17
  ## Initialization
18
18
 
19
- To initialize the object, call the `Formatters(options, list)` constructor.
19
+ To initialize the object, call the constructor `Formatters(options, list)`.
20
20
 
21
21
  ### Generic Constraints
22
22
 
23
- - `Options extends FormattersOptionsList` — type of formatting options.
24
- - `List extends FormattersList<FormattersListItem> | FormattersListItem` — type of the input data (array or single item).
25
- - `Item extends (List extends any[] ? List[number] : List)` — type of a single item in the list.
23
+ - `Options extends FormattersOptionsList` — type of formatting parameters.
24
+ - `List extends FormattersListProp` — type of input data (array or single item).
25
+ - `Item extends FormattersItemProp<List>` — type of a single item in the list.
26
26
 
27
27
  **Parameters:**
28
- - `options: Options` — formatting options for each column/property.
29
- - `list?: List` — initial list of data to format.
28
+ - `options: Options` — formatting parameters for each column/property.
29
+ - `list?: List` — initial data list for formatting.
30
30
 
31
31
  ```typescript
32
32
  import { Formatters } from '@dxtmisha/functional-basic'
33
33
 
34
- // 1. Define formatting options
34
+ // 1. Defining formatting parameters
35
35
  const options = {
36
36
  price: {
37
37
  type: 'currency',
@@ -44,31 +44,17 @@ const options = {
44
44
  user: {
45
45
  type: 'name',
46
46
  options: { lastPropName: 'surname', firstPropName: 'name' }
47
- },
48
- weight: {
49
- type: 'unit',
50
- options: { unit: 'kilogram' }
51
- },
52
- count: {
53
- type: 'plural',
54
- options: { words: 'apple|apples' }
55
- },
56
- status: {
57
- transformation: (value: number) => value === 1 ? 'Active' : 'Inactive'
58
47
  }
59
48
  }
60
49
 
61
- // 2. Initial data (can be an array or a single object)
50
+ // 2. Raw data
62
51
  const data = [
63
52
  {
64
53
  price: 100,
65
54
  currency: 'USD',
66
55
  created: '2024-03-07T12:00:00',
67
56
  name: 'John',
68
- surname: 'Doe',
69
- weight: 75,
70
- count: 5,
71
- status: 1
57
+ surname: 'Doe'
72
58
  }
73
59
  ]
74
60
 
@@ -76,93 +62,95 @@ const data = [
76
62
  const formatter = new Formatters(options, data)
77
63
  ```
78
64
 
79
- ## Processing Data
65
+ ## Methods
80
66
 
81
- ### `to`
67
+ ### Processing
68
+ - `to(): FormattersReturn<List, Options>` — Processes the data and returns the result. If the input was an array, returns a new array of enriched items. If it was a single item — a single object. Adds properties with the `Format` suffix.
82
69
 
83
- Processes the data and returns the result. If the input was an array, it returns a new array of enriched items. If the input was a single item, it returns that single enriched item.
70
+ ### Configuration
71
+ - `setList(list?: List): this` — Updates the data for formatting. Supports chaining.
84
72
 
85
- **Returns:** `FormattersListColumns<Item, Options> | FormattersListColumnItem<Item, Options>` — enriched data with additional `*Format` properties.
73
+ ### Information
74
+ - `is(): boolean` — Checks if data is set for processing.
75
+ - `isArray(): boolean` — Whether the current data is an array.
76
+ - `length(): number` — Returns the count of records in the list.
77
+ - `getList(): FormattersList<Item>` — Returns the current list as an array.
78
+ - `getOptions(): Options` — Returns the current formatting configuration.
79
+
80
+ ## Formatting Types and Parameters
81
+
82
+ The `FormattersOptionsList` configuration is a dictionary where keys correspond to property names in the data (dot notation `path.to.prop` is supported), and values are `FormattersOptionsItem` objects.
83
+
84
+ ### General Structure of `FormattersOptionsItem`
85
+ - `type?: FormattersType` — Formatter type.
86
+ - `transformation?: (value, item, options) => string` — Custom transformation function.
87
+ - `options?: Options` — Parameter object, the structure of which depends on the selected `type`.
88
+
89
+ ### Detailed Type Description
90
+
91
+ #### 1. Currency (`currency`)
92
+ Used for localized display of monetary values.
93
+ - `currencyPropName?: string` — Property name in the item from which the currency code is taken (default is `currency`).
94
+ - `options?: string | Intl.NumberFormatOptions` — You can pass a fixed code (e.g., `'USD'`) or an `Intl.NumberFormat` settings object.
95
+ - `numberOnly?: boolean` — If `true`, returns only the formatted number without the currency symbol.
96
+
97
+ #### 2. Date (`date`)
98
+ Formatting dates and times via `GeoIntl`.
99
+ - `type?: GeoDate` — Preset format:
100
+ - `full` — Full date and time.
101
+ - `datetime` — Date and time (without seconds).
102
+ - `date` — Date only.
103
+ - `time` — Time only.
104
+ - `year-month`, `year`, `month`, `day`, `day-month`, `hour-minute`.
105
+ - `options?: Intl.DateTimeFormatOptions` — Standard `Intl` parameters (e.g., `month: 'long'`).
106
+ - `hour24?: boolean` — If `true`, forces 24-hour mode.
107
+
108
+ #### 3. Name (`name`)
109
+ Combines full name parts in the correct order.
110
+ - `lastPropName?: string` — Field for the last name (default is `lastName`).
111
+ - `firstPropName?: string` — Field for the first name (default is `firstName`).
112
+ - `surname?: string` — Field for the middle name/surname (default is `surname`).
113
+ - `short?: boolean` — If `true`, outputs the last name and initials (e.g., "Doe J.").
114
+
115
+ #### 4. Number (`number`)
116
+ Standard number formatting with digit separation.
117
+ - `options?: Intl.NumberFormatOptions` — `Intl` parameters (number of decimal places, style, etc.).
118
+
119
+ #### 5. Plural (`plural`)
120
+ Choosing the correct word form depending on the number.
121
+ - `words: string` — Word forms via the `|` separator.
122
+ - For English: `"apple|apples"`.
123
+ - For Russian: `"яблоко|яблока|яблок"`.
124
+ - `options?: Intl.PluralRulesOptions` — Pluralization rule settings.
125
+ - `optionsNumber?: Intl.NumberFormatOptions` — Settings for formatting the number itself that is output before the word.
126
+
127
+ #### 6. Unit (`unit`)
128
+ Adding units of measurement (km, kg, l).
129
+ - `unit: string` — Unit of measurement code (e.g., `'kilometer'`, `'kilogram'`, `'liter'`).
130
+ - `options?: Intl.NumberFormatOptions` — Formatting parameters for the numeric part.
131
+
132
+ ## Examples
133
+
134
+ ### Using Dot Notation
135
+ ```typescript
136
+ const options = {
137
+ 'user.profile.age': { type: 'number' }
138
+ }
139
+ const data = { user: { profile: { age: 25 } } }
140
+ const formatter = new Formatters(options, data)
86
141
 
87
- ```javascript
88
142
  const result = formatter.to()
89
- /*
90
- Result (if array): [
91
- {
92
- id: 101,
93
- price: 100,
94
- currency: 'USD',
95
- priceFormat: '$100.00',
96
- status: 1,
97
- statusFormat: 'Active',
98
- ...
99
- }
100
- ]
101
-
102
- Result (if single item): {
103
- price: 100,
104
- priceFormat: '$100.00',
105
- ...
106
- }
107
- */
143
+ // result.userProfileAgeFormat === "25"
108
144
  ```
109
145
 
110
- ## Retrieval and Data Management
111
-
112
- - `is(): boolean` — Checks if the list/item is set.
113
- - `isArray(): boolean` — Checks if the current data is an array.
114
- - `length(): number` — Returns the count of records in the list.
115
- - `getList(): Item[]` — Returns the current list of data as an array.
116
- - `getOptions(): Options` — Returns the current formatting configuration mapping.
117
- - `setList(list?: List): this` — Updates the data and returns the instance for chaining.
118
-
119
- ## Configuration Structure
120
-
121
- The configuration object passed to the constructor is a map where each key corresponds to a property name in your data. Each value must follow the `FormattersOptionsItem` structure.
122
-
123
- ### Main Item Structure
124
-
146
+ ### Custom Transformation
125
147
  ```typescript
126
- {
127
- // 1. Specify the formatting type
128
- type: 'currency' | 'date' | 'name' | 'number' | 'plural' | 'unit',
129
-
130
- // 2. Pass type-specific parameters here
131
- options: { ... },
132
-
133
- // 3. Or use a custom function (overrides type-specific logic)
134
- transformation: (value, item, options) => string
148
+ const options = {
149
+ status: {
150
+ // Custom function takes precedence over type
151
+ transformation: (value, item) => {
152
+ return value === 'active' ? `✅ ${item.name} is online` : '❌ Offline'
153
+ }
154
+ }
135
155
  }
136
156
  ```
137
-
138
- ## Specific Parameters
139
-
140
- Below are the parameters available within the **`options`** property for each type.
141
-
142
- ### Currency (`currency`)
143
- - `currencyPropName?: string` — Property in the item containing the currency code (defaults to `item.currency`).
144
- - `options?: string | Intl.NumberFormatOptions` — Fixed currency code or full `Intl` options.
145
- - `numberOnly?: boolean` — If `true`, returns only the formatted number without the symbol.
146
-
147
- ### Date (`date`)
148
- - `type?: GeoDate` — Preset type: `full`, `datetime`, `date`, `year-month`, `year`, `month`, `day`, `day-month`, `time`, `hour-minute`, `hour`, `minute`, `second`.
149
- - `options?: Intl.DateTimeFormatOptions['month'] | Intl.DateTimeFormatOptions` — Additional `Intl` date options or month style.
150
- - `hour24?: boolean` — Forces 24-hour format if `true`.
151
-
152
- ### Name (`name`)
153
- - `lastPropName?: string` — Field for last name (default: `lastName`).
154
- - `firstPropName?: string` — Field for first name (default: `firstName`).
155
- - `surname?: string` — Field for surname (default: `surname`).
156
- - `short?: boolean` — Whether to use short format (initials).
157
-
158
- ### Number (`number`)
159
- - `options?: Intl.NumberFormatOptions` — Standard `Intl` number options.
160
-
161
- ### Plural (`plural`)
162
- - `words: string` — Word forms separated by `|` (e.g., `"apple|apples"`).
163
- - `options?: Intl.PluralRulesOptions` — Plural rule settings.
164
- - `optionsNumber?: Intl.NumberFormatOptions` — Formatting for the number itself.
165
-
166
- ### Unit (`unit`)
167
- - `unit: string | Intl.NumberFormatOptions` — The unit to display (e.g., `'kilometer'`, `'kilogram'`).
168
-