@novasamatech/host-api 0.6.1 → 0.6.3

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.
@@ -4,7 +4,7 @@ export declare const Size: Codec<number | bigint>;
4
4
  export declare const Dimensions: Codec<[number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined]>;
5
5
  export declare const TypographyStyle: Codec<"titleXL" | "headline" | "bodyM" | "bodyS" | "caption">;
6
6
  export declare const ButtonVariant: Codec<"primary" | "secondary" | "text">;
7
- export declare const ColorToken: Codec<"textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning">;
7
+ export declare const ColorToken: Codec<"error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning">;
8
8
  export declare const ContentAlignment: Codec<"topStart" | "topCenter" | "topEnd" | "centerStart" | "center" | "centerEnd" | "bottomStart" | "bottomCenter" | "bottomEnd">;
9
9
  export declare const HorizontalAlignment: Codec<"center" | "start" | "end">;
10
10
  export declare const VerticalAlignment: Codec<"center" | "top" | "bottom">;
@@ -18,7 +18,7 @@ export declare const Shape: Codec<{
18
18
  }>;
19
19
  export declare const BorderStyle: Codec<{
20
20
  width: number | bigint;
21
- color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning";
21
+ color: "error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning";
22
22
  shape: {
23
23
  tag: "Rounded";
24
24
  value: number | bigint;
@@ -27,11 +27,19 @@ export declare const BorderStyle: Codec<{
27
27
  value: undefined;
28
28
  } | undefined;
29
29
  }>;
30
- export declare const Modifiers: Codec<{
31
- margin: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
32
- padding: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
33
- background: {
34
- color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning";
30
+ export declare const Modifier: Codec<{
31
+ tag: "width";
32
+ value: number | bigint;
33
+ } | {
34
+ tag: "margin";
35
+ value: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined];
36
+ } | {
37
+ tag: "padding";
38
+ value: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined];
39
+ } | {
40
+ tag: "background";
41
+ value: {
42
+ color: "error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning";
35
43
  shape: {
36
44
  tag: "Rounded";
37
45
  value: number | bigint;
@@ -39,10 +47,12 @@ export declare const Modifiers: Codec<{
39
47
  tag: "Circle";
40
48
  value: undefined;
41
49
  } | undefined;
42
- } | undefined;
43
- border: {
50
+ };
51
+ } | {
52
+ tag: "border";
53
+ value: {
44
54
  width: number | bigint;
45
- color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning";
55
+ color: "error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning";
46
56
  shape: {
47
57
  tag: "Rounded";
48
58
  value: number | bigint;
@@ -50,13 +60,22 @@ export declare const Modifiers: Codec<{
50
60
  tag: "Circle";
51
61
  value: undefined;
52
62
  } | undefined;
53
- } | undefined;
54
- height: number | bigint | undefined;
55
- width: number | bigint | undefined;
56
- minWidth: number | bigint | undefined;
57
- minHeight: number | bigint | undefined;
58
- fillWidth: boolean | undefined;
59
- fillHeight: boolean | undefined;
63
+ };
64
+ } | {
65
+ tag: "height";
66
+ value: number | bigint;
67
+ } | {
68
+ tag: "minWidth";
69
+ value: number | bigint;
70
+ } | {
71
+ tag: "minHeight";
72
+ value: number | bigint;
73
+ } | {
74
+ tag: "fillWidth";
75
+ value: boolean;
76
+ } | {
77
+ tag: "fillHeight";
78
+ value: boolean;
60
79
  }>;
61
80
  type EnumVariants<T> = {
62
81
  [K in keyof T]: {
@@ -66,11 +85,19 @@ type EnumVariants<T> = {
66
85
  }[keyof T];
67
86
  type ComponentType<Props extends Codec<any>> = CodecType<ReturnType<typeof Component<Props>>>;
68
87
  declare function Component<Props extends Codec<any>>(props: Props): Codec<{
69
- modifiers: {
70
- margin: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
71
- padding: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
72
- background: {
73
- color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning";
88
+ modifiers: ({
89
+ tag: "width";
90
+ value: number | bigint;
91
+ } | {
92
+ tag: "margin";
93
+ value: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined];
94
+ } | {
95
+ tag: "padding";
96
+ value: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined];
97
+ } | {
98
+ tag: "background";
99
+ value: {
100
+ color: "error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning";
74
101
  shape: {
75
102
  tag: "Rounded";
76
103
  value: number | bigint;
@@ -78,10 +105,12 @@ declare function Component<Props extends Codec<any>>(props: Props): Codec<{
78
105
  tag: "Circle";
79
106
  value: undefined;
80
107
  } | undefined;
81
- } | undefined;
82
- border: {
108
+ };
109
+ } | {
110
+ tag: "border";
111
+ value: {
83
112
  width: number | bigint;
84
- color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning";
113
+ color: "error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning";
85
114
  shape: {
86
115
  tag: "Rounded";
87
116
  value: number | bigint;
@@ -89,14 +118,23 @@ declare function Component<Props extends Codec<any>>(props: Props): Codec<{
89
118
  tag: "Circle";
90
119
  value: undefined;
91
120
  } | undefined;
92
- } | undefined;
93
- height: number | bigint | undefined;
94
- width: number | bigint | undefined;
95
- minWidth: number | bigint | undefined;
96
- minHeight: number | bigint | undefined;
97
- fillWidth: boolean | undefined;
98
- fillHeight: boolean | undefined;
99
- } | undefined;
121
+ };
122
+ } | {
123
+ tag: "height";
124
+ value: number | bigint;
125
+ } | {
126
+ tag: "minWidth";
127
+ value: number | bigint;
128
+ } | {
129
+ tag: "minHeight";
130
+ value: number | bigint;
131
+ } | {
132
+ tag: "fillWidth";
133
+ value: boolean;
134
+ } | {
135
+ tag: "fillHeight";
136
+ value: boolean;
137
+ })[];
100
138
  props: CodecType<Props>;
101
139
  children: CustomRendererNodeType[];
102
140
  }>;
@@ -113,16 +151,17 @@ export declare const RowProps: Codec<{
113
151
  }>;
114
152
  export declare const TextProps: Codec<{
115
153
  style: "titleXL" | "headline" | "bodyM" | "bodyS" | "caption" | undefined;
116
- color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning" | undefined;
154
+ color: "error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning" | undefined;
117
155
  }>;
118
156
  export declare const ButtonProps: Codec<{
157
+ text: string;
119
158
  variant: "primary" | "secondary" | "text" | undefined;
120
159
  enabled: boolean | undefined;
121
160
  loading: boolean | undefined;
122
161
  clickAction: string | undefined;
123
162
  }>;
124
163
  export declare const TextFieldProps: Codec<{
125
- value: string | undefined;
164
+ text: string;
126
165
  placeholder: string | undefined;
127
166
  label: string | undefined;
128
167
  enabled: boolean | undefined;
@@ -18,25 +18,25 @@ export const BorderStyle = Struct({
18
18
  color: ColorToken,
19
19
  shape: Option(Shape),
20
20
  });
21
- export const Modifiers = Struct({
22
- margin: Option(Dimensions),
23
- padding: Option(Dimensions),
24
- background: Option(Struct({
21
+ export const Modifier = Enum({
22
+ margin: Dimensions,
23
+ padding: Dimensions,
24
+ background: Struct({
25
25
  color: ColorToken,
26
26
  shape: Option(Shape),
27
- })),
28
- border: Option(BorderStyle),
29
- height: Option(Size),
30
- width: Option(Size),
31
- minWidth: Option(Size),
32
- minHeight: Option(Size),
33
- fillWidth: Option(bool),
34
- fillHeight: Option(bool),
27
+ }),
28
+ border: BorderStyle,
29
+ height: Size,
30
+ width: Size,
31
+ minWidth: Size,
32
+ minHeight: Size,
33
+ fillWidth: bool,
34
+ fillHeight: bool,
35
35
  });
36
36
  const Children = lazy(() => CustomRendererNode);
37
37
  function Component(props) {
38
38
  return Struct({
39
- modifiers: Option(Modifiers),
39
+ modifiers: Vector(Modifier),
40
40
  props: props,
41
41
  children: Vector(Children),
42
42
  });
@@ -57,13 +57,14 @@ export const TextProps = Struct({
57
57
  color: Option(ColorToken),
58
58
  });
59
59
  export const ButtonProps = Struct({
60
+ text: str,
60
61
  variant: Option(ButtonVariant),
61
62
  enabled: Option(bool),
62
63
  loading: Option(bool),
63
64
  clickAction: Option(str),
64
65
  });
65
66
  export const TextFieldProps = Struct({
66
- value: Option(str),
67
+ text: str,
67
68
  placeholder: Option(str),
68
69
  label: Option(str),
69
70
  enabled: Option(bool),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@novasamatech/host-api",
3
3
  "type": "module",
4
- "version": "0.6.1",
4
+ "version": "0.6.3",
5
5
  "description": "Host API: transport implementation for host - product integration.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "README.md"
22
22
  ],
23
23
  "dependencies": {
24
- "@novasamatech/scale": "0.6.1",
24
+ "@novasamatech/scale": "0.6.3",
25
25
  "@polkadot-api/utils": "^0.2.0",
26
26
  "nanoevents": "9.1.0",
27
27
  "nanoid": "5.1.6",