igniteui-astro-components 0.0.10 → 0.0.12
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/package.json +1 -1
- package/src/components/DocsSidebar/DocsSidebar.scss +159 -136
- package/src/components/DocsSidebar/SidebarLabel.astro +2 -2
- package/src/components/DocsToc/DocsToc.scss +1 -1
- package/src/components/DocsTree/DocsTree.astro +30 -0
- package/src/components/DocsTree/docs-tree.scss +4 -1
- package/src/components/Search/Search.astro +160 -87
- package/src/components/Search/Search.scss +10 -22
- package/src/components/SearchAdvanced/SearchAdvanced.scss +3 -110
- package/src/components/mdx/ApiLink/ApiLink.astro +75 -33
- package/src/components/mdx/DocsAside/DocsAside.scss +4 -0
- package/src/components/mdx/Sample/Sample.scss +3 -9
- package/src/layouts/DocsLayout/DocsLayout.astro +4 -2
- package/src/layouts/DocsLayout/DocsLayout.scss +30 -11
- package/src/lib/types.ts +7 -0
- package/src/scripts/sample-widget.ts +13 -16
- package/src/styles/global/_breakpoints.scss +7 -5
- package/src/styles/global/_index.scss +0 -1
- package/src/styles/global/_markdown.scss +16 -3
- package/src/styles/global/_search-shared.scss +145 -40
- package/src/styles/global/_type-scale.scss +1 -1
- package/src/styles/global/_variables.scss +1 -1
- package/src/styles/global/_members.scss +0 -85
|
@@ -23,91 +23,151 @@ import './Search.scss';
|
|
|
23
23
|
<kbd class="search-trigger__hint" style="display:none;"><kbd>Ctrl</kbd><kbd>K</kbd></kbd>
|
|
24
24
|
</button>
|
|
25
25
|
|
|
26
|
+
<igc-dialog id="search-dialog" class="igd-search-dialog" aria-label="Search" hide-default-action close-on-outside-click>
|
|
27
|
+
<div class="igd-search-shell">
|
|
28
|
+
<header class="igd-search-header">
|
|
29
|
+
<igc-input
|
|
30
|
+
type="text"
|
|
31
|
+
class="igd-search-input"
|
|
32
|
+
placeholder="Search documentation"
|
|
33
|
+
autocomplete="off"
|
|
34
|
+
outlined
|
|
35
|
+
aria-label="Search documentation"
|
|
36
|
+
>
|
|
37
|
+
<igc-icon class="igd-search-icon" name="search" collection="docs" slot="prefix" aria-hidden="true"></igc-icon>
|
|
38
|
+
<igc-icon-button
|
|
39
|
+
slot="suffix"
|
|
40
|
+
class="igd-search-clear"
|
|
41
|
+
variant="flat"
|
|
42
|
+
type="button"
|
|
43
|
+
aria-label="Clear search"
|
|
44
|
+
name="clear"
|
|
45
|
+
collection="docs"
|
|
46
|
+
hidden
|
|
47
|
+
></igc-icon-button>
|
|
48
|
+
</igc-input>
|
|
49
|
+
<button
|
|
50
|
+
type="button"
|
|
51
|
+
class="search-trigger search-close"
|
|
52
|
+
aria-label="Close search"
|
|
53
|
+
>
|
|
54
|
+
<igc-icon name="close" collection="docs" aria-hidden="true"></igc-icon>
|
|
55
|
+
</button>
|
|
56
|
+
</header>
|
|
57
|
+
<igc-divider></igc-divider>
|
|
58
|
+
<div class="igd-search-status" aria-live="polite"></div>
|
|
59
|
+
<igc-list class="igd-search-results" hidden></igc-list>
|
|
60
|
+
</div>
|
|
61
|
+
</igc-dialog>
|
|
62
|
+
|
|
26
63
|
<script>
|
|
27
|
-
import {
|
|
64
|
+
import {
|
|
65
|
+
defineComponents,
|
|
66
|
+
IgcIconComponent,
|
|
67
|
+
IgcIconButtonComponent,
|
|
68
|
+
IgcDialogComponent,
|
|
69
|
+
IgcInputComponent,
|
|
70
|
+
IgcListComponent,
|
|
71
|
+
IgcListItemComponent,
|
|
72
|
+
IgcDividerComponent,
|
|
73
|
+
} from 'igniteui-webcomponents';
|
|
28
74
|
import '../../scripts/icon-registry';
|
|
29
|
-
defineComponents(IgcIconComponent);
|
|
30
|
-
</script>
|
|
31
75
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
>
|
|
42
|
-
<igc-icon name="close" collection="docs" aria-hidden="true"></igc-icon>
|
|
43
|
-
</button>
|
|
44
|
-
</div>
|
|
45
|
-
<div class="igd-search-status" aria-live="polite"></div>
|
|
46
|
-
<div id="search-pagefind"></div>
|
|
47
|
-
</div>
|
|
48
|
-
</dialog>
|
|
76
|
+
defineComponents(
|
|
77
|
+
IgcIconComponent,
|
|
78
|
+
IgcIconButtonComponent,
|
|
79
|
+
IgcDialogComponent,
|
|
80
|
+
IgcInputComponent,
|
|
81
|
+
IgcListComponent,
|
|
82
|
+
IgcListItemComponent,
|
|
83
|
+
IgcDividerComponent,
|
|
84
|
+
);
|
|
49
85
|
|
|
50
|
-
<script>
|
|
51
|
-
// BASE_URL accounts for non-root deployments, e.g. /products/ignite-ui-angular/...
|
|
52
86
|
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
|
|
87
|
+
const _w = window as any;
|
|
88
|
+
|
|
89
|
+
const INPUT_DEBOUNCE_MS = 150;
|
|
90
|
+
const MAX_RESULTS = 10;
|
|
91
|
+
|
|
92
|
+
async function loadPagefind() {
|
|
93
|
+
if (_w.__pagefind) return _w.__pagefind;
|
|
94
|
+
try {
|
|
95
|
+
const pf = await import(/* @vite-ignore */ `${base}/pagefind/pagefind.js`);
|
|
96
|
+
await pf.init();
|
|
97
|
+
_w.__pagefind = pf;
|
|
98
|
+
return pf;
|
|
99
|
+
} catch {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
53
103
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
104
|
+
function escapeHtml(s: string): string {
|
|
105
|
+
return s
|
|
106
|
+
.replace(/&/g, '&')
|
|
107
|
+
.replace(/</g, '<')
|
|
108
|
+
.replace(/>/g, '>')
|
|
109
|
+
.replace(/"/g, '"');
|
|
110
|
+
}
|
|
57
111
|
|
|
58
|
-
async function
|
|
59
|
-
const
|
|
60
|
-
|
|
112
|
+
async function runSearch(query: string) {
|
|
113
|
+
const statusEl = document.querySelector<HTMLElement>('.igd-search-status');
|
|
114
|
+
const listEl = document.querySelector<any>('igc-list.igd-search-results');
|
|
115
|
+
const clearBtn = document.querySelector<any>('.igd-search-clear');
|
|
116
|
+
const input = document.querySelector<any>('igc-input.igd-search-input');
|
|
61
117
|
|
|
62
|
-
if (!
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
s.src = `${base}/pagefind/pagefind-ui.js`;
|
|
73
|
-
s.onload = () => resolve();
|
|
74
|
-
s.onerror = () => reject(new Error('Failed to load pagefind-ui.js'));
|
|
75
|
-
document.head.appendChild(s);
|
|
76
|
-
});
|
|
77
|
-
} catch (err) {
|
|
78
|
-
console.error('[Search] pagefind failed to load:', err);
|
|
79
|
-
const el = document.getElementById('search-pagefind');
|
|
80
|
-
if (el) el.textContent = 'Search index not available — run a production build first.';
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
118
|
+
if (!statusEl || !listEl) return;
|
|
119
|
+
|
|
120
|
+
if (clearBtn) clearBtn.hidden = !query;
|
|
121
|
+
input?.requestUpdate?.();
|
|
122
|
+
|
|
123
|
+
if (!query.trim()) {
|
|
124
|
+
statusEl.textContent = '';
|
|
125
|
+
listEl.innerHTML = '';
|
|
126
|
+
listEl.hidden = true;
|
|
127
|
+
return;
|
|
83
128
|
}
|
|
84
129
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
showImages: false,
|
|
92
|
-
resetStyles: false,
|
|
93
|
-
baseUrl: base || '/',
|
|
94
|
-
bundlePath: `${base}/pagefind/`,
|
|
95
|
-
});
|
|
96
|
-
} catch (err) {
|
|
97
|
-
console.error('[Search] PagefindUI init failed:', err);
|
|
98
|
-
}
|
|
130
|
+
statusEl.textContent = 'Searching…';
|
|
131
|
+
|
|
132
|
+
const pf = await loadPagefind();
|
|
133
|
+
if (!pf) {
|
|
134
|
+
statusEl.textContent = 'Search index not available — run a production build first.';
|
|
135
|
+
return;
|
|
99
136
|
}
|
|
100
137
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
138
|
+
const search = await pf.search(query.trim());
|
|
139
|
+
const results = await Promise.all(
|
|
140
|
+
search.results.slice(0, MAX_RESULTS).map((r: any) => r.data()),
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
if (results.length === 0) {
|
|
144
|
+
statusEl.innerHTML = `No results for “<strong class="igd-search-query">${escapeHtml(query)}</strong>”.`;
|
|
145
|
+
listEl.innerHTML = '';
|
|
146
|
+
listEl.hidden = true;
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const total = search.results.length;
|
|
151
|
+
statusEl.textContent = total > MAX_RESULTS
|
|
152
|
+
? `Showing ${MAX_RESULTS} of ${total} results`
|
|
153
|
+
: `${total} result${total === 1 ? '' : 's'}`;
|
|
154
|
+
listEl.innerHTML = results.map((r: any) => `<igc-list-item>
|
|
155
|
+
<a href="${escapeHtml(r.url)}" class="igd-search-link">
|
|
156
|
+
<span class="igd-search-result-title">${escapeHtml(r.meta?.title ?? r.url)}</span>
|
|
157
|
+
<span class="igd-search-result-excerpt">${r.excerpt ?? ''}</span>
|
|
158
|
+
</a>
|
|
159
|
+
</igc-list-item>`).join('');
|
|
160
|
+
listEl.hidden = false;
|
|
104
161
|
}
|
|
105
162
|
|
|
106
163
|
async function openSearch() {
|
|
107
|
-
const dialog = document.
|
|
164
|
+
const dialog = document.querySelector<any>('igc-dialog.igd-search-dialog');
|
|
108
165
|
if (!dialog) return;
|
|
109
|
-
await
|
|
110
|
-
|
|
166
|
+
await dialog.show();
|
|
167
|
+
loadPagefind();
|
|
168
|
+
requestAnimationFrame(() => {
|
|
169
|
+
document.querySelector<any>('igc-input.igd-search-input')?.focus();
|
|
170
|
+
});
|
|
111
171
|
}
|
|
112
172
|
|
|
113
173
|
if (!_w.__searchListeners) {
|
|
@@ -118,39 +178,52 @@ import './Search.scss';
|
|
|
118
178
|
if (!hint) return;
|
|
119
179
|
const isMac = /Mac|iPhone|iPod|iPad/i.test(navigator.userAgent);
|
|
120
180
|
const modKey = hint.querySelector('kbd');
|
|
121
|
-
if (modKey) modKey.textContent = isMac ? '
|
|
181
|
+
if (modKey) modKey.textContent = isMac ? '⌘' : 'Ctrl';
|
|
122
182
|
const btn = document.getElementById('search-trigger');
|
|
123
183
|
btn?.setAttribute('aria-keyshortcuts', isMac ? 'Meta+K' : 'Control+K');
|
|
124
|
-
btn?.setAttribute('title',
|
|
184
|
+
btn?.setAttribute('title', isMac ? 'Search (⌘K)' : 'Search (Ctrl+K)');
|
|
125
185
|
hint.style.display = '';
|
|
126
186
|
}
|
|
127
187
|
updateSearchHint();
|
|
128
188
|
|
|
129
|
-
document.getElementById('search-trigger')?.addEventListener('click', () =>
|
|
130
|
-
openSearch();
|
|
131
|
-
});
|
|
189
|
+
document.getElementById('search-trigger')?.addEventListener('click', () => openSearch());
|
|
132
190
|
|
|
133
|
-
// Keyboard shortcut
|
|
134
191
|
document.addEventListener('keydown', (e: KeyboardEvent) => {
|
|
135
192
|
if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
|
|
136
193
|
e.preventDefault();
|
|
137
|
-
const dialog = document.
|
|
138
|
-
if (dialog?.open) dialog.
|
|
194
|
+
const dialog = document.querySelector<any>('igc-dialog.igd-search-dialog');
|
|
195
|
+
if (dialog?.open) dialog.hide(); else openSearch();
|
|
139
196
|
}
|
|
140
197
|
});
|
|
141
198
|
|
|
142
|
-
// Backdrop click closes the dialog
|
|
143
|
-
document.addEventListener('click', (e: MouseEvent) => {
|
|
144
|
-
const dialog = document.getElementById('search-dialog') as HTMLDialogElement | null;
|
|
145
|
-
if (dialog && e.target === dialog) dialog.close();
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
// Close on navigation
|
|
149
199
|
document.addEventListener('astro:page-load', () => {
|
|
150
|
-
|
|
151
|
-
dialog?.close();
|
|
200
|
+
document.querySelector<any>('igc-dialog.igd-search-dialog')?.hide();
|
|
152
201
|
updateSearchHint();
|
|
153
202
|
});
|
|
203
|
+
|
|
204
|
+
let debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
205
|
+
document.querySelector('igc-input.igd-search-input')?.addEventListener('igcInput', () => {
|
|
206
|
+
if (debounceTimer !== null) clearTimeout(debounceTimer);
|
|
207
|
+
const val = (document.querySelector<any>('igc-input.igd-search-input')?.value as string) ?? '';
|
|
208
|
+
debounceTimer = setTimeout(() => runSearch(val), INPUT_DEBOUNCE_MS);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
document.querySelector('.igd-search-clear')?.addEventListener('click', () => {
|
|
212
|
+
const input = document.querySelector<any>('igc-input.igd-search-input');
|
|
213
|
+
if (!input) return;
|
|
214
|
+
input.value = '';
|
|
215
|
+
input.focus();
|
|
216
|
+
runSearch('');
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
document.querySelector('.igd-search-shell .search-close')?.addEventListener('click', () => {
|
|
220
|
+
document.querySelector<any>('igc-dialog.igd-search-dialog')?.hide();
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
document.querySelector('.igd-search-shell')?.addEventListener('click', (e: Event) => {
|
|
224
|
+
if ((e.target as Element).closest('a[href]')) {
|
|
225
|
+
document.querySelector<any>('igc-dialog.igd-search-dialog')?.hide();
|
|
226
|
+
}
|
|
227
|
+
});
|
|
154
228
|
}
|
|
155
229
|
</script>
|
|
156
|
-
|
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
@use 'igniteui-theming' as *;
|
|
2
2
|
@use '../../styles/global/search-shared' as *;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@include search-dialog-base-styles;
|
|
8
|
-
background: var(--igd-layout-sections-bg);
|
|
9
|
-
color: inherit;
|
|
10
|
-
border: none;
|
|
11
|
-
padding: 0;
|
|
12
|
-
|
|
13
|
-
&:focus-visible {
|
|
14
|
-
outline: none;
|
|
4
|
+
.igd-search-result-excerpt {
|
|
5
|
+
@include type-style('caption') {
|
|
6
|
+
margin: 0;
|
|
15
7
|
}
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
@include search-dialog-backdrop;
|
|
19
|
-
@include search-dialog-backdrop-open;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
9
|
+
color: light-dark(var(--ig-gray-600), var(--ig-gray-400));
|
|
22
10
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
border-bottom: rem(1px) solid var(--igd-app-outline-color);
|
|
28
|
-
min-height: rem(48px);
|
|
11
|
+
mark {
|
|
12
|
+
background: transparent;
|
|
13
|
+
color: var(--igd-accent);
|
|
14
|
+
}
|
|
29
15
|
}
|
|
30
16
|
|
|
17
|
+
.igd-search-results {
|
|
18
|
+
padding-inline-end: rem(26px);
|
|
31
19
|
}
|
|
@@ -4,62 +4,13 @@
|
|
|
4
4
|
@layer components {
|
|
5
5
|
api-search-advanced { display: contents; }
|
|
6
6
|
|
|
7
|
-
.igd-search-dialog {
|
|
8
|
-
--border-radius: 0;
|
|
9
|
-
--background: var(--igd-layout-sections-bg);
|
|
10
|
-
--transition-duration: 150ms;
|
|
11
|
-
|
|
12
|
-
border: none;
|
|
13
|
-
|
|
14
|
-
&::part(base) {
|
|
15
|
-
@include search-dialog-base-styles;
|
|
16
|
-
|
|
17
|
-
&:focus-visible {
|
|
18
|
-
outline: none;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&::part(content) {
|
|
23
|
-
padding: 0;
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
height: 100%;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&::part(backdrop) {
|
|
30
|
-
@include search-dialog-backdrop;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&[open]::part(backdrop) {
|
|
34
|
-
@include search-dialog-backdrop-open;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
igc-input {
|
|
38
|
-
height: 100%;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
igc-input::part(container) {
|
|
42
|
-
border: 0;
|
|
43
|
-
height: 100%;
|
|
44
|
-
padding: 0 rem(16px) !important;
|
|
45
|
-
border-block-end: none !important;
|
|
46
|
-
|
|
47
|
-
&:focus-within {
|
|
48
|
-
box-shadow:
|
|
49
|
-
0 0 0 1px var(--igd-accent),
|
|
50
|
-
inset 0 1px 0 var(--igd-accent),
|
|
51
|
-
inset 0 -1px 0 var(--igd-accent),
|
|
52
|
-
inset -1px 0 0 var(--igd-accent);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
7
|
.search-trigger {
|
|
58
8
|
color: light-dark(var(--ig-gray-600), var(--ig-gray-400));
|
|
59
9
|
}
|
|
60
10
|
|
|
61
|
-
|
|
62
|
-
|
|
11
|
+
// Advanced header has a scope selector before the input, needs start padding
|
|
12
|
+
.igd-search-header {
|
|
13
|
+
padding-inline-start: rem(16px);
|
|
63
14
|
}
|
|
64
15
|
|
|
65
16
|
// TODO BUG IN THE TAB COMPONENT
|
|
@@ -139,64 +90,6 @@
|
|
|
139
90
|
}
|
|
140
91
|
}
|
|
141
92
|
|
|
142
|
-
.igd-search-header {
|
|
143
|
-
display: flex;
|
|
144
|
-
min-height: rem(75px);
|
|
145
|
-
padding-inline-start: rem(16px);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.igd-search-scope {
|
|
149
|
-
flex-shrink: 0;
|
|
150
|
-
align-self: center;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.igd-search-input {
|
|
154
|
-
--input-prefix-background: transparent;
|
|
155
|
-
--input-prefix-background--focused: transparent;
|
|
156
|
-
--input-prefix-background--filled: transparent;
|
|
157
|
-
|
|
158
|
-
--input-suffix-background: transparent;
|
|
159
|
-
--input-suffix-background--focused: transparent;
|
|
160
|
-
--input-suffix-background--filled: transparent;
|
|
161
|
-
|
|
162
|
-
width: 100%;
|
|
163
|
-
min-width: 0;
|
|
164
|
-
flex: 1 1 auto;
|
|
165
|
-
|
|
166
|
-
&::part(input) {
|
|
167
|
-
@include type-style('body-2') {
|
|
168
|
-
margin: 0;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.igd-search-clear {
|
|
174
|
-
--foreground: light-dark(var(--ig-gray-900), var(--ig-gray-900));
|
|
175
|
-
--backgroind-hover: transparent;
|
|
176
|
-
--hover-foreground: var(--igd-accent);
|
|
177
|
-
--focus-hover-foreground: var(--igd-accent);
|
|
178
|
-
--focus-foreground: var(--igd-accent);
|
|
179
|
-
--active-foreground: var(--igd-accent);
|
|
180
|
-
--shadow-color: transparent;
|
|
181
|
-
--background: transparent;
|
|
182
|
-
--hover-background: transparent;
|
|
183
|
-
--focus-background: transparent;
|
|
184
|
-
--focus-hover-background: transparent;
|
|
185
|
-
--active-background: transparent;
|
|
186
|
-
--border-color: transparent;
|
|
187
|
-
--border-radius: 0;
|
|
188
|
-
|
|
189
|
-
&::part(base) {
|
|
190
|
-
&::after {
|
|
191
|
-
display: none;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
&::part(focused) {
|
|
196
|
-
--foreground: var(--igd-accent);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
93
|
.igd-search-tab-count {
|
|
201
94
|
color: light-dark(var(--ig-gray-500), var(--ig-gray-300));
|
|
202
95
|
}
|
|
@@ -40,16 +40,37 @@
|
|
|
40
40
|
*/
|
|
41
41
|
import type { PlatformContext } from '../../../lib/types.ts';
|
|
42
42
|
|
|
43
|
-
type ApiKind = 'class' | 'interface' | 'enum' | 'type' | 'variable' | 'function';
|
|
43
|
+
type ApiKind = 'class' | 'interface' | 'enum' | 'type' | 'variable' | 'function' | 'sass';
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
/** Props for SASS API documentation links (`kind="sass"`). */
|
|
46
|
+
type SassProps = {
|
|
47
|
+
kind: 'sass';
|
|
48
|
+
/** The anchor fragment without "#", e.g. "mixin-slide-in-left". Optional when linking to the module page. */
|
|
49
|
+
type?: string;
|
|
50
|
+
/** SASS module name, e.g. "animations", "themes". Required for correct URL generation. */
|
|
51
|
+
module?: string;
|
|
52
|
+
/**
|
|
53
|
+
* When true, wraps the label in <code>.
|
|
54
|
+
* @default true — matches TypeDoc ApiLink code-formatting behaviour.
|
|
55
|
+
* Set to false for descriptive/prose labels.
|
|
56
|
+
*/
|
|
57
|
+
code?: boolean;
|
|
58
|
+
/** Override the display text. Defaults to `type ?? module ?? ''`. */
|
|
59
|
+
label?: string;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** Props for TypeDoc API documentation links (all non-sass kinds). */
|
|
63
|
+
type TypeDocProps = {
|
|
48
64
|
/**
|
|
49
65
|
* TypeDoc symbol kind. Determines the URL segment used.
|
|
50
66
|
* @default "class"
|
|
51
67
|
*/
|
|
52
|
-
kind?: ApiKind
|
|
68
|
+
kind?: Exclude<ApiKind, 'sass'>;
|
|
69
|
+
/**
|
|
70
|
+
* Short type/symbol name without platform prefix, e.g. "Toast".
|
|
71
|
+
* Required for all TypeDoc kinds.
|
|
72
|
+
*/
|
|
73
|
+
type: string;
|
|
53
74
|
/** Optional member name (property / method), e.g. "show". Appended as #anchor. */
|
|
54
75
|
member?: string;
|
|
55
76
|
/**
|
|
@@ -77,9 +98,11 @@ interface Props {
|
|
|
77
98
|
* @default true
|
|
78
99
|
*/
|
|
79
100
|
suffix?: boolean;
|
|
80
|
-
}
|
|
101
|
+
};
|
|
81
102
|
|
|
82
|
-
|
|
103
|
+
type Props = SassProps | TypeDocProps;
|
|
104
|
+
|
|
105
|
+
const KIND_SEGMENT: Record<Exclude<ApiKind, 'sass'>, string> = {
|
|
83
106
|
class: 'classes',
|
|
84
107
|
interface: 'interfaces',
|
|
85
108
|
enum: 'enums',
|
|
@@ -88,34 +111,53 @@ const KIND_SEGMENT: Record<ApiKind, string> = {
|
|
|
88
111
|
function: 'functions',
|
|
89
112
|
};
|
|
90
113
|
|
|
91
|
-
const
|
|
92
|
-
const { prefix, apiPackages } =
|
|
114
|
+
const ctx = Astro.locals.platformContext as PlatformContext;
|
|
115
|
+
const { prefix, apiPackages } = ctx;
|
|
116
|
+
const label = Astro.props.label;
|
|
93
117
|
|
|
94
|
-
const pkgConfig = apiPackages[pkg] ?? apiPackages['core'];
|
|
95
|
-
const baseType = prefixed ? `${prefix}${type}` : type;
|
|
96
|
-
const segment = KIND_SEGMENT[kind];
|
|
97
118
|
let url: string;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
let displayLabel: string;
|
|
120
|
+
let renderCode: boolean;
|
|
121
|
+
|
|
122
|
+
if (Astro.props.kind === 'sass') {
|
|
123
|
+
const { type, module, code = true } = Astro.props;
|
|
124
|
+
if (!module) console.warn('[ApiLink] kind="sass" requires a `module` prop — link may be malformed.');
|
|
125
|
+
const base = ctx.sassApiUrl?.trim().replace(/\/+$/, '');
|
|
126
|
+
const anchor = type ? `#${type}` : '';
|
|
127
|
+
if (!base) {
|
|
128
|
+
console.warn('[ApiLink] kind="sass" requires `platformContext.sassApiUrl` to be configured — falling back to "#".');
|
|
129
|
+
url = '#';
|
|
130
|
+
} else {
|
|
131
|
+
url = `${base}/${module ?? ''}${anchor}`;
|
|
132
|
+
}
|
|
133
|
+
displayLabel = label ?? type ?? module ?? '';
|
|
134
|
+
renderCode = code;
|
|
108
135
|
} else {
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
:
|
|
116
|
-
|
|
136
|
+
const { type, kind = 'class', member, pkg = 'core', prefixed = true, suffix = true } = Astro.props;
|
|
137
|
+
const pkgConfig = apiPackages[pkg] ?? apiPackages['core'];
|
|
138
|
+
const baseType = prefixed ? `${prefix}${type}` : type;
|
|
139
|
+
const segment = KIND_SEGMENT[kind];
|
|
140
|
+
if (kind === 'class') {
|
|
141
|
+
const fullType = (suffix && pkgConfig.classSuffix) ? `${baseType}${pkgConfig.classSuffix}` : baseType;
|
|
142
|
+
const cased = pkgConfig.preserveCase ? fullType : fullType.toLowerCase();
|
|
143
|
+
const classSlug = pkgConfig.noPackagePrefix
|
|
144
|
+
? cased
|
|
145
|
+
: `${pkgConfig.packageId}.${cased}`;
|
|
146
|
+
const memberAnchor = member
|
|
147
|
+
? `#${pkgConfig.pascalCaseMembers ? member.charAt(0).toUpperCase() + member.slice(1) : member}`
|
|
148
|
+
: '';
|
|
149
|
+
url = `${pkgConfig.docRoot}/classes/${classSlug}${memberAnchor}`;
|
|
150
|
+
} else {
|
|
151
|
+
const slug = pkgConfig.noPackagePrefix
|
|
152
|
+
? baseType
|
|
153
|
+
: `${pkgConfig.packageId}.${baseType}`;
|
|
154
|
+
const memberAnchorNonClass = member
|
|
155
|
+
? `#${pkgConfig.pascalCaseMembers ? member.charAt(0).toUpperCase() + member.slice(1) : member.toLowerCase()}`
|
|
156
|
+
: '';
|
|
157
|
+
url = `${pkgConfig.docRoot}/${segment}/${slug}${memberAnchorNonClass}`;
|
|
158
|
+
}
|
|
159
|
+
displayLabel = label ?? (member ? `${baseType}.${member}` : baseType);
|
|
160
|
+
renderCode = true;
|
|
117
161
|
}
|
|
118
|
-
|
|
119
|
-
const displayLabel = label ?? (member ? `${baseType}.${member}` : baseType);
|
|
120
162
|
---
|
|
121
|
-
<a href={url}
|
|
163
|
+
<a href={url}>{renderCode ? <code>{displayLabel}</code> : displayLabel}</a>
|
|
@@ -9,7 +9,7 @@ igc-tabs {
|
|
|
9
9
|
flex-grow: 1;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
--item-text-color: light-dark(var(--ig-gray-900), var(--ig-gray-
|
|
12
|
+
--item-text-color: light-dark(var(--ig-gray-900), var(--ig-gray-900));
|
|
13
13
|
--item-hover-color: var(--igd-accent);
|
|
14
14
|
--item-background: var(--igd-layout-sections-bg);
|
|
15
15
|
--item-hover-background: var(--igd-layout-sections-bg);
|
|
@@ -20,7 +20,7 @@ igc-tabs {
|
|
|
20
20
|
--item-active-hover-background: var(--igd-layout-sections-bg);
|
|
21
21
|
--indicator-color: var(--igd-accent);
|
|
22
22
|
|
|
23
|
-
--button-color: light-dark(var(--ig-gray-900), var(--ig-gray-
|
|
23
|
+
--button-color: light-dark(var(--ig-gray-900), var(--ig-gray-900));
|
|
24
24
|
--button-hover-color: var(--igd-accent);
|
|
25
25
|
--button-background: var(--igd-layout-sections-bg);
|
|
26
26
|
--button-hover-background: var(--igd-layout-sections-bg);
|
|
@@ -86,7 +86,7 @@ igc-tab::part(content) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
igc-tab::part(tab-header) {
|
|
89
|
-
min-height:
|
|
89
|
+
min-height: rem(60px);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
.igd-code-view {
|
|
@@ -167,9 +167,3 @@ igc-button {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
|
|
171
|
-
.editing-label {
|
|
172
|
-
@include type-style('body-2') {
|
|
173
|
-
margin: 0;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
@@ -33,9 +33,11 @@ export interface Props {
|
|
|
33
33
|
* 'commercial' → Premium badge, 'MIT' → Open Source badge, omit → no badge.
|
|
34
34
|
*/
|
|
35
35
|
license?: string;
|
|
36
|
+
/** Set to true on 404 pages to add the `igd-page-layout--404` modifier class. */
|
|
37
|
+
is404?: boolean;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
const { title, description, keywords, hasToc = true, hasSidebar = true, currentSlug = '', siteTitle: siteTitleProp, license } = Astro.props;
|
|
40
|
+
const { title, description, keywords, hasToc = true, hasSidebar = true, currentSlug = '', siteTitle: siteTitleProp, license, is404 = false } = Astro.props;
|
|
39
41
|
const resolvedSiteTitle = siteTitleProp ?? siteTitle;
|
|
40
42
|
const licenseType = license === 'commercial' ? 'premium' : license === 'MIT' ? 'opensource' : false;
|
|
41
43
|
const navTheme = (virtualPlatform ?? import.meta.env.VITE_NAV_THEME ?? 'igniteui') as string;
|
|
@@ -218,7 +220,7 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
|
|
|
218
220
|
the .igd-page-layout not on the body.
|
|
219
221
|
Any igc component rendered dynamically on body level should have .ig-typography in order to have proper type styles.
|
|
220
222
|
-->
|
|
221
|
-
<div class=
|
|
223
|
+
<div class={`igd-page-layout${is404 ? ' igd-page-layout--404' : ''}`}>
|
|
222
224
|
<!-- TODO: WE DONT NEED TO CALCULAtE THE IG HEADER HEIGHT ANYMORE - REMOVE IT -->
|
|
223
225
|
<!-- <DocsSubHeader style={ `--docs-global-nav-height: ${ showGlobalNav ? '4.7rem': '0' }` } data-nav-height-wrapper/> -->
|
|
224
226
|
<slot name="subheader">
|