@fugood/bricks-project 2.22.0-beta.9 → 2.22.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 (86) hide show
  1. package/compile/action-name-map.ts +108 -1
  2. package/compile/index.ts +10 -1
  3. package/package.json +3 -3
  4. package/tools/postinstall.ts +16 -9
  5. package/types/animation.ts +2 -1
  6. package/types/brick-base.ts +79 -0
  7. package/types/bricks/3DViewer.ts +200 -0
  8. package/types/bricks/Camera.ts +195 -0
  9. package/types/bricks/Chart.ts +362 -0
  10. package/types/bricks/GenerativeMedia.ts +240 -0
  11. package/types/bricks/Icon.ts +93 -0
  12. package/types/bricks/Image.ts +104 -0
  13. package/types/bricks/Items.ts +461 -0
  14. package/types/bricks/Lottie.ts +159 -0
  15. package/types/bricks/QrCode.ts +112 -0
  16. package/types/bricks/Rect.ts +110 -0
  17. package/types/bricks/RichText.ts +123 -0
  18. package/types/bricks/Rive.ts +209 -0
  19. package/types/bricks/Slideshow.ts +155 -0
  20. package/types/bricks/Svg.ts +94 -0
  21. package/types/bricks/Text.ts +143 -0
  22. package/types/bricks/TextInput.ts +231 -0
  23. package/types/bricks/Video.ts +170 -0
  24. package/types/bricks/VideoStreaming.ts +107 -0
  25. package/types/bricks/WebRtcStream.ts +60 -0
  26. package/types/bricks/WebView.ts +157 -0
  27. package/types/bricks/index.ts +20 -0
  28. package/types/common.ts +8 -3
  29. package/types/data.ts +6 -0
  30. package/types/generators/AlarmClock.ts +102 -0
  31. package/types/generators/Assistant.ts +546 -0
  32. package/types/generators/BleCentral.ts +225 -0
  33. package/types/generators/BlePeripheral.ts +202 -0
  34. package/types/generators/CanvasMap.ts +57 -0
  35. package/types/generators/CastlesPay.ts +77 -0
  36. package/types/generators/DataBank.ts +123 -0
  37. package/types/generators/File.ts +351 -0
  38. package/types/generators/GraphQl.ts +124 -0
  39. package/types/generators/Http.ts +117 -0
  40. package/types/generators/HttpServer.ts +164 -0
  41. package/types/generators/Information.ts +97 -0
  42. package/types/generators/Intent.ts +107 -0
  43. package/types/generators/Iterator.ts +95 -0
  44. package/types/generators/Keyboard.ts +85 -0
  45. package/types/generators/LlmAnthropicCompat.ts +188 -0
  46. package/types/generators/LlmGgml.ts +719 -0
  47. package/types/generators/LlmOnnx.ts +184 -0
  48. package/types/generators/LlmOpenAiCompat.ts +206 -0
  49. package/types/generators/LlmQualcommAiEngine.ts +213 -0
  50. package/types/generators/Mcp.ts +294 -0
  51. package/types/generators/McpServer.ts +248 -0
  52. package/types/generators/MediaFlow.ts +142 -0
  53. package/types/generators/MqttBroker.ts +121 -0
  54. package/types/generators/MqttClient.ts +129 -0
  55. package/types/generators/Question.ts +395 -0
  56. package/types/generators/RealtimeTranscription.ts +180 -0
  57. package/types/generators/RerankerGgml.ts +153 -0
  58. package/types/generators/SerialPort.ts +141 -0
  59. package/types/generators/SoundPlayer.ts +86 -0
  60. package/types/generators/SoundRecorder.ts +113 -0
  61. package/types/generators/SpeechToTextGgml.ts +462 -0
  62. package/types/generators/SpeechToTextOnnx.ts +227 -0
  63. package/types/generators/SpeechToTextPlatform.ts +75 -0
  64. package/types/generators/SqLite.ts +118 -0
  65. package/types/generators/Step.ts +101 -0
  66. package/types/generators/TapToPayOnIPhone.ts +175 -0
  67. package/types/generators/Tcp.ts +120 -0
  68. package/types/generators/TcpServer.ts +137 -0
  69. package/types/generators/TextToSpeechGgml.ts +182 -0
  70. package/types/generators/TextToSpeechOnnx.ts +169 -0
  71. package/types/generators/TextToSpeechOpenAiLike.ts +113 -0
  72. package/types/generators/ThermalPrinter.ts +185 -0
  73. package/types/generators/Tick.ts +75 -0
  74. package/types/generators/Udp.ts +109 -0
  75. package/types/generators/VadGgml.ts +211 -0
  76. package/types/generators/VectorStore.ts +223 -0
  77. package/types/generators/Watchdog.ts +96 -0
  78. package/types/generators/WebCrawler.ts +97 -0
  79. package/types/generators/WebRtc.ts +165 -0
  80. package/types/generators/WebSocket.ts +142 -0
  81. package/types/generators/index.ts +51 -0
  82. package/types/system.ts +64 -0
  83. package/utils/data.ts +45 -0
  84. package/utils/event-props.ts +89 -0
  85. package/types/bricks.ts +0 -3168
  86. package/types/generators.ts +0 -7633
