@orbytes/astrolab 0.3.0 → 0.4.0-next.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 +109 -64
- package/defaults.mjs +65 -0
- package/dist/core/virtual-module/virtual-routes.js +12 -1
- package/docs/PIN-CONTRACT.md +8 -0
- package/docs/PIN.md +29 -19
- package/index.d.ts +40 -16
- package/index.mjs +32 -10
- package/package.json +6 -2
- package/src/Home.astro +167 -264
- package/src/LabHead.astro +37 -1047
- package/src/chrome/ComponentCard.astro +69 -0
- package/src/chrome/Icon.astro +21 -0
- package/src/chrome/LICENSE-icons +43 -0
- package/src/chrome/Nav.astro +105 -0
- package/src/chrome/Panel.astro +104 -0
- package/src/chrome/Shell.astro +106 -0
- package/src/chrome/Sprite.astro +23 -0
- package/src/chrome/StoryView.astro +251 -0
- package/src/chrome/Tree.astro +83 -0
- package/src/chrome/ViewportControls.astro +98 -0
- package/src/chrome/ViewportStage.astro +32 -0
- package/src/chrome/fonts/OFL.txt +93 -0
- package/src/chrome/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/src/chrome/icons.ts +59 -0
- package/src/chrome/marks-client.ts +102 -0
- package/src/chrome/model.ts +142 -0
- package/src/chrome/pins-data.ts +30 -0
- package/src/chrome/shell-client.ts +372 -0
- package/src/chrome/site-data.ts +230 -0
- package/src/chrome/trees.ts +152 -0
- package/src/chrome/viewport-client.ts +579 -0
- package/src/chrome/views/Assets.astro +110 -0
- package/src/chrome/views/Pages.astro +178 -0
- package/src/chrome/views/Placeholder.astro +37 -0
- package/src/chrome/views/Tasks.astro +107 -0
- package/src/core/LICENSE-astrobook +16 -0
- package/src/core/lib/components/home.astro +4 -2
- package/src/core/lib/pages/story.astro +12 -10
- package/src/core/virtual-module/virtual-routes.ts +20 -4
- package/src/pin/board.mjs +389 -175
- package/src/pin/index.mjs +33 -2
- package/src/pin/toolbar.js +1 -1
- package/src/shell/Browse.astro +106 -353
- package/src/shell/Viewport.astro +22 -1315
- package/src/shell/lab-index.ts +23 -14
- package/src/ui/components/app.astro +5 -7
- package/src/ui/components/theme-script.astro +13 -2
- package/src/ui/lab.css +2152 -370
- package/virtual.d.ts +13 -0
- package/src/shell/CardGrid.astro +0 -297
- package/src/ui/components/build-path.ts +0 -13
- package/src/ui/components/build-tree.ts +0 -108
- package/src/ui/components/collapse-duration.ts +0 -28
- package/src/ui/components/compress-terms.ts +0 -10
- package/src/ui/components/dashboard-layout.astro +0 -39
- package/src/ui/components/home.astro +0 -65
- package/src/ui/components/layout.astro +0 -110
- package/src/ui/components/sidebar-button-fullscreen.astro +0 -38
- package/src/ui/components/sidebar-button-search.astro +0 -23
- package/src/ui/components/sidebar-button-theme.astro +0 -9
- package/src/ui/components/sidebar-button.astro +0 -24
- package/src/ui/components/sidebar-resize-handle.astro +0 -74
- package/src/ui/components/sidebar-search-panel.astro +0 -41
- package/src/ui/components/sidebar-search-script.ts +0 -103
- package/src/ui/components/sidebar-title.astro +0 -17
- package/src/ui/components/sidebar-tree-node.astro +0 -143
- package/src/ui/components/sidebar-tree.astro +0 -84
- package/src/ui/components/sidebar.astro +0 -29
- package/src/ui/components/theme-toggle.astro +0 -63
package/src/shell/lab-index.ts
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
// survives a multi-page site.
|
|
14
14
|
// 5. <directory>/responsive.json, through marks.mjs — the hand-set responsive marks. The one
|
|
15
15
|
// thing here that is ticked rather than derived, because approval cannot be read from code.
|
|
16
|
-
// 6. The stories files themselves — the component they render, the leading
|
|
17
|
-
//
|
|
16
|
+
// 6. The stories files themselves, read as text — the component they render, the leading
|
|
17
|
+
// comment (summary) and the default export's optional `meta.tags`.
|
|
18
18
|
//
|
|
19
19
|
// Classification is by Astrobook `directory` (relative to its `directory` option):
|
|
20
20
|
// <tier>/<Section>/<Version>/… tier = first segment; for the tier holding the RESPONSIVE role
|
|
@@ -108,17 +108,26 @@ export interface LabIndex {
|
|
|
108
108
|
live: { file: string; page: string; slot: number; of: number }[];
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
// read.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
// The optional `meta.tags` on a story module's default export — Astrobook ignores unknown keys, so
|
|
112
|
+
// `export default { component, meta: { tags: ["cta", "v2"] } }` is legal and this is where it is
|
|
113
|
+
// read.
|
|
114
|
+
//
|
|
115
|
+
// READ AS TEXT, NOT IMPORTED (2026-09-24, ASTROL-12). This used to be an EAGER
|
|
116
|
+
// `import.meta.glob("/src/**/*.stories.ts")`, and importing a stories file imports the component it
|
|
117
|
+
// renders — so every chrome page's module graph held every section, and Astro put every section's
|
|
118
|
+
// scoped stylesheet on every chrome page (18 of them on the lab home). The tags are string
|
|
119
|
+
// literals in the file, so a parse of its text gives the same answer and imports nothing. A tag
|
|
120
|
+
// built at runtime is not seen, which a tag never needs to be.
|
|
121
|
+
const tagsOf = (rootDir: string, moduleFile: string): string[] => {
|
|
122
|
+
let source = "";
|
|
123
|
+
try {
|
|
124
|
+
source = readFileSync(path.join(rootDir, moduleFile), "utf8");
|
|
125
|
+
} catch {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
const list = source.match(/\bmeta\s*:\s*\{[^}]*?\btags\s*:\s*\[([^\]]*)\]/);
|
|
129
|
+
if (!list) return [];
|
|
130
|
+
return [...list[1]!.matchAll(/["'`]([^"'`\n]+)["'`]/g)].map((m) => m[1]!);
|
|
122
131
|
};
|
|
123
132
|
|
|
124
133
|
// First sentence of the leading `//` comment block — the stories files already open with the
|
|
@@ -200,7 +209,7 @@ export function buildLabIndex(): LabIndex {
|
|
|
200
209
|
const liveOn = (componentFile ? mountsByFile.get(componentFile) : undefined) ?? [];
|
|
201
210
|
const primary = liveOn[0];
|
|
202
211
|
const { tier, section, version } = classify(mod.directory);
|
|
203
|
-
const tags = tagsOf(moduleFile);
|
|
212
|
+
const tags = tagsOf(rootDir, moduleFile);
|
|
204
213
|
const summary = summaryOf(rootDir, moduleFile);
|
|
205
214
|
const responsive = RESPONSIVE_DIR && moduleFile.startsWith(RESPONSIVE_DIR)
|
|
206
215
|
? { done: doneMarks.has(moduleFile), approved: approvedMarks.has(moduleFile) }
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
// Vendored from astrobook 0.13.3 (packages/ui/src/components/app.astro) — see
|
|
3
|
-
// ../../core/LICENSE-astrobook.
|
|
3
|
+
// ../../core/LICENSE-astrobook.
|
|
4
4
|
//
|
|
5
|
-
// The `/lab` home page:
|
|
6
|
-
//
|
|
7
|
-
|
|
5
|
+
// The `/lab` home page. Divergence: upstream wrapped the `home` component in its layout; since the
|
|
6
|
+
// redesign (2026-09-24) the home component IS the whole document — it renders through the
|
|
7
|
+
// package's chrome shell (../../chrome/Shell.astro) itself, so this file only mounts it.
|
|
8
8
|
import Home from 'virtual:astrobook/components/home.mjs'
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
<
|
|
12
|
-
<Home />
|
|
13
|
-
</Layout>
|
|
11
|
+
<Home />
|
|
@@ -18,11 +18,22 @@
|
|
|
18
18
|
//
|
|
19
19
|
// `is:inline` and no bundling on purpose: this must run before the first paint, or the lab
|
|
20
20
|
// flashes light before turning dark.
|
|
21
|
+
//
|
|
22
|
+
// TWO THEMES SINCE 2026-09-24, one per KEY. The chrome's light/dark and the preview's are
|
|
23
|
+
// separate (decided that day): switching the lab to dark must not switch the site inside the
|
|
24
|
+
// frame. Both documents share an origin and so share localStorage, so the only thing that can
|
|
25
|
+
// keep them apart is the key — the chrome passes `lab-chrome-theme`, and the preview keeps the
|
|
26
|
+
// original `theme-toggle`, so a preview preference stored before the split still applies.
|
|
27
|
+
interface Props {
|
|
28
|
+
storageKey?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { storageKey = "theme-toggle" } = Astro.props;
|
|
21
32
|
---
|
|
22
33
|
|
|
23
|
-
<script is:inline>
|
|
34
|
+
<script is:inline define:vars={{ storageKey }}>
|
|
24
35
|
(() => {
|
|
25
|
-
const STORAGE_KEY =
|
|
36
|
+
const STORAGE_KEY = storageKey;
|
|
26
37
|
let current;
|
|
27
38
|
|
|
28
39
|
const systemTheme = () =>
|