@4sh/ui-kit 0.6.1 → 0.7.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 (127) hide show
  1. package/README.fr.md +46 -22
  2. package/README.md +45 -23
  3. package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs.map +1 -1
  4. package/fesm2022/4sh-ui-kit-actions-ui-button.mjs +2 -2
  5. package/fesm2022/4sh-ui-kit-actions-ui-button.mjs.map +1 -1
  6. package/fesm2022/4sh-ui-kit-actions-ui-link.mjs.map +1 -1
  7. package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs +439 -0
  8. package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs.map +1 -0
  9. package/fesm2022/4sh-ui-kit-base-ui-icon.mjs.map +1 -1
  10. package/fesm2022/4sh-ui-kit-base-ui-image.mjs +111 -10
  11. package/fesm2022/4sh-ui-kit-base-ui-image.mjs.map +1 -1
  12. package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs +10 -4
  13. package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs.map +1 -1
  14. package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs.map +1 -1
  15. package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs +457 -75
  16. package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs.map +1 -1
  17. package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs +1107 -0
  18. package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs.map +1 -0
  19. package/fesm2022/4sh-ui-kit-forms-ui-field.mjs +30 -3
  20. package/fesm2022/4sh-ui-kit-forms-ui-field.mjs.map +1 -1
  21. package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs.map +1 -1
  22. package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs.map +1 -1
  23. package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs +8 -2
  24. package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs.map +1 -1
  25. package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs +15 -2
  26. package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs.map +1 -1
  27. package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs.map +1 -1
  28. package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs +8 -4
  29. package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs.map +1 -1
  30. package/fesm2022/4sh-ui-kit-forms-ui-input.mjs +40 -4
  31. package/fesm2022/4sh-ui-kit-forms-ui-input.mjs.map +1 -1
  32. package/fesm2022/4sh-ui-kit-forms-ui-label.mjs +2 -2
  33. package/fesm2022/4sh-ui-kit-forms-ui-label.mjs.map +1 -1
  34. package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs.map +1 -1
  35. package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs.map +1 -1
  36. package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs.map +1 -1
  37. package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs.map +1 -1
  38. package/fesm2022/4sh-ui-kit-forms-ui-select.mjs +5 -2
  39. package/fesm2022/4sh-ui-kit-forms-ui-select.mjs.map +1 -1
  40. package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs.map +1 -1
  41. package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs +317 -0
  42. package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs.map +1 -0
  43. package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs +8 -2
  44. package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs.map +1 -1
  45. package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs +372 -0
  46. package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs.map +1 -0
  47. package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs.map +1 -1
  48. package/fesm2022/4sh-ui-kit-forms.mjs +44 -14
  49. package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -1
  50. package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs.map +1 -1
  51. package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs.map +1 -1
  52. package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs.map +1 -1
  53. package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs.map +1 -1
  54. package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs +2 -2
  55. package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs.map +1 -1
  56. package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs +2 -2
  57. package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs.map +1 -1
  58. package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs.map +1 -1
  59. package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs.map +1 -1
  60. package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs.map +1 -1
  61. package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs.map +1 -1
  62. package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs.map +1 -1
  63. package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs.map +1 -1
  64. package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs.map +1 -1
  65. package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs +2 -2
  66. package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs.map +1 -1
  67. package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs.map +1 -1
  68. package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs +2 -2
  69. package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs.map +1 -1
  70. package/fesm2022/4sh-ui-kit-layout-ui-card.mjs.map +1 -1
  71. package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs.map +1 -1
  72. package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs +45 -4
  73. package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs.map +1 -1
  74. package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs.map +1 -1
  75. package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -1
  76. package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs +2 -2
  77. package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs.map +1 -1
  78. package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs.map +1 -1
  79. package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs.map +1 -1
  80. package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs.map +1 -1
  81. package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs +22 -10
  82. package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs.map +1 -1
  83. package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs +15 -4
  84. package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs.map +1 -1
  85. package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -1
  86. package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs.map +1 -1
  87. package/fesm2022/4sh-ui-kit-table-ui-table.mjs +2 -2
  88. package/fesm2022/4sh-ui-kit-table-ui-table.mjs.map +1 -1
  89. package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -1
  90. package/fesm2022/4sh-ui-kit.mjs.map +1 -1
  91. package/mcp/data/text-search-docs.json +654 -74
  92. package/mcp/data/ui-config.json +5908 -3732
  93. package/mcp/index.js +682 -410
  94. package/mcp/package.json +1 -1
  95. package/package.json +17 -1
  96. package/schematics/index.cjs +1 -1
  97. package/styles/component-vars.scss +119 -2
  98. package/styles/generated/_tokens-breakpoint.scss +1 -1
  99. package/styles/generated/_tokens-metrics.scss +1 -1
  100. package/styles/generated/_tokens-primitives.scss +1 -1
  101. package/styles/generated/_tokens-responsive.scss +17 -17
  102. package/styles/generated/_tokens-semantics.scss +15 -15
  103. package/styles/generated/_tokens-styles.scss +1 -1
  104. package/styles/generated/_tokens-transitions.scss +1 -1
  105. package/styles/generated/_tokens-typography.scss +1 -1
  106. package/styles/generated/_tokens.scss +1 -1
  107. package/styles/utils/_helpers.scss +15 -0
  108. package/styles/utils/_mixins.scss +17 -1
  109. package/styles.css +1 -1
  110. package/types/4sh-ui-kit-actions-ui-speed-dial.d.ts +234 -0
  111. package/types/4sh-ui-kit-base-ui-image.d.ts +16 -3
  112. package/types/4sh-ui-kit-forms-ui-autocomplete.d.ts +4 -1
  113. package/types/4sh-ui-kit-forms-ui-datepicker.d.ts +186 -36
  114. package/types/4sh-ui-kit-forms-ui-editor.d.ts +481 -0
  115. package/types/4sh-ui-kit-forms-ui-field.d.ts +20 -2
  116. package/types/4sh-ui-kit-forms-ui-input-mask.d.ts +4 -0
  117. package/types/4sh-ui-kit-forms-ui-input-number.d.ts +9 -0
  118. package/types/4sh-ui-kit-forms-ui-input-tags.d.ts +4 -1
  119. package/types/4sh-ui-kit-forms-ui-input.d.ts +28 -2
  120. package/types/4sh-ui-kit-forms-ui-select.d.ts +2 -0
  121. package/types/4sh-ui-kit-forms-ui-swatch-picker.d.ts +126 -0
  122. package/types/4sh-ui-kit-forms-ui-textarea.d.ts +4 -0
  123. package/types/4sh-ui-kit-forms-ui-toggle-button.d.ts +220 -0
  124. package/types/4sh-ui-kit-forms.d.ts +34 -7
  125. package/types/4sh-ui-kit-layout-ui-modal.d.ts +7 -0
  126. package/types/4sh-ui-kit-navigation-ui-stepper.d.ts +8 -3
  127. package/types/4sh-ui-kit-navigation-ui-tabs.d.ts +14 -3
