@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,235 @@
1
+ /**
2
+ * Automation (Test) System Types
3
+ *
4
+ * This module defines TypeScript types for the BRICKS automation/testing system.
5
+ * The automation system allows defining automated test sequences that can be
6
+ * triggered on launch, anytime, or via cron schedules.
7
+ */
8
+
9
+ import type { Subspace } from './subspace'
10
+ import type { Brick, Generator } from './common'
11
+ import type { Canvas } from './canvas'
12
+ import type { Data } from './data'
13
+
14
+ // Entity reference types - can be string ID or getter function
15
+ export type SubspaceRef = string | (() => Subspace)
16
+ export type BrickRef = string | (() => Brick)
17
+ export type GeneratorRef = string | (() => Generator)
18
+ export type CanvasRef = string | (() => Canvas)
19
+ export type DataRef = string | (() => Data)
20
+
21
+ // Variable types for test variables
22
+ export type TestVariableType = 'string' | 'number' | 'array' | 'object' | 'bool' | 'any'
23
+
24
+ // Trigger types for when tests should run
25
+ export type TestTriggerType = 'launch' | 'anytime' | 'cron'
26
+
27
+ // Jump condition operators for conditional test flow
28
+ export type JumpConditionOperator = '==' | '!=' | '>' | '>=' | '<' | '<='
29
+
30
+ // Jump condition status types
31
+ export type JumpConditionStatus = 'finished' | 'failed'
32
+
33
+ // Jump condition types
34
+ export type JumpConditionType = 'status' | 'variable'
35
+
36
+ /**
37
+ * Jump condition for controlling test case flow
38
+ */
39
+ export interface TestCaseJumpCondition {
40
+ type: JumpConditionType
41
+ // For status-based conditions
42
+ status?: JumpConditionStatus
43
+ // For variable-based conditions
44
+ variable?: string
45
+ operator?: JumpConditionOperator
46
+ value?: any
47
+ // The test case to jump to (getter function for dynamic IDs or string for static IDs)
48
+ jump_to?: string | (() => TestCase)
49
+ }
50
+
51
+ /**
52
+ * Test variable definition
53
+ */
54
+ export interface TestVariable {
55
+ __typename: 'TestVariable'
56
+ id: string
57
+ name: string
58
+ type: TestVariableType
59
+ value: any
60
+ }
61
+
62
+ /**
63
+ * Post delay rules for test cases
64
+ */
65
+ export type PostDelayRule = 'include-action-time' | 'exclude-action-time'
66
+
67
+ /**
68
+ * Test method names (13 methods)
69
+ */
70
+ export type TestMethodName =
71
+ | 'brick_press'
72
+ | 'brick_exists'
73
+ | 'wait_until_brick_exists'
74
+ | 'wait_until_event_trigger'
75
+ | 'wait_until_canvas_change'
76
+ | 'keydown'
77
+ | 'keyup'
78
+ | 'http_request'
79
+ | 'assert_property'
80
+ | 'wait_until_property_change'
81
+ | 'execute_action'
82
+ | 'match_screenshot'
83
+ | 'delay'
84
+
85
+ /**
86
+ * Run array types for each test method
87
+ * Each method has a specific signature: [methodName, ...args]
88
+ */
89
+
90
+ // [methodName, subspaceId, brickId, options?]
91
+ export type TestMethodRunBrickPress = ['brick_press', SubspaceRef, BrickRef, Record<string, any>?]
92
+
93
+ // [methodName, subspaceId, brickId, frame?]
94
+ export type TestMethodRunBrickExists = ['brick_exists', SubspaceRef, BrickRef, Record<string, any>?]
95
+
96
+ // [methodName, subspaceId, brickId, timeout?, frame?]
97
+ export type TestMethodRunWaitUntilBrickExists = [
98
+ 'wait_until_brick_exists',
99
+ SubspaceRef,
100
+ BrickRef,
101
+ number?,
102
+ Record<string, any>?,
103
+ ]
104
+
105
+ // [methodName, subspaceId, senderId, eventKey, timeout?]
106
+ // senderId can be brick or generator
107
+ export type TestMethodRunWaitUntilEventTrigger = [
108
+ 'wait_until_event_trigger',
109
+ SubspaceRef,
110
+ BrickRef | GeneratorRef,
111
+ string,
112
+ number?,
113
+ ]
114
+
115
+ // [methodName, subspaceId, canvasId, timeout?]
116
+ export type TestMethodRunWaitUntilCanvasChange = [
117
+ 'wait_until_canvas_change',
118
+ SubspaceRef,
119
+ CanvasRef,
120
+ number?,
121
+ ]
122
+
123
+ // [methodName, keyCode, pressedKey?, flags?]
124
+ export type TestMethodRunKeydown = ['keydown', number, string?, number?]
125
+
126
+ // [methodName, keyCode, pressedKey?, flags?]
127
+ export type TestMethodRunKeyup = ['keyup', number, string?, number?]
128
+
129
+ // [methodName, url, options?]
130
+ export type TestMethodRunHttpRequest = ['http_request', string, Record<string, any>?]
131
+
132
+ // [methodName, subspaceId, propertyId, value]
133
+ export type TestMethodRunAssertProperty = ['assert_property', SubspaceRef, DataRef, any]
134
+
135
+ // [methodName, subspaceId, propertyId, value, timeout?]
136
+ export type TestMethodRunWaitUntilPropertyChange = [
137
+ 'wait_until_property_change',
138
+ SubspaceRef,
139
+ DataRef,
140
+ any,
141
+ number?,
142
+ ]
143
+
144
+ // [methodName, subspaceId, handler, action, params?, options?]
145
+ export type TestMethodRunExecuteAction = [
146
+ 'execute_action',
147
+ SubspaceRef,
148
+ string,
149
+ string,
150
+ Record<string, any>?,
151
+ Record<string, any>?,
152
+ ]
153
+
154
+ // [methodName, screenshotName, threshold?, maxRetry?]
155
+ export type TestMethodRunMatchScreenshot = ['match_screenshot', string, number?, number?]
156
+
157
+ // [methodName, subspaceId?, propertyId?, defaultValue?]
158
+ export type TestMethodRunDelay = ['delay', SubspaceRef?, DataRef?, number?]
159
+
160
+ /**
161
+ * Union type for all test method run arrays
162
+ */
163
+ export type TestMethodRun =
164
+ | TestMethodRunBrickPress
165
+ | TestMethodRunBrickExists
166
+ | TestMethodRunWaitUntilBrickExists
167
+ | TestMethodRunWaitUntilEventTrigger
168
+ | TestMethodRunWaitUntilCanvasChange
169
+ | TestMethodRunKeydown
170
+ | TestMethodRunKeyup
171
+ | TestMethodRunHttpRequest
172
+ | TestMethodRunAssertProperty
173
+ | TestMethodRunWaitUntilPropertyChange
174
+ | TestMethodRunExecuteAction
175
+ | TestMethodRunMatchScreenshot
176
+ | TestMethodRunDelay
177
+
178
+ /**
179
+ * Test case definition
180
+ */
181
+ export interface TestCase {
182
+ __typename: 'TestCase'
183
+ id: string
184
+ name: string
185
+ hideShortRef?: boolean
186
+ run: TestMethodRun
187
+ exit_on_failed: boolean
188
+ commented: boolean
189
+ pre_delay: number
190
+ post_delay: number
191
+ post_delay_rule?: PostDelayRule
192
+ jump_cond: TestCaseJumpCondition[]
193
+ }
194
+
195
+ /**
196
+ * Local sync mode for tests
197
+ */
198
+ export type LocalSyncMode = 'main-only' | 'minor-only'
199
+
200
+ /**
201
+ * Automation test definition
202
+ */
203
+ export interface AutomationTest {
204
+ __typename: 'AutomationTest'
205
+ id: string
206
+ title: string
207
+ hideShortRef?: boolean
208
+ timeout: number
209
+ trigger_type?: TestTriggerType
210
+ cron?: string // Cron expression when trigger_type is 'cron'
211
+ skip_trigger_type_check?: boolean
212
+ local_sync?: LocalSyncMode
213
+ cases: TestCase[]
214
+ variables: TestVariable[]
215
+ meta?: Record<string, any>
216
+ }
217
+
218
+ /**
219
+ * Automation test map (a collection of tests)
220
+ */
221
+ export interface AutomationTestMap {
222
+ __typename: 'AutomationTestMap'
223
+ id: string
224
+ title: string
225
+ hideShortRef?: boolean
226
+ createdAt: number
227
+ tests: AutomationTest[]
228
+ }
229
+
230
+ /**
231
+ * Root automation map type (record of automation test maps by ID)
232
+ */
233
+ export type AutomationMap = {
234
+ [mapId: string]: AutomationTestMap
235
+ }
@@ -0,0 +1,80 @@
1
+ /* Auto generated by build script */
2
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from './switch'
3
+ import type { Data, DataLink } from './data'
4
+ import type { Animation, AnimationBasicEvents } from './animation'
5
+ import type {
6
+ Brick,
7
+ EventAction,
8
+ EventActionForItem,
9
+ ActionWithDataParams,
10
+ ActionWithParams,
11
+ Action,
12
+ EventProperty,
13
+ } from './common'
14
+
15
+ export interface BrickBasicProperty {
16
+ /* The brick opacity (0 ~ 1) */
17
+ opacity?: number | DataLink
18
+ /* The brick background color */
19
+ backgroundColor?: string | DataLink
20
+ /* The brick border style */
21
+ borderStyle?: 'solid' | 'dotted' | 'dashed' | DataLink
22
+ /* The brick border width (top) */
23
+ borderTopSize?: number | DataLink
24
+ /* The brick border color (top) */
25
+ borderTopColor?: string | DataLink
26
+ /* The brick border radius (top left) */
27
+ borderTopLeftRadius?: number | DataLink
28
+ /* The brick border radius (top right) */
29
+ borderTopRightRadius?: number | DataLink
30
+ /* The brick border width (bottom) */
31
+ borderBottomSize?: number | DataLink
32
+ /* The brick border color (bottom) */
33
+ borderBottomColor?: string | DataLink
34
+ /* The brick border radius (bottom left) */
35
+ borderBottomLeftRadius?: number | DataLink
36
+ /* The brick border radius (bottom right) */
37
+ borderBottomRightRadius?: number | DataLink
38
+ /* The brick border width (left) */
39
+ borderLeftSize?: number | DataLink
40
+ /* The brick border color (bottom) */
41
+ borderLeftColor?: string | DataLink
42
+ /* The brick border width (right) */
43
+ borderRightSize?: number | DataLink
44
+ /* The brick border color (right) */
45
+ borderRightColor?: string | DataLink
46
+ /* The brick rotate (deg) */
47
+ rotate?: number | DataLink
48
+ /* The brick rotateX (deg) */
49
+ rotateX?: number | DataLink
50
+ /* The brick rotateY (deg) */
51
+ rotateY?: number | DataLink
52
+ /* The brick shadow color */
53
+ shadowColor?: string | DataLink
54
+ /* The brick shadow opacity (0 ~ 1) */
55
+ shadowOpacity?: number | DataLink
56
+ /* The brick shadow radius */
57
+ shadowRadius?: number | DataLink
58
+ /* The brick shadow offset width */
59
+ shadowOffsetWidth?: number | DataLink
60
+ /* The brick shadow offset height */
61
+ shadowOffsetHeight?: number | DataLink
62
+ /* Brick pressable.
63
+ Disabled: Disabled even if event or animation is set.
64
+ Bypass: Disable and bypass the touch event on the brick. */
65
+ pressable?: 'enabled' | 'disabled' | 'bypass' | DataLink
66
+ /* Delay in milliseconds before long press is triggered */
67
+ delayLongPress?: number | DataLink
68
+ }
69
+
70
+ export interface BrickBasicEvents {
71
+ showStart?: Array<EventAction>
72
+ switchUpdate?: Array<EventAction>
73
+ standby?: Array<EventAction>
74
+ }
75
+
76
+ export interface BrickBasicEventsForItem {
77
+ showStart?: Array<EventActionForItem>
78
+ switchUpdate?: Array<EventActionForItem>
79
+ standby?: Array<EventActionForItem>
80
+ }
@@ -0,0 +1,246 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Camera view with photo capture and barcode scanning capabilities
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
+ /* Take picture on the Camera */
21
+ export type BrickCameraActionTakePicture = ActionWithParams & {
22
+ __actionName: 'BRICK_CAMERA_TAKE_PICTURE'
23
+ params?: Array<
24
+ | {
25
+ input: 'width'
26
+ value?: number | DataLink | EventProperty
27
+ mapping?: string
28
+ }
29
+ | {
30
+ input: 'quality'
31
+ value?: string | DataLink | EventProperty
32
+ mapping?: string
33
+ }
34
+ | {
35
+ input: 'base64'
36
+ value?: boolean | DataLink | EventProperty
37
+ mapping?: string
38
+ }
39
+ | {
40
+ input: 'mirrorImage'
41
+ value?: boolean | DataLink | EventProperty
42
+ mapping?: string
43
+ }
44
+ >
45
+ }
46
+
47
+ /* Record video on the Camera */
48
+ export type BrickCameraActionRecord = ActionWithParams & {
49
+ __actionName: 'BRICK_CAMERA_RECORD'
50
+ params?: Array<
51
+ | {
52
+ input: 'quality'
53
+ value?: '4:3' | '288p' | '480p' | '720p' | '1080p' | '2160p' | DataLink | EventProperty
54
+ mapping?: string
55
+ }
56
+ | {
57
+ input: 'mirrorVideo'
58
+ value?: boolean | DataLink | EventProperty
59
+ mapping?: string
60
+ }
61
+ | {
62
+ input: 'videoBitrate'
63
+ value?: string | DataLink | EventProperty
64
+ mapping?: string
65
+ }
66
+ | {
67
+ input: 'maxDuration'
68
+ value?: number | DataLink | EventProperty
69
+ mapping?: string
70
+ }
71
+ | {
72
+ input: 'maxFileSize'
73
+ value?: string | DataLink | EventProperty
74
+ mapping?: string
75
+ }
76
+ >
77
+ }
78
+
79
+ /* Record video on the Camera */
80
+ export type BrickCameraActionStopRecord = Action & {
81
+ __actionName: 'BRICK_CAMERA_STOP_RECORD'
82
+ }
83
+
84
+ /* Focus the Camera at a specific point */
85
+ export type BrickCameraActionFocus = ActionWithParams & {
86
+ __actionName: 'BRICK_CAMERA_FOCUS'
87
+ params?: Array<
88
+ | {
89
+ input: 'focusX'
90
+ value?: number | DataLink | EventProperty
91
+ mapping?: string
92
+ }
93
+ | {
94
+ input: 'focusY'
95
+ value?: number | DataLink | EventProperty
96
+ mapping?: string
97
+ }
98
+ >
99
+ }
100
+
101
+ interface BrickCameraDef {
102
+ /*
103
+ Default property:
104
+ {
105
+ "type": "back",
106
+ "flashMode": "off",
107
+ "captureAudio": false,
108
+ "whiteBalance": "auto",
109
+ "faceDetectionEnabled": false,
110
+ "faceDetectionEventMode": "when-detected"
111
+ }
112
+ */
113
+ property?: BrickBasicProperty & {
114
+ /* Camera type */
115
+ type?: 'back' | 'front' | 'external' | DataLink
116
+ /* Enable or disable camera */
117
+ isActive?: boolean | DataLink
118
+ /* Camera zoom */
119
+ zoom?: number | DataLink
120
+ /* Camera flash mode */
121
+ flashMode?: 'off' | 'on' | 'torch' | 'auto' | DataLink
122
+ /* Camera ratio (Unsupported ratio will be ignored) */
123
+ ratio?: string | DataLink
124
+ /* Capture audio when start recording */
125
+ captureAudio?: boolean | DataLink
126
+ /* Allows you to control the color temperature in your photos by cooling down or warming up the colors. */
127
+ whiteBalance?:
128
+ | 'auto'
129
+ | 'sunny'
130
+ | 'cloudy'
131
+ | 'shadow'
132
+ | 'incandescent'
133
+ | 'fluorescent'
134
+ | DataLink
135
+ /* Enable face detection (Note: Barcode detection will be disabled when enabled) */
136
+ faceDetectionEnabled?: boolean | DataLink
137
+ /* Face detection event mode */
138
+ faceDetectionEventMode?: 'when-detected' | 'interval' | DataLink
139
+ /* Quality of take picture */
140
+ pictureQuality?: number | DataLink
141
+ /* Take picture format as base64 */
142
+ pictureBase64?: boolean | DataLink
143
+ /* Mirror image of take picture */
144
+ pictureIsMirrorImage?: boolean | DataLink
145
+ /* Quality of record video */
146
+ recordQuality?: '4:3' | '288p' | '480p' | '720p' | '1080p' | '2160p' | DataLink
147
+ /* Bitrate of record video (bit/s) */
148
+ recordVideoBitrate?: number | DataLink
149
+ /* Mirror video of record video */
150
+ recordMirrorVideo?: boolean | DataLink
151
+ /* Max duration of record video (s) */
152
+ recordMaxDuration?: number | DataLink
153
+ /* Max file size of record video (bytes) */
154
+ recordMaxFileSize?: number | DataLink
155
+ }
156
+ events?: BrickBasicEvents & {
157
+ /* Event of the Camera state change */
158
+ stateChange?: Array<EventAction<string & keyof TemplateEventPropsMap['Camera']['stateChange']>>
159
+ /* Event of the Camera record start */
160
+ recordStart?: Array<EventAction>
161
+ /* Event of the Camera record end */
162
+ recordEnd?: Array<EventAction>
163
+ /* Event of the Camera barcode read */
164
+ barcodeRead?: Array<EventAction<string & keyof TemplateEventPropsMap['Camera']['barcodeRead']>>
165
+ /* Event of the Camera picture taken */
166
+ pictureTaken?: Array<
167
+ EventAction<string & keyof TemplateEventPropsMap['Camera']['pictureTaken']>
168
+ >
169
+ /* Event of the Camera record finished */
170
+ recordFinish?: Array<
171
+ EventAction<string & keyof TemplateEventPropsMap['Camera']['recordFinish']>
172
+ >
173
+ /* Event of the Camera mount error */
174
+ mountError?: Array<EventAction<string & keyof TemplateEventPropsMap['Camera']['mountError']>>
175
+ }
176
+ outlets?: {
177
+ /* Camera device and format information */
178
+ info?: () => Data<{ [key: string]: any }>
179
+ /* Picture taken result */
180
+ pictureTaken?: () => Data<{
181
+ width?: number
182
+ height?: number
183
+ uri?: string
184
+ base64?: string
185
+ [key: string]: any
186
+ }>
187
+ /* Record video result */
188
+ recordVideo?: () => Data<{
189
+ uri?: string
190
+ [key: string]: any
191
+ }>
192
+ /* Barcode read result */
193
+ barcodeRead?: () => Data<{
194
+ type?: string
195
+ data?: string
196
+ rawData?: string
197
+ bounds?: {
198
+ origin?: {
199
+ x?: number
200
+ y?: number
201
+ [key: string]: any
202
+ }
203
+ size?: {
204
+ width?: number
205
+ height?: number
206
+ [key: string]: any
207
+ }
208
+ [key: string]: any
209
+ }
210
+ [key: string]: any
211
+ }>
212
+ /* Faces detected result */
213
+ faceDetected?: () => Data<Array<{ [key: string]: any }>>
214
+ }
215
+ animation?: AnimationBasicEvents & {
216
+ stateChange?: Animation
217
+ recordStart?: Animation
218
+ recordEnd?: Animation
219
+ barcodeRead?: Animation
220
+ pictureTaken?: Animation
221
+ recordFinish?: Animation
222
+ mountError?: Animation
223
+ }
224
+ }
225
+
226
+ /* Camera view with photo capture and barcode scanning capabilities */
227
+ export type BrickCamera = Brick &
228
+ BrickCameraDef & {
229
+ templateKey: 'BRICK_CAMERA'
230
+ switches?: Array<
231
+ SwitchDef &
232
+ BrickCameraDef & {
233
+ conds?: Array<{
234
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
235
+ cond:
236
+ | SwitchCondInnerStateCurrentCanvas
237
+ | SwitchCondData
238
+ | {
239
+ __typename: 'SwitchCondInnerStateOutlet'
240
+ outlet: 'info' | 'pictureTaken' | 'recordVideo' | 'barcodeRead' | 'faceDetected'
241
+ value: any
242
+ }
243
+ }>
244
+ }
245
+ >
246
+ }