@pure-ds/core 0.5.3 → 0.5.5
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/public/assets/js/pds.d.ts +2 -2
- package/dist/types/src/js/pds-core/pds-start-helpers.d.ts.map +1 -1
- package/package.json +1 -1
- package/packages/pds-cli/bin/pds-static.js +12 -0
- package/public/assets/js/app.js +21 -21
- package/public/assets/js/pds-manager.js +1 -1
- package/public/assets/js/pds.js +10 -10
- package/src/js/pds-core/pds-start-helpers.js +1 -4
- package/src/js/pds.js +81 -3
|
@@ -3238,7 +3238,7 @@ export const ${t}CSS = \`${a}\`;
|
|
|
3238
3238
|
<button class="btn-primary btn-working">
|
|
3239
3239
|
<span>Saving</span>
|
|
3240
3240
|
</button>
|
|
3241
|
-
`.trim()}];function Ie(n){n.dataset.enhancedAccordion||(n.dataset.enhancedAccordion="true",n.addEventListener("toggle",t=>{t.target.open&&t.target.parentElement===n&&n.querySelectorAll(":scope > details[open]").forEach(e=>{e!==t.target&&(e.open=!1)})},!0))}function Ue(n){if(n.dataset.enhancedDropdown)return;n.dataset.enhancedDropdown="true";let t=n.querySelector("menu");if(!t)return;let e=n.querySelector("[data-dropdown-toggle]")||n.querySelector("button");e&&!e.hasAttribute("type")&&e.setAttribute("type","button"),t.id||(t.id=`dropdown-${Math.random().toString(36).slice(2,9)}`),t.setAttribute("role",t.getAttribute("role")||"menu"),t.hasAttribute("aria-hidden")||t.setAttribute("aria-hidden","true"),e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-controls",t.id),e.setAttribute("aria-expanded","false"));let a=()=>{let c=(n.getAttribute("data-mode")||"auto").toLowerCase();if(c==="up"||c==="down")return c;let l=n.getBoundingClientRect(),d=Math.max(0,window.innerHeight-l.bottom);return Math.max(0,l.top)>d?"up":"down"},r=()=>{n.dataset.dropdownDirection=a(),t.setAttribute("aria-hidden","false"),e?.setAttribute("aria-expanded","true")},o=()=>{t.setAttribute("aria-hidden","true"),e?.setAttribute("aria-expanded","false")},i=()=>{t.getAttribute("aria-hidden")==="false"?o():r()};e?.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),i()}),document.addEventListener("click",c=>{n.contains(c.target)||o()}),n.addEventListener("keydown",c=>{c.key==="Escape"&&(o(),e?.focus())}),n.addEventListener("focusout",c=>{(!c.relatedTarget||!n.contains(c.relatedTarget))&&o()})}function Oe(n){if(n.dataset.enhancedToggle)return;n.dataset.enhancedToggle="true";let t=n.querySelector('input[type="checkbox"]');if(!t)return;n.hasAttribute("tabindex")||n.setAttribute("tabindex","0"),n.setAttribute("role","switch"),n.setAttribute("aria-checked",t.checked?"true":"false");let e=document.createElement("span");e.className="toggle-switch",e.setAttribute("role","presentation"),e.setAttribute("aria-hidden","true");let a=document.createElement("span");a.className="toggle-knob",e.appendChild(a),n.insertBefore(e,t.nextSibling);let r=()=>{n.setAttribute("aria-checked",t.checked?"true":"false")},o=()=>{t.disabled||(t.checked=!t.checked,r(),t.dispatchEvent(new Event("change",{bubbles:!0})))};n.addEventListener("click",i=>{i.preventDefault(),o()}),n.addEventListener("keydown",i=>{(i.key===" "||i.key==="Enter")&&(i.preventDefault(),o())}),t.addEventListener("change",r)}function He(n){if(n.dataset.enhancedRange)return;let t=n.closest("label"),e=t?.classList.contains("range-output"),a=n.id||`range-${Math.random().toString(36).substring(2,11)}`,r=`${a}-output`;if(n.id=a,e){let o=t.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 c=document.createElement("span");c.textContent=o.textContent,i.appendChild(c);let l=document.createElement("output");l.id=r,l.setAttribute("for",a),l.style.color="var(--surface-text-secondary, var(--color-text-secondary))",l.style.fontSize="0.875rem",l.textContent=n.value,i.appendChild(l),o.textContent="",o.appendChild(i);let d=()=>{l.textContent=n.value};n.addEventListener("input",d)}}else{let o=n.closest(".range-container");o||(o=document.createElement("div"),o.className="range-container",n.parentNode?.insertBefore(o,n),o.appendChild(n)),o.style.position="relative";let i=document.createElement("output");i.id=r,i.setAttribute("for",a),i.className="range-bubble",i.setAttribute("aria-live","polite"),o.appendChild(i);let c=()=>{let s=parseFloat(n.min)||0,p=parseFloat(n.max)||100,g=parseFloat(n.value),h=(g-s)/(p-s);i.style.left=`calc(${h*100}% )`,i.textContent=String(g)},l=()=>i.classList.add("visible"),d=()=>i.classList.remove("visible");n.addEventListener("input",c),n.addEventListener("pointerdown",l),n.addEventListener("pointerup",d),n.addEventListener("pointerleave",d),n.addEventListener("focus",l),n.addEventListener("blur",d),c()}n.dataset.enhancedRange="1"}function qe(n){if(n.dataset.enhancedRequired)return;n.dataset.enhancedRequired="true";let t=e=>{let a=e.closest("label");if(!a||a.querySelector(".required-asterisk"))return;let r=document.createElement("span");r.classList.add("required-asterisk"),r.textContent="*",r.style.marginLeft="4px",a.querySelector("span").appendChild(r);let o=e.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)}};n.querySelectorAll("[required]").forEach(e=>{t(e)})}function Ge(n){if(n.dataset.enhancedOpenGroup)return;n.dataset.enhancedOpenGroup="true",n.classList.add("flex","flex-wrap","buttons");let t=document.createElement("input");t.type="text",t.placeholder="Add item...",t.classList.add("input-text","input-sm"),t.style.width="auto";let e=n.querySelector('input[type="radio"], input[type="checkbox"]');n.appendChild(t),t.addEventListener("keydown",a=>{if(a.key==="Enter"||a.key==="Tab"){let r=t.value.trim();if(r){a.preventDefault();let o=e.type==="radio"?"radio":"checkbox",i=`open-group-${Math.random().toString(36).substring(2,11)}`,c=document.createElement("label"),l=document.createElement("span");l.setAttribute("data-label",""),l.textContent=r;let d=document.createElement("input");d.type=o,d.name=e.name||n.getAttribute("data-name")||"open-group",d.value=r,d.id=i,c.appendChild(l),c.appendChild(d),n.insertBefore(c,t),t.value=""}}else if(a.key==="Backspace"&&t.value===""){a.preventDefault();let r=n.querySelectorAll("label");r.length>0&&r[r.length-1].remove()}})}function _e(n){if(n.dataset.enhancedBtnWorking)return;n.dataset.enhancedBtnWorking="true";let t=null,e=!1;new MutationObserver(r=>{r.forEach(o=>{if(o.attributeName==="class"){let i=n.classList.contains("btn-working"),c=n.querySelector("pds-icon");if(i)if(c)t||(t=c.getAttribute("icon")),c.setAttribute("icon","circle-notch");else{let l=document.createElement("pds-icon");l.setAttribute("icon","circle-notch"),l.setAttribute("size","sm"),n.insertBefore(l,n.firstChild),e=!0}else o.oldValue?.includes("btn-working")&&c&&(e?(c.remove(),e=!1):t&&(c.setAttribute("icon",t),t=null))}})}).observe(n,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0})}var Ve=new Map([[".accordion",Ie],["nav[data-dropdown]",Ue],["label[data-toggle]",Oe],['input[type="range"]',He],["form[data-required]",qe],["fieldset[role=group][data-open]",Ge],["button, a[class*='btn-']",_e]]),pe=Pe.map(n=>({...n,run:Ve.get(n.selector)||(()=>{})}));var ge="pds",Qe=/^([a-z][a-z0-9+\-.]*:)?\/\//i,ue=/^[a-z]:/i;function U(n=""){return n.endsWith("/")?n:`${n}/`}function Ze(n="",t=ge){let e=n.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(e)?e:`${e}/${t}`}function Je(n){return n.replace(/^\.\/+/,"")}function Ye(n){return ue.test(n)?n.replace(ue,"").replace(/^\/+/,""):n}function Ke(n){return n.startsWith("public/")?n.substring(7):n}function me(n,t={}){let e=t.segment||ge,a=t.defaultRoot||`/assets/${e}/`,r=n?.public&&n.public?.root||n?.static&&n.static?.root||null;if(!r||typeof r!="string")return U(a);let o=r.trim();return o?(o=o.replace(/\\/g,"/"),o=Ze(o,e),o=U(o),Qe.test(o)?o:(o=Je(o),o=Ye(o),o.startsWith("/")||(o=Ke(o),o.startsWith("/")||(o=`/${o}`),o=o.replace(/\/+/g,(i,c)=>c===0?i:"/")),U(o))):U(a)}function he(n){let t=n.replace(/['"]/g,"").trim();if(["system-ui","-apple-system","sans-serif","serif","monospace","cursive","fantasy","ui-sans-serif","ui-serif","ui-monospace","ui-rounded"].includes(t.toLowerCase()))return!0;let r=document.createElement("canvas").getContext("2d");if(!r)return!1;let o="mmmmmmmmmmlli",i="72px",c="monospace";r.font=`${i} ${c}`;let l=r.measureText(o).width;r.font=`${i} "${t}", ${c}`;let d=r.measureText(o).width;return l!==d}function Xe(n){return n?n.split(",").map(a=>a.trim())[0].replace(/['"]/g,"").trim():null}async function et(n,t={}){if(!n)return Promise.resolve();let{weights:e=[400,500,600,700],italic:a=!1}=t,r=Xe(n);if(!r||he(r))return Promise.resolve();let o=encodeURIComponent(r);return document.querySelector(`link[href*="fonts.googleapis.com"][href*="${o}"]`)?(console.log(`Font "${r}" is already loading or loaded`),Promise.resolve()):(console.log(`Loading font "${r}" from Google Fonts...`),new Promise((c,l)=>{let d=document.createElement("link");d.rel="stylesheet";let s=a?`ital,wght@0,${e.join(";0,")};1,${e.join(";1,")}`:`wght@${e.join(";")}`;d.href=`https://fonts.googleapis.com/css2?family=${o}:${s}&display=swap`,d.setAttribute("data-font-loader",r),d.onload=()=>{console.log(`Successfully loaded font "${r}"`),c()},d.onerror=()=>{console.warn(`Failed to load font "${r}" from Google Fonts`),l(new Error(`Failed to load font: ${r}`))},document.head.appendChild(d),setTimeout(()=>{he(r)||console.warn(`Font "${r}" did not load within timeout`),c()},5e3)}))}async function fe(n){if(!n)return Promise.resolve();let t=new Set;n.fontFamilyHeadings&&t.add(n.fontFamilyHeadings),n.fontFamilyBody&&t.add(n.fontFamilyBody),n.fontFamilyMono&&t.add(n.fontFamilyMono);let e=Array.from(t).map(a=>et(a).catch(r=>{console.warn(`Could not load font: ${a}`,r)}));await Promise.all(e)}var rt=/^[a-z][a-z0-9+\-.]*:\/\//i,O=(()=>{try{return import.meta.url}catch{return}})(),Q=n=>typeof n=="string"&&n.length&&!n.endsWith("/")?`${n}/`:n;function Z(n,t={}){if(!n||rt.test(n))return n;let{preferModule:e=!0}=t,a=()=>{if(!O)return null;try{return new URL(n,O).href}catch{return null}},r=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(n,window.location.origin).href}catch{return null}};return(e?a()||r():r()||a())||n}var ve=(()=>{if(O)try{let n=new URL(O);if(/\/public\/assets\/js\//.test(n.pathname))return new URL("../pds/",O).href}catch{return}})(),xe=!1;function we(n){xe||typeof document>"u"||(xe=!0,n.addEventListener("pds:ready",t=>{let e=t.detail?.mode;e&&(document.documentElement.classList.add(`pds-${e}`),e==="live"&&document.documentElement.classList.add("pds-ready"))}))}function ke(n={},t={}){if(!t||typeof t!="object")return n;let e=Array.isArray(n)?[...n]:{...n};for(let[a,r]of Object.entries(t))r&&typeof r=="object"&&!Array.isArray(r)?e[a]=ke(e[a]&&typeof e[a]=="object"?e[a]:{},r):e[a]=r;return e}function te(n=""){return String(n).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function H(n){if(n==null)return n;if(typeof n=="function")return;if(typeof n!="object")return n;if(Array.isArray(n))return n.map(e=>H(e)).filter(e=>e!==void 0);let t={};for(let e in n)if(n.hasOwnProperty(e)){let a=n[e];if(typeof a!="function"){let r=H(a);r!==void 0&&(t[e]=r)}}return t}function Se(n={},t={},{presets:e,defaultLog:a}){let r=typeof n=="object"&&("colors"in n||"typography"in n||"spatialRhythm"in n||"shape"in n||"behavior"in n||"layout"in n||"advanced"in n||"a11y"in n||"components"in n||"icons"in n),o=n&&n.enhancers;o&&!Array.isArray(o)&&(o=Object.values(o));let i=o??t.enhancers??[],c=n&&n.preset,l=n&&n.design,d="preset"in(n||{})||"design"in(n||{})||"enhancers"in(n||{}),s,p=null;if(d){let g=String(c||"default").toLowerCase(),h=e?.[g]||Object.values(e||{}).find(A=>te(A.name)===g||String(A.name||"").toLowerCase()===g);if(!h)throw new Error(`PDS preset not found: "${c||"default"}"`);p={id:h.id||te(h.name),name:h.name||h.id||String(g)};let v=structuredClone(h);if(l&&typeof l=="object"){let A=H(l);v=ke(v,structuredClone(A))}let{mode:x,autoDefine:m,applyGlobalStyles:w,manageTheme:F,themeStorageKey:k,preloadStyles:T,criticalLayers:R,managerURL:B,manager:j,preset:$,design:S,enhancers:E,log:L,...G}=n;s={...G,design:v,preset:p.name,log:L||a}}else if(r){let{log:g,...h}=n;s={design:structuredClone(h),log:g||a}}else{let g=e?.default||Object.values(e||{}).find(h=>te(h.name)==="default");if(!g)throw new Error("PDS default preset not available");p={id:g.id||"default",name:g.name||"Default"},s={design:structuredClone(g),preset:p.name,log:a}}return{generatorConfig:s,enhancers:i,presetInfo:p}}function $e({manageTheme:n,themeStorageKey:t,applyResolvedTheme:e,setupSystemListenerIfNeeded:a}){let r="light",o=null;if(n&&typeof window<"u"){try{o=localStorage.getItem(t)||null}catch{o=null}try{e?.(o),a?.(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 ze(n,{resolvePublicAssetURL:t}){let e=!!(n?.public?.root||n?.static?.root),a=t(n);return!e&&ve&&(a=ve),Q(Z(a))}async function Me(n,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:e="/auto-define/",autoDefinePreload:a=[],autoDefineMapper:r=null,enhancers:o=[],autoDefineOverrides:i=null,autoDefinePreferModule:c=!0}=n,l=(()=>{let s=new Map;return(t||[]).forEach(p=>s.set(p.selector,p)),(o||[]).forEach(p=>s.set(p.selector,p)),Array.from(s.values())})(),d=null;if(typeof window<"u"&&typeof document<"u"){let s=null;try{let m=await Promise.resolve().then(()=>(ye(),be));s=m?.AutoDefiner||m?.default?.AutoDefiner||m?.default||null}catch(m){console.warn("AutoDefiner not available:",m?.message||m)}let p=m=>{switch(m){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${m}.js`}},{mapper:g,...h}=i&&typeof i=="object"?i:{},x={baseURL:e&&Q(Z(e,{preferModule:c})),predefine:a,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:l,onError:(m,w)=>{if(typeof m=="string"&&m.startsWith("pds-")){let k=["pds-form","pds-drawer"].includes(m),T=w?.message?.includes("#pds/lit")||w?.message?.includes("Failed to resolve module specifier");k&&T?console.error(`\u274C PDS component <${m}> requires Lit but #pds/lit is not in import map.
|
|
3241
|
+
`.trim()}];function Ie(n){n.dataset.enhancedAccordion||(n.dataset.enhancedAccordion="true",n.addEventListener("toggle",t=>{t.target.open&&t.target.parentElement===n&&n.querySelectorAll(":scope > details[open]").forEach(e=>{e!==t.target&&(e.open=!1)})},!0))}function Ue(n){if(n.dataset.enhancedDropdown)return;n.dataset.enhancedDropdown="true";let t=n.querySelector("menu");if(!t)return;let e=n.querySelector("[data-dropdown-toggle]")||n.querySelector("button");e&&!e.hasAttribute("type")&&e.setAttribute("type","button"),t.id||(t.id=`dropdown-${Math.random().toString(36).slice(2,9)}`),t.setAttribute("role",t.getAttribute("role")||"menu"),t.hasAttribute("aria-hidden")||t.setAttribute("aria-hidden","true"),e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-controls",t.id),e.setAttribute("aria-expanded","false"));let a=()=>{let c=(n.getAttribute("data-mode")||"auto").toLowerCase();if(c==="up"||c==="down")return c;let l=n.getBoundingClientRect(),d=Math.max(0,window.innerHeight-l.bottom);return Math.max(0,l.top)>d?"up":"down"},r=()=>{n.dataset.dropdownDirection=a(),t.setAttribute("aria-hidden","false"),e?.setAttribute("aria-expanded","true")},o=()=>{t.setAttribute("aria-hidden","true"),e?.setAttribute("aria-expanded","false")},i=()=>{t.getAttribute("aria-hidden")==="false"?o():r()};e?.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),i()}),document.addEventListener("click",c=>{n.contains(c.target)||o()}),n.addEventListener("keydown",c=>{c.key==="Escape"&&(o(),e?.focus())}),n.addEventListener("focusout",c=>{(!c.relatedTarget||!n.contains(c.relatedTarget))&&o()})}function Oe(n){if(n.dataset.enhancedToggle)return;n.dataset.enhancedToggle="true";let t=n.querySelector('input[type="checkbox"]');if(!t)return;n.hasAttribute("tabindex")||n.setAttribute("tabindex","0"),n.setAttribute("role","switch"),n.setAttribute("aria-checked",t.checked?"true":"false");let e=document.createElement("span");e.className="toggle-switch",e.setAttribute("role","presentation"),e.setAttribute("aria-hidden","true");let a=document.createElement("span");a.className="toggle-knob",e.appendChild(a),n.insertBefore(e,t.nextSibling);let r=()=>{n.setAttribute("aria-checked",t.checked?"true":"false")},o=()=>{t.disabled||(t.checked=!t.checked,r(),t.dispatchEvent(new Event("change",{bubbles:!0})))};n.addEventListener("click",i=>{i.preventDefault(),o()}),n.addEventListener("keydown",i=>{(i.key===" "||i.key==="Enter")&&(i.preventDefault(),o())}),t.addEventListener("change",r)}function He(n){if(n.dataset.enhancedRange)return;let t=n.closest("label"),e=t?.classList.contains("range-output"),a=n.id||`range-${Math.random().toString(36).substring(2,11)}`,r=`${a}-output`;if(n.id=a,e){let o=t.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 c=document.createElement("span");c.textContent=o.textContent,i.appendChild(c);let l=document.createElement("output");l.id=r,l.setAttribute("for",a),l.style.color="var(--surface-text-secondary, var(--color-text-secondary))",l.style.fontSize="0.875rem",l.textContent=n.value,i.appendChild(l),o.textContent="",o.appendChild(i);let d=()=>{l.textContent=n.value};n.addEventListener("input",d)}}else{let o=n.closest(".range-container");o||(o=document.createElement("div"),o.className="range-container",n.parentNode?.insertBefore(o,n),o.appendChild(n)),o.style.position="relative";let i=document.createElement("output");i.id=r,i.setAttribute("for",a),i.className="range-bubble",i.setAttribute("aria-live","polite"),o.appendChild(i);let c=()=>{let s=parseFloat(n.min)||0,p=parseFloat(n.max)||100,g=parseFloat(n.value),h=(g-s)/(p-s);i.style.left=`calc(${h*100}% )`,i.textContent=String(g)},l=()=>i.classList.add("visible"),d=()=>i.classList.remove("visible");n.addEventListener("input",c),n.addEventListener("pointerdown",l),n.addEventListener("pointerup",d),n.addEventListener("pointerleave",d),n.addEventListener("focus",l),n.addEventListener("blur",d),c()}n.dataset.enhancedRange="1"}function qe(n){if(n.dataset.enhancedRequired)return;n.dataset.enhancedRequired="true";let t=e=>{let a=e.closest("label");if(!a||a.querySelector(".required-asterisk"))return;let r=document.createElement("span");r.classList.add("required-asterisk"),r.textContent="*",r.style.marginLeft="4px",a.querySelector("span").appendChild(r);let o=e.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)}};n.querySelectorAll("[required]").forEach(e=>{t(e)})}function Ge(n){if(n.dataset.enhancedOpenGroup)return;n.dataset.enhancedOpenGroup="true",n.classList.add("flex","flex-wrap","buttons");let t=document.createElement("input");t.type="text",t.placeholder="Add item...",t.classList.add("input-text","input-sm"),t.style.width="auto";let e=n.querySelector('input[type="radio"], input[type="checkbox"]');n.appendChild(t),t.addEventListener("keydown",a=>{if(a.key==="Enter"||a.key==="Tab"){let r=t.value.trim();if(r){a.preventDefault();let o=e.type==="radio"?"radio":"checkbox",i=`open-group-${Math.random().toString(36).substring(2,11)}`,c=document.createElement("label"),l=document.createElement("span");l.setAttribute("data-label",""),l.textContent=r;let d=document.createElement("input");d.type=o,d.name=e.name||n.getAttribute("data-name")||"open-group",d.value=r,d.id=i,c.appendChild(l),c.appendChild(d),n.insertBefore(c,t),t.value=""}}else if(a.key==="Backspace"&&t.value===""){a.preventDefault();let r=n.querySelectorAll("label");r.length>0&&r[r.length-1].remove()}})}function _e(n){if(n.dataset.enhancedBtnWorking)return;n.dataset.enhancedBtnWorking="true";let t=null,e=!1;new MutationObserver(r=>{r.forEach(o=>{if(o.attributeName==="class"){let i=n.classList.contains("btn-working"),c=n.querySelector("pds-icon");if(i)if(c)t||(t=c.getAttribute("icon")),c.setAttribute("icon","circle-notch");else{let l=document.createElement("pds-icon");l.setAttribute("icon","circle-notch"),l.setAttribute("size","sm"),n.insertBefore(l,n.firstChild),e=!0}else o.oldValue?.includes("btn-working")&&c&&(e?(c.remove(),e=!1):t&&(c.setAttribute("icon",t),t=null))}})}).observe(n,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0})}var Ve=new Map([[".accordion",Ie],["nav[data-dropdown]",Ue],["label[data-toggle]",Oe],['input[type="range"]',He],["form[data-required]",qe],["fieldset[role=group][data-open]",Ge],["button, a[class*='btn-']",_e]]),pe=Pe.map(n=>({...n,run:Ve.get(n.selector)||(()=>{})}));var ge="pds",Qe=/^([a-z][a-z0-9+\-.]*:)?\/\//i,ue=/^[a-z]:/i;function U(n=""){return n.endsWith("/")?n:`${n}/`}function Ze(n="",t=ge){let e=n.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(e)?e:`${e}/${t}`}function Je(n){return n.replace(/^\.\/+/,"")}function Ye(n){return ue.test(n)?n.replace(ue,"").replace(/^\/+/,""):n}function Ke(n){return n.startsWith("public/")?n.substring(7):n}function me(n,t={}){let e=t.segment||ge,a=t.defaultRoot||`/assets/${e}/`,r=n?.public&&n.public?.root||n?.static&&n.static?.root||null;if(!r||typeof r!="string")return U(a);let o=r.trim();return o?(o=o.replace(/\\/g,"/"),o=Ze(o,e),o=U(o),Qe.test(o)?o:(o=Je(o),o=Ye(o),o.startsWith("/")||(o=Ke(o),o.startsWith("/")||(o=`/${o}`),o=o.replace(/\/+/g,(i,c)=>c===0?i:"/")),U(o))):U(a)}function he(n){let t=n.replace(/['"]/g,"").trim();if(["system-ui","-apple-system","sans-serif","serif","monospace","cursive","fantasy","ui-sans-serif","ui-serif","ui-monospace","ui-rounded"].includes(t.toLowerCase()))return!0;let r=document.createElement("canvas").getContext("2d");if(!r)return!1;let o="mmmmmmmmmmlli",i="72px",c="monospace";r.font=`${i} ${c}`;let l=r.measureText(o).width;r.font=`${i} "${t}", ${c}`;let d=r.measureText(o).width;return l!==d}function Xe(n){return n?n.split(",").map(a=>a.trim())[0].replace(/['"]/g,"").trim():null}async function et(n,t={}){if(!n)return Promise.resolve();let{weights:e=[400,500,600,700],italic:a=!1}=t,r=Xe(n);if(!r||he(r))return Promise.resolve();let o=encodeURIComponent(r);return document.querySelector(`link[href*="fonts.googleapis.com"][href*="${o}"]`)?(console.log(`Font "${r}" is already loading or loaded`),Promise.resolve()):(console.log(`Loading font "${r}" from Google Fonts...`),new Promise((c,l)=>{let d=document.createElement("link");d.rel="stylesheet";let s=a?`ital,wght@0,${e.join(";0,")};1,${e.join(";1,")}`:`wght@${e.join(";")}`;d.href=`https://fonts.googleapis.com/css2?family=${o}:${s}&display=swap`,d.setAttribute("data-font-loader",r),d.onload=()=>{console.log(`Successfully loaded font "${r}"`),c()},d.onerror=()=>{console.warn(`Failed to load font "${r}" from Google Fonts`),l(new Error(`Failed to load font: ${r}`))},document.head.appendChild(d),setTimeout(()=>{he(r)||console.warn(`Font "${r}" did not load within timeout`),c()},5e3)}))}async function fe(n){if(!n)return Promise.resolve();let t=new Set;n.fontFamilyHeadings&&t.add(n.fontFamilyHeadings),n.fontFamilyBody&&t.add(n.fontFamilyBody),n.fontFamilyMono&&t.add(n.fontFamilyMono);let e=Array.from(t).map(a=>et(a).catch(r=>{console.warn(`Could not load font: ${a}`,r)}));await Promise.all(e)}var rt=/^[a-z][a-z0-9+\-.]*:\/\//i,O=(()=>{try{return import.meta.url}catch{return}})(),Q=n=>typeof n=="string"&&n.length&&!n.endsWith("/")?`${n}/`:n;function Z(n,t={}){if(!n||rt.test(n))return n;let{preferModule:e=!0}=t,a=()=>{if(!O)return null;try{return new URL(n,O).href}catch{return null}},r=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(n,window.location.origin).href}catch{return null}};return(e?a()||r():r()||a())||n}var ve=(()=>{if(O)try{let n=new URL(O);if(/\/public\/assets\/js\//.test(n.pathname))return new URL("../pds/",O).href}catch{return}})(),xe=!1;function we(n){xe||typeof document>"u"||(xe=!0,n.addEventListener("pds:ready",t=>{let e=t.detail?.mode;e&&document.documentElement.classList.add(`pds-${e}`,"pds-ready")}))}function ke(n={},t={}){if(!t||typeof t!="object")return n;let e=Array.isArray(n)?[...n]:{...n};for(let[a,r]of Object.entries(t))r&&typeof r=="object"&&!Array.isArray(r)?e[a]=ke(e[a]&&typeof e[a]=="object"?e[a]:{},r):e[a]=r;return e}function te(n=""){return String(n).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function H(n){if(n==null)return n;if(typeof n=="function")return;if(typeof n!="object")return n;if(Array.isArray(n))return n.map(e=>H(e)).filter(e=>e!==void 0);let t={};for(let e in n)if(n.hasOwnProperty(e)){let a=n[e];if(typeof a!="function"){let r=H(a);r!==void 0&&(t[e]=r)}}return t}function Se(n={},t={},{presets:e,defaultLog:a}){let r=typeof n=="object"&&("colors"in n||"typography"in n||"spatialRhythm"in n||"shape"in n||"behavior"in n||"layout"in n||"advanced"in n||"a11y"in n||"components"in n||"icons"in n),o=n&&n.enhancers;o&&!Array.isArray(o)&&(o=Object.values(o));let i=o??t.enhancers??[],c=n&&n.preset,l=n&&n.design,d="preset"in(n||{})||"design"in(n||{})||"enhancers"in(n||{}),s,p=null;if(d){let g=String(c||"default").toLowerCase(),h=e?.[g]||Object.values(e||{}).find(A=>te(A.name)===g||String(A.name||"").toLowerCase()===g);if(!h)throw new Error(`PDS preset not found: "${c||"default"}"`);p={id:h.id||te(h.name),name:h.name||h.id||String(g)};let v=structuredClone(h);if(l&&typeof l=="object"){let A=H(l);v=ke(v,structuredClone(A))}let{mode:x,autoDefine:m,applyGlobalStyles:w,manageTheme:F,themeStorageKey:k,preloadStyles:T,criticalLayers:R,managerURL:B,manager:j,preset:$,design:S,enhancers:E,log:L,...G}=n;s={...G,design:v,preset:p.name,log:L||a}}else if(r){let{log:g,...h}=n;s={design:structuredClone(h),log:g||a}}else{let g=e?.default||Object.values(e||{}).find(h=>te(h.name)==="default");if(!g)throw new Error("PDS default preset not available");p={id:g.id||"default",name:g.name||"Default"},s={design:structuredClone(g),preset:p.name,log:a}}return{generatorConfig:s,enhancers:i,presetInfo:p}}function $e({manageTheme:n,themeStorageKey:t,applyResolvedTheme:e,setupSystemListenerIfNeeded:a}){let r="light",o=null;if(n&&typeof window<"u"){try{o=localStorage.getItem(t)||null}catch{o=null}try{e?.(o),a?.(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 ze(n,{resolvePublicAssetURL:t}){let e=!!(n?.public?.root||n?.static?.root),a=t(n);return!e&&ve&&(a=ve),Q(Z(a))}async function Me(n,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:e="/auto-define/",autoDefinePreload:a=[],autoDefineMapper:r=null,enhancers:o=[],autoDefineOverrides:i=null,autoDefinePreferModule:c=!0}=n,l=(()=>{let s=new Map;return(t||[]).forEach(p=>s.set(p.selector,p)),(o||[]).forEach(p=>s.set(p.selector,p)),Array.from(s.values())})(),d=null;if(typeof window<"u"&&typeof document<"u"){let s=null;try{let m=await Promise.resolve().then(()=>(ye(),be));s=m?.AutoDefiner||m?.default?.AutoDefiner||m?.default||null}catch(m){console.warn("AutoDefiner not available:",m?.message||m)}let p=m=>{switch(m){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${m}.js`}},{mapper:g,...h}=i&&typeof i=="object"?i:{},x={baseURL:e&&Q(Z(e,{preferModule:c})),predefine:a,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:l,onError:(m,w)=>{if(typeof m=="string"&&m.startsWith("pds-")){let k=["pds-form","pds-drawer"].includes(m),T=w?.message?.includes("#pds/lit")||w?.message?.includes("Failed to resolve module specifier");k&&T?console.error(`\u274C PDS component <${m}> requires Lit but #pds/lit is not in import map.
|
|
3242
3242
|
Add this to your HTML <head>:
|
|
3243
3243
|
<script type="importmap">
|
|
3244
3244
|
{ "imports": { "#pds/lit": "./path/to/lit.js" } }
|
package/public/assets/js/pds.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var Et=Object.defineProperty;var me=(t,e)=>()=>(t&&(e=t(t=0)),e);var De=(t,e)=>{for(var s in e)Et(t,s,{get:e[s],enumerable:!0})};var ct={};De(ct,{AutoDefiner:()=>Me});async function Zt(...t){let e={};t.length&&typeof t[t.length-1]=="object"&&(e=t.pop()||{});let s=t,{baseURL:n,mapper:i=u=>`${u}.js`,onError:r=(u,l)=>console.error(`[defineWebComponents] ${u}:`,l)}=e,o=n?new URL(n,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),a=u=>u.toLowerCase().replace(/(^|-)([a-z])/g,(l,p,g)=>g.toUpperCase()),c=async u=>{try{if(customElements.get(u))return{tag:u,status:"already-defined"};let l=i(u),g=await import(l instanceof URL?l.href:new URL(l,o).href),h=g?.default??g?.[a(u)];if(!h){if(customElements.get(u))return{tag:u,status:"self-defined"};throw new Error(`No export found for ${u}. Expected default export or named export "${a(u)}".`)}return customElements.get(u)?{tag:u,status:"race-already-defined"}:(customElements.define(u,h),{tag:u,status:"defined"})}catch(l){throw r(u,l),l}};return Promise.all(s.map(c))}var Me,dt=me(()=>{Me=class{constructor(e={}){let{baseURL:s,mapper:n,onError:i,predicate:r=()=>!0,attributeModule:o="data-module",root:a=document,scanExisting:c=!0,debounceMs:u=16,observeShadows:l=!0,enhancers:p=[],patchAttachShadow:g=!0}=e,h=new Set,v=new Set,k=new Set,b=new Map,A=new WeakMap,F=new WeakMap,w=0,C=!1,H=null,fe=f=>{if(!f||!p.length)return;let y=F.get(f);y||(y=new Set,F.set(f,y));for(let m of p)if(!(!m.selector||!m.run)&&!y.has(m.selector))try{f.matches&&f.matches(m.selector)&&(m.run(f),y.add(m.selector))}catch($){console.warn(`[AutoDefiner] Error applying enhancer for selector "${m.selector}":`,$)}},te=(f,y)=>{if(!C&&!(!f||!f.includes("-"))&&!customElements.get(f)&&!v.has(f)&&!k.has(f)){if(y&&y.getAttribute){let m=y.getAttribute(o);m&&!b.has(f)&&b.set(f,m)}h.add(f),ze()}},ze=()=>{w||(w=setTimeout(ne,u))},L=f=>{if(f){if(f.nodeType===1){let y=f,m=y.tagName?.toLowerCase();m&&m.includes("-")&&!customElements.get(m)&&r(m,y)&&te(m,y),fe(y),l&&y.shadowRoot&&se(y.shadowRoot)}f.querySelectorAll&&f.querySelectorAll("*").forEach(y=>{let m=y.tagName?.toLowerCase();m&&m.includes("-")&&!customElements.get(m)&&r(m,y)&&te(m,y),fe(y),l&&y.shadowRoot&&se(y.shadowRoot)})}},se=f=>{if(!f||A.has(f))return;L(f);let y=new MutationObserver(m=>{for(let $ of m)$.addedNodes?.forEach(B=>{L(B)}),$.type==="attributes"&&$.target&&L($.target)});y.observe(f,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[o,...p.map(m=>m.selector).filter(m=>m.startsWith("data-"))]}),A.set(f,y)};async function ne(){if(clearTimeout(w),w=0,!h.size)return;let f=Array.from(h);h.clear(),f.forEach(y=>v.add(y));try{let y=m=>b.get(m)??(n?n(m):`${m}.js`);await Zt(...f,{baseURL:s,mapper:y,onError:(m,$)=>{k.add(m),i?.(m,$)}})}catch{}finally{f.forEach(y=>v.delete(y))}}let ie=a===document?document.documentElement:a,M=new MutationObserver(f=>{for(let y of f)y.addedNodes?.forEach(m=>{L(m)}),y.type==="attributes"&&y.target&&L(y.target)});if(M.observe(ie,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[o,...p.map(f=>f.selector).filter(f=>f.startsWith("data-"))]}),l&&g&&Element.prototype.attachShadow){let f=Element.prototype.attachShadow;Element.prototype.attachShadow=function(m){let $=f.call(this,m);if(m&&m.mode==="open"){se($);let B=this.tagName?.toLowerCase();B&&B.includes("-")&&!customElements.get(B)&&te(B,this)}return $},H=()=>Element.prototype.attachShadow=f}return c&&L(ie),{stop(){C=!0,M.disconnect(),H&&H(),w&&(clearTimeout(w),w=0),A.forEach(f=>f.disconnect())},flush:ne}}static async define(...e){let s={};e.length&&typeof e[e.length-1]=="object"&&(s=e.pop()||{});let n=e,{baseURL:i,mapper:r=l=>`${l}.js`,onError:o=(l,p)=>console.error(`[defineWebComponents] ${l}:`,p)}=s,a=i?new URL(i,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),c=l=>l.toLowerCase().replace(/(^|-)([a-z])/g,(p,g,h)=>h.toUpperCase()),u=async l=>{try{if(customElements.get(l))return{tag:l,status:"already-defined"};let p=r(l),h=await import(p instanceof URL?p.href:new URL(p,a).href),v=h?.default??h?.[c(l)];if(!v){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,v),{tag:l,status:"defined"})}catch(p){throw o(l,p),p}};return Promise.all(n.map(u))}}});var d,gt=me(()=>{d={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"}}});var St={};De(St,{defaultLog:()=>Yt,presets:()=>bt});function Yt(t="log",e,...s){if(this?.debug||this?.design?.debug||!1||t==="error"||t==="warn"){let i=console[t]||console.log;s.length>0?i(e,...s):i(e)}}var bt,wt=me(()=>{gt();bt={"ocean-breeze":{id:"ocean-breeze",name:"Ocean Breeze",tags:["playful"],description:"Fresh and calming ocean-inspired palette with professional undertones",options:{liquidGlassEffects:!0,backgroundMesh:3},colors:{primary:"#0891b2",secondary:"#64748b",accent:"#06b6d4",background:"#f0f9ff",darkMode:{background:"#0c1821",secondary:"#94a3b8",primary:"#0891b2"}},typography:{baseFontSize:17,fontScale:1.5,fontFamilyHeadings:'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',fontFamilyBody:'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif'},spatialRhythm:{baseUnit:6,scaleRatio:1.2},shape:{radiusSize:d.RadiusSizes.xxlarge}},"midnight-steel":{id:"midnight-steel",name:"Midnight Steel",description:"Bold industrial aesthetic with sharp contrasts and urban edge",colors:{primary:"#3b82f6",secondary:"#52525b",accent:"#f59e0b",background:"#fafaf9",darkMode:{background:"#18181b",secondary:"#71717a",primary:"#3b82f6"}},typography:{baseFontSize:16,fontScale:1.333,fontFamilyHeadings:"'IBM Plex Sans', system-ui, -apple-system, sans-serif",fontFamilyBody:"'Inter', system-ui, -apple-system, sans-serif",fontWeightSemibold:600},spatialRhythm:{baseUnit:4,scaleRatio:1.25},shape:{radiusSize:d.RadiusSizes.small,borderWidth:d.BorderWidths.thin}},"neural-glow":{id:"neural-glow",name:"Neural Glow",description:"AI-inspired with vibrant purple-blue gradients and futuristic vibes",colors:{primary:"#8b5cf6",secondary:"#6366f1",accent:"#ec4899",background:"#faf5ff",darkMode:{background:"#0f0a1a",secondary:"#818cf8",primary:"#8b5cf6"}},typography:{baseFontSize:16,fontScale:1.618,fontFamilyHeadings:"'Space Grotesk', system-ui, sans-serif",fontFamilyBody:"'Space Grotesk', system-ui, sans-serif"},spatialRhythm:{baseUnit:4,scaleRatio:1.5},shape:{radiusSize:d.RadiusSizes.xlarge,borderWidth:d.BorderWidths.medium},behavior:{transitionSpeed:d.TransitionSpeeds.fast}},"paper-and-ink":{id:"paper-and-ink",name:"Paper & Ink",tags:["app","featured"],description:"Ultra-minimal design with focus on typography and whitespace",colors:{primary:"#171717",secondary:"#737373",accent:"#525252",background:"#ffffff",darkMode:{background:"#0a0a0a",secondary:"#a3a3a3",primary:"#737373"}},typography:{baseFontSize:18,fontScale:1.333,fontFamilyHeadings:"'Helvetica Neue', 'Arial', sans-serif",fontFamilyBody:"'Georgia', 'Times New Roman', serif",fontWeightNormal:400,fontWeightBold:700},spatialRhythm:{baseUnit:4,scaleRatio:1.2},shape:{radiusSize:d.RadiusSizes.none,borderWidth:d.BorderWidths.thin}},"sunset-paradise":{id:"sunset-paradise",name:"Sunset Paradise",description:"Warm tropical colors evoking golden hour by the beach",options:{liquidGlassEffects:!0,backgroundMesh:2},colors:{primary:"#ea580c",secondary:"#d4a373",accent:"#fb923c",background:"#fffbeb",darkMode:{background:"#1a0f0a",secondary:"#c9a482",primary:"#f97316"}},typography:{baseFontSize:16,fontScale:1.5,fontFamilyHeadings:"'Quicksand', 'Comfortaa', sans-serif",fontFamilyBody:"'Quicksand', 'Comfortaa', sans-serif"},spatialRhythm:{baseUnit:6,scaleRatio:1.5},shape:{radiusSize:d.RadiusSizes.xxlarge,borderWidth:d.BorderWidths.medium}},"retro-wave":{id:"retro-wave",name:"Retro Wave",description:"Nostalgic 80s-inspired palette with neon undertones",colors:{primary:"#c026d3",secondary:"#a78bfa",accent:"#22d3ee",background:"#fef3ff",darkMode:{background:"#1a0a1f",secondary:"#c4b5fd",primary:"#d946ef"}},typography:{baseFontSize:15,fontScale:1.5,fontFamilyHeadings:"'Orbitron', 'Impact', monospace",fontFamilyBody:"'Courier New', 'Courier', monospace",fontWeightBold:700},spatialRhythm:{baseUnit:4,scaleRatio:1.25},shape:{radiusSize:d.RadiusSizes.none,borderWidth:d.BorderWidths.thick},behavior:{transitionSpeed:d.TransitionSpeeds.instant}},"forest-canopy":{id:"forest-canopy",name:"Forest Canopy",description:"Natural earth tones with organic, calming green hues",colors:{primary:"#059669",secondary:"#78716c",accent:"#84cc16",background:"#f0fdf4",darkMode:{background:"#0a1410",secondary:"#a8a29e",primary:"#10b981"}},typography:{baseFontSize:16,fontScale:1.414,fontFamilyHeadings:"'Merriweather Sans', 'Arial', sans-serif",fontFamilyBody:"'Merriweather', 'Georgia', serif"},spatialRhythm:{baseUnit:6,scaleRatio:1.3},shape:{radiusSize:d.RadiusSizes.medium,borderWidth:d.BorderWidths.thin}},"ruby-elegance":{id:"ruby-elegance",name:"Ruby Elegance",description:"Sophisticated palette with rich ruby reds and warm accents",colors:{primary:"#dc2626",secondary:"#9ca3af",accent:"#be123c",background:"#fef2f2",darkMode:{background:"#1b0808",secondary:"#d1d5db",primary:"#ef4444"}},typography:{baseFontSize:17,fontScale:1.5,fontFamilyHeadings:"'Playfair Display', 'Georgia', serif",fontFamilyBody:"'Crimson Text', 'Garamond', serif",fontWeightNormal:400,fontWeightSemibold:600},spatialRhythm:{baseUnit:4,scaleRatio:1.333},shape:{radiusSize:d.RadiusSizes.small,borderWidth:d.BorderWidths.thin}},"desert-dawn":{id:"desert-dawn",name:"Desert Dawn",description:"Sun-baked neutrals with grounded terracotta and cool oasis accents",colors:{primary:"#b45309",secondary:"#a8a29e",accent:"#0ea5a8",background:"#fcf6ef",darkMode:{background:"#12100e",secondary:"#d1d5db",primary:"#f59e0b"}},typography:{baseFontSize:16,fontScale:1.414,fontFamilyHeadings:"'Source Sans Pro', system-ui, -apple-system, sans-serif",fontFamilyBody:"'Source Serif Pro', Georgia, serif"},spatialRhythm:{baseUnit:6,scaleRatio:1.3},shape:{radiusSize:d.RadiusSizes.medium,borderWidth:d.BorderWidths.medium}},"contrast-pro":{id:"contrast-pro",name:"Contrast Pro",description:"Accessibility-first, high-contrast UI with assertive clarity",colors:{primary:"#1f2937",secondary:"#111827",accent:"#eab308",background:"#ffffff",darkMode:{background:"#0b0f14",secondary:"#9ca3af",primary:"#9ca3af"}},typography:{baseFontSize:17,fontScale:1.2,fontFamilyHeadings:"system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",fontFamilyBody:"system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",fontWeightBold:700},spatialRhythm:{baseUnit:3,scaleRatio:1.2},shape:{radiusSize:d.RadiusSizes.small,borderWidth:d.BorderWidths.thick},behavior:{transitionSpeed:d.TransitionSpeeds.fast,focusRingWidth:4}},"pastel-play":{id:"pastel-play",name:"Pastel Play",description:"Playful pastels with soft surfaces and friendly rounded shapes",colors:{primary:"#db2777",secondary:"#a78bfa",accent:"#34d399",background:"#fff7fa",darkMode:{background:"#1a1016",secondary:"#c4b5fd",primary:"#ec4899"}},typography:{baseFontSize:16,fontScale:1.333,fontFamilyHeadings:"'Nunito', system-ui, -apple-system, sans-serif",fontFamilyBody:"'Nunito', system-ui, -apple-system, sans-serif",lineHeightRelaxed:d.LineHeights.relaxed},spatialRhythm:{baseUnit:6,scaleRatio:1.4},shape:{radiusSize:d.RadiusSizes.xxlarge,borderWidth:d.BorderWidths.thin},behavior:{transitionSpeed:d.TransitionSpeeds.slow,animationEasing:d.AnimationEasings["ease-out"]}},"brutalist-tech":{id:"brutalist-tech",name:"Brutalist Tech",description:"Stark grayscale with engineered accents and unapologetically bold structure",colors:{primary:"#111111",secondary:"#4b5563",accent:"#06b6d4",background:"#f8fafc",darkMode:{background:"#0b0b0b",secondary:"#9ca3af",primary:"#06b6d4"}},typography:{baseFontSize:15,fontScale:1.25,fontFamilyHeadings:"'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace",fontFamilyBody:"'Inter', system-ui, -apple-system, sans-serif",letterSpacingTight:-.02},spatialRhythm:{baseUnit:4,scaleRatio:1.25},shape:{radiusSize:d.RadiusSizes.none,borderWidth:d.BorderWidths.thick},behavior:{transitionSpeed:d.TransitionSpeeds.instant}},"zen-garden":{id:"zen-garden",name:"Zen Garden",description:"Soft botanicals with contemplative spacing and balanced motion",colors:{primary:"#3f6212",secondary:"#6b7280",accent:"#7c3aed",background:"#f7fbef",darkMode:{background:"#0d130a",secondary:"#a3a3a3",primary:"#84cc16"}},typography:{baseFontSize:17,fontScale:1.414,fontFamilyHeadings:"'Merriweather', Georgia, serif",fontFamilyBody:"'Noto Sans', system-ui, -apple-system, sans-serif"},spatialRhythm:{baseUnit:6,scaleRatio:1.35},shape:{radiusSize:d.RadiusSizes.large,borderWidth:d.BorderWidths.medium},behavior:{transitionSpeed:d.TransitionSpeeds.normal,animationEasing:d.AnimationEasings.ease}},"fitness-pro":{id:"fitness-pro",name:"Fitness Pro",tags:["app","featured"],description:"Health and fitness tracking aesthetic with data-driven dark surfaces and vibrant accent rings",options:{liquidGlassEffects:!0,backgroundMesh:2},colors:{primary:"#e91e63",secondary:"#78909c",accent:"#ab47bc",background:"#fafafa",darkMode:{background:"#1a1d21",secondary:"#78909c",primary:"#0a4ca4"}},typography:{baseFontSize:15,fontScale:1.25,fontFamilyHeadings:"'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif",fontFamilyBody:"'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif",fontWeightNormal:400,fontWeightMedium:500,fontWeightSemibold:600,fontWeightBold:700,lineHeightNormal:d.LineHeights.tight},spatialRhythm:{baseUnit:4,scaleRatio:1.25,containerPadding:1.25,sectionSpacing:2.5},shape:{radiusSize:d.RadiusSizes.large,borderWidth:d.BorderWidths.thin},layers:{shadowDepth:"medium",blurMedium:12},behavior:{transitionSpeed:d.TransitionSpeeds.fast,animationEasing:d.AnimationEasings["ease-out"],focusRingWidth:2}},"travel-market":{id:"travel-market",name:"Travel Market",description:"Hospitality marketplace design with clean cards, subtle shadows, and trust-building neutrals",options:{liquidGlassEffects:!0,backgroundMesh:3},colors:{primary:"#d93251",secondary:"#717171",accent:"#144990",background:"#ffffff",darkMode:{background:"#222222",secondary:"#b0b0b0",primary:"#ff5a7a"}},typography:{baseFontSize:16,fontScale:1.2,fontFamilyHeadings:"'Circular', system-ui, -apple-system, 'Segoe UI', sans-serif",fontFamilyBody:"'Circular', system-ui, -apple-system, 'Segoe UI', sans-serif",fontWeightNormal:400,fontWeightMedium:500,fontWeightSemibold:600,fontWeightBold:700,lineHeightRelaxed:d.LineHeights.relaxed},spatialRhythm:{baseUnit:4,scaleRatio:1.25,containerMaxWidth:1440,containerPadding:1.5,sectionSpacing:3},shape:{radiusSize:d.RadiusSizes.medium,borderWidth:d.BorderWidths.thin},layers:{shadowDepth:"light",blurLight:8},behavior:{transitionSpeed:d.TransitionSpeeds.normal,animationEasing:d.AnimationEasings["ease-in-out"],hoverOpacity:.9}},"mobility-app":{id:"mobility-app",name:"Mobility App",tags:["app","featured"],description:"On-demand service platform with bold typography, map-ready colors, and action-driven UI",options:{liquidGlassEffects:!0,backgroundMesh:0},colors:{primary:"#000000",secondary:"#545454",accent:"#06c167",background:"#f6f6f6",darkMode:{background:"#0f0f0f",secondary:"#8a8a8a",primary:"#06c167"}},typography:{baseFontSize:16,fontScale:1.3,fontFamilyHeadings:"'UberMove', system-ui, -apple-system, 'Segoe UI', sans-serif",fontFamilyBody:"'UberMove', system-ui, -apple-system, 'Segoe UI', sans-serif",fontWeightNormal:400,fontWeightMedium:500,fontWeightSemibold:600,fontWeightBold:700},spatialRhythm:{baseUnit:4,scaleRatio:1.25,buttonPadding:1.25,inputPadding:1},shape:{radiusSize:d.RadiusSizes.small,borderWidth:d.BorderWidths.medium},behavior:{transitionSpeed:d.TransitionSpeeds.fast,animationEasing:d.AnimationEasings["ease-out"],focusRingWidth:3},a11y:{minTouchTarget:d.TouchTargetSizes.comfortable,focusStyle:d.FocusStyles.ring}},"fintech-secure":{id:"fintech-secure",name:"Fintech Secure",description:"Financial services app UI with trust-building blues, precise spacing, and security-first design",options:{liquidGlassEffects:!1,backgroundMesh:0},colors:{primary:"#0a2540",secondary:"#425466",accent:"#00d4ff",background:"#f7fafc",darkMode:{background:"#0a1929",secondary:"#8796a5",primary:"#00d4ff"}},typography:{baseFontSize:16,fontScale:1.25,fontFamilyHeadings:"'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif",fontFamilyBody:"'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif",fontFamilyMono:"'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace",fontWeightNormal:400,fontWeightMedium:500,fontWeightSemibold:600,fontWeightBold:700},spatialRhythm:{baseUnit:4,scaleRatio:1.25,containerMaxWidth:1280,sectionSpacing:2.5},shape:{radiusSize:d.RadiusSizes.medium,borderWidth:d.BorderWidths.thin},layers:{shadowDepth:"light",blurLight:6},behavior:{transitionSpeed:d.TransitionSpeeds.fast,animationEasing:d.AnimationEasings["ease-in-out"],focusRingWidth:3,focusRingOpacity:.4},a11y:{minTouchTarget:d.TouchTargetSizes.standard,focusStyle:d.FocusStyles.ring}},"social-feed":{id:"social-feed",name:"Social Feed",tags:["app","featured"],description:"Content-first social platform with minimal chrome, bold actions, and vibrant media presentation",options:{liquidGlassEffects:!0,backgroundMesh:4},colors:{primary:"#1877f2",secondary:"#65676b",accent:"#fe2c55",background:"#ffffff",darkMode:{background:"#18191a",secondary:"#b0b3b8",primary:"#2d88ff"}},typography:{baseFontSize:15,fontScale:1.2,fontFamilyHeadings:"system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",fontFamilyBody:"system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",fontWeightNormal:400,fontWeightMedium:500,fontWeightSemibold:600,fontWeightBold:700,lineHeightNormal:d.LineHeights.relaxed},spatialRhythm:{baseUnit:4,scaleRatio:1.25,containerMaxWidth:680,sectionSpacing:1.5},shape:{radiusSize:d.RadiusSizes.medium,borderWidth:d.BorderWidths.thin},behavior:{transitionSpeed:d.TransitionSpeeds.fast,animationEasing:d.AnimationEasings["ease-out"],hoverOpacity:.85}},"enterprise-dash":{id:"enterprise-dash",tags:["app","featured"],name:"Enterprise Dashboard",description:"Data-dense business intelligence app interface with organized hierarchy and professional polish",options:{liquidGlassEffects:!1},colors:{primary:"#0066cc",secondary:"#5f6368",accent:"#1a73e8",background:"#ffffff",success:"#34a853",warning:"#fbbc04",danger:"#ea4335",darkMode:{background:"#202124",secondary:"#9aa0a6",primary:"#8ab4f8"}},typography:{baseFontSize:14,fontScale:1.2,fontFamilyHeadings:"'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif",fontFamilyBody:"'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif",fontFamilyMono:"'Roboto Mono', ui-monospace, Consolas, monospace",fontWeightNormal:400,fontWeightMedium:500,fontWeightSemibold:600,fontWeightBold:700,lineHeightNormal:d.LineHeights.tight},spatialRhythm:{baseUnit:4,scaleRatio:1.2,containerMaxWidth:1600,containerPadding:1.5,sectionSpacing:2},shape:{radiusSize:d.RadiusSizes.small,borderWidth:d.BorderWidths.thin},layers:{shadowDepth:"light",blurLight:4},behavior:{transitionSpeed:d.TransitionSpeeds.fast,animationEasing:d.AnimationEasings["ease-in-out"],focusRingWidth:2},layout:{densityCompact:.85,gridColumns:12}}};bt.default={id:"default",name:"Default",tags:["app","featured"],description:"Fresh and modern design system with balanced aesthetics and usability",options:{liquidGlassEffects:!0,backgroundMesh:4},form:{options:{widgets:{booleans:"toggle",numbers:"input",selects:"standard"},layouts:{fieldsets:"default",arrays:"default"},enhancements:{icons:!0,datalists:!0,rangeOutput:!0},validation:{showErrors:!0,validateOnChange:!1}}},colors:{primary:"#0e7490",secondary:"#a99b95",accent:"#e54271",background:"#e7e6de",darkMode:{background:"#16171a",secondary:"#8b9199",primary:"#06b6d4"},success:null,warning:"#B38600",danger:null,info:null,gradientStops:3,elevationOpacity:.05},typography:{baseFontSize:16,fontScale:1.2,fontFamilyHeadings:'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',fontFamilyBody:'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',fontFamilyMono:'ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace',fontWeightLight:d.FontWeights.light,fontWeightNormal:d.FontWeights.normal,fontWeightMedium:d.FontWeights.medium,fontWeightSemibold:d.FontWeights.semibold,fontWeightBold:d.FontWeights.bold,lineHeightTight:d.LineHeights.tight,lineHeightNormal:d.LineHeights.normal,lineHeightRelaxed:d.LineHeights.relaxed,letterSpacingTight:-.025,letterSpacingNormal:0,letterSpacingWide:.025},spatialRhythm:{baseUnit:4,scaleRatio:1.25,maxSpacingSteps:32,containerMaxWidth:1200,containerPadding:1,inputPadding:.75,buttonPadding:1,sectionSpacing:2},layers:{shadowDepth:"medium",blurLight:4,blurMedium:8,blurHeavy:16,zIndexBase:0,zIndexDropdown:1e3,zIndexSticky:1020,zIndexFixed:1030,zIndexModal:1040,zIndexPopover:1050,zIndexTooltip:1060,zIndexNotification:1070},shape:{radiusSize:d.RadiusSizes.large,borderWidth:d.BorderWidths.medium,customRadius:null},behavior:{transitionSpeed:d.TransitionSpeeds.normal,animationEasing:d.AnimationEasings["ease-out"],customTransitionSpeed:null,customEasing:null,focusRingWidth:3,focusRingOpacity:.3,hoverOpacity:.8},layout:{gridColumns:12,gridGutter:1,breakpoints:{sm:640,md:768,lg:1024,xl:1280},densityCompact:.8,densityNormal:1,densityComfortable:1.2,buttonMinHeight:d.TouchTargetSizes.standard,inputMinHeight:40,utilities:{grid:!0,flex:!0,spacing:!0,container:!0},gridSystem:{columns:[1,2,3,4,6],autoFitBreakpoints:{sm:"150px",md:"250px",lg:"350px",xl:"450px"},enableGapUtilities:!0},containerMaxWidth:"1400px",containerPadding:"var(--spacing-6)"},advanced:{linkStyle:d.LinkStyles.inline,colorDerivation:"hsl"},a11y:{minTouchTarget:d.TouchTargetSizes.standard,prefersReducedMotion:!0,focusStyle:d.FocusStyles.ring},icons:{set:"phosphor",weight:"regular",defaultSize:24,externalPath:"/assets/img/icons/",sizes:{xs:16,sm:20,md:24,lg:32,xl:48,"2xl":64},include:{navigation:["arrow-left","arrow-right","arrow-up","arrow-down","arrow-counter-clockwise","caret-left","caret-right","caret-down","caret-up","x","list","list-dashes","dots-three-vertical","dots-three","house","gear","magnifying-glass","funnel","tabs","sidebar"],actions:["plus","minus","check","trash","pencil","floppy-disk","copy","download","upload","share","link","eye","eye-slash","heart","star","bookmark","note-pencil","cursor-click","clipboard","magic-wand","sparkle"],communication:["envelope","bell","bell-ringing","bell-simple","chat-circle","phone","paper-plane-tilt","user","users","user-gear","at"],content:["image","file","file-text","file-css","file-js","folder","folder-open","book-open","camera","video-camera","play","pause","microphone","brackets-curly","code","folder-simple","grid-four","briefcase","chart-line","chart-bar","database","map-pin"],status:["info","warning","check-circle","x-circle","question","shield","shield-check","shield-warning","lock","lock-open","fingerprint","circle-notch"],time:["calendar","clock","timer","hourglass"],commerce:["shopping-cart","credit-card","currency-dollar","tag","receipt","storefront"],formatting:["text-align-left","text-align-center","text-align-right","text-b","text-italic","text-underline","list-bullets","list-numbers","text-aa"],system:["cloud","cloud-arrow-up","cloud-arrow-down","desktop","device-mobile","globe","wifi-high","battery-charging","sun","moon","moon-stars","palette","rocket","feather","square","circle","squares-four","lightning","wrench"]},spritePath:"public/assets/pds/icons/pds-icons.svg"},gap:4,debug:!1}});var ye=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:export' 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"}},N=new ye;async function Fe(t,e=[],s=null){try{let n=s?.primitivesStylesheet?s.primitivesStylesheet:await N.getStylesheet("primitives");t.adoptedStyleSheets=[n,...e]}catch(n){let i=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${i}> failed to adopt primitives:`,n),t.adoptedStyleSheets=e}}async function He(t,e=["primitives"],s=[],n=null){try{let r=(await Promise.all(e.map(async o=>{if(n)switch(o){case"tokens":return n.tokensStylesheet;case"primitives":return n.primitivesStylesheet;case"components":return n.componentsStylesheet;case"utilities":return n.utilitiesStylesheet;default:break}return N.getStylesheet(o)}))).filter(o=>o!==null);t.adoptedStyleSheets=[...r,...s]}catch(i){let r=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${r}> failed to adopt layers:`,i),t.adoptedStyleSheets=s}}function Be(t){let e=new CSSStyleSheet;return e.replaceSync(t),e}var re=globalThis,ae=re.ShadowRoot&&(re.ShadyCSS===void 0||re.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ie=Symbol(),Ne=new WeakMap,oe=class{constructor(e,s,n){if(this._$cssResult$=!0,n!==Ie)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(ae&&e===void 0){let n=s!==void 0&&s.length===1;n&&(e=Ne.get(s)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ne.set(s,e))}return e}toString(){return this.cssText}},Oe=t=>new oe(typeof t=="string"?t:t+"",void 0,Ie);var qe=(t,e)=>{if(ae)t.adoptedStyleSheets=e.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(let s of e){let n=document.createElement("style"),i=re.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=s.cssText,t.appendChild(n)}},ge=ae?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let s="";for(let n of e.cssRules)s+=n.cssText;return Oe(s)})(t):t;var{is:At,defineProperty:$t,getOwnPropertyDescriptor:_t,getOwnPropertyNames:xt,getOwnPropertySymbols:kt,getPrototypeOf:Rt}=Object,ce=globalThis,je=ce.trustedTypes,Ct=je?je.emptyScript:"",Lt=ce.reactiveElementPolyfillSupport,j=(t,e)=>t,be={toAttribute(t,e){switch(e){case Boolean:t=t?Ct: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}},Ve=(t,e)=>!At(t,e),Ge={attribute:!0,type:String,converter:be,reflect:!1,useDefault:!1,hasChanged:Ve};Symbol.metadata??=Symbol("metadata"),ce.litPropertyMetadata??=new WeakMap;var x=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=Ge){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(),i=this.getPropertyDescriptor(e,n,s);i!==void 0&&$t(this.prototype,e,i)}}static getPropertyDescriptor(e,s,n){let{get:i,set:r}=_t(this.prototype,e)??{get(){return this[s]},set(o){this[s]=o}};return{get:i,set(o){let a=i?.call(this);r?.call(this,o),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ge}static _$Ei(){if(this.hasOwnProperty(j("elementProperties")))return;let e=Rt(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=[...xt(s),...kt(s)];for(let i of n)this.createProperty(i,s[i])}let e=this[Symbol.metadata];if(e!==null){let s=litPropertyMetadata.get(e);if(s!==void 0)for(let[n,i]of s)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[s,n]of this.elementProperties){let i=this._$Eu(s,n);i!==void 0&&this._$Eh.set(i,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 i of n)s.unshift(ge(i))}else e!==void 0&&s.push(ge(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 qe(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),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){let r=(n.converter?.toAttribute!==void 0?n.converter:be).toAttribute(s,n.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,s){let n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let r=n.getPropertyOptions(i),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:be;this._$Em=i;let a=o.fromAttribute(s,r.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,s,n){if(e!==void 0){let i=this.constructor,r=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??Ve)(r,s)||n.useDefault&&n.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,s,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,s,{useDefault:n,reflect:i,wrapped:r},o){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??s??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(s=void 0),this._$AL.set(e,s)),i===!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[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[i,r]of n){let{wrapped:o}=r,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,r,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){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[j("elementProperties")]=new Map,x[j("finalized")]=new Map,Lt?.({ReactiveElement:x}),(ce.reactiveElementVersions??=[]).push("2.1.1");var _e=globalThis,de=_e.trustedTypes,Ke=de?de.createPolicy("lit-html",{createHTML:t=>t}):void 0,et="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,tt="?"+R,Mt=`<${tt}>`,T=document,V=()=>T.createComment(""),K=t=>t===null||typeof t!="object"&&typeof t!="function",xe=Array.isArray,Ut=t=>xe(t)||typeof t?.[Symbol.iterator]=="function",Se=`[
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1
|
+
var yt=Object.defineProperty;var gt=(t,e)=>()=>(t&&(e=t(t=0)),e);var bt=(t,e)=>{for(var n in e)yt(t,n,{get:e[n],enumerable:!0})};var ot={};bt(ot,{AutoDefiner:()=>Pe});async function Kt(...t){let e={};t.length&&typeof t[t.length-1]=="object"&&(e=t.pop()||{});let n=t,{baseURL:s,mapper:r=d=>`${d}.js`,onError:o=(d,l)=>console.error(`[defineWebComponents] ${d}:`,l)}=e,i=s?new URL(s,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(n.map(c))}var Pe,it=gt(()=>{Pe=class{constructor(e={}){let{baseURL:n,mapper:s,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,H=new WeakMap,E=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)&&!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),oe()}},oe=()=>{E||(E=setTimeout(z,d))},A=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||$.has(p))return;A(p);let y=new MutationObserver(h=>{for(let v of h)v.addedNodes?.forEach(B=>{A(B)}),v.type==="attributes"&&v.target&&A(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(E),E=0,!m.size)return;let p=Array.from(m);m.clear(),p.forEach(y=>w.add(y));try{let y=h=>g.get(h)??(s?s(h):`${h}.js`);await Kt(...p,{baseURL:n,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=>{A(h)}),y.type==="attributes"&&y.target&&A(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&&A(_),{stop(){D=!0,R.disconnect(),L&&L(),E&&(clearTimeout(E),E=0),$.forEach(p=>p.disconnect())},flush:z}}static async define(...e){let n={};e.length&&typeof e[e.length-1]=="object"&&(n=e.pop()||{});let s=e,{baseURL:r,mapper:o=l=>`${l}.js`,onError:i=(l,u)=>console.error(`[defineWebComponents] ${l}:`,u)}=n,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(s.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(n){console.error(`[PDS Registry] Failed to load static ${e}:`,n),console.error(`[PDS Registry] Looking for: ${this._staticPaths[e]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:export' and configured PDS.start() with the correct static.root path");let s=new CSSStyleSheet;return s.replaceSync("/* Failed to load "+e+" */"),s}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},F=new me;async function Ue(t,e=[],n=null){try{let s=n?.primitivesStylesheet?n.primitivesStylesheet:await F.getStylesheet("primitives");t.adoptedStyleSheets=[s,...e]}catch(s){let r=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${r}> failed to adopt primitives:`,s),t.adoptedStyleSheets=e}}async function Oe(t,e=["primitives"],n=[],s=null){try{let o=(await Promise.all(e.map(async i=>{if(s)switch(i){case"tokens":return s.tokensStylesheet;case"primitives":return s.primitivesStylesheet;case"components":return s.componentsStylesheet;case"utilities":return s.utilitiesStylesheet;default:break}return F.getStylesheet(i)}))).filter(i=>i!==null);t.adoptedStyleSheets=[...o,...n]}catch(r){let o=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${o}> failed to adopt layers:`,r),t.adoptedStyleSheets=n}}function Ne(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,je=Symbol(),qe=new WeakMap,ae=class{constructor(e,n,s){if(this._$cssResult$=!0,s!==je)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o,n=this.t;if(ce&&e===void 0){let s=n!==void 0&&n.length===1;s&&(e=qe.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&qe.set(n,e))}return e}toString(){return this.cssText}},He=t=>new ae(typeof t=="string"?t:t+"",void 0,je);var Ie=(t,e)=>{if(ce)t.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of e){let s=document.createElement("style"),r=ie.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=n.cssText,t.appendChild(s)}},ye=ce?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(let s of e.cssRules)n+=s.cssText;return He(n)})(t):t;var{is:wt,defineProperty:St,getOwnPropertyDescriptor:$t,getOwnPropertyNames:_t,getOwnPropertySymbols:Et,getPrototypeOf:At}=Object,le=globalThis,ze=le.trustedTypes,vt=ze?ze.emptyScript:"",Lt=le.reactiveElementPolyfillSupport,J=(t,e)=>t,ge={toAttribute(t,e){switch(e){case Boolean:t=t?vt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},Fe=(t,e)=>!wt(t,e),Be={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:Fe};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,n=Be){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){let s=Symbol(),r=this.getPropertyDescriptor(e,s,n);r!==void 0&&St(this.prototype,e,r)}}static getPropertyDescriptor(e,n,s){let{get:r,set:o}=$t(this.prototype,e)??{get(){return this[n]},set(i){this[n]=i}};return{get:r,set(i){let a=r?.call(this);o?.call(this,i),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Be}static _$Ei(){if(this.hasOwnProperty(J("elementProperties")))return;let e=At(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 n=this.properties,s=[..._t(n),...Et(n)];for(let r of s)this.createProperty(r,n[r])}let e=this[Symbol.metadata];if(e!==null){let n=litPropertyMetadata.get(e);if(n!==void 0)for(let[s,r]of n)this.elementProperties.set(s,r)}this._$Eh=new Map;for(let[n,s]of this.elementProperties){let r=this._$Eu(n,s);r!==void 0&&this._$Eh.set(r,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let n=[];if(Array.isArray(e)){let s=new Set(e.flat(1/0).reverse());for(let r of s)n.unshift(ye(r))}else e!==void 0&&n.push(ye(e));return n}static _$Eu(e,n){let s=n.attribute;return s===!1?void 0:typeof s=="string"?s: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,n=this.constructor.elementProperties;for(let s of n.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ie(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,n,s){this._$AK(e,s)}_$ET(e,n){let s=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,s);if(r!==void 0&&s.reflect===!0){let o=(s.converter?.toAttribute!==void 0?s.converter:ge).toAttribute(n,s.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,n){let s=this.constructor,r=s._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let o=s.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(n,o.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,n,s){if(e!==void 0){let r=this.constructor,o=this[e];if(s??=r.getPropertyOptions(e),!((s.hasChanged??Fe)(o,n)||s.useDefault&&s.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,s))))return;this.C(e,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,n,{useDefault:s,reflect:r,wrapped:o},i){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,i??n??this[e]),o!==!0||i!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(n=void 0),this._$AL.set(e,n)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}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 s=this.constructor.elementProperties;if(s.size>0)for(let[r,o]of s){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,n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(n)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(n)}willUpdate(e){}_$AE(e){this._$EO?.forEach(n=>n.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(n=>this._$ET(n,this[n])),this._$EM()}updated(e){}firstUpdated(e){}};P.elementStyles=[],P.shadowRootOptions={mode:"open"},P[J("elementProperties")]=new Map,P[J("finalized")]=new Map,Lt?.({ReactiveElement:P}),(le.reactiveElementVersions??=[]).push("2.1.1");var Ae=globalThis,de=Ae.trustedTypes,We=de?de.createPolicy("lit-html",{createHTML:t=>t}):void 0,Qe="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,Xe="?"+k,Ct=`<${Xe}>`,O=document,X=()=>O.createComment(""),Y=t=>t===null||typeof t!="object"&&typeof t!="function",ve=Array.isArray,xt=t=>ve(t)||typeof t?.[Symbol.iterator]=="function",be=`[
|
|
2
|
+
\f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ve=/-->/g,Ke=/>/g,T=RegExp(`>|${be}(?:([^\\s"'>=/]+)(${be}*=${be}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ge=/'/g,Ze=/"/g,Ye=/^(?:script|style|textarea|title)$/i,Le=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),ln=Le(1),dn=Le(2),un=Le(3),N=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),Je=new WeakMap,U=O.createTreeWalker(O,129);function et(t,e){if(!ve(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return We!==void 0?We.createHTML(e):e}var Rt=(t,e)=>{let n=t.length-1,s=[],r,o=e===2?"<svg>":e===3?"<math>":"",i=Q;for(let a=0;a<n;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=Ve:l[1]!==void 0?i=Ke:l[2]!==void 0?(Ye.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]==='"'?Ze:Ge):i===Ze||i===Ge?i=T:i===Ve||i===Ke?i=Q:(i=T,r=void 0);let m=i===T&&t[a+1].startsWith("/>")?" ":"";o+=i===Q?c+Ct:u>=0?(s.push(d),c.slice(0,u)+Qe+c.slice(u)+k+m):c+k+(u===-2?a:m)}return[et(t,o+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]},ee=class t{constructor({strings:e,_$litType$:n},s){let r;this.parts=[];let o=0,i=0,a=e.length-1,c=this.parts,[d,l]=Rt(e,n);if(this.el=t.createElement(d,s),U.currentNode=this.el.content,n===2||n===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(Qe)){let f=l[i++],m=r.getAttribute(u).split(k),w=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:w[2],strings:m,ctor:w[1]==="."?Se:w[1]==="?"?$e:w[1]==="@"?_e:V}),r.removeAttribute(u)}else u.startsWith(k)&&(c.push({type:6,index:o}),r.removeAttribute(u));if(Ye.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===Xe)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,n){let s=O.createElement("template");return s.innerHTML=e,s}};function W(t,e,n=t,s){if(e===N)return e;let r=s!==void 0?n._$Co?.[s]:n._$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,n,s)),s!==void 0?(n._$Co??=[])[s]=r:n._$Cl=r),r!==void 0&&(e=W(t,r._$AS(t,e.values),r,s)),e}var we=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:n},parts:s}=this._$AD,r=(e?.creationScope??O).importNode(n,!0);U.currentNode=r;let o=U.nextNode(),i=0,a=0,c=s[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 Ee(o,this,e)),this._$AV.push(d),c=s[++a]}i!==c?.index&&(o=U.nextNode(),i++)}return U.currentNode=O,r}p(e){let n=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,n),n+=s.strings.length-2):s._$AI(e[n])),n++}},te=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,s,r){this.type=2,this._$AH=S,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=W(this,e,n),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):xt(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:n,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=ee.createElement(et(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(n);else{let o=new we(r,this),i=o.u(this.options);o.p(n),this.T(i),this._$AH=o}}_$AC(e){let n=Je.get(e.strings);return n===void 0&&Je.set(e.strings,n=new ee(e)),n}k(e){ve(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,s,r=0;for(let o of e)r===n.length?n.push(s=new t(this.O(X()),this.O(X()),this,this.options)):s=n[r],s._$AI(o),r++;r<n.length&&(this._$AR(s&&s._$AB.nextSibling,r),n.length=r)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){let s=e.nextSibling;e.remove(),e=s}}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,n,s,r,o){this.type=1,this._$AH=S,this._$AN=void 0,this.element=e,this.name=n,this._$AM=r,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=S}_$AI(e,n=this,s,r){let o=this.strings,i=!1;if(o===void 0)e=W(this,e,n,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[s+c],n,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}},$e=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,n,s,r,o){super(e,n,s,r,o),this.type=5}_$AI(e,n=this){if((e=W(this,e,n,0)??S)===N)return;let s=this._$AH,r=e===S&&s!==S||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,o=e!==S&&(s===S||r);r&&this.element.removeEventListener(this.name,this,s),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)}},Ee=class{constructor(e,n,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){W(this,e)}};var Pt=Ae.litHtmlPolyfillSupport;Pt?.(ee,te),(Ae.litHtmlVersions??=[]).push("3.3.1");var q=(t,e,n)=>{let s=n?.renderBefore??e,r=s._$litPart$;if(r===void 0){let o=n?.renderBefore??null;s._$litPart$=r=new te(e.insertBefore(X(),o),o,void 0,n??{})}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 n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=q(n,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 kt=Ce.litElementPolyfillSupport;kt?.({LitElement:K});(Ce.litElementVersions??=[]).push("4.2.1");var tt={mode:"static",preset:"default",autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(t,e,...n){console[t](e,...n)}};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(s=>{let r=document.createElement("dialog");tt.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$?q(t,a):typeof t=="string"?a.textContent=t:q(t,a);let c=a.querySelector("form");if(c){r.innerHTML=`
|
|
4
4
|
<header>
|
|
5
5
|
<h2>${e.title}</h2>
|
|
6
6
|
</header>
|
|
7
|
-
`;let
|
|
7
|
+
`;let d=document.createElement("article");for(d.className="dialog-body";c.firstChild;)d.appendChild(c.firstChild);c.appendChild(d);let l=document.createElement("footer");l.innerHTML=o.join(""),c.appendChild(l),r.appendChild(c)}else r.innerHTML=`
|
|
8
8
|
<header>
|
|
9
9
|
<h2>${e.title}</h2>
|
|
10
10
|
</header>
|
|
11
11
|
<article id="msg-container"></article>
|
|
12
12
|
<footer>
|
|
13
|
-
${
|
|
13
|
+
${o.join("")}
|
|
14
14
|
</footer>
|
|
15
|
-
`,
|
|
15
|
+
`,r.querySelector("#msg-container").appendChild(a)}else{r.innerHTML=`
|
|
16
16
|
<form method="dialog">
|
|
17
17
|
<header>
|
|
18
18
|
<h2>${e.title}</h2>
|
|
@@ -21,10 +21,10 @@ var Et=Object.defineProperty;var me=(t,e)=>()=>(t&&(e=t(t=0)),e);var De=(t,e)=>{
|
|
|
21
21
|
<article id="msg-container"></article>
|
|
22
22
|
|
|
23
23
|
<footer>
|
|
24
|
-
${
|
|
24
|
+
${o.join("")}
|
|
25
25
|
</footer>
|
|
26
26
|
</form>
|
|
27
|
-
`;let a=
|
|
27
|
+
`;let a=r.querySelector("#msg-container");typeof t=="object"&&t._$litType$?q(t,a):typeof t=="string"?a.textContent=t:q(t,a)}r.addEventListener("click",a=>{a.target.closest('button[value="cancel"]')&&(r.close(),s(!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(),s(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 Dt(){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 Dt()).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 Mt=[{selector:".accordion",description:"Ensures only one <details> element can be open at a time within the accordion.",demoHtml:`
|
|
28
28
|
<div class="accordion">
|
|
29
29
|
<details>
|
|
30
30
|
<summary>Section 1</summary>
|
|
@@ -78,12 +78,12 @@ var Et=Object.defineProperty;var me=(t,e)=>()=>(t&&(e=t(t=0)),e);var De=(t,e)=>{
|
|
|
78
78
|
<button class="btn-primary btn-working">
|
|
79
79
|
<span>Saving</span>
|
|
80
80
|
</button>
|
|
81
|
-
`.trim()}];function Ft(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 Ht(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(),u=Math.max(0,window.innerHeight-c.bottom);return Math.max(0,c.top)>u?"up":"down"},i=()=>{t.dataset.dropdownDirection=n(),e.setAttribute("aria-hidden","false"),s?.setAttribute("aria-expanded","true")},r=()=>{e.setAttribute("aria-hidden","true"),s?.setAttribute("aria-expanded","false")},o=()=>{e.getAttribute("aria-hidden")==="false"?r():i()};s?.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),o()}),document.addEventListener("click",a=>{t.contains(a.target)||r()}),t.addEventListener("keydown",a=>{a.key==="Escape"&&(r(),s?.focus())}),t.addEventListener("focusout",a=>{(!a.relatedTarget||!t.contains(a.relatedTarget))&&r()})}function Bt(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 i=()=>{t.setAttribute("aria-checked",e.checked?"true":"false")},r=()=>{e.disabled||(e.checked=!e.checked,i(),e.dispatchEvent(new Event("change",{bubbles:!0})))};t.addEventListener("click",o=>{o.preventDefault(),r()}),t.addEventListener("keydown",o=>{(o.key===" "||o.key==="Enter")&&(o.preventDefault(),r())}),e.addEventListener("change",i)}function Nt(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)}`,i=`${n}-output`;if(t.id=n,s){let r=e.querySelector("span");if(r&&!r.classList.contains("range-output-wrapper")){let o=document.createElement("span");o.className="range-output-wrapper",o.style.display="flex",o.style.justifyContent="space-between",o.style.alignItems="center";let a=document.createElement("span");a.textContent=r.textContent,o.appendChild(a);let c=document.createElement("output");c.id=i,c.setAttribute("for",n),c.style.color="var(--surface-text-secondary, var(--color-text-secondary))",c.style.fontSize="0.875rem",c.textContent=t.value,o.appendChild(c),r.textContent="",r.appendChild(o);let u=()=>{c.textContent=t.value};t.addEventListener("input",u)}}else{let r=t.closest(".range-container");r||(r=document.createElement("div"),r.className="range-container",t.parentNode?.insertBefore(r,t),r.appendChild(t)),r.style.position="relative";let o=document.createElement("output");o.id=i,o.setAttribute("for",n),o.className="range-bubble",o.setAttribute("aria-live","polite"),r.appendChild(o);let a=()=>{let l=parseFloat(t.min)||0,p=parseFloat(t.max)||100,g=parseFloat(t.value),h=(g-l)/(p-l);o.style.left=`calc(${h*100}% )`,o.textContent=String(g)},c=()=>o.classList.add("visible"),u=()=>o.classList.remove("visible");t.addEventListener("input",a),t.addEventListener("pointerdown",c),t.addEventListener("pointerup",u),t.addEventListener("pointerleave",u),t.addEventListener("focus",c),t.addEventListener("blur",u),a()}t.dataset.enhancedRange="1"}function It(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 i=document.createElement("span");i.classList.add("required-asterisk"),i.textContent="*",i.style.marginLeft="4px",n.querySelector("span").appendChild(i);let r=s.closest("form");if(r&&!r.querySelector(".required-legend")){let o=document.createElement("small");o.classList.add("required-legend"),o.textContent="* Required fields",r.insertBefore(o,r.querySelector(".form-actions")||r.lastElementChild)}};t.querySelectorAll("[required]").forEach(s=>{e(s)})}function Ot(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 i=e.value.trim();if(i){n.preventDefault();let r=s.type==="radio"?"radio":"checkbox",o=`open-group-${Math.random().toString(36).substring(2,11)}`,a=document.createElement("label"),c=document.createElement("span");c.setAttribute("data-label",""),c.textContent=i;let u=document.createElement("input");u.type=r,u.name=s.name||t.getAttribute("data-name")||"open-group",u.value=i,u.id=o,a.appendChild(c),a.appendChild(u),t.insertBefore(a,e),e.value=""}}else if(n.key==="Backspace"&&e.value===""){n.preventDefault();let i=t.querySelectorAll("label");i.length>0&&i[i.length-1].remove()}})}function qt(t){if(t.dataset.enhancedBtnWorking)return;t.dataset.enhancedBtnWorking="true";let e=null,s=!1;new MutationObserver(i=>{i.forEach(r=>{if(r.attributeName==="class"){let o=t.classList.contains("btn-working"),a=t.querySelector("pds-icon");if(o)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 r.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 jt=new Map([[".accordion",Ft],["nav[data-dropdown]",Ht],["label[data-toggle]",Bt],['input[type="range"]',Nt],["form[data-required]",It],["fieldset[role=group][data-open]",Ot],["button, a[class*='btn-']",qt]]),Ce=Dt.map(t=>({...t,run:jt.get(t.selector)||(()=>{})}));var at="pds",Gt=/^([a-z][a-z0-9+\-.]*:)?\/\//i,ot=/^[a-z]:/i;function Z(t=""){return t.endsWith("/")?t:`${t}/`}function Vt(t="",e=at){let s=t.replace(/\/+$/,"");return new RegExp(`(?:^|/)${e}$`,"i").test(s)?s:`${s}/${e}`}function Kt(t){return t.replace(/^\.\/+/,"")}function Jt(t){return ot.test(t)?t.replace(ot,"").replace(/^\/+/,""):t}function Qt(t){return t.startsWith("public/")?t.substring(7):t}function Le(t,e={}){let s=e.segment||at,n=e.defaultRoot||`/assets/${s}/`,i=t?.public&&t.public?.root||t?.static&&t.static?.root||null;if(!i||typeof i!="string")return Z(n);let r=i.trim();return r?(r=r.replace(/\\/g,"/"),r=Vt(r,s),r=Z(r),Gt.test(r)?r:(r=Kt(r),r=Jt(r),r.startsWith("/")||(r=Qt(r),r.startsWith("/")||(r=`/${r}`),r=r.replace(/\/+/g,(o,a)=>a===0?o:"/")),Z(r))):Z(n)}var Xt=/^[a-z][a-z0-9+\-.]*:\/\//i,X=(()=>{try{return import.meta.url}catch{return}})(),le=t=>typeof t=="string"&&t.length&&!t.endsWith("/")?`${t}/`:t;function ue(t,e={}){if(!t||Xt.test(t))return t;let{preferModule:s=!0}=e,n=()=>{if(!X)return null;try{return new URL(t,X).href}catch{return null}},i=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(t,window.location.origin).href}catch{return null}};return(s?n()||i():i()||n())||t}var lt=(()=>{if(X)try{let t=new URL(X);if(/\/public\/assets\/js\//.test(t.pathname))return new URL("../pds/",X).href}catch{return}})(),ut=!1;function pt(t){ut||typeof document>"u"||(ut=!0,t.addEventListener("pds:ready",e=>{let s=e.detail?.mode;s&&(document.documentElement.classList.add(`pds-${s}`),s==="live"&&document.documentElement.classList.add("pds-ready"))}))}function ht(t={},e={}){if(!e||typeof e!="object")return t;let s=Array.isArray(t)?[...t]:{...t};for(let[n,i]of Object.entries(e))i&&typeof i=="object"&&!Array.isArray(i)?s[n]=ht(s[n]&&typeof s[n]=="object"?s[n]:{},i):s[n]=i;return s}function Ue(t=""){return String(t).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Y(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=>Y(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 i=Y(n);i!==void 0&&(e[s]=i)}}return e}function ft(t={},e={},{presets:s,defaultLog:n}){let i=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),r=t&&t.enhancers;r&&!Array.isArray(r)&&(r=Object.values(r));let o=r??e.enhancers??[],a=t&&t.preset,c=t&&t.design,u="preset"in(t||{})||"design"in(t||{})||"enhancers"in(t||{}),l,p=null;if(u){let g=String(a||"default").toLowerCase(),h=s?.[g]||Object.values(s||{}).find(M=>Ue(M.name)===g||String(M.name||"").toLowerCase()===g);if(!h)throw new Error(`PDS preset not found: "${a||"default"}"`);p={id:h.id||Ue(h.name),name:h.name||h.id||String(g)};let v=structuredClone(h);if(c&&typeof c=="object"){let M=Y(c);v=ht(v,structuredClone(M))}let{mode:k,autoDefine:b,applyGlobalStyles:A,manageTheme:F,themeStorageKey:w,preloadStyles:C,criticalLayers:H,managerURL:fe,manager:te,preset:ze,design:L,enhancers:se,log:ne,...ie}=t;l={...ie,design:v,preset:p.name,log:ne||n}}else if(i){let{log:g,...h}=t;l={design:structuredClone(h),log:g||n}}else{let g=s?.default||Object.values(s||{}).find(h=>Ue(h.name)==="default");if(!g)throw new Error("PDS default preset not available");p={id:g.id||"default",name:g.name||"Default"},l={design:structuredClone(g),preset:p.name,log:n}}return{generatorConfig:l,enhancers:o,presetInfo:p}}function mt({manageTheme:t,themeStorageKey:e,applyResolvedTheme:s,setupSystemListenerIfNeeded:n}){let i="light",r=null;if(t&&typeof window<"u"){try{r=localStorage.getItem(e)||null}catch{r=null}try{s?.(r),n?.(r)}catch{}r?r==="system"?i=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":i=r:i=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:i,storedTheme:r}}function Pe(t,{resolvePublicAssetURL:e}){let s=!!(t?.public?.root||t?.static?.root),n=e(t);return!s&<&&(n=lt),le(ue(n))}async function yt(t,{baseEnhancers:e=[]}={}){let{autoDefineBaseURL:s="/auto-define/",autoDefinePreload:n=[],autoDefineMapper:i=null,enhancers:r=[],autoDefineOverrides:o=null,autoDefinePreferModule:a=!0}=t,c=(()=>{let l=new Map;return(e||[]).forEach(p=>l.set(p.selector,p)),(r||[]).forEach(p=>l.set(p.selector,p)),Array.from(l.values())})(),u=null;if(typeof window<"u"&&typeof document<"u"){let l=null;try{let b=await Promise.resolve().then(()=>(dt(),ct));l=b?.AutoDefiner||b?.default?.AutoDefiner||b?.default||null}catch(b){console.warn("AutoDefiner not available:",b?.message||b)}let p=b=>{switch(b){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${b}.js`}},{mapper:g,...h}=o&&typeof o=="object"?o:{},k={baseURL:s&&le(ue(s,{preferModule:a})),predefine:n,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:c,onError:(b,A)=>{if(typeof b=="string"&&b.startsWith("pds-")){let w=["pds-form","pds-drawer"].includes(b),C=A?.message?.includes("#pds/lit")||A?.message?.includes("Failed to resolve module specifier");w&&C?console.error(`\u274C PDS component <${b}> requires Lit but #pds/lit is not in import map.
|
|
81
|
+
`.trim()}];function Tt(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(n=>{n!==e.target&&(n.open=!1)})},!0))}function Ut(t){if(t.dataset.enhancedDropdown)return;t.dataset.enhancedDropdown="true";let e=t.querySelector("menu");if(!e)return;let n=t.querySelector("[data-dropdown-toggle]")||t.querySelector("button");n&&!n.hasAttribute("type")&&n.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"),n&&(n.setAttribute("aria-haspopup","true"),n.setAttribute("aria-controls",e.id),n.setAttribute("aria-expanded","false"));let s=()=>{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=s(),e.setAttribute("aria-hidden","false"),n?.setAttribute("aria-expanded","true")},o=()=>{e.setAttribute("aria-hidden","true"),n?.setAttribute("aria-expanded","false")},i=()=>{e.getAttribute("aria-hidden")==="false"?o():r()};n?.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(),n?.focus())}),t.addEventListener("focusout",a=>{(!a.relatedTarget||!t.contains(a.relatedTarget))&&o()})}function Ot(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 n=document.createElement("span");n.className="toggle-switch",n.setAttribute("role","presentation"),n.setAttribute("aria-hidden","true");let s=document.createElement("span");s.className="toggle-knob",n.appendChild(s),t.insertBefore(n,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 Nt(t){if(t.dataset.enhancedRange)return;let e=t.closest("label"),n=e?.classList.contains("range-output"),s=t.id||`range-${Math.random().toString(36).substring(2,11)}`,r=`${s}-output`;if(t.id=s,n){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",s),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",s),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=n=>{let s=n.closest("label");if(!s||s.querySelector(".required-asterisk"))return;let r=document.createElement("span");r.classList.add("required-asterisk"),r.textContent="*",r.style.marginLeft="4px",s.querySelector("span").appendChild(r);let o=n.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(n=>{e(n)})}function jt(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 n=t.querySelector('input[type="radio"], input[type="checkbox"]');t.appendChild(e),e.addEventListener("keydown",s=>{if(s.key==="Enter"||s.key==="Tab"){let r=e.value.trim();if(r){s.preventDefault();let o=n.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=n.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(s.key==="Backspace"&&e.value===""){s.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,n=!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),n=!0}else o.oldValue?.includes("btn-working")&&a&&(n?(a.remove(),n=!1):e&&(a.setAttribute("icon",e),e=null))}})}).observe(t,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0})}var It=new Map([[".accordion",Tt],["nav[data-dropdown]",Ut],["label[data-toggle]",Ot],['input[type="range"]',Nt],["form[data-required]",qt],["fieldset[role=group][data-open]",jt],["button, a[class*='btn-']",Ht]]),xe=Mt.map(t=>({...t,run:It.get(t.selector)||(()=>{})}));var rt="pds",zt=/^([a-z][a-z0-9+\-.]*:)?\/\//i,st=/^[a-z]:/i;function ne(t=""){return t.endsWith("/")?t:`${t}/`}function Bt(t="",e=rt){let n=t.replace(/\/+$/,"");return new RegExp(`(?:^|/)${e}$`,"i").test(n)?n:`${n}/${e}`}function Ft(t){return t.replace(/^\.\/+/,"")}function Wt(t){return st.test(t)?t.replace(st,"").replace(/^\/+/,""):t}function Vt(t){return t.startsWith("public/")?t.substring(7):t}function Re(t,e={}){let n=e.segment||rt,s=e.defaultRoot||`/assets/${n}/`,r=t?.public&&t.public?.root||t?.static&&t.static?.root||null;if(!r||typeof r!="string")return ne(s);let o=r.trim();return o?(o=o.replace(/\\/g,"/"),o=Bt(o,n),o=ne(o),zt.test(o)?o:(o=Ft(o),o=Wt(o),o.startsWith("/")||(o=Vt(o),o.startsWith("/")||(o=`/${o}`),o=o.replace(/\/+/g,(i,a)=>a===0?i:"/")),ne(o))):ne(s)}var Gt=/^[a-z][a-z0-9+\-.]*:\/\//i,se=(()=>{try{return import.meta.url}catch{return}})(),ue=t=>typeof t=="string"&&t.length&&!t.endsWith("/")?`${t}/`:t;function pe(t,e={}){if(!t||Gt.test(t))return t;let{preferModule:n=!0}=e,s=()=>{if(!se)return null;try{return new URL(t,se).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(n?s()||r():r()||s())||t}var at=(()=>{if(se)try{let t=new URL(se);if(/\/public\/assets\/js\//.test(t.pathname))return new URL("../pds/",se).href}catch{return}})(),ct=!1;function lt(t){ct||typeof document>"u"||(ct=!0,t.addEventListener("pds:ready",e=>{let n=e.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function dt(t={},e={}){if(!e||typeof e!="object")return t;let n=Array.isArray(t)?[...t]:{...t};for(let[s,r]of Object.entries(e))r&&typeof r=="object"&&!Array.isArray(r)?n[s]=dt(n[s]&&typeof n[s]=="object"?n[s]:{},r):n[s]=r;return n}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(n=>G(n)).filter(n=>n!==void 0);let e={};for(let n in t)if(t.hasOwnProperty(n)){let s=t[n];if(typeof s!="function"){let r=G(s);r!==void 0&&(e[n]=r)}}return e}function ut(t={},e={},{presets:n,defaultLog:s}){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=n?.[f]||Object.values(n||{}).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:H,themeStorageKey:E,preloadStyles:D,criticalLayers:L,managerURL:Z,manager:I,preset:oe,design:A,enhancers:M,log:z,..._}=t;l={..._,design:w,preset:u.name,log:z||s}}else if(r){let{log:f,...m}=t;l={design:structuredClone(m),log:f||s}}else{let f=n?.default||Object.values(n||{}).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:s}}return{generatorConfig:l,enhancers:i,presetInfo:u}}function pt({manageTheme:t,themeStorageKey:e,applyResolvedTheme:n,setupSystemListenerIfNeeded:s}){let r="light",o=null;if(t&&typeof window<"u"){try{o=localStorage.getItem(e)||null}catch{o=null}try{n?.(o),s?.(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 n=!!(t?.public?.root||t?.static?.root),s=e(t);return!n&&at&&(s=at),ue(pe(s))}async function ht(t,{baseEnhancers:e=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:s=[],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:n&&ue(pe(n,{preferModule:a})),predefine:s,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:c,onError:(g,$)=>{if(typeof g=="string"&&g.startsWith("pds-")){let E=["pds-form","pds-drawer"].includes(g),D=$?.message?.includes("#pds/lit")||$?.message?.includes("Failed to resolve module specifier");E&&D?console.error(`\u274C PDS component <${g}> requires Lit but #pds/lit is not in import map.
|
|
82
82
|
Add this to your HTML <head>:
|
|
83
83
|
<script type="importmap">
|
|
84
84
|
{ "imports": { "#pds/lit": "./path/to/lit.js" } }
|
|
85
85
|
<\/script>
|
|
86
|
-
See: https://github.com/pure-ds/core#lit-components`):console.warn(`\u26A0\uFE0F PDS component <${
|
|
86
|
+
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}>:`,$)},...m,mapper:g=>{if(customElements.get(g))return null;if(typeof r=="function")try{let $=r(g);return $===void 0?u(g):$}catch($){return console.warn("Custom autoDefine.mapper error; falling back to default:",$?.message||$),u(g)}return u(g)}};l&&(d=new l(x),s.length>0&&typeof l.define=="function"&&await l.define(...s,{baseURL:n,mapper:x.mapper,onError:x.onError}))}return{autoDefiner:d,mergedEnhancers:c}}var Te=class extends EventTarget{},b=new Te;b.initializing=!1;b.currentPreset=null;var ft=(t="")=>String(t).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Zt=function(t="log",e,...n){if(this?.debug||this?.design?.debug||!1||t==="error"||t==="warn"){let r=console[t]||console.log;n.length>0?r(e,...n):r(e)}};async function Jt(t,e={}){if(e?.runtimeConfig===!1||typeof fetch!="function")return null;let n=e?.runtimeConfigURL||`${t}pds-runtime-config.json`;try{let s=await fetch(n,{cache:"no-store"});return s.ok?await s.json():null}catch{return null}}b.registry=F;b.adoptLayers=Oe;b.adoptPrimitives=Ue;b.createStylesheet=Ne;b.isLiveMode=()=>F.isLive;b.ask=nt;b.toast=C;function mt(t){let e=typeof CustomEvent=="function";try{let n=e?new CustomEvent("pds:ready",{detail:t}):new Event("pds:ready");b.dispatchEvent(n)}catch{}if(typeof document<"u")if(e){let n={detail:t,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{}}}Object.defineProperty(b,"currentConfig",{value:null,writable:!0,enumerable:!0,configurable:!1});typeof window<"u"&&(window.PDS=b);var Me="pure-ds-theme",j=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(j&&re){try{typeof j.removeEventListener=="function"?j.removeEventListener("change",re):typeof j.removeListener=="function"&&j.removeListener(re)}catch{}j=null,re=null}if(t==="system"&&typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),n=s=>{let r=s?.matches===void 0?e.matches:s.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{}};j=e,re=n,typeof e.addEventListener=="function"?e.addEventListener("change",n):typeof e.addListener=="function"&&e.addListener(n)}}catch{}}Object.defineProperty(b,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(Me)||null}catch{return null}},set(t){try{if(typeof window>"u")return;t==null?localStorage.removeItem(Me):localStorage.setItem(Me,t),he(t),fe(t),b.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:t,source:"api"}}))}catch{}}});b._applyResolvedTheme=he;b._setupSystemListenerIfNeeded=fe;b.defaultEnhancers=xe;async function Qt(t){let e=t&&t.mode||"live",{mode:n,...s}=t||{};if(e==="static")return Xt(s);let r=De(s,{resolvePublicAssetURL:Re}),o=s?.managerURL||s?.public?.managerURL||s?.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,s,{emitReady:mt,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,n=t.manageTheme??!0,s=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{lt(b);let{resolvedTheme:l}=pt({manageTheme:n,themeStorageKey:s,applyResolvedTheme:he,setupSystemListenerIfNeeded:fe}),u=await Jt(o,t),f=u?.config?.design||u?.design||null,m=u?.config?.preset||u?.preset||"default",w=u?.presetId||ft(m)||"default",x=f?{[String(w).toLowerCase()]:f,...String(w).toLowerCase()!=="default"?{default:f}:{}}:null,g=t?.design&&typeof t.design=="object"?G(t.design):null,$=ft(t?.preset||"default")||"default",H=g?{[String($).toLowerCase()]:g,...String($).toLowerCase()!=="default"?{default:g}:{}}:null,E=x||t?.presets||H||{};if(!Object.keys(E||{}).length)throw new Error("PDS static mode requires preset data. Run pds:export or provide config.presets/config.design.");let D=u?.config?{...u.config,...t,preset:t?.preset||w,design:g||f||u?.config?.design}:t,L=ut(D,{},{presets:E,defaultLog:Zt}),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(_){console.warn("Failed to apply static styles:",_)}let A=null,M=[];try{let _=await ht({autoDefineBaseURL:a,autoDefinePreload:c,autoDefineMapper:d,enhancers:Z,autoDefineOverrides:i||null,autoDefinePreferModule:!(i&&i.baseURL)},{baseEnhancers:xe});A=_.autoDefiner,M=_.mergedEnhancers||[]}catch(_){console.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}),mt({mode:"static",config:L.generatorConfig,theme:l,autoDefiner:A}),{config:L.generatorConfig,theme:l,autoDefiner:A}}catch(l){throw b.dispatchEvent(new CustomEvent("pds:error",{detail:{error:l}})),l}}export{b as PDS};
|
|
87
87
|
/*! Bundled license information:
|
|
88
88
|
|
|
89
89
|
@lit/reactive-element/css-tag.js:
|
|
@@ -72,10 +72,7 @@ export function attachFoucListener(PDS) {
|
|
|
72
72
|
PDS.addEventListener("pds:ready", (event) => {
|
|
73
73
|
const mode = event.detail?.mode;
|
|
74
74
|
if (mode) {
|
|
75
|
-
document.documentElement.classList.add(`pds-${mode}
|
|
76
|
-
if (mode === "live") {
|
|
77
|
-
document.documentElement.classList.add("pds-ready");
|
|
78
|
-
}
|
|
75
|
+
document.documentElement.classList.add(`pds-${mode}`, "pds-ready");
|
|
79
76
|
}
|
|
80
77
|
});
|
|
81
78
|
}
|
package/src/js/pds.js
CHANGED
|
@@ -64,6 +64,39 @@ import {
|
|
|
64
64
|
stripFunctions,
|
|
65
65
|
} from "./pds-core/pds-start-helpers.js";
|
|
66
66
|
|
|
67
|
+
const __slugifyPreset = (str = "") =>
|
|
68
|
+
String(str)
|
|
69
|
+
.toLowerCase()
|
|
70
|
+
.replace(/&/g, " and ")
|
|
71
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
72
|
+
.replace(/^-+|-+$/g, "");
|
|
73
|
+
|
|
74
|
+
const __defaultLog = function (level = "log", message, ...data) {
|
|
75
|
+
const debug = this?.debug || this?.design?.debug || false;
|
|
76
|
+
if (debug || level === "error" || level === "warn") {
|
|
77
|
+
const method = console[level] || console.log;
|
|
78
|
+
if (data.length > 0) {
|
|
79
|
+
method(message, ...data);
|
|
80
|
+
} else {
|
|
81
|
+
method(message);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
async function __loadRuntimeConfig(assetRootURL, config = {}) {
|
|
87
|
+
if (config?.runtimeConfig === false) return null;
|
|
88
|
+
if (typeof fetch !== "function") return null;
|
|
89
|
+
const runtimeUrl =
|
|
90
|
+
config?.runtimeConfigURL || `${assetRootURL}pds-runtime-config.json`;
|
|
91
|
+
try {
|
|
92
|
+
const res = await fetch(runtimeUrl, { cache: "no-store" });
|
|
93
|
+
if (!res.ok) return null;
|
|
94
|
+
return await res.json();
|
|
95
|
+
} catch (e) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
67
100
|
/** Singleton runtime registry. Use `registry.setLiveMode()` to enable live mode or `registry.setStaticMode()` for static assets */
|
|
68
101
|
PDS.registry = registry;
|
|
69
102
|
|
|
@@ -377,8 +410,52 @@ async function staticInit(config) {
|
|
|
377
410
|
});
|
|
378
411
|
|
|
379
412
|
// Normalize first-arg to allow { preset, design, enhancers }
|
|
380
|
-
const
|
|
381
|
-
const
|
|
413
|
+
const runtimeConfig = await __loadRuntimeConfig(assetRootURL, config);
|
|
414
|
+
const runtimeDesign =
|
|
415
|
+
runtimeConfig?.config?.design || runtimeConfig?.design || null;
|
|
416
|
+
const runtimePresetLabel =
|
|
417
|
+
runtimeConfig?.config?.preset || runtimeConfig?.preset || "default";
|
|
418
|
+
const runtimePresetId =
|
|
419
|
+
runtimeConfig?.presetId || __slugifyPreset(runtimePresetLabel) || "default";
|
|
420
|
+
const runtimePresets = runtimeDesign
|
|
421
|
+
? {
|
|
422
|
+
[String(runtimePresetId).toLowerCase()]: runtimeDesign,
|
|
423
|
+
...(String(runtimePresetId).toLowerCase() !== "default"
|
|
424
|
+
? { default: runtimeDesign }
|
|
425
|
+
: {}),
|
|
426
|
+
}
|
|
427
|
+
: null;
|
|
428
|
+
|
|
429
|
+
const inlineDesign =
|
|
430
|
+
config?.design && typeof config.design === "object"
|
|
431
|
+
? stripFunctions(config.design)
|
|
432
|
+
: null;
|
|
433
|
+
const inlinePresetId = __slugifyPreset(config?.preset || "default") || "default";
|
|
434
|
+
const inlinePresets = inlineDesign
|
|
435
|
+
? {
|
|
436
|
+
[String(inlinePresetId).toLowerCase()]: inlineDesign,
|
|
437
|
+
...(String(inlinePresetId).toLowerCase() !== "default"
|
|
438
|
+
? { default: inlineDesign }
|
|
439
|
+
: {}),
|
|
440
|
+
}
|
|
441
|
+
: null;
|
|
442
|
+
|
|
443
|
+
const presets = runtimePresets || config?.presets || inlinePresets || {};
|
|
444
|
+
if (!Object.keys(presets || {}).length) {
|
|
445
|
+
throw new Error(
|
|
446
|
+
"PDS static mode requires preset data. Run pds:export or provide config.presets/config.design."
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
const normalizedInput = runtimeConfig?.config
|
|
450
|
+
? {
|
|
451
|
+
...runtimeConfig.config,
|
|
452
|
+
...config,
|
|
453
|
+
preset: config?.preset || runtimePresetId,
|
|
454
|
+
design: inlineDesign || runtimeDesign || runtimeConfig?.config?.design,
|
|
455
|
+
}
|
|
456
|
+
: config;
|
|
457
|
+
|
|
458
|
+
const normalized = normalizeInitConfig(normalizedInput, {}, { presets, defaultLog: __defaultLog });
|
|
382
459
|
const userEnhancers = normalized.enhancers;
|
|
383
460
|
|
|
384
461
|
// 2) Derive static asset URLs from the normalized public root
|
|
@@ -389,7 +466,8 @@ async function staticInit(config) {
|
|
|
389
466
|
utilities: `${assetRootURL}styles/pds-utilities.css.js`,
|
|
390
467
|
styles: `${assetRootURL}styles/pds-styles.css.js`,
|
|
391
468
|
};
|
|
392
|
-
|
|
469
|
+
const runtimePaths = runtimeConfig?.paths || {};
|
|
470
|
+
staticPaths = { ...baseStaticPaths, ...runtimePaths, ...staticPaths };
|
|
393
471
|
|
|
394
472
|
// 3) Static mode registry
|
|
395
473
|
PDS.registry.setStaticMode(staticPaths);
|