@oslokommune/punkt-elements 19.5.0 → 19.5.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 (162) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{accordion-CZ0O4c0_.cjs → accordion-5lSFQToJ.cjs} +6 -6
  3. package/dist/{accordion-DFcdonl-.js → accordion-BJh6X1Ek.js} +6 -6
  4. package/dist/{alert-CUOWdvit.js → alert-C0PiYnot.js} +28 -35
  5. package/dist/alert-IaZzEgyI.cjs +39 -0
  6. package/dist/{backlink-vLhK1hsj.cjs → backlink-BRqhwUr2.cjs} +1 -1
  7. package/dist/base-elements/checkable-native-parity.test.d.ts +0 -0
  8. package/dist/base-elements/form-disabled.test.d.ts +0 -0
  9. package/dist/base-elements/input-element.d.ts +10 -1
  10. package/dist/{button-B0uSFQVn.js → button-B78im4wB.js} +15 -15
  11. package/dist/button-BNVTj7nB.cjs +32 -0
  12. package/dist/{card-CfFW7_-K.js → card-CYKhPUNI.js} +11 -11
  13. package/dist/{card-C15acwk4.cjs → card-CaLEuumN.cjs} +10 -10
  14. package/dist/{checkbox-B2O0fkh9.js → checkbox-Bbxt-tVW.js} +8 -8
  15. package/dist/checkbox-_NnoYkue.cjs +40 -0
  16. package/dist/{combobox-DvsnfA0c.cjs → combobox-BBx87DCG.cjs} +27 -27
  17. package/dist/{combobox-Bhfh04Su.js → combobox-CjLX_Gfd.js} +41 -41
  18. package/dist/components/alert/alert.d.ts +0 -2
  19. package/dist/{consent-_DBvIRT2.js → consent-CleJMbVH.js} +1 -1
  20. package/dist/{consent-BfLkJbOk.cjs → consent-Dl-R0iC3.cjs} +1 -1
  21. package/dist/{datepicker-Cg-iueRC.cjs → datepicker-Bk-m5Zaa.cjs} +31 -31
  22. package/dist/{datepicker-BY2IKrPk.js → datepicker-CFCRxFQL.js} +13 -13
  23. package/dist/directives/slot-content.d.ts +36 -1
  24. package/dist/element-with-slot-D7sTqOr3.cjs +1 -0
  25. package/dist/{element-with-slot-FD826ooP.js → element-with-slot-DQv0cbbD.js} +80 -21
  26. package/dist/{fileupload-iuXrgrog.js → fileupload-B2606SvG.js} +31 -31
  27. package/dist/{fileupload-Djp6VJYY.cjs → fileupload-COAxc3sX.cjs} +21 -21
  28. package/dist/{footer-BCdb0wlF.js → footer-DdLls3F-.js} +13 -13
  29. package/dist/{footer-bTpLxigB.cjs → footer-vy9NqT65.cjs} +9 -9
  30. package/dist/{header-2fF-Zu5T.js → header-BQdc29IO.js} +55 -55
  31. package/dist/{header-DbSSOX-h.cjs → header-BhM7FRoC.cjs} +50 -50
  32. package/dist/{header-menu-DVYLZyez.js → header-menu-ANj5nL2M.js} +1 -1
  33. package/dist/{header-menu-ChDMnWhW.cjs → header-menu-BfkCp8jw.cjs} +1 -1
  34. package/dist/{heading-BRHCV_5J.js → heading-CUrZvkrM.js} +1 -1
  35. package/dist/{heading-u9Arof4p.cjs → heading-zoz-QZJ9.cjs} +1 -1
  36. package/dist/{helptext-CmsuAXSE.cjs → helptext-BCkwSz1m.cjs} +2 -2
  37. package/dist/{helptext-4TAHKV5_.js → helptext-DCT_9dw1.js} +1 -1
  38. package/dist/input-element-CSfDGslx.cjs +1 -0
  39. package/dist/{input-element-B1BntJeJ.js → input-element-lLzfwdim.js} +198 -173
  40. package/dist/{input-wrapper-B5rqKWSB.cjs → input-wrapper-BBG8EXQ8.cjs} +28 -28
  41. package/dist/{input-wrapper-CaMP5-Vm.js → input-wrapper-Bz9GwYrn.js} +46 -46
  42. package/dist/{link-CCFAmhL5.js → link-CmZwAw5u.js} +1 -1
  43. package/dist/{link-Bo2o0Akv.cjs → link-LO_5_La8.cjs} +2 -2
  44. package/dist/{linkcard-9L6QF7US.js → linkcard-CQluSyJJ.js} +7 -7
  45. package/dist/{linkcard-D7NbrluR.cjs → linkcard-UKsxADrP.cjs} +3 -3
  46. package/dist/{listbox-DEzd-dxF.js → listbox-Ct9jIV_5.js} +8 -8
  47. package/dist/{listbox-BoBwzL4p.cjs → listbox-g-vHHLkD.cjs} +20 -20
  48. package/dist/{loader-CQaGvyF9.cjs → loader-C_PH05aw.cjs} +2 -2
  49. package/dist/{loader-RQQ_o2aR.js → loader-DzctJ9jW.js} +1 -1
  50. package/dist/{messagebox-C-BQREWz.js → messagebox-DPFBuisE.js} +1 -1
  51. package/dist/{messagebox-BRqI3DW2.cjs → messagebox-JWKMJEFc.cjs} +2 -2
  52. package/dist/{modal-BGTTVHeW.cjs → modal-BymjMIJi.cjs} +2 -2
  53. package/dist/{modal-DCwqqNQc.js → modal-CELmA0-8.js} +1 -1
  54. package/dist/pkt-accordion.cjs +1 -1
  55. package/dist/pkt-accordion.js +1 -1
  56. package/dist/pkt-alert.cjs +1 -1
  57. package/dist/pkt-alert.js +1 -1
  58. package/dist/pkt-backlink.cjs +1 -1
  59. package/dist/pkt-backlink.js +1 -1
  60. package/dist/pkt-button.cjs +1 -1
  61. package/dist/pkt-button.js +1 -1
  62. package/dist/pkt-card.cjs +1 -1
  63. package/dist/pkt-card.js +1 -1
  64. package/dist/pkt-checkbox.cjs +1 -1
  65. package/dist/pkt-checkbox.js +1 -1
  66. package/dist/pkt-combobox.cjs +1 -1
  67. package/dist/pkt-combobox.js +1 -1
  68. package/dist/pkt-consent.cjs +1 -1
  69. package/dist/pkt-consent.js +1 -1
  70. package/dist/pkt-datepicker.cjs +1 -1
  71. package/dist/pkt-datepicker.js +1 -1
  72. package/dist/pkt-fileupload.cjs +1 -1
  73. package/dist/pkt-fileupload.js +1 -1
  74. package/dist/pkt-footer.cjs +1 -1
  75. package/dist/pkt-footer.js +1 -1
  76. package/dist/pkt-header-menu.cjs +1 -1
  77. package/dist/pkt-header-menu.js +1 -1
  78. package/dist/pkt-header.cjs +1 -1
  79. package/dist/pkt-header.js +1 -1
  80. package/dist/pkt-heading.cjs +1 -1
  81. package/dist/pkt-heading.js +1 -1
  82. package/dist/pkt-helptext.cjs +1 -1
  83. package/dist/pkt-helptext.js +1 -1
  84. package/dist/pkt-index.cjs +1 -1
  85. package/dist/pkt-index.js +30 -30
  86. package/dist/pkt-input-wrapper.cjs +1 -1
  87. package/dist/pkt-input-wrapper.js +1 -1
  88. package/dist/pkt-link.cjs +1 -1
  89. package/dist/pkt-link.js +1 -1
  90. package/dist/pkt-linkcard.cjs +1 -1
  91. package/dist/pkt-linkcard.js +1 -1
  92. package/dist/pkt-listbox.cjs +1 -1
  93. package/dist/pkt-listbox.js +1 -1
  94. package/dist/pkt-loader.cjs +1 -1
  95. package/dist/pkt-loader.js +1 -1
  96. package/dist/pkt-messagebox.cjs +1 -1
  97. package/dist/pkt-messagebox.js +1 -1
  98. package/dist/pkt-modal.cjs +1 -1
  99. package/dist/pkt-modal.js +1 -1
  100. package/dist/{pkt-options-controller-Dz-rYCG1.cjs → pkt-options-controller-CpEZcomb.cjs} +1 -1
  101. package/dist/{pkt-options-controller-sUzxHa5A.js → pkt-options-controller-D7l18Iw0.js} +1 -1
  102. package/dist/pkt-progressbar.cjs +1 -1
  103. package/dist/pkt-progressbar.js +1 -1
  104. package/dist/pkt-radiobutton.cjs +1 -1
  105. package/dist/pkt-radiobutton.js +1 -1
  106. package/dist/pkt-searchinput.cjs +1 -1
  107. package/dist/pkt-searchinput.js +1 -1
  108. package/dist/pkt-select.cjs +1 -1
  109. package/dist/pkt-select.js +1 -1
  110. package/dist/pkt-tabs.cjs +1 -1
  111. package/dist/pkt-tabs.js +1 -1
  112. package/dist/pkt-tag.cjs +1 -1
  113. package/dist/pkt-tag.js +1 -1
  114. package/dist/pkt-textarea.cjs +1 -1
  115. package/dist/pkt-textarea.js +1 -1
  116. package/dist/pkt-textinput.cjs +1 -1
  117. package/dist/pkt-textinput.js +1 -1
  118. package/dist/pkt-timepicker.cjs +1 -1
  119. package/dist/pkt-timepicker.js +1 -1
  120. package/dist/{progressbar-CAEQkFpP.cjs → progressbar-CIXNSwTy.cjs} +2 -3
  121. package/dist/{progressbar-DzX0p2vn.js → progressbar-DH5lIBpx.js} +6 -4
  122. package/dist/{radiobutton-Cv1BlwLV.cjs → radiobutton-C3kEjvHQ.cjs} +2 -2
  123. package/dist/{radiobutton-B0V-jSEX.js → radiobutton-D9htviZG.js} +5 -5
  124. package/dist/{searchinput-D6vtMUHw.cjs → searchinput-CbClDE-d.cjs} +1 -1
  125. package/dist/{select-C0GafKtu.js → select-BizHes0n.js} +20 -20
  126. package/dist/{select-Bd6Gg4Ar.cjs → select-BuQxosyi.cjs} +15 -15
  127. package/dist/{tabs-B134M9k2.js → tabs-B8blHQrL.js} +18 -18
  128. package/dist/{tabs-Dw9E06fL.cjs → tabs-CjX-GWvM.cjs} +15 -15
  129. package/dist/tag-B5dUg7AD.cjs +27 -0
  130. package/dist/{tag-CvFakm1k.js → tag-Bns7Xj1O.js} +10 -10
  131. package/dist/{textarea-CeqScqQa.cjs → textarea-BXadsEdL.cjs} +12 -12
  132. package/dist/{textarea-BZ2ufamc.js → textarea-CL1yUDVL.js} +18 -18
  133. package/dist/{textinput-DI8Tgmep.js → textinput-Csil0Zda.js} +16 -16
  134. package/dist/{textinput-L218fT2-.cjs → textinput-qi0f5NZH.cjs} +12 -12
  135. package/dist/{timepicker-ZSHZt0aW.cjs → timepicker-CvL2-Siz.cjs} +17 -17
  136. package/dist/{timepicker-CgXpmG3h.js → timepicker-DNoYMBAL.js} +22 -22
  137. package/package.json +2 -2
  138. package/src/components/alert/alert.test.ts +15 -0
  139. package/src/components/alert/alert.ts +0 -12
  140. package/src/components/checkbox/checkbox.ts +6 -9
  141. package/src/components/combobox/combobox-handlers.ts +6 -6
  142. package/src/components/combobox/combobox-value.ts +1 -1
  143. package/src/components/combobox/combobox.ts +8 -8
  144. package/src/components/datepicker/datepicker.ts +9 -9
  145. package/src/components/helptext/helptext-association.test.ts +79 -0
  146. package/src/components/input-wrapper/input-wrapper.test.ts +85 -0
  147. package/src/components/input-wrapper/input-wrapper.ts +17 -8
  148. package/src/components/progressbar/progressbar.test.ts +19 -0
  149. package/src/components/progressbar/progressbar.ts +2 -6
  150. package/src/components/radiobutton/radiobutton.ts +3 -6
  151. package/src/components/select/select.ts +5 -5
  152. package/src/components/textarea/textarea.ts +5 -5
  153. package/src/components/textinput/textinput.ts +5 -5
  154. package/src/components/timepicker/timepicker.ts +10 -10
  155. package/dist/alert-DcyO0WfW.cjs +0 -40
  156. package/dist/button-PcKtiNGS.cjs +0 -32
  157. package/dist/checkbox-C0zLtnCI.cjs +0 -40
  158. package/dist/element-with-slot-2PHu2w7O.cjs +0 -1
  159. package/dist/input-element-W6Gklt2E.cjs +0 -1
  160. package/dist/tag--kFPXNaj.cjs +0 -27
  161. package/dist/{backlink-DdyQq62f.js → backlink-BslFewn-.js} +1 -1
  162. package/dist/{searchinput-DyjUl08X.js → searchinput-Co8tcq-l.js} +1 -1
