@sixbell-telco/sdk 4.2.0 → 4.4.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 (268) hide show
  1. package/CHANGELOG.md +108 -1
  2. package/README.md +98 -66
  3. package/_index.css +2 -1586
  4. package/components/accordion/accordion-item/accordion-item.component.d.ts +1 -1
  5. package/components/alert/README.md +27 -0
  6. package/components/alert/index.d.ts +5 -0
  7. package/components/alert/public-api.d.ts +1 -0
  8. package/components/alert/src/alert.component.d.ts +85 -0
  9. package/components/audio-player/audio-timeline/audio-timeline.component.d.ts +1 -1
  10. package/components/audio-player/button-play/button-play.component.d.ts +7 -7
  11. package/components/audio-player/src/audio-player.component.d.ts +2 -2
  12. package/components/audio-player/volume-control/volume-control.component.d.ts +1 -1
  13. package/components/avatar/README.md +1 -0
  14. package/components/avatar/src/avatar.component.d.ts +2 -2
  15. package/components/badge/src/badge.component.d.ts +4 -4
  16. package/components/button/README.md +5 -4
  17. package/components/button/src/button.component.d.ts +38 -16
  18. package/components/card/README.md +2 -0
  19. package/components/card/card-footer/card-footer.component.d.ts +37 -2
  20. package/components/card/card-section-group/card-section-group.component.d.ts +1 -1
  21. package/components/card/src/card.component.d.ts +6 -6
  22. package/components/countdown/src/countdown.component.d.ts +4 -4
  23. package/components/data-table/README.md +26 -0
  24. package/components/data-table/expandable/expandable.component.d.ts +4 -4
  25. package/components/data-table/sortable-header/sortable-header.component.d.ts +1 -1
  26. package/components/data-table/src/data-table.component.d.ts +15 -8
  27. package/components/data-table/sub-component-toggle/sub-component-toggle.component.d.ts +1 -1
  28. package/components/description-list/README.md +27 -0
  29. package/components/description-list/index.d.ts +5 -0
  30. package/components/description-list/public-api.d.ts +1 -0
  31. package/components/description-list/src/description-list.component.d.ts +90 -0
  32. package/components/dialog/README.md +10 -6
  33. package/components/dialog/dialog-actions/dialog-actions.component.d.ts +4 -0
  34. package/components/dialog/src/dialog.component.d.ts +27 -6
  35. package/components/dialog/src/fullscreen-block-scroll-strategy.d.ts +31 -0
  36. package/components/divider/src/divider.component.d.ts +1 -1
  37. package/components/dropdown/README.md +2 -2
  38. package/components/dropdown/dropdown-chevron/dropdown-chevron.component.d.ts +1 -1
  39. package/components/dropdown/dropdown-content/dropdown-content.component.d.ts +1 -1
  40. package/components/dropdown/dropdown-item/dropdown-item.component.d.ts +4 -4
  41. package/components/dropdown/dropdown-item-checkbox/dropdown-item-checkbox.component.d.ts +5 -5
  42. package/components/dropdown/dropdown-item-radio/dropdown-item-radio.component.d.ts +5 -5
  43. package/components/dropdown/dropdown-trigger/dropdown-trigger.component.d.ts +11 -14
  44. package/components/dropdown-menu/README.md +2 -2
  45. package/components/dropdown-menu/bar/dropdown-menu-bar/dropdown-menu-bar.component.d.ts +1 -1
  46. package/components/dropdown-menu/bar/dropdown-menu-bar-content/dropdown-menu-bar-content.component.d.ts +6 -2
  47. package/components/dropdown-menu/bar/dropdown-menu-bar-item/dropdown-menu-bar-item.component.d.ts +3 -3
  48. package/components/dropdown-menu/bar/dropdown-menu-bar-item-checkbox/dropdown-menu-bar-item-checkbox.component.d.ts +4 -4
  49. package/components/dropdown-menu/bar/dropdown-menu-bar-item-radio/dropdown-menu-bar-item-radio.component.d.ts +4 -4
  50. package/components/dropdown-menu/bar/dropdown-menu-bar-sub-trigger/dropdown-menu-bar-sub-trigger.component.d.ts +3 -1
  51. package/components/dropdown-menu/bar/dropdown-menu-bar-trigger/dropdown-menu-bar-trigger.component.d.ts +3 -1
  52. package/components/dropdown-menu/context/dropdown-context-menu-trigger/dropdown-context-menu-trigger.component.d.ts +2 -1
  53. package/components/dropdown-menu/dropdown-menu-chevron/dropdown-menu-chevron.component.d.ts +1 -1
  54. package/components/dropdown-menu/src/dropdown-menu-content/dropdown-menu-content.component.d.ts +2 -0
  55. package/components/dropdown-menu/src/dropdown-menu-item/dropdown-menu-item.component.d.ts +3 -3
  56. package/components/dropdown-menu/src/dropdown-menu-sub-content/dropdown-menu-sub-content.component.d.ts +2 -0
  57. package/components/dropdown-menu/src/dropdown-menu-sub-trigger/dropdown-menu-sub-trigger.component.d.ts +2 -1
  58. package/components/dropdown-menu/src/dropdown-menu-trigger/dropdown-menu-trigger.component.d.ts +1 -0
  59. package/components/empty-state/README.md +40 -0
  60. package/components/empty-state/index.d.ts +5 -0
  61. package/components/empty-state/public-api.d.ts +1 -0
  62. package/components/empty-state/src/empty-state.component.d.ts +73 -0
  63. package/components/file-upload/file-dropzone/file-dropzone.component.d.ts +4 -4
  64. package/components/file-upload/file-uploader/file-uploader.component.d.ts +2 -2
  65. package/components/forms/checkbox/src/checkbox.component.d.ts +1 -1
  66. package/components/forms/combobox/README.md +2 -1
  67. package/components/forms/combobox/src/combobox.component.d.ts +31 -18
  68. package/components/forms/date-picker/src/date-picker.component.d.ts +16 -9
  69. package/components/forms/form-hint/README.md +29 -0
  70. package/components/forms/form-hint/index.d.ts +5 -0
  71. package/components/forms/form-hint/public-api.d.ts +1 -0
  72. package/components/forms/form-hint/src/form-hint.component.d.ts +38 -0
  73. package/components/forms/form-item/src/form-item.component.d.ts +45 -1
  74. package/components/forms/input/src/input.component.d.ts +15 -8
  75. package/components/forms/radio/src/radio.component.d.ts +1 -1
  76. package/components/forms/range/src/range.component.d.ts +18 -4
  77. package/components/forms/select/README.md +2 -1
  78. package/components/forms/select/src/select.component.d.ts +30 -16
  79. package/components/forms/switch/src/switch.component.d.ts +1 -1
  80. package/components/forms/textarea/src/textarea.component.d.ts +12 -5
  81. package/components/forms/toggle/src/toggle.component.d.ts +1 -1
  82. package/components/notification/src/notification.component.d.ts +1 -1
  83. package/components/overlay/README.md +7 -2
  84. package/components/overlay/overlay-trigger/overlay-trigger.component.d.ts +1 -1
  85. package/components/overlay/src/overlay.component.d.ts +10 -9
  86. package/components/paginator/components/pagination-item/pagination-item.component.d.ts +3 -3
  87. package/components/progress/src/progress.component.d.ts +1 -1
  88. package/components/segmented-button/README.md +57 -0
  89. package/components/segmented-button/index.d.ts +5 -0
  90. package/components/segmented-button/public-api.d.ts +1 -0
  91. package/components/segmented-button/src/segmented-button.component.d.ts +110 -0
  92. package/components/sonner/toaster/src/toaster.component.d.ts +3 -3
  93. package/components/tab/src/tab.component.d.ts +2 -2
  94. package/components/table/README.md +51 -3
  95. package/components/table/public-api.d.ts +1 -0
  96. package/components/table/src/table.component.d.ts +20 -13
  97. package/components/table/table-action/table-action.component.d.ts +14 -3
  98. package/components/table/table-actions/table-actions.component.d.ts +12 -1
  99. package/components/table/tokens/README.md +7 -0
  100. package/components/table/tokens/index.d.ts +5 -0
  101. package/components/table/tokens/public-api.d.ts +1 -0
  102. package/components/table/tokens/table-empty-state.d.ts +6 -0
  103. package/components/tooltip/README.md +25 -7
  104. package/components/tooltip/src/tooltip.component.d.ts +44 -12
  105. package/components/tree/README.md +73 -0
  106. package/components/tree/index.d.ts +5 -0
  107. package/components/tree/public-api.d.ts +1 -0
  108. package/components/tree/src/tree.component.d.ts +180 -0
  109. package/components/wizard/README.md +9 -0
  110. package/components/wizard/wizard-content/wizard-content.component.d.ts +1 -1
  111. package/components/wizard/wizard-wrapper/wizard-wrapper.component.d.ts +15 -6
  112. package/directives/auto-focus/src/auto-focus.directive.d.ts +1 -1
  113. package/directives/only-numbers/src/only-numbers.directive.d.ts +1 -1
  114. package/directives/truncate/README.md +49 -0
  115. package/directives/truncate/index.d.ts +5 -0
  116. package/directives/truncate/public-api.d.ts +1 -0
  117. package/directives/truncate/src/truncate-popover.component.d.ts +11 -0
  118. package/directives/truncate/src/truncate.directive.d.ts +96 -0
  119. package/fesm2022/sixbell-telco-sdk-components-accordion.mjs +2 -2
  120. package/fesm2022/sixbell-telco-sdk-components-accordion.mjs.map +1 -1
  121. package/fesm2022/sixbell-telco-sdk-components-alert.mjs +152 -0
  122. package/fesm2022/sixbell-telco-sdk-components-alert.mjs.map +1 -0
  123. package/fesm2022/sixbell-telco-sdk-components-audio-player.mjs +15 -15
  124. package/fesm2022/sixbell-telco-sdk-components-audio-player.mjs.map +1 -1
  125. package/fesm2022/sixbell-telco-sdk-components-avatar.mjs +4 -4
  126. package/fesm2022/sixbell-telco-sdk-components-avatar.mjs.map +1 -1
  127. package/fesm2022/sixbell-telco-sdk-components-badge.mjs +5 -5
  128. package/fesm2022/sixbell-telco-sdk-components-badge.mjs.map +1 -1
  129. package/fesm2022/sixbell-telco-sdk-components-button.mjs +53 -19
  130. package/fesm2022/sixbell-telco-sdk-components-button.mjs.map +1 -1
  131. package/fesm2022/sixbell-telco-sdk-components-card.mjs +61 -14
  132. package/fesm2022/sixbell-telco-sdk-components-card.mjs.map +1 -1
  133. package/fesm2022/sixbell-telco-sdk-components-countdown.mjs +5 -5
  134. package/fesm2022/sixbell-telco-sdk-components-countdown.mjs.map +1 -1
  135. package/fesm2022/sixbell-telco-sdk-components-data-table-sub-component-toggle.mjs +3 -3
  136. package/fesm2022/sixbell-telco-sdk-components-data-table-sub-component-toggle.mjs.map +1 -1
  137. package/fesm2022/sixbell-telco-sdk-components-data-table.mjs +34 -33
  138. package/fesm2022/sixbell-telco-sdk-components-data-table.mjs.map +1 -1
  139. package/fesm2022/sixbell-telco-sdk-components-description-list.mjs +200 -0
  140. package/fesm2022/sixbell-telco-sdk-components-description-list.mjs.map +1 -0
  141. package/fesm2022/sixbell-telco-sdk-components-dialog.mjs +128 -17
  142. package/fesm2022/sixbell-telco-sdk-components-dialog.mjs.map +1 -1
  143. package/fesm2022/sixbell-telco-sdk-components-divider.mjs +2 -2
  144. package/fesm2022/sixbell-telco-sdk-components-divider.mjs.map +1 -1
  145. package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs +33 -24
  146. package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs.map +1 -1
  147. package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-context.mjs +7 -3
  148. package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-context.mjs.map +1 -1
  149. package/fesm2022/sixbell-telco-sdk-components-dropdown-menu.mjs +25 -14
  150. package/fesm2022/sixbell-telco-sdk-components-dropdown-menu.mjs.map +1 -1
  151. package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs +43 -72
  152. package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs.map +1 -1
  153. package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs +1 -1
  154. package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs.map +1 -1
  155. package/fesm2022/sixbell-telco-sdk-components-empty-state.mjs +131 -0
  156. package/fesm2022/sixbell-telco-sdk-components-empty-state.mjs.map +1 -0
  157. package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs +9 -9
  158. package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs.map +1 -1
  159. package/fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs +2 -2
  160. package/fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs.map +1 -1
  161. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +104 -72
  162. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
  163. package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs +23 -12
  164. package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs.map +1 -1
  165. package/fesm2022/sixbell-telco-sdk-components-forms-form-hint.mjs +81 -0
  166. package/fesm2022/sixbell-telco-sdk-components-forms-form-hint.mjs.map +1 -0
  167. package/fesm2022/sixbell-telco-sdk-components-forms-form-item.mjs +45 -3
  168. package/fesm2022/sixbell-telco-sdk-components-forms-form-item.mjs.map +1 -1
  169. package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs +27 -13
  170. package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs.map +1 -1
  171. package/fesm2022/sixbell-telco-sdk-components-forms-radio.mjs +2 -2
  172. package/fesm2022/sixbell-telco-sdk-components-forms-radio.mjs.map +1 -1
  173. package/fesm2022/sixbell-telco-sdk-components-forms-range.mjs +29 -7
  174. package/fesm2022/sixbell-telco-sdk-components-forms-range.mjs.map +1 -1
  175. package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs +84 -56
  176. package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs.map +1 -1
  177. package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs +2 -2
  178. package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs.map +1 -1
  179. package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs +27 -22
  180. package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs.map +1 -1
  181. package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs +2 -2
  182. package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs.map +1 -1
  183. package/fesm2022/sixbell-telco-sdk-components-notification.mjs +2 -2
  184. package/fesm2022/sixbell-telco-sdk-components-notification.mjs.map +1 -1
  185. package/fesm2022/sixbell-telco-sdk-components-overlay.mjs +41 -79
  186. package/fesm2022/sixbell-telco-sdk-components-overlay.mjs.map +1 -1
  187. package/fesm2022/sixbell-telco-sdk-components-paginator.mjs +4 -4
  188. package/fesm2022/sixbell-telco-sdk-components-paginator.mjs.map +1 -1
  189. package/fesm2022/sixbell-telco-sdk-components-progress.mjs +2 -2
  190. package/fesm2022/sixbell-telco-sdk-components-progress.mjs.map +1 -1
  191. package/fesm2022/sixbell-telco-sdk-components-segmented-button.mjs +329 -0
  192. package/fesm2022/sixbell-telco-sdk-components-segmented-button.mjs.map +1 -0
  193. package/fesm2022/sixbell-telco-sdk-components-sonner-toaster.mjs +4 -4
  194. package/fesm2022/sixbell-telco-sdk-components-sonner-toaster.mjs.map +1 -1
  195. package/fesm2022/sixbell-telco-sdk-components-sonner.mjs +4 -4
  196. package/fesm2022/sixbell-telco-sdk-components-sonner.mjs.map +1 -1
  197. package/fesm2022/sixbell-telco-sdk-components-tab.mjs +3 -3
  198. package/fesm2022/sixbell-telco-sdk-components-tab.mjs.map +1 -1
  199. package/fesm2022/sixbell-telco-sdk-components-table-tokens.mjs +14 -0
  200. package/fesm2022/sixbell-telco-sdk-components-table-tokens.mjs.map +1 -0
  201. package/fesm2022/sixbell-telco-sdk-components-table.mjs +63 -32
  202. package/fesm2022/sixbell-telco-sdk-components-table.mjs.map +1 -1
  203. package/fesm2022/sixbell-telco-sdk-components-tooltip.mjs +187 -75
  204. package/fesm2022/sixbell-telco-sdk-components-tooltip.mjs.map +1 -1
  205. package/fesm2022/sixbell-telco-sdk-components-tree.mjs +478 -0
  206. package/fesm2022/sixbell-telco-sdk-components-tree.mjs.map +1 -0
  207. package/fesm2022/sixbell-telco-sdk-components-wizard.mjs +18 -9
  208. package/fesm2022/sixbell-telco-sdk-components-wizard.mjs.map +1 -1
  209. package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs +2 -2
  210. package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs.map +1 -1
  211. package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs +2 -2
  212. package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs.map +1 -1
  213. package/fesm2022/sixbell-telco-sdk-directives-truncate.mjs +339 -0
  214. package/fesm2022/sixbell-telco-sdk-directives-truncate.mjs.map +1 -0
  215. package/fesm2022/sixbell-telco-sdk-layouts.mjs +69 -41
  216. package/fesm2022/sixbell-telco-sdk-layouts.mjs.map +1 -1
  217. package/fesm2022/sixbell-telco-sdk-utils-date.mjs +15 -2
  218. package/fesm2022/sixbell-telco-sdk-utils-date.mjs.map +1 -1
  219. package/fesm2022/sixbell-telco-sdk-utils-mfe.mjs +87 -2
  220. package/fesm2022/sixbell-telco-sdk-utils-mfe.mjs.map +1 -1
  221. package/fesm2022/sixbell-telco-sdk-utils-popover-motion.mjs +186 -0
  222. package/fesm2022/sixbell-telco-sdk-utils-popover-motion.mjs.map +1 -0
  223. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs +234 -4
  224. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs.map +1 -1
  225. package/fesm2022/sixbell-telco-sdk-utils-translation-testing.mjs +203 -0
  226. package/fesm2022/sixbell-telco-sdk-utils-translation-testing.mjs.map +1 -0
  227. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs +129 -14
  228. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs.map +1 -1
  229. package/fesm2022/sixbell-telco-sdk-utils-unsaved-changes.mjs +150 -0
  230. package/fesm2022/sixbell-telco-sdk-utils-unsaved-changes.mjs.map +1 -0
  231. package/i18n/sdk/en.json +224 -0
  232. package/i18n/sdk/es.json +224 -0
  233. package/i18n/sdk/pt.json +224 -0
  234. package/layouts/README.md +18 -11
  235. package/layouts/public-api.d.ts +1 -1
  236. package/layouts/src/app-layout/app-layout.component.d.ts +11 -8
  237. package/layouts/src/layout.config.d.ts +1 -1
  238. package/layouts/src/menu/menu-active.d.ts +2 -1
  239. package/layouts/src/menu/menu-url.d.ts +2 -0
  240. package/layouts/src/navbar/navbar.component.d.ts +5 -5
  241. package/layouts/src/page-banner/page-banner.component.d.ts +19 -2
  242. package/layouts/src/side-menu/side-menu.component.d.ts +2 -2
  243. package/layouts/src/user-menu/user-menu.component.d.ts +5 -5
  244. package/package.json +64 -20
  245. package/src/_index.css +1701 -0
  246. package/utils/mfe/README.md +1 -0
  247. package/utils/mfe/src/hoist-property-rules.d.ts +13 -0
  248. package/utils/mfe/src/mfe-shadow-shell.component.d.ts +3 -0
  249. package/utils/popover-motion/README.md +38 -0
  250. package/utils/popover-motion/index.d.ts +5 -0
  251. package/utils/popover-motion/public-api.d.ts +2 -0
  252. package/utils/popover-motion/src/popover-menu-motion.d.ts +37 -0
  253. package/utils/popover-motion/src/popover-motion.d.ts +31 -0
  254. package/utils/theme/README.md +94 -1
  255. package/utils/theme/public-api.d.ts +2 -1
  256. package/utils/theme/src/models/theme.d.ts +32 -0
  257. package/utils/theme/src/overlay/theme-overlay.d.ts +33 -0
  258. package/utils/theme/src/providers/theme.provider.types.d.ts +7 -0
  259. package/utils/translation/README.md +63 -0
  260. package/utils/translation/src/translation.service.d.ts +24 -0
  261. package/utils/translation/testing/index.d.ts +5 -0
  262. package/utils/translation/testing/public-api.d.ts +2 -0
  263. package/utils/translation/testing/src/translation-testing.d.ts +96 -0
  264. package/utils/unsaved-changes/README.md +33 -0
  265. package/utils/unsaved-changes/index.d.ts +5 -0
  266. package/utils/unsaved-changes/public-api.d.ts +1 -0
  267. package/utils/unsaved-changes/src/unsaved-changes-dialog.component.d.ts +24 -0
  268. package/utils/unsaved-changes/src/unsaved-changes.d.ts +50 -0
