@mono-lit/helper 0.0.9 → 0.1.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/accordion-core-DaNyPWRr.js +277 -0
- package/dist/alert-core-DWtHbX_-.js +134 -0
- package/dist/breadcrumb-list-core-Dh68T8Cf.js +747 -0
- package/dist/{mono-button-CLkHg3WW.js → button-core-DerXg84Q.js} +3 -276
- package/dist/button-dropdown-core-DKYEOyjy.js +654 -0
- package/dist/button-utils-D5-66M02.js +63 -0
- package/dist/card-utils-l80qAmrN.js +312 -0
- package/dist/chart-core-DV7hD3ZY.js +801 -0
- package/dist/checkbox-utils-DKdrhAzF.js +337 -0
- package/dist/chip-utils-DpRrd7Zj.js +403 -0
- package/dist/{data-source-controller-C6C4ej_M.js → data-source-controller-DS_JLrmS.js} +1 -1
- package/dist/{data-source-options-fxT5QIX4.js → data-source-options-DJUNU26C.js} +6 -6
- package/dist/{data-source-read-BL266IW0.js → data-source-read-uKJpRAzx.js} +2 -2
- package/dist/date-core-CyuSyvvG.js +734 -0
- package/dist/drawer-core-DbFWvNln.js +759 -0
- package/dist/dropdown-core-BCH1pK14.js +511 -0
- package/dist/dropdown-table-core-SfHUJVFq.js +1342 -0
- package/dist/export.js +1 -1
- package/dist/{field-path-BabiMrrA.js → field-path-DK2VBWHl.js} +1 -1
- package/dist/field-tooltip.css_raw-DVblekCl.js +5 -0
- package/dist/{field-validation.css_raw-Cx6SGrfP.js → field-validation.css_raw-BU7C6173.js} +1 -170
- package/dist/file-upload-core-Cz_dBQMx.js +624 -0
- package/dist/filter-builder-core-DyWjbBP7.js +381 -0
- package/dist/{filter-builder-B6Y2mmbM.js → filter-builder-vbqIuPhX.js} +1 -1
- package/dist/{filter-eval-ChDSaAUH.js → filter-eval-CqeBnMYh.js} +1 -1
- package/dist/{filter-odata-Bi27XUpQ.js → filter-odata-GsczYKNC.js} +1 -1
- package/dist/{hydration-flush-BaE9gN3C.js → hydration-flush-Volt9X7Q.js} +2 -1071
- package/dist/index.js +11 -11
- package/dist/{index.node-DTqDBca7.js → index.node-Csy9zrr1.js} +4 -4
- package/dist/index.node.js +11 -11
- package/dist/input-utils-BglY-k0H.js +1145 -0
- package/dist/menu-core-DkAYuCZ2.js +831 -0
- package/dist/modal-core-CSBSPN_m.js +844 -0
- package/dist/mono-button-DVvZ03P-.js +280 -0
- package/dist/{mono-button.shadow-DqZMpcqY.js → mono-button.shadow-BANxMGln.js} +6 -594
- package/dist/{mono-data-chart-NKPdAgVq.js → mono-data-chart-ChF4J9RT.js} +6 -6
- package/dist/{mono-data-dropdown-B2iRpJuI.js → mono-data-dropdown-Bgj2PDfm.js} +1 -1
- package/dist/{mono-data-grid-llJCX9MC.js → mono-data-grid-DJkp96N-.js} +144 -46
- package/dist/{mono-event-BPku9HpS.js → mono-event-CAZf0F_k.js} +14 -9
- package/dist/{mono-form-controller-BrA10erm.js → mono-form-controller-DxZLvyg6.js} +2 -1
- package/dist/mono-table-checkbox-core-BKOMx8R5.js +5288 -0
- package/dist/nav-core-B5qU2dzn.js +225 -0
- package/dist/{normalize-error-D93O4q8g.js → normalize-error-BEcd1tmS.js} +2 -2
- package/dist/nuxt.js +1 -1
- package/dist/otp-core-DXg3vFLh.js +758 -0
- package/dist/radio-utils-Dk9Tl1jz.js +319 -0
- package/dist/rich-text-editor-core-Ddd_QaLn.js +1280 -0
- package/dist/select-utils-BgArYHk8.js +2140 -0
- package/dist/sidebar-core-CD6txDo3.js +583 -0
- package/dist/slider-core-vcWr321-.js +1014 -0
- package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +2 -2
- package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +1 -1
- package/dist/src/components/dropdown-table/index.d.ts +1 -1
- package/dist/src/components/dropdown-table/index.shadow.d.ts +1 -1
- package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +1 -1
- package/dist/src/components/form/form-types.d.ts +9 -3
- package/dist/src/components/input/input-core.d.ts +1 -1
- package/dist/src/components/input/input-types.d.ts +1 -1
- package/dist/src/components/otp/otp-core.d.ts +1 -1
- package/dist/src/components/select/select-core.d.ts +1 -1
- package/dist/src/components/select/select-types.d.ts +1 -1
- package/dist/src/components/slider/slider-core.d.ts +1 -1
- package/dist/src/components/slider/slider-types.d.ts +1 -1
- package/dist/src/components/table/filter-suggestion.d.ts +171 -0
- package/dist/src/components/table/index.d.ts +5 -4
- package/dist/src/components/table/index.shadow.d.ts +5 -4
- package/dist/src/components/table/mono-data-grid.d.ts +22 -3
- package/dist/src/components/table/mono-table-empty-core.d.ts +37 -0
- package/dist/src/components/table/mono-table-search-core.d.ts +22 -3
- package/dist/src/components/table/table-types.d.ts +74 -4
- package/dist/src/components/tag-input/tag-input-core.d.ts +1 -1
- package/dist/src/components/tag-input/tag-input-types.d.ts +1 -1
- package/dist/src/components/textarea/textarea-core.d.ts +1 -1
- package/dist/src/composables/mono-event.d.ts +7 -1
- package/dist/src/entries/index.d.ts +8 -6
- package/dist/src/entries/index.node.d.ts +8 -6
- package/dist/src/search/index.d.ts +1 -1
- package/dist/src/utils/group-count.d.ts +36 -0
- package/dist/switch-utils-CTZ4id2V.js +338 -0
- package/dist/tabs-core-r5-B8k_N.js +317 -0
- package/dist/tag-input-utils-D2JA90DQ.js +3060 -0
- package/dist/textarea-utils-VU1KeXm8.js +821 -0
- package/dist/ui/accordion.js +2 -274
- package/dist/ui/alert.js +2 -131
- package/dist/ui/breadcrumb.js +4 -745
- package/dist/ui/button-dropdown.js +4 -652
- package/dist/ui/button.js +2 -63
- package/dist/ui/card.js +2 -310
- package/dist/ui/chart.js +4 -800
- package/dist/ui/checkbox.js +4 -335
- package/dist/ui/chip.js +4 -402
- package/dist/ui/date.js +3 -732
- package/dist/ui/drawer.js +3 -757
- package/dist/ui/dropdown-table.js +5 -1341
- package/dist/ui/dropdown.js +4 -509
- package/dist/ui/file-upload.js +3 -622
- package/dist/ui/filter.js +5 -380
- package/dist/ui/form.js +1 -1
- package/dist/ui/index.css +118 -1
- package/dist/ui/input.js +3 -1141
- package/dist/ui/menu.js +4 -828
- package/dist/ui/modal.js +4 -843
- package/dist/ui/nav.js +4 -223
- package/dist/ui/otp.js +4 -756
- package/dist/ui/radio.js +4 -317
- package/dist/ui/rich-text-editor.js +4 -1278
- package/dist/ui/select.js +5 -2138
- package/dist/ui/shadow/accordion.js +4 -273
- package/dist/ui/shadow/alert.js +4 -130
- package/dist/ui/shadow/breadcrumb.js +5 -744
- package/dist/ui/shadow/button-dropdown.js +6 -652
- package/dist/ui/shadow/button.js +3 -63
- package/dist/ui/shadow/card.js +4 -309
- package/dist/ui/shadow/chart.js +6 -1576
- package/dist/ui/shadow/checkbox.js +4 -334
- package/dist/ui/shadow/chip.js +4 -396
- package/dist/ui/shadow/date.js +7 -731
- package/dist/ui/shadow/drawer.js +4 -756
- package/dist/ui/shadow/dropdown-table.js +8 -1762
- package/dist/ui/shadow/dropdown.js +4 -508
- package/dist/ui/shadow/file-upload.js +4 -620
- package/dist/ui/shadow/filter.js +7 -379
- package/dist/ui/shadow/input.js +6 -1140
- package/dist/ui/shadow/menu.js +5 -828
- package/dist/ui/shadow/modal.js +6 -1063
- package/dist/ui/shadow/nav.js +5 -223
- package/dist/ui/shadow/otp.js +6 -754
- package/dist/ui/shadow/radio.js +4 -316
- package/dist/ui/shadow/rich-text-editor.js +4 -1276
- package/dist/ui/shadow/select.js +6 -2136
- package/dist/ui/shadow/sidebar.js +5 -581
- package/dist/ui/shadow/slider.js +5 -1010
- package/dist/ui/shadow/switch.js +4 -335
- package/dist/ui/shadow/table.js +10 -4501
- package/dist/ui/shadow/tabs.js +6 -315
- package/dist/ui/shadow/tag-input.js +7 -3057
- package/dist/ui/shadow/textarea.js +6 -817
- package/dist/ui/sidebar.js +3 -581
- package/dist/ui/slider.js +4 -1012
- package/dist/ui/switch.js +4 -336
- package/dist/ui/table.js +9 -4502
- package/dist/ui/tabs.js +4 -315
- package/dist/ui/tag-input.js +5 -3058
- package/dist/ui/textarea.js +4 -819
- package/dist/{vite-CivRCJaf.js → vite-CfW7z2wn.js} +21 -14
- package/dist/vite.js +1 -1
- package/dist/vue.d.ts +3 -2
- package/package.json +10 -11
- package/dist/chip-strip-bNfLn52Z.js +0 -215
- package/dist/data-source-controller-Dx6IQ2CN.js +0 -243
- package/dist/data-source-options-BM4r4PRw.js +0 -558
- package/dist/data-source-read-HyBCRg1t.js +0 -242
- package/dist/excel-BXzr3uI1.js +0 -784
- package/dist/export-ixRdCS2y.js +0 -2388
- package/dist/field-tooltip-addon-CWCp19mJ.js +0 -702
- package/dist/field-tooltip.css_raw-U5UeTa2d.js +0 -269
- package/dist/filter-builder-C0T3pMx2.js +0 -208
- package/dist/form-control-core-BbiACMtL.js +0 -226
- package/dist/icon-ClxnYhBG.js +0 -19
- package/dist/import-Dc4eXC02.js +0 -612
- package/dist/light-slots-_no0r2Z-.js +0 -246
- package/dist/markdown-uGlE_OfJ.js +0 -20191
- package/dist/mono-data-grid-e9ZVBlNN.js +0 -4240
- package/dist/normalize-error-BmLbgANw.js +0 -1048
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { d as buildSizeStyle } from "./mono-ui-kvLVIf1V.js";
|
|
2
|
-
import { t as customElement } from "./mono-element-CKcT0rwv.js";
|
|
3
2
|
import { a as defineHybridPropAliases, r as booleanStringConverter, t as __decorate } from "./decorate-DbYFpi8R.js";
|
|
4
|
-
import { t as dispatchMonoEvent } from "./mono-event-
|
|
5
|
-
import { n as bucketHasContent, r as captureLightSlots, s as placeSlotNode, t as LateSlotWatcher } from "./light-slots-B5Ck0t_E.js";
|
|
3
|
+
import { t as dispatchMonoEvent } from "./mono-event-CAZf0F_k.js";
|
|
6
4
|
import { a as rateLimitHasChanged, i as rateLimitConverter, n as normalizeDebounce, r as normalizeThrottle, t as createRateLimiter } from "./rate-limit-e9Jlpl5l.js";
|
|
7
|
-
import {
|
|
5
|
+
import { html, nothing } from "lit";
|
|
8
6
|
import { property, query, state } from "lit/decorators.js";
|
|
9
7
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
|
-
import { when } from "lit/directives/when.js";
|
|
11
8
|
|
|
12
9
|
//#region src/components/button/button-core.ts
|
|
13
10
|
/**
|
|
@@ -598,274 +595,4 @@ const MonoButtonCore = (superClass) => {
|
|
|
598
595
|
};
|
|
599
596
|
|
|
600
597
|
//#endregion
|
|
601
|
-
|
|
602
|
-
let MonoButton = class MonoButton extends MonoButtonCore(LitElement) {
|
|
603
|
-
constructor(..._args) {
|
|
604
|
-
super(..._args);
|
|
605
|
-
this._buckets = /* @__PURE__ */ new Map();
|
|
606
|
-
this._slotsCaptured = false;
|
|
607
|
-
this._guardedAffixes = /* @__PURE__ */ new WeakSet();
|
|
608
|
-
this._lateAffix = [];
|
|
609
|
-
}
|
|
610
|
-
createRenderRoot() {
|
|
611
|
-
return this;
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Light-DOM refinement: `rounded="full"` auto-icon-only only when the default slot is
|
|
615
|
-
* empty. `bucketHasContent` (not a length check) so a bucket holding nothing but
|
|
616
|
-
* framework anchors still counts as empty.
|
|
617
|
-
*/
|
|
618
|
-
_defaultIsEmpty() {
|
|
619
|
-
return !bucketHasContent(this._buckets.get("default"));
|
|
620
|
-
}
|
|
621
|
-
_renderBadge() {
|
|
622
|
-
return when(Boolean(this.badge), () => html`
|
|
623
|
-
<span class=${this._badgeClass} mono-badge=${this._badgeColor}>
|
|
624
|
-
${this.badge}
|
|
625
|
-
</span>
|
|
626
|
-
`, () => nothing);
|
|
627
|
-
}
|
|
628
|
-
/**
|
|
629
|
-
* The `[data-mono-slot]` targets must be **structurally stable** across every
|
|
630
|
-
* re-render.
|
|
631
|
-
*
|
|
632
|
-
* These are light-DOM elements holding nodes the *consumer's* framework
|
|
633
|
-
* created and still tracks. Toggling `loading` used to swap between two
|
|
634
|
-
* template branches, so Lit destroyed the target `<span>` — taking the
|
|
635
|
-
* consumer's nodes with it — and `updated()` re-appended them into a brand-new
|
|
636
|
-
* one. Vue's vnodes then referenced detached nodes, and the next patch died
|
|
637
|
-
* with `TypeError: can't access property "__vnode", el is null`.
|
|
638
|
-
*
|
|
639
|
-
* So visibility is expressed with the existing `.button-icon.hidden` class
|
|
640
|
-
* (`display: none !important`), never by adding or removing the target. With
|
|
641
|
-
* the span stable, `_placeSlot` finds its nodes already in place and mutates
|
|
642
|
-
* nothing at all on a loading toggle.
|
|
643
|
-
*/
|
|
644
|
-
_renderIconOnlyContent() {
|
|
645
|
-
return html`
|
|
646
|
-
<span class=${this._iconClass()} mono-icon ?mono-spinning=${this._showsSpinner} ?mono-empty=${!this._hasIcon && !this._showsSpinner} data-mono-slot="icon"></span>
|
|
647
|
-
|
|
648
|
-
${this._renderBadge()}
|
|
649
|
-
`;
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* Icon slot class, hidden in place while loading rather than unmounted — but
|
|
653
|
-
* only in overlay mode. Inline loading keeps the icon, so the button doesn't
|
|
654
|
-
* reshuffle its contents just to show progress.
|
|
655
|
-
*/
|
|
656
|
-
/**
|
|
657
|
-
* The icon box, which is also where the spinner is drawn.
|
|
658
|
-
*
|
|
659
|
-
* `spinning` paints the ring and hides whatever is slotted inside; `empty` collapses the box
|
|
660
|
-
* when there is neither. The span itself is ALWAYS rendered — see `_renderNormalContent`.
|
|
661
|
-
*/
|
|
662
|
-
_iconClass() {
|
|
663
|
-
const base = this._cls("button-icon", "icon");
|
|
664
|
-
const state = [this._showsSpinner ? "spinning" : "", !this._hasIcon && !this._showsSpinner ? "empty" : ""].filter(Boolean).join(" ");
|
|
665
|
-
return state ? `${base} ${state}` : base;
|
|
666
|
-
}
|
|
667
|
-
_renderNormalContent() {
|
|
668
|
-
const contentBase = this._hasIcon ? this.iconPosition === "right" ? "button-content icon-right" : "button-content icon-left" : "button-content";
|
|
669
|
-
const contentClass = this._cls(contentBase, "content");
|
|
670
|
-
const iconClass = this._iconClass();
|
|
671
|
-
const textClass = this._cls("button-text", "text");
|
|
672
|
-
const iconSpan = (position) => this.iconPosition === position ? html`<span class=${iconClass} mono-icon ?mono-spinning=${this._showsSpinner} ?mono-empty=${!this._hasIcon && !this._showsSpinner} data-mono-slot="icon"></span>` : nothing;
|
|
673
|
-
return html`
|
|
674
|
-
<div class=${contentClass} mono-content>
|
|
675
|
-
${iconSpan("left")}
|
|
676
|
-
|
|
677
|
-
<span class=${textClass} mono-text data-mono-slot="default"></span>
|
|
678
|
-
|
|
679
|
-
${iconSpan("right")}
|
|
680
|
-
</div>
|
|
681
|
-
|
|
682
|
-
${this._renderBadge()}
|
|
683
|
-
`;
|
|
684
|
-
}
|
|
685
|
-
_renderContent() {
|
|
686
|
-
if (this._isIconOnlyLike) return this._renderIconOnlyContent();
|
|
687
|
-
return this._renderNormalContent();
|
|
688
|
-
}
|
|
689
|
-
render() {
|
|
690
|
-
const isDisabled = this._isBlocked;
|
|
691
|
-
const isInert = this._isInert;
|
|
692
|
-
if (this.href) return this._renderWrapper(html`
|
|
693
|
-
${this._renderAffix("prepend")}
|
|
694
|
-
<a
|
|
695
|
-
class=${"mono-button-native" + (this.cssClass?.main ? " " + this.cssClass.main : "")}
|
|
696
|
-
mono-native
|
|
697
|
-
href=${ifDefined(this.href)}
|
|
698
|
-
target=${ifDefined(this.target)}
|
|
699
|
-
title=${ifDefined(this.tooltip)}
|
|
700
|
-
aria-label=${ifDefined(this._ariaLabel)}
|
|
701
|
-
role="button"
|
|
702
|
-
aria-disabled=${isDisabled ? "true" : "false"}
|
|
703
|
-
aria-busy=${this._effectiveLoading ? "true" : "false"}
|
|
704
|
-
@click=${this._handleClick}
|
|
705
|
-
@keydown=${this._handleKeyDown}
|
|
706
|
-
@focus=${this._handleFocus}
|
|
707
|
-
@blur=${this._handleBlur}
|
|
708
|
-
>
|
|
709
|
-
${this._renderContent()}
|
|
710
|
-
</a>
|
|
711
|
-
${this._renderAffix("append")}
|
|
712
|
-
`);
|
|
713
|
-
return this._renderWrapper(html`
|
|
714
|
-
${this._renderAffix("prepend")}
|
|
715
|
-
<button
|
|
716
|
-
class=${ifDefined(this.cssClass?.main)}
|
|
717
|
-
mono-native
|
|
718
|
-
type=${this.type}
|
|
719
|
-
title=${ifDefined(this.tooltip)}
|
|
720
|
-
aria-label=${ifDefined(this._ariaLabel)}
|
|
721
|
-
?disabled=${isInert}
|
|
722
|
-
aria-disabled=${isDisabled ? "true" : "false"}
|
|
723
|
-
aria-busy=${this._effectiveLoading ? "true" : "false"}
|
|
724
|
-
@click=${this._handleClick}
|
|
725
|
-
@keydown=${this._handleKeyDown}
|
|
726
|
-
@focus=${this._handleFocus}
|
|
727
|
-
@blur=${this._handleBlur}
|
|
728
|
-
>
|
|
729
|
-
${this._renderContent()}
|
|
730
|
-
</button>
|
|
731
|
-
${this._renderAffix("append")}
|
|
732
|
-
`);
|
|
733
|
-
}
|
|
734
|
-
connectedCallback() {
|
|
735
|
-
super.connectedCallback();
|
|
736
|
-
this.setAttribute("role", "button");
|
|
737
|
-
this._captureSlots();
|
|
738
|
-
if (this.isConnected) this.performUpdate();
|
|
739
|
-
if (!this._lateAffix.length) for (const name of ["prepend", "append"]) this._lateAffix.push({
|
|
740
|
-
name,
|
|
741
|
-
watcher: new LateSlotWatcher(this, name, () => this._recaptureAffix())
|
|
742
|
-
});
|
|
743
|
-
for (const { watcher } of this._lateAffix) watcher.start();
|
|
744
|
-
}
|
|
745
|
-
disconnectedCallback() {
|
|
746
|
-
for (const { watcher } of this._lateAffix) watcher.stop();
|
|
747
|
-
super.disconnectedCallback();
|
|
748
|
-
}
|
|
749
|
-
/**
|
|
750
|
-
* Claim a `slot="prepend"` / `slot="append"` child that arrived after connect.
|
|
751
|
-
*
|
|
752
|
-
* Deliberately NOT `captureLightSlots` a second time. This build renders into
|
|
753
|
-
* the host (`createRenderRoot` → `this`), so by now the host's children include
|
|
754
|
-
* Lit's own `<div class="mono-button">` — a re-capture would bucket that as
|
|
755
|
-
* default content and detach it, wiping the rendered button. `LateSlotWatcher`
|
|
756
|
-
* hands back only the direct child carrying the slot name, which is all that is
|
|
757
|
-
* wanted here.
|
|
758
|
-
*/
|
|
759
|
-
_recaptureAffix() {
|
|
760
|
-
let gained = false;
|
|
761
|
-
for (const { name, watcher } of this._lateAffix) {
|
|
762
|
-
const el = watcher.find();
|
|
763
|
-
if (!el) continue;
|
|
764
|
-
el.removeAttribute("slot");
|
|
765
|
-
if (el.parentNode === this) this.removeChild(el);
|
|
766
|
-
this._buckets.set(name, [...this._buckets.get(name) ?? [], el]);
|
|
767
|
-
if (name === "prepend") this._hasPrepend = true;
|
|
768
|
-
else this._hasAppend = true;
|
|
769
|
-
gained = true;
|
|
770
|
-
}
|
|
771
|
-
if (gained) this.requestUpdate();
|
|
772
|
-
}
|
|
773
|
-
/**
|
|
774
|
-
* Stop a nested control's click at the affix boundary — the plain `click`
|
|
775
|
-
* and the `mno-click` / `mnoClick` aliases alike.
|
|
776
|
-
*
|
|
777
|
-
* An affix can hold a whole `<mono-button>` or a dropdown caret. Sibling
|
|
778
|
-
* placement keeps its clicks out of `_handleClick`, but they would still
|
|
779
|
-
* bubble to the HOST, where a consumer's `@click` is this button's action —
|
|
780
|
-
* a split button's caret would run the button's handler. So an affix's click
|
|
781
|
-
* ends here: its own handlers (deeper) and any document-level CAPTURE
|
|
782
|
-
* listener have already run. Same guard `mono-button-dropdown` puts on its
|
|
783
|
-
* embedded buttons.
|
|
784
|
-
*/
|
|
785
|
-
_guardAffixEvents(el) {
|
|
786
|
-
if (this._guardedAffixes.has(el)) return;
|
|
787
|
-
this._guardedAffixes.add(el);
|
|
788
|
-
const stop = (event) => event.stopPropagation();
|
|
789
|
-
el.addEventListener("click", stop);
|
|
790
|
-
el.addEventListener("mno-click", stop);
|
|
791
|
-
el.addEventListener("mnoClick", stop);
|
|
792
|
-
}
|
|
793
|
-
_captureSlots() {
|
|
794
|
-
if (this._slotsCaptured) return;
|
|
795
|
-
this._slotsCaptured = true;
|
|
796
|
-
this._buckets = captureLightSlots(this, { names: [
|
|
797
|
-
"icon",
|
|
798
|
-
"prepend",
|
|
799
|
-
"append"
|
|
800
|
-
] });
|
|
801
|
-
this._hasIcon = bucketHasContent(this._buckets.get("icon"));
|
|
802
|
-
this._hasPrepend = bucketHasContent(this._buckets.get("prepend"));
|
|
803
|
-
this._hasAppend = bucketHasContent(this._buckets.get("append"));
|
|
804
|
-
}
|
|
805
|
-
/**
|
|
806
|
-
* An affix zone renders only when its slot has content, so an affix-free button
|
|
807
|
-
* keeps byte-identical markup. That conditional is safe here — unlike the icon
|
|
808
|
-
* span, whose target must never unmount — because capture runs BEFORE the
|
|
809
|
-
* synchronous first render in `connectedCallback`, and because the flags only
|
|
810
|
-
* ever go false→true: captured nodes stay captured, so a target that exists
|
|
811
|
-
* once is never taken away from under the consumer's nodes.
|
|
812
|
-
*/
|
|
813
|
-
_renderAffix(name) {
|
|
814
|
-
if (!(name === "prepend" ? this._hasPrepend : this._hasAppend)) return nothing;
|
|
815
|
-
const cls = [
|
|
816
|
-
`button-${name}`,
|
|
817
|
-
this._affix(name).divider ? "has-divider" : "",
|
|
818
|
-
this._affixDisabled(name) ? "disabled" : "",
|
|
819
|
-
this.cssClass?.[name] ?? ""
|
|
820
|
-
].filter(Boolean).join(" ");
|
|
821
|
-
return html`<span
|
|
822
|
-
class=${cls}
|
|
823
|
-
mono-affix=${name}
|
|
824
|
-
?mono-divider=${Boolean(this._affix(name).divider)}
|
|
825
|
-
?mono-disabled=${this._affixDisabled(name)}
|
|
826
|
-
data-mono-slot=${name}
|
|
827
|
-
></span>`;
|
|
828
|
-
}
|
|
829
|
-
/**
|
|
830
|
-
* Apply sizing to the HOST (`mono-button` is inline-block). The `.sized` class
|
|
831
|
-
* makes the wrapper + inner control fill the host, so width/height set here
|
|
832
|
-
* cascade down. Props that aren't set are removed so they don't linger.
|
|
833
|
-
*/
|
|
834
|
-
_applyHostSize() {
|
|
835
|
-
const style = buildSizeStyle(this);
|
|
836
|
-
for (const prop of [
|
|
837
|
-
"width",
|
|
838
|
-
"height",
|
|
839
|
-
"min-width",
|
|
840
|
-
"max-width",
|
|
841
|
-
"min-height",
|
|
842
|
-
"max-height"
|
|
843
|
-
]) {
|
|
844
|
-
const value = style[prop];
|
|
845
|
-
if (value) this.style.setProperty(prop, value);
|
|
846
|
-
else this.style.removeProperty(prop);
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
updated(changed) {
|
|
850
|
-
super.updated(changed);
|
|
851
|
-
this._applyHostSize();
|
|
852
|
-
this._placeSlot("icon", this._buckets.get("icon") ?? []);
|
|
853
|
-
this._placeSlot("prepend", this._buckets.get("prepend") ?? []);
|
|
854
|
-
this._placeSlot("append", this._buckets.get("append") ?? []);
|
|
855
|
-
for (const name of ["prepend", "append"]) {
|
|
856
|
-
const zone = this.querySelector(`[data-mono-slot="${name}"]`);
|
|
857
|
-
if (zone) this._guardAffixEvents(zone);
|
|
858
|
-
}
|
|
859
|
-
if (!this._isIconOnlyLike) this._placeSlot("default", this._buckets.get("default") ?? []);
|
|
860
|
-
}
|
|
861
|
-
_placeSlot(name, nodes) {
|
|
862
|
-
if (!nodes.length) return;
|
|
863
|
-
const target = this.querySelector(`[data-mono-slot="${name}"]`);
|
|
864
|
-
if (!target) return;
|
|
865
|
-
for (const node of nodes) placeSlotNode(target, node);
|
|
866
|
-
}
|
|
867
|
-
};
|
|
868
|
-
MonoButton = __decorate([customElement("mono-button")], MonoButton);
|
|
869
|
-
|
|
870
|
-
//#endregion
|
|
871
|
-
export { MonoButton as t };
|
|
598
|
+
export { MonoButtonCore as t };
|