@fugood/bricks-project 2.25.0-beta.0 → 2.25.0-beta.3

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.
@@ -327,6 +327,29 @@ export const templateActionNameMap = {
327
327
  animated: 'BRICK_MAPS_ANIMATED',
328
328
  },
329
329
  },
330
+ BRICK_SKETCH: {
331
+ BRICK_SKETCH_SET_TOOL: {
332
+ tool: 'BRICK_SKETCH_TOOL',
333
+ },
334
+ BRICK_SKETCH_SET_COLOR: {
335
+ color: 'BRICK_SKETCH_COLOR',
336
+ },
337
+ BRICK_SKETCH_SET_STROKE_WIDTH: {
338
+ strokeWidth: 'BRICK_SKETCH_STROKE_WIDTH',
339
+ },
340
+ BRICK_SKETCH_IMPORT_STATE: {
341
+ stateJson: 'BRICK_SKETCH_STATE_JSON',
342
+ },
343
+ BRICK_SKETCH_EXPORT_IMAGE: {
344
+ imageFormat: 'BRICK_SKETCH_IMAGE_FORMAT',
345
+ imageQuality: 'BRICK_SKETCH_IMAGE_QUALITY',
346
+ },
347
+ BRICK_SKETCH_ADD_STROKE: {
348
+ strokePoints: 'BRICK_SKETCH_STROKE_POINTS',
349
+ strokeColor: 'BRICK_SKETCH_STROKE_COLOR',
350
+ strokeWidth: 'BRICK_SKETCH_STROKE_WIDTH',
351
+ },
352
+ },
330
353
 
