@oslokommune/punkt-elements 19.10.0 → 19.10.2

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 (136) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/{accordion-CMCCpxtz.cjs → accordion-BFKmnCDh.cjs} +1 -1
  3. package/dist/{accordion-Cp2o6wTY.js → accordion-BhCmUDoS.js} +1 -1
  4. package/dist/{alert-QfloIr-o.cjs → alert-BJPi5ylH.cjs} +1 -1
  5. package/dist/{alert-CAPiwi4F.js → alert-CUH_2zb2.js} +2 -2
  6. package/dist/{button-Dh97H-58.cjs → button-CWHqXdSG.cjs} +1 -1
  7. package/dist/{button-CeRr7oIn.js → button-DQ8rH8hx.js} +1 -1
  8. package/dist/{card-_PlgXmgZ.js → card-DfVOJCWA.js} +2 -2
  9. package/dist/{card--NuWdTbG.cjs → card-pJ0CDH2Y.cjs} +1 -1
  10. package/dist/{checkbox-QIcdn09A.cjs → checkbox-3z2uH8rd.cjs} +1 -1
  11. package/dist/{checkbox-G8k3vg85.js → checkbox-BEBBPgYW.js} +1 -1
  12. package/dist/{checkbox-group-DoueGGi5.js → checkbox-group-BiPX1EhY.js} +2 -2
  13. package/dist/{checkbox-group-nLazAkcg.cjs → checkbox-group-DRQmSHyN.cjs} +1 -1
  14. package/dist/{combobox-ClXhKwR9.cjs → combobox-C_SMnNsj.cjs} +1 -1
  15. package/dist/{combobox-Cz_rq7Mm.js → combobox-CdmzQtCh.js} +5 -5
  16. package/dist/{consent-DimzcQxt.cjs → consent-CkK9BZ7t.cjs} +1 -1
  17. package/dist/{consent-CZMxUavj.js → consent-eTXt052m.js} +1 -1
  18. package/dist/{datepicker-usIF9WY7.cjs → datepicker-BrQhahYy.cjs} +1 -1
  19. package/dist/{datepicker-C7ABsx7H.js → datepicker-DILpPWCY.js} +4 -4
  20. package/dist/directives/slot-content.d.ts +24 -11
  21. package/dist/docs/punkt-docs.d.ts +3 -0
  22. package/dist/docs/tableOfContents.d.ts +15 -0
  23. package/dist/element-with-slot-DOt8HbXA.cjs +1 -0
  24. package/dist/element-with-slot-U981OZM_.js +353 -0
  25. package/dist/{fileupload-BR9H6fET.js → fileupload-BZjZh8Mp.js} +3 -3
  26. package/dist/{fileupload-2uTFjd81.cjs → fileupload-l1d9UQf9.cjs} +1 -1
  27. package/dist/{footer-CyxRYvT-.cjs → footer-C8Zh-eUU.cjs} +1 -1
  28. package/dist/{footer-B3DMvo8-.js → footer-X5MBVUoo.js} +1 -1
  29. package/dist/{header-BKeSkfB7.js → header-DLH6Xx97.js} +5 -5
  30. package/dist/{header-Drj3lTrv.cjs → header-EvwDJXP-.cjs} +1 -1
  31. package/dist/{header-menu-buYE90FU.js → header-menu-0UtMd2_H.js} +1 -1
  32. package/dist/{header-menu-B_5hCNUl.cjs → header-menu-BqFpYI-V.cjs} +1 -1
  33. package/dist/{heading-DUYOvlxs.cjs → heading-DMHbL3xs.cjs} +1 -1
  34. package/dist/{heading-WBB5MO9i.js → heading-tWSLaRPD.js} +1 -1
  35. package/dist/{helptext-C7cyihnu.cjs → helptext-CGa1p-yd.cjs} +1 -1
  36. package/dist/{helptext-DadLkcoO.js → helptext-Dy2Ehs9W.js} +1 -1
  37. package/dist/{input-element-BBygBEei.js → input-element-BGbT4ICl.js} +1 -1
  38. package/dist/{input-element-C4SelHLD.cjs → input-element-kIrd5ABs.cjs} +1 -1
  39. package/dist/{input-wrapper-BT6B3Kco.cjs → input-wrapper-EvzyXMw-.cjs} +1 -1
  40. package/dist/{input-wrapper-DrSCuw6U.js → input-wrapper-Uks0spRR.js} +3 -3
  41. package/dist/{link-CVnIn74-.js → link-C0yBFscy.js} +1 -1
  42. package/dist/{link-CEP7w1et.cjs → link-CLdiz-ly.cjs} +1 -1
  43. package/dist/{linkcard-IWiVvRKy.js → linkcard-B5-p-YC4.js} +1 -1
  44. package/dist/{linkcard-D8vitdrQ.cjs → linkcard-v9UsV9Os.cjs} +1 -1
  45. package/dist/{loader-B0hFoBtF.cjs → loader-C4UfUu2u.cjs} +1 -1
  46. package/dist/{loader-CAsUPHjl.js → loader-DWvjIMsT.js} +1 -1
  47. package/dist/{messagebox-6_iNN5F3.js → messagebox-CJTqxfu3.js} +1 -1
  48. package/dist/{messagebox-C19L2Duq.cjs → messagebox-clOimkn7.cjs} +1 -1
  49. package/dist/{modal-CoEPzt4p.cjs → modal-BPweteoS.cjs} +1 -1
  50. package/dist/{modal-D7MolBXb.js → modal-Bm1daKaW.js} +1 -1
  51. package/dist/{option-group-element-BYS7s-is.cjs → option-group-element-2A4TBcp-.cjs} +1 -1
  52. package/dist/{option-group-element-BIuotbRu.js → option-group-element-Ber7NAlg.js} +2 -2
  53. package/dist/pkt-accordion.cjs +1 -1
  54. package/dist/pkt-accordion.js +1 -1
  55. package/dist/pkt-alert.cjs +1 -1
  56. package/dist/pkt-alert.js +1 -1
  57. package/dist/pkt-button.cjs +1 -1
  58. package/dist/pkt-button.js +1 -1
  59. package/dist/pkt-card.cjs +1 -1
  60. package/dist/pkt-card.js +1 -1
  61. package/dist/pkt-checkbox-group.cjs +1 -1
  62. package/dist/pkt-checkbox-group.js +1 -1
  63. package/dist/pkt-checkbox.cjs +1 -1
  64. package/dist/pkt-checkbox.js +1 -1
  65. package/dist/pkt-combobox.cjs +1 -1
  66. package/dist/pkt-combobox.js +1 -1
  67. package/dist/pkt-consent.cjs +1 -1
  68. package/dist/pkt-consent.js +1 -1
  69. package/dist/pkt-datepicker.cjs +1 -1
  70. package/dist/pkt-datepicker.js +1 -1
  71. package/dist/pkt-fileupload.cjs +1 -1
  72. package/dist/pkt-fileupload.js +1 -1
  73. package/dist/pkt-footer.cjs +1 -1
  74. package/dist/pkt-footer.js +1 -1
  75. package/dist/pkt-header-menu.cjs +1 -1
  76. package/dist/pkt-header-menu.js +1 -1
  77. package/dist/pkt-header.cjs +1 -1
  78. package/dist/pkt-header.js +1 -1
  79. package/dist/pkt-heading.cjs +1 -1
  80. package/dist/pkt-heading.js +1 -1
  81. package/dist/pkt-helptext.cjs +1 -1
  82. package/dist/pkt-helptext.js +1 -1
  83. package/dist/pkt-index.cjs +1 -1
  84. package/dist/pkt-index.js +29 -29
  85. package/dist/pkt-input-wrapper.cjs +1 -1
  86. package/dist/pkt-input-wrapper.js +1 -1
  87. package/dist/pkt-link.cjs +1 -1
  88. package/dist/pkt-link.js +1 -1
  89. package/dist/pkt-linkcard.cjs +1 -1
  90. package/dist/pkt-linkcard.js +1 -1
  91. package/dist/pkt-loader.cjs +1 -1
  92. package/dist/pkt-loader.js +1 -1
  93. package/dist/pkt-messagebox.cjs +1 -1
  94. package/dist/pkt-messagebox.js +1 -1
  95. package/dist/pkt-modal.cjs +1 -1
  96. package/dist/pkt-modal.js +1 -1
  97. package/dist/{pkt-options-controller-B3vVKnAG.cjs → pkt-options-controller-Ck_549wx.cjs} +1 -1
  98. package/dist/{pkt-options-controller-ClFrUWZK.js → pkt-options-controller-DTOlYR9b.js} +1 -1
  99. package/dist/pkt-radio-group.cjs +1 -1
  100. package/dist/pkt-radio-group.js +1 -1
  101. package/dist/pkt-radiobutton.cjs +1 -1
  102. package/dist/pkt-radiobutton.js +1 -1
  103. package/dist/pkt-select.cjs +1 -1
  104. package/dist/pkt-select.js +1 -1
  105. package/dist/pkt-tabs.cjs +1 -1
  106. package/dist/pkt-tabs.js +1 -1
  107. package/dist/pkt-tag.cjs +1 -1
  108. package/dist/pkt-tag.js +1 -1
  109. package/dist/pkt-textarea.cjs +1 -1
  110. package/dist/pkt-textarea.js +1 -1
  111. package/dist/pkt-textinput.cjs +1 -1
  112. package/dist/pkt-textinput.js +1 -1
  113. package/dist/pkt-timepicker.cjs +1 -1
  114. package/dist/pkt-timepicker.js +1 -1
  115. package/dist/{radio-group-C-8C0-Py.cjs → radio-group-9Szx2XyM.cjs} +1 -1
  116. package/dist/{radio-group-BzV_JhgJ.js → radio-group-CMtx_GRV.js} +2 -2
  117. package/dist/{radiobutton-bkTAD5PV.js → radiobutton-CYbvJ9y8.js} +1 -1
  118. package/dist/{radiobutton-_089zFBB.cjs → radiobutton-Dq2qkfi0.cjs} +1 -1
  119. package/dist/{select-BowvpCNa.cjs → select-1nm17iN8.cjs} +1 -1
  120. package/dist/{select-B6CN2Ymq.js → select-DlgOxHIl.js} +4 -4
  121. package/dist/shared-utils/heading-ids.d.ts +12 -0
  122. package/dist/{tabs-Dm8xcPRs.cjs → tabs-8Y5PlmLl.cjs} +1 -1
  123. package/dist/{tabs-DZvtVA0y.js → tabs-D3pPS9us.js} +1 -1
  124. package/dist/{tag-DyVZrqOQ.cjs → tag-DOUsW7nS.cjs} +1 -1
  125. package/dist/{tag-C33BPIOm.js → tag-qHYIycl8.js} +1 -1
  126. package/dist/{textarea-hW0kV5gj.js → textarea-B3qIDyEQ.js} +3 -3
  127. package/dist/{textarea-DoH3Il8v.cjs → textarea-DkeCQKmM.cjs} +1 -1
  128. package/dist/{textinput-B6G4dVuL.js → textinput-CwvVRNsP.js} +3 -3
  129. package/dist/{textinput-CQknclmV.cjs → textinput-DibZCHh_.cjs} +1 -1
  130. package/dist/{timepicker-DB3gor6g.cjs → timepicker-CZ_1HVlF.cjs} +1 -1
  131. package/dist/{timepicker-Cd2QI6ua.js → timepicker-C_oG9W9Y.js} +3 -3
  132. package/package.json +2 -2
  133. package/src/components/heading/heading.test.ts +24 -0
  134. package/src/components/helptext/helptext-association.test.ts +36 -0
  135. package/dist/element-with-slot-DDLS-aLw.js +0 -227
  136. package/dist/element-with-slot-DhiAuSjM.cjs +0 -1
