@oslokommune/punkt-elements 19.10.2 → 19.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/dist/{accordion-BhCmUDoS.js → accordion-BlsqYbJf.js} +22 -21
- package/dist/accordion-DukAa2ED.cjs +48 -0
- package/dist/{alert-BJPi5ylH.cjs → alert-CuXM6TnC.cjs} +1 -1
- package/dist/{alert-CUH_2zb2.js → alert-Xt26J9yX.js} +2 -2
- package/dist/base-elements/element-with-slot.d.ts +13 -0
- package/dist/{button-CWHqXdSG.cjs → button-BFG-7bDB.cjs} +1 -1
- package/dist/{button-DQ8rH8hx.js → button-DhCqyX4D.js} +1 -1
- package/dist/{card-DfVOJCWA.js → card-DCc3wfUb.js} +2 -2
- package/dist/{card-pJ0CDH2Y.cjs → card-Diivw_vm.cjs} +1 -1
- package/dist/{checkbox-BEBBPgYW.js → checkbox-CCBZc3Ix.js} +1 -1
- package/dist/{checkbox-3z2uH8rd.cjs → checkbox-Dyyrw5TE.cjs} +1 -1
- package/dist/{checkbox-group-DRQmSHyN.cjs → checkbox-group-COWUvl52.cjs} +1 -1
- package/dist/{checkbox-group-BiPX1EhY.js → checkbox-group-CsrEj7oZ.js} +2 -2
- package/dist/{combobox-CdmzQtCh.js → combobox-2NTR70Ad.js} +6 -6
- package/dist/{combobox-C_SMnNsj.cjs → combobox-Dlhm1iYr.cjs} +2 -2
- package/dist/{consent-eTXt052m.js → consent-BUS6GEUu.js} +2 -2
- package/dist/{consent-CkK9BZ7t.cjs → consent-DBYZaCTp.cjs} +1 -1
- package/dist/{datepicker-BrQhahYy.cjs → datepicker-0NSvgPXK.cjs} +1 -1
- package/dist/{datepicker-DILpPWCY.js → datepicker-B80E_4Cg.js} +4 -4
- package/dist/directives/slot-content.d.ts +259 -62
- package/dist/docs/components/alert.d.ts +1 -1
- package/dist/docs/components/slot-internals.d.ts +14 -0
- package/dist/docs/components/slots.d.ts +2 -0
- package/dist/element-with-slot-CVmm0_IE.js +703 -0
- package/dist/element-with-slot-CcJPCLgn.cjs +1 -0
- package/dist/{fileupload-BZjZh8Mp.js → fileupload-BmfFC748.js} +3 -3
- package/dist/{fileupload-l1d9UQf9.cjs → fileupload-CyLRyoVU.cjs} +1 -1
- package/dist/{footer-C8Zh-eUU.cjs → footer-C6ajmlq2.cjs} +1 -1
- package/dist/{footer-X5MBVUoo.js → footer-L2vhQTAS.js} +1 -1
- package/dist/{header-DLH6Xx97.js → header-DbV1G9bY.js} +6 -6
- package/dist/{header-EvwDJXP-.cjs → header-lgdaF8oa.cjs} +1 -1
- package/dist/{header-menu-BqFpYI-V.cjs → header-menu-Cz7G7Q2R.cjs} +1 -1
- package/dist/{header-menu-0UtMd2_H.js → header-menu-F3tZZ5vO.js} +1 -1
- package/dist/{heading-DMHbL3xs.cjs → heading-BluavR6A.cjs} +1 -1
- package/dist/{heading-tWSLaRPD.js → heading-y72aIgB8.js} +1 -1
- package/dist/{helptext-CGa1p-yd.cjs → helptext-Bdv80rcs.cjs} +1 -1
- package/dist/{helptext-Dy2Ehs9W.js → helptext-Dujce_W9.js} +1 -1
- package/dist/{input-element-kIrd5ABs.cjs → input-element-B9Mhkoog.cjs} +1 -1
- package/dist/{input-element-BGbT4ICl.js → input-element-BdDamXvR.js} +1 -1
- package/dist/{input-wrapper-Uks0spRR.js → input-wrapper-Bb6CZxmg.js} +3 -3
- package/dist/{input-wrapper-EvzyXMw-.cjs → input-wrapper-BwzajfFX.cjs} +1 -1
- package/dist/{link-CLdiz-ly.cjs → link-CRLAhYi0.cjs} +1 -1
- package/dist/{link-C0yBFscy.js → link-sO401Ieh.js} +1 -1
- package/dist/{linkcard-B5-p-YC4.js → linkcard-DdmGxzAP.js} +1 -1
- package/dist/{linkcard-v9UsV9Os.cjs → linkcard-DnZgMzqL.cjs} +1 -1
- package/dist/{loader-DWvjIMsT.js → loader-Di5kHEQ4.js} +1 -1
- package/dist/{loader-C4UfUu2u.cjs → loader-Zo_VSsNw.cjs} +1 -1
- package/dist/{messagebox-clOimkn7.cjs → messagebox-CR59jv8N.cjs} +1 -1
- package/dist/{messagebox-CJTqxfu3.js → messagebox-CzaFlrYz.js} +1 -1
- package/dist/{modal-Bm1daKaW.js → modal-B3CQEBBB.js} +2 -2
- package/dist/{modal-BPweteoS.cjs → modal-BKeSXrzi.cjs} +1 -1
- package/dist/{option-group-element-2A4TBcp-.cjs → option-group-element-CzehfgVZ.cjs} +1 -1
- package/dist/{option-group-element-Ber7NAlg.js → option-group-element-D5PgGNdt.js} +2 -2
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox-group.cjs +1 -1
- package/dist/pkt-checkbox-group.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-footer.cjs +1 -1
- package/dist/pkt-footer.js +1 -1
- package/dist/pkt-header-menu.cjs +1 -1
- package/dist/pkt-header-menu.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +31 -31
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/{pkt-options-controller-Ck_549wx.cjs → pkt-options-controller-139UsV4h.cjs} +1 -1
- package/dist/{pkt-options-controller-DTOlYR9b.js → pkt-options-controller-CHosj1Oo.js} +1 -1
- package/dist/pkt-radio-group.cjs +1 -1
- package/dist/pkt-radio-group.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +1 -1
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/{radio-group-CMtx_GRV.js → radio-group-CZGcjEmV.js} +2 -2
- package/dist/{radio-group-9Szx2XyM.cjs → radio-group-DaIRh-fL.cjs} +1 -1
- package/dist/{radiobutton-CYbvJ9y8.js → radiobutton-BJCSVvcQ.js} +1 -1
- package/dist/{radiobutton-Dq2qkfi0.cjs → radiobutton-qTPNeZl5.cjs} +1 -1
- package/dist/{scroll-lock-BN8lOhV5.cjs → scroll-lock-B46ur0FF.cjs} +1 -1
- package/dist/{scroll-lock-DAbNKAUy.js → scroll-lock-BALd8hF9.js} +4 -1
- package/dist/{select-DlgOxHIl.js → select-CIAfUw8F.js} +4 -4
- package/dist/{select-1nm17iN8.cjs → select-CQpwjRPh.cjs} +1 -1
- package/dist/shared-types/accordion.d.ts +3 -1
- package/dist/shared-types/index.d.ts +1 -1
- package/dist/shared-utils/scroll-lock/index.d.ts +3 -1
- package/dist/{tabs-D3pPS9us.js → tabs-DBW3P90Z.js} +2 -1
- package/dist/{tabs-8Y5PlmLl.cjs → tabs-R1Jzzj3-.cjs} +1 -1
- package/dist/{tag-DOUsW7nS.cjs → tag-BMtnaJ1A.cjs} +1 -1
- package/dist/{tag-qHYIycl8.js → tag-uVXp7uP-.js} +1 -1
- package/dist/{textarea-B3qIDyEQ.js → textarea-553WDMEq.js} +3 -3
- package/dist/{textarea-DkeCQKmM.cjs → textarea-DWLVisQX.cjs} +1 -1
- package/dist/{textinput-DibZCHh_.cjs → textinput-C7JFm9jD.cjs} +1 -1
- package/dist/{textinput-CwvVRNsP.js → textinput-wZSCpQgv.js} +3 -3
- package/dist/{timepicker-C_oG9W9Y.js → timepicker-CMe0IbPm.js} +3 -3
- package/dist/{timepicker-CZ_1HVlF.cjs → timepicker-DVyi8teh.cjs} +1 -1
- package/package.json +2 -2
- package/src/components/accordion/accordion.test.ts +34 -2
- package/src/components/accordion/accordionitem.ts +4 -1
- package/src/components/button/button.test.ts +13 -0
- package/src/components/combobox/combobox.selection.test.ts +12 -0
- package/src/components/combobox/combobox.ts +1 -1
- package/src/components/consent/consent.ts +3 -1
- package/src/components/tabs/tabitem.ts +1 -0
- package/dist/accordion-BFKmnCDh.cjs +0 -47
- package/dist/element-with-slot-DOt8HbXA.cjs +0 -1
- package/dist/element-with-slot-U981OZM_.js +0 -353
|
@@ -0,0 +1,703 @@
|
|
|
1
|
+
import { f as e, g as t, m as n, t as r } from "./element-DBugHPKM.js";
|
|
2
|
+
import { t as i } from "./async-directive-yh8hG41Q.js";
|
|
3
|
+
//#region src/controllers/pkt-slot-utils.ts
|
|
4
|
+
function a(e) {
|
|
5
|
+
return e.classList && (e.classList.contains("_dialog_overlay") || e.classList.contains("backdrop")) ? !0 : typeof e.hasAttribute == "function" && e.hasAttribute("data-skip");
|
|
6
|
+
}
|
|
7
|
+
function o(e) {
|
|
8
|
+
return e.nodeName === "OPTION" || e.nodeName === "DATA";
|
|
9
|
+
}
|
|
10
|
+
function s(e) {
|
|
11
|
+
return e.nodeType === Node.TEXT_NODE && e.nodeValue?.trim() !== "";
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/directives/slot-content.ts
|
|
15
|
+
var c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakSet();
|
|
16
|
+
function d(e) {
|
|
17
|
+
let t = c.get(e);
|
|
18
|
+
return t || (t = new D(e), c.set(e, t)), t;
|
|
19
|
+
}
|
|
20
|
+
var f = Symbol("default");
|
|
21
|
+
function p(e) {
|
|
22
|
+
return e === void 0 ? f : e;
|
|
23
|
+
}
|
|
24
|
+
function m(e) {
|
|
25
|
+
if (e.nodeType !== Node.ELEMENT_NODE) return f;
|
|
26
|
+
let t = e.getAttribute("slot");
|
|
27
|
+
return t === null ? f : p(t);
|
|
28
|
+
}
|
|
29
|
+
function h(e) {
|
|
30
|
+
return Array.isArray(e) ? e.map((e) => {
|
|
31
|
+
let t = e === null ? f : e;
|
|
32
|
+
return [t, t];
|
|
33
|
+
}) : Object.entries(e).map(([e, t]) => [e, t === null ? f : t]);
|
|
34
|
+
}
|
|
35
|
+
function g(e, t) {
|
|
36
|
+
return e.length === t.length && e.every(([e, n], r) => t[r][0] === e && t[r][1] === n);
|
|
37
|
+
}
|
|
38
|
+
function _(e) {
|
|
39
|
+
if (e.nodeType === Node.TEXT_NODE) return s(e);
|
|
40
|
+
if (e.nodeType !== Node.ELEMENT_NODE) return !1;
|
|
41
|
+
let t = e;
|
|
42
|
+
return !a(t) && !o(t);
|
|
43
|
+
}
|
|
44
|
+
function v(e) {
|
|
45
|
+
return e.nodeType === Node.TEXT_NODE && !!e.nodeValue && !s(e);
|
|
46
|
+
}
|
|
47
|
+
function y(e, t) {
|
|
48
|
+
if (!_(e)) return !1;
|
|
49
|
+
if (e instanceof HTMLTemplateElement) {
|
|
50
|
+
let n = m(e);
|
|
51
|
+
for (let r of Array.from(e.content.childNodes)) b(t, n, r);
|
|
52
|
+
} else b(t, m(e), e);
|
|
53
|
+
return !0;
|
|
54
|
+
}
|
|
55
|
+
function b(e, t, n) {
|
|
56
|
+
let r = e.get(t);
|
|
57
|
+
r || (r = [], e.set(t, r)), r.push(n);
|
|
58
|
+
}
|
|
59
|
+
function x(e, t, n) {
|
|
60
|
+
Node.prototype.insertBefore.call(e, t, n);
|
|
61
|
+
}
|
|
62
|
+
function S(e) {
|
|
63
|
+
e.parentNode && Node.prototype.removeChild.call(e.parentNode, e);
|
|
64
|
+
}
|
|
65
|
+
function C(e) {
|
|
66
|
+
return Object.getOwnPropertyDescriptor(Node.prototype, "nextSibling").get.call(e);
|
|
67
|
+
}
|
|
68
|
+
function w(e, t) {
|
|
69
|
+
return e.node.compareDocumentPosition(t.node) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
70
|
+
}
|
|
71
|
+
function T(e) {
|
|
72
|
+
if (e.nodeType !== Node.TEXT_NODE || Object.prototype.hasOwnProperty.call(e, "data")) return;
|
|
73
|
+
let t = e, n = {
|
|
74
|
+
data: Object.getOwnPropertyDescriptor(CharacterData.prototype, "data"),
|
|
75
|
+
nodeValue: Object.getOwnPropertyDescriptor(Node.prototype, "nodeValue")
|
|
76
|
+
};
|
|
77
|
+
for (let [e, r] of Object.entries(n)) !r?.get || !r.set || Object.defineProperty(t, e, {
|
|
78
|
+
configurable: !0,
|
|
79
|
+
get: () => r.get.call(t),
|
|
80
|
+
set: (e) => {
|
|
81
|
+
r.set.call(t, e), E(t);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function E(e) {
|
|
86
|
+
let t = l.get(e);
|
|
87
|
+
if (t) {
|
|
88
|
+
s(e) || t.releaseText(e);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
let n = e.parentNode && c.get(e.parentNode);
|
|
92
|
+
n && (s(e) ? n.adoptText(e) : n.blankTextChanged(e));
|
|
93
|
+
}
|
|
94
|
+
var D = class e {
|
|
95
|
+
static {
|
|
96
|
+
this.PLACEHOLDER_PREFIX = "pkt-slot";
|
|
97
|
+
}
|
|
98
|
+
constructor(e) {
|
|
99
|
+
this.nodesBySlot = /* @__PURE__ */ new Map(), this.trackedNodes = /* @__PURE__ */ new Set(), this.placeholderToNode = /* @__PURE__ */ new Map(), this.nodeToPlaceholder = /* @__PURE__ */ new Map(), this.mirrorOf = /* @__PURE__ */ new Map(), this.hasWhitespace = !1, this.contentBounds = null, this.changedWhitespace = /* @__PURE__ */ new Set(), this.directives = /* @__PURE__ */ new Set(), this.sources = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Set(), this.generation = 0, this.initialCollectionDone = !1, this.inOwnChange = !1, this.rendering = !1, this.contentEnd = null, this.rootMarker = null, this.observer = null, this.observing = !1, this.wantsObserver = !1, this.followsHostRenders = !1, this.host = e, typeof e.addController == "function" && (this.followsHostRenders = !0, e.addController({
|
|
100
|
+
hostConnected: () => {
|
|
101
|
+
if (!this.wantsObserver) return;
|
|
102
|
+
let e = !this.observing;
|
|
103
|
+
this.startObserving(), e && this.resync();
|
|
104
|
+
},
|
|
105
|
+
hostDisconnected: () => this.stopObservingIfUnused(),
|
|
106
|
+
hostUpdate: () => {
|
|
107
|
+
e.hasUpdated || this.collectLateChildren(), this.flushMutations(!1), e.hasUpdated || this.insertContentEnd(), this.rendering = !0, queueMicrotask(() => {
|
|
108
|
+
this.rendering = !1;
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
hostUpdated: () => {
|
|
112
|
+
this.rendering = !1, !this.rootMarker && this.contentEnd?.parentNode === e && (this.rootMarker = C(this.contentEnd)), this.flushMutations(!0);
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
collectNodes() {
|
|
117
|
+
if (this.initialCollectionDone) return;
|
|
118
|
+
this.initialCollectionDone = !0, this.generation++;
|
|
119
|
+
let e = Array.from(this.host.childNodes);
|
|
120
|
+
for (let t of e) this.watchHostText(t), y(t, this.nodesBySlot) && this.track(t);
|
|
121
|
+
this.syncWhitespace();
|
|
122
|
+
}
|
|
123
|
+
collectLateChildren() {
|
|
124
|
+
if (this.initialCollectionDone) {
|
|
125
|
+
for (let e of Array.from(this.host.childNodes)) this.trackedNodes.has(e) || this.placeholderToNode.has(e) || (this.watchHostText(e), _(e) && (this.addContent(e), this.generation++));
|
|
126
|
+
this.syncWhitespace();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
addDirective(e) {
|
|
130
|
+
this.directives.add(e), this.startObserving();
|
|
131
|
+
}
|
|
132
|
+
removeDirective(e) {
|
|
133
|
+
this.directives.delete(e), this.stopObservingIfUnused();
|
|
134
|
+
}
|
|
135
|
+
addSource(e, t, n) {
|
|
136
|
+
let r = this.sources.get(e);
|
|
137
|
+
r && r.manager === t && g(r.mapping, n) || (r && r.manager !== t && this.detachFrom(r.manager, e), this.sources.set(e, {
|
|
138
|
+
manager: t,
|
|
139
|
+
mapping: n
|
|
140
|
+
}), t.subscribers.add(this), t.startObserving(), this.handleChange());
|
|
141
|
+
}
|
|
142
|
+
removeSource(e) {
|
|
143
|
+
let t = this.sources.get(e);
|
|
144
|
+
t && (this.sources.delete(e), this.detachFrom(t.manager, e), this.handleChange());
|
|
145
|
+
}
|
|
146
|
+
detachFrom(e, t) {
|
|
147
|
+
[...this.sources.entries()].some(([n, r]) => n !== t && r.manager === e) || (e.subscribers.delete(this), e.stopObservingIfUnused());
|
|
148
|
+
}
|
|
149
|
+
reachableParts(e = /* @__PURE__ */ new Set()) {
|
|
150
|
+
if (e.has(this)) return [];
|
|
151
|
+
e.add(this);
|
|
152
|
+
let t = [...this.directives];
|
|
153
|
+
for (let n of this.subscribers) t.push(...n.reachableParts(e));
|
|
154
|
+
return t;
|
|
155
|
+
}
|
|
156
|
+
getNodes(e) {
|
|
157
|
+
return this.placementNodes(e).filter((e) => !u.has(e));
|
|
158
|
+
}
|
|
159
|
+
placementNodes(e) {
|
|
160
|
+
return this.nodesFor(p(e));
|
|
161
|
+
}
|
|
162
|
+
hasContent(e) {
|
|
163
|
+
return this.getNodes(e).length > 0;
|
|
164
|
+
}
|
|
165
|
+
nodesFor(e) {
|
|
166
|
+
let t = this.nodesBySlot.get(e) ?? [];
|
|
167
|
+
if (this.sources.size === 0) return t;
|
|
168
|
+
let n = [];
|
|
169
|
+
for (let { manager: t, mapping: r } of this.sources.values()) for (let [i, a] of r) a === e && n.push(...t.nodesFor(i));
|
|
170
|
+
return n.length ? [...t, ...n] : t;
|
|
171
|
+
}
|
|
172
|
+
ensurePlaceholder(e) {
|
|
173
|
+
if (this.nodeToPlaceholder.has(e)) return;
|
|
174
|
+
if (e.parentNode !== this.host) {
|
|
175
|
+
for (let { manager: t } of this.sources.values()) t.ensurePlaceholder(e);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
let t = this.isInTemplate(e) ? this.getContentEnd() : e;
|
|
179
|
+
x(this.host, this.createPlaceholder(e), t);
|
|
180
|
+
}
|
|
181
|
+
createPlaceholder(t) {
|
|
182
|
+
let n = document.createComment(e.PLACEHOLDER_PREFIX);
|
|
183
|
+
if (t.nodeType === Node.TEXT_NODE) {
|
|
184
|
+
let e = t;
|
|
185
|
+
Object.defineProperty(n, "data", {
|
|
186
|
+
configurable: !0,
|
|
187
|
+
get: () => e.data,
|
|
188
|
+
set: (t) => {
|
|
189
|
+
e.data = t;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
return this.placeholderToNode.set(n, t), this.nodeToPlaceholder.set(t, n), n;
|
|
194
|
+
}
|
|
195
|
+
forgetPlaceholder(e) {
|
|
196
|
+
let t = this.nodeToPlaceholder.get(e);
|
|
197
|
+
return t && (this.placeholderToNode.delete(t), this.nodeToPlaceholder.delete(e)), t;
|
|
198
|
+
}
|
|
199
|
+
placeholderOf(e) {
|
|
200
|
+
return this.trackedNodes.has(e) ? this.nodeToPlaceholder.get(e) : void 0;
|
|
201
|
+
}
|
|
202
|
+
handleNow(e) {
|
|
203
|
+
if (this.rendering) return e();
|
|
204
|
+
this.flushMutations(!1);
|
|
205
|
+
let t = e();
|
|
206
|
+
return this.flushMutations(!1), t;
|
|
207
|
+
}
|
|
208
|
+
positionInHost(e) {
|
|
209
|
+
if (!e || e.parentNode === this.host) return this.rendering || e && !this.isInTemplate(e) ? e : this.getContentEnd() ?? e;
|
|
210
|
+
if (this.trackedNodes.has(e)) return this.nodeToPlaceholder.get(e) ?? e;
|
|
211
|
+
for (let t = e.previousSibling; t; t = t.previousSibling) {
|
|
212
|
+
let e = this.placeholderOf(t);
|
|
213
|
+
if (e) return e.nextSibling;
|
|
214
|
+
}
|
|
215
|
+
for (let t = e.nextSibling; t; t = t.nextSibling) {
|
|
216
|
+
let e = this.placeholderOf(t);
|
|
217
|
+
if (e) return e;
|
|
218
|
+
}
|
|
219
|
+
return this.reachableParts().some((t) => t.parentOfPart() === e.parentNode) ? this.getContentEnd() : e;
|
|
220
|
+
}
|
|
221
|
+
owns(e) {
|
|
222
|
+
return this.trackedNodes.has(e);
|
|
223
|
+
}
|
|
224
|
+
moveDistributed(e, t) {
|
|
225
|
+
let n = this.nodeToPlaceholder.get(e);
|
|
226
|
+
if (this.rendering || !n || !this.trackedNodes.has(e) || !e.parentNode || e.parentNode === this.host) return !1;
|
|
227
|
+
this.flushMutations(!1);
|
|
228
|
+
let r = this.positionInHost(t);
|
|
229
|
+
if (r === n || r === e) return !0;
|
|
230
|
+
if (r && r.parentNode !== this.host) return !1;
|
|
231
|
+
let i = m(e), a = this.nodesBySlot.get(i);
|
|
232
|
+
if (!a || !a.includes(e)) return !1;
|
|
233
|
+
let o = null;
|
|
234
|
+
for (let t = r; t && !o; t = t.nextSibling) {
|
|
235
|
+
let n = this.placeholderToNode.get(t) ?? t;
|
|
236
|
+
if (!(n === e || !this.trackedNodes.has(n))) {
|
|
237
|
+
if (n instanceof HTMLTemplateElement) return !1;
|
|
238
|
+
m(n) === i && (o = n);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
let s = a[a.length - 1] === e ? a[a.length - 2] : a[a.length - 1], c = o ?? s;
|
|
242
|
+
return c && (!c.parentNode || c.parentNode === this.host) ? !1 : (this.asOwnChange(() => {
|
|
243
|
+
x(this.host, n, r), a.splice(a.indexOf(e), 1), a.splice(o ? a.indexOf(o) : a.length, 0, e), o ? x(o.parentNode, e, o) : s && x(s.parentNode, e, s.nextSibling), this.handleChange();
|
|
244
|
+
}), !0);
|
|
245
|
+
}
|
|
246
|
+
replaceContent(e) {
|
|
247
|
+
if (!this.initialCollectionDone) return !1;
|
|
248
|
+
let t = e.flatMap((e) => e.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Array.from(e.childNodes) : [e]);
|
|
249
|
+
if (t.some((e) => e.contains(this.host))) return !1;
|
|
250
|
+
this.flushMutations(!1);
|
|
251
|
+
let n = this.getContentEnd();
|
|
252
|
+
return n ? (this.asOwnChange(() => {
|
|
253
|
+
let e = new Set(this.trackedNodes);
|
|
254
|
+
for (let t of this.nodesBySlot.values()) t.forEach((t) => e.add(t));
|
|
255
|
+
for (let t of e) {
|
|
256
|
+
let e = this.forgetPlaceholder(t);
|
|
257
|
+
e && S(e), S(t), this.untrack(t);
|
|
258
|
+
}
|
|
259
|
+
for (this.nodesBySlot.clear(), this.mirrorOf.clear(), this.contentBounds = null; n.previousSibling;) S(n.previousSibling);
|
|
260
|
+
let r = document.createDocumentFragment();
|
|
261
|
+
r.append(...t), x(this.host, r, n);
|
|
262
|
+
for (let e of t) this.watchHostText(e), _(e) && this.addContent(e);
|
|
263
|
+
this.handleChange();
|
|
264
|
+
}), !0) : !1;
|
|
265
|
+
}
|
|
266
|
+
adoptText(e) {
|
|
267
|
+
!this.initialCollectionDone || this.trackedNodes.has(e) || e.parentNode !== this.host || this.isInTemplate(e) || (this.flushMutations(!1), this.asOwnChange(() => {
|
|
268
|
+
this.dropMirror(e), this.insertInSlotOrder(e), this.track(e), this.handleChange();
|
|
269
|
+
}));
|
|
270
|
+
}
|
|
271
|
+
blankTextChanged(e) {
|
|
272
|
+
let t = this.mirrorOf.get(e);
|
|
273
|
+
t && (t.data = e.data, e.data) || this.initialCollectionDone && (e.parentNode !== this.host || this.isInTemplate(e) || (this.watchHostText(e), this.changedWhitespace.add(e), this.flushMutations(!1), this.asOwnChange(() => this.handleChange())));
|
|
274
|
+
}
|
|
275
|
+
releaseText(e) {
|
|
276
|
+
if (this.flushMutations(!1), !this.trackedNodes.has(e)) return;
|
|
277
|
+
let t = this.nodeToPlaceholder.get(e);
|
|
278
|
+
(t ? t.parentNode === this.host : e.parentNode === this.host) && this.asOwnChange(() => {
|
|
279
|
+
t && (this.forgetPlaceholder(e), Node.prototype.replaceChild.call(this.host, e, t)), this.removeContent(e), this.watchHostText(e), this.handleChange();
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
watchHostText(e) {
|
|
283
|
+
T(e), v(e) && (this.hasWhitespace = !0, this.changedWhitespace.add(e));
|
|
284
|
+
}
|
|
285
|
+
syncWhitespace() {
|
|
286
|
+
if (!this.hasWhitespace) return;
|
|
287
|
+
let e = this.findContentBounds(), t = this.contentBounds, n = this.changedWhitespace;
|
|
288
|
+
if (this.contentBounds = e, this.changedWhitespace = /* @__PURE__ */ new Set(), !e) {
|
|
289
|
+
for (let e of [...this.mirrorOf.keys()]) this.dropMirror(e);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (this.dropMirrorsOutside(), !t) this.collectBlankBetween(e.firstAt, e.lastAt, n);
|
|
293
|
+
else {
|
|
294
|
+
if (t.first !== e.first) {
|
|
295
|
+
let r = this.placeOf(t.first);
|
|
296
|
+
r && this.precedes(e.firstAt, r) ? this.collectBlankBetween(e.firstAt, r, n) : this.collectBlankBeside(e.firstAt, "nextSibling", n);
|
|
297
|
+
}
|
|
298
|
+
if (t.last !== e.last) {
|
|
299
|
+
let r = this.placeOf(t.last);
|
|
300
|
+
r && this.precedes(r, e.lastAt) ? this.collectBlankBetween(r, e.lastAt, n) : this.collectBlankBeside(e.lastAt, "previousSibling", n);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
for (let t of n) t.parentNode === this.host && v(t) && this.isBetween(t, e) ? this.addMirror(t) : this.dropMirror(t);
|
|
304
|
+
}
|
|
305
|
+
dropMirrorsOutside() {
|
|
306
|
+
let e = this.nodesBySlot.get(f) ?? [], t = [], n = (e) => {
|
|
307
|
+
if (u.has(e)) t.push(this.nodeToPlaceholder.get(e));
|
|
308
|
+
else if (this.placeOf(e)) return !1;
|
|
309
|
+
return !0;
|
|
310
|
+
};
|
|
311
|
+
for (let t = 0; t < e.length && n(e[t]); t++);
|
|
312
|
+
for (let t = e.length - 1; t >= 0 && n(e[t]); t--);
|
|
313
|
+
t.forEach((e) => this.dropMirror(e));
|
|
314
|
+
}
|
|
315
|
+
precedes(e, t) {
|
|
316
|
+
return !!(e.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
317
|
+
}
|
|
318
|
+
collectBlankBeside(e, t, n) {
|
|
319
|
+
for (let r = e[t]; r; r = r[t]) {
|
|
320
|
+
if (v(r)) {
|
|
321
|
+
n.add(r);
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
let e = this.placeholderToNode.get(r) ?? r;
|
|
325
|
+
if (!u.has(e) && this.trackedNodes.has(e)) return;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
findContentBounds() {
|
|
329
|
+
let e = this.nodesBySlot.get(f) ?? [], t = (e) => u.has(e) ? null : this.placeOf(e), n, r = null, i, a = null;
|
|
330
|
+
for (let i = 0; i < e.length && !r; i++) [n, r] = [e[i], t(e[i])];
|
|
331
|
+
for (let n = e.length - 1; n >= 0 && !a; n--) [i, a] = [e[n], t(e[n])];
|
|
332
|
+
return n && i && r && a ? {
|
|
333
|
+
first: n,
|
|
334
|
+
last: i,
|
|
335
|
+
firstAt: r,
|
|
336
|
+
lastAt: a
|
|
337
|
+
} : null;
|
|
338
|
+
}
|
|
339
|
+
placeOf(e) {
|
|
340
|
+
if (!this.trackedNodes.has(e)) return null;
|
|
341
|
+
let t = this.nodeToPlaceholder.get(e) ?? e;
|
|
342
|
+
return t.parentNode === this.host ? t : null;
|
|
343
|
+
}
|
|
344
|
+
isBetween(e, { firstAt: t, lastAt: n }) {
|
|
345
|
+
return this.precedes(t, e) && this.precedes(e, n);
|
|
346
|
+
}
|
|
347
|
+
collectBlankBetween(e, t, n) {
|
|
348
|
+
if (e === t) return;
|
|
349
|
+
let [r, i] = this.precedes(e, t) ? [e, t] : [t, e];
|
|
350
|
+
for (let e = r.nextSibling; e && e !== i; e = e.nextSibling) v(e) && n.add(e);
|
|
351
|
+
}
|
|
352
|
+
addMirror(e) {
|
|
353
|
+
if (this.mirrorOf.has(e)) return;
|
|
354
|
+
let t = document.createTextNode(e.data);
|
|
355
|
+
u.add(t), this.mirrorOf.set(e, t), this.placeholderToNode.set(e, t), this.nodeToPlaceholder.set(t, e), this.insertInSlotOrder(t);
|
|
356
|
+
}
|
|
357
|
+
dropMirror(e) {
|
|
358
|
+
let t = this.mirrorOf.get(e);
|
|
359
|
+
t && (this.mirrorOf.delete(e), this.forgetPlaceholder(t), S(t), this.removeFromSlots(t));
|
|
360
|
+
}
|
|
361
|
+
insertContentEnd() {
|
|
362
|
+
this.contentEnd || (this.contentEnd = document.createComment(""), Object.defineProperty(this.contentEnd, "nextSibling", {
|
|
363
|
+
configurable: !0,
|
|
364
|
+
get: () => null
|
|
365
|
+
})), this.contentEnd.parentNode !== this.host && x(this.host, this.contentEnd, null);
|
|
366
|
+
}
|
|
367
|
+
getContentEnd() {
|
|
368
|
+
let e = this.contentEnd;
|
|
369
|
+
return e ? (e.parentNode !== this.host && this.rootMarker?.parentNode === this.host && x(this.host, e, this.rootMarker), e.parentNode === this.host ? e : null) : null;
|
|
370
|
+
}
|
|
371
|
+
isInTemplate(e) {
|
|
372
|
+
let t = this.getContentEnd();
|
|
373
|
+
return !t || e.parentNode !== this.host ? !1 : e === t || !!(t.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
374
|
+
}
|
|
375
|
+
startObserving() {
|
|
376
|
+
if (this.wantsObserver = !0, this.observing) return;
|
|
377
|
+
this.observing = !0;
|
|
378
|
+
let e = () => {
|
|
379
|
+
!this.observing || typeof MutationObserver > "u" || (this.observer = new MutationObserver((e) => {
|
|
380
|
+
this.handleMutations(e);
|
|
381
|
+
}), this.observer.observe(this.host, {
|
|
382
|
+
childList: !0,
|
|
383
|
+
subtree: !0
|
|
384
|
+
}));
|
|
385
|
+
};
|
|
386
|
+
this.followsHostRenders ? e() : setTimeout(e, 0);
|
|
387
|
+
}
|
|
388
|
+
stopObserving() {
|
|
389
|
+
this.observing && (this.observing = !1, this.observer?.disconnect(), this.observer = null);
|
|
390
|
+
}
|
|
391
|
+
stopObservingIfUnused() {
|
|
392
|
+
let e = this.directives.size === 0 && this.subscribers.size === 0;
|
|
393
|
+
(!this.host.isConnected || e && !this.followsHostRenders) && this.stopObserving();
|
|
394
|
+
}
|
|
395
|
+
flushMutations(e) {
|
|
396
|
+
if (this.inOwnChange) return;
|
|
397
|
+
let t = this.observer?.takeRecords();
|
|
398
|
+
t?.length && this.handleMutations(t, e);
|
|
399
|
+
}
|
|
400
|
+
handleMutations(e, t = !1) {
|
|
401
|
+
this.inOwnChange || this.asOwnChange(() => this.applyMutations(e, t));
|
|
402
|
+
}
|
|
403
|
+
applyMutations(e, t) {
|
|
404
|
+
let n = !1, r = [], i = /* @__PURE__ */ new Map(), a = [];
|
|
405
|
+
for (let o of e) {
|
|
406
|
+
for (let e of o.removedNodes) {
|
|
407
|
+
let a = this.placeholderToNode.get(e);
|
|
408
|
+
if (a && e.parentNode === this.host) {
|
|
409
|
+
t || (this.removeFromSlots(a), this.insertInSlotOrder(a), S(a), u.has(a) && this.changedWhitespace.add(e), n = !0);
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
if (a) {
|
|
413
|
+
if (this.placeholderToNode.delete(e), this.nodeToPlaceholder.delete(a), u.has(a) && this.mirrorOf.delete(e), t) continue;
|
|
414
|
+
S(a), this.removeContent(a), n = !0;
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
if (this.trackedNodes.has(e) && !this.host.contains(e) && !t) {
|
|
418
|
+
this.removeContent(e);
|
|
419
|
+
let t = this.forgetPlaceholder(e);
|
|
420
|
+
if (t && (r.push(t), o.target !== this.host)) {
|
|
421
|
+
let e = i.get(o.target) ?? [];
|
|
422
|
+
e.push(t), i.set(o.target, e);
|
|
423
|
+
}
|
|
424
|
+
n = !0;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (o.target !== this.host) {
|
|
428
|
+
o.addedNodes.length && a.push(o);
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
if (!t) {
|
|
432
|
+
for (let e of o.addedNodes) if (!this.placeholderToNode.has(e)) {
|
|
433
|
+
if (this.trackedNodes.has(e) && e.parentNode === this.host) {
|
|
434
|
+
let t = this.forgetPlaceholder(e);
|
|
435
|
+
t && S(t), this.removeFromSlots(e), this.insertInSlotOrder(e), n = !0;
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
!this.trackedNodes.has(e) && _(e) ? (this.addContent(e), n = !0) : (this.watchHostText(e), v(e) && (n = !0));
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
i.size && this.adoptNodesInParts(a, i) && (n = !0);
|
|
443
|
+
for (let e of r) S(e);
|
|
444
|
+
this.getContentEnd(), n && this.handleChange();
|
|
445
|
+
}
|
|
446
|
+
adoptNodesInParts(e, t) {
|
|
447
|
+
let n = /* @__PURE__ */ new Set();
|
|
448
|
+
for (let r of e) t.has(r.target) && r.addedNodes.forEach((e) => n.add(e));
|
|
449
|
+
if (n.size === 0) return !1;
|
|
450
|
+
let r = this.reachableParts(), i = [];
|
|
451
|
+
for (let e of n) {
|
|
452
|
+
if (!e.parentNode || !t.has(e.parentNode) || l.has(e) || u.has(e) || this.placeholderToNode.has(e)) continue;
|
|
453
|
+
let n = r.find((t) => t.contains(e));
|
|
454
|
+
if (!n) continue;
|
|
455
|
+
let a = this.hostPositionFor(e, n, t);
|
|
456
|
+
a && i.push({
|
|
457
|
+
node: e,
|
|
458
|
+
before: a.before
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
if (i.length === 0) return !1;
|
|
462
|
+
let a = !1;
|
|
463
|
+
for (let { node: e, before: t } of i.sort(w)) _(e) && !(e instanceof HTMLTemplateElement) ? (x(this.host, this.createPlaceholder(e), t), this.insertInSlotOrder(e), this.track(e), a = !0) : x(this.host, e, t);
|
|
464
|
+
return a;
|
|
465
|
+
}
|
|
466
|
+
hostPositionFor(e, t, n) {
|
|
467
|
+
let { startNode: r, endNode: i } = t.bounds();
|
|
468
|
+
for (let t = e.nextSibling; t && t !== i; t = t.nextSibling) {
|
|
469
|
+
let e = this.placeholderOf(t);
|
|
470
|
+
if (e) return { before: e };
|
|
471
|
+
}
|
|
472
|
+
for (let t = e.previousSibling; t && t !== r; t = t.previousSibling) {
|
|
473
|
+
let e = this.placeholderOf(t);
|
|
474
|
+
if (e) return { before: e.nextSibling };
|
|
475
|
+
}
|
|
476
|
+
let a = e.parentNode ? n.get(e.parentNode) : void 0;
|
|
477
|
+
return a ? { before: a[0] } : null;
|
|
478
|
+
}
|
|
479
|
+
resync() {
|
|
480
|
+
this.asOwnChange(() => {
|
|
481
|
+
let e = !1;
|
|
482
|
+
for (let t of [...this.trackedNodes]) {
|
|
483
|
+
let n = this.nodeToPlaceholder.get(t), r = this.host.contains(t);
|
|
484
|
+
r && (!n || n.parentNode === this.host) || (n && S(this.forgetPlaceholder(t)), r && S(t), this.removeContent(t), e = !0);
|
|
485
|
+
}
|
|
486
|
+
let t = this.getContentEnd();
|
|
487
|
+
for (let n = t ? this.host.firstChild : null; n && n !== t; n = n.nextSibling) this.trackedNodes.has(n) || this.placeholderToNode.has(n) || (this.watchHostText(n), _(n) && (this.addContent(n), e = !0));
|
|
488
|
+
this.syncWhitespace(), this.sortSlots() && (e = !0), e && this.handleChange();
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
sortSlots() {
|
|
492
|
+
let e = !1;
|
|
493
|
+
for (let t of this.nodesBySlot.values()) {
|
|
494
|
+
if (!t.every((e) => this.nodeToPlaceholder.has(e))) continue;
|
|
495
|
+
let n = t.map((e) => ({
|
|
496
|
+
node: this.nodeToPlaceholder.get(e),
|
|
497
|
+
real: e
|
|
498
|
+
})).sort(w).map(({ real: e }) => e);
|
|
499
|
+
n.every((e, n) => e === t[n]) || (t.splice(0, t.length, ...n), n.forEach(S), e = !0);
|
|
500
|
+
}
|
|
501
|
+
return e;
|
|
502
|
+
}
|
|
503
|
+
handleChange() {
|
|
504
|
+
this.syncWhitespace(), this.generation++, this.notifyDirectives();
|
|
505
|
+
for (let e of this.subscribers) e.handleChange();
|
|
506
|
+
this.host.requestUpdate();
|
|
507
|
+
}
|
|
508
|
+
notifyDirectives() {
|
|
509
|
+
for (let e of this.directives) e.handleNodesChanged();
|
|
510
|
+
}
|
|
511
|
+
asOwnChange(e) {
|
|
512
|
+
let t = this.inOwnChange;
|
|
513
|
+
this.inOwnChange = !0;
|
|
514
|
+
try {
|
|
515
|
+
e();
|
|
516
|
+
} finally {
|
|
517
|
+
t || (this.observer?.takeRecords(), this.inOwnChange = !1);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
addContent(e) {
|
|
521
|
+
e instanceof HTMLTemplateElement ? y(e, this.nodesBySlot) : this.insertInSlotOrder(e), this.track(e);
|
|
522
|
+
}
|
|
523
|
+
removeContent(e) {
|
|
524
|
+
this.untrack(e), this.removeFromSlots(e);
|
|
525
|
+
}
|
|
526
|
+
track(e) {
|
|
527
|
+
this.trackedNodes.add(e), l.set(e, this), T(e);
|
|
528
|
+
}
|
|
529
|
+
untrack(e) {
|
|
530
|
+
this.trackedNodes.delete(e), l.get(e) === this && l.delete(e);
|
|
531
|
+
}
|
|
532
|
+
insertInSlotOrder(e) {
|
|
533
|
+
let t = m(e), n = this.nodesBySlot.get(t) ?? [];
|
|
534
|
+
this.nodesBySlot.set(t, n);
|
|
535
|
+
let r = this.nodeToPlaceholder.get(e) ?? e, i = (e) => {
|
|
536
|
+
let t = this.nodeToPlaceholder.get(e) ?? e;
|
|
537
|
+
return !!(r.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
538
|
+
}, a = n.length;
|
|
539
|
+
for (; a > 0 && i(n[a - 1]);) a--;
|
|
540
|
+
n.splice(a, 0, e);
|
|
541
|
+
}
|
|
542
|
+
removeFromSlots(e) {
|
|
543
|
+
for (let [t, n] of this.nodesBySlot) {
|
|
544
|
+
let r = n.indexOf(e);
|
|
545
|
+
if (r !== -1) {
|
|
546
|
+
n.splice(r, 1), n.length === 0 && this.nodesBySlot.delete(t);
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}, O = e(class extends i {
|
|
552
|
+
constructor(e) {
|
|
553
|
+
if (super(e), this.manager = null, this.host = null, this.part = null, this.lastGeneration = -1, e.type !== n.CHILD) throw Error("slotContent() can only be used in child expressions");
|
|
554
|
+
}
|
|
555
|
+
render(e, n) {
|
|
556
|
+
return t;
|
|
557
|
+
}
|
|
558
|
+
update(e, [n, r]) {
|
|
559
|
+
return this.part = e, this.host = n, this.slotName = r, this.manager || (this.manager = d(n), this.manager.collectNodes(), this.manager.addDirective(this)), this.placeNodes(), t;
|
|
560
|
+
}
|
|
561
|
+
handleNodesChanged() {
|
|
562
|
+
!this.isConnected || !this.manager || this.placeNodes();
|
|
563
|
+
}
|
|
564
|
+
disconnected() {
|
|
565
|
+
this.manager?.removeDirective(this), this.manager = null, this.lastGeneration = -1;
|
|
566
|
+
}
|
|
567
|
+
reconnected() {
|
|
568
|
+
this.host && (this.manager = d(this.host), this.manager.addDirective(this), this.placeNodes());
|
|
569
|
+
}
|
|
570
|
+
contains(e) {
|
|
571
|
+
let t = this.parentOfPart();
|
|
572
|
+
return !this.isConnected || !t ? !1 : this.isInsidePart(e, t, this.coversContainer(t));
|
|
573
|
+
}
|
|
574
|
+
bounds() {
|
|
575
|
+
return {
|
|
576
|
+
startNode: this.part?.startNode ?? null,
|
|
577
|
+
endNode: this.part?.endNode ?? null
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
parentOfPart() {
|
|
581
|
+
return this.part ? this.part.startNode ? this.part.startNode.parentNode : this.part.parentNode : null;
|
|
582
|
+
}
|
|
583
|
+
placeNodes() {
|
|
584
|
+
if (!this.manager || !this.part) return;
|
|
585
|
+
let e = this.manager.generation;
|
|
586
|
+
if (e === this.lastGeneration) return;
|
|
587
|
+
this.lastGeneration = e;
|
|
588
|
+
let t = this.parentOfPart();
|
|
589
|
+
if (!t) return;
|
|
590
|
+
let n = this.manager.placementNodes(this.slotName), r = this.coversContainer(t), i = this.part.endNode;
|
|
591
|
+
for (let e = n.length - 1; e >= 0; e--) {
|
|
592
|
+
let a = n[e];
|
|
593
|
+
this.isInsidePart(a, t, r) || (this.manager.ensurePlaceholder(a), x(t, a, i)), i = a;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
coversContainer(e) {
|
|
597
|
+
let { startNode: t, endNode: n } = this.part;
|
|
598
|
+
return !n && (!t || t === e.firstChild);
|
|
599
|
+
}
|
|
600
|
+
isInsidePart(e, t, n) {
|
|
601
|
+
if (!this.part || e.parentNode !== t) return !1;
|
|
602
|
+
if (n) return !0;
|
|
603
|
+
let { startNode: r, endNode: i } = this.part, a = !r || !!(r.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING), o = !i || !!(e.compareDocumentPosition(i) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
604
|
+
return a && o;
|
|
605
|
+
}
|
|
606
|
+
}), k = e(class extends i {
|
|
607
|
+
constructor(e) {
|
|
608
|
+
if (super(e), this.target = null, this.source = null, this.mapping = [], e.type !== n.ELEMENT) throw Error("forwardSlots() can only be used as an element directive");
|
|
609
|
+
}
|
|
610
|
+
render(e, n) {
|
|
611
|
+
return t;
|
|
612
|
+
}
|
|
613
|
+
update(e, [n, r]) {
|
|
614
|
+
let i = d(e.element);
|
|
615
|
+
return this.target && this.target !== i && this.target.removeSource(this), this.target = i, this.source = d(n), this.source.collectNodes(), this.mapping = h(r), this.target.addSource(this, this.source, this.mapping), t;
|
|
616
|
+
}
|
|
617
|
+
disconnected() {
|
|
618
|
+
this.target?.removeSource(this);
|
|
619
|
+
}
|
|
620
|
+
reconnected() {
|
|
621
|
+
this.target && this.source && this.target.addSource(this, this.source, this.mapping);
|
|
622
|
+
}
|
|
623
|
+
}), A = /* @__PURE__ */ new Map();
|
|
624
|
+
function j(e) {
|
|
625
|
+
if (A.has(e)) return A.get(e);
|
|
626
|
+
let t, n = HTMLElement.prototype;
|
|
627
|
+
for (; !t && n;) t = Object.getOwnPropertyDescriptor(n, e), n = Object.getPrototypeOf(n);
|
|
628
|
+
return A.set(e, t), t;
|
|
629
|
+
}
|
|
630
|
+
function M(e, t) {
|
|
631
|
+
return t.some((t) => typeof t != "string" && t.contains(e));
|
|
632
|
+
}
|
|
633
|
+
var N = class extends r {
|
|
634
|
+
connectedCallback() {
|
|
635
|
+
d(this).collectNodes(), super.connectedCallback();
|
|
636
|
+
}
|
|
637
|
+
hasSlotContent(e) {
|
|
638
|
+
return d(this).hasContent(e);
|
|
639
|
+
}
|
|
640
|
+
appendChild(e) {
|
|
641
|
+
let t = d(this);
|
|
642
|
+
return t.moveDistributed(e, null) ? e : t.handleNow(() => super.insertBefore(e, t.positionInHost(null)));
|
|
643
|
+
}
|
|
644
|
+
append(...e) {
|
|
645
|
+
if (M(this, e)) {
|
|
646
|
+
super.append(...e);
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
let t = d(this);
|
|
650
|
+
t.handleNow(() => {
|
|
651
|
+
let n = document.createDocumentFragment();
|
|
652
|
+
n.append(...e), super.insertBefore(n, t.positionInHost(null));
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
prepend(...e) {
|
|
656
|
+
d(this).handleNow(() => super.prepend(...e));
|
|
657
|
+
}
|
|
658
|
+
insertBefore(e, t) {
|
|
659
|
+
let n = d(this);
|
|
660
|
+
return n.moveDistributed(e, t) ? e : n.handleNow(() => super.insertBefore(e, n.positionInHost(t)));
|
|
661
|
+
}
|
|
662
|
+
removeChild(e) {
|
|
663
|
+
let t = d(this);
|
|
664
|
+
return e.parentNode === this || !t.owns(e) ? super.removeChild(e) : t.handleNow(() => (e.parentNode?.removeChild(e), e));
|
|
665
|
+
}
|
|
666
|
+
replaceChild(e, t) {
|
|
667
|
+
let n = d(this);
|
|
668
|
+
return t.parentNode === this || !n.owns(t) ? super.replaceChild(e, t) : n.handleNow(() => (super.insertBefore(e, n.positionInHost(t)), t.parentNode?.removeChild(t), t));
|
|
669
|
+
}
|
|
670
|
+
replaceChildren(...e) {
|
|
671
|
+
let t = e.map((e) => typeof e == "string" ? document.createTextNode(e) : e);
|
|
672
|
+
d(this).replaceContent(t) || super.replaceChildren(...e);
|
|
673
|
+
}
|
|
674
|
+
get textContent() {
|
|
675
|
+
return j("textContent").get.call(this);
|
|
676
|
+
}
|
|
677
|
+
set textContent(e) {
|
|
678
|
+
let t = e == null ? "" : String(e);
|
|
679
|
+
d(this).replaceContent(t ? [document.createTextNode(t)] : []) || j("textContent").set.call(this, e);
|
|
680
|
+
}
|
|
681
|
+
get innerHTML() {
|
|
682
|
+
return j("innerHTML").get.call(this);
|
|
683
|
+
}
|
|
684
|
+
set innerHTML(e) {
|
|
685
|
+
let t = document.createElement("template");
|
|
686
|
+
t.innerHTML = e, d(this).replaceContent(Array.from(t.content.childNodes)) || j("innerHTML").set.call(this, e);
|
|
687
|
+
}
|
|
688
|
+
get innerText() {
|
|
689
|
+
let e = j("innerText");
|
|
690
|
+
return e?.get ? e.get.call(this) : this.textContent;
|
|
691
|
+
}
|
|
692
|
+
set innerText(e) {
|
|
693
|
+
let t = j("innerText");
|
|
694
|
+
if (!t?.set) {
|
|
695
|
+
this.textContent = e;
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
let n = document.createElement("div");
|
|
699
|
+
t.set.call(n, e), d(this).replaceContent(Array.from(n.childNodes)) || t.set.call(this, e);
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
//#endregion
|
|
703
|
+
export { o as a, O as i, k as n, d as r, N as t };
|