@ionic/core 7.5.8-dev.11701383555.17254408 → 7.5.8-dev.11701448395.18799530

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.
@@ -3,8 +3,9 @@
3
3
  */
4
4
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
5
5
  import { E as ENABLE_HTML_CONTENT_DEFAULT, a as sanitizeDOMString } from './config.js';
6
- import { c as config, b as getIonMode, a as isPlatform } from './ionic-global.js';
7
6
  import { n as caretBackSharp, o as arrowDown } from './index7.js';
7
+ import { c as config, b as getIonMode } from './ionic-global.js';
8
+ import { e as supportsRubberBandScrolling } from './refresher.utils.js';
8
9
  import { d as defineCustomElement$2, S as SPINNERS } from './spinner.js';
9
10
  import { d as defineCustomElement$3 } from './icon.js';
10
11
 
@@ -20,9 +21,15 @@ const RefresherContent = /*@__PURE__*/ proxyCustomElement(class RefresherContent
20
21
  }
21
22
  componentWillLoad() {
22
23
  if (this.pullingIcon === undefined) {
24
+ /**
25
+ * The native iOS refresher uses a spinner instead of
26
+ * an icon, so we need to see if this device supports
27
+ * the native iOS refresher.
28
+ */
29
+ const hasRubberBandScrolling = supportsRubberBandScrolling();
23
30
  const mode = getIonMode(this);
24
- const overflowRefresher = this.el.style.webkitOverflowScrolling !== undefined ? 'lines' : arrowDown;
25
- this.pullingIcon = config.get('refreshingIcon', mode === 'ios' && isPlatform('mobile') ? config.get('spinner', overflowRefresher) : 'circular');
31
+ const overflowRefresher = hasRubberBandScrolling ? 'lines' : arrowDown;
32
+ this.pullingIcon = config.get('refreshingIcon', mode === 'ios' && hasRubberBandScrolling ? config.get('spinner', overflowRefresher) : 'circular');
26
33
  }
27
34
  if (this.refreshingSpinner === undefined) {
28
35
  const mode = getIonMode(this);
@@ -1,192 +1,13 @@
1
1
  /*!
2
2
  * (C) Ionic http://ionicframework.com - MIT License
3
3
  */
4
- import { writeTask, proxyCustomElement, HTMLElement, createEvent, readTask, h, Host } from '@stencil/core/internal/client';
4
+ import { proxyCustomElement, HTMLElement, createEvent, writeTask, readTask, h, Host } from '@stencil/core/internal/client';
5
5
  import { g as getTimeGivenProgression } from './cubic-bezier.js';
6
6
  import { I as ION_CONTENT_CLASS_SELECTOR, b as ION_CONTENT_ELEMENT_SELECTOR, p as printIonContentErrorMsg, g as getScrollElement } from './index8.js';
7
- import { t as transitionEndAsync, c as componentOnReady, m as clamp, g as getElementRoot, r as raf } from './helpers.js';
7
+ import { t as transitionEndAsync, m as clamp, g as getElementRoot, c as componentOnReady, r as raf } from './helpers.js';
8
8
  import { c as hapticImpact, I as ImpactStyle } from './haptic.js';
9
- import { a as isPlatform, b as getIonMode } from './ionic-global.js';
10
- import { c as createAnimation } from './animation.js';
11
-
12
- const getRefresherAnimationType = (contentEl) => {
13
- const previousSibling = contentEl.previousElementSibling;
14
- const hasHeader = previousSibling !== null && previousSibling.tagName === 'ION-HEADER';
15
- return hasHeader ? 'translate' : 'scale';
16
- };
17
- const createPullingAnimation = (type, pullingSpinner, refresherEl) => {
18
- return type === 'scale'
19
- ? createScaleAnimation(pullingSpinner, refresherEl)
20
- : createTranslateAnimation(pullingSpinner, refresherEl);
21
- };
22
- const createBaseAnimation = (pullingRefresherIcon) => {
23
- const spinner = pullingRefresherIcon.querySelector('ion-spinner');
24
- const circle = spinner.shadowRoot.querySelector('circle');
25
- const spinnerArrowContainer = pullingRefresherIcon.querySelector('.spinner-arrow-container');
26
- const arrowContainer = pullingRefresherIcon.querySelector('.arrow-container');
27
- const arrow = arrowContainer ? arrowContainer.querySelector('ion-icon') : null;
28
- const baseAnimation = createAnimation().duration(1000).easing('ease-out');
29
- const spinnerArrowContainerAnimation = createAnimation()
30
- .addElement(spinnerArrowContainer)
31
- .keyframes([
32
- { offset: 0, opacity: '0.3' },
33
- { offset: 0.45, opacity: '0.3' },
34
- { offset: 0.55, opacity: '1' },
35
- { offset: 1, opacity: '1' },
36
- ]);
37
- const circleInnerAnimation = createAnimation()
38
- .addElement(circle)
39
- .keyframes([
40
- { offset: 0, strokeDasharray: '1px, 200px' },
41
- { offset: 0.2, strokeDasharray: '1px, 200px' },
42
- { offset: 0.55, strokeDasharray: '100px, 200px' },
43
- { offset: 1, strokeDasharray: '100px, 200px' },
44
- ]);
45
- const circleOuterAnimation = createAnimation()
46
- .addElement(spinner)
47
- .keyframes([
48
- { offset: 0, transform: 'rotate(-90deg)' },
49
- { offset: 1, transform: 'rotate(210deg)' },
50
- ]);
51
- /**
52
- * Only add arrow animation if present
53
- * this allows users to customize the spinners
54
- * without errors being thrown
55
- */
56
- if (arrowContainer && arrow) {
57
- const arrowContainerAnimation = createAnimation()
58
- .addElement(arrowContainer)
59
- .keyframes([
60
- { offset: 0, transform: 'rotate(0deg)' },
61
- { offset: 0.3, transform: 'rotate(0deg)' },
62
- { offset: 0.55, transform: 'rotate(280deg)' },
63
- { offset: 1, transform: 'rotate(400deg)' },
64
- ]);
65
- const arrowAnimation = createAnimation()
66
- .addElement(arrow)
67
- .keyframes([
68
- { offset: 0, transform: 'translateX(2px) scale(0)' },
69
- { offset: 0.3, transform: 'translateX(2px) scale(0)' },
70
- { offset: 0.55, transform: 'translateX(-1.5px) scale(1)' },
71
- { offset: 1, transform: 'translateX(-1.5px) scale(1)' },
72
- ]);
73
- baseAnimation.addAnimation([arrowContainerAnimation, arrowAnimation]);
74
- }
75
- return baseAnimation.addAnimation([spinnerArrowContainerAnimation, circleInnerAnimation, circleOuterAnimation]);
76
- };
77
- const createScaleAnimation = (pullingRefresherIcon, refresherEl) => {
78
- /**
79
- * Do not take the height of the refresher icon
80
- * because at this point the DOM has not updated,
81
- * so the refresher icon is still hidden with
82
- * display: none.
83
- * The `ion-refresher` container height
84
- * is roughly the amount we need to offset
85
- * the icon by when pulling down.
86
- */
87
- const height = refresherEl.clientHeight;
88
- const spinnerAnimation = createAnimation()
89
- .addElement(pullingRefresherIcon)
90
- .keyframes([
91
- { offset: 0, transform: `scale(0) translateY(-${height}px)` },
92
- { offset: 1, transform: 'scale(1) translateY(100px)' },
93
- ]);
94
- return createBaseAnimation(pullingRefresherIcon).addAnimation([spinnerAnimation]);
95
- };
96
- const createTranslateAnimation = (pullingRefresherIcon, refresherEl) => {
97
- /**
98
- * Do not take the height of the refresher icon
99
- * because at this point the DOM has not updated,
100
- * so the refresher icon is still hidden with
101
- * display: none.
102
- * The `ion-refresher` container height
103
- * is roughly the amount we need to offset
104
- * the icon by when pulling down.
105
- */
106
- const height = refresherEl.clientHeight;
107
- const spinnerAnimation = createAnimation()
108
- .addElement(pullingRefresherIcon)
109
- .keyframes([
110
- { offset: 0, transform: `translateY(-${height}px)` },
111
- { offset: 1, transform: 'translateY(100px)' },
112
- ]);
113
- return createBaseAnimation(pullingRefresherIcon).addAnimation([spinnerAnimation]);
114
- };
115
- const createSnapBackAnimation = (pullingRefresherIcon) => {
116
- return createAnimation()
117
- .duration(125)
118
- .addElement(pullingRefresherIcon)
119
- .fromTo('transform', 'translateY(var(--ion-pulling-refresher-translate, 100px))', 'translateY(0px)');
120
- };
121
- // iOS Native Refresher
122
- // -----------------------------
123
- const setSpinnerOpacity = (spinner, opacity) => {
124
- spinner.style.setProperty('opacity', opacity.toString());
125
- };
126
- const handleScrollWhilePulling = (ticks, numTicks, pullAmount) => {
127
- const max = 1;
128
- writeTask(() => {
129
- ticks.forEach((el, i) => {
130
- /**
131
- * Compute the opacity of each tick
132
- * mark as a percentage of the pullAmount
133
- * offset by max / numTicks so
134
- * the tick marks are shown staggered.
135
- */
136
- const min = i * (max / numTicks);
137
- const range = max - min;
138
- const start = pullAmount - min;
139
- const progression = clamp(0, start / range, 1);
140
- el.style.setProperty('opacity', progression.toString());
141
- });
142
- });
143
- };
144
- const handleScrollWhileRefreshing = (spinner, lastVelocityY) => {
145
- writeTask(() => {
146
- // If user pulls down quickly, the spinner should spin faster
147
- spinner.style.setProperty('--refreshing-rotation-duration', lastVelocityY >= 1.0 ? '0.5s' : '2s');
148
- spinner.style.setProperty('opacity', '1');
149
- });
150
- };
151
- const translateElement = (el, value, duration = 200) => {
152
- if (!el) {
153
- return Promise.resolve();
154
- }
155
- const trans = transitionEndAsync(el, duration);
156
- writeTask(() => {
157
- el.style.setProperty('transition', `${duration}ms all ease-out`);
158
- if (value === undefined) {
159
- el.style.removeProperty('transform');
160
- }
161
- else {
162
- el.style.setProperty('transform', `translate3d(0px, ${value}, 0px)`);
163
- }
164
- });
165
- return trans;
166
- };
167
- // Utils
168
- // -----------------------------
169
- const shouldUseNativeRefresher = async (referenceEl, mode) => {
170
- const refresherContent = referenceEl.querySelector('ion-refresher-content');
171
- if (!refresherContent) {
172
- return Promise.resolve(false);
173
- }
174
- await new Promise((resolve) => componentOnReady(refresherContent, resolve));
175
- const pullingSpinner = referenceEl.querySelector('ion-refresher-content .refresher-pulling ion-spinner');
176
- const refreshingSpinner = referenceEl.querySelector('ion-refresher-content .refresher-refreshing ion-spinner');
177
- return (pullingSpinner !== null &&
178
- refreshingSpinner !== null &&
179
- /**
180
- * We use webkitOverflowScrolling for feature detection with rubber band scrolling
181
- * on iOS. When doing referenceEl.style, webkitOverflowScrolling is undefined on non-iOS platforms.
182
- * However, it will be the empty string on iOS.
183
- * Note that we do not use getPropertyValue (and thus need to cast as any) because calling
184
- * getPropertyValue('-webkit-overflow-scrolling') will return the empty string if it is not
185
- * set on the element, even if the platform does not support that.
186
- */
187
- ((mode === 'ios' && isPlatform('mobile') && referenceEl.style.webkitOverflowScrolling !== undefined) ||
188
- mode === 'md'));
189
- };
9
+ import { b as getIonMode } from './ionic-global.js';
10
+ import { s as shouldUseNativeRefresher, t as translateElement, a as setSpinnerOpacity, h as handleScrollWhileRefreshing, b as handleScrollWhilePulling, c as createPullingAnimation, d as createSnapBackAnimation, g as getRefresherAnimationType } from './refresher.utils.js';
190
11
 
191
12
  const refresherIosCss = "ion-refresher{top:0;display:none;position:absolute;width:100%;height:60px;pointer-events:none;z-index:-1}@supports (inset-inline-start: 0){ion-refresher{inset-inline-start:0}}@supports not (inset-inline-start: 0){ion-refresher{left:0}:host-context([dir=rtl]) ion-refresher{left:unset;right:unset;right:0}[dir=rtl] ion-refresher{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){ion-refresher:dir(rtl){left:unset;right:unset;right:0}}}ion-refresher.refresher-active{display:block}ion-refresher-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;height:100%}.refresher-pulling,.refresher-refreshing{display:none;width:100%}.refresher-pulling-icon,.refresher-refreshing-icon{-webkit-transform-origin:center;transform-origin:center;-webkit-transition:200ms;transition:200ms;font-size:30px;text-align:center}:host-context([dir=rtl]) .refresher-pulling-icon,:host-context([dir=rtl]) .refresher-refreshing-icon{-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}[dir=rtl] .refresher-pulling-icon,[dir=rtl] .refresher-refreshing-icon{-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}@supports selector(:dir(rtl)){.refresher-pulling-icon:dir(rtl),.refresher-refreshing-icon:dir(rtl){-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}}.refresher-pulling-text,.refresher-refreshing-text{font-size:16px;text-align:center}ion-refresher-content .arrow-container{display:none}.refresher-pulling ion-refresher-content .refresher-pulling{display:block}.refresher-ready ion-refresher-content .refresher-pulling{display:block}.refresher-ready ion-refresher-content .refresher-pulling-icon{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.refresher-refreshing ion-refresher-content .refresher-refreshing{display:block}.refresher-cancelling ion-refresher-content .refresher-pulling{display:block}.refresher-cancelling ion-refresher-content .refresher-pulling-icon{-webkit-transform:scale(0);transform:scale(0)}.refresher-completing ion-refresher-content .refresher-refreshing{display:block}.refresher-completing ion-refresher-content .refresher-refreshing-icon{-webkit-transform:scale(0);transform:scale(0)}.refresher-native .refresher-pulling-text,.refresher-native .refresher-refreshing-text{display:none}.refresher-ios .refresher-pulling-icon,.refresher-ios .refresher-refreshing-icon{color:var(--ion-text-color, #000)}.refresher-ios .refresher-pulling-text,.refresher-ios .refresher-refreshing-text{color:var(--ion-text-color, #000)}.refresher-ios .refresher-refreshing .spinner-lines-ios line,.refresher-ios .refresher-refreshing .spinner-lines-small-ios line,.refresher-ios .refresher-refreshing .spinner-crescent circle{stroke:var(--ion-text-color, #000)}.refresher-ios .refresher-refreshing .spinner-bubbles circle,.refresher-ios .refresher-refreshing .spinner-circles circle,.refresher-ios .refresher-refreshing .spinner-dots circle{fill:var(--ion-text-color, #000)}ion-refresher.refresher-native{display:block;z-index:1}ion-refresher.refresher-native ion-spinner{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}.refresher-native .refresher-refreshing ion-spinner{--refreshing-rotation-duration:2s;display:none;-webkit-animation:var(--refreshing-rotation-duration) ease-out refresher-rotate forwards;animation:var(--refreshing-rotation-duration) ease-out refresher-rotate forwards}.refresher-native .refresher-refreshing{display:none;-webkit-animation:250ms linear refresher-pop forwards;animation:250ms linear refresher-pop forwards}.refresher-native ion-spinner{width:32px;height:32px;color:var(--ion-color-step-450, #747577)}.refresher-native.refresher-refreshing .refresher-pulling ion-spinner,.refresher-native.refresher-completing .refresher-pulling ion-spinner{display:none}.refresher-native.refresher-refreshing .refresher-refreshing ion-spinner,.refresher-native.refresher-completing .refresher-refreshing ion-spinner{display:block}.refresher-native.refresher-pulling .refresher-pulling ion-spinner{display:block}.refresher-native.refresher-pulling .refresher-refreshing ion-spinner{display:none}.refresher-native.refresher-completing ion-refresher-content .refresher-refreshing-icon{-webkit-transform:scale(0) rotate(180deg);transform:scale(0) rotate(180deg);-webkit-transition:300ms;transition:300ms}@-webkit-keyframes refresher-pop{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}50%{-webkit-transform:scale(1.2);transform:scale(1.2);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes refresher-pop{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}50%{-webkit-transform:scale(1.2);transform:scale(1.2);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes refresher-rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(180deg);transform:rotate(180deg)}}@keyframes refresher-rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(180deg);transform:rotate(180deg)}}";
192
13
 
@@ -0,0 +1,198 @@
1
+ /*!
2
+ * (C) Ionic http://ionicframework.com - MIT License
3
+ */
4
+ import { writeTask } from '@stencil/core/internal/client';
5
+ import { c as createAnimation } from './animation.js';
6
+ import { t as transitionEndAsync, c as componentOnReady, m as clamp } from './helpers.js';
7
+ import { a as isPlatform } from './ionic-global.js';
8
+
9
+ const getRefresherAnimationType = (contentEl) => {
10
+ const previousSibling = contentEl.previousElementSibling;
11
+ const hasHeader = previousSibling !== null && previousSibling.tagName === 'ION-HEADER';
12
+ return hasHeader ? 'translate' : 'scale';
13
+ };
14
+ const createPullingAnimation = (type, pullingSpinner, refresherEl) => {
15
+ return type === 'scale'
16
+ ? createScaleAnimation(pullingSpinner, refresherEl)
17
+ : createTranslateAnimation(pullingSpinner, refresherEl);
18
+ };
19
+ const createBaseAnimation = (pullingRefresherIcon) => {
20
+ const spinner = pullingRefresherIcon.querySelector('ion-spinner');
21
+ const circle = spinner.shadowRoot.querySelector('circle');
22
+ const spinnerArrowContainer = pullingRefresherIcon.querySelector('.spinner-arrow-container');
23
+ const arrowContainer = pullingRefresherIcon.querySelector('.arrow-container');
24
+ const arrow = arrowContainer ? arrowContainer.querySelector('ion-icon') : null;
25
+ const baseAnimation = createAnimation().duration(1000).easing('ease-out');
26
+ const spinnerArrowContainerAnimation = createAnimation()
27
+ .addElement(spinnerArrowContainer)
28
+ .keyframes([
29
+ { offset: 0, opacity: '0.3' },
30
+ { offset: 0.45, opacity: '0.3' },
31
+ { offset: 0.55, opacity: '1' },
32
+ { offset: 1, opacity: '1' },
33
+ ]);
34
+ const circleInnerAnimation = createAnimation()
35
+ .addElement(circle)
36
+ .keyframes([
37
+ { offset: 0, strokeDasharray: '1px, 200px' },
38
+ { offset: 0.2, strokeDasharray: '1px, 200px' },
39
+ { offset: 0.55, strokeDasharray: '100px, 200px' },
40
+ { offset: 1, strokeDasharray: '100px, 200px' },
41
+ ]);
42
+ const circleOuterAnimation = createAnimation()
43
+ .addElement(spinner)
44
+ .keyframes([
45
+ { offset: 0, transform: 'rotate(-90deg)' },
46
+ { offset: 1, transform: 'rotate(210deg)' },
47
+ ]);
48
+ /**
49
+ * Only add arrow animation if present
50
+ * this allows users to customize the spinners
51
+ * without errors being thrown
52
+ */
53
+ if (arrowContainer && arrow) {
54
+ const arrowContainerAnimation = createAnimation()
55
+ .addElement(arrowContainer)
56
+ .keyframes([
57
+ { offset: 0, transform: 'rotate(0deg)' },
58
+ { offset: 0.3, transform: 'rotate(0deg)' },
59
+ { offset: 0.55, transform: 'rotate(280deg)' },
60
+ { offset: 1, transform: 'rotate(400deg)' },
61
+ ]);
62
+ const arrowAnimation = createAnimation()
63
+ .addElement(arrow)
64
+ .keyframes([
65
+ { offset: 0, transform: 'translateX(2px) scale(0)' },
66
+ { offset: 0.3, transform: 'translateX(2px) scale(0)' },
67
+ { offset: 0.55, transform: 'translateX(-1.5px) scale(1)' },
68
+ { offset: 1, transform: 'translateX(-1.5px) scale(1)' },
69
+ ]);
70
+ baseAnimation.addAnimation([arrowContainerAnimation, arrowAnimation]);
71
+ }
72
+ return baseAnimation.addAnimation([spinnerArrowContainerAnimation, circleInnerAnimation, circleOuterAnimation]);
73
+ };
74
+ const createScaleAnimation = (pullingRefresherIcon, refresherEl) => {
75
+ /**
76
+ * Do not take the height of the refresher icon
77
+ * because at this point the DOM has not updated,
78
+ * so the refresher icon is still hidden with
79
+ * display: none.
80
+ * The `ion-refresher` container height
81
+ * is roughly the amount we need to offset
82
+ * the icon by when pulling down.
83
+ */
84
+ const height = refresherEl.clientHeight;
85
+ const spinnerAnimation = createAnimation()
86
+ .addElement(pullingRefresherIcon)
87
+ .keyframes([
88
+ { offset: 0, transform: `scale(0) translateY(-${height}px)` },
89
+ { offset: 1, transform: 'scale(1) translateY(100px)' },
90
+ ]);
91
+ return createBaseAnimation(pullingRefresherIcon).addAnimation([spinnerAnimation]);
92
+ };
93
+ const createTranslateAnimation = (pullingRefresherIcon, refresherEl) => {
94
+ /**
95
+ * Do not take the height of the refresher icon
96
+ * because at this point the DOM has not updated,
97
+ * so the refresher icon is still hidden with
98
+ * display: none.
99
+ * The `ion-refresher` container height
100
+ * is roughly the amount we need to offset
101
+ * the icon by when pulling down.
102
+ */
103
+ const height = refresherEl.clientHeight;
104
+ const spinnerAnimation = createAnimation()
105
+ .addElement(pullingRefresherIcon)
106
+ .keyframes([
107
+ { offset: 0, transform: `translateY(-${height}px)` },
108
+ { offset: 1, transform: 'translateY(100px)' },
109
+ ]);
110
+ return createBaseAnimation(pullingRefresherIcon).addAnimation([spinnerAnimation]);
111
+ };
112
+ const createSnapBackAnimation = (pullingRefresherIcon) => {
113
+ return createAnimation()
114
+ .duration(125)
115
+ .addElement(pullingRefresherIcon)
116
+ .fromTo('transform', 'translateY(var(--ion-pulling-refresher-translate, 100px))', 'translateY(0px)');
117
+ };
118
+ // iOS Native Refresher
119
+ // -----------------------------
120
+ const setSpinnerOpacity = (spinner, opacity) => {
121
+ spinner.style.setProperty('opacity', opacity.toString());
122
+ };
123
+ const handleScrollWhilePulling = (ticks, numTicks, pullAmount) => {
124
+ const max = 1;
125
+ writeTask(() => {
126
+ ticks.forEach((el, i) => {
127
+ /**
128
+ * Compute the opacity of each tick
129
+ * mark as a percentage of the pullAmount
130
+ * offset by max / numTicks so
131
+ * the tick marks are shown staggered.
132
+ */
133
+ const min = i * (max / numTicks);
134
+ const range = max - min;
135
+ const start = pullAmount - min;
136
+ const progression = clamp(0, start / range, 1);
137
+ el.style.setProperty('opacity', progression.toString());
138
+ });
139
+ });
140
+ };
141
+ const handleScrollWhileRefreshing = (spinner, lastVelocityY) => {
142
+ writeTask(() => {
143
+ // If user pulls down quickly, the spinner should spin faster
144
+ spinner.style.setProperty('--refreshing-rotation-duration', lastVelocityY >= 1.0 ? '0.5s' : '2s');
145
+ spinner.style.setProperty('opacity', '1');
146
+ });
147
+ };
148
+ const translateElement = (el, value, duration = 200) => {
149
+ if (!el) {
150
+ return Promise.resolve();
151
+ }
152
+ const trans = transitionEndAsync(el, duration);
153
+ writeTask(() => {
154
+ el.style.setProperty('transition', `${duration}ms all ease-out`);
155
+ if (value === undefined) {
156
+ el.style.removeProperty('transform');
157
+ }
158
+ else {
159
+ el.style.setProperty('transform', `translate3d(0px, ${value}, 0px)`);
160
+ }
161
+ });
162
+ return trans;
163
+ };
164
+ // Utils
165
+ // -----------------------------
166
+ /**
167
+ * In order to use the native iOS refresher the device must support rubber band scrolling.
168
+ * The ios + mobile platform check ensures that desktop Safari is not included. Desktop Safari
169
+ * has a slightly different rubber band effect that is not compatible with the native refresher
170
+ * in Ionic.
171
+ *
172
+ * We also need to be careful not to include devices that spoof their user agent.
173
+ * For example, when using iOS emulation in Chrome the user agent will be spoofed such that
174
+ * isPlatform('ios') and isPlatform('mobile') both return true. To work around this,
175
+ * we check to see if the apple-pay-logo is supported as a named image which is only
176
+ * true on Apple devices.
177
+ *
178
+ * We previously checked referencEl.style.webkitOverflowScrolling to explicitly check
179
+ * for rubber band support. However, this property was removed on iPadOS and it's possible
180
+ * that this will be removed on iOS in the future too.
181
+ */
182
+ const supportsRubberBandScrolling = () => {
183
+ return (isPlatform('ios') && isPlatform('mobile') && CSS.supports('background: -webkit-named-image(apple-pay-logo-black)'));
184
+ };
185
+ const shouldUseNativeRefresher = async (referenceEl, mode) => {
186
+ const refresherContent = referenceEl.querySelector('ion-refresher-content');
187
+ if (!refresherContent) {
188
+ return Promise.resolve(false);
189
+ }
190
+ await new Promise((resolve) => componentOnReady(refresherContent, resolve));
191
+ const pullingSpinner = referenceEl.querySelector('ion-refresher-content .refresher-pulling ion-spinner');
192
+ const refreshingSpinner = referenceEl.querySelector('ion-refresher-content .refresher-refreshing ion-spinner');
193
+ return (pullingSpinner !== null &&
194
+ refreshingSpinner !== null &&
195
+ ((mode === 'ios' && supportsRubberBandScrolling()) || mode === 'md'));
196
+ };
197
+
198
+ export { setSpinnerOpacity as a, handleScrollWhilePulling as b, createPullingAnimation as c, createSnapBackAnimation as d, supportsRubberBandScrolling as e, getRefresherAnimationType as g, handleScrollWhileRefreshing as h, shouldUseNativeRefresher as s, translateElement as t };
@@ -176,6 +176,25 @@ const translateElement = (el, value, duration = 200) => {
176
176
  };
177
177
  // Utils
178
178
  // -----------------------------
179
+ /**
180
+ * In order to use the native iOS refresher the device must support rubber band scrolling.
181
+ * The ios + mobile platform check ensures that desktop Safari is not included. Desktop Safari
182
+ * has a slightly different rubber band effect that is not compatible with the native refresher
183
+ * in Ionic.
184
+ *
185
+ * We also need to be careful not to include devices that spoof their user agent.
186
+ * For example, when using iOS emulation in Chrome the user agent will be spoofed such that
187
+ * isPlatform('ios') and isPlatform('mobile') both return true. To work around this,
188
+ * we check to see if the apple-pay-logo is supported as a named image which is only
189
+ * true on Apple devices.
190
+ *
191
+ * We previously checked referencEl.style.webkitOverflowScrolling to explicitly check
192
+ * for rubber band support. However, this property was removed on iPadOS and it's possible
193
+ * that this will be removed on iOS in the future too.
194
+ */
195
+ const supportsRubberBandScrolling = () => {
196
+ return (ionicGlobal.isPlatform('ios') && ionicGlobal.isPlatform('mobile') && CSS.supports('background: -webkit-named-image(apple-pay-logo-black)'));
197
+ };
179
198
  const shouldUseNativeRefresher = async (referenceEl, mode) => {
180
199
  const refresherContent = referenceEl.querySelector('ion-refresher-content');
181
200
  if (!refresherContent) {
@@ -186,16 +205,7 @@ const shouldUseNativeRefresher = async (referenceEl, mode) => {
186
205
  const refreshingSpinner = referenceEl.querySelector('ion-refresher-content .refresher-refreshing ion-spinner');
187
206
  return (pullingSpinner !== null &&
188
207
  refreshingSpinner !== null &&
189
- /**
190
- * We use webkitOverflowScrolling for feature detection with rubber band scrolling
191
- * on iOS. When doing referenceEl.style, webkitOverflowScrolling is undefined on non-iOS platforms.
192
- * However, it will be the empty string on iOS.
193
- * Note that we do not use getPropertyValue (and thus need to cast as any) because calling
194
- * getPropertyValue('-webkit-overflow-scrolling') will return the empty string if it is not
195
- * set on the element, even if the platform does not support that.
196
- */
197
- ((mode === 'ios' && ionicGlobal.isPlatform('mobile') && referenceEl.style.webkitOverflowScrolling !== undefined) ||
198
- mode === 'md'));
208
+ ((mode === 'ios' && supportsRubberBandScrolling()) || mode === 'md'));
199
209
  };
200
210
 
201
211
  const refresherIosCss = "ion-refresher{top:0;display:none;position:absolute;width:100%;height:60px;pointer-events:none;z-index:-1}@supports (inset-inline-start: 0){ion-refresher{inset-inline-start:0}}@supports not (inset-inline-start: 0){ion-refresher{left:0}:host-context([dir=rtl]) ion-refresher{left:unset;right:unset;right:0}[dir=rtl] ion-refresher{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){ion-refresher:dir(rtl){left:unset;right:unset;right:0}}}ion-refresher.refresher-active{display:block}ion-refresher-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;height:100%}.refresher-pulling,.refresher-refreshing{display:none;width:100%}.refresher-pulling-icon,.refresher-refreshing-icon{-webkit-transform-origin:center;transform-origin:center;-webkit-transition:200ms;transition:200ms;font-size:30px;text-align:center}:host-context([dir=rtl]) .refresher-pulling-icon,:host-context([dir=rtl]) .refresher-refreshing-icon{-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}[dir=rtl] .refresher-pulling-icon,[dir=rtl] .refresher-refreshing-icon{-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}@supports selector(:dir(rtl)){.refresher-pulling-icon:dir(rtl),.refresher-refreshing-icon:dir(rtl){-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}}.refresher-pulling-text,.refresher-refreshing-text{font-size:16px;text-align:center}ion-refresher-content .arrow-container{display:none}.refresher-pulling ion-refresher-content .refresher-pulling{display:block}.refresher-ready ion-refresher-content .refresher-pulling{display:block}.refresher-ready ion-refresher-content .refresher-pulling-icon{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.refresher-refreshing ion-refresher-content .refresher-refreshing{display:block}.refresher-cancelling ion-refresher-content .refresher-pulling{display:block}.refresher-cancelling ion-refresher-content .refresher-pulling-icon{-webkit-transform:scale(0);transform:scale(0)}.refresher-completing ion-refresher-content .refresher-refreshing{display:block}.refresher-completing ion-refresher-content .refresher-refreshing-icon{-webkit-transform:scale(0);transform:scale(0)}.refresher-native .refresher-pulling-text,.refresher-native .refresher-refreshing-text{display:none}.refresher-ios .refresher-pulling-icon,.refresher-ios .refresher-refreshing-icon{color:var(--ion-text-color, #000)}.refresher-ios .refresher-pulling-text,.refresher-ios .refresher-refreshing-text{color:var(--ion-text-color, #000)}.refresher-ios .refresher-refreshing .spinner-lines-ios line,.refresher-ios .refresher-refreshing .spinner-lines-small-ios line,.refresher-ios .refresher-refreshing .spinner-crescent circle{stroke:var(--ion-text-color, #000)}.refresher-ios .refresher-refreshing .spinner-bubbles circle,.refresher-ios .refresher-refreshing .spinner-circles circle,.refresher-ios .refresher-refreshing .spinner-dots circle{fill:var(--ion-text-color, #000)}ion-refresher.refresher-native{display:block;z-index:1}ion-refresher.refresher-native ion-spinner{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}.refresher-native .refresher-refreshing ion-spinner{--refreshing-rotation-duration:2s;display:none;-webkit-animation:var(--refreshing-rotation-duration) ease-out refresher-rotate forwards;animation:var(--refreshing-rotation-duration) ease-out refresher-rotate forwards}.refresher-native .refresher-refreshing{display:none;-webkit-animation:250ms linear refresher-pop forwards;animation:250ms linear refresher-pop forwards}.refresher-native ion-spinner{width:32px;height:32px;color:var(--ion-color-step-450, #747577)}.refresher-native.refresher-refreshing .refresher-pulling ion-spinner,.refresher-native.refresher-completing .refresher-pulling ion-spinner{display:none}.refresher-native.refresher-refreshing .refresher-refreshing ion-spinner,.refresher-native.refresher-completing .refresher-refreshing ion-spinner{display:block}.refresher-native.refresher-pulling .refresher-pulling ion-spinner{display:block}.refresher-native.refresher-pulling .refresher-refreshing ion-spinner{display:none}.refresher-native.refresher-completing ion-refresher-content .refresher-refreshing-icon{-webkit-transform:scale(0) rotate(180deg);transform:scale(0) rotate(180deg);-webkit-transition:300ms;transition:300ms}@-webkit-keyframes refresher-pop{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}50%{-webkit-transform:scale(1.2);transform:scale(1.2);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes refresher-pop{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}50%{-webkit-transform:scale(1.2);transform:scale(1.2);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes refresher-rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(180deg);transform:rotate(180deg)}}@keyframes refresher-rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(180deg);transform:rotate(180deg)}}";
@@ -823,9 +833,15 @@ const RefresherContent = class {
823
833
  }
824
834
  componentWillLoad() {
825
835
  if (this.pullingIcon === undefined) {
836
+ /**
837
+ * The native iOS refresher uses a spinner instead of
838
+ * an icon, so we need to see if this device supports
839
+ * the native iOS refresher.
840
+ */
841
+ const hasRubberBandScrolling = supportsRubberBandScrolling();
826
842
  const mode = ionicGlobal.getIonMode(this);
827
- const overflowRefresher = this.el.style.webkitOverflowScrolling !== undefined ? 'lines' : index$2.arrowDown;
828
- this.pullingIcon = ionicGlobal.config.get('refreshingIcon', mode === 'ios' && ionicGlobal.isPlatform('mobile') ? ionicGlobal.config.get('spinner', overflowRefresher) : 'circular');
843
+ const overflowRefresher = hasRubberBandScrolling ? 'lines' : index$2.arrowDown;
844
+ this.pullingIcon = ionicGlobal.config.get('refreshingIcon', mode === 'ios' && hasRubberBandScrolling ? ionicGlobal.config.get('spinner', overflowRefresher) : 'circular');
829
845
  }
830
846
  if (this.refreshingSpinner === undefined) {
831
847
  const mode = ionicGlobal.getIonMode(this);
@@ -162,6 +162,25 @@ export const translateElement = (el, value, duration = 200) => {
162
162
  };
163
163
  // Utils
164
164
  // -----------------------------
165
+ /**
166
+ * In order to use the native iOS refresher the device must support rubber band scrolling.
167
+ * The ios + mobile platform check ensures that desktop Safari is not included. Desktop Safari
168
+ * has a slightly different rubber band effect that is not compatible with the native refresher
169
+ * in Ionic.
170
+ *
171
+ * We also need to be careful not to include devices that spoof their user agent.
172
+ * For example, when using iOS emulation in Chrome the user agent will be spoofed such that
173
+ * isPlatform('ios') and isPlatform('mobile') both return true. To work around this,
174
+ * we check to see if the apple-pay-logo is supported as a named image which is only
175
+ * true on Apple devices.
176
+ *
177
+ * We previously checked referencEl.style.webkitOverflowScrolling to explicitly check
178
+ * for rubber band support. However, this property was removed on iPadOS and it's possible
179
+ * that this will be removed on iOS in the future too.
180
+ */
181
+ export const supportsRubberBandScrolling = () => {
182
+ return (isPlatform('ios') && isPlatform('mobile') && CSS.supports('background: -webkit-named-image(apple-pay-logo-black)'));
183
+ };
165
184
  export const shouldUseNativeRefresher = async (referenceEl, mode) => {
166
185
  const refresherContent = referenceEl.querySelector('ion-refresher-content');
167
186
  if (!refresherContent) {
@@ -172,14 +191,5 @@ export const shouldUseNativeRefresher = async (referenceEl, mode) => {
172
191
  const refreshingSpinner = referenceEl.querySelector('ion-refresher-content .refresher-refreshing ion-spinner');
173
192
  return (pullingSpinner !== null &&
174
193
  refreshingSpinner !== null &&
175
- /**
176
- * We use webkitOverflowScrolling for feature detection with rubber band scrolling
177
- * on iOS. When doing referenceEl.style, webkitOverflowScrolling is undefined on non-iOS platforms.
178
- * However, it will be the empty string on iOS.
179
- * Note that we do not use getPropertyValue (and thus need to cast as any) because calling
180
- * getPropertyValue('-webkit-overflow-scrolling') will return the empty string if it is not
181
- * set on the element, even if the platform does not support that.
182
- */
183
- ((mode === 'ios' && isPlatform('mobile') && referenceEl.style.webkitOverflowScrolling !== undefined) ||
184
- mode === 'md'));
194
+ ((mode === 'ios' && supportsRubberBandScrolling()) || mode === 'md'));
185
195
  };
@@ -3,11 +3,11 @@
3
3
  */
4
4
  import { Host, h } from "@stencil/core";
5
5
  import { ENABLE_HTML_CONTENT_DEFAULT } from "../../utils/config";
6
- import { isPlatform } from "../../utils/platform";
7
6
  import { sanitizeDOMString } from "../../utils/sanitization/index";
8
7
  import { arrowDown, caretBackSharp } from "ionicons/icons";
9
8
  import { config } from "../../global/config";
10
9
  import { getIonMode } from "../../global/ionic-global";
10
+ import { supportsRubberBandScrolling } from "../refresher/refresher.utils";
11
11
  import { SPINNERS } from "../spinner/spinner-configs";
12
12
  export class RefresherContent {
13
13
  constructor() {
@@ -19,9 +19,15 @@ export class RefresherContent {
19
19
  }
20
20
  componentWillLoad() {
21
21
  if (this.pullingIcon === undefined) {
22
+ /**
23
+ * The native iOS refresher uses a spinner instead of
24
+ * an icon, so we need to see if this device supports
25
+ * the native iOS refresher.
26
+ */
27
+ const hasRubberBandScrolling = supportsRubberBandScrolling();
22
28
  const mode = getIonMode(this);
23
- const overflowRefresher = this.el.style.webkitOverflowScrolling !== undefined ? 'lines' : arrowDown;
24
- this.pullingIcon = config.get('refreshingIcon', mode === 'ios' && isPlatform('mobile') ? config.get('spinner', overflowRefresher) : 'circular');
29
+ const overflowRefresher = hasRubberBandScrolling ? 'lines' : arrowDown;
30
+ this.pullingIcon = config.get('refreshingIcon', mode === 'ios' && hasRubberBandScrolling ? config.get('spinner', overflowRefresher) : 'circular');
25
31
  }
26
32
  if (this.refreshingSpinner === undefined) {
27
33
  const mode = getIonMode(this);
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-11-30T22:34:24",
2
+ "timestamp": "2023-12-01T16:36:44",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.8.0",