@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.
- package/compile/action-name-map.ts +108 -1
- package/compile/index.ts +10 -1
- package/package.json +3 -3
- 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 +20 -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/TapToPayOnIPhone.ts +175 -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 +51 -0
- package/types/system.ts +64 -0
- package/utils/data.ts +45 -0
- package/utils/event-props.ts +89 -0
- package/types/bricks.ts +0 -3168
- package/types/generators.ts +0 -7633
|
@@ -0,0 +1,461 @@
|
|
|
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
|
+
/* prev page */
|
|
16
|
+
export type BrickItemsActionPrevPage = Action & {
|
|
17
|
+
__actionName: 'BRICK_ITEMS_PREV_PAGE'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* next page */
|
|
21
|
+
export type BrickItemsActionNextPage = Action & {
|
|
22
|
+
__actionName: 'BRICK_ITEMS_NEXT_PAGE'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* jump page */
|
|
26
|
+
export type BrickItemsActionJumpPage = ActionWithParams & {
|
|
27
|
+
__actionName: 'BRICK_ITEMS_JUMP_PAGE'
|
|
28
|
+
params?: Array<{
|
|
29
|
+
input: 'pageIndex'
|
|
30
|
+
value?: number | DataLink | EventProperty
|
|
31
|
+
mapping?: string
|
|
32
|
+
}>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* open detail */
|
|
36
|
+
export type BrickItemsActionOpenDetail = ActionWithParams & {
|
|
37
|
+
__actionName: 'BRICK_ITEMS_OPEN_DETAIL'
|
|
38
|
+
params?: Array<{
|
|
39
|
+
input: 'detailIndex'
|
|
40
|
+
value?: number | DataLink | EventProperty
|
|
41
|
+
mapping?: string
|
|
42
|
+
}>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* back list */
|
|
46
|
+
export type BrickItemsActionBackList = Action & {
|
|
47
|
+
__actionName: 'BRICK_ITEMS_BACK_LIST'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Trigger dynamic animation of item by data id or index */
|
|
51
|
+
export type BrickItemsActionDynamicAnimation = ActionWithParams & {
|
|
52
|
+
__actionName: 'BRICK_ITEMS_DYNAMIC_ANIMATION'
|
|
53
|
+
params?: Array<
|
|
54
|
+
| {
|
|
55
|
+
input: 'mode'
|
|
56
|
+
value?: 'list' | 'detail' | DataLink | EventProperty
|
|
57
|
+
mapping?: string
|
|
58
|
+
}
|
|
59
|
+
| {
|
|
60
|
+
input: 'brickId'
|
|
61
|
+
value?: string | DataLink | EventProperty
|
|
62
|
+
mapping?: string
|
|
63
|
+
}
|
|
64
|
+
| {
|
|
65
|
+
input: 'dataId'
|
|
66
|
+
value?: string | DataLink | EventProperty
|
|
67
|
+
mapping?: string
|
|
68
|
+
}
|
|
69
|
+
| {
|
|
70
|
+
input: 'index'
|
|
71
|
+
value?: number | DataLink | EventProperty
|
|
72
|
+
mapping?: string
|
|
73
|
+
}
|
|
74
|
+
| {
|
|
75
|
+
input: 'animationId'
|
|
76
|
+
value?: string | DataLink | (() => Animation) | EventProperty
|
|
77
|
+
mapping?: string
|
|
78
|
+
}
|
|
79
|
+
| {
|
|
80
|
+
input: 'animationType'
|
|
81
|
+
value?: 'once' | 'loop' | DataLink | EventProperty
|
|
82
|
+
mapping?: string
|
|
83
|
+
}
|
|
84
|
+
| {
|
|
85
|
+
input: 'animationResetInitialValue'
|
|
86
|
+
value?: boolean | DataLink | EventProperty
|
|
87
|
+
mapping?: string
|
|
88
|
+
}
|
|
89
|
+
>
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Reset dynamic action of item by data id or index */
|
|
93
|
+
export type BrickItemsActionDynamicAnimationReset = ActionWithParams & {
|
|
94
|
+
__actionName: 'BRICK_ITEMS_DYNAMIC_ANIMATION_RESET'
|
|
95
|
+
params?: Array<
|
|
96
|
+
| {
|
|
97
|
+
input: 'mode'
|
|
98
|
+
value?: 'list' | 'detail' | DataLink | EventProperty
|
|
99
|
+
mapping?: string
|
|
100
|
+
}
|
|
101
|
+
| {
|
|
102
|
+
input: 'brickId'
|
|
103
|
+
value?: string | DataLink | EventProperty
|
|
104
|
+
mapping?: string
|
|
105
|
+
}
|
|
106
|
+
| {
|
|
107
|
+
input: 'dataId'
|
|
108
|
+
value?: string | DataLink | EventProperty
|
|
109
|
+
mapping?: string
|
|
110
|
+
}
|
|
111
|
+
| {
|
|
112
|
+
input: 'index'
|
|
113
|
+
value?: number | DataLink | EventProperty
|
|
114
|
+
mapping?: string
|
|
115
|
+
}
|
|
116
|
+
>
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Stop dynamic action of item by data id or index */
|
|
120
|
+
export type BrickItemsActionDynamicAnimationStop = ActionWithParams & {
|
|
121
|
+
__actionName: 'BRICK_ITEMS_DYNAMIC_ANIMATION_STOP'
|
|
122
|
+
params?: Array<
|
|
123
|
+
| {
|
|
124
|
+
input: 'mode'
|
|
125
|
+
value?: 'list' | 'detail' | DataLink | EventProperty
|
|
126
|
+
mapping?: string
|
|
127
|
+
}
|
|
128
|
+
| {
|
|
129
|
+
input: 'brickId'
|
|
130
|
+
value?: string | DataLink | EventProperty
|
|
131
|
+
mapping?: string
|
|
132
|
+
}
|
|
133
|
+
| {
|
|
134
|
+
input: 'dataId'
|
|
135
|
+
value?: string | DataLink | EventProperty
|
|
136
|
+
mapping?: string
|
|
137
|
+
}
|
|
138
|
+
| {
|
|
139
|
+
input: 'index'
|
|
140
|
+
value?: number | DataLink | EventProperty
|
|
141
|
+
mapping?: string
|
|
142
|
+
}
|
|
143
|
+
>
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface BrickItemsDef {
|
|
147
|
+
/*
|
|
148
|
+
Default property:
|
|
149
|
+
{
|
|
150
|
+
"mode": "list",
|
|
151
|
+
"items": [],
|
|
152
|
+
"transformScriptEnabled": false,
|
|
153
|
+
"transformScriptCode": "\/\* Global variable: inputs = { items, variables } \*\/\nreturn inputs.items",
|
|
154
|
+
"transformScriptVariables": {},
|
|
155
|
+
"postTransformScriptEnabled": false,
|
|
156
|
+
"postTransformScriptCode": "\/\*\n * Global variable: inputs = {\n * itemsLength, // items data length\n * collections, // [{ index, item, renderList }] (all items data)\n * collectionsCurrentPage, // [{ index, item, renderList }] (current page items data)\n * renderList, // Flattened bricks of current page { frame: { x, y, width, height ... }, ... }\n * variables\n * }\n \*\/\nreturn inputs.renderList",
|
|
157
|
+
"postTransformScriptVariables": {},
|
|
158
|
+
"pageIndex": 0,
|
|
159
|
+
"selectedItemIndex": 0,
|
|
160
|
+
"allowPageOutOfBound": true,
|
|
161
|
+
"standbySequenceInterval": 500,
|
|
162
|
+
"standbySequenceRandom": 0,
|
|
163
|
+
"brickEditWidth": 10,
|
|
164
|
+
"brickEditHeight": 10,
|
|
165
|
+
"detailBrickEditWidth": 50,
|
|
166
|
+
"detailBrickEditHeight": 50,
|
|
167
|
+
"orderMode": "horizontal",
|
|
168
|
+
"resizeMode": "auto",
|
|
169
|
+
"justifyContent": "start",
|
|
170
|
+
"alignContent": "stretch",
|
|
171
|
+
"detailResizeMode": "auto",
|
|
172
|
+
"detailJustifyContent": "start",
|
|
173
|
+
"detailAlignContent": "stretch"
|
|
174
|
+
}
|
|
175
|
+
*/
|
|
176
|
+
property?: BrickBasicProperty & {
|
|
177
|
+
/* Set current display to `list` or `detail` mode */
|
|
178
|
+
mode?: 'list' | 'detail' | DataLink
|
|
179
|
+
/* Items to generate bricks for rendering */
|
|
180
|
+
items?: Array<any> | DataLink
|
|
181
|
+
/* Enable Transform Script */
|
|
182
|
+
transformScriptEnabled?: boolean | DataLink
|
|
183
|
+
/* Code of Transform Script */
|
|
184
|
+
transformScriptCode?: string | DataLink
|
|
185
|
+
/* Variables used in Transform Script (object) */
|
|
186
|
+
transformScriptVariables?: {} | DataLink
|
|
187
|
+
/* Enable Post Transform Script */
|
|
188
|
+
postTransformScriptEnabled?: boolean | DataLink
|
|
189
|
+
/* Code of Post Transform Script */
|
|
190
|
+
postTransformScriptCode?: string | DataLink
|
|
191
|
+
/* Variables used in Post Transform Script (object) */
|
|
192
|
+
postTransformScriptVariables?: {} | DataLink
|
|
193
|
+
/* Path to get item property for generate brick id instead of use index */
|
|
194
|
+
dataKeyPath?: string | DataLink
|
|
195
|
+
/* Items per page (Default: Items size) */
|
|
196
|
+
itemsPerPage?: number | DataLink
|
|
197
|
+
/* Current page index for `list` mode */
|
|
198
|
+
pageIndex?: number | DataLink
|
|
199
|
+
/* Current selected item index for `detail` mode */
|
|
200
|
+
selectedItemIndex?: number | DataLink
|
|
201
|
+
/* Allow page out of bound */
|
|
202
|
+
allowPageOutOfBound?: boolean | DataLink
|
|
203
|
+
/* Sequentially run Standby Transition for each item */
|
|
204
|
+
standbySequenceEnabled?: boolean | DataLink
|
|
205
|
+
/* Delay time (ms) between each item */
|
|
206
|
+
standbySequenceInterval?: number | DataLink
|
|
207
|
+
/* Random delay time (ms) increase or decrease between each item (e.g. if 100ms then delay time will be -100ms ~ 100ms) */
|
|
208
|
+
standbySequenceRandom?: number | DataLink
|
|
209
|
+
/* Define frame width of Brick List editor */
|
|
210
|
+
brickEditWidth?: number | DataLink
|
|
211
|
+
/* Define frame height of Brick List editor */
|
|
212
|
+
brickEditHeight?: number | DataLink
|
|
213
|
+
/* Define frame width of Brick List editor for detail mode */
|
|
214
|
+
detailBrickEditWidth?: number | DataLink
|
|
215
|
+
/* Define frame height of Brick List editor */
|
|
216
|
+
detailBrickEditHeight?: number | DataLink
|
|
217
|
+
/* order of horizontal first or vertical first */
|
|
218
|
+
orderMode?: 'horizontal' | 'vertical' | DataLink
|
|
219
|
+
/* Max horizontal item quantity */
|
|
220
|
+
horizontalMaxQuantity?: number | DataLink
|
|
221
|
+
/* Max vertical item quantity */
|
|
222
|
+
verticalMaxQuantity?: number | DataLink
|
|
223
|
+
/* Resize mode */
|
|
224
|
+
resizeMode?: 'auto' | 'fix' | DataLink
|
|
225
|
+
/* Justify Content */
|
|
226
|
+
justifyContent?: 'start' | 'end' | 'center' | 'space-between' | 'space-around' | DataLink
|
|
227
|
+
/* Align Content */
|
|
228
|
+
alignContent?:
|
|
229
|
+
| 'stretch'
|
|
230
|
+
| 'start'
|
|
231
|
+
| 'end'
|
|
232
|
+
| 'center'
|
|
233
|
+
| 'space-between'
|
|
234
|
+
| 'space-around'
|
|
235
|
+
| DataLink
|
|
236
|
+
/* Resize mode for detail mode */
|
|
237
|
+
detailResizeMode?: 'auto' | 'fix' | DataLink
|
|
238
|
+
/* Align Content for detail mode */
|
|
239
|
+
detailJustifyContent?: 'start' | 'end' | 'center' | DataLink
|
|
240
|
+
/* Align Content for detail mode */
|
|
241
|
+
detailAlignContent?: 'stretch' | 'start' | 'end' | 'center' | DataLink
|
|
242
|
+
}
|
|
243
|
+
/* Brick Definitions for render bricks for each item of `items` on `list` mode */
|
|
244
|
+
brickList?:
|
|
245
|
+
| Array<
|
|
246
|
+
| DataLink
|
|
247
|
+
| {
|
|
248
|
+
title?: string | DataLink
|
|
249
|
+
description?: string | DataLink
|
|
250
|
+
hidden?: boolean | DataLink
|
|
251
|
+
brickId?: string | DataLink
|
|
252
|
+
brickIdPrefix?: string | DataLink
|
|
253
|
+
templateKey?: string | DataLink
|
|
254
|
+
property?: {} | DataLink
|
|
255
|
+
animation?: {} | DataLink
|
|
256
|
+
eventMap?: {} | DataLink
|
|
257
|
+
outlet?: {} | DataLink
|
|
258
|
+
stateGroup?: any
|
|
259
|
+
propertyMapping?: {} | DataLink
|
|
260
|
+
frame?:
|
|
261
|
+
| DataLink
|
|
262
|
+
| {
|
|
263
|
+
x?: number | DataLink
|
|
264
|
+
y?: number | DataLink
|
|
265
|
+
width?: number | DataLink
|
|
266
|
+
height?: number | DataLink
|
|
267
|
+
standbyMode?: 'custom' | 'top' | 'bottom' | 'left' | 'right' | DataLink
|
|
268
|
+
standbyFrame?: DataLink | {}
|
|
269
|
+
standbyOpacity?: number | DataLink
|
|
270
|
+
standbyDelay?: number | DataLink
|
|
271
|
+
standbyDelayRandom?: number | DataLink
|
|
272
|
+
standbyEasing?:
|
|
273
|
+
| DataLink
|
|
274
|
+
| {
|
|
275
|
+
default?:
|
|
276
|
+
| DataLink
|
|
277
|
+
| {
|
|
278
|
+
method?: string | DataLink
|
|
279
|
+
duration?: number | DataLink
|
|
280
|
+
}
|
|
281
|
+
x?:
|
|
282
|
+
| DataLink
|
|
283
|
+
| {
|
|
284
|
+
method?: string | DataLink
|
|
285
|
+
duration?: number | DataLink
|
|
286
|
+
}
|
|
287
|
+
y?:
|
|
288
|
+
| DataLink
|
|
289
|
+
| {
|
|
290
|
+
method?: string | DataLink
|
|
291
|
+
duration?: number | DataLink
|
|
292
|
+
}
|
|
293
|
+
width?:
|
|
294
|
+
| DataLink
|
|
295
|
+
| {
|
|
296
|
+
method?: string | DataLink
|
|
297
|
+
duration?: number | DataLink
|
|
298
|
+
}
|
|
299
|
+
height?:
|
|
300
|
+
| DataLink
|
|
301
|
+
| {
|
|
302
|
+
method?: string | DataLink
|
|
303
|
+
duration?: number | DataLink
|
|
304
|
+
}
|
|
305
|
+
opacity?:
|
|
306
|
+
| DataLink
|
|
307
|
+
| {
|
|
308
|
+
method?: string | DataLink
|
|
309
|
+
duration?: number | DataLink
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
showingDelay?: number | DataLink
|
|
313
|
+
renderOutOfViewport?: boolean | DataLink
|
|
314
|
+
}
|
|
315
|
+
show?: string | DataLink
|
|
316
|
+
pressToOpenDetail?: boolean | DataLink
|
|
317
|
+
}
|
|
318
|
+
>
|
|
319
|
+
| DataLink
|
|
320
|
+
/* Brick Definitions for render bricks for each item of `items` on `detail` mode */
|
|
321
|
+
brickDetails?:
|
|
322
|
+
| Array<
|
|
323
|
+
| DataLink
|
|
324
|
+
| {
|
|
325
|
+
title?: string | DataLink
|
|
326
|
+
description?: string | DataLink
|
|
327
|
+
hidden?: boolean | DataLink
|
|
328
|
+
brickId?: string | DataLink
|
|
329
|
+
brickIdPrefix?: string | DataLink
|
|
330
|
+
templateKey?: string | DataLink
|
|
331
|
+
property?: {} | DataLink
|
|
332
|
+
animation?: {} | DataLink
|
|
333
|
+
eventMap?: {} | DataLink
|
|
334
|
+
outlet?: {} | DataLink
|
|
335
|
+
stateGroup?: any
|
|
336
|
+
propertyMapping?: {} | DataLink
|
|
337
|
+
frame?:
|
|
338
|
+
| DataLink
|
|
339
|
+
| {
|
|
340
|
+
x?: number | DataLink
|
|
341
|
+
y?: number | DataLink
|
|
342
|
+
width?: number | DataLink
|
|
343
|
+
height?: number | DataLink
|
|
344
|
+
standbyMode?: 'custom' | 'top' | 'bottom' | 'left' | 'right' | DataLink
|
|
345
|
+
standbyFrame?: DataLink | {}
|
|
346
|
+
standbyOpacity?: number | DataLink
|
|
347
|
+
standbyDelay?: number | DataLink
|
|
348
|
+
standbyDelayRandom?: number | DataLink
|
|
349
|
+
standbyEasing?:
|
|
350
|
+
| DataLink
|
|
351
|
+
| {
|
|
352
|
+
default?:
|
|
353
|
+
| DataLink
|
|
354
|
+
| {
|
|
355
|
+
method?: string | DataLink
|
|
356
|
+
duration?: number | DataLink
|
|
357
|
+
}
|
|
358
|
+
x?:
|
|
359
|
+
| DataLink
|
|
360
|
+
| {
|
|
361
|
+
method?: string | DataLink
|
|
362
|
+
duration?: number | DataLink
|
|
363
|
+
}
|
|
364
|
+
y?:
|
|
365
|
+
| DataLink
|
|
366
|
+
| {
|
|
367
|
+
method?: string | DataLink
|
|
368
|
+
duration?: number | DataLink
|
|
369
|
+
}
|
|
370
|
+
width?:
|
|
371
|
+
| DataLink
|
|
372
|
+
| {
|
|
373
|
+
method?: string | DataLink
|
|
374
|
+
duration?: number | DataLink
|
|
375
|
+
}
|
|
376
|
+
height?:
|
|
377
|
+
| DataLink
|
|
378
|
+
| {
|
|
379
|
+
method?: string | DataLink
|
|
380
|
+
duration?: number | DataLink
|
|
381
|
+
}
|
|
382
|
+
opacity?:
|
|
383
|
+
| DataLink
|
|
384
|
+
| {
|
|
385
|
+
method?: string | DataLink
|
|
386
|
+
duration?: number | DataLink
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
showingDelay?: number | DataLink
|
|
390
|
+
renderOutOfViewport?: boolean | DataLink
|
|
391
|
+
}
|
|
392
|
+
show?: string | DataLink
|
|
393
|
+
pressToBackList?: boolean | DataLink
|
|
394
|
+
}
|
|
395
|
+
>
|
|
396
|
+
| DataLink
|
|
397
|
+
events?: BrickBasicEventsForItem & {
|
|
398
|
+
/* Event on page render finished */
|
|
399
|
+
onPageRender?: Array<EventActionForItem>
|
|
400
|
+
/* Event on page change. */
|
|
401
|
+
onPageChange?: Array<EventActionForItem>
|
|
402
|
+
/* Event on page index out of bound. */
|
|
403
|
+
onPageOutOfBound?: Array<EventActionForItem>
|
|
404
|
+
/* Event on into `detail` mode */
|
|
405
|
+
onIntoDetailMode?: Array<EventActionForItem>
|
|
406
|
+
/* Event on into `list` mode. */
|
|
407
|
+
onIntoListMode?: Array<EventActionForItem>
|
|
408
|
+
/* Event on render error */
|
|
409
|
+
onError?: Array<EventActionForItem>
|
|
410
|
+
}
|
|
411
|
+
outlets?: {
|
|
412
|
+
/* Catched error message */
|
|
413
|
+
error?: () => Data
|
|
414
|
+
/* Current render mode */
|
|
415
|
+
mode?: () => Data
|
|
416
|
+
/* Current page index */
|
|
417
|
+
pageIndex?: () => Data
|
|
418
|
+
/* Current page size */
|
|
419
|
+
pageSize?: () => Data
|
|
420
|
+
/* Selected item index of detail mode */
|
|
421
|
+
selectedItemIndex?: () => Data
|
|
422
|
+
/* Page is out of bound */
|
|
423
|
+
pageIsOutOfBound?: () => Data
|
|
424
|
+
}
|
|
425
|
+
animation?: AnimationBasicEvents & {
|
|
426
|
+
onPageRender?: Animation
|
|
427
|
+
onPageChange?: Animation
|
|
428
|
+
onPageOutOfBound?: Animation
|
|
429
|
+
onIntoDetailMode?: Animation
|
|
430
|
+
onIntoListMode?: Animation
|
|
431
|
+
onError?: Animation
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/* Brick items component */
|
|
436
|
+
export type BrickItems = Brick &
|
|
437
|
+
BrickItemsDef & {
|
|
438
|
+
templateKey: 'BRICK_ITEMS'
|
|
439
|
+
switches: Array<
|
|
440
|
+
SwitchDef &
|
|
441
|
+
BrickItemsDef & {
|
|
442
|
+
conds?: Array<{
|
|
443
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
444
|
+
cond:
|
|
445
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
446
|
+
| SwitchCondData
|
|
447
|
+
| {
|
|
448
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
449
|
+
outlet:
|
|
450
|
+
| 'error'
|
|
451
|
+
| 'mode'
|
|
452
|
+
| 'pageIndex'
|
|
453
|
+
| 'pageSize'
|
|
454
|
+
| 'selectedItemIndex'
|
|
455
|
+
| 'pageIsOutOfBound'
|
|
456
|
+
value: any
|
|
457
|
+
}
|
|
458
|
+
}>
|
|
459
|
+
}
|
|
460
|
+
>
|
|
461
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
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 animation */
|
|
16
|
+
export type BrickLottieActionPlay = ActionWithParams & {
|
|
17
|
+
__actionName: 'BRICK_LOTTIE_PLAY'
|
|
18
|
+
params?: Array<
|
|
19
|
+
| {
|
|
20
|
+
input: 'startFrame'
|
|
21
|
+
value?: number | DataLink | EventProperty
|
|
22
|
+
mapping?: string
|
|
23
|
+
}
|
|
24
|
+
| {
|
|
25
|
+
input: 'endFrame'
|
|
26
|
+
value?: number | DataLink | EventProperty
|
|
27
|
+
mapping?: string
|
|
28
|
+
}
|
|
29
|
+
>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Pause animation */
|
|
33
|
+
export type BrickLottieActionPause = Action & {
|
|
34
|
+
__actionName: 'BRICK_LOTTIE_PAUSE'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Resume animation */
|
|
38
|
+
export type BrickLottieActionResume = Action & {
|
|
39
|
+
__actionName: 'BRICK_LOTTIE_RESUME'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Stop animation */
|
|
43
|
+
export type BrickLottieActionStop = Action & {
|
|
44
|
+
__actionName: 'BRICK_LOTTIE_STOP'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Reset animation */
|
|
48
|
+
export type BrickLottieActionReset = Action & {
|
|
49
|
+
__actionName: 'BRICK_LOTTIE_RESET'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface BrickLottieDef {
|
|
53
|
+
/*
|
|
54
|
+
Default property:
|
|
55
|
+
{
|
|
56
|
+
"loop": true,
|
|
57
|
+
"autoPlay": true,
|
|
58
|
+
"resizeMode": "contain",
|
|
59
|
+
"renderMode": "auto"
|
|
60
|
+
}
|
|
61
|
+
*/
|
|
62
|
+
property?: BrickBasicProperty & {
|
|
63
|
+
/* The animation json config content from uri */
|
|
64
|
+
uri?: string | DataLink
|
|
65
|
+
/* The checksum of `uri` */
|
|
66
|
+
md5?: string | DataLink
|
|
67
|
+
/* The animation json config content(The `uri` will be ignored if `source` is defined) */
|
|
68
|
+
source?: {} | DataLink
|
|
69
|
+
/* The speed the animation will progress. This only affects the imperative API. Sending a negative value will reverse the animation. */
|
|
70
|
+
speed?: number | DataLink
|
|
71
|
+
/* A boolean flag indicating whether or not the animation should loop. */
|
|
72
|
+
loop?: boolean | DataLink
|
|
73
|
+
/* A boolean flag indicating whether or not the animation should start automatically when mounted. This only affects the imperative API. */
|
|
74
|
+
autoPlay?: boolean | DataLink
|
|
75
|
+
/* The animation resize mode */
|
|
76
|
+
resizeMode?: 'cover' | 'contain' | 'center' | DataLink
|
|
77
|
+
/* A flag to set whether or not to render with hardware or software acceleration (Not supported for iOS) */
|
|
78
|
+
renderMode?: 'auto' | 'hardware' | 'software' | DataLink
|
|
79
|
+
/* Replace color (as hex string) by keypath */
|
|
80
|
+
colorFilters?:
|
|
81
|
+
| Array<
|
|
82
|
+
| DataLink
|
|
83
|
+
| {
|
|
84
|
+
keypath?: string | DataLink
|
|
85
|
+
color?: string | DataLink
|
|
86
|
+
}
|
|
87
|
+
>
|
|
88
|
+
| DataLink
|
|
89
|
+
/* Replace color (as hex string) by find text. Use text filters will disable glyphs text render / force software render mode, This means that a specific font needs to be loaded. */
|
|
90
|
+
textFilters?:
|
|
91
|
+
| Array<
|
|
92
|
+
| DataLink
|
|
93
|
+
| {
|
|
94
|
+
find?: string | DataLink
|
|
95
|
+
replace?: string | DataLink
|
|
96
|
+
}
|
|
97
|
+
>
|
|
98
|
+
| DataLink
|
|
99
|
+
}
|
|
100
|
+
events?: BrickBasicEvents & {
|
|
101
|
+
/* Event of the brick press */
|
|
102
|
+
onPress?: Array<EventAction>
|
|
103
|
+
/* Event of the brick press in */
|
|
104
|
+
onPressIn?: Array<EventAction>
|
|
105
|
+
/* Event of the brick press out */
|
|
106
|
+
onPressOut?: Array<EventAction>
|
|
107
|
+
/* Event of the brick long press */
|
|
108
|
+
onLongPress?: Array<EventAction>
|
|
109
|
+
/* Event of the brick focus (Use TV Device with controller) */
|
|
110
|
+
onFocus?: Array<EventAction>
|
|
111
|
+
/* Event of the brick blur (Use TV Device with controller) */
|
|
112
|
+
onBlur?: Array<EventAction>
|
|
113
|
+
/* Event of the animation finished */
|
|
114
|
+
onAnimationFinish?: Array<EventAction>
|
|
115
|
+
/* Event of the uri on load failed */
|
|
116
|
+
onAnimationFailure?: Array<EventAction>
|
|
117
|
+
/* Event of the animation on loop */
|
|
118
|
+
onAnimationLoop?: Array<EventAction>
|
|
119
|
+
}
|
|
120
|
+
outlets?: {
|
|
121
|
+
/* Brick is pressing */
|
|
122
|
+
brickPressing?: () => Data
|
|
123
|
+
/* Brick is focusing (Use TV Device with controller) */
|
|
124
|
+
brickFocusing?: () => Data
|
|
125
|
+
}
|
|
126
|
+
animation?: AnimationBasicEvents & {
|
|
127
|
+
onPress?: Animation
|
|
128
|
+
onPressIn?: Animation
|
|
129
|
+
onPressOut?: Animation
|
|
130
|
+
onLongPress?: Animation
|
|
131
|
+
onFocus?: Animation
|
|
132
|
+
onBlur?: Animation
|
|
133
|
+
onAnimationFinish?: Animation
|
|
134
|
+
onAnimationFailure?: Animation
|
|
135
|
+
onAnimationLoop?: Animation
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Lottie Adobe After Effects animations brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378583-lottie)) */
|
|
140
|
+
export type BrickLottie = Brick &
|
|
141
|
+
BrickLottieDef & {
|
|
142
|
+
templateKey: 'BRICK_LOTTIE'
|
|
143
|
+
switches: Array<
|
|
144
|
+
SwitchDef &
|
|
145
|
+
BrickLottieDef & {
|
|
146
|
+
conds?: Array<{
|
|
147
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
148
|
+
cond:
|
|
149
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
150
|
+
| SwitchCondData
|
|
151
|
+
| {
|
|
152
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
153
|
+
outlet: 'brickPressing' | 'brickFocusing'
|
|
154
|
+
value: any
|
|
155
|
+
}
|
|
156
|
+
}>
|
|
157
|
+
}
|
|
158
|
+
>
|
|
159
|
+
}
|