@tomehq/theme 0.3.2 → 0.3.4
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 +23 -0
- package/dist/{chunk-2AXAEADQ.js → chunk-QYINBNMJ.js} +28 -8
- package/dist/entry.js +1 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/src/Shell.test.tsx +222 -0
- package/src/Shell.tsx +18 -4
- package/src/__virtual_stubs/config.ts +2 -0
- package/src/__virtual_stubs/doc-context.ts +2 -0
- package/src/__virtual_stubs/overrides.ts +2 -0
- package/src/__virtual_stubs/page-loader.ts +4 -0
- package/src/__virtual_stubs/routes.ts +5 -0
- package/src/entry-helpers.test.ts +76 -0
- package/src/entry-helpers.ts +18 -1
- package/src/entry.test.tsx +695 -0
- package/src/entry.tsx +9 -0
- package/vitest.config.ts +31 -1
package/src/entry.tsx
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
CodeSamples,
|
|
38
38
|
LinkCard,
|
|
39
39
|
CardGrid,
|
|
40
|
+
ApiReference,
|
|
40
41
|
} from "@tomehq/components";
|
|
41
42
|
|
|
42
43
|
const MDX_COMPONENTS: Record<string, React.ComponentType<any>> = {
|
|
@@ -59,6 +60,9 @@ const MDX_COMPONENTS: Record<string, React.ComponentType<any>> = {
|
|
|
59
60
|
const contentStyles = `
|
|
60
61
|
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@300;400;500;600;700&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400;1,700&family=Fira+Code:wght@400;500;600&display=swap');
|
|
61
62
|
|
|
63
|
+
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
|
|
64
|
+
#tome-root { height: 100%; overflow: hidden; }
|
|
65
|
+
|
|
62
66
|
.tome-content h1 { display: none; }
|
|
63
67
|
.tome-content h2 { font-family: var(--font-body); font-size: 1.35em; font-weight: 600; margin-top: 2em; margin-bottom: 0.5em; display: flex; align-items: center; gap: 10px; letter-spacing: 0.01em; }
|
|
64
68
|
.tome-content h2::before { content: "#"; font-family: var(--font-heading); font-size: 1.2em; font-weight: 300; font-style: italic; color: var(--ac); opacity: 0.5; }
|
|
@@ -549,6 +553,11 @@ function App() {
|
|
|
549
553
|
editUrl={editUrl}
|
|
550
554
|
lastUpdated={currentRoute?.lastUpdated}
|
|
551
555
|
changelogEntries={!pageData?.isMdx ? pageData?.changelogEntries : undefined}
|
|
556
|
+
apiManifest={(!pageData?.isMdx && pageData?.isApiReference) ? pageData.apiManifest : undefined}
|
|
557
|
+
apiBaseUrl={config.api?.baseUrl}
|
|
558
|
+
apiPlayground={config.api?.playground}
|
|
559
|
+
apiAuth={config.api?.auth}
|
|
560
|
+
ApiReferenceComponent={ApiReference}
|
|
552
561
|
onNavigate={navigateTo}
|
|
553
562
|
allPages={allPages}
|
|
554
563
|
docContext={docContext}
|
package/vitest.config.ts
CHANGED
|
@@ -1,17 +1,47 @@
|
|
|
1
|
-
import { defineConfig } from "vitest/config";
|
|
1
|
+
import { defineConfig, type Plugin } from "vitest/config";
|
|
2
2
|
import { resolve } from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
|
|
5
5
|
const __dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
6
6
|
|
|
7
|
+
// Vite plugin that resolves virtual:tome/* imports to real files on disk.
|
|
8
|
+
// In production, these are resolved by vite-plugin-tome; in tests we need
|
|
9
|
+
// concrete files so that vi.mock can intercept them.
|
|
10
|
+
function virtualTomeStubs(): Plugin {
|
|
11
|
+
const stubs: Record<string, string> = {
|
|
12
|
+
"virtual:tome/config": resolve(__dirname, "src/__virtual_stubs/config.ts"),
|
|
13
|
+
"virtual:tome/routes": resolve(__dirname, "src/__virtual_stubs/routes.ts"),
|
|
14
|
+
"virtual:tome/page-loader": resolve(__dirname, "src/__virtual_stubs/page-loader.ts"),
|
|
15
|
+
"virtual:tome/doc-context": resolve(__dirname, "src/__virtual_stubs/doc-context.ts"),
|
|
16
|
+
"virtual:tome/overrides": resolve(__dirname, "src/__virtual_stubs/overrides.ts"),
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
name: "virtual-tome-stubs",
|
|
21
|
+
enforce: "pre",
|
|
22
|
+
resolveId(id) {
|
|
23
|
+
const resolved = stubs[id];
|
|
24
|
+
if (resolved) return resolved;
|
|
25
|
+
return null;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
7
30
|
export default defineConfig({
|
|
8
31
|
root: __dirname,
|
|
32
|
+
plugins: [virtualTomeStubs()],
|
|
9
33
|
test: {
|
|
10
34
|
name: "theme",
|
|
11
35
|
environment: "jsdom",
|
|
12
36
|
globals: true,
|
|
13
37
|
include: ["src/**/*.test.tsx", "src/**/*.test.ts"],
|
|
14
38
|
setupFiles: [resolve(__dirname, "src/test-setup.ts")],
|
|
39
|
+
server: {
|
|
40
|
+
deps: {
|
|
41
|
+
// Force Vite to transform entry.tsx and its virtual imports inline
|
|
42
|
+
inline: [/virtual:tome/],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
15
45
|
coverage: {
|
|
16
46
|
provider: "v8",
|
|
17
47
|
include: ["src/**/*.tsx", "src/**/*.ts"],
|