@oslokommune/punkt-elements 19.10.2 → 19.11.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.
Files changed (141) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/{accordion-BhCmUDoS.js → accordion-CjGAmoQq.js} +1 -1
  3. package/dist/{accordion-BFKmnCDh.cjs → accordion-lbYihdiw.cjs} +1 -1
  4. package/dist/{alert-BJPi5ylH.cjs → alert-CuXM6TnC.cjs} +1 -1
  5. package/dist/{alert-CUH_2zb2.js → alert-Xt26J9yX.js} +2 -2
  6. package/dist/base-elements/element-with-slot.d.ts +13 -0
  7. package/dist/{button-CWHqXdSG.cjs → button-BFG-7bDB.cjs} +1 -1
  8. package/dist/{button-DQ8rH8hx.js → button-DhCqyX4D.js} +1 -1
  9. package/dist/{card-DfVOJCWA.js → card-DCc3wfUb.js} +2 -2
  10. package/dist/{card-pJ0CDH2Y.cjs → card-Diivw_vm.cjs} +1 -1
  11. package/dist/{checkbox-BEBBPgYW.js → checkbox-CCBZc3Ix.js} +1 -1
  12. package/dist/{checkbox-3z2uH8rd.cjs → checkbox-Dyyrw5TE.cjs} +1 -1
  13. package/dist/{checkbox-group-DRQmSHyN.cjs → checkbox-group-COWUvl52.cjs} +1 -1
  14. package/dist/{checkbox-group-BiPX1EhY.js → checkbox-group-CsrEj7oZ.js} +2 -2
  15. package/dist/{combobox-CdmzQtCh.js → combobox-B0VWv9c_.js} +5 -5
  16. package/dist/{combobox-C_SMnNsj.cjs → combobox-I8qdg8A4.cjs} +1 -1
  17. package/dist/{consent-eTXt052m.js → consent-BUS6GEUu.js} +2 -2
  18. package/dist/{consent-CkK9BZ7t.cjs → consent-DBYZaCTp.cjs} +1 -1
  19. package/dist/{datepicker-BrQhahYy.cjs → datepicker-0NSvgPXK.cjs} +1 -1
  20. package/dist/{datepicker-DILpPWCY.js → datepicker-B80E_4Cg.js} +4 -4
  21. package/dist/directives/slot-content.d.ts +259 -62
  22. package/dist/docs/components/alert.d.ts +1 -1
  23. package/dist/docs/components/slot-internals.d.ts +14 -0
  24. package/dist/docs/components/slots.d.ts +2 -0
  25. package/dist/element-with-slot-CVmm0_IE.js +703 -0
  26. package/dist/element-with-slot-CcJPCLgn.cjs +1 -0
  27. package/dist/{fileupload-BZjZh8Mp.js → fileupload-BmfFC748.js} +3 -3
  28. package/dist/{fileupload-l1d9UQf9.cjs → fileupload-CyLRyoVU.cjs} +1 -1
  29. package/dist/{footer-C8Zh-eUU.cjs → footer-C6ajmlq2.cjs} +1 -1
  30. package/dist/{footer-X5MBVUoo.js → footer-L2vhQTAS.js} +1 -1
  31. package/dist/{header-DLH6Xx97.js → header-DLKiD7xm.js} +6 -6
  32. package/dist/{header-EvwDJXP-.cjs → header-IQvyDow3.cjs} +1 -1
  33. package/dist/{header-menu-0UtMd2_H.js → header-menu-Ch135F5Y.js} +1 -1
  34. package/dist/{header-menu-BqFpYI-V.cjs → header-menu-DpuxDU9a.cjs} +1 -1
  35. package/dist/{heading-DMHbL3xs.cjs → heading-BluavR6A.cjs} +1 -1
  36. package/dist/{heading-tWSLaRPD.js → heading-y72aIgB8.js} +1 -1
  37. package/dist/{helptext-CGa1p-yd.cjs → helptext-Bdv80rcs.cjs} +1 -1
  38. package/dist/{helptext-Dy2Ehs9W.js → helptext-Dujce_W9.js} +1 -1
  39. package/dist/{input-element-kIrd5ABs.cjs → input-element-B9Mhkoog.cjs} +1 -1
  40. package/dist/{input-element-BGbT4ICl.js → input-element-BdDamXvR.js} +1 -1
  41. package/dist/{input-wrapper-Uks0spRR.js → input-wrapper-Bb6CZxmg.js} +3 -3
  42. package/dist/{input-wrapper-EvzyXMw-.cjs → input-wrapper-BwzajfFX.cjs} +1 -1
  43. package/dist/{link-CLdiz-ly.cjs → link-CRLAhYi0.cjs} +1 -1
  44. package/dist/{link-C0yBFscy.js → link-sO401Ieh.js} +1 -1
  45. package/dist/{linkcard-B5-p-YC4.js → linkcard-DdmGxzAP.js} +1 -1
  46. package/dist/{linkcard-v9UsV9Os.cjs → linkcard-DnZgMzqL.cjs} +1 -1
  47. package/dist/{loader-DWvjIMsT.js → loader-Di5kHEQ4.js} +1 -1
  48. package/dist/{loader-C4UfUu2u.cjs → loader-Zo_VSsNw.cjs} +1 -1
  49. package/dist/{messagebox-clOimkn7.cjs → messagebox-CR59jv8N.cjs} +1 -1
  50. package/dist/{messagebox-CJTqxfu3.js → messagebox-CzaFlrYz.js} +1 -1
  51. package/dist/{modal-Bm1daKaW.js → modal-B3CQEBBB.js} +2 -2
  52. package/dist/{modal-BPweteoS.cjs → modal-BKeSXrzi.cjs} +1 -1
  53. package/dist/{option-group-element-2A4TBcp-.cjs → option-group-element-CzehfgVZ.cjs} +1 -1
  54. package/dist/{option-group-element-Ber7NAlg.js → option-group-element-D5PgGNdt.js} +2 -2
  55. package/dist/pkt-accordion.cjs +1 -1
  56. package/dist/pkt-accordion.js +1 -1
  57. package/dist/pkt-alert.cjs +1 -1
  58. package/dist/pkt-alert.js +1 -1
  59. package/dist/pkt-button.cjs +1 -1
  60. package/dist/pkt-button.js +1 -1
  61. package/dist/pkt-card.cjs +1 -1
  62. package/dist/pkt-card.js +1 -1
  63. package/dist/pkt-checkbox-group.cjs +1 -1
  64. package/dist/pkt-checkbox-group.js +1 -1
  65. package/dist/pkt-checkbox.cjs +1 -1
  66. package/dist/pkt-checkbox.js +1 -1
  67. package/dist/pkt-combobox.cjs +1 -1
  68. package/dist/pkt-combobox.js +1 -1
  69. package/dist/pkt-consent.cjs +1 -1
  70. package/dist/pkt-consent.js +1 -1
  71. package/dist/pkt-datepicker.cjs +1 -1
  72. package/dist/pkt-datepicker.js +1 -1
  73. package/dist/pkt-fileupload.cjs +1 -1
  74. package/dist/pkt-fileupload.js +1 -1
  75. package/dist/pkt-footer.cjs +1 -1
  76. package/dist/pkt-footer.js +1 -1
  77. package/dist/pkt-header-menu.cjs +1 -1
  78. package/dist/pkt-header-menu.js +1 -1
  79. package/dist/pkt-header.cjs +1 -1
  80. package/dist/pkt-header.js +1 -1
  81. package/dist/pkt-heading.cjs +1 -1
  82. package/dist/pkt-heading.js +1 -1
  83. package/dist/pkt-helptext.cjs +1 -1
  84. package/dist/pkt-helptext.js +1 -1
  85. package/dist/pkt-index.cjs +1 -1
  86. package/dist/pkt-index.js +29 -29
  87. package/dist/pkt-input-wrapper.cjs +1 -1
  88. package/dist/pkt-input-wrapper.js +1 -1
  89. package/dist/pkt-link.cjs +1 -1
  90. package/dist/pkt-link.js +1 -1
  91. package/dist/pkt-linkcard.cjs +1 -1
  92. package/dist/pkt-linkcard.js +1 -1
  93. package/dist/pkt-loader.cjs +1 -1
  94. package/dist/pkt-loader.js +1 -1
  95. package/dist/pkt-messagebox.cjs +1 -1
  96. package/dist/pkt-messagebox.js +1 -1
  97. package/dist/pkt-modal.cjs +1 -1
  98. package/dist/pkt-modal.js +1 -1
  99. package/dist/{pkt-options-controller-Ck_549wx.cjs → pkt-options-controller-139UsV4h.cjs} +1 -1
  100. package/dist/{pkt-options-controller-DTOlYR9b.js → pkt-options-controller-CHosj1Oo.js} +1 -1
  101. package/dist/pkt-radio-group.cjs +1 -1
  102. package/dist/pkt-radio-group.js +1 -1
  103. package/dist/pkt-radiobutton.cjs +1 -1
  104. package/dist/pkt-radiobutton.js +1 -1
  105. package/dist/pkt-select.cjs +1 -1
  106. package/dist/pkt-select.js +1 -1
  107. package/dist/pkt-tabs.cjs +1 -1
  108. package/dist/pkt-tabs.js +1 -1
  109. package/dist/pkt-tag.cjs +1 -1
  110. package/dist/pkt-tag.js +1 -1
  111. package/dist/pkt-textarea.cjs +1 -1
  112. package/dist/pkt-textarea.js +1 -1
  113. package/dist/pkt-textinput.cjs +1 -1
  114. package/dist/pkt-textinput.js +1 -1
  115. package/dist/pkt-timepicker.cjs +1 -1
  116. package/dist/pkt-timepicker.js +1 -1
  117. package/dist/{radio-group-CMtx_GRV.js → radio-group-CZGcjEmV.js} +2 -2
  118. package/dist/{radio-group-9Szx2XyM.cjs → radio-group-DaIRh-fL.cjs} +1 -1
  119. package/dist/{radiobutton-CYbvJ9y8.js → radiobutton-BJCSVvcQ.js} +1 -1
  120. package/dist/{radiobutton-Dq2qkfi0.cjs → radiobutton-qTPNeZl5.cjs} +1 -1
  121. package/dist/{scroll-lock-BN8lOhV5.cjs → scroll-lock-B46ur0FF.cjs} +1 -1
  122. package/dist/{scroll-lock-DAbNKAUy.js → scroll-lock-BALd8hF9.js} +4 -1
  123. package/dist/{select-DlgOxHIl.js → select-CIAfUw8F.js} +4 -4
  124. package/dist/{select-1nm17iN8.cjs → select-CQpwjRPh.cjs} +1 -1
  125. package/dist/shared-utils/scroll-lock/index.d.ts +3 -1
  126. package/dist/{tabs-D3pPS9us.js → tabs-DBW3P90Z.js} +2 -1
  127. package/dist/{tabs-8Y5PlmLl.cjs → tabs-R1Jzzj3-.cjs} +1 -1
  128. package/dist/{tag-DOUsW7nS.cjs → tag-BMtnaJ1A.cjs} +1 -1
  129. package/dist/{tag-qHYIycl8.js → tag-uVXp7uP-.js} +1 -1
  130. package/dist/{textarea-B3qIDyEQ.js → textarea-553WDMEq.js} +3 -3
  131. package/dist/{textarea-DkeCQKmM.cjs → textarea-DWLVisQX.cjs} +1 -1
  132. package/dist/{textinput-DibZCHh_.cjs → textinput-C7JFm9jD.cjs} +1 -1
  133. package/dist/{textinput-CwvVRNsP.js → textinput-wZSCpQgv.js} +3 -3
  134. package/dist/{timepicker-C_oG9W9Y.js → timepicker-CMe0IbPm.js} +3 -3
  135. package/dist/{timepicker-CZ_1HVlF.cjs → timepicker-DVyi8teh.cjs} +1 -1
  136. package/package.json +2 -2
  137. package/src/components/button/button.test.ts +13 -0
  138. package/src/components/consent/consent.ts +3 -1
  139. package/src/components/tabs/tabitem.ts +1 -0
  140. package/dist/element-with-slot-DOt8HbXA.cjs +0 -1
  141. package/dist/element-with-slot-U981OZM_.js +0 -353
