@4sh/ui-kit 0.8.0 → 0.10.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 (143) hide show
  1. package/README.fr.md +11 -10
  2. package/README.md +11 -10
  3. package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs +3 -3
  4. package/fesm2022/4sh-ui-kit-actions-ui-button.mjs +4 -4
  5. package/fesm2022/4sh-ui-kit-actions-ui-button.mjs.map +1 -1
  6. package/fesm2022/4sh-ui-kit-actions-ui-link.mjs +4 -4
  7. package/fesm2022/4sh-ui-kit-actions-ui-link.mjs.map +1 -1
  8. package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs +3 -3
  9. package/fesm2022/4sh-ui-kit-base-ui-icon.mjs +6 -6
  10. package/fesm2022/4sh-ui-kit-base-ui-image.mjs +340 -16
  11. package/fesm2022/4sh-ui-kit-base-ui-image.mjs.map +1 -1
  12. package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs +5 -5
  13. package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs.map +1 -1
  14. package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs +5 -5
  15. package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs.map +1 -1
  16. package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs +10 -82
  17. package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs.map +1 -1
  18. package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs +4 -4
  19. package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs.map +1 -1
  20. package/fesm2022/4sh-ui-kit-forms-ui-field.mjs +4 -4
  21. package/fesm2022/4sh-ui-kit-forms-ui-field.mjs.map +1 -1
  22. package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs +8 -8
  23. package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs.map +1 -1
  24. package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs +179 -0
  25. package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs.map +1 -0
  26. package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs +7 -7
  27. package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs.map +1 -1
  28. package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs +5 -5
  29. package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs.map +1 -1
  30. package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs +5 -5
  31. package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs.map +1 -1
  32. package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs +5 -5
  33. package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs.map +1 -1
  34. package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs +5 -5
  35. package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs.map +1 -1
  36. package/fesm2022/4sh-ui-kit-forms-ui-input.mjs +4 -4
  37. package/fesm2022/4sh-ui-kit-forms-ui-input.mjs.map +1 -1
  38. package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs +4 -4
  39. package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs.map +1 -1
  40. package/fesm2022/4sh-ui-kit-forms-ui-label.mjs +4 -4
  41. package/fesm2022/4sh-ui-kit-forms-ui-label.mjs.map +1 -1
  42. package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs +4 -4
  43. package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs.map +1 -1
  44. package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs +4 -4
  45. package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs.map +1 -1
  46. package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs +4 -4
  47. package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs.map +1 -1
  48. package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs +5 -5
  49. package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs.map +1 -1
  50. package/fesm2022/4sh-ui-kit-forms-ui-select.mjs +4 -4
  51. package/fesm2022/4sh-ui-kit-forms-ui-select.mjs.map +1 -1
  52. package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs +4 -4
  53. package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs.map +1 -1
  54. package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs +4 -4
  55. package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs.map +1 -1
  56. package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs +5 -5
  57. package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs.map +1 -1
  58. package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs +215 -0
  59. package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs.map +1 -0
  60. package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs +5 -5
  61. package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs.map +1 -1
  62. package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs +4 -4
  63. package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs.map +1 -1
  64. package/fesm2022/4sh-ui-kit-forms.mjs +105 -7
  65. package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -1
  66. package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs +13 -13
  67. package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs.map +1 -1
  68. package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs +4 -4
  69. package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs.map +1 -1
  70. package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs +3 -3
  71. package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs +4 -4
  72. package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs.map +1 -1
  73. package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs +4 -4
  74. package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs.map +1 -1
  75. package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs +4 -4
  76. package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs.map +1 -1
  77. package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs +10 -10
  78. package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs.map +1 -1
  79. package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs +4 -4
  80. package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs.map +1 -1
  81. package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs +4 -4
  82. package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs.map +1 -1
  83. package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs +4 -4
  84. package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs.map +1 -1
  85. package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs +4 -4
  86. package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs.map +1 -1
  87. package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs +3 -3
  88. package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs +4 -4
  89. package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs.map +1 -1
  90. package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs +4 -4
  91. package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs.map +1 -1
  92. package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs +10 -10
  93. package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs.map +1 -1
  94. package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs +45 -26
  95. package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs.map +1 -1
  96. package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs +605 -0
  97. package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs.map +1 -0
  98. package/fesm2022/4sh-ui-kit-layout-ui-card.mjs +16 -16
  99. package/fesm2022/4sh-ui-kit-layout-ui-card.mjs.map +1 -1
  100. package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs +5 -29
  101. package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs.map +1 -1
  102. package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs +5 -29
  103. package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs.map +1 -1
  104. package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs +4 -4
  105. package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs.map +1 -1
  106. package/fesm2022/4sh-ui-kit-motion.mjs +3 -3
  107. package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs +12 -12
  108. package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs.map +1 -1
  109. package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs +4 -4
  110. package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs.map +1 -1
  111. package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs +3 -3
  112. package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs +4 -4
  113. package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs.map +1 -1
  114. package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs +12 -36
  115. package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs.map +1 -1
  116. package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs +22 -22
  117. package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs.map +1 -1
  118. package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs +20 -20
  119. package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs.map +1 -1
  120. package/fesm2022/4sh-ui-kit-overlay.mjs +60 -2
  121. package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -1
  122. package/fesm2022/4sh-ui-kit-ripple.mjs +9 -9
  123. package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs +4 -4
  124. package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs.map +1 -1
  125. package/fesm2022/4sh-ui-kit-table-ui-table.mjs +34 -34
  126. package/fesm2022/4sh-ui-kit-table-ui-table.mjs.map +1 -1
  127. package/fesm2022/4sh-ui-kit-theming.mjs +6 -6
  128. package/mcp/data/text-search-docs.json +486 -66
  129. package/mcp/data/ui-config.json +26605 -12458
  130. package/mcp/package.json +1 -1
  131. package/package.json +13 -1
  132. package/styles/component-vars.scss +1440 -721
  133. package/styles/settings/_ui-config.scss +45 -2
  134. package/styles/utils/_mixins.scss +32 -30
  135. package/styles/utils/_overlay.scss +1 -1
  136. package/types/4sh-ui-kit-base-ui-image.d.ts +151 -6
  137. package/types/4sh-ui-kit-forms-ui-datepicker.d.ts +3 -1
  138. package/types/4sh-ui-kit-forms-ui-input-date.d.ts +110 -0
  139. package/types/4sh-ui-kit-forms-ui-toggle-block.d.ts +114 -0
  140. package/types/4sh-ui-kit-forms.d.ts +43 -1
  141. package/types/4sh-ui-kit-informative-ui-tooltip.d.ts +4 -4
  142. package/types/4sh-ui-kit-layout-ui-bottom-sheet.d.ts +256 -0
  143. package/types/4sh-ui-kit-overlay.d.ts +35 -1
@@ -1,10 +1,210 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, input, output, computed, linkedSignal, effect, isDevMode, Component } from '@angular/core';
3
- import { NgOptimizedImage } from '@angular/common';
2
+ import { inject, input, numberAttribute, booleanAttribute, output, viewChild, signal, computed, DestroyRef, Component, InjectionToken, PLATFORM_ID, model, contentChild, linkedSignal, effect, isDevMode } from '@angular/core';
3
+ import { DOCUMENT, isPlatformBrowser, NgOptimizedImage, NgTemplateOutlet } from '@angular/common';
4
+ import * as i1 from '@angular/cdk/a11y';
5
+ import { A11yModule } from '@angular/cdk/a11y';
6
+ import { UiIcon } from '@4sh/ui-kit/base/ui-icon';
7
+ import { lockBodyScroll, unlockBodyScroll } from '@4sh/ui-kit/overlay';
4
8
  import { httpResource } from '@angular/common/http';
5
9
  import { DomSanitizer } from '@angular/platform-browser';
6
10
  import { ThemeService, BrandService } from '@4sh/ui-kit/theming';
