@fugood/bricks-project 2.22.0-beta.3 → 2.22.0-beta.30

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 (87) hide show
  1. package/compile/action-name-map.ts +176 -1
  2. package/compile/index.ts +1 -0
  3. package/package.json +3 -3
  4. package/tools/postinstall.ts +17 -11
  5. package/types/animation.ts +2 -1
  6. package/types/brick-base.ts +77 -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 +237 -0
  11. package/types/bricks/Icon.ts +90 -0
  12. package/types/bricks/Image.ts +101 -0
  13. package/types/bricks/Items.ts +461 -0
  14. package/types/bricks/Lottie.ts +156 -0
  15. package/types/bricks/QrCode.ts +109 -0
  16. package/types/bricks/Rect.ts +107 -0
  17. package/types/bricks/RichText.ts +120 -0
  18. package/types/bricks/Rive.ts +209 -0
  19. package/types/bricks/Slideshow.ts +155 -0
  20. package/types/bricks/Svg.ts +91 -0
  21. package/types/bricks/Text.ts +140 -0
  22. package/types/bricks/TextInput.ts +231 -0
  23. package/types/bricks/Video.ts +167 -0
  24. package/types/bricks/VideoStreaming.ts +104 -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/canvas.ts +1 -1
  29. package/types/common.ts +3 -3
  30. package/types/data.ts +6 -0
  31. package/types/generators/AlarmClock.ts +102 -0
  32. package/types/generators/Assistant.ts +546 -0
  33. package/types/generators/BleCentral.ts +225 -0
  34. package/types/generators/BlePeripheral.ts +202 -0
  35. package/types/generators/CanvasMap.ts +57 -0
  36. package/types/generators/CastlesPay.ts +77 -0
  37. package/types/generators/DataBank.ts +123 -0
  38. package/types/generators/File.ts +351 -0
  39. package/types/generators/GraphQl.ts +124 -0
  40. package/types/generators/Http.ts +117 -0
  41. package/types/generators/HttpServer.ts +156 -0
  42. package/types/generators/Information.ts +97 -0
  43. package/types/generators/Intent.ts +107 -0
  44. package/types/generators/Iterator.ts +95 -0
  45. package/types/generators/Keyboard.ts +85 -0
  46. package/types/generators/LlmAnthropicCompat.ts +188 -0
  47. package/types/generators/LlmGgml.ts +719 -0
  48. package/types/generators/LlmOnnx.ts +184 -0
  49. package/types/generators/LlmOpenAiCompat.ts +206 -0
  50. package/types/generators/LlmQualcommAiEngine.ts +213 -0
  51. package/types/generators/Mcp.ts +294 -0
  52. package/types/generators/McpServer.ts +245 -0
  53. package/types/generators/MediaFlow.ts +142 -0
  54. package/types/generators/MqttBroker.ts +121 -0
  55. package/types/generators/MqttClient.ts +129 -0
  56. package/types/generators/Question.ts +395 -0
  57. package/types/generators/RealtimeTranscription.ts +172 -0
  58. package/types/generators/RerankerGgml.ts +153 -0
  59. package/types/generators/SerialPort.ts +141 -0
  60. package/types/generators/SoundPlayer.ts +86 -0
  61. package/types/generators/SoundRecorder.ts +113 -0
  62. package/types/generators/SpeechToTextGgml.ts +462 -0
  63. package/types/generators/SpeechToTextOnnx.ts +227 -0
  64. package/types/generators/SpeechToTextPlatform.ts +75 -0
  65. package/types/generators/SqLite.ts +118 -0
  66. package/types/generators/Step.ts +101 -0
  67. package/types/generators/TapToPayOnIPhone.ts +175 -0
  68. package/types/generators/Tcp.ts +120 -0
  69. package/types/generators/TcpServer.ts +137 -0
  70. package/types/generators/TextToSpeechGgml.ts +182 -0
  71. package/types/generators/TextToSpeechOnnx.ts +169 -0
  72. package/types/generators/TextToSpeechOpenAiLike.ts +113 -0
  73. package/types/generators/ThermalPrinter.ts +185 -0
  74. package/types/generators/Tick.ts +75 -0
  75. package/types/generators/Udp.ts +109 -0
  76. package/types/generators/VadGgml.ts +211 -0
  77. package/types/generators/VectorStore.ts +223 -0
  78. package/types/generators/Watchdog.ts +96 -0
  79. package/types/generators/WebCrawler.ts +97 -0
  80. package/types/generators/WebRtc.ts +165 -0
  81. package/types/generators/WebSocket.ts +142 -0
  82. package/types/generators/index.ts +51 -0
  83. package/types/system.ts +64 -0
  84. package/utils/data.ts +45 -0
  85. package/utils/event-props.ts +210 -0
  86. package/types/bricks.ts +0 -3166
  87. package/types/generators.ts +0 -6671
