@validol4ik/uikit 0.10.1 → 0.11.1

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.
@@ -1,264 +0,0 @@
1
- import { onBeforeUnmount as te, getCurrentInstance as ge, ref as F, computed as m, watch as Y, h as w, Transition as j } from "vue";
2
- import { c as v, r as I, a as we } from "./focusout-DjvPXP_b.js";
3
- import { y as d, s as ye, G as pe, c as be, h as xe, E as Te } from "./index-W3hJ-aLX.js";
4
- import { m as qe, n as Se, o as ke, b as Ee, u as Ce, c as Be, e as Le, d as Pe, f as _e, i as He, h as Fe, j as Q, a as ze, l as Me } from "./escape-key-BNqVqiWj.js";
5
- function De(e, t, s) {
6
- function n() {
7
- }
8
- return te(() => {
9
- e.value === !0 && void 0;
10
- }), {
11
- removeFromHistory: n,
12
- addToHistory() {
13
- }
14
- };
15
- }
16
- let y = 0, z, M, p, D = !1, U, G, J, f = null;
17
- function Re(e) {
18
- Ve(e) && ye(e);
19
- }
20
- function Ve(e) {
21
- if (e.target === document.body || e.target.classList.contains("q-layout__backdrop"))
22
- return !0;
23
- const t = pe(e), s = e.shiftKey && !e.deltaX, n = !s && Math.abs(e.deltaX) <= Math.abs(e.deltaY), r = s || n ? e.deltaY : e.deltaX;
24
- for (let a = 0; a < t.length; a++) {
25
- const i = t[a];
26
- if (ke(i, n))
27
- return n ? r < 0 && i.scrollTop === 0 ? !0 : r > 0 && i.scrollTop + i.clientHeight === i.scrollHeight : r < 0 && i.scrollLeft === 0 ? !0 : r > 0 && i.scrollLeft + i.clientWidth === i.scrollWidth;
28
- }
29
- return !0;
30
- }
31
- function N(e) {
32
- e.target === document && (document.scrollingElement.scrollTop = document.scrollingElement.scrollTop);
33
- }
34
- function q(e) {
35
- D !== !0 && (D = !0, requestAnimationFrame(() => {
36
- D = !1;
37
- const { height: t } = e.target, { clientHeight: s, scrollTop: n } = document.scrollingElement;
38
- (p === void 0 || t !== window.innerHeight) && (p = s - t, document.scrollingElement.scrollTop = n), n > p && (document.scrollingElement.scrollTop -= Math.ceil((n - p) / 8));
39
- }));
40
- }
41
- function Z(e) {
42
- const t = document.body, s = window.visualViewport !== void 0;
43
- if (e === "add") {
44
- const { overflowY: n, overflowX: r } = window.getComputedStyle(t);
45
- z = qe(window), M = Se(window), U = t.style.left, G = t.style.top, J = window.location.href, t.style.left = `-${z}px`, t.style.top = `-${M}px`, r !== "hidden" && (r === "scroll" || t.scrollWidth > window.innerWidth) && t.classList.add("q-body--force-scrollbar-x"), n !== "hidden" && (n === "scroll" || t.scrollHeight > window.innerHeight) && t.classList.add("q-body--force-scrollbar-y"), t.classList.add("q-body--prevent-scroll"), document.qScrollPrevented = !0, v.is.ios === !0 && (s === !0 ? (window.scrollTo(0, 0), window.visualViewport.addEventListener("resize", q, d.passiveCapture), window.visualViewport.addEventListener("scroll", q, d.passiveCapture), window.scrollTo(0, 0)) : window.addEventListener("scroll", N, d.passiveCapture));
46
- }
47
- v.is.desktop === !0 && v.is.mac === !0 && window[`${e}EventListener`]("wheel", Re, d.notPassive), e === "remove" && (v.is.ios === !0 && (s === !0 ? (window.visualViewport.removeEventListener("resize", q, d.passiveCapture), window.visualViewport.removeEventListener("scroll", q, d.passiveCapture)) : window.removeEventListener("scroll", N, d.passiveCapture)), t.classList.remove("q-body--prevent-scroll"), t.classList.remove("q-body--force-scrollbar-x"), t.classList.remove("q-body--force-scrollbar-y"), document.qScrollPrevented = !1, t.style.left = U, t.style.top = G, window.location.href === J && window.scrollTo(z, M), p = void 0);
48
- }
49
- function $e(e) {
50
- let t = "add";
51
- if (e === !0) {
52
- if (y++, f !== null) {
53
- clearTimeout(f), f = null;
54
- return;
55
- }
56
- if (y > 1) return;
57
- } else {
58
- if (y === 0 || (y--, y > 0)) return;
59
- if (t = "remove", v.is.ios === !0 && v.is.nativeMobile === !0) {
60
- f !== null && clearTimeout(f), f = setTimeout(() => {
61
- Z(t), f = null;
62
- }, 100);
63
- return;
64
- }
65
- }
66
- Z(t);
67
- }
68
- function Ae() {
69
- let e;
70
- return {
71
- preventBodyScroll(t) {
72
- t !== e && (e !== void 0 || t === !0) && (e = t, $e(t));
73
- }
74
- };
75
- }
76
- let S = 0;
77
- const Oe = {
78
- standard: "fixed-full flex-center",
79
- top: "fixed-top justify-center",
80
- bottom: "fixed-bottom justify-center",
81
- right: "fixed-right items-center",
82
- left: "fixed-left items-center"
83
- }, ee = {
84
- standard: ["scale", "scale"],
85
- top: ["slide-down", "slide-up"],
86
- bottom: ["slide-up", "slide-down"],
87
- right: ["slide-left", "slide-right"],
88
- left: ["slide-right", "slide-left"]
89
- }, je = be({
90
- name: "QDialog",
91
- inheritAttrs: !1,
92
- props: {
93
- ...Be,
94
- ...Ce,
95
- transitionShow: String,
96
- // override useTransitionProps
97
- transitionHide: String,
98
- // override useTransitionProps
99
- persistent: Boolean,
100
- autoClose: Boolean,
101
- allowFocusOutside: Boolean,
102
- noEscDismiss: Boolean,
103
- noBackdropDismiss: Boolean,
104
- noRouteDismiss: Boolean,
105
- noRefocus: Boolean,
106
- noFocus: Boolean,
107
- noShake: Boolean,
108
- seamless: Boolean,
109
- maximized: Boolean,
110
- fullWidth: Boolean,
111
- fullHeight: Boolean,
112
- square: Boolean,
113
- backdropFilter: String,
114
- position: {
115
- type: String,
116
- default: "standard",
117
- validator: (e) => ["standard", "top", "bottom", "left", "right"].includes(e)
118
- }
119
- },
120
- emits: [
121
- ...Ee,
122
- "shake",
123
- "click",
124
- "escapeKey"
125
- ],
126
- setup(e, { slots: t, emit: s, attrs: n }) {
127
- const r = ge(), a = F(null), i = F(!1), h = F(!1);
128
- let u = null, c = null, b, k;
129
- const oe = m(
130
- () => e.persistent !== !0 && e.noRouteDismiss !== !0 && e.seamless !== !0
131
- ), { preventBodyScroll: R } = Ae(), { registerTimeout: V } = Le(), { registerTick: le, removeTick: $ } = Pe(), { transitionProps: ie, transitionStyle: A } = _e(
132
- e,
133
- () => ee[e.position][0],
134
- () => ee[e.position][1]
135
- ), ne = m(() => A.value + (e.backdropFilter !== void 0 ? `;backdrop-filter:${e.backdropFilter};-webkit-backdrop-filter:${e.backdropFilter}` : "")), { showPortal: O, hidePortal: W, portalIsAccessible: se, renderPortal: re } = He(
136
- r,
137
- a,
138
- he,
139
- "dialog"
140
- ), { hide: E } = Fe({
141
- showing: i,
142
- hideOnRouteChange: oe,
143
- handleShow: de,
144
- handleHide: fe,
145
- processOnMount: !0
146
- });
147
- De(i);
148
- const ae = m(
149
- () => `q-dialog__inner flex no-pointer-events q-dialog__inner--${e.maximized === !0 ? "maximized" : "minimized"} q-dialog__inner--${e.position} ${Oe[e.position]}` + (h.value === !0 ? " q-dialog__inner--animating" : "") + (e.fullWidth === !0 ? " q-dialog__inner--fullwidth" : "") + (e.fullHeight === !0 ? " q-dialog__inner--fullheight" : "") + (e.square === !0 ? " q-dialog__inner--square" : "")
150
- ), x = m(() => i.value === !0 && e.seamless !== !0), ue = m(() => e.autoClose === !0 ? { onClick: me } : {}), ce = m(() => [
151
- `q-dialog fullscreen no-pointer-events q-dialog--${x.value === !0 ? "modal" : "seamless"}`,
152
- n.class
153
- ]);
154
- Y(() => e.maximized, (o) => {
155
- i.value === !0 && L(o);
156
- }), Y(x, (o) => {
157
- R(o), o === !0 ? (we(P), Me(B)) : (I(P), Q(B));
158
- });
159
- function de(o) {
160
- var l;
161
- c = e.noRefocus === !1 && document.activeElement !== null ? document.activeElement : null, L(e.maximized), O(), h.value = !0, e.noFocus !== !0 ? ((l = document.activeElement) == null || l.blur(), le(g)) : $(), V(() => {
162
- if (r.proxy.$q.platform.is.ios === !0) {
163
- if (e.seamless !== !0 && document.activeElement) {
164
- const { top: T, bottom: _ } = document.activeElement.getBoundingClientRect(), { innerHeight: X } = window, H = window.visualViewport !== void 0 ? window.visualViewport.height : X;
165
- T > 0 && _ > H / 2 && (document.scrollingElement.scrollTop = Math.min(
166
- document.scrollingElement.scrollHeight - H,
167
- _ >= X ? 1 / 0 : Math.ceil(document.scrollingElement.scrollTop + _ - H / 2)
168
- )), document.activeElement.scrollIntoView();
169
- }
170
- k = !0, a.value.click(), k = !1;
171
- }
172
- O(!0), h.value = !1, s("show", o);
173
- }, e.transitionDuration);
174
- }
175
- function fe(o) {
176
- $(), K(!0), h.value = !0, W(), c !== null && ((((o == null ? void 0 : o.type.indexOf("key")) === 0 ? c.closest('[tabindex]:not([tabindex^="-"])') : void 0) || c).focus(), c = null), V(() => {
177
- W(!0), h.value = !1, s("hide", o);
178
- }, e.transitionDuration);
179
- }
180
- function g(o) {
181
- ze(() => {
182
- let l = a.value;
183
- if (l !== null) {
184
- if (o !== void 0) {
185
- const T = l.querySelector(o);
186
- if (T !== null) {
187
- T.focus({ preventScroll: !0 });
188
- return;
189
- }
190
- }
191
- l.contains(document.activeElement) !== !0 && (l = l.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]") || l.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]") || l.querySelector("[autofocus], [data-autofocus]") || l, l.focus({ preventScroll: !0 }));
192
- }
193
- });
194
- }
195
- function C(o) {
196
- o && typeof o.focus == "function" ? o.focus({ preventScroll: !0 }) : g(), s("shake");
197
- const l = a.value;
198
- l !== null && (l.classList.remove("q-animate--scale"), l.classList.add("q-animate--scale"), u !== null && clearTimeout(u), u = setTimeout(() => {
199
- u = null, a.value !== null && (l.classList.remove("q-animate--scale"), g());
200
- }, 170));
201
- }
202
- function B() {
203
- e.seamless !== !0 && (e.persistent === !0 || e.noEscDismiss === !0 ? e.maximized !== !0 && e.noShake !== !0 && C() : (s("escapeKey"), E()));
204
- }
205
- function K(o) {
206
- u !== null && (clearTimeout(u), u = null), (o === !0 || i.value === !0) && (L(!1), e.seamless !== !0 && (R(!1), I(P), Q(B))), o !== !0 && (c = null);
207
- }
208
- function L(o) {
209
- o === !0 ? b !== !0 && (S < 1 && document.body.classList.add("q-body--dialog"), S++, b = !0) : b === !0 && (S < 2 && document.body.classList.remove("q-body--dialog"), S--, b = !1);
210
- }
211
- function me(o) {
212
- k !== !0 && (E(o), s("click", o));
213
- }
214
- function ve(o) {
215
- e.persistent !== !0 && e.noBackdropDismiss !== !0 ? E(o) : e.noShake !== !0 && C();
216
- }
217
- function P(o) {
218
- e.allowFocusOutside !== !0 && se.value === !0 && Te(a.value, o.target) !== !0 && g('[tabindex]:not([tabindex="-1"])');
219
- }
220
- Object.assign(r.proxy, {
221
- // expose public methods
222
- focus: g,
223
- shake: C,
224
- // private but needed by QSelect
225
- __updateRefocusTarget(o) {
226
- c = o || null;
227
- }
228
- }), te(K);
229
- function he() {
230
- return w("div", {
231
- role: "dialog",
232
- "aria-modal": x.value === !0 ? "true" : "false",
233
- ...n,
234
- class: ce.value
235
- }, [
236
- w(j, {
237
- name: "q-transition--fade",
238
- appear: !0
239
- }, () => x.value === !0 ? w("div", {
240
- class: "q-dialog__backdrop fixed-full",
241
- style: ne.value,
242
- "aria-hidden": "true",
243
- tabindex: -1,
244
- onClick: ve
245
- }) : null),
246
- w(
247
- j,
248
- ie.value,
249
- () => i.value === !0 ? w("div", {
250
- ref: a,
251
- class: ae.value,
252
- style: A.value,
253
- tabindex: -1,
254
- ...ue.value
255
- }, xe(t.default)) : null
256
- )
257
- ]);
258
- }
259
- return re;
260
- }
261
- });
262
- export {
263
- je as Q
264
- };
@@ -1 +0,0 @@
1
- "use strict";const i=require("vue"),f=require("./focusout-DzWGke-4.cjs"),u=require("./index-D2z9gMNY.cjs"),r=require("./escape-key-DG0KKsWF.cjs");function ce(e,t,a){function s(){}return i.onBeforeUnmount(()=>{e.value===!0&&void 0}),{removeFromHistory:s,addToHistory(){}}}let p=0,H,z,y,O=!1,X,Y,I,h=null;function de(e){fe(e)&&u.stopAndPrevent(e)}function fe(e){if(e.target===document.body||e.target.classList.contains("q-layout__backdrop"))return!0;const t=u.getEventPath(e),a=e.shiftKey&&!e.deltaX,s=!a&&Math.abs(e.deltaX)<=Math.abs(e.deltaY),c=a||s?e.deltaY:e.deltaX;for(let d=0;d<t.length;d++){const n=t[d];if(r.hasScrollbar(n,s))return s?c<0&&n.scrollTop===0?!0:c>0&&n.scrollTop+n.clientHeight===n.scrollHeight:c<0&&n.scrollLeft===0?!0:c>0&&n.scrollLeft+n.clientWidth===n.scrollWidth}return!0}function j(e){e.target===document&&(document.scrollingElement.scrollTop=document.scrollingElement.scrollTop)}function T(e){O!==!0&&(O=!0,requestAnimationFrame(()=>{O=!1;const{height:t}=e.target,{clientHeight:a,scrollTop:s}=document.scrollingElement;(y===void 0||t!==window.innerHeight)&&(y=a-t,document.scrollingElement.scrollTop=s),s>y&&(document.scrollingElement.scrollTop-=Math.ceil((s-y)/8))}))}function Q(e){const t=document.body,a=window.visualViewport!==void 0;if(e==="add"){const{overflowY:s,overflowX:c}=window.getComputedStyle(t);H=r.getHorizontalScrollPosition(window),z=r.getVerticalScrollPosition(window),X=t.style.left,Y=t.style.top,I=window.location.href,t.style.left=`-${H}px`,t.style.top=`-${z}px`,c!=="hidden"&&(c==="scroll"||t.scrollWidth>window.innerWidth)&&t.classList.add("q-body--force-scrollbar-x"),s!=="hidden"&&(s==="scroll"||t.scrollHeight>window.innerHeight)&&t.classList.add("q-body--force-scrollbar-y"),t.classList.add("q-body--prevent-scroll"),document.qScrollPrevented=!0,f.client.is.ios===!0&&(a===!0?(window.scrollTo(0,0),window.visualViewport.addEventListener("resize",T,u.listenOpts.passiveCapture),window.visualViewport.addEventListener("scroll",T,u.listenOpts.passiveCapture),window.scrollTo(0,0)):window.addEventListener("scroll",j,u.listenOpts.passiveCapture))}f.client.is.desktop===!0&&f.client.is.mac===!0&&window[`${e}EventListener`]("wheel",de,u.listenOpts.notPassive),e==="remove"&&(f.client.is.ios===!0&&(a===!0?(window.visualViewport.removeEventListener("resize",T,u.listenOpts.passiveCapture),window.visualViewport.removeEventListener("scroll",T,u.listenOpts.passiveCapture)):window.removeEventListener("scroll",j,u.listenOpts.passiveCapture)),t.classList.remove("q-body--prevent-scroll"),t.classList.remove("q-body--force-scrollbar-x"),t.classList.remove("q-body--force-scrollbar-y"),document.qScrollPrevented=!1,t.style.left=X,t.style.top=Y,window.location.href===I&&window.scrollTo(H,z),y=void 0)}function me(e){let t="add";if(e===!0){if(p++,h!==null){clearTimeout(h),h=null;return}if(p>1)return}else{if(p===0||(p--,p>0))return;if(t="remove",f.client.is.ios===!0&&f.client.is.nativeMobile===!0){h!==null&&clearTimeout(h),h=setTimeout(()=>{Q(t),h=null},100);return}}Q(t)}function ve(){let e;return{preventBodyScroll(t){t!==e&&(e!==void 0||t===!0)&&(e=t,me(t))}}}let S=0;const he={standard:"fixed-full flex-center",top:"fixed-top justify-center",bottom:"fixed-bottom justify-center",right:"fixed-right items-center",left:"fixed-left items-center"},U={standard:["scale","scale"],top:["slide-down","slide-up"],bottom:["slide-up","slide-down"],right:["slide-left","slide-right"],left:["slide-right","slide-left"]},ge=u.createComponent({name:"QDialog",inheritAttrs:!1,props:{...r.useModelToggleProps,...r.useTransitionProps,transitionShow:String,transitionHide:String,persistent:Boolean,autoClose:Boolean,allowFocusOutside:Boolean,noEscDismiss:Boolean,noBackdropDismiss:Boolean,noRouteDismiss:Boolean,noRefocus:Boolean,noFocus:Boolean,noShake:Boolean,seamless:Boolean,maximized:Boolean,fullWidth:Boolean,fullHeight:Boolean,square:Boolean,backdropFilter:String,position:{type:String,default:"standard",validator:e=>["standard","top","bottom","left","right"].includes(e)}},emits:[...r.useModelToggleEmits,"shake","click","escapeKey"],setup(e,{slots:t,emit:a,attrs:s}){const c=i.getCurrentInstance(),d=i.ref(null),n=i.ref(!1),g=i.ref(!1);let m=null,v=null,b,k;const G=i.computed(()=>e.persistent!==!0&&e.noRouteDismiss!==!0&&e.seamless!==!0),{preventBodyScroll:M}=ve(),{registerTimeout:D}=r.useTimeout(),{registerTick:J,removeTick:R}=r.useTick(),{transitionProps:N,transitionStyle:V}=r.useTransition(e,()=>U[e.position][0],()=>U[e.position][1]),Z=i.computed(()=>V.value+(e.backdropFilter!==void 0?`;backdrop-filter:${e.backdropFilter};-webkit-backdrop-filter:${e.backdropFilter}`:"")),{showPortal:$,hidePortal:A,portalIsAccessible:ee,renderPortal:te}=r.usePortal(c,d,ue,"dialog"),{hide:E}=r.useModelToggle({showing:n,hideOnRouteChange:G,handleShow:ne,handleHide:se,processOnMount:!0});ce(n);const oe=i.computed(()=>`q-dialog__inner flex no-pointer-events q-dialog__inner--${e.maximized===!0?"maximized":"minimized"} q-dialog__inner--${e.position} ${he[e.position]}`+(g.value===!0?" q-dialog__inner--animating":"")+(e.fullWidth===!0?" q-dialog__inner--fullwidth":"")+(e.fullHeight===!0?" q-dialog__inner--fullheight":"")+(e.square===!0?" q-dialog__inner--square":"")),q=i.computed(()=>n.value===!0&&e.seamless!==!0),ie=i.computed(()=>e.autoClose===!0?{onClick:re}:{}),le=i.computed(()=>[`q-dialog fullscreen no-pointer-events q-dialog--${q.value===!0?"modal":"seamless"}`,s.class]);i.watch(()=>e.maximized,o=>{n.value===!0&&L(o)}),i.watch(q,o=>{M(o),o===!0?(f.addFocusout(P),r.addEscapeKey(C)):(f.removeFocusout(P),r.removeEscapeKey(C))});function ne(o){var l;v=e.noRefocus===!1&&document.activeElement!==null?document.activeElement:null,L(e.maximized),$(),g.value=!0,e.noFocus!==!0?((l=document.activeElement)==null||l.blur(),J(w)):R(),D(()=>{if(c.proxy.$q.platform.is.ios===!0){if(e.seamless!==!0&&document.activeElement){const{top:x,bottom:_}=document.activeElement.getBoundingClientRect(),{innerHeight:W}=window,F=window.visualViewport!==void 0?window.visualViewport.height:W;x>0&&_>F/2&&(document.scrollingElement.scrollTop=Math.min(document.scrollingElement.scrollHeight-F,_>=W?1/0:Math.ceil(document.scrollingElement.scrollTop+_-F/2))),document.activeElement.scrollIntoView()}k=!0,d.value.click(),k=!1}$(!0),g.value=!1,a("show",o)},e.transitionDuration)}function se(o){R(),K(!0),g.value=!0,A(),v!==null&&((((o==null?void 0:o.type.indexOf("key"))===0?v.closest('[tabindex]:not([tabindex^="-"])'):void 0)||v).focus(),v=null),D(()=>{A(!0),g.value=!1,a("hide",o)},e.transitionDuration)}function w(o){r.addFocusFn(()=>{let l=d.value;if(l!==null){if(o!==void 0){const x=l.querySelector(o);if(x!==null){x.focus({preventScroll:!0});return}}l.contains(document.activeElement)!==!0&&(l=l.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]")||l.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]")||l.querySelector("[autofocus], [data-autofocus]")||l,l.focus({preventScroll:!0}))}})}function B(o){o&&typeof o.focus=="function"?o.focus({preventScroll:!0}):w(),a("shake");const l=d.value;l!==null&&(l.classList.remove("q-animate--scale"),l.classList.add("q-animate--scale"),m!==null&&clearTimeout(m),m=setTimeout(()=>{m=null,d.value!==null&&(l.classList.remove("q-animate--scale"),w())},170))}function C(){e.seamless!==!0&&(e.persistent===!0||e.noEscDismiss===!0?e.maximized!==!0&&e.noShake!==!0&&B():(a("escapeKey"),E()))}function K(o){m!==null&&(clearTimeout(m),m=null),(o===!0||n.value===!0)&&(L(!1),e.seamless!==!0&&(M(!1),f.removeFocusout(P),r.removeEscapeKey(C))),o!==!0&&(v=null)}function L(o){o===!0?b!==!0&&(S<1&&document.body.classList.add("q-body--dialog"),S++,b=!0):b===!0&&(S<2&&document.body.classList.remove("q-body--dialog"),S--,b=!1)}function re(o){k!==!0&&(E(o),a("click",o))}function ae(o){e.persistent!==!0&&e.noBackdropDismiss!==!0?E(o):e.noShake!==!0&&B()}function P(o){e.allowFocusOutside!==!0&&ee.value===!0&&u.childHasFocus(d.value,o.target)!==!0&&w('[tabindex]:not([tabindex="-1"])')}Object.assign(c.proxy,{focus:w,shake:B,__updateRefocusTarget(o){v=o||null}}),i.onBeforeUnmount(K);function ue(){return i.h("div",{role:"dialog","aria-modal":q.value===!0?"true":"false",...s,class:le.value},[i.h(i.Transition,{name:"q-transition--fade",appear:!0},()=>q.value===!0?i.h("div",{class:"q-dialog__backdrop fixed-full",style:Z.value,"aria-hidden":"true",tabindex:-1,onClick:ae}):null),i.h(i.Transition,N.value,()=>n.value===!0?i.h("div",{ref:d,class:oe.value,style:V.value,tabindex:-1,...ie.value},u.hSlot(t.default)):null)])}return te}});exports.QDialog=ge;
@@ -1 +0,0 @@
1
- "use strict";const a=require("vue"),W=require("./focusout-DzWGke-4.cjs"),v=require("./index-D2z9gMNY.cjs"),y=require("./escape-key-DG0KKsWF.cjs");let I,A=0;const x=new Array(256);for(let e=0;e<256;e++)x[e]=(e+256).toString(16).substring(1);const xe=(()=>{const e=typeof crypto<"u"?crypto:typeof window<"u"?window.crypto||window.msCrypto:void 0;if(e!==void 0){if(e.randomBytes!==void 0)return e.randomBytes;if(e.getRandomValues!==void 0)return t=>{const o=new Uint8Array(t);return e.getRandomValues(o),o}}return t=>{const o=[];for(let n=t;n>0;n--)o.push(Math.floor(Math.random()*256));return o}})(),G=4096;function _(){(I===void 0||A+16>G)&&(A=0,I=xe(G));const e=Array.prototype.slice.call(I,A,A+=16);return e[6]=e[6]&15|64,e[8]=e[8]&63|128,x[e[0]]+x[e[1]]+x[e[2]]+x[e[3]]+"-"+x[e[4]]+x[e[5]]+"-"+x[e[6]]+x[e[7]]+"-"+x[e[8]]+x[e[9]]+"-"+x[e[10]]+x[e[11]]+x[e[12]]+x[e[13]]+x[e[14]]+x[e[15]]}function ye(e){return e??null}function J(e,t){return e??(t===!0?`f_${_()}`:null)}function pe({getValue:e,required:t=!0}={}){if(W.isRuntimeSsrPreHydration.value===!0){const o=e!==void 0?a.ref(ye(e())):a.ref(null);return t===!0&&o.value===null&&a.onMounted(()=>{o.value=`f_${_()}`}),e!==void 0&&a.watch(e,n=>{o.value=J(n,t)}),o}return e!==void 0?a.computed(()=>J(e(),t)):a.ref(`f_${_()}`)}function be(){if(window.getSelection!==void 0){const e=window.getSelection();e.empty!==void 0?e.empty():e.removeAllRanges!==void 0&&(e.removeAllRanges(),W.Platform.is.mobile!==!0&&e.addRange(document.createRange()))}else document.selection!==void 0&&document.selection.empty()}const we={target:{type:[Boolean,String,Element],default:!0},noParentEvent:Boolean},Ee={...we,contextMenu:Boolean};function Te({showing:e,avoidEmit:t,configureAnchorEl:o}){const{props:n,proxy:i,emit:d}=a.getCurrentInstance(),l=a.ref(null);let h=null;function m(u){return l.value===null?!1:u===void 0||u.touches===void 0||u.touches.length<=1}const c={};o===void 0&&(Object.assign(c,{hide(u){i.hide(u)},toggle(u){i.toggle(u),u.qAnchorHandled=!0},toggleKey(u){v.isKeyCode(u,13)===!0&&c.toggle(u)},contextClick(u){i.hide(u),v.prevent(u),a.nextTick(()=>{i.show(u),u.qAnchorHandled=!0})},prevent:v.prevent,mobileTouch(u){if(c.mobileCleanup(u),m(u)!==!0)return;i.hide(u),l.value.classList.add("non-selectable");const s=u.target;v.addEvt(c,"anchor",[[s,"touchmove","mobileCleanup","passive"],[s,"touchend","mobileCleanup","passive"],[s,"touchcancel","mobileCleanup","passive"],[l.value,"contextmenu","prevent","notPassive"]]),h=setTimeout(()=>{h=null,i.show(u),u.qAnchorHandled=!0},300)},mobileCleanup(u){l.value.classList.remove("non-selectable"),h!==null&&(clearTimeout(h),h=null),e.value===!0&&u!==void 0&&be()}}),o=function(u=n.contextMenu){if(n.noParentEvent===!0||l.value===null)return;let s;u===!0?i.$q.platform.is.mobile===!0?s=[[l.value,"touchstart","mobileTouch","passive"]]:s=[[l.value,"mousedown","hide","passive"],[l.value,"contextmenu","contextClick","notPassive"]]:s=[[l.value,"click","toggle","passive"],[l.value,"keyup","toggleKey","passive"]],v.addEvt(c,"anchor",s)});function f(){v.cleanEvt(c,"anchor")}function b(u){for(l.value=u;l.value.classList.contains("q-anchor--skip");)l.value=l.value.parentNode;o()}function w(){if(n.target===!1||n.target===""||i.$el.parentNode===null)l.value=null;else if(n.target===!0)b(i.$el.parentNode);else{let u=n.target;if(typeof n.target=="string")try{u=document.querySelector(n.target)}catch{u=void 0}u!=null?(l.value=u.$el||u,o()):(l.value=null,console.error(`Anchor: target "${n.target}" not found`))}}return a.watch(()=>n.contextMenu,u=>{l.value!==null&&(f(),o(u))}),a.watch(()=>n.target,()=>{l.value!==null&&f(),w()}),a.watch(()=>n.noParentEvent,u=>{l.value!==null&&(u===!0?f():o())}),a.onMounted(()=>{w(),t!==!0&&n.modelValue===!0&&l.value===null&&d("update:modelValue",!1)}),a.onBeforeUnmount(()=>{h!==null&&clearTimeout(h),f()}),{anchorEl:l,canShow:m,anchorEvents:c}}function Se(e,t){const o=a.ref(null);let n;function i(h,m){const c=`${m!==void 0?"add":"remove"}EventListener`,f=m!==void 0?m:n;h!==window&&h[c]("scroll",f,v.listenOpts.passive),window[c]("scroll",f,v.listenOpts.passive),n=m}function d(){o.value!==null&&(i(o.value),o.value=null)}const l=a.watch(()=>e.noParentEvent,()=>{o.value!==null&&(d(),t())});return a.onBeforeUnmount(l),{localScrollTarget:o,unconfigureScrollTarget:d,changeScrollEvent:i}}const{notPassiveCapture:L}=v.listenOpts,H=[];function R(e){const t=e.target;if(t===void 0||t.nodeType===8||t.classList.contains("no-pointer-events")===!0)return;let o=v.portalProxyList.length-1;for(;o>=0;){const n=v.portalProxyList[o].$;if(n.type.name==="QTooltip"){o--;continue}if(n.type.name!=="QDialog")break;if(n.props.seamless!==!0)return;o--}for(let n=H.length-1;n>=0;n--){const i=H[n];if((i.anchorEl.value===null||i.anchorEl.value.contains(t)===!1)&&(t===document.body||i.innerRef.value!==null&&i.innerRef.value.contains(t)===!1))e.qClickOutside=!0,i.onClickOutside(e);else return}}function Ce(e){H.push(e),H.length===1&&(document.addEventListener("mousedown",R,L),document.addEventListener("touchstart",R,L))}function ee(e){const t=H.findIndex(o=>o===e);t!==-1&&(H.splice(t,1),H.length===0&&(document.removeEventListener("mousedown",R,L),document.removeEventListener("touchstart",R,L)))}let te,ne;function oe(e){const t=e.split(" ");return t.length!==2?!1:["top","center","bottom"].includes(t[0])!==!0?(console.error("Anchor/Self position must start with one of top/center/bottom"),!1):["left","middle","right","start","end"].includes(t[1])!==!0?(console.error("Anchor/Self position must end with one of left/middle/right/start/end"),!1):!0}function He(e){return e?!(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number"):!0}const j={"start#ltr":"left","start#rtl":"right","end#ltr":"right","end#rtl":"left"};["left","middle","right"].forEach(e=>{j[`${e}#ltr`]=e,j[`${e}#rtl`]=e});function ie(e,t){const o=e.split(" ");return{vertical:o[0],horizontal:j[`${o[1]}#${t===!0?"rtl":"ltr"}`]}}function Me(e,t){let{top:o,left:n,right:i,bottom:d,width:l,height:h}=e.getBoundingClientRect();return t!==void 0&&(o-=t[1],n-=t[0],d+=t[1],i+=t[0],l+=t[0],h+=t[1]),{top:o,bottom:d,height:h,left:n,right:i,width:l,middle:n+(i-n)/2,center:o+(d-o)/2}}function ke(e,t,o){let{top:n,left:i}=e.getBoundingClientRect();return n+=t.top,i+=t.left,o!==void 0&&(n+=o[1],i+=o[0]),{top:n,bottom:n+1,height:1,left:i,right:i+1,width:1,middle:i,center:n}}function Pe(e,t){return{top:0,center:t/2,bottom:t,left:0,middle:e/2,right:e}}function le(e,t,o,n){return{top:e[o.vertical]-t[n.vertical],left:e[o.horizontal]-t[n.horizontal]}}function ue(e,t=0){if(e.targetEl===null||e.anchorEl===null||t>5)return;if(e.targetEl.offsetHeight===0||e.targetEl.offsetWidth===0){setTimeout(()=>{ue(e,t+1)},10);return}const{targetEl:o,offset:n,anchorEl:i,anchorOrigin:d,selfOrigin:l,absoluteOffset:h,fit:m,cover:c,maxHeight:f,maxWidth:b}=e;if(W.client.is.ios===!0&&window.visualViewport!==void 0){const M=document.body.style,{offsetLeft:E,offsetTop:T}=window.visualViewport;E!==te&&(M.setProperty("--q-pe-left",E+"px"),te=E),T!==ne&&(M.setProperty("--q-pe-top",T+"px"),ne=T)}const{scrollLeft:w,scrollTop:u}=o,s=h===void 0?Me(i,c===!0?[0,0]:n):ke(i,h,n);Object.assign(o.style,{top:0,left:0,minWidth:null,minHeight:null,maxWidth:b,maxHeight:f,visibility:"visible"});const{offsetWidth:B,offsetHeight:k}=o,{elWidth:q,elHeight:$}=m===!0||c===!0?{elWidth:Math.max(s.width,B),elHeight:c===!0?Math.max(s.height,k):k}:{elWidth:B,elHeight:k};let p={maxWidth:b,maxHeight:f};(m===!0||c===!0)&&(p.minWidth=s.width+"px",c===!0&&(p.minHeight=s.height+"px")),Object.assign(o.style,p);const S=Pe(q,$);let g=le(s,S,d,l);if(h===void 0||n===void 0)O(g,s,S,d,l);else{const{top:M,left:E}=g;O(g,s,S,d,l);let T=!1;if(g.top!==M){T=!0;const C=2*n[1];s.center=s.top-=C,s.bottom-=C+2}if(g.left!==E){T=!0;const C=2*n[0];s.middle=s.left-=C,s.right-=C+2}T===!0&&(g=le(s,S,d,l),O(g,s,S,d,l))}p={top:g.top+"px",left:g.left+"px"},g.maxHeight!==void 0&&(p.maxHeight=g.maxHeight+"px",s.height>g.maxHeight&&(p.minHeight=p.maxHeight)),g.maxWidth!==void 0&&(p.maxWidth=g.maxWidth+"px",s.width>g.maxWidth&&(p.minWidth=p.maxWidth)),Object.assign(o.style,p),o.scrollTop!==u&&(o.scrollTop=u),o.scrollLeft!==w&&(o.scrollLeft=w)}function O(e,t,o,n,i){const d=o.bottom,l=o.right,h=y.getScrollbarWidth(),m=window.innerHeight-h,c=document.body.clientWidth;if(e.top<0||e.top+d>m)if(i.vertical==="center")e.top=t[n.vertical]>m/2?Math.max(0,m-d):0,e.maxHeight=Math.min(d,m);else if(t[n.vertical]>m/2){const f=Math.min(m,n.vertical==="center"?t.center:n.vertical===i.vertical?t.bottom:t.top);e.maxHeight=Math.min(d,f),e.top=Math.max(0,f-d)}else e.top=Math.max(0,n.vertical==="center"?t.center:n.vertical===i.vertical?t.top:t.bottom),e.maxHeight=Math.min(d,m-e.top);if(e.left<0||e.left+l>c)if(e.maxWidth=Math.min(l,c),i.horizontal==="middle")e.left=t[n.horizontal]>c/2?Math.max(0,c-l):0;else if(t[n.horizontal]>c/2){const f=Math.min(c,n.horizontal==="middle"?t.middle:n.horizontal===i.horizontal?t.right:t.left);e.maxWidth=Math.min(l,f),e.left=Math.max(0,f-e.maxWidth)}else e.left=Math.max(0,n.horizontal==="middle"?t.middle:n.horizontal===i.horizontal?t.left:t.right),e.maxWidth=Math.min(l,c-e.left)}const We=v.createComponent({name:"QMenu",inheritAttrs:!1,props:{...Ee,...y.useModelToggleProps,...v.useDarkProps,...y.useTransitionProps,persistent:Boolean,autoClose:Boolean,separateClosePopup:Boolean,noEscDismiss:Boolean,noRouteDismiss:Boolean,noRefocus:Boolean,noFocus:Boolean,fit:Boolean,cover:Boolean,square:Boolean,anchor:{type:String,validator:oe},self:{type:String,validator:oe},offset:{type:Array,validator:He},scrollTarget:y.scrollTargetProp,touchPosition:Boolean,maxHeight:{type:String,default:null},maxWidth:{type:String,default:null}},emits:[...y.useModelToggleEmits,"click","escapeKey"],setup(e,{slots:t,emit:o,attrs:n}){let i=null,d,l,h;const m=a.getCurrentInstance(),{proxy:c}=m,{$q:f}=c,b=a.ref(null),w=a.ref(!1),u=a.computed(()=>e.persistent!==!0&&e.noRouteDismiss!==!0),s=v.useDark(e,f),{registerTick:B,removeTick:k}=y.useTick(),{registerTimeout:q}=y.useTimeout(),{transitionProps:$,transitionStyle:p}=y.useTransition(e),{localScrollTarget:S,changeScrollEvent:g,unconfigureScrollTarget:M}=Se(e,Y),{anchorEl:E,canShow:T}=Te({showing:w}),{hide:C}=y.useModelToggle({showing:w,canShow:T,handleShow:de,handleHide:fe,hideOnRouteChange:u,processOnMount:!0}),{showPortal:Q,hidePortal:U,renderPortal:re}=y.usePortal(m,b,me,"menu"),F={anchorEl:E,innerRef:b,onClickOutside(r){if(e.persistent!==!0&&w.value===!0)return C(r),(r.type==="touchstart"||r.target.classList.contains("q-dialog__backdrop"))&&v.stopAndPrevent(r),!0}},N=a.computed(()=>ie(e.anchor||(e.cover===!0?"center middle":"bottom start"),f.lang.rtl)),ae=a.computed(()=>e.cover===!0?N.value:ie(e.self||"top start",f.lang.rtl)),se=a.computed(()=>(e.square===!0?" q-menu--square":"")+(s.value===!0?" q-menu--dark q-dark":"")),ce=a.computed(()=>e.autoClose===!0?{onClick:he}:{}),V=a.computed(()=>w.value===!0&&e.persistent!==!0);a.watch(V,r=>{r===!0?(y.addEscapeKey(D),Ce(F)):(y.removeEscapeKey(D),ee(F))});function z(){y.addFocusFn(()=>{let r=b.value;r&&r.contains(document.activeElement)!==!0&&(r=r.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]")||r.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]")||r.querySelector("[autofocus], [data-autofocus]")||r,r.focus({preventScroll:!0}))})}function de(r){if(i=e.noRefocus===!1?document.activeElement:null,W.addFocusout(Z),Q(),Y(),d=void 0,r!==void 0&&(e.touchPosition||e.contextMenu)){const K=v.position(r);if(K.left!==void 0){const{top:ve,left:ge}=E.value.getBoundingClientRect();d={left:K.left-ge,top:K.top-ve}}}l===void 0&&(l=a.watch(()=>f.screen.width+"|"+f.screen.height+"|"+e.self+"|"+e.anchor+"|"+f.lang.rtl,P)),e.noFocus!==!0&&document.activeElement.blur(),B(()=>{P(),e.noFocus!==!0&&z()}),q(()=>{f.platform.is.ios===!0&&(h=e.autoClose,b.value.click()),P(),Q(!0),o("show",r)},e.transitionDuration)}function fe(r){k(),U(),X(!0),i!==null&&(r===void 0||r.qClickOutside!==!0)&&((((r==null?void 0:r.type.indexOf("key"))===0?i.closest('[tabindex]:not([tabindex^="-"])'):void 0)||i).focus(),i=null),q(()=>{U(!0),o("hide",r)},e.transitionDuration)}function X(r){d=void 0,l!==void 0&&(l(),l=void 0),(r===!0||w.value===!0)&&(W.removeFocusout(Z),M(),ee(F),y.removeEscapeKey(D)),r!==!0&&(i=null)}function Y(){(E.value!==null||e.scrollTarget!==void 0)&&(S.value=y.getScrollTarget(E.value,e.scrollTarget),g(S.value,P))}function he(r){h!==!0?(v.closePortalMenus(c,r),o("click",r)):h=!1}function Z(r){V.value===!0&&e.noFocus!==!0&&v.childHasFocus(b.value,r.target)!==!0&&z()}function D(r){e.noEscDismiss!==!0&&(o("escapeKey"),C(r))}function P(){ue({targetEl:b.value,offset:e.offset,anchorEl:E.value,anchorOrigin:N.value,selfOrigin:ae.value,absoluteOffset:d,fit:e.fit,cover:e.cover,maxHeight:e.maxHeight,maxWidth:e.maxWidth})}function me(){return a.h(a.Transition,$.value,()=>w.value===!0?a.h("div",{role:"menu",...n,ref:b,tabindex:-1,class:["q-menu q-position-engine scroll"+se.value,n.class],style:[n.style,p.value],...ce.value},v.hSlot(t.default)):null)}return a.onBeforeUnmount(X),Object.assign(c,{focus:z,updatePosition:P}),re}});exports.QMenu=We;exports.useId=pe;