@@ -0,0 +1,240 @@
1
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
+ import type { Data, DataLink } from '../data'
3
+ import type { Animation, AnimationBasicEvents } from '../animation'
4
+ import type {
5
+ Brick,
6
+ EventAction,
7
+ EventActionForItem,
8
+ ActionWithDataParams,
9
+ ActionWithParams,
10
+ Action,
11
+ EventProperty,
12
+ } from '../common'
13
+ import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
14
+
15
+ interface GenerativeMediaDef {
16
+ /*
17
+ Default property:
18
+ {
19
+ "enableCache": true,
20
+ "type": "image",
21
+ "resizeMode": "cover",
22
+ "provider": "openai",
23
+ "freepikClassicImageSize": "square_1_1"
24
+ }
25
+ */
26
+ property?: BrickBasicProperty & {
27
+ /* The text prompt to generate media from */
28
+ prompt?: string | DataLink
29
+ /* Enable cache */
30
+ enableCache?: boolean | DataLink
31
+ /* The type of media to generate (image or video) */
32
+ type?: 'image' | 'video' | DataLink
33
+ /* Default image to display when no generated image is available */
34
+ defaultImage?: string | DataLink
35
+ /* The hash of the default image */
36
+ defaultImageHash?: string | DataLink
37
+ /* The type of the default image hash */
38
+ defaultImageHashType?: 'md5' | 'sha1' | 'sha256' | DataLink
39
+ /* The Lottie animation to show while generating */
40
+ loadingAnimation?: string | DataLink
41
+ /* The Lottie animation to show when an error occurs */
42
+ errorAnimation?: string | DataLink
43
+ /* The resize mode for the generated media */
44
+ resizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat' | DataLink
45
+ /* The API key for the generative media service */
46
+ apiKey?: string | DataLink
47
+ /* The AI provider to use for generation (openai, freepik, or deepai) */
48
+ provider?: 'openai' | 'freepik-classic' | 'deepai' | DataLink
49
+ /* OpenAI image size (256x256, 512x512, 1024x1024, etc) */
50
+ openaiSize?: '1024x1024' | '1024x1792' | '1792x1024' | DataLink
51
+ /* OpenAI image style (vivid or natural) */
52
+ openaiStyle?: 'vivid' | 'natural' | DataLink
53
+ /* OpenAI image quality (standard or hd) */
54
+ openaiQuality?: 'standard' | 'hd' | DataLink
55
+ /* Freepik image size */
56
+ freepikClassicImageSize?:
57
+ | 'square_1_1'
58
+ | 'classic_4_3'
59
+ | 'traditional_3_4'
60
+ | 'widescreen_16_9'
61
+ | 'social_story_9_16'
62
+ | 'smartphone_horizontal_20_9'
63
+ | 'smartphone_vertical_9_20'
64
+ | 'standard_3_2'
65
+ | 'portrait_2_3'
66
+ | 'horizontal_2_1'
67
+ | 'vertical_1_2'
68
+ | 'social_5_4'
69
+ | 'social_post_4_5'
70
+ | DataLink
71
+ /* Freepik image style */
72
+ freepikClassicStyle?:
73
+ | 'photo'
74
+ | 'digital-art'
75
+ | '3d'
76
+ | 'painting'
77
+ | 'low-poly'
78
+ | 'pixel-art'
79
+ | 'anime'
80
+ | 'cyberpunk'
81
+ | 'comic'
82
+ | 'vintage'
83
+ | 'cartoon'
84
+ | 'vector'
85
+ | 'studio-shot'
86
+ | 'dark'
87
+ | 'sketch'
88
+ | 'mockup'
89
+ | '2000s-pone'
90
+ | '70s-vibe'
91
+ | 'watercolor'
92
+ | 'art-nouveau'
93
+ | 'origami'
94
+ | 'surreal'
95
+ | 'fantasy'
96
+ | 'traditional-japan'
97
+ | DataLink
98
+ /* Freepik color scheme */
99
+ freepikClassicStyleColor?:
100
+ | 'b&w'
101
+ | 'pastel'
102
+ | 'sepia'
103
+ | 'dramatic'
104
+ | 'vibrant'
105
+ | 'orange&teal'
106
+ | 'film-filter'
107
+ | 'split'
108
+ | 'electric'
109
+ | 'pastel-pink'
110
+ | 'gold-glow'
111
+ | 'autumn'
112
+ | 'muted-green'
113
+ | 'deep-teal'
114
+ | 'duotone'
115
+ | 'terracotta&teal'
116
+ | 'red&blue'
117
+ | 'cold-neon'
118
+ | 'burgundy&blue'
119
+ | DataLink
120
+ /* Freepik lighting style */
121
+ freepikClassicStyleLighting?:
122
+ | 'studio'
123
+ | 'warm'
124
+ | 'cinematic'
125
+ | 'volumetric'
126
+ | 'golden-hour'
127
+ | 'long-exposure'
128
+ | 'cold'
129
+ | 'iridescent'
130
+ | 'dramatic'
131
+ | 'hardlight'
132
+ | 'redscale'
133
+ | 'indoor-light'
134
+ | DataLink
135
+ /* Freepik framing style */
136
+ freepikClassicStyleFraming?:
137
+ | 'portrait'
138
+ | 'macro'
139
+ | 'panoramic'
140
+ | 'aerial-view'
141
+ | 'close-up'
142
+ | 'cinematic'
143
+ | 'high-angle'
144
+ | 'low-angle'
145
+ | 'symmetry'
146
+ | 'fish-eye'
147
+ | 'first-person'
148
+ | DataLink
149
+ /* Freepik guidance scale (level of fidelity to prompt) */
150
+ freepikClassicGuidanceScale?: number | DataLink
151
+ /* Freepik negative prompt (attributes to avoid) */
152
+ freepikClassicNegativePrompt?: string | DataLink
153
+ /* DeepAI negative prompt (attributes to avoid) */
154
+ deepaiNegativePrompt?: string | DataLink
155
+ /* DeepAI image generator version */
156
+ deepaiImageGeneratorVersion?: 'standard' | 'hd' | DataLink
157
+ /* DeepAI output image width */
158
+ deepaiWidth?: number | DataLink
159
+ /* DeepAI output image height */
160
+ deepaiHeight?: number | DataLink
161
+ }
162
+ events?: BrickBasicEvents & {
163
+ /* Event of the brick press */
164
+ generativeMediaOnPress?: Array<EventAction>
165
+ /* Event of the brick press in */
166
+ generativeMediaOnPressIn?: Array<EventAction>
167
+ /* Event of the brick press out */
168
+ generativeMediaOnPressOut?: Array<EventAction>
169
+ /* Event of the brick long press */
170
+ generativeMediaOnLongPress?: Array<EventAction>
171
+ /* Event of the brick focus (Use TV Device with controller) */
172
+ generativeMediaOnFocus?: Array<EventAction>
173
+ /* Event of the brick blur (Use TV Device with controller) */
174
+ generativeMediaOnBlur?: Array<EventAction>
175
+ /* Event when media generation succeeds */
176
+ onSuccess?: Array<EventAction>
177
+ /* Event when media generation fails */
178
+ onError?: Array<EventAction>
179
+ /* Event when media prompt request starts */
180
+ promptStart?: Array<EventAction>
181
+ /* Event when media prompt request succeeds */
182
+ promptSuccess?: Array<EventAction>
183
+ /* Event when media prompt request fails */
184
+ promptError?: Array<EventAction>
185
+ /* Event when media loading starts */
186
+ loadStart?: Array<EventAction>
187
+ /* Event when media loading succeeds */
188
+ loadSuccess?: Array<EventAction>
189
+ /* Event when media loading fails */
190
+ loadError?: Array<EventAction>
191
+ }
192
+ outlets?: {
193
+ /* Brick is pressing */
194
+ brickPressing?: () => Data
195
+ /* Brick is focusing (Use TV Device with controller) */
196
+ brickFocusing?: () => Data
197
+ /* Generated media URL */
198
+ url?: () => Data
199
+ /* Generated media error */
200
+ error?: () => Data
201
+ }
202
+ animation?: AnimationBasicEvents & {
203
+ generativeMediaOnPress?: Animation
204
+ generativeMediaOnPressIn?: Animation
205
+ generativeMediaOnPressOut?: Animation
206
+ generativeMediaOnLongPress?: Animation
207
+ generativeMediaOnFocus?: Animation
208
+ generativeMediaOnBlur?: Animation
209
+ onSuccess?: Animation
210
+ onError?: Animation
211
+ promptStart?: Animation
212
+ promptSuccess?: Animation
213
+ promptError?: Animation
214
+ loadStart?: Animation
215
+ loadSuccess?: Animation
216
+ loadError?: Animation
217
+ }
218
+ }
219
+
220
+ /* Generative Media brick - Generate images and videos using AI */
221
+ export type GenerativeMedia = Brick &
222
+ GenerativeMediaDef & {
223
+ templateKey: 'BRICK_GENERATIVE_MEDIA'
224
+ switches: Array<
225
+ SwitchDef &
226
+ GenerativeMediaDef & {
227
+ conds?: Array<{
228
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
229
+ cond:
230
+ | SwitchCondInnerStateCurrentCanvas
231
+ | SwitchCondData
232
+ | {
233
+ __typename: 'SwitchCondInnerStateOutlet'
234
+ outlet: 'brickPressing' | 'brickFocusing' | 'url' | 'error'
235
+ value: any
236
+ }
237
+ }>
238
+ }
239
+ >
240
+ }
@@ -0,0 +1,93 @@
1
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
+ import type { Data, DataLink } from '../data'
3
+ import type { Animation, AnimationBasicEvents } from '../animation'
4
+ import type {
5
+ Brick,
6
+ EventAction,
7
+ EventActionForItem,
8
+ ActionWithDataParams,
9
+ ActionWithParams,
10
+ Action,
11
+ EventProperty,
12
+ } from '../common'
13
+ import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
14
+
15
+ interface BrickIconDef {
16
+ /*
17
+ Default property:
18
+ {}
19
+ */
20
+ property?: BrickBasicProperty & {
21
+ /* Select icon */
22
+ icon?:
23
+ | DataLink
24
+ | {
25
+ type?:
26
+ | 'solid'
27
+ | 'regular'
28
+ | 'light'
29
+ | 'duotone'
30
+ | 'thin'
31
+ | 'brands'
32
+ | 'sharpSolid'
33
+ | 'sharpLight'
34
+ | 'sharpRegular'
35
+ | DataLink
36
+ name?: string | DataLink
37
+ }
38
+ /* Icon main color */
39
+ color?: string | DataLink
40
+ /* Icon secondary color (For Duotone type) */
41
+ secondaryColor?: string | DataLink
42
+ }
43
+ events?: BrickBasicEvents & {
44
+ /* Event of the brick press */
45
+ onPress?: Array<EventAction>
46
+ /* Event of the brick press in */
47
+ onPressIn?: Array<EventAction>
48
+ /* Event of the brick press out */
49
+ onPressOut?: Array<EventAction>
50
+ /* Event of the brick long press */
51
+ onLongPress?: Array<EventAction>
52
+ /* Event of the brick focus (Use TV Device with controller) */
53
+ onFocus?: Array<EventAction>
54
+ /* Event of the brick blur (Use TV Device with controller) */
55
+ onBlur?: Array<EventAction>
56
+ }
57
+ outlets?: {
58
+ /* Brick is pressing */
59
+ brickPressing?: () => Data
60
+ /* Brick is focusing (Use TV Device with controller) */
61
+ brickFocusing?: () => Data
62
+ }
63
+ animation?: AnimationBasicEvents & {
64
+ onPress?: Animation
65
+ onPressIn?: Animation
66
+ onPressOut?: Animation
67
+ onLongPress?: Animation
68
+ onFocus?: Animation
69
+ onBlur?: Animation
70
+ }
71
+ }
72
+
73
+ /* Icon brick */
74
+ export type BrickIcon = Brick &
75
+ BrickIconDef & {
76
+ templateKey: 'BRICK_ICON'
77
+ switches: Array<
78
+ SwitchDef &
79
+ BrickIconDef & {
80
+ conds?: Array<{
81
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
82
+ cond:
83
+ | SwitchCondInnerStateCurrentCanvas
84
+ | SwitchCondData
85
+ | {
86
+ __typename: 'SwitchCondInnerStateOutlet'
87
+ outlet: 'brickPressing' | 'brickFocusing'
88
+ value: any
89
+ }
90
+ }>
91
+ }
92
+ >
93
+ }
@@ -0,0 +1,104 @@
1
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
+ import type { Data, DataLink } from '../data'
3
+ import type { Animation, AnimationBasicEvents } from '../animation'
4
+ import type {
5
+ Brick,
6
+ EventAction,
7
+ EventActionForItem,
8
+ ActionWithDataParams,
9
+ ActionWithParams,
10
+ Action,
11
+ EventProperty,
12
+ } from '../common'
13
+ import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
14
+
15
+ interface BrickImageDef {
16
+ /*
17
+ Default property:
18
+ {
19
+ "path": "",
20
+ "fadeDuration": 0,
21
+ "blurBackgroundRadius": 8,
22
+ "loadSystemIos": "auto",
23
+ "loadSystemAndroid": "auto"
24
+ }
25
+ */
26
+ property?: BrickBasicProperty & {
27
+ /* The image resize mode */
28
+ resizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat' | DataLink
29
+ /* The image file path (File, URL) */
30
+ path?: string | DataLink
31
+ /* The checksum of file */
32
+ md5?: string | DataLink
33
+ /* The image fade duration */
34
+ fadeDuration?: number | DataLink
35
+ /* The image avatar mode */
36
+ avatar?: boolean | DataLink
37
+ /* The image fixed width with `avatar` */
38
+ width?: number | DataLink
39
+ /* Add blurred image at background if photo is not full */
40
+ enableBlurBackground?: boolean | DataLink
41
+ /* The blur radius of the blur filter added to the image background */
42
+ blurBackgroundRadius?: number | DataLink
43
+ /* [iOS] The use priority of image loading system (Auto: sdwebimage, fallback to default if failed) */
44
+ loadSystemIos?: 'auto' | 'sdwebimage' | 'default' | DataLink
45
+ /* [Android] The use priority of image loading system (Auto: glide, fallback to fresco if failed) */
46
+ loadSystemAndroid?: 'auto' | 'glide' | 'fresco' | DataLink
47
+ }
48
+ events?: BrickBasicEvents & {
49
+ /* Event of the brick press */
50
+ onPress?: Array<EventAction>
51
+ /* Event of the brick press in */
52
+ onPressIn?: Array<EventAction>
53
+ /* Event of the brick press out */
54
+ onPressOut?: Array<EventAction>
55
+ /* Event of the brick long press */
56
+ onLongPress?: Array<EventAction>
57
+ /* Event of the brick focus (Use TV Device with controller) */
58
+ onFocus?: Array<EventAction>
59
+ /* Event of the brick blur (Use TV Device with controller) */
60
+ onBlur?: Array<EventAction>
61
+ /* Event of the image on load */
62
+ onLoad?: Array<EventAction>
63
+ /* Event of the image on error */
64
+ onError?: Array<EventAction>
65
+ }
66
+ outlets?: {
67
+ /* Brick is pressing */
68
+ brickPressing?: () => Data
69
+ /* Brick is focusing (Use TV Device with controller) */
70
+ brickFocusing?: () => Data
71
+ }
72
+ animation?: AnimationBasicEvents & {
73
+ onPress?: Animation
74
+ onPressIn?: Animation
75
+ onPressOut?: Animation
76
+ onLongPress?: Animation
77
+ onFocus?: Animation
78
+ onBlur?: Animation
79
+ onLoad?: Animation
80
+ onError?: Animation
81
+ }
82
+ }
83
+
84
+ /* Image brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378576-image)) */
85
+ export type BrickImage = Brick &
86
+ BrickImageDef & {
87
+ templateKey: 'BRICK_IMAGE'
88
+ switches: Array<
89
+ SwitchDef &
90
+ BrickImageDef & {
91
+ conds?: Array<{
92
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
93
+ cond:
94
+ | SwitchCondInnerStateCurrentCanvas
95
+ | SwitchCondData
96
+ | {
97
+ __typename: 'SwitchCondInnerStateOutlet'
98
+ outlet: 'brickPressing' | 'brickFocusing'
99
+ value: any
100
+ }
101
+ }>
102
+ }
103
+ >
104
+ }