@fugood/bricks-project 2.23.0-beta.48 → 2.23.0-beta.49
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/util.ts +13 -4
- package/package.json +2 -2
- package/types/bricks/Camera.ts +2 -2
- package/types/bricks/Maps.ts +1 -1
- package/types/data-calc-command.ts +7003 -0
- package/types/data-calc-script.ts +21 -0
- package/types/data-calc.ts +3 -7021
- package/types/index.ts +2 -0
package/compile/util.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { makeId } from '../utils/id'
|
|
|
3
3
|
type ScriptConfig = {
|
|
4
4
|
inputs: Record<string, string>
|
|
5
5
|
enable_async: boolean
|
|
6
|
+
trigger_mode?: 'auto' | 'manual'
|
|
6
7
|
disabled_triggers: Record<string, boolean>
|
|
7
8
|
output: string | null
|
|
8
9
|
outputs: Record<string, string[]>
|
|
@@ -13,6 +14,8 @@ type ScriptConfig = {
|
|
|
13
14
|
const errorMsg = 'Not allow duplicate set property id between inputs / outputs / output / error.'
|
|
14
15
|
|
|
15
16
|
export const validateConfig = (config: ScriptConfig) => {
|
|
17
|
+
// Skip input/output overlap validation in manual mode (allows same data node in both)
|
|
18
|
+
if (config.trigger_mode === 'manual') return
|
|
16
19
|
if (config.error && config.inputs[config.error]) {
|
|
17
20
|
throw new Error(`${errorMsg}. key: error`)
|
|
18
21
|
}
|
|
@@ -87,7 +90,8 @@ export const generateCalulationMap = (config: ScriptConfig, opts?: { snapshotMod
|
|
|
87
90
|
{
|
|
88
91
|
id: key,
|
|
89
92
|
port: 'value',
|
|
90
|
-
disable_trigger_command:
|
|
93
|
+
disable_trigger_command:
|
|
94
|
+
config.trigger_mode === 'manual' || config.disabled_triggers?.[key] || undefined,
|
|
91
95
|
},
|
|
92
96
|
],
|
|
93
97
|
},
|
|
@@ -152,6 +156,8 @@ export const generateCalulationMap = (config: ScriptConfig, opts?: { snapshotMod
|
|
|
152
156
|
points: {},
|
|
153
157
|
}
|
|
154
158
|
pbList.forEach((pb, pbIndex) => {
|
|
159
|
+
// Check if this data node already exists (it might be used as both input and output)
|
|
160
|
+
const existingNode = acc.map[pb] || inputs.map[pb]
|
|
155
161
|
acc.map[pb] = {
|
|
156
162
|
type: 'data-node',
|
|
157
163
|
properties: {},
|
|
@@ -164,7 +170,8 @@ export const generateCalulationMap = (config: ScriptConfig, opts?: { snapshotMod
|
|
|
164
170
|
],
|
|
165
171
|
},
|
|
166
172
|
out: {
|
|
167
|
-
value
|
|
173
|
+
// Preserve existing out.value if node is also used as input
|
|
174
|
+
value: existingNode?.out?.value ?? null,
|
|
168
175
|
},
|
|
169
176
|
}
|
|
170
177
|
acc.editorInfo[pb] = {
|
|
@@ -292,7 +299,8 @@ export const generateCalulationMap = (config: ScriptConfig, opts?: { snapshotMod
|
|
|
292
299
|
],
|
|
293
300
|
},
|
|
294
301
|
out: {
|
|
295
|
-
value
|
|
302
|
+
// Preserve existing out.value if node is also used as input
|
|
303
|
+
value: inputs.map[config.error]?.out?.value ?? null,
|
|
296
304
|
},
|
|
297
305
|
},
|
|
298
306
|
}),
|
|
@@ -309,7 +317,8 @@ export const generateCalulationMap = (config: ScriptConfig, opts?: { snapshotMod
|
|
|
309
317
|
],
|
|
310
318
|
},
|
|
311
319
|
out: {
|
|
312
|
-
value
|
|
320
|
+
// Preserve existing out.value if node is also used as input
|
|
321
|
+
value: inputs.map[config.output]?.out?.value ?? null,
|
|
313
322
|
},
|
|
314
323
|
},
|
|
315
324
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fugood/bricks-project",
|
|
3
|
-
"version": "2.23.0-beta.
|
|
3
|
+
"version": "2.23.0-beta.49",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "bun scripts/build.js"
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"lodash": "^4.17.4",
|
|
15
15
|
"uuid": "^8.3.1"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "d879268aee7397545296e9c1ca1f369af32dfee5"
|
|
18
18
|
}
|
package/types/bricks/Camera.ts
CHANGED
|
@@ -107,8 +107,8 @@ Default property:
|
|
|
107
107
|
}
|
|
108
108
|
*/
|
|
109
109
|
property?: BrickBasicProperty & {
|
|
110
|
-
/* Camera type
|
|
111
|
-
type?: 'back' | 'front' | DataLink
|
|
110
|
+
/* Camera type */
|
|
111
|
+
type?: 'back' | 'front' | 'external' | DataLink
|
|
112
112
|
/* Enable or disable camera */
|
|
113
113
|
isActive?: boolean | DataLink
|
|
114
114
|
/* Camera zoom */
|