storybook-addon-sdc 0.1.2 → 0.1.4
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/dist/preset.js +34 -34
- package/package.json +1 -1
package/dist/preset.js
CHANGED
|
@@ -5527,40 +5527,40 @@ var argTypesGenerator_default = (content) => {
|
|
|
5527
5527
|
|
|
5528
5528
|
// src/storiesGenerator.ts
|
|
5529
5529
|
init_esm_shims();
|
|
5530
|
+
var extractArgsAndSlots = (input) => {
|
|
5531
|
+
const args = {};
|
|
5532
|
+
const slots = {};
|
|
5533
|
+
for (const key in input) {
|
|
5534
|
+
const value = input[key];
|
|
5535
|
+
if (Array.isArray(value)) {
|
|
5536
|
+
value.forEach((item) => {
|
|
5537
|
+
if (item.type === "component") {
|
|
5538
|
+
const componentName = item.component.split(":").pop();
|
|
5539
|
+
const kebabCaseName = componentName.replace(/-/g, "");
|
|
5540
|
+
const componentProps = {
|
|
5541
|
+
...item.props || {},
|
|
5542
|
+
...item.slots || {}
|
|
5543
|
+
};
|
|
5544
|
+
const componentContent = `\${${kebabCaseName}.component(${JSON.stringify(componentProps)})}`;
|
|
5545
|
+
slots[key] = (slots[key] || "") + componentContent;
|
|
5546
|
+
} else {
|
|
5547
|
+
slots[key] = (slots[key] || "") + `${item}`;
|
|
5548
|
+
}
|
|
5549
|
+
});
|
|
5550
|
+
} else if (typeof value === "object" && value !== null) {
|
|
5551
|
+
const nested = extractArgsAndSlots(value);
|
|
5552
|
+
Object.assign(args, nested.args);
|
|
5553
|
+
Object.entries(nested.slots).forEach(([nestedKey, nestedContent]) => {
|
|
5554
|
+
slots[nestedKey] = (slots[nestedKey] || "") + nestedContent;
|
|
5555
|
+
});
|
|
5556
|
+
} else {
|
|
5557
|
+
args[key] = value;
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5560
|
+
return { args, slots };
|
|
5561
|
+
};
|
|
5530
5562
|
var storiesGenerator_default = (stories) => {
|
|
5531
5563
|
const generatedStories = [];
|
|
5532
|
-
const extractArgsAndSlots = (input) => {
|
|
5533
|
-
const args = {};
|
|
5534
|
-
const slots = {};
|
|
5535
|
-
for (const key in input) {
|
|
5536
|
-
const value = input[key];
|
|
5537
|
-
if (Array.isArray(value)) {
|
|
5538
|
-
value.forEach((item) => {
|
|
5539
|
-
if (item.type === "component") {
|
|
5540
|
-
const componentName = item.component.split(":").pop();
|
|
5541
|
-
const kebabCaseName = componentName.replace(/-/g, "");
|
|
5542
|
-
const componentProps = {
|
|
5543
|
-
...item.props || {},
|
|
5544
|
-
...item.slots || {}
|
|
5545
|
-
};
|
|
5546
|
-
const componentContent = `\${${kebabCaseName}.component(${JSON.stringify(componentProps)})}`;
|
|
5547
|
-
slots[key] = (slots[key] || "") + componentContent;
|
|
5548
|
-
} else {
|
|
5549
|
-
slots[key] = (slots[key] || "") + `${item}`;
|
|
5550
|
-
}
|
|
5551
|
-
});
|
|
5552
|
-
} else if (typeof value === "object" && value !== null) {
|
|
5553
|
-
const nested = extractArgsAndSlots(value);
|
|
5554
|
-
Object.assign(args, nested.args);
|
|
5555
|
-
Object.entries(nested.slots).forEach(([nestedKey, nestedContent]) => {
|
|
5556
|
-
slots[nestedKey] = (slots[nestedKey] || "") + nestedContent;
|
|
5557
|
-
});
|
|
5558
|
-
} else {
|
|
5559
|
-
args[key] = value;
|
|
5560
|
-
}
|
|
5561
|
-
}
|
|
5562
|
-
return { args, slots };
|
|
5563
|
-
};
|
|
5564
5564
|
Object.entries(stories).forEach(([storyKey, story]) => {
|
|
5565
5565
|
const { args, slots } = extractArgsAndSlots(story);
|
|
5566
5566
|
Object.entries(slots).forEach(([slotName, content]) => {
|
|
@@ -5603,7 +5603,7 @@ var generateImports = (directory) => {
|
|
|
5603
5603
|
return assets.reduce((imports, asset) => {
|
|
5604
5604
|
const assetPath = `./${asset}`;
|
|
5605
5605
|
const extension = extname(asset);
|
|
5606
|
-
if ([".css", ".js"].includes(extension)) {
|
|
5606
|
+
if ([".css", ".js", ".mjs"].includes(extension)) {
|
|
5607
5607
|
return `${imports} import '${assetPath}';
|
|
5608
5608
|
`;
|
|
5609
5609
|
}
|
|
@@ -5640,7 +5640,7 @@ var dynamicImports = (stories) => {
|
|
|
5640
5640
|
});
|
|
5641
5641
|
return Array.from(imports).join("\n");
|
|
5642
5642
|
};
|
|
5643
|
-
var vite_plugin_storybook_yaml_stories_default = async ({ jsonSchemaFakerOptions }) => {
|
|
5643
|
+
var vite_plugin_storybook_yaml_stories_default = async ({ jsonSchemaFakerOptions = {} }) => {
|
|
5644
5644
|
return {
|
|
5645
5645
|
name: "vite-plugin-storybook-yaml-stories",
|
|
5646
5646
|
async load(id) {
|