@storybook/csf 0.0.2--canary.62.d7abc02.0 → 0.0.2--canary.62.1b51cab.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +8 -169
- package/dist/index.mjs +2 -163
- package/package.json +28 -25
package/dist/index.js
CHANGED
@@ -1,171 +1,10 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
};
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
-
for (let key of __getOwnPropNames(from))
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
-
}
|
18
|
-
return to;
|
19
|
-
};
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
|
-
mod
|
23
|
-
));
|
24
|
-
|
25
|
-
// node_modules/@ngard/tiny-isequal/index.js
|
26
|
-
var require_tiny_isequal = __commonJS({
|
27
|
-
"node_modules/@ngard/tiny-isequal/index.js"(exports) {
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true }), exports.isEqual = function() {
|
29
|
-
var e = Object.prototype.toString, r = Object.getPrototypeOf, t = Object.getOwnPropertySymbols ? function(e2) {
|
30
|
-
return Object.keys(e2).concat(Object.getOwnPropertySymbols(e2));
|
31
|
-
} : Object.keys;
|
32
|
-
return function(n, a) {
|
33
|
-
return function n2(a2, c, u) {
|
34
|
-
var i, s, l, o = e.call(a2), f = e.call(c);
|
35
|
-
if (a2 === c)
|
36
|
-
return true;
|
37
|
-
if (null == a2 || null == c)
|
38
|
-
return false;
|
39
|
-
if (u.indexOf(a2) > -1 && u.indexOf(c) > -1)
|
40
|
-
return true;
|
41
|
-
if (u.push(a2, c), o != f)
|
42
|
-
return false;
|
43
|
-
if (i = t(a2), s = t(c), i.length != s.length || i.some(function(e2) {
|
44
|
-
return !n2(a2[e2], c[e2], u);
|
45
|
-
}))
|
46
|
-
return false;
|
47
|
-
switch (o.slice(8, -1)) {
|
48
|
-
case "Symbol":
|
49
|
-
return a2.valueOf() == c.valueOf();
|
50
|
-
case "Date":
|
51
|
-
case "Number":
|
52
|
-
return +a2 == +c || +a2 != +a2 && +c != +c;
|
53
|
-
case "RegExp":
|
54
|
-
case "Function":
|
55
|
-
case "String":
|
56
|
-
case "Boolean":
|
57
|
-
return "" + a2 == "" + c;
|
58
|
-
case "Set":
|
59
|
-
case "Map":
|
60
|
-
i = a2.entries(), s = c.entries();
|
61
|
-
do {
|
62
|
-
if (!n2((l = i.next()).value, s.next().value, u))
|
63
|
-
return false;
|
64
|
-
} while (!l.done);
|
65
|
-
return true;
|
66
|
-
case "ArrayBuffer":
|
67
|
-
a2 = new Uint8Array(a2), c = new Uint8Array(c);
|
68
|
-
case "DataView":
|
69
|
-
a2 = new Uint8Array(a2.buffer), c = new Uint8Array(c.buffer);
|
70
|
-
case "Float32Array":
|
71
|
-
case "Float64Array":
|
72
|
-
case "Int8Array":
|
73
|
-
case "Int16Array":
|
74
|
-
case "Int32Array":
|
75
|
-
case "Uint8Array":
|
76
|
-
case "Uint16Array":
|
77
|
-
case "Uint32Array":
|
78
|
-
case "Uint8ClampedArray":
|
79
|
-
case "Arguments":
|
80
|
-
case "Array":
|
81
|
-
if (a2.length != c.length)
|
82
|
-
return false;
|
83
|
-
for (l = 0; l < a2.length; l++)
|
84
|
-
if ((l in a2 || l in c) && (l in a2 != l in c || !n2(a2[l], c[l], u)))
|
85
|
-
return false;
|
86
|
-
return true;
|
87
|
-
case "Object":
|
88
|
-
return n2(r(a2), r(c), u);
|
89
|
-
default:
|
90
|
-
return false;
|
91
|
-
}
|
92
|
-
}(n, a, []);
|
93
|
-
};
|
94
|
-
}();
|
95
|
-
}
|
96
|
-
});
|
97
|
-
|
98
|
-
// src/toStartCaseStr.ts
|
99
|
-
function toStartCaseStr(str) {
|
100
|
-
return str.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, (str2, $1, $2) => `${$1} ${$2}`).replace(/([a-z])([0-9])/gi, (str2, $1, $2) => `${$1} ${$2}`).replace(/(\s|^)(\w)/g, (str2, $1, $2) => $1 + $2.toUpperCase());
|
101
|
-
}
|
102
|
-
|
103
|
-
// src/includeConditionalArg.ts
|
104
|
-
var import_tiny_isequal = __toESM(require_tiny_isequal());
|
105
|
-
var count = (vals) => vals.map((v) => typeof v !== "undefined").filter(Boolean).length;
|
106
|
-
var testValue = (cond, value) => {
|
107
|
-
const { exists, eq, neq, truthy } = cond;
|
108
|
-
if (count([exists, eq, neq, truthy]) > 1) {
|
109
|
-
throw new Error(`Invalid conditional test ${JSON.stringify({ exists, eq, neq })}`);
|
110
|
-
}
|
111
|
-
if (typeof eq !== "undefined") {
|
112
|
-
return (0, import_tiny_isequal.isEqual)(value, eq);
|
113
|
-
}
|
114
|
-
if (typeof neq !== "undefined") {
|
115
|
-
return !(0, import_tiny_isequal.isEqual)(value, neq);
|
116
|
-
}
|
117
|
-
if (typeof exists !== "undefined") {
|
118
|
-
const valueExists = typeof value !== "undefined";
|
119
|
-
return exists ? valueExists : !valueExists;
|
120
|
-
}
|
121
|
-
const shouldBeTruthy = typeof truthy === "undefined" ? true : truthy;
|
122
|
-
return shouldBeTruthy ? !!value : !value;
|
123
|
-
};
|
124
|
-
var includeConditionalArg = (argType, args, globals) => {
|
125
|
-
if (!argType.if)
|
126
|
-
return true;
|
127
|
-
const { arg, global } = argType.if;
|
128
|
-
if (count([arg, global]) !== 1) {
|
129
|
-
throw new Error(`Invalid conditional value ${JSON.stringify({ arg, global })}`);
|
130
|
-
}
|
131
|
-
const value = arg ? args[arg] : globals[global];
|
132
|
-
return testValue(argType.if, value);
|
133
|
-
};
|
134
|
-
|
135
|
-
// src/index.ts
|
136
|
-
var sanitize = (string) => {
|
137
|
-
return string.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
|
138
|
-
};
|
139
|
-
var sanitizeSafe = (string, part) => {
|
140
|
-
const sanitized = sanitize(string);
|
141
|
-
if (sanitized === "") {
|
142
|
-
throw new Error(`Invalid ${part} '${string}', must include alphanumeric characters`);
|
143
|
-
}
|
144
|
-
return sanitized;
|
145
|
-
};
|
146
|
-
var toId = (kind, name) => `${sanitizeSafe(kind, "kind")}${name ? `--${sanitizeSafe(name, "name")}` : ""}`;
|
147
|
-
var storyNameFromExport = (key) => toStartCaseStr(key);
|
148
|
-
function matches(storyKey, arrayOrRegex) {
|
149
|
-
if (Array.isArray(arrayOrRegex)) {
|
150
|
-
return arrayOrRegex.includes(storyKey);
|
151
|
-
}
|
152
|
-
return storyKey.match(arrayOrRegex);
|
153
|
-
}
|
154
|
-
function isExportStory(key, { includeStories, excludeStories }) {
|
155
|
-
return key !== "__esModule" && (!includeStories || matches(key, includeStories)) && (!excludeStories || !matches(key, excludeStories));
|
156
|
-
}
|
157
|
-
var parseKind = (kind, { rootSeparator, groupSeparator }) => {
|
158
|
-
const [root, remainder] = kind.split(rootSeparator, 2);
|
159
|
-
const groups = (remainder || kind).split(groupSeparator).filter((i) => !!i);
|
160
|
-
return {
|
161
|
-
root: remainder ? root : null,
|
162
|
-
groups
|
163
|
-
};
|
164
|
-
};
|
165
|
-
|
166
|
-
exports.includeConditionalArg = includeConditionalArg;
|
167
|
-
exports.isExportStory = isExportStory;
|
168
|
-
exports.parseKind = parseKind;
|
169
|
-
exports.sanitize = sanitize;
|
170
|
-
exports.storyNameFromExport = storyNameFromExport;
|
171
|
-
exports.toId = toId;
|
3
|
+
var B=Object.create;var R=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var I=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var E=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of C(r))!w.call(e,a)&&a!==n&&R(e,a,{get:()=>r[a],enumerable:!(o=b(r,a))||o.enumerable});return e};var P=(e,r,n)=>(n=e!=null?B(h(e)):{},E(r||!e||!e.__esModule?R(n,"default",{value:e,enumerable:!0}):n,e));var x=I(T=>{Object.defineProperty(T,"__esModule",{value:!0}),T.isEqual=function(){var e=Object.prototype.toString,r=Object.getPrototypeOf,n=Object.getOwnPropertySymbols?function(o){return Object.keys(o).concat(Object.getOwnPropertySymbols(o))}:Object.keys;return function(o,a){return function i(t,s,d){var y,g,p,A=e.call(t),F=e.call(s);if(t===s)return !0;if(t==null||s==null)return !1;if(d.indexOf(t)>-1&&d.indexOf(s)>-1)return !0;if(d.push(t,s),A!=F||(y=n(t),g=n(s),y.length!=g.length||y.some(function(l){return !i(t[l],s[l],d)})))return !1;switch(A.slice(8,-1)){case"Symbol":return t.valueOf()==s.valueOf();case"Date":case"Number":return +t==+s||+t!=+t&&+s!=+s;case"RegExp":case"Function":case"String":case"Boolean":return ""+t==""+s;case"Set":case"Map":y=t.entries(),g=s.entries();do if(!i((p=y.next()).value,g.next().value,d))return !1;while(!p.done);return !0;case"ArrayBuffer":t=new Uint8Array(t),s=new Uint8Array(s);case"DataView":t=new Uint8Array(t.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(t.length!=s.length)return !1;for(p=0;p<t.length;p++)if((p in t||p in s)&&(p in t!=p in s||!i(t[p],s[p],d)))return !1;return !0;case"Object":return i(r(t),r(s),d);default:return !1}}(o,a,[])}}();});function u(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,(r,n,o)=>`${n} ${o}`).replace(/([a-z])([0-9])/gi,(r,n,o)=>`${n} ${o}`).replace(/(\s|^)(\w)/g,(r,n,o)=>n+o.toUpperCase())}var c=P(x()),S=e=>e.map(r=>typeof r<"u").filter(Boolean).length,O=(e,r)=>{let{exists:n,eq:o,neq:a,truthy:i}=e;if(S([n,o,a,i])>1)throw new Error(`Invalid conditional test ${JSON.stringify({exists:n,eq:o,neq:a})}`);if(typeof o<"u")return (0, c.isEqual)(r,o);if(typeof a<"u")return !(0, c.isEqual)(r,a);if(typeof n<"u"){let s=typeof r<"u";return n?s:!s}return (typeof i>"u"?!0:i)?!!r:!r},v=(e,r,n)=>{if(!e.if)return !0;let{arg:o,global:a}=e.if;if(S([o,a])!==1)throw new Error(`Invalid conditional value ${JSON.stringify({arg:o,global:a})}`);let i=o?r[o]:n[a];return O(e.if,i)};var L=e=>e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"-").replace(/-+/g,"-").replace(/^-+/,"").replace(/-+$/,""),m=(e,r)=>{let n=L(e);if(n==="")throw new Error(`Invalid ${r} '${e}', must include alphanumeric characters`);return n},N=(e,r)=>`${m(e,"kind")}${r?`--${m(r,"name")}`:""}`,M=e=>u(e);function f(e,r){return Array.isArray(r)?r.includes(e):e.match(r)}function G(e,{includeStories:r,excludeStories:n}){return e!=="__esModule"&&(!r||f(e,r))&&(!n||!f(e,n))}var V=(e,{rootSeparator:r,groupSeparator:n})=>{let[o,a]=e.split(r,2),i=(a||e).split(n).filter(t=>!!t);return {root:a?o:null,groups:i}};
|
4
|
+
|
5
|
+
exports.includeConditionalArg = v;
|
6
|
+
exports.isExportStory = G;
|
7
|
+
exports.parseKind = V;
|
8
|
+
exports.sanitize = L;
|
9
|
+
exports.storyNameFromExport = M;
|
10
|
+
exports.toId = N;
|
package/dist/index.mjs
CHANGED
@@ -1,164 +1,3 @@
|
|
1
|
-
var
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
19
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
20
|
-
mod
|
21
|
-
));
|
1
|
+
var B=Object.create;var R=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var I=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var E=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of C(r))!w.call(e,a)&&a!==n&&R(e,a,{get:()=>r[a],enumerable:!(o=b(r,a))||o.enumerable});return e};var P=(e,r,n)=>(n=e!=null?B(h(e)):{},E(r||!e||!e.__esModule?R(n,"default",{value:e,enumerable:!0}):n,e));var x=I(T=>{Object.defineProperty(T,"__esModule",{value:!0}),T.isEqual=function(){var e=Object.prototype.toString,r=Object.getPrototypeOf,n=Object.getOwnPropertySymbols?function(o){return Object.keys(o).concat(Object.getOwnPropertySymbols(o))}:Object.keys;return function(o,a){return function i(t,s,d){var y,g,p,A=e.call(t),F=e.call(s);if(t===s)return !0;if(t==null||s==null)return !1;if(d.indexOf(t)>-1&&d.indexOf(s)>-1)return !0;if(d.push(t,s),A!=F||(y=n(t),g=n(s),y.length!=g.length||y.some(function(l){return !i(t[l],s[l],d)})))return !1;switch(A.slice(8,-1)){case"Symbol":return t.valueOf()==s.valueOf();case"Date":case"Number":return +t==+s||+t!=+t&&+s!=+s;case"RegExp":case"Function":case"String":case"Boolean":return ""+t==""+s;case"Set":case"Map":y=t.entries(),g=s.entries();do if(!i((p=y.next()).value,g.next().value,d))return !1;while(!p.done);return !0;case"ArrayBuffer":t=new Uint8Array(t),s=new Uint8Array(s);case"DataView":t=new Uint8Array(t.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(t.length!=s.length)return !1;for(p=0;p<t.length;p++)if((p in t||p in s)&&(p in t!=p in s||!i(t[p],s[p],d)))return !1;return !0;case"Object":return i(r(t),r(s),d);default:return !1}}(o,a,[])}}();});function u(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,(r,n,o)=>`${n} ${o}`).replace(/([a-z])([0-9])/gi,(r,n,o)=>`${n} ${o}`).replace(/(\s|^)(\w)/g,(r,n,o)=>n+o.toUpperCase())}var c=P(x()),S=e=>e.map(r=>typeof r<"u").filter(Boolean).length,O=(e,r)=>{let{exists:n,eq:o,neq:a,truthy:i}=e;if(S([n,o,a,i])>1)throw new Error(`Invalid conditional test ${JSON.stringify({exists:n,eq:o,neq:a})}`);if(typeof o<"u")return (0, c.isEqual)(r,o);if(typeof a<"u")return !(0, c.isEqual)(r,a);if(typeof n<"u"){let s=typeof r<"u";return n?s:!s}return (typeof i>"u"?!0:i)?!!r:!r},v=(e,r,n)=>{if(!e.if)return !0;let{arg:o,global:a}=e.if;if(S([o,a])!==1)throw new Error(`Invalid conditional value ${JSON.stringify({arg:o,global:a})}`);let i=o?r[o]:n[a];return O(e.if,i)};var L=e=>e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"-").replace(/-+/g,"-").replace(/^-+/,"").replace(/-+$/,""),m=(e,r)=>{let n=L(e);if(n==="")throw new Error(`Invalid ${r} '${e}', must include alphanumeric characters`);return n},N=(e,r)=>`${m(e,"kind")}${r?`--${m(r,"name")}`:""}`,M=e=>u(e);function f(e,r){return Array.isArray(r)?r.includes(e):e.match(r)}function G(e,{includeStories:r,excludeStories:n}){return e!=="__esModule"&&(!r||f(e,r))&&(!n||!f(e,n))}var V=(e,{rootSeparator:r,groupSeparator:n})=>{let[o,a]=e.split(r,2),i=(a||e).split(n).filter(t=>!!t);return {root:a?o:null,groups:i}};
|
22
2
|
|
23
|
-
|
24
|
-
var require_tiny_isequal = __commonJS({
|
25
|
-
"node_modules/@ngard/tiny-isequal/index.js"(exports) {
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true }), exports.isEqual = function() {
|
27
|
-
var e = Object.prototype.toString, r = Object.getPrototypeOf, t = Object.getOwnPropertySymbols ? function(e2) {
|
28
|
-
return Object.keys(e2).concat(Object.getOwnPropertySymbols(e2));
|
29
|
-
} : Object.keys;
|
30
|
-
return function(n, a) {
|
31
|
-
return function n2(a2, c, u) {
|
32
|
-
var i, s, l, o = e.call(a2), f = e.call(c);
|
33
|
-
if (a2 === c)
|
34
|
-
return true;
|
35
|
-
if (null == a2 || null == c)
|
36
|
-
return false;
|
37
|
-
if (u.indexOf(a2) > -1 && u.indexOf(c) > -1)
|
38
|
-
return true;
|
39
|
-
if (u.push(a2, c), o != f)
|
40
|
-
return false;
|
41
|
-
if (i = t(a2), s = t(c), i.length != s.length || i.some(function(e2) {
|
42
|
-
return !n2(a2[e2], c[e2], u);
|
43
|
-
}))
|
44
|
-
return false;
|
45
|
-
switch (o.slice(8, -1)) {
|
46
|
-
case "Symbol":
|
47
|
-
return a2.valueOf() == c.valueOf();
|
48
|
-
case "Date":
|
49
|
-
case "Number":
|
50
|
-
return +a2 == +c || +a2 != +a2 && +c != +c;
|
51
|
-
case "RegExp":
|
52
|
-
case "Function":
|
53
|
-
case "String":
|
54
|
-
case "Boolean":
|
55
|
-
return "" + a2 == "" + c;
|
56
|
-
case "Set":
|
57
|
-
case "Map":
|
58
|
-
i = a2.entries(), s = c.entries();
|
59
|
-
do {
|
60
|
-
if (!n2((l = i.next()).value, s.next().value, u))
|
61
|
-
return false;
|
62
|
-
} while (!l.done);
|
63
|
-
return true;
|
64
|
-
case "ArrayBuffer":
|
65
|
-
a2 = new Uint8Array(a2), c = new Uint8Array(c);
|
66
|
-
case "DataView":
|
67
|
-
a2 = new Uint8Array(a2.buffer), c = new Uint8Array(c.buffer);
|
68
|
-
case "Float32Array":
|
69
|
-
case "Float64Array":
|
70
|
-
case "Int8Array":
|
71
|
-
case "Int16Array":
|
72
|
-
case "Int32Array":
|
73
|
-
case "Uint8Array":
|
74
|
-
case "Uint16Array":
|
75
|
-
case "Uint32Array":
|
76
|
-
case "Uint8ClampedArray":
|
77
|
-
case "Arguments":
|
78
|
-
case "Array":
|
79
|
-
if (a2.length != c.length)
|
80
|
-
return false;
|
81
|
-
for (l = 0; l < a2.length; l++)
|
82
|
-
if ((l in a2 || l in c) && (l in a2 != l in c || !n2(a2[l], c[l], u)))
|
83
|
-
return false;
|
84
|
-
return true;
|
85
|
-
case "Object":
|
86
|
-
return n2(r(a2), r(c), u);
|
87
|
-
default:
|
88
|
-
return false;
|
89
|
-
}
|
90
|
-
}(n, a, []);
|
91
|
-
};
|
92
|
-
}();
|
93
|
-
}
|
94
|
-
});
|
95
|
-
|
96
|
-
// src/toStartCaseStr.ts
|
97
|
-
function toStartCaseStr(str) {
|
98
|
-
return str.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, (str2, $1, $2) => `${$1} ${$2}`).replace(/([a-z])([0-9])/gi, (str2, $1, $2) => `${$1} ${$2}`).replace(/(\s|^)(\w)/g, (str2, $1, $2) => $1 + $2.toUpperCase());
|
99
|
-
}
|
100
|
-
|
101
|
-
// src/includeConditionalArg.ts
|
102
|
-
var import_tiny_isequal = __toESM(require_tiny_isequal());
|
103
|
-
var count = (vals) => vals.map((v) => typeof v !== "undefined").filter(Boolean).length;
|
104
|
-
var testValue = (cond, value) => {
|
105
|
-
const { exists, eq, neq, truthy } = cond;
|
106
|
-
if (count([exists, eq, neq, truthy]) > 1) {
|
107
|
-
throw new Error(`Invalid conditional test ${JSON.stringify({ exists, eq, neq })}`);
|
108
|
-
}
|
109
|
-
if (typeof eq !== "undefined") {
|
110
|
-
return (0, import_tiny_isequal.isEqual)(value, eq);
|
111
|
-
}
|
112
|
-
if (typeof neq !== "undefined") {
|
113
|
-
return !(0, import_tiny_isequal.isEqual)(value, neq);
|
114
|
-
}
|
115
|
-
if (typeof exists !== "undefined") {
|
116
|
-
const valueExists = typeof value !== "undefined";
|
117
|
-
return exists ? valueExists : !valueExists;
|
118
|
-
}
|
119
|
-
const shouldBeTruthy = typeof truthy === "undefined" ? true : truthy;
|
120
|
-
return shouldBeTruthy ? !!value : !value;
|
121
|
-
};
|
122
|
-
var includeConditionalArg = (argType, args, globals) => {
|
123
|
-
if (!argType.if)
|
124
|
-
return true;
|
125
|
-
const { arg, global } = argType.if;
|
126
|
-
if (count([arg, global]) !== 1) {
|
127
|
-
throw new Error(`Invalid conditional value ${JSON.stringify({ arg, global })}`);
|
128
|
-
}
|
129
|
-
const value = arg ? args[arg] : globals[global];
|
130
|
-
return testValue(argType.if, value);
|
131
|
-
};
|
132
|
-
|
133
|
-
// src/index.ts
|
134
|
-
var sanitize = (string) => {
|
135
|
-
return string.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
|
136
|
-
};
|
137
|
-
var sanitizeSafe = (string, part) => {
|
138
|
-
const sanitized = sanitize(string);
|
139
|
-
if (sanitized === "") {
|
140
|
-
throw new Error(`Invalid ${part} '${string}', must include alphanumeric characters`);
|
141
|
-
}
|
142
|
-
return sanitized;
|
143
|
-
};
|
144
|
-
var toId = (kind, name) => `${sanitizeSafe(kind, "kind")}${name ? `--${sanitizeSafe(name, "name")}` : ""}`;
|
145
|
-
var storyNameFromExport = (key) => toStartCaseStr(key);
|
146
|
-
function matches(storyKey, arrayOrRegex) {
|
147
|
-
if (Array.isArray(arrayOrRegex)) {
|
148
|
-
return arrayOrRegex.includes(storyKey);
|
149
|
-
}
|
150
|
-
return storyKey.match(arrayOrRegex);
|
151
|
-
}
|
152
|
-
function isExportStory(key, { includeStories, excludeStories }) {
|
153
|
-
return key !== "__esModule" && (!includeStories || matches(key, includeStories)) && (!excludeStories || !matches(key, excludeStories));
|
154
|
-
}
|
155
|
-
var parseKind = (kind, { rootSeparator, groupSeparator }) => {
|
156
|
-
const [root, remainder] = kind.split(rootSeparator, 2);
|
157
|
-
const groups = (remainder || kind).split(groupSeparator).filter((i) => !!i);
|
158
|
-
return {
|
159
|
-
root: remainder ? root : null,
|
160
|
-
groups
|
161
|
-
};
|
162
|
-
};
|
163
|
-
|
164
|
-
export { includeConditionalArg, isExportStory, parseKind, sanitize, storyNameFromExport, toId };
|
3
|
+
export { v 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.0.2--canary.62.
|
3
|
+
"version": "0.0.2--canary.62.1b51cab.0",
|
4
4
|
"description": "Component Story Format (CSF) utilities",
|
5
5
|
"keywords": [
|
6
6
|
"storybook",
|
@@ -17,32 +17,33 @@
|
|
17
17
|
"url": "https://github.com/ComponentDriven/csf.git"
|
18
18
|
},
|
19
19
|
"license": "MIT",
|
20
|
-
"files": [
|
21
|
-
"dist/**/*",
|
22
|
-
"README.md",
|
23
|
-
"*.js",
|
24
|
-
"*.d.ts"
|
25
|
-
],
|
26
20
|
"exports": {
|
27
21
|
".": {
|
28
22
|
"import": "./dist/index.mjs",
|
29
|
-
"
|
23
|
+
"browser": "./dist/index.mjs",
|
24
|
+
"node": "./dist/index.js",
|
25
|
+
"require": "./dist/index.js",
|
26
|
+
"types": "./dist/index.d.ts"
|
30
27
|
}
|
31
28
|
},
|
32
29
|
"main": "dist/index.js",
|
33
30
|
"module": "dist/index.mjs",
|
34
31
|
"types": "dist/index.d.ts",
|
32
|
+
"files": [
|
33
|
+
"dist/**/*",
|
34
|
+
"README.md",
|
35
|
+
"*.js",
|
36
|
+
"*.d.ts"
|
37
|
+
],
|
35
38
|
"scripts": {
|
36
|
-
"build": "tsup ./src/index.ts --format esm,cjs --dts --treeshake",
|
39
|
+
"build": "tsup ./src/index.ts --format esm,cjs --dts --treeshake --minify",
|
37
40
|
"check": "tsc",
|
38
41
|
"lint": "eslint src --ext .ts",
|
39
|
-
"
|
40
|
-
"
|
42
|
+
"release": "yarn build && auto shipit",
|
43
|
+
"test": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-vm-modules jest"
|
41
44
|
},
|
45
|
+
"prettier": "@storybook/linter-config/prettier.config",
|
42
46
|
"eslintConfig": {
|
43
|
-
"extends": [
|
44
|
-
"@storybook/eslint-config-storybook"
|
45
|
-
],
|
46
47
|
"parserOptions": {
|
47
48
|
"project": [
|
48
49
|
"./tsconfig.json"
|
@@ -57,6 +58,9 @@
|
|
57
58
|
}
|
58
59
|
}
|
59
60
|
},
|
61
|
+
"extends": [
|
62
|
+
"@storybook/eslint-config-storybook"
|
63
|
+
],
|
60
64
|
"rules": {
|
61
65
|
"import/no-unresolved": "error",
|
62
66
|
"jest/expect-expect": [
|
@@ -70,15 +74,18 @@
|
|
70
74
|
]
|
71
75
|
}
|
72
76
|
},
|
73
|
-
"prettier": "@storybook/linter-config/prettier.config",
|
74
77
|
"jest": {
|
75
|
-
"preset": "ts-jest/presets/default-esm",
|
76
78
|
"extensionsToTreatAsEsm": [
|
77
79
|
".ts"
|
78
80
|
],
|
79
81
|
"moduleNameMapper": {
|
80
82
|
"^(\\.{1,2}/.*)\\.js$": "$1"
|
81
83
|
},
|
84
|
+
"preset": "ts-jest/presets/default-esm",
|
85
|
+
"roots": [
|
86
|
+
"<rootDir>/src"
|
87
|
+
],
|
88
|
+
"testEnvironment": "node",
|
82
89
|
"transform": {
|
83
90
|
"^.+\\.tsx?$": [
|
84
91
|
"ts-jest",
|
@@ -86,17 +93,12 @@
|
|
86
93
|
"useESM": true
|
87
94
|
}
|
88
95
|
]
|
89
|
-
}
|
90
|
-
"testEnvironment": "node",
|
91
|
-
"roots": [
|
92
|
-
"<rootDir>/src"
|
93
|
-
]
|
96
|
+
}
|
94
97
|
},
|
95
98
|
"dependencies": {
|
96
99
|
"type-fest": "^2.19.0"
|
97
100
|
},
|
98
101
|
"devDependencies": {
|
99
|
-
"expect-type": "^0.14.2",
|
100
102
|
"@auto-it/released": "^10.37.6",
|
101
103
|
"@ngard/tiny-isequal": "^1.1.0",
|
102
104
|
"@storybook/eslint-config-storybook": "^3.1.2",
|
@@ -110,19 +112,20 @@
|
|
110
112
|
"eslint-import-resolver-typescript": "^3.5.2",
|
111
113
|
"eslint-plugin-import": "^2.26.0",
|
112
114
|
"eslint-plugin-jest": "^27.1.4",
|
115
|
+
"expect-type": "^0.14.2",
|
113
116
|
"jest": "^29.3.1",
|
114
117
|
"prettier": "^2.7.1",
|
115
118
|
"ts-jest": "^29.0.3",
|
116
119
|
"tsup": "^6.4.0",
|
117
120
|
"typescript": "^4.8.4"
|
118
121
|
},
|
122
|
+
"publishConfig": {
|
123
|
+
"access": "public"
|
124
|
+
},
|
119
125
|
"auto": {
|
120
126
|
"plugins": [
|
121
127
|
"npm",
|
122
128
|
"released"
|
123
129
|
]
|
124
|
-
},
|
125
|
-
"publishConfig": {
|
126
|
-
"access": "public"
|
127
130
|
}
|
128
131
|
}
|