@storybook/html 8.0.0-alpha.1 → 8.0.0-alpha.11

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.
@@ -1 +1 @@
1
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var entry_preview_docs_exports={};__export(entry_preview_docs_exports,{argTypesEnhancers:()=>argTypesEnhancers,decorators:()=>decorators,parameters:()=>parameters});module.exports=__toCommonJS(entry_preview_docs_exports);var import_docs_tools2=require("@storybook/docs-tools");var import_docs_tools=require("@storybook/docs-tools"),import_preview_api=require("@storybook/preview-api");function skipSourceRender(context){var _a;let sourceParams=(_a=context==null?void 0:context.parameters.docs)==null?void 0:_a.source,isArgsStory=context==null?void 0:context.parameters.__isArgsStory;return(sourceParams==null?void 0:sourceParams.type)===import_docs_tools.SourceType.DYNAMIC?!1:!isArgsStory||(sourceParams==null?void 0:sourceParams.code)||(sourceParams==null?void 0:sourceParams.type)===import_docs_tools.SourceType.CODE}var sourceDecorator=(storyFn,context)=>{var _a,_b;let story=storyFn(),renderedForSource=(_b=(_a=context==null?void 0:context.parameters.docs)==null?void 0:_a.source)!=null&&_b.excludeDecorators?context.originalStoryFn(context.args,context):story,source;return skipSourceRender(context)||(typeof renderedForSource=="string"?source=renderedForSource:renderedForSource instanceof Element&&(source=renderedForSource.outerHTML)),(0,import_preview_api.useEffect)(()=>{let{id,unmappedArgs}=context;source&&import_preview_api.addons.getChannel().emit(import_docs_tools.SNIPPET_RENDERED,{id,args:unmappedArgs,source})}),story};var decorators=[sourceDecorator],parameters={docs:{story:{inline:!0},source:{type:import_docs_tools2.SourceType.DYNAMIC,language:"html",code:void 0,excludeDecorators:void 0}}},argTypesEnhancers=[import_docs_tools2.enhanceArgTypes];0&&(module.exports={argTypesEnhancers,decorators,parameters});
1
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var entry_preview_docs_exports={};__export(entry_preview_docs_exports,{argTypesEnhancers:()=>argTypesEnhancers,decorators:()=>decorators,parameters:()=>parameters});module.exports=__toCommonJS(entry_preview_docs_exports);var import_docs_tools2=require("@storybook/docs-tools");var import_docs_tools=require("@storybook/docs-tools"),import_preview_api=require("@storybook/preview-api");function skipSourceRender(context){let sourceParams=context?.parameters.docs?.source,isArgsStory=context?.parameters.__isArgsStory;return sourceParams?.type===import_docs_tools.SourceType.DYNAMIC?!1:!isArgsStory||sourceParams?.code||sourceParams?.type===import_docs_tools.SourceType.CODE}var sourceDecorator=(storyFn,context)=>{let story=storyFn(),renderedForSource=context?.parameters.docs?.source?.excludeDecorators?context.originalStoryFn(context.args,context):story,source;return skipSourceRender(context)||(typeof renderedForSource=="string"?source=renderedForSource:renderedForSource instanceof Element&&(source=renderedForSource.outerHTML)),(0,import_preview_api.useEffect)(()=>{let{id,unmappedArgs}=context;source&&import_preview_api.addons.getChannel().emit(import_docs_tools.SNIPPET_RENDERED,{id,args:unmappedArgs,source})}),story};var decorators=[sourceDecorator],parameters={docs:{story:{inline:!0},source:{type:import_docs_tools2.SourceType.DYNAMIC,language:"html",code:void 0,excludeDecorators:void 0}}},argTypesEnhancers=[import_docs_tools2.enhanceArgTypes];0&&(module.exports={argTypesEnhancers,decorators,parameters});
package/dist/index.d.ts CHANGED
@@ -16,24 +16,14 @@ type Meta<TArgs = Args> = ComponentAnnotations<HtmlRenderer, TArgs>;
16
16
  */
17
17
  type StoryFn<TArgs = Args> = AnnotatedStoryFn<HtmlRenderer, TArgs>;
18
18
  /**
19
- * Story function that represents a CSFv3 component example.
19
+ * Story object that represents a CSFv3 component example.
20
20
  *
21
21
  * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
22
22
  */
23
23
  type StoryObj<TArgs = Args> = StoryAnnotations<HtmlRenderer, TArgs>;
24
- /**
25
- * @deprecated Use `StoryFn` instead.
26
- * Use `StoryObj` if you want to migrate to CSF3, which uses objects instead of functions to represent stories.
27
- * You can read more about the CSF3 format here: https://storybook.js.org/blog/component-story-format-3-0/
28
- *
29
- * Story function that represents a CSFv2 component example.
30
- *
31
- * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
32
- */
33
- type Story<TArgs = Args> = StoryFn<TArgs>;
34
24
  type Decorator<TArgs = StrictArgs> = DecoratorFunction<HtmlRenderer, TArgs>;
35
25
  type Loader<TArgs = StrictArgs> = LoaderFunction<HtmlRenderer, TArgs>;
