@matreshka/bff 0.20.0 → 0.22.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.
- package/dist/components/board.d.ts +7 -0
- package/dist/components/board.js +7 -0
- package/dist/components/camera.d.ts +4 -0
- package/dist/components/camera.js +4 -0
- package/dist/components/component.d.ts +2 -1
- package/dist/components/dialog.d.ts +5 -0
- package/dist/components/dialog.js +8 -0
- package/dist/components/for-each.d.ts +3 -3
- package/dist/components/for-each.js +18 -26
- package/dist/components/inputs/text-editor.d.ts +17 -0
- package/dist/components/inputs/text-editor.js +17 -0
- package/dist/components/item-list/item-list.js +11 -11
- package/dist/components/item-list/list-from-ref-context.d.ts +4 -1
- package/dist/components/item-list/list-from-ref-context.js +6 -4
- package/dist/components/item-list/types.d.ts +5 -5
- package/dist/components/item-list/types.js +1 -1
- package/dist/components/map.d.ts +11 -0
- package/dist/components/map.js +7 -0
- package/dist/components/popover.d.ts +5 -0
- package/dist/components/popover.js +8 -0
- package/dist/components/stack.d.ts +4 -0
- package/dist/components/stack.js +4 -0
- package/dist/core/actions/close-entry.d.ts +15 -0
- package/dist/core/actions/close-entry.js +28 -0
- package/dist/core/actions/component-local-actions.d.ts +113 -0
- package/dist/core/actions/component-local-actions.js +274 -0
- package/dist/core/actions/dec-context-value.d.ts +21 -0
- package/dist/core/actions/dec-context-value.js +35 -0
- package/dist/core/actions/inc-context-value.d.ts +22 -0
- package/dist/core/actions/inc-context-value.js +35 -0
- package/dist/core/actions/local-action.d.ts +4 -0
- package/dist/core/actions/local-action.js +43 -0
- package/dist/core/actions/set-context.d.ts +20 -0
- package/dist/core/actions/set-context.js +33 -0
- package/dist/core/conditions/condition-operand.d.ts +5 -3
- package/dist/core/context/context-ref.d.ts +26 -4
- package/dist/core/context/context-ref.js +25 -8
- package/dist/core/context/context.d.ts +52 -10
- package/dist/core/context/context.js +87 -13
- package/dist/core/index.d.ts +3 -6
- package/dist/core/index.js +6 -6
- package/dist/core/local/index.d.ts +14 -0
- package/dist/core/local/index.js +18 -0
- package/dist/core/types/component-instance.d.ts +7 -0
- package/dist/core/types/component-instance.js +4 -0
- package/dist/core/types/context-value-ref.d.ts +5 -3
- package/dist/core/utils/replace-context-keys.js +1 -2
- package/package.json +2 -2
- package/dist/core/actions/set-context-value.d.ts +0 -21
- package/dist/core/actions/set-context-value.js +0 -34
- package/dist/core/actions/set-context-values.d.ts +0 -35
- package/dist/core/actions/set-context-values.js +0 -30
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { ScrollToPosition } from "@matreshka/shared/enums/scroll-to-position";
|
|
2
|
+
import type { BoardPoint } from "@matreshka/shared/types/board-config";
|
|
3
|
+
import type { VideoInputDevice } from "../../platforms/platform";
|
|
4
|
+
import type { Componentable } from "../types/componentable";
|
|
5
|
+
import type { ActionConfig } from "./action";
|
|
6
|
+
import { LocalAction } from "./local-action";
|
|
7
|
+
declare abstract class ComponentLocalAction extends LocalAction {
|
|
8
|
+
protected readonly component: Componentable;
|
|
9
|
+
constructor(component: Componentable, config?: ActionConfig);
|
|
10
|
+
protected targetPayload(): {
|
|
11
|
+
target: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare class MapSetCenterLocalAction extends ComponentLocalAction {
|
|
15
|
+
private readonly center;
|
|
16
|
+
constructor(component: Componentable, center: {
|
|
17
|
+
latitude: number;
|
|
18
|
+
longitude: number;
|
|
19
|
+
altitude?: number;
|
|
20
|
+
}, config?: ActionConfig);
|
|
21
|
+
class(): string;
|
|
22
|
+
payload(): object;
|
|
23
|
+
}
|
|
24
|
+
export declare function mapSetCenterLocal(component: Componentable, center: {
|
|
25
|
+
latitude: number;
|
|
26
|
+
longitude: number;
|
|
27
|
+
altitude?: number;
|
|
28
|
+
}, config?: ActionConfig): MapSetCenterLocalAction;
|
|
29
|
+
export declare class MapSetZoomLocalAction extends ComponentLocalAction {
|
|
30
|
+
private readonly zoom;
|
|
31
|
+
constructor(component: Componentable, zoom: number, config?: ActionConfig);
|
|
32
|
+
class(): string;
|
|
33
|
+
payload(): object;
|
|
34
|
+
}
|
|
35
|
+
export declare function mapSetZoomLocal(component: Componentable, zoom: number, config?: ActionConfig): MapSetZoomLocalAction;
|
|
36
|
+
export declare class MapZoomInLocalAction extends ComponentLocalAction {
|
|
37
|
+
class(): string;
|
|
38
|
+
payload(): object;
|
|
39
|
+
}
|
|
40
|
+
export declare function mapZoomInLocal(component: Componentable, config?: ActionConfig): MapZoomInLocalAction;
|
|
41
|
+
export declare class MapZoomOutLocalAction extends ComponentLocalAction {
|
|
42
|
+
class(): string;
|
|
43
|
+
payload(): object;
|
|
44
|
+
}
|
|
45
|
+
export declare function mapZoomOutLocal(component: Componentable, config?: ActionConfig): MapZoomOutLocalAction;
|
|
46
|
+
export declare class BoardSetCenterLocalAction extends ComponentLocalAction {
|
|
47
|
+
private readonly center;
|
|
48
|
+
constructor(component: Componentable, center: BoardPoint, config?: ActionConfig);
|
|
49
|
+
class(): string;
|
|
50
|
+
payload(): object;
|
|
51
|
+
}
|
|
52
|
+
export declare function boardSetCenterLocal(component: Componentable, center: BoardPoint, config?: ActionConfig): BoardSetCenterLocalAction;
|
|
53
|
+
export declare class BoardSetZoomLocalAction extends ComponentLocalAction {
|
|
54
|
+
private readonly zoom;
|
|
55
|
+
constructor(component: Componentable, zoom: number, config?: ActionConfig);
|
|
56
|
+
class(): string;
|
|
57
|
+
payload(): object;
|
|
58
|
+
}
|
|
59
|
+
export declare function boardSetZoomLocal(component: Componentable, zoom: number, config?: ActionConfig): BoardSetZoomLocalAction;
|
|
60
|
+
export declare class BoardZoomInLocalAction extends ComponentLocalAction {
|
|
61
|
+
class(): string;
|
|
62
|
+
payload(): object;
|
|
63
|
+
}
|
|
64
|
+
export declare function boardZoomInLocal(component: Componentable, config?: ActionConfig): BoardZoomInLocalAction;
|
|
65
|
+
export declare class BoardZoomOutLocalAction extends ComponentLocalAction {
|
|
66
|
+
class(): string;
|
|
67
|
+
payload(): object;
|
|
68
|
+
}
|
|
69
|
+
export declare function boardZoomOutLocal(component: Componentable, config?: ActionConfig): BoardZoomOutLocalAction;
|
|
70
|
+
export declare class ScrollToLocalAction extends ComponentLocalAction {
|
|
71
|
+
private readonly value;
|
|
72
|
+
private readonly smooth;
|
|
73
|
+
constructor(component: Componentable, value: number | ScrollToPosition, smooth: boolean, config?: ActionConfig);
|
|
74
|
+
class(): string;
|
|
75
|
+
payload(): object;
|
|
76
|
+
}
|
|
77
|
+
export declare function scrollToLocal(component: Componentable, value: number | ScrollToPosition, smooth?: boolean, config?: ActionConfig): ScrollToLocalAction;
|
|
78
|
+
export declare class CameraSwitchLocalAction extends ComponentLocalAction {
|
|
79
|
+
private readonly device;
|
|
80
|
+
constructor(component: Componentable, device: VideoInputDevice, config?: ActionConfig);
|
|
81
|
+
class(): string;
|
|
82
|
+
payload(): object;
|
|
83
|
+
}
|
|
84
|
+
export declare function cameraSwitchLocal(component: Componentable, device: VideoInputDevice, config?: ActionConfig): CameraSwitchLocalAction;
|
|
85
|
+
declare abstract class TextEditorLocalAction extends ComponentLocalAction {
|
|
86
|
+
}
|
|
87
|
+
export declare class TextEditorInsertHtmlLocalAction extends TextEditorLocalAction {
|
|
88
|
+
private readonly value;
|
|
89
|
+
constructor(component: Componentable, value: string, config?: ActionConfig);
|
|
90
|
+
class(): string;
|
|
91
|
+
payload(): object;
|
|
92
|
+
}
|
|
93
|
+
export declare function textEditorInsertHtmlLocal(component: Componentable, value: string, config?: ActionConfig): TextEditorInsertHtmlLocalAction;
|
|
94
|
+
export declare class TextEditorFormatBlockLocalAction extends TextEditorLocalAction {
|
|
95
|
+
private readonly tag;
|
|
96
|
+
constructor(component: Componentable, tag: string, config?: ActionConfig);
|
|
97
|
+
class(): string;
|
|
98
|
+
payload(): object;
|
|
99
|
+
}
|
|
100
|
+
export declare function textEditorFormatBlockLocal(component: Componentable, tag: string, config?: ActionConfig): TextEditorFormatBlockLocalAction;
|
|
101
|
+
export declare function textEditorToggleItalicLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
102
|
+
export declare function textEditorToggleBoldLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
103
|
+
export declare function textEditorToggleUnderlineLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
104
|
+
export declare function textEditorUndoLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
105
|
+
export declare function textEditorRedoLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
106
|
+
export declare function textEditorSuperscriptLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
107
|
+
export declare function textEditorInsertOrderedListLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
108
|
+
export declare function textEditorInsertUnorderedListLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
109
|
+
export declare function textEditorJustifyLeftLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
110
|
+
export declare function textEditorJustifyCenterLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
111
|
+
export declare function textEditorJustifyRightLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
112
|
+
export declare function textEditorJustifyFullLocal(component: Componentable, config?: ActionConfig): LocalAction;
|
|
113
|
+
export {};
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextEditorFormatBlockLocalAction = exports.TextEditorInsertHtmlLocalAction = exports.CameraSwitchLocalAction = exports.ScrollToLocalAction = exports.BoardZoomOutLocalAction = exports.BoardZoomInLocalAction = exports.BoardSetZoomLocalAction = exports.BoardSetCenterLocalAction = exports.MapZoomOutLocalAction = exports.MapZoomInLocalAction = exports.MapSetZoomLocalAction = exports.MapSetCenterLocalAction = void 0;
|
|
4
|
+
exports.mapSetCenterLocal = mapSetCenterLocal;
|
|
5
|
+
exports.mapSetZoomLocal = mapSetZoomLocal;
|
|
6
|
+
exports.mapZoomInLocal = mapZoomInLocal;
|
|
7
|
+
exports.mapZoomOutLocal = mapZoomOutLocal;
|
|
8
|
+
exports.boardSetCenterLocal = boardSetCenterLocal;
|
|
9
|
+
exports.boardSetZoomLocal = boardSetZoomLocal;
|
|
10
|
+
exports.boardZoomInLocal = boardZoomInLocal;
|
|
11
|
+
exports.boardZoomOutLocal = boardZoomOutLocal;
|
|
12
|
+
exports.scrollToLocal = scrollToLocal;
|
|
13
|
+
exports.cameraSwitchLocal = cameraSwitchLocal;
|
|
14
|
+
exports.textEditorInsertHtmlLocal = textEditorInsertHtmlLocal;
|
|
15
|
+
exports.textEditorFormatBlockLocal = textEditorFormatBlockLocal;
|
|
16
|
+
exports.textEditorToggleItalicLocal = textEditorToggleItalicLocal;
|
|
17
|
+
exports.textEditorToggleBoldLocal = textEditorToggleBoldLocal;
|
|
18
|
+
exports.textEditorToggleUnderlineLocal = textEditorToggleUnderlineLocal;
|
|
19
|
+
exports.textEditorUndoLocal = textEditorUndoLocal;
|
|
20
|
+
exports.textEditorRedoLocal = textEditorRedoLocal;
|
|
21
|
+
exports.textEditorSuperscriptLocal = textEditorSuperscriptLocal;
|
|
22
|
+
exports.textEditorInsertOrderedListLocal = textEditorInsertOrderedListLocal;
|
|
23
|
+
exports.textEditorInsertUnorderedListLocal = textEditorInsertUnorderedListLocal;
|
|
24
|
+
exports.textEditorJustifyLeftLocal = textEditorJustifyLeftLocal;
|
|
25
|
+
exports.textEditorJustifyCenterLocal = textEditorJustifyCenterLocal;
|
|
26
|
+
exports.textEditorJustifyRightLocal = textEditorJustifyRightLocal;
|
|
27
|
+
exports.textEditorJustifyFullLocal = textEditorJustifyFullLocal;
|
|
28
|
+
const local_action_1 = require("./local-action");
|
|
29
|
+
class ComponentLocalAction extends local_action_1.LocalAction {
|
|
30
|
+
constructor(component, config = {}) {
|
|
31
|
+
super(config.conditions);
|
|
32
|
+
this.component = component;
|
|
33
|
+
}
|
|
34
|
+
targetPayload() {
|
|
35
|
+
return { target: this.component.id };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class MapSetCenterLocalAction extends ComponentLocalAction {
|
|
39
|
+
constructor(component, center, config) {
|
|
40
|
+
super(component, config);
|
|
41
|
+
this.center = center;
|
|
42
|
+
}
|
|
43
|
+
class() {
|
|
44
|
+
return "component-local-map-set-center";
|
|
45
|
+
}
|
|
46
|
+
payload() {
|
|
47
|
+
return { ...this.targetPayload(), ...this.center };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.MapSetCenterLocalAction = MapSetCenterLocalAction;
|
|
51
|
+
function mapSetCenterLocal(component, center, config) {
|
|
52
|
+
return new MapSetCenterLocalAction(component, center, config);
|
|
53
|
+
}
|
|
54
|
+
class MapSetZoomLocalAction extends ComponentLocalAction {
|
|
55
|
+
constructor(component, zoom, config) {
|
|
56
|
+
super(component, config);
|
|
57
|
+
this.zoom = zoom;
|
|
58
|
+
}
|
|
59
|
+
class() {
|
|
60
|
+
return "component-local-map-set-zoom";
|
|
61
|
+
}
|
|
62
|
+
payload() {
|
|
63
|
+
return { ...this.targetPayload(), zoom: this.zoom };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.MapSetZoomLocalAction = MapSetZoomLocalAction;
|
|
67
|
+
function mapSetZoomLocal(component, zoom, config) {
|
|
68
|
+
return new MapSetZoomLocalAction(component, zoom, config);
|
|
69
|
+
}
|
|
70
|
+
class MapZoomInLocalAction extends ComponentLocalAction {
|
|
71
|
+
class() {
|
|
72
|
+
return "component-local-map-zoom-in";
|
|
73
|
+
}
|
|
74
|
+
payload() {
|
|
75
|
+
return this.targetPayload();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.MapZoomInLocalAction = MapZoomInLocalAction;
|
|
79
|
+
function mapZoomInLocal(component, config) {
|
|
80
|
+
return new MapZoomInLocalAction(component, config);
|
|
81
|
+
}
|
|
82
|
+
class MapZoomOutLocalAction extends ComponentLocalAction {
|
|
83
|
+
class() {
|
|
84
|
+
return "component-local-map-zoom-out";
|
|
85
|
+
}
|
|
86
|
+
payload() {
|
|
87
|
+
return this.targetPayload();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.MapZoomOutLocalAction = MapZoomOutLocalAction;
|
|
91
|
+
function mapZoomOutLocal(component, config) {
|
|
92
|
+
return new MapZoomOutLocalAction(component, config);
|
|
93
|
+
}
|
|
94
|
+
class BoardSetCenterLocalAction extends ComponentLocalAction {
|
|
95
|
+
constructor(component, center, config) {
|
|
96
|
+
super(component, config);
|
|
97
|
+
this.center = center;
|
|
98
|
+
}
|
|
99
|
+
class() {
|
|
100
|
+
return "component-local-board-set-center";
|
|
101
|
+
}
|
|
102
|
+
payload() {
|
|
103
|
+
return { ...this.targetPayload(), ...this.center };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.BoardSetCenterLocalAction = BoardSetCenterLocalAction;
|
|
107
|
+
function boardSetCenterLocal(component, center, config) {
|
|
108
|
+
return new BoardSetCenterLocalAction(component, center, config);
|
|
109
|
+
}
|
|
110
|
+
class BoardSetZoomLocalAction extends ComponentLocalAction {
|
|
111
|
+
constructor(component, zoom, config) {
|
|
112
|
+
super(component, config);
|
|
113
|
+
this.zoom = zoom;
|
|
114
|
+
}
|
|
115
|
+
class() {
|
|
116
|
+
return "component-local-board-set-zoom";
|
|
117
|
+
}
|
|
118
|
+
payload() {
|
|
119
|
+
return { ...this.targetPayload(), zoom: this.zoom };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.BoardSetZoomLocalAction = BoardSetZoomLocalAction;
|
|
123
|
+
function boardSetZoomLocal(component, zoom, config) {
|
|
124
|
+
return new BoardSetZoomLocalAction(component, zoom, config);
|
|
125
|
+
}
|
|
126
|
+
class BoardZoomInLocalAction extends ComponentLocalAction {
|
|
127
|
+
class() {
|
|
128
|
+
return "component-local-board-zoom-in";
|
|
129
|
+
}
|
|
130
|
+
payload() {
|
|
131
|
+
return this.targetPayload();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.BoardZoomInLocalAction = BoardZoomInLocalAction;
|
|
135
|
+
function boardZoomInLocal(component, config) {
|
|
136
|
+
return new BoardZoomInLocalAction(component, config);
|
|
137
|
+
}
|
|
138
|
+
class BoardZoomOutLocalAction extends ComponentLocalAction {
|
|
139
|
+
class() {
|
|
140
|
+
return "component-local-board-zoom-out";
|
|
141
|
+
}
|
|
142
|
+
payload() {
|
|
143
|
+
return this.targetPayload();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.BoardZoomOutLocalAction = BoardZoomOutLocalAction;
|
|
147
|
+
function boardZoomOutLocal(component, config) {
|
|
148
|
+
return new BoardZoomOutLocalAction(component, config);
|
|
149
|
+
}
|
|
150
|
+
class ScrollToLocalAction extends ComponentLocalAction {
|
|
151
|
+
constructor(component, value, smooth, config) {
|
|
152
|
+
super(component, config);
|
|
153
|
+
this.value = value;
|
|
154
|
+
this.smooth = smooth;
|
|
155
|
+
}
|
|
156
|
+
class() {
|
|
157
|
+
return "component-local-stack-scroll-to";
|
|
158
|
+
}
|
|
159
|
+
payload() {
|
|
160
|
+
return {
|
|
161
|
+
...this.targetPayload(),
|
|
162
|
+
value: this.value,
|
|
163
|
+
smooth: this.smooth,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.ScrollToLocalAction = ScrollToLocalAction;
|
|
168
|
+
function scrollToLocal(component, value, smooth = false, config) {
|
|
169
|
+
return new ScrollToLocalAction(component, value, smooth, config);
|
|
170
|
+
}
|
|
171
|
+
class CameraSwitchLocalAction extends ComponentLocalAction {
|
|
172
|
+
constructor(component, device, config) {
|
|
173
|
+
super(component, config);
|
|
174
|
+
this.device = device;
|
|
175
|
+
}
|
|
176
|
+
class() {
|
|
177
|
+
return "component-local-camera-switch";
|
|
178
|
+
}
|
|
179
|
+
payload() {
|
|
180
|
+
return {
|
|
181
|
+
...this.targetPayload(),
|
|
182
|
+
deviceId: this.device.deviceId,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.CameraSwitchLocalAction = CameraSwitchLocalAction;
|
|
187
|
+
function cameraSwitchLocal(component, device, config) {
|
|
188
|
+
return new CameraSwitchLocalAction(component, device, config);
|
|
189
|
+
}
|
|
190
|
+
class TextEditorLocalAction extends ComponentLocalAction {
|
|
191
|
+
}
|
|
192
|
+
class TextEditorCommandLocalAction extends TextEditorLocalAction {
|
|
193
|
+
constructor(component, command, config) {
|
|
194
|
+
super(component, config);
|
|
195
|
+
this.command = command;
|
|
196
|
+
}
|
|
197
|
+
class() {
|
|
198
|
+
return `component-local-text-editor-${this.command}`;
|
|
199
|
+
}
|
|
200
|
+
payload() {
|
|
201
|
+
return this.targetPayload();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function textEditorCommandLocal(component, command, config) {
|
|
205
|
+
return new TextEditorCommandLocalAction(component, command, config);
|
|
206
|
+
}
|
|
207
|
+
class TextEditorInsertHtmlLocalAction extends TextEditorLocalAction {
|
|
208
|
+
constructor(component, value, config) {
|
|
209
|
+
super(component, config);
|
|
210
|
+
this.value = value;
|
|
211
|
+
}
|
|
212
|
+
class() {
|
|
213
|
+
return "component-local-text-editor-insert-html";
|
|
214
|
+
}
|
|
215
|
+
payload() {
|
|
216
|
+
return { ...this.targetPayload(), value: this.value };
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
exports.TextEditorInsertHtmlLocalAction = TextEditorInsertHtmlLocalAction;
|
|
220
|
+
function textEditorInsertHtmlLocal(component, value, config) {
|
|
221
|
+
return new TextEditorInsertHtmlLocalAction(component, value, config);
|
|
222
|
+
}
|
|
223
|
+
class TextEditorFormatBlockLocalAction extends TextEditorLocalAction {
|
|
224
|
+
constructor(component, tag, config) {
|
|
225
|
+
super(component, config);
|
|
226
|
+
this.tag = tag;
|
|
227
|
+
}
|
|
228
|
+
class() {
|
|
229
|
+
return "component-local-text-editor-format-block";
|
|
230
|
+
}
|
|
231
|
+
payload() {
|
|
232
|
+
return { ...this.targetPayload(), tag: this.tag };
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
exports.TextEditorFormatBlockLocalAction = TextEditorFormatBlockLocalAction;
|
|
236
|
+
function textEditorFormatBlockLocal(component, tag, config) {
|
|
237
|
+
return new TextEditorFormatBlockLocalAction(component, tag, config);
|
|
238
|
+
}
|
|
239
|
+
function textEditorToggleItalicLocal(component, config) {
|
|
240
|
+
return textEditorCommandLocal(component, "toggle-italic", config);
|
|
241
|
+
}
|
|
242
|
+
function textEditorToggleBoldLocal(component, config) {
|
|
243
|
+
return textEditorCommandLocal(component, "toggle-bold", config);
|
|
244
|
+
}
|
|
245
|
+
function textEditorToggleUnderlineLocal(component, config) {
|
|
246
|
+
return textEditorCommandLocal(component, "toggle-underline", config);
|
|
247
|
+
}
|
|
248
|
+
function textEditorUndoLocal(component, config) {
|
|
249
|
+
return textEditorCommandLocal(component, "undo", config);
|
|
250
|
+
}
|
|
251
|
+
function textEditorRedoLocal(component, config) {
|
|
252
|
+
return textEditorCommandLocal(component, "redo", config);
|
|
253
|
+
}
|
|
254
|
+
function textEditorSuperscriptLocal(component, config) {
|
|
255
|
+
return textEditorCommandLocal(component, "superscript", config);
|
|
256
|
+
}
|
|
257
|
+
function textEditorInsertOrderedListLocal(component, config) {
|
|
258
|
+
return textEditorCommandLocal(component, "insert-ordered-list", config);
|
|
259
|
+
}
|
|
260
|
+
function textEditorInsertUnorderedListLocal(component, config) {
|
|
261
|
+
return textEditorCommandLocal(component, "insert-unordered-list", config);
|
|
262
|
+
}
|
|
263
|
+
function textEditorJustifyLeftLocal(component, config) {
|
|
264
|
+
return textEditorCommandLocal(component, "justify-left", config);
|
|
265
|
+
}
|
|
266
|
+
function textEditorJustifyCenterLocal(component, config) {
|
|
267
|
+
return textEditorCommandLocal(component, "justify-center", config);
|
|
268
|
+
}
|
|
269
|
+
function textEditorJustifyRightLocal(component, config) {
|
|
270
|
+
return textEditorCommandLocal(component, "justify-right", config);
|
|
271
|
+
}
|
|
272
|
+
function textEditorJustifyFullLocal(component, config) {
|
|
273
|
+
return textEditorCommandLocal(component, "justify-full", config);
|
|
274
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ContextValueOrRef } from "../types/context-value-ref";
|
|
2
|
+
import { ActionConfig } from "./action";
|
|
3
|
+
import { NumberValueRef } from "./inc-context-value";
|
|
4
|
+
import { LocalAction } from "./local-action";
|
|
5
|
+
/**
|
|
6
|
+
* Уменьшение числового значения в Context на клиенте на `step`
|
|
7
|
+
* (с sync на BFF через `context-values`).
|
|
8
|
+
*/
|
|
9
|
+
export declare class DecContextValue extends LocalAction {
|
|
10
|
+
private readonly ref;
|
|
11
|
+
private readonly step;
|
|
12
|
+
constructor(ref: NumberValueRef, step: ContextValueOrRef<number>, config?: ActionConfig);
|
|
13
|
+
class(): string;
|
|
14
|
+
payload(): object;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Функциональная форма {@link DecContextValue}.
|
|
18
|
+
* Принимает только `ContextRef` с числовым значением.
|
|
19
|
+
* Без `step` клиент вычитает 1.
|
|
20
|
+
*/
|
|
21
|
+
export declare function decContextValue(ref: NumberValueRef, step?: ContextValueOrRef<number>, config?: ActionConfig): DecContextValue;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DecContextValue = void 0;
|
|
4
|
+
exports.decContextValue = decContextValue;
|
|
5
|
+
const condition_operand_1 = require("../conditions/condition-operand");
|
|
6
|
+
const local_action_1 = require("./local-action");
|
|
7
|
+
/**
|
|
8
|
+
* Уменьшение числового значения в Context на клиенте на `step`
|
|
9
|
+
* (с sync на BFF через `context-values`).
|
|
10
|
+
*/
|
|
11
|
+
class DecContextValue extends local_action_1.LocalAction {
|
|
12
|
+
constructor(ref, step, config = {}) {
|
|
13
|
+
super(config.conditions);
|
|
14
|
+
this.ref = ref;
|
|
15
|
+
this.step = step;
|
|
16
|
+
}
|
|
17
|
+
class() {
|
|
18
|
+
return "dec-context-value";
|
|
19
|
+
}
|
|
20
|
+
payload() {
|
|
21
|
+
return {
|
|
22
|
+
ref: this.ref,
|
|
23
|
+
step: (0, condition_operand_1.toSerializedOperand)(this.step),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.DecContextValue = DecContextValue;
|
|
28
|
+
/**
|
|
29
|
+
* Функциональная форма {@link DecContextValue}.
|
|
30
|
+
* Принимает только `ContextRef` с числовым значением.
|
|
31
|
+
* Без `step` клиент вычитает 1.
|
|
32
|
+
*/
|
|
33
|
+
function decContextValue(ref, step = 1, config = {}) {
|
|
34
|
+
return new DecContextValue(ref, step, config);
|
|
35
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ContextValueOrRef, ContextValueRef } from "../types/context-value-ref";
|
|
2
|
+
import { ActionConfig } from "./action";
|
|
3
|
+
import { LocalAction } from "./local-action";
|
|
4
|
+
/** Ref на числовое поле контекста. */
|
|
5
|
+
export type NumberValueRef = ContextValueRef<number | undefined>;
|
|
6
|
+
/**
|
|
7
|
+
* Изменение числового значения в Context на клиенте на `step`
|
|
8
|
+
* (с sync на BFF через `context-values`).
|
|
9
|
+
*/
|
|
10
|
+
export declare class IncContextValue extends LocalAction {
|
|
11
|
+
private readonly ref;
|
|
12
|
+
private readonly step;
|
|
13
|
+
constructor(ref: NumberValueRef, step: ContextValueOrRef<number>, config?: ActionConfig);
|
|
14
|
+
class(): string;
|
|
15
|
+
payload(): object;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Функциональная форма {@link IncContextValue}.
|
|
19
|
+
* Принимает только `ContextRef` с числовым значением.
|
|
20
|
+
* Без `step` клиент прибавляет 1.
|
|
21
|
+
*/
|
|
22
|
+
export declare function incContextValue(ref: NumberValueRef, step?: ContextValueOrRef<number>, config?: ActionConfig): IncContextValue;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IncContextValue = void 0;
|
|
4
|
+
exports.incContextValue = incContextValue;
|
|
5
|
+
const condition_operand_1 = require("../conditions/condition-operand");
|
|
6
|
+
const local_action_1 = require("./local-action");
|
|
7
|
+
/**
|
|
8
|
+
* Изменение числового значения в Context на клиенте на `step`
|
|
9
|
+
* (с sync на BFF через `context-values`).
|
|
10
|
+
*/
|
|
11
|
+
class IncContextValue extends local_action_1.LocalAction {
|
|
12
|
+
constructor(ref, step, config = {}) {
|
|
13
|
+
super(config.conditions);
|
|
14
|
+
this.ref = ref;
|
|
15
|
+
this.step = step;
|
|
16
|
+
}
|
|
17
|
+
class() {
|
|
18
|
+
return "inc-context-value";
|
|
19
|
+
}
|
|
20
|
+
payload() {
|
|
21
|
+
return {
|
|
22
|
+
ref: this.ref,
|
|
23
|
+
step: (0, condition_operand_1.toSerializedOperand)(this.step),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.IncContextValue = IncContextValue;
|
|
28
|
+
/**
|
|
29
|
+
* Функциональная форма {@link IncContextValue}.
|
|
30
|
+
* Принимает только `ContextRef` с числовым значением.
|
|
31
|
+
* Без `step` клиент прибавляет 1.
|
|
32
|
+
*/
|
|
33
|
+
function incContextValue(ref, step = 1, config = {}) {
|
|
34
|
+
return new IncContextValue(ref, step, config);
|
|
35
|
+
}
|
|
@@ -6,3 +6,7 @@ import { Action } from "./action";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare abstract class LocalAction extends Action {
|
|
8
8
|
}
|
|
9
|
+
export type InstanceLocalActions<LocalActions> = {
|
|
10
|
+
[Key in keyof LocalActions]: LocalActions[Key] extends (...args: infer Arguments) => infer Result ? Result extends LocalAction ? (...args: Arguments) => Result : LocalActions[Key] : LocalActions[Key];
|
|
11
|
+
};
|
|
12
|
+
export declare function createInstanceLocalActions<LocalActions extends object>(local: LocalActions | undefined, target: string): InstanceLocalActions<LocalActions>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LocalAction = void 0;
|
|
4
|
+
exports.createInstanceLocalActions = createInstanceLocalActions;
|
|
4
5
|
const action_1 = require("./action");
|
|
5
6
|
/**
|
|
6
7
|
* Абстрактный класс локального действия, выполняемого на клиенте.
|
|
@@ -10,3 +11,45 @@ const action_1 = require("./action");
|
|
|
10
11
|
class LocalAction extends action_1.Action {
|
|
11
12
|
}
|
|
12
13
|
exports.LocalAction = LocalAction;
|
|
14
|
+
class TargetedLocalAction extends LocalAction {
|
|
15
|
+
constructor(source, target) {
|
|
16
|
+
super();
|
|
17
|
+
this.source = source;
|
|
18
|
+
this.target = target;
|
|
19
|
+
}
|
|
20
|
+
class() {
|
|
21
|
+
return this.source.class();
|
|
22
|
+
}
|
|
23
|
+
payload() {
|
|
24
|
+
return {
|
|
25
|
+
...this.source.payload(),
|
|
26
|
+
target: this.target,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
toJSON() {
|
|
30
|
+
const serialized = this.source.toJSON();
|
|
31
|
+
return {
|
|
32
|
+
...serialized,
|
|
33
|
+
payload: {
|
|
34
|
+
...serialized.payload,
|
|
35
|
+
target: this.target,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function createInstanceLocalActions(local, target) {
|
|
41
|
+
return new Proxy(local ?? {}, {
|
|
42
|
+
get(source, property, receiver) {
|
|
43
|
+
const value = Reflect.get(source, property, receiver);
|
|
44
|
+
if (typeof value !== "function") {
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
return (...args) => {
|
|
48
|
+
const action = Reflect.apply(value, source, args);
|
|
49
|
+
return action instanceof LocalAction
|
|
50
|
+
? new TargetedLocalAction(action, target)
|
|
51
|
+
: action;
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { JsonObject } from "@matreshka/shared/types/json";
|
|
2
|
+
import { Context, ContextPathPatch } from "../context/context";
|
|
3
|
+
import { ContextValueOrRef } from "../types/context-value-ref";
|
|
4
|
+
import { ActionConfig } from "./action";
|
|
5
|
+
import { LocalAction } from "./local-action";
|
|
6
|
+
export type LocalContextPathPatch<T extends JsonObject> = Partial<{
|
|
7
|
+
[K in keyof ContextPathPatch<T>]: ContextValueOrRef<ContextPathPatch<T>[K]>;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Локальная запись patch в Context на клиенте (с sync на BFF через `context-values`).
|
|
11
|
+
*/
|
|
12
|
+
export declare class SetContext<T extends JsonObject> extends LocalAction {
|
|
13
|
+
private readonly context;
|
|
14
|
+
private readonly patch;
|
|
15
|
+
constructor(context: Context<T>, patch: LocalContextPathPatch<T>, config?: ActionConfig);
|
|
16
|
+
class(): string;
|
|
17
|
+
payload(): object;
|
|
18
|
+
}
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare function createSetContext<T extends JsonObject>(context: Context<T>, patch: LocalContextPathPatch<T>, config?: ActionConfig): SetContext<T>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetContext = void 0;
|
|
4
|
+
exports.createSetContext = createSetContext;
|
|
5
|
+
const condition_operand_1 = require("../conditions/condition-operand");
|
|
6
|
+
const local_action_1 = require("./local-action");
|
|
7
|
+
/**
|
|
8
|
+
* Локальная запись patch в Context на клиенте (с sync на BFF через `context-values`).
|
|
9
|
+
*/
|
|
10
|
+
class SetContext extends local_action_1.LocalAction {
|
|
11
|
+
constructor(context, patch, config = {}) {
|
|
12
|
+
super(config.conditions);
|
|
13
|
+
this.context = context;
|
|
14
|
+
this.patch = patch;
|
|
15
|
+
}
|
|
16
|
+
class() {
|
|
17
|
+
return "set-context";
|
|
18
|
+
}
|
|
19
|
+
payload() {
|
|
20
|
+
return {
|
|
21
|
+
context: this.context.id,
|
|
22
|
+
patch: Object.fromEntries(Object.entries(this.patch).map(([key, value]) => [
|
|
23
|
+
key,
|
|
24
|
+
(0, condition_operand_1.toSerializedOperand)(value),
|
|
25
|
+
])),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.SetContext = SetContext;
|
|
30
|
+
/** @internal */
|
|
31
|
+
function createSetContext(context, patch, config = {}) {
|
|
32
|
+
return new SetContext(context, patch, config);
|
|
33
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JsonObject, JsonPrimitive } from "@matreshka/shared/types/json";
|
|
1
|
+
import type { Json, JsonObject, JsonPrimitive } from "@matreshka/shared/types/json";
|
|
2
2
|
import type { SerializedOperand } from "@matreshka/shared/types/serialized-operand";
|
|
3
3
|
import { Paths, PathValue } from "ts-essentials";
|
|
4
4
|
import { ContextRef, ContextRefValue } from "../context/context-ref";
|
|
@@ -31,18 +31,20 @@ export type ArrayIncludesOperand<R extends ContextRef, P extends string> = Condi
|
|
|
31
31
|
export type ConditionLengthOperand = ConditionOperandFor<number>;
|
|
32
32
|
/** Операнд без привязки к конкретному `ref` (сериализация на wire). */
|
|
33
33
|
export type UntypedConditionOperand = JsonPrimitive | ContextRef;
|
|
34
|
+
/** Значение local action: JSON-значение или ссылка на значение в контексте. */
|
|
35
|
+
export type UntypedActionOperand = Json | ContextRef;
|
|
34
36
|
/**
|
|
35
37
|
* До JSON-сериализации в `kind: "ref"` лежит `ContextRef`;
|
|
36
38
|
* после stringify `ref` становится строкой `contextId.path`.
|
|
37
39
|
*/
|
|
38
40
|
export type BffSerializedOperand = {
|
|
39
41
|
kind: "literal";
|
|
40
|
-
value:
|
|
42
|
+
value: Json;
|
|
41
43
|
} | {
|
|
42
44
|
kind: "ref";
|
|
43
45
|
ref: ContextRef;
|
|
44
46
|
};
|
|
45
|
-
export declare function toSerializedOperand(value:
|
|
47
|
+
export declare function toSerializedOperand(value: UntypedActionOperand): BffSerializedOperand;
|
|
46
48
|
/** Для payload, который уходит в `Condition` и затем кастится к wire-типу. */
|
|
47
49
|
export declare function toWireOperand(value: UntypedConditionOperand): SerializedOperand;
|
|
48
50
|
export {};
|