@cngx/ui 0.1.0-rc.6 → 0.1.0-rc.8

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 (102) hide show
  1. package/README.md +112 -1
  2. package/a11y/README.md +87 -0
  3. package/accordion/README.md +4 -2
  4. package/breadcrumb/README.md +262 -0
  5. package/collection/README.md +6 -0
  6. package/command-palette/README.md +224 -0
  7. package/context-menu/README.md +98 -0
  8. package/data-grid-accordion/README.md +103 -2
  9. package/feedback/README.md +42 -0
  10. package/fesm2022/cngx-ui-a11y.mjs +452 -0
  11. package/fesm2022/cngx-ui-a11y.mjs.map +1 -0
  12. package/fesm2022/cngx-ui-accordion.mjs +116 -38
  13. package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
  14. package/fesm2022/cngx-ui-action-button.mjs +115 -50
  15. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  16. package/fesm2022/cngx-ui-breadcrumb.mjs +181 -96
  17. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
  18. package/fesm2022/cngx-ui-chart-panel.mjs +586 -0
  19. package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -0
  20. package/fesm2022/cngx-ui-collection.mjs +207 -66
  21. package/fesm2022/cngx-ui-collection.mjs.map +1 -1
  22. package/fesm2022/cngx-ui-command-palette.mjs +1281 -0
  23. package/fesm2022/cngx-ui-command-palette.mjs.map +1 -0
  24. package/fesm2022/cngx-ui-context-menu.mjs +857 -0
  25. package/fesm2022/cngx-ui-context-menu.mjs.map +1 -0
  26. package/fesm2022/cngx-ui-data-grid-accordion.mjs +498 -111
  27. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
  28. package/fesm2022/cngx-ui-empty-state.mjs +16 -6
  29. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  30. package/fesm2022/cngx-ui-feedback.mjs +1095 -521
  31. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  32. package/fesm2022/cngx-ui-layout.mjs +18 -9
  33. package/fesm2022/cngx-ui-layout.mjs.map +1 -1
  34. package/fesm2022/cngx-ui-mat-accordion.mjs +84 -16
  35. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
  36. package/fesm2022/cngx-ui-mat-paginator.mjs +67 -24
  37. package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
  38. package/fesm2022/cngx-ui-mat-stepper.mjs +72 -47
  39. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
  40. package/fesm2022/cngx-ui-mat-tabs.mjs +370 -203
  41. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  42. package/fesm2022/cngx-ui-overlay.mjs +69 -13
  43. package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
  44. package/fesm2022/cngx-ui-paginator.mjs +501 -182
  45. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  46. package/fesm2022/cngx-ui-sidenav.mjs +327 -106
  47. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  48. package/fesm2022/cngx-ui-skeleton.mjs +22 -21
  49. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  50. package/fesm2022/cngx-ui-speak.mjs +107 -8
  51. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  52. package/fesm2022/cngx-ui-stat-card.mjs +718 -0
  53. package/fesm2022/cngx-ui-stat-card.mjs.map +1 -0
  54. package/fesm2022/cngx-ui-stepper.mjs +217 -76
  55. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  56. package/fesm2022/cngx-ui-tabs.mjs +40 -19
  57. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  58. package/fesm2022/cngx-ui-timeline.mjs +548 -0
  59. package/fesm2022/cngx-ui-timeline.mjs.map +1 -0
  60. package/fesm2022/cngx-ui-toc.mjs +748 -0
  61. package/fesm2022/cngx-ui-toc.mjs.map +1 -0
  62. package/fesm2022/cngx-ui.mjs +16 -21
  63. package/fesm2022/cngx-ui.mjs.map +1 -1
  64. package/mat-accordion/README.md +1 -1
  65. package/mat-paginator/README.md +9 -2
  66. package/mat-tabs/styles/mat-tabs.css +29 -27
  67. package/overlay/README.md +9 -4
  68. package/package.json +32 -1
  69. package/paginator/README.md +8 -4
  70. package/sidenav/README.md +33 -11
  71. package/skeleton/README.md +2 -0
  72. package/speak/README.md +3 -2
  73. package/stepper/README.md +15 -3
  74. package/timeline/README.md +350 -0
  75. package/toc/README.md +186 -0
  76. package/types/cngx-ui-a11y.d.ts +394 -0
  77. package/types/cngx-ui-accordion.d.ts +100 -30
  78. package/types/cngx-ui-action-button.d.ts +47 -3
  79. package/types/cngx-ui-breadcrumb.d.ts +159 -58
  80. package/types/cngx-ui-chart-panel.d.ts +382 -0
  81. package/types/cngx-ui-collection.d.ts +159 -58
  82. package/types/cngx-ui-command-palette.d.ts +565 -0
  83. package/types/cngx-ui-context-menu.d.ts +559 -0
  84. package/types/cngx-ui-data-grid-accordion.d.ts +344 -51
  85. package/types/cngx-ui-empty-state.d.ts +9 -2
  86. package/types/cngx-ui-feedback.d.ts +664 -73
  87. package/types/cngx-ui-layout.d.ts +8 -3
  88. package/types/cngx-ui-mat-accordion.d.ts +32 -4
  89. package/types/cngx-ui-mat-paginator.d.ts +37 -8
  90. package/types/cngx-ui-mat-stepper.d.ts +23 -11
  91. package/types/cngx-ui-mat-tabs.d.ts +218 -23
  92. package/types/cngx-ui-overlay.d.ts +56 -10
  93. package/types/cngx-ui-paginator.d.ts +416 -132
  94. package/types/cngx-ui-sidenav.d.ts +248 -74
  95. package/types/cngx-ui-skeleton.d.ts +18 -7
  96. package/types/cngx-ui-speak.d.ts +118 -5
  97. package/types/cngx-ui-stat-card.d.ts +411 -0
  98. package/types/cngx-ui-stepper.d.ts +81 -29
  99. package/types/cngx-ui-tabs.d.ts +22 -6
  100. package/types/cngx-ui-timeline.d.ts +495 -0
  101. package/types/cngx-ui-toc.d.ts +581 -0
  102. package/types/cngx-ui.d.ts +8 -5
