@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,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContextValueUndefined = void 0;
4
+ exports.contextValueUndefined = contextValueUndefined;
5
+ const condition_type_1 = require("@matreshka/shared/enums/condition-type");
6
+ const condition_1 = require("./condition");
7
+ /**
8
+ * Условие, означающее, что значение в контексте по заданному ключу не определено.
9
+ *
10
+ * @internal Используйте {@link contextValueUndefined} / {@link when.notDefined}.
11
+ */
12
+ class ContextValueUndefined extends condition_1.Condition {
13
+ constructor(ref) {
14
+ super(condition_type_1.ConditionType.ContextValueUndefined, { ref });
15
+ }
16
+ }
17
+ exports.ContextValueUndefined = ContextValueUndefined;
18
+ /** Функциональная форма {@link ContextValueUndefined}. */
19
+ function contextValueUndefined(ref) {
20
+ return new ContextValueUndefined(ref);
21
+ }
@@ -0,0 +1,11 @@
1
+ import { Condition } from "./condition";
2
+ /**
3
+ * Условие: устройство клиента — десктоп.
4
+ *
5
+ * @internal Используйте {@link desktopDevice} / {@link device.desktop}.
6
+ */
7
+ export declare class DesktopDevice extends Condition {
8
+ constructor();
9
+ }
10
+ /** Функциональная форма {@link DesktopDevice}. */
11
+ export declare function desktopDevice(): DesktopDevice;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DesktopDevice = void 0;
4
+ exports.desktopDevice = desktopDevice;
5
+ const condition_type_1 = require("@matreshka/shared/enums/condition-type");
6
+ const condition_1 = require("./condition");
7
+ /**
8
+ * Условие: устройство клиента — десктоп.
9
+ *
10
+ * @internal Используйте {@link desktopDevice} / {@link device.desktop}.
11
+ */
12
+ class DesktopDevice extends condition_1.Condition {
13
+ constructor() {
14
+ super(condition_type_1.ConditionType.DesktopDevice);
15
+ }
16
+ }
17
+ exports.DesktopDevice = DesktopDevice;
18
+ /** Функциональная форма {@link DesktopDevice}. */
19
+ function desktopDevice() {
20
+ return new DesktopDevice();
21
+ }
@@ -0,0 +1,71 @@
1
+ import { conditionAll, conditionAny } from "./condition-group";
2
+ import { contextArrayIncludes, contextArrayNotIncludes } from "./context-array-includes";
3
+ import { contextArrayLengthEqual, contextArrayLengthGreaterOrEqual, contextArrayLengthGreaterThan, contextArrayLengthLessOrEqual, contextArrayLengthLessThan, contextValueEmpty, contextValueNotEmpty } from "./context-array-length";
4
+ import { contextValueDefined } from "./context-value-defined";
5
+ import { contextValueEqual } from "./context-value-equal";
6
+ import { contextValueIn } from "./context-value-in";
7
+ import { contextValueNotEqual } from "./context-value-not-equal";
8
+ import { contextValueUndefined } from "./context-value-undefined";
9
+ import { desktopDevice } from "./desktop-device";
10
+ import { mobileDevice } from "./mobile-device";
11
+ import { notDesktopDevice } from "./not-desktop-device";
12
+ import { notMobileDevice } from "./not-mobile-device";
13
+ import { notTabletDevice } from "./not-tablet-device";
14
+ import { tabletDevice } from "./tablet-device";
15
+ /**
16
+ * Условия по значению/массиву в контексте.
17
+ *
18
+ * Первый аргумент каждого условия — строго типизированный `ContextRef`, поэтому
19
+ * контекст ясен из вызова, а имя несёт только предикат: `when.equals(ref, value)`.
20
+ */
21
+ export declare const when: {
22
+ /** Значение по `ref` строго равно операнду. */
23
+ readonly equals: typeof contextValueEqual;
24
+ /** Значение по `ref` не равно операнду. */
25
+ readonly notEquals: typeof contextValueNotEqual;
26
+ /** Значение по `ref` входит в список операндов. */
27
+ readonly oneOf: typeof contextValueIn;
28
+ /** Значение по `ref` определено (`!== undefined`). */
29
+ readonly defined: typeof contextValueDefined;
30
+ /** Значение по `ref` не определено (`=== undefined`). */
31
+ readonly notDefined: typeof contextValueUndefined;
32
+ /** Массив по `ref` пуст (длина `=== 0`). */
33
+ readonly isEmpty: typeof contextValueEmpty;
34
+ /** Массив по `ref` непуст (длина `> 0`). */
35
+ readonly notEmpty: typeof contextValueNotEmpty;
36
+ /** Длина массива по `ref` равна операнду (`===`). */
37
+ readonly lengthEquals: typeof contextArrayLengthEqual;
38
+ /** Длина массива по `ref` строго меньше операнда (`<`). */
39
+ readonly lengthLessThan: typeof contextArrayLengthLessThan;
40
+ /** Длина массива по `ref` меньше или равна операнду (`<=`). */
41
+ readonly lengthAtMost: typeof contextArrayLengthLessOrEqual;
42
+ /** Длина массива по `ref` строго больше операнда (`>`). */
43
+ readonly lengthGreaterThan: typeof contextArrayLengthGreaterThan;
44
+ /** Длина массива по `ref` больше или равна операнду (`>=`). */
45
+ readonly lengthAtLeast: typeof contextArrayLengthGreaterOrEqual;
46
+ /** В массиве по `ref` есть элемент со значением по `itemPath`, равным операнду. */
47
+ readonly includes: typeof contextArrayIncludes;
48
+ /** В массиве по `ref` нет элемента со значением по `itemPath`, равным операнду. */
49
+ readonly excludes: typeof contextArrayNotIncludes;
50
+ /** Хотя бы одно из условий (OR). */
51
+ readonly any: typeof conditionAny;
52
+ /** Все условия (AND) — явная группа, удобна внутри {@link conditionAny}. */
53
+ readonly all: typeof conditionAll;
54
+ };
55
+ /**
56
+ * Условия по типу устройства клиента. Операндов нет — зависят только от устройства.
57
+ */
58
+ export declare const device: {
59
+ /** Устройство — мобильный телефон. */
60
+ readonly mobile: typeof mobileDevice;
61
+ /** Устройство — планшет. */
62
+ readonly tablet: typeof tabletDevice;
63
+ /** Устройство — десктоп. */
64
+ readonly desktop: typeof desktopDevice;
65
+ /** Устройство не мобильный телефон. */
66
+ readonly notMobile: typeof notMobileDevice;
67
+ /** Устройство не планшет. */
68
+ readonly notTablet: typeof notTabletDevice;
69
+ /** Устройство не десктоп. */
70
+ readonly notDesktop: typeof notDesktopDevice;
71
+ };
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.device = exports.when = void 0;
4
+ const condition_group_1 = require("./condition-group");
5
+ const context_array_includes_1 = require("./context-array-includes");
6
+ const context_array_length_1 = require("./context-array-length");
7
+ const context_value_defined_1 = require("./context-value-defined");
8
+ const context_value_equal_1 = require("./context-value-equal");
9
+ const context_value_in_1 = require("./context-value-in");
10
+ const context_value_not_equal_1 = require("./context-value-not-equal");
11
+ const context_value_undefined_1 = require("./context-value-undefined");
12
+ const desktop_device_1 = require("./desktop-device");
13
+ const mobile_device_1 = require("./mobile-device");
14
+ const not_desktop_device_1 = require("./not-desktop-device");
15
+ const not_mobile_device_1 = require("./not-mobile-device");
16
+ const not_tablet_device_1 = require("./not-tablet-device");
17
+ const tablet_device_1 = require("./tablet-device");
18
+ /**
19
+ * Условия по значению/массиву в контексте.
20
+ *
21
+ * Первый аргумент каждого условия — строго типизированный `ContextRef`, поэтому
22
+ * контекст ясен из вызова, а имя несёт только предикат: `when.equals(ref, value)`.
23
+ */
24
+ exports.when = {
25
+ /** Значение по `ref` строго равно операнду. */
26
+ equals: context_value_equal_1.contextValueEqual,
27
+ /** Значение по `ref` не равно операнду. */
28
+ notEquals: context_value_not_equal_1.contextValueNotEqual,
29
+ /** Значение по `ref` входит в список операндов. */
30
+ oneOf: context_value_in_1.contextValueIn,
31
+ /** Значение по `ref` определено (`!== undefined`). */
32
+ defined: context_value_defined_1.contextValueDefined,
33
+ /** Значение по `ref` не определено (`=== undefined`). */
34
+ notDefined: context_value_undefined_1.contextValueUndefined,
35
+ /** Массив по `ref` пуст (длина `=== 0`). */
36
+ isEmpty: context_array_length_1.contextValueEmpty,
37
+ /** Массив по `ref` непуст (длина `> 0`). */
38
+ notEmpty: context_array_length_1.contextValueNotEmpty,
39
+ /** Длина массива по `ref` равна операнду (`===`). */
40
+ lengthEquals: context_array_length_1.contextArrayLengthEqual,
41
+ /** Длина массива по `ref` строго меньше операнда (`<`). */
42
+ lengthLessThan: context_array_length_1.contextArrayLengthLessThan,
43
+ /** Длина массива по `ref` меньше или равна операнду (`<=`). */
44
+ lengthAtMost: context_array_length_1.contextArrayLengthLessOrEqual,
45
+ /** Длина массива по `ref` строго больше операнда (`>`). */
46
+ lengthGreaterThan: context_array_length_1.contextArrayLengthGreaterThan,
47
+ /** Длина массива по `ref` больше или равна операнду (`>=`). */
48
+ lengthAtLeast: context_array_length_1.contextArrayLengthGreaterOrEqual,
49
+ /** В массиве по `ref` есть элемент со значением по `itemPath`, равным операнду. */
50
+ includes: context_array_includes_1.contextArrayIncludes,
51
+ /** В массиве по `ref` нет элемента со значением по `itemPath`, равным операнду. */
52
+ excludes: context_array_includes_1.contextArrayNotIncludes,
53
+ /** Хотя бы одно из условий (OR). */
54
+ any: condition_group_1.conditionAny,
55
+ /** Все условия (AND) — явная группа, удобна внутри {@link conditionAny}. */
56
+ all: condition_group_1.conditionAll,
57
+ };
58
+ /**
59
+ * Условия по типу устройства клиента. Операндов нет — зависят только от устройства.
60
+ */
61
+ exports.device = {
62
+ /** Устройство — мобильный телефон. */
63
+ mobile: mobile_device_1.mobileDevice,
64
+ /** Устройство — планшет. */
65
+ tablet: tablet_device_1.tabletDevice,
66
+ /** Устройство — десктоп. */
67
+ desktop: desktop_device_1.desktopDevice,
68
+ /** Устройство не мобильный телефон. */
69
+ notMobile: not_mobile_device_1.notMobileDevice,
70
+ /** Устройство не планшет. */
71
+ notTablet: not_tablet_device_1.notTabletDevice,
72
+ /** Устройство не десктоп. */
73
+ notDesktop: not_desktop_device_1.notDesktopDevice,
74
+ };
@@ -0,0 +1,17 @@
1
+ export * from "./condition";
2
+ export * from "./condition-group";
3
+ export * from "./condition-operand";
4
+ export * from "./context-array-includes";
5
+ export * from "./context-array-length";
6
+ export * from "./context-value-defined";
7
+ export * from "./context-value-equal";
8
+ export * from "./context-value-in";
9
+ export * from "./context-value-not-equal";
10
+ export * from "./context-value-undefined";
11
+ export * from "./desktop-device";
12
+ export * from "./mobile-device";
13
+ export * from "./not-desktop-device";
14
+ export * from "./not-mobile-device";
15
+ export * from "./not-tablet-device";
16
+ export * from "./tablet-device";
17
+ export * from "./groups";
@@ -0,0 +1,33 @@
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
+ __exportStar(require("./condition"), exports);
18
+ __exportStar(require("./condition-group"), exports);
19
+ __exportStar(require("./condition-operand"), exports);
20
+ __exportStar(require("./context-array-includes"), exports);
21
+ __exportStar(require("./context-array-length"), exports);
22
+ __exportStar(require("./context-value-defined"), exports);
23
+ __exportStar(require("./context-value-equal"), exports);
24
+ __exportStar(require("./context-value-in"), exports);
25
+ __exportStar(require("./context-value-not-equal"), exports);
26
+ __exportStar(require("./context-value-undefined"), exports);
27
+ __exportStar(require("./desktop-device"), exports);
28
+ __exportStar(require("./mobile-device"), exports);
29
+ __exportStar(require("./not-desktop-device"), exports);
30
+ __exportStar(require("./not-mobile-device"), exports);
31
+ __exportStar(require("./not-tablet-device"), exports);
32
+ __exportStar(require("./tablet-device"), exports);
33
+ __exportStar(require("./groups"), exports);
@@ -0,0 +1,11 @@
1
+ import { Condition } from "./condition";
2
+ /**
3
+ * Условие: устройство клиента — мобильный телефон.
4
+ *
5
+ * @internal Используйте {@link mobileDevice} / {@link device.mobile}.
6
+ */
7
+ export declare class MobileDevice extends Condition {
8
+ constructor();
9
+ }
10
+ /** Функциональная форма {@link MobileDevice}. */
11
+ export declare function mobileDevice(): MobileDevice;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MobileDevice = void 0;
4
+ exports.mobileDevice = mobileDevice;
5
+ const condition_type_1 = require("@matreshka/shared/enums/condition-type");
6
+ const condition_1 = require("./condition");
7
+ /**
8
+ * Условие: устройство клиента — мобильный телефон.
9
+ *
10
+ * @internal Используйте {@link mobileDevice} / {@link device.mobile}.
11
+ */
12
+ class MobileDevice extends condition_1.Condition {
13
+ constructor() {
14
+ super(condition_type_1.ConditionType.MobileDevice);
15
+ }
16
+ }
17
+ exports.MobileDevice = MobileDevice;
18
+ /** Функциональная форма {@link MobileDevice}. */
19
+ function mobileDevice() {
20
+ return new MobileDevice();
21
+ }
@@ -0,0 +1,11 @@
1
+ import { Condition } from "./condition";
2
+ /**
3
+ * Условие: устройство клиента не десктоп.
4
+ *
5
+ * @internal Используйте {@link notDesktopDevice} / {@link device.notDesktop}.
6
+ */
7
+ export declare class NotDesktopDevice extends Condition {
8
+ constructor();
9
+ }
10
+ /** Функциональная форма {@link NotDesktopDevice}. */
11
+ export declare function notDesktopDevice(): NotDesktopDevice;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotDesktopDevice = void 0;
4
+ exports.notDesktopDevice = notDesktopDevice;
5
+ const condition_type_1 = require("@matreshka/shared/enums/condition-type");
6
+ const condition_1 = require("./condition");
7
+ /**
8
+ * Условие: устройство клиента не десктоп.
9
+ *
10
+ * @internal Используйте {@link notDesktopDevice} / {@link device.notDesktop}.
11
+ */
12
+ class NotDesktopDevice extends condition_1.Condition {
13
+ constructor() {
14
+ super(condition_type_1.ConditionType.NotDesktopDevice);
15
+ }
16
+ }
17
+ exports.NotDesktopDevice = NotDesktopDevice;
18
+ /** Функциональная форма {@link NotDesktopDevice}. */
19
+ function notDesktopDevice() {
20
+ return new NotDesktopDevice();
21
+ }
@@ -0,0 +1,11 @@
1
+ import { Condition } from "./condition";
2
+ /**
3
+ * Условие: устройство клиента не мобильный телефон.
4
+ *
5
+ * @internal Используйте {@link notMobileDevice} / {@link device.notMobile}.
6
+ */
7
+ export declare class NotMobileDevice extends Condition {
8
+ constructor();
9
+ }
10
+ /** Функциональная форма {@link NotMobileDevice}. */
11
+ export declare function notMobileDevice(): NotMobileDevice;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotMobileDevice = void 0;
4
+ exports.notMobileDevice = notMobileDevice;
5
+ const condition_type_1 = require("@matreshka/shared/enums/condition-type");
6
+ const condition_1 = require("./condition");
7
+ /**
8
+ * Условие: устройство клиента не мобильный телефон.
9
+ *
10
+ * @internal Используйте {@link notMobileDevice} / {@link device.notMobile}.
11
+ */
12
+ class NotMobileDevice extends condition_1.Condition {
13
+ constructor() {
14
+ super(condition_type_1.ConditionType.NotMobileDevice);
15
+ }
16
+ }
17
+ exports.NotMobileDevice = NotMobileDevice;
18
+ /** Функциональная форма {@link NotMobileDevice}. */
19
+ function notMobileDevice() {
20
+ return new NotMobileDevice();
21
+ }
@@ -0,0 +1,11 @@
1
+ import { Condition } from "./condition";
2
+ /**
3
+ * Условие: устройство клиента не планшет.
4
+ *
5
+ * @internal Используйте {@link notTabletDevice} / {@link device.notTablet}.
6
+ */
7
+ export declare class NotTabletDevice extends Condition {
8
+ constructor();
9
+ }
10
+ /** Функциональная форма {@link NotTabletDevice}. */
11
+ export declare function notTabletDevice(): NotTabletDevice;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotTabletDevice = void 0;
4
+ exports.notTabletDevice = notTabletDevice;
5
+ const condition_type_1 = require("@matreshka/shared/enums/condition-type");
6
+ const condition_1 = require("./condition");
7
+ /**
8
+ * Условие: устройство клиента не планшет.
9
+ *
10
+ * @internal Используйте {@link notTabletDevice} / {@link device.notTablet}.
11
+ */
12
+ class NotTabletDevice extends condition_1.Condition {
13
+ constructor() {
14
+ super(condition_type_1.ConditionType.NotTabletDevice);
15
+ }
16
+ }
17
+ exports.NotTabletDevice = NotTabletDevice;
18
+ /** Функциональная форма {@link NotTabletDevice}. */
19
+ function notTabletDevice() {
20
+ return new NotTabletDevice();
21
+ }
@@ -0,0 +1,11 @@
1
+ import { Condition } from "./condition";
2
+ /**
3
+ * Условие: устройство клиента — планшет.
4
+ *
5
+ * @internal Используйте {@link tabletDevice} / {@link device.tablet}.
6
+ */
7
+ export declare class TabletDevice extends Condition {
8
+ constructor();
9
+ }
10
+ /** Функциональная форма {@link TabletDevice}. */
11
+ export declare function tabletDevice(): TabletDevice;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TabletDevice = void 0;
4
+ exports.tabletDevice = tabletDevice;
5
+ const condition_type_1 = require("@matreshka/shared/enums/condition-type");
6
+ const condition_1 = require("./condition");
7
+ /**
8
+ * Условие: устройство клиента — планшет.
9
+ *
10
+ * @internal Используйте {@link tabletDevice} / {@link device.tablet}.
11
+ */
12
+ class TabletDevice extends condition_1.Condition {
13
+ constructor() {
14
+ super(condition_type_1.ConditionType.TabletDevice);
15
+ }
16
+ }
17
+ exports.TabletDevice = TabletDevice;
18
+ /** Функциональная форма {@link TabletDevice}. */
19
+ function tabletDevice() {
20
+ return new TabletDevice();
21
+ }
@@ -0,0 +1,48 @@
1
+ import { JsonObject } from "@matreshka/shared/types/json";
2
+ import { Paths, PathValue } from "ts-essentials";
3
+ import { Context } from "./context";
4
+ export type ContextRefValue<R extends ContextRef<any, any>> = R extends {
5
+ readonly __valueType?: infer ValueType;
6
+ } ? Exclude<ValueType, undefined> : R extends ContextRef<infer ContextType, infer PathType> ? PathValue<ContextType, PathType> : never;
7
+ export declare class ContextRef<ContextType extends JsonObject = any, PathType extends string = string> {
8
+ readonly context: Context<any>;
9
+ readonly path: PathType;
10
+ constructor(context: Context<any>, path: PathType);
11
+ /**
12
+ * Продолжение пути в рамках того же контекста.
13
+ * Строго типизировано: K должен быть путём внутри значения по текущему PathType.
14
+ */
15
+ ref<K extends Paths<PathValue<ContextType, PathType>>>(path: K): ContextRef<ContextType, `${PathType}.${K}`>;
16
+ /**
17
+ * Продолжение пути, если передан другой ContextRef того же контекста.
18
+ * В этом случае итоговый путь становится `${PathType}.${P2}`.
19
+ */
20
+ ref<P2 extends string>(path: ContextRef<ContextType, P2>): ContextRef<ContextType, `${PathType}.${P2}`>;
21
+ /**
22
+ * Дописывает к текущему пути **плейсхолдер** второго контекста: строку вида
23
+ * `@{<id контекста other>.<путь other>}` (через `other.toString()`), без подстановки
24
+ * значения на момент вызова.
25
+ *
26
+ * При каждом чтении `Context.value` подставляет в эту строку актуальное значение по
27
+ * ссылке `other` (тот же механизм, что и для обычных путей с плейсхолдерами).
28
+ * Если во втором контексте меняется строка-сегмент пути или индекс, одна и та же
29
+ * ссылка `ContextRef` продолжает указывать на корректные данные.
30
+ *
31
+ * По типам `other` ограничен путём во втором контексте (`Paths<OtherContextType>`),
32
+ * в отличие от склейки через обычный `ref` со строкой.
33
+ *
34
+ * Пример: текущий контекст `{ cards: { balance: number }[] }`, база `cards`; во
35
+ * втором контексте поле `segment` хранит строку `"1.balance"` (или `"0.balance"`).
36
+ * Тогда `this.context.ref("cards").strictRef(other.ref("segment"))` даёт хранимый
37
+ * путь с суффиксом-плейсхолдером; после резолва читается `cards.<индекс>.balance`.
38
+ *
39
+ * Для ссылки из **другого** экземпляра `Context` второй контекст должен быть известен
40
+ * рантайму (как и для любых `@{…}`), например через синхронизацию с клиентом.
41
+ *
42
+ * @experimental
43
+ */
44
+ strictRef<OtherContextType extends JsonObject, OtherPathType extends Paths<OtherContextType>>(other: ContextRef<OtherContextType, OtherPathType>): ContextRef<ContextType, `${PathType}.${PathValue<OtherContextType, OtherPathType> & string}`>;
45
+ value(): PathValue<ContextType, PathType>;
46
+ toString(): string;
47
+ toJSON(): string;
48
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContextRef = void 0;
4
+ const client_context_1 = require("../client-context");
5
+ class ContextRef {
6
+ constructor(context, path) {
7
+ this.context = context;
8
+ this.path = path;
9
+ }
10
+ ref(path) {
11
+ if (path instanceof ContextRef) {
12
+ const fullPath = `${this.path}.${path.path}`;
13
+ return new ContextRef(this.context, fullPath);
14
+ }
15
+ const fullPath = `${this.path}.${path}`;
16
+ return new ContextRef(this.context, fullPath);
17
+ }
18
+ /**
19
+ * Дописывает к текущему пути **плейсхолдер** второго контекста: строку вида
20
+ * `@{<id контекста other>.<путь other>}` (через `other.toString()`), без подстановки
21
+ * значения на момент вызова.
22
+ *
23
+ * При каждом чтении `Context.value` подставляет в эту строку актуальное значение по
24
+ * ссылке `other` (тот же механизм, что и для обычных путей с плейсхолдерами).
25
+ * Если во втором контексте меняется строка-сегмент пути или индекс, одна и та же
26
+ * ссылка `ContextRef` продолжает указывать на корректные данные.
27
+ *
28
+ * По типам `other` ограничен путём во втором контексте (`Paths<OtherContextType>`),
29
+ * в отличие от склейки через обычный `ref` со строкой.
30
+ *
31
+ * Пример: текущий контекст `{ cards: { balance: number }[] }`, база `cards`; во
32
+ * втором контексте поле `segment` хранит строку `"1.balance"` (или `"0.balance"`).
33
+ * Тогда `this.context.ref("cards").strictRef(other.ref("segment"))` даёт хранимый
34
+ * путь с суффиксом-плейсхолдером; после резолва читается `cards.<индекс>.balance`.
35
+ *
36
+ * Для ссылки из **другого** экземпляра `Context` второй контекст должен быть известен
37
+ * рантайму (как и для любых `@{…}`), например через синхронизацию с клиентом.
38
+ *
39
+ * @experimental
40
+ */
41
+ strictRef(other) {
42
+ const fullPath = `${this.path}.${other.toString()}`;
43
+ return new ContextRef(this.context, fullPath);
44
+ }
45
+ // Строгое значение по текущему пути
46
+ value() {
47
+ // Явно выбираем перегрузку Context.value(string): unknown и приводим к ожидаемому типу
48
+ return this.context.value(this.path);
49
+ }
50
+ toString() {
51
+ return `@{${this.context.id}.${this.path}}`;
52
+ }
53
+ toJSON() {
54
+ this.context.authorizeClient((0, client_context_1.currentClient)());
55
+ return `${this.context.id}.${this.path}`;
56
+ }
57
+ }
58
+ exports.ContextRef = ContextRef;