@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,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Form = void 0;
4
+ exports.form = form;
5
+ const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
6
+ const core_1 = require("../core");
7
+ const component_1 = require("./component");
8
+ function form(arg0, arg1) {
9
+ if (arg1 !== undefined) {
10
+ return new Form({
11
+ ...arg0,
12
+ content: arg1,
13
+ });
14
+ }
15
+ return new Form(arg0);
16
+ }
17
+ /**
18
+ * Компонент формы, содержащей вложенные компоненты и поддерживающей отправку.
19
+ * Перед инстансм необходимо убедиться, что внутри формы есть кнопка с type = submit,
20
+ * иначе обработка отправки формы не будет работать
21
+ *
22
+ * @template T Тип вложенных узлов дерева ({@link ComponentTreeNode}).
23
+ */
24
+ class Form extends component_1.Component {
25
+ /**
26
+ * Возвращает уникальный идентификатор класса компонента.
27
+ *
28
+ * @returns Строка "form".
29
+ */
30
+ class() {
31
+ return server_component_class_1.ServerComponentClass.Form;
32
+ }
33
+ /**
34
+ * Возвращает флаг, указывающий, что компонент является самостоятельным.
35
+ * @returns Всегда true.
36
+ */
37
+ standalone() {
38
+ return true;
39
+ }
40
+ /**
41
+ * Создает новый экземпляр формы.
42
+ *
43
+ * @param config Конфигурация инициализации формы.
44
+ *
45
+ * Компонент обеспечивает корректную работу сабмита по нажатию Enter и отображение
46
+ * клавиатуры с кнопкой отправки на мобильных устройствах.
47
+ *
48
+ * Убедитесь, что внутри формы присутствует кнопка с type=submit.
49
+ * Если кнопок нет — форма будет отправлена.
50
+ */
51
+ constructor(config) {
52
+ // Компонент нужен для корректной работы нажатия на Enter в форме и правильной клавиатуры на мобильных (с кнопкой сабмита)
53
+ // Убедитесь, что внутри формы существует кнопка с type=submit
54
+ // Логика сабмита передается в config.submit, при этом первая попавшаяся кнопка в форме, без указания type, считается тригерной (так работает и в обычном html form)
55
+ // Если кнопка disabled, то форма не сабмитится, если кнопок нет вообще, то форма сабмитится
56
+ super(config);
57
+ this.bindActions("submit", config.onSubmit);
58
+ }
59
+ /**
60
+ * Инициализирует свойства компонента.
61
+ *
62
+ * @param initValues Объект конфигурации инициализации.
63
+ * @returns Объект со свойствами компонента.
64
+ */
65
+ initProperties(initValues) {
66
+ return {
67
+ ...super.initProperties(initValues),
68
+ content: (0, core_1.calculateComponents)(initValues.content),
69
+ };
70
+ }
71
+ serializeRuleOverrides(overrides) {
72
+ return {
73
+ ...overrides,
74
+ content: overrides.content
75
+ ? (0, core_1.serializeComponentList)(overrides.content)
76
+ : undefined,
77
+ };
78
+ }
79
+ serialize() {
80
+ const result = super.serialize();
81
+ const p = this.properties;
82
+ return {
83
+ ...result,
84
+ class: server_component_class_1.ServerComponentClass.Form,
85
+ properties: {
86
+ ...p,
87
+ content: (0, core_1.serializeComponentList)(p.content),
88
+ },
89
+ };
90
+ }
91
+ }
92
+ exports.Form = Form;
@@ -0,0 +1,80 @@
1
+ import { GridColumnSize } from "@matreshka/shared/enums/grid-column-size";
2
+ import { GridTemplateColumns } from "@matreshka/shared/enums/grid-template-columns";
3
+ import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
4
+ import type { GridConfig } from "@matreshka/shared/types/grid-config";
5
+ import type { GridGap } from "@matreshka/shared/types/grid-gap";
6
+ import { type FlexItemSpec } from "@matreshka/shared/types/flex-item";
7
+ import { Componentable, ComponentTreeNode, StandaloneComponent } from "../core";
8
+ import { Component, ComponentInitConfig, ComponentProperties } from "./component";
9
+ import { ComponentSequence } from "./types/component-sequence";
10
+ type GridTemplateColumnValue = number | {
11
+ min: number;
12
+ max: number;
13
+ };
14
+ type GridTemplateColumnsValue = GridTemplateColumns | GridTemplateColumnValue | (GridColumnSize | number | {
15
+ min: number;
16
+ max: number;
17
+ })[];
18
+ export type GridProperties = {
19
+ content: ComponentSequence<unknown, ComponentTreeNode>;
20
+ /**
21
+ * Настройка столбцов: размер каждого столбца, либо {@link GridTemplateColumns.Subgrid}
22
+ * для наследования дорожек родительской grid.
23
+ */
24
+ columns: GridTemplateColumnsValue;
25
+ /**
26
+ * Промежуток между строками и столбцами (число) либо отдельные значения через объект.
27
+ */
28
+ gap?: GridGap;
29
+ /**
30
+ * Поведение flex-item внутри родительского stack: `{ grow }`, `{ basis }` или явные поля.
31
+ */
32
+ flexItem?: FlexItemSpec;
33
+ surface?: boolean;
34
+ } & ComponentProperties;
35
+ /**
36
+ * Конфигурация инициализации для компонента `Grid`.
37
+ *
38
+ * @property content Набор ячеек сетки.
39
+ * @property columns Настройка столбцов, для каждого столбца указывается его размер либо числом, либо диапазоном. Значения больше единицы будут конвертированы в rem, а меньше единицы в fr (аналог CSS grid-template-columns)
40
+ * @property gap Промежуток между элементами сетки: число или `{ row?, column? }`.
41
+ * @property flexItem Поведение flex-item внутри родительского stack.
42
+ * @property surface Фон контейнера
43
+ */
44
+ export type GridInitConfig<ComponentType extends Componentable = Grid, PropertiesType extends GridProperties = GridProperties> = {
45
+ content: ComponentSequence<unknown, ComponentTreeNode>;
46
+ columns: GridTemplateColumnsValue;
47
+ gap?: GridGap;
48
+ flexItem?: FlexItemSpec;
49
+ surface?: boolean;
50
+ } & ComponentInitConfig<ComponentType, PropertiesType>;
51
+ type DefaultGridInitConfigType = GridInitConfig<Grid>;
52
+ export declare function grid(options: Omit<DefaultGridInitConfigType, "content">, content: DefaultGridInitConfigType["content"]): Grid;
53
+ export declare function grid(config: DefaultGridInitConfigType): Grid;
54
+ /**
55
+ * Компонент сетки с произвольными standalone-дочерними элементами.
56
+ */
57
+ export declare class Grid<InitConfigType extends GridInitConfig<any> = DefaultGridInitConfigType, PropertiesType extends GridProperties = GridProperties> extends Component<InitConfigType, PropertiesType> implements StandaloneComponent {
58
+ /**
59
+ * Возвращает уникальный идентификатор класса компонента.
60
+ *
61
+ * @returns Строка `"grid"`.
62
+ */
63
+ protected class(): ServerComponentClass;
64
+ /**
65
+ * Указывает, что компонент является standalone.
66
+ *
67
+ * @returns Всегда true.
68
+ */
69
+ standalone(): true;
70
+ /**
71
+ * Инициализирует свойства компонента.
72
+ *
73
+ * @param initValues Объект конфигурации инициализации.
74
+ * @returns Объект со свойствами компонента.
75
+ */
76
+ protected initProperties(initValues: InitConfigType): PropertiesType;
77
+ protected serializeRuleOverrides(overrides: Partial<PropertiesType>): Record<string, unknown>;
78
+ serialize(): GridConfig;
79
+ }
80
+ export {};
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Grid = void 0;
4
+ exports.grid = grid;
5
+ const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
6
+ const flex_item_1 = require("@matreshka/shared/types/flex-item");
7
+ const core_1 = require("../core");
8
+ const component_1 = require("./component");
9
+ function grid(arg0, arg1) {
10
+ if (arg1 !== undefined) {
11
+ return new Grid({
12
+ ...arg0,
13
+ content: arg1,
14
+ });
15
+ }
16
+ return new Grid(arg0);
17
+ }
18
+ /**
19
+ * Компонент сетки с произвольными standalone-дочерними элементами.
20
+ */
21
+ class Grid extends component_1.Component {
22
+ /**
23
+ * Возвращает уникальный идентификатор класса компонента.
24
+ *
25
+ * @returns Строка `"grid"`.
26
+ */
27
+ class() {
28
+ return server_component_class_1.ServerComponentClass.Grid;
29
+ }
30
+ /**
31
+ * Указывает, что компонент является standalone.
32
+ *
33
+ * @returns Всегда true.
34
+ */
35
+ standalone() {
36
+ return true;
37
+ }
38
+ /**
39
+ * Инициализирует свойства компонента.
40
+ *
41
+ * @param initValues Объект конфигурации инициализации.
42
+ * @returns Объект со свойствами компонента.
43
+ */
44
+ initProperties(initValues) {
45
+ return {
46
+ ...super.initProperties(initValues),
47
+ content: (0, core_1.calculateComponents)(initValues.content),
48
+ columns: initValues.columns,
49
+ gap: initValues.gap,
50
+ flexItem: (0, flex_item_1.normalizeFlexItem)(initValues.flexItem),
51
+ surface: initValues.surface,
52
+ };
53
+ }
54
+ serializeRuleOverrides(overrides) {
55
+ const out = {
56
+ ...overrides,
57
+ content: overrides.content
58
+ ? (0, core_1.serializeComponentList)(overrides.content)
59
+ : undefined,
60
+ };
61
+ if (overrides.flexItem !== undefined) {
62
+ out.flexItem = (0, flex_item_1.normalizeFlexItem)(overrides.flexItem);
63
+ }
64
+ return out;
65
+ }
66
+ serialize() {
67
+ const result = super.serialize();
68
+ const p = this.properties;
69
+ return {
70
+ ...result,
71
+ class: server_component_class_1.ServerComponentClass.Grid,
72
+ properties: {
73
+ ...p,
74
+ content: (0, core_1.serializeComponentList)(p.content),
75
+ },
76
+ };
77
+ }
78
+ }
79
+ exports.Grid = Grid;
@@ -0,0 +1,55 @@
1
+ export * from "./actions/server-action";
2
+ export { OverlayAnchor } from "@matreshka/shared/types/container-overlay";
3
+ export * from "./aliases/button";
4
+ export * from "./aliases/column";
5
+ export * from "./aliases/row";
6
+ export * from "./aliases/surface";
7
+ export * from "./enum/password-input-kind";
8
+ export * from "./enum/popover-position-area";
9
+ export * from "./enum/text-input-kind";
10
+ export * from "./enum/textarea-resize";
11
+ export * from "./types/container-overlay";
12
+ export * from "./charts/bar-chart";
13
+ export * from "./charts/chart";
14
+ export * from "./charts/doughnut-chart";
15
+ export * from "./charts/line-chart";
16
+ export * from "./charts/pie-chart";
17
+ export * from "./charts/polar-area-chart";
18
+ export * from "./charts/radar-chart";
19
+ export * from "./page";
20
+ export * from "./dialog";
21
+ export * from "./file-upload-area";
22
+ export * from "./for-each";
23
+ export * from "./inputs/input-component";
24
+ export * from "./inputs/number-input";
25
+ export * from "./inputs/password-input";
26
+ export * from "./inputs/text-editor";
27
+ export * from "./inputs/text-input";
28
+ export * from "./inputs/textarea";
29
+ export * from "./outputs/currency";
30
+ export * from "./outputs/datetime";
31
+ export * from "./outputs/icon";
32
+ export * from "./outputs/iframe";
33
+ export * from "./outputs/image";
34
+ export * from "./outputs/vector";
35
+ export * from "./outputs/number";
36
+ export * from "./outputs/output-component";
37
+ export * from "./outputs/progress-bar";
38
+ export * from "./outputs/progress-spinner";
39
+ export * from "./outputs/qr-code";
40
+ export * from "./outputs/text";
41
+ export * from "./board";
42
+ export * from "./boot";
43
+ export * from "./camera";
44
+ export * from "./component";
45
+ export * from "./container";
46
+ export * from "./entry-component";
47
+ export * from "./form";
48
+ export * from "./grid";
49
+ export * from "./item-list";
50
+ export * from "./line";
51
+ export * from "./map";
52
+ export * from "./popover";
53
+ export * from "./stack";
54
+ export { needsMore, scrollDistanceToEnd, } from "@matreshka/shared/utils/needs-more";
55
+ export { isStandaloneComponentLike } from "./utils/component-factory-shared";
@@ -0,0 +1,76 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.isStandaloneComponentLike = exports.scrollDistanceToEnd = exports.needsMore = exports.OverlayAnchor = void 0;
18
+ __exportStar(require("./actions/server-action"), exports);
19
+ var container_overlay_1 = require("@matreshka/shared/types/container-overlay");
20
+ Object.defineProperty(exports, "OverlayAnchor", { enumerable: true, get: function () { return container_overlay_1.OverlayAnchor; } });
21
+ __exportStar(require("./aliases/button"), exports);
22
+ __exportStar(require("./aliases/column"), exports);
23
+ __exportStar(require("./aliases/row"), exports);
24
+ __exportStar(require("./aliases/surface"), exports);
25
+ __exportStar(require("./enum/password-input-kind"), exports);
26
+ __exportStar(require("./enum/popover-position-area"), exports);
27
+ __exportStar(require("./enum/text-input-kind"), exports);
28
+ __exportStar(require("./enum/textarea-resize"), exports);
29
+ __exportStar(require("./types/container-overlay"), exports);
30
+ __exportStar(require("./charts/bar-chart"), exports);
31
+ __exportStar(require("./charts/chart"), exports);
32
+ __exportStar(require("./charts/doughnut-chart"), exports);
33
+ __exportStar(require("./charts/line-chart"), exports);
34
+ __exportStar(require("./charts/pie-chart"), exports);
35
+ __exportStar(require("./charts/polar-area-chart"), exports);
36
+ __exportStar(require("./charts/radar-chart"), exports);
37
+ __exportStar(require("./page"), exports);
38
+ __exportStar(require("./dialog"), exports);
39
+ __exportStar(require("./file-upload-area"), exports);
40
+ __exportStar(require("./for-each"), exports);
41
+ __exportStar(require("./inputs/input-component"), exports);
42
+ __exportStar(require("./inputs/number-input"), exports);
43
+ __exportStar(require("./inputs/password-input"), exports);
44
+ __exportStar(require("./inputs/text-editor"), exports);
45
+ __exportStar(require("./inputs/text-input"), exports);
46
+ __exportStar(require("./inputs/textarea"), exports);
47
+ __exportStar(require("./outputs/currency"), exports);
48
+ __exportStar(require("./outputs/datetime"), exports);
49
+ __exportStar(require("./outputs/icon"), exports);
50
+ __exportStar(require("./outputs/iframe"), exports);
51
+ __exportStar(require("./outputs/image"), exports);
52
+ __exportStar(require("./outputs/vector"), exports);
53
+ __exportStar(require("./outputs/number"), exports);
54
+ __exportStar(require("./outputs/output-component"), exports);
55
+ __exportStar(require("./outputs/progress-bar"), exports);
56
+ __exportStar(require("./outputs/progress-spinner"), exports);
57
+ __exportStar(require("./outputs/qr-code"), exports);
58
+ __exportStar(require("./outputs/text"), exports);
59
+ __exportStar(require("./board"), exports);
60
+ __exportStar(require("./boot"), exports);
61
+ __exportStar(require("./camera"), exports);
62
+ __exportStar(require("./component"), exports);
63
+ __exportStar(require("./container"), exports);
64
+ __exportStar(require("./entry-component"), exports);
65
+ __exportStar(require("./form"), exports);
66
+ __exportStar(require("./grid"), exports);
67
+ __exportStar(require("./item-list"), exports);
68
+ __exportStar(require("./line"), exports);
69
+ __exportStar(require("./map"), exports);
70
+ __exportStar(require("./popover"), exports);
71
+ __exportStar(require("./stack"), exports);
72
+ var needs_more_1 = require("@matreshka/shared/utils/needs-more");
73
+ Object.defineProperty(exports, "needsMore", { enumerable: true, get: function () { return needs_more_1.needsMore; } });
74
+ Object.defineProperty(exports, "scrollDistanceToEnd", { enumerable: true, get: function () { return needs_more_1.scrollDistanceToEnd; } });
75
+ var component_factory_shared_1 = require("./utils/component-factory-shared");
76
+ Object.defineProperty(exports, "isStandaloneComponentLike", { enumerable: true, get: function () { return component_factory_shared_1.isStandaloneComponentLike; } });
@@ -0,0 +1,37 @@
1
+ import { Componentable, ContextRef, ContextRefValue, StandaloneComponent } from "../../core";
2
+ import { Component, ComponentInitConfig, ComponentProperties } from "../component";
3
+ /**
4
+ * Конфигурация инициализации компонента ввода.
5
+ * @property ref Ссылка в контексте.
6
+ */
7
+ export type CompatibleInputRef<ValueType, RefType extends ContextRef<any, any>> = ValueType extends ContextRefValue<RefType> ? RefType : never;
8
+ export type InputInitConfig<ValueType, ComponentType extends Componentable = InputComponent, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends InputProperties = InputProperties> = {
9
+ ref: CompatibleInputRef<ValueType, RefType>;
10
+ } & ComponentInitConfig<ComponentType, PropertiesType>;
11
+ /**
12
+ * Свойства компонента ввода.
13
+ * @property ref Ссылка в контексте.
14
+ */
15
+ export type InputProperties = {
16
+ ref: string;
17
+ } & ComponentProperties;
18
+ type DefaultInitConfigType<ValueType> = InputInitConfig<ValueType, InputComponent>;
19
+ /**
20
+ * Абстрактный базовый класс компонента ввода.
21
+ *
22
+ * @template InitConfigType Тип конфигурации инициализации.
23
+ */
24
+ export declare abstract class InputComponent<InitConfigType extends InputInitConfig<unknown, any> = DefaultInitConfigType<unknown>, PropertiesType extends InputProperties = InputProperties> extends Component<InitConfigType, PropertiesType> implements StandaloneComponent {
25
+ /**
26
+ * Возвращает признак, что компонент является самостоятельным.
27
+ * @returns Всегда true.
28
+ */
29
+ standalone(): true;
30
+ /**
31
+ * Инициализирует свойства компонента ввода.
32
+ * @param initValues Конфигурация инициализации.
33
+ * @returns Свойства компонента.
34
+ */
35
+ protected initProperties(initValues: InitConfigType): PropertiesType;
36
+ }
37
+ export {};
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InputComponent = void 0;
4
+ const component_1 = require("../component");
5
+ /**
6
+ * Абстрактный базовый класс компонента ввода.
7
+ *
8
+ * @template InitConfigType Тип конфигурации инициализации.
9
+ */
10
+ class InputComponent extends component_1.Component {
11
+ /**
12
+ * Возвращает признак, что компонент является самостоятельным.
13
+ * @returns Всегда true.
14
+ */
15
+ standalone() {
16
+ return true;
17
+ }
18
+ /**
19
+ * Инициализирует свойства компонента ввода.
20
+ * @param initValues Конфигурация инициализации.
21
+ * @returns Свойства компонента.
22
+ */
23
+ initProperties(initValues) {
24
+ return {
25
+ ...super.initProperties(initValues),
26
+ ref: initValues.ref,
27
+ };
28
+ }
29
+ }
30
+ exports.InputComponent = InputComponent;
@@ -0,0 +1,45 @@
1
+ import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
+ import { Componentable, ContextRef } from "../../core";
3
+ import { InputComponent, InputInitConfig, InputProperties } from "./input-component";
4
+ export type NumberInputProperties = {
5
+ placeholder?: string;
6
+ min?: number;
7
+ max?: number;
8
+ step?: number;
9
+ } & InputProperties;
10
+ /**
11
+ * Конфигурация инициализации компонента ввода числа.
12
+ */
13
+ export type NumberInputInitConfig<ComponentType extends Componentable = NumberInput, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends NumberInputProperties = NumberInputProperties> = {
14
+ /**
15
+ * Текст-заполнитель, отображаемый в поле ввода.
16
+ */
17
+ placeholder?: string;
18
+ /**
19
+ * Минимально допустимое значение.
20
+ */
21
+ min?: number;
22
+ /**
23
+ * Максимально допустимое значение.
24
+ */
25
+ max?: number;
26
+ /**
27
+ * Шаг изменения значения.
28
+ */
29
+ step?: number;
30
+ } & InputInitConfig<number, ComponentType, RefType, PropertiesType>;
31
+ type DefaultInitConfigType<RefType extends ContextRef<any, any>> = NumberInputInitConfig<NumberInput, RefType>;
32
+ export declare function numberInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): NumberInput<RefType>;
33
+ export declare function numberInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(ref: DefaultInitConfigType<RefType>["ref"]): NumberInput<RefType>;
34
+ export declare function numberInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: NumberInputInitConfig<any, RefType>): NumberInput<RefType>;
35
+ /**
36
+ * Компонент ввода числовых значений.
37
+ *
38
+ * Наследует функциональность от {@link InputComponent}.
39
+ */
40
+ export declare class NumberInput<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends NumberInputProperties = NumberInputProperties> extends InputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
41
+ constructor(config: DefaultInitConfigType<RefType>);
42
+ protected class(): ServerComponentClass;
43
+ protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
44
+ }
45
+ export {};
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NumberInput = void 0;
4
+ exports.numberInput = numberInput;
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 numberInput(arg0, arg1) {
9
+ if (arg1 !== undefined) {
10
+ return new NumberInput({
11
+ ...arg0,
12
+ ref: arg1,
13
+ });
14
+ }
15
+ const single = arg0;
16
+ if (single instanceof core_1.ContextRef) {
17
+ return new NumberInput({ ref: single });
18
+ }
19
+ return new NumberInput(single);
20
+ }
21
+ /**
22
+ * Компонент ввода числовых значений.
23
+ *
24
+ * Наследует функциональность от {@link InputComponent}.
25
+ */
26
+ class NumberInput extends input_component_1.InputComponent {
27
+ constructor(config) {
28
+ super(config);
29
+ }
30
+ class() {
31
+ return server_component_class_1.ServerComponentClass.NumberInput;
32
+ }
33
+ initProperties(initValues) {
34
+ return {
35
+ ...super.initProperties(initValues),
36
+ placeholder: initValues.placeholder,
37
+ min: initValues.min,
38
+ max: initValues.max,
39
+ step: initValues.step,
40
+ };
41
+ }
42
+ }
43
+ exports.NumberInput = NumberInput;
@@ -0,0 +1,28 @@
1
+ import { PasswordInputKind } from "@matreshka/shared/enums/password-input-kind";
2
+ import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
3
+ import { Componentable, ContextRef } from "../../core";
4
+ import { InputComponent, InputInitConfig, InputProperties } from "./input-component";
5
+ export type PasswordInputProperties = {
6
+ placeholder?: string;
7
+ kind?: PasswordInputKind;
8
+ } & InputProperties;
9
+ export type PasswordInputInitConfig<ComponentType extends Componentable = PasswordInput, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends PasswordInputProperties = PasswordInputProperties> = {
10
+ placeholder?: string;
11
+ kind?: PasswordInputKind;
12
+ } & InputInitConfig<string, ComponentType, RefType, PropertiesType>;
13
+ type DefaultInitConfigType<RefType extends ContextRef<any, any>> = PasswordInputInitConfig<PasswordInput, RefType>;
14
+ export declare function passwordInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): PasswordInput<RefType>;
15
+ export declare function passwordInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(ref: DefaultInitConfigType<RefType>["ref"]): PasswordInput<RefType>;
16
+ export declare function passwordInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: PasswordInputInitConfig<any, RefType>): PasswordInput<RefType>;
17
+ /**
18
+ * Компонент ввода пароля.
19
+ *
20
+ * @property kind Семантический вид автозаполнения пароля.
21
+ * Наследует функциональность от {@link InputComponent}.
22
+ */
23
+ export declare class PasswordInput<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends PasswordInputProperties = PasswordInputProperties> extends InputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
24
+ constructor(config: DefaultInitConfigType<RefType>);
25
+ protected class(): ServerComponentClass;
26
+ protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
27
+ }
28
+ export {};
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PasswordInput = void 0;
4
+ exports.passwordInput = passwordInput;
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 passwordInput(arg0, arg1) {
9
+ if (arg1 !== undefined) {
10
+ return new PasswordInput({
11
+ ...arg0,
12
+ ref: arg1,
13
+ });
14
+ }
15
+ const single = arg0;
16
+ if (single instanceof core_1.ContextRef) {
17
+ return new PasswordInput({ ref: single });
18
+ }
19
+ return new PasswordInput(single);
20
+ }
21
+ /**
22
+ * Компонент ввода пароля.
23
+ *
24
+ * @property kind Семантический вид автозаполнения пароля.
25
+ * Наследует функциональность от {@link InputComponent}.
26
+ */
27
+ class PasswordInput extends input_component_1.InputComponent {
28
+ constructor(config) {
29
+ super(config);
30
+ }
31
+ class() {
32
+ return server_component_class_1.ServerComponentClass.Password;
33
+ }
34
+ initProperties(initValues) {
35
+ return {
36
+ ...super.initProperties(initValues),
37
+ placeholder: initValues.placeholder,
38
+ kind: initValues.kind,
39
+ };
40
+ }
41
+ }
42
+ exports.PasswordInput = PasswordInput;