@@ -0,0 +1,565 @@
1
+ import * as _cngx_ui_command_palette from '@cngx/ui/command-palette';
2
+ import * as i0 from '@angular/core';
3
+ import { TemplateRef, InjectionToken, Signal, EnvironmentProviders, Provider } from '@angular/core';
4
+ import { CngxMessage } from '@cngx/core/i18n';
5
+ import { CngxRankedCommand, CngxCommandGroup } from '@cngx/common/command';
6
+ import { CngxAsyncState, KeyCombo } from '@cngx/core/utils';
7
+
8
+ /**
9
+ * The command-palette section of a {@link CngxLanguagePack}: the copy of
10
+ * `CngxCommandPalette` and its panel. It feeds the copy keys of
11
+ * `CNGX_COMMAND_PALETTE_CONFIG`; a key set through `withCommandPaletteLabels`,
12
+ * `withResultCountFormatter` or `withKeyboardLegend` still wins. Messages use
13
+ * `{name}` placeholders, numbers are formatted for the locale.
14
+ *
15
+ * @category ui/command-palette/i18n
16
+ * @since 0.1.0
17
+ * @relatedTo CNGX_COMMAND_PALETTE_CONFIG, withCommandPaletteLabels
18
+ */
19
+ interface CngxCommandPaletteLanguageSection {
20
+ /** Placeholder and accessible name of the search input. */
21
+ readonly searchPlaceholder: string;
22
+ /** Accessible name of the result listbox. */
23
+ readonly listboxLabel: string;
24
+ /** Shown when no command matches. */
25
+ readonly emptyLabel: string;
26
+ /** Shown while the commands load. */
27
+ readonly loadingLabel: string;
28
+ /** Shown when the commands failed to load. */
29
+ readonly errorLabel: string;
30
+ /** Label of the retry button after a failed load. */
31
+ readonly retryLabel: string;
32
+ /** Accessible name of the palette dialog. */
33
+ readonly paletteLabel: string;
34
+ /** `{count}`: the announced number of matching commands. */
35
+ readonly resultCount: CngxMessage;
36
+ /** Keys of the footer legend's navigate entry, as shown. Never spoken. */
37
+ readonly navigateKeys: string;
38
+ /** The navigate entry's keys in words, as screen readers hear them. */
39
+ readonly navigateKeysSpoken: string;
40
+ /** Label of the footer legend's navigate entry. */
41
+ readonly navigateLabel: string;
42
+ /** Keys of the footer legend's run entry. */
43
+ readonly runKeys: string;
44
+ /** Label of the footer legend's run entry. */
45
+ readonly runLabel: string;
46
+ /** Keys of the footer legend's close entry. */
47
+ readonly closeKeys: string;
48
+ /** Label of the footer legend's close entry. */
49
+ readonly closeLabel: string;
50
+ /** `{keys}`, `{label}`: what a screen reader hears for one footer legend entry. */
51
+ readonly legendEntry: CngxMessage;
52
+ }
53
+ /**
54
+ * The English command-palette section: the single source of the palette's
55
+ * English copy. The `CNGX_COMMAND_PALETTE_CONFIG` copy keys default to it.
56
+ *
57
+ * @category ui/command-palette/i18n
58
+ * @since 0.1.0
59
+ * @relatedTo CNGX_COMMAND_PALETTE_CONFIG
60
+ */
61
+ declare const CNGX_COMMAND_PALETTE_LANGUAGE_EN: CngxCommandPaletteLanguageSection;
62
+ declare module '@cngx/core/i18n' {
63
+ interface CngxLanguagePack {
64
+ readonly commandPalette: CngxCommandPaletteLanguageSection;
65
+ }
66
+ }
67
+
68
+ /**
69
+ * The command-palette copy of one section and locale, in the shape of the
70
+ * config copy keys.
71
+ *
72
+ * @internal
73
+ */
74
+ interface CngxCommandPaletteSiteCopy {
75
+ readonly searchPlaceholder: string;
76
+ readonly listboxLabel: string;
77
+ readonly emptyLabel: string;
78
+ readonly loadingLabel: string;
79
+ readonly errorLabel: string;
80
+ readonly retryLabel: string;
81
+ readonly paletteLabel: string;
82
+ readonly resultCount: (count: number) => string;
83
+ readonly footerLegend: readonly CngxCommandPaletteLegendEntry[];
84
+ readonly legendEntry: (keys: string, label: string) => string;
85
+ }
86
+
87
+ /**
88
+ * Context for the {@link CngxCommandRow} slot. Region granularity: the whole
89
+ * row is one slot, so the consumer lays out icon / label / shortcut-hint
90
+ * inside its own template. `data` is the command's opaque payload, narrowed at
91
+ * the use-site; `active` reflects the current `aria-activedescendant`.
92
+ *
93
+ * @category ui/command-palette
94
+ * @since 0.1.0
95
+ */
96
+ interface CngxCommandRowContext {
97
+ readonly $implicit: CngxRankedCommand;
98
+ readonly term: string;
99
+ readonly data: unknown;
100
+ readonly active: boolean;
101
+ }
102
+ /** Context for the {@link CngxCommandGroupHeader} slot. Recents is a group. */
103
+ interface CngxCommandGroupHeaderContext {
104
+ readonly $implicit: CngxCommandGroup;
105
+ }
106
+ /** Context for the {@link CngxCommandPaletteEmpty} slot. */
107
+ interface CngxCommandPaletteEmptyContext {
108
+ readonly term: string;
109
+ }
110
+ /** Context for the {@link CngxCommandPaletteLoading} slot. */
111
+ type CngxCommandPaletteLoadingContext = Record<string, never>;
112
+ /** Context for the {@link CngxCommandPaletteError} slot. */
113
+ interface CngxCommandPaletteErrorContext {
114
+ readonly error: unknown;
115
+ readonly retry: () => void;
116
+ }
117
+ /** Context for the {@link CngxCommandPaletteFooter} slot. */
118
+ type CngxCommandPaletteFooterContext = Record<string, never>;
119
+ /**
120
+ * Overrides the default command row. Project as content of
121
+ * `<cngx-command-palette>`:
122
+ *
123
+ * ```html
124
+ * <cngx-command-palette>
125
+ * <ng-template cngxCommandRow let-entry let-active="active">
126
+ * <my-icon [name]="entry.command.icon" />
127
+ * <span>{{ entry.command.label }}</span>
128
+ * </ng-template>
129
+ * </cngx-command-palette>
130
+ * ```
131
+ *
132
+ * @category ui/command-palette
133
+ * @since 0.1.0
134
+ */
135
+ declare class CngxCommandRow {
136
+ readonly templateRef: TemplateRef<CngxCommandRowContext>;
137
+ static ngTemplateContextGuard(_dir: CngxCommandRow, ctx: unknown): ctx is CngxCommandRowContext;
138
+ static ɵfac: i0.ɵɵFactoryDeclaration<CngxCommandRow, never>;
139
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CngxCommandRow, "[cngxCommandRow]", never, {}, {}, never, never, true, never>;
140
+ }
141
+ /**
142
+ * Overrides the default group header.
143
+ *
144
+ * @category ui/command-palette
145
+ * @since 0.1.0
146
+ */
147
+ declare class CngxCommandGroupHeader {
148
+ readonly templateRef: TemplateRef<CngxCommandGroupHeaderContext>;
149
+ static ngTemplateContextGuard(_dir: CngxCommandGroupHeader, ctx: unknown): ctx is CngxCommandGroupHeaderContext;
150
+ static ɵfac: i0.ɵɵFactoryDeclaration<CngxCommandGroupHeader, never>;
151
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CngxCommandGroupHeader, "[cngxCommandGroupHeader]", never, {}, {}, never, never, true, never>;
152
+ }
153
+ /**
154
+ * Overrides the default empty state.
155
+ *
156
+ * @category ui/command-palette
157
+ * @since 0.1.0
158
+ */
159
+ declare class CngxCommandPaletteEmpty {
160
+ readonly templateRef: TemplateRef<CngxCommandPaletteEmptyContext>;
161
+ static ngTemplateContextGuard(_dir: CngxCommandPaletteEmpty, ctx: unknown): ctx is CngxCommandPaletteEmptyContext;
162
+ static ɵfac: i0.ɵɵFactoryDeclaration<CngxCommandPaletteEmpty, never>;
163
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CngxCommandPaletteEmpty, "[cngxCommandPaletteEmpty]", never, {}, {}, never, never, true, never>;
164
+ }
165
+ /**
166
+ * Overrides the default first-load skeleton.
167
+ *
168
+ * @category ui/command-palette
169
+ * @since 0.1.0
170
+ */
171
+ declare class CngxCommandPaletteLoading {
172
+ readonly templateRef: TemplateRef<CngxCommandPaletteLoadingContext>;
173
+ static ngTemplateContextGuard(_dir: CngxCommandPaletteLoading, ctx: unknown): ctx is CngxCommandPaletteLoadingContext;
174
+ static ɵfac: i0.ɵɵFactoryDeclaration<CngxCommandPaletteLoading, never>;
175
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CngxCommandPaletteLoading, "[cngxCommandPaletteLoading]", never, {}, {}, never, never, true, never>;
176
+ }
177
+ /**
178
+ * Overrides the default error state. Wire `retry` to your reload path.
179
+ *
180
+ * @category ui/command-palette
181
+ * @since 0.1.0
182
+ */
183
+ declare class CngxCommandPaletteError {
184
+ readonly templateRef: TemplateRef<CngxCommandPaletteErrorContext>;
185
+ static ngTemplateContextGuard(_dir: CngxCommandPaletteError, ctx: unknown): ctx is CngxCommandPaletteErrorContext;
186
+ static ɵfac: i0.ɵɵFactoryDeclaration<CngxCommandPaletteError, never>;
187
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CngxCommandPaletteError, "[cngxCommandPaletteError]", never, {}, {}, never, never, true, never>;
188
+ }
189
+ /**
190
+ * Overrides the default keyboard-legend footer.
191
+ *
192
+ * @category ui/command-palette
193
+ * @since 0.1.0
194
+ */
195
+ declare class CngxCommandPaletteFooter {
196
+ readonly templateRef: TemplateRef<CngxCommandPaletteFooterContext>;
197
+ static ngTemplateContextGuard(_dir: CngxCommandPaletteFooter, ctx: unknown): ctx is CngxCommandPaletteFooterContext;
198
+ static ɵfac: i0.ɵɵFactoryDeclaration<CngxCommandPaletteFooter, never>;
199
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CngxCommandPaletteFooter, "[cngxCommandPaletteFooter]", never, {}, {}, never, never, true, never>;
200
+ }
201
+
202
+ /**
203
+ * Global default template overrides, keyed by slot. Resolution order for any
204
+ * fragment is instance `*cngxCommand*` slot > this map > the built-in default.
205
+ *
206
+ * @category ui/command-palette
207
+ * @since 0.1.0
208
+ */
209
+ interface CngxCommandPaletteTemplates {
210
+ readonly row?: TemplateRef<CngxCommandRowContext>;
211
+ readonly groupHeader?: TemplateRef<CngxCommandGroupHeaderContext>;
212
+ readonly empty?: TemplateRef<CngxCommandPaletteEmptyContext>;
213
+ readonly loading?: TemplateRef<CngxCommandPaletteLoadingContext>;
214
+ readonly error?: TemplateRef<CngxCommandPaletteErrorContext>;
215
+ readonly footer?: TemplateRef<CngxCommandPaletteFooterContext>;
216
+ }
217
+ /**
218
+ * One keyboard-legend row in the palette footer: the key glyphs and what they
219
+ * do. `keys` is shown, never spoken; screen readers hear `spokenKeys` (the key
220
+ * names in words, e.g. `'Up and Down arrows'` for `'↑ ↓'`), else `keys`.
221
+ *
222
+ * @category ui/command-palette
223
+ * @since 0.1.0
224
+ */
225
+ interface CngxCommandPaletteLegendEntry {
226
+ readonly keys: string;
227
+ readonly label: string;
228
+ readonly spokenKeys?: string;
229
+ }
230
+ /**
231
+ * Configuration for the command palette. The copy keys hold overrides only:
232
+ * unset by default, a value or a `Signal` once a `with*` feature ran. Every
233
+ * copy key they leave out reads the `commandPalette` section of the language
234
+ * pack (English without one), so the palette follows a runtime language
235
+ * switch.
236
+ *
237
+ * @category ui/command-palette
238
+ * @since 0.1.0
239
+ */
240
+ interface CngxCommandPaletteConfig {
241
+ /**
242
+ * Combo string that opens the palette (parsed via `parseKeyCombo`, e.g.
243
+ * `'mod+k'`, `'mod+shift+p'`). A per-instance `[openShortcut]` wins over this.
244
+ */
245
+ readonly openShortcut: string;
246
+ /** Placeholder + accessible name for the search input. */
247
+ readonly searchPlaceholder?: string | Signal<string>;
248
+ /** Accessible label for the results listbox. */
249
+ readonly listboxLabel?: string | Signal<string>;
250
+ /** Empty-state copy (async source returned no results). */
251
+ readonly emptyLabel?: string | Signal<string>;
252
+ /** First-load skeleton copy. */
253
+ readonly loadingLabel?: string | Signal<string>;
254
+ /** Error-state copy. */
255
+ readonly errorLabel?: string | Signal<string>;
256
+ /** Retry-button copy in the error state. */
257
+ readonly retryLabel?: string | Signal<string>;
258
+ /** Accessible name of the palette dialog while its `[ariaLabel]` is unbound. */
259
+ readonly paletteLabel?: string | Signal<string>;
260
+ /** Builds the polite `aria-live` result-count message. */
261
+ readonly resultCount?: ((count: number) => string) | Signal<(count: number) => string>;
262
+ /** Keyboard-legend rows rendered in the footer. */
263
+ readonly footerLegend?: readonly CngxCommandPaletteLegendEntry[] | Signal<readonly CngxCommandPaletteLegendEntry[]>;
264
+ /** Global default slot templates (config = strings, slots = structure). */
265
+ readonly templates?: CngxCommandPaletteTemplates;
266
+ }
267
+ /**
268
+ * A partial-config override produced by a `with*` helper.
269
+ *
270
+ * There is one config surface today, so this is a plain mutator - no
271
+ * `_target` discriminator. If a second palette config surface ever lands and a
272
+ * `provideCngxCommandPalette` aggregator is introduced, add the discriminator
273
+ * then (the menu family's `_target` pattern), not preemptively.
274
+ *
275
+ * @category ui/command-palette
276
+ * @since 0.1.0
277
+ */
278
+ type CngxCommandPaletteConfigFeature = (config: CngxCommandPaletteConfig) => CngxCommandPaletteConfig;
279
+ /**
280
+ * DI token carrying the resolved {@link CngxCommandPaletteConfig}. Defaults to
281
+ * {@link DEFAULT_COMMAND_PALETTE_CONFIG} at root; override app-wide via
282
+ * {@link provideCommandPaletteConfig} or per-scope via
283
+ * {@link provideCommandPaletteConfigAt}.
284
+ *
285
+ * @category ui/command-palette
286
+ * @since 0.1.0
287
+ */
288
+ declare const CNGX_COMMAND_PALETTE_CONFIG: InjectionToken<CngxCommandPaletteConfig>;
289
+ /**
290
+ * Provide a palette configuration at app root.
291
+ *
292
+ * ```ts
293
+ * provideCommandPaletteConfig(
294
+ * withCommandPaletteLabels({ emptyLabel: 'Keine Treffer.' }),
295
+ * withKeyboardLegend([{ keys: 'enter', label: 'Ausführen' }]),
296
+ * )
297
+ * ```
298
+ *
299
+ * @category ui/command-palette
300
+ * @since 0.1.0
301
+ */
302
+ declare function provideCommandPaletteConfig(...features: CngxCommandPaletteConfigFeature[]): EnvironmentProviders;
303
+ /**
304
+ * Component-scoped palette configuration override. Features merge on top of the
305
+ * enclosing scope (root or a parent `viewProviders`).
306
+ *
307
+ * @category ui/command-palette
308
+ * @since 0.1.0
309
+ */
310
+ declare function provideCommandPaletteConfigAt(...features: CngxCommandPaletteConfigFeature[]): Provider[];
311
+ /**
312
+ * Resolves the {@link CngxCommandPaletteConfig} from the current injection
313
+ * scope. Must run in an injection context.
314
+ *
315
+ * @category ui/command-palette
316
+ * @since 0.1.0
317
+ */
318
+ declare function injectCommandPaletteConfig(): CngxCommandPaletteConfig;
319
+ /**
320
+ * @internal - the config with every copy key unwrapped to a plain value. Still
321
+ * a {@link CngxCommandPaletteConfig}, so a reader keeps one config shape.
322
+ */
323
+ type CngxCommandPaletteResolvedConfig = CngxCommandPaletteConfig & CngxCommandPaletteSiteCopy;
324
+ /**
325
+ * The text-label keys {@link withCommandPaletteLabels} overrides.
326
+ *
327
+ * @category ui/command-palette
328
+ * @since 0.1.0
329
+ */
330
+ type CngxCommandPaletteLabelKey = 'searchPlaceholder' | 'listboxLabel' | 'emptyLabel' | 'loadingLabel' | 'errorLabel' | 'retryLabel' | 'paletteLabel';
331
+ /**
332
+ * Override any subset of the palette's text labels. Unset labels keep the
333
+ * inherited value. Pass a `Signal` of the overrides to switch the language at
334
+ * runtime; a key the Signal sets wins over the inherited value, an unset key
335
+ * follows it.
336
+ *
337
+ * @category ui/command-palette
338
+ * @since 0.1.0
339
+ */
340
+ declare function withCommandPaletteLabels(labels: Partial<Pick<CngxCommandPaletteConfig, CngxCommandPaletteLabelKey>> | Signal<Partial<Record<CngxCommandPaletteLabelKey, string>>>): CngxCommandPaletteConfigFeature;
341
+ /**
342
+ * Set the combo that opens the palette (parsed via `parseKeyCombo`, e.g.
343
+ * `'mod+k'`, `'mod+shift+p'`). Applies app-wide via `provideCommandPaletteConfig`
344
+ * or per-scope via `provideCommandPaletteConfigAt`. A per-instance
345
+ * `[openShortcut]` input still wins over this.
346
+ *
347
+ * @category ui/command-palette
348
+ * @since 0.1.0
349
+ */
350
+ declare function withPaletteShortcut(combo: string): CngxCommandPaletteConfigFeature;
351
+ /**
352
+ * Replace the footer keyboard legend. Pass a `Signal` to switch the language at
353
+ * runtime.
354
+ *
355
+ * @category ui/command-palette
356
+ * @since 0.1.0
357
+ */
358
+ declare function withKeyboardLegend(entries: readonly CngxCommandPaletteLegendEntry[] | Signal<readonly CngxCommandPaletteLegendEntry[]>): CngxCommandPaletteConfigFeature;
359
+ /**
360
+ * Replace the `aria-live` result-count formatter (e.g. for pluralisation in
361
+ * another locale). Pass a `Signal` of the formatter to switch the language at
362
+ * runtime; the live count speaks the new formatter on its next change.
363
+ *
364
+ * @category ui/command-palette
365
+ * @since 0.1.0
366
+ */
367
+ declare function withResultCountFormatter(formatter: ((count: number) => string) | Signal<(count: number) => string>): CngxCommandPaletteConfigFeature;
368
+ /**
369
+ * Register global default slot templates. Merged over any already set; a
370
+ * per-instance `*cngxCommand*` slot still wins over these.
371
+ *
372
+ * @category ui/command-palette
373
+ * @since 0.1.0
374
+ */
375
+ declare function withCommandPaletteTemplates(templates: CngxCommandPaletteTemplates): CngxCommandPaletteConfigFeature;
376
+
377
+ /**
378
+ * Contract the palette surface exposes to its panel body. One token, single
379
+ * surface today; the container-swap second token is the documented eject seam
380
+ * if a second surface ever lands (tracked debt), not built for one consumer.
381
+ *
382
+ * Focus restore is intentionally NOT on this contract - the palette renders a
383
+ * native modal `<dialog cngxDialog>`, so `showModal()` traps focus and
384
+ * `CngxDialog` stores the trigger at open and returns focus after the close
385
+ * transition settles. The panel only needs to know it is open and to ask the
386
+ * surface to dismiss when a command runs.
387
+ *
388
+ * @category ui/command-palette
389
+ * @since 0.1.0
390
+ */
391
+ interface CngxCommandPaletteHost {
392
+ /**
393
+ * Whether the palette surface is currently open. Two documented consumers:
394
+ * the panel resets its term and highlight when this flips to `false` (state
395
+ * must not leak into the next open), and a composing consumer derives open
396
+ * state from it instead of tracking its own flag -
397
+ * `CngxCommandPaletteTrigger` binds its `aria-expanded` to the palette's
398
+ * implementation of this member.
399
+ */
400
+ readonly isOpen: Signal<boolean>;
401
+ /** Dismiss the surface (e.g. after a command runs). */
402
+ dismiss(): void;
403
+ }
404
+ /**
405
+ * DI token the panel injects (optional) to reach its hosting palette surface.
406
+ *
407
+ * @category ui/command-palette
408
+ * @since 0.1.0
409
+ */
410
+ declare const CNGX_COMMAND_PALETTE_HOST: InjectionToken<CngxCommandPaletteHost>;
411
+
412
+ /**
413
+ * The opinionated Cmd/Ctrl+K command palette preset. Renders the panel body +
414
+ * async-state shell inside a native modal `<dialog cngxDialog>`, so focus
415
+ * trapping, trigger storage at open, and focus restore after the close
416
+ * transition are handled by `CngxDialog` and the platform - no hand-rolled
417
+ * focus machinery. The palette provides `CNGX_COMMAND_PALETTE_HOST` so the
418
+ * panel can dismiss it when a command runs.
419
+ *
420
+ * Type-to-filter runs over the merged command registry (`injectCommands`) plus
421
+ * the consumer's async `[results]`; the palette commits no form value - it
422
+ * fires `command.run()`, the locked demarcation from `CngxCombobox`. The global
423
+ * Cmd/Ctrl+K open combo is wired by the keybinding factory, not here.
424
+ *
425
+ * ```html
426
+ * <cngx-command-palette #palette [results]="results()" />
427
+ * <button [cngxCommandPaletteTrigger]="palette">Search commands</button>
428
+ * ```
429
+ *
430
+ * @category ui/command-palette
431
+ * @docsKind primary
432
+ * @wcag AA
433
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/command-palette/palette/command-palette.component.ts
434
+ * @selector cngx-command-palette
435
+ * @since 0.1.0
436
+ * @relatedTo CngxCommandPaletteTrigger, provideCommands, CngxDialog
437
+ */
438
+ declare class CngxCommandPalette implements CngxCommandPaletteHost {
439
+ /** Consumer-derived async result source. */
440
+ readonly results: i0.InputSignal<CngxAsyncState<CngxCommandGroup[]> | undefined>;
441
+ /** Two-way scope; feeds the matcher's scope filter and the panel chip. */
442
+ readonly scope: i0.ModelSignal<string | undefined>;
443
+ /** Debounce for the search input. */
444
+ readonly debounceMs: i0.InputSignal<number>;
445
+ private readonly config;
446
+ protected readonly copy: Signal<CngxCommandPaletteResolvedConfig>;
447
+ /**
448
+ * Accessible name for the dialog. Unbound, `paletteLabel` from
449
+ * `CNGX_COMMAND_PALETTE_CONFIG` (`withCommandPaletteLabels`) applies.
450
+ */
451
+ readonly ariaLabel: i0.InputSignal<string | undefined>;
452
+ /** @internal */
453
+ protected readonly resolvedAriaLabel: Signal<string>;
454
+ /**
455
+ * Per-instance open combo (parsed via `parseKeyCombo`, e.g. `'mod+shift+p'`).
456
+ * Wins over `CNGX_COMMAND_PALETTE_CONFIG.openShortcut` (`withPaletteShortcut`),
457
+ * which wins over the `'mod+k'` default. Changing it live re-installs the
458
+ * listener. For a full listener swap, override `CNGX_PALETTE_KEYBINDING_FACTORY`.
459
+ */
460
+ readonly openShortcut: i0.InputSignal<string | undefined>;
461
+ /** Fired when the user asks to retry a failed result load. */
462
+ readonly retry: i0.OutputEmitterRef<void>;
463
+ private readonly rowSlot;
464
+ private readonly groupHeaderSlot;
465
+ private readonly emptySlot;
466
+ private readonly loadingSlot;
467
+ private readonly errorSlot;
468
+ private readonly footerSlot;
469
+ protected readonly rowTpl: Signal<i0.TemplateRef<_cngx_ui_command_palette.CngxCommandRowContext> | null>;
470
+ protected readonly groupHeaderTpl: Signal<i0.TemplateRef<_cngx_ui_command_palette.CngxCommandGroupHeaderContext> | null>;
471
+ protected readonly emptyTpl: Signal<i0.TemplateRef<_cngx_ui_command_palette.CngxCommandPaletteEmptyContext> | null>;
472
+ protected readonly loadingTpl: Signal<i0.TemplateRef<_cngx_ui_command_palette.CngxCommandPaletteLoadingContext> | null>;
473
+ protected readonly errorTpl: Signal<i0.TemplateRef<_cngx_ui_command_palette.CngxCommandPaletteErrorContext> | null>;
474
+ protected readonly footerTpl: Signal<i0.TemplateRef<_cngx_ui_command_palette.CngxCommandPaletteFooterContext> | null>;
475
+ private readonly dialog;
476
+ /** Whether the palette is open. Part of the {@link CngxCommandPaletteHost} contract. */
477
+ readonly isOpen: Signal<boolean>;
478
+ /** Resolved open combo: instance input > config > `'mod+k'` default. */
479
+ private readonly resolvedShortcut;
480
+ constructor();
481
+ /** Open the palette. */
482
+ open(): void;
483
+ /** Dismiss the palette. Focus returns to the trigger via `CngxDialog`. */
484
+ dismiss(): void;
485
+ static ɵfac: i0.ɵɵFactoryDeclaration<CngxCommandPalette, never>;
486
+ static ɵcmp: i0.ɵɵComponentDeclaration<CngxCommandPalette, "cngx-command-palette", never, { "results": { "alias": "results"; "required": false; "isSignal": true; }; "scope": { "alias": "scope"; "required": false; "isSignal": true; }; "debounceMs": { "alias": "debounceMs"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "openShortcut": { "alias": "openShortcut"; "required": false; "isSignal": true; }; }, { "scope": "scopeChange"; "retry": "retry"; }, ["rowSlot", "groupHeaderSlot", "emptySlot", "loadingSlot", "errorSlot", "footerSlot"], never, true, never>;
487
+ }
488
+
489
+ /**
490
+ * Optional explicit trigger for a {@link CngxCommandPalette}. Opens the palette
491
+ * on click and advertises the popup relationship to assistive tech:
492
+ * `aria-haspopup="dialog"` plus `aria-expanded` derived from the palette's
493
+ * `isOpen()` host seam, so the trigger communicates the open state without any
494
+ * synced local flag. Pass the palette by template reference - orthogonal
495
+ * composition, no ancestor injection.
496
+ *
497
+ * ```html
498
+ * <button [cngxCommandPaletteTrigger]="palette">
499
+ * Search <kbd>Cmd K</kbd>
500
+ * </button>
501
+ * <cngx-command-palette #palette />
502
+ * ```
503
+ *
504
+ * @category ui/command-palette
505
+ * @wcag AA
506
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/command-palette/palette/command-palette-trigger.directive.ts
507
+ * @since 0.1.0
508
+ * @relatedTo CngxCommandPalette
509
+ */
510
+ declare class CngxCommandPaletteTrigger {
511
+ /** The palette this trigger opens. */
512
+ readonly palette: i0.InputSignal<CngxCommandPalette>;
513
+ protected open(): void;
514
+ static ɵfac: i0.ɵɵFactoryDeclaration<CngxCommandPaletteTrigger, never>;
515
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CngxCommandPaletteTrigger, "[cngxCommandPaletteTrigger]", ["cngxCommandPaletteTrigger"], { "palette": { "alias": "cngxCommandPaletteTrigger"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
516
+ }
517
+
518
+ /**
519
+ * Handle returned by a palette keybinding: a teardown that removes the document
520
+ * listener. The palette recreates the keybinding whenever the resolved combo
521
+ * changes and tears the previous one down, so nothing leaks document-wide.
522
+ *
523
+ * @category ui/command-palette
524
+ * @since 0.1.0
525
+ */
526
+ interface CngxPaletteKeybinding {
527
+ /** Removes the installed document keydown listener. */
528
+ teardown(): void;
529
+ }
530
+ /**
531
+ * Factory producing a {@link CngxPaletteKeybinding} for a combo. It installs a
532
+ * global listener that invokes `onOpen` whenever the combo is pressed. Captured
533
+ * as a type alias so an override matches the exact signature - a consumer can
534
+ * swap in an enterprise key-capture policy without touching the palette.
535
+ *
536
+ * @category ui/command-palette
537
+ * @since 0.1.0
538
+ */
539
+ type CngxPaletteKeybindingFactory = (combo: KeyCombo, onOpen: () => void) => CngxPaletteKeybinding;
540
+ /**
541
+ * Default palette keybinding: installs a document keydown listener that calls
542
+ * `onOpen` whenever the combo is pressed (matched via `matchesKeyCombo`).
543
+ * Side-effectful by design - it owns the global listener - so its `teardown`
544
+ * must be called on destroy.
545
+ *
546
+ * `isMac` defaults to platform detection; pass it explicitly for deterministic
547
+ * tests.
548
+ *
549
+ * @category ui/command-palette
550
+ * @since 0.1.0
551
+ */
552
+ declare function createPaletteKeybinding(combo: KeyCombo, onOpen: () => void, isMac?: boolean): CngxPaletteKeybinding;
553
+ /**
554
+ * Swappable open-trigger seam. Defaults to {@link createPaletteKeybinding}.
555
+ * Override it to install an enterprise key-capture policy without touching the
556
+ * palette. To only change the *combo*, prefer `withPaletteShortcut(...)` or the
557
+ * `[openShortcut]` input - this token is for replacing the whole listener.
558
+ *
559
+ * @category ui/command-palette
560
+ * @since 0.1.0
561
+ */
562
+ declare const CNGX_PALETTE_KEYBINDING_FACTORY: InjectionToken<CngxPaletteKeybindingFactory>;
563
+
564
+ export { CNGX_COMMAND_PALETTE_CONFIG, CNGX_COMMAND_PALETTE_HOST, CNGX_COMMAND_PALETTE_LANGUAGE_EN, CNGX_PALETTE_KEYBINDING_FACTORY, CngxCommandGroupHeader, CngxCommandPalette, CngxCommandPaletteEmpty, CngxCommandPaletteError, CngxCommandPaletteFooter, CngxCommandPaletteLoading, CngxCommandPaletteTrigger, CngxCommandRow, createPaletteKeybinding, injectCommandPaletteConfig, provideCommandPaletteConfig, provideCommandPaletteConfigAt, withCommandPaletteLabels, withCommandPaletteTemplates, withKeyboardLegend, withPaletteShortcut, withResultCountFormatter };
565
+ export type { CngxCommandGroupHeaderContext, CngxCommandPaletteConfig, CngxCommandPaletteConfigFeature, CngxCommandPaletteEmptyContext, CngxCommandPaletteErrorContext, CngxCommandPaletteFooterContext, CngxCommandPaletteHost, CngxCommandPaletteLabelKey, CngxCommandPaletteLanguageSection, CngxCommandPaletteLegendEntry, CngxCommandPaletteLoadingContext, CngxCommandPaletteTemplates, CngxCommandRowContext, CngxPaletteKeybinding, CngxPaletteKeybindingFactory };