@tolle_/tolle-ui 18.2.28 → 18.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/accordion-item.component.mjs +5 -11
- package/esm2022/lib/accordion.component.mjs +4 -9
- package/esm2022/lib/alert-dialog-dynamic.component.mjs +5 -10
- package/esm2022/lib/alert-dialog.component.mjs +44 -59
- package/esm2022/lib/alert.component.mjs +5 -11
- package/esm2022/lib/aspect-ratio.component.mjs +119 -0
- package/esm2022/lib/attachment.component.mjs +334 -0
- package/esm2022/lib/avatar-fallback.component.mjs +3 -3
- package/esm2022/lib/avatar.component.mjs +4 -9
- package/esm2022/lib/badge.component.mjs +4 -9
- package/esm2022/lib/breadcrumb-item.component.mjs +3 -3
- package/esm2022/lib/breadcrumb-link.component.mjs +3 -3
- package/esm2022/lib/breadcrumb-separator.component.mjs +3 -3
- package/esm2022/lib/breadcrumb.component.mjs +3 -3
- package/esm2022/lib/bubble.component.mjs +301 -0
- package/esm2022/lib/button.component.mjs +5 -11
- package/esm2022/lib/calendar.component.mjs +5 -11
- package/esm2022/lib/card.component.mjs +14 -43
- package/esm2022/lib/carousel/carousel.component.mjs +5 -12
- package/esm2022/lib/chain-of-thought.component.mjs +380 -0
- package/esm2022/lib/chart-pie.component.mjs +386 -0
- package/esm2022/lib/chart.component.mjs +1146 -0
- package/esm2022/lib/chart.service.mjs +555 -0
- package/esm2022/lib/checkbox.component.mjs +5 -11
- package/esm2022/lib/checkpoint.component.mjs +134 -0
- package/esm2022/lib/collapsible.component.mjs +4 -11
- package/esm2022/lib/combobox.component.mjs +372 -0
- package/esm2022/lib/command-dialog.component.mjs +164 -0
- package/esm2022/lib/command.component.mjs +514 -0
- package/esm2022/lib/command.service.mjs +130 -0
- package/esm2022/lib/confirmation.component.mjs +219 -0
- package/esm2022/lib/context-menu-trigger.directive.mjs +36 -0
- package/esm2022/lib/context-menu.component.mjs +460 -0
- package/esm2022/lib/context-menu.service.mjs +121 -0
- package/esm2022/lib/context.component.mjs +377 -0
- package/esm2022/lib/conversation.component.mjs +442 -0
- package/esm2022/lib/country-selector.component.mjs +5 -11
- package/esm2022/lib/data-table.component.mjs +63 -12
- package/esm2022/lib/date-picker.component.mjs +251 -198
- package/esm2022/lib/date-range-picker.component.mjs +224 -116
- package/esm2022/lib/date-time-picker.component.mjs +506 -0
- package/esm2022/lib/direction.component.mjs +79 -0
- package/esm2022/lib/dropdown-item.component.mjs +3 -3
- package/esm2022/lib/dropdown-label.component.mjs +3 -3
- package/esm2022/lib/dropdown-menu.component.mjs +3 -3
- package/esm2022/lib/dropdown-separator.component.mjs +3 -3
- package/esm2022/lib/dropdown-trigger.directive.mjs +6 -4
- package/esm2022/lib/empty-state.component.mjs +4 -9
- package/esm2022/lib/field.component.mjs +394 -0
- package/esm2022/lib/hover-card.component.mjs +6 -16
- package/esm2022/lib/inline-citation.component.mjs +263 -0
- package/esm2022/lib/input-group.component.mjs +418 -0
- package/esm2022/lib/input.component.mjs +5 -11
- package/esm2022/lib/item.component.mjs +243 -0
- package/esm2022/lib/kbd.component.mjs +82 -0
- package/esm2022/lib/label.component.mjs +4 -9
- package/esm2022/lib/marker.component.mjs +135 -0
- package/esm2022/lib/masked-input.component.mjs +5 -11
- package/esm2022/lib/menubar.component.mjs +683 -0
- package/esm2022/lib/message-scroller.component.mjs +353 -0
- package/esm2022/lib/message-scroller.service.mjs +157 -0
- package/esm2022/lib/message.component.mjs +228 -0
- package/esm2022/lib/model-selector.component.mjs +310 -0
- package/esm2022/lib/multi-select.component.mjs +155 -72
- package/esm2022/lib/native-select.component.mjs +201 -0
- package/esm2022/lib/navigation-menu.component.mjs +642 -0
- package/esm2022/lib/otp-group.component.mjs +3 -3
- package/esm2022/lib/otp-slot.component.mjs +4 -9
- package/esm2022/lib/otp.component.mjs +5 -11
- package/esm2022/lib/pagination.component.mjs +7 -10
- package/esm2022/lib/plan.component.mjs +335 -0
- package/esm2022/lib/popover-content.component.mjs +4 -9
- package/esm2022/lib/popover.component.mjs +15 -13
- package/esm2022/lib/progress.component.mjs +4 -9
- package/esm2022/lib/prompt-input.component.mjs +526 -0
- package/esm2022/lib/queue.component.mjs +280 -0
- package/esm2022/lib/radio-group.component.mjs +6 -13
- package/esm2022/lib/radio-item.component.mjs +4 -9
- package/esm2022/lib/range-calendar.component.mjs +5 -11
- package/esm2022/lib/reasoning.component.mjs +335 -0
- package/esm2022/lib/resizable.component.mjs +219 -0
- package/esm2022/lib/segment.component.mjs +17 -7
- package/esm2022/lib/select-group.component.mjs +4 -8
- package/esm2022/lib/select-item.component.mjs +4 -9
- package/esm2022/lib/select-separator.component.mjs +4 -8
- package/esm2022/lib/select.component.mjs +133 -49
- package/esm2022/lib/separator.component.mjs +4 -9
- package/esm2022/lib/sheet.component.mjs +38 -56
- package/esm2022/lib/shimmer.component.mjs +84 -0
- package/esm2022/lib/sidebar.component.mjs +11 -1
- package/esm2022/lib/skeleton.component.mjs +4 -9
- package/esm2022/lib/sources.component.mjs +452 -0
- package/esm2022/lib/spinner.component.mjs +68 -0
- package/esm2022/lib/suggestion.component.mjs +207 -0
- package/esm2022/lib/switch.component.mjs +5 -11
- package/esm2022/lib/table.component.mjs +213 -0
- package/esm2022/lib/tabs.component.mjs +4 -11
- package/esm2022/lib/tag-input.component.mjs +5 -11
- package/esm2022/lib/task.component.mjs +359 -0
- package/esm2022/lib/textarea.component.mjs +5 -11
- package/esm2022/lib/theme.service.mjs +17 -6
- package/esm2022/lib/time-picker.component.mjs +923 -0
- package/esm2022/lib/toast.service.mjs +3 -2
- package/esm2022/lib/toaster.component.mjs +76 -39
- package/esm2022/lib/toggle-group.component.mjs +4 -9
- package/esm2022/lib/toggle.component.mjs +5 -11
- package/esm2022/lib/tool.component.mjs +462 -0
- package/esm2022/lib/typography.component.mjs +83 -0
- package/esm2022/lib/utils/color.mjs +140 -19
- package/esm2022/public-api.mjs +61 -1
- package/fesm2022/tolle-ui.mjs +16457 -1024
- package/fesm2022/tolle-ui.mjs.map +1 -1
- package/lib/alert-dialog.component.d.ts +10 -2
- package/lib/aspect-ratio.component.d.ts +20 -0
- package/lib/attachment.component.d.ts +101 -0
- package/lib/bubble.component.d.ts +112 -0
- package/lib/chain-of-thought.component.d.ts +166 -0
- package/lib/chart-pie.component.d.ts +108 -0
- package/lib/chart.component.d.ts +369 -0
- package/lib/chart.service.d.ts +222 -0
- package/lib/checkpoint.component.d.ts +51 -0
- package/lib/combobox.component.d.ts +90 -0
- package/lib/command-dialog.component.d.ts +53 -0
- package/lib/command.component.d.ts +189 -0
- package/lib/command.service.d.ts +67 -0
- package/lib/confirmation.component.d.ts +70 -0
- package/lib/context-menu-trigger.directive.d.ts +12 -0
- package/lib/context-menu.component.d.ts +41 -0
- package/lib/context-menu.service.d.ts +38 -0
- package/lib/context.component.d.ts +134 -0
- package/lib/conversation.component.d.ts +165 -0
- package/lib/data-table.component.d.ts +27 -1
- package/lib/date-picker.component.d.ts +72 -11
- package/lib/date-range-picker.component.d.ts +63 -6
- package/lib/date-time-picker.component.d.ts +119 -0
- package/lib/direction.component.d.ts +45 -0
- package/lib/field.component.d.ts +201 -0
- package/lib/inline-citation.component.d.ts +103 -0
- package/lib/input-group.component.d.ts +150 -0
- package/lib/item.component.d.ts +154 -0
- package/lib/kbd.component.d.ts +50 -0
- package/lib/marker.component.d.ts +58 -0
- package/lib/menubar.component.d.ts +247 -0
- package/lib/message-scroller.component.d.ts +159 -0
- package/lib/message-scroller.service.d.ts +73 -0
- package/lib/message.component.d.ts +128 -0
- package/lib/model-selector.component.d.ts +103 -0
- package/lib/multi-select.component.d.ts +66 -14
- package/lib/native-select.component.d.ts +57 -0
- package/lib/navigation-menu.component.d.ts +230 -0
- package/lib/plan.component.d.ts +120 -0
- package/lib/popover.component.d.ts +1 -0
- package/lib/prompt-input.component.d.ts +194 -0
- package/lib/queue.component.d.ts +106 -0
- package/lib/reasoning.component.d.ts +127 -0
- package/lib/resizable.component.d.ts +43 -0
- package/lib/segment.component.d.ts +13 -3
- package/lib/select.component.d.ts +37 -5
- package/lib/sheet.component.d.ts +3 -0
- package/lib/shimmer.component.d.ts +38 -0
- package/lib/sidebar.component.d.ts +2 -0
- package/lib/sources.component.d.ts +156 -0
- package/lib/spinner.component.d.ts +29 -0
- package/lib/suggestion.component.d.ts +96 -0
- package/lib/table.component.d.ts +106 -0
- package/lib/task.component.d.ts +151 -0
- package/lib/theme.service.d.ts +9 -0
- package/lib/time-picker.component.d.ts +243 -0
- package/lib/toast.service.d.ts +3 -1
- package/lib/toaster.component.d.ts +26 -9
- package/lib/tool.component.d.ts +158 -0
- package/lib/typography.component.d.ts +32 -0
- package/lib/utils/color.d.ts +19 -5
- package/package.json +1 -1
- package/public-api.d.ts +50 -0
- package/registry/docs-content.json +8497 -1553
- package/registry/llms-full.txt +2679 -318
- package/registry/llms.txt +43 -4
- package/registry/manifest.json +9093 -1739
- package/registry/r/accordion-item.json +1 -1
- package/registry/r/accordion.json +1 -1
- package/registry/r/alert-dialog-dynamic.json +1 -1
- package/registry/r/alert-dialog.json +1 -1
- package/registry/r/alert.json +1 -1
- package/registry/r/attachment.json +23 -0
- package/registry/r/avatar-fallback.json +1 -1
- package/registry/r/avatar.json +1 -1
- package/registry/r/badge.json +1 -1
- package/registry/r/breadcrumb-item.json +1 -1
- package/registry/r/breadcrumb-link.json +1 -1
- package/registry/r/breadcrumb-separator.json +1 -1
- package/registry/r/breadcrumb.json +1 -1
- package/registry/r/bubble.json +23 -0
- package/registry/r/button.json +1 -1
- package/registry/r/calendar.json +1 -1
- package/registry/r/card.json +1 -1
- package/registry/r/carousel.json +1 -1
- package/registry/r/chain-of-thought.json +23 -0
- package/registry/r/chart-pie.json +30 -0
- package/registry/r/chart.json +28 -0
- package/registry/r/checkbox.json +1 -1
- package/registry/r/checkpoint.json +23 -0
- package/registry/r/collapsible.json +1 -1
- package/registry/r/combobox.json +31 -0
- package/registry/r/command-dialog.json +21 -0
- package/registry/r/command.json +26 -0
- package/registry/r/confirmation.json +23 -0
- package/registry/r/context.json +26 -0
- package/registry/r/conversation.json +23 -0
- package/registry/r/country-selector.json +1 -1
- package/registry/r/data-table.json +1 -1
- package/registry/r/date-picker.json +4 -4
- package/registry/r/date-range-picker.json +3 -3
- package/registry/r/date-time-picker.json +28 -0
- package/registry/r/direction.json +16 -0
- package/registry/r/dropdown-item.json +1 -1
- package/registry/r/dropdown-label.json +1 -1
- package/registry/r/dropdown-menu.json +1 -1
- package/registry/r/dropdown-separator.json +1 -1
- package/registry/r/dropdown-trigger.json +1 -1
- package/registry/r/empty-state.json +1 -1
- package/registry/r/field.json +23 -0
- package/registry/r/hover-card.json +1 -1
- package/registry/r/inline-citation.json +26 -0
- package/registry/r/input-group.json +23 -0
- package/registry/r/input.json +1 -1
- package/registry/r/item.json +23 -0
- package/registry/r/kbd.json +23 -0
- package/registry/r/label.json +1 -1
- package/registry/r/marker.json +23 -0
- package/registry/r/masked-input.json +1 -1
- package/registry/r/menubar.json +24 -0
- package/registry/r/message-scroller.json +26 -0
- package/registry/r/message.json +23 -0
- package/registry/r/model-selector.json +32 -0
- package/registry/r/multi-select.json +2 -2
- package/registry/r/native-select.json +23 -0
- package/registry/r/navigation-menu.json +24 -0
- package/registry/r/otp-group.json +1 -1
- package/registry/r/otp-slot.json +1 -1
- package/registry/r/otp.json +1 -1
- package/registry/r/pagination.json +3 -2
- package/registry/r/plan.json +23 -0
- package/registry/r/popover-content.json +1 -1
- package/registry/r/popover.json +1 -1
- package/registry/r/progress.json +1 -1
- package/registry/r/prompt-input.json +23 -0
- package/registry/r/queue.json +23 -0
- package/registry/r/radio-group.json +1 -1
- package/registry/r/radio-item.json +1 -1
- package/registry/r/range-calendar.json +1 -1
- package/registry/r/reasoning.json +23 -0
- package/registry/r/segment.json +1 -1
- package/registry/r/select-group.json +1 -1
- package/registry/r/select-item.json +1 -1
- package/registry/r/select-separator.json +1 -1
- package/registry/r/select.json +4 -3
- package/registry/r/separator.json +1 -1
- package/registry/r/sheet.json +1 -1
- package/registry/r/shimmer.json +23 -0
- package/registry/r/sidebar.json +1 -1
- package/registry/r/skeleton.json +1 -1
- package/registry/r/sources.json +23 -0
- package/registry/r/spinner.json +23 -0
- package/registry/r/suggestion.json +23 -0
- package/registry/r/switch.json +1 -1
- package/registry/r/table.json +21 -0
- package/registry/r/tabs.json +1 -1
- package/registry/r/tag-input.json +1 -1
- package/registry/r/task.json +23 -0
- package/registry/r/textarea.json +1 -1
- package/registry/r/time-picker.json +24 -0
- package/registry/r/toaster.json +2 -2
- package/registry/r/toggle-group.json +1 -1
- package/registry/r/toggle.json +1 -1
- package/registry/r/tool.json +23 -0
- package/registry/r/typography.json +23 -0
- package/registry/registry.json +915 -22
- package/theme.css +109 -8
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { EventEmitter, ElementRef, ChangeDetectorRef, OnDestroy } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { cn } from './utils/cn';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
declare const comboboxTriggerVariants: (props?: ({
|
|
7
|
+
size?: "default" | "xs" | "sm" | "lg" | null | undefined;
|
|
8
|
+
invalid?: boolean | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export type ComboboxProps = VariantProps<typeof comboboxTriggerVariants>;
|
|
11
|
+
export type ComboboxOption = {
|
|
12
|
+
label: string;
|
|
13
|
+
value: any;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Extra terms that should also match this option when searching. */
|
|
16
|
+
keywords?: string[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A searchable single-select: a button that opens a `tolle-command` list in a
|
|
20
|
+
* floating panel. Implements `ControlValueAccessor`, so it works with
|
|
21
|
+
* `ngModel` and reactive forms.
|
|
22
|
+
*
|
|
23
|
+
* Use `tolle-select` when the list is short and needs no search, and
|
|
24
|
+
* `tolle-multi-select` when more than one value can be chosen.
|
|
25
|
+
* @new
|
|
26
|
+
*/
|
|
27
|
+
export declare class ComboboxComponent implements ControlValueAccessor, OnDestroy {
|
|
28
|
+
private cdr;
|
|
29
|
+
/** Options to choose from. @default [] */
|
|
30
|
+
options: ComboboxOption[];
|
|
31
|
+
/** Text shown on the trigger when nothing is selected. @default 'Select an option…' */
|
|
32
|
+
placeholder: string;
|
|
33
|
+
/** Placeholder inside the search box. @default 'Search…' */
|
|
34
|
+
searchPlaceholder: string;
|
|
35
|
+
/** Message shown when the query matches no option. @default 'No results found.' */
|
|
36
|
+
emptyMessage: string;
|
|
37
|
+
/** Height and text size of the trigger. @default 'default' */
|
|
38
|
+
size: ComboboxProps['size'];
|
|
39
|
+
/** Applies the destructive border and focus ring. @default false */
|
|
40
|
+
invalid: boolean;
|
|
41
|
+
/** Disables the control. @default false */
|
|
42
|
+
disabled: boolean;
|
|
43
|
+
/** Set false to filter the options yourself, e.g. server-side. @default true */
|
|
44
|
+
shouldFilter: boolean;
|
|
45
|
+
/** Close the panel after a value is chosen. @default true */
|
|
46
|
+
closeOnSelect: boolean;
|
|
47
|
+
/** Where the panel opens relative to the trigger. @default 'bottom-start' */
|
|
48
|
+
placement: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
|
|
49
|
+
/** Accessible name when there is no associated visible label. @default '' */
|
|
50
|
+
ariaLabel: string;
|
|
51
|
+
/** Extra Tailwind classes merged onto the trigger via `cn()` (last-wins). */
|
|
52
|
+
class: string;
|
|
53
|
+
/** Emitted with the chosen value whenever the selection changes. */
|
|
54
|
+
valueChange: EventEmitter<any>;
|
|
55
|
+
/** Emitted with the query text as the user searches. */
|
|
56
|
+
searchChange: EventEmitter<string>;
|
|
57
|
+
/** Emitted when the panel opens. */
|
|
58
|
+
opened: EventEmitter<void>;
|
|
59
|
+
/** Emitted when the panel closes. */
|
|
60
|
+
closed: EventEmitter<void>;
|
|
61
|
+
triggerEl?: ElementRef<HTMLElement>;
|
|
62
|
+
panelEl?: ElementRef<HTMLElement>;
|
|
63
|
+
readonly panelId: string;
|
|
64
|
+
value: any;
|
|
65
|
+
isOpen: boolean;
|
|
66
|
+
protected cn: typeof cn;
|
|
67
|
+
private cleanup?;
|
|
68
|
+
private onChange;
|
|
69
|
+
private onTouched;
|
|
70
|
+
constructor(cdr: ChangeDetectorRef);
|
|
71
|
+
private readonly outsideClickHandler;
|
|
72
|
+
private readonly escapeHandler;
|
|
73
|
+
get selectedLabel(): string;
|
|
74
|
+
get computedTriggerClass(): string;
|
|
75
|
+
toggle(): void;
|
|
76
|
+
open(): void;
|
|
77
|
+
close(): void;
|
|
78
|
+
onTriggerKeyDown(event: KeyboardEvent): void;
|
|
79
|
+
onSelect(value: any): void;
|
|
80
|
+
private updatePosition;
|
|
81
|
+
private teardown;
|
|
82
|
+
ngOnDestroy(): void;
|
|
83
|
+
writeValue(value: any): void;
|
|
84
|
+
registerOnChange(fn: (value: any) => void): void;
|
|
85
|
+
registerOnTouched(fn: () => void): void;
|
|
86
|
+
setDisabledState(isDisabled: boolean): void;
|
|
87
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComboboxComponent, never>;
|
|
88
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComboboxComponent, "tolle-combobox", never, { "options": { "alias": "options"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; }; "size": { "alias": "size"; "required": false; }; "invalid": { "alias": "invalid"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "shouldFilter": { "alias": "shouldFilter"; "required": false; }; "closeOnSelect": { "alias": "closeOnSelect"; "required": false; }; "placement": { "alias": "placement"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, { "valueChange": "valueChange"; "searchChange": "searchChange"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { EventEmitter, ElementRef, OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
|
|
2
|
+
import { cn } from './utils/cn';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* The ⌘K command palette: a `tolle-command` in a centred modal overlay.
|
|
6
|
+
*
|
|
7
|
+
* Project a full command menu inside:
|
|
8
|
+
*
|
|
9
|
+
* ```html
|
|
10
|
+
* <tolle-command-dialog [(open)]="paletteOpen">
|
|
11
|
+
* <tolle-command (selected)="run($event)">
|
|
12
|
+
* <tolle-command-input></tolle-command-input>
|
|
13
|
+
* <tolle-command-list>…</tolle-command-list>
|
|
14
|
+
* </tolle-command>
|
|
15
|
+
* </tolle-command-dialog>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Set `shortcut` to bind a global hotkey (default ⌘K / Ctrl+K).
|
|
19
|
+
* @new
|
|
20
|
+
*/
|
|
21
|
+
export declare class CommandDialogComponent implements OnInit, OnDestroy {
|
|
22
|
+
private cdr;
|
|
23
|
+
/** Whether the palette is visible. Supports two-way binding via `[(open)]`. @default false */
|
|
24
|
+
open: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Global hotkey that toggles the palette, as `mod+key` where `mod` maps to ⌘
|
|
27
|
+
* on macOS and Ctrl elsewhere. Set to `''` to disable the binding.
|
|
28
|
+
* @default 'mod+k'
|
|
29
|
+
*/
|
|
30
|
+
shortcut: string;
|
|
31
|
+
/** Close the palette when the backdrop is clicked. @default true */
|
|
32
|
+
closeOnBackdrop: boolean;
|
|
33
|
+
/** Accessible name for the dialog. @default 'Command palette' */
|
|
34
|
+
ariaLabel: string;
|
|
35
|
+
/** Extra Tailwind classes merged onto the panel via `cn()` (last-wins). */
|
|
36
|
+
class: string;
|
|
37
|
+
/** Two-way binding partner for `open`. */
|
|
38
|
+
openChange: EventEmitter<boolean>;
|
|
39
|
+
/** Emitted when the palette opens. */
|
|
40
|
+
opened: EventEmitter<void>;
|
|
41
|
+
/** Emitted when the palette closes. */
|
|
42
|
+
closed: EventEmitter<void>;
|
|
43
|
+
panelEl?: ElementRef<HTMLElement>;
|
|
44
|
+
protected cn: typeof cn;
|
|
45
|
+
constructor(cdr: ChangeDetectorRef);
|
|
46
|
+
private readonly onKeyDown;
|
|
47
|
+
ngOnInit(): void;
|
|
48
|
+
ngOnDestroy(): void;
|
|
49
|
+
onBackdropClick(): void;
|
|
50
|
+
private setOpen;
|
|
51
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommandDialogComponent, never>;
|
|
52
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommandDialogComponent, "tolle-command-dialog", never, { "open": { "alias": "open"; "required": false; }; "shortcut": { "alias": "shortcut"; "required": false; }; "closeOnBackdrop": { "alias": "closeOnBackdrop"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, { "openChange": "openChange"; "opened": "opened"; "closed": "closed"; }, never, ["*"], true, never>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { EventEmitter, OnInit, OnChanges, OnDestroy } from '@angular/core';
|
|
2
|
+
import { cn } from './utils/cn';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* A filterable command menu — the list half of a command palette (⌘K),
|
|
6
|
+
* a searchable dropdown, or an inline action list.
|
|
7
|
+
*
|
|
8
|
+
* Compose it from `tolle-command-input`, `tolle-command-list`,
|
|
9
|
+
* `tolle-command-group`, `tolle-command-item` and `tolle-command-empty`.
|
|
10
|
+
* Filtering, keyboard navigation and `aria-activedescendant` are handled for
|
|
11
|
+
* you by the `CommandService` this component provides.
|
|
12
|
+
*
|
|
13
|
+
* For the ⌘K modal version use `tolle-command-dialog`; for a form control use
|
|
14
|
+
* `tolle-combobox`.
|
|
15
|
+
* @new
|
|
16
|
+
*/
|
|
17
|
+
export declare class CommandComponent implements OnInit, OnChanges, OnDestroy {
|
|
18
|
+
/**
|
|
19
|
+
* Set false to keep every item visible and filter the list yourself —
|
|
20
|
+
* for server-side or fuzzy search. @default true
|
|
21
|
+
*/
|
|
22
|
+
shouldFilter: boolean;
|
|
23
|
+
/** Accessible name for the command menu. @default '' */
|
|
24
|
+
ariaLabel: string;
|
|
25
|
+
/** Extra Tailwind classes merged onto the menu via `cn()` (last-wins). */
|
|
26
|
+
class: string;
|
|
27
|
+
/** Emitted with the chosen item's `value` when the user selects one. */
|
|
28
|
+
selected: EventEmitter<any>;
|
|
29
|
+
/** Emitted with the query text whenever the search input changes. */
|
|
30
|
+
queryChange: EventEmitter<string>;
|
|
31
|
+
private readonly service;
|
|
32
|
+
private readonly subscriptions;
|
|
33
|
+
ngOnInit(): void;
|
|
34
|
+
ngOnChanges(): void;
|
|
35
|
+
ngOnDestroy(): void;
|
|
36
|
+
get computedClass(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Menu-level keyboard handling, so the arrows work whether focus is in the
|
|
39
|
+
* search input or on the menu itself.
|
|
40
|
+
*/
|
|
41
|
+
onKeyDown(event: KeyboardEvent): void;
|
|
42
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommandComponent, never>;
|
|
43
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommandComponent, "tolle-command", never, { "shouldFilter": { "alias": "shouldFilter"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, { "selected": "selected"; "queryChange": "queryChange"; }, never, ["*"], true, never>;
|
|
44
|
+
}
|
|
45
|
+
/** Search box for a `tolle-command`. Typing here drives the filtering. */
|
|
46
|
+
export declare class CommandInputComponent implements OnInit, OnDestroy {
|
|
47
|
+
/** Placeholder shown when the query is empty. @default 'Type a command or search…' */
|
|
48
|
+
placeholder: string;
|
|
49
|
+
/** Accessible name for the search box. @default '' */
|
|
50
|
+
ariaLabel: string;
|
|
51
|
+
/** Extra Tailwind classes merged onto the search row via `cn()` (last-wins). */
|
|
52
|
+
class: string;
|
|
53
|
+
/** Extra Tailwind classes merged onto the `<input>` itself via `cn()` (last-wins). */
|
|
54
|
+
inputClass: string;
|
|
55
|
+
private readonly service;
|
|
56
|
+
private readonly subscriptions;
|
|
57
|
+
private readonly cdr;
|
|
58
|
+
value: string;
|
|
59
|
+
activeId: string | null;
|
|
60
|
+
protected cn: typeof cn;
|
|
61
|
+
ngOnInit(): void;
|
|
62
|
+
ngOnDestroy(): void;
|
|
63
|
+
onInput(event: Event): void;
|
|
64
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommandInputComponent, never>;
|
|
65
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommandInputComponent, "tolle-command-input", never, { "placeholder": { "alias": "placeholder"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "class": { "alias": "class"; "required": false; }; "inputClass": { "alias": "inputClass"; "required": false; }; }, {}, never, never, true, never>;
|
|
66
|
+
}
|
|
67
|
+
/** Scrolling container for the command items. */
|
|
68
|
+
export declare class CommandListComponent implements OnChanges {
|
|
69
|
+
private readonly cdr;
|
|
70
|
+
/**
|
|
71
|
+
* Angular writes a bound `class` input through its styling path, which does
|
|
72
|
+
* not mark an OnPush component dirty — without this hook the component keeps
|
|
73
|
+
* rendering the class it was born with.
|
|
74
|
+
*/
|
|
75
|
+
ngOnChanges(): void;
|
|
76
|
+
/** Accessible name for the list. @default '' */
|
|
77
|
+
ariaLabel: string;
|
|
78
|
+
/** Extra Tailwind classes merged onto the list via `cn()` (last-wins). */
|
|
79
|
+
class: string;
|
|
80
|
+
protected cn: typeof cn;
|
|
81
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommandListComponent, never>;
|
|
82
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommandListComponent, "tolle-command-list", never, { "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Shown only when the query matches nothing. Renders nothing otherwise, so it
|
|
86
|
+
* can live in the template permanently.
|
|
87
|
+
*/
|
|
88
|
+
export declare class CommandEmptyComponent implements OnInit, OnDestroy {
|
|
89
|
+
/** Extra Tailwind classes merged onto the empty state via `cn()` (last-wins). */
|
|
90
|
+
class: string;
|
|
91
|
+
private readonly service;
|
|
92
|
+
private readonly subscriptions;
|
|
93
|
+
private readonly cdr;
|
|
94
|
+
isEmpty: boolean;
|
|
95
|
+
protected cn: typeof cn;
|
|
96
|
+
ngOnInit(): void;
|
|
97
|
+
ngOnDestroy(): void;
|
|
98
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommandEmptyComponent, never>;
|
|
99
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommandEmptyComponent, "tolle-command-empty", never, { "class": { "alias": "class"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A labelled section of items. The heading hides itself when filtering removes
|
|
103
|
+
* every item in the group, so you never get a stranded header.
|
|
104
|
+
*/
|
|
105
|
+
export declare class CommandGroupComponent implements OnInit, OnDestroy {
|
|
106
|
+
/** Section heading. @default '' */
|
|
107
|
+
heading: string;
|
|
108
|
+
/** Extra Tailwind classes merged onto the group via `cn()` (last-wins). */
|
|
109
|
+
class: string;
|
|
110
|
+
private readonly service;
|
|
111
|
+
private readonly subscriptions;
|
|
112
|
+
private readonly cdr;
|
|
113
|
+
private readonly memberIds;
|
|
114
|
+
hidden: boolean;
|
|
115
|
+
protected cn: typeof cn;
|
|
116
|
+
ngOnInit(): void;
|
|
117
|
+
ngOnDestroy(): void;
|
|
118
|
+
/** Called by child items so the group knows which ids belong to it. */
|
|
119
|
+
addMember(id: string): void;
|
|
120
|
+
removeMember(id: string): void;
|
|
121
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommandGroupComponent, never>;
|
|
122
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommandGroupComponent, "tolle-command-group", never, { "heading": { "alias": "heading"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
123
|
+
}
|
|
124
|
+
/** A selectable row in a command menu. */
|
|
125
|
+
export declare class CommandItemComponent implements OnInit, OnChanges, OnDestroy {
|
|
126
|
+
/** Value emitted from the menu's `selected` output when this row is chosen. */
|
|
127
|
+
value: any;
|
|
128
|
+
/**
|
|
129
|
+
* Text matched against the query. Defaults to `value` when omitted — set it
|
|
130
|
+
* explicitly whenever the row's visible text differs from its value.
|
|
131
|
+
* @default ''
|
|
132
|
+
*/
|
|
133
|
+
label: string;
|
|
134
|
+
/** Extra terms that should also match this row, e.g. synonyms. @default [] */
|
|
135
|
+
keywords: string[];
|
|
136
|
+
/** Makes the row unselectable and skipped by the arrow keys. @default false */
|
|
137
|
+
disabled: boolean;
|
|
138
|
+
/** Extra Tailwind classes merged onto the row via `cn()` (last-wins). */
|
|
139
|
+
class: string;
|
|
140
|
+
/** Emitted when this specific row is chosen. */
|
|
141
|
+
selected: EventEmitter<any>;
|
|
142
|
+
private readonly service;
|
|
143
|
+
private readonly group;
|
|
144
|
+
private readonly subscriptions;
|
|
145
|
+
private readonly cdr;
|
|
146
|
+
readonly id: string;
|
|
147
|
+
visible: boolean;
|
|
148
|
+
active: boolean;
|
|
149
|
+
ngOnInit(): void;
|
|
150
|
+
ngOnChanges(): void;
|
|
151
|
+
ngOnDestroy(): void;
|
|
152
|
+
/** Label plus keywords, so synonyms match without being displayed. */
|
|
153
|
+
private get searchText();
|
|
154
|
+
get computedClass(): string;
|
|
155
|
+
onClick(): void;
|
|
156
|
+
onMouseEnter(): void;
|
|
157
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommandItemComponent, never>;
|
|
158
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommandItemComponent, "tolle-command-item", never, { "value": { "alias": "value"; "required": false; }; "label": { "alias": "label"; "required": false; }; "keywords": { "alias": "keywords"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, { "selected": "selected"; }, never, ["*"], true, never>;
|
|
159
|
+
}
|
|
160
|
+
/** Divider between command groups. */
|
|
161
|
+
export declare class CommandSeparatorComponent implements OnChanges {
|
|
162
|
+
private readonly cdr;
|
|
163
|
+
/**
|
|
164
|
+
* Angular writes a bound `class` input through its styling path, which does
|
|
165
|
+
* not mark an OnPush component dirty — without this hook the component keeps
|
|
166
|
+
* rendering the class it was born with.
|
|
167
|
+
*/
|
|
168
|
+
ngOnChanges(): void;
|
|
169
|
+
/** Extra Tailwind classes merged onto the separator via `cn()` (last-wins). */
|
|
170
|
+
class: string;
|
|
171
|
+
protected cn: typeof cn;
|
|
172
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommandSeparatorComponent, never>;
|
|
173
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommandSeparatorComponent, "tolle-command-separator", never, { "class": { "alias": "class"; "required": false; }; }, {}, never, never, true, never>;
|
|
174
|
+
}
|
|
175
|
+
/** Right-aligned shortcut hint inside a command item. Pairs with `tolle-kbd`. */
|
|
176
|
+
export declare class CommandShortcutComponent implements OnChanges {
|
|
177
|
+
private readonly cdr;
|
|
178
|
+
/**
|
|
179
|
+
* Angular writes a bound `class` input through its styling path, which does
|
|
180
|
+
* not mark an OnPush component dirty — without this hook the component keeps
|
|
181
|
+
* rendering the class it was born with.
|
|
182
|
+
*/
|
|
183
|
+
ngOnChanges(): void;
|
|
184
|
+
/** Extra Tailwind classes merged onto the shortcut via `cn()` (last-wins). */
|
|
185
|
+
class: string;
|
|
186
|
+
protected cn: typeof cn;
|
|
187
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommandShortcutComponent, never>;
|
|
188
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommandShortcutComponent, "tolle-command-shortcut", never, { "class": { "alias": "class"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
189
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/** One registered `tolle-command-item`, as seen by the service. */
|
|
3
|
+
export interface CommandItemState {
|
|
4
|
+
id: string;
|
|
5
|
+
/** Text the query is matched against — the item's label plus any `keywords`. */
|
|
6
|
+
searchText: string;
|
|
7
|
+
value: any;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
/** Registration order, used to keep the visible list in DOM order. */
|
|
10
|
+
order: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Coordinates a `tolle-command` and its descendants: owns the query, decides
|
|
14
|
+
* which items survive filtering, and tracks the active (highlighted) item for
|
|
15
|
+
* `aria-activedescendant`.
|
|
16
|
+
*
|
|
17
|
+
* Provided on `CommandComponent`, so each command menu gets its own instance.
|
|
18
|
+
*/
|
|
19
|
+
export declare class CommandService {
|
|
20
|
+
private readonly items;
|
|
21
|
+
private nextOrder;
|
|
22
|
+
private readonly querySubject;
|
|
23
|
+
/** Current search query. */
|
|
24
|
+
readonly query$: import("rxjs").Observable<string>;
|
|
25
|
+
private readonly visibleSubject;
|
|
26
|
+
/** Ids of the items surviving the current query, in DOM order. */
|
|
27
|
+
readonly visible$: import("rxjs").Observable<string[]>;
|
|
28
|
+
private readonly activeIdSubject;
|
|
29
|
+
/** Id of the highlighted item, or null when nothing matches. */
|
|
30
|
+
readonly activeId$: import("rxjs").Observable<string | null>;
|
|
31
|
+
private readonly selectedSubject;
|
|
32
|
+
/** Emits the value of the item the user chose. */
|
|
33
|
+
readonly selected$: import("rxjs").Observable<any>;
|
|
34
|
+
/**
|
|
35
|
+
* When set, filtering is left entirely to the consumer — every registered
|
|
36
|
+
* item stays visible regardless of the query. Use for server-side search.
|
|
37
|
+
*/
|
|
38
|
+
shouldFilter: boolean;
|
|
39
|
+
get query(): string;
|
|
40
|
+
get visibleIds(): string[];
|
|
41
|
+
get activeId(): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* True when there is nothing to show.
|
|
44
|
+
*
|
|
45
|
+
* With built-in filtering that means items exist but the query excluded them
|
|
46
|
+
* all. With `shouldFilter = false` the consumer renders the result set itself,
|
|
47
|
+
* so "no items registered" IS the empty result — requiring items to exist
|
|
48
|
+
* would make `tolle-command-empty` permanently invisible in that mode.
|
|
49
|
+
*/
|
|
50
|
+
get isEmpty(): boolean;
|
|
51
|
+
register(item: Omit<CommandItemState, 'order'>): void;
|
|
52
|
+
/** Keeps the stored search text/value in sync when an item's inputs change. */
|
|
53
|
+
update(id: string, patch: Partial<Omit<CommandItemState, 'id' | 'order'>>): void;
|
|
54
|
+
unregister(id: string): void;
|
|
55
|
+
setQuery(query: string): void;
|
|
56
|
+
isVisible(id: string): boolean;
|
|
57
|
+
/** Moves the highlight by `delta` positions, wrapping at both ends. */
|
|
58
|
+
move(delta: number): void;
|
|
59
|
+
setActive(id: string | null): void;
|
|
60
|
+
/** Selects the highlighted item, if there is one. */
|
|
61
|
+
selectActive(): void;
|
|
62
|
+
selectById(id: string): void;
|
|
63
|
+
/** Recomputes the visible set and keeps the highlight on something valid. */
|
|
64
|
+
private recompute;
|
|
65
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommandService, never>;
|
|
66
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CommandService>;
|
|
67
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/** Whether the user has answered the prompt yet, and how. */
|
|
5
|
+
export type ConfirmationState = 'pending' | 'confirmed' | 'cancelled';
|
|
6
|
+
declare const confirmationVariants: (props?: ({
|
|
7
|
+
state?: "pending" | "confirmed" | "cancelled" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
export type ConfirmationProps = VariantProps<typeof confirmationVariants>;
|
|
10
|
+
/**
|
|
11
|
+
* An inline approve / deny prompt for an agent action that needs a human to
|
|
12
|
+
* sign off. While `state` is `'pending'` it shows both buttons; once the user
|
|
13
|
+
* answers — or the host sets `state` — the buttons collapse into a compact
|
|
14
|
+
* resolved row.
|
|
15
|
+
*
|
|
16
|
+
* ```html
|
|
17
|
+
* <tolle-confirmation
|
|
18
|
+
* title="Delete 12 rows from the orders table?"
|
|
19
|
+
* description="This cannot be undone."
|
|
20
|
+
* (confirmed)="run()"
|
|
21
|
+
* (cancelled)="skip()"
|
|
22
|
+
* ></tolle-confirmation>
|
|
23
|
+
* ```
|
|
24
|
+
* @new
|
|
25
|
+
*/
|
|
26
|
+
export declare class ConfirmationComponent implements OnChanges {
|
|
27
|
+
private readonly cdr;
|
|
28
|
+
/** Headline describing the action awaiting approval. @default '' */
|
|
29
|
+
title: string;
|
|
30
|
+
/** Supporting detail shown under the title. @default '' */
|
|
31
|
+
description: string;
|
|
32
|
+
/** Label of the approve button. @default 'Approve' */
|
|
33
|
+
confirmLabel: string;
|
|
34
|
+
/** Label of the deny button. @default 'Deny' */
|
|
35
|
+
cancelLabel: string;
|
|
36
|
+
/** Text shown in the resolved row after approval. @default 'Approved' */
|
|
37
|
+
confirmedLabel: string;
|
|
38
|
+
/** Text shown in the resolved row after denial. @default 'Denied' */
|
|
39
|
+
cancelledLabel: string;
|
|
40
|
+
/** Whether the prompt is still open, and how it was answered. @default 'pending' */
|
|
41
|
+
state: ConfirmationState;
|
|
42
|
+
/** Blocks both buttons without resolving the prompt. @default false */
|
|
43
|
+
disabled: boolean;
|
|
44
|
+
/** Extra Tailwind classes merged onto the prompt via `cn()` (last-wins). */
|
|
45
|
+
class: string;
|
|
46
|
+
/** Emitted when the user approves the action. */
|
|
47
|
+
confirmed: EventEmitter<void>;
|
|
48
|
+
/** Emitted when the user denies the action. */
|
|
49
|
+
cancelled: EventEmitter<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Set when the user answers, so the prompt resolves on its own without the
|
|
52
|
+
* host having to bind `state` back. Cleared whenever `state` is pushed in.
|
|
53
|
+
*/
|
|
54
|
+
private answer;
|
|
55
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
56
|
+
/** The state actually rendered: the user's answer if there is one, else `state`. */
|
|
57
|
+
get currentState(): ConfirmationState;
|
|
58
|
+
get resolvedLabel(): string;
|
|
59
|
+
get iconName(): string;
|
|
60
|
+
get computedClass(): string;
|
|
61
|
+
get iconClass(): string;
|
|
62
|
+
get resolvedClass(): string;
|
|
63
|
+
get confirmButtonClass(): string;
|
|
64
|
+
get cancelButtonClass(): string;
|
|
65
|
+
confirm(): void;
|
|
66
|
+
cancel(): void;
|
|
67
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmationComponent, never>;
|
|
68
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmationComponent, "tolle-confirmation", never, { "title": { "alias": "title"; "required": false; }; "description": { "alias": "description"; "required": false; }; "confirmLabel": { "alias": "confirmLabel"; "required": false; }; "cancelLabel": { "alias": "cancelLabel"; "required": false; }; "confirmedLabel": { "alias": "confirmedLabel"; "required": false; }; "cancelledLabel": { "alias": "cancelledLabel"; "required": false; }; "state": { "alias": "state"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, { "confirmed": "confirmed"; "cancelled": "cancelled"; }, never, ["*"], true, never>;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { ContextMenuItem } from './context-menu.service';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class ContextMenuTriggerDirective {
|
|
5
|
+
private elementRef;
|
|
6
|
+
private contextMenuService;
|
|
7
|
+
items: ContextMenuItem[];
|
|
8
|
+
action: EventEmitter<string>;
|
|
9
|
+
onContextMenu(event: MouseEvent): void;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuTriggerDirective, never>;
|
|
11
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ContextMenuTriggerDirective, "[tolleContextMenuTrigger]", never, { "items": { "alias": "tolleContextMenuTrigger"; "required": false; }; }, { "action": "action"; }, never, never, true, never>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ElementRef, OnDestroy, OnInit, QueryList } from '@angular/core';
|
|
2
|
+
import { ContextMenuItem } from './context-menu.service';
|
|
3
|
+
import { cn } from './utils/cn';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class ContextMenuComponent implements OnInit, OnDestroy {
|
|
6
|
+
private contextMenuService;
|
|
7
|
+
private elementRef;
|
|
8
|
+
private cdr;
|
|
9
|
+
menuElement: ElementRef<HTMLDivElement>;
|
|
10
|
+
submenuElement: ElementRef<HTMLDivElement>;
|
|
11
|
+
itemButtons: QueryList<ElementRef<HTMLButtonElement>>;
|
|
12
|
+
isOpen: boolean;
|
|
13
|
+
isPositioned: boolean;
|
|
14
|
+
isSubmenuPositioned: boolean;
|
|
15
|
+
items: ContextMenuItem[];
|
|
16
|
+
openSubmenuId: string | null;
|
|
17
|
+
activeSubmenuTrigger: HTMLElement | null;
|
|
18
|
+
activeIndex: number;
|
|
19
|
+
private stateSubscription;
|
|
20
|
+
private submenuTimeout;
|
|
21
|
+
protected readonly cn: typeof cn;
|
|
22
|
+
ngOnInit(): void;
|
|
23
|
+
get activeSubmenuItems(): ContextMenuItem[];
|
|
24
|
+
onDocumentEvents(event: MouseEvent): void;
|
|
25
|
+
positionMenu(): Promise<void>;
|
|
26
|
+
focusFirstItem(): void;
|
|
27
|
+
onItemClick(item: ContextMenuItem): void;
|
|
28
|
+
onItemMouseEnter(item: ContextMenuItem, trigger: HTMLButtonElement): void;
|
|
29
|
+
onItemMouseLeave(): void;
|
|
30
|
+
onSubmenuMouseEnter(): void;
|
|
31
|
+
onSubmenuMouseLeave(): void;
|
|
32
|
+
private closeSubmenu;
|
|
33
|
+
private positionSubmenu;
|
|
34
|
+
onSubItemClick(item: ContextMenuItem): void;
|
|
35
|
+
onKeyDown(event: KeyboardEvent): void;
|
|
36
|
+
private navigate;
|
|
37
|
+
onEscape(): void;
|
|
38
|
+
ngOnDestroy(): void;
|
|
39
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuComponent, never>;
|
|
40
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ContextMenuComponent, "tolle-context-menu", never, {}, {}, never, never, true, never>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export type ContextMenuItem = {
|
|
4
|
+
id?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
destructive?: boolean;
|
|
9
|
+
separator?: boolean;
|
|
10
|
+
submenu?: ContextMenuItem[];
|
|
11
|
+
shortcut?: string;
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
type?: 'default' | 'checkbox' | 'radio';
|
|
14
|
+
};
|
|
15
|
+
export type ContextMenuState = {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
items: ContextMenuItem[];
|
|
19
|
+
isOpen: boolean;
|
|
20
|
+
triggerElement?: HTMLElement;
|
|
21
|
+
onAction?: (actionId: string) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare class ContextMenuService {
|
|
24
|
+
private _state;
|
|
25
|
+
readonly stateChanged: EventEmitter<ContextMenuState>;
|
|
26
|
+
open(config: {
|
|
27
|
+
event: MouseEvent;
|
|
28
|
+
items?: ContextMenuItem[];
|
|
29
|
+
triggerElement?: HTMLElement;
|
|
30
|
+
onAction?: (actionId: string) => void;
|
|
31
|
+
}): void;
|
|
32
|
+
close(): void;
|
|
33
|
+
positionMenu(menuElement: HTMLElement): Promise<void>;
|
|
34
|
+
positionSubmenu(triggerElement: HTMLElement, submenuElement: HTMLElement): Promise<void>;
|
|
35
|
+
performAction(actionId: string): void;
|
|
36
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuService, never>;
|
|
37
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ContextMenuService>;
|
|
38
|
+
}
|