@publish.os/nextjs 0.0.1-alpha.8 → 0.0.1-alpha.90
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/compiler-assets/nextjs/defaults/app/globals.css +1 -0
- package/compiler-assets/nextjs/defaults/group/index.tsx +50 -0
- package/compiler-assets/nextjs/defaults/group/layout.tsx +7 -3
- package/compiler-assets/nextjs/defaults/group/page.tsx +35 -43
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +22 -11
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +1 -4
- package/compiler-assets/nextjs/defaults/root/css/animation.css +131 -0
- package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +4 -1
- package/compiler-assets/nextjs/defaults/root/css/components/menu.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/popover.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/select.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/shadow.css +6 -25
- package/compiler-assets/nextjs/defaults/root/css/typography.css +51 -68
- package/compiler-assets/nextjs/defaults/root/globals.css +25 -0
- package/compiler-assets/nextjs/defaults/root/{page.tsx → index.tsx} +6 -2
- package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -1
- package/compiler-assets/nextjs/defaults/root/theme.css +22 -22
- package/compiler-assets/nextjs/shims/generated-group-page.tsx +19 -2
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +16 -2
- package/compiler-assets/nextjs/shims/global-layout.tsx +11 -43
- package/compiler-assets/nextjs/shims/proxy.ts +21 -9
- package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +76 -15
- package/compiler-assets/nextjs/shims/root-page.tsx +7 -1
- package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +34 -0
- package/compiler-assets/nextjs/shims/site-heading-level.tsx +14 -0
- package/compiler-assets/nextjs/shims/site-mdx-components.tsx +100 -0
- package/compiler-assets/nextjs/shims/site-mdx.tsx +12 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +41 -25
- package/dist/build-operation-2JAYBSKF.js +83 -0
- package/dist/button-CtzUJB8u.d.ts +11 -0
- package/dist/{button-CFdx-ohV.d.ts → button-c3WGnxIj.d.ts} +3 -3
- package/dist/chunk-535TM4A5.js +1455 -0
- package/dist/chunk-726GV2NF.js +2344 -0
- package/dist/chunk-7OGTPSKI.js +156 -0
- package/dist/chunk-AI2UULNX.js +9 -0
- package/dist/chunk-B2V22WRT.js +297 -0
- package/dist/chunk-DLDFHU7Y.js +191 -0
- package/dist/chunk-DWA3ZRGW.js +142 -0
- package/dist/chunk-GGKFQ3MA.js +621 -0
- package/dist/chunk-H6XILMZX.js +6154 -0
- package/dist/chunk-NECL5IBJ.js +318 -0
- package/dist/chunk-SVYGXXYR.js +36 -0
- package/dist/chunk-UF6ATARM.js +1100 -0
- package/dist/chunk-VO2I7MTM.js +56 -0
- package/dist/chunk-WDY4IK6Z.js +128 -0
- package/dist/chunk-WKTEO6RS.js +586 -0
- package/dist/chunk-YLTOLYWM.js +92 -0
- package/dist/compiler.d.ts +41 -7
- package/dist/compiler.js +48 -13143
- package/dist/compose-NN23UJGC.js +13 -0
- package/dist/config/createNextConfig.js +13 -0
- package/dist/dev-operation-TZDVJCN7.js +1055 -0
- package/dist/framework-selection-X4U6Y6QC.js +10 -0
- package/dist/ide-support-ZNW7ODFY.js +15 -0
- package/dist/index.d.ts +15 -3
- package/dist/kernel/components/blocks/AgentActions.js +71 -61
- package/dist/kernel/components/blocks/design-system-preview.d.ts +1 -1
- package/dist/kernel/components/blocks/design-system-preview.js +32 -13
- package/dist/kernel/components/blocks/link-playground.js +2 -2
- package/dist/kernel/components/blocks/logo-block.js +2 -2
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +10 -2
- package/dist/kernel/components/blocks/nav-breadcrumb.js +20 -5
- package/dist/kernel/components/blocks/navbar.d.ts +2 -2
- package/dist/kernel/components/blocks/navbar.js +401 -60
- package/dist/kernel/components/blocks/navigation-progress-playground.js +4 -4
- package/dist/kernel/components/blocks/navigation-progress.js +4 -1
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +11 -23
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +5 -4
- package/dist/kernel/components/blocks/search.d.ts +83 -58
- package/dist/kernel/components/blocks/search.js +553 -426
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +11 -9
- package/dist/kernel/components/blocks/sidebar.d.ts +3 -3
- package/dist/kernel/components/blocks/sidebar.js +18 -11
- package/dist/kernel/components/blocks/theme-toggle.d.ts +2 -2
- package/dist/kernel/components/blocks/theme-toggle.js +48 -2
- package/dist/kernel/components/blocks/toc.js +3 -3
- package/dist/kernel/components/mdx/components/blockquote.js +1 -1
- package/dist/kernel/components/mdx/components/callout.d.ts +5 -7
- package/dist/kernel/components/mdx/components/callout.js +66 -35
- package/dist/kernel/components/mdx/components/code-block.d.ts +5 -2
- package/dist/kernel/components/mdx/components/code-block.js +106 -5
- package/dist/kernel/components/mdx/components/copy-code-button.d.ts +8 -0
- package/dist/kernel/components/mdx/components/copy-code-button.js +60 -0
- package/dist/kernel/components/mdx/components/figure-caption.js +1 -1
- package/dist/kernel/components/mdx/components/figure.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.js +3 -3
- package/dist/kernel/components/mdx/components/image-zoom.d.ts +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +1 -1
- package/dist/kernel/components/mdx/components/image.js +77 -56
- package/dist/kernel/components/mdx/components/inline-code.js +1 -1
- package/dist/kernel/components/mdx/components/kbd.d.ts +2 -2
- package/dist/kernel/components/mdx/components/kbd.js +3 -2
- package/dist/kernel/components/mdx/components/link.d.ts +35 -4
- package/dist/kernel/components/mdx/components/link.js +1 -1
- package/dist/kernel/components/mdx/components/paragraph.js +1 -4
- package/dist/kernel/components/mdx/components/task-list.js +1 -1
- package/dist/kernel/components/mdx/components/video-player.js +2 -2
- package/dist/kernel/components/mdx/components/video.js +1 -1
- package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +12 -8
- package/dist/kernel/components/mdx/mdx.js +115 -39
- package/dist/kernel/components/mdx/rehype-heading-ids.js +1 -1
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +6 -23
- package/dist/kernel/components/ui/breadcrumb.d.ts +11 -3
- package/dist/kernel/components/ui/breadcrumb.js +6 -4
- package/dist/kernel/components/ui/button-group.d.ts +1 -1
- package/dist/kernel/components/ui/button-group.js +5 -4
- package/dist/kernel/components/ui/button.d.ts +2 -2
- package/dist/kernel/components/ui/button.js +6 -6
- package/dist/kernel/components/ui/card.d.ts +2 -2
- package/dist/kernel/components/ui/drawer.d.ts +3 -1
- package/dist/kernel/components/ui/drawer.js +5 -1
- package/dist/kernel/components/ui/input.d.ts +4 -4
- package/dist/kernel/components/ui/kbd.d.ts +1 -1
- package/dist/kernel/components/ui/kbd.js +9 -16
- package/dist/kernel/components/ui/link.d.ts +5 -3
- package/dist/kernel/components/ui/link.js +10 -9
- package/dist/kernel/components/ui/menu.js +5 -5
- package/dist/kernel/components/ui/mod-key.d.ts +10 -0
- package/dist/kernel/components/ui/mod-key.js +36 -0
- package/dist/kernel/components/ui/navigation-menu.js +2 -2
- package/dist/kernel/components/ui/progress.js +1 -1
- package/dist/kernel/components/ui/scroll-area.d.ts +8 -8
- package/dist/kernel/components/ui/scroll-area.js +4 -4
- package/dist/kernel/components/ui/select.js +7 -10
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/theme-toggle.d.ts +3 -3
- package/dist/kernel/components/ui/theme-toggle.js +4 -9
- package/dist/kernel/defaults.registry.d.ts +9 -9
- package/dist/kernel/defaults.registry.js +9 -9
- package/dist/kernel/routes/agent/markdown.d.ts +0 -1
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/metadata/feed.d.ts +1 -1
- package/dist/kernel/routes/metadata/feed.js +13 -9
- package/dist/kernel/routes/metadata/llms.d.ts +2 -1
- package/dist/kernel/routes/metadata/llms.js +4 -4
- package/dist/kernel/routes/metadata/robots.d.ts +1 -1
- package/dist/kernel/routes/metadata/robots.js +2 -2
- package/dist/kernel/routes/metadata/sitemap.d.ts +6 -3
- package/dist/kernel/routes/metadata/sitemap.js +48 -20
- package/dist/kernel/routes/pages/group.d.ts +1 -1
- package/dist/kernel/routes/pages/group.js +20 -12
- package/dist/kernel/routes/pages/leaf.d.ts +2 -2
- package/dist/kernel/routes/pages/leaf.js +20 -12
- package/dist/kernel/routes/pages/root.d.ts +2 -2
- package/dist/kernel/routes/pages/root.js +18 -12
- package/dist/resolvers/manifest-resolver.js +29 -6
- package/dist/search.d.ts +6 -7
- package/dist/search.js +47 -22
- package/dist/{sidebar-types-Bgchdfd6.d.ts → sidebar-types-DKpR27II.d.ts} +1 -1
- package/dist/{types-CIwwieNw.d.ts → types-BzkZty3r.d.ts} +23 -3
- package/dist/{types-DHBm7-j6.d.ts → types-CJWRG05y.d.ts} +20 -1
- package/dist/{types-B_b3C0U6.d.ts → types-CUtrppxt.d.ts} +8 -2
- package/dist/types.d.ts +14 -6
- package/dist/validate-local-source-XRL2Y7XE.js +14 -0
- package/dist/validate-publish-os-source-DAPZ4QGE.js +12 -0
- package/init/seed/minimal/.gitignore +1 -0
- package/init/seed/minimal/publish.os/assets/favicon/favicon.dark.png +0 -0
- package/init/seed/minimal/publish.os/assets/favicon/favicon.png +0 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +6 -10
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +1 -1
- package/init/seed/minimal/publish.os/docs/content/{theme.mdx → themes.mdx} +14 -12
- package/init/seed/minimal/publish.os/publish.os.config.json +3 -7
- package/init/seed/minimal/publish.os/theme.css +52 -24
- package/init/seed/minimal/publish.os/tsconfig.json +3 -0
- package/init/seed/minimal/seed.json +4 -1
- package/init/seed/scratch/publish.os/docs/content/get-started.mdx +6 -0
- package/init/seed/scratch/publish.os/publish.os.config.json +4 -0
- package/init/seed/scratch/seed.json +5 -0
- package/package.json +12 -26
- package/release/app/phosphor/package.json +3 -3
- package/release/app/phosphor/pnpm-lock.yaml.template +523 -360
- package/release/app/phosphor/pnpm-workspace.yaml +3 -0
- package/release/compiler/package.json +1 -1
- package/release/compiler/pnpm-lock.yaml.template +439 -286
- package/release/compiler/pnpm-workspace.yaml +3 -0
- package/release/release.json +7 -36
- package/compiler-assets/nextjs/defaults/group/leaf.tsx +0 -48
- package/dist/icons.d.ts +0 -1
- package/dist/icons.js +0 -2
- package/dist/kernel/components/mdx/components/pre.d.ts +0 -6
- package/dist/kernel/components/mdx/components/pre.js +0 -18
- package/dist/kernel/components/ui/meta-key.d.ts +0 -17
- package/dist/kernel/components/ui/meta-key.js +0 -9
- package/dist/kernel/framework-icons.d.ts +0 -1
- package/dist/kernel/framework-icons.js +0 -39
- package/dist/link-CYaCRDb6.d.ts +0 -35
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +0 -58
- package/dist/types-sM2g9nW0.d.ts +0 -12
- package/release/app/lucide/package.json +0 -30
- package/release/app/lucide/pnpm-lock.yaml.template +0 -2905
- package/release/app/lucide/pnpm-workspace.yaml +0 -11
- package/release/app/tabler/package.json +0 -30
- package/release/app/tabler/pnpm-lock.yaml.template +0 -2911
- package/release/app/tabler/pnpm-workspace.yaml +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { S as SidebarNodePrimitiveProps } from '../../../sidebar-types-
|
|
2
|
+
import { S as SidebarNodePrimitiveProps } from '../../../sidebar-types-DKpR27II.js';
|
|
3
3
|
import 'react';
|
|
4
|
-
import '../../../types-
|
|
4
|
+
import '../../../types-CJWRG05y.js';
|
|
5
5
|
|
|
6
6
|
declare function SidebarNode({ activeState, activeItemRef, children, contentId, depth, expanded, href, isExpandable, node, onLinkClick, onToggle, parentExpanded, title, }: SidebarNodePrimitiveProps): react_jsx_runtime.JSX.Element | null;
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// src/components/block/
|
|
2
|
-
import {
|
|
1
|
+
// src/components/block/sidebar/sidebar-node.tsx
|
|
2
|
+
import { CaretRightIcon } from "@phosphor-icons/react/ssr";
|
|
3
3
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import NextLink from "next/link";
|
|
@@ -42,12 +42,12 @@ var SIDEBAR_NODE_VARIANT = "base", depthClassByDepth = {
|
|
|
42
42
|
variant: {
|
|
43
43
|
base: [
|
|
44
44
|
"font-normal text-foreground-2 hover:bg-surface-hover hover:text-foreground-1",
|
|
45
|
-
"data-[state=child-path-active]:bg-surface-
|
|
46
|
-
"data-[state=path-active]:bg-surface-active data-[state=path-active]:font-medium data-[state=path-active]:text-foreground-1
|
|
45
|
+
"data-[state=child-path-active]:bg-surface-active data-[state=child-path-active]:text-foreground-1",
|
|
46
|
+
"data-[state=path-active]:bg-surface-active data-[state=path-active]:font-medium data-[state=path-active]:text-foreground-1"
|
|
47
47
|
].join(" "),
|
|
48
48
|
minimal: [
|
|
49
49
|
"font-normal text-foreground-2 hover:text-foreground-1 hover:opacity-90",
|
|
50
|
-
"data-[state=child-path-active]:
|
|
50
|
+
"data-[state=child-path-active]:text-foreground-1",
|
|
51
51
|
"data-[state=path-active]:font-semibold data-[state=path-active]:text-foreground-1 data-[state=path-active]:[text-shadow:0_0_0_currentColor]"
|
|
52
52
|
].join(" ")
|
|
53
53
|
}
|
|
@@ -78,10 +78,10 @@ function Caret({ active, expanded }) {
|
|
|
78
78
|
"span",
|
|
79
79
|
{
|
|
80
80
|
className: cn(
|
|
81
|
-
"block transition-transform duration-300 ease-
|
|
81
|
+
"block transition-transform duration-300 ease-in-out",
|
|
82
82
|
expanded ? "rotate-90" : "rotate-0"
|
|
83
83
|
),
|
|
84
|
-
children: /* @__PURE__ */ jsx(
|
|
84
|
+
children: /* @__PURE__ */ jsx(CaretRightIcon, { "aria-hidden": "true", size: 13 })
|
|
85
85
|
}
|
|
86
86
|
)
|
|
87
87
|
}
|
|
@@ -112,7 +112,7 @@ function RowInner({
|
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
114
|
function RowText({ title }) {
|
|
115
|
-
return /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 whitespace-normal break-
|
|
115
|
+
return /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 whitespace-normal wrap-break-word text-pretty", children: title });
|
|
116
116
|
}
|
|
117
117
|
function ExternalLinkIndicator() {
|
|
118
118
|
return /* @__PURE__ */ jsx(
|
|
@@ -128,6 +128,7 @@ function SidebarLink({
|
|
|
128
128
|
active,
|
|
129
129
|
children,
|
|
130
130
|
className,
|
|
131
|
+
external = !1,
|
|
131
132
|
href,
|
|
132
133
|
onClick,
|
|
133
134
|
parentExpanded,
|
|
@@ -143,7 +144,7 @@ function SidebarLink({
|
|
|
143
144
|
tabIndex: parentExpanded ? void 0 : -1,
|
|
144
145
|
...props
|
|
145
146
|
};
|
|
146
|
-
return isExternalHref(href) ? /* @__PURE__ */ jsx("a", { href, rel: mergeRel(void 0), target: "_blank", ...commonProps, children }) : /* @__PURE__ */ jsx(NextLink, { href, ...commonProps, children });
|
|
147
|
+
return external && isExternalHref(href) ? /* @__PURE__ */ jsx("a", { href, rel: mergeRel(void 0), target: "_blank", ...commonProps, children }) : /* @__PURE__ */ jsx(NextLink, { href, ...commonProps, children });
|
|
147
148
|
}
|
|
148
149
|
function SidebarNode({
|
|
149
150
|
activeState,
|
|
@@ -206,6 +207,7 @@ function SidebarNode({
|
|
|
206
207
|
active: isActive,
|
|
207
208
|
"aria-controls": isExpandable ? contentId : void 0,
|
|
208
209
|
"aria-expanded": isExpandable ? expanded : void 0,
|
|
210
|
+
external: isExternalLinkNode,
|
|
209
211
|
href,
|
|
210
212
|
onClick: onLinkClick,
|
|
211
213
|
parentExpanded,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { a as SidebarTreeNode } from '../../../sidebar-types-
|
|
4
|
-
export { b as SidebarActiveState, c as SidebarDepth, S as SidebarNodePrimitiveProps } from '../../../sidebar-types-
|
|
5
|
-
import '../../../types-
|
|
3
|
+
import { a as SidebarTreeNode } from '../../../sidebar-types-DKpR27II.js';
|
|
4
|
+
export { b as SidebarActiveState, c as SidebarDepth, S as SidebarNodePrimitiveProps } from '../../../sidebar-types-DKpR27II.js';
|
|
5
|
+
import '../../../types-CJWRG05y.js';
|
|
6
6
|
|
|
7
7
|
type SidebarProps = {
|
|
8
8
|
className?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/components/block/
|
|
3
|
+
// src/components/block/sidebar/sidebar.tsx
|
|
4
4
|
import { SidebarNode } from "@publish.os/nextjs/kernel/components/blocks/sidebar-node";
|
|
5
5
|
import { ScrollArea } from "@publish.os/nextjs/kernel/components/ui/scroll-area";
|
|
6
6
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
@@ -25,9 +25,13 @@ function isExternalHref(href) {
|
|
|
25
25
|
return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
|
|
26
26
|
}
|
|
27
27
|
function nodeHref(node) {
|
|
28
|
-
if (node.type === "link") return node.href;
|
|
28
|
+
if (node.type === "link" || "href" in node && typeof node.href == "string") return node.href;
|
|
29
29
|
if ("path" in node && typeof node.path == "string") return node.path;
|
|
30
30
|
}
|
|
31
|
+
function nodePath(node) {
|
|
32
|
+
if (node.type !== "link" && "path" in node && typeof node.path == "string")
|
|
33
|
+
return node.path;
|
|
34
|
+
}
|
|
31
35
|
function nodeChildren(node) {
|
|
32
36
|
return Array.isArray(node.children) ? node.children : [];
|
|
33
37
|
}
|
|
@@ -49,7 +53,7 @@ function createActiveIndex({
|
|
|
49
53
|
}) {
|
|
50
54
|
let activeIndex = /* @__PURE__ */ new Map();
|
|
51
55
|
function visit(node) {
|
|
52
|
-
let
|
|
56
|
+
let path = nodePath(node), exactActive = isExactActivePath(path, currentPath), pathActive = node.type === "page" && isActivePath(path, currentPath), childActive = nodeChildren(node).some(visit), activeState = exactActive ? "path-active" : childActive || pathActive ? "child-path-active" : void 0;
|
|
53
57
|
return activeIndex.set(node, {
|
|
54
58
|
activeState,
|
|
55
59
|
initiallyExpanded: exactActive || pathActive || childActive
|
|
@@ -90,7 +94,7 @@ function ExpandableChildren({
|
|
|
90
94
|
{
|
|
91
95
|
"aria-hidden": !expanded,
|
|
92
96
|
className: cn(
|
|
93
|
-
"grid overflow-hidden transition-[grid-template-rows] duration-300 ease-
|
|
97
|
+
"grid overflow-hidden transition-[grid-template-rows] duration-300 ease-in-out",
|
|
94
98
|
expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
95
99
|
),
|
|
96
100
|
"data-state": expanded ? "open" : "closed",
|
|
@@ -179,18 +183,20 @@ var SidebarTreeItem = memo(function SidebarTreeItem2({
|
|
|
179
183
|
);
|
|
180
184
|
});
|
|
181
185
|
function Sidebar({ className, currentPath, title, tree }) {
|
|
182
|
-
let resolvedCurrentPath = usePathname() ?? currentPath ?? "", instanceId = useId(), activeItemRef = useRef(null), activeIndex = useMemo(
|
|
186
|
+
let resolvedCurrentPath = usePathname() ?? currentPath ?? "", instanceId = useId(), activeItemRef = useRef(null), viewportRef = useRef(null), activeIndex = useMemo(
|
|
183
187
|
() => createActiveIndex({ currentPath: resolvedCurrentPath, tree }),
|
|
184
188
|
[resolvedCurrentPath, tree]
|
|
185
189
|
);
|
|
186
190
|
return useEffect(() => {
|
|
187
|
-
let
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
let viewport = viewportRef.current, win = viewport?.ownerDocument.defaultView;
|
|
192
|
+
if (!resolvedCurrentPath || !viewport || !win) return;
|
|
193
|
+
let frame = win.requestAnimationFrame(() => {
|
|
194
|
+
let item = activeItemRef.current;
|
|
195
|
+
if (!item) return;
|
|
196
|
+
let itemBounds = item.getBoundingClientRect(), viewportBounds = viewport.getBoundingClientRect();
|
|
197
|
+
itemBounds.top < viewportBounds.top ? viewport.scrollTop += itemBounds.top - viewportBounds.top : itemBounds.bottom > viewportBounds.bottom && (viewport.scrollTop += itemBounds.bottom - viewportBounds.bottom);
|
|
192
198
|
});
|
|
193
|
-
return () =>
|
|
199
|
+
return () => win.cancelAnimationFrame(frame);
|
|
194
200
|
}, [resolvedCurrentPath]), /* @__PURE__ */ jsxs(
|
|
195
201
|
"nav",
|
|
196
202
|
{
|
|
@@ -209,6 +215,7 @@ function Sidebar({ className, currentPath, title, tree }) {
|
|
|
209
215
|
mask: { height: 24 },
|
|
210
216
|
scrollbarClassName: "opacity-0 transition-opacity data-[hovering]:opacity-100 data-[scrolling]:opacity-100",
|
|
211
217
|
variant: "gradient",
|
|
218
|
+
viewportRef,
|
|
212
219
|
children: /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-px px-2 py-3", children: tree.map((node) => /* @__PURE__ */ jsx(
|
|
213
220
|
SidebarTreeItem,
|
|
214
221
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { B as ButtonProps } from '../../../button-c3WGnxIj.js';
|
|
3
3
|
import 'class-variance-authority/types';
|
|
4
4
|
import 'class-variance-authority';
|
|
5
5
|
import 'react';
|
|
@@ -7,4 +7,4 @@ import 'react';
|
|
|
7
7
|
type ThemeToggleProps = Omit<ButtonProps, "children" | "iconOnly" | "leftIcon" | "loading" | "rightIcon">;
|
|
8
8
|
declare function ThemeToggle({ className, onClick, size, title, type, variant, ...props }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
9
9
|
|
|
10
|
-
export { ThemeToggle };
|
|
10
|
+
export { ThemeToggle, type ThemeToggleProps };
|
|
@@ -1,7 +1,53 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/components/
|
|
4
|
-
import {
|
|
3
|
+
// src/components/ui/theme-toggle.tsx
|
|
4
|
+
import { Button } from "@publish.os/nextjs/kernel/components/ui/button";
|
|
5
|
+
import { MonitorIcon, MoonIcon, SunIcon } from "@phosphor-icons/react/ssr";
|
|
6
|
+
import { useTheme } from "next-themes";
|
|
7
|
+
import { useEffect, useMemo, useState } from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var themeOrder = ["system", "light", "dark"];
|
|
10
|
+
function ThemeIcon({ theme }) {
|
|
11
|
+
return theme === "light" ? /* @__PURE__ */ jsx(SunIcon, { "aria-hidden": "true", size: 16 }) : theme === "dark" ? /* @__PURE__ */ jsx(MoonIcon, { "aria-hidden": "true", size: 16 }) : /* @__PURE__ */ jsx(MonitorIcon, { "aria-hidden": "true", size: 16 });
|
|
12
|
+
}
|
|
13
|
+
function normalizeTheme(theme) {
|
|
14
|
+
return theme === "light" || theme === "dark" ? theme : "system";
|
|
15
|
+
}
|
|
16
|
+
function ThemeToggle({
|
|
17
|
+
className,
|
|
18
|
+
onClick,
|
|
19
|
+
size = "sm",
|
|
20
|
+
title,
|
|
21
|
+
type = "button",
|
|
22
|
+
variant = "ghost",
|
|
23
|
+
...props
|
|
24
|
+
}) {
|
|
25
|
+
let { theme, setTheme } = useTheme(), [mounted, setMounted] = useState(!1), activeTheme = normalizeTheme(theme), nextTheme = useMemo(() => {
|
|
26
|
+
let index = themeOrder.indexOf(activeTheme);
|
|
27
|
+
return themeOrder[(index + 1) % themeOrder.length] ?? "system";
|
|
28
|
+
}, [activeTheme]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setMounted(!0);
|
|
31
|
+
}, []);
|
|
32
|
+
let label = mounted ? `Switch to ${nextTheme} theme` : "Theme preference";
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
Button,
|
|
35
|
+
{
|
|
36
|
+
"aria-label": props["aria-label"] ?? label,
|
|
37
|
+
className,
|
|
38
|
+
iconOnly: !0,
|
|
39
|
+
onClick: (event) => {
|
|
40
|
+
onClick?.(event), event.defaultPrevented || setTheme(nextTheme);
|
|
41
|
+
},
|
|
42
|
+
size,
|
|
43
|
+
title: title ?? label,
|
|
44
|
+
type,
|
|
45
|
+
variant,
|
|
46
|
+
...props,
|
|
47
|
+
children: /* @__PURE__ */ jsx(ThemeIcon, { theme: mounted ? activeTheme : "system" })
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
5
51
|
export {
|
|
6
52
|
ThemeToggle
|
|
7
53
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/components/block/
|
|
3
|
+
// src/components/block/toc/toc.tsx
|
|
4
4
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
5
5
|
import {
|
|
6
6
|
extractMdxHeadings
|
|
@@ -135,7 +135,7 @@ function Toc({ className, content, levels = DEFAULT_LEVELS }) {
|
|
|
135
135
|
"div",
|
|
136
136
|
{
|
|
137
137
|
ref: viewportRef,
|
|
138
|
-
className: "max-h-[calc(
|
|
138
|
+
className: "max-h-[calc(100dvh-var(--layout-global-nav-height)-3rem)] overflow-y-auto pr-2 scrollbar-gutter-stable supports-[top:anchor-size(--global-navbar_height)]:max-h-[calc(100dvh-anchor-size(--global-navbar_height,3.5rem)-3rem)]",
|
|
139
139
|
onScroll: updateViewport,
|
|
140
140
|
style: {
|
|
141
141
|
WebkitMaskImage: maskImage,
|
|
@@ -177,7 +177,7 @@ function Toc({ className, content, levels = DEFAULT_LEVELS }) {
|
|
|
177
177
|
"data-toc-link": "",
|
|
178
178
|
href: `#${heading.id}`,
|
|
179
179
|
onClick: () => handleTocClick(heading.id),
|
|
180
|
-
children: /* @__PURE__ */ jsx("span", { className: "block min-w-0 text-wrap break-
|
|
180
|
+
children: /* @__PURE__ */ jsx("span", { className: "block min-w-0 text-wrap wrap-break-word", children: heading.text })
|
|
181
181
|
}
|
|
182
182
|
)
|
|
183
183
|
},
|
|
@@ -6,7 +6,7 @@ function Blockquote({ className, ...props }) {
|
|
|
6
6
|
"blockquote",
|
|
7
7
|
{
|
|
8
8
|
className: cn(
|
|
9
|
-
"my-6 border-l-2 border-typography-quote-stroke pl-4 text-
|
|
9
|
+
"my-6 border-l-2 border-typography-quote-stroke pl-4 text-typography-quote-foreground",
|
|
10
10
|
className
|
|
11
11
|
),
|
|
12
12
|
...props
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
4
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
declare const calloutVariants: (props?: ({
|
|
7
|
-
color?: "
|
|
8
|
-
variant?: "
|
|
7
|
+
color?: "neutral" | "info" | "warning" | "danger" | "success" | null | undefined;
|
|
8
|
+
variant?: "solid" | "soft" | "outline" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
-
type CalloutProps = VariantProps<typeof calloutVariants> & {
|
|
11
|
-
children?: ReactNode;
|
|
12
|
-
className?: string;
|
|
10
|
+
type CalloutProps = Omit<ComponentPropsWithoutRef<"aside">, "color" | "title" | "role" | "style"> & VariantProps<typeof calloutVariants> & {
|
|
13
11
|
icon?: ReactNode;
|
|
14
12
|
title?: ReactNode;
|
|
15
13
|
};
|
|
16
|
-
declare function Callout({ children, className, color, icon, title, variant, }: CalloutProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
declare function Callout({ children, className, color, icon, title, variant, ...props }: CalloutProps): react_jsx_runtime.JSX.Element;
|
|
17
15
|
|
|
18
16
|
export { Callout, type CalloutProps, calloutVariants };
|
|
@@ -1,29 +1,55 @@
|
|
|
1
1
|
// src/components/mdx/callout.tsx
|
|
2
2
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
|
+
import { useId } from "react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
var calloutVariants = cva(
|
|
6
|
-
"my-6
|
|
7
|
+
"not-markdown-prose my-6 grid min-w-0 items-start gap-2.5 rounded-callout p-3 [&_[data-slot=callout-icon]_svg]:size-[1.125em]",
|
|
7
8
|
{
|
|
8
9
|
variants: {
|
|
9
10
|
color: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
success: "
|
|
15
|
-
warning: "[--callout-emphasis-foreground:var(--warning-1100)] [--callout-foreground:var(--warning-1100)] [--callout-solid-foreground:var(--warning-100)] [--callout-solid-surface:var(--warning-900)] [--callout-stroke:var(--warning-600)] [--callout-surface:var(--warning-200)]"
|
|
11
|
+
neutral: "text-foreground-2 selection:bg-surface-4 selection:text-foreground-1",
|
|
12
|
+
info: "text-info-1200 selection:bg-info-400 selection:text-info-1200",
|
|
13
|
+
warning: "text-warning-1200 selection:bg-warning-400 selection:text-warning-1200",
|
|
14
|
+
danger: "text-danger-1200 selection:bg-danger-400 selection:text-danger-1200",
|
|
15
|
+
success: "text-success-1200 selection:bg-success-400 selection:text-success-1200"
|
|
16
16
|
},
|
|
17
17
|
variant: {
|
|
18
|
-
|
|
19
|
-
soft: "border-
|
|
20
|
-
|
|
18
|
+
solid: "border-0 border-shadow-3",
|
|
19
|
+
soft: "border-0 shadow-none",
|
|
20
|
+
outline: "border bg-transparent shadow-none"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
-
|
|
24
|
-
color: "
|
|
25
|
-
variant: "
|
|
26
|
-
|
|
23
|
+
compoundVariants: [
|
|
24
|
+
{ color: "neutral", variant: "solid", className: "bg-surface-3" },
|
|
25
|
+
{ color: "info", variant: "solid", className: "bg-info-300" },
|
|
26
|
+
{ color: "warning", variant: "solid", className: "bg-warning-300" },
|
|
27
|
+
{ color: "danger", variant: "solid", className: "bg-danger-300" },
|
|
28
|
+
{ color: "success", variant: "solid", className: "bg-success-300" },
|
|
29
|
+
{ color: "neutral", variant: "soft", className: "bg-surface-3/50" },
|
|
30
|
+
{ color: "info", variant: "soft", className: "bg-info-300/50" },
|
|
31
|
+
{ color: "warning", variant: "soft", className: "bg-warning-300/50" },
|
|
32
|
+
{ color: "danger", variant: "soft", className: "bg-danger-300/50" },
|
|
33
|
+
{ color: "success", variant: "soft", className: "bg-success-300/50" },
|
|
34
|
+
{ color: "neutral", variant: "outline", className: "border-stroke-3" },
|
|
35
|
+
{ color: "info", variant: "outline", className: "border-info-1100/25" },
|
|
36
|
+
{
|
|
37
|
+
color: "warning",
|
|
38
|
+
variant: "outline",
|
|
39
|
+
className: "border-warning-1100/25"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
color: "danger",
|
|
43
|
+
variant: "outline",
|
|
44
|
+
className: "border-danger-1100/25"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
color: "success",
|
|
48
|
+
variant: "outline",
|
|
49
|
+
className: "border-success-1100/25"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
defaultVariants: { color: "neutral", variant: "solid" }
|
|
27
53
|
}
|
|
28
54
|
);
|
|
29
55
|
function Callout({
|
|
@@ -32,42 +58,47 @@ function Callout({
|
|
|
32
58
|
color,
|
|
33
59
|
icon,
|
|
34
60
|
title,
|
|
35
|
-
variant
|
|
61
|
+
variant,
|
|
62
|
+
...props
|
|
36
63
|
}) {
|
|
37
|
-
let
|
|
38
|
-
return /* @__PURE__ */
|
|
64
|
+
let titleId = useId(), hasTitle = title != null && title !== !1;
|
|
65
|
+
return /* @__PURE__ */ jsxs(
|
|
39
66
|
"aside",
|
|
40
67
|
{
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
className: cn(
|
|
44
|
-
|
|
45
|
-
|
|
68
|
+
...props,
|
|
69
|
+
"aria-labelledby": hasTitle ? titleId : props["aria-labelledby"],
|
|
70
|
+
className: cn(
|
|
71
|
+
calloutVariants({ color, variant }),
|
|
72
|
+
icon ? "grid-cols-[auto_minmax(0,1fr)]" : "grid-cols-1",
|
|
73
|
+
className
|
|
74
|
+
),
|
|
75
|
+
"data-color": color ?? "neutral",
|
|
76
|
+
"data-slot": "callout",
|
|
77
|
+
"data-variant": variant ?? "solid",
|
|
78
|
+
role: "note",
|
|
79
|
+
children: [
|
|
80
|
+
icon ? /* @__PURE__ */ jsx(
|
|
46
81
|
"span",
|
|
47
82
|
{
|
|
48
83
|
"aria-hidden": "true",
|
|
49
|
-
className:
|
|
50
|
-
|
|
51
|
-
resolvedVariant === "solid" ? "text-inherit" : "text-[var(--callout-emphasis-foreground)]",
|
|
52
|
-
"[&_svg]:size-4 [&_svg]:shrink-0"
|
|
53
|
-
),
|
|
84
|
+
className: "flex h-lh shrink-0 items-center justify-center [&_svg]:shrink-0",
|
|
85
|
+
"data-slot": "callout-icon",
|
|
54
86
|
children: icon
|
|
55
87
|
}
|
|
56
88
|
) : null,
|
|
57
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
89
|
+
/* @__PURE__ */ jsxs("div", { className: "grid min-w-0 gap-1", "data-slot": "callout-body", children: [
|
|
58
90
|
hasTitle ? /* @__PURE__ */ jsx(
|
|
59
|
-
"
|
|
91
|
+
"div",
|
|
60
92
|
{
|
|
61
|
-
className:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
),
|
|
93
|
+
className: "min-w-0 wrap-break-word font-semibold text-pretty",
|
|
94
|
+
"data-slot": "callout-title",
|
|
95
|
+
id: titleId,
|
|
65
96
|
children: title
|
|
66
97
|
}
|
|
67
98
|
) : null,
|
|
68
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
99
|
+
children != null ? /* @__PURE__ */ jsx("div", { className: "min-w-0 wrap-break-word", "data-slot": "callout-content", children }) : null
|
|
69
100
|
] })
|
|
70
|
-
]
|
|
101
|
+
]
|
|
71
102
|
}
|
|
72
103
|
);
|
|
73
104
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { BundledTheme } from 'shiki';
|
|
2
3
|
|
|
3
|
-
type CodeBlockProps = React.ComponentPropsWithoutRef<"
|
|
4
|
+
type CodeBlockProps = Omit<React.ComponentPropsWithoutRef<"div">, "style"> & {
|
|
4
5
|
code?: string;
|
|
5
6
|
language?: string;
|
|
7
|
+
lightTheme?: BundledTheme;
|
|
8
|
+
darkTheme?: BundledTheme;
|
|
6
9
|
};
|
|
7
|
-
declare function CodeBlock({ children, code, language, ...props }: CodeBlockProps): react_jsx_runtime.JSX.Element
|
|
10
|
+
declare function CodeBlock({ children, className, code, language, lightTheme, darkTheme, title, ...props }: CodeBlockProps): Promise<react_jsx_runtime.JSX.Element>;
|
|
8
11
|
|
|
9
12
|
export { CodeBlock, type CodeBlockProps };
|
|
@@ -1,13 +1,114 @@
|
|
|
1
|
-
// src/components/mdx/code-block.tsx
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
// src/components/mdx/code-block/code-block.tsx
|
|
2
|
+
import { CopyCodeButton } from "@publish.os/nextjs/kernel/components/mdx/components/copy-code-button";
|
|
3
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
4
|
+
import { isValidElement } from "react";
|
|
5
|
+
import {
|
|
6
|
+
bundledLanguages,
|
|
7
|
+
codeToHtml
|
|
8
|
+
} from "shiki";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var copyButtonRadius = "rounded-[max(calc(var(--radius-codeblock)-0.5rem),0px)]";
|
|
11
|
+
function codeChild(children) {
|
|
12
|
+
if (!isValidElement(children))
|
|
13
|
+
return { code: typeof children == "string" ? children : "" };
|
|
14
|
+
let { className, title } = children.props, language = /(?:^|\s)language-([^\s]+)/.exec(className ?? "")?.[1], value = children.props.children;
|
|
15
|
+
return { code: typeof value == "string" ? value : "", language, title };
|
|
16
|
+
}
|
|
17
|
+
function breakableTitle(title) {
|
|
18
|
+
let parts = [], start = 0;
|
|
19
|
+
for (let separator of title.matchAll(/[/\\]/g)) {
|
|
20
|
+
let end = separator.index + 1;
|
|
21
|
+
parts.push(title.slice(start, end), /* @__PURE__ */ jsx("wbr", {}, end)), start = end;
|
|
22
|
+
}
|
|
23
|
+
return parts.push(title.slice(start)), parts;
|
|
24
|
+
}
|
|
25
|
+
function isCssDeclarationFragment(code) {
|
|
26
|
+
let source = code.replace(/^(?:\s|\/\*[\s\S]*?\*\/)*\s*/, "");
|
|
27
|
+
if (!/^(?:--[\w-]+|[a-zA-Z-]+)\s*:/.test(source)) return !1;
|
|
28
|
+
let firstBlock = source.indexOf("{"), firstDeclarationEnd = source.indexOf(";");
|
|
29
|
+
return firstBlock === -1 || firstDeclarationEnd !== -1 && firstDeclarationEnd < firstBlock;
|
|
30
|
+
}
|
|
31
|
+
async function CodeBlock({
|
|
5
32
|
children,
|
|
33
|
+
className,
|
|
6
34
|
code,
|
|
7
35
|
language,
|
|
36
|
+
lightTheme = "github-light",
|
|
37
|
+
darkTheme = "github-dark",
|
|
38
|
+
title,
|
|
8
39
|
...props
|
|
9
40
|
}) {
|
|
10
|
-
|
|
41
|
+
let child = codeChild(children), displayedCode = code ?? child.code, displayLanguage = language ?? child.language, displayTitle = title ?? child.title, token = displayLanguage?.toLowerCase() ?? "txt", highlightedLanguage = Object.hasOwn(bundledLanguages, token) ? token : "txt", html = await codeToHtml(displayedCode.replace(/\r?\n$/, ""), {
|
|
42
|
+
lang: highlightedLanguage,
|
|
43
|
+
themes: { light: lightTheme, dark: darkTheme },
|
|
44
|
+
defaultColor: !1,
|
|
45
|
+
transformers: highlightedLanguage === "css" && isCssDeclarationFragment(displayedCode) ? [
|
|
46
|
+
{
|
|
47
|
+
preprocess(source) {
|
|
48
|
+
return `:root {
|
|
49
|
+
${source}
|
|
50
|
+
}`;
|
|
51
|
+
},
|
|
52
|
+
tokens(lines) {
|
|
53
|
+
return lines.slice(1, -1);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
] : []
|
|
57
|
+
});
|
|
58
|
+
return /* @__PURE__ */ jsxs(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: cn(
|
|
62
|
+
"not-markdown-prose relative my-6 min-w-0 overflow-hidden rounded-codeblock border border-typography-pre-stroke bg-typography-pre-surface text-typography-pre-foreground",
|
|
63
|
+
className
|
|
64
|
+
),
|
|
65
|
+
"data-slot": "code-block",
|
|
66
|
+
...props,
|
|
67
|
+
children: [
|
|
68
|
+
displayTitle ? /* @__PURE__ */ jsxs(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
className: "flex min-h-11 min-w-0 items-center gap-3 border-b border-typography-pre-stroke bg-surface-2 py-2 ps-4 pe-2",
|
|
72
|
+
"data-slot": "code-block-header",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
"span",
|
|
76
|
+
{
|
|
77
|
+
className: "min-w-0 flex-1 [overflow-wrap:anywhere] text-sm font-medium leading-5 text-foreground-2",
|
|
78
|
+
dir: "auto",
|
|
79
|
+
children: breakableTitle(displayTitle)
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ jsx(CopyCodeButton, { className: copyButtonRadius, code: displayedCode })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
) : null,
|
|
86
|
+
/* @__PURE__ */ jsxs(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
className: cn(
|
|
90
|
+
"flex min-w-0 items-start gap-2 py-2 ps-4 pe-2",
|
|
91
|
+
displayTitle && "py-3 pe-4"
|
|
92
|
+
),
|
|
93
|
+
"data-slot": "code-block-content",
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
className: cn(
|
|
99
|
+
"code-block-highlight min-w-0 flex-1 overflow-x-auto overscroll-x-contain font-mono text-sm leading-6 [&_pre]:m-0 [&_pre]:min-w-max [&_pre]:overflow-visible [&_pre]:bg-transparent! [&_pre]:p-0 [&_pre]:text-inherit [&_pre]:font-inherit [&_pre]:outline-none [&_code]:block [&_code]:font-inherit",
|
|
100
|
+
!displayTitle && "[&_pre]:py-1"
|
|
101
|
+
),
|
|
102
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
displayTitle ? null : /* @__PURE__ */ jsx(CopyCodeButton, { className: copyButtonRadius, code: displayedCode })
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
);
|
|
11
112
|
}
|
|
12
113
|
export {
|
|
13
114
|
CodeBlock
|