sdocs 0.0.60 → 0.0.61
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 +27 -0
- package/dist/commands/build.js +48 -0
- package/dist/commands/init.js +6 -3
- package/dist/explorer/Explorer.svelte +114 -34
- package/dist/explorer/router.svelte.d.ts +23 -11
- package/dist/explorer/router.svelte.js +70 -40
- package/dist/explorer/tree-builder.d.ts +53 -13
- package/dist/explorer/tree-builder.js +152 -38
- package/dist/explorer/views/HomePage.svelte +14 -4
- package/dist/explorer/views/Sidebar.svelte +50 -43
- package/dist/explorer/views/TopBar.svelte +159 -0
- package/dist/explorer/views/TopBar.svelte.d.ts +14 -0
- package/dist/language/config-schema.js +21 -4
- package/dist/server/app-gen.js +6 -3
- package/dist/server/config.js +18 -3
- package/dist/types.d.ts +21 -6
- package/package.json +1 -1
package/dist/server/app-gen.js
CHANGED
|
@@ -116,8 +116,11 @@ mount(Explorer, {
|
|
|
116
116
|
docs,
|
|
117
117
|
cssNames,
|
|
118
118
|
pageModules,
|
|
119
|
+
title: ${JSON.stringify(config.title)},
|
|
119
120
|
logo: ${JSON.stringify(config.logo)},
|
|
120
|
-
|
|
121
|
+
sections: ${JSON.stringify(config.sections)},
|
|
122
|
+
defaultSection: ${JSON.stringify(config.defaultSection)},
|
|
123
|
+
routing: ${JSON.stringify(config.routing ?? 'history')},
|
|
121
124
|
sidebarConfig: ${JSON.stringify(config.sidebar)},
|
|
122
125
|
}
|
|
123
126
|
});`;
|
|
@@ -192,7 +195,7 @@ export async function generateDevFiles(config, cwd) {
|
|
|
192
195
|
// Copy Explorer components into the staging dir so they're compiled outside node_modules
|
|
193
196
|
await copyExplorerApp(sdocsDir);
|
|
194
197
|
await linkStagedDeps(sdocsDir, cwd);
|
|
195
|
-
await writeFile(resolve(sdocsDir, 'index.html'), generateIndexHtml(config.
|
|
198
|
+
await writeFile(resolve(sdocsDir, 'index.html'), generateIndexHtml(config.title));
|
|
196
199
|
await writeFile(resolve(sdocsDir, 'entry.js'), generateEntryJs(config));
|
|
197
200
|
return sdocsDir;
|
|
198
201
|
}
|
|
@@ -205,7 +208,7 @@ export async function generateBuildFiles(config, cwd) {
|
|
|
205
208
|
// Copy Explorer components into the staging dir
|
|
206
209
|
await copyExplorerApp(sdocsDir);
|
|
207
210
|
await linkStagedDeps(sdocsDir, cwd);
|
|
208
|
-
await writeFile(resolve(sdocsDir, 'index.html'), generateIndexHtml(config.
|
|
211
|
+
await writeFile(resolve(sdocsDir, 'index.html'), generateIndexHtml(config.title));
|
|
209
212
|
await writeFile(resolve(sdocsDir, 'entry.js'), generateEntryJs(config));
|
|
210
213
|
const inputs = {
|
|
211
214
|
main: resolve(sdocsDir, 'index.html'),
|
package/dist/server/config.js
CHANGED
|
@@ -8,8 +8,11 @@ const DEFAULTS = {
|
|
|
8
8
|
open: false,
|
|
9
9
|
css: null,
|
|
10
10
|
static: null,
|
|
11
|
+
title: 'sdocs',
|
|
11
12
|
logo: 'sdocs',
|
|
12
|
-
|
|
13
|
+
sections: [],
|
|
14
|
+
defaultSection: 'Docs',
|
|
15
|
+
routing: null,
|
|
13
16
|
sidebar: {
|
|
14
17
|
order: {},
|
|
15
18
|
open: [],
|
|
@@ -87,14 +90,26 @@ export function resolveConfig(userConfig) {
|
|
|
87
90
|
? userConfig.include
|
|
88
91
|
: [userConfig.include]
|
|
89
92
|
: DEFAULTS.include;
|
|
93
|
+
// Pre-0.0.61 configs: `logo` was the header text and `icon` the image.
|
|
94
|
+
// An `icon` key marks the old shape — map it onto the new keys and warn.
|
|
95
|
+
const legacy = userConfig;
|
|
96
|
+
const isLegacy = 'icon' in legacy;
|
|
97
|
+
if (isLegacy) {
|
|
98
|
+
console.warn("[sdocs] config `icon` was renamed: use `logo` for the image and `title` for the header text.");
|
|
99
|
+
}
|
|
100
|
+
const title = userConfig.title ?? (isLegacy && typeof legacy.logo === 'string' ? legacy.logo : undefined);
|
|
101
|
+
const logo = isLegacy ? legacy.icon : userConfig.logo;
|
|
90
102
|
return {
|
|
91
103
|
include,
|
|
92
104
|
port: userConfig.port ?? DEFAULTS.port,
|
|
93
105
|
open: userConfig.open ?? DEFAULTS.open,
|
|
94
106
|
css: userConfig.css ?? DEFAULTS.css,
|
|
95
107
|
static: userConfig.static ?? DEFAULTS.static,
|
|
96
|
-
|
|
97
|
-
|
|
108
|
+
title: title ?? DEFAULTS.title,
|
|
109
|
+
logo: logo ?? DEFAULTS.logo,
|
|
110
|
+
sections: userConfig.sections ?? DEFAULTS.sections,
|
|
111
|
+
defaultSection: userConfig.defaultSection ?? DEFAULTS.defaultSection,
|
|
112
|
+
routing: userConfig.routing ?? DEFAULTS.routing,
|
|
98
113
|
sidebar: {
|
|
99
114
|
order: userConfig.sidebar?.order ?? DEFAULTS.sidebar.order,
|
|
100
115
|
open: userConfig.sidebar?.open ?? DEFAULTS.sidebar.open,
|
package/dist/types.d.ts
CHANGED
|
@@ -12,10 +12,21 @@ export interface SdocsConfig {
|
|
|
12
12
|
* files for previews. Standalone CLI flows (`sdocs dev`/`build`); when
|
|
13
13
|
* embedding the Vite plugin, use the host app's own public directory. */
|
|
14
14
|
static?: string;
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
|
|
15
|
+
/** Header title text. Default: 'sdocs' */
|
|
16
|
+
title?: string;
|
|
17
|
+
/** Header logo: 'sdocs' for the built-in mascot, an image URL, or false to hide. Default: 'sdocs' */
|
|
18
|
+
logo?: string | false;
|
|
19
|
+
/** Top-bar section order. Sections come from `@Section/...` title prefixes;
|
|
20
|
+
* unlisted sections follow alphabetically. Default: default section first,
|
|
21
|
+
* rest alphabetical. */
|
|
22
|
+
sections?: string[];
|
|
23
|
+
/** Name of the section that docs without an `@Section/` prefix belong to.
|
|
24
|
+
* Default: 'Docs' */
|
|
25
|
+
defaultSection?: string;
|
|
26
|
+
/** URL style: 'history' for real paths (default in the standalone CLI,
|
|
27
|
+
* needs the server to fall back to the shell), 'hash' for #/ URLs
|
|
28
|
+
* (default when embedding — works under any host routing). */
|
|
29
|
+
routing?: 'history' | 'hash';
|
|
19
30
|
/** Sidebar configuration */
|
|
20
31
|
sidebar?: {
|
|
21
32
|
/** Per-folder sort overrides. Keys are folder paths, 'root' for top level. '*' = unlisted items. */
|
|
@@ -74,8 +85,12 @@ export interface ResolvedSdocsConfig {
|
|
|
74
85
|
open: boolean;
|
|
75
86
|
css: string | Record<string, string> | null;
|
|
76
87
|
static: string | null;
|
|
77
|
-
|
|
78
|
-
|
|
88
|
+
title: string;
|
|
89
|
+
logo: string | false;
|
|
90
|
+
sections: string[];
|
|
91
|
+
defaultSection: string;
|
|
92
|
+
/** null = per-mode default (standalone: history, embedded: hash) */
|
|
93
|
+
routing: 'history' | 'hash' | null;
|
|
79
94
|
sidebar: {
|
|
80
95
|
order: Record<string, string[]>;
|
|
81
96
|
open: string[];
|