igniteui-astro-components 0.0.27 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +82 -74
  2. package/package.json +16 -2
  3. package/src/assets/images/anatomy-test.png +0 -0
  4. package/src/components/CopyCode/CopyCode.astro +21 -7
  5. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +33 -21
  6. package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +44 -43
  7. package/src/components/DocsBreadcrumb/README.md +10 -14
  8. package/src/components/DocsSidebar/DocsSidebar.astro +47 -45
  9. package/src/components/DocsSidebar/DocsSidebar.scss +120 -122
  10. package/src/components/DocsSidebar/README.md +25 -21
  11. package/src/components/DocsSidebar/SidebarFilterInput.astro +24 -29
  12. package/src/components/DocsSidebar/SidebarFilterInput.scss +90 -89
  13. package/src/components/DocsSidebar/SidebarLabel.astro +35 -26
  14. package/src/components/DocsSidebar/sidebar-filter.ts +93 -56
  15. package/src/components/DocsSubHeader/DocsSubHeader.astro +256 -195
  16. package/src/components/DocsSubHeader/DocsSubHeader.scss +181 -178
  17. package/src/components/DocsSubHeader/README.md +18 -16
  18. package/src/components/DocsToc/DocsToc.astro +301 -280
  19. package/src/components/DocsToc/DocsToc.scss +20 -21
  20. package/src/components/DocsToc/README.md +11 -9
  21. package/src/components/DocsToc/toTreeNodes.ts +3 -8
  22. package/src/components/DocsTree/DocsTree.astro +32 -20
  23. package/src/components/DocsTree/DocsTreeItem.astro +35 -30
  24. package/src/components/DocsTree/README.md +16 -15
  25. package/src/components/DocsTree/docs-tree.scss +267 -268
  26. package/src/components/GlobalFooter/GlobalFooter.astro +10 -10
  27. package/src/components/GlobalFooter/README.md +3 -2
  28. package/src/components/GlobalNavBar/GlobalNavBar.astro +4 -2
  29. package/src/components/GlobalNavBar/GlobalNavBar.module.scss +222 -222
  30. package/src/components/GlobalNavBar/README.md +3 -2
  31. package/src/components/LicenseIndicator/LicenseIndicator.astro +7 -5
  32. package/src/components/LicenseIndicator/LicenseIndicator.scss +3 -3
  33. package/src/components/MobileSidebarToggle/MobileSidebarToggle.astro +16 -17
  34. package/src/components/MobileSidebarToggle/README.md +3 -2
  35. package/src/components/MobileTocToggle/MobileTocToggle.astro +75 -61
  36. package/src/components/MobileTocToggle/MobileTocToggle.scss +65 -59
  37. package/src/components/Search/README.md +1 -0
  38. package/src/components/Search/Search.astro +137 -109
  39. package/src/components/Search/Search.scss +20 -20
  40. package/src/components/SearchAdvanced/README.md +21 -15
  41. package/src/components/SearchAdvanced/SearchAdvanced.astro +205 -133
  42. package/src/components/SearchAdvanced/SearchAdvanced.scss +152 -153
  43. package/src/components/mdx/Anatomy/Anatomy.astro +51 -0
  44. package/src/components/mdx/Anatomy/Anatomy.scss +40 -0
  45. package/src/components/mdx/ApiLink/ApiLink.astro +133 -113
  46. package/src/components/mdx/ApiLink/ApiLink.scss +9 -9
  47. package/src/components/mdx/ApiLink/README.md +26 -22
  48. package/src/components/mdx/ApiLink/api-link-index.ts +196 -173
  49. package/src/components/mdx/ApiRef/ApiRef.astro +54 -51
  50. package/src/components/mdx/ApiRef/README.md +20 -15
  51. package/src/components/mdx/Badge/Badge.astro +14 -14
  52. package/src/components/mdx/Badge/Badge.scss +61 -56
  53. package/src/components/mdx/Badge/README.md +24 -19
  54. package/src/components/mdx/DocsAside/DocsAside.astro +30 -37
  55. package/src/components/mdx/DocsAside/DocsAside.scss +82 -82
  56. package/src/components/mdx/DocsAside/README.md +22 -22
  57. package/src/components/mdx/Faq/Faq.astro +86 -0
  58. package/src/components/mdx/Faq/Faq.scss +105 -0
  59. package/src/components/mdx/Faq/FaqItem.astro +117 -0
  60. package/src/components/mdx/Faq/README.md +223 -0
  61. package/src/components/mdx/Faq/types.ts +34 -0
  62. package/src/components/mdx/PlatformBlock/PlatformBlock.astro +3 -2
  63. package/src/components/mdx/PlatformBlock/README.md +6 -8
  64. package/src/components/mdx/Sample/README.md +21 -16
  65. package/src/components/mdx/Sample/Sample.astro +97 -74
  66. package/src/components/mdx/Sample/Sample.scss +132 -132
  67. package/src/content-helper.ts +71 -72
  68. package/src/content.config.ts +1 -6
  69. package/src/integration.ts +566 -512
  70. package/src/layouts/DocsLayout/DocsLayout.astro +228 -182
  71. package/src/layouts/DocsLayout/DocsLayout.scss +261 -261
  72. package/src/layouts/DocsLayout/README.md +24 -35
  73. package/src/lib/nav-helpers.ts +88 -82
  74. package/src/lib/types.ts +76 -76
  75. package/src/llms.ts +205 -166
  76. package/src/platform.ts +312 -162
  77. package/src/plugins/rehype-heading-anchors.ts +45 -45
  78. package/src/plugins/rehype-pagefind-ignore.ts +19 -19
  79. package/src/plugins/rehype-table-wrapper.ts +30 -30
  80. package/src/plugins/remark-docfx.ts +12 -0
  81. package/src/plugins/remark-env-vars.ts +12 -4
  82. package/src/plugins/remark-md-links.ts +10 -4
  83. package/src/scripts/icon-manifest.ts +13 -5
  84. package/src/scripts/sample-widget.ts +557 -501
  85. package/src/sidebar.ts +103 -97
  86. package/src/styles/global/_code-blocks.scss +43 -44
  87. package/src/styles/global/_component-themes.scss +151 -153
  88. package/src/styles/global/_icon-gallery.scss +81 -81
  89. package/src/styles/global/_index.scss +0 -1
  90. package/src/styles/global/_markdown.scss +816 -787
  91. package/src/styles/global/_palette.scss +456 -110
  92. package/src/styles/global/_search-shared.scss +402 -398
  93. package/src/styles/global/_type-scale.scss +127 -127
  94. package/src/styles/global/_variables.scss +138 -111
  95. package/src/styles/theme.scss +41 -41
  96. package/src/virtual-modules.d.ts +11 -2
