@dreamlake/dockit 0.2.4 → 0.2.6
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/Chip.d.ts +22 -0
- package/dist/components/Chip.js +43 -0
- package/dist/components/StatusTable.d.ts +3 -0
- package/dist/components/StatusTable.js +4 -8
- package/dist/components/Topbar.js +3 -17
- package/dist/components/VersionBadge.d.ts +5 -0
- package/dist/components/mdx-components.d.ts +2 -0
- package/dist/components/mdx-components.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/package.json +12 -11
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export type ChipVariant = 'muted' | 'accent' | 'warn';
|
|
3
|
+
export interface ChipProps extends ComponentPropsWithoutRef<'button'> {
|
|
4
|
+
/** Color pair: `muted` (default), `accent`, or `warn`. */
|
|
5
|
+
variant?: ChipVariant;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The canonical chip idiom of the shell — this component IS the design
|
|
9
|
+
* guide's badge spec, not an approximation of it: mono
|
|
10
|
+
* (`--font-doc-template-mono`), 10px / 600, `0.08em` tracking, uppercase,
|
|
11
|
+
* `2px 7px` padding, 4px radius, and a hairline `currentColor` border at
|
|
12
|
+
* 45% opacity. The topbar's DEV badge renders through it, and the
|
|
13
|
+
* segments of [`VersionBadge`](./VersionBadge.tsx) and the data-driven
|
|
14
|
+
* [`TestStatus`](./StatusTable.tsx) badge follow the same idiom.
|
|
15
|
+
*
|
|
16
|
+
* Renders a `<span>` by default, or a `<button type="button">` (with a
|
|
17
|
+
* pointer cursor) when `onClick` is given. All other props — `title`,
|
|
18
|
+
* `aria-*`, `className`, `style` — pass straight through; `style` wins
|
|
19
|
+
* over the base + variant styles, so one-off recolors are just inline
|
|
20
|
+
* overrides.
|
|
21
|
+
*/
|
|
22
|
+
export declare function Chip({ variant, onClick, className, style, children, ...rest }: ChipProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
const VARIANT_COLORS = {
|
|
3
|
+
muted: {
|
|
4
|
+
color: "var(--color-doc-template-muted)",
|
|
5
|
+
background: "var(--color-doc-template-chip)"
|
|
6
|
+
},
|
|
7
|
+
accent: {
|
|
8
|
+
color: "var(--color-doc-template-accent)",
|
|
9
|
+
background: "var(--color-doc-template-accent-soft)"
|
|
10
|
+
},
|
|
11
|
+
warn: {
|
|
12
|
+
color: "var(--color-doc-template-warn)",
|
|
13
|
+
background: "var(--color-doc-template-warn-soft)"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const BASE_STYLE = {
|
|
17
|
+
display: "inline-flex",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
fontFamily: "var(--font-doc-template-mono)",
|
|
20
|
+
fontSize: 10,
|
|
21
|
+
fontWeight: 600,
|
|
22
|
+
letterSpacing: "0.08em",
|
|
23
|
+
lineHeight: 1.4,
|
|
24
|
+
textTransform: "uppercase",
|
|
25
|
+
padding: "2px 7px",
|
|
26
|
+
borderRadius: 4,
|
|
27
|
+
border: "1px solid color-mix(in srgb, currentColor 45%, transparent)"
|
|
28
|
+
};
|
|
29
|
+
function Chip({ variant = "muted", onClick, className, style, children, ...rest }) {
|
|
30
|
+
const mergedStyle = {
|
|
31
|
+
...BASE_STYLE,
|
|
32
|
+
...VARIANT_COLORS[variant],
|
|
33
|
+
...onClick ? { cursor: "pointer" } : {},
|
|
34
|
+
...style
|
|
35
|
+
};
|
|
36
|
+
if (onClick) {
|
|
37
|
+
return /* @__PURE__ */ jsx("button", { type: "button", onClick, className, style: mergedStyle, ...rest, children });
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ jsx("span", { className, style: mergedStyle, ...rest, children });
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
Chip
|
|
43
|
+
};
|
|
@@ -12,6 +12,9 @@ export declare function StatusTable({ kind }: {
|
|
|
12
12
|
/**
|
|
13
13
|
* Inline single-suite status badge for embedding in API docs. Example:
|
|
14
14
|
* <TestStatus suite="lakeshore-controlplane" />
|
|
15
|
+
*
|
|
16
|
+
* The badge itself is the data-driven face of the canonical chip idiom —
|
|
17
|
+
* see [`Chip`](./Chip.tsx) and the `StatusBadge` notes above.
|
|
15
18
|
*/
|
|
16
19
|
export declare function TestStatus({ suite, example }: {
|
|
17
20
|
suite?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
|
+
import { Chip } from "./Chip.js";
|
|
3
4
|
const STATUS_COLOR = {
|
|
4
5
|
pass: "oklch(62% .15 145)",
|
|
5
6
|
fail: "oklch(58% .19 25)",
|
|
@@ -27,21 +28,16 @@ function StatusDot({ status }) {
|
|
|
27
28
|
function StatusBadge({ status }) {
|
|
28
29
|
const color = STATUS_COLOR[status] ?? "var(--color-doc-template-muted)";
|
|
29
30
|
return /* @__PURE__ */ jsxs(
|
|
30
|
-
|
|
31
|
+
Chip,
|
|
31
32
|
{
|
|
32
33
|
style: {
|
|
33
|
-
display: "inline-flex",
|
|
34
|
-
alignItems: "center",
|
|
35
34
|
gap: 6,
|
|
36
35
|
padding: "2px 8px",
|
|
37
|
-
|
|
36
|
+
border: "none",
|
|
38
37
|
background: `color-mix(in srgb, ${color} 12%, transparent)`,
|
|
39
38
|
color,
|
|
40
|
-
fontFamily: "var(--font-doc-template-mono)",
|
|
41
39
|
fontSize: 11,
|
|
42
|
-
|
|
43
|
-
textTransform: "uppercase",
|
|
44
|
-
letterSpacing: "0.08em"
|
|
40
|
+
lineHeight: "inherit"
|
|
45
41
|
},
|
|
46
42
|
children: [
|
|
47
43
|
/* @__PURE__ */ jsx(StatusDot, { status }),
|
|
@@ -5,6 +5,7 @@ import { findPage } from "../lib/navigation.js";
|
|
|
5
5
|
import { siteConfig } from "../site-config.js";
|
|
6
6
|
import { useMediaQuery } from "../lib/use-media-query.js";
|
|
7
7
|
import { useHiddenToggle } from "../lib/use-hidden-toggle.js";
|
|
8
|
+
import { Chip } from "./Chip.js";
|
|
8
9
|
import { ThemeToggle } from "./ThemeToggle.js";
|
|
9
10
|
import { VersionBadge } from "./VersionBadge.js";
|
|
10
11
|
import { useMerge } from "../renderer/Layout.js";
|
|
@@ -13,27 +14,12 @@ function HiddenRevealChip() {
|
|
|
13
14
|
const [show, setShow] = useHiddenToggle();
|
|
14
15
|
if (!show) return null;
|
|
15
16
|
return /* @__PURE__ */ jsx(
|
|
16
|
-
|
|
17
|
+
Chip,
|
|
17
18
|
{
|
|
18
|
-
|
|
19
|
+
variant: "warn",
|
|
19
20
|
onClick: () => setShow(false),
|
|
20
21
|
"aria-label": "Dev mode on — hidden pages are visible. Click to hide again.",
|
|
21
22
|
title: "Dev mode on — hidden pages are visible (Cmd+Shift+D to toggle)",
|
|
22
|
-
className: "text-doc-template-warn",
|
|
23
|
-
style: {
|
|
24
|
-
display: "inline-flex",
|
|
25
|
-
alignItems: "center",
|
|
26
|
-
padding: "2px 7px",
|
|
27
|
-
border: "1px solid color-mix(in srgb, var(--color-doc-template-warn) 45%, transparent)",
|
|
28
|
-
borderRadius: 4,
|
|
29
|
-
background: "var(--color-doc-template-warn-soft)",
|
|
30
|
-
fontFamily: "var(--font-doc-template-mono)",
|
|
31
|
-
fontSize: 10,
|
|
32
|
-
fontWeight: 600,
|
|
33
|
-
letterSpacing: "0.08em",
|
|
34
|
-
lineHeight: 1.4,
|
|
35
|
-
cursor: "pointer"
|
|
36
|
-
},
|
|
37
23
|
children: "DEV"
|
|
38
24
|
}
|
|
39
25
|
);
|
|
@@ -27,5 +27,10 @@ export interface VersionBadgeProps {
|
|
|
27
27
|
*
|
|
28
28
|
* Rendered by the Topbar for each `siteConfig.versionChips` entry, and
|
|
29
29
|
* exported from the library index for standalone placement.
|
|
30
|
+
*
|
|
31
|
+
* Visually, each segment follows the canonical chip idiom encapsulated by
|
|
32
|
+
* [`Chip`](./Chip.tsx) — mono 10px/600, 0.08em tracking, uppercase, 4px
|
|
33
|
+
* radius, hairline border. The two-segment (label | version) layout is
|
|
34
|
+
* bespoke, so this component does not compose `Chip` internally.
|
|
30
35
|
*/
|
|
31
36
|
export declare function VersionBadge({ label, version, collapsed, dropdown, }: VersionBadgeProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
import { Callout } from './Callout';
|
|
3
|
+
import { Chip } from './Chip';
|
|
3
4
|
import { Preview } from './Preview';
|
|
4
5
|
import { StatusTable, TestStatus } from './StatusTable';
|
|
5
6
|
/**
|
|
@@ -23,6 +24,7 @@ export declare const mdxComponents: {
|
|
|
23
24
|
code: import('react').FC<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>, "ref">>;
|
|
24
25
|
pre: typeof PreWrapper;
|
|
25
26
|
Callout: typeof Callout;
|
|
27
|
+
Chip: typeof Chip;
|
|
26
28
|
Preview: typeof Preview;
|
|
27
29
|
StatusTable: typeof StatusTable;
|
|
28
30
|
TestStatus: typeof TestStatus;
|
|
@@ -2,6 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useContext, createContext, useState } from "react";
|
|
3
3
|
import { CodeBlock } from "./CodeBlock.js";
|
|
4
4
|
import { Callout } from "./Callout.js";
|
|
5
|
+
import { Chip } from "./Chip.js";
|
|
5
6
|
import { Preview } from "./Preview.js";
|
|
6
7
|
import { TestStatus, StatusTable } from "./StatusTable.js";
|
|
7
8
|
const InsidePreContext = createContext(false);
|
|
@@ -337,6 +338,7 @@ const mdxComponents = {
|
|
|
337
338
|
code: Code,
|
|
338
339
|
pre: PreWrapper,
|
|
339
340
|
Callout,
|
|
341
|
+
Chip,
|
|
340
342
|
Preview,
|
|
341
343
|
StatusTable,
|
|
342
344
|
TestStatus
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export { useLineNumbers } from './lib/use-line-numbers';
|
|
|
27
27
|
export { useLocalStorage, DOC_PREFIX, docKey } from './lib/use-local-storage';
|
|
28
28
|
export { useMediaQuery } from './lib/use-media-query';
|
|
29
29
|
export { Callout } from './components/Callout';
|
|
30
|
+
export { Chip, type ChipProps, type ChipVariant } from './components/Chip';
|
|
30
31
|
export { ClientOnly } from './components/ClientOnly';
|
|
31
32
|
export { CodeBlock } from './components/CodeBlock';
|
|
32
33
|
export { DocFooter } from './components/DocFooter';
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { useLineNumbers } from "./lib/use-line-numbers.js";
|
|
|
12
12
|
import { DOC_PREFIX, docKey, useLocalStorage } from "./lib/use-local-storage.js";
|
|
13
13
|
import { useMediaQuery } from "./lib/use-media-query.js";
|
|
14
14
|
import { Callout } from "./components/Callout.js";
|
|
15
|
+
import { Chip } from "./components/Chip.js";
|
|
15
16
|
import { ClientOnly } from "./components/ClientOnly.js";
|
|
16
17
|
import { CodeBlock } from "./components/CodeBlock.js";
|
|
17
18
|
import { DocFooter } from "./components/DocFooter.js";
|
|
@@ -36,6 +37,7 @@ function initDocs(opts) {
|
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
39
|
Callout,
|
|
40
|
+
Chip,
|
|
39
41
|
ClientOnly,
|
|
40
42
|
CodeBlock,
|
|
41
43
|
DOC_PREFIX,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamlake/dockit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "The DreamLake documentation shell — Vike + React + Tailwind v4 + MDX docs framework with sidebar, TOC, search, and theming",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,11 +39,12 @@
|
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@mdx-js/react": ">=3.0.0",
|
|
42
|
-
"react": "
|
|
43
|
-
"react-dom": "
|
|
42
|
+
"react": ">=19.0.0",
|
|
43
|
+
"react-dom": ">=19.0.0",
|
|
44
44
|
"vike": "^0.4.210",
|
|
45
45
|
"vike-react": "^0.5.0",
|
|
46
|
-
"vite": ">=6.0.0"
|
|
46
|
+
"vite": ">=6.0.0",
|
|
47
|
+
"tailwindcss": "^4.0.0"
|
|
47
48
|
},
|
|
48
49
|
"peerDependenciesMeta": {
|
|
49
50
|
"vite": {
|
|
@@ -59,21 +60,21 @@
|
|
|
59
60
|
"remark-frontmatter": "^5.0.0",
|
|
60
61
|
"remark-gfm": "^4.0.0",
|
|
61
62
|
"remark-mdx-frontmatter": "^5.2.0",
|
|
62
|
-
"shiki": "^1.24.0"
|
|
63
|
-
"tailwindcss": "^4.0.0"
|
|
63
|
+
"shiki": "^1.24.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@mdx-js/react": "^3.1.0",
|
|
67
67
|
"@types/node": "^22.20.1",
|
|
68
|
-
"@types/react": "
|
|
69
|
-
"@types/react-dom": "
|
|
70
|
-
"react": "
|
|
71
|
-
"react-dom": "
|
|
68
|
+
"@types/react": "latest",
|
|
69
|
+
"@types/react-dom": "latest",
|
|
70
|
+
"react": "latest",
|
|
71
|
+
"react-dom": "latest",
|
|
72
72
|
"typescript": "^5.7.0",
|
|
73
73
|
"vike": "^0.4.210",
|
|
74
74
|
"vike-react": "^0.5.0",
|
|
75
75
|
"vite": "^7.0.0",
|
|
76
|
-
"vite-plugin-dts": "^4.3.0"
|
|
76
|
+
"vite-plugin-dts": "^4.3.0",
|
|
77
|
+
"tailwindcss": "^4.0.0"
|
|
77
78
|
},
|
|
78
79
|
"scripts": {
|
|
79
80
|
"build": "vite build",
|