@visualli/react 0.1.7 → 0.2.1

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.
Files changed (49) hide show
  1. package/README.md +13 -5
  2. package/dist/index.cjs +1900 -2033
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +354 -97
  5. package/dist/index.d.ts +354 -97
  6. package/dist/index.js +2005 -2095
  7. package/dist/index.js.map +1 -1
  8. package/fonts/Caveat-Variable.ttf +0 -0
  9. package/licenses/visualli-design-system/LICENSE +9 -0
  10. package/licenses/visualli-design-system/NOTICE.md +6 -0
  11. package/package.json +9 -4
  12. package/src/VisualliCanvas.tsx +452 -409
  13. package/src/VisualliRenderer.tsx +90 -112
  14. package/src/components/A11yLayer.tsx +73 -0
  15. package/src/components/KonvaContainer.tsx +28 -237
  16. package/src/components/KonvaContainerLabelLayer.tsx +41 -0
  17. package/src/components/KonvaContainerLayer.tsx +34 -33
  18. package/src/components/KonvaEdge.tsx +25 -240
  19. package/src/components/KonvaEdgeLayer.tsx +69 -49
  20. package/src/components/KonvaNode.tsx +21 -156
  21. package/src/components/KonvaNodeLayer.tsx +102 -34
  22. package/src/components/KonvaStage.tsx +17 -3
  23. package/src/components/NavigationStack.tsx +16 -159
  24. package/src/components/Overlays.tsx +327 -0
  25. package/src/components/ZoomControls.tsx +3 -107
  26. package/src/components/useFrames.ts +30 -0
  27. package/src/context/VisualliContext.tsx +3 -3
  28. package/src/design/choreography.ts +157 -0
  29. package/src/design/containers.ts +150 -0
  30. package/src/design/design.ts +115 -0
  31. package/src/design/drawing.ts +303 -0
  32. package/src/design/measure.ts +34 -0
  33. package/src/design/runtime.ts +154 -0
  34. package/src/design/useDesign.ts +38 -0
  35. package/src/generated/specCss.ts +15 -0
  36. package/src/hooks/index.ts +0 -2
  37. package/src/hooks/useKonvaRenderer.ts +13 -18
  38. package/src/hooks/useLayerChoreography.ts +159 -0
  39. package/src/hooks/useViewportNodes.ts +0 -1
  40. package/src/index.ts +22 -22
  41. package/src/stores/stores.ts +2 -2
  42. package/src/stores/useViewportStore.ts +12 -2
  43. package/src/animations/index.ts +0 -2
  44. package/src/animations/konvaLayerTransition.ts +0 -223
  45. package/src/components/SketchyBoxKonva.tsx +0 -121
  46. package/src/config/blobShapes.ts +0 -204
  47. package/src/config/index.ts +0 -21
  48. package/src/config/textScaling.ts +0 -69
  49. package/src/hooks/useKonvaLayerTransition.ts +0 -221
package/README.md CHANGED
@@ -11,7 +11,7 @@ React canvas rendering for Visualli — powered by Konva. A high-performance com
11
11
  - **Chromatic Immersion** — Optional background effects that adapt to the current layer's context
12
12
  - **Viewport Culling** — Spatial indexing ensures only visible elements are rendered
13
13
  - **Worker-based Parsing** — Parse large documents off the main thread to prevent UI blocking
14
- - **Flexible Theming** — Light, Dark, and System-aware (auto) theme support
14
+ - **Design-system theming** — 8 themes (standard, focus, color-safe, high-contrast; light and dark), comfort settings (readable type, larger text, reduced motion), forced-colors aware
15
15
  - **State Management** — Fine-grained control via Zustand stores for viewport, nodes, and selection
16
16
 
17
17
  ## Installation
@@ -82,7 +82,13 @@ The primary component for rendering `.visualli` documents. Manages the full docu
82
82
  |------|------|---------|-------------|