@@ -1,34 +1,33 @@
1
1
  @use 'igniteui-theming/sass/typography' as *;
2
2
 
3
3
  :root {
4
- --ig-toc-width: #{rem(330px)};
4
+ --ig-toc-width: #{rem(330px)};
5
5
  }
6
6
 
7
7
  .toc-sidebar {
8
- display: block;
9
- position: sticky;
10
- top: var(--igd-header-height);
11
- max-width: var(--ig-toc-width);
12
- width: 100%;
13
- min-width: rem(256px);
14
- max-height: calc(100vh - var(--igd-header-height));
15
- overflow-y: auto;
16
- padding-block: rem(24px);
8
+ display: block;
9
+ position: sticky;
10
+ top: var(--igd-header-height);
11
+ max-width: var(--ig-toc-width);
12
+ width: 100%;
13
+ min-width: rem(256px);
14
+ max-height: calc(100vh - var(--igd-header-height));
15
+ overflow-y: auto;
16
+ padding-block: rem(24px);
17
17
  }
18
18
 
19
19
  .toc-wrapper {
20
- border-inline-end: var(--igd-app-outline);
21
- border-block-end: var(--igd-app-outline);
22
- background-color: var(--igd-layout-sections-bg);
23
- height: 100%;
20
+ border-inline-end: var(--igd-app-outline);
21
+ border-block-end: var(--igd-app-outline);
22
+ background-color: var(--igd-layout-sections-bg);
23
+ height: 100%;
24
24
  }
25
25
 