@@ -1,353 +0,0 @@
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();
16
- function u(e) {
17
- let t = c.get(e);
18
- return t || (t = new y(e), c.set(e, t)), t;
19
- }
20
- var d = Symbol("default");
21
- function f(e) {
22
- return e === void 0 ? d : e;
23
- }
24
- function p(e) {
25
- return Array.isArray(e) ? e.map((e) => {
26
- let t = e === null ? d : e;
27
- return [t, t];
28
- }) : Object.entries(e).map(([e, t]) => [e, t === null ? d : t]);
29
- }
30
- function m(e, t) {
31
- return e.length === t.length && e.every(([e, n], r) => t[r][0] === e && t[r][1] === n);
32
- }
33
- function h(e, t) {
34
- if (e.nodeType === Node.COMMENT_NODE) return !1;
35
- if (e.nodeType === Node.TEXT_NODE) return s(e) ? (v(t, d, e), !0) : !1;
36
- if (e.nodeType === Node.ELEMENT_NODE) {
37
- let n = e;
38
- if (a(n) || o(n)) return !1;
39
- if (n instanceof HTMLTemplateElement) {
40
- let e = Array.from(n.content.childNodes), r = f(n.getAttribute("slot") ?? void 0);
41
- for (let n of e) v(t, r, n);
42
- return !0;
43
- }
44
- return v(t, g(e), e), !0;
45
- }
46
- return !1;
47
- }
48
- function g(e) {
49
- if (e.nodeType !== Node.ELEMENT_NODE) return d;
50
- let t = e.getAttribute("slot");
51
- return t === null ? d : f(t);
52
- }
53
- function _(e, t) {
54
- return e.node.compareDocumentPosition(t.node) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
55
- }
56
- function v(e, t, n) {
57
- let r = e.get(t);
58
- r || (r = [], e.set(t, r)), r.push(n);
59
- }
60
- var y = class e {
61
- static {
62
- this.PLACEHOLDER_PREFIX = "pkt-slot";
63
- }
64
- constructor(e) {
65
- this.observer = null, this.nodesBySlot = /* @__PURE__ */ new Map(), this.directives = /* @__PURE__ */ new Set(), this.observing = !1, this.trackedNodes = /* @__PURE__ */ new Set(), this.generation = 0, this.initialCollectionDone = !1, this.processingMutations = !1, this.placeholderToNode = /* @__PURE__ */ new Map(), this.nodeToPlaceholder = /* @__PURE__ */ new Map(), this.sources = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Set(), this.followsHostRenders = !1, this.wantsObserver = !1, this.host = e, typeof e.addController == "function" && (this.followsHostRenders = !0, e.addController({
66
- hostConnected: () => {
67
- this.wantsObserver && this.startObserving();
68
- },
69
- hostDisconnected: () => this.stopObservingIfUnused(),
70
- hostUpdate: () => {
71
- e.hasUpdated || this.collectLateChildren(), this.flushMutations(!1);
72
- },
73
- hostUpdated: () => this.flushMutations(!0)
74
- }));
75
- }
76
- collectNodes() {
77
- if (this.initialCollectionDone) return;
78
- this.initialCollectionDone = !0, this.generation++;
79
- let e = Array.from(this.host.childNodes);
80
- for (let t of e) h(t, this.nodesBySlot) && this.track(t);
81
- }
82
- collectLateChildren() {
83
- if (this.initialCollectionDone) for (let e of Array.from(this.host.childNodes)) this.trackedNodes.has(e) || !this.isUserContent(e) || (e instanceof HTMLTemplateElement ? h(e, this.nodesBySlot) : this.insertInSlotOrder(e), this.track(e), this.generation++);
84
- }
85
- addDirective(e) {
86
- this.directives.add(e), this.startObserving();
87
- }
88
- removeDirective(e) {
89
- this.directives.delete(e), this.stopObservingIfUnused();
90
- }
91
- addSource(e, t, n) {
92
- let r = this.sources.get(e);
93
- r && r.manager === t && m(r.mapping, n) || (r && r.manager !== t && this.detachFrom(r.manager, e), this.sources.set(e, {
94
- manager: t,
95
- mapping: n
96
- }), t.subscribers.add(this), t.startObserving(), this.handleChange());
97
- }
98
- removeSource(e) {
99
- let t = this.sources.get(e);
100
- t && (this.sources.delete(e), this.detachFrom(t.manager, e), this.handleChange());
101
- }
102
- getNodes(e) {
103
- return this.nodesFor(f(e));
104
- }
105
- hasContent(e) {
106
- return this.getNodes(e).length > 0;
107
- }
108
- ensurePlaceholder(t) {
109
- if (this.nodeToPlaceholder.has(t)) return;
110
- if (t.parentNode !== this.host) {
111
- for (let { manager: e } of this.sources.values()) e.ensurePlaceholder(t);
112
- return;
113
- }
114
- let n = document.createComment(e.PLACEHOLDER_PREFIX);
115
- this.host.insertBefore(n, t), this.placeholderToNode.set(n, t), this.nodeToPlaceholder.set(t, n);
116
- }
117
- nodesFor(e) {
118
- let t = this.nodesBySlot.get(e) ?? [];
119
- if (this.sources.size === 0) return t;
120
- let n = [];
121
- for (let { manager: t, mapping: r } of this.sources.values()) for (let [i, a] of r) a === e && n.push(...t.nodesFor(i));
122
- return n.length ? [...t, ...n] : t;
123
- }
124
- detachFrom(e, t) {
125
- [...this.sources.entries()].some(([n, r]) => n !== t && r.manager === e) || (e.subscribers.delete(this), e.stopObservingIfUnused());
126
- }
127
- handleChange() {
128
- this.generation++, this.notifyDirectives();
129
- for (let e of this.subscribers) e.handleChange();
130
- this.host.requestUpdate();
131
- }
132
- stopObservingIfUnused() {
133
- let e = this.directives.size === 0 && this.subscribers.size === 0;
134
- (!this.host.isConnected || e && !this.followsHostRenders) && this.stopObserving();
135
- }
136
- startObserving() {
137
- if (this.wantsObserver = !0, this.observing) return;
138
- this.observing = !0;
139
- let e = () => {
140
- !this.observing || typeof MutationObserver > "u" || (this.observer = new MutationObserver((e) => {
141
- this.handleMutations(e);
142
- }), this.observer.observe(this.host, {
143
- childList: !0,
144
- subtree: !0
145
- }));
146
- };
147
- this.followsHostRenders ? e() : setTimeout(e, 0);
148
- }
149
- flushMutations(e) {
150
- if (this.processingMutations) return;
151
- let t = this.observer?.takeRecords();
152
- t?.length && this.handleMutations(t, e);
153
- }
154
- stopObserving() {
155
- this.observing && (this.observing = !1, this.observer?.disconnect(), this.observer = null);
156
- }
157
- handleMutations(e, t = !1) {
158
- if (this.processingMutations) return;
159
- this.processingMutations = !0;
160
- let n = !1, r = [], i = /* @__PURE__ */ new Map(), a = [];
161
- for (let o of e) {
162
- for (let e of o.removedNodes) {
163
- let a = this.placeholderToNode.get(e);
164
- if (a) {
165
- if (this.placeholderToNode.delete(e), this.nodeToPlaceholder.delete(a), t) continue;
166
- a.parentNode?.removeChild(a), this.untrack(a), this.removeFromSlots(a), n = !0;
167
- continue;
168
- }
169
- if (this.trackedNodes.has(e) && !this.host.contains(e) && !t) {
170
- this.untrack(e), this.removeFromSlots(e);
171
- let t = this.nodeToPlaceholder.get(e);
172
- if (t && (this.placeholderToNode.delete(t), this.nodeToPlaceholder.delete(e), r.push(t), o.target !== this.host)) {
173
- let e = i.get(o.target) ?? [];
174
- e.push(t), i.set(o.target, e);
175
- }
176
- n = !0;
177
- }
178
- }
179
- if (o.target !== this.host) {
180
- o.addedNodes.length && a.push(o);
181
- continue;
182
- }
183
- if (!t) for (let e of o.addedNodes) this.placeholderToNode.has(e) || !this.trackedNodes.has(e) && this.isUserContent(e) && (e instanceof HTMLTemplateElement ? h(e, this.nodesBySlot) : this.insertInSlotOrder(e), this.track(e), n = !0);
184
- }
185
- i.size && this.adoptNodesInParts(a, i) && (n = !0);
186
- for (let e of r) e.parentNode?.removeChild(e);
187
- n && this.handleChange(), this.observer?.takeRecords(), this.processingMutations = !1;
188
- }
189
- adoptNodesInParts(t, n) {
190
- let r = /* @__PURE__ */ new Set();
191
- for (let e of t) n.has(e.target) && e.addedNodes.forEach((e) => r.add(e));
192
- if (r.size === 0) return !1;
193
- let i = this.reachableParts(), a = [];
194
- for (let e of r) {
195
- if (!e.parentNode || !n.has(e.parentNode) || l.has(e) || this.placeholderToNode.has(e)) continue;
196
- let t = i.find((t) => t.contains(e));
197
- if (!t) continue;
198
- let r = this.hostPositionFor(e, t, n);
199
- r && a.push({
200
- node: e,
201
- before: r.before
202
- });
203
- }
204
- if (a.length === 0) return !1;
205
- let o = !1;
206
- for (let { node: t, before: n } of a.sort(_)) if (this.isUserContent(t) && !(t instanceof HTMLTemplateElement)) {
207
- let r = document.createComment(e.PLACEHOLDER_PREFIX);
208
- this.host.insertBefore(r, n), this.placeholderToNode.set(r, t), this.nodeToPlaceholder.set(t, r), this.insertInSlotOrder(t), this.track(t), o = !0;
209
- } else this.host.insertBefore(t, n);
210
- return o;
211
- }
212
- hostPositionFor(e, t, n) {
213
- let { startNode: r, endNode: i } = t.bounds();
214
- for (let t = e.nextSibling; t && t !== i; t = t.nextSibling) {
215
- let e = this.placeholderOf(t);
216
- if (e) return { before: e };
217
- }
218
- for (let t = e.previousSibling; t && t !== r; t = t.previousSibling) {
219
- let e = this.placeholderOf(t);
220
- if (e) return { before: e.nextSibling };
221
- }
222
- let a = e.parentNode ? n.get(e.parentNode) : void 0;
223
- return a ? { before: a[0] } : null;
224
- }
225
- placeholderOf(e) {
226
- return this.trackedNodes.has(e) ? this.nodeToPlaceholder.get(e) : void 0;
227
- }
228
- reachableParts(e = /* @__PURE__ */ new Set()) {
229
- if (e.has(this)) return [];
230
- e.add(this);
231
- let t = [...this.directives];
232
- for (let n of this.subscribers) t.push(...n.reachableParts(e));
233
- return t;
234
- }
235
- insertInSlotOrder(e) {
236
- let t = g(e), n = this.nodesBySlot.get(t) ?? [];
237
- this.nodesBySlot.set(t, n);
238
- let r = this.nodeToPlaceholder.get(e) ?? e, i = (e) => {
239
- let t = this.nodeToPlaceholder.get(e) ?? e;
240
- return !!(r.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING);
241
- };
242
- if (n.length === 0 || !i(n[n.length - 1])) {
243
- n.push(e);
244
- return;
245
- }
246
- n.splice(n.findIndex(i), 0, e);
247
- }
248
- track(e) {
249
- this.trackedNodes.add(e), l.set(e, this);
250
- }
251
- untrack(e) {
252
- this.trackedNodes.delete(e), l.get(e) === this && l.delete(e);
253
- }
254
- isUserContent(e) {
255
- if (e.nodeType === Node.COMMENT_NODE) return !1;
256
- if (e.nodeType === Node.TEXT_NODE) return s(e);
257
- if (e.nodeType === Node.ELEMENT_NODE) {
258
- let t = e;
259
- return !(a(t) || o(t));
260
- }
261
- return !1;
262
- }
263
- removeFromSlots(e) {
264
- for (let [t, n] of this.nodesBySlot) {
265
- let r = n.indexOf(e);
266
- if (r !== -1) {
267
- n.splice(r, 1), n.length === 0 && this.nodesBySlot.delete(t);
268
- return;
269
- }
270
- }
271
- }
272
- notifyDirectives() {
273
- for (let e of this.directives) e.handleNodesChanged();
274
- }
275
- }, b = e(class extends i {
276
- constructor(e) {
277
- 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");
278
- }
279
- render(e, n) {
280
- return t;
281
- }
282
- update(e, [n, r]) {
283
- return this.part = e, this.host = n, this.slotName = r, this.manager || (this.manager = u(n), this.manager.collectNodes(), this.manager.addDirective(this)), this.placeNodes(), t;
284
- }
285
- handleNodesChanged() {
286
- !this.isConnected || !this.manager || this.placeNodes();
287
- }
288
- disconnected() {
289
- this.manager?.removeDirective(this), this.manager = null, this.lastGeneration = -1;
290
- }
291
- reconnected() {
292
- this.host && (this.manager = u(this.host), this.manager.addDirective(this), this.placeNodes());
293
- }
294
- contains(e) {
295
- let t = this.parentOfPart();
296
- return this.isConnected && !!t && this.isInsidePart(e, t);
297
- }
298
- bounds() {
299
- return {
300
- startNode: this.part?.startNode ?? null,
301
- endNode: this.part?.endNode ?? null
302
- };
303
- }
304
- parentOfPart() {
305
- return this.part ? this.part.startNode ? this.part.startNode.parentNode : this.part.parentNode : null;
306
- }
307
- placeNodes() {
308
- if (!this.manager || !this.part) return;
309
- let e = this.manager.generation;
310
- if (e === this.lastGeneration) return;
311
- this.lastGeneration = e;
312
- let t = this.manager.getNodes(this.slotName);
313
- for (let e of t) this.manager.ensurePlaceholder(e);
314
- let n = this.parentOfPart();
315
- if (!n) return;
316
- let r = this.part.endNode;
317
- for (let e = t.length - 1; e >= 0; e--) {
318
- let i = t[e];
319
- this.isInsidePart(i, n) || n.insertBefore(i, r), r = i;
320
- }
321
- }
322
- isInsidePart(e, t) {
323
- if (!this.part || e.parentNode !== t) return !1;
324
- let { startNode: n, endNode: r } = this.part, i = !n || !!(n.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING), a = !r || !!(e.compareDocumentPosition(r) & Node.DOCUMENT_POSITION_FOLLOWING);
325
- return i && a;
326
- }
327
- }), x = e(class extends i {
328
- constructor(e) {
329
- 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");
330
- }
331
- render(e, n) {
332
- return t;
333
- }
334
- update(e, [n, r]) {
335
- let i = u(e.element);
336
- return this.target && this.target !== i && this.target.removeSource(this), this.target = i, this.source = u(n), this.source.collectNodes(), this.mapping = p(r), this.target.addSource(this, this.source, this.mapping), t;
337
- }
338
- disconnected() {
339
- this.target?.removeSource(this);
340
- }
341
- reconnected() {
342
- this.target && this.source && this.target.addSource(this, this.source, this.mapping);
343
- }
344
- }), S = class extends r {
345
- connectedCallback() {
346
- u(this).collectNodes(), super.connectedCallback();
347
- }
348
- hasSlotContent(e) {
349
- return u(this).hasContent(e);
350
- }
351
- };
352
- //#endregion
353
- export { o as a, b as i, x as n, u as r, S as t };