@webmcpui/core 0.2.0 → 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/README.md +46 -24
- 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/index.js
CHANGED
|
@@ -2096,6 +2096,8 @@ var WmcpPopover = class extends WmcpAction {
|
|
|
2096
2096
|
this.trigger = "click";
|
|
2097
2097
|
}
|
|
2098
2098
|
static {
|
|
2099
|
+
// Typed `string` (not the narrow literal) so subclasses like <wmcp-tooltip>
|
|
2100
|
+
// can override it.
|
|
2099
2101
|
this.tagName = "wmcp-popover";
|
|
2100
2102
|
}
|
|
2101
2103
|
static {
|
|
@@ -2556,6 +2558,511 @@ __decorateClass([
|
|
|
2556
2558
|
state6()
|
|
2557
2559
|
], WmcpToast.prototype, "toasts", 2);
|
|
2558
2560
|
|
|
2561
|
+
// src/elements/switch.ts
|
|
2562
|
+
import {
|
|
2563
|
+
html as html13,
|
|
2564
|
+
css as css13,
|
|
2565
|
+
nothing as nothing12
|
|
2566
|
+
} from "lit";
|
|
2567
|
+
import { property as property15 } from "lit/decorators.js";
|
|
2568
|
+
var WmcpSwitch = class extends WmcpFormControl {
|
|
2569
|
+
constructor() {
|
|
2570
|
+
super();
|
|
2571
|
+
this.checked = false;
|
|
2572
|
+
this.defaultChecked = false;
|
|
2573
|
+
this.value = "on";
|
|
2574
|
+
}
|
|
2575
|
+
static {
|
|
2576
|
+
this.tagName = "wmcp-switch";
|
|
2577
|
+
}
|
|
2578
|
+
static {
|
|
2579
|
+
this.styles = [
|
|
2580
|
+
WmcpFormControl.styles,
|
|
2581
|
+
css13`
|
|
2582
|
+
.row {
|
|
2583
|
+
display: inline-flex;
|
|
2584
|
+
align-items: center;
|
|
2585
|
+
gap: var(--input-gap-icon, 0.5rem);
|
|
2586
|
+
cursor: pointer;
|
|
2587
|
+
font-weight: 400;
|
|
2588
|
+
}
|
|
2589
|
+
.row:has(.control:disabled) {
|
|
2590
|
+
cursor: not-allowed;
|
|
2591
|
+
color: var(--input-text-disabled, var(--muted-foreground, oklch(0.556 0 0)));
|
|
2592
|
+
}
|
|
2593
|
+
.control {
|
|
2594
|
+
appearance: none;
|
|
2595
|
+
box-sizing: border-box;
|
|
2596
|
+
position: relative;
|
|
2597
|
+
flex-shrink: 0;
|
|
2598
|
+
width: var(--switch-width, 2.25rem);
|
|
2599
|
+
height: var(--switch-height, 1.35rem);
|
|
2600
|
+
margin: 0;
|
|
2601
|
+
padding: 0;
|
|
2602
|
+
border-radius: 999px;
|
|
2603
|
+
background: var(--switch-track, var(--input, oklch(0.922 0 0)));
|
|
2604
|
+
cursor: inherit;
|
|
2605
|
+
transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
2606
|
+
}
|
|
2607
|
+
.control::before {
|
|
2608
|
+
content: '';
|
|
2609
|
+
position: absolute;
|
|
2610
|
+
top: 50%;
|
|
2611
|
+
left: var(--switch-gap, 0.15rem);
|
|
2612
|
+
width: var(--switch-thumb, 1.05rem);
|
|
2613
|
+
height: var(--switch-thumb, 1.05rem);
|
|
2614
|
+
border-radius: 50%;
|
|
2615
|
+
background: var(--switch-thumb-color, var(--background, oklch(1 0 0)));
|
|
2616
|
+
translate: 0 -50%;
|
|
2617
|
+
transition: translate 150ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
2618
|
+
box-shadow: 0 1px 2px color-mix(in oklch, oklch(0 0 0) 25%, transparent);
|
|
2619
|
+
}
|
|
2620
|
+
.control:checked {
|
|
2621
|
+
background: var(--switch-track-on, var(--primary, oklch(0.205 0 0)));
|
|
2622
|
+
}
|
|
2623
|
+
.control:checked::before {
|
|
2624
|
+
translate: calc(var(--switch-width, 2.25rem) - var(--switch-thumb, 1.05rem) - var(--switch-gap, 0.15rem) * 2) -50%;
|
|
2625
|
+
}
|
|
2626
|
+
.control:focus-visible {
|
|
2627
|
+
outline: none;
|
|
2628
|
+
box-shadow: 0 0 0 var(--ring-width, 3px)
|
|
2629
|
+
color-mix(in oklch, var(--ring, oklch(0.708 0 0)) 40%, transparent);
|
|
2630
|
+
}
|
|
2631
|
+
.control:disabled {
|
|
2632
|
+
opacity: 0.5;
|
|
2633
|
+
}
|
|
2634
|
+
.label-text {
|
|
2635
|
+
font-size: var(--input-font-size, 0.875rem);
|
|
2636
|
+
color: var(--input-text, var(--foreground, oklch(0.145 0 0)));
|
|
2637
|
+
}
|
|
2638
|
+
`
|
|
2639
|
+
];
|
|
2640
|
+
}
|
|
2641
|
+
get controlNoun() {
|
|
2642
|
+
return "switch";
|
|
2643
|
+
}
|
|
2644
|
+
connectedCallback() {
|
|
2645
|
+
this.defaultChecked = this.checked;
|
|
2646
|
+
super.connectedCallback();
|
|
2647
|
+
}
|
|
2648
|
+
getFormValue() {
|
|
2649
|
+
return this.checked ? this.value : null;
|
|
2650
|
+
}
|
|
2651
|
+
get validationValue() {
|
|
2652
|
+
return this.checked;
|
|
2653
|
+
}
|
|
2654
|
+
get isEmpty() {
|
|
2655
|
+
return !this.checked;
|
|
2656
|
+
}
|
|
2657
|
+
get requiredMessageDefault() {
|
|
2658
|
+
return "Please turn this on.";
|
|
2659
|
+
}
|
|
2660
|
+
toolInputSchema() {
|
|
2661
|
+
return {
|
|
2662
|
+
type: "object",
|
|
2663
|
+
properties: {
|
|
2664
|
+
checked: {
|
|
2665
|
+
type: "boolean",
|
|
2666
|
+
description: this.label || this.name || "Whether the switch is on."
|
|
2667
|
+
}
|
|
2668
|
+
},
|
|
2669
|
+
required: ["checked"]
|
|
2670
|
+
};
|
|
2671
|
+
}
|
|
2672
|
+
async applyAgentValue(args) {
|
|
2673
|
+
this.checked = Boolean(args.checked);
|
|
2674
|
+
await this.validate();
|
|
2675
|
+
this.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
2676
|
+
this.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
2677
|
+
}
|
|
2678
|
+
stateDescription() {
|
|
2679
|
+
return this.checked ? "on" : "off";
|
|
2680
|
+
}
|
|
2681
|
+
formResetCallback() {
|
|
2682
|
+
this.checked = this.defaultChecked;
|
|
2683
|
+
this.error = "";
|
|
2684
|
+
this.toggleAttribute("invalid", false);
|
|
2685
|
+
void this.validate(false);
|
|
2686
|
+
}
|
|
2687
|
+
async onToggle(event) {
|
|
2688
|
+
this.checked = event.target.checked;
|
|
2689
|
+
await this.validate();
|
|
2690
|
+
}
|
|
2691
|
+
renderControl() {
|
|
2692
|
+
return html13`
|
|
2693
|
+
<input
|
|
2694
|
+
id="control"
|
|
2695
|
+
class="control"
|
|
2696
|
+
part="control"
|
|
2697
|
+
type="checkbox"
|
|
2698
|
+
role="switch"
|
|
2699
|
+
.checked=${this.checked}
|
|
2700
|
+
?required=${this.required}
|
|
2701
|
+
?disabled=${this.disabled}
|
|
2702
|
+
aria-invalid=${this.error ? "true" : "false"}
|
|
2703
|
+
aria-describedby=${this.describedBy ?? nothing12}
|
|
2704
|
+
@change=${this.onToggle}
|
|
2705
|
+
/>
|
|
2706
|
+
`;
|
|
2707
|
+
}
|
|
2708
|
+
render() {
|
|
2709
|
+
return html13`
|
|
2710
|
+
<label class="row">
|
|
2711
|
+
${this.renderControl()}
|
|
2712
|
+
${this.label ? html13`<span class="label-text">${this.label}</span>` : nothing12}
|
|
2713
|
+
</label>
|
|
2714
|
+
${this.renderMessage()}
|
|
2715
|
+
`;
|
|
2716
|
+
}
|
|
2717
|
+
};
|
|
2718
|
+
__decorateClass([
|
|
2719
|
+
property15({ type: Boolean, reflect: true })
|
|
2720
|
+
], WmcpSwitch.prototype, "checked", 2);
|
|
2721
|
+
|
|
2722
|
+
// src/elements/badge.ts
|
|
2723
|
+
import { LitElement as LitElement3, html as html14, css as css14 } from "lit";
|
|
2724
|
+
import { property as property16 } from "lit/decorators.js";
|
|
2725
|
+
var WmcpBadge = class extends LitElement3 {
|
|
2726
|
+
constructor() {
|
|
2727
|
+
super(...arguments);
|
|
2728
|
+
this.variant = "primary";
|
|
2729
|
+
}
|
|
2730
|
+
static {
|
|
2731
|
+
this.tagName = "wmcp-badge";
|
|
2732
|
+
}
|
|
2733
|
+
static {
|
|
2734
|
+
this.styles = css14`
|
|
2735
|
+
:host {
|
|
2736
|
+
display: inline-flex;
|
|
2737
|
+
align-items: center;
|
|
2738
|
+
gap: var(--badge-gap, 0.25rem);
|
|
2739
|
+
padding: var(--badge-padding, 0.125rem 0.5rem);
|
|
2740
|
+
font-family: var(--badge-font-family, ui-sans-serif, system-ui, sans-serif);
|
|
2741
|
+
font-size: var(--badge-font-size, 0.75rem);
|
|
2742
|
+
font-weight: var(--badge-font-weight, 500);
|
|
2743
|
+
line-height: 1.2;
|
|
2744
|
+
border: 1px solid transparent;
|
|
2745
|
+
border-radius: var(--badge-radius, 999px);
|
|
2746
|
+
white-space: nowrap;
|
|
2747
|
+
}
|
|
2748
|
+
:host([hidden]) {
|
|
2749
|
+
display: none;
|
|
2750
|
+
}
|
|
2751
|
+
:host {
|
|
2752
|
+
color: var(--badge-primary-text, var(--primary-foreground, oklch(0.985 0 0)));
|
|
2753
|
+
background: var(--badge-primary-bg, var(--primary, oklch(0.205 0 0)));
|
|
2754
|
+
}
|
|
2755
|
+
:host([variant='secondary']) {
|
|
2756
|
+
color: var(--badge-secondary-text, var(--secondary-foreground, oklch(0.205 0 0)));
|
|
2757
|
+
background: var(--badge-secondary-bg, var(--secondary, oklch(0.97 0 0)));
|
|
2758
|
+
}
|
|
2759
|
+
:host([variant='destructive']) {
|
|
2760
|
+
color: var(--badge-destructive-text, var(--destructive-foreground, oklch(0.985 0 0)));
|
|
2761
|
+
background: var(--badge-destructive-bg, var(--destructive, oklch(0.577 0.245 27.325)));
|
|
2762
|
+
}
|
|
2763
|
+
:host([variant='outline']) {
|
|
2764
|
+
color: var(--badge-outline-text, var(--foreground, oklch(0.145 0 0)));
|
|
2765
|
+
border-color: var(--badge-outline-border, var(--border, oklch(0.922 0 0)));
|
|
2766
|
+
}
|
|
2767
|
+
`;
|
|
2768
|
+
}
|
|
2769
|
+
render() {
|
|
2770
|
+
return html14`<slot></slot>`;
|
|
2771
|
+
}
|
|
2772
|
+
};
|
|
2773
|
+
__decorateClass([
|
|
2774
|
+
property16({ reflect: true })
|
|
2775
|
+
], WmcpBadge.prototype, "variant", 2);
|
|
2776
|
+
|
|
2777
|
+
// src/elements/separator.ts
|
|
2778
|
+
import { LitElement as LitElement4, css as css15 } from "lit";
|
|
2779
|
+
import { property as property17 } from "lit/decorators.js";
|
|
2780
|
+
var WmcpSeparator = class extends LitElement4 {
|
|
2781
|
+
constructor() {
|
|
2782
|
+
super(...arguments);
|
|
2783
|
+
this.orientation = "horizontal";
|
|
2784
|
+
}
|
|
2785
|
+
static {
|
|
2786
|
+
this.tagName = "wmcp-separator";
|
|
2787
|
+
}
|
|
2788
|
+
static {
|
|
2789
|
+
this.styles = css15`
|
|
2790
|
+
:host {
|
|
2791
|
+
display: block;
|
|
2792
|
+
background: var(--separator-color, var(--border, oklch(0.922 0 0)));
|
|
2793
|
+
border: 0;
|
|
2794
|
+
flex-shrink: 0;
|
|
2795
|
+
}
|
|
2796
|
+
:host([hidden]) {
|
|
2797
|
+
display: none;
|
|
2798
|
+
}
|
|
2799
|
+
:host([orientation='horizontal']) {
|
|
2800
|
+
width: 100%;
|
|
2801
|
+
height: var(--separator-size, 1px);
|
|
2802
|
+
}
|
|
2803
|
+
:host([orientation='vertical']) {
|
|
2804
|
+
width: var(--separator-size, 1px);
|
|
2805
|
+
height: 100%;
|
|
2806
|
+
align-self: stretch;
|
|
2807
|
+
}
|
|
2808
|
+
`;
|
|
2809
|
+
}
|
|
2810
|
+
connectedCallback() {
|
|
2811
|
+
super.connectedCallback();
|
|
2812
|
+
this.setAttribute("role", "separator");
|
|
2813
|
+
if (this.orientation === "vertical") {
|
|
2814
|
+
this.setAttribute("aria-orientation", "vertical");
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
};
|
|
2818
|
+
__decorateClass([
|
|
2819
|
+
property17({ reflect: true })
|
|
2820
|
+
], WmcpSeparator.prototype, "orientation", 2);
|
|
2821
|
+
|
|
2822
|
+
// src/elements/tooltip.ts
|
|
2823
|
+
var WmcpTooltip = class extends WmcpPopover {
|
|
2824
|
+
static {
|
|
2825
|
+
this.tagName = "wmcp-tooltip";
|
|
2826
|
+
}
|
|
2827
|
+
constructor() {
|
|
2828
|
+
super();
|
|
2829
|
+
this.trigger = "hover";
|
|
2830
|
+
}
|
|
2831
|
+
get defaultNameSuffix() {
|
|
2832
|
+
return "tooltip";
|
|
2833
|
+
}
|
|
2834
|
+
};
|
|
2835
|
+
|
|
2836
|
+
// src/elements/alert.ts
|
|
2837
|
+
import {
|
|
2838
|
+
LitElement as LitElement5,
|
|
2839
|
+
html as html15,
|
|
2840
|
+
css as css16,
|
|
2841
|
+
nothing as nothing13
|
|
2842
|
+
} from "lit";
|
|
2843
|
+
import { property as property18 } from "lit/decorators.js";
|
|
2844
|
+
var WmcpAlert = class extends LitElement5 {
|
|
2845
|
+
constructor() {
|
|
2846
|
+
super(...arguments);
|
|
2847
|
+
this.variant = "info";
|
|
2848
|
+
this.title = "";
|
|
2849
|
+
}
|
|
2850
|
+
static {
|
|
2851
|
+
this.tagName = "wmcp-alert";
|
|
2852
|
+
}
|
|
2853
|
+
static {
|
|
2854
|
+
this.styles = css16`
|
|
2855
|
+
:host {
|
|
2856
|
+
display: block;
|
|
2857
|
+
padding: var(--alert-padding, 0.75rem 1rem);
|
|
2858
|
+
color: var(--alert-text, var(--foreground, oklch(0.145 0 0)));
|
|
2859
|
+
background: var(--alert-bg, var(--background, oklch(1 0 0)));
|
|
2860
|
+
border: 1px solid var(--alert-border, var(--border, oklch(0.922 0 0)));
|
|
2861
|
+
border-left: 3px solid var(--alert-accent, var(--border, oklch(0.922 0 0)));
|
|
2862
|
+
border-radius: var(--alert-radius, var(--radius, 0.625rem));
|
|
2863
|
+
font-family: var(--alert-font-family, ui-sans-serif, system-ui, sans-serif);
|
|
2864
|
+
font-size: var(--alert-font-size, 0.875rem);
|
|
2865
|
+
}
|
|
2866
|
+
:host([hidden]) {
|
|
2867
|
+
display: none;
|
|
2868
|
+
}
|
|
2869
|
+
:host([variant='success']) {
|
|
2870
|
+
--alert-accent: var(--alert-accent-success, oklch(0.627 0.13 160));
|
|
2871
|
+
}
|
|
2872
|
+
:host([variant='warning']) {
|
|
2873
|
+
--alert-accent: var(--alert-accent-warning, oklch(0.7 0.16 75));
|
|
2874
|
+
}
|
|
2875
|
+
:host([variant='error']) {
|
|
2876
|
+
--alert-accent: var(--alert-accent-error, var(--destructive, oklch(0.577 0.245 27.325)));
|
|
2877
|
+
}
|
|
2878
|
+
:host([variant='info']) {
|
|
2879
|
+
--alert-accent: var(--alert-accent-info, var(--primary, oklch(0.205 0 0)));
|
|
2880
|
+
}
|
|
2881
|
+
.title {
|
|
2882
|
+
font-weight: 600;
|
|
2883
|
+
margin-bottom: 0.125rem;
|
|
2884
|
+
}
|
|
2885
|
+
.message {
|
|
2886
|
+
color: var(--alert-message, var(--muted-foreground, oklch(0.556 0 0)));
|
|
2887
|
+
}
|
|
2888
|
+
`;
|
|
2889
|
+
}
|
|
2890
|
+
connectedCallback() {
|
|
2891
|
+
super.connectedCallback();
|
|
2892
|
+
this.setAttribute(
|
|
2893
|
+
"role",
|
|
2894
|
+
this.variant === "error" || this.variant === "warning" ? "alert" : "status"
|
|
2895
|
+
);
|
|
2896
|
+
}
|
|
2897
|
+
render() {
|
|
2898
|
+
return html15`
|
|
2899
|
+
${this.title ? html15`<div class="title">${this.title}</div>` : nothing13}
|
|
2900
|
+
<div class="message"><slot></slot></div>
|
|
2901
|
+
`;
|
|
2902
|
+
}
|
|
2903
|
+
};
|
|
2904
|
+
__decorateClass([
|
|
2905
|
+
property18({ reflect: true })
|
|
2906
|
+
], WmcpAlert.prototype, "variant", 2);
|
|
2907
|
+
__decorateClass([
|
|
2908
|
+
property18()
|
|
2909
|
+
], WmcpAlert.prototype, "title", 2);
|
|
2910
|
+
|
|
2911
|
+
// src/elements/progress.ts
|
|
2912
|
+
import {
|
|
2913
|
+
LitElement as LitElement6,
|
|
2914
|
+
html as html16,
|
|
2915
|
+
css as css17
|
|
2916
|
+
} from "lit";
|
|
2917
|
+
import { property as property19 } from "lit/decorators.js";
|
|
2918
|
+
var WmcpProgress = class extends LitElement6 {
|
|
2919
|
+
constructor() {
|
|
2920
|
+
super(...arguments);
|
|
2921
|
+
this.max = 100;
|
|
2922
|
+
this.indeterminate = false;
|
|
2923
|
+
}
|
|
2924
|
+
static {
|
|
2925
|
+
this.tagName = "wmcp-progress";
|
|
2926
|
+
}
|
|
2927
|
+
static {
|
|
2928
|
+
this.styles = css17`
|
|
2929
|
+
:host {
|
|
2930
|
+
display: block;
|
|
2931
|
+
width: 100%;
|
|
2932
|
+
height: var(--progress-height, 0.5rem);
|
|
2933
|
+
overflow: hidden;
|
|
2934
|
+
background: var(--progress-track, var(--secondary, oklch(0.97 0 0)));
|
|
2935
|
+
border-radius: var(--progress-radius, 999px);
|
|
2936
|
+
}
|
|
2937
|
+
:host([hidden]) {
|
|
2938
|
+
display: none;
|
|
2939
|
+
}
|
|
2940
|
+
.bar {
|
|
2941
|
+
height: 100%;
|
|
2942
|
+
background: var(--progress-bar, var(--primary, oklch(0.205 0 0)));
|
|
2943
|
+
border-radius: inherit;
|
|
2944
|
+
transition: width 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
2945
|
+
}
|
|
2946
|
+
.bar.indeterminate {
|
|
2947
|
+
width: 40% !important;
|
|
2948
|
+
animation: progress-slide 1.2s infinite cubic-bezier(0.4, 0, 0.2, 1);
|
|
2949
|
+
}
|
|
2950
|
+
@keyframes progress-slide {
|
|
2951
|
+
from {
|
|
2952
|
+
translate: -100%;
|
|
2953
|
+
}
|
|
2954
|
+
to {
|
|
2955
|
+
translate: 350%;
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2959
|
+
.bar.indeterminate {
|
|
2960
|
+
animation: none;
|
|
2961
|
+
width: 100% !important;
|
|
2962
|
+
opacity: 0.5;
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
`;
|
|
2966
|
+
}
|
|
2967
|
+
get isIndeterminate() {
|
|
2968
|
+
return this.indeterminate || this.value == null;
|
|
2969
|
+
}
|
|
2970
|
+
updated() {
|
|
2971
|
+
this.setAttribute("role", "progressbar");
|
|
2972
|
+
this.setAttribute("aria-valuemin", "0");
|
|
2973
|
+
this.setAttribute("aria-valuemax", String(this.max));
|
|
2974
|
+
if (this.isIndeterminate) this.removeAttribute("aria-valuenow");
|
|
2975
|
+
else this.setAttribute("aria-valuenow", String(this.value));
|
|
2976
|
+
}
|
|
2977
|
+
render() {
|
|
2978
|
+
const pct = this.isIndeterminate ? 0 : Math.max(0, Math.min(100, (this.value ?? 0) / this.max * 100));
|
|
2979
|
+
return html16`<div
|
|
2980
|
+
class="bar ${this.isIndeterminate ? "indeterminate" : ""}"
|
|
2981
|
+
style=${this.isIndeterminate ? "" : `width: ${pct}%`}
|
|
2982
|
+
></div>`;
|
|
2983
|
+
}
|
|
2984
|
+
};
|
|
2985
|
+
__decorateClass([
|
|
2986
|
+
property19({ type: Number })
|
|
2987
|
+
], WmcpProgress.prototype, "value", 2);
|
|
2988
|
+
__decorateClass([
|
|
2989
|
+
property19({ type: Number })
|
|
2990
|
+
], WmcpProgress.prototype, "max", 2);
|
|
2991
|
+
__decorateClass([
|
|
2992
|
+
property19({ type: Boolean })
|
|
2993
|
+
], WmcpProgress.prototype, "indeterminate", 2);
|
|
2994
|
+
|
|
2995
|
+
// src/elements/avatar.ts
|
|
2996
|
+
import {
|
|
2997
|
+
LitElement as LitElement7,
|
|
2998
|
+
html as html17,
|
|
2999
|
+
css as css18,
|
|
3000
|
+
nothing as nothing14
|
|
3001
|
+
} from "lit";
|
|
3002
|
+
import { property as property20, state as state7 } from "lit/decorators.js";
|
|
3003
|
+
var WmcpAvatar = class extends LitElement7 {
|
|
3004
|
+
constructor() {
|
|
3005
|
+
super(...arguments);
|
|
3006
|
+
this.src = "";
|
|
3007
|
+
this.alt = "";
|
|
3008
|
+
this.fallback = "";
|
|
3009
|
+
this.failed = false;
|
|
3010
|
+
}
|
|
3011
|
+
static {
|
|
3012
|
+
this.tagName = "wmcp-avatar";
|
|
3013
|
+
}
|
|
3014
|
+
static {
|
|
3015
|
+
this.styles = css18`
|
|
3016
|
+
:host {
|
|
3017
|
+
display: inline-flex;
|
|
3018
|
+
align-items: center;
|
|
3019
|
+
justify-content: center;
|
|
3020
|
+
width: var(--avatar-size, 2.5rem);
|
|
3021
|
+
height: var(--avatar-size, 2.5rem);
|
|
3022
|
+
overflow: hidden;
|
|
3023
|
+
border-radius: var(--avatar-radius, 50%);
|
|
3024
|
+
background: var(--avatar-bg, var(--muted, oklch(0.97 0 0)));
|
|
3025
|
+
color: var(--avatar-text, var(--muted-foreground, oklch(0.556 0 0)));
|
|
3026
|
+
font-family: var(--avatar-font-family, ui-sans-serif, system-ui, sans-serif);
|
|
3027
|
+
font-size: var(--avatar-font-size, 0.875rem);
|
|
3028
|
+
font-weight: var(--avatar-font-weight, 500);
|
|
3029
|
+
user-select: none;
|
|
3030
|
+
}
|
|
3031
|
+
:host([hidden]) {
|
|
3032
|
+
display: none;
|
|
3033
|
+
}
|
|
3034
|
+
img {
|
|
3035
|
+
width: 100%;
|
|
3036
|
+
height: 100%;
|
|
3037
|
+
object-fit: cover;
|
|
3038
|
+
}
|
|
3039
|
+
`;
|
|
3040
|
+
}
|
|
3041
|
+
willUpdate(changed) {
|
|
3042
|
+
if (changed.has("src")) this.failed = false;
|
|
3043
|
+
}
|
|
3044
|
+
render() {
|
|
3045
|
+
const showImg = this.src && !this.failed;
|
|
3046
|
+
return showImg ? html17`<img
|
|
3047
|
+
src=${this.src}
|
|
3048
|
+
alt=${this.alt || nothing14}
|
|
3049
|
+
@error=${() => this.failed = true}
|
|
3050
|
+
/>` : html17`<span aria-label=${this.alt || nothing14}>${this.fallback}</span>`;
|
|
3051
|
+
}
|
|
3052
|
+
};
|
|
3053
|
+
__decorateClass([
|
|
3054
|
+
property20()
|
|
3055
|
+
], WmcpAvatar.prototype, "src", 2);
|
|
3056
|
+
__decorateClass([
|
|
3057
|
+
property20()
|
|
3058
|
+
], WmcpAvatar.prototype, "alt", 2);
|
|
3059
|
+
__decorateClass([
|
|
3060
|
+
property20()
|
|
3061
|
+
], WmcpAvatar.prototype, "fallback", 2);
|
|
3062
|
+
__decorateClass([
|
|
3063
|
+
state7()
|
|
3064
|
+
], WmcpAvatar.prototype, "failed", 2);
|
|
3065
|
+
|
|
2559
3066
|
// src/register.ts
|
|
2560
3067
|
var elements = [
|
|
2561
3068
|
WmcpInput,
|
|
@@ -2569,7 +3076,14 @@ var elements = [
|
|
|
2569
3076
|
WmcpMenu,
|
|
2570
3077
|
WmcpTabs,
|
|
2571
3078
|
WmcpPopover,
|
|
2572
|
-
WmcpToast
|
|
3079
|
+
WmcpToast,
|
|
3080
|
+
WmcpSwitch,
|
|
3081
|
+
WmcpBadge,
|
|
3082
|
+
WmcpSeparator,
|
|
3083
|
+
WmcpTooltip,
|
|
3084
|
+
WmcpAlert,
|
|
3085
|
+
WmcpProgress,
|
|
3086
|
+
WmcpAvatar
|
|
2573
3087
|
];
|
|
2574
3088
|
function defineComponents() {
|
|
2575
3089
|
if (typeof customElements === "undefined") return;
|
|
@@ -2581,6 +3095,9 @@ function defineComponents() {
|
|
|
2581
3095
|
}
|
|
2582
3096
|
export {
|
|
2583
3097
|
WmcpAction,
|
|
3098
|
+
WmcpAlert,
|
|
3099
|
+
WmcpAvatar,
|
|
3100
|
+
WmcpBadge,
|
|
2584
3101
|
WmcpButton,
|
|
2585
3102
|
WmcpCheckbox,
|
|
2586
3103
|
WmcpDialog,
|
|
@@ -2589,12 +3106,16 @@ export {
|
|
|
2589
3106
|
WmcpInput,
|
|
2590
3107
|
WmcpMenu,
|
|
2591
3108
|
WmcpPopover,
|
|
3109
|
+
WmcpProgress,
|
|
2592
3110
|
WmcpRadio,
|
|
2593
3111
|
WmcpRadioGroup,
|
|
2594
3112
|
WmcpSelect,
|
|
3113
|
+
WmcpSeparator,
|
|
3114
|
+
WmcpSwitch,
|
|
2595
3115
|
WmcpTabs,
|
|
2596
3116
|
WmcpTextarea,
|
|
2597
3117
|
WmcpToast,
|
|
3118
|
+
WmcpTooltip,
|
|
2598
3119
|
defineComponents,
|
|
2599
3120
|
exposeTool,
|
|
2600
3121
|
isStandardSchema,
|