@fugood/bricks-ctor 2.24.0-beta.40

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 (129) hide show
  1. package/compile/action-name-map.ts +988 -0
  2. package/compile/index.ts +1245 -0
  3. package/compile/util.ts +358 -0
  4. package/index.ts +6 -0
  5. package/package.json +28 -0
  6. package/skills/bricks-design/LICENSE.txt +180 -0
  7. package/skills/bricks-design/SKILL.md +66 -0
  8. package/skills/bricks-project/SKILL.md +32 -0
  9. package/skills/bricks-project/rules/animation.md +159 -0
  10. package/skills/bricks-project/rules/architecture-patterns.md +69 -0
  11. package/skills/bricks-project/rules/automations.md +221 -0
  12. package/skills/bricks-project/rules/buttress.md +156 -0
  13. package/skills/bricks-project/rules/data-calculation.md +208 -0
  14. package/skills/bricks-project/rules/local-sync.md +129 -0
  15. package/skills/bricks-project/rules/media-flow.md +158 -0
  16. package/skills/bricks-project/rules/remote-data-bank.md +196 -0
  17. package/skills/bricks-project/rules/standby-transition.md +124 -0
  18. package/skills/rive-marketplace/SKILL.md +99 -0
  19. package/tools/deploy.ts +151 -0
  20. package/tools/icons/.gitattributes +1 -0
  21. package/tools/icons/fa6pro-glyphmap.json +4686 -0
  22. package/tools/icons/fa6pro-meta.json +3671 -0
  23. package/tools/mcp-server.ts +28 -0
  24. package/tools/mcp-tools/compile.ts +91 -0
  25. package/tools/mcp-tools/huggingface.ts +762 -0
  26. package/tools/mcp-tools/icons.ts +70 -0
  27. package/tools/mcp-tools/lottie.ts +102 -0
  28. package/tools/mcp-tools/media.ts +110 -0
  29. package/tools/postinstall.ts +229 -0
  30. package/tools/preview-main.mjs +293 -0
  31. package/tools/preview.ts +143 -0
  32. package/tools/pull.ts +116 -0
  33. package/tsconfig.json +16 -0
  34. package/types/animation.ts +100 -0
  35. package/types/automation.ts +235 -0
  36. package/types/brick-base.ts +80 -0
  37. package/types/bricks/Camera.ts +246 -0
  38. package/types/bricks/Chart.ts +372 -0
  39. package/types/bricks/GenerativeMedia.ts +276 -0
  40. package/types/bricks/Icon.ts +98 -0
  41. package/types/bricks/Image.ts +114 -0
  42. package/types/bricks/Items.ts +476 -0
  43. package/types/bricks/Lottie.ts +168 -0
  44. package/types/bricks/Maps.ts +262 -0
  45. package/types/bricks/QrCode.ts +117 -0
  46. package/types/bricks/Rect.ts +150 -0
  47. package/types/bricks/RichText.ts +128 -0
  48. package/types/bricks/Rive.ts +220 -0
  49. package/types/bricks/Slideshow.ts +201 -0
  50. package/types/bricks/Svg.ts +99 -0
  51. package/types/bricks/Text.ts +148 -0
  52. package/types/bricks/TextInput.ts +242 -0
  53. package/types/bricks/Video.ts +175 -0
  54. package/types/bricks/VideoStreaming.ts +112 -0
  55. package/types/bricks/WebRtcStream.ts +65 -0
  56. package/types/bricks/WebView.ts +168 -0
  57. package/types/bricks/index.ts +21 -0
  58. package/types/canvas.ts +82 -0
  59. package/types/common.ts +144 -0
  60. package/types/data-calc-command.ts +7005 -0
  61. package/types/data-calc-script.ts +21 -0
  62. package/types/data-calc.ts +11 -0
  63. package/types/data.ts +95 -0
  64. package/types/generators/AlarmClock.ts +110 -0
  65. package/types/generators/Assistant.ts +621 -0
  66. package/types/generators/BleCentral.ts +247 -0
  67. package/types/generators/BlePeripheral.ts +208 -0
  68. package/types/generators/CanvasMap.ts +74 -0
  69. package/types/generators/CastlesPay.ts +87 -0
  70. package/types/generators/DataBank.ts +160 -0
  71. package/types/generators/File.ts +432 -0
  72. package/types/generators/GraphQl.ts +132 -0
  73. package/types/generators/Http.ts +222 -0
  74. package/types/generators/HttpServer.ts +176 -0
  75. package/types/generators/Information.ts +103 -0
  76. package/types/generators/Intent.ts +168 -0
  77. package/types/generators/Iterator.ts +108 -0
  78. package/types/generators/Keyboard.ts +105 -0
  79. package/types/generators/LlmAnthropicCompat.ts +212 -0
  80. package/types/generators/LlmAppleBuiltin.ts +159 -0
  81. package/types/generators/LlmGgml.ts +861 -0
  82. package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
  83. package/types/generators/LlmMlx.ts +227 -0
  84. package/types/generators/LlmOnnx.ts +213 -0
  85. package/types/generators/LlmOpenAiCompat.ts +244 -0
  86. package/types/generators/LlmQualcommAiEngine.ts +247 -0
  87. package/types/generators/Mcp.ts +637 -0
  88. package/types/generators/McpServer.ts +289 -0
  89. package/types/generators/MediaFlow.ts +170 -0
  90. package/types/generators/MqttBroker.ts +141 -0
  91. package/types/generators/MqttClient.ts +141 -0
  92. package/types/generators/Question.ts +408 -0
  93. package/types/generators/RealtimeTranscription.ts +279 -0
  94. package/types/generators/RerankerGgml.ts +191 -0
  95. package/types/generators/SerialPort.ts +151 -0
  96. package/types/generators/SoundPlayer.ts +94 -0
  97. package/types/generators/SoundRecorder.ts +130 -0
  98. package/types/generators/SpeechToTextGgml.ts +415 -0
  99. package/types/generators/SpeechToTextOnnx.ts +236 -0
  100. package/types/generators/SpeechToTextPlatform.ts +85 -0
  101. package/types/generators/SqLite.ts +159 -0
  102. package/types/generators/Step.ts +107 -0
  103. package/types/generators/SttAppleBuiltin.ts +130 -0
  104. package/types/generators/Tcp.ts +126 -0
  105. package/types/generators/TcpServer.ts +147 -0
  106. package/types/generators/TextToSpeechAppleBuiltin.ts +127 -0
  107. package/types/generators/TextToSpeechGgml.ts +221 -0
  108. package/types/generators/TextToSpeechOnnx.ts +178 -0
  109. package/types/generators/TextToSpeechOpenAiLike.ts +121 -0
  110. package/types/generators/ThermalPrinter.ts +191 -0
  111. package/types/generators/Tick.ts +83 -0
  112. package/types/generators/Udp.ts +120 -0
  113. package/types/generators/VadGgml.ts +250 -0
  114. package/types/generators/VadOnnx.ts +231 -0
  115. package/types/generators/VadTraditional.ts +138 -0
  116. package/types/generators/VectorStore.ts +257 -0
  117. package/types/generators/Watchdog.ts +107 -0
  118. package/types/generators/WebCrawler.ts +103 -0
  119. package/types/generators/WebRtc.ts +181 -0
  120. package/types/generators/WebSocket.ts +148 -0
  121. package/types/generators/index.ts +57 -0
  122. package/types/index.ts +13 -0
  123. package/types/subspace.ts +59 -0
  124. package/types/switch.ts +51 -0
  125. package/types/system.ts +707 -0
  126. package/utils/calc.ts +126 -0
  127. package/utils/data.ts +497 -0
  128. package/utils/event-props.ts +836 -0
  129. package/utils/id.ts +80 -0
