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 +1 -1
- package/dist/client/App.svelte +1 -1
- package/dist/client/ComponentView.svelte +2 -2
- package/dist/client/ControlsPanel.svelte +1 -1
- package/dist/client/DataTable.svelte +1 -1
- package/dist/client/HomePage.svelte +1 -1
- package/dist/client/PageView.svelte +1 -1
- package/dist/client/Sidebar.svelte +1 -1
- package/dist/client/controls/ColorControl.svelte +1 -1
- package/dist/client/fonts/figtree-italic-latin-ext.woff2 +0 -0
- package/dist/client/fonts/figtree-italic-latin.woff2 +0 -0
- package/dist/client/fonts/figtree-latin-ext.woff2 +0 -0
- package/dist/client/fonts/figtree-latin.woff2 +0 -0
- package/dist/client/theme.css +47 -1
- package/dist/config.js +16 -1
- package/dist/server/snippet-compiler.js +5 -4
- package/package.json +1 -1
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('
|
|
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') {
|
package/dist/client/App.svelte
CHANGED
|
@@ -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: -
|
|
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: -
|
|
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:
|
|
319
|
+
font-family: var(--sdocs-font-mono);
|
|
320
320
|
}
|
|
321
321
|
</style>
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
background: var(--sdocs-bg-subtle);
|
|
203
203
|
display: flex;
|
|
204
204
|
flex-direction: column;
|
|
205
|
-
font-family: -
|
|
205
|
+
font-family: var(--sdocs-font-sans);
|
|
206
206
|
font-size: 13px;
|
|
207
207
|
}
|
|
208
208
|
.sdocs-sidebar-header {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/client/theme.css
CHANGED
|
@@ -1,7 +1,53 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* Figtree — variable 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
|
-
|
|
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
|
-
/**
|
|
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 */
|