Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@storybook/csf

Package Overview
Dependencies
Maintainers
0
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/csf - npm Package Compare versions

Comparing version 0.1.9--canary.91.f96e3a9.0 to 0.1.9--canary.96.2ccc94b.0

64

dist/index.d.ts

@@ -218,3 +218,3 @@ import { Simplify, RemoveIndexSignature, UnionToIntersection } from 'type-fest';

}
interface Renderer {
type Renderer = {
/** What is the type of the `component` annotation in this renderer? */

@@ -226,5 +226,4 @@ component: unknown;

canvasElement: unknown;
mount(): Promise<unknown>;
T?: unknown;
}
};
/** @deprecated - use `Renderer` */

@@ -253,24 +252,22 @@ type AnyFramework = Renderer;

type ViewMode = 'story' | 'docs';
interface StoryContextForLoaders<TRenderer extends Renderer = Renderer, TArgs = Args> extends StoryContextForEnhancers<TRenderer, TArgs>, Required<StoryContextUpdate<TArgs>> {
hooks: unknown;
viewMode: ViewMode;
originalStoryFn: StoryFn<TRenderer>;
}
type LoaderFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContextForLoaders<TRenderer, TArgs>) => Promise<Record<string, any> | void> | Record<string, any> | void;
type Awaitable<T> = T | PromiseLike<T>;
type CleanupCallback = () => Awaitable<unknown>;
type BeforeAll = () => Awaitable<CleanupCallback | void>;
type BeforeEach<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContext<TRenderer, TArgs>) => Awaitable<CleanupCallback | void>;
interface StoryContext<TRenderer extends Renderer = Renderer, TArgs = Args> extends StoryContextForEnhancers<TRenderer, TArgs>, Required<StoryContextUpdate<TArgs>> {
hooks: unknown;
viewMode: ViewMode;
originalStoryFn: StoryFn<TRenderer>;
interface StoryContext<TRenderer extends Renderer = Renderer, TArgs = Args> extends StoryContextForLoaders<TRenderer, TArgs> {
loaded: Record<string, any>;
abortSignal: AbortSignal;
canvasElement: TRenderer['canvasElement'];
canvas: unknown;
step: StepFunction<TRenderer, TArgs>;
mount: (...args: FunctionParameters<TRenderer['mount']>) => Promise<this['canvas']>;
}
type FunctionParameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never;
interface StoryContextForLoaders<TRenderer extends Renderer = Renderer, TArgs = Args> extends StoryContext<TRenderer, TArgs> {
}
interface PlayFunctionContext<TRenderer extends Renderer = Renderer, TArgs = Args> extends StoryContext<TRenderer, TArgs> {
}
type StepLabel = string;
type StepFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (label: StepLabel, play: PlayFunction<TRenderer, TArgs>) => Promise<void> | void;
type PlayFunctionContext<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryContext<TRenderer, TArgs> & {
step: StepFunction<TRenderer, TArgs>;
};
type PlayFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: PlayFunctionContext<TRenderer, TArgs>) => Promise<void> | void;

@@ -285,4 +282,4 @@ type PartialStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (update?: StoryContextUpdate<Partial<TArgs>>) => TRenderer['storyResult'];

