@pure-ds/core 0.7.4 → 0.7.6
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/.cursorrules +21 -0
- package/.github/copilot-instructions.md +21 -0
- package/dist/types/public/assets/js/pds-ask.d.ts +1 -2
- package/dist/types/public/assets/js/pds-ask.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-autocomplete.d.ts +36 -25
- package/dist/types/public/assets/js/pds-autocomplete.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-enhancers.d.ts +4 -4
- package/dist/types/public/assets/js/pds-enhancers.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-manager.d.ts +159 -444
- package/dist/types/public/assets/js/pds-manager.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-toast.d.ts +6 -7
- package/dist/types/public/assets/js/pds-toast.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds.d.ts +3 -4
- package/dist/types/public/assets/js/pds.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-start-helpers.d.ts.map +1 -1
- package/package.json +8 -2
- package/packages/pds-cli/bin/pds-bootstrap.js +1 -1
- package/packages/pds-cli/bin/pds-import.js +1 -1
- package/packages/pds-cli/bin/pds-mcp-eval.js +79 -0
- package/packages/pds-cli/bin/pds-mcp-health.js +128 -0
- package/packages/pds-cli/bin/pds-mcp-server.js +140 -0
- package/packages/pds-cli/bin/pds-setup-mcp.js +72 -0
- package/packages/pds-cli/lib/pds-mcp-core.js +497 -0
- package/packages/pds-cli/lib/pds-mcp-eval-cases.json +72 -0
- package/public/assets/js/app.js +2 -2
- package/public/assets/js/pds-manager.js +25 -25
- package/public/assets/js/pds.js +2 -2
- package/public/assets/pds/core/pds-manager.js +25 -25
- package/public/assets/pds/core.js +2 -2
- package/readme.md +44 -2
- package/src/js/pds-core/pds-start-helpers.js +0 -20
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var De=Object.defineProperty;var Pe=(e,t)=>{for(var n in t)De(e,n,{get:t[n],enumerable:!0})};var Z=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t}}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(n){console.error(`[PDS Registry] Failed to load static ${t}:`,n),console.error(`[PDS Registry] Looking for: ${this._staticPaths[t]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let r=new CSSStyleSheet;return r.replaceSync("/* Failed to load "+t+" */"),r}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},T=new Z;async function de(e,t=[],n=null){try{let r=n?.primitivesStylesheet?n.primitivesStylesheet:await T.getStylesheet("primitives");e.adoptedStyleSheets=[r,...t]}catch(r){let l=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${l}> failed to adopt primitives:`,r),e.adoptedStyleSheets=t}}async function pe(e,t=["primitives"],n=[],r=null){try{let s=(await Promise.all(t.map(async c=>{if(r)switch(c){case"tokens":return r.tokensStylesheet;case"primitives":return r.primitivesStylesheet;case"components":return r.componentsStylesheet;case"utilities":return r.utilitiesStylesheet;default:break}return T.getStylesheet(c)}))).filter(c=>c!==null);e.adoptedStyleSheets=[...s,...n]}catch(l){let s=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${s}> failed to adopt layers:`,l),e.adoptedStyleSheets=n}}function fe(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var me={FontWeights:{light:300,normal:400,medium:500,semibold:600,bold:700},LineHeights:{tight:1.25,normal:1.5,relaxed:1.75},BorderWidths:{hairline:.5,thin:1,medium:2,thick:3},RadiusSizes:{none:0,small:4,medium:8,large:16,xlarge:24,xxlarge:32},ShadowDepths:{none:"none",light:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",medium:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",deep:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",extreme:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},TransitionSpeeds:{fast:150,normal:250,slow:350},AnimationEasings:{linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},TouchTargetSizes:{compact:36,standard:44,comfortable:48,spacious:56},LinkStyles:{inline:"inline",block:"block",button:"button"},FocusStyles:{ring:"ring",outline:"outline",border:"border",glow:"glow"},TabSizes:{compact:2,standard:4,wide:8},SelectIcons:{chevron:"chevron",arrow:"arrow",caret:"caret",none:"none"},IconSizes:{xs:16,sm:20,md:24,lg:32,xl:48,"2xl":64,"3xl":96}};var te={};Pe(te,{deepMerge:()=>he,fragmentFromTemplateLike:()=>Me,isObject:()=>I,parseHTML:()=>ee});function I(e){return e&&typeof e=="object"&&!Array.isArray(e)}function he(e,t){let n={...e};return I(e)&&I(t)&&Object.keys(t).forEach(r=>{I(t[r])?r in e?n[r]=he(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}function Me(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],r=new Set,l=[],s=/(\s)(\.[\w-]+)=\s*$/;for(let a=0;a<t.length;a+=1){let w=t[a]??"",f=w.match(s);if(f&&a<n.length){let g=f[2].slice(1),L=`pds-val-${a}`;w=w.replace(s,`$1data-pds-prop="${g}:${L}"`),r.add(a)}l.push(w),a<n.length&&!r.has(a)&&l.push(`<!--pds-val-${a}-->`)}let c=document.createElement("template");c.innerHTML=l.join("");let S=(a,w)=>{let f=a.parentNode;if(!f)return;if(w==null){f.removeChild(a);return}let b=g=>{if(g!=null){if(g instanceof Node){f.insertBefore(g,a);return}if(Array.isArray(g)){g.forEach(L=>b(L));return}f.insertBefore(document.createTextNode(String(g)),a)}};b(w),f.removeChild(a)},_=document.createTreeWalker(c.content,NodeFilter.SHOW_COMMENT),m=[];for(;_.nextNode();){let a=_.currentNode;a?.nodeValue?.startsWith("pds-val-")&&m.push(a)}return m.forEach(a=>{let w=Number(a.nodeValue.replace("pds-val-",""));S(a,n[w])}),c.content.querySelectorAll("*").forEach(a=>{let w=a.getAttribute("data-pds-prop");if(!w)return;let[f,b]=w.split(":"),g=Number(String(b).replace("pds-val-",""));f&&Number.isInteger(g)&&(a[f]=n[g]),a.removeAttribute("data-pds-prop")}),c.content}function ee(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes}var we="pds",Te=/^([a-z][a-z0-9+\-.]*:)?\/\//i,ye=/^[a-z]:/i;function C(e=""){return e.endsWith("/")?e:`${e}/`}function Ue(e="",t=we){let n=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(n)?n:`${n}/${t}`}function ke(e){return e.replace(/^\.\/+/,"")}function Ce(e){return ye.test(e)?e.replace(ye,"").replace(/^\/+/,""):e}function je(e){return e.startsWith("public/")?e.substring(7):e}function N(e,t={}){let n=t.segment||we,r=t.defaultRoot||`/assets/${n}/`,l=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!l||typeof l!="string")return C(r);let s=l.trim();return s?(s=s.replace(/\\/g,"/"),s=Ue(s,n),s=C(s),Te.test(s)?s:(s=ke(s),s=Ce(s),s.startsWith("/")||(s=je(s),s.startsWith("/")||(s=`/${s}`),s=s.replace(/\/+/g,(c,S)=>S===0?c:"/")),C(s))):C(r)}async function $e(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let n=e,{baseURL:r,mapper:l=m=>`${m}.js`,onError:s=(m,i)=>console.error(`[defineWebComponents] ${m}:`,i)}=t,c=r?new URL(r,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),S=m=>m.toLowerCase().replace(/(^|-)([a-z])/g,(i,a,w)=>w.toUpperCase()),_=async m=>{try{if(customElements.get(m))return{tag:m,status:"already-defined"};let i=l(m),w=await import(i instanceof URL?i.href:new URL(i,c).href),f=w?.default??w?.[S(m)];if(!f){if(customElements.get(m))return{tag:m,status:"self-defined"};throw new Error(`No export found for ${m}. Expected default export or named export "${S(m)}".`)}return customElements.get(m)?{tag:m,status:"race-already-defined"}:(customElements.define(m,f),{tag:m,status:"defined"})}catch(i){throw s(m,i),i}};return Promise.all(n.map(_))}var z=class{constructor(t={}){let{baseURL:n,mapper:r,onError:l,predicate:s=()=>!0,attributeModule:c="data-module",root:S=document,scanExisting:_=!0,debounceMs:m=16,observeShadows:i=!0,enhancers:a=[],patchAttachShadow:w=!0}=t,f=new Set,b=new Set,g=new Set,L=new Map,R=new WeakMap,A=new WeakMap,E=0,h=!1,y=null,D=u=>{if(!u||!a.length)return;let p=A.get(u);p||(p=new Set,A.set(u,p));for(let d of a)if(!(!d.selector||!d.run)&&!p.has(d.selector))try{u.matches&&u.matches(d.selector)&&(d.run(u),p.add(d.selector))}catch(v){console.warn(`[AutoDefiner] Error applying enhancer for selector "${d.selector}":`,v)}},k=(u,p)=>{if(!h&&!(!u||!u.includes("-"))&&!customElements.get(u)&&!b.has(u)&&!g.has(u)){if(p&&p.getAttribute){let d=p.getAttribute(c);d&&!L.has(u)&&L.set(u,d)}f.add(u),X()}},X=()=>{E||(E=setTimeout(ce,m))},P=u=>{if(u){if(u.nodeType===1){let p=u,d=p.tagName?.toLowerCase();d&&d.includes("-")&&!customElements.get(d)&&s(d,p)&&k(d,p),D(p),i&&p.shadowRoot&&Y(p.shadowRoot)}u.querySelectorAll&&u.querySelectorAll("*").forEach(p=>{let d=p.tagName?.toLowerCase();d&&d.includes("-")&&!customElements.get(d)&&s(d,p)&&k(d,p),D(p),i&&p.shadowRoot&&Y(p.shadowRoot)})}},Y=u=>{if(!u||R.has(u))return;P(u);let p=new MutationObserver(d=>{for(let v of d)v.addedNodes?.forEach(M=>{P(M)}),v.type==="attributes"&&v.target&&P(v.target)});p.observe(u,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[c,...a.map(d=>d.selector).filter(d=>d.startsWith("data-"))]}),R.set(u,p)};async function ce(){if(clearTimeout(E),E=0,!f.size)return;let u=Array.from(f);f.clear(),u.forEach(p=>b.add(p));try{let p=d=>L.get(d)??(r?r(d):`${d}.js`);await $e(...u,{baseURL:n,mapper:p,onError:(d,v)=>{g.add(d),l?.(d,v)}})}catch{}finally{u.forEach(p=>b.delete(p))}}let le=S===document?document.documentElement:S,ue=new MutationObserver(u=>{for(let p of u)p.addedNodes?.forEach(d=>{P(d)}),p.type==="attributes"&&p.target&&P(p.target)});if(ue.observe(le,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[c,...a.map(u=>u.selector).filter(u=>u.startsWith("data-"))]}),i&&w&&Element.prototype.attachShadow){let u=Element.prototype.attachShadow;Element.prototype.attachShadow=function(d){let v=u.call(this,d);if(d&&d.mode==="open"){Y(v);let M=this.tagName?.toLowerCase();M&&M.includes("-")&&!customElements.get(M)&&k(M,this)}return v},y=()=>Element.prototype.attachShadow=u}return _&&P(le),{stop(){h=!0,ue.disconnect(),y&&y(),E&&(clearTimeout(E),E=0),R.forEach(u=>u.disconnect())},flush:ce}}static async define(...t){let n={};t.length&&typeof t[t.length-1]=="object"&&(n=t.pop()||{});let r=t,{baseURL:l,mapper:s=i=>`${i}.js`,onError:c=(i,a)=>console.error(`[defineWebComponents] ${i}:`,a)}=n,S=l?new URL(l,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),_=i=>i.toLowerCase().replace(/(^|-)([a-z])/g,(a,w,f)=>f.toUpperCase()),m=async i=>{try{if(customElements.get(i))return{tag:i,status:"already-defined"};let a=s(i),f=await import(a instanceof URL?a.href:new URL(a,S).href),b=f?.default??f?.[_(i)];if(!b){if(customElements.get(i))return{tag:i,status:"self-defined"};throw new Error(`No export found for ${i}. Expected default export or named export "${_(i)}".`)}return customElements.get(i)?{tag:i,status:"race-already-defined"}:(customElements.define(i,b),{tag:i,status:"defined"})}catch(a){throw c(i,a),a}};return Promise.all(r.map(m))}};var Oe=/^[a-z][a-z0-9+\-.]*:\/\//i,j=(()=>{try{return import.meta.url}catch{return}})(),F=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function W(e,t={}){if(!e||Oe.test(e))return e;let{preferModule:n=!0}=t,r=()=>{if(!j)return null;try{return new URL(e,j).href}catch{return null}},l=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(n?r()||l():l()||r())||e}var ge=(()=>{if(j)try{let e=new URL(j);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",j).href}catch{return}})(),Ee=!1;function Se(e){Ee||typeof document>"u"||(Ee=!0,e.addEventListener("pds:ready",t=>{let n=t.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function be({manageTheme:e,themeStorageKey:t,applyResolvedTheme:n,setupSystemListenerIfNeeded:r}){let l="light",s=null;if(e&&typeof window<"u"){try{s=localStorage.getItem(t)||null}catch{s=null}try{n?.(s),r?.(s)}catch{}s?s==="system"?l=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":l=s:l=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:l,storedTheme:s}}function B(e,{resolvePublicAssetURL:t}){let n=!!(e?.public?.root||e?.static?.root),r=t(e);return!n&&ge&&(r=ge),F(W(r))}async function Le(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:r=[],autoDefineMapper:l=null,enhancers:s=[],autoDefineOverrides:c=null,autoDefinePreferModule:S=!0}=e,_=(()=>{let i=new Map;return(t||[]).forEach(a=>i.set(a.selector,a)),(s||[]).forEach(a=>i.set(a.selector,a)),Array.from(i.values())})(),m=null;if(typeof window<"u"&&typeof document<"u"){let i=z,a=h=>{switch(h){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${h}.js`}},{mapper:w,enhancers:f,...b}=c&&typeof c=="object"?c:{},g=f?Array.isArray(f)?f:typeof f=="object"?Object.values(f):[]:[],L=(()=>{let h=new Map;return(_||[]).forEach(y=>{y?.selector&&h.set(y.selector,y)}),(g||[]).forEach(y=>{if(!y?.selector)return;let D=h.get(y.selector)||null;h.set(y.selector,{...D||{},...y,run:typeof y?.run=="function"?y.run:D?.run})}),Array.from(h.values())})(),A={baseURL:n&&F(W(n,{preferModule:S})),predefine:r,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:L,onError:(h,y)=>{if(typeof h=="string"&&h.startsWith("pds-")){let k=["pds-form","pds-drawer"].includes(h),X=y?.message?.includes("#pds/lit")||y?.message?.includes("Failed to resolve module specifier");k&&X?console.error(`\u274C PDS component <${h}> requires Lit but #pds/lit is not in import map.
|
|
2
|
-
See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):console.warn(`\u26A0\uFE0F PDS component <${
|
|
1
|
+
var De=Object.defineProperty;var Pe=(e,t)=>{for(var n in t)De(e,n,{get:t[n],enumerable:!0})};var Y=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t}}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(n){console.error(`[PDS Registry] Failed to load static ${t}:`,n),console.error(`[PDS Registry] Looking for: ${this._staticPaths[t]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let r=new CSSStyleSheet;return r.replaceSync("/* Failed to load "+t+" */"),r}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},M=new Y;async function ue(e,t=[],n=null){try{let r=n?.primitivesStylesheet?n.primitivesStylesheet:await M.getStylesheet("primitives");e.adoptedStyleSheets=[r,...t]}catch(r){let c=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${c}> failed to adopt primitives:`,r),e.adoptedStyleSheets=t}}async function de(e,t=["primitives"],n=[],r=null){try{let s=(await Promise.all(t.map(async l=>{if(r)switch(l){case"tokens":return r.tokensStylesheet;case"primitives":return r.primitivesStylesheet;case"components":return r.componentsStylesheet;case"utilities":return r.utilitiesStylesheet;default:break}return M.getStylesheet(l)}))).filter(l=>l!==null);e.adoptedStyleSheets=[...s,...n]}catch(c){let s=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${s}> failed to adopt layers:`,c),e.adoptedStyleSheets=n}}function pe(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var fe={FontWeights:{light:300,normal:400,medium:500,semibold:600,bold:700},LineHeights:{tight:1.25,normal:1.5,relaxed:1.75},BorderWidths:{hairline:.5,thin:1,medium:2,thick:3},RadiusSizes:{none:0,small:4,medium:8,large:16,xlarge:24,xxlarge:32},ShadowDepths:{none:"none",light:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",medium:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",deep:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",extreme:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},TransitionSpeeds:{fast:150,normal:250,slow:350},AnimationEasings:{linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},TouchTargetSizes:{compact:36,standard:44,comfortable:48,spacious:56},LinkStyles:{inline:"inline",block:"block",button:"button"},FocusStyles:{ring:"ring",outline:"outline",border:"border",glow:"glow"},TabSizes:{compact:2,standard:4,wide:8},SelectIcons:{chevron:"chevron",arrow:"arrow",caret:"caret",none:"none"},IconSizes:{xs:16,sm:20,md:24,lg:32,xl:48,"2xl":64,"3xl":96}};var ee={};Pe(ee,{deepMerge:()=>me,fragmentFromTemplateLike:()=>Me,isObject:()=>I,parseHTML:()=>Z});function I(e){return e&&typeof e=="object"&&!Array.isArray(e)}function me(e,t){let n={...e};return I(e)&&I(t)&&Object.keys(t).forEach(r=>{I(t[r])?r in e?n[r]=me(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}function Me(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],r=new Set,c=[],s=/(\s)(\.[\w-]+)=\s*$/;for(let a=0;a<t.length;a+=1){let w=t[a]??"",m=w.match(s);if(m&&a<n.length){let S=m[2].slice(1),L=`pds-val-${a}`;w=w.replace(s,`$1data-pds-prop="${S}:${L}"`),r.add(a)}c.push(w),a<n.length&&!r.has(a)&&c.push(`<!--pds-val-${a}-->`)}let l=document.createElement("template");l.innerHTML=c.join("");let g=(a,w)=>{let m=a.parentNode;if(!m)return;if(w==null){m.removeChild(a);return}let E=S=>{if(S!=null){if(S instanceof Node){m.insertBefore(S,a);return}if(Array.isArray(S)){S.forEach(L=>E(L));return}m.insertBefore(document.createTextNode(String(S)),a)}};E(w),m.removeChild(a)},b=document.createTreeWalker(l.content,NodeFilter.SHOW_COMMENT),h=[];for(;b.nextNode();){let a=b.currentNode;a?.nodeValue?.startsWith("pds-val-")&&h.push(a)}return h.forEach(a=>{let w=Number(a.nodeValue.replace("pds-val-",""));g(a,n[w])}),l.content.querySelectorAll("*").forEach(a=>{let w=a.getAttribute("data-pds-prop");if(!w)return;let[m,E]=w.split(":"),S=Number(String(E).replace("pds-val-",""));m&&Number.isInteger(S)&&(a[m]=n[S]),a.removeAttribute("data-pds-prop")}),l.content}function Z(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes}var ye="pds",ke=/^([a-z][a-z0-9+\-.]*:)?\/\//i,he=/^[a-z]:/i;function U(e=""){return e.endsWith("/")?e:`${e}/`}function Te(e="",t=ye){let n=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(n)?n:`${n}/${t}`}function Ue(e){return e.replace(/^\.\/+/,"")}function Ce(e){return he.test(e)?e.replace(he,"").replace(/^\/+/,""):e}function je(e){return e.startsWith("public/")?e.substring(7):e}function N(e,t={}){let n=t.segment||ye,r=t.defaultRoot||`/assets/${n}/`,c=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!c||typeof c!="string")return U(r);let s=c.trim();return s?(s=s.replace(/\\/g,"/"),s=Te(s,n),s=U(s),ke.test(s)?s:(s=Ue(s),s=Ce(s),s.startsWith("/")||(s=je(s),s.startsWith("/")||(s=`/${s}`),s=s.replace(/\/+/g,(l,g)=>g===0?l:"/")),U(s))):U(r)}async function $e(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let n=e,{baseURL:r,mapper:c=h=>`${h}.js`,onError:s=(h,i)=>console.error(`[defineWebComponents] ${h}:`,i)}=t,l=r?new URL(r,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),g=h=>h.toLowerCase().replace(/(^|-)([a-z])/g,(i,a,w)=>w.toUpperCase()),b=async h=>{try{if(customElements.get(h))return{tag:h,status:"already-defined"};let i=c(h),w=await import(i instanceof URL?i.href:new URL(i,l).href),m=w?.default??w?.[g(h)];if(!m){if(customElements.get(h))return{tag:h,status:"self-defined"};throw new Error(`No export found for ${h}. Expected default export or named export "${g(h)}".`)}return customElements.get(h)?{tag:h,status:"race-already-defined"}:(customElements.define(h,m),{tag:h,status:"defined"})}catch(i){throw s(h,i),i}};return Promise.all(n.map(b))}var z=class{constructor(t={}){let{baseURL:n,mapper:r,onError:c,predicate:s=()=>!0,attributeModule:l="data-module",root:g=document,scanExisting:b=!0,debounceMs:h=16,observeShadows:i=!0,enhancers:a=[],patchAttachShadow:w=!0}=t,m=new Set,E=new Set,S=new Set,L=new Map,R=new WeakMap,_=new WeakMap,p=0,y=!1,A=null,O=u=>{if(!u||!a.length)return;let f=_.get(u);f||(f=new Set,_.set(u,f));for(let d of a)if(!(!d.selector||!d.run)&&!f.has(d.selector))try{u.matches&&u.matches(d.selector)&&(d.run(u),f.add(d.selector))}catch(v){console.warn(`[AutoDefiner] Error applying enhancer for selector "${d.selector}":`,v)}},T=(u,f)=>{if(!y&&!(!u||!u.includes("-"))&&!customElements.get(u)&&!E.has(u)&&!S.has(u)){if(f&&f.getAttribute){let d=f.getAttribute(l);d&&!L.has(u)&&L.set(u,d)}m.add(u),xe()}},xe=()=>{p||(p=setTimeout(ie,h))},D=u=>{if(u){if(u.nodeType===1){let f=u,d=f.tagName?.toLowerCase();d&&d.includes("-")&&!customElements.get(d)&&s(d,f)&&T(d,f),O(f),i&&f.shadowRoot&&X(f.shadowRoot)}u.querySelectorAll&&u.querySelectorAll("*").forEach(f=>{let d=f.tagName?.toLowerCase();d&&d.includes("-")&&!customElements.get(d)&&s(d,f)&&T(d,f),O(f),i&&f.shadowRoot&&X(f.shadowRoot)})}},X=u=>{if(!u||R.has(u))return;D(u);let f=new MutationObserver(d=>{for(let v of d)v.addedNodes?.forEach(P=>{D(P)}),v.type==="attributes"&&v.target&&D(v.target)});f.observe(u,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...a.map(d=>d.selector).filter(d=>d.startsWith("data-"))]}),R.set(u,f)};async function ie(){if(clearTimeout(p),p=0,!m.size)return;let u=Array.from(m);m.clear(),u.forEach(f=>E.add(f));try{let f=d=>L.get(d)??(r?r(d):`${d}.js`);await $e(...u,{baseURL:n,mapper:f,onError:(d,v)=>{S.add(d),c?.(d,v)}})}catch{}finally{u.forEach(f=>E.delete(f))}}let ce=g===document?document.documentElement:g,le=new MutationObserver(u=>{for(let f of u)f.addedNodes?.forEach(d=>{D(d)}),f.type==="attributes"&&f.target&&D(f.target)});if(le.observe(ce,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...a.map(u=>u.selector).filter(u=>u.startsWith("data-"))]}),i&&w&&Element.prototype.attachShadow){let u=Element.prototype.attachShadow;Element.prototype.attachShadow=function(d){let v=u.call(this,d);if(d&&d.mode==="open"){X(v);let P=this.tagName?.toLowerCase();P&&P.includes("-")&&!customElements.get(P)&&T(P,this)}return v},A=()=>Element.prototype.attachShadow=u}return b&&D(ce),{stop(){y=!0,le.disconnect(),A&&A(),p&&(clearTimeout(p),p=0),R.forEach(u=>u.disconnect())},flush:ie}}static async define(...t){let n={};t.length&&typeof t[t.length-1]=="object"&&(n=t.pop()||{});let r=t,{baseURL:c,mapper:s=i=>`${i}.js`,onError:l=(i,a)=>console.error(`[defineWebComponents] ${i}:`,a)}=n,g=c?new URL(c,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),b=i=>i.toLowerCase().replace(/(^|-)([a-z])/g,(a,w,m)=>m.toUpperCase()),h=async i=>{try{if(customElements.get(i))return{tag:i,status:"already-defined"};let a=s(i),m=await import(a instanceof URL?a.href:new URL(a,g).href),E=m?.default??m?.[b(i)];if(!E){if(customElements.get(i))return{tag:i,status:"self-defined"};throw new Error(`No export found for ${i}. Expected default export or named export "${b(i)}".`)}return customElements.get(i)?{tag:i,status:"race-already-defined"}:(customElements.define(i,E),{tag:i,status:"defined"})}catch(a){throw l(i,a),a}};return Promise.all(r.map(h))}};var Oe=/^[a-z][a-z0-9+\-.]*:\/\//i,C=(()=>{try{return import.meta.url}catch{return}})(),F=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function W(e,t={}){if(!e||Oe.test(e))return e;let{preferModule:n=!0}=t,r=()=>{if(!C)return null;try{return new URL(e,C).href}catch{return null}},c=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(n?r()||c():c()||r())||e}var we=(()=>{if(C)try{let e=new URL(C);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",C).href}catch{return}})(),Se=!1;function ge(e){Se||typeof document>"u"||(Se=!0,e.addEventListener("pds:ready",t=>{let n=t.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function Ee({manageTheme:e,themeStorageKey:t,applyResolvedTheme:n,setupSystemListenerIfNeeded:r}){let c="light",s=null;if(e&&typeof window<"u"){try{s=localStorage.getItem(t)||null}catch{s=null}try{n?.(s),r?.(s)}catch{}s?s==="system"?c=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c=s:c=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:c,storedTheme:s}}function B(e,{resolvePublicAssetURL:t}){let n=!!(e?.public?.root||e?.static?.root),r=t(e);return!n&&we&&(r=we),F(W(r))}async function be(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:r=[],autoDefineMapper:c=null,enhancers:s=[],autoDefineOverrides:l=null,autoDefinePreferModule:g=!0}=e,b=(()=>{let i=new Map;return(t||[]).forEach(a=>i.set(a.selector,a)),(s||[]).forEach(a=>i.set(a.selector,a)),Array.from(i.values())})(),h=null;if(typeof window<"u"&&typeof document<"u"){let i=z,a=p=>{switch(p){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${p}.js`}},{mapper:w,enhancers:m,...E}=l&&typeof l=="object"?l:{},S=m?Array.isArray(m)?m:typeof m=="object"?Object.values(m):[]:[],L=(()=>{let p=new Map;return(b||[]).forEach(y=>{y?.selector&&p.set(y.selector,y)}),(S||[]).forEach(y=>{if(!y?.selector)return;let A=p.get(y.selector)||null;p.set(y.selector,{...A||{},...y,run:typeof y?.run=="function"?y.run:A?.run})}),Array.from(p.values())})(),_={baseURL:n&&F(W(n,{preferModule:g})),predefine:r,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:L,onError:(p,y)=>{if(typeof p=="string"&&p.startsWith("pds-")){let O=["pds-form","pds-drawer"].includes(p),T=y?.message?.includes("#pds/lit")||y?.message?.includes("Failed to resolve module specifier");O&&T?console.error(`\u274C PDS component <${p}> requires Lit but #pds/lit is not in import map.
|
|
2
|
+
See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):console.warn(`\u26A0\uFE0F PDS component <${p}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${p}>:`,y)},...E,mapper:p=>{if(customElements.get(p))return null;if(typeof c=="function")try{let y=c(p);return y===void 0?a(p):y}catch(y){return console.warn("Custom autoDefine.mapper error; falling back to default:",y?.message||y),a(p)}return a(p)}};h=new i(_),r.length>0&&typeof i.define=="function"&&await i.define(...r,{baseURL:n,mapper:_.mapper,onError:_.onError})}return{autoDefiner:h,mergedEnhancers:b}}var te=["light","dark"],ne=new Set(te);function Ie(e){let n=(Array.isArray(e?.themes)?e.themes.map(r=>String(r).toLowerCase()):te).filter(r=>ne.has(r));return n.length?n:te}function re(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(ne.has(n))return n;if(t&&typeof document<"u"){let r=document.documentElement?.getAttribute("data-theme");if(ne.has(r))return r}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Le(e,t){let n=re(t);return Ie(e).includes(n)}var oe=class extends EventTarget{},o=new oe;o.initializing=!1;o.currentPreset=null;o.debug=!1;var q=null,V=null,H=null,K=null;function G(e,t){return t&&typeof t=="string"?t:`${B(o.currentConfig||{},{resolvePublicAssetURL:N})}core/${e}`}async function Ne(){return Array.isArray(o.defaultEnhancers)&&o.defaultEnhancers.length>0?o.defaultEnhancers:(K||(K=import(G("pds-enhancers.js",o.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return o.defaultEnhancers=n,n}).catch(t=>{throw K=null,t})),K)}async function ze(){return typeof o.ask=="function"&&o.ask!==Ae?o.ask:(V||(V=import(G("pds-ask.js",o.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return o.ask=n,n}).catch(t=>{throw V=null,t})),V)}async function $(){return typeof o.toast=="function"&&o.toast!==k?o.toast:(H||(H=import(G("pds-toast.js",o.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return o.toast=n,n}).catch(t=>{throw H=null,t})),H)}async function Ae(...e){return(await ze())(...e)}async function k(...e){return(await $())(...e)}k.success=async(...e)=>(await $()).success(...e);k.error=async(...e)=>(await $()).error(...e);k.warning=async(...e)=>(await $()).warning(...e);k.info=async(...e)=>(await $()).info(...e);var ve=function(e="log",t,...n){let r=!!(o.registry&&!o.registry.isLive),c=(this?.debug||this?.design?.debug||o.debug||!1)===!0;if(r){if(!o.debug)return}else if(!c&&e!=="error"&&e!=="warn")return;let s=console[e]||console.log;n.length>0?s(t,...n):s(t)};function ae(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>ae(n)).filter(n=>n!==void 0);let t={};for(let[n,r]of Object.entries(e)){let c=ae(r);c!==void 0&&(t[n]=c)}return t}async function Fe(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let n=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let r=await fetch(n,{cache:"no-store"});return r.ok?await r.json():null}catch{return null}}o.registry=M;o.enums=fe;o.adoptLayers=de;o.adoptPrimitives=ue;o.parse=Z;o.createStylesheet=pe;o.isLiveMode=()=>M.isLive;o.ask=Ae;o.toast=k;o.common=ee;o.AutoComplete=null;o.loadAutoComplete=async()=>{if(o.AutoComplete&&typeof o.AutoComplete.connect=="function")return o.AutoComplete;let e=G("pds-autocomplete.js",o.currentConfig?.autoCompleteURL);return q||(q=import(e).then(t=>{let n=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!n)throw new Error("AutoComplete export not found in module");return o.AutoComplete=n,n}).catch(t=>{throw q=null,t})),q};function _e(e){let t=typeof CustomEvent=="function";try{let n=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");o.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",n))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",n))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function Re(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let r=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");o.dispatchEvent(r)}catch{}if(typeof document<"u")if(t){let r={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",r))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var se="pure-ds-theme",x=null,j=null;function Q(e){try{if(typeof document>"u")return;let t="light";e?e==="system"?t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t=e:t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t)}catch{}}function J(e){try{if(x&&j){try{typeof x.removeEventListener=="function"?x.removeEventListener("change",j):typeof x.removeListener=="function"&&x.removeListener(j)}catch{}x=null,j=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=r=>{let c=r?.matches===void 0?t.matches:r.matches;try{let s=c?"dark":"light";document.documentElement.setAttribute("data-theme",s),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:s,source:"system"}}))}catch{}};x=t,j=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}Object.defineProperty(o,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(se)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=o.currentConfig?.design||null,n=re(e);if(t&&!Le(t,n)){let r=t?.name||o.currentPreset?.name||o.currentConfig?.preset||"current preset";console.warn(`PDS theme "${n}" not supported by preset "${r}".`),o.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:r}}));return}e==null?localStorage.removeItem(se):localStorage.setItem(se,e),Q(e),J(e),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});o.defaultEnhancers=[];async function We(e){let t=e&&e.mode||"live",{mode:n,...r}=e||{};if(t==="static")return Be(r);let c=B(r,{resolvePublicAssetURL:N}),s=r?.managerURL||r?.public?.managerURL||r?.manager?.url||new URL("core/pds-manager.js",c).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:l}=await import(s);return l(o,r,{emitReady:_e,emitConfigChanged:Re,applyResolvedTheme:Q,setupSystemListenerIfNeeded:J})}o.start=We;async function Be(e){if(!e||typeof e!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let t=e.applyGlobalStyles??!0,n=e.manageTheme??!0,r=e.themeStorageKey??"pure-ds-theme",c=e.staticPaths??{},s=B(e,{resolvePublicAssetURL:N}),l=e&&e.autoDefine||null,g;l&&l.baseURL?g=F(W(l.baseURL,{preferModule:!1})):g=`${s}components/`;let b=l&&Array.isArray(l.predefine)&&l.predefine||[],h=l&&typeof l.mapper=="function"&&l.mapper||null;try{ge(o);let{resolvedTheme:i}=Ee({manageTheme:n,themeStorageKey:r,applyResolvedTheme:Q,setupSystemListenerIfNeeded:J}),a=await Fe(s,e),w=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],m=a?.config?{...a.config,...e,design:e?.design||a.config.design,preset:e?.preset||a.config.preset}:{...e},E={tokens:`${s}styles/pds-tokens.css.js`,primitives:`${s}styles/pds-primitives.css.js`,components:`${s}styles/pds-components.css.js`,utilities:`${s}styles/pds-utilities.css.js`,styles:`${s}styles/pds-styles.css.js`},S=a?.paths||{};if(c={...E,...S,...c},o.registry.setStaticMode(c),t&&typeof document<"u")try{let p=await o.registry.getStylesheet("styles");if(p){p._pds=!0;let y=(document.adoptedStyleSheets||[]).filter(A=>A._pds!==!0);document.adoptedStyleSheets=[...y,p],Re({mode:"static",source:"static:styles-applied"})}}catch(p){ve.call(o,"warn","Failed to apply static styles:",p)}let L=null,R=[];try{let p=await Ne(),y=await be({autoDefineBaseURL:g,autoDefinePreload:b,autoDefineMapper:h,enhancers:w,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:p});L=y.autoDefiner,R=y.mergedEnhancers||[]}catch(p){ve.call(o,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",p)}let _=ae(e);return o.currentConfig=Object.freeze({mode:"static",...structuredClone(_),design:structuredClone(m.design||{}),preset:m.preset,theme:i,enhancers:R}),_e({mode:"static",config:m,theme:i,autoDefiner:L}),{config:m,theme:i,autoDefiner:L}}catch(i){throw o.dispatchEvent(new CustomEvent("pds:error",{detail:{error:i}})),i}}var at=Q,it=J;export{o as PDS,at as applyResolvedTheme,it as setupSystemListenerIfNeeded};
|
package/readme.md
CHANGED
|
@@ -186,6 +186,50 @@ Install `@pure-ds/storybook` and get a cloned PDS Storybook instance right where
|
|
|
186
186
|
|
|
187
187
|
Install `@pure-ds/core` and get instant PDS AI Coding Instrucions at your fingertips (GitHub Copilot & Cursor support built in)
|
|
188
188
|
|
|
189
|
+
#### MCP-first SSoT delegation for coding agents
|
|
190
|
+
|
|
191
|
+
PDS also ships a local MCP server so agents can delegate lookups to actual SSoT files instead of relying on duplicated prompt text.
|
|
192
|
+
|
|
193
|
+
**Included binaries**
|
|
194
|
+
- `pds-mcp-server` — stdio MCP server
|
|
195
|
+
- `pds-setup-mcp` — writes local MCP config for VS Code and Cursor
|
|
196
|
+
- `pds-mcp-eval` — runs baseline parity checks against bundled cases
|
|
197
|
+
|
|
198
|
+
**Tool coverage**
|
|
199
|
+
- `get_tokens` → `public/assets/pds/pds.css-data.json`
|
|
200
|
+
- `find_utility_class` → `src/js/pds-core/pds-ontology.js`
|
|
201
|
+
- `get_component_api` → `custom-elements.json`
|
|
202
|
+
- `get_enhancer_metadata` → `src/js/pds-core/pds-enhancers-meta.js`
|
|
203
|
+
- `get_config_relations` → `src/js/pds-core/pds-config.js` (`PDS_CONFIG_RELATIONS`)
|
|
204
|
+
- `validate_pds_snippet` → validates classes/tokens/components against SSoT indexes
|
|
205
|
+
|
|
206
|
+
**Consumer project setup**
|
|
207
|
+
|
|
208
|
+
Run this in any project that depends on `@pure-ds/core`:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
npx pds-setup-mcp
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
This creates/updates:
|
|
215
|
+
- `.vscode/mcp.json`
|
|
216
|
+
- `.cursor/mcp.json`
|
|
217
|
+
|
|
218
|
+
Both configs point to:
|
|
219
|
+
|
|
220
|
+
```text
|
|
221
|
+
node ./node_modules/@pure-ds/core/packages/pds-cli/bin/pds-mcp-server.js
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Restart your IDE/agent after setup.
|
|
225
|
+
|
|
226
|
+
**Quality/parity check**
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
npm run pds:mcp:health
|
|
230
|
+
npm run pds:mcp:eval
|
|
231
|
+
```
|
|
232
|
+
|
|
189
233
|
### How It Works
|
|
190
234
|
|
|
191
235
|
It all starts with your `pds.confog.js` file in the root of the project (auto-generated when installing)
|
|
@@ -1272,8 +1316,6 @@ await PDS.start({
|
|
|
1272
1316
|
patchAttachShadow?: boolean,
|
|
1273
1317
|
debounceMs?: number
|
|
1274
1318
|
},
|
|
1275
|
-
// Note: autoDefine.moduleURL is no longer supported.
|
|
1276
|
-
// AutoDefiner ships as part of the core runtime bundle.
|
|
1277
1319
|
|
|
1278
1320
|
// Progressive enhancements
|
|
1279
1321
|
enhancers?: Array<{
|
|
@@ -470,26 +470,6 @@ export async function setupAutoDefinerAndEnhancers(options, { baseEnhancers = []
|
|
|
470
470
|
},
|
|
471
471
|
};
|
|
472
472
|
|
|
473
|
-
const debugEnhancers =
|
|
474
|
-
Boolean(
|
|
475
|
-
(typeof window !== "undefined" && window.__PDS_DEBUG_AUTODEFINE__) ||
|
|
476
|
-
autoDefineOverrides?.debugAutoDefine
|
|
477
|
-
);
|
|
478
|
-
|
|
479
|
-
if (debugEnhancers) {
|
|
480
|
-
const missingRun = resolvedEnhancers
|
|
481
|
-
.filter((enhancer) => typeof enhancer?.run !== "function")
|
|
482
|
-
.map((enhancer) => enhancer?.selector)
|
|
483
|
-
.filter(Boolean);
|
|
484
|
-
console.info("[PDS][AutoDefiner] enhancer summary", {
|
|
485
|
-
baseEnhancers: (baseEnhancers || []).length,
|
|
486
|
-
userEnhancers: (enhancers || []).length,
|
|
487
|
-
overrideEnhancers: normalizedOverrideEnhancers.length,
|
|
488
|
-
resolvedEnhancers: resolvedEnhancers.length,
|
|
489
|
-
missingRun,
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
|
|
493
473
|
autoDefiner = new AutoDefinerCtor(autoDefineConfig);
|
|
494
474
|
if (
|
|
495
475
|
autoDefinePreload.length > 0 &&
|