igniteui-astro-components 1.7.0 → 1.8.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/README.md +322 -158
- package/llms-full.txt +3207 -0
- package/llms.txt +103 -0
- package/package.json +17 -5
- package/src/assets/icons/figma-logo.svg +10 -0
- package/src/code-theme/README.md +72 -0
- package/src/code-theme/index.ts +57 -0
- package/src/components/CopyCode/CopyCode.astro +6 -1
- package/src/components/CopyCode/README.md +38 -0
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +28 -30
- package/src/components/DocsSidebar/README.md +58 -30
- package/src/components/DocsSidebar/SidebarLabel.astro +34 -36
- package/src/components/DocsSubHeader/README.md +24 -31
- package/src/components/DocsToc/DocsToc.astro +12 -14
- package/src/components/DocsToc/README.md +7 -7
- package/src/components/DocsTree/DocsTree.astro +9 -11
- package/src/components/DocsTree/DocsTreeItem.astro +36 -40
- package/src/components/DocsTree/README.md +12 -9
- package/src/components/GlobalFooter/GlobalFooter.astro +6 -8
- package/src/components/GlobalNavBar/GlobalNavBar.astro +2 -4
- package/src/components/LicenseIndicator/LicenseIndicator.astro +6 -8
- package/src/components/MobileTocToggle/MobileTocToggle.astro +31 -33
- package/src/components/MobileTocToggle/README.md +45 -0
- package/src/components/Search/README.md +10 -10
- package/src/components/Search/Search.astro +12 -6
- package/src/components/SearchAdvanced/README.md +15 -8
- package/src/components/SearchAdvanced/SearchAdvanced.astro +17 -15
- package/src/components/ThemingWidget/ThemingWidget.astro +62 -60
- package/src/components/mdx/Anatomy/Anatomy.scss +1 -1
- package/src/components/mdx/Anatomy/README.md +40 -0
- package/src/components/mdx/ApiLink/ApiLink.astro +7 -9
- package/src/components/mdx/ApiLink/README.md +1 -0
- package/src/components/mdx/ApiRef/ApiRef.astro +7 -9
- package/src/components/mdx/ApiRef/README.md +1 -1
- package/src/components/mdx/Badge/Badge.astro +3 -1
- package/src/components/mdx/Badge/README.md +1 -3
- package/src/components/mdx/DocsAside/DocsAside.astro +3 -5
- package/src/components/mdx/DocsAside/README.md +47 -29
- package/src/components/mdx/Faq/Faq.astro +11 -13
- package/src/components/mdx/Faq/FaqItem.astro +20 -26
- package/src/components/mdx/FigmaUiKits/FigmaUiKits.astro +126 -0
- package/src/components/mdx/FigmaUiKits/FigmaUiKits.scss +165 -0
- package/src/components/mdx/FigmaUiKits/README.md +115 -0
- package/src/components/mdx/FigmaUiKits/kits.ts +26 -0
- package/src/components/mdx/PlatformBlock/README.md +5 -18
- package/src/components/mdx/Sample/README.md +67 -50
- package/src/components/mdx/Sample/Sample.astro +108 -33
- package/src/components/mdx/Sample/Sample.scss +38 -17
- package/src/integration.ts +6 -21
- package/src/layouts/DocsLayout/README.md +63 -28
- package/src/lib/warn-once.ts +8 -0
- package/src/scripts/copy-status.ts +35 -0
- package/src/scripts/icon-manifest.ts +1 -0
- package/src/scripts/sample-widget.ts +109 -42
- package/src/styles/global/_code-blocks.scss +58 -36
- package/src/styles/global/_copy-button.scss +18 -25
- package/src/styles/global/_markdown.scss +15 -8
- package/src/styles/global/_variables.scss +57 -0
- package/src/styles/theme.scss +4 -1
- package/src/virtual-modules.d.ts +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
# Sidebar suite
|
|
2
2
|
|
|
3
|
-
The sidebar is composed of
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
|
7
|
-
|
|
|
8
|
-
| `
|
|
9
|
-
| `
|
|
10
|
-
| `
|
|
11
|
-
| `
|
|
12
|
-
| `sidebar-
|
|
3
|
+
The sidebar is composed of a few focused pieces on top of the shared
|
|
4
|
+
[`DocsTree`](../DocsTree/README.md) component:
|
|
5
|
+
|
|
6
|
+
| File | Export path | Description |
|
|
7
|
+
| -------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------- |
|
|
8
|
+
| `DocsSidebar.astro` | `…/components/DocsSidebar/DocsSidebar.astro` | Composition root — logo, filter and the scrollable tree |
|
|
9
|
+
| `SidebarFilterInput.astro` | `…/components/DocsSidebar/SidebarFilterInput.astro` | Filter `<input>` markup (`data-sidebar-filter-*` hooks) |
|
|
10
|
+
| `SidebarLabel.astro` | `…/components/DocsSidebar/SidebarLabel.astro` | Label renderer passed to `DocsTree` (`node`, `depth`, `isLeaf`, `isActive`) |
|
|
11
|
+
| `toTreeNodes.ts` | `…/components/DocsSidebar/toTreeNodes` | `SidebarEntry[]` → `TreeNode[]` adapter |
|
|
12
|
+
| `sidebar-filter.ts` | `…/components/DocsSidebar/sidebar-filter` | `<sidebar-filter>` custom element |
|
|
13
|
+
| `sidebar-tooltip.ts` | (internal) | Full-text tooltip for truncated labels |
|
|
13
14
|
|
|
14
15
|
---
|
|
15
16
|
|
|
@@ -20,15 +21,20 @@ The only component you need to mount directly.
|
|
|
20
21
|
### Import
|
|
21
22
|
|
|
22
23
|
```astro
|
|
23
|
-
import DocsSidebar from 'igniteui-astro-components/components/
|
|
24
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
### Props
|
|
27
28
|
|
|
28
|
-
| Prop
|
|
29
|
-
|
|
|
30
|
-
| `currentSlug`
|
|
31
|
-
| `items`
|
|
29
|
+
| Prop | Type | Default | Description |
|
|
30
|
+
| -------------------- | ---------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
31
|
+
| `currentSlug` | `string` | `''` | Slug of the active page. Highlights the matching link and auto-expands ancestor groups. |
|
|
32
|
+
| `items` | `SidebarEntry[]` | virtual module | Sidebar tree to render. **Overrides** the `virtual:docs-template/site-meta` value when provided. Use this when not running `siteMetaIntegration`. |
|
|
33
|
+
| `showFilter` | `boolean` | `true` | Render the filter input above the tree. |
|
|
34
|
+
| `trailingSlash` | `boolean` | from Astro config | Append a trailing slash to generated links. Derived from the site's `trailingSlash` setting via the virtual module; `true` when unknown. |
|
|
35
|
+
| `logoText` | `string` | product family | Text in the slide-in sidebar's logo area. |
|
|
36
|
+
| `platformLabel` | `string \| null` | from virtual module | Platform label under the logo text (for example `'Angular'`). Pass `null` to hide it. |
|
|
37
|
+
| `singleBranchExpand` | `boolean` | `true` | Keep one branch open: only the current page's groups start open and expanding a group collapses the others. The filter still opens every match. With the default, a group's `collapsed` is ignored; set `false` to honour `collapsed`. |
|
|
32
38
|
|
|
33
39
|
### Example
|
|
34
40
|
|
|
@@ -36,14 +42,13 @@ import DocsSidebar from 'igniteui-astro-components/components/sidebar/DocsSideba
|
|
|
36
42
|
|
|
37
43
|
```astro
|
|
38
44
|
---
|
|
39
|
-
import DocsSidebar from 'igniteui-astro-components/components/
|
|
45
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
40
46
|
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
41
47
|
|
|
42
48
|
// Define the tree inline or import from a shared config file.
|
|
43
49
|
const sidebar: SidebarEntry[] = [
|
|
44
50
|
{
|
|
45
51
|
label: 'Getting Started',
|
|
46
|
-
collapsed: false,
|
|
47
52
|
items: [
|
|
48
53
|
{ label: 'Introduction', slug: '' },
|
|
49
54
|
{ label: 'Installation', slug: 'installation' },
|
|
@@ -51,13 +56,12 @@ const sidebar: SidebarEntry[] = [
|
|
|
51
56
|
},
|
|
52
57
|
{
|
|
53
58
|
label: 'Components',
|
|
54
|
-
collapsed: false,
|
|
55
59
|
items: [
|
|
56
60
|
{ label: 'Toast', slug: 'components/toast' },
|
|
57
61
|
{
|
|
58
62
|
label: 'Calendar',
|
|
59
63
|
slug: 'components/calendar',
|
|
60
|
-
|
|
64
|
+
badges: [{ text: 'New', variant: 'new' }],
|
|
61
65
|
},
|
|
62
66
|
],
|
|
63
67
|
},
|
|
@@ -83,7 +87,7 @@ When `createDocsSite()` / `siteMetaIntegration()` is configured, omit
|
|
|
83
87
|
|
|
84
88
|
```astro
|
|
85
89
|
---
|
|
86
|
-
import DocsSidebar from 'igniteui-astro-components/components/
|
|
90
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
87
91
|
---
|
|
88
92
|
|
|
89
93
|
<DocsSidebar currentSlug="components/toast" />
|
|
@@ -120,7 +124,7 @@ module:
|
|
|
120
124
|
// astro.config.ts
|
|
121
125
|
import { buildSidebarFromToc, siteMetaIntegration } from 'igniteui-astro-components/integration';
|
|
122
126
|
|
|
123
|
-
const sidebar = buildSidebarFromToc({ tocPath: './docs/toc.
|
|
127
|
+
const sidebar = buildSidebarFromToc({ tocPath: './docs/toc.json', docsDir: './docs/en' });
|
|
124
128
|
|
|
125
129
|
export default defineConfig({
|
|
126
130
|
integrations: [siteMetaIntegration({ title: 'My Docs', sidebar })],
|
|
@@ -129,23 +133,32 @@ export default defineConfig({
|
|
|
129
133
|
|
|
130
134
|
### SidebarEntry type
|
|
131
135
|
|
|
136
|
+
Import from `igniteui-astro-components/lib/sidebar/types`; the file is the
|
|
137
|
+
source of truth, this is a summary:
|
|
138
|
+
|
|
132
139
|
```ts
|
|
140
|
+
type SidebarBadge = { text: string; variant: 'new' | 'updated' | 'preview' | 'premium' };
|
|
141
|
+
|
|
133
142
|
type SidebarLink = {
|
|
134
143
|
label: string;
|
|
135
144
|
slug: string;
|
|
136
|
-
|
|
145
|
+
badges?: SidebarBadge[];
|
|
137
146
|
attrs?: Record<string, string | boolean | undefined>;
|
|
138
147
|
};
|
|
139
148
|
|
|
140
149
|
type SidebarGroup = {
|
|
141
150
|
label: string;
|
|
142
|
-
collapsed?: boolean; //
|
|
151
|
+
collapsed?: boolean; // closed by default when true; read only with singleBranchExpand={false}
|
|
143
152
|
items: SidebarEntry[];
|
|
144
153
|
};
|
|
145
154
|
|
|
146
155
|
type SidebarEntry = SidebarLink | SidebarGroup;
|
|
147
156
|
```
|
|
148
157
|
|
|
158
|
+
`SIDEBAR_BADGE_VARIANTS` is exported from the same module. Helpers such as
|
|
159
|
+
`isGroup`, `isActive`, `getBreadcrumb` and `joinPath` live in
|
|
160
|
+
`igniteui-astro-components/lib/sidebar/helpers`.
|
|
161
|
+
|
|
149
162
|
### Filter behaviour
|
|
150
163
|
|
|
151
164
|
The `<sidebar-filter>` custom element handles live filtering:
|
|
@@ -168,15 +181,30 @@ clamped and the tooltip is not shown.
|
|
|
168
181
|
|
|
169
182
|
---
|
|
170
183
|
|
|
171
|
-
##
|
|
184
|
+
## Building a custom sidebar
|
|
172
185
|
|
|
173
|
-
|
|
186
|
+
`DocsSidebar` converts `SidebarEntry[]` to `TreeNode[]` with `toTreeNodes()`
|
|
187
|
+
and renders them through `DocsTree` with `SidebarLabel` as the label renderer.
|
|
188
|
+
To build your own layout, reuse those pieces:
|
|
174
189
|
|
|
175
190
|
```astro
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
191
|
+
---
|
|
192
|
+
import DocsTree from 'igniteui-astro-components/components/DocsTree/DocsTree.astro';
|
|
193
|
+
import SidebarLabel from 'igniteui-astro-components/components/DocsSidebar/SidebarLabel.astro';
|
|
194
|
+
import { toTreeNodes } from 'igniteui-astro-components/components/DocsSidebar/toTreeNodes';
|
|
195
|
+
import { normalizeSlug } from 'igniteui-astro-components/lib/sidebar/helpers';
|
|
196
|
+
|
|
197
|
+
const nodes = toTreeNodes(sidebar, currentSlug, { trailingSlash: true });
|
|
198
|
+
---
|
|
179
199
|
|
|
180
|
-
|
|
200
|
+
<DocsTree
|
|
201
|
+
nodes={nodes}
|
|
202
|
+
variant="sidebar"
|
|
203
|
+
activeId={normalizeSlug(currentSlug)}
|
|
204
|
+
toggleNodeOnClick
|
|
205
|
+
renderLabel={SidebarLabel}
|
|
206
|
+
/>
|
|
207
|
+
```
|
|
181
208
|
|
|
182
|
-
|
|
209
|
+
See the [DocsTree README](../DocsTree/README.md) for the `TreeNode` shape and
|
|
210
|
+
the `--docs-tree-*` styling tokens.
|
|
@@ -26,41 +26,39 @@ const { node, isLeaf } = Astro.props;
|
|
|
26
26
|
const badges = (node.meta?.badges ?? []) as SidebarBadge[];
|
|
27
27
|
---
|
|
28
28
|
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.map((badge) => (
|
|
39
|
-
<>
|
|
40
|
-
<Badge variant={badge.variant} class="sidebar-badge" aria-hidden="true">
|
|
41
|
-
<span>{badge.text}</span>
|
|
42
|
-
</Badge>
|
|
43
|
-
<span class="visually-hidden">, {badge.text}</span>
|
|
44
|
-
</>
|
|
45
|
-
))}
|
|
46
|
-
{badges.some((b) => b.variant === 'premium') && (
|
|
29
|
+
{isLeaf ? (
|
|
30
|
+
<>
|
|
31
|
+
<div class="igd-label-and-badge">
|
|
32
|
+
<span class="docs-tree-label">{node.label}</span>
|
|
33
|
+
{badges.length > 0 && (
|
|
34
|
+
<div class="igd-badge-container">
|
|
35
|
+
{badges
|
|
36
|
+
.filter((b) => b.variant !== 'premium')
|
|
37
|
+
.map((badge) => (
|
|
47
38
|
<>
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
aria-hidden="true"
|
|
53
|
-
/>
|
|
54
|
-
<span class="visually-hidden">, Premium</span>
|
|
39
|
+
<Badge variant={badge.variant} class="sidebar-badge" aria-hidden="true">
|
|
40
|
+
<span>{badge.text}</span>
|
|
41
|
+
</Badge>
|
|
42
|
+
<span class="visually-hidden">, {badge.text}</span>
|
|
55
43
|
</>
|
|
56
|
-
)}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
44
|
+
))}
|
|
45
|
+
{badges.some((b) => b.variant === 'premium') && (
|
|
46
|
+
<>
|
|
47
|
+
<igc-icon
|
|
48
|
+
name="premium"
|
|
49
|
+
collection="docs"
|
|
50
|
+
class="sidebar-premium-icon"
|
|
51
|
+
aria-hidden="true"
|
|
52
|
+
/>
|
|
53
|
+
<span class="visually-hidden">, Premium</span>
|
|
54
|
+
</>
|
|
55
|
+
)}
|
|
56
|
+
</div>
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
</>
|
|
60
|
+
) : (
|
|
61
|
+
<span class="group-label-text">
|
|
62
|
+
<span>{node.label}</span>
|
|
63
|
+
</span>
|
|
64
|
+
)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DocsSubHeader
|
|
2
2
|
|
|
3
|
-
Secondary fixed header bar rendered below the `GlobalNavBar`. Contains the
|
|
3
|
+
Secondary fixed header bar rendered below the `GlobalNavBar`. Contains the logo, the search button and the package and version selectors.
|
|
4
4
|
|
|
5
5
|
> **Note:** The breadcrumb trail was extracted into the standalone [`DocsBreadcrumb`](../DocsBreadcrumb/README.md) component and is now rendered inside the main content frame, above the page body — not in this bar.
|
|
6
6
|
|
|
@@ -12,18 +12,23 @@ import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.as
|
|
|
12
12
|
|
|
13
13
|
## Props
|
|
14
14
|
|
|
15
|
-
| Prop | Type
|
|
16
|
-
| ----------------- |
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| ----------------- | ---------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `logoText` | `string` | by platform | Text shown in the logo area while `GlobalNavBar` is visible; `'Ignite UI'` or `'Ultimate UI'` by default. |
|
|
18
|
+
| `packages` | `Array<string \| { label: string; value?: string; href?: string; base?: string }>` | virtual module | Entries for the package selector. A string is both label and value; `href` navigates on selection; `base` swaps the site base to keep the current page. Falls back to the virtual module's `packages`; the selector is hidden only when both are empty. |
|
|
19
|
+
| `selectedPackage` | `string` | virtual module | Currently selected package (must match one of `packages`). Falls back to the virtual module's `selectedPackage`, then to the first entry. |
|
|
20
|
+
| `packageLabel` | `string` | `'Package'` | `aria-label` of the package selector (not a visible label). |
|
|
21
|
+
| `versions` | `string[]` | — | Version labels for the version selector dropdown. Hidden when omitted. |
|
|
22
|
+
| `selectedVersion` | `string` | — | Currently selected version (must match one of `versions`). |
|
|
23
|
+
| `versionLabel` | `string` | `'Version'` | `aria-label` of the version selector (not a visible label). |
|
|
24
|
+
|
|
25
|
+
Accepted but not rendered (kept for compatibility; see the DocsSubHeader dead-props issue):
|
|
26
|
+
|
|
27
|
+
| Prop | Why it has no effect |
|
|
28
|
+
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
29
|
+
| `siteTitle`, `pageTitle`, `currentSlug`, `sidebarItems` | Breadcrumb inputs. The breadcrumb moved to `DocsBreadcrumb`; the sub-header computes the crumbs and discards them. |
|
|
30
|
+
| `productLinks` | The product-links markup is commented out. |
|
|
31
|
+
| `showThemeToggle`, `themeStorageKey` | Destructured and never used. No toggle is rendered; `DocsLayout` hard-codes the `'docs-theme'` storage key. |
|
|
27
32
|
|
|
28
33
|
`PackageEntry` is `{ label: string; value?: string; href?: string; base?: string }`:
|
|
29
34
|
|
|
@@ -46,32 +51,23 @@ import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.as
|
|
|
46
51
|
page on that site instead: the current URL with this site's base (`import.meta.env.BASE_URL`)
|
|
47
52
|
swapped for `base`, keeping the query and `#hash`. Nothing checks that the page exists there, so
|
|
48
53
|
the server should redirect missing pages, e.g. to the platform's getting started page.
|
|
49
|
-
- Product links from the virtual module are shown; the currently active platform link is hidden.
|
|
50
54
|
- The search button opens the Pagefind dialog (see `Search` component).
|
|
51
|
-
-
|
|
52
|
-
- `--docs-global-nav-height` (default `4.7rem`) — height of the `GlobalNavBar` above
|
|
53
|
-
- `--docs-subheader-height` (default `2.5rem`) — height of this bar
|
|
55
|
+
- `DocsLayout` sets `--docs-global-nav-height` on the wrapper from the measured nav height; no stylesheet in this package reads it or `--docs-subheader-height`.
|
|
54
56
|
|
|
55
57
|
## Example
|
|
56
58
|
|
|
57
59
|
```astro
|
|
58
60
|
---
|
|
59
61
|
import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.astro';
|
|
60
|
-
|
|
61
|
-
const productLinks = [
|
|
62
|
-
{ label: 'Angular', href: '/angular/', platform: 'angular' },
|
|
63
|
-
{ label: 'React', href: '/react/', platform: 'react' },
|
|
64
|
-
{ label: 'Web Components', href: '/web-components/', platform: 'web-components' },
|
|
65
|
-
];
|
|
66
62
|
---
|
|
67
63
|
|
|
68
|
-
<DocsSubHeader
|
|
64
|
+
<DocsSubHeader />
|
|
69
65
|
```
|
|
70
66
|
|
|
71
67
|
This component is used automatically inside `DocsLayout` — you only need to
|
|
72
68
|
mount it directly when building a custom page shell.
|
|
73
69
|
|
|
74
|
-
### With package/version selectors
|
|
70
|
+
### With package/version selectors
|
|
75
71
|
|
|
76
72
|
```astro
|
|
77
73
|
---
|
|
@@ -80,20 +76,17 @@ import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.
|
|
|
80
76
|
---
|
|
81
77
|
|
|
82
78
|
<DocsSubHeader
|
|
83
|
-
siteTitle="Ignite UI for Angular"
|
|
84
79
|
packages={['igniteui-angular', 'igniteui-charts']}
|
|
85
80
|
selectedPackage="igniteui-angular"
|
|
86
81
|
packageLabel="Package"
|
|
87
82
|
versions={['19.1 (latest)', '18.2', '18.1']}
|
|
88
83
|
selectedVersion="19.1 (latest)"
|
|
89
84
|
versionLabel="Version"
|
|
90
|
-
showThemeToggle
|
|
91
|
-
themeStorageKey="api-docs-theme"
|
|
92
|
-
productLinks={[]}
|
|
93
85
|
>
|
|
94
86
|
<SearchAdvanced slot="search" showScope tabs={[]} />
|
|
95
87
|
</DocsSubHeader>
|
|
96
88
|
```
|
|
97
89
|
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
`#package-select` and `#version-select` are `igc-select` elements and emit
|
|
91
|
+
`igcChange` (not a native `change` event); attach your own navigation logic
|
|
92
|
+
via `document.getElementById`.
|
|
@@ -26,20 +26,18 @@ const { headings = [], tocConfig, label = 'On this page', offsetTarget } = Astro
|
|
|
26
26
|
const nodes = headingsToTreeNodes(headings, tocConfig);
|
|
27
27
|
---
|
|
28
28
|
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
42
|
-
}
|
|
29
|
+
{nodes.length > 0 && (
|
|
30
|
+
<aside class="toc-wrapper" data-pagefind-ignore="all">
|
|
31
|
+
<docs-toc class="toc-sidebar" data-offset-target={offsetTarget}>
|
|
32
|
+
<h2 class="toc-sidebar__heading" id="toc-heading">
|
|
33
|
+
{label}
|
|
34
|
+
</h2>
|
|
35
|
+
<nav aria-labelledby="toc-heading">
|
|
36
|
+
<DocsTree nodes={nodes} variant="toc" />
|
|
37
|
+
</nav>
|
|
38
|
+
</docs-toc>
|
|
39
|
+
</aside>
|
|
40
|
+
)}
|
|
43
41
|
|
|
44
42
|
<script>
|
|
45
43
|
type ExpandableEl = HTMLElement & { expanded: boolean };
|
|
@@ -12,12 +12,12 @@ import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
|
12
12
|
|
|
13
13
|
## Props
|
|
14
14
|
|
|
15
|
-
| Prop | Type | Default | Description
|
|
16
|
-
| -------------- | ----------------------------------------------------------------- | ---------------- |
|
|
17
|
-
| `headings` | `MarkdownHeading[]` | `[]` | Array of headings from Astro's `getHeadings()` or MDX frontmatter.
|
|
18
|
-
| `tocConfig` | `false \| { minHeadingLevel?: number; maxHeadingLevel?: number }` | — | Pass `false` to disable the TOC entirely.
|
|
19
|
-
| `label` | `string` | `'On this page'` | Heading label rendered above the list.
|
|
20
|
-
| `offsetTarget` | `string` | — | CSS selector for a sticky element (e.g. a nav bar). Its bottom edge is used as the scroll-spy threshold and sets `scroll-padding-top` automatically. |
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| -------------- | ----------------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `headings` | `MarkdownHeading[]` | `[]` | Array of headings from Astro's `getHeadings()` or MDX frontmatter. |
|
|
18
|
+
| `tocConfig` | `false \| { minHeadingLevel?: number; maxHeadingLevel?: number }` | — | Pass `false` to disable the TOC entirely. |
|
|
19
|
+
| `label` | `string` | `'On this page'` | Heading label rendered above the list. |
|
|
20
|
+
| `offsetTarget` | `string` | — | CSS selector for a sticky element (e.g. a nav bar). Its bottom edge is used as the scroll-spy threshold and sets `scroll-padding-top` automatically. Falls back to the `DocsSubHeader` element (`docs-subheader-menu`) when omitted or not found. |
|
|
21
21
|
|
|
22
22
|
`tocConfig` defaults:
|
|
23
23
|
|
|
@@ -49,7 +49,7 @@ Place it in the `toc` slot of `DocsLayout`: `<DocsToc slot="toc" headings={headi
|
|
|
49
49
|
|
|
50
50
|
## Scroll-spy behaviour
|
|
51
51
|
|
|
52
|
-
- The active link is determined by comparing each heading's position to a threshold (the bottom of the `offsetTarget` element + 8 px
|
|
52
|
+
- The active link is determined by comparing each heading's position to a threshold (the bottom of the `offsetTarget` element, or of the `DocsSubHeader`, + 8 px; 160 px when neither exists).
|
|
53
53
|
- At the bottom of the page the last heading is always highlighted, even if its section is too short to ever cross the threshold.
|
|
54
54
|
- **Click-pin**: clicking a TOC link immediately marks it active and suppresses the scroll-spy until the user interacts with the page via wheel, touch, or keyboard.
|
|
55
55
|
- The component uses `requestAnimationFrame` batching so scroll and resize handlers are cheap.
|
|
@@ -44,17 +44,15 @@ const { nodes, variant, activeId, toggleNodeOnClick, ariaLabel, renderLabel } =
|
|
|
44
44
|
aria-label={ariaLabel}
|
|
45
45
|
toggle-node-on-click={toggleNodeOnClick ? '' : undefined}
|
|
46
46
|
>
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
))
|
|
57
|
-
}
|
|
47
|
+
{nodes.map((node) => (
|
|
48
|
+
<DocsTreeItem
|
|
49
|
+
node={node}
|
|
50
|
+
depth={0}
|
|
51
|
+
variant={variant}
|
|
52
|
+
activeId={activeId}
|
|
53
|
+
renderLabel={renderLabel}
|
|
54
|
+
/>
|
|
55
|
+
))}
|
|
58
56
|
</igc-tree>
|
|
59
57
|
|
|
60
58
|
<script>
|
|
@@ -56,45 +56,41 @@ if (node.itemData) {
|
|
|
56
56
|
expanded={node.expanded ? '' : undefined}
|
|
57
57
|
{...dataAttrs}
|
|
58
58
|
>
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
)
|
|
86
|
-
}
|
|
59
|
+
{node.href ? (
|
|
60
|
+
<div slot="label">
|
|
61
|
+
{/* The anchor is used only for navigation purpose it behave as an overlay on the ::part(wrapper) */}
|
|
62
|
+
<a
|
|
63
|
+
href={node.href}
|
|
64
|
+
aria-current={isActive ? 'page' : undefined}
|
|
65
|
+
class="docs-tree-link"
|
|
66
|
+
{...node.linkAttrs}
|
|
67
|
+
/>
|
|
68
|
+
{hasChildren && <igc-icon name="chevron" collection="docs" class="tree-expand-icon" />}
|
|
69
|
+
{RenderLabel ? (
|
|
70
|
+
<RenderLabel node={node} depth={depth} isLeaf={isLeaf} isActive={isActive} />
|
|
71
|
+
) : (
|
|
72
|
+
<span class="docs-tree-label">{node.label}</span>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
) : (
|
|
76
|
+
<div slot="label" class="docs-tree-group">
|
|
77
|
+
<igc-icon name="chevron" collection="docs" class="tree-expand-icon" />
|
|
78
|
+
{RenderLabel ? (
|
|
79
|
+
<RenderLabel node={node} depth={depth} isLeaf={isLeaf} isActive={isActive} />
|
|
80
|
+
) : (
|
|
81
|
+
<span class="docs-tree-label">{node.label}</span>
|
|
82
|
+
)}
|
|
83
|
+
</div>
|
|
84
|
+
)}
|
|
87
85
|
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
))
|
|
99
|
-
}
|
|
86
|
+
{hasChildren &&
|
|
87
|
+
node.children!.map((child) => (
|
|
88
|
+
<Astro.self
|
|
89
|
+
node={child}
|
|
90
|
+
depth={depth + 1}
|
|
91
|
+
variant={variant}
|
|
92
|
+
activeId={activeId}
|
|
93
|
+
renderLabel={RenderLabel}
|
|
94
|
+
/>
|
|
95
|
+
))}
|
|
100
96
|
</igc-tree-item>
|
|
@@ -4,7 +4,7 @@ Base tree component shared by `DocsSidebar` and `DocsToc`. Wraps
|
|
|
4
4
|
`<igc-tree>` from `igniteui-webcomponents` and recursively renders
|
|
5
5
|
`<igc-tree-item>`s from a generic `TreeNode[]`.
|
|
6
6
|
|
|
7
|
-
The single styling locus is [`docs-tree.
|
|
7
|
+
The single styling locus is [`docs-tree.scss`](./docs-tree.scss). Designers
|
|
8
8
|
tune values via the `--docs-tree-*` CSS custom properties; per-variant
|
|
9
9
|
tweaks live at the bottom of the file under `[data-variant="sidebar"]`
|
|
10
10
|
and `[data-variant="toc"]` selectors.
|
|
@@ -31,13 +31,16 @@ const nodes: TreeNode[] = [/* your tree */];
|
|
|
31
31
|
|
|
32
32
|
## Props
|
|
33
33
|
|
|
34
|
-
| Prop | Type | Notes
|
|
35
|
-
| ------------------- | -------------------- |
|
|
36
|
-
| `nodes` | `TreeNode[]` | Required. Root of the tree.
|
|
37
|
-
| `variant` | `'sidebar' \| 'toc'` | Required. Drives variant CSS rules.
|
|
38
|
-
| `activeId` | `string` | Optional. SSR-time match against `TreeNode.id`. **See active-state contract below.**
|
|
39
|
-
| `toggleNodeOnClick` | `boolean` | Optional. Forwarded to `<igc-tree>`.
|
|
40
|
-
| `renderLabel` | Astro component | Optional. Receives `{ node, depth, isLeaf, isActive }`. Falls back to a plain `<span>{node.label}</span>` when omitted.
|
|
34
|
+
| Prop | Type | Notes |
|
|
35
|
+
| ------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
36
|
+
| `nodes` | `TreeNode[]` | Required. Root of the tree. |
|
|
37
|
+
| `variant` | `'sidebar' \| 'toc'` | Required. Drives variant CSS rules. |
|
|
38
|
+
| `activeId` | `string` | Optional. SSR-time match against `TreeNode.id`. **See active-state contract below.** |
|
|
39
|
+
| `toggleNodeOnClick` | `boolean` | Optional. Forwarded to `<igc-tree>`. |
|
|
40
|
+
| `renderLabel` | Astro component | Optional. Receives `{ node, depth, isLeaf, isActive }`. Falls back to a plain `<span>{node.label}</span>` when omitted. |
|
|
41
|
+
| `ariaLabel` | `string` | Optional. Accessible name for the tree's `nav` role. Skip it when an outer `<nav aria-labelledby>` already names the region. |
|
|
42
|
+
|
|
43
|
+
`DocsTreeItem.astro` (also exported) renders one `<igc-tree-item>` and recurses into `children`. Props: `node: TreeNode`, `depth: number`, `variant: TreeVariant`, `activeId?: string`, `renderLabel?`. You normally never mount it directly.
|
|
41
44
|
|
|
42
45
|
## TreeNode shape
|
|
43
46
|
|
|
@@ -77,7 +80,7 @@ flicker.
|
|
|
77
80
|
## Styling
|
|
78
81
|
|
|
79
82
|
All structural and per-variant rules are in
|
|
80
|
-
[`docs-tree.
|
|
83
|
+
[`docs-tree.scss`](./docs-tree.scss). The file is imported once by
|
|
81
84
|
`DocsTree.astro`; Astro hoists and dedupes it.
|
|
82
85
|
|
|
83
86
|
Sidebar layout tokens (set on `igc-tree[data-variant="sidebar"]`):
|
|
@@ -29,12 +29,10 @@ const igNav = await fetchIgNav(resolvedLang);
|
|
|
29
29
|
|
|
30
30
|
<div class={styles.footer} data-igd-footer>
|
|
31
31
|
{/* === IgniteUI / default Infragistics footer — fetched via fetchIgNav() === */}
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
)
|
|
39
|
-
}
|
|
32
|
+
{igNav?.prefetched && (
|
|
33
|
+
<>
|
|
34
|
+
<Fragment set:html={igNav.uiFooterHtml} />
|
|
35
|
+
{igNav.footerHtml && <Fragment set:html={igNav.footerHtml} />}
|
|
36
|
+
</>
|
|
37
|
+
)}
|
|
40
38
|
</div>
|
|
@@ -23,12 +23,10 @@ const resolvedLang = lang;
|
|
|
23
23
|
const igNav = await fetchIgNav(resolvedLang);
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
{
|
|
27
|
-
/* ============================================================
|
|
26
|
+
{/* ============================================================
|
|
28
27
|
IG-family global nav (angular, react, blazor, web-components,
|
|
29
28
|
slingshot, igniteui)
|
|
30
|
-
============================================================ */
|
|
31
|
-
}
|
|
29
|
+
============================================================ */}
|
|
32
30
|
<div class={styles.navBar} transition:persist="global-nav-bar">
|
|
33
31
|
{/* IG nav — fetched directly via fetchIgNav(); falls back to static markup */}
|
|
34
32
|
{igNav?.prefetched && <Fragment set:html={igNav.headerHtml} />}
|