@storybook/react 8.6.14 → 10.0.4
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.
- package/README.md +2 -0
- package/dist/_browser-chunks/chunk-7HDTOAND.js +279 -0
- package/dist/_browser-chunks/chunk-BUAOEMNB.js +14 -0
- package/dist/_browser-chunks/chunk-HBQ5Y6GW.js +209 -0
- package/dist/_browser-chunks/chunk-L5NVL7MD.js +37 -0
- package/dist/_browser-chunks/chunk-O24TFCLO.js +43 -0
- package/dist/_browser-chunks/chunk-SKEPQA2F.js +12031 -0
- package/dist/_browser-chunks/chunk-VVH2AMAL.js +1075 -0
- package/dist/entry-preview-argtypes.js +10 -0
- package/dist/entry-preview-docs.js +13 -47
- package/dist/entry-preview-rsc.js +11 -1
- package/dist/entry-preview.js +21 -1
- package/dist/index.d.ts +452 -9
- package/dist/index.js +79 -47
- package/dist/playwright.d.ts +1 -1
- package/dist/playwright.js +7 -1
- package/dist/preset.js +511 -1
- package/dist/preview.d.ts +247 -21
- package/dist/preview.js +12 -47
- package/package.json +25 -68
- package/preset.js +1 -1
- package/preview.js +1 -0
- package/template/cli/js/Button.stories.js +2 -2
- package/template/cli/js/Header.stories.js +1 -1
- package/template/cli/js/Page.stories.js +2 -2
- package/template/cli/{ts-4-9 → ts}/Button.stories.ts +3 -2
- package/template/cli/{ts-4-9 → ts}/Header.stories.ts +2 -1
- package/template/cli/{ts-4-9 → ts}/Page.stories.ts +3 -2
- package/template/components/index.js +1 -1
- package/dist/chunk-EWIU6LHT.mjs +0 -56
- package/dist/chunk-TENYCC3B.mjs +0 -8
- package/dist/chunk-XP5HYGXS.mjs +0 -3
- package/dist/chunk-ZGTCCPPZ.mjs +0 -7
- package/dist/entry-preview-docs.d.ts +0 -20
- package/dist/entry-preview-docs.mjs +0 -2
- package/dist/entry-preview-rsc.d.ts +0 -7
- package/dist/entry-preview-rsc.mjs +0 -5
- package/dist/entry-preview.d.ts +0 -19
- package/dist/entry-preview.mjs +0 -2
- package/dist/index.mjs +0 -11
- package/dist/playwright.mjs +0 -2
- package/dist/preset.d.ts +0 -18
- package/dist/preview.mjs +0 -4
- package/dist/public-types-f2c70f25.d.ts +0 -230
- package/dist/types-5617c98e.d.ts +0 -27
- package/template/cli/ts-3-8/Button.stories.ts +0 -53
- package/template/cli/ts-3-8/Header.stories.ts +0 -33
- package/template/cli/ts-3-8/Page.stories.ts +0 -32
- package/template/cli/ts-3-8/Page.tsx +0 -73
- package/template/cli/ts-4-9/Button.tsx +0 -37
- package/template/cli/ts-4-9/Header.tsx +0 -56
- /package/template/cli/{ts-3-8 → ts}/Button.tsx +0 -0
- /package/template/cli/{ts-3-8 → ts}/Header.tsx +0 -0
- /package/template/cli/{ts-4-9 → ts}/Page.tsx +0 -0
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import "./_browser-chunks/chunk-L5NVL7MD.js";
|
|
2
|
+
|
|
3
|
+
// src/entry-preview-rsc.tsx
|
|
4
|
+
var parameters = {
|
|
5
|
+
react: {
|
|
6
|
+
rsc: true
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
parameters
|
|
11
|
+
};
|
package/dist/entry-preview.js
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __commonJS=(cb,mod)=>function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};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 __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var require_constants=__commonJS({"../../node_modules/semver/internal/constants.js"(exports2,module2){"use strict";var SEMVER_SPEC_VERSION="2.0.0",MAX_SAFE_INTEGER=Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH=16,MAX_SAFE_BUILD_LENGTH=250,RELEASE_TYPES=["major","premajor","minor","preminor","patch","prepatch","prerelease"];module2.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH,MAX_SAFE_BUILD_LENGTH,MAX_SAFE_INTEGER,RELEASE_TYPES,SEMVER_SPEC_VERSION,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}});var require_debug=__commonJS({"../../node_modules/semver/internal/debug.js"(exports2,module2){"use strict";var debug=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...args)=>console.error("SEMVER",...args):()=>{};module2.exports=debug}});var require_re=__commonJS({"../../node_modules/semver/internal/re.js"(exports2,module2){"use strict";var{MAX_SAFE_COMPONENT_LENGTH,MAX_SAFE_BUILD_LENGTH,MAX_LENGTH}=require_constants(),debug=require_debug();exports2=module2.exports={};var re=exports2.re=[],safeRe=exports2.safeRe=[],src=exports2.src=[],safeSrc=exports2.safeSrc=[],t=exports2.t={},R=0,LETTERDASHNUMBER="[a-zA-Z0-9-]",safeRegexReplacements=[["\\s",1],["\\d",MAX_LENGTH],[LETTERDASHNUMBER,MAX_SAFE_BUILD_LENGTH]],makeSafeRegex=value=>{for(let[token,max]of safeRegexReplacements)value=value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);return value},createToken=(name,value,isGlobal)=>{let safe=makeSafeRegex(value),index=R++;debug(name,index,value),t[name]=index,src[index]=value,safeSrc[index]=safe,re[index]=new RegExp(value,isGlobal?"g":void 0),safeRe[index]=new RegExp(safe,isGlobal?"g":void 0)};createToken("NUMERICIDENTIFIER","0|[1-9]\\d*");createToken("NUMERICIDENTIFIERLOOSE","\\d+");createToken("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);createToken("MAINVERSION",`(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);createToken("MAINVERSIONLOOSE",`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);createToken("PRERELEASEIDENTIFIER",`(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);createToken("PRERELEASEIDENTIFIERLOOSE",`(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);createToken("PRERELEASE",`(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);createToken("PRERELEASELOOSE",`(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);createToken("BUILDIDENTIFIER",`${LETTERDASHNUMBER}+`);createToken("BUILD",`(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);createToken("FULLPLAIN",`v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);createToken("FULL",`^${src[t.FULLPLAIN]}$`);createToken("LOOSEPLAIN",`[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);createToken("LOOSE",`^${src[t.LOOSEPLAIN]}$`);createToken("GTLT","((?:<|>)?=?)");createToken("XRANGEIDENTIFIERLOOSE",`${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);createToken("XRANGEIDENTIFIER",`${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);createToken("XRANGEPLAIN",`[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);createToken("XRANGEPLAINLOOSE",`[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);createToken("XRANGE",`^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);createToken("XRANGELOOSE",`^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);createToken("COERCEPLAIN",`(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);createToken("COERCE",`${src[t.COERCEPLAIN]}(?:$|[^\\d])`);createToken("COERCEFULL",src[t.COERCEPLAIN]+`(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);createToken("COERCERTL",src[t.COERCE],!0);createToken("COERCERTLFULL",src[t.COERCEFULL],!0);createToken("LONETILDE","(?:~>?)");createToken("TILDETRIM",`(\\s*)${src[t.LONETILDE]}\\s+`,!0);exports2.tildeTrimReplace="$1~";createToken("TILDE",`^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);createToken("TILDELOOSE",`^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);createToken("LONECARET","(?:\\^)");createToken("CARETTRIM",`(\\s*)${src[t.LONECARET]}\\s+`,!0);exports2.caretTrimReplace="$1^";createToken("CARET",`^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);createToken("CARETLOOSE",`^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);createToken("COMPARATORLOOSE",`^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);createToken("COMPARATOR",`^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);createToken("COMPARATORTRIM",`(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`,!0);exports2.comparatorTrimReplace="$1$2$3";createToken("HYPHENRANGE",`^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);createToken("HYPHENRANGELOOSE",`^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);createToken("STAR","(<|>)?=?\\s*\\*");createToken("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");createToken("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}});var require_parse_options=__commonJS({"../../node_modules/semver/internal/parse-options.js"(exports2,module2){"use strict";var looseOption=Object.freeze({loose:!0}),emptyOpts=Object.freeze({}),parseOptions=options=>options?typeof options!="object"?looseOption:options:emptyOpts;module2.exports=parseOptions}});var require_identifiers=__commonJS({"../../node_modules/semver/internal/identifiers.js"(exports2,module2){"use strict";var numeric=/^[0-9]+$/,compareIdentifiers=(a,b)=>{let anum=numeric.test(a),bnum=numeric.test(b);return anum&&bnum&&(a=+a,b=+b),a===b?0:anum&&!bnum?-1:bnum&&!anum?1:a<b?-1:1},rcompareIdentifiers=(a,b)=>compareIdentifiers(b,a);module2.exports={compareIdentifiers,rcompareIdentifiers}}});var require_semver=__commonJS({"../../node_modules/semver/classes/semver.js"(exports2,module2){"use strict";var debug=require_debug(),{MAX_LENGTH,MAX_SAFE_INTEGER}=require_constants(),{safeRe:re,safeSrc:src,t}=require_re(),parseOptions=require_parse_options(),{compareIdentifiers}=require_identifiers(),SemVer=class _SemVer{constructor(version2,options){if(options=parseOptions(options),version2 instanceof _SemVer){if(version2.loose===!!options.loose&&version2.includePrerelease===!!options.includePrerelease)return version2;version2=version2.version}else if(typeof version2!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`);if(version2.length>MAX_LENGTH)throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);debug("SemVer",version2,options),this.options=options,this.loose=!!options.loose,this.includePrerelease=!!options.includePrerelease;let m=version2.trim().match(options.loose?re[t.LOOSE]:re[t.FULL]);if(!m)throw new TypeError(`Invalid Version: ${version2}`);if(this.raw=version2,this.major=+m[1],this.minor=+m[2],this.patch=+m[3],this.major>MAX_SAFE_INTEGER||this.major<0)throw new TypeError("Invalid major version");if(this.minor>MAX_SAFE_INTEGER||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>MAX_SAFE_INTEGER||this.patch<0)throw new TypeError("Invalid patch version");m[4]?this.prerelease=m[4].split(".").map(id=>{if(/^[0-9]+$/.test(id)){let num=+id;if(num>=0&&num<MAX_SAFE_INTEGER)return num}return id}):this.prerelease=[],this.build=m[5]?m[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(other){if(debug("SemVer.compare",this.version,this.options,other),!(other instanceof _SemVer)){if(typeof other=="string"&&other===this.version)return 0;other=new _SemVer(other,this.options)}return other.version===this.version?0:this.compareMain(other)||this.comparePre(other)}compareMain(other){return other instanceof _SemVer||(other=new _SemVer(other,this.options)),compareIdentifiers(this.major,other.major)||compareIdentifiers(this.minor,other.minor)||compareIdentifiers(this.patch,other.patch)}comparePre(other){if(other instanceof _SemVer||(other=new _SemVer(other,this.options)),this.prerelease.length&&!other.prerelease.length)return-1;if(!this.prerelease.length&&other.prerelease.length)return 1;if(!this.prerelease.length&&!other.prerelease.length)return 0;let i=0;do{let a=this.prerelease[i],b=other.prerelease[i];if(debug("prerelease compare",i,a,b),a===void 0&&b===void 0)return 0;if(b===void 0)return 1;if(a===void 0)return-1;if(a===b)continue;return compareIdentifiers(a,b)}while(++i)}compareBuild(other){other instanceof _SemVer||(other=new _SemVer(other,this.options));let i=0;do{let a=this.build[i],b=other.build[i];if(debug("build compare",i,a,b),a===void 0&&b===void 0)return 0;if(b===void 0)return 1;if(a===void 0)return-1;if(a===b)continue;return compareIdentifiers(a,b)}while(++i)}inc(release,identifier,identifierBase){if(release.startsWith("pre")){if(!identifier&&identifierBase===!1)throw new Error("invalid increment argument: identifier is empty");if(identifier){let r=new RegExp(`^${this.options.loose?src[t.PRERELEASELOOSE]:src[t.PRERELEASE]}$`),match=`-${identifier}`.match(r);if(!match||match[1]!==identifier)throw new Error(`invalid identifier: ${identifier}`)}}switch(release){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",identifier,identifierBase);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",identifier,identifierBase);break;case"prepatch":this.prerelease.length=0,this.inc("patch",identifier,identifierBase),this.inc("pre",identifier,identifierBase);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",identifier,identifierBase),this.inc("pre",identifier,identifierBase);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let base=Number(identifierBase)?1:0;if(this.prerelease.length===0)this.prerelease=[base];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(identifier===this.prerelease.join(".")&&identifierBase===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(base)}}if(identifier){let prerelease=[identifier,base];identifierBase===!1&&(prerelease=[identifier]),compareIdentifiers(this.prerelease[0],identifier)===0?isNaN(this.prerelease[1])&&(this.prerelease=prerelease):this.prerelease=prerelease}break}default:throw new Error(`invalid increment argument: ${release}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};module2.exports=SemVer}});var require_parse=__commonJS({"../../node_modules/semver/functions/parse.js"(exports2,module2){"use strict";var SemVer=require_semver(),parse=(version2,options,throwErrors=!1)=>{if(version2 instanceof SemVer)return version2;try{return new SemVer(version2,options)}catch(er){if(!throwErrors)return null;throw er}};module2.exports=parse}});var require_valid=__commonJS({"../../node_modules/semver/functions/valid.js"(exports2,module2){"use strict";var parse=require_parse(),valid=(version2,options)=>{let v=parse(version2,options);return v?v.version:null};module2.exports=valid}});var require_clean=__commonJS({"../../node_modules/semver/functions/clean.js"(exports2,module2){"use strict";var parse=require_parse(),clean=(version2,options)=>{let s=parse(version2.trim().replace(/^[=v]+/,""),options);return s?s.version:null};module2.exports=clean}});var require_inc=__commonJS({"../../node_modules/semver/functions/inc.js"(exports2,module2){"use strict";var SemVer=require_semver(),inc=(version2,release,options,identifier,identifierBase)=>{typeof options=="string"&&(identifierBase=identifier,identifier=options,options=void 0);try{return new SemVer(version2 instanceof SemVer?version2.version:version2,options).inc(release,identifier,identifierBase).version}catch{return null}};module2.exports=inc}});var require_diff=__commonJS({"../../node_modules/semver/functions/diff.js"(exports2,module2){"use strict";var parse=require_parse(),diff=(version1,version2)=>{let v1=parse(version1,null,!0),v2=parse(version2,null,!0),comparison=v1.compare(v2);if(comparison===0)return null;let v1Higher=comparison>0,highVersion=v1Higher?v1:v2,lowVersion=v1Higher?v2:v1,highHasPre=!!highVersion.prerelease.length;if(!!lowVersion.prerelease.length&&!highHasPre){if(!lowVersion.patch&&!lowVersion.minor)return"major";if(lowVersion.compareMain(highVersion)===0)return lowVersion.minor&&!lowVersion.patch?"minor":"patch"}let prefix=highHasPre?"pre":"";return v1.major!==v2.major?prefix+"major":v1.minor!==v2.minor?prefix+"minor":v1.patch!==v2.patch?prefix+"patch":"prerelease"};module2.exports=diff}});var require_major=__commonJS({"../../node_modules/semver/functions/major.js"(exports2,module2){"use strict";var SemVer=require_semver(),major=(a,loose)=>new SemVer(a,loose).major;module2.exports=major}});var require_minor=__commonJS({"../../node_modules/semver/functions/minor.js"(exports2,module2){"use strict";var SemVer=require_semver(),minor=(a,loose)=>new SemVer(a,loose).minor;module2.exports=minor}});var require_patch=__commonJS({"../../node_modules/semver/functions/patch.js"(exports2,module2){"use strict";var SemVer=require_semver(),patch=(a,loose)=>new SemVer(a,loose).patch;module2.exports=patch}});var require_prerelease=__commonJS({"../../node_modules/semver/functions/prerelease.js"(exports2,module2){"use strict";var parse=require_parse(),prerelease=(version2,options)=>{let parsed=parse(version2,options);return parsed&&parsed.prerelease.length?parsed.prerelease:null};module2.exports=prerelease}});var require_compare=__commonJS({"../../node_modules/semver/functions/compare.js"(exports2,module2){"use strict";var SemVer=require_semver(),compare=(a,b,loose)=>new SemVer(a,loose).compare(new SemVer(b,loose));module2.exports=compare}});var require_rcompare=__commonJS({"../../node_modules/semver/functions/rcompare.js"(exports2,module2){"use strict";var compare=require_compare(),rcompare=(a,b,loose)=>compare(b,a,loose);module2.exports=rcompare}});var require_compare_loose=__commonJS({"../../node_modules/semver/functions/compare-loose.js"(exports2,module2){"use strict";var compare=require_compare(),compareLoose=(a,b)=>compare(a,b,!0);module2.exports=compareLoose}});var require_compare_build=__commonJS({"../../node_modules/semver/functions/compare-build.js"(exports2,module2){"use strict";var SemVer=require_semver(),compareBuild=(a,b,loose)=>{let versionA=new SemVer(a,loose),versionB=new SemVer(b,loose);return versionA.compare(versionB)||versionA.compareBuild(versionB)};module2.exports=compareBuild}});var require_sort=__commonJS({"../../node_modules/semver/functions/sort.js"(exports2,module2){"use strict";var compareBuild=require_compare_build(),sort=(list,loose)=>list.sort((a,b)=>compareBuild(a,b,loose));module2.exports=sort}});var require_rsort=__commonJS({"../../node_modules/semver/functions/rsort.js"(exports2,module2){"use strict";var compareBuild=require_compare_build(),rsort=(list,loose)=>list.sort((a,b)=>compareBuild(b,a,loose));module2.exports=rsort}});var require_gt=__commonJS({"../../node_modules/semver/functions/gt.js"(exports2,module2){"use strict";var compare=require_compare(),gt=(a,b,loose)=>compare(a,b,loose)>0;module2.exports=gt}});var require_lt=__commonJS({"../../node_modules/semver/functions/lt.js"(exports2,module2){"use strict";var compare=require_compare(),lt=(a,b,loose)=>compare(a,b,loose)<0;module2.exports=lt}});var require_eq=__commonJS({"../../node_modules/semver/functions/eq.js"(exports2,module2){"use strict";var compare=require_compare(),eq=(a,b,loose)=>compare(a,b,loose)===0;module2.exports=eq}});var require_neq=__commonJS({"../../node_modules/semver/functions/neq.js"(exports2,module2){"use strict";var compare=require_compare(),neq=(a,b,loose)=>compare(a,b,loose)!==0;module2.exports=neq}});var require_gte=__commonJS({"../../node_modules/semver/functions/gte.js"(exports2,module2){"use strict";var compare=require_compare(),gte=(a,b,loose)=>compare(a,b,loose)>=0;module2.exports=gte}});var require_lte=__commonJS({"../../node_modules/semver/functions/lte.js"(exports2,module2){"use strict";var compare=require_compare(),lte=(a,b,loose)=>compare(a,b,loose)<=0;module2.exports=lte}});var require_cmp=__commonJS({"../../node_modules/semver/functions/cmp.js"(exports2,module2){"use strict";var eq=require_eq(),neq=require_neq(),gt=require_gt(),gte=require_gte(),lt=require_lt(),lte=require_lte(),cmp=(a,op,b,loose)=>{switch(op){case"===":return typeof a=="object"&&(a=a.version),typeof b=="object"&&(b=b.version),a===b;case"!==":return typeof a=="object"&&(a=a.version),typeof b=="object"&&(b=b.version),a!==b;case"":case"=":case"==":return eq(a,b,loose);case"!=":return neq(a,b,loose);case">":return gt(a,b,loose);case">=":return gte(a,b,loose);case"<":return lt(a,b,loose);case"<=":return lte(a,b,loose);default:throw new TypeError(`Invalid operator: ${op}`)}};module2.exports=cmp}});var require_coerce=__commonJS({"../../node_modules/semver/functions/coerce.js"(exports2,module2){"use strict";var SemVer=require_semver(),parse=require_parse(),{safeRe:re,t}=require_re(),coerce=(version2,options)=>{if(version2 instanceof SemVer)return version2;if(typeof version2=="number"&&(version2=String(version2)),typeof version2!="string")return null;options=options||{};let match=null;if(!options.rtl)match=version2.match(options.includePrerelease?re[t.COERCEFULL]:re[t.COERCE]);else{let coerceRtlRegex=options.includePrerelease?re[t.COERCERTLFULL]:re[t.COERCERTL],next;for(;(next=coerceRtlRegex.exec(version2))&&(!match||match.index+match[0].length!==version2.length);)(!match||next.index+next[0].length!==match.index+match[0].length)&&(match=next),coerceRtlRegex.lastIndex=next.index+next[1].length+next[2].length;coerceRtlRegex.lastIndex=-1}if(match===null)return null;let major=match[2],minor=match[3]||"0",patch=match[4]||"0",prerelease=options.includePrerelease&&match[5]?`-${match[5]}`:"",build=options.includePrerelease&&match[6]?`+${match[6]}`:"";return parse(`${major}.${minor}.${patch}${prerelease}${build}`,options)};module2.exports=coerce}});var require_lrucache=__commonJS({"../../node_modules/semver/internal/lrucache.js"(exports2,module2){"use strict";var LRUCache=class{constructor(){this.max=1e3,this.map=new Map}get(key){let value=this.map.get(key);if(value!==void 0)return this.map.delete(key),this.map.set(key,value),value}delete(key){return this.map.delete(key)}set(key,value){if(!this.delete(key)&&value!==void 0){if(this.map.size>=this.max){let firstKey=this.map.keys().next().value;this.delete(firstKey)}this.map.set(key,value)}return this}};module2.exports=LRUCache}});var require_range=__commonJS({"../../node_modules/semver/classes/range.js"(exports2,module2){"use strict";var SPACE_CHARACTERS=/\s+/g,Range=class _Range{constructor(range,options){if(options=parseOptions(options),range instanceof _Range)return range.loose===!!options.loose&&range.includePrerelease===!!options.includePrerelease?range:new _Range(range.raw,options);if(range instanceof Comparator)return this.raw=range.value,this.set=[[range]],this.formatted=void 0,this;if(this.options=options,this.loose=!!options.loose,this.includePrerelease=!!options.includePrerelease,this.raw=range.trim().replace(SPACE_CHARACTERS," "),this.set=this.raw.split("||").map(r=>this.parseRange(r.trim())).filter(c=>c.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let first=this.set[0];if(this.set=this.set.filter(c=>!isNullSet(c[0])),this.set.length===0)this.set=[first];else if(this.set.length>1){for(let c of this.set)if(c.length===1&&isAny(c[0])){this.set=[c];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let i=0;i<this.set.length;i++){i>0&&(this.formatted+="||");let comps=this.set[i];for(let k=0;k<comps.length;k++)k>0&&(this.formatted+=" "),this.formatted+=comps[k].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(range){let memoKey=((this.options.includePrerelease&&FLAG_INCLUDE_PRERELEASE)|(this.options.loose&&FLAG_LOOSE))+":"+range,cached=cache.get(memoKey);if(cached)return cached;let loose=this.options.loose,hr=loose?re[t.HYPHENRANGELOOSE]:re[t.HYPHENRANGE];range=range.replace(hr,hyphenReplace(this.options.includePrerelease)),debug("hyphen replace",range),range=range.replace(re[t.COMPARATORTRIM],comparatorTrimReplace),debug("comparator trim",range),range=range.replace(re[t.TILDETRIM],tildeTrimReplace),debug("tilde trim",range),range=range.replace(re[t.CARETTRIM],caretTrimReplace),debug("caret trim",range);let rangeList=range.split(" ").map(comp=>parseComparator(comp,this.options)).join(" ").split(/\s+/).map(comp=>replaceGTE0(comp,this.options));loose&&(rangeList=rangeList.filter(comp=>(debug("loose invalid filter",comp,this.options),!!comp.match(re[t.COMPARATORLOOSE])))),debug("range list",rangeList);let rangeMap=new Map,comparators=rangeList.map(comp=>new Comparator(comp,this.options));for(let comp of comparators){if(isNullSet(comp))return[comp];rangeMap.set(comp.value,comp)}rangeMap.size>1&&rangeMap.has("")&&rangeMap.delete("");let result=[...rangeMap.values()];return cache.set(memoKey,result),result}intersects(range,options){if(!(range instanceof _Range))throw new TypeError("a Range is required");return this.set.some(thisComparators=>isSatisfiable(thisComparators,options)&&range.set.some(rangeComparators=>isSatisfiable(rangeComparators,options)&&thisComparators.every(thisComparator=>rangeComparators.every(rangeComparator=>thisComparator.intersects(rangeComparator,options)))))}test(version2){if(!version2)return!1;if(typeof version2=="string")try{version2=new SemVer(version2,this.options)}catch{return!1}for(let i=0;i<this.set.length;i++)if(testSet(this.set[i],version2,this.options))return!0;return!1}};module2.exports=Range;var LRU=require_lrucache(),cache=new LRU,parseOptions=require_parse_options(),Comparator=require_comparator(),debug=require_debug(),SemVer=require_semver(),{safeRe:re,t,comparatorTrimReplace,tildeTrimReplace,caretTrimReplace}=require_re(),{FLAG_INCLUDE_PRERELEASE,FLAG_LOOSE}=require_constants(),isNullSet=c=>c.value==="<0.0.0-0",isAny=c=>c.value==="",isSatisfiable=(comparators,options)=>{let result=!0,remainingComparators=comparators.slice(),testComparator=remainingComparators.pop();for(;result&&remainingComparators.length;)result=remainingComparators.every(otherComparator=>testComparator.intersects(otherComparator,options)),testComparator=remainingComparators.pop();return result},parseComparator=(comp,options)=>(debug("comp",comp,options),comp=replaceCarets(comp,options),debug("caret",comp),comp=replaceTildes(comp,options),debug("tildes",comp),comp=replaceXRanges(comp,options),debug("xrange",comp),comp=replaceStars(comp,options),debug("stars",comp),comp),isX=id=>!id||id.toLowerCase()==="x"||id==="*",replaceTildes=(comp,options)=>comp.trim().split(/\s+/).map(c=>replaceTilde(c,options)).join(" "),replaceTilde=(comp,options)=>{let r=options.loose?re[t.TILDELOOSE]:re[t.TILDE];return comp.replace(r,(_,M,m,p,pr)=>{debug("tilde",comp,_,M,m,p,pr);let ret;return isX(M)?ret="":isX(m)?ret=`>=${M}.0.0 <${+M+1}.0.0-0`:isX(p)?ret=`>=${M}.${m}.0 <${M}.${+m+1}.0-0`:pr?(debug("replaceTilde pr",pr),ret=`>=${M}.${m}.${p}-${pr} <${M}.${+m+1}.0-0`):ret=`>=${M}.${m}.${p} <${M}.${+m+1}.0-0`,debug("tilde return",ret),ret})},replaceCarets=(comp,options)=>comp.trim().split(/\s+/).map(c=>replaceCaret(c,options)).join(" "),replaceCaret=(comp,options)=>{debug("caret",comp,options);let r=options.loose?re[t.CARETLOOSE]:re[t.CARET],z=options.includePrerelease?"-0":"";return comp.replace(r,(_,M,m,p,pr)=>{debug("caret",comp,_,M,m,p,pr);let ret;return isX(M)?ret="":isX(m)?ret=`>=${M}.0.0${z} <${+M+1}.0.0-0`:isX(p)?M==="0"?ret=`>=${M}.${m}.0${z} <${M}.${+m+1}.0-0`:ret=`>=${M}.${m}.0${z} <${+M+1}.0.0-0`:pr?(debug("replaceCaret pr",pr),M==="0"?m==="0"?ret=`>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p+1}-0`:ret=`>=${M}.${m}.${p}-${pr} <${M}.${+m+1}.0-0`:ret=`>=${M}.${m}.${p}-${pr} <${+M+1}.0.0-0`):(debug("no pr"),M==="0"?m==="0"?ret=`>=${M}.${m}.${p}${z} <${M}.${m}.${+p+1}-0`:ret=`>=${M}.${m}.${p}${z} <${M}.${+m+1}.0-0`:ret=`>=${M}.${m}.${p} <${+M+1}.0.0-0`),debug("caret return",ret),ret})},replaceXRanges=(comp,options)=>(debug("replaceXRanges",comp,options),comp.split(/\s+/).map(c=>replaceXRange(c,options)).join(" ")),replaceXRange=(comp,options)=>{comp=comp.trim();let r=options.loose?re[t.XRANGELOOSE]:re[t.XRANGE];return comp.replace(r,(ret,gtlt,M,m,p,pr)=>{debug("xRange",comp,ret,gtlt,M,m,p,pr);let xM=isX(M),xm=xM||isX(m),xp=xm||isX(p),anyX=xp;return gtlt==="="&&anyX&&(gtlt=""),pr=options.includePrerelease?"-0":"",xM?gtlt===">"||gtlt==="<"?ret="<0.0.0-0":ret="*":gtlt&&anyX?(xm&&(m=0),p=0,gtlt===">"?(gtlt=">=",xm?(M=+M+1,m=0,p=0):(m=+m+1,p=0)):gtlt==="<="&&(gtlt="<",xm?M=+M+1:m=+m+1),gtlt==="<"&&(pr="-0"),ret=`${gtlt+M}.${m}.${p}${pr}`):xm?ret=`>=${M}.0.0${pr} <${+M+1}.0.0-0`:xp&&(ret=`>=${M}.${m}.0${pr} <${M}.${+m+1}.0-0`),debug("xRange return",ret),ret})},replaceStars=(comp,options)=>(debug("replaceStars",comp,options),comp.trim().replace(re[t.STAR],"")),replaceGTE0=(comp,options)=>(debug("replaceGTE0",comp,options),comp.trim().replace(re[options.includePrerelease?t.GTE0PRE:t.GTE0],"")),hyphenReplace=incPr=>($0,from,fM,fm,fp,fpr,fb,to,tM,tm,tp,tpr)=>(isX(fM)?from="":isX(fm)?from=`>=${fM}.0.0${incPr?"-0":""}`:isX(fp)?from=`>=${fM}.${fm}.0${incPr?"-0":""}`:fpr?from=`>=${from}`:from=`>=${from}${incPr?"-0":""}`,isX(tM)?to="":isX(tm)?to=`<${+tM+1}.0.0-0`:isX(tp)?to=`<${tM}.${+tm+1}.0-0`:tpr?to=`<=${tM}.${tm}.${tp}-${tpr}`:incPr?to=`<${tM}.${tm}.${+tp+1}-0`:to=`<=${to}`,`${from} ${to}`.trim()),testSet=(set,version2,options)=>{for(let i=0;i<set.length;i++)if(!set[i].test(version2))return!1;if(version2.prerelease.length&&!options.includePrerelease){for(let i=0;i<set.length;i++)if(debug(set[i].semver),set[i].semver!==Comparator.ANY&&set[i].semver.prerelease.length>0){let allowed=set[i].semver;if(allowed.major===version2.major&&allowed.minor===version2.minor&&allowed.patch===version2.patch)return!0}return!1}return!0}}});var require_comparator=__commonJS({"../../node_modules/semver/classes/comparator.js"(exports2,module2){"use strict";var ANY=Symbol("SemVer ANY"),Comparator=class _Comparator{static get ANY(){return ANY}constructor(comp,options){if(options=parseOptions(options),comp instanceof _Comparator){if(comp.loose===!!options.loose)return comp;comp=comp.value}comp=comp.trim().split(/\s+/).join(" "),debug("comparator",comp,options),this.options=options,this.loose=!!options.loose,this.parse(comp),this.semver===ANY?this.value="":this.value=this.operator+this.semver.version,debug("comp",this)}parse(comp){let r=this.options.loose?re[t.COMPARATORLOOSE]:re[t.COMPARATOR],m=comp.match(r);if(!m)throw new TypeError(`Invalid comparator: ${comp}`);this.operator=m[1]!==void 0?m[1]:"",this.operator==="="&&(this.operator=""),m[2]?this.semver=new SemVer(m[2],this.options.loose):this.semver=ANY}toString(){return this.value}test(version2){if(debug("Comparator.test",version2,this.options.loose),this.semver===ANY||version2===ANY)return!0;if(typeof version2=="string")try{version2=new SemVer(version2,this.options)}catch{return!1}return cmp(version2,this.operator,this.semver,this.options)}intersects(comp,options){if(!(comp instanceof _Comparator))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Range(comp.value,options).test(this.value):comp.operator===""?comp.value===""?!0:new Range(this.value,options).test(comp.semver):(options=parseOptions(options),options.includePrerelease&&(this.value==="<0.0.0-0"||comp.value==="<0.0.0-0")||!options.includePrerelease&&(this.value.startsWith("<0.0.0")||comp.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&comp.operator.startsWith(">")||this.operator.startsWith("<")&&comp.operator.startsWith("<")||this.semver.version===comp.semver.version&&this.operator.includes("=")&&comp.operator.includes("=")||cmp(this.semver,"<",comp.semver,options)&&this.operator.startsWith(">")&&comp.operator.startsWith("<")||cmp(this.semver,">",comp.semver,options)&&this.operator.startsWith("<")&&comp.operator.startsWith(">")))}};module2.exports=Comparator;var parseOptions=require_parse_options(),{safeRe:re,t}=require_re(),cmp=require_cmp(),debug=require_debug(),SemVer=require_semver(),Range=require_range()}});var require_satisfies=__commonJS({"../../node_modules/semver/functions/satisfies.js"(exports2,module2){"use strict";var Range=require_range(),satisfies=(version2,range,options)=>{try{range=new Range(range,options)}catch{return!1}return range.test(version2)};module2.exports=satisfies}});var require_to_comparators=__commonJS({"../../node_modules/semver/ranges/to-comparators.js"(exports2,module2){"use strict";var Range=require_range(),toComparators=(range,options)=>new Range(range,options).set.map(comp=>comp.map(c=>c.value).join(" ").trim().split(" "));module2.exports=toComparators}});var require_max_satisfying=__commonJS({"../../node_modules/semver/ranges/max-satisfying.js"(exports2,module2){"use strict";var SemVer=require_semver(),Range=require_range(),maxSatisfying=(versions,range,options)=>{let max=null,maxSV=null,rangeObj=null;try{rangeObj=new Range(range,options)}catch{return null}return versions.forEach(v=>{rangeObj.test(v)&&(!max||maxSV.compare(v)===-1)&&(max=v,maxSV=new SemVer(max,options))}),max};module2.exports=maxSatisfying}});var require_min_satisfying=__commonJS({"../../node_modules/semver/ranges/min-satisfying.js"(exports2,module2){"use strict";var SemVer=require_semver(),Range=require_range(),minSatisfying=(versions,range,options)=>{let min=null,minSV=null,rangeObj=null;try{rangeObj=new Range(range,options)}catch{return null}return versions.forEach(v=>{rangeObj.test(v)&&(!min||minSV.compare(v)===1)&&(min=v,minSV=new SemVer(min,options))}),min};module2.exports=minSatisfying}});var require_min_version=__commonJS({"../../node_modules/semver/ranges/min-version.js"(exports2,module2){"use strict";var SemVer=require_semver(),Range=require_range(),gt=require_gt(),minVersion=(range,loose)=>{range=new Range(range,loose);let minver=new SemVer("0.0.0");if(range.test(minver)||(minver=new SemVer("0.0.0-0"),range.test(minver)))return minver;minver=null;for(let i=0;i<range.set.length;++i){let comparators=range.set[i],setMin=null;comparators.forEach(comparator=>{let compver=new SemVer(comparator.semver.version);switch(comparator.operator){case">":compver.prerelease.length===0?compver.patch++:compver.prerelease.push(0),compver.raw=compver.format();case"":case">=":(!setMin||gt(compver,setMin))&&(setMin=compver);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${comparator.operator}`)}}),setMin&&(!minver||gt(minver,setMin))&&(minver=setMin)}return minver&&range.test(minver)?minver:null};module2.exports=minVersion}});var require_valid2=__commonJS({"../../node_modules/semver/ranges/valid.js"(exports2,module2){"use strict";var Range=require_range(),validRange=(range,options)=>{try{return new Range(range,options).range||"*"}catch{return null}};module2.exports=validRange}});var require_outside=__commonJS({"../../node_modules/semver/ranges/outside.js"(exports2,module2){"use strict";var SemVer=require_semver(),Comparator=require_comparator(),{ANY}=Comparator,Range=require_range(),satisfies=require_satisfies(),gt=require_gt(),lt=require_lt(),lte=require_lte(),gte=require_gte(),outside=(version2,range,hilo,options)=>{version2=new SemVer(version2,options),range=new Range(range,options);let gtfn,ltefn,ltfn,comp,ecomp;switch(hilo){case">":gtfn=gt,ltefn=lte,ltfn=lt,comp=">",ecomp=">=";break;case"<":gtfn=lt,ltefn=gte,ltfn=gt,comp="<",ecomp="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(satisfies(version2,range,options))return!1;for(let i=0;i<range.set.length;++i){let comparators=range.set[i],high=null,low=null;if(comparators.forEach(comparator=>{comparator.semver===ANY&&(comparator=new Comparator(">=0.0.0")),high=high||comparator,low=low||comparator,gtfn(comparator.semver,high.semver,options)?high=comparator:ltfn(comparator.semver,low.semver,options)&&(low=comparator)}),high.operator===comp||high.operator===ecomp||(!low.operator||low.operator===comp)&<efn(version2,low.semver))return!1;if(low.operator===ecomp&<fn(version2,low.semver))return!1}return!0};module2.exports=outside}});var require_gtr=__commonJS({"../../node_modules/semver/ranges/gtr.js"(exports2,module2){"use strict";var outside=require_outside(),gtr=(version2,range,options)=>outside(version2,range,">",options);module2.exports=gtr}});var require_ltr=__commonJS({"../../node_modules/semver/ranges/ltr.js"(exports2,module2){"use strict";var outside=require_outside(),ltr=(version2,range,options)=>outside(version2,range,"<",options);module2.exports=ltr}});var require_intersects=__commonJS({"../../node_modules/semver/ranges/intersects.js"(exports2,module2){"use strict";var Range=require_range(),intersects=(r1,r2,options)=>(r1=new Range(r1,options),r2=new Range(r2,options),r1.intersects(r2,options));module2.exports=intersects}});var require_simplify=__commonJS({"../../node_modules/semver/ranges/simplify.js"(exports2,module2){"use strict";var satisfies=require_satisfies(),compare=require_compare();module2.exports=(versions,range,options)=>{let set=[],first=null,prev=null,v=versions.sort((a,b)=>compare(a,b,options));for(let version2 of v)satisfies(version2,range,options)?(prev=version2,first||(first=version2)):(prev&&set.push([first,prev]),prev=null,first=null);first&&set.push([first,null]);let ranges=[];for(let[min,max]of set)min===max?ranges.push(min):!max&&min===v[0]?ranges.push("*"):max?min===v[0]?ranges.push(`<=${max}`):ranges.push(`${min} - ${max}`):ranges.push(`>=${min}`);let simplified=ranges.join(" || "),original=typeof range.raw=="string"?range.raw:String(range);return simplified.length<original.length?simplified:range}}});var require_subset=__commonJS({"../../node_modules/semver/ranges/subset.js"(exports2,module2){"use strict";var Range=require_range(),Comparator=require_comparator(),{ANY}=Comparator,satisfies=require_satisfies(),compare=require_compare(),subset=(sub,dom,options={})=>{if(sub===dom)return!0;sub=new Range(sub,options),dom=new Range(dom,options);let sawNonNull=!1;OUTER:for(let simpleSub of sub.set){for(let simpleDom of dom.set){let isSub=simpleSubset(simpleSub,simpleDom,options);if(sawNonNull=sawNonNull||isSub!==null,isSub)continue OUTER}if(sawNonNull)return!1}return!0},minimumVersionWithPreRelease=[new Comparator(">=0.0.0-0")],minimumVersion=[new Comparator(">=0.0.0")],simpleSubset=(sub,dom,options)=>{if(sub===dom)return!0;if(sub.length===1&&sub[0].semver===ANY){if(dom.length===1&&dom[0].semver===ANY)return!0;options.includePrerelease?sub=minimumVersionWithPreRelease:sub=minimumVersion}if(dom.length===1&&dom[0].semver===ANY){if(options.includePrerelease)return!0;dom=minimumVersion}let eqSet=new Set,gt,lt;for(let c of sub)c.operator===">"||c.operator===">="?gt=higherGT(gt,c,options):c.operator==="<"||c.operator==="<="?lt=lowerLT(lt,c,options):eqSet.add(c.semver);if(eqSet.size>1)return null;let gtltComp;if(gt&<){if(gtltComp=compare(gt.semver,lt.semver,options),gtltComp>0)return null;if(gtltComp===0&&(gt.operator!==">="||lt.operator!=="<="))return null}for(let eq of eqSet){if(gt&&!satisfies(eq,String(gt),options)||lt&&!satisfies(eq,String(lt),options))return null;for(let c of dom)if(!satisfies(eq,String(c),options))return!1;return!0}let higher,lower,hasDomLT,hasDomGT,needDomLTPre=lt&&!options.includePrerelease&<.semver.prerelease.length?lt.semver:!1,needDomGTPre=gt&&!options.includePrerelease&>.semver.prerelease.length?gt.semver:!1;needDomLTPre&&needDomLTPre.prerelease.length===1&<.operator==="<"&&needDomLTPre.prerelease[0]===0&&(needDomLTPre=!1);for(let c of dom){if(hasDomGT=hasDomGT||c.operator===">"||c.operator===">=",hasDomLT=hasDomLT||c.operator==="<"||c.operator==="<=",gt){if(needDomGTPre&&c.semver.prerelease&&c.semver.prerelease.length&&c.semver.major===needDomGTPre.major&&c.semver.minor===needDomGTPre.minor&&c.semver.patch===needDomGTPre.patch&&(needDomGTPre=!1),c.operator===">"||c.operator===">="){if(higher=higherGT(gt,c,options),higher===c&&higher!==gt)return!1}else if(gt.operator===">="&&!satisfies(gt.semver,String(c),options))return!1}if(lt){if(needDomLTPre&&c.semver.prerelease&&c.semver.prerelease.length&&c.semver.major===needDomLTPre.major&&c.semver.minor===needDomLTPre.minor&&c.semver.patch===needDomLTPre.patch&&(needDomLTPre=!1),c.operator==="<"||c.operator==="<="){if(lower=lowerLT(lt,c,options),lower===c&&lower!==lt)return!1}else if(lt.operator==="<="&&!satisfies(lt.semver,String(c),options))return!1}if(!c.operator&&(lt||gt)&>ltComp!==0)return!1}return!(gt&&hasDomLT&&!lt&>ltComp!==0||lt&&hasDomGT&&!gt&>ltComp!==0||needDomGTPre||needDomLTPre)},higherGT=(a,b,options)=>{if(!a)return b;let comp=compare(a.semver,b.semver,options);return comp>0?a:comp<0||b.operator===">"&&a.operator===">="?b:a},lowerLT=(a,b,options)=>{if(!a)return b;let comp=compare(a.semver,b.semver,options);return comp<0?a:comp>0||b.operator==="<"&&a.operator==="<="?b:a};module2.exports=subset}});var require_semver2=__commonJS({"../../node_modules/semver/index.js"(exports2,module2){"use strict";var internalRe=require_re(),constants=require_constants(),SemVer=require_semver(),identifiers=require_identifiers(),parse=require_parse(),valid=require_valid(),clean=require_clean(),inc=require_inc(),diff=require_diff(),major=require_major(),minor=require_minor(),patch=require_patch(),prerelease=require_prerelease(),compare=require_compare(),rcompare=require_rcompare(),compareLoose=require_compare_loose(),compareBuild=require_compare_build(),sort=require_sort(),rsort=require_rsort(),gt=require_gt(),lt=require_lt(),eq=require_eq(),neq=require_neq(),gte=require_gte(),lte=require_lte(),cmp=require_cmp(),coerce=require_coerce(),Comparator=require_comparator(),Range=require_range(),satisfies=require_satisfies(),toComparators=require_to_comparators(),maxSatisfying=require_max_satisfying(),minSatisfying=require_min_satisfying(),minVersion=require_min_version(),validRange=require_valid2(),outside=require_outside(),gtr=require_gtr(),ltr=require_ltr(),intersects=require_intersects(),simplifyRange=require_simplify(),subset=require_subset();module2.exports={parse,valid,clean,inc,diff,major,minor,patch,prerelease,compare,rcompare,compareLoose,compareBuild,sort,rsort,gt,lt,eq,neq,gte,lte,cmp,coerce,Comparator,Range,satisfies,toComparators,maxSatisfying,minSatisfying,minVersion,validRange,outside,gtr,ltr,intersects,simplifyRange,subset,SemVer,re:internalRe.re,src:internalRe.src,tokens:internalRe.t,SEMVER_SPEC_VERSION:constants.SEMVER_SPEC_VERSION,RELEASE_TYPES:constants.RELEASE_TYPES,compareIdentifiers:identifiers.compareIdentifiers,rcompareIdentifiers:identifiers.rcompareIdentifiers}}});var entry_preview_exports={};__export(entry_preview_exports,{beforeAll:()=>beforeAll,decorators:()=>decorators,mount:()=>mount,parameters:()=>parameters,render:()=>render,renderToCanvas:()=>renderToCanvas});module.exports=__toCommonJS(entry_preview_exports);var React4=__toESM(require("react")),import_semver=__toESM(require_semver2());var React=__toESM(require("react")),clonedReact={...React};function setReactActEnvironment(isReactActEnvironment){globalThis.IS_REACT_ACT_ENVIRONMENT=isReactActEnvironment}function getReactActEnvironment(){return globalThis.IS_REACT_ACT_ENVIRONMENT}function withGlobalActEnvironment(actImplementation){return callback=>{let previousActEnvironment=getReactActEnvironment();setReactActEnvironment(!0);try{let callbackNeedsToBeAwaited=!1,actResult=actImplementation(()=>{let result=callback();return result!==null&&typeof result=="object"&&typeof result.then=="function"&&(callbackNeedsToBeAwaited=!0),result});if(callbackNeedsToBeAwaited){let thenable=actResult;return{then:(resolve,reject)=>{thenable.then(returnValue=>{setReactActEnvironment(previousActEnvironment),resolve(returnValue)},error=>{setReactActEnvironment(previousActEnvironment),reject(error)})}}}else return setReactActEnvironment(previousActEnvironment),actResult}catch(error){throw setReactActEnvironment(previousActEnvironment),error}}}var getAct=async()=>{let reactAct;if(typeof clonedReact.act=="function")reactAct=clonedReact.act;else{let deprecatedTestUtils=await import("react-dom/test-utils");reactAct=deprecatedTestUtils?.default?.act??deprecatedTestUtils.act}return process.env.NODE_ENV==="production"?cb=>cb():withGlobalActEnvironment(reactAct)};var import_react=__toESM(require("react")),render=(args,context)=>{let{id,component:Component}=context;if(!Component)throw new Error(`Unable to render story ${id} as the component annotation is missing from the default export`);return import_react.default.createElement(Component,{...args})};var import_react2=__toESM(require("react")),import_global=require("@storybook/global");var{FRAMEWORK_OPTIONS}=import_global.global,ErrorBoundary=class extends import_react2.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){let{hasError}=this.state,{showMain}=this.props;hasError||showMain()}componentDidCatch(err){let{showException}=this.props;showException(err)}render(){let{hasError}=this.state,{children}=this.props;return hasError?null:children}},Wrapper=FRAMEWORK_OPTIONS?.strictMode?import_react2.StrictMode:import_react2.Fragment,actQueue=[],isActing=!1,processActQueue=async()=>{if(isActing||actQueue.length===0)return;isActing=!0;let actTask=actQueue.shift();actTask&&await actTask(),isActing=!1,processActQueue()};async function renderToCanvas({storyContext,unboundStoryFn,showMain,showException,forceRemount},canvasElement){let{renderElement,unmountElement}=await import("@storybook/react-dom-shim"),Story=unboundStoryFn,content=storyContext.parameters.__isPortableStory?import_react2.default.createElement(Story,{...storyContext}):import_react2.default.createElement(ErrorBoundary,{showMain,showException},import_react2.default.createElement(Story,{...storyContext})),element=Wrapper?import_react2.default.createElement(Wrapper,null,content):content;forceRemount&&unmountElement(canvasElement);let act=await getAct();return await new Promise(async(resolve,reject)=>{actQueue.push(async()=>{try{await act(async()=>{await renderElement(element,canvasElement,storyContext?.parameters?.react?.rootOptions)}),resolve()}catch(e){reject(e)}}),processActQueue()}),async()=>{await act(()=>{unmountElement(canvasElement)})}}var mount=context=>async ui=>(ui!=null&&(context.originalStoryFn=()=>ui),await context.renderToCanvas(),context.canvas);var parameters={renderer:"react"},decorators=[(story,context)=>{if(!context.parameters?.react?.rsc)return story();let major=import_semver.default.major(React4.version),minor=import_semver.default.minor(React4.version);if(major<18||major===18&&minor<3)throw new Error("React Server Components require React >= 18.3");return React4.createElement(React4.Suspense,null,story())}],beforeAll=async()=>{try{let{configure}=await import("@storybook/test"),act=await getAct();configure({unstable_advanceTimersWrapper:cb=>act(cb),asyncWrapper:async cb=>{let previousActEnvironment=getReactActEnvironment();setReactActEnvironment(!1);try{let result=await cb();return await new Promise(resolve=>{setTimeout(()=>{resolve()},0),jestFakeTimersAreEnabled()&&jest.advanceTimersByTime(0)}),result}finally{setReactActEnvironment(previousActEnvironment)}},eventWrapper:cb=>{let result;return act(()=>(result=cb(),result)),result}})}catch{}};function jestFakeTimersAreEnabled(){return typeof jest<"u"&&jest!==null?setTimeout._isMockFunction===!0||Object.prototype.hasOwnProperty.call(setTimeout,"clock"):!1}0&&(module.exports={beforeAll,decorators,mount,parameters,render,renderToCanvas});
|
|
1
|
+
import {
|
|
2
|
+
beforeAll,
|
|
3
|
+
decorators,
|
|
4
|
+
mount,
|
|
5
|
+
parameters,
|
|
6
|
+
render,
|
|
7
|
+
renderToCanvas
|
|
8
|
+
} from "./_browser-chunks/chunk-7HDTOAND.js";
|
|
9
|
+
import {
|
|
10
|
+
applyDecorators
|
|
11
|
+
} from "./_browser-chunks/chunk-BUAOEMNB.js";
|
|
12
|
+
import "./_browser-chunks/chunk-L5NVL7MD.js";
|
|
13
|
+
export {
|
|
14
|
+
applyDecorators,
|
|
15
|
+
beforeAll,
|
|
16
|
+
decorators,
|
|
17
|
+
mount,
|
|
18
|
+
parameters,
|
|
19
|
+
render,
|
|
20
|
+
renderToCanvas
|
|
21
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,422 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations, ProjectAnnotations, Args, StoryAnnotationsOrFn, ComposedStoryFn, Store_CSFExports, StoriesWithPartialProps } from 'storybook/internal/types';
|
|
1
|
+
import { ComponentType, JSX, ComponentProps } from 'react';
|
|
2
|
+
import { WebRenderer, Canvas, Args, ComponentAnnotations, AnnotatedStoryFn, ArgsStoryFn, ArgsFromMeta, StoryAnnotations, StrictArgs, DecoratorFunction, LoaderFunction, StoryContext as StoryContext$1, ProjectAnnotations, NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations, StoryAnnotationsOrFn, ComposedStoryFn, Store_CSFExports, StoriesWithPartialProps, Renderer } from 'storybook/internal/types';
|
|
4
3
|
export { ArgTypes, Args, Parameters, StrictArgs } from 'storybook/internal/types';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { RootOptions } from 'react-dom/client';
|
|
5
|
+
import { PreviewAddon, InferTypes, AddonTypes, Preview as Preview$1, Meta as Meta$1, Story } from 'storybook/internal/csf';
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
interface SymbolConstructor {
|
|
9
|
+
readonly observable: symbol;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
Returns a boolean for whether the two given types are equal.
|
|
15
|
+
|
|
16
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
17
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
18
|
+
*/
|
|
19
|
+
type IsEqual<T, U> =
|
|
20
|
+
(<G>() => G extends T ? 1 : 2) extends
|
|
21
|
+
(<G>() => G extends U ? 1 : 2)
|
|
22
|
+
? true
|
|
23
|
+
: false;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
Filter out keys from an object.
|
|
27
|
+
|
|
28
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
29
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
30
|
+
Returns `Key` otherwise.
|
|
31
|
+
|
|
32
|
+
@example
|
|
33
|
+
```
|
|
34
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
35
|
+
//=> never
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
@example
|
|
39
|
+
```
|
|
40
|
+
type Filtered = Filter<'bar', string>;
|
|
41
|
+
//=> never
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
@example
|
|
45
|
+
```
|
|
46
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
47
|
+
//=> 'bar'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
@see {Except}
|
|
51
|
+
*/
|
|
52
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
Create a type from an object type without certain keys.
|
|
56
|
+
|
|
57
|
+
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
|
58
|
+
|
|
59
|
+
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
|
|
60
|
+
|
|
61
|
+
@example
|
|
62
|
+
```
|
|
63
|
+
import type {Except} from 'type-fest';
|
|
64
|
+
|
|
65
|
+
type Foo = {
|
|
66
|
+
a: number;
|
|
67
|
+
b: string;
|
|
68
|
+
c: boolean;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
type FooWithoutA = Except<Foo, 'a' | 'c'>;
|
|
72
|
+
//=> {b: string};
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
@category Object
|
|
76
|
+
*/
|
|
77
|
+
type Except<ObjectType, KeysType extends keyof ObjectType> = {
|
|
78
|
+
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
@see Simplify
|
|
83
|
+
*/
|
|
84
|
+
interface SimplifyOptions {
|
|
85
|
+
/**
|
|
86
|
+
Do the simplification recursively.
|
|
87
|
+
|
|
88
|
+
@default false
|
|
89
|
+
*/
|
|
90
|
+
deep?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Flatten a type without worrying about the result.
|
|
94
|
+
type Flatten<
|
|
95
|
+
AnyType,
|
|
96
|
+
Options extends SimplifyOptions = {},
|
|
97
|
+
> = Options['deep'] extends true
|
|
98
|
+
? {[KeyType in keyof AnyType]: Simplify<AnyType[KeyType], Options>}
|
|
99
|
+
: {[KeyType in keyof AnyType]: AnyType[KeyType]};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
|
103
|
+
|
|
104
|
+
@example
|
|
105
|
+
```
|
|
106
|
+
import type {Simplify} from 'type-fest';
|
|
107
|
+
|
|
108
|
+
type PositionProps = {
|
|
109
|
+
top: number;
|
|
110
|
+
left: number;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
type SizeProps = {
|
|
114
|
+
width: number;
|
|
115
|
+
height: number;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// In your editor, hovering over `Props` will show a flattened object with all the properties.
|
|
119
|
+
type Props = Simplify<PositionProps & SizeProps>;
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
|
|
123
|
+
|
|
124
|
+
If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
|
|
125
|
+
|
|
126
|
+
@example
|
|
127
|
+
```
|
|
128
|
+
import type {Simplify} from 'type-fest';
|
|
129
|
+
|
|
130
|
+
interface SomeInterface {
|
|
131
|
+
foo: number;
|
|
132
|
+
bar?: string;
|
|
133
|
+
baz: number | undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
type SomeType = {
|
|
137
|
+
foo: number;
|
|
138
|
+
bar?: string;
|
|
139
|
+
baz: number | undefined;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const literal = {foo: 123, bar: 'hello', baz: 456};
|
|
143
|
+
const someType: SomeType = literal;
|
|
144
|
+
const someInterface: SomeInterface = literal;
|
|
145
|
+
|
|
146
|
+
function fn(object: Record<string, unknown>): void {}
|
|
147
|
+
|
|
148
|
+
fn(literal); // Good: literal object type is sealed
|
|
149
|
+
fn(someType); // Good: type is sealed
|
|
150
|
+
fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
|
|
151
|
+
fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
@link https://github.com/microsoft/TypeScript/issues/15300
|
|
155
|
+
|
|
156
|
+
@category Object
|
|
157
|
+
*/
|
|
158
|
+
type Simplify<
|
|
159
|
+
AnyType,
|
|
160
|
+
Options extends SimplifyOptions = {},
|
|
161
|
+
> = Flatten<AnyType> extends AnyType
|
|
162
|
+
? Flatten<AnyType, Options>
|
|
163
|
+
: AnyType;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
Remove any index signatures from the given object type, so that only explicitly defined properties remain.
|
|
167
|
+
|
|
168
|
+
Use-cases:
|
|
169
|
+
- Remove overly permissive signatures from third-party types.
|
|
170
|
+
|
|
171
|
+
This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
|
|
172
|
+
|
|
173
|
+
It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
|
|
174
|
+
|
|
175
|
+
(The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
const indexed: Record<string, unknown> = {}; // Allowed
|
|
179
|
+
|
|
180
|
+
const keyed: Record<'foo', unknown> = {}; // Error
|
|
181
|
+
// => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
type Indexed = {} extends Record<string, unknown>
|
|
188
|
+
? '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
189
|
+
: '❌ `{}` is NOT assignable to `Record<string, unknown>`';
|
|
190
|
+
// => '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
191
|
+
|
|
192
|
+
type Keyed = {} extends Record<'foo' | 'bar', unknown>
|
|
193
|
+
? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
|
|
194
|
+
: "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
|
|
195
|
+
// => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
import type {RemoveIndexSignature} from 'type-fest';
|
|
202
|
+
|
|
203
|
+
type RemoveIndexSignature<ObjectType> = {
|
|
204
|
+
[KeyType in keyof ObjectType // Map each key of `ObjectType`...
|
|
205
|
+
]: ObjectType[KeyType]; // ...to its original value, i.e. `RemoveIndexSignature<Foo> == Foo`.
|
|
206
|
+
};
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
import type {RemoveIndexSignature} from 'type-fest';
|
|
213
|
+
|
|
214
|
+
type RemoveIndexSignature<ObjectType> = {
|
|
215
|
+
[KeyType in keyof ObjectType
|
|
216
|
+
// Is `{}` assignable to `Record<KeyType, unknown>`?
|
|
217
|
+
as {} extends Record<KeyType, unknown>
|
|
218
|
+
? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
|
|
219
|
+
: ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
|
|
220
|
+
]: ObjectType[KeyType];
|
|
221
|
+
};
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
import type {RemoveIndexSignature} from 'type-fest';
|
|
228
|
+
|
|
229
|
+
type RemoveIndexSignature<ObjectType> = {
|
|
230
|
+
[KeyType in keyof ObjectType
|
|
231
|
+
as {} extends Record<KeyType, unknown>
|
|
232
|
+
? never // => Remove this `KeyType`.
|
|
233
|
+
: KeyType // => Keep this `KeyType` as it is.
|
|
234
|
+
]: ObjectType[KeyType];
|
|
235
|
+
};
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
@example
|
|
239
|
+
```
|
|
240
|
+
import type {RemoveIndexSignature} from 'type-fest';
|
|
241
|
+
|
|
242
|
+
interface Example {
|
|
243
|
+
// These index signatures will be removed.
|
|
244
|
+
[x: string]: any
|
|
245
|
+
[x: number]: any
|
|
246
|
+
[x: symbol]: any
|
|
247
|
+
[x: `head-${string}`]: string
|
|
248
|
+
[x: `${string}-tail`]: string
|
|
249
|
+
[x: `head-${string}-tail`]: string
|
|
250
|
+
[x: `${bigint}`]: string
|
|
251
|
+
[x: `embedded-${number}`]: string
|
|
252
|
+
|
|
253
|
+
// These explicitly defined keys will remain.
|
|
254
|
+
foo: 'bar';
|
|
255
|
+
qux?: 'baz';
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
type ExampleWithoutIndexSignatures = RemoveIndexSignature<Example>;
|
|
259
|
+
// => { foo: 'bar'; qux?: 'baz' | undefined; }
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
@category Object
|
|
263
|
+
*/
|
|
264
|
+
type RemoveIndexSignature<ObjectType> = {
|
|
265
|
+
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
|
|
266
|
+
? never
|
|
267
|
+
: KeyType]: ObjectType[KeyType];
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
Create a type that makes the given keys optional. The remaining keys are kept as is. The sister of the `SetRequired` type.
|
|
272
|
+
|
|
273
|
+
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
|
|
274
|
+
|
|
275
|
+
@example
|
|
276
|
+
```
|
|
277
|
+
import type {SetOptional} from 'type-fest';
|
|
278
|
+
|
|
279
|
+
type Foo = {
|
|
280
|
+
a: number;
|
|
281
|
+
b?: string;
|
|
282
|
+
c: boolean;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
|
|
286
|
+
// type SomeOptional = {
|
|
287
|
+
// a: number;
|
|
288
|
+
// b?: string; // Was already optional and still is.
|
|
289
|
+
// c?: boolean; // Is now optional.
|
|
290
|
+
// }
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
@category Object
|
|
294
|
+
*/
|
|
295
|
+
type SetOptional<BaseType, Keys extends keyof BaseType> =
|
|
296
|
+
Simplify<
|
|
297
|
+
// Pick just the keys that are readonly from the base type.
|
|
298
|
+
Except<BaseType, Keys> &
|
|
299
|
+
// Pick the keys that should be mutable from the base type and make them mutable.
|
|
300
|
+
Partial<Pick<BaseType, Keys>>
|
|
301
|
+
>;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
Convert a union type to an intersection type using [distributive conditional types](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
305
|
+
|
|
306
|
+
Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).
|
|
307
|
+
|
|
308
|
+
@example
|
|
309
|
+
```
|
|
310
|
+
import type {UnionToIntersection} from 'type-fest';
|
|
311
|
+
|
|
312
|
+
type Union = {the(): void} | {great(arg: string): void} | {escape: boolean};
|
|
313
|
+
|
|
314
|
+
type Intersection = UnionToIntersection<Union>;
|
|
315
|
+
//=> {the(): void; great(arg: string): void; escape: boolean};
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
A more applicable example which could make its way into your library code follows.
|
|
319
|
+
|
|
320
|
+
@example
|
|
321
|
+
```
|
|
322
|
+
import type {UnionToIntersection} from 'type-fest';
|
|
323
|
+
|
|
324
|
+
class CommandOne {
|
|
325
|
+
commands: {
|
|
326
|
+
a1: () => undefined,
|
|
327
|
+
b1: () => undefined,
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
class CommandTwo {
|
|
332
|
+
commands: {
|
|
333
|
+
a2: (argA: string) => undefined,
|
|
334
|
+
b2: (argB: string) => undefined,
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const union = [new CommandOne(), new CommandTwo()].map(instance => instance.commands);
|
|
339
|
+
type Union = typeof union;
|
|
340
|
+
//=> {a1(): void; b1(): void} | {a2(argA: string): void; b2(argB: string): void}
|
|
341
|
+
|
|
342
|
+
type Intersection = UnionToIntersection<Union>;
|
|
343
|
+
//=> {a1(): void; b1(): void; a2(argA: string): void; b2(argB: string): void}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
@category Type
|
|
347
|
+
*/
|
|
348
|
+
type UnionToIntersection<Union> = (
|
|
349
|
+
// `extends unknown` is always going to be the case and is used to convert the
|
|
350
|
+
// `Union` into a [distributive conditional
|
|
351
|
+
// type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
352
|
+
Union extends unknown
|
|
353
|
+
// The union type is used as the only argument to a function since the union
|
|
354
|
+
// of function arguments is an intersection.
|
|
355
|
+
? (distributedUnion: Union) => void
|
|
356
|
+
// This won't happen.
|
|
357
|
+
: never
|
|
358
|
+
// Infer the `Intersection` type since TypeScript represents the positional
|
|
359
|
+
// arguments of unions of functions as an intersection of the union.
|
|
360
|
+
) extends ((mergedIntersection: infer Intersection) => void)
|
|
361
|
+
? Intersection
|
|
362
|
+
: never;
|
|
363
|
+
|
|
364
|
+
interface ReactRenderer extends WebRenderer {
|
|
365
|
+
component: ComponentType<this['T']>;
|
|
366
|
+
storyResult: StoryFnReactReturnType;
|
|
367
|
+
mount: (ui?: JSX.Element) => Promise<Canvas>;
|
|
368
|
+
}
|
|
369
|
+
interface ReactParameters {
|
|
370
|
+
/** React renderer configuration */
|
|
371
|
+
react?: {
|
|
372
|
+
/**
|
|
373
|
+
* Whether to enable React Server Components
|
|
374
|
+
*
|
|
375
|
+
* @see https://storybook.js.org/docs/get-started/frameworks/nextjs#react-server-components-rsc
|
|
376
|
+
*/
|
|
377
|
+
rsc?: boolean;
|
|
378
|
+
/** Options passed to React root creation */
|
|
379
|
+
rootOptions?: RootOptions;
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
interface ReactTypes extends ReactRenderer {
|
|
383
|
+
parameters: ReactParameters;
|
|
384
|
+
}
|
|
385
|
+
type StoryFnReactReturnType = JSX.Element;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Metadata to configure the stories for a component.
|
|
389
|
+
*
|
|
390
|
+
* @see [Default export](https://storybook.js.org/docs/api/csf#default-export)
|
|
391
|
+
*/
|
|
392
|
+
type Meta<TCmpOrArgs = Args> = [TCmpOrArgs] extends [ComponentType<any>] ? ComponentAnnotations<ReactRenderer, ComponentProps<TCmpOrArgs>> : ComponentAnnotations<ReactRenderer, TCmpOrArgs>;
|
|
393
|
+
/**
|
|
394
|
+
* Story function that represents a CSFv2 component example.
|
|
395
|
+
*
|
|
396
|
+
* @see [Named Story exports](https://storybook.js.org/docs/api/csf#named-story-exports)
|
|
397
|
+
*/
|
|
398
|
+
type StoryFn<TCmpOrArgs = Args> = [TCmpOrArgs] extends [ComponentType<any>] ? AnnotatedStoryFn<ReactRenderer, ComponentProps<TCmpOrArgs>> : AnnotatedStoryFn<ReactRenderer, TCmpOrArgs>;
|
|
399
|
+
/**
|
|
400
|
+
* Story object that represents a CSFv3 component example.
|
|
401
|
+
*
|
|
402
|
+
* @see [Named Story exports](https://storybook.js.org/docs/api/csf#named-story-exports)
|
|
403
|
+
*/
|
|
404
|
+
type StoryObj<TMetaOrCmpOrArgs = Args> = [TMetaOrCmpOrArgs] extends [
|
|
405
|
+
{
|
|
406
|
+
render?: ArgsStoryFn<ReactRenderer, any>;
|
|
407
|
+
component?: infer Component;
|
|
408
|
+
args?: infer DefaultArgs;
|
|
409
|
+
}
|
|
410
|
+
] ? Simplify<(Component extends ComponentType<any> ? ComponentProps<Component> : unknown) & ArgsFromMeta<ReactRenderer, TMetaOrCmpOrArgs>> extends infer TArgs ? StoryAnnotations<ReactRenderer, AddMocks<TArgs, DefaultArgs>, SetOptional<TArgs, keyof TArgs & keyof DefaultArgs>> : never : TMetaOrCmpOrArgs extends ComponentType<any> ? StoryAnnotations<ReactRenderer, ComponentProps<TMetaOrCmpOrArgs>> : StoryAnnotations<ReactRenderer, TMetaOrCmpOrArgs>;
|
|
411
|
+
type AddMocks<TArgs, DefaultArgs> = Simplify<{
|
|
412
|
+
[T in keyof TArgs]: T extends keyof DefaultArgs ? DefaultArgs[T] extends (...args: any) => any & {
|
|
413
|
+
mock: {};
|
|
414
|
+
} ? DefaultArgs[T] : TArgs[T] : TArgs[T];
|
|
415
|
+
}>;
|
|
416
|
+
type Decorator<TArgs = StrictArgs> = DecoratorFunction<ReactRenderer, TArgs>;
|
|
417
|
+
type Loader<TArgs = StrictArgs> = LoaderFunction<ReactRenderer, TArgs>;
|
|
418
|
+
type StoryContext<TArgs = StrictArgs> = StoryContext$1<ReactRenderer, TArgs>;
|
|
419
|
+
type Preview = ProjectAnnotations<ReactRenderer>;
|
|
10
420
|
|
|
11
421
|
/**
|
|
12
422
|
* Function that sets the globalConfig of your storybook. The global config is the preview module of
|
|
@@ -88,4 +498,37 @@ declare function composeStory<TArgs extends Args = Args>(story: StoryAnnotations
|
|
|
88
498
|
*/
|
|
89
499
|
declare function composeStories<TModule extends Store_CSFExports<ReactRenderer, any>>(csfExports: TModule, projectAnnotations?: ProjectAnnotations<ReactRenderer>): Omit<StoriesWithPartialProps<ReactRenderer, TModule>, keyof Store_CSFExports>;
|
|
90
500
|
|
|
91
|
-
|
|
501
|
+
declare function __definePreview<Addons extends PreviewAddon<never>[]>(input: {
|
|
502
|
+
addons: Addons;
|
|
503
|
+
} & ProjectAnnotations<ReactTypes & InferTypes<Addons>>): ReactPreview<ReactTypes & InferTypes<Addons>>;
|
|
504
|
+
/** @ts-expect-error We cannot implement the meta faithfully here, but that is okay. */
|
|
505
|
+
interface ReactPreview<T extends AddonTypes> extends Preview$1<ReactTypes & T> {
|
|
506
|
+
meta<TArgs extends Args, Decorators extends DecoratorFunction<ReactTypes & T, any>, TMetaArgs extends Partial<TArgs>>(meta: {
|
|
507
|
+
render?: ArgsStoryFn<ReactTypes & T, TArgs>;
|
|
508
|
+
component?: ComponentType<TArgs>;
|
|
509
|
+
decorators?: Decorators | Decorators[];
|
|
510
|
+
args?: TMetaArgs;
|
|
511
|
+
} & Omit<ComponentAnnotations<ReactTypes & T, TArgs>, 'decorators' | 'component' | 'args' | 'render'>): ReactMeta<ReactTypes & T & {
|
|
512
|
+
args: Simplify<TArgs & Simplify<RemoveIndexSignature<DecoratorsArgs<ReactTypes & T, Decorators>>>>;
|
|
513
|
+
}, {
|
|
514
|
+
args: Partial<TArgs> extends TMetaArgs ? {} : TMetaArgs;
|
|
515
|
+
}>;
|
|
516
|
+
}
|
|
517
|
+
type DecoratorsArgs<TRenderer extends Renderer, Decorators> = UnionToIntersection<Decorators extends DecoratorFunction<TRenderer, infer TArgs> ? TArgs : unknown>;
|
|
518
|
+
interface ReactMeta<T extends ReactTypes, MetaInput extends ComponentAnnotations<T>>
|
|
519
|
+
/** @ts-expect-error hard */
|
|
520
|
+
extends Meta$1<T, MetaInput> {
|
|
521
|
+
story<TInput extends (() => ReactTypes['storyResult']) | (StoryAnnotations<T, T['args']> & {
|
|
522
|
+
render: () => ReactTypes['storyResult'];
|
|
523
|
+
})>(story?: TInput): ReactStory<T, TInput extends () => ReactTypes['storyResult'] ? {
|
|
524
|
+
render: TInput;
|
|
525
|
+
} : TInput>;
|
|
526
|
+
story<TInput extends Simplify<StoryAnnotations<T, AddMocks<T['args'], MetaInput['args']>, SetOptional<T['args'], keyof T['args'] & keyof MetaInput['args']>>>>(story?: TInput
|
|
527
|
+
/** @ts-expect-error hard */
|
|
528
|
+
): ReactStory<T, TInput>;
|
|
529
|
+
}
|
|
530
|
+
interface ReactStory<T extends ReactTypes, TInput extends StoryAnnotations<T, T['args']>> extends Story<T, TInput> {
|
|
531
|
+
Component: ComponentType<Partial<T['args']>>;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export { type AddMocks, type Decorator, INTERNAL_DEFAULT_PROJECT_ANNOTATIONS, type Loader, type Meta, type Preview, type ReactPreview, type ReactRenderer, type ReactStory, type ReactTypes, type StoryContext, type StoryFn, type StoryObj, __definePreview, composeStories, composeStory, setProjectAnnotations };
|