sveld 0.36.10 → 0.37.0
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 +895 -41
- package/lib/browser.d.ts +121 -2
- package/lib/browser.js +161 -143
- package/lib/chunk-550yx3gf.js +13 -0
- package/lib/chunk-6n4d12tf.js +1 -0
- package/lib/chunk-74rbv9gf.js +1 -0
- package/lib/chunk-eybp3ae7.js +6 -0
- package/lib/chunk-jtm65qmd.js +300 -0
- package/lib/chunk-s1v2vjye.js +7 -0
- package/lib/cli-entry.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +5 -3
- package/schema/component-api.schema.json +431 -0
- package/lib/chunk-0204rbr9.js +0 -7
- package/lib/chunk-26w7fg2w.js +0 -13
- package/lib/chunk-2nrjrvnn.js +0 -1
- package/lib/chunk-bbeezhqq.js +0 -6
- package/lib/chunk-c83445g5.js +0 -225
- package/lib/chunk-d802cqsd.js +0 -7
- package/lib/chunk-n9w94djt.js +0 -1
- package/lib/chunk-nrz6c5ew.js +0 -10
- package/lib/chunk-ptdfswsv.js +0 -2
- package/lib/chunk-py1s51tb.js +0 -16
- package/lib/chunk-syz2wqmb.js +0 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{p,ne,f,a,ie,l,d,se,x,j,n,m,H,t,r,u,L,h,ae,ce,ue,X,g,pe,Q,le,fe,T,de,c,A,me,Y,he,ge,ye,E,Z,xe,O,K,M,y,Te,Ee,v}from"./chunk-jtm65qmd.js";var at={a:"HTMLAnchorElement",abbr:"HTMLElement",address:"HTMLElement",applet:"HTMLUnknownElement",area:"HTMLAreaElement",article:"HTMLElement",aside:"HTMLElement",audio:"HTMLAudioElement",b:"HTMLElement",base:"HTMLBaseElement",basefont:"HTMLElement",bdi:"HTMLElement",bdo:"HTMLElement",blockquote:"HTMLQuoteElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",cite:"HTMLElement",code:"HTMLElement",col:"HTMLTableColElement",colgroup:"HTMLTableColElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",dd:"HTMLElement",del:"HTMLModElement",details:"HTMLDetailsElement",dfn:"HTMLElement",dialog:"HTMLDialogElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",dt:"HTMLElement",em:"HTMLElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",figcaption:"HTMLElement",figure:"HTMLElement",font:"HTMLFontElement",footer:"HTMLElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",h2:"HTMLHeadingElement",h3:"HTMLHeadingElement",h4:"HTMLHeadingElement",h5:"HTMLHeadingElement",h6:"HTMLHeadingElement",head:"HTMLHeadElement",header:"HTMLElement",hgroup:"HTMLElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",i:"HTMLElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",ins:"HTMLModElement",kbd:"HTMLElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",main:"HTMLElement",map:"HTMLMapElement",mark:"HTMLElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",nav:"HTMLElement",noscript:"HTMLElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",picture:"HTMLPictureElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",rp:"HTMLElement",rt:"HTMLElement",ruby:"HTMLElement",s:"HTMLElement",samp:"HTMLElement",script:"HTMLScriptElement",search:"HTMLElement",section:"HTMLElement",select:"HTMLSelectElement",slot:"HTMLSlotElement",small:"HTMLElement",source:"HTMLSourceElement",span:"HTMLSpanElement",strong:"HTMLElement",style:"HTMLStyleElement",sub:"HTMLElement",summary:"HTMLElement",sup:"HTMLElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",td:"HTMLTableCellElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",tfoot:"HTMLTableSectionElement",th:"HTMLTableCellElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",u:"HTMLElement",ul:"HTMLUListElement",var:"HTMLElement",video:"HTMLVideoElement",wbr:"HTMLElement"};function Rt(e){return e in at}function st(e){if(Rt(e))return at[e];return"HTMLElement"}function tt(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,rest_props:void 0,extends:void 0,customElementTag:void 0,customElement:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,valueImportBindingsByLocalName:new Map,pendingCallDefaultCandidates:[],pendingContextKeyCandidates:[],runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,additionalTypeDependencyNodes:[],wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new WeakMap,activeScopes:[],slots:new Map,snippetPropLocals:new Set,cssParts:[],cssProperties:[],deferredSlotBlockGenerics:[],events:new Map,eventDescriptions:new Map,forwardedEvents:new Map,jsDocEventNames:new Set,jsDocEventSources:new Map,bindings:new Map,contexts:new Map,typedefs:new Map,variableInfoCache:new Map,variableInfoCacheBuilt:!1,sveldIgnoreDirectives:new Map}}var At=new Set(["Component","SvelteComponent","SvelteSelf"]),It=new Set(["RegularElement","SvelteElement"]);function Ve(e){return At.has(e)}function Oe(e){return It.has(e)}function _t({hasTypeScriptType:e,hasJSDocType:o,inferredType:s,finalType:b}){if(e)return"typescript";if(o)return"jsdoc";if(s!==void 0)return"default";if(b!==void 0)return"inferred";return"unknown"}function $e(e){let o=e.explicitType??e.jsdocType??e.resolvedType??e.typeSeed,s=e.jsdocParams??e.resolvedParams,b=e.jsdocReturnType??e.resolvedReturnType;if(e.isFunctionDeclaration&&o==="() => any"&&b)o=s&&s.length>0?`(${s.map((C)=>`${C.name}${C.optional?"?":""}: ${C.type}`).join(", ")}) => ${b}`:`() => ${b}`;let S=e.jsdocDescription??e.resolvedDescription;if(S===void 0&&o!==void 0)S=e.typedefs?.get(o)?.description;let N=_t({hasTypeScriptType:e.explicitType!==void 0,hasJSDocType:e.jsdocType!==void 0||e.jsdocParams!==void 0||e.jsdocReturnType!==void 0||e.resolvedType!==void 0,inferredType:e.inferredTypeForSource,finalType:o}),D=e.initializerIsFunction||e.isFunctionDeclaration||e.inferIsFunctionFromTypeSignature===!0&&(!!e.jsdocParams?.length||e.jsdocReturnType!==void 0||!!e.jsdocType?.includes("=>")||!!e.resolvedType?.includes("=>")||!!e.explicitType?.includes("=>"));return{type:o,typeSource:N,description:S,params:s,returnType:b,isFunction:D}}function Ft(e){if(!e||typeof e!=="object"||!("type"in e))return;let o=String(e.type),s=Ve(o);if(!s&&!Oe(o))return;let b="name"in e&&typeof e.name==="string"?e.name:void 0;if(!b)return;let S=s?{type:"InlineComponent",name:b}:{type:"Element",name:b};if(b==="svelte:element"&&"tag"in e&&e.tag&&typeof e.tag==="object"){let N=e.tag;if(N.type==="Literal"&&typeof N.value==="string")S.thisValue=N.value}return S}function ct(e,o){let s=Ft(o);if(!s)return;if(e.rest_props===void 0){e.rest_props=s;return}if(e.rest_props.type==="InlineComponent"&&s.type==="Element")e.rest_props=s}function Ce(e,o,s){if(!o||e.has(o))return;e.set(o,s)}function Ge(e,o){for(let s=e.activeScopes.length-1;s>=0;s-=1){let b=e.activeScopes[s]?.get(o);if(!b)continue;return b.kind==="prop"?b.publicPropName:void 0}return}function Pe(e,o=new Set){if(!e||typeof e!=="object"||!("type"in e))return o;switch(e.type){case"Identifier":o.add(e.name);break;case"AssignmentPattern":Pe(e.left,o);break;case"ArrayPattern":for(let s of e.elements)Pe(s??void 0,o);break;case"ObjectPattern":for(let s of e.properties)if(s.type==="Property")Pe(s.value,o);else if(s.type==="RestElement")Pe(s.argument,o);break;case"RestElement":Pe(e.argument,o);break}return o}function rt(e,o){if(!o||typeof o!=="object"||!("type"in o))return;if(o.type==="Identifier"){let b=Ge(e,o.name);if(b)e.reactive_vars.add(b);return}let s=Pe(o);for(let b of s){let S=Ge(e,b);if(S)e.reactive_vars.add(S)}}function Ae(e){if(!e||typeof e!=="object"||!("type"in e))return!1;switch(String(e.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"AwaitBlock":return!0;default:return!1}}function pt(e){if(!e||typeof e!=="object"||!("type"in e))return!1;let o=String(e.type);return o==="FunctionDeclaration"||o==="FunctionExpression"||o==="ArrowFunctionExpression"}function Ht(e,o){let s=e.scopeDeclarations.get(o);if(!s)s=new Map,e.scopeDeclarations.set(o,s);return s}function jt(e,o,s){let b=[];if(s.id.type==="Identifier")return b.push({kind:"local",name:s.id.name}),b;if(s.id.type!=="ObjectPattern")return b;for(let S of s.id.properties){if(S.type==="RestElement"){if(S.argument.type==="Identifier")b.push({kind:"local",name:S.argument.name});continue}if(S.computed)continue;let N=e.getPropertyName(S.key);if(!N)continue;let D;if(S.value.type==="Identifier")D=S.value.name;else if(S.value.type==="AssignmentPattern"&&S.value.left.type==="Identifier")D=S.value.left.name;if(!D)continue;b.push({kind:"prop",name:D,publicPropName:N})}return b}function nt(e,o,s,b,S){if(!ne(o))return;let N=S?.allowRunesProps??!1,D=S?.forceProp??!1,C=o;for(let R of C.declarations){if(N&&l(d(R.init),"$props")){for(let W of jt(e,C,R))Ce(W.kind==="prop"?s:b,W.name,W.kind==="prop"?{kind:"prop",publicPropName:W.publicPropName}:{kind:"local"});continue}let G=C.kind==="var"?b:s,z=D?"prop":"local";for(let W of Pe(R.id))Ce(G,W,z==="prop"?{kind:"prop",publicPropName:W}:{kind:"local"})}}function Bt(e,o){if("id"in e&&e.id&&typeof e.id==="object"&&"name"in e.id&&typeof e.id.name==="string")Ce(o,e.id.name,{kind:"local"});for(let s of e.params)for(let b of Pe(s))Ce(o,b,{kind:"local"})}function Vt(e,o,s,b){if(!Array.isArray(o))return;for(let S of o){if(!S||typeof S!=="object"||!("type"in S))continue;switch(S.type){case"VariableDeclaration":nt(e,S,s,b);break;case"FunctionDeclaration":if(S.id?.name)Ce(s,S.id.name,{kind:"local"});break;case"ClassDeclaration":if(S.id?.name)Ce(s,S.id.name,{kind:"local"});break}}}function Ot(e,o,s){if(!s||typeof s!=="object")return;let b="content"in s&&s.content&&typeof s.content==="object"&&"body"in s.content&&Array.isArray(s.content.body)?s.content:("body"in s)&&Array.isArray(s.body)?s:void 0;if(!b||!("body"in b)||!Array.isArray(b.body))return;for(let S of b.body){if(!S||typeof S!=="object"||!("type"in S))continue;switch(S.type){case"ImportDeclaration":for(let N of S.specifiers??[])if(N.local?.name)Ce(o.componentScope,N.local.name,{kind:"local"});break;case"VariableDeclaration":nt(e,S,o.componentScope,o.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(S.id?.name)Ce(o.componentScope,S.id.name,{kind:"local"});break;case"ClassDeclaration":if(S.id?.name)Ce(o.componentScope,S.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!S.declaration||typeof S.declaration!=="object"||!("type"in S.declaration))break;if(S.declaration.type==="VariableDeclaration")nt(e,S.declaration,o.componentScope,o.componentScope,{forceProp:!0});else if(S.declaration.type==="FunctionDeclaration"&&S.declaration.id?.name)Ce(o.componentScope,S.declaration.id.name,{kind:"prop",publicPropName:S.declaration.id.name});break}}}function lt(e,o){o.componentScope.clear(),o.scopeDeclarations=new WeakMap,o.activeScopes.length=0,Ot(e,o,o.parsed?.instance)}function dt(e){return{varScopeStack:[e.componentScope]}}function ut(e,o,s,b){if(!Ae(b))return;let S=Ht(o,b),N=s.varScopeStack[s.varScopeStack.length-1]??o.componentScope;switch(String(b.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":Bt(b,S);break;case"BlockStatement":Vt(e,b.body,S,N);break;case"CatchClause":if("param"in b)for(let C of Pe(b.param))Ce(S,C,{kind:"local"});break;case"EachBlock":{let C=b;for(let R of Pe(C.context))Ce(S,R,{kind:"local"});if(typeof C.index==="string")Ce(S,C.index,{kind:"local"});else if(C.index&&"name"in C.index)Ce(S,C.index.name,{kind:"local"});break}case"AwaitBlock":{let C=b;for(let R of Pe(C.value))Ce(S,R,{kind:"local"});for(let R of Pe(C.error))Ce(S,R,{kind:"local"});break}}if(pt(b))s.varScopeStack.push(S);return S}function mt(e,o){if(pt(o))e.varScopeStack.pop()}var gt=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function $t(e,o){switch(o?.type){case"MemberExpression":return o.computed||e===o.object;case"MethodDefinition":return!!o.computed;case"MetaProperty":return e===o.meta;case"PropertyDefinition":return o.computed||e===o.value;case"Property":return o.computed||e===o.value;case"ExportSpecifier":case"ImportSpecifier":return e===o.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}var Gt=Array.from(gt);function ft(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function Jt(e){if(e.includes("\\u"))return!0;for(let o of Gt){let s=e.indexOf(o);while(s!==-1){if(!ft(e.charCodeAt(s-1))&&!ft(e.charCodeAt(s+o.length)))return!0;s=e.indexOf(o,s+1)}}return!1}function Kt(e,o){for(let s=o.length-1;s>=0;s-=1)if(o[s]?.has(e))return!0;return!1}function zt(e){let o=new Set;if(!e||typeof e!=="object"||!("type"in e))return o;switch(String(e.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let s=e;if(s.id?.name)o.add(s.id.name);for(let b of s.params??[])Pe(b,o);break}case"BlockStatement":qe(e.body,o);break;case"CatchClause":Pe(e.param,o);break;case"EachBlock":{let s=e;if(Pe(s.context,o),typeof s.index==="string")o.add(s.index);else if(s.index?.name)o.add(s.index.name);break}case"AwaitBlock":{let s=e;Pe(s.value,o),Pe(s.error,o);break}}return o}function qe(e,o){if(!Array.isArray(e))return;for(let s of e){if(!s||typeof s!=="object"||!("type"in s))continue;switch(String(s.type)){case"ImportDeclaration":for(let b of s.specifiers??[])if(b.local?.name)o.add(b.local.name);break;case"VariableDeclaration":for(let b of s.declarations??[])Pe(b.id,o);break;case"FunctionDeclaration":case"ClassDeclaration":{let b=s.id?.name;if(b)o.add(b);break}case"ExportNamedDeclaration":{let b=s.declaration;if(b&&typeof b==="object"&&"type"in b)qe([b],o);break}}}}function ot(e,o){if(!e||typeof e!=="object")return!1;let s=[...o],b=!1;return p(e,{enter(S,N){if(b){this.skip();return}if(Ae(S))s.push(zt(S));if(N&&S.type==="Identifier"&>.has(S.name)&&!N.type.startsWith("TS")&&$t(S,N)&&!Kt(S.name,s))b=!0,this.skip()},leave(S){if(Ae(S))s.pop()}}),b}function yt(e){if(!e||typeof e!=="object")return;if("content"in e){let o=e.content,s=o&&typeof o==="object"&&"body"in o?o.body:void 0;if(Array.isArray(s))return s}if("body"in e&&Array.isArray(e.body))return e.body;return}function Tt(e){if(e.runesOptionOverride!==void 0)return e.runesOptionOverride?"runes":"legacy";let o=e.parsed;if(!o)return"legacy";if(e.source!==void 0&&!Jt(e.source))return"legacy";let s=new Set;qe(yt(o.module),s);let b=new Set;return qe(yt(o.instance),b),ot(o.module,[s])||ot(o.instance,[s,b])||ot(o.fragment,[s,b])?"runes":"legacy"}var Xt=/[A-Za-z_$][\w$]*/g;function Ut(e,o,s){let b=new Map,S=o.typeParameters?.params,N=s.typeArguments?.params;if(!S?.length||!N?.length)return b;for(let D=0;D<S.length;D++){let C=S[D]?.name,R=N[D];if(!C||R?.start===void 0||R?.end===void 0)continue;let G=r(e,R.start,R.end)?.trim();if(G)b.set(C,G)}return b}function Wt(e,o){if(o.size===0)return e;return e.replace(Xt,(s)=>o.get(s)??s)}function Ie(e,o,s,b,S=new Set){let N=new Map;if(!s?.type)return N;let D=(C)=>{for(let R of C){if(R?.type!=="TSPropertySignature"||R.computed)continue;if(!R.key)continue;let G=e.getPropertyName(R.key);if(!G)continue;let z=R.typeAnnotation?.start,W=R.typeAnnotation?.end;if(z===void 0||W===void 0)continue;let Se=r(o,z+1,W)?.trim();if(!Se)continue;A(o,R.typeAnnotation?.typeAnnotation),N.set(G,{type:Se,optional:R.optional===!0,source:t(o,R)})}};switch(s.type){case"TSTypeLiteral":D(s.members??[]);break;case"TSInterfaceDeclaration":D(s.body?.body??[]);break;case"TSTypeAliasDeclaration":{let C=Ie(e,o,s.typeAnnotation,b,S);for(let[R,G]of C)N.set(R,G);break}case"TSTypeReference":{let C=fe(s.typeName);if(!C||S.has(C))break;let R=b.get(C);if(!R)break;S.add(C);let G=Ie(e,o,R,b,S);S.delete(C);let z=Ut(o,R,s);for(let[W,Se]of G)N.set(W,z.size===0?Se:{...Se,type:Wt(Se.type,z)});break}case"TSIntersectionType":for(let C of s.types??[]){let R=Ie(e,o,C,b,S);for(let[G,z]of R)N.set(G,z)}break;case"TSParenthesizedType":{let C=Ie(e,o,s.typeAnnotation,b,S);for(let[R,G]of C)N.set(R,G);break}}return N}function qt(e){let o={};for(let[s,b]of Object.entries(e))o[s]={...b.attribute===void 0?{}:{attribute:b.attribute},...b.reflect===void 0?{}:{reflect:b.reflect},...b.type===void 0?{}:{type:b.type}};return o}function bt(e,o,s){if(o.runesPropsDeclarationMetadataByDeclaratorStart.clear(),o.explicitPropTypesByName.clear(),o.explicitVariableTypesByName.clear(),o.typeImportBindingsByLocalName.clear(),o.localTypeDeclarationsByName.clear(),o.additionalTypeDependencyNodes.length=0,o.typedRunesPropsDeclarations.length=0,!o.source)return;let b=s;o.scriptLanguage=e.resolveScriptLanguage(b);let S=b.options?.customElement;o.customElementTag=S?.tag,o.customElement=S?{...S.tag===void 0?{}:{tag:S.tag},...S.shadow==="open"||S.shadow==="none"?{shadow:S.shadow}:{},...S.props?{props:qt(S.props)}:{},...S.extend===void 0?{}:{extend:!0}}:void 0,o.runesOptionOverride=b.options?.runes,o.scriptGenericsAttribute=e.resolveScriptGenericsAttribute(b);let N=b.instance?.content?.body??[];for(let D of N){if(!D?.type)continue;if(D.type==="ImportDeclaration"&&D.source?.value)for(let C of D.specifiers??[]){let R=C.local?.name;if(!R)continue;if(!(D.importKind==="type"||C.importKind==="type"))continue;let z,W;if(C.type==="ImportSpecifier")z="named",W=C.imported?.type==="Identifier"?C.imported.name:typeof C.imported?.value==="string"?C.imported.value:void 0;else if(C.type==="ImportDefaultSpecifier")z="default";else if(C.type==="ImportNamespaceSpecifier")z="namespace";if(!z)continue;o.typeImportBindingsByLocalName.set(R,{importedName:W,localName:R,source:String(D.source.value),specifierType:z})}if((D.type==="TSInterfaceDeclaration"||D.type==="TSTypeAliasDeclaration")&&D.id?.name&&D.start!==void 0&&D.end!==void 0)o.localTypeDeclarationsByName.set(D.id.name,{code:r(o,D.start,D.end)?.trim()??"",node:D,start:D.start});if(D.type==="TSEnumDeclaration"&&D.id?.name&&D.start!==void 0&&D.end!==void 0)o.localTypeDeclarationsByName.set(D.id.name,{code:me(o,D)??"",node:D,start:D.start});if(D.type==="ExportNamedDeclaration"&&D.declaration?.type==="VariableDeclaration")for(let C of D.declaration.declarations??[]){if(C.id?.type!=="Identifier"||!C.id.name)continue;let R=T(o,C.id.typeAnnotation);if(R)o.explicitPropTypesByName.set(C.id.name,R),A(o,C.id.typeAnnotation?.typeAnnotation)}else if(D.type==="VariableDeclaration")for(let C of D.declarations??[]){if(C.id?.type!=="Identifier"||!C.id.name)continue;let R=T(o,C.id.typeAnnotation);if(R)o.explicitVariableTypesByName.set(C.id.name,R)}}for(let D of N){if(!D||typeof D!=="object"||!("declarations"in D))continue;for(let C of D.declarations??[]){if(!l(d(C.init),"$props"))continue;let R=C.id?.typeAnnotation?void 0:se(C.init),G=C.id?.typeAnnotation?.typeAnnotation??R,z=C.id?.typeAnnotation?T(o,C.id.typeAnnotation):de(o,R),W=Ie(e,o,G,new Map(Array.from(o.localTypeDeclarationsByName.entries(),([ve,_e])=>[ve,_e.node]))),Se=new Set,Ne=new Set;if(c(o,G,Se,Ne),ye(o,Se,Ne),C.start!==void 0){let ve={canonicalType:z,props:W,referencedImportedTypes:Se,referencedLocalTypes:Ne};if(o.runesPropsDeclarationMetadataByDeclaratorStart.set(C.start,ve),z)o.typedRunesPropsDeclarations.push(ve)}}}}function xt(e,o,s){for(let b of s.declarations){if(!l(d(b.init),"$props"))continue;if(b.id.type==="Identifier"){o.wholePropsLocals.add(b.id.name),o.restPropLocals.add(b.id.name);let D=Q(o,b.start);if(D)for(let[C,R]of D.props)L(e,o,C,{name:C,kind:"let",type:R.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!R.optional,constant:!1,reactive:!1,source:R.source});continue}if(b.id.type!=="ObjectPattern")continue;let S=y(o,e,s),N=b.id.properties.filter((D)=>{if(D.type!=="Property"||D.computed)return!1;if(!e.getPropertyName(D.key))return!1;if(D.value.type==="Identifier")return!0;return D.value.type==="AssignmentPattern"&&D.value.left.type==="Identifier"}).length;for(let D of b.id.properties){if(D.type==="RestElement"){if(D.argument.type==="Identifier")o.restPropLocals.add(D.argument.name);continue}let C=e.getPropertyName(D.key);if(!C)continue;let R,G;if(D.value.type==="Identifier")R=D.value.name;else{let P=D.value;R=P.left.name,G=P.right}if(!R)continue;if(e.trackPropLocalName(C,R),C==="children")o.snippetPropLocals.add(R);let z=Te(o,e,D)??(N===1?S:void 0),W=le(o,b.start,C),{init:Se,bindable:Ne}=ae(G),ve=Se==null?{isFunction:!1}:h(e,o,Se),{value:_e,type:Re,isFunction:Fe,defaultValue:He}=ve,Je=W?.type===void 0&&z?.type===void 0?ve.resolvedType:void 0;if(ve.pendingCallDefault)o.pendingCallDefaultCandidates.push({propName:C,location:"props",...ve.pendingCallDefault});let{type:je,typeSource:Ke,description:ze,params:Xe,returnType:Ue,isFunction:We}=$e({explicitType:W?.type,typeSeed:Re,inferredTypeForSource:Re,jsdocType:z?.type,jsdocDescription:z?.description,jsdocParams:z?.params,jsdocReturnType:z?.returnType,resolvedType:Je,resolvedDescription:ve.resolvedDescription,resolvedParams:ve.resolvedParams,resolvedReturnType:ve.resolvedReturnType,initializerIsFunction:Fe,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(Ne)o.reactive_vars.add(C);m(o,"prop-unknown-type",C,z?.sveldIgnore),L(e,o,C,{name:C,...R===C?{}:{localName:R},kind:"let",description:ze,binding:z?.binding,deprecated:z?.deprecated,tags:z?.tags,...z?.internal?{internal:!0}:{},...Ne?{bindable:!0}:{},type:je,typeSource:Ke,value:_e,defaultValue:He,params:Xe,returnType:Ue,isFunction:We,isFunctionDeclaration:!1,isRequired:!Ne&&Se==null&&W?.optional!==!0,constant:!1,reactive:Ne,source:t(o,D)})}}}function Yt(e){let s=e.indexOf("EventDispatcher");if(s===-1)return;let b=s+15;while(e[b]===" ")b++;if(e[b]!=="<")return;let S=0,N=b;for(;b<e.length;b++)if(e[b]==="<")S++;else if(e[b]===">"){if(S--,S===0)return e.slice(N+1,b)}return}function Qt(e){let o=[],s=0,b=0;for(let S=0;S<e.length;S++){let N=e[S];if(N==="{"||N==="("||N==="["||N==="<")s++;else if(N==="}"||N===")"||N==="]"||N===">")s=Math.max(s-1,0);else if(s===0&&(N===";"||N===","))o.push(e.slice(b,S)),b=S+1}return o.push(e.slice(b)),o.map((S)=>S.trim()).filter((S)=>S.length>0)}var Zt=/^["']|["']$/g,en=/\?$/,tn=/^\{/,nn=/\}$/;function rn(e){let o=0;for(let s=0;s<e.length;s++){let b=e[s];if(b==="{"||b==="("||b==="["||b==="<")o++;else if(b==="}"||b===")"||b==="]"||b===">")o=Math.max(o-1,0);else if(o===0&&b===":"){let S=e.slice(0,s).trim().replace(en,"").replace(Zt,""),N=e.slice(s+1).trim();if(!S||!N)return;return{name:S,type:N}}}return}function ht(e,o,s,b,S){if(s){let R=new Map(Array.from(o.localTypeDeclarationsByName.entries(),([z,W])=>[z,W.node])),G=Ie(e,o,s,R);for(let[z,W]of G)g(o,{name:z,detail:W.type,has_argument:!0,source:W.source});return}let N=e.resolveLocalVarJSDoc(b)?.type,D=N?Yt(N):void 0;if(!D)return;let C=D.trim().replace(tn,"").replace(nn,"");for(let R of Qt(C)){let G=rn(R);if(!G)continue;g(o,{name:G.name,detail:G.type,has_argument:!0,source:S})}}function St(e,o){if(e.syntaxMode!=="runes")return;for(let[s,b]of Array.from(e.events.entries())){if(b.type!=="dispatched")continue;if(o.has(s)||e.forwardedEvents.has(s))continue;let S=`on${s}`,N=e.props.get(S);if(!N)continue;let D=N.type!==void 0||N.params!==void 0||N.returnType!==void 0,C=b.detail===void 0||b.detail==="undefined"||b.detail==="null"?"() => void":`(detail: ${b.detail}) => void`;e.props.set(S,{...N,description:N.description??b.description,type:D?N.type:C,typeSource:D?N.typeSource:"inferred",isFunction:!0}),e.events.delete(s)}}var Et=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function Ye(e){if(!e||typeof e!=="object")return;p(e,{enter(o){if(!Et.has(o.type))return;let s=o.expression;while(s&&Et.has(s.type))s=s.expression;if(s)this.replace(s)}})}function Qe(e,o){let s=o.source?.value;if(typeof s!=="string"||o.importKind==="type")return;for(let b of o.specifiers??[]){if(b.type!=="ImportSpecifier"||b.importKind==="type")continue;let S=b.local?.name;if(!S)continue;let N=b.imported?.name??(typeof b.imported?.value==="string"?b.imported.value:S);e.valueImportBindingsByLocalName.set(S,{localName:S,importedName:N,source:s})}}function it(e,o){if(!o)return;p(o,{enter(s){if(s.type==="ImportDeclaration")Qe(e,s);if(s.type==="FunctionDeclaration"){let b=s;if(b.id?.name)e.funcDecls.set(b.id.name,b)}}})}function vt(e,o,s){let b=o+1;while(b<e.length){if(e[b]==="\\"){b+=2;continue}if(e[b]===s)return b+1;b++}return b}function Ct(e,o){let s=o+1,b=0;while(s<e.length){let S=e[s];if(S==="\\"){s+=2;continue}if(b===0){if(S==="`")return s+1;if(S==="$"&&e[s+1]==="{"){b=1,s+=2;continue}s++;continue}if(S==="{")b++;else if(S==="}")b--;else if(S==='"'||S==="'"){s=vt(e,s,S);continue}else if(S==="`"){s=Ct(e,s);continue}s++}return s}function on(e,o){let s=[],b=e.length,S=0;while(S<b){let N=e[S];if(N==='"'||N==="'"){S=vt(e,S,N);continue}if(N==="`"){S=Ct(e,S);continue}if(N==="/"&&e[S+1]==="/"){let D=S+2;while(D<b&&e[D]!==`
|
|
2
|
+
`)D++;S=D;continue}if(N==="/"&&e[S+1]==="*"){let D=S,C=S+2;while(C<b&&!(e[C]==="*"&&e[C+1]==="/"))C++;let R=Math.min(C+2,b),G=e.slice(D,R);s.push({end:R+o,isJsDoc:G.startsWith("/**")&&G.length>4,text:G}),S=R;continue}S++}return s}function Pt(e,o,s){if(!e||typeof e!=="object"||!("type"in e))return;let b=e;if(b.type==="FunctionDeclaration"){if(b.id?.type==="Identifier"&&b.id.name)s.push({name:b.id.name,start:o});return}if(b.type==="VariableDeclaration"){for(let S of b.declarations??[])if(S?.id?.type==="Identifier"&&S.id.name)s.push({name:S.id.name,start:o})}}function an(e){let o=[];for(let s of e){if(!s||typeof s!=="object"||!("type"in s))continue;let b=s;if(b.start===void 0)continue;if(b.type==="ExportNamedDeclaration"&&b.declaration)Pt(b.declaration,b.start,o);else Pt(b,b.start,o)}return o}function sn(e,o,s){let b;for(let S of e){if(S.end>o)break;if(!S.isJsDoc)continue;if(!K.test(s.slice(S.end,o)))continue;b=S}return b}function Dt(e,o){let s=new Map;if(!e.source)return s;let b=[e.parsed?.module,e.parsed?.instance],S=[],N=[];for(let D of b){let C=D?.content;if(!C?.body||C.start===void 0||C.end===void 0)continue;S.push(...on(e.source.slice(C.start,C.end),C.start)),N.push(...an(C.body))}S.sort((D,C)=>D.end-C.end);for(let D of N){let C=sn(S,D.start,e.source);if(!C)continue;let R=E(C.text),{type:G,description:z,ignore:W,internal:Se}=M(R);if(W.length>0)m(e,"context-any-type",D.name,W);if(!G)continue;s.set(D.name,{type:o.aliasType(G.type),description:z||G.description,internal:Se||void 0})}return s}function Mt(e){if(e==="var")return"let";if(e==="using"||e==="await using")return"const";return e}var cn=null,kt=/^@component/,pn=/\r/g,ln=/^\{\s*\}$/;class i{ctx=tt();static mapToArray(e){return Array.from(e,([o,s])=>s)}static getStaticAttributeValue(e){if(!Array.isArray(e.value))return;return e.value.map((o)=>o.data??o.raw??"").join("").trim()}resolveScriptLanguage(e){let o=[e.instance,e.module].filter((b)=>b!==void 0),s=!1;for(let b of o){let S=b.attributes?.find((D)=>D.name==="lang");if(!S){s=!0;continue}if(i.getStaticAttributeValue(S)?.toLowerCase()==="ts")return"ts"}return s?"js":void 0}resolveScriptGenericsAttribute(e){let o=e.instance?.attributes?.find((D)=>D.name==="generics");if(!o)return;let s=t(this.ctx,o),b=e.instance?.attributes?.find((D)=>D.name==="lang");if((b?i.getStaticAttributeValue(b)?.toLowerCase():void 0)!=="ts"){n(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',s);return}let N=i.getStaticAttributeValue(o);if(!N)return;return{value:N,source:s}}resolvePublicPropName(e){return this.ctx.propLocalToPublicName.get(e)??e}trackPropLocalName(e,o=e){this.ctx.propLocalToPublicName.set(o,e)}getPropByLocalOrPublic(e){return this.ctx.props.get(this.resolvePublicPropName(e))}getPropTypeByLocalOrPublic(e){return this.getPropByLocalOrPublic(e)?.type}getExplicitPropType(e){return this.ctx.explicitPropTypesByName.get(e)}getPropertyName(e){if(!e||typeof e!=="object"||!("type"in e))return;if(a(e))return e.name;if(f(e))return e.value==null?void 0:String(e.value);return}isNumericConstant(e){if(!e||typeof e!=="object"||!("type"in e))return!1;if(e.type!=="MemberExpression")return!1;let o=e,s=o.object&&"name"in o.object?o.object.name:void 0,b=o.property&&"name"in o.property?o.property.name:void 0;if(!s||!b)return!1;if(s==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(b);if(s==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(b);return!1}resolveLocalVarJSDoc(e){for(let s of this.ctx.vars)if(s.declarations.some((S)=>S.id&&typeof S.id==="object"&&("type"in S.id)&&S.id.type==="Identifier"&&("name"in S.id)&&S.id.name===e))return y(this.ctx,this,s);let o=this.ctx.funcDecls.get(e);if(o)return y(this.ctx,this,o);return}addModuleExport(e,o){if(u(e)===void 0)return;if(this.ctx.moduleExports.has(e)){let s=this.ctx.moduleExports.get(e);this.ctx.moduleExports.set(e,{...s,...o})}else this.ctx.moduleExports.set(e,o)}aliasType(e){if(e==="*")return"any";return e.trim()}findVariableTypeAndDescription(e){let o=this.getPropByLocalOrPublic(e);if(o?.type)return{type:o.type,description:o.description,internal:o.internal};if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=Dt(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;let s=this.ctx.variableInfoCache.get(e),b=this.ctx.explicitVariableTypesByName.get(e);if(b)return{type:b,description:s?.description,internal:s?.internal};return s??null}accumulateGeneric(e,o){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${e}`,`${this.ctx.generics[1]}, ${o}`];else this.ctx.generics=[e,o]}cleanup(){this.ctx=tt()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/\s*@ts-[^\n\r]*/g;static stripTypeScriptDirectivesFromScripts(e){if(!e.includes("@ts-"))return e;return i.SCRIPT_BLOCK_REGEX.lastIndex=0,e.replace(i.SCRIPT_BLOCK_REGEX,(o,s,b,S)=>{i.TS_DIRECTIVE_REGEX.lastIndex=0;let N=b.replace(i.TS_DIRECTIVE_REGEX,"");return s+N+S})}parseSvelteComponent(e,o){this.cleanup(),this.ctx.componentFilePath=o.filePath;let s=i.stripTypeScriptDirectivesFromScripts(e);this.ctx.source=s;let b=v(s);if(bt(this,this.ctx,b),this.ctx.parsed=b,this.ctx.scriptLanguage==="ts")Ye(this.ctx.parsed.module),Ye(this.ctx.parsed.instance),Ye(this.ctx.parsed.fragment);this.ctx.syntaxMode=Tt(this.ctx);let S=this.ctx.parsed.css,N=S?.start!==void 0&&S?.end!==void 0?s.slice(0,S.start)+" ".repeat(S.end-S.start)+s.slice(S.end):s;Ee(this.ctx,this,N);let D={type:"ComponentRoot",instance:this.ctx.parsed.instance,fragment:this.ctx.parsed.fragment};if(it(this.ctx,this.ctx.parsed?.module),it(this.ctx,this.ctx.parsed?.instance),this.ctx.parsed?.module)p(this.ctx.parsed?.module,{enter:(P)=>{if(P.type==="ImportDeclaration")Qe(this.ctx,P);if(P.type==="FunctionDeclaration"){let k=P;if(k.id?.name)this.ctx.funcDecls.set(k.id.name,k)}if(P.type==="VariableDeclaration")this.ctx.vars.add(P);if(P.type==="ExportNamedDeclaration"){if(P.declaration==null&&P.specifiers.length===0)return;let k,I=!1;if(P.declaration==null&&P.specifiers[0]?.type==="ExportSpecifier"){let w=P.specifiers[0],_=w.local&&typeof w.local==="object"&&"name"in w.local?w.local.name:void 0,V=w.exported&&typeof w.exported==="object"&&"name"in w.exported?w.exported.name:void 0;if(!_||!V)return;let U;for(let F of Array.from(this.ctx.vars))if(F.declarations.some((B)=>B.id&&typeof B.id==="object"&&("type"in B.id)&&B.id.type==="Identifier"&&B.id.name===_)){U=F;break}if(!U){let F="source"in P&&P.source&&typeof P.source==="object"&&"value"in P.source?P.source.value:void 0,B=typeof F==="string"?`it re-exports from "${F}"`:this.ctx.valueImportBindingsByLocalName.has(_)?"it re-exports an imported binding":"no matching local declaration was found";n(this.ctx,"export-unresolved",V,`export "${V}" was skipped because ${B}; sveld only resolves exports of a local declaration.`,t(this.ctx,P));return}P.declaration=U,k=V,I=!0}if(P.declaration==null)return;if(!P.declaration||typeof P.declaration!=="object"||!("type"in P.declaration))return;let J=[];if(P.declaration.type==="FunctionDeclaration"){let w=P.declaration;if(!w.id?.name)return;let _=this.ctx.scriptLanguage==="ts"?Y(this.ctx,w):void 0;J.push({prop_name:w.id.name,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:_?.hasAnnotations?void 0:"() => any",explicitType:_?.hasAnnotations?_.signature:void 0,initializerIsFunction:!0,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(P.declaration.type==="VariableDeclaration"){let w=P.declaration,_=Mt(w.kind),V=I?w.declarations.slice(0,1):w.declarations;for(let U of V){if(!U||typeof U!=="object"||!("id"in U))continue;let{id:F,init:B}=U;if(!F||typeof F!=="object"||!("name"in F))continue;let ee=F.name,re=k??ee,oe=B==null?{isFunction:!1}:h(this,this.ctx,B),{value:be,type:De,isFunction:te,defaultValue:Le}=oe,Me=oe;if(Me.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:ee,location:"moduleExports",...Me.pendingCallDefault});J.push({prop_name:re,kind:_,isFunctionDeclaration:!1,value:be,typeSeed:De,explicitType:this.getExplicitPropType(ee),initializerIsFunction:te,defaultValue:Le,inferredTypeForSource:De,resolvedJSDoc:Me})}if(J.length===0)return}else return;let q=y(this.ctx,this,P);for(let{prop_name:w,kind:_,isFunctionDeclaration:V,value:U,typeSeed:F,explicitType:B,initializerIsFunction:ee,defaultValue:re,inferredTypeForSource:oe,resolvedJSDoc:be}of J){let{type:De,typeSource:te,description:Le,params:Me,returnType:we,isFunction:ke}=$e({explicitType:B,typeSeed:F,inferredTypeForSource:oe,jsdocType:q?.type,jsdocDescription:q?.description,jsdocParams:q?.params,jsdocReturnType:q?.returnType,resolvedType:be?.resolvedType,resolvedDescription:be?.resolvedDescription,resolvedParams:be?.resolvedParams,resolvedReturnType:be?.resolvedReturnType,initializerIsFunction:ee,isFunctionDeclaration:V,typedefs:this.ctx.typedefs});this.addModuleExport(w,{name:w,kind:_,description:Le,deprecated:q?.deprecated,tags:q?.tags,...q?.internal?{internal:!0}:{},type:De,typeSource:te,value:U,defaultValue:re,params:Me,returnType:we,isFunction:ke,isFunctionDeclaration:V,isRequired:!1,constant:_==="const",reactive:!1,source:t(this.ctx,P)})}}}});let C,R,G,z=new Set,W=new Set,Se=[];lt(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let Ne=dt(this.ctx);if(p(D,{enter:(P,k,I)=>{let J=ut(this,this.ctx,Ne,P);if(J)this.ctx.activeScopes.push(J);let q=P.type;if(P.type==="AssignmentExpression")rt(this.ctx,P.left);if(P.type==="UpdateExpression")rt(this.ctx,P.argument);if(P.type==="CallExpression"){let w=P,_=w.callee&&typeof w.callee==="object"&&"name"in w.callee?w.callee.name:void 0;if(_==="createEventDispatcher"){if(k&&typeof k==="object"&&"id"in k&&k.id&&typeof k.id==="object"&&"name"in k.id)C=k.id.name,R=k;G=w.typeArguments?.params?.[0]}if(_==="$host"){if(k&&typeof k==="object"&&"id"in k&&k.id&&typeof k.id==="object"&&"name"in k.id)z.add(k.id.name)}if(_==="setContext")ce(this.ctx,this,P,k??void 0);if(_)Se.push({name:_,arguments:w.arguments,node:w});if(ie(w.callee)&&a(w.callee.property)&&w.callee.property.name==="dispatchEvent"&&(l(w.callee.object,"$host")||a(w.callee.object)&&z.has(w.callee.object.name))){let V=pe(this.ctx,w);if(V)W.add(V)}}if(q==="SpreadAttribute"){let w=P;if(w.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(w.expression?.name??""))ct(this.ctx,k)}if(P.type==="FunctionDeclaration"){let w=P;if(w.id?.name)this.ctx.funcDecls.set(w.id.name,w)}if(P.type==="ImportDeclaration")Qe(this.ctx,P);if(P.type==="VariableDeclaration"){if(this.ctx.vars.add(P),k&&typeof k==="object"&&"type"in k&&k.type==="Program"&&P.declarations.some((w)=>l(d(w.init),"$props")))xt(this,this.ctx,P)}if(P.type==="ExportNamedDeclaration"){if(P.declaration==null&&P.specifiers.length===0)return;let w,_=!1;if(P.declaration==null&&P.specifiers[0]?.type==="ExportSpecifier"){let F=P.specifiers[0],B=F.local&&typeof F.local==="object"&&"name"in F.local?F.local.name:void 0,ee=F.exported&&typeof F.exported==="object"&&"name"in F.exported?F.exported.name:void 0;if(!B||!ee)return;let re;for(let oe of Array.from(this.ctx.vars))if(oe.declarations.some((be)=>be.id&&typeof be.id==="object"&&("type"in be.id)&&be.id.type==="Identifier"&&be.id.name===B)){re=oe;break}if(P.declaration=re,w=ee,_=!0,!re){let oe="source"in P&&P.source&&typeof P.source==="object"&&"value"in P.source?P.source.value:void 0,be=typeof oe==="string"?`it re-exports from "${oe}"`:this.ctx.valueImportBindingsByLocalName.has(B)?"it re-exports an imported binding":"no matching local declaration was found";n(this.ctx,"export-unresolved",ee,`export "${ee}" was skipped because ${be}; sveld only resolves exports of a local declaration.`,t(this.ctx,P));return}}if(P.declaration==null)return;if(!P.declaration||typeof P.declaration!=="object"||!("type"in P.declaration))return;let V=[];if(P.declaration.type==="FunctionDeclaration"){let F=P.declaration;if(!F.id?.name)return;w??=F.id.name;let B=this.ctx.scriptLanguage==="ts"?Y(this.ctx,F):void 0;V.push({prop_name:w,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:B?.hasAnnotations?void 0:"() => any",explicitType:B?.hasAnnotations?B.signature:void 0,initializerIsFunction:!0,isRequired:!1,localName:F.id.name,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(P.declaration.type==="VariableDeclaration"){let F=P.declaration,B=Mt(F.kind),ee=_?F.declarations.slice(0,1):F.declarations;for(let re of ee){if(!re||typeof re!=="object"||!("id"in re))continue;let{id:oe,init:be}=re;if(!oe||typeof oe!=="object"||!("name"in oe))continue;let De=oe.name,te=w??De,Le=B==="let"&&be==null,Me=be==null?{isFunction:!1}:h(this,this.ctx,be),{value:we,type:ke,isFunction:Ze,defaultValue:et}=Me,Be=Me;if(Be.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:te,location:"props",...Be.pendingCallDefault});V.push({prop_name:te,kind:B,isFunctionDeclaration:!1,value:we,typeSeed:ke,explicitType:this.getExplicitPropType(De),initializerIsFunction:Ze,isRequired:Le,localName:De,defaultValue:et,inferredTypeForSource:ke,resolvedJSDoc:Be})}if(V.length===0)return}else return;let U=y(this.ctx,this,P);for(let{prop_name:F,kind:B,isFunctionDeclaration:ee,value:re,typeSeed:oe,explicitType:be,initializerIsFunction:De,isRequired:te,localName:Le,defaultValue:Me,inferredTypeForSource:we,resolvedJSDoc:ke}of V){let{type:Ze,typeSource:et,description:Be,params:Lt,returnType:Nt,isFunction:wt}=$e({explicitType:be,typeSeed:oe,inferredTypeForSource:we,jsdocType:U?.type,jsdocDescription:U?.description,jsdocParams:U?.params,jsdocReturnType:U?.returnType,resolvedType:ke?.resolvedType,resolvedDescription:ke?.resolvedDescription,resolvedParams:ke?.resolvedParams,resolvedReturnType:ke?.resolvedReturnType,initializerIsFunction:De,isFunctionDeclaration:ee,typedefs:this.ctx.typedefs});m(this.ctx,"prop-unknown-type",F,U?.sveldIgnore),L(this,this.ctx,F,{name:F,...Le!==void 0&&Le!==F?{localName:Le}:{},kind:B,description:Be,binding:U?.binding,deprecated:U?.deprecated,tags:U?.tags,...U?.internal?{internal:!0}:{},type:Ze,typeSource:et,value:re,defaultValue:Me,params:Lt,returnType:Nt,isFunction:wt,isFunctionDeclaration:ee,isRequired:te,constant:B==="const",reactive:this.ctx.reactive_vars.has(F),source:t(this.ctx,P)})}}if(q==="Comment"){let _=P?.data?.trim()??"";if(kt.test(_))this.ctx.componentComment=_.replace(kt,"").replace(pn,""),this.ctx.componentCommentSource=t(this.ctx,P)}if(q==="SlotElement"){let w=P,_=w.attributes?.find((B)=>B.name==="name")?.value,V=(Array.isArray(_)?_[0]:void 0)?.data,U=(w.attributes||[]).filter((B)=>B.name!=="name").reduce((B,ee)=>{let re={value:void 0,replace:!1},oe=ee.value;if(oe===void 0||oe===!0)return B;let be=Array.isArray(oe)?oe[0]:oe;if(be){let{type:De,expression:te,raw:Le,start:Me,end:we}=be;if(De==="Text"&&Le!==void 0)re.value=JSON.stringify(Le);else if(!Array.isArray(oe)&&De==="ExpressionTag"&&te&&typeof te==="object"&&"type"in te&&te.type==="Identifier"&&"name"in te&&te.name===ee.name)re.value=te.name,re.replace=!0;if(te&&typeof te==="object"&&"type"in te){if(te.type==="Literal"&&"value"in te){let ke=te.value;re.value=typeof ke==="string"?JSON.stringify(ke):String(ke)}else if(te.type==="MemberExpression")re.value=j(this.ctx,this,te);else if(te.type!=="Identifier"){if(Me!==void 0&&we!==void 0){if(te.type==="ObjectExpression"||te.type==="TemplateLiteral")re.value=r(this.ctx,Me+1,we-1)}}}}if(ee.name)B[ee.name]=re;return B},{}),F=w.fragment?.nodes?.map(({start:B,end:ee})=>{if(B===void 0||ee===void 0)return"";return r(this.ctx,B,ee)??""}).join("").trim();O(this.ctx,{slot_name:V,slot_props:U,slot_fallback:F,source:t(this.ctx,P)})}if(q==="RenderTag"){let w=P,_=xe(this.ctx,w.expression);if(_){let V,U=!1;if(_.arguments.length===0)V={};else if(_.arguments.length===1&&typeof _.arguments[0]==="object"&&_.arguments[0]&&"type"in _.arguments[0]&&_.arguments[0].type==="ObjectExpression"){let ee=Z(this.ctx,this,_.arguments[0]);V=ee.slot_props,U=ee.hasUnresolvedSpread}else if(_.arguments.length===1)n(this.ctx,"syntax-skipped",_.publicName,`{@render ${_.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,t(this.ctx,P));let F=_.publicName==="children"?void 0:_.publicName,B=F===void 0?cn:F;if(V!==void 0)O(this.ctx,{slot_name:F,slot_props:V,slot_props_unresolved_spread:U||void 0,source:t(this.ctx,P)});if(V!==void 0||this.ctx.slots.has(B))this.ctx.snippetPropLocals.add(_.trackingName)}}if(q==="OnDirective"){let w=P;if(w.expression==null&&w.name){if(k!=null&&typeof k==="object"&&"name"in k){let _=typeof k.name==="string"?k.name:void 0,V="type"in k?String(k.type):void 0;if(_&&V){let U=Ve(V)?{type:"InlineComponent",name:_}:{type:"Element",name:_};this.ctx.forwardedEvents.set(w.name,U);let F=this.ctx.events.get(w.name),B=this.ctx.eventDescriptions.get(w.name),ee=F?.deprecated,re=F?.internal;if(!F)this.ctx.events.set(w.name,{type:"forwarded",name:w.name,element:U,description:B,deprecated:ee,...re?{internal:!0}:{},source:t(this.ctx,P)});else if(F.type==="forwarded"&&B&&!F.description)this.ctx.events.set(w.name,{...F,description:B,deprecated:F.deprecated??ee,...F.internal||re?{internal:!0}:{},source:F.source||t(this.ctx,P)})}}}}if(q==="BindDirective"&&k&&typeof k==="object"&&"type"in k&&(Oe(String(k.type))||Ve(String(k.type)))){let w=P;if(w.expression?.name){let _=Ge(this.ctx,w.expression.name);if(_)this.ctx.reactive_vars.add(_)}if(Oe(String(k.type))&&w.name==="this"&&w.expression?.name&&"name"in k&&typeof k.name==="string"){let _=Ge(this.ctx,w.expression.name);if(!_)return;let V=k.name;if(this.ctx.bindings.has(_)){let U=this.ctx.bindings.get(_);if(U&&!U.elements.includes(V))this.ctx.bindings.set(_,{...U,elements:[...U.elements,V]})}else this.ctx.bindings.set(_,{elements:[V]})}}},leave:(P)=>{if(Ae(P))this.ctx.activeScopes.pop(),mt(Ne,P)}}),C!==void 0){ht(this,this.ctx,G,C,t(this.ctx,R));for(let P of Se)if(P.name===C){let k=P.arguments[0],I=k&&typeof k==="object"&&"value"in k?k.value:void 0,J=P.arguments[1],q=ue(this,J),w=q===void 0&&J&&typeof J==="object"&&"value"in J?J.value:void 0;if(I!=null)g(this.ctx,{name:String(I),detail:q??(w==null?"":X(w)),has_argument:Boolean(J),source:t(this.ctx,P.node)})}}let ve=new Set(W);if(C!==void 0){for(let P of Se)if(P.name===C){let k=P.arguments[0],I=k&&typeof k==="object"&&"value"in k?k.value:void 0;if(I!=null)ve.add(String(I))}}this.ctx.forwardedEvents.forEach((P,k)=>{let I=this.ctx.events.get(k);if(I&&I.type==="dispatched"&&!ve.has(k)){let J=this.ctx.eventDescriptions.get(k),q={type:"forwarded",name:k,element:P,description:J,deprecated:I.deprecated,tags:I.tags,source:I.source};if(I.internal)q.internal=!0;if(I.detail!==void 0&&I.detail!=="undefined")q.detail=I.detail;this.ctx.events.set(k,q)}}),St(this.ctx,ve);let _e=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(P)=>this.resolvePublicPropName(P))):new Set,Re=i.mapToArray(this.ctx.props).filter((P)=>!_e.has(P.name)).map((P)=>{if(this.ctx.bindings.has(P.name)){let k=this.ctx.bindings.get(P.name)?.elements.sort().map((I)=>st(I)).join(" | ");return{...P,type:`null | ${k}`,typeSource:"inferred",reactive:P.reactive||this.ctx.reactive_vars.has(P.name)}}return{...P,reactive:P.reactive||this.ctx.reactive_vars.has(P.name)}});this.ctx.activeScopes.length=0;let Fe=i.mapToArray(this.ctx.slots).map((P)=>{let{slot_props_unresolved_spread:k,...I}=P;if(!P.slot_props)return I;if(typeof P.slot_props==="string")return ln.test(P.slot_props)?{...I,slot_props:"Record<string, never>"}:I;let J=P.slot_props,q=[];for(let V of Object.keys(J)){if(J[V].replace&&J[V].value!==void 0)J[V].value=this.getPropTypeByLocalOrPublic(J[V].value);if(J[V].value===void 0)J[V].value="any";q.push(`${V}: ${J[V].value}`)}let w=k?" & Record<string, any>":"",_=q.length===0?k?"Record<string, any>":"Record<string, never>":q.length===1?`{ ${q[0]} }${w}`:`{
|
|
3
|
+
${q.join(`;
|
|
4
|
+
`)};
|
|
5
|
+
}${w}`;return{...I,slot_props:_}}).sort((P,k)=>{let I=P.name??"",J=k.name??"";if(I<J)return-1;if(I>J)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let P=[...Re.map((k)=>k.type??""),...Fe.map((k)=>k.slot_props??"")].join(`
|
|
6
|
+
`);for(let{name:k,constraint:I}of this.ctx.deferredSlotBlockGenerics){let J=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${J}\\b`).test(P))continue;this.accumulateGeneric(k,I)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)n(this.ctx,"syntax-skipped","generics",'Both the "generics" script attribute and @generics/@template JSDoc tags declare component generics; the script attribute takes precedence and the JSDoc declaration was ignored.',this.ctx.scriptGenericsAttribute.source);this.ctx.generics=ge(this.ctx.scriptGenericsAttribute.value)}let He=i.mapToArray(this.ctx.moduleExports),Je=i.mapToArray(this.ctx.events).map((P)=>{switch(P.type){case"forwarded":return{...P,element:P.element.name};case"dispatched":return P;default:return P}}).sort((P,k)=>{let I=P.name.localeCompare(k.name);if(I!==0)return I;let J=P.type.localeCompare(k.type);if(J!==0)return J;if(P.type==="forwarded"&&k.type==="forwarded"){let q=P.element.localeCompare(k.element);if(q!==0)return q}return(P.detail??"").localeCompare(k.detail??"")}),je=i.mapToArray(this.ctx.typedefs),Ke=i.mapToArray(this.ctx.contexts),ze={props:new Map(this.ctx.pendingCallDefaultCandidates.filter((P)=>P.location==="props").map((P)=>[P.propName,P])),moduleExports:new Map(this.ctx.pendingCallDefaultCandidates.filter((P)=>P.location==="moduleExports").map((P)=>[P.propName,P]))};for(let P of Re)if(P.typeSource==="unknown"){let k=ze.props.get(P.name);if(k)P.type="any";let I=k?k.importSource?`Prop "${P.name}" default calls "${k.calleeName}()" imported from "${k.importSource}"; falling back to "any" pending cross-file resolution.`:`Prop "${P.name}" default calls "${k.calleeName}()", but its return type could not be inferred; falling back to "any".`:`Prop "${P.name}" type could not be inferred; falling back to "${P.type??"any"}".`;n(this.ctx,"prop-unknown-type",P.name,I,P.source)}for(let P of He)if(P.typeSource==="unknown"&&ze.moduleExports.has(P.name))P.type="any";for(let P of this.ctx.jsDocEventNames){if(ve.has(P))continue;if(this.ctx.forwardedEvents.has(P))continue;if(this.ctx.props.has(`on${P}`))continue;n(this.ctx,"event-no-source",P,`@event "${P}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(P))}if(this.ctx.rest_props?.type==="InlineComponent")n(this.ctx,"rest-props-unresolved","$$restProps",`$$restProps is only spread onto component "${this.ctx.rest_props.name}"; sveld cannot infer its rest-prop type. Spread onto a plain element or add an @restProps tag.`);let Xe=je.filter((P)=>P.internal).map((P)=>P.name.split("<")[0]);if(Xe.length>0){let P=Xe.map((I)=>({name:I,regex:new RegExp(`\\b${I}\\b`)})),k=(I,J,q)=>{if(!J)return;for(let{name:w,regex:_}of P){if(!_.test(J))continue;n(this.ctx,"internal-typedef-referenced",I,`"${I}" references "${w}", which is @internal and excluded from output; the generated .d.ts will contain a dangling reference to it.`,q)}};for(let I of Re){if(I.internal)continue;k(I.name,I.type,I.source)}for(let I of He){if(I.internal)continue;k(I.name,I.type,I.source)}for(let I of je){if(I.internal)continue;k(I.name,I.ts)}for(let I of Je){if(I.internal||I.type!=="dispatched")continue;k(I.name,I.detail,I.source)}for(let I of Fe){if(I.internal)continue;k(I.name??"default",I.slot_props,I.source)}for(let I of Ke){if(I.internal)continue;for(let J of I.properties)k(J.name,J.type)}}let Ue={source:H(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:Re,moduleExports:He,slots:Fe,events:Je,typedefs:je,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:Ke,customElementTag:this.ctx.customElementTag,customElement:this.ctx.customElement,...this.ctx.cssParts.length>0?{cssParts:this.ctx.cssParts.slice()}:{},...this.ctx.cssProperties.length>0?{cssProperties:this.ctx.cssProperties.slice()}:{},diagnostics:this.ctx.diagnosticRecords.slice()},We=he(this.ctx);if(We)Ue[x]=We;return Ue}}
|
|
7
|
+
export{i};
|
package/lib/cli-entry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{re}from"./chunk-jtm65qmd.js";export{re as cli};
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{J,F,q,V,oe,U,s,Se,W,B,ee,be,te,_,Ce,D,N,G,I,R,b,k,w,z,Pe,ke,C,re}from"./chunk-jtm65qmd.js";import{i}from"./chunk-s1v2vjye.js";async function f(n){if(n&&"input"in n)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:m,...u}=n??{},a=await D(),o=_(m??a.entry);if(o===null)throw Error('sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.');let e=G(N(a,u,{entry:o}));I(e),R(e.quiet===!0);let t=await k(o,e.glob===!0,b(e)),p;if(e.check)p=await B(t.components,W(e),{entryExports:t.entryExports});if(await C(t,e,o),!e.dryRun)t.cache?.save();let c=e.reportDiagnostics||e.strict,r=F(t.diagnostics,c);if(c&&r.length>0)if(e.format==="json")process.stderr.write(U(r));else console.error(V(r));let l=0;if(p?.bump==="major")l=3;else if(q(r,e.strict).length>0)l=4;return{diagnostics:r,check:p,errors:t.errors,exitCode:l}}export{be as CHECK_REPORT_SCHEMA_VERSION,i as ComponentParser,oe as DIAGNOSTICS_SCHEMA_VERSION,J as DIAGNOSTIC_CODES,s as buildComponentApiDocument,re as cli,ke as default,Ce as defineConfig,Se as diffApiDocuments,ee as formatCheckReport,te as formatCheckReportJson,z as getWriter,Pe as listWriters,w as registerWriter,B as runCheck,f as sveld};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sveld",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Generate TypeScript definitions and component documentation for your Svelte components.",
|
|
6
6
|
"type": "module",
|
|
@@ -16,14 +16,16 @@
|
|
|
16
16
|
"types": "./lib/browser.d.ts",
|
|
17
17
|
"import": "./lib/browser.js",
|
|
18
18
|
"default": "./lib/browser.js"
|
|
19
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"./schema/component-api.schema.json": "./schema/component-api.schema.json"
|
|
20
21
|
},
|
|
21
22
|
"bin": {
|
|
22
23
|
"sveld": "cli.js"
|
|
23
24
|
},
|
|
24
25
|
"files": [
|
|
25
26
|
"lib",
|
|
26
|
-
"cli.js"
|
|
27
|
+
"cli.js",
|
|
28
|
+
"schema"
|
|
27
29
|
],
|
|
28
30
|
"repository": {
|
|
29
31
|
"type": "git",
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/carbon-design-system/sveld/main/schema/component-api.schema.json",
|
|
4
|
+
"title": "sveld COMPONENT_API.json",
|
|
5
|
+
"description": "Public JSON Schema for the combined COMPONENT_API.json file emitted by sveld when json output is enabled.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["schemaVersion", "generator", "total", "components"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"schemaVersion": {
|
|
11
|
+
"const": 1,
|
|
12
|
+
"description": "Version of the emitted sveld component API JSON format."
|
|
13
|
+
},
|
|
14
|
+
"generator": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"required": ["name", "version", "svelteVersion"],
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"properties": {
|
|
19
|
+
"name": { "type": "string" },
|
|
20
|
+
"version": { "type": "string" },
|
|
21
|
+
"svelteVersion": { "type": "string" }
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"total": {
|
|
25
|
+
"type": "integer",
|
|
26
|
+
"minimum": 0,
|
|
27
|
+
"description": "Number of components in the components array."
|
|
28
|
+
},
|
|
29
|
+
"components": {
|
|
30
|
+
"type": "array",
|
|
31
|
+
"items": { "$ref": "#/$defs/component" }
|
|
32
|
+
},
|
|
33
|
+
"totalExports": {
|
|
34
|
+
"type": "integer",
|
|
35
|
+
"minimum": 0,
|
|
36
|
+
"description": "Count of entry-barrel exports. Only when `documentExports` is on."
|
|
37
|
+
},
|
|
38
|
+
"exports": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"description": "Entry-barrel exports other than components. Only when `documentExports` is on.",
|
|
41
|
+
"items": { "$ref": "#/$defs/entryExport" }
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"$defs": {
|
|
45
|
+
"sourcePosition": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"required": ["line", "column"],
|
|
48
|
+
"additionalProperties": false,
|
|
49
|
+
"properties": {
|
|
50
|
+
"line": {
|
|
51
|
+
"type": "integer",
|
|
52
|
+
"minimum": 1
|
|
53
|
+
},
|
|
54
|
+
"column": {
|
|
55
|
+
"type": "integer",
|
|
56
|
+
"minimum": 0
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"sourceRange": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"required": ["start", "end"],
|
|
63
|
+
"additionalProperties": false,
|
|
64
|
+
"properties": {
|
|
65
|
+
"start": { "$ref": "#/$defs/sourcePosition" },
|
|
66
|
+
"end": { "$ref": "#/$defs/sourcePosition" }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"deprecated": {
|
|
70
|
+
"oneOf": [{ "type": "string" }, { "const": true }],
|
|
71
|
+
"description": "Author-documented deprecation from `@deprecated`. A string is the message; `true` means the tag had no message."
|
|
72
|
+
},
|
|
73
|
+
"component": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"required": [
|
|
76
|
+
"moduleName",
|
|
77
|
+
"filePath",
|
|
78
|
+
"syntaxMode",
|
|
79
|
+
"props",
|
|
80
|
+
"moduleExports",
|
|
81
|
+
"slots",
|
|
82
|
+
"events",
|
|
83
|
+
"typedefs",
|
|
84
|
+
"generics"
|
|
85
|
+
],
|
|
86
|
+
"additionalProperties": false,
|
|
87
|
+
"properties": {
|
|
88
|
+
"moduleName": { "type": "string" },
|
|
89
|
+
"filePath": { "type": "string" },
|
|
90
|
+
"source": { "$ref": "#/$defs/sourceRange" },
|
|
91
|
+
"syntaxMode": {
|
|
92
|
+
"enum": ["legacy", "runes"]
|
|
93
|
+
},
|
|
94
|
+
"scriptLanguage": {
|
|
95
|
+
"enum": ["js", "ts"]
|
|
96
|
+
},
|
|
97
|
+
"props": {
|
|
98
|
+
"type": "array",
|
|
99
|
+
"items": { "$ref": "#/$defs/prop" }
|
|
100
|
+
},
|
|
101
|
+
"moduleExports": {
|
|
102
|
+
"type": "array",
|
|
103
|
+
"items": { "$ref": "#/$defs/prop" }
|
|
104
|
+
},
|
|
105
|
+
"slots": {
|
|
106
|
+
"type": "array",
|
|
107
|
+
"items": { "$ref": "#/$defs/slot" }
|
|
108
|
+
},
|
|
109
|
+
"events": {
|
|
110
|
+
"type": "array",
|
|
111
|
+
"items": { "$ref": "#/$defs/event" }
|
|
112
|
+
},
|
|
113
|
+
"typedefs": {
|
|
114
|
+
"type": "array",
|
|
115
|
+
"items": { "$ref": "#/$defs/typedef" }
|
|
116
|
+
},
|
|
117
|
+
"generics": {
|
|
118
|
+
"oneOf": [
|
|
119
|
+
{ "type": "null" },
|
|
120
|
+
{
|
|
121
|
+
"type": "array",
|
|
122
|
+
"prefixItems": [{ "type": "string" }, { "type": "string" }],
|
|
123
|
+
"items": false,
|
|
124
|
+
"minItems": 2,
|
|
125
|
+
"maxItems": 2
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
"rest_props": { "$ref": "#/$defs/restProp" },
|
|
130
|
+
"extends": { "$ref": "#/$defs/extends" },
|
|
131
|
+
"componentComment": { "type": "string" },
|
|
132
|
+
"componentCommentSource": { "$ref": "#/$defs/sourceRange" },
|
|
133
|
+
"contexts": {
|
|
134
|
+
"type": "array",
|
|
135
|
+
"items": { "$ref": "#/$defs/context" }
|
|
136
|
+
},
|
|
137
|
+
"customElementTag": {
|
|
138
|
+
"type": "string",
|
|
139
|
+
"description": "Custom-element tag name from `<svelte:options customElement=\"x-foo\" />` (or the object form's `tag`), when present."
|
|
140
|
+
},
|
|
141
|
+
"customElement": { "$ref": "#/$defs/customElement" },
|
|
142
|
+
"cssParts": {
|
|
143
|
+
"type": "array",
|
|
144
|
+
"items": { "$ref": "#/$defs/cssPart" }
|
|
145
|
+
},
|
|
146
|
+
"cssProperties": {
|
|
147
|
+
"type": "array",
|
|
148
|
+
"items": { "$ref": "#/$defs/cssProperty" }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"customElement": {
|
|
153
|
+
"type": "object",
|
|
154
|
+
"additionalProperties": false,
|
|
155
|
+
"description": "Full `<svelte:options customElement=... />` config (shorthand or object form), when present.",
|
|
156
|
+
"properties": {
|
|
157
|
+
"tag": { "type": "string" },
|
|
158
|
+
"shadow": { "enum": ["open", "none"] },
|
|
159
|
+
"props": {
|
|
160
|
+
"type": "object",
|
|
161
|
+
"additionalProperties": { "$ref": "#/$defs/customElementPropConfig" }
|
|
162
|
+
},
|
|
163
|
+
"extend": { "const": true }
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"customElementPropConfig": {
|
|
167
|
+
"type": "object",
|
|
168
|
+
"additionalProperties": false,
|
|
169
|
+
"properties": {
|
|
170
|
+
"attribute": {
|
|
171
|
+
"oneOf": [{ "type": "string" }, { "const": false }]
|
|
172
|
+
},
|
|
173
|
+
"reflect": { "type": "boolean" },
|
|
174
|
+
"type": { "enum": ["String", "Boolean", "Number", "Array", "Object"] }
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"cssPart": {
|
|
178
|
+
"type": "object",
|
|
179
|
+
"required": ["name"],
|
|
180
|
+
"additionalProperties": false,
|
|
181
|
+
"properties": {
|
|
182
|
+
"name": { "type": "string" },
|
|
183
|
+
"description": { "type": "string" }
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"cssProperty": {
|
|
187
|
+
"type": "object",
|
|
188
|
+
"required": ["name"],
|
|
189
|
+
"additionalProperties": false,
|
|
190
|
+
"properties": {
|
|
191
|
+
"name": { "type": "string", "description": "Includes the leading `--`." },
|
|
192
|
+
"type": { "type": "string" },
|
|
193
|
+
"default": { "type": "string" },
|
|
194
|
+
"description": { "type": "string" }
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"prop": {
|
|
198
|
+
"type": "object",
|
|
199
|
+
"required": ["name", "kind", "isFunction", "isFunctionDeclaration", "isRequired", "constant", "reactive"],
|
|
200
|
+
"additionalProperties": false,
|
|
201
|
+
"properties": {
|
|
202
|
+
"name": { "type": "string" },
|
|
203
|
+
"localName": { "type": "string" },
|
|
204
|
+
"kind": {
|
|
205
|
+
"enum": ["let", "const", "function"]
|
|
206
|
+
},
|
|
207
|
+
"constant": { "type": "boolean" },
|
|
208
|
+
"type": { "type": "string" },
|
|
209
|
+
"typeSource": {
|
|
210
|
+
"enum": ["typescript", "jsdoc", "default", "inferred", "unknown"]
|
|
211
|
+
},
|
|
212
|
+
"value": { "type": "string" },
|
|
213
|
+
"defaultValue": { "$ref": "#/$defs/defaultValue" },
|
|
214
|
+
"description": { "type": "string" },
|
|
215
|
+
"params": {
|
|
216
|
+
"type": "array",
|
|
217
|
+
"items": { "$ref": "#/$defs/propParam" }
|
|
218
|
+
},
|
|
219
|
+
"returnType": { "type": "string" },
|
|
220
|
+
"isFunction": { "type": "boolean" },
|
|
221
|
+
"isFunctionDeclaration": { "type": "boolean" },
|
|
222
|
+
"isRequired": { "type": "boolean" },
|
|
223
|
+
"reactive": { "type": "boolean" },
|
|
224
|
+
"binding": {
|
|
225
|
+
"enum": ["readonly", "writable"]
|
|
226
|
+
},
|
|
227
|
+
"bindable": {
|
|
228
|
+
"const": true,
|
|
229
|
+
"description": "Present only when the prop is explicitly declared with Svelte 5 $bindable()."
|
|
230
|
+
},
|
|
231
|
+
"deprecated": { "$ref": "#/$defs/deprecated" },
|
|
232
|
+
"tags": {
|
|
233
|
+
"type": "array",
|
|
234
|
+
"items": { "$ref": "#/$defs/jsdocTag" }
|
|
235
|
+
},
|
|
236
|
+
"source": { "$ref": "#/$defs/sourceRange" }
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"defaultValue": {
|
|
240
|
+
"type": "object",
|
|
241
|
+
"required": ["raw", "kind"],
|
|
242
|
+
"additionalProperties": false,
|
|
243
|
+
"properties": {
|
|
244
|
+
"raw": { "type": "string" },
|
|
245
|
+
"kind": {
|
|
246
|
+
"enum": ["literal", "array", "object", "expression", "function", "unknown"]
|
|
247
|
+
},
|
|
248
|
+
"value": {
|
|
249
|
+
"description": "Parsed JSON-safe value for literals, arrays, and plain objects when statically available."
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"propParam": {
|
|
254
|
+
"type": "object",
|
|
255
|
+
"required": ["name", "type"],
|
|
256
|
+
"additionalProperties": false,
|
|
257
|
+
"properties": {
|
|
258
|
+
"name": { "type": "string" },
|
|
259
|
+
"type": { "type": "string" },
|
|
260
|
+
"description": { "type": "string" },
|
|
261
|
+
"optional": { "type": "boolean" }
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"slot": {
|
|
265
|
+
"type": "object",
|
|
266
|
+
"required": ["default"],
|
|
267
|
+
"additionalProperties": false,
|
|
268
|
+
"properties": {
|
|
269
|
+
"name": {
|
|
270
|
+
"type": ["string", "null"]
|
|
271
|
+
},
|
|
272
|
+
"default": { "type": "boolean" },
|
|
273
|
+
"fallback": { "type": "string" },
|
|
274
|
+
"slot_props": { "type": "string" },
|
|
275
|
+
"description": { "type": "string" },
|
|
276
|
+
"deprecated": { "$ref": "#/$defs/deprecated" },
|
|
277
|
+
"tags": {
|
|
278
|
+
"type": "array",
|
|
279
|
+
"items": { "$ref": "#/$defs/jsdocTag" }
|
|
280
|
+
},
|
|
281
|
+
"source": { "$ref": "#/$defs/sourceRange" }
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"jsdocTag": {
|
|
285
|
+
"type": "object",
|
|
286
|
+
"required": ["name", "body"],
|
|
287
|
+
"additionalProperties": false,
|
|
288
|
+
"properties": {
|
|
289
|
+
"name": { "type": "string" },
|
|
290
|
+
"body": { "type": "string" }
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"event": {
|
|
294
|
+
"oneOf": [{ "$ref": "#/$defs/forwardedEvent" }, { "$ref": "#/$defs/dispatchedEvent" }]
|
|
295
|
+
},
|
|
296
|
+
"forwardedEvent": {
|
|
297
|
+
"type": "object",
|
|
298
|
+
"required": ["type", "name", "element"],
|
|
299
|
+
"additionalProperties": false,
|
|
300
|
+
"properties": {
|
|
301
|
+
"type": { "const": "forwarded" },
|
|
302
|
+
"name": { "type": "string" },
|
|
303
|
+
"element": { "type": "string" },
|
|
304
|
+
"description": { "type": "string" },
|
|
305
|
+
"deprecated": { "$ref": "#/$defs/deprecated" },
|
|
306
|
+
"detail": { "type": "string" },
|
|
307
|
+
"tags": {
|
|
308
|
+
"type": "array",
|
|
309
|
+
"items": { "$ref": "#/$defs/jsdocTag" }
|
|
310
|
+
},
|
|
311
|
+
"source": { "$ref": "#/$defs/sourceRange" }
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
"dispatchedEvent": {
|
|
315
|
+
"type": "object",
|
|
316
|
+
"required": ["type", "name"],
|
|
317
|
+
"additionalProperties": false,
|
|
318
|
+
"properties": {
|
|
319
|
+
"type": { "const": "dispatched" },
|
|
320
|
+
"name": { "type": "string" },
|
|
321
|
+
"detail": { "type": "string" },
|
|
322
|
+
"description": { "type": "string" },
|
|
323
|
+
"deprecated": { "$ref": "#/$defs/deprecated" },
|
|
324
|
+
"tags": {
|
|
325
|
+
"type": "array",
|
|
326
|
+
"items": { "$ref": "#/$defs/jsdocTag" }
|
|
327
|
+
},
|
|
328
|
+
"source": { "$ref": "#/$defs/sourceRange" }
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
"typedef": {
|
|
332
|
+
"type": "object",
|
|
333
|
+
"required": ["type", "name", "ts"],
|
|
334
|
+
"additionalProperties": false,
|
|
335
|
+
"properties": {
|
|
336
|
+
"type": { "type": "string" },
|
|
337
|
+
"name": { "type": "string" },
|
|
338
|
+
"description": { "type": "string" },
|
|
339
|
+
"ts": { "type": "string" },
|
|
340
|
+
"tags": {
|
|
341
|
+
"type": "array",
|
|
342
|
+
"items": { "$ref": "#/$defs/jsdocTag" }
|
|
343
|
+
},
|
|
344
|
+
"source": { "$ref": "#/$defs/sourceRange" }
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"context": {
|
|
348
|
+
"type": "object",
|
|
349
|
+
"required": ["key", "typeName", "properties"],
|
|
350
|
+
"additionalProperties": false,
|
|
351
|
+
"properties": {
|
|
352
|
+
"key": { "type": "string" },
|
|
353
|
+
"typeName": { "type": "string" },
|
|
354
|
+
"description": { "type": "string" },
|
|
355
|
+
"properties": {
|
|
356
|
+
"type": "array",
|
|
357
|
+
"items": { "$ref": "#/$defs/contextProperty" }
|
|
358
|
+
},
|
|
359
|
+
"hasUnresolvedSpread": {
|
|
360
|
+
"type": "boolean",
|
|
361
|
+
"description": "True when a {...spread} in the context's object literal couldn't be resolved; the generated type intersects with Record<string, any>."
|
|
362
|
+
},
|
|
363
|
+
"source": { "$ref": "#/$defs/sourceRange" }
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
"contextProperty": {
|
|
367
|
+
"type": "object",
|
|
368
|
+
"required": ["name", "type", "optional"],
|
|
369
|
+
"additionalProperties": false,
|
|
370
|
+
"properties": {
|
|
371
|
+
"name": { "type": "string" },
|
|
372
|
+
"type": { "type": "string" },
|
|
373
|
+
"description": { "type": "string" },
|
|
374
|
+
"optional": { "type": "boolean" }
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
"restProp": {
|
|
378
|
+
"oneOf": [{ "$ref": "#/$defs/elementRestProp" }, { "$ref": "#/$defs/inlineComponentRestProp" }]
|
|
379
|
+
},
|
|
380
|
+
"elementRestProp": {
|
|
381
|
+
"type": "object",
|
|
382
|
+
"required": ["type", "name"],
|
|
383
|
+
"additionalProperties": false,
|
|
384
|
+
"properties": {
|
|
385
|
+
"type": { "const": "Element" },
|
|
386
|
+
"name": { "type": "string" },
|
|
387
|
+
"thisValue": { "type": "string" },
|
|
388
|
+
"description": { "type": "string" }
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
"inlineComponentRestProp": {
|
|
392
|
+
"type": "object",
|
|
393
|
+
"required": ["type", "name"],
|
|
394
|
+
"additionalProperties": false,
|
|
395
|
+
"properties": {
|
|
396
|
+
"type": { "const": "InlineComponent" },
|
|
397
|
+
"name": { "type": "string" }
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
"extends": {
|
|
401
|
+
"type": "object",
|
|
402
|
+
"required": ["interface", "import"],
|
|
403
|
+
"additionalProperties": false,
|
|
404
|
+
"properties": {
|
|
405
|
+
"interface": { "type": "string" },
|
|
406
|
+
"import": { "type": "string" }
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
"entryExport": {
|
|
410
|
+
"type": "object",
|
|
411
|
+
"required": ["name", "kind", "isTypeOnly"],
|
|
412
|
+
"additionalProperties": false,
|
|
413
|
+
"properties": {
|
|
414
|
+
"name": { "type": "string" },
|
|
415
|
+
"kind": {
|
|
416
|
+
"enum": ["const", "let", "var", "function", "class", "type", "interface", "enum"]
|
|
417
|
+
},
|
|
418
|
+
"type": { "type": "string" },
|
|
419
|
+
"value": { "type": "string" },
|
|
420
|
+
"description": { "type": "string" },
|
|
421
|
+
"deprecated": { "$ref": "#/$defs/deprecated" },
|
|
422
|
+
"tags": {
|
|
423
|
+
"type": "array",
|
|
424
|
+
"items": { "$ref": "#/$defs/jsdocTag" }
|
|
425
|
+
},
|
|
426
|
+
"source": { "type": "string" },
|
|
427
|
+
"isTypeOnly": { "type": "boolean" }
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|