@cocoar/ui 0.1.0-beta.99 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +21 -11
  2. package/fesm2022/cocoar-ui-components.mjs +9549 -0
  3. package/fesm2022/cocoar-ui-components.mjs.map +1 -0
  4. package/fesm2022/cocoar-ui-menu.mjs +1082 -0
  5. package/fesm2022/cocoar-ui-menu.mjs.map +1 -0
  6. package/fesm2022/cocoar-ui-overlay.mjs +1284 -0
  7. package/fesm2022/cocoar-ui-overlay.mjs.map +1 -0
  8. package/fesm2022/cocoar-ui.mjs +8 -0
  9. package/fesm2022/cocoar-ui.mjs.map +1 -0
  10. package/llms-full.txt +2303 -0
  11. package/llms.txt +82 -0
  12. package/package.json +38 -19
  13. package/styles/all.css +9 -0
  14. package/styles/components.css +127 -0
  15. package/styles/tokens/all.css +38 -0
  16. package/styles/tokens/code-block.css +72 -0
  17. package/styles/tokens/colors-primitives-dark.css +84 -0
  18. package/styles/tokens/colors-primitives-light.css +75 -0
  19. package/styles/tokens/colors-usage.css +272 -0
  20. package/styles/tokens/components-shared.css +42 -0
  21. package/styles/tokens/elevation.css +30 -0
  22. package/styles/tokens/focus.css +30 -0
  23. package/styles/tokens/layers.css +17 -0
  24. package/styles/tokens/menu.css +53 -0
  25. package/styles/tokens/motion.css +93 -0
  26. package/styles/tokens/new-components.css +104 -0
  27. package/styles/tokens/radius.css +15 -0
  28. package/styles/tokens/select-overlay.css +40 -0
  29. package/styles/tokens/shadows.css +38 -0
  30. package/styles/tokens/sidebar.css +67 -0
  31. package/styles/tokens/spacing.css +16 -0
  32. package/styles/tokens/stroke-width.css +12 -0
  33. package/styles/tokens/type-primitives.css +23 -0
  34. package/styles/tokens/typography-responsive.css +44 -0
  35. package/styles/tokens/typography.css +41 -0
  36. package/types/cocoar-ui-components.d.ts +3719 -0
  37. package/types/cocoar-ui-menu.d.ts +326 -0
  38. package/types/cocoar-ui-overlay.d.ts +301 -0
  39. package/types/cocoar-ui.d.ts +3 -0
  40. package/src/index.d.ts +0 -4
  41. package/src/index.d.ts.map +0 -1
  42. package/src/index.js +0 -5
  43. package/src/index.js.map +0 -1
