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