7
- import { UiIcon } from '@4sh/ui-kit/base/ui-icon';
11
+ import { UiSpinner } from '@4sh/ui-kit/informative/ui-spinner';
12
+ import { UiMotion } from '@4sh/ui-kit/motion';
13
+
14
+ /** Clamp `value` into `[min, max]`. */
15
+ function clamp(value, min, max) {
16
+ return Math.min(max, Math.max(min, value));
17
+ }
18
+ /**
19
+ * ui-image-preview — the enlarged view (lightbox) opened by `ui-image`'s
20
+ * `preview` mode.
21
+ *
22
+ * A viewport mask holding a toolbar (zoom in/out, rotate, reset, optional
23
+ * download, close) and the image itself, which the three transforms drive
24
+ * through a single `transform`: pan, scale, rotation. Zoom is reachable at the
25
+ * pointer (toolbar, wheel) and at the keyboard (`+`/`-`/`0`/`r`, arrows to pan)
26
+ * — a zoom a keyboard user cannot pan is a zoom they cannot read.
27
+ *
28
+ * Lives in `ui-image`'s entry point: it renders that component's resolved
29
+ * source, so a separate entry point would be a cycle. Mount it directly only to
30
+ * drive the enlarged view yourself.
31
+ */
32
+ class UiImagePreview {
33
+ constructor() {
34
+ this.document = inject(DOCUMENT);
35
+ /** URL of the image to show enlarged (already resolved — `http(s)`, `blob:` or `data:`). */
36
+ this.src = input.required(/* @ts-ignore */
37
+ ...(ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []));
38
+ /** Alt text of the enlarged image (empty = decorative). */
39
+ this.alt = input('', /* @ts-ignore */
40
+ ...(ngDevMode ? [{ debugName: "alt" }] : /* istanbul ignore next */ []));
41
+ /** Accessible name of the dialog. */
42
+ this.ariaLabel = input('Aperçu de l’image', /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
44
+ /** Zoom increment applied by one toolbar click, one wheel notch or one `+`/`-` press. */
45
+ this.zoomStep = input(0.25, { ...(ngDevMode ? { debugName: "zoomStep" } : /* istanbul ignore next */ {}), transform: numberAttribute });
46
+ /** Lower zoom bound. */
47
+ this.minZoom = input(0.5, { ...(ngDevMode ? { debugName: "minZoom" } : /* istanbul ignore next */ {}), transform: numberAttribute });
48
+ /** Upper zoom bound. */
49
+ this.maxZoom = input(4, { ...(ngDevMode ? { debugName: "maxZoom" } : /* istanbul ignore next */ {}), transform: numberAttribute });
50
+ /** Offer a download action in the toolbar. */
51
+ this.downloadable = input(false, { ...(ngDevMode ? { debugName: "downloadable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
52
+ /** Filename proposed by the download action (defaults to the browser's choice). */
53
+ this.downloadName = input(/* @ts-ignore */
54
+ ...(ngDevMode ? [undefined, { debugName: "downloadName" }] : /* istanbul ignore next */ []));
55
+ /** Close when the mask around the image is clicked. */
56
+ this.dismissableMask = input(true, { ...(ngDevMode ? { debugName: "dismissableMask" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
57
+ this.zoomInAriaLabel = input('Zoom avant', /* @ts-ignore */
58
+ ...(ngDevMode ? [{ debugName: "zoomInAriaLabel" }] : /* istanbul ignore next */ []));
59
+ this.zoomOutAriaLabel = input('Zoom arrière', /* @ts-ignore */
60
+ ...(ngDevMode ? [{ debugName: "zoomOutAriaLabel" }] : /* istanbul ignore next */ []));
61
+ this.rotateLeftAriaLabel = input('Pivoter vers la gauche', /* @ts-ignore */
62
+ ...(ngDevMode ? [{ debugName: "rotateLeftAriaLabel" }] : /* istanbul ignore next */ []));
63
+ this.rotateRightAriaLabel = input('Pivoter vers la droite', /* @ts-ignore */
64
+ ...(ngDevMode ? [{ debugName: "rotateRightAriaLabel" }] : /* istanbul ignore next */ []));
65
+ this.resetAriaLabel = input('Réinitialiser l’affichage', /* @ts-ignore */
66
+ ...(ngDevMode ? [{ debugName: "resetAriaLabel" }] : /* istanbul ignore next */ []));
67
+ this.downloadAriaLabel = input('Télécharger l’image', /* @ts-ignore */
68
+ ...(ngDevMode ? [{ debugName: "downloadAriaLabel" }] : /* istanbul ignore next */ []));
69
+ this.closeAriaLabel = input('Fermer l’aperçu', /* @ts-ignore */
70
+ ...(ngDevMode ? [{ debugName: "closeAriaLabel" }] : /* istanbul ignore next */ []));
71
+ /** Emitted when the view asks to be dismissed (Escape, close button, mask click). */
72
+ this.closed = output();
73
+ this.stage = viewChild.required('stage', /* @ts-ignore */
74
+ ...(ngDevMode ? [{ debugName: "stage" }] : /* istanbul ignore next */ []));
75
+ this.scale = signal(1, /* @ts-ignore */
76
+ ...(ngDevMode ? [{ debugName: "scale" }] : /* istanbul ignore next */ []));
77
+ this.rotation = signal(0, /* @ts-ignore */
78
+ ...(ngDevMode ? [{ debugName: "rotation" }] : /* istanbul ignore next */ []));
79
+ this.panX = signal(0, /* @ts-ignore */
80
+ ...(ngDevMode ? [{ debugName: "panX" }] : /* istanbul ignore next */ []));
81
+ this.panY = signal(0, /* @ts-ignore */
82
+ ...(ngDevMode ? [{ debugName: "panY" }] : /* istanbul ignore next */ []));
83
+ this.canZoomIn = computed(() => this.scale() < this.maxZoom(), /* @ts-ignore */
84
+ ...(ngDevMode ? [{ debugName: "canZoomIn" }] : /* istanbul ignore next */ []));
85
+ this.canZoomOut = computed(() => this.scale() > this.minZoom(), /* @ts-ignore */
86
+ ...(ngDevMode ? [{ debugName: "canZoomOut" }] : /* istanbul ignore next */ []));
87
+ /** Nothing to reset while the three transforms are at their neutral value. */
88
+ this.isPristine = computed(() => this.scale() === 1 && this.rotation() === 0 && this.panX() === 0 && this.panY() === 0, /* @ts-ignore */
89
+ ...(ngDevMode ? [{ debugName: "isPristine" }] : /* istanbul ignore next */ []));
90
+ /** Panning only makes sense once the image overflows its stage. */
91
+ this.canPan = computed(() => this.scale() > 1, /* @ts-ignore */
92
+ ...(ngDevMode ? [{ debugName: "canPan" }] : /* istanbul ignore next */ []));
93
+ /** A quarter turn: what is drawn no longer fits the layout box's axes. */
94
+ this.isQuarterTurned = computed(() => this.rotation() % 180 !== 0, /* @ts-ignore */
95
+ ...(ngDevMode ? [{ debugName: "isQuarterTurned" }] : /* istanbul ignore next */ []));
96
+ this.transform = computed(() => `translate(${this.panX()}px, ${this.panY()}px) scale(${this.scale()}) rotate(${this.rotation()}deg)`, /* @ts-ignore */
97
+ ...(ngDevMode ? [{ debugName: "transform" }] : /* istanbul ignore next */ []));
98
+ // --- Drag to pan ------------------------------------------------------
99
+ this.dragOrigin = null;
100
+ lockBodyScroll(this.document);
101
+ inject(DestroyRef).onDestroy(() => unlockBodyScroll(this.document));
102
+ }
103
+ zoomIn() {
104
+ this.setScale(this.scale() + this.zoomStep());
105
+ }
106
+ zoomOut() {
107
+ this.setScale(this.scale() - this.zoomStep());
108
+ }
109
+ rotateLeft() {
110
+ this.rotation.update((deg) => deg - 90);
111
+ }
112
+ rotateRight() {
113
+ this.rotation.update((deg) => deg + 90);
114
+ }
115
+ reset() {
116
+ this.scale.set(1);
117
+ this.rotation.set(0);
118
+ this.panX.set(0);
119
+ this.panY.set(0);
120
+ }
121
+ close() {
122
+ this.closed.emit();
123
+ }
124
+ /** A press that lands on the stage itself (not on the image) is a press outside. */
125
+ onStagePointerDown(event) {
126
+ if (this.dismissableMask() && event.target === this.stage().nativeElement)
127
+ this.close();
128
+ }
129
+ onWheel(event) {
130
+ event.preventDefault();
131
+ this.setScale(this.scale() + (event.deltaY < 0 ? this.zoomStep() : -this.zoomStep()));
132
+ }
133
+ onKeydown(event) {
134
+ const step = 24;
135
+ switch (event.key) {
136
+ case 'Escape':
137
+ this.close();
138
+ break;
139
+ case '+':
140
+ case '=':
141
+ this.zoomIn();
142
+ break;
143
+ case '-':
144
+ this.zoomOut();
145
+ break;
146
+ case '0':
147
+ this.reset();
148
+ break;
149
+ case 'r':
150
+ case 'R':
151
+ this.rotateRight();
152
+ break;
153
+ case 'ArrowLeft':
154
+ this.panX.update((x) => x - step);
155
+ break;
156
+ case 'ArrowRight':
157
+ this.panX.update((x) => x + step);
158
+ break;
159
+ case 'ArrowUp':
160
+ this.panY.update((y) => y - step);
161
+ break;
162
+ case 'ArrowDown':
163
+ this.panY.update((y) => y + step);
164
+ break;
165
+ default:
166
+ return;
167
+ }
168
+ // Only a handled key is swallowed: Tab must keep cycling the focus trap.
169
+ event.preventDefault();
170
+ event.stopPropagation();
171
+ }
172
+ onPointerDown(event) {
173
+ if (!this.canPan() || event.button !== 0)
174
+ return;
175
+ this.dragOrigin = { x: event.clientX, y: event.clientY, panX: this.panX(), panY: this.panY() };
176
+ event.target.setPointerCapture?.(event.pointerId);
177
+ event.preventDefault();
178
+ }
179
+ onPointerMove(event) {
180
+ const origin = this.dragOrigin;
181
+ if (!origin)
182
+ return;
183
+ this.panX.set(origin.panX + (event.clientX - origin.x));
184
+ this.panY.set(origin.panY + (event.clientY - origin.y));
185
+ }
186
+ onPointerUp(event) {
187
+ if (!this.dragOrigin)
188
+ return;
189
+ this.dragOrigin = null;
190
+ event.target.releasePointerCapture?.(event.pointerId);
191
+ }
192
+ setScale(value) {
193
+ const next = clamp(Number(value.toFixed(4)), this.minZoom(), this.maxZoom());
194
+ this.scale.set(next);
195
+ // Back to fit: the pan offset would otherwise strand the image off-centre.
196
+ if (next <= 1) {
197
+ this.panX.set(0);
198
+ this.panY.set(0);
199
+ }
200
+ }
201
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: UiImagePreview, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
202
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: UiImagePreview, isStandalone: true, selector: "ui-image-preview", inputs: { src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: true, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, zoomStep: { classPropertyName: "zoomStep", publicName: "zoomStep", isSignal: true, isRequired: false, transformFunction: null }, minZoom: { classPropertyName: "minZoom", publicName: "minZoom", isSignal: true, isRequired: false, transformFunction: null }, maxZoom: { classPropertyName: "maxZoom", publicName: "maxZoom", isSignal: true, isRequired: false, transformFunction: null }, downloadable: { classPropertyName: "downloadable", publicName: "downloadable", isSignal: true, isRequired: false, transformFunction: null }, downloadName: { classPropertyName: "downloadName", publicName: "downloadName", isSignal: true, isRequired: false, transformFunction: null }, dismissableMask: { classPropertyName: "dismissableMask", publicName: "dismissableMask", isSignal: true, isRequired: false, transformFunction: null }, zoomInAriaLabel: { classPropertyName: "zoomInAriaLabel", publicName: "zoomInAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, zoomOutAriaLabel: { classPropertyName: "zoomOutAriaLabel", publicName: "zoomOutAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, rotateLeftAriaLabel: { classPropertyName: "rotateLeftAriaLabel", publicName: "rotateLeftAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, rotateRightAriaLabel: { classPropertyName: "rotateRightAriaLabel", publicName: "rotateRightAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, resetAriaLabel: { classPropertyName: "resetAriaLabel", publicName: "resetAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, downloadAriaLabel: { classPropertyName: "downloadAriaLabel", publicName: "downloadAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, closeAriaLabel: { classPropertyName: "closeAriaLabel", publicName: "closeAriaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed" }, viewQueries: [{ propertyName: "stage", first: true, predicate: ["stage"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- The host is the mask; this is the dialog that owns the focus, the keyboard\n shortcuts and the aria wiring. -->\n<div\n class=\"ui-image-preview\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"ariaLabel() || null\"\n tabindex=\"-1\"\n [cdkTrapFocus]=\"true\"\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onKeydown($event)\"\n>\n <!-- Unavailable actions are `aria-disabled`, not `disabled`: a real `disabled`\n drops the focus to the body the moment the button that holds it hits a\n bound, and `Escape` then no longer reaches the dialog. The handlers clamp,\n so a press at the bound is a no-op. -->\n <div class=\"ui-image-preview-toolbar\">\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"zoomOutAriaLabel() || null\"\n [attr.aria-disabled]=\"!canZoomOut() || null\"\n (click)=\"zoomOut()\"\n >\n <ui-icon name=\"magnifying-glass-minus\" size=\"sm\" />\n </button>\n\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"zoomInAriaLabel() || null\"\n [attr.aria-disabled]=\"!canZoomIn() || null\"\n (click)=\"zoomIn()\"\n >\n <ui-icon name=\"magnifying-glass-plus\" size=\"sm\" />\n </button>\n\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"rotateLeftAriaLabel() || null\"\n (click)=\"rotateLeft()\"\n >\n <ui-icon name=\"rotate-left\" size=\"sm\" />\n </button>\n\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"rotateRightAriaLabel() || null\"\n (click)=\"rotateRight()\"\n >\n <ui-icon name=\"rotate-right\" size=\"sm\" />\n </button>\n\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"resetAriaLabel() || null\"\n [attr.aria-disabled]=\"isPristine() || null\"\n (click)=\"reset()\"\n >\n <ui-icon name=\"arrows-rotate\" size=\"sm\" />\n </button>\n\n @if (downloadable()) {\n <a\n class=\"ui-image-preview-action\"\n [href]=\"src()\"\n [attr.download]=\"downloadName() || ''\"\n [attr.aria-label]=\"downloadAriaLabel() || null\"\n target=\"_blank\"\n rel=\"noopener\"\n >\n <ui-icon name=\"download\" size=\"sm\" />\n </a>\n }\n\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"closeAriaLabel() || null\"\n (click)=\"close()\"\n >\n <ui-icon name=\"xmark\" size=\"sm\" />\n </button>\n </div>\n\n <!-- The stage is the dismiss-on-outside target: a press that lands on it, and\n not on the image, closes. Escape is its keyboard equivalent, which is why\n there is no key handler here. -->\n <div\n #stage\n class=\"ui-image-preview-stage\"\n (pointerdown)=\"onStagePointerDown($event)\"\n (wheel)=\"onWheel($event)\"\n >\n <img\n class=\"ui-image-preview-media\"\n [class._pannable]=\"canPan()\"\n [class._rotated]=\"isQuarterTurned()\"\n [src]=\"src()\"\n [alt]=\"alt()\"\n [style.transform]=\"transform()\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n draggable=\"false\"\n />\n </div>\n</div>\n", styles: [":host{position:fixed;inset:0;z-index:var(--ui-image-preview-z-index, 1100);display:block;background-color:var(--ui-image-preview-mask-background, var(--primitives-black-80))}.ui-image-preview{display:flex;flex-direction:column;gap:var(--ui-image-preview-gap, var(--units-md));box-sizing:border-box;width:100%;height:100%;padding:var(--ui-image-preview-padding, var(--units-lg));outline:none}.ui-image-preview-toolbar{flex:0 0 auto;display:flex;flex-wrap:wrap;align-self:center;justify-content:center;gap:var(--ui-image-preview-toolbar-gap, var(--units-2xs));padding:var(--ui-image-preview-toolbar-padding, var(--units-2xs));border-radius:var(--ui-image-preview-toolbar-radius, var(--radius-full));background-color:var(--ui-image-preview-toolbar-background, var(--primitives-black-50))}.ui-image-preview-action{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--ui-image-preview-action-size, 2.25rem);height:var(--ui-image-preview-action-size, 2.25rem);padding:0;border:none;border-radius:var(--ui-image-preview-action-radius, var(--radius-full));background:transparent;color:var(--ui-image-preview-action-color, var(--primitives-white-base));line-height:0;text-decoration:none;cursor:pointer;transition:background-color var(--ui-control-transition-duration, var(--transition-default)) var(--ui-control-transition-easing, var(--transition-easeinout)),color var(--ui-control-transition-duration, var(--transition-default)) var(--ui-control-transition-easing, var(--transition-easeinout))}.ui-image-preview-action:hover:not([aria-disabled]){background-color:var(--ui-image-preview-action-surface-hover, var(--primitives-white-20))}.ui-image-preview-action:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-image-preview-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-image-preview-action-focus-ring-color, var(--global-border-focus))}.ui-image-preview-action[aria-disabled=true]{opacity:var(--ui-image-preview-action-opacity-disabled, .4);cursor:not-allowed}@media(prefers-reduced-motion:reduce){.ui-image-preview-action{transition-duration:.01ms}}:root[data-motion=off] .ui-image-preview-action{transition-duration:.01ms}.ui-image-preview-stage{flex:1 1 auto;display:flex;align-items:center;justify-content:center;min-height:0;overflow:hidden;container-type:size}.ui-image-preview-media{max-width:var(--ui-image-preview-media-max-width, 100%);max-height:var(--ui-image-preview-media-max-height, 100%);box-shadow:var(--ui-image-preview-media-shadow, var(--shadow-default-lg));object-fit:contain;transform-origin:center;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.ui-image-preview-media._rotated{max-width:var(--ui-image-preview-media-max-width-rotated, 100cqh);max-height:var(--ui-image-preview-media-max-height-rotated, 100cqw)}.ui-image-preview-media._pannable{cursor:grab}.ui-image-preview-media._pannable:active{cursor:grabbing}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }] }); }
203
+ }
204
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: UiImagePreview, decorators: [{
205
+ type: Component,
206
+ args: [{ selector: 'ui-image-preview', imports: [A11yModule, UiIcon], template: "<!-- The host is the mask; this is the dialog that owns the focus, the keyboard\n shortcuts and the aria wiring. -->\n<div\n class=\"ui-image-preview\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"ariaLabel() || null\"\n tabindex=\"-1\"\n [cdkTrapFocus]=\"true\"\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onKeydown($event)\"\n>\n <!-- Unavailable actions are `aria-disabled`, not `disabled`: a real `disabled`\n drops the focus to the body the moment the button that holds it hits a\n bound, and `Escape` then no longer reaches the dialog. The handlers clamp,\n so a press at the bound is a no-op. -->\n <div class=\"ui-image-preview-toolbar\">\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"zoomOutAriaLabel() || null\"\n [attr.aria-disabled]=\"!canZoomOut() || null\"\n (click)=\"zoomOut()\"\n >\n <ui-icon name=\"magnifying-glass-minus\" size=\"sm\" />\n </button>\n\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"zoomInAriaLabel() || null\"\n [attr.aria-disabled]=\"!canZoomIn() || null\"\n (click)=\"zoomIn()\"\n >\n <ui-icon name=\"magnifying-glass-plus\" size=\"sm\" />\n </button>\n\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"rotateLeftAriaLabel() || null\"\n (click)=\"rotateLeft()\"\n >\n <ui-icon name=\"rotate-left\" size=\"sm\" />\n </button>\n\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"rotateRightAriaLabel() || null\"\n (click)=\"rotateRight()\"\n >\n <ui-icon name=\"rotate-right\" size=\"sm\" />\n </button>\n\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"resetAriaLabel() || null\"\n [attr.aria-disabled]=\"isPristine() || null\"\n (click)=\"reset()\"\n >\n <ui-icon name=\"arrows-rotate\" size=\"sm\" />\n </button>\n\n @if (downloadable()) {\n <a\n class=\"ui-image-preview-action\"\n [href]=\"src()\"\n [attr.download]=\"downloadName() || ''\"\n [attr.aria-label]=\"downloadAriaLabel() || null\"\n target=\"_blank\"\n rel=\"noopener\"\n >\n <ui-icon name=\"download\" size=\"sm\" />\n </a>\n }\n\n <button\n type=\"button\"\n class=\"ui-image-preview-action\"\n [attr.aria-label]=\"closeAriaLabel() || null\"\n (click)=\"close()\"\n >\n <ui-icon name=\"xmark\" size=\"sm\" />\n </button>\n </div>\n\n <!-- The stage is the dismiss-on-outside target: a press that lands on it, and\n not on the image, closes. Escape is its keyboard equivalent, which is why\n there is no key handler here. -->\n <div\n #stage\n class=\"ui-image-preview-stage\"\n (pointerdown)=\"onStagePointerDown($event)\"\n (wheel)=\"onWheel($event)\"\n >\n <img\n class=\"ui-image-preview-media\"\n [class._pannable]=\"canPan()\"\n [class._rotated]=\"isQuarterTurned()\"\n [src]=\"src()\"\n [alt]=\"alt()\"\n [style.transform]=\"transform()\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n draggable=\"false\"\n />\n </div>\n</div>\n", styles: [":host{position:fixed;inset:0;z-index:var(--ui-image-preview-z-index, 1100);display:block;background-color:var(--ui-image-preview-mask-background, var(--primitives-black-80))}.ui-image-preview{display:flex;flex-direction:column;gap:var(--ui-image-preview-gap, var(--units-md));box-sizing:border-box;width:100%;height:100%;padding:var(--ui-image-preview-padding, var(--units-lg));outline:none}.ui-image-preview-toolbar{flex:0 0 auto;display:flex;flex-wrap:wrap;align-self:center;justify-content:center;gap:var(--ui-image-preview-toolbar-gap, var(--units-2xs));padding:var(--ui-image-preview-toolbar-padding, var(--units-2xs));border-radius:var(--ui-image-preview-toolbar-radius, var(--radius-full));background-color:var(--ui-image-preview-toolbar-background, var(--primitives-black-50))}.ui-image-preview-action{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--ui-image-preview-action-size, 2.25rem);height:var(--ui-image-preview-action-size, 2.25rem);padding:0;border:none;border-radius:var(--ui-image-preview-action-radius, var(--radius-full));background:transparent;color:var(--ui-image-preview-action-color, var(--primitives-white-base));line-height:0;text-decoration:none;cursor:pointer;transition:background-color var(--ui-control-transition-duration, var(--transition-default)) var(--ui-control-transition-easing, var(--transition-easeinout)),color var(--ui-control-transition-duration, var(--transition-default)) var(--ui-control-transition-easing, var(--transition-easeinout))}.ui-image-preview-action:hover:not([aria-disabled]){background-color:var(--ui-image-preview-action-surface-hover, var(--primitives-white-20))}.ui-image-preview-action:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-image-preview-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-image-preview-action-focus-ring-color, var(--global-border-focus))}.ui-image-preview-action[aria-disabled=true]{opacity:var(--ui-image-preview-action-opacity-disabled, .4);cursor:not-allowed}@media(prefers-reduced-motion:reduce){.ui-image-preview-action{transition-duration:.01ms}}:root[data-motion=off] .ui-image-preview-action{transition-duration:.01ms}.ui-image-preview-stage{flex:1 1 auto;display:flex;align-items:center;justify-content:center;min-height:0;overflow:hidden;container-type:size}.ui-image-preview-media{max-width:var(--ui-image-preview-media-max-width, 100%);max-height:var(--ui-image-preview-media-max-height, 100%);box-shadow:var(--ui-image-preview-media-shadow, var(--shadow-default-lg));object-fit:contain;transform-origin:center;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.ui-image-preview-media._rotated{max-width:var(--ui-image-preview-media-max-width-rotated, 100cqh);max-height:var(--ui-image-preview-media-max-height-rotated, 100cqw)}.ui-image-preview-media._pannable{cursor:grab}.ui-image-preview-media._pannable:active{cursor:grabbing}\n"] }]
207
+ }], ctorParameters: () => [], propDecorators: { src: [{ type: i0.Input, args: [{ isSignal: true, alias: "src", required: true }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], zoomStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "zoomStep", required: false }] }], minZoom: [{ type: i0.Input, args: [{ isSignal: true, alias: "minZoom", required: false }] }], maxZoom: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxZoom", required: false }] }], downloadable: [{ type: i0.Input, args: [{ isSignal: true, alias: "downloadable", required: false }] }], downloadName: [{ type: i0.Input, args: [{ isSignal: true, alias: "downloadName", required: false }] }], dismissableMask: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissableMask", required: false }] }], zoomInAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "zoomInAriaLabel", required: false }] }], zoomOutAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "zoomOutAriaLabel", required: false }] }], rotateLeftAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "rotateLeftAriaLabel", required: false }] }], rotateRightAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "rotateRightAriaLabel", required: false }] }], resetAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetAriaLabel", required: false }] }], downloadAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "downloadAriaLabel", required: false }] }], closeAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeAriaLabel", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], stage: [{ type: i0.ViewChild, args: ['stage', { isSignal: true }] }] } });
8
208
 
