@fugood/bricks-ctor 2.25.0-beta.6 → 2.25.0-beta.61
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/package.json +4 -24
- package/tools/deploy.ts +19 -165
- package/tools/mcp-server.ts +17 -26
- package/tools/postinstall.ts +21 -235
- package/tools/pull.ts +18 -121
- package/tools/push-config.ts +19 -0
- package/tools/simulator.ts +21 -0
- package/compile/action-name-map.ts +0 -1015
- package/compile/index.ts +0 -1278
- package/compile/util.ts +0 -358
- package/index.ts +0 -6
- package/skills/bricks-ctor/SKILL.md +0 -32
- package/skills/bricks-ctor/rules/animation.md +0 -159
- package/skills/bricks-ctor/rules/architecture-patterns.md +0 -69
- package/skills/bricks-ctor/rules/automations.md +0 -221
- package/skills/bricks-ctor/rules/buttress.md +0 -156
- package/skills/bricks-ctor/rules/data-calculation.md +0 -209
- package/skills/bricks-ctor/rules/local-sync.md +0 -129
- package/skills/bricks-ctor/rules/media-flow.md +0 -158
- package/skills/bricks-ctor/rules/remote-data-bank.md +0 -196
- package/skills/bricks-ctor/rules/standby-transition.md +0 -124
- package/skills/bricks-design/LICENSE.txt +0 -180
- package/skills/bricks-design/SKILL.md +0 -66
- package/skills/rive-marketplace/SKILL.md +0 -99
- package/tools/_git-author.ts +0 -29
- package/tools/_shell.ts +0 -173
- package/tools/icons/.gitattributes +0 -1
- package/tools/icons/fa6pro-glyphmap.json +0 -4686
- package/tools/icons/fa6pro-meta.json +0 -1
- package/tools/mcp-tools/compile.ts +0 -92
- package/tools/mcp-tools/huggingface.ts +0 -762
- package/tools/mcp-tools/icons.ts +0 -81
- package/tools/mcp-tools/lottie.ts +0 -102
- package/tools/mcp-tools/media.ts +0 -110
- package/tools/preview-main.mjs +0 -293
- package/tools/preview.ts +0 -150
- package/types/animation.ts +0 -100
- package/types/automation.ts +0 -235
- package/types/brick-base.ts +0 -80
- package/types/bricks/Camera.ts +0 -246
- package/types/bricks/Chart.ts +0 -372
- package/types/bricks/GenerativeMedia.ts +0 -290
- package/types/bricks/Icon.ts +0 -98
- package/types/bricks/Image.ts +0 -114
- package/types/bricks/Items.ts +0 -476
- package/types/bricks/Lottie.ts +0 -168
- package/types/bricks/Maps.ts +0 -262
- package/types/bricks/QrCode.ts +0 -117
- package/types/bricks/Rect.ts +0 -150
- package/types/bricks/RichText.ts +0 -128
- package/types/bricks/Rive.ts +0 -220
- package/types/bricks/Sketch.ts +0 -254
- package/types/bricks/Slideshow.ts +0 -201
- package/types/bricks/Svg.ts +0 -99
- package/types/bricks/Text.ts +0 -148
- package/types/bricks/TextInput.ts +0 -242
- package/types/bricks/Video.ts +0 -175
- package/types/bricks/VideoStreaming.ts +0 -112
- package/types/bricks/WebRtcStream.ts +0 -65
- package/types/bricks/WebView.ts +0 -168
- package/types/bricks/index.ts +0 -22
- package/types/canvas.ts +0 -82
- package/types/common.ts +0 -144
- package/types/data-calc-command.ts +0 -7005
- package/types/data-calc-script.ts +0 -21
- package/types/data-calc.ts +0 -11
- package/types/data.ts +0 -95
- package/types/generators/AlarmClock.ts +0 -110
- package/types/generators/Assistant.ts +0 -621
- package/types/generators/BleCentral.ts +0 -247
- package/types/generators/BlePeripheral.ts +0 -208
- package/types/generators/CanvasMap.ts +0 -74
- package/types/generators/CastlesPay.ts +0 -87
- package/types/generators/DataBank.ts +0 -160
- package/types/generators/File.ts +0 -432
- package/types/generators/GraphQl.ts +0 -132
- package/types/generators/Http.ts +0 -222
- package/types/generators/HttpServer.ts +0 -176
- package/types/generators/Information.ts +0 -103
- package/types/generators/Intent.ts +0 -168
- package/types/generators/Iterator.ts +0 -108
- package/types/generators/Keyboard.ts +0 -105
- package/types/generators/LlmAnthropicCompat.ts +0 -212
- package/types/generators/LlmAppleBuiltin.ts +0 -159
- package/types/generators/LlmGgml.ts +0 -861
- package/types/generators/LlmMediaTekNeuroPilot.ts +0 -235
- package/types/generators/LlmMlx.ts +0 -227
- package/types/generators/LlmOnnx.ts +0 -213
- package/types/generators/LlmOpenAiCompat.ts +0 -312
- package/types/generators/LlmQualcommAiEngine.ts +0 -247
- package/types/generators/Mcp.ts +0 -637
- package/types/generators/McpServer.ts +0 -289
- package/types/generators/MediaFlow.ts +0 -170
- package/types/generators/MqttBroker.ts +0 -141
- package/types/generators/MqttClient.ts +0 -141
- package/types/generators/Question.ts +0 -408
- package/types/generators/RealtimeTranscription.ts +0 -287
- package/types/generators/RerankerGgml.ts +0 -191
- package/types/generators/SerialPort.ts +0 -151
- package/types/generators/SoundPlayer.ts +0 -94
- package/types/generators/SoundRecorder.ts +0 -130
- package/types/generators/SpeechToTextGgml.ts +0 -419
- package/types/generators/SpeechToTextOnnx.ts +0 -236
- package/types/generators/SpeechToTextPlatform.ts +0 -85
- package/types/generators/SqLite.ts +0 -159
- package/types/generators/Step.ts +0 -107
- package/types/generators/SttAppleBuiltin.ts +0 -130
- package/types/generators/Tcp.ts +0 -126
- package/types/generators/TcpServer.ts +0 -147
- package/types/generators/TextToSpeechAppleBuiltin.ts +0 -127
- package/types/generators/TextToSpeechGgml.ts +0 -221
- package/types/generators/TextToSpeechOnnx.ts +0 -178
- package/types/generators/TextToSpeechOpenAiLike.ts +0 -121
- package/types/generators/ThermalPrinter.ts +0 -191
- package/types/generators/Tick.ts +0 -83
- package/types/generators/Udp.ts +0 -120
- package/types/generators/VadGgml.ts +0 -250
- package/types/generators/VadOnnx.ts +0 -231
- package/types/generators/VadTraditional.ts +0 -138
- package/types/generators/VectorStore.ts +0 -257
- package/types/generators/Watchdog.ts +0 -107
- package/types/generators/WebCrawler.ts +0 -103
- package/types/generators/WebRtc.ts +0 -181
- package/types/generators/WebSocket.ts +0 -148
- package/types/generators/index.ts +0 -57
- package/types/index.ts +0 -13
- package/types/subspace.ts +0 -60
- package/types/switch.ts +0 -51
- package/types/system.ts +0 -707
- package/utils/calc.ts +0 -126
- package/utils/data.ts +0 -497
- package/utils/event-props.ts +0 -886
- package/utils/id.ts +0 -80
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# Local Sync
|
|
2
|
-
|
|
3
|
-
Synchronize data between devices on a Local Area Network (LAN) without remote server storage. High synchronization rate for real-time multi-device experiences.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Update Data**: Sync Data Bank values across local devices
|
|
8
|
-
- **Execute Data Calculation**: Trigger calculations on other devices
|
|
9
|
-
- **No Remote Storage**: Direct device-to-device communication
|
|
10
|
-
|
|
11
|
-
## Main / Minor Device Model
|
|
12
|
-
|
|
13
|
-
| Role | Description |
|
|
14
|
-
|------|-------------|
|
|
15
|
-
| Main | Manages Data Bank if enabled, first device to start |
|
|
16
|
-
| Minor | Follows main device, subsequent devices |
|
|
17
|
-
|
|
18
|
-
### Role Determination
|
|
19
|
-
|
|
20
|
-
1. First device to start becomes Main
|
|
21
|
-
2. If simultaneous start: `Priority as Main Device` (0-9, set in Device Page) + random number determines Main
|
|
22
|
-
|
|
23
|
-
## Configuration
|
|
24
|
-
|
|
25
|
-
### Run Mode Options
|
|
26
|
-
|
|
27
|
-
| Mode | Description |
|
|
28
|
-
|------|-------------|
|
|
29
|
-
| `all` | Run on all devices |
|
|
30
|
-
| `main-only` | Only run on Main device |
|
|
31
|
-
| `minor-only` | Only run on Minor devices |
|
|
32
|
-
|
|
33
|
-
Apply run mode to:
|
|
34
|
-
- Data properties
|
|
35
|
-
- Generators
|
|
36
|
-
- Data Calculations
|
|
37
|
-
|
|
38
|
-
### Subspace Local Sync Settings
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
const subspace: Subspace = {
|
|
42
|
-
__typename: 'Subspace',
|
|
43
|
-
id: 'main',
|
|
44
|
-
localSyncChangeCanvas: 'all', // 'all' | 'main-only' | 'minor-only' | 'none'
|
|
45
|
-
// ...
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Data Local Sync
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
import { makeId } from 'bricks-ctor'
|
|
53
|
-
|
|
54
|
-
const data: Data = {
|
|
55
|
-
__typename: 'Data',
|
|
56
|
-
id: makeId('data'),
|
|
57
|
-
title: 'Shared Counter',
|
|
58
|
-
type: 'number',
|
|
59
|
-
value: 0,
|
|
60
|
-
localSyncUpdateMode: 'main-only', // 'main-only' | 'minor-only' | undefined (all)
|
|
61
|
-
events: {},
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Generator Local Sync
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
import { makeId } from 'bricks-ctor'
|
|
69
|
-
|
|
70
|
-
const generator: GeneratorTimer = {
|
|
71
|
-
__typename: 'Generator',
|
|
72
|
-
templateKey: 'Timer',
|
|
73
|
-
id: makeId('generator'),
|
|
74
|
-
title: 'Sync Timer',
|
|
75
|
-
description: '',
|
|
76
|
-
localSyncRunMode: 'main-only', // Timer only runs on main device
|
|
77
|
-
property: {},
|
|
78
|
-
events: {},
|
|
79
|
-
switches: [],
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Use Cases
|
|
84
|
-
|
|
85
|
-
### Synchronized Displays
|
|
86
|
-
Multiple screens showing coordinated content:
|
|
87
|
-
- Main device controls timing/state
|
|
88
|
-
- Minor devices follow state changes
|
|
89
|
-
|
|
90
|
-
### Interactive Kiosks
|
|
91
|
-
Touch on one device, update all:
|
|
92
|
-
- User interacts with input device (Minor)
|
|
93
|
-
- Main device processes and broadcasts result
|
|
94
|
-
- All devices update simultaneously
|
|
95
|
-
|
|
96
|
-
### Video Walls
|
|
97
|
-
Coordinated multi-screen layouts:
|
|
98
|
-
- Main device manages playback state
|
|
99
|
-
- Minor devices sync position/frame
|
|
100
|
-
|
|
101
|
-
## System Data
|
|
102
|
-
|
|
103
|
-
Access local sync status via System Data:
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
// Is current device the main device?
|
|
107
|
-
systemData.isLocalSyncMainDevice // boolean
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Important Notes
|
|
111
|
-
|
|
112
|
-
1. **Version Matching**: All devices must use same BRICKS Foundation minor version
|
|
113
|
-
- ✅ v2.11.0 matches v2.11.1
|
|
114
|
-
- ❌ v2.11.0 does NOT match v2.10.8
|
|
115
|
-
|
|
116
|
-
2. **Network Requirements**:
|
|
117
|
-
- All devices on same LAN
|
|
118
|
-
- mDNS/Bonjour enabled
|
|
119
|
-
- Firewall allows local discovery
|
|
120
|
-
|
|
121
|
-
3. **Startup Order**: Consider device startup sequence when Main role matters
|
|
122
|
-
|
|
123
|
-
## Best Practices
|
|
124
|
-
|
|
125
|
-
1. **Designate Main explicitly**: Set high `Priority as Main Device` on intended main
|
|
126
|
-
2. **Idempotent logic**: Design for eventual consistency, not strict ordering
|
|
127
|
-
3. **Minimal sync scope**: Only enable local sync for data that truly needs it
|
|
128
|
-
4. **Test multi-device**: Validate behavior with actual device count
|
|
129
|
-
5. **Handle disconnection**: Design for graceful degradation if devices disconnect
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
# Media Flow
|
|
2
|
-
|
|
3
|
-
Centralized media asset management for BRICKS applications. Store, organize, and reference images, videos, and audio files.
|
|
4
|
-
|
|
5
|
-
## Enable Media Workspace
|
|
6
|
-
|
|
7
|
-
1. Visit `Media` tab in workspace page
|
|
8
|
-
2. Enable media workspace for your workspace
|
|
9
|
-
|
|
10
|
-
## Media Box
|
|
11
|
-
|
|
12
|
-
Organize assets into boxes (folders). Each box can contain files of various types.
|
|
13
|
-
|
|
14
|
-
### Generator Media Flow
|
|
15
|
-
|
|
16
|
-
Use `Generator Media Flow` to:
|
|
17
|
-
- Get file list from a box
|
|
18
|
-
- Download files
|
|
19
|
-
- Subscribe to box changes
|
|
20
|
-
|
|
21
|
-
Quick setup: Create new Property with `As Media Resource file list?` option.
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
24
|
-
import { makeId } from 'bricks-ctor'
|
|
25
|
-
|
|
26
|
-
const mediaListGenerator: GeneratorMediaFlow = {
|
|
27
|
-
__typename: 'Generator',
|
|
28
|
-
templateKey: 'MediaFlow',
|
|
29
|
-
id: makeId('generator'),
|
|
30
|
-
title: 'Promo Images',
|
|
31
|
-
description: '',
|
|
32
|
-
property: {
|
|
33
|
-
boxId: 'promo-box-id',
|
|
34
|
-
},
|
|
35
|
-
outlets: {
|
|
36
|
-
files: () => promoFilesData, // Array of file objects
|
|
37
|
-
},
|
|
38
|
-
events: {},
|
|
39
|
-
switches: [],
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Property Kinds for Media
|
|
44
|
-
|
|
45
|
-
Link Data properties to Media Flow for asset selection:
|
|
46
|
-
|
|
47
|
-
| Kind | Description |
|
|
48
|
-
|------|-------------|
|
|
49
|
-
| `media-resource-image` | Image asset selector |
|
|
50
|
-
| `media-resource-video` | Video asset selector |
|
|
51
|
-
| `media-resource-audio` | Audio asset selector |
|
|
52
|
-
| `lottie-file-uri` | Lottie animation selector |
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
import { makeId } from 'bricks-ctor'
|
|
56
|
-
|
|
57
|
-
const backgroundImage: Data = {
|
|
58
|
-
__typename: 'Data',
|
|
59
|
-
id: makeId('data'),
|
|
60
|
-
title: 'Background Image',
|
|
61
|
-
type: 'string',
|
|
62
|
-
kind: { type: 'media-resource-image' },
|
|
63
|
-
value: '',
|
|
64
|
-
events: {},
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Assets with these kinds are **preloaded** during application launch.
|
|
69
|
-
|
|
70
|
-
## Compatible Bricks & Generators
|
|
71
|
-
|
|
72
|
-
### Bricks
|
|
73
|
-
- **Brick Image**: Display images from Media Flow
|
|
74
|
-
- **Brick Video**: Play videos from Media Flow
|
|
75
|
-
- **Brick Lottie**: Render Lottie animations
|
|
76
|
-
- **Brick Slideshow**: Cycle through Media Flow file list
|
|
77
|
-
|
|
78
|
-
### Generators
|
|
79
|
-
- **Generator Sound Player**: Play audio files
|
|
80
|
-
- **Generator File Reader**: Read file contents
|
|
81
|
-
|
|
82
|
-
## Slideshow with Media Flow
|
|
83
|
-
|
|
84
|
-
Connect Generator Media Flow output to Brick Slideshow:
|
|
85
|
-
|
|
86
|
-
```typescript
|
|
87
|
-
import { makeId, linkData } from 'bricks-ctor'
|
|
88
|
-
|
|
89
|
-
const slideshow: BrickSlideshow = {
|
|
90
|
-
__typename: 'Brick',
|
|
91
|
-
templateKey: 'Slideshow',
|
|
92
|
-
id: makeId('brick'),
|
|
93
|
-
title: 'Promo Slideshow',
|
|
94
|
-
description: '',
|
|
95
|
-
property: {
|
|
96
|
-
images: linkData(() => promoFilesData),
|
|
97
|
-
interval: 5000, // ms between slides
|
|
98
|
-
transition: 'fade',
|
|
99
|
-
},
|
|
100
|
-
events: {},
|
|
101
|
-
switches: [],
|
|
102
|
-
}
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## File Object Structure
|
|
106
|
-
|
|
107
|
-
Files from Media Flow include:
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
interface MediaFile {
|
|
111
|
-
id: string
|
|
112
|
-
name: string
|
|
113
|
-
url: string
|
|
114
|
-
thumbnailUrl?: string
|
|
115
|
-
mimeType: string
|
|
116
|
-
size: number
|
|
117
|
-
width?: number // For images/videos
|
|
118
|
-
height?: number
|
|
119
|
-
duration?: number // For videos/audio
|
|
120
|
-
createdAt: string
|
|
121
|
-
updatedAt: string
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## Upload & Management
|
|
126
|
-
|
|
127
|
-
### Via Editor
|
|
128
|
-
1. Open Media tab in BRICKS Editor
|
|
129
|
-
2. Select or create a box
|
|
130
|
-
3. Drag & drop files or use upload button
|
|
131
|
-
|
|
132
|
-
### Via CLI
|
|
133
|
-
```bash
|
|
134
|
-
bricks media boxes # List media boxes
|
|
135
|
-
bricks media box <box-id> # Box details
|
|
136
|
-
bricks media files <box-id> # List files in box
|
|
137
|
-
bricks media file <file-id> # File details
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
> Note: CLI currently supports read-only operations. Upload is not yet supported.
|
|
141
|
-
|
|
142
|
-
### Via API
|
|
143
|
-
Use BRICKS API for programmatic upload and management.
|
|
144
|
-
|
|
145
|
-
## Screenshot Storage
|
|
146
|
-
|
|
147
|
-
Automation `Match Screenshot` can save screenshots to Media Flow workspace:
|
|
148
|
-
- Baseline images stored in specified box
|
|
149
|
-
- Easy visual comparison and management
|
|
150
|
-
|
|
151
|
-
## Best Practices
|
|
152
|
-
|
|
153
|
-
1. **Organize by purpose**: Create boxes for different content types (backgrounds, icons, videos)
|
|
154
|
-
2. **Optimize assets**: Compress images/videos before upload
|
|
155
|
-
3. **Preload critical assets**: Use `media-resource-*` kinds for important visuals
|
|
156
|
-
4. **Slideshow performance**: Limit file count and resolution for smooth playback
|
|
157
|
-
5. **Version control**: Use box naming conventions for content versions
|
|
158
|
-
6. **CDN benefit**: Media Flow URLs are CDN-backed for fast delivery
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
# Remote Data Bank
|
|
2
|
-
|
|
3
|
-
Cloud-synchronized Data Bank for real-time data sharing across devices and external API access.
|
|
4
|
-
|
|
5
|
-
## Remote Update Types
|
|
6
|
-
|
|
7
|
-
The `remoteUpdate` field configures cloud synchronization:
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
remoteUpdate?:
|
|
11
|
-
| { type: 'auto' } // Sync across all devices
|
|
12
|
-
| { type: 'device-specific' } // Isolated per device
|
|
13
|
-
| { type: 'global-data', id: string } // Cross-application global data
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Auto Sync
|
|
17
|
-
|
|
18
|
-
Sync across all devices using the same application.
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
import { makeId } from 'bricks-ctor'
|
|
22
|
-
|
|
23
|
-
const data: Data = {
|
|
24
|
-
__typename: 'Data',
|
|
25
|
-
id: makeId('data'),
|
|
26
|
-
title: 'Announcement',
|
|
27
|
-
type: 'string',
|
|
28
|
-
value: '',
|
|
29
|
-
remoteUpdate: { type: 'auto' },
|
|
30
|
-
events: {},
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Global Data
|
|
35
|
-
|
|
36
|
-
Share data across different applications. Must create Global Data first on BANK page.
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
import { makeId } from 'bricks-ctor'
|
|
40
|
-
|
|
41
|
-
const data: Data = {
|
|
42
|
-
__typename: 'Data',
|
|
43
|
-
id: makeId('data'),
|
|
44
|
-
title: 'Global Config',
|
|
45
|
-
type: 'object',
|
|
46
|
-
value: {},
|
|
47
|
-
remoteUpdate: { type: 'global-data', id: 'workspace-global-config-id' },
|
|
48
|
-
events: {},
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Device Specific
|
|
53
|
-
|
|
54
|
-
Isolate data per device while still allowing web page control.
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
import { makeId } from 'bricks-ctor'
|
|
58
|
-
|
|
59
|
-
const data: Data = {
|
|
60
|
-
__typename: 'Data',
|
|
61
|
-
id: makeId('data'),
|
|
62
|
-
title: 'Device Message',
|
|
63
|
-
type: 'string',
|
|
64
|
-
value: '',
|
|
65
|
-
remoteUpdate: { type: 'device-specific' },
|
|
66
|
-
events: {},
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Use case: Control individual displays from a shared web interface without affecting other devices.
|
|
71
|
-
|
|
72
|
-
## External Access
|
|
73
|
-
|
|
74
|
-
### Web Update Page
|
|
75
|
-
|
|
76
|
-
Generate a web page for non-technical users to update data:
|
|
77
|
-
|
|
78
|
-
1. Visit BANK page
|
|
79
|
-
2. Click `Manage Keys`
|
|
80
|
-
3. Select `Generate Key used by Update Page`
|
|
81
|
-
4. Share the generated link
|
|
82
|
-
|
|
83
|
-
The page has independent permissions and can be shared with content managers.
|
|
84
|
-
|
|
85
|
-
### API Access
|
|
86
|
-
|
|
87
|
-
Programmatic data updates via REST API.
|
|
88
|
-
|
|
89
|
-
**Setup:**
|
|
90
|
-
1. Visit BANK page → Manage Keys
|
|
91
|
-
2. Create API key with appropriate permissions
|
|
92
|
-
3. Use key in API requests
|
|
93
|
-
|
|
94
|
-
**Example API Usage:**
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
# Update a property
|
|
98
|
-
curl -X POST https://api.bricks.tools/v1/bank/update \
|
|
99
|
-
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
100
|
-
-H "Content-Type: application/json" \
|
|
101
|
-
-d '{
|
|
102
|
-
"applicationId": "app-id",
|
|
103
|
-
"propertyId": "announcement",
|
|
104
|
-
"value": "New announcement text"
|
|
105
|
-
}'
|
|
106
|
-
|
|
107
|
-
# Get property value
|
|
108
|
-
curl https://api.bricks.tools/v1/bank/get \
|
|
109
|
-
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
110
|
-
-G \
|
|
111
|
-
-d "applicationId=app-id" \
|
|
112
|
-
-d "propertyId=announcement"
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Data Routing
|
|
116
|
-
|
|
117
|
-
Cross-subspace data sharing with access control.
|
|
118
|
-
|
|
119
|
-
```typescript
|
|
120
|
-
const routedData: Data = {
|
|
121
|
-
__typename: 'Data',
|
|
122
|
-
id: 'shared-state',
|
|
123
|
-
type: 'object',
|
|
124
|
-
routing: 'read-only', // 'read-only' | default (read-write)
|
|
125
|
-
// When read-only: only accepts changes from same subspace
|
|
126
|
-
// Default: accepts changes from any subspace
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## Use Cases
|
|
131
|
-
|
|
132
|
-
### Digital Signage Content Management
|
|
133
|
-
|
|
134
|
-
```typescript
|
|
135
|
-
import { makeId } from 'bricks-ctor'
|
|
136
|
-
|
|
137
|
-
// Remote-updated announcement
|
|
138
|
-
const announcement: Data = {
|
|
139
|
-
__typename: 'Data',
|
|
140
|
-
id: makeId('data'),
|
|
141
|
-
title: 'Announcement',
|
|
142
|
-
type: 'object',
|
|
143
|
-
value: { title: '', body: '', enabled: false },
|
|
144
|
-
remoteUpdate: { type: 'auto' },
|
|
145
|
-
events: {},
|
|
146
|
-
}
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
Operator updates content via web page → All displays update in real-time.
|
|
150
|
-
|
|
151
|
-
### Multi-Location Coordination
|
|
152
|
-
|
|
153
|
-
```typescript
|
|
154
|
-
import { makeId } from 'bricks-ctor'
|
|
155
|
-
|
|
156
|
-
// Global data shared across locations
|
|
157
|
-
const globalConfig: Data = {
|
|
158
|
-
__typename: 'Data',
|
|
159
|
-
id: makeId('data'),
|
|
160
|
-
title: 'Brand Config',
|
|
161
|
-
type: 'object',
|
|
162
|
-
value: {},
|
|
163
|
-
remoteUpdate: { type: 'global-data', id: 'brand-config-global' },
|
|
164
|
-
events: {},
|
|
165
|
-
}
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
Update once → All locations receive update.
|
|
169
|
-
|
|
170
|
-
### Per-Device Customization
|
|
171
|
-
|
|
172
|
-
```typescript
|
|
173
|
-
import { makeId } from 'bricks-ctor'
|
|
174
|
-
|
|
175
|
-
// Device-specific greeting
|
|
176
|
-
const deviceGreeting: Data = {
|
|
177
|
-
__typename: 'Data',
|
|
178
|
-
id: makeId('data'),
|
|
179
|
-
title: 'Greeting',
|
|
180
|
-
type: 'string',
|
|
181
|
-
value: '',
|
|
182
|
-
remoteUpdate: { type: 'device-specific' },
|
|
183
|
-
events: {},
|
|
184
|
-
}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
Each display shows different greeting, controlled from single dashboard.
|
|
188
|
-
|
|
189
|
-
## Best Practices
|
|
190
|
-
|
|
191
|
-
1. **Minimize remote data**: Only enable for data that truly needs cloud sync
|
|
192
|
-
2. **Use device-specific wisely**: Good for personalization, not for shared state
|
|
193
|
-
3. **API key security**: Use scoped keys with minimal permissions
|
|
194
|
-
4. **Offline resilience**: Design for temporary disconnection
|
|
195
|
-
5. **Batch updates**: Group related changes to reduce API calls
|
|
196
|
-
6. **Global data governance**: Establish clear ownership for global data keys
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
# Standby Transition
|
|
2
|
-
|
|
3
|
-
Easy-to-configure animation for Bricks based on Canvas render/change. Provides smooth enter animations when bricks appear and position transitions when canvas changes.
|
|
4
|
-
|
|
5
|
-
## How It Works
|
|
6
|
-
|
|
7
|
-
Two transition cases:
|
|
8
|
-
1. **First Render**: Run position transition based on `standbyMode` setting
|
|
9
|
-
2. **Canvas Change**: Existing bricks animate to new positions instead of re-rendering
|
|
10
|
-
|
|
11
|
-
## Configuration
|
|
12
|
-
|
|
13
|
-
Standby transition is configured in the **canvas item frame**, not the brick itself.
|
|
14
|
-
|
|
15
|
-
### Standby Mode
|
|
16
|
-
|
|
17
|
-
| Mode | Description |
|
|
18
|
-
|------|-------------|
|
|
19
|
-
| `top` | Slide in from top |
|
|
20
|
-
| `bottom` | Slide in from bottom |
|
|
21
|
-
| `left` | Slide in from left |
|
|
22
|
-
| `right` | Slide in from right |
|
|
23
|
-
| `custom` | Use custom `standbyFrame` values |
|
|
24
|
-
|
|
25
|
-
### Frame Options
|
|
26
|
-
|
|
27
|
-
| Option | Description |
|
|
28
|
-
|--------|-------------|
|
|
29
|
-
| `standbyMode` | Direction or `'custom'` |
|
|
30
|
-
| `standbyFrame` | Custom start frame `{ x?, y?, width?, height? }` |
|
|
31
|
-
| `standbyOpacity` | Start opacity (0.0 - 1.0) |
|
|
32
|
-
| `standbyDelay` | Delay before transition starts (ms) |
|
|
33
|
-
| `standbyDelayRandom` | Random delay variance (ms) |
|
|
34
|
-
| `standbyEasing` | Per-property easing config |
|
|
35
|
-
|
|
36
|
-
### Easing Configuration
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
standbyEasing: {
|
|
40
|
-
default?: { method: Easing, duration: number },
|
|
41
|
-
x?: { method: Easing, duration: number },
|
|
42
|
-
y?: { method: Easing, duration: number },
|
|
43
|
-
width?: { method: Easing, duration: number },
|
|
44
|
-
height?: { method: Easing, duration: number },
|
|
45
|
-
opacity?: { method: Easing, duration: number },
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## TypeScript Example
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
import { makeId } from 'bricks-ctor'
|
|
53
|
-
|
|
54
|
-
const canvas: Canvas = {
|
|
55
|
-
__typename: 'Canvas',
|
|
56
|
-
id: makeId('canvas'),
|
|
57
|
-
title: 'Home',
|
|
58
|
-
description: '',
|
|
59
|
-
property: {
|
|
60
|
-
backgroundColor: '#ffffff',
|
|
61
|
-
},
|
|
62
|
-
events: {},
|
|
63
|
-
switches: [],
|
|
64
|
-
items: [
|
|
65
|
-
{
|
|
66
|
-
item: () => heroCard,
|
|
67
|
-
frame: {
|
|
68
|
-
x: 100,
|
|
69
|
-
y: 50,
|
|
70
|
-
width: 400,
|
|
71
|
-
height: 300,
|
|
72
|
-
// Standby transition config
|
|
73
|
-
standbyMode: 'bottom',
|
|
74
|
-
standbyOpacity: 0,
|
|
75
|
-
standbyDelay: 100,
|
|
76
|
-
standbyEasing: {
|
|
77
|
-
default: { method: 'easeOutCubic', duration: 400 },
|
|
78
|
-
opacity: { method: 'easeOutQuad', duration: 300 },
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Canvas Change Transition
|
|
87
|
-
|
|
88
|
-
When navigating between canvases, bricks with the same ID smoothly transition:
|
|
89
|
-
- Position interpolates from old to new location
|
|
90
|
-
- Size interpolates if dimensions change
|
|
91
|
-
- Opacity interpolates if visibility changes
|
|
92
|
-
|
|
93
|
-
This creates a "shared element transition" effect.
|
|
94
|
-
|
|
95
|
-
## Related Events
|
|
96
|
-
|
|
97
|
-
- `standby`: Triggered when brick completes standby transition
|
|
98
|
-
|
|
99
|
-
```typescript
|
|
100
|
-
// In brick definition
|
|
101
|
-
events: {
|
|
102
|
-
standby: [
|
|
103
|
-
{
|
|
104
|
-
handler: 'system',
|
|
105
|
-
action: {
|
|
106
|
-
__actionName: 'DYNAMIC_ANIMATION',
|
|
107
|
-
parent: 'System',
|
|
108
|
-
params: [
|
|
109
|
-
{ input: 'brickId', value: () => heroCard },
|
|
110
|
-
{ input: 'animationId', value: () => pulseAnimation },
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## Best Practices
|
|
119
|
-
|
|
120
|
-
1. **Stagger delays**: Use incremental delays for list items (e.g., 0, 50, 100ms)
|
|
121
|
-
2. **Keep it short**: 200-400ms transitions feel responsive
|
|
122
|
-
3. **Match content**: Use directional transitions that match scroll direction
|
|
123
|
-
4. **Opacity for polish**: Combine position transition with opacity fade
|
|
124
|
-
5. **Same-ID trick**: Reuse brick IDs across canvases for smooth transitions
|