@matreshka/bff 0.11.1 → 0.12.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 (44) hide show
  1. package/README.md +3 -3
  2. package/dist/components/actions/server-action.d.ts +4 -1
  3. package/dist/components/component.js +2 -8
  4. package/dist/components/for-each.d.ts +0 -4
  5. package/dist/components/inputs/input-component.d.ts +8 -3
  6. package/dist/components/inputs/number-input.d.ts +10 -8
  7. package/dist/components/inputs/password-input.d.ts +8 -8
  8. package/dist/components/inputs/text-editor.d.ts +8 -8
  9. package/dist/components/inputs/text-input.d.ts +8 -8
  10. package/dist/components/inputs/textarea.d.ts +8 -8
  11. package/dist/components/outputs/currency.d.ts +8 -8
  12. package/dist/components/outputs/datetime.d.ts +9 -9
  13. package/dist/components/outputs/icon.d.ts +8 -8
  14. package/dist/components/outputs/iframe.d.ts +9 -9
  15. package/dist/components/outputs/image.d.ts +9 -9
  16. package/dist/components/outputs/number.d.ts +9 -9
  17. package/dist/components/outputs/output-component.d.ts +10 -5
  18. package/dist/components/outputs/progress-bar.d.ts +9 -9
  19. package/dist/components/outputs/progress-spinner.d.ts +9 -9
  20. package/dist/components/outputs/qr-code.d.ts +9 -9
  21. package/dist/components/outputs/text.d.ts +9 -9
  22. package/dist/components/outputs/vector.d.ts +9 -9
  23. package/dist/components/types/component-sequence.d.ts +3 -3
  24. package/dist/core/actions/set-context-value.d.ts +7 -4
  25. package/dist/core/actions/set-context-value.js +2 -0
  26. package/dist/core/actions/set-context-values.d.ts +4 -3
  27. package/dist/core/actions/toggle-context-value.d.ts +5 -7
  28. package/dist/core/client-storage.d.ts +28 -0
  29. package/dist/core/client-storage.js +45 -0
  30. package/dist/core/client.d.ts +5 -0
  31. package/dist/core/client.js +9 -10
  32. package/dist/core/index.d.ts +4 -0
  33. package/dist/core/index.js +4 -0
  34. package/dist/core/matreshka.js +2 -5
  35. package/dist/core/types/client-settings.d.ts +9 -2
  36. package/dist/core/types/context-value-ref.d.ts +31 -0
  37. package/dist/core/types/context-value-ref.js +2 -0
  38. package/dist/core/types/native-picker-context-ref.d.ts +3 -2
  39. package/dist/core/utils/color-roles-to-ids.d.ts +3 -0
  40. package/dist/core/utils/color-roles-to-ids.js +10 -0
  41. package/dist/core/utils/serialize-client-settings-colors-for-handshake.d.ts +8 -0
  42. package/dist/core/utils/serialize-client-settings-colors-for-handshake.js +15 -0
  43. package/dist/platforms/platform.d.ts +5 -5
  44. package/package.json +5 -5
package/README.md CHANGED
@@ -22,9 +22,9 @@ import { when } from "@matreshka/bff/core/conditions";
22
22
 
23
23
  ## Документация
24
24
 
