@everymatrix/general-input 1.22.1 → 1.22.2

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,297 +1,4 @@
1
- import { o, i, h as html, P as PolymerElement, y as registerStyles$1, r as requiredField, g as helper, d as dedupingMixin, I as InputMixin, K as KeyboardMixin, D as DelegateStateMixin, V as ValidateMixin, c as DelegateFocusMixin, F as FieldMixin } from './field-mixin.js';
2
-
3
- /**
4
- * @license
5
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
6
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
7
- */
8
- /**
9
- * @polymerMixin
10
- */
11
- const ThemePropertyMixin = (superClass) =>
12
- class VaadinThemePropertyMixin extends superClass {
13
- static get properties() {
14
- return {
15
- /**
16
- * Helper property with theme attribute value facilitating propagation
17
- * in shadow DOM.
18
- *
19
- * Enables the component implementation to propagate the `theme`
20
- * attribute value to the sub-components in Shadow DOM by binding
21
- * the sub-component's "theme" attribute to the `theme` property of
22
- * the host.
23
- *
24
- * **NOTE:** Extending the mixin only provides the property for binding,
25
- * and does not make the propagation alone.
26
- *
27
- * See [Styling Components: Sub-components](https://vaadin.com/docs/latest/styling/styling-components/#sub-components).
28
- * page for more information.
29
- *
30
- * @protected
31
- */
32
- _theme: {
33
- type: String,
34
- readOnly: true,
35
- },
36
- };
37
- }
38
-
39
- static get observedAttributes() {
40
- return [...super.observedAttributes, 'theme'];
41
- }
42
-
43
- /** @protected */
44
- attributeChangedCallback(name, oldValue, newValue) {
45
- super.attributeChangedCallback(name, oldValue, newValue);
46
-
47
- if (name === 'theme') {
48
- this._set_theme(newValue);
49
- }
50
- }
51
- };
52
-
53
- /**
54
- * @license
55
- * Copyright (c) 2017 - 2023 Vaadin Ltd.
56
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
57
- */
58
-
59
- /**
60
- * @typedef {Object} Theme
61
- * @property {string} themeFor
62
- * @property {CSSResult[]} styles
63
- * @property {string | string[]} [include]
64
- * @property {string} [moduleId]
65
- *
66
- * @typedef {CSSResult[] | CSSResult} CSSResultGroup
67
- */
68
-
69
- /**
70
- * @type {Theme[]}
71
- */
72
- const themeRegistry = [];
73
-
74
- /**
75
- * Check if the custom element type has themes applied.
76
- * @param {Function} elementClass
77
- * @returns {boolean}
78
- */
79
- function classHasThemes(elementClass) {
80
- return elementClass && Object.prototype.hasOwnProperty.call(elementClass, '__themes');
81
- }
82
-
83
- /**
84
- * Check if the custom element type has themes applied.
85
- * @param {string} tagName
86
- * @returns {boolean}
87
- */
88
- function hasThemes(tagName) {
89
- return classHasThemes(customElements.get(tagName));
90
- }
91
-
92
- /**
93
- * Flattens the styles into a single array of styles.
94
- * @param {CSSResultGroup} styles
95
- * @param {CSSResult[]} result
96
- * @returns {CSSResult[]}
97
- */
98
- function flattenStyles(styles = []) {
99
- return [styles].flat(Infinity).filter((style) => {
100
- if (style instanceof o) {
101
- return true;
102
- }
103
- console.warn('An item in styles is not of type CSSResult. Use `unsafeCSS` or `css`.');
104
- return false;
105
- });
106
- }
107
-
108
- /**
109
- * Registers CSS styles for a component type. Make sure to register the styles before
110
- * the first instance of a component of the type is attached to DOM.
111
- *
112
- * @param {string} themeFor The local/tag name of the component type to register the styles for
113
- * @param {CSSResultGroup} styles The CSS style rules to be registered for the component type
114
- * matching themeFor and included in the local scope of each component instance
115
- * @param {{moduleId?: string, include?: string | string[]}} options Additional options
116
- * @return {void}
117
- */
118
- function registerStyles(themeFor, styles, options = {}) {
119
- if (themeFor) {
120
- if (hasThemes(themeFor)) {
121
- console.warn(`The custom element definition for "${themeFor}"
122
- was finalized before a style module was registered.
123
- Make sure to add component specific style modules before
124
- importing the corresponding custom element.`);
125
- }
126
- }
127
-
128
- styles = flattenStyles(styles);
129
-
130
- if (window.Vaadin && window.Vaadin.styleModules) {
131
- window.Vaadin.styleModules.registerStyles(themeFor, styles, options);
132
- } else {
133
- themeRegistry.push({
134
- themeFor,
135
- styles,
136
- include: options.include,
137
- moduleId: options.moduleId,
138
- });
139
- }
140
- }
141
-
142
- /**
143
- * Returns all registered themes. By default the themeRegistry is returned as is.
144
- * In case the style-modules adapter is imported, the themes are obtained from there instead
145
- * @returns {Theme[]}
146
- */
147
- function getAllThemes() {
148
- if (window.Vaadin && window.Vaadin.styleModules) {
149
- return window.Vaadin.styleModules.getAllThemes();
150
- }
151
- return themeRegistry;
152
- }
153
-
154
- /**
155
- * Returns true if the themeFor string matches the tag name
156
- * @param {string} themeFor
157
- * @param {string} tagName
158
- * @returns {boolean}
159
- */
160
- function matchesThemeFor(themeFor, tagName) {
161
- return (themeFor || '').split(' ').some((themeForToken) => {
162
- return new RegExp(`^${themeForToken.split('*').join('.*')}$`, 'u').test(tagName);
163
- });
164
- }
165
-
166
- /**
167
- * Maps the moduleName to an include priority number which is used for
168
- * determining the order in which styles are applied.
169
- * @param {string} moduleName
170
- * @returns {number}
171
- */
172
- function getIncludePriority(moduleName = '') {
173
- let includePriority = 0;
174
- if (moduleName.startsWith('lumo-') || moduleName.startsWith('material-')) {
175
- includePriority = 1;
176
- } else if (moduleName.startsWith('vaadin-')) {
177
- includePriority = 2;
178
- }
179
- return includePriority;
180
- }
181
-
182
- /**
183
- * Gets an array of CSSResults matching the include property of the theme.
184
- * @param {Theme} theme
185
- * @returns {CSSResult[]}
186
- */
187
- function getIncludedStyles(theme) {
188
- const includedStyles = [];
189
- if (theme.include) {
190
- [].concat(theme.include).forEach((includeModuleId) => {
191
- const includedTheme = getAllThemes().find((s) => s.moduleId === includeModuleId);
192
- if (includedTheme) {
193
- includedStyles.push(...getIncludedStyles(includedTheme), ...includedTheme.styles);
194
- } else {
195
- console.warn(`Included moduleId ${includeModuleId} not found in style registry`);
196
- }
197
- }, theme.styles);
198
- }
199
- return includedStyles;
200
- }
201
-
202
- /**
203
- * Includes the styles to the template.
204
- * @param {CSSResult[]} styles
205
- * @param {HTMLTemplateElement} template
206
- */
207
- function addStylesToTemplate(styles, template) {
208
- const styleEl = document.createElement('style');
209
- styleEl.innerHTML = styles.map((style) => style.cssText).join('\n');
210
- template.content.appendChild(styleEl);
211
- }
212
-
213
- /**
214
- * Returns an array of themes that should be used for styling a component matching
215
- * the tag name. The array is sorted by the include order.
216
- * @param {string} tagName
217
- * @returns {Theme[]}
218
- */
219
- function getThemes(tagName) {
220
- const defaultModuleName = `${tagName}-default-theme`;
221
-
222
- const themes = getAllThemes()
223
- // Filter by matching themeFor properties
224
- .filter((theme) => theme.moduleId !== defaultModuleName && matchesThemeFor(theme.themeFor, tagName))
225
- .map((theme) => ({
226
- ...theme,
227
- // Prepend styles from included themes
228
- styles: [...getIncludedStyles(theme), ...theme.styles],
229
- // Map moduleId to includePriority
230
- includePriority: getIncludePriority(theme.moduleId),
231
- }))
232
- // Sort by includePriority
233
- .sort((themeA, themeB) => themeB.includePriority - themeA.includePriority);
234
-
235
- if (themes.length > 0) {
236
- return themes;
237
- }
238
- // No theme modules found, return the default module if it exists
239
- return getAllThemes().filter((theme) => theme.moduleId === defaultModuleName);
240
- }
241
-
242
- /**
243
- * @polymerMixin
244
- * @mixes ThemePropertyMixin
245
- */
246
- const ThemableMixin = (superClass) =>
247
- class VaadinThemableMixin extends ThemePropertyMixin(superClass) {
248
- /**
249
- * Covers PolymerElement based component styling
250
- * @protected
251
- */
252
- static finalize() {
253
- super.finalize();
254
-
255
- // Make sure not to run the logic intended for PolymerElement when LitElement is used.
256
- if (this.elementStyles) {
257
- return;
258
- }
259
-
260
- const template = this.prototype._template;
261
- if (!template || classHasThemes(this)) {
262
- return;
263
- }
264
-
265
- addStylesToTemplate(this.getStylesForThis(), template);
266
- }
267
-
268
- /**
269
- * Covers LitElement based component styling
270
- *
271
- * @protected
272
- */
273
- static finalizeStyles(styles) {
274
- // The "styles" object originates from the "static get styles()" function of
275
- // a LitElement based component. The theme styles are added after it
276
- // so that they can override the component styles.
277
- const themeStyles = this.getStylesForThis();
278
- return styles ? [...super.finalizeStyles(styles), ...themeStyles] : themeStyles;
279
- }
280
-
281
- /**
282
- * Get styles for the component type
283
- *
284
- * @private
285
- */
286
- static getStylesForThis() {
287
- const parent = Object.getPrototypeOf(this.prototype);
288
- const inheritedThemes = (parent ? parent.constructor.__themes : []) || [];
289
- this.__themes = [...inheritedThemes, ...getThemes(this.is)];
290
- const themeStyles = this.__themes.flatMap((theme) => theme.styles);
291
- // Remove duplicates
292
- return themeStyles.filter((style, index) => index === themeStyles.lastIndexOf(style));
293
- }
294
- };
1
+ import { r as registerStyles, i, g as defineCustomElement, j as ThemableMixin, o as DirMixin, P as PolymerElement, h as html, k as requiredField, l as helper, d as dedupingMixin, I as InputMixin, K as KeyboardMixin, D as DelegateStateMixin, V as ValidateMixin, c as DelegateFocusMixin, F as FieldMixin, p as Debouncer, t as timeOut } from './field-mixin.js';
295
2
 
