@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.
Files changed (66) hide show
  1. package/dist/components/Callout.d.ts +11 -0
  2. package/dist/components/Callout.js +101 -0
  3. package/dist/components/ClientOnly.d.ts +4 -0
  4. package/dist/components/ClientOnly.js +11 -0
  5. package/dist/components/CodeBlock.d.ts +13 -0
  6. package/dist/components/CodeBlock.js +155 -0
  7. package/dist/components/DocFooter.d.ts +1 -0
  8. package/dist/components/DocFooter.js +63 -0
  9. package/dist/components/Preview.d.ts +16 -0
  10. package/dist/components/Preview.js +220 -0
  11. package/dist/components/SearchPalette.d.ts +8 -0
  12. package/dist/components/SearchPalette.js +678 -0
  13. package/dist/components/SearchResize.d.ts +11 -0
  14. package/dist/components/SearchResize.js +150 -0
  15. package/dist/components/Sidebar.d.ts +1 -0
  16. package/dist/components/Sidebar.js +134 -0
  17. package/dist/components/StatusTable.d.ts +19 -0
  18. package/dist/components/StatusTable.js +251 -0
  19. package/dist/components/TOC.d.ts +1 -0
  20. package/dist/components/TOC.js +674 -0
  21. package/dist/components/TabStrip.d.ts +8 -0
  22. package/dist/components/TabStrip.js +105 -0
  23. package/dist/components/ThemeProvider.d.ts +11 -0
  24. package/dist/components/ThemeProvider.js +40 -0
  25. package/dist/components/ThemeToggle.d.ts +2 -0
  26. package/dist/components/ThemeToggle.js +109 -0
  27. package/dist/components/Topbar.d.ts +9 -0
  28. package/dist/components/Topbar.js +818 -0
  29. package/dist/components/mdx-components.d.ts +30 -0
  30. package/dist/components/mdx-components.js +346 -0
  31. package/dist/index.d.ts +61 -0
  32. package/dist/index.js +81 -0
  33. package/dist/lib/navigation.d.ts +80 -0
  34. package/dist/lib/navigation.js +57 -0
  35. package/dist/lib/pagefind-search.d.ts +21 -0
  36. package/dist/lib/pagefind-search.js +201 -0
  37. package/dist/lib/search-index.d.ts +43 -0
  38. package/dist/lib/search-index.js +112 -0
  39. package/dist/lib/tabs.d.ts +23 -0
  40. package/dist/lib/tabs.js +30 -0
  41. package/dist/lib/use-hidden-toggle.d.ts +15 -0
  42. package/dist/lib/use-hidden-toggle.js +23 -0
  43. package/dist/lib/use-line-numbers.d.ts +9 -0
  44. package/dist/lib/use-line-numbers.js +7 -0
  45. package/dist/lib/use-local-storage.d.ts +15 -0
  46. package/dist/lib/use-local-storage.js +58 -0
  47. package/dist/lib/use-media-query.d.ts +5 -0
  48. package/dist/lib/use-media-query.js +16 -0
  49. package/dist/renderer/Layout.d.ts +5 -0
  50. package/dist/renderer/Layout.js +170 -0
  51. package/dist/renderer/onRenderClient.d.ts +1 -0
  52. package/dist/renderer/onRenderClient.js +23 -0
  53. package/dist/renderer/onRenderHtml.d.ts +5 -0
  54. package/dist/renderer/onRenderHtml.js +44 -0
  55. package/dist/site-config.d.ts +61 -0
  56. package/dist/site-config.js +21 -0
  57. package/dist/styles.css +310 -0
  58. package/dist/vike.d.ts +12 -0
  59. package/dist/vike.js +8 -0
  60. package/dist/vite.d.ts +2 -0
  61. package/dist/vite.js +80 -0
  62. package/package.json +82 -0
  63. package/templates/netlify.example.toml +33 -0
  64. package/templates/set-version.mjs +70 -0
  65. package/templates/version-branch.sh +16 -0
  66. package/templates/versions.example.json +15 -0
