@vueless/storybook 0.0.48 → 0.0.49
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.
|
@@ -25,7 +25,7 @@ export const vue3SourceDecorator = makeDecorator({
|
|
|
25
25
|
|
|
26
26
|
async function setSourceCode() {
|
|
27
27
|
try {
|
|
28
|
-
const src = context.originalStoryFn(context.args).template;
|
|
28
|
+
const src = context.originalStoryFn(context.args, context.argTypes).template;
|
|
29
29
|
const code = templateSourceCode(src, context.args, context.argTypes);
|
|
30
30
|
const channel = addons.getChannel();
|
|
31
31
|
|
|
@@ -113,12 +113,16 @@ function propToSource(key, val) {
|
|
|
113
113
|
case "string":
|
|
114
114
|
return `${key}="${val}"`;
|
|
115
115
|
case "object":
|
|
116
|
-
return `:${key}="${
|
|
116
|
+
return `:${key}="${getObjectValue(val)}"`;
|
|
117
117
|
default:
|
|
118
118
|
return `:${key}="${val}"`;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
function getObjectValue(value) {
|
|
123
|
+
return JSON.stringify(value).replaceAll('"', "'");
|
|
124
|
+
}
|
|
125
|
+
|
|
122
126
|
function kebabCase(str) {
|
|
123
127
|
return str
|
|
124
128
|
.split("")
|
package/.storybook/preview.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { setup } from "@storybook/vue3";
|
|
2
|
+
import { getRandomId } from "vueless/utils/utilUI.js";
|
|
3
|
+
import { DARK_MODE_SELECTOR, LIGHT_MODE_SELECTOR } from "vueless/constants.js";
|
|
2
4
|
|
|
3
5
|
import themeLight from "./themes/themeLight.js";
|
|
4
6
|
import themeDark from "./themes/themeDark.js";
|
|
5
7
|
import themeLightDocs from "./themes/themeLightDocs.js";
|
|
6
8
|
import { storyDarkModeDecorator } from "./decorators/storyDarkModeDecorator.js";
|
|
7
9
|
import { vue3SourceDecorator } from "./decorators/vue3SourceDecorator.js";
|
|
8
|
-
import { DARK_MODE_SELECTOR, LIGHT_MODE_SELECTOR } from "vueless/constants.js";
|
|
9
10
|
|
|
10
11
|
/* Tailwind styles */
|
|
11
12
|
import "./index.css";
|
|
@@ -15,11 +16,11 @@ import { createVueless } from "vueless";
|
|
|
15
16
|
import { createRouter, createWebHistory } from "vue-router";
|
|
16
17
|
|
|
17
18
|
/* Setup storybook */
|
|
18
|
-
setup((app
|
|
19
|
+
setup((app) => {
|
|
19
20
|
const vueless = createVueless();
|
|
20
21
|
const router = createRouter({ history: createWebHistory(), routes: [] });
|
|
21
22
|
|
|
22
|
-
app.config.idPrefix =
|
|
23
|
+
app.config.idPrefix = getRandomId();
|
|
23
24
|
|
|
24
25
|
if (!app._context.config.globalProperties.$route) {
|
|
25
26
|
app.use(router);
|