storybook-framework-qwik 0.0.6 → 0.0.7
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 +3 -0
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +2 -4
- package/dist/qwik-city-decorator.js +4 -10
- package/package.json +1 -1
package/dist/preset.js
CHANGED
|
@@ -13,6 +13,9 @@ export const viteFinal = async (defaultConfig, options) => {
|
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
|
+
// Qwik-city plugin may be used in apps, but it has mdx stuff that conflicts with Storybook mdx
|
|
17
|
+
// we'll try to only remove the transform code (where the mdx stuff is), and keep everything else.
|
|
18
|
+
config.plugins = config.plugins.map((plugin) => plugin.name === 'vite-plugin-qwik-city' ? { ...plugin, transform: () => null } : plugin);
|
|
16
19
|
return config;
|
|
17
20
|
};
|
|
18
21
|
export const previewAnnotations = (entry = []) => [
|
package/dist/preview.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ArgsStoryFn, RenderContext } from '@storybook/types';
|
|
2
2
|
import { QwikRenderer } from './types.js';
|
|
3
3
|
export declare const render: ArgsStoryFn<QwikRenderer<unknown>>;
|
|
4
|
-
export declare function renderToCanvas<T>({ storyFn, showMain
|
|
4
|
+
export declare function renderToCanvas<T>({ storyFn, showMain }: RenderContext<QwikRenderer<T>>, canvasElement: QwikRenderer<T>['canvasElement']): Promise<void>;
|
package/dist/preview.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { render as renderQwik } from '@builder.io/qwik';
|
|
2
|
-
import { jsx as _jsx } from '@builder.io/qwik/jsx-runtime';
|
|
3
2
|
// returns the Qwik component as a JSX element (</MyComponent>)
|
|
4
3
|
// If a story has a custom renderer, it will replace this function.
|
|
5
4
|
export const render = (args, context) => {
|
|
@@ -9,10 +8,9 @@ export const render = (args, context) => {
|
|
|
9
8
|
}
|
|
10
9
|
return component;
|
|
11
10
|
};
|
|
12
|
-
export async function renderToCanvas({ storyFn, showMain
|
|
11
|
+
export async function renderToCanvas({ storyFn, showMain }, canvasElement) {
|
|
13
12
|
const container = document.createElement('div');
|
|
14
|
-
|
|
15
|
-
await renderQwik(container, tree);
|
|
13
|
+
await renderQwik(container, storyFn());
|
|
16
14
|
canvasElement.childNodes.forEach((c) => c.remove());
|
|
17
15
|
canvasElement.append(container);
|
|
18
16
|
showMain();
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx } from
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { QwikCityMockProvider } from '@builder.io/qwik-city';
|
|
3
3
|
/** Wraps story in QwikCityMockProvider */
|
|
4
|
-
export const qwikCityDecorator = (Story) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const tree = _jsx(QwikCityMockProvider, // avoid qwik-city types in return type
|
|
8
|
-
{
|
|
9
|
-
children: storyNode,
|
|
10
|
-
}, 'QwikCityMockProvider');
|
|
11
|
-
return tree;
|
|
12
|
-
};
|
|
4
|
+
export const qwikCityDecorator = (Story) =>
|
|
5
|
+
// Something is out of sync with the JSXNode generated here and the type expected by Decorator
|
|
6
|
+
(_jsx(QwikCityMockProvider, { children: Story() }));
|