sdocs 0.0.48 → 0.0.50

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/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.0.50] - 2026-07-05
11
+
12
+ ### Fixed
13
+
14
+ - **The last block of a page no longer gets clipped.** Preview iframes size
15
+ themselves to the preview root's `scrollHeight`, but the first and last
16
+ child's margins collapsed through that root and weren't counted — so the
17
+ final block of `[PAGE]` content (a closing paragraph, a raw HTML block)
18
+ was cut off. The preview root is now a block formatting context
19
+ (`display: flow-root`), so the reported height includes everything.
20
+
21
+ ## [0.0.49] - 2026-07-05
22
+
23
+ ### Fixed
24
+
25
+ - **The `:` group marker no longer leaks into page headings.** A title like
26
+ `:Group / Name` groups an entry in the sidebar, but the leading colon was
27
+ rendered verbatim in the component/page `<h1>`. Headings now strip it, so the
28
+ title reads `Group / Name`.
29
+
10
30
  ## [0.0.48] - 2026-07-05
11
31
 
12
32
  ### Changed
@@ -20,6 +20,12 @@ interface SidebarConfig {
20
20
  }
21
21
  /** Build a tree from flat doc entries */
22
22
  export declare function buildTree(docs: DocEntry[], sidebar?: SidebarConfig): TreeNode[];
23
+ /**
24
+ * The title shown to users. A leading ':' on the first segment is a sidebar
25
+ * grouping directive (see buildTree), not part of the displayed title, so it
26
+ * is stripped for headings.
27
+ */
28
+ export declare function displayTitle(title: string | null | undefined): string;
23
29
  /** Check if a path matches a tree node (for active state) */
24
30
  export declare function pathMatchesNode(currentPath: string[], node: TreeNode): boolean;
25
31
  /** Find the doc entry for a given path */
@@ -172,6 +172,14 @@ function sortByOrder(nodes, order) {
172
172
  nodes.push(node);
173
173
  }
174
174
  }
175
+ /**
176
+ * The title shown to users. A leading ':' on the first segment is a sidebar
177
+ * grouping directive (see buildTree), not part of the displayed title, so it
178
+ * is stripped for headings.
179
+ */
180
+ export function displayTitle(title) {
181
+ return (title ?? '').replace(/^:\s*/, '');
182
+ }
175
183
  /** Check if a path matches a tree node (for active state) */
176
184
  export function pathMatchesNode(currentPath, node) {
177
185
  if (node.path.length !== currentPath.length)
@@ -7,6 +7,7 @@
7
7
  import ApiTable from './ApiTable.svelte';
8
8
  import PropControl from './PropControl.svelte';
9
9
  import CssPropControl from './CssPropControl.svelte';
10
+ import { displayTitle } from '../tree-builder.js';
10
11
 
11
12
  interface Props {
12
13
  doc: DocEntry;
@@ -291,7 +292,7 @@
291
292
  {#if focusedSnippet}
292
293
  <!-- Example full-page view -->
293
294
  <div class="sdocs-view-header">
294
- <h1 class="sdocs-view-title">{meta.title} / {snippetName}</h1>
295
+ <h1 class="sdocs-view-title">{displayTitle(meta.title)} / {snippetName}</h1>
295
296
  </div>
296
297
  <div class="sdocs-panels">
297
298
  <CollapsiblePanel title="Preview">
@@ -304,7 +305,7 @@
304
305
  {:else}
305
306
  <!-- Full component view -->
306
307
  <div class="sdocs-view-header">
307
- <h1 class="sdocs-view-title">{meta.title}</h1>
308
+ <h1 class="sdocs-view-title">{displayTitle(meta.title)}</h1>
308
309
  {#if meta.description}
309
310
  <p class="sdocs-view-description">{meta.description}</p>
310
311
  {/if}
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { DocEntry } from '../../types.js';
3
3
  import PreviewFrame from './PreviewFrame.svelte';
4
+ import { displayTitle } from '../tree-builder.js';
4
5
 
5
6
  interface Props {
6
7
  doc: DocEntry;
@@ -25,7 +26,7 @@
25
26
  <div class="sdocs-page-main">
26
27
  <!-- Header -->
27
28
  <div class="sdocs-view-header">
28
- <h1 class="sdocs-view-title">{meta.title}</h1>
29
+ <h1 class="sdocs-view-title">{displayTitle(meta.title)}</h1>
29
30
  {#if meta.description}
30
31
  <p class="sdocs-view-description">{meta.description}</p>
31
32
  {/if}
@@ -138,7 +138,10 @@ ${stateBroadcast}
138
138
 
139
139
  window.parent.postMessage({ type: 'sdocs:preview-ready' }, '*');
140
140
 
141
- // Report content height to parent for auto-sizing
141
+ // Report content height to parent for auto-sizing. The preview div is
142
+ // display: flow-root so child margins are contained — otherwise the
143
+ // first/last child's margins collapse through it, scrollHeight comes up
144
+ // short, and the iframe clips the final block of content.
142
145
  const ro = new ResizeObserver(() => {
143
146
  const height = document.getElementById('sdocs-preview')?.scrollHeight ?? 0;
144
147
  window.parent.postMessage({ type: 'sdocs:resize', height }, '*');
@@ -148,7 +151,7 @@ ${stateBroadcast}
148
151
  });
149
152
  </script>
150
153
 
151
- <div id="sdocs-preview">
154
+ <div id="sdocs-preview" style="display: flow-root">
152
155
  {#snippet SdocsPreview(args)}
153
156
  ${injectRootRef(snippetBody, componentName)}
154
157
  {/snippet}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdocs",
3
- "version": "0.0.48",
3
+ "version": "0.0.50",
4
4
  "description": "A lightweight documentation tool for Svelte 5 components",
5
5
  "type": "module",
6
6
  "license": "MIT",