igniteui-astro-components 0.0.6 → 0.0.8
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 +9 -8
- package/package.json +7 -5
- package/src/assets/icons/open-link-blank.svg +1 -1
- package/src/assets/logos/code-sandbox.svg +14 -0
- package/src/assets/logos/stackblitz.svg +13 -0
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +1 -1
- package/src/components/DocsSidebar/DocsSidebar.astro +15 -8
- package/src/components/DocsSidebar/DocsSidebar.scss +152 -2
- package/src/components/DocsSidebar/SidebarFilterInput.scss +7 -3
- package/src/components/DocsSidebar/SidebarLabel.astro +25 -4
- package/src/components/DocsSidebar/toTreeNodes.ts +1 -1
- package/src/components/DocsSubHeader/DocsSubHeader.astro +119 -302
- package/src/components/DocsSubHeader/DocsSubHeader.scss +111 -11
- package/src/components/DocsToc/DocsToc.astro +5 -2
- package/src/components/DocsToc/toTreeNodes.ts +1 -1
- package/src/components/DocsTree/DocsTree.astro +9 -0
- package/src/components/DocsTree/docs-tree.scss +139 -118
- package/src/components/GlobalFooter/GlobalFooter.astro +12 -62
- package/src/components/GlobalFooter/README.md +7 -10
- package/src/components/GlobalNavBar/GlobalNavBar.astro +8 -193
- package/src/components/GlobalNavBar/GlobalNavBar.module.scss +16 -6
- package/src/components/GlobalNavBar/README.md +8 -15
- package/src/components/LicenseIndicator/LicenseIndicator.astro +19 -0
- package/src/components/LicenseIndicator/LicenseIndicator.scss +5 -0
- package/src/components/Search/Search.astro +34 -15
- package/src/components/Search/Search.scss +10 -42
- package/src/components/SearchAdvanced/SearchAdvanced.astro +202 -366
- package/src/components/SearchAdvanced/SearchAdvanced.scss +177 -0
- package/src/components/ThemingWidget/ThemingWidget.astro +5 -10
- package/src/components/mdx/ApiRef/README.md +1 -1
- package/src/components/mdx/DocsAside/DocsAside.astro +37 -32
- package/src/components/mdx/DocsAside/DocsAside.scss +123 -35
- package/src/components/mdx/Sample/Sample.astro +55 -45
- package/src/components/mdx/Sample/Sample.scss +173 -30
- package/src/content.config.ts +1 -1
- package/src/integration.ts +25 -141
- package/src/layouts/DocsLayout/DocsLayout.astro +61 -20
- package/src/layouts/DocsLayout/DocsLayout.scss +51 -6
- package/src/lib/nav-helpers.ts +11 -4
- package/src/lib/sidebar/helpers.ts +14 -1
- package/src/lib/sidebar/types.ts +5 -7
- package/src/platform.ts +9 -16
- package/src/plugins/rehype-heading-anchors.ts +74 -0
- package/src/plugins/rehype-table-wrapper.ts +49 -0
- package/src/plugins/remark-docfx.ts +0 -368
- package/src/plugins/remark-env-vars.ts +110 -0
- package/src/plugins/remark-html-transforms.ts +32 -0
- package/src/plugins/remark-md-links.ts +75 -0
- package/src/scripts/sample-widget.ts +107 -116
- package/src/sidebar.ts +6 -7
- package/src/styles/global/_breakpoints.scss +4 -4
- package/src/styles/global/_code-blocks.scss +1 -1
- package/src/styles/global/_component-themes.scss +118 -18
- package/src/styles/global/_index.scss +2 -2
- package/src/styles/global/_markdown.scss +444 -32
- package/src/styles/global/_palette.scss +7 -0
- package/src/styles/global/_search-shared.scss +273 -0
- package/src/styles/global/_variables.scss +58 -3
- package/src/styles/theme.scss +80 -11
- package/src/virtual-modules.d.ts +1 -13
- package/src/assets/icons/copy-clipboard.svg +0 -3
- package/src/assets/icons/filter-clear.svg +0 -1
- package/src/styles/custom.scss +0 -20
|
@@ -1,32 +1,175 @@
|
|
|
1
|
+
@use 'igniteui-theming/sass/typography' as *;
|
|
2
|
+
|
|
3
|
+
igc-tabs {
|
|
4
|
+
position: relative;
|
|
5
|
+
z-index: 0;
|
|
6
|
+
width: 100%;
|
|
7
|
+
|
|
8
|
+
&::part(inner) {
|
|
9
|
+
flex-grow: 1;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
--item-text-color: var(--ig-gray-800);
|
|
13
|
+
--item-hover-color: var(--igd-accent);
|
|
14
|
+
--item-background: var(--igd-layout-sections-bg);
|
|
15
|
+
--item-hover-background: var(--igd-layout-sections-bg);
|
|
16
|
+
|
|
17
|
+
--item-active-color: var(--igd-accent);
|
|
18
|
+
--item-active-hover-color: var(--igd-accent);
|
|
19
|
+
--item-active-background: var(--igd-layout-sections-bg);
|
|
20
|
+
--item-active-hover-background: var(--igd-layout-sections-bg);
|
|
21
|
+
--indicator-color: var(--igd-accent);
|
|
22
|
+
|
|
23
|
+
--button-color: var(--ig-gray-800);
|
|
24
|
+
--button-hover-color: var(--igd-accent);
|
|
25
|
+
--button-background: var(--igd-layout-sections-bg);
|
|
26
|
+
--button-hover-background: var(--igd-layout-sections-bg);
|
|
27
|
+
|
|
28
|
+
.igd-code-view__header-actions {
|
|
29
|
+
border-block: rem(1px) solid var(--ig-gray-300);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.igd-sample-container {
|
|
33
|
+
border-inline: none;
|
|
34
|
+
border-block-end: none;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// TODO THIS IS A COMPONENT BUG LOG IT
|
|
39
|
+
igc-tab::part(start-scroll-button) {
|
|
40
|
+
inset-inline-start: -1px;
|
|
41
|
+
}
|
|
42
|
+
igc-tab::part(end-scroll-button) {
|
|
43
|
+
inset-inline-end: -1px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
igc-tab {
|
|
47
|
+
.code-wrapper {
|
|
48
|
+
position: relative;
|
|
49
|
+
border-radius: 0;
|
|
50
|
+
margin: 0;
|
|
51
|
+
border: none;
|
|
52
|
+
border-top: rem(1px) solid var(--ig-gray-300);
|
|
53
|
+
max-height: rem(400px);
|
|
54
|
+
overflow: auto;
|
|
55
|
+
overscroll-behavior: contain;
|
|
56
|
+
|
|
57
|
+
pre {
|
|
58
|
+
margin: 0;
|
|
59
|
+
border: none;
|
|
60
|
+
padding: 0;
|
|
61
|
+
border-radius: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.cv-hljs-code-copy {
|
|
65
|
+
position: absolute;
|
|
66
|
+
top: rem(16px);
|
|
67
|
+
right: rem(16px);
|
|
68
|
+
opacity: 0;
|
|
69
|
+
transition: opacity 0.2s ease;
|
|
70
|
+
pointer-events: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:hover .cv-hljs-code-copy,
|
|
74
|
+
&:focus-within .cv-hljs-code-copy {
|
|
75
|
+
opacity: 1;
|
|
76
|
+
pointer-events: auto;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// TODO Log issue in the component this is not suppose to be affected by the ig-typography
|
|
82
|
+
igc-tab::part(content) {
|
|
83
|
+
@include type-style('subtitle-1') {
|
|
84
|
+
margin: 0;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
igc-tab::part(tab-header) {
|
|
89
|
+
min-height: 72px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.igd-code-view {
|
|
93
|
+
width: 100%;
|
|
94
|
+
border: rem(1px) solid var(--ig-gray-300);
|
|
95
|
+
margin-block-end: rem(26px);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.igd-code-view__inner {
|
|
99
|
+
position: relative;
|
|
100
|
+
display: flex;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.igd-sample-container {
|
|
104
|
+
--sample-container-header-height: #{rem(66px)};
|
|
105
|
+
|
|
106
|
+
position: relative;
|
|
107
|
+
border: rem(1px) solid var(--ig-gray-300);
|
|
108
|
+
min-height: rem(320px);
|
|
109
|
+
max-height: rem(800px);
|
|
110
|
+
overflow: hidden auto;
|
|
111
|
+
|
|
112
|
+
iframe {
|
|
113
|
+
display: block;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.sample-loading-indicator {
|
|
117
|
+
position: absolute;
|
|
118
|
+
inset: var(--sample-container-header-height, 0px) 0 0 0;
|
|
119
|
+
margin: auto;
|
|
120
|
+
width: 60px;
|
|
121
|
+
height: 60px;
|
|
122
|
+
z-index: 1;
|
|
123
|
+
opacity: 0;
|
|
124
|
+
pointer-events: none;
|
|
125
|
+
transition: opacity 0.2s ease;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&.loading .sample-loading-indicator {
|
|
129
|
+
opacity: 1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
1
133
|
.full-screen-btn {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.igd-code-view__footer-actions {
|
|
139
|
+
border-block-start: rem(1px) solid var(--ig-gray-300);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.igd-code-view__header-actions,
|
|
143
|
+
.igd-code-view__footer-actions {
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
justify-content: flex-end;
|
|
147
|
+
position: relative;
|
|
148
|
+
padding: rem(16px) rem(26px);
|
|
149
|
+
gap: rem(16px);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.igd-code-view__header-actions {
|
|
153
|
+
position: sticky;
|
|
154
|
+
inset-block-end: 0;
|
|
155
|
+
height: var(--sample-container-header-height);
|
|
156
|
+
border-block-start: rem(1px) solid var(--ig-gray-300);
|
|
157
|
+
background-color: var(--igd-layout-sections-bg);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
igc-button {
|
|
161
|
+
&::part(base) {
|
|
162
|
+
padding-inline: rem(16px);
|
|
163
|
+
gap: rem(4px);
|
|
164
|
+
|
|
165
|
+
@include type-style('caption') {
|
|
166
|
+
margin: 0;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.editing-label {
|
|
172
|
+
@include type-style('body-2') {
|
|
173
|
+
margin: 0;
|
|
174
|
+
}
|
|
32
175
|
}
|
package/src/content.config.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { createDocsCollection } from './content-helper.ts';
|
|
5
5
|
|
|
6
6
|
// TODO: remove these template-specific exclusions once the source repos add
|
|
7
|
-
// proper
|
|
7
|
+
// proper frontmatter to these files (no `title` → fail schema).
|
|
8
8
|
export const collections = {
|
|
9
9
|
docs: createDocsCollection(process.env.DOCS_SOURCE_PATH, {
|
|
10
10
|
exclude: [
|
package/src/integration.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* integration.ts
|
|
3
3
|
*
|
|
4
|
-
* Shared configuration helpers for Astro
|
|
4
|
+
* Shared configuration helpers for Astro docs sites.
|
|
5
5
|
* All functions are independently usable; `createDocsSite` is the
|
|
6
6
|
* convenience wrapper that composes them all.
|
|
7
7
|
*
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
* site: 'https://my-org.github.io/my-docs',
|
|
14
14
|
* title: 'My Library',
|
|
15
15
|
* description: 'Reference docs for My Library.',
|
|
16
|
-
* platform: 'angular', // drives CDN head entries
|
|
16
|
+
* platform: 'angular', // drives CDN head entries
|
|
17
17
|
* navLang: 'en', // 'en' | 'jp' | 'kr'
|
|
18
18
|
* source: {
|
|
19
|
-
* tocPath: './my-docs/toc.
|
|
19
|
+
* tocPath: './my-docs/toc.json',
|
|
20
20
|
* docsDir: './my-docs/en/components',
|
|
21
21
|
* imagesDir: './my-docs/en/images', // omit to skip image serving
|
|
22
22
|
* },
|
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
* head: [ // extra <head> entries after platform ones
|
|
25
25
|
* { tag: 'link', attrs: { rel: 'stylesheet', href: '...' } },
|
|
26
26
|
* ],
|
|
27
|
-
* // Extra Starlight options (logo, social, editLink, customCss, …)
|
|
28
|
-
* starlight: {
|
|
29
|
-
* logo: { src: './public/favicon.svg' },
|
|
30
|
-
* },
|
|
31
27
|
* // Extra Astro options (markdown, image, build, …)
|
|
32
28
|
* markdown: { remarkPlugins: [] },
|
|
33
29
|
* });
|
|
@@ -41,7 +37,6 @@
|
|
|
41
37
|
* export default defineConfig({
|
|
42
38
|
* integrations: [
|
|
43
39
|
* siteMetaIntegration({ title: 'My Library', description: 'Reference docs.' }),
|
|
44
|
-
* starlight({ sidebar }),
|
|
45
40
|
* staticImagesIntegration('/abs/path/to/my-docs/images'),
|
|
46
41
|
* ],
|
|
47
42
|
* });
|
|
@@ -64,20 +59,22 @@ import {
|
|
|
64
59
|
type LlmsMeta, type LlmsSet, type SidebarItem,
|
|
65
60
|
} from './llms.ts';
|
|
66
61
|
import { buildSidebarFromToc } from './sidebar';
|
|
67
|
-
import {
|
|
62
|
+
import { getPlatformHead } from './platform';
|
|
68
63
|
import type { HeadEntry, PlatformKey, NavLang } from './platform.ts';
|
|
69
|
-
import {
|
|
70
|
-
|
|
64
|
+
import { remarkEnvVars } from './plugins/remark-env-vars';
|
|
65
|
+
export { rehypeTableWrapper } from './plugins/rehype-table-wrapper';
|
|
66
|
+
import { rehypeTableWrapper } from './plugins/rehype-table-wrapper';
|
|
67
|
+
import { rehypeHeadingAnchors } from './plugins/rehype-heading-anchors';
|
|
68
|
+
export { rehypeHeadingAnchors } from './plugins/rehype-heading-anchors';
|
|
69
|
+
import { remarkMdLinks } from './plugins/remark-md-links';
|
|
70
|
+
import { remarkHtmlTransforms } from './plugins/remark-html-transforms';
|
|
71
71
|
|
|
72
72
|
/** Build / deployment mode. Drives env-var `DOCS_BUILD_MODE`. */
|
|
73
73
|
export type DocsMode = 'development' | 'staging' | 'production';
|
|
74
74
|
|
|
75
|
-
/** Module-level cache so the nav URL is fetched at most once per build. */
|
|
76
|
-
let _navHtmlCache: string | null = null;
|
|
77
|
-
|
|
78
75
|
/**
|
|
79
76
|
* Read `themeApiUrl` and `themingWidgetVersion` from the project's
|
|
80
|
-
* environment.json at build time.
|
|
77
|
+
* environment.json at build time. Uses the same lookup order as remark-env-vars.ts
|
|
81
78
|
* so both always resolve from the same file.
|
|
82
79
|
*/
|
|
83
80
|
function readThemingEnv(sourcePath: string | undefined, envKey: string): {
|
|
@@ -142,10 +139,6 @@ export interface SiteMetaOptions {
|
|
|
142
139
|
* module and rendered by `DocsLayout.astro`.
|
|
143
140
|
*/
|
|
144
141
|
head?: HeadEntry[];
|
|
145
|
-
/** @deprecated Use `platform` instead. */
|
|
146
|
-
prefetchNav?: boolean;
|
|
147
|
-
/** @deprecated Use `platform: 'appbuilder'` instead. */
|
|
148
|
-
prefetchAppBuilderNav?: boolean;
|
|
149
142
|
}
|
|
150
143
|
|
|
151
144
|
/**
|
|
@@ -188,8 +181,6 @@ export function siteMetaIntegration({
|
|
|
188
181
|
llmsSets = [],
|
|
189
182
|
productLinks = [],
|
|
190
183
|
head = [],
|
|
191
|
-
prefetchNav = false,
|
|
192
|
-
prefetchAppBuilderNav = false,
|
|
193
184
|
}: SiteMetaOptions = {} as SiteMetaOptions): AstroIntegration {
|
|
194
185
|
const llmsMetaMap = docsDir
|
|
195
186
|
? buildLlmsMetaMap(docsDir, sidebar ?? [])
|
|
@@ -201,17 +192,8 @@ export function siteMetaIntegration({
|
|
|
201
192
|
const navVirtualId = 'virtual:docs-template/nav-html';
|
|
202
193
|
const navResolvedId = '\0' + navVirtualId;
|
|
203
194
|
|
|
204
|
-
//
|
|
205
|
-
|
|
206
|
-
const effectivePlatform: PlatformKey | null =
|
|
207
|
-
platform ??
|
|
208
|
-
(prefetchAppBuilderNav ? 'appbuilder' : null) ??
|
|
209
|
-
(prefetchNav ? 'angular' : null);
|
|
210
|
-
|
|
211
|
-
const { navType, navUrl } = getNavConfig(effectivePlatform, navLang);
|
|
212
|
-
|
|
213
|
-
// Navigation buckets for this platform — stripped from ancestor paths during label generation.
|
|
214
|
-
const broadSections = getBroadSectionsForPlatform(effectivePlatform);
|
|
195
|
+
// Navigation buckets for this platform.
|
|
196
|
+
const broadSections = getBroadSectionsForPlatform(platform ?? null);
|
|
215
197
|
// Captured from astro:config:done; used to generate llms.txt content and virtual module.
|
|
216
198
|
let configuredSite = '';
|
|
217
199
|
// Cached virtual module source — built once in astro:config:done after
|
|
@@ -228,6 +210,7 @@ export const sidebar = ${JSON.stringify(sidebar ?? [])};
|
|
|
228
210
|
export const productLinks = ${JSON.stringify(productLinks)};
|
|
229
211
|
export const headEntries = ${JSON.stringify(head ?? [])};
|
|
230
212
|
export const trailingSlash = ${JSON.stringify(config.trailingSlash)};
|
|
213
|
+
export const navLang = ${JSON.stringify(navLang)};
|
|
231
214
|
`;
|
|
232
215
|
},
|
|
233
216
|
'astro:config:setup'({ updateConfig, injectRoute }) {
|
|
@@ -247,19 +230,6 @@ export const trailingSlash = ${JSON.stringify(config.trailingSlash)};
|
|
|
247
230
|
prerender: true,
|
|
248
231
|
});
|
|
249
232
|
|
|
250
|
-
// Vite alias: redirect @astrojs/starlight/components to our compat shim so
|
|
251
|
-
// MDX files that import Starlight UI components continue to build without the
|
|
252
|
-
// Starlight integration being active.
|
|
253
|
-
const compatIndex = fileURLToPath(new URL('./compat/starlight-components/index.ts', import.meta.url));
|
|
254
|
-
updateConfig({
|
|
255
|
-
vite: {
|
|
256
|
-
resolve: {
|
|
257
|
-
alias: [
|
|
258
|
-
{ find: '@astrojs/starlight/components', replacement: compatIndex },
|
|
259
|
-
],
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
});
|
|
263
233
|
|
|
264
234
|
// Configure Sass loadPaths so bare `highlight.js/scss/vs2015`
|
|
265
235
|
// imports in the platform theme files resolve from node_modules.
|
|
@@ -285,13 +255,10 @@ export const trailingSlash = ${JSON.stringify(config.trailingSlash)};
|
|
|
285
255
|
if (id === virtualId) return resolvedId;
|
|
286
256
|
if (id === navVirtualId) return navResolvedId;
|
|
287
257
|
},
|
|
288
|
-
|
|
258
|
+
load(id: string) {
|
|
289
259
|
if (id === resolvedId) return siteMetaCode;
|
|
290
260
|
if (id !== navResolvedId) return;
|
|
291
261
|
|
|
292
|
-
// Return cached module code — fetched at most once per build.
|
|
293
|
-
if (_navHtmlCache) return _navHtmlCache;
|
|
294
|
-
|
|
295
262
|
// ── Theming env ──────────────────────────────────────────────
|
|
296
263
|
const envKey = process.env.DOCS_ENV ?? process.env.NODE_ENV ?? 'production';
|
|
297
264
|
const { themeApiUrl, widgetVersion } = readThemingEnv(process.env.DOCS_SOURCE_PATH, envKey);
|
|
@@ -299,93 +266,11 @@ export const trailingSlash = ${JSON.stringify(config.trailingSlash)};
|
|
|
299
266
|
? `https://cdn-na.infragistics.com/igniteui/theming-widget/${widgetVersion}/igniteui-theming-widget.js`
|
|
300
267
|
: '';
|
|
301
268
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
let footerHtml = '';
|
|
305
|
-
|
|
306
|
-
// ── IG nav prefetch ──────────────────────────────────────────
|
|
307
|
-
if (navType === 'infragistics' && navUrl) {
|
|
308
|
-
try {
|
|
309
|
-
const res = await fetch(navUrl, {
|
|
310
|
-
credentials: 'omit',
|
|
311
|
-
signal: AbortSignal.timeout(15_000),
|
|
312
|
-
});
|
|
313
|
-
if (res.ok) {
|
|
314
|
-
const html = await res.text();
|
|
315
|
-
const igBase = navLang === 'jp' ? 'https://jp.infragistics.com' : 'https://www.infragistics.com';
|
|
316
|
-
headerHtml = absolutifyNavUrls(stripScripts(extractOuterHtml(html, '<header[^>]+id="header"')), igBase);
|
|
317
|
-
uiFooterHtml = absolutifyNavUrls(stripScripts(extractOuterHtml(html, '<footer[^>]+class="[^"]*\\bui-footer\\b')), igBase);
|
|
318
|
-
footerHtml = absolutifyNavUrls(stripScripts(extractOuterHtml(html, '<footer[^>]+id="footer"')), igBase);
|
|
319
|
-
// Strip the hello-bar promotional strip
|
|
320
|
-
headerHtml = headerHtml.replace(
|
|
321
|
-
/<div[^>]+id="hello-bar"[\s\S]*?<\/div>\s*/i, ''
|
|
322
|
-
);
|
|
323
|
-
} else {
|
|
324
|
-
console.warn(`[docs-template] Navigation fetch returned ${res.status} — falling back to empty markup.`);
|
|
325
|
-
}
|
|
326
|
-
} catch (err: unknown) {
|
|
327
|
-
console.warn(`[docs-template] Could not fetch navigation HTML: ${(err as Error).message} — falling back to empty markup.`);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// ── AppBuilder nav prefetch ──────────────────────────────────
|
|
332
|
-
let abHeaderHtml = '';
|
|
333
|
-
let abFooterHtml = '';
|
|
334
|
-
let abFooterUtilsHtml = '';
|
|
335
|
-
let abFooterCopyrightHtml = '';
|
|
336
|
-
let abContactSalesHtml = '';
|
|
337
|
-
|
|
338
|
-
if (navType === 'appbuilder' && navUrl) {
|
|
339
|
-
try {
|
|
340
|
-
const abRes = await fetch(navUrl, {
|
|
341
|
-
credentials: 'omit',
|
|
342
|
-
signal: AbortSignal.timeout(15_000),
|
|
343
|
-
});
|
|
344
|
-
if (abRes.ok) {
|
|
345
|
-
const abRaw = await abRes.text();
|
|
346
|
-
// Endpoint may return JSON { header, footer } or a full HTML page.
|
|
347
|
-
let parsed = false;
|
|
348
|
-
try {
|
|
349
|
-
const data = JSON.parse(abRaw) as { header?: string; footer?: string };
|
|
350
|
-
if (data.header || data.footer) {
|
|
351
|
-
abHeaderHtml = data.header ?? '';
|
|
352
|
-
abFooterHtml = data.footer ?? '';
|
|
353
|
-
parsed = true;
|
|
354
|
-
}
|
|
355
|
-
} catch { /* not JSON — fall through to HTML extraction */ }
|
|
356
|
-
|
|
357
|
-
if (!parsed) {
|
|
358
|
-
abHeaderHtml = extractOuterHtml(abRaw, '<header');
|
|
359
|
-
abFooterHtml = extractOuterHtml(abRaw, '<footer');
|
|
360
|
-
abFooterUtilsHtml = extractOuterHtml(abRaw, '<[a-z][a-z0-9]*[^>]+class="[^"]*\\bfooter-utils\\b');
|
|
361
|
-
abFooterCopyrightHtml = extractOuterHtml(abRaw, '<[a-z][a-z0-9]*[^>]+class="[^"]*\\bfooter-copyright\\b');
|
|
362
|
-
abContactSalesHtml = extractOuterHtml(abRaw, '<[a-z][a-z0-9]*[^>]+id="contactSales"');
|
|
363
|
-
}
|
|
364
|
-
} else {
|
|
365
|
-
console.warn(`[docs-template] AppBuilder nav fetch returned ${abRes.status} — falling back to runtime loading.`);
|
|
366
|
-
}
|
|
367
|
-
} catch (err: unknown) {
|
|
368
|
-
console.warn(`[docs-template] Could not prefetch AppBuilder navigation: ${(err as Error).message} — falling back to runtime loading.`);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
_navHtmlCache = [
|
|
373
|
-
`export const platform = ${JSON.stringify(effectivePlatform ?? null)};`,
|
|
374
|
-
`export const navLang = ${JSON.stringify(navLang)};`,
|
|
269
|
+
return [
|
|
270
|
+
`export const platform = ${JSON.stringify(platform ?? null)};`,
|
|
375
271
|
`export const themeApiUrl = ${JSON.stringify(themeApiUrl)};`,
|
|
376
272
|
`export const widgetScriptSrc = ${JSON.stringify(widgetScriptSrc)};`,
|
|
377
|
-
`export const prefetched = ${JSON.stringify(!!headerHtml)};`,
|
|
378
|
-
`export const headerHtml = ${JSON.stringify(headerHtml)};`,
|
|
379
|
-
`export const uiFooterHtml = ${JSON.stringify(uiFooterHtml)};`,
|
|
380
|
-
`export const footerHtml = ${JSON.stringify(footerHtml)};`,
|
|
381
|
-
`export const abPrefetched = ${JSON.stringify(!!abHeaderHtml)};`,
|
|
382
|
-
`export const abHeaderHtml = ${JSON.stringify(abHeaderHtml)};`,
|
|
383
|
-
`export const abFooterHtml = ${JSON.stringify(abFooterHtml)};`,
|
|
384
|
-
`export const abFooterUtilsHtml = ${JSON.stringify(abFooterUtilsHtml)};`,
|
|
385
|
-
`export const abFooterCopyrightHtml = ${JSON.stringify(abFooterCopyrightHtml)};`,
|
|
386
|
-
`export const abContactSalesHtml = ${JSON.stringify(abContactSalesHtml)};`,
|
|
387
273
|
].join('\n');
|
|
388
|
-
return _navHtmlCache;
|
|
389
274
|
},
|
|
390
275
|
}],
|
|
391
276
|
},
|
|
@@ -700,17 +585,12 @@ export interface CreateDocsSiteOptions {
|
|
|
700
585
|
productLinks?: ProductLink[];
|
|
701
586
|
/** Extra Astro integrations appended after the built-in ones. */
|
|
702
587
|
integrations?: AstroIntegration[];
|
|
703
|
-
/**
|
|
704
|
-
* @deprecated Starlight has been removed. This option is ignored.
|
|
705
|
-
* Use `head` for extra head entries and `integrations` for extra integrations.
|
|
706
|
-
*/
|
|
707
|
-
starlight?: Record<string, unknown>;
|
|
708
588
|
/** Any remaining keys are spread into `defineConfig` (markdown, image, build, …). */
|
|
709
589
|
[key: string]: unknown;
|
|
710
590
|
}
|
|
711
591
|
|
|
712
592
|
/**
|
|
713
|
-
* Creates a complete Astro config for a
|
|
593
|
+
* Creates a complete Astro config for a docs site.
|
|
714
594
|
*
|
|
715
595
|
* All individual helpers (`buildSidebarFromToc`, `staticImagesIntegration`,
|
|
716
596
|
* `siteMetaIntegration`) remain independently importable for cases that
|
|
@@ -759,7 +639,7 @@ export function createDocsSite(options: CreateDocsSiteOptions = {} as CreateDocs
|
|
|
759
639
|
if (!process.env.DOCS_ENV) {
|
|
760
640
|
process.env.DOCS_ENV = mode;
|
|
761
641
|
}
|
|
762
|
-
// Expose the platform so
|
|
642
|
+
// Expose the platform so plugins can set data-platform on widgets they generate.
|
|
763
643
|
if (platform) {
|
|
764
644
|
process.env.DOCS_PLATFORM = platform;
|
|
765
645
|
}
|
|
@@ -823,11 +703,15 @@ export function createDocsSite(options: CreateDocsSiteOptions = {} as CreateDocs
|
|
|
823
703
|
markdown: {
|
|
824
704
|
...(astroExtra as any).markdown,
|
|
825
705
|
remarkPlugins: [
|
|
826
|
-
|
|
706
|
+
remarkEnvVars,
|
|
707
|
+
remarkMdLinks,
|
|
708
|
+
remarkHtmlTransforms,
|
|
827
709
|
...((astroExtra as any).markdown?.remarkPlugins ?? []),
|
|
828
710
|
],
|
|
829
711
|
rehypePlugins: [
|
|
830
712
|
rehypeCodeView,
|
|
713
|
+
rehypeTableWrapper,
|
|
714
|
+
rehypeHeadingAnchors,
|
|
831
715
|
...((astroExtra as any).markdown?.rehypePlugins ?? []),
|
|
832
716
|
],
|
|
833
717
|
},
|
|
@@ -8,11 +8,11 @@ import GlobalNavBar from '../../components/GlobalNavBar/GlobalNavBar.astro';
|
|
|
8
8
|
import GlobalFooter from '../../components/GlobalFooter/GlobalFooter.astro';
|
|
9
9
|
import DocsSubHeader from '../../components/DocsSubHeader/DocsSubHeader.astro';
|
|
10
10
|
import DocsBreadcrumb from '../../components/DocsBreadcrumb/DocsBreadcrumb.astro';
|
|
11
|
+
import LicenseIndicator from '../../components/LicenseIndicator/LicenseIndicator.astro';
|
|
11
12
|
import MobileSidebarToggle from '../../components/MobileSidebarToggle/MobileSidebarToggle.astro';
|
|
12
13
|
import { widgetScriptSrc, platform as virtualPlatform } from 'virtual:docs-template/nav-html';
|
|
13
|
-
import { title as siteTitle, headEntries } from 'virtual:docs-template/site-meta';
|
|
14
|
+
import { title as siteTitle, headEntries, navLang } from 'virtual:docs-template/site-meta';
|
|
14
15
|
import '../../styles/theme.scss';
|
|
15
|
-
import '../../styles/custom.scss';
|
|
16
16
|
import './DocsLayout.scss';
|
|
17
17
|
|
|
18
18
|
export interface Props {
|
|
@@ -28,18 +28,16 @@ export interface Props {
|
|
|
28
28
|
* Useful when consuming without `siteMetaIntegration`.
|
|
29
29
|
*/
|
|
30
30
|
siteTitle?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Value of the `license` frontmatter field from the MDX page.
|
|
33
|
+
* 'commercial' → Premium badge, 'MIT' → Open Source badge, omit → no badge.
|
|
34
|
+
*/
|
|
35
|
+
license?: string;
|
|
31
36
|
}
|
|
32
37
|
|
|
33
|
-
const {
|
|
34
|
-
title,
|
|
35
|
-
description,
|
|
36
|
-
keywords,
|
|
37
|
-
hasToc = true,
|
|
38
|
-
hasSidebar = true,
|
|
39
|
-
currentSlug = '',
|
|
40
|
-
siteTitle: siteTitleProp,
|
|
41
|
-
} = Astro.props;
|
|
38
|
+
const { title, description, keywords, hasToc = true, hasSidebar = true, currentSlug = '', siteTitle: siteTitleProp, license } = Astro.props;
|
|
42
39
|
const resolvedSiteTitle = siteTitleProp ?? siteTitle;
|
|
40
|
+
const licenseType = license === 'commercial' ? 'premium' : license === 'MIT' ? 'opensource' : false;
|
|
43
41
|
const navTheme = (virtualPlatform ?? import.meta.env.VITE_NAV_THEME ?? 'igniteui') as string;
|
|
44
42
|
const showGlobalNav = navTheme !== 'none';
|
|
45
43
|
const pageTitle = title ? `${title} | ${resolvedSiteTitle}` : resolvedSiteTitle;
|
|
@@ -64,13 +62,47 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
|
|
|
64
62
|
<ClientRouter />
|
|
65
63
|
<script is:inline>
|
|
66
64
|
// Force light theme on load and after every View Transitions swap
|
|
67
|
-
try { localStorage.setItem('starlight-theme', 'light'); } catch (_) {}
|
|
68
65
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
69
66
|
document.addEventListener('astro:after-swap', function () {
|
|
70
67
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
71
68
|
});
|
|
72
69
|
|
|
73
|
-
//
|
|
70
|
+
// Enable smooth scrolling only after the page is fully loaded so the
|
|
71
|
+
// browser's scroll-position restoration on refresh is instant (no visible
|
|
72
|
+
// animated scroll). Remove it before a View Transition swap so navigation
|
|
73
|
+
// between pages is also instant, then re-enable after the new page loads.
|
|
74
|
+
document.addEventListener('astro:page-load', function () {
|
|
75
|
+
document.documentElement.style.scrollBehavior = 'smooth';
|
|
76
|
+
});
|
|
77
|
+
document.addEventListener('astro:before-swap', function () {
|
|
78
|
+
document.documentElement.style.removeProperty('scroll-behavior');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Root cause: Sample.astro SSR-renders an <igc-tab selected>. During Astro's
|
|
82
|
+
// client-side swap, <igc-tabs> connects and Lit runs firstUpdated() after
|
|
83
|
+
// Astro's moveToLocation() has already called scrollTo(0,0), but before
|
|
84
|
+
// astro:page-load. IgcTabsComponent then applies the selected tab and calls
|
|
85
|
+
// scrollIntoView() for its tab header, which can move the page down to the
|
|
86
|
+
// sample widget.
|
|
87
|
+
//
|
|
88
|
+
// Re-apply scroll-to-top on astro:page-load inside rAF, after Lit microtasks
|
|
89
|
+
// and selected-tab scrollIntoView() have settled. Do not override hash
|
|
90
|
+
// navigation, because hash fragments should keep their anchor behavior.
|
|
91
|
+
document.addEventListener('astro:page-load', function () {
|
|
92
|
+
if (!location.hash) {
|
|
93
|
+
requestAnimationFrame(function () {
|
|
94
|
+
if (!location.hash && window.scrollY > 0) {
|
|
95
|
+
window.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Preserve dynamically-injected <style> tags across View Transitions.
|
|
102
|
+
// Only styles added by JS at runtime (e.g. the IG nav widget) need
|
|
103
|
+
// preserving — Astro re-injects its own component styles on every page
|
|
104
|
+
// automatically. Tagging the initial styles caused duplicates: the
|
|
105
|
+
// preserved copy + the freshly-injected copy from the new page.
|
|
74
106
|
var _styleIndex = 0;
|
|
75
107
|
function tagStyle(style) {
|
|
76
108
|
var isAstroStyle = Array.from(style.attributes).some(function (a) { return a.name.startsWith('data-astro'); });
|
|
@@ -78,7 +110,6 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
|
|
|
78
110
|
style.setAttribute('data-vt-preserved', String(++_styleIndex));
|
|
79
111
|
}
|
|
80
112
|
}
|
|
81
|
-
document.head.querySelectorAll('style').forEach(tagStyle);
|
|
82
113
|
new MutationObserver(function (mutations) {
|
|
83
114
|
mutations.forEach(function (m) {
|
|
84
115
|
m.addedNodes.forEach(function (node) {
|
|
@@ -124,9 +155,15 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
|
|
|
124
155
|
var rafId = 0;
|
|
125
156
|
function update() {
|
|
126
157
|
var footerTop = footer.getBoundingClientRect().top;
|
|
158
|
+
// Footer is off-screen below — sidebar needs no clamping.
|
|
159
|
+
if (footerTop >= window.innerHeight) {
|
|
160
|
+
if (sidebar.style.maxHeight) sidebar.style.maxHeight = '';
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
127
163
|
var sidebarTop = sidebar.getBoundingClientRect().top;
|
|
128
|
-
var maxH = Math.min(window.innerHeight - sidebarTop, footerTop - sidebarTop);
|
|
129
|
-
|
|
164
|
+
var maxH = Math.max(0, Math.min(window.innerHeight - sidebarTop, footerTop - sidebarTop));
|
|
165
|
+
var next = maxH + 'px';
|
|
166
|
+
if (sidebar.style.maxHeight !== next) sidebar.style.maxHeight = next;
|
|
130
167
|
}
|
|
131
168
|
function schedule() {
|
|
132
169
|
if (rafId) return;
|
|
@@ -137,7 +174,7 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
|
|
|
137
174
|
// covers viewport-only changes such as DevTools docking/undocking.
|
|
138
175
|
window.addEventListener('resize', schedule, { passive: true });
|
|
139
176
|
var ro = new ResizeObserver(schedule);
|
|
140
|
-
ro.observe(
|
|
177
|
+
ro.observe(footer);
|
|
141
178
|
schedule();
|
|
142
179
|
_cleanupSidebarHeights = function() {
|
|
143
180
|
window.removeEventListener('scroll', schedule);
|
|
@@ -152,7 +189,7 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
|
|
|
152
189
|
</head>
|
|
153
190
|
<body>
|
|
154
191
|
<!-- INFRAGISTICS HEADER/NAVIGATION -->
|
|
155
|
-
{ showGlobalNav && <GlobalNavBar/> }
|
|
192
|
+
{ showGlobalNav && <GlobalNavBar lang={navLang}/> }
|
|
156
193
|
|
|
157
194
|
<!-- MAIN PAGE GRID LAYOUT -->
|
|
158
195
|
<!-- We don't set the CSS grid directly to the body -->
|
|
@@ -167,7 +204,7 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
|
|
|
167
204
|
<!-- TODO: WE DONT NEED TO CALCULAtE THE IG HEADER HEIGHT ANYMORE - REMOVE IT -->
|
|
168
205
|
<!-- <DocsSubHeader style={ `--docs-global-nav-height: ${ showGlobalNav ? '4.7rem': '0' }` } data-nav-height-wrapper/> -->
|
|
169
206
|
<slot name="subheader">
|
|
170
|
-
<DocsSubHeader pageTitle={title} currentSlug={currentSlug} siteTitle={siteTitleProp}
|
|
207
|
+
<DocsSubHeader pageTitle={title} currentSlug={currentSlug} siteTitle={siteTitleProp} />
|
|
171
208
|
</slot>
|
|
172
209
|
|
|
173
210
|
|
|
@@ -176,10 +213,14 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
|
|
|
176
213
|
<slot name="sidebar"/>
|
|
177
214
|
) }
|
|
178
215
|
|
|
216
|
+
<!-- Mobile TOC trigger row — only visible on mobile, provided by the page -->
|
|
217
|
+
<slot name="mobile-toc" />
|
|
218
|
+
|
|
179
219
|
<div class="igd-main-content">
|
|
180
220
|
<div class="igd-main-content__inner">
|
|
181
221
|
<div class="igd-main-content__page">
|
|
182
222
|
<main class="igd-main-content__markdown">
|
|
223
|
+
<LicenseIndicator license={licenseType} />
|
|
183
224
|
<DocsBreadcrumb pageTitle={ title } currentSlug={ currentSlug } siteTitle={ siteTitleProp }/>
|
|
184
225
|
<slot/>
|
|
185
226
|
</main>
|
|
@@ -195,7 +236,7 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
|
|
|
195
236
|
|
|
196
237
|
<!-- Footer is inside the grid so the sidebar's sticky containing block extends through it.
|
|
197
238
|
The JS initSidebarHeights() clamps sidebar max-height to prevent visual overlap. -->
|
|
198
|
-
<GlobalFooter/>
|
|
239
|
+
<GlobalFooter lang={navLang}/>
|
|
199
240
|
</div>
|
|
200
241
|
</body>
|
|
201
242
|
</html>
|