@adia-ai/web-modules 0.8.39 → 0.8.41
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 +37 -0
- package/README.md +6 -6
- package/agent-admin/admin-roster/admin-roster.a2ui.json +1 -0
- package/agent-admin/admin-roster/admin-roster.css +10 -2
- package/agent-admin/admin-roster/admin-roster.js +70 -22
- package/agent-admin/admin-settings/admin-settings.a2ui.json +1 -0
- package/agent-admin/agent-admin/agent-admin.a2ui.json +1 -0
- package/billing/billing-overview/billing-overview.a2ui.json +10 -1
- package/billing/billing-overview/billing-overview.class.js +142 -73
- package/billing/billing-overview/billing-overview.css +70 -57
- package/billing/billing-overview/billing-overview.yaml +5 -0
- package/billing/invoice-detail/invoice-detail.a2ui.json +9 -4
- package/billing/invoice-detail/invoice-detail.class.js +22 -5
- package/billing/invoice-detail/invoice-detail.yaml +9 -4
- package/billing/invoice-history/invoice-history.a2ui.json +7 -4
- package/billing/invoice-history/invoice-history.class.js +45 -12
- package/billing/invoice-history/invoice-history.css +18 -15
- package/billing/invoice-history/invoice-history.yaml +10 -4
- package/billing/payment-method-form/payment-method-form.a2ui.json +1 -0
- package/billing/payment-method-form/payment-method-form.class.js +3 -3
- package/billing/payment-method-form/payment-method-form.css +4 -4
- package/billing/payment-method-list/payment-method-list.a2ui.json +4 -0
- package/billing/payment-method-list/payment-method-list.class.js +31 -11
- package/billing/payment-method-list/payment-method-list.css +13 -10
- package/billing/payment-method-list/payment-method-list.yaml +3 -0
- package/billing/plan-picker/plan-picker.a2ui.json +6 -0
- package/billing/plan-picker/plan-picker.class.js +70 -22
- package/billing/plan-picker/plan-picker.css +21 -38
- package/billing/plan-picker/plan-picker.yaml +5 -0
- package/chat/chat-composer/chat-composer.a2ui.json +1 -0
- package/chat/chat-empty/chat-empty.a2ui.json +4 -0
- package/chat/chat-empty/chat-empty.yaml +2 -0
- package/chat/chat-header/chat-header.a2ui.json +5 -0
- package/chat/chat-header/chat-header.yaml +3 -0
- package/chat/chat-shell/chat-shell.a2ui.json +4 -0
- package/chat/chat-shell/chat-shell.yaml +2 -0
- package/chat/chat-shell/css/chat-shell.tokens.css +1 -1
- package/chat/chat-sidebar/chat-sidebar.a2ui.json +4 -0
- package/chat/chat-sidebar/chat-sidebar.yaml +2 -0
- package/chat/chat-status/chat-status.a2ui.json +4 -0
- package/chat/chat-status/chat-status.yaml +2 -0
- package/chat/chat-thread/chat-thread.a2ui.json +4 -0
- package/chat/chat-thread/chat-thread.yaml +2 -0
- package/dashboard/dashboard-layout/dashboard-layout.a2ui.json +8 -8
- package/dashboard/dashboard-layout/dashboard-layout.css +4 -4
- package/dashboard/dashboard-layout/dashboard-layout.js +10 -9
- package/dashboard/dashboard-layout/dashboard-layout.yaml +19 -7
- package/dashboard/date-range-selector/date-range-selector.a2ui.json +4 -3
- package/dashboard/date-range-selector/date-range-selector.yaml +6 -4
- package/dist/chat/chat-shell.min.css +1 -1
- package/dist/chat/chat-shell.min.js +25 -25
- package/dist/editor/editor-shell.min.js +3 -3
- package/dist/everything.min.js +118 -131
- package/dist/shell/admin-shell.min.css +1 -1
- package/dist/shell/admin-shell.min.js +6 -6
- package/dist/simple/simple-shell.min.js +5 -5
- package/dist/web-modules.min.css +1 -1
- package/dist/web-modules.sheet.js +1 -1
- package/editor/editor-canvas/editor-canvas.a2ui.json +4 -0
- package/editor/editor-canvas/editor-canvas.yaml +2 -0
- package/editor/editor-canvas-empty/editor-canvas-empty.a2ui.json +4 -0
- package/editor/editor-canvas-empty/editor-canvas-empty.yaml +2 -0
- package/editor/editor-canvas-toolbar/editor-canvas-toolbar.a2ui.json +4 -0
- package/editor/editor-canvas-toolbar/editor-canvas-toolbar.yaml +2 -0
- package/editor/editor-shell/editor-shell.a2ui.json +5 -0
- package/editor/editor-shell/editor-shell.yaml +3 -0
- package/editor/editor-sidebar/editor-sidebar.a2ui.json +4 -0
- package/editor/editor-sidebar/editor-sidebar.yaml +2 -0
- package/editor/editor-statusbar/editor-statusbar.a2ui.json +4 -0
- package/editor/editor-statusbar/editor-statusbar.yaml +2 -0
- package/editor/editor-toolbar/editor-toolbar.a2ui.json +4 -0
- package/editor/editor-toolbar/editor-toolbar.yaml +2 -0
- package/feedback/confirm-dialog/confirm-dialog.a2ui.json +1 -0
- package/form/form-popover/form-popover.a2ui.json +1 -0
- package/onboarding/onboarding-checklist/onboarding-checklist.a2ui.json +2 -1
- package/onboarding/onboarding-checklist/onboarding-checklist.js +2 -2
- package/onboarding/onboarding-checklist/onboarding-checklist.yaml +1 -1
- package/package.json +6 -6
- package/runtime/a2ui-root/a2ui-root.a2ui.json +6 -5
- package/runtime/a2ui-root/a2ui-root.css +75 -0
- package/runtime/a2ui-root/a2ui-root.js +118 -10
- package/runtime/a2ui-root/a2ui-root.yaml +7 -2
- package/runtime/gen-root/gen-root.a2ui.json +6 -5
- package/runtime/gen-root/gen-root.yaml +10 -2
- package/settings/integrations-page/integrations-page.a2ui.json +3 -2
- package/settings/integrations-page/integrations-page.js +8 -8
- package/settings/integrations-page/integrations-page.yaml +2 -2
- package/settings/notification-preferences/notification-preferences.a2ui.json +1 -0
- package/shell/admin-command/admin-command.a2ui.json +5 -1
- package/shell/admin-command/admin-command.yaml +3 -1
- package/shell/admin-content/admin-content.a2ui.json +4 -0
- package/shell/admin-content/admin-content.yaml +2 -0
- package/shell/admin-entity-item/admin-entity-item.a2ui.json +1 -0
- package/shell/admin-page/admin-page.a2ui.json +5 -0
- package/shell/admin-page/admin-page.yaml +3 -0
- package/shell/admin-page-body/admin-page-body.a2ui.json +4 -0
- package/shell/admin-page-body/admin-page-body.yaml +2 -0
- package/shell/admin-page-footer/admin-page-footer.a2ui.json +4 -0
- package/shell/admin-page-footer/admin-page-footer.yaml +2 -0
- package/shell/admin-page-header/admin-page-header.a2ui.json +4 -0
- package/shell/admin-page-header/admin-page-header.yaml +2 -0
- package/shell/admin-scroll/admin-scroll.a2ui.json +4 -0
- package/shell/admin-scroll/admin-scroll.yaml +2 -0
- package/shell/admin-shell/admin-shell.a2ui.json +7 -3
- package/shell/admin-shell/admin-shell.yaml +3 -1
- package/shell/admin-shell/css/admin-shell.sidebar.css +2 -2
- package/shell/admin-sidebar/admin-sidebar.a2ui.json +4 -0
- package/shell/admin-sidebar/admin-sidebar.yaml +2 -0
- package/shell/admin-statusbar/admin-statusbar.a2ui.json +6 -0
- package/shell/admin-statusbar/admin-statusbar.yaml +4 -0
- package/shell/admin-topbar/admin-topbar.a2ui.json +6 -0
- package/shell/admin-topbar/admin-topbar.yaml +4 -0
- package/shell/embed-shell/embed-shell.a2ui.json +1 -0
- package/simple/simple-content/simple-content.a2ui.json +4 -0
- package/simple/simple-content/simple-content.yaml +2 -0
- package/simple/simple-hero/simple-hero.a2ui.json +4 -0
- package/simple/simple-hero/simple-hero.yaml +2 -0
- package/simple/simple-shell/simple-shell.a2ui.json +4 -0
- package/simple/simple-shell/simple-shell.yaml +2 -0
- package/theme/theme-panel/theme-panel.a2ui.json +1 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function
|
|
1
|
+
function me(e,t){customElements.define(e,t)}function R(e,t){return customElements.get(e)?!1:(customElements.define(e,t),!0)}function ge(e){return!!customElements.get(e)}var A=Symbol("signal"),f=null,h=null,E=!1;function I(e){for(let t of e){if(t.disposed){e.delete(t);continue}t.dirty=!0,h||(h=new Set,E||queueMicrotask(q)),h.add(t)}}function q(){let e,t=0;for(;e=h;){if(++t>100){h=null,console.error("signals: drain loop exceeded 100 iterations",JSON.stringify([...e].map(n=>n.host||"?")));break}h=null;for(let n of e)if(!n.disposed&&n.dirty){n.dirty=!1;try{n.run()}catch(r){n.onError?n.onError(r):(n.disposed=!0,queueMicrotask(()=>{throw r}))}}}}function Y(e){if(E){e();return}E=!0;try{e()}finally{E=!1,h&&q()}}function _(e){let t=f;f=null;try{return e()}finally{f=t}}function m(e){let t=new Set;return{[A]:!0,get value(){return f&&t.add(f),e},set value(n){Object.is(e,n)||(e=n,I(t))},peek(){return e}}}function $(e){let t=new Set,n,r=!0,o={dirty:!1,disposed:!1,run(){r=!0,I(t)}};return{[A]:!0,get value(){if(f&&t.add(f),r){let i=f;f=o;try{n=e(),r=!1}finally{f=i}}return n},peek(){return n}}}function p(e,t){let n={dirty:!1,disposed:!1,host:t?.host??null,onError:t?.onError??null,run(){let r=f;f=n;try{e()}finally{f=r}}};return n.run(),()=>{n.disposed=!0}}function v(e){return e!=null&&typeof e=="object"&&e[A]===!0}function M(e){return e!=null&&typeof e=="object"&&typeof e.nodeType=="number"}function xe(e){return M(e)&&e.nodeType===1}var[k,y]=[Symbol(),Symbol()];function Q(e,...t){return{strings:e,values:t}}function Z(e,...t){let n="";for(let o=0;o<e.length;o++)n+=e[o],o<t.length&&(n+=t[o]);let r=new CSSStyleSheet;return r.replaceSync(n),r}var B=new WeakMap;function ee(e){let t=0,n=0,r=0;for(;r<e.length;){if(t===0&&e.charCodeAt(r)===60&&e.charCodeAt(r+1)===33&&e.charCodeAt(r+2)===45&&e.charCodeAt(r+3)===45){let i=e.indexOf("-->",r+4);if(i===-1){n=0;break}r=i+3,n=0;continue}let o=e.charCodeAt(r);t?o===(t===1?39:34)&&(t=0):o===39?t=1:o===34?t=2:o===60?n=1:o===62&&(n=0),r++}return n===1}function te(e){let t=B.get(e);if(t)return t;let n="";for(let r=0;r<e.length;r++)n+=e[r],r<e.length-1&&(n+=ee(n)?`{{p:${r}}}`:`<!--p:${r}-->`);return t=document.createElement("template"),t.innerHTML=n,B.set(e,t),t}var F={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 W(e,t){if(F[t])return F[t];let n=Object.getOwnPropertyNames(e);for(let o=0;o<n.length;o++){let i=n[o];if(i!==t&&i.toLowerCase()===t)return i}let r=Object.getPrototypeOf(e);for(;r&&r!==Object.prototype;){let o=Object.getOwnPropertyNames(r);for(let i=0;i<o.length;i++){let a=o[i];if(a!==t&&a.toLowerCase()===t)return a}r=Object.getPrototypeOf(r)}return t}function g(e,t){let n=t._i;(!n||n.s!==e.strings)&&(n&&T(n.p),n=ne(e,t),t._i=n),se(n.p,e.values)}function ne(e,t){let{strings:n}=e,o=te(n).content.cloneNode(!0),i=re(t);i&&(o=oe(o,i));let a=ie(o,e.values.length);return t.replaceChildren(o),{s:n,p:a}}var N="http://www.w3.org/2000/svg",b="http://www.w3.org/1998/Math/MathML",D="http://www.w3.org/1999/xhtml";function re(e){if(!e||e.nodeType!==1)return null;if(e.namespaceURI===N)return N;if(e.namespaceURI===b)return b;if(typeof e.closest!="function")return null;let t=e.closest("svg, math, foreignObject, annotation-xml");if(!t)return null;let n=t.localName;if(n==="foreignobject"||n==="foreignObject")return null;if(n==="annotation-xml"){let r=(t.getAttribute("encoding")||"").toLowerCase();return r==="text/html"||r==="application/xhtml+xml"?null:b}return n==="svg"?N:n==="math"?b:null}function oe(e,t){let n=document.createDocumentFragment();return H(e,n,t),n}function H(e,t,n){for(let r of[...e.childNodes])if(r.nodeType===1){let i=document.createElementNS(n,r.localName);for(let s of r.attributes)s.namespaceURI?i.setAttributeNS(s.namespaceURI,s.name,s.value):i.setAttribute(s.name,s.value);t.appendChild(i);let a=r.localName,c=n;if(n===N&&(a==="foreignObject"||a==="foreignobject"))c=D;else if(n===b&&a==="annotation-xml"){let s=(r.getAttribute("encoding")||"").toLowerCase();(s==="text/html"||s==="application/xhtml+xml")&&(c=D)}H(r,i,c)}else t.appendChild(r.cloneNode(!0))}function ie(e,t){let n=new Array(t),r=document.createTreeWalker(e,129),o;for(;o=r.nextNode();)if(o.nodeType===8){let i=o.data.match(/^p:(\d+)$/);if(i){let a=document.createTextNode("");o.replaceWith(a),r.currentNode=a,n[+i[1]]={t:"n",n:a,c:void 0,_fx:null}}}else if(o.nodeType===1)for(let i of[...o.attributes]){let a=i.value.match(/^\{\{p:(\d+)\}\}$/);if(!a){if(i.value.includes("{{p:")){let l=i.name,u=l==="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':l==="style"?' style="${expression}" \u2190 full replacement of the style string\n .style.cssText=${expression} \u2190 write CSS text via the style.cssText accessor\n':` ${l}="\${expression}" \u2190 full replacement (whole attr is the placeholder)
|
|
2
2
|
.${l}=\${expression} \u2190 property assignment (preferred for objects/functions)
|
|
3
3
|
`;console.warn(`[template] Partial attribute interpolation is not supported.
|
|
4
4
|
Element: <${o.tagName.toLowerCase()}>
|
|
5
5
|
Attribute: ${l}="${i.value.slice(0,80)}${i.value.length>80?"\u2026":""}"
|
|
6
6
|
Use one of:
|
|
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:
|
|
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 E(t){for(let e of t)e&&e._fx&&(e._fx(),e._fx=null)}function j(t){if(t.n.nodeType===1&&t.n[v])return t.n;let e=document.createElement("span");return e.style.display="contents",e.setAttribute("role","presentation"),e[v]=!0,t.n.replaceWith(e),t.n=e,e}var U=t=>t!=null&&typeof t=="object"&&t.strings,W=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(j(t));else if(U(e))g(e,j(t));else if(Array.isArray(e)){let n=j(t);n.replaceChildren();for(let r of e)if(U(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(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=F(t.n,t.name);n!==t.name&&(t.name=n),t._resolved=!0}t.n[t.name]=e}else t.t==="e"&&(W(t.c)&&t.n.removeEventListener(t.name,t.c),W(e)&&t.n.addEventListener(t.name,e));t.c=e}}function oe(t,e){for(let n=0;n<t.length;n++){let r=t[n];if(!r)continue;let o=e[n],i=r.t!=="e"&&typeof o=="function",a=!i&&r.t!=="e"&&k(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 ie(t,e,n){return{_directive:!0,_commit(r){let o=r[b]||new Map,i=new Map,a=[];for(let s=0;s<t.length;s++){let l=e(t[s],s);if(i.has(l))continue;a.push(l);let u=n(t[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&&E(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[b]=i}}}var N=new Map,z=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function ge(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(!z.has(t.category))throw new Error(`Trait "${t.name}" has unknown category "${t.category}". Known: ${[...z].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 r=null;return{schema:e,connect(o,i){r=t.setup({host:o,...i||{}})},disconnect(o){r&&(r(),r=null);for(let i of e.attributes)o.hasAttribute(i)&&(console.warn(`Trait "${e.name}": attribute "${i}" still present after disconnect`),o.removeAttribute(i))}}}return n.schema=e,N.set(t.name,n),n}function D(t){return N.get(t)||null}function be(t){return N.get(t)?.schema||null}function ye(){return[...N.keys()]}var $=Symbol(),x=Symbol();function se(t,e){t[x]=new Map,t[$]=new Map;for(let[n,r]of Object.entries(e)){let o=r.attribute??n.toLowerCase(),i=r.type??String,a=Object.prototype.hasOwnProperty.call(t,n),c=a?t[n]:void 0;a&&delete t[n];let s=m(r.default??void 0);t[$].set(n,s),Object.defineProperty(t,n,{get(){return s.value},set(l){let u=s.peek();Object.is(u,l)||(t[x].set(n,u),s.value=l,r.reflect&&ae(t,o,l,i))},configurable:!0}),a&&(s.value=c)}}var le=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 ae(t,e,n,r){r===Boolean?n?t.setAttribute(e,""):t.removeAttribute(e):n==null?t.removeAttribute(e):t.setAttribute(e,String(n))}var G=(t,e)=>e===Boolean?t!==null:e===Number?t===null?null:+t:t;function ce(t){if(Object.hasOwn(t,"_sa"))return;t._sa=!0;let e=t.styles;if(!e||!("adoptedStyleSheets"in document))return;let n=Array.isArray(e)?e:[e];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...n.filter(r=>!document.adoptedStyleSheets.includes(r))]}function K(t){if(Object.hasOwn(t,"_pp"))return;t._pp={};let e=t.parts;if(e)for(let[n,r]of Object.entries(e)){let o=document.createElement("template");o.innerHTML=r,t._pp[n]=o.content.firstElementChild}}var O=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let e=Object.entries(this.properties).map(([n,r])=>r.attribute??n.toLowerCase());return e.includes("traits")?e:[...e,"traits"]}#o=[];#e=[];#n=[];#r=null;#i=null;#t=null;#l=m(0);constructor(){super(),this.internals=typeof this.attachInternals=="function"?this.attachInternals():le,se(this,this.constructor.properties)}connectedCallback(){let e=this.constructor;e._tag||(e._tag=this.localName),ce(e),K(e),_(()=>{for(let[n,r]of Object.entries(e.properties)){let o=r.attribute??n.toLowerCase();this.hasAttribute(o)?this[n]=G(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[$].values())r.value;this.#l.value;let n=e.template(this);if(n&&g(n,this),this.render(),this[x].size){let r=new Map(this[x]);this[x].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 e.traits)this.#s(n);this.#c(),this.#r&&this.#a()}disconnectedCallback(){this._i&&E(this._i.p);for(let e of this.#o)e();this.#o.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.#i?.(),this.#i=null,this.#r?.disconnect?.(this),this.disconnected()}#a(){let e=this.#r;e.connect?.(this),this.#i=e.subscribe?.(()=>{this.#l.value++})}get controller(){return this.#r}set controller(e){this.#i?.(),this.#i=null,this.#r?.disconnect?.(this),this.#r=e,e&&this.isConnected&&this.#a()}#s(e,{declarative:n=!1}={}){this.#t.add(e);let r=e();r.connect(this,{host:this,signal:m,computed:M,effect:p}),n&&(r._declarative=!0),this.#e.push(r)}addTrait(e){return this.#t||(this.#t=new Set),this.#t.has(e)?this:(this.#s(e),this)}#c(){let e=this.getAttribute("traits");if(e)for(let n of e.split(/\s+/).filter(Boolean)){let r=D(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 e=[];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 e.push(n);this.#e.length=0,this.#e.push(...e),this.#c()}attributeChangedCallback(e,n,r){if(e==="traits"){this.isConnected&&this.#f();return}for(let[o,i]of Object.entries(this.constructor.properties))if((i.attribute??o.toLowerCase())===e){this[o]=G(r,i.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 r=document.createElement(n);for(let[o,i]of Object.entries(e))r[o]=i;return r}signal(e){let n=m(e);return this.#n.push(n),n}ensure(e){for(let i of this.children)if(i.getAttribute("slot")===e)return i;let n=this.#u(e);if(n)return n;K(this.constructor);let r=this.constructor._pp?.[e];if(!r)return null;let o=r.cloneNode(!0);return o._uiPart=!0,this.appendChild(o),o}drop(e){for(let r of this.children)if(r.getAttribute("slot")===e){r.remove();return}let n=this.#u(e);n&&n.remove()}#u(e){for(let n of this.querySelectorAll(`[slot="${e}"]`)){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(e,n,r,o){let i=e[b]||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 w=i.get(d);w?o(u,l,w):w=o(u,l,null),a.set(d,w),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!==e)&&e.insertBefore(u,s),s=u}e[b]=a}connected(){}render(){}disconnected(){}updated(e){}};var T=class extends O{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=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.#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 e of this.querySelectorAll("select-ui[data-options]"))try{let n=JSON.parse(e.getAttribute("data-options"));e.options=n}catch{}}};P("editor-shell",T);export{T 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: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};
|