@dfosco/storyboard-react 4.1.0-beta.1 → 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`
|
package/src/context.jsx
CHANGED
|
@@ -10,6 +10,7 @@ export { StoryboardContext }
|
|
|
10
10
|
|
|
11
11
|
const CanvasPageLazy = lazy(() => import('./canvas/CanvasPage.jsx'))
|
|
12
12
|
const StoryPageLazy = lazy(() => import('./story/StoryPage.jsx'))
|
|
13
|
+
const CommandPaletteLazy = lazy(() => import('./CommandPalette/CommandPalette.jsx'))
|
|
13
14
|
|
|
14
15
|
// Build a map from canvas route paths → canvas names at module load time
|
|
15
16
|
const canvasRouteMap = new Map()
|
|
@@ -115,6 +116,26 @@ function getPageFlowName(pathname) {
|
|
|
115
116
|
* The matched record entry is injected under the "record" key in flow data.
|
|
116
117
|
*/
|
|
117
118
|
export default function StoryboardProvider({ flowName, sceneName, recordName, recordParam, children }) {
|
|
119
|
+
const basePath = import.meta.env?.BASE_URL || '/'
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
<StoryboardProviderInner
|
|
124
|
+
flowName={flowName}
|
|
125
|
+
sceneName={sceneName}
|
|
126
|
+
recordName={recordName}
|
|
127
|
+
recordParam={recordParam}
|
|
128
|
+
>
|
|
129
|
+
{children}
|
|
130
|
+
</StoryboardProviderInner>
|
|
131
|
+
<Suspense fallback={null}>
|
|
132
|
+
<CommandPaletteLazy basePath={basePath} />
|
|
133
|
+
</Suspense>
|
|
134
|
+
</>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function StoryboardProviderInner({ flowName, sceneName, recordName, recordParam, children }) {
|
|
118
139
|
const location = useLocation()
|
|
119
140
|
const params = useParams()
|
|
120
141
|
|