26
-
27
26
  .toc-sidebar__heading {
28
- @include type-style('body-2');
29
-
30
- color: var(--ig-gray-500);
31
- padding-block-end: rem(8px);
32
- padding-inline: rem(24px) 0;
33
- text-transform: uppercase;
27
+ @include type-style('body-2');
28
+
29
+ color: var(--ig-gray-500);
30
+ padding-block-end: rem(8px);
31
+ padding-inline: rem(24px) 0;
32
+ text-transform: uppercase;
34
33
  }
@@ -12,14 +12,15 @@ 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. |
21
21
 
22
22
  `tocConfig` defaults:
23
+
23
24
  - `minHeadingLevel`: `2` (i.e. `##`)
24
25
  - `maxHeadingLevel`: `3` (i.e. `###`)
25
26
 
@@ -31,6 +32,7 @@ import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
31
32
 
32
33
  const { headings } = Astro.props;
33
34
  ---
35
+
34
36
  <DocsToc headings={headings} />
35
37
 
36
38
  <!-- Only h2 -->
@@ -61,8 +63,8 @@ Because bundled `<script>` modules run only once, the component listens for `ast
61
63
 
62
64
  The component ships global styles. Place the TOC inside an element with the `.toc-sidebar` class to get the built-in fixed sidebar layout (visible above `84rem`).
63
65
 
64
- | CSS custom property | Default | Description |
65
- |---------------------|---------|-------------|
66
- | `--ig-toc-width` | `24rem` | Width of the fixed TOC sidebar. |
66
+ | CSS custom property | Default | Description |
67
+ | ------------------- | ------- | ------------------------------- |
68
+ | `--ig-toc-width` | `24rem` | Width of the fixed TOC sidebar. |
67
69
 
68
70
  `.toc-sidebar:not(:has(docs-toc))` is set to `display: none` so the sidebar collapses automatically when the TOC has no items to render.
@@ -12,10 +12,7 @@
12
12
  import type { MarkdownHeading } from 'astro';
13
13
  import type { TreeNode } from '../DocsTree/types';
14
14
 
15
- export type TocConfig =
16
- | false
17
- | { minHeadingLevel?: number; maxHeadingLevel?: number }
18
- | undefined;
15
+ export type TocConfig = false | { minHeadingLevel?: number; maxHeadingLevel?: number } | undefined;
19
16
 
20
17
  interface TocItem {
21
18
  depth: number;
@@ -51,7 +48,5 @@ const toNode = (item: TocItem): TreeNode => ({
51
48
  children: item.children.length > 0 ? item.children.map(toNode) : undefined,
52
49
  });
53
50
 
54
- export const headingsToTreeNodes = (
55
- headings: MarkdownHeading[],
56
- config: TocConfig,
57
- ): TreeNode[] => buildToc(headings, config).map(toNode);
51
+ export const headingsToTreeNodes = (headings: MarkdownHeading[], config: TocConfig): TreeNode[] =>
52
+ buildToc(headings, config).map(toNode);
@@ -44,15 +44,17 @@ const { nodes, variant, activeId, toggleNodeOnClick, ariaLabel, renderLabel } =
44
44
  aria-label={ariaLabel}
45
45
  toggle-node-on-click={toggleNodeOnClick ? '' : undefined}
46
46
  >
47
- {nodes.map((node) => (
48
- <DocsTreeItem
49
- node={node}
50
- depth={0}
51
- variant={variant}
52
- activeId={activeId}
53
- renderLabel={renderLabel}
54
- />
55
- ))}
47
+ {
48
+ nodes.map((node) => (
49
+ <DocsTreeItem
50
+ node={node}
51
+ depth={0}
52
+ variant={variant}
53
+ activeId={activeId}
54
+ renderLabel={renderLabel}
55
+ />
56
+ ))
57
+ }
56
58
  </igc-tree>
57
59
 
58
60
  <script>
@@ -92,7 +94,7 @@ const { nodes, variant, activeId, toggleNodeOnClick, ariaLabel, renderLabel } =
92
94
  focusWasInTree = false;
93
95
  customElements.whenDefined('igc-tree-item').then(() => {
94
96
  const activeItem = document.querySelector<HTMLElement>(
95
- 'igc-tree[data-variant="sidebar"] igc-tree-item:has(a[aria-current="page"])'
97
+ 'igc-tree[data-variant="sidebar"] igc-tree-item:has(a[aria-current="page"])',
96
98
  );
97
99
  activeItem?.focus();
98
100
  });
@@ -102,18 +104,28 @@ const { nodes, variant, activeId, toggleNodeOnClick, ariaLabel, renderLabel } =
102
104
  // up/down arrow key navigation works immediately after the click.
103
105
  // The <a> overlay is position:absolute and captures clicks, but igc-tree's
104
106
  // keyboard handler only fires when igc-tree-item itself has focus.
105
- document.addEventListener('click', (e) => {
106
- const link = (e.target as Element).closest('igc-tree[data-variant="sidebar"] a.docs-tree-link');
107
- if (!link) return;
108
- link.closest<HTMLElement>('igc-tree-item')?.focus();
109
- }, { capture: true });
107
+ document.addEventListener(
108
+ 'click',
109
+ (e) => {
110
+ const link = (e.target as Element).closest(
111
+ 'igc-tree[data-variant="sidebar"] a.docs-tree-link',
112
+ );
113
+ if (!link) return;
114
+ link.closest<HTMLElement>('igc-tree-item')?.focus();
115
+ },
116
+ { capture: true },
117
+ );
110
118
 
111
119
  // Suppress the active-indicator transition during window resize so the
112
120
  // anchor-positioned ::before bar doesn't slowly slide to its new position.
113
121
  let resizeTimer: ReturnType<typeof setTimeout>;
114
- window.addEventListener('resize', () => {
115
- document.body.classList.add('is-resizing');
116
- clearTimeout(resizeTimer);
117
- resizeTimer = setTimeout(() => document.body.classList.remove('is-resizing'), 150);
118
- }, { passive: true });
122
+ window.addEventListener(
123
+ 'resize',
124
+ () => {
125
+ document.body.classList.add('is-resizing');
126
+ clearTimeout(resizeTimer);
127
+ resizeTimer = setTimeout(() => document.body.classList.remove('is-resizing'), 150);
128
+ },
129
+ { passive: true },
130
+ );
119
131
  </script>
@@ -30,8 +30,8 @@ interface Props {
30
30
  const { node, depth, variant, activeId, renderLabel: RenderLabel } = Astro.props;
31
31
 
32
32
  const hasChildren = !!(node.children && node.children.length > 0);
33
- const isLeaf = !hasChildren;
34
- const isActive = activeId !== undefined && node.id === activeId;
33
+ const isLeaf = !hasChildren;
34
+ const isActive = activeId !== undefined && node.id === activeId;
35
35
 
36
36
  // Fold itemData entries into a plain object of `data-*` props so Astro spreads
37
37
  // them onto <igc-tree-item>. Keys are camelCase → Astro converts to kebab.
@@ -50,40 +50,45 @@ if (node.itemData) {
50
50
  expanded={node.expanded ? '' : undefined}
51
51
  {...dataAttrs}
52
52
  >
53
- {node.href ? (
53
+ {
54
+ node.href ? (
54
55
  <div slot="label">
55
- <!-- The anchor is used only for navigation purpose it behave as an overlay on the ::part(wrapper) -->
56
+ {/* The anchor is used only for navigation purpose it behave as an overlay on the ::part(wrapper) */}
56
57
  <a
57
58
  href={node.href}
58
59
  aria-current={isActive ? 'page' : undefined}
59
60
  class="docs-tree-link"
60
61
  {...node.linkAttrs}
61
- ></a>
62
- {RenderLabel ? (
63
- <RenderLabel node={node} depth={depth} isLeaf={isLeaf} isActive={isActive} />
64
- ) : (
65
- <span class="docs-tree-label">{node.label}</span>
66
- )}
67
- {hasChildren && <igc-icon name="chevron" collection="docs" class="tree-expand-icon"></igc-icon>}
62
+ />
63
+ {RenderLabel ? (
64
+ <RenderLabel node={node} depth={depth} isLeaf={isLeaf} isActive={isActive} />
65
+ ) : (
66
+ <span class="docs-tree-label">{node.label}</span>
67
+ )}
68
+ {hasChildren && <igc-icon name="chevron" collection="docs" class="tree-expand-icon" />}
68
69
  </div>
69
- ) : (
70
- <div slot="label" class="docs-tree-group">
71
- {RenderLabel ? (
72
- <RenderLabel node={node} depth={depth} isLeaf={isLeaf} isActive={isActive} />
73
- ) : (
74
- <span class="docs-tree-label">{node.label}</span>
75
- )}
76
- <igc-icon name="chevron" collection="docs" class="tree-expand-icon"></igc-icon>
77
- </div>
78
- )}
70
+ ) : (
71
+ <div slot="label" class="docs-tree-group">
72
+ {RenderLabel ? (
73
+ <RenderLabel node={node} depth={depth} isLeaf={isLeaf} isActive={isActive} />
74
+ ) : (
75
+ <span class="docs-tree-label">{node.label}</span>
76
+ )}
77
+ <igc-icon name="chevron" collection="docs" class="tree-expand-icon" />
78
+ </div>
79
+ )
80
+ }
79
81
 
80
- {hasChildren && node.children!.map((child) => (
81
- <Astro.self
82
- node={child}
83
- depth={depth + 1}
84
- variant={variant}
85
- activeId={activeId}
86
- renderLabel={RenderLabel}
87
- />
88
- ))}
82
+ {
83
+ hasChildren &&
84
+ node.children!.map((child) => (
85
+ <Astro.self
86
+ node={child}
87
+ depth={depth + 1}
88
+ variant={variant}
89
+ activeId={activeId}
90
+ renderLabel={RenderLabel}
91
+ />
92
+ ))
93
+ }
89
94
  </igc-tree-item>
@@ -19,6 +19,7 @@ import MyLabel from './MyLabel.astro';
19
19
 
20
20
  const nodes: TreeNode[] = [/* your tree */];
21
21
  ---
22
+
22
23
  <DocsTree
23
24
  nodes={nodes}
24
25
  variant="sidebar"
@@ -30,26 +31,26 @@ const nodes: TreeNode[] = [/* your tree */];
30
31
 
31
32
  ## Props
32
33
 
33
- | Prop | Type | Notes |
34
- | --- | --- | --- |
35
- | `nodes` | `TreeNode[]` | Required. Root of the tree. |
36
- | `variant` | `'sidebar' \| 'toc'` | Required. Drives variant CSS rules. |
37
- | `activeId` | `string` | Optional. SSR-time match against `TreeNode.id`. **See active-state contract below.** |
38
- | `toggleNodeOnClick` | `boolean` | Optional. Forwarded to `<igc-tree>`. |
39
- | `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. |
40
41
 
