@scion/components 22.2.0 → 22.4.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 (42) hide show
  1. package/_index.scss +94 -5
  2. package/common/package.json +4 -0
  3. package/design/_theming.scss +25 -10
  4. package/design/components/_scion-component-dark-tokens.scss +153 -0
  5. package/design/components/_scion-component-light-tokens.scss +153 -0
  6. package/design/icons/_scion-icon-font.scss +50 -0
  7. package/design/themes/_scion-dark-theme.scss +2 -7
  8. package/design/themes/_scion-light-theme.scss +3 -8
  9. package/fesm2022/scion-components-common.mjs +251 -0
  10. package/fesm2022/scion-components-common.mjs.map +1 -0
  11. package/fesm2022/scion-components-dimension.mjs +7 -6
  12. package/fesm2022/scion-components-dimension.mjs.map +1 -1
  13. package/fesm2022/scion-components-icon.mjs +327 -0
  14. package/fesm2022/scion-components-icon.mjs.map +1 -0
  15. package/fesm2022/scion-components-menu.mjs +3277 -0
  16. package/fesm2022/scion-components-menu.mjs.map +1 -0
  17. package/fesm2022/scion-components-sashbox.mjs +21 -21
  18. package/fesm2022/scion-components-sashbox.mjs.map +1 -1
  19. package/fesm2022/scion-components-splitter.mjs +16 -13
  20. package/fesm2022/scion-components-splitter.mjs.map +1 -1
  21. package/fesm2022/scion-components-table.mjs +2337 -0
  22. package/fesm2022/scion-components-table.mjs.map +1 -0
  23. package/fesm2022/scion-components-text.mjs +322 -0
  24. package/fesm2022/scion-components-text.mjs.map +1 -0
  25. package/fesm2022/scion-components-throbber.mjs +15 -15
  26. package/fesm2022/scion-components-throbber.mjs.map +1 -1
  27. package/fesm2022/scion-components-viewport.mjs +41 -72
  28. package/fesm2022/scion-components-viewport.mjs.map +1 -1
  29. package/icon/package.json +4 -0
  30. package/menu/package.json +4 -0
  31. package/package.json +23 -3
  32. package/table/package.json +4 -0
  33. package/text/package.json +4 -0
  34. package/types/scion-components-common.d.ts +185 -0
  35. package/types/scion-components-icon.d.ts +93 -0
  36. package/types/scion-components-menu.d.ts +1922 -0
  37. package/types/scion-components-sashbox.d.ts +4 -2
  38. package/types/scion-components-splitter.d.ts +4 -3
  39. package/types/scion-components-table.d.ts +595 -0
  40. package/types/scion-components-text.d.ts +131 -0
  41. package/types/scion-components-viewport.d.ts +7 -4
  42. package/design/components/_scion-component-tokens.scss +0 -48