@@ -1,4 +1,4 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./if-defined-2mkIDgOm.cjs"),r=require("./element-with-slot-2PHu2w7O.cjs");require("./icon-Dnv6LtPC.cjs"),require("./calendar-TcxvS-1_.cjs");const i=require("./ref-Emu5PNxk.cjs"),a=require("./converters-BJ9Fe0kW.cjs");require("./tag--kFPXNaj.cjs");const o=require("./repeat-Dh9YKoeV.cjs"),s=require("./utils-63cRpWut.cjs"),c=require("./input-element-W6Gklt2E.cjs");require("./input-wrapper-B5rqKWSB.cjs");var l=class extends e.t{constructor(...e){super(...e),this.dates=[],this.dateformat=`dd.MM.yyyy`,this.className=`pkt-datepicker__tags`,this.idBase=s.n()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},e._`
1
+ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./element-with-slot-D7sTqOr3.cjs");require("./icon-Dnv6LtPC.cjs"),require("./calendar-TcxvS-1_.cjs");const r=require("./if-defined-2mkIDgOm.cjs"),i=require("./ref-Emu5PNxk.cjs"),a=require("./converters-BJ9Fe0kW.cjs");require("./tag-B5dUg7AD.cjs");const o=require("./repeat-Dh9YKoeV.cjs"),s=require("./utils-63cRpWut.cjs"),c=require("./input-element-CSfDGslx.cjs");require("./input-wrapper-BBG8EXQ8.cjs");var l=class extends e.t{constructor(...e){super(...e),this.dates=[],this.dateformat=`dd.MM.yyyy`,this.className=`pkt-datepicker__tags`,this.idBase=s.n()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},e._`
2
2
  <div class=${t.t(this.classes)} aria-live="polite">
