@pure-ds/core 0.5.19 → 0.5.21
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/dist/types/pds.d.ts +0 -1
- package/dist/types/public/assets/js/pds-manager.d.ts +5 -5
- package/dist/types/public/assets/js/pds.d.ts +3 -1
- package/dist/types/public/assets/js/pds.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-drawer.d.ts +1 -0
- package/dist/types/public/assets/pds/components/pds-drawer.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-live.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-start-helpers.d.ts +0 -3
- package/dist/types/src/js/pds-core/pds-start-helpers.d.ts.map +1 -1
- package/dist/types/src/js/pds.d.ts +2 -0
- package/dist/types/src/js/pds.d.ts.map +1 -1
- package/package.json +1 -1
- package/packages/pds-cli/bin/generate-css-data.js +7 -2
- package/packages/pds-cli/bin/pds-bootstrap.js +35 -92
- package/packages/pds-cli/bin/postinstall.mjs +2 -61
- package/packages/pds-cli/bin/templates/starter-templates.js +62 -0
- package/public/assets/js/app.js +16 -16
- package/public/assets/js/pds-manager.js +47 -47
- package/public/assets/js/pds.js +5 -5
- package/public/assets/pds/components/pds-drawer.js +142 -2
- package/readme.md +4 -162
- package/src/js/pds-core/pds-live.js +0 -26
- package/src/js/pds-core/pds-start-helpers.js +0 -60
- package/src/js/pds.d.ts +0 -1
- package/src/js/pds.js +26 -39
package/public/assets/js/pds.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var gt=Object.defineProperty;var bt=(t,e)=>()=>(t&&(e=t(t=0)),e);var wt=(t,e)=>{for(var s in e)gt(t,s,{get:e[s],enumerable:!0})};var ot={};wt(ot,{AutoDefiner:()=>Pe});async function Gt(...t){let e={};t.length&&typeof t[t.length-1]=="object"&&(e=t.pop()||{});let s=t,{baseURL:n,mapper:r=d=>`${d}.js`,onError:o=(d,l)=>console.error(`[defineWebComponents] ${d}:`,l)}=e,i=n?new URL(n,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),a=d=>d.toLowerCase().replace(/(^|-)([a-z])/g,(l,u,f)=>f.toUpperCase()),c=async d=>{try{if(customElements.get(d))return{tag:d,status:"already-defined"};let l=r(d),f=await import(l instanceof URL?l.href:new URL(l,i).href),m=f?.default??f?.[a(d)];if(!m){if(customElements.get(d))return{tag:d,status:"self-defined"};throw new Error(`No export found for ${d}. Expected default export or named export "${a(d)}".`)}return customElements.get(d)?{tag:d,status:"race-already-defined"}:(customElements.define(d,m),{tag:d,status:"defined"})}catch(l){throw o(d,l),l}};return Promise.all(s.map(c))}var Pe,it=bt(()=>{Pe=class{constructor(e={}){let{baseURL:s,mapper:n,onError:r,predicate:o=()=>!0,attributeModule:i="data-module",root:a=document,scanExisting:c=!0,debounceMs:d=16,observeShadows:l=!0,enhancers:u=[],patchAttachShadow:f=!0}=e,m=new Set,w=new Set,x=new Set,g=new Map,$=new WeakMap,I=new WeakMap,A=0,D=!1,L=null,Z=p=>{if(!p||!u.length)return;let y=I.get(p);y||(y=new Set,I.set(p,y));for(let h of u)if(!(!h.selector||!h.run)&&!y.has(h.selector))try{p.matches&&p.matches(h.selector)&&(h.run(p),y.add(h.selector))}catch(v){console.warn(`[AutoDefiner] Error applying enhancer for selector "${h.selector}":`,v)}},H=(p,y)=>{if(!D&&!(!p||!p.includes("-"))&&!customElements.get(p)&&!w.has(p)&&!x.has(p)){if(y&&y.getAttribute){let h=y.getAttribute(i);h&&!g.has(p)&&g.set(p,h)}m.add(p),ie()}},ie=()=>{A||(A=setTimeout(z,d))},E=p=>{if(p){if(p.nodeType===1){let y=p,h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&H(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)}p.querySelectorAll&&p.querySelectorAll("*").forEach(y=>{let h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&H(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)})}},M=p=>{if(!p||$.has(p))return;E(p);let y=new MutationObserver(h=>{for(let v of h)v.addedNodes?.forEach(B=>{E(B)}),v.type==="attributes"&&v.target&&E(v.target)});y.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(h=>h.selector).filter(h=>h.startsWith("data-"))]}),$.set(p,y)};async function z(){if(clearTimeout(A),A=0,!m.size)return;let p=Array.from(m);m.clear(),p.forEach(y=>w.add(y));try{let y=h=>g.get(h)??(n?n(h):`${h}.js`);await Gt(...p,{baseURL:s,mapper:y,onError:(h,v)=>{x.add(h),r?.(h,v)}})}catch{}finally{p.forEach(y=>w.delete(y))}}let _=a===document?document.documentElement:a,R=new MutationObserver(p=>{for(let y of p)y.addedNodes?.forEach(h=>{E(h)}),y.type==="attributes"&&y.target&&E(y.target)});if(R.observe(_,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),l&&f&&Element.prototype.attachShadow){let p=Element.prototype.attachShadow;Element.prototype.attachShadow=function(h){let v=p.call(this,h);if(h&&h.mode==="open"){M(v);let B=this.tagName?.toLowerCase();B&&B.includes("-")&&!customElements.get(B)&&H(B,this)}return v},L=()=>Element.prototype.attachShadow=p}return c&&E(_),{stop(){D=!0,R.disconnect(),L&&L(),A&&(clearTimeout(A),A=0),$.forEach(p=>p.disconnect())},flush:z}}static async define(...e){let s={};e.length&&typeof e[e.length-1]=="object"&&(s=e.pop()||{});let n=e,{baseURL:r,mapper:o=l=>`${l}.js`,onError:i=(l,u)=>console.error(`[defineWebComponents] ${l}:`,u)}=s,a=r?new URL(r,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),c=l=>l.toLowerCase().replace(/(^|-)([a-z])/g,(u,f,m)=>m.toUpperCase()),d=async l=>{try{if(customElements.get(l))return{tag:l,status:"already-defined"};let u=o(l),m=await import(u instanceof URL?u.href:new URL(u,a).href),w=m?.default??m?.[c(l)];if(!w){if(customElements.get(l))return{tag:l,status:"self-defined"};throw new Error(`No export found for ${l}. Expected default export or named export "${c(l)}".`)}return customElements.get(l)?{tag:l,status:"race-already-defined"}:(customElements.define(l,w),{tag:l,status:"defined"})}catch(u){throw i(l,u),u}};return Promise.all(n.map(d))}}});var me=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(e={}){this._mode="static",this._staticPaths={...this._staticPaths,...e},console.log("[PDS Registry] Switched to STATIC mode",this._staticPaths)}async getStylesheet(e){if(this._mode==="live")return null;try{return(await import(this._staticPaths[e]))[e]}catch(s){console.error(`[PDS Registry] Failed to load static ${e}:`,s),console.error(`[PDS Registry] Looking for: ${this._staticPaths[e]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let n=new CSSStyleSheet;return n.replaceSync("/* Failed to load "+e+" */"),n}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},F=new me;async function Ue(t,e=[],s=null){try{let n=s?.primitivesStylesheet?s.primitivesStylesheet:await F.getStylesheet("primitives");t.adoptedStyleSheets=[n,...e]}catch(n){let r=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${r}> failed to adopt primitives:`,n),t.adoptedStyleSheets=e}}async function Oe(t,e=["primitives"],s=[],n=null){try{let o=(await Promise.all(e.map(async i=>{if(n)switch(i){case"tokens":return n.tokensStylesheet;case"primitives":return n.primitivesStylesheet;case"components":return n.componentsStylesheet;case"utilities":return n.utilitiesStylesheet;default:break}return F.getStylesheet(i)}))).filter(i=>i!==null);t.adoptedStyleSheets=[...o,...s]}catch(r){let o=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${o}> failed to adopt layers:`,r),t.adoptedStyleSheets=s}}function Ne(t){let e=new CSSStyleSheet;return e.replaceSync(t),e}var ae=globalThis,le=ae.ShadowRoot&&(ae.ShadyCSS===void 0||ae.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qe=Symbol(),je=new WeakMap,ce=class{constructor(e,s,n){if(this._$cssResult$=!0,n!==qe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=s}get styleSheet(){let e=this.o,s=this.t;if(le&&e===void 0){let n=s!==void 0&&s.length===1;n&&(e=je.get(s)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&je.set(s,e))}return e}toString(){return this.cssText}},Ie=t=>new ce(typeof t=="string"?t:t+"",void 0,qe);var He=(t,e)=>{if(le)t.adoptedStyleSheets=e.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(let s of e){let n=document.createElement("style"),r=ae.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=s.cssText,t.appendChild(n)}},ye=le?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let s="";for(let n of e.cssRules)s+=n.cssText;return Ie(s)})(t):t;var{is:St,defineProperty:$t,getOwnPropertyDescriptor:_t,getOwnPropertyNames:At,getOwnPropertySymbols:Et,getPrototypeOf:vt}=Object,de=globalThis,ze=de.trustedTypes,Lt=ze?ze.emptyScript:"",Ct=de.reactiveElementPolyfillSupport,J=(t,e)=>t,ge={toAttribute(t,e){switch(e){case Boolean:t=t?Lt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=t!==null;break;case Number:s=t===null?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch{s=null}}return s}},Fe=(t,e)=>!St(t,e),Be={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:Fe};Symbol.metadata??=Symbol("metadata"),de.litPropertyMetadata??=new WeakMap;var P=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,s=Be){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(e,s),!s.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,s);r!==void 0&&$t(this.prototype,e,r)}}static getPropertyDescriptor(e,s,n){let{get:r,set:o}=_t(this.prototype,e)??{get(){return this[s]},set(i){this[s]=i}};return{get:r,set(i){let a=r?.call(this);o?.call(this,i),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Be}static _$Ei(){if(this.hasOwnProperty(J("elementProperties")))return;let e=vt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(J("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(J("properties"))){let s=this.properties,n=[...At(s),...Et(s)];for(let r of n)this.createProperty(r,s[r])}let e=this[Symbol.metadata];if(e!==null){let s=litPropertyMetadata.get(e);if(s!==void 0)for(let[n,r]of s)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[s,n]of this.elementProperties){let r=this._$Eu(s,n);r!==void 0&&this._$Eh.set(r,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let s=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)s.unshift(ye(r))}else e!==void 0&&s.push(ye(e));return s}static _$Eu(e,s){let n=s.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,s=this.constructor.elementProperties;for(let n of s.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return He(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,s,n){this._$AK(e,n)}_$ET(e,s){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&n.reflect===!0){let o=(n.converter?.toAttribute!==void 0?n.converter:ge).toAttribute(s,n.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,s){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let o=n.getPropertyOptions(r),i=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ge;this._$Em=r;let a=i.fromAttribute(s,o.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,s,n){if(e!==void 0){let r=this.constructor,o=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??Fe)(o,s)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,s,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,s,{useDefault:n,reflect:r,wrapped:o},i){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,i??s??this[e]),o!==!0||i!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(s=void 0),this._$AL.set(e,s)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[r,o]of n){let{wrapped:i}=o,a=this[r];i!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,o,a)}}let e=!1,s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(s)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(s)}willUpdate(e){}_$AE(e){this._$EO?.forEach(s=>s.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(s=>this._$ET(s,this[s])),this._$EM()}updated(e){}firstUpdated(e){}};P.elementStyles=[],P.shadowRootOptions={mode:"open"},P[J("elementProperties")]=new Map,P[J("finalized")]=new Map,Ct?.({ReactiveElement:P}),(de.reactiveElementVersions??=[]).push("2.1.1");var Ee=globalThis,ue=Ee.trustedTypes,We=ue?ue.createPolicy("lit-html",{createHTML:t=>t}):void 0,Qe="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,Xe="?"+k,xt=`<${Xe}>`,O=document,X=()=>O.createComment(""),Y=t=>t===null||typeof t!="object"&&typeof t!="function",ve=Array.isArray,Rt=t=>ve(t)||typeof t?.[Symbol.iterator]=="function",be=`[
|
|
2
|
-
\f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ke=/-->/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1
|
+
var gt=Object.defineProperty;var bt=(t,e)=>()=>(t&&(e=t(t=0)),e);var $t=(t,e)=>{for(var s in e)gt(t,s,{get:e[s],enumerable:!0})};var it={};$t(it,{AutoDefiner:()=>Pe});async function Gt(...t){let e={};t.length&&typeof t[t.length-1]=="object"&&(e=t.pop()||{});let s=t,{baseURL:n,mapper:r=d=>`${d}.js`,onError:o=(d,l)=>console.error(`[defineWebComponents] ${d}:`,l)}=e,i=n?new URL(n,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),a=d=>d.toLowerCase().replace(/(^|-)([a-z])/g,(l,u,f)=>f.toUpperCase()),c=async d=>{try{if(customElements.get(d))return{tag:d,status:"already-defined"};let l=r(d),f=await import(l instanceof URL?l.href:new URL(l,i).href),m=f?.default??f?.[a(d)];if(!m){if(customElements.get(d))return{tag:d,status:"self-defined"};throw new Error(`No export found for ${d}. Expected default export or named export "${a(d)}".`)}return customElements.get(d)?{tag:d,status:"race-already-defined"}:(customElements.define(d,m),{tag:d,status:"defined"})}catch(l){throw o(d,l),l}};return Promise.all(s.map(c))}var Pe,at=bt(()=>{Pe=class{constructor(e={}){let{baseURL:s,mapper:n,onError:r,predicate:o=()=>!0,attributeModule:i="data-module",root:a=document,scanExisting:c=!0,debounceMs:d=16,observeShadows:l=!0,enhancers:u=[],patchAttachShadow:f=!0}=e,m=new Set,$=new Set,x=new Set,g=new Map,w=new WeakMap,H=new WeakMap,A=0,D=!1,L=null,Z=p=>{if(!p||!u.length)return;let y=H.get(p);y||(y=new Set,H.set(p,y));for(let h of u)if(!(!h.selector||!h.run)&&!y.has(h.selector))try{p.matches&&p.matches(h.selector)&&(h.run(p),y.add(h.selector))}catch(v){console.warn(`[AutoDefiner] Error applying enhancer for selector "${h.selector}":`,v)}},I=(p,y)=>{if(!D&&!(!p||!p.includes("-"))&&!customElements.get(p)&&!$.has(p)&&!x.has(p)){if(y&&y.getAttribute){let h=y.getAttribute(i);h&&!g.has(p)&&g.set(p,h)}m.add(p),oe()}},oe=()=>{A||(A=setTimeout(z,d))},E=p=>{if(p){if(p.nodeType===1){let y=p,h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&I(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)}p.querySelectorAll&&p.querySelectorAll("*").forEach(y=>{let h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&I(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)})}},M=p=>{if(!p||w.has(p))return;E(p);let y=new MutationObserver(h=>{for(let v of h)v.addedNodes?.forEach(B=>{E(B)}),v.type==="attributes"&&v.target&&E(v.target)});y.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(h=>h.selector).filter(h=>h.startsWith("data-"))]}),w.set(p,y)};async function z(){if(clearTimeout(A),A=0,!m.size)return;let p=Array.from(m);m.clear(),p.forEach(y=>$.add(y));try{let y=h=>g.get(h)??(n?n(h):`${h}.js`);await Gt(...p,{baseURL:s,mapper:y,onError:(h,v)=>{x.add(h),r?.(h,v)}})}catch{}finally{p.forEach(y=>$.delete(y))}}let _=a===document?document.documentElement:a,R=new MutationObserver(p=>{for(let y of p)y.addedNodes?.forEach(h=>{E(h)}),y.type==="attributes"&&y.target&&E(y.target)});if(R.observe(_,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),l&&f&&Element.prototype.attachShadow){let p=Element.prototype.attachShadow;Element.prototype.attachShadow=function(h){let v=p.call(this,h);if(h&&h.mode==="open"){M(v);let B=this.tagName?.toLowerCase();B&&B.includes("-")&&!customElements.get(B)&&I(B,this)}return v},L=()=>Element.prototype.attachShadow=p}return c&&E(_),{stop(){D=!0,R.disconnect(),L&&L(),A&&(clearTimeout(A),A=0),w.forEach(p=>p.disconnect())},flush:z}}static async define(...e){let s={};e.length&&typeof e[e.length-1]=="object"&&(s=e.pop()||{});let n=e,{baseURL:r,mapper:o=l=>`${l}.js`,onError:i=(l,u)=>console.error(`[defineWebComponents] ${l}:`,u)}=s,a=r?new URL(r,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),c=l=>l.toLowerCase().replace(/(^|-)([a-z])/g,(u,f,m)=>m.toUpperCase()),d=async l=>{try{if(customElements.get(l))return{tag:l,status:"already-defined"};let u=o(l),m=await import(u instanceof URL?u.href:new URL(u,a).href),$=m?.default??m?.[c(l)];if(!$){if(customElements.get(l))return{tag:l,status:"self-defined"};throw new Error(`No export found for ${l}. Expected default export or named export "${c(l)}".`)}return customElements.get(l)?{tag:l,status:"race-already-defined"}:(customElements.define(l,$),{tag:l,status:"defined"})}catch(u){throw i(l,u),u}};return Promise.all(n.map(d))}}});var me=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(e={}){this._mode="static",this._staticPaths={...this._staticPaths,...e},console.log("[PDS Registry] Switched to STATIC mode",this._staticPaths)}async getStylesheet(e){if(this._mode==="live")return null;try{return(await import(this._staticPaths[e]))[e]}catch(s){console.error(`[PDS Registry] Failed to load static ${e}:`,s),console.error(`[PDS Registry] Looking for: ${this._staticPaths[e]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let n=new CSSStyleSheet;return n.replaceSync("/* Failed to load "+e+" */"),n}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},F=new me;async function Oe(t,e=[],s=null){try{let n=s?.primitivesStylesheet?s.primitivesStylesheet:await F.getStylesheet("primitives");t.adoptedStyleSheets=[n,...e]}catch(n){let r=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${r}> failed to adopt primitives:`,n),t.adoptedStyleSheets=e}}async function Ne(t,e=["primitives"],s=[],n=null){try{let o=(await Promise.all(e.map(async i=>{if(n)switch(i){case"tokens":return n.tokensStylesheet;case"primitives":return n.primitivesStylesheet;case"components":return n.componentsStylesheet;case"utilities":return n.utilitiesStylesheet;default:break}return F.getStylesheet(i)}))).filter(i=>i!==null);t.adoptedStyleSheets=[...o,...s]}catch(r){let o=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${o}> failed to adopt layers:`,r),t.adoptedStyleSheets=s}}function je(t){let e=new CSSStyleSheet;return e.replaceSync(t),e}var ie=globalThis,ce=ie.ShadowRoot&&(ie.ShadyCSS===void 0||ie.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,He=Symbol(),qe=new WeakMap,ae=class{constructor(e,s,n){if(this._$cssResult$=!0,n!==He)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=s}get styleSheet(){let e=this.o,s=this.t;if(ce&&e===void 0){let n=s!==void 0&&s.length===1;n&&(e=qe.get(s)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&qe.set(s,e))}return e}toString(){return this.cssText}},Ie=t=>new ae(typeof t=="string"?t:t+"",void 0,He);var ze=(t,e)=>{if(ce)t.adoptedStyleSheets=e.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(let s of e){let n=document.createElement("style"),r=ie.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=s.cssText,t.appendChild(n)}},ye=ce?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let s="";for(let n of e.cssRules)s+=n.cssText;return Ie(s)})(t):t;var{is:St,defineProperty:wt,getOwnPropertyDescriptor:_t,getOwnPropertyNames:At,getOwnPropertySymbols:Et,getPrototypeOf:vt}=Object,le=globalThis,Be=le.trustedTypes,Lt=Be?Be.emptyScript:"",Ct=le.reactiveElementPolyfillSupport,J=(t,e)=>t,ge={toAttribute(t,e){switch(e){case Boolean:t=t?Lt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=t!==null;break;case Number:s=t===null?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch{s=null}}return s}},We=(t,e)=>!St(t,e),Fe={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:We};Symbol.metadata??=Symbol("metadata"),le.litPropertyMetadata??=new WeakMap;var P=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,s=Fe){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(e,s),!s.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,s);r!==void 0&&wt(this.prototype,e,r)}}static getPropertyDescriptor(e,s,n){let{get:r,set:o}=_t(this.prototype,e)??{get(){return this[s]},set(i){this[s]=i}};return{get:r,set(i){let a=r?.call(this);o?.call(this,i),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Fe}static _$Ei(){if(this.hasOwnProperty(J("elementProperties")))return;let e=vt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(J("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(J("properties"))){let s=this.properties,n=[...At(s),...Et(s)];for(let r of n)this.createProperty(r,s[r])}let e=this[Symbol.metadata];if(e!==null){let s=litPropertyMetadata.get(e);if(s!==void 0)for(let[n,r]of s)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[s,n]of this.elementProperties){let r=this._$Eu(s,n);r!==void 0&&this._$Eh.set(r,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let s=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)s.unshift(ye(r))}else e!==void 0&&s.push(ye(e));return s}static _$Eu(e,s){let n=s.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,s=this.constructor.elementProperties;for(let n of s.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ze(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,s,n){this._$AK(e,n)}_$ET(e,s){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&n.reflect===!0){let o=(n.converter?.toAttribute!==void 0?n.converter:ge).toAttribute(s,n.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,s){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let o=n.getPropertyOptions(r),i=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ge;this._$Em=r;let a=i.fromAttribute(s,o.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,s,n){if(e!==void 0){let r=this.constructor,o=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??We)(o,s)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,s,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,s,{useDefault:n,reflect:r,wrapped:o},i){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,i??s??this[e]),o!==!0||i!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(s=void 0),this._$AL.set(e,s)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[r,o]of n){let{wrapped:i}=o,a=this[r];i!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,o,a)}}let e=!1,s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(s)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(s)}willUpdate(e){}_$AE(e){this._$EO?.forEach(s=>s.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(s=>this._$ET(s,this[s])),this._$EM()}updated(e){}firstUpdated(e){}};P.elementStyles=[],P.shadowRootOptions={mode:"open"},P[J("elementProperties")]=new Map,P[J("finalized")]=new Map,Ct?.({ReactiveElement:P}),(le.reactiveElementVersions??=[]).push("2.1.1");var Ee=globalThis,de=Ee.trustedTypes,Ve=de?de.createPolicy("lit-html",{createHTML:t=>t}):void 0,Xe="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,Ye="?"+k,xt=`<${Ye}>`,O=document,X=()=>O.createComment(""),Y=t=>t===null||typeof t!="object"&&typeof t!="function",ve=Array.isArray,Rt=t=>ve(t)||typeof t?.[Symbol.iterator]=="function",be=`[
|
|
2
|
+
\f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ke=/-->/g,Ge=/>/g,T=RegExp(`>|${be}(?:([^\\s"'>=/]+)(${be}*=${be}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ze=/'/g,Je=/"/g,et=/^(?:script|style|textarea|title)$/i,Le=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),cs=Le(1),ls=Le(2),ds=Le(3),N=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),Qe=new WeakMap,U=O.createTreeWalker(O,129);function tt(t,e){if(!ve(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ve!==void 0?Ve.createHTML(e):e}var Pt=(t,e)=>{let s=t.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",i=Q;for(let a=0;a<s;a++){let c=t[a],d,l,u=-1,f=0;for(;f<c.length&&(i.lastIndex=f,l=i.exec(c),l!==null);)f=i.lastIndex,i===Q?l[1]==="!--"?i=Ke:l[1]!==void 0?i=Ge:l[2]!==void 0?(et.test(l[2])&&(r=RegExp("</"+l[2],"g")),i=T):l[3]!==void 0&&(i=T):i===T?l[0]===">"?(i=r??Q,u=-1):l[1]===void 0?u=-2:(u=i.lastIndex-l[2].length,d=l[1],i=l[3]===void 0?T:l[3]==='"'?Je:Ze):i===Je||i===Ze?i=T:i===Ke||i===Ge?i=Q:(i=T,r=void 0);let m=i===T&&t[a+1].startsWith("/>")?" ":"";o+=i===Q?c+xt:u>=0?(n.push(d),c.slice(0,u)+Xe+c.slice(u)+k+m):c+k+(u===-2?a:m)}return[tt(t,o+(t[s]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},ee=class t{constructor({strings:e,_$litType$:s},n){let r;this.parts=[];let o=0,i=0,a=e.length-1,c=this.parts,[d,l]=Pt(e,s);if(this.el=t.createElement(d,n),U.currentNode=this.el.content,s===2||s===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(r=U.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(Xe)){let f=l[i++],m=r.getAttribute(u).split(k),$=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:$[2],strings:m,ctor:$[1]==="."?Se:$[1]==="?"?we:$[1]==="@"?_e:V}),r.removeAttribute(u)}else u.startsWith(k)&&(c.push({type:6,index:o}),r.removeAttribute(u));if(et.test(r.tagName)){let u=r.textContent.split(k),f=u.length-1;if(f>0){r.textContent=de?de.emptyScript:"";for(let m=0;m<f;m++)r.append(u[m],X()),U.nextNode(),c.push({type:2,index:++o});r.append(u[f],X())}}}else if(r.nodeType===8)if(r.data===Ye)c.push({type:2,index:o});else{let u=-1;for(;(u=r.data.indexOf(k,u+1))!==-1;)c.push({type:7,index:o}),u+=k.length-1}o++}}static createElement(e,s){let n=O.createElement("template");return n.innerHTML=e,n}};function W(t,e,s=t,n){if(e===N)return e;let r=n!==void 0?s._$Co?.[n]:s._$Cl,o=Y(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(t),r._$AT(t,s,n)),n!==void 0?(s._$Co??=[])[n]=r:s._$Cl=r),r!==void 0&&(e=W(t,r._$AS(t,e.values),r,n)),e}var $e=class{constructor(e,s){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:s},parts:n}=this._$AD,r=(e?.creationScope??O).importNode(s,!0);U.currentNode=r;let o=U.nextNode(),i=0,a=0,c=n[0];for(;c!==void 0;){if(i===c.index){let d;c.type===2?d=new te(o,o.nextSibling,this,e):c.type===1?d=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(d=new Ae(o,this,e)),this._$AV.push(d),c=n[++a]}i!==c?.index&&(o=U.nextNode(),i++)}return U.currentNode=O,r}p(e){let s=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,s),s+=n.strings.length-2):n._$AI(e[s])),s++}},te=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,s,n,r){this.type=2,this._$AH=S,this._$AN=void 0,this._$AA=e,this._$AB=s,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,s=this._$AM;return s!==void 0&&e?.nodeType===11&&(e=s.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,s=this){e=W(this,e,s),Y(e)?e===S||e==null||e===""?(this._$AH!==S&&this._$AR(),this._$AH=S):e!==this._$AH&&e!==N&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Rt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==S&&Y(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.createTextNode(e)),this._$AH=e}$(e){let{values:s,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=ee.createElement(tt(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(s);else{let o=new $e(r,this),i=o.u(this.options);o.p(s),this.T(i),this._$AH=o}}_$AC(e){let s=Qe.get(e.strings);return s===void 0&&Qe.set(e.strings,s=new ee(e)),s}k(e){ve(this._$AH)||(this._$AH=[],this._$AR());let s=this._$AH,n,r=0;for(let o of e)r===s.length?s.push(n=new t(this.O(X()),this.O(X()),this,this.options)):n=s[r],n._$AI(o),r++;r<s.length&&(this._$AR(n&&n._$AB.nextSibling,r),s.length=r)}_$AR(e=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},V=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,s,n,r,o){this.type=1,this._$AH=S,this._$AN=void 0,this.element=e,this.name=s,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=S}_$AI(e,s=this,n,r){let o=this.strings,i=!1;if(o===void 0)e=W(this,e,s,0),i=!Y(e)||e!==this._$AH&&e!==N,i&&(this._$AH=e);else{let a=e,c,d;for(e=o[0],c=0;c<o.length-1;c++)d=W(this,a[n+c],s,c),d===N&&(d=this._$AH[c]),i||=!Y(d)||d!==this._$AH[c],d===S?e=S:e!==S&&(e+=(d??"")+o[c+1]),this._$AH[c]=d}i&&!r&&this.j(e)}j(e){e===S?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Se=class extends V{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===S?void 0:e}},we=class extends V{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==S)}},_e=class extends V{constructor(e,s,n,r,o){super(e,s,n,r,o),this.type=5}_$AI(e,s=this){if((e=W(this,e,s,0)??S)===N)return;let n=this._$AH,r=e===S&&n!==S||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==S&&(n===S||r);r&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ae=class{constructor(e,s,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=s,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){W(this,e)}};var kt=Ee.litHtmlPolyfillSupport;kt?.(ee,te),(Ee.litHtmlVersions??=[]).push("3.3.1");var j=(t,e,s)=>{let n=s?.renderBefore??e,r=n._$litPart$;if(r===void 0){let o=s?.renderBefore??null;n._$litPart$=r=new te(e.insertBefore(X(),o),o,void 0,s??{})}return r._$AI(t),r};var Ce=globalThis,K=class extends P{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=j(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return N}};K._$litElement$=!0,K.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:K});var Dt=Ce.litElementPolyfillSupport;Dt?.({LitElement:K});(Ce.litElementVersions??=[]).push("4.2.1");var st={mode:"live",preset:"default",autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(t,e,...s){console[t](e,...s)}};async function nt(t,e={}){return e={...{title:"Confirm",type:"confirm",buttons:{ok:{name:"OK",primary:!0},cancel:{name:"Cancel",cancel:!0}}},...e},new Promise(n=>{let r=document.createElement("dialog");st.options?.liquidGlassEffects&&r.classList.add("liquid-glass"),e.size&&r.classList.add(`dialog-${e.size}`),e.type&&r.classList.add(`dialog-${e.type}`),e.class&&(Array.isArray(e.class)?r.classList.add(...e.class):r.classList.add(e.class)),e.maxHeight&&r.style.setProperty("--dialog-max-height",e.maxHeight);let o=Object.entries(e.buttons).map(([a,c])=>{let d=c.primary?"btn-primary btn-sm":"btn-outline btn-sm";return`<button type="${c.cancel?"button":"submit"}" class="${d}" value="${a}">${c.name}</button>`});if(e.useForm){let a=document.createElement("div");typeof t=="object"&&t._$litType$?j(t,a):typeof t=="string"?a.textContent=t:j(t,a);let c=a.querySelector("form");if(c){r.innerHTML=`
|
|
4
4
|
<header>
|
|
5
5
|
<h2>${e.title}</h2>
|
|
6
6
|
</header>
|
|
@@ -24,12 +24,12 @@ var gt=Object.defineProperty;var bt=(t,e)=>()=>(t&&(e=t(t=0)),e);var wt=(t,e)=>{
|
|
|
24
24
|
${o.join("")}
|
|
25
25
|
</footer>
|
|
26
26
|
</form>
|
|
27
|
-
`;let a=r.querySelector("#msg-container");typeof t=="object"&&t._$litType$?j(t,a):typeof t=="string"?a.textContent=t:j(t,a)}r.addEventListener("click",a=>{a.target.closest('button[value="cancel"]')&&(r.close(),n(!1))});let i=()=>{let a=r.querySelector("form");a?a.addEventListener("submit",c=>{c.preventDefault();let d;e.useForm&&c.submitter.value==="ok"?(console.log("Found form:",a),console.log("Form elements:",a?Array.from(a.elements):"no form"),d=new FormData(a),console.log("FormData entries:",Array.from(d.entries()))):d=c.submitter.value==="ok",r.close(),n(d)}):requestAnimationFrame(i)};i(),r.addEventListener("close",()=>{setTimeout(()=>r.remove(),200)}),document.body.appendChild(r),typeof e.rendered=="function"&&e.rendered(r),r.showModal()})}async function Mt(){let t=document.querySelector("pds-toaster");return t||(t=document.createElement("pds-toaster"),document.body.appendChild(t),await customElements.whenDefined("pds-toaster")),t}async function C(t,e={}){return(await Mt()).toast(t,e)}C.success=async function(t,e={}){return C(t,{...e,type:"success"})};C.error=async function(t,e={}){return C(t,{...e,type:"error"})};C.warning=async function(t,e={}){return C(t,{...e,type:"warning"})};C.info=async function(t,e={}){return C(t,{...e,type:"information"})};var Tt=[{selector:".accordion"},{selector:"nav[data-dropdown]"},{selector:"label[data-toggle]"},{selector:'input[type="range"]'},{selector:"form[data-required]"},{selector:"fieldset[role=group][data-open]"},{selector:"button, a[class*='btn-']"}];function Ut(t){t.dataset.enhancedAccordion||(t.dataset.enhancedAccordion="true",t.addEventListener("toggle",e=>{e.target.open&&e.target.parentElement===t&&t.querySelectorAll(":scope > details[open]").forEach(s=>{s!==e.target&&(s.open=!1)})},!0))}function Ot(t){if(t.dataset.enhancedDropdown)return;t.dataset.enhancedDropdown="true";let e=t.querySelector("menu");if(!e)return;let s=t.querySelector("[data-dropdown-toggle]")||t.querySelector("button");s&&!s.hasAttribute("type")&&s.setAttribute("type","button"),e.id||(e.id=`dropdown-${Math.random().toString(36).slice(2,9)}`),e.setAttribute("role",e.getAttribute("role")||"menu"),e.hasAttribute("aria-hidden")||e.setAttribute("aria-hidden","true"),s&&(s.setAttribute("aria-haspopup","true"),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-expanded","false"));let n=()=>{let a=(t.getAttribute("data-mode")||"auto").toLowerCase();if(a==="up"||a==="down")return a;let c=t.getBoundingClientRect(),d=Math.max(0,window.innerHeight-c.bottom);return Math.max(0,c.top)>d?"up":"down"},r=()=>{t.dataset.dropdownDirection=n(),e.setAttribute("aria-hidden","false"),s?.setAttribute("aria-expanded","true")},o=()=>{e.setAttribute("aria-hidden","true"),s?.setAttribute("aria-expanded","false")},i=()=>{e.getAttribute("aria-hidden")==="false"?o():r()};s?.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),i()}),document.addEventListener("click",a=>{t.contains(a.target)||o()}),t.addEventListener("keydown",a=>{a.key==="Escape"&&(o(),s?.focus())}),t.addEventListener("focusout",a=>{(!a.relatedTarget||!t.contains(a.relatedTarget))&&o()})}function Nt(t){if(t.dataset.enhancedToggle)return;t.dataset.enhancedToggle="true";let e=t.querySelector('input[type="checkbox"]');if(!e)return;t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.setAttribute("role","switch"),t.setAttribute("aria-checked",e.checked?"true":"false");let s=document.createElement("span");s.className="toggle-switch",s.setAttribute("role","presentation"),s.setAttribute("aria-hidden","true");let n=document.createElement("span");n.className="toggle-knob",s.appendChild(n),t.insertBefore(s,e.nextSibling);let r=()=>{t.setAttribute("aria-checked",e.checked?"true":"false")},o=()=>{e.disabled||(e.checked=!e.checked,r(),e.dispatchEvent(new Event("change",{bubbles:!0})))};t.addEventListener("click",i=>{i.preventDefault(),o()}),t.addEventListener("keydown",i=>{(i.key===" "||i.key==="Enter")&&(i.preventDefault(),o())}),e.addEventListener("change",r)}function jt(t){if(t.dataset.enhancedRange)return;let e=t.closest("label"),s=e?.classList.contains("range-output"),n=t.id||`range-${Math.random().toString(36).substring(2,11)}`,r=`${n}-output`;if(t.id=n,s){let o=e.querySelector("span");if(o&&!o.classList.contains("range-output-wrapper")){let i=document.createElement("span");i.className="range-output-wrapper",i.style.display="flex",i.style.justifyContent="space-between",i.style.alignItems="center";let a=document.createElement("span");a.textContent=o.textContent,i.appendChild(a);let c=document.createElement("output");c.id=r,c.setAttribute("for",n),c.style.color="var(--surface-text-secondary, var(--color-text-secondary))",c.style.fontSize="0.875rem",c.textContent=t.value,i.appendChild(c),o.textContent="",o.appendChild(i);let d=()=>{c.textContent=t.value};t.addEventListener("input",d)}}else{let o=t.closest(".range-container");o||(o=document.createElement("div"),o.className="range-container",t.parentNode?.insertBefore(o,t),o.appendChild(t)),o.style.position="relative";let i=document.createElement("output");i.id=r,i.setAttribute("for",n),i.className="range-bubble",i.setAttribute("aria-live","polite"),o.appendChild(i);let a=()=>{let l=parseFloat(t.min)||0,u=parseFloat(t.max)||100,f=parseFloat(t.value),m=(f-l)/(u-l);i.style.left=`calc(${m*100}% )`,i.textContent=String(f)},c=()=>i.classList.add("visible"),d=()=>i.classList.remove("visible");t.addEventListener("input",a),t.addEventListener("pointerdown",c),t.addEventListener("pointerup",d),t.addEventListener("pointerleave",d),t.addEventListener("focus",c),t.addEventListener("blur",d),a()}t.dataset.enhancedRange="1"}function qt(t){if(t.dataset.enhancedRequired)return;t.dataset.enhancedRequired="true";let e=s=>{let n=s.closest("label");if(!n||n.querySelector(".required-asterisk"))return;let r=document.createElement("span");r.classList.add("required-asterisk"),r.textContent="*",r.style.marginLeft="4px",n.querySelector("span").appendChild(r);let o=s.closest("form");if(o&&!o.querySelector(".required-legend")){let i=document.createElement("small");i.classList.add("required-legend"),i.textContent="* Required fields",o.insertBefore(i,o.querySelector(".form-actions")||o.lastElementChild)}};t.querySelectorAll("[required]").forEach(s=>{e(s)})}function It(t){if(t.dataset.enhancedOpenGroup)return;t.dataset.enhancedOpenGroup="true",t.classList.add("flex","flex-wrap","buttons");let e=document.createElement("input");e.type="text",e.placeholder="Add item...",e.classList.add("input-text","input-sm"),e.style.width="auto";let s=t.querySelector('input[type="radio"], input[type="checkbox"]');t.appendChild(e),e.addEventListener("keydown",n=>{if(n.key==="Enter"||n.key==="Tab"){let r=e.value.trim();if(r){n.preventDefault();let o=s.type==="radio"?"radio":"checkbox",i=`open-group-${Math.random().toString(36).substring(2,11)}`,a=document.createElement("label"),c=document.createElement("span");c.setAttribute("data-label",""),c.textContent=r;let d=document.createElement("input");d.type=o,d.name=s.name||t.getAttribute("data-name")||"open-group",d.value=r,d.id=i,a.appendChild(c),a.appendChild(d),t.insertBefore(a,e),e.value=""}}else if(n.key==="Backspace"&&e.value===""){n.preventDefault();let r=t.querySelectorAll("label");r.length>0&&r[r.length-1].remove()}})}function Ht(t){if(t.dataset.enhancedBtnWorking)return;t.dataset.enhancedBtnWorking="true";let e=null,s=!1;new MutationObserver(r=>{r.forEach(o=>{if(o.attributeName==="class"){let i=t.classList.contains("btn-working"),a=t.querySelector("pds-icon");if(i)if(a)e||(e=a.getAttribute("icon")),a.setAttribute("icon","circle-notch");else{let c=document.createElement("pds-icon");c.setAttribute("icon","circle-notch"),c.setAttribute("size","sm"),t.insertBefore(c,t.firstChild),s=!0}else o.oldValue?.includes("btn-working")&&a&&(s?(a.remove(),s=!1):e&&(a.setAttribute("icon",e),e=null))}})}).observe(t,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0})}var zt=new Map([[".accordion",Ut],["nav[data-dropdown]",Ot],["label[data-toggle]",Nt],['input[type="range"]',jt],["form[data-required]",qt],["fieldset[role=group][data-open]",It],["button, a[class*='btn-']",Ht]]),xe=Tt.map(t=>({...t,run:zt.get(t.selector)||(()=>{})}));var rt="pds",Bt=/^([a-z][a-z0-9+\-.]*:)?\/\//i,nt=/^[a-z]:/i;function se(t=""){return t.endsWith("/")?t:`${t}/`}function Ft(t="",e=rt){let s=t.replace(/\/+$/,"");return new RegExp(`(?:^|/)${e}$`,"i").test(s)?s:`${s}/${e}`}function Wt(t){return t.replace(/^\.\/+/,"")}function Kt(t){return nt.test(t)?t.replace(nt,"").replace(/^\/+/,""):t}function Vt(t){return t.startsWith("public/")?t.substring(7):t}function Re(t,e={}){let s=e.segment||rt,n=e.defaultRoot||`/assets/${s}/`,r=t?.public&&t.public?.root||t?.static&&t.static?.root||null;if(!r||typeof r!="string")return se(n);let o=r.trim();return o?(o=o.replace(/\\/g,"/"),o=Ft(o,s),o=se(o),Bt.test(o)?o:(o=Wt(o),o=Kt(o),o.startsWith("/")||(o=Vt(o),o.startsWith("/")||(o=`/${o}`),o=o.replace(/\/+/g,(i,a)=>a===0?i:"/")),se(o))):se(n)}var Zt=/^[a-z][a-z0-9+\-.]*:\/\//i,ne=(()=>{try{return import.meta.url}catch{return}})(),pe=t=>typeof t=="string"&&t.length&&!t.endsWith("/")?`${t}/`:t;function he(t,e={}){if(!t||Zt.test(t))return t;let{preferModule:s=!0}=e,n=()=>{if(!ne)return null;try{return new URL(t,ne).href}catch{return null}},r=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(t,window.location.origin).href}catch{return null}};return(s?n()||r():r()||n())||t}var at=(()=>{if(ne)try{let t=new URL(ne);if(/\/public\/assets\/js\//.test(t.pathname))return new URL("../pds/",ne).href}catch{return}})(),ct=!1;function lt(t){ct||typeof document>"u"||(ct=!0,t.addEventListener("pds:ready",e=>{let s=e.detail?.mode;s&&document.documentElement.classList.add(`pds-${s}`,"pds-ready")}))}function dt(t={},e={}){if(!e||typeof e!="object")return t;let s=Array.isArray(t)?[...t]:{...t};for(let[n,r]of Object.entries(e))r&&typeof r=="object"&&!Array.isArray(r)?s[n]=dt(s[n]&&typeof s[n]=="object"?s[n]:{},r):s[n]=r;return s}function ke(t=""){return String(t).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function G(t){if(t==null)return t;if(typeof t=="function")return;if(typeof t!="object")return t;if(Array.isArray(t))return t.map(s=>G(s)).filter(s=>s!==void 0);let e={};for(let s in t)if(t.hasOwnProperty(s)){let n=t[s];if(typeof n!="function"){let r=G(n);r!==void 0&&(e[s]=r)}}return e}function ut(t={},e={},{presets:s,defaultLog:n}){let r=typeof t=="object"&&("colors"in t||"typography"in t||"spatialRhythm"in t||"shape"in t||"behavior"in t||"layout"in t||"advanced"in t||"a11y"in t||"components"in t||"icons"in t),o=t&&t.enhancers;o&&!Array.isArray(o)&&(o=Object.values(o));let i=o??e.enhancers??[],a=t&&t.preset,c=t&&t.design,d="preset"in(t||{})||"design"in(t||{})||"enhancers"in(t||{}),l,u=null;if(d){let f=String(a||"default").toLowerCase(),m=s?.[f]||Object.values(s||{}).find(R=>ke(R.name)===f||String(R.name||"").toLowerCase()===f);if(!m)throw new Error(`PDS preset not found: "${a||"default"}"`);u={id:m.id||ke(m.name),name:m.name||m.id||String(f)};let w=structuredClone(m);if(c&&typeof c=="object"){let R=G(c);w=dt(w,structuredClone(R))}let{mode:x,autoDefine:g,applyGlobalStyles:$,manageTheme:I,themeStorageKey:A,preloadStyles:D,criticalLayers:L,managerURL:Z,manager:H,preset:ie,design:E,enhancers:M,log:z,..._}=t;l={..._,design:w,preset:u.name,log:z||n}}else if(r){let{log:f,...m}=t;l={design:structuredClone(m),log:f||n}}else{let f=s?.default||Object.values(s||{}).find(m=>ke(m.name)==="default");if(!f)throw new Error("PDS default preset not available");u={id:f.id||"default",name:f.name||"Default"},l={design:structuredClone(f),preset:u.name,log:n}}return{generatorConfig:l,enhancers:i,presetInfo:u}}function pt({manageTheme:t,themeStorageKey:e,applyResolvedTheme:s,setupSystemListenerIfNeeded:n}){let r="light",o=null;if(t&&typeof window<"u"){try{o=localStorage.getItem(e)||null}catch{o=null}try{s?.(o),n?.(o)}catch{}o?o==="system"?r=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":r=o:r=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:r,storedTheme:o}}function ht({PDS:t,defaultStorageKey:e="pure-ds-theme",setupSystemListenerIfNeeded:s,onApply:n}={}){return async function(o,i={}){let{storageKey:a=e,persist:c=!0}=i;if(!["light","dark","system"].includes(o))throw new Error(`Invalid theme "${o}". Must be "light", "dark", or "system".`);if(typeof window>"u")return o==="system"?"light":o;let d=o;if(o==="system"&&(d=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),document.documentElement.setAttribute("data-theme",d),c)try{localStorage.setItem(a,o)}catch{}try{s?.(o)}catch{}typeof n=="function"&&await n({theme:o,resolvedTheme:d});try{t?.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:d,requested:o,source:"programmatic"}}))}catch{}return d}}function De(t,{resolvePublicAssetURL:e}){let s=!!(t?.public?.root||t?.static?.root),n=e(t);return!s&&at&&(n=at),pe(he(n))}async function ft(t,{baseEnhancers:e=[]}={}){let{autoDefineBaseURL:s="/auto-define/",autoDefinePreload:n=[],autoDefineMapper:r=null,enhancers:o=[],autoDefineOverrides:i=null,autoDefinePreferModule:a=!0}=t,c=(()=>{let l=new Map;return(e||[]).forEach(u=>l.set(u.selector,u)),(o||[]).forEach(u=>l.set(u.selector,u)),Array.from(l.values())})(),d=null;if(typeof window<"u"&&typeof document<"u"){let l=null;try{let g=await Promise.resolve().then(()=>(it(),ot));l=g?.AutoDefiner||g?.default?.AutoDefiner||g?.default||null}catch(g){console.warn("AutoDefiner not available:",g?.message||g)}let u=g=>{switch(g){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${g}.js`}},{mapper:f,...m}=i&&typeof i=="object"?i:{},x={baseURL:s&&pe(he(s,{preferModule:a})),predefine:n,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:c,onError:(g,$)=>{if(typeof g=="string"&&g.startsWith("pds-")){let A=["pds-form","pds-drawer"].includes(g),D=$?.message?.includes("#pds/lit")||$?.message?.includes("Failed to resolve module specifier");A&&D?console.error(`\u274C PDS component <${g}> requires Lit but #pds/lit is not in import map.
|
|
27
|
+
`;let a=r.querySelector("#msg-container");typeof t=="object"&&t._$litType$?j(t,a):typeof t=="string"?a.textContent=t:j(t,a)}r.addEventListener("click",a=>{a.target.closest('button[value="cancel"]')&&(r.close(),n(!1))});let i=()=>{let a=r.querySelector("form");a?a.addEventListener("submit",c=>{c.preventDefault();let d;e.useForm&&c.submitter.value==="ok"?(console.log("Found form:",a),console.log("Form elements:",a?Array.from(a.elements):"no form"),d=new FormData(a),console.log("FormData entries:",Array.from(d.entries()))):d=c.submitter.value==="ok",r.close(),n(d)}):requestAnimationFrame(i)};i(),r.addEventListener("close",()=>{setTimeout(()=>r.remove(),200)}),document.body.appendChild(r),typeof e.rendered=="function"&&e.rendered(r),r.showModal()})}async function Mt(){let t=document.querySelector("pds-toaster");return t||(t=document.createElement("pds-toaster"),document.body.appendChild(t),await customElements.whenDefined("pds-toaster")),t}async function C(t,e={}){return(await Mt()).toast(t,e)}C.success=async function(t,e={}){return C(t,{...e,type:"success"})};C.error=async function(t,e={}){return C(t,{...e,type:"error"})};C.warning=async function(t,e={}){return C(t,{...e,type:"warning"})};C.info=async function(t,e={}){return C(t,{...e,type:"information"})};var Tt=[{selector:".accordion"},{selector:"nav[data-dropdown]"},{selector:"label[data-toggle]"},{selector:'input[type="range"]'},{selector:"form[data-required]"},{selector:"fieldset[role=group][data-open]"},{selector:"button, a[class*='btn-']"}];function Ut(t){t.dataset.enhancedAccordion||(t.dataset.enhancedAccordion="true",t.addEventListener("toggle",e=>{e.target.open&&e.target.parentElement===t&&t.querySelectorAll(":scope > details[open]").forEach(s=>{s!==e.target&&(s.open=!1)})},!0))}function Ot(t){if(t.dataset.enhancedDropdown)return;t.dataset.enhancedDropdown="true";let e=t.querySelector("menu");if(!e)return;let s=t.querySelector("[data-dropdown-toggle]")||t.querySelector("button");s&&!s.hasAttribute("type")&&s.setAttribute("type","button"),e.id||(e.id=`dropdown-${Math.random().toString(36).slice(2,9)}`),e.setAttribute("role",e.getAttribute("role")||"menu"),e.hasAttribute("aria-hidden")||e.setAttribute("aria-hidden","true"),s&&(s.setAttribute("aria-haspopup","true"),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-expanded","false"));let n=()=>{let a=(t.getAttribute("data-mode")||"auto").toLowerCase();if(a==="up"||a==="down")return a;let c=t.getBoundingClientRect(),d=Math.max(0,window.innerHeight-c.bottom);return Math.max(0,c.top)>d?"up":"down"},r=()=>{t.dataset.dropdownDirection=n(),e.setAttribute("aria-hidden","false"),s?.setAttribute("aria-expanded","true")},o=()=>{e.setAttribute("aria-hidden","true"),s?.setAttribute("aria-expanded","false")},i=()=>{e.getAttribute("aria-hidden")==="false"?o():r()};s?.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),i()}),document.addEventListener("click",a=>{t.contains(a.target)||o()}),t.addEventListener("keydown",a=>{a.key==="Escape"&&(o(),s?.focus())}),t.addEventListener("focusout",a=>{(!a.relatedTarget||!t.contains(a.relatedTarget))&&o()})}function Nt(t){if(t.dataset.enhancedToggle)return;t.dataset.enhancedToggle="true";let e=t.querySelector('input[type="checkbox"]');if(!e)return;t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.setAttribute("role","switch"),t.setAttribute("aria-checked",e.checked?"true":"false");let s=document.createElement("span");s.className="toggle-switch",s.setAttribute("role","presentation"),s.setAttribute("aria-hidden","true");let n=document.createElement("span");n.className="toggle-knob",s.appendChild(n),t.insertBefore(s,e.nextSibling);let r=()=>{t.setAttribute("aria-checked",e.checked?"true":"false")},o=()=>{e.disabled||(e.checked=!e.checked,r(),e.dispatchEvent(new Event("change",{bubbles:!0})))};t.addEventListener("click",i=>{i.preventDefault(),o()}),t.addEventListener("keydown",i=>{(i.key===" "||i.key==="Enter")&&(i.preventDefault(),o())}),e.addEventListener("change",r)}function jt(t){if(t.dataset.enhancedRange)return;let e=t.closest("label"),s=e?.classList.contains("range-output"),n=t.id||`range-${Math.random().toString(36).substring(2,11)}`,r=`${n}-output`;if(t.id=n,s){let o=e.querySelector("span");if(o&&!o.classList.contains("range-output-wrapper")){let i=document.createElement("span");i.className="range-output-wrapper",i.style.display="flex",i.style.justifyContent="space-between",i.style.alignItems="center";let a=document.createElement("span");a.textContent=o.textContent,i.appendChild(a);let c=document.createElement("output");c.id=r,c.setAttribute("for",n),c.style.color="var(--surface-text-secondary, var(--color-text-secondary))",c.style.fontSize="0.875rem",c.textContent=t.value,i.appendChild(c),o.textContent="",o.appendChild(i);let d=()=>{c.textContent=t.value};t.addEventListener("input",d)}}else{let o=t.closest(".range-container");o||(o=document.createElement("div"),o.className="range-container",t.parentNode?.insertBefore(o,t),o.appendChild(t)),o.style.position="relative";let i=document.createElement("output");i.id=r,i.setAttribute("for",n),i.className="range-bubble",i.setAttribute("aria-live","polite"),o.appendChild(i);let a=()=>{let l=parseFloat(t.min)||0,u=parseFloat(t.max)||100,f=parseFloat(t.value),m=(f-l)/(u-l);i.style.left=`calc(${m*100}% )`,i.textContent=String(f)},c=()=>i.classList.add("visible"),d=()=>i.classList.remove("visible");t.addEventListener("input",a),t.addEventListener("pointerdown",c),t.addEventListener("pointerup",d),t.addEventListener("pointerleave",d),t.addEventListener("focus",c),t.addEventListener("blur",d),a()}t.dataset.enhancedRange="1"}function qt(t){if(t.dataset.enhancedRequired)return;t.dataset.enhancedRequired="true";let e=s=>{let n=s.closest("label");if(!n||n.querySelector(".required-asterisk"))return;let r=document.createElement("span");r.classList.add("required-asterisk"),r.textContent="*",r.style.marginLeft="4px",n.querySelector("span").appendChild(r);let o=s.closest("form");if(o&&!o.querySelector(".required-legend")){let i=document.createElement("small");i.classList.add("required-legend"),i.textContent="* Required fields",o.insertBefore(i,o.querySelector(".form-actions")||o.lastElementChild)}};t.querySelectorAll("[required]").forEach(s=>{e(s)})}function Ht(t){if(t.dataset.enhancedOpenGroup)return;t.dataset.enhancedOpenGroup="true",t.classList.add("flex","flex-wrap","buttons");let e=document.createElement("input");e.type="text",e.placeholder="Add item...",e.classList.add("input-text","input-sm"),e.style.width="auto";let s=t.querySelector('input[type="radio"], input[type="checkbox"]');t.appendChild(e),e.addEventListener("keydown",n=>{if(n.key==="Enter"||n.key==="Tab"){let r=e.value.trim();if(r){n.preventDefault();let o=s.type==="radio"?"radio":"checkbox",i=`open-group-${Math.random().toString(36).substring(2,11)}`,a=document.createElement("label"),c=document.createElement("span");c.setAttribute("data-label",""),c.textContent=r;let d=document.createElement("input");d.type=o,d.name=s.name||t.getAttribute("data-name")||"open-group",d.value=r,d.id=i,a.appendChild(c),a.appendChild(d),t.insertBefore(a,e),e.value=""}}else if(n.key==="Backspace"&&e.value===""){n.preventDefault();let r=t.querySelectorAll("label");r.length>0&&r[r.length-1].remove()}})}function It(t){if(t.dataset.enhancedBtnWorking)return;t.dataset.enhancedBtnWorking="true";let e=null,s=!1;new MutationObserver(r=>{r.forEach(o=>{if(o.attributeName==="class"){let i=t.classList.contains("btn-working"),a=t.querySelector("pds-icon");if(i)if(a)e||(e=a.getAttribute("icon")),a.setAttribute("icon","circle-notch");else{let c=document.createElement("pds-icon");c.setAttribute("icon","circle-notch"),c.setAttribute("size","sm"),t.insertBefore(c,t.firstChild),s=!0}else o.oldValue?.includes("btn-working")&&a&&(s?(a.remove(),s=!1):e&&(a.setAttribute("icon",e),e=null))}})}).observe(t,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0})}var zt=new Map([[".accordion",Ut],["nav[data-dropdown]",Ot],["label[data-toggle]",Nt],['input[type="range"]',jt],["form[data-required]",qt],["fieldset[role=group][data-open]",Ht],["button, a[class*='btn-']",It]]),xe=Tt.map(t=>({...t,run:zt.get(t.selector)||(()=>{})}));var ot="pds",Bt=/^([a-z][a-z0-9+\-.]*:)?\/\//i,rt=/^[a-z]:/i;function se(t=""){return t.endsWith("/")?t:`${t}/`}function Ft(t="",e=ot){let s=t.replace(/\/+$/,"");return new RegExp(`(?:^|/)${e}$`,"i").test(s)?s:`${s}/${e}`}function Wt(t){return t.replace(/^\.\/+/,"")}function Vt(t){return rt.test(t)?t.replace(rt,"").replace(/^\/+/,""):t}function Kt(t){return t.startsWith("public/")?t.substring(7):t}function Re(t,e={}){let s=e.segment||ot,n=e.defaultRoot||`/assets/${s}/`,r=t?.public&&t.public?.root||t?.static&&t.static?.root||null;if(!r||typeof r!="string")return se(n);let o=r.trim();return o?(o=o.replace(/\\/g,"/"),o=Ft(o,s),o=se(o),Bt.test(o)?o:(o=Wt(o),o=Vt(o),o.startsWith("/")||(o=Kt(o),o.startsWith("/")||(o=`/${o}`),o=o.replace(/\/+/g,(i,a)=>a===0?i:"/")),se(o))):se(n)}var Zt=/^[a-z][a-z0-9+\-.]*:\/\//i,ne=(()=>{try{return import.meta.url}catch{return}})(),ue=t=>typeof t=="string"&&t.length&&!t.endsWith("/")?`${t}/`:t;function pe(t,e={}){if(!t||Zt.test(t))return t;let{preferModule:s=!0}=e,n=()=>{if(!ne)return null;try{return new URL(t,ne).href}catch{return null}},r=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(t,window.location.origin).href}catch{return null}};return(s?n()||r():r()||n())||t}var ct=(()=>{if(ne)try{let t=new URL(ne);if(/\/public\/assets\/js\//.test(t.pathname))return new URL("../pds/",ne).href}catch{return}})(),lt=!1;function dt(t){lt||typeof document>"u"||(lt=!0,t.addEventListener("pds:ready",e=>{let s=e.detail?.mode;s&&document.documentElement.classList.add(`pds-${s}`,"pds-ready")}))}function ut(t={},e={}){if(!e||typeof e!="object")return t;let s=Array.isArray(t)?[...t]:{...t};for(let[n,r]of Object.entries(e))r&&typeof r=="object"&&!Array.isArray(r)?s[n]=ut(s[n]&&typeof s[n]=="object"?s[n]:{},r):s[n]=r;return s}function ke(t=""){return String(t).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function G(t){if(t==null)return t;if(typeof t=="function")return;if(typeof t!="object")return t;if(Array.isArray(t))return t.map(s=>G(s)).filter(s=>s!==void 0);let e={};for(let s in t)if(t.hasOwnProperty(s)){let n=t[s];if(typeof n!="function"){let r=G(n);r!==void 0&&(e[s]=r)}}return e}function pt(t={},e={},{presets:s,defaultLog:n}){let r=typeof t=="object"&&("colors"in t||"typography"in t||"spatialRhythm"in t||"shape"in t||"behavior"in t||"layout"in t||"advanced"in t||"a11y"in t||"components"in t||"icons"in t),o=t&&t.enhancers;o&&!Array.isArray(o)&&(o=Object.values(o));let i=o??e.enhancers??[],a=t&&t.preset,c=t&&t.design,d="preset"in(t||{})||"design"in(t||{})||"enhancers"in(t||{}),l,u=null;if(d){let f=String(a||"default").toLowerCase(),m=s?.[f]||Object.values(s||{}).find(R=>ke(R.name)===f||String(R.name||"").toLowerCase()===f);if(!m)throw new Error(`PDS preset not found: "${a||"default"}"`);u={id:m.id||ke(m.name),name:m.name||m.id||String(f)};let $=structuredClone(m);if(c&&typeof c=="object"){let R=G(c);$=ut($,structuredClone(R))}let{mode:x,autoDefine:g,applyGlobalStyles:w,manageTheme:H,themeStorageKey:A,preloadStyles:D,criticalLayers:L,managerURL:Z,manager:I,preset:oe,design:E,enhancers:M,log:z,..._}=t;l={..._,design:$,preset:u.name,log:z||n}}else if(r){let{log:f,...m}=t;l={design:structuredClone(m),log:f||n}}else{let f=s?.default||Object.values(s||{}).find(m=>ke(m.name)==="default");if(!f)throw new Error("PDS default preset not available");u={id:f.id||"default",name:f.name||"Default"},l={design:structuredClone(f),preset:u.name,log:n}}return{generatorConfig:l,enhancers:i,presetInfo:u}}function ht({manageTheme:t,themeStorageKey:e,applyResolvedTheme:s,setupSystemListenerIfNeeded:n}){let r="light",o=null;if(t&&typeof window<"u"){try{o=localStorage.getItem(e)||null}catch{o=null}try{s?.(o),n?.(o)}catch{}o?o==="system"?r=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":r=o:r=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:r,storedTheme:o}}function De(t,{resolvePublicAssetURL:e}){let s=!!(t?.public?.root||t?.static?.root),n=e(t);return!s&&ct&&(n=ct),ue(pe(n))}async function ft(t,{baseEnhancers:e=[]}={}){let{autoDefineBaseURL:s="/auto-define/",autoDefinePreload:n=[],autoDefineMapper:r=null,enhancers:o=[],autoDefineOverrides:i=null,autoDefinePreferModule:a=!0}=t,c=(()=>{let l=new Map;return(e||[]).forEach(u=>l.set(u.selector,u)),(o||[]).forEach(u=>l.set(u.selector,u)),Array.from(l.values())})(),d=null;if(typeof window<"u"&&typeof document<"u"){let l=null;try{let g=await Promise.resolve().then(()=>(at(),it));l=g?.AutoDefiner||g?.default?.AutoDefiner||g?.default||null}catch(g){console.warn("AutoDefiner not available:",g?.message||g)}let u=g=>{switch(g){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${g}.js`}},{mapper:f,...m}=i&&typeof i=="object"?i:{},x={baseURL:s&&ue(pe(s,{preferModule:a})),predefine:n,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:c,onError:(g,w)=>{if(typeof g=="string"&&g.startsWith("pds-")){let A=["pds-form","pds-drawer"].includes(g),D=w?.message?.includes("#pds/lit")||w?.message?.includes("Failed to resolve module specifier");A&&D?console.error(`\u274C PDS component <${g}> requires Lit but #pds/lit is not in import map.
|
|
28
28
|
Add this to your HTML <head>:
|
|
29
29
|
<script type="importmap">
|
|
30
30
|
{ "imports": { "#pds/lit": "./path/to/lit.js" } }
|
|
31
31
|
<\/script>
|
|
32
|
-
See: https://github.com/pure-ds/core#lit-components`):console.warn(`\u26A0\uFE0F PDS component <${g}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${g}
|
|
32
|
+
See: https://github.com/pure-ds/core#lit-components`):console.warn(`\u26A0\uFE0F PDS component <${g}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${g}>:`,w)},...m,mapper:g=>{if(customElements.get(g))return null;if(typeof r=="function")try{let w=r(g);return w===void 0?u(g):w}catch(w){return console.warn("Custom autoDefine.mapper error; falling back to default:",w?.message||w),u(g)}return u(g)}};l&&(d=new l(x),n.length>0&&typeof l.define=="function"&&await l.define(...n,{baseURL:s,mapper:x.mapper,onError:x.onError}))}return{autoDefiner:d,mergedEnhancers:c}}var Ue=class extends EventTarget{},b=new Ue;b.initializing=!1;b.currentPreset=null;b.debug=!1;var mt=(t="")=>String(t).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Me=function(t="log",e,...s){let n=!!(b.registry&&!b.registry.isLive),r=(this?.debug||this?.design?.debug||b.debug||!1)===!0;if(n){if(!b.debug)return}else if(!r&&t!=="error"&&t!=="warn")return;let o=console[t]||console.log;s.length>0?o(e,...s):o(e)};async function Jt(t,e={}){if(e?.runtimeConfig===!1||typeof fetch!="function")return null;let s=e?.runtimeConfigURL||`${t}pds-runtime-config.json`;try{let n=await fetch(s,{cache:"no-store"});return n.ok?await n.json():null}catch{return null}}b.registry=F;b.adoptLayers=Ne;b.adoptPrimitives=Oe;b.createStylesheet=je;b.isLiveMode=()=>F.isLive;b.ask=nt;b.toast=C;function yt(t){let e=typeof CustomEvent=="function";try{let s=e?new CustomEvent("pds:ready",{detail:t}):new Event("pds:ready");b.dispatchEvent(s)}catch{}if(typeof document<"u")if(e){let s={detail:t,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",s))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",s))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}typeof window<"u"&&(window.PDS=b);var Te="pure-ds-theme",q=null,re=null;function he(t){try{if(typeof document>"u")return;let e="light";t?t==="system"?e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e=t:e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",e)}catch{}}function fe(t){try{if(q&&re){try{typeof q.removeEventListener=="function"?q.removeEventListener("change",re):typeof q.removeListener=="function"&&q.removeListener(re)}catch{}q=null,re=null}if(t==="system"&&typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),s=n=>{let r=n?.matches===void 0?e.matches:n.matches;try{let o=r?"dark":"light";document.documentElement.setAttribute("data-theme",o),b.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:o,source:"system"}}))}catch{}};q=e,re=s,typeof e.addEventListener=="function"?e.addEventListener("change",s):typeof e.addListener=="function"&&e.addListener(s)}}catch{}}Object.defineProperty(b,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(Te)||null}catch{return null}},set(t){try{if(typeof window>"u")return;t==null?localStorage.removeItem(Te):localStorage.setItem(Te,t),he(t),fe(t),b.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:t,source:"api"}}))}catch{}}});b.defaultEnhancers=xe;async function Qt(t){let e=t&&t.mode||"live",{mode:s,...n}=t||{};if(e==="static")return Xt(n);let r=De(n,{resolvePublicAssetURL:Re}),o=n?.managerURL||n?.public?.managerURL||n?.manager?.url||new URL("core/pds-manager.js",r).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:i}=await import(o);return i(b,n,{emitReady:yt,applyResolvedTheme:he,setupSystemListenerIfNeeded:fe})}b.start=Qt;async function Xt(t){if(!t||typeof t!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let e=t.applyGlobalStyles??!0,s=t.manageTheme??!0,n=t.themeStorageKey??"pure-ds-theme",r=t.staticPaths??{},o=De(t,{resolvePublicAssetURL:Re}),i=t&&t.autoDefine||null,a;i&&i.baseURL?a=ue(pe(i.baseURL,{preferModule:!1})):a=`${o}components/`;let c=i&&Array.isArray(i.predefine)&&i.predefine||[],d=i&&typeof i.mapper=="function"&&i.mapper||null;try{dt(b);let{resolvedTheme:l}=ht({manageTheme:s,themeStorageKey:n,applyResolvedTheme:he,setupSystemListenerIfNeeded:fe}),u=await Jt(o,t),f=u?.config?.design||u?.design||null,m=u?.config?.preset||u?.preset||"default",$=u?.presetId||mt(m)||"default",x=f?{[String($).toLowerCase()]:f,...String($).toLowerCase()!=="default"?{default:f}:{}}:null,g=t?.design&&typeof t.design=="object"?G(t.design):null,w=mt(t?.preset||"default")||"default",H=g?{[String(w).toLowerCase()]:g,...String(w).toLowerCase()!=="default"?{default:g}:{}}:null,A=x||t?.presets||H||{};if(!Object.keys(A||{}).length)throw new Error("PDS static mode requires preset data. Run pds:build or provide config.presets/config.design.");let D=u?.config?{...u.config,...t,preset:t?.preset||$,design:g||f||u?.config?.design}:t,L=pt(D,{},{presets:A,defaultLog:Me}),Z=L.enhancers,I={tokens:`${o}styles/pds-tokens.css.js`,primitives:`${o}styles/pds-primitives.css.js`,components:`${o}styles/pds-components.css.js`,utilities:`${o}styles/pds-utilities.css.js`,styles:`${o}styles/pds-styles.css.js`},oe=u?.paths||{};if(r={...I,...oe,...r},b.registry.setStaticMode(r),e&&typeof document<"u")try{let _=await b.registry.getStylesheet("styles");if(_){_._pds=!0;let R=(document.adoptedStyleSheets||[]).filter(p=>p._pds!==!0);document.adoptedStyleSheets=[...R,_]}}catch(_){Me.call(b,"warn","Failed to apply static styles:",_)}let E=null,M=[];try{let _=await ft({autoDefineBaseURL:a,autoDefinePreload:c,autoDefineMapper:d,enhancers:Z,autoDefineOverrides:i||null,autoDefinePreferModule:!(i&&i.baseURL)},{baseEnhancers:xe});E=_.autoDefiner,M=_.mergedEnhancers||[]}catch(_){Me.call(b,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",_)}let z=G(t);return b.currentConfig=Object.freeze({mode:"static",...structuredClone(z),design:structuredClone(L.generatorConfig.design),preset:L.generatorConfig.preset,theme:l,enhancers:M}),yt({mode:"static",config:L.generatorConfig,theme:l,autoDefiner:E}),{config:L.generatorConfig,theme:l,autoDefiner:E}}catch(l){throw b.dispatchEvent(new CustomEvent("pds:error",{detail:{error:l}})),l}}var qs=he,Hs=fe;export{b as PDS,qs as applyResolvedTheme,Hs as setupSystemListenerIfNeeded};
|
|
33
33
|
/*! Bundled license information:
|
|
34
34
|
|
|
35
35
|
@lit/reactive-element/css-tag.js:
|
|
@@ -20,6 +20,7 @@ const PDS = window.PDS;
|
|
|
20
20
|
* @csspart content - The drawer content section
|
|
21
21
|
*/
|
|
22
22
|
class PdsDrawer extends HTMLElement {
|
|
23
|
+
static #idCounter = 0;
|
|
23
24
|
#isDragging = false;
|
|
24
25
|
#startX = 0;
|
|
25
26
|
#startY = 0;
|
|
@@ -35,6 +36,9 @@ class PdsDrawer extends HTMLElement {
|
|
|
35
36
|
#currentFraction = 0; // 0=open, 1=closed
|
|
36
37
|
#resizeObs = null;
|
|
37
38
|
#openAnimationController = null;
|
|
39
|
+
#lastFocused = null;
|
|
40
|
+
#focusTrapActive = false;
|
|
41
|
+
#titleId = `pds-drawer-title-${PdsDrawer.#idCounter++}`;
|
|
38
42
|
constructor() {
|
|
39
43
|
super();
|
|
40
44
|
this.attachShadow({ mode: "open" });
|
|
@@ -73,7 +77,6 @@ class PdsDrawer extends HTMLElement {
|
|
|
73
77
|
this._open = bool;
|
|
74
78
|
this.toggleAttribute("open", this._open);
|
|
75
79
|
if (this._open) {
|
|
76
|
-
queueMicrotask(() => this.#aside?.focus());
|
|
77
80
|
document.body.classList.add("drawer-open");
|
|
78
81
|
}
|
|
79
82
|
else {
|
|
@@ -81,6 +84,7 @@ class PdsDrawer extends HTMLElement {
|
|
|
81
84
|
}
|
|
82
85
|
this.dispatchEvent(new Event("toggle"));
|
|
83
86
|
this.#syncAria();
|
|
87
|
+
this.#syncFocusTrap();
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
/**
|
|
@@ -188,6 +192,7 @@ class PdsDrawer extends HTMLElement {
|
|
|
188
192
|
this.#animateTo(1);
|
|
189
193
|
}
|
|
190
194
|
this.#syncAria();
|
|
195
|
+
this.#syncFocusTrap();
|
|
191
196
|
break;
|
|
192
197
|
case "position":
|
|
193
198
|
this._position = value || "bottom";
|
|
@@ -403,6 +408,10 @@ class PdsDrawer extends HTMLElement {
|
|
|
403
408
|
window.removeEventListener("pointermove", this.#onPointerMove);
|
|
404
409
|
window.removeEventListener("pointerup", this.#onPointerUp);
|
|
405
410
|
window.removeEventListener("keydown", this.#onKeyDown);
|
|
411
|
+
if (this.#focusTrapActive) {
|
|
412
|
+
document.removeEventListener("focusin", this.#onFocusIn, true);
|
|
413
|
+
this.#focusTrapActive = false;
|
|
414
|
+
}
|
|
406
415
|
if (window.visualViewport)
|
|
407
416
|
window.visualViewport.removeEventListener("resize", this.#recalc);
|
|
408
417
|
window.removeEventListener("resize", this.#recalc);
|
|
@@ -567,7 +576,23 @@ class PdsDrawer extends HTMLElement {
|
|
|
567
576
|
#onBackdropClick = () => this.closeDrawer();
|
|
568
577
|
|
|
569
578
|
#onKeyDown = (e) => {
|
|
570
|
-
if (this.open
|
|
579
|
+
if (!this.open) return;
|
|
580
|
+
if (e.key === "Escape") {
|
|
581
|
+
this.closeDrawer();
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
if (e.key === "Tab") {
|
|
585
|
+
this.#trapTabFocus(e);
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
#onFocusIn = (e) => {
|
|
590
|
+
if (!this.open) return;
|
|
591
|
+
const target = e.target;
|
|
592
|
+
const inShadow = this.shadowRoot?.contains(target);
|
|
593
|
+
const inLight = this.contains(target);
|
|
594
|
+
if (inShadow || inLight) return;
|
|
595
|
+
this.#focusInitial();
|
|
571
596
|
};
|
|
572
597
|
|
|
573
598
|
#onPointerDown = (e) => {
|
|
@@ -837,6 +862,7 @@ class PdsDrawer extends HTMLElement {
|
|
|
837
862
|
this._open = isOpen;
|
|
838
863
|
this.toggleAttribute("open", isOpen);
|
|
839
864
|
this.#syncAria();
|
|
865
|
+
this.#syncFocusTrap();
|
|
840
866
|
}
|
|
841
867
|
}
|
|
842
868
|
|
|
@@ -848,11 +874,125 @@ class PdsDrawer extends HTMLElement {
|
|
|
848
874
|
if (this._open) {
|
|
849
875
|
aside.setAttribute('role', 'dialog');
|
|
850
876
|
aside.setAttribute('aria-modal', 'true');
|
|
877
|
+
const headerSlot = this.shadowRoot?.querySelector('slot[name="drawer-header"]');
|
|
878
|
+
const assigned = headerSlot?.assignedElements?.({ flatten: true }) || [];
|
|
879
|
+
if (assigned.length > 0) {
|
|
880
|
+
const labelEl = assigned[0];
|
|
881
|
+
if (!labelEl.id) labelEl.id = this.#titleId;
|
|
882
|
+
aside.setAttribute('aria-labelledby', labelEl.id);
|
|
883
|
+
aside.removeAttribute('aria-label');
|
|
884
|
+
} else if (!aside.hasAttribute('aria-label')) {
|
|
885
|
+
aside.setAttribute('aria-label', 'Drawer');
|
|
886
|
+
aside.removeAttribute('aria-labelledby');
|
|
887
|
+
}
|
|
851
888
|
} else {
|
|
852
889
|
aside.removeAttribute('role');
|
|
853
890
|
aside.removeAttribute('aria-modal');
|
|
891
|
+
aside.removeAttribute('aria-labelledby');
|
|
892
|
+
aside.removeAttribute('aria-label');
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
#syncFocusTrap() {
|
|
898
|
+
if (!this.isConnected) return;
|
|
899
|
+
if (this._open) {
|
|
900
|
+
if (!this.#lastFocused) {
|
|
901
|
+
this.#lastFocused = this.#getDocumentActiveElement();
|
|
902
|
+
}
|
|
903
|
+
if (!this.#focusTrapActive) {
|
|
904
|
+
document.addEventListener("focusin", this.#onFocusIn, true);
|
|
905
|
+
this.#focusTrapActive = true;
|
|
906
|
+
}
|
|
907
|
+
queueMicrotask(() => this.#focusInitial());
|
|
908
|
+
} else {
|
|
909
|
+
if (this.#focusTrapActive) {
|
|
910
|
+
document.removeEventListener("focusin", this.#onFocusIn, true);
|
|
911
|
+
this.#focusTrapActive = false;
|
|
854
912
|
}
|
|
913
|
+
const toRestore = this.#lastFocused;
|
|
914
|
+
this.#lastFocused = null;
|
|
915
|
+
if (toRestore && document.contains(toRestore)) {
|
|
916
|
+
queueMicrotask(() => toRestore.focus?.({ preventScroll: true }));
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
#getDocumentActiveElement() {
|
|
922
|
+
const active = document.activeElement;
|
|
923
|
+
if (active === this && this.shadowRoot?.activeElement) {
|
|
924
|
+
return this.shadowRoot.activeElement;
|
|
855
925
|
}
|
|
926
|
+
return active;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
#focusInitial() {
|
|
930
|
+
const focusables = this.#getFocusableElements();
|
|
931
|
+
if (focusables.length > 0) {
|
|
932
|
+
focusables[0].focus({ preventScroll: true });
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
this.#aside?.focus({ preventScroll: true });
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
#trapTabFocus(e) {
|
|
939
|
+
const focusables = this.#getFocusableElements();
|
|
940
|
+
if (focusables.length === 0) {
|
|
941
|
+
e.preventDefault();
|
|
942
|
+
this.#aside?.focus({ preventScroll: true });
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
const active = this.#getDocumentActiveElement();
|
|
947
|
+
const first = focusables[0];
|
|
948
|
+
const last = focusables[focusables.length - 1];
|
|
949
|
+
const inDrawer = (active && (this.contains(active) || this.shadowRoot?.contains(active))) || false;
|
|
950
|
+
|
|
951
|
+
if (!inDrawer) {
|
|
952
|
+
e.preventDefault();
|
|
953
|
+
first.focus({ preventScroll: true });
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
if (e.shiftKey) {
|
|
958
|
+
if (active === first || !focusables.includes(active)) {
|
|
959
|
+
e.preventDefault();
|
|
960
|
+
last.focus({ preventScroll: true });
|
|
961
|
+
}
|
|
962
|
+
} else {
|
|
963
|
+
if (active === last) {
|
|
964
|
+
e.preventDefault();
|
|
965
|
+
first.focus({ preventScroll: true });
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
#getFocusableElements() {
|
|
971
|
+
const selector = [
|
|
972
|
+
'a[href]',
|
|
973
|
+
'area[href]',
|
|
974
|
+
'button:not([disabled])',
|
|
975
|
+
'input:not([disabled]):not([type="hidden"])',
|
|
976
|
+
'select:not([disabled])',
|
|
977
|
+
'textarea:not([disabled])',
|
|
978
|
+
'details > summary:first-of-type',
|
|
979
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
980
|
+
].join(',');
|
|
981
|
+
|
|
982
|
+
const shadowEls = this.shadowRoot
|
|
983
|
+
? Array.from(this.shadowRoot.querySelectorAll(selector))
|
|
984
|
+
: [];
|
|
985
|
+
const lightEls = Array.from(this.querySelectorAll(selector));
|
|
986
|
+
const all = shadowEls.concat(lightEls);
|
|
987
|
+
|
|
988
|
+
return all.filter((el) => {
|
|
989
|
+
if (!el) return false;
|
|
990
|
+
if (el.hasAttribute('disabled')) return false;
|
|
991
|
+
if (el.getAttribute('aria-hidden') === 'true') return false;
|
|
992
|
+
if (el.closest('[inert]')) return false;
|
|
993
|
+
const rects = el.getClientRects();
|
|
994
|
+
return rects.length > 0;
|
|
995
|
+
});
|
|
856
996
|
}
|
|
857
997
|
}
|
|
858
998
|
customElements.define("pds-drawer", PdsDrawer);
|
package/readme.md
CHANGED
|
@@ -253,160 +253,9 @@ It all starts with your `pds.confog.js` file in the root of the project (auto-ge
|
|
|
253
253
|
---
|
|
254
254
|
|
|
255
255
|
## Getting Started
|
|
256
|
+
See the full step-by-step guide in [getting-started.md](getting-started.md).
|
|
256
257
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
npm install @pure-ds/core
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
**Post-install automation:**
|
|
264
|
-
|
|
265
|
-
During installation, PDS automatically:
|
|
266
|
-
- Creates a default `pds.config.js` (if one doesn't exist)
|
|
267
|
-
- Copies Copilot/AI instructions to `.github/copilot-instructions.md`
|
|
268
|
-
- Adds `pds:build` and `pds:build-icons` scripts to your `package.json`
|
|
269
|
-
- Runs `pds:build` to generate static assets
|
|
270
|
-
|
|
271
|
-
To manually re-sync assets:
|
|
272
|
-
|
|
273
|
-
```bash
|
|
274
|
-
npm run pds:build
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
### Lit Import Convention
|
|
278
|
-
|
|
279
|
-
PDS uses a virtual import for Lit so you control the resolution:
|
|
280
|
-
|
|
281
|
-
```javascript
|
|
282
|
-
import { html, css, LitElement } from '#pds/lit';
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
**In browsers (no bundler)** - Use import maps:
|
|
286
|
-
|
|
287
|
-
```html
|
|
288
|
-
<script type="importmap">
|
|
289
|
-
{
|
|
290
|
-
"imports": {
|
|
291
|
-
"#pds/lit": "/assets/js/lit.js"
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
</script>
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
**In bundlers** - Alias to the real `lit` package:
|
|
298
|
-
|
|
299
|
-
```javascript
|
|
300
|
-
// vite.config.js
|
|
301
|
-
export default {
|
|
302
|
-
resolve: {
|
|
303
|
-
alias: { '#pds/lit': 'lit' }
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
### Quick Start: Live Mode
|
|
309
|
-
|
|
310
|
-
Generate styles at runtime with instant updates:
|
|
311
|
-
|
|
312
|
-
```javascript
|
|
313
|
-
import { PDS } from '@pure-ds/core';
|
|
314
|
-
|
|
315
|
-
await PDS.start({
|
|
316
|
-
mode: 'live',
|
|
317
|
-
preset: 'default', // or: ocean-breeze, midnight-steel, etc.
|
|
318
|
-
|
|
319
|
-
// Override preset values
|
|
320
|
-
design: {
|
|
321
|
-
colors: {
|
|
322
|
-
primary: '#007acc',
|
|
323
|
-
secondary: '#5c2d91'
|
|
324
|
-
},
|
|
325
|
-
typography: {
|
|
326
|
-
fontFamilyHeadings: 'Inter, sans-serif',
|
|
327
|
-
fontFamilyBody: 'Inter, sans-serif'
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
|
|
331
|
-
// Component auto-loading
|
|
332
|
-
autoDefine: {
|
|
333
|
-
predefine: ['pds-icon'] // Eagerly load these
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
// Use components - they'll lazy-load automatically
|
|
338
|
-
// <pds-drawer id="menu"></pds-drawer>
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
### Quick Start: Static Mode
|
|
342
|
-
|
|
343
|
-
Pre-generate assets for production:
|
|
344
|
-
|
|
345
|
-
**1. Build static files:**
|
|
346
|
-
|
|
347
|
-
```bash
|
|
348
|
-
npm run pds:build
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
This creates:
|
|
352
|
-
- `pds/styles/pds-*.css` and `pds-*.css.js` (Constructable Stylesheets)
|
|
353
|
-
- `pds/components/*.js` (Web Components)
|
|
354
|
-
- `pds/icons/pds-icons.svg` (Icon sprite)
|
|
355
|
-
- `pds/custom-elements.json` (Custom Elements Manifest for IDE integration)
|
|
356
|
-
|
|
357
|
-
**2. Initialize in static mode:**
|
|
358
|
-
|
|
359
|
-
```javascript
|
|
360
|
-
import { PDS } from '@pure-ds/core';
|
|
361
|
-
|
|
362
|
-
await PDS.start({
|
|
363
|
-
mode: 'static',
|
|
364
|
-
preset: 'default',
|
|
365
|
-
|
|
366
|
-
staticPaths: {
|
|
367
|
-
tokens: '/pds/styles/pds-tokens.css.js',
|
|
368
|
-
primitives: '/pds/styles/pds-primitives.css.js',
|
|
369
|
-
components: '/pds/styles/pds-components.css.js',
|
|
370
|
-
utilities: '/pds/styles/pds-utilities.css.js',
|
|
371
|
-
styles: '/pds/styles/pds-styles.css.js'
|
|
372
|
-
},
|
|
373
|
-
});
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
### Minimal Example
|
|
377
|
-
|
|
378
|
-
```html
|
|
379
|
-
<!DOCTYPE html>
|
|
380
|
-
<html lang="en">
|
|
381
|
-
<head>
|
|
382
|
-
<meta charset="UTF-8">
|
|
383
|
-
<title>PDS App</title>
|
|
384
|
-
<script type="importmap">
|
|
385
|
-
{
|
|
386
|
-
"imports": {
|
|
387
|
-
"#pds/lit": "/assets/js/lit.js"
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
</script>
|
|
391
|
-
</head>
|
|
392
|
-
<body>
|
|
393
|
-
<button class="btn-primary">
|
|
394
|
-
<pds-icon icon="heart"></pds-icon>
|
|
395
|
-
Click me
|
|
396
|
-
</button>
|
|
397
|
-
|
|
398
|
-
<script type="module">
|
|
399
|
-
import { PDS } from '/assets/js/pds.js';
|
|
400
|
-
|
|
401
|
-
await PDS.start({
|
|
402
|
-
design: {
|
|
403
|
-
colors: { primary: '#007acc' }
|
|
404
|
-
}
|
|
405
|
-
});
|
|
406
|
-
</script>
|
|
407
|
-
</body>
|
|
408
|
-
</html>
|
|
409
|
-
```
|
|
258
|
+
This covers the project starter, existing-project setup, CDN usage, Storybook, and core conventions.
|
|
410
259
|
|
|
411
260
|
---
|
|
412
261
|
|
|
@@ -1292,9 +1141,6 @@ const theme = PDS.theme; // 'light' | 'dark' | 'system' | null
|
|
|
1292
1141
|
PDS.theme = 'dark';
|
|
1293
1142
|
PDS.theme = 'system'; // Follows OS preference
|
|
1294
1143
|
PDS.theme = null; // Remove preference
|
|
1295
|
-
|
|
1296
|
-
// Or use method
|
|
1297
|
-
await PDS.setTheme('dark');
|
|
1298
1144
|
```
|
|
1299
1145
|
|
|
1300
1146
|
Theme is stored in localStorage and updates `html[data-theme]` automatically.
|
|
@@ -1461,10 +1307,6 @@ Adopt primitives layer (convenience method).
|
|
|
1461
1307
|
|
|
1462
1308
|
Create constructable stylesheet from CSS string.
|
|
1463
1309
|
|
|
1464
|
-
### PDS.setTheme(theme)
|
|
1465
|
-
|
|
1466
|
-
Change theme programmatically.
|
|
1467
|
-
|
|
1468
1310
|
### PDS Properties
|
|
1469
1311
|
|
|
1470
1312
|
```typescript
|
|
@@ -1977,7 +1819,7 @@ await PDS.start({
|
|
|
1977
1819
|
Enable theme management:
|
|
1978
1820
|
```javascript
|
|
1979
1821
|
await PDS.start({ manageTheme: true });
|
|
1980
|
-
|
|
1822
|
+
PDS.theme = 'dark';
|
|
1981
1823
|
```
|
|
1982
1824
|
|
|
1983
1825
|
### Fonts Not Loading
|
|
@@ -2017,7 +1859,7 @@ npm run dev
|
|
|
2017
1859
|
- 🌐 **Homepage:** https://puredesignsystem.z6.web.core.windows.net/
|
|
2018
1860
|
- 📦 **NPM:** https://www.npmjs.com/package/pure-ds
|
|
2019
1861
|
- 🐙 **GitHub:** https://github.com/mvneerven/pure-ds
|
|
2020
|
-
- 📖 **Docs:** [
|
|
1862
|
+
- 📖 **Docs:** [getting-started.md](./getting-started.md) | [PDS-QUERY-SYSTEM.md](./PDS-QUERY-SYSTEM.md)
|
|
2021
1863
|
- 💬 **Discussions:** https://github.com/mvneerven/pure-ds/discussions
|
|
2022
1864
|
- 🐛 **Issues:** https://github.com/mvneerven/pure-ds/issues
|
|
2023
1865
|
|