@cngx/ui 0.1.0-rc.6 → 0.1.0-rc.8

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 (102) hide show
  1. package/README.md +112 -1
  2. package/a11y/README.md +87 -0
  3. package/accordion/README.md +4 -2
  4. package/breadcrumb/README.md +262 -0
  5. package/collection/README.md +6 -0
  6. package/command-palette/README.md +224 -0
  7. package/context-menu/README.md +98 -0
  8. package/data-grid-accordion/README.md +103 -2
  9. package/feedback/README.md +42 -0
  10. package/fesm2022/cngx-ui-a11y.mjs +452 -0
  11. package/fesm2022/cngx-ui-a11y.mjs.map +1 -0
  12. package/fesm2022/cngx-ui-accordion.mjs +116 -38
  13. package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
  14. package/fesm2022/cngx-ui-action-button.mjs +115 -50
  15. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  16. package/fesm2022/cngx-ui-breadcrumb.mjs +181 -96
  17. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
  18. package/fesm2022/cngx-ui-chart-panel.mjs +586 -0
  19. package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -0
  20. package/fesm2022/cngx-ui-collection.mjs +207 -66
  21. package/fesm2022/cngx-ui-collection.mjs.map +1 -1
  22. package/fesm2022/cngx-ui-command-palette.mjs +1281 -0
  23. package/fesm2022/cngx-ui-command-palette.mjs.map +1 -0
  24. package/fesm2022/cngx-ui-context-menu.mjs +857 -0
  25. package/fesm2022/cngx-ui-context-menu.mjs.map +1 -0
  26. package/fesm2022/cngx-ui-data-grid-accordion.mjs +498 -111
  27. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
  28. package/fesm2022/cngx-ui-empty-state.mjs +16 -6
  29. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  30. package/fesm2022/cngx-ui-feedback.mjs +1095 -521
  31. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  32. package/fesm2022/cngx-ui-layout.mjs +18 -9
  33. package/fesm2022/cngx-ui-layout.mjs.map +1 -1
  34. package/fesm2022/cngx-ui-mat-accordion.mjs +84 -16
  35. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
  36. package/fesm2022/cngx-ui-mat-paginator.mjs +67 -24
  37. package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
  38. package/fesm2022/cngx-ui-mat-stepper.mjs +72 -47
  39. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
  40. package/fesm2022/cngx-ui-mat-tabs.mjs +370 -203
  41. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  42. package/fesm2022/cngx-ui-overlay.mjs +69 -13
  43. package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
  44. package/fesm2022/cngx-ui-paginator.mjs +501 -182
  45. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  46. package/fesm2022/cngx-ui-sidenav.mjs +327 -106
  47. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  48. package/fesm2022/cngx-ui-skeleton.mjs +22 -21
  49. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  50. package/fesm2022/cngx-ui-speak.mjs +107 -8
  51. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  52. package/fesm2022/cngx-ui-stat-card.mjs +718 -0
  53. package/fesm2022/cngx-ui-stat-card.mjs.map +1 -0
  54. package/fesm2022/cngx-ui-stepper.mjs +217 -76
  55. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  56. package/fesm2022/cngx-ui-tabs.mjs +40 -19
  57. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  58. package/fesm2022/cngx-ui-timeline.mjs +548 -0
  59. package/fesm2022/cngx-ui-timeline.mjs.map +1 -0
  60. package/fesm2022/cngx-ui-toc.mjs +748 -0
  61. package/fesm2022/cngx-ui-toc.mjs.map +1 -0
  62. package/fesm2022/cngx-ui.mjs +16 -21
  63. package/fesm2022/cngx-ui.mjs.map +1 -1
  64. package/mat-accordion/README.md +1 -1
  65. package/mat-paginator/README.md +9 -2
  66. package/mat-tabs/styles/mat-tabs.css +29 -27
  67. package/overlay/README.md +9 -4
  68. package/package.json +32 -1
  69. package/paginator/README.md +8 -4
  70. package/sidenav/README.md +33 -11
  71. package/skeleton/README.md +2 -0
  72. package/speak/README.md +3 -2
  73. package/stepper/README.md +15 -3
  74. package/timeline/README.md +350 -0
  75. package/toc/README.md +186 -0
  76. package/types/cngx-ui-a11y.d.ts +394 -0
  77. package/types/cngx-ui-accordion.d.ts +100 -30
  78. package/types/cngx-ui-action-button.d.ts +47 -3
  79. package/types/cngx-ui-breadcrumb.d.ts +159 -58
  80. package/types/cngx-ui-chart-panel.d.ts +382 -0
  81. package/types/cngx-ui-collection.d.ts +159 -58
  82. package/types/cngx-ui-command-palette.d.ts +565 -0
  83. package/types/cngx-ui-context-menu.d.ts +559 -0
  84. package/types/cngx-ui-data-grid-accordion.d.ts +344 -51
  85. package/types/cngx-ui-empty-state.d.ts +9 -2
  86. package/types/cngx-ui-feedback.d.ts +664 -73
  87. package/types/cngx-ui-layout.d.ts +8 -3
  88. package/types/cngx-ui-mat-accordion.d.ts +32 -4
  89. package/types/cngx-ui-mat-paginator.d.ts +37 -8
  90. package/types/cngx-ui-mat-stepper.d.ts +23 -11
  91. package/types/cngx-ui-mat-tabs.d.ts +218 -23
  92. package/types/cngx-ui-overlay.d.ts +56 -10
  93. package/types/cngx-ui-paginator.d.ts +416 -132
  94. package/types/cngx-ui-sidenav.d.ts +248 -74
  95. package/types/cngx-ui-skeleton.d.ts +18 -7
  96. package/types/cngx-ui-speak.d.ts +118 -5
  97. package/types/cngx-ui-stat-card.d.ts +411 -0
  98. package/types/cngx-ui-stepper.d.ts +81 -29
  99. package/types/cngx-ui-tabs.d.ts +22 -6
  100. package/types/cngx-ui-timeline.d.ts +495 -0
  101. package/types/cngx-ui-toc.d.ts +581 -0
  102. package/types/cngx-ui.d.ts +8 -5