41
42
  ## TreeNode shape
42
43
 
43
44
  ```ts
44
45
  interface TreeNode {
45
- id: string; // → data-tree-id
46
- label: string; // plain-text fallback
47
- href?: string; // when set, label is wrapped in <a href>
48
- expanded?: boolean; // SSR expand hint
46
+ id: string; // → data-tree-id
47
+ label: string; // plain-text fallback
48
+ href?: string; // when set, label is wrapped in <a href>
49
+ expanded?: boolean; // SSR expand hint
49
50
  children?: TreeNode[];
50
- itemData?: Record<string, string>; // → kebab-case data-* attrs on <igc-tree-item>
51
- linkAttrs?: Record<string, string | number | boolean | undefined>; // spread on leaf <a>
52
- meta?: Record<string, unknown>; // free-form, read by renderLabel
51
+ itemData?: Record<string, string>; // → kebab-case data-* attrs on <igc-tree-item>
52
+ linkAttrs?: Record<string, string | number | boolean | undefined>; // spread on leaf <a>
53
+ meta?: Record<string, unknown>; // free-form, read by renderLabel
53
54
  }
54
55
  ```
55
56
 
@@ -70,7 +71,7 @@ DocsTree supports two non-overlapping ways to mark the active node:
70
71
  selects via scroll-spy.
71
72
 
72
73
  **Do not pass `activeId` AND mutate `aria-current` at runtime in the
73
- same tree.** The two paths use different attribute *values* and would
74
+ same tree.** The two paths use different attribute _values_ and would
74
75
  flicker.
75
76
 
76
77
  ## Styling