@matreshka/bff 0.9.0

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 (275) hide show
  1. package/LICENSE +32 -0
  2. package/README.md +35 -0
  3. package/dist/components/actions/server-action.d.ts +30 -0
  4. package/dist/components/actions/server-action.js +23 -0
  5. package/dist/components/aliases/button.d.ts +17 -0
  6. package/dist/components/aliases/button.js +54 -0
  7. package/dist/components/aliases/column.d.ts +11 -0
  8. package/dist/components/aliases/column.js +31 -0
  9. package/dist/components/aliases/row.d.ts +11 -0
  10. package/dist/components/aliases/row.js +31 -0
  11. package/dist/components/aliases/surface.d.ts +11 -0
  12. package/dist/components/aliases/surface.js +30 -0
  13. package/dist/components/app.d.ts +5 -0
  14. package/dist/components/app.js +12 -0
  15. package/dist/components/board.d.ts +58 -0
  16. package/dist/components/board.js +152 -0
  17. package/dist/components/boot.d.ts +2 -0
  18. package/dist/components/boot.js +39 -0
  19. package/dist/components/camera.d.ts +77 -0
  20. package/dist/components/camera.js +116 -0
  21. package/dist/components/charts/bar-chart.d.ts +14 -0
  22. package/dist/components/charts/bar-chart.js +27 -0
  23. package/dist/components/charts/chart.d.ts +69 -0
  24. package/dist/components/charts/chart.js +42 -0
  25. package/dist/components/charts/doughnut-chart.d.ts +14 -0
  26. package/dist/components/charts/doughnut-chart.js +27 -0
  27. package/dist/components/charts/line-chart.d.ts +14 -0
  28. package/dist/components/charts/line-chart.js +27 -0
  29. package/dist/components/charts/pie-chart.d.ts +14 -0
  30. package/dist/components/charts/pie-chart.js +27 -0
  31. package/dist/components/charts/polar-area-chart.d.ts +14 -0
  32. package/dist/components/charts/polar-area-chart.js +27 -0
  33. package/dist/components/charts/radar-chart.d.ts +14 -0
  34. package/dist/components/charts/radar-chart.js +27 -0
  35. package/dist/components/component.d.ts +159 -0
  36. package/dist/components/component.js +380 -0
  37. package/dist/components/container.d.ts +48 -0
  38. package/dist/components/container.js +80 -0
  39. package/dist/components/dialog.d.ts +83 -0
  40. package/dist/components/dialog.js +120 -0
  41. package/dist/components/entry-component.d.ts +34 -0
  42. package/dist/components/entry-component.js +74 -0
  43. package/dist/components/enum/password-input-kind.d.ts +1 -0
  44. package/dist/components/enum/password-input-kind.js +5 -0
  45. package/dist/components/enum/popover-position-area.d.ts +1 -0
  46. package/dist/components/enum/popover-position-area.js +5 -0
  47. package/dist/components/enum/text-input-kind.d.ts +1 -0
  48. package/dist/components/enum/text-input-kind.js +5 -0
  49. package/dist/components/enum/textarea-resize.d.ts +1 -0
  50. package/dist/components/enum/textarea-resize.js +5 -0
  51. package/dist/components/file-upload-area.d.ts +79 -0
  52. package/dist/components/file-upload-area.js +138 -0
  53. package/dist/components/for-each.d.ts +188 -0
  54. package/dist/components/for-each.js +362 -0
  55. package/dist/components/form.d.ts +62 -0
  56. package/dist/components/form.js +92 -0
  57. package/dist/components/grid.d.ts +80 -0
  58. package/dist/components/grid.js +79 -0
  59. package/dist/components/index.d.ts +55 -0
  60. package/dist/components/index.js +76 -0
  61. package/dist/components/inputs/input-component.d.ts +37 -0
  62. package/dist/components/inputs/input-component.js +30 -0
  63. package/dist/components/inputs/number-input.d.ts +45 -0
  64. package/dist/components/inputs/number-input.js +43 -0
  65. package/dist/components/inputs/password-input.d.ts +28 -0
  66. package/dist/components/inputs/password-input.js +42 -0
  67. package/dist/components/inputs/text-editor.d.ts +91 -0
  68. package/dist/components/inputs/text-editor.js +282 -0
  69. package/dist/components/inputs/text-input.d.ts +48 -0
  70. package/dist/components/inputs/text-input.js +40 -0
  71. package/dist/components/inputs/textarea.d.ts +36 -0
  72. package/dist/components/inputs/textarea.js +42 -0
  73. package/dist/components/item-list/flatten-nested-items.d.ts +11 -0
  74. package/dist/components/item-list/flatten-nested-items.js +100 -0
  75. package/dist/components/item-list/index.d.ts +5 -0
  76. package/dist/components/item-list/index.js +21 -0
  77. package/dist/components/item-list/item-list-host.d.ts +10 -0
  78. package/dist/components/item-list/item-list-host.js +2 -0
  79. package/dist/components/item-list/item-list.d.ts +68 -0
  80. package/dist/components/item-list/item-list.js +206 -0
  81. package/dist/components/item-list/list-from-ref-context.d.ts +11 -0
  82. package/dist/components/item-list/list-from-ref-context.js +27 -0
  83. package/dist/components/item-list/nested-items-host-support.d.ts +36 -0
  84. package/dist/components/item-list/nested-items-host-support.js +109 -0
  85. package/dist/components/item-list/types.d.ts +40 -0
  86. package/dist/components/item-list/types.js +13 -0
  87. package/dist/components/line.d.ts +43 -0
  88. package/dist/components/line.js +35 -0
  89. package/dist/components/map.d.ts +83 -0
  90. package/dist/components/map.js +146 -0
  91. package/dist/components/outputs/currency.d.ts +63 -0
  92. package/dist/components/outputs/currency.js +42 -0
  93. package/dist/components/outputs/datetime.d.ts +69 -0
  94. package/dist/components/outputs/datetime.js +49 -0
  95. package/dist/components/outputs/icon.d.ts +43 -0
  96. package/dist/components/outputs/icon.js +38 -0
  97. package/dist/components/outputs/iframe.d.ts +48 -0
  98. package/dist/components/outputs/iframe.js +44 -0
  99. package/dist/components/outputs/image.d.ts +73 -0
  100. package/dist/components/outputs/image.js +63 -0
  101. package/dist/components/outputs/number.d.ts +39 -0
  102. package/dist/components/outputs/number.js +47 -0
  103. package/dist/components/outputs/output-component.d.ts +58 -0
  104. package/dist/components/outputs/output-component.js +50 -0
  105. package/dist/components/outputs/progress-bar.d.ts +33 -0
  106. package/dist/components/outputs/progress-bar.js +42 -0
  107. package/dist/components/outputs/progress-spinner.d.ts +37 -0
  108. package/dist/components/outputs/progress-spinner.js +43 -0
  109. package/dist/components/outputs/qr-code.d.ts +28 -0
  110. package/dist/components/outputs/qr-code.js +40 -0
  111. package/dist/components/outputs/text.d.ts +57 -0
  112. package/dist/components/outputs/text.js +78 -0
  113. package/dist/components/outputs/vector.d.ts +47 -0
  114. package/dist/components/outputs/vector.js +53 -0
  115. package/dist/components/page.d.ts +96 -0
  116. package/dist/components/page.js +127 -0
  117. package/dist/components/popover.d.ts +63 -0
  118. package/dist/components/popover.js +96 -0
  119. package/dist/components/stack.d.ts +158 -0
  120. package/dist/components/stack.js +146 -0
  121. package/dist/components/types/component-sequence.d.ts +3 -0
  122. package/dist/components/types/component-sequence.js +2 -0
  123. package/dist/components/types/container-overlay.d.ts +3 -0
  124. package/dist/components/types/container-overlay.js +2 -0
  125. package/dist/components/utils/component-factory-shared.d.ts +4 -0
  126. package/dist/components/utils/component-factory-shared.js +12 -0
  127. package/dist/core/actions/action.d.ts +35 -0
  128. package/dist/core/actions/action.js +45 -0
  129. package/dist/core/actions/animate-component.d.ts +58 -0
  130. package/dist/core/actions/animate-component.js +57 -0
  131. package/dist/core/actions/local-action.d.ts +8 -0
  132. package/dist/core/actions/local-action.js +12 -0
  133. package/dist/core/actions/set-context-value.d.ts +18 -0
  134. package/dist/core/actions/set-context-value.js +32 -0
  135. package/dist/core/actions/set-context-values.d.ts +34 -0
  136. package/dist/core/actions/set-context-values.js +30 -0
  137. package/dist/core/actions/toggle-context-value.d.ts +21 -0
  138. package/dist/core/actions/toggle-context-value.js +30 -0
  139. package/dist/core/actions/write-text-to-clipboard.d.ts +30 -0
  140. package/dist/core/actions/write-text-to-clipboard.js +44 -0
  141. package/dist/core/boot.d.ts +2 -0
  142. package/dist/core/boot.js +8 -0
  143. package/dist/core/client-context.d.ts +7 -0
  144. package/dist/core/client-context.js +20 -0
  145. package/dist/core/client.d.ts +133 -0
  146. package/dist/core/client.js +292 -0
  147. package/dist/core/conditions/condition-group.d.ts +14 -0
  148. package/dist/core/conditions/condition-group.js +30 -0
  149. package/dist/core/conditions/condition-operand.d.ts +27 -0
  150. package/dist/core/conditions/condition-operand.js +15 -0
  151. package/dist/core/conditions/condition.d.ts +27 -0
  152. package/dist/core/conditions/condition.js +35 -0
  153. package/dist/core/conditions/context-array-includes.d.ts +32 -0
  154. package/dist/core/conditions/context-array-includes.js +52 -0
  155. package/dist/core/conditions/context-array-length.d.ts +86 -0
  156. package/dist/core/conditions/context-array-length.js +155 -0
  157. package/dist/core/conditions/context-value-defined.d.ts +12 -0
  158. package/dist/core/conditions/context-value-defined.js +21 -0
  159. package/dist/core/conditions/context-value-equal.d.ts +14 -0
  160. package/dist/core/conditions/context-value-equal.js +26 -0
  161. package/dist/core/conditions/context-value-in.d.ts +17 -0
  162. package/dist/core/conditions/context-value-in.js +26 -0
  163. package/dist/core/conditions/context-value-not-equal.d.ts +14 -0
  164. package/dist/core/conditions/context-value-not-equal.js +26 -0
  165. package/dist/core/conditions/context-value-undefined.d.ts +12 -0
  166. package/dist/core/conditions/context-value-undefined.js +21 -0
  167. package/dist/core/conditions/desktop-device.d.ts +11 -0
  168. package/dist/core/conditions/desktop-device.js +21 -0
  169. package/dist/core/conditions/groups.d.ts +71 -0
  170. package/dist/core/conditions/groups.js +74 -0
  171. package/dist/core/conditions/index.d.ts +17 -0
  172. package/dist/core/conditions/index.js +33 -0
  173. package/dist/core/conditions/mobile-device.d.ts +11 -0
  174. package/dist/core/conditions/mobile-device.js +21 -0
  175. package/dist/core/conditions/not-desktop-device.d.ts +11 -0
  176. package/dist/core/conditions/not-desktop-device.js +21 -0
  177. package/dist/core/conditions/not-mobile-device.d.ts +11 -0
  178. package/dist/core/conditions/not-mobile-device.js +21 -0
  179. package/dist/core/conditions/not-tablet-device.d.ts +11 -0
  180. package/dist/core/conditions/not-tablet-device.js +21 -0
  181. package/dist/core/conditions/tablet-device.d.ts +11 -0
  182. package/dist/core/conditions/tablet-device.js +21 -0
  183. package/dist/core/context/context-ref.d.ts +48 -0
  184. package/dist/core/context/context-ref.js +58 -0
  185. package/dist/core/context/context.d.ts +121 -0
  186. package/dist/core/context/context.js +353 -0
  187. package/dist/core/entry-context.d.ts +14 -0
  188. package/dist/core/entry-context.js +31 -0
  189. package/dist/core/gateway-connection.d.ts +29 -0
  190. package/dist/core/gateway-connection.js +146 -0
  191. package/dist/core/index.d.ts +30 -0
  192. package/dist/core/index.js +46 -0
  193. package/dist/core/matreshka.d.ts +61 -0
  194. package/dist/core/matreshka.js +186 -0
  195. package/dist/core/router.d.ts +38 -0
  196. package/dist/core/router.js +116 -0
  197. package/dist/core/types/client-settings.d.ts +31 -0
  198. package/dist/core/types/client-settings.js +2 -0
  199. package/dist/core/types/component-instance.d.ts +25 -0
  200. package/dist/core/types/component-instance.js +42 -0
  201. package/dist/core/types/component-tree-node.d.ts +11 -0
  202. package/dist/core/types/component-tree-node.js +18 -0
  203. package/dist/core/types/componentable.d.ts +21 -0
  204. package/dist/core/types/componentable.js +2 -0
  205. package/dist/core/types/context-ref-primitive-value.d.ts +5 -0
  206. package/dist/core/types/context-ref-primitive-value.js +2 -0
  207. package/dist/core/types/message.d.ts +15 -0
  208. package/dist/core/types/message.js +2 -0
  209. package/dist/core/types/mixed-with-callbacks-array.d.ts +9 -0
  210. package/dist/core/types/mixed-with-callbacks-array.js +2 -0
  211. package/dist/core/types/native-picker-context-ref.d.ts +7 -0
  212. package/dist/core/types/native-picker-context-ref.js +2 -0
  213. package/dist/core/types/pageable.d.ts +15 -0
  214. package/dist/core/types/pageable.js +2 -0
  215. package/dist/core/types/standalone-component.d.ts +9 -0
  216. package/dist/core/types/standalone-component.js +2 -0
  217. package/dist/core/types/status-code.d.ts +319 -0
  218. package/dist/core/types/status-code.js +322 -0
  219. package/dist/core/utils/calculate-components.d.ts +13 -0
  220. package/dist/core/utils/calculate-components.js +40 -0
  221. package/dist/core/utils/color-token-id.d.ts +11 -0
  222. package/dist/core/utils/color-token-id.js +24 -0
  223. package/dist/core/utils/deep-pick.d.ts +2 -0
  224. package/dist/core/utils/deep-pick.js +54 -0
  225. package/dist/core/utils/hex-to-hsl.d.ts +14 -0
  226. package/dist/core/utils/hex-to-hsl.js +49 -0
  227. package/dist/core/utils/incoming-message-observer.d.ts +9 -0
  228. package/dist/core/utils/incoming-message-observer.js +23 -0
  229. package/dist/core/utils/merge-deep.d.ts +8 -0
  230. package/dist/core/utils/merge-deep.js +39 -0
  231. package/dist/core/utils/objects-diff.d.ts +13 -0
  232. package/dist/core/utils/objects-diff.js +56 -0
  233. package/dist/core/utils/parse-context-path.d.ts +4 -0
  234. package/dist/core/utils/parse-context-path.js +16 -0
  235. package/dist/core/utils/replace-context-keys.d.ts +12 -0
  236. package/dist/core/utils/replace-context-keys.js +90 -0
  237. package/dist/core/utils/serialize-component-tree.d.ts +9 -0
  238. package/dist/core/utils/serialize-component-tree.js +24 -0
  239. package/dist/core/utils/set-object-property.d.ts +2 -0
  240. package/dist/core/utils/set-object-property.js +29 -0
  241. package/dist/core/utils/track-created-instances.d.ts +10 -0
  242. package/dist/core/utils/track-created-instances.js +18 -0
  243. package/dist/core/version.d.ts +1 -0
  244. package/dist/core/version.js +21 -0
  245. package/dist/index.d.ts +3 -0
  246. package/dist/index.js +19 -0
  247. package/dist/platforms/android-platform.d.ts +6 -0
  248. package/dist/platforms/android-platform.js +10 -0
  249. package/dist/platforms/browser-platform.d.ts +79 -0
  250. package/dist/platforms/browser-platform.js +143 -0
  251. package/dist/platforms/client-platform.d.ts +6 -0
  252. package/dist/platforms/client-platform.js +10 -0
  253. package/dist/platforms/index.d.ts +12 -0
  254. package/dist/platforms/index.js +28 -0
  255. package/dist/platforms/ios-platform.d.ts +6 -0
  256. package/dist/platforms/ios-platform.js +10 -0
  257. package/dist/platforms/max-mini-app-platform.d.ts +45 -0
  258. package/dist/platforms/max-mini-app-platform.js +87 -0
  259. package/dist/platforms/mobile-platform.d.ts +117 -0
  260. package/dist/platforms/mobile-platform.js +316 -0
  261. package/dist/platforms/platform.d.ts +109 -0
  262. package/dist/platforms/platform.js +224 -0
  263. package/dist/platforms/pwa-platform.d.ts +6 -0
  264. package/dist/platforms/pwa-platform.js +10 -0
  265. package/dist/platforms/server-platform.d.ts +6 -0
  266. package/dist/platforms/server-platform.js +10 -0
  267. package/dist/platforms/telegram-mini-app-platform.d.ts +87 -0
  268. package/dist/platforms/telegram-mini-app-platform.js +166 -0
  269. package/dist/platforms/utils/client-platform.d.ts +4 -0
  270. package/dist/platforms/utils/client-platform.js +38 -0
  271. package/dist/platforms/utils/mobile-ble-services.d.ts +3 -0
  272. package/dist/platforms/utils/mobile-ble-services.js +31 -0
  273. package/dist/platforms/web-platform.d.ts +9 -0
  274. package/dist/platforms/web-platform.js +13 -0
  275. package/package.json +109 -0
