@vanelsas/baredom 2.4.0 → 2.5.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 +17 -0
- package/README.md +83 -5
- package/custom-elements.json +7338 -0
- package/dist/baredom.d.ts +97 -0
- package/dist/base.js +53 -53
- package/dist/integrity.json +87 -87
- package/dist/x-alert.d.ts +43 -0
- package/dist/x-alert.js +16 -16
- package/dist/x-avatar-group.d.ts +18 -0
- package/dist/x-avatar-group.js +10 -10
- package/dist/x-avatar.d.ts +21 -0
- package/dist/x-avatar.js +2 -2
- package/dist/x-badge.d.ts +19 -0
- package/dist/x-badge.js +7 -7
- package/dist/x-bento-grid.d.ts +12 -0
- package/dist/x-bento-grid.js +2 -2
- package/dist/x-bento-item.d.ts +12 -0
- package/dist/x-bento-item.js +4 -4
- package/dist/x-breadcrumbs.d.ts +20 -0
- package/dist/x-breadcrumbs.js +14 -14
- package/dist/x-button.d.ts +45 -0
- package/dist/x-button.js +4 -4
- package/dist/x-cancel-dialogue.d.ts +50 -0
- package/dist/x-cancel-dialogue.js +12 -12
- package/dist/x-card.d.ts +39 -0
- package/dist/x-card.js +3 -3
- package/dist/x-carousel.d.ts +48 -0
- package/dist/x-carousel.js +28 -28
- package/dist/x-chart.d.ts +23 -0
- package/dist/x-chart.js +28 -28
- package/dist/x-checkbox.d.ts +45 -0
- package/dist/x-checkbox.js +6 -6
- package/dist/x-chip.d.ts +41 -0
- package/dist/x-chip.js +8 -8
- package/dist/x-collapse.d.ts +42 -0
- package/dist/x-collapse.js +1 -1
- package/dist/x-color-picker.d.ts +47 -0
- package/dist/x-color-picker.js +40 -40
- package/dist/x-combobox.d.ts +46 -0
- package/dist/x-combobox.js +24 -24
- package/dist/x-command-palette.d.ts +46 -0
- package/dist/x-command-palette.js +24 -24
- package/dist/x-container.d.ts +14 -0
- package/dist/x-container.js +2 -2
- package/dist/x-context-menu.d.ts +17 -0
- package/dist/x-context-menu.js +9 -9
- package/dist/x-copy.d.ts +51 -0
- package/dist/x-copy.js +6 -6
- package/dist/x-currency-field.d.ts +51 -0
- package/dist/x-currency-field.js +9 -8
- package/dist/x-date-picker.d.ts +20 -0
- package/dist/x-date-picker.js +8 -8
- package/dist/x-divider.d.ts +20 -0
- package/dist/x-divider.js +3 -3
- package/dist/x-drawer.d.ts +44 -0
- package/dist/x-drawer.js +3 -3
- package/dist/x-dropdown.d.ts +42 -0
- package/dist/x-dropdown.js +9 -9
- package/dist/x-fieldset.d.ts +14 -0
- package/dist/x-fieldset.js +2 -2
- package/dist/x-file-download.d.ts +40 -0
- package/dist/x-file-download.js +7 -7
- package/dist/x-file-upload.d.ts +46 -0
- package/dist/x-file-upload.js +22 -22
- package/dist/x-form-field.d.ts +47 -0
- package/dist/x-form-field.js +6 -6
- package/dist/x-form.d.ts +41 -0
- package/dist/x-form.js +3 -3
- package/dist/x-gaussian-blur.d.ts +20 -0
- package/dist/x-gaussian-blur.js +6 -6
- package/dist/x-grid.d.ts +12 -0
- package/dist/x-grid.js +3 -3
- package/dist/x-icon.d.ts +15 -0
- package/dist/x-icon.js +2 -2
- package/dist/x-image.d.ts +48 -0
- package/dist/x-image.js +6 -6
- package/dist/x-kinetic-font.d.ts +48 -0
- package/dist/x-kinetic-font.js +11 -11
- package/dist/x-kinetic-typography.d.ts +27 -0
- package/dist/x-kinetic-typography.js +20 -20
- package/dist/x-liquid-dock.d.ts +47 -0
- package/dist/x-liquid-dock.js +35 -35
- package/dist/x-liquid-fill.d.ts +46 -0
- package/dist/x-liquid-fill.js +18 -18
- package/dist/x-liquid-glass.d.ts +25 -0
- package/dist/x-liquid-glass.js +10 -10
- package/dist/x-menu-item.d.ts +41 -0
- package/dist/x-menu.d.ts +42 -0
- package/dist/x-menu.js +1 -1
- package/dist/x-metaball-cursor.d.ts +21 -0
- package/dist/x-metaball-cursor.js +9 -9
- package/dist/x-modal.d.ts +44 -0
- package/dist/x-modal.js +2 -2
- package/dist/x-morph-stack.d.ts +46 -0
- package/dist/x-morph-stack.js +39 -39
- package/dist/x-navbar.d.ts +46 -0
- package/dist/x-navbar.js +3 -3
- package/dist/x-neural-glow.d.ts +22 -0
- package/dist/x-neural-glow.js +2 -2
- package/dist/x-notification-center.d.ts +42 -0
- package/dist/x-notification-center.js +10 -10
- package/dist/x-organic-divider.d.ts +19 -0
- package/dist/x-organic-progress.d.ts +45 -0
- package/dist/x-organic-progress.js +9 -9
- package/dist/x-organic-shape.d.ts +18 -0
- package/dist/x-pagination.d.ts +44 -0
- package/dist/x-pagination.js +1 -1
- package/dist/x-particle-button.d.ts +47 -0
- package/dist/x-particle-button.js +7 -7
- package/dist/x-popover.d.ts +45 -0
- package/dist/x-popover.js +23 -23
- package/dist/x-progress-circle.d.ts +41 -0
- package/dist/x-progress-circle.js +3 -3
- package/dist/x-progress.d.ts +44 -0
- package/dist/x-progress.js +3 -3
- package/dist/x-radio.d.ts +44 -0
- package/dist/x-radio.js +11 -11
- package/dist/x-ripple-effect.d.ts +42 -0
- package/dist/x-ripple-effect.js +5 -5
- package/dist/x-scroll-parallax.d.ts +45 -0
- package/dist/x-scroll-parallax.js +3 -3
- package/dist/x-scroll-stack.d.ts +46 -0
- package/dist/x-scroll-stack.js +6 -6
- package/dist/x-scroll-story.d.ts +56 -0
- package/dist/x-scroll-story.js +14 -14
- package/dist/x-scroll-timeline.d.ts +58 -0
- package/dist/x-scroll-timeline.js +43 -43
- package/dist/x-scroll.d.ts +51 -0
- package/dist/x-scroll.js +14 -14
- package/dist/x-search-field.d.ts +47 -0
- package/dist/x-search-field.js +15 -14
- package/dist/x-select.d.ts +40 -0
- package/dist/x-select.js +3 -3
- package/dist/x-sidebar.d.ts +40 -0
- package/dist/x-sidebar.js +8 -8
- package/dist/x-skeleton-group.d.ts +15 -0
- package/dist/x-skeleton-group.js +5 -5
- package/dist/x-skeleton.d.ts +16 -0
- package/dist/x-slider.d.ts +48 -0
- package/dist/x-slider.js +5 -5
- package/dist/x-soft-body.d.ts +44 -0
- package/dist/x-soft-body.js +5 -5
- package/dist/x-spacer.d.ts +15 -0
- package/dist/x-spacer.js +1 -1
- package/dist/x-spinner.d.ts +15 -0
- package/dist/x-splash.d.ts +42 -0
- package/dist/x-splash.js +3 -3
- package/dist/x-stat.d.ts +21 -0
- package/dist/x-stat.js +6 -6
- package/dist/x-stepper.d.ts +42 -0
- package/dist/x-stepper.js +14 -14
- package/dist/x-switch.d.ts +44 -0
- package/dist/x-switch.js +5 -5
- package/dist/x-tab.d.ts +40 -0
- package/dist/x-tab.js +7 -7
- package/dist/x-table-cell.d.ts +50 -0
- package/dist/x-table-cell.js +5 -5
- package/dist/x-table-row.d.ts +43 -0
- package/dist/x-table-row.js +10 -10
- package/dist/x-table.d.ts +124 -0
- package/dist/x-table.js +3 -3
- package/dist/x-tabs.d.ts +70 -0
- package/dist/x-tabs.js +2 -2
- package/dist/x-text-area.d.ts +47 -0
- package/dist/x-text-area.js +7 -7
- package/dist/x-theme.d.ts +15 -0
- package/dist/x-timeline-item.d.ts +46 -0
- package/dist/x-timeline-item.js +19 -19
- package/dist/x-timeline.d.ts +78 -0
- package/dist/x-timeline.js +3 -3
- package/dist/x-toast.d.ts +45 -0
- package/dist/x-toast.js +21 -21
- package/dist/x-toaster.d.ts +41 -0
- package/dist/x-toaster.js +8 -8
- package/dist/x-tooltip.d.ts +43 -0
- package/dist/x-tooltip.js +12 -12
- package/dist/x-typography.d.ts +16 -0
- package/dist/x-typography.js +1 -1
- package/dist/x-welcome-tour.d.ts +92 -0
- package/dist/x-welcome-tour.js +59 -59
- package/package.json +502 -392
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// x-drawer.d.ts — auto-generated by generate_types.bb, do not edit
|
|
2
|
+
|
|
3
|
+
export function init(): void;
|
|
4
|
+
|
|
5
|
+
export interface XDrawerEventMap {
|
|
6
|
+
"x-drawer-toggle": CustomEvent<{ open: boolean }>;
|
|
7
|
+
"x-drawer-dismiss": CustomEvent<{ reason: string }>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface XDrawer extends HTMLElement {
|
|
11
|
+
open: boolean;
|
|
12
|
+
placement: string;
|
|
13
|
+
label: string;
|
|
14
|
+
show(): void;
|
|
15
|
+
hide(): void;
|
|
16
|
+
toggle(): void;
|
|
17
|
+
|
|
18
|
+
addEventListener<K extends keyof XDrawerEventMap>(
|
|
19
|
+
type: K,
|
|
20
|
+
listener: (this: XDrawer, ev: XDrawerEventMap[K]) => any,
|
|
21
|
+
options?: boolean | AddEventListenerOptions
|
|
22
|
+
): void;
|
|
23
|
+
addEventListener(
|
|
24
|
+
type: string,
|
|
25
|
+
listener: EventListenerOrEventListenerObject,
|
|
26
|
+
options?: boolean | AddEventListenerOptions
|
|
27
|
+
): void;
|
|
28
|
+
removeEventListener<K extends keyof XDrawerEventMap>(
|
|
29
|
+
type: K,
|
|
30
|
+
listener: (this: XDrawer, ev: XDrawerEventMap[K]) => any,
|
|
31
|
+
options?: boolean | EventListenerOptions
|
|
32
|
+
): void;
|
|
33
|
+
removeEventListener(
|
|
34
|
+
type: string,
|
|
35
|
+
listener: EventListenerOrEventListenerObject,
|
|
36
|
+
options?: boolean | EventListenerOptions
|
|
37
|
+
): void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare global {
|
|
41
|
+
interface HTMLElementTagNameMap {
|
|
42
|
+
"x-drawer": XDrawer;
|
|
43
|
+
}
|
|
44
|
+
}
|
package/dist/x-drawer.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
2
|
var KJ=function(a){var b=$APP.k(a,"__xDrawerRefs");if($APP.n(b))return b;b=a.attachShadow({mode:"open"});var c=document.createElement("style"),d=document.createElement("div"),e=document.createElement("div"),g=document.createElement("div"),h=document.createElement("slot"),l=document.createElement("div"),m=document.createElement("slot"),p=document.createElement("div"),q=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
3
|
d.setAttribute("part","backdrop");e.setAttribute("part","panel");e.setAttribute("role","dialog");e.setAttribute("aria-modal","true");g.setAttribute("part","header");h.setAttribute("name","header");l.setAttribute("part","body");p.setAttribute("part","footer");q.setAttribute("name","footer");g.appendChild(h);l.appendChild(m);p.appendChild(q);e.appendChild(g);e.appendChild(l);e.appendChild(p);b.appendChild(c);b.appendChild(d);b.appendChild(e);a.__xDrawerRefs={root:b,backdrop:d,panel:e,header:g,body:l,
|
|
4
|
-
footer:p};return $APP.k(a,"__xDrawerRefs")},MJ=function(a){a=new $APP.R(null,3,[$APP.Gi,a.hasAttribute("open"),$APP.
|
|
4
|
+
footer:p};return $APP.k(a,"__xDrawerRefs")},MJ=function(a){a=new $APP.R(null,3,[$APP.Gi,a.hasAttribute("open"),$APP.hn,a.getAttribute("placement"),$APP.pi,a.getAttribute("label")],null);var b=$APP.M(a),c=$APP.D(b,$APP.Gi);a=$APP.D(b,$APP.hn);b=$APP.D(b,$APP.pi);c=$APP.F(c);a=typeof a==="string"&&$APP.I(LJ,a)?a:"right";b=typeof b==="string"&&$APP.N(b,"")?b:"Drawer";return new $APP.R(null,3,[$APP.Nm,c,$APP.Qj,a,$APP.U,b],null)},NJ=function(a,b,c){a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,
|
|
5
5
|
composed:!0,cancelable:!1}))},OJ=function(a){return $APP.xe($APP.de(function(b){var c=window.getComputedStyle(b);return $APP.N("none",c.display)&&$APP.N("hidden",c.visibility)&&b.offsetWidth>0&&b.offsetHeight>0},$APP.uc(a.querySelectorAll("a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex\x3d'-1'])"))))},PJ=function(a){var b=$APP.k(a,"__xDrawerRefs");b=$APP.n(b)?$APP.k(b,"panel"):null;var c=$APP.k(a,"__xDrawerRestore"),d=
|
|
6
6
|
$APP.k(a,"__xDrawerPanelTab")===!0;a.__xDrawerTabbables=null;a.__xDrawerRestore=null;$APP.n($APP.n(b)?d:b)&&(b.removeAttribute("tabindex"),a.__xDrawerPanelTab=!1);$APP.n($APP.n(c)?c.isConnected:c)&&c.focus()},QJ=function(a,b){NJ(a,"x-drawer-dismiss",{reason:b});a.removeAttribute("open");return null},RJ=function(a){$APP.n(a.hasAttribute("open"))||a.setAttribute("open","");return null},SJ=function(a){a.removeAttribute("open");return null},TJ=function(a){var b=KJ(a);b=$APP.k(b,"panel");var c=MJ(a),d=
|
|
7
|
-
$APP.
|
|
7
|
+
$APP.Nm.g(c),e=$APP.k(a,"__xDrawerPrevOpen");a.setAttribute("data-open",$APP.n(d)?"true":"false");a.setAttribute("data-placement",$APP.Qj.g(c));b.setAttribute("aria-label",$APP.U.g(c));$APP.n(d)?b.removeAttribute("aria-hidden"):b.setAttribute("aria-hidden","true");$APP.N(e,d)&&(a.__xDrawerPrevOpen=d,NJ(a,"x-drawer-toggle",{open:d}),$APP.n(d)?setTimeout(function(){var g=$APP.k(a,"__xDrawerRefs");g=$APP.n(g)?$APP.k(g,"panel"):null;var h=OJ(a);a.__xDrawerRestore=document.activeElement;var l=$APP.n(h)?
|
|
8
8
|
$APP.Hh(h):null;a.__xDrawerTabbables=l;$APP.t(h)?$APP.u(h).focus():$APP.n(g)&&($APP.n(g.hasAttribute("tabindex"))||(g.setAttribute("tabindex","-1"),a.__xDrawerPanelTab=!0),g.focus());return null},0):PJ(a))},UJ=function(a){function b(g){var h=g.key;if($APP.B.i(h,"Escape"))g.preventDefault(),QJ(a,"escape");else if($APP.B.i(h,"Tab")){h=$APP.k(a,"__xDrawerTabbables");h=$APP.n(h)?$APP.xe($APP.uc(h)):$APP.fe;var l=$APP.k(a,"__xDrawerRefs");l=$APP.n(l)?$APP.k(l,"panel"):null;if($APP.Hc(h))g.preventDefault(),
|
|
9
9
|
$APP.n(l)&&l.focus();else{l=document.activeElement;var m=$APP.u(h);h=$APP.xc(h);var p=g.shiftKey;$APP.n($APP.n(p)?$APP.B.i(l,m):p)?(g.preventDefault(),h.focus()):$APP.r(p)&&$APP.B.i(l,h)&&(g.preventDefault(),m.focus())}}return null}function c(){return QJ(a,"backdrop")}var d=KJ(a),e=$APP.k(d,"panel");$APP.k(d,"backdrop").addEventListener("click",c);e.addEventListener("keydown",b);$APP.ja(a,"__xDrawerHandlers",{backdrop:c,keydown:b})},VJ=function(a){var b=$APP.k(a,"__xDrawerHandlers"),c=$APP.k(a,"__xDrawerRefs");
|
|
10
10
|
if($APP.n($APP.n(b)?c:b)){var d=$APP.k(c,"backdrop");c=$APP.k(c,"panel");var e=$APP.k(b,"backdrop");b=$APP.k(b,"keydown");$APP.n(e)&&d.removeEventListener("click",e);$APP.n(b)&&c.removeEventListener("keydown",b)}a.__xDrawerHandlers=null},WJ=function(a){Object.defineProperty(a,"open",{get:function(){return this.hasAttribute("open")},set:function(b){return $APP.n(b)?RJ(this):SJ(this)},enumerable:!0,configurable:!0});Object.defineProperty(a,"placement",{get:function(){var b=this.getAttribute("placement");
|
|
11
11
|
return $APP.n(b)?b:"right"},set:function(b){return b==null?this.removeAttribute("placement"):this.setAttribute("placement",""+$APP.T.g(b))},enumerable:!0,configurable:!0});Object.defineProperty(a,"label",{get:function(){var b=this.getAttribute("label");return $APP.n(b)?b:"Drawer"},set:function(b){return b==null?this.removeAttribute("label"):this.setAttribute("label",""+$APP.T.g(b))},enumerable:!0,configurable:!0});Object.defineProperty(a,"show",{value:function(){return RJ(this)},enumerable:!0,configurable:!0,
|
|
12
12
|
writable:!0});Object.defineProperty(a,"hide",{value:function(){return SJ(this)},enumerable:!0,configurable:!0,writable:!0});Object.defineProperty(a,"toggle",{value:function(){$APP.n(this.hasAttribute("open"))?SJ(this):RJ(this);return null},enumerable:!0,configurable:!0,writable:!0})},YJ=function(){if(!$APP.n(customElements.get("x-drawer"))){var a=class extends HTMLElement{};a.observedAttributes=XJ;a.prototype.connectedCallback=function(){KJ(this);VJ(this);UJ(this);TJ(this);return null};a.prototype.disconnectedCallback=
|
|
13
|
-
function(){VJ(this);PJ(this);return null};a.prototype.attributeChangedCallback=function(b,c,d){$APP.N(c,d)&&TJ(this);return null};WJ(a.prototype);customElements.define("x-drawer",a)}return null},ZJ=function(){return YJ()};var LJ=new $APP.S(null,new $APP.R(null,4,["right",null,"top",null,"bottom",null,"left",null],null),null),XJ=["open","placement","label"];$APP.Pd(["x-drawer-toggle",new $APP.R(null,2,[$APP.
|
|
13
|
+
function(){VJ(this);PJ(this);return null};a.prototype.attributeChangedCallback=function(b,c,d){$APP.N(c,d)&&TJ(this);return null};WJ(a.prototype);customElements.define("x-drawer",a)}return null},ZJ=function(){return YJ()};var LJ=new $APP.S(null,new $APP.R(null,4,["right",null,"top",null,"bottom",null,"left",null],null),null),XJ=["open","placement","label"];$APP.Pd(["x-drawer-toggle",new $APP.R(null,2,[$APP.km,!1,$APP.V,new $APP.R(null,1,[$APP.hm,$APP.Zj],null)],null),"x-drawer-dismiss",new $APP.R(null,2,[$APP.km,!1,$APP.V,new $APP.R(null,1,[$APP.Qi,$APP.Y],null)],null)]);$APP.ha("baredom.exports.x_drawer.init",ZJ);export const init=ZJ;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// x-dropdown.d.ts — auto-generated by generate_types.bb, do not edit
|
|
2
|
+
|
|
3
|
+
export function init(): void;
|
|
4
|
+
|
|
5
|
+
export interface XDropdownEventMap {
|
|
6
|
+
"x-dropdown-toggle": CustomEvent<{ open: boolean; source: string }>;
|
|
7
|
+
"x-dropdown-change": CustomEvent<{ open: boolean }>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface XDropdown extends HTMLElement {
|
|
11
|
+
open: boolean;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
label: string;
|
|
14
|
+
placement: string;
|
|
15
|
+
|
|
16
|
+
addEventListener<K extends keyof XDropdownEventMap>(
|
|
17
|
+
type: K,
|
|
18
|
+
listener: (this: XDropdown, ev: XDropdownEventMap[K]) => any,
|
|
19
|
+
options?: boolean | AddEventListenerOptions
|
|
20
|
+
): void;
|
|
21
|
+
addEventListener(
|
|
22
|
+
type: string,
|
|
23
|
+
listener: EventListenerOrEventListenerObject,
|
|
24
|
+
options?: boolean | AddEventListenerOptions
|
|
25
|
+
): void;
|
|
26
|
+
removeEventListener<K extends keyof XDropdownEventMap>(
|
|
27
|
+
type: K,
|
|
28
|
+
listener: (this: XDropdown, ev: XDropdownEventMap[K]) => any,
|
|
29
|
+
options?: boolean | EventListenerOptions
|
|
30
|
+
): void;
|
|
31
|
+
removeEventListener(
|
|
32
|
+
type: string,
|
|
33
|
+
listener: EventListenerOrEventListenerObject,
|
|
34
|
+
options?: boolean | EventListenerOptions
|
|
35
|
+
): void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare global {
|
|
39
|
+
interface HTMLElementTagNameMap {
|
|
40
|
+
"x-dropdown": XDropdown;
|
|
41
|
+
}
|
|
42
|
+
}
|
package/dist/x-dropdown.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
a)}return null},
|
|
4
|
-
$APP.k(b,"docClick"),d=$APP.k(b,"docKeydown");return setTimeout(function(){return $APP.n(a.hasAttribute("open"))?(document.addEventListener("click",c),document.addEventListener("keydown",d)):null},0)}return null},
|
|
5
|
-
b.key;return $APP.B.i(c," ")||$APP.B.i(c,"Enter")?(b.preventDefault(),
|
|
6
|
-
"escape"):null}}},
|
|
7
|
-
function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){var d=this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){d!=null&&$APP.N(d)?(d=""+$APP.T.g(d),d=this.setAttribute(c,d)):d=this.removeAttribute(c);return d}})},
|
|
8
|
-
null:
|
|
2
|
+
var mr=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},or=function(a){var b=$APP.k(a,"__xDropdownRefs");if($APP.n(b)){var c=$APP.k(b,"trigger"),d=$APP.k(b,"label");b=$APP.k(b,"panel");var e=a.hasAttribute("open"),g=a.hasAttribute("disabled");var h=a.getAttribute("label");h=$APP.n(h)?h:"";a=a.getAttribute("placement");a=$APP.I(nr,a)?a:"bottom-start";d.textContent=h;c.setAttribute("aria-expanded",$APP.n(e)?"true":"false");mr(c,"disabled",g);return b.setAttribute("data-placement",
|
|
3
|
+
a)}return null},pr=function(a,b){if($APP.n(a.hasAttribute("disabled")))return null;var c=$APP.r(a.hasAttribute("open"));b=new CustomEvent("x-dropdown-toggle",{detail:{open:c,source:b},bubbles:!0,composed:!0,cancelable:!0});a.dispatchEvent(b);return $APP.r(b.defaultPrevented)?(c?a.setAttribute("open",""):a.removeAttribute("open"),a.dispatchEvent(new CustomEvent("x-dropdown-change",{detail:{open:c},bubbles:!0,composed:!0,cancelable:!1}))):null},qr=function(a){var b=$APP.k(a,"__xDropdownHandlers");if($APP.n(b)){var c=
|
|
4
|
+
$APP.k(b,"docClick"),d=$APP.k(b,"docKeydown");return setTimeout(function(){return $APP.n(a.hasAttribute("open"))?(document.addEventListener("click",c),document.addEventListener("keydown",d)):null},0)}return null},rr=function(a){a=$APP.k(a,"__xDropdownHandlers");if($APP.n(a)){var b=$APP.k(a,"docKeydown");document.removeEventListener("click",$APP.k(a,"docClick"));return document.removeEventListener("keydown",b)}return null},sr=function(a){return{triggerClick:function(){return pr(a,"pointer")},triggerKeydown:function(b){var c=
|
|
5
|
+
b.key;return $APP.B.i(c," ")||$APP.B.i(c,"Enter")?(b.preventDefault(),pr(a,"keyboard")):null},hostFocusout:function(b){return $APP.n(a.hasAttribute("open"))?(b=b.relatedTarget,b==null||$APP.r(a.contains(b))?pr(a,"focusout"):null):null},docClick:function(b){return $APP.n(a.hasAttribute("open"))?(b=$APP.vc(b.composedPath()),b=$APP.Td(function(c){return c===a},b),$APP.n(b)?null:pr(a,"outside-click")):null},docKeydown:function(b){b=$APP.B.i(b.key,"Escape");return $APP.n(b?a.hasAttribute("open"):b)?pr(a,
|
|
6
|
+
"escape"):null}}},tr=function(a){var b=$APP.k(a,"__xDropdownRefs");if($APP.n(b)){var c=$APP.k(a,"__xDropdownHandlers");$APP.n(c)&&(b=$APP.k(b,"trigger"),b.removeEventListener("click",$APP.k(c,"triggerClick")),b.removeEventListener("keydown",$APP.k(c,"triggerKeydown")),a.removeEventListener("focusout",$APP.k(c,"hostFocusout")))}},ur=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute(c)},set:function(d){return mr(this,c,$APP.F(d))}})},vr=
|
|
7
|
+
function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){var d=this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){d!=null&&$APP.N(d)?(d=""+$APP.T.g(d),d=this.setAttribute(c,d)):d=this.removeAttribute(c);return d}})},xr=function(){var a=class extends HTMLElement{},b=a.prototype;Object.defineProperty(a,"observedAttributes",{get:function(){return wr}});ur(b,"open","open");ur(b,"disabled","disabled");vr(b,"label","label");vr(b,"placement","placement");b.show=function(){return $APP.n(this.hasAttribute("open"))?
|
|
8
|
+
null:pr(this,"programmatic")};b.hide=function(){return $APP.n(this.hasAttribute("open"))?pr(this,"programmatic"):null};b.toggle=function(){return pr(this,"programmatic")};b.connectedCallback=function(){if(!$APP.n($APP.k(this,"__xDropdownRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("button"),g=document.createElement("span"),h=document.createElement("span"),l=document.createElement("div"),m=document.createElement("div"),p=document.createElement("slot");
|
|
9
9
|
d.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;}}";
|
|
10
10
|
e.setAttribute("part","trigger");e.setAttribute("type","button");e.setAttribute("aria-haspopup","true");e.setAttribute("aria-expanded","false");e.setAttribute("aria-controls","panel");g.setAttribute("part","trigger-label");h.setAttribute("part","chevron");h.setAttribute("aria-hidden","true");h.textContent="▾";l.setAttribute("part","panel");l.setAttribute("id","panel");l.setAttribute("data-placement","bottom-start");m.setAttribute("part","panel-inner");e.appendChild(g);e.appendChild(h);m.appendChild(p);
|
|
11
|
-
l.appendChild(m);c.appendChild(d);c.appendChild(e);c.appendChild(l);this.__xDropdownRefs={trigger:e,label:g,chevron:h,panel:l}}
|
|
12
|
-
|
|
11
|
+
l.appendChild(m);c.appendChild(d);c.appendChild(e);c.appendChild(l);this.__xDropdownRefs={trigger:e,label:g,chevron:h,panel:l}}tr(this);rr(this);this.__xDropdownHandlers=sr(this);d=$APP.k(this,"__xDropdownRefs");$APP.n(d)&&(c=$APP.k(this,"__xDropdownHandlers"),$APP.n(c)&&(d=$APP.k(d,"trigger"),d.addEventListener("click",$APP.k(c,"triggerClick")),d.addEventListener("keydown",$APP.k(c,"triggerKeydown")),this.addEventListener("focusout",$APP.k(c,"hostFocusout"))));$APP.n(this.hasAttribute("open"))&&
|
|
12
|
+
qr(this);return or(this)};b.disconnectedCallback=function(){tr(this);return rr(this)};b.attributeChangedCallback=function(c){$APP.n($APP.k(this,"__xDropdownRefs"))?(or(this),c=$APP.B.i(c,"open")?$APP.n(this.hasAttribute("open"))?qr(this):rr(this):null):c=null;return c};return a},yr=function(){return $APP.n(customElements.get("x-dropdown"))?null:customElements.define("x-dropdown",xr())};var nr=new $APP.S(null,new $APP.R(null,4,["bottom-start",null,"bottom-end",null,"top-end",null,"top-start",null],null),null),wr=["open","disabled","label","placement"];$APP.Pd(["x-dropdown-toggle",new $APP.R(null,2,[$APP.km,!0,$APP.V,new $APP.R(null,2,[$APP.hm,$APP.Zj,$APP.rl,$APP.Y],null)],null),"x-dropdown-change",new $APP.R(null,2,[$APP.km,!1,$APP.V,new $APP.R(null,1,[$APP.hm,$APP.Zj],null)],null)]);$APP.ha("baredom.exports.x_dropdown.init",yr);export const init=yr;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// x-fieldset.d.ts — auto-generated by generate_types.bb, do not edit
|
|
2
|
+
|
|
3
|
+
export function init(): void;
|
|
4
|
+
|
|
5
|
+
export interface XFieldset extends HTMLElement {
|
|
6
|
+
legend: string;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare global {
|
|
11
|
+
interface HTMLElementTagNameMap {
|
|
12
|
+
"x-fieldset": XFieldset;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/dist/x-fieldset.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var sH=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},wH=function(a){var b=$APP.k(a,"__xFieldsetRefs");if($APP.n(b)){var c=$APP.k(b,"root-el"),d=$APP.k(b,"legend-el");b=$APP.k(b,"content-el");var e=a.getAttribute("legend");e=new $APP.R(null,4,[tH,e,$APP.
|
|
3
|
-
h:"";l=$APP.F(l);l=new $APP.R(null,5,[uH,h,vH,$APP.N(h,""),$APP.X,l,$APP.
|
|
2
|
+
var sH=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},wH=function(a){var b=$APP.k(a,"__xFieldsetRefs");if($APP.n(b)){var c=$APP.k(b,"root-el"),d=$APP.k(b,"legend-el");b=$APP.k(b,"content-el");var e=a.getAttribute("legend");e=new $APP.R(null,4,[tH,e,$APP.Nl,a.hasAttribute("disabled"),$APP.Uj,a.getAttribute("aria-label"),$APP.Cj,a.getAttribute("aria-describedby")],null);var g=$APP.M(e),h=$APP.D(g,tH);var l=$APP.D(g,$APP.Nl);e=$APP.D(g,$APP.Uj);g=$APP.D(g,$APP.Cj);h=$APP.n(h)?
|
|
3
|
+
h:"";l=$APP.F(l);l=new $APP.R(null,5,[uH,h,vH,$APP.N(h,""),$APP.X,l,$APP.Pl,e,$APP.Zm,g],null);h=uH.g(l);g=vH.g(l);e=$APP.X.g(l);d.textContent=h;$APP.n(g)?d.removeAttribute("hidden"):d.setAttribute("hidden","");d=$APP.Pl.g(l);$APP.n(d)?(c.setAttribute("aria-label",d),c.removeAttribute("aria-labelledby")):(c.removeAttribute("aria-label"),$APP.n(g)?c.setAttribute("aria-labelledby","x-fieldset-legend"):c.removeAttribute("aria-labelledby"));d=$APP.Zm.g(l);$APP.n(d)?c.setAttribute("aria-describedby",d):
|
|
4
4
|
c.removeAttribute("aria-describedby");sH(a,"data-disabled",e);return sH(b,"inert",e)}return null},xH=function(a){Object.defineProperty(a,"disabled",{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute("disabled")},set:function(b){return sH(this,"disabled",$APP.F(b))}})},yH=function(a){Object.defineProperty(a,"legend",{configurable:!0,enumerable:!0,get:function(){return this.getAttribute("legend")},set:function(b){b!=null&&$APP.N(b)?(b=""+$APP.T.g(b),b=this.setAttribute("legend",
|
|
5
5
|
b)):b=this.removeAttribute("legend");return b}})},AH=function(){var a=class extends HTMLElement{},b=a.prototype;a.observedAttributes=zH;yH(b);xH(b);b.connectedCallback=function(){if(!$APP.n($APP.k(this,"__xFieldsetRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("div"),g=document.createElement("div"),h=document.createElement("div"),l=document.createElement("slot");d.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
6
|
e.setAttribute("part","root");e.setAttribute("role","group");g.setAttribute("part","legend");g.setAttribute("id","x-fieldset-legend");h.setAttribute("part","content");h.appendChild(l);e.appendChild(g);e.appendChild(h);c.appendChild(d);c.appendChild(e);$APP.n(document.getElementById("x-fieldset-input-styles"))||(d=document.createElement("style"),d.setAttribute("id","x-fieldset-input-styles"),d.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);}",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// x-file-download.d.ts — auto-generated by generate_types.bb, do not edit
|
|
2
|
+
|
|
3
|
+
export function init(): void;
|
|
4
|
+
|
|
5
|
+
export interface XFileDownloadEventMap {
|
|
6
|
+
"x-file-download-click": CustomEvent<{ href: string; filename: string }>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface XFileDownload extends HTMLElement {
|
|
10
|
+
href: string;
|
|
11
|
+
filename: string;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
|
|
14
|
+
addEventListener<K extends keyof XFileDownloadEventMap>(
|
|
15
|
+
type: K,
|
|
16
|
+
listener: (this: XFileDownload, ev: XFileDownloadEventMap[K]) => any,
|
|
17
|
+
options?: boolean | AddEventListenerOptions
|
|
18
|
+
): void;
|
|
19
|
+
addEventListener(
|
|
20
|
+
type: string,
|
|
21
|
+
listener: EventListenerOrEventListenerObject,
|
|
22
|
+
options?: boolean | AddEventListenerOptions
|
|
23
|
+
): void;
|
|
24
|
+
removeEventListener<K extends keyof XFileDownloadEventMap>(
|
|
25
|
+
type: K,
|
|
26
|
+
listener: (this: XFileDownload, ev: XFileDownloadEventMap[K]) => any,
|
|
27
|
+
options?: boolean | EventListenerOptions
|
|
28
|
+
): void;
|
|
29
|
+
removeEventListener(
|
|
30
|
+
type: string,
|
|
31
|
+
listener: EventListenerOrEventListenerObject,
|
|
32
|
+
options?: boolean | EventListenerOptions
|
|
33
|
+
): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare global {
|
|
37
|
+
interface HTMLElementTagNameMap {
|
|
38
|
+
"x-file-download": XFileDownload;
|
|
39
|
+
}
|
|
40
|
+
}
|
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 Kz=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},Oz=function(a){a=new $APP.R(null,4,[Lz,a.getAttribute("href"),Mz,a.getAttribute("filename"),$APP.Nl,a.hasAttribute("disabled"),$APP.Uj,a.getAttribute("aria-label")],null);var b=$APP.M(a);a=$APP.D(b,Lz);var c=$APP.D(b,Mz),d=$APP.D(b,$APP.Nl);b=$APP.D(b,$APP.Uj);return new $APP.R(null,4,[$APP.$m,$APP.Og(a),Nz,$APP.n(c)?c:"",$APP.X,$APP.F(d),$APP.Pl,b],null)},Pz=function(a){var b=$APP.k(a,"__xFileDownloadRefs");if($APP.n(b)){b=
|
|
3
|
+
$APP.k(b,"anchor-el");var c=Oz(a),d=$APP.$m.g(c),e=Nz.g(c),g=$APP.X.g(c);c=$APP.Pl.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 Kz(a,"data-disabled",g)}return null},Qz=function(a){return function(b){if($APP.n(a.hasAttribute("disabled")))return b.preventDefault();
|
|
4
|
+
var c=Oz(a);c={href:$APP.$m.g(c),filename:Nz.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}},Rz=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},Sz=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}})},Tz=function(a){Object.defineProperty(a,"disabled",{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute("disabled")},set:function(b){return Kz(this,"disabled",$APP.F(b))}})},Vz=function(){var a=class extends HTMLElement{},b=a.prototype;Object.defineProperty(a,"observedAttributes",
|
|
6
|
+
{get:function(){return Uz}});Sz(b,"href","href");Sz(b,"filename","filename");Tz(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}}Rz(this);c=Qz(this);$APP.k($APP.k(this,"__xFileDownloadRefs"),"anchor-el").addEventListener("click",c);this.__xFileDownloadHandlers={click:c};return Pz(this)};b.disconnectedCallback=function(){return Rz(this)};b.attributeChangedCallback=function(){return Pz(this)};return a},Wz=function(){return $APP.n(customElements.get("x-file-download"))?null:customElements.define("x-file-download",
|
|
9
|
+
Vz())},Mz=new $APP.K(null,"filename-raw","filename-raw",-706184256),Lz=new $APP.K(null,"href-raw","href-raw",-1680949453),Nz=new $APP.K(null,"filename","filename",-1428840783);var Uz=["href","filename","disabled","aria-label"];$APP.Pd(["x-file-download-click",new $APP.R(null,2,[$APP.km,!0,$APP.V,new $APP.R(null,2,[$APP.$m,$APP.Y,Nz,$APP.Y],null)],null)]);$APP.ha("baredom.exports.x_file_download.init",Wz);export const init=Wz;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// x-file-upload.d.ts — auto-generated by generate_types.bb, do not edit
|
|
2
|
+
|
|
3
|
+
export function init(): void;
|
|
4
|
+
|
|
5
|
+
export interface XFileUploadEventMap {
|
|
6
|
+
"x-file-upload-select": CustomEvent<{ files: any; rejected: any }>;
|
|
7
|
+
"x-file-upload-remove": CustomEvent<{ file: Record<string, any>; remaining: any }>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface XFileUpload extends HTMLElement {
|
|
11
|
+
accept: string;
|
|
12
|
+
multiple: boolean;
|
|
13
|
+
maxSize: number;
|
|
14
|
+
maxFiles: number;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
required: boolean;
|
|
17
|
+
name: string;
|
|
18
|
+
readonly files: any;
|
|
19
|
+
|
|
20
|
+
addEventListener<K extends keyof XFileUploadEventMap>(
|
|
21
|
+
type: K,
|
|
22
|
+
listener: (this: XFileUpload, ev: XFileUploadEventMap[K]) => any,
|
|
23
|
+
options?: boolean | AddEventListenerOptions
|
|
24
|
+
): void;
|
|
25
|
+
addEventListener(
|
|
26
|
+
type: string,
|
|
27
|
+
listener: EventListenerOrEventListenerObject,
|
|
28
|
+
options?: boolean | AddEventListenerOptions
|
|
29
|
+
): void;
|
|
30
|
+
removeEventListener<K extends keyof XFileUploadEventMap>(
|
|
31
|
+
type: K,
|
|
32
|
+
listener: (this: XFileUpload, ev: XFileUploadEventMap[K]) => any,
|
|
33
|
+
options?: boolean | EventListenerOptions
|
|
34
|
+
): void;
|
|
35
|
+
removeEventListener(
|
|
36
|
+
type: string,
|
|
37
|
+
listener: EventListenerOrEventListenerObject,
|
|
38
|
+
options?: boolean | EventListenerOptions
|
|
39
|
+
): void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare global {
|
|
43
|
+
interface HTMLElementTagNameMap {
|
|
44
|
+
"x-file-upload": XFileUpload;
|
|
45
|
+
}
|
|
46
|
+
}
|
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 Hv=function(a){return a!=null?(a=parseInt(a,10),$APP.r(isNaN(a))&&a>0?a:null):null},Wv=function(a){var b=a.lastIndexOf(".");return b>0?a.substring(b).toLowerCase():null},Xv=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=Wv(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))},aw=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.R(null,2,[Yv,g,Zv,h],null);var l=$APP.u(a);var m=l;var p=b,q=c;m=$APP.Lg(p)&&!Xv(m,p)?new $APP.R(null,2,[$APP.Th,!1,$APP.Qi,"File type not accepted"],null):q!=null&&m.size>q?new $APP.R(null,2,[$APP.Th,!1,$APP.Qi,"File too large"],null):new $APP.R(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.R(null,2,
|
|
4
|
+
[$v,l,$APP.Qi,$APP.Qi.g(m)],null))):d!=null&&e>=d?(a=$APP.w(a),h=$APP.ld.i(h,new $APP.R(null,2,[$v,l,$APP.Qi,"Maximum files reached"],null))):(a=$APP.w(a),g=$APP.ld.i(g,l),e+=1)}},bw=function(a){return document.createElement(a)},kw=function(a){a=new $APP.R(null,7,[cw,a.getAttribute("accept"),dw,a.hasAttribute("multiple"),ew,a.getAttribute("max-size"),fw,a.getAttribute("max-files"),$APP.Nl,a.hasAttribute("disabled"),$APP.Nh,a.hasAttribute("required"),$APP.zl,a.getAttribute("name")],null);var b=$APP.M(a);
|
|
5
|
+
a=$APP.D(b,cw);var c=$APP.D(b,dw),d=$APP.D(b,ew),e=$APP.D(b,fw),g=$APP.D(b,$APP.Nl),h=$APP.D(b,$APP.Nh);b=$APP.D(b,$APP.zl);return new $APP.R(null,7,[gw,$APP.n(a)?a:"",hw,$APP.F(c),iw,Hv(d),jw,Hv(e),$APP.X,$APP.F(g),$APP.mi,$APP.F(h),$APP.Aj,$APP.n(b)?b:""],null)},lw=function(a){var b=$APP.k(a,"__xFileUploadRefs");if($APP.n(b)){a=kw(a);var c=$APP.M(a);a=$APP.D(c,gw);var d=$APP.D(c,hw);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},mw=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},nw=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;mw(c);c.textContent="";for(var e=0;;)if(e<d){var g=a[e],h=bw("div"),l=bw("span"),m=bw("span"),p=bw("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=bw("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"}},ow=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)}}},pw=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},qw=function(a,b,c){return a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,composed:!0,cancelable:!1}))},rw=function(a,
|
|
11
|
+
b){var c=kw(a);c=$APP.M(c);var d=$APP.D(c,gw),e=$APP.D(c,hw),g=$APP.D(c,iw),h=$APP.D(c,jw);c=$APP.k(a,"__xFileUploadFiles");b=aw($APP.uc(b),d,g,h,c.length);d=$APP.M(b);b=$APP.D(d,Yv);d=$APP.D(d,Zv);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));nw(a);ow(a);pw(a);return qw(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,$v);q=$APP.D(q,$APP.Qi);return{file:p,reason:q}},d))})},sw=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&&rw(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?rw(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);nw(a);ow(a);pw(a);b=qw(a,"x-file-upload-remove",{file:d,remaining:c.slice()})}return b}return null}}},tw=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"))}},uw=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))}})},vw=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)}})},ww=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)}})},yw=function(){var a=class extends HTMLElement{},b=a.prototype;a.formAssociated=
|
|
18
|
+
!0;Object.defineProperty(a,"observedAttributes",{get:function(){return xw}});vw(b,"accept","accept");vw(b,"name","name");uw(b,"multiple","multiple");uw(b,"disabled","disabled");uw(b,"required","required");ww(b,"maxSize","max-size");ww(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 lw(this)};b.formResetCallback=function(){$APP.k(this,"__xFileUploadFiles").length=0;var c=$APP.k(this,"__xFileUploadRefs");$APP.n(c)&&mw($APP.k(c,"fileList"));nw(this);ow(this);return pw(this)};b.connectedCallback=function(){if(!$APP.n($APP.k(this,"__xFileUploadRefs"))){var c=this.attachShadow({mode:"open"}),
|
|
20
|
+
d=bw("style"),e=bw("div"),g=bw("input"),h=bw("div"),l=bw("slot"),m=bw("div"),p=bw("div"),q=bw("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());tw(this);this.__xFileUploadHandlers=sw(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"))));lw(this);return pw(this)};b.disconnectedCallback=function(){tw(this);var c=$APP.k(this,"__xFileUploadRefs");return $APP.n(c)?mw($APP.k(c,"fileList")):null};b.attributeChangedCallback=function(){return $APP.n($APP.k(this,"__xFileUploadRefs"))?lw(this):null};return a},zw=function(){return $APP.n(customElements.get("x-file-upload"))?null:customElements.define("x-file-upload",yw())},gw=new $APP.K(null,"accept","accept",1874130431),Zv=new $APP.K(null,"rejected","rejected",
|
|
25
|
+
231052999),Yv=new $APP.K(null,"accepted","accepted",-1953464374),ew=new $APP.K(null,"max-size-raw","max-size-raw",1536077032),iw=new $APP.K(null,"max-size","max-size",-874966132),hw=new $APP.K(null,"multiple?","multiple?",-490002283),cw=new $APP.K(null,"accept-raw","accept-raw",1407413888),jw=new $APP.K(null,"max-files","max-files",534742526),dw=new $APP.K(null,"multiple-present?","multiple-present?",-1754894397),$v=new $APP.K(null,"file","file",-1269645878),fw=new $APP.K(null,"max-files-raw","max-files-raw",
|
|
26
|
+
-244409320);var xw="accept multiple max-size max-files disabled required name".split(" ");$APP.Pd(["x-file-upload-select",new $APP.R(null,2,[$APP.km,!1,$APP.V,new $APP.R(null,2,[new $APP.K(null,"files","files",-472457450),$APP.Si,Zv,$APP.Si],null)],null),"x-file-upload-remove",new $APP.R(null,2,[$APP.km,!1,$APP.V,new $APP.R(null,2,[$v,$APP.il,new $APP.K(null,"remaining","remaining",-138926777),$APP.Si],null)],null)]);$APP.ha("baredom.exports.x_file_upload.init",zw);export const init=zw;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// x-form-field.d.ts — auto-generated by generate_types.bb, do not edit
|
|
2
|
+
|
|
3
|
+
export function init(): void;
|
|
4
|
+
|
|
5
|
+
export interface XFormFieldEventMap {
|
|
6
|
+
"x-form-field-input": CustomEvent<{ name: string; value: string }>;
|
|
7
|
+
"x-form-field-change": CustomEvent<{ name: string; value: string }>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface XFormField extends HTMLElement {
|
|
11
|
+
placeholder: string;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
name: string;
|
|
14
|
+
value: string;
|
|
15
|
+
readonly: boolean;
|
|
16
|
+
type: string;
|
|
17
|
+
label: string;
|
|
18
|
+
autocomplete: string;
|
|
19
|
+
required: boolean;
|
|
20
|
+
|
|
21
|
+
addEventListener<K extends keyof XFormFieldEventMap>(
|
|
22
|
+
type: K,
|
|
23
|
+
listener: (this: XFormField, ev: XFormFieldEventMap[K]) => any,
|
|
24
|
+
options?: boolean | AddEventListenerOptions
|
|
25
|
+
): void;
|
|
26
|
+
addEventListener(
|
|
27
|
+
type: string,
|
|
28
|
+
listener: EventListenerOrEventListenerObject,
|
|
29
|
+
options?: boolean | AddEventListenerOptions
|
|
30
|
+
): void;
|
|
31
|
+
removeEventListener<K extends keyof XFormFieldEventMap>(
|
|
32
|
+
type: K,
|
|
33
|
+
listener: (this: XFormField, ev: XFormFieldEventMap[K]) => any,
|
|
34
|
+
options?: boolean | EventListenerOptions
|
|
35
|
+
): void;
|
|
36
|
+
removeEventListener(
|
|
37
|
+
type: string,
|
|
38
|
+
listener: EventListenerOrEventListenerObject,
|
|
39
|
+
options?: boolean | EventListenerOptions
|
|
40
|
+
): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare global {
|
|
44
|
+
interface HTMLElementTagNameMap {
|
|
45
|
+
"x-form-field": XFormField;
|
|
46
|
+
}
|
|
47
|
+
}
|
package/dist/x-form-field.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
2
|
var EV=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},FV=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)},HV=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.
|
|
4
|
-
g=$APP.D(h,$APP.Ji);var q=$APP.D(h,$APP.$i),v=$APP.D(h,$APP.
|
|
5
|
-
"string"&&$APP.I(GV,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.$k.g(g);C=$APP.ui.g(g);h=$APP.
|
|
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.
|
|
3
|
+
e=$APP.k(b,"hint");b=$APP.k(b,"error");var g=$APP.zf([$APP.pi,$APP.zl,$APP.Ji,$APP.$i,$APP.Nl,$APP.Nh,$APP.Lj,$APP.Dm,$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.zl);
|
|
4
|
+
g=$APP.D(h,$APP.Ji);var q=$APP.D(h,$APP.$i),v=$APP.D(h,$APP.Nl),x=$APP.D(h,$APP.Nh),y=$APP.D(h,$APP.Lj),A=$APP.D(h,$APP.Dm),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.cn,$APP.rm,$APP.ui,$APP.Aj,$APP.Yi,$APP.Cl,$APP.Z,$APP.$k,$APP.Yl,$APP.U,$APP.Ei,$APP.$l,$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(GV,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.$k.g(g);C=$APP.ui.g(g);h=$APP.Cl.g(g);d.type=$APP.Z.g(g);d.name=$APP.Aj.g(g);d.placeholder=$APP.rm.g(g);d.disabled=$APP.X.g(g);d.readOnly=$APP.cn.g(g);d.required=$APP.mi.g(g);d.autocomplete=$APP.$l.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.Yl.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");EV(a,"data-invalid",v);c=$APP.k(a,"__xFormFieldInternals");return $APP.n(c)?
|
|
7
7
|
FV(a,c,d):null}return null},IV=function(a,b,c){return a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,composed:!0,cancelable:!1}))},JV=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),FV(a,e,b));return IV(a,"x-form-field-input",{name:d,value:c})}return null}},KV=function(a){return function(){var b=$APP.k(a,"__xFormFieldRefs");
|
|
8
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),FV(a,e,b));return IV(a,"x-form-field-change",{name:d,value:c})}return null}},LV=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
9
|
null;return}}return null},MV=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}})},NV=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute(c)},set:function(d){return EV(this,c,$APP.F(d))}})},OV=function(a){Object.defineProperty(a,"value",{configurable:!0,
|
|
@@ -14,5 +14,5 @@ e.setAttribute("part","field");g.setAttribute("part","label");g.setAttribute("id
|
|
|
14
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())}LV(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
15
|
"__xFormFieldRefs");$APP.n(c)&&(c=$APP.k(c,"input"),d=JV(this),e=KV(this),c.addEventListener("input",d),c.addEventListener("change",e),this.__xFormFieldHandlers={input:d,change:e});return HV(this)};b.disconnectedCallback=function(){return LV(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 HV(this)};b.formDisabledCallback=function(c){EV(this,"disabled",$APP.F(c));
|
|
16
16
|
return HV(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 HV(this)};return a},RV=function(){return $APP.n(customElements.get("x-form-field"))?null:customElements.define("x-form-field",QV())};var PV="label type name value placeholder hint error disabled readonly required autocomplete".split(" "),GV=new $APP.S(null,new $APP.R(null,6,["url",null,"tel",null,"email",null,"text",null,"number",null,"password",null],null),null);
|
|
17
|
-
$APP.zf([$APP.
|
|
18
|
-
2,[$APP.Z,$APP.Y,$APP.Ik,"autocomplete"],null),new $APP.R(null,2,[$APP.Z,$APP.Zj,$APP.Ik,"required"],null)]);$APP.ha("baredom.exports.x_form_field.init",RV);export const init=RV;
|
|
17
|
+
$APP.zf([$APP.rm,$APP.Pj,$APP.Aj,$APP.Yi,$APP.Bj,$APP.Z,$APP.U,$APP.$l,$APP.Dk],[new $APP.R(null,2,[$APP.Z,$APP.Y,$APP.Ik,"placeholder"],null),new $APP.R(null,2,[$APP.Z,$APP.Zj,$APP.Ik,"disabled"],null),new $APP.R(null,2,[$APP.Z,$APP.Y,$APP.Ik,"name"],null),new $APP.R(null,2,[$APP.Z,$APP.Y,$APP.Ik,"value"],null),new $APP.R(null,2,[$APP.Z,$APP.Zj,$APP.Ik,"readonly"],null),new $APP.R(null,2,[$APP.Z,$APP.Y,$APP.Ik,"type"],null),new $APP.R(null,2,[$APP.Z,$APP.Y,$APP.Ik,"label"],null),new $APP.R(null,
|
|
18
|
+
2,[$APP.Z,$APP.Y,$APP.Ik,"autocomplete"],null),new $APP.R(null,2,[$APP.Z,$APP.Zj,$APP.Ik,"required"],null)]);$APP.Pd(["x-form-field-input",new $APP.R(null,2,[$APP.km,!1,$APP.V,new $APP.R(null,2,[$APP.Aj,$APP.Y,$APP.Yi,$APP.Y],null)],null),"x-form-field-change",new $APP.R(null,2,[$APP.km,!1,$APP.V,new $APP.R(null,2,[$APP.Aj,$APP.Y,$APP.Yi,$APP.Y],null)],null)]);$APP.ha("baredom.exports.x_form_field.init",RV);export const init=RV;
|
package/dist/x-form.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// x-form.d.ts — auto-generated by generate_types.bb, do not edit
|
|
2
|
+
|
|
3
|
+
export function init(): void;
|
|
4
|
+
|
|
5
|
+
export interface XFormEventMap {
|
|
6
|
+
"x-form-submit": CustomEvent<{ values: Record<string, any> }>;
|
|
7
|
+
"x-form-reset": CustomEvent<{}>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface XForm extends HTMLElement {
|
|
11
|
+
loading: boolean;
|
|
12
|
+
novalidate: boolean;
|
|
13
|
+
autocomplete: string;
|
|
14
|
+
|
|
15
|
+
addEventListener<K extends keyof XFormEventMap>(
|
|
16
|
+
type: K,
|
|
17
|
+
listener: (this: XForm, ev: XFormEventMap[K]) => any,
|
|
18
|
+
options?: boolean | AddEventListenerOptions
|
|
19
|
+
): void;
|
|
20
|
+
addEventListener(
|
|
21
|
+
type: string,
|
|
22
|
+
listener: EventListenerOrEventListenerObject,
|
|
23
|
+
options?: boolean | AddEventListenerOptions
|
|
24
|
+
): void;
|
|
25
|
+
removeEventListener<K extends keyof XFormEventMap>(
|
|
26
|
+
type: K,
|
|
27
|
+
listener: (this: XForm, ev: XFormEventMap[K]) => any,
|
|
28
|
+
options?: boolean | EventListenerOptions
|
|
29
|
+
): void;
|
|
30
|
+
removeEventListener(
|
|
31
|
+
type: string,
|
|
32
|
+
listener: EventListenerOrEventListenerObject,
|
|
33
|
+
options?: boolean | EventListenerOptions
|
|
34
|
+
): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare global {
|
|
38
|
+
interface HTMLElementTagNameMap {
|
|
39
|
+
"x-form": XForm;
|
|
40
|
+
}
|
|
41
|
+
}
|