9
209
  /**
10
210
  * Assainissement des SVG inlinés par `ui-image`.
@@ -109,16 +309,25 @@ function provideUiImageAssets(map) {
109
309
  * `sanitizeInlineSvg()` may ever be read back out of here.
110
310
  */
111
311
  const SVG_CACHE = new Map();
312
+ /** Payload carried in the URL itself (`data:image/png;base64,…`). */
313
+ const DATA_URL = /^data:/i;
112
314
  /**
113
315
  * ui-image — theme/brand-aware image.
114
316
  *
115
- * Two sources: `name` (local asset key resolved through `assets-map.json`,
116
- * theme/brand variants) or `src` (remote/absolute URL — takes precedence).
317
+ * Three sources: `name` (local asset key resolved through `assets-map.json`,
318
+ * theme/brand variants), `src` (remote/absolute URL — takes precedence), and
319
+ * `src` + `secured` (the URL is fetched through `HttpClient`, so the app's
320
+ * interceptors authenticate it, and the response `Blob` is shown from an object
321
+ * URL revoked with the component).
117
322
  * Local `.svg` assets are inlined (`innerHTML`) so they can inherit CSS — after
118
323
  * being scrubbed by `sanitizeInlineSvg()`; remote URLs always render through
119
- * `<img [ngSrc]>` (never inlined).
324
+ * `<img [ngSrc]>` (never inlined), except `data:`/`blob:` payloads, which
325
+ * `NgOptimizedImage` rejects and a plain `<img>` renders.
120
326
  * On load failure the `fallback` local asset is shown, then a token-styled
121
327
  * placeholder if the fallback also fails (or none is provided).
328
+ *
329
+ * `preview` turns the image into a trigger for the enlarged view
330
+ * (`ui-image-preview`): zoom, rotation, pan, reset, optional download.
122
331
  */