25
- - [Документация Matreshka](https://github.com/dmitriytretyakov/matreshka/tree/main/docs/README.md)
26
- - [Использование BFF](https://github.com/dmitriytretyakov/matreshka/tree/main/docs/usage/README.md)
27
- - [Быстрый старт](https://github.com/dmitriytretyakov/matreshka/tree/main/docs/usage/quick-start.md)
25
+ - [Документация Matreshka](https://github.com/matreshka-dev/matreshka/tree/main/docs/README.md)
26
+ - [Getting started](https://github.com/matreshka-dev/matreshka/tree/main/docs/getting-started/overview.md)
27
+ - [Первое приложение](https://github.com/matreshka-dev/matreshka/tree/main/docs/getting-started/first-app.md)
28
28
 
29
29
  ## Лицензия
30
30
 
@@ -17,7 +17,9 @@ export type ServerActionProperties<ComponentType extends Componentable, PayloadT
17
17
  * Используется для выполнения произвольного кода на сервере, например, при клике по кнопке.
18
18
  * @param properties Свойства действия.
19
19
  */
20
- export type ServerActionHandler<ComponentType extends Componentable, PayloadType = undefined> = (properties: ServerActionProperties<ComponentType, PayloadType>) => void | Promise<void>;
20
+ type SyncServerActionHandler<ComponentType extends Componentable, PayloadType = undefined> = (properties: ServerActionProperties<ComponentType, PayloadType>) => void;
21
+ type AsyncServerActionHandler<ComponentType extends Componentable, PayloadType = undefined> = (properties: ServerActionProperties<ComponentType, PayloadType>) => Promise<void>;
22
+ export type ServerActionHandler<ComponentType extends Componentable, PayloadType = undefined> = SyncServerActionHandler<ComponentType, PayloadType> | AsyncServerActionHandler<ComponentType, PayloadType>;
21
23
  /**
22
24
  * Серверное действие, выполняемое BFF при взаимодействии клиента с компонентом.
23
25
  */
@@ -28,3 +30,4 @@ export declare class ServerAction<ComponentType extends Componentable, PayloadTy
28
30
  payload(): object;
29
31
  execute(properties: ServerActionProperties<ComponentType, PayloadType>): void;
30
32
  }
33
+ export {};
@@ -42,12 +42,6 @@ const core_1 = require("../core");
42
42
  const incoming_message_observer_1 = require("../core/utils/incoming-message-observer");
43
43
  const track_created_instances_1 = require("../core/utils/track-created-instances");
44
44
  const server_action_1 = require("./actions/server-action");
45
- function resolvePartialColorsToIds(colors) {
46
- return Object.entries(colors).reduce((acc, [role, value]) => {
47
- acc[role] = (0, core_1.colorTokenId)(value);
48
- return acc;
49
- }, {});
50
- }
51
45
  /**
52
46
  * @typeParam InitConfigType - Тип конфигурации, используемой в конструкторе компонента
53
47
  * @typeParam PropertiesType - Тип свойств компонента
@@ -94,7 +88,7 @@ class Component {
94
88
  initProperties(initValues) {
95
89
  const colorSources = { ...this.colors(), ...initValues.colors };
96
90
  const colors = Object.keys(colorSources).length > 0
97
- ? resolvePartialColorsToIds(colorSources)
91
+ ? (0, core_1.resolvePartialColorsToIds)(colorSources)
98
92
  : undefined;
99
93
  // @ts-expect-error properties are validated elsewhere; unsafe cast is intentional
100
94
  return {
@@ -190,7 +184,7 @@ class Component {
190
184
  if (overrides.colors === undefined) {
191
185
  return overrides;
192
186
  }
193
- const colors = resolvePartialColorsToIds(overrides.colors);
187
+ const colors = (0, core_1.resolvePartialColorsToIds)(overrides.colors);
194
188
  return {
195
189
  ...overrides,
196
190
  colors: Object.keys(colors).length > 0 ? colors : undefined,
@@ -19,10 +19,6 @@ type ForEachTypedItemRef<ContextType extends JsonObject, PathType extends string
19
19
  ref<P2 extends string>(path: ContextRef<ContextType, P2>): ContextRef<ContextType, `${PathType}.${P2}`>;
20
20
  };
21
21
  type ForEachItemLink<RefType extends ContextRef<any, any>> = RefType extends ContextRef<infer ContextType, infer PathType> ? ForEachTypedItemRef<ContextType, `${PathType}.${number}`, ForEachItemData<RefType>> : never;
22
- export type ForEachDataRef<DataType> = ContextRef<any, any> & {
23
- readonly __valueType?: DataType[];
24
- value(): DataType[] | undefined;
25
- };
26
22
  /**
27
23
  * Свойства, передаваемые генератору компонентов в `ForEach`.
28
24
  *
@@ -1,11 +1,16 @@
1
- import { Componentable, ContextRef, ContextRefValue, StandaloneComponent } from "../../core";
1
+ import { CompatibleContextValueRef, Componentable, ContextValueRef, StandaloneComponent } from "../../core";
2
2
  import { Component, ComponentInitConfig, ComponentProperties } from "../component";
3
+ /** Ref на поле ввода: значение `ValueType | undefined`. */
4
+ export type InputContextRef<ValueType> = ContextValueRef<ValueType | undefined>;
5
+ /** Ref на строковое поле ввода. */
6
+ export type StringInputContextRef = InputContextRef<string>;
3
7
  /**
4
8
  * Конфигурация инициализации компонента ввода.
5
9
  * @property ref Ссылка в контексте.
6
10
  */
7
- export type CompatibleInputRef<ValueType, RefType extends ContextRef<any, any>> = ValueType extends ContextRefValue<RefType> ? RefType : never;
8
- export type InputInitConfig<ValueType, ComponentType extends Componentable = InputComponent, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends InputProperties = InputProperties> = {
11
+ /** @see CompatibleContextValueRef */
12
+ export type CompatibleInputRef<ValueType, RefType extends InputContextRef<ValueType>> = CompatibleContextValueRef<ValueType, RefType>;
13
+ export type InputInitConfig<ValueType, ComponentType extends Componentable = InputComponent, RefType extends InputContextRef<ValueType> = InputContextRef<ValueType>, PropertiesType extends InputProperties = InputProperties> = {
9
14
  ref: CompatibleInputRef<ValueType, RefType>;
10
15
  } & ComponentInitConfig<ComponentType, PropertiesType>;
11
16
  /**
@@ -1,16 +1,18 @@
1
1
  import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
- import { Componentable, ContextRef } from "../../core";
3
- import { InputComponent, InputInitConfig, InputProperties } from "./input-component";
2
+ import { Componentable } from "../../core";
3
+ import { InputComponent, InputContextRef, InputInitConfig, InputProperties } from "./input-component";
4
4
  export type NumberInputProperties = {
5
5
  placeholder?: string;
6
6
  min?: number;
7
7
  max?: number;
8
8
  step?: number;
9
9
  } & InputProperties;
10
+ /** Ссылка контекста для {@link NumberInput}. */
11
+ export type NumberInputContextRef = InputContextRef<number>;
10
12
  /**
11
13
  * Конфигурация инициализации компонента ввода числа.
12
14
  */
13
- export type NumberInputInitConfig<ComponentType extends Componentable = NumberInput, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends NumberInputProperties = NumberInputProperties> = {
15
+ export type NumberInputInitConfig<ComponentType extends Componentable = NumberInput, RefType extends NumberInputContextRef = NumberInputContextRef, PropertiesType extends NumberInputProperties = NumberInputProperties> = {
14
16
  /**
15
17
  * Текст-заполнитель, отображаемый в поле ввода.
16
18
  */
@@ -28,16 +30,16 @@ export type NumberInputInitConfig<ComponentType extends Componentable = NumberIn
28
30
  */
29
31
  step?: number;
30
32
  } & InputInitConfig<number, ComponentType, RefType, PropertiesType>;
31
- type DefaultInitConfigType<RefType extends ContextRef<any, any>> = NumberInputInitConfig<NumberInput, RefType>;
32
- export declare function numberInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): NumberInput<RefType>;
33
- export declare function numberInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(ref: DefaultInitConfigType<RefType>["ref"]): NumberInput<RefType>;
34
- export declare function numberInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: NumberInputInitConfig<any, RefType>): NumberInput<RefType>;
33
+ type DefaultInitConfigType<RefType extends NumberInputContextRef> = NumberInputInitConfig<NumberInput, RefType>;
34
+ export declare function numberInput<RefType extends NumberInputContextRef>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): NumberInput<RefType>;
35
+ export declare function numberInput<RefType extends NumberInputContextRef>(ref: DefaultInitConfigType<RefType>["ref"]): NumberInput<RefType>;
36
+ export declare function numberInput<RefType extends NumberInputContextRef>(config: NumberInputInitConfig<any, RefType>): NumberInput<RefType>;
35
37
  /**
36
38
  * Компонент ввода числовых значений.
37
39
  *
38
40
  * Наследует функциональность от {@link InputComponent}.
39
41
  */
40
- export declare class NumberInput<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends NumberInputProperties = NumberInputProperties> extends InputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
42
+ export declare class NumberInput<RefType extends NumberInputContextRef = NumberInputContextRef, PropertiesType extends NumberInputProperties = NumberInputProperties> extends InputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
41
43
  constructor(config: DefaultInitConfigType<RefType>);
42
44
  protected class(): ServerComponentClass;
43
45
  protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
@@ -1,26 +1,26 @@
1
1
  import { PasswordInputKind } from "@matreshka/shared/enums/password-input-kind";
2
2
  import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
3
- import { Componentable, ContextRef } from "../../core";
4
- import { InputComponent, InputInitConfig, InputProperties } from "./input-component";
3
+ import { Componentable } from "../../core";
4
+ import { InputComponent, InputInitConfig, InputProperties, StringInputContextRef } from "./input-component";
5
5
  export type PasswordInputProperties = {
6
6
  placeholder?: string;
7
7
  kind?: PasswordInputKind;
8
8
  } & InputProperties;
9
- export type PasswordInputInitConfig<ComponentType extends Componentable = PasswordInput, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends PasswordInputProperties = PasswordInputProperties> = {
9
+ export type PasswordInputInitConfig<ComponentType extends Componentable = PasswordInput, RefType extends StringInputContextRef = StringInputContextRef, PropertiesType extends PasswordInputProperties = PasswordInputProperties> = {
10
10
  placeholder?: string;
11
11
  kind?: PasswordInputKind;
12
12
  } & InputInitConfig<string, ComponentType, RefType, PropertiesType>;
13
- type DefaultInitConfigType<RefType extends ContextRef<any, any>> = PasswordInputInitConfig<PasswordInput, RefType>;
14
- export declare function passwordInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): PasswordInput<RefType>;
15
- export declare function passwordInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(ref: DefaultInitConfigType<RefType>["ref"]): PasswordInput<RefType>;
16
- export declare function passwordInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: PasswordInputInitConfig<any, RefType>): PasswordInput<RefType>;
13
+ type DefaultInitConfigType<RefType extends StringInputContextRef> = PasswordInputInitConfig<PasswordInput, RefType>;
14
+ export declare function passwordInput<RefType extends StringInputContextRef = StringInputContextRef>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): PasswordInput<RefType>;
15
+ export declare function passwordInput<RefType extends StringInputContextRef = StringInputContextRef>(ref: DefaultInitConfigType<RefType>["ref"]): PasswordInput<RefType>;
16
+ export declare function passwordInput<RefType extends StringInputContextRef = StringInputContextRef>(config: PasswordInputInitConfig<any, RefType>): PasswordInput<RefType>;
17
17
  /**
18
18
  * Компонент ввода пароля.
19
19
  *
20
20
  * @property kind Семантический вид автозаполнения пароля.
21
21
  * Наследует функциональность от {@link InputComponent}.
22
22
  */
23
- export declare class PasswordInput<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends PasswordInputProperties = PasswordInputProperties> extends InputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
23
+ export declare class PasswordInput<RefType extends StringInputContextRef = StringInputContextRef, PropertiesType extends PasswordInputProperties = PasswordInputProperties> extends InputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
24
24
  constructor(config: DefaultInitConfigType<RefType>);
25
25
  protected class(): ServerComponentClass;
26
26
  protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
@@ -1,7 +1,7 @@
1
1
  import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
- import { Componentable, ComponentInstance, ContextRef } from "../../core";
2
+ import { Componentable, ComponentInstance } from "../../core";
3
3
  import { ServerComponentAction } from "../component";
4
- import { InputComponent, InputInitConfig, InputProperties } from "./input-component";
4
+ import { InputComponent, InputInitConfig, InputProperties, StringInputContextRef } from "./input-component";
5
5
  /**
6
6
  * Свойства компонента текстового редактора.
7
7
  */
@@ -9,22 +9,22 @@ export type TextEditorProperties = InputProperties;
9
9
  /**
10
10
  * Конфигурация инициализации текстового редактора.
11
11
  */
12
- export type TextEditorInitConfig<ComponentType extends Componentable = TextEditor, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends TextEditorProperties = TextEditorProperties> = InputInitConfig<string, ComponentType, RefType, PropertiesType> & {
12
+ export type TextEditorInitConfig<ComponentType extends Componentable = TextEditor, RefType extends StringInputContextRef = StringInputContextRef, PropertiesType extends TextEditorProperties = TextEditorProperties> = InputInitConfig<string, ComponentType, RefType, PropertiesType> & {
13
13
  /**
14
14
  * Событие: изменился выделенный текст в редакторе.
15
15
  */
16
16
  onSelectionChange?: ServerComponentAction<ComponentType, string> | ServerComponentAction<ComponentType, string>[];
17
17
  };
18
- type DefaultInitConfigType<RefType extends ContextRef<any, any>> = TextEditorInitConfig<TextEditor, RefType>;
19
- export declare function textEditor<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): TextEditor<RefType>;
20
- export declare function textEditor<RefType extends ContextRef<any, any> = ContextRef<any, any>>(ref: DefaultInitConfigType<RefType>["ref"]): TextEditor<RefType>;
21
- export declare function textEditor<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: TextEditorInitConfig<any, RefType>): TextEditor<RefType>;
18
+ type DefaultInitConfigType<RefType extends StringInputContextRef> = TextEditorInitConfig<TextEditor, RefType>;
19
+ export declare function textEditor<RefType extends StringInputContextRef = StringInputContextRef>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): TextEditor<RefType>;
20
+ export declare function textEditor<RefType extends StringInputContextRef = StringInputContextRef>(ref: DefaultInitConfigType<RefType>["ref"]): TextEditor<RefType>;
21
+ export declare function textEditor<RefType extends StringInputContextRef = StringInputContextRef>(config: TextEditorInitConfig<any, RefType>): TextEditor<RefType>;
22
22
  /**
23
23
  * Компонент визуального текстового редактора.
24
24
  *
25
25
  * Поддерживает панель инструментов, вложенные компоненты и команды форматирования.
26
26
  */