@@ -0,0 +1,109 @@
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 BrickQrcodeDef {
16
+ /*
17
+ Default property:
18
+ {
19
+ "value": "",
20
+ "positiveColor": "#1e252a",
21
+ "negativeColor": "transparent",
22
+ "padding": 0,
23
+ "linearGradientEnabled": false,
24
+ "linearGradientStart": "black",
25
+ "linearGradientEnd": "black",
26
+ "linearGradientDirection": [
27
+ "0%",
28
+ "0%",
29
+ "100%",
30
+ "100%"
31
+ ],
32
+ "logoSize": 20,
33
+ "logoBackgroundColor": "transparent"
34
+ }
35
+ */
36
+ property?: BrickBasicProperty & {
37
+ /* The QRCode content */
38
+ value?: string | DataLink
39
+ /* The foreground color of QRCode */
40
+ positiveColor?: string | DataLink
41
+ /* The background color of QRCode */
42
+ negativeColor?: string | DataLink
43
+ /* Quiet zone around the qr */
44
+ padding?: number | DataLink
45
+ /* Enables or disables linear gradient */
46
+ linearGradientEnabled?: boolean | DataLink
47
+ /* Linear gradient start color */
48
+ linearGradientStart?: string | DataLink
49
+ /* Linear gradient end color */
50
+ linearGradientEnd?: string | DataLink
51
+ /* Linear gradient direction ('0%', '0%', '100%', '100%') */
52
+ linearGradientDirection?: Array<string | DataLink> | DataLink
53
+ /* Logo image source */
54
+ logoPath?: string | DataLink
55
+ /* The checksum of logo file */
56
+ md5?: string | DataLink
57
+ /* Logo image size (% of QRCode) */
58
+ logoSize?: number | DataLink
59
+ /* The logo gets a filled quadratic background with this color. */
60
+ logoBackgroundColor?: string | DataLink
61
+ }
62
+ events?: BrickBasicEvents & {
63
+ /* Event of the brick press */
64
+ onPress?: Array<EventAction>
65
+ /* Event of the brick press in */
66
+ onPressIn?: Array<EventAction>
67
+ /* Event of the brick press out */
68
+ onPressOut?: Array<EventAction>
69
+ /* Event of the brick focus (Use TV Device with controller) */
70
+ onFocus?: Array<EventAction>
71
+ /* Event of the brick blur (Use TV Device with controller) */
72
+ onBlur?: Array<EventAction>
73
+ }
74
+ outlets?: {
75
+ /* Brick is pressing */
76
+ brickPressing?: () => Data
77
+ /* Brick is focusing (Use TV Device with controller) */
78
+ brickFocusing?: () => Data
79
+ }
80
+ animation?: AnimationBasicEvents & {
81
+ onPress?: Animation
82
+ onPressIn?: Animation
83
+ onPressOut?: Animation
84
+ onFocus?: Animation
85
+ onBlur?: Animation
86
+ }
87
+ }
88
+
89
+ /* QRCode brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378579-qr-code)) */
90
+ export type BrickQrcode = Brick &
91
+ BrickQrcodeDef & {
92
+ templateKey: 'BRICK_QRCODE'
93
+ switches: Array<
94
+ SwitchDef &
95
+ BrickQrcodeDef & {
96
+ conds?: Array<{
97
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
98
+ cond:
99
+ | SwitchCondInnerStateCurrentCanvas
100
+ | SwitchCondData
101
+ | {
102
+ __typename: 'SwitchCondInnerStateOutlet'
103
+ outlet: 'brickPressing' | 'brickFocusing'
104
+ value: any
105
+ }
106
+ }>
107
+ }
108
+ >
109
+ }
@@ -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 BrickRectDef {
16
+ /*
17
+ Default property:
18
+ {
19
+ "linearGradientEnabled": false,
20
+ "linearGradientColors": [
21
+ "#000000",
22
+ "#FFFFFF"
23
+ ],
24
+ "linearGradientStart": {
25
+ "x": 0,
26
+ "y": 0
27
+ },
28
+ "linearGradientEnd": {
29
+ "x": 1,
30
+ "y": 1
31
+ },
32
+ "linearGradientLocations": [
33
+ 0,
34
+ 1
35
+ ]
36
+ }
37
+ */
38
+ property?: BrickBasicProperty & {
39
+ /* Enables or disables linear gradient */
40
+ linearGradientEnabled?: boolean | DataLink
41
+ /* An array of at least two color values that represent gradient colors */
42
+ linearGradientColors?: Array<string | DataLink> | DataLink
43
+ /* An optional object of the following type: { x: number, y: number } */
44
+ linearGradientStart?:
45
+ | DataLink
46
+ | {
47
+ x?: number | DataLink
48
+ y?: number | DataLink
49
+ }
50
+ /* Same as start, but for the end of the gradient */
51
+ linearGradientEnd?:
52
+ | DataLink
53
+ | {
54
+ x?: number | DataLink
55
+ y?: number | DataLink
56
+ }
57
+ /* An optional array of numbers defining the location of each gradient color stop */
58
+ linearGradientLocations?: Array<number | DataLink> | DataLink
59
+ }
60
+ events?: BrickBasicEvents & {
61
+ /* Event of the brick press */
62
+ onPress?: Array<EventAction>
63
+ /* Event of the brick press in */
64
+ onPressIn?: Array<EventAction>
65
+ /* Event of the brick press out */
66
+ onPressOut?: Array<EventAction>
67
+ /* Event of the brick focus (Use TV Device with controller) */
68
+ onFocus?: Array<EventAction>
69
+ /* Event of the brick blur (Use TV Device with controller) */
70
+ onBlur?: Array<EventAction>
71
+ }
72
+ outlets?: {
73
+ /* Brick is pressing */
74
+ brickPressing?: () => Data
75
+ /* Brick is focusing (Use TV Device with controller) */
76
+ brickFocusing?: () => Data
77
+ }
78
+ animation?: AnimationBasicEvents & {
79
+ onPress?: Animation
80
+ onPressIn?: Animation
81
+ onPressOut?: Animation
82
+ onFocus?: Animation
83
+ onBlur?: Animation
84
+ }
85
+ }
86
+
87
+ /* Rect brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378573-rect)) */
88
+ export type BrickRect = Brick &
89
+ BrickRectDef & {
90
+ templateKey: 'BRICK_RECT'
91
+ switches: Array<
92
+ SwitchDef &
93
+ BrickRectDef & {
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,120 @@
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 BrickRichTextDef {
16
+ /*
17
+ Default property:
18
+ {
19
+ "content": "",
20
+ "renderImage": false,
21
+ "color": "#000",
22
+ "fontWeight": "normal",
23
+ "fontStyle": "normal",
24
+ "fontSizes": {
25
+ "base": 3,
26
+ "h1": 6.857142857142857,
27
+ "h2": 5.714285714285714,
28
+ "h3": 4.011428571428572,
29
+ "h4": 3.428571428571429,
30
+ "h5": 2.845714285714286,
31
+ "h6": 2.285714285714286
32
+ }
33
+ }
34
+ */
35
+ property?: BrickBasicProperty & {
36
+ /* The text content */
37
+ content?: string | DataLink
38
+ /* Render Image */
39
+ renderImage?: boolean | DataLink
40
+ /* The text color */
41
+ color?: string | DataLink
42
+ /* Specifies font weight. The values 'normal' and are supported for most fonts. Not all fonts have a variant for each of the numeric values, in that case the closest one is chosen. */
43
+ fontWeight?:
44
+ | 'normal'
45
+ | 'bold'
46
+ | '100'
47
+ | '200'
48
+ | '300'
49
+ | '400'
50
+ | '500'
51
+ | '600'
52
+ | '700'
53
+ | '800'
54
+ | '900'
55
+ | DataLink
56
+ /* The text font style */
57
+ fontStyle?: 'normal' | 'italic' | DataLink
58
+ /* The text font family */
59
+ fontFamily?: string | DataLink
60
+ /* The text font size definition (base and headers) */
61
+ fontSizes?:
62
+ | DataLink
63
+ | {
64
+ base?: number | DataLink // BRICKS Grid unit
65
+ h1?: number | DataLink // BRICKS Grid unit
66
+ h2?: number | DataLink // BRICKS Grid unit
67
+ h3?: number | DataLink // BRICKS Grid unit
68
+ h4?: number | DataLink // BRICKS Grid unit
69
+ h5?: number | DataLink // BRICKS Grid unit
70
+ h6?: number | DataLink // BRICKS Grid unit
71
+ }
72
+ }
73
+ events?: BrickBasicEvents & {
74
+ /* Event of the brick press */
75
+ onPress?: Array<EventAction>
76
+ /* Event of the brick press in */
77
+ onPressIn?: Array<EventAction>
78
+ /* Event of the brick press out */
79
+ onPressOut?: Array<EventAction>
80
+ /* Event of the brick focus (Use TV Device with controller) */
81
+ onFocus?: Array<EventAction>
82
+ /* Event of the brick blur (Use TV Device with controller) */
83
+ onBlur?: Array<EventAction>
84
+ }
85
+ outlets?: {
86
+ /* Brick is pressing */
87
+ brickPressing?: () => Data
88
+ /* Brick is focusing (Use TV Device with controller) */
89
+ brickFocusing?: () => Data
90
+ }
91
+ animation?: AnimationBasicEvents & {
92
+ onPress?: Animation
93
+ onPressIn?: Animation
94
+ onPressOut?: Animation
95
+ onFocus?: Animation
96
+ onBlur?: Animation
97
+ }
98
+ }
99
+
100
+ /* RichText brick */
101
+ export type BrickRichText = Brick &
102
+ BrickRichTextDef & {
103
+ templateKey: 'BRICK_RICH_TEXT'
104
+ switches: Array<
105
+ SwitchDef &
106
+ BrickRichTextDef & {
107
+ conds?: Array<{
108
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
109
+ cond:
110
+ | SwitchCondInnerStateCurrentCanvas
111
+ | SwitchCondData
112
+ | {
113
+ __typename: 'SwitchCondInnerStateOutlet'
114
+ outlet: 'brickPressing' | 'brickFocusing'
115
+ value: any
116
+ }
117
+ }>
118
+ }
119
+ >
120
+ }
@@ -0,0 +1,209 @@
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 BrickRiveActionPlay = ActionWithParams & {
17
+ __actionName: 'BRICK_RIVE_PLAY'
18
+ params?: Array<
19
+ | {
20
+ input: 'animationName'
21
+ value?: string | DataLink | EventProperty
22
+ mapping?: string
23
+ }
24
+ | {
25
+ input: 'loop'
26
+ value?: 'auto' | 'oneShot' | 'loop' | 'pingPong' | DataLink | EventProperty
27
+ mapping?: string
28
+ }
29
+ | {
30
+ input: 'direction'
31
+ value?: 'auto' | 'backwards' | 'forwards' | DataLink | EventProperty
32
+ mapping?: string
33
+ }
34
+ | {
35
+ input: 'isStateMachine'
36
+ value?: boolean | DataLink | EventProperty
37
+ mapping?: string
38
+ }
39
+ >
40
+ }
41
+
42
+ /* Pause animation */
43
+ export type BrickRiveActionPause = Action & {
44
+ __actionName: 'BRICK_RIVE_PAUSE'
45
+ }
46
+
47
+ /* Stop animation */
48
+ export type BrickRiveActionStop = Action & {
49
+ __actionName: 'BRICK_RIVE_STOP'
50
+ }
51
+
52
+ /* Reset animation */
53
+ export type BrickRiveActionReset = Action & {
54
+ __actionName: 'BRICK_RIVE_RESET'
55
+ }
56
+
57
+ /* Fire state */
58
+ export type BrickRiveActionFireState = ActionWithParams & {
59
+ __actionName: 'BRICK_RIVE_FIRE_STATE'
60
+ params?: Array<
61
+ | {
62
+ input: 'stateMachineName'
63
+ value?: string | DataLink | EventProperty
64
+ mapping?: string
65
+ }
66
+ | {
67
+ input: 'inputName'
68
+ value?: string | DataLink | EventProperty
69
+ mapping?: string
70
+ }
71
+ >
72
+ }
73
+
74
+ /* Set input state */
75
+ export type BrickRiveActionSetInputState = ActionWithParams & {
76
+ __actionName: 'BRICK_RIVE_SET_INPUT_STATE'
77
+ params?: Array<
78
+ | {
79
+ input: 'stateMachineName'
80
+ value?: string | DataLink | EventProperty
81
+ mapping?: string
82
+ }
83
+ | {
84
+ input: 'inputName'
85
+ value?: string | DataLink | EventProperty
86
+ mapping?: string
87
+ }
88
+ | {
89
+ input: 'value'
90
+ value?: any | EventProperty
91
+ mapping?: string
92
+ }
93
+ >
94
+ }
95
+
96
+ /* Set text run value. Text Run name need to defined as unique name in Rive file. (Ref: https://rive.app/community/doc/text/docn2E6y1lXo) */
97
+ export type BrickRiveActionSetTextRunValue = ActionWithParams & {
98
+ __actionName: 'BRICK_RIVE_SET_TEXT_RUN_VALUE'
99
+ params?: Array<
100
+ | {
101
+ input: 'textRunName'
102
+ value?: string | DataLink | EventProperty
103
+ mapping?: string
104
+ }
105
+ | {
106
+ input: 'value'
107
+ value?: any | EventProperty
108
+ mapping?: string
109
+ }
110
+ >
111
+ }
112
+
113
+ interface BrickRiveDef {
114
+ /*
115
+ Default property:
116
+ {
117
+ "autoplay": true,
118
+ "alignment": "center",
119
+ "fit": "contain"
120
+ }
121
+ */
122
+ property?: BrickBasicProperty & {
123
+ /* Rive file url */
124
+ url?: string | DataLink
125
+ /* The checksum of `url` */
126
+ md5?: string | DataLink
127
+ /* Autoplay the animation */
128
+ autoplay?: boolean | DataLink
129
+ /* Alignment of the animation */
130
+ alignment?:
131
+ | 'topLeft'
132
+ | 'topCenter'
133
+ | 'topRight'
134
+ | 'centerLeft'
135
+ | 'center'
136
+ | 'centerRight'
137
+ | 'bottomLeft'
138
+ | 'bottomCenter'
139
+ | 'bottomRight'
140
+ | DataLink
141
+ /* Fit mode of the animation */
142
+ fit?:
143
+ | 'cover'
144
+ | 'contain'
145
+ | 'fill'
146
+ | 'fitWidth'
147
+ | 'fitHeight'
148
+ | 'none'
149
+ | 'scaleDown'
150
+ | 'layout'
151
+ | DataLink
152
+ /* Artboard name */
153
+ artboardName?: string | DataLink
154
+ /* Animation name */
155
+ animationName?: string | DataLink
156
+ /* State machine name */
157
+ stateMachineName?: string | DataLink
158
+ }
159
+ events?: BrickBasicEvents & {
160
+ /* Event of animation play */
161
+ onPlay?: Array<EventAction>
162
+ /* Event of animation pause */
163
+ onPause?: Array<EventAction>
164
+ /* Event of animation stop */
165
+ onStop?: Array<EventAction>
166
+ /* Event of animation loop end */
167
+ onLoopEnd?: Array<EventAction>
168
+ /* Event of state changed */
169
+ onStateChanged?: Array<EventAction>
170
+ /* Event of error */
171
+ onError?: Array<EventAction>
172
+ /* Event of Rive general event received */
173
+ onRiveGeneralEvent?: Array<EventAction>
174
+ /* Event of Rive open-url event received */
175
+ onRiveOpenUrlEvent?: Array<EventAction>
176
+ }
177
+ animation?: AnimationBasicEvents & {
178
+ onPlay?: Animation
179
+ onPause?: Animation
180
+ onStop?: Animation
181
+ onLoopEnd?: Animation
182
+ onStateChanged?: Animation
183
+ onError?: Animation
184
+ onRiveGeneralEvent?: Animation
185
+ onRiveOpenUrlEvent?: Animation
186
+ }
187
+ }
188
+
189
+ /* Rive file component */
190
+ export type BrickRive = Brick &
191
+ BrickRiveDef & {
192
+ templateKey: 'BRICK_RIVE'
193
+ switches: Array<
194
+ SwitchDef &
195
+ BrickRiveDef & {
196
+ conds?: Array<{
197
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
198
+ cond:
199
+ | SwitchCondInnerStateCurrentCanvas
200
+ | SwitchCondData
201
+ | {
202
+ __typename: 'SwitchCondInnerStateOutlet'
203
+ outlet: ''
204
+ value: any
205
+ }
206
+ }>
207
+ }
208
+ >
209
+ }
@@ -0,0 +1,155 @@
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
+ /* Jump to a specific index in the slideshow */
16
+ export type BrickSlideshowActionJumpToIndex = ActionWithParams & {
17
+ __actionName: 'BRICK_SLIDESHOW_JUMP_TO_INDEX'
18
+ params?: Array<
19
+ | {
20
+ input: 'index'
21
+ value?: number | DataLink | EventProperty
22
+ mapping?: string
23
+ }
24
+ | {
25
+ input: 'reset'
26
+ value?: boolean | DataLink | EventProperty
27
+ mapping?: string
28
+ }
29
+ | {
30
+ input: 'shuffle'
31
+ value?: boolean | DataLink | EventProperty
32
+ mapping?: string
33
+ }
34
+ >
35
+ }
36
+
37
+ interface BrickSlideshowDef {
38
+ /*
39
+ Default property:
40
+ {
41
+ "countdown": 2000,
42
+ "loop": true,
43
+ "shuffle": false,
44
+ "videoVolume": 100,
45
+ "emptyViewText": "no available image item to show",
46
+ "emptyViewTextSize": 44,
47
+ "emptyViewTextColor": "#fff",
48
+ "blurBackgroundRadius": 8
49
+ }
50
+ */
51
+ property?: BrickBasicProperty & {
52
+ /* The time interval of show for each photo */
53
+ countdown?: number | DataLink
54
+ /* The slideshow media path list (File, URL) */
55
+ paths?:
56
+ | Array<
57
+ | DataLink
58
+ | {
59
+ url?: string | DataLink
60
+ mediaType?: 'video' | 'video-streaming' | 'photo' | DataLink
61
+ photoResizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat' | DataLink
62
+ photoLoadSystemIos?: 'auto' | 'sdwebimage' | 'default' | DataLink
63
+ photoLoadSystemAndroid?: 'auto' | 'glide' | 'fresco' | DataLink
64
+ videoResizeMode?: 'contain' | 'cover' | 'stretch' | DataLink
65
+ videoAutoAspectRatio?: boolean | DataLink
66
+ videoAspectRatio?: string | DataLink
67
+ videoVolume?: number | DataLink
68
+ videoMuted?: boolean | DataLink
69
+ videoRenderMode?: 'auto' | 'texture' | 'surface' | DataLink
70
+ }
71
+ >
72
+ | DataLink
73
+ /* Multiple slideshow media path lists to combine (Array of path arrays) */
74
+ pathsList?: Array<Array<any> | DataLink | DataLink> | DataLink
75
+ /* Loop the slideshow */
76
+ loop?: boolean | DataLink
77
+ /* Shuffle the slideshow */
78
+ shuffle?: boolean | DataLink
79
+ /* Slideshow Photo resize mode */
80
+ photoResizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat' | DataLink
81
+ /* [iOS] The use priority of image loading system (Auto: sdwebimage, fallback to default if failed) */
82
+ photoLoadSystemIos?: 'auto' | 'sdwebimage' | 'default' | DataLink
83
+ /* [Android] The use priority of image loading system (Auto: glide, fallback to fresco if failed) */
84
+ photoLoadSystemAndroid?: 'auto' | 'glide' | 'fresco' | DataLink
85
+ /* Slideshow Video resize mode */
86
+ videoResizeMode?: 'contain' | 'cover' | 'stretch' | DataLink
87
+ /* Video Auto Aspect Ratio for use Video Streaming */
88
+ videoAutoAspectRatio?: boolean | DataLink
89
+ /* Video Aspect Ratio for use Video Streaming */
90
+ videoAspectRatio?: string | DataLink
91
+ /* Video Volume */
92
+ videoVolume?: number | DataLink
93
+ /* Video Muted */
94
+ videoMuted?: boolean | DataLink
95
+ /* [Android only] 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 */
96
+ videoRenderMode?: 'auto' | 'texture' | 'surface' | DataLink
97
+ /* The photo fade duration */
98
+ fadeDuration?: number | DataLink
99
+ /* Show text content if path list is empty */
100
+ emptyViewText?: string | DataLink
101
+ /* The font size of shown text content if path list is empty */
102
+ emptyViewTextSize?: number | DataLink
103
+ /* The color of shown text content if path list is empty */
104
+ emptyViewTextColor?: string | DataLink
105
+ /* Show emptyViewText when timeout and paths is empty */
106
+ emptyViewTimeout?: number | DataLink
107
+ /* The blur radius of the blur filter added to the image */
108
+ blurRadius?: number | DataLink
109
+ /* Add blurred image at background if photo is not full */
110
+ enableBlurBackground?: boolean | DataLink
111
+ /* The blur radius of the blur filter added to the image background */
112
+ blurBackgroundRadius?: number | DataLink
113
+ }
114
+ events?: BrickBasicEvents & {
115
+ /* Event of the next slideshow on change start */
116
+ changeStart?: Array<EventAction>
117
+ /* Event of the next slideshow on change end */
118
+ changeEnd?: Array<EventAction>
119
+ /* Event on paths change */
120
+ contentChange?: Array<EventAction>
121
+ /* Event on plays of paths are end */
122
+ roundEnd?: Array<EventAction>
123
+ /* Event of the slideshow on load */
124
+ mediaOnLoad?: Array<EventAction>
125
+ }
126
+ animation?: AnimationBasicEvents & {
127
+ changeStart?: Animation
128
+ changeEnd?: Animation
129
+ contentChange?: Animation
130
+ roundEnd?: Animation
131
+ mediaOnLoad?: Animation
132
+ }
133
+ }
134
+
135
+ /* Slideshow brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378580-slideshow)) */
136
+ export type BrickSlideshow = Brick &
137
+ BrickSlideshowDef & {
138
+ templateKey: 'BRICK_SLIDESHOW'
139
+ switches: Array<
140
+ SwitchDef &
141
+ BrickSlideshowDef & {
142
+ conds?: Array<{
143
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
144
+ cond:
145
+ | SwitchCondInnerStateCurrentCanvas
146
+ | SwitchCondData
147
+ | {
148
+ __typename: 'SwitchCondInnerStateOutlet'
149
+ outlet: ''
150
+ value: any
151
+ }
152
+ }>
153
+ }
154
+ >
155
+ }