@@ -0,0 +1,481 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { BaseFormField } from '@4sh/ui-kit/forms';
3
+ import { UiSwatch } from '@4sh/ui-kit/forms/ui-swatch-picker';
4
+
5
+ /**
6
+ * Rich-text command layer — the only place that talks to the legacy editing API.
7
+ *
8
+ * `document.execCommand` is deprecated but remains the sole cross-browser way to
9
+ * apply inline formatting to a `contenteditable` selection without pulling in an
10
+ * editing engine (ProseMirror, Quill…). It is confined to this file so the kit
11
+ * keeps a single third-party-free dependency surface, and so a future Selection/
12
+ * Range implementation only has to replace these functions.
13
+ */
14
+ /**
15
+ * A formatting action the toolbar can trigger.
16
+ *
17
+ * `separator` is purely visual; `fontFamily` renders a dropdown rather than a
18
+ * button, since it picks among values instead of toggling one.
19
+ */
20
+ type EditorTool = 'bold' | 'italic' | 'underline' | 'bulletList' | 'orderedList' | 'codeBlock' | 'fontFamily' | 'fontSize' | 'indent' | 'outdent' | 'alignLeft' | 'alignCenter' | 'alignRight' | 'alignJustify' | 'textColor' | 'highlightColor' | 'link' | 'clearFormat' | 'separator';
21
+ /** Tools rendered as a dropdown: they pick among values instead of toggling one. */
22
+ type EditorSelectTool = 'fontFamily' | 'fontSize';
23
+ /** Tools rendered as an icon button. */
24
+ type EditorButtonTool = Exclude<EditorTool, 'separator' | EditorSelectTool>;
25
+ declare const EDITOR_SELECT_TOOLS: readonly EditorSelectTool[];
26
+ /** Commands whose active/inactive state the toolbar reflects via `aria-pressed`. */
27
+ type EditorToggleTool = Extract<EditorTool, 'bold' | 'italic' | 'underline' | 'bulletList' | 'orderedList' | 'codeBlock' | 'alignLeft' | 'alignCenter' | 'alignRight' | 'alignJustify'>;
28
+ /** Active formatting at the caret, recomputed after every interaction. */
29
+ type EditorState = Record<EditorToggleTool, boolean>;
30
+ /**
31
+ * Type families the editor can apply.
32
+ *
33
+ * A closed list on purpose: a free font picker would write an arbitrary family
34
+ * into the value and step outside the `--fontfamily-*` tokens. The system has no
35
+ * serif face, so the list is the three families the tokens actually carry.
36
+ */
37
+ type EditorFont = 'base' | 'title' | 'monospace';
38
+ /**
39
+ * Font key → class written into the value, token holding the family, and the
40
+ * fallback label used when the real name cannot be read (SSR, unset token).
41
+ *
42
+ * The dropdown shows the **actual** face name, resolved from the token at runtime
43
+ * (see {@link resolveFontLabel}) rather than hardcoded: a project that rebinds
44
+ * `--fontfamily-base` would otherwise see a menu naming a font it no longer uses.
45
+ */
46
+ declare const EDITOR_FONTS: readonly {
47
+ key: EditorFont;
48
+ className: string;
49
+ cssVar: string;
50
+ label: string;
51
+ }[];
52
+ /**
53
+ * First face named by a font token — what the family dropdown displays.
54
+ *
55
+ * `--fontfamily-base` holds a whole stack (`Inter, system-ui, …`); only the head
56
+ * of it is a name a person recognises.
57
+ */
58
+ declare function resolveFontLabel(cssVar: string, fallback: string): string;
59
+ /** Text sizes the editor can apply, as a step on the typography scale. */
60
+ type EditorSize = 'sm' | 'default' | 'lg' | 'xl';
61
+ /** Size key → class written into the value + French label for the dropdown. */
62
+ declare const EDITOR_SIZES: readonly {
63
+ key: EditorSize;
64
+ className: string;
65
+ label: string;
66
+ }[];
67
+ /**
68
+ * The tools enabled when the consumer does not provide a `tools` list.
69
+ *
70
+ * There is no block-level dropdown (no `blockFormat`, no headings): the editor
71
+ * only ever produces `<p>`. `fontFamily`/`fontSize` are both first-class,
72
+ * always-on tools rather than one gated behind the other.
73
+ *
74
+ * `clearFormat` is deliberately absent for now: `clearFormatMarkers()` does not
75
+ * reliably clear every marker class yet. It stays available for a project that
76
+ * explicitly adds it to `tools`, but shipping it by default would be shipping
77
+ * a broken button.
78
+ */
79
+ declare const DEFAULT_EDITOR_TOOLS: readonly EditorTool[];
80
+ /** Toolbar metadata per button tool: icon (FontAwesome) + French accessible name. */
81
+ declare const EDITOR_TOOL_META: Record<EditorButtonTool, {
82
+ icon: string;
83
+ label: string;
84
+ }>;
85
+ /** Every state off — the value used before the first render and on SSR. */
86
+ declare function emptyEditorState(): EditorState;
87
+ /** Applies a formatting command to the current selection. */
88
+ declare function applyCommand(tool: Exclude<EditorButtonTool, 'link' | 'codeBlock' | 'textColor' | 'highlightColor'>): void;
89
+ /** Toggles the block under the caret between `<pre>` and a plain paragraph. */
90
+ declare function toggleCodeBlock(): void;
91
+ /** The caret sits in a code block. */
92
+ declare function isInCodeBlock(): boolean;
93
+ /** Applies a type family to the selection (see {@link convertFontMarkers}). */
94
+ declare function applyFontFamily(): void;
95
+ /** Rewrites the `<font>` elements `fontName` just produced into `<span class>`. */
96
+ declare function convertFontMarkers(root: ParentNode, className: string): void;
97
+ /**
98
+ * Type family in force at the caret.
99
+ *
100
+ * Falls back to the family the text is actually rendered with when no class was
101
+ * applied: a heading carries `--fontfamily-title` from its own styling, and
102
+ * reporting the base family there would name a font the reader does not see.
103
+ * `null` only when the computed face matches none of the system families.
104
+ */
105
+ declare function readFontFamily(node: Node | null): EditorFont | null;
106
+ /** Applies a text size to the selection (see {@link convertSizeMarkers}). */
107
+ declare function applyFontSize(): void;
108
+ /** Rewrites the `<font>` elements `fontSize` just produced into `<span class>`. */
109
+ declare function convertSizeMarkers(root: ParentNode, className: string): void;
110
+ /** Text size active at the caret, or `null` when the text uses the default. */
111
+ declare function readFontSize(node: Node | null): EditorSize | null;
112
+ /**
113
+ * Color key → class written into the value, token holding the swatch, and
114
+ * label, derived from `ui-swatch-picker`'s default palette rather than
115
+ * hand-duplicated: the editor's color tools and the nuancier it opens must
116
+ * always offer the same token set.
117
+ */
118
+ declare const EDITOR_COLORS: readonly {
119
+ key: string;
120
+ className: string;
121
+ cssVar: string;
122
+ label: string;
123
+ }[];
124
+ /** Same key set as {@link EDITOR_COLORS}, classed separately for the highlight tool. */
125
+ declare const EDITOR_HIGHLIGHTS: readonly {
126
+ key: string;
127
+ className: string;
128
+ cssVar: string;
129
+ label: string;
130
+ }[];
131
+ /** Applies a text color to the selection (see {@link convertColorMarkers}). */
132
+ declare function applyTextColor(): void;
133
+ /** Rewrites the `<font>` elements `foreColor` just produced into `<span class>`. */
134
+ declare function convertColorMarkers(root: ParentNode, className: string): void;
135
+ /** Text color active at the caret, or `null` when the text uses the default. */
136
+ declare function readTextColor(node: Node | null): string | null;
137
+ /** Applies a highlight color to the selection (see {@link convertHighlightMarkers}). */
138
+ declare function applyHighlightColor(): void;
139
+ /** Rewrites the `<span style>` elements `hiliteColor` just produced into `<span class>`. */
140
+ declare function convertHighlightMarkers(root: ParentNode, className: string): void;
141
+ /** Highlight color active at the caret, or `null` when the text carries none. */
142
+ declare function readHighlightColor(node: Node | null): string | null;
143
+ /**
144
+ * Strips a color/highlight class from every element carrying it inside
145
+ * `range`, unwrapping the element when nothing else justifies it (a plain
146
+ * `<span>` holding only that class).
147
+ *
148
+ * Used by the pickers' "no color" swatch: `foreColor`/`hiliteColor` can only
149
+ * set a color, there is no native command to remove one, so this undoes what
150
+ * {@link convertColorMarkers}/{@link convertHighlightMarkers} previously wrote.
151
+ */
152
+ declare function clearMarkerClass(root: ParentNode, range: Range, className: string): void;
153
+ /**
154
+ * Strips every font/size/color/highlight class the editor writes, from
155
+ * whatever intersects `range`.
156
+ *
157
+ * `removeFormat` (the `clearFormat` tool's native command) only knows inline
158
+ * formatting the browser itself applies (bold, italic, underline…) — it never
159
+ * touches the `<span class="ui-editor-*">` wrappers `fontFamily`/`fontSize`/
160
+ * `textColor`/`highlightColor` write, so "Clear formatting" needs this on top
161
+ * of it to actually clear everything.
162
+ */
163
+ declare function clearFormatMarkers(root: ParentNode, range: Range): void;
164
+ /** Wraps the current selection in a link (`removeFormat` alone cannot unlink). */
165
+ declare function applyLink(href: string): void;
166
+ /** Removes the link around the caret. */
167
+ declare function removeLink(): void;
168
+ /** Reads the formatting active at the caret. */
169
+ declare function readEditorState(): EditorState;
170
+ /** Inserts already-sanitised markup at the caret, replacing the selection. */
171
+ declare function insertHtml(html: string): void;
172
+ /** Inserts plain text at the caret, replacing the selection. */
173
+ declare function insertText(text: string): void;
174
+ /**
175
+ * Strips everything outside the whitelist, keeping the text of dropped elements.
176
+ *
177
+ * Runs on paste, on top of Angular's `DomSanitizer`: the sanitizer removes what is
178
+ * dangerous, this removes what is merely foreign to the editor (Word spans, inline
179
+ * styles, headings, tables) so the value stays a small, predictable HTML subset.
180
+ */
181
+ declare function normalizeHtml(html: string): string;
182
+ /**
183
+ * Applies the same scrubbing to a live element, in place.
184
+ *
185
+ * `insertHTML` re-decorates what it inserts (`style="background-color: transparent"`
186
+ * and friends) *after* our normalisation, so the markup has to be cleaned once more
187
+ * once it is in the document. Attributes are removed node by node rather than by
188
+ * rewriting `innerHTML`, which would drop the caret.
189
+ */
190
+ declare function scrubInPlace(root: ParentNode): void;
191
+ /** Normalises a browser-produced empty document (`<br>`, empty block) to `''`. */
192
+ declare function isEmptyHtml(html: string): boolean;
193
+ /** Plain-text projection of the value — what the character counter measures. */
194
+ declare function htmlToText(html: string): string;
195
+
196
+ /** Where the toolbar sits relative to the editing area. */
197
+ type EditorToolbarPosition = 'top' | 'bottom';
198
+ /**
199
+ * ui-editor — headless rich-text field, built on the `ui-field` shell (label +
200
+ * box + helper) in **multiline** mode + a `contenteditable` area and its toolbar.
201
+ *
202
+ * Zero third-party engine: the formatting commands live in `ui-editor-commands`,
203
+ * the single place that touches the legacy editing API. The value is an HTML
204
+ * string, sanitised on the way in (`DomSanitizer`) and normalised to a small tag
205
+ * whitelist on paste.
206
+ *
207
+ * Standalone, `[(ngModel)]` or reactive forms (ControlValueAccessor via BaseFormField).
208
+ */
209
+ declare class UiEditor extends BaseFormField<string> {
210
+ /**
211
+ * Tools shown in the toolbar, in order (`separator` draws a divider).
212
+ *
213
+ * An empty or absent list falls back to the default set: a template binding an
214
+ * optional variable (`[tools]="tools"`) hands us `undefined`, which would
215
+ * otherwise leave the editor without any formatting at all.
216
+ */
217
+ tools: _angular_core.InputSignalWithTransform<readonly EditorTool[], readonly EditorTool[] | null | undefined>;
218
+ /** Hint shown while the editor is empty (no native placeholder on contenteditable). */
219
+ placeholder: _angular_core.InputSignal<string | undefined>;
220
+ /** Minimum height of the editing area, in lines of text. */
221
+ minRows: _angular_core.InputSignal<number>;
222
+ /** Maximum number of **text** characters (markup is not counted). */
223
+ maxlength: _angular_core.InputSignal<number | undefined>;
224
+ /** Shows a character counter under the field (`count` or `count / maxlength`). */
225
+ showCount: _angular_core.InputSignalWithTransform<boolean, unknown>;
226
+ /** Toolbar placement relative to the editing area. */
227
+ toolbarPosition: _angular_core.InputSignal<EditorToolbarPosition>;
228
+ /** Emitted on each edit with the new HTML value. */
229
+ valueChange: _angular_core.OutputEmitterRef<string>;
230
+ /** Emitted when the editing area receives focus. */
231
+ editorFocus: _angular_core.OutputEmitterRef<FocusEvent>;
232
+ /** Emitted when the editing area loses focus. */
233
+ editorBlur: _angular_core.OutputEmitterRef<FocusEvent>;
234
+ /** Emitted when the formatting under the caret changes. */
235
+ selectionChange: _angular_core.OutputEmitterRef<EditorState>;
236
+ /** @ignore */
237
+ private readonly sanitizer;
238
+ /** @ignore */
239
+ private readonly contentEl;
240
+ /** @ignore The rendered toolbar — holds the roving tabindex ring, in DOM order. */
241
+ private readonly toolbarEl;
242
+ /** @ignore Text color popup (see {@link onColorToolClick}). */
243
+ private readonly textColorPicker;
244
+ /** @ignore Highlight color popup (see {@link onColorToolClick}). */
245
+ private readonly highlightColorPicker;
246
+ /**
247
+ * @ignore Last HTML this component wrote out.
248
+ *
249
+ * The editing area owns its own DOM while the user types, so the value cannot be
250
+ * bound with `[innerHTML]`: re-rendering it on every keystroke would collapse the
251
+ * caret. Instead the DOM is only rewritten when the incoming value differs from
252
+ * what we last emitted — i.e. when a form writes to us.
253
+ */
254
+ private lastEmitted;
255
+ /** @ignore Formatting active at the caret. */
256
+ protected readonly state: _angular_core.WritableSignal<EditorState>;
257
+ /** @ignore Type family at the caret (`null` = the default family). */
258
+ protected readonly currentFont: _angular_core.WritableSignal<EditorFont | null>;
259
+ /** @ignore Text size at the caret (`null` = the default size). */
260
+ protected readonly currentSize: _angular_core.WritableSignal<EditorSize | null>;
261
+ /** @ignore Text color at the caret (`null` = the default color). */
262
+ protected readonly currentTextColor: _angular_core.WritableSignal<string | null>;
263
+ /** @ignore Highlight color at the caret (`null` = no highlight). */
264
+ protected readonly currentHighlightColor: _angular_core.WritableSignal<string | null>;
265
+ /** @ignore Index of the toolbar button reachable with Tab (roving tabindex). */
266
+ protected readonly activeTool: _angular_core.WritableSignal<number>;
267
+ /** @ignore Open state of the `textColor` popup (drives its trigger's `aria-expanded`). */
268
+ protected readonly textColorPickerOpen: _angular_core.WritableSignal<boolean>;
269
+ /** @ignore Open state of the `highlightColor` popup (drives its trigger's `aria-expanded`). */
270
+ protected readonly highlightColorPickerOpen: _angular_core.WritableSignal<boolean>;
271
+ /**
272
+ * @ignore Last selection seen inside the editing area.
273
+ *
274
+ * The buttons cancel their own mousedown and never take the focus, but opening
275
+ * the font dropdown does — and a `contenteditable` loses its selection with it.
276
+ * The range is therefore kept here and restored before the command runs.
277
+ */
278
+ private savedRange;
279
+ /** @ignore Sanitised value — never inject `modelValue` into the DOM raw. */
280
+ private readonly safeValue;
281
+ /** @ignore Plain-text length, what `maxlength` and the counter measure. */
282
+ protected readonly charCount: _angular_core.Signal<number>;
283
+ /** @ignore Keeps a floating label raised once focus leaves. */
284
+ protected readonly isFilled: _angular_core.Signal<boolean>;
285
+ /** @ignore Over the maxlength (only reachable programmatically). */
286
+ protected readonly overLimit: _angular_core.Signal<boolean>;
287
+ /** @ignore The placeholder only shows while there is nothing to read. */
288
+ protected readonly showPlaceholder: _angular_core.Signal<boolean>;
289
+ /** @ignore The area is editable (a read-only editor keeps its caret but not its edits). */
290
+ protected readonly isEditable: _angular_core.Signal<boolean>;
291
+ /** @ignore Resolved toolbar entries (icon + accessible name + toggle state). */
292
+ protected readonly toolbar: _angular_core.Signal<{
293
+ tool: EditorTool;
294
+ index: number;
295
+ isSeparator: boolean;
296
+ select: EditorSelectTool | null;
297
+ buttonTool: EditorButtonTool | null;
298
+ meta: {
299
+ icon: string;
300
+ label: string;
301
+ } | null;
302
+ }[]>;
303
+ /** @ignore Text sizes offered by the `fontSize` dropdown. */
304
+ protected readonly sizes: readonly {
305
+ key: EditorSize;
306
+ className: string;
307
+ label: string;
308
+ }[];
309
+ /**
310
+ * @ignore Type families, labelled with the face each token actually resolves to.
311
+ *
312
+ * Read once the view exists, since the value comes from the computed style: a
313
+ * hardcoded "Inter" would lie as soon as a project rebinds the token.
314
+ */
315
+ protected readonly fonts: _angular_core.WritableSignal<{
316
+ key: EditorFont;
317
+ className: string;
318
+ cssVar: string;
319
+ label: string;
320
+ }[]>;
321
+ /** @ignore `fontFamily` dropdown options ({@link UiSelect} `optionLabel`/`optionValue`). */
322
+ protected readonly fontFamilyOptions: _angular_core.Signal<{
323
+ value: EditorFont;
324
+ label: string;
325
+ }[]>;
326
+ /** @ignore `fontSize` dropdown options ({@link UiSelect} `optionLabel`/`optionValue`). */
327
+ protected readonly fontSizeOptions: _angular_core.Signal<{
328
+ value: EditorSize;
329
+ label: string;
330
+ }[]>;
331
+ /** @ignore Swatch entry backing the `textColor` button's color indicator. */
332
+ protected readonly currentTextColorSwatch: _angular_core.Signal<{
333
+ key: string;
334
+ className: string;
335
+ cssVar: string;
336
+ label: string;
337
+ } | undefined>;
338
+ /** @ignore Swatch entry backing the `highlightColor` button's color indicator. */
339
+ protected readonly currentHighlightColorSwatch: _angular_core.Signal<{
340
+ key: string;
341
+ className: string;
342
+ cssVar: string;
343
+ label: string;
344
+ } | undefined>;
345
+ /** @ignore The toolbar has at least one actionable entry. */
346
+ protected readonly hasToolbar: _angular_core.Signal<boolean>;
347
+ /**
348
+ * @ignore Index carrying the toolbar's single tab stop.
349
+ *
350
+ * Falls back to the first actionable tool, so a `tools` list opening on a
351
+ * separator still leaves the toolbar reachable with Tab.
352
+ */
353
+ protected readonly tabStop: _angular_core.Signal<number>;
354
+ /** @ignore id of the character counter (for `aria-describedby`). */
355
+ protected readonly countId: _angular_core.Signal<string>;
356
+ /** @ignore `aria-describedby` combines the message and the counter, whichever are shown. */
357
+ protected readonly describedByIds: _angular_core.Signal<string | null>;
358
+ constructor();
359
+ /** @ignore Auto-generated ids read as `ui-editor-*`. */
360
+ protected uidPrefix(): string;
361
+ /** Focuses the editing area. */
362
+ focus(options?: FocusOptions): void;
363
+ /** @ignore Input: single source of the value (view → form). */
364
+ protected onInput(): void;
365
+ /**
366
+ * @ignore Enforces `maxlength` on the text, not the markup.
367
+ *
368
+ * Deletions and formatting must stay available once the limit is reached, so only
369
+ * the insertion intents are cancelled.
370
+ */
371
+ protected onBeforeInput(event: InputEvent): void;
372
+ /** @ignore Paste is reduced to the editor's own tag whitelist. */
373
+ protected onPaste(event: ClipboardEvent): void;
374
+ /** @ignore The browser applies Ctrl/Cmd+B/I/U itself; we only mirror the state. */
375
+ protected onContentKeydown(event: KeyboardEvent): void;
376
+ /** @ignore */
377
+ protected onBlur(event: FocusEvent): void;
378
+ /** @ignore Recomputes the active formatting and notifies the consumer. */
379
+ protected refreshState(): void;
380
+ /** @ignore Keeps the caret position around for controls that steal the focus. */
381
+ private rememberSelection;
382
+ /** @ignore Puts the remembered caret back before running a command. */
383
+ private restoreSelection;
384
+ /** @ignore Runs a button tool against the selection the mousedown handler preserved. */
385
+ protected runTool(tool: EditorButtonTool, index: number, event?: MouseEvent): void;
386
+ /**
387
+ * @ignore `removeFormat` (the native command behind `clearFormat`) only
388
+ * strips inline formatting the browser itself applies — bold, italic,
389
+ * underline… — never the `<span class="ui-editor-*">` wrappers `fontFamily`/
390
+ * `fontSize`/`textColor`/`highlightColor` write, so those survived
391
+ * "Effacer le formatage" untouched. Run the native command, then unwrap
392
+ * those classes too, across whatever is currently selected.
393
+ */
394
+ private clearFormat;
395
+ /**
396
+ * @ignore Trigger click for `textColor`/`highlightColor`: opens the matching
397
+ * `ui-swatch-picker` instead of applying a command directly — same
398
+ * "picker takes the focus, the caret is restored before the real command
399
+ * runs" pattern as {@link onSelectMenuTrigger}, but these two are button
400
+ * tools (a one-shot action button, not a value dropdown), so they run
401
+ * through `runTool` rather than `onSelectChange`.
402
+ */
403
+ private onColorToolClick;
404
+ /**
405
+ * @ignore Applies the text color chosen in the `textColor` picker.
406
+ *
407
+ * The popup took the focus, so the caret is put back first. `foreColor`
408
+ * emits a legacy `<font>` element, immediately rewritten into a class.
409
+ */
410
+ protected onTextColorSelect(swatch: UiSwatch | null): void;
411
+ /**
412
+ * @ignore Applies the highlight color chosen in the `highlightColor` picker.
413
+ *
414
+ * The popup took the focus, so the caret is put back first. `hiliteColor`
415
+ * emits a `<span style="background-color:…">`, immediately rewritten into a
416
+ * class (see {@link convertHighlightMarkers}).
417
+ */
418
+ protected onHighlightColorSelect(swatch: UiSwatch | null): void;
419
+ /** @ignore Options for a `ui-select` dropdown ({@link UiSelect} `optionLabel`/`optionValue`). */
420
+ protected selectOptions(tool: EditorSelectTool): {
421
+ value: string;
422
+ label: string;
423
+ }[];
424
+ /**
425
+ * @ignore Current value of a `ui-select` dropdown, so it reflects the caret.
426
+ *
427
+ * Falls back to the value actually in force when no class was applied: text
428
+ * carrying no class really is rendered with `--fontfamily-base` at the
429
+ * default size, so naming it states a fact rather than a placeholder.
430
+ */
431
+ protected selectValue(tool: EditorSelectTool): string;
432
+ /** @ignore Accessible name of a dropdown — spelled out, it is never truncated. */
433
+ protected selectLabel(tool: EditorSelectTool): string;
434
+ /**
435
+ * @ignore Applies the value chosen in a `ui-select` dropdown.
436
+ *
437
+ * `ui-select` opens its own overlay and takes the focus, so the caret is put
438
+ * back first — same reasoning as the color pickers. `fontName`/`fontSize`
439
+ * each emit a legacy `<font>` element, immediately rewritten into a class.
440
+ */
441
+ protected onSelectValueChange(tool: EditorSelectTool, value: unknown, index: number): void;
442
+ /**
443
+ * @ignore v1 link flow: the native prompt.
444
+ *
445
+ * Deliberately minimal — a popover with a `ui-input` is the planned replacement,
446
+ * and it changes the component's overlay footprint, not this call site.
447
+ */
448
+ private promptForLink;
449
+ /** @ignore Keeps the caret in the editing area when a tool is clicked. */
450
+ protected onToolbarMousedown(event: MouseEvent): void;
451
+ /** @ignore Roving tabindex: the toolbar is one tab stop, arrows move within it. */
452
+ protected onToolbarKeydown(event: KeyboardEvent): void;
453
+ /**
454
+ * @ignore Moves the DOM focus onto the control now holding the tab stop.
455
+ *
456
+ * Queried from the live toolbar rather than from the `ui-button` children:
457
+ * DOM order is the visual order, and every tool (buttons and select-menu
458
+ * triggers alike) renders as a `<button>`.
459
+ */
460
+ private focusTool;
461
+ /**
462
+ * @ignore `var(--primitives-…)` for the `textColor`/`highlightColor`
463
+ * buttons' color indicator, or `null` for every other tool (no swatch
464
+ * active, or a tool the indicator does not apply to).
465
+ */
466
+ protected colorIndicatorVar(tool: EditorButtonTool | null): string | null;
467
+ /**
468
+ * @ignore Native attributes forwarded to a tool button.
469
+ *
470
+ * `aria-pressed` only on the toggles: `link` and `clearFormat` are one-shot
471
+ * actions, and a permanently unpressed toggle would misreport them.
472
+ * `textColor`/`highlightColor` forward `aria-haspopup`/`aria-expanded`
473
+ * instead — they open a `ui-swatch-picker` popup, not a toggle.
474
+ */
475
+ protected toolProps(tool: EditorTool): Record<string, string> | undefined;
476
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<UiEditor, never>;
477
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<UiEditor, "ui-editor", never, { "tools": { "alias": "tools"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "minRows": { "alias": "minRows"; "required": false; "isSignal": true; }; "maxlength": { "alias": "maxlength"; "required": false; "isSignal": true; }; "showCount": { "alias": "showCount"; "required": false; "isSignal": true; }; "toolbarPosition": { "alias": "toolbarPosition"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "editorFocus": "editorFocus"; "editorBlur": "editorBlur"; "selectionChange": "selectionChange"; }, never, never, true, never>;
478
+ }
479
+
480
+ export { DEFAULT_EDITOR_TOOLS, EDITOR_COLORS, EDITOR_FONTS, EDITOR_HIGHLIGHTS, EDITOR_SELECT_TOOLS, EDITOR_SIZES, EDITOR_TOOL_META, UiEditor, applyCommand, applyFontFamily, applyFontSize, applyHighlightColor, applyLink, applyTextColor, clearFormatMarkers, clearMarkerClass, convertColorMarkers, convertFontMarkers, convertHighlightMarkers, convertSizeMarkers, emptyEditorState, htmlToText, insertHtml, insertText, isEmptyHtml, isInCodeBlock, normalizeHtml, readEditorState, readFontFamily, readFontSize, readHighlightColor, readTextColor, removeLink, resolveFontLabel, scrubInPlace, toggleCodeBlock };
481
+ export type { EditorButtonTool, EditorFont, EditorSelectTool, EditorSize, EditorState, EditorToggleTool, EditorTool, EditorToolbarPosition };
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { FieldSize, FieldLevel } from '@4sh/ui-kit/forms';
2
+ import { FieldSize, FieldLevel, FieldFloatLabel } from '@4sh/ui-kit/forms';
3
3
 
4
4
  /**
5
5
  * ui-field — shared presentational shell for "box" fields.
@@ -13,6 +13,12 @@ import { FieldSize, FieldLevel } from '@4sh/ui-kit/forms';
13
13
  * Purely visual (no `ControlValueAccessor`): the concrete components
14
14
  * (`ui-input`, `ui-input-number`, `ui-input-mask`) own the value and provide the
15
15
  * computed `id`/`level`/`message` (via `BaseFormField`).
16
+ *
17
+ * `floatLabel` switches the label into the box, where it plays the placeholder
18
+ * role and rises on focus or once `filled` is set. The raised state is CSS-only
19
+ * for focus (`:focus-within`) and autofill; the "has a value" half cannot be
20
+ * expressed in CSS for every control (a `<button>` trigger has no `value`), so
21
+ * the concrete component reports it through `filled`.
16
22
  */
17
23
  declare class UiField {
18
24
  /** Label (rendered via `ui-label`). */
@@ -25,6 +31,10 @@ declare class UiField {
25
31
  size: _angular_core.InputSignal<FieldSize>;
26
32
  /** Effective level (drives the border + message color). */
27
33
  level: _angular_core.InputSignal<FieldLevel>;
34
+ /** Floating label placement (`over` | `in` | `on`). Unset = classic label above the box. */
35
+ floatLabel: _angular_core.InputSignal<FieldFloatLabel | undefined>;
36
+ /** The control holds a value: keeps the floating label raised once focus leaves. */
37
+ filled: _angular_core.InputSignalWithTransform<boolean, unknown>;
28
38
  /** Disabled state (visual). */
29
39
  disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
30
40
  /** Read-only state (visual). */
@@ -42,12 +52,20 @@ declare class UiField {
42
52
  messageId: _angular_core.InputSignal<string | undefined>;
43
53
  /** Renders the footer row even without a message (e.g. to host a `[uiFieldFooter]` counter). */
44
54
  hasFooter: _angular_core.InputSignalWithTransform<boolean, unknown>;
55
+ /**
56
+ * An affix is projected into `[uiFieldPrefix]` (left icon…). Only read in
57
+ * `floatLabel` mode, to indent the floating label past it: the prefix is
58
+ * projected content, so no scoped selector here can see it.
59
+ */
60
+ hasPrefix: _angular_core.InputSignalWithTransform<boolean, unknown>;
45
61
  /** @ignore */
46
62
  protected onBoxMouseDown(event: MouseEvent): void;
63
+ /** @ignore The label is rendered inside the box, as a floating label. */
64
+ protected readonly isFloating: _angular_core.Signal<boolean>;
47
65
  /** @ignore */
48
66
  protected readonly classes: _angular_core.Signal<string>;
49
67
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UiField, never>;
50
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<UiField, "ui-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "for": { "alias": "for"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "level": { "alias": "level"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "multiline": { "alias": "multiline"; "required": false; "isSignal": true; }; "autoHeight": { "alias": "autoHeight"; "required": false; "isSignal": true; }; "message": { "alias": "message"; "required": false; "isSignal": true; }; "messageId": { "alias": "messageId"; "required": false; "isSignal": true; }; "hasFooter": { "alias": "hasFooter"; "required": false; "isSignal": true; }; }, {}, never, ["[uiFieldPrefix]", "*", "[uiFieldSuffix]", "[uiFieldFooter]"], true, never>;
68
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<UiField, "ui-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "for": { "alias": "for"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "level": { "alias": "level"; "required": false; "isSignal": true; }; "floatLabel": { "alias": "floatLabel"; "required": false; "isSignal": true; }; "filled": { "alias": "filled"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "multiline": { "alias": "multiline"; "required": false; "isSignal": true; }; "autoHeight": { "alias": "autoHeight"; "required": false; "isSignal": true; }; "message": { "alias": "message"; "required": false; "isSignal": true; }; "messageId": { "alias": "messageId"; "required": false; "isSignal": true; }; "hasFooter": { "alias": "hasFooter"; "required": false; "isSignal": true; }; "hasPrefix": { "alias": "hasPrefix"; "required": false; "isSignal": true; }; }, {}, never, ["[uiFieldPrefix]", "*", "[uiFieldSuffix]", "[uiFieldFooter]"], true, never>;
51
69
  }
52
70
 
53
71
  export { UiField };
@@ -38,6 +38,10 @@ declare class UiInputMask extends BaseFormField<string> {
38
38
  private readonly inputEl;
39
39
  /** @ignore Masked displayed text. */
40
40
  protected readonly text: _angular_core.WritableSignal<string>;
41
+ /** @ignore Keeps a floating label raised once focus leaves. */
42
+ protected readonly isFilled: _angular_core.Signal<boolean>;
43
+ /** @ignore At rest the floating label already holds that spot. */
44
+ protected readonly effectivePlaceholder: _angular_core.Signal<string>;
41
45
  /** @ignore */
42
46
  protected readonly iconSize: _angular_core.Signal<UiIconSize>;
43
47
  /** @ignore Bounds declared by `ranges`, one entry per numeric segment (`null` = unbounded). */
@@ -52,6 +52,10 @@ declare class UiInputNumber extends BaseFormField<number | null> {
52
52
  private readonly inputEl;
53
53
  /** @ignore Raw displayed text (independent from the model while typing). */
54
54
  protected readonly text: _angular_core.WritableSignal<string>;
55
+ /** @ignore Keeps a floating label raised once focus leaves. */
56
+ protected readonly isFilled: _angular_core.Signal<boolean>;
57
+ /** @ignore At rest the floating label already holds that spot. */
58
+ protected readonly effectivePlaceholder: _angular_core.Signal<string>;
55
59
  /** @ignore Suffix unit, ignored when `currency` is set (the formatted value already carries it). */
56
60
  protected readonly displayUnit: _angular_core.Signal<string | null>;
57
61
  /** @ignore */
@@ -59,6 +63,11 @@ declare class UiInputNumber extends BaseFormField<number | null> {
59
63
  /** @ignore Bounds reached (disable the spinner buttons). */
60
64
  protected readonly atMax: _angular_core.Signal<boolean>;
61
65
  protected readonly atMin: _angular_core.Signal<boolean>;
66
+ /** @ignore `numberAttribute(undefined)` yields NaN, and `aria-valuemin="NaN"` is an invalid
67
+ * ARIA value — omit the attribute entirely rather than advertise a bound that does not exist. */
68
+ protected readonly ariaValueMin: _angular_core.Signal<number | null | undefined>;
69
+ /** @ignore Same as `ariaValueMin`, for the upper bound. */
70
+ protected readonly ariaValueMax: _angular_core.Signal<number | null | undefined>;
62
71
  /** @ignore Group/decimal separators of the current locale. */
63
72
  private readonly separators;
64
73
  writeValue(value: number | null): void;
@@ -240,8 +240,11 @@ declare class UiInputTags<T = unknown> extends BaseFormField<T[]> {
240
240
  protected readonly isFull: _angular_core.Signal<boolean>;
241
241
  /** @ignore The input accepts typing. */
242
242
  protected readonly canType: _angular_core.Signal<boolean>;
243
- /** @ignore The placeholder is shown only while there is no tag. */
243
+ /** @ignore The placeholder is shown only while there is no tag, and never
244
+ * under a floating label at rest: it already holds that spot. */
244
245
  protected readonly effectivePlaceholder: _angular_core.Signal<string>;
246
+ /** @ignore Keeps a floating label raised once focus leaves. */
247
+ protected readonly isFilled: _angular_core.Signal<boolean>;
245
248
  /** @ignore Flat entries (no groups). */
246
249
  private readonly flatEntries;
247
250
  /** @ignore Groups of entries. */