@vueless/storybook 0.0.52 → 0.0.53

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.
@@ -5,6 +5,7 @@ export const vue3SourceDecorator = makeDecorator({
5
5
  name: "vue3SourceDecorator",
6
6
  wrapper: (storyFn, context) => {
7
7
  const story = storyFn(context);
8
+ const urlArgs = getArgsFromUrl();
8
9
  const [, updateArgs] = useArgs();
9
10
 
10
11
  // this returns a new component that computes the source code when mounted
@@ -14,6 +15,8 @@ export const vue3SourceDecorator = makeDecorator({
14
15
  components: { story },
15
16
  setup() {
16
17
  onMounted(async () => {
18
+ updateArgs({ ...context.args, ...urlArgs });
19
+
17
20
  await setSourceCode();
18
21
  });
19
22
 
@@ -133,3 +136,18 @@ function kebabCase(str) {
133
136
  })
134
137
  .join("");
135
138
  }
139
+
140
+ function getArgsFromUrl() {
141
+ const params = new URLSearchParams(window.location.search);
142
+ const args = params.get("args");
143
+
144
+ if (!args) return {};
145
+
146
+ return args.split(";").reduce((acc, pair) => {
147
+ const [key, value] = pair.split(":");
148
+
149
+ acc[key] = decodeURIComponent(value);
150
+
151
+ return acc;
152
+ }, {});
153
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/storybook",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "description": "Simplifies Storybook configuration for Vueless UI library.",
5
5
  "homepage": "https://vueless.com",
6
6
  "author": "Johnny Grid",