@@ -0,0 +1,105 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useRef, useState, useLayoutEffect } from "react";
3
+ import { usePageContext } from "vike-react/usePageContext";
4
+ import { tabForUrl, TABS } from "../lib/tabs.js";
5
+ const SPRING = "cubic-bezier(0.4, 0.7, 0.3, 1)";
6
+ function TabStrip() {
7
+ const { urlPathname } = usePageContext();
8
+ const activeTab = tabForUrl(urlPathname);
9
+ const containerRef = useRef(null);
10
+ const linkRefs = useRef({});
11
+ const [hovered, setHovered] = useState(null);
12
+ const [bar, setBar] = useState({
13
+ left: 0,
14
+ width: 0,
15
+ ready: false
16
+ });
17
+ const targetTab = hovered ?? activeTab;
18
+ useLayoutEffect(() => {
19
+ const container = containerRef.current;
20
+ const target = linkRefs.current[targetTab];
21
+ if (!container || !target) return;
22
+ const cR = container.getBoundingClientRect();
23
+ const tR = target.getBoundingClientRect();
24
+ setBar({ left: tR.left - cR.left, width: tR.width, ready: true });
25
+ }, [targetTab, urlPathname]);
26
+ useLayoutEffect(() => {
27
+ function onResize() {
28
+ const container = containerRef.current;
29
+ const target = linkRefs.current[targetTab];
30
+ if (!container || !target) return;
31
+ const cR = container.getBoundingClientRect();
32
+ const tR = target.getBoundingClientRect();
33
+ setBar((b) => ({ ...b, left: tR.left - cR.left, width: tR.width }));
34
+ }
35
+ window.addEventListener("resize", onResize);
36
+ return () => window.removeEventListener("resize", onResize);
37
+ }, [targetTab]);
38
+ if (TABS.length === 0) return null;
39
+ return /* @__PURE__ */ jsxs(
40
+ "ol",
41
+ {
42
+ ref: containerRef,
43
+ "aria-label": "Documentation sections",
44
+ className: "flex items-stretch relative m-0 p-0 list-none",
45
+ style: { height: "100%" },
46
+ onMouseLeave: () => setHovered(null),
47
+ children: [
48
+ TABS.map((tab) => {
49
+ const isActive = tab.id === activeTab;
50
+ return /* @__PURE__ */ jsx(
51
+ "li",
52
+ {
53
+ className: "flex items-stretch",
54
+ onMouseEnter: () => setHovered(tab.id),
55
+ children: /* @__PURE__ */ jsx(
56
+ "a",
57
+ {
58
+ ref: (el) => {
59
+ linkRefs.current[tab.id] = el;
60
+ },
61
+ href: tab.landing,
62
+ "aria-current": isActive ? "page" : void 0,
63
+ className: "flex items-center no-underline px-1.5 md:px-2.5",
64
+ style: {
65
+ fontFamily: "var(--font-doc-template-mono)",
66
+ fontSize: 10,
67
+ fontWeight: 600,
68
+ letterSpacing: "0.12em",
69
+ textTransform: "uppercase",
70
+ color: isActive || hovered === tab.id ? "var(--color-doc-template-ink)" : "var(--color-doc-template-muted)",
71
+ cursor: "pointer",
72
+ transition: "color 0.18s ease"
73
+ },
74
+ children: tab.label
75
+ }
76
+ )
77
+ },
78
+ tab.id
79
+ );
80
+ }),
81
+ /* @__PURE__ */ jsx(
82
+ "span",
83
+ {
84
+ "aria-hidden": true,
85
+ style: {
86
+ position: "absolute",
87
+ bottom: -13,
88
+ left: 0,
89
+ height: 3,
90
+ background: "var(--color-doc-template-ink)",
91
+ transform: `translateX(${bar.left + bar.width * 0.05}px)`,
92
+ width: bar.width * 0.9,
93
+ transition: bar.ready ? `transform 0.32s ${SPRING}, width 0.32s ${SPRING}` : "none",
94
+ willChange: "transform, width",
95
+ pointerEvents: "none"
96
+ }
97
+ }
98
+ )
99
+ ]
100
+ }
101
+ );
102
+ }
103
+ export {
104
+ TabStrip
105
+ };
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ export type Theme = 'light' | 'dark' | 'system';
3
+ interface ThemeContextValue {
4
+ theme: Theme;
5
+ setTheme: (t: Theme) => void;
6
+ }
7
+ export declare function ThemeProvider({ children }: {
8
+ children: ReactNode;
9
+ }): import("react").JSX.Element;
10
+ export declare function useTheme(): ThemeContextValue;
11
+ export {};
@@ -0,0 +1,40 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useEffect, useContext, createContext } from "react";
3
+ import { useLocalStorage } from "../lib/use-local-storage.js";
4
+ const ThemeContext = createContext({
5
+ theme: "system",
6
+ setTheme: () => {
7
+ }
8
+ });
9
+ function applyTheme(t) {
10
+ const root = document.documentElement;
11
+ if (t === "system") {
12
+ const dark = window.matchMedia("(prefers-color-scheme: dark)").matches;
13
+ root.setAttribute("data-theme", dark ? "dark" : "light");
14
+ } else {
15
+ root.setAttribute("data-theme", t);
16
+ }
17
+ }
18
+ function isTheme(v) {
19
+ return v === "light" || v === "dark" || v === "system";
20
+ }
21
+ function ThemeProvider({ children }) {
22
+ const [stored, setStored] = useLocalStorage("theme", "system");
23
+ const theme = isTheme(stored) ? stored : "system";
24
+ useEffect(() => {
25
+ applyTheme(theme);
26
+ if (theme !== "system") return;
27
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
28
+ const onChange = () => applyTheme("system");
29
+ mq.addEventListener("change", onChange);
30
+ return () => mq.removeEventListener("change", onChange);
31
+ }, [theme]);
32
+ return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: { theme, setTheme: setStored }, children });
33
+ }
34
+ function useTheme() {
35
+ return useContext(ThemeContext);
36
+ }
37
+ export {
38
+ ThemeProvider,
39
+ useTheme
40
+ };
@@ -0,0 +1,2 @@
1
+ import { JSX } from 'react';
2
+ export declare function ThemeToggle(): JSX.Element;
@@ -0,0 +1,109 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useTheme } from "./ThemeProvider.js";
3
+ import { ClientOnly } from "./ClientOnly.js";
4
+ const SIZE = 24;
5
+ const PAD = 2;
6
+ const SPRING = "cubic-bezier(0.34, 1.45, 0.55, 1)";
7
+ const LightIcon = () => /* @__PURE__ */ jsxs(
8
+ "svg",
9
+ {
10
+ viewBox: "0 0 24 24",
11
+ fill: "none",
12
+ stroke: "currentColor",
13
+ strokeWidth: "2",
14
+ strokeLinecap: "round",
15
+ strokeLinejoin: "round",
16
+ "aria-hidden": true,
17
+ style: { width: 13, height: 13 },
18
+ children: [
19
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4" }),
20
+ /* @__PURE__ */ jsx("path", { d: "M12 2v2" }),
21
+ /* @__PURE__ */ jsx("path", { d: "M12 20v2" }),
22
+ /* @__PURE__ */ jsx("path", { d: "M4.93 4.93l1.41 1.41" }),
23
+ /* @__PURE__ */ jsx("path", { d: "M17.66 17.66l1.41 1.41" }),
24
+ /* @__PURE__ */ jsx("path", { d: "M2 12h2" }),
25
+ /* @__PURE__ */ jsx("path", { d: "M20 12h2" }),
26
+ /* @__PURE__ */ jsx("path", { d: "M4.93 19.07l1.41-1.41" }),
27
+ /* @__PURE__ */ jsx("path", { d: "M17.66 6.34l1.41-1.41" })
28
+ ]
29
+ }
30
+ );
31
+ const SystemIcon = () => /* @__PURE__ */ jsxs(
32
+ "svg",
33
+ {
34
+ viewBox: "0 0 24 24",
35
+ fill: "none",
36
+ stroke: "currentColor",
37
+ strokeWidth: "2",
38
+ strokeLinecap: "round",
39
+ strokeLinejoin: "round",
40
+ "aria-hidden": true,
41
+ style: { width: 13, height: 13 },
42
+ children: [
43
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "13", rx: "2" }),
44
+ /* @__PURE__ */ jsx("path", { d: "M8 21h8" }),
45
+ /* @__PURE__ */ jsx("path", { d: "M12 17v4" })
46
+ ]
47
+ }
48
+ );
49
+ const DarkIcon = () => /* @__PURE__ */ jsx(
50
+ "svg",
51
+ {
52
+ viewBox: "0 0 24 24",
53
+ fill: "none",
54
+ stroke: "currentColor",
55
+ strokeWidth: "2",
56
+ strokeLinecap: "round",
57
+ strokeLinejoin: "round",
58
+ "aria-hidden": true,
59
+ style: { width: 13, height: 13 },
60
+ children: /* @__PURE__ */ jsx("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" })
61
+ }
62
+ );
63
+ const SEGMENTS = [
64
+ { value: "light", label: "Light", Icon: LightIcon },
65
+ { value: "system", label: "System", Icon: SystemIcon },
66
+ { value: "dark", label: "Dark", Icon: DarkIcon }
67
+ ];
68
+ function ToggleInner() {
69
+ const { theme, setTheme } = useTheme();
70
+ const idx = Math.max(0, SEGMENTS.findIndex((s) => s.value === theme));
71
+ const current = SEGMENTS[idx];
72
+ const next = SEGMENTS[(idx + 1) % SEGMENTS.length];
73
+ const Icon = current.Icon;
74
+ return /* @__PURE__ */ jsx(
75
+ "button",
76
+ {
77
+ type: "button",
78
+ "aria-label": `Theme: ${current.label}. Switch to ${next.label}.`,
79
+ title: `Theme: ${current.label} (click for ${next.label})`,
80
+ onClick: () => setTheme(next.value),
81
+ className: "inline-flex items-center justify-center bg-doc-template-panel border-0 cursor-pointer text-doc-template-muted hover:text-doc-template-ink",
82
+ style: {
83
+ width: SIZE + PAD * 2,
84
+ height: SIZE + PAD * 2,
85
+ borderRadius: 999,
86
+ padding: 0,
87
+ margin: 0,
88
+ transition: "color 0.25s ease, background 0.25s ease"
89
+ },
90
+ children: /* @__PURE__ */ jsx(
91
+ "span",
92
+ {
93
+ style: {
94
+ display: "inline-flex",
95
+ animation: `theme-icon-pop 0.42s ${SPRING} both`
96
+ },
97
+ children: /* @__PURE__ */ jsx(Icon, {})
98
+ },
99
+ current.value
100
+ )
101
+ }
102
+ );
103
+ }
104
+ function ThemeToggle() {
105
+ return /* @__PURE__ */ jsx(ClientOnly, { children: /* @__PURE__ */ jsx(ToggleInner, {}) });
106
+ }
107
+ export {
108
+ ThemeToggle
109
+ };
@@ -0,0 +1,9 @@
1
+ interface TopbarProps {
2
+ searchOpen: boolean;
3
+ onOpenSearch: () => void;
4
+ onCloseSearch: () => void;
5
+ query: string;
6
+ setQuery: (q: string) => void;
7
+ }
8
+ export declare function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }: TopbarProps): import("react").JSX.Element;
9
+ export {};