296
3
  registerStyles(
297
4
  'vaadin-input-container',
@@ -466,174 +173,6 @@ registerStyles(
466
173
  { moduleId: 'lumo-input-container' },
467
174
  );
468
175
 
469
- /**
470
- * @license
471
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
472
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
473
- */
474
- function defineCustomElement(CustomElement) {
475
- const defined = customElements.get(CustomElement.is);
476
- if (!defined) {
477
- customElements.define(CustomElement.is, CustomElement);
478
- } else {
479
- const definedVersion = defined.version;
480
- if (definedVersion && CustomElement.version && definedVersion === CustomElement.version) {
481
- // Just loading the same thing again
482
- console.warn(`The component ${CustomElement.is} has been loaded twice`);
483
- } else {
484
- console.error(
485
- `Tried to define ${CustomElement.is} version ${CustomElement.version} when version ${defined.version} is already in use. Something will probably break.`,
486
- );
487
- }
488
- }
489
- }
490
-
491
- /**
492
- * @license
493
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
494
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
495
- */
496
-
497
- /**
498
- * Array of Vaadin custom element classes that have been subscribed to the dir changes.
499
- */
500
- const directionSubscribers = [];
501
-
502
- function alignDirs(element, documentDir, elementDir = element.getAttribute('dir')) {
503
- if (documentDir) {
504
- element.setAttribute('dir', documentDir);
505
- } else if (elementDir != null) {
506
- element.removeAttribute('dir');
507
- }
508
- }
509
-
510
- function getDocumentDir() {
511
- return document.documentElement.getAttribute('dir');
512
- }
513
-
514
- function directionUpdater() {
515
- const documentDir = getDocumentDir();
516
- directionSubscribers.forEach((element) => {
517
- alignDirs(element, documentDir);
518
- });
519
- }
520
-
521
- const directionObserver = new MutationObserver(directionUpdater);
522
- directionObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['dir'] });
523
-
524
- /**
525
- * A mixin to handle `dir` attribute based on the one set on the `<html>` element.
526
- *
527
- * @polymerMixin
528
- */
529
- const DirMixin = (superClass) =>
530
- class VaadinDirMixin extends superClass {
531
- static get properties() {
532
- return {
533
- /**
534
- * @protected
535
- */
536
- dir: {
537
- type: String,
538
- value: '',
539
- reflectToAttribute: true,
540
- converter: {
541
- fromAttribute: (attr) => {
542
- return !attr ? '' : attr;
543
- },
544
- toAttribute: (prop) => {
545
- return prop === '' ? null : prop;
546
- },
547
- },
548
- },
549
- };
550
- }
551
-
552
- /**
553
- * @return {boolean}
554
- * @protected
555
- */
556
- get __isRTL() {
557
- return this.getAttribute('dir') === 'rtl';
558
- }
559
-
560
- /** @protected */
561
- connectedCallback() {
562
- super.connectedCallback();
563
-
564
- if (!this.hasAttribute('dir') || this.__restoreSubscription) {
565
- this.__subscribe();
566
- alignDirs(this, getDocumentDir(), null);
567
- }
568
- }
569
-
570
- /** @protected */
571
- attributeChangedCallback(name, oldValue, newValue) {
572
- super.attributeChangedCallback(name, oldValue, newValue);
573
- if (name !== 'dir') {
574
- return;
575
- }
576
-
577
- const documentDir = getDocumentDir();
578
-
579
- // New value equals to the document direction and the element is not subscribed to the changes
580
- const newValueEqlDocDir = newValue === documentDir && directionSubscribers.indexOf(this) === -1;
581
- // Value was emptied and the element is not subscribed to the changes
582
- const newValueEmptied = !newValue && oldValue && directionSubscribers.indexOf(this) === -1;
583
- // New value is different and the old equals to document direction and the element is not subscribed to the changes
584
- const newDiffValue = newValue !== documentDir && oldValue === documentDir;
585
-
586
- if (newValueEqlDocDir || newValueEmptied) {
587
- this.__subscribe();
588
- alignDirs(this, documentDir, newValue);
589
- } else if (newDiffValue) {
590
- this.__unsubscribe();
591
- }
592
- }
593
-
594
- /** @protected */
595
- disconnectedCallback() {
596
- super.disconnectedCallback();
597
- this.__restoreSubscription = directionSubscribers.includes(this);
598
- this.__unsubscribe();
599
- }
600
-
601
- /** @protected */
602
- _valueToNodeAttribute(node, value, attribute) {
603
- // Override default Polymer attribute reflection to match native behavior of HTMLElement.dir property
604
- // If the property contains an empty string then it should not create an empty attribute
605
- if (attribute === 'dir' && value === '' && !node.hasAttribute('dir')) {
606
- return;
607
- }
608
- super._valueToNodeAttribute(node, value, attribute);
609
- }
610
-
611
- /** @protected */
612
- _attributeToProperty(attribute, value, type) {
613
- // Override default Polymer attribute reflection to match native behavior of HTMLElement.dir property
614
- // If the attribute is removed, then the dir property should contain an empty string instead of null
615
- if (attribute === 'dir' && !value) {
616
- this.dir = '';
617
- } else {
618
- super._attributeToProperty(attribute, value, type);
619
- }
620
- }
621
-
622
- /** @private */
623
- __subscribe() {
624
- if (!directionSubscribers.includes(this)) {
625
- directionSubscribers.push(this);
626
- }
627
- }
628
-
629
- /** @private */
630
- __unsubscribe() {
631
- if (directionSubscribers.includes(this)) {
632
- directionSubscribers.splice(directionSubscribers.indexOf(this), 1);
633
- }
634
- }
635
- };
636
-
637
176
  /**
638
177
  * @license
639
178
  * Copyright (c) 2021 - 2023 Vaadin Ltd.
@@ -813,7 +352,7 @@ const fieldButton = i`
813
352
  display: block;
814
353
  }
815
354
  `;
816
- registerStyles$1('', fieldButton, { moduleId: 'lumo-field-button' });
355
+ registerStyles('', fieldButton, { moduleId: 'lumo-field-button' });
817
356
 
818
357
  /**
819
358
  * @license
@@ -959,204 +498,45 @@ const inputField = i`
959
498
 
960
499
  const inputFieldShared$1 = [requiredField, fieldButton, helper, inputField];
961
500
 
962
- registerStyles$1('', inputFieldShared$1, {
501
+ registerStyles('', inputFieldShared$1, {
963
502
  moduleId: 'lumo-input-field-shared-styles',
964
503
  });
965
504
 
966
505
  /**
967
506
  * @license
968
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
969
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
970
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
971
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
972
- * Code distributed by Google as part of the polymer project is also
973
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
507
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
508
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
974
509
  */