type DecoratorApplicator<TRenderer extends Renderer = Renderer, TArgs = Args> = (storyFn: LegacyStoryFn<TRenderer, TArgs>, decorators: DecoratorFunction<TRenderer, TArgs>[]) => LegacyStoryFn<TRenderer, TArgs>;
type StepRunner<TRenderer extends Renderer = Renderer, TArgs = Args> = (label: StepLabel, play: PlayFunction<TRenderer, TArgs>, context: StoryContext<TRenderer, TArgs>) => Promise<void>;
interface BaseAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args> {
type StepRunner<TRenderer extends Renderer = Renderer, TArgs = Args> = (label: StepLabel, play: PlayFunction<TRenderer, TArgs>, context: PlayFunctionContext<TRenderer, TArgs>) => Promise<void>;
type BaseAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args> = {
/**

@@ -332,12 +329,27 @@ * Wrapper components or Storybook decorators that wrap a story.

tags?: Tag[];
mount: (context: StoryContext<TRenderer, TArgs>) => () => Promise<StoryContext<TRenderer, TArgs>['canvas']>;
}
interface ProjectAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args> extends BaseAnnotations<TRenderer, TArgs> {
};
type ProjectAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args> = BaseAnnotations<TRenderer, TArgs> & {
argsEnhancers?: ArgsEnhancer<TRenderer, Args>[];
argTypesEnhancers?: ArgTypesEnhancer<TRenderer, Args>[];
/**
* Lifecycle hook which runs once, before any loaders, decorators or stories, and may rerun when configuration changes or when reinitializing (e.g. between test runs).
* The function may be synchronous or asynchronous, and may return a cleanup function which may also be synchronous or asynchronous.
* The cleanup function is not guaranteed to run (e.g. when the browser closes), but runs when configuration changes or when reinitializing.
* This hook may only be defined globally (i.e. not on component or story level).
* When multiple hooks are specified, they are to be executed sequentially (and awaited) in the following order:
* - Addon hooks (in order of addons array in e.g. .storybook/main.js)
* - Annotation hooks (in order of previewAnnotations array in e.g. .storybook/main.js)
* - Preview hook (via e.g. .storybook/preview.js)
* Cleanup functions are executed sequentially in reverse order of initialization.
*/
beforeAll?: BeforeAll;
/**
* @deprecated Project `globals` renamed to `initiaGlobals`
*/
globals?: Globals;
initialGlobals?: Globals;
globalTypes?: GlobalTypes;
applyDecorators?: DecoratorApplicator<TRenderer, Args>;
runStep?: StepRunner<TRenderer, TArgs>;
}
};
type StoryDescriptor$1 = string[] | RegExp;

@@ -415,2 +427,6 @@ interface ComponentAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args> extends BaseAnnotations<TRenderer, TArgs> {

play?: PlayFunction<TRenderer, TArgs>;
/**
* Override the globals values for all stories in this component
*/
globals?: Globals;
}