27
- export declare class TextEditor<RefType extends ContextRef<any, any> = ContextRef<any, any>, InitConfigType extends TextEditorInitConfig<any, RefType> = DefaultInitConfigType<RefType>, PropertiesType extends TextEditorProperties = TextEditorProperties> extends InputComponent<InitConfigType, PropertiesType> {
27
+ export declare class TextEditor<RefType extends StringInputContextRef = StringInputContextRef, InitConfigType extends TextEditorInitConfig<any, RefType> = DefaultInitConfigType<RefType>, PropertiesType extends TextEditorProperties = TextEditorProperties> extends InputComponent<InitConfigType, PropertiesType> {
28
28
  constructor(config: TextEditorInitConfig<any, RefType>);
29
29
  protected class(): ServerComponentClass;
30
30
  /**
@@ -1,7 +1,7 @@
1
1
  import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
2
  import { TextInputKind } from "@matreshka/shared/enums/text-input-kind";
3
- import { Componentable, ContextRef } from "../../core";
4
- import { InputComponent, InputInitConfig, InputProperties } from "./input-component";
3
+ import { Componentable } from "../../core";
4
+ import { InputComponent, InputInitConfig, InputProperties, StringInputContextRef } from "./input-component";
5
5
  /**
6
6
  * Свойства маски ввода текста.
7
7
  *
@@ -28,19 +28,19 @@ export type TextInputProperties = {
28
28
  * преобразует в `autocomplete` и `inputmode`.
29
29
  * @property mask Маска ввода с настройками форматирования.
30
30
  */
31
- export type TextInputInitConfig<ComponentType extends Componentable = TextInput, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends TextInputProperties = TextInputProperties> = {
31
+ export type TextInputInitConfig<ComponentType extends Componentable = TextInput, RefType extends StringInputContextRef = StringInputContextRef, PropertiesType extends TextInputProperties = TextInputProperties> = {
32
32
  placeholder?: string;
33
33
  kind?: TextInputKind;
34
34
  mask?: InputMaskProperties;
35
35
  } & InputInitConfig<string, ComponentType, RefType, PropertiesType>;
36
- type DefaultInitConfigType<RefType extends ContextRef<any, any>> = TextInputInitConfig<TextInput, RefType>;
37
- export declare function textInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): TextInput<RefType>;
38
- export declare function textInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(ref: DefaultInitConfigType<RefType>["ref"]): TextInput<RefType>;
39
- export declare function textInput<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: TextInputInitConfig<any, RefType>): TextInput<RefType>;
36
+ type DefaultInitConfigType<RefType extends StringInputContextRef> = TextInputInitConfig<TextInput, RefType>;
37
+ export declare function textInput<RefType extends StringInputContextRef = StringInputContextRef>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): TextInput<RefType>;
38
+ export declare function textInput<RefType extends StringInputContextRef = StringInputContextRef>(ref: DefaultInitConfigType<RefType>["ref"]): TextInput<RefType>;
39
+ export declare function textInput<RefType extends StringInputContextRef = StringInputContextRef>(config: TextInputInitConfig<any, RefType>): TextInput<RefType>;
40
40
  /**
41
41
  * Компонент ввода текста.
42
42
  */