36
26
  type StoryContext<TArgs = StrictArgs> = StoryContext$1<HtmlRenderer, TArgs>;
37
27
  type Preview = ProjectAnnotations<HtmlRenderer>;
38
28
 
39
- export { Decorator, HtmlRenderer, Loader, Meta, Preview, Story, StoryContext, StoryFn, StoryObj };
29
+ export { Decorator, HtmlRenderer, Loader, Meta, Preview, StoryContext, StoryFn, StoryObj };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};module.exports=__toCommonJS(src_exports);var import_global=require("@storybook/global"),{window:globalWindow}=import_global.global;globalWindow.STORYBOOK_ENV="HTML";var _a;typeof module<"u"&&((_a=module==null?void 0:module.hot)==null||_a.decline());
1
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};module.exports=__toCommonJS(src_exports);var import_global=require("@storybook/global"),{window:globalWindow}=import_global.global;globalWindow.STORYBOOK_ENV="HTML";typeof module<"u"&&module?.hot?.decline();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/html",
3
- "version": "8.0.0-alpha.1",
3
+ "version": "8.0.0-alpha.11",
4
4
  "description": "Storybook HTML renderer",
5
5
  "keywords": [
6
6
  "storybook"
@@ -47,20 +47,17 @@
47
47
  "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts"
48
48
  },
49
49
  "dependencies": {
50
- "@storybook/docs-tools": "8.0.0-alpha.1",
50
+ "@storybook/docs-tools": "8.0.0-alpha.11",
51
51
  "@storybook/global": "^5.0.0",
52
- "@storybook/preview-api": "8.0.0-alpha.1",
53
- "@storybook/types": "8.0.0-alpha.1",
52
+ "@storybook/preview-api": "8.0.0-alpha.11",
53
+ "@storybook/types": "8.0.0-alpha.11",
54
54
  "ts-dedent": "^2.0.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "typescript": "^5.3.2"
58
58
  },
59
- "peerDependencies": {
60
- "@babel/core": "*"
61
- },
62
59
  "engines": {
63
- "node": ">=16.0.0"
60
+ "node": ">=18.0.0"
64
61
  },
65
62
  "publishConfig": {
66
63
  "access": "public"
@@ -1,3 +1,4 @@
1
+ import { fn } from '@storybook/test';
1
2
  import { createButton } from './Button';
2
3
 
3
4
  // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
@@ -19,6 +20,8 @@ export default {
19
20
  options: ['small', 'medium', 'large'],
20
21
  },
21
22
  },
23
+ // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
24
+ args: { onClick: fn() },
22
25
  };
23
26
 
24
27
  // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
@@ -1,4 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/html';
2
+ import { fn } from '@storybook/test';
2
3
  import type { ButtonProps } from './Button';
3
4
  import { createButton } from './Button';
4
5
 
@@ -21,6 +22,8 @@ const meta: Meta<ButtonProps> = {
21
22
  options: ['small', 'medium', 'large'],
22
23
  },
23
24
  },
25
+ // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
26
+ args: { onClick: fn() },
24
27
  };
25
28
 
26
29
  export default meta;
@@ -3,9 +3,9 @@ import { createButton } from './Button';
3
3
 
4
4
  export interface HeaderProps {
5
5
  user?: { name: string };
6
- onLogin: () => void;
7
- onLogout: () => void;
8
- onCreateAccount: () => void;
6
+ onLogin?: () => void;
7
+ onLogout?: () => void;
8
+ onCreateAccount?: () => void;
9
9
  }
10
10
 
11
11
  export const createHeader = ({ user, onLogout, onLogin, onCreateAccount }: HeaderProps) => {
@@ -1,4 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/html';
2
+ import { fn } from '@storybook/test';
2
3
  import type { ButtonProps } from './Button';
3
4
  import { createButton } from './Button';
4
5
 
@@ -21,6 +22,8 @@ const meta = {
21
22
  options: ['small', 'medium', 'large'],
22
23
  },
23
24
  },
25
+ // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
26
+ args: { onClick: fn() },
24
27
  } satisfies Meta<ButtonProps>;
25
28
 
26
29
  export default meta;
@@ -3,9 +3,9 @@ import { createButton } from './Button';
3
3
 
4
4
  export interface HeaderProps {
5
5
  user?: { name: string };
6
- onLogin: () => void;
7
- onLogout: () => void;
8
- onCreateAccount: () => void;
6
+ onLogin?: () => void;
7
+ onLogout?: () => void;
8
+ onCreateAccount?: () => void;
9
9
  }
10
10
 
11
11
  export const createHeader = ({ user, onLogout, onLogin, onCreateAccount }: HeaderProps) => {
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  export const Button = (args) => {
3
2
  const button = document.createElement('button');
4
3
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  export const Form = ({ onSuccess }) => {
3
2
  const container = document.createElement('div');
4
3
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  export const Pre = (args) => {
3
2
  const pre = document.createElement('pre');
4
3
 
package/jest.config.js DELETED
@@ -1,7 +0,0 @@
1
- const path = require('path');
2
- const baseConfig = require('../../jest.config.browser');
3
-
4
- module.exports = {
5
- ...baseConfig,
6
- displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep),
7
- };