igniteui-astro-components 1.5.1 → 1.7.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.
@@ -0,0 +1,134 @@
1
+ # DoDont
2
+
3
+ Renders a side-by-side "Do" / "Don't" pair of component screenshots. Each panel is a framed image with a status badge pinned to its top-inline corner — a green check for the recommended usage, a red clear for the one to avoid — and a required description below it that says why.
4
+
5
+ The frame supplies the padding around each screenshot, so the source images stay bare crops with no baked-in margin, and it centers anything smaller than its content box rather than blowing it up to fill. Panels share a subgrid, so every frame is as tall as the tallest screenshot in the row and the captions start on a common baseline.
6
+
7
+ The block is always 100% of its container and stacks into one column as soon as a panel would fall below `--igd-dodont-min-panel-width`, so it responds to the space it is given rather than to the viewport.
8
+
9
+ ## Import
10
+
11
+ ```astro
12
+ import DoDont from 'igniteui-astro-components/components/mdx/DoDont.astro';
13
+ ```
14
+
15
+ ## Props
16
+
17
+ | Prop | Type | Default | Description |
18
+ | ----------- | ------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
19
+ | `doSrc` | `ImageMetadata \| string` | _(required)_ | The recommended-usage image. An `astro:assets` import or a URL. |
20
+ | `doAlt` | `string` | _(required)_ | The recommended-usage image's accessible description. Becomes the inner `<img>` `alt`. |
21
+ | `dontSrc` | `ImageMetadata \| string` | _(required)_ | The usage-to-avoid image. An `astro:assets` import or a URL. |
22
+ | `dontAlt` | `string` | _(required)_ | The usage-to-avoid image's accessible description. Becomes the inner `<img>` `alt`. |
23
+ | `doLabel` | `string` | `'Do'` | Label for the recommended panel. Localized by default — see [Localization](#localization). |
24
+ | `dontLabel` | `string` | `"Don't"` | Label for the panel to avoid. Localized by default. |
25
+ | `loading` | `'lazy' \| 'eager'` | `'lazy'` | Image loading strategy. Use `'eager'` when the block is the first content on the page. |
26
+ | `errorText` | `string` | _(localized)_ | Notice shown with a broken-image icon inside a frame whose image failed to load. Hidden from assistive tech, which still gets the image's `alt`. |
27
+ | `class` | `string` | — | Extra CSS classes forwarded to the container. |
28
+
29
+ ### Imports vs. URLs
30
+
31
+ Pass an `astro:assets` import whenever you can. An import is rendered through Astro's `<Image>`, which converts the format (WebP by default), emits a `srcset` with 1x/2x/3x candidates clamped to the source size, and writes the intrinsic `width`/`height` so the frame holds its final size before the file arrives.
32
+
33
+ A plain URL string is rendered as a bare `<img>`. Astro cannot inspect a URL at build time, so it gets no `srcset` and **no dimensions**, and the frame grows when the image loads — a layout shift. Reserve URLs for assets that genuinely live outside the build.
34
+
35
+ ### Loading
36
+
37
+ The default `loading="lazy"` is right for a block somewhere down a topic. If the block is the first thing on the page, pass `loading="eager"`: a lazy image above the fold delays the largest contentful paint. Eager images are also fetched with `fetchpriority="high"`.
38
+
39
+ While an image is pending, a soft shimmer sweeps the frame's canvas. A small client script marks a frame whose image has not loaded and clears the mark on load or error; without JavaScript nothing is marked and the frame is simply static. The animation is disabled under `prefers-reduced-motion`.
40
+
41
+ If an image fails to load, the frame gets `data-error` and shows a broken-image icon with a short notice ("Sorry, this image could not be loaded.", localized like the labels, or your own `errorText`). The notice is `aria-hidden` — it only explains the empty box to a sighted reader, and the `<img>` keeps exposing its `alt` to assistive tech. The label and description are unaffected. A URL cannot be checked at build time, which is one more reason to prefer an `astro:assets` import: a missing imported file fails the build instead of the page.
42
+
43
+ The image props are `doSrc` / `dontSrc` rather than `do` / `dont` because Astro merges named slots into props ([`jsx-runtime`](https://github.com/withastro/astro) does `Object.assign(vnode.props, slots)`), so a prop sharing a slot's name is silently overwritten by that slot.
44
+
45
+ ## Slots
46
+
47
+ | Slot | Description |
48
+ | ------ | ------------------------------------------------------------- |
49
+ | `do` | **Required.** Why the recommended panel is the one to follow. |
50
+ | `dont` | **Required.** Why the other panel is the one to avoid. |
51
+
52
+ Both slots are validated at build time — a missing, empty or whitespace-only slot throws, exactly like a missing `alt`. A screenshot is never self-explanatory: the slot text is what search engines index, translators translate and screen readers read, and it is the only place the _reason_ for the guidance lives.
53
+
54
+ ## Examples
55
+
56
+ ```mdx
57
+ {/* Blank lines inside each Fragment so the content parses as markdown */}
58
+
59
+ <DoDont
60
+ doSrc={virtualScrollDo}
61
+ doAlt="Virtual Scroll showing a list of 100,000 employees"
62
+ dontSrc={virtualScrollDoNot}
63
+ dontAlt="Virtual Scroll used for a list of only five employees"
64
+ >
65
+ <Fragment slot="do">
66
+
67
+ Use the Virtual Scroll for a long list that is too large to render at once.
68
+
69
+ </Fragment>
70
+ <Fragment slot="dont">
71
+
72
+ Render a short list directly with the [List](../list.mdx).
73
+
74
+ </Fragment>
75
+ </DoDont>
76
+
77
+ {/* Custom labels */}
78
+
79
+ <DoDont doSrc={good} doAlt="…" dontSrc={bad} dontAlt="…" doLabel="Recommended" dontLabel="Avoid">
80
+ <Fragment slot="do">…</Fragment>
81
+ <Fragment slot="dont">…</Fragment>
82
+ </DoDont>
83
+ ```
84
+
85
+ ## Localization
86
+
87
+ The default labels follow the site language, so a Japanese topic does not ship with English "Do" / "Don't" baked in:
88
+
89
+ | Language | `doLabel` | `dontLabel` |
90
+ | -------------- | --------- | ----------- |
91
+ | `en` (default) | Do | Don't |
92
+ | `jp` / `ja` | 推奨 | 非推奨 |
93
+ | `kr` / `ko` | 권장 | 비권장 |
94
+
95
+ The broken-image notice (`errorText`) is localized the same way.
96
+
97
+ The language is the docs integration's `navLang`, read from `virtual:docs-template/site-meta` — the same value `DocsLayout` passes to the nav bar and footer — then `Astro.currentLocale`, then English. Pass `doLabel` / `dontLabel` to override on any page.
98
+
99
+ ## Accessibility
100
+
101
+ `doAlt` and `dontAlt` are required and are validated at build time — an absent, empty or whitespace-only value throws. Describe what each screenshot shows rather than merely naming the component. The `do` / `dont` slots are required for the same reason: the alt says what the picture shows, the slot says why it is right or wrong, and a reader who cannot see the image needs both.
102
+
103
+ Each panel is a `<figure>` whose `<figcaption>` holds the label and description, so assistive tech announces the panel as, e.g., "figure, Do: Use the Virtual Scroll for a long list…" and then the image's `alt`. The colon is a visually hidden separator; without it the label and description read as one run-on phrase.
104
+
105
+ The badges are decorative: the labels already name each panel, so the badges are `aria-hidden` and add no duplicate announcement. That also means the block does not rely on color alone.
106
+
107
+ The label colors meet WCAG AA for normal-size text in both themes. The "Don't" accent is `--ig-error-800` in the light theme rather than the design's `--ig-error-700`, which measures 4.1:1 on white and fails the 4.5:1 minimum. In forced-colors mode the frame keeps an outline, since box-shadow is dropped there.
108
+
109
+ ## Styling
110
+
111
+ The component reads these tokens but never sets them — its defaults are fallbacks — so a value set on any ancestor, or on the block itself through `class`, reaches every element that uses it. `--igd-dodont-accent` and `--igd-dodont-frame-accent` default per panel: set on the block they recolor both panels, set on `.igd-dodont__panel--do` or `.igd-dodont__panel--dont` just one.
112
+
113
+ | Property | Purpose |
114
+ | ------------------------------ | ------------------------------------------------------------------------ |
115
+ | `--igd-dodont-gap` | Gap between the panels and between a frame and its caption |
116
+ | `--igd-dodont-min-panel-width` | Width below which the panels stack into one column |
117
+ | `--igd-dodont-padding-block` | Space above and below a screenshot (the design leaves 86px) |
118
+ | `--igd-dodont-padding-inline` | Minimum space either side of a screenshot (20px) |
119
+ | `--igd-dodont-image-width` | Width the screenshots are laid out at (the design default is 360px) |
120
+ | `--igd-dodont-radius` | Corner radius of the image frame |
121
+ | `--igd-dodont-badge-size` | Size of the pinned badge |
122
+ | `--igd-dodont-badge-inset` | Distance of the badge from the frame's top and inline-start edges (30px) |
123
+ | `--igd-dodont-caption-gap` | Space between a label and its description (16px) |
124
+ | `--igd-dodont-stack-extra` | Added between panels when they stack, so the 26px gap becomes 46px |
125
+ | `--igd-dodont-bg` | Frame canvas, drawn by an `::after` at 0.7 opacity behind the content |
126
+ | `--igd-dodont-border-width` | Frame border (1px) |
127
+ | `--igd-dodont-accent-width` | Top accent border (2px), colored like the panel's badge |
128
+ | `--igd-dodont-frame-accent` | Top accent color — `success-500` on Do, `error-500` on Don't |
129
+ | `--igd-dodont-border-color` | Frame border color |
130
+ | `--igd-dodont-accent` | Label color — success tokens on the Do panel, error tokens on Don't |
131
+
132
+ The stylesheet is deliberately **unlayered**. `.igd-main-content__markdown img` and `figure` live in `@layer components` and set a block margin and a corner radius on every image; unlayered rules beat all layers, so the panel's own `margin: 0` and the frame-owned radius win.
133
+
134
+ Images are drawn at full opacity. The frame canvas is an `::after` pseudo-element (`gray-100` in the light theme, `surface-500` in the dark) at 0.7 opacity behind the content, inside a `gray-300` border whose top edge is a 2px accent in the panel's badge color. The borders are subtracted from the padding and badge inset, so the spec distances are measured from the frame's outer edge.
@@ -10,10 +10,13 @@ import LicenseIndicator from '../../components/LicenseIndicator/LicenseIndicator
10
10
  import igLogoRaw from '../../assets/ig-logo.svg?raw';
11
11
  import CopyCode from '../../components/CopyCode/CopyCode.astro';
12
12
  import { platform as virtualPlatform } from 'virtual:docs-template/nav-html';
13
+ import { ULTIMATE_UI_PLATFORMS } from '../../platform';
13
14
  import { title as siteTitle, headEntries, navLang } from 'virtual:docs-template/site-meta';
14
15
  import '../../styles/theme.scss';
15
16
  import './DocsLayout.scss';
16
17
 
18
+ const showIgniteUiPageLogo = !ULTIMATE_UI_PLATFORMS.has(virtualPlatform ?? '');
19
+
17
20
  export interface Props {
18
21
  title?: string;
19
22
  description?: string | null;
@@ -111,19 +114,12 @@ type HeadEntry = {
111
114
  {keywords && <meta name="keywords" content={keywords} />}
112
115
  <link rel="icon" href="/favicon.svg" type="image/svg+xml" />
113
116
  <link rel="stylesheet" href="https://use.typekit.net/bng2zgw.css" />
114
- {
115
- (headEntries as HeadEntry[]).map(({ tag: Tag, attrs = {}, content }) =>
116
- content ? <Tag {...attrs} set:html={content} /> : <Tag {...attrs} />,
117
- )
118
- }
119
- {
120
- chromeSnapshot && (
121
- <meta
122
- name="ig-chrome"
123
- content={`${chromeSnapshot.contract} build=${chromeSnapshot.build}`}
124
- />
125
- )
126
- }
117
+ {(headEntries as HeadEntry[]).map(({ tag: Tag, attrs = {}, content }) =>
118
+ content ? <Tag {...attrs} set:html={content} /> : <Tag {...attrs} />,
119
+ )}
120
+ {chromeSnapshot && (
121
+ <meta name="ig-chrome" content={`${chromeSnapshot.contract} build=${chromeSnapshot.build}`} />
122
+ )}
127
123
  {chromeSnapshot && <Fragment set:html={chromeSnapshot.head} />}
128
124
  <slot name="head" />
129
125
  <ClientRouter />
@@ -289,18 +285,16 @@ type HeadEntry = {
289
285
  </head>
290
286
  <body>
291
287
  <!-- INFRAGISTICS HEADER/NAVIGATION -->
292
- {
293
- showGlobalNav &&
294
- (chromeSnapshot ? (
295
- /* `.nv` is `position: sticky`, so the wrapper has to be sticky too, or the
288
+ {showGlobalNav &&
289
+ (chromeSnapshot ? (
290
+ /* `.nv` is `position: sticky`, so the wrapper has to be sticky too, or the
296
291
  nav would stop at the bottom of a wrapper exactly its own height. */
297
- <div transition:persist="global-nav-bar" style="position: sticky; top: 0; z-index: 50">
298
- <Fragment set:html={chromeSnapshot.header} />
299
- </div>
300
- ) : (
301
- <GlobalNavBar lang={navLang} />
302
- ))
303
- }
292
+ <div transition:persist="global-nav-bar" style="position: sticky; top: 0; z-index: 50">
293
+ <Fragment set:html={chromeSnapshot.header} />
294
+ </div>
295
+ ) : (
296
+ <GlobalNavBar lang={navLang} />
297
+ ))}
304
298
 
305
299
  <!-- MAIN PAGE GRID LAYOUT -->
306
300
  <!-- We don't set the CSS grid directly to the body -->
@@ -339,7 +333,7 @@ type HeadEntry = {
339
333
  <div class="igd-main-content__inner">
340
334
  <div class="igd-main-content__page">
341
335
  <main class="igd-main-content__markdown" data-pagefind-body>
342
- <Fragment set:html={igLogoRaw} />
336
+ {showIgniteUiPageLogo && <Fragment set:html={igLogoRaw} />}
343
337
  <LicenseIndicator license={licenseType} />
344
338
  <DocsBreadcrumb
345
339
  pageTitle={title}
@@ -358,18 +352,16 @@ type HeadEntry = {
358
352
 
359
353
  <!-- Footer is inside the grid so the sidebar's sticky containing block extends through it.
360
354
  The JS initSidebarHeights() clamps sidebar max-height to prevent visual overlap. -->
361
- {
362
- chromeSnapshot ? (
363
- /* Full width of the grid, found by initSidebarHeights() through
355
+ {chromeSnapshot ? (
356
+ /* Full width of the grid, found by initSidebarHeights() through
364
357
  data-igd-footer, and persisted across navigations: the exported
365
358
  script wires the footer's accordion once, on first load. */
366
- <div style="grid-column: 1 / -1" data-igd-footer transition:persist="global-footer">
367
- <Fragment set:html={chromeSnapshot.footer} />
368
- </div>
369
- ) : (
370
- <GlobalFooter lang={navLang} />
371
- )
372
- }
359
+ <div style="grid-column: 1 / -1" data-igd-footer transition:persist="global-footer">
360
+ <Fragment set:html={chromeSnapshot.footer} />
361
+ </div>
362
+ ) : (
363
+ <GlobalFooter lang={navLang} />
364
+ )}
373
365
  </div>
374
366
  </body>
375
367
  </html>
package/src/lib/types.ts CHANGED
@@ -1,4 +1,11 @@
1
- export type PlatformName = 'Angular' | 'React' | 'WebComponents' | 'Blazor';
1
+ export type PlatformName =
2
+ | 'Angular'
3
+ | 'React'
4
+ | 'WebComponents'
5
+ | 'Blazor'
6
+ /** XAML platforms. Share the WinUI control surface; see the docs host's NonWeb platform group. */
7
+ | 'WinUI'
8
+ | 'Uno';
2
9
 
3
10
  export interface ApiPackageConfig {
4
11
  /** TypeDoc documentation root URL (no trailing slash). */
@@ -0,0 +1,10 @@
1
+ import type { PlatformKey } from '../platform';
2
+
3
+ /**
4
+ * The XAML platforms, which ship under the Ultimate UI brand rather than Ignite UI and show
5
+ * their named source files (Sample.xaml, Sample.xaml.cs, ...) as code tabs.
6
+ *
7
+ * Kept apart from platform.ts so the client sample widget can import it without bundling the
8
+ * platform registry's head entries.
9
+ */
10
+ export const ULTIMATE_UI_PLATFORMS: ReadonlySet<string> = new Set<PlatformKey>(['winui', 'uno']);
package/src/llms.ts CHANGED
@@ -12,6 +12,7 @@
12
12
  import fs from 'node:fs';
13
13
  import path from 'node:path';
14
14
  import matter from 'gray-matter';
15
+ import { IGDOCS_PLATFORMS } from './platform';
15
16
 
16
17
  // ---------------------------------------------------------------------------
17
18
  // Public types
@@ -155,15 +156,15 @@ export const IGDOCS_BROAD_SECTIONS = [
155
156
  'Deprecated Components',
156
157
  ] as const;
157
158
 
158
- /** Platforms that use the Ignite UI doc broad sections. */
159
- const IGDOCS_PLATFORMS = new Set<string>(['angular', 'react', 'blazor', 'web-components']);
159
+ /** Platforms that use the Ignite UI doc broad sections: every platform IGDOCS_PLATFORMS lists. */
160
+ const IGDOCS_PLATFORM_KEYS = new Set<string>(Object.values(IGDOCS_PLATFORMS).map((p) => p.key));
160
161
 
161
162
  /**
162
163
  * Returns the set of broad-section labels for the given platform.
163
164
  * Returns an empty set for platforms with no defined broad sections (appbuilder, slingshot).
164
165
  */
165
166
  export function getBroadSectionsForPlatform(platform: string | null): ReadonlySet<string> {
166
- if (platform !== null && IGDOCS_PLATFORMS.has(platform)) {
167
+ if (platform !== null && IGDOCS_PLATFORM_KEYS.has(platform)) {
167
168
  return new Set(IGDOCS_BROAD_SECTIONS);
168
169
  }
169
170
  return new Set();
package/src/platform.ts CHANGED
@@ -25,7 +25,9 @@ export type HeadEntry = {
25
25
  };
26
26
 
27
27
  export type PlatformKey =
28
- 'angular' | 'react' | 'blazor' | 'web-components' | 'slingshot' | 'appbuilder';
28
+ 'angular' | 'react' | 'blazor' | 'web-components' | 'winui' | 'uno' | 'slingshot' | 'appbuilder';
29
+
30
+ export { ULTIMATE_UI_PLATFORMS } from './lib/ultimate-ui-platforms';
29
31
 
30
32
  /** Locale code for nav/API requests and UI string lookups. */
31
33
  export type NavLang = 'en' | 'jp' | 'kr';
@@ -73,7 +75,7 @@ const IG_LEGACY_CHROME_STYLES: HeadEntry[] = [
73
75
  ];
74
76
 
75
77
  // ---------------------------------------------------------------------------
76
- // Shared IG styles — used by: angular, react, blazor, web-components, slingshot
78
+ // Shared IG styles — used by: angular, react, blazor, web-components, winui, uno, slingshot
77
79
  // ---------------------------------------------------------------------------
78
80
  const IG_STYLES: HeadEntry[] = [
79
81
  // Bootstrap is wrapped in a CSS cascade layer so its global resets do not
@@ -111,7 +113,7 @@ const IG_STYLES: HeadEntry[] = [
111
113
  ];
112
114
 
113
115
  // ---------------------------------------------------------------------------
114
- // Shared IG scripts — used by: angular, react, blazor, web-components, slingshot
116
+ // Shared IG scripts — used by: angular, react, blazor, web-components, winui, uno, slingshot
115
117
  // All three belong to the legacy fetched chrome.
116
118
  // ---------------------------------------------------------------------------
117
119
  const IG_SCRIPTS: HeadEntry[] = [
@@ -297,6 +299,8 @@ export const PLATFORM_DEFS: Record<PlatformKey, PlatformDef> = {
297
299
  react: { navType: 'infragistics', styles: IG_STYLES, scripts: IG_SCRIPTS },
298
300
  blazor: { navType: 'infragistics', styles: IG_STYLES, scripts: IG_SCRIPTS },
299
301
  'web-components': { navType: 'infragistics', styles: IG_STYLES, scripts: IG_SCRIPTS },
302
+ winui: { navType: 'infragistics', styles: IG_STYLES, scripts: IG_SCRIPTS },
303
+ uno: { navType: 'infragistics', styles: IG_STYLES, scripts: IG_SCRIPTS },
300
304
  slingshot: { navType: 'infragistics', styles: IG_STYLES, scripts: IG_SCRIPTS },
301
305
  appbuilder: { navType: 'appbuilder', styles: APPBUILDER_STYLES, scripts: APPBUILDER_SCRIPTS },
302
306
  };
@@ -347,6 +351,25 @@ export const IGDOCS_PLATFORMS: Record<string, PlatformMeta> = {
347
351
  title: 'Ignite UI for Blazor',
348
352
  description: 'Component documentation for Ignite UI for Blazor.',
349
353
  },
354
+ // XAML platforms ship under the Ultimate UI brand, hence `ultimate-ui-*` URL slugs.
355
+ WinUI: {
356
+ lang: 'en',
357
+ label: 'WinUI',
358
+ key: 'winui',
359
+ devPort: 4335,
360
+ base: '/products/ultimate-ui-winui/winui/components',
361
+ title: 'Infragistics Ultimate UI for WinUI',
362
+ description: 'Component documentation for Infragistics Ultimate UI for WinUI.',
363
+ },
364
+ Uno: {
365
+ lang: 'en',
366
+ label: 'Uno Platform',
367
+ key: 'uno',
368
+ devPort: 4336,
369
+ base: '/products/ultimate-ui-uno-platform/uno-platform/components',
370
+ title: 'Infragistics Ultimate UI for Uno Platform',
371
+ description: 'Component documentation for Infragistics Ultimate UI for Uno Platform.',
372
+ },
350
373
  // Japanese
351
374
  AngularJP: {
352
375
  lang: 'jp',
@@ -384,6 +407,25 @@ export const IGDOCS_PLATFORMS: Record<string, PlatformMeta> = {
384
407
  title: 'Ignite UI for Blazor',
385
408
  description: 'Component documentation for Ignite UI for Blazor.',
386
409
  },
410
+ // XAML platforms ship under the Ultimate UI brand, hence `ultimate-ui-*` URL slugs.
411
+ WinUIJP: {
412
+ lang: 'jp',
413
+ label: 'WinUI',
414
+ key: 'winui',
415
+ devPort: 4345,
416
+ base: '/products/ultimate-ui-winui/winui/components',
417
+ title: 'Infragistics Ultimate UI for WinUI',
418
+ description: 'Component documentation for Infragistics Ultimate UI for WinUI.',
419
+ },
420
+ UnoJP: {
421
+ lang: 'jp',
422
+ label: 'Uno Platform',
423
+ key: 'uno',
424
+ devPort: 4346,
425
+ base: '/products/ultimate-ui-uno-platform/uno-platform/components',
426
+ title: 'Infragistics Ultimate UI for Uno Platform',
427
+ description: 'Component documentation for Infragistics Ultimate UI for Uno Platform.',
428
+ },
387
429
  };
388
430
 
389
431
  /**
@@ -402,6 +444,14 @@ export interface PlatformHeadOptions {
402
444
  legacyChrome?: boolean;
403
445
  }
404
446
 
447
+ /**
448
+ * The display label for a platform key ('winui' → 'WinUI'), from IGDOCS_PLATFORMS, or `null` for
449
+ * a platform it does not list.
450
+ */
451
+ export function platformLabelFor(platform: string | null | undefined): string | null {
452
+ return Object.values(IGDOCS_PLATFORMS).find((p) => p.key === platform)?.label ?? null;
453
+ }
454
+
405
455
  /**
406
456
  * Returns an array of head entries for the given platform.
407
457
  * Pass the result to `createDocsSite({ head: getPlatformHead(...) })`.
@@ -444,6 +494,8 @@ export function getNavConfig(platform: string | null, lang = 'en'): NavConfig {
444
494
  case 'react':
445
495
  case 'blazor':
446
496
  case 'web-components':
497
+ case 'uno':
498
+ case 'winui':
447
499
  case 'slingshot':
448
500
  return { navType: 'infragistics', navUrl: `${igBase}/navigation` };
449
501
  default:
@@ -25,6 +25,8 @@ const DOCCONFIG_PLATFORM_MAP: Record<string, string> = {
25
25
  react: 'React',
26
26
  'web-components': 'WebComponents',
27
27
  blazor: 'Blazor',
28
+ winui: 'WinUI',
29
+ uno: 'Uno',
28
30
  };
29
31
 
30
32
  // Lazy-loaded, cached per DOCS_SOURCE_PATH value.
@@ -31,7 +31,8 @@ defineComponents(
31
31
  );
32
32
 
33
33
  import './icon-registry';
34
- import type { Highlighter } from 'shiki';
34
+ import type { BundledLanguage, Highlighter } from 'shiki';
35
+ import { ULTIMATE_UI_PLATFORMS } from '../lib/ultimate-ui-platforms';
35
36
  import footerStackblitzIcon from '../components/mdx/Sample/assets/stackblitz.svg?raw';
36
37
  import footerOpenExternalIcon from '../components/mdx/Sample/assets/open-external.svg?raw';
37
38
 
@@ -47,14 +48,27 @@ const XPLAT_SAMPLES_ORDER: Record<string, string[]> = {
47
48
  react: ['tsx', 'ts', 'html', 'css'],
48
49
  wc: ['tsx', 'ts', 'html', 'css'],
49
50
  blazor: ['razor', 'cs', 'js', 'css'],
51
+ // XAML platforms: markup first, then code-behind. Samples are authored as
52
+ // Sample.xaml / Sample.xaml.cs plus optional data-model .cs files.
53
+ winui: ['xaml', 'cs'],
54
+ uno: ['xaml', 'cs'],
50
55
  };
51
56
 
52
57
  const XPLAT_CODE_BASE: Record<string, string> = {
53
58
  wc: '/assets/code-viewer/',
54
59
  react: '/code-viewer/',
55
60
  blazor: '/code-viewer/',
61
+ winui: '/code-viewer/',
62
+ uno: '/code-viewer/',
56
63
  };
57
64
 
65
+ /**
66
+ * Platforms whose samples cannot be handed off to StackBlitz / CodeSandbox —
67
+ * they are compiled .NET apps, and their sources are not published in an
68
+ * `igniteui-<platform>-examples` repo. Gates the "open in" footer only.
69
+ */
70
+ const SANDBOX_UNSUPPORTED_PLATFORMS = new Set(['blazor', 'winui', 'uno']);
71
+
58
72
  const DV_PATHS = ['gauges/', 'maps/', 'excel/', 'charts/'];
59
73
  const ASSETS_RE = /([.]{0,2}\/)*assets\//g;
60
74
  const DEFAULT_CODE_THEME = 'dark-plus';
@@ -66,6 +80,8 @@ declare const __IGD_SAMPLE_CODE_THEME__: string | undefined;
66
80
  interface SampleFile {
67
81
  fileExtension: string;
68
82
  fileHeader: string;
83
+ /** Original file name for platforms exposing multiple markup/source files. */
84
+ fileName?: string;
69
85
  content: string;
70
86
  isMain: boolean;
71
87
  path?: string;
@@ -88,11 +104,18 @@ interface WidgetContext {
88
104
  */
89
105
  function normalizePlatform(raw: string): string {
90
106
  if (raw === 'webcomponents' || raw === 'web-components') return 'wc';
107
+ if (raw === 'uno-platform') return 'uno';
91
108
  return raw;
92
109
  }
93
110
 
94
111
  function isXplatPlatform(platform: string): boolean {
95
- return platform === 'react' || platform === 'wc' || platform === 'blazor';
112
+ return (
113
+ platform === 'react' ||
114
+ platform === 'wc' ||
115
+ platform === 'blazor' ||
116
+ platform === 'winui' ||
117
+ platform === 'uno'
118
+ );
96
119
  }
97
120
 
98
121
  function getSamplePath(iframeSrc: string, demosBaseUrl: string): string {
@@ -137,7 +160,13 @@ function replaceRelativeAssetUrls(files: SampleFile[], demosBaseUrl: string): vo
137
160
 
138
161
  // ─── Code Highlighting ────────────────────────────────────────────────────────
139
162
 
140
- const LANG_MAP: Record<string, string> = { js: 'javascript', ts: 'typescript', cs: 'csharp' };
163
+ // Shiki has no XAML grammar; XAML is XML, so WinUI/Uno markup highlights as that.
164
+ const LANG_MAP: Record<string, string> = {
165
+ js: 'javascript',
166
+ ts: 'typescript',
167
+ cs: 'csharp',
168
+ xaml: 'xml',
169
+ };
141
170
 
142
171
  const SHIKI_LANGS = [
143
172
  'text',
@@ -151,6 +180,11 @@ const SHIKI_LANGS = [
151
180
  'razor',
152
181
  ] as const;
153
182
 
183
+ // Only the WinUI/Uno samples show these (XAML markup and data files), so they load on first use
184
+ // rather than on every sample page.
185
+ const SHIKI_LAZY_LANGS = ['xml', 'json'] as const;
186
+ const HIGHLIGHT_LANGS: ReadonlySet<string> = new Set([...SHIKI_LANGS, ...SHIKI_LAZY_LANGS]);
187
+
154
188
  let _highlighterPromise: Promise<Highlighter> | null = null;
155
189
 
156
190
  function getCodeTheme(): string {
@@ -174,9 +208,12 @@ function getHighlighter(): Promise<Highlighter> {
174
208
  }
175
209
 
176
210
  function highlightCode(codeEl: HTMLElement, lang: string): void {
177
- const safeLang = (SHIKI_LANGS as readonly string[]).includes(lang) ? lang : 'text';
211
+ const safeLang = HIGHLIGHT_LANGS.has(lang) ? lang : 'text';
178
212
  getHighlighter()
179
- .then((h) => {
213
+ .then(async (h) => {
214
+ if (!h.getLoadedLanguages().includes(safeLang)) {
215
+ await h.loadLanguage(safeLang as BundledLanguage);
216
+ }
180
217
  const tmp = document.createElement('div');
181
218
  tmp.innerHTML = h.codeToHtml(codeEl.textContent ?? '', {
182
219
  lang: safeLang,
@@ -198,11 +235,11 @@ function normalizeCodeLang(lang: string | undefined): string {
198
235
 
199
236
  // ─── Code Tab Rendering ───────────────────────────────────────────────────────
200
237
 
201
- function addCodeTab(igcTabs: HTMLElement, file: SampleFile): void {
238
+ function addCodeTab(igcTabs: HTMLElement, file: SampleFile, useFileName = false): void {
202
239
  const lang = normalizeCodeLang(file.fileExtension);
203
240
 
204
241
  const tab = document.createElement('igc-tab');
205
- tab.setAttribute('label', file.fileHeader.toUpperCase());
242
+ tab.setAttribute('label', (useFileName && file.fileName) || file.fileHeader.toUpperCase());
206
243
 
207
244
  const wrapper = document.createElement('div');
208
245
  wrapper.className = 'code-wrapper';
@@ -449,10 +486,8 @@ class XplatCodeService {
449
486
  this.platform = platform;
450
487
  this.samplesOrder = XPLAT_SAMPLES_ORDER[platform] || ['ts', 'html', 'css'];
451
488
  this.codeBase = XPLAT_CODE_BASE[platform] || '/code-viewer/';
452
- // Gates only the StackBlitz / CodeSandbox buttons — Blazor samples can't be
453
- // live-edited in a browser sandbox. The footer itself is always rendered:
454
- // it also carries the fullscreen button and the in-sample theme picker.
455
- this.enableLiveEditing = platform !== 'blazor';
489
+ // Gates the StackBlitz / CodeSandbox footer, not editing of the embedded sample.
490
+ this.enableLiveEditing = !SANDBOX_UNSUPPORTED_PLATFORMS.has(platform);
456
491
  }
457
492
 
458
493
  async init(ctx: WidgetContext): Promise<void> {
@@ -482,11 +517,18 @@ class XplatCodeService {
482
517
 
483
518
  (data.sampleFiles || ([] as SampleFile[]))
484
519
  .filter((f: SampleFile) => f.isMain)
485
- .sort(
486
- (a: SampleFile, b: SampleFile) =>
487
- this.samplesOrder.indexOf(a.fileHeader) - this.samplesOrder.indexOf(b.fileHeader),
488
- )
489
- .forEach((file: SampleFile) => addCodeTab(igcTabs, file));
520
+ .sort((a: SampleFile, b: SampleFile) => {
521
+ const rank = (file: SampleFile) => {
522
+ const index = this.samplesOrder.indexOf(file.fileHeader);
523
+ return index < 0 && ULTIMATE_UI_PLATFORMS.has(this.platform)
524
+ ? Number.MAX_SAFE_INTEGER
525
+ : index;
526
+ };
527
+ return rank(a) - rank(b);
528
+ })
529
+ .forEach((file: SampleFile) =>
530
+ addCodeTab(igcTabs, file, ULTIMATE_UI_PLATFORMS.has(this.platform)),
531
+ );
490
532
 
491
533
  // Use sdk.openProject() to avoid the StackBlitz GitHub clone freeze bug.
492
534
  addFooter(
@@ -36,7 +36,7 @@ declare module 'virtual:docs-template/site-meta' {
36
36
  export const trailingSlash: 'always' | 'never' | 'ignore';
37
37
  /** Optional package switcher entries. */
38
38
  export const packages:
39
- Array<string | { label: string; value?: string; href?: string }> | undefined;
39
+ Array<string | { label: string; value?: string; href?: string; base?: string }> | undefined;
40
40
  /** Currently selected package. */
41
41
  export const selectedPackage: string | undefined;
42
42
  }
@@ -48,6 +48,8 @@ declare module 'virtual:docs-template/nav-html' {
48
48
  | 'react'
49
49
  | 'blazor'
50
50
  | 'web-components'
51
+ | 'winui'
52
+ | 'uno'
51
53
  | 'slingshot'
52
54
  | 'appbuilder'
53
55
  | null;