igniteui-astro-components 1.6.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.
Files changed (64) hide show
  1. package/README.md +322 -158
  2. package/llms-full.txt +3207 -0
  3. package/llms.txt +103 -0
  4. package/package.json +17 -5
  5. package/src/assets/icons/figma-logo.svg +10 -0
  6. package/src/code-theme/README.md +72 -0
  7. package/src/code-theme/index.ts +57 -0
  8. package/src/components/CopyCode/CopyCode.astro +6 -1
  9. package/src/components/CopyCode/README.md +38 -0
  10. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +28 -30
  11. package/src/components/DocsSidebar/DocsSidebar.astro +14 -2
  12. package/src/components/DocsSidebar/README.md +58 -30
  13. package/src/components/DocsSidebar/SidebarLabel.astro +34 -36
  14. package/src/components/DocsSidebar/sidebar-filter.ts +53 -5
  15. package/src/components/DocsSidebar/toTreeNodes.ts +21 -5
  16. package/src/components/DocsSubHeader/DocsSubHeader.astro +22 -9
  17. package/src/components/DocsSubHeader/README.md +37 -31
  18. package/src/components/DocsToc/DocsToc.astro +12 -14
  19. package/src/components/DocsToc/README.md +7 -7
  20. package/src/components/DocsTree/DocsTree.astro +9 -11
  21. package/src/components/DocsTree/DocsTreeItem.astro +36 -40
  22. package/src/components/DocsTree/README.md +12 -9
  23. package/src/components/GlobalFooter/GlobalFooter.astro +6 -8
  24. package/src/components/GlobalNavBar/GlobalNavBar.astro +2 -4
  25. package/src/components/LicenseIndicator/LicenseIndicator.astro +6 -8
  26. package/src/components/MobileTocToggle/MobileTocToggle.astro +31 -33
  27. package/src/components/MobileTocToggle/README.md +45 -0
  28. package/src/components/Search/README.md +10 -10
  29. package/src/components/Search/Search.astro +12 -6
  30. package/src/components/SearchAdvanced/README.md +15 -8
  31. package/src/components/SearchAdvanced/SearchAdvanced.astro +17 -15
  32. package/src/components/ThemingWidget/ThemingWidget.astro +62 -60
  33. package/src/components/mdx/Anatomy/Anatomy.scss +1 -1
  34. package/src/components/mdx/Anatomy/README.md +40 -0
  35. package/src/components/mdx/ApiLink/ApiLink.astro +7 -9
  36. package/src/components/mdx/ApiLink/README.md +1 -0
  37. package/src/components/mdx/ApiRef/ApiRef.astro +7 -9
  38. package/src/components/mdx/ApiRef/README.md +1 -1
  39. package/src/components/mdx/Badge/Badge.astro +3 -1
  40. package/src/components/mdx/Badge/README.md +1 -3
  41. package/src/components/mdx/DocsAside/DocsAside.astro +3 -5
  42. package/src/components/mdx/DocsAside/README.md +47 -29
  43. package/src/components/mdx/Faq/Faq.astro +11 -13
  44. package/src/components/mdx/Faq/FaqItem.astro +20 -26
  45. package/src/components/mdx/FigmaUiKits/FigmaUiKits.astro +126 -0
  46. package/src/components/mdx/FigmaUiKits/FigmaUiKits.scss +165 -0
  47. package/src/components/mdx/FigmaUiKits/README.md +115 -0
  48. package/src/components/mdx/FigmaUiKits/kits.ts +26 -0
  49. package/src/components/mdx/PlatformBlock/README.md +5 -18
  50. package/src/components/mdx/Sample/README.md +67 -50
  51. package/src/components/mdx/Sample/Sample.astro +108 -33
  52. package/src/components/mdx/Sample/Sample.scss +38 -17
  53. package/src/integration.ts +6 -21
  54. package/src/layouts/DocsLayout/README.md +63 -28
  55. package/src/lib/warn-once.ts +8 -0
  56. package/src/scripts/copy-status.ts +35 -0
  57. package/src/scripts/icon-manifest.ts +1 -0
  58. package/src/scripts/sample-widget.ts +109 -42
  59. package/src/styles/global/_code-blocks.scss +58 -36
  60. package/src/styles/global/_copy-button.scss +18 -25
  61. package/src/styles/global/_markdown.scss +15 -8
  62. package/src/styles/global/_variables.scss +57 -0
  63. package/src/styles/theme.scss +4 -1
  64. package/src/virtual-modules.d.ts +2 -2
@@ -15,16 +15,21 @@
15
15
  * when a separate demosBaseUrl is present in the environment config.
16
16
  */
17
17
  import type { PlatformContext } from '../../../lib/types.ts';
18
+ import { warnOnce } from '../../../lib/warn-once.ts';
18
19
  import ThemingWidget from '../../ThemingWidget/ThemingWidget.astro';
19
20
  import './Sample.scss';