331
354
  GENERATOR_FILE: {
332
355
  GENERATOR_FILE_READ_CONTENT: {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.25.0-beta.0",
3
+ "version": "2.25.0-beta.3",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "typecheck": "tsc --noEmit",
7
7
  "build": "bun scripts/build.js"
8
8
  },
9
9
  "dependencies": {
10
- "@fugood/bricks-cli": "^2.25.0-beta.0",
10
+ "@fugood/bricks-cli": "^2.25.0-beta.3",
11
11
  "@huggingface/gguf": "^0.3.2",
12
12
  "@iarna/toml": "^3.0.0",
13
13
  "@modelcontextprotocol/sdk": "^1.15.0",
package/package.json.bak CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@fugood/bricks-ctor",
3
- "version": "2.25.0-beta.0",
3
+ "version": "2.25.0-beta.3",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "typecheck": "tsc --noEmit",
7
7
  "build": "bun scripts/build.js"
8
8
  },
9
9
  "dependencies": {
10
- "@fugood/bricks-cli": "^2.25.0-beta.0",
10
+ "@fugood/bricks-cli": "^2.25.0-beta.3",
11
11
  "@huggingface/gguf": "^0.3.2",
12
12
  "@iarna/toml": "^3.0.0",
13
13
  "@modelcontextprotocol/sdk": "^1.15.0",
@@ -0,0 +1,252 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Drawing canvas with Apple Pencil support, undo/redo, import/export state, and image export
4
+ */
5
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
+ import type { Data, DataLink } from '../data'
7
+ import type { Animation, AnimationBasicEvents } 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
+ /* Undo the last stroke */
21
+ export type BrickSketchActionUndo = Action & {
22
+ __actionName: 'BRICK_SKETCH_UNDO'
23
+ }
24
+
25
+ /* Redo the last undone stroke */
26
+ export type BrickSketchActionRedo = Action & {
27
+ __actionName: 'BRICK_SKETCH_REDO'
28
+ }
29
+
30
+ /* Clear all strokes from the canvas */
31
+ export type BrickSketchActionClear = Action & {
32
+ __actionName: 'BRICK_SKETCH_CLEAR'
33
+ }
34
+
35
+ /* Set the active tool */
36
+ export type BrickSketchActionSetTool = ActionWithParams & {
37
+ __actionName: 'BRICK_SKETCH_SET_TOOL'
38
+ params?: Array<{
39
+ input: 'tool'
40
+ value?: 'pen' | 'eraser' | DataLink | EventProperty
41
+ mapping?: string
42
+ }>
43
+ }
44
+
45
+ /* Set the stroke color */
46
+ export type BrickSketchActionSetColor = ActionWithParams & {
47
+ __actionName: 'BRICK_SKETCH_SET_COLOR'
48
+ params?: Array<{
49
+ input: 'color'
50
+ value?: string | DataLink | EventProperty
51
+ mapping?: string
52
+ }>
53
+ }
54
+
55
+ /* Set the stroke width (px) */
56
+ export type BrickSketchActionSetStrokeWidth = ActionWithParams & {
57
+ __actionName: 'BRICK_SKETCH_SET_STROKE_WIDTH'
58
+ params?: Array<{
59
+ input: 'strokeWidth'
60
+ value?: number | DataLink | EventProperty
61
+ mapping?: string
62
+ }>
63
+ }
64
+
65
+ /* Import sketch state (JSON string from a previous export) */
66
+ export type BrickSketchActionImportState = ActionWithParams & {
67
+ __actionName: 'BRICK_SKETCH_IMPORT_STATE'
68
+ params?: Array<{
69
+ input: 'stateJson'
70
+ value?: string | DataLink | EventProperty
71
+ mapping?: string
72
+ }>
73
+ }
74
+
75
+ /* Export the current sketch state to the BRICK_SKETCH_STATE outlet */
76
+ export type BrickSketchActionExportState = Action & {
77
+ __actionName: 'BRICK_SKETCH_EXPORT_STATE'
78
+ }
79
+
80
+ /* Export the canvas as an image (file URI emitted to BRICK_SKETCH_IMAGE_URI) */
81
+ export type BrickSketchActionExportImage = ActionWithParams & {
82
+ __actionName: 'BRICK_SKETCH_EXPORT_IMAGE'
83
+ params?: Array<
84
+ | {
85
+ input: 'imageFormat'
86
+ value?: 'png' | 'jpeg' | DataLink | EventProperty
87
+ mapping?: string
88
+ }
89
+ | {
90
+ input: 'imageQuality'
91
+ value?: number | DataLink | EventProperty
92
+ mapping?: string
93
+ }
94
+ >
95
+ }
96
+
97
+ /* Add a stroke programmatically */
98
+ export type BrickSketchActionAddStroke = ActionWithParams & {
99
+ __actionName: 'BRICK_SKETCH_ADD_STROKE'
100
+ params?: Array<
101
+ | {
102
+ input: 'strokePoints'
103
+ value?: any | EventProperty
104
+ mapping?: string
105
+ }
106
+ | {
107
+ input: 'strokeColor'
108
+ value?: string | DataLink | EventProperty
109
+ mapping?: string
110
+ }
111
+ | {
112
+ input: 'strokeWidth'
113
+ value?: number | DataLink | EventProperty
114
+ mapping?: string
115
+ }
116
+ >
117
+ }
118
+
119
+ interface BrickSketchDef {
120
+ /*
121
+ Default property:
122
+ {
123
+ "tool": "pen",
124
+ "strokeColor": "#000000",
125
+ "strokeWidth": 3,
126
+ "pressureSensitive": true,
127
+ "layoutType": "cover",
128
+ "scale": 1,
129
+ "mode": "pen",
130
+ "theme": "auto",
131
+ "backgroundPattern": "dot",
132
+ "hideToolbar": false,
133
+ "hideUndo": false,
134
+ "hideRedo": false,
135
+ "hidePencilTool": false,
136
+ "hideColorPicker": false,
137
+ "hideThickness": false,
138
+ "availableColors": [
139
+ "#000000",
140
+ "#ffffff",
141
+ "#e53935",
142
+ "#fb8c00",
143
+ "#fdd835",
144
+ "#43a047",
145
+ "#1e88e5",
146
+ "#8e24aa"
147
+ ]
148
+ }
149
+ */
150
+ property?: BrickBasicProperty & {
151
+ /* Drawing tool */
152
+ tool?: 'pen' | 'eraser' | DataLink
153
+ /* Stroke color */
154
+ strokeColor?: string | DataLink
155
+ /* Stroke width (px) */
156
+ strokeWidth?: number | DataLink
157
+ /* Vary stroke width by pen pressure (Apple Pencil / 3D Touch) */
158
+ pressureSensitive?: boolean | DataLink
159
+ /* Canvas layout. `cover` fits the brick frame; `extend` lets the canvas grow with content */
160
+ layoutType?: 'cover' | 'extend' | DataLink
161
+ /* Canvas resolution scale (device-pixel multiplier) */
162
+ scale?: number | DataLink
163
+ /* Interaction mode. `pen` = drawing (scroll disabled), `scroll` = scroll/pan (drawing disabled) */
164
+ mode?: 'pen' | 'scroll' | DataLink
165
+ /* Toolbar/UI theme. `auto` follows the system color scheme; `light`/`dark` force the palette. */
166
+ theme?: 'auto' | 'light' | 'dark' | DataLink
167
+ /* Background color of the canvas */
168
+ backgroundColor?: string | DataLink
169
+ /* Background image URL (covers the canvas; rendered behind strokes) */
170
+ backgroundImage?: string | DataLink
171
+ /* Decorative background pattern when no background image is provided */
172
+ backgroundPattern?: 'dot' | 'grid' | 'none' | DataLink
173
+ /* Hide the entire built-in toolbar */
174
+ hideToolbar?: boolean | DataLink
175
+ /* Hide the undo button in the toolbar */
176
+ hideUndo?: boolean | DataLink
177
+ /* Hide the redo button in the toolbar */
178
+ hideRedo?: boolean | DataLink
179
+ /* Hide the pen/eraser tool toggle */
180
+ hidePencilTool?: boolean | DataLink
181
+ /* Hide the color picker */
182
+ hideColorPicker?: boolean | DataLink
183
+ /* Hide the stroke thickness slider */
184
+ hideThickness?: boolean | DataLink
185
+ /* Colors shown in the built-in color picker */
186
+ availableColors?: Array<string | DataLink> | DataLink
187
+ }
188
+ events?: BrickBasicEvents & {
189
+ /* A stroke was just committed (drawn or added programmatically) */
190
+ onStrokeEnd?: Array<EventAction<string & keyof TemplateEventPropsMap['Sketch']['onStrokeEnd']>>
191
+ /* The canvas was cleared */
192
+ onClear?: Array<EventAction>
193
+ /* Sketch state changed (any commit, undo, redo, clear, or import) */
194
+ onStateChange?: Array<EventAction>
195
+ /* Active tool changed */
196
+ onToolChange?: Array<
197
+ EventAction<string & keyof TemplateEventPropsMap['Sketch']['onToolChange']>
198
+ >
199
+ /* Image export finished */
200
+ onExportImage?: Array<
201
+ EventAction<string & keyof TemplateEventPropsMap['Sketch']['onExportImage']>
202
+ >
203
+ }
204
+ outlets?: {
205
+ /* Current sketch state (strokes, settings, undo/redo stacks) */
206
+ state?: () => Data<{
207
+ strokes?: any[]
208
+ undone?: any[]
209
+ settings?: { [key: string]: any }
210
+ [key: string]: any
211
+ }>
212
+ /* URI of the most recently exported image */
213
+ imageUri?: () => Data<string>
214
+ /* Most recently committed stroke (points, color, width) */
215
+ lastStroke?: () => Data<{
216
+ color?: string
217
+ width?: number
218
+ tool?: string
219
+ points?: any[]
220
+ [key: string]: any
221
+ }>
222
+ }
223
+ animation?: AnimationBasicEvents & {
224
+ onStrokeEnd?: Animation
225
+ onClear?: Animation
226
+ onStateChange?: Animation
227
+ onToolChange?: Animation
228
+ onExportImage?: Animation
229
+ }
230
+ }
231
+
232
+ /* Drawing canvas with Apple Pencil support, undo/redo, import/export state, and image export */
233
+ export type BrickSketch = Brick &
234
+ BrickSketchDef & {
235
+ templateKey: 'BRICK_SKETCH'
236
+ switches?: Array<
237
+ SwitchDef &
238
+ BrickSketchDef & {
239
+ conds?: Array<{
240
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
241
+ cond:
242
+ | SwitchCondInnerStateCurrentCanvas
243
+ | SwitchCondData
244
+ | {
245
+ __typename: 'SwitchCondInnerStateOutlet'
246
+ outlet: 'state' | 'imageUri' | 'lastStroke'
247
+ value: any
248
+ }
249
+ }>
250
+ }
251
+ >
252
+ }
@@ -19,3 +19,4 @@ export * from './Camera'
19
19
  export * from './WebRtcStream'
20
20
  export * from './GenerativeMedia'
21
21
  export * from './Maps'
22
+ export * from './Sketch'
@@ -174,6 +174,7 @@ Default property:
174
174
  isCapturing?: boolean
175
175
  data?: {
176
176
  result?: string
177
+ language?: string
177
178
  [key: string]: any
178
179
  }
179
180
  vadEvent?: {
@@ -215,6 +216,7 @@ Default property:
215
216
  isCapturing?: boolean
216
217
  data?: {
217
218
  result?: string
219
+ language?: string
218
220
  [key: string]: any
219
221
  }
220
222
  vadEvent?: {
@@ -238,6 +240,10 @@ Default property:
238
240
  }>
239
241
  /* Stabilized transcription text from completed slices */
240
242
  stabilizedText?: () => Data<string>
243
+ /* Latest detected language code (e.g. `en`, `zh`, `ja`) from any transcribe slice (best-effort, may flicker on short slices) */
244
+ detectedLanguage?: () => Data<string>
245
+ /* Detected language code of the most recently stabilized (finalized) slice */
246
+ stabilizedLanguage?: () => Data<string>
241
247
  /* Audio output file path (auto-generated when saving audio) */
242
248
  audioOutputPath?: () => Data<string>
243
249
  /* Available microphone devices (Web / Desktop only) */
@@ -269,6 +275,8 @@ export type GeneratorRealtimeTranscription = Generator &
269
275
  | 'lastTranscribeEvent'
270
276
  | 'lastVadEvent'
271
277
  | 'stabilizedText'
278
+ | 'detectedLanguage'
279
+ | 'stabilizedLanguage'
272
280
  | 'audioOutputPath'
273
281
  | 'devices'
274
282
  value: any
@@ -358,9 +358,12 @@ Default property:
358
358
  transcribeProgress?: () => Data<number>
359
359
  /* Inference result */
360
360
  transcribeResult?: () => Data<string>
361
+ /* Detected language code of the latest transcription (e.g. `en`, `zh`, `ja`) */
362
+ detectedLanguage?: () => Data<string>
361
363
  /* Inference result details */
362
364
  transcribeDetails?: () => Data<{
363
365
  result?: string
366
+ language?: string
364
367
  segments?: Array<{
365
368
  start?: number
366
369
  end?: number
@@ -405,6 +408,7 @@ export type GeneratorSpeechInference = Generator &
405
408
  | 'isTranscribing'
406
409
  | 'transcribeProgress'
407
410
  | 'transcribeResult'
411
+ | 'detectedLanguage'
408
412
  | 'transcribeDetails'
409
413
  | 'recordedPath'
410
414
  value: any
@@ -141,6 +141,11 @@ export const templateEventPropsMap = {
141
141
  BRICK_MAPS_REGION_LONGITUDE_DELTA: 'number',
142
142
  },
143
143
  },
144
+ Sketch: {
145
+ onStrokeEnd: { BRICK_SKETCH_STROKE_COUNT: 'number' },
146
+ onToolChange: { BRICK_SKETCH_TOOL: 'string' },
147
+ onExportImage: { BRICK_SKETCH_IMAGE_URI: 'string' },
148
+ },
144
149
  Tick: {
145
150
  ticking: { GENERATOR_TICK_COUNTDOWN: 'number', GENERATOR_TICK_VALUE: 'any' },
146
151
  completed: { GENERATOR_TICK_COUNTDOWN: 'number', GENERATOR_TICK_VALUE: 'any' },
@@ -598,6 +603,7 @@ export const templateEventPropsMap = {
598
603
  onError: { GENERATOR_SPEECH_INFERENCE_ERROR: 'string' },
599
604
  onTranscribed: {
600
605
  GENERATOR_SPEECH_INFERENCE_TRANSCRIBE_RESULT: 'string',
606
+ GENERATOR_SPEECH_INFERENCE_TRANSCRIBE_LANGUAGE: 'string',
601
607
  GENERATOR_SPEECH_INFERENCE_TRANSCRIBE_START_TIME: 'number',
602
608
  GENERATOR_SPEECH_INFERENCE_TRANSCRIBE_END_TIME: 'number',
603
609
  GENERATOR_SPEECH_INFERENCE_TRANSCRIBE_TIME: 'number',
@@ -619,10 +625,11 @@ export const templateEventPropsMap = {
619
625
  RealtimeTranscription: {
620
626
  onTranscribe: {
621
627
  GENERATOR_REALTIME_TRANSCRIPTION_TRANSCRIBE_EVENT:
622
- '{ type?: string sliceIndex?: number isCapturing?: boolean data?: { result?: string [key: string]: any } vadEvent?: { type?: string confidence?: number duration?: number sliceIndex?: number timestamp?: number [key: string]: any } [key: string]: any }',
628
+ '{ type?: string sliceIndex?: number isCapturing?: boolean data?: { result?: string language?: string [key: string]: any } vadEvent?: { type?: string confidence?: number duration?: number sliceIndex?: number timestamp?: number [key: string]: any } [key: string]: any }',
623
629
  GENERATOR_REALTIME_TRANSCRIPTION_TRANSCRIBE_TYPE: 'string',
624
630
  GENERATOR_REALTIME_TRANSCRIPTION_TRANSCRIBE_SLICE_INDEX: 'number',
625
631
  GENERATOR_REALTIME_TRANSCRIPTION_TRANSCRIBE_RESULT_TEXT: 'string',
632
+ GENERATOR_REALTIME_TRANSCRIPTION_TRANSCRIBE_LANGUAGE: 'string',
626
633
  GENERATOR_REALTIME_TRANSCRIPTION_TRANSCRIBE_IS_CAPTURING: 'boolean',
627
634
  GENERATOR_REALTIME_TRANSCRIPTION_VAD_EVENT:
628
635
  '{ type?: string confidence?: number duration?: number sliceIndex?: number timestamp?: number [key: string]: any }',
@@ -644,10 +651,13 @@ export const templateEventPropsMap = {
644
651
  GENERATOR_REALTIME_TRANSCRIPTION_STATS:
645
652
  '{ type?: string timestamp?: number data?: { [key: string]: any } [key: string]: any }',
646
653
  },
647
- onStabilized: { GENERATOR_REALTIME_TRANSCRIPTION_STABILIZED_TEXT: 'string' },
654
+ onStabilized: {
655
+ GENERATOR_REALTIME_TRANSCRIPTION_STABILIZED_TEXT: 'string',
656
+ GENERATOR_REALTIME_TRANSCRIPTION_STABILIZED_LANGUAGE: 'string',
657
+ },
648
658
  onEnd: {
649
659
  GENERATOR_REALTIME_TRANSCRIPTION_END_RESULTS:
650
- 'Array<{ transcribeEvent?: { type?: string sliceIndex?: number isCapturing?: boolean data?: { result?: string [key: string]: any } vadEvent?: { type?: string confidence?: number duration?: number sliceIndex?: number timestamp?: number [key: string]: any } [key: string]: any } vadEvent?: { type?: string confidence?: number duration?: number sliceIndex?: number timestamp?: number [key: string]: any } [key: string]: any }>',
660
+ 'Array<{ transcribeEvent?: { type?: string sliceIndex?: number isCapturing?: boolean data?: { result?: string language?: string [key: string]: any } vadEvent?: { type?: string confidence?: number duration?: number sliceIndex?: number timestamp?: number [key: string]: any } [key: string]: any } vadEvent?: { type?: string confidence?: number duration?: number sliceIndex?: number timestamp?: number [key: string]: any } [key: string]: any }>',
651
661
  GENERATOR_REALTIME_TRANSCRIPTION_END_AUDIO_OUTPUT_PATH: 'string',
652
662
  },
653
663
  },