@vanelsas/baredom 0.1.11-alpha → 0.2.2-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +2 -2
- package/dist/base.js +245 -245
- package/dist/x-alert.js +9 -9
- package/dist/x-avatar-group.js +4 -4
- package/dist/x-avatar.js +17 -17
- package/dist/x-badge.js +11 -11
- package/dist/x-breadcrumbs.js +7 -7
- package/dist/x-button.js +15 -15
- package/dist/x-cancel-dialogue.js +14 -14
- package/dist/x-card.js +2 -2
- package/dist/x-chart.js +44 -44
- package/dist/x-checkbox.js +7 -7
- package/dist/x-chip.js +5 -5
- package/dist/x-collapse.js +11 -11
- package/dist/x-command-palette.js +17 -17
- package/dist/x-container.js +6 -6
- package/dist/x-context-menu.js +19 -19
- package/dist/x-copy.js +14 -14
- package/dist/x-currency-field.js +21 -21
- package/dist/x-date-picker.js +36 -36
- package/dist/x-divider.js +10 -10
- package/dist/x-drawer.js +9 -9
- package/dist/x-dropdown.js +6 -6
- package/dist/x-fieldset.js +5 -5
- package/dist/x-file-download.js +6 -6
- package/dist/x-form-field.js +17 -15
- package/dist/x-form.js +10 -10
- package/dist/x-grid.js +7 -7
- package/dist/x-menu-item.js +10 -10
- package/dist/x-menu.js +10 -10
- package/dist/x-modal.js +13 -13
- package/dist/x-navbar.js +12 -12
- package/dist/x-notification-center.js +6 -6
- package/dist/x-pagination.js +16 -16
- package/dist/x-popover.js +7 -7
- package/dist/x-progress-circle.js +9 -9
- package/dist/x-progress.js +8 -8
- package/dist/x-radio.js +9 -9
- package/dist/x-search-field.js +11 -11
- package/dist/x-select.js +10 -10
- package/dist/x-sidebar.js +24 -24
- package/dist/x-skeleton.js +5 -5
- package/dist/x-slider.js +9 -9
- package/dist/x-spacer.js +5 -5
- package/dist/x-spinner.js +5 -5
- package/dist/x-stat.js +9 -9
- package/dist/x-stepper.js +6 -6
- package/dist/x-switch.js +11 -11
- package/dist/x-tab.js +3 -3
- package/dist/x-table-cell.js +23 -23
- package/dist/x-table-row.js +5 -5
- package/dist/x-table.js +6 -6
- package/dist/x-tabs.js +7 -7
- package/dist/x-text-area.js +18 -18
- package/dist/x-timeline-item.js +13 -13
- package/dist/x-timeline.js +9 -9
- package/dist/x-toast.js +11 -11
- package/dist/x-toaster.js +1 -1
- package/package.json +1 -1
package/dist/x-drawer.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var Xt=function(a){var b=$APP.l(a,"__xDrawerRefs");if($APP.n(b))return b;b=a.attachShadow({mode:"open"});var c=document.createElement("style"),d=document.createElement("div"),e=document.createElement("div"),
|
|
3
|
-
d.setAttribute("part","backdrop");e.setAttribute("part","panel");e.setAttribute("role","dialog");e.setAttribute("aria-modal","true");
|
|
2
|
+
var Xt=function(a){var b=$APP.l(a,"__xDrawerRefs");if($APP.n(b))return b;b=a.attachShadow({mode:"open"});var c=document.createElement("style"),d=document.createElement("div"),e=document.createElement("div"),g=document.createElement("div"),h=document.createElement("slot"),k=document.createElement("div"),m=document.createElement("slot"),q=document.createElement("div"),r=document.createElement("slot");c.textContent=":host{display:contents;color-scheme:light dark;--x-drawer-size:20rem;--x-drawer-bg:Canvas;--x-drawer-fg:CanvasText;--x-drawer-backdrop:rgb(0 0 0/0.4);--x-drawer-shadow:0 8px 24px rgb(0 0 0/0.18);--x-drawer-duration:200ms;--x-drawer-easing:ease;--x-drawer-z:1000;--x-drawer-header-padding:1rem 1.25rem;--x-drawer-body-padding:1rem 1.25rem;--x-drawer-footer-padding:0.75rem 1.25rem;--x-drawer-border:color-mix(in srgb,currentColor 12%,transparent);}[part\x3dbackdrop]{display:none;position:fixed;inset:0;background:var(--x-drawer-backdrop);z-index:var(--x-drawer-z);}:host([data-open\x3dtrue]) [part\x3dbackdrop]{display:block;}[part\x3dpanel]{position:fixed;background:var(--x-drawer-bg);color:var(--x-drawer-fg);box-shadow:var(--x-drawer-shadow);display:flex;flex-direction:column;overflow:hidden;z-index:calc(var(--x-drawer-z) + 1);transition:transform var(--x-drawer-duration) var(--x-drawer-easing);}:host([data-placement\x3dleft]) [part\x3dpanel],:host([data-placement\x3dright]) [part\x3dpanel]{top:0;bottom:0;width:var(--x-drawer-size);max-width:100vw;}:host([data-placement\x3dleft]) [part\x3dpanel]{left:0;transform:translateX(-100%);}:host([data-placement\x3dright]) [part\x3dpanel]{right:0;transform:translateX(100%);}:host([data-placement\x3dtop]) [part\x3dpanel],:host([data-placement\x3dbottom]) [part\x3dpanel]{left:0;right:0;height:var(--x-drawer-size);max-height:100vh;}:host([data-placement\x3dtop]) [part\x3dpanel]{top:0;transform:translateY(-100%);}:host([data-placement\x3dbottom]) [part\x3dpanel]{bottom:0;transform:translateY(100%);}:host([data-open\x3dtrue]) [part\x3dpanel]{transform:none;}[part\x3dpanel]:focus{outline:none;}[part\x3dheader]{padding:var(--x-drawer-header-padding);border-bottom:1px solid var(--x-drawer-border);flex-shrink:0;}[part\x3dbody]{padding:var(--x-drawer-body-padding);overflow-y:auto;flex:1;}[part\x3dfooter]{padding:var(--x-drawer-footer-padding);border-top:1px solid var(--x-drawer-border);flex-shrink:0;}@media (prefers-reduced-motion:reduce){[part\x3dpanel]{transition:none;}}@media (prefers-color-scheme:dark){:host{--x-drawer-bg:#1c1d24;--x-drawer-fg:#e2e4ef;--x-drawer-border:rgb(255 255 255/0.08);--x-drawer-shadow:0 8px 40px rgb(0 0 0/0.55);--x-drawer-backdrop:rgb(0 0 0/0.55);}}";
|
|
3
|
+
d.setAttribute("part","backdrop");e.setAttribute("part","panel");e.setAttribute("role","dialog");e.setAttribute("aria-modal","true");g.setAttribute("part","header");h.setAttribute("name","header");k.setAttribute("part","body");q.setAttribute("part","footer");r.setAttribute("name","footer");g.appendChild(h);k.appendChild(m);q.appendChild(r);e.appendChild(g);e.appendChild(k);e.appendChild(q);b.appendChild(c);b.appendChild(d);b.appendChild(e);a.__xDrawerRefs={root:b,backdrop:d,panel:e,header:g,body:k,
|
|
4
4
|
footer:q};return $APP.l(a,"__xDrawerRefs")},Zt=function(a){a=new $APP.P(null,3,[$APP.rh,a.hasAttribute("open"),$APP.fj,a.getAttribute("placement"),$APP.dh,a.getAttribute("label")],null);var b=$APP.M(a),c=$APP.I(b,$APP.rh);a=$APP.I(b,$APP.fj);b=$APP.I(b,$APP.dh);c=$APP.J(c);a=typeof a==="string"&&$APP.Cc(Yt,a)?a:"right";b=typeof b==="string"&&$APP.N(b,"")?b:"Drawer";return new $APP.P(null,3,[$APP.Pi,c,$APP.Ai,a,$APP.W,b],null)},$t=function(a,b,c){a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,
|
|
5
5
|
composed:!0,cancelable:!1}))},au=function(a){return $APP.be($APP.Kd(function(b){var c=window.getComputedStyle(b);return $APP.N("none",c.display)&&$APP.N("hidden",c.visibility)&&b.offsetWidth>0&&b.offsetHeight>0},$APP.gc(a.querySelectorAll("a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex\x3d'-1'])"))))},bu=function(a){var b=$APP.l(a,"__xDrawerRefs");b=$APP.n(b)?$APP.l(b,"panel"):null;var c=$APP.l(a,"__xDrawerRestore"),d=
|
|
6
6
|
$APP.l(a,"__xDrawerPanelTab")===!0;a.__xDrawerTabbables=null;a.__xDrawerRestore=null;$APP.n($APP.n(b)?d:b)&&(b.removeAttribute("tabindex"),a.__xDrawerPanelTab=!1);$APP.n($APP.n(c)?c.isConnected:c)&&c.focus()},cu=function(a,b){$t(a,"x-drawer-dismiss",{reason:b});a.removeAttribute("open");return null},du=function(a){$APP.n(a.hasAttribute("open"))||a.setAttribute("open","");return null},eu=function(a){a.removeAttribute("open");return null},fu=function(a){var b=Xt(a);b=$APP.l(b,"panel");var c=Zt(a),d=
|
|
7
|
-
$APP.Pi.g(c),e=$APP.l(a,"__xDrawerPrevOpen");a.setAttribute("data-open",$APP.n(d)?"true":"false");a.setAttribute("data-placement",$APP.Ai.g(c));b.setAttribute("aria-label",$APP.W.g(c));$APP.N(e,d)&&(a.__xDrawerPrevOpen=d,$t(a,"x-drawer-toggle",{open:d}),$APP.n(d)?setTimeout(function(){var
|
|
8
|
-
$APP.n(
|
|
9
|
-
h=$APP.ic(h);var q=
|
|
10
|
-
c=$APP.l(c,"panel");var e=$APP.l(b,"backdrop");b=$APP.l(b,"keydown");$APP.n(e)&&d.removeEventListener("click",e);$APP.n(b)&&c.removeEventListener("keydown",b)}a.__xDrawerHandlers=null},iu=function(a){Object.defineProperty(a,"open",{get:function(){return this.hasAttribute("open")},set:function(b){return $APP.n(b)?du(this):eu(this)},enumerable:!0,configurable:!0});Object.defineProperty(a,"placement",{get:function(){var b=this.getAttribute("placement");
|
|
11
|
-
null?this.removeAttribute("placement"):this.setAttribute("placement",""+$APP.S.g(b))},enumerable:!0,configurable:!0});Object.defineProperty(a,"label",{get:function(){var b=this.getAttribute("label");return $APP.n(b)?b:"Drawer"},set:function(b){return b==null?this.removeAttribute("label"):this.setAttribute("label",""+$APP.S.g(b))},enumerable:!0,configurable:!0});Object.defineProperty(a,"show",{value:function(){return du(this)},enumerable:!0,configurable:!0,
|
|
12
|
-
{value:function(){return eu(this)},enumerable:!0,configurable:!0,writable:!0});Object.defineProperty(a,"toggle",{value:function(){$APP.n(this.hasAttribute("open"))?eu(this):du(this);return null},enumerable:!0,configurable:!0,writable:!0})},ku=function(){if(!$APP.n(customElements.get("x-drawer"))){var a=class extends HTMLElement{};a.observedAttributes=ju;a.prototype.connectedCallback=function(){Xt(this);hu(this);gu(this);fu(this);return null};a.prototype.disconnectedCallback=
|
|
13
|
-
return null};a.prototype.attributeChangedCallback=function(b,c,d){$APP.N(c,d)&&fu(this);return null};iu(a.prototype);customElements.define("x-drawer",a)}return null},lu=function(){return ku()};var Yt=new $APP.R(null,new $APP.P(null,4,["right",null,"top",null,"bottom",null,"left",null],null),null),ju=["open","placement","label"];$APP.wd(["x-drawer-toggle",new $APP.P(null,2,[$APP.wi,!1,$APP.Y,new $APP.P(null,1,[$APP.si,$APP.Li],null)],null),"x-drawer-dismiss",new $APP.P(null,2,[$APP.wi,!1,$APP.Y,new $APP.P(null,1,[$APP.xh,$APP.X],null)],null)]);$APP.ka("baredom.exports.x_drawer.init",lu);export const init=lu;
|
|
7
|
+
$APP.Pi.g(c),e=$APP.l(a,"__xDrawerPrevOpen");a.setAttribute("data-open",$APP.n(d)?"true":"false");a.setAttribute("data-placement",$APP.Ai.g(c));b.setAttribute("aria-label",$APP.W.g(c));$APP.n(d)?b.removeAttribute("aria-hidden"):b.setAttribute("aria-hidden","true");$APP.N(e,d)&&(a.__xDrawerPrevOpen=d,$t(a,"x-drawer-toggle",{open:d}),$APP.n(d)?setTimeout(function(){var g=$APP.l(a,"__xDrawerRefs");g=$APP.n(g)?$APP.l(g,"panel"):null;var h=au(a);a.__xDrawerRestore=document.activeElement;var k=$APP.n(h)?
|
|
8
|
+
$APP.xg(h):null;a.__xDrawerTabbables=k;$APP.u(h)?$APP.x(h).focus():$APP.n(g)&&($APP.n(g.hasAttribute("tabindex"))||(g.setAttribute("tabindex","-1"),a.__xDrawerPanelTab=!0),g.focus());return null},0):bu(a))},gu=function(a){function b(g){var h=g.key;if($APP.E.h(h,"Escape"))g.preventDefault(),cu(a,"escape");else if($APP.E.h(h,"Tab")){h=$APP.l(a,"__xDrawerTabbables");h=$APP.n(h)?$APP.be($APP.gc(h)):$APP.Ld;var k=$APP.l(a,"__xDrawerRefs");k=$APP.n(k)?$APP.l(k,"panel"):null;if($APP.rc(h))g.preventDefault(),
|
|
9
|
+
$APP.n(k)&&k.focus();else{k=document.activeElement;var m=$APP.x(h);h=$APP.ic(h);var q=g.shiftKey;$APP.n($APP.n(q)?$APP.E.h(k,m):q)?(g.preventDefault(),h.focus()):$APP.p(q)&&$APP.E.h(k,h)&&(g.preventDefault(),m.focus())}}return null}function c(){return cu(a,"backdrop")}var d=Xt(a),e=$APP.l(d,"panel");$APP.l(d,"backdrop").addEventListener("click",c);e.addEventListener("keydown",b);$APP.ma(a,"__xDrawerHandlers",{backdrop:c,keydown:b})},hu=function(a){var b=$APP.l(a,"__xDrawerHandlers"),c=$APP.l(a,"__xDrawerRefs");
|
|
10
|
+
if($APP.n($APP.n(b)?c:b)){var d=$APP.l(c,"backdrop");c=$APP.l(c,"panel");var e=$APP.l(b,"backdrop");b=$APP.l(b,"keydown");$APP.n(e)&&d.removeEventListener("click",e);$APP.n(b)&&c.removeEventListener("keydown",b)}a.__xDrawerHandlers=null},iu=function(a){Object.defineProperty(a,"open",{get:function(){return this.hasAttribute("open")},set:function(b){return $APP.n(b)?du(this):eu(this)},enumerable:!0,configurable:!0});Object.defineProperty(a,"placement",{get:function(){var b=this.getAttribute("placement");
|
|
11
|
+
return $APP.n(b)?b:"right"},set:function(b){return b==null?this.removeAttribute("placement"):this.setAttribute("placement",""+$APP.S.g(b))},enumerable:!0,configurable:!0});Object.defineProperty(a,"label",{get:function(){var b=this.getAttribute("label");return $APP.n(b)?b:"Drawer"},set:function(b){return b==null?this.removeAttribute("label"):this.setAttribute("label",""+$APP.S.g(b))},enumerable:!0,configurable:!0});Object.defineProperty(a,"show",{value:function(){return du(this)},enumerable:!0,configurable:!0,
|
|
12
|
+
writable:!0});Object.defineProperty(a,"hide",{value:function(){return eu(this)},enumerable:!0,configurable:!0,writable:!0});Object.defineProperty(a,"toggle",{value:function(){$APP.n(this.hasAttribute("open"))?eu(this):du(this);return null},enumerable:!0,configurable:!0,writable:!0})},ku=function(){if(!$APP.n(customElements.get("x-drawer"))){var a=class extends HTMLElement{};a.observedAttributes=ju;a.prototype.connectedCallback=function(){Xt(this);hu(this);gu(this);fu(this);return null};a.prototype.disconnectedCallback=
|
|
13
|
+
function(){hu(this);bu(this);return null};a.prototype.attributeChangedCallback=function(b,c,d){$APP.N(c,d)&&fu(this);return null};iu(a.prototype);customElements.define("x-drawer",a)}return null},lu=function(){return ku()};var Yt=new $APP.R(null,new $APP.P(null,4,["right",null,"top",null,"bottom",null,"left",null],null),null),ju=["open","placement","label"];$APP.wd(["x-drawer-toggle",new $APP.P(null,2,[$APP.wi,!1,$APP.Y,new $APP.P(null,1,[$APP.si,$APP.Li],null)],null),"x-drawer-dismiss",new $APP.P(null,2,[$APP.wi,!1,$APP.Y,new $APP.P(null,1,[$APP.xh,$APP.X],null)],null)]);$APP.ka("baredom.exports.x_drawer.init",lu);export const init=lu;
|
package/dist/x-dropdown.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var Ll=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},Nl=function(a){var b=$APP.l(a,"__xDropdownRefs");if($APP.n(b)){var c=$APP.l(b,"trigger"),d=$APP.l(b,"label");b=$APP.l(b,"panel");var e=a.hasAttribute("open"),
|
|
2
|
+
var Ll=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},Nl=function(a){var b=$APP.l(a,"__xDropdownRefs");if($APP.n(b)){var c=$APP.l(b,"trigger"),d=$APP.l(b,"label");b=$APP.l(b,"panel");var e=a.hasAttribute("open"),g=a.hasAttribute("disabled");var h=a.getAttribute("label");h=$APP.n(h)?h:"";a=a.getAttribute("placement");a=$APP.Cc(Ml,a)?a:"bottom-start";d.textContent=h;c.setAttribute("aria-expanded",$APP.n(e)?"true":"false");Ll(c,"disabled",g);return b.setAttribute("data-placement",
|
|
3
3
|
a)}return null},Ol=function(a,b){if($APP.n(a.hasAttribute("disabled")))return null;var c=$APP.p(a.hasAttribute("open"));b=new CustomEvent("x-dropdown-toggle",{detail:{open:c,source:b},bubbles:!0,composed:!0,cancelable:!0});a.dispatchEvent(b);return $APP.p(b.defaultPrevented)?(c?a.setAttribute("open",""):a.removeAttribute("open"),a.dispatchEvent(new CustomEvent("x-dropdown-change",{detail:{open:c},bubbles:!0,composed:!0,cancelable:!1}))):null},Pl=function(a){var b=$APP.l(a,"__xDropdownHandlers");if($APP.n(b)){var c=
|
|
4
4
|
$APP.l(b,"docClick"),d=$APP.l(b,"docKeydown");return setTimeout(function(){return $APP.n(a.hasAttribute("open"))?(document.addEventListener("click",c),document.addEventListener("keydown",d)):null},0)}return null},Ql=function(a){a=$APP.l(a,"__xDropdownHandlers");if($APP.n(a)){var b=$APP.l(a,"docKeydown");document.removeEventListener("click",$APP.l(a,"docClick"));return document.removeEventListener("keydown",b)}return null},Rl=function(a){return{triggerClick:function(){return Ol(a,"pointer")},triggerKeydown:function(b){var c=
|
|
5
|
-
b.key;return $APP.
|
|
5
|
+
b.key;return $APP.E.h(c," ")||$APP.E.h(c,"Enter")?(b.preventDefault(),Ol(a,"keyboard")):null},hostFocusout:function(b){return $APP.n(a.hasAttribute("open"))?(b=b.relatedTarget,b==null||$APP.p(a.contains(b))?Ol(a,"focusout"):null):null},docClick:function(b){return $APP.n(a.hasAttribute("open"))?(b=$APP.hc(b.composedPath()),b=$APP.Ad(function(c){return c===a},b),$APP.n(b)?null:Ol(a,"outside-click")):null},docKeydown:function(b){b=$APP.E.h(b.key,"Escape");return $APP.n(b?a.hasAttribute("open"):b)?Ol(a,
|
|
6
6
|
"escape"):null}}},Sl=function(a){var b=$APP.l(a,"__xDropdownRefs");if($APP.n(b)){var c=$APP.l(a,"__xDropdownHandlers");$APP.n(c)&&(b=$APP.l(b,"trigger"),b.removeEventListener("click",$APP.l(c,"triggerClick")),b.removeEventListener("keydown",$APP.l(c,"triggerKeydown")),a.removeEventListener("focusout",$APP.l(c,"hostFocusout")))}},Tl=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute(c)},set:function(d){return Ll(this,c,$APP.J(d))}})},Ul=
|
|
7
7
|
function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){var d=this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){d!=null&&$APP.N(d)?(d=""+$APP.S.g(d),d=this.setAttribute(c,d)):d=this.removeAttribute(c);return d}})},Wl=function(){var a=class extends HTMLElement{},b=a.prototype;Object.defineProperty(a,"observedAttributes",{get:function(){return Vl}});Tl(b,"open","open");Tl(b,"disabled","disabled");Ul(b,"label","label");Ul(b,"placement","placement");b.show=function(){return $APP.n(this.hasAttribute("open"))?
|
|
8
|
-
null:Ol(this,"programmatic")};b.hide=function(){return $APP.n(this.hasAttribute("open"))?Ol(this,"programmatic"):null};b.toggle=function(){return Ol(this,"programmatic")};b.connectedCallback=function(){if(!$APP.n($APP.l(this,"__xDropdownRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("button"),
|
|
8
|
+
null:Ol(this,"programmatic")};b.hide=function(){return $APP.n(this.hasAttribute("open"))?Ol(this,"programmatic"):null};b.toggle=function(){return Ol(this,"programmatic")};b.connectedCallback=function(){if(!$APP.n($APP.l(this,"__xDropdownRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("button"),g=document.createElement("span"),h=document.createElement("span"),k=document.createElement("div"),m=document.createElement("div"),q=document.createElement("slot");
|
|
9
9
|
d.textContent=":host{display:inline-block;position:relative;color-scheme:light dark;--x-dropdown-trigger-bg:#f8fafc;--x-dropdown-trigger-bg-hover:#f1f5f9;--x-dropdown-trigger-bg-active:#e2e8f0;--x-dropdown-trigger-color:#0f172a;--x-dropdown-trigger-border:1px solid #e2e8f0;--x-dropdown-trigger-radius:6px;--x-dropdown-trigger-padding:0 0.75rem;--x-dropdown-trigger-height:2.25rem;--x-dropdown-trigger-font-size:0.9375rem;--x-dropdown-trigger-font-weight:500;--x-dropdown-chevron-color:#64748b;--x-dropdown-focus-ring:#60a5fa;--x-dropdown-panel-bg:#ffffff;--x-dropdown-panel-border:1px solid #e2e8f0;--x-dropdown-panel-radius:8px;--x-dropdown-panel-shadow:0 4px 16px rgba(0,0,0,0.12);--x-dropdown-panel-padding:0.25rem;--x-dropdown-panel-min-width:10rem;--x-dropdown-panel-max-height:20rem;--x-dropdown-panel-offset:4px;--x-dropdown-transition-duration:150ms;--x-dropdown-transition-easing:ease;}@media (prefers-color-scheme:dark){:host{--x-dropdown-trigger-bg:#1e293b;--x-dropdown-trigger-bg-hover:#334155;--x-dropdown-trigger-bg-active:#475569;--x-dropdown-trigger-color:#e2e8f0;--x-dropdown-trigger-border:1px solid #334155;--x-dropdown-chevron-color:#94a3b8;--x-dropdown-focus-ring:#93c5fd;--x-dropdown-panel-bg:#1e293b;--x-dropdown-panel-border:1px solid #334155;--x-dropdown-panel-shadow:0 4px 24px rgba(0,0,0,0.4);}}[part\x3dtrigger]{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;gap:0.375rem;height:var(--x-dropdown-trigger-height);padding:var(--x-dropdown-trigger-padding);background:var(--x-dropdown-trigger-bg);color:var(--x-dropdown-trigger-color);border:var(--x-dropdown-trigger-border);border-radius:var(--x-dropdown-trigger-radius);font-size:var(--x-dropdown-trigger-font-size);font-weight:var(--x-dropdown-trigger-font-weight);font-family:inherit;cursor:pointer;user-select:none;white-space:nowrap;}[part\x3dtrigger]:hover:not(:disabled){background:var(--x-dropdown-trigger-bg-hover);}[part\x3dtrigger]:active:not(:disabled){background:var(--x-dropdown-trigger-bg-active);}[part\x3dtrigger]:disabled{cursor:default;opacity:0.55;}[part\x3dtrigger]:focus-visible{outline:none;box-shadow:0 0 0 2px var(--x-dropdown-focus-ring);}[part\x3dtrigger-label]{flex:1;}[part\x3dchevron]{display:inline-block;color:var(--x-dropdown-chevron-color);font-style:normal;flex-shrink:0;transition:transform 200ms ease;}:host([open]) [part\x3dchevron]{transform:rotate(180deg);}[part\x3dpanel]{position:absolute;z-index:1000;box-sizing:border-box;background:var(--x-dropdown-panel-bg);border:var(--x-dropdown-panel-border);border-radius:var(--x-dropdown-panel-radius);box-shadow:var(--x-dropdown-panel-shadow);padding:var(--x-dropdown-panel-padding);min-width:var(--x-dropdown-panel-min-width);max-height:var(--x-dropdown-panel-max-height);overflow-y:auto;visibility:hidden;pointer-events:none;opacity:0;transform:scaleY(0.95);transition:opacity var(--x-dropdown-transition-duration) var(--x-dropdown-transition-easing),transform var(--x-dropdown-transition-duration) var(--x-dropdown-transition-easing),visibility 0s var(--x-dropdown-transition-duration);}:host([open]) [part\x3dpanel]{visibility:visible;pointer-events:auto;opacity:1;transform:scaleY(1);transition:opacity var(--x-dropdown-transition-duration) var(--x-dropdown-transition-easing),transform var(--x-dropdown-transition-duration) var(--x-dropdown-transition-easing),visibility 0s 0s;}[part\x3dpanel][data-placement\x3dbottom-start]{top:calc(100% + var(--x-dropdown-panel-offset));left:0;transform-origin:top left;}[part\x3dpanel][data-placement\x3dbottom-end]{top:calc(100% + var(--x-dropdown-panel-offset));right:0;transform-origin:top right;}[part\x3dpanel][data-placement\x3dtop-start]{bottom:calc(100% + var(--x-dropdown-panel-offset));left:0;transform-origin:bottom left;}[part\x3dpanel][data-placement\x3dtop-end]{bottom:calc(100% + var(--x-dropdown-panel-offset));right:0;transform-origin:bottom right;}[part\x3dpanel-inner]{display:contents;}@media (prefers-reduced-motion:reduce){[part\x3dpanel]{transition:none !important;}[part\x3dchevron]{transition:none !important;}}";
|
|
10
|
-
e.setAttribute("part","trigger");e.setAttribute("type","button");e.setAttribute("aria-haspopup","true");e.setAttribute("aria-expanded","false");e.setAttribute("aria-controls","panel");
|
|
11
|
-
k.appendChild(m);c.appendChild(d);c.appendChild(e);c.appendChild(k);this.__xDropdownRefs={trigger:e,label:
|
|
12
|
-
Pl(this);return Nl(this)};b.disconnectedCallback=function(){Sl(this);return Ql(this)};b.attributeChangedCallback=function(c){$APP.n($APP.l(this,"__xDropdownRefs"))?(Nl(this),c=$APP.
|
|
10
|
+
e.setAttribute("part","trigger");e.setAttribute("type","button");e.setAttribute("aria-haspopup","true");e.setAttribute("aria-expanded","false");e.setAttribute("aria-controls","panel");g.setAttribute("part","trigger-label");h.setAttribute("part","chevron");h.setAttribute("aria-hidden","true");h.textContent="▾";k.setAttribute("part","panel");k.setAttribute("id","panel");k.setAttribute("data-placement","bottom-start");m.setAttribute("part","panel-inner");e.appendChild(g);e.appendChild(h);m.appendChild(q);
|
|
11
|
+
k.appendChild(m);c.appendChild(d);c.appendChild(e);c.appendChild(k);this.__xDropdownRefs={trigger:e,label:g,chevron:h,panel:k}}Sl(this);Ql(this);this.__xDropdownHandlers=Rl(this);d=$APP.l(this,"__xDropdownRefs");$APP.n(d)&&(c=$APP.l(this,"__xDropdownHandlers"),$APP.n(c)&&(d=$APP.l(d,"trigger"),d.addEventListener("click",$APP.l(c,"triggerClick")),d.addEventListener("keydown",$APP.l(c,"triggerKeydown")),this.addEventListener("focusout",$APP.l(c,"hostFocusout"))));$APP.n(this.hasAttribute("open"))&&
|
|
12
|
+
Pl(this);return Nl(this)};b.disconnectedCallback=function(){Sl(this);return Ql(this)};b.attributeChangedCallback=function(c){$APP.n($APP.l(this,"__xDropdownRefs"))?(Nl(this),c=$APP.E.h(c,"open")?$APP.n(this.hasAttribute("open"))?Pl(this):Ql(this):null):c=null;return c};return a},Xl=function(){return $APP.n(customElements.get("x-dropdown"))?null:customElements.define("x-dropdown",Wl())};var Ml=new $APP.R(null,new $APP.P(null,4,["bottom-start",null,"bottom-end",null,"top-end",null,"top-start",null],null),null),Vl=["open","disabled","label","placement"];$APP.wd(["x-dropdown-toggle",new $APP.P(null,2,[$APP.wi,!0,$APP.Y,new $APP.P(null,2,[$APP.si,$APP.Li,$APP.Ch,$APP.X],null)],null),"x-dropdown-change",new $APP.P(null,2,[$APP.wi,!1,$APP.Y,new $APP.P(null,1,[$APP.si,$APP.Li],null)],null)]);$APP.ka("baredom.exports.x_dropdown.init",Xl);export const init=Xl;
|
package/dist/x-fieldset.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var Vs=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},Zs=function(a){var b=$APP.l(a,"__xFieldsetRefs");if($APP.n(b)){var c=$APP.l(b,"root-el");b=$APP.l(b,"
|
|
3
|
-
new $APP.P(null,5,[Xs,
|
|
4
|
-
|
|
5
|
-
return b}})},ct=function(){var a=class extends HTMLElement{},b=a.prototype;Object.defineProperty(a,"observedAttributes",{get:function(){return bt}});at(b);$s(b);b.connectedCallback=function(){if(!$APP.n($APP.l(this,"__xFieldsetRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("div"),
|
|
6
|
-
e.setAttribute("part","root");e.setAttribute("role","group");
|
|
2
|
+
var Vs=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},Zs=function(a){var b=$APP.l(a,"__xFieldsetRefs");if($APP.n(b)){var c=$APP.l(b,"root-el"),d=$APP.l(b,"legend-el");b=$APP.l(b,"content-el");var e=a.getAttribute("legend");e=new $APP.P(null,4,[Ws,e,$APP.$h,a.hasAttribute("disabled"),$APP.Ei,a.getAttribute("aria-label"),$APP.ki,a.getAttribute("aria-describedby")],null);var g=$APP.M(e),h=$APP.I(g,Ws);var k=$APP.I(g,$APP.$h);e=$APP.I(g,$APP.Ei);g=$APP.I(g,$APP.ki);h=$APP.n(h)?
|
|
3
|
+
h:"";k=$APP.J(k);k=new $APP.P(null,5,[Xs,h,Ys,$APP.N(h,""),$APP.U,k,$APP.bi,e,$APP.Xi,g],null);h=Xs.g(k);g=Ys.g(k);e=$APP.U.g(k);d.textContent=h;$APP.n(g)?d.removeAttribute("hidden"):d.setAttribute("hidden","");d=$APP.bi.g(k);$APP.n(d)?(c.setAttribute("aria-label",d),c.removeAttribute("aria-labelledby")):(c.removeAttribute("aria-label"),$APP.n(g)?c.setAttribute("aria-labelledby","x-fieldset-legend"):c.removeAttribute("aria-labelledby"));d=$APP.Xi.g(k);$APP.n(d)?c.setAttribute("aria-describedby",d):
|
|
4
|
+
c.removeAttribute("aria-describedby");Vs(a,"data-disabled",e);return Vs(b,"inert",e)}return null},$s=function(a){Object.defineProperty(a,"disabled",{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute("disabled")},set:function(b){return Vs(this,"disabled",$APP.J(b))}})},at=function(a){Object.defineProperty(a,"legend",{configurable:!0,enumerable:!0,get:function(){var b=this.getAttribute("legend");return $APP.n(b)?b:null},set:function(b){b!=null&&$APP.N(b)?(b=""+$APP.S.g(b),b=this.setAttribute("legend",
|
|
5
|
+
b)):b=this.removeAttribute("legend");return b}})},ct=function(){var a=class extends HTMLElement{},b=a.prototype;Object.defineProperty(a,"observedAttributes",{get:function(){return bt}});at(b);$s(b);b.connectedCallback=function(){if(!$APP.n($APP.l(this,"__xFieldsetRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("div"),g=document.createElement("div"),h=document.createElement("div"),k=document.createElement("slot");d.textContent=":host{display:block;color-scheme:light dark;--x-fieldset-border-color:#d1d5db;--x-fieldset-border-width:1px;--x-fieldset-border-radius:8px;--x-fieldset-padding:1rem;--x-fieldset-gap:0.75rem;--x-fieldset-bg:transparent;--x-fieldset-legend-color:#374151;--x-fieldset-legend-font-size:0.875rem;--x-fieldset-legend-font-weight:600;--x-fieldset-legend-padding:0 0.375rem;--x-fieldset-disabled-opacity:0.45;}@media (prefers-color-scheme:dark){:host{--x-fieldset-border-color:#374151;--x-fieldset-legend-color:#d1d5db;}}[part\x3droot]{display:block;border:var(--x-fieldset-border-width) solid var(--x-fieldset-border-color);border-radius:var(--x-fieldset-border-radius);padding:var(--x-fieldset-padding);background:var(--x-fieldset-bg);position:relative;}:host([data-disabled]) [part\x3droot]{opacity:var(--x-fieldset-disabled-opacity);}[part\x3dlegend]{display:block;position:absolute;top:calc(-0.5em);left:calc(var(--x-fieldset-border-radius) - 0.375rem);padding:var(--x-fieldset-legend-padding);color:var(--x-fieldset-legend-color);font-size:var(--x-fieldset-legend-font-size);font-weight:var(--x-fieldset-legend-font-weight);background:inherit;line-height:1;white-space:nowrap;}[part\x3dlegend][hidden]{display:none;}[part\x3dcontent]{display:flex;flex-direction:column;gap:var(--x-fieldset-gap);}@media (prefers-reduced-motion:reduce){}";
|
|
6
|
+
e.setAttribute("part","root");e.setAttribute("role","group");g.setAttribute("part","legend");g.setAttribute("id","x-fieldset-legend");h.setAttribute("part","content");h.appendChild(k);e.appendChild(g);e.appendChild(h);c.appendChild(d);c.appendChild(e);this.__xFieldsetRefs={root:c,"root-el":e,"legend-el":g,"content-el":h}}return Zs(this)};b.disconnectedCallback=function(){return null};b.attributeChangedCallback=function(){return Zs(this)};return a},dt=function(){return $APP.n(customElements.get("x-fieldset"))?
|
|
7
7
|
null:customElements.define("x-fieldset",ct())},Xs=new $APP.K(null,"legend","legend",-1027192245),Ys=new $APP.K(null,"legend-visible?","legend-visible?",-281107501),Ws=new $APP.K(null,"legend-raw","legend-raw",907427195);var bt=["legend","disabled","aria-label","aria-describedby"];$APP.ka("baredom.exports.x_fieldset.init",dt);export const init=dt;
|
package/dist/x-file-download.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
2
|
var Qp=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},Up=function(a){a=new $APP.P(null,4,[Rp,a.getAttribute("href"),Sp,a.getAttribute("filename"),$APP.$h,a.hasAttribute("disabled"),$APP.Ei,a.getAttribute("aria-label")],null);var b=$APP.M(a);a=$APP.I(b,Rp);var c=$APP.I(b,Sp),d=$APP.I(b,$APP.$h);b=$APP.I(b,$APP.Ei);return new $APP.P(null,4,[$APP.Yi,$APP.n(a)?a:"",Tp,$APP.n(c)?c:"",$APP.U,$APP.J(d),$APP.bi,b],null)},Vp=function(a){var b=$APP.l(a,"__xFileDownloadRefs");if($APP.n(b)){b=
|
|
3
|
-
$APP.l(b,"anchor-el");var c=Up(a),d=$APP.Yi.g(c),e=Tp.g(c),
|
|
4
|
-
c={href:$APP.Yi.g(c),filename:Tp.g(c)};c=new CustomEvent("x-file-download-click",{detail:c,bubbles:!0,composed:!0,cancelable:!0});a.dispatchEvent(c);return $APP.n(c.defaultPrevented)?b.preventDefault():null}},Xp=function(a){var b=$APP.l(a,"__xFileDownloadHandlers"),c=$APP.l(a,"__xFileDownloadRefs");$APP.n($APP.n(b)?c:b)&&(c=$APP.l(c,"anchor-el"),b=$APP.l(b,"click"),$APP.n(b)&&c.removeEventListener("click",b));return a.__xFileDownloadHandlers=null},Yp=function(a,b,c){Object.defineProperty(a,
|
|
5
|
-
enumerable:!0,get:function(){var d=this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){d!=null&&$APP.N(d)?(d=""+$APP.S.g(d),d=this.setAttribute(c,d)):d=this.removeAttribute(c);return d}})},Zp=function(a){Object.defineProperty(a,"disabled",{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute("disabled")},set:function(b){return Qp(this,"disabled",$APP.J(b))}})},aq=function(){var a=class extends HTMLElement{},b=a.prototype;Object.defineProperty(a,"observedAttributes",
|
|
6
|
-
Yp(b,"href","href");Yp(b,"filename","filename");Zp(b);b.connectedCallback=function(){if(!$APP.n($APP.l(this,"__xFileDownloadRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("a"),
|
|
7
|
-
e.setAttribute("part","anchor");
|
|
8
|
-
h.appendChild(k);e.appendChild(
|
|
3
|
+
$APP.l(b,"anchor-el");var c=Up(a),d=$APP.Yi.g(c),e=Tp.g(c),g=$APP.U.g(c);c=$APP.bi.g(c);b.href=d;typeof e==="string"&&$APP.N(e,"")?b.setAttribute("download",e):(e=typeof d==="string",$APP.n(e?d.startsWith("data:"):e)?b.setAttribute("download",""):b.removeAttribute("download"));$APP.n(g)?b.setAttribute("aria-disabled","true"):b.removeAttribute("aria-disabled");$APP.n(c)?b.setAttribute("aria-label",c):b.removeAttribute("aria-label");return Qp(a,"data-disabled",g)}return null},Wp=function(a){return function(b){if($APP.n(a.hasAttribute("disabled")))return b.preventDefault();
|
|
4
|
+
var c=Up(a);c={href:$APP.Yi.g(c),filename:Tp.g(c)};c=new CustomEvent("x-file-download-click",{detail:c,bubbles:!0,composed:!0,cancelable:!0});a.dispatchEvent(c);return $APP.n(c.defaultPrevented)?b.preventDefault():null}},Xp=function(a){var b=$APP.l(a,"__xFileDownloadHandlers"),c=$APP.l(a,"__xFileDownloadRefs");$APP.n($APP.n(b)?c:b)&&(c=$APP.l(c,"anchor-el"),b=$APP.l(b,"click"),$APP.n(b)&&c.removeEventListener("click",b));return a.__xFileDownloadHandlers=null},Yp=function(a,b,c){Object.defineProperty(a,
|
|
5
|
+
b,{configurable:!0,enumerable:!0,get:function(){var d=this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){d!=null&&$APP.N(d)?(d=""+$APP.S.g(d),d=this.setAttribute(c,d)):d=this.removeAttribute(c);return d}})},Zp=function(a){Object.defineProperty(a,"disabled",{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute("disabled")},set:function(b){return Qp(this,"disabled",$APP.J(b))}})},aq=function(){var a=class extends HTMLElement{},b=a.prototype;Object.defineProperty(a,"observedAttributes",
|
|
6
|
+
{get:function(){return $p}});Yp(b,"href","href");Yp(b,"filename","filename");Zp(b);b.connectedCallback=function(){if(!$APP.n($APP.l(this,"__xFileDownloadRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("a"),g=document.createElement("span"),h=document.createElement("span"),k=document.createElement("slot");d.textContent=":host{display:inline-block;color-scheme:light dark;--x-file-download-bg:#2563eb;--x-file-download-color:#ffffff;--x-file-download-hover-bg:#1d4ed8;--x-file-download-active-bg:#1e40af;--x-file-download-border-radius:6px;--x-file-download-padding:0.5rem 1rem;--x-file-download-font-size:0.875rem;--x-file-download-font-weight:500;--x-file-download-gap:0.375rem;--x-file-download-icon-size:1em;--x-file-download-focus-ring:#60a5fa;--x-file-download-disabled-opacity:0.45;--x-file-download-transition:background 120ms ease;}@media (prefers-color-scheme:dark){:host{--x-file-download-bg:#3b82f6;--x-file-download-hover-bg:#2563eb;--x-file-download-active-bg:#1d4ed8;--x-file-download-focus-ring:#93c5fd;}}[part\x3danchor]{display:inline-flex;align-items:center;gap:var(--x-file-download-gap);padding:var(--x-file-download-padding);background:var(--x-file-download-bg);color:var(--x-file-download-color);border-radius:var(--x-file-download-border-radius);font-size:var(--x-file-download-font-size);font-weight:var(--x-file-download-font-weight);text-decoration:none;cursor:pointer;box-sizing:border-box;transition:var(--x-file-download-transition);outline:none;user-select:none;-webkit-user-select:none;}[part\x3danchor]:hover{background:var(--x-file-download-hover-bg);}[part\x3danchor]:active{background:var(--x-file-download-active-bg);}[part\x3danchor]:focus-visible{outline:2px solid var(--x-file-download-focus-ring);outline-offset:2px;}[part\x3dicon]{display:inline-flex;align-items:center;justify-content:center;width:var(--x-file-download-icon-size);height:var(--x-file-download-icon-size);flex-shrink:0;}[part\x3dcontent]{display:inline;}:host([data-disabled]) [part\x3danchor]{opacity:var(--x-file-download-disabled-opacity);pointer-events:none;cursor:default;}@media (prefers-reduced-motion:reduce){[part\x3danchor]{transition:none;}}";
|
|
7
|
+
e.setAttribute("part","anchor");g.setAttribute("part","icon");h.setAttribute("part","content");g.innerHTML='\x3csvg xmlns\x3d"http://www.w3.org/2000/svg" viewBox\x3d"0 0 16 16" fill\x3d"currentColor" width\x3d"1em" height\x3d"1em" aria-hidden\x3d"true"\x3e\x3cpath d\x3d"M8 1a.75.75 0 0 1 .75.75v6.19l1.97-1.97a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.03a.75.75 0 0 1 1.06-1.06L7.25 7.94V1.75A.75.75 0 0 1 8 1ZM2.5 13.25a.75.75 0 0 1 .75-.75h9.5a.75.75 0 0 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75Z"/\x3e\x3c/svg\x3e';
|
|
8
|
+
h.appendChild(k);e.appendChild(g);e.appendChild(h);c.appendChild(d);c.appendChild(e);this.__xFileDownloadRefs={"anchor-el":e,"icon-el":g,"content-el":h}}Xp(this);c=Wp(this);$APP.l($APP.l(this,"__xFileDownloadRefs"),"anchor-el").addEventListener("click",c);this.__xFileDownloadHandlers={click:c};return Vp(this)};b.disconnectedCallback=function(){return Xp(this)};b.attributeChangedCallback=function(){return Vp(this)};return a},bq=function(){return $APP.n(customElements.get("x-file-download"))?null:customElements.define("x-file-download",
|
|
9
9
|
aq())},Sp=new $APP.K(null,"filename-raw","filename-raw",-706184256),Tp=new $APP.K(null,"filename","filename",-1428840783),Rp=new $APP.K(null,"href-raw","href-raw",-1680949453);var $p=["href","filename","disabled","aria-label"];$APP.ka("baredom.exports.x_file_download.init",bq);export const init=bq;
|
package/dist/x-form-field.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
e=$APP.l(b,"hint");b=$APP.l(b,"error");var
|
|
4
|
-
|
|
5
|
-
"string"&&$APP.Cc(
|
|
6
|
-
$APP.n(C)?"hint":$APP.n(
|
|
7
|
-
|
|
8
|
-
if($APP.n(b)){b=$APP.l(b,"input");var c=b.value;var d=a.getAttribute("name");d=$APP.n(d)?d:"";var e=$APP.l(a,"__xFormFieldInternals");$APP.n(e)&&(e.setFormValue(c),
|
|
9
|
-
null;return}}return null},
|
|
10
|
-
enumerable:!0,get:function(){var b=$APP.l(this,"__xFormFieldRefs");if($APP.n(b))return $APP.l(b,"input").value;b=this.getAttribute("value");return $APP.n(b)?b:""},set:function(b){b=b!=null&&$APP.N(b)?""+$APP.S.g(b):"";this.setAttribute("value",b);var c=$APP.l(this,"__xFormFieldRefs");return $APP.n(c)?$APP.l(c,"input").value=b:null}})},
|
|
11
|
-
"name","name");
|
|
12
|
-
d.textContent=":host{display:block;color-scheme:light dark;--x-form-field-label-color:#374151;--x-form-field-label-font-size:0.875rem;--x-form-field-input-bg:#ffffff;--x-form-field-input-color:#111827;--x-form-field-input-border:1px solid #d1d5db;--x-form-field-input-border-radius:6px;--x-form-field-input-padding:0.5rem 0.75rem;--x-form-field-focus-ring-color:#2563eb;--x-form-field-error-color:#dc2626;--x-form-field-hint-color:#6b7280;--x-form-field-disabled-opacity:0.45;}@media (prefers-color-scheme:dark){:host{--x-form-field-label-color:#d1d5db;--x-form-field-input-bg:#1f2937;--x-form-field-input-color:#f9fafb;--x-form-field-input-border:1px solid #4b5563;--x-form-field-focus-ring-color:#3b82f6;--x-form-field-error-color:#f87171;--x-form-field-hint-color:#9ca3af;}}[part\x3dfield]{display:flex;flex-direction:column;gap:0.25rem;}[part\x3dlabel]{display:block;font-size:var(--x-form-field-label-font-size);font-weight:500;color:var(--x-form-field-label-color);}.label-hidden{display:none;}[part\x3dinput-wrapper]{display:block;}[part\x3dinput]{display:block;width:100%;box-sizing:border-box;padding:var(--x-form-field-input-padding);background:var(--x-form-field-input-bg);color:var(--x-form-field-input-color);border:var(--x-form-field-input-border);border-radius:var(--x-form-field-input-border-radius);font-size:1rem;line-height:1.5;font-family:inherit;outline:none;transition:border-color 120ms ease,box-shadow 120ms ease;}[part\x3dinput]:focus{border-color:var(--x-form-field-focus-ring-color);box-shadow:0 0 0 3px color-mix(in srgb,var(--x-form-field-focus-ring-color) 20%,transparent);}:host([data-invalid]) [part\x3dinput]{border-color:var(--x-form-field-error-color);}:host([data-invalid]) [part\x3dinput]:focus{box-shadow:0 0 0 3px color-mix(in srgb,var(--x-form-field-error-color) 20%,transparent);}[part\x3dinput]:disabled{opacity:var(--x-form-field-disabled-opacity);cursor:not-allowed;}[part\x3dhint]{display:block;font-size:0.8125rem;color:var(--x-form-field-hint-color);}.hint-hidden{display:none;}[part\x3derror]{display:block;font-size:0.8125rem;color:var(--x-form-field-error-color);}.error-hidden{display:none;}@media (prefers-reduced-motion:reduce){[part\x3dinput]{transition:none;}}";
|
|
13
|
-
e.setAttribute("part","field");
|
|
14
|
-
e.appendChild(
|
|
15
|
-
"__xFormFieldRefs");$APP.n(c)&&(c=$APP.l(c,"input"),d=
|
|
16
|
-
return
|
|
2
|
+
var CB=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},DB=function(a,b,c){var d=a.hasAttribute("error");var e=a.getAttribute("error");e=$APP.n(e)?e:"";a=a.hasAttribute("required");var g=c.value;return $APP.n(d)?b.setValidity({customError:!0},e,c):$APP.n($APP.n(a)?$APP.E.h(g,""):a)?b.setValidity({valueMissing:!0},"Please fill in this field.",c):b.setValidity({},"",c)},FB=function(a){var b=$APP.l(a,"__xFormFieldRefs");if($APP.n(b)){var c=$APP.l(b,"label"),d=$APP.l(b,"input"),
|
|
3
|
+
e=$APP.l(b,"hint");b=$APP.l(b,"error");var g=$APP.bf([$APP.dh,$APP.Kh,$APP.th,$APP.Fh,$APP.$h,$APP.Cg,$APP.vi,$APP.Gi,$APP.ch,$APP.jh,$APP.wh],[a.getAttribute("label"),a.getAttribute("name"),a.getAttribute("error"),a.getAttribute("hint"),a.hasAttribute("disabled"),a.hasAttribute("required"),a.hasAttribute("readonly"),a.getAttribute("value"),a.getAttribute("autocomplete"),a.getAttribute("type"),a.getAttribute("placeholder")]);var h=$APP.M(g),k=$APP.I(h,$APP.wh),m=$APP.I(h,$APP.dh),q=$APP.I(h,$APP.Kh);
|
|
4
|
+
g=$APP.I(h,$APP.th);var r=$APP.I(h,$APP.Fh),v=$APP.I(h,$APP.$h),w=$APP.I(h,$APP.Cg),z=$APP.I(h,$APP.vi),A=$APP.I(h,$APP.Gi),C=$APP.I(h,$APP.ch),F=$APP.I(h,$APP.jh);h=$APP.n(g)?g:"";var D=$APP.n(r)?r:"",Q=$APP.n(m)?m:"",V=[$APP.bh,$APP.cj,$APP.Di,$APP.gh,$APP.ii,$APP.T,$APP.Nh,$APP.Z,$APP.kh,$APP.mi,$APP.W,$APP.qh,$APP.oi,$APP.U];w=$APP.J(w);z=$APP.J(z);k=$APP.n(k)?k:"";r=typeof r==="string"&&$APP.N(r,"")&&r!=null;q=$APP.n(q)?q:"";A=$APP.n(A)?A:"";m=typeof m==="string"&&$APP.N(m,"")&&m!=null;F=typeof F===
|
|
5
|
+
"string"&&$APP.Cc(EB,F)?F:"text";g=$APP.bf(V,[w,z,k,r,q,A,m,F,typeof g==="string"&&$APP.N(g,"")&&g!=null,D,Q,h,$APP.n(C)?C:"",$APP.J(v)]);v=$APP.kh.g(g);C=$APP.gh.g(g);h=$APP.Nh.g(g);d.type=$APP.Z.g(g);d.name=$APP.ii.g(g);d.placeholder=$APP.Di.g(g);d.disabled=$APP.U.g(g);d.readOnly=$APP.cj.g(g);d.required=$APP.bh.g(g);d.autocomplete=$APP.oi.g(g);D=$APP.n($APP.bh.g(g))?"true":"false";d.setAttribute("aria-required",D);d.setAttribute("aria-invalid",$APP.n(v)?"true":"false");D=$APP.n($APP.n(C)?v:C)?"hint error":
|
|
6
|
+
$APP.n(C)?"hint":$APP.n(v)?"error":null;$APP.n(D)?d.setAttribute("aria-describedby",D):d.removeAttribute("aria-describedby");c.textContent=$APP.W.g(g);$APP.n(h)?c.classList.remove("label-hidden"):c.classList.add("label-hidden");e.textContent=$APP.mi.g(g);$APP.n(C)?e.classList.remove("hint-hidden"):e.classList.add("hint-hidden");b.textContent=$APP.qh.g(g);$APP.n(v)?b.classList.remove("error-hidden"):b.classList.add("error-hidden");CB(a,"data-invalid",v);c=$APP.l(a,"__xFormFieldInternals");return $APP.n(c)?
|
|
7
|
+
DB(a,c,d):null}return null},GB=function(a,b,c){return a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,composed:!0,cancelable:!1}))},HB=function(a){return function(){var b=$APP.l(a,"__xFormFieldRefs");if($APP.n(b)){b=$APP.l(b,"input");var c=b.value;var d=a.getAttribute("name");d=$APP.n(d)?d:"";var e=$APP.l(a,"__xFormFieldInternals");$APP.n(e)&&(e.setFormValue(c),DB(a,e,b));return GB(a,"x-form-field-input",{name:d,value:c})}return null}},IB=function(a){return function(){var b=$APP.l(a,"__xFormFieldRefs");
|
|
8
|
+
if($APP.n(b)){b=$APP.l(b,"input");var c=b.value;var d=a.getAttribute("name");d=$APP.n(d)?d:"";var e=$APP.l(a,"__xFormFieldInternals");$APP.n(e)&&(e.setFormValue(c),DB(a,e,b));return GB(a,"x-form-field-change",{name:d,value:c})}return null}},JB=function(a){var b=$APP.l(a,"__xFormFieldRefs");if($APP.n(b)){var c=$APP.l(a,"__xFormFieldHandlers");if($APP.n(c)){b=$APP.l(b,"input");b.removeEventListener("input",$APP.l(c,"input"));b.removeEventListener("change",$APP.l(c,"change"));a.__xFormFieldHandlers=
|
|
9
|
+
null;return}}return null},KB=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){var d=this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){d!=null&&$APP.N(d)?(d=""+$APP.S.g(d),d=this.setAttribute(c,d)):d=this.removeAttribute(c);return d}})},LB=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute(c)},set:function(d){return CB(this,c,$APP.J(d))}})},MB=function(a){Object.defineProperty(a,"value",{configurable:!0,
|
|
10
|
+
enumerable:!0,get:function(){var b=$APP.l(this,"__xFormFieldRefs");if($APP.n(b))return $APP.l(b,"input").value;b=this.getAttribute("value");return $APP.n(b)?b:""},set:function(b){b=b!=null&&$APP.N(b)?""+$APP.S.g(b):"";this.setAttribute("value",b);var c=$APP.l(this,"__xFormFieldRefs");return $APP.n(c)?$APP.l(c,"input").value=b:null}})},OB=function(){var a=class extends HTMLElement{},b=a.prototype;a.formAssociated=!0;Object.defineProperty(a,"observedAttributes",{get:function(){return NB}});MB(b);KB(b,
|
|
11
|
+
"label","label");KB(b,"type","type");KB(b,"name","name");KB(b,"placeholder","placeholder");KB(b,"autocomplete","autocomplete");LB(b,"disabled","disabled");LB(b,"readOnly","readonly");LB(b,"required","required");b.connectedCallback=function(){if(!$APP.n($APP.l(this,"__xFormFieldRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("div"),g=document.createElement("label"),h=document.createElement("div"),k=document.createElement("input"),m=document.createElement("span"),
|
|
12
|
+
q=document.createElement("span");d.textContent=":host{display:block;color-scheme:light dark;--x-form-field-label-color:#374151;--x-form-field-label-font-size:0.875rem;--x-form-field-input-bg:#ffffff;--x-form-field-input-color:#111827;--x-form-field-input-border:1px solid #d1d5db;--x-form-field-input-border-radius:6px;--x-form-field-input-padding:0.5rem 0.75rem;--x-form-field-focus-ring-color:#2563eb;--x-form-field-error-color:#dc2626;--x-form-field-hint-color:#6b7280;--x-form-field-disabled-opacity:0.45;}@media (prefers-color-scheme:dark){:host{--x-form-field-label-color:#d1d5db;--x-form-field-input-bg:#1f2937;--x-form-field-input-color:#f9fafb;--x-form-field-input-border:1px solid #4b5563;--x-form-field-focus-ring-color:#3b82f6;--x-form-field-error-color:#f87171;--x-form-field-hint-color:#9ca3af;}}[part\x3dfield]{display:flex;flex-direction:column;gap:0.25rem;}[part\x3dlabel]{display:block;font-size:var(--x-form-field-label-font-size);font-weight:500;color:var(--x-form-field-label-color);}.label-hidden{display:none;}[part\x3dinput-wrapper]{display:block;}[part\x3dinput]{display:block;width:100%;box-sizing:border-box;padding:var(--x-form-field-input-padding);background:var(--x-form-field-input-bg);color:var(--x-form-field-input-color);border:var(--x-form-field-input-border);border-radius:var(--x-form-field-input-border-radius);font-size:1rem;line-height:1.5;font-family:inherit;outline:none;transition:border-color 120ms ease,box-shadow 120ms ease;}[part\x3dinput]:focus{border-color:var(--x-form-field-focus-ring-color);box-shadow:0 0 0 3px color-mix(in srgb,var(--x-form-field-focus-ring-color) 20%,transparent);}:host([data-invalid]) [part\x3dinput]{border-color:var(--x-form-field-error-color);}:host([data-invalid]) [part\x3dinput]:focus{box-shadow:0 0 0 3px color-mix(in srgb,var(--x-form-field-error-color) 20%,transparent);}[part\x3dinput]:disabled{opacity:var(--x-form-field-disabled-opacity);cursor:not-allowed;}[part\x3dhint]{display:block;font-size:0.8125rem;color:var(--x-form-field-hint-color);}.hint-hidden{display:none;}[part\x3derror]{display:block;font-size:0.8125rem;color:var(--x-form-field-error-color);}.error-hidden{display:none;}@media (prefers-reduced-motion:reduce){[part\x3dinput]{transition:none;}}";
|
|
13
|
+
e.setAttribute("part","field");g.setAttribute("part","label");g.setAttribute("id","label");g.setAttribute("for","input");h.setAttribute("part","input-wrapper");k.setAttribute("part","input");k.setAttribute("id","input");k.setAttribute("aria-labelledby","label");m.setAttribute("part","hint");m.setAttribute("id","hint");m.setAttribute("aria-live","polite");q.setAttribute("part","error");q.setAttribute("id","error");q.setAttribute("role","alert");q.setAttribute("aria-live","assertive");h.appendChild(k);
|
|
14
|
+
e.appendChild(g);e.appendChild(h);e.appendChild(m);e.appendChild(q);c.appendChild(d);c.appendChild(e);this.__xFormFieldRefs={field:e,label:g,input:k,hint:m,error:q};$APP.n(this.attachInternals)&&(this.__xFormFieldInternals=this.attachInternals())}JB(this);c=$APP.l(this,"__xFormFieldRefs");$APP.n(c)&&(c=$APP.l(c,"input"),d=this.getAttribute("value"),$APP.n(d)&&(c.value=d));c=$APP.l(this,"__xFormFieldInternals");$APP.n(c)&&(d=c.setFormValue,e=this.getAttribute("value"),d.call(c,$APP.n(e)?e:""));c=$APP.l(this,
|
|
15
|
+
"__xFormFieldRefs");$APP.n(c)&&(c=$APP.l(c,"input"),d=HB(this),e=IB(this),c.addEventListener("input",d),c.addEventListener("change",e),this.__xFormFieldHandlers={input:d,change:e});return FB(this)};b.disconnectedCallback=function(){return JB(this)};b.attributeChangedCallback=function(c,d,e){$APP.E.h(c,"value")&&(c=$APP.l(this,"__xFormFieldRefs"),$APP.n(c)&&(c=$APP.l(c,"input"),$APP.N(c.value,e)&&(c.value=$APP.n(e)?e:"")));return FB(this)};b.formDisabledCallback=function(c){CB(this,"disabled",$APP.J(c));
|
|
16
|
+
return FB(this)};b.formResetCallback=function(){this.removeAttribute("value");var c=$APP.l(this,"__xFormFieldRefs");$APP.n(c)&&($APP.l(c,"input").value="");c=$APP.l(this,"__xFormFieldInternals");$APP.n(c)&&c.setFormValue("");return FB(this)};return a},PB=function(){return $APP.n(customElements.get("x-form-field"))?null:customElements.define("x-form-field",OB())};var NB="label type name value placeholder hint error disabled readonly required autocomplete".split(" "),EB=new $APP.R(null,new $APP.P(null,6,["url",null,"tel",null,"email",null,"text",null,"number",null,"password",null],null),null);
|
|
17
|
+
$APP.bf([$APP.Di,$APP.yi,$APP.ii,$APP.T,$APP.ji,$APP.Z,$APP.W,$APP.oi,$APP.Ng],[new $APP.P(null,2,[$APP.Z,$APP.X,$APP.Qg,"placeholder"],null),new $APP.P(null,2,[$APP.Z,$APP.Li,$APP.Qg,"disabled"],null),new $APP.P(null,2,[$APP.Z,$APP.X,$APP.Qg,"name"],null),new $APP.P(null,2,[$APP.Z,$APP.X,$APP.Qg,"value"],null),new $APP.P(null,2,[$APP.Z,$APP.Li,$APP.Qg,"readonly"],null),new $APP.P(null,2,[$APP.Z,$APP.X,$APP.Qg,"type"],null),new $APP.P(null,2,[$APP.Z,$APP.X,$APP.Qg,"label"],null),new $APP.P(null,2,
|
|
18
|
+
[$APP.Z,$APP.X,$APP.Qg,"autocomplete"],null),new $APP.P(null,2,[$APP.Z,$APP.Li,$APP.Qg,"required"],null)]);$APP.ka("baredom.exports.x_form_field.init",PB);export const init=PB;
|
package/dist/x-form.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
if($APP.n($APP.oh.g(a)))return b.setAttribute("aria-busy","true"),b.setAttribute("data-loading","");b.removeAttribute("aria-busy");return b.removeAttribute("data-loading")}return null},
|
|
4
|
-
(b[
|
|
5
|
-
k=
|
|
6
|
-
var h=$APP.l(a,"__xFormRefs");if($APP.n(h)){h=$APP.l(h,"form");
|
|
7
|
-
b.removeEventListener("reset",$APP.l(c,"reset"));a.removeEventListener("click",$APP.l(c,"click"));a.__xFormHandlers=null;return}}return null},
|
|
8
|
-
b:""},set:function(b){return b!=null&&$APP.N(b)?
|
|
9
|
-
d.textContent=":host{display:block;}[part\x3droot]{display:flex;flex-direction:column;gap:var(--x-form-gap,1rem);width:var(--x-form-width,100%);}:host([loading]){pointer-events:none;opacity:0.6;}";e.setAttribute("part","root");e.setAttribute("novalidate","");e.appendChild(
|
|
10
|
-
$APP.l(this,"__xFormRefs");return $APP.n(c)?$APP.l(c,"form").requestSubmit():null};b.reset=function(){var c=$APP.l(this,"__xFormRefs");return $APP.n(c)?$APP.l(c,"form").reset():null};b.setFieldError=function(c,d){c=this.querySelector('[name\x3d"'+$APP.S.g(c)+'"]');return $APP.n(c)?d==null||$APP.
|
|
11
|
-
e+=1;else return null};return a},
|
|
2
|
+
var ry=function(a,b){return a.setAttribute("autocomplete",b)},wy=function(a){a=new $APP.P(null,3,[sy,a.getAttribute("loading"),ty,$APP.n(a.hasAttribute("novalidate"))?"":null,$APP.ch,a.getAttribute("autocomplete")],null);var b=$APP.M(a),c=$APP.I(b,sy);a=$APP.I(b,ty);b=$APP.I(b,$APP.ch);c=c!=null&&$APP.N(c,"false");b=$APP.Cc(uy,b)?b:"on";return new $APP.P(null,3,[$APP.oh,c,vy,a!=null,$APP.oi,b],null)},xy=function(a){var b=$APP.l(a,"__xFormRefs");if($APP.n(b)){b=$APP.l(b,"form");a=wy(a);ry(b,$APP.oi.g(a));
|
|
3
|
+
if($APP.n($APP.oh.g(a)))return b.setAttribute("aria-busy","true"),b.setAttribute("data-loading","");b.removeAttribute("aria-busy");return b.removeAttribute("data-loading")}return null},yy=function(a){a=a.querySelectorAll("[name]:not([disabled])");for(var b={},c=a.length,d=0;;)if(d<c){var e=a[d],g=e.name;if($APP.n(function(){var m=g;return $APP.n(m)?$APP.N(g,""):m}())){var h=e.tagName.toLowerCase(),k=e.getAttribute("type");$APP.E.h(k,"checkbox")||$APP.E.h(k,"radio")||$APP.E.h(h,"x-checkbox")?$APP.n(e.checked)&&
|
|
4
|
+
(b[g]=function(){var m=e.value;return $APP.n(m)?m:"on"}()):b[g]=function(){var m=e.value;return $APP.n(m)?m:""}()}d+=1}else break;return b},zy=function(a,b,c,d){return a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,composed:!0,cancelable:d}))},Ay=function(a){var b=$APP.l(a,"__xFormRefs");if($APP.n(b)){b=$APP.l(b,"form");var c=function(g){g.preventDefault();g=wy(a);if($APP.n($APP.oh.g(g)))g=null;else{g=vy.g(g);if(!$APP.n(g)){g=a.querySelectorAll("[name]:not([disabled])");for(var h={ok:!0},
|
|
5
|
+
k=g.length,m=0;;)if(m<k){var q=g[m];$APP.n(q.reportValidity)&&($APP.n(q.reportValidity())||(h.ok=!1));m+=1}else break;g=h.ok}$APP.n(g)?(g=yy(a),g=zy(a,"x-form-submit",{values:g},!0)):g=null}return g},d=function(){for(var g=a.querySelectorAll("[name]"),h=g.length,k=0;;)if(k<h){var m=g[k];$APP.n(m.formResetCallback)&&m.formResetCallback();k+=1}else break;return zy(a,"x-form-reset",{},!1)},e=function(g){a:{g=g.target.closest("button,input[type\x3dsubmit],input[type\x3dreset]");if($APP.n(g)){g=g.type;
|
|
6
|
+
var h=$APP.l(a,"__xFormRefs");if($APP.n(h)){h=$APP.l(h,"form");g=$APP.E.h(g,"submit")||$APP.E.h(g,"")?h.requestSubmit():$APP.E.h(g,"reset")?h.reset():null;break a}}g=null}return g};b.addEventListener("submit",c);b.addEventListener("reset",d);a.addEventListener("click",e);$APP.ma(a,"__xFormHandlers",{submit:c,reset:d,click:e})}},By=function(a){var b=$APP.l(a,"__xFormRefs");if($APP.n(b)){var c=$APP.l(a,"__xFormHandlers");if($APP.n(c)){b=$APP.l(b,"form");b.removeEventListener("submit",$APP.l(c,"submit"));
|
|
7
|
+
b.removeEventListener("reset",$APP.l(c,"reset"));a.removeEventListener("click",$APP.l(c,"click"));a.__xFormHandlers=null;return}}return null},Cy=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute(c)},set:function(d){return $APP.J(d)?this.setAttribute(c,""):this.removeAttribute(c)}})},Dy=function(a){Object.defineProperty(a,"autocomplete",{configurable:!0,enumerable:!0,get:function(){var b=this.getAttribute("autocomplete");return $APP.n(b)?
|
|
8
|
+
b:""},set:function(b){return b!=null&&$APP.N(b)?ry(this,""+$APP.S.g(b)):this.removeAttribute("autocomplete")}})},Fy=function(){var a=class extends HTMLElement{},b=a.prototype;Object.defineProperty(a,"observedAttributes",{get:function(){return Ey}});Cy(b,"loading","loading");Cy(b,"novalidate","novalidate");Dy(b);b.connectedCallback=function(){if(!$APP.n(this.shadowRoot)){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("form"),g=document.createElement("slot");
|
|
9
|
+
d.textContent=":host{display:block;}[part\x3droot]{display:flex;flex-direction:column;gap:var(--x-form-gap,1rem);width:var(--x-form-width,100%);}:host([loading]){pointer-events:none;opacity:0.6;}";e.setAttribute("part","root");e.setAttribute("novalidate","");e.appendChild(g);c.appendChild(d);c.appendChild(e);this.__xFormRefs={form:e}}By(this);Ay(this);return xy(this)};b.disconnectedCallback=function(){return By(this)};b.attributeChangedCallback=function(){return xy(this)};b.submit=function(){var c=
|
|
10
|
+
$APP.l(this,"__xFormRefs");return $APP.n(c)?$APP.l(c,"form").requestSubmit():null};b.reset=function(){var c=$APP.l(this,"__xFormRefs");return $APP.n(c)?$APP.l(c,"form").reset():null};b.setFieldError=function(c,d){c=this.querySelector('[name\x3d"'+$APP.S.g(c)+'"]');return $APP.n(c)?d==null||$APP.E.h(d,"")||$APP.E.h(d,void 0)?c.removeAttribute("error"):c.setAttribute("error",d):null};b.clearErrors=function(){for(var c=this.querySelectorAll("[error]"),d=c.length,e=0;;)if(e<d)c[e].removeAttribute("error"),
|
|
11
|
+
e+=1;else return null};return a},Gy=function(){return $APP.n(customElements.get("x-form"))?null:customElements.define("x-form",Fy())},sy=new $APP.K(null,"loading-raw","loading-raw",-1707143099),vy=new $APP.K(null,"novalidate?","novalidate?",491529885),ty=new $APP.K(null,"novalidate-raw","novalidate-raw",1783236714);var Ey=["loading","novalidate","autocomplete"],uy=new $APP.R(null,new $APP.P(null,2,["off",null,"on",null],null),null);$APP.ka("baredom.exports.x_form.init",Gy);export const init=Gy;
|
package/dist/x-grid.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
$APP.M(a);a=$APP.I(b,
|
|
4
|
-
|
|
5
|
-
c.setProperty("--x-grid-row-gap",
|
|
6
|
-
d.setAttribute("part","base");d.className="base";d.appendChild(e);b.appendChild(c);b.appendChild(d);a.__x_grid_root=b;a.__x_grid_base=d;a.__x_grid_initialized=!0}
|
|
7
|
-
|
|
8
|
-
-267946462),
|
|
2
|
+
var Hw=function(a){switch(a){case "none":return"0";case "xs":return"4px";case "sm":return"8px";case "md":return"16px";case "lg":return"24px";case "xl":return"32px";default:return"16px"}},Iw=function(a,b,c){return $APP.Cc(b,a)?a:c},Jw=function(a){switch(a){case "row-dense":return"row dense";case "column-dense":return"column dense";default:return a}},Kw=function(a){return $APP.n($APP.n(a)?$APP.N("",a):a)?a:null},Lw=function(a){return $APP.n($APP.n(a)?$APP.N("",a):a)?a:"16rem"},Zw=function(a){var b=
|
|
3
|
+
$APP.M(a);a=$APP.I(b,Mw);var c=$APP.I(b,Nw),d=$APP.I(b,Ow),e=$APP.I(b,Pw),g=$APP.I(b,Qw),h=$APP.I(b,$APP.Tg),k=$APP.I(b,Rw),m=$APP.I(b,Sw);b=$APP.I(b,Tw);h=Kw(h);k=Lw(k);var q=Iw(b,Uw,"md");b=function(){var v=$APP.Cc(Uw,d)?d:null;return $APP.n(v)?v:q}();var r=function(){var v=$APP.Cc(Uw,m)?m:null;return $APP.n(v)?v:q}();g=Iw(g,Vw,"stretch");c=Iw(c,Vw,"stretch");e=Jw(Iw(e,Ww,"row"));h=$APP.n(h)?h:"repeat(auto-fit,minmax("+$APP.S.g(k)+",1fr))";return $APP.bf([Pw,Qw,$APP.Tg,Sw,Tw,Xw,Mw,Yw,Ow,Nw],[e,
|
|
4
|
+
g,h,Hw(r),q,b,$APP.J(a),r,Hw(b),c])},$w=function(a){var b=$APP.bf([Pw,Qw,$APP.Tg,Rw,Sw,Tw,Mw,Ow,Nw],[a.getAttribute("auto-flow"),a.getAttribute("align-items"),a.getAttribute("columns"),a.getAttribute("min-column-size"),a.getAttribute("column-gap"),a.getAttribute("gap"),a.hasAttribute("inline"),a.getAttribute("row-gap"),a.getAttribute("justify-items")]);b=Zw(b);a=$APP.l(a,"__x_grid_base");if($APP.n(a)){var c=a.style;a.setAttribute("data-gap",Tw.g(b));c.setProperty("--x-grid-columns",$APP.Tg.g(b));
|
|
5
|
+
c.setProperty("--x-grid-row-gap",Ow.g(b));c.setProperty("--x-grid-column-gap",Sw.g(b));c.setProperty("--x-grid-align-items",Qw.g(b));c.setProperty("--x-grid-justify-items",Nw.g(b));b=c.setProperty("--x-grid-auto-flow",Pw.g(b))}else b=null;return b},ax=function(a){if($APP.l(a,"__x_grid_initialized")!==!0){var b=a.attachShadow({mode:"open"}),c=document.createElement("style"),d=document.createElement("div"),e=document.createElement("slot");c.textContent="\n :host {\n display:block;\n }\n\n :host([inline]) {\n display:inline-block;\n }\n\n .base {\n display:grid;\n box-sizing:border-box;\n grid-template-columns:var(--x-grid-columns);\n row-gap:var(--x-grid-row-gap);\n column-gap:var(--x-grid-column-gap);\n align-items:var(--x-grid-align-items);\n justify-items:var(--x-grid-justify-items);\n grid-auto-flow:var(--x-grid-auto-flow);\n\n @media (prefers-reduced-motion: reduce) {\n .base {\n transition: none;\n }\n }\n }\n ";
|
|
6
|
+
d.setAttribute("part","base");d.className="base";d.appendChild(e);b.appendChild(c);b.appendChild(d);a.__x_grid_root=b;a.__x_grid_base=d;a.__x_grid_initialized=!0}$w(a);return a},cx=function(){var a=class extends HTMLElement{};a.observedAttributes=bx;a.prototype.connectedCallback=function(){return ax(this)};a.prototype.attributeChangedCallback=function(){return $APP.l(this,"__x_grid_initialized")===!0?$w(this):ax(this)};return a},dx=function(){return $APP.n(customElements.get("x-grid"))?null:customElements.define("x-grid",
|
|
7
|
+
cx())},Rw=new $APP.K(null,"min-column-size","min-column-size",-1066019378),Mw=new $APP.K(null,"inline","inline",1399884222),Pw=new $APP.K(null,"auto-flow","auto-flow",-1524521728),Sw=new $APP.K(null,"column-gap","column-gap",384822863),Nw=new $APP.K(null,"justify-items","justify-items",1638310783),Ow=new $APP.K(null,"row-gap","row-gap",-1809905537),Yw=new $APP.K(null,"column-gap-token","column-gap-token",-10192833),Tw=new $APP.K(null,"gap","gap",80255254),Qw=new $APP.K(null,"align-items","align-items",
|
|
8
|
+
-267946462),Xw=new $APP.K(null,"row-gap-token","row-gap-token",-219143816);var bx="columns min-column-size gap row-gap column-gap align-items justify-items auto-flow inline".split(" "),Uw=new $APP.R(null,new $APP.P(null,6,["none",null,"xs",null,"md",null,"lg",null,"xl",null,"sm",null],null),null),Vw=new $APP.R(null,new $APP.P(null,4,["center",null,"start",null,"stretch",null,"end",null],null),null),Ww=new $APP.R(null,new $APP.P(null,5,["column-dense",null,"row-dense",null,"dense",null,"column",null,"row",null],null),null);$APP.ka("baredom.exports.x_grid.init",dx);export const init=dx;
|
package/dist/x-menu-item.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
null)}
|
|
4
|
-
"false");a.setAttribute("role","menuitem");a.setAttribute("tabindex","-1");b.setAttribute("data-type","");b.setAttribute("data-variant",$APP.Wg.g(c));b.setAttribute("data-disabled",$APP.n($APP.yi.g(c))?"true":"false");return $APP.n($APP.yi.g(c))?a.setAttribute("aria-disabled","true"):a.removeAttribute("aria-disabled")}return null},
|
|
5
|
-
"Enter")||$APP.
|
|
6
|
-
b;a.__xMenuItemHandlers=
|
|
7
|
-
"variant",{get:function(){return this.getAttribute("variant")},set:function(b){return $APP.n(b)?this.setAttribute("variant",b):this.removeAttribute("variant")},configurable:!0,enumerable:!0});Object.defineProperty(a.prototype,"type",{get:function(){return this.getAttribute("type")},set:function(b){return $APP.n(b)?this.setAttribute("type",b):this.removeAttribute("type")},configurable:!0,enumerable:!0})},
|
|
8
|
-
function(){if(
|
|
9
|
-
b.setAttribute("part","base");b.className="base";e.setAttribute("part","icon");e.className="icon-span";
|
|
10
|
-
var c=$APP.l(this,"__xMenuItemRefs");if($APP.n(b)){var d=$APP.l(b,"keydown"),e=$APP.l(b,"icon-slotchange");c=$APP.n(c)?$APP.l(c,"icon-slot"):null;this.removeEventListener("click",$APP.l(b,"click"));this.removeEventListener("keydown",d);b=$APP.n(c)?c.removeEventListener("slotchange",e):null}else b=null;return b};a.prototype.attributeChangedCallback=function(){return
|
|
11
|
-
|
|
2
|
+
var XC=function(a){var b=$APP.M(a);a=$APP.I(b,$APP.T);var c=$APP.I(b,$APP.yi),d=$APP.I(b,$APP.Wg);b=$APP.I(b,$APP.Z);a=$APP.n(a)?a:"";c=$APP.J(c);d=$APP.n(d)?d:"";d=$APP.Cc(VC,d)?d:"";b=$APP.n(b)?b:"";b=$APP.Cc(WC,b)?b:"";return new $APP.P(null,4,[$APP.T,a,$APP.yi,c,$APP.Wg,d,$APP.Z,b],null)},YC=function(a){return $APP.l(a,"__xMenuItemInit")===!0},ZC=function(a){return new $APP.P(null,4,[$APP.T,a.getAttribute("value"),$APP.yi,a.hasAttribute("disabled"),$APP.Wg,a.getAttribute("variant"),$APP.Z,a.getAttribute("type")],
|
|
3
|
+
null)},$C=function(a){var b=a.getAttribute("value");return a.dispatchEvent(new CustomEvent("x-menu-item-select",{detail:{value:$APP.n(b)?b:""},bubbles:!0,composed:!0}))},aD=function(a){var b=$APP.l(a,"__xMenuItemRefs");b=$APP.n(b)?$APP.l(b,"base"):null;var c=XC(ZC(a));if($APP.n(b)){if($APP.E.h($APP.Z.g(c),"divider"))return a.setAttribute("role","separator"),a.removeAttribute("tabindex"),a.removeAttribute("aria-disabled"),b.setAttribute("data-type","divider"),b.setAttribute("data-variant",""),b.setAttribute("data-disabled",
|
|
4
|
+
"false");a.setAttribute("role","menuitem");a.setAttribute("tabindex","-1");b.setAttribute("data-type","");b.setAttribute("data-variant",$APP.Wg.g(c));b.setAttribute("data-disabled",$APP.n($APP.yi.g(c))?"true":"false");return $APP.n($APP.yi.g(c))?a.setAttribute("aria-disabled","true"):a.removeAttribute("aria-disabled")}return null},bD=function(a){function b(){return e.assignedNodes().length>0?a.setAttribute("has-icon",""):a.removeAttribute("has-icon")}function c(h){var k=h.key,m=XC(ZC(a));($APP.E.h(k,
|
|
5
|
+
"Enter")||$APP.E.h(k," "))&&$APP.p($APP.yi.g(m))&&$APP.N($APP.Z.g(m),"divider")?(h.preventDefault(),h=$C(a)):h=null;return h}function d(h){var k=XC(ZC(a));var m=$APP.yi.g(k);m=$APP.n(m)?m:$APP.E.h($APP.Z.g(k),"divider");$APP.n(m)&&h.preventDefault();return $APP.p($APP.yi.g(k))&&$APP.N($APP.Z.g(k),"divider")?$C(a):null}var e=$APP.l($APP.l(a,"__xMenuItemRefs"),"icon-slot"),g={};a.addEventListener("click",d);a.addEventListener("keydown",c);e.addEventListener("slotchange",b);g.click=d;g.keydown=c;g["icon-slotchange"]=
|
|
6
|
+
b;a.__xMenuItemHandlers=g},cD=function(a){Object.defineProperty(a.prototype,"value",{get:function(){return this.getAttribute("value")},set:function(b){return $APP.n(b)?this.setAttribute("value",b):this.removeAttribute("value")},configurable:!0,enumerable:!0});Object.defineProperty(a.prototype,"disabled",{get:function(){return this.hasAttribute("disabled")},set:function(b){return $APP.n(b)?this.setAttribute("disabled",""):this.removeAttribute("disabled")},configurable:!0,enumerable:!0});Object.defineProperty(a.prototype,
|
|
7
|
+
"variant",{get:function(){return this.getAttribute("variant")},set:function(b){return $APP.n(b)?this.setAttribute("variant",b):this.removeAttribute("variant")},configurable:!0,enumerable:!0});Object.defineProperty(a.prototype,"type",{get:function(){return this.getAttribute("type")},set:function(b){return $APP.n(b)?this.setAttribute("type",b):this.removeAttribute("type")},configurable:!0,enumerable:!0})},eD=function(){var a=class extends HTMLElement{};a.observedAttributes=dD;a.prototype.connectedCallback=
|
|
8
|
+
function(){if(YC(this)){bD(this);var b=aD(this)}else{if(!YC(this)){var c=this.attachShadow({mode:"open"}),d=document.createElement("style");b=document.createElement("div");var e=document.createElement("span"),g=document.createElement("slot"),h=document.createElement("span"),k=document.createElement("slot"),m=document.createElement("hr");d.textContent=":host{display:block;outline:none;color-scheme:light dark;--x-menu-item-color:#111827;--x-menu-item-hover-bg:#f3f4f6;--x-menu-item-focus-bg:#eff6ff;--x-menu-item-focus-color:#1d4ed8;--x-menu-item-disabled-opacity:0.45;--x-menu-item-danger-color:#dc2626;--x-menu-item-danger-hover-bg:#fef2f2;--x-menu-item-padding:8px 12px;--x-menu-item-border-radius:4px;--x-menu-item-font-size:0.9375rem;--x-menu-item-icon-gap:8px;--x-menu-item-divider-color:#e5e7eb;}@media (prefers-color-scheme:dark){:host{--x-menu-item-color:#f9fafb;--x-menu-item-hover-bg:#1f2937;--x-menu-item-focus-bg:#1e3a5f;--x-menu-item-focus-color:#60a5fa;--x-menu-item-danger-color:#f87171;--x-menu-item-danger-hover-bg:#2d1515;--x-menu-item-divider-color:#374151;}}.base{display:flex;align-items:center;gap:var(--x-menu-item-icon-gap);padding:var(--x-menu-item-padding);border-radius:var(--x-menu-item-border-radius);font-size:var(--x-menu-item-font-size);color:var(--x-menu-item-color);cursor:pointer;user-select:none;transition:background 100ms ease,color 100ms ease;}.base:hover{background:var(--x-menu-item-hover-bg);}:host(:focus) .base{background:var(--x-menu-item-focus-bg);color:var(--x-menu-item-focus-color);}.base[data-variant\x3d'danger']{color:var(--x-menu-item-danger-color);}.base[data-variant\x3d'danger']:hover{background:var(--x-menu-item-danger-hover-bg);}:host(:focus) .base[data-variant\x3d'danger']{background:var(--x-menu-item-danger-hover-bg);}.base[data-disabled\x3d'true']{opacity:var(--x-menu-item-disabled-opacity);cursor:default;pointer-events:none;}.base[data-type\x3d'divider']{padding:0;cursor:default;pointer-events:none;}.icon-span{display:none;flex-shrink:0;align-items:center;}:host([has-icon]) .icon-span{display:flex;}.divider-hr{display:none;}.base[data-type\x3d'divider'] .icon-span,.base[data-type\x3d'divider'] .label-span{display:none;}.base[data-type\x3d'divider'] .divider-hr{display:block;width:100%;border:none;border-top:1px solid var(--x-menu-item-divider-color);margin:4px 0;}@media (prefers-reduced-motion:reduce){.base{transition:none;}}";
|
|
9
|
+
b.setAttribute("part","base");b.className="base";e.setAttribute("part","icon");e.className="icon-span";g.setAttribute("name","icon");e.appendChild(g);h.className="label-span";h.appendChild(k);m.className="divider-hr";b.appendChild(e);b.appendChild(h);b.appendChild(m);c.appendChild(d);c.appendChild(b);c={};c.base=b;c["icon-span"]=e;c["icon-slot"]=g;this.__xMenuItemRefs=c;bD(this);this.__xMenuItemInit=!0}aD(this);b=this}return b};a.prototype.disconnectedCallback=function(){var b=$APP.l(this,"__xMenuItemHandlers");
|
|
10
|
+
var c=$APP.l(this,"__xMenuItemRefs");if($APP.n(b)){var d=$APP.l(b,"keydown"),e=$APP.l(b,"icon-slotchange");c=$APP.n(c)?$APP.l(c,"icon-slot"):null;this.removeEventListener("click",$APP.l(b,"click"));this.removeEventListener("keydown",d);b=$APP.n(c)?c.removeEventListener("slotchange",e):null}else b=null;return b};a.prototype.attributeChangedCallback=function(){return YC(this)?aD(this):null};cD(a);return a},fD=function(){return $APP.n(customElements.get("x-menu-item"))?null:customElements.define("x-menu-item",
|
|
11
|
+
eD())};var dD=["value","disabled","variant","type"],VC=new $APP.R(null,new $APP.P(null,2,["",null,"danger",null],null),null),WC=new $APP.R(null,new $APP.P(null,2,["",null,"divider",null],null),null);$APP.wd(["x-menu-item-select",new $APP.P(null,1,[$APP.Y,new $APP.P(null,1,[$APP.T,$APP.X],null)],null)]);$APP.ka("baredom.exports.x_menu_item.init",fD);export const init=fD;
|
package/dist/x-menu.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
return b>0?$APP.
|
|
4
|
-
-1},a))},
|
|
5
|
-
(e=
|
|
6
|
-
d)?d:"bottom-start";a=new $APP.P(null,3,[$APP.si,c,$APP.Ai,d,$APP.W,$APP.n(a)?a:""],null);return $APP.n(b)?(b.setAttribute("data-placement",$APP.Ai.g(a)),a=$APP.W.g(a),$APP.n($APP.n(a)?$APP.N(a,""):a)?b.setAttribute("aria-label",a):b.removeAttribute("aria-label")):null},
|
|
7
|
-
h.indexOf(a))?
|
|
2
|
+
var gv=function(a){return $APP.l(a,"__xMenuInit")===!0},hv=function(a){a=a.querySelectorAll("x-menu-item");for(var b=[],c=a.length,d=0;;)if(d<c){var e=a[d];$APP.p(e.hasAttribute("disabled"))&&$APP.N(e.getAttribute("type"),"divider")&&b.push(e);d+=1}else break;return b},iv=function(a,b,c){return a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,composed:!0}))},lv=function(a){$APP.n(a.hasAttribute("open"))||(a.setAttribute("open",""),iv(a,"x-menu-open",{}));if($APP.n(null)){a=hv(a);var b=a.length;
|
|
3
|
+
return b>0?$APP.E.h(null,jv)?a[0].focus():$APP.E.h(null,kv)?a[b-1].focus():null:null}return null},mv=function(a,b){$APP.n(a.hasAttribute("open"))&&(a.removeAttribute("open"),iv(a,"x-menu-close",{}));return $APP.n(b)?(a=$APP.l(a,"__xMenuRefs"),a=$APP.n(a)?$APP.l(a,"trigger-slot"):null,a=$APP.n(a)?a.assignedElements():null,a=$APP.n($APP.n(a)?a.length>0:a)?a[0]:null,$APP.n(a)?a.focus():null):null},nv=function(a,b){var c=b.composedPath();a=$APP.hc(a.assignedElements());return $APP.J($APP.Ad(function(d){return c.indexOf(d)>
|
|
4
|
+
-1},a))},ov=function(a,b){var c=b.key,d=a.hasAttribute("open");if($APP.E.h(c,"Escape"))return $APP.n(d)?(b.preventDefault(),mv(a,!0)):null;if($APP.E.h(c,"Tab"))return $APP.n(d)?mv(a,!1):null;if($APP.E.h(c,"ArrowDown")||$APP.E.h(c,"ArrowUp")){var e=hv(a),g=e.length;if(g>0){b.preventDefault();if($APP.n(d))return a=e.indexOf(document.activeElement),c=$APP.E.h(c,"ArrowDown")?a>=g-1?0:a<0?0:a+1:a<=0?g-1:a-1,e[c].focus();lv(a);return e[$APP.E.h(c,"ArrowDown")?0:g-1].focus()}}else if($APP.E.h(c,"Home")){if($APP.n(d)&&
|
|
5
|
+
(e=hv(a),e.length>0))return b.preventDefault(),e[0].focus()}else if($APP.E.h(c,"End")&&$APP.n(d)&&(e=hv(a),e.length>0))return b.preventDefault(),e[e.length-1].focus();return null},qv=function(a){var b=$APP.l(a,"__xMenuRefs");b=$APP.n(b)?$APP.l(b,"popup"):null;a=new $APP.P(null,3,[$APP.si,a.hasAttribute("open"),$APP.Ai,a.getAttribute("placement"),$APP.W,a.getAttribute("label")],null);a=$APP.M(a);var c=$APP.I(a,$APP.si),d=$APP.I(a,$APP.Ai);a=$APP.I(a,$APP.W);c=$APP.J(c);d=$APP.n(d)?d:"";d=$APP.Cc(pv,
|
|
6
|
+
d)?d:"bottom-start";a=new $APP.P(null,3,[$APP.si,c,$APP.Ai,d,$APP.W,$APP.n(a)?a:""],null);return $APP.n(b)?(b.setAttribute("data-placement",$APP.Ai.g(a)),a=$APP.W.g(a),$APP.n($APP.n(a)?$APP.N(a,""):a)?b.setAttribute("aria-label",a):b.removeAttribute("aria-label")):null},rv=function(a){function b(h){h.stopPropagation();h=h.detail.value;mv(a,!1);return iv(a,"x-menu-select",{value:$APP.n(h)?h:""})}function c(h){return ov(a,h)}function d(h){$APP.n(a.hasAttribute("open"))?(h=h.composedPath(),h=$APP.E.h(-1,
|
|
7
|
+
h.indexOf(a))?mv(a,!1):null):h=null;return h}function e(h){var k=$APP.l(a,"__xMenuRefs");k=$APP.n(k)?$APP.l(k,"trigger-slot"):null;return $APP.n($APP.n(k)?nv(k,h):k)?$APP.n(a.hasAttribute("open"))?mv(a,!0):lv(a):null}var g={};a.addEventListener("click",e);document.addEventListener("click",d,!0);a.addEventListener("keydown",c);a.addEventListener("x-menu-item-select",b);g.click=e;g["doc-click"]=d;g.keydown=c;g["item-select"]=b;a.__xMenuHandlers=g},sv=function(a){Object.defineProperty(a.prototype,"open",
|
|
8
8
|
{get:function(){return this.hasAttribute("open")},set:function(b){return $APP.n(b)?this.setAttribute("open",""):this.removeAttribute("open")},configurable:!0,enumerable:!0});Object.defineProperty(a.prototype,"placement",{get:function(){return this.getAttribute("placement")},set:function(b){return $APP.n(b)?this.setAttribute("placement",b):this.removeAttribute("placement")},configurable:!0,enumerable:!0});Object.defineProperty(a.prototype,"label",{get:function(){return this.getAttribute("label")},
|
|
9
|
-
set:function(b){return $APP.n(b)?this.setAttribute("label",b):this.removeAttribute("label")},configurable:!0,enumerable:!0})},
|
|
9
|
+
set:function(b){return $APP.n(b)?this.setAttribute("label",b):this.removeAttribute("label")},configurable:!0,enumerable:!0})},uv=function(){var a=class extends HTMLElement{};a.observedAttributes=tv;a.prototype.connectedCallback=function(){if(gv(this)){rv(this);var b=qv(this)}else{if(!gv(this)){var c=this.attachShadow({mode:"open"}),d=document.createElement("style");b=document.createElement("div");var e=document.createElement("slot"),g=document.createElement("div"),h=document.createElement("slot");
|
|
10
10
|
d.textContent=":host{display:inline-block;position:relative;color-scheme:light dark;--x-menu-bg:#ffffff;--x-menu-border:1px solid #e5e7eb;--x-menu-border-radius:8px;--x-menu-shadow:0 4px 16px rgba(0,0,0,0.12);--x-menu-min-width:160px;--x-menu-padding:4px;--x-menu-z-index:1000;}@media (prefers-color-scheme:dark){:host{--x-menu-bg:#1f2937;--x-menu-border:1px solid #374151;--x-menu-shadow:0 4px 16px rgba(0,0,0,0.4);}}.base{position:relative;display:inline-block;}.popup{display:none;position:absolute;background:var(--x-menu-bg);border:var(--x-menu-border);border-radius:var(--x-menu-border-radius);box-shadow:var(--x-menu-shadow);min-width:var(--x-menu-min-width);padding:var(--x-menu-padding);z-index:var(--x-menu-z-index);box-sizing:border-box;}:host([open]) .popup{display:block;}.popup[data-placement\x3d'bottom-start']{top:100%;left:0;margin-top:4px;}.popup[data-placement\x3d'bottom-end']{top:100%;right:0;margin-top:4px;}.popup[data-placement\x3d'top-start']{bottom:100%;left:0;margin-bottom:4px;}.popup[data-placement\x3d'top-end']{bottom:100%;right:0;margin-bottom:4px;}";
|
|
11
|
-
b.setAttribute("part","base");b.className="base";e.setAttribute("name","trigger");
|
|
12
|
-
d=$APP.l(b,"keydown"),e=$APP.l(b,"item-select");this.removeEventListener("click",$APP.l(b,"click"));document.removeEventListener("click",c,!0);this.removeEventListener("keydown",d);b=this.removeEventListener("x-menu-item-select",e)}else b=null;return b};a.prototype.attributeChangedCallback=function(){return
|
|
13
|
-
"last","last",1105735132);var
|
|
11
|
+
b.setAttribute("part","base");b.className="base";e.setAttribute("name","trigger");g.setAttribute("part","popup");g.className="popup";g.setAttribute("role","menu");g.appendChild(h);b.appendChild(e);b.appendChild(g);c.appendChild(d);c.appendChild(b);c={};c.base=b;c.popup=g;c["trigger-slot"]=e;c["item-slot"]=h;this.__xMenuRefs=c;rv(this);this.__xMenuInit=!0}qv(this);b=this}return b};a.prototype.disconnectedCallback=function(){var b=$APP.l(this,"__xMenuHandlers");if($APP.n(b)){var c=$APP.l(b,"doc-click"),
|
|
12
|
+
d=$APP.l(b,"keydown"),e=$APP.l(b,"item-select");this.removeEventListener("click",$APP.l(b,"click"));document.removeEventListener("click",c,!0);this.removeEventListener("keydown",d);b=this.removeEventListener("x-menu-item-select",e)}else b=null;return b};a.prototype.attributeChangedCallback=function(){return gv(this)?qv(this):null};sv(a);return a},vv=function(){return $APP.n(customElements.get("x-menu"))?null:customElements.define("x-menu",uv())},jv=new $APP.K(null,"first","first",-644103046),kv=new $APP.K(null,
|
|
13
|
+
"last","last",1105735132);var tv=["open","placement","label"],pv=new $APP.R(null,new $APP.P(null,4,["bottom-start",null,"bottom-end",null,"top-end",null,"top-start",null],null),null);$APP.wd(["x-menu-open",new $APP.P(null,1,[$APP.Y,$APP.xd],null),"x-menu-close",new $APP.P(null,1,[$APP.Y,$APP.xd],null),"x-menu-select",new $APP.P(null,1,[$APP.Y,new $APP.P(null,1,[$APP.T,$APP.X],null)],null)]);$APP.ka("baredom.exports.x_menu.init",vv);export const init=vv;
|
package/dist/x-modal.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
d.setAttribute("part","backdrop");e.setAttribute("part","dialog");e.setAttribute("role","dialog");e.setAttribute("aria-modal","true");
|
|
4
|
-
footer:q};return $APP.l(a,"__xModalRefs")},
|
|
5
|
-
cancelable:!1}))},
|
|
6
|
-
return $APP.n(e.matches("a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex\x3d'-1'])"))?$APP.Xc(e,
|
|
7
|
-
null;a.__xModalRestore=null;$APP.n($APP.n(b)?d:b)&&(b.removeAttribute("tabindex"),a.__xModalDialogTab=!1);$APP.n($APP.n(c)?c.isConnected:c)&&c.focus()},
|
|
8
|
-
$APP.n(d)?"true":"false");a.setAttribute("data-size",$APP.Ag.g(c));b.setAttribute("aria-label",$APP.W.g(c));$APP.N(e,d)&&(a.__xModalPrevOpen=d,
|
|
9
|
-
a.__xModalDialogTab=!0),h.focus());return null},0):
|
|
10
|
-
h.focus()):$APP.p(q)&&$APP.
|
|
11
|
-
e);$APP.n(b)&&c.removeEventListener("keydown",b)}a.__xModalHandlers=null},
|
|
12
|
-
"label",{get:function(){var b=this.getAttribute("label");return $APP.n(b)?b:"Modal"},set:function(b){return b==null?this.removeAttribute("label"):this.setAttribute("label",""+$APP.S.g(b))},enumerable:!0,configurable:!0});Object.defineProperty(a,"show",{value:function(){return
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
var ID=function(a){var b=$APP.l(a,"__xModalRefs");if($APP.n(b))return b;b=a.attachShadow({mode:"open"});var c=document.createElement("style"),d=document.createElement("div"),e=document.createElement("div"),g=document.createElement("div"),h=document.createElement("slot"),k=document.createElement("div"),m=document.createElement("slot"),q=document.createElement("div"),r=document.createElement("slot");c.textContent=":host{display:contents;color-scheme:light dark;--x-modal-bg:Canvas;--x-modal-fg:CanvasText;--x-modal-backdrop:rgb(0 0 0/0.45);--x-modal-shadow:0 20px 60px rgb(0 0 0/0.25);--x-modal-radius:0.75rem;--x-modal-width-sm:22rem;--x-modal-width-md:32rem;--x-modal-width-lg:44rem;--x-modal-width-xl:60rem;--x-modal-max-height:90vh;--x-modal-header-padding:1rem 1.25rem;--x-modal-body-padding:1rem 1.25rem;--x-modal-footer-padding:0.75rem 1.25rem;--x-modal-border:color-mix(in srgb,currentColor 12%,transparent);--x-modal-duration:180ms;--x-modal-easing:ease;--x-modal-z:1000;}[part\x3dbackdrop]{position:fixed;inset:0;background:var(--x-modal-backdrop);z-index:var(--x-modal-z);opacity:0;visibility:hidden;pointer-events:none;transition:opacity var(--x-modal-duration) var(--x-modal-easing),visibility 0s var(--x-modal-easing) var(--x-modal-duration);}:host([data-open\x3dtrue]) [part\x3dbackdrop]{opacity:1;visibility:visible;pointer-events:auto;transition:opacity var(--x-modal-duration) var(--x-modal-easing),visibility 0s;}[part\x3ddialog]{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%) scale(0.96);opacity:0;visibility:hidden;pointer-events:none;background:var(--x-modal-bg);color:var(--x-modal-fg);box-shadow:var(--x-modal-shadow);border-radius:var(--x-modal-radius);display:flex;flex-direction:column;overflow:hidden;z-index:calc(var(--x-modal-z) + 1);max-height:var(--x-modal-max-height);transition:opacity var(--x-modal-duration) var(--x-modal-easing),transform var(--x-modal-duration) var(--x-modal-easing),visibility 0s var(--x-modal-easing) var(--x-modal-duration);}:host([data-size\x3dsm]) [part\x3ddialog]{width:var(--x-modal-width-sm);}:host([data-size\x3dmd]) [part\x3ddialog]{width:var(--x-modal-width-md);}:host([data-size\x3dlg]) [part\x3ddialog]{width:var(--x-modal-width-lg);}:host([data-size\x3dxl]) [part\x3ddialog]{width:var(--x-modal-width-xl);}:host([data-size\x3dfull]) [part\x3ddialog]{inset:0;top:0;left:0;width:100vw;height:100dvh;border-radius:0;max-width:100vw;max-height:100dvh;transform:scale(0.98);}:host([data-open\x3dtrue]) [part\x3ddialog]{opacity:1;transform:translate(-50%,-50%) scale(1);visibility:visible;pointer-events:auto;transition:opacity var(--x-modal-duration) var(--x-modal-easing),transform var(--x-modal-duration) var(--x-modal-easing),visibility 0s;}:host([data-open\x3dtrue][data-size\x3dfull]) [part\x3ddialog]{transform:scale(1);}[part\x3ddialog]:focus{outline:none;}[part\x3dheader]{padding:var(--x-modal-header-padding);border-bottom:1px solid var(--x-modal-border);flex-shrink:0;}[part\x3dbody]{padding:var(--x-modal-body-padding);overflow-y:auto;flex:1;}[part\x3dfooter]{padding:var(--x-modal-footer-padding);border-top:1px solid var(--x-modal-border);flex-shrink:0;}@media (prefers-reduced-motion:reduce){[part\x3ddialog],[part\x3dbackdrop]{transition:none;}}";
|
|
3
|
+
d.setAttribute("part","backdrop");e.setAttribute("part","dialog");e.setAttribute("role","dialog");e.setAttribute("aria-modal","true");g.setAttribute("part","header");h.setAttribute("name","header");k.setAttribute("part","body");q.setAttribute("part","footer");r.setAttribute("name","footer");g.appendChild(h);k.appendChild(m);q.appendChild(r);e.appendChild(g);e.appendChild(k);e.appendChild(q);b.appendChild(c);b.appendChild(d);b.appendChild(e);a.__xModalRefs={root:b,backdrop:d,dialog:e,header:g,body:k,
|
|
4
|
+
footer:q};return $APP.l(a,"__xModalRefs")},KD=function(a){a=new $APP.P(null,3,[$APP.rh,a.hasAttribute("open"),$APP.hi,a.getAttribute("size"),$APP.dh,a.getAttribute("label")],null);var b=$APP.M(a),c=$APP.I(b,$APP.rh);a=$APP.I(b,$APP.hi);b=$APP.I(b,$APP.dh);c=$APP.J(c);a=typeof a==="string"&&$APP.Cc(JD,a)?a:"md";b=typeof b==="string"&&$APP.N(b,"")?b:"Modal";return new $APP.P(null,3,[$APP.Pi,c,$APP.Ag,a,$APP.W,b],null)},LD=function(a,b,c){a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,composed:!0,
|
|
5
|
+
cancelable:!1}))},MD=function(a){function b(d){var e=window.getComputedStyle(d);return $APP.N("none",e.display)&&$APP.N("hidden",e.visibility)&&d.offsetWidth>0&&d.offsetHeight>0}var c=$APP.Kd(b,$APP.gc($APP.l(a,"dialog").querySelectorAll("a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex\x3d'-1'])")));a=$APP.Jd(function(d){return $APP.Kd(b,$APP.Jd(function(e){var g=$APP.gc(e.querySelectorAll("a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex\x3d'-1'])"));
|
|
6
|
+
return $APP.n(e.matches("a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex\x3d'-1'])"))?$APP.Xc(e,g):g},$APP.gc([$APP.hc(d.assignedElements({flatten:!0}))])))},$APP.gc([$APP.gc($APP.l(a,"root").querySelectorAll("slot"))]));return $APP.be($APP.Hd.h(c,a))},ND=function(a){var b=$APP.l(a,"__xModalRefs");b=$APP.n(b)?$APP.l(b,"dialog"):null;var c=$APP.l(a,"__xModalRestore"),d=$APP.l(a,"__xModalDialogTab")===!0;a.__xModalTabbables=
|
|
7
|
+
null;a.__xModalRestore=null;$APP.n($APP.n(b)?d:b)&&(b.removeAttribute("tabindex"),a.__xModalDialogTab=!1);$APP.n($APP.n(c)?c.isConnected:c)&&c.focus()},OD=function(a,b){LD(a,"x-modal-dismiss",{reason:b});a.removeAttribute("open");return null},PD=function(a){$APP.n(a.hasAttribute("open"))||a.setAttribute("open","");return null},QD=function(a){a.removeAttribute("open");return null},RD=function(a){var b=ID(a);b=$APP.l(b,"dialog");var c=KD(a),d=$APP.Pi.g(c),e=$APP.l(a,"__xModalPrevOpen");a.setAttribute("data-open",
|
|
8
|
+
$APP.n(d)?"true":"false");a.setAttribute("data-size",$APP.Ag.g(c));b.setAttribute("aria-label",$APP.W.g(c));$APP.N(e,d)&&(a.__xModalPrevOpen=d,LD(a,"x-modal-toggle",{open:d}),$APP.n(d)?setTimeout(function(){var g=$APP.l(a,"__xModalRefs"),h=$APP.n(g)?$APP.l(g,"dialog"):null;g=$APP.n(g)?MD(g):null;a.__xModalRestore=document.activeElement;var k=$APP.n(g)?$APP.xg(g):null;a.__xModalTabbables=k;$APP.u(g)?$APP.x(g).focus():$APP.n(h)&&($APP.n(h.hasAttribute("tabindex"))||(h.setAttribute("tabindex","-1"),
|
|
9
|
+
a.__xModalDialogTab=!0),h.focus());return null},0):ND(a))},SD=function(a){function b(g){var h=g.key;if($APP.E.h(h,"Escape"))g.preventDefault(),OD(a,"escape");else if($APP.E.h(h,"Tab")){h=$APP.l(a,"__xModalTabbables");h=$APP.n(h)?$APP.be($APP.gc(h)):$APP.Ld;var k=$APP.l(a,"__xModalRefs");k=$APP.n(k)?$APP.l(k,"dialog"):null;if($APP.rc(h))g.preventDefault(),$APP.n(k)&&k.focus();else{k=document.activeElement;var m=$APP.x(h);h=$APP.ic(h);var q=g.shiftKey;$APP.n($APP.n(q)?$APP.E.h(k,m):q)?(g.preventDefault(),
|
|
10
|
+
h.focus()):$APP.p(q)&&$APP.E.h(k,h)&&(g.preventDefault(),m.focus())}}return null}function c(){return OD(a,"backdrop")}var d=ID(a),e=$APP.l(d,"dialog");$APP.l(d,"backdrop").addEventListener("click",c);e.addEventListener("keydown",b);$APP.ma(a,"__xModalHandlers",{backdrop:c,keydown:b})},TD=function(a){var b=$APP.l(a,"__xModalHandlers"),c=$APP.l(a,"__xModalRefs");if($APP.n($APP.n(b)?c:b)){var d=$APP.l(c,"backdrop");c=$APP.l(c,"dialog");var e=$APP.l(b,"backdrop");b=$APP.l(b,"keydown");$APP.n(e)&&d.removeEventListener("click",
|
|
11
|
+
e);$APP.n(b)&&c.removeEventListener("keydown",b)}a.__xModalHandlers=null},UD=function(a){Object.defineProperty(a,"open",{get:function(){return this.hasAttribute("open")},set:function(b){return $APP.n(b)?PD(this):QD(this)},enumerable:!0,configurable:!0});Object.defineProperty(a,"size",{get:function(){var b=this.getAttribute("size");return $APP.n(b)?b:"md"},set:function(b){return b==null?this.removeAttribute("size"):this.setAttribute("size",""+$APP.S.g(b))},enumerable:!0,configurable:!0});Object.defineProperty(a,
|
|
12
|
+
"label",{get:function(){var b=this.getAttribute("label");return $APP.n(b)?b:"Modal"},set:function(b){return b==null?this.removeAttribute("label"):this.setAttribute("label",""+$APP.S.g(b))},enumerable:!0,configurable:!0});Object.defineProperty(a,"show",{value:function(){return PD(this)},enumerable:!0,configurable:!0,writable:!0});Object.defineProperty(a,"hide",{value:function(){return QD(this)},enumerable:!0,configurable:!0,writable:!0});Object.defineProperty(a,"toggle",{value:function(){$APP.n(this.hasAttribute("open"))?
|
|
13
|
+
QD(this):PD(this);return null},enumerable:!0,configurable:!0,writable:!0})},WD=function(){if(!$APP.n(customElements.get("x-modal"))){var a=class extends HTMLElement{};a.observedAttributes=VD;a.prototype.connectedCallback=function(){ID(this);TD(this);SD(this);RD(this);return null};a.prototype.disconnectedCallback=function(){TD(this);ND(this);return null};a.prototype.attributeChangedCallback=function(b,c,d){$APP.N(c,d)&&RD(this);return null};UD(a.prototype);customElements.define("x-modal",a)}return null},
|
|
14
|
+
XD=function(){return WD()};var JD=new $APP.R(null,new $APP.P(null,5,["md",null,"lg",null,"full",null,"xl",null,"sm",null],null),null),VD=["open","size","label"];$APP.wd(["x-modal-toggle",new $APP.P(null,2,[$APP.wi,!1,$APP.Y,new $APP.P(null,1,[$APP.si,$APP.Li],null)],null),"x-modal-dismiss",new $APP.P(null,2,[$APP.wi,!1,$APP.Y,new $APP.P(null,1,[$APP.xh,$APP.X],null)],null)]);$APP.ka("baredom.exports.x_modal.init",XD);export const init=XD;
|