@fugood/bricks-project 2.22.0-beta.8 → 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.
Files changed (86) hide show
  1. package/compile/action-name-map.ts +112 -1
  2. package/compile/index.ts +10 -1
  3. package/package.json +3 -3
  4. package/tools/postinstall.ts +16 -9
  5. package/types/animation.ts +2 -1
  6. package/types/brick-base.ts +79 -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 +240 -0
  11. package/types/bricks/Icon.ts +93 -0
  12. package/types/bricks/Image.ts +104 -0
  13. package/types/bricks/Items.ts +461 -0
  14. package/types/bricks/Lottie.ts +159 -0
  15. package/types/bricks/QrCode.ts +112 -0
  16. package/types/bricks/Rect.ts +110 -0
  17. package/types/bricks/RichText.ts +123 -0
  18. package/types/bricks/Rive.ts +209 -0
  19. package/types/bricks/Slideshow.ts +155 -0
  20. package/types/bricks/Svg.ts +94 -0
  21. package/types/bricks/Text.ts +143 -0
  22. package/types/bricks/TextInput.ts +231 -0
  23. package/types/bricks/Video.ts +170 -0
  24. package/types/bricks/VideoStreaming.ts +107 -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/common.ts +8 -3
  29. package/types/data.ts +6 -0
  30. package/types/generators/AlarmClock.ts +102 -0
  31. package/types/generators/Assistant.ts +546 -0
  32. package/types/generators/BleCentral.ts +225 -0
  33. package/types/generators/BlePeripheral.ts +202 -0
  34. package/types/generators/CanvasMap.ts +57 -0
  35. package/types/generators/CastlesPay.ts +77 -0
  36. package/types/generators/DataBank.ts +123 -0
  37. package/types/generators/File.ts +351 -0
  38. package/types/generators/GraphQl.ts +124 -0
  39. package/types/generators/Http.ts +117 -0
  40. package/types/generators/HttpServer.ts +164 -0
  41. package/types/generators/Information.ts +97 -0
  42. package/types/generators/Intent.ts +107 -0
  43. package/types/generators/Iterator.ts +95 -0
  44. package/types/generators/Keyboard.ts +85 -0
  45. package/types/generators/LlmAnthropicCompat.ts +188 -0
  46. package/types/generators/LlmGgml.ts +719 -0
  47. package/types/generators/LlmOnnx.ts +184 -0
  48. package/types/generators/LlmOpenAiCompat.ts +206 -0
  49. package/types/generators/LlmQualcommAiEngine.ts +213 -0
  50. package/types/generators/Mcp.ts +294 -0
  51. package/types/generators/McpServer.ts +248 -0
  52. package/types/generators/MediaFlow.ts +142 -0
  53. package/types/generators/MqttBroker.ts +121 -0
  54. package/types/generators/MqttClient.ts +129 -0
  55. package/types/generators/Question.ts +395 -0
  56. package/types/generators/RealtimeTranscription.ts +180 -0
  57. package/types/generators/RerankerGgml.ts +153 -0
  58. package/types/generators/SerialPort.ts +141 -0
  59. package/types/generators/SoundPlayer.ts +86 -0
  60. package/types/generators/SoundRecorder.ts +113 -0
  61. package/types/generators/SpeechToTextGgml.ts +462 -0
  62. package/types/generators/SpeechToTextOnnx.ts +227 -0
  63. package/types/generators/SpeechToTextPlatform.ts +75 -0
  64. package/types/generators/SqLite.ts +118 -0
  65. package/types/generators/Step.ts +101 -0
  66. package/types/generators/TapToPayOnIPhone.ts +175 -0
  67. package/types/generators/Tcp.ts +120 -0
  68. package/types/generators/TcpServer.ts +137 -0
  69. package/types/generators/TextToSpeechGgml.ts +182 -0
  70. package/types/generators/TextToSpeechOnnx.ts +169 -0
  71. package/types/generators/TextToSpeechOpenAiLike.ts +113 -0
  72. package/types/generators/ThermalPrinter.ts +185 -0
  73. package/types/generators/Tick.ts +75 -0
  74. package/types/generators/Udp.ts +109 -0
  75. package/types/generators/VadGgml.ts +211 -0
  76. package/types/generators/VectorStore.ts +223 -0
  77. package/types/generators/Watchdog.ts +96 -0
  78. package/types/generators/WebCrawler.ts +97 -0
  79. package/types/generators/WebRtc.ts +165 -0
  80. package/types/generators/WebSocket.ts +142 -0
  81. package/types/generators/index.ts +51 -0
  82. package/types/system.ts +64 -0
  83. package/utils/data.ts +45 -0
  84. package/utils/event-props.ts +89 -0
  85. package/types/bricks.ts +0 -3168
  86. package/types/generators.ts +0 -7580