43
- export declare class TextInput<RefType extends ContextRef<any, any> = ContextRef<any, any>, InitConfigType extends TextInputInitConfig<any, RefType> = DefaultInitConfigType<RefType>, PropertiesType extends TextInputProperties = TextInputProperties> extends InputComponent<InitConfigType, PropertiesType> {
43
+ export declare class TextInput<RefType extends StringInputContextRef = StringInputContextRef, InitConfigType extends TextInputInitConfig<any, RefType> = DefaultInitConfigType<RefType>, PropertiesType extends TextInputProperties = TextInputProperties> extends InputComponent<InitConfigType, PropertiesType> {
44
44
  constructor(config: TextInputInitConfig<any, RefType>);
45
45
  protected class(): ServerComponentClass;
46
46
  protected initProperties(initValues: InitConfigType): PropertiesType;
@@ -1,7 +1,7 @@
1
1
  import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
2
  import { TextareaResize } from "@matreshka/shared/enums/textarea-resize";
3
- import { Componentable, ContextRef } from "../../core";
4
- import { InputComponent, InputInitConfig, InputProperties } from "./input-component";
3
+ import { Componentable } from "../../core";
4
+ import { InputComponent, InputInitConfig, InputProperties, StringInputContextRef } from "./input-component";
5
5
  export type TextareaProperties = {
6
6
  placeholder?: string;
7
7
  rows?: number;
@@ -14,21 +14,21 @@ export type TextareaProperties = {
14
14
  * @property rows Количество видимых строк textarea.
15
15
  * @property resize Режим изменения размера textarea.
16
16
  */
17
- export type TextareaInitConfig<ComponentType extends Componentable = Textarea, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends TextareaProperties = TextareaProperties> = {
17
+ export type TextareaInitConfig<ComponentType extends Componentable = Textarea, RefType extends StringInputContextRef = StringInputContextRef, PropertiesType extends TextareaProperties = TextareaProperties> = {
18
18
  placeholder?: string;
19
19
  rows?: number;
20
20
  resize?: TextareaResize;
21
21
  } & InputInitConfig<string, ComponentType, RefType, PropertiesType>;
22
- type DefaultInitConfigType<RefType extends ContextRef<any, any>> = TextareaInitConfig<Textarea, RefType>;
23
- export declare function textarea<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): Textarea<RefType>;
24
- export declare function textarea<RefType extends ContextRef<any, any> = ContextRef<any, any>>(ref: DefaultInitConfigType<RefType>["ref"]): Textarea<RefType>;
25
- export declare function textarea<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: TextareaInitConfig<any, RefType>): Textarea<RefType>;
22
+ type DefaultInitConfigType<RefType extends StringInputContextRef> = TextareaInitConfig<Textarea, RefType>;
23
+ export declare function textarea<RefType extends StringInputContextRef = StringInputContextRef>(options: Omit<DefaultInitConfigType<RefType>, "ref">, ref: DefaultInitConfigType<RefType>["ref"]): Textarea<RefType>;
24
+ export declare function textarea<RefType extends StringInputContextRef = StringInputContextRef>(ref: DefaultInitConfigType<RefType>["ref"]): Textarea<RefType>;
25
+ export declare function textarea<RefType extends StringInputContextRef = StringInputContextRef>(config: TextareaInitConfig<any, RefType>): Textarea<RefType>;
26
26
  /**
27
27
  * Компонент многострочного текстового ввода (textarea).
28
28
  *
29
29
  * Наследует поведение от {@link InputComponent}.
30
30
  */
31
- export declare class Textarea<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends TextareaProperties = TextareaProperties> extends InputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
31
+ export declare class Textarea<RefType extends StringInputContextRef = StringInputContextRef, PropertiesType extends TextareaProperties = TextareaProperties> extends InputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
32
32
  constructor(config: DefaultInitConfigType<RefType>);
33
33
  protected class(): ServerComponentClass;
34
34
  protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
@@ -1,6 +1,6 @@
1
1
  import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
- import { Componentable, ContextRef, StandaloneComponent } from "../../core";
3
- import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
2
+ import { Componentable, StandaloneComponent } from "../../core";
3
+ import { CompatibleOutputRef, NumberOutputContextRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
4
4
  /**
5
5
  * Конфигурация инициализации компонента валюты.
6
6
  *
@@ -33,23 +33,23 @@ export type CurrencyProperties = {
33
33
  /**
34
34
  * Конфигурация инициализации компонента валюты.
35
35
  */
36
- export type CurrencyInitConfig<ComponentType extends Componentable = Currency, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends CurrencyProperties = CurrencyProperties> = {
36
+ export type CurrencyInitConfig<ComponentType extends Componentable = Currency, RefType extends NumberOutputContextRef = NumberOutputContextRef, PropertiesType extends CurrencyProperties = CurrencyProperties> = {
37
37
  currency: string;
38
38
  minIntegerDigits?: number;
39
39
  minFractionDigits?: number;
40
40
  maxFractionDigits?: number;
41
41
  } & OutputInitConfig<number, ComponentType, RefType, PropertiesType>;
42
- type DefaultInitConfigType<RefType extends ContextRef<any, any>> = CurrencyInitConfig<Currency, RefType>;
43
- type CurrencyValueOrRef<RefType extends ContextRef<any, any>> = number | CompatibleOutputRef<number, RefType>;
44
- export declare function currency<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: CurrencyValueOrRef<RefType>): Currency<RefType>;
45
- export declare function currency<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: CurrencyInitConfig<Currency, RefType>): Currency<RefType>;
42
+ type DefaultInitConfigType<RefType extends NumberOutputContextRef> = CurrencyInitConfig<Currency, RefType>;
43
+ type CurrencyValueOrRef<RefType extends NumberOutputContextRef> = number | CompatibleOutputRef<number, RefType>;
44
+ export declare function currency<RefType extends NumberOutputContextRef = NumberOutputContextRef>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: CurrencyValueOrRef<RefType>): Currency<RefType>;
45
+ export declare function currency<RefType extends NumberOutputContextRef = NumberOutputContextRef>(config: CurrencyInitConfig<Currency, RefType>): Currency<RefType>;
46
46
  /**
47
47
  * Компонент отображения валюты.
48
48
  *
49
49
  * Представляет числовое значение с привязкой к конкретной валюте.
50
50
  * Поддерживает встроенное отображение.
51
51
  */
52
- export declare class Currency<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends CurrencyProperties = CurrencyProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
52
+ export declare class Currency<RefType extends NumberOutputContextRef = NumberOutputContextRef, PropertiesType extends CurrencyProperties = CurrencyProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
53
53
  constructor(config: DefaultInitConfigType<RefType>);
54
54
  protected class(): ServerComponentClass;
55
55
  /**
@@ -1,6 +1,6 @@
1
1
  import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
- import { Componentable, ContextRef, StandaloneComponent } from "../../core";
3
- import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
2
+ import { Componentable, StandaloneComponent } from "../../core";
3
+ import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties, StringOutputContextRef } from "./output-component";
4
4
  /**
5
5
  * Параметры форматирования даты и времени.
6
6
  *
@@ -36,21 +36,21 @@ export type DatetimeProperties = {
36
36
  * @property locales Список локалей для форматирования.
37
37
  * @property options Параметры форматирования даты и времени.
38
38
  */
39
- export type DatetimeInitConfig<ComponentType extends Componentable = Datetime, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends DatetimeProperties = DatetimeProperties> = {
39
+ export type DatetimeInitConfig<ComponentType extends Componentable = Datetime, RefType extends StringOutputContextRef = StringOutputContextRef, PropertiesType extends DatetimeProperties = DatetimeProperties> = {
40
40
  locales?: string[];
41
41
  options?: DateTimeOptions;
42
42
  } & OutputInitConfig<string, ComponentType, RefType, PropertiesType>;
43
- type DefaultInitConfigType<RefType extends ContextRef<any, any>> = DatetimeInitConfig<Datetime, RefType>;
44
- type DatetimeValueOrRef<RefType extends ContextRef<any, any>> = string | CompatibleOutputRef<string, RefType>;
45
- export declare function datetime<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: DatetimeValueOrRef<RefType>): Datetime<RefType>;
46
- export declare function datetime<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: DatetimeValueOrRef<RefType>): Datetime<RefType>;
47
- export declare function datetime<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: DatetimeInitConfig<Datetime, RefType>): Datetime<RefType>;
43
+ type DefaultInitConfigType<RefType extends StringOutputContextRef> = DatetimeInitConfig<Datetime, RefType>;
44
+ type DatetimeValueOrRef<RefType extends StringOutputContextRef> = string | CompatibleOutputRef<string, RefType>;
45
+ export declare function datetime<RefType extends StringOutputContextRef = StringOutputContextRef>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: DatetimeValueOrRef<RefType>): Datetime<RefType>;
46
+ export declare function datetime<RefType extends StringOutputContextRef = StringOutputContextRef>(valueOrRef: DatetimeValueOrRef<RefType>): Datetime<RefType>;
47
+ export declare function datetime<RefType extends StringOutputContextRef = StringOutputContextRef>(config: DatetimeInitConfig<Datetime, RefType>): Datetime<RefType>;
48
48
  /**
49
49
  * Компонент вывода отформатированной даты и времени.
50
50
  *
51
51
  * Наследуется от {@link OutputComponent} и реализует {@link StandaloneComponent}.
52
52
  */
