@dreamlake/dockit 0.1.1
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/components/Callout.d.ts +11 -0
- package/dist/components/Callout.js +101 -0
- package/dist/components/ClientOnly.d.ts +4 -0
- package/dist/components/ClientOnly.js +11 -0
- package/dist/components/CodeBlock.d.ts +13 -0
- package/dist/components/CodeBlock.js +155 -0
- package/dist/components/DocFooter.d.ts +1 -0
- package/dist/components/DocFooter.js +63 -0
- package/dist/components/Preview.d.ts +16 -0
- package/dist/components/Preview.js +220 -0
- package/dist/components/SearchPalette.d.ts +8 -0
- package/dist/components/SearchPalette.js +678 -0
- package/dist/components/SearchResize.d.ts +11 -0
- package/dist/components/SearchResize.js +150 -0
- package/dist/components/Sidebar.d.ts +1 -0
- package/dist/components/Sidebar.js +134 -0
- package/dist/components/StatusTable.d.ts +19 -0
- package/dist/components/StatusTable.js +251 -0
- package/dist/components/TOC.d.ts +1 -0
- package/dist/components/TOC.js +674 -0
- package/dist/components/TabStrip.d.ts +8 -0
- package/dist/components/TabStrip.js +105 -0
- package/dist/components/ThemeProvider.d.ts +11 -0
- package/dist/components/ThemeProvider.js +40 -0
- package/dist/components/ThemeToggle.d.ts +2 -0
- package/dist/components/ThemeToggle.js +109 -0
- package/dist/components/Topbar.d.ts +9 -0
- package/dist/components/Topbar.js +818 -0
- package/dist/components/mdx-components.d.ts +30 -0
- package/dist/components/mdx-components.js +346 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +81 -0
- package/dist/lib/navigation.d.ts +80 -0
- package/dist/lib/navigation.js +57 -0
- package/dist/lib/pagefind-search.d.ts +21 -0
- package/dist/lib/pagefind-search.js +201 -0
- package/dist/lib/search-index.d.ts +43 -0
- package/dist/lib/search-index.js +112 -0
- package/dist/lib/tabs.d.ts +23 -0
- package/dist/lib/tabs.js +30 -0
- package/dist/lib/use-hidden-toggle.d.ts +15 -0
- package/dist/lib/use-hidden-toggle.js +23 -0
- package/dist/lib/use-line-numbers.d.ts +9 -0
- package/dist/lib/use-line-numbers.js +7 -0
- package/dist/lib/use-local-storage.d.ts +15 -0
- package/dist/lib/use-local-storage.js +58 -0
- package/dist/lib/use-media-query.d.ts +5 -0
- package/dist/lib/use-media-query.js +16 -0
- package/dist/renderer/Layout.d.ts +5 -0
- package/dist/renderer/Layout.js +170 -0
- package/dist/renderer/onRenderClient.d.ts +1 -0
- package/dist/renderer/onRenderClient.js +23 -0
- package/dist/renderer/onRenderHtml.d.ts +5 -0
- package/dist/renderer/onRenderHtml.js +44 -0
- package/dist/site-config.d.ts +61 -0
- package/dist/site-config.js +21 -0
- package/dist/styles.css +310 -0
- package/dist/vike.d.ts +12 -0
- package/dist/vike.js +8 -0
- package/dist/vite.d.ts +2 -0
- package/dist/vite.js +80 -0
- package/package.json +82 -0
- package/templates/netlify.example.toml +33 -0
- package/templates/set-version.mjs +70 -0
- package/templates/version-branch.sh +16 -0
- package/templates/versions.example.json +15 -0
package/dist/vite.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import react from "@vitejs/plugin-react";
|
|
3
|
+
import vike from "vike/plugin";
|
|
4
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
5
|
+
import mdx from "@mdx-js/rollup";
|
|
6
|
+
import remarkFrontmatter from "remark-frontmatter";
|
|
7
|
+
import remarkMdxFrontmatter from "remark-mdx-frontmatter";
|
|
8
|
+
import remarkGfm from "remark-gfm";
|
|
9
|
+
import rehypeSlug from "rehype-slug";
|
|
10
|
+
import rehypeShiki from "@shikijs/rehype";
|
|
11
|
+
function mdxRawLoader() {
|
|
12
|
+
const PREFIX = "\0mdx-raw:";
|
|
13
|
+
return {
|
|
14
|
+
name: "mdx-raw-loader",
|
|
15
|
+
enforce: "pre",
|
|
16
|
+
async resolveId(id, importer) {
|
|
17
|
+
if (!id.endsWith(".mdx?raw")) return null;
|
|
18
|
+
const base = id.slice(0, -"?raw".length);
|
|
19
|
+
const resolved = await this.resolve(base, importer, { skipSelf: true });
|
|
20
|
+
if (!resolved) return null;
|
|
21
|
+
return PREFIX + resolved.id;
|
|
22
|
+
},
|
|
23
|
+
async load(id) {
|
|
24
|
+
if (!id.startsWith(PREFIX)) return null;
|
|
25
|
+
const text = await readFile(id.slice(PREFIX.length), "utf-8");
|
|
26
|
+
return `export default ${JSON.stringify(text)};`;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function dockit() {
|
|
31
|
+
return [
|
|
32
|
+
tailwindcss(),
|
|
33
|
+
mdxRawLoader(),
|
|
34
|
+
{
|
|
35
|
+
enforce: "pre",
|
|
36
|
+
...mdx({
|
|
37
|
+
remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm],
|
|
38
|
+
rehypePlugins: [
|
|
39
|
+
rehypeSlug,
|
|
40
|
+
[
|
|
41
|
+
rehypeShiki,
|
|
42
|
+
{
|
|
43
|
+
themes: { light: "github-light", dark: "github-dark" },
|
|
44
|
+
defaultColor: false,
|
|
45
|
+
// Extract `file="…"` from the fenced-block meta string
|
|
46
|
+
// (e.g. ```bash file="terminal"). Returned keys become
|
|
47
|
+
// attributes on the <pre>; PreWrapper strips it off.
|
|
48
|
+
parseMetaString(meta) {
|
|
49
|
+
const m = meta.match(/\bfile="([^"]+)"/);
|
|
50
|
+
return m ? { file: m[1] } : null;
|
|
51
|
+
},
|
|
52
|
+
transformers: [
|
|
53
|
+
// Shiki drops the original `language-…` class from <code>,
|
|
54
|
+
// so the language is otherwise inaccessible to MDX
|
|
55
|
+
// components. Mirror it onto <pre language="…"> so
|
|
56
|
+
// PreWrapper can hand it to CodeBlock as the lang chip.
|
|
57
|
+
{
|
|
58
|
+
name: "forward-language",
|
|
59
|
+
pre(node) {
|
|
60
|
+
const lang = this.options?.lang;
|
|
61
|
+
if (typeof lang === "string" && lang && lang !== "text" && lang !== "plaintext") {
|
|
62
|
+
node.properties = node.properties || {};
|
|
63
|
+
node.properties.language = lang;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
],
|
|
71
|
+
providerImportSource: "@mdx-js/react"
|
|
72
|
+
})
|
|
73
|
+
},
|
|
74
|
+
react(),
|
|
75
|
+
vike()
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
dockit
|
|
80
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dreamlake/dockit",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "The DreamLake documentation shell — Vike + React + Tailwind v4 + MDX docs framework with sidebar, TOC, search, and theming",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"templates"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"*.css"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./server": {
|
|
23
|
+
"types": "./dist/renderer/onRenderHtml.d.ts",
|
|
24
|
+
"default": "./dist/renderer/onRenderHtml.js"
|
|
25
|
+
},
|
|
26
|
+
"./client": {
|
|
27
|
+
"types": "./dist/renderer/onRenderClient.d.ts",
|
|
28
|
+
"default": "./dist/renderer/onRenderClient.js"
|
|
29
|
+
},
|
|
30
|
+
"./vike": {
|
|
31
|
+
"types": "./dist/vike.d.ts",
|
|
32
|
+
"default": "./dist/vike.js"
|
|
33
|
+
},
|
|
34
|
+
"./vite": {
|
|
35
|
+
"types": "./dist/vite.d.ts",
|
|
36
|
+
"default": "./dist/vite.js"
|
|
37
|
+
},
|
|
38
|
+
"./styles.css": "./dist/styles.css"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@mdx-js/react": ">=3.0.0",
|
|
42
|
+
"react": "^19.0.0",
|
|
43
|
+
"react-dom": "^19.0.0",
|
|
44
|
+
"vike": "^0.4.210",
|
|
45
|
+
"vike-react": "^0.5.0",
|
|
46
|
+
"vite": ">=6.0.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"vite": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@mdx-js/rollup": "^3.1.1",
|
|
55
|
+
"@shikijs/rehype": "^1.24.0",
|
|
56
|
+
"@tailwindcss/vite": "^4.0.0",
|
|
57
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
58
|
+
"rehype-slug": "^6.0.0",
|
|
59
|
+
"remark-frontmatter": "^5.0.0",
|
|
60
|
+
"remark-gfm": "^4.0.0",
|
|
61
|
+
"remark-mdx-frontmatter": "^5.2.0",
|
|
62
|
+
"shiki": "^1.24.0",
|
|
63
|
+
"tailwindcss": "^4.0.0"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@mdx-js/react": "^3.1.0",
|
|
67
|
+
"@types/node": "^22.20.1",
|
|
68
|
+
"@types/react": "^19.0.0",
|
|
69
|
+
"@types/react-dom": "^19.0.0",
|
|
70
|
+
"react": "^19.0.0",
|
|
71
|
+
"react-dom": "^19.0.0",
|
|
72
|
+
"typescript": "^5.7.0",
|
|
73
|
+
"vike": "^0.4.210",
|
|
74
|
+
"vike-react": "^0.5.0",
|
|
75
|
+
"vite": "^7.0.0",
|
|
76
|
+
"vite-plugin-dts": "^4.3.0"
|
|
77
|
+
},
|
|
78
|
+
"scripts": {
|
|
79
|
+
"build": "vite build",
|
|
80
|
+
"typecheck": "tsc --noEmit"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Netlify config for a dockit docs site in a pnpm monorepo.
|
|
2
|
+
# Copy to your repo root as netlify.toml and adjust the publish path if your
|
|
3
|
+
# docs package is not at docs/.
|
|
4
|
+
|
|
5
|
+
[build]
|
|
6
|
+
command = "pnpm install --frozen-lockfile && pnpm build"
|
|
7
|
+
publish = "docs/dist/client"
|
|
8
|
+
|
|
9
|
+
[build.environment]
|
|
10
|
+
# Vite 7 requires node ^20.19 || >=22 — Netlify's "20" image can sit below
|
|
11
|
+
# that floor.
|
|
12
|
+
NODE_VERSION = "22"
|
|
13
|
+
PNPM_VERSION = "10.33.0"
|
|
14
|
+
# Netlify installs pnpm via corepack (honoring package.json's packageManager
|
|
15
|
+
# field). Corepack's baked-in npm registry keys rotate out from under old
|
|
16
|
+
# corepack builds and the signature check then kills the install — the
|
|
17
|
+
# documented workaround is to disable the integrity check.
|
|
18
|
+
COREPACK_INTEGRITY_KEYS = "0"
|
|
19
|
+
|
|
20
|
+
# ─── Branch + PR deploys ─────────────────────────────────────────────
|
|
21
|
+
# Every PR gets a deploy preview at deploy-preview-<n>--<site>.netlify.app.
|
|
22
|
+
# Every push to a non-production branch gets a branch deploy at
|
|
23
|
+
# <branch>--<site>.netlify.app — which is what powers versioned docs URLs.
|
|
24
|
+
# Empty blocks suffice — they tell Netlify "use the [build] defaults for
|
|
25
|
+
# these contexts." Branch deploys must also be enabled in the Netlify UI:
|
|
26
|
+
# Site settings → Build & deploy → Continuous deployment → Branches and
|
|
27
|
+
# deploy contexts → "Deploy all branches" (or whitelist specific branches).
|
|
28
|
+
|
|
29
|
+
[context.deploy-preview]
|
|
30
|
+
# Applies to every PR — uses [build] command + publish settings.
|
|
31
|
+
|
|
32
|
+
[context.branch-deploy]
|
|
33
|
+
# Applies to every non-production branch push.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Usage: node scripts/set-version.mjs <version>
|
|
4
|
+
*
|
|
5
|
+
* Updates the docs-deploy version in two places:
|
|
6
|
+
* - package.json at the workspace root (the canonical version used by
|
|
7
|
+
* version-branch.sh)
|
|
8
|
+
* - docs/public/versions.json (the version manifest served at /versions.json,
|
|
9
|
+
* consumed by the in-site version switcher)
|
|
10
|
+
*
|
|
11
|
+
* versions.json schema:
|
|
12
|
+
* {
|
|
13
|
+
* "current": "<latest>",
|
|
14
|
+
* "stable": "<stable>",
|
|
15
|
+
* "aliases": { "latest": "<url>", "stable": "<url>" },
|
|
16
|
+
* "versions": [{ "version", "url", "date" }, ...] // newest first
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* Idempotent: if the version already exists, its url/date are refreshed.
|
|
20
|
+
*
|
|
21
|
+
* Run from the workspace root. Paths resolve from the invocation cwd and
|
|
22
|
+
* assume the root-package.json + docs/public/versions.json layout; adjust
|
|
23
|
+
* below if your docs package lives elsewhere.
|
|
24
|
+
*/
|
|
25
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
26
|
+
import { resolve } from 'path';
|
|
27
|
+
|
|
28
|
+
// ── EDIT ME ──────────────────────────────────────────────────────────
|
|
29
|
+
// Your Netlify site name. Per-version URLs are the site's branch-deploy
|
|
30
|
+
// addresses for branch v<x.y.z> — they always resolve once branch deploys
|
|
31
|
+
// are enabled, with no DNS setup. (Pretty subdomains like
|
|
32
|
+
// v0-2-0.your-domain.com require a manual Netlify domain-management step
|
|
33
|
+
// per release; most sites should skip them.)
|
|
34
|
+
const NETLIFY_SITE = 'YOUR-SITE';
|
|
35
|
+
const versionUrl = (version) =>
|
|
36
|
+
`https://v${version.replace(/\./g, '-')}--${NETLIFY_SITE}.netlify.app`;
|
|
37
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
38
|
+
|
|
39
|
+
const version = process.argv[2];
|
|
40
|
+
|
|
41
|
+
if (!version || !/^\d+\.\d+\.\d+/.test(version)) {
|
|
42
|
+
console.error('Usage: node scripts/set-version.mjs <x.y.z>');
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const pkgPath = resolve(process.cwd(), 'package.json');
|
|
47
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
48
|
+
pkg.version = version;
|
|
49
|
+
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
50
|
+
|
|
51
|
+
const manifestPath = resolve(process.cwd(), 'docs', 'public', 'versions.json');
|
|
52
|
+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
53
|
+
|
|
54
|
+
const url = versionUrl(version);
|
|
55
|
+
const date = new Date().toISOString().slice(0, 10);
|
|
56
|
+
|
|
57
|
+
const existing = manifest.versions.find((v) => v.version === version);
|
|
58
|
+
if (existing) {
|
|
59
|
+
existing.url = url;
|
|
60
|
+
existing.date = date;
|
|
61
|
+
} else {
|
|
62
|
+
manifest.versions.unshift({ version, url, date });
|
|
63
|
+
}
|
|
64
|
+
manifest.current = version;
|
|
65
|
+
|
|
66
|
+
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
|
|
67
|
+
|
|
68
|
+
console.log(`Updated docs version to ${version}`);
|
|
69
|
+
console.log(` package.json → version: "${version}"`);
|
|
70
|
+
console.log(` versions.json → current: "${version}", entry: ${url}`);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Push current HEAD to a v<version> branch for Netlify branch deploy.
|
|
3
|
+
# Netlify serves branch "vx.y.z" at v<x-y-z>--<site>.netlify.app.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
# ── EDIT ME ──────────────────────────────────────────────────────────
|
|
7
|
+
# Your Netlify site name (matches NETLIFY_SITE in set-version.mjs).
|
|
8
|
+
SITE="YOUR-SITE"
|
|
9
|
+
# ─────────────────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
VERSION=$(node -e "console.log(require('./package.json').version)")
|
|
12
|
+
BRANCH="v${VERSION}"
|
|
13
|
+
|
|
14
|
+
echo "Pushing to branch: ${BRANCH}"
|
|
15
|
+
git push origin "HEAD:refs/heads/${BRANCH}" --force
|
|
16
|
+
echo "Branch deploy will be available at: https://${BRANCH//./-}--${SITE}.netlify.app"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"current": "0.1.0",
|
|
3
|
+
"stable": "0.1.0",
|
|
4
|
+
"aliases": {
|
|
5
|
+
"latest": "https://docs.example.com",
|
|
6
|
+
"stable": "https://docs.example.com"
|
|
7
|
+
},
|
|
8
|
+
"versions": [
|
|
9
|
+
{
|
|
10
|
+
"version": "0.1.0",
|
|
11
|
+
"url": "https://v0-1-0--YOUR-SITE.netlify.app",
|
|
12
|
+
"date": "2026-01-01"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|