igniteui-astro-components 1.7.0 → 1.8.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/README.md +322 -158
- package/llms-full.txt +3216 -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 +77 -0
- package/src/code-theme/index.ts +76 -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 +71 -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 +162 -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
package/README.md
CHANGED
|
@@ -7,9 +7,16 @@ This package provides the navbar, sidebar, search, page frame, and MDX
|
|
|
7
7
|
components for Infragistics documentation sites, keeping the integration
|
|
8
8
|
story simple for consumer repos.
|
|
9
9
|
|
|
10
|
-
> **Status:** internal
|
|
11
|
-
>
|
|
12
|
-
>
|
|
10
|
+
> **Status:** internal. Consumed by
|
|
11
|
+
> [igniteui-documentation](https://github.com/IgniteUI/igniteui-documentation)
|
|
12
|
+
> (`docs-template`), api-docs and the Infragistics blog. The docs repo keeps its
|
|
13
|
+
> own fork of the Astro integration and uses this package as a component library.
|
|
14
|
+
|
|
15
|
+
> **For AI agents:** start with [`llms.txt`](./llms.txt) — an index of every
|
|
16
|
+
> export with its props and a link to the README that documents it. The package
|
|
17
|
+
> ships it, so in a consumer it is at
|
|
18
|
+
> `node_modules/igniteui-astro-components/llms.txt`. Working on this repo? Read
|
|
19
|
+
> [`AGENTS.md`](./AGENTS.md).
|
|
13
20
|
|
|
14
21
|
---
|
|
15
22
|
|
|
@@ -19,102 +26,248 @@ story simple for consumer repos.
|
|
|
19
26
|
npm install igniteui-astro-components
|
|
20
27
|
```
|
|
21
28
|
|
|
22
|
-
`astro@^7.3.
|
|
29
|
+
Peer dependencies: `astro@^7.3.5`, `igniteui-theming@^29`,
|
|
30
|
+
`igniteui-webcomponents@^7.4.1`. There is no build step: the package ships its
|
|
31
|
+
`.astro`, `.ts` and `.scss` sources and your Astro/Vite pipeline compiles them.
|
|
23
32
|
|
|
24
33
|
---
|
|
25
34
|
|
|
26
35
|
## Quick start
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
This is the setup every current consumer uses: the package as a component
|
|
38
|
+
library, with the host owning its Astro config. The playground in this repo is
|
|
39
|
+
the same wiring, but it is not published, so every snippet below is complete.
|
|
40
|
+
|
|
41
|
+
**1. Astro config.** Enable MDX, run the package's Markdown plugins through
|
|
42
|
+
Sätteri, and resolve the package's bare `@use 'igniteui-theming/...'` imports.
|
|
43
|
+
Two details matter:
|
|
44
|
+
|
|
45
|
+
- Astro 7 renders Markdown with Sätteri and the package's plugins are Sätteri
|
|
46
|
+
plugins (`defineHastPlugin`), so `markdown.rehypePlugins` rejects them. Pass
|
|
47
|
+
them to `satteri()`: remark-style plugins go in `mdastPlugins`, rehype-style
|
|
48
|
+
plugins in `hastPlugins`. Add `@astrojs/markdown-satteri` to the host's
|
|
49
|
+
dependencies (it is already a dependency of this package).
|
|
50
|
+
- `loadPaths: ['node_modules']` alone is not enough. Vite 8 enforces
|
|
51
|
+
igniteui-theming's export map, which does not resolve extensionless Sass
|
|
52
|
+
subpaths, so `@use 'igniteui-theming/sass/typography'` fails with `is not
|
|
53
|
+
exported under the conditions`. The importer below maps them to files.
|
|
29
54
|
|
|
30
55
|
```ts
|
|
56
|
+
// astro.config.ts
|
|
57
|
+
import fs from 'node:fs';
|
|
58
|
+
import path from 'node:path';
|
|
59
|
+
import { createRequire } from 'node:module';
|
|
60
|
+
import { pathToFileURL } from 'node:url';
|
|
31
61
|
import { defineConfig } from 'astro/config';
|
|
32
|
-
import
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
62
|
+
import mdx from '@astrojs/mdx';
|
|
63
|
+
import { satteri } from '@astrojs/markdown-satteri';
|
|
64
|
+
import { rehypeHeadingAnchors } from 'igniteui-astro-components/plugins/rehype-heading-anchors';
|
|
65
|
+
|
|
66
|
+
const themingDir = path.dirname(
|
|
67
|
+
createRequire(import.meta.url).resolve('igniteui-theming/package.json'),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
// Resolves `igniteui-theming/sass/...` to files inside the package.
|
|
71
|
+
const themingSassImporter = {
|
|
72
|
+
findFileUrl(url: string) {
|
|
73
|
+
if (!url.startsWith('igniteui-theming/')) return null;
|
|
74
|
+
const candidate = path.join(themingDir, url.slice('igniteui-theming/'.length));
|
|
75
|
+
return fs.existsSync(candidate) || fs.existsSync(path.dirname(candidate))
|
|
76
|
+
? pathToFileURL(candidate)
|
|
77
|
+
: null;
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default defineConfig({
|
|
82
|
+
integrations: [mdx()],
|
|
83
|
+
markdown: {
|
|
84
|
+
processor: satteri({ hastPlugins: [rehypeHeadingAnchors] }),
|
|
85
|
+
},
|
|
86
|
+
vite: {
|
|
87
|
+
plugins: [virtualDocsModules()], // step 2
|
|
88
|
+
css: {
|
|
89
|
+
preprocessorOptions: {
|
|
90
|
+
scss: { importers: [themingSassImporter], loadPaths: ['node_modules'] },
|
|
91
|
+
},
|
|
92
|
+
},
|
|
44
93
|
},
|
|
45
94
|
});
|
|
46
95
|
```
|
|
47
96
|
|
|
48
|
-
|
|
97
|
+
**2. Virtual modules.** `DocsLayout`, `DocsSidebar`, `DocsSubHeader`,
|
|
98
|
+
`DocsBreadcrumb` and `DoDont` import `virtual:docs-template/site-meta` at
|
|
99
|
+
module level, and the first three also import `virtual:docs-template/nav-html`,
|
|
100
|
+
so both modules must resolve wherever those components appear (an MDX page
|
|
101
|
+
that uses `<DoDont>` included). Stub them with a Vite plugin. Every name below
|
|
102
|
+
must be exported: `DocsSubHeader` imports `packages` and `selectedPackage`,
|
|
103
|
+
which `siteMetaIntegration()` does not emit, so the integration cannot provide
|
|
104
|
+
these modules today (see [The reference integration](#the-reference-integration)).
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
// astro.config.ts (continued)
|
|
108
|
+
function virtualDocsModules() {
|
|
109
|
+
const modules: Record<string, string> = {
|
|
110
|
+
'virtual:docs-template/site-meta': `
|
|
111
|
+
export const title = 'My Library';
|
|
112
|
+
export const sidebar = [];
|
|
113
|
+
export const productLinks = [];
|
|
114
|
+
export const headEntries = [];
|
|
115
|
+
export const trailingSlash = 'ignore';
|
|
116
|
+
export const navLang = 'en';
|
|
117
|
+
export const packages = [];
|
|
118
|
+
export const selectedPackage = undefined;
|
|
119
|
+
`,
|
|
120
|
+
// platform: 'angular' | 'react' | 'blazor' | 'web-components' | 'winui' | 'uno' | null
|
|
121
|
+
'virtual:docs-template/nav-html': `export const platform = 'angular';`,
|
|
122
|
+
};
|
|
123
|
+
return {
|
|
124
|
+
name: 'virtual-docs-modules',
|
|
125
|
+
resolveId: (id: string) => (id in modules ? '\0' + id : null),
|
|
126
|
+
load: (id: string) => modules[id.slice(1)] ?? null,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The module contract, and the `App.Locals` typing for step 3, are declared in
|
|
132
|
+
[src/virtual-modules.d.ts](src/virtual-modules.d.ts). Add
|
|
133
|
+
`node_modules/igniteui-astro-components/src/virtual-modules.d.ts` to your
|
|
134
|
+
`tsconfig` `include` so the imports type-check.
|
|
135
|
+
|
|
136
|
+
**3. Middleware.** `ApiLink`, `ApiRef`, `PlatformBlock` and `Sample` read
|
|
137
|
+
`Astro.locals.platformContext` and throw without it. `Sample` and
|
|
138
|
+
`ThemingWidget` also read `Astro.locals.envVars`, which is optional and treated
|
|
139
|
+
as `{}` when missing. Set both in `src/middleware.ts`:
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
// src/middleware.ts
|
|
143
|
+
import { defineMiddleware } from 'astro:middleware';
|
|
144
|
+
import type { PlatformContext } from 'igniteui-astro-components/lib/types';
|
|
145
|
+
|
|
146
|
+
const platformContext: PlatformContext = {
|
|
147
|
+
name: 'React', // 'Angular' | 'React' | 'WebComponents' | 'Blazor' | 'WinUI' | 'Uno'
|
|
148
|
+
lower: 'react',
|
|
149
|
+
prefix: 'Igr',
|
|
150
|
+
productName: 'Ignite UI for React',
|
|
151
|
+
productSpinal: 'ignite-ui-react',
|
|
152
|
+
apiPackages: {
|
|
153
|
+
core: {
|
|
154
|
+
docRoot: 'https://www.infragistics.com/react-apis-new/react/igniteui-react/latest',
|
|
155
|
+
packageId: 'igniteui-react',
|
|
156
|
+
noPackagePrefix: true,
|
|
157
|
+
preserveCase: true,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
packages: {
|
|
161
|
+
common: 'igniteui-react',
|
|
162
|
+
charts: 'igniteui-react-charts',
|
|
163
|
+
grids: 'igniteui-react-grids',
|
|
164
|
+
gauges: 'igniteui-react-gauges',
|
|
165
|
+
maps: 'igniteui-react-maps',
|
|
166
|
+
},
|
|
167
|
+
links: {
|
|
168
|
+
github: 'https://github.com/IgniteUI/igniteui-react',
|
|
169
|
+
forums: 'https://www.infragistics.com/community/forums/f/ignite-ui-for-react',
|
|
170
|
+
repoSamples: 'https://github.com/IgniteUI/igniteui-react-examples/tree/master/samples',
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const onRequest = defineMiddleware((context, next) => {
|
|
175
|
+
context.locals.platformContext = platformContext;
|
|
176
|
+
context.locals.envVars = {
|
|
177
|
+
demosBaseUrl: 'https://www.infragistics.com/react-demos',
|
|
178
|
+
defaultSampleTheme: 'bootstrap',
|
|
179
|
+
};
|
|
180
|
+
return next();
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
`envVars` keys: `demosBaseUrl`, `dvDemosBaseUrl`, `lobDemosBaseUrl`,
|
|
185
|
+
`crmDemoBaseUrl` and `wcDemosBaseUrl` (`Sample`, see its README),
|
|
186
|
+
`defaultSampleTheme` (`Sample` and `ThemingWidget`) and `defaultSampleMode`
|
|
187
|
+
(`ThemingWidget`). Leave unused keys out rather than setting them to `""`.
|
|
188
|
+
|
|
189
|
+
**4. A layout.** `DocsLayout` imports `styles/theme.scss` and the JetBrains Mono
|
|
190
|
+
font itself, so nothing else is needed:
|
|
49
191
|
|
|
50
192
|
```astro
|
|
51
193
|
---
|
|
194
|
+
// src/layouts/MyDocsLayout.astro
|
|
52
195
|
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
53
|
-
import DocsSidebar from 'igniteui-astro-components/components/
|
|
196
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
197
|
+
import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
198
|
+
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
199
|
+
import type { MarkdownHeading } from 'astro';
|
|
54
200
|
|
|
55
|
-
|
|
201
|
+
interface Props {
|
|
202
|
+
title: string;
|
|
203
|
+
currentSlug: string;
|
|
204
|
+
headings?: MarkdownHeading[];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const { title, currentSlug, headings = [] } = Astro.props;
|
|
208
|
+
|
|
209
|
+
const sidebar: SidebarEntry[] = [
|
|
210
|
+
{
|
|
211
|
+
label: 'Getting started',
|
|
212
|
+
items: [
|
|
213
|
+
{ label: 'Introduction', slug: '' },
|
|
214
|
+
{ label: 'Installation', slug: 'installation' },
|
|
215
|
+
],
|
|
216
|
+
},
|
|
217
|
+
];
|
|
56
218
|
---
|
|
57
219
|
|
|
58
|
-
<DocsLayout title="
|
|
59
|
-
<DocsSidebar slot="sidebar" currentSlug={
|
|
220
|
+
<DocsLayout title={title} siteTitle="My Library" hasSidebar currentSlug={currentSlug}>
|
|
221
|
+
<DocsSidebar slot="sidebar" items={sidebar} currentSlug={currentSlug} />
|
|
222
|
+
<DocsToc slot="toc" headings={headings} />
|
|
60
223
|
<slot />
|
|
61
224
|
</DocsLayout>
|
|
62
225
|
```
|
|
63
226
|
|
|
64
|
-
|
|
227
|
+
`DocsToc` measures the sub-header on its own, so `offsetTarget` is only needed outside `DocsLayout`. A page renders its content inside it:
|
|
228
|
+
`<MyDocsLayout title={entry.data.title} currentSlug={slug} headings={headings}><Content /></MyDocsLayout>`.
|
|
65
229
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
230
|
+
**5. MDX components.** Nothing is auto-registered. Import what a topic uses at
|
|
231
|
+
the top of the MDX file (the convention in the docs repos):
|
|
232
|
+
|
|
233
|
+
```mdx
|
|
234
|
+
import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
235
|
+
import ApiLink from 'igniteui-astro-components/components/mdx/ApiLink.astro';
|
|
236
|
+
import DocsAside from 'igniteui-astro-components/components/mdx/DocsAside.astro';
|
|
237
|
+
import PlatformBlock from 'igniteui-astro-components/components/mdx/PlatformBlock.astro';
|
|
71
238
|
```
|
|
72
239
|
|
|
73
|
-
|
|
240
|
+
or pass them through the `components` map of `<Content />` when the MDX is
|
|
241
|
+
authored without imports.
|
|
74
242
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
243
|
+
### The reference integration
|
|
244
|
+
|
|
245
|
+
`igniteui-astro-components/integration` exports `createDocsSite()` and
|
|
246
|
+
`siteMetaIntegration()`: a full docs-site config (site meta virtual modules,
|
|
247
|
+
sidebar from a JSON TOC, static images, remark/rehype pipeline, Pagefind index,
|
|
248
|
+
`llms.txt` generation, the Infragistics chrome). It is the origin of the docs
|
|
249
|
+
repo's integration, but it is **not usable as-is today**: it injects route files
|
|
250
|
+
that are not in this package (#158), it imports `pagefind` without declaring it
|
|
251
|
+
(#157), its `site-meta` module lacks the `packages` and `selectedPackage`
|
|
252
|
+
exports `DocsSubHeader` imports, and it registers no middleware. Treat it as
|
|
253
|
+
reference code until those issues are closed.
|
|
79
254
|
|
|
80
255
|
---
|
|
81
256
|
|
|
82
257
|
## Fonts
|
|
83
258
|
|
|
84
|
-
`
|
|
85
|
-
|
|
86
|
-
`
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
> ```ts
|
|
91
|
-
> import { defineConfig, fontProviders } from 'astro/config';
|
|
92
|
-
>
|
|
93
|
-
> export default defineConfig({
|
|
94
|
-
> fonts: [
|
|
95
|
-
> {
|
|
96
|
-
> provider: fontProviders.google(),
|
|
97
|
-
> name: 'Instrument Sans',
|
|
98
|
-
> cssVariable: '--font-sans',
|
|
99
|
-
> weights: ['400..700'],
|
|
100
|
-
> styles: ['normal', 'italic'],
|
|
101
|
-
> },
|
|
102
|
-
> {
|
|
103
|
-
> provider: fontProviders.google(),
|
|
104
|
-
> name: 'JetBrains Mono',
|
|
105
|
-
> cssVariable: '--font-mono',
|
|
106
|
-
> weights: ['100..800'],
|
|
107
|
-
> styles: ['normal', 'italic'],
|
|
108
|
-
> },
|
|
109
|
-
> ],
|
|
110
|
-
> });
|
|
111
|
-
> ```
|
|
259
|
+
`DocsLayout` imports the **JetBrains Mono** variable font from
|
|
260
|
+
`@fontsource-variable/jetbrains-mono` (self-hosted, no CDN request) and
|
|
261
|
+
`styles/theme.scss` sets `--font-mono: 'JetBrains Mono Variable'` on `:root`.
|
|
262
|
+
The sans-serif stack is the Infragistics brand font through
|
|
263
|
+
`--igd-font-sans`, and code uses `--igd-font-mono`. Override either custom
|
|
264
|
+
property to change the fonts site-wide.
|
|
112
265
|
|
|
113
266
|
---
|
|
114
267
|
|
|
115
268
|
## Prop-driven usage (without `siteMetaIntegration`)
|
|
116
269
|
|
|
117
|
-
By default, `DocsLayout`, `DocsSidebar`, and `DocsSubHeader` read their data (site title, sidebar tree,
|
|
270
|
+
By default, `DocsLayout`, `DocsSidebar`, and `DocsSubHeader` read their data (site title, sidebar tree, package list) from the `virtual:docs-template/site-meta` virtual module, which the host stubs in its Astro config ([Quick start](#quick-start) step 2).
|
|
118
271
|
|
|
119
272
|
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.
|
|
120
273
|
|
|
@@ -142,7 +295,7 @@ import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
|
142
295
|
|
|
143
296
|
```astro
|
|
144
297
|
---
|
|
145
|
-
import DocsSidebar from 'igniteui-astro-components/components/
|
|
298
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
146
299
|
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
147
300
|
|
|
148
301
|
const sidebar: SidebarEntry[] = [
|
|
@@ -167,57 +320,33 @@ const sidebar: SidebarEntry[] = [
|
|
|
167
320
|
|
|
168
321
|
### DocsSubHeader
|
|
169
322
|
|
|
170
|
-
| Prop
|
|
171
|
-
|
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
|
|
323
|
+
| Prop | Overrides |
|
|
324
|
+
| ----------------- | ----------------------------------------------------- |
|
|
325
|
+
| `packages` | `virtual:docs-template/site-meta` → `packages` |
|
|
326
|
+
| `selectedPackage` | `virtual:docs-template/site-meta` → `selectedPackage` |
|
|
327
|
+
|
|
328
|
+
`siteTitle`, `productLinks` and `sidebarItems` are accepted and read from the
|
|
329
|
+
virtual module as fallbacks, but nothing in the sub-header renders them any
|
|
330
|
+
more (the breadcrumb moved to `DocsBreadcrumb`, the product links markup is
|
|
331
|
+
commented out). See the [DocsSubHeader README](src/components/DocsSubHeader/README.md).
|
|
175
332
|
|
|
176
333
|
```astro
|
|
177
334
|
---
|
|
178
335
|
import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.astro';
|
|
179
|
-
|
|
180
|
-
const productLinks = [
|
|
181
|
-
{ label: 'Angular', href: '/angular/', platform: 'angular' },
|
|
182
|
-
{ label: 'React', href: '/react/', platform: 'react' },
|
|
183
|
-
];
|
|
184
336
|
---
|
|
185
337
|
|
|
186
|
-
<DocsSubHeader
|
|
338
|
+
<DocsSubHeader
|
|
339
|
+
packages={['igniteui-angular', 'igniteui-charts']}
|
|
340
|
+
selectedPackage="igniteui-angular"
|
|
341
|
+
/>
|
|
187
342
|
```
|
|
188
343
|
|
|
189
344
|
### Combining prop-driven components without the integration
|
|
190
345
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
// src/layouts/MyDocsLayout.astro
|
|
196
|
-
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
197
|
-
import DocsSidebar from 'igniteui-astro-components/components/sidebar/DocsSidebar.astro';
|
|
198
|
-
import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
199
|
-
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
200
|
-
import type { MarkdownHeading } from 'astro';
|
|
201
|
-
|
|
202
|
-
interface Props {
|
|
203
|
-
title: string;
|
|
204
|
-
currentSlug: string;
|
|
205
|
-
headings?: MarkdownHeading[];
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const { title, currentSlug, headings } = Astro.props;
|
|
209
|
-
|
|
210
|
-
const sidebar: SidebarEntry[] = [/* … your tree … */];
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
<DocsLayout title={title} siteTitle="My Library" hasSidebar currentSlug={currentSlug}>
|
|
214
|
-
<DocsSidebar slot="sidebar" items={sidebar} currentSlug={currentSlug} />
|
|
215
|
-
{headings && <DocsToc slot="toc" headings={headings} offsetTarget=".docs-subheader" />}
|
|
216
|
-
<slot />
|
|
217
|
-
</DocsLayout>
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
> 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.
|
|
346
|
+
The layout in [Quick start](#quick-start) step 4 is the minimal setup: every
|
|
347
|
+
piece of data arrives as a prop. The virtual modules must still resolve at
|
|
348
|
+
build time, because the components import them at module level; step 2 shows
|
|
349
|
+
the stub.
|
|
221
350
|
|
|
222
351
|
---
|
|
223
352
|
|
|
@@ -237,59 +366,93 @@ const sidebar: SidebarEntry[] = [/* … your tree … */];
|
|
|
237
366
|
|
|
238
367
|
### Chrome components
|
|
239
368
|
|
|
240
|
-
| Export | Purpose
|
|
241
|
-
| ---------------------------------------- |
|
|
242
|
-
| `…/components/GlobalNavBar.astro` | IG global navigation bar — legacy, fetched from `/navigation`
|
|
243
|
-
| `…/components/GlobalFooter.astro` | IG global footer — legacy, fetched from `/navigation`
|
|
244
|
-
| `…/chrome` | `igChrome()` — render the header/footer from a synced snapshot
|
|
245
|
-
| `…/chrome/contract` | `parseFragment()` — the `ig-chrome` contract checks, for sync scripts
|
|
246
|
-
| `…/components/DocsSubHeader.astro` | Secondary fixed bar —
|
|
247
|
-
| `…/components/Search.astro` | Pagefind-powered full-text search modal
|
|
248
|
-
| `…/components/
|
|
249
|
-
| `…/components/
|
|
250
|
-
| `…/components/
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
|
262
|
-
|
|
|
263
|
-
| `…/
|
|
369
|
+
| Export | Purpose | Docs |
|
|
370
|
+
| ---------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
371
|
+
| `…/components/GlobalNavBar.astro` | IG global navigation bar — legacy, fetched from `/navigation` | [README](src/components/GlobalNavBar/README.md) |
|
|
372
|
+
| `…/components/GlobalFooter.astro` | IG global footer — legacy, fetched from `/navigation` | [README](src/components/GlobalFooter/README.md) |
|
|
373
|
+
| `…/chrome` | `igChrome()` — render the header/footer from a synced snapshot | [below](#the-infragistics-header-and-footer) |
|
|
374
|
+
| `…/chrome/contract` | `parseFragment()` — the `ig-chrome` contract checks, for sync scripts | [below](#the-infragistics-header-and-footer) |
|
|
375
|
+
| `…/components/DocsSubHeader.astro` | Secondary fixed bar — package/version selectors, search | [README](src/components/DocsSubHeader/README.md) |
|
|
376
|
+
| `…/components/Search.astro` | Pagefind-powered full-text search modal | [README](src/components/Search/README.md) |
|
|
377
|
+
| `…/components/SearchAdvanced.astro` | Client-side API symbol search over a JSON index (api-docs) | [README](src/components/SearchAdvanced/README.md) |
|
|
378
|
+
| `…/components/ThemingWidget.astro` | Theme / colour-mode picker | [README](src/components/ThemingWidget/README.md) |
|
|
379
|
+
| `…/components/CopyCode.astro` | Adds a copy button to every Shiki code block | [README](src/components/CopyCode/README.md) |
|
|
380
|
+
| `…/components/MobileSidebarToggle.astro` | Mobile-only sidebar disclosure button | [README](src/components/MobileSidebarToggle/README.md) |
|
|
381
|
+
| `…/components/MobileTocToggle.astro` | Mobile-only "On this page" dropdown | [README](src/components/MobileTocToggle/README.md) |
|
|
382
|
+
| `…/components/DocsToc.astro` | "On this page" table of contents with scroll-spy | [README](src/components/DocsToc/README.md) |
|
|
383
|
+
| `…/components/DocsToc/toTreeNodes` | `headingsToTreeNodes()`, `TocConfig` — headings → `TreeNode[]` | [README](src/components/DocsToc/README.md) |
|
|
384
|
+
|
|
385
|
+
`DocsBreadcrumb` and `LicenseIndicator` are rendered by `DocsLayout` but are
|
|
386
|
+
not exported yet.
|
|
387
|
+
|
|
388
|
+
### Sidebar and tree
|
|
389
|
+
|
|
390
|
+
| Export | Purpose | Docs |
|
|
391
|
+
| --------------------------------------------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------- |
|
|
392
|
+
| `…/components/DocsSidebar/DocsSidebar.astro` | Composition root — logo, filter input, tree | [README](src/components/DocsSidebar/README.md) |
|
|
393
|
+
| `…/components/DocsSidebar/SidebarFilterInput.astro` | Filter input markup | [README](src/components/DocsSidebar/README.md) |
|
|
394
|
+
| `…/components/DocsSidebar/SidebarLabel.astro` | Label renderer used with `DocsTree` | [README](src/components/DocsSidebar/README.md) |
|
|
395
|
+
| `…/components/DocsSidebar/toTreeNodes` | `toTreeNodes()` — `SidebarEntry[]` → `TreeNode[]` | [README](src/components/DocsSidebar/README.md) |
|
|
396
|
+
| `…/components/DocsSidebar/sidebar-filter` | `<sidebar-filter>` custom element + cross-navigation hooks | [README](src/components/DocsSidebar/README.md) |
|
|
397
|
+
| `…/components/DocsTree/DocsTree.astro` | Generic `<igc-tree>` renderer shared by sidebar and TOC | [README](src/components/DocsTree/README.md) |
|
|
398
|
+
| `…/components/DocsTree/DocsTreeItem.astro` | One `<igc-tree-item>`, recursive | [README](src/components/DocsTree/README.md) |
|
|
399
|
+
| `…/components/DocsTree/types` | `TreeNode`, `TreeVariant` | [README](src/components/DocsTree/README.md) |
|
|
400
|
+
| `…/components/DocsTree/docs-tree.css` | Tree styles (export points at a missing file, see #159; the real file is `docs-tree.scss`) | [README](src/components/DocsTree/README.md) |
|
|
401
|
+
| `…/lib/sidebar/types` | `SidebarEntry`, `SidebarGroup`, `SidebarLink`, `SidebarBadge`, `SIDEBAR_BADGE_VARIANTS` | — |
|
|
402
|
+
| `…/lib/sidebar/helpers` | `isActive`, `isGroup`, `isInitiallyOpen`, `getBreadcrumb`, `joinPath`, … | — |
|
|
403
|
+
| `…/lib/types` | `PlatformName`, `ApiPackageConfig`, `PlatformContext` | — |
|
|
404
|
+
| `…/sidebar` | `buildSidebarFromToc()` — JSON TOC → sidebar tree converter (build-time) | — |
|
|
264
405
|
|
|
265
406
|
### MDX components
|
|
266
407
|
|
|
267
|
-
| Export | Purpose
|
|
268
|
-
| -------------------------------------- |
|
|
269
|
-
| `…/components/mdx/ApiLink.astro` | Inline link to an API symbol with platform-aware URLs
|
|
270
|
-
| `…/components/mdx/ApiRef.astro` | Block API
|
|
271
|
-
| `…/components/mdx/
|
|
272
|
-
| `…/components/mdx/PlatformBlock.astro` | Show content only on selected platforms
|
|
273
|
-
| `…/components/mdx/
|
|
408
|
+
| Export | Purpose | Docs |
|
|
409
|
+
| -------------------------------------- | ------------------------------------------------------------------- | ---------------------------------------------------- |
|
|
410
|
+
| `…/components/mdx/ApiLink.astro` | Inline link to an API symbol with platform-aware URLs | [README](src/components/mdx/ApiLink/README.md) |
|
|
411
|
+
| `…/components/mdx/ApiRef.astro` | Block "API References" list | [README](src/components/mdx/ApiRef/README.md) |
|
|
412
|
+
| `…/components/mdx/Sample.astro` | Embedded live sample with code tabs and live-edit buttons | [README](src/components/mdx/Sample/README.md) |
|
|
413
|
+
| `…/components/mdx/PlatformBlock.astro` | Show content only on selected platforms | [README](src/components/mdx/PlatformBlock/README.md) |
|
|
414
|
+
| `…/components/mdx/DocsAside.astro` | Note / info / warning callout | [README](src/components/mdx/DocsAside/README.md) |
|
|
415
|
+
| `…/components/mdx/Badge.astro` | Status chip (preview, new, updated, premium, opensource) | [README](src/components/mdx/Badge/README.md) |
|
|
416
|
+
| `…/components/mdx/Anatomy.astro` | Framed component anatomy image | [README](src/components/mdx/Anatomy/README.md) |
|
|
417
|
+
| `…/components/mdx/DoDont.astro` | Side-by-side Do / Don't image guidance panels | [README](src/components/mdx/DoDont/README.md) |
|
|
418
|
+
| `…/components/mdx/FigmaUiKits.astro` | "Check it out in our free Figma UI kits" banner linking to the kits | [README](src/components/mdx/FigmaUiKits/README.md) |
|
|
419
|
+
| `…/components/mdx/Faq.astro` | FAQ accordion | [README](src/components/mdx/Faq/README.md) |
|
|
420
|
+
| `…/components/mdx/FaqItem.astro` | One question/answer panel | [README](src/components/mdx/Faq/README.md) |
|
|
421
|
+
| `…/components/mdx/Faq/types` | `FaqEntry`, `FaqIndicatorPosition` | [README](src/components/mdx/Faq/README.md) |
|
|
422
|
+
|
|
423
|
+
### Code snippets
|
|
424
|
+
|
|
425
|
+
| Export | Purpose | Docs |
|
|
426
|
+
| -------------- | -------------------------------------------------------------------------------- | ---------------------------------- |
|
|
427
|
+
| `…/code-theme` | Brand Shiki theme (Rosé Pine Moon recoloured) and the ready-made `igShikiConfig` | [README](src/code-theme/README.md) |
|
|
274
428
|
|
|
275
429
|
### Build helpers
|
|
276
430
|
|
|
277
|
-
| Export | Purpose
|
|
278
|
-
| ---------------------------------- |
|
|
279
|
-
| `…/platform` |
|
|
280
|
-
| `…/content` |
|
|
281
|
-
| `…/content-config` | Default content collection schema
|
|
282
|
-
| `…/llms` | `llms.txt`
|
|
283
|
-
| `…/plugins/remark-env-vars` | Remark plugin — `{Environment.X}` token substitution
|
|
284
|
-
| `…/plugins/remark-md-links` | Remark plugin — `.md` → slug link rewriting + `DOCS_BASE` prepending
|
|
285
|
-
| `…/plugins/remark-html-transforms` | Remark plugin — divider→`<hr>`, code lang normalization, img src fixes
|
|
431
|
+
| Export | Purpose |
|
|
432
|
+
| ---------------------------------- | -------------------------------------------------------------------------------- |
|
|
433
|
+
| `…/platform` | `PlatformKey`, `NavLang`, `getPlatformHead()`, `getNavConfig()`, `PLATFORM_DEFS` |
|
|
434
|
+
| `…/content` | `createDocsCollection()` content collection helper |
|
|
435
|
+
| `…/content-config` | Default content collection schema |
|
|
436
|
+
| `…/llms` | `buildLlmsTxt()` — generates `llms.txt` files for a docs _site_ |
|
|
437
|
+
| `…/plugins/remark-env-vars` | Remark plugin — `{Environment.X}` token substitution |
|
|
438
|
+
| `…/plugins/remark-md-links` | Remark plugin — `.md` → slug link rewriting + `DOCS_BASE` prepending |
|
|
439
|
+
| `…/plugins/remark-html-transforms` | Remark plugin — divider→`<hr>`, code lang normalization, img src fixes |
|
|
440
|
+
| `…/plugins/rehype-heading-anchors` | Rehype plugin — anchor links on headings (used by every consumer) |
|
|
441
|
+
| `…/plugins/rehype-table-wrapper` | Rehype plugin — wraps tables for horizontal scrolling |
|
|
442
|
+
| `…/plugins/rehype-pagefind-ignore` | Rehype plugin — `data-pagefind-ignore` on code blocks |
|
|
286
443
|
|
|
287
444
|
### Styles
|
|
288
445
|
|
|
289
|
-
| Export
|
|
290
|
-
|
|
|
291
|
-
| `…/styles/
|
|
292
|
-
|
|
446
|
+
| Export | Purpose |
|
|
447
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
448
|
+
| `…/styles/theme.scss` | The only stylesheet: igniteui-theming setup, layer order, `--igd-*` tokens, markdown and code-block styles. `DocsLayout` imports it. |
|
|
449
|
+
|
|
450
|
+
Design tokens are CSS custom properties prefixed `--igd-` and defined on
|
|
451
|
+
`:root` in [src/styles/global/\_variables.scss](src/styles/global/_variables.scss)
|
|
452
|
+
(fonts, accent, surfaces, spacing, radius, badges, asides, FAQ, tables, and
|
|
453
|
+
`--igd-code-*` for code snippets, see [src/code-theme/README.md](src/code-theme/README.md)).
|
|
454
|
+
Override them in the host's own stylesheet; there are no Sass `!default`
|
|
455
|
+
variables to configure.
|
|
293
456
|
|
|
294
457
|
---
|
|
295
458
|
|
|
@@ -408,7 +571,11 @@ Every component is reachable through an explicit subpath in
|
|
|
408
571
|
(`igniteui-astro-components`) resolve to the JS/TS barrel
|
|
409
572
|
[`src/index.ts`](./src/index.ts) which re-exports the runtime helpers only —
|
|
410
573
|
`.astro` files must always be imported via their full subpath because Astro
|
|
411
|
-
components are not plain ES modules.
|
|
574
|
+
components are not plain ES modules. The barrel re-exports `./integration`,
|
|
575
|
+
which imports `pagefind` (not a declared dependency, #157), so a bare import
|
|
576
|
+
fails to resolve unless the host installs `pagefind`. Import the subpaths you
|
|
577
|
+
need (`igniteui-astro-components/sidebar`, `.../platform`, `.../lib/types`, …)
|
|
578
|
+
instead of the bare package.
|
|
412
579
|
|
|
413
580
|
---
|
|
414
581
|
|
|
@@ -485,7 +652,7 @@ Import component files directly by relative path without any alias or install:
|
|
|
485
652
|
```astro
|
|
486
653
|
---
|
|
487
654
|
import DocsLayout from '../../astro-components/src/layouts/DocsLayout/DocsLayout.astro';
|
|
488
|
-
import DocsSidebar from '../../astro-components/src/components/
|
|
655
|
+
import DocsSidebar from '../../astro-components/src/components/DocsSidebar/DocsSidebar.astro';
|
|
489
656
|
import ApiLink from '../../astro-components/src/components/mdx/ApiLink/ApiLink.astro';
|
|
490
657
|
---
|
|
491
658
|
```
|
|
@@ -496,16 +663,13 @@ This works immediately but ties your import paths to the internal folder structu
|
|
|
496
663
|
|
|
497
664
|
## Development
|
|
498
665
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
There is no build step — sources are published as-is and consumers compile
|
|
504
|
-
them through their own Astro / Vite pipeline. TypeScript is used only for
|
|
505
|
-
type-checking during development:
|
|
666
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup, the playground, tests,
|
|
667
|
+
lint/format, how to add a component, and how releases work. The short version:
|
|
506
668
|
|
|
507
669
|
```sh
|
|
508
|
-
|
|
670
|
+
npm ci
|
|
671
|
+
npm run playground # http://localhost:4567
|
|
672
|
+
npm run format:check && npm test && npm run lint && npm run playground:check && npm run playground:build
|
|
509
673
|
```
|
|
510
674
|
|
|
511
675
|
---
|