@tolle_/tolle-ui 18.2.29 → 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 +59 -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 +16453 -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 +26 -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 +8480 -1542
- package/registry/llms-full.txt +2679 -319
- package/registry/llms.txt +43 -4
- package/registry/manifest.json +9090 -1742
- 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,159 @@
|
|
|
1
|
+
import { EventEmitter, AfterViewInit, OnInit, OnDestroy, OnChanges } from '@angular/core';
|
|
2
|
+
import { cn } from './utils/cn';
|
|
3
|
+
import { ScrollStartPosition } from './message-scroller.service';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* A scroll container built for conversations, where content streams in while
|
|
7
|
+
* the reader is still reading.
|
|
8
|
+
*
|
|
9
|
+
* A plain overflow-scroll div gets this wrong in both directions: it either
|
|
10
|
+
* pins to the bottom and yanks the page mid-sentence, or it never follows and
|
|
11
|
+
* the reader misses the reply. This handles the cases that are easy to get
|
|
12
|
+
* wrong — following the live edge only while the reader is already there,
|
|
13
|
+
* opening a saved thread at the newest turn rather than the absolute end, and
|
|
14
|
+
* holding position when older history loads in above.
|
|
15
|
+
*
|
|
16
|
+
* ```html
|
|
17
|
+
* <tolle-message-scroller startPosition="last-anchor">
|
|
18
|
+
* <tolle-message-scroller-viewport>
|
|
19
|
+
* <tolle-message-scroller-content>
|
|
20
|
+
* <div tolleMessageScrollerItem [scrollAnchor]="turn.isNewTurn" *ngFor="let turn of turns">
|
|
21
|
+
* …
|
|
22
|
+
* </div>
|
|
23
|
+
* </tolle-message-scroller-content>
|
|
24
|
+
* </tolle-message-scroller-viewport>
|
|
25
|
+
* <tolle-message-scroller-button />
|
|
26
|
+
* </tolle-message-scroller>
|
|
27
|
+
* ```
|
|
28
|
+
* @new
|
|
29
|
+
*/
|
|
30
|
+
export declare class MessageScrollerComponent implements OnChanges, OnInit, OnDestroy {
|
|
31
|
+
private readonly cdr;
|
|
32
|
+
/**
|
|
33
|
+
* Angular writes a bound `class` input through its styling path, which does
|
|
34
|
+
* not mark an OnPush component dirty — without this hook the component keeps
|
|
35
|
+
* rendering the class it was born with.
|
|
36
|
+
*/
|
|
37
|
+
ngOnChanges(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Where to land when the transcript first renders. `last-anchor` opens at the
|
|
40
|
+
* newest turn so a long answer starts from its first line.
|
|
41
|
+
* @default 'last-anchor'
|
|
42
|
+
*/
|
|
43
|
+
startPosition: ScrollStartPosition;
|
|
44
|
+
/**
|
|
45
|
+
* Pixels of the previous turn kept visible above an anchored turn, so the
|
|
46
|
+
* reader can see what the reply is responding to. @default 48
|
|
47
|
+
*/
|
|
48
|
+
scrollPreviousItemPeek: number;
|
|
49
|
+
/**
|
|
50
|
+
* Distance from the bottom, in px, still treated as the live edge.
|
|
51
|
+
* @default 32
|
|
52
|
+
*/
|
|
53
|
+
threshold: number;
|
|
54
|
+
/** Extra Tailwind classes merged onto the frame via `cn()` (last-wins). */
|
|
55
|
+
class: string;
|
|
56
|
+
/** Emitted when the reader arrives at, or leaves, the live edge. */
|
|
57
|
+
atBottomChange: EventEmitter<boolean>;
|
|
58
|
+
private readonly service;
|
|
59
|
+
private readonly sub;
|
|
60
|
+
protected cn: typeof cn;
|
|
61
|
+
ngOnInit(): void;
|
|
62
|
+
ngOnDestroy(): void;
|
|
63
|
+
/** Jumps to the newest content and resumes following. */
|
|
64
|
+
scrollToBottom(behavior?: ScrollBehavior): void;
|
|
65
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageScrollerComponent, never>;
|
|
66
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MessageScrollerComponent, "tolle-message-scroller", never, { "startPosition": { "alias": "startPosition"; "required": false; }; "scrollPreviousItemPeek": { "alias": "scrollPreviousItemPeek"; "required": false; }; "threshold": { "alias": "threshold"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, { "atBottomChange": "atBottomChange"; }, never, ["*"], true, never>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The scrolling element. Watches its own size and its content's size so it can
|
|
70
|
+
* follow streamed text and hold position when history is prepended.
|
|
71
|
+
*/
|
|
72
|
+
export declare class MessageScrollerViewportComponent implements OnChanges, AfterViewInit, OnDestroy {
|
|
73
|
+
private readonly cdr;
|
|
74
|
+
/**
|
|
75
|
+
* Angular writes a bound `class` input through its styling path, which does
|
|
76
|
+
* not mark an OnPush component dirty — without this hook the component keeps
|
|
77
|
+
* rendering the class it was born with.
|
|
78
|
+
*/
|
|
79
|
+
ngOnChanges(): void;
|
|
80
|
+
/** Extra Tailwind classes merged onto the viewport via `cn()` (last-wins). */
|
|
81
|
+
class: string;
|
|
82
|
+
private readonly service;
|
|
83
|
+
private readonly scroller;
|
|
84
|
+
private readonly host;
|
|
85
|
+
private readonly zone;
|
|
86
|
+
private viewportEl;
|
|
87
|
+
private resizeObserver?;
|
|
88
|
+
private mutationObserver?;
|
|
89
|
+
private onScroll;
|
|
90
|
+
/** scrollHeight captured before each DOM mutation, to detect prepends. */
|
|
91
|
+
private lastScrollHeight;
|
|
92
|
+
private lastScrollTop;
|
|
93
|
+
protected cn: typeof cn;
|
|
94
|
+
ngAfterViewInit(): void;
|
|
95
|
+
ngOnDestroy(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Distinguishes content appended below (stream) from content inserted above
|
|
98
|
+
* (history). Growth while the reader has NOT moved but the scrollable area
|
|
99
|
+
* above them has, means a prepend — restore their position rather than let
|
|
100
|
+
* the view lurch.
|
|
101
|
+
*/
|
|
102
|
+
private afterMutation;
|
|
103
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageScrollerViewportComponent, never>;
|
|
104
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MessageScrollerViewportComponent, "tolle-message-scroller-viewport", never, { "class": { "alias": "class"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
105
|
+
}
|
|
106
|
+
/** The transcript itself. Announced politely so streamed replies reach screen readers. */
|
|
107
|
+
export declare class MessageScrollerContentComponent implements OnChanges {
|
|
108
|
+
private readonly cdr;
|
|
109
|
+
/**
|
|
110
|
+
* Angular writes a bound `class` input through its styling path, which does
|
|
111
|
+
* not mark an OnPush component dirty — without this hook the component keeps
|
|
112
|
+
* rendering the class it was born with.
|
|
113
|
+
*/
|
|
114
|
+
ngOnChanges(): void;
|
|
115
|
+
/** Extra Tailwind classes merged onto the transcript via `cn()` (last-wins). */
|
|
116
|
+
class: string;
|
|
117
|
+
protected cn: typeof cn;
|
|
118
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageScrollerContentComponent, never>;
|
|
119
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MessageScrollerContentComponent, "tolle-message-scroller-content", never, { "class": { "alias": "class"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Marks one row of the transcript. Set `scrollAnchor` on the row that begins a
|
|
123
|
+
* conversation turn so `startPosition="last-anchor"` can open there.
|
|
124
|
+
*/
|
|
125
|
+
export declare class MessageScrollerItemDirective implements OnInit, OnDestroy {
|
|
126
|
+
/** Marks this row as the start of a turn. @default false */
|
|
127
|
+
scrollAnchor: boolean;
|
|
128
|
+
private readonly service;
|
|
129
|
+
private readonly host;
|
|
130
|
+
ngOnInit(): void;
|
|
131
|
+
ngOnDestroy(): void;
|
|
132
|
+
/** Brings this row into view — use for jump-to-message. */
|
|
133
|
+
scrollIntoView(behavior?: ScrollBehavior): void;
|
|
134
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageScrollerItemDirective, never>;
|
|
135
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MessageScrollerItemDirective, "[tolleMessageScrollerItem]", never, { "scrollAnchor": { "alias": "scrollAnchor"; "required": false; }; }, {}, never, never, true, never>;
|
|
136
|
+
}
|
|
137
|
+
/** Floating "jump to latest" control. Hidden while the reader is already at the edge. */
|
|
138
|
+
export declare class MessageScrollerButtonComponent implements OnChanges, OnInit, OnDestroy {
|
|
139
|
+
/**
|
|
140
|
+
* Angular writes a bound `class` input through its styling path, which does
|
|
141
|
+
* not mark an OnPush component dirty — without this hook the component keeps
|
|
142
|
+
* rendering the class it was born with.
|
|
143
|
+
*/
|
|
144
|
+
ngOnChanges(): void;
|
|
145
|
+
/** Accessible name for the jump control. @default 'Jump to latest messages' */
|
|
146
|
+
ariaLabel: string;
|
|
147
|
+
/** Extra Tailwind classes merged onto the button via `cn()` (last-wins). */
|
|
148
|
+
class: string;
|
|
149
|
+
private readonly service;
|
|
150
|
+
private readonly cdr;
|
|
151
|
+
private readonly sub;
|
|
152
|
+
atBottom: boolean;
|
|
153
|
+
protected cn: typeof cn;
|
|
154
|
+
ngOnInit(): void;
|
|
155
|
+
ngOnDestroy(): void;
|
|
156
|
+
jump(): void;
|
|
157
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageScrollerButtonComponent, never>;
|
|
158
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MessageScrollerButtonComponent, "tolle-message-scroller-button", never, { "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
159
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/** Where a freshly-mounted scroller should start. */
|
|
3
|
+
export type ScrollStartPosition = 'top' | 'bottom' | 'last-anchor';
|
|
4
|
+
/**
|
|
5
|
+
* Scroll state for one `tolle-message-scroller`, shared with its viewport,
|
|
6
|
+
* items and buttons.
|
|
7
|
+
*
|
|
8
|
+
* The governing rule is: **never move the reader against their intent.** Every
|
|
9
|
+
* automatic scroll here is gated on the reader already being at the live edge.
|
|
10
|
+
* The moment they scroll up, auto-scroll switches off and stays off until they
|
|
11
|
+
* come back down or explicitly jump.
|
|
12
|
+
*
|
|
13
|
+
* Positions are read from and written to the DOM directly rather than mirrored
|
|
14
|
+
* into component state — scroll events fire far too often to run change
|
|
15
|
+
* detection on, and the values would be stale by the time they landed.
|
|
16
|
+
*/
|
|
17
|
+
export declare class MessageScrollerService {
|
|
18
|
+
/** The scrollable element, set by the viewport once it renders. */
|
|
19
|
+
private viewport;
|
|
20
|
+
/** Rows registered as the start of a conversation turn, in DOM order. */
|
|
21
|
+
private anchors;
|
|
22
|
+
private readonly atBottomSubject;
|
|
23
|
+
/** True while the reader is at (or within `threshold` of) the live edge. */
|
|
24
|
+
readonly atBottom$: import("rxjs").Observable<boolean>;
|
|
25
|
+
private readonly followingSubject;
|
|
26
|
+
/**
|
|
27
|
+
* True while new content should pull the view along. Set false the instant
|
|
28
|
+
* the reader scrolls away from the bottom.
|
|
29
|
+
*/
|
|
30
|
+
readonly following$: import("rxjs").Observable<boolean>;
|
|
31
|
+
/** Distance from the bottom, in px, still considered "at the live edge". */
|
|
32
|
+
threshold: number;
|
|
33
|
+
get atBottom(): boolean;
|
|
34
|
+
get isFollowing(): boolean;
|
|
35
|
+
registerViewport(el: HTMLElement): void;
|
|
36
|
+
registerAnchor(el: HTMLElement): void;
|
|
37
|
+
unregisterAnchor(el: HTMLElement): void;
|
|
38
|
+
/**
|
|
39
|
+
* Recomputes whether we're at the live edge. Called from the viewport's
|
|
40
|
+
* scroll handler, which runs outside Angular — this only pushes through the
|
|
41
|
+
* subjects when the boolean actually flips, so we re-enter change detection
|
|
42
|
+
* once per state change instead of once per scroll event.
|
|
43
|
+
*/
|
|
44
|
+
measure(): void;
|
|
45
|
+
/** Jumps to the live edge and resumes following. */
|
|
46
|
+
scrollToBottom(behavior?: ScrollBehavior): void;
|
|
47
|
+
/** Scrolls a specific row into view, e.g. jump-to-message from a search result. */
|
|
48
|
+
scrollToItem(el: HTMLElement, behavior?: ScrollBehavior): void;
|
|
49
|
+
/**
|
|
50
|
+
* Positions the transcript on open. `last-anchor` puts the newest turn at the
|
|
51
|
+
* top of the viewport instead of dumping the reader at the absolute end, so a
|
|
52
|
+
* long streamed answer starts from its beginning — with `peek` px of the
|
|
53
|
+
* previous turn left visible for context.
|
|
54
|
+
*/
|
|
55
|
+
applyStartPosition(position: ScrollStartPosition, peek: number): void;
|
|
56
|
+
/**
|
|
57
|
+
* Content grew. Follows only if the reader was already at the edge; uses
|
|
58
|
+
* 'auto' so streamed tokens don't queue a smooth animation per chunk.
|
|
59
|
+
*/
|
|
60
|
+
handleContentGrowth(): void;
|
|
61
|
+
/**
|
|
62
|
+
* History was prepended above the current view. Restores the reader's exact
|
|
63
|
+
* position by re-adding the height the new content introduced — otherwise the
|
|
64
|
+
* transcript visibly lurches downward as older messages load in.
|
|
65
|
+
*/
|
|
66
|
+
preserveOnPrepend(previousScrollHeight: number): void;
|
|
67
|
+
/** Current scrollHeight, captured before a prepend so it can be compared after. */
|
|
68
|
+
snapshotScrollHeight(): number;
|
|
69
|
+
/** The last registered anchor in document order (registration order can vary). */
|
|
70
|
+
private lastAnchorInDomOrder;
|
|
71
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageScrollerService, never>;
|
|
72
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MessageScrollerService>;
|
|
73
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { OnChanges, OnDestroy } from '@angular/core';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { cn } from './utils/cn';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
declare const messageVariants: (props?: ({
|
|
6
|
+
align?: "start" | "end" | null | undefined;
|
|
7
|
+
size?: "default" | "sm" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
export type MessageProps = VariantProps<typeof messageVariants>;
|
|
10
|
+
/** Which edge of the transcript a message hangs off. */
|
|
11
|
+
export type MessageAlign = 'start' | 'end';
|
|
12
|
+
/**
|
|
13
|
+
* Shares the owning message's alignment with its OnPush children.
|
|
14
|
+
*
|
|
15
|
+
* Avatar / content / header / footer all need to know which edge the row hangs
|
|
16
|
+
* off, but reading `MessageComponent.align` from a child getter would never mark
|
|
17
|
+
* that child dirty. Emitting through an observable and calling `markForCheck()`
|
|
18
|
+
* on each emission is the only thing that re-renders them.
|
|
19
|
+
*/
|
|
20
|
+
export declare class MessageAlignService {
|
|
21
|
+
private alignSource;
|
|
22
|
+
/** Emits the owning message's alignment whenever it changes. */
|
|
23
|
+
readonly align$: import("rxjs").Observable<MessageAlign>;
|
|
24
|
+
/** The owning message's current alignment. */
|
|
25
|
+
get align(): MessageAlign;
|
|
26
|
+
setAlign(align: MessageAlign): void;
|
|
27
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageAlignService, never>;
|
|
28
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MessageAlignService>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Base class for the message sub-components: resolves the row's alignment from
|
|
32
|
+
* the parent `tolle-message` and keeps the OnPush view in sync with it.
|
|
33
|
+
*/
|
|
34
|
+
declare abstract class MessageAlignAware implements OnChanges, OnDestroy {
|
|
35
|
+
/** Extra Tailwind classes merged onto the element via `cn()` (last-wins). */
|
|
36
|
+
class: string;
|
|
37
|
+
private readonly service;
|
|
38
|
+
private readonly cdr;
|
|
39
|
+
private readonly sub;
|
|
40
|
+
/**
|
|
41
|
+
* A bound `class` input is written through Angular's styling path, which
|
|
42
|
+
* does not mark an OnPush view dirty — without this every subclass would
|
|
43
|
+
* keep rendering the class it was born with.
|
|
44
|
+
*/
|
|
45
|
+
ngOnChanges(): void;
|
|
46
|
+
constructor();
|
|
47
|
+
/** Alignment inherited from the enclosing message, defaulting to 'start'. */
|
|
48
|
+
protected get align(): MessageAlign;
|
|
49
|
+
ngOnDestroy(): void;
|
|
50
|
+
protected cn: typeof cn;
|
|
51
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageAlignAware, never>;
|
|
52
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MessageAlignAware, never, never, { "class": { "alias": "class"; "required": false; }; }, {}, never, never, false, never>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The row layout for a single chat message: avatar on one edge, the content
|
|
56
|
+
* column (header, bubble, footer) filling the rest. Compose it with
|
|
57
|
+
* `tolle-bubble` for the visible surface.
|
|
58
|
+
* @new
|
|
59
|
+
*/
|
|
60
|
+
export declare class MessageComponent implements OnChanges {
|
|
61
|
+
private readonly cdr;
|
|
62
|
+
/** Which edge the message hangs off — 'start' for incoming, 'end' for outgoing. @default 'start' */
|
|
63
|
+
align: MessageProps['align'];
|
|
64
|
+
/** Gap density of the row. @default 'default' */
|
|
65
|
+
size: MessageProps['size'];
|
|
66
|
+
/** Extra Tailwind classes merged onto the row via `cn()` (last-wins). */
|
|
67
|
+
class: string;
|
|
68
|
+
private readonly service;
|
|
69
|
+
ngOnChanges(): void;
|
|
70
|
+
get computedClass(): string;
|
|
71
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageComponent, never>;
|
|
72
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MessageComponent, "tolle-message", never, { "align": { "alias": "align"; "required": false; }; "size": { "alias": "size"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
73
|
+
}
|
|
74
|
+
declare const messageGroupVariants: (props?: ({
|
|
75
|
+
align?: "start" | "end" | null | undefined;
|
|
76
|
+
spacing?: "default" | "tight" | "loose" | null | undefined;
|
|
77
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
78
|
+
export type MessageGroupProps = VariantProps<typeof messageGroupVariants>;
|
|
79
|
+
/**
|
|
80
|
+
* Stacks consecutive messages from the same sender with tighter spacing, so a
|
|
81
|
+
* burst of replies reads as one turn rather than several.
|
|
82
|
+
*/
|
|
83
|
+
export declare class MessageGroupComponent implements OnChanges {
|
|
84
|
+
private readonly cdr;
|
|
85
|
+
/**
|
|
86
|
+
* Angular writes a bound `class` input through its styling path, which does
|
|
87
|
+
* not mark an OnPush component dirty — without this hook the component keeps
|
|
88
|
+
* rendering the class it was born with.
|
|
89
|
+
*/
|
|
90
|
+
ngOnChanges(): void;
|
|
91
|
+
/** Edge the grouped messages hang off. @default 'start' */
|
|
92
|
+
align: MessageGroupProps['align'];
|
|
93
|
+
/** Vertical gap between the grouped messages. @default 'default' */
|
|
94
|
+
spacing: MessageGroupProps['spacing'];
|
|
95
|
+
/** Extra Tailwind classes merged onto the group via `cn()` (last-wins). */
|
|
96
|
+
class: string;
|
|
97
|
+
get computedClass(): string;
|
|
98
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageGroupComponent, never>;
|
|
99
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MessageGroupComponent, "tolle-message-group", never, { "align": { "alias": "align"; "required": false; }; "spacing": { "alias": "spacing"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Avatar slot for a message. Anchored to the bottom of the row so it sits beside
|
|
103
|
+
* the last line of a multi-line bubble rather than floating at the top.
|
|
104
|
+
*/
|
|
105
|
+
export declare class MessageAvatarComponent extends MessageAlignAware {
|
|
106
|
+
get computedClass(): string;
|
|
107
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageAvatarComponent, never>;
|
|
108
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MessageAvatarComponent, "tolle-message-avatar", never, {}, {}, never, ["*"], true, never>;
|
|
109
|
+
}
|
|
110
|
+
/** Content column of a message — wraps the header, the bubble, and the footer. */
|
|
111
|
+
export declare class MessageContentComponent extends MessageAlignAware {
|
|
112
|
+
get computedClass(): string;
|
|
113
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageContentComponent, never>;
|
|
114
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MessageContentComponent, "tolle-message-content", never, {}, {}, never, ["*"], true, never>;
|
|
115
|
+
}
|
|
116
|
+
/** Sender name and metadata rendered above the message surface. */
|
|
117
|
+
export declare class MessageHeaderComponent extends MessageAlignAware {
|
|
118
|
+
get computedClass(): string;
|
|
119
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageHeaderComponent, never>;
|
|
120
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MessageHeaderComponent, "tolle-message-header", never, {}, {}, never, ["*"], true, never>;
|
|
121
|
+
}
|
|
122
|
+
/** Delivery status, actions, or a timestamp rendered below the message surface. */
|
|
123
|
+
export declare class MessageFooterComponent extends MessageAlignAware {
|
|
124
|
+
get computedClass(): string;
|
|
125
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageFooterComponent, never>;
|
|
126
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MessageFooterComponent, "tolle-message-footer", never, {}, {}, never, ["*"], true, never>;
|
|
127
|
+
}
|
|
128
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { PopoverComponent } from './popover.component';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/** One model the user can pick. Deliberately provider-agnostic. */
|
|
7
|
+
export type ModelOption = {
|
|
8
|
+
/** Stable identifier written back through the form control. */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Human-readable model name. */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Vendor or family; when present the list is grouped by it. */
|
|
13
|
+
provider?: string;
|
|
14
|
+
/** One-line summary shown under the name. */
|
|
15
|
+
description?: string;
|
|
16
|
+
/** Short tag rendered as a pill, e.g. "new" or "preview". */
|
|
17
|
+
badge?: string;
|
|
18
|
+
/** Prevents the option from being chosen. */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
};
|
|
21
|
+
/** A provider heading and the models filed under it. */
|
|
22
|
+
export type ModelSelectorGroup = {
|
|
23
|
+
provider: string;
|
|
24
|
+
models: ModelOption[];
|
|
25
|
+
};
|
|
26
|
+
declare const modelSelectorTriggerVariants: (props?: ({
|
|
27
|
+
size?: "default" | "xs" | "sm" | "lg" | null | undefined;
|
|
28
|
+
variant?: "default" | "ghost" | null | undefined;
|
|
29
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
30
|
+
export type ModelSelectorProps = VariantProps<typeof modelSelectorTriggerVariants>;
|
|
31
|
+
/**
|
|
32
|
+
* A compact picker for choosing which model a conversation should use.
|
|
33
|
+
*
|
|
34
|
+
* Implements `ControlValueAccessor`, so it binds with `ngModel` or a reactive
|
|
35
|
+
* form control and round-trips the chosen model's `id`. Searching, keyboard
|
|
36
|
+
* navigation and positioning are reused from `tolle-command` and
|
|
37
|
+
* `tolle-popover` rather than reimplemented here.
|
|
38
|
+
*
|
|
39
|
+
* ```html
|
|
40
|
+
* <tolle-model-selector [models]="models" [(ngModel)]="modelId"></tolle-model-selector>
|
|
41
|
+
* ```
|
|
42
|
+
* @new
|
|
43
|
+
*/
|
|
44
|
+
export declare class ModelSelectorComponent implements ControlValueAccessor, OnChanges {
|
|
45
|
+
/** Models to choose from; grouped by `provider` when that field is set. @default [] */
|
|
46
|
+
models: ModelOption[];
|
|
47
|
+
/** Text shown on the trigger when nothing is selected. @default 'Select a model' */
|
|
48
|
+
placeholder: string;
|
|
49
|
+
/** Placeholder inside the search box. @default 'Search models…' */
|
|
50
|
+
searchPlaceholder: string;
|
|
51
|
+
/** Message shown when the query matches no model. @default 'No models found.' */
|
|
52
|
+
emptyMessage: string;
|
|
53
|
+
/** Shows the search box above the list. @default true */
|
|
54
|
+
searchable: boolean;
|
|
55
|
+
/** Prefixes the selected model's name with its provider on the trigger. @default false */
|
|
56
|
+
showProviderOnTrigger: boolean;
|
|
57
|
+
/** Height and text size of the trigger. @default 'default' */
|
|
58
|
+
size: ModelSelectorProps['size'];
|
|
59
|
+
/** Visual style of the trigger. @default 'default' */
|
|
60
|
+
variant: ModelSelectorProps['variant'];
|
|
61
|
+
/** Optional remixicon class shown at the start of the trigger. @default 'ri-sparkling-line' */
|
|
62
|
+
icon: string;
|
|
63
|
+
/** Where the list opens relative to the trigger. @default 'bottom-start' */
|
|
64
|
+
placement: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
|
|
65
|
+
/** Disables the control. @default false */
|
|
66
|
+
disabled: boolean;
|
|
67
|
+
/** Accessible name for the trigger and list. @default '' */
|
|
68
|
+
ariaLabel: string;
|
|
69
|
+
/** Extra Tailwind classes merged onto the trigger via `cn()` (last-wins). */
|
|
70
|
+
class: string;
|
|
71
|
+
/** Emitted with the chosen model's `id` whenever the selection changes. */
|
|
72
|
+
valueChange: EventEmitter<string | null>;
|
|
73
|
+
/** Emitted with the whole `ModelOption` whenever the selection changes. */
|
|
74
|
+
modelChange: EventEmitter<ModelOption | null>;
|
|
75
|
+
popover?: PopoverComponent;
|
|
76
|
+
/** Id of the currently selected model, or `null`. */
|
|
77
|
+
value: string | null;
|
|
78
|
+
/** Models bucketed by provider, recomputed whenever `models` changes. */
|
|
79
|
+
groups: ModelSelectorGroup[];
|
|
80
|
+
private readonly cdr;
|
|
81
|
+
private onChange;
|
|
82
|
+
private onTouched;
|
|
83
|
+
ngOnChanges(): void;
|
|
84
|
+
/** The selected `ModelOption`, or `null` when the value matches nothing. */
|
|
85
|
+
get selected(): ModelOption | null;
|
|
86
|
+
get triggerLabel(): string;
|
|
87
|
+
get computedTriggerClass(): string;
|
|
88
|
+
onSelect(id: string): void;
|
|
89
|
+
onPopoverClose(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Buckets models by provider, preserving input order both between and within
|
|
92
|
+
* groups. Models with no provider land in a single unlabelled group so a flat
|
|
93
|
+
* list still renders.
|
|
94
|
+
*/
|
|
95
|
+
private groupModels;
|
|
96
|
+
writeValue(value: string | null): void;
|
|
97
|
+
registerOnChange(fn: (value: string | null) => void): void;
|
|
98
|
+
registerOnTouched(fn: () => void): void;
|
|
99
|
+
setDisabledState(isDisabled: boolean): void;
|
|
100
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ModelSelectorComponent, never>;
|
|
101
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ModelSelectorComponent, "tolle-model-selector", never, { "models": { "alias": "models"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; }; "searchable": { "alias": "searchable"; "required": false; }; "showProviderOnTrigger": { "alias": "showProviderOnTrigger"; "required": false; }; "size": { "alias": "size"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "placement": { "alias": "placement"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, { "valueChange": "valueChange"; "modelChange": "modelChange"; }, never, never, true, never>;
|
|
102
|
+
}
|
|
103
|
+
export {};
|
|
@@ -1,44 +1,94 @@
|
|
|
1
|
-
import { QueryList, AfterContentInit, ElementRef, OnDestroy } from '@angular/core';
|
|
1
|
+
import { EventEmitter, QueryList, AfterContentInit, ElementRef, OnChanges, OnDestroy, ChangeDetectorRef } from '@angular/core';
|
|
2
2
|
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
4
|
import { SelectItemComponent } from './select-item.component';
|
|
4
5
|
import { SelectService } from './select.service';
|
|
5
6
|
import { cn } from './utils/cn';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
|
-
|
|
8
|
+
declare const multiSelectTriggerVariants: (props?: ({
|
|
9
|
+
size?: "default" | "xs" | "sm" | "lg" | null | undefined;
|
|
10
|
+
error?: boolean | null | undefined;
|
|
11
|
+
disabled?: boolean | null | undefined;
|
|
12
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
|
+
export type MultiSelectProps = VariantProps<typeof multiSelectTriggerVariants>;
|
|
14
|
+
/** One chip on the trigger, standing for a selected option. */
|
|
15
|
+
export interface MultiSelectChip {
|
|
16
|
+
label: string;
|
|
17
|
+
value: any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A multi-select listbox: a trigger that shows the current selection as
|
|
21
|
+
* removable chips and opens a floating panel of `tolle-select-item` options.
|
|
22
|
+
* Implements `ControlValueAccessor`, so it works with `ngModel` and reactive
|
|
23
|
+
* forms.
|
|
24
|
+
*/
|
|
25
|
+
export declare class MultiSelectComponent implements ControlValueAccessor, AfterContentInit, OnChanges, OnDestroy {
|
|
8
26
|
private selectService;
|
|
27
|
+
private cdr;
|
|
28
|
+
/** Text shown on the trigger when nothing is selected. @default 'Select options...' */
|
|
9
29
|
placeholder: string;
|
|
10
|
-
size
|
|
30
|
+
/** Padding and text size of the trigger. @default 'default' */
|
|
31
|
+
size: MultiSelectProps['size'];
|
|
32
|
+
/** Adds a search box that filters the projected options. @default false */
|
|
11
33
|
searchable: boolean;
|
|
34
|
+
/** Disables the control and blocks opening the panel. @default false */
|
|
12
35
|
disabled: boolean;
|
|
36
|
+
/** Extra Tailwind classes merged onto the trigger via `cn()` (last-wins). @default '' */
|
|
13
37
|
class: string;
|
|
38
|
+
/** Largest number of values that can be selected at once; leave unset for no cap. */
|
|
14
39
|
maxSelections?: number;
|
|
40
|
+
/** How many chips to render before collapsing the rest into a "+N more" hint. @default 3 */
|
|
15
41
|
maxDisplayItems: number;
|
|
42
|
+
/** Applies the destructive border and focus ring. @default false */
|
|
16
43
|
error: boolean;
|
|
44
|
+
/** Emitted with the full array of selected values whenever the selection changes. */
|
|
45
|
+
valueChange: EventEmitter<any[]>;
|
|
46
|
+
/** Emitted when the panel opens. */
|
|
47
|
+
opened: EventEmitter<void>;
|
|
48
|
+
/** Emitted when the panel closes. */
|
|
49
|
+
closed: EventEmitter<void>;
|
|
17
50
|
trigger: ElementRef;
|
|
18
51
|
popover: ElementRef;
|
|
19
52
|
searchInput?: ElementRef<HTMLElement>;
|
|
20
53
|
items: QueryList<SelectItemComponent>;
|
|
21
54
|
value: any[];
|
|
22
|
-
selectedItems:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
55
|
+
selectedItems: MultiSelectChip[];
|
|
56
|
+
/**
|
|
57
|
+
* The chips actually rendered, built into a field rather than read from a
|
|
58
|
+
* getter. A getter hands `*ngFor` a freshly-allocated array on every
|
|
59
|
+
* change-detection pass; paired with the default identity differ that tore
|
|
60
|
+
* down and rebuilt every badge — including the one under the pointer, whose
|
|
61
|
+
* destruction re-fires its own remove handler. See `trackChip` below, which
|
|
62
|
+
* closes the same hole for the rebuilt chip objects `syncItems()` produces.
|
|
63
|
+
*/
|
|
64
|
+
displayItems: MultiSelectChip[];
|
|
65
|
+
exceedsDisplayLimit: boolean;
|
|
26
66
|
isOpen: boolean;
|
|
27
67
|
searchQuery: string;
|
|
28
68
|
noResults: boolean;
|
|
29
69
|
private cleanup?;
|
|
70
|
+
private sub;
|
|
30
71
|
activeIndex: number;
|
|
31
72
|
private typeaheadBuffer;
|
|
32
73
|
private typeaheadTime;
|
|
33
74
|
private pendingTypeaheadChar;
|
|
34
|
-
constructor(selectService: SelectService);
|
|
75
|
+
constructor(selectService: SelectService, cdr: ChangeDetectorRef);
|
|
35
76
|
get computedTriggerClass(): string;
|
|
36
77
|
ngAfterContentInit(): void;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
78
|
+
/**
|
|
79
|
+
* `maxDisplayItems` decides how much of the selection is rendered, so the
|
|
80
|
+
* chip list has to be rebuilt when it changes.
|
|
81
|
+
*
|
|
82
|
+
* The `markForCheck()` is not redundant: under OnPush a `[class]` binding is
|
|
83
|
+
* applied through Angular's *styling* path, which writes the input but —
|
|
84
|
+
* unlike a plain property binding — never marks the component dirty, so the
|
|
85
|
+
* trigger would keep rendering the class it was born with.
|
|
86
|
+
*/
|
|
87
|
+
ngOnChanges(): void;
|
|
88
|
+
/** `*ngFor` identity for the chips — keyed on the option value, not the
|
|
89
|
+
* wrapper object, which `syncItems()` re-allocates on every sync. */
|
|
90
|
+
trackChip: (_index: number, chip: MultiSelectChip) => any;
|
|
91
|
+
private refreshDisplay;
|
|
42
92
|
get selectableItems(): SelectItemComponent[];
|
|
43
93
|
get availableSelections(): number;
|
|
44
94
|
private _outsideClickHandler;
|
|
@@ -50,6 +100,7 @@ export declare class MultiSelectComponent implements ControlValueAccessor, After
|
|
|
50
100
|
selectAll(): void;
|
|
51
101
|
clearAll(): void;
|
|
52
102
|
removeValue(event: MouseEvent, val: any): void;
|
|
103
|
+
private emitValue;
|
|
53
104
|
private syncItems;
|
|
54
105
|
onSearchChange(q: string): void;
|
|
55
106
|
private get navigableItems();
|
|
@@ -76,5 +127,6 @@ export declare class MultiSelectComponent implements ControlValueAccessor, After
|
|
|
76
127
|
setDisabledState(isDisabled: boolean): void;
|
|
77
128
|
protected cn: typeof cn;
|
|
78
129
|
static ɵfac: i0.ɵɵFactoryDeclaration<MultiSelectComponent, never>;
|
|
79
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<MultiSelectComponent, "tolle-multi-select", never, { "placeholder": { "alias": "placeholder"; "required": false; }; "size": { "alias": "size"; "required": false; }; "searchable": { "alias": "searchable"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "class": { "alias": "class"; "required": false; }; "maxSelections": { "alias": "maxSelections"; "required": false; }; "maxDisplayItems": { "alias": "maxDisplayItems"; "required": false; }; "error": { "alias": "error"; "required": false; }; }, {}, ["items"], ["*"], true, never>;
|
|
130
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MultiSelectComponent, "tolle-multi-select", never, { "placeholder": { "alias": "placeholder"; "required": false; }; "size": { "alias": "size"; "required": false; }; "searchable": { "alias": "searchable"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "class": { "alias": "class"; "required": false; }; "maxSelections": { "alias": "maxSelections"; "required": false; }; "maxDisplayItems": { "alias": "maxDisplayItems"; "required": false; }; "error": { "alias": "error"; "required": false; }; }, { "valueChange": "valueChange"; "opened": "opened"; "closed": "closed"; }, ["items"], ["*"], true, never>;
|
|
80
131
|
}
|
|
132
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { EventEmitter, ChangeDetectorRef } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
declare const nativeSelectVariants: (props?: ({
|
|
6
|
+
size?: "default" | "xs" | "sm" | "lg" | null | undefined;
|
|
7
|
+
invalid?: boolean | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
export type NativeSelectProps = VariantProps<typeof nativeSelectVariants>;
|
|
10
|
+
export type NativeSelectOption = {
|
|
11
|
+
label: string;
|
|
12
|
+
value: any;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A styled native `<select>`. Unlike `tolle-select` it uses the platform
|
|
17
|
+
* dropdown, so it needs no portal or floating-ui and works well on mobile and
|
|
18
|
+
* inside forms that must degrade without JavaScript.
|
|
19
|
+
*
|
|
20
|
+
* Options come from `options`, or from projected `<option>` elements when you
|
|
21
|
+
* need `<optgroup>` or custom markup.
|
|
22
|
+
* @new
|
|
23
|
+
*/
|
|
24
|
+
export declare class NativeSelectComponent implements ControlValueAccessor {
|
|
25
|
+
private cdr;
|
|
26
|
+
/** Id applied to the underlying `<select>`; pair it with a `tolle-label`. */
|
|
27
|
+
id: string;
|
|
28
|
+
/** Options to render. Omit and project `<option>` elements for custom markup. @default [] */
|
|
29
|
+
options: NativeSelectOption[];
|
|
30
|
+
/** Non-selectable prompt shown when no value is set. @default '' */
|
|
31
|
+
placeholder: string;
|
|
32
|
+
/** Height and text size of the control. @default 'default' */
|
|
33
|
+
size: NativeSelectProps['size'];
|
|
34
|
+
/** Applies the destructive border and sets `aria-invalid`. @default false */
|
|
35
|
+
invalid: boolean;
|
|
36
|
+
/** Disables the control. @default false */
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
/** Accessible name when there is no associated visible label. @default '' */
|
|
39
|
+
ariaLabel: string;
|
|
40
|
+
/** Extra Tailwind classes merged onto the `<select>` via `cn()` (last-wins). */
|
|
41
|
+
class: string;
|
|
42
|
+
/** Emitted with the newly selected value whenever the user picks an option. */
|
|
43
|
+
valueChange: EventEmitter<any>;
|
|
44
|
+
value: any;
|
|
45
|
+
onChange: (value: any) => void;
|
|
46
|
+
onTouched: () => void;
|
|
47
|
+
constructor(cdr: ChangeDetectorRef);
|
|
48
|
+
get computedClass(): string;
|
|
49
|
+
onSelectChange(event: Event): void;
|
|
50
|
+
writeValue(value: any): void;
|
|
51
|
+
registerOnChange(fn: (value: any) => void): void;
|
|
52
|
+
registerOnTouched(fn: () => void): void;
|
|
53
|
+
setDisabledState(isDisabled: boolean): void;
|
|
54
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NativeSelectComponent, never>;
|
|
55
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NativeSelectComponent, "tolle-native-select", never, { "id": { "alias": "id"; "required": false; }; "options": { "alias": "options"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "size": { "alias": "size"; "required": false; }; "invalid": { "alias": "invalid"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "class": { "alias": "class"; "required": false; }; }, { "valueChange": "valueChange"; }, never, ["*"], true, never>;
|
|
56
|
+
}
|
|
57
|
+
export {};
|