53
- export declare class Datetime<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends DatetimeProperties = DatetimeProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
53
+ export declare class Datetime<RefType extends StringOutputContextRef = StringOutputContextRef, PropertiesType extends DatetimeProperties = DatetimeProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
54
54
  constructor(config: DefaultInitConfigType<RefType>);
55
55
  /**
56
56
  * Возвращает идентификатор типа вывода.
@@ -1,6 +1,6 @@
1
1
  import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
- import { Componentable, ContextRef, StandaloneComponent } from "../../core";
3
- import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
2
+ import { Componentable, StandaloneComponent } from "../../core";
3
+ import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties, StringOutputContextRef } from "./output-component";
4
4
  type IconValue = string;
5
5
  /**
6
6
  * Свойства компонента вывода иконки.
@@ -14,22 +14,22 @@ export type IconProperties = {
14
14
  /**
15
15
  * Конфигурация инициализации компонента вывода иконки.
16
16
  */
17
- export type IconInitConfig<ComponentType extends Componentable = Icon, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends IconProperties = IconProperties> = {
17
+ export type IconInitConfig<ComponentType extends Componentable = Icon, RefType extends StringOutputContextRef = StringOutputContextRef, PropertiesType extends IconProperties = IconProperties> = {
18
18
  /**
19
19
  * Размер иконки в логических пикселях; на клиенте конвертируется в rem и задаёт ширину/высоту.
20
20
  */
21
21
  size: number;
22
22
  } & OutputInitConfig<IconValue, ComponentType, RefType, PropertiesType>;
23
- type DefaultInitConfigType<RefType extends ContextRef<any, any>> = IconInitConfig<Icon, RefType>;
24
- type IconValueOrRef<RefType extends ContextRef<any, any>> = IconValue | CompatibleOutputRef<IconValue, RefType>;
25
- export declare function icon<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: IconValueOrRef<RefType>): Icon<RefType>;
26
- export declare function icon<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: IconInitConfig<Icon, RefType>): Icon<RefType>;
23
+ type DefaultInitConfigType<RefType extends StringOutputContextRef> = IconInitConfig<Icon, RefType>;
24
+ type IconValueOrRef<RefType extends StringOutputContextRef> = IconValue | CompatibleOutputRef<IconValue, RefType>;
25
+ export declare function icon<RefType extends StringOutputContextRef = StringOutputContextRef>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: IconValueOrRef<RefType>): Icon<RefType>;
26
+ export declare function icon<RefType extends StringOutputContextRef = StringOutputContextRef>(config: IconInitConfig<Icon, RefType>): Icon<RefType>;
27
27
  /**
28
28
  * Компонент для отображения иконки.
29
29
  *
30
30
  * Наследуется от {@link OutputComponent}.
31
31
  */
