@fluid-topics/ft-infinite-scroll 0.3.23 → 0.3.25
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.
|
@@ -30,7 +30,9 @@ export declare class FtInfiniteScroll<T> extends FtLitElement implements FtInfin
|
|
|
30
30
|
protected render(): TemplateResult<1>;
|
|
31
31
|
private renderItemContainer;
|
|
32
32
|
private scrollDebouncer;
|
|
33
|
+
private scrollDoneDebouncer;
|
|
33
34
|
resetScroll(): void;
|
|
35
|
+
private getItem;
|
|
34
36
|
private scrollToTarget;
|
|
35
37
|
private getOffset;
|
|
36
38
|
appendItems(...items: Array<T>): void;
|
|
@@ -38,8 +40,10 @@ export declare class FtInfiniteScroll<T> extends FtLitElement implements FtInfin
|
|
|
38
40
|
private onVisibilityChange;
|
|
39
41
|
private intersectionObserver;
|
|
40
42
|
connectedCallback(): void;
|
|
43
|
+
private initIntersectionObserver;
|
|
41
44
|
private triggerFindScrollableParent;
|
|
42
45
|
private findScrollableParent;
|
|
46
|
+
private elementCanScroll;
|
|
43
47
|
private onResize;
|
|
44
48
|
private resizeObserver;
|
|
45
49
|
private onMutation;
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { html } from "lit";
|
|
8
8
|
import { property, query, state } from "lit/decorators.js";
|
|
9
9
|
import { repeat } from "lit/directives/repeat.js";
|
|
10
|
-
import { Debouncer, FtLitElement
|
|
10
|
+
import { Debouncer, FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
11
11
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
12
12
|
import { styles } from "./ft-infinite-scroll.css";
|
|
13
13
|
export class VisibleItemsChangeEvent extends CustomEvent {
|
|
@@ -38,6 +38,7 @@ export class FtInfiniteScroll extends FtLitElement {
|
|
|
38
38
|
this.scrolledToTarget = false;
|
|
39
39
|
this.alreadyRenderedIndexes = new Set();
|
|
40
40
|
this.scrollDebouncer = new Debouncer(5);
|
|
41
|
+
this.scrollDoneDebouncer = new Debouncer(10);
|
|
41
42
|
this.onVisibilityChange = (items) => {
|
|
42
43
|
const newItems = items.filter(item => item.intersectionRect.height > 1)
|
|
43
44
|
.map(item => +item.target.attributes.getNamedItem("data-item-index").value)
|
|
@@ -50,21 +51,23 @@ export class FtInfiniteScroll extends FtLitElement {
|
|
|
50
51
|
};
|
|
51
52
|
this.intersectionObserver = new IntersectionObserver(this.onVisibilityChange);
|
|
52
53
|
this.onResize = (resizables) => {
|
|
54
|
+
var _a;
|
|
53
55
|
this.triggerFindScrollableParent();
|
|
54
|
-
let diff = 0;
|
|
55
56
|
resizables = resizables.sort((a, b) => a.contentRect.top - b.contentRect.top);
|
|
56
57
|
for (const resizable of resizables) {
|
|
57
58
|
const index = +resizable.target.parentElement.getAttribute("data-item-index");
|
|
58
59
|
const oldHeight = resizable.target.parentElement.clientHeight;
|
|
59
60
|
const newHeight = resizable.contentRect.height;
|
|
60
61
|
if (this.alreadyRenderedIndexes.has(index)) {
|
|
62
|
+
if (this.scrollable) {
|
|
63
|
+
const noOverflowAnchor = ((_a = getComputedStyle(this.scrollable).overflowAnchor) !== null && _a !== void 0 ? _a : "none") === "none";
|
|
64
|
+
if (noOverflowAnchor && this.getOffset(resizable.target.parentElement) + oldHeight < this.scrollable.scrollTop) {
|
|
65
|
+
this.scrollable.scrollTop += Math.ceil(newHeight - oldHeight);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
61
68
|
resizable.target.parentElement.style.height = newHeight + "px";
|
|
62
|
-
diff += this.scrollable && this.getOffset(resizable.target.parentElement) < this.scrollable.scrollTop + diff ? newHeight - oldHeight : 0;
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
|
-
if (this.scrollable && isSafari) {
|
|
66
|
-
this.scrollable.scrollTop += diff;
|
|
67
|
-
}
|
|
68
71
|
};
|
|
69
72
|
this.resizeObserver = new ResizeObserver(this.onResize);
|
|
70
73
|
this.onMutation = () => {
|
|
@@ -111,30 +114,35 @@ export class FtInfiniteScroll extends FtLitElement {
|
|
|
111
114
|
`;
|
|
112
115
|
}
|
|
113
116
|
resetScroll() {
|
|
117
|
+
this.triggerFindScrollableParent();
|
|
114
118
|
this.intersectionObserver.disconnect();
|
|
115
119
|
this.resizeObserver.disconnect();
|
|
116
120
|
this.visibleItems = [];
|
|
117
121
|
this.scrolledToTarget = false;
|
|
118
122
|
this.scrollDebouncer.run(() => {
|
|
119
|
-
var _a
|
|
123
|
+
var _a;
|
|
120
124
|
let internalScrollToIndex = (_a = this.scrollToIndex) !== null && _a !== void 0 ? _a : (this.scrollToItem ? this.items.indexOf(this.scrollToItem) : -1);
|
|
121
125
|
if (internalScrollToIndex >= this.items.length) {
|
|
122
126
|
internalScrollToIndex = -1;
|
|
123
127
|
}
|
|
124
|
-
let target =
|
|
128
|
+
let target = this.getItem(internalScrollToIndex);
|
|
125
129
|
this.scrollToTarget(target);
|
|
126
130
|
this.onMutation();
|
|
127
|
-
|
|
131
|
+
this.scrollDoneDebouncer.run(() => {
|
|
128
132
|
this.scrolledToTarget = true;
|
|
129
|
-
}
|
|
133
|
+
});
|
|
130
134
|
});
|
|
131
135
|
}
|
|
136
|
+
getItem(index) {
|
|
137
|
+
var _a;
|
|
138
|
+
return (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`#item-${index}`);
|
|
139
|
+
}
|
|
132
140
|
scrollToTarget(target) {
|
|
133
141
|
var _a;
|
|
134
142
|
if (target) {
|
|
135
143
|
let index = +((_a = target.getAttribute("data-item-index")) !== null && _a !== void 0 ? _a : "0");
|
|
136
|
-
if (this.scrollable) {
|
|
137
|
-
this.scrollable.scrollTop =
|
|
144
|
+
if (this.scrollable && index === 0) {
|
|
145
|
+
this.scrollable.scrollTop = 0;
|
|
138
146
|
}
|
|
139
147
|
else {
|
|
140
148
|
target.scrollIntoView({ block: "start" });
|
|
@@ -161,26 +169,51 @@ export class FtInfiniteScroll extends FtLitElement {
|
|
|
161
169
|
super.connectedCallback();
|
|
162
170
|
setTimeout(() => {
|
|
163
171
|
this.triggerFindScrollableParent();
|
|
164
|
-
this.
|
|
165
|
-
this.intersectionObserver = new IntersectionObserver(this.onVisibilityChange, {
|
|
166
|
-
rootMargin: "-2px",
|
|
167
|
-
threshold: [0, 0.01, 0.1]
|
|
168
|
-
});
|
|
172
|
+
this.initIntersectionObserver();
|
|
169
173
|
this.mutationObserver.disconnect();
|
|
170
174
|
this.mutationObserver.observe(this.itemsContainer, { childList: true });
|
|
171
175
|
}, 0);
|
|
172
176
|
}
|
|
177
|
+
initIntersectionObserver() {
|
|
178
|
+
this.intersectionObserver.disconnect();
|
|
179
|
+
this.intersectionObserver = new IntersectionObserver(this.onVisibilityChange, {
|
|
180
|
+
root: this.scrollable,
|
|
181
|
+
rootMargin: "-8px",
|
|
182
|
+
threshold: [0, 0.01, 0.1]
|
|
183
|
+
});
|
|
184
|
+
}
|
|
173
185
|
triggerFindScrollableParent() {
|
|
174
|
-
|
|
186
|
+
var _a;
|
|
187
|
+
(_a = this.itemsContainer) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new Event("find-scrollable-parent", { composed: true }));
|
|
175
188
|
}
|
|
176
189
|
findScrollableParent(e) {
|
|
177
190
|
e.stopPropagation();
|
|
191
|
+
let scrollable, maybeScrollable;
|
|
178
192
|
for (let target of e.composedPath()) {
|
|
179
193
|
const element = target;
|
|
180
|
-
|
|
181
|
-
|
|
194
|
+
const mayScroll = this.elementCanScroll(element);
|
|
195
|
+
const definitelyScrolls = element.clientHeight && element.clientHeight < element.scrollHeight && mayScroll;
|
|
196
|
+
if (definitelyScrolls) {
|
|
197
|
+
scrollable = element;
|
|
182
198
|
break;
|
|
183
199
|
}
|
|
200
|
+
else if (mayScroll) {
|
|
201
|
+
maybeScrollable = element;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
let newScrollable = scrollable || maybeScrollable;
|
|
205
|
+
if (newScrollable !== this.firstScrollableParent) {
|
|
206
|
+
this.firstScrollableParent = newScrollable;
|
|
207
|
+
this.initIntersectionObserver();
|
|
208
|
+
this.resetScroll();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
elementCanScroll(element) {
|
|
212
|
+
try {
|
|
213
|
+
return ["auto", "scroll"].includes(getComputedStyle(element).overflowY);
|
|
214
|
+
}
|
|
215
|
+
catch (e) {
|
|
216
|
+
return false;
|
|
184
217
|
}
|
|
185
218
|
}
|
|
186
219
|
disconnectedCallback() {
|
|
@@ -198,7 +231,7 @@ export class FtInfiniteScroll extends FtLitElement {
|
|
|
198
231
|
if (props.has("items")) {
|
|
199
232
|
this.alreadyRenderedIndexes = new Set();
|
|
200
233
|
}
|
|
201
|
-
if (props.has("scrollToItem") || props.has("scrollToIndex")) {
|
|
234
|
+
if (props.has("scrollToItem") || props.has("scrollToIndex") && (this.scrollToItem != null || this.scrollToIndex != null)) {
|
|
202
235
|
this.resetScroll();
|
|
203
236
|
}
|
|
204
237
|
}
|
|
@@ -207,7 +240,7 @@ export class FtInfiniteScroll extends FtLitElement {
|
|
|
207
240
|
if (props.has("visibleItems") || props.has("items")) {
|
|
208
241
|
this.dispatchEvent(new VisibleItemsChangeEvent(this.visibleItems, this.visibleItems.map(index => this.items[index])));
|
|
209
242
|
}
|
|
210
|
-
if (props.has("scrolledToTarget") && this.scrolledToTarget) {
|
|
243
|
+
if (props.has("scrolledToTarget") && this.scrolledToTarget && (this.scrollToItem != null || this.scrollToIndex != null)) {
|
|
211
244
|
this.dispatchEvent(new ScrolledToTargetEvent());
|
|
212
245
|
}
|
|
213
246
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
!function(t,e,i,s,l,
|
|
1
|
+
!function(t,e,i,s,l,n){const r={padding:e.FtCssVariableFactory.create("--ft-infinite-scroll-padding","SIZE","0")},o=i.css`
|
|
2
2
|
.items-container {
|
|
3
3
|
position: relative;
|
|
4
|
-
padding: ${
|
|
4
|
+
padding: ${r.padding};
|
|
5
5
|
outline: none;
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
margin-top: 4px;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.scrollable .item-container {
|
|
28
|
-
height: 100%;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
27
|
.resizable:not(.rendered) {
|
|
32
28
|
width: 0;
|
|
33
29
|
}
|
|
@@ -35,18 +31,18 @@
|
|
|
35
31
|
.rendered {
|
|
36
32
|
display: flow-root;
|
|
37
33
|
}
|
|
38
|
-
`;var h=function(t,e,i,s){for(var l,
|
|
34
|
+
`;var h=function(t,e,i,s){for(var l,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,o=t.length-1;o>=0;o--)(l=t[o])&&(r=(n<3?l(r):n>3?l(e,i,r):l(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class a extends CustomEvent{constructor(t,e){super("visible-items-change",{detail:{visibleIndexes:t,visibleItems:e}})}}class d extends Event{constructor(){super("scrolled-to-target")}}class c extends e.FtLitElement{constructor(){super(...arguments),this.items=[],this.renderItem=()=>i.html``,this.internalScroll=!1,this.renderBeforeFirst=1,this.renderAfterLast=1,this.visibleItems=[],this.scrolledToTarget=!1,this.alreadyRenderedIndexes=new Set,this.scrollDebouncer=new e.Debouncer(5),this.scrollDoneDebouncer=new e.Debouncer(10),this.onVisibilityChange=t=>{const e=t.filter((t=>t.intersectionRect.height>1)).map((t=>+t.target.attributes.getNamedItem("data-item-index").value)).filter((t=>!this.visibleItems.includes(t))),i=t.filter((t=>t.intersectionRect.height<=1)).map((t=>+t.target.attributes.getNamedItem("data-item-index").value)).filter((t=>this.visibleItems.includes(t))),s=[...this.visibleItems].filter((t=>!i.includes(t)));this.visibleItems=[...e,...s].sort(((t,e)=>t-e))},this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange),this.onResize=t=>{var e;this.triggerFindScrollableParent(),t=t.sort(((t,e)=>t.contentRect.top-e.contentRect.top));for(const i of t){const t=+i.target.parentElement.getAttribute("data-item-index"),s=i.target.parentElement.clientHeight,l=i.contentRect.height;if(this.alreadyRenderedIndexes.has(t)){if(this.scrollable){"none"===(null!==(e=getComputedStyle(this.scrollable).overflowAnchor)&&void 0!==e?e:"none")&&this.getOffset(i.target.parentElement)+s<this.scrollable.scrollTop&&(this.scrollable.scrollTop+=Math.ceil(l-s))}i.target.parentElement.style.height=l+"px"}}},this.resizeObserver=new ResizeObserver(this.onResize),this.onMutation=()=>{[...this.itemsContainer.children].forEach((t=>{this.intersectionObserver.observe(t),this.resizeObserver.observe(t.children.item(0))}))},this.mutationObserver=new MutationObserver(this.onMutation)}get scrollable(){return this.internalScroll?this.internalScrollable:this.firstScrollableParent}render(){return i.html`
|
|
39
35
|
<div class="items-container ${this.internalScroll?"scrollable":""}"
|
|
40
36
|
tabindex="-1"
|
|
41
37
|
@find-scrollable-parent=${this.findScrollableParent}>
|
|
42
38
|
${l.repeat(this.items,((t,e)=>this.renderItemContainer(t,e)))}
|
|
43
39
|
</div>
|
|
44
|
-
`}renderItemContainer(t,e){const s=this.scrolledToTarget&&this.visibleItems.includes(e),l=this.alreadyRenderedIndexes.has(e)||this.scrolledToTarget&&e>=this.visibleItems[0]-this.renderBeforeFirst&&e<=(null!=(
|
|
40
|
+
`}renderItemContainer(t,e){const s=this.scrolledToTarget&&this.visibleItems.includes(e),l=this.alreadyRenderedIndexes.has(e)||this.scrolledToTarget&&e>=this.visibleItems[0]-this.renderBeforeFirst&&e<=(null!=(r=this.visibleItems)?r:[])[(null!=r?r:[]).length-1]+this.renderAfterLast;var r;l&&this.alreadyRenderedIndexes.add(e);return i.html`
|
|
45
41
|
<div id="item-${e}"
|
|
46
42
|
class="item-container"
|
|
47
43
|
data-item-index="${e}">
|
|
48
44
|
<div class="resizable ${s?"visible":""} ${l?"rendered":""}">
|
|
49
|
-
${l?(()=>{const s=this.renderItem(t,e);return"string"==typeof s?i.html`${
|
|
45
|
+
${l?(()=>{const s=this.renderItem(t,e);return"string"==typeof s?i.html`${n.unsafeHTML(s)}`:s})():null}
|
|
50
46
|
</div>
|
|
51
47
|
</div>
|
|
52
|
-
`}resetScroll(){this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.visibleItems=[],this.scrolledToTarget=!1,this.scrollDebouncer.run((()=>{var t
|
|
48
|
+
`}resetScroll(){this.triggerFindScrollableParent(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.visibleItems=[],this.scrolledToTarget=!1,this.scrollDebouncer.run((()=>{var t;let e=null!==(t=this.scrollToIndex)&&void 0!==t?t:this.scrollToItem?this.items.indexOf(this.scrollToItem):-1;e>=this.items.length&&(e=-1);let i=this.getItem(e);this.scrollToTarget(i),this.onMutation(),this.scrollDoneDebouncer.run((()=>{this.scrolledToTarget=!0}))}))}getItem(t){var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(`#item-${t}`)}scrollToTarget(t){var e;if(t){let i=+(null!==(e=t.getAttribute("data-item-index"))&&void 0!==e?e:"0");this.scrollable&&0===i?this.scrollable.scrollTop=0:t.scrollIntoView({block:"start"})}}getOffset(t){var e;let i=0,s=t;for(;s&&s.offsetParent!==this.scrollable.offsetParent;)i+=s.offsetTop,s=s.offsetParent;return i+(null!==(e=null==s?void 0:s.offsetTop)&&void 0!==e?e:0)-this.scrollable.offsetTop}appendItems(...t){this.items=[...this.items,...t]}prependItems(...t){this.items=[...t,...this.items]}connectedCallback(){super.connectedCallback(),setTimeout((()=>{this.triggerFindScrollableParent(),this.initIntersectionObserver(),this.mutationObserver.disconnect(),this.mutationObserver.observe(this.itemsContainer,{childList:!0})}),0)}initIntersectionObserver(){this.intersectionObserver.disconnect(),this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange,{root:this.scrollable,rootMargin:"-8px",threshold:[0,.01,.1]})}triggerFindScrollableParent(){var t;null===(t=this.itemsContainer)||void 0===t||t.dispatchEvent(new Event("find-scrollable-parent",{composed:!0}))}findScrollableParent(t){let e,i;t.stopPropagation();for(let s of t.composedPath()){const t=s,l=this.elementCanScroll(t);if(t.clientHeight&&t.clientHeight<t.scrollHeight&&l){e=t;break}l&&(i=t)}let s=e||i;s!==this.firstScrollableParent&&(this.firstScrollableParent=s,this.initIntersectionObserver(),this.resetScroll())}elementCanScroll(t){try{return["auto","scroll"].includes(getComputedStyle(t).overflowY)}catch(t){return!1}}disconnectedCallback(){super.disconnectedCallback(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.mutationObserver.disconnect()}firstUpdated(t){super.firstUpdated(t),this.resetScroll()}update(t){super.update(t),t.has("items")&&(this.alreadyRenderedIndexes=new Set),(t.has("scrollToItem")||t.has("scrollToIndex")&&(null!=this.scrollToItem||null!=this.scrollToIndex))&&this.resetScroll()}updated(t){super.updated(t),(t.has("visibleItems")||t.has("items"))&&this.dispatchEvent(new a(this.visibleItems,this.visibleItems.map((t=>this.items[t])))),t.has("scrolledToTarget")&&this.scrolledToTarget&&(null!=this.scrollToItem||null!=this.scrollToIndex)&&this.dispatchEvent(new d)}}c.styles=o,h([s.property({type:Array})],c.prototype,"items",void 0),h([s.property({attribute:!1})],c.prototype,"renderItem",void 0),h([s.property({type:Object})],c.prototype,"scrollToItem",void 0),h([s.property({type:Number})],c.prototype,"scrollToIndex",void 0),h([s.property({type:Boolean})],c.prototype,"internalScroll",void 0),h([s.property({type:Number})],c.prototype,"renderBeforeFirst",void 0),h([s.property({type:Number})],c.prototype,"renderAfterLast",void 0),h([s.state({hasChanged:(t,e)=>null!=t&&null==e||t.length!==e.length||t[0]!==e[0]})],c.prototype,"visibleItems",void 0),h([s.query(".scrollable")],c.prototype,"internalScrollable",void 0),h([s.query(".items-container")],c.prototype,"itemsContainer",void 0),h([s.state()],c.prototype,"scrolledToTarget",void 0),e.customElement("ft-infinite-scroll")(c),t.FtInfiniteScroll=c,t.FtInfiniteScrollCssVariables=r,t.ScrolledToTargetEvent=d,t.VisibleItemsChangeEvent=a,t.styles=o,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litRepeat,ftGlobals.litUnsafeHTML);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @see https://github.com/webcomponents/polyfills/tree/master/packages/scoped-custom-element-registry
|
|
16
16
|
*/
|
|
17
|
-
if(!ShadowRoot.prototype.createElement){const t=window.HTMLElement,e=window.customElements.define,i=window.customElements.get,s=window.customElements,n=new WeakMap,o=new WeakMap,r=new WeakMap,l=new WeakMap;let a;window.CustomElementRegistry=class{constructor(){this._definitionsByTag=new Map,this._definitionsByClass=new Map,this._whenDefinedPromises=new Map,this._awaitingUpgrade=new Map}define(t,n){if(t=t.toLowerCase(),void 0!==this._getDefinition(t))throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(void 0!==this._definitionsByClass.get(n))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");const l=n.prototype.attributeChangedCallback,a=new Set(n.observedAttributes||[]);u(n,a,l);const h={elementClass:n,connectedCallback:n.prototype.connectedCallback,disconnectedCallback:n.prototype.disconnectedCallback,adoptedCallback:n.prototype.adoptedCallback,attributeChangedCallback:l,formAssociated:n.formAssociated,formAssociatedCallback:n.prototype.formAssociatedCallback,formDisabledCallback:n.prototype.formDisabledCallback,formResetCallback:n.prototype.formResetCallback,formStateRestoreCallback:n.prototype.formStateRestoreCallback,observedAttributes:a};this._definitionsByTag.set(t,h),this._definitionsByClass.set(n,h);let c=i.call(s,t);c||(c=d(t),e.call(s,t,c)),this===window.customElements&&(r.set(n,h),h.standInClass=c);const p=this._awaitingUpgrade.get(t);if(p){this._awaitingUpgrade.delete(t);for(const t of p)o.delete(t),f(t,h,!0)}const v=this._whenDefinedPromises.get(t);return void 0!==v&&(v.resolve(n),this._whenDefinedPromises.delete(t)),n}upgrade(){b.push(this),s.upgrade.apply(s,arguments),b.pop()}get(t){return this._definitionsByTag.get(t)?.elementClass}_getDefinition(t){return this._definitionsByTag.get(t)}whenDefined(t){const e=this._getDefinition(t);if(void 0!==e)return Promise.resolve(e.elementClass);let i=this._whenDefinedPromises.get(t);return void 0===i&&(i={},i.promise=new Promise((t=>i.resolve=t)),this._whenDefinedPromises.set(t,i)),i.promise}_upgradeWhenDefined(t,e,i){let s=this._awaitingUpgrade.get(e);s||this._awaitingUpgrade.set(e,s=new Set),i?s.add(t):s.delete(t)}},window.HTMLElement=function(){let e=a;if(e)return a=void 0,e;const i=r.get(this.constructor);if(!i)throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)");return e=Reflect.construct(t,[],i.standInClass),Object.setPrototypeOf(e,this.constructor.prototype),n.set(e,i),e},window.HTMLElement.prototype=t.prototype;const h=t=>t===document||t instanceof ShadowRoot,c=t=>{let e=t.getRootNode();if(!h(e)){const t=b[b.length-1];if(t instanceof CustomElementRegistry)return t;e=t.getRootNode(),h(e)||(e=l.get(e)?.getRootNode()||document)}return e.customElements},d=e=>class{static get formAssociated(){return!0}constructor(){const i=Reflect.construct(t,[],this.constructor);Object.setPrototypeOf(i,HTMLElement.prototype);const s=c(i)||window.customElements,n=s._getDefinition(e);return n?f(i,n):o.set(i,s),i}connectedCallback(){const t=n.get(this);t?t.connectedCallback&&t.connectedCallback.apply(this,arguments):o.get(this)._upgradeWhenDefined(this,e,!0)}disconnectedCallback(){const t=n.get(this);t?t.disconnectedCallback&&t.disconnectedCallback.apply(this,arguments):o.get(this)._upgradeWhenDefined(this,e,!1)}adoptedCallback(){n.get(this)?.adoptedCallback?.apply(this,arguments)}formAssociatedCallback(){const t=n.get(this);t&&t.formAssociated&&t?.formAssociatedCallback?.apply(this,arguments)}formDisabledCallback(){const t=n.get(this);t?.formAssociated&&t?.formDisabledCallback?.apply(this,arguments)}formResetCallback(){const t=n.get(this);t?.formAssociated&&t?.formResetCallback?.apply(this,arguments)}formStateRestoreCallback(){const t=n.get(this);t?.formAssociated&&t?.formStateRestoreCallback?.apply(this,arguments)}},u=(t,e,i)=>{if(0===e.size||void 0===i)return;const s=t.prototype.setAttribute;s&&(t.prototype.setAttribute=function(t,n){const o=t.toLowerCase();if(e.has(o)){const t=this.getAttribute(o);s.call(this,o,n),i.call(this,o,t,n)}else s.call(this,o,n)});const n=t.prototype.removeAttribute;n&&(t.prototype.removeAttribute=function(t){const s=t.toLowerCase();if(e.has(s)){const t=this.getAttribute(s);n.call(this,s),i.call(this,s,t,null)}else n.call(this,s)})},p=e=>{const i=Object.getPrototypeOf(e);if(i!==window.HTMLElement)return i===t||"HTMLElement"===i?.prototype?.constructor?.name?Object.setPrototypeOf(e,window.HTMLElement):p(i)},f=(t,e,i=!1)=>{Object.setPrototypeOf(t,e.elementClass.prototype),n.set(t,e),a=t;try{new e.elementClass}catch(t){p(e.elementClass),new e.elementClass}e.observedAttributes.forEach((i=>{t.hasAttribute(i)&&e.attributeChangedCallback.call(t,i,null,t.getAttribute(i))})),i&&e.connectedCallback&&t.isConnected&&e.connectedCallback.call(t)},v=Element.prototype.attachShadow;Element.prototype.attachShadow=function(t){const e=v.apply(this,arguments);return t.customElements&&(e.customElements=t.customElements),e};let b=[document];const m=(t,e,i)=>{const s=(i?Object.getPrototypeOf(i):t.prototype)[e];t.prototype[e]=function(){b.push(this);const t=s.apply(i||this,arguments);return void 0!==t&&l.set(t,this),b.pop(),t}};m(ShadowRoot,"createElement",document),m(ShadowRoot,"importNode",document),m(Element,"insertAdjacentHTML");const x=(t,e)=>{const i=Object.getOwnPropertyDescriptor(t.prototype,e);Object.defineProperty(t.prototype,e,{...i,set(t){b.push(this),i.set.call(this,t),b.pop()}})};if(x(Element,"innerHTML"),x(ShadowRoot,"innerHTML"),Object.defineProperty(window,"customElements",{value:new CustomElementRegistry,configurable:!0,writable:!0}),window.ElementInternals&&window.ElementInternals.prototype.setFormValue){const t=new WeakMap,e=HTMLElement.prototype.attachInternals,i=["setFormValue","setValidity","checkValidity","reportValidity"];HTMLElement.prototype.attachInternals=function(...i){const s=e.call(this,...i);return t.set(s,this),s},i.forEach((e=>{const i=window.ElementInternals.prototype,s=i[e];i[e]=function(...e){const i=t.get(this);if(!0!==n.get(i).formAssociated)throw new DOMException(`Failed to execute ${s} on 'ElementInternals': The target element is not a form-associated custom element.`);s?.call(this,...e)}}));class s extends Array{constructor(t){super(...t),this._elements=t}get value(){return this._elements.find((t=>!0===t.checked))?.value||""}}class o{constructor(t){const e=new Map;t.forEach(((t,i)=>{const s=t.getAttribute("name"),n=e.get(s)||[];this[+i]=t,n.push(t),e.set(s,n)})),this.length=t.length,e.forEach(((t,e)=>{t&&(1===t.length?this[e]=t[0]:this[e]=new s(t))}))}namedItem(t){return this[t]}}const r=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get:function(){const t=r.get.call(this,[]),e=[];for(const i of t){const t=n.get(i);t&&!0!==t.formAssociated||e.push(i)}return new o(e)}})}}try{window.customElements.define("custom-element",null)}catch(
|
|
17
|
+
if(!ShadowRoot.prototype.createElement){const t=window.HTMLElement,e=window.customElements.define,i=window.customElements.get,s=window.customElements,n=new WeakMap,o=new WeakMap,r=new WeakMap,l=new WeakMap;let a;window.CustomElementRegistry=class{constructor(){this._definitionsByTag=new Map,this._definitionsByClass=new Map,this._whenDefinedPromises=new Map,this._awaitingUpgrade=new Map}define(t,n){if(t=t.toLowerCase(),void 0!==this._getDefinition(t))throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(void 0!==this._definitionsByClass.get(n))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");const l=n.prototype.attributeChangedCallback,a=new Set(n.observedAttributes||[]);u(n,a,l);const h={elementClass:n,connectedCallback:n.prototype.connectedCallback,disconnectedCallback:n.prototype.disconnectedCallback,adoptedCallback:n.prototype.adoptedCallback,attributeChangedCallback:l,formAssociated:n.formAssociated,formAssociatedCallback:n.prototype.formAssociatedCallback,formDisabledCallback:n.prototype.formDisabledCallback,formResetCallback:n.prototype.formResetCallback,formStateRestoreCallback:n.prototype.formStateRestoreCallback,observedAttributes:a};this._definitionsByTag.set(t,h),this._definitionsByClass.set(n,h);let c=i.call(s,t);c||(c=d(t),e.call(s,t,c)),this===window.customElements&&(r.set(n,h),h.standInClass=c);const p=this._awaitingUpgrade.get(t);if(p){this._awaitingUpgrade.delete(t);for(const t of p)o.delete(t),f(t,h,!0)}const v=this._whenDefinedPromises.get(t);return void 0!==v&&(v.resolve(n),this._whenDefinedPromises.delete(t)),n}upgrade(){b.push(this),s.upgrade.apply(s,arguments),b.pop()}get(t){return this._definitionsByTag.get(t)?.elementClass}_getDefinition(t){return this._definitionsByTag.get(t)}whenDefined(t){const e=this._getDefinition(t);if(void 0!==e)return Promise.resolve(e.elementClass);let i=this._whenDefinedPromises.get(t);return void 0===i&&(i={},i.promise=new Promise((t=>i.resolve=t)),this._whenDefinedPromises.set(t,i)),i.promise}_upgradeWhenDefined(t,e,i){let s=this._awaitingUpgrade.get(e);s||this._awaitingUpgrade.set(e,s=new Set),i?s.add(t):s.delete(t)}},window.HTMLElement=function(){let e=a;if(e)return a=void 0,e;const i=r.get(this.constructor);if(!i)throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)");return e=Reflect.construct(t,[],i.standInClass),Object.setPrototypeOf(e,this.constructor.prototype),n.set(e,i),e},window.HTMLElement.prototype=t.prototype;const h=t=>t===document||t instanceof ShadowRoot,c=t=>{let e=t.getRootNode();if(!h(e)){const t=b[b.length-1];if(t instanceof CustomElementRegistry)return t;e=t.getRootNode(),h(e)||(e=l.get(e)?.getRootNode()||document)}return e.customElements},d=e=>class{static get formAssociated(){return!0}constructor(){const i=Reflect.construct(t,[],this.constructor);Object.setPrototypeOf(i,HTMLElement.prototype);const s=c(i)||window.customElements,n=s._getDefinition(e);return n?f(i,n):o.set(i,s),i}connectedCallback(){const t=n.get(this);t?t.connectedCallback&&t.connectedCallback.apply(this,arguments):o.get(this)._upgradeWhenDefined(this,e,!0)}disconnectedCallback(){const t=n.get(this);t?t.disconnectedCallback&&t.disconnectedCallback.apply(this,arguments):o.get(this)._upgradeWhenDefined(this,e,!1)}adoptedCallback(){n.get(this)?.adoptedCallback?.apply(this,arguments)}formAssociatedCallback(){const t=n.get(this);t&&t.formAssociated&&t?.formAssociatedCallback?.apply(this,arguments)}formDisabledCallback(){const t=n.get(this);t?.formAssociated&&t?.formDisabledCallback?.apply(this,arguments)}formResetCallback(){const t=n.get(this);t?.formAssociated&&t?.formResetCallback?.apply(this,arguments)}formStateRestoreCallback(){const t=n.get(this);t?.formAssociated&&t?.formStateRestoreCallback?.apply(this,arguments)}},u=(t,e,i)=>{if(0===e.size||void 0===i)return;const s=t.prototype.setAttribute;s&&(t.prototype.setAttribute=function(t,n){const o=t.toLowerCase();if(e.has(o)){const t=this.getAttribute(o);s.call(this,o,n),i.call(this,o,t,n)}else s.call(this,o,n)});const n=t.prototype.removeAttribute;n&&(t.prototype.removeAttribute=function(t){const s=t.toLowerCase();if(e.has(s)){const t=this.getAttribute(s);n.call(this,s),i.call(this,s,t,null)}else n.call(this,s)})},p=e=>{const i=Object.getPrototypeOf(e);if(i!==window.HTMLElement)return i===t||"HTMLElement"===i?.prototype?.constructor?.name?Object.setPrototypeOf(e,window.HTMLElement):p(i)},f=(t,e,i=!1)=>{Object.setPrototypeOf(t,e.elementClass.prototype),n.set(t,e),a=t;try{new e.elementClass}catch(t){p(e.elementClass),new e.elementClass}e.observedAttributes.forEach((i=>{t.hasAttribute(i)&&e.attributeChangedCallback.call(t,i,null,t.getAttribute(i))})),i&&e.connectedCallback&&t.isConnected&&e.connectedCallback.call(t)},v=Element.prototype.attachShadow;Element.prototype.attachShadow=function(t){const e=v.apply(this,arguments);return t.customElements&&(e.customElements=t.customElements),e};let b=[document];const m=(t,e,i)=>{const s=(i?Object.getPrototypeOf(i):t.prototype)[e];t.prototype[e]=function(){b.push(this);const t=s.apply(i||this,arguments);return void 0!==t&&l.set(t,this),b.pop(),t}};m(ShadowRoot,"createElement",document),m(ShadowRoot,"importNode",document),m(Element,"insertAdjacentHTML");const x=(t,e)=>{const i=Object.getOwnPropertyDescriptor(t.prototype,e);Object.defineProperty(t.prototype,e,{...i,set(t){b.push(this),i.set.call(this,t),b.pop()}})};if(x(Element,"innerHTML"),x(ShadowRoot,"innerHTML"),Object.defineProperty(window,"customElements",{value:new CustomElementRegistry,configurable:!0,writable:!0}),window.ElementInternals&&window.ElementInternals.prototype.setFormValue){const t=new WeakMap,e=HTMLElement.prototype.attachInternals,i=["setFormValue","setValidity","checkValidity","reportValidity"];HTMLElement.prototype.attachInternals=function(...i){const s=e.call(this,...i);return t.set(s,this),s},i.forEach((e=>{const i=window.ElementInternals.prototype,s=i[e];i[e]=function(...e){const i=t.get(this);if(!0!==n.get(i).formAssociated)throw new DOMException(`Failed to execute ${s} on 'ElementInternals': The target element is not a form-associated custom element.`);s?.call(this,...e)}}));class s extends Array{constructor(t){super(...t),this._elements=t}get value(){return this._elements.find((t=>!0===t.checked))?.value||""}}class o{constructor(t){const e=new Map;t.forEach(((t,i)=>{const s=t.getAttribute("name"),n=e.get(s)||[];this[+i]=t,n.push(t),e.set(s,n)})),this.length=t.length,e.forEach(((t,e)=>{t&&(1===t.length?this[e]=t[0]:this[e]=new s(t))}))}namedItem(t){return this[t]}}const r=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get:function(){const t=r.get.call(this,[]),e=[];for(const i of t){const t=n.get(i);t&&!0!==t.formAssociated||e.push(i)}return new o(e)}})}}try{window.customElements.define("custom-element",null)}catch(St){const t=window.customElements.define;window.customElements.define=(e,i,s)=>{try{t.bind(window.customElements)(e,i,s)}catch(t){console.info(e,i,s,t)}}}class e{constructor(t=0){this.timeout=t,this.callbacks=[]}run(t,e){this.callbacks=[t],this.debounce(e)}queue(t,e){this.callbacks.push(t),this.debounce(e)}cancel(){null!=this._debounce&&window.clearTimeout(this._debounce)}debounce(t){this.cancel(),this._debounce=window.setTimeout((()=>this.runCallbacks()),null!=t?t:this.timeout)}runCallbacks(){for(let t of this.callbacks)t();this.callbacks=[]}}
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
@@ -51,19 +51,19 @@ const l=window,a=l.ShadowRoot&&(void 0===l.ShadyCSS||l.ShadyCSS.nativeShadow)&&"
|
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright 2017 Google LLC
|
|
53
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
-
*/;var b;const m=window,x=m.trustedTypes,w=x?x.emptyScript:"",
|
|
54
|
+
*/;var b;const m=window,x=m.trustedTypes,w=x?x.emptyScript:"",y=m.reactiveElementPolyfillSupport,g={toAttribute(t,e){switch(e){case Boolean:t=t?w:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},O=(t,e)=>e!==t&&(e==e||t==t),N={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:O};class C extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;null!==(e=this.h)&&void 0!==e||(this.h=[]),this.h.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Ep(i,e);void 0!==s&&(this._$Ev.set(s,i),t.push(s))})),t}static createProperty(t,e=N){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const n=this[t];this[e]=s,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||N}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(v(t))}else void 0!==t&&e.push(v(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return f(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=N){var s;const n=this.constructor._$Ep(t,i);if(void 0!==n&&!0===i.reflect){const o=(void 0!==(null===(s=i.converter)||void 0===s?void 0:s.toAttribute)?i.converter:g).toAttribute(e,i.type);this._$El=t,null==o?this.removeAttribute(n):this.setAttribute(n,o),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,n=s._$Ev.get(t);if(void 0!==n&&this._$El!==n){const t=s.getPropertyOptions(n),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:g;this._$El=n,this[n]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||O)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}
|
|
55
55
|
/**
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright 2017 Google LLC
|
|
58
58
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
59
|
*/
|
|
60
|
-
var
|
|
60
|
+
var E;C.finalized=!0,C.elementProperties=new Map,C.elementStyles=[],C.shadowRootOptions={mode:"open"},null==y||y({ReactiveElement:C}),(null!==(b=m.reactiveElementVersions)&&void 0!==b?b:m.reactiveElementVersions=[]).push("1.4.1");const $=window,R=$.trustedTypes,S=R?R.createPolicy("lit-html",{createHTML:t=>t}):void 0,M=`lit$${(Math.random()+"").slice(9)}$`,k="?"+M,U=`<${k}>`,A=document,F=(t="")=>A.createComment(t),L=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,_=t=>T(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,B=/-->/g,I=/>/g,W=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),K=/'/g,D=/"/g,z=/^(?:script|style|textarea|title)$/i,H=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),P=Symbol.for("lit-noChange"),Z=Symbol.for("lit-nothing"),J=new WeakMap,V=A.createTreeWalker(A,129,null,!1),q=(t,e)=>{const i=t.length-1,s=[];let n,o=2===e?"<svg>":"",r=j;for(let e=0;e<i;e++){const i=t[e];let l,a,h=-1,c=0;for(;c<i.length&&(r.lastIndex=c,a=r.exec(i),null!==a);)c=r.lastIndex,r===j?"!--"===a[1]?r=B:void 0!==a[1]?r=I:void 0!==a[2]?(z.test(a[2])&&(n=RegExp("</"+a[2],"g")),r=W):void 0!==a[3]&&(r=W):r===W?">"===a[0]?(r=null!=n?n:j,h=-1):void 0===a[1]?h=-2:(h=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?W:'"'===a[3]?D:K):r===D||r===K?r=W:r===B||r===I?r=j:(r=W,n=void 0);const d=r===W&&t[e+1].startsWith("/>")?" ":"";o+=r===j?i+U:h>=0?(s.push(l),i.slice(0,h)+"$lit$"+i.slice(h)+M+d):i+M+(-2===h?(s.push(void 0),e):d)}const l=o+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==S?S.createHTML(l):l,s]};class X{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const r=t.length-1,l=this.parts,[a,h]=q(t,e);if(this.el=X.createElement(a,i),V.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=V.nextNode())&&l.length<r;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(M)){const i=h[o++];if(t.push(e),void 0!==i){const t=s.getAttribute(i.toLowerCase()+"$lit$").split(M),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:n,name:e[2],strings:t,ctor:"."===e[1]?et:"?"===e[1]?st:"@"===e[1]?nt:tt})}else l.push({type:6,index:n})}for(const e of t)s.removeAttribute(e)}if(z.test(s.tagName)){const t=s.textContent.split(M),e=t.length-1;if(e>0){s.textContent=R?R.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],F()),V.nextNode(),l.push({type:2,index:++n});s.append(t[e],F())}}}else if(8===s.nodeType)if(s.data===k)l.push({type:2,index:n});else{let t=-1;for(;-1!==(t=s.data.indexOf(M,t+1));)l.push({type:7,index:n}),t+=M.length-1}n++}}static createElement(t,e){const i=A.createElement("template");return i.innerHTML=t,i}}function G(t,e,i=t,s){var n,o,r,l;if(e===P)return e;let a=void 0!==s?null===(n=i._$Co)||void 0===n?void 0:n[s]:i._$Cl;const h=L(e)?void 0:e._$litDirective$;return(null==a?void 0:a.constructor)!==h&&(null===(o=null==a?void 0:a._$AO)||void 0===o||o.call(a,!1),void 0===h?a=void 0:(a=new h(t),a._$AT(t,i,s)),void 0!==s?(null!==(r=(l=i)._$Co)&&void 0!==r?r:l._$Co=[])[s]=a:i._$Cl=a),void 0!==a&&(e=G(t,a._$AS(t,e.values),a,s)),e}class Q{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:s}=this._$AD,n=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:A).importNode(i,!0);V.currentNode=n;let o=V.nextNode(),r=0,l=0,a=s[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new Y(o,o.nextSibling,this,t):1===a.type?e=new a.ctor(o,a.name,a.strings,this,t):6===a.type&&(e=new ot(o,this,t)),this.u.push(e),a=s[++l]}r!==(null==a?void 0:a.index)&&(o=V.nextNode(),r++)}return n}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Y{constructor(t,e,i,s){var n;this.type=2,this._$AH=Z,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cm=null===(n=null==s?void 0:s.isConnected)||void 0===n||n}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=G(this,t,e),L(t)?t===Z||null==t||""===t?(this._$AH!==Z&&this._$AR(),this._$AH=Z):t!==this._$AH&&t!==P&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):_(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==Z&&L(this._$AH)?this._$AA.nextSibling.data=t:this.T(A.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=X.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===n)this._$AH.p(i);else{const t=new Q(n,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=J.get(t.strings);return void 0===e&&J.set(t.strings,e=new X(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new Y(this.O(F()),this.O(F()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class tt{constructor(t,e,i,s,n){this.type=1,this._$AH=Z,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Z}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=G(this,t,e,0),o=!L(t)||t!==this._$AH&&t!==P,o&&(this._$AH=t);else{const s=t;let r,l;for(t=n[0],r=0;r<n.length-1;r++)l=G(this,s[i+r],e,r),l===P&&(l=this._$AH[r]),o||(o=!L(l)||l!==this._$AH[r]),l===Z?t=Z:t!==Z&&(t+=(null!=l?l:"")+n[r+1]),this._$AH[r]=l}o&&!s&&this.j(t)}j(t){t===Z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class et extends tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Z?void 0:t}}const it=R?R.emptyScript:"";class st extends tt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==Z?this.element.setAttribute(this.name,it):this.element.removeAttribute(this.name)}}class nt extends tt{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=G(this,t,e,0))&&void 0!==i?i:Z)===P)return;const s=this._$AH,n=t===Z&&s!==Z||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==Z&&(s===Z||n);n&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class ot{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){G(this,t)}}const rt={P:"$lit$",A:M,M:k,C:1,L:q,R:Q,D:_,V:G,I:Y,H:tt,N:st,U:nt,B:et,F:ot},lt=$.litHtmlPolyfillSupport;null==lt||lt(X,Y),(null!==(E=$.litHtmlVersions)&&void 0!==E?E:$.litHtmlVersions=[]).push("2.4.0");
|
|
61
61
|
/**
|
|
62
62
|
* @license
|
|
63
63
|
* Copyright 2017 Google LLC
|
|
64
64
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
65
65
|
*/
|
|
66
|
-
var at,ht;class ct extends
|
|
66
|
+
var at,ht;class ct extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{var s,n;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let r=o._$litPart$;if(void 0===r){const t=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:null;o._$litPart$=r=new Y(e.insertBefore(F(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return P}}ct.finalized=!0,ct._$litElement$=!0,null===(at=globalThis.litElementHydrateSupport)||void 0===at||at.call(globalThis,{LitElement:ct});const dt=globalThis.litElementPolyfillSupport;null==dt||dt({LitElement:ct}),(null!==(ht=globalThis.litElementVersions)&&void 0!==ht?ht:globalThis.litElementVersions=[]).push("3.2.2");class ut{static create(t,e,i){let s=t=>u(null!=t?t:i),n=p`var(${u(t)}, ${s(i)})`;return n.name=t,n.category=e,n.defaultValue=i,n.defaultCssValue=s,n.get=e=>p`var(${u(t)}, ${s(e)})`,n.breadcrumb=()=>[],n.lastResortDefaultValue=()=>i,n}static extend(t,e,i){let s=t=>e.get(null!=t?t:i),n=p`var(${u(t)}, ${s(i)})`;return n.name=t,n.category=e.category,n.fallbackVariable=e,n.defaultValue=i,n.defaultCssValue=s,n.get=e=>p`var(${u(t)}, ${s(e)})`,n.breadcrumb=()=>[e.name,...e.breadcrumb()],n.lastResortDefaultValue=()=>i,n}static external(t,e){let i=e=>t.fallbackVariable?t.fallbackVariable.get(null!=e?e:t.defaultValue):u(null!=e?e:t.defaultValue),s=p`var(${u(t.name)}, ${i(t.defaultValue)})`;return s.name=t.name,s.category=t.category,s.fallbackVariable=t.fallbackVariable,s.defaultValue=t.defaultValue,s.context=e,s.defaultCssValue=i,s.get=e=>p`var(${u(t.name)}, ${i(e)})`,s.breadcrumb=()=>t.fallbackVariable?[t.fallbackVariable.name,...t.fallbackVariable.breadcrumb()]:[],s.lastResortDefaultValue=()=>{var e,i;return null!==(e=t.defaultValue)&&void 0!==e?e:null===(i=t.fallbackVariable)||void 0===i?void 0:i.lastResortDefaultValue()},s}}ut.create("--ft-color-primary","COLOR","#2196F3"),ut.create("--ft-color-primary-variant","COLOR","#1976D2"),ut.create("--ft-color-secondary","COLOR","#FFCC80"),ut.create("--ft-color-secondary-variant","COLOR","#F57C00"),ut.create("--ft-color-surface","COLOR","#FFFFFF"),ut.create("--ft-color-content","COLOR","rgba(0, 0, 0, 0.87)"),ut.create("--ft-color-error","COLOR","#B00020"),ut.create("--ft-color-outline","COLOR","rgba(0, 0, 0, 0.14)"),ut.create("--ft-color-opacity-high","NUMBER","1"),ut.create("--ft-color-opacity-medium","NUMBER","0.74"),ut.create("--ft-color-opacity-disabled","NUMBER","0.38"),ut.create("--ft-color-on-primary","COLOR","#FFFFFF"),ut.create("--ft-color-on-primary-high","COLOR","#FFFFFF"),ut.create("--ft-color-on-primary-medium","COLOR","rgba(255, 255, 255, 0.74)"),ut.create("--ft-color-on-primary-disabled","COLOR","rgba(255, 255, 255, 0.38)"),ut.create("--ft-color-on-secondary","COLOR","#FFFFFF"),ut.create("--ft-color-on-secondary-high","COLOR","#FFFFFF"),ut.create("--ft-color-on-secondary-medium","COLOR","rgba(255, 255, 255, 0.74)"),ut.create("--ft-color-on-secondary-disabled","COLOR","rgba(255, 255, 255, 0.38)"),ut.create("--ft-color-on-surface","COLOR","rgba(0, 0, 0, 0.87)"),ut.create("--ft-color-on-surface-high","COLOR","rgba(0, 0, 0, 0.87)"),ut.create("--ft-color-on-surface-medium","COLOR","rgba(0, 0, 0, 0.60)"),ut.create("--ft-color-on-surface-disabled","COLOR","rgba(0, 0, 0, 0.38)"),ut.create("--ft-opacity-content-on-surface-disabled","NUMBER","0"),ut.create("--ft-opacity-content-on-surface-enable","NUMBER","0"),ut.create("--ft-opacity-content-on-surface-hover","NUMBER","0.04"),ut.create("--ft-opacity-content-on-surface-focused","NUMBER","0.12"),ut.create("--ft-opacity-content-on-surface-pressed","NUMBER","0.10"),ut.create("--ft-opacity-content-on-surface-selected","NUMBER","0.08"),ut.create("--ft-opacity-content-on-surface-dragged","NUMBER","0.08"),ut.create("--ft-opacity-primary-on-surface-disabled","NUMBER","0"),ut.create("--ft-opacity-primary-on-surface-enable","NUMBER","0"),ut.create("--ft-opacity-primary-on-surface-hover","NUMBER","0.04"),ut.create("--ft-opacity-primary-on-surface-focused","NUMBER","0.12"),ut.create("--ft-opacity-primary-on-surface-pressed","NUMBER","0.10"),ut.create("--ft-opacity-primary-on-surface-selected","NUMBER","0.08"),ut.create("--ft-opacity-primary-on-surface-dragged","NUMBER","0.08"),ut.create("--ft-opacity-surface-on-primary-disabled","NUMBER","0"),ut.create("--ft-opacity-surface-on-primary-enable","NUMBER","0"),ut.create("--ft-opacity-surface-on-primary-hover","NUMBER","0.04"),ut.create("--ft-opacity-surface-on-primary-focused","NUMBER","0.12"),ut.create("--ft-opacity-surface-on-primary-pressed","NUMBER","0.10"),ut.create("--ft-opacity-surface-on-primary-selected","NUMBER","0.08"),ut.create("--ft-opacity-surface-on-primary-dragged","NUMBER","0.08"),ut.create("--ft-elevation-00","UNKNOWN","0px 0px 0px 0px rgba(0, 0, 0, 0), 0px 0px 0px 0px rgba(0, 0, 0, 0), 0px 0px 0px 0px rgba(0, 0, 0, 0)"),ut.create("--ft-elevation-01","UNKNOWN","0px 1px 4px 0px rgba(0, 0, 0, 0.06), 0px 1px 2px 0px rgba(0, 0, 0, 0.14), 0px 0px 1px 0px rgba(0, 0, 0, 0.06)"),ut.create("--ft-elevation-02","UNKNOWN","0px 4px 10px 0px rgba(0, 0, 0, 0.06), 0px 2px 5px 0px rgba(0, 0, 0, 0.14), 0px 0px 1px 0px rgba(0, 0, 0, 0.06)"),ut.create("--ft-elevation-03","UNKNOWN","0px 6px 13px 0px rgba(0, 0, 0, 0.06), 0px 3px 7px 0px rgba(0, 0, 0, 0.14), 0px 1px 2px 0px rgba(0, 0, 0, 0.06)"),ut.create("--ft-elevation-04","UNKNOWN","0px 8px 16px 0px rgba(0, 0, 0, 0.06), 0px 4px 9px 0px rgba(0, 0, 0, 0.14), 0px 2px 3px 0px rgba(0, 0, 0, 0.06)"),ut.create("--ft-elevation-06","UNKNOWN","0px 12px 22px 0px rgba(0, 0, 0, 0.06), 0px 6px 13px 0px rgba(0, 0, 0, 0.14), 0px 4px 5px 0px rgba(0, 0, 0, 0.06)"),ut.create("--ft-elevation-08","UNKNOWN","0px 16px 28px 0px rgba(0, 0, 0, 0.06), 0px 8px 17px 0px rgba(0, 0, 0, 0.14), 0px 6px 7px 0px rgba(0, 0, 0, 0.06)"),ut.create("--ft-elevation-12","UNKNOWN","0px 22px 40px 0px rgba(0, 0, 0, 0.06), 0px 12px 23px 0px rgba(0, 0, 0, 0.14), 0px 10px 11px 0px rgba(0, 0, 0, 0.06)"),ut.create("--ft-elevation-16","UNKNOWN","0px 28px 52px 0px rgba(0, 0, 0, 0.06), 0px 16px 29px 0px rgba(0, 0, 0, 0.14), 0px 14px 15px 0px rgba(0, 0, 0, 0.06)"),ut.create("--ft-elevation-24","UNKNOWN","0px 40px 76px 0px rgba(0, 0, 0, 0.06), 0px 24px 41px 0px rgba(0, 0, 0, 0.14), 0px 22px 23px 0px rgba(0, 0, 0, 0.06)"),ut.create("--ft-border-radius-S","SIZE","4px"),ut.create("--ft-border-radius-M","SIZE","8px"),ut.create("--ft-border-radius-L","SIZE","12px"),ut.create("--ft-border-radius-XL","SIZE","16px"),ut.create("--ft-title-font","UNKNOWN","Ubuntu, system-ui, sans-serif"),ut.create("--ft-content-font","UNKNOWN","'Open Sans', system-ui, sans-serif"),ut.create("--ft-transition-duration","UNKNOWN","250ms"),ut.create("--ft-transition-timing-function","UNKNOWN","ease-in-out");var pt,ft,vt=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class bt extends(
|
|
67
67
|
/**
|
|
68
68
|
* @license
|
|
69
69
|
* Copyright 2021 Google LLC
|
|
@@ -74,7 +74,7 @@ function(t){return class extends t{createRenderRoot(){const t=this.constructor,{
|
|
|
74
74
|
<style>${t}</style>
|
|
75
75
|
`))}
|
|
76
76
|
${this.getTemplate()}
|
|
77
|
-
`}updated(t){super.updated(t),setTimeout((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}),0)}contentAvailableCallback(t){}scheduleExportpartsUpdate(){this.exportpartsDebouncer.run((()=>{var t;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&this.exportpartsPrefixes.length>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var e,i,s,n,o,r;const l=t=>null!=t&&t.trim().length>0,a=t.filter(l).map((t=>t.trim()));if(0===a.length)return void this.removeAttribute("exportparts");const h=new Set;for(let t of null!==(i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[part],[exportparts]"))&&void 0!==i?i:[]){const e=null!==(n=null===(s=t.getAttribute("part"))||void 0===s?void 0:s.split(" "))&&void 0!==n?n:[],i=null!==(r=null===(o=t.getAttribute("exportparts"))||void 0===o?void 0:o.split(",").map((t=>t.split(":")[1])))&&void 0!==r?r:[];new Array(...e,...i).filter(l).map((t=>t.trim())).forEach((t=>h.add(t)))}if(0===h.size)return void this.removeAttribute("exportparts");const c=[...h.values()].flatMap((t=>a.map((e=>`${t}:${e}--${t}`))));this.setAttribute("exportparts",[...this.part,...c].join(", "))}}
|
|
77
|
+
`}updated(t){super.updated(t),setTimeout((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}),0)}contentAvailableCallback(t){}scheduleExportpartsUpdate(){this.exportpartsDebouncer.run((()=>{var t;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&this.exportpartsPrefixes.length>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var e,i,s,n,o,r;const l=t=>null!=t&&t.trim().length>0,a=t.filter(l).map((t=>t.trim()));if(0===a.length)return void this.removeAttribute("exportparts");const h=new Set;for(let t of null!==(i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[part],[exportparts]"))&&void 0!==i?i:[]){const e=null!==(n=null===(s=t.getAttribute("part"))||void 0===s?void 0:s.split(" "))&&void 0!==n?n:[],i=null!==(r=null===(o=t.getAttribute("exportparts"))||void 0===o?void 0:o.split(",").map((t=>t.split(":")[1])))&&void 0!==r?r:[];new Array(...e,...i).filter(l).map((t=>t.trim())).forEach((t=>h.add(t)))}if(0===h.size)return void this.removeAttribute("exportparts");const c=[...h.values()].flatMap((t=>a.map((e=>`${t}:${e}--${t}`))));this.setAttribute("exportparts",[...this.part,...c].join(", "))}}vt([s()],bt.prototype,"exportpartsPrefix",void 0),vt([function(t,e){const i=()=>JSON.parse(JSON.stringify(t));return s({type:Object,converter:{fromAttribute:t=>{if(null==t)return i();try{return JSON.parse(t)}catch{return i()}},toAttribute:t=>JSON.stringify(t)},...null!=e?e:{}})}([])],bt.prototype,"exportpartsPrefixes",void 0),p`
|
|
78
78
|
.ft-no-text-select {
|
|
79
79
|
-webkit-touch-callout: none;
|
|
80
80
|
-webkit-user-select: none;
|
|
@@ -95,17 +95,18 @@ function(t){return class extends t{createRenderRoot(){const t=this.constructor,{
|
|
|
95
95
|
-webkit-hyphens: auto;
|
|
96
96
|
hyphens: auto
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
`,navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(ft=null===(pt=window.safari)||void 0===pt?void 0:pt.pushNotification)||void 0===ft||ft.toString());
|
|
99
99
|
/**
|
|
100
100
|
* @license
|
|
101
101
|
* Copyright 2017 Google LLC
|
|
102
102
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
103
|
-
*/
|
|
103
|
+
*/
|
|
104
|
+
const mt=2,xt=t=>(...e)=>({_$litDirective$:t,values:e});class wt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
104
105
|
/**
|
|
105
106
|
* @license
|
|
106
107
|
* Copyright 2020 Google LLC
|
|
107
108
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
108
|
-
*/const{I:
|
|
109
|
+
*/const{I:yt}=rt,gt=()=>document.createComment(""),Ot=(t,e,i)=>{var s;const n=t._$AA.parentNode,o=void 0===e?t._$AB:e._$AA;if(void 0===i){const e=n.insertBefore(gt(),o),s=n.insertBefore(gt(),o);i=new yt(e,s,t,t.options)}else{const e=i._$AB.nextSibling,r=i._$AM,l=r!==t;if(l){let e;null===(s=i._$AQ)||void 0===s||s.call(i,t),i._$AM=t,void 0!==i._$AP&&(e=t._$AU)!==r._$AU&&i._$AP(e)}if(e!==o||l){let t=i._$AA;for(;t!==e;){const e=t.nextSibling;n.insertBefore(t,o),t=e}}}return i},Nt=(t,e,i=t)=>(t._$AI(e,i),t),Ct={},Et=t=>{var e;null===(e=t._$AP)||void 0===e||e.call(t,!1,!0);let i=t._$AA;const s=t._$AB.nextSibling;for(;i!==s;){const t=i.nextSibling;i.remove(),i=t}},$t=(t,e,i)=>{const s=new Map;for(let n=e;n<=i;n++)s.set(t[n],n);return s},Rt=xt(class extends wt{constructor(t){if(super(t),t.type!==mt)throw Error("repeat() can only be used in text expressions")}ht(t,e,i){let s;void 0===i?i=e:void 0!==e&&(s=e);const n=[],o=[];let r=0;for(const e of t)n[r]=s?s(e,r):r,o[r]=i(e,r),r++;return{values:o,keys:n}}render(t,e,i){return this.ht(t,e,i).values}update(t,[e,i,s]){var n;const o=(t=>t._$AH)(t),{values:r,keys:l}=this.ht(e,i,s);if(!Array.isArray(o))return this.ut=l,r;const a=null!==(n=this.ut)&&void 0!==n?n:this.ut=[],h=[];let c,d,u=0,p=o.length-1,f=0,v=r.length-1;for(;u<=p&&f<=v;)if(null===o[u])u++;else if(null===o[p])p--;else if(a[u]===l[f])h[f]=Nt(o[u],r[f]),u++,f++;else if(a[p]===l[v])h[v]=Nt(o[p],r[v]),p--,v--;else if(a[u]===l[v])h[v]=Nt(o[u],r[v]),Ot(t,h[v+1],o[u]),u++,v--;else if(a[p]===l[f])h[f]=Nt(o[p],r[f]),Ot(t,o[u],o[p]),p--,f++;else if(void 0===c&&(c=$t(l,f,v),d=$t(a,u,p)),c.has(a[u]))if(c.has(a[p])){const e=d.get(l[f]),i=void 0!==e?o[e]:null;if(null===i){const e=Ot(t,o[u]);Nt(e,r[f]),h[f]=e}else h[f]=Nt(i,r[f]),Ot(t,o[u],i),o[e]=null;f++}else Et(o[p]),p--;else Et(o[u]),u++;for(;f<=v;){const e=Ot(t,h[v+1]);Nt(e,r[f]),h[f++]=e}for(;u<=p;){const t=o[u++];null!==t&&Et(t)}return this.ut=l,((t,e=Ct)=>{t._$AH=e})(t,h),P}});
|
|
109
110
|
/**
|
|
110
111
|
* @license
|
|
111
112
|
* Copyright 2017 Google LLC
|
|
@@ -116,10 +117,10 @@ function(t){return class extends t{createRenderRoot(){const t=this.constructor,{
|
|
|
116
117
|
* Copyright 2017 Google LLC
|
|
117
118
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
118
119
|
*/
|
|
119
|
-
class
|
|
120
|
+
class St extends wt{constructor(t){if(super(t),this.it=Z,t.type!==mt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===Z||null==t)return this._t=void 0,this.it=t;if(t===P)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}St.directiveName="unsafeHTML",St.resultType=1;const Mt=xt(St),kt={padding:ut.create("--ft-infinite-scroll-padding","SIZE","0")},Ut=p`
|
|
120
121
|
.items-container {
|
|
121
122
|
position: relative;
|
|
122
|
-
padding: ${
|
|
123
|
+
padding: ${kt.padding};
|
|
123
124
|
outline: none;
|
|
124
125
|
}
|
|
125
126
|
|
|
@@ -142,10 +143,6 @@ class kt extends yt{constructor(t){if(super(t),this.it=Z,t.type!==wt)throw Error
|
|
|
142
143
|
margin-top: 4px;
|
|
143
144
|
}
|
|
144
145
|
|
|
145
|
-
.scrollable .item-container {
|
|
146
|
-
height: 100%;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
146
|
.resizable:not(.rendered) {
|
|
150
147
|
width: 0;
|
|
151
148
|
}
|
|
@@ -153,18 +150,18 @@ class kt extends yt{constructor(t){if(super(t),this.it=Z,t.type!==wt)throw Error
|
|
|
153
150
|
.rendered {
|
|
154
151
|
display: flow-root;
|
|
155
152
|
}
|
|
156
|
-
`;var
|
|
153
|
+
`;var At=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class Ft extends CustomEvent{constructor(t,e){super("visible-items-change",{detail:{visibleIndexes:t,visibleItems:e}})}}class Lt extends Event{constructor(){super("scrolled-to-target")}}class Tt extends bt{constructor(){super(...arguments),this.items=[],this.renderItem=()=>H``,this.internalScroll=!1,this.renderBeforeFirst=1,this.renderAfterLast=1,this.visibleItems=[],this.scrolledToTarget=!1,this.alreadyRenderedIndexes=new Set,this.scrollDebouncer=new e(5),this.scrollDoneDebouncer=new e(10),this.onVisibilityChange=t=>{const e=t.filter((t=>t.intersectionRect.height>1)).map((t=>+t.target.attributes.getNamedItem("data-item-index").value)).filter((t=>!this.visibleItems.includes(t))),i=t.filter((t=>t.intersectionRect.height<=1)).map((t=>+t.target.attributes.getNamedItem("data-item-index").value)).filter((t=>this.visibleItems.includes(t))),s=[...this.visibleItems].filter((t=>!i.includes(t)));this.visibleItems=[...e,...s].sort(((t,e)=>t-e))},this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange),this.onResize=t=>{var e;this.triggerFindScrollableParent(),t=t.sort(((t,e)=>t.contentRect.top-e.contentRect.top));for(const i of t){const t=+i.target.parentElement.getAttribute("data-item-index"),s=i.target.parentElement.clientHeight,n=i.contentRect.height;if(this.alreadyRenderedIndexes.has(t)){if(this.scrollable){"none"===(null!==(e=getComputedStyle(this.scrollable).overflowAnchor)&&void 0!==e?e:"none")&&this.getOffset(i.target.parentElement)+s<this.scrollable.scrollTop&&(this.scrollable.scrollTop+=Math.ceil(n-s))}i.target.parentElement.style.height=n+"px"}}},this.resizeObserver=new ResizeObserver(this.onResize),this.onMutation=()=>{[...this.itemsContainer.children].forEach((t=>{this.intersectionObserver.observe(t),this.resizeObserver.observe(t.children.item(0))}))},this.mutationObserver=new MutationObserver(this.onMutation)}get scrollable(){return this.internalScroll?this.internalScrollable:this.firstScrollableParent}render(){return H`
|
|
157
154
|
<div class="items-container ${this.internalScroll?"scrollable":""}"
|
|
158
155
|
tabindex="-1"
|
|
159
156
|
@find-scrollable-parent=${this.findScrollableParent}>
|
|
160
|
-
${
|
|
157
|
+
${Rt(this.items,((t,e)=>this.renderItemContainer(t,e)))}
|
|
161
158
|
</div>
|
|
162
159
|
`}renderItemContainer(t,e){const i=this.scrolledToTarget&&this.visibleItems.includes(e),s=this.alreadyRenderedIndexes.has(e)||this.scrolledToTarget&&e>=this.visibleItems[0]-this.renderBeforeFirst&&e<=(null!=(n=this.visibleItems)?n:[])[(null!=n?n:[]).length-1]+this.renderAfterLast;var n;s&&this.alreadyRenderedIndexes.add(e);return H`
|
|
163
160
|
<div id="item-${e}"
|
|
164
161
|
class="item-container"
|
|
165
162
|
data-item-index="${e}">
|
|
166
163
|
<div class="resizable ${i?"visible":""} ${s?"rendered":""}">
|
|
167
|
-
${s?(()=>{const i=this.renderItem(t,e);return"string"==typeof i?H`${
|
|
164
|
+
${s?(()=>{const i=this.renderItem(t,e);return"string"==typeof i?H`${Mt(i)}`:i})():null}
|
|
168
165
|
</div>
|
|
169
166
|
</div>
|
|
170
|
-
`}resetScroll(){this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.visibleItems=[],this.scrolledToTarget=!1,this.scrollDebouncer.run((()=>{var t
|
|
167
|
+
`}resetScroll(){this.triggerFindScrollableParent(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.visibleItems=[],this.scrolledToTarget=!1,this.scrollDebouncer.run((()=>{var t;let e=null!==(t=this.scrollToIndex)&&void 0!==t?t:this.scrollToItem?this.items.indexOf(this.scrollToItem):-1;e>=this.items.length&&(e=-1);let i=this.getItem(e);this.scrollToTarget(i),this.onMutation(),this.scrollDoneDebouncer.run((()=>{this.scrolledToTarget=!0}))}))}getItem(t){var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(`#item-${t}`)}scrollToTarget(t){var e;if(t){let i=+(null!==(e=t.getAttribute("data-item-index"))&&void 0!==e?e:"0");this.scrollable&&0===i?this.scrollable.scrollTop=0:t.scrollIntoView({block:"start"})}}getOffset(t){var e;let i=0,s=t;for(;s&&s.offsetParent!==this.scrollable.offsetParent;)i+=s.offsetTop,s=s.offsetParent;return i+(null!==(e=null==s?void 0:s.offsetTop)&&void 0!==e?e:0)-this.scrollable.offsetTop}appendItems(...t){this.items=[...this.items,...t]}prependItems(...t){this.items=[...t,...this.items]}connectedCallback(){super.connectedCallback(),setTimeout((()=>{this.triggerFindScrollableParent(),this.initIntersectionObserver(),this.mutationObserver.disconnect(),this.mutationObserver.observe(this.itemsContainer,{childList:!0})}),0)}initIntersectionObserver(){this.intersectionObserver.disconnect(),this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange,{root:this.scrollable,rootMargin:"-8px",threshold:[0,.01,.1]})}triggerFindScrollableParent(){var t;null===(t=this.itemsContainer)||void 0===t||t.dispatchEvent(new Event("find-scrollable-parent",{composed:!0}))}findScrollableParent(t){let e,i;t.stopPropagation();for(let s of t.composedPath()){const t=s,n=this.elementCanScroll(t);if(t.clientHeight&&t.clientHeight<t.scrollHeight&&n){e=t;break}n&&(i=t)}let s=e||i;s!==this.firstScrollableParent&&(this.firstScrollableParent=s,this.initIntersectionObserver(),this.resetScroll())}elementCanScroll(t){try{return["auto","scroll"].includes(getComputedStyle(t).overflowY)}catch(t){return!1}}disconnectedCallback(){super.disconnectedCallback(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.mutationObserver.disconnect()}firstUpdated(t){super.firstUpdated(t),this.resetScroll()}update(t){super.update(t),t.has("items")&&(this.alreadyRenderedIndexes=new Set),(t.has("scrollToItem")||t.has("scrollToIndex")&&(null!=this.scrollToItem||null!=this.scrollToIndex))&&this.resetScroll()}updated(t){super.updated(t),(t.has("visibleItems")||t.has("items"))&&this.dispatchEvent(new Ft(this.visibleItems,this.visibleItems.map((t=>this.items[t])))),t.has("scrolledToTarget")&&this.scrolledToTarget&&(null!=this.scrollToItem||null!=this.scrollToIndex)&&this.dispatchEvent(new Lt)}}var _t;Tt.styles=Ut,At([s({type:Array})],Tt.prototype,"items",void 0),At([s({attribute:!1})],Tt.prototype,"renderItem",void 0),At([s({type:Object})],Tt.prototype,"scrollToItem",void 0),At([s({type:Number})],Tt.prototype,"scrollToIndex",void 0),At([s({type:Boolean})],Tt.prototype,"internalScroll",void 0),At([s({type:Number})],Tt.prototype,"renderBeforeFirst",void 0),At([s({type:Number})],Tt.prototype,"renderAfterLast",void 0),At([n({hasChanged:(t,e)=>null!=t&&null==e||t.length!==e.length||t[0]!==e[0]})],Tt.prototype,"visibleItems",void 0),At([o(".scrollable")],Tt.prototype,"internalScrollable",void 0),At([o(".items-container")],Tt.prototype,"itemsContainer",void 0),At([n()],Tt.prototype,"scrolledToTarget",void 0),(_t="ft-infinite-scroll",t=>{window.customElements.get(_t)||window.customElements.define(_t,t)})(Tt),t.FtInfiniteScroll=Tt,t.FtInfiniteScrollCssVariables=kt,t.ScrolledToTargetEvent=Lt,t.VisibleItemsChangeEvent=Ft,t.styles=Ut,Object.defineProperty(t,"i",{value:!0})}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-infinite-scroll",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.25",
|
|
4
4
|
"description": "An infinite scroller.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-wc-utils": "0.3.
|
|
22
|
+
"@fluid-topics/ft-wc-utils": "0.3.25",
|
|
23
23
|
"lit": "2.2.8"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "4f5efdb713b2fcbb605b0dbd69feb6a86442c228"
|
|
26
26
|
}
|