sdocs 0.0.30 → 0.0.32

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 (35) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +3 -3
  3. package/dist/commands/dev.js +1 -1
  4. package/dist/commands/init.js +3 -0
  5. package/dist/{client/App.svelte → explorer/Explorer.svelte} +3 -1
  6. package/dist/explorer/Explorer.svelte.d.ts +15 -0
  7. package/dist/{client → explorer}/views/Sidebar.svelte +12 -2
  8. package/dist/server/app-gen.js +17 -16
  9. package/dist/server/cli.js +2 -2
  10. package/dist/server/config.js +2 -0
  11. package/dist/types.d.ts +3 -0
  12. package/package.json +8 -3
  13. package/dist/client/App.svelte.d.ts +0 -15
  14. /package/dist/{client → explorer}/favicon.png +0 -0
  15. /package/dist/{client → explorer}/router.svelte.d.ts +0 -0
  16. /package/dist/{client → explorer}/router.svelte.js +0 -0
  17. /package/dist/{client → explorer}/tree-builder.d.ts +0 -0
  18. /package/dist/{client → explorer}/tree-builder.js +0 -0
  19. /package/dist/{client → explorer}/views/CollapsiblePanel.svelte +0 -0
  20. /package/dist/{client → explorer}/views/CollapsiblePanel.svelte.d.ts +0 -0
  21. /package/dist/{client → explorer}/views/ComponentView.svelte +0 -0
  22. /package/dist/{client → explorer}/views/ComponentView.svelte.d.ts +0 -0
  23. /package/dist/{client → explorer}/views/ControlsPanel.svelte +0 -0
  24. /package/dist/{client → explorer}/views/ControlsPanel.svelte.d.ts +0 -0
  25. /package/dist/{client → explorer}/views/DataTable.svelte +0 -0
  26. /package/dist/{client → explorer}/views/DataTable.svelte.d.ts +0 -0
  27. /package/dist/{client → explorer}/views/HomePage.svelte +0 -0
  28. /package/dist/{client → explorer}/views/HomePage.svelte.d.ts +0 -0
  29. /package/dist/{client → explorer}/views/LayoutView.svelte +0 -0
  30. /package/dist/{client → explorer}/views/LayoutView.svelte.d.ts +0 -0
  31. /package/dist/{client → explorer}/views/PageView.svelte +0 -0
  32. /package/dist/{client → explorer}/views/PageView.svelte.d.ts +0 -0
  33. /package/dist/{client → explorer}/views/PreviewFrame.svelte +0 -0
  34. /package/dist/{client → explorer}/views/PreviewFrame.svelte.d.ts +0 -0
  35. /package/dist/{client → explorer}/views/Sidebar.svelte.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.0.32] - 2026-07-03
11
+
12
+ ### Changed
13
+
14
+ - **Breaking: the embedded component is the Explorer now.** Import
15
+ `Explorer` from `sdocs/explorer` instead of `App` from `sdocs/client` —
16
+ same component and props, named for what it is. The CLI help and
17
+ generated app use the same naming.
18
+
19
+ ## [0.0.31] - 2026-07-03
20
+
21
+ ### Added
22
+
23
+ - **`icon` config option** — the sidebar header icon is now configurable:
24
+ `'sdocs'` shows the built-in mascot (the default), any other string is
25
+ used as an image URL, and `false` hides it.
26
+
10
27
  ## [0.0.30] - 2026-07-03
11
28
 
12
29
  ### Fixed