@@ -0,0 +1,91 @@
1
+ import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
+ import { Componentable, ComponentInstance, ContextRef } from "../../core";
3
+ import { ServerComponentAction } from "../component";
4
+ import { InputComponent, InputInitConfig, InputProperties } from "./input-component";
5
+ /**
6
+ * Свойства компонента текстового редактора.
7
+ */
8
+ export type TextEditorProperties = InputProperties;
9
+ /**
10
+ * Конфигурация инициализации текстового редактора.
11
+ */
12
+ export type TextEditorInitConfig<ComponentType extends Componentable = TextEditor, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends TextEditorProperties = TextEditorProperties> = InputInitConfig<string, ComponentType, RefType, PropertiesType> & {
13
+ /**
14
+ * Событие: изменился выделенный текст в редакторе.
15
+ */
16
+ onSelectionChange?: ServerComponentAction<ComponentType, string> | ServerComponentAction<ComponentType, string>[];
17
+ };
18
+ type DefaultInitConfigType<RefType extends ContextRef<any, any>> = TextEditorInitConfig<TextEditor, RefType>;
19
+ export declare function textEditor<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): TextEditor<RefType>;
20
+ export declare function textEditor<RefType extends ContextRef<any, any> = ContextRef<any, any>>(ref: DefaultInitConfigType<RefType>["ref"]): TextEditor<RefType>;
21
+ export declare function textEditor<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: TextEditorInitConfig<any, RefType>): TextEditor<RefType>;
22
+ /**
23
+ * Компонент визуального текстового редактора.
24
+ *
25
+ * Поддерживает панель инструментов, вложенные компоненты и команды форматирования.
26
+ */
27
+ export declare class TextEditor<RefType extends ContextRef<any, any> = ContextRef<any, any>, InitConfigType extends TextEditorInitConfig<any, RefType> = DefaultInitConfigType<RefType>, PropertiesType extends TextEditorProperties = TextEditorProperties> extends InputComponent<InitConfigType, PropertiesType> {
28
+ constructor(config: TextEditorInitConfig<any, RefType>);
29
+ protected class(): ServerComponentClass;
30
+ /**
31
+ * Вставляет HTML в редактор.
32
+ *
33
+ * @param value Строка HTML.
34
+ */
35
+ insertHTML(value: string, instances?: ComponentInstance[]): this;
36
+ /**
37
+ * Переключает курсивное начертание текста.
38
+ */
39
+ toggleItalic(instances?: ComponentInstance[]): this;
40
+ /**
41
+ * Переключает полужирное начертание текста.
42
+ */
43
+ toggleBold(instances?: ComponentInstance[]): this;
44
+ /**
45
+ * Переключает подчеркивание текста.
46
+ */
47
+ toggleUnderline(instances?: ComponentInstance[]): this;
48
+ /**
49
+ * Выполняет операцию отмены последнего действия.
50
+ */
51
+ undo(instances?: ComponentInstance[]): this;
52
+ /**
53
+ * Выполняет операцию повтора последнего отмененного действия.
54
+ */
55
+ redo(instances?: ComponentInstance[]): this;
56
+ /**
57
+ * Применяет формат верхнего индекса к выделенному тексту.
58
+ */
59
+ superscript(instances?: ComponentInstance[]): this;
60
+ /**
61
+ * Вставляет нумерованный список.
62
+ */
63
+ insertOrderedList(instances?: ComponentInstance[]): this;
64
+ /**
65
+ * Вставляет маркированный список.
66
+ */
67
+ insertUnorderedList(instances?: ComponentInstance[]): this;
68
+ /**
69
+ * Выравнивает текст по левому краю.
70
+ */
71
+ justifyLeft(instances?: ComponentInstance[]): this;
72
+ /**
73
+ * Выравнивает текст по центру.
74
+ */
75
+ justifyCenter(instances?: ComponentInstance[]): this;
76
+ /**
77
+ * Выравнивает текст по правому краю.
78
+ */
79
+ justifyRight(instances?: ComponentInstance[]): this;
80
+ /**
81
+ * Выравнивает текст по ширине.
82
+ */
83
+ justifyFull(instances?: ComponentInstance[]): this;
84
+ /**
85
+ * Форматирует блок с указанным тегом.
86
+ *
87
+ * @param tag Тег HTML для форматирования блока.
88
+ */
89
+ formatBlock(tag: string, instances?: ComponentInstance[]): this;
90
+ }
91
+ export {};
@@ -0,0 +1,282 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextEditor = void 0;
4
+ exports.textEditor = textEditor;
5
+ const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
6
+ const text_editor_format_block_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-format-block-message");
7
+ const text_editor_insert_html_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-insert-html-message");
8
+ const text_editor_insert_ordered_list_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-insert-ordered-list-message");
9
+ const text_editor_insert_unordered_list_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-insert-unordered-list-message");
10
+ const text_editor_justify_center_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-justify-center-message");
11
+ const text_editor_justify_full_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-justify-full-message");
12
+ const text_editor_justify_left_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-justify-left-message");
13
+ const text_editor_justify_right_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-justify-right-message");
14
+ const text_editor_redo_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-redo-message");
15
+ const text_editor_superscript_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-superscript-message");
16
+ const text_editor_toggle_bold_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-toggle-bold-message");
17
+ const text_editor_toggle_italic_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-toggle-italic-message");
18
+ const text_editor_toggle_underline_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-toggle-underline-message");
19
+ const text_editor_undo_message_1 = require("@matreshka/shared/messages/bff-to-client/components/text-editor/text-editor-undo-message");
20
+ const core_1 = require("../../core");
21
+ const input_component_1 = require("./input-component");
22
+ function textEditor(arg0, arg1) {
23
+ if (arg1 !== undefined) {
24
+ return new TextEditor({
25
+ ...arg0,
26
+ ref: arg1,
27
+ });
28
+ }
29
+ const single = arg0;
30
+ if (single instanceof core_1.ContextRef) {
31
+ return new TextEditor({ ref: single });
32
+ }
33
+ return new TextEditor(single);
34
+ }
35
+ /**
36
+ * Компонент визуального текстового редактора.
37
+ *
38
+ * Поддерживает панель инструментов, вложенные компоненты и команды форматирования.
39
+ */
40
+ class TextEditor extends input_component_1.InputComponent {
41
+ constructor(config) {
42
+ super(config);
43
+ if (config.onSelectionChange) {
44
+ const actions = config.onSelectionChange;
45
+ this.bindActions("selection-change", actions);
46
+ }
47
+ }
48
+ class() {
49
+ return server_component_class_1.ServerComponentClass.TextEditor;
50
+ }
51
+ /**
52
+ * Вставляет HTML в редактор.
53
+ *
54
+ * @param value Строка HTML.
55
+ */
56
+ insertHTML(value, instances) {
57
+ const payload = { value };
58
+ if (instances) {
59
+ instances
60
+ .filter((instance) => instance.client)
61
+ .forEach((instance) => {
62
+ instance.client.outcomingMessage$.next(new text_editor_insert_html_message_1.TextEditorInsertHtmlMessage(instance.id, payload));
63
+ });
64
+ }
65
+ else {
66
+ this.broadcast(new text_editor_insert_html_message_1.TextEditorInsertHtmlMessage(this.id, payload));
67
+ }
68
+ return this;
69
+ }
70
+ /**
71
+ * Переключает курсивное начертание текста.
72
+ */
73
+ toggleItalic(instances) {
74
+ if (instances) {
75
+ instances
76
+ .filter((instance) => instance.client)
77
+ .forEach((instance) => {
78
+ instance.client.outcomingMessage$.next(new text_editor_toggle_italic_message_1.TextEditorToggleItalicMessage(instance.id));
79
+ });
80
+ }
81
+ else {
82
+ this.broadcast(new text_editor_toggle_italic_message_1.TextEditorToggleItalicMessage(this.id));
83
+ }
84
+ return this;
85
+ }
86
+ /**
87
+ * Переключает полужирное начертание текста.
88
+ */
89
+ toggleBold(instances) {
90
+ if (instances) {
91
+ instances
92
+ .filter((instance) => instance.client)
93
+ .forEach((instance) => {
94
+ instance.client.outcomingMessage$.next(new text_editor_toggle_bold_message_1.TextEditorToggleBoldMessage(instance.id));
95
+ });
96
+ }
97
+ else {
98
+ this.broadcast(new text_editor_toggle_bold_message_1.TextEditorToggleBoldMessage(this.id));
99
+ }
100
+ return this;
101
+ }
102
+ /**
103
+ * Переключает подчеркивание текста.
104
+ */
105
+ toggleUnderline(instances) {
106
+ if (instances) {
107
+ instances
108
+ .filter((instance) => instance.client)
109
+ .forEach((instance) => {
110
+ instance.client.outcomingMessage$.next(new text_editor_toggle_underline_message_1.TextEditorToggleUnderlineMessage(instance.id));
111
+ });
112
+ }
113
+ else {
114
+ this.broadcast(new text_editor_toggle_underline_message_1.TextEditorToggleUnderlineMessage(this.id));
115
+ }
116
+ return this;
117
+ }
118
+ /**
119
+ * Выполняет операцию отмены последнего действия.
120
+ */
121
+ undo(instances) {
122
+ if (instances) {
123
+ instances
124
+ .filter((instance) => instance.client)
125
+ .forEach((instance) => {
126
+ instance.client.outcomingMessage$.next(new text_editor_undo_message_1.TextEditorUndoMessage(instance.id));
127
+ });
128
+ }
129
+ else {
130
+ this.broadcast(new text_editor_undo_message_1.TextEditorUndoMessage(this.id));
131
+ }
132
+ return this;
133
+ }
134
+ /**
135
+ * Выполняет операцию повтора последнего отмененного действия.
136
+ */
137
+ redo(instances) {
138
+ if (instances) {
139
+ instances
140
+ .filter((instance) => instance.client)
141
+ .forEach((instance) => {
142
+ instance.client.outcomingMessage$.next(new text_editor_redo_message_1.TextEditorRedoMessage(instance.id));
143
+ });
144
+ }
145
+ else {
146
+ this.broadcast(new text_editor_redo_message_1.TextEditorRedoMessage(this.id));
147
+ }
148
+ return this;
149
+ }
150
+ /**
151
+ * Применяет формат верхнего индекса к выделенному тексту.
152
+ */
153
+ superscript(instances) {
154
+ if (instances) {
155
+ instances
156
+ .filter((instance) => instance.client)
157
+ .forEach((instance) => {
158
+ instance.client.outcomingMessage$.next(new text_editor_superscript_message_1.TextEditorSuperscriptMessage(instance.id));
159
+ });
160
+ }
161
+ else {
162
+ this.broadcast(new text_editor_superscript_message_1.TextEditorSuperscriptMessage(this.id));
163
+ }
164
+ return this;
165
+ }
166
+ /**
167
+ * Вставляет нумерованный список.
168
+ */
169
+ insertOrderedList(instances) {
170
+ if (instances) {
171
+ instances
172
+ .filter((instance) => instance.client)
173
+ .forEach((instance) => {
174
+ instance.client.outcomingMessage$.next(new text_editor_insert_ordered_list_message_1.TextEditorInsertOrderedListMessage(instance.id));
175
+ });
176
+ }
177
+ else {
178
+ this.broadcast(new text_editor_insert_ordered_list_message_1.TextEditorInsertOrderedListMessage(this.id));
179
+ }
180
+ return this;
181
+ }
182
+ /**
183
+ * Вставляет маркированный список.
184
+ */
185
+ insertUnorderedList(instances) {
186
+ if (instances) {
187
+ instances
188
+ .filter((instance) => instance.client)
189
+ .forEach((instance) => {
190
+ instance.client.outcomingMessage$.next(new text_editor_insert_unordered_list_message_1.TextEditorInsertUnorderedListMessage(instance.id));
191
+ });
192
+ }
193
+ else {
194
+ this.broadcast(new text_editor_insert_unordered_list_message_1.TextEditorInsertUnorderedListMessage(this.id));
195
+ }
196
+ return this;
197
+ }
198
+ /**
199
+ * Выравнивает текст по левому краю.
200
+ */
201
+ justifyLeft(instances) {
202
+ if (instances) {
203
+ instances
204
+ .filter((instance) => instance.client)
205
+ .forEach((instance) => {
206
+ instance.client.outcomingMessage$.next(new text_editor_justify_left_message_1.TextEditorJustifyLeftMessage(instance.id));
207
+ });
208
+ }
209
+ else {
210
+ this.broadcast(new text_editor_justify_left_message_1.TextEditorJustifyLeftMessage(this.id));
211
+ }
212
+ return this;
213
+ }
214
+ /**
215
+ * Выравнивает текст по центру.
216
+ */
217
+ justifyCenter(instances) {
218
+ if (instances) {
219
+ instances
220
+ .filter((instance) => instance.client)
221
+ .forEach((instance) => {
222
+ instance.client.outcomingMessage$.next(new text_editor_justify_center_message_1.TextEditorJustifyCenterMessage(instance.id));
223
+ });
224
+ }
225
+ else {
226
+ this.broadcast(new text_editor_justify_center_message_1.TextEditorJustifyCenterMessage(this.id));
227
+ }
228
+ return this;
229
+ }
230
+ /**
231
+ * Выравнивает текст по правому краю.
232
+ */
233
+ justifyRight(instances) {
234
+ if (instances) {
235
+ instances
236
+ .filter((instance) => instance.client)
237
+ .forEach((instance) => {
238
+ instance.client.outcomingMessage$.next(new text_editor_justify_right_message_1.TextEditorJustifyRightMessage(instance.id));
239
+ });
240
+ }
241
+ else {
242
+ this.broadcast(new text_editor_justify_right_message_1.TextEditorJustifyRightMessage(this.id));
243
+ }
244
+ return this;
245
+ }
246
+ /**
247
+ * Выравнивает текст по ширине.
248
+ */
249
+ justifyFull(instances) {
250
+ if (instances) {
251
+ instances
252
+ .filter((instance) => instance.client)
253
+ .forEach((instance) => {
254
+ instance.client.outcomingMessage$.next(new text_editor_justify_full_message_1.TextEditorJustifyFullMessage(instance.id));
255
+ });
256
+ }
257
+ else {
258
+ this.broadcast(new text_editor_justify_full_message_1.TextEditorJustifyFullMessage(this.id));
259
+ }
260
+ return this;
261
+ }
262
+ /**
263
+ * Форматирует блок с указанным тегом.
264
+ *
265
+ * @param tag Тег HTML для форматирования блока.
266
+ */
267
+ formatBlock(tag, instances) {
268
+ const payload = { tag };
269
+ if (instances) {
270
+ instances
271
+ .filter((instance) => instance.client)
272
+ .forEach((instance) => {
273
+ instance.client.outcomingMessage$.next(new text_editor_format_block_message_1.TextEditorFormatBlockMessage(instance.id, payload));
274
+ });
275
+ }
276
+ else {
277
+ this.broadcast(new text_editor_format_block_message_1.TextEditorFormatBlockMessage(this.id, payload));
278
+ }
279
+ return this;
280
+ }
281
+ }
282
+ exports.TextEditor = TextEditor;
@@ -0,0 +1,48 @@
1
+ import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
+ import { TextInputKind } from "@matreshka/shared/enums/text-input-kind";
3
+ import { Componentable, ContextRef } from "../../core";
4
+ import { InputComponent, InputInitConfig, InputProperties } from "./input-component";
5
+ /**
6
+ * Свойства маски ввода текста.
7
+ *
8
+ * @property value Маска ввода, например: '9999-9999-9999-9999'
9
+ * @property dataSymbols Символы для замены в маске, например: '9'
10
+ * @property accept Регулярное выражение для проверки допустимых символов
11
+ * @property size Максильное количество символов
12
+ */
13
+ export type InputMaskProperties = {
14
+ value: string;
15
+ dataSymbols: string;
16
+ accept?: string;
17
+ size?: number;
18
+ };
19
+ export type TextInputProperties = {
20
+ placeholder?: string;
21
+ mask?: InputMaskProperties;
22
+ kind?: TextInputKind;
23
+ } & InputProperties;
24
+ /**
25
+ * Конфигурация инициализации поля ввода текста.
26
+ * @property placeholder Текст-заполнитель.
27
+ * @property kind Семантический вид текстового поля, который клиент
28
+ * преобразует в `autocomplete` и `inputmode`.
29
+ * @property mask Маска ввода с настройками форматирования.
30
+ */
31
+ export type TextInputInitConfig<ComponentType extends Componentable = TextInput, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends TextInputProperties = TextInputProperties> = {
32
+ placeholder?: string;
33
+ kind?: TextInputKind;
34
+ mask?: InputMaskProperties;
35
+ } & InputInitConfig<string, ComponentType, RefType, PropertiesType>;
36
+ type DefaultInitConfigType<RefType extends ContextRef<any, any>> = TextInputInitConfig<TextInput, RefType>;
37
+ export declare function textInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): TextInput<RefType>;
38
+ export declare function textInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(ref: DefaultInitConfigType<RefType>["ref"]): TextInput<RefType>;
39
+ export declare function textInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: TextInputInitConfig<any, RefType>): TextInput<RefType>;
40
+ /**
41
+ * Компонент ввода текста.
42
+ */
43
+ export declare class TextInput<RefType extends ContextRef<any, any> = ContextRef<any, any>, InitConfigType extends TextInputInitConfig<any, RefType> = DefaultInitConfigType<RefType>, PropertiesType extends TextInputProperties = TextInputProperties> extends InputComponent<InitConfigType, PropertiesType> {
44
+ constructor(config: TextInputInitConfig<any, RefType>);
45
+ protected class(): ServerComponentClass;
46
+ protected initProperties(initValues: InitConfigType): PropertiesType;
47
+ }
48
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextInput = void 0;
4
+ exports.textInput = textInput;
5
+ const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
6
+ const core_1 = require("../../core");
7
+ const input_component_1 = require("./input-component");
8
+ function textInput(arg0, arg1) {
9
+ if (arg1 !== undefined) {
10
+ return new TextInput({
11
+ ...arg0,
12
+ ref: arg1,
13
+ });
14
+ }
15
+ const single = arg0;
16
+ if (single instanceof core_1.ContextRef) {
17
+ return new TextInput({ ref: single });
18
+ }
19
+ return new TextInput(single);
20
+ }
21
+ /**
22
+ * Компонент ввода текста.
23
+ */
24
+ class TextInput extends input_component_1.InputComponent {
25
+ constructor(config) {
26
+ super(config);
27
+ }
28
+ class() {
29
+ return server_component_class_1.ServerComponentClass.TextInput;
30
+ }
31
+ initProperties(initValues) {
32
+ return {
33
+ ...super.initProperties(initValues),
34
+ placeholder: initValues.placeholder,
35
+ mask: initValues.mask,
36
+ kind: initValues.kind,
37
+ };
38
+ }
39
+ }
40
+ exports.TextInput = TextInput;
@@ -0,0 +1,36 @@
1
+ import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
+ import { TextareaResize } from "@matreshka/shared/enums/textarea-resize";
3
+ import { Componentable, ContextRef } from "../../core";
4
+ import { InputComponent, InputInitConfig, InputProperties } from "./input-component";
5
+ export type TextareaProperties = {
6
+ placeholder?: string;
7
+ rows?: number;
8
+ resize?: TextareaResize;
9
+ } & InputProperties;
10
+ /**
11
+ * Конфигурация инициализации компонента textarea.
12
+ *
13
+ * @property placeholder Текст-заполнитель, отображаемый в пустом поле.
14
+ * @property rows Количество видимых строк textarea.
15
+ * @property resize Режим изменения размера textarea.
16
+ */
17
+ export type TextareaInitConfig<ComponentType extends Componentable = Textarea, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends TextareaProperties = TextareaProperties> = {
18
+ placeholder?: string;
19
+ rows?: number;
20
+ resize?: TextareaResize;
21
+ } & InputInitConfig<string, ComponentType, RefType, PropertiesType>;
22
+ type DefaultInitConfigType<RefType extends ContextRef<any, any>> = TextareaInitConfig<Textarea, RefType>;
23
+ export declare function textarea<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): Textarea<RefType>;
24
+ export declare function textarea<RefType extends ContextRef<any, any> = ContextRef<any, any>>(ref: DefaultInitConfigType<RefType>["ref"]): Textarea<RefType>;
25
+ export declare function textarea<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: TextareaInitConfig<any, RefType>): Textarea<RefType>;
26
+ /**
27
+ * Компонент многострочного текстового ввода (textarea).
28
+ *
29
+ * Наследует поведение от {@link InputComponent}.
30
+ */
31
+ export declare class Textarea<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends TextareaProperties = TextareaProperties> extends InputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
32
+ constructor(config: DefaultInitConfigType<RefType>);
33
+ protected class(): ServerComponentClass;
34
+ protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
35
+ }
36
+ export {};
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Textarea = void 0;
4
+ exports.textarea = textarea;
5
+ const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
6
+ const core_1 = require("../../core");
7
+ const input_component_1 = require("./input-component");
8
+ function textarea(arg0, arg1) {
9
+ if (arg1 !== undefined) {
10
+ return new Textarea({
11
+ ...arg0,
12
+ ref: arg1,
13
+ });
14
+ }
15
+ const single = arg0;
16
+ if (single instanceof core_1.ContextRef) {
17
+ return new Textarea({ ref: single });
18
+ }
19
+ return new Textarea(single);
20
+ }
21
+ /**
22
+ * Компонент многострочного текстового ввода (textarea).
23
+ *
24
+ * Наследует поведение от {@link InputComponent}.
25
+ */
26
+ class Textarea extends input_component_1.InputComponent {
27
+ constructor(config) {
28
+ super(config);
29
+ }
30
+ class() {
31
+ return server_component_class_1.ServerComponentClass.Textarea;
32
+ }
33
+ initProperties(initValues) {
34
+ return {
35
+ ...super.initProperties(initValues),
36
+ placeholder: initValues.placeholder,
37
+ rows: initValues.rows,
38
+ resize: initValues.resize,
39
+ };
40
+ }
41
+ }
42
+ exports.Textarea = Textarea;
@@ -0,0 +1,11 @@
1
+ import type { ComponentInstance, ComponentTreeNode } from "../../core";
2
+ import type { ItemList } from "./item-list";
3
+ import type { NestedItemTreeNode } from "./types";
4
+ export declare function isItemList(value: unknown): value is ItemList<any, any>;
5
+ export declare function flattenNestedItems<TItem extends NestedItemTreeNode, TSerialized extends TItem & {
6
+ id: string;
7
+ component: import("@matreshka/shared/types/server-component-config").ServerComponentConfig;
8
+ }>(source: (TItem | ItemList<any, TItem>)[] | undefined, instance: ComponentInstance): TSerialized[];
9
+ export declare function collectNestedComponentsFromSource<TItem extends NestedItemTreeNode>(source: (TItem | ItemList<any, TItem>)[] | undefined): ComponentTreeNode[];
10
+ export declare function releaseItemListInstances(instances: ComponentInstance[]): void;
11
+ export declare function newItemListSegmentId(): string;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.isItemList = isItemList;
37
+ exports.flattenNestedItems = flattenNestedItems;
38
+ exports.collectNestedComponentsFromSource = collectNestedComponentsFromSource;
39
+ exports.releaseItemListInstances = releaseItemListInstances;
40
+ exports.newItemListSegmentId = newItemListSegmentId;
41
+ const crypto = __importStar(require("node:crypto"));
42
+ const core_1 = require("../../core");
43
+ const track_created_instances_1 = require("../../core/utils/track-created-instances");
44
+ function isItemList(value) {
45
+ return (typeof value === "object" &&
46
+ value !== null &&
47
+ value.isItemList === true);
48
+ }
49
+ function flattenNestedItems(source, instance) {
50
+ const result = [];
51
+ for (const entry of source ?? []) {
52
+ if (isItemList(entry)) {
53
+ result.push(...entry.buildItems(instance));
54
+ }
55
+ else {
56
+ result.push(serializeStaticNestedItem(entry, instance));
57
+ }
58
+ }
59
+ return result;
60
+ }
61
+ function serializeStaticNestedItem(entry, instance) {
62
+ return (0, core_1.runWithClient)(instance.client, () => (0, core_1.runWithEntryContext)(instance.entry, instance.client, () => {
63
+ const { result } = (0, track_created_instances_1.runWithCreatedInstanceTracking)(() => ({
64
+ ...entry,
65
+ id: entry.component.id,
66
+ component: entry.component.serialize(),
67
+ }));
68
+ return result;
69
+ }));
70
+ }
71
+ function collectNestedComponentsFromSource(source) {
72
+ const result = [];
73
+ for (const entry of source ?? []) {
74
+ if (isItemList(entry)) {
75
+ result.push(...entry.getNestedComponents());
76
+ }
77
+ else {
78
+ result.push(entry.component);
79
+ }
80
+ }
81
+ return result;
82
+ }
83
+ function releaseItemListInstances(instances) {
84
+ if (instances.length === 0) {
85
+ return;
86
+ }
87
+ const byComponent = new Map();
88
+ for (const instance of instances) {
89
+ const component = instance.component;
90
+ const list = byComponent.get(component) ?? [];
91
+ list.push(instance);
92
+ byComponent.set(component, list);
93
+ }
94
+ for (const [component, componentInstances] of byComponent) {
95
+ component.releaseInstances(componentInstances);
96
+ }
97
+ }
98
+ function newItemListSegmentId() {
99
+ return crypto.randomUUID();
100
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./flatten-nested-items";
2
+ export * from "./item-list";
3
+ export * from "./item-list-host";
4
+ export * from "./nested-items-host-support";
5
+ export * from "./types";