@@ -1,5 +1,8 @@
1
1
  import dayjs from 'dayjs';
2
+ import customParseFormat from 'dayjs/plugin/customParseFormat';
2
3
 
4
+ // Strict custom-format parsing (`dayjs(date, format, true)`) needs this plugin; `extend` is idempotent.
5
+ dayjs.extend(customParseFormat);
3
6
  /**
4
7
  * Supported display / parsing formats for date utilities.
5
8
  * Internally all calculations use ISO `YYYY-MM-DD` and convert to the chosen format for display.
@@ -26,6 +29,11 @@ const TIME_SECONDS_FORMAT = 'HH:mm:ss';
26
29
  // 12-hour time format constants
27
30
  const TIME_12H_MINUTES_FORMAT = 'h:mm A';
28
31
  const TIME_12H_SECONDS_FORMAT = 'h:mm:ss A';
32
+ /** True when `date` has the digit groups and separators of `format` (`MM/DD/YYYY` fits `02/31/2024`). */
33
+ function fitsFormatShape(date, format) {
34
+ const shape = format.replace('YYYY', '9999').replace(/MM|DD/g, '99');
35
+ return date.replace(/\d/g, '9') === shape;
36
+ }
29
37
  /**
30
38
  * Reusable date utility service for date operations across the SDK.
31
39
  * Provides consistent date handling, formatting, and range operations.
@@ -39,10 +47,15 @@ class DateUtils {
39
47
  return '';
40
48
  // If already ISO, return as-is to avoid misparsing when a display format is provided
41
49
  if (/^\d{4}-\d{2}-\d{2}$/.test(date))
42
- return date;
50
+ return dayjs(date, ISO_DATE_FORMAT, true).format('YYYY-MM-DD');
43
51
  if (format && format !== 'YYYY-MM-DD') {
44
52
  const parsed = dayjs(date, format, true);
45
- return parsed.isValid() ? parsed.format('YYYY-MM-DD') : dayjs(date).format('YYYY-MM-DD');
53
+ if (parsed.isValid())
54
+ return parsed.format('YYYY-MM-DD');
55
+ // Shaped like the format but not a real date (02/31/2024): invalid, never rolled into the next month.
56
+ if (fitsFormatShape(date, format))
57
+ return parsed.format('YYYY-MM-DD');
58
+ return dayjs(date).format('YYYY-MM-DD');
46
59
  }
47
60
  return dayjs(date).format('YYYY-MM-DD');
48
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sixbell-telco-sdk-utils-date.mjs","sources":["../../../projects/sdk/utils/date/src/date-utils.ts","../../../projects/sdk/utils/date/sixbell-telco-sdk-utils-date.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\n/**\n * Supported display / parsing formats for date utilities.\n * Internally all calculations use ISO `YYYY-MM-DD` and convert to the chosen format for display.\n */\nexport const SUPPORTED_DATE_FORMATS = [\n\t'DD/MM/YYYY', // Day/Month/Year (European)\n\t'MM/DD/YYYY', // Month/Day/Year (US)\n\t'YYYY-MM-DD', // Year-Month-Day (ISO)\n\t'DD-MM-YYYY', // Day-Month-Year (European with dashes)\n\t'MM-DD-YYYY', // Month-Day-Year (US with dashes)\n\t'YYYY/MM/DD', // Year/Month/Day (ISO with slashes)\n\t'DD.MM.YYYY', // Day.Month.Year (German style)\n\t'MM.DD.YYYY', // Month.Day.Year (US with dots)\n\t'YYYY.MM.DD', // Year.Month.Day (ISO with dots)\n] as const;\n\n/** Union type of all supported format strings. */\nexport type SupportedDateFormat = (typeof SUPPORTED_DATE_FORMATS)[number];\n\n/**\n * Supported time-only formats\n */\nexport const SUPPORTED_TIME_FORMATS = ['HH:mm', 'HH:mm:ss'] as const;\nexport type SupportedTimeFormat = (typeof SUPPORTED_TIME_FORMATS)[number];\n\n// Commonly used format constants\nexport const ISO_DATE_FORMAT: SupportedDateFormat = 'YYYY-MM-DD';\nexport const TIME_MINUTES_FORMAT: SupportedTimeFormat = 'HH:mm';\nexport const TIME_SECONDS_FORMAT: SupportedTimeFormat = 'HH:mm:ss';\n\n// 12-hour time format constants\nexport const TIME_12H_MINUTES_FORMAT = 'h:mm A';\nexport const TIME_12H_SECONDS_FORMAT = 'h:mm:ss A';\n\n// Application-wide default UI date display format\n\n/**\n * Quick action types for range picker\n */\nexport type QuickRangePreset = 'last7Days' | 'last30Days' | 'last6Months' | 'lastYear';\n\n/**\n * Date range representation\n */\nexport interface DateRange {\n\tstart: string;\n\tend: string;\n}\n\n/**\n * Reusable date utility service for date operations across the SDK.\n * Provides consistent date handling, formatting, and range operations.\n */\nexport class DateUtils {\n\t/**\n\t * Convert a date string to ISO format (YYYY-MM-DD)\n\t */\n\tstatic toISODate(date: string, format?: SupportedDateFormat): string {\n\t\tif (!date) return '';\n\t\t// If already ISO, return as-is to avoid misparsing when a display format is provided\n\t\tif (/^\\d{4}-\\d{2}-\\d{2}$/.test(date)) return date;\n\t\tif (format && format !== 'YYYY-MM-DD') {\n\t\t\tconst parsed = dayjs(date, format, true);\n\t\t\treturn parsed.isValid() ? parsed.format('YYYY-MM-DD') : dayjs(date).format('YYYY-MM-DD');\n\t\t}\n\t\treturn dayjs(date).format('YYYY-MM-DD');\n\t}\n\n\t/**\n\t * Convert ISO date to display format\n\t */\n\tstatic toDisplayDate(isoDate: string, format: SupportedDateFormat): string {\n\t\tif (!isoDate) return '';\n\t\treturn dayjs(isoDate).format(format);\n\t}\n\n\t/** Build a combined date-time format string, e.g. `YYYY-MM-DD HH:mm:ss` */\n\tstatic buildDateTimeFormat(dateFmt: SupportedDateFormat, timeFmt: SupportedTimeFormat): string {\n\t\treturn `${dateFmt} ${timeFmt}`;\n\t}\n\n\t/** Infer time format from a time string (returns seconds precision if length is 8) */\n\tstatic inferTimeFormat(time: string | null | undefined): SupportedTimeFormat {\n\t\treturn time?.length === 8 ? TIME_SECONDS_FORMAT : TIME_MINUTES_FORMAT;\n\t}\n\n\t/** Current time formatted per the provided time format */\n\tstatic timeNow(format: SupportedTimeFormat = TIME_SECONDS_FORMAT): string {\n\t\treturn dayjs().format(format);\n\t}\n\n\t/** Milliseconds since epoch for now */\n\tstatic nowMillis(): number {\n\t\treturn dayjs().valueOf();\n\t}\n\n\t/** Convert ISO date + time string into epoch milliseconds using provided time format */\n\tstatic toMillis(isoDate: string, time: string, timeFmt: SupportedTimeFormat): number | null {\n\t\tif (!isoDate || !time) return null;\n\t\tconst fmt = this.buildDateTimeFormat(ISO_DATE_FORMAT, timeFmt);\n\t\tconst dt = dayjs(`${isoDate} ${time}`, fmt);\n\t\treturn dt.isValid() ? dt.valueOf() : null;\n\t}\n\n\t/** Whether a given ISO date equals today (local) */\n\tstatic isTodayISO(isoDate: string): boolean {\n\t\treturn !!isoDate && isoDate === this.today();\n\t}\n\n\t/** End-of-day string for the given time format */\n\tstatic endOfDay(format: SupportedTimeFormat): string {\n\t\treturn format === TIME_SECONDS_FORMAT ? '23:59:59' : '23:59';\n\t}\n\n\t/** Start-of-day string for the given time format */\n\tstatic startOfDay(format: SupportedTimeFormat): string {\n\t\treturn format === TIME_SECONDS_FORMAT ? '00:00:00' : '00:00';\n\t}\n\n\t/** Checks if the provided time string represents end-of-day */\n\tstatic isEndOfDay(time: string | null | undefined): boolean {\n\t\treturn time === '23:59' || time === '23:59:59';\n\t}\n\n\t/**\n\t * Convert 24-hour time format to 12-hour format with AM/PM\n\t * @param time24h Time in HH:mm or HH:mm:ss format\n\t * @param includeSeconds Whether to include seconds in the output\n\t * @returns Time in 12-hour format (h:mm A or h:mm:ss A)\n\t */\n\tstatic to12HourFormat(time24h: string, includeSeconds: boolean = false): string {\n\t\tif (!time24h) return '';\n\n\t\t// Parse the time using dayjs\n\t\tconst timeFormat = includeSeconds ? TIME_SECONDS_FORMAT : TIME_MINUTES_FORMAT;\n\t\tconst timeObj = dayjs(`2000-01-01 ${time24h}`, `YYYY-MM-DD ${timeFormat}`);\n\n\t\tif (!timeObj.isValid()) return time24h;\n\n\t\tconst outputFormat = includeSeconds ? TIME_12H_SECONDS_FORMAT : TIME_12H_MINUTES_FORMAT;\n\t\treturn timeObj.format(outputFormat);\n\t}\n\n\t/**\n\t * Generate range value string for calendar components (ISO/ISO format)\n\t */\n\tstatic toRangeValue(range: DateRange | null): string {\n\t\tif (!range?.start || !range?.end) return '';\n\t\treturn `${range.start}/${range.end}`;\n\t}\n\n\t/**\n\t * Parse range value string from calendar components (ISO/ISO format)\n\t */\n\tstatic parseRangeValue(value: string): DateRange | null {\n\t\tif (!value?.includes('/')) return null;\n\t\tconst [start, end] = value.split('/');\n\t\tif (!start || !end) return null;\n\t\treturn { start, end };\n\t}\n\n\t/**\n\t * Generate quick range based on preset\n\t */\n\tstatic generateQuickRange(preset: QuickRangePreset): DateRange {\n\t\tconst today = dayjs();\n\t\tlet startDate: dayjs.Dayjs;\n\n\t\tswitch (preset) {\n\t\t\tcase 'last7Days':\n\t\t\t\tstartDate = today.subtract(6, 'day'); // inclusive of today => 7 days\n\t\t\t\tbreak;\n\t\t\tcase 'last30Days':\n\t\t\t\tstartDate = today.subtract(29, 'day');\n\t\t\t\tbreak;\n\t\t\tcase 'last6Months':\n\t\t\t\tstartDate = today.subtract(6, 'month');\n\t\t\t\tbreak;\n\t\t\tcase 'lastYear':\n\t\t\t\tstartDate = today.subtract(1, 'year');\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Unknown preset: ${preset}`);\n\t\t}\n\n\t\treturn {\n\t\t\tstart: startDate.format('YYYY-MM-DD'),\n\t\t\tend: today.format('YYYY-MM-DD'),\n\t\t};\n\t}\n\n\t/**\n\t * Generate a range representing the last N hours relative to now, including times.\n\t * Returns ISO date range plus HH:mm:ss start/end time strings.\n\t */\n\tstatic generateLastHoursRange(hours: number): { range: DateRange; startTime: string; endTime: string } {\n\t\tconst now = dayjs();\n\t\tconst start = now.subtract(hours, 'hour');\n\t\treturn {\n\t\t\trange: {\n\t\t\t\tstart: start.format('YYYY-MM-DD'),\n\t\t\t\tend: now.format('YYYY-MM-DD'),\n\t\t\t},\n\t\t\tstartTime: start.format('HH:mm:ss'),\n\t\t\tendTime: now.format('HH:mm:ss'),\n\t\t};\n\t}\n\n\t/**\n\t * Validate date range\n\t */\n\tstatic isValidRange(range: DateRange | null): boolean {\n\t\tif (!range?.start || !range?.end) return false;\n\t\treturn dayjs(range.start).isValid() && dayjs(range.end).isValid();\n\t}\n\n\t/**\n\t * Check if a date is valid\n\t */\n\tstatic isValidDate(date: string): boolean {\n\t\treturn dayjs(date).isValid();\n\t}\n\n\t/**\n\t * Get today's date in ISO format\n\t */\n\tstatic today(): string {\n\t\treturn dayjs().format('YYYY-MM-DD');\n\t}\n\n\t/**\n\t * Get yesterday's date in ISO format\n\t */\n\tstatic yesterday(): string {\n\t\treturn dayjs().subtract(1, 'day').format('YYYY-MM-DD');\n\t}\n\n\t/**\n\t * Get tomorrow's date in ISO format\n\t */\n\tstatic tomorrow(): string {\n\t\treturn dayjs().add(1, 'day').format('YYYY-MM-DD');\n\t}\n\n\t/**\n\t * Add/subtract time from a date\n\t */\n\tstatic addTime(date: string, amount: number, unit: dayjs.ManipulateType): string {\n\t\treturn dayjs(date).add(amount, unit).format('YYYY-MM-DD');\n\t}\n\n\t/**\n\t * Get difference between two dates\n\t */\n\tstatic diff(date1: string, date2: string, unit: dayjs.QUnitType = 'day'): number {\n\t\treturn dayjs(date1).diff(dayjs(date2), unit);\n\t}\n\n\t/**\n\t * Check if date is between two dates (inclusive)\n\t */\n\tstatic isBetween(date: string, start: string, end: string): boolean {\n\t\tconst dateObj = dayjs(date);\n\t\tconst startObj = dayjs(start);\n\t\tconst endObj = dayjs(end);\n\t\treturn (dateObj.isAfter(startObj) || dateObj.isSame(startObj)) && (dateObj.isBefore(endObj) || dateObj.isSame(endObj));\n\t}\n\n\t/**\n\t * Format date with custom pattern\n\t */\n\tstatic format(date: string, pattern: string): string {\n\t\treturn dayjs(date).format(pattern);\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAEA;;;AAGG;AACI,MAAM,sBAAsB,GAAG;AACrC,IAAA,YAAY;AACZ,IAAA,YAAY;AACZ,I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KAAK,CAAC,GAAG,CAAC;AACzB,QAAA,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvH;AAEA;;AAEG;AACH,IAAA,OAAO,MAAM,CAAC,IAAY,EAAE,OAAe,EAAA;QAC1C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;IACnC;AACA;;ACpRD;;AAEG;;;;"}
1
+ {"version":3,"file":"sixbell-telco-sdk-utils-date.mjs","sources":["../../../projects/sdk/utils/date/src/date-utils.ts","../../../projects/sdk/utils/date/sixbell-telco-sdk-utils-date.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\n\n// Strict custom-format parsing (`dayjs(date, format, true)`) needs this plugin; `extend` is idempotent.\ndayjs.extend(customParseFormat);\n\n/**\n * Supported display / parsing formats for date utilities.\n * Internally all calculations use ISO `YYYY-MM-DD` and convert to the chosen format for display.\n */\nexport const SUPPORTED_DATE_FORMATS = [\n\t'DD/MM/YYYY', // Day/Month/Year (European)\n\t'MM/DD/YYYY', // Month/Day/Year (US)\n\t'YYYY-MM-DD', // Year-Month-Day (ISO)\n\t'DD-MM-YYYY', // Day-Month-Year (European with dashes)\n\t'MM-DD-YYYY', // Month-Day-Year (US with dashes)\n\t'YYYY/MM/DD', // Year/Month/Day (ISO with slashes)\n\t'DD.MM.YYYY', // Day.Month.Year (German style)\n\t'MM.DD.YYYY', // Month.Day.Year (US with dots)\n\t'YYYY.MM.DD', // Year.Month.Day (ISO with dots)\n] as const;\n\n/** Union type of all supported format strings. */\nexport type SupportedDateFormat = (typeof SUPPORTED_DATE_FORMATS)[number];\n\n/**\n * Supported time-only formats\n */\nexport const SUPPORTED_TIME_FORMATS = ['HH:mm', 'HH:mm:ss'] as const;\nexport type SupportedTimeFormat = (typeof SUPPORTED_TIME_FORMATS)[number];\n\n// Commonly used format constants\nexport const ISO_DATE_FORMAT: SupportedDateFormat = 'YYYY-MM-DD';\nexport const TIME_MINUTES_FORMAT: SupportedTimeFormat = 'HH:mm';\nexport const TIME_SECONDS_FORMAT: SupportedTimeFormat = 'HH:mm:ss';\n\n// 12-hour time format constants\nexport const TIME_12H_MINUTES_FORMAT = 'h:mm A';\nexport const TIME_12H_SECONDS_FORMAT = 'h:mm:ss A';\n\n// Application-wide default UI date display format\n\n/**\n * Quick action types for range picker\n */\nexport type QuickRangePreset = 'last7Days' | 'last30Days' | 'last6Months' | 'lastYear';\n\n/**\n * Date range representation\n */\nexport interface DateRange {\n\tstart: string;\n\tend: string;\n}\n\n/** True when `date` has the digit groups and separators of `format` (`MM/DD/YYYY` fits `02/31/2024`). */\nfunction fitsFormatShape(date: string, format: SupportedDateFormat): boolean {\n\tconst shape = format.replace('YYYY', '9999').replace(/MM|DD/g, '99');\n\treturn date.replace(/\\d/g, '9') === shape;\n}\n\n/**\n * Reusable date utility service for date operations across the SDK.\n * Provides consistent date handling, formatting, and range operations.\n */\nexport class DateUtils {\n\t/**\n\t * Convert a date string to ISO format (YYYY-MM-DD)\n\t */\n\tstatic toISODate(date: string, format?: SupportedDateFormat): string {\n\t\tif (!date) return '';\n\t\t// If already ISO, return as-is to avoid misparsing when a display format is provided\n\t\tif (/^\\d{4}-\\d{2}-\\d{2}$/.test(date)) return dayjs(date, ISO_DATE_FORMAT, true).format('YYYY-MM-DD');\n\t\tif (format && format !== 'YYYY-MM-DD') {\n\t\t\tconst parsed = dayjs(date, format, true);\n\t\t\tif (parsed.isValid()) return parsed.format('YYYY-MM-DD');\n\t\t\t// Shaped like the format but not a real date (02/31/2024): invalid, never rolled into the next month.\n\t\t\tif (fitsFormatShape(date, format)) return parsed.format('YYYY-MM-DD');\n\t\t\treturn dayjs(date).format('YYYY-MM-DD');\n\t\t}\n\t\treturn dayjs(date).format('YYYY-MM-DD');\n\t}\n\n\t/**\n\t * Convert ISO date to display format\n\t */\n\tstatic toDisplayDate(isoDate: string, format: SupportedDateFormat): string {\n\t\tif (!isoDate) return '';\n\t\treturn dayjs(isoDate).format(format);\n\t}\n\n\t/** Build a combined date-time format string, e.g. `YYYY-MM-DD HH:mm:ss` */\n\tstatic buildDateTimeFormat(dateFmt: SupportedDateFormat, timeFmt: SupportedTimeFormat): string {\n\t\treturn `${dateFmt} ${timeFmt}`;\n\t}\n\n\t/** Infer time format from a time string (returns seconds precision if length is 8) */\n\tstatic inferTimeFormat(time: string | null | undefined): SupportedTimeFormat {\n\t\treturn time?.length === 8 ? TIME_SECONDS_FORMAT : TIME_MINUTES_FORMAT;\n\t}\n\n\t/** Current time formatted per the provided time format */\n\tstatic timeNow(format: SupportedTimeFormat = TIME_SECONDS_FORMAT): string {\n\t\treturn dayjs().format(format);\n\t}\n\n\t/** Milliseconds since epoch for now */\n\tstatic nowMillis(): number {\n\t\treturn dayjs().valueOf();\n\t}\n\n\t/** Convert ISO date + time string into epoch milliseconds using provided time format */\n\tstatic toMillis(isoDate: string, time: string, timeFmt: SupportedTimeFormat): number | null {\n\t\tif (!isoDate || !time) return null;\n\t\tconst fmt = this.buildDateTimeFormat(ISO_DATE_FORMAT, timeFmt);\n\t\tconst dt = dayjs(`${isoDate} ${time}`, fmt);\n\t\treturn dt.isValid() ? dt.valueOf() : null;\n\t}\n\n\t/** Whether a given ISO date equals today (local) */\n\tstatic isTodayISO(isoDate: string): boolean {\n\t\treturn !!isoDate && isoDate === this.today();\n\t}\n\n\t/** End-of-day string for the given time format */\n\tstatic endOfDay(format: SupportedTimeFormat): string {\n\t\treturn format === TIME_SECONDS_FORMAT ? '23:59:59' : '23:59';\n\t}\n\n\t/** Start-of-day string for the given time format */\n\tstatic startOfDay(format: SupportedTimeFormat): string {\n\t\treturn format === TIME_SECONDS_FORMAT ? '00:00:00' : '00:00';\n\t}\n\n\t/** Checks if the provided time string represents end-of-day */\n\tstatic isEndOfDay(time: string | null | undefined): boolean {\n\t\treturn time === '23:59' || time === '23:59:59';\n\t}\n\n\t/**\n\t * Convert 24-hour time format to 12-hour format with AM/PM\n\t * @param time24h Time in HH:mm or HH:mm:ss format\n\t * @param includeSeconds Whether to include seconds in the output\n\t * @returns Time in 12-hour format (h:mm A or h:mm:ss A)\n\t */\n\tstatic to12HourFormat(time24h: string, includeSeconds: boolean = false): string {\n\t\tif (!time24h) return '';\n\n\t\t// Parse the time using dayjs\n\t\tconst timeFormat = includeSeconds ? TIME_SECONDS_FORMAT : TIME_MINUTES_FORMAT;\n\t\tconst timeObj = dayjs(`2000-01-01 ${time24h}`, `YYYY-MM-DD ${timeFormat}`);\n\n\t\tif (!timeObj.isValid()) return time24h;\n\n\t\tconst outputFormat = includeSeconds ? TIME_12H_SECONDS_FORMAT : TIME_12H_MINUTES_FORMAT;\n\t\treturn timeObj.format(outputFormat);\n\t}\n\n\t/**\n\t * Generate range value string for calendar components (ISO/ISO format)\n\t */\n\tstatic toRangeValue(range: DateRange | null): string {\n\t\tif (!range?.start || !range?.end) return '';\n\t\treturn `${range.start}/${range.end}`;\n\t}\n\n\t/**\n\t * Parse range value string from calendar components (ISO/ISO format)\n\t */\n\tstatic parseRangeValue(value: string): DateRange | null {\n\t\tif (!value?.includes('/')) return null;\n\t\tconst [start, end] = value.split('/');\n\t\tif (!start || !end) return null;\n\t\treturn { start, end };\n\t}\n\n\t/**\n\t * Generate quick range based on preset\n\t */\n\tstatic generateQuickRange(preset: QuickRangePreset): DateRange {\n\t\tconst today = dayjs();\n\t\tlet startDate: dayjs.Dayjs;\n\n\t\tswitch (preset) {\n\t\t\tcase 'last7Days':\n\t\t\t\tstartDate = today.subtract(6, 'day'); // inclusive of today => 7 days\n\t\t\t\tbreak;\n\t\t\tcase 'last30Days':\n\t\t\t\tstartDate = today.subtract(29, 'day');\n\t\t\t\tbreak;\n\t\t\tcase 'last6Months':\n\t\t\t\tstartDate = today.subtract(6, 'month');\n\t\t\t\tbreak;\n\t\t\tcase 'lastYear':\n\t\t\t\tstartDate = today.subtract(1, 'year');\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Unknown preset: ${preset}`);\n\t\t}\n\n\t\treturn {\n\t\t\tstart: startDate.format('YYYY-MM-DD'),\n\t\t\tend: today.format('YYYY-MM-DD'),\n\t\t};\n\t}\n\n\t/**\n\t * Generate a range representing the last N hours relative to now, including times.\n\t * Returns ISO date range plus HH:mm:ss start/end time strings.\n\t */\n\tstatic generateLastHoursRange(hours: number): { range: DateRange; startTime: string; endTime: string } {\n\t\tconst now = dayjs();\n\t\tconst start = now.subtract(hours, 'hour');\n\t\treturn {\n\t\t\trange: {\n\t\t\t\tstart: start.format('YYYY-MM-DD'),\n\t\t\t\tend: now.format('YYYY-MM-DD'),\n\t\t\t},\n\t\t\tstartTime: start.format('HH:mm:ss'),\n\t\t\tendTime: now.format('HH:mm:ss'),\n\t\t};\n\t}\n\n\t/**\n\t * Validate date range\n\t */\n\tstatic isValidRange(range: DateRange | null): boolean {\n\t\tif (!range?.start || !range?.end) return false;\n\t\treturn dayjs(range.start).isValid() && dayjs(range.end).isValid();\n\t}\n\n\t/**\n\t * Check if a date is valid\n\t */\n\tstatic isValidDate(date: string): boolean {\n\t\treturn dayjs(date).isValid();\n\t}\n\n\t/**\n\t * Get today's date in ISO format\n\t */\n\tstatic today(): string {\n\t\treturn dayjs().format('YYYY-MM-DD');\n\t}\n\n\t/**\n\t * Get yesterday's date in ISO format\n\t */\n\tstatic yesterday(): string {\n\t\treturn dayjs().subtract(1, 'day').format('YYYY-MM-DD');\n\t}\n\n\t/**\n\t * Get tomorrow's date in ISO format\n\t */\n\tstatic tomorrow(): string {\n\t\treturn dayjs().add(1, 'day').format('YYYY-MM-DD');\n\t}\n\n\t/**\n\t * Add/subtract time from a date\n\t */\n\tstatic addTime(date: string, amount: number, unit: dayjs.ManipulateType): string {\n\t\treturn dayjs(date).add(amount, unit).format('YYYY-MM-DD');\n\t}\n\n\t/**\n\t * Get difference between two dates\n\t */\n\tstatic diff(date1: string, date2: string, unit: dayjs.QUnitType = 'day'): number {\n\t\treturn dayjs(date1).diff(dayjs(date2), unit);\n\t}\n\n\t/**\n\t * Check if date is between two dates (inclusive)\n\t */\n\tstatic isBetween(date: string, start: string, end: string): boolean {\n\t\tconst dateObj = dayjs(date);\n\t\tconst startObj = dayjs(start);\n\t\tconst endObj = dayjs(end);\n\t\treturn (dateObj.isAfter(startObj) || dateObj.isSame(startObj)) && (dateObj.isBefore(endObj) || dateObj.isSame(endObj));\n\t}\n\n\t/**\n\t * Format date with custom pattern\n\t */\n\tstatic format(date: string, pattern: string): string {\n\t\treturn dayjs(date).format(pattern);\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAGA;AACA,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC;AAE/B;;;AAGG;AACI,MAAM,sBAAsB,GAAG;AACrC,IAAA,YAAY;AACZ,IAAA,YAAY;AACZ,IAAA,YAAY;AACZ,IAAA,YAAY;AACZ,IAAA,YAAY;AACZ,IAAA,YAAY;AACZ,IAAA,YAAY;AACZ,IAAA,YAAY;AACZ,IAAA,YAAY;;AAMb;;AAEG;MACU,sBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU;AAG1D;AACO,MAAM,eAAe,GAAwB;AAC7C,MAAM,mBAAmB,GAAwB;AACjD,MAAM,mBAAmB,GAAwB;AAExD;AACO,MAAM,uBAAuB,GAAG;AAChC,MAAM,uBAAuB,GAAG;AAiBvC;AACA,SAAS,eAAe,CAAC,IAAY,EAAE,MAA2B,EAAA;AACjE,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;IACpE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,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CAAC,QAAQ,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvH;AAEA;;AAEG;AACH,IAAA,OAAO,MAAM,CAAC,IAAY,EAAE,OAAe,EAAA;QAC1C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;IACnC;AACA;;ACjSD;;AAEG;;;;"}
@@ -1,7 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, signal, Injectable, inject, ElementRef, DestroyRef, computed, afterNextRender, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
2
+ import { InjectionToken, signal, Injectable, inject, ElementRef, DestroyRef, computed, afterNextRender, isDevMode, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
3
3
  import { DOCUMENT } from '@angular/common';
4
4
  import { RouterOutlet } from '@angular/router';
5
+ import { LoggerService } from '@sixbell-telco/sdk/utils/logger';
5
6
  import { Dialog } from '@angular/cdk/dialog';
6
7
  import { OverlayContainer, Overlay } from '@angular/cdk/overlay';
7
8
 
@@ -16,6 +17,79 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
16
17
  type: Injectable
17
18
  }] });