20
21
 
22
+ type SampleChrome = 'widget' | 'demo' | 'bare';
23
+
21
24
  interface Props {
25
+ /** Sample path relative to the demos base URL, e.g. `/charts/data-chart/axis-crossing`. */
22
26
  src: string;
23
27
  /**
24
28
  * Iframe height in px. Default 150. With `fitContent` it is only the
25
29
  * loading placeholder / cross-origin fallback and defaults to 50.
26
30
  */
27
31
  height?: number;
32
+ /** `title` of the iframe, for accessibility. Defaults to "<platform> Example". */
28
33
  alt?: string;
29
34
  /** Use lobDemosBaseUrl instead of demosBaseUrl (for LOB/grid-dynamic demos). */
30
35
  lob?: boolean;
@@ -39,23 +44,30 @@ interface Props {
39
44
  * browser on the Web Components site. Code tabs and live editing follow it.
40
45
  */
41
46
  wc?: boolean;
42
- /** Render only the iframe — no navbar, no code tabs, no live-edit footer. */
43
- iframeOnly?: boolean;
44
- /** When used with iframeOnly, also render a "View in full screen" button below. */
45
- fullscreenBtn?: boolean;
46
47
  /**
47
- * Keep the widget's frame but drop its code viewer: no tabs header, no code
48
- * fetch, and no live-edit or full-screen buttons. The footer then carries
49
- * only the theme picker (see `showThemePicker`), and without one there is
50
- * no footer at all. For demos whose code is not a usage example, e.g. ones
51
- * that fake interaction states for display.
48
+ * What the widget draws around the demo. Defaults to `widget`.
49
+ * - `widget`: the EXAMPLE and code tabs, and a footer with the live-edit and
50
+ * full-screen buttons (and the theme picker, with `showThemePicker`).
51
+ * - `demo`: the widget's frame and the demo, without the tabs and the code
52
+ * viewer. The footer carries only the theme picker, and without one there is
53
+ * no footer. For demos whose code is not a usage example, e.g. ones that fake
54
+ * interaction states for display.
55
+ * - `bare`: the iframe in a plain container (see `fullscreenBtn`).
52
56
  */
53
- hideCode?: boolean;
57
+ chrome?: SampleChrome;
54
58
  /**
55
59
  * Opt in to the in-sample theme picker for this sample. Its initial theme is
56
60
  * resolved from the site (see `defaultTheme` below), not passed per usage.
61
+ * `widget` and `demo` only: `bare` has no footer to put it in, so there it is
62
+ * ignored, with a build warning.
57
63
  */
58
64
  showThemePicker?: boolean;
65
+ /**
66
+ * Render a "View in full screen" button below the iframe. `bare` only: the
67
+ * `widget` footer already has one and `demo` leaves full screen out on
68
+ * purpose, so there it is ignored, with a build warning.
69
+ */
70
+ fullscreenBtn?: boolean;
59
71
  /**
60
72
  * Size the iframe to fit its content: the embedded page dictates the
61
73
  * iframe's size. `height` serves only as the placeholder/fallback — shown
@@ -99,10 +111,11 @@ interface Props {
99
111
  * container is fully transparent, so a demo without a background of its own
100
112
  * sits directly on the page.
101
113
  *
102
- * Defaults to `false` when `showThemePicker` is on: a sample whose theme —
103
- * and mode — the reader can switch needs a surface of its own to switch
104
- * against, otherwise a dark-mode demo would sit on the page's own light
105
- * background. An explicit value always wins.
114
+ * Defaults to `false` when a theme picker renders (`showThemePicker` with the
115
+ * `widget` or `demo` chrome): a sample whose theme — and mode — the reader
116
+ * can switch needs a surface of its own to switch against, otherwise a
117
+ * dark-mode demo would sit on the page's own light background. An explicit
118
+ * value always wins.
106
119
  */
107
120
  noBackground?: boolean;
108
121
  /**
@@ -113,6 +126,10 @@ interface Props {
113
126
  * overrides the transparency `noBackground` leaves behind (in light mode).
114
127
  */
115
128
  whiteBackground?: boolean;
129
+ /** @deprecated Use `chrome="bare"` instead. Will be removed in 2.0.0. */
130
+ iframeOnly?: boolean;
131
+ /** @deprecated Use `chrome="demo"` instead. Will be removed in 2.0.0. */
132
+ hideCode?: boolean;
116
133
  }
117
134
 
118
135
  const {
@@ -122,9 +139,7 @@ const {
122
139
  dv = false,
123
140
  crm = false,
124
141
  wc = false,
125
- iframeOnly = false,
126
142
  fullscreenBtn = false,
127
- hideCode = false,
128
143
  showThemePicker = false,
129
144
  fitContent = false,
130
145
  spacing = 'none',
@@ -134,9 +149,62 @@ const {
134
149
  whiteBackground = false,
135
150
  } = Astro.props;
136
151
 
137
- // The theme picker implies a painted backdrop (see the prop's doc), so its
138
- // default flips with `showThemePicker`. An explicitly passed value still wins.
139
- const noBackground = Astro.props.noBackground ?? !showThemePicker;
152
+ // `chrome` is checked first. A value that is not one of the three is ignored,
153
+ // as if it were not set, so a deprecated prop next to a mistyped `chrome` still
154
+ // applies.
155
+ const CHROMES: SampleChrome[] = ['widget', 'demo', 'bare'];
156
+ const explicitChrome = CHROMES.find((value) => value === Astro.props.chrome);
157
+
158
+ // `iframeOnly` and `hideCode` are the deprecated 1.x spellings of
159
+ // `chrome="bare"` and `chrome="demo"`. They keep working until 2.0.0 removes
160
+ // them, with a build warning for each sample that uses them, so the docs can
161
+ // move at their own pace. `iframeOnly` comes first so that it wins over
162
+ // `hideCode`, as in 1.x, and a valid `chrome` wins over both.
163
+ const DEPRECATED_PROPS = { iframeOnly: 'bare', hideCode: 'demo' } as const;
164
+ let deprecatedChrome: SampleChrome | undefined;
165
+ for (const prop of ['iframeOnly', 'hideCode'] as const) {
166
+ if (!Astro.props[prop]) continue;
167
+ const replacement = DEPRECATED_PROPS[prop];
168
+ const ignored = explicitChrome
169
+ ? ` chrome="${explicitChrome}" is set, so ${prop} is ignored.`
170
+ : '';
171
+ warnOnce(
172
+ `[Sample] ${src}: ${prop} is deprecated and will be removed in igniteui-astro-components 2.0.0. Use chrome="${replacement}" instead.${ignored}`,
173
+ );
174
+ deprecatedChrome ??= replacement;
175
+ }
176
+
177
+ const chrome = explicitChrome ?? deprecatedChrome ?? 'widget';
178
+ if (Astro.props.chrome != null && !explicitChrome) {
179
+ warnOnce(
180
+ `[Sample] ${src}: chrome="${Astro.props.chrome}" is not one of ${CHROMES.join(', ')}, so it is ignored, and the sample renders as chrome="${chrome}".`,
181
+ );
182
+ }
183
+ const isBare = chrome === 'bare';
184
+ const isDemo = chrome === 'demo';
185
+
186
+ // A modifier that doesn't apply to the chosen chrome would do nothing without a
187
+ // word, so say so at build time.
188
+ if (showThemePicker && isBare) {
189
+ warnOnce(
190
+ `[Sample] ${src}: showThemePicker has no effect with chrome="bare", which renders no footer for the picker.`,
191
+ );
192
+ }
193
+ if (fullscreenBtn && !isBare) {
194
+ warnOnce(
195
+ `[Sample] ${src}: fullscreenBtn only applies to chrome="bare". ${
196
+ isDemo
197
+ ? 'chrome="demo" leaves full screen out on purpose.'
198
+ : 'The widget footer already has a full-screen button.'
199
+ }`,
200
+ );
201
+ }
202
+ const hasThemePicker = showThemePicker && !isBare;
203
+ const hasFullscreenBtn = fullscreenBtn && isBare;
204
+
205
+ // The theme picker implies a painted backdrop (see the prop's doc), so the
206
+ // default flips when a picker renders. An explicitly passed value still wins.
207
+ const noBackground = Astro.props.noBackground ?? !hasThemePicker;
140
208
 
141
209
  // Fixed samples default to 150px. In fitContent mode `height` is only the
142
210
  // loading placeholder, so an unspecified one defaults lower (50px) to avoid
@@ -170,8 +238,8 @@ const spacingVal = ['none', 'sm', 'md', 'lg'].includes(spacing) ? spacing : 'non
170
238
  const containerStyle = fitContent ? undefined : `height: ${height}px`;
171
239
  // The fullscreen bar sits inside the container, so it is added on top of
172
240
  // `height` — the iframe keeps the height it was given.
173
- const iframeOnlyContainerStyle =
174
- fitContent || !fullscreenBtn
241
+ const bareContainerStyle =
242
+ fitContent || !hasFullscreenBtn
175
243
  ? containerStyle
176
244
  : `height: calc(${height}px + var(--sample-container-header-height))`;
177
245
  const iframeStyle = fitContent ? `width: 100%; height: ${height}px;` : 'width: 100%; height: 100%;';
@@ -210,7 +278,7 @@ const baseUrl = wc
210
278
  // Outside the Web Components site, `demosBaseUrl` is the page's own platform
211
279
  // browser, so a `wc` sample without `wcDemosBaseUrl` silently loads the wrong one.
212
280
  if (wc && !env.wcDemosBaseUrl && name !== 'WebComponents') {
213
- console.warn(
281
+ warnOnce(
214
282
  `[Sample] ${src}: wc is set but wcDemosBaseUrl is not configured, so this sample won't load from the Web Components samples browser.`,
215
283
  );
216
284
  }
@@ -221,9 +289,12 @@ const githubSrc = srcNoSlash;
221
289
  // Stable, unique element ID derived from the sample path.
222
290
  const widgetId = 'cw' + src.replace(/[^a-z0-9]/gi, '-');
223
291
  const exampleTabId = `${widgetId}-example`;
292
+ // Anchor for the iframeOnly fullscreen button's tooltip. The random suffix keeps
293
+ // it unique when the same demo is embedded more than once on a page.
294
+ const fullscreenBtnId = `${widgetId}-fullscreen-${Math.random().toString(36).slice(2, 9)}`;
224
295
 
225
- // The full widget's demo pane, shared by its two layouts: inside the EXAMPLE
226
- // tab, or on its own when `hideCode` drops the tabs.
296
+ // The widget's demo pane, shared by its two chromes: inside the EXAMPLE tab
297
+ // (`widget`), or on its own without the tabs (`demo`).
227
298
  const samplePaneClass = [
228
299
  'igd-sample-container',
229
300
  'loading',
@@ -258,7 +329,7 @@ const sampleIframeAttrs = {
258
329
  };
259
330
  ---
260
331
 
261
- {iframeOnly ? (
332
+ {isBare ? (
262
333
  <>
263
334
  <div
264
335
  class:list={[
@@ -280,7 +351,7 @@ const sampleIframeAttrs = {
280
351
  aria-label={
281
352
  isResizable ? 'Resizable sample — use the left and right arrow keys to resize' : undefined
282
353
  }
283
- style={iframeOnlyContainerStyle}
354
+ style={bareContainerStyle}
284
355
  >
285
356
  <div class="igd-sample-frame">
286
357
  <iframe
@@ -292,9 +363,10 @@ const sampleIframeAttrs = {
292
363
  />
293
364
  {isResizable && <div class="igd-sample-resize-handle" aria-hidden="true" />}
294
365
  </div>
295
- {fullscreenBtn && (
366
+ {hasFullscreenBtn && (
296
367
  <div class="igd-code-view__header-actions">
297
368
  <igc-icon-button
369
+ id={fullscreenBtnId}
298
370
  name="open-link-blank"
299
371
  collection="docs"
300
372
  variant="outlined"
@@ -303,6 +375,9 @@ const sampleIframeAttrs = {
303
375
  target="_blank"
304
376
  aria-label="Open in full screen"
305
377
  />
378
+ <igc-tooltip anchor={fullscreenBtnId} class="igd-sample-action-tooltip" with-arrow>
379
+ Open in full screen
380
+ </igc-tooltip>
306
381
  </div>
307
382
  )}
308
383
  </div>
@@ -310,16 +385,16 @@ const sampleIframeAttrs = {
310
385
  ) : (
311
386
  <>
312
387
  <div
313
- class:list={['igd-code-view', { 'igd-code-view--hide-code': hideCode }]}
388
+ class:list={['igd-code-view', { 'igd-code-view--demo': isDemo }]}
314
389
  id={widgetId}
315
390
  data-iframe-src={iframeSrc}
316
391
  data-demos-base-url={baseUrl}
317
392
  data-github-src={githubSrc}
318
393
  data-platform={wc ? 'wc' : lower}
319
- data-hide-code={hideCode ? 'true' : undefined}
394
+ data-chrome={chrome}
320
395
  >
321
396
  <div class="igd-code-view__inner">
322
- {hideCode ? (
397
+ {isDemo ? (
323
398
  <div class:list={samplePaneClass} {...samplePaneAttrs}>
324
399
  <igc-circular-progress
325
400
  indeterminate
@@ -349,7 +424,7 @@ const sampleIframeAttrs = {
349
424
  </igc-tabs>
350
425
  )}
351
426
  </div>
352
- {showThemePicker && (
427
+ {hasThemePicker && (
353
428
  <div class="igd-sample-theming" hidden>
354
429
  <ThemingWidget selectedTheme={defaultTheme} />
355
430
  </div>
@@ -363,8 +438,8 @@ const sampleIframeAttrs = {
363
438
  // astro:page-load fires after every client-router navigation AND on the initial
364
439
  // page load, so using it as the sole trigger handles both cases without
365
440
  // double-initialization.
366
- // Placed outside the iframeOnly conditional so components and icons are always
367
- // registered (needed for igc-icon-button even in iframeOnly + fullscreenBtn mode).
441
+ // Placed outside the chrome conditional so components and icons are always
442
+ // registered (needed for igc-icon-button even with chrome="bare" + fullscreenBtn).
368
443
  import { initSampleWidgets } from '../../../scripts/sample-widget';
369
444
  document.addEventListener('astro:page-load', initSampleWidgets);
370
445
  </script>
@@ -58,27 +58,21 @@ igc-tab {
58
58
  overflow: hidden auto;
59
59
  overscroll-behavior: contain;
60
60
 
61
+ // The <pre> carries `igd-code`, so surface, font and token colours come
62
+ // from the shared code-snippet rules (_code-blocks.scss) and match the
63
+ // page's fenced blocks. Only the frame differs: the tab draws the border.
61
64
  pre {
62
65
  margin: 0;
63
66
  border: none;
64
- // Same spacing token the EXAMPLE pane uses for `md`, so the code
65
- // and the demo share the same breathing room (and both follow an
66
- // --igd-sample-spacing-md override).
67
- padding: var(--igd-sample-spacing-md, #{rem(16px)});
68
67
  border-radius: 0;
69
- white-space: pre-wrap;
70
- word-break: break-word;
71
68
  }
72
69
 
73
- // Match the page-level CopyCode button (.copy-btn): flat variant, same
74
- // 8px corner offset, and the shared palette — the code pane is always
75
- // dark (single dark Shiki theme) while the button's default colors
76
- // follow the site theme, so without the palette the icon was invisible
77
- // in light mode until hovered.
70
+ // Same affordance as the page-level CopyCode button (.copy-btn): flat
71
+ // variant, same corner offset, same `--igd-code-copy-*` palette.
78
72
  .cv-hljs-code-copy {
79
73
  position: absolute;
80
- inset-block-start: rem(8px);
81
- inset-inline-end: rem(8px);
74
+ inset-block-start: var(--igd-code-copy-inset);
75
+ inset-inline-end: var(--igd-code-copy-inset);
82
76
  opacity: 0;
83
77
  transition: opacity 0.2s ease;
84
78
  pointer-events: none;
@@ -91,6 +85,14 @@ igc-tab {
91
85
  opacity: 1;
92
86
  pointer-events: auto;
93
87
  }
88
+
89
+ // Always shows the copy button on touch devices.
90
+ @media (hover: none) {
91
+ .cv-hljs-code-copy {
92
+ opacity: 1;
93
+ pointer-events: auto;
94
+ }
95
+ }
94
96
  }
95
97
  }
96
98
 
@@ -122,9 +124,9 @@ igc-tab::part(tab-header) {
122
124
  display: flex;
123
125
  }
124
126
 
125
- // `hideCode`: no tabs header, so the demo pane sits directly in the widget's
126
- // own frame, which already draws the border, and takes its top corners.
127
- .igd-code-view--hide-code {
127
+ // `chrome="demo"`: no tabs header, so the demo pane sits directly in the
128
+ // widget's own frame, which already draws the border, and takes its top corners.
129
+ .igd-code-view--demo {
128
130
  .igd-sample-container {
129
131
  flex: 1 1 0;
130
132
  min-width: 0;
@@ -148,7 +150,7 @@ igc-tab::part(tab-header) {
148
150
 
149
151
  display: grid;
150
152
  // The iframe frame takes all the space left over; anything after it (the
151
- // fullscreen bar in iframeOnly mode) keeps its own height.
153
+ // fullscreen bar with chrome="bare") keeps its own height.
152
154
  grid-template-rows: minmax(0, 1fr);
153
155
  position: relative;
154
156
  border: rem(1px) solid var(--ig-gray-300);
@@ -463,6 +465,25 @@ igc-tab::part(tab-header) {
463
465
  }
464
466
  }
465
467
 
468
+ // Names the icon-only action buttons (StackBlitz, full screen, copy code) on
469
+ // hover/focus. Same look as the theme picker's mode tooltips, which share the
470
+ // footer with these buttons.
471
+ .igd-sample-action-tooltip {
472
+ --ig-tooltip-background: rgb(52 75 101 / 90%);
473
+ --ig-tooltip-text-color: var(--ig-gray-50);
474
+ --ig-tooltip-border-radius: #{rem(4px)};
475
+
476
+ &::part(base) {
477
+ min-height: rem(24px);
478
+ padding: rem(4px) rem(8px);
479
+ font-family: var(--igd-font-sans);
480
+ font-size: rem(10px);
481
+ font-weight: 500;
482
+ letter-spacing: rem(0.33px);
483
+ line-height: rem(16px);
484
+ }
485
+ }
486
+
466
487
  .igd-code-view__header-actions {
467
488
  height: var(--sample-container-header-height);
468
489
  border-block-start: rem(1px) solid var(--ig-gray-300);
@@ -78,6 +78,7 @@ import { igChrome, type IgChromeOptions } from './chrome/integration';
78
78
  export { igChrome, type IgChromeOptions } from './chrome/integration';
79
79
  import { remarkMdLinks } from './plugins/remark-md-links';
80
80
  import { remarkHtmlTransforms } from './plugins/remark-html-transforms';
81
+ import { igShikiConfig } from './code-theme';
81
82
 
82
83
  /** Build / deployment mode. Drives env-var `DOCS_BUILD_MODE`. */
83
84
  export type DocsMode = 'development' | 'staging' | 'production';
@@ -212,8 +213,8 @@ export const navLang = ${JSON.stringify(navLang)};
212
213
  prerender: true,
213
214
  });
214
215
 
215
- // Configure Sass loadPaths so bare `highlight.js/scss/vs2015`
216
- // imports in the platform theme files resolve from node_modules.
216
+ // Configure Sass loadPaths so bare package imports in the platform
217
+ // theme files resolve from node_modules.
217
218
  updateConfig({
218
219
  vite: {
219
220
  css: {
@@ -659,24 +660,6 @@ export function createDocsSite(
659
660
  ? getPlatformHead(platform, navLang, { legacyChrome: !chrome || navLang === 'jp' })
660
661
  : [];
661
662
 
662
- // highlight.js for code-tab syntax highlighting inside code-view widgets.
663
- const codeViewHead: HeadEntry[] = [
664
- {
665
- tag: 'link',
666
- attrs: {
667
- rel: 'stylesheet',
668
- href: 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/vs2015.min.css',
669
- },
670
- },
671
- {
672
- tag: 'script',
673
- attrs: {
674
- src: 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js',
675
- defer: true,
676
- },
677
- },
678
- ];
679
-
680
663
  // Auto-configure a Vite dev-server proxy so sample-widget.ts can fetch
681
664
  // /code-viewer/*.json from the local demos server without CORS issues.
682
665
  const devProxy: Record<string, object> = {};
@@ -734,6 +717,8 @@ export function createDocsSite(
734
717
  },
735
718
  },
736
719
  markdown: {
720
+ // Brand Shiki theme; a consumer's own `markdown.shikiConfig` replaces it.
721
+ shikiConfig: igShikiConfig,
737
722
  ...(astroExtra as any).markdown,
738
723
  // Astro 7 renders Markdown/MDX with Sätteri instead of remark/rehype.
739
724
  // MDAST plugins run before HAST plugins, matching the old
@@ -764,7 +749,7 @@ export function createDocsSite(
764
749
  mode,
765
750
  llmsSets,
766
751
  productLinks,
767
- head: [...platformHead, ...codeViewHead, ...head],
752
+ head: [...platformHead, ...head],
768
753
  }),
769
754
  mdx(),
770
755
  ...(chrome ? [igChrome(chrome)] : []),
@@ -10,23 +10,58 @@ import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
10
10
 
11
11
  ## Props
12
12
 
13
- | Prop | Type | Default | Description |
14
- | ------------- | ---------------- | -------------- | ------------------------------------------------------------------------------------------------------------- |
15
- | `title` | `string` | — | Page `<title>` prepended to the site name. Omit to show the site name only. |
16
- | `description` | `string \| null` | — | `<meta name="description">` value. |
17
- | `keywords` | `string \| null` | — | `<meta name="keywords">` value. |
18
- | `hasSidebar` | `boolean` | `true` | Renders the sidebar rail when `true`. Provide content via `<… slot="sidebar">`. |
19
- | `currentSlug` | `string` | `''` | Slug of the current page — used for breadcrumbs in the sub-header. |
20
- | `siteTitle` | `string` | virtual module | Override the site name used in `<title>` and the sub-header. Use this when not running `siteMetaIntegration`. |
13
+ | Prop | Type | Default | Description |
14
+ | ----------------- | ---------------- | -------------- | ------------------------------------------------------------------------------------------------------------- |
15
+ | `title` | `string` | — | Page `<title>` prepended to the site name. Omit to show the site name only. |
16
+ | `description` | `string \| null` | — | `<meta name="description">` value. |
17
+ | `keywords` | `string \| null` | — | `<meta name="keywords">` value. |
18
+ | `hasSidebar` | `boolean` | `true` | Renders the sidebar rail when `true`. Provide content via `<… slot="sidebar">`. |
19
+ | `currentSlug` | `string` | `''` | Slug of the current page — used for the breadcrumb above the content. |
20
+ | `siteTitle` | `string` | virtual module | Override the site name used in `<title>` and the breadcrumb. Use this when not running `siteMetaIntegration`. |
21
+ | `license` | `string` | — | `license` frontmatter value. `'commercial'` shows a Premium badge, `'MIT'` an Open Source badge. |
22
+ | `is404` | `boolean` | `false` | Adds the `igd-page-layout--404` modifier class on 404 pages. |
23
+ | `packages` | `string[]` | — | Entries for the sub-header package selector. Hidden when omitted. |
24
+ | `selectedPackage` | `string` | — | Currently selected package (must match one of `packages`). |
25
+ | `packageLabel` | `string` | `'Package'` | `aria-label` of the sub-header package selector (not a visible label). |
26
+ | `versions` | `string[]` | — | Entries for the sub-header version selector. Hidden when omitted. |
27
+ | `selectedVersion` | `string` | — | Currently selected version (must match one of `versions`). |
28
+ | `versionLabel` | `string` | `'Version'` | `aria-label` of the sub-header version selector (not a visible label). |
29
+ | `showThemeToggle` | `boolean` | `false` | Forwarded to `DocsSubHeader`, which does not render a toggle; no effect today. |
30
+ | `themeStorageKey` | `string` | `'docs-theme'` | Forwarded to `DocsSubHeader` and unused; the layout's restore script reads the `'docs-theme'` key only. |
31
+
32
+ `hasToc` (`boolean`, default `true`) is also read at runtime and hides the `toc`
33
+ slot when `false`, but it is not yet declared in the `Props` interface (issue #161), so
34
+ TypeScript consumers must spread it in (`{...{ hasToc: false }}`).
21
35
 
22
36
  ## Slots
23
37
 
24
- | Slot | Description |
25
- | ----------- | ---------------------------------------------------------------------------------------------------------------------- |
26
- | _(default)_ | Main page content. |
27
- | `sidebar` | Sidebar content — typically `<DocsSidebar>`. Only rendered when `hasSidebar={true}`. |
28
- | `toc` | "On this page" column — pass `<DocsToc slot="toc" headings={headings} />` here. Omit to hide the TOC sidebar entirely. |
29
- | `head` | Extra `<head>` entries injected after platform defaults. |
38
+ | Slot | Description |
39
+ | ------------ | ---------------------------------------------------------------------------------------------------------------------- |
40
+ | _(default)_ | Main page content, rendered inside `<main data-pagefind-body>`. |
41
+ | `sidebar` | Sidebar content — typically `<DocsSidebar>`. Only rendered when `hasSidebar={true}`. |
42
+ | `toc` | "On this page" column — pass `<DocsToc slot="toc" headings={headings} />` here. Omit to hide the TOC sidebar entirely. |
43
+ | `mobile-toc` | Mobile-only TOC row below the sub-header — pass `<MobileTocToggle slot="mobile-toc" headings={headings} />`. |
44
+ | `subheader` | Replaces the default `<DocsSubHeader>`; use it to mount your own sub-header (for example with `SearchAdvanced`). |
45
+ | `head` | Extra `<head>` entries injected after platform defaults. |
46
+
47
+ ## What the layout brings in
48
+
49
+ - `styles/theme.scss` (the package's global stylesheet) and the JetBrains Mono
50
+ variable font from `@fontsource-variable/jetbrains-mono`. You do not need to
51
+ import either yourself.
52
+ - `GlobalNavBar`, `DocsSubHeader`, `DocsBreadcrumb`, `LicenseIndicator`,
53
+ `CopyCode` and `GlobalFooter`.
54
+ - `<html data-theme="light|dark">`, restored from `localStorage` before paint.
55
+ - Astro's `<ClientRouter>` for view transitions.
56
+
57
+ ## Host requirements
58
+
59
+ - The two virtual modules below must resolve (stub them if you do not use the
60
+ integration).
61
+ - Components rendered inside the layout that read
62
+ `Astro.locals.platformContext` or `Astro.locals.envVars` (`ApiLink`,
63
+ `ApiRef`, `PlatformBlock`, `Sample`, `ThemingWidget`) need a middleware that
64
+ sets them — see [Quick start](../../../README.md#quick-start) step 3.
30
65
 
31
66
  ## Example
32
67
 
@@ -34,12 +69,12 @@ import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
34
69
 
35
70
  Pass all data directly as props. The `virtual:docs-template/site-meta` module
36
71
  still needs to be resolvable at Vite build time — supply a minimal stub (see
37
- [playground/astro.config.mjs](../../../playground/astro.config.mjs)).
72
+ [Quick start](../../../README.md#quick-start) step 2).
38
73
 
39
74
  ```astro
40
75
  ---
41
76
  import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
42
- import DocsSidebar from 'igniteui-astro-components/components/sidebar/DocsSidebar.astro';
77
+ import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
43
78
  import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
44
79
  import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
45
80
  import type { MarkdownHeading } from 'astro';
@@ -55,7 +90,7 @@ const sidebar: SidebarEntry[] = [
55
90
 
56
91
  <DocsLayout title="Toast" siteTitle="My Library" hasSidebar currentSlug={slug}>
57
92
  <DocsSidebar slot="sidebar" items={sidebar} currentSlug={slug} />
58
- <DocsToc slot="toc" headings={headings} offsetTarget=".docs-subheader" />
93
+ <DocsToc slot="toc" headings={headings} />
59
94
  <slot />
60
95
  </DocsLayout>
61
96
  ```
@@ -67,7 +102,7 @@ Omit the `toc` slot entirely — the TOC sidebar collapses automatically via CSS
67
102
  ```astro
68
103
  ---
69
104
  import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
70
- import DocsSidebar from 'igniteui-astro-components/components/sidebar/DocsSidebar.astro';
105
+ import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
71
106
 
72
107
  const slug = Astro.params.slug ?? '';
73
108
  ---
@@ -86,7 +121,7 @@ can be omitted — it is read from the virtual module automatically.
86
121
  ```astro
87
122
  ---
88
123
  import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
89
- import DocsSidebar from 'igniteui-astro-components/components/sidebar/DocsSidebar.astro';
124
+ import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
90
125
  import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
91
126
 
92
127
  const { headings } = Astro.props;
@@ -95,7 +130,7 @@ const slug = Astro.params.slug ?? '';
95
130
 
96
131
  <DocsLayout title="Toast" description="Toast component documentation" hasSidebar currentSlug={slug}>
97
132
  <DocsSidebar slot="sidebar" currentSlug={slug} />
98
- <DocsToc slot="toc" headings={headings} offsetTarget=".docs-subheader" />
133
+ <DocsToc slot="toc" headings={headings} />
99
134
  <slot />
100
135
  </DocsLayout>
101
136
  ```
@@ -119,12 +154,12 @@ with `data-igd-footer`, persisted across navigations. See
119
154
 
120
155
  ## Virtual module dependencies
121
156
 
122
- `DocsLayout` imports from two virtual modules. When using `siteMetaIntegration`
123
- they are provided automatically. When not, supply minimal stubs via a Vite
124
- plugin (see [playground/astro.config.mjs](../../../playground/astro.config.mjs)
125
- for a reference implementation):
157
+ `DocsLayout` imports from two virtual modules. Supply them with a Vite plugin
158
+ (see [Quick start](../../../README.md#quick-start) step 2; `siteMetaIntegration`
159
+ does not emit `packages` and `selectedPackage`, so it cannot provide them
160
+ today):
126
161
 
127
- | Module | Used for | Can be overridden by prop |
128
- | --------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
129
- | `virtual:docs-template/site-meta` | Site title, sidebar tree, product links, extra `<head>` entries | `siteTitle` on `DocsLayout`, `items` on `DocsSidebar`, `productLinks`/`sidebarItems` on `DocsSubHeader` |
130
- | `virtual:docs-template/nav-html` | Pre-fetched nav/footer HTML, widget script URL, platform key | — (not yet prop-overridable) |
162
+ | Module | Used for | Can be overridden by prop |
163
+ | --------------------------------- | ------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
164
+ | `virtual:docs-template/site-meta` | `title`, `sidebar`, `productLinks`, `headEntries`, `trailingSlash`, `navLang`, `packages`, `selectedPackage` | `siteTitle` on `DocsLayout`, `items`/`trailingSlash` on `DocsSidebar`, `packages`/`selectedPackage` on `DocsSubHeader` |
165
+ | `virtual:docs-template/nav-html` | Pre-fetched nav/footer HTML, widget script URL, platform key | — (not yet prop-overridable) |
@@ -0,0 +1,8 @@
1
+ const warned = new Set<string>();
2
+
3
+ /** Logs each build warning message once per process. */
4
+ export function warnOnce(message: string): void {
5
+ if (warned.has(message)) return;
6
+ warned.add(message);
7
+ console.warn(message);
8
+ }
@@ -0,0 +1,35 @@
1
+ /** Visually hidden live region that announces the copy-code result to screen readers. */
2
+ const REGION_CLASS = 'igd-copy-status';
3
+
4
+ // Visually hidden styles, set inline.
5
+ const HIDDEN_STYLE =
6
+ 'position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap';
7
+
8
+ function getRegion(host: HTMLElement): HTMLElement {
9
+ let region = host.querySelector<HTMLElement>(`:scope > .${REGION_CLASS}`);
10
+ if (!region) {
11
+ region = document.createElement('span');
12
+ region.className = REGION_CLASS;
13
+ region.setAttribute('role', 'status');
14
+ region.setAttribute('aria-live', 'polite');
15
+ region.style.cssText = HIDDEN_STYLE;
16
+ host.appendChild(region);
17
+ }
18
+ return region;
19
+ }
20
+
21
+ /** Announces `message` from the live region inside `host`. */
22
+ export function announceCopyStatus(host: HTMLElement, message: string): void {
23
+ const region = getRegion(host);
24
+ region.textContent = '';
25
+ // Sets the text on the next frame so a repeated message is announced again.
26
+ requestAnimationFrame(() => {
27
+ region.textContent = message;
28
+ });
29
+ }
30
+
31
+ /** Clears the live region inside `host`. */
32
+ export function clearCopyStatus(host: HTMLElement): void {
33
+ const region = host.querySelector<HTMLElement>(`:scope > .${REGION_CLASS}`);
34
+ if (region) region.textContent = '';
35
+ }
@@ -25,6 +25,7 @@ export const BRAND_ICONS = new Set([
25
25
  'react-logo',
26
26
  'wc-logo',
27
27
  'github-logo',
28
+ 'figma-logo',
28
29
  'chatgpt',
29
30
  'claude',
30
31
  ]);