igniteui-astro-components 0.0.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.
- package/LICENSE +21 -0
- package/README.md +374 -0
- package/package.json +109 -0
- package/src/components/DocsSidebar/DocsSidebar.astro +99 -0
- package/src/components/DocsSidebar/README.md +166 -0
- package/src/components/DocsSidebar/SidebarFilterInput.astro +74 -0
- package/src/components/DocsSidebar/SidebarLabel.astro +40 -0
- package/src/components/DocsSidebar/sidebar-filter.ts +393 -0
- package/src/components/DocsSidebar/toTreeNodes.ts +66 -0
- package/src/components/DocsSubHeader/DocsSubHeader.astro +320 -0
- package/src/components/DocsSubHeader/README.md +74 -0
- package/src/components/DocsToc/DocsToc.astro +307 -0
- package/src/components/DocsToc/README.md +68 -0
- package/src/components/DocsToc/toTreeNodes.ts +57 -0
- package/src/components/DocsTree/DocsTree.astro +66 -0
- package/src/components/DocsTree/DocsTreeItem.astro +84 -0
- package/src/components/DocsTree/README.md +105 -0
- package/src/components/DocsTree/docs-tree.css +227 -0
- package/src/components/DocsTree/types.ts +47 -0
- package/src/components/GlobalFooter/GlobalFooter.astro +90 -0
- package/src/components/GlobalFooter/GlobalFooter.module.scss +23 -0
- package/src/components/GlobalFooter/README.md +35 -0
- package/src/components/GlobalNavBar/GlobalNavBar.astro +218 -0
- package/src/components/GlobalNavBar/GlobalNavBar.module.scss +215 -0
- package/src/components/GlobalNavBar/README.md +49 -0
- package/src/components/MobileSidebarToggle/MobileSidebarToggle.astro +112 -0
- package/src/components/MobileSidebarToggle/README.md +31 -0
- package/src/components/Search/README.md +43 -0
- package/src/components/Search/Search.astro +222 -0
- package/src/components/ThemingWidget/README.md +35 -0
- package/src/components/ThemingWidget/ThemingWidget.astro +152 -0
- package/src/components/mdx/ApiLink/ApiLink.astro +121 -0
- package/src/components/mdx/ApiLink/README.md +68 -0
- package/src/components/mdx/ApiRef/ApiRef.astro +92 -0
- package/src/components/mdx/ApiRef/README.md +50 -0
- package/src/components/mdx/DocsAside/DocsAside.astro +86 -0
- package/src/components/mdx/DocsAside/README.md +66 -0
- package/src/components/mdx/DocsAside/icons/caution.svg +3 -0
- package/src/components/mdx/DocsAside/icons/danger.svg +3 -0
- package/src/components/mdx/DocsAside/icons/note.svg +3 -0
- package/src/components/mdx/DocsAside/icons/tip.svg +4 -0
- package/src/components/mdx/PlatformBlock/PlatformBlock.astro +24 -0
- package/src/components/mdx/PlatformBlock/README.md +57 -0
- package/src/components/mdx/Sample/README.md +59 -0
- package/src/components/mdx/Sample/Sample.astro +142 -0
- package/src/content-helper.ts +159 -0
- package/src/content.config.ts +17 -0
- package/src/index.ts +42 -0
- package/src/integration.ts +841 -0
- package/src/layouts/DocsLayout/DocsLayout.astro +307 -0
- package/src/layouts/DocsLayout/README.md +124 -0
- package/src/lib/nav-helpers.ts +155 -0
- package/src/lib/platform-context.ts +305 -0
- package/src/lib/sidebar/helpers.ts +81 -0
- package/src/lib/sidebar/types.ts +36 -0
- package/src/llms.ts +315 -0
- package/src/platform.ts +281 -0
- package/src/plugins/remark-docfx.ts +368 -0
- package/src/scripts/sample-widget.ts +516 -0
- package/src/sidebar.ts +167 -0
- package/src/styles/custom.scss +254 -0
- package/src/styles/ig-theme.scss +43 -0
- package/src/virtual-modules.d.ts +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Infragistics, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
# igniteui-astro-components
|
|
2
|
+
|
|
3
|
+
Reusable [Astro](https://astro.build) components, layouts, integrations, and
|
|
4
|
+
utilities used to build Infragistics / Ignite UI documentation sites.
|
|
5
|
+
|
|
6
|
+
This package replaces the default [Starlight](https://starlight.astro.build)
|
|
7
|
+
chrome (navbar, sidebar, search, page frame, MDX components) with
|
|
8
|
+
project-specific implementations while keeping the integration story simple
|
|
9
|
+
for consumer repos.
|
|
10
|
+
|
|
11
|
+
> **Status:** internal — published from this repo as a parallel copy of the
|
|
12
|
+
> components living in `docs-template`. Both trees are kept in sync until
|
|
13
|
+
> consumers migrate fully.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm install igniteui-astro-components
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`astro@^5 || ^6` is required as a peer dependency.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
Add the integration to your `astro.config.ts`:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { defineConfig } from 'astro/config';
|
|
33
|
+
import { createDocsSite } from 'igniteui-astro-components/integration';
|
|
34
|
+
|
|
35
|
+
export default createDocsSite({
|
|
36
|
+
site: 'https://my-org.github.io/my-docs',
|
|
37
|
+
title: 'My Library',
|
|
38
|
+
description: 'Reference docs for My Library.',
|
|
39
|
+
platform: 'angular', // 'angular' | 'react' | 'web-components' | 'blazor' | …
|
|
40
|
+
navLang: 'en', // 'en' | 'jp' | 'kr'
|
|
41
|
+
source: {
|
|
42
|
+
tocPath: './my-docs/toc.yml',
|
|
43
|
+
docsDir: './my-docs/en/components',
|
|
44
|
+
imagesDir: './my-docs/en/images',
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Use the layout in a route:
|
|
50
|
+
|
|
51
|
+
```astro
|
|
52
|
+
---
|
|
53
|
+
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
54
|
+
import DocsSidebar from 'igniteui-astro-components/components/sidebar/DocsSidebar.astro';
|
|
55
|
+
|
|
56
|
+
const { slug } = Astro.params;
|
|
57
|
+
---
|
|
58
|
+
<DocsLayout title="Hello" hasSidebar currentSlug={slug}>
|
|
59
|
+
<DocsSidebar slot="sidebar" currentSlug={slug} />
|
|
60
|
+
<slot />
|
|
61
|
+
</DocsLayout>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Import MDX components in a page or `mdx-components.ts`:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
export { default as ApiLink } from 'igniteui-astro-components/components/mdx/ApiLink.astro';
|
|
68
|
+
export { default as ApiRef } from 'igniteui-astro-components/components/mdx/ApiRef.astro';
|
|
69
|
+
export { default as PlatformBlock } from 'igniteui-astro-components/components/mdx/PlatformBlock.astro';
|
|
70
|
+
export { default as Sample } from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Pull in the base styles once (e.g. from your root layout or `astro.config`):
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import 'igniteui-astro-components/styles/custom.css';
|
|
77
|
+
import 'igniteui-astro-components/styles/ig-theme.scss';
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Prop-driven usage (without `siteMetaIntegration`)
|
|
83
|
+
|
|
84
|
+
By default, `DocsLayout`, `DocsSidebar`, and `DocsSubHeader` read their data (site title, sidebar tree, product links) from the `virtual:docs-template/site-meta` virtual module that is provided by `siteMetaIntegration` / `createDocsSite`.
|
|
85
|
+
|
|
86
|
+
If you are not using the integration — for example when consuming the package via a GitHub dependency in a project that builds its own config — every piece of data can be passed directly as a prop instead.
|
|
87
|
+
|
|
88
|
+
### DocsLayout
|
|
89
|
+
|
|
90
|
+
| Prop | Overrides |
|
|
91
|
+
|------|-----------|
|
|
92
|
+
| `siteTitle` | `virtual:docs-template/site-meta` → `title` |
|
|
93
|
+
|
|
94
|
+
```astro
|
|
95
|
+
---
|
|
96
|
+
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
97
|
+
---
|
|
98
|
+
<DocsLayout title="Toast" siteTitle="My Library" hasSidebar currentSlug="components/toast">
|
|
99
|
+
<slot />
|
|
100
|
+
</DocsLayout>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### DocsSidebar
|
|
104
|
+
|
|
105
|
+
| Prop | Overrides |
|
|
106
|
+
|------|-----------|
|
|
107
|
+
| `items` | `virtual:docs-template/site-meta` → `sidebar` |
|
|
108
|
+
|
|
109
|
+
```astro
|
|
110
|
+
---
|
|
111
|
+
import DocsSidebar from 'igniteui-astro-components/components/sidebar/DocsSidebar.astro';
|
|
112
|
+
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
113
|
+
|
|
114
|
+
const sidebar: SidebarEntry[] = [
|
|
115
|
+
{
|
|
116
|
+
label: 'Getting Started',
|
|
117
|
+
collapsed: false,
|
|
118
|
+
items: [
|
|
119
|
+
{ label: 'Introduction', slug: '' },
|
|
120
|
+
{ label: 'Installation', slug: 'installation' },
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: 'Components',
|
|
125
|
+
collapsed: false,
|
|
126
|
+
items: [
|
|
127
|
+
{ label: 'Toast', slug: 'components/toast' },
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
---
|
|
132
|
+
<DocsSidebar items={sidebar} currentSlug="components/toast" />
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### DocsSubHeader
|
|
136
|
+
|
|
137
|
+
| Prop | Overrides |
|
|
138
|
+
|------|-----------|
|
|
139
|
+
| `siteTitle` | `virtual:docs-template/site-meta` → `title` |
|
|
140
|
+
| `productLinks` | `virtual:docs-template/site-meta` → `productLinks` |
|
|
141
|
+
| `sidebarItems` | `virtual:docs-template/site-meta` → `sidebar` (used for breadcrumb) |
|
|
142
|
+
|
|
143
|
+
```astro
|
|
144
|
+
---
|
|
145
|
+
import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.astro';
|
|
146
|
+
|
|
147
|
+
const productLinks = [
|
|
148
|
+
{ label: 'Angular', href: '/angular/', platform: 'angular' },
|
|
149
|
+
{ label: 'React', href: '/react/', platform: 'react' },
|
|
150
|
+
];
|
|
151
|
+
---
|
|
152
|
+
<DocsSubHeader
|
|
153
|
+
siteTitle="My Library"
|
|
154
|
+
productLinks={productLinks}
|
|
155
|
+
currentSlug="components/toast"
|
|
156
|
+
/>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Combining prop-driven components without the integration
|
|
160
|
+
|
|
161
|
+
A minimal setup that needs no virtual modules or Astro integration:
|
|
162
|
+
|
|
163
|
+
```astro
|
|
164
|
+
---
|
|
165
|
+
// src/layouts/MyDocsLayout.astro
|
|
166
|
+
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
167
|
+
import DocsSidebar from 'igniteui-astro-components/components/sidebar/DocsSidebar.astro';
|
|
168
|
+
import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
169
|
+
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
170
|
+
import type { MarkdownHeading } from 'astro';
|
|
171
|
+
|
|
172
|
+
interface Props {
|
|
173
|
+
title: string;
|
|
174
|
+
currentSlug: string;
|
|
175
|
+
headings?: MarkdownHeading[];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const { title, currentSlug, headings } = Astro.props;
|
|
179
|
+
|
|
180
|
+
const sidebar: SidebarEntry[] = [/* … your tree … */];
|
|
181
|
+
---
|
|
182
|
+
<DocsLayout
|
|
183
|
+
title={title}
|
|
184
|
+
siteTitle="My Library"
|
|
185
|
+
hasSidebar
|
|
186
|
+
currentSlug={currentSlug}
|
|
187
|
+
>
|
|
188
|
+
<DocsSidebar slot="sidebar" items={sidebar} currentSlug={currentSlug} />
|
|
189
|
+
{headings && <DocsToc slot="toc" headings={headings} offsetTarget=".docs-subheader" />}
|
|
190
|
+
<slot />
|
|
191
|
+
</DocsLayout>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
> The virtual modules still need to be resolvable at build time (they are declared in `src/virtual-modules.d.ts`). When not using `siteMetaIntegration`, add stub exports to your `astro.config.ts` using the playground's `virtualDocsModules` pattern — see [playground/astro.config.mjs](playground/astro.config.mjs) for a reference implementation.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## What's included
|
|
199
|
+
|
|
200
|
+
### Astro integration
|
|
201
|
+
|
|
202
|
+
| Export | Purpose |
|
|
203
|
+
| --- | --- |
|
|
204
|
+
| `igniteui-astro-components/integration` | `createDocsSite()`, `siteMetaIntegration()`, `staticImagesIntegration()`, `buildSidebarFromToc()` re-export |
|
|
205
|
+
|
|
206
|
+
### Layouts
|
|
207
|
+
|
|
208
|
+
| Export | Purpose | Docs |
|
|
209
|
+
| --- | --- | --- |
|
|
210
|
+
| `igniteui-astro-components/layouts/DocsLayout.astro` | Top-level page shell — global nav + sub-header + optional sidebar + main frame + footer | [README](src/layouts/DocsLayout/README.md) |
|
|
211
|
+
|
|
212
|
+
### Chrome components
|
|
213
|
+
|
|
214
|
+
| Export | Purpose | Docs |
|
|
215
|
+
| --- | --- | --- |
|
|
216
|
+
| `…/components/GlobalNavBar.astro` | IG / AppBuilder global navigation bar | [README](src/components/GlobalNavBar/README.md) |
|
|
217
|
+
| `…/components/GlobalFooter.astro` | IG global footer | [README](src/components/GlobalFooter/README.md) |
|
|
218
|
+
| `…/components/DocsSubHeader.astro` | Secondary fixed bar — site title + breadcrumb + product links + search | [README](src/components/DocsSubHeader/README.md) |
|
|
219
|
+
| `…/components/Search.astro` | Pagefind-powered full-text search modal | [README](src/components/Search/README.md) |
|
|
220
|
+
| `…/components/ThemingWidget.astro` | Theming widget | [README](src/components/ThemingWidget/README.md) |
|
|
221
|
+
| `…/components/MobileSidebarToggle.astro` | Mobile-only sidebar disclosure button | [README](src/components/MobileSidebarToggle/README.md) |
|
|
222
|
+
| `…/components/DocsToc.astro` | "On this page" table of contents with scroll-spy | [README](src/components/DocsToc/README.md) |
|
|
223
|
+
|
|
224
|
+
### Sidebar suite
|
|
225
|
+
|
|
226
|
+
| Export | Purpose | Docs |
|
|
227
|
+
| --- | --- | --- |
|
|
228
|
+
| `…/components/sidebar/DocsSidebar.astro` | Composition root — filter input + recursive tree | [README](src/components/sidebar/README.md) |
|
|
229
|
+
| `…/components/sidebar/SidebarTree.astro` | Recursive `<ul>` of items | [README](src/components/sidebar/README.md) |
|
|
230
|
+
| `…/components/sidebar/SidebarItem.astro` | One link or `<details>` group | [README](src/components/sidebar/README.md) |
|
|
231
|
+
| `…/components/sidebar/SidebarFilterInput.astro` | Filter input markup | [README](src/components/sidebar/README.md) |
|
|
232
|
+
| `…/components/sidebar/sidebar-filter` | `<sidebar-filter>` custom element + cross-navigation hooks | [README](src/components/sidebar/README.md) |
|
|
233
|
+
| `…/lib/sidebar/types` | `SidebarEntry`, `SidebarGroup`, `SidebarLink`, `SidebarBadge` | — |
|
|
234
|
+
| `…/lib/sidebar/helpers` | `isActive`, `isGroup`, `isInitiallyOpen`, `getBreadcrumb`, `joinPath`, … | — |
|
|
235
|
+
| `…/sidebar` | `buildSidebarFromToc()` — TOC → sidebar tree converter (build-time) | — |
|
|
236
|
+
|
|
237
|
+
### MDX components
|
|
238
|
+
|
|
239
|
+
| Export | Purpose | Docs |
|
|
240
|
+
| --- | --- | --- |
|
|
241
|
+
| `…/components/mdx/ApiLink.astro` | Inline link to an API symbol with platform-aware URLs | [README](src/components/mdx/ApiLink/README.md) |
|
|
242
|
+
| `…/components/mdx/ApiRef.astro` | Block API reference card | [README](src/components/mdx/ApiRef/README.md) |
|
|
243
|
+
| `…/components/mdx/PlatformBlock.astro` | Show content only on selected platforms | [README](src/components/mdx/PlatformBlock/README.md) |
|
|
244
|
+
| `…/components/mdx/Sample.astro` | Embedded code-view sample widget | [README](src/components/mdx/Sample/README.md) |
|
|
245
|
+
|
|
246
|
+
### Build helpers
|
|
247
|
+
|
|
248
|
+
| Export | Purpose |
|
|
249
|
+
| --- | --- |
|
|
250
|
+
| `…/platform` | Platform / nav-language types |
|
|
251
|
+
| `…/content` | Content collection helpers |
|
|
252
|
+
| `…/content-config` | Default content collection schema |
|
|
253
|
+
| `…/llms` | `llms.txt` manifest generator |
|
|
254
|
+
| `…/plugins/remark-docfx` | Remark plugin for docfx-flavored Markdown quirks |
|
|
255
|
+
|
|
256
|
+
### Styles
|
|
257
|
+
|
|
258
|
+
| Export | Purpose |
|
|
259
|
+
| --- | --- |
|
|
260
|
+
| `…/styles/custom.css` | Base tokens + sidebar/code-view/sample styles |
|
|
261
|
+
| `…/styles/ig-theme.scss` | IG color palette mapped to design tokens |
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Subpath exports
|
|
266
|
+
|
|
267
|
+
Every component is reachable through an explicit subpath in
|
|
268
|
+
[`package.json#exports`](./package.json). Bare-specifier imports
|
|
269
|
+
(`igniteui-astro-components`) resolve to the JS/TS barrel
|
|
270
|
+
[`src/index.ts`](./src/index.ts) which re-exports the runtime helpers only —
|
|
271
|
+
`.astro` files must always be imported via their full subpath because Astro
|
|
272
|
+
components are not plain ES modules.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Using from another repo without publishing a package
|
|
277
|
+
|
|
278
|
+
You do not need to release a version to npm to consume these components. Use one of the two approaches below.
|
|
279
|
+
|
|
280
|
+
### Option A — npm `file:` link (recommended for active development)
|
|
281
|
+
|
|
282
|
+
In the consumer repo, add a `file:` reference in `package.json`:
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"dependencies": {
|
|
287
|
+
"igniteui-astro-components": "file:../path/to/astro-components"
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Run `npm install` in the consumer repo. npm creates a symlink so every save in the components repo is instantly visible. All `package.json#exports` subpaths work exactly as they would with a published package.
|
|
293
|
+
|
|
294
|
+
```sh
|
|
295
|
+
# Consumer repo
|
|
296
|
+
npm install
|
|
297
|
+
# or, to refresh after adding new exports:
|
|
298
|
+
npm install ../path/to/astro-components
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
> **Windows note:** symlinks require Developer Mode or running your terminal as Administrator.
|
|
302
|
+
|
|
303
|
+
### Option B — TypeScript / Vite path alias (no install step)
|
|
304
|
+
|
|
305
|
+
Add a path alias in the consumer's `tsconfig.json` and `astro.config.ts` that maps the package name to the local source:
|
|
306
|
+
|
|
307
|
+
**`tsconfig.json`**
|
|
308
|
+
```json
|
|
309
|
+
{
|
|
310
|
+
"compilerOptions": {
|
|
311
|
+
"paths": {
|
|
312
|
+
"igniteui-astro-components": ["../astro-components/src/index.ts"],
|
|
313
|
+
"igniteui-astro-components/*": ["../astro-components/src/*"]
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**`astro.config.ts`**
|
|
320
|
+
```ts
|
|
321
|
+
import path from 'node:path';
|
|
322
|
+
import { defineConfig } from 'astro/config';
|
|
323
|
+
|
|
324
|
+
export default defineConfig({
|
|
325
|
+
vite: {
|
|
326
|
+
resolve: {
|
|
327
|
+
alias: {
|
|
328
|
+
'igniteui-astro-components': path.resolve('../astro-components/src/index.ts'),
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
});
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
> The alias covers the JS/TS barrel. `.astro` component imports such as
|
|
336
|
+
> `'igniteui-astro-components/layouts/DocsLayout.astro'` resolve automatically
|
|
337
|
+
> through the `paths` wildcard in `tsconfig.json` — Astro's Vite pipeline
|
|
338
|
+
> handles them at build time.
|
|
339
|
+
|
|
340
|
+
### Option C — direct relative imports (quick prototype)
|
|
341
|
+
|
|
342
|
+
Import component files directly by relative path without any alias or install:
|
|
343
|
+
|
|
344
|
+
```astro
|
|
345
|
+
---
|
|
346
|
+
import DocsLayout from '../../astro-components/src/layouts/DocsLayout/DocsLayout.astro';
|
|
347
|
+
import DocsSidebar from '../../astro-components/src/components/sidebar/DocsSidebar.astro';
|
|
348
|
+
import ApiLink from '../../astro-components/src/components/mdx/ApiLink/ApiLink.astro';
|
|
349
|
+
---
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
This works immediately but ties your import paths to the internal folder structure. Switch to Option A or B before the project matures.
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## Development
|
|
357
|
+
|
|
358
|
+
```sh
|
|
359
|
+
npm install
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
There is no build step — sources are published as-is and consumers compile
|
|
363
|
+
them through their own Astro / Vite pipeline. TypeScript is used only for
|
|
364
|
+
type-checking during development:
|
|
365
|
+
|
|
366
|
+
```sh
|
|
367
|
+
npx tsc --noEmit
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## License
|
|
373
|
+
|
|
374
|
+
[MIT](./LICENSE)
|
package/package.json
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "igniteui-astro-components",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Reusable Astro components, layouts, and integrations for Infragistics / Ignite UI documentation sites. Replaces the Starlight defaults with project-specific implementations.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": "^20.19.0 || ^22.13.0 || >=24.0.0"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Infragistics",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/IgniteUI/igniteui-astro-components"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"astro",
|
|
17
|
+
"astro-component",
|
|
18
|
+
"astro-integration",
|
|
19
|
+
"documentation",
|
|
20
|
+
"docs",
|
|
21
|
+
"infragistics",
|
|
22
|
+
"ignite-ui",
|
|
23
|
+
"sidebar",
|
|
24
|
+
"mdx"
|
|
25
|
+
],
|
|
26
|
+
"files": [
|
|
27
|
+
"src",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./src/index.ts",
|
|
34
|
+
"default": "./src/index.ts"
|
|
35
|
+
},
|
|
36
|
+
"./integration": "./src/integration.ts",
|
|
37
|
+
"./sidebar": "./src/sidebar.ts",
|
|
38
|
+
"./platform": "./src/platform.ts",
|
|
39
|
+
"./content": "./src/content-helper.ts",
|
|
40
|
+
"./content-config": "./src/content.config.ts",
|
|
41
|
+
"./llms": "./src/llms.ts",
|
|
42
|
+
"./layouts/DocsLayout.astro": "./src/layouts/DocsLayout/DocsLayout.astro",
|
|
43
|
+
"./components/GlobalNavBar.astro": "./src/components/GlobalNavBar/GlobalNavBar.astro",
|
|
44
|
+
"./components/GlobalFooter.astro": "./src/components/GlobalFooter/GlobalFooter.astro",
|
|
45
|
+
"./components/DocsSubHeader.astro": "./src/components/DocsSubHeader/DocsSubHeader.astro",
|
|
46
|
+
"./components/Search.astro": "./src/components/Search/Search.astro",
|
|
47
|
+
"./components/ThemingWidget.astro": "./src/components/ThemingWidget/ThemingWidget.astro",
|
|
48
|
+
"./components/MobileSidebarToggle.astro": "./src/components/MobileSidebarToggle/MobileSidebarToggle.astro",
|
|
49
|
+
"./components/DocsToc.astro": "./src/components/DocsToc/DocsToc.astro",
|
|
50
|
+
"./components/DocsSidebar/DocsSidebar.astro": "./src/components/DocsSidebar/DocsSidebar.astro",
|
|
51
|
+
"./components/DocsSidebar/SidebarFilterInput.astro": "./src/components/DocsSidebar/SidebarFilterInput.astro",
|
|
52
|
+
"./components/DocsSidebar/SidebarLabel.astro": "./src/components/DocsSidebar/SidebarLabel.astro",
|
|
53
|
+
"./components/DocsSidebar/sidebar-filter": "./src/components/DocsSidebar/sidebar-filter.ts",
|
|
54
|
+
"./components/DocsSidebar/toTreeNodes": "./src/components/DocsSidebar/toTreeNodes.ts",
|
|
55
|
+
"./components/DocsToc/toTreeNodes": "./src/components/DocsToc/toTreeNodes.ts",
|
|
56
|
+
"./components/DocsTree/DocsTree.astro": "./src/components/DocsTree/DocsTree.astro",
|
|
57
|
+
"./components/DocsTree/DocsTreeItem.astro": "./src/components/DocsTree/DocsTreeItem.astro",
|
|
58
|
+
"./components/DocsTree/types": "./src/components/DocsTree/types.ts",
|
|
59
|
+
"./components/DocsTree/docs-tree.css": "./src/components/DocsTree/docs-tree.css",
|
|
60
|
+
"./components/mdx/ApiRef.astro": "./src/components/mdx/ApiRef/ApiRef.astro",
|
|
61
|
+
"./components/mdx/ApiLink.astro": "./src/components/mdx/ApiLink/ApiLink.astro",
|
|
62
|
+
"./components/mdx/DocsAside.astro": "./src/components/mdx/DocsAside/DocsAside.astro",
|
|
63
|
+
"./components/mdx/PlatformBlock.astro": "./src/components/mdx/PlatformBlock/PlatformBlock.astro",
|
|
64
|
+
"./components/mdx/Sample.astro": "./src/components/mdx/Sample/Sample.astro",
|
|
65
|
+
"./lib/sidebar/types": "./src/lib/sidebar/types.ts",
|
|
66
|
+
"./lib/sidebar/helpers": "./src/lib/sidebar/helpers.ts",
|
|
67
|
+
"./lib/platform-context": "./src/lib/platform-context.ts",
|
|
68
|
+
"./plugins/remark-docfx": "./src/plugins/remark-docfx.ts",
|
|
69
|
+
"./styles/custom.scss": "./src/styles/custom.scss",
|
|
70
|
+
"./styles/ig-theme.scss": "./src/styles/ig-theme.scss",
|
|
71
|
+
"./package.json": "./package.json"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"astro": "^5.0.0 || ^6.0.0",
|
|
75
|
+
"igniteui-webcomponents": "^7.1.3"
|
|
76
|
+
},
|
|
77
|
+
"peerDependenciesMeta": {
|
|
78
|
+
"igniteui-webcomponents": {
|
|
79
|
+
"optional": true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"igniteui-webcomponents": "^7.1.3",
|
|
84
|
+
"js-yaml": "^4.1.0",
|
|
85
|
+
"jsdom": "^29.0.1"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@types/js-yaml": "^4.0.9",
|
|
89
|
+
"@types/jsdom": "^21.1.7",
|
|
90
|
+
"astro": "^6.1.6",
|
|
91
|
+
"igniteui-theming": "^26.0.1",
|
|
92
|
+
"sass": "^1.83.0",
|
|
93
|
+
"typescript": "^5.6.0"
|
|
94
|
+
},
|
|
95
|
+
"workspaces": [
|
|
96
|
+
"playground"
|
|
97
|
+
],
|
|
98
|
+
"publishConfig": {
|
|
99
|
+
"access": "public"
|
|
100
|
+
},
|
|
101
|
+
"scripts": {
|
|
102
|
+
"playground": "npm --prefix playground run dev",
|
|
103
|
+
"playground:dev": "npm --prefix playground run dev",
|
|
104
|
+
"playground:build": "npm --prefix playground run build",
|
|
105
|
+
"playground:preview": "npm --prefix playground run preview",
|
|
106
|
+
"playground:clean": "npm --prefix playground run clean",
|
|
107
|
+
"playground:check": "npm --prefix playground run check"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Docs sidebar — composes the shared DocsTree base with the sidebar
|
|
4
|
+
* filter custom element and a SidebarLabel renderer (badges + caret).
|
|
5
|
+
*
|
|
6
|
+
* Public Props are unchanged from the previous implementation.
|
|
7
|
+
*
|
|
8
|
+
* Package: igniteui-webcomponents (public, MIT) — change the import path
|
|
9
|
+
* in the <script> block below to use @infragistics/igniteui-webcomponents.
|
|
10
|
+
*/
|
|
11
|
+
import { sidebar as sidebarData } from 'virtual:docs-template/site-meta';
|
|
12
|
+
import SidebarFilterInput from './SidebarFilterInput.astro';
|
|
13
|
+
import SidebarLabel from './SidebarLabel.astro';
|
|
14
|
+
import DocsTree from '../DocsTree/DocsTree.astro';
|
|
15
|
+
import { toTreeNodes } from './toTreeNodes';
|
|
16
|
+
import type { SidebarEntry } from '../../lib/sidebar/types';
|
|
17
|
+
import { normalizeSlug } from '../../lib/sidebar/helpers';
|
|
18
|
+
|
|
19
|
+
interface Props {
|
|
20
|
+
currentSlug?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Sidebar tree to render. Overrides the virtual module value when provided.
|
|
23
|
+
* Useful when consuming the component without `siteMetaIntegration`.
|
|
24
|
+
*/
|
|
25
|
+
items?: SidebarEntry[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { currentSlug = '', items: itemsProp } = Astro.props;
|
|
29
|
+
const items = (itemsProp ?? sidebarData) as SidebarEntry[];
|
|
30
|
+
const nodes = toTreeNodes(items, currentSlug);
|
|
31
|
+
const activeId = normalizeSlug(currentSlug);
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<sidebar-filter id="docs-sidebar" data-no-results="No topics match">
|
|
35
|
+
<SidebarFilterInput />
|
|
36
|
+
<div class="sidebar-scroll" data-sidebar-scroll>
|
|
37
|
+
<DocsTree
|
|
38
|
+
nodes={nodes}
|
|
39
|
+
variant="sidebar"
|
|
40
|
+
activeId={activeId}
|
|
41
|
+
toggleNodeOnClick
|
|
42
|
+
ariaLabel="Sidebar navigation"
|
|
43
|
+
renderLabel={SidebarLabel}
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</sidebar-filter>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
// Register Ignite UI Web Components used by the sidebar filter input.
|
|
50
|
+
// (DocsTree registers IgcTreeComponent / IgcTreeItemComponent itself.)
|
|
51
|
+
// To use the licensed package, change the import to:
|
|
52
|
+
// import { ... } from '@infragistics/igniteui-webcomponents';
|
|
53
|
+
import {
|
|
54
|
+
defineComponents,
|
|
55
|
+
IgcInputComponent,
|
|
56
|
+
IgcButtonComponent,
|
|
57
|
+
IgcIconComponent,
|
|
58
|
+
registerIconFromText,
|
|
59
|
+
} from 'igniteui-webcomponents';
|
|
60
|
+
|
|
61
|
+
defineComponents(IgcInputComponent, IgcButtonComponent, IgcIconComponent);
|
|
62
|
+
|
|
63
|
+
registerIconFromText(
|
|
64
|
+
'sidebar-filter-search',
|
|
65
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none"><path d="M1 3h14M4 8h8M7 13h2" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>`,
|
|
66
|
+
);
|
|
67
|
+
registerIconFromText(
|
|
68
|
+
'sidebar-filter-clear',
|
|
69
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" fill="none"><path d="M2 2l10 10M12 2 2 12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
import './sidebar-filter';
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<style>
|
|
76
|
+
/* Layout-only — the tree's structural styles live in docs-tree.css. */
|
|
77
|
+
sidebar-filter {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
flex: 1;
|
|
81
|
+
min-height: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.sidebar-scroll {
|
|
85
|
+
flex: 1;
|
|
86
|
+
min-height: 0;
|
|
87
|
+
overflow-y: auto;
|
|
88
|
+
margin-inline-end: calc(-1 * var(--sl-sidebar-pad-x, 1rem));
|
|
89
|
+
padding-inline-end: var(--sl-sidebar-pad-x, 1rem);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* [data-sidebar-filter-status] is from SidebarFilterInput → :global() required */
|
|
93
|
+
sidebar-filter :global([data-sidebar-filter-status]):not(:empty) {
|
|
94
|
+
display: block;
|
|
95
|
+
padding: 0.5rem;
|
|
96
|
+
font-size: var(--sl-text-sm, 0.875rem);
|
|
97
|
+
color: var(--sl-color-gray-3, #888);
|
|
98
|
+
}
|
|
99
|
+
</style>
|