32
- export declare class Icon<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends IconProperties = IconProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
32
+ export declare class Icon<RefType extends StringOutputContextRef = StringOutputContextRef, PropertiesType extends IconProperties = IconProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
33
33
  constructor(config: DefaultInitConfigType<RefType>);
34
34
  protected class(): ServerComponentClass;
35
35
  /**
@@ -1,7 +1,7 @@
1
1
  import { IframeAllow } from "@matreshka/shared/enums/iframe-allow";
2
2
  import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
3
- import { Componentable, ContextRef } from "../../core";
4
- import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
3
+ import { Componentable } from "../../core";
4
+ import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties, StringOutputContextRef } from "./output-component";
5
5
  export { IframeAllow } from "@matreshka/shared/enums/iframe-allow";
6
6
  /**
7
7
  * Свойства компонента вывода iframe.
@@ -21,21 +21,21 @@ export type IframeProperties = {
21
21
  * @property allow Список разрешённых возможностей для атрибута `allow` iframe.
22
22
  * @property ratio Соотношение сторон iframe через CSS `aspect-ratio`.
23
23
  */
24
- export type IframeInitConfig<ComponentType extends Componentable = Iframe, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends IframeProperties = IframeProperties> = {
24
+ export type IframeInitConfig<ComponentType extends Componentable = Iframe, RefType extends StringOutputContextRef = StringOutputContextRef, PropertiesType extends IframeProperties = IframeProperties> = {
25
25
  allow?: IframeAllow[];
26
26
  ratio?: {
27
27
  value: number;
28
28
  };
29
29
  } & OutputInitConfig<string, ComponentType, RefType, PropertiesType>;
30
- type DefaultInitConfigType<RefType extends ContextRef<any, any>> = IframeInitConfig<Iframe, RefType>;
31
- type IframeValueOrRef<RefType extends ContextRef<any, any>> = string | CompatibleOutputRef<string, RefType>;
32
- export declare function iframe<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: IframeValueOrRef<RefType>): Iframe<RefType>;
33
- export declare function iframe<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: IframeValueOrRef<RefType>): Iframe<RefType>;
34
- export declare function iframe<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: IframeInitConfig<Iframe, RefType>): Iframe<RefType>;
30
+ type DefaultInitConfigType<RefType extends StringOutputContextRef> = IframeInitConfig<Iframe, RefType>;
31
+ type IframeValueOrRef<RefType extends StringOutputContextRef> = string | CompatibleOutputRef<string, RefType>;
32
+ export declare function iframe<RefType extends StringOutputContextRef = StringOutputContextRef>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: IframeValueOrRef<RefType>): Iframe<RefType>;
33
+ export declare function iframe<RefType extends StringOutputContextRef = StringOutputContextRef>(valueOrRef: IframeValueOrRef<RefType>): Iframe<RefType>;
34
+ export declare function iframe<RefType extends StringOutputContextRef = StringOutputContextRef>(config: IframeInitConfig<Iframe, RefType>): Iframe<RefType>;
35
35
  /**
36
36
  * Компонент вывода iframe.
37
37
  */
