@dfosco/storyboard-react 3.11.2 → 3.11.3

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 CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dfosco/storyboard-react",
3
- "version": "3.11.2",
3
+ "version": "3.11.3",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "@dfosco/storyboard-core": "3.11.2",
7
- "@dfosco/tiny-canvas": "3.11.2",
6
+ "@dfosco/storyboard-core": "3.11.3",
7
+ "@dfosco/tiny-canvas": "3.11.3",
8
8
  "@neodrag/react": "^2.3.1",
9
9
  "glob": "^11.0.0",
10
10
  "jsonc-parser": "^3.3.1"
@@ -863,7 +863,7 @@ export default function CanvasPage({ name }) {
863
863
  function handleSnapToggle() {
864
864
  setSnapEnabled((prev) => {
865
865
  const next = !prev
866
- updateCanvas(name, { snapToGrid: next }).catch((err) =>
866
+ updateCanvas(name, { settings: { snapToGrid: next } }).catch((err) =>
867
867
  console.error('[canvas] Failed to persist snap setting:', err)
868
868
  )
869
869
  return next
@@ -922,12 +922,15 @@ export default function CanvasPage({ name }) {
922
922
  return () => document.removeEventListener('storyboard:canvas:zoom-to-fit', handleZoomToFit)
923
923
  }, [localWidgets, localSources, jsxExports])
924
924
 
925
- // On initial load without a ?widget= deep link, zoom to fit all objects
925
+ // On initial load without a ?widget= deep link, zoom to fit all objects.
926
+ // Wait for jsxExports when the canvas has a JSX module so components are
927
+ // included in the bounding-box calculation.
926
928
  useEffect(() => {
927
929
  if (loading || initialWidgetParam.current) return
930
+ if (canvas?._jsxModule && !jsxExports) return
928
931
  initialWidgetParam.current = true // only once
929
932
  document.dispatchEvent(new CustomEvent('storyboard:canvas:zoom-to-fit'))
930
- }, [loading])
933
+ }, [loading, jsxExports, canvas])
931
934
 
932
935
  // Canvas background should follow toolbar theme target.
933
936
  useEffect(() => {