@4sh/ui-kit 0.1.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 (202) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +7 -0
  3. package/README.md +229 -0
  4. package/fesm2022/4sh-ui-kit-forms.mjs +501 -0
  5. package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -0
  6. package/fesm2022/4sh-ui-kit-motion.mjs +155 -0
  7. package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -0
  8. package/fesm2022/4sh-ui-kit-overlay.mjs +61 -0
  9. package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -0
  10. package/fesm2022/4sh-ui-kit-theming.mjs +120 -0
  11. package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -0
  12. package/fesm2022/4sh-ui-kit-types.mjs +12 -0
  13. package/fesm2022/4sh-ui-kit-types.mjs.map +1 -0
  14. package/fesm2022/4sh-ui-kit-ui-accordion.mjs +244 -0
  15. package/fesm2022/4sh-ui-kit-ui-accordion.mjs.map +1 -0
  16. package/fesm2022/4sh-ui-kit-ui-alert.mjs +160 -0
  17. package/fesm2022/4sh-ui-kit-ui-alert.mjs.map +1 -0
  18. package/fesm2022/4sh-ui-kit-ui-autocomplete.mjs +926 -0
  19. package/fesm2022/4sh-ui-kit-ui-autocomplete.mjs.map +1 -0
  20. package/fesm2022/4sh-ui-kit-ui-avatar-group.mjs +34 -0
  21. package/fesm2022/4sh-ui-kit-ui-avatar-group.mjs.map +1 -0
  22. package/fesm2022/4sh-ui-kit-ui-avatar.mjs +122 -0
  23. package/fesm2022/4sh-ui-kit-ui-avatar.mjs.map +1 -0
  24. package/fesm2022/4sh-ui-kit-ui-badge.mjs +95 -0
  25. package/fesm2022/4sh-ui-kit-ui-badge.mjs.map +1 -0
  26. package/fesm2022/4sh-ui-kit-ui-breadcrumb.mjs +190 -0
  27. package/fesm2022/4sh-ui-kit-ui-breadcrumb.mjs.map +1 -0
  28. package/fesm2022/4sh-ui-kit-ui-button-split.mjs +151 -0
  29. package/fesm2022/4sh-ui-kit-ui-button-split.mjs.map +1 -0
  30. package/fesm2022/4sh-ui-kit-ui-button.mjs +222 -0
  31. package/fesm2022/4sh-ui-kit-ui-button.mjs.map +1 -0
  32. package/fesm2022/4sh-ui-kit-ui-card.mjs +164 -0
  33. package/fesm2022/4sh-ui-kit-ui-card.mjs.map +1 -0
  34. package/fesm2022/4sh-ui-kit-ui-checkbox.mjs +118 -0
  35. package/fesm2022/4sh-ui-kit-ui-checkbox.mjs.map +1 -0
  36. package/fesm2022/4sh-ui-kit-ui-chip.mjs +205 -0
  37. package/fesm2022/4sh-ui-kit-ui-chip.mjs.map +1 -0
  38. package/fesm2022/4sh-ui-kit-ui-context-menu.mjs +219 -0
  39. package/fesm2022/4sh-ui-kit-ui-context-menu.mjs.map +1 -0
  40. package/fesm2022/4sh-ui-kit-ui-datepicker.mjs +1508 -0
  41. package/fesm2022/4sh-ui-kit-ui-datepicker.mjs.map +1 -0
  42. package/fesm2022/4sh-ui-kit-ui-drawer.mjs +300 -0
  43. package/fesm2022/4sh-ui-kit-ui-drawer.mjs.map +1 -0
  44. package/fesm2022/4sh-ui-kit-ui-empty-state.mjs +148 -0
  45. package/fesm2022/4sh-ui-kit-ui-empty-state.mjs.map +1 -0
  46. package/fesm2022/4sh-ui-kit-ui-field.mjs +102 -0
  47. package/fesm2022/4sh-ui-kit-ui-field.mjs.map +1 -0
  48. package/fesm2022/4sh-ui-kit-ui-file-upload.mjs +568 -0
  49. package/fesm2022/4sh-ui-kit-ui-file-upload.mjs.map +1 -0
  50. package/fesm2022/4sh-ui-kit-ui-helper.mjs +85 -0
  51. package/fesm2022/4sh-ui-kit-ui-helper.mjs.map +1 -0
  52. package/fesm2022/4sh-ui-kit-ui-icon.mjs +98 -0
  53. package/fesm2022/4sh-ui-kit-ui-icon.mjs.map +1 -0
  54. package/fesm2022/4sh-ui-kit-ui-image.mjs +201 -0
  55. package/fesm2022/4sh-ui-kit-ui-image.mjs.map +1 -0
  56. package/fesm2022/4sh-ui-kit-ui-input-group.mjs +119 -0
  57. package/fesm2022/4sh-ui-kit-ui-input-group.mjs.map +1 -0
  58. package/fesm2022/4sh-ui-kit-ui-input-mask.mjs +125 -0
  59. package/fesm2022/4sh-ui-kit-ui-input-mask.mjs.map +1 -0
  60. package/fesm2022/4sh-ui-kit-ui-input-number.mjs +234 -0
  61. package/fesm2022/4sh-ui-kit-ui-input-number.mjs.map +1 -0
  62. package/fesm2022/4sh-ui-kit-ui-input-otp.mjs +288 -0
  63. package/fesm2022/4sh-ui-kit-ui-input-otp.mjs.map +1 -0
  64. package/fesm2022/4sh-ui-kit-ui-input-tags.mjs +679 -0
  65. package/fesm2022/4sh-ui-kit-ui-input-tags.mjs.map +1 -0
  66. package/fesm2022/4sh-ui-kit-ui-input.mjs +121 -0
  67. package/fesm2022/4sh-ui-kit-ui-input.mjs.map +1 -0
  68. package/fesm2022/4sh-ui-kit-ui-label.mjs +61 -0
  69. package/fesm2022/4sh-ui-kit-ui-label.mjs.map +1 -0
  70. package/fesm2022/4sh-ui-kit-ui-link.mjs +147 -0
  71. package/fesm2022/4sh-ui-kit-ui-link.mjs.map +1 -0
  72. package/fesm2022/4sh-ui-kit-ui-menu.mjs +484 -0
  73. package/fesm2022/4sh-ui-kit-ui-menu.mjs.map +1 -0
  74. package/fesm2022/4sh-ui-kit-ui-modal.mjs +555 -0
  75. package/fesm2022/4sh-ui-kit-ui-modal.mjs.map +1 -0
  76. package/fesm2022/4sh-ui-kit-ui-nudger.mjs +168 -0
  77. package/fesm2022/4sh-ui-kit-ui-nudger.mjs.map +1 -0
  78. package/fesm2022/4sh-ui-kit-ui-paginator.mjs +245 -0
  79. package/fesm2022/4sh-ui-kit-ui-paginator.mjs.map +1 -0
  80. package/fesm2022/4sh-ui-kit-ui-popover.mjs +296 -0
  81. package/fesm2022/4sh-ui-kit-ui-popover.mjs.map +1 -0
  82. package/fesm2022/4sh-ui-kit-ui-progress-bar.mjs +124 -0
  83. package/fesm2022/4sh-ui-kit-ui-progress-bar.mjs.map +1 -0
  84. package/fesm2022/4sh-ui-kit-ui-radio.mjs +92 -0
  85. package/fesm2022/4sh-ui-kit-ui-radio.mjs.map +1 -0
  86. package/fesm2022/4sh-ui-kit-ui-rating.mjs +185 -0
  87. package/fesm2022/4sh-ui-kit-ui-rating.mjs.map +1 -0
  88. package/fesm2022/4sh-ui-kit-ui-read-only.mjs +146 -0
  89. package/fesm2022/4sh-ui-kit-ui-read-only.mjs.map +1 -0
  90. package/fesm2022/4sh-ui-kit-ui-segment-control.mjs +386 -0
  91. package/fesm2022/4sh-ui-kit-ui-segment-control.mjs.map +1 -0
  92. package/fesm2022/4sh-ui-kit-ui-select.mjs +868 -0
  93. package/fesm2022/4sh-ui-kit-ui-select.mjs.map +1 -0
  94. package/fesm2022/4sh-ui-kit-ui-separator.mjs +77 -0
  95. package/fesm2022/4sh-ui-kit-ui-separator.mjs.map +1 -0
  96. package/fesm2022/4sh-ui-kit-ui-sidebar.mjs +577 -0
  97. package/fesm2022/4sh-ui-kit-ui-sidebar.mjs.map +1 -0
  98. package/fesm2022/4sh-ui-kit-ui-skeleton.mjs +81 -0
  99. package/fesm2022/4sh-ui-kit-ui-skeleton.mjs.map +1 -0
  100. package/fesm2022/4sh-ui-kit-ui-slider.mjs +340 -0
  101. package/fesm2022/4sh-ui-kit-ui-slider.mjs.map +1 -0
  102. package/fesm2022/4sh-ui-kit-ui-spinner.mjs +132 -0
  103. package/fesm2022/4sh-ui-kit-ui-spinner.mjs.map +1 -0
  104. package/fesm2022/4sh-ui-kit-ui-stepper.mjs +389 -0
  105. package/fesm2022/4sh-ui-kit-ui-stepper.mjs.map +1 -0
  106. package/fesm2022/4sh-ui-kit-ui-table.mjs +1406 -0
  107. package/fesm2022/4sh-ui-kit-ui-table.mjs.map +1 -0
  108. package/fesm2022/4sh-ui-kit-ui-tabs.mjs +503 -0
  109. package/fesm2022/4sh-ui-kit-ui-tabs.mjs.map +1 -0
  110. package/fesm2022/4sh-ui-kit-ui-tag.mjs +84 -0
  111. package/fesm2022/4sh-ui-kit-ui-tag.mjs.map +1 -0
  112. package/fesm2022/4sh-ui-kit-ui-textarea.mjs +119 -0
  113. package/fesm2022/4sh-ui-kit-ui-textarea.mjs.map +1 -0
  114. package/fesm2022/4sh-ui-kit-ui-toast.mjs +424 -0
  115. package/fesm2022/4sh-ui-kit-ui-toast.mjs.map +1 -0
  116. package/fesm2022/4sh-ui-kit-ui-toggle.mjs +120 -0
  117. package/fesm2022/4sh-ui-kit-ui-toggle.mjs.map +1 -0
  118. package/fesm2022/4sh-ui-kit-ui-tooltip.mjs +445 -0
  119. package/fesm2022/4sh-ui-kit-ui-tooltip.mjs.map +1 -0
  120. package/fesm2022/4sh-ui-kit.mjs +16 -0
  121. package/fesm2022/4sh-ui-kit.mjs.map +1 -0
  122. package/package.json +287 -0
  123. package/styles/base/_base.scss +19 -0
  124. package/styles/base/_motion.scss +144 -0
  125. package/styles/base/_typography.scss +99 -0
  126. package/styles/generated/_tokens-breakpoint.scss +8 -0
  127. package/styles/generated/_tokens-metrics.scss +37 -0
  128. package/styles/generated/_tokens-primitives.scss +284 -0
  129. package/styles/generated/_tokens-responsive.scss +99 -0
  130. package/styles/generated/_tokens-semantics.scss +1274 -0
  131. package/styles/generated/_tokens-styles.scss +35 -0
  132. package/styles/generated/_tokens-transitions.scss +11 -0
  133. package/styles/generated/_tokens-typography.scss +14 -0
  134. package/styles/generated/_tokens.scss +10 -0
  135. package/styles/index.scss +25 -0
  136. package/styles/settings/_ui-config.scss +67 -0
  137. package/styles/utils/_functions.scss +67 -0
  138. package/styles/utils/_helpers.scss +129 -0
  139. package/styles/utils/_mixins.scss +186 -0
  140. package/styles/utils/_motion.scss +47 -0
  141. package/styles/utils/_overlay.scss +26 -0
  142. package/styles/utils.scss +15 -0
  143. package/styles.css +1 -0
  144. package/types/4sh-ui-kit-forms.d.ts +259 -0
  145. package/types/4sh-ui-kit-motion.d.ts +111 -0
  146. package/types/4sh-ui-kit-overlay.d.ts +31 -0
  147. package/types/4sh-ui-kit-theming.d.ts +54 -0
  148. package/types/4sh-ui-kit-types.d.ts +13 -0
  149. package/types/4sh-ui-kit-ui-accordion.d.ts +140 -0
  150. package/types/4sh-ui-kit-ui-alert.d.ts +89 -0
  151. package/types/4sh-ui-kit-ui-autocomplete.d.ts +411 -0
  152. package/types/4sh-ui-kit-ui-avatar-group.d.ts +17 -0
  153. package/types/4sh-ui-kit-ui-avatar.d.ts +55 -0
  154. package/types/4sh-ui-kit-ui-badge.d.ts +38 -0
  155. package/types/4sh-ui-kit-ui-breadcrumb.d.ts +131 -0
  156. package/types/4sh-ui-kit-ui-button-split.d.ts +102 -0
  157. package/types/4sh-ui-kit-ui-button.d.ts +91 -0
  158. package/types/4sh-ui-kit-ui-card.d.ts +102 -0
  159. package/types/4sh-ui-kit-ui-checkbox.d.ts +54 -0
  160. package/types/4sh-ui-kit-ui-chip.d.ts +114 -0
  161. package/types/4sh-ui-kit-ui-context-menu.d.ts +105 -0
  162. package/types/4sh-ui-kit-ui-datepicker.d.ts +539 -0
  163. package/types/4sh-ui-kit-ui-drawer.d.ts +147 -0
  164. package/types/4sh-ui-kit-ui-empty-state.d.ts +93 -0
  165. package/types/4sh-ui-kit-ui-field.d.ts +53 -0
  166. package/types/4sh-ui-kit-ui-file-upload.d.ts +268 -0
  167. package/types/4sh-ui-kit-ui-helper.d.ts +46 -0
  168. package/types/4sh-ui-kit-ui-icon.d.ts +69 -0
  169. package/types/4sh-ui-kit-ui-image.d.ts +88 -0
  170. package/types/4sh-ui-kit-ui-input-group.d.ts +54 -0
  171. package/types/4sh-ui-kit-ui-input-mask.d.ts +63 -0
  172. package/types/4sh-ui-kit-ui-input-number.d.ts +96 -0
  173. package/types/4sh-ui-kit-ui-input-otp.d.ts +130 -0
  174. package/types/4sh-ui-kit-ui-input-tags.d.ts +350 -0
  175. package/types/4sh-ui-kit-ui-input.d.ts +78 -0
  176. package/types/4sh-ui-kit-ui-label.d.ts +36 -0
  177. package/types/4sh-ui-kit-ui-link.d.ts +72 -0
  178. package/types/4sh-ui-kit-ui-menu.d.ts +235 -0
  179. package/types/4sh-ui-kit-ui-modal.d.ts +241 -0
  180. package/types/4sh-ui-kit-ui-nudger.d.ts +79 -0
  181. package/types/4sh-ui-kit-ui-paginator.d.ts +150 -0
  182. package/types/4sh-ui-kit-ui-popover.d.ts +125 -0
  183. package/types/4sh-ui-kit-ui-progress-bar.d.ts +82 -0
  184. package/types/4sh-ui-kit-ui-radio.d.ts +44 -0
  185. package/types/4sh-ui-kit-ui-rating.d.ts +90 -0
  186. package/types/4sh-ui-kit-ui-read-only.d.ts +70 -0
  187. package/types/4sh-ui-kit-ui-segment-control.d.ts +184 -0
  188. package/types/4sh-ui-kit-ui-select.d.ts +392 -0
  189. package/types/4sh-ui-kit-ui-separator.d.ts +43 -0
  190. package/types/4sh-ui-kit-ui-sidebar.d.ts +358 -0
  191. package/types/4sh-ui-kit-ui-skeleton.d.ts +52 -0
  192. package/types/4sh-ui-kit-ui-slider.d.ts +127 -0
  193. package/types/4sh-ui-kit-ui-spinner.d.ts +67 -0
  194. package/types/4sh-ui-kit-ui-stepper.d.ts +220 -0
  195. package/types/4sh-ui-kit-ui-table.d.ts +570 -0
  196. package/types/4sh-ui-kit-ui-tabs.d.ts +225 -0
  197. package/types/4sh-ui-kit-ui-tag.d.ts +46 -0
  198. package/types/4sh-ui-kit-ui-textarea.d.ts +61 -0
  199. package/types/4sh-ui-kit-ui-toast.d.ts +247 -0
  200. package/types/4sh-ui-kit-ui-toggle.d.ts +67 -0
  201. package/types/4sh-ui-kit-ui-tooltip.d.ts +167 -0
  202. package/types/4sh-ui-kit.d.ts +4 -0
