reallysimpledocs 1.0.0-beta.0 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@ RSD keeps docs portable: content lives in `docs/`, navigation lives in `docs/doc
7
7
  ## Add to an Astro site
8
8
 
9
9
  ```bash
10
- npm install reallysimpledocs@beta basecoat-css@beta
10
+ npm install reallysimpledocs@beta basecoat-css@beta tailwindcss
11
11
  ```
12
12
 
13
13
  Add the integration:
@@ -61,6 +61,40 @@ Welcome to the docs.
61
61
 
62
62
  RSD injects docs pages, Lunr search, per-page Markdown exports, `llms.txt`, and `llms-full.txt`.
63
63
 
64
+ ## Use Basecoat on the rest of the site
65
+
66
+ RSD styles and scripts its generated docs pages. For custom Astro pages outside the docs route, use Basecoat directly in your own layout.
67
+
68
+ Install stays the same:
69
+
70
+ ```bash
71
+ npm install reallysimpledocs@beta basecoat-css@beta tailwindcss
72
+ ```
73
+
74
+ Create a site stylesheet:
75
+
76
+ ```css
77
+ /* src/styles/site.css */
78
+ @import "tailwindcss";
79
+ @import "basecoat-css/base";
80
+ @import "basecoat-css/styles/vega";
81
+
82
+ @source "../src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}";
83
+ ```
84
+
85
+ Load that stylesheet and Basecoat's JavaScript in your custom layout:
86
+
87
+ ```astro
88
+ ---
89
+ import "../styles/site.css";
90
+ import "basecoat-css/all.min";
91
+ ---
92
+
93
+ <slot />
94
+ ```
95
+
96
+ Use the same Basecoat `style` in your RSD config and your site stylesheet if you want the docs and custom pages to match.
97
+
64
98
  ## Local development (this repo)
65
99
 
66
100
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reallysimpledocs",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.js",
@@ -26,14 +26,15 @@
26
26
  "lucide-static": "^0.552.0",
27
27
  "lunr": "^2.3.9",
28
28
  "marked": "^16.4.1",
29
- "shiki": "^4.1.0",
30
- "tailwindcss": "4.1.17"
29
+ "shiki": "^4.1.0"
31
30
  },
32
31
  "peerDependencies": {
33
- "basecoat-css": "^1.0.0-beta.1"
32
+ "basecoat-css": "^1.0.0-beta.1",
33
+ "tailwindcss": ">=4.1.17 <5"
34
34
  },
35
35
  "devDependencies": {
36
- "basecoat-css": "^1.0.0-beta.1"
36
+ "basecoat-css": "^1.0.0-beta.1",
37
+ "tailwindcss": "4.1.17"
37
38
  },
38
39
  "overrides": {
39
40
  "esbuild": "^0.28.1",
@@ -222,7 +222,7 @@ const actionItems = [
222
222
  </div>
223
223
  </article>
224
224
  <aside class="hidden w-56 xl:block">
225
- <div class="docs-toc sticky top-20 space-y-2 text-sm [&_a]:text-muted-foreground [&_a]:hover:text-primary [&_ol]:space-y-2 [&_ol_ol]:mt-2 [&_ol_ol]:pl-3">
225
+ <div class="docs-toc sticky top-20 space-y-2 text-sm [&_a]:text-muted-foreground [&_a]:hover:text-foreground [&_a[data-active='true']]:text-foreground [&_ol]:space-y-2 [&_ol_ol]:mt-2 [&_ol_ol]:pl-3" data-docs-toc>
226
226
  <h2 class="flex items-center gap-1 font-medium">
227
227
  On this page
228
228
  </h2>
@@ -230,7 +230,7 @@ const actionItems = [
230
230
  {
231
231
  headings.map((heading) => (
232
232
  <li class={heading.depth === 3 ? "pl-3" : ""}>
233
- <a href={`#${heading.id}`}>{heading.text}</a>
233
+ <a href={`#${heading.id}`} data-toc-link>{heading.text}</a>
234
234
  </li>
235
235
  ))
236
236
  }
@@ -283,5 +283,60 @@ const actionItems = [
283
283
  document.body.removeChild(textarea);
284
284
  if (!ok) throw new Error("Copy failed");
285
285
  }
286
+
287
+ function initDocsToc() {
288
+ const toc = document.querySelector("[data-docs-toc]");
289
+ if (!toc) return;
290
+
291
+ const links = Array.from(toc.querySelectorAll("[data-toc-link]"));
292
+ const linkById = new Map();
293
+ for (const link of links) {
294
+ const id = decodeURIComponent(link.hash.slice(1));
295
+ if (id) linkById.set(id, link);
296
+ }
297
+
298
+ const headings = Array.from(linkById.keys())
299
+ .map((id) => document.getElementById(id))
300
+ .filter(Boolean);
301
+ if (!headings.length) return;
302
+
303
+ const setActive = (id) => {
304
+ for (const link of links) {
305
+ const active = decodeURIComponent(link.hash.slice(1)) === id;
306
+ link.dataset.active = active ? "true" : "false";
307
+ if (active) link.setAttribute("aria-current", "location");
308
+ else link.removeAttribute("aria-current");
309
+ }
310
+ };
311
+
312
+ const currentHeading = () => {
313
+ const offset = 160;
314
+ let current = headings[0];
315
+ for (const heading of headings) {
316
+ if (heading.getBoundingClientRect().top <= offset) current = heading;
317
+ else break;
318
+ }
319
+ return current;
320
+ };
321
+
322
+ const updateActive = () => setActive(currentHeading().id);
323
+ updateActive();
324
+
325
+ let queued = false;
326
+ const queueUpdate = () => {
327
+ if (queued) return;
328
+ queued = true;
329
+ window.requestAnimationFrame(() => {
330
+ queued = false;
331
+ updateActive();
332
+ });
333
+ };
334
+
335
+ window.addEventListener("scroll", queueUpdate, { passive: true });
336
+ window.addEventListener("resize", queueUpdate);
337
+ window.addEventListener("hashchange", () => window.setTimeout(updateActive, 0));
338
+ }
339
+
340
+ initDocsToc();
286
341
  </script>
287
342
  </BaseLayout>