@fugood/bricks-project 2.22.0-beta.9 → 2.22.1
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.
- package/compile/action-name-map.ts +108 -17
- package/compile/index.ts +10 -1
- package/package.json +3 -4
- package/tools/postinstall.ts +16 -9
- package/types/animation.ts +2 -1
- package/types/brick-base.ts +79 -0
- package/types/bricks/3DViewer.ts +200 -0
- package/types/bricks/Camera.ts +195 -0
- package/types/bricks/Chart.ts +362 -0
- package/types/bricks/GenerativeMedia.ts +240 -0
- package/types/bricks/Icon.ts +93 -0
- package/types/bricks/Image.ts +104 -0
- package/types/bricks/Items.ts +461 -0
- package/types/bricks/Lottie.ts +159 -0
- package/types/bricks/QrCode.ts +112 -0
- package/types/bricks/Rect.ts +110 -0
- package/types/bricks/RichText.ts +123 -0
- package/types/bricks/Rive.ts +209 -0
- package/types/bricks/Slideshow.ts +155 -0
- package/types/bricks/Svg.ts +94 -0
- package/types/bricks/Text.ts +143 -0
- package/types/bricks/TextInput.ts +231 -0
- package/types/bricks/Video.ts +170 -0
- package/types/bricks/VideoStreaming.ts +107 -0
- package/types/bricks/WebRtcStream.ts +60 -0
- package/types/bricks/WebView.ts +157 -0
- package/types/bricks/index.ts +19 -0
- package/types/common.ts +8 -3
- package/types/data.ts +6 -0
- package/types/generators/AlarmClock.ts +102 -0
- package/types/generators/Assistant.ts +546 -0
- package/types/generators/BleCentral.ts +225 -0
- package/types/generators/BlePeripheral.ts +202 -0
- package/types/generators/CanvasMap.ts +57 -0
- package/types/generators/CastlesPay.ts +77 -0
- package/types/generators/DataBank.ts +123 -0
- package/types/generators/File.ts +351 -0
- package/types/generators/GraphQl.ts +124 -0
- package/types/generators/Http.ts +117 -0
- package/types/generators/HttpServer.ts +164 -0
- package/types/generators/Information.ts +97 -0
- package/types/generators/Intent.ts +107 -0
- package/types/generators/Iterator.ts +95 -0
- package/types/generators/Keyboard.ts +85 -0
- package/types/generators/LlmAnthropicCompat.ts +188 -0
- package/types/generators/LlmGgml.ts +719 -0
- package/types/generators/LlmOnnx.ts +184 -0
- package/types/generators/LlmOpenAiCompat.ts +206 -0
- package/types/generators/LlmQualcommAiEngine.ts +213 -0
- package/types/generators/Mcp.ts +294 -0
- package/types/generators/McpServer.ts +248 -0
- package/types/generators/MediaFlow.ts +142 -0
- package/types/generators/MqttBroker.ts +121 -0
- package/types/generators/MqttClient.ts +129 -0
- package/types/generators/Question.ts +395 -0
- package/types/generators/RealtimeTranscription.ts +180 -0
- package/types/generators/RerankerGgml.ts +153 -0
- package/types/generators/SerialPort.ts +141 -0
- package/types/generators/SoundPlayer.ts +86 -0
- package/types/generators/SoundRecorder.ts +113 -0
- package/types/generators/SpeechToTextGgml.ts +462 -0
- package/types/generators/SpeechToTextOnnx.ts +227 -0
- package/types/generators/SpeechToTextPlatform.ts +75 -0
- package/types/generators/SqLite.ts +118 -0
- package/types/generators/Step.ts +101 -0
- package/types/generators/Tcp.ts +120 -0
- package/types/generators/TcpServer.ts +137 -0
- package/types/generators/TextToSpeechGgml.ts +182 -0
- package/types/generators/TextToSpeechOnnx.ts +169 -0
- package/types/generators/TextToSpeechOpenAiLike.ts +113 -0
- package/types/generators/ThermalPrinter.ts +185 -0
- package/types/generators/Tick.ts +75 -0
- package/types/generators/Udp.ts +109 -0
- package/types/generators/VadGgml.ts +211 -0
- package/types/generators/VectorStore.ts +223 -0
- package/types/generators/Watchdog.ts +96 -0
- package/types/generators/WebCrawler.ts +97 -0
- package/types/generators/WebRtc.ts +165 -0
- package/types/generators/WebSocket.ts +142 -0
- package/types/generators/index.ts +50 -0
- package/types/system.ts +64 -0
- package/utils/data.ts +45 -0
- package/utils/event-props.ts +89 -13
- package/types/bricks.ts +0 -3168
- package/types/generators.ts +0 -7633
|
@@ -0,0 +1,170 @@
|
|
|
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
|
+
/* Play the video */
|
|
16
|
+
export type BrickVideoActionPlay = Action & {
|
|
17
|
+
__actionName: 'BRICK_VIDEO_PLAY'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Seek the video */
|
|
21
|
+
export type BrickVideoActionSeek = ActionWithParams & {
|
|
22
|
+
__actionName: 'BRICK_VIDEO_SEEK'
|
|
23
|
+
params?: Array<
|
|
24
|
+
| {
|
|
25
|
+
input: 'seekTime'
|
|
26
|
+
value?: number | DataLink | EventProperty
|
|
27
|
+
mapping?: string
|
|
28
|
+
}
|
|
29
|
+
| {
|
|
30
|
+
input: 'play'
|
|
31
|
+
value?: boolean | DataLink | EventProperty
|
|
32
|
+
mapping?: string
|
|
33
|
+
}
|
|
34
|
+
>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Pause the video */
|
|
38
|
+
export type BrickVideoActionPause = Action & {
|
|
39
|
+
__actionName: 'BRICK_VIDEO_PAUSE'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Replay the video */
|
|
43
|
+
export type BrickVideoActionReplay = Action & {
|
|
44
|
+
__actionName: 'BRICK_VIDEO_REPLAY'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Stop the video */
|
|
48
|
+
export type BrickVideoActionStop = Action & {
|
|
49
|
+
__actionName: 'BRICK_VIDEO_STOP'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface BrickVideoDef {
|
|
53
|
+
/*
|
|
54
|
+
Default property:
|
|
55
|
+
{
|
|
56
|
+
"paused": false,
|
|
57
|
+
"volume": 100,
|
|
58
|
+
"muted": false,
|
|
59
|
+
"progressUpdateInterval": 1000,
|
|
60
|
+
"replayTimeout": 500,
|
|
61
|
+
"renderMode": "auto"
|
|
62
|
+
}
|
|
63
|
+
*/
|
|
64
|
+
property?: BrickBasicProperty & {
|
|
65
|
+
/* The video path list or single path (File, URL) */
|
|
66
|
+
path?:
|
|
67
|
+
| string
|
|
68
|
+
| DataLink
|
|
69
|
+
| DataLink
|
|
70
|
+
| {
|
|
71
|
+
url?: string | DataLink
|
|
72
|
+
}
|
|
73
|
+
| Array<
|
|
74
|
+
| DataLink
|
|
75
|
+
| {
|
|
76
|
+
url?: string | DataLink
|
|
77
|
+
}
|
|
78
|
+
| string
|
|
79
|
+
| DataLink
|
|
80
|
+
| DataLink
|
|
81
|
+
>
|
|
82
|
+
| DataLink
|
|
83
|
+
| DataLink
|
|
84
|
+
/* The checksum of file */
|
|
85
|
+
md5?: string | DataLink
|
|
86
|
+
/* Controls whether the video is paused */
|
|
87
|
+
paused?: boolean | DataLink
|
|
88
|
+
/* Volume */
|
|
89
|
+
volume?: number | DataLink
|
|
90
|
+
/* Muted */
|
|
91
|
+
muted?: boolean | DataLink
|
|
92
|
+
/* Video resize mode */
|
|
93
|
+
resizeMode?: 'contain' | 'cover' | 'stretch' | DataLink
|
|
94
|
+
/* Repeat the video path list */
|
|
95
|
+
repeat?: boolean | DataLink
|
|
96
|
+
/* Progress Update Interval */
|
|
97
|
+
progressUpdateInterval?: number | DataLink
|
|
98
|
+
/* Replay on playing error */
|
|
99
|
+
replayOnError?: boolean | DataLink
|
|
100
|
+
/* Timeout to replay if repeat or replayOnError is true and video is end or error */
|
|
101
|
+
replayTimeout?: number | DataLink
|
|
102
|
+
/* 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 */
|
|
103
|
+
renderMode?: 'auto' | 'texture' | 'surface' | DataLink
|
|
104
|
+
}
|
|
105
|
+
events?: BrickBasicEvents & {
|
|
106
|
+
/* Event of the brick press */
|
|
107
|
+
onPress?: Array<EventAction>
|
|
108
|
+
/* Event of the brick press in */
|
|
109
|
+
onPressIn?: Array<EventAction>
|
|
110
|
+
/* Event of the brick press out */
|
|
111
|
+
onPressOut?: Array<EventAction>
|
|
112
|
+
/* Event of the brick long press */
|
|
113
|
+
onLongPress?: Array<EventAction>
|
|
114
|
+
/* Event of the brick focus (Use TV Device with controller) */
|
|
115
|
+
onFocus?: Array<EventAction>
|
|
116
|
+
/* Event of the brick blur (Use TV Device with controller) */
|
|
117
|
+
onBlur?: Array<EventAction>
|
|
118
|
+
/* Event of the next video on change start */
|
|
119
|
+
nextVideo?: Array<EventAction>
|
|
120
|
+
/* Event on plays of path are totally end */
|
|
121
|
+
roundEnd?: Array<EventAction>
|
|
122
|
+
/* Event on video load */
|
|
123
|
+
onLoad?: Array<EventAction>
|
|
124
|
+
/* Event of the video playing error */
|
|
125
|
+
onError?: Array<EventAction>
|
|
126
|
+
/* Event of the video progress interval */
|
|
127
|
+
onProgress?: Array<EventAction>
|
|
128
|
+
}
|
|
129
|
+
outlets?: {
|
|
130
|
+
/* Brick is pressing */
|
|
131
|
+
brickPressing?: () => Data
|
|
132
|
+
/* Brick is focusing (Use TV Device with controller) */
|
|
133
|
+
brickFocusing?: () => Data
|
|
134
|
+
}
|
|
135
|
+
animation?: AnimationBasicEvents & {
|
|
136
|
+
onPress?: Animation
|
|
137
|
+
onPressIn?: Animation
|
|
138
|
+
onPressOut?: Animation
|
|
139
|
+
onLongPress?: Animation
|
|
140
|
+
onFocus?: Animation
|
|
141
|
+
onBlur?: Animation
|
|
142
|
+
nextVideo?: Animation
|
|
143
|
+
roundEnd?: Animation
|
|
144
|
+
onLoad?: Animation
|
|
145
|
+
onError?: Animation
|
|
146
|
+
onProgress?: Animation
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Video brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378577-video)) */
|
|
151
|
+
export type BrickVideo = Brick &
|
|
152
|
+
BrickVideoDef & {
|
|
153
|
+
templateKey: 'BRICK_VIDEO'
|
|
154
|
+
switches: Array<
|
|
155
|
+
SwitchDef &
|
|
156
|
+
BrickVideoDef & {
|
|
157
|
+
conds?: Array<{
|
|
158
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
159
|
+
cond:
|
|
160
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
161
|
+
| SwitchCondData
|
|
162
|
+
| {
|
|
163
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
164
|
+
outlet: 'brickPressing' | 'brickFocusing'
|
|
165
|
+
value: any
|
|
166
|
+
}
|
|
167
|
+
}>
|
|
168
|
+
}
|
|
169
|
+
>
|
|
170
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
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 BrickVideoStreamingDef {
|
|
16
|
+
/*
|
|
17
|
+
Default property:
|
|
18
|
+
{
|
|
19
|
+
"networkCaching": 300,
|
|
20
|
+
"paused": false,
|
|
21
|
+
"volume": 100,
|
|
22
|
+
"muted": false,
|
|
23
|
+
"replayTimeout": 500
|
|
24
|
+
}
|
|
25
|
+
*/
|
|
26
|
+
property?: BrickBasicProperty & {
|
|
27
|
+
/* The video path list or single path (File, URL) */
|
|
28
|
+
uri?: string | DataLink
|
|
29
|
+
/* Set cache time from streaming (You can adjust according to network conditions), it will delay the playing. */
|
|
30
|
+
networkCaching?: number | DataLink
|
|
31
|
+
/* Controls whether the video is paused */
|
|
32
|
+
paused?: boolean | DataLink
|
|
33
|
+
/* Volume */
|
|
34
|
+
volume?: number | DataLink
|
|
35
|
+
/* Muted */
|
|
36
|
+
muted?: boolean | DataLink
|
|
37
|
+
/* Video Auto Aspect Ratio */
|
|
38
|
+
autoAspectRatio?: boolean | DataLink
|
|
39
|
+
/* Video Aspect Ratio */
|
|
40
|
+
aspectRatio?: string | DataLink
|
|
41
|
+
/* Repeat the video path list */
|
|
42
|
+
repeat?: boolean | DataLink
|
|
43
|
+
/* Replay on playing error */
|
|
44
|
+
replayOnError?: boolean | DataLink
|
|
45
|
+
/* Timeout to replay if repeat or replayOnError is true and video is end or error */
|
|
46
|
+
replayTimeout?: number | 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 on plays of path are end */
|
|
62
|
+
onEnd?: Array<EventAction>
|
|
63
|
+
/* Event on plays of path are end */
|
|
64
|
+
onLoad?: Array<EventAction>
|
|
65
|
+
/* Event of the video playing error */
|
|
66
|
+
onError?: Array<EventAction>
|
|
67
|
+
}
|
|
68
|
+
outlets?: {
|
|
69
|
+
/* Brick is pressing */
|
|
70
|
+
brickPressing?: () => Data
|
|
71
|
+
/* Brick is focusing (Use TV Device with controller) */
|
|
72
|
+
brickFocusing?: () => Data
|
|
73
|
+
}
|
|
74
|
+
animation?: AnimationBasicEvents & {
|
|
75
|
+
onPress?: Animation
|
|
76
|
+
onPressIn?: Animation
|
|
77
|
+
onPressOut?: Animation
|
|
78
|
+
onLongPress?: Animation
|
|
79
|
+
onFocus?: Animation
|
|
80
|
+
onBlur?: Animation
|
|
81
|
+
onEnd?: Animation
|
|
82
|
+
onLoad?: Animation
|
|
83
|
+
onError?: Animation
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Brick video streaming component, supports RTSP / RTMP streaming. */
|
|
88
|
+
export type BrickVideoStreaming = Brick &
|
|
89
|
+
BrickVideoStreamingDef & {
|
|
90
|
+
templateKey: 'BRICK_VIDEO_STREAMING'
|
|
91
|
+
switches: Array<
|
|
92
|
+
SwitchDef &
|
|
93
|
+
BrickVideoStreamingDef & {
|
|
94
|
+
conds?: Array<{
|
|
95
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
96
|
+
cond:
|
|
97
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
98
|
+
| SwitchCondData
|
|
99
|
+
| {
|
|
100
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
101
|
+
outlet: 'brickPressing' | 'brickFocusing'
|
|
102
|
+
value: any
|
|
103
|
+
}
|
|
104
|
+
}>
|
|
105
|
+
}
|
|
106
|
+
>
|
|
107
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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 BrickWebRTCStreamDef {
|
|
16
|
+
/*
|
|
17
|
+
Default property:
|
|
18
|
+
{
|
|
19
|
+
"mirror": false,
|
|
20
|
+
"resizeMode": "contain",
|
|
21
|
+
"noStreamViewText": "no stream",
|
|
22
|
+
"noStreamViewTextSize": 44,
|
|
23
|
+
"noStreamViewTextColor": "#000"
|
|
24
|
+
}
|
|
25
|
+
*/
|
|
26
|
+
property?: BrickBasicProperty & {
|
|
27
|
+
/* Mirror video */
|
|
28
|
+
mirror?: boolean | DataLink
|
|
29
|
+
/* The stream resize mode */
|
|
30
|
+
resizeMode?: 'contain' | 'cover' | DataLink
|
|
31
|
+
/* Show text content if no stream */
|
|
32
|
+
noStreamViewText?: string | DataLink
|
|
33
|
+
/* The font size of shown text content if no stream */
|
|
34
|
+
noStreamViewTextSize?: number | DataLink
|
|
35
|
+
/* The color of shown text content if no stream */
|
|
36
|
+
noStreamViewTextColor?: string | DataLink
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* WebRTCStream brick */
|
|
41
|
+
export type BrickWebRTCStream = Brick &
|
|
42
|
+
BrickWebRTCStreamDef & {
|
|
43
|
+
templateKey: 'BRICK_WEBRTC_STREAM'
|
|
44
|
+
switches: Array<
|
|
45
|
+
SwitchDef &
|
|
46
|
+
BrickWebRTCStreamDef & {
|
|
47
|
+
conds?: Array<{
|
|
48
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
49
|
+
cond:
|
|
50
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
51
|
+
| SwitchCondData
|
|
52
|
+
| {
|
|
53
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
54
|
+
outlet: ''
|
|
55
|
+
value: any
|
|
56
|
+
}
|
|
57
|
+
}>
|
|
58
|
+
}
|
|
59
|
+
>
|
|
60
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
/* Run Javascript on the WebView */
|
|
16
|
+
export type BrickWebViewActionInjectJavascript = ActionWithParams & {
|
|
17
|
+
__actionName: 'BRICK_WEBVIEW_INJECT_JAVASCRIPT'
|
|
18
|
+
params?: Array<{
|
|
19
|
+
input: 'javascriptCode'
|
|
20
|
+
value?: string | DataLink | EventProperty
|
|
21
|
+
mapping?: string
|
|
22
|
+
}>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Query selector on the WebView */
|
|
26
|
+
export type BrickWebViewActionQuerySelector = ActionWithParams & {
|
|
27
|
+
__actionName: 'BRICK_WEBVIEW_QUERY_SELECTOR'
|
|
28
|
+
params?: Array<
|
|
29
|
+
| {
|
|
30
|
+
input: 'querySelector'
|
|
31
|
+
value?: string | DataLink | EventProperty
|
|
32
|
+
mapping?: string
|
|
33
|
+
}
|
|
34
|
+
| {
|
|
35
|
+
input: 'expression'
|
|
36
|
+
value?: string | DataLink | EventProperty
|
|
37
|
+
mapping?: string
|
|
38
|
+
}
|
|
39
|
+
>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Do go forward on the WebView */
|
|
43
|
+
export type BrickWebViewActionGoForward = Action & {
|
|
44
|
+
__actionName: 'BRICK_WEBVIEW_GO_FORWARD'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Do go back on the webview */
|
|
48
|
+
export type BrickWebViewActionGoBack = Action & {
|
|
49
|
+
__actionName: 'BRICK_WEBVIEW_GO_BACK'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Do reload on the webview */
|
|
53
|
+
export type BrickWebViewActionReload = Action & {
|
|
54
|
+
__actionName: 'BRICK_WEBVIEW_RELOAD'
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface BrickWebViewDef {
|
|
58
|
+
/*
|
|
59
|
+
Default property:
|
|
60
|
+
{
|
|
61
|
+
"cropLeft": 0,
|
|
62
|
+
"cropRight": 0,
|
|
63
|
+
"cropTop": 0,
|
|
64
|
+
"cropBottom": 0,
|
|
65
|
+
"allowContentControl": true,
|
|
66
|
+
"allowFileAccess": true,
|
|
67
|
+
"domStorageEnabled": true,
|
|
68
|
+
"cacheEnabled": true,
|
|
69
|
+
"geolocationEnabled": true,
|
|
70
|
+
"thirdPartyCookiesEnabled": true,
|
|
71
|
+
"javaScriptEnabled": true
|
|
72
|
+
}
|
|
73
|
+
*/
|
|
74
|
+
property?: BrickBasicProperty & {
|
|
75
|
+
/* The WebView content URL */
|
|
76
|
+
url?: string | DataLink
|
|
77
|
+
/* The request headers to load content */
|
|
78
|
+
headers?: {} | DataLink
|
|
79
|
+
/* The request UserAgent */
|
|
80
|
+
userAgent?: string | DataLink
|
|
81
|
+
/* The webview content HTML (Use `url` first) */
|
|
82
|
+
html?: string | DataLink
|
|
83
|
+
/* Crop webview content left position (px) */
|
|
84
|
+
cropLeft?: number | DataLink
|
|
85
|
+
/* Crop webview content right position (px) */
|
|
86
|
+
cropRight?: number | DataLink
|
|
87
|
+
/* Crop webview content top position (px) */
|
|
88
|
+
cropTop?: number | DataLink
|
|
89
|
+
/* Crop webview content bottom position (px) */
|
|
90
|
+
cropBottom?: number | DataLink
|
|
91
|
+
/* Allow content control */
|
|
92
|
+
allowContentControl?: boolean | DataLink
|
|
93
|
+
/* List of origin strings to allow being navigated to. (Allowed all if not provided) */
|
|
94
|
+
originAllowList?: Array<string | DataLink> | DataLink
|
|
95
|
+
/* Allow file:// access */
|
|
96
|
+
allowFileAccess?: boolean | DataLink
|
|
97
|
+
/* Enable DOM Storage */
|
|
98
|
+
domStorageEnabled?: boolean | DataLink
|
|
99
|
+
/* Enable Cache */
|
|
100
|
+
cacheEnabled?: boolean | DataLink
|
|
101
|
+
/* Enable Geolocation */
|
|
102
|
+
geolocationEnabled?: boolean | DataLink
|
|
103
|
+
/* Enable Third Party Cooikies */
|
|
104
|
+
thirdPartyCookiesEnabled?: boolean | DataLink
|
|
105
|
+
/* Enable JavaScript */
|
|
106
|
+
javaScriptEnabled?: boolean | DataLink
|
|
107
|
+
/* Inject JavaScript code */
|
|
108
|
+
code?: string | DataLink
|
|
109
|
+
/* Inject JavaScript code before content loaded */
|
|
110
|
+
beforeContentLoaded?: string | DataLink
|
|
111
|
+
/* Inject JavaScript code for main frame only (only `YES` supported for Android) */
|
|
112
|
+
forMainFrameOnly?: boolean | DataLink
|
|
113
|
+
/* Inject JavaScript code before content loaded for main frame only (only `YES` supported for Android) */
|
|
114
|
+
beforeContentLoadedForMainFrameOnly?: boolean | DataLink
|
|
115
|
+
}
|
|
116
|
+
events?: BrickBasicEvents & {
|
|
117
|
+
/* Event of the WebView on load */
|
|
118
|
+
onLoad?: Array<EventAction>
|
|
119
|
+
/* Event when the WebView load fails */
|
|
120
|
+
onError?: Array<EventAction>
|
|
121
|
+
/* Event of the webview on message by `window.ReactNativeWebView.postMessage` on you're injected javascript code */
|
|
122
|
+
onMessage?: Array<EventAction>
|
|
123
|
+
}
|
|
124
|
+
outlets?: {
|
|
125
|
+
/* The result of the query selector action */
|
|
126
|
+
queryResult?: () => Data
|
|
127
|
+
/* The error of the query selector action */
|
|
128
|
+
queryError?: () => Data
|
|
129
|
+
}
|
|
130
|
+
animation?: AnimationBasicEvents & {
|
|
131
|
+
onLoad?: Animation
|
|
132
|
+
onError?: Animation
|
|
133
|
+
onMessage?: Animation
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* WebView brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378588-web-view)) */
|
|
138
|
+
export type BrickWebView = Brick &
|
|
139
|
+
BrickWebViewDef & {
|
|
140
|
+
templateKey: 'BRICK_WEBVIEW'
|
|
141
|
+
switches: Array<
|
|
142
|
+
SwitchDef &
|
|
143
|
+
BrickWebViewDef & {
|
|
144
|
+
conds?: Array<{
|
|
145
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
146
|
+
cond:
|
|
147
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
148
|
+
| SwitchCondData
|
|
149
|
+
| {
|
|
150
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
151
|
+
outlet: 'queryResult' | 'queryError'
|
|
152
|
+
value: any
|
|
153
|
+
}
|
|
154
|
+
}>
|
|
155
|
+
}
|
|
156
|
+
>
|
|
157
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from './Rect'
|
|
2
|
+
export * from './Text'
|
|
3
|
+
export * from './TextInput'
|
|
4
|
+
export * from './RichText'
|
|
5
|
+
export * from './Image'
|
|
6
|
+
export * from './Svg'
|
|
7
|
+
export * from './Icon'
|
|
8
|
+
export * from './Video'
|
|
9
|
+
export * from './VideoStreaming'
|
|
10
|
+
export * from './QrCode'
|
|
11
|
+
export * from './Slideshow'
|
|
12
|
+
export * from './Chart'
|
|
13
|
+
export * from './Items'
|
|
14
|
+
export * from './Lottie'
|
|
15
|
+
export * from './Rive'
|
|
16
|
+
export * from './WebView'
|
|
17
|
+
export * from './Camera'
|
|
18
|
+
export * from './WebRtcStream'
|
|
19
|
+
export * from './GenerativeMedia'
|
package/types/common.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type SubpsaceAction = string
|
|
|
39
39
|
export type Action = {
|
|
40
40
|
__actionName: string
|
|
41
41
|
parent: 'Brick' | 'Generator' | 'Subspace' | 'System'
|
|
42
|
-
name
|
|
42
|
+
name?: string
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// Find correct key in bricks-project/utils/event-props for EventAction
|
|
@@ -65,7 +65,7 @@ export type ItemBrickID = string
|
|
|
65
65
|
|
|
66
66
|
export type EventAction = {
|
|
67
67
|
handler: 'system' | (() => Brick | Generator) | SubspaceID | ItemBrickID
|
|
68
|
-
action:
|
|
68
|
+
action: ActionWithParams | ActionWithDataParams
|
|
69
69
|
waitAsync?: boolean
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -82,7 +82,7 @@ export type EventActionForItem = {
|
|
|
82
82
|
export type ApplicationFont = {
|
|
83
83
|
name: string
|
|
84
84
|
url: string
|
|
85
|
-
md5
|
|
85
|
+
md5?: string
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
export type ApplicationSettings = {
|
|
@@ -115,6 +115,11 @@ export type ApplicationSettings = {
|
|
|
115
115
|
borderBottomRightRadius?: number
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
+
ai?: {
|
|
119
|
+
useAnthropicApiKeySystemData?: boolean
|
|
120
|
+
useOpenAiApiKeySystemData?: boolean
|
|
121
|
+
useGeminiApiKeySystemData?: boolean
|
|
122
|
+
}
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
export type Application = {
|
package/types/data.ts
CHANGED
|
@@ -56,6 +56,11 @@ export type Data<T = any> = DataDef & {
|
|
|
56
56
|
| 'rich-text-content'
|
|
57
57
|
| 'sandbox-script'
|
|
58
58
|
| 'llm-prompt'
|
|
59
|
+
| 'llm-messages'
|
|
60
|
+
| 'llm-tools'
|
|
61
|
+
| 'mcp-server-resources'
|
|
62
|
+
| 'mcp-server-tools'
|
|
63
|
+
| 'mcp-server-prompts'
|
|
59
64
|
}
|
|
60
65
|
value: T
|
|
61
66
|
}
|
|
@@ -67,6 +72,7 @@ export type DataAssetKind = {
|
|
|
67
72
|
| 'media-resource-audio'
|
|
68
73
|
| 'media-resource-file'
|
|
69
74
|
| 'lottie-file-uri'
|
|
75
|
+
| 'rive-file-uri'
|
|
70
76
|
| 'ggml-model-asset'
|
|
71
77
|
| 'gguf-model-asset'
|
|
72
78
|
| 'binary-asset'
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
2
|
+
import type { Data, DataLink } from '../data'
|
|
3
|
+
import type {
|
|
4
|
+
Generator,
|
|
5
|
+
EventAction,
|
|
6
|
+
ActionWithDataParams,
|
|
7
|
+
ActionWithParams,
|
|
8
|
+
Action,
|
|
9
|
+
EventProperty,
|
|
10
|
+
} from '../common'
|
|
11
|
+
|
|
12
|
+
/* Start the alarm clock */
|
|
13
|
+
export type GeneratorAlarmClockActionStart = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_ALARM_CLOCK_START'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Pause the alarm clock */
|
|
18
|
+
export type GeneratorAlarmClockActionPause = Action & {
|
|
19
|
+
__actionName: 'GENERATOR_ALARM_CLOCK_PAUSE'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface GeneratorAlarmClockDef {
|
|
23
|
+
/*
|
|
24
|
+
Default property:
|
|
25
|
+
{
|
|
26
|
+
"init": false,
|
|
27
|
+
"timezone": "UTC",
|
|
28
|
+
"cron": "* * * * *",
|
|
29
|
+
"min": "",
|
|
30
|
+
"hour": "",
|
|
31
|
+
"dom": "",
|
|
32
|
+
"mon": "",
|
|
33
|
+
"dow": ""
|
|
34
|
+
}
|
|
35
|
+
*/
|
|
36
|
+
property?: {
|
|
37
|
+
/* Start alarm clock on generator initialized */
|
|
38
|
+
init?: boolean | DataLink
|
|
39
|
+
/* Timezone */
|
|
40
|
+
timezone?: string | DataLink
|
|
41
|
+
/* Max count of alarm clock trigs */
|
|
42
|
+
maxTrigs?: number | DataLink
|
|
43
|
+
/* Time to start alarm clock */
|
|
44
|
+
startAt?: string | DataLink | string | DataLink | DataLink
|
|
45
|
+
/* Time to end alarm clock (Empty for not end) */
|
|
46
|
+
stopAt?: string | DataLink | string | DataLink | DataLink
|
|
47
|
+
/* Setting trigger rule by cron tab (Ref: https://crontab.guru/) */
|
|
48
|
+
cron?: string | DataLink
|
|
49
|
+
/* minute */
|
|
50
|
+
min?: string | DataLink
|
|
51
|
+
/* hour */
|
|
52
|
+
hour?: string | DataLink
|
|
53
|
+
/* day (month) */
|
|
54
|
+
dom?: string | DataLink
|
|
55
|
+
/* month */
|
|
56
|
+
mon?: string | DataLink
|
|
57
|
+
/* day (week) */
|
|
58
|
+
dow?: string | DataLink
|
|
59
|
+
}
|
|
60
|
+
events?: {
|
|
61
|
+
/* Event for cron rule is not invalid */
|
|
62
|
+
onRuleInvalid?: Array<EventAction>
|
|
63
|
+
/* Event for alarm clock start */
|
|
64
|
+
onStart?: Array<EventAction>
|
|
65
|
+
/* Event for alarm clock trig */
|
|
66
|
+
onTrig?: Array<EventAction>
|
|
67
|
+
/* Event for alarm clock stop */
|
|
68
|
+
onEnd?: Array<EventAction>
|
|
69
|
+
}
|
|
70
|
+
outlets?: {
|
|
71
|
+
/* Current time of each alarm clock trig */
|
|
72
|
+
trigTime?: () => Data
|
|
73
|
+
/* Current timestamp (unix time) of each alarm clock trig */
|
|
74
|
+
trigTimestamp?: () => Data
|
|
75
|
+
/* Count of alarm clock trigs */
|
|
76
|
+
trigCount?: () => Data
|
|
77
|
+
/* Is alarm clock running? */
|
|
78
|
+
running?: () => Data
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Execute event by cron tab */
|
|
83
|
+
export type GeneratorAlarmClock = Generator &
|
|
84
|
+
GeneratorAlarmClockDef & {
|
|
85
|
+
templateKey: 'GENERATOR_ALARM_CLOCK'
|
|
86
|
+
switches: Array<
|
|
87
|
+
SwitchDef &
|
|
88
|
+
GeneratorAlarmClockDef & {
|
|
89
|
+
conds?: Array<{
|
|
90
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
91
|
+
cond:
|
|
92
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
93
|
+
| SwitchCondData
|
|
94
|
+
| {
|
|
95
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
96
|
+
outlet: 'trigTime' | 'trigTimestamp' | 'trigCount' | 'running'
|
|
97
|
+
value: any
|
|
98
|
+
}
|
|
99
|
+
}>
|
|
100
|
+
}
|
|
101
|
+
>
|
|
102
|
+
}
|