ku4web-components 6.4.34 → 6.4.38
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/dist/cjs/{index-fabdc7d0.js → index-38fe0039.js} +1 -1
- package/dist/cjs/ku4-carousel-controls.cjs.entry.js +3 -3
- package/dist/cjs/ku4-carousel-slide.cjs.entry.js +2 -2
- package/dist/cjs/ku4-carousel.cjs.entry.js +15 -9
- package/dist/cjs/ku4-col.cjs.entry.js +2 -2
- package/dist/cjs/ku4-drawer.cjs.entry.js +2 -2
- package/dist/cjs/ku4-feature.cjs.entry.js +3 -3
- package/dist/cjs/ku4-focus-trap.cjs.entry.js +27 -27
- package/dist/cjs/ku4-form.cjs.entry.js +4 -4
- package/dist/cjs/ku4-grid.cjs.entry.js +2 -2
- package/dist/cjs/ku4-label.cjs.entry.js +3 -3
- package/dist/cjs/ku4-mask.cjs.entry.js +3 -3
- package/dist/cjs/ku4-modal.cjs.entry.js +4 -4
- package/dist/cjs/ku4-panel.cjs.entry.js +2 -2
- package/dist/cjs/ku4-preview.cjs.entry.js +15 -44
- package/dist/cjs/ku4-tab-list.cjs.entry.js +5 -5
- package/dist/cjs/ku4-tab-panel.cjs.entry.js +4 -4
- package/dist/cjs/ku4-tab.cjs.entry.js +4 -4
- package/dist/cjs/ku4-table.cjs.entry.js +2 -2
- package/dist/cjs/ku4-tooltip.cjs.entry.js +3 -3
- package/dist/cjs/ku4-validation.cjs.entry.js +4 -4
- package/dist/cjs/ku4web-components.cjs.js +8 -99
- package/dist/cjs/loader.cjs.js +3 -19
- package/dist/cjs/{shadow-css-4bfd7bfa.js → shadow-css-d8ee70b1.js} +1 -1
- package/dist/esm/{index-d14f31b2.js → index-52020db7.js} +1 -1
- package/dist/esm/ku4-carousel-controls.entry.js +3 -3
- package/dist/esm/ku4-carousel-slide.entry.js +2 -2
- package/dist/esm/ku4-carousel.entry.js +15 -9
- package/dist/esm/ku4-col.entry.js +2 -2
- package/dist/esm/ku4-drawer.entry.js +2 -2
- package/dist/esm/ku4-feature.entry.js +3 -3
- package/dist/esm/ku4-focus-trap.entry.js +4 -4
- package/dist/esm/ku4-form.entry.js +4 -4
- package/dist/esm/ku4-grid.entry.js +2 -2
- package/dist/esm/ku4-label.entry.js +3 -3
- package/dist/esm/ku4-mask.entry.js +3 -3
- package/dist/esm/ku4-modal.entry.js +4 -4
- package/dist/esm/ku4-panel.entry.js +2 -2
- package/dist/esm/ku4-preview.entry.js +6 -35
- package/dist/esm/ku4-tab-list.entry.js +5 -5
- package/dist/esm/ku4-tab-panel.entry.js +4 -4
- package/dist/esm/ku4-tab.entry.js +4 -4
- package/dist/esm/ku4-table.entry.js +2 -2
- package/dist/esm/ku4-tooltip.entry.js +3 -3
- package/dist/esm/ku4-validation.entry.js +4 -4
- package/dist/esm/ku4web-components.js +8 -99
- package/dist/esm/loader.js +3 -19
- package/dist/{ku4web-components/shadow-css-bc14d9fd.js → esm/shadow-css-c1fdfa9f.js} +1 -1
- package/dist/esm-es5/{index-d14f31b2.js → index-52020db7.js} +1 -1
- package/dist/esm-es5/ku4-carousel-controls.entry.js +1 -1
- package/dist/esm-es5/ku4-carousel-slide.entry.js +1 -1
- package/dist/esm-es5/ku4-carousel.entry.js +1 -1
- package/dist/esm-es5/ku4-col.entry.js +1 -1
- package/dist/esm-es5/ku4-drawer.entry.js +1 -1
- package/dist/esm-es5/ku4-feature.entry.js +1 -1
- package/dist/esm-es5/ku4-focus-trap.entry.js +1 -1
- package/dist/esm-es5/ku4-form.entry.js +1 -1
- package/dist/esm-es5/ku4-grid.entry.js +1 -1
- package/dist/esm-es5/ku4-label.entry.js +1 -1
- package/dist/esm-es5/ku4-mask.entry.js +1 -1
- package/dist/esm-es5/ku4-modal.entry.js +1 -1
- package/dist/esm-es5/ku4-panel.entry.js +1 -1
- package/dist/esm-es5/ku4-preview.entry.js +1 -1
- package/dist/esm-es5/ku4-tab-list.entry.js +1 -1
- package/dist/esm-es5/ku4-tab-panel.entry.js +1 -1
- package/dist/esm-es5/ku4-tab.entry.js +1 -1
- package/dist/esm-es5/ku4-table.entry.js +1 -1
- package/dist/esm-es5/ku4-tooltip.entry.js +1 -1
- package/dist/esm-es5/ku4-validation.entry.js +1 -1
- package/dist/esm-es5/ku4web-components.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{shadow-css-bc14d9fd.js → shadow-css-c1fdfa9f.js} +0 -0
- package/dist/index.js +1 -1
- package/dist/ku4web-components/index.esm.js +0 -1
- package/dist/ku4web-components/ku4web-components.css +1 -283
- package/dist/ku4web-components/ku4web-components.esm.js +1 -125
- package/dist/ku4web-components/ku4web-components.js +1 -1
- package/dist/ku4web-components/{p-967f8f4b.system.entry.js → p-19147286.system.entry.js} +1 -1
- package/dist/ku4web-components/p-1fb8966a.entry.js +1 -0
- package/dist/ku4web-components/{p-c72b3ced.system.entry.js → p-2bbea5f3.system.entry.js} +1 -1
- package/dist/ku4web-components/p-4986dc9a.entry.js +1 -0
- package/dist/ku4web-components/{p-176273d5.system.js → p-4de687d8.system.js} +1 -1
- package/dist/ku4web-components/p-5848719e.system.js +1 -0
- package/dist/ku4web-components/p-5ad4d525.entry.js +1 -0
- package/dist/ku4web-components/{p-e0558b2b.system.entry.js → p-60512677.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-cb0f32a7.js → p-670d415c.js} +1 -1
- package/dist/ku4web-components/{p-c3c31235.system.entry.js → p-67b90b07.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-435478fa.system.entry.js → p-6a6ebdd6.system.entry.js} +1 -1
- package/dist/ku4web-components/p-6f56d780.entry.js +1 -0
- package/dist/ku4web-components/p-7587e933.entry.js +1 -0
- package/dist/ku4web-components/{p-3ad57422.system.entry.js → p-769237d3.system.entry.js} +1 -1
- package/dist/ku4web-components/p-7a5e62fd.entry.js +1 -0
- package/dist/ku4web-components/{p-46d73124.system.entry.js → p-8645d86f.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-cb6b67f2.entry.js → p-867d74d6.entry.js} +1 -1
- package/dist/ku4web-components/p-911a6cc5.entry.js +1 -0
- package/dist/ku4web-components/{p-7bbd50d6.system.entry.js → p-93417cb8.system.entry.js} +1 -1
- package/dist/ku4web-components/p-98548901.system.entry.js +1 -0
- package/dist/ku4web-components/{p-44f9a1a9.system.entry.js → p-9b9fb5a2.system.entry.js} +1 -1
- package/dist/ku4web-components/p-9e2c3988.entry.js +1 -0
- package/dist/ku4web-components/{p-64f6379d.system.entry.js → p-ac86618a.system.entry.js} +1 -1
- package/dist/ku4web-components/p-af5d8c77.system.entry.js +1 -0
- package/dist/ku4web-components/p-b2db2c0b.entry.js +1 -0
- package/dist/ku4web-components/p-b9cf48d6.entry.js +1 -0
- package/dist/ku4web-components/p-bfd8c04e.entry.js +1 -0
- package/dist/ku4web-components/p-c11d7118.entry.js +1 -0
- package/dist/ku4web-components/p-c194ee9c.entry.js +1 -0
- package/dist/ku4web-components/{p-c2285d3c.system.entry.js → p-c48ff8d2.system.entry.js} +1 -1
- package/dist/ku4web-components/p-cdaa80f7.entry.js +1 -0
- package/dist/ku4web-components/{ku4-col.entry.js → p-d0579e6f.entry.js} +1 -75
- package/dist/ku4web-components/p-d248862c.entry.js +1 -0
- package/dist/ku4web-components/{p-9f159c4b.system.entry.js → p-d312c8ae.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-110de527.system.entry.js → p-d3dad5b5.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-d3379ca9.system.entry.js → p-dda45242.system.entry.js} +1 -1
- package/dist/ku4web-components/p-e63f2453.entry.js +1 -0
- package/dist/ku4web-components/{p-4e89d6bc.system.entry.js → p-e89bc35d.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-308941a0.system.entry.js → p-e9c1a470.system.entry.js} +1 -1
- package/dist/ku4web-components/p-ebc49910.entry.js +1 -0
- package/dist/ku4web-components/{p-a025c941.system.js → p-f4d979bb.system.js} +0 -0
- package/dist/ku4web-components/{p-3fb7c6ff.js → p-f566887e.js} +0 -0
- package/dist/ku4web-components/{p-7a3a3b7f.system.entry.js → p-faef0a79.system.entry.js} +1 -1
- package/dist/ku4web-components/p-fbba3322.entry.js +1 -0
- package/dist/ku4web-components/{p-d8836783.system.entry.js → p-ff4c04f5.system.entry.js} +1 -1
- package/dist/types/components/ku4-carousel/ku4-carousel.d.ts +4 -0
- package/dist/types/components/ku4-validation/ku4-validation.d.ts +5 -0
- package/dist/types/components.d.ts +16 -0
- package/loader/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/cjs/app-globals-3a1e7e63.js +0 -5
- package/dist/cjs/css-shim-a6998297.js +0 -6
- package/dist/cjs/dom-66f79778.js +0 -75
- package/dist/cjs/index-51b7a610.js +0 -14
- package/dist/cjs/index-c52d450b.js +0 -10
- package/dist/cjs/index-ff13b651.js +0 -3046
- package/dist/cjs/uid-3dd31175.js +0 -11
- package/dist/collection/capabilities/a11y/aria.js +0 -26
- package/dist/collection/capabilities/angular/index.js +0 -24
- package/dist/collection/capabilities/decorators/deprecated.js +0 -20
- package/dist/collection/capabilities/decorators/index.js +0 -3
- package/dist/collection/capabilities/decorators/memoize.js +0 -7
- package/dist/collection/capabilities/dom/isFocusable.js +0 -7
- package/dist/collection/capabilities/dom/queryFocusable.js +0 -2
- package/dist/collection/capabilities/identity/uid.js +0 -6
- package/dist/collection/capabilities/mask/index.js +0 -5
- package/dist/collection/capabilities/mask/patterns/date.js +0 -40
- package/dist/collection/capabilities/mask/patterns/index.js +0 -7
- package/dist/collection/capabilities/react/index.js +0 -25
- package/dist/collection/capabilities/testing/html.js +0 -14
- package/dist/collection/capabilities/testing/styles.js +0 -14
- package/dist/collection/capabilities/vue/index.js +0 -28
- package/dist/collection/capabilities/vue3/index.js +0 -26
- package/dist/collection/collection-manifest.json +0 -31
- package/dist/collection/components/ku4-carousel/ku4-carousel.css +0 -215
- package/dist/collection/components/ku4-carousel/ku4-carousel.js +0 -335
- package/dist/collection/components/ku4-carousel-controls/ku4-carousel-controls.css +0 -32
- package/dist/collection/components/ku4-carousel-controls/ku4-carousel-controls.js +0 -93
- package/dist/collection/components/ku4-carousel-slide/ku4-carousel-slide.css +0 -3
- package/dist/collection/components/ku4-carousel-slide/ku4-carousel-slide.js +0 -140
- package/dist/collection/components/ku4-col/ku4-col.css +0 -601
- package/dist/collection/components/ku4-col/ku4-col.js +0 -288
- package/dist/collection/components/ku4-drawer/ku4-drawer.css +0 -56
- package/dist/collection/components/ku4-drawer/ku4-drawer.js +0 -163
- package/dist/collection/components/ku4-feature/ku4-feature.js +0 -70
- package/dist/collection/components/ku4-focus-trap/ku4-focus-trap.css +0 -3
- package/dist/collection/components/ku4-focus-trap/ku4-focus-trap.js +0 -441
- package/dist/collection/components/ku4-form/ku4-form.js +0 -194
- package/dist/collection/components/ku4-grid/ku4-grid.css +0 -751
- package/dist/collection/components/ku4-grid/ku4-grid.js +0 -408
- package/dist/collection/components/ku4-label/ku4-label.css +0 -36
- package/dist/collection/components/ku4-label/ku4-label.js +0 -115
- package/dist/collection/components/ku4-mask/ku4-mask.css +0 -3
- package/dist/collection/components/ku4-mask/ku4-mask.js +0 -427
- package/dist/collection/components/ku4-modal/ku4-modal.css +0 -85
- package/dist/collection/components/ku4-modal/ku4-modal.js +0 -186
- package/dist/collection/components/ku4-panel/ku4-panel.css +0 -14
- package/dist/collection/components/ku4-panel/ku4-panel.js +0 -119
- package/dist/collection/components/ku4-preview/ku4-preview.css +0 -23
- package/dist/collection/components/ku4-preview/ku4-preview.js +0 -249
- package/dist/collection/components/ku4-tab/ku4-tab.css +0 -82
- package/dist/collection/components/ku4-tab/ku4-tab.js +0 -191
- package/dist/collection/components/ku4-tab-list/ku4-tab-list.css +0 -6
- package/dist/collection/components/ku4-tab-list/ku4-tab-list.js +0 -118
- package/dist/collection/components/ku4-tab-panel/ku4-tab-panel.css +0 -26
- package/dist/collection/components/ku4-tab-panel/ku4-tab-panel.js +0 -166
- package/dist/collection/components/ku4-table/ku4-table.css +0 -116
- package/dist/collection/components/ku4-table/ku4-table.js +0 -120
- package/dist/collection/components/ku4-tooltip/ku4-tooltip.css +0 -56
- package/dist/collection/components/ku4-tooltip/ku4-tooltip.js +0 -274
- package/dist/collection/components/ku4-validation/ku4-validation.css +0 -7
- package/dist/collection/components/ku4-validation/ku4-validation.js +0 -309
- package/dist/collection/components/ku4-validation/validate.js +0 -14
- package/dist/collection/index.js +0 -1
- package/dist/collection/security.js +0 -27
- package/dist/esm/app-globals-0f993ce5.js +0 -3
- package/dist/esm/css-shim-a64b8820.js +0 -4
- package/dist/esm/dom-d08ba8aa.js +0 -73
- package/dist/esm/index-4693d116.js +0 -3
- package/dist/esm/index-88e7b9d4.js +0 -3010
- package/dist/esm/index-89916128.js +0 -3
- package/dist/esm/shadow-css-bc14d9fd.js +0 -389
- package/dist/esm/uid-5355229f.js +0 -9
- package/dist/ku4web-components/app-globals-0f993ce5.js +0 -3
- package/dist/ku4web-components/app-globals-497eb362.system.js +0 -1
- package/dist/ku4web-components/css-shim-00dc76e5.system.js +0 -1
- package/dist/ku4web-components/css-shim-a64b8820.js +0 -4
- package/dist/ku4web-components/dom-59f9ee66.system.js +0 -21
- package/dist/ku4web-components/dom-d08ba8aa.js +0 -73
- package/dist/ku4web-components/index-3127d7f7.system.js +0 -1
- package/dist/ku4web-components/index-4693d116.js +0 -3
- package/dist/ku4web-components/index-7624f416.system.js +0 -1
- package/dist/ku4web-components/index-88e7b9d4.js +0 -3010
- package/dist/ku4web-components/index-89916128.js +0 -3
- package/dist/ku4web-components/index-aea7f048.system.js +0 -1
- package/dist/ku4web-components/index.system.js +0 -1
- package/dist/ku4web-components/ku4-carousel-controls.entry.js +0 -70
- package/dist/ku4web-components/ku4-carousel-controls.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-carousel-slide.entry.js +0 -47
- package/dist/ku4web-components/ku4-carousel-slide.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-carousel.entry.js +0 -159
- package/dist/ku4web-components/ku4-carousel.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-col.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-drawer.entry.js +0 -35
- package/dist/ku4web-components/ku4-drawer.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-feature.entry.js +0 -29
- package/dist/ku4web-components/ku4-feature.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-focus-trap.entry.js +0 -323
- package/dist/ku4web-components/ku4-focus-trap.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-form.entry.js +0 -97
- package/dist/ku4web-components/ku4-form.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-grid.entry.js +0 -108
- package/dist/ku4web-components/ku4-grid.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-label.entry.js +0 -70
- package/dist/ku4web-components/ku4-label.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-mask.entry.js +0 -311
- package/dist/ku4web-components/ku4-mask.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-modal.entry.js +0 -71
- package/dist/ku4web-components/ku4-modal.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-panel.entry.js +0 -49
- package/dist/ku4web-components/ku4-panel.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-preview.entry.js +0 -128
- package/dist/ku4web-components/ku4-preview.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-tab-list.entry.js +0 -76
- package/dist/ku4web-components/ku4-tab-list.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-tab-panel.entry.js +0 -72
- package/dist/ku4web-components/ku4-tab-panel.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-tab.entry.js +0 -63
- package/dist/ku4web-components/ku4-tab.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-table.entry.js +0 -79
- package/dist/ku4web-components/ku4-table.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-tooltip.entry.js +0 -120
- package/dist/ku4web-components/ku4-tooltip.system.entry.js +0 -1
- package/dist/ku4web-components/ku4-validation.entry.js +0 -158
- package/dist/ku4web-components/ku4-validation.system.entry.js +0 -1
- package/dist/ku4web-components/ku4web-components.system.js +0 -1
- package/dist/ku4web-components/p-026e04d8.entry.js +0 -1
- package/dist/ku4web-components/p-0a7ce92f.entry.js +0 -1
- package/dist/ku4web-components/p-10a643bb.system.js +0 -1
- package/dist/ku4web-components/p-288c6e27.entry.js +0 -1
- package/dist/ku4web-components/p-417f04e9.entry.js +0 -1
- package/dist/ku4web-components/p-4c117404.entry.js +0 -1
- package/dist/ku4web-components/p-5299172c.entry.js +0 -1
- package/dist/ku4web-components/p-6b080fd7.entry.js +0 -1
- package/dist/ku4web-components/p-731d15d8.entry.js +0 -1
- package/dist/ku4web-components/p-7760e8b4.entry.js +0 -1
- package/dist/ku4web-components/p-7764c6f2.entry.js +0 -1
- package/dist/ku4web-components/p-7ffb5116.entry.js +0 -1
- package/dist/ku4web-components/p-8063491d.entry.js +0 -1
- package/dist/ku4web-components/p-8b7e72eb.entry.js +0 -1
- package/dist/ku4web-components/p-92ddb4be.entry.js +0 -1
- package/dist/ku4web-components/p-c7dc83c3.entry.js +0 -1
- package/dist/ku4web-components/p-cb142835.system.entry.js +0 -1
- package/dist/ku4web-components/p-cb746d07.entry.js +0 -1
- package/dist/ku4web-components/p-da065955.entry.js +0 -1
- package/dist/ku4web-components/p-e7698568.system.entry.js +0 -1
- package/dist/ku4web-components/p-e8367ca4.entry.js +0 -1
- package/dist/ku4web-components/p-fb68de75.entry.js +0 -1
- package/dist/ku4web-components/shadow-css-c015bba2.system.js +0 -13
- package/dist/ku4web-components/uid-5355229f.js +0 -9
- package/dist/ku4web-components/uid-93975202.system.js +0 -1
@@ -1,274 +0,0 @@
|
|
1
|
-
import { Component, Prop, Element, Method, Host, h } from '@stencil/core';
|
2
|
-
import { debounce, Rectangle, Timeout } from 'ku4es-kernel';
|
3
|
-
/**
|
4
|
-
* @description ku4-tooltip
|
5
|
-
*/
|
6
|
-
export class Ku4Tooltip {
|
7
|
-
constructor() {
|
8
|
-
this.isShowing = false;
|
9
|
-
this.show = this.show.bind(this);
|
10
|
-
this.hide = this.hide.bind(this);
|
11
|
-
this._show = this._show.bind(this);
|
12
|
-
this._hide = this._hide.bind(this);
|
13
|
-
this._toggle = this._toggle.bind(this);
|
14
|
-
this.hideTimeout = new Timeout(200).onTimeout(this._hide);
|
15
|
-
}
|
16
|
-
/**
|
17
|
-
* Show tooltip on target element.
|
18
|
-
* @param {HTMLElement} element - Element to show tooltip on
|
19
|
-
*/
|
20
|
-
async show(element) {
|
21
|
-
this.hideTimeout.clear();
|
22
|
-
if (this.host.contains(element)) {
|
23
|
-
return;
|
24
|
-
}
|
25
|
-
else {
|
26
|
-
this.isShowing = true;
|
27
|
-
this.host.setAttribute('visible', 'true');
|
28
|
-
this.calcualatePosition(element);
|
29
|
-
this.scrollListener = debounce(() => this.calcualatePosition(element));
|
30
|
-
window.addEventListener('scroll', this.scrollListener);
|
31
|
-
}
|
32
|
-
}
|
33
|
-
/**
|
34
|
-
* Hide tool tip.
|
35
|
-
*/
|
36
|
-
async hide() {
|
37
|
-
this.hideTimeout.clear().start();
|
38
|
-
}
|
39
|
-
_show(e) {
|
40
|
-
this.show(e.target);
|
41
|
-
}
|
42
|
-
_hide() {
|
43
|
-
window.removeEventListener('scroll', this.scrollListener);
|
44
|
-
this.host.removeAttribute('visible');
|
45
|
-
this.isShowing = false;
|
46
|
-
}
|
47
|
-
_toggle(e) {
|
48
|
-
this.isShowing ? this._hide() : this._show(e);
|
49
|
-
}
|
50
|
-
calcualatePosition(target) {
|
51
|
-
const { left, top, width, height } = target.getBoundingClientRect();
|
52
|
-
const { left: hleft, top: htop, width: hwidth, height: hheight } = this.host.getBoundingClientRect();
|
53
|
-
const targetBox = new Rectangle(left, top, width, height);
|
54
|
-
const hostBox = new Rectangle(hleft, htop, hwidth, hheight);
|
55
|
-
/**
|
56
|
-
* The measurements aren't quite lining up with center. They are off by a small bit
|
57
|
-
* Need to figure out why.
|
58
|
-
* Also the Arrow is not lining up. Looks like some small margin mistakes fix.
|
59
|
-
* Could also stand to figure out a way to support an arrow that is white with a border.
|
60
|
-
*/
|
61
|
-
if (this.top) {
|
62
|
-
this.host.style.left = `${targetBox.origin.x + targetBox.dimensions.x / 2 - hostBox.dimensions.x / 2}px`;
|
63
|
-
this.host.style.top = `${targetBox.origin.y - hostBox.dimensions.y - 15}px`;
|
64
|
-
}
|
65
|
-
else if (this.left) {
|
66
|
-
this.host.style.left = `${targetBox.origin.x - hostBox.dimensions.x - 15}px`;
|
67
|
-
this.host.style.top = `${targetBox.origin.y + targetBox.dimensions.y / 2 - hostBox.dimensions.y / 2}px`;
|
68
|
-
}
|
69
|
-
else if (this.bottom) {
|
70
|
-
this.host.style.left = `${targetBox.origin.x + targetBox.dimensions.x / 2 - hostBox.dimensions.x / 2}px`;
|
71
|
-
this.host.style.top = `${targetBox.origin.y + targetBox.dimensions.y + 15}px`;
|
72
|
-
}
|
73
|
-
else if (this.right) {
|
74
|
-
this.host.style.left = `${targetBox.origin.x + targetBox.dimensions.x + 15}px`;
|
75
|
-
this.host.style.top = `${targetBox.origin.y + targetBox.dimensions.y / 2 - hostBox.dimensions.y / 2}px`;
|
76
|
-
}
|
77
|
-
else {
|
78
|
-
this.host.style.left = `${targetBox.origin.x + targetBox.dimensions.x / 2 - hostBox.dimensions.x / 2}px`;
|
79
|
-
this.host.style.top = `${targetBox.origin.y + targetBox.dimensions.y + 15}px`;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
componentWillLoad() {
|
83
|
-
const { debug, element, host, top, left, bottom, right } = this;
|
84
|
-
if (!(top || left || bottom || right)) {
|
85
|
-
this.host.setAttribute('bottom', '');
|
86
|
-
}
|
87
|
-
document.querySelectorAll(element).forEach((element) => {
|
88
|
-
host.addEventListener('mouseover', this._show);
|
89
|
-
element.addEventListener('mouseover', this._show);
|
90
|
-
element.addEventListener('touchstart', this._toggle);
|
91
|
-
if (debug) {
|
92
|
-
return;
|
93
|
-
}
|
94
|
-
host.addEventListener('mouseout', this.hide);
|
95
|
-
element.addEventListener('mouseout', this.hide);
|
96
|
-
});
|
97
|
-
}
|
98
|
-
disconnectedCallback() {
|
99
|
-
const { debug, element, hideTimeout, host } = this;
|
100
|
-
document.querySelectorAll(element).forEach((element) => {
|
101
|
-
host.removeEventListener('mouseover', this._show);
|
102
|
-
element.removeEventListener('mouseover', this._show);
|
103
|
-
element.removeEventListener('touchstart', this._toggle);
|
104
|
-
if (debug) {
|
105
|
-
return;
|
106
|
-
}
|
107
|
-
host.removeEventListener('mouseout', this.hide);
|
108
|
-
element.removeEventListener('mouseout', this.hide);
|
109
|
-
});
|
110
|
-
hideTimeout.clear();
|
111
|
-
}
|
112
|
-
render() {
|
113
|
-
return (h(Host, { role: "tooltip" },
|
114
|
-
h("div", { class: "arrow" }),
|
115
|
-
h("div", { class: "content" },
|
116
|
-
h("slot", null))));
|
117
|
-
}
|
118
|
-
static get is() { return "ku4-tooltip"; }
|
119
|
-
static get encapsulation() { return "shadow"; }
|
120
|
-
static get originalStyleUrls() { return {
|
121
|
-
"$": ["ku4-tooltip.scss"]
|
122
|
-
}; }
|
123
|
-
static get styleUrls() { return {
|
124
|
-
"$": ["ku4-tooltip.css"]
|
125
|
-
}; }
|
126
|
-
static get properties() { return {
|
127
|
-
"element": {
|
128
|
-
"type": "string",
|
129
|
-
"mutable": false,
|
130
|
-
"complexType": {
|
131
|
-
"original": "string",
|
132
|
-
"resolved": "string",
|
133
|
-
"references": {}
|
134
|
-
},
|
135
|
-
"required": false,
|
136
|
-
"optional": false,
|
137
|
-
"docs": {
|
138
|
-
"tags": [],
|
139
|
-
"text": "Query selector of element(s) to tie to\nthis tooltip."
|
140
|
-
},
|
141
|
-
"attribute": "element",
|
142
|
-
"reflect": false
|
143
|
-
},
|
144
|
-
"top": {
|
145
|
-
"type": "boolean",
|
146
|
-
"mutable": false,
|
147
|
-
"complexType": {
|
148
|
-
"original": "boolean",
|
149
|
-
"resolved": "boolean",
|
150
|
-
"references": {}
|
151
|
-
},
|
152
|
-
"required": false,
|
153
|
-
"optional": false,
|
154
|
-
"docs": {
|
155
|
-
"tags": [],
|
156
|
-
"text": "Pin tooltip to top of target element"
|
157
|
-
},
|
158
|
-
"attribute": "top",
|
159
|
-
"reflect": false
|
160
|
-
},
|
161
|
-
"left": {
|
162
|
-
"type": "boolean",
|
163
|
-
"mutable": false,
|
164
|
-
"complexType": {
|
165
|
-
"original": "boolean",
|
166
|
-
"resolved": "boolean",
|
167
|
-
"references": {}
|
168
|
-
},
|
169
|
-
"required": false,
|
170
|
-
"optional": false,
|
171
|
-
"docs": {
|
172
|
-
"tags": [],
|
173
|
-
"text": "Pin tooltip to left of target element"
|
174
|
-
},
|
175
|
-
"attribute": "left",
|
176
|
-
"reflect": false
|
177
|
-
},
|
178
|
-
"bottom": {
|
179
|
-
"type": "boolean",
|
180
|
-
"mutable": false,
|
181
|
-
"complexType": {
|
182
|
-
"original": "boolean",
|
183
|
-
"resolved": "boolean",
|
184
|
-
"references": {}
|
185
|
-
},
|
186
|
-
"required": false,
|
187
|
-
"optional": false,
|
188
|
-
"docs": {
|
189
|
-
"tags": [],
|
190
|
-
"text": "Pin tooltip to bottom of target element"
|
191
|
-
},
|
192
|
-
"attribute": "bottom",
|
193
|
-
"reflect": false
|
194
|
-
},
|
195
|
-
"right": {
|
196
|
-
"type": "boolean",
|
197
|
-
"mutable": false,
|
198
|
-
"complexType": {
|
199
|
-
"original": "boolean",
|
200
|
-
"resolved": "boolean",
|
201
|
-
"references": {}
|
202
|
-
},
|
203
|
-
"required": false,
|
204
|
-
"optional": false,
|
205
|
-
"docs": {
|
206
|
-
"tags": [],
|
207
|
-
"text": "Pin tooltip to right of target element"
|
208
|
-
},
|
209
|
-
"attribute": "right",
|
210
|
-
"reflect": false
|
211
|
-
},
|
212
|
-
"debug": {
|
213
|
-
"type": "boolean",
|
214
|
-
"mutable": false,
|
215
|
-
"complexType": {
|
216
|
-
"original": "boolean",
|
217
|
-
"resolved": "boolean",
|
218
|
-
"references": {}
|
219
|
-
},
|
220
|
-
"required": false,
|
221
|
-
"optional": false,
|
222
|
-
"docs": {
|
223
|
-
"tags": [],
|
224
|
-
"text": "Prevents tooltip show/hide behavior. Instead,\ntooltip will always show. This is useful for\ncustom style development and debugging."
|
225
|
-
},
|
226
|
-
"attribute": "debug",
|
227
|
-
"reflect": false
|
228
|
-
}
|
229
|
-
}; }
|
230
|
-
static get methods() { return {
|
231
|
-
"show": {
|
232
|
-
"complexType": {
|
233
|
-
"signature": "(element: any) => Promise<void>",
|
234
|
-
"parameters": [{
|
235
|
-
"tags": [{
|
236
|
-
"text": "element - Element to show tooltip on",
|
237
|
-
"name": "param"
|
238
|
-
}],
|
239
|
-
"text": "- Element to show tooltip on"
|
240
|
-
}],
|
241
|
-
"references": {
|
242
|
-
"Promise": {
|
243
|
-
"location": "global"
|
244
|
-
}
|
245
|
-
},
|
246
|
-
"return": "Promise<void>"
|
247
|
-
},
|
248
|
-
"docs": {
|
249
|
-
"text": "Show tooltip on target element.",
|
250
|
-
"tags": [{
|
251
|
-
"name": "param",
|
252
|
-
"text": "element - Element to show tooltip on"
|
253
|
-
}]
|
254
|
-
}
|
255
|
-
},
|
256
|
-
"hide": {
|
257
|
-
"complexType": {
|
258
|
-
"signature": "() => Promise<void>",
|
259
|
-
"parameters": [],
|
260
|
-
"references": {
|
261
|
-
"Promise": {
|
262
|
-
"location": "global"
|
263
|
-
}
|
264
|
-
},
|
265
|
-
"return": "Promise<void>"
|
266
|
-
},
|
267
|
-
"docs": {
|
268
|
-
"text": "Hide tool tip.",
|
269
|
-
"tags": []
|
270
|
-
}
|
271
|
-
}
|
272
|
-
}; }
|
273
|
-
static get elementRef() { return "host"; }
|
274
|
-
}
|
@@ -1,309 +0,0 @@
|
|
1
|
-
import { Component, Host, Prop, State, Method, Element, h, Event } from '@stencil/core';
|
2
|
-
import { Assert, identity, wait } from 'ku4es-kernel';
|
3
|
-
import validate from './validate';
|
4
|
-
/**
|
5
|
-
* @description ku4-validation
|
6
|
-
*/
|
7
|
-
export class Ku4Validation {
|
8
|
-
constructor() {
|
9
|
-
/**
|
10
|
-
* Validation RegExp pattern that the target field must match to
|
11
|
-
* be considered valid. Multiple patterns can be passed delimited
|
12
|
-
* by a `space` character. e.g. pattern1 pattern2 pattern3 etc.
|
13
|
-
* If your target field is optional you can accomplish this with
|
14
|
-
* your pattern using "(^$)|(YOUR-PATTERN)". This says that the
|
15
|
-
* field must be empty (^$) OR (YOUR-PATTERN).
|
16
|
-
*/
|
17
|
-
this.pattern = '.*';
|
18
|
-
/**
|
19
|
-
* Any RegExp flags that you want to include in your pattern. Multiple
|
20
|
-
* patterns can be passed delimited by a `space` character. e.g.
|
21
|
-
* using the pattern1 pattern2 pattern3 example from the `pattern`
|
22
|
-
* property, you could pass "gimsuy gim gi". If you wanted to pass
|
23
|
-
* flags only for patterns 1 and 3 you will just skip flags for pattern2
|
24
|
-
* by typing nothing and instead typing another "space" e.g. "gimsuy gi".
|
25
|
-
* If you wanted to skip flags for pattern1 you could start flags with a
|
26
|
-
* "space" e.g. " gim gi".
|
27
|
-
*/
|
28
|
-
this.flags = '';
|
29
|
-
/**
|
30
|
-
* A reference to a named function or a function body that
|
31
|
-
* define a validation criteria and return `true` when the
|
32
|
-
* defined validation criteria are satisfied.
|
33
|
-
* The function will be called with one argument, `value`,
|
34
|
-
* that will contain the current value of the target field.
|
35
|
-
* Example: method="return value === 'valid'", or
|
36
|
-
* function validate(value) { return value === 'valid'; }
|
37
|
-
* method="validate(value)"
|
38
|
-
*/
|
39
|
-
this.method = '';
|
40
|
-
const patterns = this.pattern.split(' ');
|
41
|
-
const flags = this.flags.split(' ');
|
42
|
-
const method = this.method.trim();
|
43
|
-
this.regex = patterns.map((pattern, i) => new RegExp(pattern, flags[i]));
|
44
|
-
this.validationMethod = Assert.isNullOrEmpty(method)
|
45
|
-
? () => true
|
46
|
-
: new Function('value', (/^return/.test(method) ? method : `return ${method}`));
|
47
|
-
this.handleInput = this.handleInput.bind(this);
|
48
|
-
this.handleChange = this.handleChange.bind(this);
|
49
|
-
this.handleBlur = this.handleBlur.bind(this);
|
50
|
-
this.handleReset = this.handleReset.bind(this);
|
51
|
-
}
|
52
|
-
/**
|
53
|
-
* Call to explicitly validate this validation. This method
|
54
|
-
* is called internally on change and blur of the input internally.
|
55
|
-
* There is no default need to call this method.
|
56
|
-
*/
|
57
|
-
async validate() {
|
58
|
-
return this.assert();
|
59
|
-
}
|
60
|
-
handleInput() {
|
61
|
-
(this.input.type === 'file' || Assert.isFalse(this.isValid)) && this.assert();
|
62
|
-
}
|
63
|
-
handleChange() {
|
64
|
-
(this.input.type === 'file' || Assert.isFalse(this.isValid)) && this.assert();
|
65
|
-
}
|
66
|
-
handleBlur() {
|
67
|
-
this.assert();
|
68
|
-
}
|
69
|
-
handleReset() {
|
70
|
-
this.isValid = true;
|
71
|
-
this.invalid = !this.isValid;
|
72
|
-
this.input.setAttribute('aria-invalid', this.invalid);
|
73
|
-
}
|
74
|
-
assert() {
|
75
|
-
const { ele, validOptions, input, regex } = this;
|
76
|
-
if (input.type === 'file' && Assert.isNullOrEmpty(input.value)) {
|
77
|
-
return;
|
78
|
-
}
|
79
|
-
const previousIsValid = this.isValid;
|
80
|
-
this.isValid = validate(regex, input.value, validOptions, ele) && this.validationMethod(input.value);
|
81
|
-
this.invalid = !this.isValid;
|
82
|
-
input.setAttribute('aria-invalid', this.invalid);
|
83
|
-
if (Assert.isFalse(previousIsValid) && this.isValid) {
|
84
|
-
this.didValidate.emit(this.isValid);
|
85
|
-
}
|
86
|
-
return this.isValid;
|
87
|
-
}
|
88
|
-
componentWillLoad() {
|
89
|
-
this.input = document.getElementById(this.for);
|
90
|
-
if (Assert.exists(this.input)) {
|
91
|
-
this.ele = document.getElementById(this.element) || document.querySelector(this.element);
|
92
|
-
this.validOptions = Assert.exists(this.values)
|
93
|
-
? this.values.split(',')
|
94
|
-
: (this.ele && this.ele.nodeName === 'DATALIST' &&
|
95
|
-
[].slice.call(this.ele.querySelectorAll('option'))
|
96
|
-
.map(option => option.value));
|
97
|
-
const describedby = this.input.getAttribute('aria-describedby');
|
98
|
-
const id = this.host.getAttribute('id') || identity.uid();
|
99
|
-
this.host.setAttribute('id', id);
|
100
|
-
if (Assert.isNullOrEmpty(describedby)) {
|
101
|
-
this.input.setAttribute('aria-describedby', id);
|
102
|
-
}
|
103
|
-
/**
|
104
|
-
* We "wait" to put this on the next event loop. This allows
|
105
|
-
* ku4-mask to be placed anywhere in the dom and not affect
|
106
|
-
* to workings of ku4-validation.
|
107
|
-
*/
|
108
|
-
wait(0).then(() => {
|
109
|
-
this.input.addEventListener('input', this.handleInput);
|
110
|
-
this.input.addEventListener('change', this.handleChange);
|
111
|
-
this.input.addEventListener('blur', this.handleBlur);
|
112
|
-
});
|
113
|
-
if (Assert.isFunction(this.host.closest)) {
|
114
|
-
this.form = this.host.closest('form');
|
115
|
-
if (this.form && this.form.addEventListener) {
|
116
|
-
this.form.addEventListener('reset', this.handleReset);
|
117
|
-
}
|
118
|
-
}
|
119
|
-
}
|
120
|
-
else {
|
121
|
-
// eslint-disable-next-line no-console
|
122
|
-
console.error('ku4-validation must have a valid `for` referencing target field `id`.');
|
123
|
-
}
|
124
|
-
}
|
125
|
-
disconnectedCallback() {
|
126
|
-
if (this.input && this.input.removeEventListener) {
|
127
|
-
this.input.removeEventListener('input', this.handleInput);
|
128
|
-
this.input.removeEventListener('change', this.handleChange);
|
129
|
-
this.input.removeEventListener('blur', this.handleBlur);
|
130
|
-
}
|
131
|
-
if (this.form && this.form.removeEventListener) {
|
132
|
-
this.form.removeEventListener('reset', this.handleReset);
|
133
|
-
}
|
134
|
-
}
|
135
|
-
render() {
|
136
|
-
return h(Host, { role: "alert", "aria-live": "assertive" },
|
137
|
-
h("slot", null));
|
138
|
-
}
|
139
|
-
static get is() { return "ku4-validation"; }
|
140
|
-
static get encapsulation() { return "shadow"; }
|
141
|
-
static get originalStyleUrls() { return {
|
142
|
-
"$": ["ku4-validation.scss"]
|
143
|
-
}; }
|
144
|
-
static get styleUrls() { return {
|
145
|
-
"$": ["ku4-validation.css"]
|
146
|
-
}; }
|
147
|
-
static get properties() { return {
|
148
|
-
"for": {
|
149
|
-
"type": "string",
|
150
|
-
"mutable": false,
|
151
|
-
"complexType": {
|
152
|
-
"original": "string",
|
153
|
-
"resolved": "string",
|
154
|
-
"references": {}
|
155
|
-
},
|
156
|
-
"required": false,
|
157
|
-
"optional": false,
|
158
|
-
"docs": {
|
159
|
-
"tags": [],
|
160
|
-
"text": "The value of the id attribute of the field that this\nis the validation for."
|
161
|
-
},
|
162
|
-
"attribute": "for",
|
163
|
-
"reflect": false
|
164
|
-
},
|
165
|
-
"element": {
|
166
|
-
"type": "string",
|
167
|
-
"mutable": false,
|
168
|
-
"complexType": {
|
169
|
-
"original": "string",
|
170
|
-
"resolved": "string",
|
171
|
-
"references": {}
|
172
|
-
},
|
173
|
-
"required": false,
|
174
|
-
"optional": false,
|
175
|
-
"docs": {
|
176
|
-
"tags": [],
|
177
|
-
"text": "querySelector for an element whose value this value should match.\nThis is excellent for creating confirmation type validations, e.g.\nemail confirmations or password confirmations. See the Preview\nin the ku4-form Docs and \"Show code\" for some examples of using\nthis attribute."
|
178
|
-
},
|
179
|
-
"attribute": "element",
|
180
|
-
"reflect": false
|
181
|
-
},
|
182
|
-
"pattern": {
|
183
|
-
"type": "string",
|
184
|
-
"mutable": false,
|
185
|
-
"complexType": {
|
186
|
-
"original": "string",
|
187
|
-
"resolved": "string",
|
188
|
-
"references": {}
|
189
|
-
},
|
190
|
-
"required": false,
|
191
|
-
"optional": false,
|
192
|
-
"docs": {
|
193
|
-
"tags": [],
|
194
|
-
"text": "Validation RegExp pattern that the target field must match to\nbe considered valid. Multiple patterns can be passed delimited\nby a `space` character. e.g. pattern1 pattern2 pattern3 etc.\nIf your target field is optional you can accomplish this with\nyour pattern using \"(^$)|(YOUR-PATTERN)\". This says that the\nfield must be empty (^$) OR (YOUR-PATTERN)."
|
195
|
-
},
|
196
|
-
"attribute": "pattern",
|
197
|
-
"reflect": false,
|
198
|
-
"defaultValue": "'.*'"
|
199
|
-
},
|
200
|
-
"flags": {
|
201
|
-
"type": "string",
|
202
|
-
"mutable": false,
|
203
|
-
"complexType": {
|
204
|
-
"original": "string",
|
205
|
-
"resolved": "string",
|
206
|
-
"references": {}
|
207
|
-
},
|
208
|
-
"required": false,
|
209
|
-
"optional": false,
|
210
|
-
"docs": {
|
211
|
-
"tags": [],
|
212
|
-
"text": "Any RegExp flags that you want to include in your pattern. Multiple\npatterns can be passed delimited by a `space` character. e.g.\nusing the pattern1 pattern2 pattern3 example from the `pattern`\nproperty, you could pass \"gimsuy gim gi\". If you wanted to pass\nflags only for patterns 1 and 3 you will just skip flags for pattern2\nby typing nothing and instead typing another \"space\" e.g. \"gimsuy gi\".\nIf you wanted to skip flags for pattern1 you could start flags with a\n\"space\" e.g. \" gim gi\"."
|
213
|
-
},
|
214
|
-
"attribute": "flags",
|
215
|
-
"reflect": false,
|
216
|
-
"defaultValue": "''"
|
217
|
-
},
|
218
|
-
"values": {
|
219
|
-
"type": "string",
|
220
|
-
"mutable": false,
|
221
|
-
"complexType": {
|
222
|
-
"original": "string",
|
223
|
-
"resolved": "string",
|
224
|
-
"references": {}
|
225
|
-
},
|
226
|
-
"required": false,
|
227
|
-
"optional": false,
|
228
|
-
"docs": {
|
229
|
-
"tags": [],
|
230
|
-
"text": "Comma delimited string of valid values. This attribute is great\nif your validation rules require some very specific set of\nvalid values. An example may be if you have a select field where\nyou would like to show all possible values but some you still\nwant to be invalid."
|
231
|
-
},
|
232
|
-
"attribute": "values",
|
233
|
-
"reflect": false
|
234
|
-
},
|
235
|
-
"method": {
|
236
|
-
"type": "string",
|
237
|
-
"mutable": false,
|
238
|
-
"complexType": {
|
239
|
-
"original": "string",
|
240
|
-
"resolved": "string",
|
241
|
-
"references": {}
|
242
|
-
},
|
243
|
-
"required": false,
|
244
|
-
"optional": false,
|
245
|
-
"docs": {
|
246
|
-
"tags": [],
|
247
|
-
"text": "A reference to a named function or a function body that\ndefine a validation criteria and return `true` when the\ndefined validation criteria are satisfied.\nThe function will be called with one argument, `value`,\nthat will contain the current value of the target field.\nExample: method=\"return value === 'valid'\", or\nfunction validate(value) { return value === 'valid'; }\nmethod=\"validate(value)\""
|
248
|
-
},
|
249
|
-
"attribute": "method",
|
250
|
-
"reflect": false,
|
251
|
-
"defaultValue": "''"
|
252
|
-
},
|
253
|
-
"invalid": {
|
254
|
-
"type": "boolean",
|
255
|
-
"mutable": true,
|
256
|
-
"complexType": {
|
257
|
-
"original": "boolean",
|
258
|
-
"resolved": "boolean",
|
259
|
-
"references": {}
|
260
|
-
},
|
261
|
-
"required": false,
|
262
|
-
"optional": false,
|
263
|
-
"docs": {
|
264
|
-
"tags": [],
|
265
|
-
"text": "Set to true to display as invalid"
|
266
|
-
},
|
267
|
-
"attribute": "invalid",
|
268
|
-
"reflect": true
|
269
|
-
}
|
270
|
-
}; }
|
271
|
-
static get states() { return {
|
272
|
-
"isValid": {}
|
273
|
-
}; }
|
274
|
-
static get events() { return [{
|
275
|
-
"method": "didValidate",
|
276
|
-
"name": "validate",
|
277
|
-
"bubbles": true,
|
278
|
-
"cancelable": true,
|
279
|
-
"composed": true,
|
280
|
-
"docs": {
|
281
|
-
"tags": [],
|
282
|
-
"text": "Event fired when this validation changes from\ninvalid to valid."
|
283
|
-
},
|
284
|
-
"complexType": {
|
285
|
-
"original": "any",
|
286
|
-
"resolved": "any",
|
287
|
-
"references": {}
|
288
|
-
}
|
289
|
-
}]; }
|
290
|
-
static get methods() { return {
|
291
|
-
"validate": {
|
292
|
-
"complexType": {
|
293
|
-
"signature": "() => Promise<boolean>",
|
294
|
-
"parameters": [],
|
295
|
-
"references": {
|
296
|
-
"Promise": {
|
297
|
-
"location": "global"
|
298
|
-
}
|
299
|
-
},
|
300
|
-
"return": "Promise<boolean>"
|
301
|
-
},
|
302
|
-
"docs": {
|
303
|
-
"text": "Call to explicitly validate this validation. This method\nis called internally on change and blur of the input internally.\nThere is no default need to call this method.",
|
304
|
-
"tags": []
|
305
|
-
}
|
306
|
-
}
|
307
|
-
}; }
|
308
|
-
static get elementRef() { return "host"; }
|
309
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Business logic for form validation:
|
3
|
-
* It tests against a list of regular expressions that all must pass for this
|
4
|
-
* to return true. And IFF an element is passed it will also have to match this value.
|
5
|
-
* @param {Array<RegExp>} expressions - List of regular expressions to test against.
|
6
|
-
* @param {string} value - The value to test
|
7
|
-
* @param {Array<string>} [options] - A list of valid options that this value must match if not null
|
8
|
-
* @param {HTMLElement} [element] - An element to test if the value matches its value if not null.
|
9
|
-
*/
|
10
|
-
export default (expressions, value, options, element) => options
|
11
|
-
? options.some(v => v === value) && expressions.every(r => r.test(value))
|
12
|
-
: element
|
13
|
-
? element.value === value && expressions.every(r => r.test(value))
|
14
|
-
: expressions.every(r => r.test(value));
|
package/dist/collection/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './components';
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { identity } from 'ku4es-kernel';
|
2
|
-
import { Dto } from 'ku4es-ui-kernel';
|
3
|
-
const allowed = [''].concat([ /*allowed*/]);
|
4
|
-
export default () => {
|
5
|
-
if (!allowed.includes(location.host)) {
|
6
|
-
try {
|
7
|
-
const dto = new Dto({
|
8
|
-
tid: 'UA-72481487-1',
|
9
|
-
cid: location.host,
|
10
|
-
v: 1,
|
11
|
-
t: 'event',
|
12
|
-
ec: 'ku4web-component',
|
13
|
-
ea: 'ku4web-component-loaded',
|
14
|
-
el: location.host,
|
15
|
-
z: identity.uid()
|
16
|
-
});
|
17
|
-
fetch(`https://www.google-analytics.com/collect?${dto.toQueryString()}`, {
|
18
|
-
method: 'GET',
|
19
|
-
mode: 'cors',
|
20
|
-
headers: { 'User-Agent': navigator.userAgent }
|
21
|
-
});
|
22
|
-
}
|
23
|
-
catch (e) {
|
24
|
-
return null;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
};
|
@@ -1,4 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Stencil Client Patch Esm v2.8.1 | MIT Licensed | https://stenciljs.com
|
3
|
-
*/
|
4
|
-
var __assign=undefined&&undefined.__assign||function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector="";};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r);}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE;}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return "\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return {start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return {start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t);}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else {if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s);}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value;}));}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0);})),!t)return "break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return [];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t});})),t++;})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o});}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.substr(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement;}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors);})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return ":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return {original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return !1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t));}));}function reScope(e,t){var r=e.template.map((function(r){return "string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\."+t,"."+r)}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t);}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t);})).observe(document.head,{childList:!0});}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove();}})).catch((function(e){console.error(e);}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1;}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}));}));})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal();}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal();},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t=s.scopeId+"-"+this.count,o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e);},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n);}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes);},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document));}("undefined"!=typeof window&&window);
|