1import { 2 findClosestIonContent, 3 getScrollElement, 4 printIonContentErrorMsg 5} from "./chunk-2V4QKHY3.js"; 6import { 7 ENABLE_HTML_CONTENT_DEFAULT, 8 sanitizeDOMString 9} from "./chunk-R4QHACMO.js"; 10import { 11 config, 12 getIonMode 13} from "./chunk-PP7P2UY3.js"; 14import { 15 Host, 16 createEvent, 17 getElement, 18 h, 19 readTask, 20 registerInstance, 21 writeTask 22} from "./chunk-LPF5FBSP.js"; 23import "./chunk-36T2BHYJ.js"; 24import "./chunk-3MMB2GIP.js"; 25import { 26 __async 27} from "./chunk-KLIBT2SQ.js"; 28 29// node_modules/@ionic/core/dist/esm/ion-infinite-scroll_2.entry.js 30var infiniteScrollCss = "ion-infinite-scroll{display:none;width:100%}.infinite-scroll-enabled{display:block}"; 31var InfiniteScroll = class { 32 constructor(hostRef) { 33 registerInstance(this, hostRef); 34 this.ionInfinite = createEvent(this, "ionInfinite", 7); 35 this.thrPx = 0; 36 this.thrPc = 0; 37 this.didFire = false; 38 this.isBusy = false; 39 this.onScroll = () => { 40 const scrollEl = this.scrollEl; 41 if (!scrollEl || !this.canStart()) { 42 return 1; 43 } 44 const infiniteHeight = this.el.offsetHeight; 45 if (infiniteHeight === 0) { 46 return 2; 47 } 48 const scrollTop = scrollEl.scrollTop; 49 const scrollHeight = scrollEl.scrollHeight; 50 const height = scrollEl.offsetHeight; 51 const threshold = this.thrPc !== 0 ? height * this.thrPc : this.thrPx; 52 const distanceFromInfinite = this.position === "bottom" ? scrollHeight - infiniteHeight - scrollTop - threshold - height : scrollTop - infiniteHeight - threshold; 53 if (distanceFromInfinite < 0) { 54 if (!this.didFire) { 55 this.isLoading = true; 56 this.didFire = true; 57 this.ionInfinite.emit(); 58 return 3; 59 } 60 } 61 return 4; 62 }; 63 this.isLoading = false; 64 this.threshold = "15%"; 65 this.disabled = false; 66 this.position = "bottom"; 67 } 68 thresholdChanged() { 69 const val = this.threshold; 70 if (val.lastIndexOf("%") > -1) { 71 this.thrPx = 0; 72 this.thrPc = parseFloat(val) / 100; 73 } else { 74 this.thrPx = parseFloat(val); 75 this.thrPc = 0; 76 } 77 } 78 disabledChanged() { 79 const disabled = this.disabled; 80 if (disabled) { 81 this.isLoading = false; 82 this.isBusy = false; 83 } 84 this.enableScrollEvents(!disabled); 85 } 86 connectedCallback() { 87 return __async(this, null, function* () { 88 const contentEl = findClosestIonContent(this.el); 89 if (!contentEl) { 90 printIonContentErrorMsg(this.el); 91 return; 92 } 93 this.scrollEl = yield getScrollElement(contentEl); 94 this.thresholdChanged(); 95 this.disabledChanged(); 96 if (this.position === "top") { 97 writeTask(() => { 98 if (this.scrollEl) { 99 this.scrollEl.scrollTop = this.scrollEl.scrollHeight - this.scrollEl.clientHeight; 100 } 101 }); 102 } 103 }); 104 } 105 disconnectedCallback() { 106 this.enableScrollEvents(false); 107 this.scrollEl = void 0; 108 } 109 /** 110 * Call `complete()` within the `ionInfinite` output event handler when 111 * your async operation has completed. For example, the `loading` 112 * state is while the app is performing an asynchronous operation, 113 * such as receiving more data from an AJAX request to add more items 114 * to a data list. Once the data has been received and UI updated, you 115 * then call this method to signify that the loading has completed. 116 * This method will change the infinite scroll's state from `loading` 117 * to `enabled`. 118 */ 119 complete() { 120 return __async(this, null, function* () { 121 const scrollEl = this.scrollEl; 122 if (!this.isLoading || !scrollEl) { 123 return; 124 } 125 this.isLoading = false; 126 if (this.position === "top") { 127 this.isBusy = true; 128 const prev = scrollEl.scrollHeight - scrollEl.scrollTop; 129 requestAnimationFrame(() => { 130 readTask(() => { 131 const scrollHeight = scrollEl.scrollHeight; 132 const newScrollTop = scrollHeight - prev; 133 requestAnimationFrame(() => { 134 writeTask(() => { 135 scrollEl.scrollTop = newScrollTop; 136 this.isBusy = false;
137 this.didFire = false; 138 }); 139 }); 140 }); 141 }); 142 } else { 143 this.didFire = false; 144 } 145 }); 146 } 147 canStart() { 148 return !this.disabled && !this.isBusy && !!this.scrollEl && !this.isLoading; 149 } 150 enableScrollEvents(shouldListen) { 151 if (this.scrollEl) { 152 if (shouldListen) { 153 this.scrollEl.addEventListener("scroll", this.onScroll); 154 } else { 155 this.scrollEl.removeEventListener("scroll", this.onScroll); 156 } 157 } 158 } 159 render() { 160 const mode = getIonMode(this); 161 const disabled = this.disabled; 162 return h(Host, { class: { 163 [mode]: true, 164 "infinite-scroll-loading": this.isLoading, 165 "infinite-scroll-enabled": !disabled 166 } }); 167 } 168 get el() { 169 return getElement(this); 170 } 171 static get watchers() { 172 return { 173 "threshold": ["thresholdChanged"], 174 "disabled": ["disabledChanged"] 175 }; 176 } 177}; 178InfiniteScroll.style = infiniteScrollCss; 179var infiniteScrollContentIosCss = "ion-infinite-scroll-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;min-height:84px;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.infinite-loading{margin-left:0;margin-right:0;margin-top:0;margin-bottom:32px;display:none;width:100%}.infinite-loading-text{-webkit-margin-start:32px;margin-inline-start:32px;-webkit-margin-end:32px;margin-inline-end:32px;margin-top:4px;margin-bottom:0}.infinite-scroll-loading ion-infinite-scroll-content>.infinite-loading{display:block}.infinite-scroll-content-ios .infinite-loading-text{color:var(--ion-color-step-600, #666666)}.infinite-scroll-content-ios .infinite-loading-spinner .spinner-lines-ios line,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-lines-small-ios line,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-crescent circle{stroke:var(--ion-color-step-600, #666666)}.infinite-scroll-content-ios .infinite-loading-spinner .spinner-bubbles circle,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-circles circle,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-dots circle{fill:var(--ion-color-step-600, #666666)}"; 180var infiniteScrollContentMdCss = "ion-infinite-scroll-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;min-height:84px;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.infinite-loading{margin-left:0;margin-right:0;margin-top:0;margin-bottom:32px;display:none;width:100%}.infinite-loading-text{-webkit-margin-start:32px;margin-inline-start:32px;-webkit-margin-end:32px;margin-inline-end:32px;margin-top:4px;margin-bottom:0}.infinite-scroll-loading ion-infinite-scroll-content>.infinite-loading{display:block}.infinite-scroll-content-md .infinite-loading-text{color:var(--ion-color-step-600, #666666)}.infinite-scroll-content-md .infinite-loading-spinner .spinner-lines-md line,.infinite-scroll-content-md .infinite-loading-spinner .spinner-lines-small-md line,.infinite-scroll-content-md .infinite-loading-spinner .spinner-crescent circle{stroke:var(--ion-color-step-600, #666666)}.infinite-scroll-content-md .infinite-loading-spinner .spinner-bubbles circle,.infinite-scroll-content-md .infinite-loading-spinner .spinner-circles circle,.infinite-scroll-content-md .infinite-loading-spinner .spinner-dots circle{fill:var(--ion-color-step-600, #666666)}"; 181var InfiniteScrollContent = class { 182 constructor(hostRef) { 183 registerInstance(this, hostRef); 184 this.customHTMLEnabled = config.get("innerHTMLTemplatesEnabled", ENABLE_HTML_CONTENT_DEFAULT); 185 this.loadingSpinner = void 0; 186 this.loadingText = void 0; 187 } 188 componentDidLoad() { 189 if (this.loadingSpinner === void 0) { 190 const mode = getIonMode(this); 191 this.loadingSpinner = config.get("infiniteLoadingSpinner", config.get("spinner", mode === "ios" ? "lines" : "crescent")); 192 } 193 } 194 renderLoadingText() { 195 const { customHTMLEnabled, loadingText } = this; 196 if (customHTMLEnabled) { 197 return h("div", { class: "infinite-loading-text", innerHTML: sanitizeDOMString(loadingText) }); 198 } 199 return h("div", { class: "infinite-loading-text" }, this.loadingText); 200 } 201 render() { 202 const mode = getIonMode(this); 203 return h(Host, { class: { 204 [mode]: true, 205 // Used internally for styling 206 [`infinite-scroll-content-${mode}`]: true 207 } }, h("div", { class: "infinite-loading" }, this.loadingSpinner && h("div", { class: "infinite-loading-spinner" }, h("ion-spinner", { name: this.loadingSpinner })), this.loadingText !== void 0 && this.renderLoadingText())); 208 } 209}; 210InfiniteScrollContent.style = { 211 ios: infiniteScrollContentIosCss, 212 md: infiniteScrollContentMdCss 213}; 214export { 215 InfiniteScroll as ion_infinite_scroll, 216 InfiniteScrollContent as ion_infinite_scroll_content 217};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.