@adia-ai/web-modules 0.8.43 → 0.8.44
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/CHANGELOG.md +8 -0
- package/chat/chat-sidebar/chat-sidebar.d.ts +4 -0
- package/dist/chat/chat-shell.min.js +1 -1
- package/dist/editor/editor-shell.min.js +1 -1
- package/dist/everything.min.js +130 -130
- package/dist/shell/admin-shell.min.js +1 -1
- package/dist/simple/simple-shell.min.js +1 -1
- package/package.json +6 -6
- package/shell/admin-command/admin-command.d.ts +5 -0
- package/shell/admin-sidebar/admin-sidebar.d.ts +4 -0
- package/simple/simple-shell/simple-shell.d.ts +2 -0
- package/theme/theme-panel/theme-panel.d.ts +31 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog — @adia-ai/web-modules
|
|
2
2
|
|
|
3
|
+
## [0.8.44] — 2026-08-20
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **Restored kebab-case props silently dropped from `.d.ts` (gh#1686, `dts-codegen.mjs` fix — see repo-root CHANGELOG).** Props on `admin-command`, `admin-sidebar`, `chat-sidebar`, `simple-shell`, and `theme-panel` are restored to their `.d.ts` files. No runtime behavior change — these props already worked at runtime; only the shipped TypeScript surface was affected.
|
|
7
|
+
|
|
8
|
+
### Maintenance
|
|
9
|
+
- **`dist/` bundles rebuilt** in this cut's window (5 file(s)) — regenerated from the source changes described above, not independent edits.
|
|
10
|
+
|
|
3
11
|
## [0.8.43] — 2026-08-18
|
|
4
12
|
|
|
5
13
|
### Breaking
|
|
@@ -46,6 +46,10 @@ duplicating threshold math.
|
|
|
46
46
|
.toggle() / .collapse() / .expand() public methods.
|
|
47
47
|
*/
|
|
48
48
|
collapsible: boolean;
|
|
49
|
+
/** Optional override for the snap-floor width. Defaults to reading
|
|
50
|
+
CSS min-width via getComputedStyle.
|
|
51
|
+
*/
|
|
52
|
+
minWidth: string;
|
|
49
53
|
/** Identifier for localStorage namespacing. Defaults to slot value
|
|
50
54
|
("leading" or "trailing"). Override when running multiple sidebars
|
|
51
55
|
with the same slot.
|
|
@@ -38,7 +38,7 @@ var VS=Object.defineProperty;var ee=(i,e,t)=>()=>{if(t)throw t[0];try{return i&&
|
|
|
38
38
|
`+c+" Compute the full attr value as a single expression and interpolate the whole.")}continue}let l=+o[1],a=s.name;a[0]==="@"?(r.removeAttribute(a),t[l]={t:"e",n:r,name:a.slice(1),c:void 0,_fx:null}):a[0]==="."?(r.removeAttribute(a),t[l]={t:"p",n:r,name:Wu(r,a.slice(1)),c:void 0,_fx:null,_resolved:!1}):a[0]==="?"?(r.removeAttribute(a),console.warn(`[template] Lit-style boolean attribute "${a}=" is not supported.
|
|
39
39
|
Element: <${r.tagName.toLowerCase()}>
|
|
40
40
|
Use .${a.slice(1)}=\${value} (property binding) instead \u2014 the primitive reflects the property to the DOM attribute for you.
|
|
41
|
-
See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),t[l]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):t[l]={t:"a",n:r,name:a,c:void 0,_fx:null}}return t}function as(i){for(let e of i)e&&e._fx&&(e._fx(),e._fx=null)}function Bl(i){if(i.n.nodeType===1&&i.n[Wl])return i.n;let e=document.createElement("span");return e.style.display="contents",e.setAttribute("role","presentation"),e[Wl]=!0,i.n.replaceWith(e),i.n=e,e}var Iu=i=>i!=null&&typeof i=="object"&&i.strings,Nu=i=>typeof i=="function"||i!=null&&typeof i.handleEvent=="function";function ql(i,e){if(e!==i.c){if(i.t==="n")if(e!=null&&e._directive)e._commit(Bl(i));else if(Iu(e))ln(e,Bl(i));else if(Array.isArray(e)){let t=Bl(i);t.replaceChildren();for(let n of e)if(Iu(n)){let r=document.createElement("span");r.style.display="contents",r.setAttribute("role","presentation"),t.appendChild(r),ln(n,r)}else t.appendChild(document.createTextNode(n??""))}else if(Dl(e))i.n.replaceWith(e),i.n=e;else if(i.n[Wl]){let t=document.createTextNode(e??"");i.n.replaceWith(t),i.n=t}else i.n.textContent=e??"";else if(i.t==="a")e==null||e===!1?i.n.removeAttribute(i.name):i.n.setAttribute(i.name,e===!0?"":e);else if(i.t==="p"){if(!i._resolved){let t=Wu(i.n,i.name);t!==i.name&&(i.name=t),i._resolved=!0}i.n[i.name]=e}else i.t==="e"&&(Nu(i.c)&&i.n.removeEventListener(i.name,i.c),Nu(e)&&i.n.addEventListener(i.name,e));i.c=e}}function FS(i,e){for(let t=0;t<i.length;t++){let n=i[t];if(!n)continue;let r=e[t],s=n.t!=="e"&&typeof r=="function",o=!s&&n.t!=="e"&&Yl(r);if(n._fx&&!s&&!o&&(n._fx(),n._fx=null),s){n._fx||(n._fx=xi(()=>ql(n,r())));continue}if(o){n._fx||(n._fx=xi(()=>ql(n,r.value)));continue}ql(n,r)}}function HS(i,e,t){return{_directive:!0,_commit(n){let r=n[an]||new Map,s=new Map,o=[];for(let a=0;a<i.length;a++){let h=e(i[a],a);if(s.has(h))continue;o.push(h);let c=t(i[a],a);if(r.has(h)){let f=r.get(h);ln(c,f),s.set(h,f)}else{let f=document.createElement("span");f.style.display="contents",f.setAttribute("role","presentation"),ln(c,f),s.set(h,f)}}for(let[a,h]of r)s.has(a)||(h._i&&as(h._i.p),h.remove());let l=null;for(let a=o.length-1;a>=0;a--){let h=s.get(o[a]);(h.nextSibling!==l||h.parentNode!==n)&&n.insertBefore(h,l),l=h}n[an]=s}}}var In=new Map;function KS(i,e){return e===`data-${i}`||e.startsWith(`data-${i}-`)}function Gu(i,e){return i===e||i.startsWith(`${e}-`)||e.startsWith(`${i}-`)}function JS(i){let e=[i.name,...i.prefixes||[]],t=[...i.attributes||[],...i.config||[]].filter(n=>!e.some(r=>KS(r,n)));if(t.length>0)throw new Error(`Trait "${i.name}" declares attribute(s) outside its owned data-* namespace: ${t.join(", ")}. A trait owns "data-${i.name}" / "data-${i.name}-*" by default; register any other prefix via defineTrait({ ..., prefixes: [...] }) (ADR-0060) or rename the attribute.`)}function e1(i){let e=i.prefixes||[];for(let[t,n]of In){if(t===i.name)continue;let r=n.schema,s=[r.name,...r.prefixes||[]];for(let o of e)for(let l of s)if(Gu(o,l))throw new Error(`Trait "${i.name}"'s registered prefix "${o}" overlaps trait "${r.name}"'s owned namespace ("${l}"). Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`);for(let o of r.prefixes||[])if(Gu(o,i.name))throw new Error(`Trait "${i.name}"'s name overlaps trait "${r.name}"'s registered prefix "${o}". Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`)}}var Uu=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function dT(i){if(!i.name)throw new Error("Trait requires a name");if(!i.setup)throw new Error(`Trait "${i.name}" requires a setup function`);if(!i.category)throw new Error(`Trait "${i.name}" requires a category`);if(!Uu.has(i.category))throw new Error(`Trait "${i.name}" has unknown category "${i.category}". Known: ${[...Uu].join(", ")}`);if(!i.description)throw new Error(`Trait "${i.name}" requires a description`);JS(i),e1(i);let e=Object.freeze({name:i.name,category:i.category,description:i.description,attributes:Object.freeze(i.attributes||[]),events:Object.freeze(i.events||[]),config:Object.freeze(i.config||[]),prefixes:Object.freeze(i.prefixes||[])});function t(){let n=null;return{schema:e,connect(r,s){n=i.setup({host:r,...s||{}})},disconnect(r){n&&(n(),n=null);for(let s of e.attributes)r.hasAttribute(s)&&(console.warn(`Trait "${e.name}": attribute "${s}" still present after disconnect`),r.removeAttribute(s))}}}return t.schema=e,In.set(i.name,t),t}function Fu(i){return In.get(i)||null}function OT(i){return In.get(i)?.schema||null}function pT(){return[...In.keys()]}var Il=Symbol(),Nn=Symbol();function t1(i,e){i[Nn]=new Map,i[Il]=new Map;for(let[t,n]of Object.entries(e)){let r=n.attribute??t.toLowerCase(),s=n.type??String,o=Object.prototype.hasOwnProperty.call(i,t),l=o?i[t]:void 0;o&&delete i[t];let a=on(n.default??void 0);i[Il].set(t,a),Object.defineProperty(i,t,{get(){return a.value},set(h){let c=a.peek();Object.is(c,h)||(i[Nn].set(t,c),a.value=h,n.reflect&&n1(i,r,h,s))},configurable:!0}),o&&(a.value=l)}}var i1=Object.freeze({setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0},get form(){return null},get labels(){return[]},get validity(){return{}},get validationMessage(){return""},get willValidate(){return!1}});function n1(i,e,t,n){n===Boolean?t?i.setAttribute(e,""):i.removeAttribute(e):t==null?i.removeAttribute(e):i.setAttribute(e,String(t))}var Hu=(i,e)=>e===Boolean?i!==null:e===Number?i===null?null:+i:i;function r1(i){if(Object.hasOwn(i,"_sa"))return;i._sa=!0;let e=i.styles;if(!e||!("adoptedStyleSheets"in document))return;let t=Array.isArray(e)?e:[e];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...t.filter(n=>!document.adoptedStyleSheets.includes(n))]}function Ku(i){if(Object.hasOwn(i,"_pp"))return;i._pp={};let e=i.parts;if(e)for(let[t,n]of Object.entries(e)){let r=document.createElement("template");r.innerHTML=n,i._pp[t]=r.content.firstElementChild}}var hn=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let e=Object.entries(this.properties).map(([t,n])=>n.attribute??t.toLowerCase());return e.includes("traits")?e:[...e,"traits"]}#t=[];#r=[];#e=[];#i=null;#o=null;#n=null;#l=on(0);constructor(){super(),this.internals=typeof this.attachInternals=="function"?this.attachInternals():i1,t1(this,this.constructor.properties)}connectedCallback(){let e=this.constructor;e._tag||(e._tag=this.localName),r1(e),Ku(e),os(()=>{for(let[t,n]of Object.entries(e.properties)){let r=n.attribute??t.toLowerCase();this.hasAttribute(r)?this[t]=Hu(this.getAttribute(r),n.type??String):n.reflect&&n.type===Boolean&&this[t]===!0&&this.setAttribute(r,"")}}),os(()=>this.connected()),this.#t.push(xi(()=>{for(let n of this[Il].values())n.value;this.#l.value;let t=e.template(this);if(t&&ln(t,this),this.render(),this[Nn].size){let n=new Map(this[Nn]);this[Nn].clear(),this.updated(n)}},{host:this.localName,onError:this.onError?t=>this.onError(t):null})),this.#n||(this.#n=new Set);for(let t of e.traits)this.#a(t);this.#h(),this.#i&&this.#s()}disconnectedCallback(){this._i&&as(this._i.p);for(let e of this.#t)e();this.#t.length=0;for(let e of this.#e)e.value=void 0;this.#e.length=0;for(let e of this.#r)e.disconnect(this);this.#r.length=0,this.#n?.clear(),this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.disconnected()}#s(){let e=this.#i;e.connect?.(this),this.#o=e.subscribe?.(()=>{this.#l.value++})}get controller(){return this.#i}set controller(e){this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.#i=e,e&&this.isConnected&&this.#s()}#a(e,{declarative:t=!1}={}){this.#n.add(e);let n=e();n.connect(this,{host:this,signal:on,computed:Vl,effect:xi}),t&&(n._declarative=!0),this.#r.push(n)}addTrait(e){return this.#n||(this.#n=new Set),this.#n.has(e)?this:(this.#a(e),this)}#h(){let e=this.getAttribute("traits");if(e)for(let t of e.split(/\s+/).filter(Boolean)){let n=Fu(t);if(!n){console.warn(`<${this.localName}> traits="${t}" \u2014 trait not found. Did you forget to import it?`);continue}this.#n.has(n)||this.#a(n,{declarative:!0})}}#c(){if(!this.#n)return;let e=[];for(let t of this.#r)if(t._declarative){t.disconnect(this);for(let n of this.#n)if(n.schema?.name&&t.schema?.name===n.schema.name){this.#n.delete(n);break}}else e.push(t);this.#r.length=0,this.#r.push(...e),this.#h()}attributeChangedCallback(e,t,n){if(e==="traits"){this.isConnected&&this.#c();return}for(let[r,s]of Object.entries(this.constructor.properties))if((s.attribute??r.toLowerCase())===e){this[r]=Hu(n,s.type??String);break}}static template=()=>null;static create(e={}){let t=this._tag??customElements.getName?.(this);if(!t)throw new Error("Component not registered");let n=document.createElement(t);for(let[r,s]of Object.entries(e))n[r]=s;return n}signal(e){let t=on(e);return this.#e.push(t),t}ensure(e){for(let s of this.children)if(s.getAttribute("slot")===e)return s;let t=this.#f(e);if(t)return t;Ku(this.constructor);let n=this.constructor._pp?.[e];if(!n)return null;let r=n.cloneNode(!0);return r._uiPart=!0,this.appendChild(r),r}drop(e){for(let n of this.children)if(n.getAttribute("slot")===e){n.remove();return}let t=this.#f(e);t&&t.remove()}#f(e){for(let t of this.querySelectorAll(`[slot="${e}"]`)){let n=t.parentElement,r=!0;for(;n&&n!==this;){if(n.localName.includes("-")){r=!1;break}n=n.parentElement}if(r&&n===this)return t}return null}reconcile(e,t,n,r){let s=e[an]||new Map,o=new Map,l=[];for(let h=0;h<t.length;h++){let c=t[h],f=n(c,h);if(o.has(f))continue;let u=s.get(f);u?r(c,h,u):u=r(c,h,null),o.set(f,u),l.push(f)}for(let[h,c]of s)o.has(h)||c.remove();let a=null;for(let h=l.length-1;h>=0;h--){let c=o.get(l[h]);(c.nextSibling!==a||c.parentNode!==e)&&e.insertBefore(c,a),a=c}e[an]=o}connected(){}render(){}disconnected(){}updated(e){}};var s1={"&":"&","<":"<",">":">",'"':"""},Ju=i=>i.replace(/[&<>"]/g,e=>s1[e]);function Nl(i){let e=i.split(`
|
|
41
|
+
See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),t[l]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):t[l]={t:"a",n:r,name:a,c:void 0,_fx:null}}return t}function as(i){for(let e of i)e&&e._fx&&(e._fx(),e._fx=null)}function Bl(i){if(i.n.nodeType===1&&i.n[Wl])return i.n;let e=document.createElement("span");return e.style.display="contents",e.setAttribute("role","presentation"),e[Wl]=!0,i.n.replaceWith(e),i.n=e,e}var Iu=i=>i!=null&&typeof i=="object"&&i.strings,Nu=i=>typeof i=="function"||i!=null&&typeof i.handleEvent=="function";function ql(i,e){if(e!==i.c){if(i.t==="n")if(e!=null&&e._directive)e._commit(Bl(i));else if(Iu(e))ln(e,Bl(i));else if(Array.isArray(e)){let t=Bl(i);t.replaceChildren();for(let n of e)if(Iu(n)){let r=document.createElement("span");r.style.display="contents",r.setAttribute("role","presentation"),t.appendChild(r),ln(n,r)}else t.appendChild(document.createTextNode(n??""))}else if(Dl(e))i.n.replaceWith(e),i.n=e;else if(i.n[Wl]){let t=document.createTextNode(e??"");i.n.replaceWith(t),i.n=t}else i.n.textContent=e??"";else if(i.t==="a")e==null||e===!1?i.n.removeAttribute(i.name):i.n.setAttribute(i.name,e===!0?"":e);else if(i.t==="p"){if(!i._resolved){let t=Wu(i.n,i.name);t!==i.name&&(i.name=t),i._resolved=!0}i.n[i.name]=e}else i.t==="e"&&(Nu(i.c)&&i.n.removeEventListener(i.name,i.c),Nu(e)&&i.n.addEventListener(i.name,e));i.c=e}}function FS(i,e){for(let t=0;t<i.length;t++){let n=i[t];if(!n)continue;let r=e[t],s=n.t!=="e"&&typeof r=="function",o=!s&&n.t!=="e"&&Yl(r);if(n._fx&&!s&&!o&&(n._fx(),n._fx=null),s){n._fx||(n._fx=xi(()=>ql(n,r())));continue}if(o){n._fx||(n._fx=xi(()=>ql(n,r.value)));continue}ql(n,r)}}function HS(i,e,t){return{_directive:!0,_commit(n){let r=n[an]||new Map,s=new Map,o=[];for(let a=0;a<i.length;a++){let h=e(i[a],a);if(s.has(h))continue;o.push(h);let c=t(i[a],a);if(r.has(h)){let f=r.get(h);ln(c,f),s.set(h,f)}else{let f=document.createElement("span");f.style.display="contents",f.setAttribute("role","presentation"),ln(c,f),s.set(h,f)}}for(let[a,h]of r)s.has(a)||(h._i&&as(h._i.p),h.remove());let l=null;for(let a=o.length-1;a>=0;a--){let h=s.get(o[a]);(h.nextSibling!==l||h.parentNode!==n)&&n.insertBefore(h,l),l=h}n[an]=s}}}var In=new Map;function KS(i,e){return e===`data-${i}`||e.startsWith(`data-${i}-`)}function Gu(i,e){return i===e||i.startsWith(`${e}-`)||e.startsWith(`${i}-`)}function JS(i){let e=[i.name,...i.prefixes||[]],t=[...i.attributes||[],...i.config||[]].filter(n=>!e.some(r=>KS(r,n)));if(t.length>0)throw new Error(`Trait "${i.name}" declares attribute(s) outside its owned data-* namespace: ${t.join(", ")}. A trait owns "data-${i.name}" / "data-${i.name}-*" by default; register any other prefix via defineTrait({ ..., prefixes: [...] }) (ADR-0060) or rename the attribute.`)}function e1(i){let e=i.prefixes||[];for(let[t,n]of In){if(t===i.name)continue;let r=n.schema,s=[r.name,...r.prefixes||[]];for(let o of e)for(let l of s)if(Gu(o,l))throw new Error(`Trait "${i.name}"'s registered prefix "${o}" overlaps trait "${r.name}"'s owned namespace ("${l}"). Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`);for(let o of r.prefixes||[])if(Gu(o,i.name))throw new Error(`Trait "${i.name}"'s name overlaps trait "${r.name}"'s registered prefix "${o}". Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`)}}var Uu=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function dT(i){if(!i.name)throw new Error("Trait requires a name");if(!i.setup)throw new Error(`Trait "${i.name}" requires a setup function`);if(!i.category)throw new Error(`Trait "${i.name}" requires a category`);if(!Uu.has(i.category))throw new Error(`Trait "${i.name}" has unknown category "${i.category}". Known: ${[...Uu].join(", ")}`);if(!i.description)throw new Error(`Trait "${i.name}" requires a description`);JS(i),e1(i);let e=Object.freeze({name:i.name,category:i.category,description:i.description,attributes:Object.freeze(i.attributes||[]),events:Object.freeze(i.events||[]),config:Object.freeze(i.config||[]),prefixes:Object.freeze(i.prefixes||[])});function t(){let n=null;return{schema:e,connect(r,s){n=i.setup({host:r,...s||{}})},disconnect(r){n&&(n(),n=null);for(let s of e.attributes)r.hasAttribute(s)&&(console.warn(`Trait "${e.name}": attribute "${s}" still present after disconnect`),r.removeAttribute(s))}}}return t.schema=e,In.set(i.name,t),t}function Fu(i){return In.get(i)||null}function OT(i){return In.get(i)?.schema||null}function pT(){return[...In.keys()]}var Il=Symbol(),Nn=Symbol();function t1(i,e){i[Nn]=new Map,i[Il]=new Map;for(let[t,n]of Object.entries(e)){let r=n.attribute??t.toLowerCase(),s=n.type??String,o=Object.prototype.hasOwnProperty.call(i,t),l=o?i[t]:void 0;o&&delete i[t];let a=on(n.default??void 0);i[Il].set(t,a),Object.defineProperty(i,t,{get(){return a.value},set(h){let c=a.peek();Object.is(c,h)||(i[Nn].set(t,c),a.value=h,n.reflect&&n1(i,r,h,s))},configurable:!0}),o&&(a.value=l)}}var i1=Object.freeze({setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0},get form(){return null},get labels(){return[]},get validity(){return{}},get validationMessage(){return""},get willValidate(){return!1}});function n1(i,e,t,n){n===Boolean?t?i.setAttribute(e,""):i.removeAttribute(e):t==null?i.removeAttribute(e):i.setAttribute(e,String(t))}var Hu=(i,e)=>e===Boolean?i!==null&&i!=="false":e===Number?i===null?null:+i:i;function r1(i){if(Object.hasOwn(i,"_sa"))return;i._sa=!0;let e=i.styles;if(!e||!("adoptedStyleSheets"in document))return;let t=Array.isArray(e)?e:[e];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...t.filter(n=>!document.adoptedStyleSheets.includes(n))]}function Ku(i){if(Object.hasOwn(i,"_pp"))return;i._pp={};let e=i.parts;if(e)for(let[t,n]of Object.entries(e)){let r=document.createElement("template");r.innerHTML=n,i._pp[t]=r.content.firstElementChild}}var hn=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let e=Object.entries(this.properties).map(([t,n])=>n.attribute??t.toLowerCase());return e.includes("traits")?e:[...e,"traits"]}#t=[];#r=[];#e=[];#i=null;#o=null;#n=null;#l=on(0);constructor(){super(),this.internals=typeof this.attachInternals=="function"?this.attachInternals():i1,t1(this,this.constructor.properties)}connectedCallback(){let e=this.constructor;e._tag||(e._tag=this.localName),r1(e),Ku(e),os(()=>{for(let[t,n]of Object.entries(e.properties)){let r=n.attribute??t.toLowerCase();this.hasAttribute(r)?this[t]=Hu(this.getAttribute(r),n.type??String):n.reflect&&n.type===Boolean&&this[t]===!0&&this.setAttribute(r,"")}}),os(()=>this.connected()),this.#t.push(xi(()=>{for(let n of this[Il].values())n.value;this.#l.value;let t=e.template(this);if(t&&ln(t,this),this.render(),this[Nn].size){let n=new Map(this[Nn]);this[Nn].clear(),this.updated(n)}},{host:this.localName,onError:this.onError?t=>this.onError(t):null})),this.#n||(this.#n=new Set);for(let t of e.traits)this.#a(t);this.#h(),this.#i&&this.#s()}disconnectedCallback(){this._i&&as(this._i.p);for(let e of this.#t)e();this.#t.length=0;for(let e of this.#e)e.value=void 0;this.#e.length=0;for(let e of this.#r)e.disconnect(this);this.#r.length=0,this.#n?.clear(),this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.disconnected()}#s(){let e=this.#i;e.connect?.(this),this.#o=e.subscribe?.(()=>{this.#l.value++})}get controller(){return this.#i}set controller(e){this.#o?.(),this.#o=null,this.#i?.disconnect?.(this),this.#i=e,e&&this.isConnected&&this.#s()}#a(e,{declarative:t=!1}={}){this.#n.add(e);let n=e();n.connect(this,{host:this,signal:on,computed:Vl,effect:xi}),t&&(n._declarative=!0),this.#r.push(n)}addTrait(e){return this.#n||(this.#n=new Set),this.#n.has(e)?this:(this.#a(e),this)}#h(){let e=this.getAttribute("traits");if(e)for(let t of e.split(/\s+/).filter(Boolean)){let n=Fu(t);if(!n){console.warn(`<${this.localName}> traits="${t}" \u2014 trait not found. Did you forget to import it?`);continue}this.#n.has(n)||this.#a(n,{declarative:!0})}}#c(){if(!this.#n)return;let e=[];for(let t of this.#r)if(t._declarative){t.disconnect(this);for(let n of this.#n)if(n.schema?.name&&t.schema?.name===n.schema.name){this.#n.delete(n);break}}else e.push(t);this.#r.length=0,this.#r.push(...e),this.#h()}attributeChangedCallback(e,t,n){if(e==="traits"){this.isConnected&&this.#c();return}for(let[r,s]of Object.entries(this.constructor.properties))if((s.attribute??r.toLowerCase())===e){this[r]=Hu(n,s.type??String);break}}static template=()=>null;static create(e={}){let t=this._tag??customElements.getName?.(this);if(!t)throw new Error("Component not registered");let n=document.createElement(t);for(let[r,s]of Object.entries(e))n[r]=s;return n}signal(e){let t=on(e);return this.#e.push(t),t}ensure(e){for(let s of this.children)if(s.getAttribute("slot")===e)return s;let t=this.#f(e);if(t)return t;Ku(this.constructor);let n=this.constructor._pp?.[e];if(!n)return null;let r=n.cloneNode(!0);return r._uiPart=!0,this.appendChild(r),r}drop(e){for(let n of this.children)if(n.getAttribute("slot")===e){n.remove();return}let t=this.#f(e);t&&t.remove()}#f(e){for(let t of this.querySelectorAll(`[slot="${e}"]`)){let n=t.parentElement,r=!0;for(;n&&n!==this;){if(n.localName.includes("-")){r=!1;break}n=n.parentElement}if(r&&n===this)return t}return null}reconcile(e,t,n,r){let s=e[an]||new Map,o=new Map,l=[];for(let h=0;h<t.length;h++){let c=t[h],f=n(c,h);if(o.has(f))continue;let u=s.get(f);u?r(c,h,u):u=r(c,h,null),o.set(f,u),l.push(f)}for(let[h,c]of s)o.has(h)||c.remove();let a=null;for(let h=l.length-1;h>=0;h--){let c=o.get(l[h]);(c.nextSibling!==a||c.parentNode!==e)&&e.insertBefore(c,a),a=c}e[an]=o}connected(){}render(){}disconnected(){}updated(e){}};var s1={"&":"&","<":"<",">":">",'"':"""},Ju=i=>i.replace(/[&<>"]/g,e=>s1[e]);function Nl(i){let e=i.split(`
|
|
42
42
|
`),t=[],n=0;for(;n<e.length;){let r=e[n],s=r.match(/^```(\w*)/);if(s){let a=s[1],h=[];for(n++;n<e.length&&!e[n].startsWith("```");)h.push(Ju(e[n])),n++;n++;let c=h.join(`
|
|
43
43
|
`);t.push(a?`<code-ui language="${a}">${c}</code-ui>`:`<pre><code>${c}</code></pre>`);continue}if(!r.trim()){n++;continue}let o=r.match(/^(#{1,6})\s+(.+)/);if(o){let a=o[1].length;t.push(`<h${a}>${hs(o[2])}</h${a}>`),n++;continue}if(/^[-*]\s/.test(r)){let a=[];for(;n<e.length&&/^[-*]\s/.test(e[n]);)a.push(`<li>${hs(e[n].replace(/^[-*]\s/,""))}</li>`),n++;t.push(`<ul>${a.join("")}</ul>`);continue}if(/^\d+\.\s/.test(r)){let a=[];for(;n<e.length&&/^\d+\.\s/.test(e[n]);)a.push(`<li>${hs(e[n].replace(/^\d+\.\s/,""))}</li>`),n++;t.push(`<ol>${a.join("")}</ol>`);continue}let l=[];for(;n<e.length&&e[n].trim()&&!/^```|^#{1,6}\s|^[-*]\s|^\d+\.\s/.test(e[n]);)l.push(e[n]),n++;t.push(`<p>${hs(l.join(" "))}</p>`)}return t.join(`
|
|
44
44
|
`)}var o1=i=>`\0CODE${i}\0`,l1=/\0CODE(\d+)\0/g;function hs(i){let e=Ju(i),t=[],n=e.replace(/`([^`]+)`/g,(r,s)=>{let o=t.length;return t.push(s),o1(o)});return n=n.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/_(.+?)_/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),n=n.replace(l1,(r,s)=>`<code>${t[Number(s)]}</code>`),n}var eT=new Set(["json","html","javascript","js","css","markdown","md","yaml","yml"]),tT={js:"javascript",md:"markdown",yml:"yaml"};function Lu(i){if(!i)return"";let e=String(i).toLowerCase();return tT[e]??e}var ts=class i extends hn{static formAssociated=!0;static properties={language:{type:String,default:"",reflect:!0},inline:{type:Boolean,default:!1,reflect:!0},text:{type:String,default:"",reflect:!0},lineNumbers:{type:Boolean,default:!1,reflect:!0,attribute:"line-numbers"},editable:{type:Boolean,default:!1,reflect:!0},bare:{type:Boolean,default:!1,reflect:!0},placeholder:{type:String,default:"",reflect:!0},name:{type:String,default:"",reflect:!0},required:{type:Boolean,default:!1,reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},readonly:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#r=null;#e=null;#i=0;#o=!1;#n=null;#l="";#s=null;#a=()=>this.#b();connected(){this.#i+=1,!this.inline&&!this.querySelector(":scope > pre")&&this.#h(),this.#t=this.querySelector(':scope > header [slot="copy"]'),this.#t&&this.#t.addEventListener("click",this.#a);let e=Lu(this.language),t=this.hasAttribute("data-line-states")||e==="diff";!this.inline&&!t&&(eT.has(e)||this.editable)&&this.#f()}disconnected(){this.#i+=1,this.#r!=null&&(clearTimeout(this.#r),this.#r=null),this.#t&&(this.#t.removeEventListener("click",this.#a),this.#t=null),this.#e&&(this.#e.destroy(),this.#e=null)}#h(){let e=this.querySelector(":scope > template"),t=this.text?this.text.trim():e?i.#c(e.innerHTML):(this.textContent||"").trim();if(this.textContent="",!this.bare){let a=document.createElement("header"),h=document.createElement("span");h.setAttribute("slot","label"),h.textContent=this.language||"code",a.appendChild(h);let c=document.createElement("div");c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.setAttribute("slot","copy"),c.textContent="Copy",a.appendChild(c),this.appendChild(a)}let n=document.createElement("pre"),r=document.createElement("code"),s=Lu(this.language),o=this.getAttribute("data-line-states");if(o!=null||s==="diff"){r.setAttribute("data-line-state-mode",""),this.lineNumbers&&r.setAttribute("data-line-numbers","");let a=o?.split(",").map(c=>c.trim())??null;t.split(`
|
|
@@ -7,4 +7,4 @@ function me(e,t){customElements.define(e,t)}function R(e,t){return customElement
|
|
|
7
7
|
`+u+" Compute the full attr value as a single expression and interpolate the whole.")}continue}let c=+a[1],s=i.name;s[0]==="@"?(o.removeAttribute(s),n[c]={t:"e",n:o,name:s.slice(1),c:void 0,_fx:null}):s[0]==="."?(o.removeAttribute(s),n[c]={t:"p",n:o,name:W(o,s.slice(1)),c:void 0,_fx:null,_resolved:!1}):s[0]==="?"?(o.removeAttribute(s),console.warn(`[template] Lit-style boolean attribute "${s}=" is not supported.
|
|
8
8
|
Element: <${o.tagName.toLowerCase()}>
|
|
9
9
|
Use .${s.slice(1)}=\${value} (property binding) instead \u2014 the primitive reflects the property to the DOM attribute for you.
|
|
10
|
-
See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),n[c]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):n[c]={t:"a",n:o,name:s,c:void 0,_fx:null}}return n}function T(e){for(let t of e)t&&t._fx&&(t._fx(),t._fx=null)}function j(e){if(e.n.nodeType===1&&e.n[k])return e.n;let t=document.createElement("span");return t.style.display="contents",t.setAttribute("role","presentation"),t[k]=!0,e.n.replaceWith(t),e.n=t,t}var V=e=>e!=null&&typeof e=="object"&&e.strings,z=e=>typeof e=="function"||e!=null&&typeof e.handleEvent=="function";function L(e,t){if(t!==e.c){if(e.t==="n")if(t!=null&&t._directive)t._commit(j(e));else if(V(t))g(t,j(e));else if(Array.isArray(t)){let n=j(e);n.replaceChildren();for(let r of t)if(V(r)){let o=document.createElement("span");o.style.display="contents",o.setAttribute("role","presentation"),n.appendChild(o),g(r,o)}else n.appendChild(document.createTextNode(r??""))}else if(M(t))e.n.replaceWith(t),e.n=t;else if(e.n[k]){let n=document.createTextNode(t??"");e.n.replaceWith(n),e.n=n}else e.n.textContent=t??"";else if(e.t==="a")t==null||t===!1?e.n.removeAttribute(e.name):e.n.setAttribute(e.name,t===!0?"":t);else if(e.t==="p"){if(!e._resolved){let n=W(e.n,e.name);n!==e.name&&(e.name=n),e._resolved=!0}e.n[e.name]=t}else e.t==="e"&&(z(e.c)&&e.n.removeEventListener(e.name,e.c),z(t)&&e.n.addEventListener(e.name,t));e.c=t}}function se(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(!r)continue;let o=t[n],i=r.t!=="e"&&typeof o=="function",a=!i&&r.t!=="e"&&v(o);if(r._fx&&!i&&!a&&(r._fx(),r._fx=null),i){r._fx||(r._fx=p(()=>L(r,o())));continue}if(a){r._fx||(r._fx=p(()=>L(r,o.value)));continue}L(r,o)}}function ae(e,t,n){return{_directive:!0,_commit(r){let o=r[y]||new Map,i=new Map,a=[];for(let s=0;s<e.length;s++){let l=t(e[s],s);if(i.has(l))continue;a.push(l);let u=n(e[s],s);if(o.has(l)){let d=o.get(l);g(u,d),i.set(l,d)}else{let d=document.createElement("span");d.style.display="contents",d.setAttribute("role","presentation"),g(u,d),i.set(l,d)}}for(let[s,l]of o)i.has(s)||(l._i&&T(l._i.p),l.remove());let c=null;for(let s=a.length-1;s>=0;s--){let l=i.get(a[s]);(l.nextSibling!==c||l.parentNode!==r)&&r.insertBefore(l,c),c=l}r[y]=i}}}var x=new Map;function le(e,t){return t===`data-${e}`||t.startsWith(`data-${e}-`)}function U(e,t){return e===t||e.startsWith(`${t}-`)||t.startsWith(`${e}-`)}function ce(e){let t=[e.name,...e.prefixes||[]],n=[...e.attributes||[],...e.config||[]].filter(r=>!t.some(o=>le(o,r)));if(n.length>0)throw new Error(`Trait "${e.name}" declares attribute(s) outside its owned data-* namespace: ${n.join(", ")}. A trait owns "data-${e.name}" / "data-${e.name}-*" by default; register any other prefix via defineTrait({ ..., prefixes: [...] }) (ADR-0060) or rename the attribute.`)}function ue(e){let t=e.prefixes||[];for(let[n,r]of x){if(n===e.name)continue;let o=r.schema,i=[o.name,...o.prefixes||[]];for(let a of t)for(let c of i)if(U(a,c))throw new Error(`Trait "${e.name}"'s registered prefix "${a}" overlaps trait "${o.name}"'s owned namespace ("${c}"). Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`);for(let a of o.prefixes||[])if(U(a,e.name))throw new Error(`Trait "${e.name}"'s name overlaps trait "${o.name}"'s registered prefix "${a}". Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`)}}var G=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function _e(e){if(!e.name)throw new Error("Trait requires a name");if(!e.setup)throw new Error(`Trait "${e.name}" requires a setup function`);if(!e.category)throw new Error(`Trait "${e.name}" requires a category`);if(!G.has(e.category))throw new Error(`Trait "${e.name}" has unknown category "${e.category}". Known: ${[...G].join(", ")}`);if(!e.description)throw new Error(`Trait "${e.name}" requires a description`);ce(e),ue(e);let t=Object.freeze({name:e.name,category:e.category,description:e.description,attributes:Object.freeze(e.attributes||[]),events:Object.freeze(e.events||[]),config:Object.freeze(e.config||[]),prefixes:Object.freeze(e.prefixes||[])});function n(){let r=null;return{schema:t,connect(o,i){r=e.setup({host:o,...i||{}})},disconnect(o){r&&(r(),r=null);for(let i of t.attributes)o.hasAttribute(i)&&(console.warn(`Trait "${t.name}": attribute "${i}" still present after disconnect`),o.removeAttribute(i))}}}return n.schema=t,x.set(e.name,n),n}function K(e){return x.get(e)||null}function Ne(e){return x.get(e)?.schema||null}function Te(){return[...x.keys()]}var P=Symbol(),w=Symbol();function fe(e,t){e[w]=new Map,e[P]=new Map;for(let[n,r]of Object.entries(t)){let o=r.attribute??n.toLowerCase(),i=r.type??String,a=Object.prototype.hasOwnProperty.call(e,n),c=a?e[n]:void 0;a&&delete e[n];let s=m(r.default??void 0);e[P].set(n,s),Object.defineProperty(e,n,{get(){return s.value},set(l){let u=s.peek();Object.is(u,l)||(e[w].set(n,u),s.value=l,r.reflect&&he(e,o,l,i))},configurable:!0}),a&&(s.value=c)}}var de=Object.freeze({setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0},get form(){return null},get labels(){return[]},get validity(){return{}},get validationMessage(){return""},get willValidate(){return!1}});function he(e,t,n,r){r===Boolean?n?e.setAttribute(t,""):e.removeAttribute(t):n==null?e.removeAttribute(t):e.setAttribute(t,String(n))}var J=(e,t)=>t===Boolean?e!==null:t===Number?e===null?null:+e:e;function pe(e){if(Object.hasOwn(e,"_sa"))return;e._sa=!0;let t=e.styles;if(!t||!("adoptedStyleSheets"in document))return;let n=Array.isArray(t)?t:[t];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n.filter(r=>!document.adoptedStyleSheets.includes(r))]}function X(e){if(Object.hasOwn(e,"_pp"))return;e._pp={};let t=e.parts;if(t)for(let[n,r]of Object.entries(t)){let o=document.createElement("template");o.innerHTML=r,e._pp[n]=o.content.firstElementChild}}var C=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let t=Object.entries(this.properties).map(([n,r])=>r.attribute??n.toLowerCase());return t.includes("traits")?t:[...t,"traits"]}#o=[];#e=[];#n=[];#r=null;#i=null;#t=null;#a=m(0);constructor(){super(),this.internals=typeof this.attachInternals=="function"?this.attachInternals():de,fe(this,this.constructor.properties)}connectedCallback(){let t=this.constructor;t._tag||(t._tag=this.localName),pe(t),X(t),_(()=>{for(let[n,r]of Object.entries(t.properties)){let o=r.attribute??n.toLowerCase();this.hasAttribute(o)?this[n]=J(this.getAttribute(o),r.type??String):r.reflect&&r.type===Boolean&&this[n]===!0&&this.setAttribute(o,"")}}),_(()=>this.connected()),this.#o.push(p(()=>{for(let r of this[P].values())r.value;this.#a.value;let n=t.template(this);if(n&&g(n,this),this.render(),this[w].size){let r=new Map(this[w]);this[w].clear(),this.updated(r)}},{host:this.localName,onError:this.onError?n=>this.onError(n):null})),this.#t||(this.#t=new Set);for(let n of t.traits)this.#s(n);this.#c(),this.#r&&this.#l()}disconnectedCallback(){this._i&&T(this._i.p);for(let t of this.#o)t();this.#o.length=0;for(let t of this.#n)t.value=void 0;this.#n.length=0;for(let t of this.#e)t.disconnect(this);this.#e.length=0,this.#t?.clear(),this.#i?.(),this.#i=null,this.#r?.disconnect?.(this),this.disconnected()}#l(){let t=this.#r;t.connect?.(this),this.#i=t.subscribe?.(()=>{this.#a.value++})}get controller(){return this.#r}set controller(t){this.#i?.(),this.#i=null,this.#r?.disconnect?.(this),this.#r=t,t&&this.isConnected&&this.#l()}#s(t,{declarative:n=!1}={}){this.#t.add(t);let r=t();r.connect(this,{host:this,signal:m,computed:$,effect:p}),n&&(r._declarative=!0),this.#e.push(r)}addTrait(t){return this.#t||(this.#t=new Set),this.#t.has(t)?this:(this.#s(t),this)}#c(){let t=this.getAttribute("traits");if(t)for(let n of t.split(/\s+/).filter(Boolean)){let r=K(n);if(!r){console.warn(`<${this.localName}> traits="${n}" \u2014 trait not found. Did you forget to import it?`);continue}this.#t.has(r)||this.#s(r,{declarative:!0})}}#f(){if(!this.#t)return;let t=[];for(let n of this.#e)if(n._declarative){n.disconnect(this);for(let r of this.#t)if(r.schema?.name&&n.schema?.name===r.schema.name){this.#t.delete(r);break}}else t.push(n);this.#e.length=0,this.#e.push(...t),this.#c()}attributeChangedCallback(t,n,r){if(t==="traits"){this.isConnected&&this.#f();return}for(let[o,i]of Object.entries(this.constructor.properties))if((i.attribute??o.toLowerCase())===t){this[o]=J(r,i.type??String);break}}static template=()=>null;static create(t={}){let n=this._tag??customElements.getName?.(this);if(!n)throw new Error("Component not registered");let r=document.createElement(n);for(let[o,i]of Object.entries(t))r[o]=i;return r}signal(t){let n=m(t);return this.#n.push(n),n}ensure(t){for(let i of this.children)if(i.getAttribute("slot")===t)return i;let n=this.#u(t);if(n)return n;X(this.constructor);let r=this.constructor._pp?.[t];if(!r)return null;let o=r.cloneNode(!0);return o._uiPart=!0,this.appendChild(o),o}drop(t){for(let r of this.children)if(r.getAttribute("slot")===t){r.remove();return}let n=this.#u(t);n&&n.remove()}#u(t){for(let n of this.querySelectorAll(`[slot="${t}"]`)){let r=n.parentElement,o=!0;for(;r&&r!==this;){if(r.localName.includes("-")){o=!1;break}r=r.parentElement}if(o&&r===this)return n}return null}reconcile(t,n,r,o){let i=t[y]||new Map,a=new Map,c=[];for(let l=0;l<n.length;l++){let u=n[l],d=r(u,l);if(a.has(d))continue;let S=i.get(d);S?o(u,l,S):S=o(u,l,null),a.set(d,S),c.push(d)}for(let[l,u]of i)a.has(l)||u.remove();let s=null;for(let l=c.length-1;l>=0;l--){let u=a.get(c[l]);(u.nextSibling!==s||u.parentNode!==t)&&t.insertBefore(u,s),s=u}t[y]=a}connected(){}render(){}disconnected(){}updated(t){}};var O=class extends C{static properties={focusMode:{type:Boolean,default:!1,reflect:!0,attribute:"focus-mode"}};static template=()=>null;#o=null;#e=null;#n=null;connected(){this.#o=this.querySelector("editor-toolbar"),this.#e=this.querySelector("editor-canvas"),this.#r(),this.#n=t=>{let n=t?.detail?.name;n&&(n==="toggle-focus"||n==="full-screen")&&this.toggleFocusMode()},this.addEventListener("toolbar-action",this.#n)}disconnected(){this.#n&&this.removeEventListener("toolbar-action",this.#n),this.#n=null}toggleFocusMode(){this.focusMode=!this.focusMode,this.#o?.tagName?.toLowerCase()==="editor-toolbar"&&(this.#o.fullScreen=this.focusMode),this.#e?.tagName?.toLowerCase()==="editor-canvas"&&(this.focusMode?this.#e.focus?.():this.#e.blur?.()),this.dispatchEvent(new CustomEvent("editor-mode-change",{bubbles:!0,detail:{focusMode:this.focusMode}}))}#r(){for(let t of this.querySelectorAll("select-ui[data-options]"))try{let n=JSON.parse(t.getAttribute("data-options"));t.options=n}catch{}}};R("editor-shell",O);export{O as EditorShell};
|
|
10
|
+
See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),n[c]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):n[c]={t:"a",n:o,name:s,c:void 0,_fx:null}}return n}function T(e){for(let t of e)t&&t._fx&&(t._fx(),t._fx=null)}function j(e){if(e.n.nodeType===1&&e.n[k])return e.n;let t=document.createElement("span");return t.style.display="contents",t.setAttribute("role","presentation"),t[k]=!0,e.n.replaceWith(t),e.n=t,t}var V=e=>e!=null&&typeof e=="object"&&e.strings,z=e=>typeof e=="function"||e!=null&&typeof e.handleEvent=="function";function L(e,t){if(t!==e.c){if(e.t==="n")if(t!=null&&t._directive)t._commit(j(e));else if(V(t))g(t,j(e));else if(Array.isArray(t)){let n=j(e);n.replaceChildren();for(let r of t)if(V(r)){let o=document.createElement("span");o.style.display="contents",o.setAttribute("role","presentation"),n.appendChild(o),g(r,o)}else n.appendChild(document.createTextNode(r??""))}else if(M(t))e.n.replaceWith(t),e.n=t;else if(e.n[k]){let n=document.createTextNode(t??"");e.n.replaceWith(n),e.n=n}else e.n.textContent=t??"";else if(e.t==="a")t==null||t===!1?e.n.removeAttribute(e.name):e.n.setAttribute(e.name,t===!0?"":t);else if(e.t==="p"){if(!e._resolved){let n=W(e.n,e.name);n!==e.name&&(e.name=n),e._resolved=!0}e.n[e.name]=t}else e.t==="e"&&(z(e.c)&&e.n.removeEventListener(e.name,e.c),z(t)&&e.n.addEventListener(e.name,t));e.c=t}}function se(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(!r)continue;let o=t[n],i=r.t!=="e"&&typeof o=="function",a=!i&&r.t!=="e"&&v(o);if(r._fx&&!i&&!a&&(r._fx(),r._fx=null),i){r._fx||(r._fx=p(()=>L(r,o())));continue}if(a){r._fx||(r._fx=p(()=>L(r,o.value)));continue}L(r,o)}}function ae(e,t,n){return{_directive:!0,_commit(r){let o=r[y]||new Map,i=new Map,a=[];for(let s=0;s<e.length;s++){let l=t(e[s],s);if(i.has(l))continue;a.push(l);let u=n(e[s],s);if(o.has(l)){let d=o.get(l);g(u,d),i.set(l,d)}else{let d=document.createElement("span");d.style.display="contents",d.setAttribute("role","presentation"),g(u,d),i.set(l,d)}}for(let[s,l]of o)i.has(s)||(l._i&&T(l._i.p),l.remove());let c=null;for(let s=a.length-1;s>=0;s--){let l=i.get(a[s]);(l.nextSibling!==c||l.parentNode!==r)&&r.insertBefore(l,c),c=l}r[y]=i}}}var x=new Map;function le(e,t){return t===`data-${e}`||t.startsWith(`data-${e}-`)}function U(e,t){return e===t||e.startsWith(`${t}-`)||t.startsWith(`${e}-`)}function ce(e){let t=[e.name,...e.prefixes||[]],n=[...e.attributes||[],...e.config||[]].filter(r=>!t.some(o=>le(o,r)));if(n.length>0)throw new Error(`Trait "${e.name}" declares attribute(s) outside its owned data-* namespace: ${n.join(", ")}. A trait owns "data-${e.name}" / "data-${e.name}-*" by default; register any other prefix via defineTrait({ ..., prefixes: [...] }) (ADR-0060) or rename the attribute.`)}function ue(e){let t=e.prefixes||[];for(let[n,r]of x){if(n===e.name)continue;let o=r.schema,i=[o.name,...o.prefixes||[]];for(let a of t)for(let c of i)if(U(a,c))throw new Error(`Trait "${e.name}"'s registered prefix "${a}" overlaps trait "${o.name}"'s owned namespace ("${c}"). Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`);for(let a of o.prefixes||[])if(U(a,e.name))throw new Error(`Trait "${e.name}"'s name overlaps trait "${o.name}"'s registered prefix "${a}". Registered prefixes must be globally exclusive across the trait registry (ADR-0060).`)}}var G=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function _e(e){if(!e.name)throw new Error("Trait requires a name");if(!e.setup)throw new Error(`Trait "${e.name}" requires a setup function`);if(!e.category)throw new Error(`Trait "${e.name}" requires a category`);if(!G.has(e.category))throw new Error(`Trait "${e.name}" has unknown category "${e.category}". Known: ${[...G].join(", ")}`);if(!e.description)throw new Error(`Trait "${e.name}" requires a description`);ce(e),ue(e);let t=Object.freeze({name:e.name,category:e.category,description:e.description,attributes:Object.freeze(e.attributes||[]),events:Object.freeze(e.events||[]),config:Object.freeze(e.config||[]),prefixes:Object.freeze(e.prefixes||[])});function n(){let r=null;return{schema:t,connect(o,i){r=e.setup({host:o,...i||{}})},disconnect(o){r&&(r(),r=null);for(let i of t.attributes)o.hasAttribute(i)&&(console.warn(`Trait "${t.name}": attribute "${i}" still present after disconnect`),o.removeAttribute(i))}}}return n.schema=t,x.set(e.name,n),n}function K(e){return x.get(e)||null}function Ne(e){return x.get(e)?.schema||null}function Te(){return[...x.keys()]}var P=Symbol(),w=Symbol();function fe(e,t){e[w]=new Map,e[P]=new Map;for(let[n,r]of Object.entries(t)){let o=r.attribute??n.toLowerCase(),i=r.type??String,a=Object.prototype.hasOwnProperty.call(e,n),c=a?e[n]:void 0;a&&delete e[n];let s=m(r.default??void 0);e[P].set(n,s),Object.defineProperty(e,n,{get(){return s.value},set(l){let u=s.peek();Object.is(u,l)||(e[w].set(n,u),s.value=l,r.reflect&&he(e,o,l,i))},configurable:!0}),a&&(s.value=c)}}var de=Object.freeze({setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0},get form(){return null},get labels(){return[]},get validity(){return{}},get validationMessage(){return""},get willValidate(){return!1}});function he(e,t,n,r){r===Boolean?n?e.setAttribute(t,""):e.removeAttribute(t):n==null?e.removeAttribute(t):e.setAttribute(t,String(n))}var J=(e,t)=>t===Boolean?e!==null&&e!=="false":t===Number?e===null?null:+e:e;function pe(e){if(Object.hasOwn(e,"_sa"))return;e._sa=!0;let t=e.styles;if(!t||!("adoptedStyleSheets"in document))return;let n=Array.isArray(t)?t:[t];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n.filter(r=>!document.adoptedStyleSheets.includes(r))]}function X(e){if(Object.hasOwn(e,"_pp"))return;e._pp={};let t=e.parts;if(t)for(let[n,r]of Object.entries(t)){let o=document.createElement("template");o.innerHTML=r,e._pp[n]=o.content.firstElementChild}}var C=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let t=Object.entries(this.properties).map(([n,r])=>r.attribute??n.toLowerCase());return t.includes("traits")?t:[...t,"traits"]}#o=[];#e=[];#n=[];#r=null;#i=null;#t=null;#a=m(0);constructor(){super(),this.internals=typeof this.attachInternals=="function"?this.attachInternals():de,fe(this,this.constructor.properties)}connectedCallback(){let t=this.constructor;t._tag||(t._tag=this.localName),pe(t),X(t),_(()=>{for(let[n,r]of Object.entries(t.properties)){let o=r.attribute??n.toLowerCase();this.hasAttribute(o)?this[n]=J(this.getAttribute(o),r.type??String):r.reflect&&r.type===Boolean&&this[n]===!0&&this.setAttribute(o,"")}}),_(()=>this.connected()),this.#o.push(p(()=>{for(let r of this[P].values())r.value;this.#a.value;let n=t.template(this);if(n&&g(n,this),this.render(),this[w].size){let r=new Map(this[w]);this[w].clear(),this.updated(r)}},{host:this.localName,onError:this.onError?n=>this.onError(n):null})),this.#t||(this.#t=new Set);for(let n of t.traits)this.#s(n);this.#c(),this.#r&&this.#l()}disconnectedCallback(){this._i&&T(this._i.p);for(let t of this.#o)t();this.#o.length=0;for(let t of this.#n)t.value=void 0;this.#n.length=0;for(let t of this.#e)t.disconnect(this);this.#e.length=0,this.#t?.clear(),this.#i?.(),this.#i=null,this.#r?.disconnect?.(this),this.disconnected()}#l(){let t=this.#r;t.connect?.(this),this.#i=t.subscribe?.(()=>{this.#a.value++})}get controller(){return this.#r}set controller(t){this.#i?.(),this.#i=null,this.#r?.disconnect?.(this),this.#r=t,t&&this.isConnected&&this.#l()}#s(t,{declarative:n=!1}={}){this.#t.add(t);let r=t();r.connect(this,{host:this,signal:m,computed:$,effect:p}),n&&(r._declarative=!0),this.#e.push(r)}addTrait(t){return this.#t||(this.#t=new Set),this.#t.has(t)?this:(this.#s(t),this)}#c(){let t=this.getAttribute("traits");if(t)for(let n of t.split(/\s+/).filter(Boolean)){let r=K(n);if(!r){console.warn(`<${this.localName}> traits="${n}" \u2014 trait not found. Did you forget to import it?`);continue}this.#t.has(r)||this.#s(r,{declarative:!0})}}#f(){if(!this.#t)return;let t=[];for(let n of this.#e)if(n._declarative){n.disconnect(this);for(let r of this.#t)if(r.schema?.name&&n.schema?.name===r.schema.name){this.#t.delete(r);break}}else t.push(n);this.#e.length=0,this.#e.push(...t),this.#c()}attributeChangedCallback(t,n,r){if(t==="traits"){this.isConnected&&this.#f();return}for(let[o,i]of Object.entries(this.constructor.properties))if((i.attribute??o.toLowerCase())===t){this[o]=J(r,i.type??String);break}}static template=()=>null;static create(t={}){let n=this._tag??customElements.getName?.(this);if(!n)throw new Error("Component not registered");let r=document.createElement(n);for(let[o,i]of Object.entries(t))r[o]=i;return r}signal(t){let n=m(t);return this.#n.push(n),n}ensure(t){for(let i of this.children)if(i.getAttribute("slot")===t)return i;let n=this.#u(t);if(n)return n;X(this.constructor);let r=this.constructor._pp?.[t];if(!r)return null;let o=r.cloneNode(!0);return o._uiPart=!0,this.appendChild(o),o}drop(t){for(let r of this.children)if(r.getAttribute("slot")===t){r.remove();return}let n=this.#u(t);n&&n.remove()}#u(t){for(let n of this.querySelectorAll(`[slot="${t}"]`)){let r=n.parentElement,o=!0;for(;r&&r!==this;){if(r.localName.includes("-")){o=!1;break}r=r.parentElement}if(o&&r===this)return n}return null}reconcile(t,n,r,o){let i=t[y]||new Map,a=new Map,c=[];for(let l=0;l<n.length;l++){let u=n[l],d=r(u,l);if(a.has(d))continue;let S=i.get(d);S?o(u,l,S):S=o(u,l,null),a.set(d,S),c.push(d)}for(let[l,u]of i)a.has(l)||u.remove();let s=null;for(let l=c.length-1;l>=0;l--){let u=a.get(c[l]);(u.nextSibling!==s||u.parentNode!==t)&&t.insertBefore(u,s),s=u}t[y]=a}connected(){}render(){}disconnected(){}updated(t){}};var O=class extends C{static properties={focusMode:{type:Boolean,default:!1,reflect:!0,attribute:"focus-mode"}};static template=()=>null;#o=null;#e=null;#n=null;connected(){this.#o=this.querySelector("editor-toolbar"),this.#e=this.querySelector("editor-canvas"),this.#r(),this.#n=t=>{let n=t?.detail?.name;n&&(n==="toggle-focus"||n==="full-screen")&&this.toggleFocusMode()},this.addEventListener("toolbar-action",this.#n)}disconnected(){this.#n&&this.removeEventListener("toolbar-action",this.#n),this.#n=null}toggleFocusMode(){this.focusMode=!this.focusMode,this.#o?.tagName?.toLowerCase()==="editor-toolbar"&&(this.#o.fullScreen=this.focusMode),this.#e?.tagName?.toLowerCase()==="editor-canvas"&&(this.focusMode?this.#e.focus?.():this.#e.blur?.()),this.dispatchEvent(new CustomEvent("editor-mode-change",{bubbles:!0,detail:{focusMode:this.focusMode}}))}#r(){for(let t of this.querySelectorAll("select-ui[data-options]"))try{let n=JSON.parse(t.getAttribute("data-options"));t.options=n}catch{}}};R("editor-shell",O);export{O as EditorShell};
|