@webmcpui/core 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +160 -2
- package/dist/index.js +522 -1
- package/dist/webmcpui.global.js +279 -45
- package/package.json +1 -1
package/dist/webmcpui.global.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var webmcpui=(()=>{var we=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var Yt=Object.prototype.hasOwnProperty;var Zt=(i,t)=>{for(var e in t)we(i,e,{get:t[e],enumerable:!0})},Xt=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Kt(t))!Yt.call(i,o)&&o!==e&&we(i,o,{get:()=>t[o],enumerable:!(r=dt(t,o))||r.enumerable});return i};var Qt=i=>Xt(we({},"__esModule",{value:!0}),i),l=(i,t,e,r)=>{for(var o=r>1?void 0:r?dt(t,e):t,s=i.length-1,n;s>=0;s--)(n=i[s])&&(o=(r?n(t,e,o):n(o))||o);return r&&o&&we(t,e,o),o};var _r={};Zt(_r,{WmcpAction:()=>E,WmcpButton:()=>N,WmcpCheckbox:()=>oe,WmcpDialog:()=>V,WmcpExposable:()=>R,WmcpFormControl:()=>b,WmcpInput:()=>te,WmcpMenu:()=>I,WmcpPopover:()=>L,WmcpRadio:()=>ae,WmcpRadioGroup:()=>J,WmcpSelect:()=>F,WmcpTabs:()=>z,WmcpTextarea:()=>re,WmcpToast:()=>C,defineComponents:()=>qe,exposeTool:()=>Ve,isStandardSchema:()=>Be,isWebMCPAvailable:()=>Bt,textFieldStyles:()=>q,validateStandard:()=>Ue});var pt=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var P=function(i,t,e,r,o){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!o:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?o.call(i,e):o?o.value=e:t.set(i,e),e},w=function(i,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!r:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(i):r?r.value:t.get(i)},ie,Ee,$e,ce,Fe,de,Te,K,pe,j,Re,ut;var _={__proto__:null};_.enumerable=!0;Object.freeze(_);var Je=(j=class{constructor(t,e={}){if(ie.set(this,!1),Ee.set(this,!1),$e.set(this,!1),ce.set(this,!1),Fe.set(this,Date.now()),de.set(this,!1),Te.set(this,void 0),K.set(this,void 0),pe.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:o,composed:s}=e;P(this,ie,!!o,"f"),P(this,Ee,!!r,"f"),P(this,$e,!!s,"f"),P(this,Te,`${t}`,"f"),P(this,K,null,"f"),P(this,pe,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){P(this,ce,!0,"f")}get target(){return w(this,K,"f")}get currentTarget(){return w(this,K,"f")}get srcElement(){return w(this,K,"f")}get type(){return w(this,Te,"f")}get cancelable(){return w(this,ie,"f")}get defaultPrevented(){return w(this,ie,"f")&&w(this,ce,"f")}get timeStamp(){return w(this,Fe,"f")}composedPath(){return w(this,pe,"f")?[w(this,K,"f")]:[]}get returnValue(){return!w(this,ie,"f")||!w(this,ce,"f")}get bubbles(){return w(this,Ee,"f")}get composed(){return w(this,$e,"f")}get eventPhase(){return w(this,pe,"f")?j.AT_TARGET:j.NONE}get cancelBubble(){return w(this,de,"f")}set cancelBubble(t){t&&P(this,de,!0,"f")}stopPropagation(){P(this,de,!0,"f")}get isTrusted(){return!1}},ie=new WeakMap,Ee=new WeakMap,$e=new WeakMap,ce=new WeakMap,Fe=new WeakMap,de=new WeakMap,Te=new WeakMap,K=new WeakMap,pe=new WeakMap,j.NONE=0,j.CAPTURING_PHASE=1,j.AT_TARGET=2,j.BUBBLING_PHASE=3,j);Object.defineProperties(Je.prototype,{initEvent:_,stopImmediatePropagation:_,preventDefault:_,target:_,currentTarget:_,srcElement:_,type:_,cancelable:_,defaultPrevented:_,timeStamp:_,composedPath:_,returnValue:_,bubbles:_,composed:_,eventPhase:_,cancelBubble:_,stopPropagation:_,isTrusted:_});var ht=(ut=class extends Je{constructor(t,e={}){super(t,e),Re.set(this,void 0),P(this,Re,e?.detail??null,"f")}initCustomEvent(t,e,r,o){throw new Error("Method not implemented.")}get detail(){return w(this,Re,"f")}},Re=new WeakMap,ut);Object.defineProperties(ht.prototype,{detail:_});var W=Je,Ke=ht;var $;var kr=($=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},$.STYLE_RULE=1,$.CHARSET_RULE=2,$.IMPORT_RULE=3,$.MEDIA_RULE=4,$.FONT_FACE_RULE=5,$.PAGE_RULE=6,$.NAMESPACE_RULE=10,$.KEYFRAMES_RULE=7,$.KEYFRAME_RULE=8,$.SUPPORTS_RULE=12,$.COUNTER_STYLE_RULE=11,$.FONT_FEATURE_VALUES_RULE=14,$.MARGIN_RULE=9,$);globalThis.Event??=W;globalThis.CustomEvent??=Ke;var Ze=Symbol(),mt=i=>typeof i=="boolean"?i:i?.capture??!1,D={__proto__:null};D.enumerable=!0;Object.freeze(D);var Ae=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let o=mt(r)?this.__captureEventListeners:this.__eventListeners,s=o.get(t);if(s===void 0)s=new Map,o.set(t,s);else if(s.has(e))return;let n=typeof r=="object"&&r?r:{};n.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),s.set(e,n??{})}removeEventListener(t,e,r){if(e==null)return;let o=mt(r)?this.__captureEventListeners:this.__eventListeners,s=o.get(t);s!==void 0&&(s.delete(e),s.size||o.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,o=!1,s=W.NONE,n=null,c=null,a=null,g=t.stopPropagation,x=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return n??c},...D},srcElement:{get(){return t.target},...D},currentTarget:{get(){return a},...D},eventPhase:{get(){return s},...D},composedPath:{value:()=>e,...D},stopPropagation:{value:()=>{r=!0,g.call(t)},...D},stopImmediatePropagation:{value:()=>{o=!0,x.call(t)},...D}});let u=(y,A,le)=>{typeof y=="function"?y(t):typeof y?.handleEvent=="function"&&y.handleEvent(t),A.once&&le.delete(y)},v=()=>(a=null,s=W.NONE,!t.defaultPrevented),m=e.slice().reverse();n=!this.__host||!t.composed?this:null;let S=y=>{for(c=this;c.__host&&y.includes(c.__host);)c=c.__host};for(let y of m){!n&&(!c||c===y.__host)&&S(m.slice(m.indexOf(y))),a=y,s=y===t.target?W.AT_TARGET:W.CAPTURING_PHASE;let A=y.__captureEventListeners.get(t.type);if(A){for(let[le,Ge]of A)if(u(le,Ge,A),o)return v()}if(r)return v()}let T=t.bubbles?e:[this];c=null;for(let y of T){!n&&(!c||y===c.__host)&&S(T.slice(0,T.indexOf(y)+1)),a=y,s=y===t.target?W.AT_TARGET:W.BUBBLING_PHASE;let A=y.__eventListeners.get(t.type);if(A){for(let[le,Ge]of A)if(u(le,Ge,A),o)return v()}if(r)return v()}return v()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,gt,rr]}};var vt=new WeakMap,ue=i=>{let t=vt.get(i);return t===void 0&&vt.set(i,t=new Map),t},he=class extends Ae{getRootNode(t){return t?.composed?Ye:this.__host?.__shadowRoot??Ye}};var bt=class extends he{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var gt=new bt,Ye=gt;var ft=class extends he{constructor(t){if(super(),t!==Ze)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:ke,customElements:Qe,document:Ye,Document:bt,Element:yt,EventTarget:Ae,HTMLElement:xt,Node:he,ShadowRoot:St,window:this,Window:ft})}};var yt=class extends he{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(ue(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){ue(this).set(t,String(e))}removeAttribute(t){ue(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return ue(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new St(Ze,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new pt(this);return this.__internals=t,t}getAttribute(t){return ue(this).get(t)??null}};var xt=class extends yt{},Xe=xt;var St=class extends he{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new Xe,"localName",{get(){return"lit-server-root"}});function er(){let i,t;return{promise:new Promise((r,o)=>{i=r,t=o}),resolve:i,reject:t}}var ke=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
-
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let r=this.__pendingWhenDefineds.get(t);return r||(r=
|
|
3
|
-
\f\r]`,
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Pt=/'/g,Ot=/"/g,It=/^(?:script|style|textarea|title)$/i,nt=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),h=nt(1),lo=nt(2),co=nt(3),B=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),Mt=new WeakMap,Z=X.createTreeWalker(X,129);function Lt(i,t){if(!st(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return At!==void 0?At.createHTML(t):t}var Wt=(i,t)=>{let e=i.length-1,r=[],o,s=t===2?"<svg>":t===3?"<math>":"",n=ye;for(let c=0;c<e;c++){let a=i[c],g,x,u=-1,v=0;for(;v<a.length&&(n.lastIndex=v,x=n.exec(a),x!==null);)v=n.lastIndex,n===ye?x[1]==="!--"?n=kt:x[1]!==void 0?n=Ct:x[2]!==void 0?(It.test(x[2])&&(o=RegExp("</"+x[2],"g")),n=Y):x[3]!==void 0&&(n=Y):n===Y?x[0]===">"?(n=o??ye,u=-1):x[1]===void 0?u=-2:(u=n.lastIndex-x[2].length,g=x[1],n=x[3]===void 0?Y:x[3]==='"'?Ot:Pt):n===Ot||n===Pt?n=Y:n===kt||n===Ct?n=ye:(n=Y,o=void 0);let m=n===Y&&i[c+1].startsWith("/>")?" ":"";s+=n===ye?a+pr:u>=0?(r.push(g),a.slice(0,u)+ot+a.slice(u)+U+m):a+U+(u===-2?c:m)}return[Lt(i,s+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},_e=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let s=0,n=0,c=t.length-1,a=this.parts,[g,x]=Wt(t,e);if(this.el=i.createElement(g,r),Z.currentNode=this.el.content,e===2||e===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(o=Z.nextNode())!==null&&a.length<c;){if(o.nodeType===1){if(o.hasAttributes())for(let u of o.getAttributeNames())if(u.endsWith(ot)){let v=x[n++],m=o.getAttribute(u).split(U),S=/([.?@])?(.*)/.exec(v);a.push({type:1,index:s,name:S[2],strings:m,ctor:S[1]==="."?Ne:S[1]==="?"?Ie:S[1]==="@"?Le:ee}),o.removeAttribute(u)}else u.startsWith(U)&&(a.push({type:6,index:s}),o.removeAttribute(u));if(It.test(o.tagName)){let u=o.textContent.split(U),v=u.length-1;if(v>0){o.textContent=Oe?Oe.emptyScript:"";for(let m=0;m<v;m++)o.append(u[m],xe()),Z.nextNode(),a.push({type:2,index:++s});o.append(u[v],xe())}}}else if(o.nodeType===8)if(o.data===it)a.push({type:2,index:s});else{let u=-1;for(;(u=o.data.indexOf(U,u+1))!==-1;)a.push({type:7,index:s}),u+=U.length-1}s++}}static createElement(t,e){let r=X.createElement("template");return r.innerHTML=t,r}};function Q(i,t,e=i,r){if(t===B)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,s=Se(t)?void 0:t._$litDirective$;return o?.constructor!==s&&(o?._$AO?.(!1),s===void 0?o=void 0:(o=new s(i),o._$AT(i,e,r)),r!==void 0?(e._$Co??=[])[r]=o:e._$Cl=o),o!==void 0&&(t=Q(i,o._$AS(i,t.values),o,r)),t}var Me=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,o=(t?.creationScope??X).importNode(e,!0);Z.currentNode=o;let s=Z.nextNode(),n=0,c=0,a=r[0];for(;a!==void 0;){if(n===a.index){let g;a.type===2?g=new se(s,s.nextSibling,this,t):a.type===1?g=new a.ctor(s,a.name,a.strings,this,t):a.type===6&&(g=new We(s,this,t)),this._$AV.push(g),a=r[++c]}n!==a?.index&&(s=Z.nextNode(),n++)}return Z.currentNode=X,o}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},se=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Q(this,t,e),Se(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==B&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Nt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&Se(this._$AH)?this._$AA.nextSibling.data=t:this.T(X.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,o=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=_e.createElement(Lt(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let s=new Me(o,this),n=s.u(this.options);s.p(e),this.T(n),this._$AH=s}}_$AC(t){let e=Mt.get(t.strings);return e===void 0&&Mt.set(t.strings,e=new _e(t)),e}k(t){st(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,o=0;for(let s of t)o===e.length?e.push(r=new i(this.O(xe()),this.O(xe()),this,this.options)):r=e[o],r._$AI(s),o++;o<e.length&&(this._$AR(r&&r._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=Rt(t).nextSibling;Rt(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ee=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,s){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=p}_$AI(t,e=this,r,o){let s=this.strings,n=!1;if(s===void 0)t=Q(this,t,e,0),n=!Se(t)||t!==this._$AH&&t!==B,n&&(this._$AH=t);else{let c=t,a,g;for(t=s[0],a=0;a<s.length-1;a++)g=Q(this,c[r+a],e,a),g===B&&(g=this._$AH[a]),n||=!Se(g)||g!==this._$AH[a],g===p?t=p:t!==p&&(t+=(g??"")+s[a+1]),this._$AH[a]=g}n&&!o&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ne=class extends ee{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}},Ie=class extends ee{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}},Le=class extends ee{constructor(t,e,r,o,s){super(t,e,r,o,s),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??p)===B)return;let r=this._$AH,o=t===p&&r!==p||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==p&&(r===p||o);o&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},We=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}},Dt={M:ot,P:U,A:it,C:1,L:Wt,R:Me,D:Nt,V:Q,I:se,H:ee,N:Ie,U:Le,B:Ne,F:We},ur=De.litHtmlPolyfillSupport;ur?.(_e,se),(De.litHtmlVersions??=[]).push("3.3.3");var Ht=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let s=e?.renderBefore??null;r._$litPart$=o=new se(t.insertBefore(xe(),s),s,void 0,e??{})}return o._$AI(i),o};var at=globalThis,O=class extends H{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ht(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return B}};O._$litElement$=!0,O.finalized=!0,at.litElementHydrateSupport?.({LitElement:O});var hr=at.litElementPolyfillSupport;hr?.({LitElement:O});(at.litElementVersions??=[]).push("4.2.2");var mr={attribute:!0,type:String,converter:ge,reflect:!1,hasChanged:Pe},vr=(i=mr,t,e)=>{let{kind:r,metadata:o}=e,s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),r==="setter"&&((i=Object.create(i)).wrapped=!0),s.set(e.name,i),r==="accessor"){let{name:n}=e;return{set(c){let a=t.get.call(this);t.set.call(this,c),this.requestUpdate(n,a,i,!0,c)},init(c){return c!==void 0&&this.C(n,void 0,i,c),c}}}if(r==="setter"){let{name:n}=e;return function(c){let a=this[n];t.call(this,c),this.requestUpdate(n,a,i,!0,c)}}throw Error("Unsupported decorator location: "+r)};function d(i){return(t,e)=>typeof e=="object"?vr(i,t,e):((r,o,s)=>{let n=o.hasOwnProperty(s);return o.constructor.createProperty(s,r),n?Object.getOwnPropertyDescriptor(o,s):void 0})(i,t,e)}function k(i){return d({...i,state:!0,attribute:!1})}async function Ue(i,t){let e=await i["~standard"].validate(t);return e.issues?{valid:!1,errors:e.issues.map(r=>r.message)}:{valid:!0,value:e.value,errors:[]}}function Be(i){return typeof i=="object"&&i!==null&&"~standard"in i&&typeof i["~standard"]?.validate=="function"}function Ut(){let i=typeof document<"u"?document.modelContext:void 0,t=typeof navigator<"u"?navigator.modelContext:void 0,e=i??t;return e&&typeof e.registerTool=="function"?e:void 0}function Bt(){return Ut()!==void 0}var br=globalThis.process?.env?.NODE_ENV!=="production",lt=new Set;function Ve(i){let t=Ut();if(!t?.registerTool)return()=>{};let e={name:i.name,description:i.description,inputSchema:i.inputSchema??{type:"object",properties:{}},execute:i.execute};br&<.has(e.name)&&console.warn(`[webmcpui] A WebMCP tool named "${e.name}" is already registered on this page. Tool names are page-global, so the host rejects the duplicate and this control won't be agent-callable. Give one control a unique \`name\`, or override it with \`tool-name\`.`),lt.add(e.name);let r=typeof AbortController=="function"?new AbortController:void 0,o=t.registerTool(e,r?{signal:r.signal}:void 0),s=!1;return()=>{if(!s){s=!0,lt.delete(e.name);try{r?.abort(),o&&typeof o.unregister=="function"?o.unregister():typeof t.unregisterTool=="function"&&t.unregisterTool(i.name)}catch{}}}}var R=class extends O{constructor(){super(...arguments);this.expose=!1;this.toolName="";this.toolDescription="";this.toolDisposer=()=>{}}toolInputSchema(){return{type:"object",properties:{}}}get toolReactiveProps(){return["expose","toolName","toolDescription"]}connectedCallback(){super.connectedCallback(),this.expose&&this.registerTool()}disconnectedCallback(){super.disconnectedCallback(),this.toolDisposer(),this.toolDisposer=()=>{}}updated(e){this.expose&&this.toolReactiveProps.some(r=>e.has(r))?this.registerTool():!this.expose&&e.has("expose")&&(this.toolDisposer(),this.toolDisposer=()=>{})}registerTool(){this.toolDisposer(),this.toolDisposer=Ve({name:this.resolvedToolName,description:this.toolDescription||this.defaultToolDescription,inputSchema:this.toolInputSchema(),execute:e=>this.executeTool(e)})}};l([d({type:Boolean})],R.prototype,"expose",2),l([d({attribute:"tool-name"})],R.prototype,"toolName",2),l([d({attribute:"tool-description"})],R.prototype,"toolDescription",2);var q=f`
|
|
1
|
+
"use strict";var webmcpui=(()=>{var Ce=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var rr=Object.getOwnPropertyNames;var or=Object.prototype.hasOwnProperty;var ir=(i,t)=>{for(var e in t)Ce(i,e,{get:t[e],enumerable:!0})},sr=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of rr(t))!or.call(i,o)&&o!==e&&Ce(i,o,{get:()=>t[o],enumerable:!(r=bt(t,o))||r.enumerable});return i};var ar=i=>sr(Ce({},"__esModule",{value:!0}),i),n=(i,t,e,r)=>{for(var o=r>1?void 0:r?bt(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(o=(r?a(t,e,o):a(o))||o);return r&&o&&Ce(t,e,o),o};var Ar={};ir(Ar,{WmcpAction:()=>$,WmcpAlert:()=>Z,WmcpAvatar:()=>W,WmcpBadge:()=>le,WmcpButton:()=>I,WmcpCheckbox:()=>ae,WmcpDialog:()=>B,WmcpExposable:()=>A,WmcpFormControl:()=>g,WmcpInput:()=>ie,WmcpMenu:()=>L,WmcpPopover:()=>P,WmcpProgress:()=>G,WmcpRadio:()=>he,WmcpRadioGroup:()=>Y,WmcpSelect:()=>K,WmcpSeparator:()=>ce,WmcpSwitch:()=>ne,WmcpTabs:()=>j,WmcpTextarea:()=>se,WmcpToast:()=>M,WmcpTooltip:()=>me,defineComponents:()=>Xe,exposeTool:()=>Ke,isStandardSchema:()=>Je,isWebMCPAvailable:()=>Jt,textFieldStyles:()=>F,validateStandard:()=>Fe});var ft=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var O=function(i,t,e,r,o){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!o:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?o.call(i,e):o?o.value=e:t.set(i,e),e},E=function(i,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!r:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(i):r?r.value:t.get(i)},de,Pe,Me,ge,et,be,Oe,X,fe,q,Ne,yt;var w={__proto__:null};w.enumerable=!0;Object.freeze(w);var tt=(q=class{constructor(t,e={}){if(de.set(this,!1),Pe.set(this,!1),Me.set(this,!1),ge.set(this,!1),et.set(this,Date.now()),be.set(this,!1),Oe.set(this,void 0),X.set(this,void 0),fe.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:o,composed:s}=e;O(this,de,!!o,"f"),O(this,Pe,!!r,"f"),O(this,Me,!!s,"f"),O(this,Oe,`${t}`,"f"),O(this,X,null,"f"),O(this,fe,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){O(this,ge,!0,"f")}get target(){return E(this,X,"f")}get currentTarget(){return E(this,X,"f")}get srcElement(){return E(this,X,"f")}get type(){return E(this,Oe,"f")}get cancelable(){return E(this,de,"f")}get defaultPrevented(){return E(this,de,"f")&&E(this,ge,"f")}get timeStamp(){return E(this,et,"f")}composedPath(){return E(this,fe,"f")?[E(this,X,"f")]:[]}get returnValue(){return!E(this,de,"f")||!E(this,ge,"f")}get bubbles(){return E(this,Pe,"f")}get composed(){return E(this,Me,"f")}get eventPhase(){return E(this,fe,"f")?q.AT_TARGET:q.NONE}get cancelBubble(){return E(this,be,"f")}set cancelBubble(t){t&&O(this,be,!0,"f")}stopPropagation(){O(this,be,!0,"f")}get isTrusted(){return!1}},de=new WeakMap,Pe=new WeakMap,Me=new WeakMap,ge=new WeakMap,et=new WeakMap,be=new WeakMap,Oe=new WeakMap,X=new WeakMap,fe=new WeakMap,q.NONE=0,q.CAPTURING_PHASE=1,q.AT_TARGET=2,q.BUBBLING_PHASE=3,q);Object.defineProperties(tt.prototype,{initEvent:w,stopImmediatePropagation:w,preventDefault:w,target:w,currentTarget:w,srcElement:w,type:w,cancelable:w,defaultPrevented:w,timeStamp:w,composedPath:w,returnValue:w,bubbles:w,composed:w,eventPhase:w,cancelBubble:w,stopPropagation:w,isTrusted:w});var xt=(yt=class extends tt{constructor(t,e={}){super(t,e),Ne.set(this,void 0),O(this,Ne,e?.detail??null,"f")}initCustomEvent(t,e,r,o){throw new Error("Method not implemented.")}get detail(){return E(this,Ne,"f")}},Ne=new WeakMap,yt);Object.defineProperties(xt.prototype,{detail:w});var D=tt,rt=xt;var T;var Lr=(T=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},T.STYLE_RULE=1,T.CHARSET_RULE=2,T.IMPORT_RULE=3,T.MEDIA_RULE=4,T.FONT_FACE_RULE=5,T.PAGE_RULE=6,T.NAMESPACE_RULE=10,T.KEYFRAMES_RULE=7,T.KEYFRAME_RULE=8,T.SUPPORTS_RULE=12,T.COUNTER_STYLE_RULE=11,T.FONT_FEATURE_VALUES_RULE=14,T.MARGIN_RULE=9,T);globalThis.Event??=D;globalThis.CustomEvent??=rt;var it=Symbol(),St=i=>typeof i=="boolean"?i:i?.capture??!1,H={__proto__:null};H.enumerable=!0;Object.freeze(H);var Ie=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let o=St(r)?this.__captureEventListeners:this.__eventListeners,s=o.get(t);if(s===void 0)s=new Map,o.set(t,s);else if(s.has(e))return;let a=typeof r=="object"&&r?r:{};a.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),s.set(e,a??{})}removeEventListener(t,e,r){if(e==null)return;let o=St(r)?this.__captureEventListeners:this.__eventListeners,s=o.get(t);s!==void 0&&(s.delete(e),s.size||o.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,o=!1,s=D.NONE,a=null,d=null,c=null,f=t.stopPropagation,x=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return a??d},...H},srcElement:{get(){return t.target},...H},currentTarget:{get(){return c},...H},eventPhase:{get(){return s},...H},composedPath:{value:()=>e,...H},stopPropagation:{value:()=>{r=!0,f.call(t)},...H},stopImmediatePropagation:{value:()=>{o=!0,x.call(t)},...H}});let h=(y,C,ve)=>{typeof y=="function"?y(t):typeof y?.handleEvent=="function"&&y.handleEvent(t),C.once&&ve.delete(y)},b=()=>(c=null,s=D.NONE,!t.defaultPrevented),v=e.slice().reverse();a=!this.__host||!t.composed?this:null;let S=y=>{for(d=this;d.__host&&y.includes(d.__host);)d=d.__host};for(let y of v){!a&&(!d||d===y.__host)&&S(v.slice(v.indexOf(y))),c=y,s=y===t.target?D.AT_TARGET:D.CAPTURING_PHASE;let C=y.__captureEventListeners.get(t.type);if(C){for(let[ve,Qe]of C)if(h(ve,Qe,C),o)return b()}if(r)return b()}let R=t.bubbles?e:[this];d=null;for(let y of R){!a&&(!d||y===d.__host)&&S(R.slice(0,R.indexOf(y)+1)),c=y,s=y===t.target?D.AT_TARGET:D.BUBBLING_PHASE;let C=y.__eventListeners.get(t.type);if(C){for(let[ve,Qe]of C)if(h(ve,Qe,C),o)return b()}if(r)return b()}return b()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,Et,cr]}};var wt=new WeakMap,ye=i=>{let t=wt.get(i);return t===void 0&&wt.set(i,t=new Map),t},xe=class extends Ie{getRootNode(t){return t?.composed?ot:this.__host?.__shadowRoot??ot}};var _t=class extends xe{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var Et=new _t,ot=Et;var $t=class extends xe{constructor(t){if(super(),t!==it)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Le,customElements:at,document:ot,Document:_t,Element:Tt,EventTarget:Ie,HTMLElement:kt,Node:xe,ShadowRoot:Rt,window:this,Window:$t})}};var Tt=class extends xe{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(ye(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){ye(this).set(t,String(e))}removeAttribute(t){ye(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return ye(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Rt(it,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new ft(this);return this.__internals=t,t}getAttribute(t){return ye(this).get(t)??null}};var kt=class extends Tt{},st=kt;var Rt=class extends xe{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new st,"localName",{get(){return"lit-server-root"}});function nr(){let i,t;return{promise:new Promise((r,o)=>{i=r,t=o}),resolve:i,reject:t}}var Le=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
+
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let r=this.__pendingWhenDefineds.get(t);return r||(r=nr(),this.__pendingWhenDefineds.set(t,r)),r.promise}},lr=Le;var at=new lr,cr=new $t(it);var Se=globalThis,We=Se.ShadowRoot&&(Se.ShadyCSS===void 0||Se.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,nt=Symbol(),At=new WeakMap,we=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==nt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(We&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=At.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&At.set(e,t))}return t}toString(){return this.cssText}},Ct=i=>new we(typeof i=="string"?i:i+"",void 0,nt),m=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,o,s)=>r+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[s+1],i[0]);return new we(e,i,nt)},Pt=(i,t)=>{if(We)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=Se.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},lt=We||Se.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Ct(e)})(i):i;var{is:dr,defineProperty:pr,getOwnPropertyDescriptor:ur,getOwnPropertyNames:hr,getOwnPropertySymbols:mr,getPrototypeOf:vr}=Object,$e=globalThis;$e.customElements??=at;var Mt=$e.trustedTypes,gr=Mt?Mt.emptyScript:"",br=$e.reactiveElementPolyfillSupport,_e=(i,t)=>i,Ee={toAttribute(i,t){switch(t){case Boolean:i=i?gr:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},De=(i,t)=>!dr(i,t),Ot={attribute:!0,type:String,converter:Ee,reflect:!1,useDefault:!1,hasChanged:De};Symbol.metadata??=Symbol("metadata"),$e.litPropertyMetadata??=new WeakMap;var U=class extends(globalThis.HTMLElement??st){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ot){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&pr(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:s}=ur(this.prototype,t)??{get(){return this[e]},set(a){this[e]=a}};return{get:o,set(a){let d=o?.call(this);s?.call(this,a),this.requestUpdate(t,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ot}static _$Ei(){if(this.hasOwnProperty(_e("elementProperties")))return;let t=vr(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(_e("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_e("properties"))){let e=this.properties,r=[...hr(e),...mr(e)];for(let o of r)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,o]of e)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let o=this._$Eu(e,r);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let o of r)e.unshift(lt(o))}else t!==void 0&&e.push(lt(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Pt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let s=(r.converter?.toAttribute!==void 0?r.converter:Ee).toAttribute(e,r.type);this._$Em=t,s==null?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let s=r.getPropertyOptions(o),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Ee;this._$Em=o;let d=a.fromAttribute(e,s.type);this[o]=d??this._$Ej?.get(o)??d,this._$Em=null}}requestUpdate(t,e,r,o=!1,s){if(t!==void 0){let a=this.constructor;if(o===!1&&(s=this[t]),r??=a.getPropertyOptions(t),!((r.hasChanged??De)(s,e)||r.useDefault&&r.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(a._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:o,wrapped:s},a){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),s!==!0||a!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),o===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[o,s]of this._$Ep)this[o]=s;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,s]of r){let{wrapped:a}=s,d=this[o];a!==!0||this._$AL.has(o)||d===void 0||this.C(o,void 0,s,d)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};U.elementStyles=[],U.shadowRootOptions={mode:"open"},U[_e("elementProperties")]=new Map,U[_e("finalized")]=new Map,br?.({ReactiveElement:U}),($e.reactiveElementVersions??=[]).push("2.1.2");var Ge=globalThis,Nt=i=>i,He=Ge.trustedTypes,It=He?He.createPolicy("lit-html",{createHTML:i=>i}):void 0,dt="$lit$",z=`lit$${Math.random().toFixed(9).slice(2)}$`,pt="?"+z,fr=`<${pt}>`,te=Ge.document===void 0?{createTreeWalker:()=>({})}:document,ke=()=>te.createComment(""),Re=i=>i===null||typeof i!="object"&&typeof i!="function",ut=Array.isArray,zt=i=>ut(i)||typeof i?.[Symbol.iterator]=="function",ct=`[
|
|
3
|
+
\f\r]`,Te=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lt=/-->/g,Wt=/>/g,Q=RegExp(`>|${ct}(?:([^\\s"'>=/]+)(${ct}*=${ct}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dt=/'/g,Ht=/"/g,Vt=/^(?:script|style|textarea|title)$/i,ht=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),u=ht(1),go=ht(2),bo=ht(3),V=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),Ut=new WeakMap,ee=te.createTreeWalker(te,129);function Bt(i,t){if(!ut(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return It!==void 0?It.createHTML(t):t}var jt=(i,t)=>{let e=i.length-1,r=[],o,s=t===2?"<svg>":t===3?"<math>":"",a=Te;for(let d=0;d<e;d++){let c=i[d],f,x,h=-1,b=0;for(;b<c.length&&(a.lastIndex=b,x=a.exec(c),x!==null);)b=a.lastIndex,a===Te?x[1]==="!--"?a=Lt:x[1]!==void 0?a=Wt:x[2]!==void 0?(Vt.test(x[2])&&(o=RegExp("</"+x[2],"g")),a=Q):x[3]!==void 0&&(a=Q):a===Q?x[0]===">"?(a=o??Te,h=-1):x[1]===void 0?h=-2:(h=a.lastIndex-x[2].length,f=x[1],a=x[3]===void 0?Q:x[3]==='"'?Ht:Dt):a===Ht||a===Dt?a=Q:a===Lt||a===Wt?a=Te:(a=Q,o=void 0);let v=a===Q&&i[d+1].startsWith("/>")?" ":"";s+=a===Te?c+fr:h>=0?(r.push(f),c.slice(0,h)+dt+c.slice(h)+z+v):c+z+(h===-2?d:v)}return[Bt(i,s+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Ae=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let s=0,a=0,d=t.length-1,c=this.parts,[f,x]=jt(t,e);if(this.el=i.createElement(f,r),ee.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=ee.nextNode())!==null&&c.length<d;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(dt)){let b=x[a++],v=o.getAttribute(h).split(z),S=/([.?@])?(.*)/.exec(b);c.push({type:1,index:s,name:S[2],strings:v,ctor:S[1]==="."?ze:S[1]==="?"?Ve:S[1]==="@"?Be:oe}),o.removeAttribute(h)}else h.startsWith(z)&&(c.push({type:6,index:s}),o.removeAttribute(h));if(Vt.test(o.tagName)){let h=o.textContent.split(z),b=h.length-1;if(b>0){o.textContent=He?He.emptyScript:"";for(let v=0;v<b;v++)o.append(h[v],ke()),ee.nextNode(),c.push({type:2,index:++s});o.append(h[b],ke())}}}else if(o.nodeType===8)if(o.data===pt)c.push({type:2,index:s});else{let h=-1;for(;(h=o.data.indexOf(z,h+1))!==-1;)c.push({type:7,index:s}),h+=z.length-1}s++}}static createElement(t,e){let r=te.createElement("template");return r.innerHTML=t,r}};function re(i,t,e=i,r){if(t===V)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,s=Re(t)?void 0:t._$litDirective$;return o?.constructor!==s&&(o?._$AO?.(!1),s===void 0?o=void 0:(o=new s(i),o._$AT(i,e,r)),r!==void 0?(e._$Co??=[])[r]=o:e._$Cl=o),o!==void 0&&(t=re(i,o._$AS(i,t.values),o,r)),t}var Ue=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,o=(t?.creationScope??te).importNode(e,!0);ee.currentNode=o;let s=ee.nextNode(),a=0,d=0,c=r[0];for(;c!==void 0;){if(a===c.index){let f;c.type===2?f=new pe(s,s.nextSibling,this,t):c.type===1?f=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(f=new je(s,this,t)),this._$AV.push(f),c=r[++d]}a!==c?.index&&(s=ee.nextNode(),a++)}return ee.currentNode=te,o}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},pe=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=re(this,t,e),Re(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==V&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):zt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&Re(this._$AH)?this._$AA.nextSibling.data=t:this.T(te.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,o=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ae.createElement(Bt(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let s=new Ue(o,this),a=s.u(this.options);s.p(e),this.T(a),this._$AH=s}}_$AC(t){let e=Ut.get(t.strings);return e===void 0&&Ut.set(t.strings,e=new Ae(t)),e}k(t){ut(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,o=0;for(let s of t)o===e.length?e.push(r=new i(this.O(ke()),this.O(ke()),this,this.options)):r=e[o],r._$AI(s),o++;o<e.length&&(this._$AR(r&&r._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=Nt(t).nextSibling;Nt(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},oe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,s){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=p}_$AI(t,e=this,r,o){let s=this.strings,a=!1;if(s===void 0)t=re(this,t,e,0),a=!Re(t)||t!==this._$AH&&t!==V,a&&(this._$AH=t);else{let d=t,c,f;for(t=s[0],c=0;c<s.length-1;c++)f=re(this,d[r+c],e,c),f===V&&(f=this._$AH[c]),a||=!Re(f)||f!==this._$AH[c],f===p?t=p:t!==p&&(t+=(f??"")+s[c+1]),this._$AH[c]=f}a&&!o&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ze=class extends oe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}},Ve=class extends oe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}},Be=class extends oe{constructor(t,e,r,o,s){super(t,e,r,o,s),this.type=5}_$AI(t,e=this){if((t=re(this,t,e,0)??p)===V)return;let r=this._$AH,o=t===p&&r!==p||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==p&&(r===p||o);o&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},je=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){re(this,t)}},Gt={M:dt,P:z,A:pt,C:1,L:jt,R:Ue,D:zt,V:re,I:pe,H:oe,N:Ve,U:Be,B:ze,F:je},yr=Ge.litHtmlPolyfillSupport;yr?.(Ae,pe),(Ge.litHtmlVersions??=[]).push("3.3.3");var qt=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let s=e?.renderBefore??null;r._$litPart$=o=new pe(t.insertBefore(ke(),s),s,void 0,e??{})}return o._$AI(i),o};var mt=globalThis,_=class extends U{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=qt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};_._$litElement$=!0,_.finalized=!0,mt.litElementHydrateSupport?.({LitElement:_});var xr=mt.litElementPolyfillSupport;xr?.({LitElement:_});(mt.litElementVersions??=[]).push("4.2.2");var Sr={attribute:!0,type:String,converter:Ee,reflect:!1,hasChanged:De},wr=(i=Sr,t,e)=>{let{kind:r,metadata:o}=e,s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),r==="setter"&&((i=Object.create(i)).wrapped=!0),s.set(e.name,i),r==="accessor"){let{name:a}=e;return{set(d){let c=t.get.call(this);t.set.call(this,d),this.requestUpdate(a,c,i,!0,d)},init(d){return d!==void 0&&this.C(a,void 0,i,d),d}}}if(r==="setter"){let{name:a}=e;return function(d){let c=this[a];t.call(this,d),this.requestUpdate(a,c,i,!0,d)}}throw Error("Unsupported decorator location: "+r)};function l(i){return(t,e)=>typeof e=="object"?wr(i,t,e):((r,o,s)=>{let a=o.hasOwnProperty(s);return o.constructor.createProperty(s,r),a?Object.getOwnPropertyDescriptor(o,s):void 0})(i,t,e)}function k(i){return l({...i,state:!0,attribute:!1})}async function Fe(i,t){let e=await i["~standard"].validate(t);return e.issues?{valid:!1,errors:e.issues.map(r=>r.message)}:{valid:!0,value:e.value,errors:[]}}function Je(i){return typeof i=="object"&&i!==null&&"~standard"in i&&typeof i["~standard"]?.validate=="function"}function Ft(){let i=typeof document<"u"?document.modelContext:void 0,t=typeof navigator<"u"?navigator.modelContext:void 0,e=i??t;return e&&typeof e.registerTool=="function"?e:void 0}function Jt(){return Ft()!==void 0}var _r=globalThis.process?.env?.NODE_ENV!=="production",vt=new Set;function Ke(i){let t=Ft();if(!t?.registerTool)return()=>{};let e={name:i.name,description:i.description,inputSchema:i.inputSchema??{type:"object",properties:{}},execute:i.execute};_r&&vt.has(e.name)&&console.warn(`[webmcpui] A WebMCP tool named "${e.name}" is already registered on this page. Tool names are page-global, so the host rejects the duplicate and this control won't be agent-callable. Give one control a unique \`name\`, or override it with \`tool-name\`.`),vt.add(e.name);let r=typeof AbortController=="function"?new AbortController:void 0,o=t.registerTool(e,r?{signal:r.signal}:void 0),s=!1;return()=>{if(!s){s=!0,vt.delete(e.name);try{r?.abort(),o&&typeof o.unregister=="function"?o.unregister():typeof t.unregisterTool=="function"&&t.unregisterTool(i.name)}catch{}}}}var A=class extends _{constructor(){super(...arguments);this.expose=!1;this.toolName="";this.toolDescription="";this.toolDisposer=()=>{}}toolInputSchema(){return{type:"object",properties:{}}}get toolReactiveProps(){return["expose","toolName","toolDescription"]}connectedCallback(){super.connectedCallback(),this.expose&&this.registerTool()}disconnectedCallback(){super.disconnectedCallback(),this.toolDisposer(),this.toolDisposer=()=>{}}updated(e){this.expose&&this.toolReactiveProps.some(r=>e.has(r))?this.registerTool():!this.expose&&e.has("expose")&&(this.toolDisposer(),this.toolDisposer=()=>{})}registerTool(){this.toolDisposer(),this.toolDisposer=Ke({name:this.resolvedToolName,description:this.toolDescription||this.defaultToolDescription,inputSchema:this.toolInputSchema(),execute:e=>this.executeTool(e)})}};n([l({type:Boolean})],A.prototype,"expose",2),n([l({attribute:"tool-name"})],A.prototype,"toolName",2),n([l({attribute:"tool-description"})],A.prototype,"toolDescription",2);var F=m`
|
|
5
5
|
.control {
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
width: 100%;
|
|
@@ -42,7 +42,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
42
42
|
var(--destructive, oklch(0.577 0.245 27.325))
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`,g=class extends A{constructor(){super(...arguments);this.label="";this.name="";this.value="";this.placeholder="";this.required=!1;this.disabled=!1;this.helperText="";this.requiredMessage="";this.error="";this.internals=this.attachInternals();this.onInvalid=()=>{this.error=this.internals.validationMessage,this.toggleAttribute("invalid",!0)}}static{this.formAssociated=!0}static{this.styles=m`
|
|
46
46
|
:host {
|
|
47
47
|
display: inline-flex;
|
|
48
48
|
flex-direction: column;
|
|
@@ -74,19 +74,19 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
74
74
|
var(--destructive, oklch(0.577 0.245 27.325))
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
|
-
`}get controlNoun(){return"field"}get control(){return this.renderRoot?.querySelector("input, textarea, select")??null}get describedBy(){return this.error?"wmcp-error":this.helperText?"wmcp-helper":void 0}connectedCallback(){super.connectedCallback(),this.syncFormValue(),this.addEventListener("invalid",this.onInvalid),this.validate(!1)}getFormValue(){return this.value}syncFormValue(){this.internals.setFormValue(this.getFormValue())}get validationValue(){return this.value}get isEmpty(){return this.value===""}get requiredMessageDefault(){return"This field is required."}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this.onInvalid)}updated(e){super.updated(e),this.syncFormValue()}get resolvedToolName(){return this.toolName||`fill_${this.name||this.controlNoun}`}get defaultToolDescription(){return`Set the value of the "${this.label||this.name||this.controlNoun}" field.`}get toolReactiveProps(){return[...super.toolReactiveProps,"name"]}async executeTool(e){let r=this.label||this.name||this.controlNoun;return await this.applyAgentValue(e),{content:[{type:"text",text:this.error?`Set "${r}" but validation failed: ${this.error}`:`Set "${r}" to "${this.stateDescription()}".`}],isError:!!this.error}}async applyAgentValue(e){let r=e.value;await this.setValueFromAgent(r==null?"":String(r))}stateDescription(){return this.value}toolInputSchema(){return{type:"object",properties:{value:{type:"string",description:this.label||this.name||"The value to set."}},required:["value"]}}async setValueFromAgent(e){this.value=e,await this.validate(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}async onInput(e){this.value=e.target.value,await this.validate()}async computeValidity(){if(this.required&&this.isEmpty)return{valid:!1,message:this.requiredMessage||this.requiredMessageDefault,flags:{valueMissing:!0}};if(
|
|
77
|
+
`}get controlNoun(){return"field"}get control(){return this.renderRoot?.querySelector("input, textarea, select")??null}get describedBy(){return this.error?"wmcp-error":this.helperText?"wmcp-helper":void 0}connectedCallback(){super.connectedCallback(),this.syncFormValue(),this.addEventListener("invalid",this.onInvalid),this.validate(!1)}getFormValue(){return this.value}syncFormValue(){this.internals.setFormValue(this.getFormValue())}get validationValue(){return this.value}get isEmpty(){return this.value===""}get requiredMessageDefault(){return"This field is required."}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this.onInvalid)}updated(e){super.updated(e),this.syncFormValue()}get resolvedToolName(){return this.toolName||`fill_${this.name||this.controlNoun}`}get defaultToolDescription(){return`Set the value of the "${this.label||this.name||this.controlNoun}" field.`}get toolReactiveProps(){return[...super.toolReactiveProps,"name"]}async executeTool(e){let r=this.label||this.name||this.controlNoun;return await this.applyAgentValue(e),{content:[{type:"text",text:this.error?`Set "${r}" but validation failed: ${this.error}`:`Set "${r}" to "${this.stateDescription()}".`}],isError:!!this.error}}async applyAgentValue(e){let r=e.value;await this.setValueFromAgent(r==null?"":String(r))}stateDescription(){return this.value}toolInputSchema(){return{type:"object",properties:{value:{type:"string",description:this.label||this.name||"The value to set."}},required:["value"]}}async setValueFromAgent(e){this.value=e,await this.validate(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}async onInput(e){this.value=e.target.value,await this.validate()}async computeValidity(){if(this.required&&this.isEmpty)return{valid:!1,message:this.requiredMessage||this.requiredMessageDefault,flags:{valueMissing:!0}};if(Je(this.schema)){let e=await Fe(this.schema,this.validationValue);if(!e.valid)return{valid:!1,message:e.errors[0]??"Invalid value",flags:{customError:!0}}}return{valid:!0,message:"",flags:{}}}async validate(e=!0){let{valid:r,message:o,flags:s}=await this.computeValidity();return r?this.internals.setValidity({}):this.internals.setValidity(s,o,this.control??void 0),e&&(this.error=r?"":o,this.toggleAttribute("invalid",!r)),r}formResetCallback(){this.value="",this.error="",this.toggleAttribute("invalid",!1),this.validate(!1)}renderMessage(){return this.error?u`<span id="wmcp-error" class="message error" role="alert"
|
|
78
78
|
>${this.error}</span
|
|
79
|
-
>`:this.helperText?
|
|
79
|
+
>`:this.helperText?u`<span id="wmcp-helper" class="message helper"
|
|
80
80
|
>${this.helperText}</span
|
|
81
|
-
>`:p}render(){return
|
|
82
|
-
${this.label?
|
|
81
|
+
>`:p}render(){return u`
|
|
82
|
+
${this.label?u`<label for="control">${this.label}</label>`:p}
|
|
83
83
|
${this.renderControl()}
|
|
84
84
|
${this.renderMessage()}
|
|
85
|
-
`}};
|
|
85
|
+
`}};n([l()],g.prototype,"label",2),n([l()],g.prototype,"name",2),n([l()],g.prototype,"value",2),n([l()],g.prototype,"placeholder",2),n([l({type:Boolean,reflect:!0})],g.prototype,"required",2),n([l({type:Boolean,reflect:!0})],g.prototype,"disabled",2),n([l({attribute:"helper-text"})],g.prototype,"helperText",2),n([l({attribute:"required-message"})],g.prototype,"requiredMessage",2),n([l({attribute:!1})],g.prototype,"schema",2),n([k()],g.prototype,"error",2);var ie=class extends g{constructor(){super(...arguments);this.type="text"}static{this.tagName="wmcp-input"}static{this.styles=[g.styles,F,m`
|
|
86
86
|
.control {
|
|
87
87
|
height: var(--input-height-md, 2.25rem);
|
|
88
88
|
}
|
|
89
|
-
`]}get controlNoun(){return"input"}toolInputSchema(){return{type:"object",properties:{value:{type:this.type==="number"?"number":"string",description:this.label||this.name||"The value to set."}},required:["value"]}}renderControl(){return
|
|
89
|
+
`]}get controlNoun(){return"input"}toolInputSchema(){return{type:"object",properties:{value:{type:this.type==="number"?"number":"string",description:this.label||this.name||"The value to set."}},required:["value"]}}renderControl(){return u`
|
|
90
90
|
<input
|
|
91
91
|
id="control"
|
|
92
92
|
class="control"
|
|
@@ -100,12 +100,12 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
100
100
|
aria-describedby=${this.describedBy??p}
|
|
101
101
|
@input=${this.onInput}
|
|
102
102
|
/>
|
|
103
|
-
`}};
|
|
103
|
+
`}};n([l()],ie.prototype,"type",2);var se=class extends g{constructor(){super(...arguments);this.rows=3}static{this.tagName="wmcp-textarea"}static{this.styles=[g.styles,F,m`
|
|
104
104
|
.control {
|
|
105
105
|
min-height: var(--textarea-min-height, 4.5rem);
|
|
106
106
|
resize: vertical;
|
|
107
107
|
}
|
|
108
|
-
`]}get controlNoun(){return"textarea"}renderControl(){return
|
|
108
|
+
`]}get controlNoun(){return"textarea"}renderControl(){return u`
|
|
109
109
|
<textarea
|
|
110
110
|
id="control"
|
|
111
111
|
class="control"
|
|
@@ -119,7 +119,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
119
119
|
aria-describedby=${this.describedBy??p}
|
|
120
120
|
@input=${this.onInput}
|
|
121
121
|
></textarea>
|
|
122
|
-
`}};
|
|
122
|
+
`}};n([l({type:Number})],se.prototype,"rows",2);var Kt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Yt=i=>(...t)=>({_$litDirective$:i,values:t}),Ye=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:Er}=Gt,Zt=i=>i;var Xt=()=>document.createComment(""),ue=(i,t,e)=>{let r=i._$AA.parentNode,o=t===void 0?i._$AB:t._$AA;if(e===void 0){let s=r.insertBefore(Xt(),o),a=r.insertBefore(Xt(),o);e=new Er(s,a,i,i.options)}else{let s=e._$AB.nextSibling,a=e._$AM,d=a!==i;if(d){let c;e._$AQ?.(i),e._$AM=i,e._$AP!==void 0&&(c=i._$AU)!==a._$AU&&e._$AP(c)}if(s!==o||d){let c=e._$AA;for(;c!==s;){let f=Zt(c).nextSibling;Zt(r).insertBefore(c,o),c=f}}}return e},J=(i,t,e=i)=>(i._$AI(t,e),i),$r={},Qt=(i,t=$r)=>i._$AH=t,er=i=>i._$AH,Ze=i=>{i._$AR(),i._$AA.remove()};var tr=(i,t,e)=>{let r=new Map;for(let o=t;o<=e;o++)r.set(i[o],o);return r},N=Yt(class extends Ye{constructor(i){if(super(i),i.type!==Kt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let o=[],s=[],a=0;for(let d of i)o[a]=r?r(d,a):a,s[a]=e(d,a),a++;return{values:s,keys:o}}render(i,t,e){return this.dt(i,t,e).values}update(i,[t,e,r]){let o=er(i),{values:s,keys:a}=this.dt(t,e,r);if(!Array.isArray(o))return this.ut=a,s;let d=this.ut??=[],c=[],f,x,h=0,b=o.length-1,v=0,S=s.length-1;for(;h<=b&&v<=S;)if(o[h]===null)h++;else if(o[b]===null)b--;else if(d[h]===a[v])c[v]=J(o[h],s[v]),h++,v++;else if(d[b]===a[S])c[S]=J(o[b],s[S]),b--,S--;else if(d[h]===a[S])c[S]=J(o[h],s[S]),ue(i,c[S+1],o[h]),h++,S--;else if(d[b]===a[v])c[v]=J(o[b],s[v]),ue(i,o[h],o[b]),b--,v++;else if(f===void 0&&(f=tr(a,v,S),x=tr(d,h,b)),f.has(d[h]))if(f.has(d[b])){let R=x.get(a[v]),y=R!==void 0?o[R]:null;if(y===null){let C=ue(i,o[h]);J(C,s[v]),c[v]=C}else c[v]=J(y,s[v]),ue(i,o[h],y),o[R]=null;v++}else Ze(o[b]),b--;else Ze(o[h]),h++;for(;v<=S;){let R=ue(i,c[S+1]);J(R,s[v]),c[v++]=R}for(;h<=b;){let R=o[h++];R!==null&&Ze(R)}return this.ut=a,Qt(i,c),V}});function gt(i){return Array.isArray(i.options)}var K=class extends g{constructor(){super(...arguments);this.options=[];this.resolvedOptions=[]}static{this.tagName="wmcp-select"}static{this.styles=[g.styles,F,m`
|
|
123
123
|
.control {
|
|
124
124
|
height: var(--input-height-md, 2.25rem);
|
|
125
125
|
cursor: pointer;
|
|
@@ -127,13 +127,13 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
127
127
|
.control:disabled {
|
|
128
128
|
cursor: not-allowed;
|
|
129
129
|
}
|
|
130
|
-
`]}get controlNoun(){return"select"}connectedCallback(){this.syncOptions(),super.connectedCallback(),this.optionObserver=new MutationObserver(()=>this.syncOptions()),this.optionObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this.optionObserver?.disconnect(),this.optionObserver=void 0}willUpdate(e){e.has("options")&&this.syncOptions()}updated(e){super.updated(e),this.expose&&e.has("resolvedOptions")&&this.registerTool()}syncOptions(){this.resolvedOptions=this.options.length>0?this.options:this.readDeclarativeOptions()}readDeclarativeOptions(){let e=o=>({value:o.value,label:o.textContent?.trim()||o.value,disabled:o.disabled}),r=[];for(let o of Array.from(this.children))o instanceof HTMLOptGroupElement?r.push({label:o.label,options:Array.from(o.querySelectorAll("option")).map(e)}):o instanceof HTMLOptionElement&&r.push(e(o));return r}flatOptions(){return this.resolvedOptions.flatMap(e=>
|
|
130
|
+
`]}get controlNoun(){return"select"}connectedCallback(){this.syncOptions(),super.connectedCallback(),this.optionObserver=new MutationObserver(()=>this.syncOptions()),this.optionObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this.optionObserver?.disconnect(),this.optionObserver=void 0}willUpdate(e){e.has("options")&&this.syncOptions()}updated(e){super.updated(e),this.expose&&e.has("resolvedOptions")&&this.registerTool()}syncOptions(){this.resolvedOptions=this.options.length>0?this.options:this.readDeclarativeOptions()}readDeclarativeOptions(){let e=o=>({value:o.value,label:o.textContent?.trim()||o.value,disabled:o.disabled}),r=[];for(let o of Array.from(this.children))o instanceof HTMLOptGroupElement?r.push({label:o.label,options:Array.from(o.querySelectorAll("option")).map(e)}):o instanceof HTMLOptionElement&&r.push(e(o));return r}flatOptions(){return this.resolvedOptions.flatMap(e=>gt(e)?e.options:[e])}toolInputSchema(){return{type:"object",properties:{value:{type:"string",enum:this.flatOptions().map(e=>e.value),description:this.label||this.name||"The option value to select."}},required:["value"]}}renderOption(e){return u`<option
|
|
131
131
|
value=${e.value}
|
|
132
132
|
?disabled=${e.disabled??!1}
|
|
133
133
|
?selected=${e.value===this.value}
|
|
134
134
|
>
|
|
135
135
|
${e.label}
|
|
136
|
-
</option>`}renderControl(){return
|
|
136
|
+
</option>`}renderControl(){return u`
|
|
137
137
|
<select
|
|
138
138
|
id="control"
|
|
139
139
|
class="control"
|
|
@@ -144,14 +144,14 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
144
144
|
aria-describedby=${this.describedBy??p}
|
|
145
145
|
@change=${this.onInput}
|
|
146
146
|
>
|
|
147
|
-
${this.placeholder?
|
|
147
|
+
${this.placeholder?u`<option value="" disabled ?selected=${!this.value}>
|
|
148
148
|
${this.placeholder}
|
|
149
149
|
</option>`:p}
|
|
150
|
-
${
|
|
150
|
+
${N(this.resolvedOptions,(e,r)=>gt(e)?`g:${e.label}:${r}`:`o:${e.value}`,e=>gt(e)?u`<optgroup label=${e.label}>
|
|
151
151
|
${e.options.map(r=>this.renderOption(r))}
|
|
152
152
|
</optgroup>`:this.renderOption(e))}
|
|
153
153
|
</select>
|
|
154
|
-
`}};
|
|
154
|
+
`}};n([l({attribute:!1})],K.prototype,"options",2),n([k()],K.prototype,"resolvedOptions",2);var ae=class extends g{constructor(){super();this.checked=!1;this.defaultChecked=!1;this.value="on"}static{this.tagName="wmcp-checkbox"}static{this.styles=[g.styles,m`
|
|
155
155
|
.row {
|
|
156
156
|
display: inline-flex;
|
|
157
157
|
align-items: center;
|
|
@@ -184,7 +184,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
184
184
|
font-size: var(--input-font-size, 0.875rem);
|
|
185
185
|
color: var(--input-text, var(--foreground, oklch(0.145 0 0)));
|
|
186
186
|
}
|
|
187
|
-
`]}get controlNoun(){return"checkbox"}connectedCallback(){this.defaultChecked=this.checked,super.connectedCallback()}getFormValue(){return this.checked?this.value:null}get validationValue(){return this.checked}get isEmpty(){return!this.checked}get requiredMessageDefault(){return"Please check this box."}toolInputSchema(){return{type:"object",properties:{checked:{type:"boolean",description:this.label||this.name||"Whether the box is checked."}},required:["checked"]}}async applyAgentValue(e){this.checked=!!e.checked,await this.validate(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}stateDescription(){return this.checked?"checked":"unchecked"}formResetCallback(){this.checked=this.defaultChecked,this.error="",this.toggleAttribute("invalid",!1),this.validate(!1)}async onToggle(e){this.checked=e.target.checked,await this.validate()}renderControl(){return
|
|
187
|
+
`]}get controlNoun(){return"checkbox"}connectedCallback(){this.defaultChecked=this.checked,super.connectedCallback()}getFormValue(){return this.checked?this.value:null}get validationValue(){return this.checked}get isEmpty(){return!this.checked}get requiredMessageDefault(){return"Please check this box."}toolInputSchema(){return{type:"object",properties:{checked:{type:"boolean",description:this.label||this.name||"Whether the box is checked."}},required:["checked"]}}async applyAgentValue(e){this.checked=!!e.checked,await this.validate(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}stateDescription(){return this.checked?"checked":"unchecked"}formResetCallback(){this.checked=this.defaultChecked,this.error="",this.toggleAttribute("invalid",!1),this.validate(!1)}async onToggle(e){this.checked=e.target.checked,await this.validate()}renderControl(){return u`
|
|
188
188
|
<input
|
|
189
189
|
id="control"
|
|
190
190
|
class="control"
|
|
@@ -197,13 +197,13 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
197
197
|
aria-describedby=${this.describedBy??p}
|
|
198
198
|
@change=${this.onToggle}
|
|
199
199
|
/>
|
|
200
|
-
`}render(){return
|
|
200
|
+
`}render(){return u`
|
|
201
201
|
<label class="row">
|
|
202
202
|
${this.renderControl()}
|
|
203
|
-
${this.label?
|
|
203
|
+
${this.label?u`<span class="label-text">${this.label}</span>`:p}
|
|
204
204
|
</label>
|
|
205
205
|
${this.renderMessage()}
|
|
206
|
-
`}};
|
|
206
|
+
`}};n([l({type:Boolean,reflect:!0})],ae.prototype,"checked",2);var Tr=0,he=class extends HTMLElement{static{this.tagName="wmcp-radio"}get value(){return this.getAttribute("value")??""}get label(){return this.getAttribute("label")??this.textContent?.trim()??""}get disabled(){return this.hasAttribute("disabled")}connectedCallback(){this.style.display="none"}},Y=class extends g{constructor(){super(...arguments);this.options=[];this.resolvedOptions=[];this.groupName=`wmcp-radio-${++Tr}`}static{this.tagName="wmcp-radio-group"}static{this.styles=[g.styles,m`
|
|
207
207
|
.group-label {
|
|
208
208
|
font-size: var(--input-font-size-label, 0.875rem);
|
|
209
209
|
font-weight: var(--input-font-weight-label, 500);
|
|
@@ -246,7 +246,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
246
246
|
font-size: var(--input-font-size, 0.875rem);
|
|
247
247
|
color: var(--input-text, var(--foreground, oklch(0.145 0 0)));
|
|
248
248
|
}
|
|
249
|
-
`]}get controlNoun(){return"radio"}connectedCallback(){this.syncOptions(),super.connectedCallback(),this.optionObserver=new MutationObserver(()=>this.syncOptions()),this.optionObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this.optionObserver?.disconnect(),this.optionObserver=void 0}willUpdate(e){e.has("options")&&this.syncOptions()}updated(e){super.updated(e),this.expose&&e.has("resolvedOptions")&&this.registerTool()}syncOptions(){this.resolvedOptions=this.options.length>0?this.options:this.readDeclarativeOptions()}readDeclarativeOptions(){return Array.from(this.querySelectorAll(":scope > wmcp-radio")).map(e=>({value:e.getAttribute("value")??"",label:e.getAttribute("label")??e.textContent?.trim()??"",disabled:e.hasAttribute("disabled")}))}toolInputSchema(){return{type:"object",properties:{value:{type:"string",enum:this.resolvedOptions.map(e=>e.value),description:this.label||this.name||"The option value to select."}},required:["value"]}}async onSelect(e){this.value=e.target.value,await this.validate()}renderControl(){return
|
|
249
|
+
`]}get controlNoun(){return"radio"}connectedCallback(){this.syncOptions(),super.connectedCallback(),this.optionObserver=new MutationObserver(()=>this.syncOptions()),this.optionObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this.optionObserver?.disconnect(),this.optionObserver=void 0}willUpdate(e){e.has("options")&&this.syncOptions()}updated(e){super.updated(e),this.expose&&e.has("resolvedOptions")&&this.registerTool()}syncOptions(){this.resolvedOptions=this.options.length>0?this.options:this.readDeclarativeOptions()}readDeclarativeOptions(){return Array.from(this.querySelectorAll(":scope > wmcp-radio")).map(e=>({value:e.getAttribute("value")??"",label:e.getAttribute("label")??e.textContent?.trim()??"",disabled:e.hasAttribute("disabled")}))}toolInputSchema(){return{type:"object",properties:{value:{type:"string",enum:this.resolvedOptions.map(e=>e.value),description:this.label||this.name||"The option value to select."}},required:["value"]}}async onSelect(e){this.value=e.target.value,await this.validate()}renderControl(){return u`
|
|
250
250
|
<div
|
|
251
251
|
class="group"
|
|
252
252
|
role="radiogroup"
|
|
@@ -254,7 +254,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
254
254
|
aria-describedby=${this.describedBy??p}
|
|
255
255
|
aria-invalid=${this.error?"true":"false"}
|
|
256
256
|
>
|
|
257
|
-
${
|
|
257
|
+
${N(this.resolvedOptions,e=>e.value,e=>u`
|
|
258
258
|
<label class="row">
|
|
259
259
|
<input
|
|
260
260
|
type="radio"
|
|
@@ -270,11 +270,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
270
270
|
</label>
|
|
271
271
|
`)}
|
|
272
272
|
</div>
|
|
273
|
-
`}render(){return
|
|
274
|
-
${this.label?
|
|
273
|
+
`}render(){return u`
|
|
274
|
+
${this.label?u`<span id="group-label" class="group-label">${this.label}</span>`:p}
|
|
275
275
|
${this.renderControl()}
|
|
276
276
|
${this.renderMessage()}
|
|
277
|
-
`}};
|
|
277
|
+
`}};n([l({attribute:!1})],Y.prototype,"options",2),n([k()],Y.prototype,"resolvedOptions",2);var $=class extends A{constructor(){super(...arguments);this.name="";this.label=""}get defaultNameSuffix(){return"element"}get actionNoun(){return this.label||this.name||this.defaultNameSuffix}get resolvedToolName(){return this.toolName||`${this.actionVerb}_${this.name||this.defaultNameSuffix}`}get defaultToolDescription(){return`Activate the "${this.actionNoun}".`}get toolReactiveProps(){return[...super.toolReactiveProps,"name","label"]}};n([l()],$.prototype,"name",2),n([l()],$.prototype,"label",2);var I=class extends ${constructor(){super(...arguments);this.variant="primary";this.size="md";this.type="button";this.disabled=!1;this.internals=this.attachInternals()}static{this.tagName="wmcp-button"}static{this.formAssociated=!0}static{this.shadowRootOptions={..._.shadowRootOptions,delegatesFocus:!0}}static{this.styles=m`
|
|
278
278
|
:host {
|
|
279
279
|
display: inline-block;
|
|
280
280
|
font-family: var(
|
|
@@ -385,7 +385,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
385
385
|
opacity: var(--button-disabled-opacity, 0.5);
|
|
386
386
|
cursor: not-allowed;
|
|
387
387
|
}
|
|
388
|
-
`}get button(){return this.renderRoot?.querySelector("button")??null}get actionVerb(){return"click"}get defaultNameSuffix(){return"button"}get actionNoun(){return this.label||this.textContent?.trim()||this.name||"button"}get defaultToolDescription(){return`Click the "${this.actionNoun}" button.`}executeTool(){let e=this.actionNoun;if(this.disabled)return{content:[{type:"text",text:`The "${e}" button is disabled and can't be activated.`}],isError:!0};this.activate();let r=this.type==="submit"?" (submitted the form)":this.type==="reset"?" (reset the form)":"";return{content:[{type:"text",text:`Clicked the "${e}" button${r}.`}]}}activate(){this.button?.click()}onInnerClick(){this.disabled||(this.type==="submit"?this.internals.form?.requestSubmit():this.type==="reset"&&this.internals.form?.reset())}render(){return
|
|
388
|
+
`}get button(){return this.renderRoot?.querySelector("button")??null}get actionVerb(){return"click"}get defaultNameSuffix(){return"button"}get actionNoun(){return this.label||this.textContent?.trim()||this.name||"button"}get defaultToolDescription(){return`Click the "${this.actionNoun}" button.`}executeTool(){let e=this.actionNoun;if(this.disabled)return{content:[{type:"text",text:`The "${e}" button is disabled and can't be activated.`}],isError:!0};this.activate();let r=this.type==="submit"?" (submitted the form)":this.type==="reset"?" (reset the form)":"";return{content:[{type:"text",text:`Clicked the "${e}" button${r}.`}]}}activate(){this.button?.click()}onInnerClick(){this.disabled||(this.type==="submit"?this.internals.form?.requestSubmit():this.type==="reset"&&this.internals.form?.reset())}render(){return u`
|
|
389
389
|
<button
|
|
390
390
|
class="control"
|
|
391
391
|
part="control"
|
|
@@ -396,7 +396,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
396
396
|
>
|
|
397
397
|
<slot></slot>
|
|
398
398
|
</button>
|
|
399
|
-
`}};
|
|
399
|
+
`}};n([l({reflect:!0})],I.prototype,"variant",2),n([l({reflect:!0})],I.prototype,"size",2),n([l()],I.prototype,"type",2),n([l({type:Boolean,reflect:!0})],I.prototype,"disabled",2);var B=class extends ${constructor(){super(...arguments);this.open=!1;this.modal=!0;this.staticBackdrop=!1;this.returnValue=""}static{this.tagName="wmcp-dialog"}static{this.styles=m`
|
|
400
400
|
:host {
|
|
401
401
|
display: contents;
|
|
402
402
|
}
|
|
@@ -463,7 +463,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
`}get dialogEl(){return this.renderRoot?.querySelector("dialog")??null}get actionVerb(){return"open"}get defaultNameSuffix(){return"dialog"}get defaultToolDescription(){return`Open the "${this.actionNoun}" dialog for the user to review.`}executeTool(){let e=this.actionNoun;return this.open?{content:[{type:"text",text:`The "${e}" dialog is already open.`}]}:(this.show(),{content:[{type:"text",text:`Opened the "${e}" dialog for the user to review.`}]})}updated(e){super.updated(e),e.has("open")&&this.syncNativeOpen()}show(){this.open=!0}close(e){e!==void 0&&(this.returnValue=e),this.open=!1}syncNativeOpen(){let e=this.dialogEl;e&&(this.open&&!e.open?(this.modal?e.showModal():e.show(),this.dispatchEvent(new Event("open",{bubbles:!0,composed:!0}))):!this.open&&e.open&&e.close(this.returnValue))}onNativeClose(){this.returnValue=this.dialogEl?.returnValue??this.returnValue,this.open&&(this.open=!1),this.dispatchEvent(new Event("close",{bubbles:!0,composed:!0}))}onDialogClick(e){this.staticBackdrop||e.target===this.dialogEl&&this.close()}render(){return
|
|
466
|
+
`}get dialogEl(){return this.renderRoot?.querySelector("dialog")??null}get actionVerb(){return"open"}get defaultNameSuffix(){return"dialog"}get defaultToolDescription(){return`Open the "${this.actionNoun}" dialog for the user to review.`}executeTool(){let e=this.actionNoun;return this.open?{content:[{type:"text",text:`The "${e}" dialog is already open.`}]}:(this.show(),{content:[{type:"text",text:`Opened the "${e}" dialog for the user to review.`}]})}updated(e){super.updated(e),e.has("open")&&this.syncNativeOpen()}show(){this.open=!0}close(e){e!==void 0&&(this.returnValue=e),this.open=!1}syncNativeOpen(){let e=this.dialogEl;e&&(this.open&&!e.open?(this.modal?e.showModal():e.show(),this.dispatchEvent(new Event("open",{bubbles:!0,composed:!0}))):!this.open&&e.open&&e.close(this.returnValue))}onNativeClose(){this.returnValue=this.dialogEl?.returnValue??this.returnValue,this.open&&(this.open=!1),this.dispatchEvent(new Event("close",{bubbles:!0,composed:!0}))}onDialogClick(e){this.staticBackdrop||e.target===this.dialogEl&&this.close()}render(){return u`
|
|
467
467
|
<dialog
|
|
468
468
|
part="dialog"
|
|
469
469
|
aria-label=${this.label||this.actionNoun}
|
|
@@ -474,7 +474,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
474
474
|
<slot></slot>
|
|
475
475
|
</div>
|
|
476
476
|
</dialog>
|
|
477
|
-
`}};
|
|
477
|
+
`}};n([l({type:Boolean,reflect:!0})],B.prototype,"open",2),n([l({type:Boolean})],B.prototype,"modal",2),n([l({type:Boolean,attribute:"static-backdrop"})],B.prototype,"staticBackdrop",2);var L=class extends ${constructor(){super(...arguments);this.label="";this.items=[];this.open=!1;this.resolvedItems=[]}static{this.tagName="wmcp-menu"}static{this.styles=m`
|
|
478
478
|
:host {
|
|
479
479
|
display: inline-block;
|
|
480
480
|
font-family: var(
|
|
@@ -579,7 +579,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
579
579
|
opacity: var(--menu-item-disabled-opacity, 0.5);
|
|
580
580
|
cursor: not-allowed;
|
|
581
581
|
}
|
|
582
|
-
`}get menuEl(){return this.renderRoot?.querySelector(".menu")??null}get itemButtons(){return Array.from(this.renderRoot?.querySelectorAll(".item")??[])}get actionVerb(){return"select"}get defaultNameSuffix(){return"menu"}get actionNoun(){return this.label||this.name||"menu"}get defaultToolDescription(){return`Select an item from the "${this.actionNoun}" menu.`}get toolReactiveProps(){return[...super.toolReactiveProps,"resolvedItems"]}toolInputSchema(){return{type:"object",properties:{item:{type:"string",enum:this.resolvedItems.filter(e=>!e.disabled).map(e=>e.value),description:`Which item to select from the "${this.actionNoun}" menu.`}},required:["item"]}}executeTool(e){let r=e.item==null?"":String(e.item),o=this.resolvedItems.find(s=>s.value===r);return o?o.disabled?{content:[{type:"text",text:`The "${o.label}" item is disabled.`}],isError:!0}:(this.selectItem(o),{content:[{type:"text",text:`Selected "${o.label}" from the "${this.actionNoun}" menu.`}]}):{content:[{type:"text",text:`No item "${r}" in the "${this.actionNoun}" menu.`}],isError:!0}}connectedCallback(){this.syncItems(),super.connectedCallback(),this.itemObserver=new MutationObserver(()=>this.syncItems()),this.itemObserver.observe(this,{childList:!0})}disconnectedCallback(){super.disconnectedCallback(),this.itemObserver?.disconnect(),this.itemObserver=void 0}willUpdate(e){e.has("items")&&this.syncItems()}syncItems(){this.resolvedItems=this.items.length>0?this.items:this.readDeclarativeItems()}readDeclarativeItems(){return Array.from(this.querySelectorAll("option")).map(e=>({value:e.value,label:e.textContent?.trim()||e.value,disabled:e.disabled}))}selectItem(e){this.dispatchEvent(new CustomEvent("select",{detail:{value:e.value,label:e.label},bubbles:!0,composed:!0})),this.menuEl?.hidePopover()}onItemClick(e){e.disabled||this.selectItem(e)}onToggle(e){this.open=e.newState==="open",this.open&&this.itemButtons.find(r=>!r.disabled)?.focus()}onMenuKeydown(e){let r=this.itemButtons.filter(
|
|
582
|
+
`}get menuEl(){return this.renderRoot?.querySelector(".menu")??null}get itemButtons(){return Array.from(this.renderRoot?.querySelectorAll(".item")??[])}get actionVerb(){return"select"}get defaultNameSuffix(){return"menu"}get actionNoun(){return this.label||this.name||"menu"}get defaultToolDescription(){return`Select an item from the "${this.actionNoun}" menu.`}get toolReactiveProps(){return[...super.toolReactiveProps,"resolvedItems"]}toolInputSchema(){return{type:"object",properties:{item:{type:"string",enum:this.resolvedItems.filter(e=>!e.disabled).map(e=>e.value),description:`Which item to select from the "${this.actionNoun}" menu.`}},required:["item"]}}executeTool(e){let r=e.item==null?"":String(e.item),o=this.resolvedItems.find(s=>s.value===r);return o?o.disabled?{content:[{type:"text",text:`The "${o.label}" item is disabled.`}],isError:!0}:(this.selectItem(o),{content:[{type:"text",text:`Selected "${o.label}" from the "${this.actionNoun}" menu.`}]}):{content:[{type:"text",text:`No item "${r}" in the "${this.actionNoun}" menu.`}],isError:!0}}connectedCallback(){this.syncItems(),super.connectedCallback(),this.itemObserver=new MutationObserver(()=>this.syncItems()),this.itemObserver.observe(this,{childList:!0})}disconnectedCallback(){super.disconnectedCallback(),this.itemObserver?.disconnect(),this.itemObserver=void 0}willUpdate(e){e.has("items")&&this.syncItems()}syncItems(){this.resolvedItems=this.items.length>0?this.items:this.readDeclarativeItems()}readDeclarativeItems(){return Array.from(this.querySelectorAll("option")).map(e=>({value:e.value,label:e.textContent?.trim()||e.value,disabled:e.disabled}))}selectItem(e){this.dispatchEvent(new CustomEvent("select",{detail:{value:e.value,label:e.label},bubbles:!0,composed:!0})),this.menuEl?.hidePopover()}onItemClick(e){e.disabled||this.selectItem(e)}onToggle(e){this.open=e.newState==="open",this.open&&this.itemButtons.find(r=>!r.disabled)?.focus()}onMenuKeydown(e){let r=this.itemButtons.filter(a=>!a.disabled);if(r.length===0)return;let o=r.indexOf(this.shadowRoot?.activeElement),s=-1;switch(e.key){case"ArrowDown":s=o<0?0:(o+1)%r.length;break;case"ArrowUp":s=o<=0?r.length-1:o-1;break;case"Home":s=0;break;case"End":s=r.length-1;break;default:return}e.preventDefault(),r[s]?.focus()}render(){return u`
|
|
583
583
|
<button
|
|
584
584
|
type="button"
|
|
585
585
|
class="trigger"
|
|
@@ -610,7 +610,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
610
610
|
@toggle=${this.onToggle}
|
|
611
611
|
@keydown=${this.onMenuKeydown}
|
|
612
612
|
>
|
|
613
|
-
${this.resolvedItems.length===0?p:
|
|
613
|
+
${this.resolvedItems.length===0?p:N(this.resolvedItems,e=>e.value,e=>u`
|
|
614
614
|
<button
|
|
615
615
|
type="button"
|
|
616
616
|
class="item"
|
|
@@ -623,7 +623,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
623
623
|
</button>
|
|
624
624
|
`)}
|
|
625
625
|
</div>
|
|
626
|
-
`}};
|
|
626
|
+
`}};n([l()],L.prototype,"label",2),n([l({attribute:!1})],L.prototype,"items",2),n([l({type:Boolean,reflect:!0})],L.prototype,"open",2),n([k()],L.prototype,"resolvedItems",2);var j=class extends ${constructor(){super(...arguments);this.active="";this.label="";this.tabs=[]}static{this.tagName="wmcp-tabs"}static{this.styles=m`
|
|
627
627
|
:host {
|
|
628
628
|
display: block;
|
|
629
629
|
font-family: var(
|
|
@@ -674,9 +674,9 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
674
674
|
.panels {
|
|
675
675
|
padding-top: var(--tabs-panel-padding-top, 1rem);
|
|
676
676
|
}
|
|
677
|
-
`}get actionVerb(){return"switch"}get defaultNameSuffix(){return"tabs"}get actionNoun(){return this.label||this.name||"tabs"}get defaultToolDescription(){return`Switch the active tab in the "${this.actionNoun}" tabs.`}get toolReactiveProps(){return[...super.toolReactiveProps,"tabs"]}toolInputSchema(){return{type:"object",properties:{tab:{type:"string",enum:this.tabs.filter(e=>!e.disabled).map(e=>e.value),description:`Which tab to switch to in the "${this.actionNoun}" tabs.`}},required:["tab"]}}executeTool(e){let r=e.tab==null?"":String(e.tab),o=this.tabs.find(s=>s.value===r);return o?o.disabled?{content:[{type:"text",text:`The "${o.label}" tab is disabled.`}],isError:!0}:(this.switchTo(o.value),{content:[{type:"text",text:`Switched to the "${o.label}" tab in the "${this.actionNoun}" tabs.`}]}):{content:[{type:"text",text:`No tab "${r}" in the "${this.actionNoun}" tabs.`}],isError:!0}}connectedCallback(){this.syncTabs(),this.ensureActive(),super.connectedCallback(),this.panelObserver=new MutationObserver(()=>{this.syncTabs(),this.ensureActive()}),this.panelObserver.observe(this,{childList:!0})}disconnectedCallback(){super.disconnectedCallback(),this.panelObserver?.disconnect(),this.panelObserver=void 0}updated(e){super.updated(e),(e.has("active")||e.has("tabs"))&&this.applyPanels()}get panelEls(){return Array.from(this.querySelectorAll("[tab]"))}syncTabs(){this.tabs=this.panelEls.map(e=>({value:e.getAttribute("tab")??"",label:e.getAttribute("tab-label")||e.getAttribute("tab")||"",disabled:e.hasAttribute("tab-disabled")}))}ensureActive(){this.tabs.some(r=>r.value===this.active&&!r.disabled)||(this.active=this.tabs.find(r=>!r.disabled)?.value??"")}applyPanels(){for(let e of this.panelEls){let r=e.getAttribute("tab")??"",o=this.tabs.find(s=>s.value===r);e.setAttribute("role","tabpanel"),e.setAttribute("tabindex","0"),o?.label&&e.setAttribute("aria-label",o.label),e.toggleAttribute("hidden",r!==this.active)}}switchTo(e){e!==this.active&&(this.active=e,this.dispatchEvent(new CustomEvent("change",{detail:{value:e},bubbles:!0,composed:!0})))}get tabButtons(){return Array.from(this.renderRoot?.querySelectorAll(".tab")??[])}onKeydown(e){let r=this.tabs.filter(
|
|
677
|
+
`}get actionVerb(){return"switch"}get defaultNameSuffix(){return"tabs"}get actionNoun(){return this.label||this.name||"tabs"}get defaultToolDescription(){return`Switch the active tab in the "${this.actionNoun}" tabs.`}get toolReactiveProps(){return[...super.toolReactiveProps,"tabs"]}toolInputSchema(){return{type:"object",properties:{tab:{type:"string",enum:this.tabs.filter(e=>!e.disabled).map(e=>e.value),description:`Which tab to switch to in the "${this.actionNoun}" tabs.`}},required:["tab"]}}executeTool(e){let r=e.tab==null?"":String(e.tab),o=this.tabs.find(s=>s.value===r);return o?o.disabled?{content:[{type:"text",text:`The "${o.label}" tab is disabled.`}],isError:!0}:(this.switchTo(o.value),{content:[{type:"text",text:`Switched to the "${o.label}" tab in the "${this.actionNoun}" tabs.`}]}):{content:[{type:"text",text:`No tab "${r}" in the "${this.actionNoun}" tabs.`}],isError:!0}}connectedCallback(){this.syncTabs(),this.ensureActive(),super.connectedCallback(),this.panelObserver=new MutationObserver(()=>{this.syncTabs(),this.ensureActive()}),this.panelObserver.observe(this,{childList:!0})}disconnectedCallback(){super.disconnectedCallback(),this.panelObserver?.disconnect(),this.panelObserver=void 0}updated(e){super.updated(e),(e.has("active")||e.has("tabs"))&&this.applyPanels()}get panelEls(){return Array.from(this.querySelectorAll("[tab]"))}syncTabs(){this.tabs=this.panelEls.map(e=>({value:e.getAttribute("tab")??"",label:e.getAttribute("tab-label")||e.getAttribute("tab")||"",disabled:e.hasAttribute("tab-disabled")}))}ensureActive(){this.tabs.some(r=>r.value===this.active&&!r.disabled)||(this.active=this.tabs.find(r=>!r.disabled)?.value??"")}applyPanels(){for(let e of this.panelEls){let r=e.getAttribute("tab")??"",o=this.tabs.find(s=>s.value===r);e.setAttribute("role","tabpanel"),e.setAttribute("tabindex","0"),o?.label&&e.setAttribute("aria-label",o.label),e.toggleAttribute("hidden",r!==this.active)}}switchTo(e){e!==this.active&&(this.active=e,this.dispatchEvent(new CustomEvent("change",{detail:{value:e},bubbles:!0,composed:!0})))}get tabButtons(){return Array.from(this.renderRoot?.querySelectorAll(".tab")??[])}onKeydown(e){let r=this.tabs.filter(c=>!c.disabled);if(r.length===0)return;let o=r.map(c=>c.value),s=o.indexOf(this.active),a=-1;switch(e.key){case"ArrowRight":case"ArrowDown":a=(s+1)%o.length;break;case"ArrowLeft":case"ArrowUp":a=s<=0?o.length-1:s-1;break;case"Home":a=0;break;case"End":a=o.length-1;break;default:return}e.preventDefault();let d=o[a];this.switchTo(d),this.updateComplete.then(()=>{this.tabButtons.find(c=>c.dataset.value===d)?.focus()})}render(){return u`
|
|
678
678
|
<div role="tablist" aria-label=${this.label||p} @keydown=${this.onKeydown}>
|
|
679
|
-
${
|
|
679
|
+
${N(this.tabs,e=>e.value,e=>{let r=e.value===this.active;return u`<button
|
|
680
680
|
type="button"
|
|
681
681
|
class="tab"
|
|
682
682
|
part="tab"
|
|
@@ -691,7 +691,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
691
691
|
</button>`})}
|
|
692
692
|
</div>
|
|
693
693
|
<div class="panels" part="panels"><slot></slot></div>
|
|
694
|
-
`}};
|
|
694
|
+
`}};n([l({reflect:!0})],j.prototype,"active",2),n([l()],j.prototype,"label",2),n([k()],j.prototype,"tabs",2);var P=class extends ${constructor(){super(...arguments);this.open=!1;this.label="";this.placement="bottom";this.trigger="click"}static{this.tagName="wmcp-popover"}static{this.styles=m`
|
|
695
695
|
:host {
|
|
696
696
|
display: inline-block;
|
|
697
697
|
font-family: var(
|
|
@@ -768,7 +768,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
770
|
}
|
|
771
|
-
`}get panelEl(){return this.renderRoot?.querySelector(".panel")??null}get actionVerb(){return"open"}get defaultNameSuffix(){return"popover"}get defaultToolDescription(){return`Open the "${this.actionNoun}" popover.`}executeTool(){let e=this.actionNoun;return this.open?{content:[{type:"text",text:`The "${e}" popover is already open.`}]}:(this.show(),{content:[{type:"text",text:`Opened the "${e}" popover.`}]})}updated(e){super.updated(e),e.has("open")&&this.syncNativeOpen()}show(){this.open=!0}close(){this.open=!1}syncNativeOpen(){let e=this.panelEl;if(!e)return;let r=e.matches(":popover-open");this.open&&!r?e.showPopover():!this.open&&r&&e.hidePopover()}onToggle(e){let r=e.newState==="open";this.open=r,this.dispatchEvent(new Event(r?"open":"close",{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.cancelScheduledClose()}openOnHover(){this.trigger==="hover"&&(this.cancelScheduledClose(),this.show())}scheduleHoverClose(){this.trigger==="hover"&&(this.cancelScheduledClose(),this.closeTimer=setTimeout(()=>this.close(),120))}cancelScheduledClose(){this.closeTimer&&(clearTimeout(this.closeTimer),this.closeTimer=void 0)}render(){let e=this.trigger==="hover";return
|
|
771
|
+
`}get panelEl(){return this.renderRoot?.querySelector(".panel")??null}get actionVerb(){return"open"}get defaultNameSuffix(){return"popover"}get defaultToolDescription(){return`Open the "${this.actionNoun}" popover.`}executeTool(){let e=this.actionNoun;return this.open?{content:[{type:"text",text:`The "${e}" popover is already open.`}]}:(this.show(),{content:[{type:"text",text:`Opened the "${e}" popover.`}]})}updated(e){super.updated(e),e.has("open")&&this.syncNativeOpen()}show(){this.open=!0}close(){this.open=!1}syncNativeOpen(){let e=this.panelEl;if(!e)return;let r=e.matches(":popover-open");this.open&&!r?e.showPopover():!this.open&&r&&e.hidePopover()}onToggle(e){let r=e.newState==="open";this.open=r,this.dispatchEvent(new Event(r?"open":"close",{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.cancelScheduledClose()}openOnHover(){this.trigger==="hover"&&(this.cancelScheduledClose(),this.show())}scheduleHoverClose(){this.trigger==="hover"&&(this.cancelScheduledClose(),this.closeTimer=setTimeout(()=>this.close(),120))}cancelScheduledClose(){this.closeTimer&&(clearTimeout(this.closeTimer),this.closeTimer=void 0)}render(){let e=this.trigger==="hover";return u`
|
|
772
772
|
<button
|
|
773
773
|
type="button"
|
|
774
774
|
class="trigger"
|
|
@@ -799,7 +799,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
799
799
|
>
|
|
800
800
|
<slot></slot>
|
|
801
801
|
</div>
|
|
802
|
-
`}};
|
|
802
|
+
`}};n([l({type:Boolean,reflect:!0})],P.prototype,"open",2),n([l()],P.prototype,"label",2),n([l({reflect:!0})],P.prototype,"placement",2),n([l()],P.prototype,"trigger",2);var kr=3e4,M=class extends A{constructor(){super(...arguments);this.name="";this.label="";this.placement="bottom-right";this.duration=5e3;this.toasts=[];this.recent=[];this.nextId=0;this.timers=new Map}static{this.tagName="wmcp-toast"}static{this.styles=m`
|
|
803
803
|
:host {
|
|
804
804
|
position: fixed;
|
|
805
805
|
z-index: var(--toast-z, 1000);
|
|
@@ -901,11 +901,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
901
901
|
}
|
|
902
902
|
`}show(e){let r={...e,id:this.nextId++,variant:e.variant??"info",shownAt:Date.now()};this.toasts=[...this.toasts,r],this.recent=[r,...this.recent].slice(0,10);let o=e.duration??this.duration;return o>0&&this.timers.set(r.id,setTimeout(()=>this.dismiss(r.id),o)),r.id}dismiss(e){this.toasts=this.toasts.filter(o=>o.id!==e);let r=this.timers.get(e);r&&(clearTimeout(r),this.timers.delete(e))}clear(){for(let e of[...this.toasts])this.dismiss(e.id)}disconnectedCallback(){super.disconnectedCallback();for(let e of this.timers.values())clearTimeout(e);this.timers.clear()}get resolvedToolName(){return this.toolName||`read_${this.name||"notifications"}`}get defaultToolDescription(){return"Read the notifications currently shown to the user (with any that appeared in the last few seconds), so you can tell what just happened on the page."}get toolReactiveProps(){return[...super.toolReactiveProps,"name"]}executeTool(){let e=s=>`[${s.variant}] ${s.title?`${s.title}: `:""}${s.message}`;if(this.toasts.length>0)return{content:[{type:"text",text:`${this.toasts.length} notification(s) showing:
|
|
903
903
|
`+this.toasts.map(e).join(`
|
|
904
|
-
`)}]};let r=Date.now()-
|
|
904
|
+
`)}]};let r=Date.now()-kr,o=this.recent.filter(s=>s.shownAt>=r);return o.length>0?{content:[{type:"text",text:`No notifications are showing now. Recently shown:
|
|
905
905
|
`+o.map(e).join(`
|
|
906
|
-
`)}]}:{content:[{type:"text",text:"No notifications."}]}}render(){return
|
|
906
|
+
`)}]}:{content:[{type:"text",text:"No notifications."}]}}render(){return u`
|
|
907
907
|
<div role="region" aria-label=${this.label||"Notifications"} aria-live="polite">
|
|
908
|
-
${
|
|
908
|
+
${N(this.toasts,e=>e.id,e=>u`
|
|
909
909
|
<div
|
|
910
910
|
class="toast"
|
|
911
911
|
part="toast"
|
|
@@ -913,7 +913,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
913
913
|
role=${e.variant==="error"?"alert":"status"}
|
|
914
914
|
>
|
|
915
915
|
<div class="body">
|
|
916
|
-
${e.title?
|
|
916
|
+
${e.title?u`<div class="title">${e.title}</div>`:p}
|
|
917
917
|
<div class="message">${e.message}</div>
|
|
918
918
|
</div>
|
|
919
919
|
<button
|
|
@@ -928,7 +928,241 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
928
928
|
</div>
|
|
929
929
|
`)}
|
|
930
930
|
</div>
|
|
931
|
-
`}};
|
|
931
|
+
`}};n([l()],M.prototype,"name",2),n([l()],M.prototype,"label",2),n([l({reflect:!0})],M.prototype,"placement",2),n([l({type:Number})],M.prototype,"duration",2),n([k()],M.prototype,"toasts",2);var ne=class extends g{constructor(){super();this.checked=!1;this.defaultChecked=!1;this.value="on"}static{this.tagName="wmcp-switch"}static{this.styles=[g.styles,m`
|
|
932
|
+
.row {
|
|
933
|
+
display: inline-flex;
|
|
934
|
+
align-items: center;
|
|
935
|
+
gap: var(--input-gap-icon, 0.5rem);
|
|
936
|
+
cursor: pointer;
|
|
937
|
+
font-weight: 400;
|
|
938
|
+
}
|
|
939
|
+
.row:has(.control:disabled) {
|
|
940
|
+
cursor: not-allowed;
|
|
941
|
+
color: var(--input-text-disabled, var(--muted-foreground, oklch(0.556 0 0)));
|
|
942
|
+
}
|
|
943
|
+
.control {
|
|
944
|
+
appearance: none;
|
|
945
|
+
box-sizing: border-box;
|
|
946
|
+
position: relative;
|
|
947
|
+
flex-shrink: 0;
|
|
948
|
+
width: var(--switch-width, 2.25rem);
|
|
949
|
+
height: var(--switch-height, 1.35rem);
|
|
950
|
+
margin: 0;
|
|
951
|
+
padding: 0;
|
|
952
|
+
border-radius: 999px;
|
|
953
|
+
background: var(--switch-track, var(--input, oklch(0.922 0 0)));
|
|
954
|
+
cursor: inherit;
|
|
955
|
+
transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
956
|
+
}
|
|
957
|
+
.control::before {
|
|
958
|
+
content: '';
|
|
959
|
+
position: absolute;
|
|
960
|
+
top: 50%;
|
|
961
|
+
left: var(--switch-gap, 0.15rem);
|
|
962
|
+
width: var(--switch-thumb, 1.05rem);
|
|
963
|
+
height: var(--switch-thumb, 1.05rem);
|
|
964
|
+
border-radius: 50%;
|
|
965
|
+
background: var(--switch-thumb-color, var(--background, oklch(1 0 0)));
|
|
966
|
+
translate: 0 -50%;
|
|
967
|
+
transition: translate 150ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
968
|
+
box-shadow: 0 1px 2px color-mix(in oklch, oklch(0 0 0) 25%, transparent);
|
|
969
|
+
}
|
|
970
|
+
.control:checked {
|
|
971
|
+
background: var(--switch-track-on, var(--primary, oklch(0.205 0 0)));
|
|
972
|
+
}
|
|
973
|
+
.control:checked::before {
|
|
974
|
+
translate: calc(var(--switch-width, 2.25rem) - var(--switch-thumb, 1.05rem) - var(--switch-gap, 0.15rem) * 2) -50%;
|
|
975
|
+
}
|
|
976
|
+
.control:focus-visible {
|
|
977
|
+
outline: none;
|
|
978
|
+
box-shadow: 0 0 0 var(--ring-width, 3px)
|
|
979
|
+
color-mix(in oklch, var(--ring, oklch(0.708 0 0)) 40%, transparent);
|
|
980
|
+
}
|
|
981
|
+
.control:disabled {
|
|
982
|
+
opacity: 0.5;
|
|
983
|
+
}
|
|
984
|
+
.label-text {
|
|
985
|
+
font-size: var(--input-font-size, 0.875rem);
|
|
986
|
+
color: var(--input-text, var(--foreground, oklch(0.145 0 0)));
|
|
987
|
+
}
|
|
988
|
+
`]}get controlNoun(){return"switch"}connectedCallback(){this.defaultChecked=this.checked,super.connectedCallback()}getFormValue(){return this.checked?this.value:null}get validationValue(){return this.checked}get isEmpty(){return!this.checked}get requiredMessageDefault(){return"Please turn this on."}toolInputSchema(){return{type:"object",properties:{checked:{type:"boolean",description:this.label||this.name||"Whether the switch is on."}},required:["checked"]}}async applyAgentValue(e){this.checked=!!e.checked,await this.validate(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}stateDescription(){return this.checked?"on":"off"}formResetCallback(){this.checked=this.defaultChecked,this.error="",this.toggleAttribute("invalid",!1),this.validate(!1)}async onToggle(e){this.checked=e.target.checked,await this.validate()}renderControl(){return u`
|
|
989
|
+
<input
|
|
990
|
+
id="control"
|
|
991
|
+
class="control"
|
|
992
|
+
part="control"
|
|
993
|
+
type="checkbox"
|
|
994
|
+
role="switch"
|
|
995
|
+
.checked=${this.checked}
|
|
996
|
+
?required=${this.required}
|
|
997
|
+
?disabled=${this.disabled}
|
|
998
|
+
aria-invalid=${this.error?"true":"false"}
|
|
999
|
+
aria-describedby=${this.describedBy??p}
|
|
1000
|
+
@change=${this.onToggle}
|
|
1001
|
+
/>
|
|
1002
|
+
`}render(){return u`
|
|
1003
|
+
<label class="row">
|
|
1004
|
+
${this.renderControl()}
|
|
1005
|
+
${this.label?u`<span class="label-text">${this.label}</span>`:p}
|
|
1006
|
+
</label>
|
|
1007
|
+
${this.renderMessage()}
|
|
1008
|
+
`}};n([l({type:Boolean,reflect:!0})],ne.prototype,"checked",2);var le=class extends _{constructor(){super(...arguments);this.variant="primary"}static{this.tagName="wmcp-badge"}static{this.styles=m`
|
|
1009
|
+
:host {
|
|
1010
|
+
display: inline-flex;
|
|
1011
|
+
align-items: center;
|
|
1012
|
+
gap: var(--badge-gap, 0.25rem);
|
|
1013
|
+
padding: var(--badge-padding, 0.125rem 0.5rem);
|
|
1014
|
+
font-family: var(--badge-font-family, ui-sans-serif, system-ui, sans-serif);
|
|
1015
|
+
font-size: var(--badge-font-size, 0.75rem);
|
|
1016
|
+
font-weight: var(--badge-font-weight, 500);
|
|
1017
|
+
line-height: 1.2;
|
|
1018
|
+
border: 1px solid transparent;
|
|
1019
|
+
border-radius: var(--badge-radius, 999px);
|
|
1020
|
+
white-space: nowrap;
|
|
1021
|
+
}
|
|
1022
|
+
:host([hidden]) {
|
|
1023
|
+
display: none;
|
|
1024
|
+
}
|
|
1025
|
+
:host {
|
|
1026
|
+
color: var(--badge-primary-text, var(--primary-foreground, oklch(0.985 0 0)));
|
|
1027
|
+
background: var(--badge-primary-bg, var(--primary, oklch(0.205 0 0)));
|
|
1028
|
+
}
|
|
1029
|
+
:host([variant='secondary']) {
|
|
1030
|
+
color: var(--badge-secondary-text, var(--secondary-foreground, oklch(0.205 0 0)));
|
|
1031
|
+
background: var(--badge-secondary-bg, var(--secondary, oklch(0.97 0 0)));
|
|
1032
|
+
}
|
|
1033
|
+
:host([variant='destructive']) {
|
|
1034
|
+
color: var(--badge-destructive-text, var(--destructive-foreground, oklch(0.985 0 0)));
|
|
1035
|
+
background: var(--badge-destructive-bg, var(--destructive, oklch(0.577 0.245 27.325)));
|
|
1036
|
+
}
|
|
1037
|
+
:host([variant='outline']) {
|
|
1038
|
+
color: var(--badge-outline-text, var(--foreground, oklch(0.145 0 0)));
|
|
1039
|
+
border-color: var(--badge-outline-border, var(--border, oklch(0.922 0 0)));
|
|
1040
|
+
}
|
|
1041
|
+
`}render(){return u`<slot></slot>`}};n([l({reflect:!0})],le.prototype,"variant",2);var ce=class extends _{constructor(){super(...arguments);this.orientation="horizontal"}static{this.tagName="wmcp-separator"}static{this.styles=m`
|
|
1042
|
+
:host {
|
|
1043
|
+
display: block;
|
|
1044
|
+
background: var(--separator-color, var(--border, oklch(0.922 0 0)));
|
|
1045
|
+
border: 0;
|
|
1046
|
+
flex-shrink: 0;
|
|
1047
|
+
}
|
|
1048
|
+
:host([hidden]) {
|
|
1049
|
+
display: none;
|
|
1050
|
+
}
|
|
1051
|
+
:host([orientation='horizontal']) {
|
|
1052
|
+
width: 100%;
|
|
1053
|
+
height: var(--separator-size, 1px);
|
|
1054
|
+
}
|
|
1055
|
+
:host([orientation='vertical']) {
|
|
1056
|
+
width: var(--separator-size, 1px);
|
|
1057
|
+
height: 100%;
|
|
1058
|
+
align-self: stretch;
|
|
1059
|
+
}
|
|
1060
|
+
`}connectedCallback(){super.connectedCallback(),this.setAttribute("role","separator"),this.orientation==="vertical"&&this.setAttribute("aria-orientation","vertical")}};n([l({reflect:!0})],ce.prototype,"orientation",2);var me=class extends P{static{this.tagName="wmcp-tooltip"}constructor(){super(),this.trigger="hover"}get defaultNameSuffix(){return"tooltip"}};var Z=class extends _{constructor(){super(...arguments);this.variant="info";this.title=""}static{this.tagName="wmcp-alert"}static{this.styles=m`
|
|
1061
|
+
:host {
|
|
1062
|
+
display: block;
|
|
1063
|
+
padding: var(--alert-padding, 0.75rem 1rem);
|
|
1064
|
+
color: var(--alert-text, var(--foreground, oklch(0.145 0 0)));
|
|
1065
|
+
background: var(--alert-bg, var(--background, oklch(1 0 0)));
|
|
1066
|
+
border: 1px solid var(--alert-border, var(--border, oklch(0.922 0 0)));
|
|
1067
|
+
border-left: 3px solid var(--alert-accent, var(--border, oklch(0.922 0 0)));
|
|
1068
|
+
border-radius: var(--alert-radius, var(--radius, 0.625rem));
|
|
1069
|
+
font-family: var(--alert-font-family, ui-sans-serif, system-ui, sans-serif);
|
|
1070
|
+
font-size: var(--alert-font-size, 0.875rem);
|
|
1071
|
+
}
|
|
1072
|
+
:host([hidden]) {
|
|
1073
|
+
display: none;
|
|
1074
|
+
}
|
|
1075
|
+
:host([variant='success']) {
|
|
1076
|
+
--alert-accent: var(--alert-accent-success, oklch(0.627 0.13 160));
|
|
1077
|
+
}
|
|
1078
|
+
:host([variant='warning']) {
|
|
1079
|
+
--alert-accent: var(--alert-accent-warning, oklch(0.7 0.16 75));
|
|
1080
|
+
}
|
|
1081
|
+
:host([variant='error']) {
|
|
1082
|
+
--alert-accent: var(--alert-accent-error, var(--destructive, oklch(0.577 0.245 27.325)));
|
|
1083
|
+
}
|
|
1084
|
+
:host([variant='info']) {
|
|
1085
|
+
--alert-accent: var(--alert-accent-info, var(--primary, oklch(0.205 0 0)));
|
|
1086
|
+
}
|
|
1087
|
+
.title {
|
|
1088
|
+
font-weight: 600;
|
|
1089
|
+
margin-bottom: 0.125rem;
|
|
1090
|
+
}
|
|
1091
|
+
.message {
|
|
1092
|
+
color: var(--alert-message, var(--muted-foreground, oklch(0.556 0 0)));
|
|
1093
|
+
}
|
|
1094
|
+
`}connectedCallback(){super.connectedCallback(),this.setAttribute("role",this.variant==="error"||this.variant==="warning"?"alert":"status")}render(){return u`
|
|
1095
|
+
${this.title?u`<div class="title">${this.title}</div>`:p}
|
|
1096
|
+
<div class="message"><slot></slot></div>
|
|
1097
|
+
`}};n([l({reflect:!0})],Z.prototype,"variant",2),n([l()],Z.prototype,"title",2);var G=class extends _{constructor(){super(...arguments);this.max=100;this.indeterminate=!1}static{this.tagName="wmcp-progress"}static{this.styles=m`
|
|
1098
|
+
:host {
|
|
1099
|
+
display: block;
|
|
1100
|
+
width: 100%;
|
|
1101
|
+
height: var(--progress-height, 0.5rem);
|
|
1102
|
+
overflow: hidden;
|
|
1103
|
+
background: var(--progress-track, var(--secondary, oklch(0.97 0 0)));
|
|
1104
|
+
border-radius: var(--progress-radius, 999px);
|
|
1105
|
+
}
|
|
1106
|
+
:host([hidden]) {
|
|
1107
|
+
display: none;
|
|
1108
|
+
}
|
|
1109
|
+
.bar {
|
|
1110
|
+
height: 100%;
|
|
1111
|
+
background: var(--progress-bar, var(--primary, oklch(0.205 0 0)));
|
|
1112
|
+
border-radius: inherit;
|
|
1113
|
+
transition: width 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
1114
|
+
}
|
|
1115
|
+
.bar.indeterminate {
|
|
1116
|
+
width: 40% !important;
|
|
1117
|
+
animation: progress-slide 1.2s infinite cubic-bezier(0.4, 0, 0.2, 1);
|
|
1118
|
+
}
|
|
1119
|
+
@keyframes progress-slide {
|
|
1120
|
+
from {
|
|
1121
|
+
translate: -100%;
|
|
1122
|
+
}
|
|
1123
|
+
to {
|
|
1124
|
+
translate: 350%;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1128
|
+
.bar.indeterminate {
|
|
1129
|
+
animation: none;
|
|
1130
|
+
width: 100% !important;
|
|
1131
|
+
opacity: 0.5;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
`}get isIndeterminate(){return this.indeterminate||this.value==null}updated(){this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax",String(this.max)),this.isIndeterminate?this.removeAttribute("aria-valuenow"):this.setAttribute("aria-valuenow",String(this.value))}render(){let e=this.isIndeterminate?0:Math.max(0,Math.min(100,(this.value??0)/this.max*100));return u`<div
|
|
1135
|
+
class="bar ${this.isIndeterminate?"indeterminate":""}"
|
|
1136
|
+
style=${this.isIndeterminate?"":`width: ${e}%`}
|
|
1137
|
+
></div>`}};n([l({type:Number})],G.prototype,"value",2),n([l({type:Number})],G.prototype,"max",2),n([l({type:Boolean})],G.prototype,"indeterminate",2);var W=class extends _{constructor(){super(...arguments);this.src="";this.alt="";this.fallback="";this.failed=!1}static{this.tagName="wmcp-avatar"}static{this.styles=m`
|
|
1138
|
+
:host {
|
|
1139
|
+
display: inline-flex;
|
|
1140
|
+
align-items: center;
|
|
1141
|
+
justify-content: center;
|
|
1142
|
+
width: var(--avatar-size, 2.5rem);
|
|
1143
|
+
height: var(--avatar-size, 2.5rem);
|
|
1144
|
+
overflow: hidden;
|
|
1145
|
+
border-radius: var(--avatar-radius, 50%);
|
|
1146
|
+
background: var(--avatar-bg, var(--muted, oklch(0.97 0 0)));
|
|
1147
|
+
color: var(--avatar-text, var(--muted-foreground, oklch(0.556 0 0)));
|
|
1148
|
+
font-family: var(--avatar-font-family, ui-sans-serif, system-ui, sans-serif);
|
|
1149
|
+
font-size: var(--avatar-font-size, 0.875rem);
|
|
1150
|
+
font-weight: var(--avatar-font-weight, 500);
|
|
1151
|
+
user-select: none;
|
|
1152
|
+
}
|
|
1153
|
+
:host([hidden]) {
|
|
1154
|
+
display: none;
|
|
1155
|
+
}
|
|
1156
|
+
img {
|
|
1157
|
+
width: 100%;
|
|
1158
|
+
height: 100%;
|
|
1159
|
+
object-fit: cover;
|
|
1160
|
+
}
|
|
1161
|
+
`}willUpdate(e){e.has("src")&&(this.failed=!1)}render(){return this.src&&!this.failed?u`<img
|
|
1162
|
+
src=${this.src}
|
|
1163
|
+
alt=${this.alt||p}
|
|
1164
|
+
@error=${()=>this.failed=!0}
|
|
1165
|
+
/>`:u`<span aria-label=${this.alt||p}>${this.fallback}</span>`}};n([l()],W.prototype,"src",2),n([l()],W.prototype,"alt",2),n([l()],W.prototype,"fallback",2),n([k()],W.prototype,"failed",2);var Rr=[ie,se,K,ae,he,Y,I,B,L,j,P,M,ne,le,ce,me,Z,G,W];function Xe(){if(!(typeof customElements>"u"))for(let i of Rr)customElements.get(i.tagName)||customElements.define(i.tagName,i)}Xe();return ar(Ar);})();
|
|
932
1166
|
/*! Bundled license information:
|
|
933
1167
|
|
|
934
1168
|
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|