vzcode 2.31.0 → 2.34.0
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/README.md +8 -0
- package/dist/assets/{index-BfDRE_ou.js → index-nL6to42p.js} +116 -116
- package/dist/index.html +1 -1
- package/package.json +4 -2
- package/src/client/VZCodeContext/types.ts +12 -0
- package/src/client/VZCodeContext/useVZCodeState.ts +4 -1
- package/src/client/VZSidebar/VisualEditor/VisualEditor.tsx +86 -154
- package/src/client/VZSidebar/VisualEditor/status.ts +150 -0
- package/src/client/VZSidebar/VisualEditor/updateConfig.ts +52 -0
- package/src/client/vzReducer/createInitialState.ts +8 -3
- package/src/types.ts +14 -0
package/README.md
CHANGED
|
@@ -121,6 +121,12 @@ You can also use [npm link](https://docs.npmjs.com/cli/v8/commands/npm-link) to
|
|
|
121
121
|
- **Staging Site Editor (Experimental)**:
|
|
122
122
|
Use VZCode on a persistent server, making code changes with multiplayer mode remotely, reflecting instantly on a staging site.
|
|
123
123
|
|
|
124
|
+
## Embedding the Visual Editor in a host application
|
|
125
|
+
|
|
126
|
+
Embedded clients can pass `initialSidebarView="visual"` to `VZCodeProvider` to open the Visual panel (standalone VZCode keeps its existing AI chat default). Pass `renderVisualEditorEmptyState={(reason) => ...}` to replace built-in empty states with your own UI. The callback receives `missing-config`, `invalid-config`, `missing-widgets`, `invalid-widgets`, or `empty-widgets`; return `null` to use the default message. A nonempty, valid `visualEditorWidgets` array activates the normal widgets.
|
|
127
|
+
|
|
128
|
+
When embedding VZCode beside a host-owned visualization iframe, pass the mutable `iframeRef` to `VZCodeProvider`. VZCode sends top-level config patches via `postMessage` after `config.json` changes; the host must make sure the iframe implements the message listener and that iframe recreations receive the current config. Host applications own any AI setup action: VZCode never triggers paid generation itself.
|
|
129
|
+
|
|
124
130
|
## Visual Editor
|
|
125
131
|
|
|
126
132
|
VZCode includes a visual editor feature that allows you to create interactive widgets (like sliders and color pickers) for tweaking configuration parameters in real-time. This is particularly useful for data visualizations where you want to adjust visual properties dynamically without editing code.
|
|
@@ -198,6 +204,8 @@ The `visualEditorWidgets` array defines the interactive controls that will be av
|
|
|
198
204
|
- **step**: Step increment for `slider` widgets (optional, defaults to 1 if not specified)
|
|
199
205
|
- **options**: Array of string options (required for `dropdown` widgets)
|
|
200
206
|
|
|
207
|
+
Every widget's `property` must resolve to an **existing** value in `config.json` (dot-separated paths such as `margin.left` are supported, but arrays and prototype keys are not editable). Match the value to the widget: finite number for `slider`, boolean for `checkbox`, string for `textInput`, one of `options` for `dropdown`, and a valid, opaque CSS color for `color`. Invalid widget values or paths show the host-configurable `invalid-widgets` empty state rather than rendering broken controls.
|
|
208
|
+
|
|
201
209
|
### Setting Up Your Visualization
|
|
202
210
|
|
|
203
211
|
To make your visualization work with the visual editor, you need to:
|