@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,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
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
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 BrickSvgDef {
|
|
16
|
+
/*
|
|
17
|
+
Default property:
|
|
18
|
+
{
|
|
19
|
+
"source": "",
|
|
20
|
+
"uri": "",
|
|
21
|
+
"renderMode": "general"
|
|
22
|
+
}
|
|
23
|
+
*/
|
|
24
|
+
property?: BrickBasicProperty & {
|
|
25
|
+
/* The SVG XML content */
|
|
26
|
+
source?: string | DataLink
|
|
27
|
+
/* The svg source location (URL or LocalPath) */
|
|
28
|
+
uri?: string | DataLink
|
|
29
|
+
/* The checksum of file */
|
|
30
|
+
md5?: string | DataLink
|
|
31
|
+
/* The rules of replacing origin colour */
|
|
32
|
+
colorMapping?:
|
|
33
|
+
| Array<
|
|
34
|
+
| DataLink
|
|
35
|
+
| {
|
|
36
|
+
findItem?: string | DataLink
|
|
37
|
+
replaceItem?: string | DataLink
|
|
38
|
+
}
|
|
39
|
+
>
|
|
40
|
+
| DataLink
|
|
41
|
+
/* The render mode */
|
|
42
|
+
renderMode?: 'general' | 'legacy' | DataLink
|
|
43
|
+
}
|
|
44
|
+
events?: BrickBasicEvents & {
|
|
45
|
+
/* Event of the brick press */
|
|
46
|
+
onPress?: Array<EventAction>
|
|
47
|
+
/* Event of the brick press in */
|
|
48
|
+
onPressIn?: Array<EventAction>
|
|
49
|
+
/* Event of the brick press out */
|
|
50
|
+
onPressOut?: Array<EventAction>
|
|
51
|
+
/* Event of the brick long press */
|
|
52
|
+
onLongPress?: Array<EventAction>
|
|
53
|
+
/* Event of the brick focus (Use TV Device with controller) */
|
|
54
|
+
onFocus?: Array<EventAction>
|
|
55
|
+
/* Event of the brick blur (Use TV Device with controller) */
|
|
56
|
+
onBlur?: Array<EventAction>
|
|
57
|
+
}
|
|
58
|
+
outlets?: {
|
|
59
|
+
/* Brick is pressing */
|
|
60
|
+
brickPressing?: () => Data
|
|
61
|
+
/* Brick is focusing (Use TV Device with controller) */
|
|
62
|
+
brickFocusing?: () => Data
|
|
63
|
+
}
|
|
64
|
+
animation?: AnimationBasicEvents & {
|
|
65
|
+
onPress?: Animation
|
|
66
|
+
onPressIn?: Animation
|
|
67
|
+
onPressOut?: Animation
|
|
68
|
+
onLongPress?: Animation
|
|
69
|
+
onFocus?: Animation
|
|
70
|
+
onBlur?: Animation
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* SVG is an XML-based vector image format for 2D graphics */
|
|
75
|
+
export type BrickSvg = Brick &
|
|
76
|
+
BrickSvgDef & {
|
|
77
|
+
templateKey: 'BRICK_SVG'
|
|
78
|
+
switches: Array<
|
|
79
|
+
SwitchDef &
|
|
80
|
+
BrickSvgDef & {
|
|
81
|
+
conds?: Array<{
|
|
82
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
83
|
+
cond:
|
|
84
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
85
|
+
| SwitchCondData
|
|
86
|
+
| {
|
|
87
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
88
|
+
outlet: 'brickPressing' | 'brickFocusing'
|
|
89
|
+
value: any
|
|
90
|
+
}
|
|
91
|
+
}>
|
|
92
|
+
}
|
|
93
|
+
>
|
|
94
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
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 BrickTextDef {
|
|
16
|
+
/*
|
|
17
|
+
Default property:
|
|
18
|
+
{
|
|
19
|
+
"text": "",
|
|
20
|
+
"templateType": "${}",
|
|
21
|
+
"color": "#000",
|
|
22
|
+
"fontWeight": "normal",
|
|
23
|
+
"fontStyle": "normal",
|
|
24
|
+
"fontPadding": true,
|
|
25
|
+
"fontSizeVector": 0.5,
|
|
26
|
+
"lineNumber": 1,
|
|
27
|
+
"textAlign": "center",
|
|
28
|
+
"textAlignVertical": "center"
|
|
29
|
+
}
|
|
30
|
+
*/
|
|
31
|
+
property?: BrickBasicProperty & {
|
|
32
|
+
/* The text content */
|
|
33
|
+
text?: string | DataLink | number | DataLink | boolean | DataLink | string | DataLink | DataLink
|
|
34
|
+
/* Data to be used in the text template (e.g. `Hello ${name}`). Supports nested data, such as `Hello ${user.name}`. */
|
|
35
|
+
templateData?: {} | DataLink
|
|
36
|
+
/* The text template type */
|
|
37
|
+
templateType?: '${}' | '{{}}' | DataLink
|
|
38
|
+
/* The text replacement (Regular Expression), can be multiple. */
|
|
39
|
+
replace?:
|
|
40
|
+
| Array<
|
|
41
|
+
| DataLink
|
|
42
|
+
| {
|
|
43
|
+
regex?: string | DataLink
|
|
44
|
+
replaceWith?: string | DataLink
|
|
45
|
+
}
|
|
46
|
+
>
|
|
47
|
+
| DataLink
|
|
48
|
+
/* The text color */
|
|
49
|
+
color?: string | DataLink
|
|
50
|
+
/* 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. */
|
|
51
|
+
fontWeight?:
|
|
52
|
+
| 'normal'
|
|
53
|
+
| 'bold'
|
|
54
|
+
| '100'
|
|
55
|
+
| '200'
|
|
56
|
+
| '300'
|
|
57
|
+
| '400'
|
|
58
|
+
| '500'
|
|
59
|
+
| '600'
|
|
60
|
+
| '700'
|
|
61
|
+
| '800'
|
|
62
|
+
| '900'
|
|
63
|
+
| DataLink
|
|
64
|
+
/* The text font style */
|
|
65
|
+
fontStyle?: 'normal' | 'italic' | DataLink
|
|
66
|
+
/* The text font family */
|
|
67
|
+
fontFamily?: string | DataLink
|
|
68
|
+
/* [Android only] Set to No to remove extra font padding intended to make space for certain ascenders / descenders. */
|
|
69
|
+
fontPadding?: boolean | DataLink
|
|
70
|
+
/* The text font size (grid) */
|
|
71
|
+
fontSize?: number | DataLink
|
|
72
|
+
/* The text font size vector. If the font size is not specified, the font size will be calculated by the height of the text box. */
|
|
73
|
+
fontSizeVector?: number | DataLink
|
|
74
|
+
/* The text letter spacing (grid) */
|
|
75
|
+
letterSpacing?: number | DataLink
|
|
76
|
+
/* The line height of text content (grid) */
|
|
77
|
+
lineHeight?: number | DataLink
|
|
78
|
+
/* The line number limit of text content */
|
|
79
|
+
lineNumber?: number | DataLink
|
|
80
|
+
/* The text align */
|
|
81
|
+
textAlign?: 'auto' | 'left' | 'right' | 'center' | 'justify' | DataLink
|
|
82
|
+
/* The text align vertical */
|
|
83
|
+
textAlignVertical?: 'auto' | 'top' | 'bottom' | 'center' | DataLink
|
|
84
|
+
/* Enable vertical rendering */
|
|
85
|
+
verticalRendering?: boolean | DataLink
|
|
86
|
+
}
|
|
87
|
+
events?: BrickBasicEvents & {
|
|
88
|
+
/* Event of the brick press */
|
|
89
|
+
onPress?: Array<EventAction>
|
|
90
|
+
/* Event of the brick press in */
|
|
91
|
+
onPressIn?: Array<EventAction>
|
|
92
|
+
/* Event of the brick press out */
|
|
93
|
+
onPressOut?: Array<EventAction>
|
|
94
|
+
/* Event of the brick long press */
|
|
95
|
+
onLongPress?: Array<EventAction>
|
|
96
|
+
/* Event of the brick focus (Use TV Device with controller) */
|
|
97
|
+
onFocus?: Array<EventAction>
|
|
98
|
+
/* Event of the brick blur (Use TV Device with controller) */
|
|
99
|
+
onBlur?: Array<EventAction>
|
|
100
|
+
/* Event of the text content on change start */
|
|
101
|
+
beforeValueChange?: Array<EventAction>
|
|
102
|
+
/* Event of the text content on change end */
|
|
103
|
+
valueChange?: Array<EventAction>
|
|
104
|
+
}
|
|
105
|
+
outlets?: {
|
|
106
|
+
/* Brick is pressing */
|
|
107
|
+
brickPressing?: () => Data
|
|
108
|
+
/* Brick is focusing (Use TV Device with controller) */
|
|
109
|
+
brickFocusing?: () => Data
|
|
110
|
+
}
|
|
111
|
+
animation?: AnimationBasicEvents & {
|
|
112
|
+
onPress?: Animation
|
|
113
|
+
onPressIn?: Animation
|
|
114
|
+
onPressOut?: Animation
|
|
115
|
+
onLongPress?: Animation
|
|
116
|
+
onFocus?: Animation
|
|
117
|
+
onBlur?: Animation
|
|
118
|
+
beforeValueChange?: Animation
|
|
119
|
+
valueChange?: Animation
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Text brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378574-text)) */
|
|
124
|
+
export type BrickText = Brick &
|
|
125
|
+
BrickTextDef & {
|
|
126
|
+
templateKey: 'BRICK_TEXT'
|
|
127
|
+
switches: Array<
|
|
128
|
+
SwitchDef &
|
|
129
|
+
BrickTextDef & {
|
|
130
|
+
conds?: Array<{
|
|
131
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
132
|
+
cond:
|
|
133
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
134
|
+
| SwitchCondData
|
|
135
|
+
| {
|
|
136
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
137
|
+
outlet: 'brickPressing' | 'brickFocusing'
|
|
138
|
+
value: any
|
|
139
|
+
}
|
|
140
|
+
}>
|
|
141
|
+
}
|
|
142
|
+
>
|
|
143
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
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
|
+
/* Focus TextInput */
|
|
16
|
+
export type BrickTextInputActionFocus = Action & {
|
|
17
|
+
__actionName: 'BRICK_TEXT_INPUT_FOCUS'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Blur TextInput */
|
|
21
|
+
export type BrickTextInputActionBlur = Action & {
|
|
22
|
+
__actionName: 'BRICK_TEXT_INPUT_BLUR'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Clear TextInput */
|
|
26
|
+
export type BrickTextInputActionClear = Action & {
|
|
27
|
+
__actionName: 'BRICK_TEXT_INPUT_CLEAR'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Reset TextInput to default value */
|
|
31
|
+
export type BrickTextInputActionResetToDefault = Action & {
|
|
32
|
+
__actionName: 'BRICK_TEXT_INPUT_RESET_TO_DEFAULT'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Focus the input and select text with regex or start/end */
|
|
36
|
+
export type BrickTextInputActionSelectText = ActionWithParams & {
|
|
37
|
+
__actionName: 'BRICK_TEXT_INPUT_SELECT_TEXT'
|
|
38
|
+
params?: Array<
|
|
39
|
+
| {
|
|
40
|
+
input: 'regex'
|
|
41
|
+
value?: string | DataLink | EventProperty
|
|
42
|
+
mapping?: string
|
|
43
|
+
}
|
|
44
|
+
| {
|
|
45
|
+
input: 'start'
|
|
46
|
+
value?: number | DataLink | EventProperty
|
|
47
|
+
mapping?: string
|
|
48
|
+
}
|
|
49
|
+
| {
|
|
50
|
+
input: 'end'
|
|
51
|
+
value?: number | DataLink | EventProperty
|
|
52
|
+
mapping?: string
|
|
53
|
+
}
|
|
54
|
+
>
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Set text value of the TextInput */
|
|
58
|
+
export type BrickTextInputActionSetText = ActionWithParams & {
|
|
59
|
+
__actionName: 'BRICK_TEXT_INPUT_SET_TEXT'
|
|
60
|
+
params?: Array<{
|
|
61
|
+
input: 'text'
|
|
62
|
+
value?: string | DataLink | EventProperty
|
|
63
|
+
mapping?: string
|
|
64
|
+
}>
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Append text value of the TextInput */
|
|
68
|
+
export type BrickTextInputActionAppendText = ActionWithParams & {
|
|
69
|
+
__actionName: 'BRICK_TEXT_INPUT_APPEND_TEXT'
|
|
70
|
+
params?: Array<{
|
|
71
|
+
input: 'text'
|
|
72
|
+
value?: string | DataLink | EventProperty
|
|
73
|
+
mapping?: string
|
|
74
|
+
}>
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Trigger regex */
|
|
78
|
+
export type BrickTextInputActionTrySubmit = Action & {
|
|
79
|
+
__actionName: 'BRICK_TEXT_INPUT_TRY_SUBMIT'
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface BrickTextInputDef {
|
|
83
|
+
/*
|
|
84
|
+
Default property:
|
|
85
|
+
{
|
|
86
|
+
"editable": true,
|
|
87
|
+
"defaultValue": "",
|
|
88
|
+
"color": "#000",
|
|
89
|
+
"fontWeight": "normal",
|
|
90
|
+
"fontStyle": "normal",
|
|
91
|
+
"fontSizeVector": 0.5,
|
|
92
|
+
"lineNumber": 1,
|
|
93
|
+
"textAlign": "center",
|
|
94
|
+
"textAlignVertical": "center",
|
|
95
|
+
"keyboardType": "default",
|
|
96
|
+
"returnKeyType": "done"
|
|
97
|
+
}
|
|
98
|
+
*/
|
|
99
|
+
property?: BrickBasicProperty & {
|
|
100
|
+
/* Allow to edit */
|
|
101
|
+
editable?: boolean | DataLink
|
|
102
|
+
/* The default value of the text input */
|
|
103
|
+
defaultValue?: string | DataLink
|
|
104
|
+
/* The text color */
|
|
105
|
+
color?: string | DataLink
|
|
106
|
+
/* 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. */
|
|
107
|
+
fontWeight?:
|
|
108
|
+
| 'normal'
|
|
109
|
+
| 'bold'
|
|
110
|
+
| '100'
|
|
111
|
+
| '200'
|
|
112
|
+
| '300'
|
|
113
|
+
| '400'
|
|
114
|
+
| '500'
|
|
115
|
+
| '600'
|
|
116
|
+
| '700'
|
|
117
|
+
| '800'
|
|
118
|
+
| '900'
|
|
119
|
+
| DataLink
|
|
120
|
+
/* The text font style */
|
|
121
|
+
fontStyle?: 'normal' | 'italic' | DataLink
|
|
122
|
+
/* The text font family */
|
|
123
|
+
fontFamily?: string | DataLink
|
|
124
|
+
/* The text font size (grid) */
|
|
125
|
+
fontSize?: number | DataLink
|
|
126
|
+
/* The text font size vector. If the font size is not specified, the font size will be calculated by the height of the text box. */
|
|
127
|
+
fontSizeVector?: number | DataLink
|
|
128
|
+
/* The text letter spacing (grid) */
|
|
129
|
+
letterSpacing?: number | DataLink
|
|
130
|
+
/* The line height of text content (grid) */
|
|
131
|
+
lineHeight?: number | DataLink
|
|
132
|
+
/* The line number limit of text content (Use 0 to unlimited) */
|
|
133
|
+
lineNumber?: number | DataLink
|
|
134
|
+
/* The text align */
|
|
135
|
+
textAlign?: 'auto' | 'left' | 'right' | 'center' | 'justify' | DataLink
|
|
136
|
+
/* The text align vertical */
|
|
137
|
+
textAlignVertical?: 'auto' | 'top' | 'bottom' | 'center' | DataLink
|
|
138
|
+
/* The placeholder text */
|
|
139
|
+
placeholder?: string | DataLink
|
|
140
|
+
/* Color of the placeholder text */
|
|
141
|
+
placeholderTextColor?: string | DataLink
|
|
142
|
+
/* Limits the maximum number of characters that can be entered */
|
|
143
|
+
maxLength?: number | DataLink
|
|
144
|
+
/* The virtual keyboard type */
|
|
145
|
+
keyboardType?:
|
|
146
|
+
| 'default'
|
|
147
|
+
| 'number-pad'
|
|
148
|
+
| 'decimal-pad'
|
|
149
|
+
| 'numeric'
|
|
150
|
+
| 'email-address'
|
|
151
|
+
| 'phone-pad'
|
|
152
|
+
| DataLink
|
|
153
|
+
/* The virtual keyboard return key type The line number should be 1. */
|
|
154
|
+
returnKeyType?: 'done' | 'go' | 'next' | 'search' | 'send' | DataLink
|
|
155
|
+
/* Trigger event on input change after debounce time */
|
|
156
|
+
debounce?: number | DataLink
|
|
157
|
+
/* Regular Expression to match */
|
|
158
|
+
regex?: string | DataLink
|
|
159
|
+
/* The regex matching complete mode */
|
|
160
|
+
completeMode?: 'allMatch' | 'oneMatch' | DataLink
|
|
161
|
+
/* Auto submit when regex match */
|
|
162
|
+
autoSubmitWhenMatch?: boolean | DataLink
|
|
163
|
+
/* Blur TextInput on submit */
|
|
164
|
+
blurOnSubmit?: boolean | DataLink
|
|
165
|
+
}
|
|
166
|
+
events?: BrickBasicEvents & {
|
|
167
|
+
/* Event of the TextInput is focused */
|
|
168
|
+
onFocus?: Array<EventAction>
|
|
169
|
+
/* Event of the input field is blurred */
|
|
170
|
+
onBlur?: Array<EventAction>
|
|
171
|
+
/* Event of the TextInput is empty */
|
|
172
|
+
onEmpty?: Array<EventAction>
|
|
173
|
+
/* Event of the TextInput value change */
|
|
174
|
+
onChange?: Array<EventAction>
|
|
175
|
+
/* Event of the TextInput submit */
|
|
176
|
+
onSubmit?: Array<EventAction>
|
|
177
|
+
/* Event of the TextInput match regex (check every value change) */
|
|
178
|
+
onMatch?: Array<EventAction>
|
|
179
|
+
/* Event of the TextInput not match regex (check every value change) */
|
|
180
|
+
onNotMatch?: Array<EventAction>
|
|
181
|
+
/* Event of the TextInput not match regex (check every submit) */
|
|
182
|
+
onResultNotMatch?: Array<EventAction>
|
|
183
|
+
/* Event of the TextInput reach max length or match regex */
|
|
184
|
+
onFullFill?: Array<EventAction>
|
|
185
|
+
}
|
|
186
|
+
outlets?: {
|
|
187
|
+
/* The raw input */
|
|
188
|
+
rawInput?: () => Data
|
|
189
|
+
/* The regex result */
|
|
190
|
+
resultVariable?: () => Data
|
|
191
|
+
/* Last key in */
|
|
192
|
+
lastKey?: () => Data
|
|
193
|
+
/* Selection of the TextInput (start, end, text) */
|
|
194
|
+
selection?: () => Data
|
|
195
|
+
/* Selection text of the TextInput */
|
|
196
|
+
selectionText?: () => Data
|
|
197
|
+
}
|
|
198
|
+
animation?: AnimationBasicEvents & {
|
|
199
|
+
onFocus?: Animation
|
|
200
|
+
onBlur?: Animation
|
|
201
|
+
onEmpty?: Animation
|
|
202
|
+
onChange?: Animation
|
|
203
|
+
onSubmit?: Animation
|
|
204
|
+
onMatch?: Animation
|
|
205
|
+
onNotMatch?: Animation
|
|
206
|
+
onResultNotMatch?: Animation
|
|
207
|
+
onFullFill?: Animation
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* Text Input brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378575-text-input)) */
|
|
212
|
+
export type BrickTextInput = Brick &
|
|
213
|
+
BrickTextInputDef & {
|
|
214
|
+
templateKey: 'BRICK_TEXT_INPUT'
|
|
215
|
+
switches: Array<
|
|
216
|
+
SwitchDef &
|
|
217
|
+
BrickTextInputDef & {
|
|
218
|
+
conds?: Array<{
|
|
219
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
220
|
+
cond:
|
|
221
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
222
|
+
| SwitchCondData
|
|
223
|
+
| {
|
|
224
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
225
|
+
outlet: 'rawInput' | 'resultVariable' | 'lastKey' | 'selection' | 'selectionText'
|
|
226
|
+
value: any
|
|
227
|
+
}
|
|
228
|
+
}>
|
|
229
|
+
}
|
|
230
|
+
>
|
|
231
|
+
}
|