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
|
@@ -7,14 +7,19 @@
|
|
|
7
7
|
* This module handles the dynamic parts:
|
|
8
8
|
* – Serial iframe loading (one at a time, IntersectionObserver-based)
|
|
9
9
|
* – Code-tab fetching and rendering (Angular JSON or xplat JSON)
|
|
10
|
-
* – Tab switching
|
|
10
|
+
* – Tab switching via <igc-tabs> / <igc-tab> web components
|
|
11
11
|
* – Live-editing footer (StackBlitz / CodeSandbox)
|
|
12
12
|
*
|
|
13
|
-
* Selector: `.code-view[data-platform]`
|
|
14
|
-
* This distinguishes pre-rendered Sample.astro widgets from `.ig-code-view`
|
|
15
|
-
* elements that come from the docfx pipeline (handled by code-view.js).
|
|
13
|
+
* Selector: `.igd-code-view[data-platform]`
|
|
16
14
|
*/
|
|
17
15
|
|
|
16
|
+
import { defineComponents, IgcTabsComponent, IgcTabComponent, IgcButtonComponent, IgcIconButtonComponent, IgcIconComponent, IgcCircularProgressComponent } from 'igniteui-webcomponents';
|
|
17
|
+
defineComponents(IgcTabsComponent, IgcTabComponent, IgcButtonComponent, IgcIconButtonComponent, IgcIconComponent, IgcCircularProgressComponent);
|
|
18
|
+
|
|
19
|
+
import './icon-registry';
|
|
20
|
+
import stackblitzSvg from '../assets/logos/stackblitz.svg?raw';
|
|
21
|
+
import codeSandboxSvg from '../assets/logos/code-sandbox.svg?raw';
|
|
22
|
+
|
|
18
23
|
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
19
24
|
|
|
20
25
|
const SAMPLES_ORDER = ['modules', 'ts', 'html', 'scss', 'css'];
|
|
@@ -49,9 +54,7 @@ interface WidgetContext {
|
|
|
49
54
|
iframeSrc: string;
|
|
50
55
|
demosBaseUrl: string;
|
|
51
56
|
widgetIndex: number;
|
|
52
|
-
|
|
53
|
-
container: HTMLElement;
|
|
54
|
-
activateTab: (tab: HTMLElement) => void;
|
|
57
|
+
igcTabs: HTMLElement;
|
|
55
58
|
githubSrc: string;
|
|
56
59
|
}
|
|
57
60
|
|
|
@@ -108,87 +111,51 @@ function replaceRelativeAssetUrls(files: SampleFile[], demosBaseUrl: string): vo
|
|
|
108
111
|
});
|
|
109
112
|
}
|
|
110
113
|
|
|
111
|
-
// ─── Tab Switching ────────────────────────────────────────────────────────────
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Returns an `activateTab` callback that mirrors the original buildShell closure.
|
|
115
|
-
* Operates purely on the pre-rendered HTML — no DOM construction needed.
|
|
116
|
-
*/
|
|
117
|
-
function buildActivateTab(
|
|
118
|
-
navbar: HTMLElement,
|
|
119
|
-
container: HTMLElement,
|
|
120
|
-
fsBtn: HTMLElement | null,
|
|
121
|
-
exampleTabId: string,
|
|
122
|
-
): (tab: HTMLElement) => void {
|
|
123
|
-
return function activateTab(tab: HTMLElement) {
|
|
124
|
-
navbar.querySelectorAll<HTMLElement>('.code-view-tab, .code-view-tab--active').forEach(t => {
|
|
125
|
-
t.classList.remove('code-view-tab--active');
|
|
126
|
-
t.classList.add('code-view-tab');
|
|
127
|
-
});
|
|
128
|
-
container.querySelectorAll<HTMLElement>('.code-view-tab-content').forEach(c => {
|
|
129
|
-
c.style.display = 'none';
|
|
130
|
-
});
|
|
131
|
-
tab.classList.remove('code-view-tab');
|
|
132
|
-
tab.classList.add('code-view-tab--active');
|
|
133
|
-
const pane = container.querySelector<HTMLElement>('#' + tab.dataset.tabId);
|
|
134
|
-
if (pane) pane.style.display = '';
|
|
135
|
-
if (fsBtn) {
|
|
136
|
-
fsBtn.style.visibility = tab.dataset.tabId === exampleTabId ? 'visible' : 'hidden';
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
114
|
// ─── Code Tab Rendering ───────────────────────────────────────────────────────
|
|
142
115
|
|
|
143
116
|
function addCodeTab(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
activateTab: (tab: HTMLElement) => void,
|
|
147
|
-
widgetIndex: number,
|
|
148
|
-
file: SampleFile,
|
|
149
|
-
tabIndex: number,
|
|
117
|
+
igcTabs: HTMLElement,
|
|
118
|
+
file: SampleFile,
|
|
150
119
|
): void {
|
|
151
|
-
const lang
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
copyBtn.className = 'cv-hljs-code-copy hidden';
|
|
176
|
-
copyBtn.textContent = 'COPY CODE';
|
|
120
|
+
const lang = file.fileExtension === 'js' ? 'javascript' : (file.fileExtension || 'text');
|
|
121
|
+
|
|
122
|
+
const tab = document.createElement('igc-tab');
|
|
123
|
+
tab.setAttribute('label', file.fileHeader.toUpperCase());
|
|
124
|
+
|
|
125
|
+
const wrapper = document.createElement('div');
|
|
126
|
+
wrapper.className = 'code-wrapper';
|
|
127
|
+
|
|
128
|
+
const pre = document.createElement('pre');
|
|
129
|
+
const code = document.createElement('code');
|
|
130
|
+
code.className = `language-${lang}`;
|
|
131
|
+
code.textContent = file.content;
|
|
132
|
+
pre.appendChild(code);
|
|
133
|
+
|
|
134
|
+
const copyBtn = document.createElement('igc-icon-button') as HTMLElement;
|
|
135
|
+
copyBtn.setAttribute('variant', 'outlined');
|
|
136
|
+
copyBtn.setAttribute('aria-label', 'Copy code');
|
|
137
|
+
copyBtn.className = 'cv-hljs-code-copy';
|
|
138
|
+
|
|
139
|
+
const copyIcon = document.createElement('igc-icon');
|
|
140
|
+
copyIcon.setAttribute('name', 'copy');
|
|
141
|
+
copyIcon.setAttribute('collection', 'docs');
|
|
142
|
+
copyBtn.appendChild(copyIcon);
|
|
143
|
+
|
|
177
144
|
copyBtn.addEventListener('click', () => {
|
|
178
145
|
navigator.clipboard.writeText(file.content).then(() => {
|
|
179
|
-
|
|
180
|
-
copyBtn.
|
|
181
|
-
setTimeout(() => {
|
|
146
|
+
copyIcon.setAttribute('name', 'check');
|
|
147
|
+
copyBtn.setAttribute('aria-label', 'Code copied');
|
|
148
|
+
setTimeout(() => {
|
|
149
|
+
copyIcon.setAttribute('name', 'copy');
|
|
150
|
+
copyBtn.setAttribute('aria-label', 'Copy code');
|
|
151
|
+
}, 1500);
|
|
182
152
|
});
|
|
183
153
|
});
|
|
184
154
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
pre.appendChild(copyBtn);
|
|
190
|
-
pane.appendChild(pre);
|
|
191
|
-
container.appendChild(pane);
|
|
155
|
+
wrapper.appendChild(pre);
|
|
156
|
+
wrapper.appendChild(copyBtn);
|
|
157
|
+
tab.appendChild(wrapper);
|
|
158
|
+
igcTabs.appendChild(tab);
|
|
192
159
|
|
|
193
160
|
if (typeof (window as any).hljs !== 'undefined') {
|
|
194
161
|
(window as any).hljs.highlightElement(code);
|
|
@@ -199,32 +166,46 @@ function addCodeTab(
|
|
|
199
166
|
|
|
200
167
|
function addFooter(
|
|
201
168
|
widget: HTMLElement,
|
|
169
|
+
iframeSrc: string,
|
|
202
170
|
explicitEditor: string | null,
|
|
203
171
|
onStackblitz: (() => void) | null,
|
|
204
172
|
onCodeSandbox: (() => void) | null,
|
|
205
173
|
): void {
|
|
206
174
|
const footer = document.createElement('div');
|
|
207
|
-
footer.className = '
|
|
175
|
+
footer.className = 'igd-code-view__footer-actions';
|
|
208
176
|
|
|
209
177
|
const label = document.createElement('span');
|
|
210
178
|
label.className = 'editing-label';
|
|
211
|
-
label.textContent = 'Edit in: ';
|
|
212
179
|
footer.appendChild(label);
|
|
213
180
|
|
|
181
|
+
const fsBtn = document.createElement('igc-button') as HTMLElement;
|
|
182
|
+
fsBtn.setAttribute('variant', 'outlined');
|
|
183
|
+
fsBtn.setAttribute('aria-label', 'Open in full screen');
|
|
184
|
+
fsBtn.className = 'igd-full-screen-btn igd-edit-in-btn';
|
|
185
|
+
fsBtn.innerHTML = `<igc-icon name="open-link-blank" collection="docs" slot="prefix"></igc-icon>Full screen`;
|
|
186
|
+
if (iframeSrc) {
|
|
187
|
+
const fullscreenSrc = iframeSrc + (iframeSrc.includes('?') ? '&' : '?') + 'nav=0';
|
|
188
|
+
fsBtn.setAttribute('href', fullscreenSrc);
|
|
189
|
+
fsBtn.setAttribute('target', '_blank');
|
|
190
|
+
}
|
|
191
|
+
footer.appendChild(fsBtn);
|
|
192
|
+
|
|
214
193
|
if ((!explicitEditor || explicitEditor === 'stackblitz') && onStackblitz) {
|
|
215
|
-
const btn
|
|
216
|
-
btn.
|
|
217
|
-
btn.
|
|
218
|
-
btn.
|
|
194
|
+
const btn = document.createElement('igc-button') as HTMLElement;
|
|
195
|
+
btn.setAttribute('variant', 'outlined');
|
|
196
|
+
btn.setAttribute('aria-label', 'Edit in StackBlitz');
|
|
197
|
+
btn.className = 'stackblitz-btn igd-edit-in-btn';
|
|
198
|
+
btn.innerHTML = stackblitzSvg;
|
|
219
199
|
btn.addEventListener('click', onStackblitz);
|
|
220
200
|
footer.appendChild(btn);
|
|
221
201
|
}
|
|
222
202
|
|
|
223
203
|
if ((!explicitEditor || explicitEditor === 'csb') && onCodeSandbox) {
|
|
224
|
-
const btn
|
|
225
|
-
btn.
|
|
226
|
-
btn.
|
|
227
|
-
btn.
|
|
204
|
+
const btn = document.createElement('igc-button') as HTMLElement;
|
|
205
|
+
btn.setAttribute('variant', 'outlined');
|
|
206
|
+
btn.setAttribute('aria-label', 'Edit in CodeSandbox');
|
|
207
|
+
btn.className = 'codesandbox-btn igd-edit-in-btn';
|
|
208
|
+
btn.innerHTML = codeSandboxSvg;
|
|
228
209
|
btn.addEventListener('click', onCodeSandbox);
|
|
229
210
|
footer.appendChild(btn);
|
|
230
211
|
}
|
|
@@ -236,7 +217,7 @@ function addFooter(
|
|
|
236
217
|
|
|
237
218
|
class AngularCodeService {
|
|
238
219
|
async init(ctx: WidgetContext): Promise<void> {
|
|
239
|
-
const { widget, iframeSrc, demosBaseUrl, widgetIndex,
|
|
220
|
+
const { widget, iframeSrc, demosBaseUrl, widgetIndex, igcTabs } = ctx;
|
|
240
221
|
const samplePath = getSamplePath(iframeSrc, demosBaseUrl);
|
|
241
222
|
const isDv = isDvSample(samplePath);
|
|
242
223
|
const assetDir = isDv ? 'code-viewer' : 'samples';
|
|
@@ -275,15 +256,15 @@ class AngularCodeService {
|
|
|
275
256
|
.filter((f: SampleFile) => f.isMain)
|
|
276
257
|
.sort((a: SampleFile, b: SampleFile) =>
|
|
277
258
|
SAMPLES_ORDER.indexOf(a.fileHeader) - SAMPLES_ORDER.indexOf(b.fileHeader))
|
|
278
|
-
.forEach((file: SampleFile
|
|
279
|
-
addCodeTab(
|
|
259
|
+
.forEach((file: SampleFile) =>
|
|
260
|
+
addCodeTab(igcTabs, file));
|
|
280
261
|
|
|
281
262
|
const onStackblitz = isDv ? null : () => this._openInStackBlitz(sampleData, sharedData);
|
|
282
|
-
addFooter(widget, explicitEditor, onStackblitz, fallbackCodeSandbox);
|
|
263
|
+
addFooter(widget, iframeSrc, explicitEditor, onStackblitz, fallbackCodeSandbox);
|
|
283
264
|
|
|
284
265
|
} catch (err: any) {
|
|
285
266
|
console.warn('[sample-widget] Could not fetch Angular sample files:', err.message);
|
|
286
|
-
addFooter(widget, explicitEditor, fallbackStackblitz, fallbackCodeSandbox);
|
|
267
|
+
addFooter(widget, iframeSrc, explicitEditor, fallbackStackblitz, fallbackCodeSandbox);
|
|
287
268
|
}
|
|
288
269
|
}
|
|
289
270
|
|
|
@@ -366,11 +347,11 @@ class XplatCodeService {
|
|
|
366
347
|
}
|
|
367
348
|
|
|
368
349
|
async init(ctx: WidgetContext): Promise<void> {
|
|
369
|
-
const { widget, iframeSrc, demosBaseUrl,
|
|
350
|
+
const { widget, iframeSrc, demosBaseUrl, igcTabs, githubSrc } = ctx;
|
|
370
351
|
const samplePath = getSamplePath(iframeSrc, demosBaseUrl);
|
|
371
352
|
const addXplatFooter = () => {
|
|
372
353
|
if (!this.enableLiveEditing || !githubSrc) return;
|
|
373
|
-
addFooter(widget, 'csb', null, () => this._openCodeSandbox(githubSrc, demosBaseUrl));
|
|
354
|
+
addFooter(widget, iframeSrc, 'csb', null, () => this._openCodeSandbox(githubSrc, demosBaseUrl));
|
|
374
355
|
};
|
|
375
356
|
|
|
376
357
|
try {
|
|
@@ -388,8 +369,8 @@ class XplatCodeService {
|
|
|
388
369
|
.filter((f: SampleFile) => f.isMain)
|
|
389
370
|
.sort((a: SampleFile, b: SampleFile) =>
|
|
390
371
|
this.samplesOrder.indexOf(a.fileHeader) - this.samplesOrder.indexOf(b.fileHeader))
|
|
391
|
-
.forEach((file: SampleFile
|
|
392
|
-
addCodeTab(
|
|
372
|
+
.forEach((file: SampleFile) =>
|
|
373
|
+
addCodeTab(igcTabs, file));
|
|
393
374
|
|
|
394
375
|
addXplatFooter();
|
|
395
376
|
} catch (err: any) {
|
|
@@ -432,6 +413,8 @@ export function initSampleWidgets(): void {
|
|
|
432
413
|
|
|
433
414
|
iframe.addEventListener('load', () => {
|
|
434
415
|
samplePane.classList.remove('loading');
|
|
416
|
+
samplePane.removeAttribute('aria-busy');
|
|
417
|
+
iframe.removeAttribute('aria-hidden');
|
|
435
418
|
iframeLoading = false;
|
|
436
419
|
processIframeQueue();
|
|
437
420
|
}, { once: true });
|
|
@@ -439,7 +422,7 @@ export function initSampleWidgets(): void {
|
|
|
439
422
|
iframe.src = iframe.dataset.src!;
|
|
440
423
|
}
|
|
441
424
|
|
|
442
|
-
document.querySelectorAll<HTMLElement>('.code-view[data-platform]').forEach((widget, index) => {
|
|
425
|
+
document.querySelectorAll<HTMLElement>('.igd-code-view[data-platform]').forEach((widget, index) => {
|
|
443
426
|
// Skip widgets already initialized (e.g. Astro client router restoring a cached page).
|
|
444
427
|
if (widget.dataset.widgetInitialized) return;
|
|
445
428
|
widget.dataset.widgetInitialized = 'true';
|
|
@@ -451,28 +434,36 @@ export function initSampleWidgets(): void {
|
|
|
451
434
|
|
|
452
435
|
if (!iframeSrc) return;
|
|
453
436
|
|
|
454
|
-
const
|
|
455
|
-
const
|
|
456
|
-
const samplePane = widget.querySelector<HTMLElement>('.sample-container');
|
|
437
|
+
const igcTabs = widget.querySelector<HTMLElement>('igc-tabs');
|
|
438
|
+
const samplePane = widget.querySelector<HTMLElement>('.igd-sample-container');
|
|
457
439
|
const iframe = widget.querySelector<HTMLIFrameElement>('iframe');
|
|
458
|
-
const fsBtn = widget.querySelector<HTMLElement>('.fs-button-container');
|
|
459
|
-
const exampleTab = widget.querySelector<HTMLElement>('.code-view-tab--active');
|
|
460
440
|
|
|
461
|
-
if (!
|
|
441
|
+
if (!igcTabs) return;
|
|
462
442
|
|
|
463
|
-
const exampleTabId =
|
|
464
|
-
const activateTab = buildActivateTab(navbar, container, fsBtn, exampleTabId);
|
|
443
|
+
const exampleTabId = `${widget.id}-example`;
|
|
465
444
|
|
|
466
|
-
//
|
|
467
|
-
|
|
445
|
+
// Toggle fullscreen button visibility based on active tab.
|
|
446
|
+
igcTabs.addEventListener('igcChange', (e: Event) => {
|
|
447
|
+
const detail = (e as CustomEvent<HTMLElement>).detail;
|
|
448
|
+
const btn = widget.querySelector<HTMLElement>('.igd-full-screen-btn');
|
|
449
|
+
if (btn) {
|
|
450
|
+
btn.style.display = detail?.id === exampleTabId ? '' : 'none';
|
|
451
|
+
}
|
|
452
|
+
});
|
|
468
453
|
|
|
469
|
-
//
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
454
|
+
// Wire copy buttons for pre-rendered code tabs (e.g. MockSample in playground).
|
|
455
|
+
widget.querySelectorAll<HTMLElement>('.code-wrapper').forEach(pre => {
|
|
456
|
+
const btn = pre.querySelector<HTMLElement>('.cv-hljs-code-copy');
|
|
457
|
+
const icon = btn?.querySelector<HTMLElement>('igc-icon');
|
|
458
|
+
const code = pre.querySelector<HTMLElement>('code');
|
|
459
|
+
if (!btn || !code) return;
|
|
460
|
+
btn.addEventListener('click', () => {
|
|
461
|
+
navigator.clipboard.writeText(code.textContent ?? '').then(() => {
|
|
462
|
+
icon?.setAttribute('name', 'check');
|
|
463
|
+
setTimeout(() => { icon?.setAttribute('name', 'copy'); }, 1500);
|
|
464
|
+
});
|
|
474
465
|
});
|
|
475
|
-
}
|
|
466
|
+
});
|
|
476
467
|
|
|
477
468
|
// Enqueue iframe loading.
|
|
478
469
|
if (iframe && samplePane) {
|
|
@@ -497,7 +488,7 @@ export function initSampleWidgets(): void {
|
|
|
497
488
|
: new AngularCodeService();
|
|
498
489
|
|
|
499
490
|
const ctx: WidgetContext = {
|
|
500
|
-
widget, iframeSrc, demosBaseUrl, widgetIndex: index,
|
|
491
|
+
widget, iframeSrc, demosBaseUrl, widgetIndex: index, igcTabs, githubSrc,
|
|
501
492
|
};
|
|
502
493
|
|
|
503
494
|
// Fetch code-tab data only when the widget becomes visible.
|
package/src/sidebar.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* sidebar.ts
|
|
3
3
|
*
|
|
4
|
-
* Builds
|
|
4
|
+
* Builds the docs sidebar from a JSON TOC file.
|
|
5
5
|
* Source-agnostic: consuming repos pass their own paths.
|
|
6
6
|
*
|
|
7
7
|
* Usage in a consuming repo's astro.config.ts:
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* import { buildSidebarFromToc } from 'docs-template/sidebar';
|
|
10
10
|
*
|
|
11
11
|
* const sidebar = buildSidebarFromToc({
|
|
12
|
-
* tocPath: './node_modules/my-docs-source/toc.
|
|
12
|
+
* tocPath: './node_modules/my-docs-source/toc.json',
|
|
13
13
|
* docsDir: './node_modules/my-docs-source/en/components',
|
|
14
14
|
* // exclude: [/^internal\//], // optional extra exclude patterns
|
|
15
15
|
* });
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
|
|
18
18
|
import fs from 'node:fs';
|
|
19
19
|
import path from 'node:path';
|
|
20
|
-
import * as yaml from 'js-yaml';
|
|
21
20
|
import type { SidebarEntry, SidebarGroup, SidebarLink } from './lib/sidebar/types';
|
|
22
21
|
|
|
23
22
|
// Re-export so consumers (astro.config.ts in child sites) can import the
|
|
@@ -102,7 +101,7 @@ function convertTocItem(
|
|
|
102
101
|
if (item.href) {
|
|
103
102
|
if (!docExists(docsDir, item.href, exclude)) return null;
|
|
104
103
|
const entry: SidebarLink = { label: item.name, slug: hrefToSlug(item.href) };
|
|
105
|
-
// Status badge — only one slot available
|
|
104
|
+
// Status badge — only one slot available, priority order:
|
|
106
105
|
if (item.new) entry.badge = { text: 'New', variant: 'success' };
|
|
107
106
|
else if (item.preview) entry.badge = { text: 'Preview', variant: 'caution' };
|
|
108
107
|
else if (item.updated) entry.badge = { text: 'Updated', variant: 'note' };
|
|
@@ -124,7 +123,7 @@ function convertTocItem(
|
|
|
124
123
|
// ---------------------------------------------------------------------------
|
|
125
124
|
|
|
126
125
|
export interface BuildSidebarFromTocOptions {
|
|
127
|
-
/** Absolute path to the TOC file (.
|
|
126
|
+
/** Absolute path to the TOC file (.json). */
|
|
128
127
|
tocPath: string;
|
|
129
128
|
/** Absolute path to the Markdown docs directory. */
|
|
130
129
|
docsDir: string;
|
|
@@ -133,12 +132,12 @@ export interface BuildSidebarFromTocOptions {
|
|
|
133
132
|
}
|
|
134
133
|
|
|
135
134
|
/**
|
|
136
|
-
* Reads a
|
|
135
|
+
* Reads a JSON TOC file and converts it to a sidebar array.
|
|
137
136
|
*/
|
|
138
137
|
export function buildSidebarFromToc({ tocPath, docsDir, exclude = [] }: BuildSidebarFromTocOptions): SidebarEntry[] {
|
|
139
138
|
if (!tocPath || !fs.existsSync(tocPath)) return [];
|
|
140
139
|
const tocRaw = fs.readFileSync(tocPath, 'utf-8');
|
|
141
|
-
const tocItems =
|
|
140
|
+
const tocItems: TocItem[] = JSON.parse(tocRaw);
|
|
142
141
|
|
|
143
142
|
const sidebar: SidebarEntry[] = [];
|
|
144
143
|
let currentGroup: SidebarGroup | null = null;
|
|
@@ -37,12 +37,12 @@ $bp-tablet-min: #{rem(768px)};
|
|
|
37
37
|
/// Start of desktop (≥ 1024px)
|
|
38
38
|
$bp-desktop-min: #{rem(1024px)};
|
|
39
39
|
|
|
40
|
-
/// Start of large-desktop (≥
|
|
41
|
-
$bp-large-desktop-min: #{rem(
|
|
40
|
+
/// Start of large-desktop (≥ 1280px)
|
|
41
|
+
$bp-large-desktop-min: #{rem(1280px)};
|
|
42
42
|
|
|
43
43
|
/// Layout-specific
|
|
44
44
|
/// Below this the sidebar becomes a slide-in overlay (< 1300px)
|
|
45
|
-
$bp-sidebar-max: #{rem(
|
|
45
|
+
$bp-sidebar-max: #{rem(1600px)};
|
|
46
46
|
|
|
47
47
|
/// At this and above the sidebar is always visible (≥ 1300px)
|
|
48
|
-
$bp-sidebar-min: #{rem(
|
|
48
|
+
$bp-sidebar-min: #{rem(1400px)};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
@use '../../styles/global/breakpoints' as *;
|
|
1
2
|
@use 'igniteui-theming' as *;
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
|
|
4
5
|
/* Custom drop-down theme for igc-select (Web Components) */
|
|
5
6
|
igc-select {
|
|
6
7
|
// TODO as а user i want to be able to add border on the entier dropdown
|
|
@@ -35,7 +36,65 @@ igc-select {
|
|
|
35
36
|
--ig-drop-down-selected-focus-item-background: transparent;
|
|
36
37
|
|
|
37
38
|
// TODO this controls the item size which is very confusing
|
|
38
|
-
--ig-drop-down-size: #{rem(40px)}
|
|
39
|
+
--ig-drop-down-size: #{rem(40px)};
|
|
40
|
+
|
|
41
|
+
--ig-input-group-input-prefix-background: transparent;
|
|
42
|
+
--ig-input-group-input-prefix-background--filled: transparent;
|
|
43
|
+
--ig-input-group-input-prefix-color--filled: var(--ig-gray-900);
|
|
44
|
+
--ig-input-group-input-prefix-background--focused: transparent;
|
|
45
|
+
--ig-input-group-input-prefix-color--focused: var(--ig-gray-900);
|
|
46
|
+
--ig-input-group-input-suffix-background: transparent;
|
|
47
|
+
--ig-input-group-input-suffix-background--filled: transparent;
|
|
48
|
+
--ig-input-group-input-suffix-color--filled: var(--ig-gray-900);
|
|
49
|
+
--ig-input-group-input-suffix-background--focused: transparent;
|
|
50
|
+
--ig-input-group-input-suffix-color--focused: var(--ig-gray-900);
|
|
51
|
+
--ig-input-group-idle-text-color: var(--ig-gray-900);
|
|
52
|
+
--ig-input-group-disabled-border-color: transparent;
|
|
53
|
+
--ig-input-group-border-color: transparent;
|
|
54
|
+
--ig-input-group-focused-border-color: transparent;
|
|
55
|
+
--ig-input-group-hover-border-color: transparent;
|
|
56
|
+
--ig-input-group-border-disabled-background: transparent;
|
|
57
|
+
--ig-select-toggle-button-background: transparent;
|
|
58
|
+
--ig-select-toggle-button-background-focus: transparent;
|
|
59
|
+
--ig-select-toggle-button-foreground: var(--ig-gray-900);
|
|
60
|
+
--ig-select-toggle-button-foreground-focus: var(--igd-accent);
|
|
61
|
+
--ig-select-toggle-button-foreground-filled: var(--ig-gray-900);
|
|
62
|
+
--ig-select-toggle-button-background-disabled: transparent;
|
|
63
|
+
--ig-select-toggle-button-foreground-disabled: var(--ig-gray-400);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
igc-select::part(toggle-icon) {
|
|
67
|
+
padding-inline-start: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@media (max-width: #{$bp-mobile-max}) {
|
|
72
|
+
.igd-version-select {
|
|
73
|
+
max-width: rem(90px);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media (min-width: #{$bp-mobile-max}) {
|
|
78
|
+
.igd-package-select::part(native-input),
|
|
79
|
+
.igd-version-select::part(native-input) {
|
|
80
|
+
field-sizing: content;
|
|
81
|
+
|
|
82
|
+
&::part(base) {
|
|
83
|
+
min-width: 100%;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
igc-select-item {
|
|
91
|
+
margin-block: 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
igc-select::part(container) {
|
|
95
|
+
@include type-style('body-2') {
|
|
96
|
+
margin: 0;
|
|
97
|
+
};
|
|
39
98
|
}
|
|
40
99
|
|
|
41
100
|
igc-select::part(base) {
|
|
@@ -45,24 +104,65 @@ igc-select::part(base) {
|
|
|
45
104
|
min-width: fit-content;
|
|
46
105
|
}
|
|
47
106
|
|
|
48
|
-
igc-
|
|
49
|
-
|
|
50
|
-
|
|
107
|
+
igc-icon-button[variant='outlined'] {
|
|
108
|
+
--foreground: light-dark(var(--ig-gray-900), var(--ig-gray-200));
|
|
109
|
+
--hover-foreground: var(--igd-accent);
|
|
110
|
+
--focus-foreground: var(--igd-accent);
|
|
111
|
+
--active-foreground: var(--igd-accent);
|
|
112
|
+
--focus-hover-foreground: var(--igd-accent);
|
|
113
|
+
|
|
114
|
+
--hover-background: transparent;
|
|
115
|
+
--focus-background: transparent;
|
|
116
|
+
--active-background: transparent;
|
|
117
|
+
--focus-hover-background: transparent;
|
|
118
|
+
--focus-visible-background: transparent;
|
|
119
|
+
|
|
120
|
+
--border-color: light-dark(var(--ig-gray-400), var(--ig-gray-700));
|
|
121
|
+
--focus-border-color: light-dark(var(--ig-gray-400), var(--ig-gray-700));
|
|
122
|
+
--border-radius: #{rem(4px)};
|
|
123
|
+
|
|
124
|
+
&::part(base) {
|
|
125
|
+
&::after {
|
|
126
|
+
display: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// TODO the icon color is not changing on hover, focus, active states, log an issue in the library
|
|
130
|
+
&:hover,
|
|
131
|
+
&:focus {
|
|
132
|
+
--foreground: var(--igd-accent);
|
|
133
|
+
}
|
|
51
134
|
}
|
|
52
135
|
}
|
|
53
136
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
--
|
|
137
|
+
igc-button[variant='outlined'] {
|
|
138
|
+
&::part(base) {
|
|
139
|
+
--border-color: light-dark(var(--ig-gray-400), var(--ig-gray-700));
|
|
140
|
+
--hover-border-color: light-dark(var(--ig-gray-400), var(--ig-gray-700));
|
|
141
|
+
--focus-border-color: light-dark(var(--ig-gray-400), var(--ig-gray-700));
|
|
142
|
+
--focus-visible-border-color: light-dark(var(--ig-gray-400), var(--ig-gray-700));
|
|
143
|
+
--active-border-color: light-dark(var(--ig-gray-400), var(--ig-gray-700));
|
|
144
|
+
|
|
145
|
+
--foreground: light-dark(var(--ig-gray-900), var(--ig-gray-200));
|
|
146
|
+
--hover-foreground: var(--igd-accent);
|
|
147
|
+
--focus-foreground: var(--igd-accent);
|
|
148
|
+
--active-foreground: var(--igd-accent);
|
|
149
|
+
--focus-hover-foreground: var(--igd-accent);
|
|
150
|
+
--focus-visible-foreground: var(--igd-accent);
|
|
151
|
+
|
|
152
|
+
--icon-color: light-dark(var(--ig-gray-900), var(--ig-gray-200));
|
|
153
|
+
--icon-color-hover: var(--igd-accent);
|
|
154
|
+
|
|
155
|
+
--hover-background: transparent;
|
|
156
|
+
--focus-background: transparent;
|
|
157
|
+
--active-background: transparent;
|
|
158
|
+
--focus-hover-background: transparent;
|
|
159
|
+
--focus-visible-background: transparent;
|
|
160
|
+
|
|
161
|
+
--border-radius: #{rem(4px)};
|
|
162
|
+
|
|
163
|
+
&::after {
|
|
164
|
+
display: none;
|
|
165
|
+
}
|
|
58
166
|
}
|
|
59
|
-
|
|
60
|
-
--ig-flat-icon-button-foreground: var(--ig-gray-900);
|
|
61
|
-
--ig-flat-icon-button-hover-foreground: var(--ig-gray-900);
|
|
62
|
-
--ig-flat-icon-button-focus-foreground: var(--ig-gray-900);
|
|
63
|
-
--ig-flat-icon-button-active-foreground: var(--ig-gray-900);
|
|
64
|
-
|
|
65
|
-
--ig-flat-icon-button-hover-background: transparent;
|
|
66
|
-
--ig-flat-icon-button-focus-background: transparent;
|
|
67
|
-
--ig-flat-icon-button-active-background: transparent;
|
|
68
167
|
}
|
|
168
|
+
|