@tenphi/starlight 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 +4 -0
- package/dist/client/appearance.d.ts +12 -0
- package/dist/client/appearance.d.ts.map +1 -0
- package/dist/client/appearance.js +66 -0
- package/dist/client/appearance.js.map +1 -0
- package/dist/client/search.d.ts +1 -0
- package/dist/client/search.js +43 -0
- package/dist/client/search.js.map +1 -0
- package/dist/components/Card.astro +14 -0
- package/dist/components/Preview.astro +31 -0
- package/dist/components/Steps.astro +1 -0
- package/dist/components/Tabs.astro +10 -0
- package/dist/components-public.d.ts +6 -0
- package/dist/components.d.ts +5 -0
- package/dist/components.js +5 -0
- package/dist/content-B9C0vXAq.d.ts +12 -0
- package/dist/content-B9C0vXAq.d.ts.map +1 -0
- package/dist/content-Cwk8rm6i.js +30 -0
- package/dist/content-Cwk8rm6i.js.map +1 -0
- package/dist/content.d.ts +2 -0
- package/dist/content.js +2 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +273 -0
- package/dist/index.js.map +1 -0
- package/dist/routes/DocsPage.astro +127 -0
- package/dist/styles.css +191 -0
- package/dist/styles.d.ts +1 -0
- package/package.json +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrey Yamanov
|
|
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,12 @@
|
|
|
1
|
+
//#region src/client/appearance.d.ts
|
|
2
|
+
type Theme = "light" | "dark" | "system";
|
|
3
|
+
type Contrast = "normal" | "more" | "system";
|
|
4
|
+
type Appearance = {
|
|
5
|
+
theme?: Theme;
|
|
6
|
+
contrast?: Contrast;
|
|
7
|
+
};
|
|
8
|
+
declare function applyAppearance(value: Appearance): void;
|
|
9
|
+
declare function saveAppearance(value: Appearance): void;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { applyAppearance, saveAppearance };
|
|
12
|
+
//# sourceMappingURL=appearance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appearance.d.ts","names":[],"sources":["../../src/client/appearance.ts"],"mappings":";KAEK;KACA;KACA;EAAe,QAAQ;EAAO,WAAW;;iBAK9B,gBAAgB,OAAO;iBASvB,eAAe,OAAO"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//#region src/client/appearance.ts
|
|
2
|
+
const STORAGE_KEY = "tasty-docs-appearance";
|
|
3
|
+
const themes = /* @__PURE__ */ new Set([
|
|
4
|
+
"light",
|
|
5
|
+
"dark",
|
|
6
|
+
"system"
|
|
7
|
+
]);
|
|
8
|
+
const contrasts = /* @__PURE__ */ new Set([
|
|
9
|
+
"normal",
|
|
10
|
+
"more",
|
|
11
|
+
"system"
|
|
12
|
+
]);
|
|
13
|
+
function applyAppearance(value) {
|
|
14
|
+
const root = document.documentElement;
|
|
15
|
+
if (value.theme && value.theme !== "system") root.dataset.theme = value.theme;
|
|
16
|
+
else delete root.dataset.theme;
|
|
17
|
+
if (value.contrast && value.contrast !== "system") root.dataset.contrast = value.contrast;
|
|
18
|
+
else delete root.dataset.contrast;
|
|
19
|
+
}
|
|
20
|
+
function saveAppearance(value) {
|
|
21
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(value));
|
|
22
|
+
applyAppearance(value);
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
26
|
+
if (stored) applyAppearance(normalizeAppearance(JSON.parse(stored)));
|
|
27
|
+
} catch {}
|
|
28
|
+
const theme = document.querySelector("[data-docs-theme]");
|
|
29
|
+
const contrast = document.querySelector("[data-docs-contrast]");
|
|
30
|
+
let current = {
|
|
31
|
+
theme: "system",
|
|
32
|
+
contrast: "system"
|
|
33
|
+
};
|
|
34
|
+
try {
|
|
35
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
36
|
+
if (stored) current = normalizeAppearance(JSON.parse(stored));
|
|
37
|
+
} catch {}
|
|
38
|
+
if (theme) theme.value = current.theme ?? "system";
|
|
39
|
+
if (contrast) contrast.value = current.contrast ?? "system";
|
|
40
|
+
const update = () => {
|
|
41
|
+
current = {
|
|
42
|
+
theme: normalizeTheme(theme?.value),
|
|
43
|
+
contrast: normalizeContrast(contrast?.value)
|
|
44
|
+
};
|
|
45
|
+
saveAppearance(current);
|
|
46
|
+
};
|
|
47
|
+
theme?.addEventListener("change", update);
|
|
48
|
+
contrast?.addEventListener("change", update);
|
|
49
|
+
function normalizeAppearance(value) {
|
|
50
|
+
if (!value || typeof value !== "object") return {};
|
|
51
|
+
const record = value;
|
|
52
|
+
return {
|
|
53
|
+
theme: normalizeTheme(record.theme),
|
|
54
|
+
contrast: normalizeContrast(record.contrast)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function normalizeTheme(value) {
|
|
58
|
+
return typeof value === "string" && themes.has(value) ? value : "system";
|
|
59
|
+
}
|
|
60
|
+
function normalizeContrast(value) {
|
|
61
|
+
return typeof value === "string" && contrasts.has(value) ? value : "system";
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { applyAppearance, saveAppearance };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=appearance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appearance.js","names":[],"sources":["../../src/client/appearance.ts"],"sourcesContent":["const STORAGE_KEY = \"tasty-docs-appearance\";\n\ntype Theme = \"light\" | \"dark\" | \"system\";\ntype Contrast = \"normal\" | \"more\" | \"system\";\ntype Appearance = { theme?: Theme; contrast?: Contrast };\n\nconst themes = new Set([\"light\", \"dark\", \"system\"]);\nconst contrasts = new Set([\"normal\", \"more\", \"system\"]);\n\nexport function applyAppearance(value: Appearance): void {\n const root = document.documentElement;\n if (value.theme && value.theme !== \"system\") root.dataset.theme = value.theme;\n else delete root.dataset.theme;\n if (value.contrast && value.contrast !== \"system\")\n root.dataset.contrast = value.contrast;\n else delete root.dataset.contrast;\n}\n\nexport function saveAppearance(value: Appearance): void {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(value));\n applyAppearance(value);\n}\n\ntry {\n const stored = localStorage.getItem(STORAGE_KEY);\n if (stored) applyAppearance(normalizeAppearance(JSON.parse(stored)));\n} catch {\n // Storage may be unavailable; CSS media queries remain the fallback.\n}\n\nconst theme = document.querySelector<HTMLSelectElement>(\"[data-docs-theme]\");\nconst contrast = document.querySelector<HTMLSelectElement>(\n \"[data-docs-contrast]\",\n);\nlet current: Appearance = { theme: \"system\", contrast: \"system\" };\ntry {\n const stored = localStorage.getItem(STORAGE_KEY);\n if (stored) current = normalizeAppearance(JSON.parse(stored));\n} catch {\n // The controls retain system defaults when storage is unavailable.\n}\nif (theme) theme.value = current.theme ?? \"system\";\nif (contrast) contrast.value = current.contrast ?? \"system\";\nconst update = () => {\n current = {\n theme: normalizeTheme(theme?.value),\n contrast: normalizeContrast(contrast?.value),\n };\n saveAppearance(current);\n};\ntheme?.addEventListener(\"change\", update);\ncontrast?.addEventListener(\"change\", update);\n\nfunction normalizeAppearance(value: unknown): Appearance {\n if (!value || typeof value !== \"object\") return {};\n const record = value as Record<string, unknown>;\n return {\n theme: normalizeTheme(record.theme),\n contrast: normalizeContrast(record.contrast),\n };\n}\n\nfunction normalizeTheme(value: unknown): Theme {\n return typeof value === \"string\" && themes.has(value)\n ? (value as Theme)\n : \"system\";\n}\n\nfunction normalizeContrast(value: unknown): Contrast {\n return typeof value === \"string\" && contrasts.has(value)\n ? (value as Contrast)\n : \"system\";\n}\n"],"mappings":";AAAA,MAAM,cAAc;AAMpB,MAAM,yBAAS,IAAI,IAAI;CAAC;CAAS;CAAQ;AAAQ,CAAC;AAClD,MAAM,4BAAY,IAAI,IAAI;CAAC;CAAU;CAAQ;AAAQ,CAAC;AAEtD,SAAgB,gBAAgB,OAAyB;CACvD,MAAM,OAAO,SAAS;CACtB,IAAI,MAAM,SAAS,MAAM,UAAU,UAAU,KAAK,QAAQ,QAAQ,MAAM;MACnE,OAAO,KAAK,QAAQ;CACzB,IAAI,MAAM,YAAY,MAAM,aAAa,UACvC,KAAK,QAAQ,WAAW,MAAM;MAC3B,OAAO,KAAK,QAAQ;AAC3B;AAEA,SAAgB,eAAe,OAAyB;CACtD,aAAa,QAAQ,aAAa,KAAK,UAAU,KAAK,CAAC;CACvD,gBAAgB,KAAK;AACvB;AAEA,IAAI;CACF,MAAM,SAAS,aAAa,QAAQ,WAAW;CAC/C,IAAI,QAAQ,gBAAgB,oBAAoB,KAAK,MAAM,MAAM,CAAC,CAAC;AACrE,QAAQ,CAER;AAEA,MAAM,QAAQ,SAAS,cAAiC,mBAAmB;AAC3E,MAAM,WAAW,SAAS,cACxB,sBACF;AACA,IAAI,UAAsB;CAAE,OAAO;CAAU,UAAU;AAAS;AAChE,IAAI;CACF,MAAM,SAAS,aAAa,QAAQ,WAAW;CAC/C,IAAI,QAAQ,UAAU,oBAAoB,KAAK,MAAM,MAAM,CAAC;AAC9D,QAAQ,CAER;AACA,IAAI,OAAO,MAAM,QAAQ,QAAQ,SAAS;AAC1C,IAAI,UAAU,SAAS,QAAQ,QAAQ,YAAY;AACnD,MAAM,eAAe;CACnB,UAAU;EACR,OAAO,eAAe,OAAO,KAAK;EAClC,UAAU,kBAAkB,UAAU,KAAK;CAC7C;CACA,eAAe,OAAO;AACxB;AACA,OAAO,iBAAiB,UAAU,MAAM;AACxC,UAAU,iBAAiB,UAAU,MAAM;AAE3C,SAAS,oBAAoB,OAA4B;CACvD,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO,CAAC;CACjD,MAAM,SAAS;CACf,OAAO;EACL,OAAO,eAAe,OAAO,KAAK;EAClC,UAAU,kBAAkB,OAAO,QAAQ;CAC7C;AACF;AAEA,SAAS,eAAe,OAAuB;CAC7C,OAAO,OAAO,UAAU,YAAY,OAAO,IAAI,KAAK,IAC/C,QACD;AACN;AAEA,SAAS,kBAAkB,OAA0B;CACnD,OAAO,OAAO,UAAU,YAAY,UAAU,IAAI,KAAK,IAClD,QACD;AACN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/client/search.ts
|
|
2
|
+
const open = document.querySelector("[data-docs-search-open]");
|
|
3
|
+
const dialog = document.querySelector("[data-docs-search]");
|
|
4
|
+
const input = document.querySelector("[data-docs-search-input]");
|
|
5
|
+
const status = document.querySelector("[data-docs-search-status]");
|
|
6
|
+
const results = document.querySelector("[data-docs-search-results]");
|
|
7
|
+
const base = document.querySelector("[data-docs-base]")?.dataset.docsBase ?? "/";
|
|
8
|
+
const basePath = base === "/" ? "" : `/${base.replace(/^\/+|\/+$/g, "")}`;
|
|
9
|
+
open?.addEventListener("click", () => {
|
|
10
|
+
dialog?.showModal();
|
|
11
|
+
input?.focus();
|
|
12
|
+
});
|
|
13
|
+
let pagefind;
|
|
14
|
+
input?.addEventListener("input", async () => {
|
|
15
|
+
const query = input.value.trim();
|
|
16
|
+
if (!status || !results) return;
|
|
17
|
+
if (!query) {
|
|
18
|
+
status.textContent = "";
|
|
19
|
+
results.replaceChildren();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
status.textContent = "Searching…";
|
|
23
|
+
const modulePath = `${basePath}/pagefind/pagefind.js`;
|
|
24
|
+
pagefind ??= import(
|
|
25
|
+
/* @vite-ignore */
|
|
26
|
+
modulePath
|
|
27
|
+
);
|
|
28
|
+
const response = await (await pagefind).search(query);
|
|
29
|
+
const records = await Promise.all(response.results.slice(0, 12).map((result) => result.data()));
|
|
30
|
+
results.replaceChildren(...records.map((record) => {
|
|
31
|
+
const item = document.createElement("li");
|
|
32
|
+
const link = document.createElement("a");
|
|
33
|
+
link.href = `${basePath}${record.url}`;
|
|
34
|
+
link.textContent = record.meta.title ?? record.url;
|
|
35
|
+
item.append(link);
|
|
36
|
+
return item;
|
|
37
|
+
}));
|
|
38
|
+
status.textContent = `${records.length} result${records.length === 1 ? "" : "s"}`;
|
|
39
|
+
});
|
|
40
|
+
//#endregion
|
|
41
|
+
export {};
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","names":[],"sources":["../../src/client/search.ts"],"sourcesContent":["export {};\n\nconst open = document.querySelector<HTMLButtonElement>(\n \"[data-docs-search-open]\",\n);\nconst dialog = document.querySelector<HTMLDialogElement>(\"[data-docs-search]\");\nconst input = document.querySelector<HTMLInputElement>(\n \"[data-docs-search-input]\",\n);\nconst status = document.querySelector<HTMLElement>(\"[data-docs-search-status]\");\nconst results = document.querySelector<HTMLUListElement>(\n \"[data-docs-search-results]\",\n);\nconst base =\n document.querySelector<HTMLElement>(\"[data-docs-base]\")?.dataset.docsBase ??\n \"/\";\nconst basePath = base === \"/\" ? \"\" : `/${base.replace(/^\\/+|\\/+$/g, \"\")}`;\n\nopen?.addEventListener(\"click\", () => {\n dialog?.showModal();\n input?.focus();\n});\n\ntype Pagefind = {\n search(query: string): Promise<{\n results: Array<{\n data(): Promise<{ url: string; meta: { title?: string } }>;\n }>;\n }>;\n};\nlet pagefind: Promise<Pagefind> | undefined;\ninput?.addEventListener(\"input\", async () => {\n const query = input.value.trim();\n if (!status || !results) return;\n if (!query) {\n status.textContent = \"\";\n results.replaceChildren();\n return;\n }\n status.textContent = \"Searching…\";\n const modulePath = `${basePath}/pagefind/pagefind.js`;\n pagefind ??= import(/* @vite-ignore */ modulePath);\n const response = await (await pagefind).search(query);\n const records = await Promise.all(\n response.results.slice(0, 12).map((result) => result.data()),\n );\n results.replaceChildren(\n ...records.map((record) => {\n const item = document.createElement(\"li\");\n const link = document.createElement(\"a\");\n link.href = `${basePath}${record.url}`;\n link.textContent = record.meta.title ?? record.url;\n item.append(link);\n return item;\n }),\n );\n status.textContent = `${records.length} result${records.length === 1 ? \"\" : \"s\"}`;\n});\n"],"mappings":";AAEA,MAAM,OAAO,SAAS,cACpB,yBACF;AACA,MAAM,SAAS,SAAS,cAAiC,oBAAoB;AAC7E,MAAM,QAAQ,SAAS,cACrB,0BACF;AACA,MAAM,SAAS,SAAS,cAA2B,2BAA2B;AAC9E,MAAM,UAAU,SAAS,cACvB,4BACF;AACA,MAAM,OACJ,SAAS,cAA2B,kBAAkB,CAAC,EAAE,QAAQ,YACjE;AACF,MAAM,WAAW,SAAS,MAAM,KAAK,IAAI,KAAK,QAAQ,cAAc,EAAE;AAEtE,MAAM,iBAAiB,eAAe;CACpC,QAAQ,UAAU;CAClB,OAAO,MAAM;AACf,CAAC;AASD,IAAI;AACJ,OAAO,iBAAiB,SAAS,YAAY;CAC3C,MAAM,QAAQ,MAAM,MAAM,KAAK;CAC/B,IAAI,CAAC,UAAU,CAAC,SAAS;CACzB,IAAI,CAAC,OAAO;EACV,OAAO,cAAc;EACrB,QAAQ,gBAAgB;EACxB;CACF;CACA,OAAO,cAAc;CACrB,MAAM,aAAa,GAAG,SAAS;CAC/B,aAAa;;EAA0B;;CACvC,MAAM,WAAW,OAAO,MAAM,SAAA,CAAU,OAAO,KAAK;CACpD,MAAM,UAAU,MAAM,QAAQ,IAC5B,SAAS,QAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK,WAAW,OAAO,KAAK,CAAC,CAC7D;CACA,QAAQ,gBACN,GAAG,QAAQ,KAAK,WAAW;EACzB,MAAM,OAAO,SAAS,cAAc,IAAI;EACxC,MAAM,OAAO,SAAS,cAAc,GAAG;EACvC,KAAK,OAAO,GAAG,WAAW,OAAO;EACjC,KAAK,cAAc,OAAO,KAAK,SAAS,OAAO;EAC/C,KAAK,OAAO,IAAI;EAChB,OAAO;CACT,CAAC,CACH;CACA,OAAO,cAAc,GAAG,QAAQ,OAAO,SAAS,QAAQ,WAAW,IAAI,KAAK;AAC9E,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
title?: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const { title, href } = Astro.props;
|
|
8
|
+
const Tag = href ? "a" : "article";
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<Tag class="td-card" href={href} data-tasty-anatomy="Card">
|
|
12
|
+
{title && <h3 data-tasty-anatomy="CardTitle">{title}</h3>}
|
|
13
|
+
<div data-tasty-anatomy="CardBody"><slot /></div>
|
|
14
|
+
</Tag>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
html?: string;
|
|
5
|
+
css?: string;
|
|
6
|
+
javascript?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { title, html = "", css = "", javascript } = Astro.props;
|
|
10
|
+
const source = `<!doctype html><meta charset="utf-8"><style>${css}</style>${html}${javascript ? `<script>${javascript}<\/script>` : ""}`;
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<figure class="td-preview" aria-label={title} data-tasty-anatomy="Preview">
|
|
14
|
+
<figcaption><strong>{title}</strong></figcaption>
|
|
15
|
+
{
|
|
16
|
+
javascript ? (
|
|
17
|
+
<iframe title={title} sandbox="allow-scripts" srcdoc={source} />
|
|
18
|
+
) : (
|
|
19
|
+
<div class="td-preview__stage">
|
|
20
|
+
<template
|
|
21
|
+
shadowrootmode="open"
|
|
22
|
+
set:html={`<style>${css}</style>${html}`}
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
<details class="td-preview__code">
|
|
28
|
+
<summary>View source</summary>
|
|
29
|
+
<pre><code>{source}</code></pre>
|
|
30
|
+
</details>
|
|
31
|
+
</figure>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<ol class="td-steps" data-tasty-anatomy="Steps"><slot /></ol>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DocsConfig } from "@tenphi/docs";
|
|
2
|
+
//#region src/content.d.ts
|
|
3
|
+
declare function createStarlightCollection(config?: DocsConfig, root?: string): {
|
|
4
|
+
loader: {
|
|
5
|
+
name: string;
|
|
6
|
+
load(context: import("@tenphi/docs/content").DocsLoaderContext): Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
schema: any;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { createStarlightCollection as t };
|
|
12
|
+
//# sourceMappingURL=content-B9C0vXAq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-B9C0vXAq.d.ts","names":[],"sources":["../src/content.ts"],"mappings":";;iBAGgB,0BAA0B,SAAS,YAAY;EAE3D;;qEAF+C;;EAG/C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { register } from "node:module";
|
|
2
|
+
import { register as register$1 } from "tsx/esm/api";
|
|
3
|
+
import { createDocsLoader } from "@tenphi/docs";
|
|
4
|
+
//#region src/starlight-runtime.js
|
|
5
|
+
register(`data:text/javascript,${encodeURIComponent(`
|
|
6
|
+
import { readFile } from 'node:fs/promises';
|
|
7
|
+
export async function load(url, context, nextLoad) {
|
|
8
|
+
if (url.includes('.jsonc')) {
|
|
9
|
+
const file = new URL(url.split('?')[0]);
|
|
10
|
+
const contents = await readFile(file, 'utf8');
|
|
11
|
+
return { format: 'module', source: 'export default ' + JSON.stringify(contents), shortCircuit: true };
|
|
12
|
+
}
|
|
13
|
+
return nextLoad(url, context);
|
|
14
|
+
}
|
|
15
|
+
`)}`, import.meta.url);
|
|
16
|
+
const unregister = register$1();
|
|
17
|
+
const [{ default: starlight }, { docsSchema }] = await Promise.all([import("@astrojs/starlight"), import("@astrojs/starlight/schema")]);
|
|
18
|
+
unregister();
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/content.ts
|
|
21
|
+
function createStarlightCollection(config, root) {
|
|
22
|
+
return {
|
|
23
|
+
loader: createDocsLoader(config, root ? { root } : {}),
|
|
24
|
+
schema: docsSchema()
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { starlight as n, createStarlightCollection as t };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=content-Cwk8rm6i.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-Cwk8rm6i.js","names":["registerLoader","register"],"sources":["../src/starlight-runtime.js","../src/content.ts"],"sourcesContent":["import { register as registerLoader } from \"node:module\";\nimport { register } from \"tsx/esm/api\";\n\nconst rawLoaderSource = `\n import { readFile } from 'node:fs/promises';\n export async function load(url, context, nextLoad) {\n if (url.includes('.jsonc')) {\n const file = new URL(url.split('?')[0]);\n const contents = await readFile(file, 'utf8');\n return { format: 'module', source: 'export default ' + JSON.stringify(contents), shortCircuit: true };\n }\n return nextLoad(url, context);\n }\n`;\nregisterLoader(\n `data:text/javascript,${encodeURIComponent(rawLoaderSource)}`,\n import.meta.url,\n);\nconst unregister = register();\nconst [{ default: starlight }, { docsSchema }] = await Promise.all([\n import(\"@astrojs/starlight\"),\n import(\"@astrojs/starlight/schema\"),\n]);\nunregister();\n\nexport { docsSchema };\nexport default starlight;\n","import { docsSchema } from \"./starlight-schema-runtime.js\";\nimport { createDocsLoader, type DocsConfig } from \"@tenphi/docs\";\n\nexport function createStarlightCollection(config?: DocsConfig, root?: string) {\n return {\n loader: createDocsLoader(config, root ? { root } : {}),\n schema: docsSchema(),\n };\n}\n"],"mappings":";;;;AAcAA,SACE,wBAAwB,mBAAmB;;;;;;;;;;CAAe,KAC1D,YAAY,GACd;AACA,MAAM,aAAaC,WAAS;AAC5B,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,gBAAgB,MAAM,QAAQ,IAAI,CACjE,OAAO,uBACP,OAAO,4BACT,CAAC;AACD,WAAW;;;ACpBX,SAAgB,0BAA0B,QAAqB,MAAe;CAC5E,OAAO;EACL,QAAQ,iBAAiB,QAAQ,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC;EACrD,QAAQ,WAAW;CACrB;AACF"}
|
package/dist/content.js
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { t as createStarlightCollection } from "./content-B9C0vXAq.js";
|
|
2
|
+
import { DocsConfig, DocsDiagnostic, ThemeConfig } from "@tenphi/docs";
|
|
3
|
+
import { AstroIntegration } from "astro";
|
|
4
|
+
//#region src/starlight-runtime.d.ts
|
|
5
|
+
interface StarlightOptions {
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
customCss?: string[];
|
|
9
|
+
pagefind?: false | Record<string, unknown>;
|
|
10
|
+
sidebar?: unknown[];
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
declare function starlight(options: StarlightOptions): AstroIntegration;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/integration.d.ts
|
|
16
|
+
interface TastyDocsOptions {
|
|
17
|
+
config?: DocsConfig;
|
|
18
|
+
root?: string;
|
|
19
|
+
}
|
|
20
|
+
declare function tastyDocs(options?: TastyDocsOptions): AstroIntegration;
|
|
21
|
+
declare function tastyStarlight(config: Parameters<typeof starlight>[0]): AstroIntegration;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/theme/index.d.ts
|
|
24
|
+
interface ResolvedDocsTheme {
|
|
25
|
+
css: string;
|
|
26
|
+
colors: {
|
|
27
|
+
surface: Record<string, string>;
|
|
28
|
+
accentText: Record<string, string>;
|
|
29
|
+
accentSurface: Record<string, string>;
|
|
30
|
+
accentSurfaceText: Record<string, string>;
|
|
31
|
+
focus: Record<string, string>;
|
|
32
|
+
};
|
|
33
|
+
contrast: {
|
|
34
|
+
light: number;
|
|
35
|
+
dark: number;
|
|
36
|
+
lightContrast: number;
|
|
37
|
+
darkContrast: number;
|
|
38
|
+
};
|
|
39
|
+
diagnostics: DocsDiagnostic[];
|
|
40
|
+
}
|
|
41
|
+
declare function resolveDocsTheme(theme?: ThemeConfig): ResolvedDocsTheme;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { type ResolvedDocsTheme, type TastyDocsOptions, createStarlightCollection, tastyDocs as default, resolveDocsTheme, tastyStarlight };
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/starlight-runtime.d.ts","../src/integration.ts","../src/theme/index.ts"],"mappings":";;;;UAEiB;EACf;EACA;EACA;EACA,mBAAmB;EACnB;GACC;;iBAGqB,UAAU,SAAS,mBAAmB;;;UCU7C;EACf,SAAS;EACT;;iBAGsB,UACtB,UAAS,mBACR;iBAkNa,eACd,QAAQ,kBAAkB,gBACzB;;;UCrOc;EACf;EACA;IACE,SAAS;IACT,YAAY;IACZ,eAAe;IACf,mBAAmB;IACnB,OAAO;;EAET;IACE;IACA;IACA;IACA;;EAEF,aAAa;;iBAGC,iBAAiB,QAAO,cAAmB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { n as starlight, t as createStarlightCollection } from "./content-Cwk8rm6i.js";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { cp, mkdir } from "node:fs/promises";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { assertValidDocs, createDocsGraph } from "@tenphi/docs";
|
|
8
|
+
import { tastyIntegration } from "@tenphi/tasty/ssr/astro";
|
|
9
|
+
import { apcaContrast, glaze, okhslToLinearSrgb, relativeLuminanceFromLinearRgb, variantToOkhsl } from "@tenphi/glaze";
|
|
10
|
+
//#region src/theme/index.ts
|
|
11
|
+
function resolveDocsTheme(theme = {}) {
|
|
12
|
+
const brand = normalizeBrand(theme.brand);
|
|
13
|
+
const authoredTarget = brand.contrast?.apca ?? 45;
|
|
14
|
+
const normalTarget = Array.isArray(authoredTarget) ? authoredTarget[0] : authoredTarget;
|
|
15
|
+
const highTarget = Array.isArray(authoredTarget) ? authoredTarget[1] : normalTarget + 15;
|
|
16
|
+
const surface = glaze.color({
|
|
17
|
+
from: "#ffffff",
|
|
18
|
+
mode: "auto"
|
|
19
|
+
});
|
|
20
|
+
const accentText = glaze.color({
|
|
21
|
+
from: brand.from,
|
|
22
|
+
base: surface,
|
|
23
|
+
role: "text",
|
|
24
|
+
contrast: { apca: authoredTarget },
|
|
25
|
+
mode: "auto"
|
|
26
|
+
}, {
|
|
27
|
+
autoFlip: true,
|
|
28
|
+
...theme.contrastLevel !== void 0 ? { contrastLevel: theme.contrastLevel } : {}
|
|
29
|
+
});
|
|
30
|
+
const focus = glaze.color({
|
|
31
|
+
from: brand.from,
|
|
32
|
+
base: surface,
|
|
33
|
+
role: "border",
|
|
34
|
+
contrast: { apca: authoredTarget },
|
|
35
|
+
mode: "auto"
|
|
36
|
+
}, { autoFlip: true });
|
|
37
|
+
const accentSurface = glaze.color({
|
|
38
|
+
from: brand.from,
|
|
39
|
+
mode: "fixed"
|
|
40
|
+
});
|
|
41
|
+
const accentSurfaceText = glaze.color({
|
|
42
|
+
from: "#ffffff",
|
|
43
|
+
base: accentSurface,
|
|
44
|
+
role: "text",
|
|
45
|
+
contrast: { apca: 60 },
|
|
46
|
+
mode: "auto"
|
|
47
|
+
});
|
|
48
|
+
const resolvedSurface = surface.resolve();
|
|
49
|
+
const resolvedAccent = accentText.resolve();
|
|
50
|
+
const scores = {
|
|
51
|
+
light: score(resolvedAccent.light, resolvedSurface.light),
|
|
52
|
+
dark: score(resolvedAccent.dark, resolvedSurface.dark),
|
|
53
|
+
lightContrast: score(resolvedAccent.lightContrast, resolvedSurface.lightContrast),
|
|
54
|
+
darkContrast: score(resolvedAccent.darkContrast, resolvedSurface.darkContrast)
|
|
55
|
+
};
|
|
56
|
+
const diagnostics = [];
|
|
57
|
+
for (const [scheme, measured] of Object.entries(scores)) {
|
|
58
|
+
const required = scheme.includes("Contrast") ? highTarget : normalTarget;
|
|
59
|
+
if (measured + .05 < required) diagnostics.push({
|
|
60
|
+
code: "DOCS_BRAND_CONTRAST_UNMET",
|
|
61
|
+
severity: "error",
|
|
62
|
+
message: `Brand contrast in ${scheme} is Lc ${measured.toFixed(1)}; required Lc ${required}.`,
|
|
63
|
+
hint: `Authored color: ${String(brand.from)}.`
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const outputOptions = { modes: { highContrast: true } };
|
|
67
|
+
const colors = {
|
|
68
|
+
surface: surface.json(outputOptions),
|
|
69
|
+
accentText: accentText.json(outputOptions),
|
|
70
|
+
accentSurface: accentSurface.json(outputOptions),
|
|
71
|
+
accentSurfaceText: accentSurfaceText.json(outputOptions),
|
|
72
|
+
focus: focus.json(outputOptions)
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
css: themeCss(colors, theme),
|
|
76
|
+
colors,
|
|
77
|
+
contrast: scores,
|
|
78
|
+
diagnostics
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function normalizeBrand(brand) {
|
|
82
|
+
if (typeof brand === "object" && brand !== null && "from" in brand) return brand;
|
|
83
|
+
return { from: brand ?? "#315efb" };
|
|
84
|
+
}
|
|
85
|
+
function score(foreground, background) {
|
|
86
|
+
return Math.abs(apcaContrast(luminance(foreground), luminance(background)));
|
|
87
|
+
}
|
|
88
|
+
function luminance(variant) {
|
|
89
|
+
const { h, s, l } = variantToOkhsl(variant);
|
|
90
|
+
return relativeLuminanceFromLinearRgb(okhslToLinearSrgb(h, s, l, variant.pastel));
|
|
91
|
+
}
|
|
92
|
+
function themeCss(colors, theme) {
|
|
93
|
+
const declarations = (mode) => [
|
|
94
|
+
`--td-surface:${colors.surface[mode]}`,
|
|
95
|
+
`--td-accent-text:${colors.accentText[mode]}`,
|
|
96
|
+
`--td-accent-surface:${colors.accentSurface[mode]}`,
|
|
97
|
+
`--td-accent-surface-text:${colors.accentSurfaceText[mode]}`,
|
|
98
|
+
`--td-focus:${colors.focus[mode]}`,
|
|
99
|
+
...Object.entries(theme.tokens ?? {}).map(([name, value]) => `${name}:${String(value)}`)
|
|
100
|
+
].join(";");
|
|
101
|
+
return [
|
|
102
|
+
`:root{${declarations("dark")}}`,
|
|
103
|
+
`:root[data-theme=light]{${declarations("light")}}`,
|
|
104
|
+
`@media(prefers-color-scheme:light){:root:not([data-theme]){${declarations("light")}}}`,
|
|
105
|
+
`@media(prefers-contrast:more){:root{${declarations("darkContrast")}}:root[data-theme=light]{${declarations("lightContrast")}}@media(prefers-color-scheme:light){:root:not([data-theme]){${declarations("lightContrast")}}}}`,
|
|
106
|
+
`:root[data-contrast=more]{${declarations("darkContrast")}}`,
|
|
107
|
+
`:root[data-theme=light][data-contrast=more]{${declarations("lightContrast")}}`
|
|
108
|
+
].join("\n");
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/integration.ts
|
|
112
|
+
const packageRequire = createRequire(import.meta.url);
|
|
113
|
+
const starlightRoot = dirname(packageRequire.resolve("@astrojs/starlight"));
|
|
114
|
+
const tastyStaticMiddleware = packageRequire.resolve("@tenphi/tasty/ssr/astro-middleware-static");
|
|
115
|
+
function tastyDocs(options = {}) {
|
|
116
|
+
const docsTheme = resolveDocsTheme(options.config?.theme);
|
|
117
|
+
if (docsTheme.diagnostics.some((diagnostic) => diagnostic.severity === "error")) throw new Error(docsTheme.diagnostics.map((diagnostic) => diagnostic.message).join("\n"));
|
|
118
|
+
const cssPath = fileURLToPath(new URL("./styles.css", import.meta.url));
|
|
119
|
+
const searchClientPath = fileURLToPath(new URL("./client/search.js", import.meta.url));
|
|
120
|
+
const appearanceClientPath = fileURLToPath(new URL("./client/appearance.js", import.meta.url));
|
|
121
|
+
const inner = [tastyIntegration({ islands: false }), starlight({
|
|
122
|
+
title: options.config?.site?.title ?? "Documentation",
|
|
123
|
+
...options.config?.site?.description ? { description: options.config.site.description } : {},
|
|
124
|
+
customCss: ["virtual:tasty-docs/theme.css", cssPath],
|
|
125
|
+
...options.config?.search?.enabled === false ? { pagefind: false } : {},
|
|
126
|
+
sidebar: [{
|
|
127
|
+
label: "Documentation",
|
|
128
|
+
items: [{ autogenerate: { directory: "" } }]
|
|
129
|
+
}]
|
|
130
|
+
})];
|
|
131
|
+
let projectRoot = options.root;
|
|
132
|
+
let graphConfig = options.config;
|
|
133
|
+
let graph;
|
|
134
|
+
let usingStarlight = false;
|
|
135
|
+
return {
|
|
136
|
+
name: "tasty-docs",
|
|
137
|
+
hooks: {
|
|
138
|
+
"astro:config:setup": async (context) => {
|
|
139
|
+
if (context.config.integrations.some((integration) => integration.name === "@astrojs/starlight")) throw new Error("Tasty Docs already includes Starlight. Remove the direct @astrojs/starlight integration before continuing.");
|
|
140
|
+
projectRoot ??= fileURLToPath(context.config.root);
|
|
141
|
+
const base = options.config?.build?.base ?? context.config.base;
|
|
142
|
+
graphConfig = {
|
|
143
|
+
...options.config,
|
|
144
|
+
build: {
|
|
145
|
+
...options.config?.build,
|
|
146
|
+
base
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
usingStarlight = hasContentConfig(context.config.srcDir);
|
|
150
|
+
context.updateConfig({
|
|
151
|
+
base,
|
|
152
|
+
output: "static",
|
|
153
|
+
vite: {
|
|
154
|
+
ssr: { external: ["@tenphi/docs"] },
|
|
155
|
+
plugins: [virtualDocsPlugin(docsTheme.css, () => ({
|
|
156
|
+
entries: graph?.entries ?? [],
|
|
157
|
+
routes: graph?.routes ?? [],
|
|
158
|
+
site: graph?.config.site ?? options.config?.site ?? {},
|
|
159
|
+
base: graph?.config.build.base ?? base,
|
|
160
|
+
search: graph?.config.search.enabled ?? options.config?.search?.enabled ?? true
|
|
161
|
+
}))],
|
|
162
|
+
resolve: { alias: [{
|
|
163
|
+
find: "@astrojs/starlight",
|
|
164
|
+
replacement: starlightRoot
|
|
165
|
+
}, {
|
|
166
|
+
find: "@tenphi/tasty/ssr/astro-middleware-static",
|
|
167
|
+
replacement: tastyStaticMiddleware
|
|
168
|
+
}] }
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
await callInner(inner.slice(0, 1), "astro:config:setup", context);
|
|
172
|
+
if (!usingStarlight) {
|
|
173
|
+
graph = await createDocsGraph({
|
|
174
|
+
root: projectRoot,
|
|
175
|
+
config: graphConfig
|
|
176
|
+
});
|
|
177
|
+
assertValidDocs(graph);
|
|
178
|
+
if (graph.config.search.enabled) context.injectScript("page", `import ${JSON.stringify(searchClientPath)};`);
|
|
179
|
+
context.injectScript("page", `import ${JSON.stringify(appearanceClientPath)};`);
|
|
180
|
+
context.injectRoute({
|
|
181
|
+
pattern: "[...route]",
|
|
182
|
+
entrypoint: new URL("./routes/DocsPage.astro", import.meta.url),
|
|
183
|
+
prerender: true
|
|
184
|
+
});
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const starlightIntegration = inner[1];
|
|
188
|
+
if (starlightIntegration) {
|
|
189
|
+
const selfIndex = context.config.integrations.findIndex((integration) => integration.name === "tasty-docs");
|
|
190
|
+
context.config.integrations.splice(selfIndex + 1, 0, starlightIntegration);
|
|
191
|
+
try {
|
|
192
|
+
await callInner([starlightIntegration], "astro:config:setup", context);
|
|
193
|
+
} finally {
|
|
194
|
+
const placeholderIndex = context.config.integrations.indexOf(starlightIntegration);
|
|
195
|
+
if (placeholderIndex >= 0) context.config.integrations.splice(placeholderIndex, 1);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"astro:config:done": async (context) => {
|
|
200
|
+
await callInner(usingStarlight ? inner : inner.slice(0, 1), "astro:config:done", context);
|
|
201
|
+
},
|
|
202
|
+
"astro:build:start": async (context) => {
|
|
203
|
+
if (!graph) {
|
|
204
|
+
graph = await createDocsGraph({
|
|
205
|
+
...projectRoot ? { root: projectRoot } : {},
|
|
206
|
+
...graphConfig ? { config: graphConfig } : {}
|
|
207
|
+
});
|
|
208
|
+
assertValidDocs(graph);
|
|
209
|
+
}
|
|
210
|
+
await callInner(usingStarlight ? inner : inner.slice(0, 1), "astro:build:start", context);
|
|
211
|
+
},
|
|
212
|
+
"astro:build:done": async (context) => {
|
|
213
|
+
await callInner(usingStarlight ? inner : inner.slice(0, 1), "astro:build:done", context);
|
|
214
|
+
if (!graph) return;
|
|
215
|
+
const output = fileURLToPath(context.dir);
|
|
216
|
+
for (const asset of graph.assets) {
|
|
217
|
+
if (!asset.sourcePath || !asset.publicPath) continue;
|
|
218
|
+
const target = join(output, asset.publicPath.replace(/^\//, ""));
|
|
219
|
+
await mkdir(dirname(target), { recursive: true });
|
|
220
|
+
await cp(asset.sourcePath, target);
|
|
221
|
+
}
|
|
222
|
+
if (!usingStarlight && graph.config.search.enabled) {
|
|
223
|
+
const { close, createIndex } = await import("pagefind");
|
|
224
|
+
const created = await createIndex({ rootSelector: "[data-pagefind-body]" });
|
|
225
|
+
if (!created.index || created.errors.length > 0) throw new Error(`Pagefind failed to start: ${created.errors.join("; ")}`);
|
|
226
|
+
const indexed = await created.index.addDirectory({ path: output });
|
|
227
|
+
if (indexed.errors.length > 0) throw new Error(`Pagefind failed to index the site: ${indexed.errors.join("; ")}`);
|
|
228
|
+
const written = await created.index.writeFiles({ outputPath: join(output, "pagefind") });
|
|
229
|
+
await close();
|
|
230
|
+
if (written.errors.length > 0) throw new Error(`Pagefind failed to write the index: ${written.errors.join("; ")}`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function tastyStarlight(config) {
|
|
237
|
+
return starlight(config);
|
|
238
|
+
}
|
|
239
|
+
async function callInner(integrations, hook, context) {
|
|
240
|
+
for (const integration of integrations) {
|
|
241
|
+
const handler = integration.hooks[hook];
|
|
242
|
+
if (typeof handler === "function") await handler(context);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function virtualDocsPlugin(css, getContent) {
|
|
246
|
+
const themeId = "\0virtual:tasty-docs/theme.css";
|
|
247
|
+
const configId = "\0virtual:tasty-docs/config";
|
|
248
|
+
return {
|
|
249
|
+
name: "tasty-docs-theme",
|
|
250
|
+
resolveId(id) {
|
|
251
|
+
if (id === "virtual:tasty-docs/theme.css") return themeId;
|
|
252
|
+
if (id === "virtual:tasty-docs/config") return configId;
|
|
253
|
+
},
|
|
254
|
+
load(id) {
|
|
255
|
+
if (id === themeId) return css;
|
|
256
|
+
if (id === configId) return `export const content = ${JSON.stringify(getContent())};`;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
function hasContentConfig(srcDir) {
|
|
261
|
+
const source = fileURLToPath(srcDir);
|
|
262
|
+
return [
|
|
263
|
+
"content.config.ts",
|
|
264
|
+
"content.config.mts",
|
|
265
|
+
"content.config.js",
|
|
266
|
+
"content.config.mjs",
|
|
267
|
+
"content/config.ts"
|
|
268
|
+
].some((path) => existsSync(join(source, path)));
|
|
269
|
+
}
|
|
270
|
+
//#endregion
|
|
271
|
+
export { createStarlightCollection, tastyDocs as default, resolveDocsTheme, tastyStarlight };
|
|
272
|
+
|
|
273
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/theme/index.ts","../src/integration.ts"],"sourcesContent":["import {\n apcaContrast,\n glaze,\n okhslToLinearSrgb,\n relativeLuminanceFromLinearRgb,\n variantToOkhsl,\n type GlazeColorValue,\n type ResolvedColorVariant,\n} from \"@tenphi/glaze\";\nimport type { BrandConfig, DocsDiagnostic, ThemeConfig } from \"@tenphi/docs\";\n\nexport interface ResolvedDocsTheme {\n css: string;\n colors: {\n surface: Record<string, string>;\n accentText: Record<string, string>;\n accentSurface: Record<string, string>;\n accentSurfaceText: Record<string, string>;\n focus: Record<string, string>;\n };\n contrast: {\n light: number;\n dark: number;\n lightContrast: number;\n darkContrast: number;\n };\n diagnostics: DocsDiagnostic[];\n}\n\nexport function resolveDocsTheme(theme: ThemeConfig = {}): ResolvedDocsTheme {\n const brand = normalizeBrand(theme.brand);\n const authoredTarget = brand.contrast?.apca ?? 45;\n const normalTarget = Array.isArray(authoredTarget)\n ? authoredTarget[0]\n : authoredTarget;\n const highTarget = Array.isArray(authoredTarget)\n ? authoredTarget[1]\n : normalTarget + 15;\n const surface = glaze.color({ from: \"#ffffff\", mode: \"auto\" });\n const accentText = glaze.color(\n {\n from: brand.from,\n base: surface,\n role: \"text\",\n contrast: { apca: authoredTarget },\n mode: \"auto\",\n },\n {\n autoFlip: true,\n ...(theme.contrastLevel !== undefined\n ? { contrastLevel: theme.contrastLevel }\n : {}),\n },\n );\n const focus = glaze.color(\n {\n from: brand.from,\n base: surface,\n role: \"border\",\n contrast: { apca: authoredTarget },\n mode: \"auto\",\n },\n { autoFlip: true },\n );\n const accentSurface = glaze.color({ from: brand.from, mode: \"fixed\" });\n const accentSurfaceText = glaze.color({\n from: \"#ffffff\",\n base: accentSurface,\n role: \"text\",\n contrast: { apca: 60 },\n mode: \"auto\",\n });\n\n const resolvedSurface = surface.resolve();\n const resolvedAccent = accentText.resolve();\n const scores = {\n light: score(resolvedAccent.light, resolvedSurface.light),\n dark: score(resolvedAccent.dark, resolvedSurface.dark),\n lightContrast: score(\n resolvedAccent.lightContrast,\n resolvedSurface.lightContrast,\n ),\n darkContrast: score(\n resolvedAccent.darkContrast,\n resolvedSurface.darkContrast,\n ),\n };\n const diagnostics: DocsDiagnostic[] = [];\n for (const [scheme, measured] of Object.entries(scores)) {\n const required = scheme.includes(\"Contrast\") ? highTarget : normalTarget;\n if (measured + 0.05 < required) {\n diagnostics.push({\n code: \"DOCS_BRAND_CONTRAST_UNMET\",\n severity: \"error\",\n message: `Brand contrast in ${scheme} is Lc ${measured.toFixed(1)}; required Lc ${required}.`,\n hint: `Authored color: ${String(brand.from)}.`,\n });\n }\n }\n const outputOptions = { modes: { highContrast: true } } as const;\n const colors = {\n surface: surface.json(outputOptions),\n accentText: accentText.json(outputOptions),\n accentSurface: accentSurface.json(outputOptions),\n accentSurfaceText: accentSurfaceText.json(outputOptions),\n focus: focus.json(outputOptions),\n };\n return {\n css: themeCss(colors, theme),\n colors,\n contrast: scores,\n diagnostics,\n };\n}\n\nfunction normalizeBrand(\n brand: BrandConfig | undefined,\n): Exclude<BrandConfig, GlazeColorValue> & { from: GlazeColorValue } {\n if (typeof brand === \"object\" && brand !== null && \"from\" in brand)\n return brand;\n return { from: brand ?? \"#315efb\" };\n}\n\nfunction score(\n foreground: ResolvedColorVariant,\n background: ResolvedColorVariant,\n): number {\n return Math.abs(apcaContrast(luminance(foreground), luminance(background)));\n}\n\nfunction luminance(variant: ResolvedColorVariant): number {\n const { h, s, l } = variantToOkhsl(variant);\n return relativeLuminanceFromLinearRgb(\n okhslToLinearSrgb(h, s, l, variant.pastel),\n );\n}\n\nfunction themeCss(\n colors: ResolvedDocsTheme[\"colors\"],\n theme: ThemeConfig,\n): string {\n const declarations = (mode: string): string =>\n [\n `--td-surface:${colors.surface[mode]}`,\n `--td-accent-text:${colors.accentText[mode]}`,\n `--td-accent-surface:${colors.accentSurface[mode]}`,\n `--td-accent-surface-text:${colors.accentSurfaceText[mode]}`,\n `--td-focus:${colors.focus[mode]}`,\n ...Object.entries(theme.tokens ?? {}).map(\n ([name, value]) => `${name}:${String(value)}`,\n ),\n ].join(\";\");\n return [\n `:root{${declarations(\"dark\")}}`,\n `:root[data-theme=light]{${declarations(\"light\")}}`,\n `@media(prefers-color-scheme:light){:root:not([data-theme]){${declarations(\"light\")}}}`,\n `@media(prefers-contrast:more){:root{${declarations(\"darkContrast\")}}:root[data-theme=light]{${declarations(\"lightContrast\")}}@media(prefers-color-scheme:light){:root:not([data-theme]){${declarations(\"lightContrast\")}}}}`,\n `:root[data-contrast=more]{${declarations(\"darkContrast\")}}`,\n `:root[data-theme=light][data-contrast=more]{${declarations(\"lightContrast\")}}`,\n ].join(\"\\n\");\n}\n","import { existsSync } from \"node:fs\";\nimport { cp, mkdir } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport starlight from \"./starlight-runtime.js\";\nimport {\n createDocsGraph,\n assertValidDocs,\n type DocsConfig,\n} from \"@tenphi/docs\";\nimport { tastyIntegration } from \"@tenphi/tasty/ssr/astro\";\nimport type { AstroIntegration, HookParameters } from \"astro\";\nimport { resolveDocsTheme } from \"./theme/index.js\";\n\nconst packageRequire = createRequire(import.meta.url);\nconst starlightRoot = dirname(packageRequire.resolve(\"@astrojs/starlight\"));\nconst tastyStaticMiddleware = packageRequire.resolve(\n \"@tenphi/tasty/ssr/astro-middleware-static\",\n);\n\nexport interface TastyDocsOptions {\n config?: DocsConfig;\n root?: string;\n}\n\nexport default function tastyDocs(\n options: TastyDocsOptions = {},\n): AstroIntegration {\n const docsTheme = resolveDocsTheme(options.config?.theme);\n if (\n docsTheme.diagnostics.some((diagnostic) => diagnostic.severity === \"error\")\n ) {\n throw new Error(\n docsTheme.diagnostics.map((diagnostic) => diagnostic.message).join(\"\\n\"),\n );\n }\n const cssPath = fileURLToPath(new URL(\"./styles.css\", import.meta.url));\n const searchClientPath = fileURLToPath(\n new URL(\"./client/search.js\", import.meta.url),\n );\n const appearanceClientPath = fileURLToPath(\n new URL(\"./client/appearance.js\", import.meta.url),\n );\n const inner = [\n tastyIntegration({ islands: false }),\n starlight({\n title: options.config?.site?.title ?? \"Documentation\",\n ...(options.config?.site?.description\n ? { description: options.config.site.description }\n : {}),\n customCss: [\"virtual:tasty-docs/theme.css\", cssPath],\n ...(options.config?.search?.enabled === false ? { pagefind: false } : {}),\n sidebar: [\n {\n label: \"Documentation\",\n items: [{ autogenerate: { directory: \"\" } }],\n },\n ],\n }),\n ] satisfies AstroIntegration[];\n let projectRoot = options.root;\n let graphConfig = options.config;\n let graph: Awaited<ReturnType<typeof createDocsGraph>> | undefined;\n let usingStarlight = false;\n\n return {\n name: \"tasty-docs\",\n hooks: {\n \"astro:config:setup\": async (context) => {\n if (\n context.config.integrations.some(\n (integration) => integration.name === \"@astrojs/starlight\",\n )\n ) {\n throw new Error(\n \"Tasty Docs already includes Starlight. Remove the direct @astrojs/starlight integration before continuing.\",\n );\n }\n projectRoot ??= fileURLToPath(context.config.root);\n const base = options.config?.build?.base ?? context.config.base;\n graphConfig = {\n ...options.config,\n build: { ...options.config?.build, base },\n };\n usingStarlight = hasContentConfig(context.config.srcDir);\n context.updateConfig({\n base,\n output: \"static\",\n vite: {\n ssr: {\n external: [\"@tenphi/docs\"],\n },\n plugins: [\n virtualDocsPlugin(docsTheme.css, () => ({\n entries: graph?.entries ?? [],\n routes: graph?.routes ?? [],\n site: graph?.config.site ?? options.config?.site ?? {},\n base: graph?.config.build.base ?? base,\n search:\n graph?.config.search.enabled ??\n options.config?.search?.enabled ??\n true,\n })),\n ],\n resolve: {\n alias: [\n {\n find: \"@astrojs/starlight\",\n replacement: starlightRoot,\n },\n {\n find: \"@tenphi/tasty/ssr/astro-middleware-static\",\n replacement: tastyStaticMiddleware,\n },\n ],\n },\n },\n });\n await callInner(inner.slice(0, 1), \"astro:config:setup\", context);\n\n if (!usingStarlight) {\n graph = await createDocsGraph({\n root: projectRoot,\n config: graphConfig,\n });\n assertValidDocs(graph);\n if (graph.config.search.enabled) {\n context.injectScript(\n \"page\",\n `import ${JSON.stringify(searchClientPath)};`,\n );\n }\n context.injectScript(\n \"page\",\n `import ${JSON.stringify(appearanceClientPath)};`,\n );\n context.injectRoute({\n pattern: \"[...route]\",\n entrypoint: new URL(\"./routes/DocsPage.astro\", import.meta.url),\n prerender: true,\n });\n return;\n }\n\n // Starlight inserts its own follow-up integrations immediately after\n // itself. Give it a temporary real position so Astro processes those\n // once, after this composite integration, rather than re-visiting us.\n const starlightIntegration = inner[1];\n if (starlightIntegration) {\n const selfIndex = context.config.integrations.findIndex(\n (integration) => integration.name === \"tasty-docs\",\n );\n context.config.integrations.splice(\n selfIndex + 1,\n 0,\n starlightIntegration,\n );\n try {\n await callInner(\n [starlightIntegration],\n \"astro:config:setup\",\n context,\n );\n } finally {\n const placeholderIndex =\n context.config.integrations.indexOf(starlightIntegration);\n if (placeholderIndex >= 0)\n context.config.integrations.splice(placeholderIndex, 1);\n }\n }\n },\n \"astro:config:done\": async (context) => {\n await callInner(\n usingStarlight ? inner : inner.slice(0, 1),\n \"astro:config:done\",\n context,\n );\n },\n \"astro:build:start\": async (context) => {\n if (!graph) {\n graph = await createDocsGraph({\n ...(projectRoot ? { root: projectRoot } : {}),\n ...(graphConfig ? { config: graphConfig } : {}),\n });\n assertValidDocs(graph);\n }\n await callInner(\n usingStarlight ? inner : inner.slice(0, 1),\n \"astro:build:start\",\n context,\n );\n },\n \"astro:build:done\": async (context) => {\n await callInner(\n usingStarlight ? inner : inner.slice(0, 1),\n \"astro:build:done\",\n context,\n );\n if (!graph) return;\n const output = fileURLToPath(context.dir);\n for (const asset of graph.assets) {\n if (!asset.sourcePath || !asset.publicPath) continue;\n const target = join(output, asset.publicPath.replace(/^\\//, \"\"));\n await mkdir(dirname(target), { recursive: true });\n await cp(asset.sourcePath, target);\n }\n if (!usingStarlight && graph.config.search.enabled) {\n const { close, createIndex } = await import(\"pagefind\");\n const created = await createIndex({\n rootSelector: \"[data-pagefind-body]\",\n });\n if (!created.index || created.errors.length > 0) {\n throw new Error(\n `Pagefind failed to start: ${created.errors.join(\"; \")}`,\n );\n }\n const indexed = await created.index.addDirectory({ path: output });\n if (indexed.errors.length > 0) {\n throw new Error(\n `Pagefind failed to index the site: ${indexed.errors.join(\"; \")}`,\n );\n }\n const written = await created.index.writeFiles({\n outputPath: join(output, \"pagefind\"),\n });\n await close();\n if (written.errors.length > 0) {\n throw new Error(\n `Pagefind failed to write the index: ${written.errors.join(\"; \")}`,\n );\n }\n }\n },\n },\n };\n}\n\nexport function tastyStarlight(\n config: Parameters<typeof starlight>[0],\n): AstroIntegration {\n return starlight(config);\n}\n\nasync function callInner<K extends keyof AstroIntegration[\"hooks\"]>(\n integrations: AstroIntegration[],\n hook: K,\n context: HookParameters<K>,\n): Promise<void> {\n for (const integration of integrations) {\n const handler = integration.hooks[hook];\n if (typeof handler === \"function\") {\n await (handler as (value: HookParameters<K>) => void | Promise<void>)(\n context,\n );\n }\n }\n}\n\nfunction virtualDocsPlugin(css: string, getContent: () => unknown) {\n const themeId = \"\\0virtual:tasty-docs/theme.css\";\n const configId = \"\\0virtual:tasty-docs/config\";\n return {\n name: \"tasty-docs-theme\",\n resolveId(id: string) {\n if (id === \"virtual:tasty-docs/theme.css\") return themeId;\n if (id === \"virtual:tasty-docs/config\") return configId;\n return undefined;\n },\n load(id: string) {\n if (id === themeId) return css;\n if (id === configId) {\n return `export const content = ${JSON.stringify(getContent())};`;\n }\n return undefined;\n },\n };\n}\n\nfunction hasContentConfig(srcDir: URL): boolean {\n const source = fileURLToPath(srcDir);\n return [\n \"content.config.ts\",\n \"content.config.mts\",\n \"content.config.js\",\n \"content.config.mjs\",\n \"content/config.ts\",\n ].some((path) => existsSync(join(source, path)));\n}\n"],"mappings":";;;;;;;;;;AA6BA,SAAgB,iBAAiB,QAAqB,CAAC,GAAsB;CAC3E,MAAM,QAAQ,eAAe,MAAM,KAAK;CACxC,MAAM,iBAAiB,MAAM,UAAU,QAAQ;CAC/C,MAAM,eAAe,MAAM,QAAQ,cAAc,IAC7C,eAAe,KACf;CACJ,MAAM,aAAa,MAAM,QAAQ,cAAc,IAC3C,eAAe,KACf,eAAe;CACnB,MAAM,UAAU,MAAM,MAAM;EAAE,MAAM;EAAW,MAAM;CAAO,CAAC;CAC7D,MAAM,aAAa,MAAM,MACvB;EACE,MAAM,MAAM;EACZ,MAAM;EACN,MAAM;EACN,UAAU,EAAE,MAAM,eAAe;EACjC,MAAM;CACR,GACA;EACE,UAAU;EACV,GAAI,MAAM,kBAAkB,KAAA,IACxB,EAAE,eAAe,MAAM,cAAc,IACrC,CAAC;CACP,CACF;CACA,MAAM,QAAQ,MAAM,MAClB;EACE,MAAM,MAAM;EACZ,MAAM;EACN,MAAM;EACN,UAAU,EAAE,MAAM,eAAe;EACjC,MAAM;CACR,GACA,EAAE,UAAU,KAAK,CACnB;CACA,MAAM,gBAAgB,MAAM,MAAM;EAAE,MAAM,MAAM;EAAM,MAAM;CAAQ,CAAC;CACrE,MAAM,oBAAoB,MAAM,MAAM;EACpC,MAAM;EACN,MAAM;EACN,MAAM;EACN,UAAU,EAAE,MAAM,GAAG;EACrB,MAAM;CACR,CAAC;CAED,MAAM,kBAAkB,QAAQ,QAAQ;CACxC,MAAM,iBAAiB,WAAW,QAAQ;CAC1C,MAAM,SAAS;EACb,OAAO,MAAM,eAAe,OAAO,gBAAgB,KAAK;EACxD,MAAM,MAAM,eAAe,MAAM,gBAAgB,IAAI;EACrD,eAAe,MACb,eAAe,eACf,gBAAgB,aAClB;EACA,cAAc,MACZ,eAAe,cACf,gB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,MAAM;EACN,UAAU,IAAY;GACpB,IAAI,OAAO,gCAAgC,OAAO;GAClD,IAAI,OAAO,6BAA6B,OAAO;EAEjD;EACA,KAAK,IAAY;GACf,IAAI,OAAO,SAAS,OAAO;GAC3B,IAAI,OAAO,UACT,OAAO,0BAA0B,KAAK,UAAU,WAAW,CAAC,EAAE;EAGlE;CACF;AACF;AAEA,SAAS,iBAAiB,QAAsB;CAC9C,MAAM,SAAS,cAAc,MAAM;CACnC,OAAO;EACL;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,MAAM,SAAS,WAAW,KAAK,QAAQ,IAAI,CAAC,CAAC;AACjD"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { createMarkdownProcessor } from "@astrojs/markdown-remark";
|
|
3
|
+
import { content } from "virtual:tasty-docs/config";
|
|
4
|
+
import "virtual:tasty-docs/theme.css";
|
|
5
|
+
import "../styles.css";
|
|
6
|
+
|
|
7
|
+
export const prerender = true;
|
|
8
|
+
|
|
9
|
+
export async function getStaticPaths() {
|
|
10
|
+
const processor = await createMarkdownProcessor();
|
|
11
|
+
return Promise.all(
|
|
12
|
+
content.entries.map(async (entry) => ({
|
|
13
|
+
params: { route: entry.route === "/" ? undefined : entry.route.slice(1) },
|
|
14
|
+
props: {
|
|
15
|
+
entry,
|
|
16
|
+
routes: content.routes,
|
|
17
|
+
html: (await processor.render(entry.transformedBody)).code,
|
|
18
|
+
site: content.site,
|
|
19
|
+
base: content.base,
|
|
20
|
+
search: content.search,
|
|
21
|
+
},
|
|
22
|
+
})),
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const { entry, routes, html, site, base, search } = Astro.props;
|
|
27
|
+
const withBase = (route) =>
|
|
28
|
+
`${base === "/" ? "" : `/${base.replace(/^\/+|\/+$/g, "")}`}${route}` || "/";
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<!doctype html>
|
|
32
|
+
<html lang="en">
|
|
33
|
+
<head>
|
|
34
|
+
<meta charset="utf-8" />
|
|
35
|
+
<meta name="viewport" content="width=device-width" />
|
|
36
|
+
<title>{entry.title} | {site.title ?? "Documentation"}</title>
|
|
37
|
+
{
|
|
38
|
+
entry.description && (
|
|
39
|
+
<meta name="description" content={entry.description} />
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
</head>
|
|
43
|
+
<body class="td-shell">
|
|
44
|
+
<a class="td-skip" href="#main-content">Skip to content</a>
|
|
45
|
+
<header
|
|
46
|
+
class="td-shell__header"
|
|
47
|
+
data-tasty-anatomy="Header"
|
|
48
|
+
data-docs-base={base}
|
|
49
|
+
>
|
|
50
|
+
<a href={withBase("/")}>{site.title ?? "Documentation"}</a>
|
|
51
|
+
<div class="td-shell__actions">
|
|
52
|
+
<label>
|
|
53
|
+
<span class="td-visually-hidden">Color theme</span>
|
|
54
|
+
<select data-docs-theme aria-label="Color theme">
|
|
55
|
+
<option value="system">System theme</option>
|
|
56
|
+
<option value="light">Light theme</option>
|
|
57
|
+
<option value="dark">Dark theme</option>
|
|
58
|
+
</select>
|
|
59
|
+
</label>
|
|
60
|
+
<label>
|
|
61
|
+
<span class="td-visually-hidden">Contrast</span>
|
|
62
|
+
<select data-docs-contrast aria-label="Contrast">
|
|
63
|
+
<option value="system">System contrast</option>
|
|
64
|
+
<option value="normal">Normal contrast</option>
|
|
65
|
+
<option value="more">High contrast</option>
|
|
66
|
+
</select>
|
|
67
|
+
</label>
|
|
68
|
+
{
|
|
69
|
+
search && (
|
|
70
|
+
<button type="button" data-docs-search-open aria-haspopup="dialog">
|
|
71
|
+
Search
|
|
72
|
+
</button>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
</div>
|
|
76
|
+
</header>
|
|
77
|
+
<div class="td-shell__layout">
|
|
78
|
+
<nav
|
|
79
|
+
class="td-shell__nav"
|
|
80
|
+
aria-label="Documentation"
|
|
81
|
+
data-tasty-anatomy="Sidebar"
|
|
82
|
+
>
|
|
83
|
+
<ul>
|
|
84
|
+
{
|
|
85
|
+
routes.map((route) => (
|
|
86
|
+
<li>
|
|
87
|
+
<a
|
|
88
|
+
href={withBase(route.route)}
|
|
89
|
+
aria-current={
|
|
90
|
+
route.route === entry.route ? "page" : undefined
|
|
91
|
+
}
|
|
92
|
+
>
|
|
93
|
+
{route.title}
|
|
94
|
+
</a>
|
|
95
|
+
</li>
|
|
96
|
+
))
|
|
97
|
+
}
|
|
98
|
+
</ul>
|
|
99
|
+
</nav>
|
|
100
|
+
<main
|
|
101
|
+
id="main-content"
|
|
102
|
+
class="td-shell__main"
|
|
103
|
+
data-pagefind-body
|
|
104
|
+
data-tasty-anatomy="Article"
|
|
105
|
+
>
|
|
106
|
+
<h1>{entry.title}</h1>
|
|
107
|
+
<div set:html={html} />
|
|
108
|
+
</main>
|
|
109
|
+
</div>
|
|
110
|
+
{
|
|
111
|
+
search && (
|
|
112
|
+
<dialog data-docs-search aria-labelledby="td-search-title">
|
|
113
|
+
<form method="dialog">
|
|
114
|
+
<button aria-label="Close search">Close</button>
|
|
115
|
+
</form>
|
|
116
|
+
<h2 id="td-search-title">Search documentation</h2>
|
|
117
|
+
<label>
|
|
118
|
+
Search{" "}
|
|
119
|
+
<input type="search" data-docs-search-input autocomplete="off" />
|
|
120
|
+
</label>
|
|
121
|
+
<div data-docs-search-status aria-live="polite" />
|
|
122
|
+
<ul data-docs-search-results />
|
|
123
|
+
</dialog>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
</body>
|
|
127
|
+
</html>
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
@layer tasty-docs {
|
|
2
|
+
:root {
|
|
3
|
+
--sl-color-accent-low: color-mix(
|
|
4
|
+
in oklab,
|
|
5
|
+
var(--td-accent-surface) 18%,
|
|
6
|
+
var(--td-surface)
|
|
7
|
+
);
|
|
8
|
+
--sl-color-accent: var(--td-accent-text);
|
|
9
|
+
--sl-color-accent-high: var(--td-accent-text);
|
|
10
|
+
--sl-content-width: var(--content-width, 50rem);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:where(a, button, input, select, textarea):focus-visible {
|
|
14
|
+
outline: 3px solid var(--td-focus);
|
|
15
|
+
outline-offset: 3px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.td-card {
|
|
19
|
+
display: block;
|
|
20
|
+
padding: 1.25rem;
|
|
21
|
+
border: 1px solid var(--sl-color-gray-5);
|
|
22
|
+
border-radius: 0.75rem;
|
|
23
|
+
background: var(--sl-color-bg-nav);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.td-preview {
|
|
27
|
+
border: 1px solid var(--sl-color-gray-5);
|
|
28
|
+
border-radius: 0.75rem;
|
|
29
|
+
overflow: clip;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.td-preview__stage {
|
|
33
|
+
padding: 1.5rem;
|
|
34
|
+
background: var(--td-surface);
|
|
35
|
+
}
|
|
36
|
+
.td-preview__code {
|
|
37
|
+
border-top: 1px solid var(--sl-color-gray-5);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.td-shell {
|
|
41
|
+
min-height: 100vh;
|
|
42
|
+
color: #20232a;
|
|
43
|
+
background: var(--td-surface);
|
|
44
|
+
font:
|
|
45
|
+
1rem/1.7 system-ui,
|
|
46
|
+
sans-serif;
|
|
47
|
+
}
|
|
48
|
+
:root[data-theme="light"] .td-shell {
|
|
49
|
+
color: #20232a;
|
|
50
|
+
}
|
|
51
|
+
:root[data-theme="dark"] .td-shell {
|
|
52
|
+
color: #eceef5;
|
|
53
|
+
}
|
|
54
|
+
.td-shell__header {
|
|
55
|
+
position: sticky;
|
|
56
|
+
top: 0;
|
|
57
|
+
z-index: 2;
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: space-between;
|
|
61
|
+
padding: 0.8rem 1.25rem;
|
|
62
|
+
border-bottom: 1px solid color-mix(in oklab, currentColor 18%, transparent);
|
|
63
|
+
background: color-mix(in oklab, var(--td-surface) 94%, transparent);
|
|
64
|
+
backdrop-filter: blur(12px);
|
|
65
|
+
}
|
|
66
|
+
.td-shell__header a {
|
|
67
|
+
color: var(--td-accent-text);
|
|
68
|
+
font-weight: 700;
|
|
69
|
+
text-decoration: none;
|
|
70
|
+
}
|
|
71
|
+
.td-shell__actions {
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 0.5rem;
|
|
75
|
+
}
|
|
76
|
+
.td-shell__actions :where(select, button) {
|
|
77
|
+
min-height: 2.25rem;
|
|
78
|
+
}
|
|
79
|
+
.td-visually-hidden {
|
|
80
|
+
position: absolute;
|
|
81
|
+
width: 1px;
|
|
82
|
+
height: 1px;
|
|
83
|
+
padding: 0;
|
|
84
|
+
margin: -1px;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
clip: rect(0, 0, 0, 0);
|
|
87
|
+
white-space: nowrap;
|
|
88
|
+
border: 0;
|
|
89
|
+
}
|
|
90
|
+
.td-shell__layout {
|
|
91
|
+
display: grid;
|
|
92
|
+
grid-template-columns: minmax(13rem, 18rem) minmax(0, 1fr);
|
|
93
|
+
max-width: 86rem;
|
|
94
|
+
margin: auto;
|
|
95
|
+
}
|
|
96
|
+
.td-shell__nav {
|
|
97
|
+
padding: 1.5rem;
|
|
98
|
+
border-inline-end: 1px solid
|
|
99
|
+
color-mix(in oklab, currentColor 18%, transparent);
|
|
100
|
+
}
|
|
101
|
+
.td-shell__nav ul {
|
|
102
|
+
margin: 0;
|
|
103
|
+
padding: 0;
|
|
104
|
+
list-style: none;
|
|
105
|
+
}
|
|
106
|
+
.td-shell__nav a {
|
|
107
|
+
display: block;
|
|
108
|
+
padding: 0.3rem 0.5rem;
|
|
109
|
+
color: var(--td-accent-text);
|
|
110
|
+
border-radius: 0.35rem;
|
|
111
|
+
}
|
|
112
|
+
.td-shell__main {
|
|
113
|
+
width: min(100%, var(--content-width, 52rem));
|
|
114
|
+
padding: 2rem clamp(1.25rem, 4vw, 3rem) 5rem;
|
|
115
|
+
}
|
|
116
|
+
.td-shell__main img {
|
|
117
|
+
max-width: 100%;
|
|
118
|
+
height: auto;
|
|
119
|
+
}
|
|
120
|
+
.td-shell__main :where(pre, table) {
|
|
121
|
+
max-width: 100%;
|
|
122
|
+
overflow: auto;
|
|
123
|
+
}
|
|
124
|
+
.td-shell__main :where(a) {
|
|
125
|
+
color: var(--td-accent-text);
|
|
126
|
+
}
|
|
127
|
+
.td-shell__main :where(h1, h2, h3) {
|
|
128
|
+
line-height: 1.2;
|
|
129
|
+
}
|
|
130
|
+
[data-docs-search] {
|
|
131
|
+
width: min(42rem, calc(100% - 2rem));
|
|
132
|
+
padding: 1.25rem;
|
|
133
|
+
color: inherit;
|
|
134
|
+
background: var(--td-surface);
|
|
135
|
+
border: 1px solid var(--td-focus);
|
|
136
|
+
border-radius: 0.75rem;
|
|
137
|
+
}
|
|
138
|
+
[data-docs-search]::backdrop {
|
|
139
|
+
background: rgb(0 0 0 / 0.55);
|
|
140
|
+
}
|
|
141
|
+
[data-docs-search] form {
|
|
142
|
+
float: inline-end;
|
|
143
|
+
}
|
|
144
|
+
[data-docs-search] label,
|
|
145
|
+
[data-docs-search] input {
|
|
146
|
+
display: block;
|
|
147
|
+
width: 100%;
|
|
148
|
+
}
|
|
149
|
+
[data-docs-search] input {
|
|
150
|
+
margin-block: 0.4rem 1rem;
|
|
151
|
+
padding: 0.6rem;
|
|
152
|
+
}
|
|
153
|
+
.td-skip {
|
|
154
|
+
position: fixed;
|
|
155
|
+
inset: 0.5rem auto auto 0.5rem;
|
|
156
|
+
z-index: 4;
|
|
157
|
+
translate: 0 -150%;
|
|
158
|
+
padding: 0.5rem 0.8rem;
|
|
159
|
+
background: var(--td-accent-surface);
|
|
160
|
+
color: var(--td-accent-surface-text);
|
|
161
|
+
}
|
|
162
|
+
.td-skip:focus {
|
|
163
|
+
translate: 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@media (prefers-color-scheme: dark) {
|
|
167
|
+
.td-shell {
|
|
168
|
+
color: #eceef5;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@media (max-width: 48rem) {
|
|
173
|
+
.td-shell__layout {
|
|
174
|
+
grid-template-columns: 1fr;
|
|
175
|
+
}
|
|
176
|
+
.td-shell__nav {
|
|
177
|
+
border-inline-end: 0;
|
|
178
|
+
border-bottom: 1px solid
|
|
179
|
+
color-mix(in oklab, currentColor 18%, transparent);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@media (prefers-reduced-motion: reduce) {
|
|
184
|
+
*,
|
|
185
|
+
*::before,
|
|
186
|
+
*::after {
|
|
187
|
+
scroll-behavior: auto !important;
|
|
188
|
+
transition-duration: 0.01ms !important;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tenphi/starlight",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Astro and Starlight renderer for Tasty Docs",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"./dist/styles.css",
|
|
8
|
+
"./dist/client/*.js"
|
|
9
|
+
],
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./content": {
|
|
16
|
+
"types": "./dist/content.d.ts",
|
|
17
|
+
"import": "./dist/content.js"
|
|
18
|
+
},
|
|
19
|
+
"./components": {
|
|
20
|
+
"types": "./dist/components-public.d.ts",
|
|
21
|
+
"import": "./dist/components.js"
|
|
22
|
+
},
|
|
23
|
+
"./styles": {
|
|
24
|
+
"types": "./dist/styles.d.ts",
|
|
25
|
+
"default": "./dist/styles.css"
|
|
26
|
+
},
|
|
27
|
+
"./client/*": "./dist/client/*.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"README.md",
|
|
32
|
+
"LICENSE"
|
|
33
|
+
],
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=22.14"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/tenphi/tasty-docs.git",
|
|
43
|
+
"directory": "packages/starlight"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/tenphi/tasty-docs#readme",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/tenphi/tasty-docs/issues"
|
|
48
|
+
},
|
|
49
|
+
"author": "Andrey Yamanov",
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@astrojs/markdown-remark": "^7.2.4",
|
|
53
|
+
"@astrojs/starlight": "^0.41.10",
|
|
54
|
+
"@tenphi/docs": "0.1.0",
|
|
55
|
+
"@tenphi/glaze": "2.0.0",
|
|
56
|
+
"@tenphi/tasty": "3.4.0",
|
|
57
|
+
"pagefind": "^1.5.2",
|
|
58
|
+
"tsx": "^4.20.6"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"astro": "^7.2.9"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@types/node": "^22.15.2",
|
|
65
|
+
"astro": "^7.2.9",
|
|
66
|
+
"tsdown": "^0.22.14",
|
|
67
|
+
"typescript": "^7.0.2",
|
|
68
|
+
"vitest": "^4.1.11"
|
|
69
|
+
},
|
|
70
|
+
"scripts": {
|
|
71
|
+
"build": "tsdown --config tsdown.config.ts && node ../../scripts/pack-assets.mjs",
|
|
72
|
+
"clean": "rm -rf dist",
|
|
73
|
+
"typecheck": "tsc --noEmit",
|
|
74
|
+
"test": "vitest run"
|
|
75
|
+
}
|
|
76
|
+
}
|