mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Add snippet metadata panel, duplicate, and immediate-load preview (M4.5)
This commit is contained in:
@@ -333,6 +333,28 @@ useSettingsStore.subscribe((s, prev) => {
|
||||
});
|
||||
```
|
||||
|
||||
### Implemented policy: what renders immediately vs. debounced
|
||||
|
||||
> The service above is a **sketch**; the shipped renderer lives inline in
|
||||
> `LivePreview.tsx` (one `setTimeout` whose delay is computed per change) and
|
||||
> subscribes to the stores via hooks rather than startup subscribers. When it is
|
||||
> extracted into a service, preserve this policy.
|
||||
|
||||
The debounce exists to stay out of the way **while typing** — nothing else. So the
|
||||
delay is `0` (immediate) for everything except keystrokes (spec §03C):
|
||||
|
||||
- **Immediate** — a _programmatic buffer load_ (`SnippetStore.bufferEpoch` changed:
|
||||
select / create / duplicate / revert / hydrate) or a _Draft↔Published switch_
|
||||
(`editorView` changed). These are the cases §03C names; the editor and preview
|
||||
both key off `bufferEpoch` to tell a load from a keystroke.
|
||||
- **Debounced** — a keystroke (only `shownText` changed). This is the churn the
|
||||
debounce protects against.
|
||||
|
||||
Detect "this was a keystroke" by elimination: `shownText` changed but `bufferEpoch`
|
||||
and `editorView` did **not**. Fit-mode and theme changes currently fall through the
|
||||
debounce too (harmless; not typing) — flush them if instant feedback is wanted, but
|
||||
never debounce a load or a view switch.
|
||||
|
||||
### Busy indicator
|
||||
|
||||
`setBusy(true/false)` toggles store state that the preview reads to overlay a
|
||||
@@ -532,7 +554,7 @@ bookkeeping. Gate the observer to responsive modes (Original needs no re-fit).
|
||||
| View teardown | `view.finalize()` before each re-render and on unmount | the renderer's `RenderHandle` |
|
||||
| Theming | Vega `Config` per UI theme, applied at embed time | `chartConfigFor()` in `src/core/vega-themes.ts` |
|
||||
| Field names | `escapeVegaField` on every data-derived `field:` | `src/core/rendering.ts` |
|
||||
| Debounce | `createDebouncedRenderer`, delay from `renderDebounce` setting | `src/app/services/debounced-renderer.ts` |
|
||||
| Debounce | Inline timer; `0` on buffer-load/view-switch, `renderDebounce` on keystroke (§5) | `LivePreview.tsx` (service not yet extracted) |
|
||||
| Spec prep | `prepareSpecForRender` (pure, on a copy) | `src/core/rendering.ts` (see _Live Preview_) |
|
||||
| Errors | One error field, cleared on success, empty = nothing | `PreviewStore.error` |
|
||||
| Container fit | Inner host + frame (out-specify `.vega-embed`); resize via synthetic `window:resize` | §8 (`LivePreview` + `chart-renderer`) |
|
||||
|
||||
Reference in New Issue
Block a user