975
510
 
976
- /**
977
- * Async interface wrapper around `setTimeout`.
978
- *
979
- * @namespace
980
- * @summary Async interface wrapper around `setTimeout`.
981
- */
982
- const timeOut = {
983
- /**
984
- * Returns a sub-module with the async interface providing the provided
985
- * delay.
986
- *
987
- * @memberof timeOut
988
- * @param {number=} delay Time to wait before calling callbacks in ms
989
- * @return {!AsyncInterface} An async timeout interface
990
- */
991
- after(delay) {
992
- return {
993
- run(fn) {
994
- return window.setTimeout(fn, delay);
995
- },
996
- cancel(handle) {
997
- window.clearTimeout(handle);
998
- },
999
- };
1000
- },
1001
- /**
1002
- * Enqueues a function called in the next task.
1003
- *
1004
- * @memberof timeOut
1005
- * @param {!Function} fn Callback to run
1006
- * @param {number=} delay Delay in milliseconds
1007
- * @return {number} Handle used for canceling task
1008
- */
1009
- run(fn, delay) {
1010
- return window.setTimeout(fn, delay);
1011
- },
1012
- /**
1013
- * Cancels a previously enqueued `timeOut` callback.
1014
- *
1015
- * @memberof timeOut
1016
- * @param {number} handle Handle returned from `run` of callback to cancel
1017
- * @return {void}
1018
- */
1019
- cancel(handle) {
1020
- window.clearTimeout(handle);
1021
- },
1022
- };
511
+ const testUserAgent = (regexp) => regexp.test(navigator.userAgent);
1023
512
 
