sdocs 0.0.12 → 0.0.14

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/dist/app-gen.js CHANGED
@@ -58,7 +58,7 @@ mount(App, {
58
58
  }
59
59
  /** Generate a preview HTML page for an iframe snippet */
60
60
  function generatePreviewHtml(iframeVirtualId, css) {
61
- const normHref = (href) => href.startsWith('./') ? href.slice(1) : href.startsWith('/') || href.startsWith('http') ? href : '/' + href;
61
+ const normHref = (href) => href.startsWith('http') ? href : href.startsWith('/') ? `/@fs${href}` : '/' + href;
62
62
  let cssLinks = '';
63
63
  if (css) {
64
64
  if (typeof css === 'string') {
@@ -143,7 +143,7 @@
143
143
  color: var(--sdocs-text);
144
144
  cursor: pointer;
145
145
  box-shadow: 0 1px 3px var(--sdocs-shadow);
146
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
146
+ font-family: var(--sdocs-font-sans);
147
147
  }
148
148
  .sdocs-exit-fullscreen:hover {
149
149
  background: var(--sdocs-bg-hover);
@@ -266,7 +266,7 @@
266
266
  .sdocs-component-view {
267
267
  padding: 24px 32px;
268
268
  max-width: 960px;
269
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
269
+ font-family: var(--sdocs-font-sans);
270
270
  }
271
271
  .sdocs-view-header {
272
272
  margin-bottom: 24px;
@@ -316,6 +316,6 @@
316
316
  overflow-x: auto;
317
317
  }
318
318
  .sdocs-code-block :global(code) {
319
- font-family: 'SF Mono', Monaco, Consolas, monospace;
319
+ font-family: var(--sdocs-font-mono);
320
320
  }
321
321
  </style>
@@ -171,7 +171,7 @@
171
171
  }
172
172
  .sdocs-control-type {
173
173
  color: var(--sdocs-text-muted);
174
- font-family: monospace;
174
+ font-family: var(--sdocs-font-mono);
175
175
  font-size: 12px;
176
176
  }
177
177
  .sdocs-reset-btn {
@@ -61,7 +61,7 @@
61
61
  color: var(--sdocs-text-strong);
62
62
  }
63
63
  .sdocs-table code {
64
- font-family: 'SF Mono', Monaco, Consolas, monospace;
64
+ font-family: var(--sdocs-font-mono);
65
65
  font-size: 12px;
66
66
  background: var(--sdocs-bg-hover);
67
67
  padding: 1px 4px;
@@ -52,7 +52,7 @@
52
52
  height: 100%;
53
53
  min-height: 400px;
54
54
  gap: 32px;
55
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
55
+ font-family: var(--sdocs-font-sans);
56
56
  }
57
57
  .sdocs-home-brand {
58
58
  text-align: center;
@@ -66,7 +66,7 @@
66
66
  display: flex;
67
67
  gap: 24px;
68
68
  padding: 24px 32px;
69
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
69
+ font-family: var(--sdocs-font-sans);
70
70
  }
71
71
  .sdocs-page-main {
72
72
  flex: 1;
@@ -202,7 +202,7 @@
202
202
  background: var(--sdocs-bg-subtle);
203
203
  display: flex;
204
204
  flex-direction: column;
205
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
205
+ font-family: var(--sdocs-font-sans);
206
206
  font-size: 13px;
207
207
  }
208
208
  .sdocs-sidebar-header {
@@ -41,7 +41,7 @@
41
41
  }
42
42
  .sdocs-control-value {
43
43
  color: var(--sdocs-text-secondary);
44
- font-family: monospace;
44
+ font-family: var(--sdocs-font-mono);
45
45
  font-size: 12px;
46
46
  }
47
47
  </style>
@@ -1,7 +1,53 @@
1
- /* sdocs color system semantic CSS variables */
1
+ /* Figtreevariable font (300–900) */
2
+ @font-face {
3
+ font-family: 'Figtree';
4
+ font-style: normal;
5
+ font-weight: 300 900;
6
+ font-display: swap;
7
+ src: url('./fonts/figtree-latin.woff2') format('woff2');
8
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
9
+ U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
10
+ U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
11
+ }
12
+ @font-face {
13
+ font-family: 'Figtree';
14
+ font-style: normal;
15
+ font-weight: 300 900;
16
+ font-display: swap;
17
+ src: url('./fonts/figtree-latin-ext.woff2') format('woff2');
18
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
19
+ U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
20
+ U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
21
+ U+A720-A7FF;
22
+ }
23
+ @font-face {
24
+ font-family: 'Figtree';
25
+ font-style: italic;
26
+ font-weight: 300 900;
27
+ font-display: swap;
28
+ src: url('./fonts/figtree-italic-latin.woff2') format('woff2');
29
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
30
+ U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
31
+ U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
32
+ }
33
+ @font-face {
34
+ font-family: 'Figtree';
35
+ font-style: italic;
36
+ font-weight: 300 900;
37
+ font-display: swap;
38
+ src: url('./fonts/figtree-italic-latin-ext.woff2') format('woff2');
39
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
40
+ U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
41
+ U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
42
+ U+A720-A7FF;
43
+ }
44
+
45
+ /* sdocs design tokens */
2
46
 
3
47
  :root,
4
48
  [data-sdocs-theme="light"] {
49
+ --sdocs-font-sans: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
50
+ --sdocs-font-mono: 'SF Mono', Monaco, Consolas, monospace;
5
51
  --sdocs-bg: #ffffff;
6
52
  --sdocs-bg-subtle: #f8fafc;
7
53
  --sdocs-bg-hover: #f1f5f9;
package/dist/config.js CHANGED
@@ -22,13 +22,28 @@ export function findConfigFile(root) {
22
22
  }
23
23
  return null;
24
24
  }
25
+ /** Resolve CSS paths to absolute filesystem paths */
26
+ function resolveCssPaths(css, root) {
27
+ if (!css)
28
+ return null;
29
+ if (typeof css === 'string') {
30
+ return css.startsWith('/') || css.startsWith('http') ? css : resolve(root, css);
31
+ }
32
+ const resolved = {};
33
+ for (const [name, href] of Object.entries(css)) {
34
+ resolved[name] = href.startsWith('/') || href.startsWith('http') ? href : resolve(root, href);
35
+ }
36
+ return resolved;
37
+ }
25
38
  /** Load and resolve the sdocs config with defaults */
26
39
  export async function loadConfig(root) {
27
40
  const configPath = findConfigFile(root);
28
41
  if (!configPath)
29
42
  return { ...DEFAULTS };
30
43
  const userConfig = await importConfig(configPath);
31
- return resolveConfig(userConfig);
44
+ const resolved = resolveConfig(userConfig);
45
+ resolved.css = resolveCssPaths(resolved.css, root);
46
+ return resolved;
32
47
  }
33
48
  /** Import a config file (supports .js, .mjs, .ts via Vite) */
34
49
  async function importConfig(configPath) {
@@ -63,12 +63,13 @@ export function generateIframeComponent(absoluteImports, snippetBody) {
63
63
  ${snippetBody}
64
64
  </div>`;
65
65
  }
66
- /** Normalize a CSS path to root-relative so it works inside deeply nested virtual URLs */
66
+ /** Convert a CSS path to a Vite-servable URL */
67
67
  function normalizeCssHref(href) {
68
- if (href.startsWith('./'))
69
- return href.slice(1);
70
- if (href.startsWith('/') || href.startsWith('http'))
68
+ if (href.startsWith('http'))
71
69
  return href;
70
+ // Absolute filesystem path → use Vite's /@fs/ prefix
71
+ if (href.startsWith('/'))
72
+ return `/@fs${href}`;
72
73
  return '/' + href;
73
74
  }
74
75
  /** Generate CSS link tags for the preview HTML */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdocs",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "A lightweight documentation tool for Svelte 5 components",
5
5
  "type": "module",
6
6
  "license": "MIT",