@f5-sales-demo/docs-theme 4.5.1 → 4.5.3
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.
|
@@ -13,9 +13,6 @@ const base = import.meta.env.BASE_URL.replace(/\/$/, '');
|
|
|
13
13
|
{!metadata && (entry.id === 'index' || entry.id === '') && <CardGrid>
|
|
14
14
|
{providerSections.map(section => <LinkCard title={section.label} href={`${base}/${section.path}/`} />)}
|
|
15
15
|
</CardGrid>}
|
|
16
|
-
<label class="version-control">Documentation version
|
|
17
|
-
<select id="provider-version" aria-label="Documentation version"><option>{process.env.DOCUMENTATION_LABEL || 'Latest stable'}</option></select>
|
|
18
|
-
</label>
|
|
19
16
|
<slot />
|
|
20
17
|
{metadata && <footer class="provider-provenance">
|
|
21
18
|
<p>Schema path: <code>{metadata.schema_path.join('.') || 'root'}</code> · <a href={metadata.source_url}>Complete Markdown</a></p>
|
|
@@ -27,32 +24,3 @@ const base = import.meta.env.BASE_URL.replace(/\/$/, '');
|
|
|
27
24
|
.provider-provenance small { color: var(--sl-color-gray-3); }
|
|
28
25
|
</style>
|
|
29
26
|
|
|
30
|
-
<script>
|
|
31
|
-
const select = document.querySelector<HTMLSelectElement>('#provider-version');
|
|
32
|
-
const publicationRoot = '/terraform-provider-xcsh/';
|
|
33
|
-
if (select) {
|
|
34
|
-
fetch(`${publicationRoot}documentation-versions.json`).then(response => response.json()).then(data => {
|
|
35
|
-
const path = window.location.pathname.slice(publicationRoot.length);
|
|
36
|
-
const prefix = path.startsWith('versions/') ? path.split('/').slice(0, 2).join('/') + '/' : path.startsWith('preview/main/') ? 'preview/main/' : '';
|
|
37
|
-
const equivalent = path.slice(prefix.length);
|
|
38
|
-
const versions = [{ label: `Latest stable (${data.latest})`, prefix: '' }, ...data.versions.map((version: string) => ({ label: version, prefix: `versions/${version}/` })), { label: 'Main preview', prefix: 'preview/main/' }];
|
|
39
|
-
select.replaceChildren(...versions.map(version => {
|
|
40
|
-
const option = document.createElement('option');
|
|
41
|
-
option.textContent = version.label;
|
|
42
|
-
option.value = version.prefix;
|
|
43
|
-
option.selected = prefix === version.prefix;
|
|
44
|
-
return option;
|
|
45
|
-
}));
|
|
46
|
-
select.addEventListener('change', async () => {
|
|
47
|
-
const landing = `${publicationRoot}${select.value}`;
|
|
48
|
-
const destination = `${landing}${equivalent}`;
|
|
49
|
-
const response = await fetch(destination, { method: 'HEAD' });
|
|
50
|
-
window.location.assign(response.ok ? destination : landing);
|
|
51
|
-
});
|
|
52
|
-
}).catch(() => { select.disabled = true; });
|
|
53
|
-
}
|
|
54
|
-
</script>
|
|
55
|
-
<style>
|
|
56
|
-
.version-control { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; font-size: var(--sl-text-sm); }
|
|
57
|
-
select { max-width: 100%; padding: .25rem; }
|
|
58
|
-
</style>
|
package/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { expect, test } from 'vitest';
|
|
3
|
+
|
|
4
|
+
test('canonical prototype exposes current documentation without version switching', () => {
|
|
5
|
+
const source = readFileSync(new URL('../../components/ProviderReference.astro', import.meta.url), 'utf8');
|
|
6
|
+
expect(source).not.toContain('provider-version');
|
|
7
|
+
expect(source).not.toContain('documentation-versions.json');
|
|
8
|
+
expect(source).not.toContain('preview/main/');
|
|
9
|
+
});
|