@fugood/bricks-project 2.22.0-beta.27 → 2.22.0-beta.28
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/package.json +2 -2
- package/types/animation.ts +1 -0
- package/types/brick-base.ts +77 -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 +237 -0
- package/types/bricks/Icon.ts +90 -0
- package/types/bricks/Image.ts +101 -0
- package/types/bricks/Items.ts +461 -0
- package/types/bricks/Lottie.ts +156 -0
- package/types/bricks/Qrcode.ts +109 -0
- package/types/bricks/Rect.ts +107 -0
- package/types/bricks/RichText.ts +120 -0
- package/types/bricks/Rive.ts +209 -0
- package/types/bricks/Slideshow.ts +155 -0
- package/types/bricks/Svg.ts +91 -0
- package/types/bricks/Text.ts +140 -0
- package/types/bricks/TextInput.ts +231 -0
- package/types/bricks/Video.ts +167 -0
- package/types/bricks/VideoStreaming.ts +104 -0
- package/types/bricks/WebRTCStream.ts +60 -0
- package/types/bricks/WebView.ts +157 -0
- package/types/bricks/index.ts +20 -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 +156 -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 +245 -0
- package/types/generators/MQTTBroker.ts +121 -0
- package/types/generators/MediaFlow.ts +142 -0
- package/types/generators/MqttClient.ts +129 -0
- package/types/generators/Question.ts +395 -0
- package/types/generators/RealtimeTranscription.ts +172 -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/TapToPayOnIPhone.ts +175 -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/bricks.ts +0 -3269
- package/types/generators.ts +0 -8632
|
@@ -0,0 +1,156 @@
|
|
|
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 focus (Use TV Device with controller) */
|
|
108
|
+
onFocus?: Array<EventAction>
|
|
109
|
+
/* Event of the brick blur (Use TV Device with controller) */
|
|
110
|
+
onBlur?: Array<EventAction>
|
|
111
|
+
/* Event of the animation finished */
|
|
112
|
+
onAnimationFinish?: Array<EventAction>
|
|
113
|
+
/* Event of the uri on load failed */
|
|
114
|
+
onAnimationFailure?: Array<EventAction>
|
|
115
|
+
/* Event of the animation on loop */
|
|
116
|
+
onAnimationLoop?: Array<EventAction>
|
|
117
|
+
}
|
|
118
|
+
outlets?: {
|
|
119
|
+
/* Brick is pressing */
|
|
120
|
+
brickPressing?: () => Data
|
|
121
|
+
/* Brick is focusing (Use TV Device with controller) */
|
|
122
|
+
brickFocusing?: () => Data
|
|
123
|
+
}
|
|
124
|
+
animation?: AnimationBasicEvents & {
|
|
125
|
+
onPress?: Animation
|
|
126
|
+
onPressIn?: Animation
|
|
127
|
+
onPressOut?: Animation
|
|
128
|
+
onFocus?: Animation
|
|
129
|
+
onBlur?: Animation
|
|
130
|
+
onAnimationFinish?: Animation
|
|
131
|
+
onAnimationFailure?: Animation
|
|
132
|
+
onAnimationLoop?: Animation
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Lottie Adobe After Effects animations brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378583-lottie)) */
|
|
137
|
+
export type BrickLottie = Brick &
|
|
138
|
+
BrickLottieDef & {
|
|
139
|
+
templateKey: 'BRICK_LOTTIE'
|
|
140
|
+
switches: Array<
|
|
141
|
+
SwitchDef &
|
|
142
|
+
BrickLottieDef & {
|
|
143
|
+
conds?: Array<{
|
|
144
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
145
|
+
cond:
|
|
146
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
147
|
+
| SwitchCondData
|
|
148
|
+
| {
|
|
149
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
150
|
+
outlet: 'brickPressing' | 'brickFocusing'
|
|
151
|
+
value: any
|
|
152
|
+
}
|
|
153
|
+
}>
|
|
154
|
+
}
|
|
155
|
+
>
|
|
156
|
+
}
|
|
@@ -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
|
+
}
|