1024
- /**
1025
- @license
1026
- Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
1027
- This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
1028
- The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
1029
- The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
1030
- Code distributed by Google as part of the polymer project is also
1031
- subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
1032
- */
513
+ const testPlatform = (regexp) => regexp.test(navigator.platform);
1033
514
 
1034
- const debouncerQueue = new Set();
515
+ const testVendor = (regexp) => regexp.test(navigator.vendor);
1035
516
 
1036
- /**
1037
- * @summary Collapse multiple callbacks into one invocation after a timer.
1038
- */
1039
- class Debouncer {
1040
- /**
1041
- * Creates a debouncer if no debouncer is passed as a parameter
1042
- * or it cancels an active debouncer otherwise. The following
1043
- * example shows how a debouncer can be called multiple times within a
1044
- * microtask and "debounced" such that the provided callback function is
1045
- * called once. Add this method to a custom element:
1046
- *
1047
- * ```js
1048
- * import {microTask} from '@vaadin/component-base/src/async.js';
1049
- * import {Debouncer} from '@vaadin/component-base/src/debounce.js';
1050
- * // ...
1051
- *
1052
- * _debounceWork() {
1053
- * this._debounceJob = Debouncer.debounce(this._debounceJob,
1054
- * microTask, () => this._doWork());
1055
- * }
1056
- * ```
1057
- *
1058
- * If the `_debounceWork` method is called multiple times within the same
1059
- * microtask, the `_doWork` function will be called only once at the next
1060
- * microtask checkpoint.
1061
- *
1062
- * Note: In testing it is often convenient to avoid asynchrony. To accomplish
1063
- * this with a debouncer, you can use `enqueueDebouncer` and
1064
- * `flush`. For example, extend the above example by adding
1065
- * `enqueueDebouncer(this._debounceJob)` at the end of the
1066
- * `_debounceWork` method. Then in a test, call `flush` to ensure
1067
- * the debouncer has completed.
1068
- *
1069
- * @param {Debouncer?} debouncer Debouncer object.
1070
- * @param {!AsyncInterface} asyncModule Object with Async interface
1071
- * @param {function()} callback Callback to run.
1072
- * @return {!Debouncer} Returns a debouncer object.
1073
- */
1074
- static debounce(debouncer, asyncModule, callback) {
1075
- if (debouncer instanceof Debouncer) {
1076
- // Cancel the async callback, but leave in debouncerQueue if it was
1077
- // enqueued, to maintain 1.x flush order
1078
- debouncer._cancelAsync();
1079
- } else {
1080
- debouncer = new Debouncer();
1081
- }
1082
- debouncer.setConfig(asyncModule, callback);
1083
- return debouncer;
1084
- }
517
+ testUserAgent(/Android/u);
1085
518
 
1086
- constructor() {
1087
- this._asyncModule = null;
1088
- this._callback = null;
1089
- this._timer = null;
1090
- }
519
+ testUserAgent(/Chrome/u) && testVendor(/Google Inc/u);
1091
520
 
1092
- /**
1093
- * Sets the scheduler; that is, a module with the Async interface,
1094
- * a callback and optional arguments to be passed to the run function
1095
- * from the async module.
1096
- *
1097
- * @param {!AsyncInterface} asyncModule Object with Async interface.
1098
- * @param {function()} callback Callback to run.
1099
- * @return {void}
1100
- */
1101
- setConfig(asyncModule, callback) {
1102
- this._asyncModule = asyncModule;
1103
- this._callback = callback;
1104
- this._timer = this._asyncModule.run(() => {
1105
- this._timer = null;
1106
- debouncerQueue.delete(this);
1107
- this._callback();
1108
- });
1109
- }
521
+ const isFirefox = testUserAgent(/Firefox/u);
1110
522
 
1111
- /**
1112
- * Cancels an active debouncer and returns a reference to itself.
1113
- *
1114
- * @return {void}
1115
- */
1116
- cancel() {
1117
- if (this.isActive()) {
1118
- this._cancelAsync();
1119
- // Canceling a debouncer removes its spot from the flush queue,
1120
- // so if a debouncer is manually canceled and re-debounced, it
1121
- // will reset its flush order (this is a very minor difference from 1.x)
1122
- // Re-debouncing via the `debounce` API retains the 1.x FIFO flush order
1123
- debouncerQueue.delete(this);
1124
- }
1125
- }
523
+ // IPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
524
+ const isIPad = testPlatform(/^iPad/u) || (testPlatform(/^Mac/u) && navigator.maxTouchPoints > 1);
1126
525
 
1127
- /**
1128
- * Cancels a debouncer's async callback.
1129
- *
1130
- * @return {void}
1131
- */
1132
- _cancelAsync() {
1133
- if (this.isActive()) {
1134
- this._asyncModule.cancel(/** @type {number} */ (this._timer));
1135
- this._timer = null;
1136
- }
1137
- }
526
+ const isIPhone = testPlatform(/^iPhone/u);
1138
527
 
1139
- /**
1140
- * Flushes an active debouncer and returns a reference to itself.
1141
- *
1142
- * @return {void}
1143
- */
1144
- flush() {
1145
- if (this.isActive()) {
1146
- this.cancel();
1147
- this._callback();
1148
- }
1149
- }
528
+ const isIOS = isIPhone || isIPad;
529
+
530
+ const isSafari = testUserAgent(/^((?!chrome|android).)*safari/iu);
1150
531
 
1151
- /**
1152
- * Returns true if the debouncer is active.
1153
- *
1154
- * @return {boolean} True if active.
1155
- */
1156
- isActive() {
1157
- return this._timer != null;
532
+ const isTouch = (() => {
533
+ try {
534
+ document.createEvent('TouchEvent');
535
+ return true;
536
+ } catch (e) {
537
+ return false;
1158
538
  }
1159
- }
539
+ })();
1160
540
 
1161
541
  /**
1162
542
  * @license
@@ -1234,40 +614,6 @@ const SlotStylesMixin = dedupingMixin(
1234
614
  },
1235
615
  );
1236
616
 
1237
- /**
1238
- * @license
1239
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
1240
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
1241
- */
1242
-
1243
- const testUserAgent = (regexp) => regexp.test(navigator.userAgent);
1244
-
1245
- const testPlatform = (regexp) => regexp.test(navigator.platform);
1246
-
1247
- const testVendor = (regexp) => regexp.test(navigator.vendor);
1248
-
1249
- testUserAgent(/Android/u);
1250
-
1251
- testUserAgent(/Chrome/u) && testVendor(/Google Inc/u);
1252
-
1253
- testUserAgent(/Firefox/u);
1254
-
1255
- // IPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
1256
- testPlatform(/^iPad/u) || (testPlatform(/^Mac/u) && navigator.maxTouchPoints > 1);
1257
-
1258
- testPlatform(/^iPhone/u);
1259
-
1260
- testUserAgent(/^((?!chrome|android).)*safari/iu);
1261
-
1262
- const isTouch = (() => {
1263
- try {
1264
- document.createEvent('TouchEvent');
1265
- return true;
1266
- } catch (e) {
1267
- return false;
1268
- }
1269
- })();
1270
-
1271
617
  /**
1272
618
  * @license
1273
619
  * Copyright (c) 2021 - 2023 Vaadin Ltd.
@@ -1862,4 +1208,4 @@ const inputFieldContainer = i`
1862
1208
 
1863
1209
  const inputFieldShared = [fieldShared, inputFieldContainer, clearButton];
1864
1210
 
1865
- export { InputConstraintsMixin as I, InputControlMixin as a, inputFieldShared as b, inputFieldShared$1 as i };
1211
+ export { InputConstraintsMixin as I, isFirefox as a, isIOS as b, InputControlMixin as c, inputFieldShared as d, isSafari as e, isTouch as f, inputFieldShared$1 as i };