@@ -0,0 +1,581 @@
1
+ import * as _cngx_ui_toc from '@cngx/ui/toc';
2
+ import * as _angular_core from '@angular/core';
3
+ import { InjectionToken, Signal, OutputRef, TemplateRef, EnvironmentProviders, Provider } from '@angular/core';
4
+
5
+ /**
6
+ * One entry in a table-of-contents outline. Tree-shaped: an item may nest
7
+ * `children`, rendered as a nested `<ul>` under its link. `id` targets the
8
+ * section element the link scrolls to (matched via `getElementById`), `label`
9
+ * is the visible link text. Explicit data input - the organism never scans
10
+ * the document for headings in this release (see the deferred auto-discovery
11
+ * phase).
12
+ *
13
+ * @category ui/toc
14
+ * @since 0.1.0
15
+ */
16
+ interface CngxTocItem {
17
+ /** Section element id this entry links to and scrolls into view. */
18
+ readonly id: string;
19
+ /** Visible link text. */
20
+ readonly label: string;
21
+ /** Nested sub-sections, rendered as an indented child list. */
22
+ readonly children?: readonly CngxTocItem[];
23
+ }
24
+ /**
25
+ * Template context handed to the `*cngxTocItem` slot and to a
26
+ * `CNGX_TOC_CONFIG.templates.item` default. `$implicit` is the item so
27
+ * `let-item` binds it positionally; `active` mirrors the item's
28
+ * `aria-current` state; `depth` is the zero-based nesting level for
29
+ * indentation-aware custom markup.
30
+ *
31
+ * @category ui/toc
32
+ * @since 0.1.0
33
+ */
34
+ interface CngxTocItemContext {
35
+ /** The item being rendered (`let-item`). */
36
+ readonly $implicit: CngxTocItem;
37
+ /** `true` when this item is the active section. */
38
+ readonly active: boolean;
39
+ /** Zero-based nesting depth. */
40
+ readonly depth: number;
41
+ }
42
+
43
+ /**
44
+ * Minimal contract a toc rail exposes to its collaborators (the opt-in
45
+ * `CngxTocRouterSync` fragment directive): the active-section signal it
46
+ * derives, the activation output it emits, and the imperative `scrollTo`
47
+ * it owns. Injected via {@link CNGX_TOC} + `useExisting`, never by injecting
48
+ * the concrete `CngxToc` class - that would create a cyclic type dependency
49
+ * and block the decompose brain/skin split.
50
+ *
51
+ * Direction mirrors `CNGX_SIDENAV`, not `CNGX_BREADCRUMB_ITEMS_SOURCE`: the
52
+ * rail owns the state (`activeId`, `scrollTo`) and the collaborator consumes
53
+ * it, so the toc *provides* the token and the sync directive *injects* it.
54
+ *
55
+ * @category ui/toc
56
+ * @since 0.1.0
57
+ * @relatedTo CngxToc, CngxTocRouterSync
58
+ */
59
+ interface CngxTocContract {
60
+ /** The section currently most visible, or `null` before the spy resolves. */
61
+ readonly activeId: Signal<string | null>;
62
+ /** Fires when a link is activated (click / Enter), carrying its item. */
63
+ readonly activated: OutputRef<CngxTocItem>;
64
+ /** Scroll the section with this id into view and move focus to it. */
65
+ scrollTo(id: string): void;
66
+ }
67
+ /**
68
+ * Contract token for a toc rail. `CngxToc` provides it via
69
+ * `{ provide: CNGX_TOC, useExisting: CngxToc }`, so a collaborator injects the
70
+ * narrow {@link CngxTocContract} instead of the concrete class.
71
+ *
72
+ * @category ui/toc
73
+ * @since 0.1.0
74
+ * @relatedTo CngxToc, CngxTocRouterSync
75
+ */
76
+ declare const CNGX_TOC: InjectionToken<CngxTocContract>;
77
+
78
+ /**
79
+ * "On this page" navigation rail. Renders a `<nav>` of anchor links from a
80
+ * {@link CngxTocItem} outline, tracks the most-visible section through an
81
+ * internal {@link CngxScrollSpy}, and communicates the active link via
82
+ * `aria-current` inside the `computed()` graph. Nested items render as
83
+ * indented sub-lists; native link semantics and tab order stay intact (a toc
84
+ * is a navigation landmark of links, not a treeview).
85
+ *
86
+ * Composition over configuration: the spy is bound in this component's own
87
+ * template rather than via `hostDirectives`, because the organism - not the
88
+ * consumer - owns the flat id list the spy observes, and `[cngxScrollSpy]` is
89
+ * a required input. The spy resolves its targets through `getElementById`, so
90
+ * its host placement is irrelevant to its function.
91
+ *
92
+ * @category ui/toc
93
+ * @docsKind primary
94
+ * @wcag AA
95
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/toc.component.ts
96
+ * @since 0.1.0
97
+ * @relatedTo CngxScrollSpy, CngxTocRouterSync, CngxSidenav
98
+ * <example-url>http://localhost:4200/#/ui/toc/basic/on-this-page-rail</example-url>
99
+ * <example-url>http://localhost:4200/#/ui/toc/auto/heading-auto-discovery</example-url>
100
+ * @slot cngxTocItem Replaces the plain label inside each item's link at every depth, ahead of CNGX_TOC_CONFIG.templates.item; gets the item as $implicit, plus active and the zero-based depth.
101
+ */
102
+ declare class CngxToc implements CngxTocContract {
103
+ private readonly doc;
104
+ private readonly cfg;
105
+ private readonly ariaLabels;
106
+ private readonly reducedMotion;
107
+ private readonly isBrowser;
108
+ /**
109
+ * The outline to render. Tree-shaped; nested `children` become sub-lists.
110
+ * Ignored when `[autoDiscover]` is set - the headings under `contentRoot`
111
+ * become the outline instead.
112
+ */
113
+ readonly items: _angular_core.InputSignal<readonly CngxTocItem[]>;
114
+ /**
115
+ * Derive the outline from the heading elements under `contentRoot` instead
116
+ * of a hand-maintained `[items]` array. Headings nest by their level
117
+ * (`h2 > h3`), and a heading with no `id` gets a slugified one written onto
118
+ * it so the link can target it. Scans once after the first render; call
119
+ * {@link refresh} after you inject or remove sections at runtime.
120
+ */
121
+ readonly autoDiscover: _angular_core.InputSignalWithTransform<boolean, unknown>;
122
+ /** Which headings `[autoDiscover]` collects, in CSS-selector form. */
123
+ readonly headingSelector: _angular_core.InputSignal<string>;
124
+ /**
125
+ * CSS selector for the scroll container the spy observes. `null` (default)
126
+ * uses the viewport. Forwarded to the spy's `[root]`; also the root the
127
+ * `[autoDiscover]` scan walks for headings.
128
+ */
129
+ readonly contentRoot: _angular_core.InputSignal<string | null>;
130
+ /** Root margin forwarded to the spy. Defaults to the config cascade. */
131
+ readonly rootMargin: _angular_core.InputSignal<string>;
132
+ /** Minimum visibility ratio forwarded to the spy. Defaults to the config cascade. */
133
+ readonly threshold: _angular_core.InputSignal<number>;
134
+ /** Fires when a link is activated (click / Enter). */
135
+ readonly activated: _angular_core.OutputEmitterRef<CngxTocItem>;
136
+ private readonly spy;
137
+ private readonly itemSlot;
138
+ /** Headings discovered by the last `[autoDiscover]` scan. */
139
+ private readonly discovered;
140
+ /** The outline actually rendered: the discovered headings when `[autoDiscover]` is on, else `[items]`. */
141
+ protected readonly resolvedItems: Signal<readonly CngxTocItem[]>;
142
+ /** Accessible name of the `nav` landmark, from the config cascade; follows a language switch. */
143
+ protected readonly navLabel: Signal<string>;
144
+ /**
145
+ * Depth-first flat id list feeding `[cngxScrollSpy]`. `equal: arrayEqual`
146
+ * keeps the reference stable across same-shape re-sets so a re-render does
147
+ * not re-create the observer.
148
+ */
149
+ protected readonly flatIds: Signal<string[]>;
150
+ constructor();
151
+ /**
152
+ * The active section, or `null`. `viewChild` is a view query, so `spy()` is
153
+ * `undefined` during the creation pass; `?? null` makes that an explicit
154
+ * value every downstream computed is defined at.
155
+ */
156
+ readonly activeId: Signal<string | null>;
157
+ /**
158
+ * Ancestor-id chain of the active leaf - the parent links that get
159
+ * `data-active-trail`. Same `equal` as `flatIds`: an array-valued computed
160
+ * feeding an attribute binding must not allocate a fresh array every spy
161
+ * tick (reference_signal_architecture Equality Rule).
162
+ */
163
+ protected readonly activeTrail: Signal<readonly string[]>;
164
+ /** Resolved item template: instance slot -> config default -> built-in label. */
165
+ protected readonly resolvedItemTpl: Signal<_angular_core.TemplateRef<_cngx_ui_toc.CngxTocItemContext> | null>;
166
+ /**
167
+ * Scroll the section with this id into view and move focus to it. Honours
168
+ * `prefers-reduced-motion` - the configured `scrollBehavior` is swapped for
169
+ * `'auto'` (instant) whenever reduced motion is requested. A visual-only
170
+ * jump is a silent state change for screen-reader users, so focus follows
171
+ * the scroll (Pillar 2).
172
+ */
173
+ scrollTo(id: string): void;
174
+ /** Click / Enter handler: takes over the native anchor jump, scrolls, and announces the activation. */
175
+ protected handleActivate(item: CngxTocItem, event?: Event): void;
176
+ /**
177
+ * Move focus to the scrolled-to section. `preventScroll` keeps `focus()`
178
+ * from fighting the smooth `scrollIntoView` above with a second instant
179
+ * jump. Section elements are consumer-owned DOM, so `tabindex="-1"` is set
180
+ * imperatively only when the element is not focusable by default and the
181
+ * consumer set no `tabindex` - an author-set value is never overwritten.
182
+ * That persistent attribute on borrowed DOM is the entry's tracked debt.
183
+ */
184
+ private focusTarget;
185
+ /** Elements that take focus without an author `tabindex`. */
186
+ private isFocusableByDefault;
187
+ /** Depth-first collect of every id in the outline. */
188
+ private collectIds;
189
+ /** Ancestor ids of the active leaf (path from root, excluding the leaf itself). */
190
+ private computeTrail;
191
+ /** Root-to-target id path, or `null` when the id is not in the outline. */
192
+ private pathTo;
193
+ /**
194
+ * Re-run the `[autoDiscover]` heading scan. No-op unless `[autoDiscover]` is
195
+ * set and we are on the browser. Call it after injecting or removing sections
196
+ * at runtime - discovery is one-shot by design, not a live observer.
197
+ */
198
+ refresh(): void;
199
+ /** Walk the headings under `contentRoot` into a level-nested outline. */
200
+ private scanHeadings;
201
+ /** Numeric level of a heading element (`h2` -> 2). Non-heading matches read as level 1. */
202
+ private headingLevel;
203
+ /** Visible text of a heading, collapsed to a single spaced line. */
204
+ private headingLabel;
205
+ /**
206
+ * Return the heading's id, generating and writing a slug when it has none.
207
+ * The write mutates consumer-owned DOM (tracked debt); an author-set id is
208
+ * kept verbatim. Collisions against prior scan ids and existing document ids
209
+ * get a `-2`, `-3`, ... suffix.
210
+ */
211
+ private ensureId;
212
+ /** Lowercase, strip diacritics-free non-alphanumerics to hyphens, collapse and trim. */
213
+ private slugify;
214
+ /** Freeze a mutable node into a CngxTocItem, dropping empty children arrays. */
215
+ private freeze;
216
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxToc, never>;
217
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxToc, "cngx-toc", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "autoDiscover": { "alias": "autoDiscover"; "required": false; "isSignal": true; }; "headingSelector": { "alias": "headingSelector"; "required": false; "isSignal": true; }; "contentRoot": { "alias": "contentRoot"; "required": false; "isSignal": true; }; "rootMargin": { "alias": "rootMargin"; "required": false; "isSignal": true; }; "threshold": { "alias": "threshold"; "required": false; "isSignal": true; }; }, { "activated": "activated"; }, ["itemSlot"], never, true, never>;
218
+ }
219
+
220
+ /**
221
+ * Deep-links a `CngxToc` into the URL fragment. Opt-in via
222
+ * `[cngxTocRouterSync]` on the same host as `<cngx-toc>`: activating a link
223
+ * writes `#<section-id>` (replacing the history entry, so a scroll-driven rail
224
+ * never floods the back stack), and a deep link like `/guide#pricing` scrolls
225
+ * to that section once on load.
226
+ *
227
+ * Reaches the rail through the {@link CNGX_TOC} contract token, never the
228
+ * concrete `CngxToc` class. The activation subscription is torn down with the
229
+ * directive via `takeUntilDestroyed` - an `OutputRef` subscription would
230
+ * otherwise outlive route changes. Without `@angular/router` the directive
231
+ * dev-warns once and no-ops.
232
+ *
233
+ * @category ui/toc
234
+ * @docsKind primary
235
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/toc-router-sync.directive.ts
236
+ * @since 0.1.0
237
+ * @relatedTo CngxToc, CNGX_TOC
238
+ * <example-url>http://localhost:4200/#/ui/toc/router/fragment-deep-link</example-url>
239
+ */
240
+ declare class CngxTocRouterSync {
241
+ private readonly toc;
242
+ private readonly router;
243
+ private readonly route;
244
+ constructor();
245
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTocRouterSync, never>;
246
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxTocRouterSync, "[cngxTocRouterSync]", ["cngxTocRouterSync"], {}, {}, never, never, true, never>;
247
+ }
248
+
249
+ /**
250
+ * Per-item template slot for `CngxToc`. Project an `<ng-template cngxTocItem>`
251
+ * inside `<cngx-toc>` to replace the built-in plain-label rendering with
252
+ * custom markup - the `let-` variables come out typed via
253
+ * `ngTemplateContextGuard`:
254
+ *
255
+ * ```html
256
+ * <cngx-toc [items]="toc" contentRoot="#article">
257
+ * <ng-template cngxTocItem let-item let-active="active" let-depth="depth">
258
+ * <span [class.is-active]="active">{{ item.label }}</span>
259
+ * @if (depth === 0) { <cngx-badge>{{ item.children?.length }}</cngx-badge> }
260
+ * </ng-template>
261
+ * </cngx-toc>
262
+ * ```
263
+ *
264
+ * Named `CngxTocItemSlot` (not `*Directive`) per the repo's no-artifact-suffix
265
+ * rule; the selector stays `cngxTocItem`, which is what consumers write.
266
+ * Resolves ahead of `CNGX_TOC_CONFIG.templates.item` and the built-in label.
267
+ *
268
+ * @category ui/toc
269
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/toc-item-slot.ts
270
+ * @since 0.1.0
271
+ * @relatedTo CngxToc
272
+ * <example-url>http://localhost:4200/#/ui/toc/slots/custom-item-template</example-url>
273
+ */
274
+ declare class CngxTocItemSlot {
275
+ readonly templateRef: TemplateRef<CngxTocItemContext>;
276
+ static ngTemplateContextGuard(_dir: CngxTocItemSlot, ctx: unknown): ctx is CngxTocItemContext;
277
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTocItemSlot, never>;
278
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxTocItemSlot, "ng-template[cngxTocItem]", ["cngxTocItem"], {}, {}, never, never, true, never>;
279
+ }
280
+
281
+ /**
282
+ * The toc section of a {@link CngxLanguagePack}: the accessible names of
283
+ * `CngxToc`. It feeds the `ariaLabels` of `CNGX_TOC_CONFIG`; a key set through
284
+ * `withTocAriaLabels` still wins.
285
+ *
286
+ * @category ui/toc/i18n
287
+ * @since 0.1.0
288
+ * @relatedTo CNGX_TOC_CONFIG, withTocAriaLabels
289
+ */
290
+ interface CngxTocLanguageSection {
291
+ /** Accessible name of the `nav` landmark. */
292
+ readonly nav: string;
293
+ }
294
+ /**
295
+ * The English toc section: the single source of the toc's English copy. The
296
+ * `CNGX_TOC_CONFIG` labels default to it.
297
+ *
298
+ * @category ui/toc/i18n
299
+ * @since 0.1.0
300
+ * @relatedTo CNGX_TOC_CONFIG
301
+ */
302
+ declare const CNGX_TOC_LANGUAGE_EN: CngxTocLanguageSection;
303
+ declare module '@cngx/core/i18n' {
304
+ interface CngxLanguagePack {
305
+ readonly toc: CngxTocLanguageSection;
306
+ }
307
+ }
308
+
309
+ /**
310
+ * Accessible names the toc renders. A partial of the `toc` language section,
311
+ * declared once there; an unset key reads the section (English without a
312
+ * pack).
313
+ *
314
+ * @category ui/toc
315
+ * @since 0.1.0
316
+ */
317
+ type CngxTocAriaLabels = Partial<CngxTocLanguageSection>;
318
+ /**
319
+ * App-wide cascade for the table-of-contents organism's ARIA label, its
320
+ * scroll behaviour, the `CngxScrollSpy` defaults it forwards, and the default
321
+ * item template.
322
+ *
323
+ * Resolution priority (high -> low):
324
+ * 1. Per-instance Input binding (e.g. `[contentRoot]`, `*cngxTocItem`).
325
+ * 2. `provideTocConfigAt(...)` in a parent component's `viewProviders`
326
+ * (component-scoped override).
327
+ * 3. `provideTocConfig(...)` at the application root.
328
+ * 4. Library defaults (`CNGX_TOC_DEFAULTS`; the names come from the `toc`
329
+ * section of the language pack).
330
+ *
331
+ * Every key is optional - partial overrides deep-merge with the library
332
+ * defaults, so consumers declare only the keys they want to override.
333
+ *
334
+ * @category ui/toc
335
+ * @since 0.1.0
336
+ */
337
+ interface CngxTocConfig {
338
+ /**
339
+ * ARIA-string fallback for the `nav` landmark. A per-instance
340
+ * `[navLabel]`-equivalent binding is not exposed; the landmark name always
341
+ * comes from this cascade, the `toc` section of the language pack by
342
+ * default. Accepts a `Signal` so the
343
+ * name follows a runtime language switch; read the resolved bundle through
344
+ * {@link injectTocAriaLabels}.
345
+ */
346
+ readonly ariaLabels?: CngxTocAriaLabels | Signal<CngxTocAriaLabels>;
347
+ /**
348
+ * Scroll behaviour used when a link is activated and the section is
349
+ * brought into view. `'smooth'` by default; swapped to `'auto'` (instant)
350
+ * at runtime whenever `prefers-reduced-motion: reduce` matches, regardless
351
+ * of this value.
352
+ */
353
+ readonly scrollBehavior?: 'auto' | 'smooth';
354
+ /**
355
+ * Defaults forwarded to the internal `CngxScrollSpy`. Per-instance
356
+ * `[rootMargin]` / `[threshold]` inputs still win; this only moves the
357
+ * cascade default. `contentRoot` has no cascade default - it is viewport
358
+ * (`null`) unless bound per instance.
359
+ */
360
+ readonly spy?: {
361
+ /** Root margin passed to the spy's `IntersectionObserver`. */
362
+ readonly rootMargin?: string;
363
+ /** Minimum visibility ratio for a section to become active. */
364
+ readonly threshold?: number;
365
+ };
366
+ /**
367
+ * Global default template slots. The item slot resolves three-stage:
368
+ * per-instance `*cngxTocItem` -> this `templates.item` -> the built-in
369
+ * plain-label rendering. Set it to give every un-slotted toc the same
370
+ * custom item markup.
371
+ */
372
+ readonly templates?: {
373
+ /** Default per-item template; overridden per instance by `*cngxTocItem`. */
374
+ readonly item?: TemplateRef<CngxTocItemContext>;
375
+ };
376
+ }
377
+
378
+ /**
379
+ * Library defaults for the toc configuration cascade. Carries no copy: the
380
+ * `ariaLabels` defaults are the `toc` section of the language pack; single
381
+ * keys ride the `withTocAriaLabels` feature. The spy defaults (`rootMargin` / `threshold`) mirror
382
+ * `CngxScrollSpy`'s own input defaults so an un-configured toc tracks
383
+ * scrolling identically to a hand-wired spy.
384
+ *
385
+ * Exported for intra-lib consumers (`provideTocConfig` deep-merges with this
386
+ * base) but **NOT** re-exported from `public-api.ts` - downstream consumers
387
+ * reach the defaults via `inject(CNGX_TOC_CONFIG)` so `provideTocConfig` /
388
+ * `provideTocConfigAt` overrides take precedence.
389
+ *
390
+ * @internal
391
+ */
392
+ declare const CNGX_TOC_DEFAULTS: CngxTocConfig;
393
+ /**
394
+ * App-wide configuration cascade for the table-of-contents organism. Resolves
395
+ * in priority order:
396
+ *
397
+ * 1. Per-instance Input binding.
398
+ * 2. `provideTocConfigAt(...)` in a parent component's `viewProviders`.
399
+ * 3. `provideTocConfig(...)` at the application root.
400
+ * 4. Library defaults (this token's `factory`).
401
+ *
402
+ * `providedIn: 'root'` with a default factory means consumers never need to
403
+ * provide the token explicitly - `inject(CNGX_TOC_CONFIG)` always resolves.
404
+ * Consumers who want overrides call `provideTocConfig(...)` in
405
+ * `bootstrapApplication` providers (root cascade) or `provideTocConfigAt(...)`
406
+ * in a component's `viewProviders` (sub-tree cascade).
407
+ *
408
+ * @category ui/toc
409
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/config/toc.config.defaults.ts
410
+ * @since 0.1.0
411
+ */
412
+ declare const CNGX_TOC_CONFIG: InjectionToken<CngxTocConfig>;
413
+
414
+ /**
415
+ * Discriminated-union shape returned by the toc config features -
416
+ * `withTocAriaLabels`, `withTocScrollBehavior`, `withTocSpy`, and
417
+ * `withTocTemplates`. The
418
+ * reducer in `provideTocConfig` / `provideTocConfigAt` matches on `kind` and
419
+ * merges `payload` into the corresponding config sub-tree. Mirrors
420
+ * `CngxBreadcrumbConfigFeature` so the consumer's mental model is one across
421
+ * feature areas.
422
+ *
423
+ * @category ui/toc
424
+ * @since 0.1.0
425
+ */
426
+ type CngxTocConfigFeature = {
427
+ readonly kind: 'ariaLabels';
428
+ readonly payload: CngxTocAriaLabels | Signal<CngxTocAriaLabels>;
429
+ } | {
430
+ readonly kind: 'scrollBehavior';
431
+ readonly payload: {
432
+ readonly scrollBehavior: NonNullable<CngxTocConfig['scrollBehavior']>;
433
+ };
434
+ } | {
435
+ readonly kind: 'spy';
436
+ readonly payload: NonNullable<CngxTocConfig['spy']>;
437
+ } | {
438
+ readonly kind: 'templates';
439
+ readonly payload: NonNullable<CngxTocConfig['templates']>;
440
+ };
441
+ /**
442
+ * Application-root configuration cascade for the toc organism. Pass any
443
+ * combination of `withTocAriaLabels`, `withTocScrollBehavior`, `withTocSpy`,
444
+ * and `withTocTemplates` features in `bootstrapApplication`'s providers array.
445
+ *
446
+ * Resolution priority (high -> low):
447
+ * 1. Per-instance Input binding.
448
+ * 2. `provideTocConfigAt(...)` in a parent component's `viewProviders`.
449
+ * 3. `provideTocConfig(...)` at the application root.
450
+ * 4. Library defaults (`CNGX_TOC_DEFAULTS`).
451
+ *
452
+ * The provider deep-merges supplied features with the library defaults so
453
+ * consumers only declare keys they want to override.
454
+ *
455
+ * ```ts
456
+ * bootstrapApplication(AppComponent, {
457
+ * providers: [
458
+ * provideTocConfig(
459
+ * withTocAriaLabels({ nav: 'On this page' }),
460
+ * withTocScrollBehavior('smooth'),
461
+ * ),
462
+ * ],
463
+ * });
464
+ * ```
465
+ *
466
+ * @category ui/toc
467
+ * @since 0.1.0
468
+ */
469
+ declare function provideTocConfig(...features: CngxTocConfigFeature[]): EnvironmentProviders;
470
+ /**
471
+ * Component-scoped configuration cascade for the toc organism. Pass any
472
+ * combination of feature factories in a parent component's `viewProviders`
473
+ * array.
474
+ *
475
+ * Unlike `provideTocConfig` (root-only), `provideTocConfigAt` injects the
476
+ * parent injector's `CNGX_TOC_CONFIG` value (resolves through the priority
477
+ * chain) and deep-merges the supplied features on top. Descendant toc
478
+ * instances see the merged config; sibling sub-trees keep the inherited value.
479
+ *
480
+ * ```ts
481
+ * @Component({
482
+ * viewProviders: [provideTocConfigAt(withTocScrollBehavior('auto'))],
483
+ * template: '<cngx-toc [items]="toc" contentRoot="#article" />',
484
+ * })
485
+ * class Guide {}
486
+ * ```
487
+ *
488
+ * @category ui/toc
489
+ * @since 0.1.0
490
+ */
491
+ declare function provideTocConfigAt(...features: CngxTocConfigFeature[]): Provider[];
492
+
493
+ /**
494
+ * Override the toc's ARIA-string fallback - the accessible name of the `nav`
495
+ * landmark that wraps the link list (default `'On this page'`). Pass a
496
+ * `Signal` to switch the language at runtime.
497
+ *
498
+ * ```ts
499
+ * provideTocConfig(withTocAriaLabels({ nav: 'Auf dieser Seite' }));
500
+ * ```
501
+ *
502
+ * @category ui/toc
503
+ * @since 0.1.0
504
+ */
505
+ declare function withTocAriaLabels(payload: CngxTocAriaLabels | Signal<CngxTocAriaLabels>): CngxTocConfigFeature;
506
+ /**
507
+ * Set the app-wide default scroll behaviour used when a link is activated.
508
+ * `'smooth'` by default; the organism still swaps to `'auto'` at runtime
509
+ * whenever `prefers-reduced-motion: reduce` matches, so this only chooses the
510
+ * motion-allowed behaviour.
511
+ *
512
+ * ```ts
513
+ * provideTocConfig(withTocScrollBehavior('auto'));
514
+ * ```
515
+ *
516
+ * @category ui/toc
517
+ * @since 0.1.0
518
+ */
519
+ declare function withTocScrollBehavior(scrollBehavior: NonNullable<CngxTocConfig['scrollBehavior']>): CngxTocConfigFeature;
520
+ /**
521
+ * Move the app-wide `CngxScrollSpy` defaults - the `rootMargin` and
522
+ * `threshold` the rail forwards to its internal spy. Per-instance
523
+ * `[rootMargin]` / `[threshold]` bindings still win; this only sets the
524
+ * cascade default (e.g. a fixed-header offset every toc should share).
525
+ *
526
+ * ```ts
527
+ * provideTocConfig(withTocSpy({ rootMargin: '-80px 0px 0px 0px' }));
528
+ * ```
529
+ *
530
+ * @category ui/toc
531
+ * @since 0.1.0
532
+ */
533
+ declare function withTocSpy(payload: NonNullable<CngxTocConfig['spy']>): CngxTocConfigFeature;
534
+ /**
535
+ * Register a global default item template. Resolves after a per-instance
536
+ * `*cngxTocItem` slot and before the built-in plain-label rendering, so every
537
+ * un-slotted toc renders the same custom item markup.
538
+ *
539
+ * ```ts
540
+ * @Component({
541
+ * viewProviders: [provideTocConfigAt(withTocTemplates({ item: myItemTpl }))],
542
+ * })
543
+ * ```
544
+ *
545
+ * @category ui/toc
546
+ * @since 0.1.0
547
+ */
548
+ declare function withTocTemplates(payload: NonNullable<CngxTocConfig['templates']>): CngxTocConfigFeature;
549
+
550
+ /**
551
+ * Convenience accessor for the toc configuration cascade. Runs in injection
552
+ * context; resolves through the priority chain (per-instance Input ->
553
+ * `provideTocConfigAt` -> `provideTocConfig` -> library defaults). Equivalent
554
+ * to `inject(CNGX_TOC_CONFIG)` - the helper exists so consumers don't import
555
+ * the token directly. Mirrors `injectBreadcrumbConfig`.
556
+ *
557
+ * ```ts
558
+ * export class CngxToc {
559
+ * private readonly cfg = injectTocConfig();
560
+ * protected readonly navLabel = computed(() => this.cfg.ariaLabels?.nav ?? 'On this page');
561
+ * }
562
+ * ```
563
+ *
564
+ * @category ui/toc
565
+ * @since 0.1.0
566
+ */
567
+ declare function injectTocConfig(): CngxTocConfig;
568
+ /**
569
+ * The resolved accessible names of the toc config in scope, every key the
570
+ * config leaves unset (also a key an override sets to `undefined`) filled from
571
+ * the `toc` section of the active pack, as a Signal that follows a runtime
572
+ * language switch. Runs in injection context; read it inside a `computed()`, a template
573
+ * or a handler.
574
+ *
575
+ * @category ui/toc
576
+ * @since 0.1.0
577
+ */
578
+ declare function injectTocAriaLabels(): Signal<Required<CngxTocAriaLabels>>;
579
+
580
+ export { CNGX_TOC, CNGX_TOC_CONFIG, CNGX_TOC_DEFAULTS, CNGX_TOC_LANGUAGE_EN, CngxToc, CngxTocItemSlot, CngxTocRouterSync, injectTocAriaLabels, injectTocConfig, provideTocConfig, provideTocConfigAt, withTocAriaLabels, withTocScrollBehavior, withTocSpy, withTocTemplates };
581
+ export type { CngxTocAriaLabels, CngxTocConfig, CngxTocConfigFeature, CngxTocContract, CngxTocItem, CngxTocItemContext, CngxTocLanguageSection };
@@ -8,12 +8,15 @@ export { CngxFailed, CngxPending, CngxSucceeded } from '@cngx/common/interactive
8
8
  /**
9
9
  * @cngx/ui
10
10
  *
11
- * UI components for cngx composable Angular extensions.
12
- * Secondary entry points:
13
- * @cngx/ui/layout – CngxStack, CngxGrid
14
- * @cngx/ui/overlay – CngxOverlay, CngxOverlayRef
11
+ * Organism layer of cngx: 26 secondary entry points (layout, overlay,
12
+ * feedback, stepper/mat-stepper, tabs/mat-tabs, accordion/mat-accordion,
13
+ * paginator/mat-paginator, sidenav, breadcrumb, timeline, toc,
14
+ * command-palette, context-menu, collection, stat-card, chart-panel,
15
+ * data-grid-accordion, empty-state, action-button, skeleton, speak, a11y).
16
+ * Import from the specific entry point; the root barrel keeps only a
17
+ * small backwards-compat set (see public-api.ts).
15
18
  */
16
- /** @internal — replaced at publish time, not part of consumer API. */
19
+ /** @internal - replaced at publish time, not part of consumer API. */
17
20
  declare const VERSION: _cngx_utils.Version;
18
21
 
19
22
  export { VERSION };