@dfosco/storyboard-react 1.13.0 → 1.15.0
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
package/src/Viewfinder.jsx
CHANGED
package/src/context.jsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { useMemo } from 'react'
|
|
1
|
+
import { useEffect, useMemo } from 'react'
|
|
3
2
|
import { useParams, useLocation } from 'react-router-dom'
|
|
4
3
|
// Side-effect import: seeds the core data index via init()
|
|
5
4
|
import 'virtual:storyboard-data-index'
|
|
6
|
-
import { loadScene, sceneExists, findRecord, deepMerge, setSceneClass } from '@dfosco/storyboard-core'
|
|
5
|
+
import { loadScene, sceneExists, findRecord, deepMerge, setSceneClass, installBodyClassSync } from '@dfosco/storyboard-core'
|
|
7
6
|
import { StoryboardContext } from './StoryboardContext.js'
|
|
8
7
|
|
|
9
8
|
export { StoryboardContext }
|
|
@@ -34,6 +33,9 @@ export default function StoryboardProvider({ sceneName, recordName, recordParam,
|
|
|
34
33
|
const activeSceneName = sceneParam || sceneName || (sceneExists(pageScene) ? pageScene : 'default')
|
|
35
34
|
const params = useParams()
|
|
36
35
|
|
|
36
|
+
// Auto-install body class sync (sb-key--value classes on <body>)
|
|
37
|
+
useEffect(() => installBodyClassSync(), [])
|
|
38
|
+
|
|
37
39
|
const { data, error } = useMemo(() => {
|
|
38
40
|
try {
|
|
39
41
|
let sceneData = loadScene(activeSceneName)
|
|
@@ -51,7 +53,7 @@ export default function StoryboardProvider({ sceneName, recordName, recordParam,
|
|
|
51
53
|
} catch (err) {
|
|
52
54
|
return { data: null, error: err.message }
|
|
53
55
|
}
|
|
54
|
-
}, [activeSceneName, recordName, recordParam, params
|
|
56
|
+
}, [activeSceneName, recordName, recordParam, params])
|
|
55
57
|
|
|
56
58
|
const value = {
|
|
57
59
|
data,
|
package/src/context.test.jsx
CHANGED
|
@@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react'
|
|
|
2
2
|
import { useContext } from 'react'
|
|
3
3
|
import { init } from '@dfosco/storyboard-core'
|
|
4
4
|
import StoryboardProvider, { StoryboardContext } from './context.jsx'
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
|
|
7
7
|
const mockUseLocation = vi.fn(() => ({ pathname: '/', search: '', hash: '' }))
|
|
8
8
|
|
package/src/vite/data-plugin.js
CHANGED