38
- export declare class Iframe<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends IframeProperties = IframeProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
38
+ export declare class Iframe<RefType extends StringOutputContextRef = StringOutputContextRef, PropertiesType extends IframeProperties = IframeProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
39
39
  constructor(config: DefaultInitConfigType<RefType>);
40
40
  protected class(): ServerComponentClass;
41
41
  /**
@@ -2,9 +2,9 @@ import { RatioMode } from "@matreshka/shared/enums/ratio-mode";
2
2
  import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
3
3
  import { type FlexItemSpec } from "@matreshka/shared/types/flex-item";
4
4
  import type { RadiusPx } from "@matreshka/shared/types/radius-px";
5
- import { Componentable, ContextRef, StandaloneComponent } from "../../core";
5
+ import { Componentable, StandaloneComponent } from "../../core";
6
6
  import { ServerComponentAction } from "../component";
7
- import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
7
+ import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties, StringOutputContextRef } from "./output-component";
8
8
  export { RatioMode } from "@matreshka/shared/enums/ratio-mode";
9
9
  /** @deprecated Use RatioMode instead */
10
10
  export { RatioMode as ImageMode } from "@matreshka/shared/enums/ratio-mode";
@@ -32,7 +32,7 @@ export type ImageProperties = {
32
32
  * @property radius Скругление (логические px).
33
33
  * @property onClick Обработчики нажатия на изображение.
34
34
  */
35
- export type ImageInitConfig<ComponentType extends Componentable = Image, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends ImageProperties = ImageProperties> = {
35
+ export type ImageInitConfig<ComponentType extends Componentable = Image, RefType extends StringOutputContextRef = StringOutputContextRef, PropertiesType extends ImageProperties = ImageProperties> = {
36
36
  ratio?: {
37
37
  value: number;
38
38
  mode: RatioMode;
@@ -47,15 +47,15 @@ export type ImageInitConfig<ComponentType extends Componentable = Image, RefType
47
47
  flexItem?: FlexItemSpec;
48
48
  onClick?: ServerComponentAction<ComponentType> | ServerComponentAction<ComponentType>[];
49
49
  } & OutputInitConfig<string, ComponentType, RefType, PropertiesType>;
50
- type DefaultInitConfigType<RefType extends ContextRef<any, any>> = ImageInitConfig<any, RefType>;
51
- type ImageValueOrRef<RefType extends ContextRef<any, any>> = string | CompatibleOutputRef<string, RefType>;
52
- export declare function image<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: ImageValueOrRef<RefType>): Image<RefType>;
53
- export declare function image<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: ImageValueOrRef<RefType>): Image<RefType>;
54
- export declare function image<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: ImageInitConfig<any, RefType>): Image<RefType>;
50
+ type DefaultInitConfigType<RefType extends StringOutputContextRef> = ImageInitConfig<any, RefType>;
51
+ type ImageValueOrRef<RefType extends StringOutputContextRef> = string | CompatibleOutputRef<string, RefType>;
52
+ export declare function image<RefType extends StringOutputContextRef = StringOutputContextRef>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: ImageValueOrRef<RefType>): Image<RefType>;
53
+ export declare function image<RefType extends StringOutputContextRef = StringOutputContextRef>(valueOrRef: ImageValueOrRef<RefType>): Image<RefType>;
54
+ export declare function image<RefType extends StringOutputContextRef = StringOutputContextRef>(config: ImageInitConfig<any, RefType>): Image<RefType>;
55
55
  /**
56
56
  * Компонент для вывода изображения.
57
57
  */