@@ -0,0 +1,1922 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { Injector, Signal, ElementRef, Binding, Provider, ViewContainerRef } from '@angular/core';
3
+ import { OneOf, MaybeArray, Disposable, RequireOne } from '@scion/toolkit/types';
4
+ import { ComponentType } from '@angular/cdk/portal';
5
+ import { MaybeSignal, SciComponentDescriptor } from '@scion/components/common';
6
+ import { Translatable } from '@scion/components/text';
7
+ import * as _scion_components_menu from '@scion/components/menu';
8
+
9
+ interface SciMenubarFactory {
10
+ addMenu(descriptor: SciMenubarMenuDescriptor, menuFactoryFn: (menu: SciMenuFactory) => void): this;
11
+ }
12
+ interface SciMenubarMenuDescriptor {
13
+ name?: `menuitem:${string}`;
14
+ label: MaybeSignal<Translatable>;
15
+ visible?: MaybeSignal<boolean>;
16
+ cssClass?: string | string[];
17
+ attributes?: {
18
+ [name: string]: string;
19
+ };
20
+ menu?: SciMenuDescriptor['menu'];
21
+ }
22
+
23
+ /**
24
+ * Represents a menu contribution contributed via {@link contributeMenu}.
25
+ */
26
+ interface SciMenuContribution {
27
+ /** Type of this contribution, indicating whether contributing to a menu, toolbar, or menubar. */
28
+ type: 'menu' | 'toolbar' | 'menubar';
29
+ /** Factory function to instantiate menu items of this contribution. */
30
+ factoryFn: SciMenuFactoryFnLike;
31
+ /** Minimal context required by this contribution. */
32
+ requiredContext: Map<string, unknown>;
33
+ /** Position where to insert menu items of this contribution. */
34
+ position?: SciMenuContributionPositionLike;
35
+ /** Instant when this contribution was registered. */
36
+ contributionInstant: number;
37
+ /** Arbitrary metadata associated with this contribution. */
38
+ metadata: {
39
+ [key: string]: unknown;
40
+ };
41
+ }
42
+ /**
43
+ * Controls contribution to a menu location.
44
+ */
45
+ interface SciMenuContributionOptions {
46
+ /**
47
+ * Declares a minimal required context.
48
+ *
49
+ * The contribution is only applied if the context of the menu location contains at least the specified key/value pairs.
50
+ * Context requirements can be defined using explicit values or an asterisk (`*`) to require any value for a given context key.
51
+ *
52
+ * @example - Contribute only for administrators within an active project context
53
+ * ```ts
54
+ * requiredContext: new Map()
55
+ * .set('userRole', 'admin')
56
+ * .set('activeProjectId', '*')
57
+ * ```
58
+ *
59
+ * A required context can also be provided at the injector level using {@link provideMenuContextProvider}, for example, at the component, route, or application level,
60
+ * and is available to menus contributed in the scope of this injector. The inherited context can be overridden or extended. Setting a context entry to `undefined` clears it.
61
+ */
62
+ requiredContext?: Map<string, unknown>;
63
+ /**
64
+ * Specifies the injector used to register the contribution. Defaults to the current injection context.
65
+ *
66
+ * The contribution is disposed when the passed injector is destroyed.
67
+ */
68
+ injector?: Injector;
69
+ /**
70
+ * Allows associating arbitrary metadata with the contribution.
71
+ *
72
+ * @docs-private Not public API. Used by frameworks integrating the SCION Menu API. Applications should not use this property.
73
+ */
74
+ metadata?: {
75
+ [key: string]: unknown;
76
+ };
77
+ /**
78
+ * Specifies an instant used to maintain a stable contribution order when the contribution is replaced, e.g., on context change.
79
+ *
80
+ * @docs-private Not public API. Used by frameworks integrating the SCION Menu API. Applications should not use this property.
81
+ */
82
+ contributionInstant?: number;
83
+ }
84
+ /**
85
+ * Describes location and position of a menu contribution.
86
+ */
87
+ type SciMenuContributionLocation = {
88
+ location: `menu:${string}`;
89
+ } & SciMenuContributionPosition;
90
+ /**
91
+ * Describes location and position of a toolbar contribution.
92
+ */
93
+ type SciToolbarContributionLocation = {
94
+ location: `toolbar:${string}`;
95
+ } & SciToolbarContributionPosition;
96
+ /**
97
+ * Describes location and position of a menubar contribution.
98
+ */
99
+ type SciMenubarContributionLocation = {
100
+ location: `menubar:${string}`;
101
+ } & SciMenubarContributionPosition;
102
+ /**
103
+ * Describes location and position of a menu, toolbar, or menubar contribution.
104
+ */
105
+ type SciMenuContributionLocationLike = SciMenuContributionLocation | SciToolbarContributionLocation | SciMenubarContributionLocation;
106
+ /**
107
+ * Controls where to insert a contribution into a menu. Can be at the beginning, at the end, or relative to a menu item or menu group.
108
+ */
109
+ type SciMenuContributionPosition = OneOf<{
110
+ before?: `menuitem:${string}` | `menu:${string}`;
111
+ after?: `menuitem:${string}` | `menu:${string}`;
112
+ position?: 'start' | 'end';
113
+ }>;
114
+ /**
115
+ * Controls where to insert a contribution into a toolbar. Can be at the beginning, at the end, or relative to a toolbar item or toolbar group.
116
+ */
117
+ type SciToolbarContributionPosition = OneOf<{
118
+ before?: `menuitem:${string}` | `toolbar:${string}`;
119
+ after?: `menuitem:${string}` | `toolbar:${string}`;
120
+ position?: 'start' | 'end';
121
+ }>;
122
+ /**
123
+ * Controls where to insert a contribution into a menubar. Can be at the beginning, at the end, or relative to a menu item.
124
+ */
125
+ type SciMenubarContributionPosition = OneOf<{
126
+ before?: `menu:${string}`;
127
+ after?: `menu:${string}`;
128
+ position?: 'start' | 'end';
129
+ }>;
130
+ /**
131
+ * Controls where to insert a contribution into a menu, toolbar, or menubar.
132
+ */
133
+ type SciMenuContributionPositionLike = SciMenuContributionPosition | SciToolbarContributionPosition | SciMenubarContributionPosition;
134
+ /**
135
+ * Signature of a function used to add menu items to a menu.
136
+ *
137
+ * The menu calls this function with a {@link SciMenuFactory} that provides methods for populating it.
138
+ * The menu context is passed as the second argument, a key/value map that describes the environment of the menu.
139
+ *
140
+ * The function runs within a reactive context, running again when tracked signals change.
141
+ * Most menu item properties accept a value or signal. For properties that can change, prefer setting the property as a signal over tracking it manually to prevent this function from re-running.
142
+ *
143
+ * The function can call `inject` to get required dependencies from the root injector. Registering a {@link provideMenuInjectionContextProvider} allows providing additional tokens for dependency injection.
144
+ *
145
+ * @experimental since 22.3.0; API and behavior may change in any version without notice.
146
+ */
147
+ type SciMenuFactoryFn = (menu: SciMenuFactory, context: Map<string, unknown>) => void;
148
+ /**
149
+ * Signature of a function used to add tools to a {@link SciToolbarComponent}.
150
+ *
151
+ * The toolbar calls this function with a {@link SciToolbarFactory} that provides methods for populating it.
152
+ * The toolbar context is passed as the second argument, a key/value map that describes the environment of the toolbar.
153
+ *
154
+ * The function runs within a reactive context, running again when tracked signals change.
155
+ * Most menu item properties accept a value or signal. For properties that can change, prefer setting the property as a signal over tracking it manually to prevent this function from re-running.
156
+ *
157
+ * The function can call `inject` to get required dependencies from the root injector. Registering a {@link provideMenuInjectionContextProvider} allows providing additional tokens for dependency injection.
158
+ *
159
+ * @experimental since 22.3.0; API and behavior may change in any version without notice.
160
+ */
161
+ type SciToolbarFactoryFn = (toolbar: SciToolbarFactory, context: Map<string, unknown>) => void;
162
+ /**
163
+ * Signature of a function used to add tools to a {@link SciMenubarComponent}.
164
+ *
165
+ * The menubar calls this function with a {@link SciMenubarFactory} that provides methods for populating it.
166
+ * The menubar context is passed as the second argument, a key/value map that describes the environment of the menubar.
167
+ *
168
+ * The function runs within a reactive context, running again when tracked signals change.
169
+ * Most menu item properties accept a value or signal. For properties that can change, prefer setting the property as a signal over tracking it manually to prevent this function from re-running.
170
+ *
171
+ * The function can call `inject` to get required dependencies from the root injector. Registering a {@link provideMenuInjectionContextProvider} allows providing additional tokens for dependency injection.
172
+ *
173
+ * @experimental since 22.3.0; API and behavior may change in any version without notice.
174
+ */
175
+ type SciMenubarFactoryFn = (menubar: SciMenubarFactory, context: Map<string, unknown>) => void;
176
+ /**
177
+ * Represents a {@link SciMenuFactoryFn}, {@link SciToolbarFactoryFn}, or {@link SciMenubarFactoryFn}.
178
+ */
179
+ type SciMenuFactoryFnLike = SciMenuFactoryFn | SciToolbarFactoryFn | SciMenubarFactoryFn;
180
+
181
+ /**
182
+ * INPUTS FOR DESCRIPTION: https://www.electronjs.org/docs/latest/api/menu-item
183
+ *
184
+ * TODO [menu] describe (shared)
185
+ */
186
+ interface SciMenuItem {
187
+ type: 'menu-item';
188
+ name?: `menuitem:${string}`;
189
+ labelText?: Signal<string>;
190
+ labelComponent?: SciComponentDescriptor;
191
+ iconLigature?: Signal<string>;
192
+ iconComponent?: SciComponentDescriptor;
193
+ control?: SciComponentDescriptor;
194
+ tooltip?: Signal<string>;
195
+ accelerator?: SciKeyboardAccelerator;
196
+ disabled?: Signal<boolean>;
197
+ visible?: Signal<boolean>;
198
+ checked?: Signal<boolean>;
199
+ active?: Signal<boolean>;
200
+ actions?: SciMenuItemLike[];
201
+ matchesFilter?: (filter: string) => boolean;
202
+ position?: SciMenuContributionPositionLike;
203
+ visualMenuIndicator?: boolean;
204
+ cssClass?: string[];
205
+ attributes?: {
206
+ [name: string]: string;
207
+ };
208
+ onSelect?: () => Promise<boolean>;
209
+ menu?: {
210
+ name?: `menu:${string}`;
211
+ width?: string;
212
+ minWidth?: string;
213
+ maxWidth?: string;
214
+ maxHeight?: string;
215
+ filter?: SciMenuFilterConfig<Signal<Translatable>>;
216
+ children: SciMenuItemLike[];
217
+ };
218
+ }
219
+ interface SciMenuGroup {
220
+ type: 'group';
221
+ name?: `menu:${string}` | `toolbar:${string}`;
222
+ label?: Signal<string>;
223
+ collapsible?: {
224
+ collapsed: boolean;
225
+ };
226
+ glyphArea?: false;
227
+ disabled?: Signal<boolean>;
228
+ visible?: Signal<boolean>;
229
+ position?: SciMenuContributionPositionLike;
230
+ actions?: SciMenuItemLike[];
231
+ children: SciMenuItemLike[];
232
+ cssClass?: string[];
233
+ }
234
+ type SciMenuItemLike = SciMenuItem | SciMenuGroup;
235
+
236
+ /**
237
+ * Installs accelerators for menu items contributed to the given location matching the specified context.
238
+ *
239
+ * An accelerator maps a physical key combination (key combined with modifiers such as `Ctrl`, `Shift`, or `Alt`) to an application action,
240
+ * enabling users to trigger an action without using a pointer device.
241
+ *
242
+ * Context and accelerator targets are inherited from the current injector hierarchy, but can be overridden via {@link SciMenuAcceleratorOptions.context} and {@link SciMenuAcceleratorOptions.target} options.
243
+ *
244
+ * This function must be called within an injection context, or an explicit {@link Injector} passed. Destroying the injection context uninstalls the accelerators.
245
+ *
246
+ * @param location - Specifies the menu, toolbar, or menubar for which to install accelerators.
247
+ * @param options - Controls the installation of accelerators.
248
+ * @returns Handle to uninstall the accelerators.
249
+ *
250
+ * @experimental since 22.3.0; API and behavior may change in any version without notice.
251
+ */
252
+ declare function installMenuAccelerators(location: `menu:${string}` | `toolbar:${string}` | `menubar:${string}`, options?: SciMenuAcceleratorOptions): Disposable;
253
+ /**
254
+ * Controls the installation of accelerators.
255
+ */
256
+ interface SciMenuAcceleratorOptions {
257
+ /**
258
+ * Specifies DOM elements on which to install menu accelerators. Defaults to {@link Document}.
259
+ *
260
+ * Alternatively, accelerator targets can be provided at the injector level using {@link provideMenuAcceleratorTargetProvider}, for example, at the component, route, or application level,
261
+ * and are available to accelerators installed in the scope of this injector. Inherited targets can be overridden.
262
+ */
263
+ target?: MaybeArray<Element | ElementRef<Element>>;
264
+ /**
265
+ * Controls in which context to install menu accelerators.
266
+ *
267
+ * Menu contributions may declare a required context. Only accelerators of contributions matching the context are installed.
268
+ *
269
+ * A context can also be provided at the injector level using {@link provideMenuContextProvider}, for example, at the component, route, or application level,
270
+ * and is available to accelerators installed in the scope of this injector. The inherited context can be overridden or extended. Setting a context entry to `undefined` clears it.
271
+ */
272
+ context?: Map<string, unknown>;
273
+ /**
274
+ * Specifies the injector used to install accelerators. Defaults to the current injection context.
275
+ *
276
+ * Accelerators are uninstalled when the injector is destroyed.
277
+ */
278
+ injector?: Injector;
279
+ /**
280
+ * Specifies metadata available to the operation.
281
+ *
282
+ * @docs-private Not public API. Used by frameworks integrating the SCION Menu API. Applications should not use this property.
283
+ */
284
+ metadata?: {
285
+ [key: string]: unknown;
286
+ };
287
+ }
288
+ /**
289
+ * Represents a keyboard accelerator to match specific keystrokes or key combinations.
290
+ *
291
+ * An accelerator maps a physical key combination (key combined with modifiers such as `Ctrl`, `Shift`, or `Alt`) to an application action,
292
+ * enabling users to trigger an action without using a pointer device.
293
+ */
294
+ interface SciKeyboardAccelerator {
295
+ /**
296
+ * Specifies the key of the accelerator.
297
+ *
298
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
299
+ */
300
+ key: string;
301
+ /**
302
+ * Indicates whether the `Ctrl` key (or `Cmd` key on macOS) must be pressed.
303
+ */
304
+ ctrl?: boolean;
305
+ /**
306
+ * Indicates whether the `Shift` key must be pressed.
307
+ */
308
+ shift?: boolean;
309
+ /**
310
+ * Indicates whether the `Alt` key (or `Opt` key on macOS) must be pressed.
311
+ */
312
+ alt?: boolean;
313
+ /**
314
+ * Specifies the physical location of the key on the keyboard.
315
+ *
316
+ * - `numpad`: Keys on the numeric keypad.
317
+ * - `left`: Left-side modifier keys.
318
+ * - `right`: Right-side modifier keys.
319
+ *
320
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/location
321
+ */
322
+ location?: 'numpad' | 'left' | 'right';
323
+ }
324
+
325
+ /**
326
+ * Factory used for adding items to a {@link SciToolbarComponent}.
327
+ *
328
+ * A toolbar is a horizontal or vertical container that provides quick access to context-related tools.
329
+ * It can contain buttons, split buttons, toggles, menus, and other controls, with related items grouped together.
330
+ *
331
+ * The methods of this factory return a reference to this factory, enabling method chaining.
332
+ */
333
+ interface SciToolbarFactory {
334
+ /**
335
+ * Adds a button or toggle to the toolbar.
336
+ *
337
+ * A toolbar button typically has an icon, a tooltip, and an accelerator. Clicking the button invokes {@link SciToolbarButtonDescriptor.onSelect}.
338
+ *
339
+ * ```ts
340
+ * contributeMenu('toolbar:main', toolbar => toolbar
341
+ * .addToolbarButton({icon: 'undo', accelerator: {ctrl: true, key: 'Z'}, tooltip: 'Undo', onSelect: () => console.log('Undo')})
342
+ * .addToolbarButton({icon: 'redo', accelerator: {ctrl: true, key: 'Y'}, tooltip: 'Redo', onSelect: () => console.log('Redo')}),
343
+ * );
344
+ * ```
345
+ *
346
+ * ##### Toggle Button
347
+ *
348
+ * Setting {@link SciToolbarButtonDescriptor.checked} configures the button as a toggle button.
349
+ *
350
+ * ```ts
351
+ * const bold = signal(true);
352
+ * const italic = signal(false);
353
+ *
354
+ * contributeMenu('toolbar:main', toolbar => toolbar
355
+ * .addToolbarButton({icon: 'format_bold', checked: bold, accelerator: {ctrl: true, shift: true, key: 'B'}, tooltip: 'Bold', onSelect: () => bold.update(bold => !bold)})
356
+ * .addToolbarButton({icon: 'format_italic', checked: italic, accelerator: {ctrl: true, shift: true, key: 'I'}, tooltip: 'Italic', onSelect: () => italic.update(italic => !italic)}),
357
+ * );
358
+ * ```
359
+ *
360
+ * ##### Allow for Relative Positioning
361
+ *
362
+ * Assigning a name allows other contributions to be positioned relative to this button.
363
+ *
364
+ * ```ts
365
+ * contributeMenu('toolbar:main', toolbar => toolbar
366
+ * .addToolbarButton({
367
+ * name: 'menuitem:undo', // <--- Gives the button a name
368
+ * icon: 'undo',
369
+ * onSelect: () => console.log('Undo'),
370
+ * }),
371
+ * );
372
+ * ```
373
+ *
374
+ * Use that name to contribute before or after the toolbar button.
375
+ *
376
+ * ```ts
377
+ * contributeMenu({location: 'toolbar:main', after: 'menuitem:undo'}, toolbar => toolbar
378
+ * .addToolbarButton({icon: 'save', onSelect: () => console.log('Save')}),
379
+ * );
380
+ * ```
381
+ *
382
+ * @param descriptor - Configures the appearance and behavior of the button.
383
+ * @returns A reference to this factory, enabling method chaining.
384
+ */
385
+ addToolbarButton(descriptor: SciToolbarButtonDescriptor): this;
386
+ /**
387
+ * Adds a split button to the toolbar.
388
+ *
389
+ * A split button consists of two parts: a primary action button and a menu button that opens a menu with related actions.
390
+ * Clicking the primary action button invokes {@link SciToolbarButtonDescriptor.onSelect}.
391
+ *
392
+ * Pass a descriptor to configure the primary action button and the appearance of the menu.
393
+ * To add menu items to the menu, pass a menu factory function as the second argument. The menu calls this function with a {@link SciMenuFactory} that provides methods for populating it.
394
+ *
395
+ * ```ts
396
+ * contributeMenu('toolbar:main', toolbar => toolbar
397
+ * .addToolbarSplitButton({
398
+ * icon: 'content_paste',
399
+ * tooltip: 'Paste',
400
+ * accelerator: {ctrl: true, key: 'V'},
401
+ * onSelect: () => console.log('Paste'),
402
+ * }, menu => menu
403
+ * .addMenuItem({icon: 'image', label: 'Paste Rich Text', onSelect: () => console.log('Paste Rich Text')})
404
+ * .addMenuItem({icon: 'article', label: 'Paste Text', onSelect: () => console.log('Paste Text')})
405
+ * .addMenuItem({icon: 'link', label: 'Paste URL', onSelect: () => console.log('Paste URL')}),
406
+ * ),
407
+ * );
408
+ * ```
409
+ *
410
+ * ##### Allow for Separate Menu Contributions
411
+ *
412
+ * As an alternative to defining the menu items inline, assign the menu a name, allowing for separate contributions to the menu using {@link contributeMenu}.
413
+ *
414
+ * ```ts
415
+ * contributeMenu('toolbar:main', toolbar => toolbar
416
+ * .addToolbarSplitButton({
417
+ * icon: 'content_paste',
418
+ * tooltip: 'Paste',
419
+ * accelerator: {ctrl: true, key: 'V'},
420
+ * onSelect: () => console.log('Paste'),
421
+ * menu: {name: 'menu:paste-options'}, // <--- Gives the menu a name
422
+ * }),
423
+ * );
424
+ * ```
425
+ *
426
+ * Use that name to contribute to the menu.
427
+ *
428
+ * ```ts
429
+ * contributeMenu('menu:paste-options', menu => menu
430
+ * .addMenuItem({icon: 'image', label: 'Paste Rich Text', onSelect: () => console.log('Paste Rich Text')})
431
+ * .addMenuItem({icon: 'article', label: 'Paste Text', onSelect: () => console.log('Paste Text')})
432
+ * .addMenuItem({icon: 'link', label: 'Paste URL', onSelect: () => console.log('Paste URL')}),
433
+ * );
434
+ * ```
435
+ *
436
+ * ##### Toggle Split Button
437
+ *
438
+ * Setting {@link SciToolbarButtonDescriptor.checked} configures the split button as a toggle button.
439
+ *
440
+ * ```ts
441
+ * const underlined = signal<'solid' | 'dashed' | 'dotted' | false>(false);
442
+ *
443
+ * contributeMenu('toolbar:main', toolbar => toolbar
444
+ * .addToolbarSplitButton({
445
+ * icon: 'format_underlined',
446
+ * checked: computed(() => underlined() !== false), // <--- Sets the button's checked state
447
+ * tooltip: 'Underlined',
448
+ * accelerator: {ctrl: true, shift: true, key: 'U'},
449
+ * onSelect: () => underlined.update(underlined => underlined ? false : 'solid'),
450
+ * }, menu => menu
451
+ * .addMenuItem({label: 'Solid', onSelect: () => underlined.set('solid')})
452
+ * .addMenuItem({label: 'Dashed', onSelect: () => underlined.set('dashed')})
453
+ * .addMenuItem({label: 'Dotted', onSelect: () => underlined.set('dotted')}),
454
+ * ),
455
+ * );
456
+ * ```
457
+ *
458
+ * ##### Allow for Relative Positioning
459
+ *
460
+ * Assigning the split button a name allows other contributions to be positioned relative to it.
461
+ *
462
+ * ```ts
463
+ * contributeMenu('toolbar:main', toolbar => toolbar
464
+ * .addToolbarSplitButton({
465
+ * name: 'menuitem:paste', // <--- Gives the split button a name
466
+ * icon: 'content_paste',
467
+ * onSelect: () => console.log('Paste'),
468
+ * }),
469
+ * );
470
+ * ```
471
+ *
472
+ * Use that name to contribute before or after the split button.
473
+ *
474
+ * ```ts
475
+ * contributeMenu({location: 'toolbar:main', after: 'menuitem:paste'}, toolbar => toolbar
476
+ * .addToolbarButton({icon: 'save', onSelect: () => console.log('Save')}),
477
+ * );
478
+ * ```
479
+ *
480
+ * @param descriptor - Configures the appearance and behavior of the split button and its menu.
481
+ * @param menuFactoryFn - Optional factory function to add menu items to the menu.
482
+ * @returns A reference to this factory, enabling method chaining.
483
+ */
484
+ addToolbarSplitButton(descriptor: SciToolbarButtonDescriptor & {
485
+ menu?: SciMenuDescriptor['menu'];
486
+ }, menuFactoryFn?: (menu: SciMenuFactory) => void): this;
487
+ /**
488
+ * Adds a menu to the toolbar.
489
+ *
490
+ * Pass a descriptor to configure the menu button and the appearance of the menu.
491
+ * By default, renders a visual menu indicator, which can be disabled via the {@link SciToolbarMenuDescriptor.visualMenuIndicator} property.
492
+ *
493
+ * To add menu items to the menu, pass a menu factory function as the second argument. The menu calls this function with a {@link SciMenuFactory} that provides methods for populating it.
494
+ *
495
+ * ```ts
496
+ * contributeMenu('toolbar:main', toolbar => toolbar
497
+ * .addToolbarMenu({icon: 'folder', tooltip: 'File'}, menu => menu
498
+ * .addMenuItem({icon: 'save', label: 'Save', accelerator: {ctrl: true, key: 'S'}, onSelect: () => console.log('Save')})
499
+ * .addMenuItem({icon: 'print', label: 'Print', accelerator: {ctrl: true, key: 'P'}, onSelect: () => console.log('Print')})
500
+ * .addMenu({icon: 'file_download', label: 'Export As...'}, menu => menu
501
+ * .addMenuItem({icon: 'picture_as_pdf', label: 'PDF Document', onSelect: () => console.log('PDF Document')})
502
+ * .addMenuItem({icon: 'table_view', label: 'Excel Spreadsheet', onSelect: () => console.log('Excel Spreadsheet')}),
503
+ * ),
504
+ * ),
505
+ * );
506
+ * ```
507
+ *
508
+ * ##### Allow for Separate Menu Contributions
509
+ *
510
+ * As an alternative to defining the menu items inline, assign the menu (or submenu) a name, allowing for separate contributions to the menu using {@link contributeMenu}.
511
+ *
512
+ * ```ts
513
+ * contributeMenu('toolbar:main', toolbar => toolbar
514
+ * .addToolbarMenu({
515
+ * icon: 'folder',
516
+ * tooltip: 'File',
517
+ * menu: {name: 'menu:file'}, // <--- Gives the menu a name
518
+ * }),
519
+ * );
520
+ * ```
521
+ *
522
+ * Use that name to contribute to the menu.
523
+ *
524
+ * ```ts
525
+ * contributeMenu('menu:file', menu => menu
526
+ * .addMenuItem({icon: 'save', label: 'Save', accelerator: {ctrl: true, key: 'S'}, onSelect: () => console.log('Save')})
527
+ * .addMenuItem({icon: 'print', label: 'Print', accelerator: {ctrl: true, key: 'P'}, onSelect: () => console.log('Print')})
528
+ * .addMenu({icon: 'file_download', label: 'Export As...'}, menu => menu
529
+ * .addMenuItem({icon: 'picture_as_pdf', label: 'PDF Document', onSelect: () => console.log('PDF Document')})
530
+ * .addMenuItem({icon: 'table_view', label: 'Excel Spreadsheet', onSelect: () => console.log('Excel Spreadsheet')}),
531
+ * ),
532
+ * );
533
+ * ```
534
+ *
535
+ * ##### Allow for Relative Positioning
536
+ *
537
+ * Assigning the menu button a name allows other contributions to be positioned relative to it.
538
+ *
539
+ * ```ts
540
+ * contributeMenu('toolbar:main', toolbar => toolbar
541
+ * .addToolbarMenu({
542
+ * name: 'menuitem:file', // <--- Gives the menu button a name
543
+ * icon: 'folder',
544
+ * tooltip: 'File',
545
+ * }),
546
+ * );
547
+ * ```
548
+ *
549
+ * Use that name to contribute before or after the menu button.
550
+ *
551
+ * ```ts
552
+ * contributeMenu({location: 'toolbar:main', after: 'menuitem:file'}, toolbar => toolbar
553
+ * .addToolbarButton({icon: 'save', onSelect: () => console.log('Save')}),
554
+ * );
555
+ * ```
556
+ *
557
+ * @param descriptor - Configures the appearance and behavior of the menu button and its menu.
558
+ * @param menuFactoryFn - Optional factory function to add menu items to the menu.
559
+ * @returns A reference to this factory, enabling method chaining.
560
+ */
561
+ addToolbarMenu(descriptor: SciToolbarMenuDescriptor, menuFactoryFn?: (menu: SciMenuFactory) => void): this;
562
+ /**
563
+ * Adds a component to the toolbar, allowing for custom toolbar items like a filter field.
564
+ *
565
+ * The control can be any component. Data can be passed to the component via {@link SciToolbarControlDescriptor.bindings}.
566
+ * Because the component is not a button, it does not support a selection handler, checked state, or disabled state.
567
+ *
568
+ * ```ts
569
+ * contributeMenu('toolbar:main', toolbar => toolbar
570
+ * .addToolbarControl({
571
+ * component: FilterFieldComponent,
572
+ * bindings: [inputBinding('placeholder', signal('Filter items...'))],
573
+ * }),
574
+ * );
575
+ * ```
576
+ *
577
+ * ##### Allow for Relative Positioning
578
+ *
579
+ * Assigning a name allows other contributions to be positioned relative to this control.
580
+ *
581
+ * ```ts
582
+ * contributeMenu('toolbar:main', toolbar => toolbar
583
+ * .addToolbarControl({
584
+ * name: 'menuitem:filter', // <--- Gives the toolbar control a name
585
+ * component: FilterFieldComponent,
586
+ * }),
587
+ * );
588
+ * ```
589
+ *
590
+ * Use that name to contribute before or after the toolbar control.
591
+ *
592
+ * ```ts
593
+ * contributeMenu({location: 'toolbar:main', after: 'menuitem:filter'}, toolbar => toolbar
594
+ * .addToolbarButton({icon: 'save', onSelect: () => console.log('Save')}),
595
+ * );
596
+ * ```
597
+ *
598
+ * @param descriptor - Specifies the component and its inputs.
599
+ * @returns A reference to this factory, enabling method chaining.
600
+ */
601
+ addToolbarControl(descriptor: SciToolbarControlDescriptor): this;
602
+ /**
603
+ * Adds a split control to the toolbar.
604
+ *
605
+ * A split control consists of two parts: the control and a menu button that opens a menu with related actions.
606
+ *
607
+ * The control can be any component. Data can be passed to the component via {@link SciToolbarControlDescriptor.bindings}.
608
+ * Because the component is not a button, it does not support a selection handler, checked state, or disabled state.
609
+ *
610
+ * To add menu items to the menu, pass a menu factory function as the second argument. The menu calls this function with a {@link SciMenuFactory} that provides methods for populating it.
611
+ *
612
+ * ```ts
613
+ * const matchCase = signal(false);
614
+ * const useRegex = signal(false);
615
+ *
616
+ * contributeMenu('toolbar:main', toolbar => toolbar
617
+ * .addToolbarSplitControl({
618
+ * component: FilterFieldComponent,
619
+ * bindings: [inputBinding('placeholder', signal('Filter items...'))],
620
+ * }, menu => menu
621
+ * .addMenuItem({label: 'Match Case', checked: matchCase, onSelect: () => matchCase.update(caseSensitive => !caseSensitive)})
622
+ * .addMenuItem({label: 'Regular Expressions', checked: useRegex, onSelect: () => useRegex.update(regex => !regex)}),
623
+ * ),
624
+ * );
625
+ * ```
626
+ * ##### Allow for Separate Menu Contributions
627
+ *
628
+ * As an alternative to defining the menu items inline, assign the menu a name, allowing for separate contributions to the menu using {@link contributeMenu}.
629
+ *
630
+ * ```ts
631
+ * contributeMenu('toolbar:main', toolbar => toolbar
632
+ * .addToolbarSplitControl({
633
+ * component: FilterFieldComponent,
634
+ * bindings: [inputBinding('placeholder', signal('Filter items...'))],
635
+ * menu: {name: 'menu:filter-options'}, // <--- Gives the menu a name
636
+ * },
637
+ * ),
638
+ * );
639
+ * ```
640
+ *
641
+ * Use that name to contribute to the menu.
642
+ *
643
+ * ```ts
644
+ * contributeMenu('menu:filter-options', menu => menu
645
+ * .addMenuItem({label: 'Match Case', checked: matchCase, onSelect: () => matchCase.update(caseSensitive => !caseSensitive)})
646
+ * .addMenuItem({label: 'Regular Expressions', checked: useRegex, onSelect: () => useRegex.update(regex => !regex)}),
647
+ * );
648
+ * ```
649
+ *
650
+ * ##### Allow for Relative Positioning
651
+ *
652
+ * Assigning the split control a name allows other contributions to be positioned relative to it.
653
+ *
654
+ * ```ts
655
+ * contributeMenu('toolbar:main', toolbar => toolbar
656
+ * .addToolbarSplitControl({
657
+ * name: 'menuitem:filter', // <--- Gives the control a name
658
+ * component: FilterFieldComponent,
659
+ * },
660
+ * ),
661
+ * );
662
+ * ```
663
+ *
664
+ * Use that name to contribute before or after the split control.
665
+ *
666
+ * ```ts
667
+ * contributeMenu({location: 'toolbar:main', after: 'menuitem:filter'}, toolbar => toolbar
668
+ * .addToolbarButton({icon: 'save', onSelect: () => console.log('Save')}),
669
+ * );
670
+ * ```
671
+ *
672
+ * @param descriptor - Specifies the component and its inputs.
673
+ * @param menuFactoryFn - Optional factory function to add menu items to the split control.
674
+ * @returns A reference to this factory, enabling method chaining.
675
+ */
676
+ addToolbarSplitControl(descriptor: SciToolbarControlDescriptor & {
677
+ menu?: SciMenuDescriptor['menu'];
678
+ }, menuFactoryFn?: (menu: SciMenuFactory) => void): this;
679
+ /**
680
+ * Adds a group to the toolbar to group related items visually.
681
+ *
682
+ * Pass a factory function to add items to the group. The group calls this function with a {@link SciToolbarFactory} that provides methods for populating it.
683
+ *
684
+ * ```ts
685
+ * contributeMenu('toolbar:main', toolbar => toolbar
686
+ * .addGroup(group => group
687
+ * .addToolbarButton({icon: 'undo', onSelect: () => console.log('Undo')})
688
+ * .addToolbarButton({icon: 'redo', onSelect: () => console.log('Redo')}),
689
+ * ),
690
+ * );
691
+ * ```
692
+ *
693
+ * @param groupFactoryFn - Factory function to add items to the group.
694
+ * @returns A reference to this factory, enabling method chaining.
695
+ */
696
+ addGroup(groupFactoryFn: (group: SciToolbarFactory) => void): this;
697
+ /**
698
+ * Adds a group to the toolbar to group related items visually.
699
+ *
700
+ * Pass a descriptor to configure the appearance and behavior of the group.
701
+ * To add items to the group, pass a group factory function as the second argument. The group calls this function with a {@link SciToolbarFactory} that provides methods for populating it.
702
+ *
703
+ * ```ts
704
+ * contributeMenu('toolbar:main', toolbar => toolbar
705
+ * .addGroup({cssClass: 'group'}, group => group
706
+ * .addToolbarButton({icon: 'undo', onSelect: () => console.log('Undo')})
707
+ * .addToolbarButton({icon: 'redo', onSelect: () => console.log('Redo')}),
708
+ * ),
709
+ * );
710
+ * ```
711
+ *
712
+ * ##### Allow for Separate Group Contributions
713
+ *
714
+ * Assigning the group a name allows for separate contributions to the group using {@link contributeMenu}.
715
+ *
716
+ * ```ts
717
+ * contributeMenu('toolbar:main', toolbar => toolbar
718
+ * .addGroup({name: 'toolbar:edit'}), // <--- Gives the group a name
719
+ * );
720
+ * ```
721
+ *
722
+ * Use that name to contribute to the group.
723
+ *
724
+ * ```ts
725
+ * contributeMenu('toolbar:edit', toolbar => toolbar
726
+ * .addToolbarButton({icon: 'undo', onSelect: () => console.log('Undo')})
727
+ * .addToolbarButton({icon: 'redo', onSelect: () => console.log('Redo')}),
728
+ * );
729
+ * ```
730
+ *
731
+ * ##### Allow for Relative Positioning
732
+ *
733
+ * Assigning the group a name allows other contributions to be positioned relative to it.
734
+ *
735
+ * ```ts
736
+ * contributeMenu('toolbar:main', toolbar => toolbar
737
+ * .addGroup({
738
+ * name: 'toolbar:edit', // <--- Gives the group a name
739
+ * }, group => group
740
+ * .addToolbarButton({icon: 'undo', onSelect: () => console.log('Undo')})
741
+ * .addToolbarButton({icon: 'redo', onSelect: () => console.log('Redo')}),
742
+ * ),
743
+ * );
744
+ * ```
745
+ *
746
+ * Use that name to contribute before or after the group.
747
+ *
748
+ * ```ts
749
+ * contributeMenu({location: 'toolbar:main', after: 'toolbar:edit'}, toolbar => toolbar
750
+ * .addToolbarButton({icon: 'save', onSelect: () => console.log('Save')}),
751
+ * );
752
+ * ```
753
+ *
754
+ * @param descriptor - Configures the appearance and behavior of the group.
755
+ * @param groupFactoryFn - Optional factory function to add items to the group.
756
+ * @returns A reference to this factory, enabling method chaining.
757
+ */
758
+ addGroup(descriptor: SciToolbarGroupDescriptor, groupFactoryFn?: (group: SciToolbarFactory) => void): this;
759
+ }
760
+ /**
761
+ * Configures the appearance and behavior of a toolbar button.
762
+ */
763
+ interface SciToolbarButtonDescriptor {
764
+ /**
765
+ * Specifies the name of the button, used to position other toolbar items relative to it.
766
+ */
767
+ name?: `menuitem:${string}`;
768
+ /**
769
+ * Specifies the icon to be displayed for the button.
770
+ *
771
+ * SCION uses icon providers to render icons. An icon provider can be registered using {@link provideIconProvider}.
772
+ *
773
+ * Defaults to a Material icon provider if the application has not registered an icon provider, interpreting the icon as a Material Icon font ligature.
774
+ * Refer to https://fonts.google.com/icons for available Material icons and instructions on including the Material icon font.
775
+ *
776
+ * For icons that can change, prefer setting the icon as a signal over tracking it manually to prevent the contribution function from re-running.
777
+ *
778
+ * A component can be used to render a custom icon. Data can be passed to the component via {@link SciComponentDescriptor.bindings}.
779
+ */
780
+ icon?: MaybeSignal<string> | ComponentType<unknown> | SciComponentDescriptor;
781
+ /**
782
+ * Specifies the label to be displayed for the button.
783
+ *
784
+ * Can be text or a translation key. A translation key starts with the percent symbol (`%`) and may include parameters in matrix notation for text interpolation.
785
+ *
786
+ * SCION uses text providers to resolve translation keys. A text provider can be registered using {@link provideTextProvider}.
787
+ *
788
+ * For texts that can change, prefer setting the text as a signal over tracking it manually to prevent the contribution function from re-running.
789
+ *
790
+ * A component can be used to render a custom label. Data can be passed to the component via {@link SciComponentDescriptor.bindings}.
791
+ */
792
+ label?: MaybeSignal<Translatable> | ComponentType<unknown> | SciComponentDescriptor;
793
+ /**
794
+ * Specifies the tooltip to be displayed when hovering over the button.
795
+ *
796
+ * Can be text or a translation key. A translation key starts with the percent symbol (`%`) and may include parameters in matrix notation for text interpolation.
797
+ *
798
+ * SCION uses text providers to resolve translation keys. A text provider can be registered using {@link provideTextProvider}.
799
+ *
800
+ * For texts that can change, prefer setting the text as a signal over tracking it manually to prevent the contribution function from re-running.
801
+ */
802
+ tooltip?: MaybeSignal<Translatable>;
803
+ /**
804
+ * Configures the button as a toggle button, with the specified checked state.
805
+ *
806
+ * Prefer setting the checked state as a signal over tracking it manually to prevent the contribution function from re-running.
807
+ */
808
+ checked?: MaybeSignal<boolean>;
809
+ /**
810
+ * Specifies the accelerator to be installed for the button.
811
+ *
812
+ * Accelerators allow for quick access using a keyboard shortcut, mapping a physical key combination (key combined with modifiers such as `Ctrl`, `Shift`, or `Alt`) to an application action.
813
+ */
814
+ accelerator?: SciKeyboardAccelerator;
815
+ /**
816
+ * Indicates whether the button is disabled. Defaults to `false`.
817
+ *
818
+ * Prefer setting the disabled state as a signal over tracking it manually to prevent the contribution function from re-running.
819
+ */
820
+ disabled?: MaybeSignal<boolean>;
821
+ /**
822
+ * Indicates whether the button is visible. Defaults to `true`.
823
+ *
824
+ * Prefer setting the visible state as a signal over tracking it manually to prevent the contribution function from re-running.
825
+ */
826
+ visible?: MaybeSignal<boolean>;
827
+ /**
828
+ * Specifies CSS classes to associate with the button.
829
+ */
830
+ cssClass?: string | string[];
831
+ /**
832
+ * Specifies HTML attributes to associate with the button.
833
+ *
834
+ * Data attributes should start with the `data-` prefix.
835
+ */
836
+ attributes?: {
837
+ [name: string]: string;
838
+ };
839
+ /**
840
+ * Specifies the handler invoked when the button is triggered by a click or keyboard shortcut.
841
+ *
842
+ * @returns A `boolean` or a Promise indicating whether to close the enclosing popover, if any. Non-checkable buttons close the popover by default.
843
+ */
844
+ onSelect: () => void | boolean | Promise<void | boolean>;
845
+ }
846
+ /**
847
+ * Configures the appearance and behavior of a toolbar menu button and its menu.
848
+ */
849
+ interface SciToolbarMenuDescriptor {
850
+ /**
851
+ * Specifies the name of the menu button, used to position other toolbar items relative to it.
852
+ */
853
+ name?: `menuitem:${string}`;
854
+ /**
855
+ * Specifies the icon to be displayed for the menu button.
856
+ *
857
+ * SCION uses icon providers to render icons. An icon provider can be registered using {@link provideIconProvider}.
858
+ *
859
+ * Defaults to a Material icon provider if the application has not registered an icon provider, interpreting the icon as a Material Icon font ligature.
860
+ * Refer to https://fonts.google.com/icons for available Material icons and instructions on including the Material icon font.
861
+ *
862
+ * For icons that can change, prefer setting the icon as a signal over tracking it manually to prevent the contribution function from re-running.
863
+ *
864
+ * A component can be used to render a custom icon. Data can be passed to the component via {@link SciComponentDescriptor.bindings}.
865
+ */
866
+ icon?: MaybeSignal<string> | ComponentType<unknown> | SciComponentDescriptor;
867
+ /**
868
+ * Specifies the label to be displayed for the menu button.
869
+ *
870
+ * Can be text or a translation key. A translation key starts with the percent symbol (`%`) and may include parameters in matrix notation for text interpolation.
871
+ *
872
+ * SCION uses text providers to resolve translation keys. A text provider can be registered using {@link provideTextProvider}.
873
+ *
874
+ * For texts that can change, prefer setting the text as a signal over tracking it manually to prevent the contribution function from re-running.
875
+ *
876
+ * A component can be used to render a custom label. Data can be passed to the component via {@link SciComponentDescriptor.bindings}.
877
+ */
878
+ label?: MaybeSignal<Translatable> | ComponentType<unknown> | SciComponentDescriptor;
879
+ /**
880
+ * Specifies the tooltip to be displayed when hovering over the menu button.
881
+ *
882
+ * Can be text or a translation key. A translation key starts with the percent symbol (`%`) and may include parameters in matrix notation for text interpolation.
883
+ *
884
+ * SCION uses text providers to resolve translation keys. A text provider can be registered using {@link provideTextProvider}.
885
+ *
886
+ * For texts that can change, prefer setting the text as a signal over tracking it manually to prevent the contribution function from re-running.
887
+ */
888
+ tooltip?: MaybeSignal<Translatable>;
889
+ /**
890
+ * Indicates whether the menu button is disabled. Defaults to `false`.
891
+ *
892
+ * Prefer setting the disabled state as a signal over tracking it manually to prevent the contribution function from re-running.
893
+ */
894
+ disabled?: MaybeSignal<boolean>;
895
+ /**
896
+ * Indicates whether the menu button is visible. Defaults to `true`.
897
+ *
898
+ * Prefer setting the visible state as a signal over tracking it manually to prevent the contribution function from re-running.
899
+ */
900
+ visible?: MaybeSignal<boolean>;
901
+ /**
902
+ * Controls whether to display a visual indicator for the menu. Defaults to `true`.
903
+ *
904
+ * For icon menu buttons, a small triangle indicator is rendered in the bottom-right corner. For label menu buttons, a chevron is used.
905
+ */
906
+ visualMenuIndicator?: boolean;
907
+ /**
908
+ * Specifies CSS classes to associate with the menu button and menu.
909
+ */
910
+ cssClass?: string | string[];
911
+ /**
912
+ * Specifies HTML attributes to associate with the menu button and menu.
913
+ *
914
+ * Data attributes should start with the `data-` prefix.
915
+ */
916
+ attributes?: {
917
+ [name: string]: string;
918
+ };
919
+ /**
920
+ * Configures the appearance and behavior of the menu opened when clicking the menu button.
921
+ */
922
+ menu?: SciMenuDescriptor['menu'];
923
+ }
924
+ /**
925
+ * Configures the appearance and behavior of a toolbar control.
926
+ */
927
+ interface SciToolbarControlDescriptor {
928
+ /**
929
+ * Specifies the name of the control, used to position other toolbar items relative to it.
930
+ */
931
+ name?: `menuitem:${string}`;
932
+ /**
933
+ * Specifies the component used to render the control.
934
+ */
935
+ component: ComponentType<unknown>;
936
+ /**
937
+ * Specifies data to pass to the component.
938
+ *
939
+ * ```ts
940
+ * bindings: [inputBinding('placeholder', signal('Filter items...'))];
941
+ * ```
942
+ *
943
+ * Inputs are available as input properties in the component.
944
+ *
945
+ * ```ts
946
+ * public placeholder = input.required<string>();
947
+ * ```
948
+ *
949
+ * @see inputBinding
950
+ * @see outputBinding
951
+ * @see twoWayBinding
952
+ */
953
+ bindings?: Binding[];
954
+ /**
955
+ * Specifies the injector used to instantiate the component, giving control over which objects are available for injection. Defaults to the element injector.
956
+ *
957
+ * ```ts
958
+ * Injector.create({
959
+ * parent: ...,
960
+ * providers: [
961
+ * {provide: <TOKEN>, useValue: <VALUE>}
962
+ * ],
963
+ * })
964
+ * ```
965
+ */
966
+ injector?: Injector;
967
+ /**
968
+ * Specifies providers available for injection in the component.
969
+ */
970
+ providers?: Provider[];
971
+ /**
972
+ * Specifies the tooltip to be displayed when hovering over the control.
973
+ *
974
+ * Can be text or a translation key. A translation key starts with the percent symbol (`%`) and may include parameters in matrix notation for text interpolation.
975
+ *
976
+ * SCION uses text providers to resolve translation keys. A text provider can be registered using {@link provideTextProvider}.
977
+ *
978
+ * For texts that can change, prefer setting the text as a signal over tracking it manually to prevent the contribution function from re-running.
979
+ */
980
+ tooltip?: MaybeSignal<Translatable>;
981
+ /**
982
+ * Indicates whether the control is visible. Defaults to `true`.
983
+ *
984
+ * Prefer setting the visible state as a signal over tracking it manually to prevent the contribution function from re-running.
985
+ */
986
+ visible?: MaybeSignal<boolean>;
987
+ /**
988
+ * Specifies CSS classes to associate with the control.
989
+ */
990
+ cssClass?: string | string[];
991
+ /**
992
+ * Specifies HTML attributes to associate with the control.
993
+ *
994
+ * Data attributes should start with the `data-` prefix.
995
+ */
996
+ attributes?: {
997
+ [name: string]: string;
998
+ };
999
+ }
1000
+ /**
1001
+ * Configures the appearance and behavior of a toolbar group.
1002
+ */
1003
+ interface SciToolbarGroupDescriptor {
1004
+ /**
1005
+ * Specifies the name of the group, used to position other toolbar items relative to it.
1006
+ */
1007
+ name?: `toolbar:${string}`;
1008
+ /**
1009
+ * Indicates whether the group is disabled. Defaults to `false`.
1010
+ *
1011
+ * Prefer setting the disabled state as a signal over tracking it manually to prevent the contribution function from re-running.
1012
+ */
1013
+ disabled?: MaybeSignal<boolean>;
1014
+ /**
1015
+ * Indicates whether the group is visible. Defaults to `true`.
1016
+ *
1017
+ * Prefer setting the visible state as a signal over tracking it manually to prevent the contribution function from re-running.
1018
+ */
1019
+ visible?: MaybeSignal<boolean>;
1020
+ /**
1021
+ * Specifies CSS classes to associate with the group.
1022
+ */
1023
+ cssClass?: string | string[];
1024
+ }
1025
+
1026
+ interface SciMenuFactory {
1027
+ addMenuItem(descriptor: SciMenuItemDescriptor): this;
1028
+ addMenu(descriptor: SciMenuDescriptor, menuFactoryFn?: (menu: SciMenuFactory) => void): this;
1029
+ addGroup(groupFactoryFn: (group: SciMenuFactory) => void): this;
1030
+ addGroup(descriptor: SciMenuGroupDescriptor, groupFactoryFn?: (group: SciMenuFactory) => void): this;
1031
+ }
1032
+ interface SciMenuItemDescriptor {
1033
+ name?: `menuitem:${string}`;
1034
+ label: MaybeSignal<Translatable> | ComponentType<unknown> | SciComponentDescriptor;
1035
+ icon?: MaybeSignal<string> | ComponentType<unknown> | SciComponentDescriptor;
1036
+ checked?: MaybeSignal<boolean>;
1037
+ active?: MaybeSignal<boolean>;
1038
+ tooltip?: MaybeSignal<Translatable>;
1039
+ accelerator?: SciKeyboardAccelerator;
1040
+ disabled?: MaybeSignal<boolean>;
1041
+ visible?: MaybeSignal<boolean>;
1042
+ actions?: (actions: SciToolbarFactory) => void;
1043
+ onFilter?: (filter: string) => boolean;
1044
+ cssClass?: string | string[];
1045
+ attributes?: {
1046
+ [name: string]: string;
1047
+ };
1048
+ onSelect: () => void | boolean | Promise<void | boolean>;
1049
+ }
1050
+ /**
1051
+ * Configures a menu button and its menu.
1052
+ */
1053
+ interface SciMenuDescriptor {
1054
+ name?: `menuitem:${string}`;
1055
+ label: MaybeSignal<Translatable> | ComponentType<unknown> | SciComponentDescriptor;
1056
+ icon?: MaybeSignal<string> | ComponentType<unknown> | SciComponentDescriptor;
1057
+ disabled?: MaybeSignal<boolean>;
1058
+ visible?: MaybeSignal<boolean>;
1059
+ cssClass?: string | string[];
1060
+ attributes?: {
1061
+ [name: string]: string;
1062
+ };
1063
+ /**
1064
+ * Configures the menu.
1065
+ */
1066
+ menu?: {
1067
+ name?: `menu:${string}`;
1068
+ width?: string;
1069
+ minWidth?: string;
1070
+ maxWidth?: string;
1071
+ maxHeight?: string;
1072
+ filter?: boolean | RequireOne<SciMenuFilterConfig>;
1073
+ };
1074
+ }
1075
+ interface SciMenuGroupDescriptor {
1076
+ name?: `menu:${string}`;
1077
+ label?: MaybeSignal<Translatable>;
1078
+ collapsible?: boolean | {
1079
+ collapsed: boolean;
1080
+ };
1081
+ /**
1082
+ * TODO [menu]: Explain what glyph area is.
1083
+ *
1084
+ * Controls whether to hide the glyph area in this group.
1085
+ * Defaults to displaying the glyph area if any menu item contained in the menu or its groups has an icon or is checkable.
1086
+ */
1087
+ glyphArea?: false;
1088
+ disabled?: MaybeSignal<boolean>;
1089
+ visible?: MaybeSignal<boolean>;
1090
+ actions?: (actions: SciToolbarFactory) => void;
1091
+ cssClass?: string | string[];
1092
+ }
1093
+ /**
1094
+ * Features of the menu filter field.
1095
+ */
1096
+ interface SciMenuFilterConfig<T = MaybeSignal<Translatable>> {
1097
+ placeholder?: T;
1098
+ notFoundMessage?: T;
1099
+ focus?: boolean;
1100
+ }
1101
+
1102
+ /**
1103
+ * Opens a menu with items contributed via {@link contributeMenu}.
1104
+ *
1105
+ * A menu displays a list of related items in a popover, organized into groups and submenus.
1106
+ * It closes when a menu item is selected or on an outside click. Menu items can define a keyboard accelerator for quick access.
1107
+ *
1108
+ * ## Menu Item Size
1109
+ * The menu item size is based on the `--sci-menu-item-size` CSS variable and defaults to `16px`. It determines the icon size and is used to compute the font size and padding.
1110
+ *
1111
+ * A custom size can be defined globally using the `:root` selector:
1112
+ *
1113
+ * ```css
1114
+ * sci-menu {
1115
+ * --sci-menu-item-size: 18px;
1116
+ * }
1117
+ * ```
1118
+ *
1119
+ * Instead of computing the font size based on `--sci-menu-item-size`, an explicit font size can be defined using the `--sci-menu-font-size` CSS variable:
1120
+ *
1121
+ * ```css
1122
+ * sci-menu {
1123
+ * --sci-menu-item-size: 14px;
1124
+ * }
1125
+ * ```
1126
+ *
1127
+ * ## Custom Styling
1128
+ * The appearance of the menu can be customized using the following CSS variables:
1129
+ *
1130
+ * - `--sci-menu-font-size`: Font size of menu items.
1131
+ * - `--sci-menu-border-radius`: Border radius of a menu popover.
1132
+ * - `--sci-menu-min-width`: Minimum width of a menu popover.
1133
+ * - `--sci-menu-submenu-min-width`: Minimum width of a submenu popover.
1134
+ * - `--sci-menu-item-size`: Size of menu items; used as the menu item icon size and to compute font size and padding.
1135
+ * - `--sci-menu-item-cursor`: Cursor style when hovering over a menu item.
1136
+ * - `--sci-menu-item-text-color`: Text and icon color of menu items.
1137
+ * - `--sci-menu-item-text-color-disabled`: Text and icon color of disabled menu items.
1138
+ * - `--sci-menu-item-background-color-hover`: Background color of a menu item when hovered.
1139
+ * - `--sci-menu-item-background-color-active`: Background color of a menu item when pressed.
1140
+ * - `--sci-menu-item-border-radius`: Border radius of menu items.
1141
+ * - `--sci-menu-item-outline-width`: Outline width of menu items when focused.
1142
+ * - `--sci-menu-item-accelerator-text-color`: Text color of menu item accelerators.
1143
+ * - `--sci-menu-item-active-indicator-size`: Size of the visual indicator for active menu items.
1144
+ * - `--sci-menu-item-active-indicator-background-color`: Background color of the visual indicator for active menu items.
1145
+ * - `--sci-menu-item-active-indicator-border-radius`: Border radius of the visual indicator for active menu items.
1146
+ * - `--sci-menu-group-header-font-family`: Font family for group headers.
1147
+ * - `--sci-menu-group-header-font-size`: Font size for group headers.
1148
+ * - `--sci-menu-group-header-font-weight`: Font weight for group headers.
1149
+ * - `--sci-menu-group-header-text-color`: Text color for group headers.
1150
+ * - `--sci-menu-filter-outline-width`: Outline width of the filter field.
1151
+ * - `--sci-menu-filter-outline-radius`: Outline radius of the filter field.
1152
+ *
1153
+ * @experimental since 22.3.0; API and behavior may change in any version without notice.
1154
+ */
1155
+ declare abstract class SciMenuService {
1156
+ /**
1157
+ * Opens a menu with items contributed to the specified menu.
1158
+ *
1159
+ * The menu is positioned relative to the specified anchor, vertically or horizontally. The anchor can be a coordinate, a mouse event, or a DOM element.
1160
+ *
1161
+ * ```ts
1162
+ * import {inject} from '@angular/core';
1163
+ * import {SciMenuService} from '@scion/components/menu';
1164
+ *
1165
+ * inject(SciMenuService).open('menu:contextmenu', { // <--- Sets the name of the menu
1166
+ * anchor: {x: 500, y: 600}, // <--- Sets the anchor position
1167
+ * });
1168
+ * ```
1169
+ *
1170
+ * Use the {@link contributeMenu} function to contribute to the menu by passing the menu name and a factory function.
1171
+ * The menu calls the factory function with a {@link SciMenuFactoryFn}, providing methods for populating the menu.
1172
+ *
1173
+ * ```ts
1174
+ * import {contributeMenu} from '@scion/components/menu';
1175
+ *
1176
+ * contributeMenu('menu:contextmenu', menu => menu
1177
+ * .addMenuItem({icon: 'content_copy', label: 'Copy', onSelect: () => console.log('Copy')})
1178
+ * .addMenuItem({icon: 'content_paste', label: 'Paste', onSelect: () => console.log('Paste')}),
1179
+ * );
1180
+ * ```
1181
+ *
1182
+ * Multiple contributions to the same menu can populate it from different places in the application. Passing a {@link SciMenuContributionLocation}
1183
+ * gives exact control over contribution placement within the menu. By default, menu items are added in contribution order.
1184
+ *
1185
+ * Groups and submenus can be named to allow extension from other contributions.
1186
+ *
1187
+ * ## Location in the DOM
1188
+ * By default, the menu popover is inserted after the anchor element in the DOM, or appended to the HTML body if using a coordinate anchor.
1189
+ *
1190
+ * A different location can be set via the {@link SciMenuOptions.viewContainerRef} option:
1191
+ *
1192
+ * ```ts
1193
+ * import {inject, ViewContainerRef} from '@angular/core';
1194
+ * import {SciMenuService} from '@scion/components/menu';
1195
+ *
1196
+ * inject(SciMenuService).open('menu:contextmenu', {
1197
+ * anchor: {x: 500, y: 600},
1198
+ * viewContainerRef: inject(ViewContainerRef), // <--- Sets the location in the DOM
1199
+ * });
1200
+ * ```
1201
+ *
1202
+ * ## Filterable Menu
1203
+ * Setting the {@link SciMenuOptions.filter} option displays a filter field, enabling filtering of menu items.
1204
+ *
1205
+ * ```ts
1206
+ * import {inject} from '@angular/core';
1207
+ * import {SciMenuService} from '@scion/components/menu';
1208
+ *
1209
+ * inject(SciMenuService).open('menu:contextmenu', {
1210
+ * anchor: {x: 500, y: 600},
1211
+ * filter: true, // <--- Instructs the menu to display a filter field
1212
+ * });
1213
+ * ```
1214
+ *
1215
+ * ## Menu Size
1216
+ * The menu size can be controlled via menu options. By default, a menu uses the minimum width defined by the `--sci-menu-min-width` or `--sci-menu-submenu-min-width` CSS variables.
1217
+ *
1218
+ * ```ts
1219
+ * import {inject} from '@angular/core';
1220
+ * import {SciMenuService} from '@scion/components/menu';
1221
+ *
1222
+ * inject(SciMenuService).open('menu:contextmenu', {
1223
+ * anchor: {x: 500, y: 600},
1224
+ * width: '500px', // <--- Sets a fixed menu width
1225
+ * maxHeight: '800px', // <--- Sets a maximum menu height
1226
+ * });
1227
+ * ```
1228
+ *
1229
+ * ## Context
1230
+ * A menu can have a context, a key/value map that describes its environment. Contributions can declare a minimal required context and read the menu context.
1231
+ *
1232
+ * A context can be set via the {@link SciMenuOptions.context} option:
1233
+ *
1234
+ * ```ts
1235
+ * import {SciMenuService} from '@scion/components/menu';
1236
+ * import {inject} from '@angular/core';
1237
+ *
1238
+ * inject(SciMenuService).open('menu:contextmenu', {
1239
+ * anchor: {x: 500, y: 600},
1240
+ * context: new Map().set('key', 'value'), // <--- Sets the menu context
1241
+ * });
1242
+ * ```
1243
+ *
1244
+ * ## Accelerators
1245
+ * Menu items can have an accelerator for quick access using a keyboard shortcut.
1246
+ *
1247
+ * Menu accelerators must be installed using the {@link installMenuAccelerators} function, passing the name (and context, if any) of the menu.
1248
+ *
1249
+ * ```ts
1250
+ * import {installMenuAccelerators} from '@scion/components/menu';
1251
+ *
1252
+ * installMenuAccelerators('menu:contextmenu', {
1253
+ * context: new Map().set('key', 'value'), // <--- Sets the menu context
1254
+ * });
1255
+ * ```
1256
+ *
1257
+ * By default, accelerators are installed on the {@link Document}. A different accelerator target can be defined via the {@link SciMenuAcceleratorOptions.target} option.
1258
+ *
1259
+ * ```ts
1260
+ * import {installMenuAccelerators} from '@scion/components/menu';
1261
+ * import {ElementRef, inject} from '@angular/core';
1262
+ *
1263
+ * installMenuAccelerators('menu:contextmenu', {
1264
+ * target: inject(ElementRef), // <--- Sets a different accelerator target
1265
+ * });
1266
+ * ```
1267
+ *
1268
+ * Alternatively, accelerator targets can be provided at the injector level using {@link provideMenuAcceleratorTargetProvider}, for example, at the component, route, or application level,
1269
+ * and are available to accelerators installed in the scope of this injector. Inherited targets can be overridden via {@link SciMenuAcceleratorOptions.target} option.
1270
+ *
1271
+ * @param name - Specifies the name of the menu. Used to look up menu items contributed via the {@link contributeMenu} function.
1272
+ * @param options - Controls the appearance and placement of the menu. At minimum, the menu anchor must be configured to determine where to open the menu.
1273
+ * @returns A reference to the menu, allowing to close the menu or get notified when it is closed.
1274
+ */
1275
+ abstract open(name: `menu:${string}`, options: SciMenuOptions): SciMenuRef;
1276
+ /**
1277
+ * Closes currently opened menus.
1278
+ */
1279
+ abstract closeAll(): void;
1280
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SciMenuService, never>;
1281
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
1282
+ }
1283
+ /**
1284
+ * Controls the appearance and placement of a menu.
1285
+ */
1286
+ interface SciMenuOptions {
1287
+ /**
1288
+ * Controls where to open the menu.
1289
+ *
1290
+ * Can be an HTML element or a coordinate relative to the page viewport.
1291
+ */
1292
+ anchor: HTMLElement | ElementRef<HTMLElement> | SciMenuOrigin | MouseEvent;
1293
+ /**
1294
+ * Specifies a context to describe the environment of the menu.
1295
+ *
1296
+ * Menu contributions may declare a required context. Only contributions matching this context are used.
1297
+ *
1298
+ * A context can also be provided at the injector level using {@link provideMenuContextProvider}, for example, at the component, route, or application level,
1299
+ * and is available to menus opened in the scope of this injector. The inherited context can be overridden or extended. Setting a context entry to `undefined` clears it.
1300
+ *
1301
+ * ```ts
1302
+ * import {provideMenuContextProvider} from '@scion/components/menu';
1303
+ *
1304
+ * providers: [
1305
+ * provideMenuContextProvider(() => new Map().set('key', 'value')),
1306
+ * ];
1307
+ * ```
1308
+ *
1309
+ * @see provideMenuContextProvider
1310
+ */
1311
+ context?: Map<string, unknown>;
1312
+ /**
1313
+ * Controls whether to open the menu below or to the side of the anchor.
1314
+ */
1315
+ align?: 'vertical' | 'horizontal';
1316
+ /**
1317
+ * Sets the distance (in pixels) between the menu and its anchor element along the X and Y axes.
1318
+ *
1319
+ * By default, the menu is aligned flush with the anchor.
1320
+ */
1321
+ offset?: {
1322
+ x?: number;
1323
+ y?: number;
1324
+ };
1325
+ /**
1326
+ * Controls where to insert the menu popover into the DOM.
1327
+ *
1328
+ * By default, the menu popover is inserted after the anchor element, or appended to the HTML body if using a coordinate anchor.
1329
+ */
1330
+ viewContainerRef?: ViewContainerRef;
1331
+ /**
1332
+ * Specifies the preferred menu width.
1333
+ */
1334
+ width?: string;
1335
+ /**
1336
+ * Specifies the preferred minimum menu width.
1337
+ *
1338
+ * Defaults to the `--sci-menu-min-width` or `--sci-menu-submenu-min-width` CSS variables.
1339
+ *
1340
+ * If the anchor is an {@link HTMLElement}, the effective minimum width evaluates to `max(anchorWidth, minWidth)`.
1341
+ */
1342
+ minWidth?: string;
1343
+ /**
1344
+ * Specifies the maximum menu width.
1345
+ */
1346
+ maxWidth?: string;
1347
+ /**
1348
+ * Specifies the maximum menu height.
1349
+ */
1350
+ maxHeight?: string;
1351
+ /**
1352
+ * Enables users to filter menu items.
1353
+ *
1354
+ * Setting a descriptor allows customizing the filter field, such as defining a custom placeholder text or controlling whether the filter field is focused on open.
1355
+ */
1356
+ filter?: boolean | RequireOne<SciMenuFilterConfig>;
1357
+ /**
1358
+ * Specifies CSS classes to associate with the menu.
1359
+ */
1360
+ cssClass?: string | string[];
1361
+ /**
1362
+ * Specifies HTML attributes to associate with the menu.
1363
+ *
1364
+ * Data attributes should start with the `data-` prefix.
1365
+ */
1366
+ attributes?: {
1367
+ [name: string]: string;
1368
+ };
1369
+ }
1370
+ /**
1371
+ * Coordinate relative to the top/left corner of the page viewport.
1372
+ */
1373
+ interface SciMenuOrigin {
1374
+ x: number;
1375
+ y: number;
1376
+ width?: number;
1377
+ height?: number;
1378
+ }
1379
+ /**
1380
+ * Represents a reference to a menu.
1381
+ *
1382
+ * Use to close the menu or get notified when the menu is closed.
1383
+ */
1384
+ interface SciMenuRef {
1385
+ /**
1386
+ * Closes the menu. Has no effect if the menu is already closed.
1387
+ */
1388
+ close(): void;
1389
+ /**
1390
+ * Registers a callback to be notified when the menu is closed.
1391
+ *
1392
+ * If the menu is already closed, the callback is executed immediately.
1393
+ */
1394
+ onClose: (fn: () => void) => void;
1395
+ }
1396
+
1397
+ /**
1398
+ * // TODO [menu] documentation
1399
+ *
1400
+ * @docs-private Not public API. Used by frameworks integrating the SCION Menu API. Applications should not use this service.
1401
+ */
1402
+ declare class ɵSciMenuService implements SciMenuService {
1403
+ private readonly _menuRegistry;
1404
+ private readonly _environmentContext;
1405
+ /** @inheritDoc */
1406
+ open(menu: `menu:${string}` | SciMenuItemLike[], options: SciMenuOptions): SciMenuRef;
1407
+ /** @inheritDoc */
1408
+ closeAll(): void;
1409
+ /**
1410
+ * The function:
1411
+ * - Must be called within an injection context, or an explicit {@link Injector} passed.
1412
+ * - Must be called in a non-reactive (non-tracking) context.
1413
+ *
1414
+ * @docs-private Not public API. Used by frameworks integrating the SCION Menu API. Applications should not use this method.
1415
+ */
1416
+ menuItems(location: MaybeSignal<`menu:${string}` | `toolbar:${string}` | `menubar:${string}`>, context: MaybeSignal<Map<string, unknown>>, options?: {
1417
+ injector?: Injector;
1418
+ metadata?: {
1419
+ [key: string]: unknown;
1420
+ };
1421
+ }): Signal<SciMenuItemLike[]>;
1422
+ /** @docs-private Not public API. Used by frameworks integrating the SCION Menu API. Applications should not use this method. */
1423
+ menuContributions(location: MaybeSignal<`menu:${string}` | `toolbar:${string}` | `menubar:${string}`>, context: MaybeSignal<Map<string, unknown>>, options?: {
1424
+ injector?: Injector;
1425
+ metadata?: {
1426
+ [key: string]: unknown;
1427
+ };
1428
+ }): Signal<SciMenuContribution[]>;
1429
+ /** @docs-private Not public API. Used by frameworks integrating the SCION Menu API. Applications should not use this method. */
1430
+ contributeMenu(location: SciMenuContributionLocationLike, factoryFn: SciMenuFactoryFnLike, options?: SciMenuContributionOptions): Disposable;
1431
+ /**
1432
+ * Gets installed keyboard accelerators for menu items that match the given context.
1433
+ *
1434
+ * A match does not require an identical context. All common context keys must have identical context values.
1435
+ *
1436
+ * Inherits the context from the current injector hierarchy, but can be overridden via `context` options. See {@link provideMenuContextProvider}.
1437
+ *
1438
+ * @docs-private Not public API. Used by frameworks integrating the SCION Menu API. Applications should not use this method.
1439
+ */
1440
+ accelerators(options?: {
1441
+ context?: MaybeSignal<Map<string, unknown>>;
1442
+ }): Signal<SciKeyboardAccelerator[]>;
1443
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ɵSciMenuService, never>;
1444
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
1445
+ }
1446
+
1447
+ /**
1448
+ * Enables integrators to intercept the registration and retrieval of menu contributions and to control where menu popovers open.
1449
+ *
1450
+ * Adapters can handle or augment calls. Multiple adapters form a chain and are called one by one in registration order.
1451
+ *
1452
+ * Calling 'next' passes the call to the next adapter, or to the registry if it is the last adapter in the chain.
1453
+ *
1454
+ * TODO [menu] documentation
1455
+ *
1456
+ * @experimental since 22.3.0; API and behavior may change in any version without notice.
1457
+ */
1458
+ declare abstract class SciMenuAdapter {
1459
+ abstract contributeMenu?(location: SciMenuContributionLocationLike, factoryFn: SciMenuFactoryFnLike, options: SciMenuContributionOptions, next: SciMenuAdapterChain): Disposable;
1460
+ abstract menuContributions?(location: Signal<`menu:${string}` | `toolbar:${string}` | `menubar:${string}`>, context: Signal<Map<string, unknown>>, options: {
1461
+ injector?: Injector;
1462
+ metadata?: {
1463
+ [key: string]: unknown;
1464
+ };
1465
+ }, next: SciMenuAdapterChain): Signal<SciMenuContribution[]>;
1466
+ abstract menuItems?(location: Signal<`menu:${string}` | `toolbar:${string}` | `menubar:${string}`>, context: Signal<Map<string, unknown>>, options: {
1467
+ injector?: Injector;
1468
+ metadata?: {
1469
+ [key: string]: unknown;
1470
+ };
1471
+ }, next: SciMenuAdapterChain): Signal<SciMenuItemLike[]>;
1472
+ abstract openMenu?(menu: `menu:${string}` | SciMenuItemLike[], options: SciMenuOptions, next: SciMenuAdapterChain): SciMenuRef;
1473
+ abstract closeMenus?(next: SciMenuAdapterChain): void;
1474
+ abstract accelerators?(context: Signal<Map<string, unknown>>, next: SciMenuAdapterChain): Signal<SciKeyboardAccelerator[]>;
1475
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SciMenuAdapter, never>;
1476
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
1477
+ }
1478
+ /**
1479
+ * Represents the next adapter in the adapter chain.
1480
+ */
1481
+ interface SciMenuAdapterChain {
1482
+ contributeMenu(location: SciMenuContributionLocationLike, factoryFn: SciMenuFactoryFnLike, options: SciMenuContributionOptions): Disposable;
1483
+ menuContributions(location: Signal<`menu:${string}` | `toolbar:${string}` | `menubar:${string}`>, context: Signal<Map<string, unknown>>, options: {
1484
+ injector?: Injector;
1485
+ metadata?: {
1486
+ [key: string]: unknown;
1487
+ };
1488
+ }): Signal<SciMenuContribution[]>;
1489
+ menuItems(location: Signal<`menu:${string}` | `toolbar:${string}` | `menubar:${string}`>, context: Signal<Map<string, unknown>>, options: {
1490
+ injector?: Injector;
1491
+ metadata?: {
1492
+ [key: string]: unknown;
1493
+ };
1494
+ }): Signal<SciMenuItemLike[]>;
1495
+ openMenu(menu: `menu:${string}` | SciMenuItemLike[], options: SciMenuOptions): SciMenuRef;
1496
+ closeMenus(): void;
1497
+ accelerators(context: Signal<Map<string, unknown>>): Signal<SciKeyboardAccelerator[]>;
1498
+ }
1499
+
1500
+ /**
1501
+ * Contributes tools to a {@link SciToolbarComponent} with the given name.
1502
+ *
1503
+ * A toolbar is a horizontal or vertical container that provides quick access to context-related tools. It can contain buttons, toggles, menus, and other controls,
1504
+ * with related items grouped together.
1505
+ *
1506
+ * The toolbar calls the passed factory function with a {@link SciToolbarFactory}. The factory provides methods for populating the toolbar.
1507
+ * The factory function runs in a reactive context, running again when tracked signals change. It can call `inject` to get required dependencies.
1508
+ *
1509
+ * ```ts
1510
+ * contributeMenu('toolbar:main', (toolbar, context) => toolbar
1511
+ * .addToolbarButton({icon: 'undo', accelerator: {ctrl: true, key: 'Z'}, tooltip: 'Undo', onSelect: () => console.log('Undo')})
1512
+ * .addToolbarButton({icon: 'redo', accelerator: {ctrl: true, key: 'Y'}, tooltip: 'Redo', onSelect: () => console.log('Redo')})
1513
+ * .addGroup(group => group
1514
+ * .addToolbarButton({icon: 'content_copy', accelerator: {ctrl: true, key: 'C'}, tooltip: 'Copy', onSelect: () => console.log('Copy')})
1515
+ * .addToolbarButton({icon: 'content_paste', accelerator: {ctrl: true, key: 'V'}, tooltip: 'Paste', onSelect: () => console.log('Paste')}),
1516
+ * )
1517
+ * .addToolbarMenu({icon: 'folder', tooltip: 'File'}, menu => menu
1518
+ * .addMenuItem({icon: 'save', label: 'Save', accelerator: {ctrl: true, key: 'S'}, onSelect: () => console.log('Save')})
1519
+ * .addMenuItem({icon: 'print', label: 'Print', accelerator: {ctrl: true, key: 'P'}, onSelect: () => console.log('Print')})
1520
+ * .addMenu({icon: 'file_download', label: 'Export As...'}, menu => menu
1521
+ * .addMenuItem({icon: 'picture_as_pdf', label: 'PDF Document', onSelect: () => console.log('PDF Document')})
1522
+ * .addMenuItem({icon: 'table_view', label: 'Excel Spreadsheet', onSelect: () => console.log('Excel Spreadsheet')}),
1523
+ * ),
1524
+ * ),
1525
+ * );
1526
+ * ```
1527
+ *
1528
+ * A toolbar can have a context, a key/value map that describes its environment. The contribution can declare a minimal required context via {@link SciMenuContributionOptions.requiredContext}.
1529
+ * The toolbar context is passed as the second argument to the factory function.
1530
+ *
1531
+ * Multiple contributions to the same toolbar can populate it from different places in the application. Passing a {@link SciToolbarContributionLocation}
1532
+ * gives exact control over contribution placement within the toolbar. By default, toolbar items are added in contribution order.
1533
+ *
1534
+ * Menus and groups can be named to allow extension from other contributions.
1535
+ *
1536
+ * This function must be called within an injection context, or an explicit {@link Injector} passed. The contribution is disposed when the injection context or the passed injector is destroyed.
1537
+ *
1538
+ * @experimental since 22.3.0; API and behavior may change in any version without notice.
1539
+ *
1540
+ * @param location - Identifies the toolbar to contribute to. Passing a {@link SciToolbarContributionLocation} gives exact control over placement.
1541
+ * @param toolbarFactoryFn - Specifies the function to contribute tools to the toolbar. The function is called in a reactive context and can call `inject` to get required dependencies.
1542
+ * @param options - Controls contribution to the toolbar, for example, the minimal required context.
1543
+ * @returns A handle that can be used to manually dispose the contribution. The contribution is disposed automatically when the calling (or passed) injection context is destroyed.
1544
+ */
1545
+ declare function contributeMenu(location: `toolbar:${string}` | SciToolbarContributionLocation, toolbarFactoryFn: SciToolbarFactoryFn, options?: SciMenuContributionOptions): Disposable;
1546
+ /**
1547
+ * Contributes menus to a {@link SciMenubarComponent} with the given name.
1548
+ *
1549
+ * A menubar displays a horizontal row of menus, typically placed at the top of the application.
1550
+ *
1551
+ * The menubar calls the passed factory function with a {@link SciMenubarFactory}. The factory provides methods for populating the menubar.
1552
+ * The factory function runs in a reactive context, running again when tracked signals change. It can call `inject` to get required dependencies.
1553
+ *
1554
+ * TODO [menu] Add example
1555
+ *
1556
+ * A menubar can have a context, a key/value map that describes its environment. The contribution can declare a minimal required context via {@link SciMenuContributionOptions.requiredContext}.
1557
+ * The menubar context is passed as the second argument to the factory function.
1558
+ *
1559
+ * Multiple contributions to the same menubar can populate it from different places in the application. Passing a {@link SciMenubarContributionLocation}
1560
+ * gives exact control over contribution placement within the menubar. By default, menus are added in contribution order.
1561
+ *
1562
+ * Menus and groups can be named to allow extension from other contributions.
1563
+ *
1564
+ * This function must be called within an injection context, or an explicit {@link Injector} passed. The contribution is disposed when the injection context or the passed injector is destroyed.
1565
+ *
1566
+ * @experimental since 22.3.0; API and behavior may change in any version without notice.
1567
+ *
1568
+ * @param location - Identifies the menubar to contribute to. Passing a {@link SciMenubarContributionLocation} gives exact control over placement.
1569
+ * @param menubarFactoryFn - Specifies the function to contribute menus to the menubar. The function is called in a reactive context and can call `inject` to get required dependencies.
1570
+ * @param options - Controls contribution to the menubar, for example, the minimal required context.
1571
+ * @returns A handle that can be used to manually dispose the contribution. The contribution is disposed automatically when the calling (or passed) injection context is destroyed.
1572
+ */
1573
+ declare function contributeMenu(location: `menubar:${string}` | SciMenubarContributionLocation, menubarFactoryFn: SciMenubarFactoryFn, options?: SciMenuContributionOptions): Disposable;
1574
+ /**
1575
+ * Contributes menu items to a menu with the given name.
1576
+ *
1577
+ * A menu displays a list of related items in a popover, organized into groups and submenus.
1578
+ * It closes when a menu item is selected or on an outside click. Menu items can define a keyboard accelerator for quick access.
1579
+ *
1580
+ * The menu calls the passed factory function with a {@link SciMenuFactory}. The factory provides methods for populating the menu.
1581
+ * The factory function runs in a reactive context, running again when tracked signals change. It can call `inject` to get required dependencies.
1582
+ *
1583
+ * TODO [menu] Add example
1584
+ *
1585
+ * A menu can have a context, a key/value map that describes its environment. The contribution can declare a minimal required context via {@link SciMenuContributionOptions.requiredContext}.
1586
+ * The menu context is passed as the second argument to the factory function.
1587
+ *
1588
+ * Multiple contributions to the same menu can populate it from different places in the application. Passing a {@link SciMenuContributionLocation}
1589
+ * gives exact control over contribution placement within the menu. By default, menu items are added in contribution order.
1590
+ *
1591
+ * Menus and groups can be named to allow extension from other contributions.
1592
+ *
1593
+ * This function must be called within an injection context, or an explicit {@link Injector} passed. The contribution is disposed when the injection context or the passed injector is destroyed.
1594
+ *
1595
+ * @experimental since 22.3.0; API and behavior may change in any version without notice.
1596
+ *
1597
+ * @param location - Identifies the menu to contribute to. Passing a {@link SciMenuContributionLocation} gives exact control over placement.
1598
+ * @param menuFactoryFn - Specifies the function to contribute menu items to the menu. The function is called in a reactive context and can call `inject` to get required dependencies.
1599
+ * @param options - Controls contribution to the menu, for example, the minimal required context.
1600
+ * @returns A handle that can be used to manually dispose the contribution. The contribution is disposed automatically when the calling (or passed) injection context is destroyed.
1601
+ */
1602
+ declare function contributeMenu(location: `menu:${string}` | SciMenuContributionLocation, menuFactoryFn: SciMenuFactoryFn, options?: SciMenuContributionOptions): Disposable;
1603
+
1604
+ /**
1605
+ * Displays items contributed via the {@link contributeMenu} function matching the toolbar's name.
1606
+ *
1607
+ * A toolbar is a horizontal or vertical container providing quick access to context-related tools.
1608
+ * It contains buttons, toggles, menus, and other controls, with related items grouped together.
1609
+ *
1610
+ * The toolbar must be assigned a name, used as the location when contributing to the toolbar.
1611
+ * The name must start with the `toolbar:` prefix.
1612
+ *
1613
+ * ```html
1614
+ * <sci-toolbar name="toolbar:main"/>
1615
+ * ```
1616
+ *
1617
+ * Use the {@link contributeMenu} function to contribute to the toolbar by passing the toolbar name and a factory function.
1618
+ * The toolbar calls the factory function with a {@link SciToolbarFactory}, providing methods for populating the toolbar.
1619
+ *
1620
+ * ```ts
1621
+ * import {contributeMenu} from '@scion/components/menu';
1622
+ *
1623
+ * contributeMenu('toolbar:main', toolbar => toolbar
1624
+ * .addToolbarButton({icon: 'undo', accelerator: {ctrl: true, key: 'Z'}, tooltip: 'Undo', onSelect: () => console.log('Undo')})
1625
+ * .addToolbarButton({icon: 'redo', accelerator: {ctrl: true, key: 'Y'}, tooltip: 'Redo', onSelect: () => console.log('Redo')})
1626
+ * .addGroup(group => group
1627
+ * .addToolbarButton({icon: 'content_copy', accelerator: {ctrl: true, key: 'C'}, tooltip: 'Copy', onSelect: () => console.log('Copy')})
1628
+ * .addToolbarButton({icon: 'content_paste', accelerator: {ctrl: true, key: 'V'}, tooltip: 'Paste', onSelect: () => console.log('Paste')}),
1629
+ * )
1630
+ * .addToolbarMenu({icon: 'folder', tooltip: 'File'}, menu => menu
1631
+ * .addMenuItem({icon: 'save', label: 'Save', accelerator: {ctrl: true, key: 'S'}, onSelect: () => console.log('Save')})
1632
+ * .addMenuItem({icon: 'print', label: 'Print', accelerator: {ctrl: true, key: 'P'}, onSelect: () => console.log('Print')})
1633
+ * .addMenu({icon: 'file_download', label: 'Export As...'}, menu => menu
1634
+ * .addMenuItem({icon: 'picture_as_pdf', label: 'PDF Document', onSelect: () => console.log('PDF Document')})
1635
+ * .addMenuItem({icon: 'table_view', label: 'Excel Spreadsheet', onSelect: () => console.log('Excel Spreadsheet')}),
1636
+ * ),
1637
+ * ),
1638
+ * );
1639
+ * ```
1640
+ *
1641
+ * Multiple contributions to the same toolbar can populate it from different places in the application. Passing a {@link SciToolbarContributionLocation}
1642
+ * gives exact control over contribution placement within the toolbar. By default, toolbar items are added in contribution order.
1643
+ *
1644
+ * Menus and groups can be named to allow extension from other contributions.
1645
+ *
1646
+ * ## Context
1647
+ * A toolbar can have a context, a key/value map that describes its environment. Contributions can declare a minimal required context and read the toolbar context.
1648
+ *
1649
+ * A context can be set on the toolbar with the `context` input:
1650
+ *
1651
+ * ```html
1652
+ * <sci-toolbar name="toolbar:main" [context]="..."/>
1653
+ * ```
1654
+ *
1655
+ * ## Accelerator Target
1656
+ * Tools can have an accelerator for quick access using a keyboard shortcut. By default, the toolbar uses the {@link Document} as the accelerator target.
1657
+ *
1658
+ * The accelerator target can be changed via the `acceleratorTarget` input:
1659
+ *
1660
+ * ```html
1661
+ * <sci-toolbar name="toolbar:main" [acceleratorTarget]="..."/>
1662
+ * ```
1663
+ *
1664
+ * ## Toolbar Size
1665
+ * The toolbar size is based on the `--sci-toolbar-item-size` CSS variable and defaults to 16px. It determines the icon size and is used to compute the font size and padding.
1666
+ *
1667
+ * A custom size can be defined globally using the `:root` selector or scoped to a specific toolbar.
1668
+ *
1669
+ * ```css
1670
+ * sci-toolbar {
1671
+ * --sci-toolbar-item-size: 18px;
1672
+ * }
1673
+ * ```
1674
+ *
1675
+ * Instead of computing the font size based on `--sci-toolbar-item-size`, an explicit font size can be defined using the `--sci-toolbar-font-size` CSS variable, either globally or at the toolbar level.
1676
+ *
1677
+ * ```css
1678
+ * sci-toolbar {
1679
+ * --sci-toolbar-font-size: 14px;
1680
+ * }
1681
+ * ```
1682
+ *
1683
+ * ## Hiding an Empty Toolbar
1684
+ * If the toolbar has no tools, it can be hidden using the CSS `:empty` pseudo-class:
1685
+ *
1686
+ * ```css
1687
+ * sci-toolbar:empty {
1688
+ * display: none;
1689
+ * }
1690
+ * ```
1691
+ *
1692
+ * ## Custom Styling
1693
+ * The appearance of the toolbar can be customized using the following CSS variables, either globally in the `:root` or on the toolbar level.
1694
+ *
1695
+ * - `--sci-toolbar-font-size`: Font size of toolbar items.
1696
+ * - `--sci-toolbar-item-size`: Size of toolbar items; used as the toolbar item icon size and to compute font size and padding.
1697
+ * - `--sci-toolbar-item-cursor`: Cursor style when hovering over a toolbar item.
1698
+ * - `--sci-toolbar-item-text-color`: Text and icon color of toolbar items.
1699
+ * - `--sci-toolbar-item-text-color-disabled`: Text and icon color of disabled toolbar items.
1700
+ * - `--sci-toolbar-item-background-color`: Background color of toolbar items.
1701
+ * - `--sci-toolbar-item-background-color-hover`: Background color of a toolbar item when hovered.
1702
+ * - `--sci-toolbar-item-background-color-active`: Background color of a toolbar item when pressed.
1703
+ * - `--sci-toolbar-item-background-color-checked`: Background color of toggled toolbar items.
1704
+ * - `--sci-toolbar-item-border-radius`: Border radius of toolbar items.
1705
+ * - `--sci-toolbar-item-border-color-hover`: Border color of toolbar items when hovered.
1706
+ * - `--sci-toolbar-item-border-color-checked`: Border color of toggled toolbar items.
1707
+ * - `--sci-toolbar-item-outline-width`: Outline width of toolbar items when focused.
1708
+ * - `--sci-toolbar-item-menu-indicator-color`: Color of the menu indicator for toolbar items without a label.
1709
+ * - `--sci-toolbar-item-menu-indicator-color-disabled`: Color of the menu indicator if disabled.
1710
+ * - `--sci-toolbar-item-menu-indicator-size`: Size of the menu indicator.
1711
+ *
1712
+ * @experimental since 22.3.0; API and behavior may change in any version without notice.
1713
+ */
1714
+ declare class SciToolbarComponent {
1715
+ /**
1716
+ * Defines the name of the toolbar. The name must start with the `toolbar:` prefix.
1717
+ *
1718
+ * Use this name to contribute tools to the toolbar using the {@link contributeMenu} function.
1719
+ */
1720
+ readonly name: _angular_core.InputSignal<`toolbar:${string}`>;
1721
+ /**
1722
+ * Specifies the orientation of the toolbar. Defaults to `horizontal`.
1723
+ */
1724
+ readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
1725
+ /**
1726
+ * Specifies a context to describe the environment of the toolbar.
1727
+ *
1728
+ * Toolbar contributions may declare a required context. Only contributions matching this context are used.
1729
+ *
1730
+ * A context can also be provided at the injector level using {@link provideMenuContextProvider}, for example, at the component, route, or application level,
1731
+ * and is available to toolbars used in the scope of this injector. The inherited context can be overridden or extended. Setting a context entry to `undefined` clears it.
1732
+ *
1733
+ * ```ts
1734
+ * import {provideMenuContextProvider} from '@scion/components/menu';
1735
+ *
1736
+ * providers: [
1737
+ * provideMenuContextProvider(() => new Map().set('key', 'value')),
1738
+ * ];
1739
+ * ```
1740
+ *
1741
+ * @see provideMenuContextProvider
1742
+ */
1743
+ readonly context: _angular_core.InputSignal<Map<string, unknown> | undefined>;
1744
+ /**
1745
+ * Specifies the accelerator targets for the toolbar. Defaults to {@link Document}.
1746
+ *
1747
+ * Alternatively, accelerator targets can be provided at the injector level using {@link provideMenuAcceleratorTargetProvider}, for example, at the component, route, or application level,
1748
+ * and are available to toolbars used in the scope of this injector. Inherited targets can be overridden.
1749
+ *
1750
+ * ```ts
1751
+ * import {provideMenuAcceleratorTargetProvider} from '@scion/components/menu';
1752
+ * import {ElementRef, inject} from '@angular/core';
1753
+ *
1754
+ * providers: [
1755
+ * provideMenuAcceleratorTargetProvider(() => inject(ElementRef)),
1756
+ * ];
1757
+ * ```
1758
+ */
1759
+ readonly acceleratorTarget: _angular_core.InputSignal<MaybeArray<Element | ElementRef<Element>> | undefined>;
1760
+ /**
1761
+ * Controls where to attach menu popovers in the DOM. By default, popovers are added as a direct sibling of the toolbar.
1762
+ */
1763
+ readonly popoverViewContainerRef: _angular_core.InputSignal<ViewContainerRef>;
1764
+ /**
1765
+ * Indicates whether any menu within the toolbar is currently open.
1766
+ *
1767
+ * TODO [dwi][API] How to name that metod? Cannot be internal because used by table.
1768
+ */
1769
+ readonly menuOpen: _angular_core.Signal<boolean>;
1770
+ private readonly _environmentContext;
1771
+ private readonly _context;
1772
+ private readonly _virtualToolbarGroupComponent;
1773
+ protected readonly menuItems: _angular_core.Signal<_scion_components_menu.SciMenuItemLike[]>;
1774
+ constructor();
1775
+ /**
1776
+ * Creates and attaches a {@link SciToolbarGroupComponent} using this component as host,
1777
+ * rendering top-level toolbar items and groups as direct children inside `<sci-toolbar/>`.
1778
+ */
1779
+ private attachVirtualToolbarGroup;
1780
+ /**
1781
+ * Installs accelerators of menu items in this toolbar, recursively for menu items in submenus and groups.
1782
+ */
1783
+ private installAccelerators;
1784
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SciToolbarComponent, never>;
1785
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SciToolbarComponent, "sci-toolbar", never, { "name": { "alias": "name"; "required": true; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; "acceleratorTarget": { "alias": "acceleratorTarget"; "required": false; "isSignal": true; }; "popoverViewContainerRef": { "alias": "popoverViewContainerRef"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1786
+ }
1787
+
1788
+ /**
1789
+ * TODO [menu]: Explain how to size the menubar. (height can be set)
1790
+ *
1791
+ * @experimental since 22.3.0; API and behavior may change in any version without notice.
1792
+ */
1793
+ declare class SciMenubarComponent {
1794
+ readonly name: _angular_core.InputSignal<`menubar:${string}`>;
1795
+ readonly context: _angular_core.InputSignal<Map<string, unknown> | undefined>;
1796
+ readonly acceleratorTarget: _angular_core.InputSignal<MaybeArray<Element | ElementRef<Element>> | undefined>;
1797
+ readonly viewContainerRef: _angular_core.InputSignal<ViewContainerRef>;
1798
+ private readonly _environmentContext;
1799
+ private readonly _context;
1800
+ protected readonly menuItems: Signal<SciMenuItem[]>;
1801
+ protected readonly activeMenuItem: _angular_core.WritableSignal<{
1802
+ menuItem: SciMenuItem;
1803
+ element: HTMLElement;
1804
+ closing?: true | "prevented";
1805
+ } | null>;
1806
+ constructor();
1807
+ /**
1808
+ * Method invoked when clicking on a menu item.
1809
+ */
1810
+ protected onMenuItemClick(menuItem: SciMenuItem, element: HTMLElement): void;
1811
+ /**
1812
+ * Method invoked before clicking on a menu item.
1813
+ *
1814
+ * When clicking on the active menu item, mark it as closing to prevent immediate re-opening race condition on subsequent click event.
1815
+ */
1816
+ protected onMenuItemMouseDown(menuItem: SciMenuItem): void;
1817
+ /**
1818
+ * Method invoked when moving the pointer over a menu item.
1819
+ */
1820
+ protected onMenuItemMouseEnter(menuItem: SciMenuItem, element: HTMLElement): void;
1821
+ /**
1822
+ * Method invoked when moving the pointer out of a menu item.
1823
+ */
1824
+ protected onMenuItemMouseLeave(menuItem: SciMenuItem): void;
1825
+ /**
1826
+ * Opens a menu based on {@link activeMenuItem}.
1827
+ */
1828
+ private installMenuOpener;
1829
+ /**
1830
+ * Installs accelerators of menu items in this menubar, recursively for menu items in submenus and groups.
1831
+ */
1832
+ private installAccelerators;
1833
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SciMenubarComponent, never>;
1834
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SciMenubarComponent, "sci-menubar", never, { "name": { "alias": "name"; "required": true; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; "acceleratorTarget": { "alias": "acceleratorTarget"; "required": false; "isSignal": true; }; "viewContainerRef": { "alias": "viewContainerRef"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1835
+ }
1836
+
1837
+ /**
1838
+ * Registers a {@link SciMenuContextProviderFn} to provide context to menu locations and contributions.
1839
+ *
1840
+ * Provided context is applied to menu locations and contributions in the scope of the injector providing this function.
1841
+ * Individual locations and contributions can extend or override the provided context.
1842
+ *
1843
+ * Multiple providers can be registered. Providers at different injector tree levels form a hierarchy.
1844
+ *
1845
+ * @see SciMenuContextProviderFn
1846
+ */
1847
+ declare function provideMenuContextProvider(providerFn: SciMenuContextProviderFn): Provider[];
1848
+ /**
1849
+ * Registers a {@link SciMenuInjectionContextProviderFn} to provide dependency injection tokens for a given menu context.
1850
+ *
1851
+ * Provided tokens are available for dependency injection for contributions registered in the scope of the injector providing this function.
1852
+ * Tokens can be injected in the factory passed to {@link contributeMenu}.
1853
+ *
1854
+ * Multiple providers can be registered. Providers at different injector tree levels form a hierarchy.
1855
+ *
1856
+ * @see SciMenuInjectionContextProviderFn
1857
+ */
1858
+ declare function provideMenuInjectionContextProvider(providerFn: SciMenuInjectionContextProviderFn): Provider[];
1859
+ /**
1860
+ * Registers a {@link SciMenuAcceleratorTargetProviderFn} to provide accelerator targets to menu locations.
1861
+ *
1862
+ * Provided accelerator targets are available to menu locations in the scope of the injector providing this function.
1863
+ * Individual locations can override the provided targets.
1864
+ *
1865
+ * Multiple providers can be registered. Providers at different injector tree levels form a hierarchy.
1866
+ *
1867
+ * @see SciMenuAcceleratorTargetProviderFn
1868
+ */
1869
+ declare function provideMenuAcceleratorTargetProvider(providerFn: SciMenuAcceleratorTargetProviderFn): Provider[];
1870
+ /**
1871
+ * Signature of a function to provide context to menu locations and contributions.
1872
+ *
1873
+ * A menu location is a toolbar, menubar, or menu. A location or contribution can have a context (`Map`)
1874
+ * describing its environment. A contribution is eligible for a location only if the location's context fully
1875
+ * contains the contribution's context.
1876
+ *
1877
+ * Register this provider using the {@link provideMenuContextProvider} function.
1878
+ *
1879
+ * The function can call `inject` to get dependencies from the injector providing this function.
1880
+ *
1881
+ * @param callingInjector - Use to inject dependencies from the injector calling this function, e.g., the injector of the menu location.
1882
+ */
1883
+ type SciMenuContextProviderFn = (callingInjector: Injector) => MaybeSignal<Map<string, unknown> | undefined>;
1884
+ /**
1885
+ * Signature of a function to provide dependency injection tokens for a given menu context.
1886
+ *
1887
+ * The passed menu context is the context of a menu location (toolbar, menubar, or menu) describing its environment.
1888
+ * Returned tokens are available for dependency injection in the menu factory passed to {@link contributeMenu}.
1889
+ *
1890
+ * Register this provider using the {@link provideMenuInjectionContextProvider} function.
1891
+ *
1892
+ * The function can call `inject` to get any required dependencies.
1893
+ */
1894
+ type SciMenuInjectionContextProviderFn = (context: Map<string, unknown>) => Provider[];
1895
+ /**
1896
+ * Signature of a function to provide accelerator targets to menu locations.
1897
+ *
1898
+ * An accelerator target is a DOM element on which a menu location (toolbar, menubar, or menu) listens
1899
+ * for keyboard events for accelerators configured on menu items.
1900
+ *
1901
+ * Register this provider using the {@link provideMenuAcceleratorTargetProvider} function.
1902
+ *
1903
+ * The function can call `inject` to get dependencies from the injector providing this function.
1904
+ *
1905
+ * @param callingInjector - Use to inject dependencies from the injector calling this function, e.g., the injector of the menu location.
1906
+ */
1907
+ type SciMenuAcceleratorTargetProviderFn = (callingInjector: Injector) => MaybeSignal<MaybeArray<Element | ElementRef<Element>> | undefined>;
1908
+
1909
+ /**
1910
+ * Injects dependency injection providers of the given menu context based on the current injection context.
1911
+ *
1912
+ * Must be called within an injection context, or an explicit {@link Injector} passed.
1913
+ *
1914
+ * @see provideMenuInjectionContextProvider
1915
+ * @docs-private Not public API. Used by frameworks integrating the SCION Menu API. Applications should not use this function.
1916
+ */
1917
+ declare function injectMenuInjectionContextProviders(menuContext: Map<string, unknown>, options?: {
1918
+ injector?: Injector;
1919
+ }): Provider[];
1920
+
1921
+ export { SciMenuAdapter, SciMenuService, SciMenubarComponent, SciToolbarComponent, contributeMenu, installMenuAccelerators, provideMenuAcceleratorTargetProvider, provideMenuContextProvider, provideMenuInjectionContextProvider, ɵSciMenuService, injectMenuInjectionContextProviders as ɵinjectMenuInjectionContextProviders };
1922
+ export type { SciKeyboardAccelerator, SciMenuAcceleratorOptions, SciMenuAcceleratorTargetProviderFn, SciMenuAdapterChain, SciMenuContextProviderFn, SciMenuContribution, SciMenuContributionLocation, SciMenuContributionLocationLike, SciMenuContributionOptions, SciMenuContributionPosition, SciMenuContributionPositionLike, SciMenuDescriptor, SciMenuFactory, SciMenuFactoryFn, SciMenuFactoryFnLike, SciMenuFilterConfig, SciMenuGroup, SciMenuGroupDescriptor, SciMenuInjectionContextProviderFn, SciMenuItem, SciMenuItemDescriptor, SciMenuItemLike, SciMenuOptions, SciMenuOrigin, SciMenuRef, SciMenubarContributionLocation, SciMenubarContributionPosition, SciMenubarFactory, SciMenubarFactoryFn, SciMenubarMenuDescriptor, SciToolbarButtonDescriptor, SciToolbarContributionLocation, SciToolbarContributionPosition, SciToolbarControlDescriptor, SciToolbarFactory, SciToolbarFactoryFn, SciToolbarGroupDescriptor, SciToolbarMenuDescriptor };