igniteui-astro-components 1.3.0 → 1.4.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.
package/README.md CHANGED
@@ -239,8 +239,10 @@ const sidebar: SidebarEntry[] = [/* … your tree … */];
239
239
 
240
240
  | Export | Purpose | Docs |
241
241
  | ---------------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------------ |
242
- | `…/components/GlobalNavBar.astro` | IG global navigation bar | [README](src/components/GlobalNavBar/README.md) |
243
- | `…/components/GlobalFooter.astro` | IG global footer | [README](src/components/GlobalFooter/README.md) |
242
+ | `…/components/GlobalNavBar.astro` | IG global navigation bar — legacy, fetched from `/navigation` | [README](src/components/GlobalNavBar/README.md) |
243
+ | `…/components/GlobalFooter.astro` | IG global footer — legacy, fetched from `/navigation` | [README](src/components/GlobalFooter/README.md) |
244
+ | `…/chrome` | `igChrome()` — render the header/footer from a synced snapshot | [below](#the-infragistics-header-and-footer) |
245
+ | `…/chrome/contract` | `parseFragment()` — the `ig-chrome` contract checks, for sync scripts | [below](#the-infragistics-header-and-footer) |
244
246
  | `…/components/DocsSubHeader.astro` | Secondary fixed bar — site title + breadcrumb + product links + search | [README](src/components/DocsSubHeader/README.md) |
245
247
  | `…/components/Search.astro` | Pagefind-powered full-text search modal | [README](src/components/Search/README.md) |
246
248
  | `…/components/ThemingWidget.astro` | Theming widget | [README](src/components/ThemingWidget/README.md) |
@@ -290,6 +292,114 @@ const sidebar: SidebarEntry[] = [/* … your tree … */];
290
292
 
291
293
  ---
292
294
 
295
+ ## The Infragistics header and footer
296
+
297
+ The marketing site (Marketing-Infragistics) is the single source of the
298
+ Infragistics header and footer. It publishes them at
299
+ `/assets/chrome/fragment.html`: one versioned fragment (`ig-chrome v1`) with
300
+ scoped CSS and one classic script. tripwire renders it server-side; a site built
301
+ on this package keeps a **snapshot** of it in its own repo and renders it from
302
+ there.
303
+
304
+ ### Which header and footer a page gets
305
+
306
+ `DocsLayout` decides per build:
307
+
308
+ | Build | Renders | Source |
309
+ | ------------------------------------------- | ------------------------------------------------------------ | --------------------------------------------------------------- |
310
+ | the site registers `igChrome({ snapshot })` | the **marketing site's exported chrome** | the site's snapshot folder; nothing fetched at build or runtime |
311
+ | `navLang: 'jp'` | the legacy Japanese chrome (`GlobalNavBar` / `GlobalFooter`) | fetched from `jp.infragistics.com/navigation` at build |
312
+ | the site does not register `igChrome` | the legacy chrome (`GlobalNavBar` / `GlobalFooter`) | fetched from `www.infragistics.com/navigation` at build |
313
+
314
+ Japanese builds stay on the legacy chrome even with `igChrome`, until a
315
+ Japanese fragment is published.
316
+
317
+ ### Using the snapshot
318
+
319
+ **1. Keep a snapshot in the repo.** One folder, shared by every Astro project in
320
+ the repo, with one subfolder per source:
321
+
322
+ ```
323
+ ig-chrome/
324
+ staging/ from https://astro-staging.infragistics.com/assets/chrome/fragment.html
325
+ production/ from https://www.infragistics.com/assets/chrome/fragment.html
326
+ manifest.json contract, build hash, source, sync time
327
+ fragment.html asset URLs written as %IG_CHROME_ASSETS%/…
328
+ assets/chrome.css
329
+ assets/chrome.js
330
+ assets/media/* every image the chrome loads from the marketing host
331
+ ```
332
+
333
+ Each consumer repo owns the script that writes it (`scripts/chrome-sync.mjs` in
334
+ docs-template and api-docs). It validates the fragment with this package's
335
+ `igniteui-astro-components/chrome/contract`, the same checks the build and
336
+ tripwire apply, and writes nothing when the build hash is unchanged.
337
+
338
+ The **marketing site's deploy runs it**: after each deploy, its `sync-chrome` job
339
+ (Marketing-Infragistics, `.github/workflows/deploy.yml`) hands each docs repo the
340
+ export it just deployed, runs that repo's script, and opens a PR when the chrome
341
+ changed. Nothing in a docs repo has to reach the marketing site's hosts. To
342
+ sync by hand, run the script locally (see the docs repo's README).
343
+
344
+ **2. Register the integration**, with the snapshot for the build's environment:
345
+
346
+ ```ts
347
+ import { igChrome } from 'igniteui-astro-components/chrome';
348
+
349
+ integrations: [
350
+ igChrome({ snapshot: isProduction ? './ig-chrome/production' : './ig-chrome/staging' }),
351
+ ];
352
+ ```
353
+
354
+ or `createDocsSite({ chrome: { snapshot } })`, which also drops the legacy
355
+ chrome's `navigation.css`, `footer.css`, jQuery, `plugins.nav.js` and
356
+ `navigation.js` from `<head>` (`getPlatformHead(platform, lang, { legacyChrome: false })`).
357
+
358
+ Per build, `igChrome`:
359
+
360
+ - validates the snapshot against the contract. A missing, broken or
361
+ incompatible snapshot **fails the build**, naming the folder;
362
+ - has `DocsLayout` render its head, header and footer parts;
363
+ - serves the CSS, JS and images from the site's own build, under its base path:
364
+ `{base}/_ig-chrome/{build}/…`. Every deployment is self-contained: nothing is
365
+ loaded from the marketing host at runtime except the Google Fonts stylesheet
366
+ the fragment links. Pages carry `<meta name="ig-chrome" content="v1 build=…">`.
367
+
368
+ ### How a nav change reaches a site
369
+
370
+ ```
371
+ Marketing-Infragistics: push to staging / main
372
+ │
373
+ ├─ deploy job ──► build ──► S3 (publishes /assets/chrome/fragment.html, build=abc123)
374
+ │ └──► uploads the export as an artifact
375
+ │
376
+ └─ sync-chrome job, for each docs repo (igniteui-documentation, api-docs)
377
+ │ checks out the repo, runs ITS scripts/chrome-sync.mjs on the export
378
+ │
379
+ ├─ same build hash ──► nothing to do
380
+ └─ new build ────────► PR in the docs repo:
381
+ ig-chrome/staging (deploys from staging)
382
+ ig-chrome/production (deploys from main)
383
+ │
384
+ review, merge ──► the next docs build renders it
385
+ ```
386
+
387
+ A sync changes only the snapshot folder. No release of this package is needed
388
+ when the marketing site changes its navigation. The `sync-chrome` job needs a
389
+ GitHub App with write access to the docs repos; until it is configured the job
390
+ is skipped and a sync is run locally.
391
+
392
+ ### Why the legacy chrome is still here
393
+
394
+ `GlobalNavBar` / `GlobalFooter` and their `/navigation` fetch stay for now:
395
+
396
+ - **Japanese** has no fragment yet, so Japanese builds use them.
397
+ - **Sites that haven't adopted `igChrome`** keep exactly the behaviour they had,
398
+ so adopting the snapshot is a per-site change, not a breaking release.
399
+
400
+ Once a Japanese fragment exists and every site using `DocsLayout` has a
401
+ snapshot, the legacy chrome and its fetch can be removed.
402
+
293
403
  ## Subpath exports
294
404
 
295
405
  Every component is reachable through an explicit subpath in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-astro-components",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Reusable Astro components, layouts, and integrations for Infragistics / Ignite UI documentation sites. Replaces the Starlight defaults with project-specific implementations.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -40,6 +40,8 @@
40
40
  "./content-config": "./src/content.config.ts",
41
41
  "./llms": "./src/llms.ts",
42
42
  "./layouts/DocsLayout.astro": "./src/layouts/DocsLayout/DocsLayout.astro",
43
+ "./chrome": "./src/chrome/integration.ts",
44
+ "./chrome/contract": "./src/chrome/contract.mjs",
43
45
  "./components/GlobalNavBar.astro": "./src/components/GlobalNavBar/GlobalNavBar.astro",
44
46
  "./components/GlobalFooter.astro": "./src/components/GlobalFooter/GlobalFooter.astro",
45
47
  "./components/DocsSubHeader.astro": "./src/components/DocsSubHeader/DocsSubHeader.astro",
@@ -83,34 +85,34 @@
83
85
  "./package.json": "./package.json"
84
86
  },
85
87
  "peerDependencies": {
86
- "astro": "^7.3.4",
87
- "igniteui-theming": "^26.0.1",
88
- "igniteui-webcomponents": "^7.3.0-beta.1"
88
+ "astro": "^7.3.5",
89
+ "igniteui-theming": "^29.0.0",
90
+ "igniteui-webcomponents": "^7.4.1"
89
91
  },
90
92
  "dependencies": {
91
93
  "@astrojs/mdx": "^8.0.2",
92
94
  "@astrojs/markdown-satteri": "^0.4.2",
93
- "@fontsource-variable/instrument-sans": "^5.2.8",
94
- "@fontsource-variable/inter": "^5.2.8",
95
- "@fontsource-variable/jetbrains-mono": "^5.2.8",
95
+ "@fontsource-variable/instrument-sans": "^5.3.0",
96
+ "@fontsource-variable/inter": "^5.3.0",
97
+ "@fontsource-variable/jetbrains-mono": "^5.3.0",
96
98
  "github-slugger": "^2.0.0",
97
- "jsdom": "^29.0.1",
99
+ "jsdom": "^30.1.1",
98
100
  "satteri": "^0.10.5",
99
- "shiki": "^4.3.0"
101
+ "shiki": "^4.4.0"
100
102
  },
101
103
  "devDependencies": {
102
- "@astrojs/check": "^0.9.9",
103
- "@types/jsdom": "^21.1.7",
104
- "astro": "^7.3.4",
104
+ "@astrojs/check": "^0.9.10",
105
+ "@types/jsdom": "^30.0.0",
106
+ "astro": "^7.3.5",
105
107
  "husky": "^9.1.7",
106
- "igniteui-theming": "^26.0.1",
107
- "igniteui-webcomponents": "^7.3.0-beta.1",
108
- "lint-staged": "^17.0.8",
109
- "oxlint": "^1.72.0",
110
- "prettier": "^3.9.4",
111
- "prettier-plugin-astro": "^0.14.1",
112
- "sass": "^1.83.0",
113
- "typescript": "^5.9.3"
108
+ "igniteui-theming": "^29.0.0",
109
+ "igniteui-webcomponents": "^7.4.1",
110
+ "lint-staged": "^17.6.0",
111
+ "oxlint": "^1.86.0",
112
+ "prettier": "^3.9.9",
113
+ "prettier-plugin-astro": "^1.1.0",
114
+ "sass": "^1.105.0",
115
+ "typescript": "~6.0.3"
114
116
  },
115
117
  "publishConfig": {
116
118
  "access": "public"
@@ -0,0 +1,12 @@
1
+ export declare const CHROME_CONTRACT: 'v1';
2
+ export declare const ASSET_TOKEN: '%IG_CHROME_ASSETS%';
3
+
4
+ export interface ParsedFragment {
5
+ contract: string;
6
+ build: string;
7
+ head: string;
8
+ header: string;
9
+ footer: string;
10
+ }
11
+
12
+ export declare function parseFragment(html: string): ParsedFragment;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * The `ig-chrome` contract: the shape of the header/footer fragment the
3
+ * marketing site publishes at `/assets/chrome/fragment.html`
4
+ * (Marketing-Infragistics, `src/lib/chromeExport.ts`).
5
+ *
6
+ * Used by the Astro integration (`integration.ts`) to validate a snapshot at
7
+ * build time. The checks are identical to tripwire's `NavCache.Parse()` and to
8
+ * the consumer repos' sync scripts (`scripts/chrome-sync.mjs`), so a fragment
9
+ * one consumer accepts, every consumer accepts.
10
+ *
11
+ * Plain JavaScript, so a consumer's sync script can import it under bare
12
+ * `node` as well (`igniteui-astro-components/chrome/contract`).
13
+ */
14
+
15
+ /** The fragment shape this code understands. Must match CHROME_CONTRACT in chromeExport.ts. */
16
+ export const CHROME_CONTRACT = 'v1';
17
+
18
+ /**
19
+ * Placeholder the synced snapshot uses for "where this site serves the chrome
20
+ * assets". The integration replaces it with `{base}/_ig-chrome/{build}` at
21
+ * build time, so one snapshot works under every site's base path.
22
+ */
23
+ export const ASSET_TOKEN = '%IG_CHROME_ASSETS%';
24
+
25
+ const STAMP = /<!--\s*ig-chrome\s+(v\d+)\s+build=([A-Za-z0-9]+)/;
26
+ /** The site header itself: a <header> whose class list starts with "nv". */
27
+ const SITE_HEADER = /<header\b[^>]*\sclass="nv[\s"]/i;
28
+
29
+ /**
30
+ * Splits a fragment into its parts. Throws on anything that does not match the
31
+ * contract.
32
+ *
33
+ * @param {string} html
34
+ * @returns {{ contract: string, build: string, head: string, header: string, footer: string }}
35
+ */
36
+ export function parseFragment(html) {
37
+ const text = html ?? '';
38
+ const stamp = STAMP.exec(text);
39
+ if (!stamp) {
40
+ throw new Error('The fragment carries no ig-chrome version stamp.');
41
+ }
42
+ if (stamp[1] !== CHROME_CONTRACT) {
43
+ throw new Error(
44
+ `The fragment is contract ${stamp[1]}; this version of igniteui-astro-components understands ${CHROME_CONTRACT}.`,
45
+ );
46
+ }
47
+
48
+ const fragment = {
49
+ contract: stamp[1],
50
+ build: stamp[2],
51
+ head: part(text, 'head'),
52
+ header: part(text, 'header'),
53
+ footer: part(text, 'footer'),
54
+ };
55
+
56
+ // Not tied to ASSET_TOKEN: this also validates the RAW marketing fragment
57
+ if (!fragment.head.includes('chrome.css')) {
58
+ throw new Error("The fragment's head part does not load chrome.css.");
59
+ }
60
+ if (!fragment.head.includes('chrome.js')) {
61
+ throw new Error("The fragment's head part does not load chrome.js.");
62
+ }
63
+ if (!fragment.header.includes('data-ig-chrome="header"')) {
64
+ throw new Error('The fragment\'s header part has no [data-ig-chrome="header"] root.');
65
+ }
66
+ if (!SITE_HEADER.test(fragment.header)) {
67
+ throw new Error('The fragment\'s header part has no <header class="nv"> element.');
68
+ }
69
+ if (!/<footer\b/i.test(fragment.footer)) {
70
+ throw new Error("The fragment's footer part has no <footer> element.");
71
+ }
72
+ return fragment;
73
+ }
74
+
75
+ /**
76
+ * @param {string} html
77
+ * @param {string} name
78
+ */
79
+ function part(html, name) {
80
+ const open = `<!-- ig-chrome:${name} -->`;
81
+ const close = `<!-- /ig-chrome:${name} -->`;
82
+ const start = html.indexOf(open);
83
+ const end = start < 0 ? -1 : html.indexOf(close, start + open.length);
84
+ if (start < 0 || end < 0) {
85
+ throw new Error(`The fragment has no '${name}' part.`);
86
+ }
87
+ const body = html.slice(start + open.length, end).trim();
88
+ if (!body) {
89
+ throw new Error(`The fragment's '${name}' part is empty.`);
90
+ }
91
+ return body;
92
+ }
@@ -0,0 +1,173 @@
1
+ /**
2
+ * `igChrome()` — render the Infragistics header and footer from a snapshot of
3
+ * the marketing site's own export.
4
+ *
5
+ * The marketing site (Marketing-Infragistics) is the single source of the
6
+ * Infragistics chrome. It publishes it at `/assets/chrome/fragment.html`: one
7
+ * versioned fragment (`ig-chrome v1`) with scoped CSS and one classic script.
8
+ * A consumer repo keeps a copy of that export (written by its own sync script,
9
+ * which the marketing site's deploy runs) and registers this integration with the
10
+ * snapshot's folder:
11
+ *
12
+ * integrations: [igChrome({ snapshot: './ig-chrome/production' })]
13
+ *
14
+ * Then, per build:
15
+ *
16
+ * - the snapshot is validated against the ig-chrome contract. A missing,
17
+ * broken or incompatible snapshot FAILS the build, naming the folder: no
18
+ * site ships without chrome;
19
+ * - DocsLayout renders its head, header and footer parts (read through the
20
+ * build-time `__IG_CHROME__` constant this defines);
21
+ * - the CSS, JS and images are served from this site's own build, under its
22
+ * base path: `{base}/_ig-chrome/{build}/…`. Nothing is loaded from the
23
+ * marketing host at runtime.
24
+ *
25
+ * Japanese builds (`navLang: 'jp'`) keep the legacy fetched chrome until a
26
+ * Japanese fragment is published. Without this integration, DocsLayout keeps
27
+ * its legacy fetched chrome for every language.
28
+ *
29
+ * SNAPSHOT LAYOUT (written by the consumer's sync script):
30
+ *
31
+ * <snapshot>/manifest.json contract, build hash, source, sync time
32
+ * <snapshot>/fragment.html asset URLs written as %IG_CHROME_ASSETS%/…
33
+ * <snapshot>/assets/chrome.css
34
+ * <snapshot>/assets/chrome.js
35
+ * <snapshot>/assets/media/*
36
+ */
37
+ import fs from 'node:fs';
38
+ import path from 'node:path';
39
+ import { fileURLToPath } from 'node:url';
40
+ import type { AstroIntegration } from 'astro';
41
+ import { parseFragment, ASSET_TOKEN, type ParsedFragment } from './contract.mjs';
42
+
43
+ export interface IgChromeOptions {
44
+ /**
45
+ * The snapshot folder, absolute or relative to the Astro project root. In a
46
+ * repo with several Astro projects, point them all at one shared folder.
47
+ */
48
+ snapshot: string | URL;
49
+ }
50
+
51
+ /** What DocsLayout reads, via `__IG_CHROME__`: the parsed snapshot, asset URLs resolved. */
52
+ export type IgChromeData = ParsedFragment;
53
+
54
+ const MIME: Record<string, string> = {
55
+ '.css': 'text/css; charset=utf-8',
56
+ '.js': 'text/javascript; charset=utf-8',
57
+ '.svg': 'image/svg+xml',
58
+ '.png': 'image/png',
59
+ '.webp': 'image/webp',
60
+ '.jpg': 'image/jpeg',
61
+ '.jpeg': 'image/jpeg',
62
+ '.gif': 'image/gif',
63
+ '.avif': 'image/avif',
64
+ '.ico': 'image/x-icon',
65
+ };
66
+
67
+ export function igChrome(options: IgChromeOptions): AstroIntegration {
68
+ let assetsDir = '';
69
+ let build = '';
70
+
71
+ return {
72
+ name: 'igniteui:chrome',
73
+ hooks: {
74
+ 'astro:config:setup'({ config, updateConfig, logger }) {
75
+ const root = fileURLToPath(config.root);
76
+ const snapshotDir =
77
+ options.snapshot instanceof URL
78
+ ? fileURLToPath(options.snapshot)
79
+ : path.resolve(root, options.snapshot);
80
+ assetsDir = path.join(snapshotDir, 'assets');
81
+
82
+ const fragmentFile = path.join(snapshotDir, 'fragment.html');
83
+ if (!fs.existsSync(fragmentFile)) {
84
+ throw new Error(
85
+ `[igniteui:chrome] no snapshot at ${snapshotDir}. Run the repo's chrome sync script first.`,
86
+ );
87
+ }
88
+ let parsed;
89
+ try {
90
+ parsed = parseFragment(fs.readFileSync(fragmentFile, 'utf8'));
91
+ } catch (err) {
92
+ throw new Error(
93
+ `[igniteui:chrome] the snapshot at ${snapshotDir} is invalid: ${(err as Error).message}`,
94
+ );
95
+ }
96
+ for (const file of ['chrome.css', 'chrome.js']) {
97
+ if (!parsed.head.includes(`${ASSET_TOKEN}/${file}`)) {
98
+ throw new Error(
99
+ `[igniteui:chrome] the snapshot at ${snapshotDir} does not load ${ASSET_TOKEN}/${file}. Re-run the repo's chrome sync script.`,
100
+ );
101
+ }
102
+ if (!fs.existsSync(path.join(assetsDir, file))) {
103
+ throw new Error(
104
+ `[igniteui:chrome] the snapshot at ${snapshotDir} has no assets/${file}.`,
105
+ );
106
+ }
107
+ }
108
+ build = parsed.build;
109
+
110
+ const base = (config.base || '/').replace(/\/+$/, '');
111
+ const prefix = `${base}/_ig-chrome/${build}`;
112
+ const resolve = (text: string) => text.split(ASSET_TOKEN).join(prefix);
113
+ const data: IgChromeData = {
114
+ ...parsed,
115
+ head: resolve(parsed.head),
116
+ header: resolve(parsed.header),
117
+ footer: resolve(parsed.footer),
118
+ };
119
+
120
+ updateConfig({
121
+ vite: {
122
+ plugins: [
123
+ {
124
+ /* `astro dev`: serve the snapshot's assets at the URLs the build emits. */
125
+ name: 'igniteui:chrome-dev-assets',
126
+ /* Server environments only: only DocsLayout's frontmatter reads it.
127
+ * A global `define` is also written into the client's /@vite/env,
128
+ * which would ship the whole ~100 KB snapshot to every dev page. */
129
+ configEnvironment(name) {
130
+ if (name !== 'client') return { define: { __IG_CHROME__: JSON.stringify(data) } };
131
+ },
132
+ configureServer(server) {
133
+ // Astro may strip the base from req.url before this runs (it does
134
+ // when the dev server itself runs under a base), so accept both.
135
+ const prefixes = [`${prefix}/`, `/_ig-chrome/${build}/`];
136
+ server.middlewares.use((req, res, next) => {
137
+ const url = (req.url || '').split('?')[0]!;
138
+ const match = prefixes.find((p) => url.startsWith(p));
139
+ if (!match) return next();
140
+ const file = path.join(assetsDir, decodeURIComponent(url.slice(match.length)));
141
+ const relative = path.relative(assetsDir, file);
142
+ if (
143
+ !relative ||
144
+ relative === '..' ||
145
+ relative.startsWith(`..${path.sep}`) ||
146
+ path.isAbsolute(relative) ||
147
+ !fs.statSync(file, { throwIfNoEntry: false })?.isFile()
148
+ ) {
149
+ return next();
150
+ }
151
+ res.setHeader(
152
+ 'Content-Type',
153
+ MIME[path.extname(file).toLowerCase()] ?? 'application/octet-stream',
154
+ );
155
+ fs.createReadStream(file).pipe(res);
156
+ });
157
+ },
158
+ },
159
+ ],
160
+ },
161
+ });
162
+ logger.info(`header/footer from snapshot build ${build}`);
163
+ },
164
+
165
+ 'astro:build:done'({ dir, logger }) {
166
+ // Each site carries its own copy, so every deployment is self-contained.
167
+ const target = path.join(fileURLToPath(dir), '_ig-chrome', build);
168
+ fs.cpSync(assetsDir, target, { recursive: true });
169
+ logger.info(`copied the chrome assets to /_ig-chrome/${build}/`);
170
+ },
171
+ },
172
+ };
173
+ }
@@ -82,6 +82,18 @@ const activeId = normalizeSlug(currentSlug);
82
82
  renderLabel={SidebarLabel}
83
83
  />
84
84
  </div>
85
+ {
86
+ /* Shared tooltip showing the full text of a truncated (line-clamped) label.
87
+ Anchored at runtime to the hovered/focused row by sidebar-tooltip.ts, which
88
+ also owns show/hide — hence the empty trigger lists. */
89
+ }
90
+ <igc-tooltip
91
+ data-sidebar-tooltip
92
+ class="igd-sidebar-tooltip"
93
+ placement="right"
94
+ show-triggers=""
95
+ hide-triggers=""
96
+ with-arrow></igc-tooltip>
85
97
  </sidebar-filter>
86
98
  <div class="docs-sidebar-backdrop" id="docs-sidebar-backdrop" aria-hidden="true"></div>
87
99
 
@@ -96,15 +108,23 @@ const activeId = normalizeSlug(currentSlug);
96
108
  IgcInputComponent,
97
109
  IgcButtonComponent,
98
110
  IgcIconComponent,
111
+ IgcTooltipComponent,
99
112
  } from 'igniteui-webcomponents';
100
113
 
101
- defineComponents(IgcBadgeComponent, IgcInputComponent, IgcButtonComponent, IgcIconComponent);
114
+ defineComponents(
115
+ IgcBadgeComponent,
116
+ IgcInputComponent,
117
+ IgcButtonComponent,
118
+ IgcIconComponent,
119
+ IgcTooltipComponent,
120
+ );
102
121
 
103
122
  // Icons (sidebar-filter-search, sidebar-filter-clear) are registered via
104
123
  // the icon registry which picks up all SVGs from src/assets/icons/.
105
124
  import '../../scripts/icon-registry';
106
125
 
107
126
  import './sidebar-filter';
127
+ import './sidebar-tooltip';
108
128
 
109
129
  // Close the sidebar overlay when the backdrop is clicked.
110
130
  document.addEventListener('click', (e) => {
@@ -1,4 +1,5 @@
1
1
  @use 'igniteui-theming/sass/typography' as *;
2
+ @use '../../styles/global/breakpoints' as *;
2
3
 
3
4
  @layer components {
4
5
  // Desktop base. On tablet/mobile DocsLayout.scss turns this into a slide-in overlay.
@@ -87,9 +88,11 @@
87
88
  }
88
89
  }
89
90
 
91
+ // Group rows: row inset, then the chevron column (see the layout model in
92
+ // DocsTree/docs-tree.scss). No flex gap here — the chevron's own margin is
93
+ // the single source of the icon→label spacing.
90
94
  .docs-tree-group {
91
- gap: rem(8px);
92
- padding: rem(12px) rem(8px);
95
+ padding: rem(12px) rem(8px) rem(12px) var(--docs-tree-row-inset, #{rem(6px)});
93
96
  }
94
97
 
95
98
  .group-label-text {
@@ -122,4 +125,30 @@
122
125
  max-height: 20px;
123
126
  }
124
127
  }
128
+
129
+ // Full-text tooltip for truncated labels (see sidebar-tooltip.ts).
130
+ .igd-sidebar-tooltip {
131
+ --ig-tooltip-background: light-dark(var(--ig-gray-800), var(--ig-gray-200));
132
+ --ig-tooltip-text-color: light-dark(var(--ig-gray-50), var(--ig-gray-900));
133
+ --ig-tooltip-border-radius: #{rem(4px)};
134
+
135
+ &::part(base) {
136
+ @include type-style('body-2') {
137
+ margin-block: 0;
138
+ line-height: rem(20px);
139
+ }
140
+
141
+ max-width: rem(320px);
142
+ padding: rem(6px) rem(10px);
143
+ font-family: var(--igd-font-sans);
144
+ white-space: normal;
145
+ word-break: break-word;
146
+ }
147
+
148
+ // Labels are not clamped on mobile/tablet (see DocsTree/docs-tree.scss),
149
+ // and hover tooltips make no sense on touch — keep it out of the overlay.
150
+ @media (max-width: #{$bp-tablet-max}) {
151
+ display: none;
152
+ }
153
+ }
125
154
  }
@@ -9,6 +9,7 @@ The sidebar is composed of four focused components and a custom element:
9
9
  | `SidebarTree.astro` | `…/components/sidebar/SidebarTree.astro` | Recursive `<ul>` renderer |
10
10
  | `SidebarItem.astro` | `…/components/sidebar/SidebarItem.astro` | Single link or `<details>` group |
11
11
  | `sidebar-filter.ts` | `…/components/sidebar/sidebar-filter` | `<sidebar-filter>` custom element |
12
+ | `sidebar-tooltip.ts` | `…/components/sidebar/sidebar-tooltip` | Full-text tooltip for truncated labels |
12
13
 
13
14
  ---
14
15
 
@@ -154,6 +155,17 @@ The `<sidebar-filter>` custom element handles live filtering:
154
155
  - "No results" text is set via `data-no-results` on the host element.
155
156
  - Filter state persists across Astro View Transitions navigations via `sessionStorage`.
156
157
 
158
+ ### Truncated labels
159
+
160
+ Leaf labels are clamped to two lines. When a label overflows the clamp, hovering
161
+ or focusing its row shows the full text in a shared `<igc-tooltip>` (one per
162
+ sidebar, re-anchored to the current row by `sidebar-tooltip.ts`). Rows whose
163
+ label fits never show a tooltip; truncation is measured on each interaction, so
164
+ it stays correct after the sidebar is resized. Style it via
165
+ `.igd-sidebar-tooltip` and the `--ig-tooltip-*` variables. Below the tablet
166
+ breakpoint (< 1280px, where the sidebar is a slide-in overlay) labels are not
167
+ clamped and the tooltip is not shown.
168
+
157
169
  ---
158
170
 
159
171
  ## SidebarTree / SidebarItem
@@ -5,7 +5,7 @@
5
5
  * Receives `{ node, depth, isLeaf, isActive }` from DocsTreeItem.
6
6
  * Branches on isLeaf:
7
7
  * • leaf → label text + optional badge (from node.meta.badge)
8
- * • group → label text only (the caret lives in the native indicator slot of igc-tree-item)
8
+ * • group → label text only (DocsTreeItem renders the leading chevron before it)
9
9
  *
10
10
  * The outer container is the `<a class="docs-tree-link">` (leaves) or
11
11
  * `<div class="docs-tree-group">` (groups) provided by DocsTreeItem.