storybook-framework-qwik 0.0.7 → 0.1.0
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/component-to-jsx.d.ts +3 -0
- package/dist/component-to-jsx.js +4 -0
- package/dist/index.d.ts +0 -1
- package/dist/preset.d.ts +4 -4
- package/dist/preset.js +1 -1
- package/dist/preview.js +3 -2
- package/dist/qwik-city-decorator.js +2 -4
- package/dist/types.d.ts +6 -1
- package/package.json +10 -6
- package/src/typings.d.ts +1 -0
- package/template/cli/button.tsx +1 -1
- package/template/cli/story-example.stories.tsx +8 -7
package/dist/index.d.ts
CHANGED
package/dist/preset.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const core:
|
|
3
|
-
export declare const viteFinal:
|
|
4
|
-
export declare const previewAnnotations:
|
|
1
|
+
import type { StorybookViteConfig } from '@storybook/builder-vite';
|
|
2
|
+
export declare const core: StorybookViteConfig['core'];
|
|
3
|
+
export declare const viteFinal: StorybookViteConfig['viteFinal'];
|
|
4
|
+
export declare const previewAnnotations: StorybookViteConfig['previewAnnotations'];
|
|
5
5
|
export declare const previewHead: (head: string) => string;
|
package/dist/preset.js
CHANGED
package/dist/preview.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { render as renderQwik } from '@builder.io/qwik';
|
|
2
|
+
import { componentToJSX } from './component-to-jsx.js';
|
|
2
3
|
// returns the Qwik component as a JSX element (</MyComponent>)
|
|
3
4
|
// If a story has a custom renderer, it will replace this function.
|
|
4
5
|
export const render = (args, context) => {
|
|
5
6
|
const { component } = context;
|
|
6
7
|
if (typeof component === 'function') {
|
|
7
|
-
return component
|
|
8
|
+
return componentToJSX(component, args);
|
|
8
9
|
}
|
|
9
10
|
return component;
|
|
10
11
|
};
|
|
@@ -15,7 +16,7 @@ export async function renderToCanvas({ storyFn, showMain }, canvasElement) {
|
|
|
15
16
|
canvasElement.append(container);
|
|
16
17
|
showMain();
|
|
17
18
|
}
|
|
18
|
-
// I don't know how to
|
|
19
|
+
// I don't know how to do HMR stuff correctly, and Vite seems to keep referencing old files when you make a change.
|
|
19
20
|
// Force a reload when vite notifies of an update as a dirty temporary workaround.
|
|
20
21
|
const viteHotMeta = import.meta.hot;
|
|
21
22
|
if (viteHotMeta) {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "
|
|
1
|
+
import { jsx as _jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
2
|
import { QwikCityMockProvider } from '@builder.io/qwik-city';
|
|
3
3
|
/** Wraps story in QwikCityMockProvider */
|
|
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() }));
|
|
4
|
+
export const qwikCityDecorator = (Story) => (_jsx(QwikCityMockProvider, { children: Story() }));
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component } from '@builder.io/qwik';
|
|
2
2
|
import { WebRenderer } from '@storybook/types';
|
|
3
3
|
export type { Args, ArgTypes, Parameters, StrictArgs } from '@storybook/types';
|
|
4
|
-
import type { AnnotatedStoryFn, Args, ComponentAnnotations, StoryAnnotations, DecoratorFunction, LoaderFunction, StoryContext as GenericStoryContext, StrictArgs } from '@storybook/types';
|
|
4
|
+
import type { AnnotatedStoryFn, Args, ComponentAnnotations, StoryAnnotations, DecoratorFunction, LoaderFunction, StoryContext as GenericStoryContext, StrictArgs, StorybookConfig as StorybookConfigBase } from '@storybook/types';
|
|
5
5
|
export interface QwikRenderer<T> extends WebRenderer {
|
|
6
6
|
component: Component<T>;
|
|
7
7
|
storyResult: ReturnType<Component<T>>;
|
|
@@ -27,3 +27,8 @@ export type StoryObj<TArgs = Args> = StoryAnnotations<QwikRenderer<TArgs>, TArgs
|
|
|
27
27
|
export type Decorator<TArgs = StrictArgs> = DecoratorFunction<QwikRenderer<TArgs>, TArgs>;
|
|
28
28
|
export type Loader<TArgs = StrictArgs> = LoaderFunction<QwikRenderer<TArgs>, TArgs>;
|
|
29
29
|
export type StoryContext<TArgs = StrictArgs> = GenericStoryContext<QwikRenderer<TArgs>, TArgs>;
|
|
30
|
+
export type StorybookConfig = Omit<StorybookConfigBase, 'framework'> & {
|
|
31
|
+
framework: 'storybook-framework-qwik' | {
|
|
32
|
+
name: 'storybook-framework-qwik';
|
|
33
|
+
};
|
|
34
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybook-framework-qwik",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Storybook for Qwik: View Qwik components in isolation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -76,10 +76,11 @@
|
|
|
76
76
|
"types": "dist/index.d.ts",
|
|
77
77
|
"scripts": {
|
|
78
78
|
"watch": "tsc --watch --outDir ./dist --listEmittedFiles",
|
|
79
|
-
"build": "tsc --outDir ./dist --listEmittedFiles"
|
|
79
|
+
"build": "tsc --outDir ./dist --listEmittedFiles",
|
|
80
|
+
"semantic-release": "semantic-release"
|
|
80
81
|
},
|
|
81
82
|
"dependencies": {
|
|
82
|
-
"@storybook/builder-vite": "
|
|
83
|
+
"@storybook/builder-vite": ">=7.0.0-beta.7"
|
|
83
84
|
},
|
|
84
85
|
"peerDependencies": {
|
|
85
86
|
"@builder.io/qwik": ">=0.15.2"
|
|
@@ -88,8 +89,11 @@
|
|
|
88
89
|
"@builder.io/qwik-city": ">=0.0.128"
|
|
89
90
|
},
|
|
90
91
|
"devDependencies": {
|
|
91
|
-
"@
|
|
92
|
-
"
|
|
92
|
+
"@suin/semantic-release-yarn": "1.1.0",
|
|
93
|
+
"@types/node": "^18",
|
|
94
|
+
"semantic-release": "^21.0.0",
|
|
95
|
+
"typescript": "~5.0.2",
|
|
96
|
+
"vite": "^4.2.1"
|
|
93
97
|
},
|
|
94
98
|
"engines": {
|
|
95
99
|
"node": "^14.18 || >=16"
|
|
@@ -97,4 +101,4 @@
|
|
|
97
101
|
"publishConfig": {
|
|
98
102
|
"access": "public"
|
|
99
103
|
}
|
|
100
|
-
}
|
|
104
|
+
}
|
package/src/typings.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'global';
|
package/template/cli/button.tsx
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta } from 'storybook-framework-qwik';
|
|
3
|
+
import { StoryExample, StoryExampleProps } from './story-example';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
|
-
title:
|
|
6
|
+
title: 'Story Example',
|
|
6
7
|
args: {
|
|
7
|
-
label:
|
|
8
|
-
color:
|
|
8
|
+
label: 'Example label',
|
|
9
|
+
color: 'red',
|
|
9
10
|
},
|
|
10
11
|
argTypes: {
|
|
11
12
|
color: {
|
|
12
|
-
options: [
|
|
13
|
+
options: ['red', 'green', 'blue'],
|
|
13
14
|
control: {
|
|
14
|
-
type:
|
|
15
|
+
type: 'select',
|
|
15
16
|
},
|
|
16
17
|
},
|
|
17
18
|
},
|