@sbb-esta/lyne-elements 1.2.0 → 1.3.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 (257) hide show
  1. package/accordion/accordion.d.ts +1 -1
  2. package/accordion/accordion.d.ts.map +1 -1
  3. package/alert/alert/alert.d.ts +1 -1
  4. package/alert/alert/alert.d.ts.map +1 -1
  5. package/button/common/button-common.d.ts.map +1 -1
  6. package/button/common.js +20 -20
  7. package/button/mini-button/mini-button.d.ts +0 -1
  8. package/button/mini-button/mini-button.d.ts.map +1 -1
  9. package/button/mini-button.js +16 -18
  10. package/calendar/calendar.d.ts.map +1 -1
  11. package/calendar.js +22 -20
  12. package/checkbox/checkbox/checkbox.d.ts +0 -1
  13. package/checkbox/checkbox/checkbox.d.ts.map +1 -1
  14. package/checkbox/checkbox-group/checkbox-group.d.ts +0 -1
  15. package/checkbox/checkbox-group/checkbox-group.d.ts.map +1 -1
  16. package/checkbox/checkbox-group.js +5 -3
  17. package/checkbox/checkbox-panel/checkbox-panel.d.ts +0 -1
  18. package/checkbox/checkbox-panel/checkbox-panel.d.ts.map +1 -1
  19. package/checkbox/checkbox-panel.js +12 -11
  20. package/checkbox/checkbox.js +12 -11
  21. package/clock/clock.d.ts +19 -13
  22. package/clock/clock.d.ts.map +1 -1
  23. package/clock.js +86 -75
  24. package/core/datetime/date-adapter.d.ts +23 -13
  25. package/core/datetime/date-adapter.d.ts.map +1 -1
  26. package/core/datetime/native-date-adapter.d.ts +0 -1
  27. package/core/datetime/native-date-adapter.d.ts.map +1 -1
  28. package/core/datetime.js +23 -23
  29. package/core/decorators/host-attributes.d.ts +1 -1
  30. package/core/decorators/slot-state.d.ts +18 -0
  31. package/core/decorators/slot-state.d.ts.map +1 -0
  32. package/core/decorators.d.ts +1 -0
  33. package/core/decorators.d.ts.map +1 -1
  34. package/core/decorators.js +15 -9
  35. package/core/mixins/hydration-mixin.d.ts.map +1 -1
  36. package/core/mixins.js +126 -132
  37. package/core/styles/mixins/buttons.scss +15 -48
  38. package/custom-elements.json +509 -540
  39. package/datepicker/common/datepicker-button.d.ts +5 -5
  40. package/datepicker/common/datepicker-button.d.ts.map +1 -1
  41. package/datepicker/common.js +21 -20
  42. package/datepicker/datepicker/datepicker.d.ts +55 -38
  43. package/datepicker/datepicker/datepicker.d.ts.map +1 -1
  44. package/datepicker/datepicker-next-day/datepicker-next-day.d.ts +1 -1
  45. package/datepicker/datepicker-next-day/datepicker-next-day.d.ts.map +1 -1
  46. package/datepicker/datepicker-next-day.js +16 -16
  47. package/datepicker/datepicker-previous-day/datepicker-previous-day.d.ts +1 -1
  48. package/datepicker/datepicker-previous-day/datepicker-previous-day.d.ts.map +1 -1
  49. package/datepicker/datepicker-previous-day.js +14 -14
  50. package/datepicker/datepicker-toggle/datepicker-toggle.d.ts +1 -1
  51. package/datepicker/datepicker-toggle/datepicker-toggle.d.ts.map +1 -1
  52. package/datepicker/datepicker-toggle.js +25 -23
  53. package/datepicker/datepicker.js +147 -181
  54. package/development/accordion/accordion.d.ts +1 -1
  55. package/development/accordion/accordion.d.ts.map +1 -1
  56. package/development/accordion.js +1 -1
  57. package/development/alert/alert/alert.d.ts +1 -1
  58. package/development/alert/alert/alert.d.ts.map +1 -1
  59. package/development/alert/alert.js +1 -1
  60. package/development/button/common/button-common.d.ts.map +1 -1
  61. package/development/button/common.js +30 -25
  62. package/development/button/mini-button/mini-button.d.ts +0 -1
  63. package/development/button/mini-button/mini-button.d.ts.map +1 -1
  64. package/development/button/mini-button.js +17 -55
  65. package/development/calendar/calendar.d.ts.map +1 -1
  66. package/development/calendar.js +4 -2
  67. package/development/checkbox/checkbox/checkbox.d.ts +0 -1
  68. package/development/checkbox/checkbox/checkbox.d.ts.map +1 -1
  69. package/development/checkbox/checkbox-group/checkbox-group.d.ts +0 -1
  70. package/development/checkbox/checkbox-group/checkbox-group.d.ts.map +1 -1
  71. package/development/checkbox/checkbox-group.js +6 -5
  72. package/development/checkbox/checkbox-panel/checkbox-panel.d.ts +0 -1
  73. package/development/checkbox/checkbox-panel/checkbox-panel.d.ts.map +1 -1
  74. package/development/checkbox/checkbox-panel.js +5 -5
  75. package/development/checkbox/checkbox.js +5 -5
  76. package/development/clock/clock.d.ts +19 -13
  77. package/development/clock/clock.d.ts.map +1 -1
  78. package/development/clock.js +85 -80
  79. package/development/core/datetime/date-adapter.d.ts +23 -13
  80. package/development/core/datetime/date-adapter.d.ts.map +1 -1
  81. package/development/core/datetime/native-date-adapter.d.ts +0 -1
  82. package/development/core/datetime/native-date-adapter.d.ts.map +1 -1
  83. package/development/core/datetime.js +28 -26
  84. package/development/core/decorators/host-attributes.d.ts +1 -1
  85. package/development/core/decorators/slot-state.d.ts +18 -0
  86. package/development/core/decorators/slot-state.d.ts.map +1 -0
  87. package/development/core/decorators.d.ts +1 -0
  88. package/development/core/decorators.d.ts.map +1 -1
  89. package/development/core/decorators.js +11 -2
  90. package/development/core/mixins/hydration-mixin.d.ts.map +1 -1
  91. package/development/core/mixins.js +15 -16
  92. package/development/datepicker/common/datepicker-button.d.ts +5 -5
  93. package/development/datepicker/common/datepicker-button.d.ts.map +1 -1
  94. package/development/datepicker/common.js +10 -9
  95. package/development/datepicker/datepicker/datepicker.d.ts +55 -38
  96. package/development/datepicker/datepicker/datepicker.d.ts.map +1 -1
  97. package/development/datepicker/datepicker-next-day/datepicker-next-day.d.ts +1 -1
  98. package/development/datepicker/datepicker-next-day/datepicker-next-day.d.ts.map +1 -1
  99. package/development/datepicker/datepicker-next-day.js +14 -54
  100. package/development/datepicker/datepicker-previous-day/datepicker-previous-day.d.ts +1 -1
  101. package/development/datepicker/datepicker-previous-day/datepicker-previous-day.d.ts.map +1 -1
  102. package/development/datepicker/datepicker-previous-day.js +14 -54
  103. package/development/datepicker/datepicker-toggle/datepicker-toggle.d.ts +1 -1
  104. package/development/datepicker/datepicker-toggle/datepicker-toggle.d.ts.map +1 -1
  105. package/development/datepicker/datepicker-toggle.js +16 -10
  106. package/development/datepicker/datepicker.js +134 -159
  107. package/development/dialog/dialog.js +1 -1
  108. package/development/file-selector/file-selector.d.ts +0 -1
  109. package/development/file-selector/file-selector.d.ts.map +1 -1
  110. package/development/file-selector.js +6 -5
  111. package/development/form-field/form-field/form-field.d.ts +1 -2
  112. package/development/form-field/form-field/form-field.d.ts.map +1 -1
  113. package/development/form-field/form-field-clear/form-field-clear.d.ts.map +1 -1
  114. package/development/form-field/form-field-clear.js +15 -51
  115. package/development/form-field/form-field.js +8 -7
  116. package/development/icon/icon-request.d.ts.map +1 -1
  117. package/development/icon.js +8 -13
  118. package/development/link/common/link-common.d.ts.map +1 -1
  119. package/development/link/common.js +6 -7
  120. package/development/link-list/link-list.d.ts +0 -1
  121. package/development/link-list/link-list.d.ts.map +1 -1
  122. package/development/link-list.js +5 -5
  123. package/development/map-container.js +5 -2
  124. package/development/navigation/navigation-list/navigation-list.d.ts +0 -1
  125. package/development/navigation/navigation-list/navigation-list.d.ts.map +1 -1
  126. package/development/navigation/navigation-list.js +5 -5
  127. package/development/navigation/navigation-section/navigation-section.d.ts +0 -1
  128. package/development/navigation/navigation-section/navigation-section.d.ts.map +1 -1
  129. package/development/navigation/navigation-section.js +6 -6
  130. package/development/notification/notification.d.ts +5 -16
  131. package/development/notification/notification.d.ts.map +1 -1
  132. package/development/notification.js +8 -9
  133. package/development/option/option/option.d.ts.map +1 -1
  134. package/development/option/option.js +5 -5
  135. package/development/popover/popover/popover.d.ts +3 -1
  136. package/development/popover/popover/popover.d.ts.map +1 -1
  137. package/development/popover/popover-trigger.js +14 -49
  138. package/development/popover/popover.js +11 -4
  139. package/development/radio-button/radio-button/radio-button.d.ts +0 -1
  140. package/development/radio-button/radio-button/radio-button.d.ts.map +1 -1
  141. package/development/radio-button/radio-button-group/radio-button-group.d.ts +0 -1
  142. package/development/radio-button/radio-button-group/radio-button-group.d.ts.map +1 -1
  143. package/development/radio-button/radio-button-group.js +6 -6
  144. package/development/radio-button/radio-button-panel/radio-button-panel.d.ts +0 -1
  145. package/development/radio-button/radio-button-panel/radio-button-panel.d.ts.map +1 -1
  146. package/development/radio-button/radio-button-panel.js +4 -7
  147. package/development/radio-button/radio-button.js +4 -7
  148. package/development/selection-expansion-panel/selection-expansion-panel.d.ts +0 -1
  149. package/development/selection-expansion-panel/selection-expansion-panel.d.ts.map +1 -1
  150. package/development/selection-expansion-panel.js +6 -5
  151. package/development/skiplink-list/skiplink-list.d.ts +0 -1
  152. package/development/skiplink-list/skiplink-list.d.ts.map +1 -1
  153. package/development/skiplink-list.js +5 -5
  154. package/development/status/status.d.ts +0 -1
  155. package/development/status/status.d.ts.map +1 -1
  156. package/development/status.js +5 -5
  157. package/development/stepper/stepper/stepper.d.ts +3 -1
  158. package/development/stepper/stepper/stepper.d.ts.map +1 -1
  159. package/development/stepper/stepper.js +3 -2
  160. package/development/tabs/tab-group/tab-group.d.ts +3 -1
  161. package/development/tabs/tab-group/tab-group.d.ts.map +1 -1
  162. package/development/tabs/tab-group.js +3 -2
  163. package/development/tabs/tab-label/tab-label.d.ts +0 -1
  164. package/development/tabs/tab-label/tab-label.d.ts.map +1 -1
  165. package/development/tabs/tab-label.js +5 -5
  166. package/development/tag/tag/tag.d.ts +0 -1
  167. package/development/tag/tag/tag.d.ts.map +1 -1
  168. package/development/tag/tag.js +6 -5
  169. package/development/teaser/teaser.d.ts +0 -1
  170. package/development/teaser/teaser.d.ts.map +1 -1
  171. package/development/teaser.js +5 -5
  172. package/development/toast/toast.d.ts +1 -2
  173. package/development/toast/toast.d.ts.map +1 -1
  174. package/development/toast.js +10 -8
  175. package/development/toggle/toggle-option/toggle-option.d.ts +0 -1
  176. package/development/toggle/toggle-option/toggle-option.d.ts.map +1 -1
  177. package/development/toggle/toggle-option.js +6 -6
  178. package/development/toggle-check/toggle-check.d.ts +2 -3
  179. package/development/toggle-check/toggle-check.d.ts.map +1 -1
  180. package/development/toggle-check.js +5 -5
  181. package/development/visual-checkbox.js +2 -2
  182. package/dialog/dialog.js +1 -1
  183. package/file-selector/file-selector.d.ts +0 -1
  184. package/file-selector/file-selector.d.ts.map +1 -1
  185. package/file-selector.js +17 -15
  186. package/form-field/form-field/form-field.d.ts +1 -2
  187. package/form-field/form-field/form-field.d.ts.map +1 -1
  188. package/form-field/form-field-clear/form-field-clear.d.ts.map +1 -1
  189. package/form-field/form-field-clear.js +17 -18
  190. package/form-field/form-field.js +16 -14
  191. package/icon/icon-request.d.ts.map +1 -1
  192. package/icon.js +86 -86
  193. package/link/common/link-common.d.ts.map +1 -1
  194. package/link/common.js +9 -9
  195. package/link-list/link-list.d.ts +0 -1
  196. package/link-list/link-list.d.ts.map +1 -1
  197. package/link-list.js +8 -7
  198. package/map-container.js +1 -1
  199. package/navigation/navigation-list/navigation-list.d.ts +0 -1
  200. package/navigation/navigation-list/navigation-list.d.ts.map +1 -1
  201. package/navigation/navigation-list.js +9 -8
  202. package/navigation/navigation-section/navigation-section.d.ts +0 -1
  203. package/navigation/navigation-section/navigation-section.d.ts.map +1 -1
  204. package/navigation/navigation-section.js +10 -9
  205. package/notification/notification.d.ts +5 -16
  206. package/notification/notification.d.ts.map +1 -1
  207. package/notification.js +9 -9
  208. package/option/option/option.d.ts.map +1 -1
  209. package/option/option.js +6 -5
  210. package/package.json +1 -1
  211. package/popover/popover/popover.d.ts +3 -1
  212. package/popover/popover/popover.d.ts.map +1 -1
  213. package/popover/popover-trigger.js +13 -13
  214. package/popover/popover.js +55 -48
  215. package/radio-button/radio-button/radio-button.d.ts +0 -1
  216. package/radio-button/radio-button/radio-button.d.ts.map +1 -1
  217. package/radio-button/radio-button-group/radio-button-group.d.ts +0 -1
  218. package/radio-button/radio-button-group/radio-button-group.d.ts.map +1 -1
  219. package/radio-button/radio-button-group.js +7 -6
  220. package/radio-button/radio-button-panel/radio-button-panel.d.ts +0 -1
  221. package/radio-button/radio-button-panel/radio-button-panel.d.ts.map +1 -1
  222. package/radio-button/radio-button-panel.js +12 -14
  223. package/radio-button/radio-button.js +7 -9
  224. package/selection-expansion-panel/selection-expansion-panel.d.ts +0 -1
  225. package/selection-expansion-panel/selection-expansion-panel.d.ts.map +1 -1
  226. package/selection-expansion-panel.js +15 -13
  227. package/skiplink-list/skiplink-list.d.ts +0 -1
  228. package/skiplink-list/skiplink-list.d.ts.map +1 -1
  229. package/skiplink-list.js +4 -3
  230. package/status/status.d.ts +0 -1
  231. package/status/status.d.ts.map +1 -1
  232. package/status.js +9 -8
  233. package/stepper/stepper/stepper.d.ts +3 -1
  234. package/stepper/stepper/stepper.d.ts.map +1 -1
  235. package/stepper/stepper.js +7 -6
  236. package/tabs/tab-group/tab-group.d.ts +3 -1
  237. package/tabs/tab-group/tab-group.d.ts.map +1 -1
  238. package/tabs/tab-group.js +14 -13
  239. package/tabs/tab-label/tab-label.d.ts +0 -1
  240. package/tabs/tab-label/tab-label.d.ts.map +1 -1
  241. package/tabs/tab-label.js +4 -3
  242. package/tag/tag/tag.d.ts +0 -1
  243. package/tag/tag/tag.d.ts.map +1 -1
  244. package/tag/tag.js +6 -4
  245. package/teaser/teaser.d.ts +0 -1
  246. package/teaser/teaser.d.ts.map +1 -1
  247. package/teaser.js +4 -3
  248. package/toast/toast.d.ts +1 -2
  249. package/toast/toast.d.ts.map +1 -1
  250. package/toast.js +15 -12
  251. package/toggle/toggle-option/toggle-option.d.ts +0 -1
  252. package/toggle/toggle-option/toggle-option.d.ts.map +1 -1
  253. package/toggle/toggle-option.js +12 -11
  254. package/toggle-check/toggle-check.d.ts +2 -3
  255. package/toggle-check/toggle-check.d.ts.map +1 -1
  256. package/toggle-check.js +4 -3
  257. package/visual-checkbox.js +4 -4