@@ -100,6 +100,9 @@ export const templateActionNameMap = {
100
100
  payloadType: 'CHANNEL_PUBLISH_PAYLOAD_TYPE',
101
101
  payload: 'CHANNEL_PUBLISH_PAYLOAD',
102
102
  },
103
+ DELAY: {
104
+ time: 'DELAY_TIME',
105
+ },
103
106
  USE_SHARE_APPLICATION: {
104
107
  applicationId: 'APPLICATION_ID',
105
108
  releaseVersion: 'RELEASE_VERSION',
@@ -126,6 +129,17 @@ export const templateActionNameMap = {
126
129
  behavior: 'BEHAVIOR',
127
130
  exceptionMessage: 'EXCEPTION_MESSAGE',
128
131
  },
132
+ TRIGGER_APPLICATION_FILTER: {
133
+ name: 'NAME',
134
+ variables: 'VARIABLES',
135
+ result: 'RESULT',
136
+ error: 'ERROR',
137
+ },
138
+ SAVE_UPDATE_SNAPSHOT: {
139
+ snapshotFileIndentifier: 'SNAPSHOT_FILE_INDENTIFIER',
140
+ snapshotSaveResult: 'SNAPSHOT_SAVE_RESULT',
141
+ snapshotErrorResult: 'SNAPSHOT_ERROR_RESULT',
142
+ },
129
143
  },
130
144
 
131
145
  BRICK_TEXT_INPUT: {
@@ -142,6 +156,13 @@ export const templateActionNameMap = {
142
156
  },
143
157
  },
144
158
 
