@fugood/bricks-project 2.23.7 → 2.23.9
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/index.ts +59 -25
- package/package.json +2 -2
- package/skills/bricks-design/LICENSE.txt +180 -0
- package/skills/bricks-design/SKILL.md +66 -0
- package/types/automation.ts +1 -1
- package/types/bricks/Camera.ts +10 -5
- package/types/bricks/Chart.ts +5 -2
- package/types/bricks/GenerativeMedia.ts +20 -7
- package/types/bricks/Icon.ts +3 -2
- package/types/bricks/Image.ts +2 -1
- package/types/bricks/Items.ts +19 -8
- package/types/bricks/Lottie.ts +9 -4
- package/types/bricks/Maps.ts +10 -5
- package/types/bricks/QrCode.ts +1 -0
- package/types/bricks/Rect.ts +1 -0
- package/types/bricks/RichText.ts +3 -2
- package/types/bricks/Rive.ts +17 -10
- package/types/bricks/Slideshow.ts +12 -5
- package/types/bricks/Svg.ts +1 -0
- package/types/bricks/Text.ts +1 -0
- package/types/bricks/TextInput.ts +8 -5
- package/types/bricks/Video.ts +3 -2
- package/types/bricks/VideoStreaming.ts +1 -0
- package/types/bricks/WebRtcStream.ts +1 -0
- package/types/bricks/WebView.ts +6 -5
- package/types/common.ts +10 -8
- package/types/generators/AlarmClock.ts +7 -4
- package/types/generators/Assistant.ts +9 -6
- package/types/generators/BleCentral.ts +14 -5
- package/types/generators/BlePeripheral.ts +1 -0
- package/types/generators/CanvasMap.ts +2 -1
- package/types/generators/CastlesPay.ts +7 -2
- package/types/generators/DataBank.ts +8 -3
- package/types/generators/File.ts +41 -14
- package/types/generators/GraphQl.ts +6 -3
- package/types/generators/Http.ts +3 -2
- package/types/generators/HttpServer.ts +11 -6
- package/types/generators/Information.ts +2 -1
- package/types/generators/Intent.ts +3 -2
- package/types/generators/Iterator.ts +5 -4
- package/types/generators/Keyboard.ts +4 -3
- package/types/generators/LlmAnthropicCompat.ts +11 -4
- package/types/generators/LlmAppleBuiltin.ts +8 -3
- package/types/generators/LlmGgml.ts +12 -5
- package/types/generators/LlmMediaTekNeuroPilot.ts +11 -4
- package/types/generators/LlmMlx.ts +11 -4
- package/types/generators/LlmOnnx.ts +11 -4
- package/types/generators/LlmOpenAiCompat.ts +11 -4
- package/types/generators/LlmQualcommAiEngine.ts +9 -4
- package/types/generators/Mcp.ts +40 -17
- package/types/generators/McpServer.ts +17 -8
- package/types/generators/MediaFlow.ts +8 -3
- package/types/generators/MqttBroker.ts +16 -7
- package/types/generators/MqttClient.ts +5 -4
- package/types/generators/Question.ts +2 -1
- package/types/generators/RealtimeTranscription.ts +22 -7
- package/types/generators/RerankerGgml.ts +5 -2
- package/types/generators/SerialPort.ts +7 -2
- package/types/generators/SoundPlayer.ts +4 -1
- package/types/generators/SoundRecorder.ts +3 -2
- package/types/generators/SpeechToTextGgml.ts +8 -3
- package/types/generators/SpeechToTextOnnx.ts +5 -2
- package/types/generators/SpeechToTextPlatform.ts +7 -2
- package/types/generators/SqLite.ts +5 -2
- package/types/generators/Step.ts +2 -1
- package/types/generators/SttAppleBuiltin.ts +5 -2
- package/types/generators/Tcp.ts +5 -4
- package/types/generators/TcpServer.ts +10 -7
- package/types/generators/TextToSpeechAppleBuiltin.ts +5 -2
- package/types/generators/TextToSpeechGgml.ts +5 -2
- package/types/generators/TextToSpeechOnnx.ts +5 -2
- package/types/generators/TextToSpeechOpenAiLike.ts +5 -2
- package/types/generators/ThermalPrinter.ts +2 -1
- package/types/generators/Tick.ts +3 -2
- package/types/generators/Udp.ts +3 -2
- package/types/generators/VadGgml.ts +8 -3
- package/types/generators/VadOnnx.ts +6 -3
- package/types/generators/VadTraditional.ts +8 -3
- package/types/generators/VectorStore.ts +4 -3
- package/types/generators/Watchdog.ts +3 -2
- package/types/generators/WebCrawler.ts +3 -2
- package/types/generators/WebRtc.ts +8 -3
- package/types/generators/WebSocket.ts +2 -1
- package/types/subspace.ts +1 -0
- package/utils/event-props.ts +833 -1059
package/compile/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle -- Uses __typename, __actionName, etc. for type system */
|
|
2
|
+
import camelCase from 'lodash/camelCase'
|
|
3
|
+
import upperFirst from 'lodash/upperFirst'
|
|
2
4
|
import snakeCase from 'lodash/snakeCase'
|
|
3
5
|
import omit from 'lodash/omit'
|
|
4
6
|
import { parse as parseAST } from 'acorn'
|
|
@@ -110,14 +112,20 @@ const compileScriptCalculationCode = (code = '') => {
|
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
|
|
115
|
+
const getTemplateName = (key: string) =>
|
|
116
|
+
upperFirst(camelCase(key.replace(/^(BRICK|GENERATOR)_/, '')))
|
|
117
|
+
|
|
113
118
|
const compileEventActionValue = (templateKey, eventKey, value, errorReference) => {
|
|
114
|
-
const tmplEventProperties = templateEventPropsMap[templateKey]
|
|
119
|
+
const tmplEventProperties = templateEventPropsMap[getTemplateName(templateKey)]
|
|
115
120
|
const props = tmplEventProperties?.[eventKey]
|
|
116
121
|
if (!props) return compileProperty(value, errorReference)
|
|
117
|
-
if (
|
|
118
|
-
|
|
122
|
+
if (typeof value === 'string' && value in props) {
|
|
123
|
+
const expectedType = props[value]
|
|
124
|
+
if (expectedType) return value
|
|
125
|
+
}
|
|
126
|
+
if (typeof value === 'string' && /^(BRICK|GENERATOR)_/.test(value)) {
|
|
119
127
|
console.warn(
|
|
120
|
-
`[Warning]
|
|
128
|
+
`[Warning] Event property "${value}" is not compatible with event "${eventKey}" of ${templateKey} ${errorReference}`,
|
|
121
129
|
)
|
|
122
130
|
}
|
|
123
131
|
return compileProperty(value, errorReference)
|
|
@@ -163,7 +171,7 @@ const compileEvents = (
|
|
|
163
171
|
eventMap: { [key: string]: Array<any> },
|
|
164
172
|
options = { camelCase: false, errorReference: '' },
|
|
165
173
|
) => {
|
|
166
|
-
const { camelCase, errorReference } = options
|
|
174
|
+
const { camelCase: useCamelCase, errorReference } = options
|
|
167
175
|
return Object.entries(eventMap).reduce((acc, [key, events]) => {
|
|
168
176
|
acc[convertEventKey(templateKey, key)] = events.map((event) => {
|
|
169
177
|
const { handler, action } = event
|
|
@@ -188,37 +196,37 @@ const compileEvents = (
|
|
|
188
196
|
if (!handlerKey) throw new Error(`Invalid handler: ${handler} ${errorReference}`)
|
|
189
197
|
|
|
190
198
|
const parameterList: Array<object> = []
|
|
191
|
-
if (Object.
|
|
199
|
+
if (Object.prototype.hasOwnProperty.call(action, 'params')) {
|
|
192
200
|
const actionDef = action as ActionWithParams
|
|
193
201
|
;(actionDef.params || []).forEach(({ input, value, mapping }) => {
|
|
194
202
|
const param = {
|
|
195
|
-
[
|
|
203
|
+
[useCamelCase ? 'inputToReceiver' : 'input_to_receiver']: handlerTemplateKey
|
|
196
204
|
? compileActionParam(handlerTemplateKey, action.__actionName, input)
|
|
197
205
|
: input,
|
|
198
|
-
[
|
|
206
|
+
[useCamelCase ? 'resultFromSender' : 'result_from_sender']:
|
|
199
207
|
mapping || compileEventActionValue(handlerTemplateKey, key, value, errorReference),
|
|
200
208
|
}
|
|
201
|
-
if (mapping) param[
|
|
209
|
+
if (mapping) param[useCamelCase ? 'resultDataMapping' : 'result_data_mapping'] = true
|
|
202
210
|
parameterList.push(param)
|
|
203
211
|
})
|
|
204
|
-
} else if (Object.
|
|
212
|
+
} else if (Object.prototype.hasOwnProperty.call(action, 'dataParams')) {
|
|
205
213
|
const actionDef = action as ActionWithDataParams
|
|
206
214
|
;(actionDef.dataParams || []).forEach(({ input, value, mapping }) => {
|
|
207
215
|
if (!input) return
|
|
208
216
|
const param = {
|
|
209
|
-
[
|
|
210
|
-
[
|
|
217
|
+
[useCamelCase ? 'inputToReceiver' : 'input_to_receiver']: input().id,
|
|
218
|
+
[useCamelCase ? 'resultFromSender' : 'result_from_sender']:
|
|
211
219
|
mapping || compileEventActionValue(handlerTemplateKey, key, value, errorReference),
|
|
212
220
|
}
|
|
213
|
-
if (mapping) param[
|
|
221
|
+
if (mapping) param[useCamelCase ? 'resultDataMapping' : 'result_data_mapping'] = true
|
|
214
222
|
parameterList.push(param)
|
|
215
223
|
})
|
|
216
224
|
}
|
|
217
225
|
return {
|
|
218
226
|
handler: handlerKey,
|
|
219
227
|
action: action.__actionName,
|
|
220
|
-
[
|
|
221
|
-
[
|
|
228
|
+
[useCamelCase ? 'parameterList' : 'parameter_list']: parameterList,
|
|
229
|
+
[useCamelCase ? 'waitAsync' : 'wait_async']: event.waitAsync,
|
|
222
230
|
}
|
|
223
231
|
})
|
|
224
232
|
return acc
|
|
@@ -354,10 +362,10 @@ const compileRemoteUpdate = (remoteUpdate: Data['remoteUpdate']) => {
|
|
|
354
362
|
}
|
|
355
363
|
|
|
356
364
|
const compileModule = (subspace: Subspace) => {
|
|
357
|
-
if (!subspace.module) return {}
|
|
365
|
+
if (!subspace.module?.id) return {}
|
|
358
366
|
return {
|
|
359
367
|
module: {
|
|
360
|
-
link:
|
|
368
|
+
link: subspace.module.link ?? false,
|
|
361
369
|
id: subspace.module.id,
|
|
362
370
|
version: subspace.module.version,
|
|
363
371
|
},
|
|
@@ -412,14 +420,21 @@ const compileTestCase = (testCase: TestCase) => ({
|
|
|
412
420
|
pre_delay: testCase.pre_delay,
|
|
413
421
|
post_delay: testCase.post_delay,
|
|
414
422
|
post_delay_rule: testCase.post_delay_rule,
|
|
415
|
-
jump_cond: testCase.jump_cond.map((cond) =>
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
+
jump_cond: testCase.jump_cond.map((cond) => {
|
|
424
|
+
if (cond.jump_to == null) {
|
|
425
|
+
console.warn(
|
|
426
|
+
`[Warning] jump_cond is missing jump_to in test case "${testCase.name}" (${testCase.id})`,
|
|
427
|
+
)
|
|
428
|
+
}
|
|
429
|
+
return {
|
|
430
|
+
type: cond.type,
|
|
431
|
+
status: cond.status,
|
|
432
|
+
variable: cond.variable,
|
|
433
|
+
operator: cond.operator,
|
|
434
|
+
value: cond.value,
|
|
435
|
+
jump_to: cond.jump_to,
|
|
436
|
+
}
|
|
437
|
+
}),
|
|
423
438
|
})
|
|
424
439
|
|
|
425
440
|
/**
|
|
@@ -533,6 +548,25 @@ export const compile = async (app: Application) => {
|
|
|
533
548
|
'SUBSPACE',
|
|
534
549
|
`(subspace index: ${subspaceIndex})`,
|
|
535
550
|
)
|
|
551
|
+
|
|
552
|
+
// Linked module subspaces reference external content — only include
|
|
553
|
+
// module metadata, not local canvas/brick/data compilation
|
|
554
|
+
if (subspace.module?.link) {
|
|
555
|
+
subspaceMap[subspaceId] = {
|
|
556
|
+
title: subspace.title,
|
|
557
|
+
description: subspace.description,
|
|
558
|
+
unused: subspace.unused,
|
|
559
|
+
portal: subspace.portal,
|
|
560
|
+
layout: {
|
|
561
|
+
width: subspace.layout?.width,
|
|
562
|
+
height: subspace.layout?.height,
|
|
563
|
+
resize_mode: subspace.layout?.resizeMode,
|
|
564
|
+
},
|
|
565
|
+
...compileModule(subspace),
|
|
566
|
+
}
|
|
567
|
+
return subspaceMap
|
|
568
|
+
}
|
|
569
|
+
|
|
536
570
|
const rootCanvasId = assertEntryId(
|
|
537
571
|
subspace.rootCanvas?.id,
|
|
538
572
|
'CANVAS',
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fugood/bricks-project",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.9",
|
|
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.23.
|
|
10
|
+
"@fugood/bricks-cli": "^2.23.9",
|
|
11
11
|
"@huggingface/gguf": "^0.3.2",
|
|
12
12
|
"@iarna/toml": "^3.0.0",
|
|
13
13
|
"@modelcontextprotocol/sdk": "^1.15.0",
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
This skill is a derivative work based on:
|
|
179
|
+
https://github.com/anthropics/skills/blob/main/skills/frontend-design/SKILL.md
|
|
180
|
+
Copyright Anthropic, PBC. Licensed under the Apache License, Version 2.0.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bricks-design
|
|
3
|
+
description: Create distinctive, production-grade BRICKS application interfaces with high design quality. Use this skill when the user asks to build BRICKS canvases, screens, layouts, or applications. Generates creative, polished BRICKS code that avoids generic aesthetics.
|
|
4
|
+
license: Complete terms in LICENSE.txt (Apache-2.0, based on github.com/anthropics/skills)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This skill guides creation of distinctive, production-grade BRICKS application interfaces that avoid generic aesthetics. Implement working code with exceptional attention to visual design and creative choices.
|
|
8
|
+
|
|
9
|
+
The user provides interface requirements: a screen, layout, application, or component to build. They may include context about the purpose, audience, platform, or technical constraints.
|
|
10
|
+
|
|
11
|
+
## Design Thinking
|
|
12
|
+
|
|
13
|
+
Before coding, understand the context and commit to a **bold** aesthetic direction:
|
|
14
|
+
- **Purpose**: What problem does this interface solve? Who uses it? What platform(s)?
|
|
15
|
+
- **Tone**: Pick a strong direction: brutally minimal, maximalist, retro-futuristic, organic/natural, luxury/refined, playful, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. Use these for inspiration but design one true to the aesthetic.
|
|
16
|
+
- **Constraints**: Target platform (mobile, TV, desktop, kiosk), screen dimensions, accessibility needs.
|
|
17
|
+
- **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
|
|
18
|
+
|
|
19
|
+
**CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work — the key is intentionality, not intensity.
|
|
20
|
+
|
|
21
|
+
Then implement working BRICKS TypeScript code that is:
|
|
22
|
+
- Production-grade and functional
|
|
23
|
+
- Visually striking and memorable
|
|
24
|
+
- Cohesive with a clear aesthetic point-of-view
|
|
25
|
+
- Meticulously refined in every detail
|
|
26
|
+
|
|
27
|
+
## Aesthetics Guidelines
|
|
28
|
+
|
|
29
|
+
### Typography
|
|
30
|
+
Choose fonts that are beautiful, unique, and interesting. Avoid defaulting to system fonts — opt for distinctive choices that elevate the interface. Pair a characterful display font with a refined body font. Create clear typographic hierarchy through weight, size, spacing, and alignment. Use auto-scaling (`fontSizeVector`) when text should fill its container proportionally.
|
|
31
|
+
|
|
32
|
+
### Color & Theme
|
|
33
|
+
Commit to a cohesive palette. Dominant colors with sharp accents outperform timid, evenly-distributed palettes. Use gradients for rich, atmospheric surfaces — multi-stop linear gradients create far more depth than flat fills. Use Data nodes as a shared color store for consistency across bricks.
|
|
34
|
+
|
|
35
|
+
### Motion & Animation
|
|
36
|
+
Focus on high-impact moments: one well-orchestrated canvas enter with staggered standby reveals creates more delight than scattered micro-interactions. Use spring animations for natural, bouncy UI elements. Use composed animations (parallel/sequence) for coordinated entrance choreography. Reserve looping animations (`breatheStart`) for attention-drawing elements — overuse dulls their impact.
|
|
37
|
+
|
|
38
|
+
### Spatial Composition
|
|
39
|
+
Absolute positioning gives total control — use it creatively. Overlap bricks. Create asymmetric layouts. Use generous negative space OR controlled density. Break grid expectations. Consider rotation for diagonal flow and perspective. Vary scale dramatically between elements for visual tension.
|
|
40
|
+
|
|
41
|
+
### Depth & Atmosphere
|
|
42
|
+
Create atmosphere through layered elements rather than flat solid colors:
|
|
43
|
+
- **Gradients** with multiple color stops for rich backgrounds
|
|
44
|
+
- **Shadows** for elevation and hierarchy
|
|
45
|
+
- **Blur effects** (blur, progressive blur, liquid glass) for glass morphism on native platforms
|
|
46
|
+
- **Opacity layering** — stack semi-transparent rects for texture and depth
|
|
47
|
+
- **Border details** — per-side colors, styles, and widths for decorative framing
|
|
48
|
+
|
|
49
|
+
### Interactive Polish
|
|
50
|
+
Design interactions that feel tactile and responsive:
|
|
51
|
+
- Scale/opacity animations on press for physical feedback
|
|
52
|
+
- Focus states for TV/controller navigation
|
|
53
|
+
- Outlet-driven switches for state-dependent visual changes
|
|
54
|
+
- Deliberate long-press patterns for secondary actions
|
|
55
|
+
|
|
56
|
+
## What to NEVER Do
|
|
57
|
+
|
|
58
|
+
- **No generic aesthetics**: Avoid the same tired palette, the same safe layout, the same system font on every screen. Each design should feel distinct and intentional.
|
|
59
|
+
- **No flat sameness**: Don't make every canvas look like the same template with different text. Vary spatial composition, color weight, animation timing, and typographic scale.
|
|
60
|
+
- **No placeholder layouts**: Don't just center everything in a grid. Use the absolute positioning system to create spatial interest — overlap, offset, scale contrast.
|
|
61
|
+
|
|
62
|
+
Vary between light and dark themes, different fonts, different aesthetics across generations. NEVER converge on common choices across designs.
|
|
63
|
+
|
|
64
|
+
**IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate animations, layered rects, and rich gradients. Minimalist designs need restraint, precision in spacing, and carefully chosen typography. Elegance comes from executing the vision well.
|
|
65
|
+
|
|
66
|
+
Remember: The agent is capable of extraordinary creative work. Don't hold back — show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
|
package/types/automation.ts
CHANGED
|
@@ -45,7 +45,7 @@ export interface TestCaseJumpCondition {
|
|
|
45
45
|
operator?: JumpConditionOperator
|
|
46
46
|
value?: any
|
|
47
47
|
// The test case to jump to (getter function for dynamic IDs or string for static IDs)
|
|
48
|
-
jump_to
|
|
48
|
+
jump_to?: string | (() => TestCase)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
package/types/bricks/Camera.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
EventProperty,
|
|
16
16
|
} from '../common'
|
|
17
17
|
import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
|
|
18
|
+
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
18
19
|
|
|
19
20
|
/* Take picture on the Camera */
|
|
20
21
|
export type BrickCameraActionTakePicture = ActionWithParams & {
|
|
@@ -154,19 +155,23 @@ Default property:
|
|
|
154
155
|
}
|
|
155
156
|
events?: BrickBasicEvents & {
|
|
156
157
|
/* Event of the Camera state change */
|
|
157
|
-
stateChange?: Array<EventAction
|
|
158
|
+
stateChange?: Array<EventAction<string & keyof TemplateEventPropsMap['Camera']['stateChange']>>
|
|
158
159
|
/* Event of the Camera record start */
|
|
159
160
|
recordStart?: Array<EventAction>
|
|
160
161
|
/* Event of the Camera record end */
|
|
161
162
|
recordEnd?: Array<EventAction>
|
|
162
163
|
/* Event of the Camera barcode read */
|
|
163
|
-
barcodeRead?: Array<EventAction
|
|
164
|
+
barcodeRead?: Array<EventAction<string & keyof TemplateEventPropsMap['Camera']['barcodeRead']>>
|
|
164
165
|
/* Event of the Camera picture taken */
|
|
165
|
-
pictureTaken?: Array<
|
|
166
|
+
pictureTaken?: Array<
|
|
167
|
+
EventAction<string & keyof TemplateEventPropsMap['Camera']['pictureTaken']>
|
|
168
|
+
>
|
|
166
169
|
/* Event of the Camera record finished */
|
|
167
|
-
recordFinish?: Array<
|
|
170
|
+
recordFinish?: Array<
|
|
171
|
+
EventAction<string & keyof TemplateEventPropsMap['Camera']['recordFinish']>
|
|
172
|
+
>
|
|
168
173
|
/* Event of the Camera mount error */
|
|
169
|
-
mountError?: Array<EventAction
|
|
174
|
+
mountError?: Array<EventAction<string & keyof TemplateEventPropsMap['Camera']['mountError']>>
|
|
170
175
|
}
|
|
171
176
|
outlets?: {
|
|
172
177
|
/* Camera device and format information */
|
package/types/bricks/Chart.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
EventProperty,
|
|
16
16
|
} from '../common'
|
|
17
17
|
import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
|
|
18
|
+
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
18
19
|
|
|
19
20
|
/* Data highlight */
|
|
20
21
|
export type BrickChartActionDataHighlight = ActionWithParams & {
|
|
@@ -335,9 +336,11 @@ Default property:
|
|
|
335
336
|
/* Event of chart render */
|
|
336
337
|
onRender?: Array<EventAction>
|
|
337
338
|
/* Event of data point on press */
|
|
338
|
-
onPress?: Array<EventAction
|
|
339
|
+
onPress?: Array<EventAction<string & keyof TemplateEventPropsMap['Chart']['onPress']>>
|
|
339
340
|
/* Event of legend select changed */
|
|
340
|
-
onLegendSelectChanged?: Array<
|
|
341
|
+
onLegendSelectChanged?: Array<
|
|
342
|
+
EventAction<string & keyof TemplateEventPropsMap['Chart']['onLegendSelectChanged']>
|
|
343
|
+
>
|
|
341
344
|
}
|
|
342
345
|
animation?: AnimationBasicEvents & {
|
|
343
346
|
onRender?: Animation
|
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
EventProperty,
|
|
16
16
|
} from '../common'
|
|
17
17
|
import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
|
|
18
|
+
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
18
19
|
|
|
19
20
|
interface GenerativeMediaDef {
|
|
20
21
|
/*
|
|
@@ -194,21 +195,33 @@ Default property:
|
|
|
194
195
|
/* Event of the brick blur (Use TV Device with controller) */
|
|
195
196
|
generativeMediaOnBlur?: Array<EventAction>
|
|
196
197
|
/* Event when media generation succeeds */
|
|
197
|
-
onSuccess?: Array<
|
|
198
|
+
onSuccess?: Array<
|
|
199
|
+
EventAction<string & keyof TemplateEventPropsMap['GenerativeMedia']['onSuccess']>
|
|
200
|
+
>
|
|
198
201
|
/* Event when media generation fails */
|
|
199
|
-
onError?: Array<EventAction
|
|
202
|
+
onError?: Array<EventAction<string & keyof TemplateEventPropsMap['GenerativeMedia']['onError']>>
|
|
200
203
|
/* Event when media prompt request starts */
|
|
201
|
-
promptStart?: Array<
|
|
204
|
+
promptStart?: Array<
|
|
205
|
+
EventAction<string & keyof TemplateEventPropsMap['GenerativeMedia']['promptStart']>
|
|
206
|
+
>
|
|
202
207
|
/* Event when media prompt request succeeds */
|
|
203
|
-
promptSuccess?: Array<
|
|
208
|
+
promptSuccess?: Array<
|
|
209
|
+
EventAction<string & keyof TemplateEventPropsMap['GenerativeMedia']['promptSuccess']>
|
|
210
|
+
>
|
|
204
211
|
/* Event when media prompt request fails */
|
|
205
|
-
promptError?: Array<
|
|
212
|
+
promptError?: Array<
|
|
213
|
+
EventAction<string & keyof TemplateEventPropsMap['GenerativeMedia']['promptError']>
|
|
214
|
+
>
|
|
206
215
|
/* Event when media loading starts */
|
|
207
216
|
loadStart?: Array<EventAction>
|
|
208
217
|
/* Event when media loading succeeds */
|
|
209
|
-
loadSuccess?: Array<
|
|
218
|
+
loadSuccess?: Array<
|
|
219
|
+
EventAction<string & keyof TemplateEventPropsMap['GenerativeMedia']['loadSuccess']>
|
|
220
|
+
>
|
|
210
221
|
/* Event when media loading fails */
|
|
211
|
-
loadError?: Array<
|
|
222
|
+
loadError?: Array<
|
|
223
|
+
EventAction<string & keyof TemplateEventPropsMap['GenerativeMedia']['loadError']>
|
|
224
|
+
>
|
|
212
225
|
}
|
|
213
226
|
outlets?: {
|
|
214
227
|
/* Brick is pressing */
|
package/types/bricks/Icon.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Auto generated by build script
|
|
2
2
|
*
|
|
3
|
-
* Display
|
|
3
|
+
* Display Font Awesome 6 Pro icons. Supports Solid, Regular, Light, Duotone, Thin, Brands, and Sharp styles
|
|
4
4
|
*/
|
|
5
5
|
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
6
6
|
import type { Data, DataLink } from '../data'
|
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
EventProperty,
|
|
16
16
|
} from '../common'
|
|
17
17
|
import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
|
|
18
|
+
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
18
19
|
|
|
19
20
|
interface BrickIconDef {
|
|
20
21
|
/*
|
|
@@ -74,7 +75,7 @@ Default property:
|
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
/* Display
|
|
78
|
+
/* Display Font Awesome 6 Pro icons. Supports Solid, Regular, Light, Duotone, Thin, Brands, and Sharp styles */
|
|
78
79
|
export type BrickIcon = Brick &
|
|
79
80
|
BrickIconDef & {
|
|
80
81
|
templateKey: 'BRICK_ICON'
|
package/types/bricks/Image.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
EventProperty,
|
|
16
16
|
} from '../common'
|
|
17
17
|
import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
|
|
18
|
+
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
18
19
|
|
|
19
20
|
interface BrickImageDef {
|
|
20
21
|
/*
|
|
@@ -70,7 +71,7 @@ Default property:
|
|
|
70
71
|
/* Event of the image on load */
|
|
71
72
|
onLoad?: Array<EventAction>
|
|
72
73
|
/* Event of the image on error */
|
|
73
|
-
onError?: Array<EventAction
|
|
74
|
+
onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Image']['onError']>>
|
|
74
75
|
}
|
|
75
76
|
outlets?: {
|
|
76
77
|
/* Brick is pressing */
|
package/types/bricks/Items.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Auto generated by build script
|
|
2
2
|
*
|
|
3
|
-
*
|
|
3
|
+
* Data-driven list/grid. Maps items array to brick templates via propertyMapping, with pagination and detail mode support
|
|
4
4
|
*/
|
|
5
5
|
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
6
6
|
import type { Data, DataLink } from '../data'
|
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
EventProperty,
|
|
16
16
|
} from '../common'
|
|
17
17
|
import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
|
|
18
|
+
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
18
19
|
|
|
19
20
|
/* prev page */
|
|
20
21
|
export type BrickItemsActionPrevPage = Action & {
|
|
@@ -400,17 +401,27 @@ Default property:
|
|
|
400
401
|
| DataLink
|
|
401
402
|
events?: BrickBasicEventsForItem & {
|
|
402
403
|
/* Event on page render finished */
|
|
403
|
-
onPageRender?: Array<
|
|
404
|
+
onPageRender?: Array<
|
|
405
|
+
EventActionForItem<string & keyof TemplateEventPropsMap['Items']['onPageRender']>
|
|
406
|
+
>
|
|
404
407
|
/* Event on page change. */
|
|
405
|
-
onPageChange?: Array<
|
|
408
|
+
onPageChange?: Array<
|
|
409
|
+
EventActionForItem<string & keyof TemplateEventPropsMap['Items']['onPageChange']>
|
|
410
|
+
>
|
|
406
411
|
/* Event on page index out of bound. */
|
|
407
|
-
onPageOutOfBound?: Array<
|
|
412
|
+
onPageOutOfBound?: Array<
|
|
413
|
+
EventActionForItem<string & keyof TemplateEventPropsMap['Items']['onPageOutOfBound']>
|
|
414
|
+
>
|
|
408
415
|
/* Event on into `detail` mode */
|
|
409
|
-
onIntoDetailMode?: Array<
|
|
416
|
+
onIntoDetailMode?: Array<
|
|
417
|
+
EventActionForItem<string & keyof TemplateEventPropsMap['Items']['onIntoDetailMode']>
|
|
418
|
+
>
|
|
410
419
|
/* Event on into `list` mode. */
|
|
411
|
-
onIntoListMode?: Array<
|
|
420
|
+
onIntoListMode?: Array<
|
|
421
|
+
EventActionForItem<string & keyof TemplateEventPropsMap['Items']['onIntoListMode']>
|
|
422
|
+
>
|
|
412
423
|
/* Event on render error */
|
|
413
|
-
onError?: Array<EventActionForItem
|
|
424
|
+
onError?: Array<EventActionForItem<string & keyof TemplateEventPropsMap['Items']['onError']>>
|
|
414
425
|
}
|
|
415
426
|
outlets?: {
|
|
416
427
|
/* Catched error message */
|
|
@@ -436,7 +447,7 @@ Default property:
|
|
|
436
447
|
}
|
|
437
448
|
}
|
|
438
449
|
|
|
439
|
-
/*
|
|
450
|
+
/* Data-driven list/grid. Maps items array to brick templates via propertyMapping, with pagination and detail mode support */
|
|
440
451
|
export type BrickItems = Brick &
|
|
441
452
|
BrickItemsDef & {
|
|
442
453
|
templateKey: 'BRICK_ITEMS'
|