123
332
  class UiImage {
124
333
  constructor() {
@@ -126,6 +335,7 @@ class UiImage {
126
335
  this.assetsMap = inject(UI_IMAGE_ASSETS, { optional: true }) ?? {};
127
336
  this.themeService = inject(ThemeService);
128
337
  this.brandService = inject(BrandService);
338
+ this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
129
339
  /** Local asset key in `assets-map.json` (theme/brand-aware resolution). */
130
340
  this.name = input(/* @ts-ignore */
131
341
  ...(ngDevMode ? [undefined, { debugName: "name" }] : /* istanbul ignore next */ []));
@@ -149,18 +359,88 @@ class UiImage {
149
359
  ...(ngDevMode ? [undefined, { debugName: "heightUnit" }] : /* istanbul ignore next */ []));
150
360
  this.alt = input(/* @ts-ignore */
151
361
  ...(ngDevMode ? [undefined, { debugName: "alt" }] : /* istanbul ignore next */ []));
362
+ /**
363
+ * Fetch `src` through `HttpClient` instead of letting the browser load it.
364
+ *
365
+ * That is what an endpoint behind an `Authorization` header needs: an `<img
366
+ * src>` is a plain browser request, which carries no interceptor and no
367
+ * bearer token. The response `Blob` is shown from an object URL, revoked as
368
+ * soon as the source changes or the component goes away.
369
+ *
370
+ * Cross-origin still applies: the endpoint must answer the CORS preflight
371
+ * (`Access-Control-Allow-Origin`, and `Access-Control-Allow-Headers` for the
372
+ * auth header) — an `<img>` would have displayed it without any of that.
373
+ */
374
+ this.secured = input(false, { ...(ngDevMode ? { debugName: "secured" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
375
+ /** Send cookies/TLS credentials with the `secured` request (cross-origin sessions). */
376
+ this.withCredentials = input(false, { ...(ngDevMode ? { debugName: "withCredentials" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
377
+ /** Visible text of the loading indicator shown while a `secured` fetch is in flight. */
378
+ this.loadingLabel = input(/* @ts-ignore */
379
+ ...(ngDevMode ? [undefined, { debugName: "loadingLabel" }] : /* istanbul ignore next */ []));
380
+ /** Accessible name of that loading indicator. */
381
+ this.loadingAriaLabel = input('Chargement de l’image', /* @ts-ignore */
382
+ ...(ngDevMode ? [{ debugName: "loadingAriaLabel" }] : /* istanbul ignore next */ []));
383
+ /** Clicking the image opens the enlarged view (`ui-image-preview`). */
384
+ this.preview = input(false, { ...(ngDevMode ? { debugName: "preview" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
385
+ /** Enlarged view open state (two-way — set it to open the preview yourself). */
386
+ this.previewVisible = model(false, /* @ts-ignore */
387
+ ...(ngDevMode ? [{ debugName: "previewVisible" }] : /* istanbul ignore next */ []));
388
+ /** Accessible name of the trigger (defaults to the image's own `alt`). */
389
+ this.previewAriaLabel = input(/* @ts-ignore */
390
+ ...(ngDevMode ? [undefined, { debugName: "previewAriaLabel" }] : /* istanbul ignore next */ []));
391
+ /** Accessible name of the enlarged view dialog. */
392
+ this.previewDialogAriaLabel = input('Aperçu de l’image', /* @ts-ignore */
393
+ ...(ngDevMode ? [{ debugName: "previewDialogAriaLabel" }] : /* istanbul ignore next */ []));
394
+ /** Zoom increment of one toolbar click, wheel notch or `+`/`-` press in the preview. */
395
+ this.zoomStep = input(0.25, { ...(ngDevMode ? { debugName: "zoomStep" } : /* istanbul ignore next */ {}), transform: numberAttribute });
396
+ /** Lower zoom bound in the preview. */
397
+ this.minZoom = input(0.5, { ...(ngDevMode ? { debugName: "minZoom" } : /* istanbul ignore next */ {}), transform: numberAttribute });
398
+ /** Upper zoom bound in the preview. */
399
+ this.maxZoom = input(4, { ...(ngDevMode ? { debugName: "maxZoom" } : /* istanbul ignore next */ {}), transform: numberAttribute });
400
+ /** Offer a download action in the preview toolbar. */
401
+ this.downloadable = input(false, { ...(ngDevMode ? { debugName: "downloadable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
402
+ /** Filename proposed by that download action. */
403
+ this.downloadName = input(/* @ts-ignore */
404
+ ...(ngDevMode ? [undefined, { debugName: "downloadName" }] : /* istanbul ignore next */ []));
152
405
  /** Emitted with the failed URL when an image fails to load. */
153
406
  this.loadFailed = output();
407
+ /**
408
+ * Replaces the hover indicator of the `preview` mode (the magnifier). Rendered
409
+ * over the image, decorative — the accessible name stays on the trigger.
410
+ *
411
+ * ```html
412
+ * <ui-image src="…" preview>
413
+ * <ng-template #previewIndicator>Agrandir</ng-template>
414
+ * </ui-image>
415
+ * ```
416
+ */
417
+ this.previewIndicator = contentChild('previewIndicator', /* @ts-ignore */
418
+ ...(ngDevMode ? [{ debugName: "previewIndicator" }] : /* istanbul ignore next */ []));
154
419
  this.isRemote = computed(() => !!this.src(), /* @ts-ignore */
155
420
  ...(ngDevMode ? [{ debugName: "isRemote" }] : /* istanbul ignore next */ []));
156
421
  /** Inline SVG is reserved for LOCAL assets — a remote `.svg` renders through `<img>` (no XSS surface). */
157
422
  this.isInlineSvg = computed(() => !this.isRemote() && !!this.name()?.toLowerCase().endsWith('.svg'), /* @ts-ignore */
158
423
  ...(ngDevMode ? [{ debugName: "isInlineSvg" }] : /* istanbul ignore next */ []));
424
+ /** `secured` only means anything with a `src` to fetch. */
425
+ this.isSecured = computed(() => this.secured() && !!this.src(), /* @ts-ignore */
426
+ ...(ngDevMode ? [{ debugName: "isSecured" }] : /* istanbul ignore next */ []));
427
+ /** A `data:` payload is already the image — `NgOptimizedImage` refuses it. */
428
+ this.isDataUrl = computed(() => DATA_URL.test(this.src() ?? ''), /* @ts-ignore */
429
+ ...(ngDevMode ? [{ debugName: "isDataUrl" }] : /* istanbul ignore next */ []));
159
430
  this.localSrc = computed(() => this.resolveLocal(this.name()), /* @ts-ignore */
160
431
  ...(ngDevMode ? [{ debugName: "localSrc" }] : /* istanbul ignore next */ []));
161
432
  this.fallbackSrc = computed(() => this.resolveLocal(this.fallback()), /* @ts-ignore */
162
433
  ...(ngDevMode ? [{ debugName: "fallbackSrc" }] : /* istanbul ignore next */ []));
163
- this.primarySrc = computed(() => this.src() || this.localSrc(), /* @ts-ignore */
434
+ // --- Secured source (HttpClient → Blob → object URL) ------------------
435
+ this.blobResource = httpResource.blob(() => this.isSecured() ? { url: this.src(), withCredentials: this.withCredentials() } : undefined, /* @ts-ignore */
436
+ ...(ngDevMode ? [{ debugName: "blobResource" }] : /* istanbul ignore next */ []));
437
+ this.blobUrl = signal(null, /* @ts-ignore */
438
+ ...(ngDevMode ? [{ debugName: "blobUrl" }] : /* istanbul ignore next */ []));
439
+ this.securedLoading = computed(() => this.isSecured() && this.blobResource.isLoading(), /* @ts-ignore */
440
+ ...(ngDevMode ? [{ debugName: "securedLoading" }] : /* istanbul ignore next */ []));
441
+ this.securedFailed = computed(() => this.isSecured() && this.blobResource.status() === 'error', /* @ts-ignore */
442
+ ...(ngDevMode ? [{ debugName: "securedFailed" }] : /* istanbul ignore next */ []));
443
+ this.primarySrc = computed(() => this.isSecured() ? (this.blobUrl() ?? '') : this.src() || this.localSrc(), /* @ts-ignore */
164
444
  ...(ngDevMode ? [{ debugName: "primarySrc" }] : /* istanbul ignore next */ []));
165
445
  // Failure flags auto-reset when their source URL changes (theme/brand/src swap → automatic retry).
166
446
  this.primaryImgFailed = linkedSignal({ ...(ngDevMode ? { debugName: "primaryImgFailed" } : /* istanbul ignore next */ {}), source: this.primarySrc,
@@ -202,15 +482,26 @@ class UiImage {
202
482
  return safe === undefined ? null : this.sanitizer.bypassSecurityTrustHtml(safe);
203
483
  }, /* @ts-ignore */
204
484
  ...(ngDevMode ? [{ debugName: "svgContent" }] : /* istanbul ignore next */ []));
205
- this.primaryFailed = computed(() => this.isInlineSvg() ? this.svgResource.status() === 'error' : this.primaryImgFailed(), /* @ts-ignore */
485
+ this.primaryFailed = computed(() => {
486
+ if (this.isInlineSvg())
487
+ return this.svgResource.status() === 'error';
488
+ return this.securedFailed() || this.primaryImgFailed();
489
+ }, /* @ts-ignore */
206
490
  ...(ngDevMode ? [{ debugName: "primaryFailed" }] : /* istanbul ignore next */ []));
207
491
  this.showFallback = computed(() => this.primaryFailed() && !!this.fallbackSrc() && !this.fallbackImgFailed(), /* @ts-ignore */
208
492
  ...(ngDevMode ? [{ debugName: "showFallback" }] : /* istanbul ignore next */ []));
209
- this.showPlaceholder = computed(() => !this.primarySrc() ||
210
- (this.primaryFailed() && (!this.fallbackSrc() || this.fallbackImgFailed())), /* @ts-ignore */
493
+ this.showPlaceholder = computed(() => !this.securedLoading() &&
494
+ (!this.primarySrc() ||
495
+ (this.primaryFailed() && (!this.fallbackSrc() || this.fallbackImgFailed()))), /* @ts-ignore */
211
496
  ...(ngDevMode ? [{ debugName: "showPlaceholder" }] : /* istanbul ignore next */ []));
212
497
  this.displayedSrc = computed(() => this.showFallback() ? this.fallbackSrc() : this.primarySrc(), /* @ts-ignore */
213
498
  ...(ngDevMode ? [{ debugName: "displayedSrc" }] : /* istanbul ignore next */ []));
499
+ /** `blob:`/`data:` bypass `NgOptimizedImage`; a local fallback never does. */
500
+ this.isRawSrc = computed(() => !this.showFallback() && (this.isSecured() || this.isDataUrl()), /* @ts-ignore */
501
+ ...(ngDevMode ? [{ debugName: "isRawSrc" }] : /* istanbul ignore next */ []));
502
+ /** The image is a preview trigger only once there is something to enlarge. */
503
+ this.canPreview = computed(() => this.preview() && !this.showPlaceholder() && !this.securedLoading(), /* @ts-ignore */
504
+ ...(ngDevMode ? [{ debugName: "canPreview" }] : /* istanbul ignore next */ []));
214
505
  this.cssWidth = computed(() => this.width() != null ? `${this.width()}${this.widthUnit() || 'px'}` : null, /* @ts-ignore */
215
506
  ...(ngDevMode ? [{ debugName: "cssWidth" }] : /* istanbul ignore next */ []));
216
507
  this.cssHeight = computed(() => this.height() != null ? `${this.height()}${this.heightUnit() || 'px'}` : null, /* @ts-ignore */
@@ -225,6 +516,30 @@ class UiImage {
225
516
  if (url && this.svgResource.hasValue())
226
517
  SVG_CACHE.set(url, sanitizeInlineSvg(this.svgResource.value()));
227
518
  });
519
+ // The object URL's whole lifetime: created when a Blob arrives, revoked by
520
+ // the cleanup — which runs before the next source AND on destroy. That is
521
+ // what keeps a list of secured images from leaking one URL per render.
522
+ effect((onCleanup) => {
523
+ const blob = this.blobResource.hasValue() ? this.blobResource.value() : undefined;
524
+ if (!blob || !this.isBrowser) {
525
+ this.blobUrl.set(null);
526
+ return;
527
+ }
528
+ const url = URL.createObjectURL(blob);
529
+ this.blobUrl.set(url);
530
+ onCleanup(() => URL.revokeObjectURL(url));
531
+ });
532
+ // A failed fetch never reaches an `<img>`, so `(error)` cannot report it.
533
+ effect(() => {
534
+ if (this.securedFailed())
535
+ this.loadFailed.emit(this.src());
536
+ });
537
+ // Nothing left to enlarge (source swapped, load failed): close rather than
538
+ // leave the dialog on a stale image.
539
+ effect(() => {
540
+ if (this.previewVisible() && !this.canPreview())
541
+ this.previewVisible.set(false);
542
+ });
228
543
  if (isDevMode()) {
229
544
  effect(() => {
230
545
  if (this.src() && this.name()) {
@@ -233,6 +548,12 @@ class UiImage {
233
548
  if (!this.src() && !this.name()) {
234
549
  console.warn('[ui-image] Neither `src` nor `name` is set — the placeholder is displayed.');
235
550
  }
551
+ if (this.secured() && !this.src()) {
552
+ console.warn('[ui-image] `secured` has no effect without `src` — nothing to fetch.');
553
+ }
554
+ if (this.preview() && !this.alt() && !this.previewAriaLabel()) {
555
+ console.warn('[ui-image] `preview` renders a button with no accessible name — set `alt` or `previewAriaLabel`.');
556
+ }
236
557
  });
237
558
  }
238
559
  }
@@ -285,21 +606,24 @@ class UiImage {
285
606
  }
286
607
  return '';
287
608
  }
288
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: UiImage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
289
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", type: UiImage, isStandalone: true, selector: "ui-image", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, fallback: { classPropertyName: "fallback", publicName: "fallback", isSignal: true, isRequired: false, transformFunction: null }, priority: { classPropertyName: "priority", publicName: "priority", isSignal: true, isRequired: false, transformFunction: null }, fill: { classPropertyName: "fill", publicName: "fill", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, widthUnit: { classPropertyName: "widthUnit", publicName: "widthUnit", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, heightUnit: { classPropertyName: "heightUnit", publicName: "heightUnit", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { loadFailed: "loadFailed" }, ngImport: i0, template: "@if (showPlaceholder()) {\n <div\n class=\"ui-image-placeholder\"\n [style.width]=\"cssWidth()\"\n [style.height]=\"cssHeight()\"\n [attr.role]=\"alt() ? 'img' : null\"\n [attr.aria-label]=\"alt() || null\"\n [attr.aria-hidden]=\"alt() ? null : true\"\n >\n <ui-icon name=\"image\" />\n </div>\n} @else if (isInlineSvg() && !primaryFailed()) {\n <!--\n EXCEPTION JUSTIFI\u00C9E (FSHSP-177) : le SVG local est inlin\u00E9 pour h\u00E9riter du CSS\n (currentColor, th\u00E8me) \u2014 un <img> ne le permet pas. La valeur est assainie par\n sanitizeInlineSvg() puis pass\u00E9e \u00E0 bypassSecurityTrustHtml() dans ui-image.ts.\n Registre : docs/SECURITY-PRACTICES.md.\n Une paire disable/enable et non un disable-next-line : un commentaire HTML ne\n peut pas se glisser \u00E0 l'int\u00E9rieur d'une balise ouvrante.\n -->\n <!-- eslint-disable no-restricted-syntax -->\n <div\n class=\"ui-image-svg\"\n [style.width]=\"cssWidth()\"\n [style.height]=\"cssHeight()\"\n [innerHTML]=\"svgContent()\"\n ></div>\n <!-- eslint-enable no-restricted-syntax -->\n} @else {\n <img\n class=\"ui-image\"\n [ngSrc]=\"displayedSrc()!\"\n [alt]=\"alt() || ''\"\n [width]=\"!fill() ? width() : null\"\n [height]=\"!fill() ? (height() ? height() : width()) : null\"\n [fill]=\"fill()\"\n [priority]=\"priority()\"\n (error)=\"onImgError()\"\n />\n}\n", styles: ["@charset \"UTF-8\";:host{display:flex;align-items:center;justify-content:center}.ui-image{object-fit:var(--ui-image-object-fit, contain)}.ui-image-svg{display:flex;width:100%}.ui-image-svg ::ng-deep svg{width:100%;height:100%}.ui-image-placeholder{display:flex;align-items:center;justify-content:center;min-width:var(--ui-image-placeholder-min-width, var(--units-xl));min-height:var(--ui-image-placeholder-min-height, var(--units-xl));border-radius:var(--ui-image-placeholder-radius, var(--radius-default));background:var(--global-background-muted);color:var(--global-text-muted)}\n"], dependencies: [{ kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }] }); }
609
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: UiImage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
610
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: UiImage, isStandalone: true, selector: "ui-image", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, fallback: { classPropertyName: "fallback", publicName: "fallback", isSignal: true, isRequired: false, transformFunction: null }, priority: { classPropertyName: "priority", publicName: "priority", isSignal: true, isRequired: false, transformFunction: null }, fill: { classPropertyName: "fill", publicName: "fill", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, widthUnit: { classPropertyName: "widthUnit", publicName: "widthUnit", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, heightUnit: { classPropertyName: "heightUnit", publicName: "heightUnit", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, secured: { classPropertyName: "secured", publicName: "secured", isSignal: true, isRequired: false, transformFunction: null }, withCredentials: { classPropertyName: "withCredentials", publicName: "withCredentials", isSignal: true, isRequired: false, transformFunction: null }, loadingLabel: { classPropertyName: "loadingLabel", publicName: "loadingLabel", isSignal: true, isRequired: false, transformFunction: null }, loadingAriaLabel: { classPropertyName: "loadingAriaLabel", publicName: "loadingAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, preview: { classPropertyName: "preview", publicName: "preview", isSignal: true, isRequired: false, transformFunction: null }, previewVisible: { classPropertyName: "previewVisible", publicName: "previewVisible", isSignal: true, isRequired: false, transformFunction: null }, previewAriaLabel: { classPropertyName: "previewAriaLabel", publicName: "previewAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, previewDialogAriaLabel: { classPropertyName: "previewDialogAriaLabel", publicName: "previewDialogAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, zoomStep: { classPropertyName: "zoomStep", publicName: "zoomStep", isSignal: true, isRequired: false, transformFunction: null }, minZoom: { classPropertyName: "minZoom", publicName: "minZoom", isSignal: true, isRequired: false, transformFunction: null }, maxZoom: { classPropertyName: "maxZoom", publicName: "maxZoom", isSignal: true, isRequired: false, transformFunction: null }, downloadable: { classPropertyName: "downloadable", publicName: "downloadable", isSignal: true, isRequired: false, transformFunction: null }, downloadName: { classPropertyName: "downloadName", publicName: "downloadName", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { previewVisible: "previewVisibleChange", loadFailed: "loadFailed" }, queries: [{ propertyName: "previewIndicator", first: true, predicate: ["previewIndicator"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- The media is written once and rendered either bare, or inside the preview\n trigger \u2014 a `<button>` cannot wrap three `@else if` branches otherwise. -->\n<ng-template #media>\n @if (securedLoading()) {\n <div\n class=\"ui-image-placeholder _loading\"\n [style.width]=\"cssWidth()\"\n [style.height]=\"cssHeight()\"\n >\n <ui-spinner size=\"small\" [label]=\"loadingLabel()\" [ariaLabel]=\"loadingAriaLabel()\" />\n </div>\n } @else if (showPlaceholder()) {\n <div\n class=\"ui-image-placeholder\"\n [style.width]=\"cssWidth()\"\n [style.height]=\"cssHeight()\"\n [attr.role]=\"alt() ? 'img' : null\"\n [attr.aria-label]=\"alt() || null\"\n [attr.aria-hidden]=\"alt() ? null : true\"\n >\n <ui-icon name=\"image\" />\n </div>\n } @else if (isInlineSvg() && !primaryFailed()) {\n <!--\n EXCEPTION JUSTIFI\u00C9E (FSHSP-177) : le SVG local est inlin\u00E9 pour h\u00E9riter du CSS\n (currentColor, th\u00E8me) \u2014 un <img> ne le permet pas. La valeur est assainie par\n sanitizeInlineSvg() puis pass\u00E9e \u00E0 bypassSecurityTrustHtml() dans ui-image.ts.\n Registre : docs/SECURITY-PRACTICES.md.\n Une paire disable/enable et non un disable-next-line : un commentaire HTML ne\n peut pas se glisser \u00E0 l'int\u00E9rieur d'une balise ouvrante.\n -->\n <!-- eslint-disable no-restricted-syntax -->\n <div\n class=\"ui-image-svg\"\n [style.width]=\"cssWidth()\"\n [style.height]=\"cssHeight()\"\n [innerHTML]=\"svgContent()\"\n ></div>\n <!-- eslint-enable no-restricted-syntax -->\n } @else if (isRawSrc()) {\n <!-- `blob:` / `data:` : NgOptimizedImage refuses both, a plain <img> shows them. -->\n <img\n class=\"ui-image\"\n [src]=\"displayedSrc()!\"\n [alt]=\"alt() || ''\"\n [style.width]=\"!fill() ? cssWidth() : null\"\n [style.height]=\"!fill() ? cssHeight() : null\"\n [attr.loading]=\"priority() ? null : 'lazy'\"\n [attr.fetchpriority]=\"priority() ? 'high' : null\"\n (error)=\"onImgError()\"\n />\n } @else {\n <img\n class=\"ui-image\"\n [ngSrc]=\"displayedSrc()!\"\n [alt]=\"alt() || ''\"\n [width]=\"!fill() ? width() : null\"\n [height]=\"!fill() ? (height() ? height() : width()) : null\"\n [fill]=\"fill()\"\n [priority]=\"priority()\"\n (error)=\"onImgError()\"\n />\n }\n</ng-template>\n\n@if (canPreview()) {\n <button\n type=\"button\"\n class=\"ui-image-trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"previewAriaLabel() || null\"\n (click)=\"previewVisible.set(true)\"\n >\n <ng-container [ngTemplateOutlet]=\"media\" />\n\n <!-- Decorative: the affordance is already carried by the button's role and\n its accessible name. -->\n <span class=\"ui-image-indicator\" aria-hidden=\"true\">\n @if (previewIndicator(); as indicator) {\n <ng-container [ngTemplateOutlet]=\"indicator\" />\n } @else {\n <ui-icon name=\"magnifying-glass-plus\" />\n }\n </span>\n </button>\n} @else {\n <ng-container [ngTemplateOutlet]=\"media\" />\n}\n\n@if (previewVisible()) {\n <ui-image-preview\n [src]=\"displayedSrc()!\"\n [alt]=\"alt() || ''\"\n [ariaLabel]=\"previewDialogAriaLabel()\"\n [zoomStep]=\"zoomStep()\"\n [minZoom]=\"minZoom()\"\n [maxZoom]=\"maxZoom()\"\n [downloadable]=\"downloadable()\"\n [downloadName]=\"downloadName()\"\n (closed)=\"previewVisible.set(false)\"\n [uiMotion]=\"'fade'\"\n #previewMotion=\"uiMotion\"\n [animate.enter]=\"previewMotion.enter()\"\n [animate.leave]=\"previewMotion.leave()\"\n />\n}\n", styles: ["@charset \"UTF-8\";:host{display:flex;align-items:center;justify-content:center}.ui-image{object-fit:var(--ui-image-object-fit, contain)}.ui-image-svg{display:flex;width:100%}.ui-image-svg ::ng-deep svg{width:100%;height:100%}.ui-image-placeholder{display:flex;align-items:center;justify-content:center;min-width:var(--ui-image-placeholder-min-width, var(--units-xl));min-height:var(--ui-image-placeholder-min-height, var(--units-xl));border-radius:var(--ui-image-placeholder-radius, var(--radius-default));background:var(--ui-image-placeholder-surface, var(--global-background-muted));color:var(--ui-image-placeholder-color, var(--global-text-muted))}.ui-image-trigger{position:relative;display:inline-flex;padding:0;border:none;border-radius:var(--ui-image-trigger-radius, 0);background:none;line-height:0;cursor:pointer}.ui-image-trigger:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-image-trigger-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-image-trigger-focus-ring-color, var(--global-border-focus))}.ui-image-trigger:hover .ui-image-indicator,.ui-image-trigger:focus-visible .ui-image-indicator{opacity:1}.ui-image-indicator{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border-radius:inherit;background:var(--ui-image-indicator-background, var(--primitives-black-50));color:var(--ui-image-indicator-color, var(--primitives-white-base));font-size:var(--ui-image-indicator-font-size, var(--size-typography-text-lg));line-height:1;opacity:0;transition:opacity var(--ui-control-transition-duration, var(--transition-default)) var(--ui-control-transition-easing, var(--transition-easeinout))}@media(prefers-reduced-motion:reduce){.ui-image-indicator{transition-duration:.01ms}}:root[data-motion=off] .ui-image-indicator{transition-duration:.01ms}\n"], dependencies: [{ kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }, { kind: "component", type: UiSpinner, selector: "ui-spinner", inputs: ["size", "orientation", "label", "ariaLabel", "spinnerTemplate", "image", "imageAlt", "icon", "strokeWidth", "fill", "animationDuration", "delay"] }, { kind: "directive", type: UiMotion, selector: "[uiMotion]", inputs: ["uiMotion", "motionDuration", "motionDelay", "motionEasing", "motionEnterEasing", "motionLeaveEasing", "motionDistance", "motionScale", "motionDisabled", "motionOnInsert"], exportAs: ["uiMotion"] }, { kind: "component", type: UiImagePreview, selector: "ui-image-preview", inputs: ["src", "alt", "ariaLabel", "zoomStep", "minZoom", "maxZoom", "downloadable", "downloadName", "dismissableMask", "zoomInAriaLabel", "zoomOutAriaLabel", "rotateLeftAriaLabel", "rotateRightAriaLabel", "resetAriaLabel", "downloadAriaLabel", "closeAriaLabel"], outputs: ["closed"] }] }); }
290
611
  }
291
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: UiImage, decorators: [{
612
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: UiImage, decorators: [{
292
613
  type: Component,
293
- args: [{ selector: 'ui-image', imports: [NgOptimizedImage, UiIcon], template: "@if (showPlaceholder()) {\n <div\n class=\"ui-image-placeholder\"\n [style.width]=\"cssWidth()\"\n [style.height]=\"cssHeight()\"\n [attr.role]=\"alt() ? 'img' : null\"\n [attr.aria-label]=\"alt() || null\"\n [attr.aria-hidden]=\"alt() ? null : true\"\n >\n <ui-icon name=\"image\" />\n </div>\n} @else if (isInlineSvg() && !primaryFailed()) {\n <!--\n EXCEPTION JUSTIFI\u00C9E (FSHSP-177) : le SVG local est inlin\u00E9 pour h\u00E9riter du CSS\n (currentColor, th\u00E8me) \u2014 un <img> ne le permet pas. La valeur est assainie par\n sanitizeInlineSvg() puis pass\u00E9e \u00E0 bypassSecurityTrustHtml() dans ui-image.ts.\n Registre : docs/SECURITY-PRACTICES.md.\n Une paire disable/enable et non un disable-next-line : un commentaire HTML ne\n peut pas se glisser \u00E0 l'int\u00E9rieur d'une balise ouvrante.\n -->\n <!-- eslint-disable no-restricted-syntax -->\n <div\n class=\"ui-image-svg\"\n [style.width]=\"cssWidth()\"\n [style.height]=\"cssHeight()\"\n [innerHTML]=\"svgContent()\"\n ></div>\n <!-- eslint-enable no-restricted-syntax -->\n} @else {\n <img\n class=\"ui-image\"\n [ngSrc]=\"displayedSrc()!\"\n [alt]=\"alt() || ''\"\n [width]=\"!fill() ? width() : null\"\n [height]=\"!fill() ? (height() ? height() : width()) : null\"\n [fill]=\"fill()\"\n [priority]=\"priority()\"\n (error)=\"onImgError()\"\n />\n}\n", styles: ["@charset \"UTF-8\";:host{display:flex;align-items:center;justify-content:center}.ui-image{object-fit:var(--ui-image-object-fit, contain)}.ui-image-svg{display:flex;width:100%}.ui-image-svg ::ng-deep svg{width:100%;height:100%}.ui-image-placeholder{display:flex;align-items:center;justify-content:center;min-width:var(--ui-image-placeholder-min-width, var(--units-xl));min-height:var(--ui-image-placeholder-min-height, var(--units-xl));border-radius:var(--ui-image-placeholder-radius, var(--radius-default));background:var(--global-background-muted);color:var(--global-text-muted)}\n"] }]
294
- }], ctorParameters: () => [], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], src: [{ type: i0.Input, args: [{ isSignal: true, alias: "src", required: false }] }], fallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "fallback", required: false }] }], priority: [{ type: i0.Input, args: [{ isSignal: true, alias: "priority", required: false }] }], fill: [{ type: i0.Input, args: [{ isSignal: true, alias: "fill", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], widthUnit: [{ type: i0.Input, args: [{ isSignal: true, alias: "widthUnit", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], heightUnit: [{ type: i0.Input, args: [{ isSignal: true, alias: "heightUnit", required: false }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], loadFailed: [{ type: i0.Output, args: ["loadFailed"] }] } });
614
+ args: [{ selector: 'ui-image', imports: [NgOptimizedImage, NgTemplateOutlet, UiIcon, UiSpinner, UiMotion, UiImagePreview], template: "<!-- The media is written once and rendered either bare, or inside the preview\n trigger \u2014 a `<button>` cannot wrap three `@else if` branches otherwise. -->\n<ng-template #media>\n @if (securedLoading()) {\n <div\n class=\"ui-image-placeholder _loading\"\n [style.width]=\"cssWidth()\"\n [style.height]=\"cssHeight()\"\n >\n <ui-spinner size=\"small\" [label]=\"loadingLabel()\" [ariaLabel]=\"loadingAriaLabel()\" />\n </div>\n } @else if (showPlaceholder()) {\n <div\n class=\"ui-image-placeholder\"\n [style.width]=\"cssWidth()\"\n [style.height]=\"cssHeight()\"\n [attr.role]=\"alt() ? 'img' : null\"\n [attr.aria-label]=\"alt() || null\"\n [attr.aria-hidden]=\"alt() ? null : true\"\n >\n <ui-icon name=\"image\" />\n </div>\n } @else if (isInlineSvg() && !primaryFailed()) {\n <!--\n EXCEPTION JUSTIFI\u00C9E (FSHSP-177) : le SVG local est inlin\u00E9 pour h\u00E9riter du CSS\n (currentColor, th\u00E8me) \u2014 un <img> ne le permet pas. La valeur est assainie par\n sanitizeInlineSvg() puis pass\u00E9e \u00E0 bypassSecurityTrustHtml() dans ui-image.ts.\n Registre : docs/SECURITY-PRACTICES.md.\n Une paire disable/enable et non un disable-next-line : un commentaire HTML ne\n peut pas se glisser \u00E0 l'int\u00E9rieur d'une balise ouvrante.\n -->\n <!-- eslint-disable no-restricted-syntax -->\n <div\n class=\"ui-image-svg\"\n [style.width]=\"cssWidth()\"\n [style.height]=\"cssHeight()\"\n [innerHTML]=\"svgContent()\"\n ></div>\n <!-- eslint-enable no-restricted-syntax -->\n } @else if (isRawSrc()) {\n <!-- `blob:` / `data:` : NgOptimizedImage refuses both, a plain <img> shows them. -->\n <img\n class=\"ui-image\"\n [src]=\"displayedSrc()!\"\n [alt]=\"alt() || ''\"\n [style.width]=\"!fill() ? cssWidth() : null\"\n [style.height]=\"!fill() ? cssHeight() : null\"\n [attr.loading]=\"priority() ? null : 'lazy'\"\n [attr.fetchpriority]=\"priority() ? 'high' : null\"\n (error)=\"onImgError()\"\n />\n } @else {\n <img\n class=\"ui-image\"\n [ngSrc]=\"displayedSrc()!\"\n [alt]=\"alt() || ''\"\n [width]=\"!fill() ? width() : null\"\n [height]=\"!fill() ? (height() ? height() : width()) : null\"\n [fill]=\"fill()\"\n [priority]=\"priority()\"\n (error)=\"onImgError()\"\n />\n }\n</ng-template>\n\n@if (canPreview()) {\n <button\n type=\"button\"\n class=\"ui-image-trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"previewAriaLabel() || null\"\n (click)=\"previewVisible.set(true)\"\n >\n <ng-container [ngTemplateOutlet]=\"media\" />\n\n <!-- Decorative: the affordance is already carried by the button's role and\n its accessible name. -->\n <span class=\"ui-image-indicator\" aria-hidden=\"true\">\n @if (previewIndicator(); as indicator) {\n <ng-container [ngTemplateOutlet]=\"indicator\" />\n } @else {\n <ui-icon name=\"magnifying-glass-plus\" />\n }\n </span>\n </button>\n} @else {\n <ng-container [ngTemplateOutlet]=\"media\" />\n}\n\n@if (previewVisible()) {\n <ui-image-preview\n [src]=\"displayedSrc()!\"\n [alt]=\"alt() || ''\"\n [ariaLabel]=\"previewDialogAriaLabel()\"\n [zoomStep]=\"zoomStep()\"\n [minZoom]=\"minZoom()\"\n [maxZoom]=\"maxZoom()\"\n [downloadable]=\"downloadable()\"\n [downloadName]=\"downloadName()\"\n (closed)=\"previewVisible.set(false)\"\n [uiMotion]=\"'fade'\"\n #previewMotion=\"uiMotion\"\n [animate.enter]=\"previewMotion.enter()\"\n [animate.leave]=\"previewMotion.leave()\"\n />\n}\n", styles: ["@charset \"UTF-8\";:host{display:flex;align-items:center;justify-content:center}.ui-image{object-fit:var(--ui-image-object-fit, contain)}.ui-image-svg{display:flex;width:100%}.ui-image-svg ::ng-deep svg{width:100%;height:100%}.ui-image-placeholder{display:flex;align-items:center;justify-content:center;min-width:var(--ui-image-placeholder-min-width, var(--units-xl));min-height:var(--ui-image-placeholder-min-height, var(--units-xl));border-radius:var(--ui-image-placeholder-radius, var(--radius-default));background:var(--ui-image-placeholder-surface, var(--global-background-muted));color:var(--ui-image-placeholder-color, var(--global-text-muted))}.ui-image-trigger{position:relative;display:inline-flex;padding:0;border:none;border-radius:var(--ui-image-trigger-radius, 0);background:none;line-height:0;cursor:pointer}.ui-image-trigger:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-image-trigger-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-image-trigger-focus-ring-color, var(--global-border-focus))}.ui-image-trigger:hover .ui-image-indicator,.ui-image-trigger:focus-visible .ui-image-indicator{opacity:1}.ui-image-indicator{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border-radius:inherit;background:var(--ui-image-indicator-background, var(--primitives-black-50));color:var(--ui-image-indicator-color, var(--primitives-white-base));font-size:var(--ui-image-indicator-font-size, var(--size-typography-text-lg));line-height:1;opacity:0;transition:opacity var(--ui-control-transition-duration, var(--transition-default)) var(--ui-control-transition-easing, var(--transition-easeinout))}@media(prefers-reduced-motion:reduce){.ui-image-indicator{transition-duration:.01ms}}:root[data-motion=off] .ui-image-indicator{transition-duration:.01ms}\n"] }]
615
+ }], ctorParameters: () => [], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], src: [{ type: i0.Input, args: [{ isSignal: true, alias: "src", required: false }] }], fallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "fallback", required: false }] }], priority: [{ type: i0.Input, args: [{ isSignal: true, alias: "priority", required: false }] }], fill: [{ type: i0.Input, args: [{ isSignal: true, alias: "fill", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], widthUnit: [{ type: i0.Input, args: [{ isSignal: true, alias: "widthUnit", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], heightUnit: [{ type: i0.Input, args: [{ isSignal: true, alias: "heightUnit", required: false }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], secured: [{ type: i0.Input, args: [{ isSignal: true, alias: "secured", required: false }] }], withCredentials: [{ type: i0.Input, args: [{ isSignal: true, alias: "withCredentials", required: false }] }], loadingLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingLabel", required: false }] }], loadingAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingAriaLabel", required: false }] }], preview: [{ type: i0.Input, args: [{ isSignal: true, alias: "preview", required: false }] }], previewVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewVisible", required: false }] }, { type: i0.Output, args: ["previewVisibleChange"] }], previewAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewAriaLabel", required: false }] }], previewDialogAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewDialogAriaLabel", required: false }] }], zoomStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "zoomStep", required: false }] }], minZoom: [{ type: i0.Input, args: [{ isSignal: true, alias: "minZoom", required: false }] }], maxZoom: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxZoom", required: false }] }], downloadable: [{ type: i0.Input, args: [{ isSignal: true, alias: "downloadable", required: false }] }], downloadName: [{ type: i0.Input, args: [{ isSignal: true, alias: "downloadName", required: false }] }], loadFailed: [{ type: i0.Output, args: ["loadFailed"] }], previewIndicator: [{ type: i0.ContentChild, args: ['previewIndicator', { isSignal: true }] }] } });
295
616
 
296
617
  /*
297
618
  * Public API Surface of ui-kit/ui-image
619
+ *
620
+ * Includes `ui-image-preview`: it renders the source `ui-image` has already
621
+ * resolved, so the two live in one entry point (a separate one would be a cycle).
298
622
  */
299
623
 
300
624
  /**
301
625
  * Generated bundle index. Do not edit.
302
626
  */
303
627
 
304
- export { UI_IMAGE_ASSETS, UiImage, provideUiImageAssets };
628
+ export { UI_IMAGE_ASSETS, UiImage, UiImagePreview, provideUiImageAssets };
305
629
  //# sourceMappingURL=4sh-ui-kit-base-ui-image.mjs.map