3
3
  ${Array.isArray(this.dates)&&this.dates[0]?o.t(a.h((this.dates??[]).filter(Boolean)),e=>e,t=>e._` <pkt-tag
4
4
  id=${this.idBase+t+`-tag`}
@@ -54,13 +54,13 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
54
54
  .type=${this.inputType}
55
55
  id="${this.id}-input"
56
56
  .value=${this.value}
57
- min=${n.t(this.min)}
58
- max=${n.t(this.max)}
59
- placeholder=${n.t(this.placeholder)}
57
+ min=${r.t(this.min)}
58
+ max=${r.t(this.max)}
59
+ placeholder=${r.t(this.placeholder)}
60
60
  ?readonly=${this.isInputReadonly}
61
- aria-describedby=${n.t(this.describedBy)}
61
+ aria-describedby=${r.t(this.describedBy)}
62
62
  aria-invalid=${this.hasError}
63
- aria-errormessage=${n.t(this.errorMessageId)}
63
+ aria-errormessage=${r.t(this.errorMessageId)}
64
64
  @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
65
65
  @touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
66
66
  ?disabled=${this.disabled}
@@ -73,21 +73,21 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
73
73
  />
74
74
  ${this.renderCalendarButton()}
75
75
  </div>
76
- `}};e.n([e.u({type:String})],M.prototype,`value`,void 0);try{e.d(`pkt-datepicker-single`)(M)}catch{console.warn(`Forsøker å definere <pkt-datepicker-single>, men den er allerede definert`)}var N=class extends j{constructor(...e){super(...e),this.value=[],this.label=``,this.showRangeLabels=!1,this.inputRefTo=i.t()}get inputElementTo(){return this.inputRefTo.value}render(){let r=D.getRangeLabelClasses(this.showRangeLabels);return e._`
76
+ `}};e.n([e.u({type:String})],M.prototype,`value`,void 0);try{e.d(`pkt-datepicker-single`)(M)}catch{console.warn(`Forsøker å definere <pkt-datepicker-single>, men den er allerede definert`)}var N=class extends j{constructor(...e){super(...e),this.value=[],this.label=``,this.showRangeLabels=!1,this.inputRefTo=i.t()}get inputElementTo(){return this.inputRefTo.value}render(){let n=D.getRangeLabelClasses(this.showRangeLabels);return e._`
77
77
  <div class="pkt-input__container">
78
78
  ${this.showRangeLabels?e._` <div class="pkt-input-prefix">${this.pktStrings.get(`generic`).from}</div> `:e.h}
79
79
  <input
80
- aria-describedby=${n.t(this.describedBy)}
80
+ aria-describedby=${r.t(this.describedBy)}
81
81
  aria-invalid=${this.hasError}
82
- aria-errormessage=${n.t(this.errorMessageId)}
82
+ aria-errormessage=${r.t(this.errorMessageId)}
83
83
  class=${t.t(this.inputClasses)}
84
84
  .type=${this.inputType}
85
85
  id="${this.id}-input"
86
86
  aria-label="${this.label} ${this.pktStrings.get(`generic`).from}"
87
87
  .value=${this.value[0]??``}
88
- min=${n.t(this.min)}
89
- max=${n.t(this.max)}
90
- placeholder=${n.t(this.placeholder)}
88
+ min=${r.t(this.min)}
89
+ max=${r.t(this.max)}
90
+ placeholder=${r.t(this.placeholder)}
91
91
  ?readonly=${this.isInputReadonly}
92
92
  ?disabled=${this.disabled}
93
93
  @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
@@ -99,22 +99,22 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
99
99
  @change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
100
100
  ${i.n(this.inputRef)}
101
101
  />
102
- <div class="${t.t(r)}" id="${this.id}-to-label">
102
+ <div class="${t.t(n)}" id="${this.id}-to-label">
103
103
  ${this.pktStrings.get(`generic`).to}
104
104
  </div>
105
105
  ${this.showRangeLabels?e.h:e._` <div class="pkt-input-separator">–</div> `}
106
106
  <input
107
- aria-describedby=${n.t(this.describedBy)}
107
+ aria-describedby=${r.t(this.describedBy)}
108
108
  aria-invalid=${this.hasError}
109
- aria-errormessage=${n.t(this.errorMessageId)}
109
+ aria-errormessage=${r.t(this.errorMessageId)}
110
110
  class=${t.t(this.inputClasses)}
111
111
  .type=${this.inputType}
112
112
  id="${this.id}-to"
113
113
  aria-label="${this.label} ${this.pktStrings.get(`generic`).to}"
114
114
  .value=${this.value[1]??``}
115
- min=${n.t(this.min)}
116
- max=${n.t(this.max)}
117
- placeholder=${n.t(this.placeholder)}
115
+ min=${r.t(this.min)}
116
+ max=${r.t(this.max)}
117
+ placeholder=${r.t(this.placeholder)}
118
118
  ?readonly=${this.isInputReadonly}
119
119
  ?disabled=${this.disabled}
120
120
  @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
@@ -131,15 +131,15 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
131
131
  `}};e.n([e.u({type:Array})],N.prototype,`value`,void 0),e.n([e.u({type:String})],N.prototype,`label`,void 0),e.n([e.u({type:Boolean})],N.prototype,`showRangeLabels`,void 0);try{e.d(`pkt-datepicker-range`)(N)}catch{console.warn(`Forsøker å definere <pkt-datepicker-range>, men den er allerede definert`)}var P=class extends j{constructor(...e){super(...e),this.value=[]}get isInputDisabled(){return this.disabled||this.maxlength!==void 0&&this.maxlength!==null&&this.value.length>=this.maxlength}dispatchAddToSelected(e){this.dispatchEvent(new CustomEvent(`add-to-selected`,{detail:e,bubbles:!0,composed:!0}))}render(){return e._`
132
132
  <div class="pkt-input__container">
133
133
  <input
134
- aria-describedby=${n.t(this.describedBy)}
134
+ aria-describedby=${r.t(this.describedBy)}
135
135
  aria-invalid=${this.hasError}
136
- aria-errormessage=${n.t(this.errorMessageId)}
136
+ aria-errormessage=${r.t(this.errorMessageId)}
137
137
  class=${t.t(this.inputClasses)}
138
138
  .type=${this.inputType}
139
139
  id="${this.id}-input"
140
- min=${n.t(this.min)}
141
- max=${n.t(this.max)}
142
- placeholder=${n.t(this.placeholder)}
140
+ min=${r.t(this.min)}
141
+ max=${r.t(this.max)}
142
+ placeholder=${r.t(this.placeholder)}
143
143
  ?readonly=${this.isInputReadonly}
144
144
  ?disabled=${this.isInputDisabled}
145
145
  @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
@@ -162,12 +162,12 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
162
162
  .max=${this.max}
163
163
  .placeholder=${this.placeholder}
164
164
  .readonly=${this.readonly}
165
- .disabled=${this.disabled}
165
+ .disabled=${this.isDisabled}
166
166
  .inputClasses=${this.inputClasses}
167
167
  .inputSize=${this.inputSize}
168
168
  .internals=${this.internals}
169
169
  .hasError=${this.hasError}
170
- .hasHelptext=${!!(this.helptext||this.helptextDropdown)}
170
+ .hasHelptext=${!!(this.helptext||this.helptextDropdown||this.hasSlotContent(`helptext`))}
171
171
  .strings=${this.strings}
172
172
  @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
173
173
  @input-change=${()=>this.onInput()}
@@ -188,13 +188,13 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
188
188
  .max=${this.max}
189
189
  .placeholder=${this.placeholder}
190
190
  .readonly=${this.readonly}
191
- .disabled=${this.disabled}
191
+ .disabled=${this.isDisabled}
192
192
  .showRangeLabels=${this.showRangeLabels}
193
193
  .inputClasses=${this.inputClasses}
194
194
  .inputSize=${this.inputSize}
195
195
  .internals=${this.internals}
196
196
  .hasError=${this.hasError}
197
- .hasHelptext=${!!(this.helptext||this.helptextDropdown)}
197
+ .hasHelptext=${!!(this.helptext||this.helptextDropdown||this.hasSlotContent(`helptext`))}
198
198
  .strings=${this.strings}
199
199
  @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
200
200
  @input-change=${()=>this.onInput()}
@@ -216,13 +216,13 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
216
216
  .max=${this.max}
217
217
  .placeholder=${this.placeholder}
218
218
  .readonly=${this.readonly}
219
- .disabled=${this.disabled}
219
+ .disabled=${this.isDisabled}
220
220
  .maxlength=${this.maxlength}
221
221
  .inputClasses=${this.inputClasses}
222
222
  .inputSize=${this.inputSize}
223
223
  .internals=${this.internals}
224
224
  .hasError=${this.hasError}
225
- .hasHelptext=${!!(this.helptext||this.helptextDropdown)}
225
+ .hasHelptext=${!!(this.helptext||this.helptextDropdown||this.hasSlotContent(`helptext`))}
226
226
  .strings=${this.strings}
227
227
  @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
228
228
  @input-change=${()=>this.onInput()}
@@ -254,13 +254,14 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
254
254
  ></pkt-datepicker-popup>
255
255
  `}render(){return this.inputClasses=D.getInputClasses(this.fullwidth,this.showRangeLabels,this.multiple,this.range,this.readonly,this.inputType,this.inputSize),e._`
256
256
  <pkt-input-wrapper
257
+ ${n.n(this,[`helptext`])}
257
258
  .strings=${this.strings}
258
259
  label="${this.label}"
259
260
  forId="${this.id}-input"
260
261
  ?counter=${this.multiple&&!!this.maxlength}
261
262
  .counterCurrent=${this.value?this._value.length:0}
262
263
  .counterMaxLength=${this.maxlength}
263
- ?disabled=${this.disabled}
264
+ ?disabled=${this.isDisabled}
264
265
  ?hasError=${this.hasError}
265
266
  ?hasFieldset=${this.effectiveHasFieldset(!1)}
266
267
  ?inline=${this.inline}
@@ -278,7 +279,6 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
278
279
  .ariaDescribedby=${this.ariaDescribedby}
279
280
  .size=${this.inputSize}
280
281
  >
281
- <div class="pkt-contents" slot="helptext">${r.r(this,`helptext`)}</div>
282
282
  ${this.multiple?e._`<pkt-date-tags
283
283
  .dates=${this._value}
284
284
  dateformat=${this.dateformat}
@@ -1,16 +1,16 @@
1
1
  import { _ as e, d as t, h as n, l as r, n as i, s as a, t as o, u as s } from "./element-mwwC2Rra.js";
2
2
  import { t as c } from "./class-map-C4hdfSfY.js";
3
- import { t as l } from "./if-defined-Bebu3LXY.js";
4
- import { r as ee } from "./element-with-slot-FD826ooP.js";
3
+ import { n as ee } from "./element-with-slot-DQv0cbbD.js";
5
4
  import "./icon-JigbxxF7.js";
6
5
  import "./calendar-BLaRXUBl.js";
6
+ import { t as l } from "./if-defined-Bebu3LXY.js";
7
7
  import { n as u, t as d } from "./ref-CCSGk4MP.js";
8
8
  import { a as f, c as p, d as m, h, i as g, m as _, n as v, r as y, s as b, t as x, u as S } from "./converters-CkjLSYpa.js";
9
- import "./tag-CvFakm1k.js";
9
+ import "./tag-Bns7Xj1O.js";
10
10
  import { t as C } from "./repeat-CdxGS-_3.js";
11
11
  import { n as w, t as T } from "./utils-BwF4QSrq.js";
12
- import { t as E } from "./input-element-B1BntJeJ.js";
13
- import "./input-wrapper-CaMP5-Vm.js";
12
+ import { t as E } from "./input-element-lLzfwdim.js";
13
+ import "./input-wrapper-Bz9GwYrn.js";
14
14
  //#region src/components/datepicker/date-tags.ts
15
15
  var D = class extends o {
16
16
  constructor(...e) {
@@ -943,12 +943,12 @@ var $ = class t extends E {
943
943
  .max=${this.max}
944
944
  .placeholder=${this.placeholder}
945
945
  .readonly=${this.readonly}
946
- .disabled=${this.disabled}
946
+ .disabled=${this.isDisabled}
947
947
  .inputClasses=${this.inputClasses}
948
948
  .inputSize=${this.inputSize}
949
949
  .internals=${this.internals}
950
950
  .hasError=${this.hasError}
951
- .hasHelptext=${!!(this.helptext || this.helptextDropdown)}
951
+ .hasHelptext=${!!(this.helptext || this.helptextDropdown || this.hasSlotContent("helptext"))}
952
952
  .strings=${this.strings}
953
953
  @toggle-calendar=${(e) => this.toggleCalendar(e.detail)}
954
954
  @input-change=${() => this.onInput()}
@@ -978,13 +978,13 @@ var $ = class t extends E {
978
978
  .max=${this.max}
979
979
  .placeholder=${this.placeholder}
980
980
  .readonly=${this.readonly}
981
- .disabled=${this.disabled}
981
+ .disabled=${this.isDisabled}
982
982
  .showRangeLabels=${this.showRangeLabels}
983
983
  .inputClasses=${this.inputClasses}
984
984
  .inputSize=${this.inputSize}
985
985
  .internals=${this.internals}
986
986
  .hasError=${this.hasError}
987
- .hasHelptext=${!!(this.helptext || this.helptextDropdown)}
987
+ .hasHelptext=${!!(this.helptext || this.helptextDropdown || this.hasSlotContent("helptext"))}
988
988
  .strings=${this.strings}
989
989
  @toggle-calendar=${(e) => this.toggleCalendar(e.detail)}
990
990
  @input-change=${() => this.onInput()}
@@ -1032,13 +1032,13 @@ var $ = class t extends E {
1032
1032
  .max=${this.max}
1033
1033
  .placeholder=${this.placeholder}
1034
1034
  .readonly=${this.readonly}
1035
- .disabled=${this.disabled}
1035
+ .disabled=${this.isDisabled}
1036
1036
  .maxlength=${this.maxlength}
1037
1037
  .inputClasses=${this.inputClasses}
1038
1038
  .inputSize=${this.inputSize}
1039
1039
  .internals=${this.internals}
1040
1040
  .hasError=${this.hasError}
1041
- .hasHelptext=${!!(this.helptext || this.helptextDropdown)}
1041
+ .hasHelptext=${!!(this.helptext || this.helptextDropdown || this.hasSlotContent("helptext"))}
1042
1042
  .strings=${this.strings}
1043
1043
  @toggle-calendar=${(e) => this.toggleCalendar(e.detail)}
1044
1044
  @input-change=${() => this.onInput()}
@@ -1084,13 +1084,14 @@ var $ = class t extends E {
1084
1084
  render() {
1085
1085
  return this.inputClasses = G.getInputClasses(this.fullwidth, this.showRangeLabels, this.multiple, this.range, this.readonly, this.inputType, this.inputSize), e`
1086
1086
  <pkt-input-wrapper
1087
+ ${ee(this, ["helptext"])}
1087
1088
  .strings=${this.strings}
1088
1089
  label="${this.label}"
1089
1090
  forId="${this.id}-input"
1090
1091
  ?counter=${this.multiple && !!this.maxlength}
1091
1092
  .counterCurrent=${this.value ? this._value.length : 0}
1092
1093
  .counterMaxLength=${this.maxlength}
1093
- ?disabled=${this.disabled}
1094
+ ?disabled=${this.isDisabled}
1094
1095
  ?hasError=${this.hasError}
1095
1096
  ?hasFieldset=${this.effectiveHasFieldset(!1)}
1096
1097
  ?inline=${this.inline}
@@ -1108,7 +1109,6 @@ var $ = class t extends E {
1108
1109
  .ariaDescribedby=${this.ariaDescribedby}
1109
1110
  .size=${this.inputSize}
1110
1111
  >
1111
- <div class="pkt-contents" slot="helptext">${ee(this, "helptext")}</div>
1112
1112
  ${this.multiple ? e`<pkt-date-tags
1113
1113
  .dates=${this._value}
1114
1114
  dateformat=${this.dateformat}
@@ -1,11 +1,15 @@
1
1
  import { LitElement } from 'lit';
2
2
  import { AsyncDirective, PartInfo } from 'lit/async-directive.js';
3
- import { ChildPart } from 'lit/directive.js';
3
+ import { ChildPart, ElementPart } from 'lit/directive.js';
4
4
  /**
5
5
  * Returns the SlotManager for a host, creating one if it doesn't exist.
6
6
  * Call this in connectedCallback() to eagerly collect children before Lit renders.
7
7
  */
8
8
  export declare function getSlotManager(host: LitElement): SlotManager;
9
+ declare const DEFAULT_SLOT: unique symbol;
10
+ type SlotKey = string | typeof DEFAULT_SLOT;
11
+ type SlotMapping = Array<[from: SlotKey, to: SlotKey]>;
12
+ type ForwardedSlots = string[] | Record<string, string | null>;
9
13
  /**
10
14
  * Per-host singleton that manages node collection and observation.
11
15
  * Scans host children, categorizes them by slot attribute, and notifies
@@ -28,6 +32,8 @@ export declare class SlotManager {
28
32
  private placeholderToNode;
29
33
  private nodeToPlaceholder;
30
34
  private static PLACEHOLDER_PREFIX;
35
+ private sources;
36
+ private subscribers;
31
37
  constructor(host: LitElement);
32
38
  /**
33
39
  * Collect original children BEFORE Lit's first render.
@@ -43,6 +49,8 @@ export declare class SlotManager {
43
49
  * Unregister a directive instance. Stops observing if no directives remain.
44
50
  */
45
51
  removeDirective(d: SlotContentDirective): void;
52
+ addSource(token: object, manager: SlotManager, mapping: SlotMapping): void;
53
+ removeSource(token: object): void;
46
54
  /**
47
55
  * Returns nodes matching the given slot name.
48
56
  */
@@ -59,6 +67,10 @@ export declare class SlotManager {
59
67
  * the placeholder removal and clean up the real node.
60
68
  */
61
69
  ensurePlaceholder(node: Node): void;
70
+ private nodesFor;
71
+ private detachFrom;
72
+ private handleChange;
73
+ private stopObservingIfUnused;
62
74
  /**
63
75
  * Start MutationObserver for dynamic child changes.
64
76
  * Deferred via setTimeout to avoid catching Lit's first render mutations.
@@ -125,4 +137,27 @@ declare class SlotContentDirective extends AsyncDirective {
125
137
  * html`<div class="help">${slotContent(this, 'helptext')}</div>`
126
138
  */
127
139
  export declare const slotContent: (_host: LitElement, _slotName?: string | undefined) => import('lit-html/directive.js').DirectiveResult<typeof SlotContentDirective>;
140
+ declare class ForwardSlotsDirective extends AsyncDirective {
141
+ private target;
142
+ private source;
143
+ private mapping;
144
+ constructor(partInfo: PartInfo);
145
+ render(_host: LitElement, _slots: ForwardedSlots): unknown;
146
+ update(part: ElementPart, [host, slots]: [LitElement, ForwardedSlots]): unknown;
147
+ disconnected(): void;
148
+ reconnected(): void;
149
+ }
150
+ /**
151
+ * Element directive that gives a child element the host's slot content without an
152
+ * intermediate element. The child renders the nodes with its own `slotContent()`.
153
+ *
154
+ * @param host - The component instance (typically `this`)
155
+ * @param slots - Slot names forwarded under the same name, or a map from the host's slot
156
+ * name to the child's slot name (`null` for the child's default slot)
157
+ *
158
+ * @example
159
+ * html`<pkt-input-wrapper ${forwardSlots(this, ['helptext'])}></pkt-input-wrapper>`
160
+ * html`<pkt-helptext ${forwardSlots(this, { helptext: null })}></pkt-helptext>`
161
+ */
162
+ export declare const forwardSlots: (_host: LitElement, _slots: ForwardedSlots) => import('lit-html/directive.js').DirectiveResult<typeof ForwardSlotsDirective>;
128
163
  export {};
@@ -0,0 +1 @@
1
+ const e=require("./element-BOmr9YLv.cjs"),t=require("./async-directive-BGoo_npW.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=>[e,e]):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}});
@@ -15,67 +15,109 @@ function s(e) {
15
15
  var c = /* @__PURE__ */ new WeakMap();
16
16
  function l(e) {
17
17
  let t = c.get(e);
18
- return t || (t = new m(e), c.set(e, t)), t;
18
+ return t || (t = new g(e), c.set(e, t)), t;
19
19
  }
20
20
  var u = Symbol("default");
21
21
  function d(e) {
22
22
  return e === void 0 ? u : e;
23
23
  }
24
- function f(e, t) {
24
+ function f(e) {
25
+ return Array.isArray(e) ? e.map((e) => [e, e]) : Object.entries(e).map(([e, t]) => [e, t === null ? u : t]);
26
+ }
27
+ function p(e, t) {
28
+ return e.length === t.length && e.every(([e, n], r) => t[r][0] === e && t[r][1] === n);
29
+ }
30
+ function m(e, t) {
25
31
  if (e.nodeType === Node.COMMENT_NODE) return !1;
26
- if (e.nodeType === Node.TEXT_NODE) return s(e) ? (p(t, u, e), !0) : !1;
32
+ if (e.nodeType === Node.TEXT_NODE) return s(e) ? (h(t, u, e), !0) : !1;
27
33
  if (e.nodeType === Node.ELEMENT_NODE) {
28
34
  let n = e;
29
35
  if (a(n) || o(n)) return !1;
30
36
  if (n instanceof HTMLTemplateElement) {
31
37
  let e = Array.from(n.content.childNodes), r = d(n.getAttribute("slot") ?? void 0);
32
- for (let n of e) p(t, r, n);
38
+ for (let n of e) h(t, r, n);
33
39
  return !0;
34
40
  }
35
41
  let r = n.getAttribute("slot");
36
- return p(t, r === null ? u : d(r), e), !0;
42
+ return h(t, r === null ? u : d(r), e), !0;
37
43
  }
38
44
  return !1;
39
45
  }
40
- function p(e, t, n) {
46
+ function h(e, t, n) {
41
47
  let r = e.get(t);
42
48
  r || (r = [], e.set(t, r)), r.push(n);
43
49
  }
44
- var m = class e {
50
+ var g = class e {
45
51
  static {
46
52
  this.PLACEHOLDER_PREFIX = "pkt-slot";
47
53
  }
48
54
  constructor(e) {
49
- 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.host = e;
55
+ 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;
50
56
  }
51
57
  collectNodes() {
52
58
  if (this.initialCollectionDone) return;
53
59
  this.initialCollectionDone = !0, this.generation++;
54
60
  let e = Array.from(this.host.childNodes);
55
- for (let t of e) f(t, this.nodesBySlot) && this.trackedNodes.add(t);
61
+ for (let t of e) m(t, this.nodesBySlot) && this.trackedNodes.add(t);
56
62
  }
57
63
  addDirective(e) {
58
64
  this.directives.add(e), this.startObserving();
59
65
  }
60
66
  removeDirective(e) {
61
- this.directives.delete(e), this.directives.size === 0 && this.stopObserving();
67
+ this.directives.delete(e), this.stopObservingIfUnused();
68
+ }
69
+ addSource(e, t, n) {
70
+ let r = this.sources.get(e);
71
+ r && r.manager === t && p(r.mapping, n) || (r && r.manager !== t && this.detachFrom(r.manager, e), this.sources.set(e, {
72
+ manager: t,
73
+ mapping: n
74
+ }), t.subscribers.add(this), t.startObserving(), this.handleChange());
75
+ }
76
+ removeSource(e) {
77
+ let t = this.sources.get(e);
78
+ t && (this.sources.delete(e), this.detachFrom(t.manager, e), this.handleChange());
62
79
  }
63
80
  getNodes(e) {
64
- return this.nodesBySlot.get(d(e)) ?? [];
81
+ return this.nodesFor(d(e));
65
82
  }
66
83
  hasContent(e) {
67
84
  return this.getNodes(e).length > 0;
68
85
  }
69
86
  ensurePlaceholder(t) {
70
- if (this.nodeToPlaceholder.has(t) || t.parentNode !== this.host) return;
87
+ if (this.nodeToPlaceholder.has(t)) return;
88
+ if (t.parentNode !== this.host) {
89
+ for (let { manager: e } of this.sources.values()) e.ensurePlaceholder(t);
90
+ return;
91
+ }
71
92
  let n = document.createComment(e.PLACEHOLDER_PREFIX);
72
93
  this.host.insertBefore(n, t), this.placeholderToNode.set(n, t), this.nodeToPlaceholder.set(t, n);
73
94
  }
95
+ nodesFor(e) {
96
+ let t = this.nodesBySlot.get(e) ?? [];
97
+ if (this.sources.size === 0) return t;
98
+ let n = [];
99
+ for (let { manager: t, mapping: r } of this.sources.values()) for (let [i, a] of r) a === e && n.push(...t.nodesFor(i));
100
+ return n.length ? [...t, ...n] : t;
101
+ }
102
+ detachFrom(e, t) {
103
+ [...this.sources.entries()].some(([n, r]) => n !== t && r.manager === e) || (e.subscribers.delete(this), e.stopObservingIfUnused());
104
+ }
105
+ handleChange() {
106
+ this.generation++, this.notifyDirectives();
107
+ for (let e of this.subscribers) e.handleChange();
108
+ this.host.requestUpdate();
109
+ }
110
+ stopObservingIfUnused() {
111
+ this.directives.size === 0 && this.subscribers.size === 0 && this.stopObserving();
112
+ }
74
113
  startObserving() {
75
114
  this.observing || (this.observing = !0, setTimeout(() => {
76
- this.observing && (this.observer = new MutationObserver((e) => {
115
+ !this.observing || typeof MutationObserver > "u" || (this.observer = new MutationObserver((e) => {
77
116
  this.handleMutations(e);
78
- }), this.observer.observe(this.host, { childList: !0 }));
117
+ }), this.observer.observe(this.host, {
118
+ childList: !0,
119
+ subtree: !0
120
+ }));
79
121
  }, 0));
80
122
  }
81
123
  stopObserving() {
@@ -85,22 +127,22 @@ var m = class e {
85
127
  if (this.processingMutations) return;
86
128
  this.processingMutations = !0;
87
129
  let t = !1;
88
- for (let n of e) if (n.target === this.host) {
130
+ for (let n of e) {
89
131
  for (let e of n.removedNodes) {
90
132
  let n = this.placeholderToNode.get(e);
91
133
  if (n) {
92
134
  n.parentNode?.removeChild(n), this.trackedNodes.delete(n), this.removeFromSlots(n), this.placeholderToNode.delete(e), this.nodeToPlaceholder.delete(n), t = !0;
93
135
  continue;
94
136
  }
95
- if (this.trackedNodes.has(e)) {
137
+ if (this.trackedNodes.has(e) && !this.host.contains(e)) {
96
138
  this.trackedNodes.delete(e), this.removeFromSlots(e);
97
139
  let n = this.nodeToPlaceholder.get(e);
98
140
  n && (n.parentNode?.removeChild(n), this.placeholderToNode.delete(n), this.nodeToPlaceholder.delete(e)), t = !0;
99
141
  }
100
142
  }
101
- for (let e of n.addedNodes) this.placeholderToNode.has(e) || !this.trackedNodes.has(e) && this.isUserContent(e) && f(e, this.nodesBySlot) && (this.trackedNodes.add(e), t = !0);
143
+ 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);
102
144
  }
103
- t && (this.generation++, this.notifyDirectives()), this.observer?.takeRecords(), this.processingMutations = !1;
145
+ t && this.handleChange(), this.observer?.takeRecords(), this.processingMutations = !1;
104
146
  }
105
147
  isUserContent(e) {
106
148
  if (e.nodeType === Node.COMMENT_NODE) return !1;
@@ -123,7 +165,7 @@ var m = class e {
123
165
  notifyDirectives() {
124
166
  for (let e of this.directives) e.handleNodesChanged();
125
167
  }
126
- }, h = e(class extends i {
168
+ }, _ = e(class extends i {
127
169
  constructor(e) {
128
170
  if (super(e), this.manager = null, this.lastGeneration = -1, e.type !== n.CHILD) throw Error("slotContent() can only be used in child expressions");
129
171
  }
@@ -153,7 +195,24 @@ var m = class e {
153
195
  let e = this.manager.generation;
154
196
  return e === this.lastGeneration ? t : (this.lastGeneration = e, this.manager.getNodes(this.slotName));
155
197
  }
156
- }), g = class extends r {
198
+ }), v = e(class extends i {
199
+ constructor(e) {
200
+ 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");
201
+ }
202
+ render(e, n) {
203
+ return t;
204
+ }
205
+ update(e, [n, r]) {
206
+ let i = l(e.element);
207
+ 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;
208
+ }
209
+ disconnected() {
210
+ this.target?.removeSource(this);
211
+ }
212
+ reconnected() {
213
+ this.target && this.source && this.target.addSource(this, this.source, this.mapping);
214
+ }
215
+ }), y = class extends r {
157
216
  connectedCallback() {
158
217
  l(this).collectNodes(), super.connectedCallback();
159
218
  }
@@ -162,4 +221,4 @@ var m = class e {
162
221
  }
163
222
  };
164
223
  //#endregion
165
- export { o as i, l as n, h as r, g as t };
224
+ export { o as a, _ as i, v as n, l as r, y as t };