@storybook/html
Advanced tools
Comparing version 0.0.0-pr-28882-sha-90fe4bc9 to 0.0.0-pr-28882-sha-a04fe375
@@ -1,2 +0,2 @@ | ||
import { Args, ComponentAnnotations, AnnotatedStoryFn, StoryAnnotations, StrictArgs, DecoratorFunction, LoaderFunction, StoryContext as StoryContext$1, ProjectAnnotations } from 'storybook/internal/types'; | ||
import { Args, ComponentAnnotations, AnnotatedStoryFn, StoryAnnotations, StrictArgs, DecoratorFunction, LoaderFunction, StoryContext as StoryContext$1, ProjectAnnotations, NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from 'storybook/internal/types'; | ||
export { ArgTypes, Args, Parameters, StrictArgs } from 'storybook/internal/types'; | ||
@@ -29,2 +29,23 @@ import { H as HtmlRenderer } from './types-19e12ec7.js'; | ||
export { Decorator, HtmlRenderer, Loader, Meta, Preview, StoryContext, StoryFn, StoryObj }; | ||
/** | ||
* Function that sets the globalConfig of your storybook. The global config is the preview module of | ||
* your .storybook folder. | ||
* | ||
* It should be run a single time, so that your global config (e.g. decorators) is applied to your | ||
* stories when using `composeStories` or `composeStory`. | ||
* | ||
* Example: | ||
* | ||
* ```jsx | ||
* // setup-file.js | ||
* import { setProjectAnnotations } from '@storybook/preact'; | ||
* import projectAnnotations from './.storybook/preview'; | ||
* | ||
* setProjectAnnotations(projectAnnotations); | ||
* ``` | ||
* | ||
* @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview') | ||
*/ | ||
declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<HtmlRenderer>; | ||
export { Decorator, HtmlRenderer, Loader, Meta, Preview, StoryContext, StoryFn, StoryObj, setProjectAnnotations }; |
@@ -1,1 +0,7 @@ | ||
"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(); | ||
"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 src_exports={};__export(src_exports,{setProjectAnnotations:()=>setProjectAnnotations});module.exports=__toCommonJS(src_exports);var import_global=require("@storybook/global"),{window:globalWindow}=import_global.global;globalWindow.STORYBOOK_ENV="HTML";var import_preview_api2=require("storybook/internal/preview-api");var entry_preview_exports={};__export(entry_preview_exports,{parameters:()=>parameters,render:()=>render,renderToCanvas:()=>renderToCanvas});var import_preview_api=require("storybook/internal/preview-api"),import_global2=require("@storybook/global"),import_ts_dedent=require("ts-dedent"),{Node}=import_global2.global,render=(args,context)=>{let{id,component:Component}=context;if(typeof Component=="string"){let output=Component;return Object.keys(args).forEach(key=>{output=output.replace(`{{${key}}}`,args[key])}),output}if(Component instanceof HTMLElement){let output=Component.cloneNode(!0);return Object.keys(args).forEach(key=>{output.setAttribute(key,typeof args[key]=="string"?args[key]:JSON.stringify(args[key]))}),output}if(typeof Component=="function")return Component(args,context);throw console.warn(import_ts_dedent.dedent` | ||
Storybook's HTML renderer only supports rendering DOM elements and strings. | ||
Received: ${Component} | ||
`),new Error(`Unable to render story ${id}`)};function renderToCanvas({storyFn,kind,name,showMain,showError,forceRemount},canvasElement){let element=storyFn();if(showMain(),typeof element=="string")canvasElement.innerHTML=element,(0,import_preview_api.simulatePageLoad)(canvasElement);else if(element instanceof Node){if(canvasElement.firstChild===element&&forceRemount===!1)return;canvasElement.innerHTML="",canvasElement.appendChild(element),(0,import_preview_api.simulateDOMContentLoaded)()}else showError({title:`Expecting an HTML snippet or DOM node from the story: "${name}" of "${kind}".`,description:import_ts_dedent.dedent` | ||
Did you forget to return the HTML snippet from the story? | ||
Use "() => <your snippet or node>" or when defining the story. | ||
`})}var parameters={renderer:"html"};function setProjectAnnotations(projectAnnotations){return(0,import_preview_api2.setDefaultProjectAnnotations)(entry_preview_exports),(0,import_preview_api2.setProjectAnnotations)(projectAnnotations)}typeof module<"u"&&module?.hot?.decline();0&&(module.exports={setProjectAnnotations}); |
{ | ||
"name": "@storybook/html", | ||
"version": "0.0.0-pr-28882-sha-90fe4bc9", | ||
"version": "0.0.0-pr-28882-sha-a04fe375", | ||
"description": "Storybook HTML renderer", | ||
@@ -50,7 +50,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@storybook/components": "^0.0.0-pr-28882-sha-90fe4bc9", | ||
"@storybook/components": "^0.0.0-pr-28882-sha-a04fe375", | ||
"@storybook/global": "^5.0.0", | ||
"@storybook/manager-api": "^0.0.0-pr-28882-sha-90fe4bc9", | ||
"@storybook/preview-api": "^0.0.0-pr-28882-sha-90fe4bc9", | ||
"@storybook/theming": "^0.0.0-pr-28882-sha-90fe4bc9", | ||
"@storybook/manager-api": "^0.0.0-pr-28882-sha-a04fe375", | ||
"@storybook/preview-api": "^0.0.0-pr-28882-sha-a04fe375", | ||
"@storybook/theming": "^0.0.0-pr-28882-sha-a04fe375", | ||
"ts-dedent": "^2.0.0" | ||
@@ -62,3 +62,3 @@ }, | ||
"peerDependencies": { | ||
"storybook": "^0.0.0-pr-28882-sha-90fe4bc9" | ||
"storybook": "^0.0.0-pr-28882-sha-a04fe375" | ||
}, | ||
@@ -65,0 +65,0 @@ "engines": { |
import './button.css'; | ||
export interface ButtonProps { | ||
/** | ||
* Is this the principal call to action on the page? | ||
*/ | ||
/** Is this the principal call to action on the page? */ | ||
primary?: boolean; | ||
/** | ||
* What background color to use | ||
*/ | ||
/** What background color to use */ | ||
backgroundColor?: string; | ||
/** | ||
* How large should the button be? | ||
*/ | ||
/** How large should the button be? */ | ||
size?: 'small' | 'medium' | 'large'; | ||
/** | ||
* Button contents | ||
*/ | ||
/** Button contents */ | ||
label: string; | ||
/** | ||
* Optional click handler | ||
*/ | ||
/** Optional click handler */ | ||
onClick?: () => void; | ||
} | ||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
/** Primary UI component for user interaction */ | ||
export const createButton = ({ | ||
@@ -30,0 +18,0 @@ primary = false, |
import './button.css'; | ||
export interface ButtonProps { | ||
/** | ||
* Is this the principal call to action on the page? | ||
*/ | ||
/** Is this the principal call to action on the page? */ | ||
primary?: boolean; | ||
/** | ||
* What background color to use | ||
*/ | ||
/** What background color to use */ | ||
backgroundColor?: string; | ||
/** | ||
* How large should the button be? | ||
*/ | ||
/** How large should the button be? */ | ||
size?: 'small' | 'medium' | 'large'; | ||
/** | ||
* Button contents | ||
*/ | ||
/** Button contents */ | ||
label: string; | ||
/** | ||
* Optional click handler | ||
*/ | ||
/** Optional click handler */ | ||
onClick?: () => void; | ||
} | ||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
/** Primary UI component for user interaction */ | ||
export const createButton = ({ | ||
@@ -30,0 +18,0 @@ primary = false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
47025
42
1024