@vanelsas/baredom 2.5.0 → 2.6.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 +14 -0
- package/README.md +11 -296
- package/custom-elements.json +36 -1
- package/dist/base.js +38 -38
- package/dist/integrity.json +93 -93
- package/dist/x-alert.js +17 -17
- package/dist/x-avatar-group.js +10 -10
- package/dist/x-avatar.js +13 -13
- package/dist/x-badge.js +11 -11
- package/dist/x-bento-grid.js +5 -5
- package/dist/x-bento-item.js +4 -4
- package/dist/x-breadcrumbs.js +14 -14
- package/dist/x-button.js +15 -15
- package/dist/x-cancel-dialogue.js +12 -12
- package/dist/x-card.js +7 -7
- package/dist/x-carousel.js +28 -28
- package/dist/x-chart.js +46 -46
- package/dist/x-checkbox.js +11 -11
- package/dist/x-chip.js +8 -8
- package/dist/x-collapse.js +10 -10
- package/dist/x-color-picker.js +40 -40
- package/dist/x-combobox.d.ts +1 -0
- package/dist/x-combobox.js +25 -25
- package/dist/x-command-palette.js +24 -24
- package/dist/x-container.js +6 -6
- package/dist/x-context-menu.js +18 -18
- package/dist/x-copy.js +20 -20
- package/dist/x-currency-field.d.ts +1 -0
- package/dist/x-currency-field.js +23 -22
- package/dist/x-date-picker.js +37 -37
- package/dist/x-divider.js +8 -8
- package/dist/x-drawer.js +11 -11
- package/dist/x-dropdown.js +9 -9
- package/dist/x-fieldset.js +5 -5
- package/dist/x-file-download.js +7 -7
- package/dist/x-file-upload.js +22 -22
- package/dist/x-form-field.js +15 -15
- package/dist/x-form.js +9 -9
- package/dist/x-gaussian-blur.js +16 -16
- package/dist/x-grid.js +6 -6
- package/dist/x-icon.js +7 -7
- package/dist/x-image.js +18 -18
- package/dist/x-kinetic-font.js +28 -28
- package/dist/x-kinetic-typography.js +37 -37
- package/dist/x-liquid-dock.js +35 -35
- package/dist/x-liquid-fill.js +40 -40
- package/dist/x-liquid-glass.js +35 -35
- package/dist/x-menu-item.js +10 -10
- package/dist/x-menu.js +10 -10
- package/dist/x-metaball-cursor.js +25 -25
- package/dist/x-modal.js +11 -11
- package/dist/x-morph-stack.js +39 -39
- package/dist/x-navbar.js +12 -12
- package/dist/x-neural-glow.js +30 -30
- package/dist/x-notification-center.js +10 -10
- package/dist/x-organic-divider.js +15 -15
- package/dist/x-organic-progress.js +35 -35
- package/dist/x-organic-shape.js +12 -12
- package/dist/x-pagination.d.ts +2 -1
- package/dist/x-pagination.js +17 -16
- package/dist/x-particle-button.js +46 -46
- package/dist/x-popover.js +23 -23
- package/dist/x-progress-circle.js +7 -7
- package/dist/x-progress.js +7 -7
- package/dist/x-radio.js +11 -11
- package/dist/x-ripple-effect.js +11 -11
- package/dist/x-scroll-parallax.js +17 -17
- package/dist/x-scroll-stack.js +18 -18
- package/dist/x-scroll-story.js +33 -33
- package/dist/x-scroll-timeline.js +44 -44
- package/dist/x-scroll.js +39 -39
- package/dist/x-search-field.js +15 -15
- package/dist/x-select.d.ts +1 -0
- package/dist/x-select.js +10 -10
- package/dist/x-sidebar.js +16 -16
- package/dist/x-skeleton-group.js +13 -13
- package/dist/x-skeleton.js +1 -1
- package/dist/x-slider.d.ts +1 -0
- package/dist/x-slider.js +18 -16
- package/dist/x-soft-body.js +20 -20
- package/dist/x-spacer.js +5 -5
- package/dist/x-spinner.js +5 -5
- package/dist/x-splash.js +13 -13
- package/dist/x-stat.js +9 -9
- package/dist/x-stepper.js +14 -14
- package/dist/x-switch.js +10 -10
- package/dist/x-tab.js +7 -7
- package/dist/x-table-cell.js +19 -19
- package/dist/x-table-row.js +10 -10
- package/dist/x-table.js +13 -13
- package/dist/x-tabs.d.ts +1 -0
- package/dist/x-tabs.js +11 -11
- package/dist/x-text-area.d.ts +1 -0
- package/dist/x-text-area.js +20 -18
- package/dist/x-theme.js +24 -24
- package/dist/x-timeline-item.js +19 -19
- package/dist/x-timeline.js +9 -9
- package/dist/x-toast.js +21 -21
- package/dist/x-toaster.js +8 -8
- package/dist/x-tooltip.js +12 -12
- package/dist/x-typography.js +8 -8
- package/dist/x-welcome-tour.js +58 -58
- package/package.json +6 -2
package/dist/x-file-download.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
$APP.k(b,"anchor-el");var c=
|
|
4
|
-
var c=
|
|
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.T.g(d),d=this.setAttribute(c,d)):d=this.removeAttribute(c);return d}})},
|
|
6
|
-
{get:function(){return
|
|
2
|
+
var Lz=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},Pz=function(a){a=new $APP.Q(null,4,[Mz,a.getAttribute("href"),Nz,a.getAttribute("filename"),$APP.Ol,a.hasAttribute("disabled"),$APP.Uj,a.getAttribute("aria-label")],null);var b=$APP.M(a);a=$APP.D(b,Mz);var c=$APP.D(b,Nz),d=$APP.D(b,$APP.Ol);b=$APP.D(b,$APP.Uj);return new $APP.Q(null,4,[$APP.an,$APP.Og(a),Oz,$APP.n(c)?c:"",$APP.X,$APP.F(d),$APP.Ql,b],null)},Qz=function(a){var b=$APP.k(a,"__xFileDownloadRefs");if($APP.n(b)){b=
|
|
3
|
+
$APP.k(b,"anchor-el");var c=Pz(a),d=$APP.an.g(c),e=Oz.g(c),g=$APP.X.g(c);c=$APP.Ql.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 Lz(a,"data-disabled",g)}return null},Rz=function(a){return function(b){if($APP.n(a.hasAttribute("disabled")))return b.preventDefault();
|
|
4
|
+
var c=Pz(a);c={href:$APP.an.g(c),filename:Oz.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}},Sz=function(a){var b=$APP.k(a,"__xFileDownloadHandlers"),c=$APP.k(a,"__xFileDownloadRefs");$APP.n($APP.n(b)?c:b)&&(c=$APP.k(c,"anchor-el"),b=$APP.k(b,"click"),$APP.n(b)&&c.removeEventListener("click",b));return a.__xFileDownloadHandlers=null},Tz=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.T.g(d),d=this.setAttribute(c,d)):d=this.removeAttribute(c);return d}})},Uz=function(a){Object.defineProperty(a,"disabled",{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute("disabled")},set:function(b){return Lz(this,"disabled",$APP.F(b))}})},Wz=function(){var a=class extends HTMLElement{},b=a.prototype;Object.defineProperty(a,"observedAttributes",
|
|
6
|
+
{get:function(){return Vz}});Tz(b,"href","href");Tz(b,"filename","filename");Uz(b);b.connectedCallback=function(){if(!$APP.n($APP.k(this,"__xFileDownloadRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("a"),g=document.createElement("span"),h=document.createElement("span"),l=document.createElement("slot");d.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
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(l);e.appendChild(g);e.appendChild(h);c.appendChild(d);c.appendChild(e);this.__xFileDownloadRefs={"anchor-el":e,"icon-el":g,"content-el":h}}
|
|
9
|
-
|
|
8
|
+
h.appendChild(l);e.appendChild(g);e.appendChild(h);c.appendChild(d);c.appendChild(e);this.__xFileDownloadRefs={"anchor-el":e,"icon-el":g,"content-el":h}}Sz(this);c=Rz(this);$APP.k($APP.k(this,"__xFileDownloadRefs"),"anchor-el").addEventListener("click",c);this.__xFileDownloadHandlers={click:c};return Qz(this)};b.disconnectedCallback=function(){return Sz(this)};b.attributeChangedCallback=function(){return Qz(this)};return a},Xz=function(){return $APP.n(customElements.get("x-file-download"))?null:customElements.define("x-file-download",
|
|
9
|
+
Wz())},Nz=new $APP.K(null,"filename-raw","filename-raw",-706184256),Mz=new $APP.K(null,"href-raw","href-raw",-1680949453),Oz=new $APP.K(null,"filename","filename",-1428840783);var Vz=["href","filename","disabled","aria-label"];$APP.Pd(["x-file-download-click",new $APP.Q(null,2,[$APP.lm,!0,$APP.V,new $APP.Q(null,2,[$APP.an,$APP.Y,Oz,$APP.Y],null)],null)]);$APP.ha("baredom.exports.x_file_download.init",Xz);export const init=Xz;
|
package/dist/x-file-upload.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
c.startsWith(""+$APP.T.g(e)+"/")):$APP.B.i(e,c)},b))},
|
|
4
|
-
[
|
|
5
|
-
a=$APP.D(b,
|
|
6
|
-
e.setAttribute("accept",a);$APP.n(d)?e.setAttribute("multiple",""):e.removeAttribute("multiple");b.setAttribute("tabindex",$APP.n(c)?"-1":"0");a=""+$APP.T.g(c);return b.setAttribute("aria-disabled",a)}return null},
|
|
7
|
-
$APP.w(b),b=null,c=0),d=0;else return null},
|
|
2
|
+
var Iv=function(a){return a!=null?(a=parseInt(a,10),$APP.r(isNaN(a))&&a>0?a:null):null},Jv=function(a){var b=a.lastIndexOf(".");return b>0?a.substring(b).toLowerCase():null},Kv=function(a,b){if(b==null||$APP.B.i(b,""))return!0;var c=function(){var e=a.type;return $APP.n(e)?e:""}().toLowerCase(),d=Jv(a.name);b=$APP.ae.i($APP.Jg,$APP.Hg(b,/,/));return $APP.F($APP.Td(function(e){e=e.toLowerCase();return $APP.n(e.startsWith("."))?$APP.B.i(e,d):$APP.n(e.endsWith("/*"))?(e=e.substring(0,e.indexOf("/")),
|
|
3
|
+
c.startsWith(""+$APP.T.g(e)+"/")):$APP.B.i(e,c)},b))},bw=function(a,b,c,d,e){a=$APP.t(a);for(var g=$APP.fe,h=$APP.fe;;){if($APP.r(a))return new $APP.Q(null,2,[Zv,g,$v,h],null);var l=$APP.u(a);var m=l;var p=b,q=c;m=$APP.Lg(p)&&!Kv(m,p)?new $APP.Q(null,2,[$APP.Th,!1,$APP.Qi,"File type not accepted"],null):q!=null&&m.size>q?new $APP.Q(null,2,[$APP.Th,!1,$APP.Qi,"File too large"],null):new $APP.Q(null,2,[$APP.Th,!0,$APP.Qi,null],null);$APP.r($APP.Th.g(m))?(a=$APP.w(a),h=$APP.ld.i(h,new $APP.Q(null,2,
|
|
4
|
+
[aw,l,$APP.Qi,$APP.Qi.g(m)],null))):d!=null&&e>=d?(a=$APP.w(a),h=$APP.ld.i(h,new $APP.Q(null,2,[aw,l,$APP.Qi,"Maximum files reached"],null))):(a=$APP.w(a),g=$APP.ld.i(g,l),e+=1)}},cw=function(a){return document.createElement(a)},lw=function(a){a=new $APP.Q(null,7,[dw,a.getAttribute("accept"),ew,a.hasAttribute("multiple"),fw,a.getAttribute("max-size"),gw,a.getAttribute("max-files"),$APP.Ol,a.hasAttribute("disabled"),$APP.Nh,a.hasAttribute("required"),$APP.Al,a.getAttribute("name")],null);var b=$APP.M(a);
|
|
5
|
+
a=$APP.D(b,dw);var c=$APP.D(b,ew),d=$APP.D(b,fw),e=$APP.D(b,gw),g=$APP.D(b,$APP.Ol),h=$APP.D(b,$APP.Nh);b=$APP.D(b,$APP.Al);return new $APP.Q(null,7,[hw,$APP.n(a)?a:"",iw,$APP.F(c),jw,Iv(d),kw,Iv(e),$APP.X,$APP.F(g),$APP.mi,$APP.F(h),$APP.Aj,$APP.n(b)?b:""],null)},mw=function(a){var b=$APP.k(a,"__xFileUploadRefs");if($APP.n(b)){a=lw(a);var c=$APP.M(a);a=$APP.D(c,hw);var d=$APP.D(c,iw);c=$APP.D(c,$APP.X);var e=$APP.k(b,"fileInput");b=$APP.k(b,"dropZone");$APP.B.i(a,"")?e.removeAttribute("accept"):
|
|
6
|
+
e.setAttribute("accept",a);$APP.n(d)?e.setAttribute("multiple",""):e.removeAttribute("multiple");b.setAttribute("tabindex",$APP.n(c)?"-1":"0");a=""+$APP.T.g(c);return b.setAttribute("aria-disabled",a)}return null},nw=function(a){a=$APP.t($APP.uc(a.querySelectorAll("[part\x3dthumbnail]")));for(var b=null,c=0,d=0;;)if(d<c){var e=b.F(null,d);URL.revokeObjectURL(e.src);d+=1}else if(a=$APP.t(a))b=a,$APP.Nc(b)?(a=$APP.yb(b),c=$APP.zb(b),b=a,e=$APP.z(a),a=c,c=e):(e=$APP.u(b),URL.revokeObjectURL(e.src),a=
|
|
7
|
+
$APP.w(b),b=null,c=0),d=0;else return null},ow=function(a){var b=$APP.k(a,"__xFileUploadRefs");if($APP.n(b)){var c=$APP.k(b,"fileList");b=$APP.k(b,"liveRegion");a=$APP.k(a,"__xFileUploadFiles");var d=a.length;nw(c);c.textContent="";for(var e=0;;)if(e<d){var g=a[e],h=cw("div"),l=cw("span"),m=cw("span"),p=cw("button"),q=g.name;h.setAttribute("part","file-item");h.setAttribute("role","listitem");var v=g.type,x=typeof v==="string";$APP.n(x?v.startsWith("image/"):x)&&(v=cw("img"),v.setAttribute("part",
|
|
8
8
|
"thumbnail"),v.src=URL.createObjectURL(g),v.setAttribute("alt",q),h.appendChild(v));l.setAttribute("part","file-name");l.textContent=q;m.setAttribute("part","file-size");v=m;g=g.size;g=g<1024?""+$APP.T.g(g)+" B":g<1048576?""+$APP.T.g((g/1024).toFixed(1))+" KB":g<1073741824?""+$APP.T.g((g/1048576).toFixed(1))+" MB":""+$APP.T.g((g/1073741824).toFixed(1))+" GB";v.textContent=g;p.setAttribute("part","remove");p.setAttribute("type","button");g=p;q="Remove "+$APP.T.g(q);g.setAttribute("aria-label",q);q=
|
|
9
|
-
p;g=""+$APP.T.g(e);q.setAttribute("data-index",g);p.textContent="×";h.appendChild(l);h.appendChild(m);h.appendChild(p);c.appendChild(h);e+=1}else break;b.textContent=d===0?"":""+$APP.T.g(d)+" file"+$APP.T.g($APP.N(d,1)?"s":null)+" selected"}},
|
|
10
|
-
g+=1;else break;b.setFormValue(d)}}},
|
|
11
|
-
b){var c=
|
|
12
|
-
"x-file-upload-select",{files:$APP.zd(b),rejected:$APP.zd($APP.ae.i(function(p){var q=$APP.M(p);p=$APP.D(q
|
|
13
|
-
$APP.n(b)?$APP.k(b,"fileInput").click():null):null},fileChange:function(b){b=b.target;var c=b.files;c.length>0&&
|
|
14
|
-
b;return b<=0?(a.__xFileUploadDragCtr=0,a.removeAttribute("data-drag-over")):null},drop:function(b){b.preventDefault();a.__xFileUploadDragCtr=0;a.removeAttribute("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.k(a,"dragover"));c.removeEventListener("dragleave",$APP.k(a,"dragleave"));c.removeEventListener("drop",$APP.k(a,"drop"));d.removeEventListener("change",$APP.k(a,"fileChange"));b.removeEventListener("click",$APP.k(a,"fileListClick"))}},
|
|
17
|
-
this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){return d!=null&&$APP.N(d)?this.setAttribute(c,""+$APP.T.g(d)):this.removeAttribute(c)}})},
|
|
18
|
-
!0;Object.defineProperty(a,"observedAttributes",{get:function(){return
|
|
19
|
-
c.checkValidity():null};b.reportValidity=function(){var c=$APP.k(this,"__xFileUploadInternals");return $APP.n(c)?c.reportValidity():null};b.formDisabledCallback=function(c){$APP.Eg(this,"disabled",c);return
|
|
20
|
-
d=
|
|
9
|
+
p;g=""+$APP.T.g(e);q.setAttribute("data-index",g);p.textContent="×";h.appendChild(l);h.appendChild(m);h.appendChild(p);c.appendChild(h);e+=1}else break;b.textContent=d===0?"":""+$APP.T.g(d)+" file"+$APP.T.g($APP.N(d,1)?"s":null)+" selected"}},pw=function(a){var b=$APP.k(a,"__xFileUploadInternals");if($APP.n(b)){var c=$APP.k(a,"__xFileUploadFiles");a=a.getAttribute("name");a=$APP.n(a)?a:"file";if(c.length===0)b.setFormValue(null);else{for(var d=new FormData,e=c.length,g=0;;)if(g<e)d.append(a,c[g]),
|
|
10
|
+
g+=1;else break;b.setFormValue(d)}}},qw=function(a){var b=$APP.k(a,"__xFileUploadInternals");if($APP.n(b)){var c=$APP.k(a,"__xFileUploadRefs");if($APP.n(c)){var d=a.hasAttribute("required");a=$APP.k(a,"__xFileUploadFiles");c=$APP.k(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},rw=function(a,b,c){return a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,composed:!0,cancelable:!1}))},sw=function(a,
|
|
11
|
+
b){var c=lw(a);c=$APP.M(c);var d=$APP.D(c,hw),e=$APP.D(c,iw),g=$APP.D(c,jw),h=$APP.D(c,kw);c=$APP.k(a,"__xFileUploadFiles");b=bw($APP.uc(b),d,g,h,c.length);d=$APP.M(b);b=$APP.D(d,Zv);d=$APP.D(d,$v);if($APP.n(e)){e=$APP.t(b);g=null;for(var l=h=0;;)if(l<h){var m=g.F(null,l);c.push(m);l+=1}else if(e=$APP.t(e))g=e,$APP.Nc(g)?(e=$APP.yb(g),l=$APP.zb(g),g=e,h=$APP.z(e),e=l):(e=$APP.u(g),c.push(e),e=$APP.w(g),g=null,h=0),l=0;else break}else c.length=0,$APP.t(b)&&c.push($APP.u(b));ow(a);pw(a);qw(a);return rw(a,
|
|
12
|
+
"x-file-upload-select",{files:$APP.zd(b),rejected:$APP.zd($APP.ae.i(function(p){var q=$APP.M(p);p=$APP.D(q,aw);q=$APP.D(q,$APP.Qi);return{file:p,reason:q}},d))})},tw=function(a){return{zoneClick:function(){if($APP.n(a.hasAttribute("disabled")))return null;var b=$APP.k(a,"__xFileUploadRefs");return $APP.n(b)?$APP.k(b,"fileInput").click():null},zoneKeydown:function(b){return($APP.B.i(b.key,"Enter")||$APP.B.i(b.key," "))&&$APP.r(a.hasAttribute("disabled"))?(b.preventDefault(),b=$APP.k(a,"__xFileUploadRefs"),
|
|
13
|
+
$APP.n(b)?$APP.k(b,"fileInput").click():null):null},fileChange:function(b){b=b.target;var c=b.files;c.length>0&&sw(a,c);return b.value=""},dragenter:function(b){b.preventDefault();if($APP.n(a.hasAttribute("disabled")))return null;b=$APP.k(a,"__xFileUploadDragCtr")+1;a.__xFileUploadDragCtr=b;return $APP.B.i(b,1)?a.setAttribute("data-drag-over",""):null},dragover:function(b){b.preventDefault();return b.dataTransfer.dropEffect="copy"},dragleave:function(){var b=$APP.k(a,"__xFileUploadDragCtr")-1;a.__xFileUploadDragCtr=
|
|
14
|
+
b;return b<=0?(a.__xFileUploadDragCtr=0,a.removeAttribute("data-drag-over")):null},drop:function(b){b.preventDefault();a.__xFileUploadDragCtr=0;a.removeAttribute("data-drag-over");if($APP.n(a.hasAttribute("disabled")))return null;b=b.dataTransfer.files;return b.length>0?sw(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.k(a,"__xFileUploadFiles"),
|
|
15
|
+
d=c[b];c.splice(b,1);ow(a);pw(a);qw(a);b=rw(a,"x-file-upload-remove",{file:d,remaining:c.slice()})}return b}return null}}},uw=function(a){var b=$APP.k(a,"__xFileUploadRefs");if($APP.n(b)&&(a=$APP.k(a,"__xFileUploadHandlers"),$APP.n(a))){var c=$APP.k(b,"dropZone"),d=$APP.k(b,"fileInput");b=$APP.k(b,"fileList");c.removeEventListener("click",$APP.k(a,"zoneClick"));c.removeEventListener("keydown",$APP.k(a,"zoneKeydown"));c.removeEventListener("dragenter",$APP.k(a,"dragenter"));c.removeEventListener("dragover",
|
|
16
|
+
$APP.k(a,"dragover"));c.removeEventListener("dragleave",$APP.k(a,"dragleave"));c.removeEventListener("drop",$APP.k(a,"drop"));d.removeEventListener("change",$APP.k(a,"fileChange"));b.removeEventListener("click",$APP.k(a,"fileListClick"))}},vw=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute(c)},set:function(d){return $APP.Eg(this,c,$APP.F(d))}})},ww=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){var d=
|
|
17
|
+
this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){return d!=null&&$APP.N(d)?this.setAttribute(c,""+$APP.T.g(d)):this.removeAttribute(c)}})},xw=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){var d=this.getAttribute(c);return d!=null?(d=parseInt(d,10),$APP.n(isNaN(d))?null:d):null},set:function(d){return d!=null&&$APP.N(d)?this.setAttribute(c,""+$APP.T.g(d)):this.removeAttribute(c)}})},zw=function(){var a=class extends HTMLElement{},b=a.prototype;a.formAssociated=
|
|
18
|
+
!0;Object.defineProperty(a,"observedAttributes",{get:function(){return yw}});ww(b,"accept","accept");ww(b,"name","name");vw(b,"multiple","multiple");vw(b,"disabled","disabled");vw(b,"required","required");xw(b,"maxSize","max-size");xw(b,"maxFiles","max-files");Object.defineProperty(b,"files",{configurable:!0,enumerable:!0,get:function(){var c=$APP.k(this,"__xFileUploadFiles");return($APP.n(c)?c:[]).slice()}});b.checkValidity=function(){var c=$APP.k(this,"__xFileUploadInternals");return $APP.n(c)?
|
|
19
|
+
c.checkValidity():null};b.reportValidity=function(){var c=$APP.k(this,"__xFileUploadInternals");return $APP.n(c)?c.reportValidity():null};b.formDisabledCallback=function(c){$APP.Eg(this,"disabled",c);return mw(this)};b.formResetCallback=function(){$APP.k(this,"__xFileUploadFiles").length=0;var c=$APP.k(this,"__xFileUploadRefs");$APP.n(c)&&nw($APP.k(c,"fileList"));ow(this);pw(this);return qw(this)};b.connectedCallback=function(){if(!$APP.n($APP.k(this,"__xFileUploadRefs"))){var c=this.attachShadow({mode:"open"}),
|
|
20
|
+
d=cw("style"),e=cw("div"),g=cw("input"),h=cw("div"),l=cw("slot"),m=cw("div"),p=cw("div"),q=cw("div");d.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;}}";
|
|
21
21
|
e.setAttribute("part","drop-zone");e.setAttribute("role","button");e.setAttribute("tabindex","0");g.setAttribute("type","file");g.setAttribute("aria-hidden","true");g.setAttribute("tabindex","-1");h.setAttribute("part","content");h.appendChild(l);m.setAttribute("part","drag-overlay");m.setAttribute("hidden","");m.textContent="Drop files here";p.setAttribute("part","file-list");p.setAttribute("role","list");q.setAttribute("part","live-region");q.setAttribute("aria-live","polite");q.setAttribute("aria-atomic",
|
|
22
|
-
"true");e.appendChild(g);e.appendChild(h);e.appendChild(m);c.appendChild(d);c.appendChild(e);c.appendChild(p);c.appendChild(q);this.__xFileUploadFiles=[];this.__xFileUploadDragCtr=0;this.__xFileUploadRefs={dropZone:e,fileInput:g,content:h,dragOverlay:m,fileList:p,liveRegion:q}}c=this.attachInternals;$APP.n($APP.n(c)?$APP.r($APP.k(this,"__xFileUploadInternals")):c)&&(this.__xFileUploadInternals=this.attachInternals());
|
|
22
|
+
"true");e.appendChild(g);e.appendChild(h);e.appendChild(m);c.appendChild(d);c.appendChild(e);c.appendChild(p);c.appendChild(q);this.__xFileUploadFiles=[];this.__xFileUploadDragCtr=0;this.__xFileUploadRefs={dropZone:e,fileInput:g,content:h,dragOverlay:m,fileList:p,liveRegion:q}}c=this.attachInternals;$APP.n($APP.n(c)?$APP.r($APP.k(this,"__xFileUploadInternals")):c)&&(this.__xFileUploadInternals=this.attachInternals());uw(this);this.__xFileUploadHandlers=tw(this);g=$APP.k(this,"__xFileUploadRefs");
|
|
23
23
|
$APP.n(g)&&(c=$APP.k(this,"__xFileUploadHandlers"),$APP.n(c)&&(d=$APP.k(g,"dropZone"),e=$APP.k(g,"fileInput"),g=$APP.k(g,"fileList"),d.addEventListener("click",$APP.k(c,"zoneClick")),d.addEventListener("keydown",$APP.k(c,"zoneKeydown")),d.addEventListener("dragenter",$APP.k(c,"dragenter")),d.addEventListener("dragover",$APP.k(c,"dragover")),d.addEventListener("dragleave",$APP.k(c,"dragleave")),d.addEventListener("drop",$APP.k(c,"drop")),e.addEventListener("change",$APP.k(c,"fileChange")),g.addEventListener("click",
|
|
24
|
-
$APP.k(c,"fileListClick"))));
|
|
25
|
-
231052999),
|
|
26
|
-
-244409320);var
|
|
24
|
+
$APP.k(c,"fileListClick"))));mw(this);return qw(this)};b.disconnectedCallback=function(){uw(this);var c=$APP.k(this,"__xFileUploadRefs");return $APP.n(c)?nw($APP.k(c,"fileList")):null};b.attributeChangedCallback=function(){return $APP.n($APP.k(this,"__xFileUploadRefs"))?mw(this):null};return a},Aw=function(){return $APP.n(customElements.get("x-file-upload"))?null:customElements.define("x-file-upload",zw())},hw=new $APP.K(null,"accept","accept",1874130431),$v=new $APP.K(null,"rejected","rejected",
|
|
25
|
+
231052999),Zv=new $APP.K(null,"accepted","accepted",-1953464374),fw=new $APP.K(null,"max-size-raw","max-size-raw",1536077032),jw=new $APP.K(null,"max-size","max-size",-874966132),iw=new $APP.K(null,"multiple?","multiple?",-490002283),dw=new $APP.K(null,"accept-raw","accept-raw",1407413888),kw=new $APP.K(null,"max-files","max-files",534742526),ew=new $APP.K(null,"multiple-present?","multiple-present?",-1754894397),aw=new $APP.K(null,"file","file",-1269645878),gw=new $APP.K(null,"max-files-raw","max-files-raw",
|
|
26
|
+
-244409320);var yw="accept multiple max-size max-files disabled required name".split(" ");$APP.Pd(["x-file-upload-select",new $APP.Q(null,2,[$APP.lm,!1,$APP.V,new $APP.Q(null,2,[new $APP.K(null,"files","files",-472457450),$APP.Si,$v,$APP.Si],null)],null),"x-file-upload-remove",new $APP.Q(null,2,[$APP.lm,!1,$APP.V,new $APP.Q(null,2,[aw,$APP.jl,new $APP.K(null,"remaining","remaining",-138926777),$APP.Si],null)],null)]);$APP.ha("baredom.exports.x_file_upload.init",Aw);export const init=Aw;
|
package/dist/x-form-field.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
e=$APP.k(b,"hint");b=$APP.k(b,"error");var g=$APP.zf([$APP.pi,$APP.
|
|
4
|
-
g=$APP.D(h,$APP.Ji);var q=$APP.D(h,$APP.$i),v=$APP.D(h,$APP.
|
|
5
|
-
"string"&&$APP.I(
|
|
6
|
-
$APP.n(C)?"hint":$APP.n(v)?"error":null;$APP.n(H)?d.setAttribute("aria-describedby",H):d.removeAttribute("aria-describedby");c.textContent=$APP.U.g(g);$APP.n(h)?c.classList.remove("label-hidden"):c.classList.add("label-hidden");e.textContent=$APP.
|
|
7
|
-
|
|
8
|
-
if($APP.n(b)){b=$APP.k(b,"input");var c=b.value;var d=a.getAttribute("name");d=$APP.n(d)?d:"";var e=$APP.k(a,"__xFormFieldInternals");$APP.n(e)&&(e.setFormValue(c),
|
|
9
|
-
null;return}}return null},
|
|
10
|
-
enumerable:!0,get:function(){var b=$APP.k(this,"__xFormFieldRefs");if($APP.n(b))return $APP.k(b,"input").value;b=this.getAttribute("value");return $APP.n(b)?b:""},set:function(b){b=b!=null&&$APP.N(b)?""+$APP.T.g(b):"";this.setAttribute("value",b);var c=$APP.k(this,"__xFormFieldRefs");return $APP.n(c)?$APP.k(c,"input").value=b:null}})},
|
|
11
|
-
"label","label");
|
|
2
|
+
var HV=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},IV=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.B.i(g,""):a)?b.setValidity({valueMissing:!0},"Please fill in this field.",c):b.setValidity({},"",c)},KV=function(a){var b=$APP.k(a,"__xFormFieldRefs");if($APP.n(b)){var c=$APP.k(b,"label"),d=$APP.k(b,"input"),
|
|
3
|
+
e=$APP.k(b,"hint");b=$APP.k(b,"error");var g=$APP.zf([$APP.pi,$APP.Al,$APP.Ji,$APP.$i,$APP.Ol,$APP.Nh,$APP.Lj,$APP.Em,$APP.oi,$APP.yi,$APP.Pi],[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),l=$APP.D(h,$APP.Pi),m=$APP.D(h,$APP.pi),p=$APP.D(h,$APP.Al);
|
|
4
|
+
g=$APP.D(h,$APP.Ji);var q=$APP.D(h,$APP.$i),v=$APP.D(h,$APP.Ol),x=$APP.D(h,$APP.Nh),y=$APP.D(h,$APP.Lj),A=$APP.D(h,$APP.Em),C=$APP.D(h,$APP.oi),E=$APP.D(h,$APP.yi);h=$APP.n(g)?g:"";var H=$APP.n(q)?q:"",G=$APP.n(m)?m:"",J=[$APP.mi,$APP.dn,$APP.sm,$APP.ui,$APP.Aj,$APP.Yi,$APP.Dl,$APP.Z,$APP.al,$APP.Zl,$APP.U,$APP.Ei,$APP.am,$APP.X];x=$APP.F(x);y=$APP.F(y);l=$APP.n(l)?l:"";q=typeof q==="string"&&$APP.N(q,"")&&q!=null;p=$APP.n(p)?p:"";A=$APP.n(A)?A:"";m=typeof m==="string"&&$APP.N(m,"")&&m!=null;E=typeof E===
|
|
5
|
+
"string"&&$APP.I(JV,E)?E:"text";g=$APP.zf(J,[x,y,l,q,p,A,m,E,typeof g==="string"&&$APP.N(g,"")&&g!=null,H,G,h,$APP.n(C)?C:"",$APP.F(v)]);v=$APP.al.g(g);C=$APP.ui.g(g);h=$APP.Dl.g(g);d.type=$APP.Z.g(g);d.name=$APP.Aj.g(g);d.placeholder=$APP.sm.g(g);d.disabled=$APP.X.g(g);d.readOnly=$APP.dn.g(g);d.required=$APP.mi.g(g);d.autocomplete=$APP.am.g(g);H=$APP.n($APP.mi.g(g))?"true":"false";d.setAttribute("aria-required",H);d.setAttribute("aria-invalid",$APP.n(v)?"true":"false");H=$APP.n($APP.n(C)?v:C)?"hint error":
|
|
6
|
+
$APP.n(C)?"hint":$APP.n(v)?"error":null;$APP.n(H)?d.setAttribute("aria-describedby",H):d.removeAttribute("aria-describedby");c.textContent=$APP.U.g(g);$APP.n(h)?c.classList.remove("label-hidden"):c.classList.add("label-hidden");e.textContent=$APP.Zl.g(g);$APP.n(C)?e.classList.remove("hint-hidden"):e.classList.add("hint-hidden");b.textContent=$APP.Ei.g(g);$APP.n(v)?b.classList.remove("error-hidden"):b.classList.add("error-hidden");HV(a,"data-invalid",v);c=$APP.k(a,"__xFormFieldInternals");return $APP.n(c)?
|
|
7
|
+
IV(a,c,d):null}return null},LV=function(a,b,c){return a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,composed:!0,cancelable:!1}))},MV=function(a){return function(){var b=$APP.k(a,"__xFormFieldRefs");if($APP.n(b)){b=$APP.k(b,"input");var c=b.value;var d=a.getAttribute("name");d=$APP.n(d)?d:"";var e=$APP.k(a,"__xFormFieldInternals");$APP.n(e)&&(e.setFormValue(c),IV(a,e,b));return LV(a,"x-form-field-input",{name:d,value:c})}return null}},NV=function(a){return function(){var b=$APP.k(a,"__xFormFieldRefs");
|
|
8
|
+
if($APP.n(b)){b=$APP.k(b,"input");var c=b.value;var d=a.getAttribute("name");d=$APP.n(d)?d:"";var e=$APP.k(a,"__xFormFieldInternals");$APP.n(e)&&(e.setFormValue(c),IV(a,e,b));return LV(a,"x-form-field-change",{name:d,value:c})}return null}},OV=function(a){var b=$APP.k(a,"__xFormFieldRefs");if($APP.n(b)){var c=$APP.k(a,"__xFormFieldHandlers");if($APP.n(c)){b=$APP.k(b,"input");b.removeEventListener("input",$APP.k(c,"input"));b.removeEventListener("change",$APP.k(c,"change"));a.__xFormFieldHandlers=
|
|
9
|
+
null;return}}return null},PV=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.T.g(d),d=this.setAttribute(c,d)):d=this.removeAttribute(c);return d}})},QV=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute(c)},set:function(d){return HV(this,c,$APP.F(d))}})},RV=function(a){Object.defineProperty(a,"value",{configurable:!0,
|
|
10
|
+
enumerable:!0,get:function(){var b=$APP.k(this,"__xFormFieldRefs");if($APP.n(b))return $APP.k(b,"input").value;b=this.getAttribute("value");return $APP.n(b)?b:""},set:function(b){b=b!=null&&$APP.N(b)?""+$APP.T.g(b):"";this.setAttribute("value",b);var c=$APP.k(this,"__xFormFieldRefs");return $APP.n(c)?$APP.k(c,"input").value=b:null}})},TV=function(){var a=class extends HTMLElement{},b=a.prototype;a.formAssociated=!0;Object.defineProperty(a,"observedAttributes",{get:function(){return SV}});RV(b);PV(b,
|
|
11
|
+
"label","label");PV(b,"type","type");PV(b,"name","name");PV(b,"placeholder","placeholder");PV(b,"autocomplete","autocomplete");QV(b,"disabled","disabled");QV(b,"readOnly","readonly");QV(b,"required","required");b.connectedCallback=function(){if(!$APP.n($APP.k(this,"__xFormFieldRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("div"),g=document.createElement("label"),h=document.createElement("div"),l=document.createElement("input"),m=document.createElement("span"),
|
|
12
12
|
p=document.createElement("span");d.textContent=":host{display:block;color-scheme:light dark;--x-form-field-label-color:var(--x-color-text-muted,#374151);--x-form-field-label-font-size:var(--x-font-size-sm,0.875rem);--x-form-field-input-bg:var(--x-color-surface,#ffffff);--x-form-field-input-color:var(--x-color-text,#111827);--x-form-field-input-border:1px solid var(--x-color-border,#d1d5db);--x-form-field-input-border-radius:var(--x-radius-md,6px);--x-form-field-input-padding:0.5rem 0.75rem;--x-form-field-focus-ring-color:var(--x-color-primary,#2563eb);--x-form-field-error-color:var(--x-color-danger,#dc2626);--x-form-field-hint-color:var(--x-color-text-muted,#6b7280);--x-form-field-disabled-opacity:0.45;}@media (prefers-color-scheme:dark){:host{--x-form-field-label-color:var(--x-color-text-muted,#d1d5db);--x-form-field-input-bg:var(--x-color-surface-hover,#1f2937);--x-form-field-input-color:var(--x-color-text,#f9fafb);--x-form-field-input-border:1px solid var(--x-color-border,#4b5563);--x-form-field-focus-ring-color:var(--x-color-primary,#3b82f6);--x-form-field-error-color:var(--x-color-danger,#f87171);--x-form-field-hint-color:var(--x-color-text-muted,#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
13
|
e.setAttribute("part","field");g.setAttribute("part","label");g.setAttribute("id","label");g.setAttribute("for","input");h.setAttribute("part","input-wrapper");l.setAttribute("part","input");l.setAttribute("id","input");l.setAttribute("aria-labelledby","label");m.setAttribute("part","hint");m.setAttribute("id","hint");m.setAttribute("aria-live","polite");p.setAttribute("part","error");p.setAttribute("id","error");p.setAttribute("role","alert");p.setAttribute("aria-live","assertive");h.appendChild(l);
|
|
14
|
-
e.appendChild(g);e.appendChild(h);e.appendChild(m);e.appendChild(p);c.appendChild(d);c.appendChild(e);this.__xFormFieldRefs={field:e,label:g,input:l,hint:m,error:p};$APP.n(this.attachInternals)&&(this.__xFormFieldInternals=this.attachInternals())}
|
|
15
|
-
"__xFormFieldRefs");$APP.n(c)&&(c=$APP.k(c,"input"),d=
|
|
16
|
-
return
|
|
17
|
-
$APP.zf([$APP.
|
|
18
|
-
2,[$APP.Z,$APP.Y,$APP.Ik,"autocomplete"],null),new $APP.
|
|
14
|
+
e.appendChild(g);e.appendChild(h);e.appendChild(m);e.appendChild(p);c.appendChild(d);c.appendChild(e);this.__xFormFieldRefs={field:e,label:g,input:l,hint:m,error:p};$APP.n(this.attachInternals)&&(this.__xFormFieldInternals=this.attachInternals())}OV(this);c=$APP.k(this,"__xFormFieldRefs");$APP.n(c)&&(c=$APP.k(c,"input"),d=this.getAttribute("value"),$APP.n(d)&&(c.value=d));c=$APP.k(this,"__xFormFieldInternals");$APP.n(c)&&(d=c.setFormValue,e=this.getAttribute("value"),d.call(c,$APP.n(e)?e:""));c=$APP.k(this,
|
|
15
|
+
"__xFormFieldRefs");$APP.n(c)&&(c=$APP.k(c,"input"),d=MV(this),e=NV(this),c.addEventListener("input",d),c.addEventListener("change",e),this.__xFormFieldHandlers={input:d,change:e});return KV(this)};b.disconnectedCallback=function(){return OV(this)};b.attributeChangedCallback=function(c,d,e){$APP.B.i(c,"value")&&(c=$APP.k(this,"__xFormFieldRefs"),$APP.n(c)&&(c=$APP.k(c,"input"),$APP.N(c.value,e)&&(c.value=$APP.n(e)?e:"")));return KV(this)};b.formDisabledCallback=function(c){HV(this,"disabled",$APP.F(c));
|
|
16
|
+
return KV(this)};b.formResetCallback=function(){this.removeAttribute("value");var c=$APP.k(this,"__xFormFieldRefs");$APP.n(c)&&($APP.k(c,"input").value="");c=$APP.k(this,"__xFormFieldInternals");$APP.n(c)&&c.setFormValue("");return KV(this)};return a},UV=function(){return $APP.n(customElements.get("x-form-field"))?null:customElements.define("x-form-field",TV())};var SV="label type name value placeholder hint error disabled readonly required autocomplete".split(" "),JV=new $APP.S(null,new $APP.Q(null,6,["url",null,"tel",null,"email",null,"text",null,"number",null,"password",null],null),null);
|
|
17
|
+
$APP.zf([$APP.sm,$APP.Pj,$APP.Aj,$APP.Yi,$APP.Bj,$APP.Z,$APP.U,$APP.am,$APP.Dk],[new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"placeholder"],null),new $APP.Q(null,2,[$APP.Z,$APP.Zj,$APP.Ik,"disabled"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"name"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"value"],null),new $APP.Q(null,2,[$APP.Z,$APP.Zj,$APP.Ik,"readonly"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"type"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"label"],null),new $APP.Q(null,
|
|
18
|
+
2,[$APP.Z,$APP.Y,$APP.Ik,"autocomplete"],null),new $APP.Q(null,2,[$APP.Z,$APP.Zj,$APP.Ik,"required"],null)]);$APP.Pd(["x-form-field-input",new $APP.Q(null,2,[$APP.lm,!1,$APP.V,new $APP.Q(null,2,[$APP.Aj,$APP.Y,$APP.Yi,$APP.Y],null)],null),"x-form-field-change",new $APP.Q(null,2,[$APP.lm,!1,$APP.V,new $APP.Q(null,2,[$APP.Aj,$APP.Y,$APP.Yi,$APP.Y],null)],null)]);$APP.ha("baredom.exports.x_form_field.init",UV);export const init=UV;
|
package/dist/x-form.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
$APP
|
|
4
|
-
$APP.n(e.checked)&&(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},
|
|
5
|
-
for(var h={ok:!0},l=g.length,m=0;;)if(m<l){var p=g[m];$APP.n(p.reportValidity)&&($APP.n(p.reportValidity())||(h.ok=!1));m+=1}else break;g=h.ok}$APP.n(g)?(g=
|
|
6
|
-
g.type;var h=$APP.k(a,"__xFormRefs");if($APP.n(h)){h=$APP.k(h,"form");g=$APP.B.i(g,"submit")||$APP.B.i(g,"")?h.requestSubmit():$APP.B.i(g,"reset")?h.reset():null;break a}}g=null}return g};b.addEventListener("submit",c);b.addEventListener("reset",d);a.addEventListener("click",e);$APP.ja(a,"__xFormHandlers",{submit:c,reset:d,click:e})}},
|
|
7
|
-
"submit"));b.removeEventListener("reset",$APP.k(c,"reset"));a.removeEventListener("click",$APP.k(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(g);c.appendChild(d);c.appendChild(e);this.__xFormRefs={form:e}}
|
|
2
|
+
var ZR=function(a,b){return a.setAttribute("autocomplete",b)},cS=function(a){a=new $APP.Q(null,3,[$APP.Dm,a.getAttribute("loading"),$R,$APP.n(a.hasAttribute("novalidate"))?"":null,$APP.oi,a.getAttribute("autocomplete")],null);var b=$APP.M(a),c=$APP.D(b,$APP.Dm);a=$APP.D(b,$R);b=$APP.D(b,$APP.oi);c=c!=null&&$APP.N(c,"false");b=$APP.I(aS,b)?b:"on";return new $APP.Q(null,3,[$APP.Ci,c,bS,a!=null,$APP.am,b],null)},dS=function(a){var b=$APP.k(a,"__xFormRefs");if($APP.n(b)){b=$APP.k(b,"form");a=cS(a);ZR(b,
|
|
3
|
+
$APP.am.g(a));if($APP.n($APP.Ci.g(a)))return b.setAttribute("aria-busy","true"),b.setAttribute("data-loading","");b.removeAttribute("aria-busy");return b.removeAttribute("data-loading")}return null},eS=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(),l=e.getAttribute("type");$APP.B.i(l,"checkbox")||$APP.B.i(l,"radio")||$APP.B.i(h,"x-checkbox")?
|
|
4
|
+
$APP.n(e.checked)&&(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},fS=function(a,b,c,d){return a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,composed:!0,cancelable:d}))},gS=function(a){var b=$APP.k(a,"__xFormRefs");if($APP.n(b)){b=$APP.k(b,"form");var c=function(g){g.preventDefault();g=cS(a);if($APP.n($APP.Ci.g(g)))g=null;else{g=bS.g(g);if(!$APP.n(g)){g=a.querySelectorAll("[name]:not([disabled])");
|
|
5
|
+
for(var h={ok:!0},l=g.length,m=0;;)if(m<l){var p=g[m];$APP.n(p.reportValidity)&&($APP.n(p.reportValidity())||(h.ok=!1));m+=1}else break;g=h.ok}$APP.n(g)?(g=eS(a),g=fS(a,"x-form-submit",{values:g},!0)):g=null}return g},d=function(){for(var g=a.querySelectorAll("[name]"),h=g.length,l=0;;)if(l<h){var m=g[l];$APP.n(m.formResetCallback)&&m.formResetCallback();l+=1}else break;return fS(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=
|
|
6
|
+
g.type;var h=$APP.k(a,"__xFormRefs");if($APP.n(h)){h=$APP.k(h,"form");g=$APP.B.i(g,"submit")||$APP.B.i(g,"")?h.requestSubmit():$APP.B.i(g,"reset")?h.reset():null;break a}}g=null}return g};b.addEventListener("submit",c);b.addEventListener("reset",d);a.addEventListener("click",e);$APP.ja(a,"__xFormHandlers",{submit:c,reset:d,click:e})}},hS=function(a){var b=$APP.k(a,"__xFormRefs");if($APP.n(b)){var c=$APP.k(a,"__xFormHandlers");if($APP.n(c)){b=$APP.k(b,"form");b.removeEventListener("submit",$APP.k(c,
|
|
7
|
+
"submit"));b.removeEventListener("reset",$APP.k(c,"reset"));a.removeEventListener("click",$APP.k(c,"click"));a.__xFormHandlers=null;return}}return null},iS=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute(c)},set:function(d){return $APP.F(d)?this.setAttribute(c,""):this.removeAttribute(c)}})},jS=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)?ZR(this,""+$APP.T.g(b)):this.removeAttribute("autocomplete")}})},lS=function(){var a=class extends HTMLElement{},b=a.prototype;Object.defineProperty(a,"observedAttributes",{get:function(){return kS}});iS(b,"loading","loading");iS(b,"novalidate","novalidate");jS(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}}hS(this);gS(this);return dS(this)};b.disconnectedCallback=function(){return hS(this)};b.attributeChangedCallback=function(){return dS(this)};b.submit=function(){var c=
|
|
10
10
|
$APP.k(this,"__xFormRefs");return $APP.n(c)?$APP.k(c,"form").requestSubmit():null};b.reset=function(){var c=$APP.k(this,"__xFormRefs");return $APP.n(c)?$APP.k(c,"form").reset():null};b.setFieldError=function(c,d){c=this.querySelector('[name\x3d"'+$APP.T.g(c)+'"]');return $APP.n(c)?d==null||$APP.B.i(d,"")||$APP.B.i(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},
|
|
11
|
+
e+=1;else return null};return a},mS=function(){return $APP.n(customElements.get("x-form"))?null:customElements.define("x-form",lS())},$R=new $APP.K(null,"novalidate-raw","novalidate-raw",1783236714),bS=new $APP.K(null,"novalidate?","novalidate?",491529885);var kS=["loading","novalidate","autocomplete"],aS=new $APP.S(null,new $APP.Q(null,2,["off",null,"on",null],null),null);$APP.Pd(["x-form-submit",new $APP.Q(null,2,[$APP.lm,!0,$APP.V,new $APP.Q(null,1,[new $APP.K(null,"values","values",372645556),$APP.jl],null)],null),"x-form-reset",new $APP.Q(null,2,[$APP.lm,!1,$APP.V,$APP.Qd],null)]);$APP.ha("baredom.exports.x_form.init",mS);export const init=mS;
|
package/dist/x-gaussian-blur.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
2
|
+
var wX=function(a,b,c){var d=$APP.z(a);return $APP.We.m($APP.fe,$APP.ae.g(function(e){var g=e*2.39996323,h=50+30*Math.cos(g);g=50+30*Math.sin(g);var l=10*Math.sin(e*2.39996323),m=10*Math.cos(e*Math.PI),p=Math.sin(e*1.618);p=.7+p*p*.6;var q=.8+.4*Math.sin(e*1.3),v=-(e/$APP.oh.i(b,1));return new $APP.Q(null,7,[$APP.Oj,$APP.pc(a,$APP.fd(e,d)),$APP.Ll,h+l,$APP.Kl,g+m,$APP.Mh,c*p,tX,$APP.fd(e,4),uX,q,vX,v],null)}),$APP.dg(0,b))},xX=function(a){var b=a.attachShadow({mode:"open"}),c=document.createElement("style"),
|
|
3
3
|
d=document.createElement("div"),e=document.createElement("div"),g=document.createElement("slot");c.textContent=":host{display:block;position:relative;width:100%;height:100%;overflow:hidden;box-sizing:border-box;color-scheme:light dark;--x-gaussian-blur-bg:transparent;--x-gaussian-blur-z-index:0;--x-gaussian-blur-border-radius:0;}:host{border-radius:var(--x-gaussian-blur-border-radius);}[part\x3dbackdrop]{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:var(--x-gaussian-blur-z-index);background:var(--x-gaussian-blur-bg);}[part\x3dcontent]{position:relative;z-index:1;width:100%;height:100%;}.blob{position:absolute;border-radius:50%;will-change:transform;pointer-events:none;}@keyframes x-gb-float-0{0%,100%{transform:translate(-50%,-50%) translate(0,0);}25%{transform:translate(-50%,-50%) translate(12%,-18%);}50%{transform:translate(-50%,-50%) translate(-10%,15%);}75%{transform:translate(-50%,-50%) translate(15%,6%);}}@keyframes x-gb-float-1{0%,100%{transform:translate(-50%,-50%) translate(0,0);}25%{transform:translate(-50%,-50%) translate(-15%,10%);}50%{transform:translate(-50%,-50%) translate(18%,-12%);}75%{transform:translate(-50%,-50%) translate(-8%,-16%);}}@keyframes x-gb-float-2{0%,100%{transform:translate(-50%,-50%) translate(0,0);}25%{transform:translate(-50%,-50%) translate(10%,16%);}50%{transform:translate(-50%,-50%) translate(-18%,-8%);}75%{transform:translate(-50%,-50%) translate(14%,-12%);}}@keyframes x-gb-float-3{0%,100%{transform:translate(-50%,-50%) translate(0,0);}25%{transform:translate(-50%,-50%) translate(-12%,-10%);}50%{transform:translate(-50%,-50%) translate(16%,18%);}75%{transform:translate(-50%,-50%) translate(-10%,14%);}}@keyframes x-gb-pulse-0{0%,100%{transform:translate(-50%,-50%) scale(1) translate(0,0);}33%{transform:translate(-50%,-50%) scale(1.2) translate(10%,-14%);}66%{transform:translate(-50%,-50%) scale(0.85) translate(-10%,10%);}}@keyframes x-gb-pulse-1{0%,100%{transform:translate(-50%,-50%) scale(1) translate(0,0);}33%{transform:translate(-50%,-50%) scale(0.85) translate(-14%,10%);}66%{transform:translate(-50%,-50%) scale(1.2) translate(12%,-8%);}}@keyframes x-gb-pulse-2{0%,100%{transform:translate(-50%,-50%) scale(1) translate(0,0);}33%{transform:translate(-50%,-50%) scale(1.18) translate(8%,16%);}66%{transform:translate(-50%,-50%) scale(0.82) translate(-16%,-10%);}}@keyframes x-gb-pulse-3{0%,100%{transform:translate(-50%,-50%) scale(1) translate(0,0);}33%{transform:translate(-50%,-50%) scale(0.88) translate(-10%,-14%);}66%{transform:translate(-50%,-50%) scale(1.15) translate(10%,16%);}}:host([data-paused]) .blob{animation-play-state:paused;}@media (prefers-reduced-motion:reduce){.blob{animation:none!important;}}";
|
|
4
|
-
d.setAttribute("part","backdrop");d.setAttribute("aria-hidden","true");e.setAttribute("part","content");e.appendChild(g);b.appendChild(c);b.appendChild(d);b.appendChild(e);a.__xGaussianBlurBackdrop=d;a.__xGaussianBlurSlot=g;a.__xGaussianBlurBlobs=[];a.__xGaussianBlurInit=!0},
|
|
5
|
-
$APP.zf([
|
|
6
|
-
typeof c==="string"&&$APP.N("",c.trim())?(c=parseInt(c.trim(),10),c=$APP.n(isFinite(c))?$APP.
|
|
7
|
-
e:"float";d=d!=null;typeof m==="string"&&$APP.N("",m.trim())?(m=parseFloat(m.trim()),q=isFinite(m),m=$APP.n($APP.n(q)?m>0:q)?m:60):m=60;q=
|
|
8
|
-
d=$APP.D(b,
|
|
9
|
-
e=m.length;l=$APP.z(h);for(g=e;;)if(g<l)q=document.createElement("div"),q.className="blob",d.appendChild(q),m.push(q),g+=1;else break;for(;;)if(e>l)g=m.pop(),d.removeChild(g),--e;else break;for(d=0;;)if(d<l){var v=m[d];q=$APP.pc(h,d);g=p;e=c;var x=$APP.M(q),y=$APP.D(x,$APP.Oj),A=$APP.D(x,$APP.
|
|
10
|
-
E);v.setProperty("height",E);v.setProperty("background","radial-gradient(circle,"+$APP.T.g(y)+" 0%,transparent 70%)");v.setProperty("transform","translate(-50%,-50%)");b:switch(y=H,g){case "float":g="x-gb-float-"+$APP.T.g(y);break b;case "pulse":g="x-gb-pulse-"+$APP.T.g(y);break b;default:g=null}$APP.n(g)?(q*=e,e*=x,v.setProperty("animation",""+$APP.T.g(g)+" "+$APP.T.g(q)+"s ease-in-out "+$APP.T.g(e)+"s infinite")):v.removeProperty("animation");d+=1}else break a}
|
|
11
|
-
c)}$APP.n($APP.k(a,"__xGaussianBlurInit"))||
|
|
4
|
+
d.setAttribute("part","backdrop");d.setAttribute("aria-hidden","true");e.setAttribute("part","content");e.appendChild(g);b.appendChild(c);b.appendChild(d);b.appendChild(e);a.__xGaussianBlurBackdrop=d;a.__xGaussianBlurSlot=g;a.__xGaussianBlurBlobs=[];a.__xGaussianBlurInit=!0},yX=function(a,b){if($APP.n($APP.n(b)?b.assignedNodes().length>0:null))return a.removeAttribute("role"),a.removeAttribute("aria-hidden");a.setAttribute("role","presentation");return a.setAttribute("aria-hidden","true")},IX=function(a){var b=
|
|
5
|
+
$APP.zf([zX,$APP.Wg,$APP.Gj,$APP.rm,$APP.Mh,$APP.ki,$APP.qi,$APP.Rh,AX],[a.getAttribute("paused"),a.getAttribute("animation"),a.getAttribute("speed"),a.getAttribute("colors"),a.getAttribute("size"),a.getAttribute("blur"),a.getAttribute("opacity"),a.getAttribute("count"),a.getAttribute("blend")]);var c=$APP.M(b);b=$APP.D(c,AX);var d=$APP.D(c,zX),e=$APP.D(c,$APP.Wg),g=$APP.D(c,$APP.Gj);var h=$APP.D(c,$APP.rm);var l=$APP.D(c,$APP.Mh),m=$APP.D(c,$APP.ki),p=$APP.D(c,$APP.qi);c=$APP.D(c,$APP.Rh);h=BX(h);
|
|
6
|
+
typeof c==="string"&&$APP.N("",c.trim())?(c=parseInt(c.trim(),10),c=$APP.n(isFinite(c))?$APP.ph.i(12,$APP.oh.i(1,c)):5):c=5;if(typeof l==="string"&&$APP.N("",l.trim())){l=l.trim();var q=$APP.D(CX,l);$APP.n(q)?l=q:(l=parseFloat(l),q=isFinite(l),l=$APP.n($APP.n(q)?l>0:q)?$APP.ph.i(100,$APP.oh.i(10,l)):50)}else l=50;typeof g==="string"&&$APP.N("",g.trim())?(g=g.trim(),q=$APP.D(DX,g),$APP.n(q)?g=q:(g=parseFloat(g),q=isFinite(g),g=$APP.n($APP.n(q)?g>0:q)?g:10)):g=10;e=typeof e==="string"&&$APP.I(EX,e)?
|
|
7
|
+
e:"float";d=d!=null;typeof m==="string"&&$APP.N("",m.trim())?(m=parseFloat(m.trim()),q=isFinite(m),m=$APP.n($APP.n(q)?m>0:q)?m:60):m=60;q=wX(h,c,l);typeof p==="string"&&$APP.N("",p.trim())?(p=parseFloat(p.trim()),p=$APP.n(isFinite(p))?$APP.ph.i(1,$APP.oh.i(0,p)):.7):p=.7;b=typeof b==="string"&&$APP.I(FX,b)?b:"normal";h=$APP.zf([zX,$APP.Wg,$APP.rm,GX,$APP.ki,$APP.Qm,$APP.qi,$APP.Rh,AX,HX],[d,e,h,g,m,q,p,c,b,l]);b=$APP.M(h);p=$APP.D(b,$APP.ki);c=$APP.D(b,$APP.qi);m=$APP.D(b,AX);l=$APP.D(b,$APP.Wg);
|
|
8
|
+
d=$APP.D(b,zX);e=$APP.k(a,"__xGaussianBlurBackdrop");b=$APP.k(a,"__xGaussianBlurSlot");e.style.setProperty("filter","blur("+$APP.T.g(p)+"px)");e.style.setProperty("opacity",""+$APP.T.g(c));e.style.setProperty("mix-blend-mode",m);$APP.n(d)?a.setAttribute("data-paused",""):a.removeAttribute("data-paused");a.setAttribute("data-animation",l);a:{m=$APP.M(h);h=$APP.D(m,$APP.Qm);p=$APP.D(m,$APP.Wg);c=$APP.D(m,GX);$APP.D(m,$APP.ki);d=$APP.k(a,"__xGaussianBlurBackdrop");m=$APP.k(a,"__xGaussianBlurBlobs");
|
|
9
|
+
e=m.length;l=$APP.z(h);for(g=e;;)if(g<l)q=document.createElement("div"),q.className="blob",d.appendChild(q),m.push(q),g+=1;else break;for(;;)if(e>l)g=m.pop(),d.removeChild(g),--e;else break;for(d=0;;)if(d<l){var v=m[d];q=$APP.pc(h,d);g=p;e=c;var x=$APP.M(q),y=$APP.D(x,$APP.Oj),A=$APP.D(x,$APP.Ll),C=$APP.D(x,$APP.Kl),E=$APP.D(x,$APP.Mh),H=$APP.D(x,tX);q=$APP.D(x,uX);x=$APP.D(x,vX);v=v.style;E=""+$APP.T.g(E)+"%";v.setProperty("left",""+$APP.T.g(A)+"%");v.setProperty("top",""+$APP.T.g(C)+"%");v.setProperty("width",
|
|
10
|
+
E);v.setProperty("height",E);v.setProperty("background","radial-gradient(circle,"+$APP.T.g(y)+" 0%,transparent 70%)");v.setProperty("transform","translate(-50%,-50%)");b:switch(y=H,g){case "float":g="x-gb-float-"+$APP.T.g(y);break b;case "pulse":g="x-gb-pulse-"+$APP.T.g(y);break b;default:g=null}$APP.n(g)?(q*=e,e*=x,v.setProperty("animation",""+$APP.T.g(g)+" "+$APP.T.g(q)+"s ease-in-out "+$APP.T.g(e)+"s infinite")):v.removeProperty("animation");d+=1}else break a}yX(a,b)},JX=function(a){function b(){return yX(a,
|
|
11
|
+
c)}$APP.n($APP.k(a,"__xGaussianBlurInit"))||xX(a);var c=$APP.k(a,"__xGaussianBlurSlot");a.__xGaussianBlurSlotHandler=b;c.addEventListener("slotchange",b);IX(a)},KX=function(a){for(var b=$APP.t(new $APP.O(null,8,5,$APP.P,[new $APP.O(null,3,5,$APP.P,["colors","colors","#6366f1, #ec4899, #14b8a6, #f59e0b"],null),new $APP.O(null,3,5,$APP.P,["blur","blur","60"],null),new $APP.O(null,3,5,$APP.P,["speed","speed","medium"],null),new $APP.O(null,3,5,$APP.P,["count","count","5"],null),new $APP.O(null,3,5,$APP.P,
|
|
12
12
|
["size","size","medium"],null),new $APP.O(null,3,5,$APP.P,["opacity","opacity","0.7"],null),new $APP.O(null,3,5,$APP.P,["animation","animation","float"],null),new $APP.O(null,3,5,$APP.P,["blend","blend","normal"],null)],null)),c=null,d=0,e=0;;)if(e<d){var g=c.F(null,e),h=$APP.Ac(g,0,null),l=$APP.Ac(g,1,null),m=$APP.Ac(g,2,null);Object.defineProperty(a,h,{get:function(v,x,y,A,C,E,H,G){return function(){var J=this.getAttribute(H);return $APP.n(J)?J:G}}(b,c,d,e,g,h,l,m),set:function(v,x,y,A,C,E,H){return function(G){return typeof G===
|
|
13
13
|
"string"&&$APP.N("",G)?this.setAttribute(H,G):this.removeAttribute(H)}}(b,c,d,e,g,h,l,m),enumerable:!0,configurable:!0});e+=1}else if(h=$APP.t(b)){g=h;if($APP.Nc(g))b=$APP.yb(g),e=$APP.zb(g),c=b,d=$APP.z(b),b=e;else{l=$APP.u(g);m=$APP.Ac(l,0,null);var p=$APP.Ac(l,1,null),q=$APP.Ac(l,2,null);Object.defineProperty(a,m,{get:function(v,x,y,A,C,E,H,G){return function(){var J=this.getAttribute(H);return $APP.n(J)?J:G}}(b,c,d,e,l,m,p,q,g,h),set:function(v,x,y,A,C,E,H){return function(G){return typeof G===
|
|
14
|
-
"string"&&$APP.N("",G)?this.setAttribute(H,G):this.removeAttribute(H)}}(b,c,d,e,l,m,p,q,g,h),enumerable:!0,configurable:!0});b=$APP.w(g);c=null;d=0}e=0}else break;Object.defineProperty(a,"paused",{get:function(){return this.hasAttribute("paused")},set:function(v){return $APP.n(v)?this.setAttribute("paused",""):this.removeAttribute("paused")},enumerable:!0,configurable:!0})},
|
|
15
|
-
a.prototype.disconnectedCallback=function(){var b=$APP.k(this,"__xGaussianBlurSlot"),c=$APP.k(this,"__xGaussianBlurSlotHandler");$APP.n($APP.n(b)?c:b)&&b.removeEventListener("slotchange",c);return null};a.prototype.attributeChangedCallback=function(b,c,d){$APP.N(c,d)&&$APP.n($APP.k(this,"__xGaussianBlurInit"))&&
|
|
16
|
-
"speed-s",-1018350546),
|
|
17
|
-
$APP.zf([
|
|
18
|
-
$APP.Ik,"count"],null),new $APP.
|
|
19
|
-
var
|
|
20
|
-
$APP.ce(function(c){return $APP.N("",c)})),a)):
|
|
14
|
+
"string"&&$APP.N("",G)?this.setAttribute(H,G):this.removeAttribute(H)}}(b,c,d,e,l,m,p,q,g,h),enumerable:!0,configurable:!0});b=$APP.w(g);c=null;d=0}e=0}else break;Object.defineProperty(a,"paused",{get:function(){return this.hasAttribute("paused")},set:function(v){return $APP.n(v)?this.setAttribute("paused",""):this.removeAttribute("paused")},enumerable:!0,configurable:!0})},MX=function(){var a=class extends HTMLElement{};a.observedAttributes=LX;a.prototype.connectedCallback=function(){JX(this);return null};
|
|
15
|
+
a.prototype.disconnectedCallback=function(){var b=$APP.k(this,"__xGaussianBlurSlot"),c=$APP.k(this,"__xGaussianBlurSlotHandler");$APP.n($APP.n(b)?c:b)&&b.removeEventListener("slotchange",c);return null};a.prototype.attributeChangedCallback=function(b,c,d){$APP.N(c,d)&&$APP.n($APP.k(this,"__xGaussianBlurInit"))&&IX(this);return null};KX(a.prototype);return a},NX=function(){$APP.n(customElements.get("x-gaussian-blur"))||customElements.define("x-gaussian-blur",MX());return null},GX=new $APP.K(null,"speed-s",
|
|
16
|
+
"speed-s",-1018350546),AX=new $APP.K(null,"blend","blend",249565561),zX=new $APP.K(null,"paused","paused",-1710376127),HX=new $APP.K(null,"size-pct","size-pct",-741809955),tX=new $APP.K(null,"anim-index","anim-index",-1563021855),vX=new $APP.K(null,"delay-factor","delay-factor",-751650178),uX=new $APP.K(null,"duration-factor","duration-factor",-409465019);var LX="colors blur speed count size opacity animation blend paused".split(" ");
|
|
17
|
+
$APP.zf([zX,$APP.Wg,$APP.Gj,$APP.rm,$APP.Mh,$APP.ki,$APP.qi,$APP.Rh,AX],[new $APP.Q(null,2,[$APP.Z,$APP.Zj,$APP.Ik,"paused"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"animation"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"speed"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"colors"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"size"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"blur"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"opacity"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,
|
|
18
|
+
$APP.Ik,"count"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Ik,"blend"],null)]);
|
|
19
|
+
var EX=new $APP.S(null,new $APP.Q(null,3,["float",null,"none",null,"pulse",null],null),null),FX=new $APP.S(null,new $APP.Q(null,5,["soft-light",null,"multiply",null,"screen",null,"normal",null,"overlay",null],null),null),DX=new $APP.Q(null,3,["slow",18,"medium",10,"fast",5],null),CX=new $APP.Q(null,3,["small",30,"medium",50,"large",70],null),BX=function BX(a){return typeof a==="string"&&$APP.N("",a.trim())?(a=a.trim().split(/,/),$APP.We.m($APP.fe,$APP.th.i($APP.ae.g(function(c){return c.trim()}),
|
|
20
|
+
$APP.ce(function(c){return $APP.N("",c)})),a)):BX.g?BX.g("#6366f1, #ec4899, #14b8a6, #f59e0b"):BX.call(null,"#6366f1, #ec4899, #14b8a6, #f59e0b")};$APP.ha("baredom.exports.x_gaussian_blur.init",NX);export const init=NX;
|
package/dist/x-grid.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
a=$APP.D(b
|
|
4
|
-
|
|
5
|
-
$APP.Mk.g(b));c.setProperty("--x-grid-row-gap",$APP.
|
|
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
|
-
|
|
2
|
+
var VP=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"}},WP=function(a,b,c){return $APP.I(b,a)?a:c},XP=function(a){switch(a){case "row-dense":return"row dense";case "column-dense":return"column dense";default:return a}},YP=function(a){return $APP.n($APP.n(a)?$APP.N("",a):a)?a:null},ZP=function(a){return $APP.n($APP.n(a)?$APP.N("",a):a)?a:"16rem"},jQ=function(a){var b=$APP.M(a);
|
|
3
|
+
a=$APP.D(b,$P);var c=$APP.D(b,aQ),d=$APP.D(b,$APP.pm),e=$APP.D(b,bQ),g=$APP.D(b,cQ),h=$APP.D(b,$APP.Mk),l=$APP.D(b,dQ),m=$APP.D(b,$APP.qj);b=$APP.D(b,$APP.Yj);h=YP(h);l=ZP(l);var p=WP(b,eQ,"md");b=function(){var v=$APP.I(eQ,d)?d:null;return $APP.n(v)?v:p}();var q=function(){var v=$APP.I(eQ,m)?m:null;return $APP.n(v)?v:p}();g=WP(g,fQ,"stretch");c=WP(c,fQ,"stretch");e=XP(WP(e,gQ,"row"));h=$APP.n(h)?h:"repeat(auto-fit,minmax("+$APP.T.g(l)+",1fr))";return $APP.zf([bQ,cQ,$APP.Mk,$APP.qj,$APP.Yj,hQ,$P,
|
|
4
|
+
iQ,$APP.pm,aQ],[e,g,h,VP(q),p,b,$APP.F(a),q,VP(b),c])},kQ=function(a){var b=$APP.zf([bQ,cQ,$APP.Mk,dQ,$APP.qj,$APP.Yj,$P,$APP.pm,aQ],[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=jQ(b);a=$APP.k(a,"__x_grid_base");if($APP.n(a)){var c=a.style;a.setAttribute("data-gap",$APP.Yj.g(b));c.setProperty("--x-grid-columns",
|
|
5
|
+
$APP.Mk.g(b));c.setProperty("--x-grid-row-gap",$APP.pm.g(b));c.setProperty("--x-grid-column-gap",$APP.qj.g(b));c.setProperty("--x-grid-align-items",cQ.g(b));c.setProperty("--x-grid-justify-items",aQ.g(b));b=c.setProperty("--x-grid-auto-flow",bQ.g(b))}else b=null;return b},lQ=function(a){if(!$APP.Dg(a,"__x_grid_initialized")){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 ";
|
|
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}kQ(a);return a},nQ=function(){var a=class extends HTMLElement{};a.observedAttributes=mQ;a.prototype.connectedCallback=function(){return lQ(this)};a.prototype.attributeChangedCallback=function(){return $APP.Dg(this,"__x_grid_initialized")?kQ(this):lQ(this)};return a},oQ=function(){return $APP.n(customElements.get("x-grid"))?null:customElements.define("x-grid",
|
|
7
|
+
nQ())},dQ=new $APP.K(null,"min-column-size","min-column-size",-1066019378),$P=new $APP.K(null,"inline","inline",1399884222),iQ=new $APP.K(null,"column-gap-token","column-gap-token",-10192833),cQ=new $APP.K(null,"align-items","align-items",-267946462),hQ=new $APP.K(null,"row-gap-token","row-gap-token",-219143816),bQ=new $APP.K(null,"auto-flow","auto-flow",-1524521728),aQ=new $APP.K(null,"justify-items","justify-items",1638310783);var mQ="columns min-column-size gap row-gap column-gap align-items justify-items auto-flow inline".split(" "),eQ=new $APP.S(null,new $APP.Q(null,6,["none",null,"xs",null,"md",null,"lg",null,"xl",null,"sm",null],null),null),fQ=new $APP.S(null,new $APP.Q(null,4,["center",null,"start",null,"stretch",null,"end",null],null),null),gQ=new $APP.S(null,new $APP.Q(null,5,["column-dense",null,"row-dense",null,"dense",null,"column",null,"row",null],null),null);$APP.ha("baredom.exports.x_grid.init",oQ);export const init=oQ;
|
package/dist/x-icon.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
2
|
+
var DP=function(){return new $APP.Q(null,3,[$APP.Qh,""+$APP.T.g(BP)+"px",CP,"md",$APP.il,BP],null)},FP=function(a){if(typeof a==="string"){a=a.trim();var b=a.toLowerCase();if($APP.B.i("",a))return DP();if($APP.I(EP,b))return a=$APP.D(EP,b),new $APP.Q(null,3,[$APP.Qh,""+$APP.T.g(a)+"px",CP,b,$APP.il,a],null);b=parseInt(a,10);return typeof b==="number"&&$APP.r(isNaN(b))&&b>0&&$APP.B.i(""+$APP.T.g(b),a)?new $APP.Q(null,3,[$APP.Qh,""+$APP.T.g(b)+"px",CP,null,$APP.il,b],null):DP()}return DP()},HP=function(a){if(!$APP.n($APP.k(a,
|
|
3
3
|
"__xIconRefs"))){var b=a.attachShadow({mode:"open"}),c=document.createElement("style"),d=document.createElement("span"),e=document.createElement("slot");c.textContent=':host{display:inline-flex;align-items:center;justify-content:center;line-height:0;vertical-align:middle;color:var(--x-icon-color,currentColor);--x-icon-size:20px;}[part\x3dbox]{display:inline-flex;align-items:center;justify-content:center;width:var(--x-icon-size);height:var(--x-icon-size);}::slotted(svg){display:block;width:100%;height:100%;}::slotted(svg[fill\x3d"currentColor"]),::slotted(svg[stroke\x3d"currentColor"]){color:inherit;}';
|
|
4
|
-
d.setAttribute("part","box");d.appendChild(e);b.appendChild(c);b.appendChild(d);a.__xIconRefs=new $APP.
|
|
5
|
-
typeof e==="string":b)?e:"";c=$APP.Qh.g(c);var g=d;$APP.B.i(g,"inherit")?d="inherit":(d=$APP.D(
|
|
6
|
-
d),a.removeAttribute("aria-hidden")):(a.setAttribute("aria-hidden","true"),a.removeAttribute("role"),a.removeAttribute("aria-label"));a.__xIconModel=b}},
|
|
7
|
-
class extends HTMLElement{};a.observedAttributes=
|
|
8
|
-
|
|
9
|
-
null),
|
|
4
|
+
d.setAttribute("part","box");d.appendChild(e);b.appendChild(c);b.appendChild(d);a.__xIconRefs=new $APP.Q(null,2,[$APP.Hi,b,GP,d],null)}},PP=function(a){var b=new $APP.Q(null,4,[$APP.Wl,a.getAttribute("size"),$APP.gn,a.getAttribute("color"),$APP.pi,a.getAttribute("label"),IP,a.hasAttribute("label")],null);b=$APP.M(b);var c=$APP.D(b,$APP.Wl),d=$APP.D(b,$APP.gn),e=$APP.D(b,$APP.pi);b=$APP.D(b,IP);c=FP(c);typeof d==="string"?(d=d.trim().toLowerCase(),d=$APP.I(JP,d)?d:"inherit"):d="inherit";e=$APP.n($APP.n(b)?
|
|
5
|
+
typeof e==="string":b)?e:"";c=$APP.Qh.g(c);var g=d;$APP.B.i(g,"inherit")?d="inherit":(d=$APP.D(KP,g),g=$APP.D(LP,g),d="var("+$APP.T.g(d)+","+$APP.T.g(g)+")");b=new $APP.Q(null,4,[MP,c,NP,d,$APP.U,e,OP,$APP.F(b)&&$APP.N("",e)],null);if($APP.N($APP.k(a,"__xIconModel"),b)){b=$APP.M(b);e=$APP.D(b,MP);c=$APP.D(b,NP);d=$APP.D(b,$APP.U);g=$APP.D(b,OP);HP(a);var h=a.style;h.setProperty("--x-icon-size",e);h.setProperty("--x-icon-color",c);$APP.n(g)?(a.setAttribute("role","img"),a.setAttribute("aria-label",
|
|
6
|
+
d),a.removeAttribute("aria-hidden")):(a.setAttribute("aria-hidden","true"),a.removeAttribute("role"),a.removeAttribute("aria-label"));a.__xIconModel=b}},QP=function(a,b,c){Object.defineProperty(a,b,{get:function(){var d=this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){return d==null||$APP.B.i(d,"")?this.removeAttribute(c):this.setAttribute(c,""+$APP.T.g(d))},enumerable:!0,configurable:!0})},RP=function(a){QP(a,"size","size");QP(a,"color","color");QP(a,"label","label")},TP=function(){var a=
|
|
7
|
+
class extends HTMLElement{};a.observedAttributes=SP;a.prototype.connectedCallback=function(){HP(this);PP(this);return null};a.prototype.disconnectedCallback=function(){return null};a.prototype.attributeChangedCallback=function(b,c,d){$APP.N(c,d)&&PP(this);return null};RP(a.prototype);return a},UP=function(){$APP.n(customElements.get("x-icon"))||customElements.define("x-icon",TP());return null},CP=new $APP.K(null,"token","token",-1211463215),NP=new $APP.K(null,"color-css","color-css",-1998870384),
|
|
8
|
+
GP=new $APP.K(null,"box","box",1530920394),MP=new $APP.K(null,"size-css","size-css",-1292915783),IP=new $APP.K(null,"label-present?","label-present?",-367749525),OP=new $APP.K(null,"labelled?","labelled?",-1907816908);var SP=["size","color","label"],EP=new $APP.Q(null,4,["sm",16,"md",20,"lg",24,"xl",32],null),JP=new $APP.S(null,new $APP.Q(null,8,["success",null,"warning",null,"muted",null,"secondary",null,"tertiary",null,"primary",null,"danger",null,"inherit",null],null),null),LP=new $APP.Q(null,7,"primary #2563eb secondary #64748b tertiary #94a3b8 success #16a34a warning #d97706 danger #dc2626 muted #64748b".split(" "),null),KP=new $APP.Q(null,7,"primary --x-color-primary secondary --x-color-secondary tertiary --x-color-tertiary success --x-color-success warning --x-color-warning danger --x-color-danger muted --x-color-text-muted".split(" "),
|
|
9
|
+
null),BP=$APP.D(EP,"md");$APP.ha("baredom.exports.x_icon.init",UP);export const init=UP;
|
package/dist/x-image.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
!1],null)):new $APP.
|
|
2
|
+
var PM=function(a){if(a==null)return new $APP.Q(null,2,[$APP.Qh,null,$APP.Th,!0],null);if(typeof a!=="string")return new $APP.Q(null,2,[$APP.Qh,null,$APP.Th,!1],null);a=a.trim().toLowerCase();if($APP.B.i(a,"")||$APP.B.i(a,"auto"))return new $APP.Q(null,2,[$APP.Qh,null,$APP.Th,!0],null);var b=$APP.eg(OM,a);return $APP.n(b)?(a=parseFloat($APP.pc(b,1)),b=parseFloat($APP.pc(b,2)),a>0&&b>0?new $APP.Q(null,2,[$APP.Qh,""+$APP.T.g(a)+" / "+$APP.T.g(b),$APP.Th,!0],null):new $APP.Q(null,2,[$APP.Qh,null,$APP.Th,
|
|
3
|
+
!1],null)):new $APP.Q(null,2,[$APP.Qh,null,$APP.Th,!1],null)},UM=function(a){var b=$APP.k(a,"__xImageRefs");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("img"),h=document.createElement("div"),l=document.createElement("slot"),m=document.createElement("div"),p=document.createElement("span"),q=document.createElement("span");c.textContent=":host{display:block;max-width:100%;box-sizing:border-box;color-scheme:light dark;--x-image-radius:var(--x-radius-md,8px);--x-image-bg:var(--x-color-surface,#f3f4f6);--x-image-border:0;--x-image-shimmer-color:var(--x-color-border,rgba(0,0,0,0.08));--x-image-shimmer-highlight:rgba(255,255,255,0.65);--x-image-shimmer-duration:1.5s;--x-image-fade-duration:var(--x-transition-duration,200ms);--x-image-fade-easing:var(--x-transition-easing,ease);--x-image-text:var(--x-color-text-muted,rgba(0,0,0,0.55));--x-image-error-gap:var(--x-space-xs,6px);--x-image-font-family:var(--x-font-family,system-ui,sans-serif);--x-image-font-size:var(--x-font-size-sm,0.875rem);}@media (prefers-color-scheme:dark){:host{--x-image-bg:var(--x-color-surface,#1f2937);--x-image-shimmer-color:var(--x-color-border,rgba(255,255,255,0.08));--x-image-shimmer-highlight:rgba(255,255,255,0.10);--x-image-text:var(--x-color-text-muted,rgba(255,255,255,0.65));}}[part\x3dframe]{position:relative;width:100%;height:100%;min-height:1em;background:var(--x-image-bg);border-radius:var(--x-image-radius);border:var(--x-image-border);overflow:hidden;}[part\x3dimage]{display:block;width:100%;height:100%;opacity:0;transition:opacity var(--x-image-fade-duration) var(--x-image-fade-easing);}:host([data-state\x3dloaded]) [part\x3dimage]{opacity:1;}[part\x3dshimmer]{position:absolute;inset:0;background-color:var(--x-image-shimmer-color);background-image:linear-gradient(90deg,transparent 0%,var(--x-image-shimmer-highlight) 50%,transparent 100%);background-size:200% 100%;background-repeat:no-repeat;background-position:-100% 0;animation:x-image-shimmer var(--x-image-shimmer-duration) linear infinite;}@keyframes x-image-shimmer{0%{background-position:-100% 0;}100%{background-position:100% 0;}}:host([data-state\x3dloaded]) [part\x3dshimmer],:host([data-state\x3derror]) [part\x3dshimmer]{display:none;}[part\x3derror]{position:absolute;inset:0;display:none;flex-direction:column;align-items:center;justify-content:center;gap:var(--x-image-error-gap);padding:8px;text-align:center;color:var(--x-image-text);font-family:var(--x-image-font-family);font-size:var(--x-image-font-size);}:host([data-state\x3derror]) [part\x3derror]{display:flex;}:host([data-state\x3derror]) [part\x3dimage]{visibility:hidden;}[part\x3derror-glyph]{font-size:1.5em;line-height:1;}[part\x3derror-text]{line-height:1.25;}@media (prefers-reduced-motion:reduce){[part\x3dshimmer]{animation:none;}[part\x3dimage]{transition:none;}}";
|
|
4
4
|
d.setAttribute("part","frame");e.setAttribute("part","shimmer");e.setAttribute("aria-hidden","true");g.setAttribute("part","image");g.alt="";g.decoding="async";g.loading="lazy";h.setAttribute("part","error");h.setAttribute("role","img");h.setAttribute("aria-label","Image failed to load");l.setAttribute("name","error");m.setAttribute("part","error-default");p.setAttribute("part","error-glyph");p.setAttribute("aria-hidden","true");p.textContent="⚠";q.setAttribute("part","error-text");q.textContent=
|
|
5
|
-
"Image unavailable";m.appendChild(p);m.appendChild(q);l.appendChild(m);h.appendChild(l);d.appendChild(e);d.appendChild(g);d.appendChild(h);b.appendChild(c);b.appendChild(d);a.__xImageRefs=new $APP.
|
|
6
|
-
|
|
7
|
-
"string"?(d=$APP.Og(d),d=typeof d==="string"&&$APP.N("",d)?d:null):d=null;typeof p==="string"?(p=p.trim().toLowerCase(),p=$APP.I(
|
|
8
|
-
$APP.n(
|
|
9
|
-
"img"),$APP.n(
|
|
10
|
-
h)):(l.removeAttribute("src"),
|
|
11
|
-
"__xImageRefs")),g=$APP.D(e,$APP.yj);e=$APP.k(a,"__xImageCurrentSrc");if($APP.n($APP.n(g)?typeof e==="string"&&$APP.N("",e):g)){var h=g.getAttribute("src");$APP.B.i(h,e)&&(
|
|
12
|
-
d.addEventListener("error",b);$APP.Cg(a,"__xImageHandlers",new $APP.
|
|
13
|
-
$APP.B.i(d,"")?this.removeAttribute(c):this.setAttribute(c,""+$APP.T.g(d))},enumerable:!0,configurable:!0})},
|
|
14
|
-
"naturalWidth",{get:function(){var b=$APP.k(this,"__xImageRefs");return $APP.n(b)?$APP.yj.g(b).naturalWidth:0},enumerable:!0,configurable:!0});Object.defineProperty(a,"naturalHeight",{get:function(){var b=$APP.k(this,"__xImageRefs");return $APP.n(b)?$APP.yj.g(b).naturalHeight:0},enumerable:!0,configurable:!0});Object.defineProperty(a,"state",{get:function(){var b=$APP.k(this,"__xImageState");return $APP.n(b)?b:"loading"},enumerable:!0,configurable:!0})},
|
|
15
|
-
a.observedAttributes=
|
|
16
|
-
|
|
17
|
-
"decorative-present?","decorative-present?",2067744841)
|
|
18
|
-
$APP.zf([$APP.
|
|
19
|
-
new $APP.
|
|
20
|
-
var
|
|
5
|
+
"Image unavailable";m.appendChild(p);m.appendChild(q);l.appendChild(m);h.appendChild(l);d.appendChild(e);d.appendChild(g);d.appendChild(h);b.appendChild(c);b.appendChild(d);a.__xImageRefs=new $APP.Q(null,6,[$APP.Hi,b,QM,d,RM,e,$APP.yj,g,SM,h,TM,l],null);return $APP.k(a,"__xImageRefs")},VM=function(a,b){a.__xImageState=b;a.setAttribute("data-state",b)},gN=function(a){var b=new $APP.Q(null,8,[$APP.gm,a.getAttribute("src"),$APP.Lm,a.getAttribute("alt"),WM,a.hasAttribute("alt"),XM,a.hasAttribute("decorative"),
|
|
6
|
+
YM,a.getAttribute("ratio"),ZM,a.getAttribute("fit"),$APP.Xj,a.getAttribute("position"),$APP.Dm,a.getAttribute("loading")],null);var c=$APP.M(b),d=$APP.D(c,$APP.gm),e=$APP.D(c,$APP.Lm),g=$APP.D(c,WM),h=$APP.D(c,XM),l=$APP.D(c,YM),m=$APP.D(c,ZM);b=$APP.D(c,$APP.Xj);var p=$APP.D(c,$APP.Dm);h=$APP.F(h);l=PM(l);c=$APP.M(l);l=$APP.D(c,$APP.Qh);c=$APP.D(c,$APP.Th);var q=!h&&$APP.r(g);e=h?"":$APP.n(g)?$APP.n(e)?e:"":"";typeof m==="string"?(m=m.trim().toLowerCase(),m=$APP.I($M,m)?m:"cover"):m="cover";typeof d===
|
|
7
|
+
"string"?(d=$APP.Og(d),d=typeof d==="string"&&$APP.N("",d)?d:null):d=null;typeof p==="string"?(p=p.trim().toLowerCase(),p=$APP.I(aN,p)?p:"lazy"):p="lazy";typeof b==="string"?(b=b.trim(),b=$APP.B.i(b,"")?"center":b):b="center";b=$APP.zf([$APP.ei,bN,$APP.Ak,cN,$APP.yl,dN,eN,$APP.cn,fN],[e,m,d,h,p,c,q,b,l]);$APP.N($APP.k(a,"__xImageModel"),b)&&(h=UM(a),c=$APP.M(h),h=$APP.D(c,QM),l=$APP.D(c,$APP.yj),c=$APP.D(c,SM),q=$APP.k(a,"__xImageModel"),p=$APP.n(q)?$APP.Ak.g(q):null,q=q==null||$APP.N(p,$APP.Ak.g(b)),
|
|
8
|
+
$APP.n(fN.g(b))?h.style.aspectRatio=fN.g(b):h.style.aspectRatio="",$APP.n(dN.g(b))||$APP.n($APP.k(a,"__xImageWarnedRatio"))||(a.__xImageWarnedRatio=!0,console.warn('[x-image] Invalid ratio attribute; expected "W:H" (e.g. "16:9").')),l.style.objectFit=bN.g(b),l.style.objectPosition=$APP.cn.g(b),l.loading=$APP.yl.g(b),l.decoding="async",$APP.n(cN.g(b))?(l.alt="",a.setAttribute("aria-hidden","true"),a.removeAttribute("role")):(l.alt=$APP.ei.g(b),a.removeAttribute("aria-hidden"),a.setAttribute("role",
|
|
9
|
+
"img"),$APP.n(eN.g(b))&&!$APP.n($APP.k(a,"__xImageWarnedAlt"))&&(a.__xImageWarnedAlt=!0,console.warn('[x-image] Missing alt attribute. Set alt\x3d"…" or add the `decorative` attribute.'))),c.setAttribute("aria-label",$APP.r(cN.g(b))&&$APP.N("",$APP.ei.g(b))?$APP.ei.g(b):"Image failed to load"),q&&(h=$APP.Ak.g(b),l=$APP.M($APP.k(a,"__xImageRefs")),l=$APP.D(l,$APP.yj),$APP.N($APP.k(a,"__xImageCurrentSrc"),h)&&(a.__xImageCurrentSrc=h,typeof h==="string"&&$APP.N("",h)?(VM(a,"loading"),l.setAttribute("src",
|
|
10
|
+
h)):(l.removeAttribute("src"),VM(a,"loading")))),a.__xImageModel=b)},kN=function(a){function b(){var e=$APP.M($APP.k(a,"__xImageRefs")),g=$APP.D(e,$APP.yj);e=$APP.k(a,"__xImageCurrentSrc");$APP.n($APP.n(g)?typeof e==="string"&&$APP.N("",e):g)&&(g=g.getAttribute("src"),$APP.B.i(g,e)&&(VM(a,"error"),e=$APP.Hh(new $APP.Q(null,1,[$APP.Ak,$APP.n(e)?e:""],null)),e=new CustomEvent("x-image-error",{detail:e,bubbles:!0,composed:!0,cancelable:!1}),a.dispatchEvent(e)));return null}function c(){var e=$APP.M($APP.k(a,
|
|
11
|
+
"__xImageRefs")),g=$APP.D(e,$APP.yj);e=$APP.k(a,"__xImageCurrentSrc");if($APP.n($APP.n(g)?typeof e==="string"&&$APP.N("",e):g)){var h=g.getAttribute("src");$APP.B.i(h,e)&&(VM(a,"loaded"),h=g.naturalWidth,g=g.naturalHeight,e=$APP.Hh(new $APP.Q(null,3,[$APP.Ak,$APP.n(e)?e:"",hN,$APP.n(h)?h:0,iN,$APP.n(g)?g:0],null)),e=new CustomEvent("x-image-load",{detail:e,bubbles:!0,composed:!0,cancelable:!1}),a.dispatchEvent(e))}return null}var d=UM(a);d=$APP.M(d);d=$APP.D(d,$APP.yj);d.addEventListener("load",c);
|
|
12
|
+
d.addEventListener("error",b);$APP.Cg(a,"__xImageHandlers",new $APP.Q(null,2,[jN,c,$APP.Ei,b],null))},lN=function(a){var b=$APP.k(a,"__xImageHandlers"),c=$APP.k(a,"__xImageRefs");if($APP.n($APP.n(b)?c:b)){c=$APP.yj.g(c);var d=jN.g(b);b=$APP.Ei.g(b);$APP.n(d)&&c.removeEventListener("load",d);$APP.n(b)&&c.removeEventListener("error",b)}a.__xImageHandlers=null},mN=function(a,b,c){Object.defineProperty(a,b,{get:function(){var d=this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){return d==null||
|
|
13
|
+
$APP.B.i(d,"")?this.removeAttribute(c):this.setAttribute(c,""+$APP.T.g(d))},enumerable:!0,configurable:!0})},nN=function(a){mN(a,"src","src");mN(a,"alt","alt");mN(a,"ratio","ratio");mN(a,"fit","fit");mN(a,"position","position");mN(a,"loading","loading");Object.defineProperty(a,"decorative",{get:function(){return this.hasAttribute("decorative")},set:function(b){return $APP.n(b)?this.setAttribute("decorative",""):this.removeAttribute("decorative")},enumerable:!0,configurable:!0});Object.defineProperty(a,
|
|
14
|
+
"naturalWidth",{get:function(){var b=$APP.k(this,"__xImageRefs");return $APP.n(b)?$APP.yj.g(b).naturalWidth:0},enumerable:!0,configurable:!0});Object.defineProperty(a,"naturalHeight",{get:function(){var b=$APP.k(this,"__xImageRefs");return $APP.n(b)?$APP.yj.g(b).naturalHeight:0},enumerable:!0,configurable:!0});Object.defineProperty(a,"state",{get:function(){var b=$APP.k(this,"__xImageState");return $APP.n(b)?b:"loading"},enumerable:!0,configurable:!0})},pN=function(){var a=class extends HTMLElement{};
|
|
15
|
+
a.observedAttributes=oN;a.prototype.connectedCallback=function(){UM(this);lN(this);kN(this);$APP.k(this,"__xImageState")==null&&VM(this,"loading");gN(this);return null};a.prototype.disconnectedCallback=function(){lN(this);return null};a.prototype.attributeChangedCallback=function(b,c,d){$APP.N(c,d)&&gN(this);return null};nN(a.prototype);return a},qN=function(){$APP.n(customElements.get("x-image"))||customElements.define("x-image",pN());return null},QM=new $APP.K(null,"frame","frame",-1711082588),
|
|
16
|
+
ZM=new $APP.K(null,"fit-raw","fit-raw",792829585),cN=new $APP.K(null,"decorative?","decorative?",131461581),SM=new $APP.K(null,"error-box","error-box",1060106676),fN=new $APP.K(null,"ratio-css","ratio-css",1208951932),RM=new $APP.K(null,"shimmer","shimmer",2123148747),TM=new $APP.K(null,"error-slot","error-slot",493821239),YM=new $APP.K(null,"ratio-raw","ratio-raw",-1076891672),eN=new $APP.K(null,"warn-alt?","warn-alt?",-638898603),jN=new $APP.K(null,"load","load",-1318641184),XM=new $APP.K(null,
|
|
17
|
+
"decorative-present?","decorative-present?",2067744841),bN=new $APP.K(null,"fit","fit",869444807),WM=new $APP.K(null,"alt-present?","alt-present?",-707038767),hN=new $APP.K(null,"naturalWidth","naturalWidth",-1890093257),iN=new $APP.K(null,"naturalHeight","naturalHeight",227028566),dN=new $APP.K(null,"ratio-valid?","ratio-valid?",-713026893);var oN="src alt decorative ratio fit position loading".split(" ");
|
|
18
|
+
$APP.zf([$APP.ei,bN,$APP.Ak,new $APP.K(null,"state","state",-1988618099),new $APP.K(null,"decorative","decorative",-238973678),$APP.yl,$APP.xj,iN,hN,$APP.cn],[new $APP.Q(null,1,[$APP.Z,$APP.Y],null),new $APP.Q(null,1,[$APP.Z,$APP.Y],null),new $APP.Q(null,1,[$APP.Z,$APP.Y],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.Bj,!0],null),new $APP.Q(null,1,[$APP.Z,$APP.Zj],null),new $APP.Q(null,1,[$APP.Z,$APP.Y],null),new $APP.Q(null,1,[$APP.Z,$APP.Y],null),new $APP.Q(null,2,[$APP.Z,$APP.W,$APP.Bj,!0],null),
|
|
19
|
+
new $APP.Q(null,2,[$APP.Z,$APP.W,$APP.Bj,!0],null),new $APP.Q(null,1,[$APP.Z,$APP.Y],null)]);$APP.Pd(["x-image-load",new $APP.Q(null,2,[$APP.V,new $APP.Q(null,3,[$APP.Ak,$APP.Y,hN,$APP.W,iN,$APP.W],null),$APP.lm,!1],null),"x-image-error",new $APP.Q(null,2,[$APP.V,new $APP.Q(null,1,[$APP.Ak,$APP.Y],null),$APP.lm,!1],null)]);
|
|
20
|
+
var $M=new $APP.S(null,new $APP.Q(null,5,["cover",null,"none",null,"fill",null,"scale-down",null,"contain",null],null),null),aN=new $APP.S(null,new $APP.Q(null,2,["eager",null,"lazy",null],null),null),OM=/^\s*(\d+(?:\.\d+)?)\s*[:\/]\s*(\d+(?:\.\d+)?)\s*$/;$APP.ha("baredom.exports.x_image.init",qN);export const init=qN;
|