@@ -0,0 +1,326 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { InjectionToken, TemplateRef } from '@angular/core';
3
+
4
+ interface CoarMenuAimConfig {
5
+ readonly enabled: boolean;
6
+ /** Emits debug events consumed by the showcase to render the aim triangle overlay. */
7
+ readonly debugEnabled: boolean;
8
+ /** Delay before switching to a newly hovered sibling submenu when aim is detected. */
9
+ readonly switchDelayMs: number;
10
+ /** Maximum age of the last pointer sample used for intent detection. */
11
+ readonly sampleMaxAgeMs: number;
12
+ }
13
+ interface CoarMenuAimConfigProvider {
14
+ getMenuAimConfig(): CoarMenuAimConfig;
15
+ }
16
+ declare const DEFAULT_COAR_MENU_AIM_CONFIG: CoarMenuAimConfig;
17
+ declare const COAR_MENU_AIM_CONFIG: InjectionToken<CoarMenuAimConfigProvider>;
18
+
19
+ declare class CoarMenuAimConfigDirective implements CoarMenuAimConfigProvider {
20
+ private readonly parent;
21
+ /** Enable/disable menu-aim for this menu tree. */
22
+ readonly aimEnabled: _angular_core.InputSignal<boolean | undefined>;
23
+ /** Emit debug events for menu-aim visualization (showcase only). */
24
+ readonly aimDebugEnabled: _angular_core.InputSignal<boolean | undefined>;
25
+ /** Delay before switching to a newly hovered sibling submenu when aim is detected. */
26
+ readonly aimSwitchDelayMs: _angular_core.InputSignal<number | undefined>;
27
+ /** Maximum age of the last pointer sample used for intent detection. */
28
+ readonly aimSampleMaxAgeMs: _angular_core.InputSignal<number | undefined>;
29
+ getMenuAimConfig(): CoarMenuAimConfig;
30
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CoarMenuAimConfigDirective, never>;
31
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CoarMenuAimConfigDirective, "[coarMenuAimConfig]", never, { "aimEnabled": { "alias": "aimEnabled"; "required": false; "isSignal": true; }; "aimDebugEnabled": { "alias": "aimDebugEnabled"; "required": false; "isSignal": true; }; "aimSwitchDelayMs": { "alias": "aimSwitchDelayMs"; "required": false; "isSignal": true; }; "aimSampleMaxAgeMs": { "alias": "aimSampleMaxAgeMs"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
32
+ }
33
+
34
+ /**
35
+ * CoarMenu: Shell component providing menu styling container.
36
+ *
37
+ * Responsibilities:
38
+ * - Apply consistent menu styling via CSS variables
39
+ * - Provide semantic menu container (<menu> or <div role="menu">)
40
+ * - Provide root cascade for sibling submenu tracking
41
+ * - No logic - just a styled wrapper
42
+ *
43
+ * Use standalone for inline menus, or as overlay content (via `createOverlayBuilder`) for context menus/flyouts.
44
+ *
45
+ * @example
46
+ * ```html
47
+ * <coar-menu>
48
+ * <coar-menu-item>Action 1</coar-menu-item>
49
+ * <coar-menu-item>Action 2</coar-menu-item>
50
+ * <coar-menu-divider></coar-menu-divider>
51
+ * <coar-menu-item>Action 3</coar-menu-item>
52
+ * </coar-menu>
53
+ * ```
54
+ */
55
+ declare class CoarMenuComponent {
56
+ private readonly overlayRef;
57
+ /**
58
+ * Controls whether the menu reserves and renders an icon column.
59
+ *
60
+ * Default is enabled to avoid layout shift for stateful icons (e.g. checkmarks).
61
+ * Set to false for text-only menus (icons will not render).
62
+ */
63
+ readonly showIconColumn: _angular_core.InputSignal<boolean>;
64
+ /**
65
+ * Removes border, background, border-radius, and shadow for seamless embedding in containers.
66
+ *
67
+ * Use when embedding menu in sidebars, panels, or custom containers that provide their own styling.
68
+ * Use as boolean attribute: `<coar-menu borderless>` or `[borderless]="true"`
69
+ */
70
+ readonly borderless: _angular_core.InputSignalWithTransform<boolean, unknown>;
71
+ /**
72
+ * Check if this menu is rendered inside an overlay (flyout).
73
+ * Used to enable border visibility for menu items.
74
+ */
75
+ protected isInOverlay(): boolean;
76
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CoarMenuComponent, never>;
77
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CoarMenuComponent, "coar-menu", never, { "showIconColumn": { "alias": "showIconColumn"; "required": false; "isSignal": true; }; "borderless": { "alias": "borderless"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, [{ directive: typeof CoarMenuAimConfigDirective; inputs: { "aimEnabled": "aimEnabled"; "aimDebugEnabled": "aimDebugEnabled"; "aimSwitchDelayMs": "aimSwitchDelayMs"; "aimSampleMaxAgeMs": "aimSampleMaxAgeMs"; }; outputs: {}; }]>;
78
+ }
79
+
80
+ /**
81
+ * Event emitted when a menu item is clicked.
82
+ * Provides control over menu closing behavior.
83
+ */
84
+ interface CoarMenuItemClickEvent {
85
+ /** Call this to keep the menu open after clicking (prevents auto-close) */
86
+ keepMenuOpen(): void;
87
+ /** Original mouse event */
88
+ event: MouseEvent;
89
+ }
90
+ /**
91
+ * CoarMenuItem: Individual menu item with optional icon and submenu support.
92
+ *
93
+ * Responsibilities:
94
+ * - Render item text and optional icon
95
+ * - Handle click events
96
+ * - Support disabled state
97
+ * - Visual states: hover, active, focus
98
+ * - Trigger submenu (accordion or flyout via parent menu logic)
99
+ *
100
+ * Does NOT manage overlay directly - parent menu handles flyout logic.
101
+ *
102
+ * @example
103
+ * ```html
104
+ * <coar-menu-item (clicked)="onSave()">Save</coar-menu-item>
105
+ * <coar-menu-item icon="copy">Copy</coar-menu-item>
106
+ * <coar-menu-item [disabled]="true">Unavailable</coar-menu-item>
107
+ *
108
+ * <!-- Prevent menu from closing on click: -->
109
+ * <coar-menu-item (clicked)="toggle($event)">Toggle Setting</coar-menu-item>
110
+ *
111
+ * toggle(event: CoarMenuItemClickEvent) {
112
+ * event.keepMenuOpen(); // Keep menu open
113
+ * this.setting = !this.setting;
114
+ * }
115
+ * ```
116
+ */
117
+ declare class CoarMenuItemComponent {
118
+ private readonly parentOverlay;
119
+ /** Item text content */
120
+ readonly label: _angular_core.InputSignal<string | undefined>;
121
+ /** Optional icon identifier (rendered via CoarIconComponent) */
122
+ readonly icon: _angular_core.InputSignal<string | undefined>;
123
+ /** Disabled state prevents interaction */
124
+ readonly disabled: _angular_core.InputSignal<boolean>;
125
+ /** Emitted when user clicks/selects the item. Menu closes by default unless preventDefault() is called. */
126
+ readonly clicked: _angular_core.OutputEmitterRef<CoarMenuItemClickEvent>;
127
+ /** Emitted when user hovers over item (for flyout trigger) */
128
+ readonly hovered: _angular_core.OutputEmitterRef<Event>;
129
+ onClick(event: MouseEvent): void;
130
+ onMouseEnter(event: MouseEvent): void;
131
+ onKeyboardActivate(): void;
132
+ private closeMenuTree;
133
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CoarMenuItemComponent, never>;
134
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CoarMenuItemComponent, "coar-menu-item", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "clicked": "clicked"; "hovered": "hovered"; }, never, ["*"], true, never>;
135
+ }
136
+
137
+ /**
138
+ * CoarMenuDivider: Visual separator between menu items.
139
+ *
140
+ * Simple horizontal line for grouping menu items.
141
+ *
142
+ * @example
143
+ * ```html
144
+ * <coar-menu>
145
+ * <coar-menu-item>Cut</coar-menu-item>
146
+ * <coar-menu-item>Copy</coar-menu-item>
147
+ * <coar-menu-divider></coar-menu-divider>
148
+ * <coar-menu-item>Paste</coar-menu-item>
149
+ * </coar-menu>
150
+ * ```
151
+ */
152
+ declare class CoarMenuDividerComponent {
153
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CoarMenuDividerComponent, never>;
154
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CoarMenuDividerComponent, "coar-menu-divider", never, {}, {}, never, never, true, never>;
155
+ }
156
+
157
+ /**
158
+ * CoarMenuHeading: Non-interactive section label for menu groups.
159
+ *
160
+ * Responsibilities:
161
+ * - Display section/group heading text
162
+ * - Provide visual separation between menu sections
163
+ * - Non-interactive (no hover, no click, not focusable)
164
+ *
165
+ * @example
166
+ * ```html
167
+ * <coar-menu>
168
+ * <coar-menu-heading>Foundations</coar-menu-heading>
169
+ * <coar-menu-item routerLink="/typography">Typography</coar-menu-item>
170
+ * <coar-menu-item routerLink="/colors">Colors</coar-menu-item>
171
+ *
172
+ * <coar-menu-heading>Form Controls</coar-menu-heading>
173
+ * <coar-menu-item routerLink="/text-input">Text Input</coar-menu-item>
174
+ * </coar-menu>
175
+ * ```
176
+ */
177
+ declare class CoarMenuHeadingComponent {
178
+ /** Optional explicit label text (alternative to content projection) */
179
+ readonly label: _angular_core.InputSignal<string | undefined>;
180
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CoarMenuHeadingComponent, never>;
181
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CoarMenuHeadingComponent, "coar-menu-heading", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
182
+ }
183
+
184
+ /**
185
+ * CoarSubmenuItem: Menu item that opens a submenu on hover.
186
+ *
187
+ * Responsibilities:
188
+ * - Render parent item with icon and label
189
+ * - Manage submenu overlay lifecycle
190
+ * - Support nested submenus (can contain other submenu-items)
191
+ *
192
+ * @example
193
+ * ```html
194
+ * <coar-submenu-item label="Share" icon="🔗">
195
+ * <ng-template>
196
+ * <coar-menu-item icon="✉️" (clicked)="sendEmail()">Email</coar-menu-item>
197
+ * <coar-menu-item icon="🔗" (clicked)="copyLink()">Copy Link</coar-menu-item>
198
+ * </ng-template>
199
+ * </coar-submenu-item>
200
+ *
201
+ * <!-- Optional: explicitly mark the template -->
202
+ * <coar-submenu-item label="Share" icon="🔗">
203
+ * <ng-template coarSubmenu>
204
+ * ...
205
+ * </ng-template>
206
+ * </coar-submenu-item>
207
+ *
208
+ * <!-- Also supported (legacy / external template): -->
209
+ * <coar-submenu-item label="Share" icon="🔗" [submenuTemplate]="shareMenu" />
210
+ * ```
211
+ */
212
+ declare class CoarSubmenuItemComponent {
213
+ private readonly destroyRef;
214
+ private readonly cdr;
215
+ private readonly cascade;
216
+ private readonly parentOverlay;
217
+ private readonly injector;
218
+ private readonly overlayBuilder;
219
+ protected readonly submenuTemplateInjector: _angular_core.DestroyableInjector;
220
+ constructor();
221
+ /** Label text for the menu item */
222
+ readonly label: _angular_core.InputSignal<string>;
223
+ /** Optional icon identifier */
224
+ readonly icon: _angular_core.InputSignal<string | undefined>;
225
+ /** Disabled state prevents interaction */
226
+ readonly disabled: _angular_core.InputSignal<boolean>;
227
+ /**
228
+ * Optional external submenu template.
229
+ *
230
+ * Prefer an inline `<ng-template>` child when possible.
231
+ */
232
+ readonly submenuTemplate: _angular_core.InputSignal<TemplateRef<unknown> | null>;
233
+ /**
234
+ * Optional data to pass to the submenu template.
235
+ *
236
+ * If provided, this data will be passed as the context to the submenu template,
237
+ * instead of inheriting the parent overlay's context.
238
+ *
239
+ * Use this to create clean boundaries between parent and submenu:
240
+ * - Simple case: `[submenuData]="context"` (pass full context)
241
+ * - Complex case: `[submenuData]="transformData(context)"` (pass only what submenu needs)
242
+ *
243
+ * @example
244
+ * ```html
245
+ * <!-- Pass specific data contract to submenu -->
246
+ * <coar-submenu-item
247
+ * label="Status"
248
+ * [submenuTemplate]="statusMenu"
249
+ * [submenuData]="{ selectedIds: context.selected.map(s => s.Id) }">
250
+ * </coar-submenu-item>
251
+ * ```
252
+ */
253
+ readonly submenuData: _angular_core.InputSignal<unknown>;
254
+ private readonly markedInlineTemplate?;
255
+ private readonly inlineTemplate?;
256
+ private overlaySubmenuTemplate;
257
+ private submenuRef;
258
+ isOpen: boolean;
259
+ protected submenuTemplateToRender(): TemplateRef<unknown>;
260
+ onMouseEnter(event: MouseEvent): void;
261
+ onClick(event: MouseEvent): void;
262
+ onKeyboardActivate(event: Event): void;
263
+ private openSubmenu;
264
+ private closeSubmenu;
265
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CoarSubmenuItemComponent, never>;
266
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CoarSubmenuItemComponent, "coar-submenu-item, coar-sub-flyout", never, { "label": { "alias": "label"; "required": true; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "submenuTemplate": { "alias": "submenuTemplate"; "required": false; "isSignal": true; }; "submenuData": { "alias": "submenuData"; "required": false; "isSignal": true; }; }, {}, ["markedInlineTemplate", "inlineTemplate"], never, true, never>;
267
+ }
268
+
269
+ /**
270
+ * CoarSubExpand: Menu item that expands/collapses a submenu inline.
271
+ *
272
+ * Use this variant when you want nested options to stay visible (e.g. sidebar panels)
273
+ * while still reusing the same menu item types inside the submenu.
274
+ *
275
+ * @example
276
+ * ```html
277
+ * <coar-menu>
278
+ * <coar-sub-expand label="Filters" icon="settings" [(open)]="filtersOpen">
279
+ * <ng-template>
280
+ * <coar-menu>
281
+ * <coar-menu-item icon="plus">Add Filter</coar-menu-item>
282
+ * <coar-menu-item icon="trash">Clear</coar-menu-item>
283
+ * </coar-menu>
284
+ * </ng-template>
285
+ </coar-sub-expand>
286
+ * </coar-menu>
287
+ * ```
288
+ */
289
+ declare class CoarSubExpandComponent {
290
+ /** Label text for the menu item */
291
+ readonly label: _angular_core.InputSignal<string>;
292
+ /** Optional icon identifier */
293
+ readonly icon: _angular_core.InputSignal<string | undefined>;
294
+ /** Disabled state prevents interaction */
295
+ readonly disabled: _angular_core.InputSignal<boolean>;
296
+ /** Expanded state (two-way bindable with [(open)]) */
297
+ readonly open: _angular_core.InputSignalWithTransform<boolean | undefined, unknown>;
298
+ /** Emits when expanded state changes (for [(open)]) */
299
+ readonly openChange: _angular_core.OutputEmitterRef<boolean>;
300
+ private readonly openInternal;
301
+ protected readonly isOpen: _angular_core.Signal<boolean>;
302
+ /** Optional external submenu template. Prefer an inline `<ng-template>` child when possible. */
303
+ readonly submenuTemplate: _angular_core.InputSignal<TemplateRef<unknown> | null>;
304
+ private readonly markedInlineTemplate?;
305
+ private readonly inlineTemplate?;
306
+ protected submenuTemplateToRender(): TemplateRef<unknown>;
307
+ constructor();
308
+ toggle(event: Event): void;
309
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CoarSubExpandComponent, never>;
310
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CoarSubExpandComponent, "coar-sub-expand", never, { "label": { "alias": "label"; "required": true; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "open": { "alias": "open"; "required": false; "isSignal": true; }; "submenuTemplate": { "alias": "submenuTemplate"; "required": false; "isSignal": true; }; }, { "openChange": "openChange"; }, ["markedInlineTemplate", "inlineTemplate"], never, true, never>;
311
+ }
312
+
313
+ /**
314
+ * Marks an inline submenu template for a `coar-submenu-item`.
315
+ *
316
+ * This is optional: if a submenu item contains exactly one direct child `<ng-template>`,
317
+ * that template will be used even without this directive.
318
+ */
319
+ declare class CoarSubmenuTemplateDirective {
320
+ readonly templateRef: TemplateRef<unknown>;
321
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CoarSubmenuTemplateDirective, never>;
322
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CoarSubmenuTemplateDirective, "ng-template[coarSubmenu]", never, {}, {}, never, never, true, never>;
323
+ }
324
+
325
+ export { COAR_MENU_AIM_CONFIG, CoarMenuAimConfigDirective, CoarMenuComponent, CoarMenuDividerComponent, CoarMenuHeadingComponent, CoarMenuItemComponent, CoarSubExpandComponent, CoarSubmenuItemComponent, CoarSubmenuTemplateDirective, DEFAULT_COAR_MENU_AIM_CONFIG };
326
+ export type { CoarMenuAimConfig, CoarMenuAimConfigProvider, CoarMenuItemClickEvent };
@@ -0,0 +1,301 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Type, TemplateRef, InjectionToken } from '@angular/core';
3
+ import { Observable } from 'rxjs';
4
+
5
+ interface OverlaySpec<TInputs = void> {
6
+ content?: ContentSpec<TInputs>;
7
+ anchor?: AnchorSpec;
8
+ position?: PositionSpec;
9
+ size?: SizeSpec;
10
+ backdrop?: BackdropSpec;
11
+ scroll?: ScrollSpec;
12
+ dismiss?: DismissSpec;
13
+ focus?: FocusSpec;
14
+ a11y?: A11ySpec;
15
+ attachment?: AttachmentSpec;
16
+ /**
17
+ * Additional CSS class(es) to add to the overlay panel element.
18
+ * Useful for applying custom styles or size variants.
19
+ */
20
+ panelClass?: string | string[];
21
+ }
22
+ /**
23
+ * Optional application-level hook to apply global overlay defaults/policies.
24
+ *
25
+ * Resolvers should be pure functions and must not override explicit caller configuration
26
+ * unless the application intentionally chooses to.
27
+ */
28
+ type OverlaySpecResolver = (spec: OverlaySpec<unknown>) => OverlaySpec<unknown>;
29
+ /**
30
+ * Multi-provider token. Resolvers are applied in registration order.
31
+ */
32
+ declare const COAR_OVERLAY_SPEC_RESOLVERS: InjectionToken<readonly OverlaySpecResolver[]>;
33
+ type Placement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end' | 'center';
34
+ interface ContentSpec<TInputs> {
35
+ kind: 'component' | 'template' | 'text';
36
+ component?: Type<unknown>;
37
+ template?: TemplateRef<unknown>;
38
+ /**
39
+ * Optional default inputs.
40
+ * Runtime inputs provided at open() time are merged on top.
41
+ */
42
+ defaults?: Partial<TInputs>;
43
+ }
44
+ type AnchorSpec = {
45
+ kind: 'element';
46
+ element: Element;
47
+ } | {
48
+ kind: 'point';
49
+ x: number;
50
+ y: number;
51
+ } | {
52
+ kind: 'virtual';
53
+ placement: 'center' | 'top' | 'bottom';
54
+ };
55
+ interface PositionSpec {
56
+ placement: Placement | readonly Placement[];
57
+ offset?: number;
58
+ flip?: boolean;
59
+ shift?: boolean;
60
+ }
61
+ interface SizeSpec {
62
+ mode: 'content' | 'content-clamped' | 'fixed';
63
+ minWidth?: number | 'anchor';
64
+ minHeight?: number | 'anchor';
65
+ maxWidth?: number | 'viewport';
66
+ maxHeight?: number | 'viewport';
67
+ }
68
+ type BackdropSpec = {
69
+ kind: 'none';
70
+ } | {
71
+ kind: 'modal';
72
+ closeOnBackdropClick?: boolean;
73
+ };
74
+ interface ScrollSpec {
75
+ strategy: 'noop' | 'reposition' | 'close';
76
+ }
77
+ interface DismissSpec {
78
+ outsideClick?: boolean;
79
+ escapeKey?: boolean;
80
+ /**
81
+ * Optional pointer-based dismissal for menu-like overlays.
82
+ *
83
+ * When enabled, the overlay closes after the pointer leaves the overlay *tree*
84
+ * (the overlay itself and any child overlays opened via openChild()).
85
+ * Entering any child overlay cancels the parent's close timer.
86
+ */
87
+ hoverTree?: {
88
+ enabled?: boolean;
89
+ delayMs?: number;
90
+ };
91
+ }
92
+ interface FocusSpec {
93
+ trap?: boolean;
94
+ restore?: boolean;
95
+ }
96
+ interface A11ySpec {
97
+ role?: 'dialog' | 'menu' | 'tooltip' | 'listbox';
98
+ label?: string;
99
+ labelledBy?: string;
100
+ describedBy?: string;
101
+ }
102
+ /**
103
+ * Defines where the overlay element is attached in the DOM and what boundaries
104
+ * are used for clamping/fallback calculations.
105
+ *
106
+ * - 'body': Attach to document.body (portal pattern), use viewport boundaries
107
+ * - 'parent': Attach to a specific container element, use that container's boundaries
108
+ */
109
+ type AttachmentSpec = {
110
+ strategy: 'body';
111
+ } | {
112
+ strategy: 'parent';
113
+ container: HTMLElement;
114
+ };
115
+ declare const COAR_OVERLAY_DEFAULTS: {
116
+ readonly anchor: {
117
+ readonly kind: "virtual";
118
+ readonly placement: "center";
119
+ };
120
+ readonly position: {
121
+ readonly placement: readonly ["top", "bottom", "left", "right"];
122
+ readonly offset: 8;
123
+ readonly flip: true;
124
+ readonly shift: true;
125
+ };
126
+ readonly backdrop: {
127
+ readonly kind: "none";
128
+ };
129
+ readonly scroll: {
130
+ readonly strategy: "reposition";
131
+ };
132
+ readonly dismiss: {
133
+ readonly outsideClick: true;
134
+ readonly escapeKey: true;
135
+ };
136
+ readonly focus: {
137
+ readonly trap: false;
138
+ readonly restore: true;
139
+ };
140
+ readonly a11y: {};
141
+ readonly attachment: {
142
+ readonly strategy: "body";
143
+ };
144
+ };
145
+
146
+ interface OverlayRef {
147
+ close(result?: unknown): void;
148
+ updatePosition(): void;
149
+ closeChildren(exclude?: OverlayRef): void;
150
+ readonly afterClosed$: Observable<unknown>;
151
+ readonly isClosed: boolean;
152
+ /**
153
+ * Get the root overlay in a parent-child tree (e.g., menu with submenus).
154
+ * Returns this overlay if it has no parent.
155
+ */
156
+ getRoot(): OverlayRef;
157
+ /**
158
+ * Optional DOM access for advanced behaviors (e.g. menu-aim).
159
+ * Implementations may return the inner panel element that contains the rendered content.
160
+ */
161
+ getPanelElement?(): HTMLElement;
162
+ }
163
+
164
+ interface OverlayOpenOptions {
165
+ closeSiblings?: boolean;
166
+ }
167
+ type OverlaySettings<TInputs> = Omit<OverlaySpec<TInputs>, 'content'>;
168
+ type UnwrapInputSignal<T> = T extends i0.InputSignal<infer V> ? V : T;
169
+ type ComponentInputs<C> = {
170
+ [K in keyof C]?: UnwrapInputSignal<C[K]>;
171
+ };
172
+ declare class CoarOverlayService {
173
+ private readonly appRef;
174
+ private readonly environmentInjector;
175
+ private readonly specResolvers;
176
+ private readonly openOverlays;
177
+ private globalListenersInstalled;
178
+ private readonly onDocumentPointerDown;
179
+ private readonly onDocumentKeyDown;
180
+ openTemplate<TCtx>(template: TemplateRef<TCtx>, settings: OverlaySettings<TCtx>, inputs: TCtx): OverlayRef;
181
+ openComponent<C>(component: Type<C>, settings: OverlaySettings<ComponentInputs<C>>, inputs: ComponentInputs<C>): OverlayRef;
182
+ openText(settings: OverlaySettings<{
183
+ text: string;
184
+ }>, inputs: {
185
+ text: string;
186
+ }): OverlayRef;
187
+ openTemplateAsChild<TCtx>(parent: OverlayRef, template: TemplateRef<TCtx>, settings: OverlaySettings<TCtx>, inputs: TCtx, options?: OverlayOpenOptions): OverlayRef;
188
+ openComponentAsChild<C>(parent: OverlayRef, component: Type<C>, settings: OverlaySettings<ComponentInputs<C>>, inputs: ComponentInputs<C>, options?: OverlayOpenOptions): OverlayRef;
189
+ openTextAsChild(parent: OverlayRef, settings: OverlaySettings<{
190
+ text: string;
191
+ }>, inputs: {
192
+ text: string;
193
+ }, options?: OverlayOpenOptions): OverlayRef;
194
+ closeAll(): void;
195
+ private resolveSpec;
196
+ private applySpecResolvers;
197
+ private attach;
198
+ private inheritDismissFromParent;
199
+ private getInternalRefOrNull;
200
+ private installGlobalListenersIfNeeded;
201
+ private uninstallGlobalListenersIfIdle;
202
+ private getOpenOverlaysInOrder;
203
+ private getTopmostOverlayContainingTarget;
204
+ private getTopmostDismissableOverlay;
205
+ private getTopmostFocusTrappingOverlay;
206
+ private mergeInputs;
207
+ static ɵfac: i0.ɵɵFactoryDeclaration<CoarOverlayService, never>;
208
+ static ɵprov: i0.ɵɵInjectableDeclaration<CoarOverlayService>;
209
+ }
210
+
211
+ interface OverlayChildOpenOptions {
212
+ closeSiblings?: boolean;
213
+ }
214
+ interface TemplateOverlayOpener<TCtx> {
215
+ open(inputs: TCtx): OverlayRef;
216
+ openAsChild(parent: OverlayRef, inputs: TCtx, options?: OverlayChildOpenOptions): OverlayRef;
217
+ }
218
+ interface ComponentOverlayOpener<C> {
219
+ open(inputs: ComponentInputs<C>): OverlayRef;
220
+ openAsChild(parent: OverlayRef, inputs: ComponentInputs<C>, options?: OverlayChildOpenOptions): OverlayRef;
221
+ }
222
+ interface TextOverlayOpener {
223
+ open(inputs: {
224
+ text: string;
225
+ }): OverlayRef;
226
+ openAsChild(parent: OverlayRef, inputs: {
227
+ text: string;
228
+ }, options?: OverlayChildOpenOptions): OverlayRef;
229
+ }
230
+ declare class CoarOverlayOpenBuilder {
231
+ private readonly service;
232
+ private readonly settings;
233
+ constructor(service: CoarOverlayService, settings?: OverlaySettings<unknown>);
234
+ fork(): CoarOverlayOpenBuilder;
235
+ backdrop(value: OverlaySettings<unknown>['backdrop']): CoarOverlayOpenBuilder;
236
+ anchor(value: OverlaySettings<unknown>['anchor']): CoarOverlayOpenBuilder;
237
+ position(value: OverlaySettings<unknown>['position']): CoarOverlayOpenBuilder;
238
+ size(value: OverlaySettings<unknown>['size']): CoarOverlayOpenBuilder;
239
+ scroll(value: OverlaySettings<unknown>['scroll']): CoarOverlayOpenBuilder;
240
+ dismiss(value: OverlaySettings<unknown>['dismiss']): CoarOverlayOpenBuilder;
241
+ focus(value: OverlaySettings<unknown>['focus']): CoarOverlayOpenBuilder;
242
+ a11y(value: OverlaySettings<unknown>['a11y']): CoarOverlayOpenBuilder;
243
+ attachment(value: OverlaySettings<unknown>['attachment']): CoarOverlayOpenBuilder;
244
+ /**
245
+ * Add CSS class(es) to the overlay panel element.
246
+ * Useful for applying custom styles or size variants.
247
+ */
248
+ panelClass(value: string | string[]): CoarOverlayOpenBuilder;
249
+ /**
250
+ * Applies baseline settings, without overriding fields already set on this builder.
251
+ * Useful for applying a preset after you've already configured part of the builder.
252
+ */
253
+ withPreset(value: OverlaySettings<unknown>): CoarOverlayOpenBuilder;
254
+ fromTemplate<TCtx>(template: TemplateRef<TCtx>): TemplateOverlayOpener<TCtx>;
255
+ fromComponent<C>(component: Type<C>): ComponentOverlayOpener<C>;
256
+ fromText(): TextOverlayOpener;
257
+ }
258
+ /**
259
+ * Content-last overlay builder (configure shared overlay settings once).
260
+ *
261
+ * Intended usage:
262
+ *
263
+ * ```ts
264
+ * const overlay = createOverlayBuilder()
265
+ * .anchor({ kind: 'element', element })
266
+ * .position({ placement: 'bottom-start', offset: 4, flip: true, shift: true });
267
+ *
268
+ * overlay.fromTemplate(tpl).open({ $implicit: data });
269
+ * overlay.fromComponent(MyCmp).open({ text: 'Hello' });
270
+ * ```
271
+ *
272
+ * You can also provide initial settings:
273
+ *
274
+ * ```ts
275
+ * const overlay = createOverlayBuilder(coarMenuPreset);
276
+ * ```
277
+ */
278
+ declare function createOverlayBuilder(): CoarOverlayOpenBuilder;
279
+ declare function createOverlayBuilder(initial: OverlaySettings<unknown>): CoarOverlayOpenBuilder;
280
+
281
+ declare const coarTooltipPreset: OverlaySettings<unknown>;
282
+ declare const coarModalPreset: OverlaySettings<unknown>;
283
+ declare const coarMenuPreset: OverlaySettings<unknown>;
284
+ declare const coarHoverMenuPreset: OverlaySettings<unknown>;
285
+
286
+ /**
287
+ * The OverlayRef for the overlay currently rendering this content.
288
+ *
289
+ * Provided automatically by CoarOverlayService for overlay content so components
290
+ * can open true child overlays without DOM lookups.
291
+ */
292
+ declare const COAR_OVERLAY_REF: InjectionToken<OverlayRef>;
293
+ /**
294
+ * Parent overlay reference for menu hierarchies.
295
+ * Each overlay provides this token pointing to itself, enabling child menu items
296
+ * to close siblings by calling parent.closeChildren().
297
+ */
298
+ declare const COAR_MENU_PARENT: InjectionToken<OverlayRef | null>;
299
+
300
+ export { COAR_MENU_PARENT, COAR_OVERLAY_DEFAULTS, COAR_OVERLAY_REF, COAR_OVERLAY_SPEC_RESOLVERS, CoarOverlayOpenBuilder, coarHoverMenuPreset, coarMenuPreset, coarModalPreset, coarTooltipPreset, createOverlayBuilder };
301
+ export type { A11ySpec, AnchorSpec, AttachmentSpec, BackdropSpec, ComponentOverlayOpener, DismissSpec, FocusSpec, OverlayChildOpenOptions, OverlayRef, OverlaySettings, OverlaySpec, OverlaySpecResolver, Placement, PositionSpec, ScrollSpec, SizeSpec, TemplateOverlayOpener, TextOverlayOpener };
@@ -0,0 +1,3 @@
1
+ export * from '@cocoar/ui/overlay';
2
+ export * from '@cocoar/ui/components';
3
+ export * from '@cocoar/ui/menu';
package/src/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from '@cocoar/ui-components';
2
- export * from '@cocoar/ui-menu';
3
- export * from '@cocoar/ui-overlay';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../libs/ui/src/index.ts"],"names":[],"mappings":"AACA,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
package/src/index.js DELETED
@@ -1,5 +0,0 @@
1
- // Re-export all Cocoar Design System packages
2
- export * from '@cocoar/ui-components';
3
- export * from '@cocoar/ui-menu';
4
- export * from '@cocoar/ui-overlay';
5
- //# sourceMappingURL=index.js.map
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/ui/src/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC","sourcesContent":["// Re-export all Cocoar Design System packages\nexport * from '@cocoar/ui-components';\nexport * from '@cocoar/ui-menu';\nexport * from '@cocoar/ui-overlay';\n"]}