igniteui-astro-components 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) 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/README.md +58 -30
  12. package/src/components/DocsSidebar/SidebarLabel.astro +34 -36
  13. package/src/components/DocsSubHeader/README.md +24 -31
  14. package/src/components/DocsToc/DocsToc.astro +12 -14
  15. package/src/components/DocsToc/README.md +7 -7
  16. package/src/components/DocsTree/DocsTree.astro +9 -11
  17. package/src/components/DocsTree/DocsTreeItem.astro +36 -40
  18. package/src/components/DocsTree/README.md +12 -9
  19. package/src/components/GlobalFooter/GlobalFooter.astro +6 -8
  20. package/src/components/GlobalNavBar/GlobalNavBar.astro +2 -4
  21. package/src/components/LicenseIndicator/LicenseIndicator.astro +6 -8
  22. package/src/components/MobileTocToggle/MobileTocToggle.astro +31 -33
  23. package/src/components/MobileTocToggle/README.md +45 -0
  24. package/src/components/Search/README.md +10 -10
  25. package/src/components/Search/Search.astro +12 -6
  26. package/src/components/SearchAdvanced/README.md +15 -8
  27. package/src/components/SearchAdvanced/SearchAdvanced.astro +17 -15
  28. package/src/components/ThemingWidget/ThemingWidget.astro +62 -60
  29. package/src/components/mdx/Anatomy/Anatomy.scss +1 -1
  30. package/src/components/mdx/Anatomy/README.md +40 -0
  31. package/src/components/mdx/ApiLink/ApiLink.astro +7 -9
  32. package/src/components/mdx/ApiLink/README.md +1 -0
  33. package/src/components/mdx/ApiRef/ApiRef.astro +7 -9
  34. package/src/components/mdx/ApiRef/README.md +1 -1
  35. package/src/components/mdx/Badge/Badge.astro +3 -1
  36. package/src/components/mdx/Badge/README.md +1 -3
  37. package/src/components/mdx/DocsAside/DocsAside.astro +3 -5
  38. package/src/components/mdx/DocsAside/README.md +47 -29
  39. package/src/components/mdx/Faq/Faq.astro +11 -13
  40. package/src/components/mdx/Faq/FaqItem.astro +20 -26
  41. package/src/components/mdx/FigmaUiKits/FigmaUiKits.astro +126 -0
  42. package/src/components/mdx/FigmaUiKits/FigmaUiKits.scss +165 -0
  43. package/src/components/mdx/FigmaUiKits/README.md +115 -0
  44. package/src/components/mdx/FigmaUiKits/kits.ts +26 -0
  45. package/src/components/mdx/PlatformBlock/README.md +5 -18
  46. package/src/components/mdx/Sample/README.md +67 -50
  47. package/src/components/mdx/Sample/Sample.astro +108 -33
  48. package/src/components/mdx/Sample/Sample.scss +38 -17
  49. package/src/integration.ts +6 -21
  50. package/src/layouts/DocsLayout/README.md +63 -28
  51. package/src/lib/warn-once.ts +8 -0
  52. package/src/scripts/copy-status.ts +35 -0
  53. package/src/scripts/icon-manifest.ts +1 -0
  54. package/src/scripts/sample-widget.ts +109 -42
  55. package/src/styles/global/_code-blocks.scss +58 -36
  56. package/src/styles/global/_copy-button.scss +18 -25
  57. package/src/styles/global/_markdown.scss +15 -8
  58. package/src/styles/global/_variables.scss +57 -0
  59. package/src/styles/theme.scss +4 -1
  60. package/src/virtual-modules.d.ts +1 -1
@@ -10,25 +10,51 @@ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
10
10
 
11
11
  ## Props
12
12
 