58
- export declare class Image<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends ImageProperties = ImageProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
58
+ export declare class Image<RefType extends StringOutputContextRef = StringOutputContextRef, PropertiesType extends ImageProperties = ImageProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
59
59
  /**
60
60
  * Создает экземпляр изображения.
61
61
  * @param config Конфигурация инициализации изображения.
@@ -1,6 +1,6 @@
1
1
  import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
2
- import { Componentable, ContextRef, StandaloneComponent } from "../../core";
3
- import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
2
+ import { Componentable, StandaloneComponent } from "../../core";
3
+ import { CompatibleOutputRef, NumberOutputContextRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
4
4
  type NumericValue = number;
5
5
  /**
6
6
  * Свойства компонента вывода числа.
@@ -9,18 +9,18 @@ export type NumberProperties = {} & OutputProperties;
9
9
  /**
10
10
  * Конфигурация инициализации компонента вывода числа.
11
11
  */
12
- export type NumberInitConfig<ComponentType extends Componentable = Number, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends NumberProperties = NumberProperties> = {} & OutputInitConfig<NumericValue, ComponentType, RefType, PropertiesType>;
13
- type DefaultInitConfigType<RefType extends ContextRef<any, any>> = NumberInitConfig<Number, RefType>;
14
- type NumberValueOrRef<RefType extends ContextRef<any, any>> = NumericValue | CompatibleOutputRef<NumericValue, RefType>;
15
- export declare function number<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: NumberValueOrRef<RefType>): Number<RefType>;
16
- export declare function number<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: NumberValueOrRef<RefType>): Number<RefType>;
17
- export declare function number<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: NumberInitConfig<Number, RefType>): Number<RefType>;
12
+ export type NumberInitConfig<ComponentType extends Componentable = Number, RefType extends NumberOutputContextRef = NumberOutputContextRef, PropertiesType extends NumberProperties = NumberProperties> = {} & OutputInitConfig<NumericValue, ComponentType, RefType, PropertiesType>;
13
+ type DefaultInitConfigType<RefType extends NumberOutputContextRef> = NumberInitConfig<Number, RefType>;
14
+ type NumberValueOrRef<RefType extends NumberOutputContextRef> = NumericValue | CompatibleOutputRef<NumericValue, RefType>;
15
+ export declare function number<RefType extends NumberOutputContextRef = NumberOutputContextRef>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: NumberValueOrRef<RefType>): Number<RefType>;
16
+ export declare function number<RefType extends NumberOutputContextRef = NumberOutputContextRef>(valueOrRef: NumberValueOrRef<RefType>): Number<RefType>;
17
+ export declare function number<RefType extends NumberOutputContextRef = NumberOutputContextRef>(config: NumberInitConfig<Number, RefType>): Number<RefType>;
18
18
  /**
19
19
  * Компонент для вывода числа. Поддерживает вывод вещественных чисел и разделение на порядки с учетом локали клиента
20
20
  *
21
21
  * Наследуется от {@link OutputComponent}.
22
22
  */
23
- export declare class Number<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends NumberProperties = NumberProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
23
+ export declare class Number<RefType extends NumberOutputContextRef = NumberOutputContextRef, PropertiesType extends NumberProperties = NumberProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
24
24
  constructor(config: DefaultInitConfigType<RefType>);
25
25
  /**
26
26
  * Возвращает идентификатор типа вывода.
@@ -1,4 +1,4 @@
1
- import { Componentable, ContextRef, ContextRefValue, StandaloneComponent } from "../../core";
1
+ import { Componentable, ContextRefValue, ContextValueRef, StandaloneComponent } from "../../core";
2
2
  import { Component, ComponentInitConfig, ComponentProperties } from "../component";
3
3
  /**
4
4
  * Конфигурация инициализации для компонента вывода.
@@ -8,9 +8,14 @@ import { Component, ComponentInitConfig, ComponentProperties } from "../componen
8
8
  * @property ref Ссылка на значение в контексте, откуда будет браться значение.
9
9
  * @property value Статическое значение.
10
10
  */
11
- type RefCompatibleValue<ValueType> = Exclude<ValueType, ContextRef<any, any>>;
12
- export type CompatibleOutputRef<ValueType, RefType extends ContextRef<any, any>> = RefCompatibleValue<ValueType> extends ContextRefValue<RefType> ? RefType : never;
13
- export type OutputInitConfig<ValueType, ComponentType extends Componentable = OutputComponent, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends OutputProperties = OutputProperties> = ({
11
+ /** Ref на поле вывода (`ContextValueRef` для скalar `ValueType` компонента). */
12
+ export type OutputContextRef<ValueType> = ContextValueRef<ValueType | undefined>;
13
+ /** Ref на строковое поле вывода. */
14
+ export type StringOutputContextRef = OutputContextRef<string>;
15
+ /** Ref на числовое поле вывода. */
16
+ export type NumberOutputContextRef = OutputContextRef<number>;
17
+ export type CompatibleOutputRef<ValueType, RefType extends OutputContextRef<ValueType>> = ValueType extends ContextRefValue<RefType> ? RefType : never;
18
+ export type OutputInitConfig<ValueType, ComponentType extends Componentable = OutputComponent, RefType extends OutputContextRef<ValueType> = OutputContextRef<ValueType>, PropertiesType extends OutputProperties = OutputProperties> = ({
14
19
  ref: CompatibleOutputRef<ValueType, RefType>;
15
20
  } | {
16
21
  value: ValueType;
@@ -51,7 +56,7 @@ export declare abstract class OutputComponent<InitConfigType extends OutputInitC
51
56
  * Первая аргумент-мост для фабрик output: литерал `value` или экземпляр {@link ContextRef}.
52
57
  */
53
58
  export declare function outputValueRefToConfig<TOpts extends object>(valueOrRef: unknown, opts: TOpts): TOpts & ({
54
- ref: ContextRef<any, any>;
59
+ ref: ContextValueRef<unknown>;
55
60
  } | {
56
61
  value: unknown;
57
62
  });