@adia-ai/web-modules 0.6.28 → 0.6.30
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 +23 -0
- package/README.md +49 -2
- package/dist/chat/chat-shell.min.css +1 -0
- package/dist/chat/chat-shell.min.js +53 -0
- package/dist/editor/editor-shell.min.css +1 -0
- package/dist/editor/editor-shell.min.js +10 -0
- package/dist/everything.min.js +74 -0
- package/dist/shell/admin-shell.min.css +1 -0
- package/dist/shell/admin-shell.min.js +10 -0
- package/dist/simple/simple-shell.min.css +1 -0
- package/dist/simple/simple-shell.min.js +10 -0
- package/package.json +44 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where(editor-shell){--editor-bg:var(--a-canvas-0);--editor-border:1px solid var(--a-border-subtle);--editor-panel-bg:var(--a-canvas-2);--editor-bar-height:var(--a-chrome-pane-header-height);--editor-bar-px:var(--a-space-3);--editor-bar-gap:var(--a-space-2);--editor-bar-font:var(--a-ui-size);--editor-bar-fg:var(--a-fg-subtle);--editor-bar-fg-strong:var(--a-fg);--editor-canvas-bg:var(--a-canvas-1);--editor-canvas-fg:var(--a-fg-muted);--editor-canvas-toolbar-bg:var(--editor-panel-bg);--editor-canvas-toolbar-px:var(--a-space-3);--editor-canvas-toolbar-gap:var(--a-space-2);--editor-title-weight:var(--a-weight-medium);--editor-pane-width-left:240px;--editor-pane-width-right:280px}editor-shell{box-sizing:border-box;background:var(--editor-bg);flex-direction:column;height:100%;display:flex;overflow:hidden}editor-shell editor-canvas{background:var(--editor-canvas-bg);min-width:0;color:var(--editor-canvas-fg);flex:1;justify-content:flex-start;align-items:stretch;display:flex}editor-shell pane-ui{--pane-radius:0;--pane-bg:var(--editor-panel-bg);flex-shrink:0;height:100%}editor-shell editor-sidebar[slot=leading]>pane-ui{width:var(--editor-pane-width-left)}editor-shell editor-sidebar[slot=trailing]>pane-ui{width:var(--editor-pane-width-right)}editor-shell>editor-toolbar{box-sizing:border-box;align-items:center;gap:var(--editor-toolbar-gap,var(--a-space-2));padding:0 var(--editor-toolbar-px,var(--a-space-3));height:var(--editor-toolbar-height,var(--a-size-lg));font-size:var(--editor-toolbar-font,var(--a-ui-size));box-shadow:inset 0 -1px 0 var(--a-border-subtle);background:var(--editor-panel-bg,var(--a-bg));flex-shrink:0;grid-area:toolbar;display:flex}editor-toolbar>[slot=title]{font-weight:var(--a-weight-medium,500);color:var(--a-fg)}editor-toolbar>[slot=action-leading]{margin-inline-end:var(--a-space-2)}editor-toolbar>[slot=status]{color:var(--a-fg-muted);margin-inline-start:var(--a-space-2)}editor-toolbar>[slot=action]{margin-inline-start:auto}editor-toolbar>[slot=action]~[slot=action]{margin-inline-start:var(--a-space-2)}editor-shell>editor-canvas{background:var(--editor-canvas-bg,var(--a-bg-subtle));flex-direction:column;flex:1;grid-area:canvas;justify-content:flex-start;align-items:stretch;min-width:0;min-height:0;display:flex;position:relative;overflow:auto}editor-canvas>*{transform:scale(var(--editor-canvas-zoom,1));transform-origin:0 0}editor-canvas-toolbar{align-items:center;gap:var(--editor-canvas-toolbar-gap,var(--a-space-2));padding:0 var(--editor-canvas-toolbar-px,var(--a-space-3));box-shadow:inset 0 -1px 0 var(--a-border-subtle);background:var(--editor-canvas-toolbar-bg,var(--editor-panel-bg,var(--a-bg)));z-index:1;flex-shrink:0;display:flex;position:sticky;top:0;transform:none}editor-canvas-toolbar>[slot=title]{font-weight:var(--a-weight-medium,500);color:var(--a-fg)}editor-canvas-toolbar>[slot=action-leading]{align-items:center;gap:var(--editor-canvas-toolbar-gap,var(--a-space-2));flex-shrink:0;margin-inline-end:var(--a-space-2);display:flex}editor-canvas-toolbar>[slot=action]{align-items:center;gap:var(--editor-canvas-toolbar-gap,var(--a-space-2));flex-shrink:0;margin-inline-start:auto;display:flex}editor-canvas-toolbar>[slot=action]~[slot=action]{margin-inline-start:var(--editor-canvas-toolbar-gap,var(--a-space-2))}editor-canvas:not([empty])>editor-canvas-empty{display:none}editor-canvas[empty]>editor-canvas-empty{padding:var(--a-space-6);flex:1;justify-content:center;align-items:center;display:flex}:is(editor-sidebar[slot=leading],editor-sidebar[slot=trailing]){flex-direction:column;flex-shrink:0;min-height:0;display:flex;position:relative}editor-sidebar[slot=leading]{border-right:var(--editor-border,1px solid var(--a-border-subtle));grid-area:leading}editor-sidebar[slot=trailing]{border-left:var(--editor-border,1px solid var(--a-border-subtle));grid-area:trailing}editor-sidebar>pane-ui{flex-direction:column;flex:1;min-height:0;display:flex}editor-sidebar{transition:width var(--editor-sidebar-duration,var(--a-duration,.18s)) var(--editor-sidebar-easing,var(--a-easing,ease));container:editor-sidebar/inline-size}editor-sidebar>pane-ui{transition:width var(--editor-sidebar-duration,var(--a-duration,.18s)) var(--editor-sidebar-easing,var(--a-easing,ease))}editor-sidebar[collapsed]>pane-ui{min-width:var(--editor-sidebar-collapsed-width,48px);overflow:hidden;width:var(--editor-sidebar-collapsed-width,48px)!important}editor-sidebar[collapsed]>pane-ui>section,editor-sidebar[collapsed]>pane-ui>footer{display:none}editor-sidebar[collapsed]>pane-ui>header{justify-content:flex-start;align-items:center;gap:var(--a-space-1);padding:var(--a-space-2) 0;flex-direction:column;display:flex}editor-sidebar[collapsed]>pane-ui>header :is(span:not([data-icon]):not([slot]),label,h1,h2,h3){display:none}editor-sidebar[collapsed]{background:var(--editor-sidebar-rail-bg,var(--a-bg-subtle,var(--a-bg)))}editor-sidebar:is([resizing],:has(pane-ui[data-resizing])),editor-sidebar:is([resizing],:has(pane-ui[data-resizing]))>pane-ui{transition:none}editor-shell>editor-statusbar{box-sizing:border-box;align-items:center;gap:var(--editor-statusbar-gap,var(--a-space-2));padding:0 var(--editor-statusbar-px,var(--a-space-3));height:var(--editor-statusbar-height,var(--a-size-md));font-size:var(--editor-statusbar-font,var(--a-ui-sm));box-shadow:inset 0 1px 0 var(--a-border-subtle);background:var(--editor-panel-bg,var(--a-bg));color:var(--a-fg-muted);flex-shrink:0;grid-area:statusbar;display:flex}editor-statusbar>[slot=cursor],editor-statusbar>[slot=zoom]{font-family:var(--a-font-family-mono);margin-inline-start:var(--a-space-2)}editor-statusbar>[slot=action]{margin-inline-start:auto}editor-statusbar>[slot=action]~[slot=action]{margin-inline-start:var(--a-space-2)}editor-shell:has(>editor-canvas){grid-template:"toolbar toolbar toolbar""leading canvas trailing"1fr"statusbar statusbar statusbar"/auto 1fr auto;height:100%;display:grid}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var S=Symbol("signal"),f=null,h=null,_=!1;function P(t){for(let e of t){if(e.disposed){t.delete(e);continue}e.dirty=!0,h||(h=new Set,_||queueMicrotask(q)),h.add(e)}}function q(){let t,e=0;for(;t=h;){if(++e>100){h=null,console.error("signals: drain loop exceeded 100 iterations");break}h=null;for(let n of t)if(!n.disposed&&n.dirty){n.dirty=!1;try{n.run()}catch(o){n.onError?n.onError(o):(n.disposed=!0,queueMicrotask(()=>{throw o}))}}}}function K(t){if(_){t();return}_=!0;try{t()}finally{_=!1,h&&q()}}function M(t){let e=f;f=null;try{return t()}finally{f=e}}function m(t){let e=new Set;return{[S]:!0,get value(){return f&&e.add(f),t},set value(n){Object.is(t,n)||(t=n,P(e))},peek(){return t}}}function k(t){let e=new Set,n,o=!0,r={dirty:!1,disposed:!1,run(){o=!0,P(e)}};return{[S]:!0,get value(){if(f&&e.add(f),o){let s=f;f=r;try{n=t(),o=!1}finally{f=s}}return n},peek(){return n}}}function p(t,e){let n={dirty:!1,disposed:!1,host:e?.host??null,onError:e?.onError??null,run(){let o=f;f=n;try{t()}finally{f=o}}};return n.run(),()=>{n.disposed=!0}}function O(t){return t!=null&&typeof t=="object"&&t[S]===!0}var[v,b]=[Symbol(),Symbol()];function V(t,...e){return{strings:t,values:e}}function X(t,...e){let n="";for(let r=0;r<t.length;r++)n+=t[r],r<e.length&&(n+=e[r]);let o=new CSSStyleSheet;return o.replaceSync(n),o}var I=new WeakMap;function Y(t){let e=0,n=0,o=0;for(;o<t.length;){if(e===0&&t.charCodeAt(o)===60&&t.charCodeAt(o+1)===33&&t.charCodeAt(o+2)===45&&t.charCodeAt(o+3)===45){let s=t.indexOf("-->",o+4);if(s===-1){n=0;break}o=s+3,n=0;continue}let r=t.charCodeAt(o);e?r===(e===1?39:34)&&(e=0):r===39?e=1:r===34?e=2:r===60?n=1:r===62&&(n=0),o++}return n===1}function J(t){let e=I.get(t);if(e)return e;let n="";for(let o=0;o<t.length;o++)n+=t[o],o<t.length-1&&(n+=Y(n)?`{{p:${o}}}`:`<!--p:${o}-->`);return e=document.createElement("template"),e.innerHTML=n,I.set(t,e),e}var B={classname:"className",innertext:"innerText",innerhtml:"innerHTML",outerhtml:"outerHTML",textcontent:"textContent",tabindex:"tabIndex",arialabel:"ariaLabel",ariadescribedby:"ariaDescribedBy",arialabelledby:"ariaLabelledBy",ariarole:"role",contenteditable:"contentEditable",readonly:"readOnly",maxlength:"maxLength",minlength:"minLength",colspan:"colSpan",rowspan:"rowSpan",cellpadding:"cellPadding",cellspacing:"cellSpacing",usemap:"useMap",ismap:"isMap",accesskey:"accessKey",defaultchecked:"defaultChecked",defaultvalue:"defaultValue",defaultselected:"defaultSelected"};function H(t,e){if(B[e])return B[e];let n=Object.getOwnPropertyNames(t);for(let r=0;r<n.length;r++){let s=n[r];if(s!==e&&s.toLowerCase()===e)return s}let o=Object.getPrototypeOf(t);for(;o&&o!==Object.prototype;){let r=Object.getOwnPropertyNames(o);for(let s=0;s<r.length;s++){let l=r[s];if(l!==e&&l.toLowerCase()===e)return l}o=Object.getPrototypeOf(o)}return e}function g(t,e){let n=e._i;(!n||n.s!==t.strings)&&(n&&A(n.p),n=Q(t,e),e._i=n),ne(n.p,t.values)}function Q(t,e){let{strings:n}=t,r=J(n).content.cloneNode(!0),s=Z(e);s&&(r=ee(r,s));let l=te(r,t.values.length);return e.replaceChildren(r),{s:n,p:l}}var C="http://www.w3.org/2000/svg",y="http://www.w3.org/1998/Math/MathML",R="http://www.w3.org/1999/xhtml";function Z(t){if(!t||t.nodeType!==1)return null;if(t.namespaceURI===C)return C;if(t.namespaceURI===y)return y;if(typeof t.closest!="function")return null;let e=t.closest("svg, math, foreignObject, annotation-xml");if(!e)return null;let n=e.localName;if(n==="foreignobject"||n==="foreignObject")return null;if(n==="annotation-xml"){let o=(e.getAttribute("encoding")||"").toLowerCase();return o==="text/html"||o==="application/xhtml+xml"?null:y}return n==="svg"?C:n==="math"?y:null}function ee(t,e){let n=document.createDocumentFragment();return U(t,n,e),n}function U(t,e,n){for(let o of[...t.childNodes])if(o.nodeType===1){let s=document.createElementNS(n,o.localName);for(let i of o.attributes)i.namespaceURI?s.setAttributeNS(i.namespaceURI,i.name,i.value):s.setAttribute(i.name,i.value);e.appendChild(s);let l=o.localName,c=n;if(n===C&&(l==="foreignObject"||l==="foreignobject"))c=R;else if(n===y&&l==="annotation-xml"){let i=(o.getAttribute("encoding")||"").toLowerCase();(i==="text/html"||i==="application/xhtml+xml")&&(c=R)}U(o,s,c)}else e.appendChild(o.cloneNode(!0))}function te(t,e){let n=new Array(e),o=document.createTreeWalker(t,129),r;for(;r=o.nextNode();)if(r.nodeType===8){let s=r.data.match(/^p:(\d+)$/);if(s){let l=document.createTextNode("");r.replaceWith(l),o.currentNode=l,n[+s[1]]={t:"n",n:l,c:void 0,_fx:null}}}else if(r.nodeType===1)for(let s of[...r.attributes]){let l=s.value.match(/^\{\{p:(\d+)\}\}$/);if(!l){if(s.value.includes("{{p:")){let a=s.name,u=a==="class"?' class="${expression}" \u2190 full replacement (whole class string is the expression)\n .className=${expression} \u2190 writes to the className property (resolved camelCase since FB-55 fix)\n':a==="style"?' style="${expression}" \u2190 full replacement of the style string\n .style.cssText=${expression} \u2190 write CSS text via the style.cssText accessor\n':` ${a}="\${expression}" \u2190 full replacement (whole attr is the placeholder)
|
|
2
|
+
.${a}=\${expression} \u2190 property assignment (preferred for objects/functions)
|
|
3
|
+
`;console.warn(`[template] Partial attribute interpolation is not supported.
|
|
4
|
+
Element: <${r.tagName.toLowerCase()}>
|
|
5
|
+
Attribute: ${a}="${s.value.slice(0,80)}${s.value.length>80?"\u2026":""}"
|
|
6
|
+
Use one of:
|
|
7
|
+
`+u+" Compute the full attr value as a single expression and interpolate the whole.")}continue}let c=+l[1],i=s.name;i[0]==="@"?(r.removeAttribute(i),n[c]={t:"e",n:r,name:i.slice(1),c:void 0,_fx:null}):i[0]==="."?(r.removeAttribute(i),n[c]={t:"p",n:r,name:H(r,i.slice(1)),c:void 0,_fx:null,_resolved:!1}):i[0]==="?"?(r.removeAttribute(i),console.warn(`[template] Lit-style boolean attribute "${i}=" is not supported.
|
|
8
|
+
Element: <${r.tagName.toLowerCase()}>
|
|
9
|
+
Use .${i.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:r,name:i,c:void 0,_fx:null}}return n}function A(t){for(let e of t)e&&e._fx&&(e._fx(),e._fx=null)}function $(t){if(t.n.nodeType===1&&t.n[v])return t.n;let e=document.createElement("span");return e.style.display="contents",e[v]=!0,t.n.replaceWith(e),t.n=e,e}var W=t=>t!=null&&typeof t=="object"&&t.strings,D=t=>typeof t=="function"||t!=null&&typeof t.handleEvent=="function";function L(t,e){if(e!==t.c){if(t.t==="n")if(e!=null&&e._directive)e._commit($(t));else if(W(e))g(e,$(t));else if(Array.isArray(e)){let n=$(t);n.replaceChildren();for(let o of e)if(W(o)){let r=document.createElement("span");r.style.display="contents",n.appendChild(r),g(o,r)}else n.appendChild(document.createTextNode(o??""))}else if(e instanceof Node)t.n.replaceWith(e),t.n=e;else if(t.n[v]){let n=document.createTextNode(e??"");t.n.replaceWith(n),t.n=n}else t.n.textContent=e??"";else if(t.t==="a")e==null||e===!1?t.n.removeAttribute(t.name):t.n.setAttribute(t.name,e===!0?"":e);else if(t.t==="p"){if(!t._resolved){let n=H(t.n,t.name);n!==t.name&&(t.name=n),t._resolved=!0}t.n[t.name]=e}else t.t==="e"&&(D(t.c)&&t.n.removeEventListener(t.name,t.c),D(e)&&t.n.addEventListener(t.name,e));t.c=e}}function ne(t,e){for(let n=0;n<t.length;n++){let o=t[n];if(!o)continue;let r=e[n],s=o.t!=="e"&&typeof r=="function",l=!s&&o.t!=="e"&&O(r);if(o._fx&&!s&&!l&&(o._fx(),o._fx=null),s){o._fx||(o._fx=p(()=>L(o,r())));continue}if(l){o._fx||(o._fx=p(()=>L(o,r.value)));continue}L(o,r)}}function oe(t,e,n){return{_directive:!0,_commit(o){let r=o[b]||new Map,s=new Map,l=[];for(let i=0;i<t.length;i++){let a=e(t[i],i);if(s.has(a))continue;l.push(a);let u=n(t[i],i);if(r.has(a)){let d=r.get(a);g(u,d),s.set(a,d)}else{let d=document.createElement("span");d.style.display="contents",g(u,d),s.set(a,d)}}for(let[i,a]of r)s.has(i)||(a._i&&A(a._i.p),a.remove());let c=null;for(let i=l.length-1;i>=0;i--){let a=s.get(l[i]);(a.nextSibling!==c||a.parentNode!==o)&&o.insertBefore(a,c),c=a}o[b]=s}}}var N=new Map,F=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function fe(t){if(!t.name)throw new Error("Trait requires a name");if(!t.setup)throw new Error(`Trait "${t.name}" requires a setup function`);if(!t.category)throw new Error(`Trait "${t.name}" requires a category`);if(!F.has(t.category))throw new Error(`Trait "${t.name}" has unknown category "${t.category}". Known: ${[...F].join(", ")}`);if(!t.description)throw new Error(`Trait "${t.name}" requires a description`);let e=Object.freeze({name:t.name,category:t.category,description:t.description,attributes:Object.freeze(t.attributes||[]),events:Object.freeze(t.events||[]),config:Object.freeze(t.config||[])});function n(){let o=null;return{schema:e,connect(r,s){o=t.setup({host:r,...s||{}})},disconnect(r){o&&(o(),o=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 n.schema=e,N.set(t.name,n),n}function z(t){return N.get(t)||null}function de(t){return N.get(t)?.schema||null}function he(){return[...N.keys()]}var j=Symbol(),x=Symbol();function re(t,e){t[x]=new Map,t[j]=new Map;for(let[n,o]of Object.entries(e)){let r=o.attribute??n.toLowerCase(),s=o.type??String,l=m(o.default??void 0);t[j].set(n,l),Object.defineProperty(t,n,{get(){return l.value},set(c){let i=l.peek();Object.is(i,c)||(t[x].set(n,i),l.value=c,o.reflect&&se(t,r,c,s))},configurable:!0})}}function se(t,e,n,o){o===Boolean?n?t.setAttribute(e,""):t.removeAttribute(e):n==null?t.removeAttribute(e):t.setAttribute(e,String(n))}var ie=(t,e)=>e===Boolean?t!==null:e===Number?t===null?null:+t:t;function le(t){if(Object.hasOwn(t,"_sa"))return;t._sa=!0;let e=t.styles;if(!e)return;let n=Array.isArray(e)?e:[e];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n.filter(o=>!document.adoptedStyleSheets.includes(o))]}function G(t){if(Object.hasOwn(t,"_pp"))return;t._pp={};let e=t.parts;if(e)for(let[n,o]of Object.entries(e)){let r=document.createElement("template");r.innerHTML=o,t._pp[n]=r.content.firstElementChild}}var E=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let e=Object.entries(this.properties).map(([n,o])=>o.attribute??n.toLowerCase());return e.includes("traits")?e:[...e,"traits"]}#r=[];#e=[];#n=[];#o=null;#s=null;#t=null;#l=m(0);constructor(){super(),this.internals=this.attachInternals(),re(this,this.constructor.properties)}connectedCallback(){let e=this.constructor;e._tag||(e._tag=this.localName),le(e),G(e),M(()=>this.connected()),this.#r.push(p(()=>{for(let o of this[j].values())o.value;this.#l.value;let n=e.template(this);if(n&&g(n,this),this.render(),this[x].size){let o=new Map(this[x]);this[x].clear(),this.updated(o)}},{host:this.localName,onError:this.onError?n=>this.onError(n):null})),this.#t||(this.#t=new Set);for(let n of e.traits)this.#i(n);this.#c(),this.#o&&this.#a()}disconnectedCallback(){this._i&&A(this._i.p);for(let e of this.#r)e();this.#r.length=0;for(let e of this.#n)e.value=void 0;this.#n.length=0;for(let e of this.#e)e.disconnect(this);this.#e.length=0,this.#t?.clear(),this.#s?.(),this.#s=null,this.#o?.disconnect?.(this),this.disconnected()}#a(){let e=this.#o;e.connect?.(this),this.#s=e.subscribe?.(()=>{this.#l.value++})}get controller(){return this.#o}set controller(e){this.#s?.(),this.#s=null,this.#o?.disconnect?.(this),this.#o=e,e&&this.isConnected&&this.#a()}#i(e,{declarative:n=!1}={}){this.#t.add(e);let o=e();o.connect(this,{host:this,signal:m,computed:k,effect:p}),n&&(o._declarative=!0),this.#e.push(o)}addTrait(e){return this.#t||(this.#t=new Set),this.#t.has(e)?this:(this.#i(e),this)}#c(){let e=this.getAttribute("traits");if(e)for(let n of e.split(/\s+/).filter(Boolean)){let o=z(n);if(!o){console.warn(`<${this.localName}> traits="${n}" \u2014 trait not found. Did you forget to import it?`);continue}this.#t.has(o)||this.#i(o,{declarative:!0})}}#f(){if(!this.#t)return;let e=[];for(let n of this.#e)if(n._declarative){n.disconnect(this);for(let o of this.#t)if(o.schema?.name&&n.schema?.name===o.schema.name){this.#t.delete(o);break}}else e.push(n);this.#e.length=0,this.#e.push(...e),this.#c()}attributeChangedCallback(e,n,o){if(e==="traits"){this.isConnected&&this.#f();return}for(let[r,s]of Object.entries(this.constructor.properties))if((s.attribute??r.toLowerCase())===e){this[r]=ie(o,s.type??String);break}}static template=()=>null;static create(e={}){let n=this._tag??customElements.getName?.(this);if(!n)throw new Error("Component not registered");let o=document.createElement(n);for(let[r,s]of Object.entries(e))o[r]=s;return o}signal(e){let n=m(e);return this.#n.push(n),n}ensure(e){for(let s of this.children)if(s.getAttribute("slot")===e)return s;let n=this.#u(e);if(n)return n;G(this.constructor);let o=this.constructor._pp?.[e];if(!o)return null;let r=o.cloneNode(!0);return r._uiPart=!0,this.appendChild(r),r}drop(e){for(let o of this.children)if(o.getAttribute("slot")===e){o.remove();return}let n=this.#u(e);n&&n.remove()}#u(e){for(let n of this.querySelectorAll(`[slot="${e}"]`)){let o=n.parentElement,r=!0;for(;o&&o!==this;){if(o.localName.includes("-")){r=!1;break}o=o.parentElement}if(r&&o===this)return n}return null}reconcile(e,n,o,r){let s=e[b]||new Map,l=new Map,c=[];for(let a=0;a<n.length;a++){let u=n[a],d=o(u,a);if(l.has(d))continue;let w=s.get(d);w?r(u,a,w):w=r(u,a,null),l.set(d,w),c.push(d)}for(let[a,u]of s)l.has(a)||u.remove();let i=null;for(let a=c.length-1;a>=0;a--){let u=l.get(c[a]);(u.nextSibling!==i||u.parentNode!==e)&&e.insertBefore(u,i),i=u}e[b]=l}connected(){}render(){}disconnected(){}updated(e){}};var T=class extends E{static properties={focusMode:{type:Boolean,default:!1,reflect:!0,attribute:"focus-mode"}};static template=()=>null;#r=null;#e=null;#n=null;connected(){this.#r=this.querySelector("editor-toolbar"),this.#e=this.querySelector("editor-canvas"),this.#o(),this.#n=e=>{let n=e?.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.#r?.tagName?.toLowerCase()==="editor-toolbar"&&(this.#r.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}}))}#o(){for(let e of this.querySelectorAll("select-ui[data-options]"))try{let n=JSON.parse(e.getAttribute("data-options"));e.options=n}catch{}}};customElements.define("editor-shell",T);export{T as EditorShell};
|