@@ -148,6 +148,42 @@ describe('helptext association', () => {
148
148
  expectDescribedBySlot(host)
149
149
  })
150
150
 
151
+ const createSlotted = (text: string) => {
152
+ const slotted = document.createElement('div')
153
+ slotted.setAttribute('slot', 'helptext')
154
+ slotted.className = 'slotted'
155
+ slotted.textContent = text
156
+ return slotted
157
+ }
158
+
159
+ test.each(slotCases)('%s %s shows slotted helptext a framework hides and shows again', async (tag, attrs) => {
160
+ const host = await mountWithSlot(tag, attrs, '<div slot="helptext" class="slotted">Hjelp fra slot</div>')
161
+ const slotted = host.querySelector('.slotted')!
162
+ const parent = slotted.parentNode!
163
+ const next = slotted.nextSibling
164
+ parent.removeChild(slotted)
165
+ const anchor = document.createComment('v-if')
166
+ parent.insertBefore(anchor, next)
167
+ await settle(host)
168
+ expect(host.querySelector('.pkt-inputwrapper__helptext')).toBeNull()
169
+
170
+ expect(anchor.parentNode).not.toBeNull()
171
+ anchor.parentNode!.insertBefore(createSlotted('Hjelp fra slot'), anchor.nextSibling)
172
+ anchor.remove()
173
+ await settle(host)
174
+
175
+ expectDescribedBySlot(host)
176
+ })
177
+
178
+ test.each(slotCases)('%s %s shows slotted helptext that a framework replaces', async (tag, attrs) => {
179
+ const host = await mountWithSlot(tag, attrs, '<div slot="helptext" class="slotted">Gammel</div>')
180
+ const slotted = host.querySelector('.slotted')!
181
+ slotted.parentNode!.replaceChild(createSlotted('Hjelp fra slot'), slotted)
182
+ await settle(host)
183
+
184
+ expectDescribedBySlot(host)
185
+ })
186
+
151
187
  test.each(slotCases)('%s %s drops the link when slotted helptext is removed', async (tag, attrs) => {
152
188
  const host = await mountWithSlot(tag, attrs, '<div slot="helptext" class="slotted">Hjelp fra slot</div>')
153
189
  expectDescribedBySlot(host)
@@ -1,227 +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();
16
- function l(e) {
17
- let t = c.get(e);
18
- return t || (t = new g(e), c.set(e, t)), t;
19
- }
20
- var u = Symbol("default");
21
- function d(e) {
22
- return e === void 0 ? u : e;
23
- }
24
- function f(e) {
25
- return Array.isArray(e) ? e.map((e) => {
26
- let t = e === null ? u : e;
27
- return [t, t];
28
- }) : Object.entries(e).map(([e, t]) => [e, t === null ? u : t]);
29
- }
30
- function p(e, t) {
31
- return e.length === t.length && e.every(([e, n], r) => t[r][0] === e && t[r][1] === n);
32
- }
33
- function m(e, t) {
34
- if (e.nodeType === Node.COMMENT_NODE) return !1;
35
- if (e.nodeType === Node.TEXT_NODE) return s(e) ? (h(t, u, 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 = d(n.getAttribute("slot") ?? void 0);
41
- for (let n of e) h(t, r, n);
42
- return !0;
43
- }
44
- let r = n.getAttribute("slot");
45
- return h(t, r === null ? u : d(r), e), !0;
46
- }
47
- return !1;
48
- }
49
- function h(e, t, n) {
50
- let r = e.get(t);
51
- r || (r = [], e.set(t, r)), r.push(n);
52
- }
53
- var g = class e {
54
- static {
55
- this.PLACEHOLDER_PREFIX = "pkt-slot";
56
- }
57
- constructor(e) {
58
- 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.host = e;
59
- }
60
- collectNodes() {
61
- if (this.initialCollectionDone) return;
62
- this.initialCollectionDone = !0, this.generation++;
63
- let e = Array.from(this.host.childNodes);
64
- for (let t of e) m(t, this.nodesBySlot) && this.trackedNodes.add(t);
65
- }
66
- addDirective(e) {
67
- this.directives.add(e), this.startObserving();
68
- }
69
- removeDirective(e) {
70
- this.directives.delete(e), this.stopObservingIfUnused();
71
- }
72
- addSource(e, t, n) {
73
- let r = this.sources.get(e);
74
- r && r.manager === t && p(r.mapping, n) || (r && r.manager !== t && this.detachFrom(r.manager, e), this.sources.set(e, {
75
- manager: t,
76
- mapping: n
77
- }), t.subscribers.add(this), t.startObserving(), this.handleChange());
78
- }
79
- removeSource(e) {
80
- let t = this.sources.get(e);
81
- t && (this.sources.delete(e), this.detachFrom(t.manager, e), this.handleChange());
82
- }
83
- getNodes(e) {
84
- return this.nodesFor(d(e));
85
- }
86
- hasContent(e) {
87
- return this.getNodes(e).length > 0;
88
- }
89
- ensurePlaceholder(t) {
90
- if (this.nodeToPlaceholder.has(t)) return;
91
- if (t.parentNode !== this.host) {
92
- for (let { manager: e } of this.sources.values()) e.ensurePlaceholder(t);
93
- return;
94
- }
95
- let n = document.createComment(e.PLACEHOLDER_PREFIX);
96
- this.host.insertBefore(n, t), this.placeholderToNode.set(n, t), this.nodeToPlaceholder.set(t, n);
97
- }
98
- nodesFor(e) {
99
- let t = this.nodesBySlot.get(e) ?? [];
100
- if (this.sources.size === 0) return t;
101
- let n = [];
102
- for (let { manager: t, mapping: r } of this.sources.values()) for (let [i, a] of r) a === e && n.push(...t.nodesFor(i));
103
- return n.length ? [...t, ...n] : t;
104
- }
105
- detachFrom(e, t) {
106
- [...this.sources.entries()].some(([n, r]) => n !== t && r.manager === e) || (e.subscribers.delete(this), e.stopObservingIfUnused());
107
- }
108
- handleChange() {
109
- this.generation++, this.notifyDirectives();
110
- for (let e of this.subscribers) e.handleChange();
111
- this.host.requestUpdate();
112
- }
113
- stopObservingIfUnused() {
114
- this.directives.size === 0 && this.subscribers.size === 0 && this.stopObserving();
115
- }
116
- startObserving() {
117
- this.observing || (this.observing = !0, setTimeout(() => {
118
- !this.observing || typeof MutationObserver > "u" || (this.observer = new MutationObserver((e) => {
119
- this.handleMutations(e);
120
- }), this.observer.observe(this.host, {
121
- childList: !0,
122
- subtree: !0
123
- }));
124
- }, 0));
125
- }
126
- stopObserving() {
127
- this.observing && (this.observing = !1, this.observer?.disconnect(), this.observer = null);
128
- }
129
- handleMutations(e) {
130
- if (this.processingMutations) return;
131
- this.processingMutations = !0;
132
- let t = !1;
133
- for (let n of e) {
134
- for (let e of n.removedNodes) {
135
- let n = this.placeholderToNode.get(e);
136
- if (n) {
137
- n.parentNode?.removeChild(n), this.trackedNodes.delete(n), this.removeFromSlots(n), this.placeholderToNode.delete(e), this.nodeToPlaceholder.delete(n), t = !0;
138
- continue;
139
- }
140
- if (this.trackedNodes.has(e) && !this.host.contains(e)) {
141
- this.trackedNodes.delete(e), this.removeFromSlots(e);
142
- let n = this.nodeToPlaceholder.get(e);
143
- n && (n.parentNode?.removeChild(n), this.placeholderToNode.delete(n), this.nodeToPlaceholder.delete(e)), t = !0;
144
- }
145
- }
146
- if (n.target === this.host) for (let e of n.addedNodes) this.placeholderToNode.has(e) || !this.trackedNodes.has(e) && this.isUserContent(e) && m(e, this.nodesBySlot) && (this.trackedNodes.add(e), t = !0);
147
- }
148
- t && this.handleChange(), this.observer?.takeRecords(), this.processingMutations = !1;
149
- }
150
- isUserContent(e) {
151
- if (e.nodeType === Node.COMMENT_NODE) return !1;
152
- if (e.nodeType === Node.TEXT_NODE) return s(e);
153
- if (e.nodeType === Node.ELEMENT_NODE) {
154
- let t = e;
155
- return !(a(t) || o(t));
156
- }
157
- return !1;
158
- }
159
- removeFromSlots(e) {
160
- for (let [t, n] of this.nodesBySlot) {
161
- let r = n.indexOf(e);
162
- if (r !== -1) {
163
- n.splice(r, 1), n.length === 0 && this.nodesBySlot.delete(t);
164
- return;
165
- }
166
- }
167
- }
168
- notifyDirectives() {
169
- for (let e of this.directives) e.handleNodesChanged();
170
- }
171
- }, _ = e(class extends i {
172
- constructor(e) {
173
- if (super(e), this.manager = null, this.lastGeneration = -1, e.type !== n.CHILD) throw Error("slotContent() can only be used in child expressions");
174
- }
175
- render(e, n) {
176
- return t;
177
- }
178
- update(e, [t, n]) {
179
- return this.slotName = n, this.manager || (this.manager = l(t), this.manager.collectNodes(), this.manager.addDirective(this)), this.ensurePlaceholders(), this.getNodesOrNoChange();
180
- }
181
- handleNodesChanged() {
182
- if (!this.isConnected || !this.manager) return;
183
- this.ensurePlaceholders();
184
- let e = this.getNodesOrNoChange();
185
- e !== t && this.setValue(e);
186
- }
187
- ensurePlaceholders() {
188
- if (!this.manager) return;
189
- let e = this.manager.getNodes(this.slotName);
190
- for (let t of e) this.manager.ensurePlaceholder(t);
191
- }
192
- disconnected() {
193
- this.manager?.removeDirective(this), this.manager = null, this.lastGeneration = -1;
194
- }
195
- reconnected() {}
196
- getNodesOrNoChange() {
197
- if (!this.manager) return t;
198
- let e = this.manager.generation;
199
- return e === this.lastGeneration ? t : (this.lastGeneration = e, this.manager.getNodes(this.slotName));
200
- }
201
- }), v = e(class extends i {
202
- constructor(e) {
203
- 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");
204
- }
205
- render(e, n) {
206
- return t;
207
- }
208
- update(e, [n, r]) {
209
- let i = l(e.element);
210
- return this.target && this.target !== i && this.target.removeSource(this), this.target = i, this.source = l(n), this.source.collectNodes(), this.mapping = f(r), this.target.addSource(this, this.source, this.mapping), t;
211
- }
212
- disconnected() {
213
- this.target?.removeSource(this);
214
- }
215
- reconnected() {
216
- this.target && this.source && this.target.addSource(this, this.source, this.mapping);
217
- }
218
- }), y = class extends r {
219
- connectedCallback() {
220
- l(this).collectNodes(), super.connectedCallback();
221
- }
222
- hasSlotContent(e) {
223
- return l(this).hasContent(e);
224
- }
225
- };
226
- //#endregion
227
- export { o as a, _ as i, v as n, l as r, y as t };
@@ -1 +0,0 @@
1
- const e=require("./element-C6WTyJFE.cjs"),t=require("./async-directive-DpyKp6qv.cjs");function n(e){return e.classList&&(e.classList.contains(`_dialog_overlay`)||e.classList.contains(`backdrop`))?!0:typeof e.hasAttribute==`function`&&e.hasAttribute(`data-skip`)}function r(e){return e.nodeName===`OPTION`||e.nodeName===`DATA`}function i(e){return e.nodeType===Node.TEXT_NODE&&e.nodeValue?.trim()!==``}var a=new WeakMap;function o(e){let t=a.get(e);return t||(t=new p(e),a.set(e,t)),t}var s=Symbol(`default`);function c(e){return e===void 0?s:e}function l(e){return Array.isArray(e)?e.map(e=>{let t=e===null?s:e;return[t,t]}):Object.entries(e).map(([e,t])=>[e,t===null?s:t])}function u(e,t){return e.length===t.length&&e.every(([e,n],r)=>t[r][0]===e&&t[r][1]===n)}function d(e,t){if(e.nodeType===Node.COMMENT_NODE)return!1;if(e.nodeType===Node.TEXT_NODE)return i(e)?(f(t,s,e),!0):!1;if(e.nodeType===Node.ELEMENT_NODE){let i=e;if(n(i)||r(i))return!1;if(i instanceof HTMLTemplateElement){let e=Array.from(i.content.childNodes),n=c(i.getAttribute(`slot`)??void 0);for(let r of e)f(t,n,r);return!0}let a=i.getAttribute(`slot`);return f(t,a===null?s:c(a),e),!0}return!1}function f(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}var p=class e{static{this.PLACEHOLDER_PREFIX=`pkt-slot`}constructor(e){this.observer=null,this.nodesBySlot=new Map,this.directives=new Set,this.observing=!1,this.trackedNodes=new Set,this.generation=0,this.initialCollectionDone=!1,this.processingMutations=!1,this.placeholderToNode=new Map,this.nodeToPlaceholder=new Map,this.sources=new Map,this.subscribers=new Set,this.host=e}collectNodes(){if(this.initialCollectionDone)return;this.initialCollectionDone=!0,this.generation++;let e=Array.from(this.host.childNodes);for(let t of e)d(t,this.nodesBySlot)&&this.trackedNodes.add(t)}addDirective(e){this.directives.add(e),this.startObserving()}removeDirective(e){this.directives.delete(e),this.stopObservingIfUnused()}addSource(e,t,n){let r=this.sources.get(e);r&&r.manager===t&&u(r.mapping,n)||(r&&r.manager!==t&&this.detachFrom(r.manager,e),this.sources.set(e,{manager:t,mapping:n}),t.subscribers.add(this),t.startObserving(),this.handleChange())}removeSource(e){let t=this.sources.get(e);t&&(this.sources.delete(e),this.detachFrom(t.manager,e),this.handleChange())}getNodes(e){return this.nodesFor(c(e))}hasContent(e){return this.getNodes(e).length>0}ensurePlaceholder(t){if(this.nodeToPlaceholder.has(t))return;if(t.parentNode!==this.host){for(let{manager:e}of this.sources.values())e.ensurePlaceholder(t);return}let n=document.createComment(e.PLACEHOLDER_PREFIX);this.host.insertBefore(n,t),this.placeholderToNode.set(n,t),this.nodeToPlaceholder.set(t,n)}nodesFor(e){let t=this.nodesBySlot.get(e)??[];if(this.sources.size===0)return t;let n=[];for(let{manager:t,mapping:r}of this.sources.values())for(let[i,a]of r)a===e&&n.push(...t.nodesFor(i));return n.length?[...t,...n]:t}detachFrom(e,t){[...this.sources.entries()].some(([n,r])=>n!==t&&r.manager===e)||(e.subscribers.delete(this),e.stopObservingIfUnused())}handleChange(){this.generation++,this.notifyDirectives();for(let e of this.subscribers)e.handleChange();this.host.requestUpdate()}stopObservingIfUnused(){this.directives.size===0&&this.subscribers.size===0&&this.stopObserving()}startObserving(){this.observing||(this.observing=!0,setTimeout(()=>{!this.observing||typeof MutationObserver>`u`||(this.observer=new MutationObserver(e=>{this.handleMutations(e)}),this.observer.observe(this.host,{childList:!0,subtree:!0}))},0))}stopObserving(){this.observing&&(this.observing=!1,this.observer?.disconnect(),this.observer=null)}handleMutations(e){if(this.processingMutations)return;this.processingMutations=!0;let t=!1;for(let n of e){for(let e of n.removedNodes){let n=this.placeholderToNode.get(e);if(n){n.parentNode?.removeChild(n),this.trackedNodes.delete(n),this.removeFromSlots(n),this.placeholderToNode.delete(e),this.nodeToPlaceholder.delete(n),t=!0;continue}if(this.trackedNodes.has(e)&&!this.host.contains(e)){this.trackedNodes.delete(e),this.removeFromSlots(e);let n=this.nodeToPlaceholder.get(e);n&&(n.parentNode?.removeChild(n),this.placeholderToNode.delete(n),this.nodeToPlaceholder.delete(e)),t=!0}}if(n.target===this.host)for(let e of n.addedNodes)this.placeholderToNode.has(e)||!this.trackedNodes.has(e)&&this.isUserContent(e)&&d(e,this.nodesBySlot)&&(this.trackedNodes.add(e),t=!0)}t&&this.handleChange(),this.observer?.takeRecords(),this.processingMutations=!1}isUserContent(e){if(e.nodeType===Node.COMMENT_NODE)return!1;if(e.nodeType===Node.TEXT_NODE)return i(e);if(e.nodeType===Node.ELEMENT_NODE){let t=e;return!(n(t)||r(t))}return!1}removeFromSlots(e){for(let[t,n]of this.nodesBySlot){let r=n.indexOf(e);if(r!==-1){n.splice(r,1),n.length===0&&this.nodesBySlot.delete(t);return}}}notifyDirectives(){for(let e of this.directives)e.handleNodesChanged()}},m=class extends t.t{constructor(t){if(super(t),this.manager=null,this.lastGeneration=-1,t.type!==e.m.CHILD)throw Error(`slotContent() can only be used in child expressions`)}render(t,n){return e.g}update(e,[t,n]){return this.slotName=n,this.manager||(this.manager=o(t),this.manager.collectNodes(),this.manager.addDirective(this)),this.ensurePlaceholders(),this.getNodesOrNoChange()}handleNodesChanged(){if(!this.isConnected||!this.manager)return;this.ensurePlaceholders();let t=this.getNodesOrNoChange();t!==e.g&&this.setValue(t)}ensurePlaceholders(){if(!this.manager)return;let e=this.manager.getNodes(this.slotName);for(let t of e)this.manager.ensurePlaceholder(t)}disconnected(){this.manager?.removeDirective(this),this.manager=null,this.lastGeneration=-1}reconnected(){}getNodesOrNoChange(){if(!this.manager)return e.g;let t=this.manager.generation;return t===this.lastGeneration?e.g:(this.lastGeneration=t,this.manager.getNodes(this.slotName))}},h=e.f(m),g=class extends t.t{constructor(t){if(super(t),this.target=null,this.source=null,this.mapping=[],t.type!==e.m.ELEMENT)throw Error(`forwardSlots() can only be used as an element directive`)}render(t,n){return e.g}update(t,[n,r]){let i=o(t.element);return this.target&&this.target!==i&&this.target.removeSource(this),this.target=i,this.source=o(n),this.source.collectNodes(),this.mapping=l(r),this.target.addSource(this,this.source,this.mapping),e.g}disconnected(){this.target?.removeSource(this)}reconnected(){this.target&&this.source&&this.target.addSource(this,this.source,this.mapping)}},_=e.f(g),v=class extends e.t{connectedCallback(){o(this).collectNodes(),super.connectedCallback()}hasSlotContent(e){return o(this).hasContent(e)}};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});