@dfosco/storyboard-core 4.2.1 → 4.2.2
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 +1 -1
- package/src/loader.js +9 -2
package/package.json
CHANGED
package/src/loader.js
CHANGED
|
@@ -392,11 +392,18 @@ export function listStories() {
|
|
|
392
392
|
/**
|
|
393
393
|
* Returns story data by name.
|
|
394
394
|
* Story entries include `_storyModule` (path) and `_storyImport` (dynamic import function).
|
|
395
|
-
*
|
|
395
|
+
* Accepts both flat names ("product-card") and scoped names ("folder/product-card") —
|
|
396
|
+
* if an exact match isn't found and the name contains a slash, tries the basename.
|
|
397
|
+
* @param {string} name - Story name (e.g. "button-patterns" or "explorations/button-patterns")
|
|
396
398
|
* @returns {object|null} Story data with import function, or null
|
|
397
399
|
*/
|
|
398
400
|
export function getStoryData(name) {
|
|
399
|
-
|
|
401
|
+
if (dataIndex.stories[name]) return dataIndex.stories[name]
|
|
402
|
+
if (name && name.includes('/')) {
|
|
403
|
+
const basename = name.split('/').pop()
|
|
404
|
+
if (dataIndex.stories[basename]) return dataIndex.stories[basename]
|
|
405
|
+
}
|
|
406
|
+
return null
|
|
400
407
|
}
|
|
401
408
|
|
|
402
409
|
export { deepMerge }
|