@@ -430,2 +446,6 @@ type StoryAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args, TRequiredArgs = Partial<TArgs>> = BaseAnnotations<TRenderer, TArgs> & {

play?: PlayFunction<TRenderer, TArgs>;
/**
* Override the globals values for this story
*/
globals?: Globals;
/** @deprecated */

@@ -495,2 +515,2 @@ story?: Omit<StoryAnnotations<TRenderer, TArgs>, 'story'>;

export { AnnotatedStoryFn, AnyFramework, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, BeforeEach, CleanupCallback, ComponentAnnotations, ComponentId, ComponentTitle, Conditional, DecoratorApplicator, DecoratorFunction, GlobalTypes, Globals, IncludeExcludeOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoaderFunction, Parameters, PartialStoryFn, PlayFunction, PlayFunctionContext, ProjectAnnotations, Renderer, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, StepFunction, StepLabel, StepRunner, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryKind, StoryName, StrictArgTypes, StrictArgs, StrictGlobalTypes, StrictInputType, StrictParameters, Tag, ViewMode, combineTags, includeConditionalArg, isExportStory, parseKind, sanitize, storyNameFromExport, toId };
export { AnnotatedStoryFn, AnyFramework, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, BeforeAll, BeforeEach, CleanupCallback, ComponentAnnotations, ComponentId, ComponentTitle, Conditional, DecoratorApplicator, DecoratorFunction, GlobalTypes, Globals, IncludeExcludeOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoaderFunction, Parameters, PartialStoryFn, PlayFunction, PlayFunctionContext, ProjectAnnotations, Renderer, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, StepFunction, StepLabel, StepRunner, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryKind, StoryName, StrictArgTypes, StrictArgs, StrictGlobalTypes, StrictInputType, StrictParameters, Tag, ViewMode, combineTags, includeConditionalArg, isExportStory, parseKind, sanitize, storyNameFromExport, toId };
'use strict';
var C=Object.create;var u=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var P=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var E=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of F(e))!w.call(r,a)&&a!==n&&u(r,a,{get:()=>e[a],enumerable:!(t=B(e,a))||t.enumerable});return r};var v=(r,e,n)=>(n=r!=null?C(h(r)):{},E(e||!r||!r.__esModule?u(n,"default",{value:r,enumerable:!0}):n,r));var x=P(T=>{Object.defineProperty(T,"__esModule",{value:!0}),T.isEqual=function(){var r=Object.prototype.toString,e=Object.getPrototypeOf,n=Object.getOwnPropertySymbols?function(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}:Object.keys;return function(t,a){return function i(o,s,p){var y,g,d,l=r.call(o),b=r.call(s);if(o===s)return !0;if(o==null||s==null)return !1;if(p.indexOf(o)>-1&&p.indexOf(s)>-1)return !0;if(p.push(o,s),l!=b||(y=n(o),g=n(s),y.length!=g.length||y.some(function(A){return !i(o[A],s[A],p)})))return !1;switch(l.slice(8,-1)){case"Symbol":return o.valueOf()==s.valueOf();case"Date":case"Number":return +o==+s||+o!=+o&&+s!=+s;case"RegExp":case"Function":case"String":case"Boolean":return ""+o==""+s;case"Set":case"Map":y=o.entries(),g=s.entries();do if(!i((d=y.next()).value,g.next().value,p))return !1;while(!d.done);return !0;case"ArrayBuffer":o=new Uint8Array(o),s=new Uint8Array(s);case"DataView":o=new Uint8Array(o.buffer),s=new Uint8Array(s.buffer);case"Float32Array":case"Float64Array":case"Int8Array":case"Int16Array":case"Int32Array":case"Uint8Array":case"Uint16Array":case"Uint32Array":case"Uint8ClampedArray":case"Arguments":case"Array":if(o.length!=s.length)return !1;for(d=0;d<o.length;d++)if((d in o||d in s)&&(d in o!=d in s||!i(o[d],s[d],p)))return !1;return !0;case"Object":return i(e(o),e(s),p);default:return !1}}(t,a,[])}}();});function R(r){return r.replace(/_/g," ").replace(/-/g," ").replace(/\./g," ").replace(/([^\n])([A-Z])([a-z])/g,(e,n,t,a)=>`${n} ${t}${a}`).replace(/([a-z])([A-Z])/g,(e,n,t)=>`${n} ${t}`).replace(/([a-z])([0-9])/gi,(e,n,t)=>`${n} ${t}`).replace(/([0-9])([a-z])/gi,(e,n,t)=>`${n} ${t}`).replace(/(\s|^)(\w)/g,(e,n,t)=>`${n}${t.toUpperCase()}`).replace(/ +/g," ").trim()}var c=v(x()),S=r=>r.map(e=>typeof e<"u").filter(Boolean).length,I=(r,e)=>{let{exists:n,eq:t,neq:a,truthy:i}=r;if(S([n,t,a,i])>1)throw new Error(`Invalid conditional test ${JSON.stringify({exists:n,eq:t,neq:a})}`);if(typeof t<"u")return (0, c.isEqual)(e,t);if(typeof a<"u")return !(0, c.isEqual)(e,a);if(typeof n<"u"){let s=typeof e<"u";return n?s:!s}return (typeof i>"u"?!0:i)?!!e:!e},k=(r,e,n)=>{if(!r.if)return !0;let{arg:t,global:a}=r.if;if(S([t,a])!==1)throw new Error(`Invalid conditional value ${JSON.stringify({arg:t,global:a})}`);let i=t?e[t]:n[a];return I(r.if,i)};var O=r=>r.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"-").replace(/-+/g,"-").replace(/^-+/,"").replace(/-+$/,""),m=(r,e)=>{let n=O(r);if(n==="")throw new Error(`Invalid ${e} '${r}', must include alphanumeric characters`);return n},N=(r,e)=>`${m(r,"kind")}${e?`--${m(e,"name")}`:""}`,M=r=>R(r);function f(r,e){return Array.isArray(e)?e.includes(r):r.match(e)}function G(r,{includeStories:e,excludeStories:n}){return r!=="__esModule"&&(!e||f(r,e))&&(!n||!f(r,n))}var V=(r,{rootSeparator:e,groupSeparator:n})=>{let[t,a]=r.split(e,2),i=(a||r).split(n).filter(o=>!!o);return {root:a?t:null,groups:i}},z=(...r)=>{let e=r.reduce((n,t)=>(t.startsWith("!")?n.delete(t.slice(1)):n.add(t),n),new Set);return Array.from(e)};
var B=Object.create;var u=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var E=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var I=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of F(e))!w.call(r,a)&&a!==n&&u(r,a,{get:()=>e[a],enumerable:!(t=C(e,a))||t.enumerable});return r};var k=(r,e,n)=>(n=r!=null?B(h(r)):{},I(e||!r||!r.__esModule?u(n,"default",{value:r,enumerable:!0}):n,r));var x=E(T=>{Object.defineProperty(T,"__esModule",{value:!0}),T.isEqual=function(){var r=Object.prototype.toString,e=Object.getPrototypeOf,n=Object.getOwnPropertySymbols?function(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}:Object.keys;return function(t,a){return function i(o,s,d){var y,g,p,c=r.call(o),b=r.call(s);if(o===s)return !0;if(o==null||s==null)return !1;if(d.indexOf(o)>-1&&d.indexOf(s)>-1)return !0;if(d.push(o,s),c!=b||(y=n(o),g=n(s),y.length!=g.length||y.some(function(A){return !i(o[A],s[A],d)})))return !1;switch(c.slice(8,-1)){case"Symbol":return o.valueOf()==s.valueOf();case"Date":case"Number":return +o==+s||+o!=+o&&+s!=+s;case"RegExp":case"Function":case"String":case"Boolean":return ""+o==""+s;case"Set":case"Map":y=o.entries(),g=s.entries();do if(!i((p=y.next()).value,g.next().value,d))return !1;while(!p.done);return !0;case"ArrayBuffer":o=new Uint8Array(o),s=new Uint8Array(s);case"DataView":o=new Uint8Array(o.buffer),s=new Uint8Array(s.buffer);case"Float32Array":case"Float64Array":case"Int8Array":case"Int16Array":case"Int32Array":case"Uint8Array":case"Uint16Array":case"Uint32Array":case"Uint8ClampedArray":case"Arguments":case"Array":if(o.length!=s.length)return !1;for(p=0;p<o.length;p++)if((p in o||p in s)&&(p in o!=p in s||!i(o[p],s[p],d)))return !1;return !0;case"Object":return i(e(o),e(s),d);default:return !1}}(t,a,[])}}();});function R(r){return r.replace(/_/g," ").replace(/-/g," ").replace(/\./g," ").replace(/([^\n])([A-Z])([a-z])/g,(e,n,t,a)=>`${n} ${t}${a}`).replace(/([a-z])([A-Z])/g,(e,n,t)=>`${n} ${t}`).replace(/([a-z])([0-9])/gi,(e,n,t)=>`${n} ${t}`).replace(/([0-9])([a-z])/gi,(e,n,t)=>`${n} ${t}`).replace(/(\s|^)(\w)/g,(e,n,t)=>`${n}${t.toUpperCase()}`).replace(/ +/g," ").trim()}var l=k(x()),S=r=>r.map(e=>typeof e<"u").filter(Boolean).length,v=(r,e)=>{let{exists:n,eq:t,neq:a,truthy:i}=r;if(S([n,t,a,i])>1)throw new Error(`Invalid conditional test ${JSON.stringify({exists:n,eq:t,neq:a})}`);if(typeof t<"u")return (0, l.isEqual)(e,t);if(typeof a<"u")return !(0, l.isEqual)(e,a);if(typeof n<"u"){let s=typeof e<"u";return n?s:!s}return (typeof i>"u"?!0:i)?!!e:!e},P=(r,e,n)=>{if(!r.if)return !0;let{arg:t,global:a}=r.if;if(S([t,a])!==1)throw new Error(`Invalid conditional value ${JSON.stringify({arg:t,global:a})}`);let i=t?e[t]:n[a];return v(r.if,i)};var O=r=>r.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"-").replace(/-+/g,"-").replace(/^-+/,"").replace(/-+$/,""),m=(r,e)=>{let n=O(r);if(n==="")throw new Error(`Invalid ${e} '${r}', must include alphanumeric characters`);return n},G=(r,e)=>`${m(r,"kind")}${e?`--${m(e,"name")}`:""}`,N=r=>R(r);function f(r,e){return Array.isArray(e)?e.includes(r):r.match(e)}function M(r,{includeStories:e,excludeStories:n}){return r!=="__esModule"&&(!e||f(r,e))&&(!n||!f(r,n))}var V=(r,{rootSeparator:e,groupSeparator:n})=>{let[t,a]=r.split(e,2),i=(a||r).split(n).filter(o=>!!o);return {root:a?t:null,groups:i}},z=(...r)=>{let e=r.reduce((n,t)=>(t.startsWith("!")?n.delete(t.slice(1)):n.add(t),n),new Set);return Array.from(e)};
exports.combineTags = z;
exports.includeConditionalArg = k;
exports.isExportStory = G;
exports.includeConditionalArg = P;
exports.isExportStory = M;
exports.parseKind = V;
exports.sanitize = O;
exports.storyNameFromExport = M;
exports.toId = N;
exports.storyNameFromExport = N;
exports.toId = G;
{
"name": "@storybook/csf",
"version": "0.1.9--canary.91.f96e3a9.0",
"version": "0.1.9--canary.96.2ccc94b.0",
"description": "Component Story Format (CSF) utilities",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc