@orbytes/astrolab 0.3.0 → 0.4.0-next.2

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.
Files changed (82) hide show
  1. package/README.md +261 -116
  2. package/bin/pin-gallery.mjs +53 -19
  3. package/defaults.mjs +72 -20
  4. package/dist/core/virtual-module/virtual-routes.js +12 -1
  5. package/docs/PIN-CONTRACT.md +84 -10
  6. package/docs/PIN.md +117 -37
  7. package/index.d.ts +41 -23
  8. package/index.mjs +46 -91
  9. package/package.json +7 -3
  10. package/src/Home.astro +166 -264
  11. package/src/LabHead.astro +37 -1047
  12. package/src/chrome/ActionsMenu.astro +97 -0
  13. package/src/chrome/ComponentCard.astro +76 -0
  14. package/src/chrome/Icon.astro +21 -0
  15. package/src/chrome/LICENSE-icons +43 -0
  16. package/src/chrome/Nav.astro +131 -0
  17. package/src/chrome/Panel.astro +117 -0
  18. package/src/chrome/Properties.astro +104 -0
  19. package/src/chrome/SectionsTree.astro +128 -0
  20. package/src/chrome/Shell.astro +120 -0
  21. package/src/chrome/Sprite.astro +23 -0
  22. package/src/chrome/StoryView.astro +192 -0
  23. package/src/chrome/Tree.astro +86 -0
  24. package/src/chrome/ViewportControls.astro +173 -0
  25. package/src/chrome/ViewportStage.astro +55 -0
  26. package/src/chrome/fonts/OFL.txt +93 -0
  27. package/src/chrome/fonts/inter-latin-wght-normal.woff2 +0 -0
  28. package/src/chrome/icons.ts +68 -0
  29. package/src/chrome/marks-client.ts +75 -0
  30. package/src/chrome/model.ts +156 -0
  31. package/src/chrome/navbar-client.ts +324 -0
  32. package/src/chrome/params-client.ts +434 -0
  33. package/src/chrome/pins-data.ts +63 -0
  34. package/src/chrome/shell-client.ts +468 -0
  35. package/src/chrome/site-data.ts +230 -0
  36. package/src/chrome/trees.ts +257 -0
  37. package/src/chrome/viewport-client.ts +405 -0
  38. package/src/chrome/views/Assets.astro +125 -0
  39. package/src/chrome/views/Pages.astro +214 -0
  40. package/src/chrome/views/Placeholder.astro +37 -0
  41. package/src/chrome/views/Tasks.astro +79 -0
  42. package/src/core/LICENSE-astrobook +21 -0
  43. package/src/core/lib/components/home.astro +4 -2
  44. package/src/core/lib/pages/story.astro +12 -10
  45. package/src/core/utils/kebab-case.ts +2 -2
  46. package/src/core/virtual-module/virtual-routes.ts +20 -4
  47. package/src/pin/board.mjs +414 -190
  48. package/src/pin/index.mjs +67 -22
  49. package/src/pin/tickets.mjs +6 -5
  50. package/src/pin/toolbar.js +82 -4
  51. package/src/shell/Browse.astro +131 -353
  52. package/src/shell/Viewport.astro +22 -1315
  53. package/src/shell/lab-index.ts +28 -18
  54. package/src/shell/lab-params.ts +113 -6
  55. package/src/shell/live-files.mjs +212 -10
  56. package/src/shell/marks.mjs +17 -41
  57. package/src/ui/components/app.astro +5 -7
  58. package/src/ui/components/preview-layout.astro +17 -0
  59. package/src/ui/components/theme-script.astro +17 -5
  60. package/src/ui/lab.css +3754 -371
  61. package/virtual.d.ts +13 -4
  62. package/bin/lab-cull.mjs +0 -401
  63. package/src/shell/CardGrid.astro +0 -297
  64. package/src/ui/components/build-path.ts +0 -13
  65. package/src/ui/components/build-tree.ts +0 -108
  66. package/src/ui/components/collapse-duration.ts +0 -28
  67. package/src/ui/components/compress-terms.ts +0 -10
  68. package/src/ui/components/dashboard-layout.astro +0 -39
  69. package/src/ui/components/home.astro +0 -65
  70. package/src/ui/components/layout.astro +0 -110
  71. package/src/ui/components/sidebar-button-fullscreen.astro +0 -38
  72. package/src/ui/components/sidebar-button-search.astro +0 -23
  73. package/src/ui/components/sidebar-button-theme.astro +0 -9
  74. package/src/ui/components/sidebar-button.astro +0 -24
  75. package/src/ui/components/sidebar-resize-handle.astro +0 -74
  76. package/src/ui/components/sidebar-search-panel.astro +0 -41
  77. package/src/ui/components/sidebar-search-script.ts +0 -103
  78. package/src/ui/components/sidebar-title.astro +0 -17
  79. package/src/ui/components/sidebar-tree-node.astro +0 -143
  80. package/src/ui/components/sidebar-tree.astro +0 -84
  81. package/src/ui/components/sidebar.astro +0 -29
  82. package/src/ui/components/theme-toggle.astro +0 -63
@@ -24,6 +24,16 @@
24
24
  // this meta has to be here as well as in LabHead.astro. Do not make it conditional.
25
25
  // · Feedbucket, when the consumer configured a key — a bare story page is a lab page you can
26
26
  // open full screen, and it carried the widget before this split.
27
+ // · the FRAMED flag, which hides Astro's dev toolbar inside a lab frame (decided 2026-09-24).
28
+ // Every preview is an <iframe> of this document, and the dev server injects its toolbar into
29
+ // every page it serves, so a component page carried two: the lab page's own and a second,
30
+ // scaled with the canvas, sitting over the story. The outer one is enough — its pin picker
31
+ // already descends into same-origin frames. So an inline script marks <html> before first
32
+ // paint when `window.frameElement` is set (a same-origin parent, which every lab frame is),
33
+ // and one rule on that mark hides the toolbar. It stays on this route opened in its own tab,
34
+ // and on the site's own pages, which never render through this layout. The cost: a ticket
35
+ // left on a bare story draws its marker only there, because the outer toolbar places markers
36
+ // for its own page's url and a framed toolbar can no longer be opened to draw them.
27
37
  import 'virtual:astrobook/user-css.mjs'
28
38
 
29
39
  import { ClientRouter } from 'astro:transitions'
@@ -55,6 +65,9 @@ const feedbucketKey = labConfig.feedbucketKey
55
65
  <meta name="generator" content={Astro.generator} />
56
66
  <title>{config.title}</title>
57
67
  <meta name="robots" content="noindex, nofollow" />
68
+ <script is:inline>
69
+ if (window.frameElement) document.documentElement.setAttribute('data-lab-framed', '')
70
+ </script>
58
71
  <ThemeScript />
59
72
  <script>
60
73
  import { initThemeMessage } from './theme-message.ts'
@@ -95,6 +108,10 @@ const feedbucketKey = labConfig.feedbucketKey
95
108
  min-width: 0;
96
109
  overflow: auto;
97
110
  }
111
+
112
+ html.lab-preview-shell[data-lab-framed] astro-dev-toolbar {
113
+ display: none !important;
114
+ }
98
115
  </style>
99
116
  </head>
100
117
  <body class="lab-preview-shell">
@@ -6,9 +6,10 @@
6
6
  //
7
7
  // 1. The whole point of the pass is that the lab depends on nothing but Astro. One npm package
8
8
  // left behind for a sun/moon button is the one that would surprise the next reader.
9
- // 2. `.dark` on <html> is a DOM contract this package leans on hard — LabHead.astro styles the
10
- // live pill, the cull switch and the row error against it. A contract that load-bearing
11
- // should be owned here, not read off a third party's minified inline script.
9
+ // 2. `.dark` on <html> is a DOM contract this package leans on hard — the stylesheet LabHead.astro
10
+ // loads (../lab.css) swaps every chrome token against it, and the sidebars, the device switch
11
+ // and the parameters drawer with them. A contract that load-bearing should be owned here, not
12
+ // read off a third party's minified inline script.
12
13
  // 3. What was left after dropping the ripple `startViewTransition` animation — presentation,
13
14
  // and phase 2's business if it wants it back — was about forty lines.
14
15
  //
@@ -18,11 +19,22 @@
18
19
  //
19
20
  // `is:inline` and no bundling on purpose: this must run before the first paint, or the lab
20
21
  // flashes light before turning dark.
22
+ //
23
+ // TWO THEMES SINCE 2026-09-24, one per KEY. The chrome's light/dark and the preview's are
24
+ // separate (decided that day): switching the lab to dark must not switch the site inside the
25
+ // frame. Both documents share an origin and so share localStorage, so the only thing that can
26
+ // keep them apart is the key — the chrome passes `lab-chrome-theme`, and the preview keeps the
27
+ // original `theme-toggle`, so a preview preference stored before the split still applies.
28
+ interface Props {
29
+ storageKey?: string;
30
+ }
31
+
32
+ const { storageKey = "theme-toggle" } = Astro.props;
21
33
  ---
22
34
 
23
- <script is:inline>
35
+ <script is:inline define:vars={{ storageKey }}>
24
36
  (() => {
25
- const STORAGE_KEY = "theme-toggle";
37
+ const STORAGE_KEY = storageKey;
26
38
  let current;
27
39
 
28
40
  const systemTheme = () =>