@sarj/docs-ui 0.1.0
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/LICENSE +21 -0
- package/README.md +13 -0
- package/package.json +47 -0
- package/src/components/Breadcrumbs.astro +20 -0
- package/src/components/PageAnchor.astro +1 -0
- package/src/components/ReferencePage.astro +55 -0
- package/src/styles/theme.css +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sarj-ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Generated by `sarj-standards maintain docs sync`; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# @sarj/docs-ui
|
|
4
|
+
|
|
5
|
+
Shared Astro and Starlight reference UI for Sarj standards sites
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @sarj/docs-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Rules and configuration are documented in the generated rule directory.
|
|
12
|
+
|
|
13
|
+
[Documentation](https://code-standards.sarj.ai/) · [Source](https://github.com/sarj-ai/standards)
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sarj/docs-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"packageManager": "npm@12.0.2",
|
|
5
|
+
"description": "Shared Astro and Starlight reference UI for Sarj standards sites",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "node tests/package-contract.mjs"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
"./styles.css": "./src/styles/theme.css",
|
|
12
|
+
"./PageAnchor.astro": "./src/components/PageAnchor.astro",
|
|
13
|
+
"./ReferencePage.astro": "./src/components/ReferencePage.astro",
|
|
14
|
+
"./Breadcrumbs.astro": "./src/components/Breadcrumbs.astro"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"src",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"./src/styles/theme.css"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/sarj-ai/standards.git",
|
|
30
|
+
"directory": "packages/docs-ui"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://code-standards.sarj.ai/",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/sarj-ai/standards/issues"
|
|
35
|
+
},
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@fontsource-variable/nunito": "5.3.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@astrojs/starlight": ">=0.41.7 <0.42",
|
|
42
|
+
"astro": ">=7.2.3 <8"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=22.14.0"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Ancestor {
|
|
3
|
+
label: string;
|
|
4
|
+
href: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
ancestors: readonly Ancestor[];
|
|
9
|
+
current: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { ancestors, current } = Astro.props;
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<nav class="breadcrumbs" aria-label="Breadcrumb">
|
|
16
|
+
<ol>
|
|
17
|
+
{ancestors.map((ancestor) => <li><a href={ancestor.href}>{ancestor.label}</a></li>)}
|
|
18
|
+
<li><span aria-current="page">{current}</span></li>
|
|
19
|
+
</ol>
|
|
20
|
+
</nav>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<span id="_top" class="reference-page-anchor" tabindex="-1"></span>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
|
|
3
|
+
import type { StarlightUserConfig } from '@astrojs/starlight/types';
|
|
4
|
+
|
|
5
|
+
type Sidebar = NonNullable<StarlightUserConfig['sidebar']>;
|
|
6
|
+
type Discovery = 'searchable' | 'navigation-only' | 'unlisted';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
title: string;
|
|
10
|
+
description: string;
|
|
11
|
+
sidebar: Sidebar;
|
|
12
|
+
discovery?: Discovery;
|
|
13
|
+
hasSidebar?: boolean;
|
|
14
|
+
template?: 'doc' | 'splash';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
sidebar,
|
|
21
|
+
discovery = 'searchable',
|
|
22
|
+
hasSidebar = true,
|
|
23
|
+
template = 'doc',
|
|
24
|
+
} = Astro.props;
|
|
25
|
+
const pagefind = discovery === 'searchable';
|
|
26
|
+
const noindex = discovery === 'unlisted';
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<StarlightPage
|
|
30
|
+
frontmatter={{
|
|
31
|
+
title,
|
|
32
|
+
description,
|
|
33
|
+
template,
|
|
34
|
+
pagefind,
|
|
35
|
+
prev: false,
|
|
36
|
+
next: false,
|
|
37
|
+
head: noindex ? [{ tag: 'meta', attrs: { name: 'robots', content: 'noindex, nofollow' } }] : [],
|
|
38
|
+
}}
|
|
39
|
+
sidebar={sidebar}
|
|
40
|
+
hasSidebar={hasSidebar}
|
|
41
|
+
>
|
|
42
|
+
<div data-pagefind-body={pagefind ? true : undefined} data-pagefind-ignore={pagefind ? undefined : true}>
|
|
43
|
+
<slot />
|
|
44
|
+
</div>
|
|
45
|
+
</StarlightPage>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
const menu = document.querySelector('starlight-menu-button');
|
|
49
|
+
const menuButton = menu?.querySelector('button');
|
|
50
|
+
if (menu instanceof HTMLElement && menuButton instanceof HTMLButtonElement) {
|
|
51
|
+
const syncExpanded = () => menuButton.setAttribute('aria-expanded', menu.getAttribute('aria-expanded') ?? 'false');
|
|
52
|
+
syncExpanded();
|
|
53
|
+
new MutationObserver(syncExpanded).observe(menu, { attributes: true, attributeFilter: ['aria-expanded'] });
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@import '@fontsource-variable/nunito';
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--sl-font: 'Nunito Variable', Nunito, ui-sans-serif, system-ui, sans-serif;
|
|
5
|
+
--sl-font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
|
|
6
|
+
--sl-content-width: 72rem;
|
|
7
|
+
--sl-color-accent-low: #e9ebff;
|
|
8
|
+
--sl-color-accent: #465be8;
|
|
9
|
+
--sl-color-accent-high: #17205f;
|
|
10
|
+
--sl-color-white: #12141a;
|
|
11
|
+
--sl-color-gray-1: #252934;
|
|
12
|
+
--sl-color-gray-2: #4d5361;
|
|
13
|
+
--sl-color-gray-3: #6e7482;
|
|
14
|
+
--sl-color-gray-4: #b8bdc8;
|
|
15
|
+
--sl-color-gray-5: #dfe2e8;
|
|
16
|
+
--sl-color-gray-6: #f1f2f5;
|
|
17
|
+
--sl-color-black: #ffffff;
|
|
18
|
+
--report: #c34453;
|
|
19
|
+
--pass: #16806d;
|
|
20
|
+
--rule: #e4e6eb;
|
|
21
|
+
--paper: #ffffff;
|
|
22
|
+
--ink: #12141a;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:root[data-theme='dark'] {
|
|
26
|
+
--sl-color-accent-low: #20284c;
|
|
27
|
+
--sl-color-accent: #7787ff;
|
|
28
|
+
--sl-color-accent-high: #eef0ff;
|
|
29
|
+
--sl-color-white: #f4f5f8;
|
|
30
|
+
--sl-color-gray-1: #d8dbe3;
|
|
31
|
+
--sl-color-gray-2: #a5aab7;
|
|
32
|
+
--sl-color-gray-3: #777d8c;
|
|
33
|
+
--sl-color-gray-4: #414653;
|
|
34
|
+
--sl-color-gray-5: #272b34;
|
|
35
|
+
--sl-color-gray-6: #15171d;
|
|
36
|
+
--sl-color-black: #0b0c10;
|
|
37
|
+
--report: #ff8794;
|
|
38
|
+
--pass: #62d5bd;
|
|
39
|
+
--rule: #272a32;
|
|
40
|
+
--paper: #0b0c10;
|
|
41
|
+
--ink: #f4f5f8;
|
|
42
|
+
}
|