@everymatrix/general-input 1.21.7 → 1.22.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,5 +1,4 @@
1
- import { i, r as registerStyles, M as getDeepActiveElement, N as getFocusableElements, b as isElementFocused, J as ControllerMixin, O as getAncestorRootNodes } from './field-mixin.js';
2
- import { b as isIOS } from './input-field-shared-styles.js';
1
+ import { i, y as registerStyles, z as getDeepActiveElement, A as getFocusableElements, b as isElementFocused, d as dedupingMixin } from './field-mixin.js';
3
2
 
4
3
  /**
5
4
  * @license
@@ -255,6 +254,42 @@ function afterNextRender(context, callback, args) {
255
254
  afterRenderQueue.push([context, callback, args]);
256
255
  }
257
256
 
257
+ /**
258
+ * @license
259
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
260
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
261
+ */
262
+
263
+ const testUserAgent = (regexp) => regexp.test(navigator.userAgent);
264
+
265
+ const testPlatform = (regexp) => regexp.test(navigator.platform);
266
+
267
+ const testVendor = (regexp) => regexp.test(navigator.vendor);
268
+
269
+ testUserAgent(/Android/u);
270
+
271
+ testUserAgent(/Chrome/u) && testVendor(/Google Inc/u);
272
+
273
+ testUserAgent(/Firefox/u);
274
+
275
+ // IPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
276
+ const isIPad = testPlatform(/^iPad/u) || (testPlatform(/^Mac/u) && navigator.maxTouchPoints > 1);
277
+
278
+ const isIPhone = testPlatform(/^iPhone/u);
279
+
280
+ const isIOS = isIPhone || isIPad;
281
+
282
+ testUserAgent(/^((?!chrome|android).)*safari/iu);
283
+
284
+ (() => {
285
+ try {
286
+ document.createEvent('TouchEvent');
287
+ return true;
288
+ } catch (e) {
289
+ return false;
290
+ }
291
+ })();
292
+
258
293
  /**
259
294
  * @license
260
295
  * Copyright (c) 2017 Anton Korzunov
@@ -728,6 +763,87 @@ class FocusTrapController {
728
763
  }
729
764
  }
730
765
 
766
+ /**
767
+ * @license
768
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
769
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
770
+ */
771
+
772
+ /**
773
+ * @typedef ReactiveController
774
+ * @type {import('lit').ReactiveController}
775
+ */
776
+
777
+ /**
778
+ * A mixin for connecting controllers to the element.
779
+ *
780
+ * @polymerMixin
781
+ */
782
+ const ControllerMixin = dedupingMixin((superClass) => {
783
+ // If the superclass extends from LitElement,
784
+ // use its own controllers implementation.
785
+ if (typeof superClass.prototype.addController === 'function') {
786
+ return superClass;
787
+ }
788
+
789
+ return class ControllerMixinClass extends superClass {
790
+ constructor() {
791
+ super();
792
+
793
+ /**
794
+ * @type {Set<ReactiveController>}
795
+ */
796
+ this.__controllers = new Set();
797
+ }
798
+
799
+ /** @protected */
800
+ connectedCallback() {
801
+ super.connectedCallback();
802
+
803
+ this.__controllers.forEach((c) => {
804
+ if (c.hostConnected) {
805
+ c.hostConnected();
806
+ }
807
+ });
808
+ }
809
+
810
+ /** @protected */
811
+ disconnectedCallback() {
812
+ super.disconnectedCallback();
813
+
814
+ this.__controllers.forEach((c) => {
815
+ if (c.hostDisconnected) {
816
+ c.hostDisconnected();
817
+ }
818
+ });
819
+ }
820
+
821
+ /**
822
+ * Registers a controller to participate in the element update cycle.
823
+ *
824
+ * @param {ReactiveController} controller
825
+ * @protected
826
+ */
827
+ addController(controller) {
828
+ this.__controllers.add(controller);
829
+ // Call hostConnected if a controller is added after the element is attached.
830
+ if (this.$ !== undefined && this.isConnected && controller.hostConnected) {
831
+ controller.hostConnected();
832
+ }
833
+ }
834
+
835
+ /**
836
+ * Removes a controller from the element.
837
+ *
838
+ * @param {ReactiveController} controller
839
+ * @protected
840
+ */
841
+ removeController(controller) {
842
+ this.__controllers.delete(controller);
843
+ }
844
+ };
845
+ });
846
+
731
847
  /**
732
848
  * @license
733
849
  * Copyright (c) 2017 - 2023 Vaadin Ltd.
@@ -1439,6 +1555,48 @@ const OverlayMixin = (superClass) =>
1439
1555
  }
1440
1556
  };
1441
1557
 
1558
+ /**
1559
+ * @license
1560
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
1561
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
1562
+ */
1563
+
1564
+ /**
1565
+ * Returns an array of ancestor root nodes for the given node.
1566
+ *
1567
+ * A root node is either a document node or a document fragment node (Shadow Root).
1568
+ * The array is collected by a bottom-up DOM traversing that starts with the given node
1569
+ * and involves both the light DOM and ancestor shadow DOM trees.
1570
+ *
1571
+ * @param {Node} node
1572
+ * @return {Node[]}
1573
+ */
1574
+ function getAncestorRootNodes(node) {
1575
+ const result = [];
1576
+
1577
+ while (node) {
1578
+ if (node.nodeType === Node.DOCUMENT_NODE) {
1579
+ result.push(node);
1580
+ break;
1581
+ }
1582
+
1583
+ if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
1584
+ result.push(node);
1585
+ node = node.host;
1586
+ continue;
1587
+ }
1588
+
1589
+ if (node.assignedSlot) {
1590
+ node = node.assignedSlot;
1591
+ continue;
1592
+ }
1593
+
1594
+ node = node.parentNode;
1595
+ }
1596
+
1597
+ return result;
1598
+ }
1599
+
1442
1600
  /**
1443
1601
  * @license
1444
1602
  * Copyright (c) 2017 - 2023 Vaadin Ltd.
@@ -1879,86 +2037,6 @@ const overlayStyles = i`
1879
2037
  }
1880
2038
  `;
1881
2039
 
1882
- /**
1883
- * @license
1884
- * Copyright (c) 2023 Vaadin Ltd.
1885
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
1886
- */
1887
-
1888
- /**
1889
- * A mixin that forwards CSS class names to the internal overlay element
1890
- * by setting the `overlayClass` property or `overlay-class` attribute.
1891
- *
1892
- * @polymerMixin
1893
- */
1894
- const OverlayClassMixin = (superclass) =>
1895
- class OverlayClassMixinClass extends superclass {
1896
- static get properties() {
1897
- return {
1898
- /**
1899
- * A space-delimited list of CSS class names to set on the overlay element.
1900
- * This property does not affect other CSS class names set manually via JS.
1901
- *
1902
- * Note, if the CSS class name was set with this property, clearing it will
1903
- * remove it from the overlay, even if the same class name was also added
1904
- * manually, e.g. by using `classList.add()` in the `renderer` function.
1905
- *
1906
- * @attr {string} overlay-class
1907
- */
1908
- overlayClass: {
1909
- type: String,
1910
- },
1911
-
1912
- /**
1913
- * An overlay element on which CSS class names are set.
1914
- *
1915
- * @protected
1916
- */
1917
- _overlayElement: {
1918
- type: Object,
1919
- },
1920
- };
1921
- }
1922
-
1923
- static get observers() {
1924
- return ['__updateOverlayClassNames(overlayClass, _overlayElement)'];
1925
- }
1926
-
1927
- /** @private */
1928
- __updateOverlayClassNames(overlayClass, overlayElement) {
1929
- if (!overlayElement) {
1930
- return;
1931
- }
1932
-
1933
- // Overlay is set but overlayClass is not set
1934
- if (overlayClass === undefined) {
1935
- return;
1936
- }
1937
-
1938
- const { classList } = overlayElement;
1939
-
1940
- if (!this.__initialClasses) {
1941
- this.__initialClasses = new Set(classList);
1942
- }
1943
-
1944
- if (Array.isArray(this.__previousClasses)) {
1945
- // Remove old classes that no longer apply
1946
- const classesToRemove = this.__previousClasses.filter((name) => !this.__initialClasses.has(name));
1947
- if (classesToRemove.length > 0) {
1948
- classList.remove(...classesToRemove);
1949
- }
1950
- }
1951
-
1952
- // Add new classes based on the overlayClass
1953
- const classesToAdd = typeof overlayClass === 'string' ? overlayClass.split(' ') : [];
1954
- if (classesToAdd.length > 0) {
1955
- classList.add(...classesToAdd);
1956
- }
1957
-
1958
- this.__previousClasses = classesToAdd;
1959
- }
1960
- };
1961
-
1962
2040
  /**
1963
2041
  * @license
1964
2042
  * Copyright (c) 2021 - 2023 Vaadin Ltd.
@@ -1998,4 +2076,4 @@ class VirtualKeyboardController {
1998
2076
  }
1999
2077
  }
2000
2078
 
2001
- export { OverlayMixin as O, PositionMixin as P, VirtualKeyboardController as V, afterNextRender as a, OverlayClassMixin as b, overlay as c, menuOverlayCore as d, hideOthers as h, menuOverlay as m, overlayStyles as o };
2079
+ export { OverlayMixin as O, PositionMixin as P, VirtualKeyboardController as V, afterNextRender as a, overlay as b, menuOverlayCore as c, hideOthers as h, menuOverlay as m, overlayStyles as o };