13
- | Prop | Type | Default | Description |
14
- | ----------------- | -------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
15
- | `src` | `string` | _(required)_ | Sample path relative to the demos base URL, e.g. `"/charts/data-chart/axis-crossing"`. |
16
- | `height` | `number` | `150` (`50` if `fitContent`) | iframe height in pixels. With `fitContent` it is only the loading placeholder / cross-origin fallback. |
17
- | `alt` | `string` | `''` | `title` attribute for the iframe (accessibility). |
18
- | `lob` | `boolean` | `false` | Use `lobDemosBaseUrl` instead of `demosBaseUrl` (LOB/grid-dynamic demos). |
19
- | `dv` | `boolean` | `false` | Force use of `dvDemosBaseUrl` (data-viz demos). Auto-detected for paths starting with `charts/`, `gauges/`, `maps/`, `excel/`. |
20
- | `crm` | `boolean` | `false` | Use `crmDemoBaseUrl` (CRM demo samples). |
21
- | `wc` | `boolean` | `false` | Load the sample from the Web Components samples browser (`wcDemosBaseUrl`) on every platform's docs, for demos the platforms share. Falls back to `demosBaseUrl`. Code tabs and live editing follow it. |
22
- | `iframeOnly` | `boolean` | `false` | Render only the iframe — no navbar, no code tabs, no live-edit footer. |
23
- | `fullscreenBtn` | `boolean` | `false` | When `iframeOnly={true}`, also renders a "View in full screen" button below the iframe. |
24
- | `hideCode` | `boolean` | `false` | Keep the widget's frame but drop its code viewer: no tabs header, no code fetch, no live-edit or full-screen buttons. The footer carries only the theme picker (`showThemePicker`); without it there is no footer. For demos whose code is not a usage example, e.g. ones that fake interaction states. |
25
- | `fitContent` | `boolean` | `false` | Size the iframe to fit its content — the embedded page dictates the size. Same-origin demos are measured directly; cross-origin demos must report via `postMessage`. Demos with ink overflow (shadows, glows, focus rings) must reserve room for it in their own layout, since an iframe clips at its edge. |
26
- | `spacing` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'none'` | Padding around the iframe inside the container: `none` = 0, `sm` = 8px, `md` = 16px, `lg` = 32px. Applied by the host container, never inside the embedded page. |
27
- | `position` | `string` | — | Where the iframe sits inside the container when it doesn't fill it. Accepts a horizontal token (`start`, `center`, `end`) and/or a vertical token (`top`, `center`, `bottom`), space-separated in any order — e.g. `"center"`, `"start top"`, `"end bottom"`. |
28
- | `resizable` | `boolean` | `false` | Show a drag handle on the right edge that resizes the iframe's width so responsive demos can be previewed at different widths. Left/right arrow keys resize it when focused. Combines with `fitContent`: the drag owns the width, the content keeps dictating the height. |
29
- | `noBorder` | `boolean` | `true` | Drop the 1px border drawn around the iframe/container. Pass `noBorder={false}` to draw it — recommended whenever chrome (code tabs or `fullscreenBtn`) is visible. |
30
- | `noBackground` | `boolean` | `true` | Hide the grid-pattern backdrop drawn behind the iframe, keeping the container fully transparent. Pass `noBackground={false}` to show it. |
31
- | `whiteBackground` | `boolean` | `false` | Paint the backdrop behind the iframe pure white (`#fff`) instead of the default light gray. Only the light side changes — dark mode (the site's, or the in-sample theming widget's) is left as is. Implies a painted background, so it also overrides the transparency `noBackground` leaves behind in light mode. |
13
+ | Prop | Type | Default | Description |
14
+ | ----------------- | -------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
15
+ | `src` | `string` | _(required)_ | Sample path relative to the demos base URL, e.g. `"/charts/data-chart/axis-crossing"`. |
16
+ | `height` | `number` | `150` (`50` if `fitContent`) | iframe height in pixels. With `fitContent` it is only the loading placeholder / cross-origin fallback. |
17
+ | `alt` | `string` | `''` | `title` attribute for the iframe (accessibility). |
18
+ | `lob` | `boolean` | `false` | Use `lobDemosBaseUrl` instead of `demosBaseUrl` (LOB/grid-dynamic demos). |
19
+ | `dv` | `boolean` | `false` | Force use of `dvDemosBaseUrl` (data-viz demos). Auto-detected for paths starting with `charts/`, `gauges/`, `maps/`, `excel/`. |
20
+ | `crm` | `boolean` | `false` | Use `crmDemoBaseUrl` (CRM demo samples). |
21
+ | `wc` | `boolean` | `false` | Load the sample from the Web Components samples browser (`wcDemosBaseUrl`) on every platform's docs, for demos the platforms share. Falls back to `demosBaseUrl`. Code tabs and live editing follow it. |
22
+ | `chrome` | `'widget' \| 'demo' \| 'bare'` | `'widget'` | What the widget draws around the demo. `widget`: the EXAMPLE and code tabs, and a footer with the live-edit and full-screen buttons. `demo`: the widget's frame without the tabs and the code viewer; the footer carries only the theme picker, and without one there is no footer. For demos whose code is not a usage example, e.g. ones that fake interaction states. `bare`: only the iframe, in a plain container. See [Chrome](#chrome). |
23
+ | `showThemePicker` | `boolean` | `false` | Add the in-sample theme picker to the footer. Its initial theme comes from the site, not from the usage. `widget` and `demo` only: `bare` has no footer to put it in. |
24
+ | `fullscreenBtn` | `boolean` | `false` | Render a "View in full screen" button below the iframe. `bare` only: the `widget` footer already has one, and `demo` leaves full screen out on purpose. |
25
+ | `fitContent` | `boolean` | `false` | Size the iframe to fit its content — the embedded page dictates the size. Same-origin demos are measured directly; cross-origin demos must report via `postMessage`. Demos with ink overflow (shadows, glows, focus rings) must reserve room for it in their own layout, since an iframe clips at its edge. |
26
+ | `spacing` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'none'` | Padding around the iframe inside the container: `none` = 0, `sm` = 8px, `md` = 16px, `lg` = 32px. Applied by the host container, never inside the embedded page. |
27
+ | `position` | `string` | — | Where the iframe sits inside the container when it doesn't fill it. Accepts a horizontal token (`start`, `center`, `end`) and/or a vertical token (`top`, `center`, `bottom`), space-separated in any order — e.g. `"center"`, `"start top"`, `"end bottom"`. |
28
+ | `resizable` | `boolean` | `false` | Show a drag handle on the right edge that resizes the iframe's width so responsive demos can be previewed at different widths. Left/right arrow keys resize it when focused. Combines with `fitContent`: the drag owns the width, the content keeps dictating the height. |
29
+ | `noBorder` | `boolean` | `true` | Drop the 1px border drawn around the iframe/container. Pass `noBorder={false}` to draw it — recommended whenever the tabs, the footer or the `fullscreenBtn` bar render. |
30
+ | `noBackground` | `boolean` | `true` (`false` with a theme picker) | Hide the grid-pattern backdrop drawn behind the iframe, keeping the container fully transparent. Pass `noBackground={false}` to show it. Defaults to `false` when a theme picker renders (`showThemePicker` with `widget` or `demo`), so a demo whose theme and mode the reader can switch has a surface of its own. An explicit value always wins. |
31
+ | `whiteBackground` | `boolean` | `false` | Paint the backdrop behind the iframe pure white (`#fff`) instead of the default light gray. Only the light side changes — dark mode (the site's, or the in-sample theming widget's) is left as is. Implies a painted background, so it also overrides the transparency `noBackground` leaves behind in light mode. |
32
+ | `iframeOnly` | `boolean` | `false` | **Deprecated**, removed in 2.0.0. Use `chrome="bare"`. See [Deprecated props](#deprecated-props). |
33
+ | `hideCode` | `boolean` | `false` | **Deprecated**, removed in 2.0.0. Use `chrome="demo"`. See [Deprecated props](#deprecated-props). |
34
+
35
+ ## Chrome
36
+
37
+ `chrome` picks what surrounds the demo, and `showThemePicker` and `fullscreenBtn` add to it where they apply:
38
+
39
+ | `chrome` | Tabs and code | Footer | `showThemePicker` | `fullscreenBtn` |
40
+ | -------------------- | ------------- | -------------------------------------- | ----------------- | --------------- |
41
+ | `widget` _(default)_ | Yes | Live-edit and full-screen buttons | Yes | No |
42
+ | `demo` | No | Only the theme picker, if there is one | Yes | No |
43
+ | `bare` | No | None | No | Yes |
44
+
45
+ A modifier the chrome ignores, or a `chrome` value that is not one of the three, logs a build warning. The types only reject an unknown `chrome` value: they accept every modifier with every chrome, as MDX, where most samples live, is not type-checked anyway.
46
+
47
+ ### Deprecated props
48
+
49
+ `iframeOnly` and `hideCode`, the 1.x spellings of `chrome="bare"` and `chrome="demo"`, still work, but they are deprecated and 2.0.0 removes them. Editors strike them through, and each sample that uses one logs a build warning, once per build, that names the replacement:
50
+
51
+ | Deprecated | Use instead |
52
+ | -------------------------- | ----------------------------- |
53
+ | `iframeOnly` | `chrome="bare"` |
54
+ | `iframeOnly fullscreenBtn` | `chrome="bare" fullscreenBtn` |
55
+ | `hideCode` | `chrome="demo"` |
56
+
57
+ As in 1.x, `iframeOnly` wins over `hideCode`. A valid `chrome` wins over both, and the warning says the deprecated prop is ignored. A `chrome` that is not one of the three is ignored itself, so the deprecated prop still applies.
32
58
 
33
59
  ## Examples
34
60
 
@@ -47,32 +73,33 @@ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
47
73
 
48
74
  {/* Web Components sample shared by every platform's docs */}
49
75
 
50
- <Sample src="/themes/palettes/scales" wc fitContent iframeOnly />
76
+ <Sample src="/themes/palettes/scales" wc fitContent chrome="bare" />
51
77
 
52
78
  {/* Bare iframe for embedding */}
53
79
 
54
- <Sample src="/charts/bar-chart/overview" iframeOnly height={300} />
80
+ <Sample src="/charts/bar-chart/overview" chrome="bare" height={300} />
55
81
 
56
82
  {/* Bare iframe + fullscreen link */}
57
83
 
58
- <Sample src="/charts/bar-chart/overview" iframeOnly fullscreenBtn height={300} />
84
+ <Sample src="/charts/bar-chart/overview" chrome="bare" fullscreenBtn height={300} />
59
85
 
60
86
  {/* Demo only, with the theme picker: no code tabs or live-edit buttons */}
61
87
 
62
- <Sample src="/inputs/radio/interaction-state" hideCode showThemePicker height={400} />
88
+ <Sample src="/inputs/radio/interaction-state" chrome="demo" showThemePicker height={400} />
63
89
  ```
64
90
 
65
91
  ## Environment configuration
66
92
 
67
- The base URLs are resolved from `environment.json` at build time via `siteMetaIntegration` and exposed through `getPlatformContext().getEnvVars()`:
93
+ The base URLs are read from `Astro.locals.envVars`, a plain `Record<string, string>` that the host site's middleware must set (the docs sites load it from their `environment.json`; the root README's Quick start step 3 shows a minimal version). The platform (`Astro.locals.platformContext`) comes from the same middleware:
68
94
 
69
- | Key | Used by |
70
- | ----------------- | ------------------------------ |
71
- | `demosBaseUrl` | Default demos |
72
- | `dvDemosBaseUrl` | Charts / gauges / maps / excel |
73
- | `lobDemosBaseUrl` | LOB / grids |
74
- | `crmDemoBaseUrl` | CRM demos |
75
- | `wcDemosBaseUrl` | `wc` samples, on any platform |
95
+ | Key | Used by |
96
+ | -------------------- | ------------------------------------------------------------------------------------ |
97
+ | `demosBaseUrl` | Default demos |
98
+ | `dvDemosBaseUrl` | Charts / gauges / maps / excel |
99
+ | `lobDemosBaseUrl` | LOB / grids |
100
+ | `crmDemoBaseUrl` | CRM demos |
101
+ | `wcDemosBaseUrl` | `wc` samples, on any platform |
102
+ | `defaultSampleTheme` | Starting theme of the code tabs and theme picker; falls back to the platform default |
76
103
 
77
104
  Outside the Web Components site, a `wc` sample needs `wcDemosBaseUrl`: without it the sample falls back to `demosBaseUrl`, the page's own platform browser, and the build logs a warning. Leave unused keys out rather than setting them to `""`: an empty string doesn't fall back, it produces a relative URL.
78
105
 
@@ -80,26 +107,16 @@ Outside the Web Components site, a `wc` sample needs `wcDemosBaseUrl`: without i
80
107
 
81
108
  Code tabs are syntax-highlighted client-side using [Shiki](https://shiki.style/) (lazy-loaded via dynamic import and pre-warmed at widget init). Supported languages: `typescript`, `tsx`, `javascript`, `html`, `css`, `scss`, `csharp`, `razor`.
82
109
 
83
- The theme defaults to `dark-plus` and can be overridden per project via a Vite define in `astro.config.mjs`:
84
-
85
- ```js
86
- // astro.config.mjs
87
- export default defineConfig({
88
- vite: {
89
- define: {
90
- __IGD_SAMPLE_CODE_THEME__: JSON.stringify('github-dark'),
91
- },
92
- },
93
- });
94
- ```
95
-
96
- Any [Shiki bundled theme](https://shiki.style/themes) name is accepted. If the define is absent the default `dark-plus` is used.
110
+ The tabs use the package's brand code theme (`igCodeTheme`, the same one `createDocsSite()` applies to fenced blocks), so a code tab and a fenced block look identical. See [`src/code-theme/README.md`](../../../code-theme/README.md).
97
111
 
98
- > **Note:** highlight.js is no longer required. Remove any hljs `<script>` / `<link>` head entries from your integration config if they were added solely for code tabs.
112
+ ## Registering in MDX
99
113
 
100
- ## MDX global registration
114
+ Nothing is registered automatically. Either import the component at the top of
115
+ each MDX file (the convention in the docs repos):
101
116
 
102
- ```ts
103
- // src/mdx-components.ts
104
- export { default as Sample } from 'igniteui-astro-components/components/mdx/Sample.astro';
117
+ ```mdx
118
+ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
105
119
  ```
120
+
121
+ or pass it through the `components` map of a `<Content />` render when the MDX
122
+ is authored without imports (CMS content, for example).
@@ -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)] : []),