@@ -0,0 +1,148 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Display styled text with font, color, alignment, and truncation controls
4
+ */
5
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
+ import type { Data, DataLink } from '../data'
7
+ import type { Animation, AnimationBasicEvents } from '../animation'
8
+ import type {
9
+ Brick,
10
+ EventAction,
11
+ EventActionForItem,
12
+ ActionWithDataParams,
13
+ ActionWithParams,
14
+ Action,
15
+ EventProperty,
16
+ } from '../common'
17
+ import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
18
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
19
+
20
+ interface BrickTextDef {
21
+ /*
22
+ Default property:
23
+ {
24
+ "text": "",
25
+ "templateType": "${}",
26
+ "color": "#000",
27
+ "fontWeight": "normal",
28
+ "fontStyle": "normal",
29
+ "fontPadding": true,
30
+ "fontSizeVector": 0.5,
31
+ "lineNumber": 1,
32
+ "textAlign": "center",
33
+ "textAlignVertical": "center"
34
+ }
35
+ */
36
+ property?: BrickBasicProperty & {
37
+ /* The text content */
38
+ text?: string | DataLink | number | DataLink | boolean | DataLink | string | DataLink | DataLink
39
+ /* Data to be used in the text template (e.g. `Hello ${name}`). Supports nested data, such as `Hello ${user.name}`. */
40
+ templateData?: {} | DataLink
41
+ /* The text template type */
42
+ templateType?: '${}' | '{{}}' | DataLink
43
+ /* The text replacement (Regular Expression), can be multiple. */
44
+ replace?:
45
+ | Array<
46
+ | DataLink
47
+ | {
48
+ regex?: string | DataLink
49
+ replaceWith?: string | DataLink
50
+ }
51
+ >
52
+ | DataLink
53
+ /* The text color */
54
+ color?: string | DataLink
55
+ /* Specifies font weight. The values 'normal' and are supported for most fonts. Not all fonts have a variant for each of the numeric values, in that case the closest one is chosen. */
56
+ fontWeight?:
57
+ | 'normal'
58
+ | 'bold'
59
+ | '100'
60
+ | '200'
61
+ | '300'
62
+ | '400'
63
+ | '500'
64
+ | '600'
65
+ | '700'
66
+ | '800'
67
+ | '900'
68
+ | DataLink
69
+ /* The text font style */
70
+ fontStyle?: 'normal' | 'italic' | DataLink
71
+ /* The text font family */
72
+ fontFamily?: string | DataLink
73
+ /* [Android only] Set to No to remove extra font padding intended to make space for certain ascenders / descenders. */
74
+ fontPadding?: boolean | DataLink
75
+ /* The text font size (grid) */
76
+ fontSize?: number | DataLink
77
+ /* The text font size vector. If the font size is not specified, the font size will be calculated by the height of the text box. */
78
+ fontSizeVector?: number | DataLink
79
+ /* The text letter spacing (grid) */
80
+ letterSpacing?: number | DataLink
81
+ /* The line height of text content (grid) */
82
+ lineHeight?: number | DataLink
83
+ /* The line number limit of text content */
84
+ lineNumber?: number | DataLink
85
+ /* The text align */
86
+ textAlign?: 'auto' | 'left' | 'right' | 'center' | 'justify' | DataLink
87
+ /* The text align vertical */
88
+ textAlignVertical?: 'auto' | 'top' | 'bottom' | 'center' | DataLink
89
+ /* Enable vertical rendering */
90
+ verticalRendering?: boolean | DataLink
91
+ }
92
+ events?: BrickBasicEvents & {
93
+ /* Event of the brick press */
94
+ onPress?: Array<EventAction>
95
+ /* Event of the brick press in */
96
+ onPressIn?: Array<EventAction>
97
+ /* Event of the brick press out */
98
+ onPressOut?: Array<EventAction>
99
+ /* Event of the brick long press */
100
+ onLongPress?: Array<EventAction>
101
+ /* Event of the brick focus (Use TV Device with controller) */
102
+ onFocus?: Array<EventAction>
103
+ /* Event of the brick blur (Use TV Device with controller) */
104
+ onBlur?: Array<EventAction>
105
+ /* Event of the text content on change start */
106
+ beforeValueChange?: Array<EventAction>
107
+ /* Event of the text content on change end */
108
+ valueChange?: Array<EventAction>
109
+ }
110
+ outlets?: {
111
+ /* Brick is pressing */
112
+ brickPressing?: () => Data<boolean>
113
+ /* Brick is focusing (Use TV Device with controller) */
114
+ brickFocusing?: () => Data<boolean>
115
+ }
116
+ animation?: AnimationBasicEvents & {
117
+ onPress?: Animation
118
+ onPressIn?: Animation
119
+ onPressOut?: Animation
120
+ onLongPress?: Animation
121
+ onFocus?: Animation
122
+ onBlur?: Animation
123
+ beforeValueChange?: Animation
124
+ valueChange?: Animation
125
+ }
126
+ }
127
+
128
+ /* Display styled text with font, color, alignment, and truncation controls */
129
+ export type BrickText = Brick &
130
+ BrickTextDef & {
131
+ templateKey: 'BRICK_TEXT'
132
+ switches?: Array<
133
+ SwitchDef &
134
+ BrickTextDef & {
135
+ conds?: Array<{
136
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
137
+ cond:
138
+ | SwitchCondInnerStateCurrentCanvas
139
+ | SwitchCondData
140
+ | {
141
+ __typename: 'SwitchCondInnerStateOutlet'
142
+ outlet: 'brickPressing' | 'brickFocusing'
143
+ value: any
144
+ }
145
+ }>
146
+ }
147
+ >
148
+ }
@@ -0,0 +1,242 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Editable text input field with keyboard type, placeholder, and validation support
4
+ */
5
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
+ import type { Data, DataLink } from '../data'
7
+ import type { Animation, AnimationBasicEvents } from '../animation'
8
+ import type {
9
+ Brick,
10
+ EventAction,
11
+ EventActionForItem,
12
+ ActionWithDataParams,
13
+ ActionWithParams,
14
+ Action,
15
+ EventProperty,
16
+ } from '../common'
17
+ import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
18
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
19
+
20
+ /* Focus TextInput */
21
+ export type BrickTextInputActionFocus = Action & {
22
+ __actionName: 'BRICK_TEXT_INPUT_FOCUS'
23
+ }
24
+
25
+ /* Blur TextInput */
26
+ export type BrickTextInputActionBlur = Action & {
27
+ __actionName: 'BRICK_TEXT_INPUT_BLUR'
28
+ }
29
+
30
+ /* Clear TextInput */
31
+ export type BrickTextInputActionClear = Action & {
32
+ __actionName: 'BRICK_TEXT_INPUT_CLEAR'
33
+ }
34
+
35
+ /* Reset TextInput to default value */
36
+ export type BrickTextInputActionResetToDefault = Action & {
37
+ __actionName: 'BRICK_TEXT_INPUT_RESET_TO_DEFAULT'
38
+ }
39
+
40
+ /* Focus the input and select text with regex or start/end */
41
+ export type BrickTextInputActionSelectText = ActionWithParams & {
42
+ __actionName: 'BRICK_TEXT_INPUT_SELECT_TEXT'
43
+ params?: Array<
44
+ | {
45
+ input: 'regex'
46
+ value?: string | DataLink | EventProperty
47
+ mapping?: string
48
+ }
49
+ | {
50
+ input: 'start'
51
+ value?: number | DataLink | EventProperty
52
+ mapping?: string
53
+ }
54
+ | {
55
+ input: 'end'
56
+ value?: number | DataLink | EventProperty
57
+ mapping?: string
58
+ }
59
+ >
60
+ }
61
+
62
+ /* Set text value of the TextInput */
63
+ export type BrickTextInputActionSetText = ActionWithParams & {
64
+ __actionName: 'BRICK_TEXT_INPUT_SET_TEXT'
65
+ params?: Array<{
66
+ input: 'text'
67
+ value?: string | DataLink | EventProperty
68
+ mapping?: string
69
+ }>
70
+ }
71
+
72
+ /* Append text value of the TextInput */
73
+ export type BrickTextInputActionAppendText = ActionWithParams & {
74
+ __actionName: 'BRICK_TEXT_INPUT_APPEND_TEXT'
75
+ params?: Array<{
76
+ input: 'text'
77
+ value?: string | DataLink | EventProperty
78
+ mapping?: string
79
+ }>
80
+ }
81
+
82
+ /* Trigger regex */
83
+ export type BrickTextInputActionTrySubmit = Action & {
84
+ __actionName: 'BRICK_TEXT_INPUT_TRY_SUBMIT'
85
+ }
86
+
87
+ interface BrickTextInputDef {
88
+ /*
89
+ Default property:
90
+ {
91
+ "editable": true,
92
+ "defaultValue": "",
93
+ "color": "#000",
94
+ "fontWeight": "normal",
95
+ "fontStyle": "normal",
96
+ "fontSizeVector": 0.5,
97
+ "lineNumber": 1,
98
+ "textAlign": "center",
99
+ "textAlignVertical": "center",
100
+ "keyboardType": "default",
101
+ "returnKeyType": "done"
102
+ }
103
+ */
104
+ property?: BrickBasicProperty & {
105
+ /* Allow to edit */
106
+ editable?: boolean | DataLink
107
+ /* The default value of the text input */
108
+ defaultValue?: string | DataLink
109
+ /* The text color */
110
+ color?: string | DataLink
111
+ /* Specifies font weight. The values 'normal' and are supported for most fonts. Not all fonts have a variant for each of the numeric values, in that case the closest one is chosen. */
112
+ fontWeight?:
113
+ | 'normal'
114
+ | 'bold'
115
+ | '100'
116
+ | '200'
117
+ | '300'
118
+ | '400'
119
+ | '500'
120
+ | '600'
121
+ | '700'
122
+ | '800'
123
+ | '900'
124
+ | DataLink
125
+ /* The text font style */
126
+ fontStyle?: 'normal' | 'italic' | DataLink
127
+ /* The text font family */
128
+ fontFamily?: string | DataLink
129
+ /* The text font size (grid) */
130
+ fontSize?: number | DataLink
131
+ /* The text font size vector. If the font size is not specified, the font size will be calculated by the height of the text box. */
132
+ fontSizeVector?: number | DataLink
133
+ /* The text letter spacing (grid) */
134
+ letterSpacing?: number | DataLink
135
+ /* The line height of text content (grid) */
136
+ lineHeight?: number | DataLink
137
+ /* The line number limit of text content (Use 0 to unlimited) */
138
+ lineNumber?: number | DataLink
139
+ /* The text align */
140
+ textAlign?: 'auto' | 'left' | 'right' | 'center' | 'justify' | DataLink
141
+ /* The text align vertical */
142
+ textAlignVertical?: 'auto' | 'top' | 'bottom' | 'center' | DataLink
143
+ /* The placeholder text */
144
+ placeholder?: string | DataLink
145
+ /* Color of the placeholder text */
146
+ placeholderTextColor?: string | DataLink
147
+ /* Limits the maximum number of characters that can be entered */
148
+ maxLength?: number | DataLink
149
+ /* The virtual keyboard type */
150
+ keyboardType?:
151
+ | 'default'
152
+ | 'number-pad'
153
+ | 'decimal-pad'
154
+ | 'numeric'
155
+ | 'email-address'
156
+ | 'phone-pad'
157
+ | DataLink
158
+ /* The virtual keyboard return key type The line number should be 1. */
159
+ returnKeyType?: 'done' | 'go' | 'next' | 'search' | 'send' | DataLink
160
+ /* Trigger event on input change after debounce time */
161
+ debounce?: number | DataLink
162
+ /* Regular Expression to match */
163
+ regex?: string | DataLink
164
+ /* The regex matching complete mode */
165
+ completeMode?: 'allMatch' | 'oneMatch' | DataLink
166
+ /* Auto submit when regex match */
167
+ autoSubmitWhenMatch?: boolean | DataLink
168
+ /* Blur TextInput on submit */
169
+ blurOnSubmit?: boolean | DataLink
170
+ }
171
+ events?: BrickBasicEvents & {
172
+ /* Event of the TextInput is focused */
173
+ onFocus?: Array<EventAction>
174
+ /* Event of the input field is blurred */
175
+ onBlur?: Array<EventAction>
176
+ /* Event of the TextInput is empty */
177
+ onEmpty?: Array<EventAction>
178
+ /* Event of the TextInput value change */
179
+ onChange?: Array<EventAction<string & keyof TemplateEventPropsMap['TextInput']['onChange']>>
180
+ /* Event of the TextInput submit */
181
+ onSubmit?: Array<EventAction<string & keyof TemplateEventPropsMap['TextInput']['onSubmit']>>
182
+ /* Event of the TextInput match regex (check every value change) */
183
+ onMatch?: Array<EventAction<string & keyof TemplateEventPropsMap['TextInput']['onMatch']>>
184
+ /* Event of the TextInput not match regex (check every value change) */
185
+ onNotMatch?: Array<EventAction<string & keyof TemplateEventPropsMap['TextInput']['onNotMatch']>>
186
+ /* Event of the TextInput not match regex (check every submit) */
187
+ onResultNotMatch?: Array<
188
+ EventAction<string & keyof TemplateEventPropsMap['TextInput']['onResultNotMatch']>
189
+ >
190
+ /* Event of the TextInput reach max length or match regex */
191
+ onFullFill?: Array<EventAction>
192
+ }
193
+ outlets?: {
194
+ /* The raw input */
195
+ rawInput?: () => Data<any>
196
+ /* The regex result */
197
+ resultVariable?: () => Data<{ [key: string]: any }>
198
+ /* Last key in */
199
+ lastKey?: () => Data<any>
200
+ /* Selection of the TextInput (start, end, text) */
201
+ selection?: () => Data<{
202
+ start?: number
203
+ end?: number
204
+ text?: string
205
+ }>
206
+ /* Selection text of the TextInput */
207
+ selectionText?: () => Data<string>
208
+ }
209
+ animation?: AnimationBasicEvents & {
210
+ onFocus?: Animation
211
+ onBlur?: Animation
212
+ onEmpty?: Animation
213
+ onChange?: Animation
214
+ onSubmit?: Animation
215
+ onMatch?: Animation
216
+ onNotMatch?: Animation
217
+ onResultNotMatch?: Animation
218
+ onFullFill?: Animation
219
+ }
220
+ }
221
+
222
+ /* Editable text input field with keyboard type, placeholder, and validation support */
223
+ export type BrickTextInput = Brick &
224
+ BrickTextInputDef & {
225
+ templateKey: 'BRICK_TEXT_INPUT'
226
+ switches?: Array<
227
+ SwitchDef &
228
+ BrickTextInputDef & {
229
+ conds?: Array<{
230
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
231
+ cond:
232
+ | SwitchCondInnerStateCurrentCanvas
233
+ | SwitchCondData
234
+ | {
235
+ __typename: 'SwitchCondInnerStateOutlet'
236
+ outlet: 'rawInput' | 'resultVariable' | 'lastKey' | 'selection' | 'selectionText'
237
+ value: any
238
+ }
239
+ }>
240
+ }
241
+ >
242
+ }
@@ -0,0 +1,175 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Video playback with play/pause controls and streaming support
4
+ */
5
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
+ import type { Data, DataLink } from '../data'
7
+ import type { Animation, AnimationBasicEvents } from '../animation'
8
+ import type {
9
+ Brick,
10
+ EventAction,
11
+ EventActionForItem,
12
+ ActionWithDataParams,
13
+ ActionWithParams,
14
+ Action,
15
+ EventProperty,
16
+ } from '../common'
17
+ import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
18
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
19
+
20
+ /* Play the video */
21
+ export type BrickVideoActionPlay = Action & {
22
+ __actionName: 'BRICK_VIDEO_PLAY'
23
+ }
24
+
25
+ /* Seek the video */
26
+ export type BrickVideoActionSeek = ActionWithParams & {
27
+ __actionName: 'BRICK_VIDEO_SEEK'
28
+ params?: Array<
29
+ | {
30
+ input: 'seekTime'
31
+ value?: number | DataLink | EventProperty
32
+ mapping?: string
33
+ }
34
+ | {
35
+ input: 'play'
36
+ value?: boolean | DataLink | EventProperty
37
+ mapping?: string
38
+ }
39
+ >
40
+ }
41
+
42
+ /* Pause the video */
43
+ export type BrickVideoActionPause = Action & {
44
+ __actionName: 'BRICK_VIDEO_PAUSE'
45
+ }
46
+
47
+ /* Replay the video */
48
+ export type BrickVideoActionReplay = Action & {
49
+ __actionName: 'BRICK_VIDEO_REPLAY'
50
+ }
51
+
52
+ /* Stop the video */
53
+ export type BrickVideoActionStop = Action & {
54
+ __actionName: 'BRICK_VIDEO_STOP'
55
+ }
56
+
57
+ interface BrickVideoDef {
58
+ /*
59
+ Default property:
60
+ {
61
+ "paused": false,
62
+ "volume": 100,
63
+ "muted": false,
64
+ "progressUpdateInterval": 1000,
65
+ "replayTimeout": 500,
66
+ "renderMode": "auto"
67
+ }
68
+ */
69
+ property?: BrickBasicProperty & {
70
+ /* The video path list or single path (File, URL) */
71
+ path?:
72
+ | string
73
+ | DataLink
74
+ | DataLink
75
+ | {
76
+ url?: string | DataLink
77
+ }
78
+ | Array<
79
+ | DataLink
80
+ | {
81
+ url?: string | DataLink
82
+ }
83
+ | string
84
+ | DataLink
85
+ | DataLink
86
+ >
87
+ | DataLink
88
+ | DataLink
89
+ /* The checksum of file */
90
+ md5?: string | DataLink
91
+ /* Controls whether the video is paused */
92
+ paused?: boolean | DataLink
93
+ /* Volume */
94
+ volume?: number | DataLink
95
+ /* Muted */
96
+ muted?: boolean | DataLink
97
+ /* Video resize mode */
98
+ resizeMode?: 'contain' | 'cover' | 'stretch' | DataLink
99
+ /* Repeat the video path list */
100
+ repeat?: boolean | DataLink
101
+ /* Progress Update Interval */
102
+ progressUpdateInterval?: number | DataLink
103
+ /* Replay on playing error */
104
+ replayOnError?: boolean | DataLink
105
+ /* Timeout to replay if repeat or replayOnError is true and video is end or error */
106
+ replayTimeout?: number | DataLink
107
+ /* Use what view type for render video (Auto / Texture or Surface). Notice: Although using surface has better performance, it also affects the Animation & Standby Transition used by itself */
108
+ renderMode?: 'auto' | 'texture' | 'surface' | DataLink
109
+ }
110
+ events?: BrickBasicEvents & {
111
+ /* Event of the brick press */
112
+ onPress?: Array<EventAction>
113
+ /* Event of the brick press in */
114
+ onPressIn?: Array<EventAction>
115
+ /* Event of the brick press out */
116
+ onPressOut?: Array<EventAction>
117
+ /* Event of the brick long press */
118
+ onLongPress?: Array<EventAction>
119
+ /* Event of the brick focus (Use TV Device with controller) */
120
+ onFocus?: Array<EventAction>
121
+ /* Event of the brick blur (Use TV Device with controller) */
122
+ onBlur?: Array<EventAction>
123
+ /* Event of the next video on change start */
124
+ nextVideo?: Array<EventAction<string & keyof TemplateEventPropsMap['Video']['nextVideo']>>
125
+ /* Event on plays of path are totally end */
126
+ roundEnd?: Array<EventAction>
127
+ /* Event on video load */
128
+ onLoad?: Array<EventAction>
129
+ /* Event of the video playing error */
130
+ onError?: Array<EventAction>
131
+ /* Event of the video progress interval */
132
+ onProgress?: Array<EventAction<string & keyof TemplateEventPropsMap['Video']['onProgress']>>
133
+ }
134
+ outlets?: {
135
+ /* Brick is pressing */
136
+ brickPressing?: () => Data<boolean>
137
+ /* Brick is focusing (Use TV Device with controller) */
138
+ brickFocusing?: () => Data<boolean>
139
+ }
140
+ animation?: AnimationBasicEvents & {
141
+ onPress?: Animation
142
+ onPressIn?: Animation
143
+ onPressOut?: Animation
144
+ onLongPress?: Animation
145
+ onFocus?: Animation
146
+ onBlur?: Animation
147
+ nextVideo?: Animation
148
+ roundEnd?: Animation
149
+ onLoad?: Animation
150
+ onError?: Animation
151
+ onProgress?: Animation
152
+ }
153
+ }
154
+
155
+ /* Video playback with play/pause controls and streaming support */
156
+ export type BrickVideo = Brick &
157
+ BrickVideoDef & {
158
+ templateKey: 'BRICK_VIDEO'
159
+ switches?: Array<
160
+ SwitchDef &
161
+ BrickVideoDef & {
162
+ conds?: Array<{
163
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
164
+ cond:
165
+ | SwitchCondInnerStateCurrentCanvas
166
+ | SwitchCondData
167
+ | {
168
+ __typename: 'SwitchCondInnerStateOutlet'
169
+ outlet: 'brickPressing' | 'brickFocusing'
170
+ value: any
171
+ }
172
+ }>
173
+ }
174
+ >
175
+ }
@@ -0,0 +1,112 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Brick video streaming component, supports RTSP / RTMP streaming.
4
+ */
5
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
+ import type { Data, DataLink } from '../data'
7
+ import type { Animation, AnimationBasicEvents } from '../animation'
8
+ import type {
9
+ Brick,
10
+ EventAction,
11
+ EventActionForItem,
12
+ ActionWithDataParams,
13
+ ActionWithParams,
14
+ Action,
15
+ EventProperty,
16
+ } from '../common'
17
+ import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
18
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
19
+
20
+ interface BrickVideoStreamingDef {
21
+ /*
22
+ Default property:
23
+ {
24
+ "networkCaching": 300,
25
+ "paused": false,
26
+ "volume": 100,
27
+ "muted": false,
28
+ "replayTimeout": 500
29
+ }
30
+ */
31
+ property?: BrickBasicProperty & {
32
+ /* The video path list or single path (File, URL) */
33
+ uri?: string | DataLink
34
+ /* Set cache time from streaming (You can adjust according to network conditions), it will delay the playing. */
35
+ networkCaching?: number | DataLink
36
+ /* Controls whether the video is paused */
37
+ paused?: boolean | DataLink
38
+ /* Volume */
39
+ volume?: number | DataLink
40
+ /* Muted */
41
+ muted?: boolean | DataLink
42
+ /* Video Auto Aspect Ratio */
43
+ autoAspectRatio?: boolean | DataLink
44
+ /* Video Aspect Ratio */
45
+ aspectRatio?: string | DataLink
46
+ /* Repeat the video path list */
47
+ repeat?: boolean | DataLink
48
+ /* Replay on playing error */
49
+ replayOnError?: boolean | DataLink
50
+ /* Timeout to replay if repeat or replayOnError is true and video is end or error */
51
+ replayTimeout?: number | DataLink
52
+ }
53
+ events?: BrickBasicEvents & {
54
+ /* Event of the brick press */
55
+ onPress?: Array<EventAction>
56
+ /* Event of the brick press in */
57
+ onPressIn?: Array<EventAction>
58
+ /* Event of the brick press out */
59
+ onPressOut?: Array<EventAction>
60
+ /* Event of the brick long press */
61
+ onLongPress?: Array<EventAction>
62
+ /* Event of the brick focus (Use TV Device with controller) */
63
+ onFocus?: Array<EventAction>
64
+ /* Event of the brick blur (Use TV Device with controller) */
65
+ onBlur?: Array<EventAction>
66
+ /* Event on plays of path are end */
67
+ onEnd?: Array<EventAction>
68
+ /* Event on plays of path are end */
69
+ onLoad?: Array<EventAction>
70
+ /* Event of the video playing error */
71
+ onError?: Array<EventAction>
72
+ }
73
+ outlets?: {
74
+ /* Brick is pressing */
75
+ brickPressing?: () => Data<boolean>
76
+ /* Brick is focusing (Use TV Device with controller) */
77
+ brickFocusing?: () => Data<boolean>
78
+ }
79
+ animation?: AnimationBasicEvents & {
80
+ onPress?: Animation
81
+ onPressIn?: Animation
82
+ onPressOut?: Animation
83
+ onLongPress?: Animation
84
+ onFocus?: Animation
85
+ onBlur?: Animation
86
+ onEnd?: Animation
87
+ onLoad?: Animation
88
+ onError?: Animation
89
+ }
90
+ }
91
+
92
+ /* Brick video streaming component, supports RTSP / RTMP streaming. */
93
+ export type BrickVideoStreaming = Brick &
94
+ BrickVideoStreamingDef & {
95
+ templateKey: 'BRICK_VIDEO_STREAMING'
96
+ switches?: Array<
97
+ SwitchDef &
98
+ BrickVideoStreamingDef & {
99
+ conds?: Array<{
100
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
101
+ cond:
102
+ | SwitchCondInnerStateCurrentCanvas
103
+ | SwitchCondData
104
+ | {
105
+ __typename: 'SwitchCondInnerStateOutlet'
106
+ outlet: 'brickPressing' | 'brickFocusing'
107
+ value: any
108
+ }
109
+ }>
110
+ }
111
+ >
112
+ }