@fugood/bricks-ctor 2.24.1 → 2.24.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.
- package/compile/action-name-map.ts +23 -0
- package/compile/index.ts +193 -13
- package/package.json +3 -4
- package/skills/bricks-ctor/rules/animation.md +3 -2
- package/skills/bricks-ctor/rules/buttress.md +97 -8
- package/tools/icons/fa6pro-meta.json +1 -3671
- package/tools/mcp-tools/icons.ts +12 -1
- package/tools/preview-main.mjs +18 -5
- package/tools/update-config.ts +110 -0
- package/types/animation.ts +16 -5
- package/types/bricks/Image.ts +12 -0
- package/types/bricks/Sketch.ts +254 -0
- package/types/bricks/index.ts +1 -0
- package/types/data.ts +1 -1
- package/types/generators/LlmGgml.ts +1 -0
- package/types/generators/LlmMlx.ts +1 -0
- package/types/generators/RealtimeTranscription.ts +8 -0
- package/types/generators/SpeechToTextGgml.ts +5 -0
- package/types/subspace.ts +1 -1
- package/utils/data.ts +1 -1
- package/utils/event-props.ts +13 -3
package/tools/mcp-tools/icons.ts
CHANGED
|
@@ -17,7 +17,18 @@ const STYLE_BITS: Record<IconStyle, number> = {
|
|
|
17
17
|
duotone: 256,
|
|
18
18
|
}
|
|
19
19
|
const ALL_STYLES = Object.keys(STYLE_BITS) as IconStyle[]
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
// Metadata is shipped as { bitmaskValue: [iconName, ...] } with the dominant
|
|
22
|
+
// 510 (all non-brand families) omitted. Expand to a flat lookup once.
|
|
23
|
+
const DEFAULT_BITMASK = 510
|
|
24
|
+
const compactMeta = glyphmapMeta as Record<string, string[]>
|
|
25
|
+
const iconMeta: Record<string, number> = {}
|
|
26
|
+
for (const name of Object.keys(glyphmap)) iconMeta[name] = DEFAULT_BITMASK
|
|
27
|
+
for (const bitmaskKey of Object.keys(compactMeta)) {
|
|
28
|
+
const value = Number(bitmaskKey)
|
|
29
|
+
const names = compactMeta[bitmaskKey]
|
|
30
|
+
for (const name of names) iconMeta[name] = value
|
|
31
|
+
}
|
|
21
32
|
|
|
22
33
|
const iconList = Object.entries(glyphmap as Record<string, number>).map(([name, code]) => {
|
|
23
34
|
const bits = iconMeta[name] || 0
|
package/tools/preview-main.mjs
CHANGED
|
@@ -6,6 +6,12 @@ import { createServer } from 'http'
|
|
|
6
6
|
import { parseArgs } from 'util'
|
|
7
7
|
import * as TOON from '@toon-format/toon'
|
|
8
8
|
|
|
9
|
+
for (const stream of [process.stdout, process.stderr]) {
|
|
10
|
+
stream.on('error', (err) => {
|
|
11
|
+
if (err.code !== 'EPIPE') throw err
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
const { values } = parseArgs({
|
|
10
16
|
args: process.argv,
|
|
11
17
|
options: {
|
|
@@ -224,16 +230,23 @@ app.on('ready', () => {
|
|
|
224
230
|
)
|
|
225
231
|
if (takeScreenshotConfig) {
|
|
226
232
|
const { delay, width, height, path } = takeScreenshotConfig
|
|
227
|
-
setTimeout(() => {
|
|
233
|
+
setTimeout(async () => {
|
|
234
|
+
let screenshotFailed = false
|
|
228
235
|
console.log('Taking screenshot')
|
|
229
|
-
|
|
236
|
+
try {
|
|
237
|
+
const image = await mainWindow.webContents.capturePage()
|
|
230
238
|
console.log('Writing screenshot to', path)
|
|
231
|
-
writeFile(path, image.resize({ width, height }).toJPEG(75))
|
|
239
|
+
await writeFile(path, image.resize({ width, height }).toJPEG(75))
|
|
240
|
+
} catch (err) {
|
|
241
|
+
screenshotFailed = true
|
|
242
|
+
console.error('Screenshot capture/write failed', err)
|
|
243
|
+
} finally {
|
|
232
244
|
if (noKeepOpen) {
|
|
233
245
|
console.log('Closing app')
|
|
234
|
-
app.
|
|
246
|
+
if (screenshotFailed) app.exit(1)
|
|
247
|
+
else app.quit()
|
|
235
248
|
}
|
|
236
|
-
}
|
|
249
|
+
}
|
|
237
250
|
}, delay)
|
|
238
251
|
}
|
|
239
252
|
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises'
|
|
2
|
+
import { parseArgs } from 'util'
|
|
3
|
+
import { sh } from './_shell'
|
|
4
|
+
import { buildCommitArgs } from './_git-author'
|
|
5
|
+
|
|
6
|
+
const cwd = process.cwd()
|
|
7
|
+
|
|
8
|
+
const readJson = async (p: string) => JSON.parse(await readFile(p, 'utf8'))
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
values: { 'auto-commit': autoCommit, 'no-check': noCheck, 'no-validate': noValidate, yes, help },
|
|
12
|
+
} = parseArgs({
|
|
13
|
+
args: process.argv.slice(2),
|
|
14
|
+
options: {
|
|
15
|
+
'auto-commit': { type: 'boolean' },
|
|
16
|
+
'no-check': { type: 'boolean' },
|
|
17
|
+
'no-validate': { type: 'boolean' },
|
|
18
|
+
yes: { type: 'boolean', short: 'y' },
|
|
19
|
+
help: { type: 'boolean', short: 'h' },
|
|
20
|
+
},
|
|
21
|
+
allowPositionals: true,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
if (help) {
|
|
25
|
+
console.log(`Push compiled config to BRICKS without creating a release.
|
|
26
|
+
|
|
27
|
+
Options:
|
|
28
|
+
--auto-commit Auto-commit unstaged changes before pushing
|
|
29
|
+
--no-check Skip the conflict guard (don't pass --last-commit-id)
|
|
30
|
+
--no-validate Skip server-side config schema validation
|
|
31
|
+
-y, --yes Skip all prompts
|
|
32
|
+
-h, --help Show this help message`)
|
|
33
|
+
process.exit(0)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Detect git repo (mirrors deploy.ts)
|
|
37
|
+
const { exitCode } = await sh`cd ${cwd} && git status`.quiet().nothrow()
|
|
38
|
+
const isGitRepo = exitCode === 0
|
|
39
|
+
|
|
40
|
+
if (!isGitRepo && !yes) {
|
|
41
|
+
const confirmContinue = prompt('No git repository found, continue? (y/n)')
|
|
42
|
+
if (confirmContinue !== 'y') throw new Error('Update cancelled')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Read application.json + compiled config
|
|
46
|
+
const app = await readJson(`${cwd}/application.json`)
|
|
47
|
+
const config = await readJson(`${cwd}/.bricks/build/application-config.json`)
|
|
48
|
+
|
|
49
|
+
// Handle unstaged changes the same way deploy.ts does.
|
|
50
|
+
let commitId = ''
|
|
51
|
+
let parentCommitId = ''
|
|
52
|
+
if (isGitRepo) {
|
|
53
|
+
const unstagedChanges = await sh`cd ${cwd} && git diff --name-only --diff-filter=ACMR`.text()
|
|
54
|
+
if (unstagedChanges) {
|
|
55
|
+
if (autoCommit) {
|
|
56
|
+
// Capture the pre-commit HEAD so we can use it as the conflict-check
|
|
57
|
+
// baseline (the server should still hold it from the prior deploy).
|
|
58
|
+
parentCommitId = (await sh`cd ${cwd} && git rev-parse HEAD`.nothrow().text()).trim()
|
|
59
|
+
await sh`cd ${cwd} && git add -A`
|
|
60
|
+
const commitArgs = await buildCommitArgs(cwd, ['chore: update bricks config'])
|
|
61
|
+
await sh`cd ${cwd} && git ${commitArgs}`
|
|
62
|
+
} else {
|
|
63
|
+
throw new Error('Unstaged changes found, please commit or stash your changes before updating')
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
commitId = (await sh`cd ${cwd} && git rev-parse HEAD`.text()).trim()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Auto-derive --last-commit-id for the server-side conflict guard.
|
|
70
|
+
// - parent of the auto-commit (server still holds it from the prior deploy)
|
|
71
|
+
// - current HEAD (clean tree — server should be at the same commit too)
|
|
72
|
+
let lastCommitId: string | undefined
|
|
73
|
+
if (!noCheck) {
|
|
74
|
+
if (parentCommitId) lastCommitId = parentCommitId
|
|
75
|
+
else if (commitId) lastCommitId = commitId
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!yes) {
|
|
79
|
+
const confirm = prompt('Are you sure you want to push the new config? (y/n)')
|
|
80
|
+
if (confirm !== 'y') throw new Error('Update cancelled')
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const isModule = app.type === 'module'
|
|
84
|
+
const command = isModule ? 'module' : 'app'
|
|
85
|
+
|
|
86
|
+
const updateConfig = {
|
|
87
|
+
...config,
|
|
88
|
+
bricks_project_last_commit_id: commitId || undefined,
|
|
89
|
+
}
|
|
90
|
+
const configPath = `${cwd}/.bricks/build/update-config.json`
|
|
91
|
+
await writeFile(configPath, JSON.stringify(updateConfig))
|
|
92
|
+
|
|
93
|
+
const args = ['bricks', command, 'update', app.id, '-f', configPath, '--json']
|
|
94
|
+
if (noValidate) args.push('--no-validate')
|
|
95
|
+
if (lastCommitId) args.push('--last-commit-id', lastCommitId)
|
|
96
|
+
|
|
97
|
+
const result = await sh`${args}`.quiet().nothrow()
|
|
98
|
+
|
|
99
|
+
if (result.exitCode !== 0) {
|
|
100
|
+
const output = result.stderr.toString() || result.stdout.toString()
|
|
101
|
+
try {
|
|
102
|
+
const json = JSON.parse(output)
|
|
103
|
+
throw new Error(json.error?.message || json.error || 'Update failed')
|
|
104
|
+
} catch {
|
|
105
|
+
throw new Error(output || 'Update failed')
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const output = JSON.parse(result.stdout.toString())
|
|
110
|
+
console.log(`${isModule ? 'Module' : 'App'} config updated: ${output.target?.name || app.name}`)
|
package/types/animation.ts
CHANGED
|
@@ -44,10 +44,21 @@ export interface AnimationTimingConfig {
|
|
|
44
44
|
export interface AnimationSpringConfig {
|
|
45
45
|
__type: 'AnimationSpringConfig'
|
|
46
46
|
toValue: number // BRICKS Grid unit
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
// Use one spring parameter family: tension/friction, speed/bounciness,
|
|
48
|
+
// or stiffness/damping/mass.
|
|
49
|
+
friction?: number
|
|
50
|
+
tension?: number
|
|
51
|
+
speed?: number
|
|
52
|
+
bounciness?: number
|
|
53
|
+
stiffness?: number
|
|
54
|
+
damping?: number
|
|
55
|
+
mass?: number
|
|
56
|
+
velocity?: number
|
|
57
|
+
delay?: number
|
|
58
|
+
isInteraction?: boolean
|
|
59
|
+
overshootClamping?: boolean
|
|
60
|
+
restDisplacementThreshold?: number
|
|
61
|
+
restSpeedThreshold?: number
|
|
51
62
|
}
|
|
52
63
|
|
|
53
64
|
export interface AnimationDecayConfig {
|
|
@@ -62,7 +73,7 @@ export interface AnimationDef {
|
|
|
62
73
|
__typename: 'Animation'
|
|
63
74
|
id: string
|
|
64
75
|
alias?: string
|
|
65
|
-
title
|
|
76
|
+
title?: string
|
|
66
77
|
description?: string
|
|
67
78
|
hideShortRef?: boolean
|
|
68
79
|
runType?: 'once' | 'loop'
|
package/types/bricks/Image.ts
CHANGED
|
@@ -25,6 +25,10 @@ Default property:
|
|
|
25
25
|
"templateType": "${}",
|
|
26
26
|
"fadeDuration": 0,
|
|
27
27
|
"blurBackgroundRadius": 8,
|
|
28
|
+
"imageFilterEnabled": false,
|
|
29
|
+
"imageFilterBlur": 0,
|
|
30
|
+
"imageFilterBlurMode": "clamp",
|
|
31
|
+
"imageFilterColorMatrix": [],
|
|
28
32
|
"loadSystemIos": "auto",
|
|
29
33
|
"loadSystemAndroid": "auto"
|
|
30
34
|
}
|
|
@@ -50,6 +54,14 @@ Default property:
|
|
|
50
54
|
enableBlurBackground?: boolean | DataLink
|
|
51
55
|
/* The blur radius of the blur filter added to the image background */
|
|
52
56
|
blurBackgroundRadius?: number | DataLink
|
|
57
|
+
/* Enable Skia image filters. When disabled, Image uses the normal platform image renderer. */
|
|
58
|
+
imageFilterEnabled?: boolean | DataLink
|
|
59
|
+
/* Blur amount for the Skia image filter. */
|
|
60
|
+
imageFilterBlur?: number | DataLink
|
|
61
|
+
/* Tile mode for the Skia blur image filter. */
|
|
62
|
+
imageFilterBlurMode?: 'clamp' | 'decal' | 'repeat' | 'mirror' | DataLink
|
|
63
|
+
/* Optional 4x5 color matrix for the Skia image filter. Provide 20 numbers. */
|
|
64
|
+
imageFilterColorMatrix?: Array<number | DataLink> | DataLink
|
|
53
65
|
/* [iOS] The use priority of image loading system (Auto: sdwebimage, fallback to default if failed) */
|
|
54
66
|
loadSystemIos?: 'auto' | 'sdwebimage' | 'default' | DataLink
|
|
55
67
|
/* [Android] The use priority of image loading system (Auto: glide, fallback to fresco if failed) */
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/* Auto generated by build script
|
|
2
|
+
*
|
|
3
|
+
* Drawing canvas with 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
|
+
/* Initial sketch state to load on mount (object or JSON string from a previous export). When `BRICK_SKETCH_STATE` outlet feeds the same value back via binding, the echo is detected and ignored to avoid an update loop. */
|
|
152
|
+
initialState?: string | DataLink | DataLink | {} | DataLink
|
|
153
|
+
/* Drawing tool */
|
|
154
|
+
tool?: 'pen' | 'eraser' | DataLink
|
|
155
|
+
/* Stroke color */
|
|
156
|
+
strokeColor?: string | DataLink
|
|
157
|
+
/* Stroke width (px) */
|
|
158
|
+
strokeWidth?: number | DataLink
|
|
159
|
+
/* Vary stroke width by pen pressure */
|
|
160
|
+
pressureSensitive?: boolean | DataLink
|
|
161
|
+
/* Canvas layout. `cover` fits the brick frame; `extend` lets the canvas grow with content */
|
|
162
|
+
layoutType?: 'cover' | 'extend' | DataLink
|
|
163
|
+
/* Canvas resolution scale (device-pixel multiplier) */
|
|
164
|
+
scale?: number | DataLink
|
|
165
|
+
/* Interaction mode. `pen` = drawing (scroll disabled), `scroll` = scroll/pan (drawing disabled) */
|
|
166
|
+
mode?: 'pen' | 'scroll' | DataLink
|
|
167
|
+
/* Toolbar/UI theme. `auto` follows the system color scheme; `light`/`dark` force the palette. */
|
|
168
|
+
theme?: 'auto' | 'light' | 'dark' | DataLink
|
|
169
|
+
/* Background color of the canvas */
|
|
170
|
+
backgroundColor?: string | DataLink
|
|
171
|
+
/* Background image URL (covers the canvas; rendered behind strokes) */
|
|
172
|
+
backgroundImage?: string | DataLink
|
|
173
|
+
/* Decorative background pattern when no background image is provided */
|
|
174
|
+
backgroundPattern?: 'dot' | 'grid' | 'none' | DataLink
|
|
175
|
+
/* Hide the entire built-in toolbar */
|
|
176
|
+
hideToolbar?: boolean | DataLink
|
|
177
|
+
/* Hide the undo button in the toolbar */
|
|
178
|
+
hideUndo?: boolean | DataLink
|
|
179
|
+
/* Hide the redo button in the toolbar */
|
|
180
|
+
hideRedo?: boolean | DataLink
|
|
181
|
+
/* Hide the pen/eraser tool toggle */
|
|
182
|
+
hidePencilTool?: boolean | DataLink
|
|
183
|
+
/* Hide the color picker */
|
|
184
|
+
hideColorPicker?: boolean | DataLink
|
|
185
|
+
/* Hide the stroke thickness slider */
|
|
186
|
+
hideThickness?: boolean | DataLink
|
|
187
|
+
/* Colors shown in the built-in color picker */
|
|
188
|
+
availableColors?: Array<string | DataLink> | DataLink
|
|
189
|
+
}
|
|
190
|
+
events?: BrickBasicEvents & {
|
|
191
|
+
/* A stroke was just committed (drawn or added programmatically) */
|
|
192
|
+
onStrokeEnd?: Array<EventAction<string & keyof TemplateEventPropsMap['Sketch']['onStrokeEnd']>>
|
|
193
|
+
/* The canvas was cleared */
|
|
194
|
+
onClear?: Array<EventAction>
|
|
195
|
+
/* Sketch state changed (any commit, undo, redo, clear, or import) */
|
|
196
|
+
onStateChange?: Array<EventAction>
|
|
197
|
+
/* Active tool changed */
|
|
198
|
+
onToolChange?: Array<
|
|
199
|
+
EventAction<string & keyof TemplateEventPropsMap['Sketch']['onToolChange']>
|
|
200
|
+
>
|
|
201
|
+
/* Image export finished */
|
|
202
|
+
onExportImage?: Array<
|
|
203
|
+
EventAction<string & keyof TemplateEventPropsMap['Sketch']['onExportImage']>
|
|
204
|
+
>
|
|
205
|
+
}
|
|
206
|
+
outlets?: {
|
|
207
|
+
/* Current sketch state (strokes, settings, undo/redo stacks) */
|
|
208
|
+
state?: () => Data<{
|
|
209
|
+
strokes?: any[]
|
|
210
|
+
undone?: any[]
|
|
211
|
+
settings?: { [key: string]: any }
|
|
212
|
+
[key: string]: any
|
|
213
|
+
}>
|
|
214
|
+
/* URI of the most recently exported image */
|
|
215
|
+
imageUri?: () => Data<string>
|
|
216
|
+
/* Most recently committed stroke (points, color, width) */
|
|
217
|
+
lastStroke?: () => Data<{
|
|
218
|
+
color?: string
|
|
219
|
+
width?: number
|
|
220
|
+
tool?: string
|
|
221
|
+
points?: any[]
|
|
222
|
+
[key: string]: any
|
|
223
|
+
}>
|
|
224
|
+
}
|
|
225
|
+
animation?: AnimationBasicEvents & {
|
|
226
|
+
onStrokeEnd?: Animation
|
|
227
|
+
onClear?: Animation
|
|
228
|
+
onStateChange?: Animation
|
|
229
|
+
onToolChange?: Animation
|
|
230
|
+
onExportImage?: Animation
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* Drawing canvas with undo/redo, import/export state, and image export */
|
|
235
|
+
export type BrickSketch = Brick &
|
|
236
|
+
BrickSketchDef & {
|
|
237
|
+
templateKey: 'BRICK_SKETCH'
|
|
238
|
+
switches?: Array<
|
|
239
|
+
SwitchDef &
|
|
240
|
+
BrickSketchDef & {
|
|
241
|
+
conds?: Array<{
|
|
242
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
243
|
+
cond:
|
|
244
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
245
|
+
| SwitchCondData
|
|
246
|
+
| {
|
|
247
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
248
|
+
outlet: 'state' | 'imageUri' | 'lastStroke'
|
|
249
|
+
value: any
|
|
250
|
+
}
|
|
251
|
+
}>
|
|
252
|
+
}
|
|
253
|
+
>
|
|
254
|
+
}
|
package/types/bricks/index.ts
CHANGED
package/types/data.ts
CHANGED
|
@@ -713,6 +713,7 @@ Default property:
|
|
|
713
713
|
| {
|
|
714
714
|
enabled?: boolean | DataLink
|
|
715
715
|
url?: string | DataLink
|
|
716
|
+
autoDiscoverType?: 'manual' | 'auto' | DataLink
|
|
716
717
|
fallbackType?: 'use-local' | 'no-op' | DataLink
|
|
717
718
|
strategy?: 'prefer-local' | 'prefer-buttress' | 'prefer-best' | DataLink
|
|
718
719
|
}
|
|
@@ -158,6 +158,7 @@ Default property:
|
|
|
158
158
|
| {
|
|
159
159
|
enabled?: boolean | DataLink
|
|
160
160
|
url?: string | DataLink
|
|
161
|
+
autoDiscoverType?: 'manual' | 'auto' | DataLink
|
|
161
162
|
fallbackType?: 'use-local' | 'no-op' | DataLink
|
|
162
163
|
strategy?: 'prefer-local' | 'prefer-buttress' | 'prefer-best' | DataLink
|
|
163
164
|
}
|
|
@@ -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
|
|
@@ -323,6 +323,7 @@ Default property:
|
|
|
323
323
|
| {
|
|
324
324
|
enabled?: boolean | DataLink
|
|
325
325
|
url?: string | DataLink
|
|
326
|
+
autoDiscoverType?: 'manual' | 'auto' | DataLink
|
|
326
327
|
fallbackType?: 'use-local' | 'no-op' | DataLink
|
|
327
328
|
strategy?: 'prefer-local' | 'prefer-buttress' | 'prefer-best' | DataLink
|
|
328
329
|
}
|
|
@@ -358,9 +359,12 @@ Default property:
|
|
|
358
359
|
transcribeProgress?: () => Data<number>
|
|
359
360
|
/* Inference result */
|
|
360
361
|
transcribeResult?: () => Data<string>
|
|
362
|
+
/* Detected language code of the latest transcription (e.g. `en`, `zh`, `ja`) */
|
|
363
|
+
detectedLanguage?: () => Data<string>
|
|
361
364
|
/* Inference result details */
|
|
362
365
|
transcribeDetails?: () => Data<{
|
|
363
366
|
result?: string
|
|
367
|
+
language?: string
|
|
364
368
|
segments?: Array<{
|
|
365
369
|
start?: number
|
|
366
370
|
end?: number
|
|
@@ -405,6 +409,7 @@ export type GeneratorSpeechInference = Generator &
|
|
|
405
409
|
| 'isTranscribing'
|
|
406
410
|
| 'transcribeProgress'
|
|
407
411
|
| 'transcribeResult'
|
|
412
|
+
| 'detectedLanguage'
|
|
408
413
|
| 'transcribeDetails'
|
|
409
414
|
| 'recordedPath'
|
|
410
415
|
value: any
|
package/types/subspace.ts
CHANGED
package/utils/data.ts
CHANGED
package/utils/event-props.ts
CHANGED
|
@@ -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: {
|
|
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
|
},
|