@dfosco/storyboard-react 4.1.0-beta.2 → 4.1.0-beta.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,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dfosco/storyboard-react",
|
|
3
|
-
"version": "4.1.0-beta.
|
|
3
|
+
"version": "4.1.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@base-ui/react": "^1.4.0",
|
|
7
|
-
"@dfosco/storyboard-core": "4.1.0-beta.
|
|
8
|
-
"@dfosco/tiny-canvas": "4.1.0-beta.
|
|
7
|
+
"@dfosco/storyboard-core": "4.1.0-beta.3",
|
|
8
|
+
"@dfosco/tiny-canvas": "4.1.0-beta.3",
|
|
9
9
|
"@neodrag/react": "^2.3.1",
|
|
10
10
|
"glob": "^11.0.0",
|
|
11
11
|
"jsonc-parser": "^3.3.1",
|
package/src/canvas/useCanvas.js
CHANGED
|
@@ -6,6 +6,8 @@ import { getCanvasData } from '@dfosco/storyboard-core'
|
|
|
6
6
|
* Falls back to build-time data if the server is unavailable.
|
|
7
7
|
*/
|
|
8
8
|
async function fetchCanvasFromServer(name) {
|
|
9
|
+
// Canvas server API is only available during local dev
|
|
10
|
+
if (import.meta.env?.PROD) return null
|
|
9
11
|
try {
|
|
10
12
|
const base = (import.meta.env?.BASE_URL || '/').replace(/\/$/, '')
|
|
11
13
|
const res = await fetch(`${base}/_storyboard/canvas/read?name=${encodeURIComponent(name)}`)
|
|
@@ -24,6 +24,9 @@ const ImageWidget = forwardRef(function ImageWidget({ props, onUpdate, resizable
|
|
|
24
24
|
|
|
25
25
|
const src = readProp(props, 'src', imageSchema)
|
|
26
26
|
const isPrivate = readProp(props, 'private', imageSchema)
|
|
27
|
+
|
|
28
|
+
// Private images are not included in production builds
|
|
29
|
+
const isHiddenInProd = isPrivate && import.meta.env?.PROD
|
|
27
30
|
const width = readProp(props, 'width', imageSchema)
|
|
28
31
|
const height = readProp(props, 'height', imageSchema)
|
|
29
32
|
|
|
@@ -77,7 +80,7 @@ const ImageWidget = forwardRef(function ImageWidget({ props, onUpdate, resizable
|
|
|
77
80
|
}
|
|
78
81
|
}), [src, onUpdate])
|
|
79
82
|
|
|
80
|
-
if (!src) return null
|
|
83
|
+
if (!src || isHiddenInProd) return null
|
|
81
84
|
|
|
82
85
|
const sizeStyle = {}
|
|
83
86
|
if (typeof width === 'number') sizeStyle.width = `${width}px`
|