package/README.md CHANGED
@@ -65,11 +65,11 @@ The plugin discovers `.sdoc` files and exposes them via a `virtual:sdocs` module
65
65
  ```svelte
66
66
  <!-- src/routes/docs/+page.svelte -->
67
67
  <script>
68
- import App from 'sdocs/client';
68
+ import Explorer from 'sdocs/explorer';
69
69
  import { docs, cssNames } from 'virtual:sdocs';
70
70
  </script>
71
71
 
72
- <App
72
+ <Explorer
73
73
  {docs}
74
74
  {cssNames}
75
75
  logo="My Design System"
@@ -273,7 +273,7 @@ sidebar: {
273
273
  |--------|-------------|
274
274
  | `sdocs` | Main entry — `sdocsPlugin` + types |
275
275
  | `sdocs/vite` | Vite plugin function |
276
- | `sdocs/client` | App.svelte UI component |
276
+ | `sdocs/explorer` | Explorer.svelte UI component |
277
277
  | `sdocs/ui` | Reusable UI components (Button, Frame, Icon, Control, NavTree, Stack) |
278
278
 
279
279
  ## License
@@ -44,7 +44,7 @@ export async function devCommand() {
44
44
  // Rolldown-based Vite (8+) can't scan .svelte entry graphs and floods
45
45
  // the console with unresolved-import errors. Skip the initial scan —
46
46
  // runtime discovery still optimizes dependencies on demand — and
47
- // pre-bundle the one dependency the client app always needs.
47
+ // pre-bundle the one dependency the Explorer app always needs.
48
48
  entries: [],
49
49
  include: ['svelte'],
50
50
  },
@@ -21,6 +21,9 @@ export default {
21
21
  // Sidebar logo text (default: 'sdocs')
22
22
  // logo: 'sdocs',
23
23
 
24
+ // Sidebar logo icon: 'sdocs' for the mascot, an image URL, or false to hide (default: 'sdocs')
25
+ // icon: 'sdocs',
26
+
24
27
  // Sidebar configuration
25
28
  // sidebar: {
26
29
  // order: { root: ['Components', '*', 'Documentation'] },
@@ -15,6 +15,7 @@
15
15
  interface Props {
16
16
  docs: DocEntry[];
17
17
  logo?: string;
18
+ icon?: string | false;
18
19
  cssNames?: string[];
19
20
  sidebarConfig?: {
20
21
  order?: Record<string, string[]>;
@@ -22,7 +23,7 @@
22
23
  };
23
24
  }
24
25
 
25
- let { docs, logo = 'sdocs', cssNames = [], sidebarConfig }: Props = $props();
26
+ let { docs, logo = 'sdocs', icon = 'sdocs', cssNames = [], sidebarConfig }: Props = $props();
26
27
 
27
28
  let sidebarHidden = $state(false);
28
29
  let activeStylesheet = $state<string | undefined>(undefined);
@@ -62,6 +63,7 @@
62
63
  {tree}
63
64
  {currentPath}
64
65
  {logo}
66
+ {icon}
65
67
  {cssNames}
66
68
  {activeStylesheet}
67
69
  {theme}
@@ -0,0 +1,15 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import '../ui/styles/sdocs.css';
3
+ declare const __propDef: {
4
+ props: Record<string, never>;
5
+ events: {
6
+ [evt: string]: CustomEvent<any>;
7
+ };
8
+ slots: {};
9
+ };
10
+ export type ExplorerProps = typeof __propDef.props;
11
+ export type ExplorerEvents = typeof __propDef.events;
12
+ export type ExplorerSlots = typeof __propDef.slots;
13
+ export default class Explorer extends SvelteComponentTyped<ExplorerProps, ExplorerEvents, ExplorerSlots> {
14
+ }
15
+ export {};
@@ -11,6 +11,7 @@
11
11
  tree: TreeNode[];
12
12
  currentPath: string[];
13
13
  logo: string;
14
+ icon?: string | false;
14
15
  cssNames?: string[];
15
16
  activeStylesheet?: string;
16
17
  theme?: ThemeMode;
@@ -19,7 +20,7 @@
19
20
  onThemeChange?: (theme: ThemeMode) => void;
20
21
  }
21
22
 
22
- let { tree, currentPath, logo, cssNames = [], activeStylesheet, theme = 'light', onToggleFullscreen, onStylesheetChange, onThemeChange }: Props = $props();
23
+ let { tree, currentPath, logo, icon = 'sdocs', cssNames = [], activeStylesheet, theme = 'light', onToggleFullscreen, onStylesheetChange, onThemeChange }: Props = $props();
23
24
 
24
25
  const themeIcons: Record<ThemeMode, string> = { light: '\u2600', dark: '\u263D' };
25
26
  const themeLabels: Record<ThemeMode, string> = { light: 'Light', dark: 'Dark' };
@@ -185,7 +186,11 @@
185
186
  <aside class="sdocs-sidebar">
186
187
  <div class="sdocs-sidebar-header">
187
188
  <a href="#/" class="sdocs-logo">
188
- <Icon name="sdocs" --w="22px" --h="22px" --fill="#FC1D29" />
189
+ {#if icon === 'sdocs'}
190
+ <Icon name="sdocs" --w="22px" --h="22px" --fill="#FC1D29" />
191
+ {:else if icon}
192
+ <img class="sdocs-logo-img" src={icon} alt="" />
193
+ {/if}
189
194
  {logo}
190
195
  </a>
191
196
  <div class="sdocs-header-actions">
@@ -304,6 +309,11 @@
304
309
  color: var(--color-base-900);
305
310
  text-decoration: none;
306
311
  }
312
+ .sdocs-logo-img {
313
+ width: 22px;
314
+ height: 22px;
315
+ object-fit: contain;
316
+ }
307
317
  .sdocs-header-actions {
308
318
  display: flex;
309
319
  align-items: center;
@@ -7,13 +7,13 @@ import { discoverDocFiles, getSdocKind } from './discovery.js';
7
7
  import { extractSnippets, hasDefaultSnippet } from './snippet-extractor.js';
8
8
  import { base64urlEncode } from './snippet-compiler.js';
9
9
  const __dirname = dirname(fileURLToPath(import.meta.url));
10
- /** Source client directory in the installed package (dist/client, next to dist/server) */
11
- function getClientSourceDir() {
12
- return resolve(__dirname, '../client');
10
+ /** Source Explorer directory in the installed package (dist/explorer, next to dist/server) */
11
+ function getExplorerSourceDir() {
12
+ return resolve(__dirname, '../explorer');
13
13
  }
14
- /** Copy the client app plus the ui/ tree it imports (styles, fonts, components) */
15
- async function copyClientApp(sdocsDir) {
16
- await copyDir(getClientSourceDir(), resolve(sdocsDir, 'client'));
14
+ /** Copy the Explorer app plus the ui/ tree it imports (styles, fonts, components) */
15
+ async function copyExplorerApp(sdocsDir) {
16
+ await copyDir(getExplorerSourceDir(), resolve(sdocsDir, 'explorer'));
17
17
  await copyDir(resolve(__dirname, '../ui'), resolve(sdocsDir, 'ui'));
18
18
  }
19
19
  /** Nearest node_modules walking up from dir (mirrors Node's resolution) */
@@ -68,7 +68,7 @@ function generateIndexHtml(title) {
68
68
  <head>
69
69
  <meta charset="UTF-8">
70
70
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
71
- <link rel="icon" type="image/png" href="./client/favicon.png">
71
+ <link rel="icon" type="image/png" href="./explorer/favicon.png">
72
72
  <title>${title}</title>
73
73
  <style>body { margin: 0; }</style>
74
74
  </head>
@@ -78,18 +78,19 @@ function generateIndexHtml(title) {
78
78
  </body>
79
79
  </html>`;
