@pure-ds/core 0.6.11 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursorrules +38 -1
- package/.github/copilot-instructions.md +38 -1
- package/custom-elements.json +77 -46
- package/dist/types/public/assets/js/pds-ask.d.ts +3 -0
- package/dist/types/public/assets/js/pds-ask.d.ts.map +1 -0
- package/dist/types/public/assets/js/pds-auto-definer.d.ts +9 -0
- package/dist/types/public/assets/js/pds-auto-definer.d.ts.map +1 -0
- package/dist/types/public/assets/js/pds-autocomplete.d.ts +68 -0
- package/dist/types/public/assets/js/pds-autocomplete.d.ts.map +1 -0
- package/dist/types/public/assets/js/pds-enhancers.d.ts +7 -0
- package/dist/types/public/assets/js/pds-enhancers.d.ts.map +1 -0
- package/dist/types/public/assets/js/pds-manager.d.ts +444 -159
- package/dist/types/public/assets/js/pds-manager.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-toast.d.ts +9 -0
- package/dist/types/public/assets/js/pds-toast.d.ts.map +1 -0
- package/dist/types/public/assets/js/pds.d.ts +4 -3
- package/dist/types/public/assets/js/pds.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-drawer.d.ts +1 -143
- package/dist/types/public/assets/pds/components/pds-drawer.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-form.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-icon.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-omnibox.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-richtext.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-scrollrow.d.ts +1 -83
- package/dist/types/public/assets/pds/components/pds-scrollrow.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-splitpanel.d.ts +1 -89
- package/dist/types/public/assets/pds/components/pds-splitpanel.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-theme.d.ts +1 -22
- package/dist/types/public/assets/pds/components/pds-theme.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-toaster.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-treeview.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-upload.d.ts.map +1 -1
- package/dist/types/src/js/common/ask.d.ts.map +1 -1
- package/dist/types/src/js/pds-ask.d.ts +2 -0
- package/dist/types/src/js/pds-ask.d.ts.map +1 -0
- package/dist/types/src/js/pds-auto-definer.d.ts +2 -0
- package/dist/types/src/js/pds-auto-definer.d.ts.map +1 -0
- package/dist/types/src/js/pds-autocomplete.d.ts +2 -0
- package/dist/types/src/js/pds-autocomplete.d.ts.map +1 -0
- package/dist/types/src/js/pds-core/pds-live.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-start-helpers.d.ts.map +1 -1
- package/dist/types/src/js/pds-enhancers.d.ts +2 -0
- package/dist/types/src/js/pds-enhancers.d.ts.map +1 -0
- package/dist/types/src/js/pds-live-manager/conversion-service.d.ts.map +1 -1
- package/dist/types/src/js/pds-toast.d.ts +2 -0
- package/dist/types/src/js/pds-toast.d.ts.map +1 -0
- package/dist/types/src/js/pds.d.ts.map +1 -1
- package/package.json +6 -4
- package/packages/pds-cli/README.md +9 -0
- package/packages/pds-cli/bin/pds-static.js +25 -3
- package/packages/pds-cli/bin/sync-assets.js +34 -0
- package/packages/pds-cli/bin/templates/bootstrap/pds.config.js +1 -5
- package/packages/pds-cli/bin/templates/bootstrap/public/index.html +2 -1
- package/packages/pds-cli/bin/templates/starter-templates.js +1 -3
- package/public/assets/js/app.js +4 -34
- package/public/assets/js/pds-ask.js +25 -0
- package/public/assets/js/pds-auto-definer.js +1 -0
- package/public/assets/js/pds-autocomplete.js +7 -0
- package/public/assets/js/pds-enhancers.js +1 -0
- package/public/assets/js/pds-manager.js +37 -37
- package/public/assets/js/pds-toast.js +1 -0
- package/public/assets/js/pds.js +2 -32
- package/public/assets/pds/components/pds-calendar.js +2 -2
- package/public/assets/pds/components/pds-drawer.js +1 -1
- package/public/assets/pds/components/pds-form.js +7 -6
- package/public/assets/pds/components/pds-icon.js +12 -9
- package/public/assets/pds/components/pds-live-edit.js +5 -8
- package/public/assets/pds/components/pds-live-importer.js +2 -1
- package/public/assets/pds/components/pds-live-template-canvas.js +2 -1
- package/public/assets/pds/components/pds-omnibox.js +11 -1
- package/public/assets/pds/components/pds-richtext.js +2 -0
- package/public/assets/pds/components/pds-scrollrow.js +5 -1
- package/public/assets/pds/components/pds-splitpanel.js +3 -1
- package/public/assets/pds/components/pds-theme.js +2 -0
- package/public/assets/pds/components/pds-toaster.js +2 -0
- package/public/assets/pds/components/pds-treeview.js +2 -0
- package/public/assets/pds/components/pds-upload.js +2 -0
- package/public/assets/pds/core/pds-ask.js +25 -0
- package/public/assets/pds/core/pds-auto-definer.js +1 -0
- package/public/assets/pds/core/pds-autocomplete.js +7 -0
- package/public/assets/pds/core/pds-enhancers.js +1 -0
- package/public/assets/pds/core/pds-manager.js +3646 -0
- package/public/assets/pds/core/pds-toast.js +1 -0
- package/public/assets/pds/core.js +2 -0
- package/public/assets/pds/custom-elements.json +77 -46
- package/public/assets/pds/pds-css-complete.json +2 -2
- package/public/assets/pds/pds.css-data.json +1 -1
- package/public/assets/pds/vscode-custom-data.json +5 -13
- package/readme.md +4 -1
- package/src/js/pds-core/pds-live.js +3 -0
- package/src/js/pds-core/pds-start-helpers.js +5 -1
- package/src/js/pds-live-manager/conversion-service.js +1 -2
- package/src/js/pds.js +159 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function r(){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 n(t,e={}){return(await r()).toast(t,e)}n.success=async function(t,e={}){return n(t,{...e,type:"success"})};n.error=async function(t,e={}){return n(t,{...e,type:"error"})};n.warning=async function(t,e={}){return n(t,{...e,type:"warning"})};n.info=async function(t,e={}){return n(t,{...e,type:"information"})};export{n as toast};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var me=Object.defineProperty;var he=(e,t)=>{for(var n in t)me(e,n,{get:t[n],enumerable:!0})};var W=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t}}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(n){console.error(`[PDS Registry] Failed to load static ${t}:`,n),console.error(`[PDS Registry] Looking for: ${this._staticPaths[t]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let r=new CSSStyleSheet;return r.replaceSync("/* Failed to load "+t+" */"),r}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},_=new W;async function X(e,t=[],n=null){try{let r=n?.primitivesStylesheet?n.primitivesStylesheet:await _.getStylesheet("primitives");e.adoptedStyleSheets=[r,...t]}catch(r){let a=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${a}> failed to adopt primitives:`,r),e.adoptedStyleSheets=t}}async function Y(e,t=["primitives"],n=[],r=null){try{let s=(await Promise.all(t.map(async c=>{if(r)switch(c){case"tokens":return r.tokensStylesheet;case"primitives":return r.primitivesStylesheet;case"components":return r.componentsStylesheet;case"utilities":return r.utilitiesStylesheet;default:break}return _.getStylesheet(c)}))).filter(c=>c!==null);e.adoptedStyleSheets=[...s,...n]}catch(a){let s=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${s}> failed to adopt layers:`,a),e.adoptedStyleSheets=n}}function Z(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var ee={FontWeights:{light:300,normal:400,medium:500,semibold:600,bold:700},LineHeights:{tight:1.25,normal:1.5,relaxed:1.75},BorderWidths:{hairline:.5,thin:1,medium:2,thick:3},RadiusSizes:{none:0,small:4,medium:8,large:16,xlarge:24,xxlarge:32},ShadowDepths:{none:"none",light:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",medium:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",deep:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",extreme:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},TransitionSpeeds:{fast:150,normal:250,slow:350},AnimationEasings:{linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},TouchTargetSizes:{compact:36,standard:44,comfortable:48,spacious:56},LinkStyles:{inline:"inline",block:"block",button:"button"},FocusStyles:{ring:"ring",outline:"outline",border:"border",glow:"glow"},TabSizes:{compact:2,standard:4,wide:8},SelectIcons:{chevron:"chevron",arrow:"arrow",caret:"caret",none:"none"},IconSizes:{xs:16,sm:20,md:24,lg:32,xl:48,"2xl":64,"3xl":96}};var V={};he(V,{deepMerge:()=>te,fragmentFromTemplateLike:()=>ye,isObject:()=>k,parseHTML:()=>B});function k(e){return e&&typeof e=="object"&&!Array.isArray(e)}function te(e,t){let n={...e};return k(e)&&k(t)&&Object.keys(t).forEach(r=>{k(t[r])?r in e?n[r]=te(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}function ye(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],r=new Set,a=[],s=/(\s)(\.[\w-]+)=\s*$/;for(let i=0;i<t.length;i+=1){let d=t[i]??"",u=d.match(s);if(u&&i<n.length){let p=u[2].slice(1),m=`pds-val-${i}`;d=d.replace(s,`$1data-pds-prop="${p}:${m}"`),r.add(i)}a.push(d),i<n.length&&!r.has(i)&&a.push(`<!--pds-val-${i}-->`)}let c=document.createElement("template");c.innerHTML=a.join("");let f=(i,d)=>{let u=i.parentNode;if(!u)return;if(d==null){u.removeChild(i);return}let w=p=>{if(p!=null){if(p instanceof Node){u.insertBefore(p,i);return}if(Array.isArray(p)){p.forEach(m=>w(m));return}u.insertBefore(document.createTextNode(String(p)),i)}};w(d),u.removeChild(i)},E=document.createTreeWalker(c.content,NodeFilter.SHOW_COMMENT),S=[];for(;E.nextNode();){let i=E.currentNode;i?.nodeValue?.startsWith("pds-val-")&&S.push(i)}return S.forEach(i=>{let d=Number(i.nodeValue.replace("pds-val-",""));f(i,n[d])}),c.content.querySelectorAll("*").forEach(i=>{let d=i.getAttribute("data-pds-prop");if(!d)return;let[u,w]=d.split(":"),p=Number(String(w).replace("pds-val-",""));u&&Number.isInteger(p)&&(i[u]=n[p]),i.removeAttribute("data-pds-prop")}),c.content}function B(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes}var re="pds",ge=/^([a-z][a-z0-9+\-.]*:)?\/\//i,ne=/^[a-z]:/i;function v(e=""){return e.endsWith("/")?e:`${e}/`}function we(e="",t=re){let n=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(n)?n:`${n}/${t}`}function Se(e){return e.replace(/^\.\/+/,"")}function be(e){return ne.test(e)?e.replace(ne,"").replace(/^\/+/,""):e}function Ee(e){return e.startsWith("public/")?e.substring(7):e}function M(e,t={}){let n=t.segment||re,r=t.defaultRoot||`/assets/${n}/`,a=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!a||typeof a!="string")return v(r);let s=a.trim();return s?(s=s.replace(/\\/g,"/"),s=we(s,n),s=v(s),ge.test(s)?s:(s=Se(s),s=be(s),s.startsWith("/")||(s=Ee(s),s.startsWith("/")||(s=`/${s}`),s=s.replace(/\/+/g,(c,f)=>f===0?c:"/")),v(s))):v(r)}var Le=/^[a-z][a-z0-9+\-.]*:\/\//i,D=(()=>{try{return import.meta.url}catch{return}})(),T=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function U(e,t={}){if(!e||Le.test(e))return e;let{preferModule:n=!0}=t,r=()=>{if(!D)return null;try{return new URL(e,D).href}catch{return null}},a=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(n?r()||a():a()||r())||e}var se=(()=>{if(D)try{let e=new URL(D);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",D).href}catch{return}})(),oe=!1;function ie(e){oe||typeof document>"u"||(oe=!0,e.addEventListener("pds:ready",t=>{let n=t.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function ae({manageTheme:e,themeStorageKey:t,applyResolvedTheme:n,setupSystemListenerIfNeeded:r}){let a="light",s=null;if(e&&typeof window<"u"){try{s=localStorage.getItem(t)||null}catch{s=null}try{n?.(s),r?.(s)}catch{}s?s==="system"?a=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a=s:a=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:a,storedTheme:s}}function C(e,{resolvePublicAssetURL:t}){let n=!!(e?.public?.root||e?.static?.root),r=t(e);return!n&&se&&(r=se),T(U(r))}async function ce(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:r=[],autoDefineMapper:a=null,autoDefinerModuleURL:s=null,enhancers:c=[],autoDefineOverrides:f=null,autoDefinePreferModule:E=!0}=e,S=(()=>{let i=new Map;return(t||[]).forEach(d=>i.set(d.selector,d)),(c||[]).forEach(d=>i.set(d.selector,d)),Array.from(i.values())})(),y=null;if(typeof window<"u"&&typeof document<"u"){let i=null;try{if(!s||typeof s!="string")throw new Error("AutoDefiner module URL is not configured");let l=await import(s);i=l?.AutoDefiner||l?.default?.AutoDefiner||l?.default||null}catch(l){console.warn("AutoDefiner not available:",l?.message||l)}let d=l=>{switch(l){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${l}.js`}},{mapper:u,...w}=f&&typeof f=="object"?f:{},m={baseURL:n&&T(U(n,{preferModule:E})),predefine:r,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:S,onError:(l,h)=>{if(typeof l=="string"&&l.startsWith("pds-")){let L=["pds-form","pds-drawer"].includes(l),F=h?.message?.includes("#pds/lit")||h?.message?.includes("Failed to resolve module specifier");L&&F?console.error(`\u274C PDS component <${l}> requires Lit but #pds/lit is not in import map.
|
|
2
|
+
See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):console.warn(`\u26A0\uFE0F PDS component <${l}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${l}>:`,h)},...w,mapper:l=>{if(customElements.get(l))return null;if(typeof a=="function")try{let h=a(l);return h===void 0?d(l):h}catch(h){return console.warn("Custom autoDefine.mapper error; falling back to default:",h?.message||h),d(l)}return d(l)}};i&&(y=new i(m),r.length>0&&typeof i.define=="function"&&await i.define(...r,{baseURL:n,mapper:m.mapper,onError:m.onError}))}return{autoDefiner:y,mergedEnhancers:S}}var H=["light","dark"],q=new Set(H);function _e(e){let n=(Array.isArray(e?.themes)?e.themes.map(r=>String(r).toLowerCase()):H).filter(r=>q.has(r));return n.length?n:H}function K(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(q.has(n))return n;if(t&&typeof document<"u"){let r=document.documentElement?.getAttribute("data-theme");if(q.has(r))return r}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function le(e,t){let n=K(t);return _e(e).includes(n)}var Q=class extends EventTarget{},o=new Q;o.initializing=!1;o.currentPreset=null;o.debug=!1;var j=null,$=null,I=null,O=null;function x(e,t){return t&&typeof t=="string"?t:`${C(o.currentConfig||{},{resolvePublicAssetURL:M})}core/${e}`}async function Ae(){return Array.isArray(o.defaultEnhancers)&&o.defaultEnhancers.length>0?o.defaultEnhancers:(O||(O=import(x("pds-enhancers.js",o.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return o.defaultEnhancers=n,n}).catch(t=>{throw O=null,t})),O)}async function ve(){return typeof o.ask=="function"&&o.ask!==ue?o.ask:($||($=import(x("pds-ask.js",o.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return o.ask=n,n}).catch(t=>{throw $=null,t})),$)}async function P(){return typeof o.toast=="function"&&o.toast!==A?o.toast:(I||(I=import(x("pds-toast.js",o.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return o.toast=n,n}).catch(t=>{throw I=null,t})),I)}async function ue(...e){return(await ve())(...e)}async function A(...e){return(await P())(...e)}A.success=async(...e)=>(await P()).success(...e);A.error=async(...e)=>(await P()).error(...e);A.warning=async(...e)=>(await P()).warning(...e);A.info=async(...e)=>(await P()).info(...e);var de=function(e="log",t,...n){let r=!!(o.registry&&!o.registry.isLive),a=(this?.debug||this?.design?.debug||o.debug||!1)===!0;if(r){if(!o.debug)return}else if(!a&&e!=="error"&&e!=="warn")return;let s=console[e]||console.log;n.length>0?s(t,...n):s(t)};function J(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>J(n)).filter(n=>n!==void 0);let t={};for(let[n,r]of Object.entries(e)){let a=J(r);a!==void 0&&(t[n]=a)}return t}async function De(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let n=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let r=await fetch(n,{cache:"no-store"});return r.ok?await r.json():null}catch{return null}}o.registry=_;o.enums=ee;o.adoptLayers=Y;o.adoptPrimitives=X;o.parse=B;o.createStylesheet=Z;o.isLiveMode=()=>_.isLive;o.ask=ue;o.toast=A;o.common=V;o.AutoComplete=null;o.loadAutoComplete=async()=>{if(o.AutoComplete&&typeof o.AutoComplete.connect=="function")return o.AutoComplete;let e=x("pds-autocomplete.js",o.currentConfig?.autoCompleteURL);return j||(j=import(e).then(t=>{let n=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!n)throw new Error("AutoComplete export not found in module");return o.AutoComplete=n,n}).catch(t=>{throw j=null,t})),j};function pe(e){let t=typeof CustomEvent=="function";try{let n=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");o.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",n))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",n))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function fe(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let r=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");o.dispatchEvent(r)}catch{}if(typeof document<"u")if(t){let r={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",r))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var G="pure-ds-theme",b=null,R=null;function N(e){try{if(typeof document>"u")return;let t="light";e?e==="system"?t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t=e:t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t)}catch{}}function z(e){try{if(b&&R){try{typeof b.removeEventListener=="function"?b.removeEventListener("change",R):typeof b.removeListener=="function"&&b.removeListener(R)}catch{}b=null,R=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=r=>{let a=r?.matches===void 0?t.matches:r.matches;try{let s=a?"dark":"light";document.documentElement.setAttribute("data-theme",s),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:s,source:"system"}}))}catch{}};b=t,R=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}Object.defineProperty(o,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(G)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=o.currentConfig?.design||null,n=K(e);if(t&&!le(t,n)){let r=t?.name||o.currentPreset?.name||o.currentConfig?.preset||"current preset";console.warn(`PDS theme "${n}" not supported by preset "${r}".`),o.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:r}}));return}e==null?localStorage.removeItem(G):localStorage.setItem(G,e),N(e),z(e),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});o.defaultEnhancers=[];async function Re(e){let t=e&&e.mode||"live",{mode:n,...r}=e||{};if(t==="static")return xe(r);let a=C(r,{resolvePublicAssetURL:M}),s=r?.managerURL||r?.public?.managerURL||r?.manager?.url||new URL("core/pds-manager.js",a).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:c}=await import(s);return c(o,r,{emitReady:pe,emitConfigChanged:fe,applyResolvedTheme:N,setupSystemListenerIfNeeded:z})}o.start=Re;async function xe(e){if(!e||typeof e!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let t=e.applyGlobalStyles??!0,n=e.manageTheme??!0,r=e.themeStorageKey??"pure-ds-theme",a=e.staticPaths??{},s=C(e,{resolvePublicAssetURL:M}),c=e&&e.autoDefine||null,f;c&&c.baseURL?f=T(U(c.baseURL,{preferModule:!1})):f=`${s}components/`;let E=c&&Array.isArray(c.predefine)&&c.predefine||[],S=c&&typeof c.mapper=="function"&&c.mapper||null;try{ie(o);let{resolvedTheme:y}=ae({manageTheme:n,themeStorageKey:r,applyResolvedTheme:N,setupSystemListenerIfNeeded:z}),i=await De(s,e),d=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],u=i?.config?{...i.config,...e,design:e?.design||i.config.design,preset:e?.preset||i.config.preset}:{...e},w={tokens:`${s}styles/pds-tokens.css.js`,primitives:`${s}styles/pds-primitives.css.js`,components:`${s}styles/pds-components.css.js`,utilities:`${s}styles/pds-utilities.css.js`,styles:`${s}styles/pds-styles.css.js`},p=i?.paths||{};if(a={...w,...p,...a},o.registry.setStaticMode(a),t&&typeof document<"u")try{let g=await o.registry.getStylesheet("styles");if(g){g._pds=!0;let L=(document.adoptedStyleSheets||[]).filter(F=>F._pds!==!0);document.adoptedStyleSheets=[...L,g],fe({mode:"static",source:"static:styles-applied"})}}catch(g){de.call(o,"warn","Failed to apply static styles:",g)}let m=null,l=[];try{let g=await Ae(),L=await ce({autoDefineBaseURL:f,autoDefinePreload:E,autoDefineMapper:S,autoDefinerModuleURL:x("pds-auto-definer.js",c?.moduleURL||o.currentConfig?.autoDefinerURL),enhancers:d,autoDefineOverrides:c||null,autoDefinePreferModule:!(c&&c.baseURL)},{baseEnhancers:g});m=L.autoDefiner,l=L.mergedEnhancers||[]}catch(g){de.call(o,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",g)}let h=J(e);return o.currentConfig=Object.freeze({mode:"static",...structuredClone(h),design:structuredClone(u.design||{}),preset:u.preset,theme:y,enhancers:l}),pe({mode:"static",config:u,theme:y,autoDefiner:m}),{config:u,theme:y,autoDefiner:m}}catch(y){throw o.dispatchEvent(new CustomEvent("pds:error",{detail:{error:y}})),y}}var Be=N,Ve=z;export{o as PDS,Be as applyResolvedTheme,Ve as setupSystemListenerIfNeeded};
|
|
@@ -1334,6 +1334,34 @@
|
|
|
1334
1334
|
"kind": "method",
|
|
1335
1335
|
"name": "_teardown"
|
|
1336
1336
|
},
|
|
1337
|
+
{
|
|
1338
|
+
"kind": "method",
|
|
1339
|
+
"name": "_enableInteractiveEditing"
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
"kind": "method",
|
|
1343
|
+
"name": "_disableInteractiveEditing",
|
|
1344
|
+
"parameters": [
|
|
1345
|
+
{
|
|
1346
|
+
"name": "options",
|
|
1347
|
+
"default": "{}"
|
|
1348
|
+
}
|
|
1349
|
+
]
|
|
1350
|
+
},
|
|
1351
|
+
{
|
|
1352
|
+
"kind": "method",
|
|
1353
|
+
"name": "setInteractiveEditingEnabled",
|
|
1354
|
+
"parameters": [
|
|
1355
|
+
{
|
|
1356
|
+
"name": "enabled",
|
|
1357
|
+
"default": "true"
|
|
1358
|
+
}
|
|
1359
|
+
]
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
"kind": "method",
|
|
1363
|
+
"name": "isInteractiveEditingEnabled"
|
|
1364
|
+
},
|
|
1337
1365
|
{
|
|
1338
1366
|
"kind": "method",
|
|
1339
1367
|
"name": "_handleThemeChanged"
|
|
@@ -1529,6 +1557,14 @@
|
|
|
1529
1557
|
"kind": "method",
|
|
1530
1558
|
"name": "_buildQuickModeDropdown"
|
|
1531
1559
|
},
|
|
1560
|
+
{
|
|
1561
|
+
"kind": "method",
|
|
1562
|
+
"name": "_buildQuickModeContent"
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
"kind": "method",
|
|
1566
|
+
"name": "createSharedQuickModeMenuItem"
|
|
1567
|
+
},
|
|
1532
1568
|
{
|
|
1533
1569
|
"kind": "method",
|
|
1534
1570
|
"name": "_openDrawer",
|
|
@@ -1563,6 +1599,14 @@
|
|
|
1563
1599
|
}
|
|
1564
1600
|
]
|
|
1565
1601
|
},
|
|
1602
|
+
{
|
|
1603
|
+
"kind": "method",
|
|
1604
|
+
"name": "openDesignSettings"
|
|
1605
|
+
},
|
|
1606
|
+
{
|
|
1607
|
+
"kind": "method",
|
|
1608
|
+
"name": "resetConfig"
|
|
1609
|
+
},
|
|
1566
1610
|
{
|
|
1567
1611
|
"kind": "method",
|
|
1568
1612
|
"name": "openImportDetailsFromToast",
|
|
@@ -1741,6 +1785,22 @@
|
|
|
1741
1785
|
"text": "null"
|
|
1742
1786
|
},
|
|
1743
1787
|
"default": "null"
|
|
1788
|
+
},
|
|
1789
|
+
{
|
|
1790
|
+
"kind": "field",
|
|
1791
|
+
"name": "_interactiveEditingEnabled",
|
|
1792
|
+
"type": {
|
|
1793
|
+
"text": "boolean"
|
|
1794
|
+
},
|
|
1795
|
+
"default": "true"
|
|
1796
|
+
},
|
|
1797
|
+
{
|
|
1798
|
+
"kind": "field",
|
|
1799
|
+
"name": "_interactionListenersAttached",
|
|
1800
|
+
"type": {
|
|
1801
|
+
"text": "boolean"
|
|
1802
|
+
},
|
|
1803
|
+
"default": "false"
|
|
1744
1804
|
}
|
|
1745
1805
|
],
|
|
1746
1806
|
"events": [
|
|
@@ -1897,7 +1957,7 @@
|
|
|
1897
1957
|
"name": "_persistImportHistory",
|
|
1898
1958
|
"parameters": [
|
|
1899
1959
|
{
|
|
1900
|
-
"name": "{ sourceType, result }"
|
|
1960
|
+
"name": "{ sourceType, importMode, result }"
|
|
1901
1961
|
}
|
|
1902
1962
|
]
|
|
1903
1963
|
},
|
|
@@ -1928,6 +1988,9 @@
|
|
|
1928
1988
|
},
|
|
1929
1989
|
{
|
|
1930
1990
|
"name": "fileName"
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
"name": "importMode"
|
|
1931
1994
|
}
|
|
1932
1995
|
]
|
|
1933
1996
|
},
|
|
@@ -1990,6 +2053,14 @@
|
|
|
1990
2053
|
},
|
|
1991
2054
|
"default": "\"\""
|
|
1992
2055
|
},
|
|
2056
|
+
{
|
|
2057
|
+
"kind": "field",
|
|
2058
|
+
"name": "_selectedImportMode",
|
|
2059
|
+
"type": {
|
|
2060
|
+
"text": "string"
|
|
2061
|
+
},
|
|
2062
|
+
"default": "\"convert-only\""
|
|
2063
|
+
},
|
|
1993
2064
|
{
|
|
1994
2065
|
"kind": "field",
|
|
1995
2066
|
"name": "_isImporting",
|
|
@@ -2632,32 +2703,8 @@
|
|
|
2632
2703
|
"declarations": [
|
|
2633
2704
|
{
|
|
2634
2705
|
"kind": "class",
|
|
2635
|
-
"description": "
|
|
2706
|
+
"description": "",
|
|
2636
2707
|
"name": "PdsScrollrow",
|
|
2637
|
-
"cssParts": [
|
|
2638
|
-
{
|
|
2639
|
-
"description": "The scrollable container element",
|
|
2640
|
-
"name": "viewport"
|
|
2641
|
-
},
|
|
2642
|
-
{
|
|
2643
|
-
"description": "The previous/left scroll navigation button",
|
|
2644
|
-
"name": "prev"
|
|
2645
|
-
},
|
|
2646
|
-
{
|
|
2647
|
-
"description": "The next/right scroll navigation button",
|
|
2648
|
-
"name": "next"
|
|
2649
|
-
}
|
|
2650
|
-
],
|
|
2651
|
-
"slots": [
|
|
2652
|
-
{
|
|
2653
|
-
"description": "Scrollable tile content",
|
|
2654
|
-
"name": "default"
|
|
2655
|
-
},
|
|
2656
|
-
{
|
|
2657
|
-
"description": "Optional heading content rendered in the component header",
|
|
2658
|
-
"name": "heading"
|
|
2659
|
-
}
|
|
2660
|
-
],
|
|
2661
2708
|
"members": [
|
|
2662
2709
|
{
|
|
2663
2710
|
"kind": "field",
|
|
@@ -2747,32 +2794,16 @@
|
|
|
2747
2794
|
],
|
|
2748
2795
|
"attributes": [
|
|
2749
2796
|
{
|
|
2750
|
-
"name": "label"
|
|
2751
|
-
"type": {
|
|
2752
|
-
"text": "string"
|
|
2753
|
-
},
|
|
2754
|
-
"description": "Accessible label for the scroll region; also used as fallback heading copy"
|
|
2797
|
+
"name": "label"
|
|
2755
2798
|
},
|
|
2756
2799
|
{
|
|
2757
|
-
"name": "snap"
|
|
2758
|
-
"type": {
|
|
2759
|
-
"text": "\"start\"|\"center\""
|
|
2760
|
-
},
|
|
2761
|
-
"description": "Snap alignment for tiles when scrolling (default: start)"
|
|
2800
|
+
"name": "snap"
|
|
2762
2801
|
},
|
|
2763
2802
|
{
|
|
2764
|
-
"name": "tile-min"
|
|
2765
|
-
"type": {
|
|
2766
|
-
"text": "string"
|
|
2767
|
-
},
|
|
2768
|
-
"description": "Minimum tile width (CSS length, e.g. \"250px\")"
|
|
2803
|
+
"name": "tile-min"
|
|
2769
2804
|
},
|
|
2770
2805
|
{
|
|
2771
|
-
"name": "tile-max"
|
|
2772
|
-
"type": {
|
|
2773
|
-
"text": "string"
|
|
2774
|
-
},
|
|
2775
|
-
"description": "Maximum tile width (CSS length, e.g. \"360px\")"
|
|
2806
|
+
"name": "tile-max"
|
|
2776
2807
|
}
|
|
2777
2808
|
],
|
|
2778
2809
|
"superclass": {
|
|
@@ -1129,7 +1129,7 @@
|
|
|
1129
1129
|
"name": "--border-width-hairline",
|
|
1130
1130
|
"description": "Border width hairline",
|
|
1131
1131
|
"syntax": "<length>",
|
|
1132
|
-
"value": "
|
|
1132
|
+
"value": "1px",
|
|
1133
1133
|
"category": "Border Tokens"
|
|
1134
1134
|
},
|
|
1135
1135
|
{
|
|
@@ -2292,7 +2292,7 @@
|
|
|
2292
2292
|
],
|
|
2293
2293
|
"metadata": {
|
|
2294
2294
|
"generator": "PDS CSS Data Generator",
|
|
2295
|
-
"generatedAt": "2026-02-
|
|
2295
|
+
"generatedAt": "2026-02-23T17:59:14.105Z",
|
|
2296
2296
|
"totalProperties": 169,
|
|
2297
2297
|
"totalClasses": 169,
|
|
2298
2298
|
"totalAttributes": 5
|
|
@@ -783,31 +783,23 @@
|
|
|
783
783
|
},
|
|
784
784
|
{
|
|
785
785
|
"name": "pds-scrollrow",
|
|
786
|
-
"description": "
|
|
786
|
+
"description": "PdsScrollrow component",
|
|
787
787
|
"attributes": [
|
|
788
788
|
{
|
|
789
789
|
"name": "label",
|
|
790
|
-
"description": "
|
|
790
|
+
"description": ""
|
|
791
791
|
},
|
|
792
792
|
{
|
|
793
793
|
"name": "snap",
|
|
794
|
-
"description": "
|
|
795
|
-
"values": [
|
|
796
|
-
{
|
|
797
|
-
"name": "start"
|
|
798
|
-
},
|
|
799
|
-
{
|
|
800
|
-
"name": "center"
|
|
801
|
-
}
|
|
802
|
-
]
|
|
794
|
+
"description": ""
|
|
803
795
|
},
|
|
804
796
|
{
|
|
805
797
|
"name": "tile-min",
|
|
806
|
-
"description": "
|
|
798
|
+
"description": ""
|
|
807
799
|
},
|
|
808
800
|
{
|
|
809
801
|
"name": "tile-max",
|
|
810
|
-
"description": "
|
|
802
|
+
"description": ""
|
|
811
803
|
}
|
|
812
804
|
]
|
|
813
805
|
},
|
package/readme.md
CHANGED
|
@@ -571,6 +571,7 @@ PDS.dispatchEvent(new CustomEvent('pds:toast', {
|
|
|
571
571
|
<script type="importmap">
|
|
572
572
|
{
|
|
573
573
|
"imports": {
|
|
574
|
+
"#pds": "/assets/pds/core.js",
|
|
574
575
|
"#showdown": "https://cdn.jsdelivr.net/npm/showdown@2.1.0/+esm"
|
|
575
576
|
}
|
|
576
577
|
}
|
|
@@ -1405,6 +1406,7 @@ await PDS.start({ design: myPreset });
|
|
|
1405
1406
|
<script type="importmap">
|
|
1406
1407
|
{
|
|
1407
1408
|
"imports": {
|
|
1409
|
+
"#pds": "https://cdn.jsdelivr.net/npm/@pure-ds/core@latest/public/assets/pds/core.js",
|
|
1408
1410
|
"#pds/lit": "https://cdn.jsdelivr.net/npm/@pure-ds/core@latest/public/assets/pds/external/lit.js"
|
|
1409
1411
|
}
|
|
1410
1412
|
}
|
|
@@ -1414,7 +1416,7 @@ await PDS.start({ design: myPreset });
|
|
|
1414
1416
|
<button class="btn-primary">Click me</button>
|
|
1415
1417
|
|
|
1416
1418
|
<script type="module">
|
|
1417
|
-
import { PDS } from '
|
|
1419
|
+
import { PDS } from '#pds';
|
|
1418
1420
|
|
|
1419
1421
|
await PDS.start({
|
|
1420
1422
|
mode: 'static',
|
|
@@ -1819,6 +1821,7 @@ export default {
|
|
|
1819
1821
|
<script type="importmap">
|
|
1820
1822
|
{
|
|
1821
1823
|
"imports": {
|
|
1824
|
+
"#pds": "/assets/pds/core.js",
|
|
1822
1825
|
"#pds/lit": "/assets/pds/external/lit.js"
|
|
1823
1826
|
}
|
|
1824
1827
|
}
|
|
@@ -1089,6 +1089,9 @@ export async function startLive(PDS, config, { emitReady, emitConfigChanged, app
|
|
|
1089
1089
|
autoDefineMapper:
|
|
1090
1090
|
(cfgAuto && typeof cfgAuto.mapper === "function" && cfgAuto.mapper) ||
|
|
1091
1091
|
null,
|
|
1092
|
+
autoDefinerModuleURL:
|
|
1093
|
+
(cfgAuto && cfgAuto.moduleURL) ||
|
|
1094
|
+
`${assetRootURL}core/pds-auto-definer.js`,
|
|
1092
1095
|
enhancers: userEnhancers,
|
|
1093
1096
|
autoDefineOverrides: cfgAuto || null,
|
|
1094
1097
|
autoDefinePreferModule: !(cfgAuto && cfgAuto.baseURL),
|
|
@@ -332,6 +332,7 @@ export async function setupAutoDefinerAndEnhancers(options, { baseEnhancers = []
|
|
|
332
332
|
autoDefineBaseURL = "/auto-define/",
|
|
333
333
|
autoDefinePreload = [],
|
|
334
334
|
autoDefineMapper = null,
|
|
335
|
+
autoDefinerModuleURL = null,
|
|
335
336
|
enhancers = [],
|
|
336
337
|
autoDefineOverrides = null,
|
|
337
338
|
autoDefinePreferModule = true,
|
|
@@ -351,7 +352,10 @@ export async function setupAutoDefinerAndEnhancers(options, { baseEnhancers = []
|
|
|
351
352
|
// Dynamically import AutoDefiner to avoid Node/CJS interop at build time
|
|
352
353
|
let AutoDefinerCtor = null;
|
|
353
354
|
try {
|
|
354
|
-
|
|
355
|
+
if (!autoDefinerModuleURL || typeof autoDefinerModuleURL !== "string") {
|
|
356
|
+
throw new Error("AutoDefiner module URL is not configured");
|
|
357
|
+
}
|
|
358
|
+
const mod = await import(autoDefinerModuleURL);
|
|
355
359
|
AutoDefinerCtor =
|
|
356
360
|
mod?.AutoDefiner || mod?.default?.AutoDefiner || mod?.default || null;
|
|
357
361
|
} catch (e) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createImportResult } from "./import-contract.js";
|
|
2
2
|
import tailwindRulebookJson from "./tailwind-conversion-rules.json" with { type: "json" };
|
|
3
|
-
|
|
4
|
-
const PDS = globalThis.PDS;
|
|
3
|
+
import { PDS } from "../pds.js";
|
|
5
4
|
|
|
6
5
|
const RULEBOOK_JSON_PATH = "src/js/pds-live-manager/tailwind-conversion-rules.json";
|
|
7
6
|
const BREAKPOINT_ORDER = ["base", "sm", "md", "lg", "xl", "2xl"];
|
package/src/js/pds.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference path="./pds.d.ts" />
|
|
2
2
|
|
|
3
|
-
import { AutoComplete } from "pure-web/ac";
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* Public PDS runtime object exported to consumers.
|
|
7
5
|
*
|
|
@@ -53,10 +51,7 @@ import {
|
|
|
53
51
|
} from "./pds-core/pds-runtime.js";
|
|
54
52
|
import { registry } from "./pds-core/pds-registry.js";
|
|
55
53
|
import { enums } from "./pds-core/pds-enums.js";
|
|
56
|
-
import { ask } from "./common/ask.js";
|
|
57
|
-
import { toast } from "./common/toast.js";
|
|
58
54
|
import * as common from "./common/common.js";
|
|
59
|
-
import { defaultPDSEnhancers } from "./pds-core/pds-enhancers.js";
|
|
60
55
|
import { resolvePublicAssetURL } from "./pds-core/pds-paths.js";
|
|
61
56
|
import {
|
|
62
57
|
ensureAbsoluteAssetURL,
|
|
@@ -71,6 +66,125 @@ import {
|
|
|
71
66
|
resolveThemePreference,
|
|
72
67
|
} from "./pds-core/pds-theme-utils.js";
|
|
73
68
|
|
|
69
|
+
let __autoCompletePromise = null;
|
|
70
|
+
let __askPromise = null;
|
|
71
|
+
let __toastPromise = null;
|
|
72
|
+
let __defaultEnhancersPromise = null;
|
|
73
|
+
|
|
74
|
+
function __resolveExternalRuntimeModuleURL(filename, overrideURL) {
|
|
75
|
+
if (overrideURL && typeof overrideURL === "string") {
|
|
76
|
+
return overrideURL;
|
|
77
|
+
}
|
|
78
|
+
const assetRootURL = resolveRuntimeAssetRoot(PDS.currentConfig || {}, {
|
|
79
|
+
resolvePublicAssetURL,
|
|
80
|
+
});
|
|
81
|
+
return `${assetRootURL}core/${filename}`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function __loadDefaultEnhancers() {
|
|
85
|
+
if (Array.isArray(PDS.defaultEnhancers) && PDS.defaultEnhancers.length > 0) {
|
|
86
|
+
return PDS.defaultEnhancers;
|
|
87
|
+
}
|
|
88
|
+
if (!__defaultEnhancersPromise) {
|
|
89
|
+
const enhancersModuleURL = __resolveExternalRuntimeModuleURL(
|
|
90
|
+
"pds-enhancers.js",
|
|
91
|
+
PDS.currentConfig?.enhancersURL
|
|
92
|
+
);
|
|
93
|
+
__defaultEnhancersPromise = import(enhancersModuleURL)
|
|
94
|
+
.then((mod) => {
|
|
95
|
+
const enhancers = Array.isArray(mod?.defaultPDSEnhancers)
|
|
96
|
+
? mod.defaultPDSEnhancers
|
|
97
|
+
: [];
|
|
98
|
+
PDS.defaultEnhancers = enhancers;
|
|
99
|
+
return enhancers;
|
|
100
|
+
})
|
|
101
|
+
.catch((error) => {
|
|
102
|
+
__defaultEnhancersPromise = null;
|
|
103
|
+
throw error;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return __defaultEnhancersPromise;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function __loadAsk() {
|
|
110
|
+
if (typeof PDS.ask === "function" && PDS.ask !== __lazyAsk) {
|
|
111
|
+
return PDS.ask;
|
|
112
|
+
}
|
|
113
|
+
if (!__askPromise) {
|
|
114
|
+
const askModuleURL = __resolveExternalRuntimeModuleURL(
|
|
115
|
+
"pds-ask.js",
|
|
116
|
+
PDS.currentConfig?.askURL
|
|
117
|
+
);
|
|
118
|
+
__askPromise = import(askModuleURL)
|
|
119
|
+
.then((mod) => {
|
|
120
|
+
const impl = mod?.ask;
|
|
121
|
+
if (typeof impl !== "function") {
|
|
122
|
+
throw new Error("Failed to load ask helper");
|
|
123
|
+
}
|
|
124
|
+
PDS.ask = impl;
|
|
125
|
+
return impl;
|
|
126
|
+
})
|
|
127
|
+
.catch((error) => {
|
|
128
|
+
__askPromise = null;
|
|
129
|
+
throw error;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return __askPromise;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async function __loadToast() {
|
|
136
|
+
if (typeof PDS.toast === "function" && PDS.toast !== __lazyToast) {
|
|
137
|
+
return PDS.toast;
|
|
138
|
+
}
|
|
139
|
+
if (!__toastPromise) {
|
|
140
|
+
const toastModuleURL = __resolveExternalRuntimeModuleURL(
|
|
141
|
+
"pds-toast.js",
|
|
142
|
+
PDS.currentConfig?.toastURL
|
|
143
|
+
);
|
|
144
|
+
__toastPromise = import(toastModuleURL)
|
|
145
|
+
.then((mod) => {
|
|
146
|
+
const impl = mod?.toast;
|
|
147
|
+
if (typeof impl !== "function") {
|
|
148
|
+
throw new Error("Failed to load toast helper");
|
|
149
|
+
}
|
|
150
|
+
PDS.toast = impl;
|
|
151
|
+
return impl;
|
|
152
|
+
})
|
|
153
|
+
.catch((error) => {
|
|
154
|
+
__toastPromise = null;
|
|
155
|
+
throw error;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return __toastPromise;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function __lazyAsk(...args) {
|
|
162
|
+
const askImpl = await __loadAsk();
|
|
163
|
+
return askImpl(...args);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function __lazyToast(...args) {
|
|
167
|
+
const toastImpl = await __loadToast();
|
|
168
|
+
return toastImpl(...args);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
__lazyToast.success = async (...args) => {
|
|
172
|
+
const toastImpl = await __loadToast();
|
|
173
|
+
return toastImpl.success(...args);
|
|
174
|
+
};
|
|
175
|
+
__lazyToast.error = async (...args) => {
|
|
176
|
+
const toastImpl = await __loadToast();
|
|
177
|
+
return toastImpl.error(...args);
|
|
178
|
+
};
|
|
179
|
+
__lazyToast.warning = async (...args) => {
|
|
180
|
+
const toastImpl = await __loadToast();
|
|
181
|
+
return toastImpl.warning(...args);
|
|
182
|
+
};
|
|
183
|
+
__lazyToast.info = async (...args) => {
|
|
184
|
+
const toastImpl = await __loadToast();
|
|
185
|
+
return toastImpl.info(...args);
|
|
186
|
+
};
|
|
187
|
+
|
|
74
188
|
const __defaultLog = function (level = "log", message, ...data) {
|
|
75
189
|
const isStaticMode = Boolean(PDS.registry && !PDS.registry.isLive);
|
|
76
190
|
const debug =
|
|
@@ -145,10 +259,41 @@ PDS.createStylesheet = createStylesheet;
|
|
|
145
259
|
|
|
146
260
|
/** Return true when running inside a live/designer-backed environment */
|
|
147
261
|
PDS.isLiveMode = () => registry.isLive;
|
|
148
|
-
PDS.ask =
|
|
149
|
-
PDS.toast =
|
|
262
|
+
PDS.ask = __lazyAsk;
|
|
263
|
+
PDS.toast = __lazyToast;
|
|
150
264
|
PDS.common = common;
|
|
151
|
-
PDS.AutoComplete =
|
|
265
|
+
PDS.AutoComplete = null;
|
|
266
|
+
PDS.loadAutoComplete = async () => {
|
|
267
|
+
if (PDS.AutoComplete && typeof PDS.AutoComplete.connect === "function") {
|
|
268
|
+
return PDS.AutoComplete;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const autoCompleteModuleURL = __resolveExternalRuntimeModuleURL(
|
|
272
|
+
"pds-autocomplete.js",
|
|
273
|
+
PDS.currentConfig?.autoCompleteURL
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
if (!__autoCompletePromise) {
|
|
277
|
+
__autoCompletePromise = import(autoCompleteModuleURL)
|
|
278
|
+
.then((mod) => {
|
|
279
|
+
const autoCompleteCtor =
|
|
280
|
+
mod?.AutoComplete ||
|
|
281
|
+
mod?.default?.AutoComplete ||
|
|
282
|
+
mod?.default ||
|
|
283
|
+
null;
|
|
284
|
+
if (!autoCompleteCtor) {
|
|
285
|
+
throw new Error("AutoComplete export not found in module");
|
|
286
|
+
}
|
|
287
|
+
PDS.AutoComplete = autoCompleteCtor;
|
|
288
|
+
return autoCompleteCtor;
|
|
289
|
+
})
|
|
290
|
+
.catch((error) => {
|
|
291
|
+
__autoCompletePromise = null;
|
|
292
|
+
throw error;
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
return __autoCompletePromise;
|
|
296
|
+
};
|
|
152
297
|
|
|
153
298
|
function __emitPDSReady(detail) {
|
|
154
299
|
const hasCustomEvent = typeof CustomEvent === "function";
|
|
@@ -210,11 +355,6 @@ function __emitPDSConfigChanged(detail = {}) {
|
|
|
210
355
|
}
|
|
211
356
|
}
|
|
212
357
|
|
|
213
|
-
if (typeof window !== "undefined") {
|
|
214
|
-
// @ts-ignore
|
|
215
|
-
window.PDS = PDS;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
358
|
// ---------------------------------------------------------------------------
|
|
219
359
|
// Theme management (centralized on PDS.theme)
|
|
220
360
|
// Consumers may read/write `PDS.theme` with values: 'system' | 'light' | 'dark'
|
|
@@ -354,7 +494,7 @@ Object.defineProperty(PDS, "theme", {
|
|
|
354
494
|
* enhancements that can be applied to vanilla markup. Consumers can override
|
|
355
495
|
* or add to these via the `enhancers` option of PDS.start({ mode }).
|
|
356
496
|
*/
|
|
357
|
-
PDS.defaultEnhancers =
|
|
497
|
+
PDS.defaultEnhancers = [];
|
|
358
498
|
|
|
359
499
|
/**
|
|
360
500
|
* Initialize PDS in live mode with the given configuration (new unified shape).
|
|
@@ -535,10 +675,15 @@ async function staticInit(config) {
|
|
|
535
675
|
let autoDefiner = null;
|
|
536
676
|
let mergedEnhancers = [];
|
|
537
677
|
try {
|
|
678
|
+
const defaultPDSEnhancers = await __loadDefaultEnhancers();
|
|
538
679
|
const res = await setupAutoDefinerAndEnhancers({
|
|
539
680
|
autoDefineBaseURL,
|
|
540
681
|
autoDefinePreload,
|
|
541
682
|
autoDefineMapper,
|
|
683
|
+
autoDefinerModuleURL: __resolveExternalRuntimeModuleURL(
|
|
684
|
+
"pds-auto-definer.js",
|
|
685
|
+
cfgAuto?.moduleURL || PDS.currentConfig?.autoDefinerURL
|
|
686
|
+
),
|
|
542
687
|
enhancers: userEnhancers,
|
|
543
688
|
autoDefineOverrides: cfgAuto || null,
|
|
544
689
|
autoDefinePreferModule: !(cfgAuto && cfgAuto.baseURL),
|