@vanelsas/baredom 3.5.0 → 3.7.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/CHANGELOG.md +43 -0
- package/README.md +3 -3
- package/custom-elements.json +316 -0
- package/dist/baredom.d.ts +3 -0
- package/dist/base.js +606 -587
- package/dist/integrity.json +111 -108
- package/dist/x-alert.js +17 -17
- package/dist/x-avatar-group.js +9 -9
- package/dist/x-avatar.js +14 -14
- package/dist/x-badge.js +8 -8
- package/dist/x-bento-grid.js +5 -5
- package/dist/x-bento-item.js +4 -4
- package/dist/x-breadcrumbs.js +13 -13
- package/dist/x-button.js +1 -1
- package/dist/x-calendar.js +39 -39
- package/dist/x-cancel-dialogue.js +13 -13
- package/dist/x-card.js +7 -7
- package/dist/x-carousel.js +34 -34
- package/dist/x-chart.js +45 -45
- package/dist/x-checkbox.js +1 -1
- package/dist/x-chip.js +1 -1
- package/dist/x-code.js +27 -27
- package/dist/x-collapse.js +9 -9
- package/dist/x-color-picker.js +44 -44
- package/dist/x-combobox.js +33 -33
- package/dist/x-command-palette.js +28 -28
- package/dist/x-confetti.js +23 -23
- package/dist/x-container.js +5 -5
- package/dist/x-context-menu.js +20 -20
- package/dist/x-copy.js +1 -1
- package/dist/x-currency-field.js +23 -23
- package/dist/x-date-picker.js +43 -43
- package/dist/x-divider.js +9 -10
- package/dist/x-drag-panel.d.ts +45 -0
- package/dist/x-drag-panel.js +36 -0
- package/dist/x-drawer.js +11 -11
- package/dist/x-drop-zone.d.ts +49 -0
- package/dist/x-drop-zone.js +11 -0
- package/dist/x-dropdown.js +12 -12
- package/dist/x-fieldset.js +5 -5
- package/dist/x-file-download.js +6 -6
- package/dist/x-file-upload.js +25 -25
- package/dist/x-floating-panel.d.ts +50 -0
- package/dist/x-floating-panel.js +24 -0
- package/dist/x-form-field.js +15 -15
- package/dist/x-form.js +10 -10
- package/dist/x-gaussian-blur.js +13 -13
- package/dist/x-grid.js +6 -6
- package/dist/x-i18n-provider.js +7 -7
- package/dist/x-i18n.js +4 -4
- package/dist/x-icon.js +7 -7
- package/dist/x-image.js +17 -17
- package/dist/x-kbd.js +11 -11
- package/dist/x-kinetic-canvas.js +24 -24
- package/dist/x-kinetic-font.js +25 -25
- package/dist/x-kinetic-typography.js +34 -34
- package/dist/x-liquid-dock.js +31 -31
- package/dist/x-liquid-fill.js +41 -41
- package/dist/x-liquid-glass.js +35 -35
- package/dist/x-menu-item.js +8 -8
- package/dist/x-menu.js +9 -9
- package/dist/x-metaball-cursor.js +23 -23
- package/dist/x-modal.js +12 -12
- package/dist/x-morph-stack.js +37 -37
- package/dist/x-multi-combobox.js +39 -39
- package/dist/x-navbar.js +14 -14
- package/dist/x-neural-glow.js +29 -29
- package/dist/x-notification-center.js +9 -9
- package/dist/x-organic-divider.js +17 -17
- package/dist/x-organic-progress.js +34 -34
- package/dist/x-organic-shape.js +14 -14
- package/dist/x-otp-input.js +21 -21
- package/dist/x-pagination.js +14 -14
- package/dist/x-particle-button.js +45 -45
- package/dist/x-popover.js +27 -27
- package/dist/x-progress-circle.js +8 -8
- package/dist/x-progress.js +7 -7
- package/dist/x-proximity-list.js +20 -20
- package/dist/x-radio.js +12 -12
- package/dist/x-range-slider.js +28 -28
- package/dist/x-rating.js +24 -24
- package/dist/x-ripple-effect.js +9 -9
- package/dist/x-scroll-parallax.js +17 -17
- package/dist/x-scroll-stack.js +16 -16
- package/dist/x-scroll-story.js +31 -31
- package/dist/x-scroll-timeline.js +46 -46
- package/dist/x-scroll.js +36 -36
- package/dist/x-search-field.js +1 -1
- package/dist/x-select.js +1 -1
- package/dist/x-sidebar.js +15 -15
- package/dist/x-skeleton-group.js +12 -12
- package/dist/x-skeleton.js +1 -1
- package/dist/x-slider.js +16 -16
- package/dist/x-soft-body.js +17 -17
- package/dist/x-spacer.js +4 -4
- package/dist/x-spinner.js +4 -4
- package/dist/x-splash.js +12 -12
- package/dist/x-split-pane.js +14 -14
- package/dist/x-spotlight-card.js +11 -11
- package/dist/x-stat.js +10 -10
- package/dist/x-stepper.js +13 -13
- package/dist/x-switch.js +11 -11
- package/dist/x-tab.js +6 -6
- package/dist/x-table-cell.js +19 -19
- package/dist/x-table-row.js +8 -8
- package/dist/x-table.js +13 -13
- package/dist/x-tabs.js +11 -11
- package/dist/x-text-area.js +19 -19
- package/dist/x-theme.js +25 -25
- package/dist/x-timeline-item.js +20 -20
- package/dist/x-timeline.js +8 -8
- package/dist/x-toast.js +22 -22
- package/dist/x-toaster.js +7 -7
- package/dist/x-tooltip.js +12 -12
- package/dist/x-trace-history.js +125 -124
- package/dist/x-typography.js +6 -6
- package/dist/x-welcome-tour.js +63 -63
- package/package.json +16 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
+
var ZH=function(a){return typeof a==="string"&&$APP.I(a,"")?a:"Draggable panel"},qea=function(a){var b=$APP.G(a);a=$APP.C(b,$APP.xr);b=$APP.C(b,$APP.Wr);return $APP.D($APP.z.j(a,"touch")&&$APP.z.j(b,"surface"))},$H=function(a,b){return{kind:a,value:b}},aI=function(a,b,c){return{kind:a,value:b,reason:c}},rea=function(a){return $APP.Ge(function(b){var c=$APP.G(b);b=$APP.C(c,$APP.el);c=$APP.C(c,$APP.fl);return(($APP.n(b)?b:0)+($APP.n(c)?c:0))/2},a)},sea=function(a,b){return $APP.w($APP.De(function(c){return c<
|
|
3
|
+
($APP.n(b)?b:0)},a))},bI=function(a,b){return{kind:a,value:b}},cI=function(a){$APP.U(a,"data-drag-state")},dI=function(a){a=a.getAttribute("kind");return $APP.n(a)?a:""},eI=function(a){a=a.getAttribute("value");return $APP.n(a)?a:""},fI=function(a,b){$APP.il(a);var c=$APP.Pl(a);a=$APP.Zg.B(c,$APP.at,dI(b),$APP.Dc([$APP.it,$APP.w($APP.ml($APP.ll(a),b))]));var d=$APP.G(a);a=$APP.C(d,$APP.Wj);b=$APP.C(d,$APP.Jl);c=$APP.C(d,$APP.Kl);var e=$APP.C(d,$APP.it);d=$APP.C(d,$APP.at);return $APP.D($APP.p(a)&&
|
|
4
|
+
(b==null||$APP.cd(b,d))&&(c==null||($APP.n(e)?e:0)<c))},gI=function(a,b){$APP.il(a);var c=fI(a,b);$APP.Q(a,"__xDropZoneHover",new $APP.M(null,3,[$APP.Vl,b,$APP.Tl,c,$APP.Ul,0],null));$APP.S(a,"data-drag-state",$APP.n(c)?"over":"reject");$APP.ej(a,"x-drop-zone-enter",bI(dI(b),eI(b)));$APP.Wl(a)},hI=function(a,b){$APP.n($APP.l(a,"__xDropZoneHover"))&&($APP.Q(a,"__xDropZoneHover",null),cI(a),$APP.ej(a,"x-drop-zone-leave",bI(dI(b),eI(b))),$APP.Wl(a))},iI=function(a,b,c,d){var e=$APP.nl(a);a=$APP.ml($APP.ll(a),
|
|
5
|
+
b);a=$APP.Cl(a,e);return sea(rea(a),e?d:c)},jI=function(a,b,c,d){$APP.Q(a,"__xDropZoneLastDrop",new $APP.M(null,2,[$APP.Vl,b,$APP.Z,ZH(b.getAttribute("label"))],null));var e=dI(b),f=eI(b);c=$APP.n(c)?$APP.dl(c.getAttribute("value")):null;var h=$APP.Ti.i($APP.Pl(a));$APP.ej(a,"x-drop-zone-drop",{kind:e,value:f,from:c,to:h,index:d,panel:b})},kI=function(a){if(!$APP.Ui(a,"__xDragPanelInitialized")){var b=a.attachShadow({mode:"open"}),c=document.createElement("style"),d=document.createElement("div"),
|
|
6
|
+
e=document.createElement("div"),f=document.createElement("span"),h=document.createElement("slot");$APP.S(e,"part","handle");$APP.S(e,"role","button");$APP.S(e,"tabindex","0");$APP.S(f,"part","grip");$APP.S(f,"aria-hidden","true");f.textContent="⠿";$APP.S(h,"name","header");e.appendChild(f);e.appendChild(h);e=$APP.l({handle:e},"handle");f=document.createElement("div");h=document.createElement("slot");$APP.S(f,"part","body");f.appendChild(h);c.textContent=tea;$APP.S(d,"part","panel");d.appendChild(e);
|
|
7
|
+
d.appendChild(f);b.appendChild(c);b.appendChild(d);$APP.Q(a,"__xDragPanelRefs",{host:a,panel:d,handle:e,window});$APP.Vi(a,"__xDragPanelInitialized")}},lI=function(a,b){a=$APP.l(a,"__xDragPanelRefs");return $APP.n(a)?$APP.l(a,b):null},mI=function(a,b){var c=$APP.l(a,"__xDragPanelLive");if($APP.n(c))a=c;else{c=a.shadowRoot;var d=document.createElement("span");$APP.S(d,"aria-live","polite");$APP.S(d,"class","sr-only");c.appendChild(d);$APP.Q(a,"__xDragPanelLive",d);a=d}return a.textContent=b},nI=function(a){a=
|
|
8
|
+
new $APP.M(null,7,[$APP.iq,a.getAttribute("kind"),$APP.Mj,a.getAttribute("value"),$APP.Oj,a.getAttribute("label"),$APP.sv,a.getAttribute("grab"),$APP.hq,a.getAttribute("auto-scroll"),$APP.Pj,a.hasAttribute("disabled"),$APP.Gl,a.hasAttribute("pending")],null);var b=$APP.G(a);a=$APP.C(b,$APP.iq);var c=$APP.C(b,$APP.Mj),d=$APP.C(b,$APP.Oj),e=$APP.C(b,$APP.sv),f=$APP.C(b,$APP.hq),h=$APP.C(b,$APP.Pj);b=$APP.C(b,$APP.Gl);h=$APP.D(h);b=$APP.D(b);return new $APP.M(null,8,[$APP.at,typeof a==="string"?a:"",
|
|
9
|
+
$APP.Ti,typeof c==="string"?c:"",$APP.Z,ZH(d),$APP.Wr,$APP.z.j(e,"surface")?"surface":"handle",$APP.Ju,$APP.z.j(f,"none")?"none":"auto",$APP.Wj,h,$APP.Ll,b,$APP.ot,$APP.D(!h&&!b)],null)},oI=function(a){var b=$APP.l(a,"__xDragPanelModel");return $APP.n(b)?b:nI(a)},pI=function(a){var b=nI(a);if($APP.I($APP.l(a,"__xDragPanelModel"),b)){kI(a);var c=$APP.G(b),d=$APP.C(c,$APP.Z),e=$APP.C(c,$APP.Wj);c=$APP.C(c,$APP.Ll);var f=lI(a,"handle");$APP.n(f)&&($APP.S(f,"aria-label",d),$APP.S(f,"tabindex",$APP.n(e)?
|
|
10
|
+
"-1":"0"),$APP.n(c)?$APP.S(f,"aria-busy","true"):$APP.U(f,"aria-busy"));a=$APP.Q(a,"__xDragPanelModel",b)}else a=null;return a},uea=function(a,b){a=lI(a,"panel");var c=$APP.G(b);b=$APP.C(c,$APP.Sp);var d=$APP.C(c,$APP.Wp),e=$APP.G(c);c=$APP.C(e,$APP.Gt);var f=$APP.C(e,$APP.Ft),h=$APP.C(e,$APP.Bq);e=$APP.C(e,$APP.Cq);f=$APP.G(new $APP.M(null,2,[$APP.tu,($APP.n(c)?c:0)-($APP.n(h)?h:0),$APP.su,($APP.n(f)?f:0)-($APP.n(e)?e:0)],null));c=$APP.C(f,$APP.tu);f=$APP.C(f,$APP.su);d=$APP.G(new $APP.M(null,2,
|
|
11
|
+
[$APP.Us,c-($APP.n(b)?b:0),$APP.Ts,f-($APP.n(d)?d:0)],null));b=$APP.C(d,$APP.Us);d=$APP.C(d,$APP.Ts);b="translate("+$APP.P.i(b)+$APP.P.i("px")+","+$APP.P.i(d)+$APP.P.i("px")+") scale(var("+$APP.P.i("--x-drag-panel-lift-scale")+",1.02))";a.style.setProperty("transform",b)},qI=function(a,b){a=document.elementsFromPoint(a,b);return $APP.oe(function(c){return $APP.n(c.closest)?c.closest("x-drop-zone"):null},$APP.Dc(a))},rI=function(a,b){for(;;){if(a==null)return document.scrollingElement;var c=getComputedStyle(a);
|
|
12
|
+
c=$APP.n(b)?c.overflowY:c.overflowX;var d=$APP.n(b)?a.scrollHeight:a.scrollWidth,e=$APP.n(b)?a.clientHeight:a.clientWidth;if(($APP.z.j(c,"auto")||$APP.z.j(c,"scroll")||$APP.z.j(c,"overlay"))&&d>e+1)return a;a=a.parentElement}},sI=function(a,b,c,d){if($APP.n(a)){if(a===document.scrollingElement)var e=$APP.n(c)?new $APP.M(null,2,[$APP.fu,0,$APP.Ps,window.innerHeight],null):new $APP.M(null,2,[$APP.fu,0,$APP.Ps,window.innerWidth],null);else e=a.getBoundingClientRect(),e=$APP.n(c)?new $APP.M(null,2,[$APP.fu,
|
|
13
|
+
e.top,$APP.Ps,e.bottom],null):new $APP.M(null,2,[$APP.fu,e.left,$APP.Ps,e.right],null);var f=$APP.G(e);e=$APP.C(f,$APP.fu);f=$APP.C(f,$APP.Ps);var h=$APP.G(new $APP.M(null,3,[$APP.Mv,b,$APP.fu,e,$APP.Ps,f],null));b=$APP.C(h,$APP.Mv);e=$APP.C(h,$APP.fu);f=$APP.C(h,$APP.Ps);h=$APP.C(h,$APP.Xt);e=$APP.n(e)?e:0;f=$APP.n(f)?f:0;var k=f-e;h=$APP.n(h)?h:900;b==null||k<=0?b=0:(k=$APP.Rl.j(48,.15*$APP.Ql.j(0,$APP.n(k)?k:0)),e=b-e,b=f-b,b=e<b?-(h*(k<=0?0:$APP.Ql.j(0,$APP.Rl.j(1,(k-e)/k)))):h*(k<=0?0:$APP.Ql.j(0,
|
|
14
|
+
$APP.Rl.j(1,(k-b)/k))));d=($APP.n(b)?b:0)*($APP.n(d)?d:0)/1E3;$APP.I(0,d)&&($APP.n(c)?a.scrollTop+=d:a.scrollLeft+=d)}},vea=function(a,b,c){if($APP.z.j("auto",$APP.Ju.i(oI(a)))){var d=$APP.G(b);b=$APP.C(d,$APP.Gt);d=$APP.C(d,$APP.Ft);var e=document.elementsFromPoint(b,d)[0];if($APP.n(e)){var f=$APP.l(a,"__xDragPanelScrollers");$APP.n($APP.n(f)?e===$APP.l(f,"hit"):f)?a=f:(e={hit:e,vertical:rI(e,!0),horizontal:rI(e,!1)},$APP.Zi(a,"__xDragPanelScrollers",e),a=e);sI($APP.l(a,"vertical"),d,!0,c);sI($APP.l(a,
|
|
15
|
+
"horizontal"),b,!1,c)}}},wea=function(a,b){var c=$APP.G(b),d=$APP.C(c,$APP.Gt),e=$APP.C(c,$APP.Ft);c=qI(d,e);b=tI.i(b);b!==c&&($APP.n(b)&&hI(b,a),$APP.n(c)&&gI(c,a));$APP.n(c)&&(b=$APP.l(c,"__xDropZoneHover"),$APP.n(b)&&$APP.n($APP.Tl.i(b))&&(d=iI(c,a,d,e),$APP.I(d,$APP.Ul.i(b))&&$APP.Zi(c,"__xDropZoneHover",$APP.Zg.m(b,$APP.Ul,d)),$APP.Wl(c)));$APP.Zi(a,"__xDragPanelDrag",$APP.Zg.m($APP.l(a,"__xDragPanelDrag"),tI,c))},xea=function(a){$APP.Zi(a,"__xDragPanelLastFrame",null);return $APP.Zi(a,"__xDragPanelRaf",
|
|
16
|
+
requestAnimationFrame(function(b){return uI(a,b)}))},vI=function(a){var b=$APP.l(a,"__xDragPanelRaf");$APP.n(b)&&cancelAnimationFrame(b);$APP.Zi(a,"__xDragPanelRaf",null);$APP.Zi(a,"__xDragPanelLastFrame",null);$APP.Zi(a,"__xDragPanelScrollers",null)},xI=function(a){var b=$APP.l(a,"__xDragPanelPress");$APP.n(b)&&clearTimeout(wI.i(b));$APP.Q(a,"__xDragPanelPress",null)},zI=function(a,b,c,d){var e=a.getBoundingClientRect(),f=oI(a);xI(a);try{a.setPointerCapture(b)}catch(h){}$APP.Q(a,"__xDragPanelDrag",
|
|
17
|
+
$APP.vg([$APP.Ft,tI,$APP.Cq,$APP.Sp,$APP.iu,yI,$APP.Gt,$APP.Bq,$APP.Wp],[d,null,d-e.top,e.left,b,a.closest("x-drop-zone"),c,c-e.left,e.top]));b=lI(a,"panel");c=""+$APP.P.i(e.height)+$APP.P.i("px");a.style.setProperty("height",c);b.style.setProperty("position","fixed");c=""+$APP.P.i(e.left)+$APP.P.i("px");b.style.setProperty("left",c);c=""+$APP.P.i(e.top)+$APP.P.i("px");b.style.setProperty("top",c);c=""+$APP.P.i(e.width)+$APP.P.i("px");b.style.setProperty("width",c);e=""+$APP.P.i(e.height)+$APP.P.i("px");
|
|
18
|
+
b.style.setProperty("height",e);b.style.setProperty("margin","0");$APP.S(a,"data-dragging","");$APP.ej(a,"x-drag-panel-drag-start",$H($APP.at.i(f),$APP.Ti.i(f)));mI(a,"Picked up "+$APP.P.i($APP.Z.i(f)));return xea(a)},AI=function(a){vI(a);a:{var b=lI(a,"panel");a.style.removeProperty("height");for(var c=$APP.q(new $APP.J(null,7,5,$APP.K,"position left top width height margin transform".split(" "),null)),d=null,e=0,f=0;;)if(f<e){var h=d.C(null,f);b.style.removeProperty(h);f+=1}else if(c=$APP.q(c))d=
|
|
19
|
+
c,$APP.Zc(d)?(c=$APP.Eb(d),e=$APP.Fb(d),d=c,h=$APP.w(c),c=e,e=h):(h=$APP.t(d),b.style.removeProperty(h),c=$APP.v(d),d=null,e=0),f=0;else break a}$APP.U(a,"data-dragging");$APP.Q(a,"__xDragPanelDrag",null)},BI=function(a){var b=$APP.l(a,"__xDragPanelDrag");if($APP.n(b)){var c=oI(a);b=tI.i(b);$APP.n(b)&&hI(b,a);AI(a);$APP.ej(a,"x-drag-panel-drag-cancel",aI($APP.at.i(c),$APP.Ti.i(c),"escape"));return mI(a,"Cancelled moving "+$APP.P.i($APP.Z.i(c)))}return null},yea=function(a){return $APP.Ff.m($APP.Fe,
|
|
20
|
+
$APP.Ce(function(b){return fI(b,a)}),$APP.Dc(document.querySelectorAll("x-drop-zone")))},CI=function(a,b,c){b=$APP.B(b,c,null);if($APP.n(b)){gI(b,a);c=$APP.Pl(b);var d=document.querySelectorAll("x-drop-zone"),e=d.length;d=Array.from(d).indexOf(b)+1;$APP.Dl(b,""+$APP.P.i(ZH(a.getAttribute("label")))+" over "+$APP.P.i($APP.Z.i(c))+", zone "+$APP.P.i(d)+" of "+$APP.P.i(e));return b.scrollIntoView({block:"nearest",inline:"nearest"})}return null},EI=function(a){var b=$APP.l(a,"__xDragPanelKeyboard");$APP.n(b)&&
|
|
21
|
+
(b=$APP.B(DI.i(b),$APP.Ul.i(b),null),$APP.n(b)&&hI(b,a));$APP.U(a,"data-dragging");$APP.Q(a,"__xDragPanelKeyboard",null)},FI=function(a,b){var c=$APP.l(a,"__xDragPanelKeyboard");if($APP.n(c)){var d=$APP.G(c),e=$APP.C(d,DI);d=$APP.C(d,$APP.Ul);b=$APP.td(d+b,$APP.w(e));d=$APP.B(e,d,null);$APP.n(d)&&hI(d,a);$APP.Q(a,"__xDragPanelKeyboard",$APP.Zg.m(c,$APP.Ul,b));return CI(a,e,b)}return null},zea=function(a,b){var c=oI(a);if($APP.n(function(){var h=$APP.ot.i(c);if($APP.n(h)&&(h=$APP.z.j(0,b.button))&&
|
|
22
|
+
(h=$APP.l(a,"__xDragPanelDrag")==null)&&(h=$APP.Wr.i(c),h=$APP.z.j(h,"surface"),h||(h=lI(a,"handle"),h=$APP.D($APP.n(h)?b.composedPath().includes(h):h)),h)){h=b.target;if($APP.n(h)){var k=h.closest;h=$APP.n(k)?h.closest("[data-no-drag],button,a,input,select,textarea"):k}h=!$APP.D(h)}return h}())){var d=b.pointerId,e=b.clientX,f=b.clientY;b.preventDefault();return qea(new $APP.M(null,2,[$APP.xr,b.pointerType,$APP.Wr,$APP.Wr.i(c)],null))?$APP.Q(a,"__xDragPanelPress",new $APP.M(null,4,[$APP.iu,d,$APP.Sp,
|
|
23
|
+
e,$APP.Wp,f,wI,setTimeout(function(){return zI(a,d,e,f)},250)],null)):zI(a,d,e,f)}return null},Aea=function(a,b){var c=b.key,d=$APP.l(a,"__xDragPanelKeyboard"),e=oI(a);var f=$APP.z.j(c," ");e=f?(f=$APP.p(d))?$APP.ot.i(e):f:f;if($APP.n(e))return b.preventDefault(),b=oI(a),c=yea(a),$APP.q(c)?($APP.Q(a,"__xDragPanelKeyboard",new $APP.M(null,2,[DI,c,$APP.Ul,0],null)),$APP.S(a,"data-dragging",""),$APP.ej(a,"x-drag-panel-drag-start",$H($APP.at.i(b),$APP.Ti.i(b))),mI(a,"Picked up "+$APP.P.i($APP.Z.i(b))),
|
|
24
|
+
a=CI(a,c,0)):a=null,a;if($APP.n($APP.n(d)?$APP.z.j(c,"ArrowDown")||$APP.z.j(c,"ArrowRight"):d))return b.preventDefault(),FI(a,1);if($APP.n($APP.n(d)?$APP.z.j(c,"ArrowUp")||$APP.z.j(c,"ArrowLeft"):d))return b.preventDefault(),FI(a,-1);if($APP.n($APP.n(d)?$APP.z.j(c,"Enter"):d)){b.preventDefault();a:{c=$APP.l(a,"__xDragPanelKeyboard");if($APP.n(c)&&(b=oI(a),c=$APP.B(DI.i(c),$APP.Ul.i(c),null),d=a.closest("x-drop-zone"),EI(a),$APP.n(c))){e=$APP.w($APP.ml($APP.ll(c),a));$APP.Q(c,"__xDropZoneHover",null);
|
|
25
|
+
cI(c);jI(c,a,d,e);$APP.Wl(c);a=mI(a,"Dropped "+$APP.P.i($APP.Z.i(b)));break a}a=null}return a}return $APP.n($APP.n(d)?$APP.z.j(c,"Escape"):d)?(b.preventDefault(),$APP.n($APP.l(a,"__xDragPanelKeyboard"))?(b=oI(a),EI(a),$APP.ej(a,"x-drag-panel-drag-cancel",aI($APP.at.i(b),$APP.Ti.i(b),"escape")),a=mI(a,"Cancelled moving "+$APP.P.i($APP.Z.i(b)))):a=null,a):null},Bea=function(a){var b={};$APP.ka(b,"pointerDown",function(c){return zea(a,c)});$APP.ka(b,"pointerMove",function(c){var d=c.clientX,e=c.clientY,
|
|
26
|
+
f=$APP.l(a,"__xDragPanelPress");if($APP.n(f)){f=$APP.Zg.B(f,$APP.Gt,d,$APP.Dc([$APP.Ft,e]));var h=$APP.G(f);f=$APP.C(h,$APP.Sp);var k=$APP.C(h,$APP.Wp),m=$APP.C(h,$APP.Gt),r=$APP.C(h,$APP.Ft);h=$APP.C(h,$APP.zr);Math.hypot(($APP.n(m)?m:0)-($APP.n(f)?f:0),($APP.n(r)?r:0)-($APP.n(k)?k:0))>($APP.n(h)?h:8)&&xI(a)}f=$APP.l(a,"__xDragPanelDrag");return $APP.n(f)?$APP.z.j($APP.iu.i(f),c.pointerId)?$APP.Zi(a,"__xDragPanelDrag",$APP.Zg.B(f,$APP.Gt,d,$APP.Dc([$APP.Ft,e]))):null:null});$APP.ka(b,"pointerEnd",
|
|
27
|
+
function(c){xI(a);var d=$APP.l(a,"__xDragPanelDrag");if($APP.n(d))if($APP.z.j($APP.iu.i(d),c.pointerId))if($APP.z.j("pointercancel",c.type))c=BI(a);else{var e=$APP.l(a,"__xDragPanelDrag");if($APP.n(e)){c=oI(a);var f=$APP.G(e);d=$APP.C(f,$APP.Gt);var h=$APP.C(f,$APP.Ft);f=$APP.C(f,yI);var k=qI(d,h),m=$APP.n(k)?fI(k,a):k;e=tI.i(e);$APP.n(e)&&hI(e,a);AI(a);$APP.n(m)?(d=iI(k,a,d,h),$APP.Q(k,"__xDropZoneHover",null),cI(k),jI(k,a,f,d),$APP.Wl(k),c=mI(a,"Dropped "+$APP.P.i($APP.Z.i(c)))):($APP.ej(a,"x-drag-panel-drag-cancel",
|
|
28
|
+
aI($APP.at.i(c),$APP.Ti.i(c),"no-zone")),c=mI(a,"Returned "+$APP.P.i($APP.Z.i(c))))}else c=null}else c=null;else c=null;return c});$APP.ka(b,"handleKeydown",function(c){return Aea(a,c)});$APP.ka(b,"windowKeydown",function(c){c=$APP.z.j("Escape",c.key);return $APP.n(c?$APP.l(a,"__xDragPanelDrag"):c)?BI(a):null});return b},GI=function(a,b){var c=$APP.l(a,"__xDragPanelRefs");a=$APP.l(a,"__xDragPanelHandlers");if($APP.n($APP.n(c)?a:c))for(var d=$APP.q(Cea),e=null,f=0,h=0;;)if(h<f){var k=e.C(null,h),m=
|
|
29
|
+
$APP.B(k,0,null),r=$APP.B(k,1,null),u=$APP.B(k,2,null);k=$APP.B(k,3,null);var x=$APP.l(c,m),y=$APP.l(a,u);$APP.n(function(){var H=x;return $APP.n(H)?y:H}())&&($APP.n(b)?x.addEventListener(r,y,k):x.removeEventListener(r,y,k));h+=1}else if(d=$APP.q(d)){if($APP.Zc(d))r=$APP.Eb(d),d=$APP.Fb(d),m=r,r=$APP.w(r),e=m,f=r;else{e=$APP.t(d);m=$APP.B(e,0,null);r=$APP.B(e,1,null);u=$APP.B(e,2,null);k=$APP.B(e,3,null);var A=$APP.l(c,m),E=$APP.l(a,u);$APP.n(function(){var H=A;return $APP.n(H)?E:H}())&&($APP.n(b)?
|
|
30
|
+
A.addEventListener(r,E,k):A.removeEventListener(r,E,k));d=$APP.v(d);e=null;f=0}h=0}else return null;else return null},Dea=function(a){return $APP.tj(a,$APP.gw)},Eea=function(a){kI(a);pI(a);$APP.Q(a,"__xDragPanelHandlers",Bea(a));return GI(a,!0)},Fea=function(a){xI(a);vI(a);EI(a);$APP.Q(a,"__xDragPanelDrag",null);GI(a,!1);return $APP.Q(a,"__xDragPanelHandlers",null)},Gea=function(a,b,c,d){return $APP.I(c,d)?pI(a):null},HI=function(){return $APP.ri("x-drag-panel",new $APP.M(null,5,[$APP.ii,Hea,$APP.gi,
|
|
31
|
+
Eea,$APP.di,Fea,$APP.ci,Gea,$APP.hi,Dea],null))},Hea="kind value label grab auto-scroll disabled pending".split(" "),DI=new $APP.F(null,"zones","zones",2018149077),yI=new $APP.F(null,"from-zone","from-zone",-2048143887),wI=new $APP.F(null,"timer","timer",-1266967739),tI=new $APP.F(null,"zone","zone",2068674983);var tea=":host{display:block;position:relative;box-sizing:border-box;border-radius:var("+$APP.P.i("--x-drag-panel-radius")+",var(--x-radius-md,8px));}:host([hidden]){display:none;}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;}[part\x3dpanel]{box-sizing:border-box;display:flex;flex-direction:column;overflow:hidden;background:var("+$APP.P.i("--x-drag-panel-bg")+",var(--x-color-surface,#fff));color:var("+$APP.P.i("--x-drag-panel-color")+
|
|
32
|
+
",var(--x-color-text,#111));border:var("+$APP.P.i("--x-drag-panel-border")+",1px solid var(--x-color-border,#d8d8d8));border-radius:var("+$APP.P.i("--x-drag-panel-radius")+",var(--x-radius-md,8px));box-shadow:var("+$APP.P.i("--x-drag-panel-shadow")+",0 1px 2px rgba(0,0,0,.06));transition:var("+$APP.P.i("--x-drag-panel-transition")+",box-shadow .16s ease,transform .16s ease);}[part\x3dhandle]{display:flex;align-items:center;gap:.5rem;min-height:var("+$APP.P.i("--x-drag-panel-handle-height")+",2rem);padding:0 var("+
|
|
33
|
+
$APP.P.i("--x-drag-panel-padding")+",.75rem);background:var("+$APP.P.i("--x-drag-panel-handle-bg")+",transparent);cursor:grab;touch-action:none;user-select:none;}[part\x3dhandle]:focus-visible{outline:2px solid var(--x-color-focus,#3b82f6);outline-offset:-2px;}[part\x3dgrip]{flex:none;width:.75rem;color:var("+$APP.P.i("--x-drag-panel-grip-color")+",var(--x-color-text-muted,#8a8a8a));line-height:1;}[part\x3dbody]{padding:var("+$APP.P.i("--x-drag-panel-padding")+",.75rem);}:host([grab\x3dsurface]) [part\x3dpanel]{cursor:grab;touch-action:none;}:host([data-dragging]) [part\x3dpanel]{z-index:1000;pointer-events:none;cursor:grabbing;box-shadow:var("+
|
|
34
|
+
$APP.P.i("--x-drag-panel-lift-shadow")+",0 12px 32px rgba(0,0,0,.22));background:var("+$APP.P.i("--x-drag-panel-bg")+",var(--x-color-bg,#fff));transition:none;}:host([data-dragging]),:host([pending]){border:var("+$APP.P.i("--x-drag-panel-footprint-border")+",1px dashed var(--x-color-border,#c9c9c9));background:var("+$APP.P.i("--x-drag-panel-footprint-bg")+",transparent);}:host([pending]) [part\x3dpanel]{visibility:hidden;}:host([disabled]) [part\x3dpanel]{opacity:.55;}:host([disabled]) [part\x3dhandle]{cursor:default;}@media (prefers-reduced-motion: reduce){[part\x3dpanel]{transition:none !important;}}",
|
|
35
|
+
uI=function uI(a,b){var d=$APP.l(a,"__xDragPanelDrag");if($APP.n(d)){var e=$APP.l(a,"__xDragPanelLastFrame");e=$APP.n(e)?b-e:0;$APP.Zi(a,"__xDragPanelLastFrame",b);uea(a,d);wea(a,d);vea(a,d,e);return $APP.Zi(a,"__xDragPanelRaf",requestAnimationFrame(function(f){return uI.j?uI.j(a,f):uI.call(null,a,f)}))}return null},Cea=new $APP.J(null,6,5,$APP.K,[new $APP.J(null,4,5,$APP.K,["host","pointerdown","pointerDown",!1],null),new $APP.J(null,4,5,$APP.K,["host","pointermove","pointerMove",!1],null),new $APP.J(null,
|
|
36
|
+
4,5,$APP.K,["host","pointerup","pointerEnd",!1],null),new $APP.J(null,4,5,$APP.K,["host","pointercancel","pointerEnd",!1],null),new $APP.J(null,4,5,$APP.K,["handle","keydown","handleKeydown",!1],null),new $APP.J(null,4,5,$APP.K,["window","keydown","windowKeydown",!1],null)],null);$APP.ha("baredom.exports.x_drag_panel.init",HI);export const init=HI;
|
package/dist/x-drawer.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
$APP.
|
|
4
|
-
|
|
5
|
-
!0;$APP.Q(a,"__xDrawerTabbables",null);$APP.Q(a,"__xDrawerRestore",null);$APP.n($APP.n(b)?d:b)&&($APP.U(b,"tabindex"),$APP.Q(a,"__xDrawerPanelTab",!1));return $APP.n($APP.n(c)?c.isConnected:c)?c.focus():null},
|
|
6
|
-
return $APP.n($APP.n(e)?$APP.z.j(a,d):e)?(b.preventDefault(),c.focus()):$APP.p(e)&&$APP.z.j(a,c)?(b.preventDefault(),d.focus()):null},
|
|
7
|
-
var e=
|
|
8
|
-
d=$APP.C(c,$APP.
|
|
9
|
-
e);$APP.n(f)?$APP.U(d,"aria-hidden"):$APP.
|
|
10
|
-
$APP.l(a,"__xDrawerHandlers"),c=$APP.l(a,"__xDrawerRefs");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)}$APP.Q(a,"__xDrawerHandlers",null)},
|
|
11
|
-
set:function(b){return $APP.n(b)?
|
|
12
|
-
$APP.U(this,"open"):
|
|
2
|
+
var MT=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"),f=document.createElement("div"),h=document.createElement("slot"),k=document.createElement("div"),m=document.createElement("slot"),r=document.createElement("div"),u=document.createElement("slot");c.textContent=":host{display:contents;color-scheme:light dark;--x-drawer-size:20rem;--x-drawer-bg:var(--x-color-bg,Canvas);--x-drawer-fg:var(--x-color-text,CanvasText);--x-drawer-backdrop:rgb(0 0 0/0.4);--x-drawer-shadow:var(--x-shadow-lg,0 8px 24px rgb(0 0 0/0.18));--x-drawer-duration:var(--x-transition-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:var(--x-color-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:100%;}: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:100dvh;}: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:var(--x-color-bg,#1c1d24);--x-drawer-fg:var(--x-color-text,#e2e4ef);--x-drawer-border:var(--x-color-border,rgb(255 255 255/0.08));--x-drawer-shadow:var(--x-shadow-lg,0 8px 40px rgb(0 0 0/0.55));--x-drawer-backdrop:rgb(0 0 0/0.55);}}";
|
|
3
|
+
$APP.S(d,"part","backdrop");$APP.S(e,"part","panel");$APP.S(e,"role","dialog");$APP.S(e,"aria-modal","true");$APP.S(f,"part","header");$APP.S(h,"name","header");$APP.S(k,"part","body");$APP.S(r,"part","footer");$APP.S(u,"name","footer");f.appendChild(h);k.appendChild(m);r.appendChild(u);e.appendChild(f);e.appendChild(k);e.appendChild(r);b.appendChild(c);b.appendChild(d);b.appendChild(e);$APP.Q(a,"__xDrawerRefs",{root:b,backdrop:d,panel:e,header:f,body:k,footer:r});return $APP.l(a,"__xDrawerRefs")},
|
|
4
|
+
vka=function(a){return $APP.Ze($APP.De(function(b){var c=window.getComputedStyle(b);return $APP.I("none",c.display)&&$APP.I("hidden",c.visibility)&&b.offsetWidth>0&&b.offsetHeight>0},$APP.Dc(a.querySelectorAll("a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex\x3d'-1'])"))))},NT=function(a){var b=$APP.l(a,"__xDrawerRefs");b=$APP.n(b)?$APP.l(b,"panel"):null;var c=$APP.l(a,"__xDrawerRestore"),d=$APP.l(a,"__xDrawerPanelTab")===
|
|
5
|
+
!0;$APP.Q(a,"__xDrawerTabbables",null);$APP.Q(a,"__xDrawerRestore",null);$APP.n($APP.n(b)?d:b)&&($APP.U(b,"tabindex"),$APP.Q(a,"__xDrawerPanelTab",!1));return $APP.n($APP.n(c)?c.isConnected:c)?c.focus():null},wka=function(a,b){var c=$APP.l(a,"__xDrawerTabbables");c=$APP.n(c)?$APP.Ze($APP.Dc(c)):$APP.Fe;a=$APP.l(a,"__xDrawerRefs");a=$APP.n(a)?$APP.l(a,"panel"):null;if($APP.Sc(c))return b.preventDefault(),$APP.n(a)?a.focus():null;a=document.activeElement;var d=$APP.t(c);c=$APP.Hc(c);var e=b.shiftKey;
|
|
6
|
+
return $APP.n($APP.n(e)?$APP.z.j(a,d):e)?(b.preventDefault(),c.focus()):$APP.p(e)&&$APP.z.j(a,c)?(b.preventDefault(),d.focus()):null},OT=function(a,b){$APP.ej(a,"x-drawer-dismiss",{reason:b});return $APP.U(a,"open")},PT=function(a){return $APP.n(a.hasAttribute("open"))?null:$APP.S(a,"open","")},xka=function(a,b,c){b=$APP.D($APP.yv.i(b));c=$APP.D($APP.yv.i(c));$APP.I(b,c)&&($APP.ej(a,"x-drawer-toggle",{open:c}),c?setTimeout(function(){var d=$APP.l(a,"__xDrawerRefs");d=$APP.n(d)?$APP.l(d,"panel"):null;
|
|
7
|
+
var e=vka(a);$APP.Q(a,"__xDrawerRestore",document.activeElement);$APP.Q(a,"__xDrawerTabbables",$APP.n(e)?$APP.$m(e):null);$APP.q(e)?d=$APP.t(e).focus():$APP.n(d)?($APP.n(d.hasAttribute("tabindex"))||($APP.S(d,"tabindex","-1"),$APP.Q(a,"__xDrawerPanelTab",!0)),d=d.focus()):d=null;return d},0):NT(a))},QT=function(a){if($APP.n($APP.l(a,"__xDrawerRefs"))){var b=new $APP.M(null,3,[$APP.Nq,a.hasAttribute("open"),$APP.bw,a.getAttribute("placement"),$APP.Oj,a.getAttribute("label")],null);var c=$APP.G(b),
|
|
8
|
+
d=$APP.C(c,$APP.Nq);b=$APP.C(c,$APP.bw);c=$APP.C(c,$APP.Oj);d=$APP.D(d);b=typeof b==="string"&&$APP.cd(yka,b)?b:"right";c=typeof c==="string"&&$APP.I(c,"")?c:"Drawer";b=new $APP.M(null,3,[$APP.yv,d,$APP.es,b,$APP.Z,c],null);c=$APP.l(a,"__xDrawerModel");if($APP.I(c,b)){d=MT(a);d=$APP.l(d,"panel");var e=$APP.G(b),f=$APP.C(e,$APP.yv);e=$APP.C(e,$APP.es);$APP.S(a,"data-open",$APP.n(f)?"true":"false");$APP.S(a,"data-placement",e);e=$APP.G(b);f=$APP.C(e,$APP.yv);e=$APP.C(e,$APP.Z);$APP.S(d,"aria-label",
|
|
9
|
+
e);$APP.n(f)?$APP.U(d,"aria-hidden"):$APP.S(d,"aria-hidden","true");xka(a,c,b);a=$APP.Q(a,"__xDrawerModel",b)}else a=null;return a}return null},zka=function(a){function b(f){var h=f.key;$APP.z.j(h,"Escape")?(f.preventDefault(),f=OT(a,"escape")):f=$APP.z.j(h,"Tab")?wka(a,f):null;return f}function c(){return OT(a,"backdrop")}var d=MT(a),e=$APP.l(d,"panel");$APP.l(d,"backdrop").addEventListener("click",c);e.addEventListener("keydown",b);$APP.Q(a,"__xDrawerHandlers",{backdrop:c,keydown:b})},RT=function(a){var b=
|
|
10
|
+
$APP.l(a,"__xDrawerHandlers"),c=$APP.l(a,"__xDrawerRefs");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)}$APP.Q(a,"__xDrawerHandlers",null)},Aka=function(a){MT(a);RT(a);zka(a);return QT(a)},Bka=function(a){RT(a);return NT(a)},Cka=function(a,b,c,d){return $APP.I(c,d)?QT(a):null},Dka=function(a){Object.defineProperty(a,"open",{get:function(){return this.hasAttribute("open")},
|
|
11
|
+
set:function(b){return $APP.n(b)?PT(this):$APP.U(this,"open")},enumerable:!0,configurable:!0});$APP.mj(a,"placement","placement","right");$APP.mj(a,"label","label","Drawer");Object.defineProperty(a,"show",{value:function(){return PT(this)},enumerable:!0,configurable:!0,writable:!0});Object.defineProperty(a,"hide",{value:function(){return $APP.U(this,"open")},enumerable:!0,configurable:!0,writable:!0});return Object.defineProperty(a,"toggle",{value:function(){return $APP.n(this.hasAttribute("open"))?
|
|
12
|
+
$APP.U(this,"open"):PT(this)},enumerable:!0,configurable:!0,writable:!0})},ST=function(){return $APP.ri("x-drawer",new $APP.M(null,5,[$APP.ii,Eka,$APP.gi,Aka,$APP.di,Bka,$APP.ci,Cka,$APP.hi,Dka],null))};var yka=new $APP.bh(null,new $APP.M(null,4,["right",null,"top",null,"bottom",null,"left",null],null),null),Eka=["open","placement","label"];$APP.ie(["x-drawer-toggle",new $APP.M(null,2,[$APP.Xu,!1,$APP.V,new $APP.M(null,1,[$APP.Tu,$APP.rj],null)],null),"x-drawer-dismiss",new $APP.M(null,2,[$APP.Xu,!1,$APP.V,new $APP.M(null,1,[$APP.Yq,$APP.X],null)],null)]);$APP.ha("baredom.exports.x_drawer.init",ST);export const init=ST;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// x-drop-zone.d.ts — auto-generated by generate_types.bb, do not edit
|
|
2
|
+
|
|
3
|
+
export function init(): void;
|
|
4
|
+
|
|
5
|
+
export interface XDropZoneEventMap {
|
|
6
|
+
"x-drop-zone-enter": CustomEvent<{ kind: string; value: string }>;
|
|
7
|
+
"x-drop-zone-leave": CustomEvent<{ kind: string; value: string }>;
|
|
8
|
+
"x-drop-zone-drop": CustomEvent<{ kind: string; value: string; from: string | null; to: string; index: number; panel: HTMLElement }>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface XDropZone extends HTMLElement {
|
|
12
|
+
value: string;
|
|
13
|
+
accepts: string;
|
|
14
|
+
max: number;
|
|
15
|
+
label: string;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
pending: boolean;
|
|
18
|
+
pendingIndex: number;
|
|
19
|
+
animateMoves: boolean;
|
|
20
|
+
reserve(panel: HTMLElement, index: number): void;
|
|
21
|
+
release(): void;
|
|
22
|
+
|
|
23
|
+
addEventListener<K extends keyof XDropZoneEventMap>(
|
|
24
|
+
type: K,
|
|
25
|
+
listener: (this: XDropZone, ev: XDropZoneEventMap[K]) => any,
|
|
26
|
+
options?: boolean | AddEventListenerOptions
|
|
27
|
+
): void;
|
|
28
|
+
addEventListener(
|
|
29
|
+
type: string,
|
|
30
|
+
listener: EventListenerOrEventListenerObject,
|
|
31
|
+
options?: boolean | AddEventListenerOptions
|
|
32
|
+
): void;
|
|
33
|
+
removeEventListener<K extends keyof XDropZoneEventMap>(
|
|
34
|
+
type: K,
|
|
35
|
+
listener: (this: XDropZone, ev: XDropZoneEventMap[K]) => any,
|
|
36
|
+
options?: boolean | EventListenerOptions
|
|
37
|
+
): void;
|
|
38
|
+
removeEventListener(
|
|
39
|
+
type: string,
|
|
40
|
+
listener: EventListenerOrEventListenerObject,
|
|
41
|
+
options?: boolean | EventListenerOptions
|
|
42
|
+
): void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare global {
|
|
46
|
+
interface HTMLElementTagNameMap {
|
|
47
|
+
"x-drop-zone": XDropZone;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
+
var LV=function(a){var b=$APP.jl(a,"empty");return $APP.n(b)?$APP.q($APP.ll(a))?$APP.S(b,"hidden",""):$APP.U(b,"hidden"):null},MV=function(a){for(var b=new Map,c=$APP.q($APP.ll(a)),d=null,e=0,f=0;;)if(f<e){var h=d.C(null,f);b.set(h,h.getBoundingClientRect());f+=1}else if(c=$APP.q(c))d=c,$APP.Zc(d)?(c=$APP.Eb(d),f=$APP.Fb(d),d=c,e=$APP.w(c),c=f):(c=$APP.t(d),b.set(c,c.getBoundingClientRect()),c=$APP.v(d),d=null,e=0),f=0;else break;$APP.Zi(a,"__xDropZoneRects",b)},NV=function(a,b,c){a.animate([{transform:"translate("+
|
|
3
|
+
$APP.P.i(b)+$APP.P.i("px")+","+$APP.P.i(c)+$APP.P.i("px")+")"},{transform:"none"}],{duration:180,easing:"ease"})},OV=function(a){var b=$APP.l(a,"__xDropZoneObserver");$APP.n(b)&&b.disconnect();$APP.Q(a,"__xDropZoneObserver",null)},Jla=function(a){if(!$APP.n($APP.l(a,"__xDropZoneObserver"))){var b=new MutationObserver(function(){if(!$APP.n(matchMedia("(prefers-reduced-motion: reduce)").matches)){var c=$APP.l(a,"__xDropZoneRects");if($APP.n(c))for(var d=$APP.q($APP.ll(a)),e=null,f=0,h=0;;)if(h<f){var k=
|
|
4
|
+
e.C(null,h),m=c.get(k);if($APP.n(m)){var r=m,u=k.getBoundingClientRect();m=r.left-u.left;r=r.top-u.top;($APP.I(0,m)||$APP.I(0,r))&&NV(k,m,r)}h+=1}else if(d=$APP.q(d))$APP.Zc(d)?(f=$APP.Eb(d),d=$APP.Fb(d),e=f,f=$APP.w(f)):(e=$APP.t(d),f=c.get(e),$APP.n(f)&&(h=f,k=e.getBoundingClientRect(),f=h.left-k.left,h=h.top-k.top,($APP.I(0,f)||$APP.I(0,h))&&NV(e,f,h)),d=$APP.v(d),e=null,f=0),h=0;else break;MV(a)}return LV(a)});b.observe(a,{childList:!0});$APP.Q(a,"__xDropZoneObserver",b);MV(a)}},Kla=function(a){var b=
|
|
5
|
+
$APP.Pl(a),c=$APP.l(a,"__xDropZoneLastDrop"),d=$APP.Vl.i(c),e=function(){return $APP.n(d)?$APP.oe(function(h){return h===d},$APP.ll(a)):d}(),f=function(){var h=$APP.Z.i(c);return $APP.n(h)?h:"Item"}();$APP.Dl(a,$APP.n(e)?""+$APP.P.i(f)+" moved to "+$APP.P.i($APP.Z.i(b)):"Move of "+$APP.P.i(f)+" failed");return $APP.Q(a,"__xDropZoneLastDrop",null)},PV=function(a){var b=$APP.Ol(a),c=$APP.l(a,"__xDropZoneModel");if($APP.I(c,b)){$APP.il(a);var d=$APP.G(b),e=$APP.C(d,$APP.Z);d=$APP.C(d,$APP.Ll);$APP.S(a,
|
|
6
|
+
"role","group");$APP.S(a,"aria-label",e);$APP.n(d)?$APP.S(a,"aria-busy","true"):$APP.U(a,"aria-busy");e=$APP.G(b);e=$APP.C(e,$APP.Nl);$APP.n(e)?Jla(a):OV(a);$APP.Q(a,"__xDropZoneModel",b);$APP.Wl(a);LV(a);$APP.n(c)?(c=$APP.D($APP.Ll.i(c)),e=$APP.D($APP.Ll.i(b)),!c&&e?(c=$APP.Z.i($APP.l(a,"__xDropZoneLastDrop")),a=$APP.Dl(a,"Moving "+$APP.P.i($APP.n(c)?c:"Item")+" to "+$APP.P.i($APP.Z.i(b)))):a=c&&!e?Kla(a):null):a=null}else a=null;return a},QV=function(a){a=$APP.l(a,"__xDropZoneReservation");$APP.n(a)&&
|
|
7
|
+
(a=$APP.Vl.i(a),$APP.n(a)&&$APP.U(a,"pending"))},Lla=function(a){var b={};$APP.ka(b,"slotChange",function(){LV(a);return $APP.Wl(a)});return b},RV=function(a,b){var c=$APP.l(a,"__xDropZoneRefs");a=$APP.l(a,"__xDropZoneHandlers");if($APP.n($APP.n(c)?a:c))for(var d=$APP.q($APP.hw),e=null,f=0,h=0;;)if(h<f){var k=e.C(null,h),m=$APP.B(k,0,null),r=$APP.B(k,1,null),u=$APP.B(k,2,null);k=$APP.B(k,3,null);var x=$APP.l(c,m),y=$APP.l(a,u);$APP.n(function(){var H=x;return $APP.n(H)?y:H}())&&($APP.n(b)?x.addEventListener(r,
|
|
8
|
+
y,k):x.removeEventListener(r,y,k));h+=1}else if(d=$APP.q(d)){if($APP.Zc(d))r=$APP.Eb(d),d=$APP.Fb(d),m=r,r=$APP.w(r),e=m,f=r;else{e=$APP.t(d);m=$APP.B(e,0,null);r=$APP.B(e,1,null);u=$APP.B(e,2,null);k=$APP.B(e,3,null);var A=$APP.l(c,m),E=$APP.l(a,u);$APP.n(function(){var H=A;return $APP.n(H)?E:H}())&&($APP.n(b)?A.addEventListener(r,E,k):A.removeEventListener(r,E,k));d=$APP.v(d);e=null;f=0}h=0}else break},Mla=function(a){$APP.mj(a,"value","value","");$APP.mj(a,"accepts","accepts","");$APP.oj(a,"max",
|
|
9
|
+
"max",null);$APP.mj(a,"label","label","Drop zone");$APP.jj(a,"disabled","disabled");$APP.jj(a,"pending","pending");$APP.oj(a,"pendingIndex","pending-index",null);$APP.jj(a,"animateMoves","animate-moves");Object.defineProperty(a,"reserve",{value:function(b,c){$APP.il(this);QV(this);$APP.Q(this,"__xDropZoneReservation",new $APP.M(null,1,[$APP.Vl,b],null));$APP.n(b)&&$APP.S(b,"pending","");typeof c==="number"?$APP.S(this,"pending-index",""+$APP.P.i(c)):$APP.U(this,"pending-index");return $APP.S(this,
|
|
10
|
+
"pending","")},enumerable:!0,configurable:!0,writable:!0});return Object.defineProperty(a,"release",{value:function(){QV(this);$APP.Q(this,"__xDropZoneReservation",null);$APP.U(this,"pending");return $APP.U(this,"pending-index")},enumerable:!0,configurable:!0,writable:!0})},Nla=function(a){$APP.il(a);PV(a);$APP.Q(a,"__xDropZoneHandlers",Lla(a));RV(a,!0);return LV(a)},Ola=function(a){OV(a);RV(a,!1);$APP.Q(a,"__xDropZoneHandlers",null);return $APP.Q(a,"__xDropZoneHover",null)},Pla=function(a,b,c,d){return $APP.I(c,
|
|
11
|
+
d)?PV(a):null},SV=function(){return $APP.ri("x-drop-zone",new $APP.M(null,5,[$APP.ii,Qla,$APP.gi,Nla,$APP.di,Ola,$APP.ci,Pla,$APP.hi,Mla],null))},Qla="value accepts max label disabled pending pending-index animate-moves".split(" ");$APP.ha("baredom.exports.x_drop_zone.init",SV);export const init=SV;
|
package/dist/x-dropdown.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
null},docKeydown:function(b){b=$APP.z.j(b.key,"Escape");return $APP.n(b?a.hasAttribute("open"):b)?
|
|
7
|
-
$APP.l(c,"triggerKeydown"));a.removeEventListener("focusout",$APP.l(c,"hostFocusout"));$APP.n(b)&&b.removeEventListener("click",$APP.l(c,"panelClick"))}}},
|
|
8
|
-
var d=document.createElement("button"),e=document.createElement("span"),f=document.createElement("span");$APP.
|
|
9
|
-
f=$APP.C(f,
|
|
10
|
-
|
|
11
|
-
$APP.z.j(b,"open")?$APP.n(a.hasAttribute("open"))?
|
|
12
|
-
configurable:!0})},
|
|
13
|
-
$APP.
|
|
2
|
+
var iB=function(a){if($APP.n($APP.l(a,"__xDropdownRefs"))){var b=a.hasAttribute("open");var c=a.hasAttribute("disabled"),d=a.getAttribute("label");d=$APP.n(d)?d:"";var e=a.getAttribute("placement");e=$APP.cd(jaa,e)?e:"bottom-start";b=new $APP.M(null,4,[$APP.yv,b,$APP.Wj,c,$APP.Z,d,$APP.es,e],null);if($APP.I($APP.l(a,"__xDropdownModel"),b))if(e=$APP.l(a,"__xDropdownRefs"),$APP.n(e)){d=$APP.l(e,"trigger");c=$APP.l(e,"panel");e=$APP.l(e,"label");var f=$APP.G(b);f=$APP.C(f,$APP.Z);e.textContent=f;f=$APP.G(b);
|
|
3
|
+
e=$APP.C(f,$APP.yv);f=$APP.C(f,$APP.Wj);$APP.S(d,"aria-expanded",$APP.n(e)?"true":"false");$APP.$i(d,"disabled",f);d=$APP.G(b);d=$APP.C(d,$APP.es);$APP.S(c,"data-placement",d);a=$APP.Q(a,"__xDropdownModel",b)}else a=null;else a=null;return a}return null},jB=function(a,b){if($APP.n(a.hasAttribute("disabled")))return null;var c=$APP.p(a.hasAttribute("open"));return $APP.gj(a,"x-dropdown-toggle",{open:c,source:b})?(c?$APP.S(a,"open",""):$APP.U(a,"open"),$APP.ej(a,"x-dropdown-change",{open:c})):null},
|
|
4
|
+
kB=function(a){var b=$APP.l(a,"__xDropdownHandlers");if($APP.n(b)){var c=$APP.l(b,"docClick"),d=$APP.l(b,"docKeydown");return queueMicrotask(function(){return $APP.n(a.hasAttribute("open"))?(document.addEventListener("click",c),document.addEventListener("keydown",d)):null})}return null},lB=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},
|
|
5
|
+
kaa=function(a){return{triggerClick:function(){return jB(a,"pointer")},triggerKeydown:function(b){var c=b.key;return $APP.z.j(c," ")||$APP.z.j(c,"Enter")?(b.preventDefault(),jB(a,"keyboard")):null},hostFocusout:function(b){return $APP.n(a.hasAttribute("open"))?(b=b.relatedTarget,b==null||$APP.p(a.contains(b))?jB(a,"focusout"):null):null},docClick:function(b){return $APP.n(a.hasAttribute("open"))?(b=$APP.Ec(b.composedPath()),b=$APP.oe(function(c){return c===a},b),$APP.n(b)?null:jB(a,"outside-click")):
|
|
6
|
+
null},docKeydown:function(b){b=$APP.z.j(b.key,"Escape");return $APP.n(b?a.hasAttribute("open"):b)?jB(a,"escape"):null},panelClick:function(b){return $APP.n(a.hasAttribute("open"))?$APP.n(b.target.closest("button, a, [role\x3dmenuitem]"))?jB(a,"item-select"):null:null}}},mB=function(a){var b=$APP.l(a,"__xDropdownRefs");if($APP.n(b)){var c=$APP.l(a,"__xDropdownHandlers");if($APP.n(c)){var d=$APP.l(b,"trigger");b=$APP.l(b,"panel");d.removeEventListener("click",$APP.l(c,"triggerClick"));d.removeEventListener("keydown",
|
|
7
|
+
$APP.l(c,"triggerKeydown"));a.removeEventListener("focusout",$APP.l(c,"hostFocusout"));$APP.n(b)&&b.removeEventListener("click",$APP.l(c,"panelClick"))}}},laa=function(a){if(!$APP.n($APP.l(a,"__xDropdownRefs"))){var b=a.attachShadow({mode:"open"}),c=document.createElement("style");c.textContent=":host{display:inline-block;position:relative;color-scheme:light dark;--x-dropdown-trigger-bg:var(--x-color-surface-hover,#f8fafc);--x-dropdown-trigger-bg-hover:var(--x-color-surface-active,#f1f5f9);--x-dropdown-trigger-bg-active:var(--x-color-surface-active,#e2e8f0);--x-dropdown-trigger-color:var(--x-color-text,#0f172a);--x-dropdown-trigger-border:1px solid var(--x-color-border,#e2e8f0);--x-dropdown-trigger-radius:var(--x-radius-md,6px);--x-dropdown-trigger-padding:0 0.75rem;--x-dropdown-trigger-height:2.25rem;--x-dropdown-trigger-font-size:var(--x-font-size-sm,0.9375rem);--x-dropdown-trigger-font-weight:500;--x-dropdown-chevron-color:var(--x-color-text-muted,#64748b);--x-dropdown-focus-ring:var(--x-color-focus-ring,#60a5fa);--x-dropdown-panel-bg:var(--x-color-bg,#ffffff);--x-dropdown-panel-border:1px solid var(--x-color-border,#e2e8f0);--x-dropdown-panel-radius:var(--x-radius-md,8px);--x-dropdown-panel-shadow:var(--x-shadow-md,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:var(--x-transition-duration,150ms);--x-dropdown-transition-easing:var(--x-transition-easing,ease);}@media (prefers-color-scheme:dark){:host{--x-dropdown-trigger-bg:var(--x-color-surface-hover,#1e293b);--x-dropdown-trigger-bg-hover:var(--x-color-surface-active,#334155);--x-dropdown-trigger-bg-active:var(--x-color-surface-active,#475569);--x-dropdown-trigger-color:var(--x-color-text,#e2e8f0);--x-dropdown-trigger-border:1px solid var(--x-color-border,#334155);--x-dropdown-chevron-color:var(--x-color-text-muted,#94a3b8);--x-dropdown-focus-ring:var(--x-color-focus-ring,#93c5fd);--x-dropdown-panel-bg:var(--x-color-bg,#1e293b);--x-dropdown-panel-border:1px solid var(--x-color-border,#334155);--x-dropdown-panel-shadow:var(--x-shadow-md,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-width:calc(100vw - 1rem);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;}}";
|
|
8
|
+
var d=document.createElement("button"),e=document.createElement("span"),f=document.createElement("span");$APP.S(d,"part","trigger");$APP.S(d,"type","button");$APP.S(d,"aria-haspopup","true");$APP.S(d,"aria-expanded","false");$APP.S(d,"aria-controls","panel");$APP.S(e,"part","trigger-label");$APP.S(f,"part","chevron");$APP.S(f,"aria-hidden","true");f.textContent="▾";d.appendChild(e);d.appendChild(f);f=$APP.G(new $APP.M(null,3,[$APP.fs,d,$APP.Z,e,nB,f],null));d=$APP.C(f,$APP.fs);e=$APP.C(f,$APP.Z);
|
|
9
|
+
f=$APP.C(f,nB);var h=document.createElement("div"),k=document.createElement("div"),m=document.createElement("slot");$APP.S(h,"part","panel");$APP.S(h,"id","panel");$APP.S(h,"data-placement","bottom-start");$APP.S(k,"part","panel-inner");k.appendChild(m);h.appendChild(k);h=$APP.G(new $APP.M(null,1,[$APP.Vl,h],null));h=$APP.C(h,$APP.Vl);e={trigger:d,label:e,chevron:f,panel:h};b.appendChild(c);b.appendChild(d);b.appendChild(h);$APP.Q(a,"__xDropdownRefs",e)}mB(a);lB(a);$APP.Q(a,"__xDropdownHandlers",
|
|
10
|
+
kaa(a));d=$APP.l(a,"__xDropdownRefs");$APP.n(d)&&(b=$APP.l(a,"__xDropdownHandlers"),$APP.n(b)&&(c=$APP.l(d,"trigger"),d=$APP.l(d,"panel"),c.addEventListener("click",$APP.l(b,"triggerClick")),c.addEventListener("keydown",$APP.l(b,"triggerKeydown")),a.addEventListener("focusout",$APP.l(b,"hostFocusout")),$APP.n(d)&&d.addEventListener("click",$APP.l(b,"panelClick"))));$APP.n(a.hasAttribute("open"))&&kB(a);return iB(a)},maa=function(a){mB(a);return lB(a)},naa=function(a,b,c,d){return $APP.I(c,d)?(iB(a),
|
|
11
|
+
$APP.z.j(b,"open")?$APP.n(a.hasAttribute("open"))?kB(a):lB(a):null):null},paa=function(a){$APP.tj(a,oaa);Object.defineProperty(a,"show",{value:function(){return $APP.n(this.hasAttribute("open"))?null:jB(this,"programmatic")},writable:!0,configurable:!0});Object.defineProperty(a,"hide",{value:function(){return $APP.n(this.hasAttribute("open"))?jB(this,"programmatic"):null},writable:!0,configurable:!0});return Object.defineProperty(a,"toggle",{value:function(){return jB(this,"programmatic")},writable:!0,
|
|
12
|
+
configurable:!0})},oB=function(){return $APP.ri("x-dropdown",new $APP.M(null,5,[$APP.ii,qaa,$APP.gi,laa,$APP.di,maa,$APP.ci,naa,$APP.hi,paa],null))},nB=new $APP.F(null,"chevron","chevron",1127691895);var jaa=new $APP.bh(null,new $APP.M(null,4,["bottom-start",null,"bottom-end",null,"top-end",null,"top-start",null],null),null),qaa=["open","disabled","label","placement"],oaa=new $APP.M(null,4,[$APP.Tu,new $APP.M(null,2,[$APP.N,$APP.rj,$APP.W,"open"],null),$APP.tn,new $APP.M(null,2,[$APP.N,$APP.rj,$APP.W,"disabled"],null),$APP.Z,new $APP.M(null,2,[$APP.N,$APP.X,$APP.W,"label"],null),$APP.es,new $APP.M(null,2,[$APP.N,$APP.X,$APP.W,"placement"],null)],null);
|
|
13
|
+
$APP.ie(["x-dropdown-toggle",new $APP.M(null,2,[$APP.Xu,!0,$APP.V,new $APP.M(null,2,[$APP.Tu,$APP.rj,$APP.au,$APP.X],null)],null),"x-dropdown-change",new $APP.M(null,2,[$APP.Xu,!1,$APP.V,new $APP.M(null,1,[$APP.Tu,$APP.rj],null)],null)]);$APP.ha("baredom.exports.x_dropdown.init",oB);export const init=oB;
|
package/dist/x-fieldset.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
$APP.n(d)){c=$APP.l(d,"root-el");e=$APP.l(d,"content-el");d=$APP.l(d,"legend-el");var f=$APP.G(b),h=$APP.C(f,
|
|
4
|
-
c=$APP.G(b);c=$APP.C(c,$APP.
|
|
2
|
+
var jR=function(a){if($APP.n($APP.l(a,"__xFieldsetRefs"))){var b=new $APP.M(null,4,[gR,a.getAttribute("legend"),$APP.Pj,a.hasAttribute("disabled"),$APP.am,a.getAttribute("aria-label"),$APP.bm,a.getAttribute("aria-describedby")],null);var c=$APP.G(b),d=$APP.C(c,gR),e=$APP.C(c,$APP.Pj);b=$APP.C(c,$APP.am);c=$APP.C(c,$APP.bm);d=$APP.n(d)?d:"";e=$APP.D(e);b=new $APP.M(null,5,[hR,d,iR,$APP.I(d,""),$APP.Wj,e,$APP.jm,b,$APP.im,c],null);if($APP.I($APP.l(a,"__xFieldsetModel"),b))if(d=$APP.l(a,"__xFieldsetRefs"),
|
|
3
|
+
$APP.n(d)){c=$APP.l(d,"root-el");e=$APP.l(d,"content-el");d=$APP.l(d,"legend-el");var f=$APP.G(b),h=$APP.C(f,hR);f=$APP.C(f,iR);d.textContent=h;$APP.n(f)?$APP.U(d,"hidden"):$APP.S(d,"hidden","");f=$APP.G(b);d=$APP.C(f,$APP.jm);h=$APP.C(f,$APP.im);f=$APP.C(f,iR);$APP.n(d)?($APP.S(c,"aria-label",d),$APP.U(c,"aria-labelledby")):($APP.U(c,"aria-label"),$APP.n(f)?$APP.S(c,"aria-labelledby","x-fieldset-legend"):$APP.U(c,"aria-labelledby"));$APP.n(h)?$APP.S(c,"aria-describedby",h):$APP.U(c,"aria-describedby");
|
|
4
|
+
c=$APP.G(b);c=$APP.C(c,$APP.Wj);$APP.$i(a,"data-disabled",c);$APP.$i(e,"inert",c);a=$APP.Q(a,"__xFieldsetModel",b)}else a=null;else a=null;return a}return null},Sia=function(a){if(!$APP.n(document.getElementById("x-fieldset-input-styles"))){var b=document.createElement("style");$APP.S(b,"id","x-fieldset-input-styles");b.textContent="x-fieldset input,x-fieldset select,x-fieldset textarea{background:var(--x-fieldset-input-bg);color:var(--x-fieldset-input-color);border:1px solid var(--x-fieldset-input-border);border-radius:var(--x-fieldset-input-radius);padding:0.5rem 0.75rem;font:inherit;outline:none;box-sizing:border-box;}x-fieldset input:focus,x-fieldset select:focus,x-fieldset textarea:focus{border-color:var(--x-fieldset-input-focus);box-shadow:0 0 0 2px var(--x-fieldset-input-focus);}";
|
|
5
5
|
document.head.appendChild(b)}if(!$APP.n($APP.l(a,"__xFieldsetRefs"))){b=a.attachShadow({mode:"open"});var c=document.createElement("style"),d=document.createElement("div"),e=document.createElement("div"),f=document.createElement("div"),h=document.createElement("slot"),k={};c.textContent=":host{display:block;color-scheme:light dark;--x-fieldset-border-color:var(--x-color-border, #d1d5db);--x-fieldset-border-width:1px;--x-fieldset-border-radius:var(--x-radius-md, 8px);--x-fieldset-padding:1rem;--x-fieldset-gap:0.75rem;--x-fieldset-bg:var(--x-color-surface,transparent);--x-fieldset-legend-color:var(--x-color-text-muted,#374151);--x-fieldset-legend-font-size:var(--x-font-size-sm, 0.875rem);--x-fieldset-legend-font-weight:600;--x-fieldset-legend-padding:0 0.375rem;--x-fieldset-disabled-opacity:0.45;--x-fieldset-input-bg:var(--x-color-surface,#ffffff);--x-fieldset-input-color:var(--x-color-text,#0f172a);--x-fieldset-input-border:var(--x-color-border,#d1d5db);--x-fieldset-input-radius:var(--x-radius-sm,0.375rem);--x-fieldset-input-focus:var(--x-color-focus-ring,#60a5fa);}@media (prefers-color-scheme:dark){:host{--x-fieldset-border-color:var(--x-color-border, #374151);--x-fieldset-legend-color:var(--x-color-text-muted,#d1d5db);--x-fieldset-input-bg:var(--x-color-surface,#1f2937);--x-fieldset-input-color:var(--x-color-text,#e5e7eb);--x-fieldset-input-border:var(--x-color-border,#374151);--x-fieldset-input-focus:var(--x-color-focus-ring,#93c5fd);}}[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);}";
|
|
6
|
-
$APP.
|
|
7
|
-
$APP.
|
|
6
|
+
$APP.S(d,"part","root");$APP.S(d,"role","group");$APP.S(e,"part","legend");$APP.S(e,"id","x-fieldset-legend");$APP.S(f,"part","content");f.appendChild(h);d.appendChild(e);d.appendChild(f);b.appendChild(c);b.appendChild(d);k.root=b;k["root-el"]=d;k["legend-el"]=e;k["content-el"]=f;$APP.Q(a,"__xFieldsetRefs",k)}return jR(a)},Tia=function(a,b,c,d){return $APP.I(c,d)?jR(a):null},Via=function(a){return $APP.tj(a,Uia)},kR=function(){return $APP.ri("x-fieldset",new $APP.M(null,4,[$APP.ii,Wia,$APP.gi,Sia,
|
|
7
|
+
$APP.ci,Tia,$APP.hi,Via],null))},iR=new $APP.F(null,"legend-visible?","legend-visible?",-281107501),gR=new $APP.F(null,"legend-raw","legend-raw",907427195),hR=new $APP.F(null,"legend","legend",-1027192245);var Wia=["legend","disabled","aria-label","aria-describedby"],Uia=new $APP.M(null,2,[hR,new $APP.M(null,2,[$APP.N,$APP.X,$APP.W,"legend"],null),$APP.tn,new $APP.M(null,2,[$APP.N,$APP.rj,$APP.W,"disabled"],null)],null);$APP.ha("baredom.exports.x_fieldset.init",kR);export const init=kR;
|
package/dist/x-file-download.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
$APP.l(a,"__xFileDownloadRefs");if($APP.n(c)){c=$APP.l(c,"anchor-el");var d=$APP.G(b);d=$APP.C(d,$APP.
|
|
4
|
-
c=$APP.G(b);c=$APP.C(c,$APP.
|
|
5
|
-
|
|
2
|
+
var zH=function(a){a=new $APP.M(null,4,[yH,a.getAttribute("href"),$APP.Lq,a.getAttribute("filename"),$APP.Pj,a.hasAttribute("disabled"),$APP.am,a.getAttribute("aria-label")],null);var b=$APP.G(a);a=$APP.C(b,yH);var c=$APP.C(b,$APP.Lq),d=$APP.C(b,$APP.Pj);b=$APP.C(b,$APP.am);return new $APP.M(null,4,[$APP.Sv,$APP.Pi(a),$APP.Bu,$APP.n(c)?c:"",$APP.Wj,$APP.D(d),$APP.jm,b],null)},AH=function(a){if($APP.n($APP.l(a,"__xFileDownloadRefs"))){var b=zH(a);if($APP.I($APP.l(a,"__xFileDownloadModel"),b)){var c=
|
|
3
|
+
$APP.l(a,"__xFileDownloadRefs");if($APP.n(c)){c=$APP.l(c,"anchor-el");var d=$APP.G(b);d=$APP.C(d,$APP.Sv);c.href=d;var e=$APP.G(b);d=$APP.C(e,$APP.Sv);e=$APP.C(e,$APP.Bu);typeof e==="string"&&$APP.I(e,"")?$APP.S(c,"download",e):(e=typeof d==="string",$APP.n(e?d.startsWith("data:"):e)?$APP.S(c,"download",""):$APP.U(c,"download"));e=$APP.G(b);d=$APP.C(e,$APP.Wj);e=$APP.C(e,$APP.jm);$APP.n(d)?$APP.S(c,"aria-disabled","true"):$APP.U(c,"aria-disabled");$APP.n(e)?$APP.S(c,"aria-label",e):$APP.U(c,"aria-label");
|
|
4
|
+
c=$APP.G(b);c=$APP.C(c,$APP.Wj);$APP.$i(a,"data-disabled",c);a=$APP.Q(a,"__xFileDownloadModel",b)}else a=null}else a=null;return a}return null},Xda=function(a){function b(d){if($APP.n(a.hasAttribute("disabled")))d=d.preventDefault();else{var e=zH(a);e={href:$APP.Sv.i(e),filename:$APP.Bu.i(e)};d=$APP.gj(a,"x-file-download-click",e)?null:d.preventDefault()}return d}var c={};$APP.l($APP.l(a,"__xFileDownloadRefs"),"anchor-el").addEventListener("click",b);c.click=b;$APP.Q(a,"__xFileDownloadHandlers",c)},
|
|
5
|
+
BH=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 $APP.Q(a,"__xFileDownloadHandlers",null)},Yda=function(a){if(!$APP.n($APP.l(a,"__xFileDownloadRefs"))){var b=a.attachShadow({mode:"open"}),c=document.createElement("style"),d=document.createElement("a"),e=document.createElement("span"),f=document.createElement("span"),h=document.createElement("slot");
|
|
6
6
|
c.textContent=":host{display:inline-block;color-scheme:light dark;--x-file-download-bg:var(--x-color-primary,#2563eb);--x-file-download-color:var(--x-color-surface,#ffffff);--x-file-download-hover-bg:var(--x-color-primary-hover,#1d4ed8);--x-file-download-active-bg:var(--x-color-primary-active,#1e40af);--x-file-download-border-radius:var(--x-radius-md,6px);--x-file-download-padding:0.5rem 1rem;--x-file-download-font-size:var(--x-font-size-sm,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:var(--x-color-focus-ring,#60a5fa);--x-file-download-disabled-opacity:0.45;--x-file-download-transition:background var(--x-transition-duration,120ms) ease;}@media (prefers-color-scheme:dark){:host{--x-file-download-bg:var(--x-color-primary,#3b82f6);--x-file-download-hover-bg:var(--x-color-primary-hover,#2563eb);--x-file-download-active-bg:var(--x-color-primary-active,#1d4ed8);--x-file-download-focus-ring:var(--x-color-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
|
-
$APP.
|
|
8
|
-
f.appendChild(h);d.appendChild(e);d.appendChild(f);b.appendChild(c);b.appendChild(d);b={};b["anchor-el"]=d;b["icon-el"]=e;b["content-el"]=f;$APP.Q(a,"__xFileDownloadRefs",b)}
|
|
7
|
+
$APP.S(d,"part","anchor");$APP.S(e,"part","icon");$APP.S(f,"part","content");e.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
|
+
f.appendChild(h);d.appendChild(e);d.appendChild(f);b.appendChild(c);b.appendChild(d);b={};b["anchor-el"]=d;b["icon-el"]=e;b["content-el"]=f;$APP.Q(a,"__xFileDownloadRefs",b)}BH(a);Xda(a);return AH(a)},Zda=function(a){return BH(a)},$da=function(a,b,c,d){return $APP.I(c,d)?AH(a):null},bea=function(a){return $APP.tj(a,aea)},CH=function(){return $APP.ri("x-file-download",new $APP.M(null,5,[$APP.ii,cea,$APP.gi,Yda,$APP.di,Zda,$APP.ci,$da,$APP.hi,bea],null))},yH=new $APP.F(null,"href-raw","href-raw",-1680949453);var cea=["href","filename","disabled","aria-label"],aea=new $APP.M(null,3,[$APP.Sv,new $APP.M(null,3,[$APP.N,$APP.X,$APP.W,"href",$APP.sj,""],null),$APP.Bu,new $APP.M(null,3,[$APP.N,$APP.X,$APP.W,"filename",$APP.sj,""],null),$APP.tn,new $APP.M(null,2,[$APP.N,$APP.rj,$APP.W,"disabled"],null)],null);$APP.ie(["x-file-download-click",new $APP.M(null,2,[$APP.Xu,!0,$APP.V,new $APP.M(null,2,[$APP.Sv,$APP.X,$APP.Bu,$APP.X],null)],null)]);$APP.ha("baredom.exports.x_file_download.init",CH);export const init=CH;
|
package/dist/x-file-upload.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
c.startsWith(""+$APP.P.i(e)+"/")):$APP.z.j(e,c)},b))},
|
|
4
|
-
2,[
|
|
5
|
-
|
|
6
|
-
"accept"):$APP.
|
|
7
|
-
b=a,e=$APP.w(a),a=c,c=e):(e=$APP.
|
|
8
|
-
$APP.
|
|
9
|
-
f;$APP.
|
|
10
|
-
else{for(var d=new FormData,e=c.length,f=0;;)if(f<e)d.append(a,c[f]),f+=1;else break;b.setFormValue(d)}}},
|
|
11
|
-
|
|
12
|
-
rejected:$APP.
|
|
13
|
-
null):null},fileChange:function(b){b=b.target;var c=b.files;c.length>0&&
|
|
14
|
-
0?($APP.Q(a,"__xFileUploadDragCtr",0),$APP.U(a,"data-drag-over")):null},drop:function(b){b.preventDefault();$APP.Q(a,"__xFileUploadDragCtr",0);$APP.U(a,"data-drag-over");if($APP.n(a.hasAttribute("disabled")))return null;b=b.dataTransfer.files;return b.length>0?
|
|
15
|
-
d=c[b];c.splice(b,1);
|
|
16
|
-
$APP.l(a,"dragover"));c.removeEventListener("dragleave",$APP.l(a,"dragleave"));c.removeEventListener("drop",$APP.l(a,"drop"));d.removeEventListener("change",$APP.l(a,"fileChange"));b.removeEventListener("click",$APP.l(a,"fileListClick"))}},
|
|
2
|
+
var RE=function(a){return a!=null?(a=parseInt(a,10),$APP.p(isNaN(a))&&a>0?a:null):null},Ica=function(a){var b=a.lastIndexOf(".");return b>0?a.substring(b).toLowerCase():null},Jca=function(a,b){if(b==null||$APP.z.j(b,""))return!0;var c=function(){var e=a.type;return $APP.n(e)?e:""}().toLowerCase(),d=Ica(a.name);b=$APP.xe.j($APP.zi,$APP.xi(b,/,/));return $APP.D($APP.oe(function(e){e=e.toLowerCase();return $APP.n(e.startsWith("."))?$APP.z.j(e,d):$APP.n(e.endsWith("/*"))?(e=e.substring(0,e.indexOf("/")),
|
|
3
|
+
c.startsWith(""+$APP.P.i(e)+"/")):$APP.z.j(e,c)},b))},Kca=function(a,b,c,d,e){a=$APP.q(a);for(var f=$APP.Fe,h=$APP.Fe;;){if($APP.p(a))return new $APP.M(null,2,[SE,f,TE,h],null);var k=$APP.t(a);var m=k;var r=b,u=c;m=$APP.Di(r)&&!Jca(m,r)?new $APP.M(null,2,[$APP.gm,!1,$APP.Yq,"File type not accepted"],null):u!=null&&m.size>u?new $APP.M(null,2,[$APP.gm,!1,$APP.Yq,"File too large"],null):new $APP.M(null,2,[$APP.gm,!0,$APP.Yq,null],null);$APP.p($APP.gm.i(m))?(a=$APP.v(a),h=$APP.Ad.j(h,new $APP.M(null,
|
|
4
|
+
2,[UE,k,$APP.Yq,$APP.Yq.i(m)],null))):d!=null&&e>=d?(a=$APP.v(a),h=$APP.Ad.j(h,new $APP.M(null,2,[UE,k,$APP.Yq,"Maximum files reached"],null))):(a=$APP.v(a),f=$APP.Ad.j(f,k),e+=1)}},cF=function(a){a=new $APP.M(null,7,[VE,a.getAttribute("accept"),WE,a.hasAttribute("multiple"),XE,a.getAttribute("max-size"),YE,a.getAttribute("max-files"),$APP.Pj,a.hasAttribute("disabled"),$APP.Qj,a.hasAttribute("required"),$APP.Lj,a.getAttribute("name")],null);var b=$APP.G(a);a=$APP.C(b,VE);var c=$APP.C(b,WE),d=$APP.C(b,
|
|
5
|
+
XE),e=$APP.C(b,YE),f=$APP.C(b,$APP.Pj),h=$APP.C(b,$APP.Qj);b=$APP.C(b,$APP.Lj);return new $APP.M(null,7,[ZE,$APP.n(a)?a:"",$E,$APP.D(c),aF,RE(d),bF,RE(e),$APP.Wj,$APP.D(f),$APP.wj,$APP.D(h),$APP.Uj,$APP.n(b)?b:""],null)},dF=function(a){if($APP.n($APP.l(a,"__xFileUploadRefs"))){var b=cF(a);if($APP.I($APP.l(a,"__xFileUploadModel"),b)){var c=$APP.l(a,"__xFileUploadRefs");if($APP.n(c)){var d=$APP.l(c,"dropZone");c=$APP.l(c,"fileInput");var e=$APP.G(b),f=$APP.C(e,ZE);e=$APP.C(e,$E);$APP.z.j(f,"")?$APP.U(c,
|
|
6
|
+
"accept"):$APP.S(c,"accept",f);$APP.n(e)?$APP.S(c,"multiple",""):$APP.U(c,"multiple");c=$APP.G(b);c=$APP.C(c,$APP.Wj);$APP.S(d,"tabindex",$APP.n(c)?"-1":"0");$APP.S(d,"aria-disabled",""+$APP.P.i(c));a=$APP.Q(a,"__xFileUploadModel",b)}else a=null}else a=null;return a}return null},eF=function(a){a=$APP.q($APP.Dc(a.querySelectorAll("[part\x3dthumbnail]")));for(var b=null,c=0,d=0;;)if(d<c){var e=b.C(null,d);URL.revokeObjectURL(e.src);d+=1}else if(a=$APP.q(a))b=a,$APP.Zc(b)?(a=$APP.Eb(b),c=$APP.Fb(b),
|
|
7
|
+
b=a,e=$APP.w(a),a=c,c=e):(e=$APP.t(b),URL.revokeObjectURL(e.src),a=$APP.v(b),b=null,c=0),d=0;else return null},fF=function(a){var b=$APP.l(a,"__xFileUploadRefs");if($APP.n(b)){var c=$APP.l(b,"fileList");b=$APP.l(b,"liveRegion");a=$APP.l(a,"__xFileUploadFiles");var d=a.length;eF(c);c.textContent="";for(var e=0;;)if(e<d){var f=a[e],h=document.createElement("div"),k=document.createElement("span"),m=document.createElement("span"),r=document.createElement("button"),u=f.name;$APP.S(h,"part","file-item");
|
|
8
|
+
$APP.S(h,"role","listitem");var x=f.type,y=typeof x==="string";$APP.n(y?x.startsWith("image/"):y)&&(x=document.createElement("img"),$APP.S(x,"part","thumbnail"),x.src=URL.createObjectURL(f),$APP.S(x,"alt",u),h.appendChild(x));$APP.S(k,"part","file-name");k.textContent=u;$APP.S(m,"part","file-size");x=m;f=f.size;f=f<1024?""+$APP.P.i(f)+" B":f<1048576?""+$APP.P.i((f/1024).toFixed(1))+" KB":f<1073741824?""+$APP.P.i((f/1048576).toFixed(1))+" MB":""+$APP.P.i((f/1073741824).toFixed(1))+" GB";x.textContent=
|
|
9
|
+
f;$APP.S(r,"part","remove");$APP.S(r,"type","button");$APP.S(r,"aria-label","Remove "+$APP.P.i(u));$APP.S(r,"data-index",""+$APP.P.i(e));r.textContent="×";h.appendChild(k);h.appendChild(m);h.appendChild(r);c.appendChild(h);e+=1}else break;b.textContent=d===0?"":""+$APP.P.i(d)+" file"+$APP.P.i($APP.I(d,1)?"s":null)+" selected"}},gF=function(a){var b=$APP.l(a,"__xFileUploadInternals");if($APP.n(b)){var c=$APP.l(a,"__xFileUploadFiles");a=a.getAttribute("name");a=$APP.n(a)?a:"file";if(c.length===0)b.setFormValue(null);
|
|
10
|
+
else{for(var d=new FormData,e=c.length,f=0;;)if(f<e)d.append(a,c[f]),f+=1;else break;b.setFormValue(d)}}},hF=function(a){var b=$APP.l(a,"__xFileUploadInternals");if($APP.n(b)){var c=$APP.l(a,"__xFileUploadRefs");if($APP.n(c)){var d=a.hasAttribute("required");a=$APP.l(a,"__xFileUploadFiles");c=$APP.l(c,"dropZone");return $APP.n($APP.n(d)?a.length===0:d)?b.setValidity({valueMissing:!0},"Please select a file.",c):b.setValidity({},"")}}return null},iF=function(a,b){var c=cF(a);c=$APP.G(c);var d=$APP.C(c,
|
|
11
|
+
ZE),e=$APP.C(c,$E),f=$APP.C(c,aF),h=$APP.C(c,bF);c=$APP.l(a,"__xFileUploadFiles");b=Kca($APP.Dc(b),d,f,h,c.length);d=$APP.G(b);b=$APP.C(d,SE);d=$APP.C(d,TE);if($APP.n(e)){e=$APP.q(b);f=null;for(var k=h=0;;)if(k<h){var m=f.C(null,k);c.push(m);k+=1}else if(e=$APP.q(e))f=e,$APP.Zc(f)?(e=$APP.Eb(f),k=$APP.Fb(f),f=e,h=$APP.w(e),e=k):(e=$APP.t(f),c.push(e),e=$APP.v(f),f=null,h=0),k=0;else break}else c.length=0,$APP.q(b)&&c.push($APP.t(b));fF(a);gF(a);hF(a);return $APP.ej(a,"x-file-upload-select",{files:$APP.hd(b),
|
|
12
|
+
rejected:$APP.hd($APP.xe.j(function(r){var u=$APP.G(r);r=$APP.C(u,UE);u=$APP.C(u,$APP.Yq);return{file:r,reason:u}},d))})},Lca=function(a){return{zoneClick:function(){if($APP.n(a.hasAttribute("disabled")))return null;var b=$APP.l(a,"__xFileUploadRefs");return $APP.n(b)?$APP.l(b,"fileInput").click():null},zoneKeydown:function(b){return($APP.z.j(b.key,"Enter")||$APP.z.j(b.key," "))&&$APP.p(a.hasAttribute("disabled"))?(b.preventDefault(),b=$APP.l(a,"__xFileUploadRefs"),$APP.n(b)?$APP.l(b,"fileInput").click():
|
|
13
|
+
null):null},fileChange:function(b){b=b.target;var c=b.files;c.length>0&&iF(a,c);return b.value=""},dragenter:function(b){b.preventDefault();if($APP.n(a.hasAttribute("disabled")))return null;b=$APP.l(a,"__xFileUploadDragCtr")+1;$APP.Q(a,"__xFileUploadDragCtr",b);return $APP.z.j(b,1)?$APP.S(a,"data-drag-over",""):null},dragover:function(b){b.preventDefault();return b.dataTransfer.dropEffect="copy"},dragleave:function(){var b=$APP.l(a,"__xFileUploadDragCtr")-1;$APP.Q(a,"__xFileUploadDragCtr",b);return b<=
|
|
14
|
+
0?($APP.Q(a,"__xFileUploadDragCtr",0),$APP.U(a,"data-drag-over")):null},drop:function(b){b.preventDefault();$APP.Q(a,"__xFileUploadDragCtr",0);$APP.U(a,"data-drag-over");if($APP.n(a.hasAttribute("disabled")))return null;b=b.dataTransfer.files;return b.length>0?iF(a,b):null},fileListClick:function(b){b=b.target;b=$APP.n(b.hasAttribute("data-index"))?b:b.closest("[data-index]");if($APP.n(b)){b=parseInt(b.getAttribute("data-index"),10);if($APP.n(isNaN(b)))b=null;else{var c=$APP.l(a,"__xFileUploadFiles"),
|
|
15
|
+
d=c[b];c.splice(b,1);fF(a);gF(a);hF(a);b=$APP.ej(a,"x-file-upload-remove",{file:d,remaining:c.slice()})}return b}return null}}},jF=function(a){var b=$APP.l(a,"__xFileUploadRefs");if($APP.n(b)&&(a=$APP.l(a,"__xFileUploadHandlers"),$APP.n(a))){var c=$APP.l(b,"dropZone"),d=$APP.l(b,"fileInput");b=$APP.l(b,"fileList");c.removeEventListener("click",$APP.l(a,"zoneClick"));c.removeEventListener("keydown",$APP.l(a,"zoneKeydown"));c.removeEventListener("dragenter",$APP.l(a,"dragenter"));c.removeEventListener("dragover",
|
|
16
|
+
$APP.l(a,"dragover"));c.removeEventListener("dragleave",$APP.l(a,"dragleave"));c.removeEventListener("drop",$APP.l(a,"drop"));d.removeEventListener("change",$APP.l(a,"fileChange"));b.removeEventListener("click",$APP.l(a,"fileListClick"))}},Mca=function(a){if(!$APP.n($APP.l(a,"__xFileUploadRefs"))){var b=a.attachShadow({mode:"open"}),c=document.createElement("style"),d=document.createElement("div"),e=document.createElement("input"),f=document.createElement("div"),h=document.createElement("slot"),k=
|
|
17
17
|
document.createElement("div"),m=document.createElement("div"),r=document.createElement("div");c.textContent=":host{display:block;box-sizing:border-box;color-scheme:light dark;--x-file-upload-bg:var(--x-color-surface,#ffffff);--x-file-upload-fg:var(--x-color-text,#0f172a);--x-file-upload-muted:var(--x-color-text-muted,#64748b);--x-file-upload-border:2px dashed var(--x-color-border,#cbd5e1);--x-file-upload-border-hover:2px dashed var(--x-color-primary,#3b82f6);--x-file-upload-drag-bg:var(--x-color-primary,rgba(59,130,246,0.05));--x-file-upload-radius:var(--x-radius-md,8px);--x-file-upload-padding:var(--x-space-lg,24px);--x-file-upload-font-size:var(--x-font-size-sm,0.9375rem);--x-file-upload-focus-ring:var(--x-color-focus-ring,#60a5fa);--x-file-upload-disabled-opacity:var(--x-opacity-disabled,0.55);--x-file-upload-transition-duration:var(--x-transition-duration,150ms);--x-file-upload-item-bg:var(--x-color-surface,#f8fafc);--x-file-upload-item-border:1px solid var(--x-color-border,#e2e8f0);--x-file-upload-thumb-size:48px;--x-file-upload-remove-color:var(--x-color-text-muted,#64748b);--x-file-upload-remove-hover:var(--x-color-danger,#ef4444);}@media (prefers-color-scheme:dark){:host{--x-file-upload-bg:var(--x-color-surface,#1e293b);--x-file-upload-fg:var(--x-color-text,#e2e8f0);--x-file-upload-muted:var(--x-color-text-muted,#94a3b8);--x-file-upload-border:2px dashed var(--x-color-border,#334155);--x-file-upload-border-hover:2px dashed var(--x-color-primary,#60a5fa);--x-file-upload-drag-bg:rgba(96,165,250,0.08);--x-file-upload-focus-ring:var(--x-color-focus-ring,#93c5fd);--x-file-upload-item-bg:var(--x-color-surface,#1e293b);--x-file-upload-item-border:1px solid var(--x-color-border,#334155);--x-file-upload-remove-color:var(--x-color-text-muted,#94a3b8);}}[part\x3ddrop-zone]{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:120px;padding:var(--x-file-upload-padding);background:var(--x-file-upload-bg);border:var(--x-file-upload-border);border-radius:var(--x-file-upload-radius);cursor:pointer;text-align:center;color:var(--x-file-upload-muted);font-size:var(--x-file-upload-font-size);font-family:inherit;transition:border-color var(--x-file-upload-transition-duration) ease,background var(--x-file-upload-transition-duration) ease;}[part\x3ddrop-zone]:hover{border:var(--x-file-upload-border-hover);}[part\x3ddrop-zone]:focus-visible{outline:none;box-shadow:0 0 0 2px var(--x-file-upload-focus-ring);}:host([data-drag-over]) [part\x3ddrop-zone]{border:var(--x-file-upload-border-hover);background:var(--x-file-upload-drag-bg);}:host([data-drag-over]) [part\x3dcontent]{visibility:hidden;}:host([data-drag-over]) [part\x3ddrag-overlay]{display:flex;}[part\x3ddrag-overlay]{display:none;position:absolute;inset:0;align-items:center;justify-content:center;border-radius:var(--x-file-upload-radius);font-weight:600;color:var(--x-color-primary,#3b82f6);pointer-events:none;}:host([disabled]){pointer-events:none;cursor:default;}:host([disabled]) [part\x3ddrop-zone]{opacity:var(--x-file-upload-disabled-opacity);}[part\x3dfile-list]{display:flex;flex-direction:column;gap:8px;margin-top:12px;}[part\x3dfile-list]:empty{display:none;}[part\x3dfile-item]{display:flex;align-items:center;gap:12px;padding:8px 12px;background:var(--x-file-upload-item-bg);border:var(--x-file-upload-item-border);border-radius:6px;font-size:var(--x-file-upload-font-size);font-family:inherit;color:var(--x-file-upload-fg);}[part\x3dthumbnail]{width:var(--x-file-upload-thumb-size);height:var(--x-file-upload-thumb-size);object-fit:cover;border-radius:4px;flex-shrink:0;}[part\x3dfile-name]{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}[part\x3dfile-size]{color:var(--x-file-upload-muted);font-size:0.8125rem;flex-shrink:0;}[part\x3dremove]{all:unset;display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;font-size:1rem;color:var(--x-file-upload-remove-color);cursor:pointer;border-radius:4px;flex-shrink:0;}[part\x3dremove]:hover{color:var(--x-file-upload-remove-hover);}[part\x3dremove]:focus-visible{outline:none;box-shadow:0 0 0 2px var(--x-file-upload-focus-ring);}[part\x3dlive-region]{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);}input[type\x3dfile]{display:none;}@media (prefers-reduced-motion:reduce){[part\x3ddrop-zone]{transition:none !important;}}@media (pointer:coarse){[part\x3ddrop-zone]{min-height:140px;}[part\x3dremove]{width:2.75rem;height:2.75rem;}}";
|
|
18
|
-
$APP.
|
|
19
|
-
b.appendChild(d);b.appendChild(m);b.appendChild(r);$APP.Q(a,"__xFileUploadFiles",[]);$APP.Q(a,"__xFileUploadDragCtr",0);$APP.Q(a,"__xFileUploadRefs",{dropZone:d,fileInput:e,content:f,dragOverlay:k,fileList:m,liveRegion:r})}b=a.attachInternals;$APP.n($APP.n(b)?$APP.p($APP.l(a,"__xFileUploadInternals")):b)&&$APP.Q(a,"__xFileUploadInternals",a.attachInternals());
|
|
20
|
-
$APP.l(e,"dropZone"),d=$APP.l(e,"fileInput"),e=$APP.l(e,"fileList"),c.addEventListener("click",$APP.l(b,"zoneClick")),c.addEventListener("keydown",$APP.l(b,"zoneKeydown")),c.addEventListener("dragenter",$APP.l(b,"dragenter")),c.addEventListener("dragover",$APP.l(b,"dragover")),c.addEventListener("dragleave",$APP.l(b,"dragleave")),c.addEventListener("drop",$APP.l(b,"drop")),d.addEventListener("change",$APP.l(b,"fileChange")),e.addEventListener("click",$APP.l(b,"fileListClick"))));
|
|
21
|
-
|
|
22
|
-
$APP.
|
|
23
|
-
1874130431),
|
|
24
|
-
|
|
25
|
-
$APP.
|
|
26
|
-
2,[$APP.
|
|
27
|
-
$APP.
|
|
18
|
+
$APP.S(d,"part","drop-zone");$APP.S(d,"role","button");$APP.S(d,"tabindex","0");$APP.S(e,"type","file");$APP.S(e,"aria-hidden","true");$APP.S(e,"tabindex","-1");$APP.S(f,"part","content");f.appendChild(h);$APP.S(k,"part","drag-overlay");$APP.S(k,"hidden","");k.textContent="Drop files here";$APP.S(m,"part","file-list");$APP.S(m,"role","list");$APP.S(r,"part","live-region");$APP.S(r,"aria-live","polite");$APP.S(r,"aria-atomic","true");d.appendChild(e);d.appendChild(f);d.appendChild(k);b.appendChild(c);
|
|
19
|
+
b.appendChild(d);b.appendChild(m);b.appendChild(r);$APP.Q(a,"__xFileUploadFiles",[]);$APP.Q(a,"__xFileUploadDragCtr",0);$APP.Q(a,"__xFileUploadRefs",{dropZone:d,fileInput:e,content:f,dragOverlay:k,fileList:m,liveRegion:r})}b=a.attachInternals;$APP.n($APP.n(b)?$APP.p($APP.l(a,"__xFileUploadInternals")):b)&&$APP.Q(a,"__xFileUploadInternals",a.attachInternals());jF(a);$APP.Q(a,"__xFileUploadHandlers",Lca(a));e=$APP.l(a,"__xFileUploadRefs");$APP.n(e)&&(b=$APP.l(a,"__xFileUploadHandlers"),$APP.n(b)&&(c=
|
|
20
|
+
$APP.l(e,"dropZone"),d=$APP.l(e,"fileInput"),e=$APP.l(e,"fileList"),c.addEventListener("click",$APP.l(b,"zoneClick")),c.addEventListener("keydown",$APP.l(b,"zoneKeydown")),c.addEventListener("dragenter",$APP.l(b,"dragenter")),c.addEventListener("dragover",$APP.l(b,"dragover")),c.addEventListener("dragleave",$APP.l(b,"dragleave")),c.addEventListener("drop",$APP.l(b,"drop")),d.addEventListener("change",$APP.l(b,"fileChange")),e.addEventListener("click",$APP.l(b,"fileListClick"))));dF(a);return hF(a)},
|
|
21
|
+
Nca=function(a){jF(a);a=$APP.l(a,"__xFileUploadRefs");return $APP.n(a)?eF($APP.l(a,"fileList")):null},Oca=function(a,b,c,d){return $APP.I(c,d)?dF(a):null},Pca=function(a,b){$APP.$i(a,"disabled",b);return dF(a)},Qca=function(a){$APP.l(a,"__xFileUploadFiles").length=0;var b=$APP.l(a,"__xFileUploadRefs");$APP.n(b)&&eF($APP.l(b,"fileList"));fF(a);gF(a);return hF(a)},Rca=function(a){$APP.Fj(a,"__xFileUploadInternals");$APP.nj(a,"accept","accept");$APP.nj(a,"name","name");$APP.jj(a,"multiple","multiple");
|
|
22
|
+
$APP.jj(a,"disabled","disabled");$APP.jj(a,"required","required");$APP.oj(a,"maxSize","max-size",0);$APP.oj(a,"maxFiles","max-files",0);return Object.defineProperty(a,"files",{configurable:!0,enumerable:!0,get:function(){var b=$APP.l(this,"__xFileUploadFiles");return($APP.n(b)?b:[]).slice()}})},kF=function(){return $APP.ri("x-file-upload",new $APP.M(null,8,[$APP.ii,Sca,$APP.gi,Mca,$APP.di,Nca,$APP.ci,Oca,$APP.ei,!0,$APP.bi,Pca,$APP.ai,Qca,$APP.hi,Rca],null))},ZE=new $APP.F(null,"accept","accept",
|
|
23
|
+
1874130431),lF=new $APP.F(null,"files","files",-472457450),TE=new $APP.F(null,"rejected","rejected",231052999),SE=new $APP.F(null,"accepted","accepted",-1953464374),XE=new $APP.F(null,"max-size-raw","max-size-raw",1536077032),aF=new $APP.F(null,"max-size","max-size",-874966132),$E=new $APP.F(null,"multiple?","multiple?",-490002283),VE=new $APP.F(null,"accept-raw","accept-raw",1407413888),bF=new $APP.F(null,"max-files","max-files",534742526),Tca=new $APP.F(null,"remaining","remaining",-138926777),
|
|
24
|
+
WE=new $APP.F(null,"multiple-present?","multiple-present?",-1754894397),UE=new $APP.F(null,"file","file",-1269645878),YE=new $APP.F(null,"max-files-raw","max-files-raw",-244409320);var Sca="accept multiple max-size max-files disabled required name".split(" ");
|
|
25
|
+
$APP.vg([$APP.Zv,$APP.jv,$APP.Mr,$APP.tn,$APP.Uj,new $APP.F(null,"multiple","multiple",1244445549),lF,$APP.Ut,new $APP.F(null,"maxFiles","maxFiles",-1897204198),new $APP.F(null,"maxSize","maxSize",-1434884613),$APP.Xs,$APP.et,ZE],[new $APP.M(null,2,[$APP.N,$APP.X,$APP.qj,!0],null),new $APP.M(null,2,[$APP.N,$APP.ts,$APP.qj,!0],null),new $APP.M(null,2,[$APP.N,$APP.rj,$APP.qj,!0],null),new $APP.M(null,2,[$APP.N,$APP.rj,$APP.W,"disabled"],null),new $APP.M(null,2,[$APP.N,$APP.X,$APP.W,"name"],null),new $APP.M(null,
|
|
26
|
+
2,[$APP.N,$APP.rj,$APP.W,"multiple"],null),new $APP.M(null,2,[$APP.N,$APP.br,$APP.Ns,!0],null),new $APP.M(null,2,[$APP.N,$APP.pt,$APP.qj,!0],null),new $APP.M(null,2,[$APP.N,$APP.Y,$APP.W,"max-files"],null),new $APP.M(null,2,[$APP.N,$APP.Y,$APP.W,"max-size"],null),new $APP.M(null,2,[$APP.N,$APP.rj,$APP.W,"required"],null),new $APP.M(null,2,[$APP.N,$APP.Ks,$APP.qj,!0],null),new $APP.M(null,2,[$APP.N,$APP.X,$APP.W,"accept"],null)]);
|
|
27
|
+
$APP.ie(["x-file-upload-select",new $APP.M(null,2,[$APP.Xu,!1,$APP.V,new $APP.M(null,2,[lF,$APP.br,TE,$APP.br],null)],null),"x-file-upload-remove",new $APP.M(null,2,[$APP.Xu,!1,$APP.V,new $APP.M(null,2,[UE,$APP.Qt,Tca,$APP.br],null)],null)]);$APP.ha("baredom.exports.x_file_upload.init",kF);export const init=kF;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// x-floating-panel.d.ts — auto-generated by generate_types.bb, do not edit
|
|
2
|
+
|
|
3
|
+
export function init(): void;
|
|
4
|
+
|
|
5
|
+
export interface XFloatingPanelEventMap {
|
|
6
|
+
"x-floating-panel-toggle": CustomEvent<{ open: boolean }>;
|
|
7
|
+
"x-floating-panel-dismiss-request": CustomEvent<{ reason: string }>;
|
|
8
|
+
"x-floating-panel-move": CustomEvent<{ x: number; y: number; source: string }>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface XFloatingPanel extends HTMLElement {
|
|
12
|
+
open: boolean;
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
step: number;
|
|
16
|
+
closable: boolean;
|
|
17
|
+
resizable: boolean;
|
|
18
|
+
label: string;
|
|
19
|
+
focusOnOpen: boolean;
|
|
20
|
+
show(): void;
|
|
21
|
+
hide(): void;
|
|
22
|
+
toggle(): void;
|
|
23
|
+
|
|
24
|
+
addEventListener<K extends keyof XFloatingPanelEventMap>(
|
|
25
|
+
type: K,
|
|
26
|
+
listener: (this: XFloatingPanel, ev: XFloatingPanelEventMap[K]) => any,
|
|
27
|
+
options?: boolean | AddEventListenerOptions
|
|
28
|
+
): void;
|
|
29
|
+
addEventListener(
|
|
30
|
+
type: string,
|
|
31
|
+
listener: EventListenerOrEventListenerObject,
|
|
32
|
+
options?: boolean | AddEventListenerOptions
|
|
33
|
+
): void;
|
|
34
|
+
removeEventListener<K extends keyof XFloatingPanelEventMap>(
|
|
35
|
+
type: K,
|
|
36
|
+
listener: (this: XFloatingPanel, ev: XFloatingPanelEventMap[K]) => any,
|
|
37
|
+
options?: boolean | EventListenerOptions
|
|
38
|
+
): void;
|
|
39
|
+
removeEventListener(
|
|
40
|
+
type: string,
|
|
41
|
+
listener: EventListenerOrEventListenerObject,
|
|
42
|
+
options?: boolean | EventListenerOptions
|
|
43
|
+
): void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare global {
|
|
47
|
+
interface HTMLElementTagNameMap {
|
|
48
|
+
"x-floating-panel": XFloatingPanel;
|
|
49
|
+
}
|
|
50
|
+
}
|