80
80
  }
81
- /** Generate the entry.js that mounts the App */
81
+ /** Generate the entry.js that mounts the Explorer */
82
82
  function generateEntryJs(config) {
83
83
  return `import { mount } from 'svelte';
84
84
  import { docs, cssNames } from 'virtual:sdocs';
85
- import App from './client/App.svelte';
85
+ import Explorer from './explorer/Explorer.svelte';
86
86
 
87
- mount(App, {
87
+ mount(Explorer, {
88
88
  target: document.getElementById('app'),
89
89
  props: {
90
90
  docs,
91
91
  cssNames,
92
92
  logo: ${JSON.stringify(config.logo)},
93
+ icon: ${JSON.stringify(config.icon)},
93
94
  sidebarConfig: ${JSON.stringify(config.sidebar)},
94
95
  }
95
96
  });`;
@@ -121,8 +122,8 @@ function generatePreviewHtml(iframeVirtualId, css) {
121
122
  <div id="app"></div>
122
123
  <script type="module">
123
124
  import { mount } from 'svelte';
124
- import App from '${iframeVirtualId}';
125
- mount(App, { target: document.getElementById('app') });
125
+ import Preview from '${iframeVirtualId}';
126
+ mount(Preview, { target: document.getElementById('app') });
126
127
 
127
128
  window.addEventListener('message', (e) => {
128
129
  if (e.data?.type === 'sdocs:update-stylesheet') {
@@ -164,8 +165,8 @@ async function discoverSnippets(config, cwd) {
164
165
  /** Generate the staging directory with entry files for dev mode */
165
166
  export async function generateDevFiles(config, cwd) {
166
167
  const sdocsDir = await createStagingDir(cwd);
167
- // Copy client components into the staging dir so they're compiled outside node_modules
168
- await copyClientApp(sdocsDir);
168
+ // Copy Explorer components into the staging dir so they're compiled outside node_modules
169
+ await copyExplorerApp(sdocsDir);
169
170
  await writeFile(resolve(sdocsDir, 'index.html'), generateIndexHtml(config.logo));
170
171
  await writeFile(resolve(sdocsDir, 'entry.js'), generateEntryJs(config));
171
172
  return sdocsDir;
@@ -173,8 +174,8 @@ export async function generateDevFiles(config, cwd) {
173
174
  /** Generate the staging directory with entry + preview HTML files for build mode */
174
175
  export async function generateBuildFiles(config, cwd) {
175
176
  const sdocsDir = await createStagingDir(cwd);
176
- // Copy client components into the staging dir
177
- await copyClientApp(sdocsDir);
177
+ // Copy Explorer components into the staging dir
178
+ await copyExplorerApp(sdocsDir);
178
179
  await writeFile(resolve(sdocsDir, 'index.html'), generateIndexHtml(config.logo));
179
180
  await writeFile(resolve(sdocsDir, 'entry.js'), generateEntryJs(config));
180
181
  const inputs = {
@@ -18,9 +18,9 @@ Usage:
18
18
  sdocs <command>
19
19
 
20
20
  Commands:
21
- dev Start development server with live reload
21
+ dev Start the Explorer dev server with live reload
22
22
  run Same as dev — works with npx and no local install
23
- build Build static documentation site
23
+ build Build the Explorer as a static site
24
24
  preview Serve built site locally
25
25
  init Scaffold sdocs.config.js
26
26
 
@@ -8,6 +8,7 @@ const DEFAULTS = {
8
8
  open: false,
9
9
  css: null,
10
10
  logo: 'sdocs',
11
+ icon: 'sdocs',
11
12
  sidebar: {
12
13
  order: {},
13
14
  open: [],
@@ -77,6 +78,7 @@ export function resolveConfig(userConfig) {
77
78
  open: userConfig.open ?? DEFAULTS.open,
78
79
  css: userConfig.css ?? DEFAULTS.css,
79
80
  logo: userConfig.logo ?? DEFAULTS.logo,
81
+ icon: userConfig.icon ?? DEFAULTS.icon,
80
82
  sidebar: {
81
83
  order: userConfig.sidebar?.order ?? DEFAULTS.sidebar.order,
82
84
  open: userConfig.sidebar?.open ?? DEFAULTS.sidebar.open,
package/dist/types.d.ts CHANGED
@@ -10,6 +10,8 @@ export interface SdocsConfig {
10
10
  css?: string | Record<string, string>;
11
11
  /** Sidebar logo text. Default: 'sdocs' */
12
12
  logo?: string;
13
+ /** Sidebar logo icon: 'sdocs' for the built-in mascot, an image URL, or false to hide. Default: 'sdocs' */
14
+ icon?: string | false;
13
15
  /** Sidebar configuration */
14
16
  sidebar?: {
15
17
  /** Per-folder sort overrides. Keys are folder paths, 'root' for top level. '*' = unlisted items. */
@@ -25,6 +27,7 @@ export interface ResolvedSdocsConfig {
25
27
  open: boolean;
26
28
  css: string | Record<string, string> | null;
27
29
  logo: string;
30
+ icon: string | false;
28
31
  sidebar: {
29
32
  order: Record<string, string[]>;
30
33
  open: string[];
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "sdocs",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "A lightweight documentation tool for Svelte 5 components",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/gabilungu/sdocs.git",
10
+ "directory": "packages/sdocs"
11
+ },
7
12
  "bin": {
8
13
  "sdocs": "./bin/sdocs.js"
9
14
  },
@@ -16,8 +21,8 @@
16
21
  "types": "./dist/vite.d.ts",
17
22
  "default": "./dist/vite.js"
18
23
  },
19
- "./client": {
20
- "svelte": "./dist/client/App.svelte"
24
+ "./explorer": {
25
+ "svelte": "./dist/explorer/Explorer.svelte"
21
26
  },
22
27
  "./ui": {
23
28
  "types": "./dist/ui/index.d.ts",
@@ -1,15 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import '../ui/styles/sdocs.css';
3
- declare const __propDef: {
4
- props: Record<string, never>;
5
- events: {
6
- [evt: string]: CustomEvent<any>;
7
- };
8
- slots: {};
9
- };
10
- export type AppProps = typeof __propDef.props;
11
- export type AppEvents = typeof __propDef.events;
12
- export type AppSlots = typeof __propDef.slots;
13
- export default class App extends SvelteComponentTyped<AppProps, AppEvents, AppSlots> {
14
- }
15
- export {};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes