@webmcpui/core 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +35 -19
- package/dist/index.js +25 -5
- package/dist/testing.d.ts +3 -1
- package/dist/{webmcp-DEspBoqq.d.ts → webmcp-JAn7I2xj.d.ts} +3 -0
- package/dist/webmcpui.global.js +10 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export { T as ToolDisposer, W as WebMCPToolDefinition, a as WebMCPToolResult, b as WebMCPToolResultContent, e as exposeTool, i as isWebMCPAvailable } from './webmcp-DEspBoqq.js';
|
|
1
|
+
import { LitElement, CSSResultGroup, TemplateResult, nothing, CSSResult } from 'lit';
|
|
2
|
+
import { J as JSONSchema } from './webmcp-JAn7I2xj.js';
|
|
3
|
+
export { T as ToolDisposer, W as WebMCPToolDefinition, a as WebMCPToolResult, b as WebMCPToolResultContent, e as exposeTool, i as isWebMCPAvailable } from './webmcp-JAn7I2xj.js';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Minimal Standard Schema v1 types + a validation helper.
|
|
@@ -11,6 +10,10 @@ export { T as ToolDisposer, W as WebMCPToolDefinition, a as WebMCPToolResult, b
|
|
|
11
10
|
* that implements `~standard`. This is the Skillet-avoidance decision: no
|
|
12
11
|
* bespoke schema language, zero learning curve.
|
|
13
12
|
*/
|
|
13
|
+
/**
|
|
14
|
+
* The minimal [Standard Schema](https://standardschema.dev) v1 surface this
|
|
15
|
+
* package relies on — implemented by Zod, Valibot, ArkType, and others.
|
|
16
|
+
*/
|
|
14
17
|
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
15
18
|
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
16
19
|
}
|
|
@@ -41,6 +44,7 @@ declare namespace StandardSchemaV1 {
|
|
|
41
44
|
readonly output: Output;
|
|
42
45
|
}
|
|
43
46
|
}
|
|
47
|
+
/** The normalized result of {@link validateStandard}: either a value or issues. */
|
|
44
48
|
interface ValidationOutcome<Output> {
|
|
45
49
|
/** True when the value passed validation. */
|
|
46
50
|
readonly valid: boolean;
|
|
@@ -74,7 +78,14 @@ declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
|
|
|
74
78
|
* Text-field box appearance for the `.control` element. Used by input,
|
|
75
79
|
* textarea, and select — the controls that render as a bordered field.
|
|
76
80
|
*/
|
|
77
|
-
declare const textFieldStyles:
|
|
81
|
+
declare const textFieldStyles: CSSResult;
|
|
82
|
+
/**
|
|
83
|
+
* Shared base for every `<wmcp-*>` form control: form association via
|
|
84
|
+
* `ElementInternals`, Standard Schema validation, accessible error messaging,
|
|
85
|
+
* and opt-in WebMCP tool exposure. Each concrete element is a thin subclass
|
|
86
|
+
* that supplies its control markup and tool schema. Abstract — not registered
|
|
87
|
+
* on its own.
|
|
88
|
+
*/
|
|
78
89
|
declare abstract class WmcpFormControl extends LitElement {
|
|
79
90
|
static formAssociated: boolean;
|
|
80
91
|
static styles: CSSResultGroup;
|
|
@@ -167,10 +178,11 @@ declare abstract class WmcpFormControl extends LitElement {
|
|
|
167
178
|
formResetCallback(): void;
|
|
168
179
|
/** Subclasses render their control element here (id/class "control"). */
|
|
169
180
|
protected abstract renderControl(): TemplateResult;
|
|
170
|
-
protected renderMessage(): TemplateResult
|
|
171
|
-
render(): TemplateResult
|
|
181
|
+
protected renderMessage(): TemplateResult | typeof nothing;
|
|
182
|
+
render(): TemplateResult;
|
|
172
183
|
}
|
|
173
184
|
|
|
185
|
+
/** The `type` variants `<wmcp-input>` supports (mirrors native input types). */
|
|
174
186
|
type WmcpInputType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' | 'date';
|
|
175
187
|
/**
|
|
176
188
|
* `<wmcp-input>` — a form-associated, agent-operable single-line text input.
|
|
@@ -182,12 +194,12 @@ type WmcpInputType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' |
|
|
|
182
194
|
*/
|
|
183
195
|
declare class WmcpInput extends WmcpFormControl {
|
|
184
196
|
static readonly tagName = "wmcp-input";
|
|
185
|
-
static styles:
|
|
197
|
+
static styles: CSSResultGroup;
|
|
186
198
|
/** HTML input type. */
|
|
187
199
|
type: WmcpInputType;
|
|
188
200
|
protected get controlNoun(): string;
|
|
189
201
|
protected toolInputSchema(): JSONSchema;
|
|
190
|
-
protected renderControl():
|
|
202
|
+
protected renderControl(): TemplateResult;
|
|
191
203
|
}
|
|
192
204
|
|
|
193
205
|
/**
|
|
@@ -201,22 +213,25 @@ declare class WmcpInput extends WmcpFormControl {
|
|
|
201
213
|
*/
|
|
202
214
|
declare class WmcpTextarea extends WmcpFormControl {
|
|
203
215
|
static readonly tagName = "wmcp-textarea";
|
|
204
|
-
static styles:
|
|
216
|
+
static styles: CSSResultGroup;
|
|
205
217
|
/** Initial visible number of text lines. */
|
|
206
218
|
rows: number;
|
|
207
219
|
protected get controlNoun(): string;
|
|
208
|
-
protected renderControl():
|
|
220
|
+
protected renderControl(): TemplateResult;
|
|
209
221
|
}
|
|
210
222
|
|
|
223
|
+
/** A single selectable option in a `<wmcp-select>`. */
|
|
211
224
|
interface WmcpSelectOption {
|
|
212
225
|
value: string;
|
|
213
226
|
label: string;
|
|
214
227
|
disabled?: boolean;
|
|
215
228
|
}
|
|
229
|
+
/** A labelled group of options (renders as an `<optgroup>`). */
|
|
216
230
|
interface WmcpSelectOptionGroup {
|
|
217
231
|
label: string;
|
|
218
232
|
options: WmcpSelectOption[];
|
|
219
233
|
}
|
|
234
|
+
/** An item in a `<wmcp-select>`'s `items` property — a plain option or a group. */
|
|
220
235
|
type WmcpSelectItem = WmcpSelectOption | WmcpSelectOptionGroup;
|
|
221
236
|
/**
|
|
222
237
|
* `<wmcp-select>` — a form-associated, agent-operable single-select dropdown.
|
|
@@ -234,7 +249,7 @@ type WmcpSelectItem = WmcpSelectOption | WmcpSelectOptionGroup;
|
|
|
234
249
|
*/
|
|
235
250
|
declare class WmcpSelect extends WmcpFormControl {
|
|
236
251
|
static readonly tagName = "wmcp-select";
|
|
237
|
-
static styles:
|
|
252
|
+
static styles: CSSResultGroup;
|
|
238
253
|
/**
|
|
239
254
|
* Options as data. When non-empty, takes precedence over declarative
|
|
240
255
|
* `<option>` children. Set as a property, not an attribute.
|
|
@@ -254,7 +269,7 @@ declare class WmcpSelect extends WmcpFormControl {
|
|
|
254
269
|
flatOptions(): WmcpSelectOption[];
|
|
255
270
|
protected toolInputSchema(): JSONSchema;
|
|
256
271
|
private renderOption;
|
|
257
|
-
protected renderControl():
|
|
272
|
+
protected renderControl(): TemplateResult;
|
|
258
273
|
}
|
|
259
274
|
|
|
260
275
|
/**
|
|
@@ -271,7 +286,7 @@ declare class WmcpSelect extends WmcpFormControl {
|
|
|
271
286
|
*/
|
|
272
287
|
declare class WmcpCheckbox extends WmcpFormControl {
|
|
273
288
|
static readonly tagName = "wmcp-checkbox";
|
|
274
|
-
static styles:
|
|
289
|
+
static styles: CSSResultGroup;
|
|
275
290
|
/** Whether the box is checked. */
|
|
276
291
|
checked: boolean;
|
|
277
292
|
private defaultChecked;
|
|
@@ -287,10 +302,11 @@ declare class WmcpCheckbox extends WmcpFormControl {
|
|
|
287
302
|
protected stateDescription(): string;
|
|
288
303
|
formResetCallback(): void;
|
|
289
304
|
private onToggle;
|
|
290
|
-
protected renderControl():
|
|
291
|
-
render():
|
|
305
|
+
protected renderControl(): TemplateResult;
|
|
306
|
+
render(): TemplateResult;
|
|
292
307
|
}
|
|
293
308
|
|
|
309
|
+
/** One choice in a `<wmcp-radio-group>`, set declaratively via the `options` property. */
|
|
294
310
|
interface WmcpRadioOption {
|
|
295
311
|
value: string;
|
|
296
312
|
label: string;
|
|
@@ -323,7 +339,7 @@ declare class WmcpRadio extends HTMLElement {
|
|
|
323
339
|
*/
|
|
324
340
|
declare class WmcpRadioGroup extends WmcpFormControl {
|
|
325
341
|
static readonly tagName = "wmcp-radio-group";
|
|
326
|
-
static styles:
|
|
342
|
+
static styles: CSSResultGroup;
|
|
327
343
|
/** Options as data. When non-empty, takes precedence over `<wmcp-radio>`. */
|
|
328
344
|
options: WmcpRadioOption[];
|
|
329
345
|
private resolvedOptions;
|
|
@@ -339,8 +355,8 @@ declare class WmcpRadioGroup extends WmcpFormControl {
|
|
|
339
355
|
private readDeclarativeOptions;
|
|
340
356
|
protected toolInputSchema(): JSONSchema;
|
|
341
357
|
private onSelect;
|
|
342
|
-
protected renderControl():
|
|
343
|
-
render():
|
|
358
|
+
protected renderControl(): TemplateResult;
|
|
359
|
+
render(): TemplateResult;
|
|
344
360
|
}
|
|
345
361
|
|
|
346
362
|
/**
|
package/dist/index.js
CHANGED
|
@@ -410,7 +410,11 @@ __decorateClass([
|
|
|
410
410
|
], WmcpFormControl.prototype, "error", 2);
|
|
411
411
|
|
|
412
412
|
// src/elements/input.ts
|
|
413
|
-
import {
|
|
413
|
+
import {
|
|
414
|
+
html as html2,
|
|
415
|
+
css as css2,
|
|
416
|
+
nothing as nothing2
|
|
417
|
+
} from "lit";
|
|
414
418
|
import { property as property2 } from "lit/decorators.js";
|
|
415
419
|
var WmcpInput = class extends WmcpFormControl {
|
|
416
420
|
constructor() {
|
|
@@ -470,7 +474,11 @@ __decorateClass([
|
|
|
470
474
|
], WmcpInput.prototype, "type", 2);
|
|
471
475
|
|
|
472
476
|
// src/elements/textarea.ts
|
|
473
|
-
import {
|
|
477
|
+
import {
|
|
478
|
+
html as html3,
|
|
479
|
+
css as css3,
|
|
480
|
+
nothing as nothing3
|
|
481
|
+
} from "lit";
|
|
474
482
|
import { property as property3 } from "lit/decorators.js";
|
|
475
483
|
var WmcpTextarea = class extends WmcpFormControl {
|
|
476
484
|
constructor() {
|
|
@@ -518,7 +526,11 @@ __decorateClass([
|
|
|
518
526
|
], WmcpTextarea.prototype, "rows", 2);
|
|
519
527
|
|
|
520
528
|
// src/elements/select.ts
|
|
521
|
-
import {
|
|
529
|
+
import {
|
|
530
|
+
html as html4,
|
|
531
|
+
css as css4,
|
|
532
|
+
nothing as nothing4
|
|
533
|
+
} from "lit";
|
|
522
534
|
import { property as property4, state as state2 } from "lit/decorators.js";
|
|
523
535
|
import { repeat } from "lit/directives/repeat.js";
|
|
524
536
|
function isGroup(item) {
|
|
@@ -657,7 +669,11 @@ __decorateClass([
|
|
|
657
669
|
], WmcpSelect.prototype, "resolvedOptions", 2);
|
|
658
670
|
|
|
659
671
|
// src/elements/checkbox.ts
|
|
660
|
-
import {
|
|
672
|
+
import {
|
|
673
|
+
html as html5,
|
|
674
|
+
css as css5,
|
|
675
|
+
nothing as nothing5
|
|
676
|
+
} from "lit";
|
|
661
677
|
import { property as property5 } from "lit/decorators.js";
|
|
662
678
|
var WmcpCheckbox = class extends WmcpFormControl {
|
|
663
679
|
constructor() {
|
|
@@ -789,7 +805,11 @@ __decorateClass([
|
|
|
789
805
|
], WmcpCheckbox.prototype, "checked", 2);
|
|
790
806
|
|
|
791
807
|
// src/elements/radio.ts
|
|
792
|
-
import {
|
|
808
|
+
import {
|
|
809
|
+
html as html6,
|
|
810
|
+
css as css6,
|
|
811
|
+
nothing as nothing6
|
|
812
|
+
} from "lit";
|
|
793
813
|
import { property as property6, state as state3 } from "lit/decorators.js";
|
|
794
814
|
import { repeat as repeat2 } from "lit/directives/repeat.js";
|
|
795
815
|
var groupCounter = 0;
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as WebMCPToolResult } from './webmcp-
|
|
1
|
+
import { a as WebMCPToolResult } from './webmcp-JAn7I2xj.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Fake WebMCP host for tests, demos, and the eventual inspector.
|
|
@@ -8,12 +8,14 @@ import { a as WebMCPToolResult } from './webmcp-DEspBoqq.js';
|
|
|
8
8
|
* records registered tools and lets you invoke them as an agent would.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
/** A tool an element registered with the {@link FakeAgent}, as recorded for inspection. */
|
|
11
12
|
interface RegisteredTool {
|
|
12
13
|
name: string;
|
|
13
14
|
description: string;
|
|
14
15
|
inputSchema: Record<string, unknown>;
|
|
15
16
|
execute: (args: Record<string, unknown>) => WebMCPToolResult | Promise<WebMCPToolResult>;
|
|
16
17
|
}
|
|
18
|
+
/** Handle to the fake WebMCP host returned by {@link installFakeAgent}. */
|
|
17
19
|
interface FakeAgent {
|
|
18
20
|
/** All currently-registered tools, in registration order. */
|
|
19
21
|
readonly tools: readonly RegisteredTool[];
|
|
@@ -15,14 +15,17 @@
|
|
|
15
15
|
*/
|
|
16
16
|
/** A JSON-Schema-ish description of a tool's parameters. */
|
|
17
17
|
type JSONSchema = Record<string, unknown>;
|
|
18
|
+
/** A single piece of a tool result. Today only `text` content is supported. */
|
|
18
19
|
interface WebMCPToolResultContent {
|
|
19
20
|
type: 'text';
|
|
20
21
|
text: string;
|
|
21
22
|
}
|
|
23
|
+
/** The value a tool's `execute` returns to the agent. */
|
|
22
24
|
interface WebMCPToolResult {
|
|
23
25
|
content: WebMCPToolResultContent[];
|
|
24
26
|
isError?: boolean;
|
|
25
27
|
}
|
|
28
|
+
/** Describes a WebMCP tool to register via {@link exposeTool}. */
|
|
26
29
|
interface WebMCPToolDefinition {
|
|
27
30
|
/** Stable, unique tool name (snake_case by convention). */
|
|
28
31
|
name: string;
|
package/dist/webmcpui.global.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var webmcpui=(()=>{var me=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Bt=Object.prototype.hasOwnProperty;var jt=(i,e)=>{for(var t in e)me(i,t,{get:e[t],enumerable:!0})},zt=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Vt(e))!Bt.call(i,s)&&s!==t&&me(i,s,{get:()=>e[s],enumerable:!(r=rt(e,s))||r.enumerable});return i};var qt=i=>zt(me({},"__esModule",{value:!0}),i),v=(i,e,t,r)=>{for(var s=r>1?void 0:r?rt(e,t):e,o=i.length-1,n;o>=0;o--)(n=i[o])&&(s=(r?n(e,t,s):n(s))||s);return r&&s&&me(e,t,s),s};var pr={};jt(pr,{WmcpCheckbox:()=>G,WmcpFormControl:()=>u,WmcpInput:()=>q,WmcpRadio:()=>X,WmcpRadioGroup:()=>D,WmcpSelect:()=>U,WmcpTextarea:()=>F,defineComponents:()=>Ue,exposeTool:()=>Ne,isStandardSchema:()=>Me,isWebMCPAvailable:()=>Nt,textFieldStyles:()=>k,validateStandard:()=>Pe});var it=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){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=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var T=function(i,e,t,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!s:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(i,t):s?s.value=t:e.set(i,t),t},E=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},J,ve,fe,ee,He,te,ge,H,re,N,_e,st;var S={__proto__:null};S.enumerable=!0;Object.freeze(S);var We=(N=class{constructor(e,t={}){if(J.set(this,!1),ve.set(this,!1),fe.set(this,!1),ee.set(this,!1),He.set(this,Date.now()),te.set(this,!1),ge.set(this,void 0),H.set(this,void 0),re.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 t!="object"||!t)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:s,composed:o}=t;T(this,J,!!s,"f"),T(this,ve,!!r,"f"),T(this,fe,!!o,"f"),T(this,ge,`${e}`,"f"),T(this,H,null,"f"),T(this,re,!1,"f")}initEvent(e,t,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){T(this,ee,!0,"f")}get target(){return E(this,H,"f")}get currentTarget(){return E(this,H,"f")}get srcElement(){return E(this,H,"f")}get type(){return E(this,ge,"f")}get cancelable(){return E(this,J,"f")}get defaultPrevented(){return E(this,J,"f")&&E(this,ee,"f")}get timeStamp(){return E(this,He,"f")}composedPath(){return E(this,re,"f")?[E(this,H,"f")]:[]}get returnValue(){return!E(this,J,"f")||!E(this,ee,"f")}get bubbles(){return E(this,ve,"f")}get composed(){return E(this,fe,"f")}get eventPhase(){return E(this,re,"f")?N.AT_TARGET:N.NONE}get cancelBubble(){return E(this,te,"f")}set cancelBubble(e){e&&T(this,te,!0,"f")}stopPropagation(){T(this,te,!0,"f")}get isTrusted(){return!1}},J=new WeakMap,ve=new WeakMap,fe=new WeakMap,ee=new WeakMap,He=new WeakMap,te=new WeakMap,ge=new WeakMap,H=new WeakMap,re=new WeakMap,N.NONE=0,N.CAPTURING_PHASE=1,N.AT_TARGET=2,N.BUBBLING_PHASE=3,N);Object.defineProperties(We.prototype,{initEvent:S,stopImmediatePropagation:S,preventDefault:S,target:S,currentTarget:S,srcElement:S,type:S,cancelable:S,defaultPrevented:S,timeStamp:S,composedPath:S,returnValue:S,bubbles:S,composed:S,eventPhase:S,cancelBubble:S,stopPropagation:S,isTrusted:S});var ot=(st=class extends We{constructor(e,t={}){super(e,t),_e.set(this,void 0),T(this,_e,t?.detail??null,"f")}initCustomEvent(e,t,r,s){throw new Error("Method not implemented.")}get detail(){return E(this,_e,"f")}},_e=new WeakMap,st);Object.defineProperties(ot.prototype,{detail:S});var R=We,Ve=ot;var $;var yr=($=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??=R;globalThis.CustomEvent??=Ve;var je=Symbol(),nt=i=>typeof i=="boolean"?i:i?.capture??!1,C={__proto__:null};C.enumerable=!0;Object.freeze(C);var be=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,r){if(t==null)return;let s=nt(r)?this.__captureEventListeners:this.__eventListeners,o=s.get(e);if(o===void 0)o=new Map,s.set(e,o);else if(o.has(t))return;let n=typeof r=="object"&&r?r:{};n.signal?.addEventListener("abort",()=>this.removeEventListener(e,t,r)),o.set(t,n??{})}removeEventListener(e,t,r){if(t==null)return;let s=nt(r)?this.__captureEventListeners:this.__eventListeners,o=s.get(e);o!==void 0&&(o.delete(t),o.size||s.delete(e))}dispatchEvent(e){let t=this.__resolveFullEventPath();!e.composed&&this.__host&&(t=t.slice(0,t.indexOf(this.__host)));let r=!1,s=!1,o=R.NONE,n=null,l=null,a=null,m=e.stopPropagation,b=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get(){return n??l},...C},srcElement:{get(){return e.target},...C},currentTarget:{get(){return a},...C},eventPhase:{get(){return o},...C},composedPath:{value:()=>t,...C},stopPropagation:{value:()=>{r=!0,m.call(e)},...C},stopImmediatePropagation:{value:()=>{s=!0,b.call(e)},...C}});let c=(g,A,Q)=>{typeof g=="function"?g(e):typeof g?.handleEvent=="function"&&g.handleEvent(e),A.once&&Q.delete(g)},p=()=>(a=null,o=R.NONE,!e.defaultPrevented),d=t.slice().reverse();n=!this.__host||!e.composed?this:null;let y=g=>{for(l=this;l.__host&&g.includes(l.__host);)l=l.__host};for(let g of d){!n&&(!l||l===g.__host)&&y(d.slice(d.indexOf(g))),a=g,o=g===e.target?R.AT_TARGET:R.CAPTURING_PHASE;let A=g.__captureEventListeners.get(e.type);if(A){for(let[Q,De]of A)if(c(Q,De,A),s)return p()}if(r)return p()}let w=e.bubbles?t:[this];l=null;for(let g of w){!n&&(!l||g===l.__host)&&y(w.slice(0,w.indexOf(g)+1)),a=g,o=g===e.target?R.AT_TARGET:R.BUBBLING_PHASE;let A=g.__eventListeners.get(e.type);if(A){for(let[Q,De]of A)if(c(Q,De,A),s)return p()}if(r)return p()}return p()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,ct,Jt]}};var at=new WeakMap,ie=i=>{let e=at.get(i);return e===void 0&&at.set(i,e=new Map),e},se=class extends be{getRootNode(e){return e?.composed?Be:this.__host?.__shadowRoot??Be}};var lt=class extends se{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var ct=new lt,Be=ct;var ht=class extends se{constructor(e){if(super(),e!==je)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:ye,customElements:qe,document:Be,Document:lt,Element:dt,EventTarget:be,HTMLElement:ut,Node:se,ShadowRoot:pt,window:this,Window:ht})}};var dt=class extends se{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(ie(this)).map(([e,t])=>({name:e,value:t}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){ie(this).set(e,String(t))}removeAttribute(e){ie(this).delete(e)}toggleAttribute(e,t){if(this.hasAttribute(e)){if(t===void 0||!t)return this.removeAttribute(e),!1}else return t===void 0||t?(this.setAttribute(e,""),!0):!1;return!0}hasAttribute(e){return ie(this).has(e)}attachShadow(e){this.__shadowRootMode=e.mode;let t=new pt(je,e);return t.__eventTargetParent=this,t.__host=this,this.__shadowRoot=t}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let e=new it(this);return this.__internals=e,e}getAttribute(e){return ie(this).get(e)??null}};var ut=class extends dt{},ze=ut;var pt=class extends se{get host(){return this.__host}constructor(e,t){if(super(),e!==e)throw new TypeError("Illegal constructor");this.mode=t.mode}};globalThis.litServerRoot??=Object.defineProperty(new ze,"localName",{get(){return"lit-server-root"}});function Ft(){let i,e;return{promise:new Promise((r,s)=>{i=r,e=s}),resolve:i,reject:e}}var ye=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(e,t){if(this.__definitions.has(e))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${e}" 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 "${e}" has already been used with this registry`);if(this.__reverseDefinitions.has(t))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(t)}`);t.__localName=e,this.__definitions.set(e,{ctor:t,observedAttributes:t.observedAttributes??[]}),this.__reverseDefinitions.set(t,e),this.__pendingWhenDefineds.get(e)?.resolve(t),this.__pendingWhenDefineds.delete(e)}get(e){return this.__definitions.get(e)?.ctor}getName(e){return this.__reverseDefinitions.get(e)??null}initialize(e){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(e){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(e){let t=this.__definitions.get(e);if(t)return t.ctor;let r=this.__pendingWhenDefineds.get(e);return r||(r=
|
|
1
|
+
"use strict";var webmcpui=(()=>{var me=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Bt=Object.prototype.hasOwnProperty;var jt=(s,e)=>{for(var t in e)me(s,t,{get:e[t],enumerable:!0})},zt=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vt(e))!Bt.call(s,i)&&i!==t&&me(s,i,{get:()=>e[i],enumerable:!(r=rt(e,i))||r.enumerable});return s};var qt=s=>zt(me({},"__esModule",{value:!0}),s),v=(s,e,t,r)=>{for(var i=r>1?void 0:r?rt(e,t):e,o=s.length-1,n;o>=0;o--)(n=s[o])&&(i=(r?n(e,t,i):n(i))||i);return r&&i&&me(e,t,i),i};var pr={};jt(pr,{WmcpCheckbox:()=>F,WmcpFormControl:()=>u,WmcpInput:()=>q,WmcpRadio:()=>X,WmcpRadioGroup:()=>D,WmcpSelect:()=>U,WmcpTextarea:()=>G,defineComponents:()=>Ue,exposeTool:()=>Ne,isStandardSchema:()=>Me,isWebMCPAvailable:()=>Nt,textFieldStyles:()=>k,validateStandard:()=>Pe});var st=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){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=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var T=function(s,e,t,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!i:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(s,t):i?i.value=t:e.set(s,t),t},E=function(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)},J,ve,fe,ee,He,te,ge,H,re,N,_e,it;var S={__proto__:null};S.enumerable=!0;Object.freeze(S);var We=(N=class{constructor(e,t={}){if(J.set(this,!1),ve.set(this,!1),fe.set(this,!1),ee.set(this,!1),He.set(this,Date.now()),te.set(this,!1),ge.set(this,void 0),H.set(this,void 0),re.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 t!="object"||!t)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:o}=t;T(this,J,!!i,"f"),T(this,ve,!!r,"f"),T(this,fe,!!o,"f"),T(this,ge,`${e}`,"f"),T(this,H,null,"f"),T(this,re,!1,"f")}initEvent(e,t,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){T(this,ee,!0,"f")}get target(){return E(this,H,"f")}get currentTarget(){return E(this,H,"f")}get srcElement(){return E(this,H,"f")}get type(){return E(this,ge,"f")}get cancelable(){return E(this,J,"f")}get defaultPrevented(){return E(this,J,"f")&&E(this,ee,"f")}get timeStamp(){return E(this,He,"f")}composedPath(){return E(this,re,"f")?[E(this,H,"f")]:[]}get returnValue(){return!E(this,J,"f")||!E(this,ee,"f")}get bubbles(){return E(this,ve,"f")}get composed(){return E(this,fe,"f")}get eventPhase(){return E(this,re,"f")?N.AT_TARGET:N.NONE}get cancelBubble(){return E(this,te,"f")}set cancelBubble(e){e&&T(this,te,!0,"f")}stopPropagation(){T(this,te,!0,"f")}get isTrusted(){return!1}},J=new WeakMap,ve=new WeakMap,fe=new WeakMap,ee=new WeakMap,He=new WeakMap,te=new WeakMap,ge=new WeakMap,H=new WeakMap,re=new WeakMap,N.NONE=0,N.CAPTURING_PHASE=1,N.AT_TARGET=2,N.BUBBLING_PHASE=3,N);Object.defineProperties(We.prototype,{initEvent:S,stopImmediatePropagation:S,preventDefault:S,target:S,currentTarget:S,srcElement:S,type:S,cancelable:S,defaultPrevented:S,timeStamp:S,composedPath:S,returnValue:S,bubbles:S,composed:S,eventPhase:S,cancelBubble:S,stopPropagation:S,isTrusted:S});var ot=(it=class extends We{constructor(e,t={}){super(e,t),_e.set(this,void 0),T(this,_e,t?.detail??null,"f")}initCustomEvent(e,t,r,i){throw new Error("Method not implemented.")}get detail(){return E(this,_e,"f")}},_e=new WeakMap,it);Object.defineProperties(ot.prototype,{detail:S});var R=We,Ve=ot;var $;var yr=($=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??=R;globalThis.CustomEvent??=Ve;var je=Symbol(),nt=s=>typeof s=="boolean"?s:s?.capture??!1,C={__proto__:null};C.enumerable=!0;Object.freeze(C);var be=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,r){if(t==null)return;let i=nt(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(e);if(o===void 0)o=new Map,i.set(e,o);else if(o.has(t))return;let n=typeof r=="object"&&r?r:{};n.signal?.addEventListener("abort",()=>this.removeEventListener(e,t,r)),o.set(t,n??{})}removeEventListener(e,t,r){if(t==null)return;let i=nt(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(e);o!==void 0&&(o.delete(t),o.size||i.delete(e))}dispatchEvent(e){let t=this.__resolveFullEventPath();!e.composed&&this.__host&&(t=t.slice(0,t.indexOf(this.__host)));let r=!1,i=!1,o=R.NONE,n=null,l=null,a=null,m=e.stopPropagation,b=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get(){return n??l},...C},srcElement:{get(){return e.target},...C},currentTarget:{get(){return a},...C},eventPhase:{get(){return o},...C},composedPath:{value:()=>t,...C},stopPropagation:{value:()=>{r=!0,m.call(e)},...C},stopImmediatePropagation:{value:()=>{i=!0,b.call(e)},...C}});let c=(g,A,Q)=>{typeof g=="function"?g(e):typeof g?.handleEvent=="function"&&g.handleEvent(e),A.once&&Q.delete(g)},p=()=>(a=null,o=R.NONE,!e.defaultPrevented),d=t.slice().reverse();n=!this.__host||!e.composed?this:null;let y=g=>{for(l=this;l.__host&&g.includes(l.__host);)l=l.__host};for(let g of d){!n&&(!l||l===g.__host)&&y(d.slice(d.indexOf(g))),a=g,o=g===e.target?R.AT_TARGET:R.CAPTURING_PHASE;let A=g.__captureEventListeners.get(e.type);if(A){for(let[Q,De]of A)if(c(Q,De,A),i)return p()}if(r)return p()}let w=e.bubbles?t:[this];l=null;for(let g of w){!n&&(!l||g===l.__host)&&y(w.slice(0,w.indexOf(g)+1)),a=g,o=g===e.target?R.AT_TARGET:R.BUBBLING_PHASE;let A=g.__eventListeners.get(e.type);if(A){for(let[Q,De]of A)if(c(Q,De,A),i)return p()}if(r)return p()}return p()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,ct,Jt]}};var at=new WeakMap,se=s=>{let e=at.get(s);return e===void 0&&at.set(s,e=new Map),e},ie=class extends be{getRootNode(e){return e?.composed?Be:this.__host?.__shadowRoot??Be}};var lt=class extends ie{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var ct=new lt,Be=ct;var ht=class extends ie{constructor(e){if(super(),e!==je)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:ye,customElements:qe,document:Be,Document:lt,Element:dt,EventTarget:be,HTMLElement:ut,Node:ie,ShadowRoot:pt,window:this,Window:ht})}};var dt=class extends ie{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(se(this)).map(([e,t])=>({name:e,value:t}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){se(this).set(e,String(t))}removeAttribute(e){se(this).delete(e)}toggleAttribute(e,t){if(this.hasAttribute(e)){if(t===void 0||!t)return this.removeAttribute(e),!1}else return t===void 0||t?(this.setAttribute(e,""),!0):!1;return!0}hasAttribute(e){return se(this).has(e)}attachShadow(e){this.__shadowRootMode=e.mode;let t=new pt(je,e);return t.__eventTargetParent=this,t.__host=this,this.__shadowRoot=t}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let e=new st(this);return this.__internals=e,e}getAttribute(e){return se(this).get(e)??null}};var ut=class extends dt{},ze=ut;var pt=class extends ie{get host(){return this.__host}constructor(e,t){if(super(),e!==e)throw new TypeError("Illegal constructor");this.mode=t.mode}};globalThis.litServerRoot??=Object.defineProperty(new ze,"localName",{get(){return"lit-server-root"}});function Gt(){let s,e;return{promise:new Promise((r,i)=>{s=r,e=i}),resolve:s,reject:e}}var ye=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(e,t){if(this.__definitions.has(e))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${e}" 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 "${e}" has already been used with this registry`);if(this.__reverseDefinitions.has(t))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(t)}`);t.__localName=e,this.__definitions.set(e,{ctor:t,observedAttributes:t.observedAttributes??[]}),this.__reverseDefinitions.set(t,e),this.__pendingWhenDefineds.get(e)?.resolve(t),this.__pendingWhenDefineds.delete(e)}get(e){return this.__definitions.get(e)?.ctor}getName(e){return this.__reverseDefinitions.get(e)??null}initialize(e){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(e){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(e){let t=this.__definitions.get(e);if(t)return t.ctor;let r=this.__pendingWhenDefineds.get(e);return r||(r=Gt(),this.__pendingWhenDefineds.set(e,r)),r.promise}},Ft=ye;var qe=new Ft,Jt=new ht(je);var oe=globalThis,Se=oe.ShadowRoot&&(oe.ShadyCSS===void 0||oe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ge=Symbol(),mt=new WeakMap,ne=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ge)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Se&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=mt.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&mt.set(t,e))}return e}toString(){return this.cssText}},vt=s=>new ne(typeof s=="string"?s:s+"",void 0,Ge),x=(s,...e)=>{let t=s.length===1?s[0]:e.reduce((r,i,o)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[o+1],s[0]);return new ne(t,s,Ge)},ft=(s,e)=>{if(Se)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=oe.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,s.appendChild(r)}},Fe=Se||oe.CSSStyleSheet===void 0?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return vt(t)})(s):s;var{is:Kt,defineProperty:Yt,getOwnPropertyDescriptor:Zt,getOwnPropertyNames:Xt,getOwnPropertySymbols:Qt,getPrototypeOf:er}=Object,ce=globalThis;ce.customElements??=qe;var gt=ce.trustedTypes,tr=gt?gt.emptyScript:"",rr=ce.reactiveElementPolyfillSupport,ae=(s,e)=>s,le={toAttribute(s,e){switch(e){case Boolean:s=s?tr:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},Ee=(s,e)=>!Kt(s,e),_t={attribute:!0,type:String,converter:le,reflect:!1,useDefault:!1,hasChanged:Ee};Symbol.metadata??=Symbol("metadata"),ce.litPropertyMetadata??=new WeakMap;var O=class extends(globalThis.HTMLElement??ze){static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_t){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Yt(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=Zt(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get:i,set(n){let l=i?.call(this);o?.call(this,n),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_t}static _$Ei(){if(this.hasOwnProperty(ae("elementProperties")))return;let e=er(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ae("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ae("properties"))){let t=this.properties,r=[...Xt(t),...Qt(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(Fe(i))}else e!==void 0&&t.push(Fe(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ft(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:le).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:le;this._$Em=i;let l=n.fromAttribute(t,o.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(e,t,r,i=!1,o){if(e!==void 0){let n=this.constructor;if(i===!1&&(o=this[e]),r??=n.getPropertyOptions(e),!((r.hasChanged??Ee)(o,t)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(n._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:o},n){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),o!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:n}=o,l=this[i];n!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,o,l)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};O.elementStyles=[],O.shadowRootOptions={mode:"open"},O[ae("elementProperties")]=new Map,O[ae("finalized")]=new Map,rr?.({ReactiveElement:O}),(ce.reactiveElementVersions??=[]).push("2.1.2");var Ce=globalThis,bt=s=>s,$e=Ce.trustedTypes,yt=$e?$e.createPolicy("lit-html",{createHTML:s=>s}):void 0,Ke="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,Ye="?"+P,sr=`<${Ye}>`,B=Ce.document===void 0?{createTreeWalker:()=>({})}:document,de=()=>B.createComment(""),ue=s=>s===null||typeof s!="object"&&typeof s!="function",Ze=Array.isArray,At=s=>Ze(s)||typeof s?.[Symbol.iterator]=="function",Je=`[
|
|
3
3
|
\f\r]`,he=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,St=/-->/g,Et=/>/g,W=RegExp(`>|${Je}(?:([^\\s"'>=/]+)(${Je}*=${Je}*(?:[^
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),$t=/'/g,xt=/"/g,Tt=/^(?:script|style|textarea|title)$/i,Xe=
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),$t=/'/g,xt=/"/g,Tt=/^(?:script|style|textarea|title)$/i,Xe=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),_=Xe(1),Qr=Xe(2),es=Xe(3),M=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),wt=new WeakMap,V=B.createTreeWalker(B,129);function Rt(s,e){if(!Ze(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return yt!==void 0?yt.createHTML(e):e}var Ct=(s,e)=>{let t=s.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",n=he;for(let l=0;l<t;l++){let a=s[l],m,b,c=-1,p=0;for(;p<a.length&&(n.lastIndex=p,b=n.exec(a),b!==null);)p=n.lastIndex,n===he?b[1]==="!--"?n=St:b[1]!==void 0?n=Et:b[2]!==void 0?(Tt.test(b[2])&&(i=RegExp("</"+b[2],"g")),n=W):b[3]!==void 0&&(n=W):n===W?b[0]===">"?(n=i??he,c=-1):b[1]===void 0?c=-2:(c=n.lastIndex-b[2].length,m=b[1],n=b[3]===void 0?W:b[3]==='"'?xt:$t):n===xt||n===$t?n=W:n===St||n===Et?n=he:(n=W,i=void 0);let d=n===W&&s[l+1].startsWith("/>")?" ":"";o+=n===he?a+sr:c>=0?(r.push(m),a.slice(0,c)+Ke+a.slice(c)+P+d):a+P+(c===-2?l:d)}return[Rt(s,o+(s[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},pe=class s{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,n=0,l=e.length-1,a=this.parts,[m,b]=Ct(e,t);if(this.el=s.createElement(m,r),V.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=V.nextNode())!==null&&a.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(let c of i.getAttributeNames())if(c.endsWith(Ke)){let p=b[n++],d=i.getAttribute(c).split(P),y=/([.?@])?(.*)/.exec(p);a.push({type:1,index:o,name:y[2],strings:d,ctor:y[1]==="."?we:y[1]==="?"?Ae:y[1]==="@"?Te:z}),i.removeAttribute(c)}else c.startsWith(P)&&(a.push({type:6,index:o}),i.removeAttribute(c));if(Tt.test(i.tagName)){let c=i.textContent.split(P),p=c.length-1;if(p>0){i.textContent=$e?$e.emptyScript:"";for(let d=0;d<p;d++)i.append(c[d],de()),V.nextNode(),a.push({type:2,index:++o});i.append(c[p],de())}}}else if(i.nodeType===8)if(i.data===Ye)a.push({type:2,index:o});else{let c=-1;for(;(c=i.data.indexOf(P,c+1))!==-1;)a.push({type:7,index:o}),c+=P.length-1}o++}}static createElement(e,t){let r=B.createElement("template");return r.innerHTML=e,r}};function j(s,e,t=s,r){if(e===M)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=ue(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(s),i._$AT(s,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=j(s,i._$AS(s,e.values),i,r)),e}var xe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??B).importNode(t,!0);V.currentNode=i;let o=V.nextNode(),n=0,l=0,a=r[0];for(;a!==void 0;){if(n===a.index){let m;a.type===2?m=new K(o,o.nextSibling,this,e):a.type===1?m=new a.ctor(o,a.name,a.strings,this,e):a.type===6&&(m=new Re(o,this,e)),this._$AV.push(m),a=r[++l]}n!==a?.index&&(o=V.nextNode(),n++)}return V.currentNode=B,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},K=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=j(this,e,t),ue(e)?e===h||e==null||e===""?(this._$AH!==h&&this._$AR(),this._$AH=h):e!==this._$AH&&e!==M&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):At(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==h&&ue(this._$AH)?this._$AA.nextSibling.data=e:this.T(B.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=pe.createElement(Rt(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new xe(i,this),n=o.u(this.options);o.p(t),this.T(n),this._$AH=o}}_$AC(e){let t=wt.get(e.strings);return t===void 0&&wt.set(e.strings,t=new pe(e)),t}k(e){Ze(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new s(this.O(de()),this.O(de()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=bt(e).nextSibling;bt(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},z=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=h,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=h}_$AI(e,t=this,r,i){let o=this.strings,n=!1;if(o===void 0)e=j(this,e,t,0),n=!ue(e)||e!==this._$AH&&e!==M,n&&(this._$AH=e);else{let l=e,a,m;for(e=o[0],a=0;a<o.length-1;a++)m=j(this,l[r+a],t,a),m===M&&(m=this._$AH[a]),n||=!ue(m)||m!==this._$AH[a],m===h?e=h:e!==h&&(e+=(m??"")+o[a+1]),this._$AH[a]=m}n&&!i&&this.j(e)}j(e){e===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},we=class extends z{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===h?void 0:e}},Ae=class extends z{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==h)}},Te=class extends z{constructor(e,t,r,i,o){super(e,t,r,i,o),this.type=5}_$AI(e,t=this){if((e=j(this,e,t,0)??h)===M)return;let r=this._$AH,i=e===h&&r!==h||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==h&&(r===h||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Re=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){j(this,e)}},Ot={M:Ke,P,A:Ye,C:1,L:Ct,R:xe,D:At,V:j,I:K,H:z,N:Ae,U:Te,B:we,F:Re},ir=Ce.litHtmlPolyfillSupport;ir?.(pe,K),(Ce.litHtmlVersions??=[]).push("3.3.3");var Pt=(s,e,t)=>{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let o=t?.renderBefore??null;r._$litPart$=i=new K(e.insertBefore(de(),o),o,void 0,t??{})}return i._$AI(s),i};var Qe=globalThis,L=class extends O{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Pt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return M}};L._$litElement$=!0,L.finalized=!0,Qe.litElementHydrateSupport?.({LitElement:L});var or=Qe.litElementPolyfillSupport;or?.({LitElement:L});(Qe.litElementVersions??=[]).push("4.2.2");var nr={attribute:!0,type:String,converter:le,reflect:!1,hasChanged:Ee},ar=(s=nr,e,t)=>{let{kind:r,metadata:i}=t,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),r==="setter"&&((s=Object.create(s)).wrapped=!0),o.set(t.name,s),r==="accessor"){let{name:n}=t;return{set(l){let a=e.get.call(this);e.set.call(this,l),this.requestUpdate(n,a,s,!0,l)},init(l){return l!==void 0&&this.C(n,void 0,s,l),l}}}if(r==="setter"){let{name:n}=t;return function(l){let a=this[n];e.call(this,l),this.requestUpdate(n,a,s,!0,l)}}throw Error("Unsupported decorator location: "+r)};function f(s){return(e,t)=>typeof t=="object"?ar(s,e,t):((r,i,o)=>{let n=i.hasOwnProperty(o);return i.constructor.createProperty(o,r),n?Object.getOwnPropertyDescriptor(i,o):void 0})(s,e,t)}function Y(s){return f({...s,state:!0,attribute:!1})}async function Pe(s,e){let t=await s["~standard"].validate(e);return t.issues?{valid:!1,errors:t.issues.map(r=>r.message)}:{valid:!0,value:t.value,errors:[]}}function Me(s){return typeof s=="object"&&s!==null&&"~standard"in s&&typeof s["~standard"]?.validate=="function"}function Mt(){let s=typeof document<"u"?document.modelContext:void 0,e=typeof navigator<"u"?navigator.modelContext:void 0,t=s??e;return t&&typeof t.registerTool=="function"?t:void 0}function Nt(){return Mt()!==void 0}var lr=globalThis.process?.env?.NODE_ENV!=="production",et=new Set;function Ne(s){let e=Mt();if(!e?.registerTool)return()=>{};let t={name:s.name,description:s.description,inputSchema:s.inputSchema??{type:"object",properties:{}},execute:s.execute};lr&&et.has(t.name)&&console.warn(`[webmcpui] A WebMCP tool named "${t.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\`.`),et.add(t.name);let r=typeof AbortController=="function"?new AbortController:void 0,i=e.registerTool(t,r?{signal:r.signal}:void 0),o=!1;return()=>{if(!o){o=!0,et.delete(t.name);try{r?.abort(),i&&typeof i.unregister=="function"?i.unregister():typeof e.unregisterTool=="function"&&e.unregisterTool(s.name)}catch{}}}}var k=x`
|
|
5
5
|
.control {
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
width: 100%;
|
|
@@ -74,7 +74,7 @@ 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),this.expose&&this.registerTool()}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),this.toolDisposer(),this.toolDisposer=()=>{}}updated(t){this.syncFormValue(),this.expose&&(t.has("expose")||t.has("name")||t.has("toolName")||t.has("toolDescription"))&&this.registerTool()}get resolvedToolName(){return this.toolName||`fill_${this.name||this.controlNoun}`}registerTool(){this.toolDisposer();let t=this.label||this.name||this.controlNoun;this.toolDisposer=Ne({name:this.resolvedToolName,description:this.toolDescription||`Set the value of the "${t}" field.`,inputSchema:this.toolInputSchema(),execute:async r=>(await this.applyAgentValue(r),{content:[{type:"text",text:this.error?`Set "${t}" but validation failed: ${this.error}`:`Set "${t}" to "${this.stateDescription()}".`}],isError:!!this.error})})}async applyAgentValue(t){let r=t.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(t){this.value=t,await this.validate(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}async onInput(t){this.value=t.target.value,await this.validate()}async computeValidity(){if(this.required&&this.isEmpty)return{valid:!1,message:this.requiredMessage||this.requiredMessageDefault,flags:{valueMissing:!0}};if(Me(this.schema)){let t=await Pe(this.schema,this.validationValue);if(!t.valid)return{valid:!1,message:t.errors[0]??"Invalid value",flags:{customError:!0}}}return{valid:!0,message:"",flags:{}}}async validate(t=!0){let{valid:r,message:
|
|
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),this.expose&&this.registerTool()}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),this.toolDisposer(),this.toolDisposer=()=>{}}updated(t){this.syncFormValue(),this.expose&&(t.has("expose")||t.has("name")||t.has("toolName")||t.has("toolDescription"))&&this.registerTool()}get resolvedToolName(){return this.toolName||`fill_${this.name||this.controlNoun}`}registerTool(){this.toolDisposer();let t=this.label||this.name||this.controlNoun;this.toolDisposer=Ne({name:this.resolvedToolName,description:this.toolDescription||`Set the value of the "${t}" field.`,inputSchema:this.toolInputSchema(),execute:async r=>(await this.applyAgentValue(r),{content:[{type:"text",text:this.error?`Set "${t}" but validation failed: ${this.error}`:`Set "${t}" to "${this.stateDescription()}".`}],isError:!!this.error})})}async applyAgentValue(t){let r=t.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(t){this.value=t,await this.validate(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}async onInput(t){this.value=t.target.value,await this.validate()}async computeValidity(){if(this.required&&this.isEmpty)return{valid:!1,message:this.requiredMessage||this.requiredMessageDefault,flags:{valueMissing:!0}};if(Me(this.schema)){let t=await Pe(this.schema,this.validationValue);if(!t.valid)return{valid:!1,message:t.errors[0]??"Invalid value",flags:{customError:!0}}}return{valid:!0,message:"",flags:{}}}async validate(t=!0){let{valid:r,message:i,flags:o}=await this.computeValidity();return r?this.internals.setValidity({}):this.internals.setValidity(o,i,this.control??void 0),t&&(this.error=r?"":i,this.toggleAttribute("invalid",!r)),r}formResetCallback(){this.value="",this.error="",this.toggleAttribute("invalid",!1),this.validate(!1)}renderMessage(){return this.error?_`<span id="wmcp-error" class="message error" role="alert"
|
|
78
78
|
>${this.error}</span
|
|
79
79
|
>`:this.helperText?_`<span id="wmcp-helper" class="message helper"
|
|
80
80
|
>${this.helperText}</span
|
|
@@ -100,7 +100,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
100
100
|
aria-describedby=${this.describedBy??h}
|
|
101
101
|
@input=${this.onInput}
|
|
102
102
|
/>
|
|
103
|
-
`}};v([f()],q.prototype,"type",2);var
|
|
103
|
+
`}};v([f()],q.prototype,"type",2);var G=class extends u{constructor(){super(...arguments);this.rows=3}static{this.tagName="wmcp-textarea"}static{this.styles=[u.styles,k,x`
|
|
104
104
|
.control {
|
|
105
105
|
min-height: var(--textarea-min-height, 4.5rem);
|
|
106
106
|
resize: vertical;
|
|
@@ -119,7 +119,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
119
119
|
aria-describedby=${this.describedBy??h}
|
|
120
120
|
@input=${this.onInput}
|
|
121
121
|
></textarea>
|
|
122
|
-
`}};v([f({type:Number})],
|
|
122
|
+
`}};v([f({type:Number})],G.prototype,"rows",2);var Lt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},kt=s=>(...e)=>({_$litDirective$:s,values:e}),Le=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:cr}=Ot,It=s=>s;var Ut=()=>document.createComment(""),Z=(s,e,t)=>{let r=s._$AA.parentNode,i=e===void 0?s._$AB:e._$AA;if(t===void 0){let o=r.insertBefore(Ut(),i),n=r.insertBefore(Ut(),i);t=new cr(o,n,s,s.options)}else{let o=t._$AB.nextSibling,n=t._$AM,l=n!==s;if(l){let a;t._$AQ?.(s),t._$AM=s,t._$AP!==void 0&&(a=s._$AU)!==n._$AU&&t._$AP(a)}if(o!==i||l){let a=t._$AA;for(;a!==o;){let m=It(a).nextSibling;It(r).insertBefore(a,i),a=m}}}return t},I=(s,e,t=s)=>(s._$AI(e,t),s),hr={},Dt=(s,e=hr)=>s._$AH=e,Ht=s=>s._$AH,ke=s=>{s._$AR(),s._$AA.remove()};var Wt=(s,e,t)=>{let r=new Map;for(let i=e;i<=t;i++)r.set(s[i],i);return r},Ie=kt(class extends Le{constructor(s){if(super(s),s.type!==Lt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let i=[],o=[],n=0;for(let l of s)i[n]=r?r(l,n):n,o[n]=t(l,n),n++;return{values:o,keys:i}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,r]){let i=Ht(s),{values:o,keys:n}=this.dt(e,t,r);if(!Array.isArray(i))return this.ut=n,o;let l=this.ut??=[],a=[],m,b,c=0,p=i.length-1,d=0,y=o.length-1;for(;c<=p&&d<=y;)if(i[c]===null)c++;else if(i[p]===null)p--;else if(l[c]===n[d])a[d]=I(i[c],o[d]),c++,d++;else if(l[p]===n[y])a[y]=I(i[p],o[y]),p--,y--;else if(l[c]===n[y])a[y]=I(i[c],o[y]),Z(s,a[y+1],i[c]),c++,y--;else if(l[p]===n[d])a[d]=I(i[p],o[d]),Z(s,i[c],i[p]),p--,d++;else if(m===void 0&&(m=Wt(n,d,y),b=Wt(l,c,p)),m.has(l[c]))if(m.has(l[p])){let w=b.get(n[d]),g=w!==void 0?i[w]:null;if(g===null){let A=Z(s,i[c]);I(A,o[d]),a[d]=A}else a[d]=I(g,o[d]),Z(s,i[c],g),i[w]=null;d++}else ke(i[p]),p--;else ke(i[c]),c++;for(;d<=y;){let w=Z(s,a[y+1]);I(w,o[d]),a[d++]=w}for(;c<=p;){let w=i[c++];w!==null&&ke(w)}return this.ut=n,Dt(s,a),M}});function tt(s){return Array.isArray(s.options)}var U=class extends u{constructor(){super(...arguments);this.options=[];this.resolvedOptions=[]}static{this.tagName="wmcp-select"}static{this.styles=[u.styles,k,x`
|
|
123
123
|
.control {
|
|
124
124
|
height: var(--input-height-md, 2.25rem);
|
|
125
125
|
cursor: pointer;
|
|
@@ -127,7 +127,7 @@ 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(t){t.has("options")&&this.syncOptions()}updated(t){super.updated(t),this.expose&&t.has("resolvedOptions")&&this.registerTool()}syncOptions(){this.resolvedOptions=this.options.length>0?this.options:this.readDeclarativeOptions()}readDeclarativeOptions(){let t=
|
|
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(t){t.has("options")&&this.syncOptions()}updated(t){super.updated(t),this.expose&&t.has("resolvedOptions")&&this.registerTool()}syncOptions(){this.resolvedOptions=this.options.length>0?this.options:this.readDeclarativeOptions()}readDeclarativeOptions(){let t=i=>({value:i.value,label:i.textContent?.trim()||i.value,disabled:i.disabled}),r=[];for(let i of Array.from(this.children))i instanceof HTMLOptGroupElement?r.push({label:i.label,options:Array.from(i.querySelectorAll("option")).map(t)}):i instanceof HTMLOptionElement&&r.push(t(i));return r}flatOptions(){return this.resolvedOptions.flatMap(t=>tt(t)?t.options:[t])}toolInputSchema(){return{type:"object",properties:{value:{type:"string",enum:this.flatOptions().map(t=>t.value),description:this.label||this.name||"The option value to select."}},required:["value"]}}renderOption(t){return _`<option
|
|
131
131
|
value=${t.value}
|
|
132
132
|
?disabled=${t.disabled??!1}
|
|
133
133
|
?selected=${t.value===this.value}
|
|
@@ -151,7 +151,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
151
151
|
${t.options.map(r=>this.renderOption(r))}
|
|
152
152
|
</optgroup>`:this.renderOption(t))}
|
|
153
153
|
</select>
|
|
154
|
-
`}};v([f({attribute:!1})],U.prototype,"options",2),v([Y()],U.prototype,"resolvedOptions",2);var
|
|
154
|
+
`}};v([f({attribute:!1})],U.prototype,"options",2),v([Y()],U.prototype,"resolvedOptions",2);var F=class extends u{constructor(){super();this.checked=!1;this.defaultChecked=!1;this.value="on"}static{this.tagName="wmcp-checkbox"}static{this.styles=[u.styles,x`
|
|
155
155
|
.row {
|
|
156
156
|
display: inline-flex;
|
|
157
157
|
align-items: center;
|
|
@@ -203,7 +203,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
203
203
|
${this.label?_`<span class="label-text">${this.label}</span>`:h}
|
|
204
204
|
</label>
|
|
205
205
|
${this.renderMessage()}
|
|
206
|
-
`}};v([f({type:Boolean,reflect:!0})],
|
|
206
|
+
`}};v([f({type:Boolean,reflect:!0})],F.prototype,"checked",2);var dr=0,X=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"}},D=class extends u{constructor(){super(...arguments);this.options=[];this.resolvedOptions=[];this.groupName=`wmcp-radio-${++dr}`}static{this.tagName="wmcp-radio-group"}static{this.styles=[u.styles,x`
|
|
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);
|
|
@@ -274,7 +274,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
274
274
|
${this.label?_`<span id="group-label" class="group-label">${this.label}</span>`:h}
|
|
275
275
|
${this.renderControl()}
|
|
276
276
|
${this.renderMessage()}
|
|
277
|
-
`}};v([f({attribute:!1})],D.prototype,"options",2),v([Y()],D.prototype,"resolvedOptions",2);var ur=[q,
|
|
277
|
+
`}};v([f({attribute:!1})],D.prototype,"options",2),v([Y()],D.prototype,"resolvedOptions",2);var ur=[q,G,U,F,X,D];function Ue(){if(!(typeof customElements>"u"))for(let s of ur)customElements.get(s.tagName)||customElements.define(s.tagName,s)}Ue();return qt(pr);})();
|
|
278
278
|
/*! Bundled license information:
|
|
279
279
|
|
|
280
280
|
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webmcpui/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Framework-agnostic WebMCP-native custom elements. Form primitives with Standard Schema validation and imperative WebMCP tool exposure.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Gary Pfaff (Pfaff Digital)",
|