@@ -0,0 +1,155 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, booleanAttribute, computed, Directive } from '@angular/core';
3
+
4
+ /** All preset keys, in declaration order (handy for stories/docs). */
5
+ const UI_MOTION_PRESETS = [
6
+ 'fade',
7
+ 'slide-up',
8
+ 'slide-down',
9
+ 'slide-left',
10
+ 'slide-right',
11
+ 'zoom',
12
+ 'collapse',
13
+ ];
14
+ /** CSS class to bind to `animate.enter` for a preset. */
15
+ const motionEnterClass = (preset) => `ui-motion-${preset}-enter`;
16
+ /** CSS class to bind to `animate.leave` for a preset. */
17
+ const motionLeaveClass = (preset) => `ui-motion-${preset}-leave`;
18
+ /**
19
+ * uiMotion — ergonomic wiring for the motion system on a conditionally
20
+ * rendered element (`@if`, `@for`, control-flow insert/remove).
21
+ *
22
+ * It selects an enter/leave **preset** and exposes the matching class names for
23
+ * Angular's native `animate.enter` / `animate.leave`, while letting you re-time
24
+ * a single instance through the `--ui-motion-*` custom properties — no extra
25
+ * CSS. Set `motionDisabled` (or the global `data-motion="off"` switch / the
26
+ * user's reduced-motion preference) to opt out.
27
+ *
28
+ * The enter/leave bindings stay in the template (Angular resolves them at the
29
+ * insertion/removal boundary); the directive supplies the class strings and the
30
+ * timing variables:
31
+ *
32
+ * @example
33
+ * ```html
34
+ * @if (open()) {
35
+ * <div class="panel"
36
+ * [uiMotion]="'zoom'" #m="uiMotion"
37
+ * [animate.enter]="m.enter()" [animate.leave]="m.leave()">…</div>
38
+ * }
39
+ *
40
+ * <!-- faster, custom easing, disabled on demand -->
41
+ * <div [uiMotion]="'slide-down'" motionDuration="120ms"
42
+ * [motionDisabled]="prefersStillness()" #m="uiMotion"
43
+ * [animate.enter]="m.enter()" [animate.leave]="m.leave()">…</div>
44
+ * ```
45
+ */
46
+ class UiMotion {
47
+ constructor() {
48
+ /** Motion preset (enter/leave pair). */
49
+ this.preset = input.required({ ...(ngDevMode ? { debugName: "preset" } : /* istanbul ignore next */ {}), alias: 'uiMotion' });
50
+ /** Override the duration for this element (e.g. `"120ms"`). */
51
+ this.motionDuration = input(/* @ts-ignore */
52
+ ...(ngDevMode ? [undefined, { debugName: "motionDuration" }] : /* istanbul ignore next */ []));
53
+ /** Override the delay before the animation starts (e.g. `"40ms"`). */
54
+ this.motionDelay = input(/* @ts-ignore */
55
+ ...(ngDevMode ? [undefined, { debugName: "motionDelay" }] : /* istanbul ignore next */ []));
56
+ /** Override both enter and leave easing (CSS timing function). */
57
+ this.motionEasing = input(/* @ts-ignore */
58
+ ...(ngDevMode ? [undefined, { debugName: "motionEasing" }] : /* istanbul ignore next */ []));
59
+ /** Override only the enter easing (falls back to `motionEasing`). */
60
+ this.motionEnterEasing = input(/* @ts-ignore */
61
+ ...(ngDevMode ? [undefined, { debugName: "motionEnterEasing" }] : /* istanbul ignore next */ []));
62
+ /** Override only the leave easing (falls back to `motionEasing`). */
63
+ this.motionLeaveEasing = input(/* @ts-ignore */
64
+ ...(ngDevMode ? [undefined, { debugName: "motionLeaveEasing" }] : /* istanbul ignore next */ []));
65
+ /** Override the slide offset for the directional presets (e.g. `"12px"`). */
66
+ this.motionDistance = input(/* @ts-ignore */
67
+ ...(ngDevMode ? [undefined, { debugName: "motionDistance" }] : /* istanbul ignore next */ []));
68
+ /** Override the start/end scale for the `zoom` preset (e.g. `0.9`). */
69
+ this.motionScale = input(/* @ts-ignore */
70
+ ...(ngDevMode ? [undefined, { debugName: "motionScale" }] : /* istanbul ignore next */ []));
71
+ /** Disable motion for this element (renders/removes with no animation). */
72
+ this.motionDisabled = input(false, { ...(ngDevMode ? { debugName: "motionDisabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
73
+ /**
74
+ * Play the enter preset through a class the directive applies itself, instead
75
+ * of binding `animate.enter` in the template — the preset classes are plain
76
+ * CSS animations, they need no framework hook to run once on insertion.
77
+ *
78
+ * **Mandatory for anything rendered in a CDK overlay** (dropdown panels,
79
+ * menus, popovers). `animate.enter` registers the node in Angular's animation
80
+ * queue, and that queue is unwound through the injector when the node goes
81
+ * away; if the application is torn down while the overlay is still attached,
82
+ * the unwind throws (`NG0205`) in the middle of the teardown and everything
83
+ * after it is skipped — including the overlay's own `dispose()`. The panel
84
+ * then stays in the document, detached from its anchor, in the top-left
85
+ * corner of whatever renders next. No queue, no orphan.
86
+ *
87
+ * Leave it off for content inserted by `@if` / `@for` in a normal view, where
88
+ * `animate.enter` also buys the leave animation.
89
+ */
90
+ this.motionOnInsert = input(false, { ...(ngDevMode ? { debugName: "motionOnInsert" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
91
+ /** Class to bind to `animate.enter` (empty when disabled → instant appear). */
92
+ this.enter = computed(() => (this.motionDisabled() ? '' : motionEnterClass(this.preset())), /* @ts-ignore */
93
+ ...(ngDevMode ? [{ debugName: "enter" }] : /* istanbul ignore next */ []));
94
+ /** Class to bind to `animate.leave` (empty when disabled → instant removal). */
95
+ this.leave = computed(() => (this.motionDisabled() ? '' : motionLeaveClass(this.preset())), /* @ts-ignore */
96
+ ...(ngDevMode ? [{ debugName: "leave" }] : /* istanbul ignore next */ []));
97
+ /** @ignore Enter class applied by the directive in `motionOnInsert` mode. */
98
+ this._insertClass = computed(() => (this.motionOnInsert() ? this.enter() : ''), /* @ts-ignore */
99
+ ...(ngDevMode ? [{ debugName: "_insertClass" }] : /* istanbul ignore next */ []));
100
+ /** @ignore */
101
+ this._duration = computed(() => this.motionDuration() ?? null, /* @ts-ignore */
102
+ ...(ngDevMode ? [{ debugName: "_duration" }] : /* istanbul ignore next */ []));
103
+ /** @ignore */
104
+ this._delay = computed(() => this.motionDelay() ?? null, /* @ts-ignore */
105
+ ...(ngDevMode ? [{ debugName: "_delay" }] : /* istanbul ignore next */ []));
106
+ /** @ignore */
107
+ this._enterEasing = computed(() => this.motionEnterEasing() ?? this.motionEasing() ?? null, /* @ts-ignore */
108
+ ...(ngDevMode ? [{ debugName: "_enterEasing" }] : /* istanbul ignore next */ []));
109
+ /** @ignore */
110
+ this._leaveEasing = computed(() => this.motionLeaveEasing() ?? this.motionEasing() ?? null, /* @ts-ignore */
111
+ ...(ngDevMode ? [{ debugName: "_leaveEasing" }] : /* istanbul ignore next */ []));
112
+ /** @ignore */
113
+ this._distance = computed(() => this.motionDistance() ?? null, /* @ts-ignore */
114
+ ...(ngDevMode ? [{ debugName: "_distance" }] : /* istanbul ignore next */ []));
115
+ /** @ignore */
116
+ this._scale = computed(() => {
117
+ const s = this.motionScale();
118
+ return s === undefined ? null : String(s);
119
+ }, /* @ts-ignore */
120
+ ...(ngDevMode ? [{ debugName: "_scale" }] : /* istanbul ignore next */ []));
121
+ }
122
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: UiMotion, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
123
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: UiMotion, isStandalone: true, selector: "[uiMotion]", inputs: { preset: { classPropertyName: "preset", publicName: "uiMotion", isSignal: true, isRequired: true, transformFunction: null }, motionDuration: { classPropertyName: "motionDuration", publicName: "motionDuration", isSignal: true, isRequired: false, transformFunction: null }, motionDelay: { classPropertyName: "motionDelay", publicName: "motionDelay", isSignal: true, isRequired: false, transformFunction: null }, motionEasing: { classPropertyName: "motionEasing", publicName: "motionEasing", isSignal: true, isRequired: false, transformFunction: null }, motionEnterEasing: { classPropertyName: "motionEnterEasing", publicName: "motionEnterEasing", isSignal: true, isRequired: false, transformFunction: null }, motionLeaveEasing: { classPropertyName: "motionLeaveEasing", publicName: "motionLeaveEasing", isSignal: true, isRequired: false, transformFunction: null }, motionDistance: { classPropertyName: "motionDistance", publicName: "motionDistance", isSignal: true, isRequired: false, transformFunction: null }, motionScale: { classPropertyName: "motionScale", publicName: "motionScale", isSignal: true, isRequired: false, transformFunction: null }, motionDisabled: { classPropertyName: "motionDisabled", publicName: "motionDisabled", isSignal: true, isRequired: false, transformFunction: null }, motionOnInsert: { classPropertyName: "motionOnInsert", publicName: "motionOnInsert", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_insertClass()", "style.--ui-motion-duration": "_duration()", "style.--ui-motion-delay": "_delay()", "style.--ui-motion-easing-enter": "_enterEasing()", "style.--ui-motion-easing-leave": "_leaveEasing()", "style.--ui-motion-distance": "_distance()", "style.--ui-motion-scale": "_scale()" } }, exportAs: ["uiMotion"], ngImport: i0 }); }
124
+ }
125
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: UiMotion, decorators: [{
126
+ type: Directive,
127
+ args: [{
128
+ selector: '[uiMotion]',
129
+ exportAs: 'uiMotion',
130
+ host: {
131
+ '[class]': '_insertClass()',
132
+ '[style.--ui-motion-duration]': '_duration()',
133
+ '[style.--ui-motion-delay]': '_delay()',
134
+ '[style.--ui-motion-easing-enter]': '_enterEasing()',
135
+ '[style.--ui-motion-easing-leave]': '_leaveEasing()',
136
+ '[style.--ui-motion-distance]': '_distance()',
137
+ '[style.--ui-motion-scale]': '_scale()',
138
+ },
139
+ }]
140
+ }], propDecorators: { preset: [{ type: i0.Input, args: [{ isSignal: true, alias: "uiMotion", required: true }] }], motionDuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionDuration", required: false }] }], motionDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionDelay", required: false }] }], motionEasing: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionEasing", required: false }] }], motionEnterEasing: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionEnterEasing", required: false }] }], motionLeaveEasing: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionLeaveEasing", required: false }] }], motionDistance: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionDistance", required: false }] }], motionScale: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionScale", required: false }] }], motionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionDisabled", required: false }] }], motionOnInsert: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionOnInsert", required: false }] }] } });
141
+
142
+ /*
143
+ * Public API Surface of ui-kit/motion
144
+ *
145
+ * `UiMotion` directive + presets. The enter/leave CSS classes it toggles live
146
+ * in the package's global stylesheet (`styles/base/_motion.scss` → `styles.css`), shipped with
147
+ * the design tokens.
148
+ */
149
+
150
+ /**
151
+ * Generated bundle index. Do not edit.
152
+ */
153
+
154
+ export { UI_MOTION_PRESETS, UiMotion, motionEnterClass, motionLeaveClass };
155
+ //# sourceMappingURL=4sh-ui-kit-motion.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"4sh-ui-kit-motion.mjs","sources":["../../../projects/ui-kit/motion/src/lib/ui-motion.ts","../../../projects/ui-kit/motion/src/public-api.ts","../../../projects/ui-kit/motion/src/4sh-ui-kit-motion.ts"],"sourcesContent":["import { booleanAttribute, computed, Directive, input } from '@angular/core';\n\n/**\n * Built-in motion presets. Each maps to a pair of global CSS classes\n * (`ui-motion-<preset>-enter` / `ui-motion-<preset>-leave`) defined in\n * `styles/base/_motion.scss`, compiled into the package's `styles.css`.\n *\n * - `fade` — opacity only (neutral).\n * - `slide-up` — rise + fade (toasts, tooltips above a trigger).\n * - `slide-down` — drop + fade (menus/dropdowns below a trigger).\n * - `slide-left` — enter from the right (drawers/panels).\n * - `slide-right` — enter from the left.\n * - `zoom` — scale + fade (modals, dialogs, popovers).\n * - `collapse` — grid-row height + fade (accordions, panels; needs a grid wrapper).\n */\nexport type UiMotionPreset =\n | 'fade'\n | 'slide-up'\n | 'slide-down'\n | 'slide-left'\n | 'slide-right'\n | 'zoom'\n | 'collapse';\n\n/** All preset keys, in declaration order (handy for stories/docs). */\nexport const UI_MOTION_PRESETS: readonly UiMotionPreset[] = [\n 'fade',\n 'slide-up',\n 'slide-down',\n 'slide-left',\n 'slide-right',\n 'zoom',\n 'collapse',\n];\n\n/** CSS class to bind to `animate.enter` for a preset. */\nexport const motionEnterClass = (preset: UiMotionPreset): string => `ui-motion-${preset}-enter`;\n/** CSS class to bind to `animate.leave` for a preset. */\nexport const motionLeaveClass = (preset: UiMotionPreset): string => `ui-motion-${preset}-leave`;\n\n/**\n * uiMotion — ergonomic wiring for the motion system on a conditionally\n * rendered element (`@if`, `@for`, control-flow insert/remove).\n *\n * It selects an enter/leave **preset** and exposes the matching class names for\n * Angular's native `animate.enter` / `animate.leave`, while letting you re-time\n * a single instance through the `--ui-motion-*` custom properties — no extra\n * CSS. Set `motionDisabled` (or the global `data-motion=\"off\"` switch / the\n * user's reduced-motion preference) to opt out.\n *\n * The enter/leave bindings stay in the template (Angular resolves them at the\n * insertion/removal boundary); the directive supplies the class strings and the\n * timing variables:\n *\n * @example\n * ```html\n * @if (open()) {\n * <div class=\"panel\"\n * [uiMotion]=\"'zoom'\" #m=\"uiMotion\"\n * [animate.enter]=\"m.enter()\" [animate.leave]=\"m.leave()\">…</div>\n * }\n *\n * <!-- faster, custom easing, disabled on demand -->\n * <div [uiMotion]=\"'slide-down'\" motionDuration=\"120ms\"\n * [motionDisabled]=\"prefersStillness()\" #m=\"uiMotion\"\n * [animate.enter]=\"m.enter()\" [animate.leave]=\"m.leave()\">…</div>\n * ```\n */\n@Directive({\n selector: '[uiMotion]',\n exportAs: 'uiMotion',\n host: {\n '[class]': '_insertClass()',\n '[style.--ui-motion-duration]': '_duration()',\n '[style.--ui-motion-delay]': '_delay()',\n '[style.--ui-motion-easing-enter]': '_enterEasing()',\n '[style.--ui-motion-easing-leave]': '_leaveEasing()',\n '[style.--ui-motion-distance]': '_distance()',\n '[style.--ui-motion-scale]': '_scale()',\n },\n})\nexport class UiMotion {\n /** Motion preset (enter/leave pair). */\n preset = input.required<UiMotionPreset>({ alias: 'uiMotion' });\n /** Override the duration for this element (e.g. `\"120ms\"`). */\n motionDuration = input<string>();\n /** Override the delay before the animation starts (e.g. `\"40ms\"`). */\n motionDelay = input<string>();\n /** Override both enter and leave easing (CSS timing function). */\n motionEasing = input<string>();\n /** Override only the enter easing (falls back to `motionEasing`). */\n motionEnterEasing = input<string>();\n /** Override only the leave easing (falls back to `motionEasing`). */\n motionLeaveEasing = input<string>();\n /** Override the slide offset for the directional presets (e.g. `\"12px\"`). */\n motionDistance = input<string>();\n /** Override the start/end scale for the `zoom` preset (e.g. `0.9`). */\n motionScale = input<number | string>();\n /** Disable motion for this element (renders/removes with no animation). */\n motionDisabled = input(false, { transform: booleanAttribute });\n /**\n * Play the enter preset through a class the directive applies itself, instead\n * of binding `animate.enter` in the template — the preset classes are plain\n * CSS animations, they need no framework hook to run once on insertion.\n *\n * **Mandatory for anything rendered in a CDK overlay** (dropdown panels,\n * menus, popovers). `animate.enter` registers the node in Angular's animation\n * queue, and that queue is unwound through the injector when the node goes\n * away; if the application is torn down while the overlay is still attached,\n * the unwind throws (`NG0205`) in the middle of the teardown and everything\n * after it is skipped — including the overlay's own `dispose()`. The panel\n * then stays in the document, detached from its anchor, in the top-left\n * corner of whatever renders next. No queue, no orphan.\n *\n * Leave it off for content inserted by `@if` / `@for` in a normal view, where\n * `animate.enter` also buys the leave animation.\n */\n motionOnInsert = input(false, { transform: booleanAttribute });\n\n /** Class to bind to `animate.enter` (empty when disabled → instant appear). */\n readonly enter = computed(() => (this.motionDisabled() ? '' : motionEnterClass(this.preset())));\n /** Class to bind to `animate.leave` (empty when disabled → instant removal). */\n readonly leave = computed(() => (this.motionDisabled() ? '' : motionLeaveClass(this.preset())));\n\n /** @ignore Enter class applied by the directive in `motionOnInsert` mode. */\n protected readonly _insertClass = computed(() => (this.motionOnInsert() ? this.enter() : ''));\n /** @ignore */\n protected readonly _duration = computed(() => this.motionDuration() ?? null);\n /** @ignore */\n protected readonly _delay = computed(() => this.motionDelay() ?? null);\n /** @ignore */\n protected readonly _enterEasing = computed(() => this.motionEnterEasing() ?? this.motionEasing() ?? null);\n /** @ignore */\n protected readonly _leaveEasing = computed(() => this.motionLeaveEasing() ?? this.motionEasing() ?? null);\n /** @ignore */\n protected readonly _distance = computed(() => this.motionDistance() ?? null);\n /** @ignore */\n protected readonly _scale = computed(() => {\n const s = this.motionScale();\n return s === undefined ? null : String(s);\n });\n}\n","/*\n * Public API Surface of ui-kit/motion\n *\n * `UiMotion` directive + presets. The enter/leave CSS classes it toggles live\n * in the package's global stylesheet (`styles/base/_motion.scss` → `styles.css`), shipped with\n * the design tokens.\n */\n\nexport * from './lib/ui-motion';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAwBA;AACO,MAAM,iBAAiB,GAA8B;IAC1D,MAAM;IACN,UAAU;IACV,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,MAAM;IACN,UAAU;;AAGZ;AACO,MAAM,gBAAgB,GAAG,CAAC,MAAsB,KAAa,CAAA,UAAA,EAAa,MAAM,CAAA,MAAA;AACvF;AACO,MAAM,gBAAgB,GAAG,CAAC,MAAsB,KAAa,CAAA,UAAA,EAAa,MAAM,CAAA,MAAA;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;MAcU,QAAQ,CAAA;AAbrB,IAAA,WAAA,GAAA;;QAeE,IAAA,CAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,6EAAmB,KAAK,EAAE,UAAU,EAAA,CAAG;;AAE9D,QAAA,IAAA,CAAA,cAAc,GAAG,KAAK;sGAAU;;AAEhC,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK;mGAAU;;AAE7B,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK;oGAAU;;AAE9B,QAAA,IAAA,CAAA,iBAAiB,GAAG,KAAK;yGAAU;;AAEnC,QAAA,IAAA,CAAA,iBAAiB,GAAG,KAAK;yGAAU;;AAEnC,QAAA,IAAA,CAAA,cAAc,GAAG,KAAK;sGAAU;;AAEhC,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK;mGAAmB;;QAEtC,IAAA,CAAA,cAAc,GAAG,KAAK,CAAC,KAAK,sFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AAC9D;;;;;;;;;;;;;;;;AAgBG;QACH,IAAA,CAAA,cAAc,GAAG,KAAK,CAAC,KAAK,sFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;QAGrD,IAAA,CAAA,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,cAAc,EAAE,GAA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art } from '@angular/router';
4
+ import { filter } from 'rxjs';
5
+
6
+ /**
7
+ * Auto-dismiss shared by every floating panel of the kit (menu, context menu,
8
+ * popover, select, autocomplete, input-tags, datepicker, tooltip).
9
+ *
10
+ * A CDK overlay lives in `body`, outside the routed view: it only disappears
11
+ * when its host component is destroyed. A panel whose host survives the
12
+ * navigation — declared in an app shell (header, sidebar, layout) — therefore
13
+ * stays on screen over the next page, and lands in the top-left corner as soon
14
+ * as it is re-positioned, because its anchor left the DOM with the previous
15
+ * page (a detached element measures 0×0 at the viewport origin).
16
+ *
17
+ * Call it from the component's constructor (injection context); the
18
+ * subscription is torn down with the component.
19
+ *
20
+ * ```ts
21
+ * constructor() {
22
+ * closeOnNavigation(() => this.close(false));
23
+ * }
24
+ * ```
25
+ *
26
+ * Only **page** changes dismiss the panel: a navigation that merely rewrites
27
+ * the query string or the fragment (filters, pagination, deep-link state
28
+ * pushed by the panel itself) leaves it open. Without a `Router` in the
29
+ * injector (kit used outside a routed app), this is a no-op.
30
+ *
31
+ * @param close Closing callback — must be idempotent (it may fire on a panel
32
+ * that is already closed) and must not steal focus, the navigation owns it.
33
+ */
34
+ function closeOnNavigation(close) {
35
+ const router = inject(Router, { optional: true });
36
+ if (!router)
37
+ return;
38
+ router.events
39
+ .pipe(filter((event) => event instanceof NavigationStart),
40
+ // `router.url` is still the current page while the navigation starts.
41
+ filter((event) => pathOf(event.url) !== pathOf(router.url)), takeUntilDestroyed())
42
+ .subscribe(() => close());
43
+ }
44
+ /** Path part of a serialized URL, query string and fragment removed. */
45
+ function pathOf(url) {
46
+ return url.split(/[?#]/)[0];
47
+ }
48
+
49
+ /*
50
+ * Public API Surface of ui-kit/overlay
51
+ *
52
+ * Helpers shared by the components that open a CDK overlay (select,
53
+ * autocomplete, datepicker, menu, popover…).
54
+ */
55
+
56
+ /**
57
+ * Generated bundle index. Do not edit.
58
+ */
59
+
60
+ export { closeOnNavigation };
61
+ //# sourceMappingURL=4sh-ui-kit-overlay.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"4sh-ui-kit-overlay.mjs","sources":["../../../projects/ui-kit/overlay/src/lib/close-on-navigation.ts","../../../projects/ui-kit/overlay/src/public-api.ts","../../../projects/ui-kit/overlay/src/4sh-ui-kit-overlay.ts"],"sourcesContent":["import { inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { NavigationStart, Router } from '@angular/router';\nimport { filter } from 'rxjs';\n\n/**\n * Auto-dismiss shared by every floating panel of the kit (menu, context menu,\n * popover, select, autocomplete, input-tags, datepicker, tooltip).\n *\n * A CDK overlay lives in `body`, outside the routed view: it only disappears\n * when its host component is destroyed. A panel whose host survives the\n * navigation — declared in an app shell (header, sidebar, layout) — therefore\n * stays on screen over the next page, and lands in the top-left corner as soon\n * as it is re-positioned, because its anchor left the DOM with the previous\n * page (a detached element measures 0×0 at the viewport origin).\n *\n * Call it from the component's constructor (injection context); the\n * subscription is torn down with the component.\n *\n * ```ts\n * constructor() {\n * closeOnNavigation(() => this.close(false));\n * }\n * ```\n *\n * Only **page** changes dismiss the panel: a navigation that merely rewrites\n * the query string or the fragment (filters, pagination, deep-link state\n * pushed by the panel itself) leaves it open. Without a `Router` in the\n * injector (kit used outside a routed app), this is a no-op.\n *\n * @param close Closing callback — must be idempotent (it may fire on a panel\n * that is already closed) and must not steal focus, the navigation owns it.\n */\nexport function closeOnNavigation(close: () => void): void {\n const router = inject(Router, { optional: true });\n if (!router) return;\n\n router.events\n .pipe(\n filter((event): event is NavigationStart => event instanceof NavigationStart),\n // `router.url` is still the current page while the navigation starts.\n filter((event) => pathOf(event.url) !== pathOf(router.url)),\n takeUntilDestroyed(),\n )\n .subscribe(() => close());\n}\n\n/** Path part of a serialized URL, query string and fragment removed. */\nfunction pathOf(url: string): string {\n return url.split(/[?#]/)[0];\n}\n","/*\n * Public API Surface of ui-kit/overlay\n *\n * Helpers shared by the components that open a CDK overlay (select,\n * autocomplete, datepicker, menu, popover…).\n */\n\nexport * from './lib/close-on-navigation';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,SAAU,iBAAiB,CAAC,KAAiB,EAAA;AACjD,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACjD,IAAA,IAAI,CAAC,MAAM;QAAE;AAEb,IAAA,MAAM,CAAC;SACJ,IAAI,CACH,MAAM,CAAC,CAAC,KAAK,KAA+B,KAAK,YAAY,eAAe,CAAC;;IAE7E,MAAM,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAC3D,kBAAkB,EAAE;AAErB,SAAA,SAAS,CAAC,MAAM,KAAK,EAAE,CAAC;AAC7B;AAEA;AACA,SAAS,MAAM,CAAC,GAAW,EAAA;IACzB,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC7B;;AClDA;;;;;AAKG;;ACLH;;AAEG;;;;"}
@@ -0,0 +1,120 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, signal, effect, Injectable, InjectionToken } from '@angular/core';
3
+ import { DOCUMENT } from '@angular/common';
4
+
5
+ /**
6
+ * Manages light/dark mode via the `[data-theme]` attribute on <html>,
7
+ * aligned with the generated tokens (semantics: modeLight → :root, modeDark → [data-theme='dark']).
8
+ */
9
+ class ThemeService {
10
+ constructor() {
11
+ this.document = inject(DOCUMENT);
12
+ this.currentMode = signal(this.getStoredMode(), /* @ts-ignore */
13
+ ...(ngDevMode ? [{ debugName: "currentMode" }] : /* istanbul ignore next */ []));
14
+ effect(() => {
15
+ const mode = this.currentMode();
16
+ const root = this.document.documentElement;
17
+ if (mode === 'dark') {
18
+ root.setAttribute('data-theme', 'dark');
19
+ }
20
+ else {
21
+ root.removeAttribute('data-theme');
22
+ }
23
+ if (typeof localStorage !== 'undefined') {
24
+ localStorage.setItem('theme-mode', mode);
25
+ }
26
+ });
27
+ }
28
+ toggle() {
29
+ this.currentMode.update(mode => (mode === 'light' ? 'dark' : 'light'));
30
+ }
31
+ get isDark() {
32
+ return this.currentMode() === 'dark';
33
+ }
34
+ getStoredMode() {
35
+ if (typeof localStorage !== 'undefined') {
36
+ return localStorage.getItem('theme-mode') || 'light';
37
+ }
38
+ return 'light';
39
+ }
40
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
41
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ThemeService, providedIn: 'root' }); }
42
+ }
43
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ThemeService, decorators: [{
44
+ type: Injectable,
45
+ args: [{ providedIn: 'root' }]
46
+ }], ctorParameters: () => [] });
47
+
48
+ /** Subdomain → brand (primitive tokens use the modeBrand1/2/3 modes). */
49
+ const SUBDOMAIN_TO_BRAND = {
50
+ themeone: 'brand1',
51
+ themetwo: 'brand2',
52
+ themethree: 'brand3',
53
+ };
54
+ /**
55
+ * Brand the application starts on. Optional — defaults to `brand1`.
56
+ *
57
+ * The kit deliberately does NOT detect the brand itself: how a project picks
58
+ * its brand (subdomain, user setting, backend config…) is an application
59
+ * concern. Provide it with `provideUiKitBrand()`.
60
+ */
61
+ const UI_KIT_INITIAL_BRAND = new InjectionToken('UI_KIT_INITIAL_BRAND');
62
+ /** Maps a subdomain segment (e.g. "themetwo") to a brand — `brand1` when unknown. */
63
+ function brandFromSubdomain(subdomain) {
64
+ return SUBDOMAIN_TO_BRAND[subdomain] ?? 'brand1';
65
+ }
66
+ /**
67
+ * Sets the initial brand of the application.
68
+ *
69
+ * ```ts
70
+ * providers: [provideUiKitBrand(brandFromSubdomain(subdomain))]
71
+ * ```
72
+ */
73
+ function provideUiKitBrand(brand) {
74
+ return { provide: UI_KIT_INITIAL_BRAND, useValue: brand };
75
+ }
76
+ /**
77
+ * Manages the active brand via the `[data-brand]` attribute on <html>.
78
+ * brand1 = default (:root, no attribute). brand2/brand3 override the
79
+ * `--primitives-*` variables, which propagates to the semantics (which reference them).
80
+ */
81
+ class BrandService {
82
+ constructor() {
83
+ this.document = inject(DOCUMENT);
84
+ this.currentBrand = signal(inject(UI_KIT_INITIAL_BRAND, { optional: true }) ?? 'brand1', /* @ts-ignore */
85
+ ...(ngDevMode ? [{ debugName: "currentBrand" }] : /* istanbul ignore next */ []));
86
+ effect(() => {
87
+ const brand = this.currentBrand();
88
+ const root = this.document.documentElement;
89
+ if (brand === 'brand1') {
90
+ root.removeAttribute('data-brand');
91
+ }
92
+ else {
93
+ root.setAttribute('data-brand', brand);
94
+ }
95
+ });
96
+ }
97
+ set(brand) {
98
+ this.currentBrand.set(brand);
99
+ }
100
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BrandService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
101
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BrandService, providedIn: 'root' }); }
102
+ }
103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BrandService, decorators: [{
104
+ type: Injectable,
105
+ args: [{ providedIn: 'root' }]
106
+ }], ctorParameters: () => [] });
107
+
108
+ /*
109
+ * Public API Surface of ui-kit/theming
110
+ *
111
+ * Runtime switches for the two token dimensions carried by the DOM:
112
+ * light/dark (`[data-theme]`) and brand (`[data-brand]`).
113
+ */
114
+
115
+ /**
116
+ * Generated bundle index. Do not edit.
117
+ */
118
+
119
+ export { BrandService, ThemeService, UI_KIT_INITIAL_BRAND, brandFromSubdomain, provideUiKitBrand };
120
+ //# sourceMappingURL=4sh-ui-kit-theming.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"4sh-ui-kit-theming.mjs","sources":["../../../projects/ui-kit/theming/src/lib/theme.service.ts","../../../projects/ui-kit/theming/src/lib/brand.service.ts","../../../projects/ui-kit/theming/src/public-api.ts","../../../projects/ui-kit/theming/src/4sh-ui-kit-theming.ts"],"sourcesContent":["import { Injectable, signal, effect, inject } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\nexport type ThemeMode = 'light' | 'dark';\n\n/**\n * Manages light/dark mode via the `[data-theme]` attribute on <html>,\n * aligned with the generated tokens (semantics: modeLight → :root, modeDark → [data-theme='dark']).\n */\n@Injectable({ providedIn: 'root' })\nexport class ThemeService {\n private document = inject(DOCUMENT);\n\n readonly currentMode = signal<ThemeMode>(this.getStoredMode());\n\n constructor() {\n effect(() => {\n const mode = this.currentMode();\n const root = this.document.documentElement;\n\n if (mode === 'dark') {\n root.setAttribute('data-theme', 'dark');\n } else {\n root.removeAttribute('data-theme');\n }\n if (typeof localStorage !== 'undefined') {\n localStorage.setItem('theme-mode', mode);\n }\n });\n }\n\n toggle() {\n this.currentMode.update(mode => (mode === 'light' ? 'dark' : 'light'));\n }\n\n get isDark(): boolean {\n return this.currentMode() === 'dark';\n }\n\n private getStoredMode(): ThemeMode {\n if (typeof localStorage !== 'undefined') {\n return (localStorage.getItem('theme-mode') as ThemeMode) || 'light';\n }\n return 'light';\n }\n}\n","import { inject, Injectable, InjectionToken, Provider, signal, effect } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\nexport type Brand = 'brand1' | 'brand2' | 'brand3';\n\n/** Subdomain → brand (primitive tokens use the modeBrand1/2/3 modes). */\nconst SUBDOMAIN_TO_BRAND: Record<string, Brand> = {\n themeone: 'brand1',\n themetwo: 'brand2',\n themethree: 'brand3',\n};\n\n/**\n * Brand the application starts on. Optional — defaults to `brand1`.\n *\n * The kit deliberately does NOT detect the brand itself: how a project picks\n * its brand (subdomain, user setting, backend config…) is an application\n * concern. Provide it with `provideUiKitBrand()`.\n */\nexport const UI_KIT_INITIAL_BRAND = new InjectionToken<Brand>('UI_KIT_INITIAL_BRAND');\n\n/** Maps a subdomain segment (e.g. \"themetwo\") to a brand — `brand1` when unknown. */\nexport function brandFromSubdomain(subdomain: string): Brand {\n return SUBDOMAIN_TO_BRAND[subdomain] ?? 'brand1';\n}\n\n/**\n * Sets the initial brand of the application.\n *\n * ```ts\n * providers: [provideUiKitBrand(brandFromSubdomain(subdomain))]\n * ```\n */\nexport function provideUiKitBrand(brand: Brand): Provider {\n return { provide: UI_KIT_INITIAL_BRAND, useValue: brand };\n}\n\n/**\n * Manages the active brand via the `[data-brand]` attribute on <html>.\n * brand1 = default (:root, no attribute). brand2/brand3 override the\n * `--primitives-*` variables, which propagates to the semantics (which reference them).\n */\n@Injectable({ providedIn: 'root' })\nexport class BrandService {\n private document = inject(DOCUMENT);\n\n readonly currentBrand = signal<Brand>(inject(UI_KIT_INITIAL_BRAND, { optional: true }) ?? 'brand1');\n\n constructor() {\n effect(() => {\n const brand = this.currentBrand();\n const root = this.document.documentElement;\n if (brand === 'brand1') {\n root.removeAttribute('data-brand');\n } else {\n root.setAttribute('data-brand', brand);\n }\n });\n }\n\n set(brand: Brand) {\n this.currentBrand.set(brand);\n }\n}\n","/*\n * Public API Surface of ui-kit/theming\n *\n * Runtime switches for the two token dimensions carried by the DOM:\n * light/dark (`[data-theme]`) and brand (`[data-brand]`).\n */\n\nexport * from './lib/theme.service';\nexport * from './lib/brand.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAKA;;;AAGG;MAEU,YAAY,CAAA;AAKvB,IAAA,WAAA,GAAA;AAJQ,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAE1B,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAY,IAAI,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CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAZ,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cADC,MAAM,EAAA,CAAA,CAAA;;2FACnB,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;AC1ClC;;;;;AAKG;;ACLH;;AAEG;;;;"}
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Public API Surface of ui-kit/types
3
+ *
4
+ * Shared, type-only building blocks used across several `ui-*` components
5
+ * (e.g. `UiLevel`). No runtime code — a component that only needs a type
6
+ * import pays nothing for depending on this entry point.
7
+ */
8
+
9
+ /**
10
+ * Generated bundle index. Do not edit.
11
+ */
12
+ //# sourceMappingURL=4sh-ui-kit-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"4sh-ui-kit-types.mjs","sources":["../../../projects/ui-kit/types/src/public-api.ts","../../../projects/ui-kit/types/src/4sh-ui-kit-types.ts"],"sourcesContent":["/*\n * Public API Surface of ui-kit/types\n *\n * Shared, type-only building blocks used across several `ui-*` components\n * (e.g. `UiLevel`). No runtime code — a component that only needs a type\n * import pays nothing for depending on this entry point.\n */\n\nexport * from './ui-level';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;;;;;AAMG;;ACNH;;AAEG"}