@descope/web-components-ui 1.0.39 → 1.0.41
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +35 -18
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1128 -481
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/101.js +148 -0
- package/dist/umd/208.js +2 -0
- package/dist/umd/208.js.LICENSE.txt +5 -0
- package/dist/umd/211.js +312 -0
- package/dist/umd/211.js.LICENSE.txt +5 -0
- package/dist/umd/233.js +573 -0
- package/dist/umd/{511.js.LICENSE.txt → 233.js.LICENSE.txt} +0 -6
- package/dist/umd/422.js +2 -0
- package/dist/umd/422.js.LICENSE.txt +5 -0
- package/dist/umd/437.js +19 -0
- package/dist/umd/437.js.LICENSE.txt +5 -0
- package/dist/umd/513.js +1 -0
- package/dist/umd/515.js +202 -0
- package/dist/umd/515.js.LICENSE.txt +11 -0
- package/dist/umd/54.js +4 -4
- package/dist/umd/56.js +48 -0
- package/dist/umd/56.js.LICENSE.txt +5 -0
- package/dist/umd/599.js +1 -1
- package/dist/umd/63.js +1 -0
- package/dist/umd/725.js +37 -0
- package/dist/umd/725.js.LICENSE.txt +11 -0
- package/dist/umd/729.js +1 -1
- package/dist/umd/767.js +2 -0
- package/dist/umd/{9.js.LICENSE.txt → 767.js.LICENSE.txt} +0 -6
- package/dist/umd/786.js +2 -0
- package/dist/umd/786.js.LICENSE.txt +17 -0
- package/dist/umd/789.js +1 -0
- package/dist/umd/806.js +109 -0
- package/dist/umd/806.js.LICENSE.txt +5 -0
- package/dist/umd/938.js +1 -0
- package/dist/umd/97.js +1 -1
- package/dist/umd/descope-button-index-js.js +1 -1
- package/dist/umd/descope-checkbox-index-js.js +1 -0
- package/dist/umd/descope-combo-index-js.js +1 -1
- package/dist/umd/descope-container-index-js.js +1 -1
- package/dist/umd/descope-email-field-index-js.js +1 -0
- package/dist/umd/descope-number-field-index-js.js +1 -0
- package/dist/umd/descope-password-field-index-js.js +1 -0
- package/dist/umd/descope-switch-toggle-index-js.js +1 -0
- package/dist/umd/descope-text-area-index-js.js +1 -0
- package/dist/umd/descope-text-field-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +9 -2
- package/src/components/descope-button/Button.js +90 -30
- package/src/components/descope-button/index.js +3 -3
- package/src/components/descope-checkbox/Checkbox.js +33 -0
- package/src/components/descope-checkbox/index.js +6 -0
- package/src/components/descope-combo/index.js +12 -12
- package/src/components/descope-container/Container.js +57 -51
- package/src/components/descope-container/index.js +1 -1
- package/src/components/descope-date-picker/index.js +13 -7
- package/src/components/descope-email-field/EmailField.js +72 -0
- package/src/components/descope-email-field/index.js +6 -0
- package/src/components/descope-number-field/NumberField.js +72 -0
- package/src/components/descope-number-field/index.js +6 -0
- package/src/components/descope-password-field/PasswordField.js +79 -0
- package/src/components/descope-password-field/index.js +6 -0
- package/src/components/descope-switch-toggle/SwitchToggle.js +81 -0
- package/src/components/descope-switch-toggle/index.js +6 -0
- package/src/components/descope-text-area/TextArea.js +66 -0
- package/src/components/descope-text-area/index.js +6 -0
- package/src/components/descope-text-field/TextField.js +98 -28
- package/src/components/descope-text-field/index.js +3 -3
- package/src/componentsHelpers/componentNameValidationMixin.js +21 -17
- package/src/componentsHelpers/createProxy/helpers.js +31 -27
- package/src/componentsHelpers/createProxy/index.js +27 -17
- package/src/componentsHelpers/createStyleMixin/helpers.js +65 -47
- package/src/componentsHelpers/createStyleMixin/index.js +64 -55
- package/src/componentsHelpers/draggableMixin.js +25 -26
- package/src/componentsHelpers/index.js +12 -9
- package/src/componentsHelpers/inputMixin.js +38 -37
- package/src/constants.js +1 -1
- package/src/dev/index.js +4 -3
- package/src/helpers.js +8 -6
- package/src/index.cjs.js +1 -1
- package/src/index.js +16 -8
- package/src/index.umd.js +11 -5
- package/src/theme/components/button.js +32 -21
- package/src/theme/components/checkbox.js +9 -0
- package/src/theme/components/container.js +32 -27
- package/src/theme/components/emailField.js +8 -0
- package/src/theme/components/index.js +19 -7
- package/src/theme/components/input.js +106 -0
- package/src/theme/components/numberField.js +8 -0
- package/src/theme/components/passwordField.js +11 -0
- package/src/theme/components/switchToggle.js +10 -0
- package/src/theme/components/textArea.js +44 -0
- package/src/theme/components/textField.js +69 -45
- package/src/theme/globals.js +27 -26
- package/src/theme/index.js +2 -2
- package/src/themeHelpers/index.js +45 -30
- package/src/themeHelpers/processColors.js +10 -7
- package/dist/umd/221.js +0 -37
- package/dist/umd/511.js +0 -573
- package/dist/umd/9.js +0 -312
- /package/dist/umd/{221.js.LICENSE.txt → 101.js.LICENSE.txt} +0 -0
package/dist/umd/9.js
DELETED
@@ -1,312 +0,0 @@
|
|
1
|
-
/*! For license information please see 9.js.LICENSE.txt */
|
2
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[9],{9765:(t,e,o)=>{var n=o(4241),i=o(6155),r=o(1402),s=o(4463),a=o(5128);const c=o(9897).iv`
|
3
|
-
:host {
|
4
|
-
display: inline-block;
|
5
|
-
position: relative;
|
6
|
-
outline: none;
|
7
|
-
white-space: nowrap;
|
8
|
-
-webkit-user-select: none;
|
9
|
-
-moz-user-select: none;
|
10
|
-
user-select: none;
|
11
|
-
}
|
12
|
-
|
13
|
-
:host([hidden]) {
|
14
|
-
display: none !important;
|
15
|
-
}
|
16
|
-
|
17
|
-
/* Aligns the button with form fields when placed on the same line.
|
18
|
-
Note, to make it work, the form fields should have the same "::before" pseudo-element. */
|
19
|
-
.vaadin-button-container::before {
|
20
|
-
content: '\\2003';
|
21
|
-
display: inline-block;
|
22
|
-
width: 0;
|
23
|
-
max-height: 100%;
|
24
|
-
}
|
25
|
-
|
26
|
-
.vaadin-button-container {
|
27
|
-
display: inline-flex;
|
28
|
-
align-items: center;
|
29
|
-
justify-content: center;
|
30
|
-
text-align: center;
|
31
|
-
width: 100%;
|
32
|
-
height: 100%;
|
33
|
-
min-height: inherit;
|
34
|
-
text-shadow: inherit;
|
35
|
-
}
|
36
|
-
|
37
|
-
[part='prefix'],
|
38
|
-
[part='suffix'] {
|
39
|
-
flex: none;
|
40
|
-
}
|
41
|
-
|
42
|
-
[part='label'] {
|
43
|
-
white-space: nowrap;
|
44
|
-
overflow: hidden;
|
45
|
-
text-overflow: ellipsis;
|
46
|
-
}
|
47
|
-
`;var l=o(1598),u=o(9109),h=o(602);const d=t=>class extends((0,l.f)((0,h.L)(t))){get _activeKeys(){return[" "]}ready(){super.ready(),(0,u.NH)(this,"down",(t=>{this._shouldSetActive(t)&&this._setActive(!0)})),(0,u.NH)(this,"up",(()=>{this._setActive(!1)}))}disconnectedCallback(){super.disconnectedCallback(),this._setActive(!1)}_shouldSetActive(t){return!this.disabled}_onKeyDown(t){super._onKeyDown(t),this._shouldSetActive(t)&&this._activeKeys.includes(t.key)&&(this._setActive(!0),document.addEventListener("keyup",(t=>{this._activeKeys.includes(t.key)&&this._setActive(!1)}),{once:!0}))}_setActive(t){this.toggleAttribute("active",t)}};var m=o(2527),f=o(4062);const p=t=>class extends(d((0,f.N)((0,m.W)(t)))){static get properties(){return{tabindex:{type:Number,value:0,reflectToAttribute:!0}}}get _activeKeys(){return["Enter"," "]}ready(){super.ready(),this.hasAttribute("role")||this.setAttribute("role","button")}_onKeyDown(t){super._onKeyDown(t),this._activeKeys.includes(t.key)&&(t.preventDefault(),this.click())}};(0,a.hC)("vaadin-button",c,{moduleId:"vaadin-button-styles"});class v extends(p((0,r.S)((0,a.Tb)((0,i.k)(n.H3))))){static get is(){return"vaadin-button"}static get template(){return n.dy`
|
48
|
-
<div class="vaadin-button-container">
|
49
|
-
<span part="prefix" aria-hidden="true">
|
50
|
-
<slot name="prefix"></slot>
|
51
|
-
</span>
|
52
|
-
<span part="label">
|
53
|
-
<slot></slot>
|
54
|
-
</span>
|
55
|
-
<span part="suffix" aria-hidden="true">
|
56
|
-
<slot name="suffix"></slot>
|
57
|
-
</span>
|
58
|
-
</div>
|
59
|
-
<slot name="tooltip"></slot>
|
60
|
-
`}ready(){super.ready(),this._tooltipController=new s.f(this),this.addController(this._tooltipController)}}customElements.define(v.is,v)},4599:(t,e,o)=>{o(1195),o(9098),o(9416),o(9849),o(4173);var n=o(5128);const i=n.iv`
|
61
|
-
:host {
|
62
|
-
/* Sizing */
|
63
|
-
--lumo-button-size: var(--lumo-size-m);
|
64
|
-
min-width: calc(var(--lumo-button-size) * 2);
|
65
|
-
height: var(--lumo-button-size);
|
66
|
-
padding: 0 calc(var(--lumo-button-size) / 3 + var(--lumo-border-radius-m) / 2);
|
67
|
-
margin: var(--lumo-space-xs) 0;
|
68
|
-
box-sizing: border-box;
|
69
|
-
/* Style */
|
70
|
-
font-family: var(--lumo-font-family);
|
71
|
-
font-size: var(--lumo-font-size-m);
|
72
|
-
font-weight: 500;
|
73
|
-
color: var(--_lumo-button-color, var(--lumo-primary-text-color));
|
74
|
-
background-color: var(--_lumo-button-background-color, var(--lumo-contrast-5pct));
|
75
|
-
border-radius: var(--lumo-border-radius-m);
|
76
|
-
cursor: var(--lumo-clickable-cursor);
|
77
|
-
-webkit-tap-highlight-color: transparent;
|
78
|
-
-webkit-font-smoothing: antialiased;
|
79
|
-
-moz-osx-font-smoothing: grayscale;
|
80
|
-
flex-shrink: 0;
|
81
|
-
}
|
82
|
-
|
83
|
-
/* Set only for the internal parts so we don't affect the host vertical alignment */
|
84
|
-
[part='label'],
|
85
|
-
[part='prefix'],
|
86
|
-
[part='suffix'] {
|
87
|
-
line-height: var(--lumo-line-height-xs);
|
88
|
-
}
|
89
|
-
|
90
|
-
[part='label'] {
|
91
|
-
padding: calc(var(--lumo-button-size) / 6) 0;
|
92
|
-
}
|
93
|
-
|
94
|
-
:host([theme~='small']) {
|
95
|
-
font-size: var(--lumo-font-size-s);
|
96
|
-
--lumo-button-size: var(--lumo-size-s);
|
97
|
-
}
|
98
|
-
|
99
|
-
:host([theme~='large']) {
|
100
|
-
font-size: var(--lumo-font-size-l);
|
101
|
-
--lumo-button-size: var(--lumo-size-l);
|
102
|
-
}
|
103
|
-
|
104
|
-
/* For interaction states */
|
105
|
-
:host::before,
|
106
|
-
:host::after {
|
107
|
-
content: '';
|
108
|
-
/* We rely on the host always being relative */
|
109
|
-
position: absolute;
|
110
|
-
z-index: 1;
|
111
|
-
top: 0;
|
112
|
-
right: 0;
|
113
|
-
bottom: 0;
|
114
|
-
left: 0;
|
115
|
-
background-color: currentColor;
|
116
|
-
border-radius: inherit;
|
117
|
-
opacity: 0;
|
118
|
-
pointer-events: none;
|
119
|
-
}
|
120
|
-
|
121
|
-
/* Hover */
|
122
|
-
|
123
|
-
@media (any-hover: hover) {
|
124
|
-
:host(:hover)::before {
|
125
|
-
opacity: 0.02;
|
126
|
-
}
|
127
|
-
}
|
128
|
-
|
129
|
-
/* Active */
|
130
|
-
|
131
|
-
:host::after {
|
132
|
-
transition: opacity 1.4s, transform 0.1s;
|
133
|
-
filter: blur(8px);
|
134
|
-
}
|
135
|
-
|
136
|
-
:host([active])::before {
|
137
|
-
opacity: 0.05;
|
138
|
-
transition-duration: 0s;
|
139
|
-
}
|
140
|
-
|
141
|
-
:host([active])::after {
|
142
|
-
opacity: 0.1;
|
143
|
-
transition-duration: 0s, 0s;
|
144
|
-
transform: scale(0);
|
145
|
-
}
|
146
|
-
|
147
|
-
/* Keyboard focus */
|
148
|
-
|
149
|
-
:host([focus-ring]) {
|
150
|
-
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
|
151
|
-
}
|
152
|
-
|
153
|
-
:host([theme~='primary'][focus-ring]) {
|
154
|
-
box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 3px var(--lumo-primary-color-50pct);
|
155
|
-
}
|
156
|
-
|
157
|
-
/* Types (primary, tertiary, tertiary-inline */
|
158
|
-
|
159
|
-
:host([theme~='tertiary']),
|
160
|
-
:host([theme~='tertiary-inline']) {
|
161
|
-
background-color: transparent !important;
|
162
|
-
min-width: 0;
|
163
|
-
}
|
164
|
-
|
165
|
-
:host([theme~='tertiary']) {
|
166
|
-
padding: 0 calc(var(--lumo-button-size) / 6);
|
167
|
-
}
|
168
|
-
|
169
|
-
:host([theme~='tertiary-inline'])::before {
|
170
|
-
display: none;
|
171
|
-
}
|
172
|
-
|
173
|
-
:host([theme~='tertiary-inline']) {
|
174
|
-
margin: 0;
|
175
|
-
height: auto;
|
176
|
-
padding: 0;
|
177
|
-
line-height: inherit;
|
178
|
-
font-size: inherit;
|
179
|
-
}
|
180
|
-
|
181
|
-
:host([theme~='tertiary-inline']) [part='label'] {
|
182
|
-
padding: 0;
|
183
|
-
overflow: visible;
|
184
|
-
line-height: inherit;
|
185
|
-
}
|
186
|
-
|
187
|
-
:host([theme~='primary']) {
|
188
|
-
background-color: var(--_lumo-button-primary-background-color, var(--lumo-primary-color));
|
189
|
-
color: var(--_lumo-button-primary-color, var(--lumo-primary-contrast-color));
|
190
|
-
font-weight: 600;
|
191
|
-
min-width: calc(var(--lumo-button-size) * 2.5);
|
192
|
-
}
|
193
|
-
|
194
|
-
:host([theme~='primary'])::before {
|
195
|
-
background-color: black;
|
196
|
-
}
|
197
|
-
|
198
|
-
@media (any-hover: hover) {
|
199
|
-
:host([theme~='primary']:hover)::before {
|
200
|
-
opacity: 0.05;
|
201
|
-
}
|
202
|
-
}
|
203
|
-
|
204
|
-
:host([theme~='primary'][active])::before {
|
205
|
-
opacity: 0.1;
|
206
|
-
}
|
207
|
-
|
208
|
-
:host([theme~='primary'][active])::after {
|
209
|
-
opacity: 0.2;
|
210
|
-
}
|
211
|
-
|
212
|
-
/* Colors (success, error, contrast) */
|
213
|
-
|
214
|
-
:host([theme~='success']) {
|
215
|
-
color: var(--lumo-success-text-color);
|
216
|
-
}
|
217
|
-
|
218
|
-
:host([theme~='success'][theme~='primary']) {
|
219
|
-
background-color: var(--lumo-success-color);
|
220
|
-
color: var(--lumo-success-contrast-color);
|
221
|
-
}
|
222
|
-
|
223
|
-
:host([theme~='error']) {
|
224
|
-
color: var(--lumo-error-text-color);
|
225
|
-
}
|
226
|
-
|
227
|
-
:host([theme~='error'][theme~='primary']) {
|
228
|
-
background-color: var(--lumo-error-color);
|
229
|
-
color: var(--lumo-error-contrast-color);
|
230
|
-
}
|
231
|
-
|
232
|
-
:host([theme~='contrast']) {
|
233
|
-
color: var(--lumo-contrast);
|
234
|
-
}
|
235
|
-
|
236
|
-
:host([theme~='contrast'][theme~='primary']) {
|
237
|
-
background-color: var(--lumo-contrast);
|
238
|
-
color: var(--lumo-base-color);
|
239
|
-
}
|
240
|
-
|
241
|
-
/* Disabled state. Keep selectors after other color variants. */
|
242
|
-
|
243
|
-
:host([disabled]) {
|
244
|
-
pointer-events: none;
|
245
|
-
color: var(--lumo-disabled-text-color);
|
246
|
-
}
|
247
|
-
|
248
|
-
:host([theme~='primary'][disabled]) {
|
249
|
-
background-color: var(--lumo-contrast-30pct);
|
250
|
-
color: var(--lumo-base-color);
|
251
|
-
}
|
252
|
-
|
253
|
-
:host([theme~='primary'][disabled]) [part] {
|
254
|
-
opacity: 0.7;
|
255
|
-
}
|
256
|
-
|
257
|
-
/* Icons */
|
258
|
-
|
259
|
-
[part] ::slotted(vaadin-icon) {
|
260
|
-
display: inline-block;
|
261
|
-
width: var(--lumo-icon-size-m);
|
262
|
-
height: var(--lumo-icon-size-m);
|
263
|
-
}
|
264
|
-
|
265
|
-
/* Vaadin icons are based on a 16x16 grid (unlike Lumo and Material icons with 24x24), so they look too big by default */
|
266
|
-
[part] ::slotted(vaadin-icon[icon^='vaadin:']) {
|
267
|
-
padding: 0.25em;
|
268
|
-
box-sizing: border-box !important;
|
269
|
-
}
|
270
|
-
|
271
|
-
[part='prefix'] {
|
272
|
-
margin-left: -0.25em;
|
273
|
-
margin-right: 0.25em;
|
274
|
-
}
|
275
|
-
|
276
|
-
[part='suffix'] {
|
277
|
-
margin-left: 0.25em;
|
278
|
-
margin-right: -0.25em;
|
279
|
-
}
|
280
|
-
|
281
|
-
/* Icon-only */
|
282
|
-
|
283
|
-
:host([theme~='icon']:not([theme~='tertiary-inline'])) {
|
284
|
-
min-width: var(--lumo-button-size);
|
285
|
-
padding-left: calc(var(--lumo-button-size) / 4);
|
286
|
-
padding-right: calc(var(--lumo-button-size) / 4);
|
287
|
-
}
|
288
|
-
|
289
|
-
:host([theme~='icon']) [part='prefix'],
|
290
|
-
:host([theme~='icon']) [part='suffix'] {
|
291
|
-
margin-left: 0;
|
292
|
-
margin-right: 0;
|
293
|
-
}
|
294
|
-
|
295
|
-
/* RTL specific styles */
|
296
|
-
|
297
|
-
:host([dir='rtl']) [part='prefix'] {
|
298
|
-
margin-left: 0.25em;
|
299
|
-
margin-right: -0.25em;
|
300
|
-
}
|
301
|
-
|
302
|
-
:host([dir='rtl']) [part='suffix'] {
|
303
|
-
margin-left: -0.25em;
|
304
|
-
margin-right: 0.25em;
|
305
|
-
}
|
306
|
-
|
307
|
-
:host([dir='rtl'][theme~='icon']) [part='prefix'],
|
308
|
-
:host([dir='rtl'][theme~='icon']) [part='suffix'] {
|
309
|
-
margin-left: 0;
|
310
|
-
margin-right: 0;
|
311
|
-
}
|
312
|
-
`;(0,n.hC)("vaadin-button",i,{moduleId:"lumo-button"}),o(9765)},9109:(t,e,o)=>{o.d(e,{BP:()=>M,NH:()=>N});var n=o(7913);const i=!1,r=t=>t,s="string"==typeof document.head.style.touchAction,a="__polymerGestures",c="__polymerGesturesHandled",l="__polymerGesturesTouchAction",u=["mousedown","mousemove","mouseup","click"],h=[0,1,4,2],d=function(){try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(t){return!1}}();function m(t){return u.indexOf(t)>-1}let f=!1;function p(t){if(!m(t)&&"touchend"!==t)return s&&f&&i?{passive:!0}:void 0}!function(){try{const t=Object.defineProperty({},"passive",{get(){f=!0}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(t){}}();const v=navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/u),y={button:!0,command:!0,fieldset:!0,input:!0,keygen:!0,optgroup:!0,option:!0,select:!0,textarea:!0};function b(t){const e=t.type;if(!m(e))return!1;if("mousemove"===e){let e=void 0===t.buttons?1:t.buttons;return t instanceof window.MouseEvent&&!d&&(e=h[t.which]||0),Boolean(1&e)}return 0===(void 0===t.button?0:t.button)}const g={mouse:{target:null,mouseIgnoreJob:null},touch:{x:0,y:0,id:-1,scrollDecided:!1}};function x(t,e,o){t.movefn=e,t.upfn=o,document.addEventListener("mousemove",e),document.addEventListener("mouseup",o)}function w(t){document.removeEventListener("mousemove",t.movefn),document.removeEventListener("mouseup",t.upfn),t.movefn=null,t.upfn=null}const k=window.ShadyDOM&&window.ShadyDOM.noPatch?window.ShadyDOM.composedPath:t=>t.composedPath&&t.composedPath()||[],_={},z=[];function A(t){const e=k(t);return e.length>0?e[0]:t.target}function E(t){const e=t.type,o=t.currentTarget[a];if(!o)return;const n=o[e];if(!n)return;if(!t[c]&&(t[c]={},e.startsWith("touch"))){const o=t.changedTouches[0];if("touchstart"===e&&1===t.touches.length&&(g.touch.id=o.identifier),g.touch.id!==o.identifier)return;s||"touchstart"!==e&&"touchmove"!==e||function(t){const e=t.changedTouches[0],o=t.type;if("touchstart"===o)g.touch.x=e.clientX,g.touch.y=e.clientY,g.touch.scrollDecided=!1;else if("touchmove"===o){if(g.touch.scrollDecided)return;g.touch.scrollDecided=!0;const o=function(t){let e="auto";const o=k(t);for(let t,n=0;n<o.length;n++)if(t=o[n],t[l]){e=t[l];break}return e}(t);let n=!1;const i=Math.abs(g.touch.x-e.clientX),r=Math.abs(g.touch.y-e.clientY);t.cancelable&&("none"===o?n=!0:"pan-x"===o?n=r>i:"pan-y"===o&&(n=i>r)),n?t.preventDefault():Y("track")}}(t)}const i=t[c];if(!i.skip){for(let e,o=0;o<z.length;o++)e=z[o],n[e.name]&&!i[e.name]&&e.flow&&e.flow.start.indexOf(t.type)>-1&&e.reset&&e.reset();for(let o,r=0;r<z.length;r++)o=z[r],n[o.name]&&!i[o.name]&&(i[o.name]=!0,o[e](t))}}function N(t,e,o){return!!_[e]&&(function(t,e,o){const n=_[e],i=n.deps,r=n.name;let s=t[a];s||(t[a]=s={});for(let e,o,n=0;n<i.length;n++)e=i[n],v&&m(e)&&"click"!==e||(o=s[e],o||(s[e]=o={_count:0}),0===o._count&&t.addEventListener(e,E,p(e)),o[r]=(o[r]||0)+1,o._count=(o._count||0)+1);t.addEventListener(e,o),n.touchAction&&M(t,n.touchAction)}(t,e,o),!0)}function D(t){z.push(t),t.emits.forEach((e=>{_[e]=t}))}function M(t,e){s&&t instanceof HTMLElement&&n.YA.run((()=>{t.style.touchAction=e})),t[l]=e}function T(t,e,o){const n=new Event(e,{bubbles:!0,cancelable:!0,composed:!0});if(n.detail=o,r(t).dispatchEvent(n),n.defaultPrevented){const t=o.preventer||o.sourceEvent;t&&t.preventDefault&&t.preventDefault()}}function Y(t){const e=function(t){for(let e,o=0;o<z.length;o++){e=z[o];for(let o,n=0;n<e.emits.length;n++)if(o=e.emits[n],o===t)return e}return null}(t);e.info&&(e.info.prevent=!0)}function X(t,e,o,n){e&&T(e,t,{x:o.clientX,y:o.clientY,sourceEvent:o,preventer:n,prevent:t=>Y(t)})}function L(t,e,o){if(t.prevent)return!1;if(t.started)return!0;const n=Math.abs(t.x-e),i=Math.abs(t.y-o);return n>=5||i>=5}function C(t,e,o){if(!e)return;const n=t.moves[t.moves.length-2],i=t.moves[t.moves.length-1],r=i.x-t.x,s=i.y-t.y;let a,c=0;n&&(a=i.x-n.x,c=i.y-n.y),T(e,"track",{state:t.state,x:o.clientX,y:o.clientY,dx:r,dy:s,ddx:a,ddy:c,sourceEvent:o,hover:()=>function(t,e){let o=document.elementFromPoint(t,e),n=o;for(;n&&n.shadowRoot&&!window.ShadyDOM;){const i=n;if(n=n.shadowRoot.elementFromPoint(t,e),i===n)break;n&&(o=n)}return o}(o.clientX,o.clientY)})}function K(t,e,o){const n=Math.abs(e.clientX-t.x),i=Math.abs(e.clientY-t.y),r=A(o||e);!r||y[r.localName]&&r.hasAttribute("disabled")||(isNaN(n)||isNaN(i)||n<=25&&i<=25||function(t){if("click"===t.type){if(0===t.detail)return!0;const e=A(t);if(!e.nodeType||e.nodeType!==Node.ELEMENT_NODE)return!0;const o=e.getBoundingClientRect(),n=t.pageX,i=t.pageY;return!(n>=o.left&&n<=o.right&&i>=o.top&&i<=o.bottom)}return!1}(e))&&(t.prevent||T(r,"tap",{x:e.clientX,y:e.clientY,sourceEvent:e,preventer:o}))}D({name:"downup",deps:["mousedown","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["down","up"],info:{movefn:null,upfn:null},reset(){w(this.info)},mousedown(t){if(!b(t))return;const e=A(t),o=this;x(this.info,(t=>{b(t)||(X("up",e,t),w(o.info))}),(t=>{b(t)&&X("up",e,t),w(o.info)})),X("down",e,t)},touchstart(t){X("down",A(t),t.changedTouches[0],t)},touchend(t){X("up",A(t),t.changedTouches[0],t)}}),D({name:"track",touchAction:"none",deps:["mousedown","touchstart","touchmove","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["track"],info:{x:0,y:0,state:"start",started:!1,moves:[],addMove(t){this.moves.length>2&&this.moves.shift(),this.moves.push(t)},movefn:null,upfn:null,prevent:!1},reset(){this.info.state="start",this.info.started=!1,this.info.moves=[],this.info.x=0,this.info.y=0,this.info.prevent=!1,w(this.info)},mousedown(t){if(!b(t))return;const e=A(t),o=this,n=t=>{const n=t.clientX,i=t.clientY;L(o.info,n,i)&&(o.info.state=o.info.started?"mouseup"===t.type?"end":"track":"start","start"===o.info.state&&Y("tap"),o.info.addMove({x:n,y:i}),b(t)||(o.info.state="end",w(o.info)),e&&C(o.info,e,t),o.info.started=!0)};x(this.info,n,(t=>{o.info.started&&n(t),w(o.info)})),this.info.x=t.clientX,this.info.y=t.clientY},touchstart(t){const e=t.changedTouches[0];this.info.x=e.clientX,this.info.y=e.clientY},touchmove(t){const e=A(t),o=t.changedTouches[0],n=o.clientX,i=o.clientY;L(this.info,n,i)&&("start"===this.info.state&&Y("tap"),this.info.addMove({x:n,y:i}),C(this.info,e,o),this.info.state="track",this.info.started=!0)},touchend(t){const e=A(t),o=t.changedTouches[0];this.info.started&&(this.info.state="end",this.info.addMove({x:o.clientX,y:o.clientY}),C(this.info,e,o))}}),D({name:"tap",deps:["mousedown","click","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["click","touchend"]},emits:["tap"],info:{x:NaN,y:NaN,prevent:!1},reset(){this.info.x=NaN,this.info.y=NaN,this.info.prevent=!1},mousedown(t){b(t)&&(this.info.x=t.clientX,this.info.y=t.clientY)},click(t){b(t)&&K(this.info,t)},touchstart(t){const e=t.changedTouches[0];this.info.x=e.clientX,this.info.y=e.clientY},touchend(t){K(this.info,t.changedTouches[0],t)}})}}]);
|
File without changes
|