@pod-os/elements 0.8.0 → 0.9.0
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/BrokenFile-b01d72da.js +226 -0
- package/dist/cjs/ResourceAware-f1aac952.js +7 -0
- package/dist/cjs/elements.cjs.js +1 -1
- package/dist/{esm/ion-app_48.entry.js → cjs/index-74c56a41.js} +8 -4122
- package/dist/cjs/ion-app_25.cjs.entry.js +3043 -0
- package/dist/cjs/ion-badge_7.cjs.entry.js +258 -0
- package/dist/cjs/ion-item-divider_3.cjs.entry.js +109 -0
- package/dist/cjs/ion-item_3.cjs.entry.js +367 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pos-app-document-viewer.cjs.entry.js +28 -0
- package/dist/cjs/pos-app-generic.cjs.entry.js +16 -0
- package/dist/cjs/pos-app-image-viewer.cjs.entry.js +29 -0
- package/dist/cjs/pos-app-rdf-document.cjs.entry.js +16 -0
- package/dist/cjs/pos-description_2.cjs.entry.js +40 -0
- package/dist/cjs/pos-document.cjs.entry.js +67 -0
- package/dist/cjs/pos-relations_2.cjs.entry.js +45 -0
- package/dist/cjs/pos-subjects.cjs.entry.js +28 -0
- package/dist/collection/apps/{pos-app-pdf-viewer/pos-app-pdf-viewer.js → pos-app-document-viewer/pos-app-document-viewer.js} +3 -3
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/{pos-pdf/pos-pdf.css → pos-document/pos-document.css} +0 -0
- package/dist/collection/components/{pos-pdf/pos-pdf.js → pos-document/pos-document.js} +4 -4
- package/dist/collection/components/pos-type-router/pos-type-router.js +3 -12
- package/dist/collection/components/pos-type-router/selectAppForTypes.js +24 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +2 -2
- package/dist/components/pos-app-browser.js +46 -184
- package/dist/components/pos-app-document-viewer.d.ts +11 -0
- package/dist/components/{pos-app-pdf-viewer2.js → pos-app-document-viewer.js} +50 -47
- package/dist/components/pos-app-generic.js +192 -1
- package/dist/components/pos-app-image-viewer.js +160 -1
- package/dist/components/pos-app-rdf-document.js +168 -1
- package/dist/components/{pos-pdf.d.ts → pos-document.d.ts} +4 -4
- package/dist/components/pos-document.js +6 -0
- package/dist/components/{pos-pdf2.js → pos-document2.js} +8 -8
- package/dist/components/pos-router2.js +18 -180
- package/dist/components/pos-type-router2.js +28 -217
- package/dist/elements/elements.esm.js +1 -1
- package/dist/elements/{p-145ab600.entry.js → p-0ed0e3ba.entry.js} +1 -1
- package/dist/elements/{p-5808c505.js → p-12407693.js} +1 -1
- package/dist/elements/p-1688668c.entry.js +1 -0
- package/dist/elements/{p-85d6f579.entry.js → p-16afe2d7.entry.js} +1 -1
- package/dist/elements/{p-f4b358b2.entry.js → p-1a9cdd0b.entry.js} +1 -1
- package/dist/elements/{p-8ed61030.entry.js → p-21a6c0d5.entry.js} +1 -1
- package/dist/elements/{p-1e3bbab1.entry.js → p-24fffcb6.entry.js} +1 -1
- package/dist/elements/p-2ca5f7f2.entry.js +5 -0
- package/dist/elements/{p-7fc32e8d.entry.js → p-2eced374.entry.js} +1 -1
- package/dist/elements/p-301096a8.entry.js +1 -0
- package/dist/elements/{p-2a9a9bb1.entry.js → p-35faa0fa.entry.js} +1 -1
- package/dist/elements/{p-f851b91a.js → p-37c43290.js} +2 -2
- package/dist/elements/p-3f0dec28.entry.js +1 -0
- package/dist/elements/p-410c567f.entry.js +1 -0
- package/dist/elements/p-417ecc9e.js +1 -0
- package/dist/elements/p-43717c61.js +1 -0
- package/dist/elements/{p-b57b6dfe.entry.js → p-573e7d6e.entry.js} +1 -1
- package/dist/elements/{p-ec8c13e0.entry.js → p-59680588.entry.js} +1 -1
- package/dist/elements/p-5fe41c08.entry.js +1 -0
- package/dist/elements/p-68110709.entry.js +1 -0
- package/dist/elements/{p-29c0f03f.js → p-6ed079a5.js} +2 -2
- package/dist/elements/p-709fd743.entry.js +1 -0
- package/dist/elements/p-73648481.entry.js +1 -0
- package/dist/elements/p-784b06b3.entry.js +1 -0
- package/dist/elements/p-84cc1417.entry.js +1 -0
- package/dist/elements/p-8596ddbc.js +4 -0
- package/dist/elements/{p-b0d8c4f0.entry.js → p-8c0124df.entry.js} +1 -1
- package/dist/elements/{p-020dee35.entry.js → p-a48e16ba.entry.js} +1 -1
- package/dist/elements/p-ab11bb11.js +4 -0
- package/dist/elements/{p-8a24508e.entry.js → p-ae87571c.entry.js} +1 -1
- package/dist/elements/p-b2acbe46.entry.js +1 -0
- package/dist/elements/p-babdb154.entry.js +9 -0
- package/dist/elements/{p-9c719139.js → p-bb128f00.js} +1 -1
- package/dist/elements/{p-fe753f07.entry.js → p-c442a411.entry.js} +1 -1
- package/dist/elements/{p-b36873af.entry.js → p-c4d119d2.entry.js} +1 -1
- package/dist/elements/p-eea7ce93.js +116 -0
- package/dist/elements/p-f72edc68.entry.js +1 -0
- package/dist/elements/{p-6987a85b.entry.js → p-ffb33569.entry.js} +1 -1
- package/dist/esm/BrokenFile-e1e68cb6.js +223 -0
- package/dist/esm/ResourceAware-845001bb.js +5 -0
- package/dist/esm/{data-62c81c24.js → data-2c0eab05.js} +1 -1
- package/dist/esm/elements.js +1 -1
- package/dist/esm/{index-ebf7f059.js → index-38d8370e.js} +1 -1
- package/dist/esm/{index-1f3d8582.js → index-47f5cd9a.js} +1 -1
- package/dist/{cjs/ion-app_48.cjs.entry.js → esm/index-5c6f4d9d.js} +6 -4174
- package/dist/esm/{index-65ecd543.js → index-753825bf.js} +1 -1
- package/dist/esm/{input-shims-8a389148.js → input-shims-167ef062.js} +2 -2
- package/dist/esm/ion-accordion.entry.js +1 -1
- package/dist/esm/ion-app_25.entry.js +3015 -0
- package/dist/esm/ion-back-button.entry.js +1 -1
- package/dist/esm/ion-badge_7.entry.js +248 -0
- package/dist/esm/ion-breadcrumb.entry.js +1 -1
- package/dist/esm/ion-datetime-button.entry.js +2 -2
- package/dist/esm/ion-datetime.entry.js +3 -3
- package/dist/esm/ion-fab-button.entry.js +1 -1
- package/dist/esm/ion-infinite-scroll.entry.js +2 -2
- package/dist/esm/ion-input.entry.js +1 -1
- package/dist/esm/ion-item-divider_3.entry.js +103 -0
- package/dist/esm/ion-item-sliding.entry.js +2 -2
- package/dist/esm/ion-item_3.entry.js +361 -0
- package/dist/esm/ion-menu-button.entry.js +1 -1
- package/dist/esm/ion-modal.entry.js +2 -2
- package/dist/esm/ion-range.entry.js +2 -2
- package/dist/esm/ion-refresher-content.entry.js +1 -1
- package/dist/esm/ion-refresher.entry.js +2 -2
- package/dist/esm/ion-reorder-group.entry.js +2 -2
- package/dist/esm/ion-reorder.entry.js +1 -1
- package/dist/esm/ion-toggle.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pos-app-document-viewer.entry.js +24 -0
- package/dist/esm/pos-app-generic.entry.js +12 -0
- package/dist/esm/pos-app-image-viewer.entry.js +25 -0
- package/dist/esm/pos-app-rdf-document.entry.js +12 -0
- package/dist/esm/pos-description_2.entry.js +35 -0
- package/dist/esm/pos-document.entry.js +63 -0
- package/dist/esm/pos-relations_2.entry.js +40 -0
- package/dist/esm/pos-subjects.entry.js +24 -0
- package/dist/esm/{status-tap-33623c88.js → status-tap-ce25f9e5.js} +2 -2
- package/dist/types/apps/{pos-app-pdf-viewer/pos-app-pdf-viewer.d.ts → pos-app-document-viewer/pos-app-document-viewer.d.ts} +1 -1
- package/dist/types/components/{pos-pdf/pos-pdf.d.ts → pos-document/pos-document.d.ts} +1 -1
- package/dist/types/components/pos-type-router/selectAppForTypes.d.ts +8 -0
- package/dist/types/components.d.ts +40 -40
- package/package.json +1 -1
- package/dist/components/pos-app-generic2.js +0 -194
- package/dist/components/pos-app-image-viewer2.js +0 -162
- package/dist/components/pos-app-pdf-viewer.d.ts +0 -11
- package/dist/components/pos-app-pdf-viewer.js +0 -6
- package/dist/components/pos-app-rdf-document2.js +0 -170
- package/dist/components/pos-pdf.js +0 -6
- package/dist/elements/p-10cae467.js +0 -4
- package/dist/elements/p-19e4a688.js +0 -4
- package/dist/elements/p-5f811ad7.entry.js +0 -1
- package/dist/elements/p-7a79a3cd.entry.js +0 -128
- package/dist/elements/p-b9a87655.entry.js +0 -1
|
@@ -1,2978 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { g as getIonMode$1, c as config, a as isPlatform } from './ionic-global-a2c7ad8b.js';
|
|
3
|
-
import { c as createColorClasses$1, o as openURL, h as hostContext } from './theme-7cf2cab0.js';
|
|
4
|
-
import { h as hasShadowDom, i as inheritAriaAttributes, a as inheritAttributes$1, c as componentOnReady, b as clamp, r as raf, d as debounceEvent } from './helpers-aeff219b.js';
|
|
5
|
-
import { p as printIonWarning, a as printIonError } from './index-1f3d8582.js';
|
|
6
|
-
import { i as isRTL$1 } from './dir-defb16c6.js';
|
|
7
|
-
import { f as findIonContent, p as printIonContentErrorMsg, g as getScrollElement } from './index-ebf7f059.js';
|
|
8
|
-
import { c as createKeyboardController } from './keyboard-controller-33693bc2.js';
|
|
9
|
-
import { c as chevronForward, a as arrowBackSharp, b as closeCircle, d as closeSharp, s as searchOutline, e as searchSharp } from './index-65ecd543.js';
|
|
10
|
-
import './index-0dbaca1a.js';
|
|
11
|
-
|
|
12
|
-
const appCss = "html.plt-mobile ion-app{user-select:none}html.plt-mobile ion-app [contenteditable]{user-select:text}ion-app.force-statusbar-padding{--ion-safe-area-top:20px}";
|
|
13
|
-
|
|
14
|
-
const App = class {
|
|
15
|
-
constructor(hostRef) {
|
|
16
|
-
registerInstance(this, hostRef);
|
|
17
|
-
}
|
|
18
|
-
componentDidLoad() {
|
|
19
|
-
{
|
|
20
|
-
rIC(async () => {
|
|
21
|
-
const isHybrid = isPlatform(window, 'hybrid');
|
|
22
|
-
if (!config.getBoolean('_testing')) {
|
|
23
|
-
import('./index-b212db1c.js').then((module) => module.startTapClick(config));
|
|
24
|
-
}
|
|
25
|
-
if (config.getBoolean('statusTap', isHybrid)) {
|
|
26
|
-
import('./status-tap-33623c88.js').then((module) => module.startStatusTap());
|
|
27
|
-
}
|
|
28
|
-
if (config.getBoolean('inputShims', needInputShims())) {
|
|
29
|
-
/**
|
|
30
|
-
* needInputShims() ensures that only iOS and Android
|
|
31
|
-
* platforms proceed into this block.
|
|
32
|
-
*/
|
|
33
|
-
const platform = isPlatform(window, 'ios') ? 'ios' : 'android';
|
|
34
|
-
import('./input-shims-8a389148.js').then((module) => module.startInputShims(config, platform));
|
|
35
|
-
}
|
|
36
|
-
const hardwareBackButtonModule = await import('./hardware-back-button-242191a7.js');
|
|
37
|
-
if (config.getBoolean('hardwareBackButton', isHybrid)) {
|
|
38
|
-
hardwareBackButtonModule.startHardwareBackButton();
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
hardwareBackButtonModule.blockHardwareBackButton();
|
|
42
|
-
}
|
|
43
|
-
if (typeof window !== 'undefined') {
|
|
44
|
-
import('./keyboard-413afe04.js').then((module) => module.startKeyboardAssist(window));
|
|
45
|
-
}
|
|
46
|
-
import('./focus-visible-78d55799.js').then((module) => (this.focusVisible = module.startFocusVisible()));
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* @internal
|
|
52
|
-
* Used to set focus on an element that uses `ion-focusable`.
|
|
53
|
-
* Do not use this if focusing the element as a result of a keyboard
|
|
54
|
-
* event as the focus utility should handle this for us. This method
|
|
55
|
-
* should be used when we want to programmatically focus an element as
|
|
56
|
-
* a result of another user action. (Ex: We focus the first element
|
|
57
|
-
* inside of a popover when the user presents it, but the popover is not always
|
|
58
|
-
* presented as a result of keyboard action.)
|
|
59
|
-
*/
|
|
60
|
-
async setFocus(elements) {
|
|
61
|
-
if (this.focusVisible) {
|
|
62
|
-
this.focusVisible.setFocus(elements);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
render() {
|
|
66
|
-
const mode = getIonMode$1(this);
|
|
67
|
-
return (h(Host, { class: {
|
|
68
|
-
[mode]: true,
|
|
69
|
-
'ion-page': true,
|
|
70
|
-
'force-statusbar-padding': config.getBoolean('_forceStatusbarPadding'),
|
|
71
|
-
} }));
|
|
72
|
-
}
|
|
73
|
-
get el() { return getElement$1(this); }
|
|
74
|
-
};
|
|
75
|
-
const needInputShims = () => {
|
|
76
|
-
/**
|
|
77
|
-
* iOS always needs input shims
|
|
78
|
-
*/
|
|
79
|
-
const needsShimsIOS = isPlatform(window, 'ios') && isPlatform(window, 'mobile');
|
|
80
|
-
if (needsShimsIOS) {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Android only needs input shims when running
|
|
85
|
-
* in the browser and only if the browser is using the
|
|
86
|
-
* new Chrome 108+ resize behavior: https://developer.chrome.com/blog/viewport-resize-behavior/
|
|
87
|
-
*/
|
|
88
|
-
const isAndroidMobileWeb = isPlatform(window, 'android') && isPlatform(window, 'mobileweb');
|
|
89
|
-
if (isAndroidMobileWeb) {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
return false;
|
|
93
|
-
};
|
|
94
|
-
const rIC = (callback) => {
|
|
95
|
-
if ('requestIdleCallback' in window) {
|
|
96
|
-
window.requestIdleCallback(callback);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
setTimeout(callback, 32);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
App.style = appCss;
|
|
103
|
-
|
|
104
|
-
const badgeIosCss = ":host{--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff);--padding-top:3px;--padding-end:8px;--padding-bottom:3px;--padding-start:8px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:inline-block;min-width:10px;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);font-size:13px;font-weight:bold;line-height:1;text-align:center;white-space:nowrap;contain:content;vertical-align:baseline}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(:empty){display:none}:host{border-radius:10px}";
|
|
105
|
-
|
|
106
|
-
const badgeMdCss = ":host{--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff);--padding-top:3px;--padding-end:8px;--padding-bottom:3px;--padding-start:8px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:inline-block;min-width:10px;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);font-size:13px;font-weight:bold;line-height:1;text-align:center;white-space:nowrap;contain:content;vertical-align:baseline}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(:empty){display:none}:host{--padding-top:3px;--padding-end:4px;--padding-bottom:4px;--padding-start:4px;border-radius:4px}";
|
|
107
|
-
|
|
108
|
-
const Badge = class {
|
|
109
|
-
constructor(hostRef) {
|
|
110
|
-
registerInstance(this, hostRef);
|
|
111
|
-
}
|
|
112
|
-
render() {
|
|
113
|
-
const mode = getIonMode$1(this);
|
|
114
|
-
return (h(Host, { class: createColorClasses$1(this.color, {
|
|
115
|
-
[mode]: true,
|
|
116
|
-
}) }, h("slot", null)));
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
Badge.style = {
|
|
120
|
-
ios: badgeIosCss,
|
|
121
|
-
md: badgeMdCss
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const buttonIosCss = ":host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #3880ff);--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;box-sizing:border-box;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.button-native{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.button-native::-moz-focus-inner{border:0}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted(ion-icon){font-size:1.4em;pointer-events:none}::slotted(ion-icon[slot=start]){margin-left:-0.3em;margin-right:0.3em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em}}::slotted(ion-icon[slot=end]){margin-left:0.3em;margin-right:-0.2em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em}}::slotted(ion-icon[slot=icon-only]){font-size:1.8em}ion-ripple-effect{color:var(--ripple-color)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}:host(.ion-activated){color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){:host(:hover){color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.button-solid.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.button-outline.ion-color) .button-native{border-color:var(--ion-color-base);background:transparent;color:var(--ion-color-base)}:host(.button-clear.ion-color) .button-native{background:transparent;color:var(--ion-color-base)}:host(.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{color:var(--ion-toolbar-color, var(--color))}:host(.button-outline.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{border-color:var(--ion-toolbar-color, var(--color, var(--border-color)))}:host(.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--background));color:var(--ion-toolbar-background, var(--color))}:host{--border-radius:10px;--padding-top:0;--padding-bottom:0;--padding-start:1em;--padding-end:1em;--transition:background-color, opacity 100ms linear;margin-left:2px;margin-right:2px;margin-top:4px;margin-bottom:4px;height:2.8em;font-size:16px;font-weight:500;letter-spacing:-0.03em}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px}}:host(.button-solid){--background-activated:var(--ion-color-primary-shade, #3171e0);--background-focused:var(--ion-color-primary-shade, #3171e0);--background-hover:var(--ion-color-primary-tint, #4c8dff);--background-activated-opacity:1;--background-focused-opacity:1;--background-hover-opacity:1}:host(.button-outline){--border-radius:10px;--border-width:1px;--border-style:solid;--background-activated:var(--ion-color-primary, #3880ff);--background-focused:var(--ion-color-primary, #3880ff);--background-hover:transparent;--background-focused-opacity:.1;--color-activated:var(--ion-color-primary-contrast, #fff)}:host(.button-clear){--background-activated:transparent;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:transparent;--background-focused-opacity:.1;font-size:17px;font-weight:normal;letter-spacing:0}:host(.button-large){--border-radius:12px;--padding-top:0;--padding-start:1em;--padding-end:1em;--padding-bottom:0;height:2.8em;font-size:20px}:host(.button-small){--border-radius:6px;--padding-top:0;--padding-start:0.9em;--padding-end:0.9em;--padding-bottom:0;height:2.1em;font-size:13px}:host(.button-round){--border-radius:64px;--padding-top:0;--padding-start:26px;--padding-end:26px;--padding-bottom:0}:host(.button-strong){font-weight:600}:host(.button-clear.ion-activated){opacity:0.4}:host(.button-outline.ion-activated.ion-color) .button-native{color:var(--ion-color-contrast)}:host(.button-outline.ion-activated.ion-color) .button-native::after{background:var(--ion-color-base)}:host(.button-solid.ion-color.ion-activated) .button-native::after{background:var(--ion-color-shade)}:host(.button-outline.ion-focused.ion-color) .button-native,:host(.button-clear.ion-focused.ion-color) .button-native{color:var(--ion-color-base)}:host(.button-outline.ion-focused.ion-color) .button-native::after,:host(.button-clear.ion-focused.ion-color) .button-native::after{background:var(--ion-color-base)}:host(.button-solid.ion-color.ion-focused) .button-native::after{background:var(--ion-color-shade)}@media (any-hover: hover){:host(.button-clear:hover),:host(.button-outline:hover){opacity:0.6}:host(.button-clear.ion-color:hover) .button-native,:host(.button-outline.ion-color:hover) .button-native{color:var(--ion-color-base)}:host(.button-clear.ion-color:hover) .button-native::after,:host(.button-outline.ion-color:hover) .button-native::after{background:transparent}:host(.button-solid.ion-color:hover) .button-native::after{background:var(--ion-color-tint)}:host(:hover.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native::after{background:#fff;opacity:0.1}}";
|
|
125
|
-
|
|
126
|
-
const buttonMdCss = ":host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #3880ff);--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;box-sizing:border-box;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.button-native{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.button-native::-moz-focus-inner{border:0}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted(ion-icon){font-size:1.4em;pointer-events:none}::slotted(ion-icon[slot=start]){margin-left:-0.3em;margin-right:0.3em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em}}::slotted(ion-icon[slot=end]){margin-left:0.3em;margin-right:-0.2em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em}}::slotted(ion-icon[slot=icon-only]){font-size:1.8em}ion-ripple-effect{color:var(--ripple-color)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}:host(.ion-activated){color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){:host(:hover){color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.button-solid.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.button-outline.ion-color) .button-native{border-color:var(--ion-color-base);background:transparent;color:var(--ion-color-base)}:host(.button-clear.ion-color) .button-native{background:transparent;color:var(--ion-color-base)}:host(.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{color:var(--ion-toolbar-color, var(--color))}:host(.button-outline.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{border-color:var(--ion-toolbar-color, var(--color, var(--border-color)))}:host(.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--background));color:var(--ion-toolbar-background, var(--color))}:host{--border-radius:4px;--padding-top:0;--padding-bottom:0;--padding-start:1.1em;--padding-end:1.1em;--transition:box-shadow 280ms cubic-bezier(.4, 0, .2, 1),\n background-color 15ms linear,\n color 15ms linear;margin-left:2px;margin-right:2px;margin-top:4px;margin-bottom:4px;height:36px;font-size:14px;font-weight:500;letter-spacing:0.06em;text-transform:uppercase}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px}}:host(.button-solid){--background-activated:transparent;--background-hover:var(--ion-color-primary-contrast, #fff);--background-focused:var(--ion-color-primary-contrast, #fff);--background-activated-opacity:0;--background-focused-opacity:.24;--background-hover-opacity:.08;--box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)}:host(.button-solid.ion-activated){--box-shadow:0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12)}:host(.button-outline){--border-width:2px;--border-style:solid;--box-shadow:none;--background-activated:transparent;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:var(--ion-color-primary, #3880ff);--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04}:host(.button-outline.ion-activated.ion-color) .button-native{background:transparent}:host(.button-clear){--background-activated:transparent;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:var(--ion-color-primary, #3880ff);--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04}:host(.button-round){--border-radius:64px;--padding-top:0;--padding-start:26px;--padding-end:26px;--padding-bottom:0}:host(.button-large){--padding-top:0;--padding-start:1em;--padding-end:1em;--padding-bottom:0;height:2.8em;font-size:20px}:host(.button-small){--padding-top:0;--padding-start:0.9em;--padding-end:0.9em;--padding-bottom:0;height:2.1em;font-size:13px}:host(.button-strong){font-weight:bold}::slotted(ion-icon[slot=icon-only]){padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host(.button-solid.ion-color.ion-focused) .button-native::after{background:var(--ion-color-contrast)}:host(.button-clear.ion-color.ion-focused) .button-native::after,:host(.button-outline.ion-color.ion-focused) .button-native::after{background:var(--ion-color-base)}@media (any-hover: hover){:host(.button-solid.ion-color:hover) .button-native::after{background:var(--ion-color-contrast)}:host(.button-clear.ion-color:hover) .button-native::after,:host(.button-outline.ion-color:hover) .button-native::after{background:var(--ion-color-base)}}";
|
|
127
|
-
|
|
128
|
-
const Button = class {
|
|
129
|
-
constructor(hostRef) {
|
|
130
|
-
registerInstance(this, hostRef);
|
|
131
|
-
this.ionFocus = createEvent(this, "ionFocus", 7);
|
|
132
|
-
this.ionBlur = createEvent(this, "ionBlur", 7);
|
|
133
|
-
this.inItem = false;
|
|
134
|
-
this.inListHeader = false;
|
|
135
|
-
this.inToolbar = false;
|
|
136
|
-
this.inheritedAttributes = {};
|
|
137
|
-
/**
|
|
138
|
-
* The type of button.
|
|
139
|
-
*/
|
|
140
|
-
this.buttonType = 'button';
|
|
141
|
-
/**
|
|
142
|
-
* If `true`, the user cannot interact with the button.
|
|
143
|
-
*/
|
|
144
|
-
this.disabled = false;
|
|
145
|
-
/**
|
|
146
|
-
* When using a router, it specifies the transition direction when navigating to
|
|
147
|
-
* another page using `href`.
|
|
148
|
-
*/
|
|
149
|
-
this.routerDirection = 'forward';
|
|
150
|
-
/**
|
|
151
|
-
* If `true`, activates a button with a heavier font weight.
|
|
152
|
-
*/
|
|
153
|
-
this.strong = false;
|
|
154
|
-
/**
|
|
155
|
-
* The type of the button.
|
|
156
|
-
*/
|
|
157
|
-
this.type = 'button';
|
|
158
|
-
this.handleClick = (ev) => {
|
|
159
|
-
const { el } = this;
|
|
160
|
-
if (this.type === 'button') {
|
|
161
|
-
openURL(this.href, ev, this.routerDirection, this.routerAnimation);
|
|
162
|
-
}
|
|
163
|
-
else if (hasShadowDom(el)) {
|
|
164
|
-
// this button wants to specifically submit a form
|
|
165
|
-
// climb up the dom to see if we're in a <form>
|
|
166
|
-
// and if so, then use JS to submit it
|
|
167
|
-
let formEl = this.findForm();
|
|
168
|
-
const { form } = this;
|
|
169
|
-
if (!formEl && form !== undefined) {
|
|
170
|
-
/**
|
|
171
|
-
* The developer specified a form selector for
|
|
172
|
-
* the button to submit, but it was not found.
|
|
173
|
-
*/
|
|
174
|
-
if (typeof form === 'string') {
|
|
175
|
-
printIonWarning(`Form with selector: "#${form}" could not be found. Verify that the id is correct and the form is rendered in the DOM.`, el);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
printIonWarning(`The provided "form" element is invalid. Verify that the form is a HTMLFormElement and rendered in the DOM.`, el);
|
|
179
|
-
}
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
if (!formEl) {
|
|
183
|
-
/**
|
|
184
|
-
* If the form element is not set, the button may be inside
|
|
185
|
-
* of a form element. Query the closest form element to the button.
|
|
186
|
-
*/
|
|
187
|
-
formEl = el.closest('form');
|
|
188
|
-
}
|
|
189
|
-
if (formEl) {
|
|
190
|
-
ev.preventDefault();
|
|
191
|
-
const fakeButton = document.createElement('button');
|
|
192
|
-
fakeButton.type = this.type;
|
|
193
|
-
fakeButton.style.display = 'none';
|
|
194
|
-
formEl.appendChild(fakeButton);
|
|
195
|
-
fakeButton.click();
|
|
196
|
-
fakeButton.remove();
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
this.onFocus = () => {
|
|
201
|
-
this.ionFocus.emit();
|
|
202
|
-
};
|
|
203
|
-
this.onBlur = () => {
|
|
204
|
-
this.ionBlur.emit();
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
componentWillLoad() {
|
|
208
|
-
this.inToolbar = !!this.el.closest('ion-buttons');
|
|
209
|
-
this.inListHeader = !!this.el.closest('ion-list-header');
|
|
210
|
-
this.inItem = !!this.el.closest('ion-item') || !!this.el.closest('ion-item-divider');
|
|
211
|
-
this.inheritedAttributes = inheritAriaAttributes(this.el);
|
|
212
|
-
}
|
|
213
|
-
get hasIconOnly() {
|
|
214
|
-
return !!this.el.querySelector('[slot="icon-only"]');
|
|
215
|
-
}
|
|
216
|
-
get rippleType() {
|
|
217
|
-
const hasClearFill = this.fill === undefined || this.fill === 'clear';
|
|
218
|
-
// If the button is in a toolbar, has a clear fill (which is the default)
|
|
219
|
-
// and only has an icon we use the unbounded "circular" ripple effect
|
|
220
|
-
if (hasClearFill && this.hasIconOnly && this.inToolbar) {
|
|
221
|
-
return 'unbounded';
|
|
222
|
-
}
|
|
223
|
-
return 'bounded';
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Finds the form element based on the provided `form` selector
|
|
227
|
-
* or element reference provided.
|
|
228
|
-
*/
|
|
229
|
-
findForm() {
|
|
230
|
-
const { form } = this;
|
|
231
|
-
if (form instanceof HTMLFormElement) {
|
|
232
|
-
return form;
|
|
233
|
-
}
|
|
234
|
-
if (typeof form === 'string') {
|
|
235
|
-
const el = document.getElementById(form);
|
|
236
|
-
if (el instanceof HTMLFormElement) {
|
|
237
|
-
return el;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
render() {
|
|
243
|
-
const mode = getIonMode$1(this);
|
|
244
|
-
const { buttonType, type, disabled, rel, target, size, href, color, expand, hasIconOnly, shape, strong, inheritedAttributes, } = this;
|
|
245
|
-
const finalSize = size === undefined && this.inItem ? 'small' : size;
|
|
246
|
-
const TagType = href === undefined ? 'button' : 'a';
|
|
247
|
-
const attrs = TagType === 'button'
|
|
248
|
-
? { type }
|
|
249
|
-
: {
|
|
250
|
-
download: this.download,
|
|
251
|
-
href,
|
|
252
|
-
rel,
|
|
253
|
-
target,
|
|
254
|
-
};
|
|
255
|
-
let fill = this.fill;
|
|
256
|
-
/**
|
|
257
|
-
* We check both undefined and null to
|
|
258
|
-
* work around https://github.com/ionic-team/stencil/issues/3586.
|
|
259
|
-
*/
|
|
260
|
-
if (fill == null) {
|
|
261
|
-
fill = this.inToolbar || this.inListHeader ? 'clear' : 'solid';
|
|
262
|
-
}
|
|
263
|
-
return (h(Host, { onClick: this.handleClick, "aria-disabled": disabled ? 'true' : null, class: createColorClasses$1(color, {
|
|
264
|
-
[mode]: true,
|
|
265
|
-
[buttonType]: true,
|
|
266
|
-
[`${buttonType}-${expand}`]: expand !== undefined,
|
|
267
|
-
[`${buttonType}-${finalSize}`]: finalSize !== undefined,
|
|
268
|
-
[`${buttonType}-${shape}`]: shape !== undefined,
|
|
269
|
-
[`${buttonType}-${fill}`]: true,
|
|
270
|
-
[`${buttonType}-strong`]: strong,
|
|
271
|
-
'in-toolbar': hostContext('ion-toolbar', this.el),
|
|
272
|
-
'in-toolbar-color': hostContext('ion-toolbar[color]', this.el),
|
|
273
|
-
'button-has-icon-only': hasIconOnly,
|
|
274
|
-
'button-disabled': disabled,
|
|
275
|
-
'ion-activatable': true,
|
|
276
|
-
'ion-focusable': true,
|
|
277
|
-
}) }, h(TagType, Object.assign({}, attrs, { class: "button-native", part: "native", disabled: disabled, onFocus: this.onFocus, onBlur: this.onBlur }, inheritedAttributes), h("span", { class: "button-inner" }, h("slot", { name: "icon-only" }), h("slot", { name: "start" }), h("slot", null), h("slot", { name: "end" })), mode === 'md' && h("ion-ripple-effect", { type: this.rippleType }))));
|
|
278
|
-
}
|
|
279
|
-
get el() { return getElement$1(this); }
|
|
280
|
-
};
|
|
281
|
-
Button.style = {
|
|
282
|
-
ios: buttonIosCss,
|
|
283
|
-
md: buttonMdCss
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
const cardIosCss = ":host{--ion-safe-area-left:0px;--ion-safe-area-right:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.card-disabled){cursor:default;opacity:0.3;pointer-events:none}.card-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:inherit}.card-native::-moz-focus-inner{border:0}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}ion-ripple-effect{color:var(--ripple-color)}:host{--background:var(--ion-card-background, var(--ion-item-background, var(--ion-background-color, #fff)));--color:var(--ion-card-color, var(--ion-item-color, var(--ion-color-step-600, #666666)));margin-left:16px;margin-right:16px;margin-top:24px;margin-bottom:24px;border-radius:8px;transition:transform 500ms cubic-bezier(0.12, 0.72, 0.29, 1);font-size:14px;box-shadow:0 4px 16px rgba(0, 0, 0, 0.12)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px}}:host(.ion-activated){transform:scale3d(0.97, 0.97, 1)}";
|
|
287
|
-
|
|
288
|
-
const cardMdCss = ":host{--ion-safe-area-left:0px;--ion-safe-area-right:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.card-disabled){cursor:default;opacity:0.3;pointer-events:none}.card-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:inherit}.card-native::-moz-focus-inner{border:0}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}ion-ripple-effect{color:var(--ripple-color)}:host{--background:var(--ion-card-background, var(--ion-item-background, var(--ion-background-color, #fff)));--color:var(--ion-card-color, var(--ion-item-color, var(--ion-color-step-550, #737373)));margin-left:10px;margin-right:10px;margin-top:10px;margin-bottom:10px;border-radius:4px;font-size:14px;box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}";
|
|
289
|
-
|
|
290
|
-
const Card = class {
|
|
291
|
-
constructor(hostRef) {
|
|
292
|
-
registerInstance(this, hostRef);
|
|
293
|
-
this.inheritedAriaAttributes = {};
|
|
294
|
-
/**
|
|
295
|
-
* If `true`, a button tag will be rendered and the card will be tappable.
|
|
296
|
-
*/
|
|
297
|
-
this.button = false;
|
|
298
|
-
/**
|
|
299
|
-
* The type of the button. Only used when an `onclick` or `button` property is present.
|
|
300
|
-
*/
|
|
301
|
-
this.type = 'button';
|
|
302
|
-
/**
|
|
303
|
-
* If `true`, the user cannot interact with the card.
|
|
304
|
-
*/
|
|
305
|
-
this.disabled = false;
|
|
306
|
-
/**
|
|
307
|
-
* When using a router, it specifies the transition direction when navigating to
|
|
308
|
-
* another page using `href`.
|
|
309
|
-
*/
|
|
310
|
-
this.routerDirection = 'forward';
|
|
311
|
-
}
|
|
312
|
-
componentWillLoad() {
|
|
313
|
-
this.inheritedAriaAttributes = inheritAttributes$1(this.el, ['aria-label']);
|
|
314
|
-
}
|
|
315
|
-
isClickable() {
|
|
316
|
-
return this.href !== undefined || this.button;
|
|
317
|
-
}
|
|
318
|
-
renderCard(mode) {
|
|
319
|
-
const clickable = this.isClickable();
|
|
320
|
-
if (!clickable) {
|
|
321
|
-
return [h("slot", null)];
|
|
322
|
-
}
|
|
323
|
-
const { href, routerAnimation, routerDirection, inheritedAriaAttributes } = this;
|
|
324
|
-
const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div';
|
|
325
|
-
const attrs = TagType === 'button'
|
|
326
|
-
? { type: this.type }
|
|
327
|
-
: {
|
|
328
|
-
download: this.download,
|
|
329
|
-
href: this.href,
|
|
330
|
-
rel: this.rel,
|
|
331
|
-
target: this.target,
|
|
332
|
-
};
|
|
333
|
-
return (h(TagType, Object.assign({}, attrs, inheritedAriaAttributes, { class: "card-native", part: "native", disabled: this.disabled, onClick: (ev) => openURL(href, ev, routerDirection, routerAnimation) }), h("slot", null), clickable && mode === 'md' && h("ion-ripple-effect", null)));
|
|
334
|
-
}
|
|
335
|
-
render() {
|
|
336
|
-
const mode = getIonMode$1(this);
|
|
337
|
-
return (h(Host, { class: createColorClasses$1(this.color, {
|
|
338
|
-
[mode]: true,
|
|
339
|
-
'card-disabled': this.disabled,
|
|
340
|
-
'ion-activatable': this.isClickable(),
|
|
341
|
-
}) }, this.renderCard(mode)));
|
|
342
|
-
}
|
|
343
|
-
get el() { return getElement$1(this); }
|
|
344
|
-
};
|
|
345
|
-
Card.style = {
|
|
346
|
-
ios: cardIosCss,
|
|
347
|
-
md: cardMdCss
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
const cardContentIosCss = "ion-card-content{display:block;position:relative}.card-content-ios{padding-left:20px;padding-right:20px;padding-top:20px;padding-bottom:20px;font-size:16px;line-height:1.4}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.card-content-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px}}.card-content-ios h1{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}.card-content-ios h2{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:normal}.card-content-ios h3,.card-content-ios h4,.card-content-ios h5,.card-content-ios h6{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:normal}.card-content-ios p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px}ion-card-header+.card-content-ios{padding-top:0}";
|
|
351
|
-
|
|
352
|
-
const cardContentMdCss = "ion-card-content{display:block;position:relative}.card-content-md{padding-left:16px;padding-right:16px;padding-top:13px;padding-bottom:13px;font-size:14px;line-height:1.5}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.card-content-md{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}.card-content-md h1{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}.card-content-md h2{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:normal}.card-content-md h3,.card-content-md h4,.card-content-md h5,.card-content-md h6{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:normal}.card-content-md p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px;font-weight:normal;line-height:1.5}ion-card-header+.card-content-md{padding-top:0}";
|
|
353
|
-
|
|
354
|
-
const CardContent = class {
|
|
355
|
-
constructor(hostRef) {
|
|
356
|
-
registerInstance(this, hostRef);
|
|
357
|
-
}
|
|
358
|
-
render() {
|
|
359
|
-
const mode = getIonMode$1(this);
|
|
360
|
-
return (h(Host, { class: {
|
|
361
|
-
[mode]: true,
|
|
362
|
-
// Used internally for styling
|
|
363
|
-
[`card-content-${mode}`]: true,
|
|
364
|
-
} }));
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
CardContent.style = {
|
|
368
|
-
ios: cardContentIosCss,
|
|
369
|
-
md: cardContentMdCss
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
const cardHeaderIosCss = ":host{--background:transparent;--color:inherit;display:block;position:relative;background:var(--background);color:var(--color)}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host{padding-left:20px;padding-right:20px;padding-top:20px;padding-bottom:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px}}@supports (backdrop-filter: blur(0)){:host(.card-header-translucent){background-color:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.9);backdrop-filter:saturate(180%) blur(30px)}}";
|
|
373
|
-
|
|
374
|
-
const cardHeaderMdCss = ":host{--background:transparent;--color:inherit;display:block;position:relative;background:var(--background);color:var(--color)}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host{padding-left:16px;padding-right:16px;padding-top:16px;padding-bottom:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}::slotted(ion-card-title:not(:first-child)),::slotted(ion-card-subtitle:not(:first-child)){margin-top:8px}";
|
|
375
|
-
|
|
376
|
-
const CardHeader = class {
|
|
377
|
-
constructor(hostRef) {
|
|
378
|
-
registerInstance(this, hostRef);
|
|
379
|
-
/**
|
|
380
|
-
* If `true`, the card header will be translucent.
|
|
381
|
-
* Only applies when the mode is `"ios"` and the device supports
|
|
382
|
-
* [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility).
|
|
383
|
-
*/
|
|
384
|
-
this.translucent = false;
|
|
385
|
-
}
|
|
386
|
-
render() {
|
|
387
|
-
const mode = getIonMode$1(this);
|
|
388
|
-
return (h(Host, { class: createColorClasses$1(this.color, {
|
|
389
|
-
'card-header-translucent': this.translucent,
|
|
390
|
-
'ion-inherit-color': true,
|
|
391
|
-
[mode]: true,
|
|
392
|
-
}) }, h("slot", null)));
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
CardHeader.style = {
|
|
396
|
-
ios: cardHeaderIosCss,
|
|
397
|
-
md: cardHeaderMdCss
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
const cardTitleIosCss = ":host{display:block;position:relative;color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-text-color, #000);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-size:28px;font-weight:700;line-height:1.2}";
|
|
401
|
-
|
|
402
|
-
const cardTitleMdCss = ":host{display:block;position:relative;color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-850, #262626);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-size:20px;font-weight:500;line-height:1.2}";
|
|
403
|
-
|
|
404
|
-
const CardTitle = class {
|
|
405
|
-
constructor(hostRef) {
|
|
406
|
-
registerInstance(this, hostRef);
|
|
407
|
-
}
|
|
408
|
-
render() {
|
|
409
|
-
const mode = getIonMode$1(this);
|
|
410
|
-
return (h(Host, { role: "heading", "aria-level": "2", class: createColorClasses$1(this.color, {
|
|
411
|
-
'ion-inherit-color': true,
|
|
412
|
-
[mode]: true,
|
|
413
|
-
}) }, h("slot", null)));
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
CardTitle.style = {
|
|
417
|
-
ios: cardTitleIosCss,
|
|
418
|
-
md: cardTitleMdCss
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
/*!
|
|
422
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
|
423
|
-
*/
|
|
424
|
-
const SIZE_TO_MEDIA = {
|
|
425
|
-
xs: '(min-width: 0px)',
|
|
426
|
-
sm: '(min-width: 576px)',
|
|
427
|
-
md: '(min-width: 768px)',
|
|
428
|
-
lg: '(min-width: 992px)',
|
|
429
|
-
xl: '(min-width: 1200px)',
|
|
430
|
-
};
|
|
431
|
-
// Check if the window matches the media query
|
|
432
|
-
// at the breakpoint passed
|
|
433
|
-
// e.g. matchBreakpoint('sm') => true if screen width exceeds 576px
|
|
434
|
-
const matchBreakpoint = (breakpoint) => {
|
|
435
|
-
if (breakpoint === undefined || breakpoint === '') {
|
|
436
|
-
return true;
|
|
437
|
-
}
|
|
438
|
-
if (window.matchMedia) {
|
|
439
|
-
const mediaQuery = SIZE_TO_MEDIA[breakpoint];
|
|
440
|
-
return window.matchMedia(mediaQuery).matches;
|
|
441
|
-
}
|
|
442
|
-
return false;
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
const colCss = ":host{padding-left:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-right:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;box-sizing:border-box;position:relative;flex-basis:0;flex-grow:1;width:100%;max-width:100%;min-height:1px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px))}}@media (min-width: 576px){:host{padding-left:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-right:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px))}}}@media (min-width: 768px){:host{padding-left:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-right:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px))}}}@media (min-width: 992px){:host{padding-left:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-right:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px))}}}@media (min-width: 1200px){:host{padding-left:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-right:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px))}}}";
|
|
446
|
-
|
|
447
|
-
const win = typeof window !== 'undefined' ? window : undefined;
|
|
448
|
-
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
449
|
-
const SUPPORTS_VARS = win && !!(win.CSS && win.CSS.supports && win.CSS.supports('--a: 0'));
|
|
450
|
-
const BREAKPOINTS = ['', 'xs', 'sm', 'md', 'lg', 'xl'];
|
|
451
|
-
const Col = class {
|
|
452
|
-
constructor(hostRef) {
|
|
453
|
-
registerInstance(this, hostRef);
|
|
454
|
-
}
|
|
455
|
-
onResize() {
|
|
456
|
-
forceUpdate(this);
|
|
457
|
-
}
|
|
458
|
-
// Loop through all of the breakpoints to see if the media query
|
|
459
|
-
// matches and grab the column value from the relevant prop if so
|
|
460
|
-
getColumns(property) {
|
|
461
|
-
let matched;
|
|
462
|
-
for (const breakpoint of BREAKPOINTS) {
|
|
463
|
-
const matches = matchBreakpoint(breakpoint);
|
|
464
|
-
// Grab the value of the property, if it exists and our
|
|
465
|
-
// media query matches we return the value
|
|
466
|
-
const columns = this[property + breakpoint.charAt(0).toUpperCase() + breakpoint.slice(1)];
|
|
467
|
-
if (matches && columns !== undefined) {
|
|
468
|
-
matched = columns;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
// Return the last matched columns since the breakpoints
|
|
472
|
-
// increase in size and we want to return the largest match
|
|
473
|
-
return matched;
|
|
474
|
-
}
|
|
475
|
-
calculateSize() {
|
|
476
|
-
const columns = this.getColumns('size');
|
|
477
|
-
// If size wasn't set for any breakpoint
|
|
478
|
-
// or if the user set the size without a value
|
|
479
|
-
// it means we need to stick with the default and return
|
|
480
|
-
// e.g. <ion-col size-md>
|
|
481
|
-
if (!columns || columns === '') {
|
|
482
|
-
return;
|
|
483
|
-
}
|
|
484
|
-
// If the size is set to auto then don't calculate a size
|
|
485
|
-
const colSize = columns === 'auto'
|
|
486
|
-
? 'auto'
|
|
487
|
-
: // If CSS supports variables we should use the grid columns var
|
|
488
|
-
SUPPORTS_VARS
|
|
489
|
-
? `calc(calc(${columns} / var(--ion-grid-columns, 12)) * 100%)`
|
|
490
|
-
: // Convert the columns to a percentage by dividing by the total number
|
|
491
|
-
// of columns (12) and then multiplying by 100
|
|
492
|
-
(columns / 12) * 100 + '%';
|
|
493
|
-
return {
|
|
494
|
-
flex: `0 0 ${colSize}`,
|
|
495
|
-
width: `${colSize}`,
|
|
496
|
-
'max-width': `${colSize}`,
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
// Called by push, pull, and offset since they use the same calculations
|
|
500
|
-
calculatePosition(property, modifier) {
|
|
501
|
-
const columns = this.getColumns(property);
|
|
502
|
-
if (!columns) {
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
// If the number of columns passed are greater than 0 and less than
|
|
506
|
-
// 12 we can position the column, else default to auto
|
|
507
|
-
const amount = SUPPORTS_VARS
|
|
508
|
-
? // If CSS supports variables we should use the grid columns var
|
|
509
|
-
`calc(calc(${columns} / var(--ion-grid-columns, 12)) * 100%)`
|
|
510
|
-
: // Convert the columns to a percentage by dividing by the total number
|
|
511
|
-
// of columns (12) and then multiplying by 100
|
|
512
|
-
columns > 0 && columns < 12
|
|
513
|
-
? (columns / 12) * 100 + '%'
|
|
514
|
-
: 'auto';
|
|
515
|
-
return {
|
|
516
|
-
[modifier]: amount,
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
calculateOffset(isRTL) {
|
|
520
|
-
return this.calculatePosition('offset', isRTL ? 'margin-right' : 'margin-left');
|
|
521
|
-
}
|
|
522
|
-
calculatePull(isRTL) {
|
|
523
|
-
return this.calculatePosition('pull', isRTL ? 'left' : 'right');
|
|
524
|
-
}
|
|
525
|
-
calculatePush(isRTL) {
|
|
526
|
-
return this.calculatePosition('push', isRTL ? 'right' : 'left');
|
|
527
|
-
}
|
|
528
|
-
render() {
|
|
529
|
-
const isRTL = document.dir === 'rtl';
|
|
530
|
-
const mode = getIonMode$1(this);
|
|
531
|
-
return (h(Host, { class: {
|
|
532
|
-
[mode]: true,
|
|
533
|
-
}, style: Object.assign(Object.assign(Object.assign(Object.assign({}, this.calculateOffset(isRTL)), this.calculatePull(isRTL)), this.calculatePush(isRTL)), this.calculateSize()) }, h("slot", null)));
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
Col.style = colCss;
|
|
537
|
-
|
|
538
|
-
const contentCss = ":host{--background:var(--ion-background-color, #fff);--color:var(--ion-text-color, #000);--padding-top:0px;--padding-bottom:0px;--padding-start:0px;--padding-end:0px;--keyboard-offset:0px;--offset-top:0px;--offset-bottom:0px;--overflow:auto;display:block;position:relative;flex:1;width:100%;height:100%;margin:0 !important;padding:0 !important;font-family:var(--ion-font-family, inherit);contain:size style}:host(.ion-color) .inner-scroll{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.outer-content){--background:var(--ion-color-step-50, #f2f2f2)}#background-content{left:0px;right:0px;top:calc(var(--offset-top) * -1);bottom:calc(var(--offset-bottom) * -1);position:absolute;background:var(--background)}.inner-scroll{left:0px;right:0px;top:calc(var(--offset-top) * -1);bottom:calc(var(--offset-bottom) * -1);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:calc(var(--padding-top) + var(--offset-top));padding-bottom:calc(var(--padding-bottom) + var(--keyboard-offset) + var(--offset-bottom));position:absolute;color:var(--color);box-sizing:border-box;overflow:hidden;touch-action:pan-x pan-y pinch-zoom}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.inner-scroll{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.scroll-y,.scroll-x{-webkit-overflow-scrolling:touch;z-index:0;will-change:scroll-position}.scroll-y{overflow-y:var(--overflow);overscroll-behavior-y:contain}.scroll-x{overflow-x:var(--overflow);overscroll-behavior-x:contain}.overscroll::before,.overscroll::after{position:absolute;width:1px;height:1px;content:\"\"}.overscroll::before{bottom:-1px}.overscroll::after{top:-1px}:host(.content-sizing){display:flex;flex-direction:column;min-height:0;contain:none}:host(.content-sizing) .inner-scroll{position:relative;top:0;bottom:0;margin-top:calc(var(--offset-top) * -1);margin-bottom:calc(var(--offset-bottom) * -1)}.transition-effect{display:none;position:absolute;width:100%;height:100vh;opacity:0;pointer-events:none}:host(.content-ltr) .transition-effect{left:-100%;}:host(.content-rtl) .transition-effect{right:-100%;}.transition-cover{position:absolute;right:0;width:100%;height:100%;background:black;opacity:0.1}.transition-shadow{display:block;position:absolute;width:10px;height:100%;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAgCAYAAAAIXrg4AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MTE3MDgzRkQ5QTkyMTFFOUEwNzQ5MkJFREE1NUY2MjQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MTE3MDgzRkU5QTkyMTFFOUEwNzQ5MkJFREE1NUY2MjQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoxMTcwODNGQjlBOTIxMUU5QTA3NDkyQkVEQTU1RjYyNCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoxMTcwODNGQzlBOTIxMUU5QTA3NDkyQkVEQTU1RjYyNCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PmePEuQAAABNSURBVHjaYvz//z8DIxAwMDAwATGMhmFmPDQuOSZks0AMmoJBaQHjkPfB0Lfg/2gQjVow+HPy/yHvg9GiYjQfjMbBqAWjFgy/4hogwADYqwdzxy5BuwAAAABJRU5ErkJggg==);background-repeat:repeat-y;background-size:10px 16px}:host(.content-ltr) .transition-shadow{right:0;}:host(.content-rtl) .transition-shadow{left:0;transform:scaleX(-1)}::slotted([slot=fixed]){position:absolute;transform:translateZ(0)}";
|
|
539
|
-
|
|
540
|
-
const Content = class {
|
|
541
|
-
constructor(hostRef) {
|
|
542
|
-
registerInstance(this, hostRef);
|
|
543
|
-
this.ionScrollStart = createEvent(this, "ionScrollStart", 7);
|
|
544
|
-
this.ionScroll = createEvent(this, "ionScroll", 7);
|
|
545
|
-
this.ionScrollEnd = createEvent(this, "ionScrollEnd", 7);
|
|
546
|
-
this.isScrolling = false;
|
|
547
|
-
this.lastScroll = 0;
|
|
548
|
-
this.queued = false;
|
|
549
|
-
this.cTop = -1;
|
|
550
|
-
this.cBottom = -1;
|
|
551
|
-
this.isMainContent = true;
|
|
552
|
-
// Detail is used in a hot loop in the scroll event, by allocating it here
|
|
553
|
-
// V8 will be able to inline any read/write to it since it's a monomorphic class.
|
|
554
|
-
// https://mrale.ph/blog/2015/01/11/whats-up-with-monomorphism.html
|
|
555
|
-
this.detail = {
|
|
556
|
-
scrollTop: 0,
|
|
557
|
-
scrollLeft: 0,
|
|
558
|
-
type: 'scroll',
|
|
559
|
-
event: undefined,
|
|
560
|
-
startX: 0,
|
|
561
|
-
startY: 0,
|
|
562
|
-
startTime: 0,
|
|
563
|
-
currentX: 0,
|
|
564
|
-
currentY: 0,
|
|
565
|
-
velocityX: 0,
|
|
566
|
-
velocityY: 0,
|
|
567
|
-
deltaX: 0,
|
|
568
|
-
deltaY: 0,
|
|
569
|
-
currentTime: 0,
|
|
570
|
-
data: undefined,
|
|
571
|
-
isScrolling: true,
|
|
572
|
-
};
|
|
573
|
-
/**
|
|
574
|
-
* If `true`, the content will scroll behind the headers
|
|
575
|
-
* and footers. This effect can easily be seen by setting the toolbar
|
|
576
|
-
* to transparent.
|
|
577
|
-
*/
|
|
578
|
-
this.fullscreen = false;
|
|
579
|
-
/**
|
|
580
|
-
* If you want to enable the content scrolling in the X axis, set this property to `true`.
|
|
581
|
-
*/
|
|
582
|
-
this.scrollX = false;
|
|
583
|
-
/**
|
|
584
|
-
* If you want to disable the content scrolling in the Y axis, set this property to `false`.
|
|
585
|
-
*/
|
|
586
|
-
this.scrollY = true;
|
|
587
|
-
/**
|
|
588
|
-
* Because of performance reasons, ionScroll events are disabled by default, in order to enable them
|
|
589
|
-
* and start listening from (ionScroll), set this property to `true`.
|
|
590
|
-
*/
|
|
591
|
-
this.scrollEvents = false;
|
|
592
|
-
}
|
|
593
|
-
connectedCallback() {
|
|
594
|
-
this.isMainContent = this.el.closest('ion-menu, ion-popover, ion-modal') === null;
|
|
595
|
-
}
|
|
596
|
-
disconnectedCallback() {
|
|
597
|
-
this.onScrollEnd();
|
|
598
|
-
}
|
|
599
|
-
onAppLoad() {
|
|
600
|
-
this.resize();
|
|
601
|
-
}
|
|
602
|
-
shouldForceOverscroll() {
|
|
603
|
-
const { forceOverscroll } = this;
|
|
604
|
-
const mode = getIonMode$1(this);
|
|
605
|
-
return forceOverscroll === undefined ? mode === 'ios' && isPlatform('ios') : forceOverscroll;
|
|
606
|
-
}
|
|
607
|
-
resize() {
|
|
608
|
-
if (this.fullscreen) {
|
|
609
|
-
readTask(() => this.readDimensions());
|
|
610
|
-
}
|
|
611
|
-
else if (this.cTop !== 0 || this.cBottom !== 0) {
|
|
612
|
-
this.cTop = this.cBottom = 0;
|
|
613
|
-
forceUpdate(this);
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
readDimensions() {
|
|
617
|
-
const page = getPageElement(this.el);
|
|
618
|
-
const top = Math.max(this.el.offsetTop, 0);
|
|
619
|
-
const bottom = Math.max(page.offsetHeight - top - this.el.offsetHeight, 0);
|
|
620
|
-
const dirty = top !== this.cTop || bottom !== this.cBottom;
|
|
621
|
-
if (dirty) {
|
|
622
|
-
this.cTop = top;
|
|
623
|
-
this.cBottom = bottom;
|
|
624
|
-
forceUpdate(this);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
onScroll(ev) {
|
|
628
|
-
const timeStamp = Date.now();
|
|
629
|
-
const shouldStart = !this.isScrolling;
|
|
630
|
-
this.lastScroll = timeStamp;
|
|
631
|
-
if (shouldStart) {
|
|
632
|
-
this.onScrollStart();
|
|
633
|
-
}
|
|
634
|
-
if (!this.queued && this.scrollEvents) {
|
|
635
|
-
this.queued = true;
|
|
636
|
-
readTask((ts) => {
|
|
637
|
-
this.queued = false;
|
|
638
|
-
this.detail.event = ev;
|
|
639
|
-
updateScrollDetail(this.detail, this.scrollEl, ts, shouldStart);
|
|
640
|
-
this.ionScroll.emit(this.detail);
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Get the element where the actual scrolling takes place.
|
|
646
|
-
* This element can be used to subscribe to `scroll` events or manually modify
|
|
647
|
-
* `scrollTop`. However, it's recommended to use the API provided by `ion-content`:
|
|
648
|
-
*
|
|
649
|
-
* i.e. Using `ionScroll`, `ionScrollStart`, `ionScrollEnd` for scrolling events
|
|
650
|
-
* and `scrollToPoint()` to scroll the content into a certain point.
|
|
651
|
-
*/
|
|
652
|
-
async getScrollElement() {
|
|
653
|
-
/**
|
|
654
|
-
* If this gets called in certain early lifecycle hooks (ex: Vue onMounted),
|
|
655
|
-
* scrollEl won't be defined yet with the custom elements build, so wait for it to load in.
|
|
656
|
-
*/
|
|
657
|
-
if (!this.scrollEl) {
|
|
658
|
-
await new Promise((resolve) => componentOnReady(this.el, resolve));
|
|
659
|
-
}
|
|
660
|
-
return Promise.resolve(this.scrollEl);
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Returns the background content element.
|
|
664
|
-
* @internal
|
|
665
|
-
*/
|
|
666
|
-
async getBackgroundElement() {
|
|
667
|
-
if (!this.backgroundContentEl) {
|
|
668
|
-
await new Promise((resolve) => componentOnReady(this.el, resolve));
|
|
669
|
-
}
|
|
670
|
-
return Promise.resolve(this.backgroundContentEl);
|
|
671
|
-
}
|
|
672
|
-
/**
|
|
673
|
-
* Scroll to the top of the component.
|
|
674
|
-
*
|
|
675
|
-
* @param duration The amount of time to take scrolling to the top. Defaults to `0`.
|
|
676
|
-
*/
|
|
677
|
-
scrollToTop(duration = 0) {
|
|
678
|
-
return this.scrollToPoint(undefined, 0, duration);
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Scroll to the bottom of the component.
|
|
682
|
-
*
|
|
683
|
-
* @param duration The amount of time to take scrolling to the bottom. Defaults to `0`.
|
|
684
|
-
*/
|
|
685
|
-
async scrollToBottom(duration = 0) {
|
|
686
|
-
const scrollEl = await this.getScrollElement();
|
|
687
|
-
const y = scrollEl.scrollHeight - scrollEl.clientHeight;
|
|
688
|
-
return this.scrollToPoint(undefined, y, duration);
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Scroll by a specified X/Y distance in the component.
|
|
692
|
-
*
|
|
693
|
-
* @param x The amount to scroll by on the horizontal axis.
|
|
694
|
-
* @param y The amount to scroll by on the vertical axis.
|
|
695
|
-
* @param duration The amount of time to take scrolling by that amount.
|
|
696
|
-
*/
|
|
697
|
-
async scrollByPoint(x, y, duration) {
|
|
698
|
-
const scrollEl = await this.getScrollElement();
|
|
699
|
-
return this.scrollToPoint(x + scrollEl.scrollLeft, y + scrollEl.scrollTop, duration);
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* Scroll to a specified X/Y location in the component.
|
|
703
|
-
*
|
|
704
|
-
* @param x The point to scroll to on the horizontal axis.
|
|
705
|
-
* @param y The point to scroll to on the vertical axis.
|
|
706
|
-
* @param duration The amount of time to take scrolling to that point. Defaults to `0`.
|
|
707
|
-
*/
|
|
708
|
-
async scrollToPoint(x, y, duration = 0) {
|
|
709
|
-
const el = await this.getScrollElement();
|
|
710
|
-
if (duration < 32) {
|
|
711
|
-
if (y != null) {
|
|
712
|
-
el.scrollTop = y;
|
|
713
|
-
}
|
|
714
|
-
if (x != null) {
|
|
715
|
-
el.scrollLeft = x;
|
|
716
|
-
}
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
let resolve;
|
|
720
|
-
let startTime = 0;
|
|
721
|
-
const promise = new Promise((r) => (resolve = r));
|
|
722
|
-
const fromY = el.scrollTop;
|
|
723
|
-
const fromX = el.scrollLeft;
|
|
724
|
-
const deltaY = y != null ? y - fromY : 0;
|
|
725
|
-
const deltaX = x != null ? x - fromX : 0;
|
|
726
|
-
// scroll loop
|
|
727
|
-
const step = (timeStamp) => {
|
|
728
|
-
const linearTime = Math.min(1, (timeStamp - startTime) / duration) - 1;
|
|
729
|
-
const easedT = Math.pow(linearTime, 3) + 1;
|
|
730
|
-
if (deltaY !== 0) {
|
|
731
|
-
el.scrollTop = Math.floor(easedT * deltaY + fromY);
|
|
732
|
-
}
|
|
733
|
-
if (deltaX !== 0) {
|
|
734
|
-
el.scrollLeft = Math.floor(easedT * deltaX + fromX);
|
|
735
|
-
}
|
|
736
|
-
if (easedT < 1) {
|
|
737
|
-
// do not use DomController here
|
|
738
|
-
// must use nativeRaf in order to fire in the next frame
|
|
739
|
-
requestAnimationFrame(step);
|
|
740
|
-
}
|
|
741
|
-
else {
|
|
742
|
-
resolve();
|
|
743
|
-
}
|
|
744
|
-
};
|
|
745
|
-
// chill out for a frame first
|
|
746
|
-
requestAnimationFrame((ts) => {
|
|
747
|
-
startTime = ts;
|
|
748
|
-
step(ts);
|
|
749
|
-
});
|
|
750
|
-
return promise;
|
|
751
|
-
}
|
|
752
|
-
onScrollStart() {
|
|
753
|
-
this.isScrolling = true;
|
|
754
|
-
this.ionScrollStart.emit({
|
|
755
|
-
isScrolling: true,
|
|
756
|
-
});
|
|
757
|
-
if (this.watchDog) {
|
|
758
|
-
clearInterval(this.watchDog);
|
|
759
|
-
}
|
|
760
|
-
// watchdog
|
|
761
|
-
this.watchDog = setInterval(() => {
|
|
762
|
-
if (this.lastScroll < Date.now() - 120) {
|
|
763
|
-
this.onScrollEnd();
|
|
764
|
-
}
|
|
765
|
-
}, 100);
|
|
766
|
-
}
|
|
767
|
-
onScrollEnd() {
|
|
768
|
-
clearInterval(this.watchDog);
|
|
769
|
-
this.watchDog = null;
|
|
770
|
-
if (this.isScrolling) {
|
|
771
|
-
this.isScrolling = false;
|
|
772
|
-
this.ionScrollEnd.emit({
|
|
773
|
-
isScrolling: false,
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
render() {
|
|
778
|
-
const { isMainContent, scrollX, scrollY, el } = this;
|
|
779
|
-
const rtl = isRTL$1(el) ? 'rtl' : 'ltr';
|
|
780
|
-
const mode = getIonMode$1(this);
|
|
781
|
-
const forceOverscroll = this.shouldForceOverscroll();
|
|
782
|
-
const transitionShadow = mode === 'ios';
|
|
783
|
-
const TagType = isMainContent ? 'main' : 'div';
|
|
784
|
-
this.resize();
|
|
785
|
-
return (h(Host, { class: createColorClasses$1(this.color, {
|
|
786
|
-
[mode]: true,
|
|
787
|
-
'content-sizing': hostContext('ion-popover', this.el),
|
|
788
|
-
overscroll: forceOverscroll,
|
|
789
|
-
[`content-${rtl}`]: true,
|
|
790
|
-
}), style: {
|
|
791
|
-
'--offset-top': `${this.cTop}px`,
|
|
792
|
-
'--offset-bottom': `${this.cBottom}px`,
|
|
793
|
-
} }, h("div", { ref: (el) => (this.backgroundContentEl = el), id: "background-content", part: "background" }), h(TagType, { class: {
|
|
794
|
-
'inner-scroll': true,
|
|
795
|
-
'scroll-x': scrollX,
|
|
796
|
-
'scroll-y': scrollY,
|
|
797
|
-
overscroll: (scrollX || scrollY) && forceOverscroll,
|
|
798
|
-
}, ref: (scrollEl) => (this.scrollEl = scrollEl), onScroll: this.scrollEvents ? (ev) => this.onScroll(ev) : undefined, part: "scroll" }, h("slot", null)), transitionShadow ? (h("div", { class: "transition-effect" }, h("div", { class: "transition-cover" }), h("div", { class: "transition-shadow" }))) : null, h("slot", { name: "fixed" })));
|
|
799
|
-
}
|
|
800
|
-
get el() { return getElement$1(this); }
|
|
801
|
-
};
|
|
802
|
-
const getParentElement = (el) => {
|
|
803
|
-
var _a;
|
|
804
|
-
if (el.parentElement) {
|
|
805
|
-
// normal element with a parent element
|
|
806
|
-
return el.parentElement;
|
|
807
|
-
}
|
|
808
|
-
if ((_a = el.parentNode) === null || _a === void 0 ? void 0 : _a.host) {
|
|
809
|
-
// shadow dom's document fragment
|
|
810
|
-
return el.parentNode.host;
|
|
811
|
-
}
|
|
812
|
-
return null;
|
|
813
|
-
};
|
|
814
|
-
const getPageElement = (el) => {
|
|
815
|
-
const tabs = el.closest('ion-tabs');
|
|
816
|
-
if (tabs) {
|
|
817
|
-
return tabs;
|
|
818
|
-
}
|
|
819
|
-
/**
|
|
820
|
-
* If we're in a popover, we need to use its wrapper so we can account for space
|
|
821
|
-
* between the popover and the edges of the screen. But if the popover contains
|
|
822
|
-
* its own page element, we should use that instead.
|
|
823
|
-
*/
|
|
824
|
-
const page = el.closest('ion-app, ion-page, .ion-page, page-inner, .popover-content');
|
|
825
|
-
if (page) {
|
|
826
|
-
return page;
|
|
827
|
-
}
|
|
828
|
-
return getParentElement(el);
|
|
829
|
-
};
|
|
830
|
-
// ******** DOM READ ****************
|
|
831
|
-
const updateScrollDetail = (detail, el, timestamp, shouldStart) => {
|
|
832
|
-
const prevX = detail.currentX;
|
|
833
|
-
const prevY = detail.currentY;
|
|
834
|
-
const prevT = detail.currentTime;
|
|
835
|
-
const currentX = el.scrollLeft;
|
|
836
|
-
const currentY = el.scrollTop;
|
|
837
|
-
const timeDelta = timestamp - prevT;
|
|
838
|
-
if (shouldStart) {
|
|
839
|
-
// remember the start positions
|
|
840
|
-
detail.startTime = timestamp;
|
|
841
|
-
detail.startX = currentX;
|
|
842
|
-
detail.startY = currentY;
|
|
843
|
-
detail.velocityX = detail.velocityY = 0;
|
|
844
|
-
}
|
|
845
|
-
detail.currentTime = timestamp;
|
|
846
|
-
detail.currentX = detail.scrollLeft = currentX;
|
|
847
|
-
detail.currentY = detail.scrollTop = currentY;
|
|
848
|
-
detail.deltaX = currentX - detail.startX;
|
|
849
|
-
detail.deltaY = currentY - detail.startY;
|
|
850
|
-
if (timeDelta > 0 && timeDelta < 100) {
|
|
851
|
-
const velocityX = (currentX - prevX) / timeDelta;
|
|
852
|
-
const velocityY = (currentY - prevY) / timeDelta;
|
|
853
|
-
detail.velocityX = velocityX * 0.7 + detail.velocityX * 0.3;
|
|
854
|
-
detail.velocityY = velocityY * 0.7 + detail.velocityY * 0.3;
|
|
855
|
-
}
|
|
856
|
-
};
|
|
857
|
-
Content.style = contentCss;
|
|
858
|
-
|
|
859
|
-
/*!
|
|
860
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
|
861
|
-
*/
|
|
862
|
-
const handleFooterFade = (scrollEl, baseEl) => {
|
|
863
|
-
readTask(() => {
|
|
864
|
-
const scrollTop = scrollEl.scrollTop;
|
|
865
|
-
const maxScroll = scrollEl.scrollHeight - scrollEl.clientHeight;
|
|
866
|
-
/**
|
|
867
|
-
* Toolbar background will fade
|
|
868
|
-
* out over fadeDuration in pixels.
|
|
869
|
-
*/
|
|
870
|
-
const fadeDuration = 10;
|
|
871
|
-
/**
|
|
872
|
-
* Begin fading out maxScroll - 30px
|
|
873
|
-
* from the bottom of the content.
|
|
874
|
-
* Also determine how close we are
|
|
875
|
-
* to starting the fade. If we are
|
|
876
|
-
* before the starting point, the
|
|
877
|
-
* scale value will get clamped to 0.
|
|
878
|
-
* If we are after the maxScroll (rubber
|
|
879
|
-
* band scrolling), the scale value will
|
|
880
|
-
* get clamped to 1.
|
|
881
|
-
*/
|
|
882
|
-
const fadeStart = maxScroll - fadeDuration;
|
|
883
|
-
const distanceToStart = scrollTop - fadeStart;
|
|
884
|
-
const scale = clamp(0, 1 - distanceToStart / fadeDuration, 1);
|
|
885
|
-
writeTask(() => {
|
|
886
|
-
baseEl.style.setProperty('--opacity-scale', scale.toString());
|
|
887
|
-
});
|
|
888
|
-
});
|
|
889
|
-
};
|
|
890
|
-
|
|
891
|
-
const footerIosCss = "ion-footer{display:block;position:relative;order:1;width:100%;z-index:10}ion-footer.footer-toolbar-padding ion-toolbar:last-of-type{padding-bottom:var(--ion-safe-area-bottom, 0)}.footer-ios ion-toolbar:first-of-type{--border-width:0.55px 0 0}@supports (backdrop-filter: blur(0)){.footer-background{left:0;right:0;top:0;bottom:0;position:absolute;backdrop-filter:saturate(180%) blur(20px)}.footer-translucent-ios ion-toolbar{--opacity:.8}}.footer-ios.ion-no-border ion-toolbar:first-of-type{--border-width:0}.footer-collapse-fade ion-toolbar{--opacity-scale:inherit}";
|
|
892
|
-
|
|
893
|
-
const footerMdCss = "ion-footer{display:block;position:relative;order:1;width:100%;z-index:10}ion-footer.footer-toolbar-padding ion-toolbar:last-of-type{padding-bottom:var(--ion-safe-area-bottom, 0)}.footer-md::before{left:0;top:-2px;bottom:auto;background-position:left 0 top 0;position:absolute;width:100%;height:2px;background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAHBAMAAADzDtBxAAAAD1BMVEUAAAAAAAAAAAAAAAAAAABPDueNAAAABXRSTlMUCS0gBIh/TXEAAAAaSURBVAjXYxCEAgY4UIICBmMogMsgFLtAAQCNSwXZKOdPxgAAAABJRU5ErkJggg==\");background-repeat:repeat-x;content:\"\"}[dir=rtl] .footer-md::before,:host-context([dir=rtl]) .footer-md::before{left:unset;right:unset;right:0}[dir=rtl] .footer-md::before,:host-context([dir=rtl]) .footer-md::before{background-position:right 0 top 0}.footer-md.ion-no-border::before{display:none}";
|
|
894
|
-
|
|
895
|
-
const Footer = class {
|
|
896
|
-
constructor(hostRef) {
|
|
897
|
-
registerInstance(this, hostRef);
|
|
898
|
-
this.keyboardCtrl = null;
|
|
899
|
-
this.keyboardVisible = false;
|
|
900
|
-
/**
|
|
901
|
-
* If `true`, the footer will be translucent.
|
|
902
|
-
* Only applies when the mode is `"ios"` and the device supports
|
|
903
|
-
* [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility).
|
|
904
|
-
*
|
|
905
|
-
* Note: In order to scroll content behind the footer, the `fullscreen`
|
|
906
|
-
* attribute needs to be set on the content.
|
|
907
|
-
*/
|
|
908
|
-
this.translucent = false;
|
|
909
|
-
this.checkCollapsibleFooter = () => {
|
|
910
|
-
const mode = getIonMode$1(this);
|
|
911
|
-
if (mode !== 'ios') {
|
|
912
|
-
return;
|
|
913
|
-
}
|
|
914
|
-
const { collapse } = this;
|
|
915
|
-
const hasFade = collapse === 'fade';
|
|
916
|
-
this.destroyCollapsibleFooter();
|
|
917
|
-
if (hasFade) {
|
|
918
|
-
const pageEl = this.el.closest('ion-app,ion-page,.ion-page,page-inner');
|
|
919
|
-
const contentEl = pageEl ? findIonContent(pageEl) : null;
|
|
920
|
-
if (!contentEl) {
|
|
921
|
-
printIonContentErrorMsg(this.el);
|
|
922
|
-
return;
|
|
923
|
-
}
|
|
924
|
-
this.setupFadeFooter(contentEl);
|
|
925
|
-
}
|
|
926
|
-
};
|
|
927
|
-
this.setupFadeFooter = async (contentEl) => {
|
|
928
|
-
const scrollEl = (this.scrollEl = await getScrollElement(contentEl));
|
|
929
|
-
/**
|
|
930
|
-
* Handle fading of toolbars on scroll
|
|
931
|
-
*/
|
|
932
|
-
this.contentScrollCallback = () => {
|
|
933
|
-
handleFooterFade(scrollEl, this.el);
|
|
934
|
-
};
|
|
935
|
-
scrollEl.addEventListener('scroll', this.contentScrollCallback);
|
|
936
|
-
handleFooterFade(scrollEl, this.el);
|
|
937
|
-
};
|
|
938
|
-
}
|
|
939
|
-
componentDidLoad() {
|
|
940
|
-
this.checkCollapsibleFooter();
|
|
941
|
-
}
|
|
942
|
-
componentDidUpdate() {
|
|
943
|
-
this.checkCollapsibleFooter();
|
|
944
|
-
}
|
|
945
|
-
connectedCallback() {
|
|
946
|
-
this.keyboardCtrl = createKeyboardController((keyboardOpen) => {
|
|
947
|
-
this.keyboardVisible = keyboardOpen; // trigger re-render by updating state
|
|
948
|
-
});
|
|
949
|
-
}
|
|
950
|
-
disconnectedCallback() {
|
|
951
|
-
if (this.keyboardCtrl) {
|
|
952
|
-
this.keyboardCtrl.destroy();
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
destroyCollapsibleFooter() {
|
|
956
|
-
if (this.scrollEl && this.contentScrollCallback) {
|
|
957
|
-
this.scrollEl.removeEventListener('scroll', this.contentScrollCallback);
|
|
958
|
-
this.contentScrollCallback = undefined;
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
render() {
|
|
962
|
-
const { translucent, collapse } = this;
|
|
963
|
-
const mode = getIonMode$1(this);
|
|
964
|
-
const tabs = this.el.closest('ion-tabs');
|
|
965
|
-
const tabBar = tabs === null || tabs === void 0 ? void 0 : tabs.querySelector(':scope > ion-tab-bar');
|
|
966
|
-
return (h(Host, { role: "contentinfo", class: {
|
|
967
|
-
[mode]: true,
|
|
968
|
-
// Used internally for styling
|
|
969
|
-
[`footer-${mode}`]: true,
|
|
970
|
-
[`footer-translucent`]: translucent,
|
|
971
|
-
[`footer-translucent-${mode}`]: translucent,
|
|
972
|
-
['footer-toolbar-padding']: !this.keyboardVisible && (!tabBar || tabBar.slot !== 'bottom'),
|
|
973
|
-
[`footer-collapse-${collapse}`]: collapse !== undefined,
|
|
974
|
-
} }, mode === 'ios' && translucent && h("div", { class: "footer-background" }), h("slot", null)));
|
|
975
|
-
}
|
|
976
|
-
get el() { return getElement$1(this); }
|
|
977
|
-
};
|
|
978
|
-
Footer.style = {
|
|
979
|
-
ios: footerIosCss,
|
|
980
|
-
md: footerMdCss
|
|
981
|
-
};
|
|
982
|
-
|
|
983
|
-
const gridCss = ":host{padding-left:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-right:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));margin-left:auto;margin-right:auto;display:block;flex:1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px))}}@media (min-width: 576px){:host{padding-left:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-right:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px))}}}@media (min-width: 768px){:host{padding-left:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-right:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px))}}}@media (min-width: 992px){:host{padding-left:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-right:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px))}}}@media (min-width: 1200px){:host{padding-left:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-right:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px))}}}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto}}:host(.grid-fixed){width:var(--ion-grid-width-xs, var(--ion-grid-width, 100%));max-width:100%}@media (min-width: 576px){:host(.grid-fixed){width:var(--ion-grid-width-sm, var(--ion-grid-width, 540px))}}@media (min-width: 768px){:host(.grid-fixed){width:var(--ion-grid-width-md, var(--ion-grid-width, 720px))}}@media (min-width: 992px){:host(.grid-fixed){width:var(--ion-grid-width-lg, var(--ion-grid-width, 960px))}}@media (min-width: 1200px){:host(.grid-fixed){width:var(--ion-grid-width-xl, var(--ion-grid-width, 1140px))}}:host(.ion-no-padding){--ion-grid-column-padding:0;--ion-grid-column-padding-xs:0;--ion-grid-column-padding-sm:0;--ion-grid-column-padding-md:0;--ion-grid-column-padding-lg:0;--ion-grid-column-padding-xl:0}";
|
|
984
|
-
|
|
985
|
-
const Grid = class {
|
|
986
|
-
constructor(hostRef) {
|
|
987
|
-
registerInstance(this, hostRef);
|
|
988
|
-
/**
|
|
989
|
-
* If `true`, the grid will have a fixed width based on the screen size.
|
|
990
|
-
*/
|
|
991
|
-
this.fixed = false;
|
|
992
|
-
}
|
|
993
|
-
render() {
|
|
994
|
-
const mode = getIonMode$1(this);
|
|
995
|
-
return (h(Host, { class: {
|
|
996
|
-
[mode]: true,
|
|
997
|
-
'grid-fixed': this.fixed,
|
|
998
|
-
} }, h("slot", null)));
|
|
999
|
-
}
|
|
1000
|
-
};
|
|
1001
|
-
Grid.style = gridCss;
|
|
1002
|
-
|
|
1003
|
-
/*!
|
|
1004
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
|
1005
|
-
*/
|
|
1006
|
-
const TRANSITION = 'all 0.2s ease-in-out';
|
|
1007
|
-
const cloneElement = (tagName) => {
|
|
1008
|
-
const getCachedEl = document.querySelector(`${tagName}.ion-cloned-element`);
|
|
1009
|
-
if (getCachedEl !== null) {
|
|
1010
|
-
return getCachedEl;
|
|
1011
|
-
}
|
|
1012
|
-
const clonedEl = document.createElement(tagName);
|
|
1013
|
-
clonedEl.classList.add('ion-cloned-element');
|
|
1014
|
-
clonedEl.style.setProperty('display', 'none');
|
|
1015
|
-
document.body.appendChild(clonedEl);
|
|
1016
|
-
return clonedEl;
|
|
1017
|
-
};
|
|
1018
|
-
const createHeaderIndex = (headerEl) => {
|
|
1019
|
-
if (!headerEl) {
|
|
1020
|
-
return;
|
|
1021
|
-
}
|
|
1022
|
-
const toolbars = headerEl.querySelectorAll('ion-toolbar');
|
|
1023
|
-
return {
|
|
1024
|
-
el: headerEl,
|
|
1025
|
-
toolbars: Array.from(toolbars).map((toolbar) => {
|
|
1026
|
-
const ionTitleEl = toolbar.querySelector('ion-title');
|
|
1027
|
-
return {
|
|
1028
|
-
el: toolbar,
|
|
1029
|
-
background: toolbar.shadowRoot.querySelector('.toolbar-background'),
|
|
1030
|
-
ionTitleEl,
|
|
1031
|
-
innerTitleEl: ionTitleEl ? ionTitleEl.shadowRoot.querySelector('.toolbar-title') : null,
|
|
1032
|
-
ionButtonsEl: Array.from(toolbar.querySelectorAll('ion-buttons')),
|
|
1033
|
-
};
|
|
1034
|
-
}),
|
|
1035
|
-
};
|
|
1036
|
-
};
|
|
1037
|
-
const handleContentScroll = (scrollEl, scrollHeaderIndex, contentEl) => {
|
|
1038
|
-
readTask(() => {
|
|
1039
|
-
const scrollTop = scrollEl.scrollTop;
|
|
1040
|
-
const scale = clamp(1, 1 + -scrollTop / 500, 1.1);
|
|
1041
|
-
// Native refresher should not cause titles to scale
|
|
1042
|
-
const nativeRefresher = contentEl.querySelector('ion-refresher.refresher-native');
|
|
1043
|
-
if (nativeRefresher === null) {
|
|
1044
|
-
writeTask(() => {
|
|
1045
|
-
scaleLargeTitles(scrollHeaderIndex.toolbars, scale);
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
});
|
|
1049
|
-
};
|
|
1050
|
-
const setToolbarBackgroundOpacity = (headerEl, opacity) => {
|
|
1051
|
-
/**
|
|
1052
|
-
* Fading in the backdrop opacity
|
|
1053
|
-
* should happen after the large title
|
|
1054
|
-
* has collapsed, so it is handled
|
|
1055
|
-
* by handleHeaderFade()
|
|
1056
|
-
*/
|
|
1057
|
-
if (headerEl.collapse === 'fade') {
|
|
1058
|
-
return;
|
|
1059
|
-
}
|
|
1060
|
-
if (opacity === undefined) {
|
|
1061
|
-
headerEl.style.removeProperty('--opacity-scale');
|
|
1062
|
-
}
|
|
1063
|
-
else {
|
|
1064
|
-
headerEl.style.setProperty('--opacity-scale', opacity.toString());
|
|
1065
|
-
}
|
|
1066
|
-
};
|
|
1067
|
-
const handleToolbarBorderIntersection = (ev, mainHeaderIndex, scrollTop) => {
|
|
1068
|
-
if (!ev[0].isIntersecting) {
|
|
1069
|
-
return;
|
|
1070
|
-
}
|
|
1071
|
-
/**
|
|
1072
|
-
* There is a bug in Safari where overflow scrolling on a non-body element
|
|
1073
|
-
* does not always reset the scrollTop position to 0 when letting go. It will
|
|
1074
|
-
* set to 1 once the rubber band effect has ended. This causes the background to
|
|
1075
|
-
* appear slightly on certain app setups.
|
|
1076
|
-
*
|
|
1077
|
-
* Additionally, we check if user is rubber banding (scrolling is negative)
|
|
1078
|
-
* as this can mean they are using pull to refresh. Once the refresher starts,
|
|
1079
|
-
* the content is transformed which can cause the intersection observer to erroneously
|
|
1080
|
-
* fire here as well.
|
|
1081
|
-
*/
|
|
1082
|
-
const scale = ev[0].intersectionRatio > 0.9 || scrollTop <= 0 ? 0 : ((1 - ev[0].intersectionRatio) * 100) / 75;
|
|
1083
|
-
setToolbarBackgroundOpacity(mainHeaderIndex.el, scale === 1 ? undefined : scale);
|
|
1084
|
-
};
|
|
1085
|
-
/**
|
|
1086
|
-
* If toolbars are intersecting, hide the scrollable toolbar content
|
|
1087
|
-
* and show the primary toolbar content. If the toolbars are not intersecting,
|
|
1088
|
-
* hide the primary toolbar content and show the scrollable toolbar content
|
|
1089
|
-
*/
|
|
1090
|
-
const handleToolbarIntersection = (ev, mainHeaderIndex, scrollHeaderIndex, scrollEl) => {
|
|
1091
|
-
writeTask(() => {
|
|
1092
|
-
const scrollTop = scrollEl.scrollTop;
|
|
1093
|
-
handleToolbarBorderIntersection(ev, mainHeaderIndex, scrollTop);
|
|
1094
|
-
const event = ev[0];
|
|
1095
|
-
const intersection = event.intersectionRect;
|
|
1096
|
-
const intersectionArea = intersection.width * intersection.height;
|
|
1097
|
-
const rootArea = event.rootBounds.width * event.rootBounds.height;
|
|
1098
|
-
const isPageHidden = intersectionArea === 0 && rootArea === 0;
|
|
1099
|
-
const leftDiff = Math.abs(intersection.left - event.boundingClientRect.left);
|
|
1100
|
-
const rightDiff = Math.abs(intersection.right - event.boundingClientRect.right);
|
|
1101
|
-
const isPageTransitioning = intersectionArea > 0 && (leftDiff >= 5 || rightDiff >= 5);
|
|
1102
|
-
if (isPageHidden || isPageTransitioning) {
|
|
1103
|
-
return;
|
|
1104
|
-
}
|
|
1105
|
-
if (event.isIntersecting) {
|
|
1106
|
-
setHeaderActive(mainHeaderIndex, false);
|
|
1107
|
-
setHeaderActive(scrollHeaderIndex);
|
|
1108
|
-
}
|
|
1109
|
-
else {
|
|
1110
|
-
/**
|
|
1111
|
-
* There is a bug with IntersectionObserver on Safari
|
|
1112
|
-
* where `event.isIntersecting === false` when cancelling
|
|
1113
|
-
* a swipe to go back gesture. Checking the intersection
|
|
1114
|
-
* x, y, width, and height provides a workaround. This bug
|
|
1115
|
-
* does not happen when using Safari + Web Animations,
|
|
1116
|
-
* only Safari + CSS Animations.
|
|
1117
|
-
*/
|
|
1118
|
-
const hasValidIntersection = (intersection.x === 0 && intersection.y === 0) || (intersection.width !== 0 && intersection.height !== 0);
|
|
1119
|
-
if (hasValidIntersection && scrollTop > 0) {
|
|
1120
|
-
setHeaderActive(mainHeaderIndex);
|
|
1121
|
-
setHeaderActive(scrollHeaderIndex, false);
|
|
1122
|
-
setToolbarBackgroundOpacity(mainHeaderIndex.el);
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
});
|
|
1126
|
-
};
|
|
1127
|
-
const setHeaderActive = (headerIndex, active = true) => {
|
|
1128
|
-
const headerEl = headerIndex.el;
|
|
1129
|
-
if (active) {
|
|
1130
|
-
headerEl.classList.remove('header-collapse-condense-inactive');
|
|
1131
|
-
headerEl.removeAttribute('aria-hidden');
|
|
1132
|
-
}
|
|
1133
|
-
else {
|
|
1134
|
-
headerEl.classList.add('header-collapse-condense-inactive');
|
|
1135
|
-
headerEl.setAttribute('aria-hidden', 'true');
|
|
1136
|
-
}
|
|
1137
|
-
};
|
|
1138
|
-
const scaleLargeTitles = (toolbars = [], scale = 1, transition = false) => {
|
|
1139
|
-
toolbars.forEach((toolbar) => {
|
|
1140
|
-
const ionTitle = toolbar.ionTitleEl;
|
|
1141
|
-
const titleDiv = toolbar.innerTitleEl;
|
|
1142
|
-
if (!ionTitle || ionTitle.size !== 'large') {
|
|
1143
|
-
return;
|
|
1144
|
-
}
|
|
1145
|
-
titleDiv.style.transition = transition ? TRANSITION : '';
|
|
1146
|
-
titleDiv.style.transform = `scale3d(${scale}, ${scale}, 1)`;
|
|
1147
|
-
});
|
|
1148
|
-
};
|
|
1149
|
-
const handleHeaderFade = (scrollEl, baseEl, condenseHeader) => {
|
|
1150
|
-
readTask(() => {
|
|
1151
|
-
const scrollTop = scrollEl.scrollTop;
|
|
1152
|
-
const baseElHeight = baseEl.clientHeight;
|
|
1153
|
-
const fadeStart = condenseHeader ? condenseHeader.clientHeight : 0;
|
|
1154
|
-
/**
|
|
1155
|
-
* If we are using fade header with a condense
|
|
1156
|
-
* header, then the toolbar backgrounds should
|
|
1157
|
-
* not begin to fade in until the condense
|
|
1158
|
-
* header has fully collapsed.
|
|
1159
|
-
*
|
|
1160
|
-
* Additionally, the main content should not
|
|
1161
|
-
* overflow out of the container until the
|
|
1162
|
-
* condense header has fully collapsed. When
|
|
1163
|
-
* using just the condense header the content
|
|
1164
|
-
* should overflow out of the container.
|
|
1165
|
-
*/
|
|
1166
|
-
if (condenseHeader !== null && scrollTop < fadeStart) {
|
|
1167
|
-
baseEl.style.setProperty('--opacity-scale', '0');
|
|
1168
|
-
scrollEl.style.setProperty('clip-path', `inset(${baseElHeight}px 0px 0px 0px)`);
|
|
1169
|
-
return;
|
|
1170
|
-
}
|
|
1171
|
-
const distanceToStart = scrollTop - fadeStart;
|
|
1172
|
-
const fadeDuration = 10;
|
|
1173
|
-
const scale = clamp(0, distanceToStart / fadeDuration, 1);
|
|
1174
|
-
writeTask(() => {
|
|
1175
|
-
scrollEl.style.removeProperty('clip-path');
|
|
1176
|
-
baseEl.style.setProperty('--opacity-scale', scale.toString());
|
|
1177
|
-
});
|
|
1178
|
-
});
|
|
1179
|
-
};
|
|
1180
|
-
|
|
1181
|
-
const headerIosCss = "ion-header{display:block;position:relative;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-ios ion-toolbar:last-of-type{--border-width:0 0 0.55px}@supports (backdrop-filter: blur(0)){.header-background{left:0;right:0;top:0;bottom:0;position:absolute;backdrop-filter:saturate(180%) blur(20px)}.header-translucent-ios ion-toolbar{--opacity:.8}.header-collapse-condense-inactive .header-background{backdrop-filter:blur(20px)}}.header-ios.ion-no-border ion-toolbar:last-of-type{--border-width:0}.header-collapse-fade ion-toolbar{--opacity-scale:inherit}.header-collapse-condense{z-index:9}.header-collapse-condense ion-toolbar{position:sticky;top:0}.header-collapse-condense ion-toolbar:first-of-type{padding-top:7px;z-index:1}.header-collapse-condense ion-toolbar{--background:var(--ion-background-color, #fff);z-index:0}.header-collapse-condense ion-toolbar:last-of-type{--border-width:0px}.header-collapse-condense ion-toolbar ion-searchbar{height:48px;padding-top:0px;padding-bottom:13px}.header-collapse-main{--opacity-scale:1}.header-collapse-main ion-toolbar{--opacity-scale:inherit}.header-collapse-main ion-toolbar.in-toolbar ion-title,.header-collapse-main ion-toolbar.in-toolbar ion-buttons{transition:all 0.2s ease-in-out}.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse{opacity:0;pointer-events:none}.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse{visibility:hidden}";
|
|
1182
|
-
|
|
1183
|
-
const headerMdCss = "ion-header{display:block;position:relative;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-md::after{left:0;bottom:-5px;background-position:left 0 top -2px;position:absolute;width:100%;height:5px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAHBAMAAADzDtBxAAAAD1BMVEUAAAAAAAAAAAAAAAAAAABPDueNAAAABXRSTlMUCS0gBIh/TXEAAAAaSURBVAjXYxCEAgY4UIICBmMogMsgFLtAAQCNSwXZKOdPxgAAAABJRU5ErkJggg==);background-repeat:repeat-x;content:\"\"}[dir=rtl] .header-md::after,:host-context([dir=rtl]) .header-md::after{left:unset;right:unset;right:0}[dir=rtl] .header-md::after,:host-context([dir=rtl]) .header-md::after{background-position:right 0 top -2px}.header-collapse-condense{display:none}.header-md.ion-no-border::after{display:none}";
|
|
1184
|
-
|
|
1185
|
-
const Header = class {
|
|
1186
|
-
constructor(hostRef) {
|
|
1187
|
-
registerInstance(this, hostRef);
|
|
1188
|
-
this.inheritedAttributes = {};
|
|
1189
|
-
/**
|
|
1190
|
-
* If `true`, the header will be translucent.
|
|
1191
|
-
* Only applies when the mode is `"ios"` and the device supports
|
|
1192
|
-
* [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility).
|
|
1193
|
-
*
|
|
1194
|
-
* Note: In order to scroll content behind the header, the `fullscreen`
|
|
1195
|
-
* attribute needs to be set on the content.
|
|
1196
|
-
*/
|
|
1197
|
-
this.translucent = false;
|
|
1198
|
-
this.setupFadeHeader = async (contentEl, condenseHeader) => {
|
|
1199
|
-
const scrollEl = (this.scrollEl = await getScrollElement(contentEl));
|
|
1200
|
-
/**
|
|
1201
|
-
* Handle fading of toolbars on scroll
|
|
1202
|
-
*/
|
|
1203
|
-
this.contentScrollCallback = () => {
|
|
1204
|
-
handleHeaderFade(this.scrollEl, this.el, condenseHeader);
|
|
1205
|
-
};
|
|
1206
|
-
scrollEl.addEventListener('scroll', this.contentScrollCallback);
|
|
1207
|
-
handleHeaderFade(this.scrollEl, this.el, condenseHeader);
|
|
1208
|
-
};
|
|
1209
|
-
}
|
|
1210
|
-
componentWillLoad() {
|
|
1211
|
-
this.inheritedAttributes = inheritAriaAttributes(this.el);
|
|
1212
|
-
}
|
|
1213
|
-
componentDidLoad() {
|
|
1214
|
-
this.checkCollapsibleHeader();
|
|
1215
|
-
}
|
|
1216
|
-
componentDidUpdate() {
|
|
1217
|
-
this.checkCollapsibleHeader();
|
|
1218
|
-
}
|
|
1219
|
-
disconnectedCallback() {
|
|
1220
|
-
this.destroyCollapsibleHeader();
|
|
1221
|
-
}
|
|
1222
|
-
async checkCollapsibleHeader() {
|
|
1223
|
-
const mode = getIonMode$1(this);
|
|
1224
|
-
if (mode !== 'ios') {
|
|
1225
|
-
return;
|
|
1226
|
-
}
|
|
1227
|
-
const { collapse } = this;
|
|
1228
|
-
const hasCondense = collapse === 'condense';
|
|
1229
|
-
const hasFade = collapse === 'fade';
|
|
1230
|
-
this.destroyCollapsibleHeader();
|
|
1231
|
-
if (hasCondense) {
|
|
1232
|
-
const pageEl = this.el.closest('ion-app,ion-page,.ion-page,page-inner');
|
|
1233
|
-
const contentEl = pageEl ? findIonContent(pageEl) : null;
|
|
1234
|
-
// Cloned elements are always needed in iOS transition
|
|
1235
|
-
writeTask(() => {
|
|
1236
|
-
const title = cloneElement('ion-title');
|
|
1237
|
-
title.size = 'large';
|
|
1238
|
-
cloneElement('ion-back-button');
|
|
1239
|
-
});
|
|
1240
|
-
await this.setupCondenseHeader(contentEl, pageEl);
|
|
1241
|
-
}
|
|
1242
|
-
else if (hasFade) {
|
|
1243
|
-
const pageEl = this.el.closest('ion-app,ion-page,.ion-page,page-inner');
|
|
1244
|
-
const contentEl = pageEl ? findIonContent(pageEl) : null;
|
|
1245
|
-
if (!contentEl) {
|
|
1246
|
-
printIonContentErrorMsg(this.el);
|
|
1247
|
-
return;
|
|
1248
|
-
}
|
|
1249
|
-
const condenseHeader = contentEl.querySelector('ion-header[collapse="condense"]');
|
|
1250
|
-
await this.setupFadeHeader(contentEl, condenseHeader);
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
destroyCollapsibleHeader() {
|
|
1254
|
-
if (this.intersectionObserver) {
|
|
1255
|
-
this.intersectionObserver.disconnect();
|
|
1256
|
-
this.intersectionObserver = undefined;
|
|
1257
|
-
}
|
|
1258
|
-
if (this.scrollEl && this.contentScrollCallback) {
|
|
1259
|
-
this.scrollEl.removeEventListener('scroll', this.contentScrollCallback);
|
|
1260
|
-
this.contentScrollCallback = undefined;
|
|
1261
|
-
}
|
|
1262
|
-
if (this.collapsibleMainHeader) {
|
|
1263
|
-
this.collapsibleMainHeader.classList.remove('header-collapse-main');
|
|
1264
|
-
this.collapsibleMainHeader = undefined;
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
async setupCondenseHeader(contentEl, pageEl) {
|
|
1268
|
-
if (!contentEl || !pageEl) {
|
|
1269
|
-
printIonContentErrorMsg(this.el);
|
|
1270
|
-
return;
|
|
1271
|
-
}
|
|
1272
|
-
if (typeof IntersectionObserver === 'undefined') {
|
|
1273
|
-
return;
|
|
1274
|
-
}
|
|
1275
|
-
this.scrollEl = await getScrollElement(contentEl);
|
|
1276
|
-
const headers = pageEl.querySelectorAll('ion-header');
|
|
1277
|
-
this.collapsibleMainHeader = Array.from(headers).find((header) => header.collapse !== 'condense');
|
|
1278
|
-
if (!this.collapsibleMainHeader) {
|
|
1279
|
-
return;
|
|
1280
|
-
}
|
|
1281
|
-
const mainHeaderIndex = createHeaderIndex(this.collapsibleMainHeader);
|
|
1282
|
-
const scrollHeaderIndex = createHeaderIndex(this.el);
|
|
1283
|
-
if (!mainHeaderIndex || !scrollHeaderIndex) {
|
|
1284
|
-
return;
|
|
1285
|
-
}
|
|
1286
|
-
setHeaderActive(mainHeaderIndex, false);
|
|
1287
|
-
setToolbarBackgroundOpacity(mainHeaderIndex.el, 0);
|
|
1288
|
-
/**
|
|
1289
|
-
* Handle interaction between toolbar collapse and
|
|
1290
|
-
* showing/hiding content in the primary ion-header
|
|
1291
|
-
* as well as progressively showing/hiding the main header
|
|
1292
|
-
* border as the top-most toolbar collapses or expands.
|
|
1293
|
-
*/
|
|
1294
|
-
const toolbarIntersection = (ev) => {
|
|
1295
|
-
handleToolbarIntersection(ev, mainHeaderIndex, scrollHeaderIndex, this.scrollEl);
|
|
1296
|
-
};
|
|
1297
|
-
this.intersectionObserver = new IntersectionObserver(toolbarIntersection, {
|
|
1298
|
-
root: contentEl,
|
|
1299
|
-
threshold: [0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1],
|
|
1300
|
-
});
|
|
1301
|
-
this.intersectionObserver.observe(scrollHeaderIndex.toolbars[scrollHeaderIndex.toolbars.length - 1].el);
|
|
1302
|
-
/**
|
|
1303
|
-
* Handle scaling of large iOS titles and
|
|
1304
|
-
* showing/hiding border on last toolbar
|
|
1305
|
-
* in primary header
|
|
1306
|
-
*/
|
|
1307
|
-
this.contentScrollCallback = () => {
|
|
1308
|
-
handleContentScroll(this.scrollEl, scrollHeaderIndex, contentEl);
|
|
1309
|
-
};
|
|
1310
|
-
this.scrollEl.addEventListener('scroll', this.contentScrollCallback);
|
|
1311
|
-
writeTask(() => {
|
|
1312
|
-
if (this.collapsibleMainHeader !== undefined) {
|
|
1313
|
-
this.collapsibleMainHeader.classList.add('header-collapse-main');
|
|
1314
|
-
}
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
|
-
render() {
|
|
1318
|
-
const { translucent, inheritedAttributes } = this;
|
|
1319
|
-
const mode = getIonMode$1(this);
|
|
1320
|
-
const collapse = this.collapse || 'none';
|
|
1321
|
-
// banner role must be at top level, so remove role if inside a menu
|
|
1322
|
-
const roleType = hostContext('ion-menu', this.el) ? 'none' : 'banner';
|
|
1323
|
-
return (h(Host, Object.assign({ role: roleType, class: {
|
|
1324
|
-
[mode]: true,
|
|
1325
|
-
// Used internally for styling
|
|
1326
|
-
[`header-${mode}`]: true,
|
|
1327
|
-
[`header-translucent`]: this.translucent,
|
|
1328
|
-
[`header-collapse-${collapse}`]: true,
|
|
1329
|
-
[`header-translucent-${mode}`]: this.translucent,
|
|
1330
|
-
} }, inheritedAttributes), mode === 'ios' && translucent && h("div", { class: "header-background" }), h("slot", null)));
|
|
1331
|
-
}
|
|
1332
|
-
get el() { return getElement$1(this); }
|
|
1333
|
-
};
|
|
1334
|
-
Header.style = {
|
|
1335
|
-
ios: headerIosCss,
|
|
1336
|
-
md: headerMdCss
|
|
1337
|
-
};
|
|
1338
|
-
|
|
1339
|
-
let CACHED_MAP;
|
|
1340
|
-
const getIconMap = () => {
|
|
1341
|
-
if (typeof window === 'undefined') {
|
|
1342
|
-
return new Map();
|
|
1343
|
-
}
|
|
1344
|
-
else {
|
|
1345
|
-
if (!CACHED_MAP) {
|
|
1346
|
-
const win = window;
|
|
1347
|
-
win.Ionicons = win.Ionicons || {};
|
|
1348
|
-
CACHED_MAP = win.Ionicons.map = win.Ionicons.map || new Map();
|
|
1349
|
-
}
|
|
1350
|
-
return CACHED_MAP;
|
|
1351
|
-
}
|
|
1352
|
-
};
|
|
1353
|
-
const getUrl = (i) => {
|
|
1354
|
-
let url = getSrc(i.src);
|
|
1355
|
-
if (url) {
|
|
1356
|
-
return url;
|
|
1357
|
-
}
|
|
1358
|
-
url = getName(i.name, i.icon, i.mode, i.ios, i.md);
|
|
1359
|
-
if (url) {
|
|
1360
|
-
return getNamedUrl(url);
|
|
1361
|
-
}
|
|
1362
|
-
if (i.icon) {
|
|
1363
|
-
url = getSrc(i.icon);
|
|
1364
|
-
if (url) {
|
|
1365
|
-
return url;
|
|
1366
|
-
}
|
|
1367
|
-
url = getSrc(i.icon[i.mode]);
|
|
1368
|
-
if (url) {
|
|
1369
|
-
return url;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
return null;
|
|
1373
|
-
};
|
|
1374
|
-
const getNamedUrl = (iconName) => {
|
|
1375
|
-
const url = getIconMap().get(iconName);
|
|
1376
|
-
if (url) {
|
|
1377
|
-
return url;
|
|
1378
|
-
}
|
|
1379
|
-
return getAssetPath(`svg/${iconName}.svg`);
|
|
1380
|
-
};
|
|
1381
|
-
const getName = (iconName, icon, mode, ios, md) => {
|
|
1382
|
-
// default to "md" if somehow the mode wasn't set
|
|
1383
|
-
mode = (mode && toLower(mode)) === 'ios' ? 'ios' : 'md';
|
|
1384
|
-
// if an icon was passed in using the ios or md attributes
|
|
1385
|
-
// set the iconName to whatever was passed in
|
|
1386
|
-
if (ios && mode === 'ios') {
|
|
1387
|
-
iconName = toLower(ios);
|
|
1388
|
-
}
|
|
1389
|
-
else if (md && mode === 'md') {
|
|
1390
|
-
iconName = toLower(md);
|
|
1391
|
-
}
|
|
1392
|
-
else {
|
|
1393
|
-
if (!iconName && icon && !isSrc(icon)) {
|
|
1394
|
-
iconName = icon;
|
|
1395
|
-
}
|
|
1396
|
-
if (isStr(iconName)) {
|
|
1397
|
-
iconName = toLower(iconName);
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
if (!isStr(iconName) || iconName.trim() === '') {
|
|
1401
|
-
return null;
|
|
1402
|
-
}
|
|
1403
|
-
// only allow alpha characters and dash
|
|
1404
|
-
const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
|
|
1405
|
-
if (invalidChars !== '') {
|
|
1406
|
-
return null;
|
|
1407
|
-
}
|
|
1408
|
-
return iconName;
|
|
1409
|
-
};
|
|
1410
|
-
const getSrc = (src) => {
|
|
1411
|
-
if (isStr(src)) {
|
|
1412
|
-
src = src.trim();
|
|
1413
|
-
if (isSrc(src)) {
|
|
1414
|
-
return src;
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
return null;
|
|
1418
|
-
};
|
|
1419
|
-
const isSrc = (str) => str.length > 0 && /(\/|\.)/.test(str);
|
|
1420
|
-
const isStr = (val) => typeof val === 'string';
|
|
1421
|
-
const toLower = (val) => val.toLowerCase();
|
|
1422
|
-
/**
|
|
1423
|
-
* Elements inside of web components sometimes need to inherit global attributes
|
|
1424
|
-
* set on the host. For example, the inner input in `ion-input` should inherit
|
|
1425
|
-
* the `title` attribute that developers set directly on `ion-input`. This
|
|
1426
|
-
* helper function should be called in componentWillLoad and assigned to a variable
|
|
1427
|
-
* that is later used in the render function.
|
|
1428
|
-
*
|
|
1429
|
-
* This does not need to be reactive as changing attributes on the host element
|
|
1430
|
-
* does not trigger a re-render.
|
|
1431
|
-
*/
|
|
1432
|
-
const inheritAttributes = (el, attributes = []) => {
|
|
1433
|
-
const attributeObject = {};
|
|
1434
|
-
attributes.forEach(attr => {
|
|
1435
|
-
if (el.hasAttribute(attr)) {
|
|
1436
|
-
const value = el.getAttribute(attr);
|
|
1437
|
-
if (value !== null) {
|
|
1438
|
-
attributeObject[attr] = el.getAttribute(attr);
|
|
1439
|
-
}
|
|
1440
|
-
el.removeAttribute(attr);
|
|
1441
|
-
}
|
|
1442
|
-
});
|
|
1443
|
-
return attributeObject;
|
|
1444
|
-
};
|
|
1445
|
-
/**
|
|
1446
|
-
* Returns `true` if the document or host element
|
|
1447
|
-
* has a `dir` set to `rtl`. The host value will always
|
|
1448
|
-
* take priority over the root document value.
|
|
1449
|
-
*/
|
|
1450
|
-
const isRTL = (hostEl) => {
|
|
1451
|
-
if (hostEl) {
|
|
1452
|
-
if (hostEl.dir !== '') {
|
|
1453
|
-
return hostEl.dir.toLowerCase() === 'rtl';
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
return (document === null || document === void 0 ? void 0 : document.dir.toLowerCase()) === 'rtl';
|
|
1457
|
-
};
|
|
1458
|
-
|
|
1459
|
-
const validateContent = (svgContent) => {
|
|
1460
|
-
const div = document.createElement('div');
|
|
1461
|
-
div.innerHTML = svgContent;
|
|
1462
|
-
// setup this way to ensure it works on our buddy IE
|
|
1463
|
-
for (let i = div.childNodes.length - 1; i >= 0; i--) {
|
|
1464
|
-
if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {
|
|
1465
|
-
div.removeChild(div.childNodes[i]);
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
// must only have 1 root element
|
|
1469
|
-
const svgElm = div.firstElementChild;
|
|
1470
|
-
if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {
|
|
1471
|
-
const svgClass = svgElm.getAttribute('class') || '';
|
|
1472
|
-
svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());
|
|
1473
|
-
// root element must be an svg
|
|
1474
|
-
// lets double check we've got valid elements
|
|
1475
|
-
// do not allow scripts
|
|
1476
|
-
if (isValid(svgElm)) {
|
|
1477
|
-
return div.innerHTML;
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
return '';
|
|
1481
|
-
};
|
|
1482
|
-
const isValid = (elm) => {
|
|
1483
|
-
if (elm.nodeType === 1) {
|
|
1484
|
-
if (elm.nodeName.toLowerCase() === 'script') {
|
|
1485
|
-
return false;
|
|
1486
|
-
}
|
|
1487
|
-
for (let i = 0; i < elm.attributes.length; i++) {
|
|
1488
|
-
const name = elm.attributes[i].name;
|
|
1489
|
-
if (isStr(name) && name.toLowerCase().indexOf('on') === 0) {
|
|
1490
|
-
return false;
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
for (let i = 0; i < elm.childNodes.length; i++) {
|
|
1494
|
-
if (!isValid(elm.childNodes[i])) {
|
|
1495
|
-
return false;
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
return true;
|
|
1500
|
-
};
|
|
1501
|
-
|
|
1502
|
-
const ioniconContent = new Map();
|
|
1503
|
-
const requests = new Map();
|
|
1504
|
-
const getSvgContent = (url, sanitize) => {
|
|
1505
|
-
// see if we already have a request for this url
|
|
1506
|
-
let req = requests.get(url);
|
|
1507
|
-
if (!req) {
|
|
1508
|
-
if (typeof fetch !== 'undefined' && typeof document !== 'undefined') {
|
|
1509
|
-
// we don't already have a request
|
|
1510
|
-
req = fetch(url).then((rsp) => {
|
|
1511
|
-
if (rsp.ok) {
|
|
1512
|
-
return rsp.text().then((svgContent) => {
|
|
1513
|
-
if (svgContent && sanitize !== false) {
|
|
1514
|
-
svgContent = validateContent(svgContent);
|
|
1515
|
-
}
|
|
1516
|
-
ioniconContent.set(url, svgContent || '');
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
ioniconContent.set(url, '');
|
|
1520
|
-
});
|
|
1521
|
-
// cache for the same requests
|
|
1522
|
-
requests.set(url, req);
|
|
1523
|
-
}
|
|
1524
|
-
else {
|
|
1525
|
-
// set to empty for ssr scenarios and resolve promise
|
|
1526
|
-
ioniconContent.set(url, '');
|
|
1527
|
-
return Promise.resolve();
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
return req;
|
|
1531
|
-
};
|
|
1532
|
-
|
|
1533
|
-
const iconCss = ":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:32px;stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}:host(.flip-rtl) .icon-inner{transform:scaleX(-1)}:host(.icon-small){font-size:18px !important}:host(.icon-large){font-size:32px !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}";
|
|
1534
|
-
|
|
1535
|
-
let parser;
|
|
1536
|
-
const Icon = class {
|
|
1537
|
-
constructor(hostRef) {
|
|
1538
|
-
registerInstance(this, hostRef);
|
|
1539
|
-
this.iconName = null;
|
|
1540
|
-
this.inheritedAttributes = {};
|
|
1541
|
-
this.isVisible = false;
|
|
1542
|
-
/**
|
|
1543
|
-
* The mode determines which platform styles to use.
|
|
1544
|
-
*/
|
|
1545
|
-
this.mode = getIonMode();
|
|
1546
|
-
/**
|
|
1547
|
-
* If enabled, ion-icon will be loaded lazily when it's visible in the viewport.
|
|
1548
|
-
* Default, `false`.
|
|
1549
|
-
*/
|
|
1550
|
-
this.lazy = false;
|
|
1551
|
-
/**
|
|
1552
|
-
* When set to `false`, SVG content that is HTTP fetched will not be checked
|
|
1553
|
-
* if the response SVG content has any `<script>` elements, or any attributes
|
|
1554
|
-
* that start with `on`, such as `onclick`.
|
|
1555
|
-
* @default true
|
|
1556
|
-
*/
|
|
1557
|
-
this.sanitize = true;
|
|
1558
|
-
this.hasAriaHidden = () => {
|
|
1559
|
-
const { el } = this;
|
|
1560
|
-
return el.hasAttribute('aria-hidden') && el.getAttribute('aria-hidden') === 'true';
|
|
1561
|
-
};
|
|
1562
|
-
}
|
|
1563
|
-
componentWillLoad() {
|
|
1564
|
-
this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);
|
|
1565
|
-
}
|
|
1566
|
-
connectedCallback() {
|
|
1567
|
-
// purposely do not return the promise here because loading
|
|
1568
|
-
// the svg file should not hold up loading the app
|
|
1569
|
-
// only load the svg if it's visible
|
|
1570
|
-
this.waitUntilVisible(this.el, '50px', () => {
|
|
1571
|
-
this.isVisible = true;
|
|
1572
|
-
this.loadIcon();
|
|
1573
|
-
});
|
|
1574
|
-
}
|
|
1575
|
-
disconnectedCallback() {
|
|
1576
|
-
if (this.io) {
|
|
1577
|
-
this.io.disconnect();
|
|
1578
|
-
this.io = undefined;
|
|
1579
|
-
}
|
|
1580
|
-
}
|
|
1581
|
-
waitUntilVisible(el, rootMargin, cb) {
|
|
1582
|
-
if (this.lazy && typeof window !== 'undefined' && window.IntersectionObserver) {
|
|
1583
|
-
const io = (this.io = new window.IntersectionObserver((data) => {
|
|
1584
|
-
if (data[0].isIntersecting) {
|
|
1585
|
-
io.disconnect();
|
|
1586
|
-
this.io = undefined;
|
|
1587
|
-
cb();
|
|
1588
|
-
}
|
|
1589
|
-
}, { rootMargin }));
|
|
1590
|
-
io.observe(el);
|
|
1591
|
-
}
|
|
1592
|
-
else {
|
|
1593
|
-
// browser doesn't support IntersectionObserver
|
|
1594
|
-
// so just fallback to always show it
|
|
1595
|
-
cb();
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
loadIcon() {
|
|
1599
|
-
if (this.isVisible) {
|
|
1600
|
-
if (!parser) {
|
|
1601
|
-
/**
|
|
1602
|
-
* Create an instance of the DOM parser. This creates a single
|
|
1603
|
-
* parser instance for the entire app, which is more efficient.
|
|
1604
|
-
*/
|
|
1605
|
-
parser = new DOMParser();
|
|
1606
|
-
}
|
|
1607
|
-
const url = getUrl(this);
|
|
1608
|
-
if (url) {
|
|
1609
|
-
if (ioniconContent.has(url)) {
|
|
1610
|
-
// sync if it's already loaded
|
|
1611
|
-
this.svgContent = ioniconContent.get(url);
|
|
1612
|
-
}
|
|
1613
|
-
else if (url.startsWith('data:')) {
|
|
1614
|
-
const doc = parser.parseFromString(url, 'text/html');
|
|
1615
|
-
const svgEl = doc.body.querySelector('svg');
|
|
1616
|
-
if (svgEl !== null) {
|
|
1617
|
-
this.svgContent = svgEl.outerHTML;
|
|
1618
|
-
}
|
|
1619
|
-
else {
|
|
1620
|
-
this.svgContent = '';
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
else {
|
|
1624
|
-
// async if it hasn't been loaded
|
|
1625
|
-
getSvgContent(url, this.sanitize).then(() => (this.svgContent = ioniconContent.get(url)));
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
}
|
|
1629
|
-
const label = this.iconName = getName(this.name, this.icon, this.mode, this.ios, this.md);
|
|
1630
|
-
/**
|
|
1631
|
-
* Come up with a default label
|
|
1632
|
-
* in case user does not provide their own.
|
|
1633
|
-
*/
|
|
1634
|
-
if (label) {
|
|
1635
|
-
this.ariaLabel = label.replace(/\-/g, ' ');
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
render() {
|
|
1639
|
-
const { iconName, ariaLabel, el, inheritedAttributes } = this;
|
|
1640
|
-
const mode = this.mode || 'md';
|
|
1641
|
-
const flipRtl = this.flipRtl ||
|
|
1642
|
-
(iconName &&
|
|
1643
|
-
(iconName.indexOf('arrow') > -1 || iconName.indexOf('chevron') > -1) &&
|
|
1644
|
-
this.flipRtl !== false);
|
|
1645
|
-
/**
|
|
1646
|
-
* Only set the aria-label if a) we have generated
|
|
1647
|
-
* one for the icon and if aria-hidden is not set to "true".
|
|
1648
|
-
* If developer wants to set their own aria-label, then
|
|
1649
|
-
* inheritedAttributes down below will override whatever
|
|
1650
|
-
* default label we have set.
|
|
1651
|
-
*/
|
|
1652
|
-
return (h(Host, Object.assign({ "aria-label": ariaLabel !== undefined && !this.hasAriaHidden() ? ariaLabel : null, role: "img", class: Object.assign(Object.assign({ [mode]: true }, createColorClasses(this.color)), { [`icon-${this.size}`]: !!this.size, 'flip-rtl': !!flipRtl && isRTL(el) }) }, inheritedAttributes), this.svgContent ? (h("div", { class: "icon-inner", innerHTML: this.svgContent })) : (h("div", { class: "icon-inner" }))));
|
|
1653
|
-
}
|
|
1654
|
-
static get assetsDirs() { return ["svg"]; }
|
|
1655
|
-
get el() { return getElement$1(this); }
|
|
1656
|
-
static get watchers() { return {
|
|
1657
|
-
"name": ["loadIcon"],
|
|
1658
|
-
"src": ["loadIcon"],
|
|
1659
|
-
"icon": ["loadIcon"]
|
|
1660
|
-
}; }
|
|
1661
|
-
};
|
|
1662
|
-
const getIonMode = () => (typeof document !== 'undefined' && document.documentElement.getAttribute('mode')) || 'md';
|
|
1663
|
-
const createColorClasses = (color) => {
|
|
1664
|
-
return color
|
|
1665
|
-
? {
|
|
1666
|
-
'ion-color': true,
|
|
1667
|
-
[`ion-color-${color}`]: true,
|
|
1668
|
-
}
|
|
1669
|
-
: null;
|
|
1670
|
-
};
|
|
1671
|
-
Icon.style = iconCss;
|
|
1672
|
-
|
|
1673
|
-
const itemIosCss = ":host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--show-full-highlight:0;--show-inset-highlight:0;--detail-icon-color:initial;--detail-icon-font-size:20px;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;align-items:center;justify-content:space-between;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;overflow:hidden;box-sizing:border-box}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native,:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:inherit;justify-content:inherit;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;box-sizing:border-box;z-index:1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-native{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0;transition:var(--transition);z-index:-1}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);box-shadow:var(--inner-box-shadow);overflow:inherit;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-bottom{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--inner-padding-end);padding-top:0;padding-bottom:0;display:flex;justify-content:space-between}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-bottom{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--inner-padding-end);padding-inline-end:var(--inner-padding-end)}}.item-detail-icon{color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label:not([slot=end])){flex:1}:host(.item-input){align-items:center}.input-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:inherit;box-sizing:border-box}:host(.item-label-stacked),:host(.item-label-floating){align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{flex:1;flex-direction:column}.item-highlight,.item-inner-highlight{left:0;right:0;top:0;bottom:0;border-radius:inherit;position:absolute;width:100%;height:100%;transform:scaleX(0);transition:transform 200ms, border-bottom-width 200ms;z-index:2;box-sizing:border-box;pointer-events:none}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus),:host(.item-interactive.ion-touched.ion-invalid){--full-highlight-height:calc(var(--highlight-height) * var(--show-full-highlight));--inset-highlight-height:calc(var(--highlight-height) * var(--show-inset-highlight))}:host(.ion-focused) .item-highlight,:host(.ion-focused) .item-inner-highlight,:host(.item-has-focus) .item-highlight,:host(.item-has-focus) .item-inner-highlight{transform:scaleX(1);border-style:var(--border-style);border-color:var(--highlight-background)}:host(.ion-focused) .item-highlight,:host(.item-has-focus) .item-highlight{border-width:var(--full-highlight-height);opacity:var(--show-full-highlight)}:host(.ion-focused) .item-inner-highlight,:host(.item-has-focus) .item-inner-highlight{border-bottom-width:var(--inset-highlight-height);opacity:var(--show-inset-highlight)}:host(.ion-focused.item-fill-solid) .item-highlight,:host(.item-has-focus.item-fill-solid) .item-highlight{border-width:calc(var(--full-highlight-height) - 1px)}:host(.ion-focused) .item-inner-highlight,:host(.ion-focused:not(.item-fill-outline)) .item-highlight,:host(.item-has-focus) .item-inner-highlight,:host(.item-has-focus:not(.item-fill-outline)) .item-highlight{border-top:none;border-right:none;border-left:none}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus){--highlight-background:var(--highlight-color-focused)}:host(.item-interactive.ion-valid){--highlight-background:var(--highlight-color-valid)}:host(.item-interactive.ion-invalid){--highlight-background:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=helper]){display:none}::slotted([slot=error]){display:none;color:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=error]){display:block}:host(:not(.item-label)) ::slotted(ion-select){--padding-start:0;max-width:none}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0;align-self:stretch;width:100%;max-width:100%}:host(:not(.item-label)) ::slotted(ion-datetime){--padding-start:0}:host(.item-label-stacked) ::slotted(ion-datetime),:host(.item-label-floating) ::slotted(ion-datetime){--padding-start:0;width:100%}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio),:host(.item-multiple-inputs) ::slotted(ion-select){position:relative}:host(.item-textarea){align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host(.item-fill-solid) ::slotted([slot=start]),:host(.item-fill-solid) ::slotted([slot=end]),:host(.item-fill-outline) ::slotted([slot=start]),:host(.item-fill-outline) ::slotted([slot=end]){align-self:center}::slotted([slot=helper]),::slotted([slot=error]),.item-counter{padding-top:5px;font-size:12px;z-index:1}.item-counter{margin-left:auto;color:var(--ion-color-step-550, #737373);white-space:nowrap;padding-inline-start:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-counter{margin-left:unset;-webkit-margin-start:auto;margin-inline-start:auto}}@media (prefers-reduced-motion: reduce){.item-highlight,.item-inner-highlight{transition:none}}:host{--min-height:44px;--transition:background-color 200ms linear, opacity 200ms linear;--padding-start:20px;--inner-padding-end:10px;--inner-border-width:0px 0px 0.55px 0px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:#000;--background-focused:#000;--background-hover:currentColor;--background-activated-opacity:.12;--background-focused-opacity:.15;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, #c8c7cc)));--color:var(--ion-item-color, var(--ion-text-color, #000));--highlight-height:0px;--highlight-color-focused:var(--ion-color-primary, #3880ff);--highlight-color-valid:var(--ion-color-success, #2dd36f);--highlight-color-invalid:var(--ion-color-danger, #eb445a);--bottom-padding-start:0px;font-size:17px}:host(.ion-activated){--transition:none}:host(.ion-color.ion-focused) .item-native::after{background:#000;opacity:0.15}:host(.ion-color.ion-activated) .item-native::after{background:#000;opacity:0.12}:host(.item-interactive){--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-full){--border-width:0px 0px 0.55px 0px;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-inset){--inner-border-width:0px 0px 0.55px 0px;--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0px;--show-full-highlight:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0px;--show-inset-highlight:0}.item-highlight,.item-inner-highlight{transition:none}:host(.item-has-focus) .item-inner-highlight,:host(.item-has-focus) .item-highlight{border-top:none;border-right:none;border-left:none}::slotted([slot=start]){margin-left:0;margin-right:20px;margin-top:2px;margin-bottom:2px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:20px;margin-inline-end:20px}}::slotted([slot=end]){margin-left:10px;margin-right:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}::slotted(ion-icon[slot=start]),::slotted(ion-icon[slot=end]){margin-top:7px;margin-bottom:7px}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}::slotted(.button-small){--padding-top:0px;--padding-bottom:0px;--padding-start:.5em;--padding-end:.5em;height:24px;font-size:13px}::slotted(ion-avatar){width:36px;height:36px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:10px;margin-right:10px;margin-top:10px;margin-bottom:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){margin-left:0px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){margin-left:unset;-webkit-margin-start:0px;margin-inline-start:0px}}::slotted(ion-label){margin-left:0;margin-right:8px;margin-top:10px;margin-bottom:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-label){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px}}:host(.item-label-floating),:host(.item-label-stacked){--min-height:68px}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0px}:host(.item-label-fixed) ::slotted(ion-select),:host(.item-label-fixed) ::slotted(ion-datetime){--padding-start:0}";
|
|
1674
|
-
|
|
1675
|
-
const itemMdCss = ":host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--show-full-highlight:0;--show-inset-highlight:0;--detail-icon-color:initial;--detail-icon-font-size:20px;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;align-items:center;justify-content:space-between;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;overflow:hidden;box-sizing:border-box}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native,:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:inherit;justify-content:inherit;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;box-sizing:border-box;z-index:1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-native{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0;transition:var(--transition);z-index:-1}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);box-shadow:var(--inner-box-shadow);overflow:inherit;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-bottom{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--inner-padding-end);padding-top:0;padding-bottom:0;display:flex;justify-content:space-between}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-bottom{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--inner-padding-end);padding-inline-end:var(--inner-padding-end)}}.item-detail-icon{color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label:not([slot=end])){flex:1}:host(.item-input){align-items:center}.input-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:inherit;box-sizing:border-box}:host(.item-label-stacked),:host(.item-label-floating){align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{flex:1;flex-direction:column}.item-highlight,.item-inner-highlight{left:0;right:0;top:0;bottom:0;border-radius:inherit;position:absolute;width:100%;height:100%;transform:scaleX(0);transition:transform 200ms, border-bottom-width 200ms;z-index:2;box-sizing:border-box;pointer-events:none}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus),:host(.item-interactive.ion-touched.ion-invalid){--full-highlight-height:calc(var(--highlight-height) * var(--show-full-highlight));--inset-highlight-height:calc(var(--highlight-height) * var(--show-inset-highlight))}:host(.ion-focused) .item-highlight,:host(.ion-focused) .item-inner-highlight,:host(.item-has-focus) .item-highlight,:host(.item-has-focus) .item-inner-highlight{transform:scaleX(1);border-style:var(--border-style);border-color:var(--highlight-background)}:host(.ion-focused) .item-highlight,:host(.item-has-focus) .item-highlight{border-width:var(--full-highlight-height);opacity:var(--show-full-highlight)}:host(.ion-focused) .item-inner-highlight,:host(.item-has-focus) .item-inner-highlight{border-bottom-width:var(--inset-highlight-height);opacity:var(--show-inset-highlight)}:host(.ion-focused.item-fill-solid) .item-highlight,:host(.item-has-focus.item-fill-solid) .item-highlight{border-width:calc(var(--full-highlight-height) - 1px)}:host(.ion-focused) .item-inner-highlight,:host(.ion-focused:not(.item-fill-outline)) .item-highlight,:host(.item-has-focus) .item-inner-highlight,:host(.item-has-focus:not(.item-fill-outline)) .item-highlight{border-top:none;border-right:none;border-left:none}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus){--highlight-background:var(--highlight-color-focused)}:host(.item-interactive.ion-valid){--highlight-background:var(--highlight-color-valid)}:host(.item-interactive.ion-invalid){--highlight-background:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=helper]){display:none}::slotted([slot=error]){display:none;color:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=error]){display:block}:host(:not(.item-label)) ::slotted(ion-select){--padding-start:0;max-width:none}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0;align-self:stretch;width:100%;max-width:100%}:host(:not(.item-label)) ::slotted(ion-datetime){--padding-start:0}:host(.item-label-stacked) ::slotted(ion-datetime),:host(.item-label-floating) ::slotted(ion-datetime){--padding-start:0;width:100%}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio),:host(.item-multiple-inputs) ::slotted(ion-select){position:relative}:host(.item-textarea){align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host(.item-fill-solid) ::slotted([slot=start]),:host(.item-fill-solid) ::slotted([slot=end]),:host(.item-fill-outline) ::slotted([slot=start]),:host(.item-fill-outline) ::slotted([slot=end]){align-self:center}::slotted([slot=helper]),::slotted([slot=error]),.item-counter{padding-top:5px;font-size:12px;z-index:1}.item-counter{margin-left:auto;color:var(--ion-color-step-550, #737373);white-space:nowrap;padding-inline-start:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-counter{margin-left:unset;-webkit-margin-start:auto;margin-inline-start:auto}}@media (prefers-reduced-motion: reduce){.item-highlight,.item-inner-highlight{transition:none}}:host{--min-height:48px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor;--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));--color:var(--ion-item-color, var(--ion-text-color, #000));--transition:opacity 15ms linear, background-color 15ms linear;--padding-start:16px;--inner-padding-end:16px;--inner-border-width:0 0 1px 0;--highlight-height:1px;--highlight-color-focused:var(--ion-color-primary, #3880ff);--highlight-color-valid:var(--ion-color-success, #2dd36f);--highlight-color-invalid:var(--ion-color-danger, #eb445a);font-size:16px;font-weight:normal;text-transform:none}:host(.item-fill-outline){--highlight-height:2px}:host(.item-fill-none.item-interactive.ion-focus) .item-highlight,:host(.item-fill-none.item-interactive.item-has-focus) .item-highlight,:host(.item-fill-none.item-interactive.ion-touched.ion-invalid) .item-highlight{transform:scaleX(1);border-width:0 0 var(--full-highlight-height) 0;border-style:var(--border-style);border-color:var(--highlight-background)}:host(.item-fill-none.item-interactive.ion-focus) .item-native,:host(.item-fill-none.item-interactive.item-has-focus) .item-native,:host(.item-fill-none.item-interactive.ion-touched.ion-invalid) .item-native{border-bottom-color:var(--highlight-background)}:host(.item-fill-outline.item-interactive.ion-focus) .item-highlight,:host(.item-fill-outline.item-interactive.item-has-focus) .item-highlight{transform:scaleX(1)}:host(.item-fill-outline.item-interactive.ion-focus) .item-highlight,:host(.item-fill-outline.item-interactive.item-has-focus) .item-highlight,:host(.item-fill-outline.item-interactive.ion-touched.ion-invalid) .item-highlight{border-width:var(--full-highlight-height);border-style:var(--border-style);border-color:var(--highlight-background)}:host(.item-fill-outline.item-interactive.ion-touched.ion-invalid) .item-native{border-color:var(--highlight-background)}:host(.item-fill-solid.item-interactive.ion-focus) .item-highlight,:host(.item-fill-solid.item-interactive.item-has-focus) .item-highlight,:host(.item-fill-solid.item-interactive.ion-touched.ion-invalid) .item-highlight{transform:scaleX(1);border-width:0 0 var(--full-highlight-height) 0;border-style:var(--border-style);border-color:var(--highlight-background)}:host(.item-fill-solid.item-interactive.ion-focus) .item-native,:host(.item-fill-solid.item-interactive.item-has-focus) .item-native,:host(.item-fill-solid.item-interactive.ion-touched.ion-invalid) .item-native{border-bottom-color:var(--highlight-background)}:host(.ion-color.ion-activated) .item-native::after{background:transparent}:host(.item-has-focus) .item-native{caret-color:var(--highlight-background)}:host(.item-interactive){--border-width:0 0 1px 0;--inner-border-width:0;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-full){--border-width:0 0 1px 0;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-inset){--inner-border-width:0 0 1px 0;--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0;--show-full-highlight:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0;--show-inset-highlight:0}:host(.item-fill-outline) .item-highlight{--position-offset:calc(-1 * var(--border-width));left:var(--position-offset);top:var(--position-offset);width:calc(100% + 2 * var(--border-width));height:calc(100% + 2 * var(--border-width));transition:none}:host-context([dir=rtl]):host(.item-fill-outline) .item-highlight,:host-context([dir=rtl]).item-fill-outline .item-highlight{left:unset;right:unset;right:var(--position-offset)}:host(.item-fill-outline.ion-focused) .item-native,:host(.item-fill-outline.item-has-focus) .item-native{border-color:transparent}:host(.item-multi-line) ::slotted([slot=start]),:host(.item-multi-line) ::slotted([slot=end]){margin-top:16px;margin-bottom:16px;align-self:flex-start}::slotted([slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted([slot=end]){margin-left:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;-webkit-margin-start:32px;margin-inline-start:32px}}:host(.item-fill-solid) ::slotted([slot=start]),:host(.item-fill-solid) ::slotted([slot=end]),:host(.item-fill-outline) ::slotted([slot=start]),:host(.item-fill-outline) ::slotted([slot=end]){align-self:center}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);font-size:24px}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted(ion-icon[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}:host(.item-fill-solid) ::slotted(ion-icon[slot=start]),:host(.item-fill-outline) ::slotted(ion-icon[slot=start]){margin-right:8px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-fill-solid) ::slotted(ion-icon[slot=start]),:host(.item-fill-outline) ::slotted(ion-icon[slot=start]){margin-right:unset;-webkit-margin-end:8px;margin-inline-end:8px}}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}::slotted(ion-note){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;align-self:flex-start;font-size:11px}::slotted(ion-note[slot]:not([slot=helper]):not([slot=error])){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-note[slot=start]){padding-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=start]){padding-right:unset;-webkit-padding-end:16px;padding-inline-end:16px}}::slotted(ion-note[slot=end]){padding-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=end]){padding-left:unset;-webkit-padding-start:16px;padding-inline-start:16px}}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:unset;-webkit-margin-end:16px;margin-inline-end:16px}}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:10px;margin-bottom:10px}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}:host(.item-label-fixed) ::slotted(ion-select),:host(.item-label-fixed) ::slotted(ion-datetime){--padding-start:8px}:host(.item-toggle) ::slotted(ion-label),:host(.item-radio) ::slotted(ion-label){margin-left:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-toggle) ::slotted(ion-label),:host(.item-radio) ::slotted(ion-label){margin-left:unset;-webkit-margin-start:0;margin-inline-start:0}}::slotted(.button-small){--padding-top:0;--padding-bottom:0;--padding-start:.6em;--padding-end:.6em;height:25px;font-size:12px}:host(.item-label-floating),:host(.item-label-stacked){--min-height:55px}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0}:host(.ion-focused:not(.ion-color)) ::slotted(.label-stacked),:host(.ion-focused:not(.ion-color)) ::slotted(.label-floating),:host(.item-has-focus:not(.ion-color)) ::slotted(.label-stacked),:host(.item-has-focus:not(.ion-color)) ::slotted(.label-floating){color:var(--ion-color-primary, #3880ff)}:host(.ion-color){--highlight-color-focused:var(--ion-color-contrast)}:host(.item-label-color){--highlight-color-focused:var(--ion-color-base)}:host(.item-fill-solid.ion-color),:host(.item-fill-outline.ion-color){--highlight-color-focused:var(--ion-color-base)}:host(.item-fill-solid){--background:var(--ion-color-step-50, #f2f2f2);--background-hover:var(--ion-color-step-100, #e6e6e6);--background-focused:var(--ion-color-step-150, #d9d9d9);--border-width:0 0 1px 0;--inner-border-width:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl]):host(.item-fill-solid),:host-context([dir=rtl]).item-fill-solid{border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}:host(.item-fill-solid) .item-native{--border-color:var(--ion-color-step-500, gray)}:host(.item-fill-solid.ion-focused) .item-native,:host(.item-fill-solid.item-has-focus) .item-native{--background:var(--background-focused)}:host(.item-fill-solid.item-shape-round){border-top-left-radius:16px;border-top-right-radius:16px;border-bottom-right-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl]):host(.item-fill-solid.item-shape-round),:host-context([dir=rtl]).item-fill-solid.item-shape-round{border-top-left-radius:16px;border-top-right-radius:16px;border-bottom-right-radius:0;border-bottom-left-radius:0}@media (any-hover: hover){:host(.item-fill-solid:hover) .item-native{--background:var(--background-hover);--border-color:var(--ion-color-step-750, #404040)}}:host(.item-fill-outline){--ripple-color:transparent;--background-focused:transparent;--background-hover:transparent;--border-color:var(--ion-color-step-500, gray);--border-width:1px;border:none;overflow:visible}:host(.item-fill-outline) .item-native{--native-padding-left:16px;border-radius:4px}:host(.item-fill-outline.item-shape-round) .item-native{--inner-padding-start:16px;border-radius:28px}:host(.item-fill-outline.item-shape-round) .item-bottom{padding-left:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-fill-outline.item-shape-round) .item-bottom{padding-left:unset;-webkit-padding-start:32px;padding-inline-start:32px}}:host(.item-fill-outline.item-label-floating.ion-focused) .item-native ::slotted(ion-input:not(:first-child)),:host(.item-fill-outline.item-label-floating.ion-focused) .item-native ::slotted(ion-textarea:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-focus) .item-native ::slotted(ion-input:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-focus) .item-native ::slotted(ion-textarea:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-value) .item-native ::slotted(ion-input:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-value) .item-native ::slotted(ion-textarea:not(:first-child)){transform:translateY(-14px)}@media (any-hover: hover){:host(.item-fill-outline:hover) .item-native{--border-color:var(--ion-color-step-750, #404040)}}.item-counter{letter-spacing:0.0333333333em}";
|
|
1676
|
-
|
|
1677
|
-
const Item = class {
|
|
1678
|
-
constructor(hostRef) {
|
|
1679
|
-
registerInstance(this, hostRef);
|
|
1680
|
-
this.labelColorStyles = {};
|
|
1681
|
-
this.itemStyles = new Map();
|
|
1682
|
-
this.inheritedAriaAttributes = {};
|
|
1683
|
-
this.multipleInputs = false;
|
|
1684
|
-
this.focusable = true;
|
|
1685
|
-
/**
|
|
1686
|
-
* If `true`, a button tag will be rendered and the item will be tappable.
|
|
1687
|
-
*/
|
|
1688
|
-
this.button = false;
|
|
1689
|
-
/**
|
|
1690
|
-
* The icon to use when `detail` is set to `true`.
|
|
1691
|
-
*/
|
|
1692
|
-
this.detailIcon = chevronForward;
|
|
1693
|
-
/**
|
|
1694
|
-
* If `true`, the user cannot interact with the item.
|
|
1695
|
-
*/
|
|
1696
|
-
this.disabled = false;
|
|
1697
|
-
/**
|
|
1698
|
-
* If `true`, a character counter will display the ratio of characters used and the total character limit. Only applies when the `maxlength` property is set on the inner `ion-input` or `ion-textarea`.
|
|
1699
|
-
*/
|
|
1700
|
-
this.counter = false;
|
|
1701
|
-
/**
|
|
1702
|
-
* When using a router, it specifies the transition direction when navigating to
|
|
1703
|
-
* another page using `href`.
|
|
1704
|
-
*/
|
|
1705
|
-
this.routerDirection = 'forward';
|
|
1706
|
-
/**
|
|
1707
|
-
* The type of the button. Only used when an `onclick` or `button` property is present.
|
|
1708
|
-
*/
|
|
1709
|
-
this.type = 'button';
|
|
1710
|
-
}
|
|
1711
|
-
counterFormatterChanged() {
|
|
1712
|
-
this.updateCounterOutput(this.getFirstInput());
|
|
1713
|
-
}
|
|
1714
|
-
handleIonChange(ev) {
|
|
1715
|
-
if (this.counter && ev.target === this.getFirstInput()) {
|
|
1716
|
-
this.updateCounterOutput(ev.target);
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
labelColorChanged(ev) {
|
|
1720
|
-
const { color } = this;
|
|
1721
|
-
// There will be a conflict with item color if
|
|
1722
|
-
// we apply the label color to item, so we ignore
|
|
1723
|
-
// the label color if the user sets a color on item
|
|
1724
|
-
if (color === undefined) {
|
|
1725
|
-
this.labelColorStyles = ev.detail;
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
itemStyle(ev) {
|
|
1729
|
-
ev.stopPropagation();
|
|
1730
|
-
const tagName = ev.target.tagName;
|
|
1731
|
-
const updatedStyles = ev.detail;
|
|
1732
|
-
const newStyles = {};
|
|
1733
|
-
const childStyles = this.itemStyles.get(tagName) || {};
|
|
1734
|
-
let hasStyleChange = false;
|
|
1735
|
-
Object.keys(updatedStyles).forEach((key) => {
|
|
1736
|
-
if (updatedStyles[key]) {
|
|
1737
|
-
const itemKey = `item-${key}`;
|
|
1738
|
-
if (!childStyles[itemKey]) {
|
|
1739
|
-
hasStyleChange = true;
|
|
1740
|
-
}
|
|
1741
|
-
newStyles[itemKey] = true;
|
|
1742
|
-
}
|
|
1743
|
-
});
|
|
1744
|
-
if (!hasStyleChange && Object.keys(newStyles).length !== Object.keys(childStyles).length) {
|
|
1745
|
-
hasStyleChange = true;
|
|
1746
|
-
}
|
|
1747
|
-
if (hasStyleChange) {
|
|
1748
|
-
this.itemStyles.set(tagName, newStyles);
|
|
1749
|
-
forceUpdate(this);
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
connectedCallback() {
|
|
1753
|
-
if (this.counter) {
|
|
1754
|
-
this.updateCounterOutput(this.getFirstInput());
|
|
1755
|
-
}
|
|
1756
|
-
this.hasStartEl();
|
|
1757
|
-
}
|
|
1758
|
-
componentDidUpdate() {
|
|
1759
|
-
// Do not use @Listen here to avoid making all items
|
|
1760
|
-
// appear as clickable to screen readers
|
|
1761
|
-
// https://github.com/ionic-team/ionic-framework/issues/22011
|
|
1762
|
-
const input = this.getFirstInput();
|
|
1763
|
-
if (input !== undefined && !this.clickListener) {
|
|
1764
|
-
this.clickListener = (ev) => this.delegateFocus(ev, input);
|
|
1765
|
-
this.el.addEventListener('click', this.clickListener);
|
|
1766
|
-
}
|
|
1767
|
-
}
|
|
1768
|
-
disconnectedCallback() {
|
|
1769
|
-
const input = this.getFirstInput();
|
|
1770
|
-
if (input !== undefined && this.clickListener) {
|
|
1771
|
-
this.el.removeEventListener('click', this.clickListener);
|
|
1772
|
-
this.clickListener = undefined;
|
|
1773
|
-
}
|
|
1774
|
-
}
|
|
1775
|
-
componentDidLoad() {
|
|
1776
|
-
raf(() => {
|
|
1777
|
-
this.inheritedAriaAttributes = inheritAttributes$1(this.el, ['aria-label']);
|
|
1778
|
-
this.setMultipleInputs();
|
|
1779
|
-
this.focusable = this.isFocusable();
|
|
1780
|
-
});
|
|
1781
|
-
}
|
|
1782
|
-
// If the item contains multiple clickable elements and/or inputs, then the item
|
|
1783
|
-
// should not have a clickable input cover over the entire item to prevent
|
|
1784
|
-
// interfering with their individual click events
|
|
1785
|
-
setMultipleInputs() {
|
|
1786
|
-
// The following elements have a clickable cover that is relative to the entire item
|
|
1787
|
-
const covers = this.el.querySelectorAll('ion-checkbox, ion-datetime, ion-select, ion-radio');
|
|
1788
|
-
// The following elements can accept focus alongside the previous elements
|
|
1789
|
-
// therefore if these elements are also a child of item, we don't want the
|
|
1790
|
-
// input cover on top of those interfering with their clicks
|
|
1791
|
-
const inputs = this.el.querySelectorAll('ion-input, ion-range, ion-searchbar, ion-segment, ion-textarea, ion-toggle');
|
|
1792
|
-
// The following elements should also stay clickable when an input with cover is present
|
|
1793
|
-
const clickables = this.el.querySelectorAll('ion-anchor, ion-button, a, button');
|
|
1794
|
-
// Check for multiple inputs to change the position of the input cover to relative
|
|
1795
|
-
// for all of the covered inputs above
|
|
1796
|
-
this.multipleInputs =
|
|
1797
|
-
covers.length + inputs.length > 1 ||
|
|
1798
|
-
covers.length + clickables.length > 1 ||
|
|
1799
|
-
(covers.length > 0 && this.isClickable());
|
|
1800
|
-
}
|
|
1801
|
-
// If the item contains an input including a checkbox, datetime, select, or radio
|
|
1802
|
-
// then the item will have a clickable input cover that covers the item
|
|
1803
|
-
// that should get the hover, focused and activated states UNLESS it has multiple
|
|
1804
|
-
// inputs, then those need to individually get each click
|
|
1805
|
-
hasCover() {
|
|
1806
|
-
const inputs = this.el.querySelectorAll('ion-checkbox, ion-datetime, ion-select, ion-radio');
|
|
1807
|
-
return inputs.length === 1 && !this.multipleInputs;
|
|
1808
|
-
}
|
|
1809
|
-
// If the item has an href or button property it will render a native
|
|
1810
|
-
// anchor or button that is clickable
|
|
1811
|
-
isClickable() {
|
|
1812
|
-
return this.href !== undefined || this.button;
|
|
1813
|
-
}
|
|
1814
|
-
canActivate() {
|
|
1815
|
-
return this.isClickable() || this.hasCover();
|
|
1816
|
-
}
|
|
1817
|
-
isFocusable() {
|
|
1818
|
-
const focusableChild = this.el.querySelector('.ion-focusable');
|
|
1819
|
-
return this.canActivate() || focusableChild !== null;
|
|
1820
|
-
}
|
|
1821
|
-
getFirstInput() {
|
|
1822
|
-
const inputs = this.el.querySelectorAll('ion-input, ion-textarea');
|
|
1823
|
-
return inputs[0];
|
|
1824
|
-
}
|
|
1825
|
-
// This is needed for WebKit due to a delegatesFocus bug where
|
|
1826
|
-
// clicking on the left padding of an item is not focusing the input
|
|
1827
|
-
// but is opening the keyboard. It will no longer be needed with
|
|
1828
|
-
// iOS 14.
|
|
1829
|
-
delegateFocus(ev, input) {
|
|
1830
|
-
const clickedItem = ev.target.tagName === 'ION-ITEM';
|
|
1831
|
-
let firstActive = false;
|
|
1832
|
-
// If the first input is the same as the active element we need
|
|
1833
|
-
// to focus the first input again, but if the active element
|
|
1834
|
-
// is another input inside of the item we shouldn't switch focus
|
|
1835
|
-
if (document.activeElement) {
|
|
1836
|
-
firstActive = input.querySelector('input, textarea') === document.activeElement;
|
|
1837
|
-
}
|
|
1838
|
-
// Only focus the first input if we clicked on an ion-item
|
|
1839
|
-
// and the first input exists
|
|
1840
|
-
if (clickedItem && (firstActive || !this.multipleInputs)) {
|
|
1841
|
-
input.fireFocusEvents = false;
|
|
1842
|
-
input.setBlur();
|
|
1843
|
-
input.setFocus();
|
|
1844
|
-
raf(() => {
|
|
1845
|
-
input.fireFocusEvents = true;
|
|
1846
|
-
});
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
|
-
updateCounterOutput(inputEl) {
|
|
1850
|
-
var _a, _b;
|
|
1851
|
-
const { counter, counterFormatter, defaultCounterFormatter } = this;
|
|
1852
|
-
if (counter && !this.multipleInputs && (inputEl === null || inputEl === void 0 ? void 0 : inputEl.maxlength) !== undefined) {
|
|
1853
|
-
const length = (_b = (_a = inputEl === null || inputEl === void 0 ? void 0 : inputEl.value) === null || _a === void 0 ? void 0 : _a.toString().length) !== null && _b !== void 0 ? _b : 0;
|
|
1854
|
-
if (counterFormatter === undefined) {
|
|
1855
|
-
this.counterString = defaultCounterFormatter(length, inputEl.maxlength);
|
|
1856
|
-
}
|
|
1857
|
-
else {
|
|
1858
|
-
try {
|
|
1859
|
-
this.counterString = counterFormatter(length, inputEl.maxlength);
|
|
1860
|
-
}
|
|
1861
|
-
catch (e) {
|
|
1862
|
-
printIonError('Exception in provided `counterFormatter`.', e);
|
|
1863
|
-
// Fallback to the default counter formatter when an exception happens
|
|
1864
|
-
this.counterString = defaultCounterFormatter(length, inputEl.maxlength);
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
defaultCounterFormatter(length, maxlength) {
|
|
1870
|
-
return `${length} / ${maxlength}`;
|
|
1871
|
-
}
|
|
1872
|
-
hasStartEl() {
|
|
1873
|
-
const startEl = this.el.querySelector('[slot="start"]');
|
|
1874
|
-
if (startEl !== null) {
|
|
1875
|
-
this.el.classList.add('item-has-start-slot');
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
render() {
|
|
1879
|
-
const { counterString, detail, detailIcon, download, fill, labelColorStyles, lines, disabled, href, rel, shape, target, routerAnimation, routerDirection, inheritedAriaAttributes, } = this;
|
|
1880
|
-
const childStyles = {};
|
|
1881
|
-
const mode = getIonMode$1(this);
|
|
1882
|
-
const clickable = this.isClickable();
|
|
1883
|
-
const canActivate = this.canActivate();
|
|
1884
|
-
const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div';
|
|
1885
|
-
const attrs = TagType === 'button'
|
|
1886
|
-
? { type: this.type }
|
|
1887
|
-
: {
|
|
1888
|
-
download,
|
|
1889
|
-
href,
|
|
1890
|
-
rel,
|
|
1891
|
-
target,
|
|
1892
|
-
};
|
|
1893
|
-
// Only set onClick if the item is clickable to prevent screen
|
|
1894
|
-
// readers from reading all items as clickable
|
|
1895
|
-
const clickFn = clickable
|
|
1896
|
-
? {
|
|
1897
|
-
onClick: (ev) => {
|
|
1898
|
-
openURL(href, ev, routerDirection, routerAnimation);
|
|
1899
|
-
},
|
|
1900
|
-
}
|
|
1901
|
-
: {};
|
|
1902
|
-
const showDetail = detail !== undefined ? detail : mode === 'ios' && clickable;
|
|
1903
|
-
this.itemStyles.forEach((value) => {
|
|
1904
|
-
Object.assign(childStyles, value);
|
|
1905
|
-
});
|
|
1906
|
-
const ariaDisabled = disabled || childStyles['item-interactive-disabled'] ? 'true' : null;
|
|
1907
|
-
const fillValue = fill || 'none';
|
|
1908
|
-
const inList = hostContext('ion-list', this.el);
|
|
1909
|
-
return (h(Host, { "aria-disabled": ariaDisabled, class: Object.assign(Object.assign(Object.assign({}, childStyles), labelColorStyles), createColorClasses$1(this.color, {
|
|
1910
|
-
item: true,
|
|
1911
|
-
[mode]: true,
|
|
1912
|
-
[`item-lines-${lines}`]: lines !== undefined,
|
|
1913
|
-
[`item-fill-${fillValue}`]: true,
|
|
1914
|
-
[`item-shape-${shape}`]: shape !== undefined,
|
|
1915
|
-
'item-disabled': disabled,
|
|
1916
|
-
'in-list': inList,
|
|
1917
|
-
'item-multiple-inputs': this.multipleInputs,
|
|
1918
|
-
'ion-activatable': canActivate,
|
|
1919
|
-
'ion-focusable': this.focusable,
|
|
1920
|
-
'item-rtl': document.dir === 'rtl',
|
|
1921
|
-
})), role: inList ? 'listitem' : null }, h(TagType, Object.assign({}, attrs, inheritedAriaAttributes, { class: "item-native", part: "native", disabled: disabled }, clickFn), h("slot", { name: "start" }), h("div", { class: "item-inner" }, h("div", { class: "input-wrapper" }, h("slot", null)), h("slot", { name: "end" }), showDetail && (h("ion-icon", { icon: detailIcon, lazy: false, class: "item-detail-icon", part: "detail-icon", "aria-hidden": "true", "flip-rtl": detailIcon === chevronForward })), h("div", { class: "item-inner-highlight" })), canActivate && mode === 'md' && h("ion-ripple-effect", null), h("div", { class: "item-highlight" })), h("div", { class: "item-bottom" }, h("slot", { name: "error" }), h("slot", { name: "helper" }), counterString && h("ion-note", { class: "item-counter" }, counterString))));
|
|
1922
|
-
}
|
|
1923
|
-
static get delegatesFocus() { return true; }
|
|
1924
|
-
get el() { return getElement$1(this); }
|
|
1925
|
-
static get watchers() { return {
|
|
1926
|
-
"counterFormatter": ["counterFormatterChanged"]
|
|
1927
|
-
}; }
|
|
1928
|
-
};
|
|
1929
|
-
Item.style = {
|
|
1930
|
-
ios: itemIosCss,
|
|
1931
|
-
md: itemMdCss
|
|
1932
|
-
};
|
|
1933
|
-
|
|
1934
|
-
const itemDividerIosCss = ":host{--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--inner-padding-top:0px;--inner-padding-end:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;align-items:center;justify-content:space-between;width:100%;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:100;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.item-divider-sticky){position:sticky;top:0}.item-divider-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border:0;overflow:hidden}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-divider-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-divider-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:hidden}:host{--background:var(--ion-color-step-100, #e6e6e6);--color:var(--ion-color-step-850, #262626);--padding-start:20px;--inner-padding-end:10px;border-radius:0;position:relative;min-height:28px;font-size:17px;font-weight:600}:host([slot=start]){margin-left:0;margin-right:20px;margin-top:2px;margin-bottom:2px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host([slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:20px;margin-inline-end:20px}}:host([slot=end]){margin-left:10px;margin-right:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host([slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}::slotted(ion-icon[slot=start]),::slotted(ion-icon[slot=end]){margin-top:7px;margin-bottom:7px}::slotted(h1){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}::slotted(h2){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:17px;font-weight:normal}::slotted(h3),::slotted(h4),::slotted(h5),::slotted(h6){margin-left:0;margin-right:0;margin-top:0;margin-bottom:3px;font-size:14px;font-weight:normal;line-height:normal}::slotted(p){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.4);font-size:14px;line-height:normal;text-overflow:inherit;overflow:inherit}::slotted(h2:last-child) ::slotted(h3:last-child),::slotted(h4:last-child),::slotted(h5:last-child),::slotted(h6:last-child),::slotted(p:last-child){margin-bottom:0}";
|
|
1935
|
-
|
|
1936
|
-
const itemDividerMdCss = ":host{--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--inner-padding-top:0px;--inner-padding-end:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;align-items:center;justify-content:space-between;width:100%;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:100;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.item-divider-sticky){position:sticky;top:0}.item-divider-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border:0;overflow:hidden}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-divider-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-divider-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:hidden}:host{--background:var(--ion-background-color, #fff);--color:var(--ion-color-step-400, #999999);--padding-start:16px;--inner-padding-end:0;min-height:30px;border-bottom:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));font-size:14px}::slotted([slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted([slot=end]){margin-left:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;-webkit-margin-start:32px;margin-inline-start:32px}}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:13px;margin-bottom:10px}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);font-size:24px}:host(.ion-color) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted(ion-icon[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(ion-note){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;align-self:flex-start;font-size:11px}::slotted(ion-note[slot]){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-note[slot=start]){padding-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=start]){padding-right:unset;-webkit-padding-end:16px;padding-inline-end:16px}}::slotted(ion-note[slot=end]){padding-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=end]){padding-left:unset;-webkit-padding-start:16px;padding-inline-start:16px}}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:unset;-webkit-margin-end:16px;margin-inline-end:16px}}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(h1){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}::slotted(h2){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:normal}::slotted(h3,h4,h5,h6){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:normal;line-height:normal}::slotted(p){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;color:var(--ion-color-step-600, #666666);font-size:14px;line-height:normal;text-overflow:inherit;overflow:inherit}";
|
|
1937
|
-
|
|
1938
|
-
const ItemDivider = class {
|
|
1939
|
-
constructor(hostRef) {
|
|
1940
|
-
registerInstance(this, hostRef);
|
|
1941
|
-
/**
|
|
1942
|
-
* When it's set to `true`, the item-divider will stay visible when it reaches the top
|
|
1943
|
-
* of the viewport until the next `ion-item-divider` replaces it.
|
|
1944
|
-
*
|
|
1945
|
-
* This feature relies in `position:sticky`:
|
|
1946
|
-
* https://caniuse.com/#feat=css-sticky
|
|
1947
|
-
*/
|
|
1948
|
-
this.sticky = false;
|
|
1949
|
-
}
|
|
1950
|
-
render() {
|
|
1951
|
-
const mode = getIonMode$1(this);
|
|
1952
|
-
return (h(Host, { class: createColorClasses$1(this.color, {
|
|
1953
|
-
[mode]: true,
|
|
1954
|
-
'item-divider-sticky': this.sticky,
|
|
1955
|
-
item: true,
|
|
1956
|
-
}) }, h("slot", { name: "start" }), h("div", { class: "item-divider-inner" }, h("div", { class: "item-divider-wrapper" }, h("slot", null)), h("slot", { name: "end" }))));
|
|
1957
|
-
}
|
|
1958
|
-
get el() { return getElement$1(this); }
|
|
1959
|
-
};
|
|
1960
|
-
ItemDivider.style = {
|
|
1961
|
-
ios: itemDividerIosCss,
|
|
1962
|
-
md: itemDividerMdCss
|
|
1963
|
-
};
|
|
1964
|
-
|
|
1965
|
-
const itemGroupIosCss = "ion-item-group{display:block}";
|
|
1966
|
-
|
|
1967
|
-
const itemGroupMdCss = "ion-item-group{display:block}";
|
|
1968
|
-
|
|
1969
|
-
const ItemGroup = class {
|
|
1970
|
-
constructor(hostRef) {
|
|
1971
|
-
registerInstance(this, hostRef);
|
|
1972
|
-
}
|
|
1973
|
-
render() {
|
|
1974
|
-
const mode = getIonMode$1(this);
|
|
1975
|
-
return (h(Host, { role: "group", class: {
|
|
1976
|
-
[mode]: true,
|
|
1977
|
-
// Used internally for styling
|
|
1978
|
-
[`item-group-${mode}`]: true,
|
|
1979
|
-
item: true,
|
|
1980
|
-
} }));
|
|
1981
|
-
}
|
|
1982
|
-
};
|
|
1983
|
-
ItemGroup.style = {
|
|
1984
|
-
ios: itemGroupIosCss,
|
|
1985
|
-
md: itemGroupMdCss
|
|
1986
|
-
};
|
|
1987
|
-
|
|
1988
|
-
const labelIosCss = ".item.sc-ion-label-ios-h,.item .sc-ion-label-ios-h{--color:initial;display:block;color:var(--color);font-family:var(--ion-font-family, inherit);font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;box-sizing:border-box}.ion-color.sc-ion-label-ios-h{color:var(--ion-color-base)}.ion-text-wrap.sc-ion-label-ios-h,[text-wrap].sc-ion-label-ios-h{white-space:normal}.item-interactive-disabled.sc-ion-label-ios-h:not(.item-multiple-inputs),.item-interactive-disabled:not(.item-multiple-inputs) .sc-ion-label-ios-h{cursor:default;opacity:0.3;pointer-events:none}.item-input.sc-ion-label-ios-h,.item-input .sc-ion-label-ios-h{flex:initial;max-width:200px;pointer-events:none}.item-textarea.sc-ion-label-ios-h,.item-textarea .sc-ion-label-ios-h{align-self:baseline}.label-fixed.sc-ion-label-ios-h{flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.label-stacked.sc-ion-label-ios-h,.label-floating.sc-ion-label-ios-h{margin-bottom:0;align-self:stretch;width:auto;max-width:100%}.label-no-animate.label-floating.sc-ion-label-ios-h{transition:none}.sc-ion-label-ios-s h1,.sc-ion-label-ios-s h2,.sc-ion-label-ios-s h3,.sc-ion-label-ios-s h4,.sc-ion-label-ios-s h5,.sc-ion-label-ios-s h6{text-overflow:inherit;overflow:inherit}.ion-text-wrap.sc-ion-label-ios-h,[text-wrap].sc-ion-label-ios-h{font-size:14px;line-height:1.5}.label-stacked.sc-ion-label-ios-h{margin-bottom:4px;font-size:14px}.label-floating.sc-ion-label-ios-h{margin-bottom:0;transform:translate(0, 29px);transform-origin:left top;transition:transform 150ms ease-in-out}[dir=rtl].sc-ion-label-ios-h -no-combinator.label-floating.sc-ion-label-ios-h,[dir=rtl] .sc-ion-label-ios-h -no-combinator.label-floating.sc-ion-label-ios-h,[dir=rtl].label-floating.sc-ion-label-ios-h,[dir=rtl] .label-floating.sc-ion-label-ios-h{transform-origin:right top}.item-textarea.label-floating.sc-ion-label-ios-h,.item-textarea .label-floating.sc-ion-label-ios-h{transform:translate(0, 28px)}.item-has-focus.label-floating.sc-ion-label-ios-h,.item-has-focus .label-floating.sc-ion-label-ios-h,.item-has-placeholder.sc-ion-label-ios-h:not(.item-input).label-floating,.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-ios-h,.item-has-value.label-floating.sc-ion-label-ios-h,.item-has-value .label-floating.sc-ion-label-ios-h{transform:scale(0.82)}.sc-ion-label-ios-s h1{margin-left:0;margin-right:0;margin-top:3px;margin-bottom:2px;font-size:22px;font-weight:normal}.sc-ion-label-ios-s h2{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:17px;font-weight:normal}.sc-ion-label-ios-s h3,.sc-ion-label-ios-s h4,.sc-ion-label-ios-s h5,.sc-ion-label-ios-s h6{margin-left:0;margin-right:0;margin-top:0;margin-bottom:3px;font-size:14px;font-weight:normal;line-height:normal}.sc-ion-label-ios-s p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px;line-height:normal;text-overflow:inherit;overflow:inherit}.sc-ion-label-ios-s>p{color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.4)}.sc-ion-label-ios-h.in-item-color.sc-ion-label-ios-s>p{color:inherit}.sc-ion-label-ios-s h2:last-child,.sc-ion-label-ios-s h3:last-child,.sc-ion-label-ios-s h4:last-child,.sc-ion-label-ios-s h5:last-child,.sc-ion-label-ios-s h6:last-child,.sc-ion-label-ios-s p:last-child{margin-bottom:0}";
|
|
1989
|
-
|
|
1990
|
-
const labelMdCss = ".item.sc-ion-label-md-h,.item .sc-ion-label-md-h{--color:initial;display:block;color:var(--color);font-family:var(--ion-font-family, inherit);font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;box-sizing:border-box}.ion-color.sc-ion-label-md-h{color:var(--ion-color-base)}.ion-text-wrap.sc-ion-label-md-h,[text-wrap].sc-ion-label-md-h{white-space:normal}.item-interactive-disabled.sc-ion-label-md-h:not(.item-multiple-inputs),.item-interactive-disabled:not(.item-multiple-inputs) .sc-ion-label-md-h{cursor:default;opacity:0.3;pointer-events:none}.item-input.sc-ion-label-md-h,.item-input .sc-ion-label-md-h{flex:initial;max-width:200px;pointer-events:none}.item-textarea.sc-ion-label-md-h,.item-textarea .sc-ion-label-md-h{align-self:baseline}.label-fixed.sc-ion-label-md-h{flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.label-stacked.sc-ion-label-md-h,.label-floating.sc-ion-label-md-h{margin-bottom:0;align-self:stretch;width:auto;max-width:100%}.label-no-animate.label-floating.sc-ion-label-md-h{transition:none}.sc-ion-label-md-s h1,.sc-ion-label-md-s h2,.sc-ion-label-md-s h3,.sc-ion-label-md-s h4,.sc-ion-label-md-s h5,.sc-ion-label-md-s h6{text-overflow:inherit;overflow:inherit}.ion-text-wrap.sc-ion-label-md-h,[text-wrap].sc-ion-label-md-h{line-height:1.5}.label-stacked.sc-ion-label-md-h,.label-floating.sc-ion-label-md-h{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;transform-origin:top left}.label-stacked.label-rtl.sc-ion-label-md-h,.label-floating.label-rtl.sc-ion-label-md-h{transform-origin:top right}.label-stacked.sc-ion-label-md-h{transform:translateY(50%) scale(0.75);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1)}.label-floating.sc-ion-label-md-h{transform:translateY(96%);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1)}.ion-focused.label-floating.sc-ion-label-md-h,.ion-focused .label-floating.sc-ion-label-md-h,.item-has-focus.label-floating.sc-ion-label-md-h,.item-has-focus .label-floating.sc-ion-label-md-h,.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating,.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h,.item-has-value.label-floating.sc-ion-label-md-h,.item-has-value .label-floating.sc-ion-label-md-h{transform:translateY(50%) scale(0.75)}.item-fill-outline.ion-focused.label-floating.sc-ion-label-md-h,.item-fill-outline.ion-focused .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-focus.label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-focus .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating,.item-fill-outline.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-value.label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-value .label-floating.sc-ion-label-md-h{transform:translateY(-6px) scale(0.75);position:relative;max-width:min-content;background-color:var(--ion-item-background, var(--ion-background-color, #fff));overflow:visible;z-index:3}.item-fill-outline.ion-focused.label-floating.sc-ion-label-md-h::before,.item-fill-outline.ion-focused .label-floating.sc-ion-label-md-h::before,.item-fill-outline.ion-focused.label-floating.sc-ion-label-md-h::after,.item-fill-outline.ion-focused .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-focus.label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-focus .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-focus.label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-focus .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating::before,.item-fill-outline.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating::after,.item-fill-outline.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-value.label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-value .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-value.label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-value .label-floating.sc-ion-label-md-h::after{position:absolute;width:4px;height:100%;background-color:var(--ion-item-background, var(--ion-background-color, #fff));content:\"\"}.item-fill-outline.ion-focused.label-floating.sc-ion-label-md-h::before,.item-fill-outline.ion-focused .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-focus.label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-focus .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating::before,.item-fill-outline.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-value.label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-value .label-floating.sc-ion-label-md-h::before{left:calc(-1 * 4px)}.item-fill-outline.ion-focused.label-floating.sc-ion-label-md-h::after,.item-fill-outline.ion-focused .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-focus.label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-focus .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating::after,.item-fill-outline.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-value.label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-value .label-floating.sc-ion-label-md-h::after{right:calc(-1 * 4px)}.item-fill-outline.ion-focused.item-has-start-slot.label-floating.sc-ion-label-md-h,.item-fill-outline.ion-focused.item-has-start-slot .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-focus.item-has-start-slot.label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-focus.item-has-start-slot .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).item-has-start-slot.label-floating,.item-fill-outline.item-has-placeholder:not(.item-input).item-has-start-slot .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-value.item-has-start-slot.label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-value.item-has-start-slot .label-floating.sc-ion-label-md-h{transform:translateX(-32px) translateY(-6px) scale(0.75)}.item-fill-outline.ion-focused.item-has-start-slot.label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.ion-focused.item-has-start-slot .label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.item-has-focus.item-has-start-slot.label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.item-has-focus.item-has-start-slot .label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).item-has-start-slot.label-floating.label-rtl,.item-fill-outline.item-has-placeholder:not(.item-input).item-has-start-slot .label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.item-has-value.item-has-start-slot.label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.item-has-value.item-has-start-slot .label-floating.label-rtl.sc-ion-label-md-h{transform:translateX(calc(-1 * -32px)) translateY(-6px) scale(0.75)}.ion-focused.label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused .label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused.label-floating.sc-ion-label-md-h:not(.ion-color),.ion-focused .label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--ion-color-primary, #3880ff)}.ion-focused.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.ion-focused.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--ion-color-contrast)}.item-fill-solid.ion-focused.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.ion-focused.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.ion-focused.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.ion-focused.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.ion-focused.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.ion-focused.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.ion-focused.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.ion-focused.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.item-has-focus.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.item-has-focus.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.item-has-focus.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.item-has-focus.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.item-has-focus.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.item-has-focus.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.item-has-focus.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.item-has-focus.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--ion-color-base)}.ion-invalid.ion-touched.label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-invalid.ion-touched .label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-invalid.ion-touched.label-floating.sc-ion-label-md-h:not(.ion-color),.ion-invalid.ion-touched .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--highlight-color-invalid)}.sc-ion-label-md-s h1{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}.sc-ion-label-md-s h2{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:normal}.sc-ion-label-md-s h3,.sc-ion-label-md-s h4,.sc-ion-label-md-s h5,.sc-ion-label-md-s h6{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:normal;line-height:normal}.sc-ion-label-md-s p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px;line-height:20px;text-overflow:inherit;overflow:inherit}.sc-ion-label-md-s>p{color:var(--ion-color-step-600, #666666)}.sc-ion-label-md-h.in-item-color.sc-ion-label-md-s>p{color:inherit}";
|
|
1991
|
-
|
|
1992
|
-
const Label = class {
|
|
1993
|
-
constructor(hostRef) {
|
|
1994
|
-
registerInstance(this, hostRef);
|
|
1995
|
-
this.ionColor = createEvent(this, "ionColor", 7);
|
|
1996
|
-
this.ionStyle = createEvent(this, "ionStyle", 7);
|
|
1997
|
-
this.inRange = false;
|
|
1998
|
-
this.noAnimate = false;
|
|
1999
|
-
}
|
|
2000
|
-
componentWillLoad() {
|
|
2001
|
-
this.inRange = !!this.el.closest('ion-range');
|
|
2002
|
-
this.noAnimate = this.position === 'floating';
|
|
2003
|
-
this.emitStyle();
|
|
2004
|
-
this.emitColor();
|
|
2005
|
-
}
|
|
2006
|
-
componentDidLoad() {
|
|
2007
|
-
if (this.noAnimate) {
|
|
2008
|
-
setTimeout(() => {
|
|
2009
|
-
this.noAnimate = false;
|
|
2010
|
-
}, 1000);
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
colorChanged() {
|
|
2014
|
-
this.emitColor();
|
|
2015
|
-
}
|
|
2016
|
-
positionChanged() {
|
|
2017
|
-
this.emitStyle();
|
|
2018
|
-
}
|
|
2019
|
-
emitColor() {
|
|
2020
|
-
const { color } = this;
|
|
2021
|
-
this.ionColor.emit({
|
|
2022
|
-
'item-label-color': color !== undefined,
|
|
2023
|
-
[`ion-color-${color}`]: color !== undefined,
|
|
2024
|
-
});
|
|
2025
|
-
}
|
|
2026
|
-
emitStyle() {
|
|
2027
|
-
const { inRange, position } = this;
|
|
2028
|
-
// If the label is inside of a range we don't want
|
|
2029
|
-
// to override the classes added by the label that
|
|
2030
|
-
// is a direct child of the item
|
|
2031
|
-
if (!inRange) {
|
|
2032
|
-
this.ionStyle.emit({
|
|
2033
|
-
label: true,
|
|
2034
|
-
[`label-${position}`]: position !== undefined,
|
|
2035
|
-
});
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
render() {
|
|
2039
|
-
const position = this.position;
|
|
2040
|
-
const mode = getIonMode$1(this);
|
|
2041
|
-
return (h(Host, { class: createColorClasses$1(this.color, {
|
|
2042
|
-
[mode]: true,
|
|
2043
|
-
'in-item-color': hostContext('ion-item.ion-color', this.el),
|
|
2044
|
-
[`label-${position}`]: position !== undefined,
|
|
2045
|
-
[`label-no-animate`]: this.noAnimate,
|
|
2046
|
-
'label-rtl': document.dir === 'rtl',
|
|
2047
|
-
}) }));
|
|
2048
|
-
}
|
|
2049
|
-
get el() { return getElement$1(this); }
|
|
2050
|
-
static get watchers() { return {
|
|
2051
|
-
"color": ["colorChanged"],
|
|
2052
|
-
"position": ["positionChanged"]
|
|
2053
|
-
}; }
|
|
2054
|
-
};
|
|
2055
|
-
Label.style = {
|
|
2056
|
-
ios: labelIosCss,
|
|
2057
|
-
md: labelMdCss
|
|
2058
|
-
};
|
|
2059
|
-
|
|
2060
|
-
const listIosCss = "ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{transform:translateZ(0);overflow:hidden}.list-ios{background:var(--ion-item-background, var(--ion-background-color, #fff))}.list-ios.list-inset{margin-left:16px;margin-right:16px;margin-top:16px;margin-bottom:16px;border-radius:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.list-ios.list-inset{margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px}}.list-ios.list-inset ion-item{--border-width:0 0 1px 0;--inner-border-width:0}.list-ios.list-inset ion-item:last-child{--border-width:0;--inner-border-width:0}.list-ios.list-inset+ion-list.list-inset{margin-top:0}.list-ios-lines-none .item{--border-width:0;--inner-border-width:0}.list-ios-lines-full .item,.list-ios .item-lines-full{--border-width:0 0 0.55px 0}.list-ios-lines-full .item{--inner-border-width:0}.list-ios-lines-inset .item,.list-ios .item-lines-inset{--inner-border-width:0 0 0.55px 0}.list-ios .item-lines-inset{--border-width:0}.list-ios .item-lines-full{--inner-border-width:0}.list-ios .item-lines-none{--border-width:0;--inner-border-width:0}ion-card .list-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";
|
|
2061
|
-
|
|
2062
|
-
const listMdCss = "ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{transform:translateZ(0);overflow:hidden}.list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:8px;padding-bottom:8px;background:var(--ion-item-background, var(--ion-background-color, #fff))}.list-md>.input:last-child::after{left:0}[dir=rtl] .list-md>.input:last-child::after,:host-context([dir=rtl]) .list-md>.input:last-child::after{left:unset;right:unset;right:0}.list-md.list-inset{margin-left:16px;margin-right:16px;margin-top:16px;margin-bottom:16px;border-radius:2px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.list-md.list-inset{margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px}}.list-md.list-inset ion-item:first-child{--border-radius:2px 2px 0 0}.list-md.list-inset ion-item:last-child{--border-radius:0 0 2px, 2px;--border-width:0;--inner-border-width:0}.list-md.list-inset .item-interactive{--padding-start:0;--padding-end:0}.list-md.list-inset+ion-list.list-inset{margin-top:0}.list-md-lines-none .item{--border-width:0;--inner-border-width:0}.list-md-lines-full .item,.list-md .item-lines-full{--border-width:0 0 1px 0}.list-md-lines-full .item{--inner-border-width:0}.list-md-lines-inset .item,.list-md .item-lines-inset{--inner-border-width:0 0 1px 0}.list-md .item-lines-inset{--border-width:0}.list-md .item-lines-full{--inner-border-width:0}.list-md .item-lines-none{--border-width:0;--inner-border-width:0}ion-card .list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";
|
|
2063
|
-
|
|
2064
|
-
const List = class {
|
|
2065
|
-
constructor(hostRef) {
|
|
2066
|
-
registerInstance(this, hostRef);
|
|
2067
|
-
/**
|
|
2068
|
-
* If `true`, the list will have margin around it and rounded corners.
|
|
2069
|
-
*/
|
|
2070
|
-
this.inset = false;
|
|
2071
|
-
}
|
|
2072
|
-
/**
|
|
2073
|
-
* If `ion-item-sliding` are used inside the list, this method closes
|
|
2074
|
-
* any open sliding item.
|
|
2075
|
-
*
|
|
2076
|
-
* Returns `true` if an actual `ion-item-sliding` is closed.
|
|
2077
|
-
*/
|
|
2078
|
-
async closeSlidingItems() {
|
|
2079
|
-
const item = this.el.querySelector('ion-item-sliding');
|
|
2080
|
-
if (item === null || item === void 0 ? void 0 : item.closeOpened) {
|
|
2081
|
-
return item.closeOpened();
|
|
2082
|
-
}
|
|
2083
|
-
return false;
|
|
2084
|
-
}
|
|
2085
|
-
render() {
|
|
2086
|
-
const mode = getIonMode$1(this);
|
|
2087
|
-
const { lines, inset } = this;
|
|
2088
|
-
return (h(Host, { role: "list", class: {
|
|
2089
|
-
[mode]: true,
|
|
2090
|
-
// Used internally for styling
|
|
2091
|
-
[`list-${mode}`]: true,
|
|
2092
|
-
'list-inset': inset,
|
|
2093
|
-
[`list-lines-${lines}`]: lines !== undefined,
|
|
2094
|
-
[`list-${mode}-lines-${lines}`]: lines !== undefined,
|
|
2095
|
-
} }));
|
|
2096
|
-
}
|
|
2097
|
-
get el() { return getElement$1(this); }
|
|
2098
|
-
};
|
|
2099
|
-
List.style = {
|
|
2100
|
-
ios: listIosCss,
|
|
2101
|
-
md: listMdCss
|
|
2102
|
-
};
|
|
2103
|
-
|
|
2104
|
-
const noteIosCss = ":host{color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-350, #a6a6a6)}";
|
|
2105
|
-
|
|
2106
|
-
const noteMdCss = ":host{color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-600, #666666);font-size:14px}";
|
|
2107
|
-
|
|
2108
|
-
const Note = class {
|
|
2109
|
-
constructor(hostRef) {
|
|
2110
|
-
registerInstance(this, hostRef);
|
|
2111
|
-
}
|
|
2112
|
-
render() {
|
|
2113
|
-
const mode = getIonMode$1(this);
|
|
2114
|
-
return (h(Host, { class: createColorClasses$1(this.color, {
|
|
2115
|
-
[mode]: true,
|
|
2116
|
-
}) }, h("slot", null)));
|
|
2117
|
-
}
|
|
2118
|
-
};
|
|
2119
|
-
Note.style = {
|
|
2120
|
-
ios: noteIosCss,
|
|
2121
|
-
md: noteMdCss
|
|
2122
|
-
};
|
|
2123
|
-
|
|
2124
|
-
const progressBarIosCss = ":host{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.3);--progress-background:var(--ion-color-primary, #3880ff);--buffer-background:var(--background);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{transform-origin:left top;transition:transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--buffer-background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{animation:primary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{animation:secondary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{animation-play-state:paused}:host(.ion-color) .progress-buffer-bar{background:rgba(var(--ion-color-base-rgb), 0.3)}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@keyframes primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes buffering{to{transform:translateX(-10px)}}:host{height:3px}";
|
|
2125
|
-
|
|
2126
|
-
const progressBarMdCss = ":host{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.3);--progress-background:var(--ion-color-primary, #3880ff);--buffer-background:var(--background);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{transform-origin:left top;transition:transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--buffer-background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{animation:primary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{animation:secondary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{animation-play-state:paused}:host(.ion-color) .progress-buffer-bar{background:rgba(var(--ion-color-base-rgb), 0.3)}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@keyframes primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes buffering{to{transform:translateX(-10px)}}:host{height:4px}";
|
|
2127
|
-
|
|
2128
|
-
const ProgressBar = class {
|
|
2129
|
-
constructor(hostRef) {
|
|
2130
|
-
registerInstance(this, hostRef);
|
|
2131
|
-
/**
|
|
2132
|
-
* The state of the progress bar, based on if the time the process takes is known or not.
|
|
2133
|
-
* Default options are: `"determinate"` (no animation), `"indeterminate"` (animate from left to right).
|
|
2134
|
-
*/
|
|
2135
|
-
this.type = 'determinate';
|
|
2136
|
-
/**
|
|
2137
|
-
* If true, reverse the progress bar direction.
|
|
2138
|
-
*/
|
|
2139
|
-
this.reversed = false;
|
|
2140
|
-
/**
|
|
2141
|
-
* The value determines how much of the active bar should display when the
|
|
2142
|
-
* `type` is `"determinate"`.
|
|
2143
|
-
* The value should be between [0, 1].
|
|
2144
|
-
*/
|
|
2145
|
-
this.value = 0;
|
|
2146
|
-
/**
|
|
2147
|
-
* If the buffer and value are smaller than 1, the buffer circles will show.
|
|
2148
|
-
* The buffer should be between [0, 1].
|
|
2149
|
-
*/
|
|
2150
|
-
this.buffer = 1;
|
|
2151
|
-
}
|
|
2152
|
-
render() {
|
|
2153
|
-
const { color, type, reversed, value, buffer } = this;
|
|
2154
|
-
const paused = config.getBoolean('_testing');
|
|
2155
|
-
const mode = getIonMode$1(this);
|
|
2156
|
-
return (h(Host, { role: "progressbar", "aria-valuenow": type === 'determinate' ? value : null, "aria-valuemin": "0", "aria-valuemax": "1", class: createColorClasses$1(color, {
|
|
2157
|
-
[mode]: true,
|
|
2158
|
-
[`progress-bar-${type}`]: true,
|
|
2159
|
-
'progress-paused': paused,
|
|
2160
|
-
'progress-bar-reversed': document.dir === 'rtl' ? !reversed : reversed,
|
|
2161
|
-
}) }, type === 'indeterminate' ? renderIndeterminate() : renderProgress(value, buffer)));
|
|
2162
|
-
}
|
|
2163
|
-
};
|
|
2164
|
-
const renderIndeterminate = () => {
|
|
2165
|
-
return (h("div", { part: "track", class: "progress-buffer-bar" }, h("div", { class: "indeterminate-bar-primary" }, h("span", { part: "progress", class: "progress-indeterminate" })), h("div", { class: "indeterminate-bar-secondary" }, h("span", { part: "progress", class: "progress-indeterminate" }))));
|
|
2166
|
-
};
|
|
2167
|
-
const renderProgress = (value, buffer) => {
|
|
2168
|
-
const finalValue = clamp(0, value, 1);
|
|
2169
|
-
const finalBuffer = clamp(0, buffer, 1);
|
|
2170
|
-
return [
|
|
2171
|
-
h("div", { part: "progress", class: "progress", style: { transform: `scaleX(${finalValue})` } }),
|
|
2172
|
-
/**
|
|
2173
|
-
* Buffer circles with two container to move
|
|
2174
|
-
* the circles behind the buffer progress
|
|
2175
|
-
* with respecting the animation.
|
|
2176
|
-
* When finalBuffer === 1, we use display: none
|
|
2177
|
-
* instead of removing the element to avoid flickering.
|
|
2178
|
-
*/
|
|
2179
|
-
h("div", { class: { 'buffer-circles-container': true, 'ion-hide': finalBuffer === 1 }, style: { transform: `translateX(${finalBuffer * 100}%)` } }, h("div", { class: "buffer-circles-container", style: { transform: `translateX(-${finalBuffer * 100}%)` } }, h("div", { part: "stream", class: "buffer-circles" }))),
|
|
2180
|
-
h("div", { part: "track", class: "progress-buffer-bar", style: { transform: `scaleX(${finalBuffer})` } }),
|
|
2181
|
-
];
|
|
2182
|
-
};
|
|
2183
|
-
ProgressBar.style = {
|
|
2184
|
-
ios: progressBarIosCss,
|
|
2185
|
-
md: progressBarMdCss
|
|
2186
|
-
};
|
|
2187
|
-
|
|
2188
|
-
const rippleEffectCss = ":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:strict;pointer-events:none}:host(.unbounded){contain:layout size style}.ripple-effect{border-radius:50%;position:absolute;background-color:currentColor;color:inherit;contain:strict;opacity:0;animation:225ms rippleAnimation forwards, 75ms fadeInAnimation forwards;will-change:transform, opacity;pointer-events:none}.fade-out{transform:translate(var(--translate-end)) scale(var(--final-scale, 1));animation:150ms fadeOutAnimation forwards}@keyframes rippleAnimation{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:scale(1)}to{transform:translate(var(--translate-end)) scale(var(--final-scale, 1))}}@keyframes fadeInAnimation{from{animation-timing-function:linear;opacity:0}to{opacity:0.16}}@keyframes fadeOutAnimation{from{animation-timing-function:linear;opacity:0.16}to{opacity:0}}";
|
|
2189
|
-
|
|
2190
|
-
const RippleEffect = class {
|
|
2191
|
-
constructor(hostRef) {
|
|
2192
|
-
registerInstance(this, hostRef);
|
|
2193
|
-
/**
|
|
2194
|
-
* Sets the type of ripple-effect:
|
|
2195
|
-
*
|
|
2196
|
-
* - `bounded`: the ripple effect expands from the user's click position
|
|
2197
|
-
* - `unbounded`: the ripple effect expands from the center of the button and overflows the container.
|
|
2198
|
-
*
|
|
2199
|
-
* NOTE: Surfaces for bounded ripples should have the overflow property set to hidden,
|
|
2200
|
-
* while surfaces for unbounded ripples should have it set to visible.
|
|
2201
|
-
*/
|
|
2202
|
-
this.type = 'bounded';
|
|
2203
|
-
}
|
|
2204
|
-
/**
|
|
2205
|
-
* Adds the ripple effect to the parent element.
|
|
2206
|
-
*
|
|
2207
|
-
* @param x The horizontal coordinate of where the ripple should start.
|
|
2208
|
-
* @param y The vertical coordinate of where the ripple should start.
|
|
2209
|
-
*/
|
|
2210
|
-
async addRipple(x, y) {
|
|
2211
|
-
return new Promise((resolve) => {
|
|
2212
|
-
readTask(() => {
|
|
2213
|
-
const rect = this.el.getBoundingClientRect();
|
|
2214
|
-
const width = rect.width;
|
|
2215
|
-
const height = rect.height;
|
|
2216
|
-
const hypotenuse = Math.sqrt(width * width + height * height);
|
|
2217
|
-
const maxDim = Math.max(height, width);
|
|
2218
|
-
const maxRadius = this.unbounded ? maxDim : hypotenuse + PADDING;
|
|
2219
|
-
const initialSize = Math.floor(maxDim * INITIAL_ORIGIN_SCALE);
|
|
2220
|
-
const finalScale = maxRadius / initialSize;
|
|
2221
|
-
let posX = x - rect.left;
|
|
2222
|
-
let posY = y - rect.top;
|
|
2223
|
-
if (this.unbounded) {
|
|
2224
|
-
posX = width * 0.5;
|
|
2225
|
-
posY = height * 0.5;
|
|
2226
|
-
}
|
|
2227
|
-
const styleX = posX - initialSize * 0.5;
|
|
2228
|
-
const styleY = posY - initialSize * 0.5;
|
|
2229
|
-
const moveX = width * 0.5 - posX;
|
|
2230
|
-
const moveY = height * 0.5 - posY;
|
|
2231
|
-
writeTask(() => {
|
|
2232
|
-
const div = document.createElement('div');
|
|
2233
|
-
div.classList.add('ripple-effect');
|
|
2234
|
-
const style = div.style;
|
|
2235
|
-
style.top = styleY + 'px';
|
|
2236
|
-
style.left = styleX + 'px';
|
|
2237
|
-
style.width = style.height = initialSize + 'px';
|
|
2238
|
-
style.setProperty('--final-scale', `${finalScale}`);
|
|
2239
|
-
style.setProperty('--translate-end', `${moveX}px, ${moveY}px`);
|
|
2240
|
-
const container = this.el.shadowRoot || this.el;
|
|
2241
|
-
container.appendChild(div);
|
|
2242
|
-
setTimeout(() => {
|
|
2243
|
-
resolve(() => {
|
|
2244
|
-
removeRipple(div);
|
|
2245
|
-
});
|
|
2246
|
-
}, 225 + 100);
|
|
2247
|
-
});
|
|
2248
|
-
});
|
|
2249
|
-
});
|
|
2250
|
-
}
|
|
2251
|
-
get unbounded() {
|
|
2252
|
-
return this.type === 'unbounded';
|
|
2253
|
-
}
|
|
2254
|
-
render() {
|
|
2255
|
-
const mode = getIonMode$1(this);
|
|
2256
|
-
return (h(Host, { role: "presentation", class: {
|
|
2257
|
-
[mode]: true,
|
|
2258
|
-
unbounded: this.unbounded,
|
|
2259
|
-
} }));
|
|
2260
|
-
}
|
|
2261
|
-
get el() { return getElement$1(this); }
|
|
2262
|
-
};
|
|
2263
|
-
const removeRipple = (ripple) => {
|
|
2264
|
-
ripple.classList.add('fade-out');
|
|
2265
|
-
setTimeout(() => {
|
|
2266
|
-
ripple.remove();
|
|
2267
|
-
}, 200);
|
|
2268
|
-
};
|
|
2269
|
-
const PADDING = 10;
|
|
2270
|
-
const INITIAL_ORIGIN_SCALE = 0.5;
|
|
2271
|
-
RippleEffect.style = rippleEffectCss;
|
|
2272
|
-
|
|
2273
|
-
const rowCss = ":host{display:flex;flex-wrap:wrap}";
|
|
2274
|
-
|
|
2275
|
-
const Row = class {
|
|
2276
|
-
constructor(hostRef) {
|
|
2277
|
-
registerInstance(this, hostRef);
|
|
2278
|
-
}
|
|
2279
|
-
render() {
|
|
2280
|
-
return (h(Host, { class: getIonMode$1(this) }, h("slot", null)));
|
|
2281
|
-
}
|
|
2282
|
-
};
|
|
2283
|
-
Row.style = rowCss;
|
|
2284
|
-
|
|
2285
|
-
const searchbarIosCss = ".sc-ion-searchbar-ios-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:.5;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:flex;position:relative;align-items:center;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}.ion-color.sc-ion-searchbar-ios-h{color:var(--ion-color-contrast)}.ion-color.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{background:var(--ion-color-base)}.ion-color.sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios,.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.ion-color.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{color:inherit}.searchbar-search-icon.sc-ion-searchbar-ios{color:var(--icon-color);pointer-events:none}.searchbar-input-container.sc-ion-searchbar-ios{display:block;position:relative;flex-shrink:1;width:100%}.searchbar-input.sc-ion-searchbar-ios{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;border-radius:var(--border-radius);display:block;width:100%;border:0;outline:none;background:var(--background);font-family:inherit;box-shadow:var(--box-shadow);box-sizing:border-box;appearance:none}.searchbar-input.sc-ion-searchbar-ios::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-ios::-webkit-search-cancel-button,.searchbar-input.sc-ion-searchbar-ios::-ms-clear{display:none}.searchbar-cancel-button.sc-ion-searchbar-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:none;height:100%;border:0;outline:none;color:var(--cancel-button-color);cursor:pointer;appearance:none}.searchbar-cancel-button.sc-ion-searchbar-ios>div.sc-ion-searchbar-ios{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.searchbar-clear-button.sc-ion-searchbar-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:none;min-height:0;outline:none;color:var(--clear-button-color);appearance:none}.searchbar-clear-button.sc-ion-searchbar-ios:focus{opacity:0.5}.searchbar-has-value.searchbar-should-show-clear.sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios{display:block}.searchbar-disabled.sc-ion-searchbar-ios-h{cursor:default;opacity:0.4;pointer-events:none}.sc-ion-searchbar-ios-h{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.07);--border-radius:10px;--box-shadow:none;--cancel-button-color:var(--ion-color-primary, #3880ff);--clear-button-color:var(--ion-color-step-600, #666666);--color:var(--ion-text-color, #000);--icon-color:var(--ion-color-step-600, #666666);padding-left:12px;padding-right:12px;padding-top:12px;padding-bottom:12px;height:60px;contain:strict}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.sc-ion-searchbar-ios-h{padding-left:unset;padding-right:unset;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px}}.searchbar-input-container.sc-ion-searchbar-ios{height:36px}.searchbar-search-icon.sc-ion-searchbar-ios{margin-left:calc(50% - 60px);left:5px;top:0;position:absolute;width:22px;height:100%;contain:strict}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-search-icon.sc-ion-searchbar-ios{margin-left:unset;-webkit-margin-start:calc(50% - 60px);margin-inline-start:calc(50% - 60px)}}[dir=rtl].sc-ion-searchbar-ios .searchbar-search-icon.sc-ion-searchbar-ios,[dir=rtl].sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,[dir=rtl] .sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{left:unset;right:unset;right:5px}.searchbar-input.sc-ion-searchbar-ios{padding-left:28px;padding-right:28px;padding-top:0;padding-bottom:0;height:100%;font-size:17px;font-weight:400;contain:strict}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-input.sc-ion-searchbar-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:28px;padding-inline-start:28px;-webkit-padding-end:28px;padding-inline-end:28px}}.searchbar-clear-button.sc-ion-searchbar-ios{right:0;top:0;background-position:center;position:absolute;width:30px;height:100%;border:0;background-color:transparent}[dir=rtl].sc-ion-searchbar-ios .searchbar-clear-button.sc-ion-searchbar-ios,[dir=rtl].sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios,[dir=rtl] .sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios{left:unset;right:unset;left:0}.searchbar-clear-icon.sc-ion-searchbar-ios{width:18px;height:100%}.searchbar-cancel-button.sc-ion-searchbar-ios{padding-left:8px;padding-right:0;padding-top:0;padding-bottom:0;flex-shrink:0;background-color:transparent;font-size:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-cancel-button.sc-ion-searchbar-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:0;padding-inline-end:0}}.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{margin-left:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{margin-left:unset;-webkit-margin-start:0;margin-inline-start:0}}.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{padding-left:30px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{padding-left:unset;-webkit-padding-start:30px;padding-inline-start:30px}}.searchbar-has-focus.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-should-show-cancel.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{display:block}.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{transition:all 300ms ease}.searchbar-animated.searchbar-has-focus.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-animated.searchbar-should-show-cancel.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{opacity:1;pointer-events:auto}.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{margin-right:-100%;transform:translate3d(0, 0, 0);transition:all 300ms ease;opacity:0;pointer-events:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{margin-right:unset;-webkit-margin-end:-100%;margin-inline-end:-100%}}.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios,.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{transition-duration:0ms}.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{color:var(--ion-color-base)}@media (any-hover: hover){.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios:hover{color:var(--ion-color-tint)}}ion-toolbar.sc-ion-searchbar-ios-h,ion-toolbar .sc-ion-searchbar-ios-h{padding-top:1px;padding-bottom:15px;height:52px}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color),ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color){color:inherit}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-cancel-button.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-cancel-button.sc-ion-searchbar-ios{color:currentColor}ion-toolbar.ion-color.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{color:currentColor;opacity:0.5}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-input.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-input.sc-ion-searchbar-ios{background:rgba(var(--ion-color-contrast-rgb), 0.07);color:currentColor}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-clear-button.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-clear-button.sc-ion-searchbar-ios{color:currentColor;opacity:0.5}";
|
|
2286
|
-
|
|
2287
|
-
const searchbarMdCss = ".sc-ion-searchbar-md-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:.5;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:flex;position:relative;align-items:center;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}.ion-color.sc-ion-searchbar-md-h{color:var(--ion-color-contrast)}.ion-color.sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md{background:var(--ion-color-base)}.ion-color.sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md,.ion-color.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md,.ion-color.sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md{color:inherit}.searchbar-search-icon.sc-ion-searchbar-md{color:var(--icon-color);pointer-events:none}.searchbar-input-container.sc-ion-searchbar-md{display:block;position:relative;flex-shrink:1;width:100%}.searchbar-input.sc-ion-searchbar-md{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;border-radius:var(--border-radius);display:block;width:100%;border:0;outline:none;background:var(--background);font-family:inherit;box-shadow:var(--box-shadow);box-sizing:border-box;appearance:none}.searchbar-input.sc-ion-searchbar-md::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-md::-webkit-search-cancel-button,.searchbar-input.sc-ion-searchbar-md::-ms-clear{display:none}.searchbar-cancel-button.sc-ion-searchbar-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:none;height:100%;border:0;outline:none;color:var(--cancel-button-color);cursor:pointer;appearance:none}.searchbar-cancel-button.sc-ion-searchbar-md>div.sc-ion-searchbar-md{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.searchbar-clear-button.sc-ion-searchbar-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:none;min-height:0;outline:none;color:var(--clear-button-color);appearance:none}.searchbar-clear-button.sc-ion-searchbar-md:focus{opacity:0.5}.searchbar-has-value.searchbar-should-show-clear.sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md{display:block}.searchbar-disabled.sc-ion-searchbar-md-h{cursor:default;opacity:0.4;pointer-events:none}.sc-ion-searchbar-md-h{--background:var(--ion-background-color, #fff);--border-radius:2px;--box-shadow:0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);--cancel-button-color:var(--ion-color-step-900, #1a1a1a);--clear-button-color:initial;--color:var(--ion-color-step-850, #262626);--icon-color:var(--ion-color-step-600, #666666);padding-left:8px;padding-right:8px;padding-top:8px;padding-bottom:8px;background:inherit}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.sc-ion-searchbar-md-h{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px}}.searchbar-search-icon.sc-ion-searchbar-md{left:16px;top:11px;width:21px;height:21px}[dir=rtl].sc-ion-searchbar-md .searchbar-search-icon.sc-ion-searchbar-md,[dir=rtl].sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md{left:unset;right:unset;right:16px}.searchbar-cancel-button.sc-ion-searchbar-md{left:5px;top:0;background-color:transparent;font-size:1.6em}[dir=rtl].sc-ion-searchbar-md .searchbar-cancel-button.sc-ion-searchbar-md,[dir=rtl].sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md{left:unset;right:unset;right:5px}.searchbar-search-icon.sc-ion-searchbar-md,.searchbar-cancel-button.sc-ion-searchbar-md{position:absolute}.searchbar-search-icon.ion-activated.sc-ion-searchbar-md,.searchbar-cancel-button.ion-activated.sc-ion-searchbar-md{background-color:transparent}.searchbar-input.sc-ion-searchbar-md{padding-left:55px;padding-right:55px;padding-top:6px;padding-bottom:6px;background-position:left 8px center;height:auto;font-size:16px;font-weight:400;line-height:30px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-input.sc-ion-searchbar-md{padding-left:unset;padding-right:unset;-webkit-padding-start:55px;padding-inline-start:55px;-webkit-padding-end:55px;padding-inline-end:55px}}[dir=rtl].sc-ion-searchbar-md .searchbar-input.sc-ion-searchbar-md,[dir=rtl].sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md{background-position:right 8px center}.searchbar-clear-button.sc-ion-searchbar-md{right:13px;top:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;position:absolute;height:100%;border:0;background-color:transparent}[dir=rtl].sc-ion-searchbar-md .searchbar-clear-button.sc-ion-searchbar-md,[dir=rtl].sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md{left:unset;right:unset;left:13px}.searchbar-clear-button.ion-activated.sc-ion-searchbar-md{background-color:transparent}.searchbar-clear-icon.sc-ion-searchbar-md{width:22px;height:100%}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md{display:block}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md,.searchbar-should-show-cancel.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md{display:block}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md+.searchbar-search-icon.sc-ion-searchbar-md,.searchbar-should-show-cancel.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md+.searchbar-search-icon.sc-ion-searchbar-md{display:none}ion-toolbar.sc-ion-searchbar-md-h,ion-toolbar .sc-ion-searchbar-md-h{padding-left:7px;padding-right:7px;padding-top:3px;padding-bottom:3px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){ion-toolbar.sc-ion-searchbar-md-h,ion-toolbar .sc-ion-searchbar-md-h{padding-left:unset;padding-right:unset;-webkit-padding-start:7px;padding-inline-start:7px;-webkit-padding-end:7px;padding-inline-end:7px}}";
|
|
2288
|
-
|
|
2289
|
-
const Searchbar = class {
|
|
2290
|
-
constructor(hostRef) {
|
|
2291
|
-
registerInstance(this, hostRef);
|
|
2292
|
-
this.ionInput = createEvent(this, "ionInput", 7);
|
|
2293
|
-
this.ionChange = createEvent(this, "ionChange", 7);
|
|
2294
|
-
this.ionCancel = createEvent(this, "ionCancel", 7);
|
|
2295
|
-
this.ionClear = createEvent(this, "ionClear", 7);
|
|
2296
|
-
this.ionBlur = createEvent(this, "ionBlur", 7);
|
|
2297
|
-
this.ionFocus = createEvent(this, "ionFocus", 7);
|
|
2298
|
-
this.ionStyle = createEvent(this, "ionStyle", 7);
|
|
2299
|
-
this.isCancelVisible = false;
|
|
2300
|
-
this.shouldAlignLeft = true;
|
|
2301
|
-
this.focused = false;
|
|
2302
|
-
this.noAnimate = true;
|
|
2303
|
-
/**
|
|
2304
|
-
* If `true`, enable searchbar animation.
|
|
2305
|
-
*/
|
|
2306
|
-
this.animated = false;
|
|
2307
|
-
/**
|
|
2308
|
-
* Set the input's autocomplete property.
|
|
2309
|
-
*/
|
|
2310
|
-
this.autocomplete = 'off';
|
|
2311
|
-
/**
|
|
2312
|
-
* Set the input's autocorrect property.
|
|
2313
|
-
*/
|
|
2314
|
-
this.autocorrect = 'off';
|
|
2315
|
-
/**
|
|
2316
|
-
* Set the cancel button icon. Only applies to `md` mode.
|
|
2317
|
-
* Defaults to `arrow-back-sharp`.
|
|
2318
|
-
*/
|
|
2319
|
-
this.cancelButtonIcon = config.get('backButtonIcon', arrowBackSharp);
|
|
2320
|
-
/**
|
|
2321
|
-
* Set the the cancel button text. Only applies to `ios` mode.
|
|
2322
|
-
*/
|
|
2323
|
-
this.cancelButtonText = 'Cancel';
|
|
2324
|
-
/**
|
|
2325
|
-
* Set the amount of time, in milliseconds, to wait to trigger the `ionChange` event after each keystroke. This also impacts form bindings such as `ngModel` or `v-model`.
|
|
2326
|
-
*/
|
|
2327
|
-
this.debounce = 250;
|
|
2328
|
-
/**
|
|
2329
|
-
* If `true`, the user cannot interact with the input.
|
|
2330
|
-
*/
|
|
2331
|
-
this.disabled = false;
|
|
2332
|
-
/**
|
|
2333
|
-
* Set the input's placeholder.
|
|
2334
|
-
* `placeholder` can accept either plaintext or HTML as a string.
|
|
2335
|
-
* To display characters normally reserved for HTML, they
|
|
2336
|
-
* must be escaped. For example `<Ionic>` would become
|
|
2337
|
-
* `<Ionic>`
|
|
2338
|
-
*
|
|
2339
|
-
* For more information: [Security Documentation](https://ionicframework.com/docs/faq/security)
|
|
2340
|
-
*/
|
|
2341
|
-
this.placeholder = 'Search';
|
|
2342
|
-
/**
|
|
2343
|
-
* Sets the behavior for the cancel button. Defaults to `"never"`.
|
|
2344
|
-
* Setting to `"focus"` shows the cancel button on focus.
|
|
2345
|
-
* Setting to `"never"` hides the cancel button.
|
|
2346
|
-
* Setting to `"always"` shows the cancel button regardless
|
|
2347
|
-
* of focus state.
|
|
2348
|
-
*/
|
|
2349
|
-
this.showCancelButton = 'never';
|
|
2350
|
-
/**
|
|
2351
|
-
* Sets the behavior for the clear button. Defaults to `"focus"`.
|
|
2352
|
-
* Setting to `"focus"` shows the clear button on focus if the
|
|
2353
|
-
* input is not empty.
|
|
2354
|
-
* Setting to `"never"` hides the clear button.
|
|
2355
|
-
* Setting to `"always"` shows the clear button regardless
|
|
2356
|
-
* of focus state, but only if the input is not empty.
|
|
2357
|
-
*/
|
|
2358
|
-
this.showClearButton = 'always';
|
|
2359
|
-
/**
|
|
2360
|
-
* If `true`, enable spellcheck on the input.
|
|
2361
|
-
*/
|
|
2362
|
-
this.spellcheck = false;
|
|
2363
|
-
/**
|
|
2364
|
-
* Set the type of the input.
|
|
2365
|
-
*/
|
|
2366
|
-
this.type = 'search';
|
|
2367
|
-
/**
|
|
2368
|
-
* the value of the searchbar.
|
|
2369
|
-
*/
|
|
2370
|
-
this.value = '';
|
|
2371
|
-
/**
|
|
2372
|
-
* Clears the input field and triggers the control change.
|
|
2373
|
-
*/
|
|
2374
|
-
this.onClearInput = (shouldFocus) => {
|
|
2375
|
-
this.ionClear.emit();
|
|
2376
|
-
// setTimeout() fixes https://github.com/ionic-team/ionic/issues/7527
|
|
2377
|
-
// wait for 4 frames
|
|
2378
|
-
setTimeout(() => {
|
|
2379
|
-
const value = this.getValue();
|
|
2380
|
-
if (value !== '') {
|
|
2381
|
-
this.value = '';
|
|
2382
|
-
this.ionInput.emit();
|
|
2383
|
-
/**
|
|
2384
|
-
* When tapping clear button
|
|
2385
|
-
* ensure input is focused after
|
|
2386
|
-
* clearing input so users
|
|
2387
|
-
* can quickly start typing.
|
|
2388
|
-
*/
|
|
2389
|
-
if (shouldFocus && !this.focused) {
|
|
2390
|
-
this.setFocus();
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
}, 16 * 4);
|
|
2394
|
-
};
|
|
2395
|
-
/**
|
|
2396
|
-
* Clears the input field and tells the input to blur since
|
|
2397
|
-
* the clearInput function doesn't want the input to blur
|
|
2398
|
-
* then calls the custom cancel function if the user passed one in.
|
|
2399
|
-
*/
|
|
2400
|
-
this.onCancelSearchbar = (ev) => {
|
|
2401
|
-
if (ev) {
|
|
2402
|
-
ev.preventDefault();
|
|
2403
|
-
ev.stopPropagation();
|
|
2404
|
-
}
|
|
2405
|
-
this.ionCancel.emit();
|
|
2406
|
-
this.onClearInput();
|
|
2407
|
-
if (this.nativeInput) {
|
|
2408
|
-
this.nativeInput.blur();
|
|
2409
|
-
}
|
|
2410
|
-
};
|
|
2411
|
-
/**
|
|
2412
|
-
* Update the Searchbar input value when the input changes
|
|
2413
|
-
*/
|
|
2414
|
-
this.onInput = (ev) => {
|
|
2415
|
-
const input = ev.target;
|
|
2416
|
-
if (input) {
|
|
2417
|
-
this.value = input.value;
|
|
2418
|
-
}
|
|
2419
|
-
this.ionInput.emit(ev);
|
|
2420
|
-
};
|
|
2421
|
-
/**
|
|
2422
|
-
* Sets the Searchbar to not focused and checks if it should align left
|
|
2423
|
-
* based on whether there is a value in the searchbar or not.
|
|
2424
|
-
*/
|
|
2425
|
-
this.onBlur = () => {
|
|
2426
|
-
this.focused = false;
|
|
2427
|
-
this.ionBlur.emit();
|
|
2428
|
-
this.positionElements();
|
|
2429
|
-
};
|
|
2430
|
-
/**
|
|
2431
|
-
* Sets the Searchbar to focused and active on input focus.
|
|
2432
|
-
*/
|
|
2433
|
-
this.onFocus = () => {
|
|
2434
|
-
this.focused = true;
|
|
2435
|
-
this.ionFocus.emit();
|
|
2436
|
-
this.positionElements();
|
|
2437
|
-
};
|
|
2438
|
-
}
|
|
2439
|
-
debounceChanged() {
|
|
2440
|
-
this.ionChange = debounceEvent(this.ionChange, this.debounce);
|
|
2441
|
-
}
|
|
2442
|
-
valueChanged() {
|
|
2443
|
-
const inputEl = this.nativeInput;
|
|
2444
|
-
const value = this.getValue();
|
|
2445
|
-
if (inputEl && inputEl.value !== value) {
|
|
2446
|
-
inputEl.value = value;
|
|
2447
|
-
}
|
|
2448
|
-
this.ionChange.emit({ value });
|
|
2449
|
-
}
|
|
2450
|
-
showCancelButtonChanged() {
|
|
2451
|
-
requestAnimationFrame(() => {
|
|
2452
|
-
this.positionElements();
|
|
2453
|
-
forceUpdate(this);
|
|
2454
|
-
});
|
|
2455
|
-
}
|
|
2456
|
-
connectedCallback() {
|
|
2457
|
-
this.emitStyle();
|
|
2458
|
-
}
|
|
2459
|
-
componentDidLoad() {
|
|
2460
|
-
this.positionElements();
|
|
2461
|
-
this.debounceChanged();
|
|
2462
|
-
setTimeout(() => {
|
|
2463
|
-
this.noAnimate = false;
|
|
2464
|
-
}, 300);
|
|
2465
|
-
}
|
|
2466
|
-
emitStyle() {
|
|
2467
|
-
this.ionStyle.emit({
|
|
2468
|
-
searchbar: true,
|
|
2469
|
-
});
|
|
2470
|
-
}
|
|
2471
|
-
/**
|
|
2472
|
-
* Sets focus on the specified `ion-searchbar`. Use this method instead of the global
|
|
2473
|
-
* `input.focus()`.
|
|
2474
|
-
*/
|
|
2475
|
-
async setFocus() {
|
|
2476
|
-
if (this.nativeInput) {
|
|
2477
|
-
this.nativeInput.focus();
|
|
2478
|
-
}
|
|
2479
|
-
}
|
|
2480
|
-
/**
|
|
2481
|
-
* Returns the native `<input>` element used under the hood.
|
|
2482
|
-
*/
|
|
2483
|
-
getInputElement() {
|
|
2484
|
-
return Promise.resolve(this.nativeInput);
|
|
2485
|
-
}
|
|
2486
|
-
/**
|
|
2487
|
-
* Positions the input search icon, placeholder, and the cancel button
|
|
2488
|
-
* based on the input value and if it is focused. (ios only)
|
|
2489
|
-
*/
|
|
2490
|
-
positionElements() {
|
|
2491
|
-
const value = this.getValue();
|
|
2492
|
-
const prevAlignLeft = this.shouldAlignLeft;
|
|
2493
|
-
const mode = getIonMode$1(this);
|
|
2494
|
-
const shouldAlignLeft = !this.animated || value.trim() !== '' || !!this.focused;
|
|
2495
|
-
this.shouldAlignLeft = shouldAlignLeft;
|
|
2496
|
-
if (mode !== 'ios') {
|
|
2497
|
-
return;
|
|
2498
|
-
}
|
|
2499
|
-
if (prevAlignLeft !== shouldAlignLeft) {
|
|
2500
|
-
this.positionPlaceholder();
|
|
2501
|
-
}
|
|
2502
|
-
if (this.animated) {
|
|
2503
|
-
this.positionCancelButton();
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
/**
|
|
2507
|
-
* Positions the input placeholder
|
|
2508
|
-
*/
|
|
2509
|
-
positionPlaceholder() {
|
|
2510
|
-
const inputEl = this.nativeInput;
|
|
2511
|
-
if (!inputEl) {
|
|
2512
|
-
return;
|
|
2513
|
-
}
|
|
2514
|
-
const rtl = isRTL$1(this.el);
|
|
2515
|
-
const iconEl = (this.el.shadowRoot || this.el).querySelector('.searchbar-search-icon');
|
|
2516
|
-
if (this.shouldAlignLeft) {
|
|
2517
|
-
inputEl.removeAttribute('style');
|
|
2518
|
-
iconEl.removeAttribute('style');
|
|
2519
|
-
}
|
|
2520
|
-
else {
|
|
2521
|
-
// Create a dummy span to get the placeholder width
|
|
2522
|
-
const doc = document;
|
|
2523
|
-
const tempSpan = doc.createElement('span');
|
|
2524
|
-
tempSpan.innerText = this.placeholder || '';
|
|
2525
|
-
doc.body.appendChild(tempSpan);
|
|
2526
|
-
// Get the width of the span then remove it
|
|
2527
|
-
raf(() => {
|
|
2528
|
-
const textWidth = tempSpan.offsetWidth;
|
|
2529
|
-
tempSpan.remove();
|
|
2530
|
-
// Calculate the input padding
|
|
2531
|
-
const inputLeft = 'calc(50% - ' + textWidth / 2 + 'px)';
|
|
2532
|
-
// Calculate the icon margin
|
|
2533
|
-
const iconLeft = 'calc(50% - ' + (textWidth / 2 + 30) + 'px)';
|
|
2534
|
-
// Set the input padding start and icon margin start
|
|
2535
|
-
if (rtl) {
|
|
2536
|
-
inputEl.style.paddingRight = inputLeft;
|
|
2537
|
-
iconEl.style.marginRight = iconLeft;
|
|
2538
|
-
}
|
|
2539
|
-
else {
|
|
2540
|
-
inputEl.style.paddingLeft = inputLeft;
|
|
2541
|
-
iconEl.style.marginLeft = iconLeft;
|
|
2542
|
-
}
|
|
2543
|
-
});
|
|
2544
|
-
}
|
|
2545
|
-
}
|
|
2546
|
-
/**
|
|
2547
|
-
* Show the iOS Cancel button on focus, hide it offscreen otherwise
|
|
2548
|
-
*/
|
|
2549
|
-
positionCancelButton() {
|
|
2550
|
-
const rtl = isRTL$1(this.el);
|
|
2551
|
-
const cancelButton = (this.el.shadowRoot || this.el).querySelector('.searchbar-cancel-button');
|
|
2552
|
-
const shouldShowCancel = this.shouldShowCancelButton();
|
|
2553
|
-
if (cancelButton !== null && shouldShowCancel !== this.isCancelVisible) {
|
|
2554
|
-
const cancelStyle = cancelButton.style;
|
|
2555
|
-
this.isCancelVisible = shouldShowCancel;
|
|
2556
|
-
if (shouldShowCancel) {
|
|
2557
|
-
if (rtl) {
|
|
2558
|
-
cancelStyle.marginLeft = '0';
|
|
2559
|
-
}
|
|
2560
|
-
else {
|
|
2561
|
-
cancelStyle.marginRight = '0';
|
|
2562
|
-
}
|
|
2563
|
-
}
|
|
2564
|
-
else {
|
|
2565
|
-
const offset = cancelButton.offsetWidth;
|
|
2566
|
-
if (offset > 0) {
|
|
2567
|
-
if (rtl) {
|
|
2568
|
-
cancelStyle.marginLeft = -offset + 'px';
|
|
2569
|
-
}
|
|
2570
|
-
else {
|
|
2571
|
-
cancelStyle.marginRight = -offset + 'px';
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2577
|
-
getValue() {
|
|
2578
|
-
return this.value || '';
|
|
2579
|
-
}
|
|
2580
|
-
hasValue() {
|
|
2581
|
-
return this.getValue() !== '';
|
|
2582
|
-
}
|
|
2583
|
-
/**
|
|
2584
|
-
* Determines whether or not the cancel button should be visible onscreen.
|
|
2585
|
-
* Cancel button should be shown if one of two conditions applies:
|
|
2586
|
-
* 1. `showCancelButton` is set to `always`.
|
|
2587
|
-
* 2. `showCancelButton` is set to `focus`, and the searchbar has been focused.
|
|
2588
|
-
*/
|
|
2589
|
-
shouldShowCancelButton() {
|
|
2590
|
-
if (this.showCancelButton === 'never' || (this.showCancelButton === 'focus' && !this.focused)) {
|
|
2591
|
-
return false;
|
|
2592
|
-
}
|
|
2593
|
-
return true;
|
|
2594
|
-
}
|
|
2595
|
-
/**
|
|
2596
|
-
* Determines whether or not the clear button should be visible onscreen.
|
|
2597
|
-
* Clear button should be shown if one of two conditions applies:
|
|
2598
|
-
* 1. `showClearButton` is set to `always`.
|
|
2599
|
-
* 2. `showClearButton` is set to `focus`, and the searchbar has been focused.
|
|
2600
|
-
*/
|
|
2601
|
-
shouldShowClearButton() {
|
|
2602
|
-
if (this.showClearButton === 'never' || (this.showClearButton === 'focus' && !this.focused)) {
|
|
2603
|
-
return false;
|
|
2604
|
-
}
|
|
2605
|
-
return true;
|
|
2606
|
-
}
|
|
2607
|
-
render() {
|
|
2608
|
-
const { cancelButtonText } = this;
|
|
2609
|
-
const animated = this.animated && config.getBoolean('animated', true);
|
|
2610
|
-
const mode = getIonMode$1(this);
|
|
2611
|
-
const clearIcon = this.clearIcon || (mode === 'ios' ? closeCircle : closeSharp);
|
|
2612
|
-
const searchIcon = this.searchIcon || (mode === 'ios' ? searchOutline : searchSharp);
|
|
2613
|
-
const shouldShowCancelButton = this.shouldShowCancelButton();
|
|
2614
|
-
const cancelButton = this.showCancelButton !== 'never' && (h("button", { "aria-label": cancelButtonText, "aria-hidden": shouldShowCancelButton ? undefined : 'true', type: "button", tabIndex: mode === 'ios' && !shouldShowCancelButton ? -1 : undefined, onMouseDown: this.onCancelSearchbar, onTouchStart: this.onCancelSearchbar, class: "searchbar-cancel-button" }, h("div", { "aria-hidden": "true" }, mode === 'md' ? (h("ion-icon", { "aria-hidden": "true", mode: mode, icon: this.cancelButtonIcon, lazy: false })) : (cancelButtonText))));
|
|
2615
|
-
return (h(Host, { role: "search", "aria-disabled": this.disabled ? 'true' : null, class: createColorClasses$1(this.color, {
|
|
2616
|
-
[mode]: true,
|
|
2617
|
-
'searchbar-animated': animated,
|
|
2618
|
-
'searchbar-disabled': this.disabled,
|
|
2619
|
-
'searchbar-no-animate': animated && this.noAnimate,
|
|
2620
|
-
'searchbar-has-value': this.hasValue(),
|
|
2621
|
-
'searchbar-left-aligned': this.shouldAlignLeft,
|
|
2622
|
-
'searchbar-has-focus': this.focused,
|
|
2623
|
-
'searchbar-should-show-clear': this.shouldShowClearButton(),
|
|
2624
|
-
'searchbar-should-show-cancel': this.shouldShowCancelButton(),
|
|
2625
|
-
}) }, h("div", { class: "searchbar-input-container" }, h("input", { "aria-label": "search text", disabled: this.disabled, ref: (el) => (this.nativeInput = el), class: "searchbar-input", inputMode: this.inputmode, enterKeyHint: this.enterkeyhint, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, placeholder: this.placeholder, type: this.type, value: this.getValue(), autoComplete: this.autocomplete, autoCorrect: this.autocorrect, spellcheck: this.spellcheck }), mode === 'md' && cancelButton, h("ion-icon", { "aria-hidden": "true", mode: mode, icon: searchIcon, lazy: false, class: "searchbar-search-icon" }), h("button", { "aria-label": "reset", type: "button", "no-blur": true, class: "searchbar-clear-button", onPointerDown: (ev) => {
|
|
2626
|
-
/**
|
|
2627
|
-
* This prevents mobile browsers from
|
|
2628
|
-
* blurring the input when the clear
|
|
2629
|
-
* button is activated.
|
|
2630
|
-
*/
|
|
2631
|
-
ev.preventDefault();
|
|
2632
|
-
}, onClick: () => this.onClearInput(true) }, h("ion-icon", { "aria-hidden": "true", mode: mode, icon: clearIcon, lazy: false, class: "searchbar-clear-icon" }))), mode === 'ios' && cancelButton));
|
|
2633
|
-
}
|
|
2634
|
-
get el() { return getElement$1(this); }
|
|
2635
|
-
static get watchers() { return {
|
|
2636
|
-
"debounce": ["debounceChanged"],
|
|
2637
|
-
"value": ["valueChanged"],
|
|
2638
|
-
"showCancelButton": ["showCancelButtonChanged"]
|
|
2639
|
-
}; }
|
|
2640
|
-
};
|
|
2641
|
-
Searchbar.style = {
|
|
2642
|
-
ios: searchbarIosCss,
|
|
2643
|
-
md: searchbarMdCss
|
|
2644
|
-
};
|
|
2645
|
-
|
|
2646
|
-
const skeletonTextCss = ":host{--background:rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065);border-radius:var(--border-radius, inherit);display:block;width:100%;height:inherit;margin-top:4px;margin-bottom:4px;background:var(--background);line-height:10px;user-select:none;pointer-events:none}span{display:inline-block}:host(.in-media){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;height:100%}:host(.skeleton-text-animated){position:relative;background:linear-gradient(to right, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 8%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.135) 18%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 33%);background-size:800px 104px;animation-duration:1s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:shimmer;animation-timing-function:linear}@keyframes shimmer{0%{background-position:-400px 0}100%{background-position:400px 0}}";
|
|
2647
|
-
|
|
2648
|
-
const SkeletonText = class {
|
|
2649
|
-
constructor(hostRef) {
|
|
2650
|
-
registerInstance(this, hostRef);
|
|
2651
|
-
/**
|
|
2652
|
-
* If `true`, the skeleton text will animate.
|
|
2653
|
-
*/
|
|
2654
|
-
this.animated = false;
|
|
2655
|
-
}
|
|
2656
|
-
render() {
|
|
2657
|
-
const animated = this.animated && config.getBoolean('animated', true);
|
|
2658
|
-
const inMedia = hostContext('ion-avatar', this.el) || hostContext('ion-thumbnail', this.el);
|
|
2659
|
-
const mode = getIonMode$1(this);
|
|
2660
|
-
return (h(Host, { class: {
|
|
2661
|
-
[mode]: true,
|
|
2662
|
-
'skeleton-text-animated': animated,
|
|
2663
|
-
'in-media': inMedia,
|
|
2664
|
-
} }, h("span", null, "\u00A0")));
|
|
2665
|
-
}
|
|
2666
|
-
get el() { return getElement$1(this); }
|
|
2667
|
-
};
|
|
2668
|
-
SkeletonText.style = skeletonTextCss;
|
|
2669
|
-
|
|
2670
|
-
const titleIosCss = ":host{--color:initial;display:flex;flex:1;align-items:center;transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{left:0;top:0;padding-left:90px;padding-right:90px;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);position:absolute;width:100%;height:100%;transform:translateZ(0);font-size:17px;font-weight:600;text-align:center;box-sizing:border-box;pointer-events:none}:host-context([dir=rtl]){left:unset;right:unset;right:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:90px;padding-inline-start:90px;-webkit-padding-end:90px;padding-inline-end:90px}}:host(.title-small){padding-left:9px;padding-right:9px;padding-top:6px;padding-bottom:16px;position:relative;font-size:13px;font-weight:normal}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.title-small){padding-left:unset;padding-right:unset;-webkit-padding-start:9px;padding-inline-start:9px;-webkit-padding-end:9px;padding-inline-end:9px}}:host(.title-large){padding-left:16px;padding-right:16px;padding-top:0;padding-bottom:0;transform-origin:left center;bottom:0;align-items:flex-end;min-width:100%;padding-bottom:6px;font-size:34px;font-weight:700;text-align:start}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.title-large){padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host(.title-large.title-rtl){transform-origin:right center}:host(.title-large.ion-cloned-element){--color:var(--ion-text-color, #000)}:host(.title-large) .toolbar-title{transform-origin:inherit}:host-context([dir=rtl]):host(.title-large) .toolbar-title,:host-context([dir=rtl]).title-large .toolbar-title{transform-origin:calc(100% - inherit)}";
|
|
2671
|
-
|
|
2672
|
-
const titleMdCss = ":host{--color:initial;display:flex;flex:1;align-items:center;transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{padding-left:20px;padding-right:20px;padding-top:0;padding-bottom:0;font-size:20px;font-weight:500;letter-spacing:0.0125em}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px}}:host(.title-small){width:100%;height:100%;font-size:15px;font-weight:normal}";
|
|
2673
|
-
|
|
2674
|
-
const ToolbarTitle = class {
|
|
2675
|
-
constructor(hostRef) {
|
|
2676
|
-
registerInstance(this, hostRef);
|
|
2677
|
-
this.ionStyle = createEvent(this, "ionStyle", 7);
|
|
2678
|
-
}
|
|
2679
|
-
sizeChanged() {
|
|
2680
|
-
this.emitStyle();
|
|
2681
|
-
}
|
|
2682
|
-
connectedCallback() {
|
|
2683
|
-
this.emitStyle();
|
|
2684
|
-
}
|
|
2685
|
-
emitStyle() {
|
|
2686
|
-
const size = this.getSize();
|
|
2687
|
-
this.ionStyle.emit({
|
|
2688
|
-
[`title-${size}`]: true,
|
|
2689
|
-
});
|
|
2690
|
-
}
|
|
2691
|
-
getSize() {
|
|
2692
|
-
return this.size !== undefined ? this.size : 'default';
|
|
2693
|
-
}
|
|
2694
|
-
render() {
|
|
2695
|
-
const mode = getIonMode$1(this);
|
|
2696
|
-
const size = this.getSize();
|
|
2697
|
-
return (h(Host, { class: createColorClasses$1(this.color, {
|
|
2698
|
-
[mode]: true,
|
|
2699
|
-
[`title-${size}`]: true,
|
|
2700
|
-
'title-rtl': document.dir === 'rtl',
|
|
2701
|
-
}) }, h("div", { class: "toolbar-title" }, h("slot", null))));
|
|
2702
|
-
}
|
|
2703
|
-
get el() { return getElement$1(this); }
|
|
2704
|
-
static get watchers() { return {
|
|
2705
|
-
"size": ["sizeChanged"]
|
|
2706
|
-
}; }
|
|
2707
|
-
};
|
|
2708
|
-
ToolbarTitle.style = {
|
|
2709
|
-
ios: titleIosCss,
|
|
2710
|
-
md: titleMdCss
|
|
2711
|
-
};
|
|
2712
|
-
|
|
2713
|
-
const toolbarIosCss = ":host{--border-width:0;--border-style:solid;--opacity:1;--opacity-scale:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:var(--ion-safe-area-left);padding-right:var(--ion-safe-area-right);display:block;position:relative;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-safe-area-left);padding-inline-start:var(--ion-safe-area-left);-webkit-padding-end:var(--ion-safe-area-right);padding-inline-end:var(--ion-safe-area-right)}}:host(.ion-color){color:var(--ion-color-contrast)}:host(.ion-color) .toolbar-background{background:var(--ion-color-base)}.toolbar-container{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;flex-direction:row;align-items:center;justify-content:space-between;width:100%;min-height:var(--min-height);contain:content;overflow:hidden;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.toolbar-container{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.toolbar-background{left:0;right:0;top:0;bottom:0;position:absolute;transform:translateZ(0);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;opacity:calc(var(--opacity) * var(--opacity-scale));z-index:-1;pointer-events:none}::slotted(ion-progress-bar){left:0;right:0;bottom:0;position:absolute}:host{--background:var(--ion-toolbar-background, var(--ion-color-step-50, #f7f7f7));--color:var(--ion-toolbar-color, var(--ion-text-color, #000));--border-color:var(--ion-toolbar-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.2))));--padding-top:3px;--padding-bottom:3px;--padding-start:4px;--padding-end:4px;--min-height:44px}.toolbar-content{flex:1;order:4;min-width:0}:host(.toolbar-segment) .toolbar-content{display:inline-flex}:host(.toolbar-searchbar) .toolbar-container{padding-top:0;padding-bottom:0}:host(.toolbar-searchbar) ::slotted(*){align-self:start}:host(.toolbar-searchbar) ::slotted(ion-chip){margin-top:3px}:host(.toolbar-searchbar) ::slotted(ion-back-button){height:38px}::slotted(ion-buttons){min-height:38px}::slotted([slot=start]){order:2}::slotted([slot=secondary]){order:3}::slotted([slot=primary]){order:5;text-align:end}::slotted([slot=end]){order:6;text-align:end}:host(.toolbar-title-large) .toolbar-container{flex-wrap:wrap;align-items:flex-start}:host(.toolbar-title-large) .toolbar-content ion-title{flex:1;order:8;min-width:100%}";
|
|
2714
|
-
|
|
2715
|
-
const toolbarMdCss = ":host{--border-width:0;--border-style:solid;--opacity:1;--opacity-scale:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:var(--ion-safe-area-left);padding-right:var(--ion-safe-area-right);display:block;position:relative;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-safe-area-left);padding-inline-start:var(--ion-safe-area-left);-webkit-padding-end:var(--ion-safe-area-right);padding-inline-end:var(--ion-safe-area-right)}}:host(.ion-color){color:var(--ion-color-contrast)}:host(.ion-color) .toolbar-background{background:var(--ion-color-base)}.toolbar-container{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;flex-direction:row;align-items:center;justify-content:space-between;width:100%;min-height:var(--min-height);contain:content;overflow:hidden;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.toolbar-container{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.toolbar-background{left:0;right:0;top:0;bottom:0;position:absolute;transform:translateZ(0);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;opacity:calc(var(--opacity) * var(--opacity-scale));z-index:-1;pointer-events:none}::slotted(ion-progress-bar){left:0;right:0;bottom:0;position:absolute}:host{--background:var(--ion-toolbar-background, var(--ion-background-color, #fff));--color:var(--ion-toolbar-color, var(--ion-text-color, #424242));--border-color:var(--ion-toolbar-border-color, var(--ion-border-color, var(--ion-color-step-150, #c1c4cd)));--padding-top:0;--padding-bottom:0;--padding-start:0;--padding-end:0;--min-height:56px}.toolbar-content{flex:1;order:3;min-width:0;max-width:100%}::slotted(.buttons-first-slot){margin-left:4px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(.buttons-first-slot){margin-left:unset;-webkit-margin-start:4px;margin-inline-start:4px}}::slotted(.buttons-last-slot){margin-right:4px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(.buttons-last-slot){margin-right:unset;-webkit-margin-end:4px;margin-inline-end:4px}}::slotted([slot=start]){order:2}::slotted([slot=secondary]){order:4}::slotted([slot=primary]){order:5;text-align:end}::slotted([slot=end]){order:6;text-align:end}";
|
|
2716
|
-
|
|
2717
|
-
const Toolbar = class {
|
|
2718
|
-
constructor(hostRef) {
|
|
2719
|
-
registerInstance(this, hostRef);
|
|
2720
|
-
this.childrenStyles = new Map();
|
|
2721
|
-
}
|
|
2722
|
-
componentWillLoad() {
|
|
2723
|
-
const buttons = Array.from(this.el.querySelectorAll('ion-buttons'));
|
|
2724
|
-
const firstButtons = buttons.find((button) => {
|
|
2725
|
-
return button.slot === 'start';
|
|
2726
|
-
});
|
|
2727
|
-
if (firstButtons) {
|
|
2728
|
-
firstButtons.classList.add('buttons-first-slot');
|
|
2729
|
-
}
|
|
2730
|
-
const buttonsReversed = buttons.reverse();
|
|
2731
|
-
const lastButtons = buttonsReversed.find((button) => button.slot === 'end') ||
|
|
2732
|
-
buttonsReversed.find((button) => button.slot === 'primary') ||
|
|
2733
|
-
buttonsReversed.find((button) => button.slot === 'secondary');
|
|
2734
|
-
if (lastButtons) {
|
|
2735
|
-
lastButtons.classList.add('buttons-last-slot');
|
|
2736
|
-
}
|
|
2737
|
-
}
|
|
2738
|
-
childrenStyle(ev) {
|
|
2739
|
-
ev.stopPropagation();
|
|
2740
|
-
const tagName = ev.target.tagName;
|
|
2741
|
-
const updatedStyles = ev.detail;
|
|
2742
|
-
const newStyles = {};
|
|
2743
|
-
const childStyles = this.childrenStyles.get(tagName) || {};
|
|
2744
|
-
let hasStyleChange = false;
|
|
2745
|
-
Object.keys(updatedStyles).forEach((key) => {
|
|
2746
|
-
const childKey = `toolbar-${key}`;
|
|
2747
|
-
const newValue = updatedStyles[key];
|
|
2748
|
-
if (newValue !== childStyles[childKey]) {
|
|
2749
|
-
hasStyleChange = true;
|
|
2750
|
-
}
|
|
2751
|
-
if (newValue) {
|
|
2752
|
-
newStyles[childKey] = true;
|
|
2753
|
-
}
|
|
2754
|
-
});
|
|
2755
|
-
if (hasStyleChange) {
|
|
2756
|
-
this.childrenStyles.set(tagName, newStyles);
|
|
2757
|
-
forceUpdate(this);
|
|
2758
|
-
}
|
|
2759
|
-
}
|
|
2760
|
-
render() {
|
|
2761
|
-
const mode = getIonMode$1(this);
|
|
2762
|
-
const childStyles = {};
|
|
2763
|
-
this.childrenStyles.forEach((value) => {
|
|
2764
|
-
Object.assign(childStyles, value);
|
|
2765
|
-
});
|
|
2766
|
-
return (h(Host, { class: Object.assign(Object.assign({}, childStyles), createColorClasses$1(this.color, {
|
|
2767
|
-
[mode]: true,
|
|
2768
|
-
'in-toolbar': hostContext('ion-toolbar', this.el),
|
|
2769
|
-
})) }, h("div", { class: "toolbar-background" }), h("div", { class: "toolbar-container" }, h("slot", { name: "start" }), h("slot", { name: "secondary" }), h("div", { class: "toolbar-content" }, h("slot", null)), h("slot", { name: "primary" }), h("slot", { name: "end" }))));
|
|
2770
|
-
}
|
|
2771
|
-
get el() { return getElement$1(this); }
|
|
2772
|
-
};
|
|
2773
|
-
Toolbar.style = {
|
|
2774
|
-
ios: toolbarIosCss,
|
|
2775
|
-
md: toolbarMdCss
|
|
2776
|
-
};
|
|
2777
|
-
|
|
2778
|
-
const appendToMap$1 = (map, propName, value) => {
|
|
2779
|
-
const items = map.get(propName);
|
|
2780
|
-
if (!items) {
|
|
2781
|
-
map.set(propName, [value]);
|
|
2782
|
-
}
|
|
2783
|
-
else if (!items.includes(value)) {
|
|
2784
|
-
items.push(value);
|
|
2785
|
-
}
|
|
2786
|
-
};
|
|
2787
|
-
const debounce$1 = (fn, ms) => {
|
|
2788
|
-
let timeoutId;
|
|
2789
|
-
return (...args) => {
|
|
2790
|
-
if (timeoutId) {
|
|
2791
|
-
clearTimeout(timeoutId);
|
|
2792
|
-
}
|
|
2793
|
-
timeoutId = setTimeout(() => {
|
|
2794
|
-
timeoutId = 0;
|
|
2795
|
-
fn(...args);
|
|
2796
|
-
}, ms);
|
|
2797
|
-
};
|
|
2798
|
-
};
|
|
2799
|
-
|
|
2800
|
-
/**
|
|
2801
|
-
* Check if a possible element isConnected.
|
|
2802
|
-
* The property might not be there, so we check for it.
|
|
2803
|
-
*
|
|
2804
|
-
* We want it to return true if isConnected is not a property,
|
|
2805
|
-
* otherwise we would remove these elements and would not update.
|
|
2806
|
-
*
|
|
2807
|
-
* Better leak in Edge than to be useless.
|
|
2808
|
-
*/
|
|
2809
|
-
const isConnected$1 = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
2810
|
-
const cleanupElements$1 = debounce$1((map) => {
|
|
2811
|
-
for (let key of map.keys()) {
|
|
2812
|
-
map.set(key, map.get(key).filter(isConnected$1));
|
|
2813
|
-
}
|
|
2814
|
-
}, 2000);
|
|
2815
|
-
const stencilSubscription$1 = () => {
|
|
2816
|
-
if (typeof getRenderingRef !== 'function') {
|
|
2817
|
-
// If we are not in a stencil project, we do nothing.
|
|
2818
|
-
// This function is not really exported by @stencil/core.
|
|
2819
|
-
return {};
|
|
2820
|
-
}
|
|
2821
|
-
const elmsToUpdate = new Map();
|
|
2822
|
-
return {
|
|
2823
|
-
dispose: () => elmsToUpdate.clear(),
|
|
2824
|
-
get: (propName) => {
|
|
2825
|
-
const elm = getRenderingRef();
|
|
2826
|
-
if (elm) {
|
|
2827
|
-
appendToMap$1(elmsToUpdate, propName, elm);
|
|
2828
|
-
}
|
|
2829
|
-
},
|
|
2830
|
-
set: (propName) => {
|
|
2831
|
-
const elements = elmsToUpdate.get(propName);
|
|
2832
|
-
if (elements) {
|
|
2833
|
-
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
2834
|
-
}
|
|
2835
|
-
cleanupElements$1(elmsToUpdate);
|
|
2836
|
-
},
|
|
2837
|
-
reset: () => {
|
|
2838
|
-
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
2839
|
-
cleanupElements$1(elmsToUpdate);
|
|
2840
|
-
},
|
|
2841
|
-
};
|
|
2842
|
-
};
|
|
2843
|
-
|
|
2844
|
-
const unwrap$1 = (val) => (typeof val === 'function' ? val() : val);
|
|
2845
|
-
const createObservableMap$1 = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
2846
|
-
const unwrappedState = unwrap$1(defaultState);
|
|
2847
|
-
let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
|
|
2848
|
-
const handlers = {
|
|
2849
|
-
dispose: [],
|
|
2850
|
-
get: [],
|
|
2851
|
-
set: [],
|
|
2852
|
-
reset: [],
|
|
2853
|
-
};
|
|
2854
|
-
const reset = () => {
|
|
2855
|
-
var _a;
|
|
2856
|
-
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
2857
|
-
// otherwise, the state won't be properly reset
|
|
2858
|
-
states = new Map(Object.entries((_a = unwrap$1(defaultState)) !== null && _a !== void 0 ? _a : {}));
|
|
2859
|
-
handlers.reset.forEach((cb) => cb());
|
|
2860
|
-
};
|
|
2861
|
-
const dispose = () => {
|
|
2862
|
-
// Call first dispose as resetting the state would
|
|
2863
|
-
// cause less updates ;)
|
|
2864
|
-
handlers.dispose.forEach((cb) => cb());
|
|
2865
|
-
reset();
|
|
2866
|
-
};
|
|
2867
|
-
const get = (propName) => {
|
|
2868
|
-
handlers.get.forEach((cb) => cb(propName));
|
|
2869
|
-
return states.get(propName);
|
|
2870
|
-
};
|
|
2871
|
-
const set = (propName, value) => {
|
|
2872
|
-
const oldValue = states.get(propName);
|
|
2873
|
-
if (shouldUpdate(value, oldValue, propName)) {
|
|
2874
|
-
states.set(propName, value);
|
|
2875
|
-
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
2876
|
-
}
|
|
2877
|
-
};
|
|
2878
|
-
const state = (typeof Proxy === 'undefined'
|
|
2879
|
-
? {}
|
|
2880
|
-
: new Proxy(unwrappedState, {
|
|
2881
|
-
get(_, propName) {
|
|
2882
|
-
return get(propName);
|
|
2883
|
-
},
|
|
2884
|
-
ownKeys(_) {
|
|
2885
|
-
return Array.from(states.keys());
|
|
2886
|
-
},
|
|
2887
|
-
getOwnPropertyDescriptor() {
|
|
2888
|
-
return {
|
|
2889
|
-
enumerable: true,
|
|
2890
|
-
configurable: true,
|
|
2891
|
-
};
|
|
2892
|
-
},
|
|
2893
|
-
has(_, propName) {
|
|
2894
|
-
return states.has(propName);
|
|
2895
|
-
},
|
|
2896
|
-
set(_, propName, value) {
|
|
2897
|
-
set(propName, value);
|
|
2898
|
-
return true;
|
|
2899
|
-
},
|
|
2900
|
-
}));
|
|
2901
|
-
const on = (eventName, callback) => {
|
|
2902
|
-
handlers[eventName].push(callback);
|
|
2903
|
-
return () => {
|
|
2904
|
-
removeFromArray$1(handlers[eventName], callback);
|
|
2905
|
-
};
|
|
2906
|
-
};
|
|
2907
|
-
const onChange = (propName, cb) => {
|
|
2908
|
-
const unSet = on('set', (key, newValue) => {
|
|
2909
|
-
if (key === propName) {
|
|
2910
|
-
cb(newValue);
|
|
2911
|
-
}
|
|
2912
|
-
});
|
|
2913
|
-
// We need to unwrap the defaultState because it might be a function.
|
|
2914
|
-
// Otherwise we might not be sending the right reset value.
|
|
2915
|
-
const unReset = on('reset', () => cb(unwrap$1(defaultState)[propName]));
|
|
2916
|
-
return () => {
|
|
2917
|
-
unSet();
|
|
2918
|
-
unReset();
|
|
2919
|
-
};
|
|
2920
|
-
};
|
|
2921
|
-
const use = (...subscriptions) => {
|
|
2922
|
-
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
2923
|
-
if (subscription.set) {
|
|
2924
|
-
unsubs.push(on('set', subscription.set));
|
|
2925
|
-
}
|
|
2926
|
-
if (subscription.get) {
|
|
2927
|
-
unsubs.push(on('get', subscription.get));
|
|
2928
|
-
}
|
|
2929
|
-
if (subscription.reset) {
|
|
2930
|
-
unsubs.push(on('reset', subscription.reset));
|
|
2931
|
-
}
|
|
2932
|
-
if (subscription.dispose) {
|
|
2933
|
-
unsubs.push(on('dispose', subscription.dispose));
|
|
2934
|
-
}
|
|
2935
|
-
return unsubs;
|
|
2936
|
-
}, []);
|
|
2937
|
-
return () => unsubs.forEach((unsub) => unsub());
|
|
2938
|
-
};
|
|
2939
|
-
const forceUpdate = (key) => {
|
|
2940
|
-
const oldValue = states.get(key);
|
|
2941
|
-
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
2942
|
-
};
|
|
2943
|
-
return {
|
|
2944
|
-
state,
|
|
2945
|
-
get,
|
|
2946
|
-
set,
|
|
2947
|
-
on,
|
|
2948
|
-
onChange,
|
|
2949
|
-
use,
|
|
2950
|
-
dispose,
|
|
2951
|
-
reset,
|
|
2952
|
-
forceUpdate,
|
|
2953
|
-
};
|
|
2954
|
-
};
|
|
2955
|
-
const removeFromArray$1 = (array, item) => {
|
|
2956
|
-
const index = array.indexOf(item);
|
|
2957
|
-
if (index >= 0) {
|
|
2958
|
-
array[index] = array[array.length - 1];
|
|
2959
|
-
array.length--;
|
|
2960
|
-
}
|
|
2961
|
-
};
|
|
2962
|
-
|
|
2963
|
-
const createStore$1 = (defaultState, shouldUpdate) => {
|
|
2964
|
-
const map = createObservableMap$1(defaultState, shouldUpdate);
|
|
2965
|
-
map.use(stencilSubscription$1());
|
|
2966
|
-
return map;
|
|
2967
|
-
};
|
|
2968
|
-
|
|
2969
|
-
const getIdpUrl = () => prompt('Please enter your Identity Provider URL', 'http://localhost:3000');
|
|
2970
|
-
|
|
2971
|
-
const store = createStore$1({
|
|
2972
|
-
getIdpUrl,
|
|
2973
|
-
isLoggedIn: false,
|
|
2974
|
-
webId: '',
|
|
2975
|
-
});
|
|
1
|
+
'use strict';
|
|
2976
2
|
|
|
2977
3
|
var __create = Object.create;
|
|
2978
4
|
var __defProp = Object.defineProperty;
|
|
@@ -5190,14 +2216,14 @@ function subtleMapping(jwk) {
|
|
|
5190
2216
|
}
|
|
5191
2217
|
return { algorithm, keyUsages };
|
|
5192
2218
|
}
|
|
5193
|
-
var parse
|
|
2219
|
+
var parse, jwk_to_key_default;
|
|
5194
2220
|
var init_jwk_to_key = __esm({
|
|
5195
2221
|
"../node_modules/jose/dist/browser/runtime/jwk_to_key.js"() {
|
|
5196
2222
|
init_env();
|
|
5197
2223
|
init_webcrypto();
|
|
5198
2224
|
init_errors();
|
|
5199
2225
|
init_base64url();
|
|
5200
|
-
parse
|
|
2226
|
+
parse = async (jwk) => {
|
|
5201
2227
|
var _a, _b;
|
|
5202
2228
|
const { algorithm, keyUsages } = subtleMapping(jwk);
|
|
5203
2229
|
const rest = [
|
|
@@ -5213,7 +2239,7 @@ var init_jwk_to_key = __esm({
|
|
|
5213
2239
|
delete keyData.use;
|
|
5214
2240
|
return webcrypto_default.subtle.importKey("jwk", keyData, ...rest);
|
|
5215
2241
|
};
|
|
5216
|
-
jwk_to_key_default = parse
|
|
2242
|
+
jwk_to_key_default = parse;
|
|
5217
2243
|
}
|
|
5218
2244
|
});
|
|
5219
2245
|
|
|
@@ -28454,7 +25480,7 @@ var BinaryFile = class {
|
|
|
28454
25480
|
};
|
|
28455
25481
|
|
|
28456
25482
|
// src/files/BrokenFile.ts
|
|
28457
|
-
var BrokenFile
|
|
25483
|
+
var BrokenFile = class {
|
|
28458
25484
|
constructor(url, status) {
|
|
28459
25485
|
this.url = url;
|
|
28460
25486
|
this.status = status;
|
|
@@ -28490,7 +25516,7 @@ var FileFetcher = class {
|
|
|
28490
25516
|
const blob = yield response.blob();
|
|
28491
25517
|
return new BinaryFile(url, blob);
|
|
28492
25518
|
} else {
|
|
28493
|
-
return new BrokenFile
|
|
25519
|
+
return new BrokenFile(
|
|
28494
25520
|
url,
|
|
28495
25521
|
new HttpStatus(response.status, response.statusText)
|
|
28496
25522
|
);
|
|
@@ -42256,1145 +39282,5 @@ queue-microtask/index.js:
|
|
|
42256
39282
|
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *)
|
|
42257
39283
|
*/
|
|
42258
39284
|
|
|
42259
|
-
|
|
42260
|
-
|
|
42261
|
-
};
|
|
42262
|
-
|
|
42263
|
-
const PosApp = class {
|
|
42264
|
-
constructor(hostRef) {
|
|
42265
|
-
registerInstance(this, hostRef);
|
|
42266
|
-
this.os = undefined;
|
|
42267
|
-
}
|
|
42268
|
-
componentWillLoad() {
|
|
42269
|
-
this.os = createPodOS();
|
|
42270
|
-
this.os.handleIncomingRedirect();
|
|
42271
|
-
this.os.trackSession(sessionInfo => {
|
|
42272
|
-
store.state.isLoggedIn = sessionInfo.isLoggedIn;
|
|
42273
|
-
store.state.webId = sessionInfo.webId;
|
|
42274
|
-
});
|
|
42275
|
-
}
|
|
42276
|
-
async initializeOs(event) {
|
|
42277
|
-
event.stopPropagation();
|
|
42278
|
-
event.detail(this.os);
|
|
42279
|
-
}
|
|
42280
|
-
render() {
|
|
42281
|
-
return (h("ion-app", null, h("slot", null)));
|
|
42282
|
-
}
|
|
42283
|
-
};
|
|
42284
|
-
|
|
42285
|
-
const PosAppBrowser = class {
|
|
42286
|
-
constructor(hostRef) {
|
|
42287
|
-
registerInstance(this, hostRef);
|
|
42288
|
-
}
|
|
42289
|
-
render() {
|
|
42290
|
-
return (h("pos-app", null, h("ion-header", null, h("ion-toolbar", null, h("ion-title", { slot: "start" }, "PodOS"), h("pos-login", null))), h("ion-content", null, h("pos-router", null)), h("ion-footer", null, h("ion-toolbar", null, h("ion-title", null, "PodOS Browser")))));
|
|
42291
|
-
}
|
|
42292
|
-
};
|
|
42293
|
-
|
|
42294
|
-
const PosAppGeneric = class {
|
|
42295
|
-
constructor(hostRef) {
|
|
42296
|
-
registerInstance(this, hostRef);
|
|
42297
|
-
}
|
|
42298
|
-
render() {
|
|
42299
|
-
return (h("ion-grid", null, h("ion-row", null, h("ion-col", { size: "12", "size-sm": true }, h("ion-card", null, h("ion-card-header", null, h("pos-type-badges", null), h("pos-picture", null), h("ion-card-title", null, h("pos-label", null))), h("ion-card-content", null, h("pos-description", null)))), h("ion-col", { size: "12", "size-sm": true }, h("pos-literals", null)), h("ion-col", { size: "12", "size-sm": true }, h("pos-relations", null), h("pos-reverse-relations", null)))));
|
|
42300
|
-
}
|
|
42301
|
-
};
|
|
42302
|
-
|
|
42303
|
-
function subscribeResource(component) {
|
|
42304
|
-
component.subscribeResource.emit(component.receiveResource);
|
|
42305
|
-
}
|
|
42306
|
-
|
|
42307
|
-
const PosAppImageViewer = class {
|
|
42308
|
-
constructor(hostRef) {
|
|
42309
|
-
registerInstance(this, hostRef);
|
|
42310
|
-
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
42311
|
-
this.receiveResource = (resource) => {
|
|
42312
|
-
this.resource = resource;
|
|
42313
|
-
};
|
|
42314
|
-
this.resource = undefined;
|
|
42315
|
-
}
|
|
42316
|
-
componentWillLoad() {
|
|
42317
|
-
subscribeResource(this);
|
|
42318
|
-
}
|
|
42319
|
-
render() {
|
|
42320
|
-
if (!this.resource) {
|
|
42321
|
-
return null;
|
|
42322
|
-
}
|
|
42323
|
-
return (h("ion-grid", null, h("ion-row", null, h("ion-col", { size: "12", "size-sm": true }, h("pos-image", { src: this.resource.uri })), h("ion-col", { size: "12", "size-sm": true }, h("ion-card", null, h("ion-card-header", null, h("ion-card-title", null, h("pos-label", null), h("pos-type-badges", null)), h("pos-literals", null)))))));
|
|
42324
|
-
}
|
|
42325
|
-
};
|
|
42326
|
-
PosAppImageViewer.style = "pos-image {\n --max-width: 100%;\n }";
|
|
42327
|
-
|
|
42328
|
-
const PosAppPdfViewer = class {
|
|
42329
|
-
constructor(hostRef) {
|
|
42330
|
-
registerInstance(this, hostRef);
|
|
42331
|
-
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
42332
|
-
this.receiveResource = (resource) => {
|
|
42333
|
-
this.resource = resource;
|
|
42334
|
-
};
|
|
42335
|
-
this.resource = undefined;
|
|
42336
|
-
}
|
|
42337
|
-
componentWillLoad() {
|
|
42338
|
-
subscribeResource(this);
|
|
42339
|
-
}
|
|
42340
|
-
render() {
|
|
42341
|
-
if (!this.resource) {
|
|
42342
|
-
return null;
|
|
42343
|
-
}
|
|
42344
|
-
return (h("ion-grid", null, h("ion-row", null, h("ion-col", { size: "12", "size-sm": true }, h("pos-pdf", { src: this.resource.uri })), h("ion-col", { size: "12", "size-sm": true }, h("ion-card", null, h("ion-card-header", null, h("ion-card-title", null, h("pos-label", null), h("pos-type-badges", null)), h("pos-literals", null)))))));
|
|
42345
|
-
}
|
|
42346
|
-
};
|
|
42347
|
-
|
|
42348
|
-
const PosAppRdfDocument = class {
|
|
42349
|
-
constructor(hostRef) {
|
|
42350
|
-
registerInstance(this, hostRef);
|
|
42351
|
-
}
|
|
42352
|
-
render() {
|
|
42353
|
-
return (h("ion-grid", null, h("ion-row", null, h("ion-col", { size: "12", "size-sm": true }, h("pos-subjects", null)), h("ion-col", { size: "12", "size-sm": true }, h("ion-card", null, h("ion-card-header", null, h("ion-card-title", null, h("pos-label", null), h("pos-type-badges", null)), h("pos-literals", null)))))));
|
|
42354
|
-
}
|
|
42355
|
-
};
|
|
42356
|
-
|
|
42357
|
-
const PosDescription = class {
|
|
42358
|
-
constructor(hostRef) {
|
|
42359
|
-
registerInstance(this, hostRef);
|
|
42360
|
-
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
42361
|
-
this.receiveResource = (resource) => {
|
|
42362
|
-
this.resource = resource;
|
|
42363
|
-
};
|
|
42364
|
-
this.resource = undefined;
|
|
42365
|
-
}
|
|
42366
|
-
componentWillLoad() {
|
|
42367
|
-
subscribeResource(this);
|
|
42368
|
-
}
|
|
42369
|
-
render() {
|
|
42370
|
-
return this.resource ? this.resource.description() : null;
|
|
42371
|
-
}
|
|
42372
|
-
};
|
|
42373
|
-
|
|
42374
|
-
const BrokenFile = ({ file }) => {
|
|
42375
|
-
const iconName = iconForStatus(file.status);
|
|
42376
|
-
return (h("div", null,
|
|
42377
|
-
h("a", { class: "error", href: file.url },
|
|
42378
|
-
h("div", null,
|
|
42379
|
-
h("ion-icon", { name: iconName })),
|
|
42380
|
-
h("div", { class: "code" }, file.status.code),
|
|
42381
|
-
h("div", { class: "text" }, file.status.text))));
|
|
42382
|
-
};
|
|
42383
|
-
function iconForStatus(status) {
|
|
42384
|
-
switch (status.code) {
|
|
42385
|
-
case 401:
|
|
42386
|
-
case 403:
|
|
42387
|
-
return 'lock-closed-outline';
|
|
42388
|
-
case 404:
|
|
42389
|
-
return 'help-circle-outline';
|
|
42390
|
-
default:
|
|
42391
|
-
return 'alert-circle-outline';
|
|
42392
|
-
}
|
|
42393
|
-
}
|
|
42394
|
-
|
|
42395
|
-
const posImageCss = ":host{}img,ion-skeleton-text,div.error{border-radius:var(--border-radius);width:var(--width);height:var(--height);max-width:var(--max-width);max-height:var(--max-height)}.error{display:flex;opacity:0.8;background:repeating-linear-gradient( -45deg, rgba(150, 0, 0, 0.1), rgba(150, 0, 0, 0.1) 10px, #fff 5px, #fff 25px );flex-direction:column;border:1px solid red;color:black;align-items:center;justify-content:center;word-break:break-all;padding:1rem;box-sizing:border-box}.error ion-icon{color:#282828;--ionicon-stroke-width:calc(var(--width) / 5);font-size:calc(var(--width) / 2)}a{text-decoration:none;width:var(--width);height:var(--height)}.code{font-weight:bold;font-size:calc(var(--width) / 8)}.text{font-size:calc(var(--width) / 20)}";
|
|
42396
|
-
|
|
42397
|
-
const PosImage = class {
|
|
42398
|
-
constructor(hostRef) {
|
|
42399
|
-
registerInstance(this, hostRef);
|
|
42400
|
-
this.initializeOsEmitter = createEvent(this, "pod-os:init", 7);
|
|
42401
|
-
this.setOs = async (os) => {
|
|
42402
|
-
this.os = os;
|
|
42403
|
-
};
|
|
42404
|
-
this.src = undefined;
|
|
42405
|
-
this.alt = undefined;
|
|
42406
|
-
this.os = undefined;
|
|
42407
|
-
this.dataUri = undefined;
|
|
42408
|
-
this.brokenFile = undefined;
|
|
42409
|
-
this.error = undefined;
|
|
42410
|
-
this.loading = true;
|
|
42411
|
-
}
|
|
42412
|
-
componentWillLoad() {
|
|
42413
|
-
store.onChange('isLoggedIn', () => this.fetchBlob());
|
|
42414
|
-
this.initializeOsEmitter.emit(this.setOs);
|
|
42415
|
-
}
|
|
42416
|
-
async fetchBlob() {
|
|
42417
|
-
try {
|
|
42418
|
-
this.loading = true;
|
|
42419
|
-
const file = await this.os.fetchFile(this.src);
|
|
42420
|
-
if (file.blob()) {
|
|
42421
|
-
this.dataUri = URL.createObjectURL(file.blob());
|
|
42422
|
-
this.error = null;
|
|
42423
|
-
}
|
|
42424
|
-
else {
|
|
42425
|
-
this.brokenFile = file;
|
|
42426
|
-
}
|
|
42427
|
-
}
|
|
42428
|
-
catch (err) {
|
|
42429
|
-
this.error = err;
|
|
42430
|
-
}
|
|
42431
|
-
finally {
|
|
42432
|
-
this.loading = false;
|
|
42433
|
-
}
|
|
42434
|
-
}
|
|
42435
|
-
render() {
|
|
42436
|
-
if (this.loading) {
|
|
42437
|
-
return h("ion-skeleton-text", { animated: true });
|
|
42438
|
-
}
|
|
42439
|
-
if (this.error) {
|
|
42440
|
-
return h("div", { class: "error" }, this.error.message);
|
|
42441
|
-
}
|
|
42442
|
-
if (this.brokenFile) {
|
|
42443
|
-
return h(BrokenFile, { file: this.brokenFile });
|
|
42444
|
-
}
|
|
42445
|
-
return h("img", { src: this.dataUri, alt: this.alt });
|
|
42446
|
-
}
|
|
42447
|
-
static get watchers() { return {
|
|
42448
|
-
"os": ["fetchBlob"],
|
|
42449
|
-
"src": ["fetchBlob"]
|
|
42450
|
-
}; }
|
|
42451
|
-
};
|
|
42452
|
-
PosImage.style = posImageCss;
|
|
42453
|
-
|
|
42454
|
-
const PosLabel = class {
|
|
42455
|
-
constructor(hostRef) {
|
|
42456
|
-
registerInstance(this, hostRef);
|
|
42457
|
-
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
42458
|
-
this.receiveResource = (resource) => {
|
|
42459
|
-
this.resource = resource;
|
|
42460
|
-
};
|
|
42461
|
-
this.resource = undefined;
|
|
42462
|
-
}
|
|
42463
|
-
componentWillLoad() {
|
|
42464
|
-
subscribeResource(this);
|
|
42465
|
-
}
|
|
42466
|
-
render() {
|
|
42467
|
-
return this.resource ? this.resource.label() : null;
|
|
42468
|
-
}
|
|
42469
|
-
};
|
|
42470
|
-
|
|
42471
|
-
const PosLiterals = class {
|
|
42472
|
-
constructor(hostRef) {
|
|
42473
|
-
registerInstance(this, hostRef);
|
|
42474
|
-
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
42475
|
-
this.receiveResource = (resource) => {
|
|
42476
|
-
this.data = resource.literals();
|
|
42477
|
-
};
|
|
42478
|
-
this.data = [];
|
|
42479
|
-
}
|
|
42480
|
-
componentWillLoad() {
|
|
42481
|
-
subscribeResource(this);
|
|
42482
|
-
}
|
|
42483
|
-
render() {
|
|
42484
|
-
const items = this.data.map(it => (h("ion-item-group", null, h("ion-item-divider", null, h("ion-label", null, it.predicate)), it.values.map(value => (h("ion-item", null, h("ion-label", { class: "ion-text-wrap" }, value), ' '))))));
|
|
42485
|
-
return this.data.length > 0 ? h("ion-list", null, items) : null;
|
|
42486
|
-
}
|
|
42487
|
-
};
|
|
42488
|
-
|
|
42489
|
-
const posLoginCss = ":host{display:flex;gap:10px}.user-data{align-items:center;display:inline-flex;gap:10px}.user-data pos-picture{--width:40px;--height:40px;--border-radius:50%}";
|
|
42490
|
-
|
|
42491
|
-
const PosLogin = class {
|
|
42492
|
-
constructor(hostRef) {
|
|
42493
|
-
registerInstance(this, hostRef);
|
|
42494
|
-
this.initializeOsEmitter = createEvent(this, "pod-os:init", 7);
|
|
42495
|
-
this.setOs = async (os) => {
|
|
42496
|
-
this.os = os;
|
|
42497
|
-
};
|
|
42498
|
-
this.os = undefined;
|
|
42499
|
-
}
|
|
42500
|
-
componentWillLoad() {
|
|
42501
|
-
this.initializeOsEmitter.emit(this.setOs);
|
|
42502
|
-
}
|
|
42503
|
-
login() {
|
|
42504
|
-
const idp = store.state.getIdpUrl();
|
|
42505
|
-
this.os.login(idp);
|
|
42506
|
-
}
|
|
42507
|
-
logout() {
|
|
42508
|
-
this.os.logout();
|
|
42509
|
-
}
|
|
42510
|
-
render() {
|
|
42511
|
-
return (h(Host, null, store.state.isLoggedIn ? (h("pos-resource", { uri: store.state.webId }, h("span", { class: "user-data" }, h("pos-picture", null), h("pos-label", null)))) : (''), !store.state.isLoggedIn && h("ion-button", { onClick: () => this.login() }, "Login"), store.state.isLoggedIn && h("ion-button", { onClick: () => this.logout() }, "Logout")));
|
|
42512
|
-
}
|
|
42513
|
-
};
|
|
42514
|
-
PosLogin.style = posLoginCss;
|
|
42515
|
-
|
|
42516
|
-
const PosNavigationBar = class {
|
|
42517
|
-
constructor(hostRef) {
|
|
42518
|
-
registerInstance(this, hostRef);
|
|
42519
|
-
this.linkEmitter = createEvent(this, "pod-os:link", 7);
|
|
42520
|
-
this.uri = '';
|
|
42521
|
-
this.value = this.uri;
|
|
42522
|
-
}
|
|
42523
|
-
onChange(event) {
|
|
42524
|
-
this.value = event.detail.value;
|
|
42525
|
-
}
|
|
42526
|
-
onSubmit(event) {
|
|
42527
|
-
event.preventDefault();
|
|
42528
|
-
this.linkEmitter.emit(this.value);
|
|
42529
|
-
}
|
|
42530
|
-
render() {
|
|
42531
|
-
return (h("form", { onSubmit: e => this.onSubmit(e) }, h("ion-searchbar", { enterkeyhint: "search", placeholder: "Enter URI", value: this.uri, debounce: 0, onIonChange: e => this.onChange(e) })));
|
|
42532
|
-
}
|
|
42533
|
-
};
|
|
42534
|
-
|
|
42535
|
-
const posPdfCss = "iframe{width:100%;height:100vh}.error{display:flex;opacity:0.8;background:repeating-linear-gradient( -45deg, rgba(150, 0, 0, 0.1), rgba(150, 0, 0, 0.1) 10px, #fff 5px, #fff 25px );flex-direction:column;border:1px solid red;color:black;align-items:center;justify-content:center;word-break:break-all;padding:1rem;box-sizing:border-box}.error ion-icon{color:#282828;--ionicon-stroke-width:calc(var(--width) / 5);font-size:calc(var(--width) / 2)}a{text-decoration:none;width:var(--width);height:var(--height)}.code{font-weight:bold;font-size:calc(var(--width) / 8)}.text{font-size:calc(var(--width) / 20)}";
|
|
42536
|
-
|
|
42537
|
-
const PosPdf = class {
|
|
42538
|
-
constructor(hostRef) {
|
|
42539
|
-
registerInstance(this, hostRef);
|
|
42540
|
-
this.initializeOsEmitter = createEvent(this, "pod-os:init", 7);
|
|
42541
|
-
this.setOs = async (os) => {
|
|
42542
|
-
this.os = os;
|
|
42543
|
-
};
|
|
42544
|
-
this.src = undefined;
|
|
42545
|
-
this.alt = undefined;
|
|
42546
|
-
this.os = undefined;
|
|
42547
|
-
this.dataUri = undefined;
|
|
42548
|
-
this.brokenFile = undefined;
|
|
42549
|
-
this.error = undefined;
|
|
42550
|
-
this.loading = true;
|
|
42551
|
-
}
|
|
42552
|
-
componentWillLoad() {
|
|
42553
|
-
store.onChange('isLoggedIn', () => this.fetchBlob());
|
|
42554
|
-
this.initializeOsEmitter.emit(this.setOs);
|
|
42555
|
-
}
|
|
42556
|
-
async fetchBlob() {
|
|
42557
|
-
try {
|
|
42558
|
-
this.loading = true;
|
|
42559
|
-
const file = await this.os.fetchFile(this.src);
|
|
42560
|
-
if (file.blob()) {
|
|
42561
|
-
this.dataUri = URL.createObjectURL(file.blob());
|
|
42562
|
-
this.error = null;
|
|
42563
|
-
}
|
|
42564
|
-
else {
|
|
42565
|
-
this.brokenFile = file;
|
|
42566
|
-
}
|
|
42567
|
-
}
|
|
42568
|
-
catch (err) {
|
|
42569
|
-
this.error = err;
|
|
42570
|
-
}
|
|
42571
|
-
finally {
|
|
42572
|
-
this.loading = false;
|
|
42573
|
-
}
|
|
42574
|
-
}
|
|
42575
|
-
render() {
|
|
42576
|
-
if (this.loading) {
|
|
42577
|
-
return h("ion-skeleton-text", { animated: true });
|
|
42578
|
-
}
|
|
42579
|
-
if (this.error) {
|
|
42580
|
-
return h("div", { class: "error" }, this.error.message);
|
|
42581
|
-
}
|
|
42582
|
-
if (this.brokenFile) {
|
|
42583
|
-
return h(BrokenFile, { file: this.brokenFile });
|
|
42584
|
-
}
|
|
42585
|
-
return h("iframe", { src: this.dataUri });
|
|
42586
|
-
}
|
|
42587
|
-
static get watchers() { return {
|
|
42588
|
-
"os": ["fetchBlob"],
|
|
42589
|
-
"src": ["fetchBlob"]
|
|
42590
|
-
}; }
|
|
42591
|
-
};
|
|
42592
|
-
PosPdf.style = posPdfCss;
|
|
42593
|
-
|
|
42594
|
-
const posPictureCss = ":host{--width:300px;--height:300px;--border-radius:var(--border-radius, 0)}";
|
|
42595
|
-
|
|
42596
|
-
const PosPicture = class {
|
|
42597
|
-
constructor(hostRef) {
|
|
42598
|
-
registerInstance(this, hostRef);
|
|
42599
|
-
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
42600
|
-
this.receiveResource = (resource) => {
|
|
42601
|
-
this.resource = resource;
|
|
42602
|
-
};
|
|
42603
|
-
this.resource = undefined;
|
|
42604
|
-
}
|
|
42605
|
-
componentWillLoad() {
|
|
42606
|
-
subscribeResource(this);
|
|
42607
|
-
}
|
|
42608
|
-
render() {
|
|
42609
|
-
const pic = this.resource ? this.resource.picture() : null;
|
|
42610
|
-
if (!pic)
|
|
42611
|
-
return null;
|
|
42612
|
-
return h("pos-image", { src: pic.url, alt: this.resource.label() });
|
|
42613
|
-
}
|
|
42614
|
-
};
|
|
42615
|
-
PosPicture.style = posPictureCss;
|
|
42616
|
-
|
|
42617
|
-
const PosRelations = class {
|
|
42618
|
-
constructor(hostRef) {
|
|
42619
|
-
registerInstance(this, hostRef);
|
|
42620
|
-
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
42621
|
-
this.receiveResource = (resource) => {
|
|
42622
|
-
this.data = resource.relations();
|
|
42623
|
-
};
|
|
42624
|
-
this.data = [];
|
|
42625
|
-
}
|
|
42626
|
-
componentWillLoad() {
|
|
42627
|
-
subscribeResource(this);
|
|
42628
|
-
}
|
|
42629
|
-
render() {
|
|
42630
|
-
const items = this.data.map(it => (h("ion-item-group", null, h("ion-item-divider", null, h("ion-label", null, it.predicate)), it.uris.map(uri => (h("pos-rich-link", { uri: uri }))))));
|
|
42631
|
-
return this.data.length > 0 ? h("ion-list", null, items) : null;
|
|
42632
|
-
}
|
|
42633
|
-
};
|
|
42634
|
-
|
|
42635
|
-
const PosResource = class {
|
|
42636
|
-
constructor(hostRef) {
|
|
42637
|
-
registerInstance(this, hostRef);
|
|
42638
|
-
this.initializeOsEmitter = createEvent(this, "pod-os:init", 7);
|
|
42639
|
-
this.setOs = async (os) => {
|
|
42640
|
-
this.os = os;
|
|
42641
|
-
};
|
|
42642
|
-
this.os = undefined;
|
|
42643
|
-
this.resource = undefined;
|
|
42644
|
-
this.consumers = [];
|
|
42645
|
-
this.uri = undefined;
|
|
42646
|
-
this.lazy = false;
|
|
42647
|
-
this.error = undefined;
|
|
42648
|
-
this.loading = true;
|
|
42649
|
-
}
|
|
42650
|
-
componentWillLoad() {
|
|
42651
|
-
store.onChange('isLoggedIn', () => this.loadResource());
|
|
42652
|
-
this.initializeOsEmitter.emit(this.setOs);
|
|
42653
|
-
}
|
|
42654
|
-
async provideResource(event) {
|
|
42655
|
-
event.stopPropagation();
|
|
42656
|
-
if (this.resource) {
|
|
42657
|
-
event.detail(this.resource);
|
|
42658
|
-
}
|
|
42659
|
-
this.consumers.push(event);
|
|
42660
|
-
}
|
|
42661
|
-
async loadResource() {
|
|
42662
|
-
await this.getResource(!this.lazy);
|
|
42663
|
-
}
|
|
42664
|
-
async fetch() {
|
|
42665
|
-
await this.getResource(true);
|
|
42666
|
-
}
|
|
42667
|
-
async getResource(fetch = false) {
|
|
42668
|
-
try {
|
|
42669
|
-
if (fetch) {
|
|
42670
|
-
this.loading = true;
|
|
42671
|
-
await this.os.fetch(this.uri);
|
|
42672
|
-
}
|
|
42673
|
-
this.resource = this.os.store.get(this.uri);
|
|
42674
|
-
this.error = null;
|
|
42675
|
-
this.consumers.forEach(consumer => {
|
|
42676
|
-
consumer.detail(this.resource);
|
|
42677
|
-
});
|
|
42678
|
-
}
|
|
42679
|
-
catch (err) {
|
|
42680
|
-
this.error = err;
|
|
42681
|
-
}
|
|
42682
|
-
finally {
|
|
42683
|
-
this.loading = false;
|
|
42684
|
-
}
|
|
42685
|
-
}
|
|
42686
|
-
render() {
|
|
42687
|
-
if (this.loading) {
|
|
42688
|
-
return h("ion-progress-bar", { type: "indeterminate" });
|
|
42689
|
-
}
|
|
42690
|
-
if (this.error) {
|
|
42691
|
-
return (h("ion-card", null, h("ion-card-header", null, h("p", null, "Sorry, something went wrong"), h("p", null, "Status:",
|
|
42692
|
-
// @ts-ignore
|
|
42693
|
-
this.error.status), h("details", null, this.error.message)), h("ion-card-content", null, h("p", null, "You can try to open the link outside PodOS:"), h("a", { href: this.uri }, this.uri))));
|
|
42694
|
-
}
|
|
42695
|
-
return h("slot", null);
|
|
42696
|
-
}
|
|
42697
|
-
static get watchers() { return {
|
|
42698
|
-
"os": ["loadResource"],
|
|
42699
|
-
"uri": ["loadResource"]
|
|
42700
|
-
}; }
|
|
42701
|
-
};
|
|
42702
|
-
|
|
42703
|
-
const PosReverseRelations = class {
|
|
42704
|
-
constructor(hostRef) {
|
|
42705
|
-
registerInstance(this, hostRef);
|
|
42706
|
-
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
42707
|
-
this.receiveResource = (resource) => {
|
|
42708
|
-
this.data = resource.reverseRelations();
|
|
42709
|
-
};
|
|
42710
|
-
this.data = [];
|
|
42711
|
-
}
|
|
42712
|
-
componentWillLoad() {
|
|
42713
|
-
subscribeResource(this);
|
|
42714
|
-
}
|
|
42715
|
-
render() {
|
|
42716
|
-
const items = this.data.map(it => (h("ion-item-group", null, h("ion-item-divider", null, h("ion-label", null, "is ", it.predicate, " of")), it.uris.map(uri => (h("pos-rich-link", { uri: uri }))))));
|
|
42717
|
-
return this.data.length > 0 ? h("ion-list", null, items) : null;
|
|
42718
|
-
}
|
|
42719
|
-
};
|
|
42720
|
-
|
|
42721
|
-
const PosRichLink = class {
|
|
42722
|
-
constructor(hostRef) {
|
|
42723
|
-
registerInstance(this, hostRef);
|
|
42724
|
-
this.linkEmitter = createEvent(this, "pod-os:link", 7);
|
|
42725
|
-
this.uri = undefined;
|
|
42726
|
-
}
|
|
42727
|
-
render() {
|
|
42728
|
-
return (h("pos-resource", { lazy: true, uri: this.uri }, h("ion-item", { href: this.uri, onClick: e => {
|
|
42729
|
-
e.preventDefault();
|
|
42730
|
-
this.linkEmitter.emit(this.uri);
|
|
42731
|
-
} }, h("ion-label", null, h("pos-label", null), h("p", null, h("ion-label", { style: { maxWidth: '50rem' } }, h("pos-description", null))), h("p", null, h("a", { href: this.uri }, this.uri))))));
|
|
42732
|
-
}
|
|
42733
|
-
};
|
|
42734
|
-
|
|
42735
|
-
const appendToMap = (map, propName, value) => {
|
|
42736
|
-
const items = map.get(propName);
|
|
42737
|
-
if (!items) {
|
|
42738
|
-
map.set(propName, [value]);
|
|
42739
|
-
}
|
|
42740
|
-
else if (!items.includes(value)) {
|
|
42741
|
-
items.push(value);
|
|
42742
|
-
}
|
|
42743
|
-
};
|
|
42744
|
-
const debounce = (fn, ms) => {
|
|
42745
|
-
let timeoutId;
|
|
42746
|
-
return (...args) => {
|
|
42747
|
-
if (timeoutId) {
|
|
42748
|
-
clearTimeout(timeoutId);
|
|
42749
|
-
}
|
|
42750
|
-
timeoutId = setTimeout(() => {
|
|
42751
|
-
timeoutId = 0;
|
|
42752
|
-
fn(...args);
|
|
42753
|
-
}, ms);
|
|
42754
|
-
};
|
|
42755
|
-
};
|
|
42756
|
-
|
|
42757
|
-
/**
|
|
42758
|
-
* Check if a possible element isConnected.
|
|
42759
|
-
* The property might not be there, so we check for it.
|
|
42760
|
-
*
|
|
42761
|
-
* We want it to return true if isConnected is not a property,
|
|
42762
|
-
* otherwise we would remove these elements and would not update.
|
|
42763
|
-
*
|
|
42764
|
-
* Better leak in Edge than to be useless.
|
|
42765
|
-
*/
|
|
42766
|
-
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
42767
|
-
const cleanupElements = debounce((map) => {
|
|
42768
|
-
for (let key of map.keys()) {
|
|
42769
|
-
map.set(key, map.get(key).filter(isConnected));
|
|
42770
|
-
}
|
|
42771
|
-
}, 2000);
|
|
42772
|
-
const stencilSubscription = () => {
|
|
42773
|
-
if (typeof getRenderingRef !== 'function') {
|
|
42774
|
-
// If we are not in a stencil project, we do nothing.
|
|
42775
|
-
// This function is not really exported by @stencil/core.
|
|
42776
|
-
return {};
|
|
42777
|
-
}
|
|
42778
|
-
const elmsToUpdate = new Map();
|
|
42779
|
-
return {
|
|
42780
|
-
dispose: () => elmsToUpdate.clear(),
|
|
42781
|
-
get: (propName) => {
|
|
42782
|
-
const elm = getRenderingRef();
|
|
42783
|
-
if (elm) {
|
|
42784
|
-
appendToMap(elmsToUpdate, propName, elm);
|
|
42785
|
-
}
|
|
42786
|
-
},
|
|
42787
|
-
set: (propName) => {
|
|
42788
|
-
const elements = elmsToUpdate.get(propName);
|
|
42789
|
-
if (elements) {
|
|
42790
|
-
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
42791
|
-
}
|
|
42792
|
-
cleanupElements(elmsToUpdate);
|
|
42793
|
-
},
|
|
42794
|
-
reset: () => {
|
|
42795
|
-
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
42796
|
-
cleanupElements(elmsToUpdate);
|
|
42797
|
-
},
|
|
42798
|
-
};
|
|
42799
|
-
};
|
|
42800
|
-
|
|
42801
|
-
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
42802
|
-
let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
42803
|
-
const handlers = {
|
|
42804
|
-
dispose: [],
|
|
42805
|
-
get: [],
|
|
42806
|
-
set: [],
|
|
42807
|
-
reset: [],
|
|
42808
|
-
};
|
|
42809
|
-
const reset = () => {
|
|
42810
|
-
states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
42811
|
-
handlers.reset.forEach((cb) => cb());
|
|
42812
|
-
};
|
|
42813
|
-
const dispose = () => {
|
|
42814
|
-
// Call first dispose as resetting the state would
|
|
42815
|
-
// cause less updates ;)
|
|
42816
|
-
handlers.dispose.forEach((cb) => cb());
|
|
42817
|
-
reset();
|
|
42818
|
-
};
|
|
42819
|
-
const get = (propName) => {
|
|
42820
|
-
handlers.get.forEach((cb) => cb(propName));
|
|
42821
|
-
return states.get(propName);
|
|
42822
|
-
};
|
|
42823
|
-
const set = (propName, value) => {
|
|
42824
|
-
const oldValue = states.get(propName);
|
|
42825
|
-
if (shouldUpdate(value, oldValue, propName)) {
|
|
42826
|
-
states.set(propName, value);
|
|
42827
|
-
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
42828
|
-
}
|
|
42829
|
-
};
|
|
42830
|
-
const state = (typeof Proxy === 'undefined'
|
|
42831
|
-
? {}
|
|
42832
|
-
: new Proxy(defaultState, {
|
|
42833
|
-
get(_, propName) {
|
|
42834
|
-
return get(propName);
|
|
42835
|
-
},
|
|
42836
|
-
ownKeys(_) {
|
|
42837
|
-
return Array.from(states.keys());
|
|
42838
|
-
},
|
|
42839
|
-
getOwnPropertyDescriptor() {
|
|
42840
|
-
return {
|
|
42841
|
-
enumerable: true,
|
|
42842
|
-
configurable: true,
|
|
42843
|
-
};
|
|
42844
|
-
},
|
|
42845
|
-
has(_, propName) {
|
|
42846
|
-
return states.has(propName);
|
|
42847
|
-
},
|
|
42848
|
-
set(_, propName, value) {
|
|
42849
|
-
set(propName, value);
|
|
42850
|
-
return true;
|
|
42851
|
-
},
|
|
42852
|
-
}));
|
|
42853
|
-
const on = (eventName, callback) => {
|
|
42854
|
-
handlers[eventName].push(callback);
|
|
42855
|
-
return () => {
|
|
42856
|
-
removeFromArray(handlers[eventName], callback);
|
|
42857
|
-
};
|
|
42858
|
-
};
|
|
42859
|
-
const onChange = (propName, cb) => {
|
|
42860
|
-
const unSet = on('set', (key, newValue) => {
|
|
42861
|
-
if (key === propName) {
|
|
42862
|
-
cb(newValue);
|
|
42863
|
-
}
|
|
42864
|
-
});
|
|
42865
|
-
const unReset = on('reset', () => cb(defaultState[propName]));
|
|
42866
|
-
return () => {
|
|
42867
|
-
unSet();
|
|
42868
|
-
unReset();
|
|
42869
|
-
};
|
|
42870
|
-
};
|
|
42871
|
-
const use = (...subscriptions) => {
|
|
42872
|
-
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
42873
|
-
if (subscription.set) {
|
|
42874
|
-
unsubs.push(on('set', subscription.set));
|
|
42875
|
-
}
|
|
42876
|
-
if (subscription.get) {
|
|
42877
|
-
unsubs.push(on('get', subscription.get));
|
|
42878
|
-
}
|
|
42879
|
-
if (subscription.reset) {
|
|
42880
|
-
unsubs.push(on('reset', subscription.reset));
|
|
42881
|
-
}
|
|
42882
|
-
if (subscription.dispose) {
|
|
42883
|
-
unsubs.push(on('dispose', subscription.dispose));
|
|
42884
|
-
}
|
|
42885
|
-
return unsubs;
|
|
42886
|
-
}, []);
|
|
42887
|
-
return () => unsubs.forEach((unsub) => unsub());
|
|
42888
|
-
};
|
|
42889
|
-
const forceUpdate = (key) => {
|
|
42890
|
-
const oldValue = states.get(key);
|
|
42891
|
-
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
42892
|
-
};
|
|
42893
|
-
return {
|
|
42894
|
-
state,
|
|
42895
|
-
get,
|
|
42896
|
-
set,
|
|
42897
|
-
on,
|
|
42898
|
-
onChange,
|
|
42899
|
-
use,
|
|
42900
|
-
dispose,
|
|
42901
|
-
reset,
|
|
42902
|
-
forceUpdate,
|
|
42903
|
-
};
|
|
42904
|
-
};
|
|
42905
|
-
const removeFromArray = (array, item) => {
|
|
42906
|
-
const index = array.indexOf(item);
|
|
42907
|
-
if (index >= 0) {
|
|
42908
|
-
array[index] = array[array.length - 1];
|
|
42909
|
-
array.length--;
|
|
42910
|
-
}
|
|
42911
|
-
};
|
|
42912
|
-
|
|
42913
|
-
const createStore = (defaultState, shouldUpdate) => {
|
|
42914
|
-
const map = createObservableMap(defaultState, shouldUpdate);
|
|
42915
|
-
map.use(stencilSubscription());
|
|
42916
|
-
return map;
|
|
42917
|
-
};
|
|
42918
|
-
|
|
42919
|
-
const createRouter = (opts) => {
|
|
42920
|
-
var _a;
|
|
42921
|
-
const win = window;
|
|
42922
|
-
const url = new URL(win.location.href);
|
|
42923
|
-
const parseURL = (_a = opts === null || opts === void 0 ? void 0 : opts.parseURL) !== null && _a !== void 0 ? _a : DEFAULT_PARSE_URL;
|
|
42924
|
-
const { state, onChange, dispose } = createStore({
|
|
42925
|
-
url,
|
|
42926
|
-
activePath: parseURL(url)
|
|
42927
|
-
}, (newV, oldV, prop) => {
|
|
42928
|
-
if (prop === 'url') {
|
|
42929
|
-
return newV.href !== oldV.href;
|
|
42930
|
-
}
|
|
42931
|
-
return newV !== oldV;
|
|
42932
|
-
});
|
|
42933
|
-
const push = (href) => {
|
|
42934
|
-
history.pushState(null, null, href);
|
|
42935
|
-
const url = new URL(href, document.baseURI);
|
|
42936
|
-
state.url = url;
|
|
42937
|
-
state.activePath = parseURL(url);
|
|
42938
|
-
};
|
|
42939
|
-
const match = (routes) => {
|
|
42940
|
-
const { activePath } = state;
|
|
42941
|
-
for (let route of routes) {
|
|
42942
|
-
const params = matchPath(activePath, route.path);
|
|
42943
|
-
if (params) {
|
|
42944
|
-
if (route.to != null) {
|
|
42945
|
-
const to = (typeof route.to === 'string')
|
|
42946
|
-
? route.to
|
|
42947
|
-
: route.to(activePath);
|
|
42948
|
-
push(to);
|
|
42949
|
-
return match(routes);
|
|
42950
|
-
}
|
|
42951
|
-
else {
|
|
42952
|
-
return { params, route };
|
|
42953
|
-
}
|
|
42954
|
-
}
|
|
42955
|
-
}
|
|
42956
|
-
return undefined;
|
|
42957
|
-
};
|
|
42958
|
-
const navigationChanged = () => {
|
|
42959
|
-
const url = new URL(win.location.href);
|
|
42960
|
-
state.url = url;
|
|
42961
|
-
state.activePath = parseURL(url);
|
|
42962
|
-
};
|
|
42963
|
-
const Switch = (_, childrenRoutes) => {
|
|
42964
|
-
const result = match(childrenRoutes);
|
|
42965
|
-
if (result) {
|
|
42966
|
-
if (typeof result.route.jsx === 'function') {
|
|
42967
|
-
return result.route.jsx(result.params);
|
|
42968
|
-
}
|
|
42969
|
-
else {
|
|
42970
|
-
return result.route.jsx;
|
|
42971
|
-
}
|
|
42972
|
-
}
|
|
42973
|
-
};
|
|
42974
|
-
const disposeRouter = () => {
|
|
42975
|
-
win.removeEventListener('popstate', navigationChanged);
|
|
42976
|
-
dispose();
|
|
42977
|
-
};
|
|
42978
|
-
const router = {
|
|
42979
|
-
Switch,
|
|
42980
|
-
get url() {
|
|
42981
|
-
return state.url;
|
|
42982
|
-
},
|
|
42983
|
-
get activePath() {
|
|
42984
|
-
return state.activePath;
|
|
42985
|
-
},
|
|
42986
|
-
push,
|
|
42987
|
-
onChange: onChange,
|
|
42988
|
-
dispose: disposeRouter,
|
|
42989
|
-
};
|
|
42990
|
-
// Initial update
|
|
42991
|
-
navigationChanged();
|
|
42992
|
-
// Listen URL changes
|
|
42993
|
-
win.addEventListener('popstate', navigationChanged);
|
|
42994
|
-
return router;
|
|
42995
|
-
};
|
|
42996
|
-
const Route = (props, children) => {
|
|
42997
|
-
var _a;
|
|
42998
|
-
if ('to' in props) {
|
|
42999
|
-
return {
|
|
43000
|
-
path: props.path,
|
|
43001
|
-
to: props.to,
|
|
43002
|
-
};
|
|
43003
|
-
}
|
|
43004
|
-
return {
|
|
43005
|
-
path: props.path,
|
|
43006
|
-
id: props.id,
|
|
43007
|
-
jsx: (_a = props.render) !== null && _a !== void 0 ? _a : children,
|
|
43008
|
-
};
|
|
43009
|
-
};
|
|
43010
|
-
const matchPath = (pathname, path) => {
|
|
43011
|
-
if (typeof path === 'string') {
|
|
43012
|
-
if (path === pathname) {
|
|
43013
|
-
return {};
|
|
43014
|
-
}
|
|
43015
|
-
}
|
|
43016
|
-
else if (typeof path === 'function') {
|
|
43017
|
-
const params = path(pathname);
|
|
43018
|
-
if (params) {
|
|
43019
|
-
return params === true
|
|
43020
|
-
? {}
|
|
43021
|
-
: { ...params };
|
|
43022
|
-
}
|
|
43023
|
-
}
|
|
43024
|
-
else {
|
|
43025
|
-
const results = path.exec(pathname);
|
|
43026
|
-
if (results) {
|
|
43027
|
-
path.lastIndex = 0;
|
|
43028
|
-
return { ...results };
|
|
43029
|
-
}
|
|
43030
|
-
}
|
|
43031
|
-
return undefined;
|
|
43032
|
-
};
|
|
43033
|
-
const DEFAULT_PARSE_URL = (url) => {
|
|
43034
|
-
return url.pathname.toLowerCase();
|
|
43035
|
-
};
|
|
43036
|
-
|
|
43037
|
-
/**
|
|
43038
|
-
* TS adaption of https://github.com/pillarjs/path-to-regexp/blob/master/index.js
|
|
43039
|
-
*/
|
|
43040
|
-
/**
|
|
43041
|
-
* Default configs.
|
|
43042
|
-
*/
|
|
43043
|
-
const DEFAULT_DELIMITER = '/';
|
|
43044
|
-
const DEFAULT_DELIMITERS = './';
|
|
43045
|
-
/**
|
|
43046
|
-
* The main path matching regexp utility.
|
|
43047
|
-
*/
|
|
43048
|
-
const PATH_REGEXP = new RegExp([
|
|
43049
|
-
// Match escaped characters that would otherwise appear in future matches.
|
|
43050
|
-
// This allows the user to escape special characters that won't transform.
|
|
43051
|
-
'(\\\\.)',
|
|
43052
|
-
// Match Express-style parameters and un-named parameters with a prefix
|
|
43053
|
-
// and optional suffixes. Matches appear as:
|
|
43054
|
-
//
|
|
43055
|
-
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?"]
|
|
43056
|
-
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined]
|
|
43057
|
-
'(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'
|
|
43058
|
-
].join('|'), 'g');
|
|
43059
|
-
/**
|
|
43060
|
-
* Parse a string for the raw tokens.
|
|
43061
|
-
*/
|
|
43062
|
-
const parse = (str, options) => {
|
|
43063
|
-
var tokens = [];
|
|
43064
|
-
var key = 0;
|
|
43065
|
-
var index = 0;
|
|
43066
|
-
var path = '';
|
|
43067
|
-
var defaultDelimiter = (options && options.delimiter) || DEFAULT_DELIMITER;
|
|
43068
|
-
var delimiters = (options && options.delimiters) || DEFAULT_DELIMITERS;
|
|
43069
|
-
var pathEscaped = false;
|
|
43070
|
-
var res;
|
|
43071
|
-
while ((res = PATH_REGEXP.exec(str)) !== null) {
|
|
43072
|
-
var m = res[0];
|
|
43073
|
-
var escaped = res[1];
|
|
43074
|
-
var offset = res.index;
|
|
43075
|
-
path += str.slice(index, offset);
|
|
43076
|
-
index = offset + m.length;
|
|
43077
|
-
// Ignore already escaped sequences.
|
|
43078
|
-
if (escaped) {
|
|
43079
|
-
path += escaped[1];
|
|
43080
|
-
pathEscaped = true;
|
|
43081
|
-
continue;
|
|
43082
|
-
}
|
|
43083
|
-
var prev = '';
|
|
43084
|
-
var next = str[index];
|
|
43085
|
-
var name = res[2];
|
|
43086
|
-
var capture = res[3];
|
|
43087
|
-
var group = res[4];
|
|
43088
|
-
var modifier = res[5];
|
|
43089
|
-
if (!pathEscaped && path.length) {
|
|
43090
|
-
var k = path.length - 1;
|
|
43091
|
-
if (delimiters.indexOf(path[k]) > -1) {
|
|
43092
|
-
prev = path[k];
|
|
43093
|
-
path = path.slice(0, k);
|
|
43094
|
-
}
|
|
43095
|
-
}
|
|
43096
|
-
// Push the current path onto the tokens.
|
|
43097
|
-
if (path) {
|
|
43098
|
-
tokens.push(path);
|
|
43099
|
-
path = '';
|
|
43100
|
-
pathEscaped = false;
|
|
43101
|
-
}
|
|
43102
|
-
var partial = prev !== '' && next !== undefined && next !== prev;
|
|
43103
|
-
var repeat = modifier === '+' || modifier === '*';
|
|
43104
|
-
var optional = modifier === '?' || modifier === '*';
|
|
43105
|
-
var delimiter = prev || defaultDelimiter;
|
|
43106
|
-
var pattern = capture || group;
|
|
43107
|
-
tokens.push({
|
|
43108
|
-
name: name || key++,
|
|
43109
|
-
prefix: prev,
|
|
43110
|
-
delimiter: delimiter,
|
|
43111
|
-
optional: optional,
|
|
43112
|
-
repeat: repeat,
|
|
43113
|
-
partial: partial,
|
|
43114
|
-
pattern: pattern ? escapeGroup(pattern) : '[^' + escapeString(delimiter) + ']+?'
|
|
43115
|
-
});
|
|
43116
|
-
}
|
|
43117
|
-
// Push any remaining characters.
|
|
43118
|
-
if (path || index < str.length) {
|
|
43119
|
-
tokens.push(path + str.substr(index));
|
|
43120
|
-
}
|
|
43121
|
-
return tokens;
|
|
43122
|
-
};
|
|
43123
|
-
/**
|
|
43124
|
-
* Escape a regular expression string.
|
|
43125
|
-
*/
|
|
43126
|
-
const escapeString = (str) => {
|
|
43127
|
-
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1');
|
|
43128
|
-
};
|
|
43129
|
-
/**
|
|
43130
|
-
* Escape the capturing group by escaping special characters and meaning.
|
|
43131
|
-
*/
|
|
43132
|
-
const escapeGroup = (group) => {
|
|
43133
|
-
return group.replace(/([=!:$/()])/g, '\\$1');
|
|
43134
|
-
};
|
|
43135
|
-
/**
|
|
43136
|
-
* Get the flags for a regexp from the options.
|
|
43137
|
-
*/
|
|
43138
|
-
const flags = (options) => {
|
|
43139
|
-
return options && options.sensitive ? '' : 'i';
|
|
43140
|
-
};
|
|
43141
|
-
/**
|
|
43142
|
-
* Pull out keys from a regexp.
|
|
43143
|
-
*/
|
|
43144
|
-
const regexpToRegexp = (path, keys) => {
|
|
43145
|
-
if (!keys)
|
|
43146
|
-
return path;
|
|
43147
|
-
// Use a negative lookahead to match only capturing groups.
|
|
43148
|
-
var groups = path.source.match(/\((?!\?)/g);
|
|
43149
|
-
if (groups) {
|
|
43150
|
-
for (var i = 0; i < groups.length; i++) {
|
|
43151
|
-
keys.push({
|
|
43152
|
-
name: i,
|
|
43153
|
-
prefix: null,
|
|
43154
|
-
delimiter: null,
|
|
43155
|
-
optional: false,
|
|
43156
|
-
repeat: false,
|
|
43157
|
-
partial: false,
|
|
43158
|
-
pattern: null
|
|
43159
|
-
});
|
|
43160
|
-
}
|
|
43161
|
-
}
|
|
43162
|
-
return path;
|
|
43163
|
-
};
|
|
43164
|
-
/**
|
|
43165
|
-
* Transform an array into a regexp.
|
|
43166
|
-
*/
|
|
43167
|
-
const arrayToRegexp = (path, keys, options) => {
|
|
43168
|
-
var parts = [];
|
|
43169
|
-
for (var i = 0; i < path.length; i++) {
|
|
43170
|
-
parts.push(pathToRegexp(path[i], keys, options).source);
|
|
43171
|
-
}
|
|
43172
|
-
return new RegExp('(?:' + parts.join('|') + ')', flags(options));
|
|
43173
|
-
};
|
|
43174
|
-
/**
|
|
43175
|
-
* Create a path regexp from string input.
|
|
43176
|
-
*/
|
|
43177
|
-
const stringToRegexp = (path, keys, options) => {
|
|
43178
|
-
return tokensToRegExp(parse(path, options), keys, options);
|
|
43179
|
-
};
|
|
43180
|
-
/**
|
|
43181
|
-
* Expose a function for taking tokens and returning a RegExp.
|
|
43182
|
-
*/
|
|
43183
|
-
const tokensToRegExp = (tokens, keys, options) => {
|
|
43184
|
-
options = options || {};
|
|
43185
|
-
var strict = options.strict;
|
|
43186
|
-
var end = options.end !== false;
|
|
43187
|
-
var delimiter = escapeString(options.delimiter || DEFAULT_DELIMITER);
|
|
43188
|
-
var delimiters = options.delimiters || DEFAULT_DELIMITERS;
|
|
43189
|
-
var endsWith = [].concat(options.endsWith || []).map(escapeString).concat('$').join('|');
|
|
43190
|
-
var route = '';
|
|
43191
|
-
var isEndDelimited = false;
|
|
43192
|
-
// Iterate over the tokens and create our regexp string.
|
|
43193
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
43194
|
-
var token = tokens[i];
|
|
43195
|
-
if (typeof token === 'string') {
|
|
43196
|
-
route += escapeString(token);
|
|
43197
|
-
isEndDelimited = i === tokens.length - 1 && delimiters.indexOf(token[token.length - 1]) > -1;
|
|
43198
|
-
}
|
|
43199
|
-
else {
|
|
43200
|
-
var prefix = escapeString(token.prefix || '');
|
|
43201
|
-
var capture = token.repeat
|
|
43202
|
-
? '(?:' + token.pattern + ')(?:' + prefix + '(?:' + token.pattern + '))*'
|
|
43203
|
-
: token.pattern;
|
|
43204
|
-
if (keys)
|
|
43205
|
-
keys.push(token);
|
|
43206
|
-
if (token.optional) {
|
|
43207
|
-
if (token.partial) {
|
|
43208
|
-
route += prefix + '(' + capture + ')?';
|
|
43209
|
-
}
|
|
43210
|
-
else {
|
|
43211
|
-
route += '(?:' + prefix + '(' + capture + '))?';
|
|
43212
|
-
}
|
|
43213
|
-
}
|
|
43214
|
-
else {
|
|
43215
|
-
route += prefix + '(' + capture + ')';
|
|
43216
|
-
}
|
|
43217
|
-
}
|
|
43218
|
-
}
|
|
43219
|
-
if (end) {
|
|
43220
|
-
if (!strict)
|
|
43221
|
-
route += '(?:' + delimiter + ')?';
|
|
43222
|
-
route += endsWith === '$' ? '$' : '(?=' + endsWith + ')';
|
|
43223
|
-
}
|
|
43224
|
-
else {
|
|
43225
|
-
if (!strict)
|
|
43226
|
-
route += '(?:' + delimiter + '(?=' + endsWith + '))?';
|
|
43227
|
-
if (!isEndDelimited)
|
|
43228
|
-
route += '(?=' + delimiter + '|' + endsWith + ')';
|
|
43229
|
-
}
|
|
43230
|
-
return new RegExp('^' + route, flags(options));
|
|
43231
|
-
};
|
|
43232
|
-
/**
|
|
43233
|
-
* Normalize the given path string, returning a regular expression.
|
|
43234
|
-
*
|
|
43235
|
-
* An empty array can be passed in for the keys, which will hold the
|
|
43236
|
-
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
|
|
43237
|
-
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
|
|
43238
|
-
*/
|
|
43239
|
-
const pathToRegexp = (path, keys, options) => {
|
|
43240
|
-
if (path instanceof RegExp) {
|
|
43241
|
-
return regexpToRegexp(path, keys);
|
|
43242
|
-
}
|
|
43243
|
-
if (Array.isArray(path)) {
|
|
43244
|
-
return arrayToRegexp(path, keys, options);
|
|
43245
|
-
}
|
|
43246
|
-
return stringToRegexp(path, keys, options);
|
|
43247
|
-
};
|
|
43248
|
-
|
|
43249
|
-
let cacheCount = 0;
|
|
43250
|
-
const patternCache = {};
|
|
43251
|
-
const cacheLimit = 10000;
|
|
43252
|
-
// Memoized function for creating the path match regex
|
|
43253
|
-
const compilePath = (pattern, options) => {
|
|
43254
|
-
const cacheKey = `${options.end}${options.strict}`;
|
|
43255
|
-
const cache = patternCache[cacheKey] || (patternCache[cacheKey] = {});
|
|
43256
|
-
const cachePattern = JSON.stringify(pattern);
|
|
43257
|
-
if (cache[cachePattern]) {
|
|
43258
|
-
return cache[cachePattern];
|
|
43259
|
-
}
|
|
43260
|
-
const keys = [];
|
|
43261
|
-
const re = pathToRegexp(pattern, keys, options);
|
|
43262
|
-
const compiledPattern = { re, keys };
|
|
43263
|
-
if (cacheCount < cacheLimit) {
|
|
43264
|
-
cache[cachePattern] = compiledPattern;
|
|
43265
|
-
cacheCount += 1;
|
|
43266
|
-
}
|
|
43267
|
-
return compiledPattern;
|
|
43268
|
-
};
|
|
43269
|
-
const match = (pathname, options = {}) => {
|
|
43270
|
-
const { exact = false, strict = false } = options;
|
|
43271
|
-
const { re, keys } = compilePath(pathname, { end: exact, strict });
|
|
43272
|
-
return (path) => {
|
|
43273
|
-
const match = re.exec(path);
|
|
43274
|
-
if (!match) {
|
|
43275
|
-
return undefined;
|
|
43276
|
-
}
|
|
43277
|
-
const [url, ...values] = match;
|
|
43278
|
-
const isExact = path === url;
|
|
43279
|
-
if (exact && !isExact) {
|
|
43280
|
-
return undefined;
|
|
43281
|
-
}
|
|
43282
|
-
return keys.reduce((memo, key, index) => {
|
|
43283
|
-
memo[key.name] = values[index];
|
|
43284
|
-
return memo;
|
|
43285
|
-
}, {});
|
|
43286
|
-
};
|
|
43287
|
-
};
|
|
43288
|
-
|
|
43289
|
-
const Router = createRouter();
|
|
43290
|
-
const PosRouter = class {
|
|
43291
|
-
constructor(hostRef) {
|
|
43292
|
-
registerInstance(this, hostRef);
|
|
43293
|
-
this.uri = undefined;
|
|
43294
|
-
}
|
|
43295
|
-
linkClicked(e) {
|
|
43296
|
-
this.navigate(e.detail);
|
|
43297
|
-
}
|
|
43298
|
-
componentWillLoad() {
|
|
43299
|
-
this.updateUri();
|
|
43300
|
-
Router.onChange('url', () => {
|
|
43301
|
-
this.updateUri();
|
|
43302
|
-
});
|
|
43303
|
-
}
|
|
43304
|
-
navigate(uri) {
|
|
43305
|
-
Router.push('?uri=' + encodeURIComponent(uri));
|
|
43306
|
-
}
|
|
43307
|
-
updateUri() {
|
|
43308
|
-
this.uri = new URLSearchParams(window.location.search).get('uri') || window.location.href;
|
|
43309
|
-
}
|
|
43310
|
-
render() {
|
|
43311
|
-
console.log('render router', this.uri);
|
|
43312
|
-
return (h(Router.Switch, null, h(Route, { path: match('', { exact: false }) }, h("pos-navigation-bar", { uri: this.uri }), h("pos-resource", { key: this.uri, uri: this.uri }, h("pos-type-router", null)))));
|
|
43313
|
-
}
|
|
43314
|
-
};
|
|
43315
|
-
|
|
43316
|
-
const PosSubjects = class {
|
|
43317
|
-
constructor(hostRef) {
|
|
43318
|
-
registerInstance(this, hostRef);
|
|
43319
|
-
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
43320
|
-
this.receiveResource = (resource) => {
|
|
43321
|
-
const doc = resource.assume(RdfDocument);
|
|
43322
|
-
this.data = doc.subjects();
|
|
43323
|
-
};
|
|
43324
|
-
this.data = [];
|
|
43325
|
-
}
|
|
43326
|
-
componentWillLoad() {
|
|
43327
|
-
subscribeResource(this);
|
|
43328
|
-
}
|
|
43329
|
-
render() {
|
|
43330
|
-
const items = this.data.map(it => h("pos-rich-link", { uri: it.uri }));
|
|
43331
|
-
return this.data.length > 0 ? h("ion-list", null, items) : null;
|
|
43332
|
-
}
|
|
43333
|
-
};
|
|
43334
|
-
|
|
43335
|
-
const posTypeBadgesCss = ".types{display:flex;gap:0.25rem;margin:0.5rem 0}.expanded{flex-direction:column;justify-content:flex-start;align-items:flex-start}ion-badge{color:#333;background:#eee}ion-badge.toggle{cursor:pointer}ion-badge.toggle:hover{background:#ddd}";
|
|
43336
|
-
|
|
43337
|
-
const PosTypeBadges = class {
|
|
43338
|
-
constructor(hostRef) {
|
|
43339
|
-
registerInstance(this, hostRef);
|
|
43340
|
-
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
43341
|
-
this.receiveResource = (resource) => {
|
|
43342
|
-
this.data = resource.types();
|
|
43343
|
-
this.typeLabels = [...new Set(resource.types().map(it => it.label))];
|
|
43344
|
-
};
|
|
43345
|
-
this.data = [];
|
|
43346
|
-
this.typeLabels = [];
|
|
43347
|
-
this.isExpanded = false;
|
|
43348
|
-
}
|
|
43349
|
-
componentWillLoad() {
|
|
43350
|
-
subscribeResource(this);
|
|
43351
|
-
}
|
|
43352
|
-
toggleDetails() {
|
|
43353
|
-
this.isExpanded = !this.isExpanded;
|
|
43354
|
-
}
|
|
43355
|
-
render() {
|
|
43356
|
-
if (this.data.length == 0) {
|
|
43357
|
-
return null;
|
|
43358
|
-
}
|
|
43359
|
-
if (this.isExpanded) {
|
|
43360
|
-
return (h("div", { class: "types expanded" }, h("ion-badge", { class: "toggle", onClick: () => this.toggleDetails() }, h("ion-icon", { name: "contract-outline" })), this.data.map(it => (h("ion-badge", null, it.uri)))));
|
|
43361
|
-
}
|
|
43362
|
-
else {
|
|
43363
|
-
return (h(Host, null, h("div", { class: "types" }, this.typeLabels.map(it => (h("ion-badge", null, it))), h("ion-badge", { class: "toggle", onClick: () => this.toggleDetails() }, h("ion-icon", { name: "expand-outline" })))));
|
|
43364
|
-
}
|
|
43365
|
-
}
|
|
43366
|
-
};
|
|
43367
|
-
PosTypeBadges.style = posTypeBadgesCss;
|
|
43368
|
-
|
|
43369
|
-
const PosTypeRouter = class {
|
|
43370
|
-
constructor(hostRef) {
|
|
43371
|
-
registerInstance(this, hostRef);
|
|
43372
|
-
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
43373
|
-
this.receiveResource = (resource) => {
|
|
43374
|
-
this.types = resource.types();
|
|
43375
|
-
};
|
|
43376
|
-
this.types = undefined;
|
|
43377
|
-
}
|
|
43378
|
-
componentWillLoad() {
|
|
43379
|
-
subscribeResource(this);
|
|
43380
|
-
}
|
|
43381
|
-
render() {
|
|
43382
|
-
return this.types ? this.renderApp() : null;
|
|
43383
|
-
}
|
|
43384
|
-
renderApp() {
|
|
43385
|
-
if (this.types.some(type => type.uri === 'http://www.w3.org/2007/ont/link#RDFDocument')) {
|
|
43386
|
-
return h("pos-app-rdf-document", null);
|
|
43387
|
-
}
|
|
43388
|
-
else if (this.types.some(type => type.uri === 'http://www.w3.org/ns/iana/media-types/application/pdf#Resource')) {
|
|
43389
|
-
return h("pos-app-pdf-viewer", null);
|
|
43390
|
-
}
|
|
43391
|
-
else if (this.types.some(type => type.uri === 'http://purl.org/dc/terms/Image')) {
|
|
43392
|
-
return h("pos-app-image-viewer", null);
|
|
43393
|
-
}
|
|
43394
|
-
else {
|
|
43395
|
-
return h("pos-app-generic", null);
|
|
43396
|
-
}
|
|
43397
|
-
}
|
|
43398
|
-
};
|
|
43399
|
-
|
|
43400
|
-
export { App as ion_app, Badge as ion_badge, Button as ion_button, Card as ion_card, CardContent as ion_card_content, CardHeader as ion_card_header, CardTitle as ion_card_title, Col as ion_col, Content as ion_content, Footer as ion_footer, Grid as ion_grid, Header as ion_header, Icon as ion_icon, Item as ion_item, ItemDivider as ion_item_divider, ItemGroup as ion_item_group, Label as ion_label, List as ion_list, Note as ion_note, ProgressBar as ion_progress_bar, RippleEffect as ion_ripple_effect, Row as ion_row, Searchbar as ion_searchbar, SkeletonText as ion_skeleton_text, ToolbarTitle as ion_title, Toolbar as ion_toolbar, PosApp as pos_app, PosAppBrowser as pos_app_browser, PosAppGeneric as pos_app_generic, PosAppImageViewer as pos_app_image_viewer, PosAppPdfViewer as pos_app_pdf_viewer, PosAppRdfDocument as pos_app_rdf_document, PosDescription as pos_description, PosImage as pos_image, PosLabel as pos_label, PosLiterals as pos_literals, PosLogin as pos_login, PosNavigationBar as pos_navigation_bar, PosPdf as pos_pdf, PosPicture as pos_picture, PosRelations as pos_relations, PosResource as pos_resource, PosReverseRelations as pos_reverse_relations, PosRichLink as pos_rich_link, PosRouter as pos_router, PosSubjects as pos_subjects, PosTypeBadges as pos_type_badges, PosTypeRouter as pos_type_router };
|
|
39285
|
+
exports.PodOS = PodOS;
|
|
39286
|
+
exports.RdfDocument = RdfDocument;
|