@matreshka/bff 0.21.0 → 0.22.1
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/inputs/text-editor.d.ts +17 -0
- package/dist/components/inputs/text-editor.js +17 -0
- 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 +9 -7
- package/dist/core/conditions/context-array-includes.d.ts +4 -4
- package/dist/core/conditions/context-array-length.d.ts +15 -15
- package/dist/core/conditions/context-value-equal.d.ts +2 -2
- package/dist/core/conditions/context-value-in.d.ts +2 -2
- package/dist/core/conditions/context-value-not-equal.d.ts +2 -2
- package/dist/core/context/context-ref.d.ts +21 -0
- package/dist/core/context/context-ref.js +16 -0
- package/dist/core/context/context.d.ts +10 -0
- package/dist/core/context/context.js +11 -0
- 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 +2 -0
- 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
|
@@ -8,7 +8,7 @@ import { CompatibleArrayContextRef, ConditionLengthOperand } from "./condition-o
|
|
|
8
8
|
*
|
|
9
9
|
* @internal Используйте фабрики длины массива ({@link contextArrayLengthEqual} и др.).
|
|
10
10
|
*/
|
|
11
|
-
export declare abstract class ContextArrayLength<R extends ContextRef
|
|
11
|
+
export declare abstract class ContextArrayLength<R extends ContextRef<any, any>> extends Condition {
|
|
12
12
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand, operator: ArrayLengthCompare);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -16,68 +16,68 @@ export declare abstract class ContextArrayLength<R extends ContextRef> extends C
|
|
|
16
16
|
*
|
|
17
17
|
* @internal Используйте {@link contextArrayLengthEqual} / {@link when.lengthEquals}.
|
|
18
18
|
*/
|
|
19
|
-
export declare class ContextArrayLengthEqual<R extends ContextRef
|
|
19
|
+
export declare class ContextArrayLengthEqual<R extends ContextRef<any, any>> extends Condition {
|
|
20
20
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand);
|
|
21
21
|
}
|
|
22
22
|
/** Функциональная форма {@link ContextArrayLengthEqual}. */
|
|
23
|
-
export declare function contextArrayLengthEqual<R extends ContextRef
|
|
23
|
+
export declare function contextArrayLengthEqual<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthEqual<R>;
|
|
24
24
|
/**
|
|
25
25
|
* Алиас: длина массива в контексте строго меньше операнда (`<`).
|
|
26
26
|
*
|
|
27
27
|
* @internal Используйте {@link contextArrayLengthLessThan} / {@link when.lengthLessThan}.
|
|
28
28
|
*/
|
|
29
|
-
export declare class ContextArrayLengthLessThan<R extends ContextRef
|
|
29
|
+
export declare class ContextArrayLengthLessThan<R extends ContextRef<any, any>> extends Condition {
|
|
30
30
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand);
|
|
31
31
|
}
|
|
32
32
|
/** Функциональная форма {@link ContextArrayLengthLessThan}. */
|
|
33
|
-
export declare function contextArrayLengthLessThan<R extends ContextRef
|
|
33
|
+
export declare function contextArrayLengthLessThan<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthLessThan<R>;
|
|
34
34
|
/**
|
|
35
35
|
* Алиас: длина массива в контексте меньше или равна операнду (`<=`).
|
|
36
36
|
*
|
|
37
37
|
* @internal Используйте {@link contextArrayLengthLessOrEqual} / {@link when.lengthAtMost}.
|
|
38
38
|
*/
|
|
39
|
-
export declare class ContextArrayLengthLessOrEqual<R extends ContextRef
|
|
39
|
+
export declare class ContextArrayLengthLessOrEqual<R extends ContextRef<any, any>> extends Condition {
|
|
40
40
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand);
|
|
41
41
|
}
|
|
42
42
|
/** Функциональная форма {@link ContextArrayLengthLessOrEqual}. */
|
|
43
|
-
export declare function contextArrayLengthLessOrEqual<R extends ContextRef
|
|
43
|
+
export declare function contextArrayLengthLessOrEqual<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthLessOrEqual<R>;
|
|
44
44
|
/**
|
|
45
45
|
* Алиас: длина массива в контексте строго больше операнда (`>`).
|
|
46
46
|
*
|
|
47
47
|
* @internal Используйте {@link contextArrayLengthGreaterThan} / {@link when.lengthGreaterThan}.
|
|
48
48
|
*/
|
|
49
|
-
export declare class ContextArrayLengthGreaterThan<R extends ContextRef
|
|
49
|
+
export declare class ContextArrayLengthGreaterThan<R extends ContextRef<any, any>> extends Condition {
|
|
50
50
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand);
|
|
51
51
|
}
|
|
52
52
|
/** Функциональная форма {@link ContextArrayLengthGreaterThan}. */
|
|
53
|
-
export declare function contextArrayLengthGreaterThan<R extends ContextRef
|
|
53
|
+
export declare function contextArrayLengthGreaterThan<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthGreaterThan<R>;
|
|
54
54
|
/**
|
|
55
55
|
* Алиас: длина массива в контексте больше или равна операнду (`>=`).
|
|
56
56
|
*
|
|
57
57
|
* @internal Используйте {@link contextArrayLengthGreaterOrEqual} / {@link when.lengthAtLeast}.
|
|
58
58
|
*/
|
|
59
|
-
export declare class ContextArrayLengthGreaterOrEqual<R extends ContextRef
|
|
59
|
+
export declare class ContextArrayLengthGreaterOrEqual<R extends ContextRef<any, any>> extends Condition {
|
|
60
60
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand);
|
|
61
61
|
}
|
|
62
62
|
/** Функциональная форма {@link ContextArrayLengthGreaterOrEqual}. */
|
|
63
|
-
export declare function contextArrayLengthGreaterOrEqual<R extends ContextRef
|
|
63
|
+
export declare function contextArrayLengthGreaterOrEqual<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthGreaterOrEqual<R>;
|
|
64
64
|
/**
|
|
65
65
|
* Алиас: массив в контексте пуст (длина равна 0).
|
|
66
66
|
*
|
|
67
67
|
* @internal Используйте {@link contextValueEmpty} / {@link when.isEmpty}.
|
|
68
68
|
*/
|
|
69
|
-
export declare class ContextValueEmpty<R extends ContextRef
|
|
69
|
+
export declare class ContextValueEmpty<R extends ContextRef<any, any>> extends ContextArrayLengthEqual<R> {
|
|
70
70
|
constructor(ref: CompatibleArrayContextRef<R>);
|
|
71
71
|
}
|
|
72
72
|
/** Функциональная форма {@link ContextValueEmpty}. */
|
|
73
|
-
export declare function contextValueEmpty<R extends ContextRef
|
|
73
|
+
export declare function contextValueEmpty<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>): ContextValueEmpty<R>;
|
|
74
74
|
/**
|
|
75
75
|
* Алиас: массив в контексте непуст (длина строго больше 0).
|
|
76
76
|
*
|
|
77
77
|
* @internal Используйте {@link contextValueNotEmpty} / {@link when.notEmpty}.
|
|
78
78
|
*/
|
|
79
|
-
export declare class ContextValueNotEmpty<R extends ContextRef
|
|
79
|
+
export declare class ContextValueNotEmpty<R extends ContextRef<any, any>> extends ContextArrayLengthGreaterThan<R> {
|
|
80
80
|
constructor(ref: CompatibleArrayContextRef<R>);
|
|
81
81
|
}
|
|
82
82
|
/** Функциональная форма {@link ContextValueNotEmpty}. */
|
|
83
|
-
export declare function contextValueNotEmpty<R extends ContextRef
|
|
83
|
+
export declare function contextValueNotEmpty<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>): ContextValueNotEmpty<R>;
|
|
@@ -7,8 +7,8 @@ import { ConditionOperand } from "./condition-operand";
|
|
|
7
7
|
*
|
|
8
8
|
* @internal Используйте {@link contextValueEqual} / {@link when.equals}.
|
|
9
9
|
*/
|
|
10
|
-
export declare class ContextValueEqual<R extends ContextRef
|
|
10
|
+
export declare class ContextValueEqual<R extends ContextRef<any, any>> extends Condition {
|
|
11
11
|
constructor(ref: R, value: ConditionOperand<R>);
|
|
12
12
|
}
|
|
13
13
|
/** Функциональная форма {@link ContextValueEqual}. */
|
|
14
|
-
export declare function contextValueEqual<R extends ContextRef
|
|
14
|
+
export declare function contextValueEqual<R extends ContextRef<any, any>>(ref: R, value: ConditionOperand<R>): ContextValueEqual<R>;
|
|
@@ -7,8 +7,8 @@ import { ConditionOperand } from "./condition-operand";
|
|
|
7
7
|
*
|
|
8
8
|
* @internal Используйте {@link contextValueIn} / {@link when.oneOf}.
|
|
9
9
|
*/
|
|
10
|
-
export declare class ContextValueIn<R extends ContextRef
|
|
10
|
+
export declare class ContextValueIn<R extends ContextRef<any, any>> extends Condition {
|
|
11
11
|
constructor(ref: R, value: ConditionOperand<R>[]);
|
|
12
12
|
}
|
|
13
13
|
/** Функциональная форма {@link ContextValueIn}. */
|
|
14
|
-
export declare function contextValueIn<R extends ContextRef
|
|
14
|
+
export declare function contextValueIn<R extends ContextRef<any, any>>(ref: R, value: ConditionOperand<R>[]): ContextValueIn<R>;
|
|
@@ -7,8 +7,8 @@ import { ConditionOperand } from "./condition-operand";
|
|
|
7
7
|
*
|
|
8
8
|
* @internal Используйте {@link contextValueNotEqual} / {@link when.notEquals}.
|
|
9
9
|
*/
|
|
10
|
-
export declare class ContextValueNotEqual<R extends ContextRef
|
|
10
|
+
export declare class ContextValueNotEqual<R extends ContextRef<any, any>> extends Condition {
|
|
11
11
|
constructor(ref: R, value: ConditionOperand<R>);
|
|
12
12
|
}
|
|
13
13
|
/** Функциональная форма {@link ContextValueNotEqual}. */
|
|
14
|
-
export declare function contextValueNotEqual<R extends ContextRef
|
|
14
|
+
export declare function contextValueNotEqual<R extends ContextRef<any, any>>(ref: R, value: ConditionOperand<R>): ContextValueNotEqual<R>;
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import { JsonObject } from "@matreshka/shared/types/json";
|
|
2
2
|
import { Paths, PathValue } from "ts-essentials";
|
|
3
|
+
import { ActionConfig } from "../actions/action";
|
|
4
|
+
import { DecContextValue } from "../actions/dec-context-value";
|
|
5
|
+
import { IncContextValue } from "../actions/inc-context-value";
|
|
6
|
+
import { SetContext } from "../actions/set-context";
|
|
7
|
+
import { ToggleContextValue } from "../actions/toggle-context-value";
|
|
8
|
+
import { ContextValueOrRef } from "../types/context-value-ref";
|
|
3
9
|
import { Context } from "./context";
|
|
10
|
+
type ContextRefLocalSet<ContextType extends JsonObject, PathType extends string> = {
|
|
11
|
+
set: (value: ContextValueOrRef<PathValue<ContextType, PathType>>, config?: ActionConfig) => SetContext<ContextType>;
|
|
12
|
+
};
|
|
13
|
+
type ContextRefLocalToggle = {
|
|
14
|
+
toggle: (config?: ActionConfig) => ToggleContextValue;
|
|
15
|
+
};
|
|
16
|
+
type ContextRefLocalNumeric = {
|
|
17
|
+
inc: (step?: ContextValueOrRef<number>, config?: ActionConfig) => IncContextValue;
|
|
18
|
+
dec: (step?: ContextValueOrRef<number>, config?: ActionConfig) => DecContextValue;
|
|
19
|
+
};
|
|
20
|
+
/** Локальные действия по ref; `toggle` / `inc` / `dec` — по типу значения по пути. */
|
|
21
|
+
export type ContextRefLocalActions<ContextType extends JsonObject, PathType extends string> = ContextRefLocalSet<ContextType, PathType> & (PathValue<ContextType, PathType> extends boolean | undefined ? ContextRefLocalToggle : {}) & (PathValue<ContextType, PathType> extends number | undefined ? ContextRefLocalNumeric : {});
|
|
4
22
|
export type ContextRefValue<R extends ContextRef> = R extends {
|
|
5
23
|
readonly __valueType?: infer ValueType;
|
|
6
24
|
} ? Exclude<ValueType, undefined> : R extends ContextRef<infer ContextType, infer PathType> ? PathValue<ContextType, PathType> : never;
|
|
7
25
|
export declare class ContextRef<ContextType extends JsonObject = JsonObject, PathType extends string = string> {
|
|
8
26
|
readonly context: Context<any>;
|
|
9
27
|
readonly path: PathType;
|
|
28
|
+
/** Локальные (client-only) действия по этому ref. */
|
|
29
|
+
readonly local: ContextRefLocalActions<ContextType, PathType>;
|
|
10
30
|
constructor(context: Context<any>, path: PathType);
|
|
11
31
|
/**
|
|
12
32
|
* Продолжение пути в рамках того же контекста.
|
|
@@ -52,3 +72,4 @@ export declare class ContextRef<ContextType extends JsonObject = JsonObject, Pat
|
|
|
52
72
|
toString(): string;
|
|
53
73
|
toJSON(): string;
|
|
54
74
|
}
|
|
75
|
+
export {};
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ContextRef = void 0;
|
|
4
|
+
const dec_context_value_1 = require("../actions/dec-context-value");
|
|
5
|
+
const inc_context_value_1 = require("../actions/inc-context-value");
|
|
6
|
+
const set_context_1 = require("../actions/set-context");
|
|
7
|
+
const toggle_context_value_1 = require("../actions/toggle-context-value");
|
|
4
8
|
const client_context_1 = require("../client-context");
|
|
5
9
|
class ContextRef {
|
|
6
10
|
constructor(context, path) {
|
|
7
11
|
this.context = context;
|
|
8
12
|
this.path = path;
|
|
13
|
+
/** Локальные (client-only) действия по этому ref. */
|
|
14
|
+
this.local = {
|
|
15
|
+
set: (value, config) => {
|
|
16
|
+
const patch = {
|
|
17
|
+
[this.path]: value,
|
|
18
|
+
};
|
|
19
|
+
return (0, set_context_1.createSetContext)(this.context, patch, config);
|
|
20
|
+
},
|
|
21
|
+
toggle: (config) => (0, toggle_context_value_1.toggleContextValue)(this, config),
|
|
22
|
+
inc: (step = 1, config) => (0, inc_context_value_1.incContextValue)(this, step, config),
|
|
23
|
+
dec: (step = 1, config) => (0, dec_context_value_1.decContextValue)(this, step, config),
|
|
24
|
+
};
|
|
9
25
|
}
|
|
10
26
|
ref(path) {
|
|
11
27
|
if (path instanceof ContextRef) {
|
|
@@ -2,7 +2,10 @@ import { JsonObject } from "@matreshka/shared/types/json";
|
|
|
2
2
|
import { BehaviorSubject, Observable } from "rxjs";
|
|
3
3
|
import { Paths, PathValue } from "ts-essentials";
|
|
4
4
|
import { ZodObject } from "zod/v4";
|
|
5
|
+
import { ActionConfig } from "../actions/action";
|
|
6
|
+
import { LocalContextPathPatch } from "../actions/set-context";
|
|
5
7
|
import type { Client } from "../client";
|
|
8
|
+
import { ContextValueOrRef } from "../types/context-value-ref";
|
|
6
9
|
import { ContextRef } from "./context-ref";
|
|
7
10
|
/** Частичное обновление данных контекста по dotted-путям (см. {@link Context.set}). */
|
|
8
11
|
export type ContextPathPatch<T extends JsonObject> = Partial<{
|
|
@@ -30,6 +33,13 @@ export declare class Context<T extends JsonObject> {
|
|
|
30
33
|
* Явный {@link destroy} по-прежнему обязателен, если данные не нужны весь runtime.
|
|
31
34
|
*/
|
|
32
35
|
readonly persistent: boolean;
|
|
36
|
+
/** Локальные (client-only) действия над данными этого контекста. */
|
|
37
|
+
readonly local: {
|
|
38
|
+
set: (patch: LocalContextPathPatch<T>, config?: ActionConfig) => import("../actions/set-context").SetContext<T>;
|
|
39
|
+
toggle: <K extends Paths<T>>(path: PathValue<T, K> extends boolean | undefined ? K : never, config?: ActionConfig) => import("../actions/toggle-context-value").ToggleContextValue;
|
|
40
|
+
inc: <K extends Paths<T>>(path: PathValue<T, K> extends number | undefined ? K : never, step?: ContextValueOrRef<number>, config?: ActionConfig) => import("../actions/inc-context-value").IncContextValue;
|
|
41
|
+
dec: <K extends Paths<T>>(path: PathValue<T, K> extends number | undefined ? K : never, step?: ContextValueOrRef<number>, config?: ActionConfig) => import("../actions/dec-context-value").DecContextValue;
|
|
42
|
+
};
|
|
33
43
|
/** Реактивное хранилище инициализации контекста */
|
|
34
44
|
private _init$;
|
|
35
45
|
readonly init$: Observable<void>;
|
|
@@ -7,6 +7,10 @@ const targeted_message_1 = require("@matreshka/shared/messages/targeted-message"
|
|
|
7
7
|
const fetch_from_object_1 = require("@matreshka/shared/utils/fetch-from-object");
|
|
8
8
|
const rxjs_1 = require("rxjs");
|
|
9
9
|
const v4_1 = require("zod/v4");
|
|
10
|
+
const dec_context_value_1 = require("../actions/dec-context-value");
|
|
11
|
+
const inc_context_value_1 = require("../actions/inc-context-value");
|
|
12
|
+
const set_context_1 = require("../actions/set-context");
|
|
13
|
+
const toggle_context_value_1 = require("../actions/toggle-context-value");
|
|
10
14
|
const client_context_1 = require("../client-context");
|
|
11
15
|
const deep_pick_1 = require("../utils/deep-pick");
|
|
12
16
|
const incoming_message_observer_1 = require("../utils/incoming-message-observer");
|
|
@@ -97,6 +101,13 @@ class Context {
|
|
|
97
101
|
constructor(config) {
|
|
98
102
|
/** Уникальный идентификатор контекста */
|
|
99
103
|
this.id = crypto.randomUUID();
|
|
104
|
+
/** Локальные (client-only) действия над данными этого контекста. */
|
|
105
|
+
this.local = {
|
|
106
|
+
set: (patch, config) => (0, set_context_1.createSetContext)(this, patch, config),
|
|
107
|
+
toggle: (path, config) => (0, toggle_context_value_1.toggleContextValue)(this.ref(path), config),
|
|
108
|
+
inc: (path, step, config) => (0, inc_context_value_1.incContextValue)(this.ref(path), step ?? 1, config),
|
|
109
|
+
dec: (path, step, config) => (0, dec_context_value_1.decContextValue)(this.ref(path), step ?? 1, config),
|
|
110
|
+
};
|
|
100
111
|
/** Реактивное хранилище инициализации контекста */
|
|
101
112
|
this._init$ = new rxjs_1.ReplaySubject(1);
|
|
102
113
|
this.init$ = this._init$.asObservable();
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
export * from "./actions/action";
|
|
2
|
-
export * from "./actions/animate-component";
|
|
3
|
-
export * from "./actions/local-action";
|
|
4
|
-
export * from "./actions/set-context-value";
|
|
5
|
-
export * from "./actions/set-context-values";
|
|
6
|
-
export * from "./actions/toggle-context-value";
|
|
7
|
-
export * from "./actions/write-text-to-clipboard";
|
|
8
2
|
export * from "./boot";
|
|
9
3
|
export * from "./client";
|
|
10
4
|
export * from "./client-context";
|
|
@@ -15,6 +9,9 @@ export * from "./matreshka";
|
|
|
15
9
|
export * from "./conditions";
|
|
16
10
|
export * from "./context/context";
|
|
17
11
|
export * from "./context/context-ref";
|
|
12
|
+
export type { DimensionalValue } from "@matreshka/shared/types/dimensional-value";
|
|
13
|
+
export { ComponentAnimationEffect, DimensionalUnit, TimingFunction, local, } from "./local";
|
|
14
|
+
export type { ActionConfig, AnimateComponentConfig, ComponentAnimationEffects, DimensionalKeyframeStops, OpacityKeyframeStops, } from "./local";
|
|
18
15
|
export * from "./types/client-settings";
|
|
19
16
|
export * from "./utils/calculate-components";
|
|
20
17
|
export * from "./utils/color-roles-to-ids";
|
package/dist/core/index.js
CHANGED
|
@@ -14,13 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.local = exports.TimingFunction = exports.DimensionalUnit = exports.ComponentAnimationEffect = void 0;
|
|
17
18
|
__exportStar(require("./actions/action"), exports);
|
|
18
|
-
__exportStar(require("./actions/animate-component"), exports);
|
|
19
|
-
__exportStar(require("./actions/local-action"), exports);
|
|
20
|
-
__exportStar(require("./actions/set-context-value"), exports);
|
|
21
|
-
__exportStar(require("./actions/set-context-values"), exports);
|
|
22
|
-
__exportStar(require("./actions/toggle-context-value"), exports);
|
|
23
|
-
__exportStar(require("./actions/write-text-to-clipboard"), exports);
|
|
24
19
|
__exportStar(require("./boot"), exports);
|
|
25
20
|
__exportStar(require("./client"), exports);
|
|
26
21
|
__exportStar(require("./client-context"), exports);
|
|
@@ -31,6 +26,11 @@ __exportStar(require("./matreshka"), exports);
|
|
|
31
26
|
__exportStar(require("./conditions"), exports);
|
|
32
27
|
__exportStar(require("./context/context"), exports);
|
|
33
28
|
__exportStar(require("./context/context-ref"), exports);
|
|
29
|
+
var local_1 = require("./local");
|
|
30
|
+
Object.defineProperty(exports, "ComponentAnimationEffect", { enumerable: true, get: function () { return local_1.ComponentAnimationEffect; } });
|
|
31
|
+
Object.defineProperty(exports, "DimensionalUnit", { enumerable: true, get: function () { return local_1.DimensionalUnit; } });
|
|
32
|
+
Object.defineProperty(exports, "TimingFunction", { enumerable: true, get: function () { return local_1.TimingFunction; } });
|
|
33
|
+
Object.defineProperty(exports, "local", { enumerable: true, get: function () { return local_1.local; } });
|
|
34
34
|
__exportStar(require("./types/client-settings"), exports);
|
|
35
35
|
__exportStar(require("./utils/calculate-components"), exports);
|
|
36
36
|
__exportStar(require("./utils/color-roles-to-ids"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { animate } from "../actions/animate-component";
|
|
2
|
+
import { writeTextToClipboard } from "../actions/write-text-to-clipboard";
|
|
3
|
+
export type { ActionConfig } from "../actions/action";
|
|
4
|
+
export { DimensionalUnit } from "@matreshka/shared/enums/dimensional-unit";
|
|
5
|
+
export type { DimensionalValue } from "@matreshka/shared/types/dimensional-value";
|
|
6
|
+
export { animate, ComponentAnimationEffect, TimingFunction, } from "../actions/animate-component";
|
|
7
|
+
export type { AnimateComponentConfig, ComponentAnimationEffects, DimensionalKeyframeStops, OpacityKeyframeStops, } from "../actions/animate-component";
|
|
8
|
+
/**
|
|
9
|
+
* Глобальные локальные (client-only) действия Matreshka BFF.
|
|
10
|
+
*/
|
|
11
|
+
export declare const local: {
|
|
12
|
+
readonly animate: typeof animate;
|
|
13
|
+
readonly writeTextToClipboard: typeof writeTextToClipboard;
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.local = exports.TimingFunction = exports.ComponentAnimationEffect = exports.animate = exports.DimensionalUnit = void 0;
|
|
4
|
+
const animate_component_1 = require("../actions/animate-component");
|
|
5
|
+
const write_text_to_clipboard_1 = require("../actions/write-text-to-clipboard");
|
|
6
|
+
var dimensional_unit_1 = require("@matreshka/shared/enums/dimensional-unit");
|
|
7
|
+
Object.defineProperty(exports, "DimensionalUnit", { enumerable: true, get: function () { return dimensional_unit_1.DimensionalUnit; } });
|
|
8
|
+
var animate_component_2 = require("../actions/animate-component");
|
|
9
|
+
Object.defineProperty(exports, "animate", { enumerable: true, get: function () { return animate_component_2.animate; } });
|
|
10
|
+
Object.defineProperty(exports, "ComponentAnimationEffect", { enumerable: true, get: function () { return animate_component_2.ComponentAnimationEffect; } });
|
|
11
|
+
Object.defineProperty(exports, "TimingFunction", { enumerable: true, get: function () { return animate_component_2.TimingFunction; } });
|
|
12
|
+
/**
|
|
13
|
+
* Глобальные локальные (client-only) действия Matreshka BFF.
|
|
14
|
+
*/
|
|
15
|
+
exports.local = {
|
|
16
|
+
animate: animate_component_1.animate,
|
|
17
|
+
writeTextToClipboard: write_text_to_clipboard_1.writeTextToClipboard,
|
|
18
|
+
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { EntryComponent } from "../../components";
|
|
2
|
+
import { InstanceLocalActions } from "../actions/local-action";
|
|
2
3
|
import type { Client } from "../client";
|
|
3
4
|
import type { Componentable } from "./componentable";
|
|
5
|
+
type ComponentInstanceLocalActions<ComponentType> = ComponentType extends {
|
|
6
|
+
local: infer LocalActions;
|
|
7
|
+
} ? InstanceLocalActions<LocalActions> : Record<string, never>;
|
|
4
8
|
/**
|
|
5
9
|
* Инстанс server-компонента на клиенте.
|
|
6
10
|
* Один BFF-объект может быть сериализован несколько раз с разными id (`uuid-0`, `uuid-1`, …).
|
|
@@ -15,6 +19,8 @@ export declare class ComponentInstance<ComponentType extends Componentable = Com
|
|
|
15
19
|
constructor(
|
|
16
20
|
/** Id инстанса на клиенте (обычно `target` входящего сообщения). */
|
|
17
21
|
id: string, component: ComponentType);
|
|
22
|
+
/** Локальные действия компонента, адресованные этому instance. */
|
|
23
|
+
readonly local: ComponentInstanceLocalActions<ComponentType>;
|
|
18
24
|
get client(): Client | undefined;
|
|
19
25
|
/** Entry-инстанс дерева, внутри которого сериализован этот компонент (`entry.component` — BFF entry). */
|
|
20
26
|
get entry(): ComponentInstance<EntryComponent> | undefined;
|
|
@@ -23,3 +29,4 @@ export declare class ComponentInstance<ComponentType extends Componentable = Com
|
|
|
23
29
|
/** Закрепляет instance за client/entry после успешной сериализации конфига. */
|
|
24
30
|
commitSerialization(): void;
|
|
25
31
|
}
|
|
32
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ComponentInstance = void 0;
|
|
4
|
+
const local_action_1 = require("../actions/local-action");
|
|
4
5
|
const client_context_1 = require("../client-context");
|
|
5
6
|
const entry_context_1 = require("../entry-context");
|
|
6
7
|
/**
|
|
@@ -14,6 +15,9 @@ class ComponentInstance {
|
|
|
14
15
|
this.id = id;
|
|
15
16
|
this.component = component;
|
|
16
17
|
this._serialized = false;
|
|
18
|
+
this.local = (0, local_action_1.createInstanceLocalActions)("local" in component
|
|
19
|
+
? component.local
|
|
20
|
+
: undefined, id);
|
|
17
21
|
}
|
|
18
22
|
get client() {
|
|
19
23
|
return this._client;
|
|
@@ -24,6 +24,8 @@ export type ContextValueRef<ValueType> = ContextRef<any, any> & {
|
|
|
24
24
|
* Ref `R` совместим с ожидаемым типом значения `ValueType` (проверка на call site).
|
|
25
25
|
*/
|
|
26
26
|
export type CompatibleContextValueRef<ValueType, R extends ContextRef> = ValueType extends ContextRefValue<R> ? R : never;
|
|
27
|
+
/** Статическое значение или ссылка на совместимое значение в контексте. */
|
|
28
|
+
export type ContextValueOrRef<ValueType> = ValueType | ContextValueRef<Exclude<ValueType, undefined>>;
|
|
27
29
|
/**
|
|
28
30
|
* Ссылка на массив элементов в контексте (`ItemType[] | undefined`).
|
|
29
31
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matreshka/bff",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "Matreshka BFF: server-driven UI runtime — routing, pages, context, component DSL, and platform APIs",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"vitest": "^4.1.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@matreshka/shared": "^0.
|
|
65
|
+
"@matreshka/shared": "^0.21.0",
|
|
66
66
|
"@simplewebauthn/server": "^13.1.1",
|
|
67
67
|
"@simplewebauthn/types": "^12.0.0",
|
|
68
68
|
"fast-xml-parser": "^5.3.3",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ContextRefValue } from "../context/context-ref";
|
|
2
|
-
import { ContextValueRef } from "../types/context-value-ref";
|
|
3
|
-
import { ActionConfig } from "./action";
|
|
4
|
-
import { LocalAction } from "./local-action";
|
|
5
|
-
/**
|
|
6
|
-
* Запись одного значения в Context на клиенте (с sync на BFF через `context-values`).
|
|
7
|
-
*
|
|
8
|
-
* `R` — конкретный ref; `value` имеет тип значения по этому ref.
|
|
9
|
-
*/
|
|
10
|
-
export declare class SetContextValue<R extends ContextValueRef<unknown>> extends LocalAction {
|
|
11
|
-
private readonly ref;
|
|
12
|
-
private readonly value;
|
|
13
|
-
constructor(ref: R, value: ContextRefValue<R>, config?: ActionConfig);
|
|
14
|
-
class(): string;
|
|
15
|
-
payload(): object;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Функциональная форма {@link SetContextValue}.
|
|
19
|
-
* Тип `value` должен совпадать с типом значения по `ref`.
|
|
20
|
-
*/
|
|
21
|
-
export declare function setContextValue<R extends ContextValueRef<unknown>>(ref: R, value: ContextRefValue<R>, config?: ActionConfig): SetContextValue<R>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetContextValue = void 0;
|
|
4
|
-
exports.setContextValue = setContextValue;
|
|
5
|
-
const local_action_1 = require("./local-action");
|
|
6
|
-
/**
|
|
7
|
-
* Запись одного значения в Context на клиенте (с sync на BFF через `context-values`).
|
|
8
|
-
*
|
|
9
|
-
* `R` — конкретный ref; `value` имеет тип значения по этому ref.
|
|
10
|
-
*/
|
|
11
|
-
class SetContextValue extends local_action_1.LocalAction {
|
|
12
|
-
constructor(ref, value, config = {}) {
|
|
13
|
-
super(config.conditions);
|
|
14
|
-
this.ref = ref;
|
|
15
|
-
this.value = value;
|
|
16
|
-
}
|
|
17
|
-
class() {
|
|
18
|
-
return "set-context-value";
|
|
19
|
-
}
|
|
20
|
-
payload() {
|
|
21
|
-
return {
|
|
22
|
-
ref: this.ref,
|
|
23
|
-
value: this.value,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.SetContextValue = SetContextValue;
|
|
28
|
-
/**
|
|
29
|
-
* Функциональная форма {@link SetContextValue}.
|
|
30
|
-
* Тип `value` должен совпадать с типом значения по `ref`.
|
|
31
|
-
*/
|
|
32
|
-
function setContextValue(ref, value, config = {}) {
|
|
33
|
-
return new SetContextValue(ref, value, config);
|
|
34
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ContextRefValue } from "../context/context-ref";
|
|
2
|
-
import { ContextValueRef } from "../types/context-value-ref";
|
|
3
|
-
import { ActionConfig } from "./action";
|
|
4
|
-
import { LocalAction } from "./local-action";
|
|
5
|
-
/**
|
|
6
|
-
* Пара ref + value для batch-записи в Context.
|
|
7
|
-
* Тип `value` выводится из конкретного `ref`.
|
|
8
|
-
*/
|
|
9
|
-
export type ContextValueAssignment<R extends ContextValueRef<unknown> = ContextValueRef<unknown>> = {
|
|
10
|
-
ref: R;
|
|
11
|
-
value: ContextRefValue<R>;
|
|
12
|
-
};
|
|
13
|
-
type AssertContextValueAssignments<T extends readonly unknown[]> = {
|
|
14
|
-
[K in keyof T]: T[K] extends {
|
|
15
|
-
ref: infer R extends ContextValueRef<unknown>;
|
|
16
|
-
} ? ContextValueAssignment<R> : never;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Batch-запись значений в Context на клиенте (с sync на BFF через `context-values`).
|
|
20
|
-
*/
|
|
21
|
-
export declare class SetContextValues extends LocalAction {
|
|
22
|
-
private readonly values;
|
|
23
|
-
constructor(values: readonly ContextValueAssignment[], config?: ActionConfig);
|
|
24
|
-
class(): string;
|
|
25
|
-
payload(): object;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Функциональная форма {@link SetContextValues}.
|
|
29
|
-
* У каждого элемента массива тип `value` должен совпадать с типом значения по `ref`.
|
|
30
|
-
*/
|
|
31
|
-
export declare function setContextValues<const T extends readonly [
|
|
32
|
-
ContextValueAssignment,
|
|
33
|
-
...ContextValueAssignment[]
|
|
34
|
-
]>(values: AssertContextValueAssignments<T> & T, config?: ActionConfig): SetContextValues;
|
|
35
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetContextValues = void 0;
|
|
4
|
-
exports.setContextValues = setContextValues;
|
|
5
|
-
const local_action_1 = require("./local-action");
|
|
6
|
-
/**
|
|
7
|
-
* Batch-запись значений в Context на клиенте (с sync на BFF через `context-values`).
|
|
8
|
-
*/
|
|
9
|
-
class SetContextValues extends local_action_1.LocalAction {
|
|
10
|
-
constructor(values, config = {}) {
|
|
11
|
-
super(config.conditions);
|
|
12
|
-
this.values = values;
|
|
13
|
-
}
|
|
14
|
-
class() {
|
|
15
|
-
return "set-context-values";
|
|
16
|
-
}
|
|
17
|
-
payload() {
|
|
18
|
-
return {
|
|
19
|
-
values: this.values.map(({ ref, value }) => ({ ref, value })),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.SetContextValues = SetContextValues;
|
|
24
|
-
/**
|
|
25
|
-
* Функциональная форма {@link SetContextValues}.
|
|
26
|
-
* У каждого элемента массива тип `value` должен совпадать с типом значения по `ref`.
|
|
27
|
-
*/
|
|
28
|
-
function setContextValues(values, config = {}) {
|
|
29
|
-
return new SetContextValues(values, config);
|
|
30
|
-
}
|