83
83
  | `visualliFile` | `File \| string` | — | A `.visualli` file as a File object or URL path |
84
84
  | `visualliString` | `string` | — | Raw JSONL content as a string |
85
- | `theme` | `'light' \| 'dark' \| 'auto'` | `'light'` | Color theme. `'auto'` follows system preference |
85
+ | `theme` | `ThemeName \| 'auto' \| 'focus' \| 'colorsafe' \| 'contrast'` | `'light'` | One of the 8 design-system themes (`light`, `dark`, `focus-light`, `focus-dark`, `colorsafe-light`, `colorsafe-dark`, `contrast-light`, `contrast-dark`), a family, or `'auto'` (follows the reader). `'light'` / `'dark'` / `'auto'` still work |
86
+ | `reveal` | `'gradual' \| 'instant'` | `'gradual'` | How a layer arrives: ideas bloom in one by one then connectors draw (design-system motion), or everything fades in together |
87
+ | `comfort` | `{ readableType?, largerText?, reducedMotion? }` | — | Reader comfort settings |
88
+ | `respectForcedColors` | `boolean` | `true` | Use the high-contrast theme under forced-colors |
89
+ | `fontBaseUrl` | `string` | jsDelivr copy | Where `Caveat-Variable.ttf` is served from |
90
+ | `loadWebFonts` | `boolean` | `true` | Load Kalam + Atkinson Hyperlegible from Google Fonts |
91
+ | `layout` | `'auto' \| 'touch' \| 'pointer'` | `'auto'` | Touch -> bottom-sheet peek + larger controls; pointer -> floating peek on hover |
86
92
  | `chromaticImmersion` | `boolean` | `false` | Enable background color effects based on layer context |
87
93
  | `useWorker` | `boolean` | `true` | Parse documents in a Web Worker (recommended for large files) |
88
94
  | `width` | `string \| number` | `'100%'` | Width as CSS value or pixel number |
@@ -102,7 +108,9 @@ The low-level canvas component used internally by `VisualliRenderer`. Use this i
102
108
  |------|------|-------------|
103
109
  | `preParsedVisualli` | `VisualliDocument` | Pre-parsed document from `@visualli/core` |
104
110
  | `visualliString` | `string` | Raw JSONL string (parsed on mount) |
105
- | `isDark` | `boolean` | Dark mode flag |
111
+ | `theme` | `ThemeInput` | Same values as `VisualliRenderer` |
112
+ | `isDark` | `boolean` | **Deprecated** — use `theme` (`true` → `'dark'`). Kept for one release |
113
+ | `comfort` | `Comfort` | Readable type, larger text, reduced motion |
106
114
  | `chromaticImmersion` | `boolean` | Enable chromatic background |
107
115
  | `onNodeClick` | `(node: FlatNode) => void` | Callback fired on node click |
108
116
  | `onLayerChange` | `(id: string, layer: VisualliLayer) => void` | Callback fired on layer navigation |
@@ -117,7 +125,7 @@ const document = parseVisualliFile(jsonlString);
117
125
 
118
126
  <VisualliCanvas
119
127
  preParsedVisualli={document}
120
- isDark={true}
128
+ theme="dark"
121
129
  onNodeClick={(node) => console.log('Clicked:', node.data.label)}
122
130
  />
123
131
  ```
@@ -153,7 +161,7 @@ The SDK exports low-level hooks for building custom rendering pipelines:
153
161
 
154
162
  - **`useKonvaRenderer`** — Access the Konva stage and rendering loop
155
163
  - **`useViewportNodes`** — Get nodes currently visible in the viewport (post-culling)
156
- - **`useKonvaLayerTransition`** — Control layer transition animations
164
+ - **`useLayerChoreography`** — Step inside / back out with the design system's motion
157
165
  - **`useVisualli`** — Access the Visualli context (when wrapped in `VisualliProvider`)
158
166
 
159
167
  ## Requirements