@stacksjs/stx-vscode 0.2.710 → 0.2.713
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.
|
@@ -75,6 +75,7 @@ declare module 'stx' {
|
|
|
75
75
|
export const state: typeof globalThis.state
|
|
76
76
|
export const untrack: typeof globalThis.untrack
|
|
77
77
|
export const useAsync: typeof globalThis.useAsync
|
|
78
|
+
export const useBroadcastStream: typeof globalThis.useBroadcastStream
|
|
78
79
|
export const useClickOutside: typeof globalThis.useClickOutside
|
|
79
80
|
export const useColorMode: typeof globalThis.useColorMode
|
|
80
81
|
export const useCookie: typeof globalThis.useCookie
|
|
@@ -469,6 +469,7 @@ declare function useTimeout(_fn: () => void, _ms?: number): {
|
|
|
469
469
|
subscribe: (_fn: (_pending: boolean) => void) => () => void
|
|
470
470
|
}
|
|
471
471
|
declare const useTimeoutFn: typeof useTimeout
|
|
472
|
+
declare const useBroadcastStream: typeof import('@stacksjs/stx').useBroadcastStream
|
|
472
473
|
declare function nextTick(_fn?: () => void): Promise<void>
|
|
473
474
|
|
|
474
475
|
// ============================================================================
|
|
@@ -782,6 +783,7 @@ declare function withDefaults<T extends Record<string, any>>(_props: T, _default
|
|
|
782
783
|
* @example
|
|
783
784
|
* const emit = defineEmits<{ view: [record: Row], remove: [id: number] }>()
|
|
784
785
|
*/
|
|
786
|
+
declare function defineEmits(_events: readonly string[]): (_event: string, ..._args: unknown[]) => void
|
|
785
787
|
declare function defineEmits<T extends string = string>(): (_event: T, ..._args: unknown[]) => void
|
|
786
788
|
declare function defineEmits<T extends Record<string, unknown[]>>(): <K extends keyof T & string>(_event: K, ..._args: T[K]) => void
|
|
787
789
|
declare function defineExpose<T extends Record<string, any>>(_exposed: T): void
|
|
@@ -7,7 +7,7 @@ var wt=Object.create;var{getPrototypeOf:vt,defineProperty:ve,getOwnPropertyNames
|
|
|
7
7
|
`?`
|
|
8
8
|
`:" ",t++}s+=" ",t++,n=K,i="";continue}if(r==="/"&&$e(n,i)){let a=Te(e,t);if(a!==-1){s+=`/${" ".repeat(a-t-2)}/`,t=a,n=K,i="";continue}}if(r==="`"){s+=" ",t++;while(t<e.length&&e[t]!=="`"){if(e[t]==="\\"){s+=" ",t+=2;continue}if(e[t]==="$"&&e[t+1]==="{"){let a=t+2,c=_e(e,a);if(s+=" ",s+=L(e.slice(a,c)),c<e.length)s+=" ";t=c+1;continue}s+=e[t]===`
|
|
9
9
|
`?`
|
|
10
|
-
`:" ",t++}s+=" ",t++,n=K,i="";continue}if(s+=r,t++,/[\w$]/.test(r))i=/[\w$]/.test(n)?i+r:r,n=r;else if(!/\s/.test(r))n=r,i=""}return s}function Q(e){let s=new Uint16Array(e.length),t=0,n=!0;for(let i=0;i<e.length;i++){let o=e[i];if(o===")"||o==="]"||o==="}")if(t===0)n=!1;else t--;if(s[i]=t,o==="("||o==="["||o==="{")t++}return{depths:s,balanced:n&&t===0}}function Ce(e){let s=e.indexOf(" as ");if(s!==-1){let o=e.slice(0,s).trim(),r=e.slice(s+4).trim();return o&&r?{arrayExpr:o,itemVar:r}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let n=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),i=t[2].trim();return n&&i?{arrayExpr:i,itemVar:n}:null}var H=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"];var Rt=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var kn=H.filter((e)=>!Rt.includes(e));var Dt=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],Pt=["x-init","x-transition","x-effect","x-on"],An=[...Dt,...Pt];var J=G(require("node:fs"),1),z=G(require("node:path"),1);function ke(e,s,t,n){let i=0;for(let o=s;o<e.length;o++)if(e[o]===t)i++;else if(e[o]===n&&!(n===">"&&e[o-1]==="=")){if(--i===0)return o}return-1}function It(e){let s=L(e),t=0,n=0,i=[];for(let o=0;o<s.length;o++)if("([{".includes(s[o]))t++;else if(")]}".includes(s[o]))t--;else if(s[o]===","&&t===0)i.push(e.slice(n,o).trim()),n=o+1;return i.push(e.slice(n).trim()),i}function ce(e,s){let t=L(e),n=new RegExp(`\\b(?:${s.map((i)=>i.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let i of t.matchAll(n)){let o=i.index+i[0].length,r="";if(t[o]==="<"){let c=ke(t,o,"<",">");if(c<0)continue;r=e.slice(o+1,c),o=c+1;while(/\s/.test(t[o]||"")&&o<t.length)o++}if(t[o]!=="(")continue;let a=ke(t,o,"(",")");if(a>=0)return{type:r,args:It(e.slice(o+1,a))}}return null}var Ae=`
|
|
10
|
+
`:" ",t++}s+=" ",t++,n=K,i="";continue}if(s+=r,t++,/[\w$]/.test(r))i=/[\w$]/.test(n)?i+r:r,n=r;else if(!/\s/.test(r))n=r,i=""}return s}function Q(e){let s=new Uint16Array(e.length),t=0,n=!0;for(let i=0;i<e.length;i++){let o=e[i];if(o===")"||o==="]"||o==="}")if(t===0)n=!1;else t--;if(s[i]=t,o==="("||o==="["||o==="{")t++}return{depths:s,balanced:n&&t===0}}function Ce(e){let s=e.indexOf(" as ");if(s!==-1){let o=e.slice(0,s).trim(),r=e.slice(s+4).trim();return o&&r?{arrayExpr:o,itemVar:r}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let n=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),i=t[2].trim();return n&&i?{arrayExpr:i,itemVar:n}:null}var H=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"];var Rt=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var kn=H.filter((e)=>!Rt.includes(e));var Dt=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],Pt=["x-init","x-transition","x-effect","x-on"],An=[...Dt,...Pt];var J=G(require("node:fs"),1),z=G(require("node:path"),1);function ke(e,s,t,n){let i=0;for(let o=s;o<e.length;o++)if(e[o]===t)i++;else if(e[o]===n&&!(n===">"&&e[o-1]==="=")){if(--i===0)return o}return-1}function It(e){let s=L(e),t=0,n=0,i=[];for(let o=0;o<s.length;o++)if("([{".includes(s[o]))t++;else if(")]}".includes(s[o]))t--;else if(s[o]===","&&t===0)i.push(e.slice(n,o).trim()),n=o+1;return i.push(e.slice(n).trim()),i}function ce(e,s){let t=L(e),n=new RegExp(`\\b(?:${s.map((i)=>i.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let i of t.matchAll(n)){let o=i.index+i[0].length,r="";if(t[o]==="<"){let c=ke(t,o,"<",">");if(c<0)continue;r=e.slice(o+1,c),o=c+1;while(/\s/.test(t[o]||"")&&o<t.length)o++}if(t[o]!=="(")continue;let a=ke(t,o,"(",")");if(a>=0)return{type:r,args:It(e.slice(o+1,a))}}return null}var Ae=`
|
|
11
11
|
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
12
12
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
13
13
|
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
@@ -22,7 +22,7 @@ namespace ${s} {
|
|
|
22
22
|
${o}
|
|
23
23
|
${u.join(`
|
|
24
24
|
`)}
|
|
25
|
-
}`,props:p,events:m}}var Z=G(require("node:fs"),1),A=G(require("node:path"),1);function Pe(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var De=new Map;function Ie(e,s=!0){let t=De.get(e);if(s&&t)return t;let n=new Map,i=[A.default.join(e,"src"),A.default.join(e,"dist"),e];function o(r,a){if(a>6)return;let c;try{c=Z.default.readdirSync(r,{withFileTypes:!0})}catch{return}for(let u of c){let p=A.default.join(r,u.name);if(u.isDirectory()){if(u.name==="node_modules"||u.name.startsWith("."))continue;o(p,a+1)}else if(u.isFile()&&u.name.endsWith(".stx")){let m=u.name.slice(0,-4);if(!n.has(m))n.set(m,p);let g=m.toLowerCase();if(!n.has(g))n.set(g,p);let S=Pe(m);if(!n.has(S))n.set(S,p)}}}for(let r of i)if(o(r,0),n.size>0)break;if(s)De.set(e,n);return n}function Le(e,s){if(e.startsWith(".")||e.startsWith("/"))return null;let t=s;while(!0){let n=A.default.join(t,"node_modules",e);try{if(Z.default.statSync(n).isDirectory())return n}catch{}let i=A.default.dirname(t);if(i===t)return null;t=i}}function Oe(e,s,t={}){return[A.default.resolve(A.default.dirname(s),`${e}.stx`),A.default.resolve(A.default.dirname(s),e),A.default.resolve(t.componentsDir||"components",`${e}.stx`),A.default.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Me(e){let s=e.endsWith(".stx")?e.slice(0,-4):e,t=s.split("-").map((i)=>i.charAt(0).toUpperCase()+i.slice(1)).join(""),n=Pe(s);return[s,t,n]}function Lt(e,s){let[t,n,i]=Me(e);for(let o of[t,t.toLowerCase(),n,i]){let r=s?.__importedComponents?.get(o);if(r!==void 0)return r}}function*Ot(e,s,t={},n){let i=Me(e);if(i[0].startsWith("./")||i[0].startsWith("../")){yield A.default.resolve(A.default.dirname(s),`${i[0]}.stx`);return}let o=[...new Set(i.map((c)=>`${c}.stx`))],r=t.projectRoot||process.cwd(),a=[...n?.__originalFilePath?[A.default.join(A.default.dirname(n.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],A.default.join(A.default.dirname(s),"components"),A.default.resolve(r,"src/components"),A.default.resolve(r,"components"),A.default.resolve("/home/runner/work/stx/stx/packages/stx/src","components")];for(let c of new Set(a)){for(let u of o)yield A.default.join(c,u);try{for(let u of Z.default.readdirSync(c,{withFileTypes:!0}))if(u.isDirectory())for(let p of o)yield A.default.join(c,u.name,p)}catch{}}}function Ne(e,s,t={},n){let i=Lt(e,n);if(i!==void 0)return i;for(let o of Ot(e,s,t,n))try{if(Z.default.statSync(o,{throwIfNoEntry:!1})?.isFile())return o}catch{}return null}var je=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function Be(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...je].some((s)=>s.toLowerCase()===e.toLowerCase());return je.has(e)||/[A-Z]/.test(e)}function*Mt(e){let s=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,t;while(t=s.exec(e)){let n=s.lastIndex,i=[];while(n<e.length){while(/\s/.test(e[n]||""))n++;if(e[n]===">"||e.slice(n,n+2)==="/>"){n+=e[n]===">"?1:2;break}let o=/^[^\s=/>]+/.exec(e.slice(n))?.[0];if(!o){n++;continue}let r=n;n+=o.length;while(/\s/.test(e[n]||""))n++;if(e[n]!=="="){i.push({name:o,value:!0,offset:r,braced:!1});continue}n++;while(/\s/.test(e[n]||""))n++;let a=e[n],c=a==="{",u=a==='"'||a==="'";if(u||c)n++;let p=n;if(c){let m=L(e.slice(n)),g=1,S=0;for(;S<m.length;S++){if(m[S]==="{")g++;if(m[S]==="}"&&--g===0)break}n+=S}else if(u)while(n<e.length&&e[n]!==a)n++;else while(n<e.length&&!/[\s/>]/.test(e[n]))n++;if(i.push({name:o,value:e.slice(p,n),offset:p,braced:c}),u||c)n++}s.lastIndex=n,yield{name:t[1],offset:t.index,attributes:i}}}function Fe(e,s,t){let n=[],i=[Ae,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],o=new Map,r=new Map,a=new Map,c=t.scriptCode(e,t.filePath),u=L(c);for(let w of c.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(u.slice(w.index,w.index+6)!=="import")continue;let b=w[2],v=z.default.isAbsolute(b)||b.startsWith(".")?z.default.resolve(z.default.dirname(t.filePath),b):Le(b,z.default.dirname(t.filePath));if(!v)continue;let k=v.endsWith(".stx")?v:J.default.existsSync(`${v}.stx`)?`${v}.stx`:void 0,y=k?null:Ie(v,!1),_=w[1].startsWith("{")?w[1].slice(1,-1).split(","):[w[1]];for(let C of _){let[O,T=O]=C.trim().split(/\s+as\s+/),N=k||y?.get(O)||y?.get(O.toLowerCase());if(N)a.set(T,N),a.set(T.toLowerCase(),N),a.set(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),N)}}for(let w of s.matchAll(/@import\s*\(([^)]+)\)/g))for(let b of w[1].matchAll(/['"]([^'"]+)['"]/g)){let v=Oe(b[1],t.filePath,t).find((k)=>J.default.statSync(k,{throwIfNoEntry:!1})?.isFile());if(v)a.set(z.default.basename(b[1]).replace(/\.stx$/,""),v)}let p={__importedComponents:a},m=new Map,g=(w,b,v)=>{let k=e.slice(0,w);return{code:b,offset:w,attribute:v,anchor:!0,kind:"directive",line:k.split(`
|
|
25
|
+
}`,props:p,events:m}}var Z=G(require("node:fs"),1),A=G(require("node:path"),1);function Pe(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var De=new Map;function Ie(e,s=!0){let t=De.get(e);if(s&&t)return t;let n=new Map,i=[A.default.join(e,"src"),A.default.join(e,"dist"),e];function o(r,a){if(a>6)return;let c;try{c=Z.default.readdirSync(r,{withFileTypes:!0})}catch{return}for(let u of c){let p=A.default.join(r,u.name);if(u.isDirectory()){if(u.name==="node_modules"||u.name.startsWith("."))continue;o(p,a+1)}else if(u.isFile()&&u.name.endsWith(".stx")){let m=u.name.slice(0,-4);if(!n.has(m))n.set(m,p);let g=m.toLowerCase();if(!n.has(g))n.set(g,p);let S=Pe(m);if(!n.has(S))n.set(S,p)}}}for(let r of i)if(o(r,0),n.size>0)break;if(s)De.set(e,n);return n}function Le(e,s){if(e.startsWith(".")||e.startsWith("/"))return null;let t=s;while(!0){let n=A.default.join(t,"node_modules",e);try{if(Z.default.statSync(n).isDirectory())return n}catch{}let i=A.default.dirname(t);if(i===t)return null;t=i}}function Oe(e,s,t={}){return[A.default.resolve(A.default.dirname(s),`${e}.stx`),A.default.resolve(A.default.dirname(s),e),A.default.resolve(t.componentsDir||"components",`${e}.stx`),A.default.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Me(e){let s=e.endsWith(".stx")?e.slice(0,-4):e,t=s.split("-").map((i)=>i.charAt(0).toUpperCase()+i.slice(1)).join(""),n=Pe(s);return[s,t,n]}function Lt(e,s){let[t,n,i]=Me(e);for(let o of[t,t.toLowerCase(),n,i]){let r=s?.__importedComponents?.get(o);if(r!==void 0)return r}}function*Ot(e,s,t={},n){let i=Me(e);if(i[0].startsWith("./")||i[0].startsWith("../")){yield A.default.resolve(A.default.dirname(s),`${i[0]}.stx`);return}let o=[...new Set(i.map((c)=>`${c}.stx`))],r=t.projectRoot||process.cwd(),a=[...n?.__originalFilePath?[A.default.join(A.default.dirname(n.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],A.default.join(A.default.dirname(s),"components"),A.default.resolve(r,"src/components"),A.default.resolve(r,"components"),A.default.resolve("/home/runner/work/stx/stx/packages/stx/src","components")];for(let c of new Set(a)){for(let u of o)yield A.default.join(c,u);try{for(let u of Z.default.readdirSync(c,{withFileTypes:!0}))if(u.isDirectory())for(let p of o)yield A.default.join(c,u.name,p)}catch{}}}function Ne(e,s,t={},n){let i=Lt(e,n);if(i!==void 0)return i;for(let o of Ot(e,s,t,n))try{if(Z.default.statSync(o,{throwIfNoEntry:!1})?.isFile())return o}catch{}return null}var je=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function Be(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...je].some((s)=>s.toLowerCase()===e.toLowerCase());return je.has(e)||/[A-Z]/.test(e)}function*Mt(e){let s=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,t;while(t=s.exec(e)){let n=s.lastIndex,i=[];while(n<e.length){while(/\s/.test(e[n]||""))n++;if(e[n]===">"||e.slice(n,n+2)==="/>"){n+=e[n]===">"?1:2;break}let o=/^[^\s=/>]+/.exec(e.slice(n))?.[0];if(!o){n++;continue}let r=n;n+=o.length;while(/\s/.test(e[n]||""))n++;if(e[n]!=="="){i.push({name:o,value:!0,offset:r,braced:!1});continue}n++;while(/\s/.test(e[n]||""))n++;let a=e[n],c=a==="{",u=a==='"'||a==="'";if(u||c)n++;let p=n;if(c){let m=L(e.slice(n)),g=1,S=0;for(;S<m.length;S++){if(m[S]==="{")g++;if(m[S]==="}"&&--g===0)break}n+=S}else if(u)while(n<e.length&&e[n]!==a)n++;else while(n<e.length&&!/[\s/>]/.test(e[n]))n++;if(i.push({name:o,value:e.slice(p,n),offset:p,braced:c}),u||c)n++}s.lastIndex=n,yield{name:t[1],offset:t.index,attributes:i}}}function Fe(e,s,t){let n=[],i=[Ae,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],o=new Map,r=new Map,a=new Map,c=t.scriptCode(e,t.filePath),u=L(c);for(let w of c.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(u.slice(w.index,w.index+6)!=="import")continue;let b=w[2],v=z.default.isAbsolute(b)||b.startsWith(".")?z.default.resolve(z.default.dirname(t.filePath),b):Le(b,z.default.dirname(t.filePath));if(!v)continue;let k=v.endsWith(".stx")?v:J.default.existsSync(`${v}.stx`)?`${v}.stx`:void 0,y=k?null:Ie(v,!1),_=w[1].startsWith("{")?w[1].slice(1,-1).split(","):[w[1]];for(let C of _){let[O,T=O]=C.trim().split(/\s+as\s+/),N=k||y?.get(O)||y?.get(O.toLowerCase());if(N)a.set(T,N),a.set(T.toLowerCase(),N),a.set(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),N)}}for(let w of s.matchAll(/@import\s*\(([^)]+)\)/g))for(let b of w[1].matchAll(/['"]([^'"]+)['"]/g)){let v=Oe(b[1],t.filePath,t).find((k)=>J.default.statSync(k,{throwIfNoEntry:!1})?.isFile());if(v)a.set(z.default.basename(b[1]).replace(/\.stx$/,""),v)}let p={__importedComponents:a},m=new Map,g=(w,b,v)=>{let k=e.slice(0,w);return{code:b,offset:w,attribute:v,anchor:!0,kind:"directive",line:k.split(`
|
|
26
26
|
`).length,column:w-k.lastIndexOf(`
|
|
27
27
|
`)}},S=(w,b,v)=>n.push({expression:w,statement:{text:b+w.code+v,prefixLength:b.length}});for(let w of Mt(s)){if(Be(w.name)||w.name==="component")continue;let b=Ne(w.name,t.filePath,t,p);if(!b)continue;let v=m.get(b);if(!v){let y;try{y=t.readComponent?t.readComponent(b):J.default.readFileSync(b,"utf8")}catch{continue}if(y===void 0)continue;r.set(b,y),v=Re(t.scriptCode(y,b),`__StxComponent${m.size}`),m.set(b,v),i.push(v.declarations)}let k=[];for(let y of w.attributes){let{name:_,offset:C}=y,O=y.value===!0?"true":y.value;if(_.startsWith("@")||_.startsWith("v-on:")){if(v.events&&y.value!==!0)o.set(C,`__StxEvent<${v.events}, ${JSON.stringify(_.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let T=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(_);if(_.startsWith("v-")&&!_.startsWith("v-bind:")&&!T)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(_))continue;let N=(T?T[1]||"modelValue":_.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(M,j)=>j.toUpperCase());if(k.push(N),!v.props)continue;let P=_.startsWith(":")||_.startsWith("v-bind:")||!!T||y.braced?O:y.value!==!0?JSON.stringify(O):"true";S(g(C,P,_),";void ((",`) satisfies __StxProp<${v.props}, ${JSON.stringify(N)}>);`)}if(v.props){let y=[...new Set(k)].map((C)=>`${JSON.stringify(C)}: undefined as any`).join(", "),_=g(w.offset,`<${w.name}>`);n.push({expression:_,statement:{text:`;void ({ ${y} } satisfies ${v.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:m.size?i.join(`
|
|
28
28
|
`):"",checks:n,events:o,dependencies:r}}function Ve(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let s=[],t=[],n=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let i of e.matchAll(n)){let o=i[0];if(/^<\/template\s*>$/i.test(o)){let r=t.pop();if(r)r.end=i.index}else if(/^<template\b/i.test(o)&&!/\/\s*>$/.test(o)){let a=[...o.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((p)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(p[1])),c=(a?.[2]??a?.[3])?.trim();if(c&&a?.[1]==="data-stx-slot-binding")try{c=decodeURIComponent(c)}catch{c=void 0}let u=c?{start:i.index+o.length,end:e.length,binding:c}:void 0;if(t.push(u),u)s.push(u)}}return s}var We=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Nt(e){let s=(t)=>t.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,s).replace(/\{\{--[\s\S]*?--\}\}/g,s)}function te(e){let s=[],t=Nt(e);We.lastIndex=0;let n;while((n=We.exec(t))!==null){let i=(n[1]||"").trim(),o=(n[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,r=(n[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,a=n.index+o,c=n.index+n[0].length-r,u=e.slice(a,c);if(/\bsrc\s*=/.test(i))continue;let p=i.match(/\btype\s*=\s*["']([^"']+)["']/i);if(p&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(p[1]))continue;let m=/\bserver\b/.test(i)?"server":/\bclient\b/.test(i)?"client":"plain",g=U(e,a);s.push({kind:m,code:u,startLine:g,startColumn:q(e,a),offset:a,attrs:i})}return s}function U(e,s){let t=1;for(let n=0;n<s&&n<e.length;n++)if(e.charCodeAt(n)===10)t++;return t}function q(e,s){let t=e.lastIndexOf(`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx-vscode",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.713",
|
|
5
5
|
"description": "stx language support for VS Code extensions to embed: the hovers, completions, diagnostics, grammar, snippets, language configuration and TypeScript server plugin behind the stx extension.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|