From f0d37e94f72094bc1598ded6329ed65401bc746e Mon Sep 17 00:00:00 2001 From: Viktor Kombov Date: Wed, 13 May 2026 12:34:47 +0300 Subject: [PATCH 1/7] chore: remove Starlight/DocFX leftovers and split remark plugin --- .env.example | 4 +- astro.config.ts | 141 +------ docs/angular/astro.config.ts | 3 - docs/angular/package.json | 3 - docs/xplat/astro.config.ts | 3 - .../grids/hierarchical-grid/overview.mdx | 6 +- src/components/ThemingWidget.astro | 11 +- src/content.config.ts | 2 +- src/integration.ts | 29 +- src/platform.ts | 21 +- src/plugins/remark-docfx.ts | 395 ------------------ src/plugins/remark-env-vars.ts | 110 +++++ src/plugins/remark-html-transforms.ts | 30 ++ src/plugins/remark-md-links.ts | 67 +++ src/sidebar.ts | 6 +- src/styles/custom.css | 2 +- src/styles/ig-theme.scss | 4 +- 17 files changed, 254 insertions(+), 583 deletions(-) delete mode 100644 src/plugins/remark-docfx.ts create mode 100644 src/plugins/remark-env-vars.ts create mode 100644 src/plugins/remark-html-transforms.ts create mode 100644 src/plugins/remark-md-links.ts diff --git a/.env.example b/.env.example index 56b55dbade..c5a3a49171 100644 --- a/.env.example +++ b/.env.example @@ -8,6 +8,6 @@ # Absolute path to the root of the docs source repository. # This directory must contain en/components/toc.yml and en/components/*.md # -# Windows example: DOCS_SOURCE_PATH=C:/Repos/docs/igniteui-docfx -# macOS/Linux: DOCS_SOURCE_PATH=/home/user/repos/igniteui-docfx +# Windows example: DOCS_SOURCE_PATH=C:/Repos/docs/my-docs-source +# macOS/Linux: DOCS_SOURCE_PATH=/home/user/repos/my-docs-source DOCS_SOURCE_PATH= diff --git a/astro.config.ts b/astro.config.ts index 296345540a..c8530eefcf 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -1,132 +1,17 @@ -import { defineConfig } from 'astro/config'; -import mdx from '@astrojs/mdx'; -import { buildSidebarFromToc, siteMetaIntegration } from './src/integration'; -import { getPlatformHead } from './src/platform'; -import path from 'node:path'; -import { loadEnv } from 'vite'; - -// Load .env into process.env — Vite/Astro does this for the browser bundle -// but NOT for astro.config.ts itself, so we do it explicitly here. -const env = loadEnv('', process.cwd(), ''); -Object.assign(process.env, env); - // --------------------------------------------------------------------------- -// Source paths — set via DOCS_SOURCE_PATH env var. -// For local development copy .env.example to .env and set an absolute path: -// DOCS_SOURCE_PATH=C:/Repos/docs/igniteui-docfx (Windows) -// DOCS_SOURCE_PATH=/home/user/repos/igniteui-docfx (macOS/Linux) +// Root astro.config.ts — NOT used for production builds. +// +// The actual docs sites are built via: +// docs/angular/astro.config.ts → Angular docs +// docs/xplat/astro.config.ts → React / Blazor / Web Components docs +// +// Both call createDocsSite() from src/integration.ts which assembles the +// full Astro configuration (plugins, sidebar, head entries, etc.). +// +// This file exists only so Astro tooling (language server, CLI) has a +// valid config when opened from the repo root. // --------------------------------------------------------------------------- -if (!process.env.DOCS_SOURCE_PATH) { - throw new Error( - '[docs-template] DOCS_SOURCE_PATH env var is required. ' + - 'Copy .env.example to .env and set an absolute path to the docs source repo root.' - ); -} - -const SOURCE_ROOT = path.resolve(process.env.DOCS_SOURCE_PATH); -const COMPONENTS = path.join(SOURCE_ROOT, 'en/components'); -const TOC_PATH = path.join(SOURCE_ROOT, 'en/components/toc.yml'); - -process.env.DOCS_SOURCE_PATH = COMPONENTS; - -const sidebar = buildSidebarFromToc({ - tocPath: TOC_PATH, - docsDir: COMPONENTS, - exclude: [ - /^grids_templates\//i, - /^style-guide\.md$/i, - /^themes\/sass\/presets\//i, - /^themes\.md$/i, - ], -}); +import { defineConfig } from 'astro/config'; -// https://astro.build/config -export default defineConfig({ - site: 'localhost:4321', - compressHTML: true, - build: { - assets: '_assets', - }, - vite: { - css: { - preprocessorOptions: { - scss: { - loadPaths: [path.join(process.cwd(), 'node_modules')], - silenceDeprecations: ['if-function'], - }, - }, - }, - }, - integrations: [ - starlight({ - title: 'Ignite UI for Angular', - logo: { - src: './public/favicon.svg', - }, - social: [ - { icon: 'github', label: 'GitHub', href: 'https://github.com/IgniteUI/igniteui-angular' }, - ], - sidebar, - // Prepend the packaged theme entry so consuming projects get the theme. - customCss: [ - './src/styles/ig-theme.scss', - './src/styles/custom.css', - ], - head: [ - // Platform CDN assets — driven by platform below - ...getPlatformHead('angular', 'en'), - // Angular-specific Ignite UI component bundle (repo-specific, not in shared registry) - // { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://www.infragistics.com/products/ignite-ui-angular/angular/bundles/igniteui.f5cfb48022e69dd66658.css' } }, - // highlight.js for code-tab syntax highlighting inside code-view widgets - { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/vs2015.min.css' } }, - { tag: 'script', attrs: { src: 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js', defer: true } }, - ], - editLink: { - baseUrl: 'https://github.com/IgniteUI/igniteui-docfx/edit/master/en/components/', - }, - components: { - PageFrame: './src/components/overrides/CustomPageFrame.astro', - Head: './src/components/overrides/Head.astro', - Header: './src/components/overrides/Header.astro', - Footer: './src/components/overrides/Footer.astro', - MobileTableOfContents: './src/components/overrides/MobileTableOfContents.astro', - Sidebar: './src/components/overrides/Sidebar/Sidebar.astro', - PageSidebar: './src/components/overrides/PageSidebar.astro', - }, - expressiveCode: { - themes: ['dark-plus'], - } - }), - siteMetaIntegration({ - title: 'Ignite UI for Angular', - platform: 'angular', - description: - 'Complete reference documentation for Ignite UI for Angular — a Material-based ' + - 'UI component library including Data Grid, Charts, Gauges, Calendars, and more.', - docsDir: COMPONENTS, - sidebar, - head: [ - ...getPlatformHead('angular', 'en'), - { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/vs2015.min.css' } }, - { tag: 'script', attrs: { src: 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js', defer: true } }, - ], - productLinks: [ - { label: 'Angular', href: '#', platform: 'angular' }, - { label: 'React', href: '#', platform: 'react' }, - { label: 'Blazor', href: '#', platform: 'blazor' }, - { label: 'Web Components', href: '#', platform: 'web-components' }, - ], - }), - mdx(), - staticImagesIntegration(IMAGES), - ], - markdown: { - remarkPlugins: [ - (await import('./src/plugins/remark-docfx')).remarkDocfx, - ], - rehypePlugins: [ - (await import('./src/plugins/remark-docfx')).rehypeCodeView, - ], - }, -}); +export default defineConfig({}); diff --git a/docs/angular/astro.config.ts b/docs/angular/astro.config.ts index c13b8885f5..7ad23c613f 100644 --- a/docs/angular/astro.config.ts +++ b/docs/angular/astro.config.ts @@ -74,9 +74,6 @@ export default createDocsSite({ docsDir: componentsDocsDir, }, sidebar: { exclude: [/^internal\//] }, - starlight: { - // logo: { src: './public/favicon.svg' }, - }, integrations: [mdx()], // Expose @/ alias so MDX files can import Sample.astro and peer components. // @xplat-images resolves xplat-sourced MDX image imports to the angular images dir. diff --git a/docs/angular/package.json b/docs/angular/package.json index 00be0d0db7..3d5120cb45 100644 --- a/docs/angular/package.json +++ b/docs/angular/package.json @@ -3,9 +3,6 @@ "type": "module", "version": "1.0.0", "scripts": { - "sync:en": "node scripts/sync-docfx.mjs --lang=en", - "sync:jp": "node scripts/sync-docfx.mjs --lang=jp", - "sync:kr": "node scripts/sync-docfx.mjs --lang=kr", "generate": "node scripts/generate.mjs", "generate:en": "node scripts/generate.mjs --lang=en", "generate:jp": "node scripts/generate.mjs --lang=jp", diff --git a/docs/xplat/astro.config.ts b/docs/xplat/astro.config.ts index 8e3112bb7e..604778b47d 100644 --- a/docs/xplat/astro.config.ts +++ b/docs/xplat/astro.config.ts @@ -342,9 +342,6 @@ export default createDocsSite({ href: mode === 'production' ? `${PROD_HOST}${b}` : `${STAGING_HOST}${b}`, platform: key, })), - starlight: { - logo: { src: './public/favicon.svg' }, - }, integrations: [mdx()], vite: { plugins: [vitePluginPlatformTokens()], diff --git a/docs/xplat/src/content/jp/components/grids/hierarchical-grid/overview.mdx b/docs/xplat/src/content/jp/components/grids/hierarchical-grid/overview.mdx index aa86d3d70b..9a706f61a0 100644 --- a/docs/xplat/src/content/jp/components/grids/hierarchical-grid/overview.mdx +++ b/docs/xplat/src/content/jp/components/grids/hierarchical-grid/overview.mdx @@ -922,11 +922,7 @@ $custom-theme: grid-theme( ### サンプル - - + サンプルは、**テーマの変更**で選択したグローバル テーマの影響を受けません。 diff --git a/src/components/ThemingWidget.astro b/src/components/ThemingWidget.astro index 8549120fa5..76260882c3 100644 --- a/src/components/ThemingWidget.astro +++ b/src/components/ThemingWidget.astro @@ -2,10 +2,7 @@ /** * ThemingWidget * - * Renders the `` web component. Mirrors the - * behaviour from igniteui-docfx-template: - * template/partials/themeselect*.tmpl.partial - * src/app/handlers/theming.ts + * Renders the `` web component. * * Behaviour: * - `themeApiUrl` and `widgetVersion` are resolved from environment.json at @@ -87,9 +84,9 @@ const lang = language === 'jp' ? 'ja' : undefined; } // ── Replay theme into a newly loaded iframe ────────────────────────────── - // Mirrors docfx's onSampleIframeContentLoaded: when an iframe finishes - // loading we immediately push the persisted themeStyle into it so samples - // that loaded after a theme was already selected pick it up. + // When an iframe finishes loading we immediately push the persisted + // themeStyle into it so samples that loaded after a theme was already + // selected pick it up. function onIframeLoad(e: Event) { const iframe = e.target as HTMLIFrameElement; if (iframe.classList.contains('no-theming')) return; diff --git a/src/content.config.ts b/src/content.config.ts index 9381a24c26..b7b72b449e 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -5,7 +5,7 @@ import { z } from 'astro/zod'; import { createDocsCollection } from './content-helper.ts'; // TODO: remove these template-specific exclusions once the source repos add -// proper Starlight frontmatter to these files (no `title` → fail schema). +// proper frontmatter to these files (no `title` → fail schema). export const collections = { docs: createDocsCollection(process.env.DOCS_SOURCE_PATH, { exclude: [ diff --git a/src/integration.ts b/src/integration.ts index e7fc7acf35..22d22824a3 100644 --- a/src/integration.ts +++ b/src/integration.ts @@ -1,7 +1,7 @@ /** * integration.ts * - * Shared configuration helpers for Astro + Starlight docs sites. + * Shared configuration helpers for Astro docs sites. * All functions are independently usable; `createDocsSite` is the * convenience wrapper that composes them all. * @@ -23,10 +23,6 @@ * head: [ // extra entries after platform ones * { tag: 'link', attrs: { rel: 'stylesheet', href: '...' } }, * ], - * // Extra Starlight options (logo, social, editLink, customCss, …) - * starlight: { - * logo: { src: './public/favicon.svg' }, - * }, * // Extra Astro options (markdown, image, build, …) * markdown: { remarkPlugins: [] }, * }); @@ -40,7 +36,6 @@ * export default defineConfig({ * integrations: [ * siteMetaIntegration({ title: 'My Library', description: 'Reference docs.' }), - * starlight({ sidebar }), * ], * }); * @@ -65,7 +60,9 @@ import { buildSidebarFromToc } from './sidebar'; import { getNavConfig, getPlatformHead } from './platform'; import type { HeadEntry, PlatformKey, NavLang } from './platform.ts'; import { JSDOM } from 'jsdom'; -import { remarkDocfx, rehypeCodeView } from './plugins/remark-docfx'; +import { remarkEnvVars } from './plugins/remark-env-vars'; +import { remarkMdLinks } from './plugins/remark-md-links'; +import { remarkHtmlTransforms } from './plugins/remark-html-transforms'; /** Build / deployment mode. Drives env-var `DOCS_BUILD_MODE`. */ export type DocsMode = 'development' | 'staging' | 'production'; @@ -75,8 +72,8 @@ let _navHtmlCache: string | null = null; /** * Read `themeApiUrl` and `themingWidgetVersion` from the project's - * environment.json at build time. Mirrors the lookup order in remark-docfx.ts - * so both always resolve from the same file. + * environment.json at build time. Uses the same lookup order as the + * remark plugin so both always resolve from the same file. */ function readThemingEnv(sourcePath: string | undefined, envKey: string): { themeApiUrl: string; @@ -692,17 +689,12 @@ export interface CreateDocsSiteOptions { productLinks?: ProductLink[]; /** Extra Astro integrations appended after the built-in ones. */ integrations?: AstroIntegration[]; - /** - * @deprecated Starlight has been removed. This option is ignored. - * Use `head` for extra head entries and `integrations` for extra integrations. - */ - starlight?: Record; /** Any remaining keys are spread into `defineConfig` (markdown, image, build, …). */ [key: string]: unknown; } /** - * Creates a complete Astro config for a standard Starlight docs site. + * Creates a complete Astro config for a docs site. * * All individual helpers (`buildSidebarFromToc`, `siteMetaIntegration`) * remain independently importable for cases that need finer control. @@ -741,7 +733,7 @@ export function createDocsSite(options: CreateDocsSiteOptions = {} as CreateDocs if (!process.env.DOCS_ENV) { process.env.DOCS_ENV = mode; } - // Expose the platform so remark-docfx can set data-platform on widgets it generates. + // Expose the platform so the remark plugin can set data-platform on widgets it generates. if (platform) { process.env.DOCS_PLATFORM = platform; } @@ -802,11 +794,12 @@ export function createDocsSite(options: CreateDocsSiteOptions = {} as CreateDocs markdown: { ...(astroExtra as any).markdown, remarkPlugins: [ - remarkDocfx, + remarkEnvVars, + remarkMdLinks, + remarkHtmlTransforms, ...((astroExtra as any).markdown?.remarkPlugins ?? []), ], rehypePlugins: [ - rehypeCodeView, ...((astroExtra as any).markdown?.rehypePlugins ?? []), ], }, diff --git a/src/platform.ts b/src/platform.ts index c7ec642c91..7fada3476e 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -2,14 +2,11 @@ * platform.ts * * Central registry of per-platform CDN assets (styles / scripts) and nav - * endpoint configuration, ported from igniteui-docfx-template: - * - template/partials/head.tmpl.partial (styles + AppBuilder init script) - * - template/partials/scripts.tmpl.partial (scripts per platform) - * - template/conceptual.html.primary.js (platform flag derivation) + * endpoint configuration. * * Usage from astro.config.ts: * import { getPlatformHead } from './src/platform.ts'; - * // inside starlight({ head: getPlatformHead('angular', 'en') }) + * // inside createDocsSite({ head: getPlatformHead('angular', 'en') }) * * Usage from integration.ts: * import { getNavConfig } from './platform.ts'; @@ -20,12 +17,12 @@ // Types // --------------------------------------------------------------------------- -/** HTML tag names accepted by Starlight's `head` array. */ +/** HTML tag names accepted by the `head` array. */ export type HeadTag = | 'title' | 'link' | 'style' | 'base' | 'meta' | 'script' | 'noscript' | 'template'; -/** Single entry in Starlight's `head` array — tag, attrs, optional content. */ +/** Single entry in the `head` array — tag, attrs, optional content. */ export type HeadEntry = { tag: HeadTag; attrs?: Record; @@ -75,8 +72,8 @@ export interface NavConfig { // --------------------------------------------------------------------------- const IG_STYLES: HeadEntry[] = [ // Bootstrap is wrapped in a CSS cascade layer so its global resets do not - // bleed into the Starlight theme. The layer priority order is declared at - // the top of custom.css: @layer bootstrap, starlight.core, starlight.overrides + // bleed into the site theme. The layer priority order is declared at + // the top of custom.css: @layer bootstrap // Note: @import layer() does not support the `integrity` SRI attribute. { tag: 'style', @@ -116,7 +113,7 @@ const APPBUILDER_STYLES: HeadEntry[] = [ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://staging.appbuilder.dev/wp-content/plugins/megamenu-pro/icons/genericons/genericons/genericons.css', media: 'all' } }, { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://staging.appbuilder.dev/wp-content/plugins/megamenu-pro/icons/fontawesome6/css/all.min.css', media: 'all' } }, // Bootstrap v4.4 partials — wrapped in a CSS cascade layer so they don't - // override the Starlight theme. See custom.css @layer declaration. + // override the site theme. See custom.css @layer declaration. { tag: 'style', content: [ @@ -239,8 +236,8 @@ export const IGDOCS_PLATFORMS: Record = { }; /** - * Returns an array of Starlight `head` entries for the given platform. - * Pass the result directly to `starlight({ head: getPlatformHead(...) })`. + * Returns an array of `head` entries for the given platform. + * Pass the result directly to `createDocsSite({ head: getPlatformHead(...) })`. * * @param platform - Platform identifier. * @param lang - Locale — not currently used but kept for API completeness. diff --git a/src/plugins/remark-docfx.ts b/src/plugins/remark-docfx.ts deleted file mode 100644 index 8e1803997c..0000000000 --- a/src/plugins/remark-docfx.ts +++ /dev/null @@ -1,395 +0,0 @@ -/** - * Remark plugin that transforms docfx-specific markdown syntax into - * standard HTML / markdown that Starlight can render. - * - * Handles: - * 1. {environment:...} variable substitution in text, links, and raw HTML - * 2. elements -> .ig-code-view placeholder divs (enhanced by code-view.js) - * 3.
->
- * 4. Relative .md link rewriting for Astro trailing-slash URLs - */ - -import { visit } from 'unist-util-visit'; -import fs from 'node:fs'; -import path from 'node:path'; - -// ENV is loaded lazily the first time replaceEnvVars() is called — NOT at -// module load time. Module-level code runs while the Astro config is being -// evaluated, before createDocsSite() has had a chance to set DOCS_SOURCE_PATH. -// Deferring the load ensures we read the correct environment.json for the -// active project (Angular, Blazor, React, WC, …). -let _ENV: Record | null = null; -let _envSourcePath: string | null = null; // tracks which DOCS_SOURCE_PATH was used - -const DOCCONFIG_PLATFORM_MAP: Record = { - angular: 'Angular', - react: 'React', - 'web-components': 'WebComponents', - blazor: 'Blazor', -}; - -function loadEnv(): Record { - const currentPath = process.env.DOCS_SOURCE_PATH ?? null; - // Re-load if the source path changed (e.g. two projects built in the same process) - if (_ENV !== null && currentPath === _envSourcePath) return _ENV as Record; - _envSourcePath = currentPath; - _ENV = null; - - if (!process.env.DOCS_SOURCE_PATH) { _ENV = {}; return _ENV as Record; } - const sourceRoot = path.resolve(process.env.DOCS_SOURCE_PATH); - - // Search order: - // 1. {docsDir}/en/environment.json — docfx repo layout - // 2. {docsDir}/environment.json — flat layout - // 3. {docsDir}/../environment.json — xplat layout: docsDir = dist/{P}/{lang}/components, - // environment.json lives one level up - // 4. {docsDir}/../en/environment.json - const parent = path.dirname(sourceRoot); - const candidates = [ - path.join(sourceRoot, 'en', 'environment.json'), - path.join(sourceRoot, 'environment.json'), - path.join(parent, 'environment.json'), - path.join(parent, 'en', 'environment.json'), - ]; - - const envPath = candidates.find(c => fs.existsSync(c)); - if (!envPath) { - // Fallback: read samplesBrowsers from docConfig.json (no generate step needed). - // Mirrors the same fallback in src/lib/platform-context.ts getEnvVars(). - try { - const envKey = process.env.DOCS_ENV ?? process.env.NODE_ENV ?? 'production'; - const docConfigPlatform = DOCCONFIG_PLATFORM_MAP[process.env.DOCS_PLATFORM ?? ''] ?? ''; - if (docConfigPlatform) { - const docConfig = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), 'docConfig.json'), 'utf-8')); - const demosUrl: string = - docConfig[docConfigPlatform]?.samplesBrowsers?.[envKey] ?? - docConfig[docConfigPlatform]?.samplesBrowsers?.['development'] ?? - ''; - _ENV = { dvDemosBaseUrl: demosUrl, demosBaseUrl: demosUrl, infragisticsBaseUrl: 'https://www.infragistics.com' }; - } else { - _ENV = {}; - } - } catch { - _ENV = {}; - } - return _ENV; - } - - try { - const envData = JSON.parse(fs.readFileSync(envPath, 'utf-8')); - // DOCS_ENV overrides explicitly (useful for staging builds). - // Otherwise fall back to NODE_ENV ('development' | 'production'). - // Matches environment.json keys: development / staging / production. - const envKey = process.env.DOCS_ENV ?? process.env.NODE_ENV ?? 'production'; - _ENV = envData[envKey] ?? envData.production ?? {}; - } catch { - _ENV = {}; - } - - return _ENV as Record; -} - -const ENV_PATTERN = /\{environment:(\w+)\}/g; - -/** - * Rewrite a relative .md link to a root-relative Astro URL. - * Absolute, root-relative, fragment-only, and protocol links are left untouched. - * @param url - Raw link URL from the markdown AST. - * @param filePath - Absolute path of the current .md file. - * @param docsDir - Absolute path to the docs root (DOCS_SOURCE_PATH). - */ -function rewriteMdLink(url: string, filePath: string, docsDir: string): string { - if (!url) return url; - if ( - url.startsWith('http://') || url.startsWith('https://') || - url.startsWith('/') || url.startsWith('#') || url.startsWith('mailto:') - ) return url; - - // Separate path from fragment / query-string suffix. - const hashIdx = url.indexOf('#'); - const qIdx = url.indexOf('?'); - const splitAt = hashIdx !== -1 ? hashIdx : qIdx !== -1 ? qIdx : -1; - let mdPath = splitAt !== -1 ? url.slice(0, splitAt) : url; - const suffix = splitAt !== -1 ? url.slice(splitAt) : ''; - - if (!mdPath.endsWith('.md')) return url; - - // Resolve the link relative to the current file's directory. - const fileDir = path.dirname(filePath); - const resolved = path.resolve(fileDir, mdPath); - - // Compute the slug: path relative to docsDir, forward slashes, no .md extension. - const rel = path.relative(docsDir, resolved).replace(/\\/g, '/'); - const slug = rel.endsWith('.md') ? rel.slice(0, -3) : rel; - - // Return a URL with the site base prepended so links remain correct when - // the site is mounted at a sub-path (e.g. /docs-react-new/). - // DOCS_BASE is set by createDocsSite() in integration.ts; it is empty in dev mode. - const docsBase = (process.env.DOCS_BASE ?? '').replace(/\/$/, ''); - return docsBase + '/' + slug.toLowerCase() + '/' + suffix; -} - -export function replaceEnvVars(str: string): string { - if (!str || typeof str !== 'string') return str; - const env = loadEnv(); - return str.replace(ENV_PATTERN, (_match, key) => env[key] ?? `{environment:${key}}`); -} - -/** - * Build the pre-rendered widget HTML shell (matches the Sample.astro structure). - * Picked up at runtime by sample-widget.ts via `.code-view[data-platform]`. - */ -function buildWidgetHtml( - src: string, - demosBase: string, - githubSrc: string, - height: string, - alt: string, - platform: string, -): string { - const widgetId = 'cw' + src.replace(/[^a-z0-9]/gi, '-'); - const tabId = `${widgetId}-example`; - const safeAlt = alt.replace(/"/g, '"'); - return ( - `
` + - `
` + - `
EXAMPLE
` + - `` + - `
` + - `
` + - `
` + - `` + - `
` + - `
` + - `
` - ); -} - -/** - * Transform ... raw HTML blocks into the - * pre-rendered widget shell consumed by sample-widget.ts at runtime. - */ -function transformCodeView(html: string): string { - return html.replace( - /\s*(?:<\/code-view>)?/g, - (_match, attrs: string) => { - const stackblitzMatch = attrs.match(/stackblitz="([^"]*)"/); - const codesandboxMatch = attrs.match(/codesandbox="([^"]*)"/); - const srcMatch = attrs.match(/iframe-src="([^"]*)"/); - const demosBaseMatch = attrs.match(/data-demos-base-url="([^"]*)"/); - const githubSrcMatch = attrs.match(/github-src="([^"]*)"/); - const heightMatch = attrs.match(/style="height:\s*(\d+px)"/); - const altMatch = attrs.match(/alt="([^"]*)"/); - const height = heightMatch ? heightMatch[1] : '400px'; - const alt = altMatch ? altMatch[1] : 'Demo'; - - // Explicit StackBlitz embed (stackblitz="") - if (stackblitzMatch) { - const project = replaceEnvVars(stackblitzMatch[1]); - const embedUrl = project.startsWith('http') - ? project - : `https://stackblitz.com/edit/${project}?embed=1&file=src/app/app.component.ts`; - return ``; - } - - // Explicit CodeSandbox embed (codesandbox="") - if (codesandboxMatch) { - const project = replaceEnvVars(codesandboxMatch[1]); - const embedUrl = project.startsWith('http') - ? project - : `https://codesandbox.io/embed/${project}?fontsize=14&hidenavigation=1&theme=light`; - return ``; - } - - // Standard docfx code-view with iframe-src + data-demos-base-url. - // Output the pre-rendered widget shell; sample-widget.ts activates it at runtime. - if (srcMatch) { - const src = replaceEnvVars(srcMatch[1]); - if (!src || src.includes('{environment:')) return ''; // env var not resolved - const demosBaseUrl = demosBaseMatch ? replaceEnvVars(demosBaseMatch[1]) : ''; - const githubSrc = githubSrcMatch ? githubSrcMatch[1] : ''; - const platform = process.env.DOCS_PLATFORM || 'angular'; - return buildWidgetHtml(src, demosBaseUrl, githubSrc, height, alt, platform); - } - - return ''; - } - ); -} - -/** - * Transform
into
- */ -function transformDividers(html: string): string { - return html.replace(/\s*<\/div>/g, '
'); -} - -function strVal(v: unknown): string { - return typeof v === 'string' ? v : Array.isArray(v) ? v.join(' ') : String(v ?? ''); -} - -/** - * Rehype plugin — transforms elements into the pre-rendered widget shell. - * - * Handles two HAST representations depending on what's in the pipeline: - * - * 1. `element` nodes (tagName === 'code-view') — produced when rehype-raw is - * present and re-parses raw HTML fragments into proper HAST elements. - * - * 2. `raw` string nodes — produced when rehype-raw is NOT in the pipeline - * (e.g. Astro content-collection .md files). In that case multiline - * blocks are opaque raw strings; we run the same regex - * transformer used in the remark stage. - */ -export function rehypeCodeView() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return (tree: any) => { - // ── 1. element nodes (after rehype-raw) ────────────────────────────────── - // eslint-disable-next-line @typescript-eslint/no-explicit-any - visit(tree, 'element', (node: any) => { - if (node.tagName !== 'code-view') return; - - const p = node.properties || {}; - - // HAST converts hyphenated attributes to camelCase via property-information. - const iframeSrc = strVal(p.iframeSrc ?? p['iframe-src'] ?? ''); - const demosBase = strVal(p.dataDemosBaseUrl ?? p['data-demos-base-url'] ?? ''); - const githubSrc = strVal(p.githubSrc ?? p['github-src'] ?? ''); - const styleStr = strVal(p.style ?? ''); - const alt = strVal(p.alt ?? 'Demo'); - - const src = replaceEnvVars(iframeSrc); - const baseUrl = replaceEnvVars(demosBase); - - if (!src || src.includes('{environment:')) return; - - const heightMatch = styleStr.match(/height:\s*(\d+\s*px)/i); - const height = heightMatch ? heightMatch[1].replace(/\s+/, '') : '400px'; - const platform = process.env.DOCS_PLATFORM || 'angular'; - const widgetId = 'cw' + src.replace(/[^a-z0-9]/gi, '-'); - const tabId = `${widgetId}-example`; - - node.tagName = 'div'; - node.properties = { - className: ['code-view'], - id: widgetId, - 'data-iframe-src': src, - 'data-platform': platform, - ...(baseUrl ? { 'data-demos-base-url': baseUrl } : {}), - ...(githubSrc ? { 'data-github-src': githubSrc } : {}), - }; - node.children = [ - { - type: 'element', tagName: 'div', - properties: { className: ['code-view-navbar'] }, - children: [ - { - type: 'element', tagName: 'div', - properties: { className: ['code-view-tab', 'code-view-tab--active'], 'data-tab-id': tabId }, - children: [{ type: 'text', value: 'EXAMPLE' }], - }, - { - type: 'element', tagName: 'span', - properties: { className: ['fs-button-container'], title: 'Expand to fullscreen' }, - children: [], - }, - ], - }, - { - type: 'element', tagName: 'div', - properties: { className: ['code-views-container'] }, - children: [ - { - type: 'element', tagName: 'div', - properties: { - id: tabId, - className: ['sample-container', 'code-view-tab-content', 'loading'], - style: `height: ${height}`, - }, - children: [ - { - type: 'element', tagName: 'iframe', - properties: { - 'data-src': src, - title: alt, - style: 'width: 100%; height: 100%;', - frameBorder: '0', - seamless: '', - }, - children: [], - }, - ], - }, - ], - }, - ]; - }); - - // ── 2. raw string nodes (no rehype-raw in pipeline) ────────────────────── - // eslint-disable-next-line @typescript-eslint/no-explicit-any - visit(tree, 'raw', (node: any) => { - if (!node.value || !node.value.includes(' { - const filePath = (file.path as string) ?? ''; - const docsDir = process.env.DOCS_SOURCE_PATH - ? path.resolve(process.env.DOCS_SOURCE_PATH) - : (filePath ? path.dirname(filePath) : ''); - // 1. Walk the AST and replace environment variables in text/links/html - // eslint-disable-next-line @typescript-eslint/no-explicit-any - visit(tree, (node: any) => { - // Text nodes - if (node.type === 'text' && node.value) { - node.value = replaceEnvVars(node.value as string); - } - - // Links - if (node.type === 'link' && node.url) { - node.url = replaceEnvVars(node.url as string); - node.url = rewriteMdLink(node.url as string, filePath, docsDir); - // Prepend DOCS_BASE to root-relative internal links that were not already - // rewritten by rewriteMdLink (e.g. bare /grids/grid/… links that skip - // the .md-only rewriter above). - const docsBase = (process.env.DOCS_BASE ?? '').replace(/\/$/, ''); - if ( - docsBase && - (node.url as string).startsWith('/') && - !(node.url as string).startsWith('//') && - !(node.url as string).startsWith(docsBase + '/') - ) { - node.url = docsBase + (node.url as string); - } - } - - // Images - if (node.type === 'image' && node.url) { - node.url = replaceEnvVars(node.url as string); - node.url = (node.url as string).replace(/^(\.\.\/)+images\//, '/images/'); - } - - // Code blocks — normalize language identifiers to lowercase - if (node.type === 'code' && node.lang) { - node.lang = (node.lang as string).toLowerCase(); - } - - // Inline HTML - if (node.type === 'html' && node.value) { - node.value = replaceEnvVars(node.value as string); - node.value = transformCodeView(node.value as string); - node.value = transformDividers(node.value as string); - node.value = (node.value as string).replace(/src="(\.\.\/)+images\//g, 'src="/images/'); - } - }); - }; -} diff --git a/src/plugins/remark-env-vars.ts b/src/plugins/remark-env-vars.ts new file mode 100644 index 0000000000..1ea9838e6e --- /dev/null +++ b/src/plugins/remark-env-vars.ts @@ -0,0 +1,110 @@ +/** + * Remark plugin: environment variable substitution. + * + * Replaces `{environment:key}` tokens in markdown text, link URLs, image URLs, + * and inline HTML with values from the project's environment.json. + * + * Resolution order for environment.json: + * 1. {DOCS_SOURCE_PATH}/en/environment.json + * 2. {DOCS_SOURCE_PATH}/environment.json + * 3. {DOCS_SOURCE_PATH}/../environment.json + * 4. {DOCS_SOURCE_PATH}/../en/environment.json + * 5. Fallback: read demosBaseUrl from docConfig.json + * + * DOCS_ENV (or NODE_ENV) selects the env block: development | staging | production. + */ + +import { visit } from 'unist-util-visit'; +import fs from 'node:fs'; +import path from 'node:path'; + +const ENV_PATTERN = /\{environment:(\w+)\}/g; + +const DOCCONFIG_PLATFORM_MAP: Record = { + angular: 'Angular', + react: 'React', + 'web-components': 'WebComponents', + blazor: 'Blazor', +}; + +// Lazy-loaded, cached per DOCS_SOURCE_PATH value. +let _env: Record | null = null; +let _envSourcePath: string | null = null; + +function loadEnv(): Record { + const currentPath = process.env.DOCS_SOURCE_PATH ?? null; + if (_env !== null && currentPath === _envSourcePath) return _env; + _envSourcePath = currentPath; + _env = null; + + if (!currentPath) { _env = {}; return _env; } + const sourceRoot = path.resolve(currentPath); + const parent = path.dirname(sourceRoot); + + const candidates = [ + path.join(sourceRoot, 'en', 'environment.json'), + path.join(sourceRoot, 'environment.json'), + path.join(parent, 'environment.json'), + path.join(parent, 'en', 'environment.json'), + ]; + + const envPath = candidates.find(c => fs.existsSync(c)); + + if (!envPath) { + try { + const envKey = process.env.DOCS_ENV ?? process.env.NODE_ENV ?? 'production'; + const platform = DOCCONFIG_PLATFORM_MAP[process.env.DOCS_PLATFORM ?? ''] ?? ''; + if (platform) { + const configPath = path.resolve(process.cwd(), 'docConfig.json'); + const docConfig = JSON.parse(fs.readFileSync(configPath, 'utf-8')); + const demosUrl: string = + docConfig[platform]?.samplesBrowsers?.[envKey] ?? + docConfig[platform]?.samplesBrowsers?.['development'] ?? ''; + _env = { dvDemosBaseUrl: demosUrl, demosBaseUrl: demosUrl, infragisticsBaseUrl: 'https://www.infragistics.com' }; + } else { + _env = {}; + } + } catch { + _env = {}; + } + return _env; + } + + try { + const data = JSON.parse(fs.readFileSync(envPath, 'utf-8')); + const envKey = process.env.DOCS_ENV ?? process.env.NODE_ENV ?? 'production'; + _env = data[envKey] ?? data.production ?? {}; + } catch { + _env = {}; + } + return _env!; +} + +/** Replace all `{environment:key}` tokens in a string. Exported for use by other modules. */ +export function replaceEnvVars(str: string): string { + if (!str || typeof str !== 'string') return str; + const env = loadEnv(); + return str.replace(ENV_PATTERN, (_match, key) => env[key] ?? `{environment:${key}}`); +} + +/** Remark plugin that substitutes `{environment:key}` tokens in the markdown AST. */ +export function remarkEnvVars() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (tree: any) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + visit(tree, (node: any) => { + if (node.type === 'text' && node.value) { + node.value = replaceEnvVars(node.value); + } + if (node.type === 'link' && node.url) { + node.url = replaceEnvVars(node.url); + } + if (node.type === 'image' && node.url) { + node.url = replaceEnvVars(node.url); + } + if (node.type === 'html' && node.value) { + node.value = replaceEnvVars(node.value); + } + }); + }; +} diff --git a/src/plugins/remark-html-transforms.ts b/src/plugins/remark-html-transforms.ts new file mode 100644 index 0000000000..313366127a --- /dev/null +++ b/src/plugins/remark-html-transforms.ts @@ -0,0 +1,30 @@ +/** + * Remark plugin: inline HTML transforms. + * + * Handles legacy HTML patterns in markdown content: + * - `
` → `
` + * - Normalizes code block language identifiers to lowercase + */ + +import { visit } from 'unist-util-visit'; + +const DIVIDER_PATTERN = /\s*<\/div>/g; + +/** Remark plugin that transforms legacy HTML patterns in the AST. */ +export function remarkHtmlTransforms() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (tree: any) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + visit(tree, (node: any) => { + // Inline HTML: divider → hr + if (node.type === 'html' && node.value) { + node.value = (node.value as string).replace(DIVIDER_PATTERN, '
'); + } + + // Code blocks: normalize language to lowercase + if (node.type === 'code' && node.lang) { + node.lang = (node.lang as string).toLowerCase(); + } + }); + }; +} diff --git a/src/plugins/remark-md-links.ts b/src/plugins/remark-md-links.ts new file mode 100644 index 0000000000..a7b89ae086 --- /dev/null +++ b/src/plugins/remark-md-links.ts @@ -0,0 +1,67 @@ +/** + * Remark plugin: rewrite relative .md links to Astro-compatible URLs. + * + * Transforms `[label](./some-page.md)` or `[label](../folder/page.md#section)` + * into root-relative URLs like `/products/.../some-page/` (with DOCS_BASE prepended). + * + * Also prepends DOCS_BASE to bare root-relative internal links (e.g. `/grids/grid/...`) + * that are already absolute but missing the site base path. + */ + +import { visit } from 'unist-util-visit'; +import path from 'node:path'; + +/** + * Resolve a relative .md link to an absolute Astro URL. + * Non-relative, non-.md, and external links are returned unchanged. + */ +function rewriteMdLink(url: string, filePath: string, docsDir: string): string { + if (!url) return url; + if ( + url.startsWith('http://') || url.startsWith('https://') || + url.startsWith('/') || url.startsWith('#') || url.startsWith('mailto:') + ) return url; + + const hashIdx = url.indexOf('#'); + const qIdx = url.indexOf('?'); + const splitAt = hashIdx !== -1 ? hashIdx : qIdx !== -1 ? qIdx : -1; + let mdPath = splitAt !== -1 ? url.slice(0, splitAt) : url; + const suffix = splitAt !== -1 ? url.slice(splitAt) : ''; + + if (!mdPath.endsWith('.md')) return url; + + const fileDir = path.dirname(filePath); + const resolved = path.resolve(fileDir, mdPath); + const rel = path.relative(docsDir, resolved).replace(/\\/g, '/'); + const slug = rel.endsWith('.md') ? rel.slice(0, -3) : rel; + + const docsBase = (process.env.DOCS_BASE ?? '').replace(/\/$/, ''); + return docsBase + '/' + slug.toLowerCase() + '/' + suffix; +} + +/** Remark plugin that rewrites relative .md links and prepends DOCS_BASE. */ +export function remarkMdLinks() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (tree: any, file: any) => { + const filePath = (file.path as string) ?? ''; + const docsDir = process.env.DOCS_SOURCE_PATH + ? path.resolve(process.env.DOCS_SOURCE_PATH) + : (filePath ? path.dirname(filePath) : ''); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + visit(tree, 'link', (node: any) => { + node.url = rewriteMdLink(node.url as string, filePath, docsDir); + + // Prepend DOCS_BASE to root-relative internal links not already prefixed. + const docsBase = (process.env.DOCS_BASE ?? '').replace(/\/$/, ''); + if ( + docsBase && + (node.url as string).startsWith('/') && + !(node.url as string).startsWith('//') && + !(node.url as string).startsWith(docsBase + '/') + ) { + node.url = docsBase + (node.url as string); + } + }); + }; +} diff --git a/src/sidebar.ts b/src/sidebar.ts index ca47a8726c..0862cb777a 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -1,7 +1,7 @@ /** * sidebar.ts * - * Builds an Astro Starlight sidebar from a YAML or JSON TOC file. + * Builds an Astro sidebar from a YAML or JSON TOC file. * Source-agnostic: consuming repos pass their own paths. * * Usage in a consuming repo's astro.config.ts: @@ -102,7 +102,7 @@ function convertTocItem( if (item.href) { if (!docExists(docsDir, item.href, exclude)) return null; const entry: SidebarLink = { label: item.name, slug: hrefToSlug(item.href) }; - // Status badge — only one slot available in Starlight, priority order: + // Status badge — only one slot available, priority order: if (item.new) entry.badge = { text: 'New', variant: 'success' }; else if (item.preview) entry.badge = { text: 'Preview', variant: 'caution' }; else if (item.updated) entry.badge = { text: 'Updated', variant: 'note' }; @@ -133,7 +133,7 @@ export interface BuildSidebarFromTocOptions { } /** - * Reads a YAML or JSON TOC file and converts it to a Starlight sidebar array. + * Reads a YAML or JSON TOC file and converts it to a sidebar array. */ export function buildSidebarFromToc({ tocPath, docsDir, exclude = [] }: BuildSidebarFromTocOptions): SidebarEntry[] { if (!tocPath || !fs.existsSync(tocPath)) return []; diff --git a/src/styles/custom.css b/src/styles/custom.css index 0c44289d0b..d58718f3d8 100644 --- a/src/styles/custom.css +++ b/src/styles/custom.css @@ -70,7 +70,7 @@ kbd { } /* ── Code-view widget ───────────────────────────────────────────────────────── - Ported from igniteui-docfx-template/src/styles/shared/components/_code-view.scss + Styles for the code-view / sample widget component. ─────────────────────────────────────────────────────────────────────────── */ .ig-code-view, diff --git a/src/styles/ig-theme.scss b/src/styles/ig-theme.scss index caaedaafbb..2a8a0d71aa 100644 --- a/src/styles/ig-theme.scss +++ b/src/styles/ig-theme.scss @@ -18,7 +18,7 @@ $ig-palette: palette( @include palette($ig-palette); -// Starlight accent bridge — maps IG palette shades to Starlight accent vars +// Accent bridge — maps IG palette shades to --sl-color-accent-* CSS vars [data-theme='light'] { --sl-color-accent-low: var(--ig-primary-200); --sl-color-accent: var(--ig-primary-500); @@ -26,7 +26,7 @@ $ig-palette: palette( } // Dark mode — re-emit palette with lighter primary/secondary for legibility -// on dark surfaces. Starlight writes [data-theme='dark'] on . +// on dark surfaces. The theme sets [data-theme='dark'] on . [data-theme='dark'] { $ig-palette-dark: palette( $primary: #4db8ff, From f52aaff5472116d95c1d54d03d2ea267388177b5 Mon Sep 17 00:00:00 2001 From: Viktor Kombov Date: Wed, 13 May 2026 12:40:28 +0300 Subject: [PATCH 2/7] chore: update remark plugins to fix relative image paths and enhance link handling --- src/plugins/remark-html-transforms.ts | 4 +++- src/plugins/remark-md-links.ts | 32 +++++++++++++++++---------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/plugins/remark-html-transforms.ts b/src/plugins/remark-html-transforms.ts index 313366127a..701010ae78 100644 --- a/src/plugins/remark-html-transforms.ts +++ b/src/plugins/remark-html-transforms.ts @@ -9,6 +9,7 @@ import { visit } from 'unist-util-visit'; const DIVIDER_PATTERN = /\s*<\/div>/g; +const IMG_SRC_PATTERN = /src="(\.\.\/)+images\//g; /** Remark plugin that transforms legacy HTML patterns in the AST. */ export function remarkHtmlTransforms() { @@ -16,9 +17,10 @@ export function remarkHtmlTransforms() { return (tree: any) => { // eslint-disable-next-line @typescript-eslint/no-explicit-any visit(tree, (node: any) => { - // Inline HTML: divider → hr + // Inline HTML: divider → hr, relative img src → root-relative if (node.type === 'html' && node.value) { node.value = (node.value as string).replace(DIVIDER_PATTERN, '
'); + node.value = (node.value as string).replace(IMG_SRC_PATTERN, 'src="/images/'); } // Code blocks: normalize language to lowercase diff --git a/src/plugins/remark-md-links.ts b/src/plugins/remark-md-links.ts index a7b89ae086..8fe567d3f9 100644 --- a/src/plugins/remark-md-links.ts +++ b/src/plugins/remark-md-links.ts @@ -39,7 +39,7 @@ function rewriteMdLink(url: string, filePath: string, docsDir: string): string { return docsBase + '/' + slug.toLowerCase() + '/' + suffix; } -/** Remark plugin that rewrites relative .md links and prepends DOCS_BASE. */ +/** Remark plugin that rewrites relative .md links, prepends DOCS_BASE, and fixes relative image paths. */ export function remarkMdLinks() { // eslint-disable-next-line @typescript-eslint/no-explicit-any return (tree: any, file: any) => { @@ -49,18 +49,26 @@ export function remarkMdLinks() { : (filePath ? path.dirname(filePath) : ''); // eslint-disable-next-line @typescript-eslint/no-explicit-any - visit(tree, 'link', (node: any) => { - node.url = rewriteMdLink(node.url as string, filePath, docsDir); + visit(tree, (node: any) => { + if (node.type === 'link' && node.url) { + node.url = rewriteMdLink(node.url as string, filePath, docsDir); - // Prepend DOCS_BASE to root-relative internal links not already prefixed. - const docsBase = (process.env.DOCS_BASE ?? '').replace(/\/$/, ''); - if ( - docsBase && - (node.url as string).startsWith('/') && - !(node.url as string).startsWith('//') && - !(node.url as string).startsWith(docsBase + '/') - ) { - node.url = docsBase + (node.url as string); + // Prepend DOCS_BASE to root-relative internal links not already prefixed. + const docsBase = (process.env.DOCS_BASE ?? '').replace(/\/$/, ''); + if ( + docsBase && + (node.url as string).startsWith('/') && + !(node.url as string).startsWith('//') && + !(node.url as string).startsWith(docsBase + '/') + ) { + node.url = docsBase + (node.url as string); + } + } + + // Rewrite relative `../images/` paths in markdown image nodes to root-relative `/images/`. + // Generated MDX files may contain relative image references that Vite cannot resolve. + if (node.type === 'image' && node.url) { + node.url = (node.url as string).replace(/^(\.\.\/)+images\//, '/images/'); } }); }; From 298b18a4e81774cc2fcffc5414c763ed7b4744a2 Mon Sep 17 00:00:00 2001 From: Viktor Kombov Date: Wed, 13 May 2026 14:29:35 +0300 Subject: [PATCH 3/7] refactor: remove build-time nav prefetch and clean up stale type declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove all nav HTML prefetch logic from siteMetaIntegration: stripScripts(), absolutifyNavUrls(), extractOuterHtml() helpers, _navHtmlCache, IG nav fetch block, AppBuilder nav fetch block - Remove getNavConfig and JSDOM imports; remove prefetchNav / prefetchAppBuilderNav deprecated options from SiteMetaOptions - The nav-html virtual module is kept (consumed by igniteui-astro- components) but now only exports theming config (themeApiUrl, widgetScriptSrc, platform, navLang) plus empty/false stubs for nav HTML fields — GlobalNavBar/GlobalFooter now fetch nav at request time via fetchIgNav() - Replace stale inline virtual-module declarations in docs/angular/src/env.d.ts with a reference directive (matching docs/xplat/src/env.d.ts) - Remove stale getNavConfig JSDoc example from platform.ts - Remove stale header/footer prefetch comment from ThemingWidget.astro --- docs/angular/src/env.d.ts | 23 +--- src/components/ThemingWidget.astro | 3 +- src/integration.ts | 204 +++-------------------------- src/platform.ts | 3 - src/virtual-modules.d.ts | 12 +- 5 files changed, 21 insertions(+), 224 deletions(-) diff --git a/docs/angular/src/env.d.ts b/docs/angular/src/env.d.ts index d072f07e4c..247311d29f 100644 --- a/docs/angular/src/env.d.ts +++ b/docs/angular/src/env.d.ts @@ -1,22 +1 @@ -declare module 'virtual:docs-template/site-meta' { - export const title: string; - export const description: string; - export const sidebar: { label: string; slug?: string; items?: unknown[] }[]; - export const mode: 'dev' | 'staging' | 'prod'; - export const trailingSlash: 'always' | 'never' | 'ignore'; -} - -declare module 'virtual:docs-template/nav-html' { - export const platform: 'igniteui' | 'angular' | 'react' | 'blazor' | 'web-components' | 'slingshot' | 'appbuilder' | null; - export const navLang: string; - export const prefetched: boolean; - export const headerHtml: string; - export const uiFooterHtml: string; - export const footerHtml: string; - export const abPrefetched: boolean; - export const abHeaderHtml: string; - export const abFooterHtml: string; - export const abFooterUtilsHtml: string; - export const abFooterCopyrightHtml: string; - export const abContactSalesHtml: string; -} \ No newline at end of file +/// \ No newline at end of file diff --git a/src/components/ThemingWidget.astro b/src/components/ThemingWidget.astro index 76260882c3..5bfca0dfbd 100644 --- a/src/components/ThemingWidget.astro +++ b/src/components/ThemingWidget.astro @@ -6,8 +6,7 @@ * * Behaviour: * - `themeApiUrl` and `widgetVersion` are resolved from environment.json at - * build time via the `virtual:docs-template/nav-html` virtual module - * (same step as the header/footer prefetch in siteMetaIntegration). + * build time via the `virtual:docs-template/nav-html` virtual module. * - Renders nothing when `themeApiUrl` is unavailable. * - The widget container starts hidden and is revealed client-side only * when at least one themeable `