159
+ BRICK_VIDEO: {
160
+ BRICK_VIDEO_SEEK: {
161
+ seekTime: 'BRICK_VIDEO_SEEK_TIME',
162
+ play: 'BRICK_VIDEO_PLAY',
163
+ },
164
+ },
165
+
145
166
  BRICK_SLIDESHOW: {
146
167
  BRICK_SLIDESHOW_JUMP_TO_INDEX: {
147
168
  index: 'BRICK_SLIDESHOW_INDEX',
@@ -231,7 +252,12 @@ export const templateActionNameMap = {
231
252
  index: 'BRICK_ITEMS_INDEX',
232
253
  },
233
254
  },
234
-
255
+ BRICK_LOTTIE: {
256
+ BRICK_LOTTIE_PLAY: {
257
+ startFrame: 'BRICK_LOTTIE_START_FRAME',
258
+ endFrame: 'BRICK_LOTTIE_END_FRAME',
259
+ },
260
+ },
235
261
  BRICK_RIVE: {
236
262
  BRICK_RIVE_PLAY: {
237
263
  animationName: 'BRICK_RIVE_ANIMATION_NAME',
@@ -257,6 +283,10 @@ export const templateActionNameMap = {
257
283
  BRICK_WEBVIEW_INJECT_JAVASCRIPT: {
258
284
  javascriptCode: 'BRICK_WEBVIEW_JAVASCRIPT_CODE',
259
285
  },
286
+ BRICK_WEBVIEW_QUERY_SELECTOR: {
287
+ querySelector: 'BRICK_WEBVIEW_QUERY_SELECTOR',
288
+ expression: 'BRICK_WEBVIEW_EXPRESSION',
289
+ },
260
290
  },
261
291
  BRICK_CAMERA: {
262
292
  BRICK_CAMERA_TAKE_PICTURE: {
@@ -552,6 +582,8 @@ export const templateActionNameMap = {
552
582
  prompt: 'GENERATOR_ONNX_LLM_PROMPT',
553
583
  chat: 'GENERATOR_ONNX_LLM_CHAT',
554
584
  images: 'GENERATOR_ONNX_LLM_IMAGES',
585
+ tools: 'GENERATOR_ONNX_LLM_TOOLS',
586
+ toolChoice: 'GENERATOR_ONNX_LLM_TOOL_CHOICE',
555
587
  },
556
588
  },
557
589
  GENERATOR_ONNX_STT: {
@@ -589,7 +621,37 @@ export const templateActionNameMap = {
589
621
  realtimeVadFreqThold: 'GENERATOR_SPEECH_INFERENCE_REALTIME_VAD_FREQ_THOLD',
590
622
  },
591
623
  },
624
+ GENERATOR_VAD_INFERENCE: {
625
+ GENERATOR_VAD_INFERENCE_DETECT_FILE: {
626
+ fileUrl: 'GENERATOR_VAD_INFERENCE_FILE_URL',
627
+ threshold: 'GENERATOR_VAD_INFERENCE_THRESHOLD',
628
+ minSpeechDurationMs: 'GENERATOR_VAD_INFERENCE_MIN_SPEECH_DURATION_MS',
629
+ minSilenceDurationMs: 'GENERATOR_VAD_INFERENCE_MIN_SILENCE_DURATION_MS',
630
+ maxSpeechDurationS: 'GENERATOR_VAD_INFERENCE_MAX_SPEECH_DURATION_S',
631
+ speechPadMs: 'GENERATOR_VAD_INFERENCE_SPEECH_PAD_MS',
632
+ samplesOverlap: 'GENERATOR_VAD_INFERENCE_SAMPLES_OVERLAP',
633
+ },
634
+ GENERATOR_VAD_INFERENCE_DETECT_DATA: {
635
+ data: 'GENERATOR_VAD_INFERENCE_DATA',
636
+ threshold: 'GENERATOR_VAD_INFERENCE_THRESHOLD',
637
+ minSpeechDurationMs: 'GENERATOR_VAD_INFERENCE_MIN_SPEECH_DURATION_MS',
638
+ minSilenceDurationMs: 'GENERATOR_VAD_INFERENCE_MIN_SILENCE_DURATION_MS',
639
+ maxSpeechDurationS: 'GENERATOR_VAD_INFERENCE_MAX_SPEECH_DURATION_S',
640
+ speechPadMs: 'GENERATOR_VAD_INFERENCE_SPEECH_PAD_MS',
641
+ samplesOverlap: 'GENERATOR_VAD_INFERENCE_SAMPLES_OVERLAP',
642
+ },
643
+ },
644
+
592
645
  GENERATOR_LLM: {
646
+ GENERATOR_LLM_TOKENIZE: {
647
+ mode: 'GENERATOR_LLM_MODE',
648
+ prompt: 'GENERATOR_LLM_PROMPT',
649
+ promptMediaPaths: 'GENERATOR_LLM_PROMPT_MEDIA_PATHS',
650
+ messages: 'GENERATOR_LLM_MESSAGES',
651
+ },
652
+ GENERATOR_LLM_DETOKENIZE: {
653
+ tokens: 'GENERATOR_LLM_TOKENS',
654
+ },
593
655
  GENERATOR_LLM_PROCESS_PROMPT: {
594
656
  sessionKey: 'GENERATOR_LLM_SESSION_KEY',
595
657
  mode: 'GENERATOR_LLM_MODE',
@@ -597,10 +659,15 @@ export const templateActionNameMap = {
597
659
  tools: 'GENERATOR_LLM_TOOLS',
598
660
  parallelToolCalls: 'GENERATOR_LLM_PARALLEL_TOOL_CALLS',
599
661
  toolChoice: 'GENERATOR_LLM_TOOL_CHOICE',
662
+ enableThinking: 'GENERATOR_LLM_ENABLE_THINKING',
600
663
  prompt: 'GENERATOR_LLM_PROMPT',
664
+ promptMediaPaths: 'GENERATOR_LLM_PROMPT_MEDIA_PATHS',
601
665
  promptTemplateData: 'GENERATOR_LLM_PROMPT_TEMPLATE_DATA',
602
666
  promptTemplateType: 'GENERATOR_LLM_PROMPT_TEMPLATE_TYPE',
603
667
  responseFormat: 'GENERATOR_LLM_RESPONSE_FORMAT',
668
+ chatTemplateKwargs: 'GENERATOR_LLM_CHAT_TEMPLATE_KWARGS',
669
+ addGenerationPrompt: 'GENERATOR_LLM_ADD_GENERATION_PROMPT',
670
+ now: 'GENERATOR_LLM_NOW',
604
671
  },
605
672
  GENERATOR_LLM_COMPLETION: {
606
673
  sessionKey: 'GENERATOR_LLM_SESSION_KEY',
@@ -609,10 +676,16 @@ export const templateActionNameMap = {
609
676
  tools: 'GENERATOR_LLM_TOOLS',
610
677
  parallelToolCalls: 'GENERATOR_LLM_PARALLEL_TOOL_CALLS',
611
678
  toolChoice: 'GENERATOR_LLM_TOOL_CHOICE',
679
+ enableThinking: 'GENERATOR_LLM_ENABLE_THINKING',
680
+ useReasoningFormat: 'GENERATOR_LLM_USE_REASONING_FORMAT',
612
681
  prompt: 'GENERATOR_LLM_PROMPT',
682
+ promptMediaPaths: 'GENERATOR_LLM_PROMPT_MEDIA_PATHS',
613
683
  promptTemplateData: 'GENERATOR_LLM_PROMPT_TEMPLATE_DATA',
614
684
  promptTemplateType: 'GENERATOR_LLM_PROMPT_TEMPLATE_TYPE',
615
685
  responseFormat: 'GENERATOR_LLM_RESPONSE_FORMAT',
686
+ chatTemplateKwargs: 'GENERATOR_LLM_CHAT_TEMPLATE_KWARGS',
687
+ addGenerationPrompt: 'GENERATOR_LLM_ADD_GENERATION_PROMPT',
688
+ now: 'GENERATOR_LLM_NOW',
616
689
  grammar: 'GENERATOR_LLM_GRAMMAR',
617
690
  stopWords: 'GENERATOR_LLM_STOP_WORDS',
618
691
  predict: 'GENERATOR_LLM_PREDICT',
@@ -646,10 +719,27 @@ export const templateActionNameMap = {
646
719
  sessionCustomKey: 'GENERATOR_LLM_SESSION_CUSTOM_KEY',
647
720
  },
648
721
  },
722
+ GENERATOR_GGML_TTS: {
723
+ GENERATOR_GGML_TTS_GENERATE: {
724
+ text: 'GENERATOR_GGML_TTS_TEXT',
725
+ },
726
+ },
727
+ GENERATOR_RERANKER: {
728
+ GENERATOR_RERANKER_RERANK: {
729
+ query: 'GENERATOR_RERANKER_QUERY',
730
+ documents: 'GENERATOR_RERANKER_DOCUMENTS',
731
+ },
732
+ },
649
733
  GENERATOR_QNN_LLM: {
734
+ GENERATOR_QNN_LLM_PROCESS: {
735
+ prompt: 'GENERATOR_QNN_LLM_PROMPT',
736
+ messages: 'GENERATOR_QNN_LLM_MESSAGES',
737
+ tools: 'GENERATOR_QNN_LLM_TOOLS',
738
+ },
650
739
  GENERATOR_QNN_LLM_GENERATE: {
651
740
  prompt: 'GENERATOR_QNN_LLM_PROMPT',
652
741
  messages: 'GENERATOR_QNN_LLM_MESSAGES',
742
+ tools: 'GENERATOR_QNN_LLM_TOOLS',
653
743
  },
654
744
  },
655
745
  GENERATOR_OPENAI_LLM: {
@@ -672,10 +762,24 @@ export const templateActionNameMap = {
672
762
  text: 'GENERATOR_OPENAI_TTS_TEXT',
673
763
  },
674
764
  },
765
+ GENERATOR_ANTHROPIC_LLM: {
766
+ GENERATOR_ANTHROPIC_LLM_COMPLETION: {
767
+ systemMessage: 'GENERATOR_ANTHROPIC_LLM_SYSTEM_MESSAGE',
768
+ messages: 'GENERATOR_ANTHROPIC_LLM_MESSAGES',
769
+ maxTokens: 'GENERATOR_ANTHROPIC_LLM_MAX_TOKENS',
770
+ temperature: 'GENERATOR_ANTHROPIC_LLM_TEMPERATURE',
771
+ topP: 'GENERATOR_ANTHROPIC_LLM_TOP_P',
772
+ topK: 'GENERATOR_ANTHROPIC_LLM_TOP_K',
773
+ stopSequences: 'GENERATOR_ANTHROPIC_LLM_STOP_SEQUENCES',
774
+ tools: 'GENERATOR_ANTHROPIC_LLM_TOOLS',
775
+ toolChoice: 'GENERATOR_ANTHROPIC_LLM_TOOL_CHOICE',
776
+ },
777
+ },
675
778
  GENERATOR_ASSISTANT: {
676
779
  GENERATOR_ASSISTANT_ADD_MESSAGE: {
677
780
  role: 'GENERATOR_ASSISTANT_ROLE',
678
781
  content: 'GENERATOR_ASSISTANT_CONTENT',
782
+ image: 'GENERATOR_ASSISTANT_IMAGE',
679
783
  payload: 'GENERATOR_ASSISTANT_PAYLOAD',
680
784
  useFileSearch: 'GENERATOR_ASSISTANT_USE_FILE_SEARCH',
681
785
  filePath: 'GENERATOR_ASSISTANT_FILE_PATH',
@@ -699,12 +803,14 @@ export const templateActionNameMap = {
699
803
  GENERATOR_ASSISTANT_UPDATE_MESSAGE_AT_INDEX: {
700
804
  index: 'GENERATOR_ASSISTANT_INDEX',
701
805
  content: 'GENERATOR_ASSISTANT_CONTENT',
806
+ image: 'GENERATOR_ASSISTANT_IMAGE',
702
807
  payload: 'GENERATOR_ASSISTANT_PAYLOAD',
703
808
  },
704
809
  GENERATOR_ASSISTANT_ADD_AUDIO_MESSAGE: {
705
810
  role: 'GENERATOR_ASSISTANT_ROLE',
706
811
  contentFile: 'GENERATOR_ASSISTANT_CONTENT_FILE',
707
812
  contentBase64: 'GENERATOR_ASSISTANT_CONTENT_BASE64',
813
+ image: 'GENERATOR_ASSISTANT_IMAGE',
708
814
  useFileSearch: 'GENERATOR_ASSISTANT_USE_FILE_SEARCH',
709
815
  payload: 'GENERATOR_ASSISTANT_PAYLOAD',
710
816
  filePath: 'GENERATOR_ASSISTANT_FILE_PATH',
@@ -727,6 +833,7 @@ export const templateActionNameMap = {
727
833
  index: 'GENERATOR_ASSISTANT_INDEX',
728
834
  contentFile: 'GENERATOR_ASSISTANT_CONTENT_FILE',
729
835
  contentBase64: 'GENERATOR_ASSISTANT_CONTENT_BASE64',
836
+ image: 'GENERATOR_ASSISTANT_IMAGE',
730
837
  payload: 'GENERATOR_ASSISTANT_PAYLOAD',
731
838
  },
732
839
  GENERATOR_ASSISTANT_REMOVE_MESSAGE_AT_INDEX: {
@@ -743,6 +850,10 @@ export const templateActionNameMap = {
743
850
  mcpVariables: 'GENERATOR_ASSISTANT_MCP_VARIABLES',
744
851
  role: 'GENERATOR_ASSISTANT_ROLE',
745
852
  },
853
+ GENERATOR_ASSISTANT_SUMMARY_MESSAGES: {
854
+ summaryMessages: 'GENERATOR_ASSISTANT_SUMMARY_MESSAGES',
855
+ summarySessionKey: 'GENERATOR_ASSISTANT_SUMMARY_SESSION_KEY',
856
+ },
746
857
  },
747
858
  GENERATOR_VECTOR_STORE: {
748
859
  GENERATOR_VECTOR_STORE_RESET: {
package/compile/index.ts CHANGED
@@ -59,7 +59,9 @@ const compileEventActionValue = (templateKey, eventKey, value, errorReference) =
59
59
  if (!props) return compileProperty(value, errorReference)
60
60
  if (props.includes(value)) return value
61
61
  if (value?.startsWith(templateKey)) {
62
- console.warn(`[Warning] Value start with template key but there is no event property: ${value} ${errorReference}`)
62
+ console.warn(
63
+ `[Warning] Value start with template key but there is no event property: ${value} ${errorReference}`,
64
+ )
63
65
  }
64
66
  return compileProperty(value, errorReference)
65
67
  }
@@ -223,6 +225,13 @@ const compileApplicationSettings = (settings: Application['settings']) => {
223
225
  selectable_border: settings.tvOptions.selectableBorder,
224
226
  }
225
227
  : undefined,
228
+ ai: settings?.ai
229
+ ? {
230
+ use_anthropic_api_key_system_data: settings.ai.useAnthropicApiKeySystemData,
231
+ use_openai_api_key_system_data: settings.ai.useOpenAiApiKeySystemData,
232
+ use_gemini_api_key_system_data: settings.ai.useGeminiApiKeySystemData,
233
+ }
234
+ : undefined,
226
235
  }
227
236
  }
228
237
 
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.22.0-beta.8",
3
+ "version": "2.22.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "build": "node scripts/build.js"
7
7
  },
8
8
  "dependencies": {
9
- "@modelcontextprotocol/sdk": "^1.7.0",
9
+ "@modelcontextprotocol/sdk": "^1.15.0",
10
10
  "@types/escodegen": "^0.0.10",
11
11
  "@types/lodash": "^4.17.12",
12
12
  "acorn": "^8.13.0",
@@ -14,5 +14,5 @@
14
14
  "lodash": "^4.17.4",
15
15
  "uuid": "^8.3.1"
16
16
  },
17
- "gitHead": "1745f85ae031ef75bbb0e235f22eff7a0b081cc5"
17
+ "gitHead": "d61c326c30686b72477e3194bebe521b10ec83d8"
18
18
  }
@@ -1,15 +1,7 @@
1
1
  import { $ } from 'bun'
2
2
  import { stat, readFile, writeFile } from 'fs/promises'
3
- const cwd = process.cwd()
4
-
5
- const libFiles = ['types', 'utils', 'index.ts']
6
3
 
7
- await $`mkdir -p ${cwd}/project`
8
- for (const file of libFiles) {
9
- await $`cp -r ${__dirname}/../${file} ${cwd}/project`
10
- }
11
-
12
- console.log('Copied files to project/')
4
+ const cwd = process.cwd()
13
5
 
14
6
  async function exists(f: string) {
15
7
  try {
@@ -20,6 +12,21 @@ async function exists(f: string) {
20
12
  }
21
13
  }
22
14
 
15
+ // handle flag --skip-copy
16
+ const skipCopyProject = process.argv.includes('--skip-copy-project')
17
+ if (skipCopyProject) {
18
+ console.log('Skipping copy of files to project/')
19
+ } else {
20
+
21
+ const libFiles = ['types', 'utils', 'index.ts']
22
+
23
+ await $`mkdir -p ${cwd}/project`
24
+ for (const file of libFiles) {
25
+ await $`cp -r ${__dirname}/../${file} ${cwd}/project`
26
+ }
27
+ console.log('Copied files to project/')
28
+ }
29
+
23
30
  const projectMcpServer = {
24
31
  command: 'bun',
25
32
  args: [`${cwd}/node_modules/@fugood/bricks-project/tools/mcp-server.ts`],
@@ -30,6 +30,7 @@ export type Easing =
30
30
  | 'easeInBounce'
31
31
  | 'easeOutBounce'
32
32
  | 'easeInOutBounce'
33
+ | string // Support format like 'cubic-bezier(x1, y1, x2, y2)'
33
34
 
34
35
  export interface AnimationTimingConfig {
35
36
  __type: 'AnimationTimingConfig'
@@ -89,7 +90,7 @@ export interface AnimationComposeDef {
89
90
  export type Animation = AnimationDef | AnimationComposeDef
90
91
 
91
92
  export interface AnimationBasicEvents {
92
- show?: Animation
93
+ showStart?: Animation
93
94
  standby?: Animation
94
95
  breatheStart?: Animation
95
96
  }
@@ -0,0 +1,79 @@
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
+
14
+ export interface BrickBasicProperty {
15
+ /* The brick opacity (0 ~ 1) */
16
+ opacity?: number | DataLink
17
+ /* The brick background color */
18
+ backgroundColor?: string | DataLink
19
+ /* The brick border style */
20
+ borderStyle?: 'solid' | 'dotted' | 'dashed' | DataLink
21
+ /* The brick border width (top) */
22
+ borderTopSize?: number | DataLink
23
+ /* The brick border color (top) */
24
+ borderTopColor?: string | DataLink
25
+ /* The brick border radius (top left) */
26
+ borderTopLeftRadius?: number | DataLink
27
+ /* The brick border radius (top right) */
28
+ borderTopRightRadius?: number | DataLink
29
+ /* The brick border width (bottom) */
30
+ borderBottomSize?: number | DataLink
31
+ /* The brick border color (bottom) */
32
+ borderBottomColor?: string | DataLink
33
+ /* The brick border radius (bottom left) */
34
+ borderBottomLeftRadius?: number | DataLink
35
+ /* The brick border radius (bottom right) */
36
+ borderBottomRightRadius?: number | DataLink
37
+ /* The brick border width (left) */
38
+ borderLeftSize?: number | DataLink
39
+ /* The brick border color (bottom) */
40
+ borderLeftColor?: string | DataLink
41
+ /* The brick border width (right) */
42
+ borderRightSize?: number | DataLink
43
+ /* The brick border color (right) */
44
+ borderRightColor?: string | DataLink
45
+ /* The brick rotate (deg) */
46
+ rotate?: number | DataLink
47
+ /* The brick rotateX (deg) */
48
+ rotateX?: number | DataLink
49
+ /* The brick rotateY (deg) */
50
+ rotateY?: number | DataLink
51
+ /* The brick shadow color */
52
+ shadowColor?: string | DataLink
53
+ /* The brick shadow opacity (0 ~ 1) */
54
+ shadowOpacity?: number | DataLink
55
+ /* The brick shadow radius */
56
+ shadowRadius?: number | DataLink
57
+ /* The brick shadow offset width */
58
+ shadowOffsetWidth?: number | DataLink
59
+ /* The brick shadow offset height */
60
+ shadowOffsetHeight?: number | DataLink
61
+ /* Brick pressable.
62
+ Disabled: Disabled even if event or animation is set.
63
+ Bypass: Disable and bypass the touch event on the brick. */
64
+ pressable?: 'enabled' | 'disabled' | 'bypass' | DataLink
65
+ /* Delay in milliseconds before long press is triggered */
66
+ delayLongPress?: number | DataLink
67
+ }
68
+
69
+ export interface BrickBasicEvents {
70
+ showStart?: Array<EventAction>
71
+ switchUpdate?: Array<EventAction>
72
+ standby?: Array<EventAction>
73
+ }
74
+
75
+ export interface BrickBasicEventsForItem {
76
+ showStart?: Array<EventActionForItem>
77
+ switchUpdate?: Array<EventActionForItem>
78
+ standby?: Array<EventActionForItem>
79
+ }
@@ -0,0 +1,200 @@
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 object animation */
16
+ export type Brick3DViewerActionAnimationPlay = ActionWithParams & {
17
+ __actionName: 'BRICK_3D_VIEWER_ANIMATION_PLAY'
18
+ params?: Array<{
19
+ input: 'objectIndex'
20
+ value?: number | DataLink | EventProperty
21
+ mapping?: string
22
+ }>
23
+ }
24
+
25
+ /* Pause object animation */
26
+ export type Brick3DViewerActionAnimationPause = ActionWithParams & {
27
+ __actionName: 'BRICK_3D_VIEWER_ANIMATION_PAUSE'
28
+ params?: Array<{
29
+ input: 'objectIndex'
30
+ value?: number | DataLink | EventProperty
31
+ mapping?: string
32
+ }>
33
+ }
34
+
35
+ /* Goto object animation progress */
36
+ export type Brick3DViewerActionAnimationGoto = ActionWithParams & {
37
+ __actionName: 'BRICK_3D_VIEWER_ANIMATION_GOTO'
38
+ params?: Array<
39
+ | {
40
+ input: 'objectIndex'
41
+ value?: number | DataLink | EventProperty
42
+ mapping?: string
43
+ }
44
+ | {
45
+ input: 'animationProgress'
46
+ value?: number | DataLink | EventProperty
47
+ mapping?: string
48
+ }
49
+ >
50
+ }
51
+
52
+ interface Brick3DViewerDef {
53
+ /*
54
+ Default property:
55
+ {
56
+ "showLoadingBox": true,
57
+ "enableOrbitControls": true
58
+ }
59
+ */
60
+ property?: BrickBasicProperty & {
61
+ /* 3D model list */
62
+ objects?:
63
+ | Array<
64
+ | DataLink
65
+ | {
66
+ url?: string | DataLink
67
+ md5?: string | DataLink
68
+ type?: 'USDZ' | 'glTF' | DataLink
69
+ rotation?: number | DataLink | Array<number | DataLink> | DataLink | DataLink
70
+ scale?: number | DataLink | Array<number | DataLink> | DataLink | DataLink
71
+ x?: number | DataLink
72
+ y?: number | DataLink
73
+ z?: number | DataLink
74
+ moveable?: boolean | DataLink
75
+ rotateable?: boolean | DataLink
76
+ selectable?: boolean | DataLink
77
+ enableCollision?: boolean | DataLink
78
+ animationLoopMode?: 'once' | 'repeat' | 'pingpong' | DataLink
79
+ animationProgress?: number | DataLink
80
+ animationPaused?: boolean | DataLink
81
+ boundingBox?:
82
+ | DataLink
83
+ | {
84
+ min?:
85
+ | DataLink
86
+ | {
87
+ x?: number | DataLink
88
+ y?: number | DataLink
89
+ z?: number | DataLink
90
+ }
91
+ max?:
92
+ | DataLink
93
+ | {
94
+ x?: number | DataLink
95
+ y?: number | DataLink
96
+ z?: number | DataLink
97
+ }
98
+ }
99
+ }
100
+ >
101
+ | DataLink
102
+ /* Show loading placeholder box */
103
+ showLoadingBox?: boolean | DataLink
104
+ /* Display shadows */
105
+ shadows?: boolean | DataLink
106
+ /* Default camera position */
107
+ camera?:
108
+ | DataLink
109
+ | {
110
+ fov?: number | DataLink
111
+ aspect?: number | DataLink
112
+ near?: number | DataLink
113
+ far?: number | DataLink
114
+ position?:
115
+ | DataLink
116
+ | {
117
+ x?: number | DataLink
118
+ y?: number | DataLink
119
+ z?: number | DataLink
120
+ }
121
+ quaternion?:
122
+ | DataLink
123
+ | {
124
+ x?: number | DataLink
125
+ y?: number | DataLink
126
+ z?: number | DataLink
127
+ w?: number | DataLink
128
+ }
129
+ }
130
+ /* Enable orbit controls */
131
+ enableOrbitControls?: boolean | DataLink
132
+ /* Camera control options */
133
+ orbitControls?:
134
+ | DataLink
135
+ | {
136
+ autoRotate?: boolean | DataLink
137
+ enableZoom?: boolean | DataLink
138
+ enablePan?: boolean | DataLink
139
+ enableRotate?: boolean | DataLink
140
+ enableDamping?: boolean | DataLink
141
+ dampingFactor?: number | DataLink
142
+ rotateSpeed?: number | DataLink
143
+ zoomSpeed?: number | DataLink
144
+ panSpeed?: number | DataLink
145
+ minDistance?: number | DataLink
146
+ maxDistance?: number | DataLink
147
+ minPolarAngle?: number | DataLink
148
+ maxPolarAngle?: number | DataLink
149
+ minAzimuthAngle?: number | DataLink
150
+ maxAzimuthAngle?: number | DataLink
151
+ }
152
+ /* Move controls options */
153
+ moveControls?:
154
+ | DataLink
155
+ | {
156
+ responsiveness?: number | DataLink
157
+ rotationRingColor?: string | DataLink
158
+ rotationRingSize?: number | DataLink
159
+ showBoundingBox?: boolean | DataLink
160
+ }
161
+ }
162
+ events?: BrickBasicEvents & {
163
+ /* Event of error occurred */
164
+ onError?: Array<EventAction>
165
+ /* Event of object changed position or rotation */
166
+ onChange?: Array<EventAction>
167
+ /* Event of object selected */
168
+ onSelectChange?: Array<EventAction>
169
+ /* Event of object collision occurred */
170
+ onCollision?: Array<EventAction>
171
+ }
172
+ animation?: AnimationBasicEvents & {
173
+ onError?: Animation
174
+ onChange?: Animation
175
+ onSelectChange?: Animation
176
+ onCollision?: Animation
177
+ }
178
+ }
179
+
180
+ /* 3D viewer brick */
181
+ export type Brick3DViewer = Brick &
182
+ Brick3DViewerDef & {
183
+ templateKey: 'BRICK_3D_VIEWER'
184
+ switches: Array<
185
+ SwitchDef &
186
+ Brick3DViewerDef & {
187
+ conds?: Array<{
188
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
189
+ cond:
190
+ | SwitchCondInnerStateCurrentCanvas
191
+ | SwitchCondData
192
+ | {
193
+ __typename: 'SwitchCondInnerStateOutlet'
194
+ outlet: ''
195
+ value: any
196
+ }
197
+ }>
198
+ }
199
+ >
200
+ }