@fugood/bricks-project 2.25.0-beta.19 → 2.25.0-beta.20
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 +56 -0
- package/compile/index.ts +6 -2
- package/package.json +2 -2
- package/package.json.bak +2 -2
- package/types/animation.ts +8 -3
- package/types/brick-base.ts +1 -1
- package/types/bricks/Camera.ts +8 -8
- package/types/bricks/Chart.ts +4 -4
- package/types/bricks/GenerativeMedia.ts +15 -15
- package/types/bricks/Icon.ts +7 -7
- package/types/bricks/Image.ts +9 -9
- package/types/bricks/Items.ts +7 -7
- package/types/bricks/Lottie.ts +10 -10
- package/types/bricks/Maps.ts +11 -11
- package/types/bricks/QrCode.ts +7 -7
- package/types/bricks/Rect.ts +7 -7
- package/types/bricks/RichText.ts +7 -7
- package/types/bricks/Rive.ts +9 -9
- package/types/bricks/Scene3D.ts +596 -0
- package/types/bricks/Sketch.ts +6 -6
- package/types/bricks/Slideshow.ts +7 -7
- package/types/bricks/Svg.ts +7 -7
- package/types/bricks/Text.ts +9 -9
- package/types/bricks/TextInput.ts +10 -10
- package/types/bricks/Video.ts +12 -12
- package/types/bricks/VideoStreaming.ts +10 -10
- package/types/bricks/WebRtcStream.ts +1 -1
- package/types/bricks/WebView.ts +4 -4
- package/types/bricks/index.ts +1 -0
- package/types/data.ts +2 -0
- package/utils/event-props.ts +17 -0
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
/* Auto generated by build script
|
|
2
|
+
*
|
|
3
|
+
* 3D scene renderer powered by WebGPU/WebGL with declarative objects, lights, camera, controls, and a script hook (tvOS support is experimental)
|
|
4
|
+
*/
|
|
5
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
6
|
+
import type { Data, DataLink } from '../data'
|
|
7
|
+
import type { Animation, AnimationBasicEvents, AnimationOrGetter } from '../animation'
|
|
8
|
+
import type {
|
|
9
|
+
Brick,
|
|
10
|
+
EventAction,
|
|
11
|
+
EventActionForItem,
|
|
12
|
+
ActionWithDataParams,
|
|
13
|
+
ActionWithParams,
|
|
14
|
+
Action,
|
|
15
|
+
EventProperty,
|
|
16
|
+
} from '../common'
|
|
17
|
+
import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
|
|
18
|
+
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
19
|
+
|
|
20
|
+
/* Add an object to the scene */
|
|
21
|
+
export type BrickScene3DActionAddObject = ActionWithParams & {
|
|
22
|
+
__actionName: 'BRICK_SCENE_3D_ADD_OBJECT'
|
|
23
|
+
params?: Array<
|
|
24
|
+
| {
|
|
25
|
+
input: 'objectId'
|
|
26
|
+
value?: string | DataLink | EventProperty
|
|
27
|
+
mapping?: string
|
|
28
|
+
}
|
|
29
|
+
| {
|
|
30
|
+
input: 'objectType'
|
|
31
|
+
value?:
|
|
32
|
+
| 'gltf'
|
|
33
|
+
| 'usd'
|
|
34
|
+
| 'usdz'
|
|
35
|
+
| 'box'
|
|
36
|
+
| 'sphere'
|
|
37
|
+
| 'plane'
|
|
38
|
+
| 'cylinder'
|
|
39
|
+
| 'cone'
|
|
40
|
+
| 'torus'
|
|
41
|
+
| 'text'
|
|
42
|
+
| DataLink
|
|
43
|
+
| EventProperty
|
|
44
|
+
mapping?: string
|
|
45
|
+
}
|
|
46
|
+
| {
|
|
47
|
+
input: 'objectUrl'
|
|
48
|
+
value?: string | DataLink | EventProperty
|
|
49
|
+
mapping?: string
|
|
50
|
+
}
|
|
51
|
+
| {
|
|
52
|
+
input: 'objectMd5'
|
|
53
|
+
value?: string | DataLink | EventProperty
|
|
54
|
+
mapping?: string
|
|
55
|
+
}
|
|
56
|
+
| {
|
|
57
|
+
input: 'objectPosition'
|
|
58
|
+
value?: any | EventProperty
|
|
59
|
+
mapping?: string
|
|
60
|
+
}
|
|
61
|
+
| {
|
|
62
|
+
input: 'objectRotation'
|
|
63
|
+
value?: any | EventProperty
|
|
64
|
+
mapping?: string
|
|
65
|
+
}
|
|
66
|
+
| {
|
|
67
|
+
input: 'objectScale'
|
|
68
|
+
value?: any | EventProperty
|
|
69
|
+
mapping?: string
|
|
70
|
+
}
|
|
71
|
+
| {
|
|
72
|
+
input: 'objectColor'
|
|
73
|
+
value?: string | DataLink | EventProperty
|
|
74
|
+
mapping?: string
|
|
75
|
+
}
|
|
76
|
+
>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Remove an object by id */
|
|
80
|
+
export type BrickScene3DActionRemoveObject = ActionWithParams & {
|
|
81
|
+
__actionName: 'BRICK_SCENE_3D_REMOVE_OBJECT'
|
|
82
|
+
params?: Array<{
|
|
83
|
+
input: 'objectId'
|
|
84
|
+
value?: string | DataLink | EventProperty
|
|
85
|
+
mapping?: string
|
|
86
|
+
}>
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Update an object's transform / appearance */
|
|
90
|
+
export type BrickScene3DActionUpdateObject = ActionWithParams & {
|
|
91
|
+
__actionName: 'BRICK_SCENE_3D_UPDATE_OBJECT'
|
|
92
|
+
params?: Array<
|
|
93
|
+
| {
|
|
94
|
+
input: 'objectId'
|
|
95
|
+
value?: string | DataLink | EventProperty
|
|
96
|
+
mapping?: string
|
|
97
|
+
}
|
|
98
|
+
| {
|
|
99
|
+
input: 'objectPosition'
|
|
100
|
+
value?: any | EventProperty
|
|
101
|
+
mapping?: string
|
|
102
|
+
}
|
|
103
|
+
| {
|
|
104
|
+
input: 'objectRotation'
|
|
105
|
+
value?: any | EventProperty
|
|
106
|
+
mapping?: string
|
|
107
|
+
}
|
|
108
|
+
| {
|
|
109
|
+
input: 'objectScale'
|
|
110
|
+
value?: any | EventProperty
|
|
111
|
+
mapping?: string
|
|
112
|
+
}
|
|
113
|
+
| {
|
|
114
|
+
input: 'objectVisible'
|
|
115
|
+
value?: boolean | DataLink | EventProperty
|
|
116
|
+
mapping?: string
|
|
117
|
+
}
|
|
118
|
+
| {
|
|
119
|
+
input: 'objectColor'
|
|
120
|
+
value?: string | DataLink | EventProperty
|
|
121
|
+
mapping?: string
|
|
122
|
+
}
|
|
123
|
+
>
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Move the camera (optionally animated) */
|
|
127
|
+
export type BrickScene3DActionSetCamera = ActionWithParams & {
|
|
128
|
+
__actionName: 'BRICK_SCENE_3D_SET_CAMERA'
|
|
129
|
+
params?: Array<
|
|
130
|
+
| {
|
|
131
|
+
input: 'cameraPosition'
|
|
132
|
+
value?: any | EventProperty
|
|
133
|
+
mapping?: string
|
|
134
|
+
}
|
|
135
|
+
| {
|
|
136
|
+
input: 'cameraTarget'
|
|
137
|
+
value?: any | EventProperty
|
|
138
|
+
mapping?: string
|
|
139
|
+
}
|
|
140
|
+
| {
|
|
141
|
+
input: 'cameraFov'
|
|
142
|
+
value?: number | DataLink | EventProperty
|
|
143
|
+
mapping?: string
|
|
144
|
+
}
|
|
145
|
+
| {
|
|
146
|
+
input: 'cameraAnimateMs'
|
|
147
|
+
value?: number | DataLink | EventProperty
|
|
148
|
+
mapping?: string
|
|
149
|
+
}
|
|
150
|
+
>
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* Aim the camera at an object */
|
|
154
|
+
export type BrickScene3DActionLookAt = ActionWithParams & {
|
|
155
|
+
__actionName: 'BRICK_SCENE_3D_LOOK_AT'
|
|
156
|
+
params?: Array<{
|
|
157
|
+
input: 'objectId'
|
|
158
|
+
value?: string | DataLink | EventProperty
|
|
159
|
+
mapping?: string
|
|
160
|
+
}>
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Play an animation clip on a gltf object */
|
|
164
|
+
export type BrickScene3DActionPlayAnimation = ActionWithParams & {
|
|
165
|
+
__actionName: 'BRICK_SCENE_3D_PLAY_ANIMATION'
|
|
166
|
+
params?: Array<
|
|
167
|
+
| {
|
|
168
|
+
input: 'objectId'
|
|
169
|
+
value?: string | DataLink | EventProperty
|
|
170
|
+
mapping?: string
|
|
171
|
+
}
|
|
172
|
+
| {
|
|
173
|
+
input: 'animationName'
|
|
174
|
+
value?: string | DataLink | EventProperty
|
|
175
|
+
mapping?: string
|
|
176
|
+
}
|
|
177
|
+
| {
|
|
178
|
+
input: 'animationLoop'
|
|
179
|
+
value?: boolean | DataLink | EventProperty
|
|
180
|
+
mapping?: string
|
|
181
|
+
}
|
|
182
|
+
| {
|
|
183
|
+
input: 'animationSpeed'
|
|
184
|
+
value?: number | DataLink | EventProperty
|
|
185
|
+
mapping?: string
|
|
186
|
+
}
|
|
187
|
+
>
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* Stop an animation clip */
|
|
191
|
+
export type BrickScene3DActionStopAnimation = ActionWithParams & {
|
|
192
|
+
__actionName: 'BRICK_SCENE_3D_STOP_ANIMATION'
|
|
193
|
+
params?: Array<
|
|
194
|
+
| {
|
|
195
|
+
input: 'objectId'
|
|
196
|
+
value?: string | DataLink | EventProperty
|
|
197
|
+
mapping?: string
|
|
198
|
+
}
|
|
199
|
+
| {
|
|
200
|
+
input: 'animationName'
|
|
201
|
+
value?: string | DataLink | EventProperty
|
|
202
|
+
mapping?: string
|
|
203
|
+
}
|
|
204
|
+
>
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* Replace the background (color or HDR image) */
|
|
208
|
+
export type BrickScene3DActionSetBackground = ActionWithParams & {
|
|
209
|
+
__actionName: 'BRICK_SCENE_3D_SET_BACKGROUND'
|
|
210
|
+
params?: Array<
|
|
211
|
+
| {
|
|
212
|
+
input: 'backgroundColor'
|
|
213
|
+
value?: string | DataLink | EventProperty
|
|
214
|
+
mapping?: string
|
|
215
|
+
}
|
|
216
|
+
| {
|
|
217
|
+
input: 'backgroundHdrUrl'
|
|
218
|
+
value?: string | DataLink | EventProperty
|
|
219
|
+
mapping?: string
|
|
220
|
+
}
|
|
221
|
+
| {
|
|
222
|
+
input: 'backgroundMd5'
|
|
223
|
+
value?: string | DataLink | EventProperty
|
|
224
|
+
mapping?: string
|
|
225
|
+
}
|
|
226
|
+
>
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* Toggle interaction controls at runtime */
|
|
230
|
+
export type BrickScene3DActionSetControls = ActionWithParams & {
|
|
231
|
+
__actionName: 'BRICK_SCENE_3D_SET_CONTROLS'
|
|
232
|
+
params?: Array<
|
|
233
|
+
| {
|
|
234
|
+
input: 'controlsEnabled'
|
|
235
|
+
value?: boolean | DataLink | EventProperty
|
|
236
|
+
mapping?: string
|
|
237
|
+
}
|
|
238
|
+
| {
|
|
239
|
+
input: 'controlsAutoRotate'
|
|
240
|
+
value?: boolean | DataLink | EventProperty
|
|
241
|
+
mapping?: string
|
|
242
|
+
}
|
|
243
|
+
| {
|
|
244
|
+
input: 'controlsAutoRotateSpeed'
|
|
245
|
+
value?: number | DataLink | EventProperty
|
|
246
|
+
mapping?: string
|
|
247
|
+
}
|
|
248
|
+
>
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/* Capture a screenshot (file URI emitted to BRICK_SCENE_3D_LAST_SCREENSHOT_URI) */
|
|
252
|
+
export type BrickScene3DActionScreenshot = ActionWithParams & {
|
|
253
|
+
__actionName: 'BRICK_SCENE_3D_SCREENSHOT'
|
|
254
|
+
params?: Array<
|
|
255
|
+
| {
|
|
256
|
+
input: 'screenshotFormat'
|
|
257
|
+
value?: 'png' | 'jpeg' | DataLink | EventProperty
|
|
258
|
+
mapping?: string
|
|
259
|
+
}
|
|
260
|
+
| {
|
|
261
|
+
input: 'screenshotQuality'
|
|
262
|
+
value?: number | DataLink | EventProperty
|
|
263
|
+
mapping?: string
|
|
264
|
+
}
|
|
265
|
+
>
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/* Reset the scene back to the declared `objects` / `lights` / `camera` props */
|
|
269
|
+
export type BrickScene3DActionReset = Action & {
|
|
270
|
+
__actionName: 'BRICK_SCENE_3D_RESET'
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
interface BrickScene3DDef {
|
|
274
|
+
/*
|
|
275
|
+
Default property:
|
|
276
|
+
{
|
|
277
|
+
"backend": "auto",
|
|
278
|
+
"antialias": true,
|
|
279
|
+
"alpha": false,
|
|
280
|
+
"shadows": false,
|
|
281
|
+
"toneMapping": "aces",
|
|
282
|
+
"colorSpace": "srgb",
|
|
283
|
+
"powerPreference": "default",
|
|
284
|
+
"frameLoop": "always",
|
|
285
|
+
"cameraType": "perspective",
|
|
286
|
+
"cameraPosition": {
|
|
287
|
+
"x": 3,
|
|
288
|
+
"y": 3,
|
|
289
|
+
"z": 5
|
|
290
|
+
},
|
|
291
|
+
"cameraTarget": {
|
|
292
|
+
"x": 0,
|
|
293
|
+
"y": 0,
|
|
294
|
+
"z": 0
|
|
295
|
+
},
|
|
296
|
+
"fov": 50,
|
|
297
|
+
"near": 0.1,
|
|
298
|
+
"far": 1000,
|
|
299
|
+
"zoom": 1,
|
|
300
|
+
"controls": "none",
|
|
301
|
+
"autoRotate": false,
|
|
302
|
+
"autoRotateSpeed": 2,
|
|
303
|
+
"enableDamping": true,
|
|
304
|
+
"minDistance": 0.5,
|
|
305
|
+
"maxDistance": 50,
|
|
306
|
+
"minPolarAngle": 0,
|
|
307
|
+
"envMapProjection": "equirect",
|
|
308
|
+
"ambientColor": "#ffffff",
|
|
309
|
+
"ambientIntensity": 0.4,
|
|
310
|
+
"lights": [],
|
|
311
|
+
"objects": [],
|
|
312
|
+
"bloom": false,
|
|
313
|
+
"bloomStrength": 0.6,
|
|
314
|
+
"fxaa": false,
|
|
315
|
+
"ssao": false,
|
|
316
|
+
"frameRuntime": "ui",
|
|
317
|
+
"variables": {},
|
|
318
|
+
"eventScriptEvents": "none",
|
|
319
|
+
"eventScriptKeys": [],
|
|
320
|
+
"eventScriptKeyRepeat": false,
|
|
321
|
+
"eventScriptKeyRepeatInterval": 90,
|
|
322
|
+
"enableRaycast": false,
|
|
323
|
+
"emitFrameEvents": false,
|
|
324
|
+
"frameEventInterval": 250
|
|
325
|
+
}
|
|
326
|
+
*/
|
|
327
|
+
property?: BrickBasicProperty & {
|
|
328
|
+
/* Renderer backend. `auto` uses WebGPU when available and falls back to WebGL. */
|
|
329
|
+
backend?: 'auto' | 'webgpu' | 'webgl' | DataLink
|
|
330
|
+
/* Enable multi-sample antialiasing */
|
|
331
|
+
antialias?: boolean | DataLink
|
|
332
|
+
/* Render with a transparent canvas (alpha channel) */
|
|
333
|
+
alpha?: boolean | DataLink
|
|
334
|
+
/* Enable shadow mapping for lights and meshes */
|
|
335
|
+
shadows?: boolean | DataLink
|
|
336
|
+
/* Tone mapping curve */
|
|
337
|
+
toneMapping?: 'none' | 'linear' | 'reinhard' | 'cineon' | 'aces' | 'agx' | DataLink
|
|
338
|
+
/* Output color space */
|
|
339
|
+
colorSpace?: 'srgb' | 'srgb-linear' | DataLink
|
|
340
|
+
/* GPU power preference */
|
|
341
|
+
powerPreference?: 'default' | 'high-performance' | 'low-power' | DataLink
|
|
342
|
+
/* Frame loop policy. `always` renders every frame; `whenVisible` pauses off-screen; `demand` renders only on prop change or invalidate */
|
|
343
|
+
frameLoop?: 'always' | 'whenVisible' | 'demand' | DataLink
|
|
344
|
+
/* Camera projection type */
|
|
345
|
+
cameraType?: 'perspective' | 'orthographic' | DataLink
|
|
346
|
+
/* Camera position in world space */
|
|
347
|
+
cameraPosition?:
|
|
348
|
+
| DataLink
|
|
349
|
+
| {
|
|
350
|
+
x?: number | DataLink
|
|
351
|
+
y?: number | DataLink
|
|
352
|
+
z?: number | DataLink
|
|
353
|
+
}
|
|
354
|
+
/* Point the camera looks at */
|
|
355
|
+
cameraTarget?:
|
|
356
|
+
| DataLink
|
|
357
|
+
| {
|
|
358
|
+
x?: number | DataLink
|
|
359
|
+
y?: number | DataLink
|
|
360
|
+
z?: number | DataLink
|
|
361
|
+
}
|
|
362
|
+
/* Field of view in degrees (perspective camera only) */
|
|
363
|
+
fov?: number | DataLink
|
|
364
|
+
/* Near clipping plane */
|
|
365
|
+
near?: number | DataLink
|
|
366
|
+
/* Far clipping plane */
|
|
367
|
+
far?: number | DataLink
|
|
368
|
+
/* Camera zoom factor */
|
|
369
|
+
zoom?: number | DataLink
|
|
370
|
+
/* Interaction controls */
|
|
371
|
+
controls?: 'none' | 'orbit' | 'pan-zoom' | DataLink
|
|
372
|
+
/* Auto-rotate the camera around the target */
|
|
373
|
+
autoRotate?: boolean | DataLink
|
|
374
|
+
/* Auto-rotate speed (units per second) */
|
|
375
|
+
autoRotateSpeed?: number | DataLink
|
|
376
|
+
/* Smooth interaction with damping */
|
|
377
|
+
enableDamping?: boolean | DataLink
|
|
378
|
+
/* Minimum dolly distance */
|
|
379
|
+
minDistance?: number | DataLink
|
|
380
|
+
/* Maximum dolly distance */
|
|
381
|
+
maxDistance?: number | DataLink
|
|
382
|
+
/* Minimum polar angle (radians) */
|
|
383
|
+
minPolarAngle?: number | DataLink
|
|
384
|
+
/* Maximum polar angle (radians) */
|
|
385
|
+
maxPolarAngle?: number | DataLink
|
|
386
|
+
/* Background solid color (used when no background image is set) */
|
|
387
|
+
backgroundColor?: string | DataLink
|
|
388
|
+
/* Background image URL (HDR/EXR/equirect environment map) */
|
|
389
|
+
backgroundImage?: string | DataLink
|
|
390
|
+
/* Environment map projection */
|
|
391
|
+
envMapProjection?: 'equirect' | 'cube' | 'none' | DataLink
|
|
392
|
+
/* Fog color */
|
|
393
|
+
fogColor?: string | DataLink
|
|
394
|
+
/* Fog near distance */
|
|
395
|
+
fogNear?: number | DataLink
|
|
396
|
+
/* Fog far distance */
|
|
397
|
+
fogFar?: number | DataLink
|
|
398
|
+
/* Ambient light color */
|
|
399
|
+
ambientColor?: string | DataLink
|
|
400
|
+
/* Ambient light intensity */
|
|
401
|
+
ambientIntensity?: number | DataLink
|
|
402
|
+
/* Scene lights. Each entry: `{ type, color, intensity, position, target, castShadow, ... }` */
|
|
403
|
+
lights?:
|
|
404
|
+
| Array<
|
|
405
|
+
| DataLink
|
|
406
|
+
| {
|
|
407
|
+
type?: 'ambient' | 'directional' | 'point' | 'spot' | 'hemisphere' | DataLink
|
|
408
|
+
color?: string | DataLink
|
|
409
|
+
intensity?: number | DataLink
|
|
410
|
+
position?:
|
|
411
|
+
| DataLink
|
|
412
|
+
| {
|
|
413
|
+
x?: number | DataLink
|
|
414
|
+
y?: number | DataLink
|
|
415
|
+
z?: number | DataLink
|
|
416
|
+
}
|
|
417
|
+
target?:
|
|
418
|
+
| DataLink
|
|
419
|
+
| {
|
|
420
|
+
x?: number | DataLink
|
|
421
|
+
y?: number | DataLink
|
|
422
|
+
z?: number | DataLink
|
|
423
|
+
}
|
|
424
|
+
castShadow?: boolean | DataLink
|
|
425
|
+
distance?: number | DataLink
|
|
426
|
+
decay?: number | DataLink
|
|
427
|
+
angle?: number | DataLink
|
|
428
|
+
penumbra?: number | DataLink
|
|
429
|
+
groundColor?: string | DataLink
|
|
430
|
+
}
|
|
431
|
+
>
|
|
432
|
+
| DataLink
|
|
433
|
+
/* Scene objects. Each entry: `{ id, type, url?, md5?, position, rotation, scale, color?, animation?, visible }` */
|
|
434
|
+
objects?:
|
|
435
|
+
| Array<
|
|
436
|
+
| DataLink
|
|
437
|
+
| {
|
|
438
|
+
id?: string | DataLink
|
|
439
|
+
type?:
|
|
440
|
+
| 'gltf'
|
|
441
|
+
| 'usd'
|
|
442
|
+
| 'usdz'
|
|
443
|
+
| 'box'
|
|
444
|
+
| 'sphere'
|
|
445
|
+
| 'plane'
|
|
446
|
+
| 'cylinder'
|
|
447
|
+
| 'cone'
|
|
448
|
+
| 'torus'
|
|
449
|
+
| 'text'
|
|
450
|
+
| DataLink
|
|
451
|
+
url?: string | DataLink
|
|
452
|
+
md5?: string | DataLink
|
|
453
|
+
position?:
|
|
454
|
+
| DataLink
|
|
455
|
+
| {
|
|
456
|
+
x?: number | DataLink
|
|
457
|
+
y?: number | DataLink
|
|
458
|
+
z?: number | DataLink
|
|
459
|
+
}
|
|
460
|
+
rotation?:
|
|
461
|
+
| DataLink
|
|
462
|
+
| {
|
|
463
|
+
x?: number | DataLink
|
|
464
|
+
y?: number | DataLink
|
|
465
|
+
z?: number | DataLink
|
|
466
|
+
}
|
|
467
|
+
scale?:
|
|
468
|
+
| DataLink
|
|
469
|
+
| {
|
|
470
|
+
x?: number | DataLink
|
|
471
|
+
y?: number | DataLink
|
|
472
|
+
z?: number | DataLink
|
|
473
|
+
}
|
|
474
|
+
color?: string | DataLink
|
|
475
|
+
text?: string | DataLink
|
|
476
|
+
animation?: string | DataLink
|
|
477
|
+
visible?: boolean | DataLink
|
|
478
|
+
castShadow?: boolean | DataLink
|
|
479
|
+
receiveShadow?: boolean | DataLink
|
|
480
|
+
}
|
|
481
|
+
>
|
|
482
|
+
| DataLink
|
|
483
|
+
/* Enable bloom post-effect */
|
|
484
|
+
bloom?: boolean | DataLink
|
|
485
|
+
/* Bloom intensity */
|
|
486
|
+
bloomStrength?: number | DataLink
|
|
487
|
+
/* Enable FXAA antialiasing post-effect */
|
|
488
|
+
fxaa?: boolean | DataLink
|
|
489
|
+
/* Enable screen-space ambient occlusion (SSAO) */
|
|
490
|
+
ssao?: boolean | DataLink
|
|
491
|
+
/* Where the per-frame script runs. `ui` dispatches the data-op to reanimated's UI runtime via `runOnUI` (slightly less Promise overhead). `js` evaluates on the worklets-core thread via `runOnUIAsync` (Promise-resolved). Pick `js` if you don't have `react-native-reanimated` installed. */
|
|
492
|
+
frameRuntime?: 'js' | 'ui' | DataLink
|
|
493
|
+
/* JS expression or script. Pure expressions run on the worklet thread per frame (`time`, `dt`, `objects`, `camera`, `variables` are in scope). Statement-form scripts run once on mount via the JS sandbox. */
|
|
494
|
+
script?: string | DataLink
|
|
495
|
+
/* JS expression run when an enabled key or pointer event fires. It receives `event` / `input` plus `time`, `objects`, `camera`, and `variables`, and returns the same mutation map as `script`. */
|
|
496
|
+
eventScript?: string | DataLink
|
|
497
|
+
/* Object of values exposed to the inline `script` as `variables.<key>`. Updates re-flow into the script on the next frame. */
|
|
498
|
+
variables?: DataLink | {}
|
|
499
|
+
/* Which input events can run `eventScript`. `none` disables it; `all` enables key + pointer; `keys` and `pointer` enable only that input family. */
|
|
500
|
+
eventScriptEvents?: 'none' | 'all' | 'keys' | 'pointer' | DataLink
|
|
501
|
+
/* Optional key allowlist for `eventScript` (`pressedKey`, `code`, or `keyCode`). Empty means every key. */
|
|
502
|
+
eventScriptKeys?:
|
|
503
|
+
| string
|
|
504
|
+
| DataLink
|
|
505
|
+
| Array<string | DataLink | number | DataLink | DataLink>
|
|
506
|
+
| DataLink
|
|
507
|
+
| DataLink
|
|
508
|
+
/* Repeat `keydown` event scripts while an allowed key is held. Repeat events include `event.repeat === true`. */
|
|
509
|
+
eventScriptKeyRepeat?: boolean | DataLink
|
|
510
|
+
/* Interval in milliseconds for repeated key event scripts. */
|
|
511
|
+
eventScriptKeyRepeatInterval?: number | DataLink
|
|
512
|
+
/* Enable pointer raycast → emits `BRICK_SCENE_3D_ON_OBJECT_CLICK` / `_ON_OBJECT_HOVER` */
|
|
513
|
+
enableRaycast?: boolean | DataLink
|
|
514
|
+
/* Emit periodic `BRICK_SCENE_3D_ON_FRAME` events */
|
|
515
|
+
emitFrameEvents?: boolean | DataLink
|
|
516
|
+
/* Throttle interval for frame events (ms) */
|
|
517
|
+
frameEventInterval?: number | DataLink
|
|
518
|
+
}
|
|
519
|
+
events?: BrickBasicEvents & {
|
|
520
|
+
/* An asset finished loading (gltf/usd/usdz/hdr/texture) */
|
|
521
|
+
onLoad?: Array<EventAction<string & keyof TemplateEventPropsMap['Scene3D']['onLoad']>>
|
|
522
|
+
/* An asset failed to load */
|
|
523
|
+
onLoadError?: Array<EventAction<string & keyof TemplateEventPropsMap['Scene3D']['onLoadError']>>
|
|
524
|
+
/* Pointer click hit an object */
|
|
525
|
+
onObjectClick?: Array<
|
|
526
|
+
EventAction<string & keyof TemplateEventPropsMap['Scene3D']['onObjectClick']>
|
|
527
|
+
>
|
|
528
|
+
/* Pointer hover entered or left an object */
|
|
529
|
+
onObjectHover?: Array<
|
|
530
|
+
EventAction<string & keyof TemplateEventPropsMap['Scene3D']['onObjectHover']>
|
|
531
|
+
>
|
|
532
|
+
/* An animation clip finished */
|
|
533
|
+
onAnimationEnd?: Array<
|
|
534
|
+
EventAction<string & keyof TemplateEventPropsMap['Scene3D']['onAnimationEnd']>
|
|
535
|
+
>
|
|
536
|
+
/* Periodic frame tick (throttled by `frameEventInterval`, gated by `emitFrameEvents`) */
|
|
537
|
+
onFrame?: Array<EventAction<string & keyof TemplateEventPropsMap['Scene3D']['onFrame']>>
|
|
538
|
+
/* Inline `script` failed at compile, init, or per-frame execution */
|
|
539
|
+
onScriptError?: Array<
|
|
540
|
+
EventAction<string & keyof TemplateEventPropsMap['Scene3D']['onScriptError']>
|
|
541
|
+
>
|
|
542
|
+
}
|
|
543
|
+
outlets?: {
|
|
544
|
+
/* Latest frame rate (frames per second) */
|
|
545
|
+
fps?: () => Data<number>
|
|
546
|
+
/* Number of objects in the scene */
|
|
547
|
+
objectCount?: () => Data<number>
|
|
548
|
+
/* ID of the most recently selected object (via raycast click) */
|
|
549
|
+
selectedObjectId?: () => Data<string>
|
|
550
|
+
/* URI of the most recent screenshot */
|
|
551
|
+
lastScreenshotUri?: () => Data<string>
|
|
552
|
+
/* Snapshot of scene state (objects, camera, lights) */
|
|
553
|
+
sceneState?: () => Data<{
|
|
554
|
+
objects?: any[]
|
|
555
|
+
camera?: { [key: string]: any }
|
|
556
|
+
lights?: any[]
|
|
557
|
+
[key: string]: any
|
|
558
|
+
}>
|
|
559
|
+
}
|
|
560
|
+
animation?: AnimationBasicEvents & {
|
|
561
|
+
onLoad?: AnimationOrGetter
|
|
562
|
+
onLoadError?: AnimationOrGetter
|
|
563
|
+
onObjectClick?: AnimationOrGetter
|
|
564
|
+
onObjectHover?: AnimationOrGetter
|
|
565
|
+
onAnimationEnd?: AnimationOrGetter
|
|
566
|
+
onFrame?: AnimationOrGetter
|
|
567
|
+
onScriptError?: AnimationOrGetter
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/* 3D scene renderer powered by WebGPU/WebGL with declarative objects, lights, camera, controls, and a script hook (tvOS support is experimental) */
|
|
572
|
+
export type BrickScene3D = Brick &
|
|
573
|
+
BrickScene3DDef & {
|
|
574
|
+
templateKey: 'BRICK_SCENE_3D'
|
|
575
|
+
switches?: Array<
|
|
576
|
+
SwitchDef &
|
|
577
|
+
BrickScene3DDef & {
|
|
578
|
+
conds?: Array<{
|
|
579
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
580
|
+
cond:
|
|
581
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
582
|
+
| SwitchCondData
|
|
583
|
+
| {
|
|
584
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
585
|
+
outlet:
|
|
586
|
+
| 'fps'
|
|
587
|
+
| 'objectCount'
|
|
588
|
+
| 'selectedObjectId'
|
|
589
|
+
| 'lastScreenshotUri'
|
|
590
|
+
| 'sceneState'
|
|
591
|
+
value: any
|
|
592
|
+
}
|
|
593
|
+
}>
|
|
594
|
+
}
|
|
595
|
+
>
|
|
596
|
+
}
|
package/types/bricks/Sketch.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
6
6
|
import type { Data, DataLink } from '../data'
|
|
7
|
-
import type { Animation, AnimationBasicEvents } from '../animation'
|
|
7
|
+
import type { Animation, AnimationBasicEvents, AnimationOrGetter } from '../animation'
|
|
8
8
|
import type {
|
|
9
9
|
Brick,
|
|
10
10
|
EventAction,
|
|
@@ -223,11 +223,11 @@ Default property:
|
|
|
223
223
|
}>
|
|
224
224
|
}
|
|
225
225
|
animation?: AnimationBasicEvents & {
|
|
226
|
-
onStrokeEnd?:
|
|
227
|
-
onClear?:
|
|
228
|
-
onStateChange?:
|
|
229
|
-
onToolChange?:
|
|
230
|
-
onExportImage?:
|
|
226
|
+
onStrokeEnd?: AnimationOrGetter
|
|
227
|
+
onClear?: AnimationOrGetter
|
|
228
|
+
onStateChange?: AnimationOrGetter
|
|
229
|
+
onToolChange?: AnimationOrGetter
|
|
230
|
+
onExportImage?: AnimationOrGetter
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
6
6
|
import type { Data, DataLink } from '../data'
|
|
7
|
-
import type { Animation, AnimationBasicEvents } from '../animation'
|
|
7
|
+
import type { Animation, AnimationBasicEvents, AnimationOrGetter } from '../animation'
|
|
8
8
|
import type {
|
|
9
9
|
Brick,
|
|
10
10
|
EventAction,
|
|
@@ -169,12 +169,12 @@ Default property:
|
|
|
169
169
|
>
|
|
170
170
|
}
|
|
171
171
|
animation?: AnimationBasicEvents & {
|
|
172
|
-
changeStart?:
|
|
173
|
-
changeEnd?:
|
|
174
|
-
contentChange?:
|
|
175
|
-
roundEnd?:
|
|
176
|
-
mediaOnLoad?:
|
|
177
|
-
mediaOnError?:
|
|
172
|
+
changeStart?: AnimationOrGetter
|
|
173
|
+
changeEnd?: AnimationOrGetter
|
|
174
|
+
contentChange?: AnimationOrGetter
|
|
175
|
+
roundEnd?: AnimationOrGetter
|
|
176
|
+
mediaOnLoad?: AnimationOrGetter
|
|
177
|
+
mediaOnError?: AnimationOrGetter
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
package/types/bricks/Svg.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
6
6
|
import type { Data, DataLink } from '../data'
|
|
7
|
-
import type { Animation, AnimationBasicEvents } from '../animation'
|
|
7
|
+
import type { Animation, AnimationBasicEvents, AnimationOrGetter } from '../animation'
|
|
8
8
|
import type {
|
|
9
9
|
Brick,
|
|
10
10
|
EventAction,
|
|
@@ -67,12 +67,12 @@ Default property:
|
|
|
67
67
|
brickFocusing?: () => Data<boolean>
|
|
68
68
|
}
|
|
69
69
|
animation?: AnimationBasicEvents & {
|
|
70
|
-
onPress?:
|
|
71
|
-
onPressIn?:
|
|
72
|
-
onPressOut?:
|
|
73
|
-
onLongPress?:
|
|
74
|
-
onFocus?:
|
|
75
|
-
onBlur?:
|
|
70
|
+
onPress?: AnimationOrGetter
|
|
71
|
+
onPressIn?: AnimationOrGetter
|
|
72
|
+
onPressOut?: AnimationOrGetter
|
|
73
|
+
onLongPress?: AnimationOrGetter
|
|
74
|
+
onFocus?: AnimationOrGetter
|
|
75
|
+
onBlur?: AnimationOrGetter
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|