@storybook/csf 0.1.2-next.0 → 0.1.3--canary.78.9722e80.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/index.d.ts +110 -3
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
@@ -50,7 +50,7 @@ yarn add @componentdriven/csf
|
|
50
50
|
|
51
51
|
See package source for function definitions and types:
|
52
52
|
|
53
|
-
- `storyNameFromExport(key)` - Enhance export name (`key`) of the story.
|
53
|
+
- `storyNameFromExport(key)` - Enhance export name (`key`) of the story. Implemented to have parity with [startCase](https://lodash.com/docs/4.17.11#startCase).
|
54
54
|
|
55
55
|
- `isExportStory(key, { includeStories, excludeStories })` - Does a named export match CSF inclusion/exclusion options?
|
56
56
|
|
package/dist/index.d.ts
CHANGED
@@ -57,6 +57,7 @@ interface Parameters {
|
|
57
57
|
interface StrictParameters {
|
58
58
|
[name: string]: unknown;
|
59
59
|
}
|
60
|
+
type ControlType = 'object' | 'boolean' | 'check' | 'inline-check' | 'radio' | 'inline-radio' | 'select' | 'multi-select' | 'number' | 'range' | 'file' | 'color' | 'date' | 'text';
|
60
61
|
type ConditionalTest = {
|
61
62
|
truthy?: boolean;
|
62
63
|
} | {
|
@@ -73,11 +74,114 @@ type ConditionalValue = {
|
|
73
74
|
};
|
74
75
|
type Conditional = ConditionalValue & ConditionalTest;
|
75
76
|
interface InputType {
|
76
|
-
|
77
|
+
/**
|
78
|
+
* @see https://storybook.js.org/docs/api/arg-types#control
|
79
|
+
*/
|
80
|
+
control?: ControlType | {
|
81
|
+
/**
|
82
|
+
* @see https://storybook.js.org/docs/api/arg-types#controltype
|
83
|
+
*/
|
84
|
+
type: ControlType;
|
85
|
+
} | {
|
86
|
+
type: 'color';
|
87
|
+
/**
|
88
|
+
* @see https://storybook.js.org/docs/api/arg-types#controlpresetcolors
|
89
|
+
*/
|
90
|
+
presetColors?: string[];
|
91
|
+
} | {
|
92
|
+
type: 'file';
|
93
|
+
/**
|
94
|
+
* @see https://storybook.js.org/docs/api/arg-types#controlaccept
|
95
|
+
*/
|
96
|
+
accept?: string;
|
97
|
+
} | {
|
98
|
+
type: 'inline-check' | 'radio' | 'inline-radio' | 'select' | 'multi-select';
|
99
|
+
/**
|
100
|
+
* @see https://storybook.js.org/docs/api/arg-types#controllabels
|
101
|
+
*/
|
102
|
+
labels?: {
|
103
|
+
[options: string]: string;
|
104
|
+
};
|
105
|
+
} | {
|
106
|
+
type: 'number' | 'range';
|
107
|
+
/**
|
108
|
+
* @see https://storybook.js.org/docs/api/arg-types#controlmax
|
109
|
+
*/
|
110
|
+
max?: number;
|
111
|
+
/**
|
112
|
+
* @see https://storybook.js.org/docs/api/arg-types#controlmin
|
113
|
+
*/
|
114
|
+
min?: number;
|
115
|
+
/**
|
116
|
+
* @see https://storybook.js.org/docs/api/arg-types#controlstep
|
117
|
+
*/
|
118
|
+
step?: number;
|
119
|
+
} | false;
|
120
|
+
/**
|
121
|
+
* @see https://storybook.js.org/docs/api/arg-types#description
|
122
|
+
*/
|
77
123
|
description?: string;
|
78
|
-
|
79
|
-
|
124
|
+
/**
|
125
|
+
* @see https://storybook.js.org/docs/api/arg-types#if
|
126
|
+
*/
|
80
127
|
if?: Conditional;
|
128
|
+
/**
|
129
|
+
* @see https://storybook.js.org/docs/api/arg-types#mapping
|
130
|
+
*/
|
131
|
+
mapping?: {
|
132
|
+
[key: string]: {
|
133
|
+
[option: string]: any;
|
134
|
+
};
|
135
|
+
};
|
136
|
+
/**
|
137
|
+
* @see https://storybook.js.org/docs/api/arg-types#name
|
138
|
+
*/
|
139
|
+
name?: string;
|
140
|
+
/**
|
141
|
+
* @see https://storybook.js.org/docs/api/arg-types#options
|
142
|
+
*/
|
143
|
+
options?: string[];
|
144
|
+
/**
|
145
|
+
* @see https://storybook.js.org/docs/api/arg-types#table
|
146
|
+
*/
|
147
|
+
table?: {
|
148
|
+
/**
|
149
|
+
* @see https://storybook.js.org/docs/api/arg-types#tablecategory
|
150
|
+
*/
|
151
|
+
category?: string;
|
152
|
+
/**
|
153
|
+
* @see https://storybook.js.org/docs/api/arg-types#tabledefaultvalue
|
154
|
+
*/
|
155
|
+
defaultValue?: {
|
156
|
+
summary: string;
|
157
|
+
detail?: string;
|
158
|
+
};
|
159
|
+
/**
|
160
|
+
* @see https://storybook.js.org/docs/api/arg-types#tabledisable
|
161
|
+
*/
|
162
|
+
disable?: boolean;
|
163
|
+
/**
|
164
|
+
* @see https://storybook.js.org/docs/api/arg-types#tablesubcategory
|
165
|
+
*/
|
166
|
+
subcategory?: string;
|
167
|
+
/**
|
168
|
+
* @see https://storybook.js.org/docs/api/arg-types#tabletype
|
169
|
+
*/
|
170
|
+
type?: {
|
171
|
+
summary?: string;
|
172
|
+
detail?: string;
|
173
|
+
};
|
174
|
+
};
|
175
|
+
/**
|
176
|
+
* @see https://storybook.js.org/docs/api/arg-types#type
|
177
|
+
*/
|
178
|
+
type?: SBType | SBScalarType['name'];
|
179
|
+
/**
|
180
|
+
* @see https://storybook.js.org/docs/api/arg-types#defaultvalue
|
181
|
+
*
|
182
|
+
* @deprecated Use `table.defaultValue.summary` instead.
|
183
|
+
*/
|
184
|
+
defaultValue?: any;
|
81
185
|
[key: string]: any;
|
82
186
|
}
|
83
187
|
interface StrictInputType extends InputType {
|
@@ -90,6 +194,9 @@ interface Args {
|
|
90
194
|
interface StrictArgs {
|
91
195
|
[name: string]: unknown;
|
92
196
|
}
|
197
|
+
/**
|
198
|
+
* @see https://storybook.js.org/docs/api/arg-types#argtypes
|
199
|
+
*/
|
93
200
|
type ArgTypes<TArgs = Args> = {
|
94
201
|
[name in keyof TArgs]: InputType;
|
95
202
|
};
|
package/dist/index.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var
|
3
|
+
var F=Object.create;var u=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var I=(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 C(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?F(h(r)):{},E(e||!r||!r.__esModule?u(n,"default",{value:r,enumerable:!0}):n,r));var x=I(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,l=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),l!=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(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((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 c=v(x()),S=r=>r.map(e=>typeof e<"u").filter(Boolean).length,P=(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},O=(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 P(r.if,i)};var L=r=>r.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"-").replace(/-+/g,"-").replace(/^-+/,"").replace(/-+$/,""),m=(r,e)=>{let n=L(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}};
|
4
4
|
|
5
5
|
exports.includeConditionalArg = O;
|
6
6
|
exports.isExportStory = G;
|
7
|
-
exports.parseKind =
|
7
|
+
exports.parseKind = V;
|
8
8
|
exports.sanitize = L;
|
9
9
|
exports.storyNameFromExport = M;
|
10
10
|
exports.toId = N;
|
package/dist/index.mjs
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
var
|
1
|
+
var F=Object.create;var u=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var I=(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 C(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?F(h(r)):{},E(e||!r||!r.__esModule?u(n,"default",{value:r,enumerable:!0}):n,r));var x=I(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,l=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),l!=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(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((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 c=v(x()),S=r=>r.map(e=>typeof e<"u").filter(Boolean).length,P=(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},O=(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 P(r.if,i)};var L=r=>r.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"-").replace(/-+/g,"-").replace(/^-+/,"").replace(/-+$/,""),m=(r,e)=>{let n=L(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}};
|
2
2
|
|
3
|
-
export { O as includeConditionalArg, G as isExportStory,
|
3
|
+
export { O as includeConditionalArg, G as isExportStory, V as parseKind, L as sanitize, M as storyNameFromExport, N as toId };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@storybook/csf",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.3--canary.78.9722e80.0",
|
4
4
|
"description": "Component Story Format (CSF) utilities",
|
5
5
|
"keywords": [
|
6
6
|
"storybook",
|
@@ -99,14 +99,14 @@
|
|
99
99
|
"type-fest": "^2.19.0"
|
100
100
|
},
|
101
101
|
"devDependencies": {
|
102
|
-
"@auto-it/released": "^
|
102
|
+
"@auto-it/released": "^11.1.1",
|
103
103
|
"@ngard/tiny-isequal": "^1.1.0",
|
104
104
|
"@storybook/eslint-config-storybook": "^3.1.2",
|
105
105
|
"@types/jest": "^29.2.0",
|
106
106
|
"@types/node": "^18.11.0",
|
107
107
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
108
108
|
"@typescript-eslint/parser": "^5.42.1",
|
109
|
-
"auto": "^
|
109
|
+
"auto": "^11.1.1",
|
110
110
|
"common-tags": "^1.8.0",
|
111
111
|
"eslint": "^8.27.0",
|
112
112
|
"eslint-import-resolver-typescript": "^3.5.2",
|