@dreamlake/dockit 0.2.26 → 0.2.28
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/ContentRow.d.ts +7 -0
- package/dist/components/ContentRow.js +18 -0
- package/dist/components/Topbar.js +20 -16
- 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/dist/renderer/Layout.js +1 -0
- package/dist/styles.css +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export interface ContentRowProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Expand into the prose gutters, staying inside the content column. */
|
|
4
|
+
width?: "wide" | "text";
|
|
5
|
+
}
|
|
6
|
+
/** A responsive row for diagrams, examples and comparisons wider than prose. */
|
|
7
|
+
export declare function ContentRow({ width, className, ...props }: ContentRowProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
function ContentRow({
|
|
3
|
+
width = "wide",
|
|
4
|
+
className = "",
|
|
5
|
+
...props
|
|
6
|
+
}) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
...props,
|
|
11
|
+
className: `doc-content-row ${className}`,
|
|
12
|
+
"data-width": width
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
ContentRow
|
|
18
|
+
};
|
|
@@ -10,7 +10,7 @@ import { ThemeToggle } from "./ThemeToggle.js";
|
|
|
10
10
|
import { VersionBadge } from "./VersionBadge.js";
|
|
11
11
|
import { useMerge } from "../renderer/Layout.js";
|
|
12
12
|
import { TabStrip } from "./TabStrip.js";
|
|
13
|
-
import { internalTabs, tabForUrl } from "../lib/tabs.js";
|
|
13
|
+
import { TABS, internalTabs, tabForUrl } from "../lib/tabs.js";
|
|
14
14
|
function HiddenRevealChip() {
|
|
15
15
|
const [show, setShow] = useHiddenToggle();
|
|
16
16
|
if (!show) return null;
|
|
@@ -38,6 +38,7 @@ const SEARCH_INSET = `max(${SEARCH_GUTTER}px, calc((100vw - ${SEARCH_MAX_W}px) /
|
|
|
38
38
|
function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
39
39
|
const { urlPathname } = usePageContext();
|
|
40
40
|
const current = findPage(urlPathname);
|
|
41
|
+
const hasTabs = TABS.length > 0;
|
|
41
42
|
const activeTab = internalTabs().find((t) => t.id === tabForUrl(urlPathname));
|
|
42
43
|
const versionChips = activeTab?.versionChips ?? siteConfig.versionChips ?? [];
|
|
43
44
|
const inputRef = useRef(null);
|
|
@@ -154,11 +155,12 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
154
155
|
const iconButtonMode = isBelowLg && !searchOpen;
|
|
155
156
|
const closedWidth = isXlUp ? CLOSED_WIDTH_XL : isLgUp ? CLOSED_WIDTH_LG : CLOSED_WIDTH_MD;
|
|
156
157
|
const brandRef = useRef(null);
|
|
158
|
+
const wordmarkRef = useRef(null);
|
|
157
159
|
const brandMaxRight = useRef(0);
|
|
158
160
|
const tabsRef = useRef(null);
|
|
159
161
|
const actionsRef = useRef(null);
|
|
160
162
|
const [tabsFit, setTabsFit] = useState(false);
|
|
161
|
-
const [
|
|
163
|
+
const [breadcrumbBounds, setBreadcrumbBounds] = useState({ left: 0, width: 0 });
|
|
162
164
|
const [pinLeft, setPinLeft] = useState(0);
|
|
163
165
|
const [searchPinLeft, setSearchPinLeft] = useState(null);
|
|
164
166
|
useLayoutEffect(() => {
|
|
@@ -182,7 +184,10 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
182
184
|
const packedSearchLeft = actionsLeft - 8 - closedWidth;
|
|
183
185
|
const fits = (searchLeft) => w > 0 && brandClear && pin + w + 16 <= searchLeft;
|
|
184
186
|
const fullPin = textRight + closedWidth + 16 <= actionsLeft && fits(pinnedSearchLeft);
|
|
185
|
-
|
|
187
|
+
const pinned = isLgUp && (fullPin || fits(packedSearchLeft));
|
|
188
|
+
const breadcrumbLeft = (wordmarkRef.current?.getBoundingClientRect().right ?? brand?.right ?? 0) + 10;
|
|
189
|
+
const breadcrumbRight = pinned ? pin : tabsEl.getBoundingClientRect().left;
|
|
190
|
+
setBreadcrumbBounds({ left: breadcrumbLeft, width: Math.max(0, breadcrumbRight - breadcrumbLeft - 16) });
|
|
186
191
|
setPinLeft(pin);
|
|
187
192
|
setSearchPinLeft(fullPin ? pinnedSearchLeft : null);
|
|
188
193
|
setTabsFit(fullPin || fits(packedSearchLeft));
|
|
@@ -198,7 +203,7 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
198
203
|
ro.disconnect();
|
|
199
204
|
window.removeEventListener("resize", measure);
|
|
200
205
|
};
|
|
201
|
-
}, [closedWidth]);
|
|
206
|
+
}, [closedWidth, isLgUp, merged, urlPathname]);
|
|
202
207
|
const edgePinned = isLgUp && !iconButtonMode && tabsFit;
|
|
203
208
|
const searchStyle = iconButtonMode ? {
|
|
204
209
|
// In-flow grid item — sits at the end of column 2 next to TabStrip.
|
|
@@ -298,7 +303,7 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
298
303
|
{
|
|
299
304
|
ref: brandRef,
|
|
300
305
|
href: "/",
|
|
301
|
-
className: "flex items-center gap-2.5 pl-[14px] md:pl-[18px] no-underline text-doc-template-ink hover:opacity-80 min-w-[72px] shrink-0",
|
|
306
|
+
className: "flex items-center gap-2.5 pl-[14px] md:pl-[18px] no-underline text-doc-template-ink hover:opacity-80 min-w-[72px] shrink-0 whitespace-nowrap",
|
|
302
307
|
style: {
|
|
303
308
|
fontFamily: "var(--font-doc-template-ui)",
|
|
304
309
|
fontSize: 14,
|
|
@@ -308,7 +313,7 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
308
313
|
...palFade(searchOpen)
|
|
309
314
|
},
|
|
310
315
|
children: [
|
|
311
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
316
|
+
/* @__PURE__ */ jsxs("span", { ref: wordmarkRef, children: [
|
|
312
317
|
siteConfig.brand,
|
|
313
318
|
/* @__PURE__ */ jsx(
|
|
314
319
|
"span",
|
|
@@ -397,16 +402,14 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
397
402
|
"aria-label": "Breadcrumb",
|
|
398
403
|
className: "hidden md:flex items-center gap-1.5 text-doc-template-muted uppercase pointer-events-none overflow-hidden",
|
|
399
404
|
style: {
|
|
400
|
-
//
|
|
401
|
-
//
|
|
402
|
-
|
|
403
|
-
// underneath the tabs. (gridArea/placeSelf: see the note on
|
|
404
|
-
// `searchStyle` about fixed-positioned grid items.)
|
|
405
|
-
...edgePinned ? {
|
|
405
|
+
// On tabbed sites the wordmark supplies the root crumb. Keep
|
|
406
|
+
// the remaining path in the measured gap before the tab strip.
|
|
407
|
+
...hasTabs ? {
|
|
406
408
|
position: "fixed",
|
|
407
409
|
top: 0,
|
|
408
410
|
height: 40,
|
|
409
|
-
left:
|
|
411
|
+
left: breadcrumbBounds.left,
|
|
412
|
+
width: breadcrumbBounds.width,
|
|
410
413
|
gridArea: "auto",
|
|
411
414
|
placeSelf: "stretch"
|
|
412
415
|
} : { gridColumn: 2, gridRow: 1, justifySelf: "start", marginLeft: 8 },
|
|
@@ -420,15 +423,16 @@ function Topbar({ searchOpen, onOpenSearch, onCloseSearch, query, setQuery }) {
|
|
|
420
423
|
transition: `opacity 0.25s ease, transform 0.25s ${SPRING}`
|
|
421
424
|
},
|
|
422
425
|
children: [
|
|
423
|
-
|
|
426
|
+
hasTabs && /* @__PURE__ */ jsx("span", { "aria-hidden": true, style: { opacity: 0.5 }, children: "/" }),
|
|
427
|
+
!hasTabs && siteConfig.breadcrumbRoot && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
424
428
|
/* @__PURE__ */ jsx("span", { children: siteConfig.breadcrumbRoot }),
|
|
425
429
|
/* @__PURE__ */ jsx("span", { style: { opacity: 0.5 }, children: "/" })
|
|
426
430
|
] }),
|
|
427
431
|
current.section && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
428
|
-
/* @__PURE__ */ jsx("span", { children: current.section }),
|
|
432
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0", children: current.section }),
|
|
429
433
|
/* @__PURE__ */ jsx("span", { style: { opacity: 0.5 }, children: "/" })
|
|
430
434
|
] }),
|
|
431
|
-
/* @__PURE__ */ jsx("span", { className: "text-doc-template-ink", children: current.title })
|
|
435
|
+
/* @__PURE__ */ jsx("span", { className: "text-doc-template-ink truncate", "aria-current": "page", title: current.title, children: current.title })
|
|
432
436
|
]
|
|
433
437
|
}
|
|
434
438
|
),
|
|
@@ -2,6 +2,7 @@ import { ComponentPropsWithoutRef } from 'react';
|
|
|
2
2
|
import { Table } from './Table';
|
|
3
3
|
import { Callout } from './Callout';
|
|
4
4
|
import { Chip } from './Chip';
|
|
5
|
+
import { ContentRow } from './ContentRow';
|
|
5
6
|
import { Preview } from './Preview';
|
|
6
7
|
import { StatusTable, TestStatus } from './StatusTable';
|
|
7
8
|
/**
|
|
@@ -27,6 +28,7 @@ export declare const mdxComponents: {
|
|
|
27
28
|
Callout: typeof Callout;
|
|
28
29
|
Chip: typeof Chip;
|
|
29
30
|
Preview: typeof Preview;
|
|
31
|
+
ContentRow: typeof ContentRow;
|
|
30
32
|
StatusTable: typeof StatusTable;
|
|
31
33
|
TestStatus: typeof TestStatus;
|
|
32
34
|
};
|
|
@@ -4,6 +4,7 @@ import { CodeBlock } from "./CodeBlock.js";
|
|
|
4
4
|
import { Table } from "./Table.js";
|
|
5
5
|
import { Callout } from "./Callout.js";
|
|
6
6
|
import { Chip } from "./Chip.js";
|
|
7
|
+
import { ContentRow } from "./ContentRow.js";
|
|
7
8
|
import { Preview } from "./Preview.js";
|
|
8
9
|
import { TestStatus, StatusTable } from "./StatusTable.js";
|
|
9
10
|
const InsidePreContext = createContext(false);
|
|
@@ -341,6 +342,7 @@ const mdxComponents = {
|
|
|
341
342
|
Callout,
|
|
342
343
|
Chip,
|
|
343
344
|
Preview,
|
|
345
|
+
ContentRow,
|
|
344
346
|
StatusTable,
|
|
345
347
|
TestStatus
|
|
346
348
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ import { TOC } from "./components/TOC.js";
|
|
|
30
30
|
import { Topbar } from "./components/Topbar.js";
|
|
31
31
|
import { VersionBadge } from "./components/VersionBadge.js";
|
|
32
32
|
import { Layout, useMerge } from "./renderer/Layout.js";
|
|
33
|
+
import { ContentRow } from "./components/ContentRow.js";
|
|
33
34
|
function initDocs(opts) {
|
|
34
35
|
if (opts.pages && opts.pageMetadata) {
|
|
35
36
|
throw new Error("initDocs: provide pageMetadata or pages, not both");
|
|
@@ -48,6 +49,7 @@ export {
|
|
|
48
49
|
CodeBlock,
|
|
49
50
|
CodeExample,
|
|
50
51
|
CodeTabs,
|
|
52
|
+
ContentRow,
|
|
51
53
|
DOC_PREFIX,
|
|
52
54
|
DocFooter,
|
|
53
55
|
Layout,
|
package/dist/renderer/Layout.js
CHANGED
|
@@ -145,6 +145,7 @@ function Layout({ children }) {
|
|
|
145
145
|
/* @__PURE__ */ jsxs(
|
|
146
146
|
"main",
|
|
147
147
|
{
|
|
148
|
+
"data-doc-fullscreen": isFullscreen || void 0,
|
|
148
149
|
...current?.noindex ? {} : { "data-pagefind-body": true },
|
|
149
150
|
...current?.hidden ? { "data-pagefind-meta": "hidden:true" } : {},
|
|
150
151
|
className: isFullscreen ? "doc-content w-full min-w-0 h-full overflow-auto p-4" : "doc-content w-full min-w-0 px-[18px] pb-20 lg:px-[56px] lg:pb-[120px] lg:max-w-[760px]",
|
package/dist/styles.css
CHANGED
|
@@ -427,3 +427,11 @@
|
|
|
427
427
|
}
|
|
428
428
|
.dockit-code-tabs[data-first-active='true'] [role='tabpanel'] { border-top-left-radius: 0; }
|
|
429
429
|
.dockit-code-tabs [role='tabpanel'][hidden] { display: none; }
|
|
430
|
+
|
|
431
|
+
/* ContentRow borrows only the main column gutters, never the sidebar/TOC. */
|
|
432
|
+
.doc-content { --doc-row-bleed: 6px; }
|
|
433
|
+
.doc-content-row { min-width: 0; margin-block: 24px; }
|
|
434
|
+
.doc-content-row[data-width="wide"] { width: calc(100% + 2 * var(--doc-row-bleed, 0px)); margin-inline: calc(-1 * var(--doc-row-bleed, 0px)); }
|
|
435
|
+
.doc-content-row > * { min-width: 0; }
|
|
436
|
+
@media (min-width: 1024px) { .doc-content { --doc-row-bleed: 40px; } }
|
|
437
|
+
.doc-content[data-doc-fullscreen] { --doc-row-bleed: 0px; }
|
package/package.json
CHANGED