package/clock/clock.d.ts CHANGED
@@ -29,16 +29,19 @@ export declare class SbbClockElement extends LitElement {
29
29
  private _moveMinutesHandFn;
30
30
  /** Move the minutes hand every minute. */
31
31
  private _handMovement?;
32
- protected willUpdate(changedProperties: PropertyValues<this>): void;
32
+ protected willUpdate(changedProperties: PropertyValues<this>): Promise<void>;
33
+ protected firstUpdated(changedProperties: PropertyValues<this>): Promise<void>;
34
+ disconnectedCallback(): void;
33
35
  private _handlePageVisibilityChange;
34
- private _addEventListeners;
35
- private _removeEventListeners;
36
- private _removeHoursAnimationStyles;
37
- private _removeSecondsAnimationStyles;
38
- /** Given the current date, calculates the hh/mm/ss values and the hh/mm/ss left to the next midnight. */
39
- private _assignCurrentTime;
36
+ private _startOrConfigureClock;
37
+ /** Starts the clock by defining the hands starting position then starting the animations. */
38
+ private _startClock;
39
+ /** Stops the clock by removing all the animations. */
40
+ private _stopClock;
40
41
  /** Set the starting position for the three hands on the clock face. */
41
42
  private _setHandsStartingPosition;
43
+ /** Given the current date, calculates the hh/mm/ss values and the hh/mm/ss left to the next midnight. */
44
+ private _assignCurrentTime;
42
45
  /** Set the starting position for the minutes hand. */
43
46
  private _setMinutesHand;
44
47
  /** Move the hours hand to the next value. */
@@ -46,12 +49,15 @@ export declare class SbbClockElement extends LitElement {
46
49
  /** Move the minutes hand to the next value. */
47
50
  private _moveMinutesHand;
48
51
  private _addMinutesAndSetHands;
49
- /** Stops the clock by removing all the animations. */
50
- private _stopClock;
51
- /** Starts the clock by defining the hands starting position then starting the animations. */
52
- private _startClock;
53
- protected firstUpdated(changedProperties: PropertyValues<this>): Promise<void>;
54
- disconnectedCallback(): void;
52
+ /**
53
+ * Removing animation by overriding with empty string,
54
+ * then triggering a reflow and re add original animation by removing override.
55
+ * @private
56
+ */
57
+ private _resetSecondsHandAnimation;
58
+ private _removeEventListeners;
59
+ private _removeHoursAnimationStyles;
60
+ private _removeSecondsAnimationStyles;
55
61
  protected render(): TemplateResult;
56
62
  }
57
63
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../../src/elements/clock/clock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAkB,UAAU,EAAE,MAAM,KAAK,CAAC;AAIjD,OAAO,KAAK,EAAE,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,6FAA6F;YAC/E,WAAW;IAqBzB,sDAAsD;YACxC,UAAU;IAcxB,uEAAuE;IACvE,OAAO,CAAC,yBAAyB;IA4CjC,yGAAyG;IACzG,OAAO,CAAC,kBAAkB;IAW1B,sDAAsD;IACtD,OAAO,CAAC,eAAe;IAOvB,6CAA6C;IAC7C,OAAO,CAAC,cAAc;IAYtB,+CAA+C;IAC/C,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,sBAAsB;IAK9B;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAUlC,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,2BAA2B;IAMnC,OAAO,CAAC,6BAA6B;cAOlB,MAAM,IAAI,cAAc;CA4B5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,WAAW,EAAE,eAAe,CAAC;KAC9B;CACF"}
package/clock.js CHANGED
@@ -1,137 +1,148 @@
1
- import { css as H, LitElement as g, isServer as u, html as z } from "lit";
1
+ import { css as p, LitElement as H, isServer as _, html as g } from "lit";
2
2
  import { property as y, customElement as f } from "lit/decorators.js";
3
- import { ref as l } from "lit/directives/ref.js";
4
- const S = `<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><g class="face"><circle fill="#FFF" cx="52.5" cy="52.5" r="52.5"/><path d="M50.75 4h3.5v12h-3.5zM50.75 89h3.5v12h-3.5zM75.233 9.623l3.03 1.75-6 10.392-3.03-1.75zM32.734 83.233l3.03 1.75-6 10.392-3.03-1.75zM93.628 26.732l1.75 3.031-10.392 6-1.75-3.03zM20.017 69.234l1.75 3.031-10.392 6-1.75-3.03zM101 50.75v3.5H89v-3.5zM16 50.75v3.5H4v-3.5zM95.379 75.232l-1.75 3.031-10.392-6 1.75-3.03zM21.766 32.734l-1.75 3.031-10.392-6 1.75-3.03zM78.267 93.63l-3.03 1.75-6-10.393 3.03-1.75zM35.766 20.015l-3.03 1.75-6-10.392 3.03-1.75z"/><g><path d="M56.873 4.19l1.392.147-.366 3.48-1.392-.145zM47.101 97.177l1.393.146-.366 3.481-1.392-.146zM61.896 4.914l1.37.29-.728 3.424-1.37-.29zM42.458 96.366l1.37.29-.728 3.424-1.37-.291zM66.825 6.157l1.332.432-1.082 3.33-1.331-.434zM37.931 95.085l1.332.432-1.082 3.33-1.331-.433zM71.584 7.906l1.28.569-1.424 3.197-1.28-.57zM33.56 93.32l1.278.569-1.423 3.197-1.28-.57zM80.44 12.852l1.133.823-2.058 2.831-1.132-.823zM25.481 88.494l1.133.822-2.057 2.832-1.133-.823zM84.43 15.986l1.04.937-2.342 2.6-1.04-.936zM21.87 85.469l1.04.936-2.341 2.601-1.04-.937zM88.072 19.522l.937 1.04-2.6 2.343-.937-1.04zM18.593 82.088l.937 1.04-2.601 2.342-.937-1.04zM91.328 23.425l.823 1.133-2.832 2.057-.823-1.132zM15.684 78.385l.823 1.132-2.832 2.058-.822-1.133zM96.52 32.128l.57 1.279-3.198 1.423-.57-1.278zM11.109 70.161l.569 1.279-3.197 1.423-.57-1.279zM98.407 36.85l.433 1.332-3.33 1.081-.432-1.331zM9.483 65.74l.432 1.33-3.329 1.082-.432-1.331zM99.795 41.726l.291 1.37-3.423.727-.29-1.37zM8.34 61.17l.292 1.37-3.424.728-.29-1.37zM100.66 46.73l.146 1.393-3.48.366-.147-1.392zM7.674 56.506l.146 1.392-3.48.366-.147-1.392zM100.811 56.873l-.146 1.392-3.48-.365.145-1.393zM7.821 47.101l-.146 1.392-3.48-.365.145-1.393zM100.09 61.895l-.291 1.369-3.424-.728.291-1.369zM8.631 42.46l-.291 1.37-3.423-.728.29-1.37zM98.84 66.827l-.432 1.331-3.329-1.081.433-1.332zM9.918 37.93l-.433 1.331-3.329-1.082.433-1.331zM97.098 71.585l-.569 1.28-3.197-1.424.57-1.28zM11.677 33.558l-.57 1.28-3.197-1.424.57-1.279zM92.149 80.439l-.823 1.133-2.832-2.058.823-1.132zM16.506 25.482l-.823 1.133-2.831-2.057.823-1.133zM89.017 84.431l-.937 1.04-2.6-2.341.936-1.04zM19.528 21.869l-.936 1.04-2.601-2.342.936-1.04zM85.48 88.076l-1.041.936-2.342-2.6 1.04-.937zM22.91 18.59l-1.04.937-2.341-2.601 1.04-.937zM81.574 91.328l-1.133.823-2.057-2.831 1.132-.823zM26.617 15.684l-1.133.823-2.057-2.832 1.132-.823zM72.873 96.524l-1.279.57-1.423-3.198 1.278-.57zM34.838 11.105l-1.279.57-1.423-3.198 1.279-.57zM68.151 98.405l-1.331.432-1.082-3.329 1.332-.432zM39.259 9.485l-1.332.433-1.081-3.33 1.331-.432zM63.272 99.799l-1.369.29-.728-3.422 1.37-.291zM43.83 8.337l-1.369.291-.727-3.423 1.37-.291zM58.27 100.662l-1.393.146-.366-3.48 1.393-.147zM48.494 7.672l-1.392.147-.366-3.481 1.392-.147z"/></g></g></svg>
5
- `, w = `<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><path id="mod_clock_svg_hours" d="M55.7 64.5h-6.4l.6-44h5.2z"/></svg>
6
- `, L = `<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><path d="M55.1,64.5h-5.2l0.8-58h3.6L55.1,64.5z"/></svg>
7
- `, E = `<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><path d="M57.8,21.3c0-2.9-2.4-5.2-5.2-5.2s-5.3,2.3-5.3,5.2c0,2.7,2,4.8,4.5,5.2V69h1.5V26.5C55.8,26.2,57.8,24,57.8,21.3z"/></svg>
8
- `, C = H`*,:before,:after{box-sizing:border-box}:host{--sbb-clock-hours-animation-start-angle: 0deg;--sbb-clock-seconds-animation-start-angle: 0deg;--sbb-clock-hours-animation-duration: 0s;--sbb-clock-seconds-animation-duration: 0s;--sbb-clock-animation-play-state: paused;--sbb-clock-seconds-hand-color: var(--sbb-color-red);display:block}.sbb-clock{position:relative;width:100%;height:100%;aspect-ratio:1/1;overflow:hidden;contain:content}.sbb-clock__face,.sbb-clock__hand-hours,.sbb-clock__hand-minutes,.sbb-clock__hand-seconds{position:absolute;top:0;right:0;bottom:0;left:0;transform-origin:center center;transform:rotate(0);transform-style:preserve-3d;backface-visibility:hidden}.sbb-clock__hand-minutes{transition:transform .2s cubic-bezier(.4,2.08,.55,.44)}@supports not (aspect-ratio: 1/1){.sbb-clock__hand-minutes{transform-origin:50% 49.625%}}.sbb-clock__hand-hours{animation-name:rotate;animation-duration:43200s;animation-iteration-count:infinite;animation-timing-function:linear;animation-play-state:var(--sbb-clock-animation-play-state)}.sbb-clock__hand-hours--initial-hour{animation-name:hand-hours-animation-initial-hour;animation-duration:var(--sbb-clock-hours-animation-duration);animation-play-state:var(--sbb-clock-animation-play-state);animation-iteration-count:1}.sbb-clock__hand-minutes--no-transition{transition:none}.sbb-clock__hand-seconds{animation-name:hand-seconds-animation;animation-duration:60s;animation-timing-function:linear;animation-play-state:var(--sbb-clock-animation-play-state);animation-iteration-count:infinite;fill:var(--sbb-clock-seconds-hand-color)}.sbb-clock__hand-seconds--initial-minute{animation-name:hand-seconds-animation-initial-minute;animation-duration:var(--sbb-clock-seconds-animation-duration);animation-play-state:var(--sbb-clock-animation-play-state);animation-iteration-count:1}:host(:not([data-initialized])) :is(.sbb-clock__hand-hours,.sbb-clock__hand-minutes,.sbb-clock__hand-seconds){display:none}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes hand-hours-animation-initial-hour{0%{transform:rotate(var(--sbb-clock-hours-animation-start-angle))}to{transform:rotate(360deg)}}@keyframes hand-seconds-animation{0%{transform:rotate(0)}97.5%,to{transform:rotate(360deg)}}@keyframes hand-seconds-animation-initial-minute{0%{transform:rotate(var(--sbb-clock-seconds-animation-start-angle))}97.5%,to{transform:rotate(360deg)}}`;
9
- var A = Object.defineProperty, O = Object.getOwnPropertyDescriptor, p = (t, s, o, i) => {
10
- for (var n = i > 1 ? void 0 : i ? O(s, o) : s, e = t.length - 1, a; e >= 0; e--)
11
- (a = t[e]) && (n = (i ? a(s, o, n) : a(n)) || n);
12
- return i && n && A(s, o, n), n;
3
+ import { ref as r } from "lit/directives/ref.js";
4
+ const z = `<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><g class="face"><circle fill="#FFF" cx="52.5" cy="52.5" r="52.5"/><path d="M50.75 4h3.5v12h-3.5zM50.75 89h3.5v12h-3.5zM75.233 9.623l3.03 1.75-6 10.392-3.03-1.75zM32.734 83.233l3.03 1.75-6 10.392-3.03-1.75zM93.628 26.732l1.75 3.031-10.392 6-1.75-3.03zM20.017 69.234l1.75 3.031-10.392 6-1.75-3.03zM101 50.75v3.5H89v-3.5zM16 50.75v3.5H4v-3.5zM95.379 75.232l-1.75 3.031-10.392-6 1.75-3.03zM21.766 32.734l-1.75 3.031-10.392-6 1.75-3.03zM78.267 93.63l-3.03 1.75-6-10.393 3.03-1.75zM35.766 20.015l-3.03 1.75-6-10.392 3.03-1.75z"/><g><path d="M56.873 4.19l1.392.147-.366 3.48-1.392-.145zM47.101 97.177l1.393.146-.366 3.481-1.392-.146zM61.896 4.914l1.37.29-.728 3.424-1.37-.29zM42.458 96.366l1.37.29-.728 3.424-1.37-.291zM66.825 6.157l1.332.432-1.082 3.33-1.331-.434zM37.931 95.085l1.332.432-1.082 3.33-1.331-.433zM71.584 7.906l1.28.569-1.424 3.197-1.28-.57zM33.56 93.32l1.278.569-1.423 3.197-1.28-.57zM80.44 12.852l1.133.823-2.058 2.831-1.132-.823zM25.481 88.494l1.133.822-2.057 2.832-1.133-.823zM84.43 15.986l1.04.937-2.342 2.6-1.04-.936zM21.87 85.469l1.04.936-2.341 2.601-1.04-.937zM88.072 19.522l.937 1.04-2.6 2.343-.937-1.04zM18.593 82.088l.937 1.04-2.601 2.342-.937-1.04zM91.328 23.425l.823 1.133-2.832 2.057-.823-1.132zM15.684 78.385l.823 1.132-2.832 2.058-.822-1.133zM96.52 32.128l.57 1.279-3.198 1.423-.57-1.278zM11.109 70.161l.569 1.279-3.197 1.423-.57-1.279zM98.407 36.85l.433 1.332-3.33 1.081-.432-1.331zM9.483 65.74l.432 1.33-3.329 1.082-.432-1.331zM99.795 41.726l.291 1.37-3.423.727-.29-1.37zM8.34 61.17l.292 1.37-3.424.728-.29-1.37zM100.66 46.73l.146 1.393-3.48.366-.147-1.392zM7.674 56.506l.146 1.392-3.48.366-.147-1.392zM100.811 56.873l-.146 1.392-3.48-.365.145-1.393zM7.821 47.101l-.146 1.392-3.48-.365.145-1.393zM100.09 61.895l-.291 1.369-3.424-.728.291-1.369zM8.631 42.46l-.291 1.37-3.423-.728.29-1.37zM98.84 66.827l-.432 1.331-3.329-1.081.433-1.332zM9.918 37.93l-.433 1.331-3.329-1.082.433-1.331zM97.098 71.585l-.569 1.28-3.197-1.424.57-1.28zM11.677 33.558l-.57 1.28-3.197-1.424.57-1.279zM92.149 80.439l-.823 1.133-2.832-2.058.823-1.132zM16.506 25.482l-.823 1.133-2.831-2.057.823-1.133zM89.017 84.431l-.937 1.04-2.6-2.341.936-1.04zM19.528 21.869l-.936 1.04-2.601-2.342.936-1.04zM85.48 88.076l-1.041.936-2.342-2.6 1.04-.937zM22.91 18.59l-1.04.937-2.341-2.601 1.04-.937zM81.574 91.328l-1.133.823-2.057-2.831 1.132-.823zM26.617 15.684l-1.133.823-2.057-2.832 1.132-.823zM72.873 96.524l-1.279.57-1.423-3.198 1.278-.57zM34.838 11.105l-1.279.57-1.423-3.198 1.279-.57zM68.151 98.405l-1.331.432-1.082-3.329 1.332-.432zM39.259 9.485l-1.332.433-1.081-3.33 1.331-.432zM63.272 99.799l-1.369.29-.728-3.422 1.37-.291zM43.83 8.337l-1.369.291-.727-3.423 1.37-.291zM58.27 100.662l-1.393.146-.366-3.48 1.393-.147zM48.494 7.672l-1.392.147-.366-3.481 1.392-.147z"/></g></g></svg>
5
+ `, S = `<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><path id="mod_clock_svg_hours" d="M55.7 64.5h-6.4l.6-44h5.2z"/></svg>
6
+ `, w = `<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><path d="M55.1,64.5h-5.2l0.8-58h3.6L55.1,64.5z"/></svg>
7
+ `, L = `<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><path d="M57.8,21.3c0-2.9-2.4-5.2-5.2-5.2s-5.3,2.3-5.3,5.2c0,2.7,2,4.8,4.5,5.2V69h1.5V26.5C55.8,26.2,57.8,24,57.8,21.3z"/></svg>
8
+ `, C = p`*,:before,:after{box-sizing:border-box}:host{--sbb-clock-hours-animation-start-angle: 0deg;--sbb-clock-seconds-animation-start-angle: 0deg;--sbb-clock-hours-animation-duration: 0s;--sbb-clock-seconds-animation-duration: 0s;--sbb-clock-animation-play-state: paused;--sbb-clock-seconds-hand-color: var(--sbb-color-red);display:block}.sbb-clock{position:relative;width:100%;height:100%;aspect-ratio:1/1;overflow:hidden;contain:content}.sbb-clock__face,.sbb-clock__hand-hours,.sbb-clock__hand-minutes,.sbb-clock__hand-seconds{position:absolute;top:0;right:0;bottom:0;left:0;transform-origin:center center;transform:rotate(0);transform-style:preserve-3d;backface-visibility:hidden}.sbb-clock__hand-minutes{transition:transform .2s cubic-bezier(.4,2.08,.55,.44)}@supports not (aspect-ratio: 1/1){.sbb-clock__hand-minutes{transform-origin:50% 49.625%}}.sbb-clock__hand-hours{animation-name:rotate;animation-duration:43200s;animation-iteration-count:infinite;animation-timing-function:linear;animation-play-state:var(--sbb-clock-animation-play-state)}.sbb-clock__hand-hours--initial-hour{animation-name:hand-hours-animation-initial-hour;animation-duration:var(--sbb-clock-hours-animation-duration);animation-play-state:var(--sbb-clock-animation-play-state);animation-iteration-count:1}.sbb-clock__hand-minutes--no-transition{transition:none}.sbb-clock__hand-seconds{animation-name:hand-seconds-animation;animation-duration:60s;animation-timing-function:linear;animation-play-state:var(--sbb-clock-animation-play-state);animation-iteration-count:infinite;fill:var(--sbb-clock-seconds-hand-color)}.sbb-clock__hand-seconds--initial-minute{animation-name:hand-seconds-animation-initial-minute;animation-duration:var(--sbb-clock-seconds-animation-duration);animation-play-state:var(--sbb-clock-animation-play-state);animation-iteration-count:1}:host(:not([data-initialized])) :is(.sbb-clock__hand-hours,.sbb-clock__hand-minutes,.sbb-clock__hand-seconds){display:none}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes hand-hours-animation-initial-hour{0%{transform:rotate(var(--sbb-clock-hours-animation-start-angle))}to{transform:rotate(360deg)}}@keyframes hand-seconds-animation{0%{transform:rotate(0)}97.5%,to{transform:rotate(360deg)}}@keyframes hand-seconds-animation-initial-minute{0%{transform:rotate(var(--sbb-clock-seconds-animation-start-angle))}97.5%,to{transform:rotate(360deg)}}`;
9
+ var E = Object.defineProperty, A = Object.getOwnPropertyDescriptor, k = (t, n, s, i) => {
10
+ for (var o = i > 1 ? void 0 : i ? A(n, s) : n, e = t.length - 1, a; e >= 0; e--)
11
+ (a = t[e]) && (o = (i ? a(n, s, o) : a(o)) || o);
12
+ return i && o && E(n, s, o), o;
13
13
  };
14
- const P = 12, T = 60, b = 60, N = 50, v = 360, M = 30, F = 6, I = 360 / 58.5, x = 60, U = 3600, k = {
14
+ const O = 12, P = 60, u = 60, T = 50, b = 360, v = 30, N = 6, F = 360 / 58.5, I = 60, x = 3600, M = {
15
15
  once: !0,
16
16
  passive: !0
17
17
  };
18
- let c = class extends g {
18
+ let c = class extends H {
19
19
  constructor() {
20
20
  super(...arguments), this.now = null, this._moveHoursHandFn = () => this._moveHoursHand(), this._moveMinutesHandFn = () => this._moveMinutesHand(), this._handlePageVisibilityChange = async () => {
21
21
  document.visibilityState === "hidden" ? await this._stopClock() : this.now || await this._startClock();
22
22
  };
23
23
  }
24
- willUpdate(t) {
25
- super.willUpdate(t), !u && t.has("now") && (this.now ? (this._removeSecondsAnimationStyles(), this._removeHoursAnimationStyles(), this._stopClock()) : this._startClock());
24
+ async willUpdate(t) {
25
+ super.willUpdate(t), !_ && t.has("now") && await this._startOrConfigureClock();
26
26
  }
27
- _addEventListeners() {
28
- document.addEventListener("visibilitychange", this._handlePageVisibilityChange, !1);
27
+ async firstUpdated(t) {
28
+ super.firstUpdated(t), _ || (document.addEventListener("visibilitychange", this._handlePageVisibilityChange, !1), await this._startOrConfigureClock());
29
29
  }
30
- _removeEventListeners() {
31
- var t, s;
32
- document == null || document.removeEventListener("visibilitychange", this._handlePageVisibilityChange), (t = this._clockHandHours) == null || t.removeEventListener("animationend", this._moveHoursHandFn), (s = this._clockHandSeconds) == null || s.removeEventListener("animationend", this._moveMinutesHandFn), clearInterval(this._handMovement);
30
+ disconnectedCallback() {
31
+ super.disconnectedCallback(), this._removeEventListeners();
33
32
  }
34
- _removeHoursAnimationStyles() {
35
- var t;
36
- (t = this._clockHandHours) == null || t.classList.remove("sbb-clock__hand-hours--initial-hour"), this.style.removeProperty("--sbb-clock-hours-animation-start-angle"), this.style.removeProperty("--sbb-clock-hours-animation-duration");
33
+ async _startOrConfigureClock() {
34
+ this.now ? (await this._stopClock(), this._resetSecondsHandAnimation(), this._setHandsStartingPosition()) : await this._startClock();
37
35
  }
38
- _removeSecondsAnimationStyles() {
39
- var t, s;
40
- (t = this._clockHandSeconds) == null || t.classList.remove("sbb-clock__hand-seconds--initial-minute"), (s = this._clockHandMinutes) == null || s.classList.remove("sbb-clock__hand-minutes--no-transition"), this.style.removeProperty("--sbb-clock-seconds-animation-start-angle"), this.style.removeProperty("--sbb-clock-seconds-animation-duration");
36
+ /** Starts the clock by defining the hands starting position then starting the animations. */
37
+ async _startClock() {
38
+ var t, n;
39
+ (t = this._clockHandHours) == null || t.addEventListener(
40
+ "animationend",
41
+ this._moveHoursHandFn,
42
+ M
43
+ ), (n = this._clockHandSeconds) == null || n.addEventListener(
44
+ "animationend",
45
+ this._moveMinutesHandFn,
46
+ M
47
+ ), await new Promise(
48
+ () => setTimeout(() => {
49
+ var s;
50
+ this._setHandsStartingPosition(), (s = this.style) == null || s.setProperty("--sbb-clock-animation-play-state", "running");
51
+ }, T)
52
+ );
41
53
  }
42
- /** Given the current date, calculates the hh/mm/ss values and the hh/mm/ss left to the next midnight. */
43
- _assignCurrentTime() {
44
- const t = this.now ? null : /* @__PURE__ */ new Date(), [s, o, i] = t ? [t.getHours(), t.getMinutes(), t.getSeconds()] : this.now.split(":").map((n) => +n);
45
- this._hours = s % 12, this._minutes = o, this._seconds = i;
54
+ /** Stops the clock by removing all the animations. */
55
+ async _stopClock() {
56
+ var t, n, s, i;
57
+ clearInterval(this._handMovement), this._removeSecondsAnimationStyles(), this._removeHoursAnimationStyles(), (t = this._clockHandHours) == null || t.removeEventListener("animationend", this._moveHoursHandFn), (n = this._clockHandSeconds) == null || n.removeEventListener("animationend", this._moveMinutesHandFn), (s = this._clockHandMinutes) == null || s.classList.add("sbb-clock__hand-minutes--no-transition"), (i = this.style) == null || i.setProperty("--sbb-clock-animation-play-state", "paused");
46
58
  }
47
59
  /** Set the starting position for the three hands on the clock face. */
48
60
  _setHandsStartingPosition() {
49
- var e, a, r, d, h, m, _;
61
+ var e, a, l, d, h, m;
50
62
  this._assignCurrentTime();
51
- const t = b - this._seconds, s = T - this._minutes, o = P - this._hours;
52
- let i = 0, n = 0;
53
- t > 0 && (i += t, n = 1), s > 0 && (i += (s - n) * x, n = 1), o > 0 && (i += (o - n) * U), (e = this.style) == null || e.setProperty(
63
+ const t = u - this._seconds, n = P - this._minutes, s = O - this._hours;
64
+ let i = 0, o = 0;
65
+ t > 0 && (i += t, o = 1), n > 0 && (i += (n - o) * I, o = 1), s > 0 && (i += (s - o) * x), (e = this.style) == null || e.setProperty(
54
66
  "--sbb-clock-hours-animation-start-angle",
55
- `${Math.ceil(this._hours * M + this._minutes / 2)}deg`
56
- ), (a = this.style) == null || a.setProperty("--sbb-clock-hours-animation-duration", `${i}s`), (r = this.style) == null || r.setProperty(
67
+ `${Math.ceil(this._hours * v + this._minutes / 2)}deg`
68
+ ), (a = this.style) == null || a.setProperty("--sbb-clock-hours-animation-duration", `${i}s`), (l = this.style) == null || l.setProperty(
57
69
  "--sbb-clock-seconds-animation-start-angle",
58
- `${Math.ceil(this._seconds * I)}deg`
59
- ), (d = this.style) == null || d.setProperty("--sbb-clock-seconds-animation-duration", `${t}s`), this._setMinutesHand(), (h = this._clockHandSeconds) == null || h.classList.add("sbb-clock__hand-seconds--initial-minute"), (m = this._clockHandHours) == null || m.classList.add("sbb-clock__hand-hours--initial-hour"), (_ = this.style) == null || _.setProperty("--sbb-clock-animation-play-state", "running"), this.toggleAttribute("data-initialized", !0);
70
+ `${Math.ceil(this._seconds * F)}deg`
71
+ ), (d = this.style) == null || d.setProperty("--sbb-clock-seconds-animation-duration", `${t}s`), this._setMinutesHand(), (h = this._clockHandSeconds) == null || h.classList.add("sbb-clock__hand-seconds--initial-minute"), (m = this._clockHandHours) == null || m.classList.add("sbb-clock__hand-hours--initial-hour"), this.toggleAttribute("data-initialized", !0);
72
+ }
73
+ /** Given the current date, calculates the hh/mm/ss values and the hh/mm/ss left to the next midnight. */
74
+ _assignCurrentTime() {
75
+ const t = this.now ? null : /* @__PURE__ */ new Date(), [n, s, i] = t ? [t.getHours(), t.getMinutes(), t.getSeconds()] : this.now.split(":").map((o) => +o);
76
+ this._hours = n % 12, this._minutes = s, this._seconds = i;
60
77
  }
61
78
  /** Set the starting position for the minutes hand. */
62
79
  _setMinutesHand() {
63
80
  var t;
64
81
  (t = this._clockHandMinutes) == null || t.style.setProperty(
65
82
  "transform",
66
- `rotateZ(${Math.ceil(this._minutes * F)}deg)`
83
+ `rotateZ(${Math.ceil(this._minutes * N)}deg)`
67
84
  );
68
85
  }
69
86
  /** Move the hours hand to the next value. */
70
87
  _moveHoursHand() {
71
- var s;
88
+ var n;
72
89
  this._removeHoursAnimationStyles();
73
- let t = Math.ceil(this._hours * M + this._minutes / 2);
74
- t >= v && (t -= v), (s = this._clockHandHours) == null || s.style.setProperty("transform", `rotateZ(${t}deg)`);
90
+ let t = Math.ceil(this._hours * v + this._minutes / 2);
91
+ t >= b && (t -= b), (n = this._clockHandHours) == null || n.style.setProperty("transform", `rotateZ(${t}deg)`);
75
92
  }
76
93
  /** Move the minutes hand to the next value. */
77
94
  _moveMinutesHand() {
78
95
  var t;
79
96
  (t = this._clockHandSeconds) == null || t.removeEventListener("animationend", this._moveMinutesHandFn), this._removeSecondsAnimationStyles(), this._addMinutesAndSetHands(), this._handMovement = setInterval(
80
97
  () => this._addMinutesAndSetHands(),
81
- b * 1e3
98
+ u * 1e3
82
99
  );
83
100
  }
84
101
  _addMinutesAndSetHands() {
85
102
  this._minutes++, this._setMinutesHand();
86
103
  }
87
- /** Stops the clock by removing all the animations. */
88
- async _stopClock() {
89
- var t, s, o, i, n, e;
90
- clearInterval(this._handMovement), this.now ? (this._setHandsStartingPosition(), await new Promise((a) => setTimeout(a)), (t = this._clockHandSeconds) == null || t.classList.add("sbb-clock__hand-seconds--initial-minute"), (s = this._clockHandHours) == null || s.classList.add("sbb-clock__hand-hours--initial-hour")) : (this._removeSecondsAnimationStyles(), this._removeHoursAnimationStyles()), (o = this._clockHandHours) == null || o.removeEventListener("animationend", this._moveHoursHandFn), (i = this._clockHandSeconds) == null || i.removeEventListener("animationend", this._moveMinutesHandFn), (n = this._clockHandMinutes) == null || n.classList.add("sbb-clock__hand-minutes--no-transition"), (e = this.style) == null || e.setProperty("--sbb-clock-animation-play-state", "paused");
104
+ /**
105
+ * Removing animation by overriding with empty string,
106
+ * then triggering a reflow and re add original animation by removing override.
107
+ * @private
108
+ */
109
+ _resetSecondsHandAnimation() {
110
+ this._clockHandSeconds && (this._clockHandSeconds.style.animation = "", this._clockHandSeconds.offsetHeight, this._clockHandSeconds.style.removeProperty("animation"));
91
111
  }
92
- /** Starts the clock by defining the hands starting position then starting the animations. */
93
- async _startClock() {
94
- var t, s;
95
- (t = this._clockHandHours) == null || t.addEventListener(
96
- "animationend",
97
- this._moveHoursHandFn,
98
- k
99
- ), (s = this._clockHandSeconds) == null || s.addEventListener(
100
- "animationend",
101
- this._moveMinutesHandFn,
102
- k
103
- ), await new Promise(
104
- () => setTimeout(() => this._setHandsStartingPosition(), N)
105
- );
112
+ _removeEventListeners() {
113
+ var t, n;
114
+ document == null || document.removeEventListener("visibilitychange", this._handlePageVisibilityChange), (t = this._clockHandHours) == null || t.removeEventListener("animationend", this._moveHoursHandFn), (n = this._clockHandSeconds) == null || n.removeEventListener("animationend", this._moveMinutesHandFn), clearInterval(this._handMovement);
106
115
  }
107
- async firstUpdated(t) {
108
- super.firstUpdated(t), u || (this._addEventListeners(), this.now ? await this._stopClock() : await this._startClock());
116
+ _removeHoursAnimationStyles() {
117
+ var t;
118
+ (t = this._clockHandHours) == null || t.classList.remove("sbb-clock__hand-hours--initial-hour"), this.style.removeProperty("--sbb-clock-hours-animation-start-angle"), this.style.removeProperty("--sbb-clock-hours-animation-duration");
109
119
  }
110
- disconnectedCallback() {
111
- super.disconnectedCallback(), this._removeEventListeners();
120
+ _removeSecondsAnimationStyles() {
121
+ var t, n;
122
+ (t = this._clockHandSeconds) == null || t.classList.remove("sbb-clock__hand-seconds--initial-minute"), (n = this._clockHandMinutes) == null || n.classList.remove("sbb-clock__hand-minutes--no-transition"), this.style.removeProperty("--sbb-clock-seconds-animation-start-angle"), this.style.removeProperty("--sbb-clock-seconds-animation-duration");
112
123
  }
113
124
  render() {
114
- return z`
125
+ return g`
115
126
  <div class="sbb-clock">
116
- <span class="sbb-clock__face" .innerHTML=${S}></span>
127
+ <span class="sbb-clock__face" .innerHTML=${z}></span>
117
128
  <span
118
129
  class="sbb-clock__hand-hours"
119
- .innerHTML=${w}
120
- ${l((t) => {
130
+ .innerHTML=${S}
131
+ ${r((t) => {
121
132
  this._clockHandHours = t;
122
133
  })}
123
134
  ></span>
124
135
  <span
125
136
  class="sbb-clock__hand-minutes sbb-clock__hand-minutes--no-transition"
126
- .innerHTML=${L}
127
- ${l((t) => {
137
+ .innerHTML=${w}
138
+ ${r((t) => {
128
139
  this._clockHandMinutes = t;
129
140
  })}
130
141
  ></span>
131
142
  <span
132
143
  class="sbb-clock__hand-seconds"
133
- .innerHTML=${E}
134
- ${l((t) => {
144
+ .innerHTML=${L}
145
+ ${r((t) => {
135
146
  this._clockHandSeconds = t;
136
147
  })}
137
148
  ></span>
@@ -140,10 +151,10 @@ let c = class extends g {
140
151
  }
141
152
  };
142
153
  c.styles = C;
143
- p([
154
+ k([
144
155
  y()
145
156
  ], c.prototype, "now", 2);
146
- c = p([
157
+ c = k([
147
158
  f("sbb-clock")
148
159
  ], c);
149
160
  export {
@@ -30,12 +30,13 @@ export declare abstract class DateAdapter<T = any> {
30
30
  * @param date
31
31
  */
32
32
  abstract getDayOfWeek(date: T): number;
33
+ /** Get the first day of the week (0: sunday; 1: monday; etc.). */
33
34
  abstract getFirstDayOfWeek(): number;
34
35
  /**
35
36
  * Get the number of days in a month.
36
37
  * @param year
37
38
  * @param month
38
- * */
39
+ */
39
40
  abstract getNumDaysInMonth(date: T): number;
40
41
  /**
41
42
  * Get a list of all the months in a given style.
@@ -54,18 +55,19 @@ export declare abstract class DateAdapter<T = any> {
54
55
  /**
55
56
  * Checks whether a given `date` is valid.
56
57
  * @param date
57
- * */
58
+ */
58
59
  abstract isValid(date: T | null | undefined): boolean;
59
- /** Creates a new date by cloning the given one.
60
+ /**
61
+ * Creates a new date by cloning the given one.
60
62
  * @param date
61
- * */
63
+ */
62
64
  abstract clone(date: T): T;
63
65
  /**
64
66
  * Creates a new date, given day, month and year; without date's overflow.
65
67
  * @param year
66
68
  * @param month The month of the date (1-indexed, 1 = January). Must be an integer 1 - 12.
67
69
  * @param date
68
- * */
70
+ */
69
71
  abstract createDate(year: number, month: number, date: number): T;
70
72
  /**
71
73
  * Attempts to deserialize a value to a valid date object. This is different from parsing in that
@@ -74,7 +76,7 @@ export declare abstract class DateAdapter<T = any> {
74
76
  * the given value is already a valid date object or null.
75
77
  * @param value Either Date, ISOString, Unix Timestamp (number of seconds since Jan 1, 1970).
76
78
  * @returns The date if the input is valid, `null` otherwise.
77
- * */
79
+ */
78
80
  deserialize(value: T | string | number | null | undefined): T | null;
79
81
  /**
80
82
  * Creates a new date adding the number of provided `years` to the provided `date`.
@@ -90,26 +92,33 @@ export declare abstract class DateAdapter<T = any> {
90
92
  * @param months The number of months to add.
91
93
  */
92
94
  abstract addCalendarMonths(date: T, months: number): T;
93
- /** Creates a new date by adding the number of provided `days` to the provided `date`.
95
+ /**
96
+ * Creates a new date by adding the number of provided `days` to the provided `date`.
94
97
  * @param date The starting date.
95
98
  * @param days The number of days to add.
96
99
  */
97
100
  abstract addCalendarDays(date: T, days: number): T;
98
- /** Get the date in the local format.
101
+ /**
102
+ * Get the date in the local format.
99
103
  * @param date The date to format
100
104
  * @returns The `date` in the local format as string.
101
105
  */
102
106
  abstract getAccessibilityFormatDate(date: T | string): string;
103
- /** Get the given string as Date.
107
+ /**
108
+ * Get the given string as Date.
104
109
  * @param value The date in the format DD.MM.YYYY.
105
110
  * @param now The current date as Date.
106
111
  */
107
112
  abstract parse(value: string | null | undefined, now: T): T | undefined;
108
- /** Format the given Date as string.
113
+ /**
114
+ * Format the given date as string.
109
115
  * @param date The date to format.
110
116
  */
111
- abstract format(date: T | null | undefined): string;
112
- /** Checks whether the given `obj` is a Date.
117
+ format(date: T | null | undefined, options?: {
118
+ weekdayStyle?: 'long' | 'short' | 'narrow';
119
+ }): string;
120
+ /**
121
+ * Checks whether the given `obj` is a Date.
113
122
  * @param obj The object to check.
114
123
  */
115
124
  abstract isDateInstance(obj: any): boolean;
@@ -118,7 +127,8 @@ export declare abstract class DateAdapter<T = any> {
118
127
  * @returns An invalid date.
119
128
  */
120
129
  abstract invalid(): T;
121
- /** Get the given date as ISO String.
130
+ /**
131
+ * Get the given date as ISO String.
122
132
  * @param date The date to convert to ISO String.
123
133
  */
124
134
  toIso8601(date: T): string;
@@ -1 +1 @@
1
- {"version":3,"file":"date-adapter.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/datetime/date-adapter.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,EAAE,MAAU,CAAC;AACtC,e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,IAAI,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,OAAO;IAY3D;;;;;;;OAOG;IACI,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC;CAS7D"}
@@ -59,7 +59,6 @@ export declare class NativeDateAdapter extends DateAdapter<Date> {
59
59
  deserialize(date: SbbDateLike | null | undefined): Date | null;
60
60
  /** Returns the right format for the `valueAsDate` property. */
61
61
  parse(value: string | null | undefined, now: Date): Date | undefined;
62
- format(value: Date | null | undefined): string;
63
62
  invalid(): Date;
64
63
  /**
65
64
  * Creates an array with the given length and fills it by mapping with the provided function.
@@ -1 +1 @@
1
- {"version":3,"file":"native-date-adapter.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/datetime/native-date-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAU7D,qBAAa,iBAAkB,SAAQ,WAAW,CAAC,IAAI,CAAC;IACtD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;gBAExB,gBAAgB,GAAE,MAAW;IAKhD,uCAAuC;IAChC,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAIlC,wCAAwC;IACjC,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAInC,sCAAsC;IAC/B,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAIlC,kDAAkD;IAC3C,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAIvC,yCAAyC;IAClC,0BAA0B,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM;IAS9D;;;;OAIG;IACI,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,EAA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,MAAM,GAAG,IAAI;IAmBlE,gDAAgD;IACzC,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO;IAIxC,uDAAuD;IAChD,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAItD,mDAAmD;IAC5C,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAI9B;;;;OAIG;IACI,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIxD;;;;OAIG;IACI,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAQ1D,yFAAyF;IAClF,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAKtD,6EAA6E;IAC7D,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI;IAkB9E,+DAA+D;IACxD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS;IA4B3D,OAAO,IAAI,IAAI;IAI/B;;;;OAIG;IACH,OAAO,CAAC,MAAM;IAId,gEAAgE;IAChE,OAAO,CAAC,uBAAuB;CAShC;AAED,eAAO,MAAM,kBAAkB,mBAA0B,CAAC"}
package/core/datetime.js CHANGED
@@ -8,11 +8,27 @@ class l {
8
8
  * the given value is already a valid date object or null.
9
9
  * @param value Either Date, ISOString, Unix Timestamp (number of seconds since Jan 1, 1970).
10
10
  * @returns The date if the input is valid, `null` otherwise.
11
- * */
11
+ */
12
12
  deserialize(t) {
13
13
  return t == null || this.isDateInstance(t) && this.isValid(t) ? t : this.invalid();
14
14
  }
15
- /** Get the given date as ISO String.
15
+ /**
16
+ * Format the given date as string.
17
+ * @param date The date to format.
18
+ */
19
+ format(t, e) {
20
+ if (!this.isValid(t))
21
+ return "";
22
+ const r = /* @__PURE__ */ new Date(this.toIso8601(t) + "T00:00:00"), a = new Intl.DateTimeFormat("de-CH", {
23
+ day: "2-digit",
24
+ month: "2-digit",
25
+ year: "numeric"
26
+ }), n = (e == null ? void 0 : e.weekdayStyle) ?? "short";
27
+ let s = this.getDayOfWeekNames(n)[this.getDayOfWeek(t)];
28
+ return s = s.charAt(0).toUpperCase() + s.substring(1), n === "short" && (s = s.substring(0, 2)), `${s}, ${a.format(r)}`;
29
+ }
30
+ /**
31
+ * Get the given date as ISO String.
16
32
  * @param date The date to convert to ISO String.
17
33
  */
18
34
  toIso8601(t) {
@@ -72,7 +88,7 @@ class l {
72
88
  }
73
89
  }
74
90
  const D = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/;
75
- class c extends l {
91
+ class g extends l {
76
92
  constructor(t = 15) {
77
93
  super(), this._cutoffYearOffset = t;
78
94
  }
@@ -187,7 +203,7 @@ class c extends l {
187
203
  if (t)
188
204
  if (Number.isNaN(+t)) {
189
205
  if (D.test(t))
190
- return this.getValidDateOrNull(new Date(t));
206
+ return this.getValidDateOrNull(new Date(t.includes("T") ? t : t + "T00:00:00"));
191
207
  } else return this.getValidDateOrNull(new Date(+t * 1e3));
192
208
  else return null;
193
209
  else if (typeof t == "number")
@@ -208,19 +224,6 @@ class c extends l {
208
224
  }
209
225
  return new Date(n, +a[2] - 1, +a[1]);
210
226
  }
211
- format(t) {
212
- if (!t)
213
- return "";
214
- const e = `${i.current}-CH`, r = new Intl.DateTimeFormat("de-CH", {
215
- day: "2-digit",
216
- month: "2-digit",
217
- year: "numeric"
218
- });
219
- let n = new Intl.DateTimeFormat(e, {
220
- weekday: "short"
221
- }).format(t);
222
- return n = n.charAt(0).toUpperCase() + n.charAt(1), `${n}, ${r.format(t)}`;
223
- }
224
227
  invalid() {
225
228
  return /* @__PURE__ */ new Date(NaN);
226
229
  }
@@ -230,10 +233,7 @@ class c extends l {
230
233
  * @param valueFunction The function of array's index used to fill the array.
231
234
  */
232
235
  _range(t, e) {
233
- const r = Array(t);
234
- for (let a = 0; a < t; a++)
235
- r[a] = e(a);
236
- return r;
236
+ return Array.from({ length: t }).map((r, a) => e(a));
237
237
  }
238
238
  /** Creates a date but allows the month and date to overflow. */
239
239
  _createDateWithOverflow(t, e, r) {
@@ -241,13 +241,13 @@ class c extends l {
241
241
  return t >= 0 && t < 100 && a.setFullYear(this.getYear(a) - 1900), a;
242
242
  }
243
243
  }
244
- const w = new c();
244
+ const w = new g();
245
245
  export {
246
246
  o as DAYS_PER_ROW,
247
247
  l as DateAdapter,
248
248
  u as FORMAT_DATE,
249
249
  f as MONTHS_PER_ROW,
250
- c as NativeDateAdapter,
250
+ g as NativeDateAdapter,
251
251
  d as YEARS_PER_PAGE,
252
252
  m as YEARS_PER_ROW,
253
253
  w as defaultDateAdapter
@@ -8,10 +8,10 @@ import { AbstractConstructor } from '../mixins.js';
8
8
  *
9
9
  * @example
10
10
  *
11
+ * @customElement('my-element)
11
12
  * @hostAttributes({
12
13
  * role: 'region'
13
14
  * })
14
- * @customElement('my-element)
15
15
  * export class MyElement extends LitElement {
16
16
  * ...
17
17
  * }
@@ -0,0 +1,18 @@
1
+ import { ReactiveElement } from 'lit';
2
+ import { AbstractConstructor } from '../mixins.js';
3
+
4
+ /**
5
+ * Adds the {@link SbbSlotStateController} to the related element.
6
+ *
7
+ * @example
8
+ *
9
+ * @customElement('my-element)
10
+ * @slotState()
11
+ * export class MyElement extends LitElement {
12
+ * ...
13
+ * }
14
+ *
15
+ * @param attributes A record of attributes to apply to the element.
16
+ */
17
+ export declare const slotState: () => (target: AbstractConstructor<ReactiveElement>) => void;
18
+ //# sourceMappingURL=slot-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot-state.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/decorators/slot-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,KAAK,CAAC;AAGrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,iBAAkB,mBAAmB,CAAC,eAAe,CAAC,SAM3E,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './decorators/host-attributes.js';
2
+ export * from './decorators/slot-state.js';
2
3
  //# sourceMappingURL=decorators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/elements/core/decorators.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/elements/core/decorators.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC"}
@@ -1,18 +1,24 @@
1
1
  import { isServer as i } from "lit";
2
- function l(o, t) {
3
- for (const [e, r] of Object.entries(t))
4
- r ? o.setAttribute(e, r) : o.toggleAttribute(e, r !== null);
2
+ import { SbbSlotStateController as d } from "./controllers.js";
3
+ function l(o, e) {
4
+ for (const [t, r] of Object.entries(e))
5
+ r ? o.setAttribute(t, r) : o.toggleAttribute(t, r !== null);
5
6
  }
6
- const f = (o) => (t) => t.addInitializer((e) => {
7
- i ? l(e, o) : e.addController({
7
+ const m = (o) => (e) => e.addInitializer((t) => {
8
+ i ? l(t, o) : t.addController({
8
9
  hostConnected() {
9
- l(e, o), e.removeController(this);
10
+ l(t, o), t.removeController(this);
10
11
  },
11
12
  hostUpdate() {
12
- l(e, o), e.removeController(this);
13
+ l(t, o), t.removeController(this);
13
14
  }
14
15
  });
15
- });
16
+ }), p = () => (o) => {
17
+ i || o.addInitializer(
18
+ (e) => new d(e)
19
+ );
20
+ };
16
21
  export {
17
- f as hostAttributes
22
+ m as hostAttributes,
23
+ p as slotState
18
24
  };