18
19
 
20
+ const PROPERTIES_ATTRIBUTE = 'data-st-mfe-properties';
21
+ const PROPERTY_NAME = /^@property\s+(--[^\s{]+)/;
22
+ function collectPropertyRules(rules, into) {
23
+ for (const rule of Array.from(rules)) {
24
+ if (rule.cssText.startsWith('@property'))
25
+ into.push(rule.cssText);
26
+ else if ('cssRules' in rule)
27
+ collectPropertyRules(rule.cssRules, into);
28
+ }
29
+ }
30
+ function propertyName(rule) {
31
+ return PROPERTY_NAME.exec(rule)?.[1] ?? null;
32
+ }
33
+ /** Names of the custom properties the document already registers with `@property`, readable sheets only. */
34
+ function documentPropertyNames(document) {
35
+ const names = new Set();
36
+ for (const sheet of Array.from(document.styleSheets)) {
37
+ const rules = [];
38
+ try {
39
+ collectPropertyRules(sheet.cssRules, rules);
40
+ }
41
+ catch {
42
+ continue;
43
+ }
44
+ rules.forEach((rule) => names.add(propertyName(rule) ?? ''));
45
+ }
46
+ for (const style of Array.from(document.head?.querySelectorAll(`style[${PROPERTIES_ATTRIBUTE}]`) ?? [])) {
47
+ for (const match of (style.textContent ?? '').matchAll(/@property\s+(--[^\s{]+)/g))
48
+ names.add(match[1]);
49
+ }
50
+ names.delete('');
51
+ return names;
52
+ }
53
+ /**
54
+ * Registers a child stylesheet's `@property` rules at document level, once per `source`.
55
+ *
56
+ * Browsers ignore `@property` inside a shadow root, and Tailwind v4 relies on it for the initial values of
57
+ * `--tw-*` variables (`border`, `shadow-*`, `ring-*`, `translate-*`, gradients...). Registration is global
58
+ * and the first one wins, so properties the document already registers are skipped: a child built with a
59
+ * different Tailwind version never changes the host's initial values.
60
+ *
61
+ * Returns `'unreadable'` when the sheet's rules cannot be read (a cross-origin sheet served without CORS).
62
+ */
63
+ function hoistMfePropertyRules(sheet, source, document) {
64
+ if (!document.head || !sheet)
65
+ return 'nothing-to-hoist';
66
+ const hoisted = Array.from(document.head.querySelectorAll(`style[${PROPERTIES_ATTRIBUTE}]`));
67
+ if (hoisted.some((style) => style.getAttribute(PROPERTIES_ATTRIBUTE) === source))
68
+ return 'already-hoisted';
69
+ const rules = [];
70
+ try {
71
+ collectPropertyRules(sheet.cssRules, rules);
72
+ }
73
+ catch {
74
+ return 'unreadable';
75
+ }
76
+ const registered = documentPropertyNames(document);
77
+ const missing = rules.filter((rule) => {
78
+ const name = propertyName(rule);
79
+ if (!name || registered.has(name))
80
+ return false;
81
+ registered.add(name);
82
+ return true;
83
+ });
84
+ if (!missing.length)
85
+ return 'nothing-to-hoist';
86
+ const style = document.createElement('style');
87
+ style.setAttribute(PROPERTIES_ATTRIBUTE, source);
88
+ style.textContent = missing.join('\n');
89
+ document.head.append(style);
90
+ return 'hoisted';
91
+ }
92
+
19
93
  /**
20
94
  * CDK overlay container that renders inside the federated child's shadow root, so the child's
21
95
  * compiled stylesheet styles its dialogs, menus and popovers. Without a registered shell (the
@@ -101,6 +175,7 @@ const STYLES_ATTRIBUTE = 'data-st-mfe-styles';
101
175
  * Route component that mounts a federated child inside its own shadow root: it attaches the child's
102
176
  * compiled stylesheet there, hides the content until it loads (no unstyled flash), and registers the
103
177
  * shadow root so CDK overlays opened by the child render inside it. Theme tokens inherit from the host.
178
+ * Its Tailwind `@property` registrations the document lacks are hoisted to it, where browsers honour them.
104
179
  * Configure it with `provideMfeShadowShell` on the same route.
105
180
  */
106
181
  class MfeShadowShellComponent {
@@ -109,6 +184,7 @@ class MfeShadowShellComponent {
109
184
  document = inject(DOCUMENT);
110
185
  host = inject(ElementRef).nativeElement;
111
186
  destroyRef = inject(DestroyRef);
187
+ logger = inject(LoggerService);
112
188
  stylesReady = signal(false);
113
189
  visibility = computed(() => (this.stylesReady() ? 'visible' : 'hidden'));
114
190
  constructor() {
@@ -127,13 +203,22 @@ class MfeShadowShellComponent {
127
203
  link.rel = 'stylesheet';
128
204
  link.setAttribute(STYLES_ATTRIBUTE, '');
129
205
  const reveal = () => this.stylesReady.set(true);
130
- link.addEventListener('load', reveal, { once: true });
206
+ link.addEventListener('load', () => {
207
+ this.hoistPropertyRules(link);
208
+ reveal();
209
+ }, { once: true });
131
210
  link.addEventListener('error', reveal, { once: true });
132
211
  const timer = setTimeout(reveal, this.config.revealTimeoutMs ?? 1500);
133
212
  this.destroyRef.onDestroy(() => clearTimeout(timer));
134
213
  link.href = await mfeStylesheetHref(this.config);
135
214
  shadowRoot.prepend(link);
136
215
  }
216
+ hoistPropertyRules(link) {
217
+ const href = link.getAttribute('href') ?? '';
218
+ if (hoistMfePropertyRules(link.sheet, href, this.document) !== 'unreadable' || !isDevMode())
219
+ return;
220
+ this.logger.warn(`MFE shadow shell: cannot read the rules of ${href} (cross-origin without CORS?), so its @property rules were not hoisted and Tailwind border, shadow, ring and translate utilities may not resolve. Serve it with CORS or from the host origin.`, { component: 'MfeShadowShellComponent', href });
221
+ }
137
222
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: MfeShadowShellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
138
223
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: MfeShadowShellComponent, isStandalone: true, selector: "st-mfe-shadow-shell", ngImport: i0, template: '<div [style.visibility]="visibility()"><router-outlet /></div>', isInline: true, styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
139
224
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sixbell-telco-sdk-utils-mfe.mjs","sources":["../../../projects/sdk/utils/mfe/src/mfe-shadow-root.ts","../../../projects/sdk/utils/mfe/src/shadow-root-overlay-container.ts","../../../projects/sdk/utils/mfe/src/provide-mfe-shadow-shell.ts","../../../projects/sdk/utils/mfe/src/mfe-shadow-shell.component.ts","../../../projects/sdk/utils/mfe/sixbell-telco-sdk-utils-mfe.ts"],"sourcesContent":["import { Injectable, InjectionToken, signal } from '@angular/core';\n\n/** Where a federated child MFE serves its compiled stylesheet. */\nexport interface MfeShadowShellConfig {\n\t/** Public path the host mounts the child under, with a trailing slash (e.g. `/mfe-aux-tables/`). */\n\tbasePath: string;\n\t/**\n\t * Module (relative to `basePath`) whose export holds the hashed stylesheet href written after the build.\n\t * Defaults to `assets/stylesheet-href.js`.\n\t */\n\tstylesheetHrefModule?: string;\n\t/** Export name read from `stylesheetHrefModule`. Defaults to `stylesheetHref`. */\n\tstylesheetHrefExport?: string;\n\t/** Reveal the content after this delay even if the stylesheet never answers. Defaults to 1500 ms. */\n\trevealTimeoutMs?: number;\n}\n\nexport const MFE_SHADOW_SHELL_CONFIG = new InjectionToken<MfeShadowShellConfig>('MFE_SHADOW_SHELL_CONFIG');\n\n/** Route-scoped registry of the shell's shadow root, so overlays opened by the child render inside it. */\n@Injectable()\nexport class MfeShadowRoot {\n\treadonly root = signal<ShadowRoot | null>(null);\n}\n","import { OverlayContainer } from '@angular/cdk/overlay';\nimport { Injectable, inject } from '@angular/core';\nimport { MfeShadowRoot } from './mfe-shadow-root';\n\n/**\n * CDK overlay container that renders inside the federated child's shadow root, so the child's\n * compiled stylesheet styles its dialogs, menus and popovers. Without a registered shell (the\n * standalone dev harness) it stays on the document body, where the styles are global.\n */\n@Injectable()\nexport class ShadowRootOverlayContainer extends OverlayContainer {\n\tprivate readonly shell = inject(MfeShadowRoot, { optional: true });\n\n\toverride getContainerElement(): HTMLElement {\n\t\tconst container = super.getContainerElement();\n\t\tconst shadowRoot = this.shell?.root();\n\t\tif (shadowRoot && container.parentNode !== shadowRoot) {\n\t\t\tshadowRoot.appendChild(container);\n\t\t}\n\t\treturn container;\n\t}\n}\n","import { Dialog } from '@angular/cdk/dialog';\nimport { Overlay, OverlayContainer } from '@angular/cdk/overlay';\nimport { Provider } from '@angular/core';\nimport { MFE_SHADOW_SHELL_CONFIG, MfeShadowRoot, MfeShadowShellConfig } from './mfe-shadow-root';\nimport { ShadowRootOverlayContainer } from './shadow-root-overlay-container';\n\ntype StylesheetModuleImporter = (url: string) => Promise<Record<string, unknown>>;\n\nconst importModule: StylesheetModuleImporter = (url) => import(/* @vite-ignore */ /* webpackIgnore: true */ url);\nconst hrefCache = new Map<string, Promise<string>>();\nconst PRELOAD_ATTRIBUTE = 'data-st-mfe-styles-preload';\n\n/**\n * Resolves the child's compiled stylesheet href: the hashed name written after the build, read from\n * `stylesheetHrefModule`, or `<basePath>styles.css` when that module is missing.\n */\nexport async function resolveMfeStylesheetHref(config: MfeShadowShellConfig, importer: StylesheetModuleImporter = importModule): Promise<string> {\n\tconst fallback = `${config.basePath}styles.css`;\n\ttry {\n\t\tconst module = await importer(`${config.basePath}${config.stylesheetHrefModule ?? 'assets/stylesheet-href.js'}?v=${Date.now()}`);\n\t\tconst href = module[config.stylesheetHrefExport ?? 'stylesheetHref'];\n\t\treturn typeof href === 'string' && href ? href : fallback;\n\t} catch {\n\t\treturn fallback;\n\t}\n}\n\n/** One resolution per child per page load; also preloads the stylesheet in the document head. */\nexport function mfeStylesheetHref(config: MfeShadowShellConfig): Promise<string> {\n\tlet href = hrefCache.get(config.basePath);\n\tif (!href) {\n\t\thref = resolveMfeStylesheetHref(config);\n\t\threfCache.set(config.basePath, href);\n\t\tvoid href.then(preloadStylesheet);\n\t}\n\treturn href;\n}\n\nfunction preloadStylesheet(href: string): void {\n\tconst head = globalThis.document?.head;\n\tif (!head || head.querySelector(`link[${PRELOAD_ATTRIBUTE}][href=\"${href}\"]`)) return;\n\tconst preload = globalThis.document.createElement('link');\n\tpreload.rel = 'preload';\n\tpreload.as = 'style';\n\tpreload.href = href;\n\tpreload.setAttribute(PRELOAD_ATTRIBUTE, '');\n\thead.append(preload);\n}\n\n/**\n * Route providers for a federated child mounted through `MfeShadowShellComponent`: the shell config,\n * the shadow-root registry, and CDK Overlay/Dialog scoped to the route so overlays open inside it.\n *\n * ```ts\n * { path: '', component: MfeShadowShellComponent, providers: provideMfeShadowShell({ basePath: '/mfe-aux-tables/' }), children }\n * ```\n */\nexport function provideMfeShadowShell(config: MfeShadowShellConfig): Provider[] {\n\tvoid mfeStylesheetHref(config);\n\treturn [\n\t\t{ provide: MFE_SHADOW_SHELL_CONFIG, useValue: config },\n\t\tMfeShadowRoot,\n\t\t{ provide: OverlayContainer, useClass: ShadowRootOverlayContainer },\n\t\t{ provide: Overlay, useClass: Overlay },\n\t\t{ provide: Dialog, useClass: Dialog },\n\t];\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n\tChangeDetectionStrategy,\n\tComponent,\n\tDestroyRef,\n\tElementRef,\n\tViewEncapsulation,\n\tafterNextRender,\n\tcomputed,\n\tinject,\n\tsignal,\n} from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\nimport { MFE_SHADOW_SHELL_CONFIG, MfeShadowRoot } from './mfe-shadow-root';\nimport { mfeStylesheetHref } from './provide-mfe-shadow-shell';\n\nconst STYLES_ATTRIBUTE = 'data-st-mfe-styles';\n\n/**\n * Route component that mounts a federated child inside its own shadow root: it attaches the child's\n * compiled stylesheet there, hides the content until it loads (no unstyled flash), and registers the\n * shadow root so CDK overlays opened by the child render inside it. Theme tokens inherit from the host.\n * Configure it with `provideMfeShadowShell` on the same route.\n */\n@Component({\n\tselector: 'st-mfe-shadow-shell',\n\timports: [RouterOutlet],\n\ttemplate: '<div [style.visibility]=\"visibility()\"><router-outlet /></div>',\n\tstyles: ':host { display: block; }',\n\tencapsulation: ViewEncapsulation.ShadowDom,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MfeShadowShellComponent {\n\tprivate readonly config = inject(MFE_SHADOW_SHELL_CONFIG);\n\tprivate readonly registry = inject(MfeShadowRoot);\n\tprivate readonly document = inject(DOCUMENT);\n\tprivate readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\tprivate readonly destroyRef = inject(DestroyRef);\n\tprivate readonly stylesReady = signal(false);\n\n\tprotected readonly visibility = computed(() => (this.stylesReady() ? 'visible' : 'hidden'));\n\n\tconstructor() {\n\t\tconst shadowRoot = this.host.shadowRoot;\n\t\tif (shadowRoot) this.registry.root.set(shadowRoot);\n\t\tthis.destroyRef.onDestroy(() => this.registry.root.set(null));\n\t\tafterNextRender(() => void this.attachStylesheet(shadowRoot));\n\t}\n\n\tprivate async attachStylesheet(shadowRoot: ShadowRoot | null): Promise<void> {\n\t\tif (!shadowRoot || shadowRoot.querySelector(`link[${STYLES_ATTRIBUTE}]`)) {\n\t\t\tthis.stylesReady.set(true);\n\t\t\treturn;\n\t\t}\n\t\tconst link = this.document.createElement('link');\n\t\tlink.rel = 'stylesheet';\n\t\tlink.setAttribute(STYLES_ATTRIBUTE, '');\n\t\tconst reveal = () => this.stylesReady.set(true);\n\t\tlink.addEventListener('load', reveal, { once: true });\n\t\tlink.addEventListener('error', reveal, { once: true });\n\t\tconst timer = setTimeout(reveal, this.config.revealTimeoutMs ?? 1500);\n\t\tthis.destroyRef.onDestroy(() => clearTimeout(timer));\n\t\tlink.href = await mfeStylesheetHref(this.config);\n\t\tshadowRoot.prepend(link);\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAiBa,uBAAuB,GAAG,IAAI,cAAc,CAAuB,yBAAyB;AAEzG;MAEa,aAAa,CAAA;AAChB,IAAA,IAAI,GAAG,MAAM,CAAoB,IAAI,CAAC;wGADnC,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;4GAAb,aAAa,EAAA,CAAA;;4FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB;;;AChBD;;;;AAIG;AAEG,MAAO,0BAA2B,SAAQ,gBAAgB,CAAA;IAC9C,KAAK,GAAG,MAAM,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAEzD,mBAAmB,GAAA;AAC3B,QAAA,MAAM,SAAS,GAAG,KAAK,CAAC,mBAAmB,EAAE;QAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE;QACrC,IAAI,UAAU,IAAI,SAAS,CAAC,UAAU,KAAK,UAAU,EAAE;AACtD,YAAA,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC;QAClC;AACA,QAAA,OAAO,SAAS;IACjB;wGAVY,0BAA0B,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;4GAA1B,0BAA0B,EAAA,CAAA;;4FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC;;;AC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":["../../../projects/sdk/utils/mfe/src/mfe-shadow-root.ts","../../../projects/sdk/utils/mfe/src/hoist-property-rules.ts","../../../projects/sdk/utils/mfe/src/shadow-root-overlay-container.ts","../../../projects/sdk/utils/mfe/src/provide-mfe-shadow-shell.ts","../../../projects/sdk/utils/mfe/src/mfe-shadow-shell.component.ts","../../../projects/sdk/utils/mfe/sixbell-telco-sdk-utils-mfe.ts"],"sourcesContent":["import { Injectable, InjectionToken, signal } from '@angular/core';\n\n/** Where a federated child MFE serves its compiled stylesheet. */\nexport interface MfeShadowShellConfig {\n\t/** Public path the host mounts the child under, with a trailing slash (e.g. `/mfe-aux-tables/`). */\n\tbasePath: string;\n\t/**\n\t * Module (relative to `basePath`) whose export holds the hashed stylesheet href written after the build.\n\t * Defaults to `assets/stylesheet-href.js`.\n\t */\n\tstylesheetHrefModule?: string;\n\t/** Export name read from `stylesheetHrefModule`. Defaults to `stylesheetHref`. */\n\tstylesheetHrefExport?: string;\n\t/** Reveal the content after this delay even if the stylesheet never answers. Defaults to 1500 ms. */\n\trevealTimeoutMs?: number;\n}\n\nexport const MFE_SHADOW_SHELL_CONFIG = new InjectionToken<MfeShadowShellConfig>('MFE_SHADOW_SHELL_CONFIG');\n\n/** Route-scoped registry of the shell's shadow root, so overlays opened by the child render inside it. */\n@Injectable()\nexport class MfeShadowRoot {\n\treadonly root = signal<ShadowRoot | null>(null);\n}\n","const PROPERTIES_ATTRIBUTE = 'data-st-mfe-properties';\nconst PROPERTY_NAME = /^@property\\s+(--[^\\s{]+)/;\n\n/** Outcome of {@link hoistMfePropertyRules}. */\nexport type MfePropertyHoistResult = 'hoisted' | 'nothing-to-hoist' | 'already-hoisted' | 'unreadable';\n\nfunction collectPropertyRules(rules: CSSRuleList, into: string[]): void {\n\tfor (const rule of Array.from(rules)) {\n\t\tif (rule.cssText.startsWith('@property')) into.push(rule.cssText);\n\t\telse if ('cssRules' in rule) collectPropertyRules((rule as CSSGroupingRule).cssRules, into);\n\t}\n}\n\nfunction propertyName(rule: string): string | null {\n\treturn PROPERTY_NAME.exec(rule)?.[1] ?? null;\n}\n\n/** Names of the custom properties the document already registers with `@property`, readable sheets only. */\nfunction documentPropertyNames(document: Document): Set<string> {\n\tconst names = new Set<string>();\n\tfor (const sheet of Array.from(document.styleSheets)) {\n\t\tconst rules: string[] = [];\n\t\ttry {\n\t\t\tcollectPropertyRules(sheet.cssRules, rules);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\trules.forEach((rule) => names.add(propertyName(rule) ?? ''));\n\t}\n\tfor (const style of Array.from(document.head?.querySelectorAll(`style[${PROPERTIES_ATTRIBUTE}]`) ?? [])) {\n\t\tfor (const match of (style.textContent ?? '').matchAll(/@property\\s+(--[^\\s{]+)/g)) names.add(match[1]);\n\t}\n\tnames.delete('');\n\treturn names;\n}\n\n/**\n * Registers a child stylesheet's `@property` rules at document level, once per `source`.\n *\n * Browsers ignore `@property` inside a shadow root, and Tailwind v4 relies on it for the initial values of\n * `--tw-*` variables (`border`, `shadow-*`, `ring-*`, `translate-*`, gradients...). Registration is global\n * and the first one wins, so properties the document already registers are skipped: a child built with a\n * different Tailwind version never changes the host's initial values.\n *\n * Returns `'unreadable'` when the sheet's rules cannot be read (a cross-origin sheet served without CORS).\n */\nexport function hoistMfePropertyRules(sheet: CSSStyleSheet | null, source: string, document: Document): MfePropertyHoistResult {\n\tif (!document.head || !sheet) return 'nothing-to-hoist';\n\tconst hoisted = Array.from(document.head.querySelectorAll(`style[${PROPERTIES_ATTRIBUTE}]`));\n\tif (hoisted.some((style) => style.getAttribute(PROPERTIES_ATTRIBUTE) === source)) return 'already-hoisted';\n\tconst rules: string[] = [];\n\ttry {\n\t\tcollectPropertyRules(sheet.cssRules, rules);\n\t} catch {\n\t\treturn 'unreadable';\n\t}\n\tconst registered = documentPropertyNames(document);\n\tconst missing = rules.filter((rule) => {\n\t\tconst name = propertyName(rule);\n\t\tif (!name || registered.has(name)) return false;\n\t\tregistered.add(name);\n\t\treturn true;\n\t});\n\tif (!missing.length) return 'nothing-to-hoist';\n\tconst style = document.createElement('style');\n\tstyle.setAttribute(PROPERTIES_ATTRIBUTE, source);\n\tstyle.textContent = missing.join('\\n');\n\tdocument.head.append(style);\n\treturn 'hoisted';\n}\n","import { OverlayContainer } from '@angular/cdk/overlay';\nimport { Injectable, inject } from '@angular/core';\nimport { MfeShadowRoot } from './mfe-shadow-root';\n\n/**\n * CDK overlay container that renders inside the federated child's shadow root, so the child's\n * compiled stylesheet styles its dialogs, menus and popovers. Without a registered shell (the\n * standalone dev harness) it stays on the document body, where the styles are global.\n */\n@Injectable()\nexport class ShadowRootOverlayContainer extends OverlayContainer {\n\tprivate readonly shell = inject(MfeShadowRoot, { optional: true });\n\n\toverride getContainerElement(): HTMLElement {\n\t\tconst container = super.getContainerElement();\n\t\tconst shadowRoot = this.shell?.root();\n\t\tif (shadowRoot && container.parentNode !== shadowRoot) {\n\t\t\tshadowRoot.appendChild(container);\n\t\t}\n\t\treturn container;\n\t}\n}\n","import { Dialog } from '@angular/cdk/dialog';\nimport { Overlay, OverlayContainer } from '@angular/cdk/overlay';\nimport { Provider } from '@angular/core';\nimport { MFE_SHADOW_SHELL_CONFIG, MfeShadowRoot, MfeShadowShellConfig } from './mfe-shadow-root';\nimport { ShadowRootOverlayContainer } from './shadow-root-overlay-container';\n\ntype StylesheetModuleImporter = (url: string) => Promise<Record<string, unknown>>;\n\nconst importModule: StylesheetModuleImporter = (url) => import(/* @vite-ignore */ /* webpackIgnore: true */ url);\nconst hrefCache = new Map<string, Promise<string>>();\nconst PRELOAD_ATTRIBUTE = 'data-st-mfe-styles-preload';\n\n/**\n * Resolves the child's compiled stylesheet href: the hashed name written after the build, read from\n * `stylesheetHrefModule`, or `<basePath>styles.css` when that module is missing.\n */\nexport async function resolveMfeStylesheetHref(config: MfeShadowShellConfig, importer: StylesheetModuleImporter = importModule): Promise<string> {\n\tconst fallback = `${config.basePath}styles.css`;\n\ttry {\n\t\tconst module = await importer(`${config.basePath}${config.stylesheetHrefModule ?? 'assets/stylesheet-href.js'}?v=${Date.now()}`);\n\t\tconst href = module[config.stylesheetHrefExport ?? 'stylesheetHref'];\n\t\treturn typeof href === 'string' && href ? href : fallback;\n\t} catch {\n\t\treturn fallback;\n\t}\n}\n\n/** One resolution per child per page load; also preloads the stylesheet in the document head. */\nexport function mfeStylesheetHref(config: MfeShadowShellConfig): Promise<string> {\n\tlet href = hrefCache.get(config.basePath);\n\tif (!href) {\n\t\thref = resolveMfeStylesheetHref(config);\n\t\threfCache.set(config.basePath, href);\n\t\tvoid href.then(preloadStylesheet);\n\t}\n\treturn href;\n}\n\nfunction preloadStylesheet(href: string): void {\n\tconst head = globalThis.document?.head;\n\tif (!head || head.querySelector(`link[${PRELOAD_ATTRIBUTE}][href=\"${href}\"]`)) return;\n\tconst preload = globalThis.document.createElement('link');\n\tpreload.rel = 'preload';\n\tpreload.as = 'style';\n\tpreload.href = href;\n\tpreload.setAttribute(PRELOAD_ATTRIBUTE, '');\n\thead.append(preload);\n}\n\n/**\n * Route providers for a federated child mounted through `MfeShadowShellComponent`: the shell config,\n * the shadow-root registry, and CDK Overlay/Dialog scoped to the route so overlays open inside it.\n *\n * ```ts\n * { path: '', component: MfeShadowShellComponent, providers: provideMfeShadowShell({ basePath: '/mfe-aux-tables/' }), children }\n * ```\n */\nexport function provideMfeShadowShell(config: MfeShadowShellConfig): Provider[] {\n\tvoid mfeStylesheetHref(config);\n\treturn [\n\t\t{ provide: MFE_SHADOW_SHELL_CONFIG, useValue: config },\n\t\tMfeShadowRoot,\n\t\t{ provide: OverlayContainer, useClass: ShadowRootOverlayContainer },\n\t\t{ provide: Overlay, useClass: Overlay },\n\t\t{ provide: Dialog, useClass: Dialog },\n\t];\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n\tChangeDetectionStrategy,\n\tComponent,\n\tDestroyRef,\n\tElementRef,\n\tViewEncapsulation,\n\tafterNextRender,\n\tcomputed,\n\tinject,\n\tisDevMode,\n\tsignal,\n} from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\nimport { LoggerService } from '@sixbell-telco/sdk/utils/logger';\nimport { hoistMfePropertyRules } from './hoist-property-rules';\nimport { MFE_SHADOW_SHELL_CONFIG, MfeShadowRoot } from './mfe-shadow-root';\nimport { mfeStylesheetHref } from './provide-mfe-shadow-shell';\n\nconst STYLES_ATTRIBUTE = 'data-st-mfe-styles';\n\n/**\n * Route component that mounts a federated child inside its own shadow root: it attaches the child's\n * compiled stylesheet there, hides the content until it loads (no unstyled flash), and registers the\n * shadow root so CDK overlays opened by the child render inside it. Theme tokens inherit from the host.\n * Its Tailwind `@property` registrations the document lacks are hoisted to it, where browsers honour them.\n * Configure it with `provideMfeShadowShell` on the same route.\n */\n@Component({\n\tselector: 'st-mfe-shadow-shell',\n\timports: [RouterOutlet],\n\ttemplate: '<div [style.visibility]=\"visibility()\"><router-outlet /></div>',\n\tstyles: ':host { display: block; }',\n\tencapsulation: ViewEncapsulation.ShadowDom,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MfeShadowShellComponent {\n\tprivate readonly config = inject(MFE_SHADOW_SHELL_CONFIG);\n\tprivate readonly registry = inject(MfeShadowRoot);\n\tprivate readonly document = inject(DOCUMENT);\n\tprivate readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\tprivate readonly destroyRef = inject(DestroyRef);\n\tprivate readonly logger = inject(LoggerService);\n\tprivate readonly stylesReady = signal(false);\n\n\tprotected readonly visibility = computed(() => (this.stylesReady() ? 'visible' : 'hidden'));\n\n\tconstructor() {\n\t\tconst shadowRoot = this.host.shadowRoot;\n\t\tif (shadowRoot) this.registry.root.set(shadowRoot);\n\t\tthis.destroyRef.onDestroy(() => this.registry.root.set(null));\n\t\tafterNextRender(() => void this.attachStylesheet(shadowRoot));\n\t}\n\n\tprivate async attachStylesheet(shadowRoot: ShadowRoot | null): Promise<void> {\n\t\tif (!shadowRoot || shadowRoot.querySelector(`link[${STYLES_ATTRIBUTE}]`)) {\n\t\t\tthis.stylesReady.set(true);\n\t\t\treturn;\n\t\t}\n\t\tconst link = this.document.createElement('link');\n\t\tlink.rel = 'stylesheet';\n\t\tlink.setAttribute(STYLES_ATTRIBUTE, '');\n\t\tconst reveal = () => this.stylesReady.set(true);\n\t\tlink.addEventListener(\n\t\t\t'load',\n\t\t\t() => {\n\t\t\t\tthis.hoistPropertyRules(link);\n\t\t\t\treveal();\n\t\t\t},\n\t\t\t{ once: true },\n\t\t);\n\t\tlink.addEventListener('error', reveal, { once: true });\n\t\tconst timer = setTimeout(reveal, this.config.revealTimeoutMs ?? 1500);\n\t\tthis.destroyRef.onDestroy(() => clearTimeout(timer));\n\t\tlink.href = await mfeStylesheetHref(this.config);\n\t\tshadowRoot.prepend(link);\n\t}\n\n\tprivate hoistPropertyRules(link: HTMLLinkElement): void {\n\t\tconst href = link.getAttribute('href') ?? '';\n\t\tif (hoistMfePropertyRules(link.sheet, href, this.document) !== 'unreadable' || !isDevMode()) return;\n\t\tthis.logger.warn(\n\t\t\t`MFE shadow shell: cannot read the rules of ${href} (cross-origin without CORS?), so its @property rules were not hoisted and Tailwind border, shadow, ring and translate utilities may not resolve. Serve it with CORS or from the host origin.`,\n\t\t\t{ component: 'MfeShadowShellComponent', href },\n\t\t);\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAiBa,uBAAuB,GAAG,IAAI,cAAc,CAAuB,yBAAyB;AAEzG;MAEa,aAAa,CAAA;AAChB,IAAA,IAAI,GAAG,MAAM,CAAoB,IAAI,CAAC;wGADnC,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;4GAAb,aAAa,EAAA,CAAA;;4FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB;;;ACpBD,MAAM,oBAAoB,GAAG,wBAAwB;AACrD,MAAM,aAAa,GAAG,0BAA0B;AA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uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,wBAAA,CAAA,EAAA;;;AClChD;;AAEG;;;;"}
@@ -0,0 +1,186 @@
1
+ import { CDK_MENU, MENU_TRIGGER } from '@angular/cdk/menu';
2
+ import { STANDARD_DROPDOWN_BELOW_POSITIONS, STANDARD_DROPDOWN_ADJACENT_POSITIONS } from '@angular/cdk/overlay';
3
+ import * as i0 from '@angular/core';
4
+ import { inject, ElementRef, input, signal, afterNextRender, DestroyRef, Directive } from '@angular/core';
5
+ import { ThemeDomService } from '@sixbell-telco/sdk/utils/theme';
6
+
7
+ /** Keyframe names the `popover-motion` utility plays while opening and closing. */
8
+ const POPOVER_MOTION_ANIMATIONS = { opening: 'st-popover-in', closing: 'st-popover-out' };
9
+ const ALIGN_FROM_Y = { top: 'start', center: 'center', bottom: 'end' };
10
+ /**
11
+ * Placement of a panel from the CDK connection pair it was applied with (`positionChange`).
12
+ * A pair that overlaps the trigger instead of sitting beside it falls back to its vertical anchor.
13
+ */
14
+ function popoverPlacement(pair) {
15
+ if (pair.originY === 'bottom' && pair.overlayY === 'top')
16
+ return { side: 'bottom', align: pair.overlayX };
17
+ if (pair.originY === 'top' && pair.overlayY === 'bottom')
18
+ return { side: 'top', align: pair.overlayX };
19
+ if (pair.originX === 'end' && pair.overlayX === 'start')
20
+ return { side: 'right', align: ALIGN_FROM_Y[pair.overlayY] };
21
+ if (pair.originX === 'start' && pair.overlayX === 'end')
22
+ return { side: 'left', align: ALIGN_FROM_Y[pair.overlayY] };
23
+ return { side: pair.overlayY === 'bottom' ? 'top' : 'bottom', align: pair.overlayX };
24
+ }
25
+ /** Whether an `animationend` / `animationcancel` belongs to the `popover-motion` phase. */
26
+ function isPopoverMotionAnimation(event, phase) {
27
+ return event.animationName === POPOVER_MOTION_ANIMATIONS[phase];
28
+ }
29
+ const OPPOSITE_EDGES = { top: 'bottom', bottom: 'top', start: 'end', end: 'start' };
30
+ /**
31
+ * Offset for a fallback position derived from a primary one: negated when the fallback anchors the
32
+ * opposite edge (a flip), so a gap between trigger and panel stays a gap on either side.
33
+ */
34
+ function mirrorPopoverOffset(offset, from, to) {
35
+ const value = offset ?? 0;
36
+ return OPPOSITE_EDGES[from] === to && value !== 0 ? -value : value;
37
+ }
38
+
39
+ const SIDE_CLASS = 'st-popover-side-';
40
+ const ALIGN_CLASS = 'st-popover-align-';
41
+ const SIDES = ['top', 'right', 'bottom', 'left'];
42
+ const ALIGNS = ['start', 'center', 'end'];
43
+ /** Gap in pixels between a menu trigger and a menu opened below or above it */
44
+ const MENU_GAP = 4;
45
+ /** Tag each position with pane classes naming its placement, so the menu panel can read where the CDK put it */
46
+ function withPlacementClasses(positions) {
47
+ return positions.map((position) => {
48
+ const { side, align } = popoverPlacement(position);
49
+ const own = position.panelClass ? [].concat(position.panelClass) : [];
50
+ return { ...position, panelClass: [...own, `${SIDE_CLASS}${side}`, `${ALIGN_CLASS}${align}`] };
51
+ });
52
+ }
53
+ const MENU_BELOW_POSITIONS = withPlacementClasses(STANDARD_DROPDOWN_BELOW_POSITIONS.map((position) => ({ ...position, offsetY: position.overlayY === 'top' ? MENU_GAP : -MENU_GAP })));
54
+ const MENU_ADJACENT_POSITIONS = withPlacementClasses(STANDARD_DROPDOWN_ADJACENT_POSITIONS);
55
+ const CONTEXT_MENU_POSITIONS = withPlacementClasses(STANDARD_DROPDOWN_BELOW_POSITIONS.map((position) => ({
56
+ ...position,
57
+ offsetX: position.overlayX === 'start' ? 2 : -2,
58
+ offsetY: position.overlayY === 'top' ? 2 : -2,
59
+ })));
60
+ /**
61
+ * Positions for a CDK menu trigger, the same placements the CDK picks by default (below a root or
62
+ * menu-bar trigger with a 4px gap, beside a trigger inside a vertical menu), tagged for `popover-motion`.
63
+ * Call it in the injection context of the trigger.
64
+ */
65
+ function popoverMenuPositions() {
66
+ const parentMenu = inject(CDK_MENU, { optional: true });
67
+ return parentMenu?.orientation === 'vertical' ? MENU_ADJACENT_POSITIONS : MENU_BELOW_POSITIONS;
68
+ }
69
+ /** Positions for a CDK context menu trigger (the CDK defaults), tagged for `popover-motion` */
70
+ function popoverContextMenuPositions() {
71
+ return CONTEXT_MENU_POSITIONS;
72
+ }
73
+ function readPlacement(pane) {
74
+ const classes = pane?.classList;
75
+ const side = SIDES.find((value) => classes?.contains(`${SIDE_CLASS}${value}`));
76
+ const align = ALIGNS.find((value) => classes?.contains(`${ALIGN_CLASS}${value}`)) ?? 'start';
77
+ if (side)
78
+ return { side, align };
79
+ // Untagged positions (a trigger with its own cdkMenuPosition): the CDK pins `bottom` only for panels above the trigger.
80
+ return { side: pane?.style.bottom ? 'top' : 'bottom', align };
81
+ }
82
+ function longestAnimationMs(element) {
83
+ const style = getComputedStyle(element);
84
+ const toMs = (value) => {
85
+ const parsed = Number.parseFloat(value);
86
+ if (!Number.isFinite(parsed))
87
+ return 0;
88
+ return value.trim().endsWith('ms') ? parsed : parsed * 1000;
89
+ };
90
+ const durations = (style.animationDuration ?? '').split(',').map(toMs);
91
+ const delays = (style.animationDelay ?? '').split(',').map(toMs);
92
+ return Math.max(0, ...durations.map((duration, index) => duration + (delays[index] ?? delays[0] ?? 0)));
93
+ }
94
+ /**
95
+ * `popover-motion` for a CDK menu panel (`cdkMenu`). The entrance starts once the CDK placed the pane.
96
+ * The CDK detaches a menu the moment it closes, so the exit plays on an inert, hidden-from-AT snapshot
97
+ * of the panel at the same spot, removed when its animation ends.
98
+ * The panel is portaled out of its page, so it takes the theme of `stPopoverMenuMotionTheme` (the element
99
+ * that declares the menu), as `st-dropdown` does for its panel; the snapshot keeps it.
100
+ */
101
+ class PopoverMenuMotionDirective {
102
+ element = inject(ElementRef).nativeElement;
103
+ trigger = inject(MENU_TRIGGER, { optional: true });
104
+ themeDom = inject(ThemeDomService);
105
+ /** Element whose nearest `data-theme` the portaled panel takes */
106
+ stPopoverMenuMotionTheme = input(null);
107
+ /** @internal */
108
+ theme() {
109
+ return this.themeDom.themeOf(this.stPopoverMenuMotionTheme());
110
+ }
111
+ /** @internal */
112
+ state = signal(this.trigger ? 'opening' : 'open');
113
+ /** @internal */
114
+ placement = signal(null);
115
+ constructor() {
116
+ if (!this.trigger)
117
+ return;
118
+ afterNextRender({ read: () => this.placement.set(readPlacement(this.element.parentElement)) });
119
+ const subscription = this.trigger.closed.subscribe(() => this.playExit());
120
+ inject(DestroyRef).onDestroy(() => subscription.unsubscribe());
121
+ }
122
+ /** @internal */
123
+ onAnimationEnd(event) {
124
+ if (event.target === this.element && this.state() === 'opening' && isPopoverMotionAnimation(event, 'opening')) {
125
+ this.state.set('open');
126
+ }
127
+ }
128
+ playExit() {
129
+ const pane = this.element.parentElement;
130
+ const layer = pane?.parentElement?.parentElement;
131
+ if (!pane || !layer || !this.element.isConnected)
132
+ return;
133
+ const rect = this.element.getBoundingClientRect();
134
+ const holder = this.element.ownerDocument.createElement('div');
135
+ holder.setAttribute('aria-hidden', 'true');
136
+ holder.setAttribute('inert', '');
137
+ Object.assign(holder.style, {
138
+ position: 'fixed',
139
+ left: `${rect.left}px`,
140
+ top: `${rect.top}px`,
141
+ width: `${rect.width}px`,
142
+ pointerEvents: 'none',
143
+ zIndex: getComputedStyle(pane.parentElement).zIndex || '1000',
144
+ });
145
+ const snapshot = this.element.cloneNode(true);
146
+ [snapshot, ...Array.from(snapshot.querySelectorAll('[id]'))].forEach((node) => node.removeAttribute('id'));
147
+ snapshot.setAttribute('data-state', 'closing');
148
+ holder.appendChild(snapshot);
149
+ layer.appendChild(holder);
150
+ let timer = null;
151
+ const remove = () => {
152
+ if (timer !== null)
153
+ clearTimeout(timer);
154
+ holder.remove();
155
+ };
156
+ snapshot.addEventListener('animationend', (event) => {
157
+ if (event.target === snapshot && isPopoverMotionAnimation(event, 'closing'))
158
+ remove();
159
+ });
160
+ timer = setTimeout(remove, longestAnimationMs(snapshot) + 50);
161
+ }
162
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PopoverMenuMotionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
163
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.25", type: PopoverMenuMotionDirective, isStandalone: true, selector: "[stPopoverMenuMotion]", inputs: { stPopoverMenuMotionTheme: { classPropertyName: "stPopoverMenuMotionTheme", publicName: "stPopoverMenuMotionTheme", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "animationend": "onAnimationEnd($event)" }, properties: { "attr.data-state": "state()", "attr.data-side": "placement()?.side", "attr.data-align": "placement()?.align", "attr.data-theme": "theme()" }, classAttribute: "popover-motion" }, ngImport: i0 });
164
+ }
165
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PopoverMenuMotionDirective, decorators: [{
166
+ type: Directive,
167
+ args: [{
168
+ selector: '[stPopoverMenuMotion]',
169
+ standalone: true,
170
+ host: {
171
+ class: 'popover-motion',
172
+ '[attr.data-state]': 'state()',
173
+ '[attr.data-side]': 'placement()?.side',
174
+ '[attr.data-align]': 'placement()?.align',
175
+ '[attr.data-theme]': 'theme()',
176
+ '(animationend)': 'onAnimationEnd($event)',
177
+ },
178
+ }]
179
+ }], ctorParameters: () => [] });
180
+
181
+ /**
182
+ * Generated bundle index. Do not edit.
183
+ */
184
+
185
+ export { POPOVER_MOTION_ANIMATIONS, PopoverMenuMotionDirective, isPopoverMotionAnimation, mirrorPopoverOffset, popoverContextMenuPositions, popoverMenuPositions, popoverPlacement };
186
+ //# sourceMappingURL=sixbell-telco-sdk-utils-popover-motion.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sixbell-telco-sdk-utils-popover-motion.mjs","sources":["../../../projects/sdk/utils/popover-motion/src/popover-motion.ts","../../../projects/sdk/utils/popover-motion/src/popover-menu-motion.ts","../../../projects/sdk/utils/popover-motion/sixbell-telco-sdk-utils-popover-motion.ts"],"sourcesContent":["import type { ConnectedPosition } from '@angular/cdk/overlay';\n\n/** Side of the trigger the panel was placed on. */\nexport type PopoverSide = 'top' | 'right' | 'bottom' | 'left';\n\n/** Edge of the trigger the panel lines up with, along the side. */\nexport type PopoverAlign = 'start' | 'center' | 'end';\n\n/** Where the CDK placed a panel, as `data-side` / `data-align` on a `popover-motion` element. */\nexport interface PopoverPlacement {\n\treadonly side: PopoverSide;\n\treadonly align: PopoverAlign;\n}\n\n/** Lifecycle of a `popover-motion` panel, bound to its `data-state`. */\nexport type PopoverMotionState = 'closed' | 'opening' | 'open' | 'closing';\n\n/** Keyframe names the `popover-motion` utility plays while opening and closing. */\nexport const POPOVER_MOTION_ANIMATIONS = { opening: 'st-popover-in', closing: 'st-popover-out' } as const;\n\ntype PositionPair = Pick<ConnectedPosition, 'originX' | 'originY' | 'overlayX' | 'overlayY'>;\n\nconst ALIGN_FROM_Y = { top: 'start', center: 'center', bottom: 'end' } as const satisfies Record<ConnectedPosition['overlayY'], PopoverAlign>;\n\n/**\n * Placement of a panel from the CDK connection pair it was applied with (`positionChange`).\n * A pair that overlaps the trigger instead of sitting beside it falls back to its vertical anchor.\n */\nexport function popoverPlacement(pair: PositionPair): PopoverPlacement {\n\tif (pair.originY === 'bottom' && pair.overlayY === 'top') return { side: 'bottom', align: pair.overlayX };\n\tif (pair.originY === 'top' && pair.overlayY === 'bottom') return { side: 'top', align: pair.overlayX };\n\tif (pair.originX === 'end' && pair.overlayX === 'start') return { side: 'right', align: ALIGN_FROM_Y[pair.overlayY] };\n\tif (pair.originX === 'start' && pair.overlayX === 'end') return { side: 'left', align: ALIGN_FROM_Y[pair.overlayY] };\n\treturn { side: pair.overlayY === 'bottom' ? 'top' : 'bottom', align: pair.overlayX };\n}\n\n/** Whether an `animationend` / `animationcancel` belongs to the `popover-motion` phase. */\nexport function isPopoverMotionAnimation(event: Pick<AnimationEvent, 'animationName'>, phase: 'opening' | 'closing'): boolean {\n\treturn event.animationName === POPOVER_MOTION_ANIMATIONS[phase];\n}\n\nconst OPPOSITE_EDGES: Readonly<Record<string, string>> = { top: 'bottom', bottom: 'top', start: 'end', end: 'start' };\n\n/**\n * Offset for a fallback position derived from a primary one: negated when the fallback anchors the\n * opposite edge (a flip), so a gap between trigger and panel stays a gap on either side.\n */\nexport function mirrorPopoverOffset(offset: number | undefined, from: string, to: string): number {\n\tconst value = offset ?? 0;\n\treturn OPPOSITE_EDGES[from] === to && value !== 0 ? -value : value;\n}\n","import { CDK_MENU, MENU_TRIGGER } from '@angular/cdk/menu';\nimport { ConnectedPosition, STANDARD_DROPDOWN_ADJACENT_POSITIONS, STANDARD_DROPDOWN_BELOW_POSITIONS } from '@angular/cdk/overlay';\nimport { afterNextRender, DestroyRef, Directive, ElementRef, inject, input, signal } from '@angular/core';\nimport { ThemeDomService } from '@sixbell-telco/sdk/utils/theme';\nimport { isPopoverMotionAnimation, PopoverAlign, PopoverMotionState, PopoverPlacement, popoverPlacement, PopoverSide } from './popover-motion';\n\nconst SIDE_CLASS = 'st-popover-side-';\nconst ALIGN_CLASS = 'st-popover-align-';\nconst SIDES: readonly PopoverSide[] = ['top', 'right', 'bottom', 'left'];\nconst ALIGNS: readonly PopoverAlign[] = ['start', 'center', 'end'];\n\n/** Gap in pixels between a menu trigger and a menu opened below or above it */\nconst MENU_GAP = 4;\n\n/** Tag each position with pane classes naming its placement, so the menu panel can read where the CDK put it */\nfunction withPlacementClasses(positions: readonly ConnectedPosition[]): ConnectedPosition[] {\n\treturn positions.map((position) => {\n\t\tconst { side, align } = popoverPlacement(position);\n\t\tconst own = position.panelClass ? ([] as string[]).concat(position.panelClass) : [];\n\t\treturn { ...position, panelClass: [...own, `${SIDE_CLASS}${side}`, `${ALIGN_CLASS}${align}`] };\n\t});\n}\n\nconst MENU_BELOW_POSITIONS = withPlacementClasses(\n\tSTANDARD_DROPDOWN_BELOW_POSITIONS.map((position) => ({ ...position, offsetY: position.overlayY === 'top' ? MENU_GAP : -MENU_GAP })),\n);\nconst MENU_ADJACENT_POSITIONS = withPlacementClasses(STANDARD_DROPDOWN_ADJACENT_POSITIONS);\nconst CONTEXT_MENU_POSITIONS = withPlacementClasses(\n\tSTANDARD_DROPDOWN_BELOW_POSITIONS.map((position) => ({\n\t\t...position,\n\t\toffsetX: position.overlayX === 'start' ? 2 : -2,\n\t\toffsetY: position.overlayY === 'top' ? 2 : -2,\n\t})),\n);\n\n/**\n * Positions for a CDK menu trigger, the same placements the CDK picks by default (below a root or\n * menu-bar trigger with a 4px gap, beside a trigger inside a vertical menu), tagged for `popover-motion`.\n * Call it in the injection context of the trigger.\n */\nexport function popoverMenuPositions(): ConnectedPosition[] {\n\tconst parentMenu = inject(CDK_MENU, { optional: true });\n\treturn parentMenu?.orientation === 'vertical' ? MENU_ADJACENT_POSITIONS : MENU_BELOW_POSITIONS;\n}\n\n/** Positions for a CDK context menu trigger (the CDK defaults), tagged for `popover-motion` */\nexport function popoverContextMenuPositions(): ConnectedPosition[] {\n\treturn CONTEXT_MENU_POSITIONS;\n}\n\nfunction readPlacement(pane: HTMLElement | null): PopoverPlacement {\n\tconst classes = pane?.classList;\n\tconst side = SIDES.find((value) => classes?.contains(`${SIDE_CLASS}${value}`));\n\tconst align = ALIGNS.find((value) => classes?.contains(`${ALIGN_CLASS}${value}`)) ?? 'start';\n\tif (side) return { side, align };\n\t// Untagged positions (a trigger with its own cdkMenuPosition): the CDK pins `bottom` only for panels above the trigger.\n\treturn { side: pane?.style.bottom ? 'top' : 'bottom', align };\n}\n\nfunction longestAnimationMs(element: Element): number {\n\tconst style = getComputedStyle(element);\n\tconst toMs = (value: string) => {\n\t\tconst parsed = Number.parseFloat(value);\n\t\tif (!Number.isFinite(parsed)) return 0;\n\t\treturn value.trim().endsWith('ms') ? parsed : parsed * 1000;\n\t};\n\tconst durations = (style.animationDuration ?? '').split(',').map(toMs);\n\tconst delays = (style.animationDelay ?? '').split(',').map(toMs);\n\treturn Math.max(0, ...durations.map((duration, index) => duration + (delays[index] ?? delays[0] ?? 0)));\n}\n\n/**\n * `popover-motion` for a CDK menu panel (`cdkMenu`). The entrance starts once the CDK placed the pane.\n * The CDK detaches a menu the moment it closes, so the exit plays on an inert, hidden-from-AT snapshot\n * of the panel at the same spot, removed when its animation ends.\n * The panel is portaled out of its page, so it takes the theme of `stPopoverMenuMotionTheme` (the element\n * that declares the menu), as `st-dropdown` does for its panel; the snapshot keeps it.\n */\n@Directive({\n\tselector: '[stPopoverMenuMotion]',\n\tstandalone: true,\n\thost: {\n\t\tclass: 'popover-motion',\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.data-side]': 'placement()?.side',\n\t\t'[attr.data-align]': 'placement()?.align',\n\t\t'[attr.data-theme]': 'theme()',\n\t\t'(animationend)': 'onAnimationEnd($event)',\n\t},\n})\nexport class PopoverMenuMotionDirective {\n\tprivate readonly element: HTMLElement = inject(ElementRef).nativeElement;\n\tprivate readonly trigger = inject(MENU_TRIGGER, { optional: true });\n\tprivate readonly themeDom = inject(ThemeDomService);\n\n\t/** Element whose nearest `data-theme` the portaled panel takes */\n\treadonly stPopoverMenuMotionTheme = input<Element | null>(null);\n\n\t/** @internal */\n\tprotected theme(): string | null {\n\t\treturn this.themeDom.themeOf(this.stPopoverMenuMotionTheme());\n\t}\n\n\t/** @internal */\n\tprotected readonly state = signal<PopoverMotionState>(this.trigger ? 'opening' : 'open');\n\n\t/** @internal */\n\tprotected readonly placement = signal<PopoverPlacement | null>(null);\n\n\tconstructor() {\n\t\tif (!this.trigger) return;\n\t\tafterNextRender({ read: () => this.placement.set(readPlacement(this.element.parentElement)) });\n\n\t\tconst subscription = this.trigger.closed.subscribe(() => this.playExit());\n\t\tinject(DestroyRef).onDestroy(() => subscription.unsubscribe());\n\t}\n\n\t/** @internal */\n\tprotected onAnimationEnd(event: AnimationEvent): void {\n\t\tif (event.target === this.element && this.state() === 'opening' && isPopoverMotionAnimation(event, 'opening')) {\n\t\t\tthis.state.set('open');\n\t\t}\n\t}\n\n\tprivate playExit(): void {\n\t\tconst pane = this.element.parentElement;\n\t\tconst layer = pane?.parentElement?.parentElement;\n\t\tif (!pane || !layer || !this.element.isConnected) return;\n\n\t\tconst rect = this.element.getBoundingClientRect();\n\t\tconst holder = this.element.ownerDocument.createElement('div');\n\t\tholder.setAttribute('aria-hidden', 'true');\n\t\tholder.setAttribute('inert', '');\n\t\tObject.assign(holder.style, {\n\t\t\tposition: 'fixed',\n\t\t\tleft: `${rect.left}px`,\n\t\t\ttop: `${rect.top}px`,\n\t\t\twidth: `${rect.width}px`,\n\t\t\tpointerEvents: 'none',\n\t\t\tzIndex: getComputedStyle(pane.parentElement as HTMLElement).zIndex || '1000',\n\t\t});\n\n\t\tconst snapshot = this.element.cloneNode(true) as HTMLElement;\n\t\t[snapshot, ...Array.from(snapshot.querySelectorAll<HTMLElement>('[id]'))].forEach((node) => node.removeAttribute('id'));\n\t\tsnapshot.setAttribute('data-state', 'closing');\n\t\tholder.appendChild(snapshot);\n\t\tlayer.appendChild(holder);\n\n\t\tlet timer: ReturnType<typeof setTimeout> | null = null;\n\t\tconst remove = () => {\n\t\t\tif (timer !== null) clearTimeout(timer);\n\t\t\tholder.remove();\n\t\t};\n\t\tsnapshot.addEventListener('animationend', (event) => {\n\t\t\tif (event.target === snapshot && isPopoverMotionAnimation(event, 'closing')) remove();\n\t\t});\n\t\ttimer = setTimeout(remove, longestAnimationMs(snapshot) + 50);\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAiBA;AACO,MAAM,yBAAyB,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB;AAI9F,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAyE;AAE7I;;;AAGG;AACG,SAAU,gBAAgB,CAAC,IAAkB,EAAA;IAClD,IAAI,IAAI,CAAC,OAAO,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK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