forty-cdk 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/README.md +122 -0
- package/aspect-ratio/README.md +76 -0
- package/avatar/README.md +100 -0
- package/breadcrumbs/README.md +49 -0
- package/breakpoints/README.md +81 -0
- package/button/README.md +49 -0
- package/calendar/README.md +458 -0
- package/carousel/README.md +358 -0
- package/checkbox/README.md +146 -0
- package/combobox/README.md +535 -0
- package/context-menu/README.md +139 -0
- package/date-field/README.md +184 -0
- package/date-picker/README.md +338 -0
- package/dialog/README.md +388 -0
- package/disclosure/README.md +114 -0
- package/drag-drop/README.md +359 -0
- package/drawer/README.md +560 -0
- package/dropdown-menu/README.md +176 -0
- package/fesm2022/forty-cdk-accordion.mjs +348 -0
- package/fesm2022/forty-cdk-accordion.mjs.map +1 -0
- package/fesm2022/forty-cdk-aspect-ratio.mjs +74 -0
- package/fesm2022/forty-cdk-aspect-ratio.mjs.map +1 -0
- package/fesm2022/forty-cdk-avatar.mjs +308 -0
- package/fesm2022/forty-cdk-avatar.mjs.map +1 -0
- package/fesm2022/forty-cdk-breadcrumbs.mjs +125 -0
- package/fesm2022/forty-cdk-breadcrumbs.mjs.map +1 -0
- package/fesm2022/forty-cdk-breakpoints.mjs +117 -0
- package/fesm2022/forty-cdk-breakpoints.mjs.map +1 -0
- package/fesm2022/forty-cdk-button.mjs +134 -0
- package/fesm2022/forty-cdk-button.mjs.map +1 -0
- package/fesm2022/forty-cdk-calendar.mjs +2034 -0
- package/fesm2022/forty-cdk-calendar.mjs.map +1 -0
- package/fesm2022/forty-cdk-carousel.mjs +968 -0
- package/fesm2022/forty-cdk-carousel.mjs.map +1 -0
- package/fesm2022/forty-cdk-checkbox.mjs +226 -0
- package/fesm2022/forty-cdk-checkbox.mjs.map +1 -0
- package/fesm2022/forty-cdk-combobox.mjs +2596 -0
- package/fesm2022/forty-cdk-combobox.mjs.map +1 -0
- package/fesm2022/forty-cdk-context-menu.mjs +413 -0
- package/fesm2022/forty-cdk-context-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-core.mjs +9022 -0
- package/fesm2022/forty-cdk-core.mjs.map +1 -0
- package/fesm2022/forty-cdk-date-field.mjs +744 -0
- package/fesm2022/forty-cdk-date-field.mjs.map +1 -0
- package/fesm2022/forty-cdk-date-picker.mjs +1011 -0
- package/fesm2022/forty-cdk-date-picker.mjs.map +1 -0
- package/fesm2022/forty-cdk-dialog.mjs +707 -0
- package/fesm2022/forty-cdk-dialog.mjs.map +1 -0
- package/fesm2022/forty-cdk-disclosure.mjs +190 -0
- package/fesm2022/forty-cdk-disclosure.mjs.map +1 -0
- package/fesm2022/forty-cdk-drag-drop.mjs +1180 -0
- package/fesm2022/forty-cdk-drag-drop.mjs.map +1 -0
- package/fesm2022/forty-cdk-drawer.mjs +1641 -0
- package/fesm2022/forty-cdk-drawer.mjs.map +1 -0
- package/fesm2022/forty-cdk-dropdown-menu.mjs +350 -0
- package/fesm2022/forty-cdk-dropdown-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-field.mjs +425 -0
- package/fesm2022/forty-cdk-field.mjs.map +1 -0
- package/fesm2022/forty-cdk-fieldset.mjs +164 -0
- package/fesm2022/forty-cdk-fieldset.mjs.map +1 -0
- package/fesm2022/forty-cdk-file-upload.mjs +221 -0
- package/fesm2022/forty-cdk-file-upload.mjs.map +1 -0
- package/fesm2022/forty-cdk-hover-card.mjs +496 -0
- package/fesm2022/forty-cdk-hover-card.mjs.map +1 -0
- package/fesm2022/forty-cdk-input.mjs +274 -0
- package/fesm2022/forty-cdk-input.mjs.map +1 -0
- package/fesm2022/forty-cdk-internationalized-date.mjs +1 -1
- package/fesm2022/forty-cdk-internationalized-date.mjs.map +1 -1
- package/fesm2022/forty-cdk-listbox.mjs +1279 -0
- package/fesm2022/forty-cdk-listbox.mjs.map +1 -0
- package/fesm2022/forty-cdk-menu.mjs +1439 -0
- package/fesm2022/forty-cdk-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-menubar.mjs +787 -0
- package/fesm2022/forty-cdk-menubar.mjs.map +1 -0
- package/fesm2022/forty-cdk-meter.mjs +211 -0
- package/fesm2022/forty-cdk-meter.mjs.map +1 -0
- package/fesm2022/forty-cdk-navigation-menu.mjs +1145 -0
- package/fesm2022/forty-cdk-navigation-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-number-input.mjs +559 -0
- package/fesm2022/forty-cdk-number-input.mjs.map +1 -0
- package/fesm2022/forty-cdk-otp-input.mjs +527 -0
- package/fesm2022/forty-cdk-otp-input.mjs.map +1 -0
- package/fesm2022/forty-cdk-pagination.mjs +323 -0
- package/fesm2022/forty-cdk-pagination.mjs.map +1 -0
- package/fesm2022/forty-cdk-pane-resizer.mjs +297 -0
- package/fesm2022/forty-cdk-pane-resizer.mjs.map +1 -0
- package/fesm2022/forty-cdk-popover.mjs +698 -0
- package/fesm2022/forty-cdk-popover.mjs.map +1 -0
- package/fesm2022/forty-cdk-progress.mjs +226 -0
- package/fesm2022/forty-cdk-progress.mjs.map +1 -0
- package/fesm2022/forty-cdk-radio-group.mjs +378 -0
- package/fesm2022/forty-cdk-radio-group.mjs.map +1 -0
- package/fesm2022/forty-cdk-scroll-area.mjs +640 -0
- package/fesm2022/forty-cdk-scroll-area.mjs.map +1 -0
- package/fesm2022/forty-cdk-search.mjs +205 -0
- package/fesm2022/forty-cdk-search.mjs.map +1 -0
- package/fesm2022/forty-cdk-select.mjs +1661 -0
- package/fesm2022/forty-cdk-select.mjs.map +1 -0
- package/fesm2022/forty-cdk-separator.mjs +82 -0
- package/fesm2022/forty-cdk-separator.mjs.map +1 -0
- package/fesm2022/forty-cdk-signal-forms.mjs +97 -0
- package/fesm2022/forty-cdk-signal-forms.mjs.map +1 -0
- package/fesm2022/forty-cdk-slider.mjs +803 -0
- package/fesm2022/forty-cdk-slider.mjs.map +1 -0
- package/fesm2022/forty-cdk-stepper.mjs +886 -0
- package/fesm2022/forty-cdk-stepper.mjs.map +1 -0
- package/fesm2022/forty-cdk-switch.mjs +137 -0
- package/fesm2022/forty-cdk-switch.mjs.map +1 -0
- package/fesm2022/forty-cdk-table.mjs +1518 -0
- package/fesm2022/forty-cdk-table.mjs.map +1 -0
- package/fesm2022/forty-cdk-tabs.mjs +400 -0
- package/fesm2022/forty-cdk-tabs.mjs.map +1 -0
- package/fesm2022/forty-cdk-time-field.mjs +593 -0
- package/fesm2022/forty-cdk-time-field.mjs.map +1 -0
- package/fesm2022/forty-cdk-time-picker.mjs +1013 -0
- package/fesm2022/forty-cdk-time-picker.mjs.map +1 -0
- package/fesm2022/forty-cdk-toast.mjs +1153 -0
- package/fesm2022/forty-cdk-toast.mjs.map +1 -0
- package/fesm2022/forty-cdk-toggle.mjs +516 -0
- package/fesm2022/forty-cdk-toggle.mjs.map +1 -0
- package/fesm2022/forty-cdk-toolbar.mjs +374 -0
- package/fesm2022/forty-cdk-toolbar.mjs.map +1 -0
- package/fesm2022/forty-cdk-tooltip.mjs +672 -0
- package/fesm2022/forty-cdk-tooltip.mjs.map +1 -0
- package/fesm2022/forty-cdk-tree.mjs +2007 -0
- package/fesm2022/forty-cdk-tree.mjs.map +1 -0
- package/fesm2022/forty-cdk-virtualization.mjs +1 -1
- package/fesm2022/forty-cdk-virtualization.mjs.map +1 -1
- package/fesm2022/forty-cdk.mjs +0 -43310
- package/fesm2022/forty-cdk.mjs.map +1 -1
- package/field/README.md +97 -0
- package/fieldset/README.md +86 -0
- package/file-upload/README.md +73 -0
- package/hover-card/README.md +171 -0
- package/input/README.md +156 -0
- package/listbox/README.md +424 -0
- package/menu/README.md +181 -0
- package/menubar/README.md +140 -0
- package/meter/README.md +128 -0
- package/navigation-menu/README.md +253 -0
- package/number-input/README.md +171 -0
- package/otp-input/README.md +198 -0
- package/package.json +213 -1
- package/pagination/README.md +61 -0
- package/pane-resizer/README.md +136 -0
- package/popover/README.md +262 -0
- package/progress/README.md +115 -0
- package/radio-group/README.md +129 -0
- package/scroll-area/README.md +184 -0
- package/search/README.md +42 -0
- package/select/README.md +488 -0
- package/separator/README.md +84 -0
- package/signal-forms/README.md +72 -0
- package/slider/README.md +152 -0
- package/stepper/README.md +292 -0
- package/switch/README.md +116 -0
- package/table/README.md +769 -0
- package/tabs/README.md +130 -0
- package/time-field/README.md +157 -0
- package/time-picker/README.md +172 -0
- package/toast/README.md +398 -0
- package/toggle/README.md +224 -0
- package/toolbar/README.md +109 -0
- package/tooltip/README.md +274 -0
- package/tree/README.md +708 -0
- package/types/forty-cdk-accordion.d.ts +242 -0
- package/types/forty-cdk-aspect-ratio.d.ts +59 -0
- package/types/forty-cdk-avatar.d.ts +133 -0
- package/types/forty-cdk-breadcrumbs.d.ts +92 -0
- package/types/forty-cdk-breakpoints.d.ts +141 -0
- package/types/forty-cdk-button.d.ts +80 -0
- package/types/forty-cdk-calendar.d.ts +914 -0
- package/types/forty-cdk-carousel.d.ts +530 -0
- package/types/forty-cdk-checkbox.d.ts +141 -0
- package/types/forty-cdk-combobox.d.ts +1259 -0
- package/types/forty-cdk-context-menu.d.ts +313 -0
- package/types/forty-cdk-core.d.ts +5774 -0
- package/types/forty-cdk-date-field.d.ts +307 -0
- package/types/forty-cdk-date-picker.d.ts +622 -0
- package/types/forty-cdk-dialog.d.ts +546 -0
- package/types/forty-cdk-disclosure.d.ts +127 -0
- package/types/forty-cdk-drag-drop.d.ts +456 -0
- package/types/forty-cdk-drawer.d.ts +871 -0
- package/types/forty-cdk-dropdown-menu.d.ts +242 -0
- package/types/forty-cdk-field.d.ts +236 -0
- package/types/forty-cdk-fieldset.d.ts +119 -0
- package/types/forty-cdk-file-upload.d.ts +124 -0
- package/types/forty-cdk-hover-card.d.ts +320 -0
- package/types/forty-cdk-input.d.ts +169 -0
- package/types/forty-cdk-internationalized-date.d.ts +1 -1
- package/types/forty-cdk-listbox.d.ts +513 -0
- package/types/forty-cdk-menu.d.ts +629 -0
- package/types/forty-cdk-menubar.d.ts +451 -0
- package/types/forty-cdk-meter.d.ts +122 -0
- package/types/forty-cdk-navigation-menu.d.ts +514 -0
- package/types/forty-cdk-number-input.d.ts +319 -0
- package/types/forty-cdk-otp-input.d.ts +248 -0
- package/types/forty-cdk-pagination.d.ts +214 -0
- package/types/forty-cdk-pane-resizer.d.ts +145 -0
- package/types/forty-cdk-popover.d.ts +509 -0
- package/types/forty-cdk-progress.d.ts +143 -0
- package/types/forty-cdk-radio-group.d.ts +222 -0
- package/types/forty-cdk-scroll-area.d.ts +258 -0
- package/types/forty-cdk-search.d.ts +142 -0
- package/types/forty-cdk-select.d.ts +899 -0
- package/types/forty-cdk-separator.d.ts +59 -0
- package/types/forty-cdk-signal-forms.d.ts +58 -0
- package/types/forty-cdk-slider.d.ts +379 -0
- package/types/forty-cdk-stepper.d.ts +650 -0
- package/types/forty-cdk-switch.d.ts +87 -0
- package/types/forty-cdk-table.d.ts +723 -0
- package/types/forty-cdk-tabs.d.ts +235 -0
- package/types/forty-cdk-time-field.d.ts +307 -0
- package/types/forty-cdk-time-picker.d.ts +578 -0
- package/types/forty-cdk-toast.d.ts +598 -0
- package/types/forty-cdk-toggle.d.ts +310 -0
- package/types/forty-cdk-toolbar.d.ts +217 -0
- package/types/forty-cdk-tooltip.d.ts +436 -0
- package/types/forty-cdk-tree.d.ts +688 -0
- package/types/forty-cdk.d.ts +1 -19743
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { InjectionToken, Signal, Provider } from '@angular/core';
|
|
3
|
+
import { WritingDirection, ListNavigationAction } from 'forty-cdk/core';
|
|
4
|
+
import * as forty_cdk_accordion from 'forty-cdk/accordion';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Registry entry for one `ForAccordionTrigger`. Triggers register their host
|
|
8
|
+
* element so the root can drive keyboard navigation over its own triggers
|
|
9
|
+
* without an unscoped DOM query that would leak into nested accordions.
|
|
10
|
+
*/
|
|
11
|
+
interface ForAccordionTriggerHandle {
|
|
12
|
+
readonly host: HTMLElement;
|
|
13
|
+
readonly disabled: Signal<boolean>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Coordination contract owned by the `ForAccordion` root.
|
|
17
|
+
* Items derive their state from this context; triggers route clicks and
|
|
18
|
+
* keyboard navigation through it.
|
|
19
|
+
*/
|
|
20
|
+
interface ForAccordionContext {
|
|
21
|
+
readonly multiple: Signal<boolean>;
|
|
22
|
+
readonly collapsible: Signal<boolean>;
|
|
23
|
+
readonly orientation: Signal<'horizontal' | 'vertical'>;
|
|
24
|
+
readonly dir: Signal<WritingDirection>;
|
|
25
|
+
isExpanded(itemValue: string): boolean;
|
|
26
|
+
toggle(itemValue: string): void;
|
|
27
|
+
/** Whether the given item is allowed to collapse right now. */
|
|
28
|
+
canCollapse(itemValue: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Focus a sibling trigger relative to the one currently focused. Disabled
|
|
31
|
+
* triggers are skipped. `currentTrigger` is the element from which the
|
|
32
|
+
* keyboard event originated. Navigation stays within this accordion's own
|
|
33
|
+
* registered triggers, so a nested accordion does not cross-contaminate.
|
|
34
|
+
*/
|
|
35
|
+
focusByOffset(currentTrigger: HTMLElement, action: ListNavigationAction): void;
|
|
36
|
+
registerTrigger(handle: ForAccordionTriggerHandle): void;
|
|
37
|
+
unregisterTrigger(handle: ForAccordionTriggerHandle): void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Per-item state contract. Provided by `ForAccordionItem`, consumed by
|
|
41
|
+
* its `ForAccordionTrigger` and `ForAccordionContent`.
|
|
42
|
+
*/
|
|
43
|
+
interface ForAccordionItemContext {
|
|
44
|
+
readonly expanded: Signal<boolean>;
|
|
45
|
+
readonly disabled: Signal<boolean>;
|
|
46
|
+
readonly value: Signal<string>;
|
|
47
|
+
readonly triggerId: Signal<string>;
|
|
48
|
+
readonly contentId: Signal<string>;
|
|
49
|
+
/** Adopts a consumer-set static `id` on the trigger host into `triggerId`. */
|
|
50
|
+
adoptTriggerId(el: HTMLElement): void;
|
|
51
|
+
/** Adopts a consumer-set static `id` on the content host into `contentId`. */
|
|
52
|
+
adoptContentId(el: HTMLElement): void;
|
|
53
|
+
toggle(): void;
|
|
54
|
+
}
|
|
55
|
+
declare const FOR_ACCORDION_CONTEXT: InjectionToken<ForAccordionContext>;
|
|
56
|
+
declare const FOR_ACCORDION_ITEM_CONTEXT: InjectionToken<ForAccordionItemContext>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Root of the Accordion primitive. Holds the open value(s) and orchestrates
|
|
60
|
+
* single/multiple expansion, collapse rules, and keyboard navigation between
|
|
61
|
+
* triggers.
|
|
62
|
+
*
|
|
63
|
+
* Implements the [WAI-ARIA Accordion pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/).
|
|
64
|
+
*
|
|
65
|
+
* State is modeled as `value: readonly string[]` regardless of mode:
|
|
66
|
+
* - In single mode (`multiple=false`, default), the array has 0 or 1 element.
|
|
67
|
+
* - In multiple mode, any number of items can be open.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```html
|
|
71
|
+
* <div forAccordion [(value)]="open" collapsible>
|
|
72
|
+
* <div forAccordionItem value="a">
|
|
73
|
+
* <h3><button type="button" forAccordionTrigger>A</button></h3>
|
|
74
|
+
* <section forAccordionContent>...</section>
|
|
75
|
+
* </div>
|
|
76
|
+
* <div forAccordionItem value="b">...</div>
|
|
77
|
+
* </div>
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
declare class ForAccordion implements ForAccordionContext {
|
|
81
|
+
#private;
|
|
82
|
+
/** When true, multiple items can be expanded simultaneously. */
|
|
83
|
+
readonly multiple: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
84
|
+
/**
|
|
85
|
+
* Single mode only: when true, the open item can be collapsed by clicking
|
|
86
|
+
* its trigger. When false, exactly one item stays open at all times once
|
|
87
|
+
* any has been opened.
|
|
88
|
+
*/
|
|
89
|
+
readonly collapsible: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
90
|
+
/**
|
|
91
|
+
* Layout direction of the trigger list. `'vertical'` (default) maps
|
|
92
|
+
* ArrowUp/Down to prev/next; `'horizontal'` maps ArrowLeft/Right (with RTL
|
|
93
|
+
* swap when `dir='rtl'`).
|
|
94
|
+
*/
|
|
95
|
+
readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
|
|
96
|
+
/**
|
|
97
|
+
* Writing direction. Only relevant when `orientation='horizontal'`. When
|
|
98
|
+
* unset (default `null`), the inherited ambient direction is resolved from
|
|
99
|
+
* the nearest ancestor carrying a `dir` attribute (or `<html dir>`),
|
|
100
|
+
* defaulting to `'ltr'`. An explicit `[dir]` always wins. The resolved
|
|
101
|
+
* value is reflected to the host `dir` attribute and drives arrow-key
|
|
102
|
+
* semantics.
|
|
103
|
+
*/
|
|
104
|
+
readonly _dirInput: _angular_core.InputSignal<WritingDirection | null>;
|
|
105
|
+
readonly dir: _angular_core.Signal<WritingDirection>;
|
|
106
|
+
/**
|
|
107
|
+
* When true (default), arrow navigation between triggers wraps at the ends —
|
|
108
|
+
* moving past the last trigger focuses the first and vice versa. Set `false`
|
|
109
|
+
* to stop at the boundaries. Mirrors the `loop` input on `ForTabs` and
|
|
110
|
+
* `ForListbox`.
|
|
111
|
+
*/
|
|
112
|
+
readonly loop: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
113
|
+
/**
|
|
114
|
+
* Two-way bindable. List of currently expanded item values. In single
|
|
115
|
+
* mode the array has 0 or 1 element. The `model()` change emitter
|
|
116
|
+
* (`(valueChange)`) fires only on internal toggles, never on consumer
|
|
117
|
+
* writes via `[(value)]` — observe transitions without binding back.
|
|
118
|
+
*/
|
|
119
|
+
readonly value: _angular_core.ModelSignal<readonly string[]>;
|
|
120
|
+
isExpanded(itemValue: string): boolean;
|
|
121
|
+
toggle(itemValue: string): void;
|
|
122
|
+
canCollapse(_itemValue: string): boolean;
|
|
123
|
+
focusByOffset(currentTrigger: HTMLElement, action: ListNavigationAction): void;
|
|
124
|
+
registerTrigger(handle: ForAccordionTriggerHandle): void;
|
|
125
|
+
unregisterTrigger(handle: ForAccordionTriggerHandle): void;
|
|
126
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForAccordion, never>;
|
|
127
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForAccordion, "[forAccordion]", ["forAccordion"], { "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "collapsible": { "alias": "collapsible"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "_dirInput": { "alias": "dir"; "required": false; "isSignal": true; }; "loop": { "alias": "loop"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* One section of a `ForAccordion`. Owns the unique `value` identifying this
|
|
132
|
+
* item to the root and exposes the per-item context that the trigger and
|
|
133
|
+
* content read.
|
|
134
|
+
*/
|
|
135
|
+
declare class ForAccordionItem implements ForAccordionItemContext {
|
|
136
|
+
#private;
|
|
137
|
+
protected readonly parent: forty_cdk_accordion.ForAccordionContext;
|
|
138
|
+
/** Unique identifier of this item within the accordion. Required. */
|
|
139
|
+
readonly value: _angular_core.InputSignal<string>;
|
|
140
|
+
/**
|
|
141
|
+
* When true, the trigger ignores clicks and reflects the native `disabled`
|
|
142
|
+
* attribute (not `aria-disabled`). The trigger is therefore dropped from the
|
|
143
|
+
* Tab order and skipped by arrow-key navigation, but stays in the
|
|
144
|
+
* accessibility tree so screen readers still announce it. See
|
|
145
|
+
* `ForAccordionTrigger` for the rationale (rule #561 D2).
|
|
146
|
+
*/
|
|
147
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
148
|
+
readonly triggerId: _angular_core.Signal<string>;
|
|
149
|
+
readonly contentId: _angular_core.Signal<string>;
|
|
150
|
+
readonly expanded: _angular_core.Signal<boolean>;
|
|
151
|
+
/**
|
|
152
|
+
* Adopts a consumer-set static `id` on the `[forAccordionTrigger]` host into
|
|
153
|
+
* `triggerId` (preserving anchors / external `aria-labelledby` references /
|
|
154
|
+
* label `for`) instead of letting the `[id]` host binding clobber it.
|
|
155
|
+
*/
|
|
156
|
+
adoptTriggerId(el: HTMLElement): void;
|
|
157
|
+
/** Adopts a consumer-set static `id` on the content host into `contentId`. */
|
|
158
|
+
adoptContentId(el: HTMLElement): void;
|
|
159
|
+
toggle(): void;
|
|
160
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForAccordionItem, never>;
|
|
161
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForAccordionItem, "[forAccordionItem]", ["forAccordionItem"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Header button for a `ForAccordionItem`. Apply on a `<button>` wrapped in a
|
|
166
|
+
* heading element (`<h2>`–`<h6>`) so APG landmark navigation works. The
|
|
167
|
+
* directive host-binds `type="button"` so a trigger inside a `<form>` never
|
|
168
|
+
* submits it on toggle.
|
|
169
|
+
*
|
|
170
|
+
* Handles ARIA wiring, click-to-toggle, and the recommended keyboard
|
|
171
|
+
* navigation (ArrowDown / ArrowUp / Home / End).
|
|
172
|
+
*
|
|
173
|
+
* `aria-controls` is emitted only while the item is expanded — mirroring the
|
|
174
|
+
* overlay triggers' open-only gating — so the reference never dangles at an
|
|
175
|
+
* unmounted panel under the recommended `@if (item.expanded())` mount pattern.
|
|
176
|
+
*/
|
|
177
|
+
declare class ForAccordionTrigger {
|
|
178
|
+
#private;
|
|
179
|
+
protected readonly parent: forty_cdk_accordion.ForAccordionContext;
|
|
180
|
+
protected readonly item: forty_cdk_accordion.ForAccordionItemContext;
|
|
181
|
+
/**
|
|
182
|
+
* APG: aria-disabled is true only when the panel is open AND the accordion
|
|
183
|
+
* disallows collapse. A real `disabled` item is reflected via the native
|
|
184
|
+
* `disabled` attribute instead — the sanctioned exception in rule #561 (D2):
|
|
185
|
+
* the trigger is a real single-purpose `<button>`, not a roving collection
|
|
186
|
+
* item (every trigger stays independently in the Tab order; the arrow-key
|
|
187
|
+
* navigation is an APG-optional enhancement layered on top, not a
|
|
188
|
+
* roving-tabindex collection), so native `disabled` is correct here. The
|
|
189
|
+
* button stays in the accessibility tree — screen readers still announce it
|
|
190
|
+
* as unavailable in browse mode — while being dropped from the Tab order and
|
|
191
|
+
* the arrow-key navigation (which `focusByOffset` already skips), keeping
|
|
192
|
+
* disabled triggers uniformly unreachable. The APG Accordion pattern does not
|
|
193
|
+
* require disabled headers to remain focusable.
|
|
194
|
+
*/
|
|
195
|
+
protected readonly ariaDisabled: _angular_core.Signal<boolean>;
|
|
196
|
+
constructor();
|
|
197
|
+
protected onKeyDown(event: KeyboardEvent): void;
|
|
198
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForAccordionTrigger, never>;
|
|
199
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForAccordionTrigger, "[forAccordionTrigger]", ["forAccordionTrigger"], {}, {}, never, never, true, never>;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Panel revealed by a `ForAccordionTrigger`. The directive does not manage
|
|
204
|
+
* DOM presence — wrap with `@if (item.expanded())` so panels mount and
|
|
205
|
+
* unmount with the expanded state and `animate.enter` / `animate.leave`
|
|
206
|
+
* work natively. If the consumer prefers to keep the panel mounted (for
|
|
207
|
+
* CSS-only transitions or to preserve internal state), the directive
|
|
208
|
+
* reflects `aria-hidden="true"` and `inert` while closed so the panel is
|
|
209
|
+
* removed from the accessibility tree and focus order automatically.
|
|
210
|
+
*
|
|
211
|
+
* APG note: `role="region"` adds the panel to the landmark navigation tree.
|
|
212
|
+
* If the accordion has 6+ simultaneously expandable panels, consider not
|
|
213
|
+
* using region — the directive will gain an opt-out input when this comes up
|
|
214
|
+
* in real usage.
|
|
215
|
+
*/
|
|
216
|
+
declare class ForAccordionContent {
|
|
217
|
+
protected readonly parent: forty_cdk_accordion.ForAccordionContext;
|
|
218
|
+
protected readonly item: forty_cdk_accordion.ForAccordionItemContext;
|
|
219
|
+
constructor();
|
|
220
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForAccordionContent, never>;
|
|
221
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForAccordionContent, "[forAccordionContent]", ["forAccordionContent"], {}, {}, never, never, true, never>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Defaults inherited by descendant accordions in the surrounding injector
|
|
226
|
+
* scope. Configure with `provideForAccordionDefaults`. The shape is a stub
|
|
227
|
+
* today — present so future per-scope tuning can land without churning the
|
|
228
|
+
* public surface.
|
|
229
|
+
*/
|
|
230
|
+
interface ForAccordionDefaults {
|
|
231
|
+
}
|
|
232
|
+
/** Token holding the resolved accordion defaults for the current scope. */
|
|
233
|
+
declare const FOR_ACCORDION_DEFAULTS: _angular_core.InjectionToken<ForAccordionDefaults>;
|
|
234
|
+
/**
|
|
235
|
+
* Configures forty-cdk accordion defaults for this injector scope. Partial
|
|
236
|
+
* overrides inherit unspecified keys from the parent scope (or library
|
|
237
|
+
* defaults at the root).
|
|
238
|
+
*/
|
|
239
|
+
declare function provideForAccordionDefaults(defaults?: Partial<ForAccordionDefaults>): Provider[];
|
|
240
|
+
|
|
241
|
+
export { FOR_ACCORDION_CONTEXT, FOR_ACCORDION_DEFAULTS, FOR_ACCORDION_ITEM_CONTEXT, ForAccordion, ForAccordionContent, ForAccordionItem, ForAccordionTrigger, provideForAccordionDefaults };
|
|
242
|
+
export type { ForAccordionContext, ForAccordionDefaults, ForAccordionItemContext };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Provider } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Headless aspect-ratio container. Locks the host element's box to a fixed
|
|
6
|
+
* `width / height` ratio via the native CSS `aspect-ratio` property — useful
|
|
7
|
+
* for media (video, image, iframe) and skeletons that must reserve space
|
|
8
|
+
* before content loads.
|
|
9
|
+
*
|
|
10
|
+
* The directive only writes the `aspect-ratio` style; sizing rules (width,
|
|
11
|
+
* max-width, background, etc.) stay with the consumer.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <div forAspectRatio [ratio]="16 / 9">
|
|
16
|
+
* <img src="cover.jpg" alt="" />
|
|
17
|
+
* </div>
|
|
18
|
+
*
|
|
19
|
+
* <div forAspectRatio ratio="1"> <!-- square -->
|
|
20
|
+
* <video src="clip.mp4" controls></video>
|
|
21
|
+
* </div>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare class ForAspectRatio {
|
|
25
|
+
/**
|
|
26
|
+
* Width / height ratio, e.g. `16 / 9`, `4 / 3`, `1`. Accepts numeric inputs
|
|
27
|
+
* (`[ratio]="16 / 9"`) and string attributes (`ratio="1.5"`). Defaults to
|
|
28
|
+
* `1` (square). Non-positive or non-finite values fall back to `1` so the
|
|
29
|
+
* host never emits an invalid `aspect-ratio`.
|
|
30
|
+
*/
|
|
31
|
+
readonly ratio: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* The host `aspect-ratio` style value, guarded so a `0`, negative, or
|
|
34
|
+
* non-finite `ratio` never produces invalid CSS — it falls back to `1`.
|
|
35
|
+
*/
|
|
36
|
+
protected readonly resolvedRatio: _angular_core.Signal<string>;
|
|
37
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForAspectRatio, never>;
|
|
38
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForAspectRatio, "[forAspectRatio]", ["forAspectRatio"], { "ratio": { "alias": "ratio"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Defaults inherited by descendant aspect-ratio containers in the surrounding
|
|
43
|
+
* injector scope. Configure with `provideForAspectRatioDefaults`. The shape
|
|
44
|
+
* is a stub today — present so future per-scope tuning can land without
|
|
45
|
+
* churning the public surface.
|
|
46
|
+
*/
|
|
47
|
+
interface ForAspectRatioDefaults {
|
|
48
|
+
}
|
|
49
|
+
/** Token holding the resolved aspect-ratio defaults for the current scope. */
|
|
50
|
+
declare const FOR_ASPECT_RATIO_DEFAULTS: _angular_core.InjectionToken<ForAspectRatioDefaults>;
|
|
51
|
+
/**
|
|
52
|
+
* Configures forty-cdk aspect-ratio defaults for this injector scope. Partial
|
|
53
|
+
* overrides inherit unspecified keys from the parent scope (or library
|
|
54
|
+
* defaults at the root).
|
|
55
|
+
*/
|
|
56
|
+
declare function provideForAspectRatioDefaults(defaults?: Partial<ForAspectRatioDefaults>): Provider[];
|
|
57
|
+
|
|
58
|
+
export { FOR_ASPECT_RATIO_DEFAULTS, ForAspectRatio, provideForAspectRatioDefaults };
|
|
59
|
+
export type { ForAspectRatioDefaults };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Signal, Provider } from '@angular/core';
|
|
3
|
+
import * as forty_cdk_avatar from 'forty-cdk/avatar';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Lifecycle stages of the avatar's image:
|
|
7
|
+
* - `idle`: no `src` set yet.
|
|
8
|
+
* - `loading`: `src` set, waiting for the network.
|
|
9
|
+
* - `loaded`: image rendered successfully.
|
|
10
|
+
* - `error`: image failed to load.
|
|
11
|
+
*/
|
|
12
|
+
type ForAvatarStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
13
|
+
interface ForAvatarContext {
|
|
14
|
+
/** Current status of the avatar's image. */
|
|
15
|
+
readonly status: Signal<ForAvatarStatus>;
|
|
16
|
+
/**
|
|
17
|
+
* `true` when the consumer should render the fallback. Drives `@if` in
|
|
18
|
+
* the consumer's template. Honors `fallbackDelayMs` for `idle` / `loading`
|
|
19
|
+
* states; `error` flips it to `true` immediately.
|
|
20
|
+
*/
|
|
21
|
+
readonly shouldShowFallback: Signal<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* Internal — reported by `[forAvatarImage]` so the root can transition
|
|
24
|
+
* its state machine. Consumers should not call this.
|
|
25
|
+
*/
|
|
26
|
+
reportStatus(status: ForAvatarStatus): void;
|
|
27
|
+
}
|
|
28
|
+
declare const FOR_AVATAR_CONTEXT: InjectionToken<ForAvatarContext>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Headless avatar root. Tracks the load lifecycle of an inner
|
|
32
|
+
* `[forAvatarImage]` and exposes `status` + `shouldShowFallback` so the
|
|
33
|
+
* consumer can swap the image for fallback content (initials, generic icon)
|
|
34
|
+
* via `@if`.
|
|
35
|
+
*
|
|
36
|
+
* No ARIA role is imposed — avatars are typically presentational. If the
|
|
37
|
+
* surrounding component conveys identity (a person's name in the header,
|
|
38
|
+
* a chat bubble), the consumer should provide an `aria-label` on the
|
|
39
|
+
* relevant ancestor or pair the avatar with visible text.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```html
|
|
43
|
+
* <span forAvatar #a="forAvatar" fallbackDelayMs="500">
|
|
44
|
+
* <img forAvatarImage [src]="user.avatarUrl" [alt]="user.name" />
|
|
45
|
+
* @if (a.shouldShowFallback()) {
|
|
46
|
+
* <span forAvatarFallback>{{ user.initials }}</span>
|
|
47
|
+
* }
|
|
48
|
+
* </span>
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare class ForAvatar implements ForAvatarContext {
|
|
52
|
+
#private;
|
|
53
|
+
/**
|
|
54
|
+
* Milliseconds to defer the fallback for fast loads, avoiding a brief
|
|
55
|
+
* "initials → image" flicker. Set to `0` (default) to show immediately
|
|
56
|
+
* during `idle` / `loading`, or to e.g. `500` to skip rendering during
|
|
57
|
+
* quick cached loads. `error` always shows the fallback immediately.
|
|
58
|
+
* The default is read from `provideForAvatarDefaults` for the
|
|
59
|
+
* surrounding scope.
|
|
60
|
+
*/
|
|
61
|
+
readonly fallbackDelayMs: i0.InputSignalWithTransform<number, unknown>;
|
|
62
|
+
readonly status: i0.Signal<ForAvatarStatus>;
|
|
63
|
+
readonly shouldShowFallback: i0.Signal<boolean>;
|
|
64
|
+
constructor();
|
|
65
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ForAvatar, never>;
|
|
66
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ForAvatar, "[forAvatar]", ["forAvatar"], { "fallbackDelayMs": { "alias": "fallbackDelayMs"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Wraps an `<img>` and reports its load lifecycle to the surrounding
|
|
71
|
+
* `[forAvatar]`. The native `src` / `alt` bindings are owned by the
|
|
72
|
+
* consumer — this directive only observes.
|
|
73
|
+
*
|
|
74
|
+
* Reflects `data-status` on the image element so the consumer can hide it
|
|
75
|
+
* via CSS while loading or after an error (e.g. `img[data-status="error"]
|
|
76
|
+
* { display: none }`).
|
|
77
|
+
*/
|
|
78
|
+
declare class ForAvatarImage {
|
|
79
|
+
#private;
|
|
80
|
+
/**
|
|
81
|
+
* Emits whenever the image lifecycle transitions to a new state. Useful
|
|
82
|
+
* if the consumer wants to log analytics, swap to a different src on
|
|
83
|
+
* error, etc.
|
|
84
|
+
*/
|
|
85
|
+
readonly loadStatusChanged: i0.OutputEmitterRef<ForAvatarStatus>;
|
|
86
|
+
constructor();
|
|
87
|
+
protected status(): ForAvatarStatus;
|
|
88
|
+
protected onLoad(): void;
|
|
89
|
+
protected onError(): void;
|
|
90
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ForAvatarImage, never>;
|
|
91
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ForAvatarImage, "img[forAvatarImage]", ["forAvatarImage"], {}, { "loadStatusChanged": "loadStatusChanged"; }, never, never, true, never>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Marker for the avatar's fallback content (initials, generic icon, …).
|
|
96
|
+
* Reflects `data-status` from the parent `[forAvatar]` so the consumer can
|
|
97
|
+
* style for the `error` state separately from `idle` / `loading` if needed.
|
|
98
|
+
*
|
|
99
|
+
* The decision of *whether* to render the fallback lives on the root —
|
|
100
|
+
* drive `@if` with `forAvatar.shouldShowFallback()`.
|
|
101
|
+
*/
|
|
102
|
+
declare class ForAvatarFallback {
|
|
103
|
+
protected readonly parent: forty_cdk_avatar.ForAvatarContext;
|
|
104
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ForAvatarFallback, never>;
|
|
105
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ForAvatarFallback, "[forAvatarFallback]", ["forAvatarFallback"], {}, {}, never, never, true, never>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Defaults inherited by descendant avatars in the surrounding injector
|
|
110
|
+
* scope. Configure with `provideForAvatarDefaults` either at the
|
|
111
|
+
* application root or in any component's `providers` array; partial
|
|
112
|
+
* overrides merge with the parent scope.
|
|
113
|
+
*/
|
|
114
|
+
interface ForAvatarDefaults {
|
|
115
|
+
/**
|
|
116
|
+
* Milliseconds to defer the fallback for fast loads, avoiding a brief
|
|
117
|
+
* "initials → image" flicker. Set to `0` to show immediately during
|
|
118
|
+
* `idle` / `loading`, or to e.g. `500` to skip rendering during quick
|
|
119
|
+
* cached loads. `error` always shows the fallback immediately.
|
|
120
|
+
*/
|
|
121
|
+
fallbackDelayMs: number;
|
|
122
|
+
}
|
|
123
|
+
/** Token holding the resolved avatar defaults for the current scope. */
|
|
124
|
+
declare const FOR_AVATAR_DEFAULTS: i0.InjectionToken<ForAvatarDefaults>;
|
|
125
|
+
/**
|
|
126
|
+
* Configures forty-cdk avatar defaults for this injector scope. Partial
|
|
127
|
+
* overrides inherit unspecified keys from the parent scope (or library
|
|
128
|
+
* defaults at the root).
|
|
129
|
+
*/
|
|
130
|
+
declare function provideForAvatarDefaults(defaults?: Partial<ForAvatarDefaults>): Provider[];
|
|
131
|
+
|
|
132
|
+
export { FOR_AVATAR_CONTEXT, FOR_AVATAR_DEFAULTS, ForAvatar, ForAvatarFallback, ForAvatarImage, provideForAvatarDefaults };
|
|
133
|
+
export type { ForAvatarContext, ForAvatarDefaults, ForAvatarStatus };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Provider } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Headless breadcrumb trail implementing the
|
|
6
|
+
* [WAI-ARIA Breadcrumb pattern](https://www.w3.org/WAI/ARIA/apg/patterns/breadcrumb/):
|
|
7
|
+
* a `navigation` landmark wrapping a set of links that reveal the page's
|
|
8
|
+
* position within the site hierarchy.
|
|
9
|
+
*
|
|
10
|
+
* The directive contributes only the landmark role + accessible name; the
|
|
11
|
+
* consumer owns the markup structure (an `<ol>` of `<li>` links is the APG
|
|
12
|
+
* recommendation) and applies their own styles. Each link decorated with
|
|
13
|
+
* `[forBreadcrumbItem]` can mark itself the current page via `current`, and
|
|
14
|
+
* visual dividers decorated with `[forBreadcrumbSeparator]` are hidden from
|
|
15
|
+
* assistive technology.
|
|
16
|
+
*
|
|
17
|
+
* There is no keyboard interaction or focus management beyond what the native
|
|
18
|
+
* links provide — breadcrumb links are ordinary tab stops.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```html
|
|
22
|
+
* <nav forBreadcrumbs>
|
|
23
|
+
* <ol>
|
|
24
|
+
* <li><a forBreadcrumbItem href="/">Home</a></li>
|
|
25
|
+
* <li forBreadcrumbSeparator aria-hidden="true">/</li>
|
|
26
|
+
* <li><a forBreadcrumbItem href="/library">Library</a></li>
|
|
27
|
+
* <li forBreadcrumbSeparator aria-hidden="true">/</li>
|
|
28
|
+
* <li><a forBreadcrumbItem href="/library/data" current>Data</a></li>
|
|
29
|
+
* </ol>
|
|
30
|
+
* </nav>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare class ForBreadcrumbs {
|
|
34
|
+
/**
|
|
35
|
+
* Accessible label for the navigation landmark. Defaults to `'Breadcrumb'`
|
|
36
|
+
* so a bare `<nav forBreadcrumbs>` is already a correctly labelled landmark —
|
|
37
|
+
* the conventional name for this pattern. Override it (or point a native
|
|
38
|
+
* `aria-labelledby` at a visible heading) when the page hosts more than one
|
|
39
|
+
* breadcrumb trail and they need to be told apart.
|
|
40
|
+
*/
|
|
41
|
+
readonly ariaLabel: i0.InputSignal<string | null>;
|
|
42
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ForBreadcrumbs, never>;
|
|
43
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ForBreadcrumbs, "[forBreadcrumbs]", ["forBreadcrumbs"], { "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A single link within a breadcrumb trail. Apply on an `<a>` so navigation is
|
|
48
|
+
* native. Set `current` on the link that points to the page the user is on —
|
|
49
|
+
* it reflects [`aria-current="page"`](https://www.w3.org/TR/wai-aria-1.2/#aria-current)
|
|
50
|
+
* so assistive technology announces it as the current location.
|
|
51
|
+
*/
|
|
52
|
+
declare class ForBreadcrumbItem {
|
|
53
|
+
/**
|
|
54
|
+
* Whether this item represents the page the user is currently on. The
|
|
55
|
+
* current item reflects `aria-current="page"`; all others emit no
|
|
56
|
+
* `aria-current` attribute.
|
|
57
|
+
*/
|
|
58
|
+
readonly current: i0.InputSignalWithTransform<boolean, unknown>;
|
|
59
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ForBreadcrumbItem, never>;
|
|
60
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ForBreadcrumbItem, "[forBreadcrumbItem]", ["forBreadcrumbItem"], { "current": { "alias": "current"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Decorative divider rendered between breadcrumb items (a `/`, `>`, chevron,
|
|
65
|
+
* etc.). Reflects `aria-hidden="true"` so assistive technology skips it — the
|
|
66
|
+
* trail's structure is already conveyed by the list and the links, making the
|
|
67
|
+
* visual separator redundant in the accessibility tree.
|
|
68
|
+
*/
|
|
69
|
+
declare class ForBreadcrumbSeparator {
|
|
70
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ForBreadcrumbSeparator, never>;
|
|
71
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ForBreadcrumbSeparator, "[forBreadcrumbSeparator]", ["forBreadcrumbSeparator"], {}, {}, never, never, true, never>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Defaults inherited by descendant breadcrumbs in the surrounding injector
|
|
76
|
+
* scope. Configure with `provideForBreadcrumbsDefaults`. The shape is a stub
|
|
77
|
+
* today — present so future per-scope tuning can land without churning the
|
|
78
|
+
* public surface.
|
|
79
|
+
*/
|
|
80
|
+
interface ForBreadcrumbsDefaults {
|
|
81
|
+
}
|
|
82
|
+
/** Token holding the resolved breadcrumbs defaults for the current scope. */
|
|
83
|
+
declare const FOR_BREADCRUMBS_DEFAULTS: i0.InjectionToken<ForBreadcrumbsDefaults>;
|
|
84
|
+
/**
|
|
85
|
+
* Configures forty-cdk breadcrumbs defaults for this injector scope. Partial
|
|
86
|
+
* overrides inherit unspecified keys from the parent scope (or library
|
|
87
|
+
* defaults at the root).
|
|
88
|
+
*/
|
|
89
|
+
declare function provideForBreadcrumbsDefaults(defaults?: Partial<ForBreadcrumbsDefaults>): Provider[];
|
|
90
|
+
|
|
91
|
+
export { FOR_BREADCRUMBS_DEFAULTS, ForBreadcrumbItem, ForBreadcrumbSeparator, ForBreadcrumbs, provideForBreadcrumbsDefaults };
|
|
92
|
+
export type { ForBreadcrumbsDefaults };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Provider, Signal } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A breakpoint map: each named breakpoint paired with its `min-width`
|
|
6
|
+
* threshold in CSS pixels. Names are arbitrary — `injectBreakpoints` derives
|
|
7
|
+
* its query methods (`up`, `down`, `between`, `only`) from whatever keys this
|
|
8
|
+
* map declares, sorted ascending by threshold.
|
|
9
|
+
*/
|
|
10
|
+
type BreakpointMap = Record<string, number>;
|
|
11
|
+
/**
|
|
12
|
+
* The default breakpoint map, mirroring Tailwind CSS's `sm`–`2xl` scale. Used
|
|
13
|
+
* as the library fallback when no `provideForBreakpoints` is in scope, and the
|
|
14
|
+
* source of the typed breakpoint names when the consumer has not augmented
|
|
15
|
+
* {@link BreakpointRegistry}.
|
|
16
|
+
*/
|
|
17
|
+
declare const breakpointsTailwind: {
|
|
18
|
+
readonly sm: 640;
|
|
19
|
+
readonly md: 768;
|
|
20
|
+
readonly lg: 1024;
|
|
21
|
+
readonly xl: 1280;
|
|
22
|
+
readonly '2xl': 1536;
|
|
23
|
+
};
|
|
24
|
+
/** The breakpoint names from the default Tailwind scale. */
|
|
25
|
+
type TailwindBreakpointName = keyof typeof breakpointsTailwind;
|
|
26
|
+
/** Resolved shape stored against {@link FOR_BREAKPOINTS}. */
|
|
27
|
+
interface ForBreakpointsDefaults {
|
|
28
|
+
/** The active breakpoint map for the current injector scope. */
|
|
29
|
+
breakpoints: BreakpointMap;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Token holding the resolved breakpoint map for the current injector scope.
|
|
33
|
+
* The library always provides a fully-populated value (the Tailwind fallback
|
|
34
|
+
* at the root, or the map from the nearest `provideForBreakpoints`).
|
|
35
|
+
*/
|
|
36
|
+
declare const FOR_BREAKPOINTS: _angular_core.InjectionToken<ForBreakpointsDefaults>;
|
|
37
|
+
/**
|
|
38
|
+
* Configures the breakpoint map for this injector scope so `injectBreakpoints`
|
|
39
|
+
* can be called with no arguments. Provide it once in your application config:
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* providers: [
|
|
43
|
+
* provideForBreakpoints({ mobile: 0, tablet: 640, laptop: 1024, desktop: 1280 }),
|
|
44
|
+
* ]
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* Providing it again on a component injector replaces the map for that subtree
|
|
48
|
+
* only (the nearest scope wins; the map is replaced wholesale, never merged
|
|
49
|
+
* key-by-key). Omit it entirely to use {@link breakpointsTailwind}.
|
|
50
|
+
*/
|
|
51
|
+
declare function provideForBreakpoints(breakpoints: BreakpointMap): Provider[];
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Extension point for typing custom breakpoint names. Augment it via module
|
|
55
|
+
* declaration merging so `injectBreakpoints` autocompletes your own names
|
|
56
|
+
* instead of the default Tailwind scale:
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* import type { appBreakpoints } from './breakpoints';
|
|
60
|
+
*
|
|
61
|
+
* declare module 'forty-cdk' {
|
|
62
|
+
* interface BreakpointRegistry extends Record<keyof typeof appBreakpoints, true> {}
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* When left empty (no augmentation), {@link BreakpointName} falls back to the
|
|
67
|
+
* keys of {@link breakpointsTailwind}.
|
|
68
|
+
*/
|
|
69
|
+
interface BreakpointRegistry {
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The set of valid breakpoint names. Resolves to the augmented
|
|
73
|
+
* {@link BreakpointRegistry} keys when present, otherwise the Tailwind scale
|
|
74
|
+
* (`'sm' | 'md' | 'lg' | 'xl' | '2xl'`).
|
|
75
|
+
*/
|
|
76
|
+
type BreakpointName = [keyof BreakpointRegistry] extends [never] ? TailwindBreakpointName : keyof BreakpointRegistry & string;
|
|
77
|
+
/** Reactive handle returned by {@link injectBreakpoints}. */
|
|
78
|
+
interface ForBreakpoints<K extends string = BreakpointName> {
|
|
79
|
+
/**
|
|
80
|
+
* Matches the named breakpoint and wider — `(min-width: <threshold>px)`.
|
|
81
|
+
* @param name A breakpoint declared in the active map.
|
|
82
|
+
*/
|
|
83
|
+
up(name: K): Signal<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Matches narrower than the named breakpoint —
|
|
86
|
+
* `(max-width: <threshold - 0.02>px)`. The 0.02px back-off keeps `up(name)`
|
|
87
|
+
* and `down(name)` from both matching at the exact threshold.
|
|
88
|
+
* @param name A breakpoint declared in the active map.
|
|
89
|
+
*/
|
|
90
|
+
down(name: K): Signal<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Matches from `min` (inclusive) up to but not including `max`.
|
|
93
|
+
* @param min Lower breakpoint, inclusive.
|
|
94
|
+
* @param max Upper breakpoint, exclusive.
|
|
95
|
+
*/
|
|
96
|
+
between(min: K, max: K): Signal<boolean>;
|
|
97
|
+
/**
|
|
98
|
+
* Matches only the named breakpoint's own band — from its threshold up to
|
|
99
|
+
* but not including the next-larger breakpoint (open-ended for the largest).
|
|
100
|
+
* @param name A breakpoint declared in the active map.
|
|
101
|
+
*/
|
|
102
|
+
only(name: K): Signal<boolean>;
|
|
103
|
+
/**
|
|
104
|
+
* The largest breakpoint whose `min-width` currently matches, or `null` when
|
|
105
|
+
* the viewport is narrower than the smallest breakpoint (and on the server).
|
|
106
|
+
*/
|
|
107
|
+
readonly active: Signal<K | null>;
|
|
108
|
+
/**
|
|
109
|
+
* Escape hatch for an arbitrary media query string (orientation, pointer,
|
|
110
|
+
* `prefers-color-scheme`, …) that the named helpers don't cover.
|
|
111
|
+
* @param query Any valid media query.
|
|
112
|
+
*/
|
|
113
|
+
matches(query: string): Signal<boolean>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A signal-first, zoneless, SSR-safe viewport breakpoint observer. Reads the
|
|
117
|
+
* breakpoint map from the ambient {@link FOR_BREAKPOINTS} token (configured
|
|
118
|
+
* with `provideForBreakpoints`, or the Tailwind fallback), so call sites never
|
|
119
|
+
* repeat the breakpoint set:
|
|
120
|
+
*
|
|
121
|
+
* ```ts
|
|
122
|
+
* private bp = injectBreakpoints();
|
|
123
|
+
* protected isDesktop = this.bp.up('desktop');
|
|
124
|
+
* protected active = this.bp.active;
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* Each query method returns a `Signal<boolean>` backed by a cached
|
|
128
|
+
* `MediaQueryList`. The returned handle captures the calling injection
|
|
129
|
+
* context, so its methods can be invoked lazily from `computed()` or a
|
|
130
|
+
* template — not only during construction. Listeners are torn down with the
|
|
131
|
+
* injector. On the server (or where `matchMedia` is unavailable) every signal
|
|
132
|
+
* reads `false` and `active` reads `null`.
|
|
133
|
+
*
|
|
134
|
+
* Must be called from an injection context.
|
|
135
|
+
*
|
|
136
|
+
* @returns A {@link ForBreakpoints} handle of reactive query methods.
|
|
137
|
+
*/
|
|
138
|
+
declare function injectBreakpoints(): ForBreakpoints;
|
|
139
|
+
|
|
140
|
+
export { FOR_BREAKPOINTS, breakpointsTailwind, injectBreakpoints, provideForBreakpoints };
|
|
141
|
+
export type { BreakpointMap, BreakpointName, BreakpointRegistry, ForBreakpoints, ForBreakpointsDefaults };
|