@publish.os/nextjs 0.0.1-alpha.81 → 0.0.1-alpha.91
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 +8 -8
- package/compiler-assets/nextjs/defaults/group/page.tsx +44 -43
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +33 -13
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -3
- package/compiler-assets/nextjs/defaults/root/css/animation.css +131 -0
- package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -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/document.tsx +38 -0
- package/compiler-assets/nextjs/shims/generated-group-page.tsx +19 -2
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +18 -2
- package/compiler-assets/nextjs/shims/global-layout.tsx +19 -85
- package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
- package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
- package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
- package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
- package/compiler-assets/nextjs/shims/proxy.ts +143 -65
- 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 +30 -0
- package/compiler-assets/nextjs/shims/site-heading-level.tsx +14 -0
- package/compiler-assets/nextjs/shims/site-mdx-components.tsx +112 -0
- package/compiler-assets/nextjs/shims/site-mdx.tsx +17 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +41 -25
- package/dist/build-operation-5QMLXF7N.js +89 -0
- package/dist/{button-CFdx-ohV.d.ts → button-BdCScEKi.d.ts} +6 -6
- package/dist/capture-local-source-WGGDIUU2.js +258 -0
- package/dist/chunk-22RSSUNV.js +13 -0
- package/dist/chunk-4BC2L2KA.js +620 -0
- package/dist/chunk-5J3YUNRY.js +121 -0
- package/dist/chunk-5KAD7W53.js +248 -0
- package/dist/chunk-6C65KV7O.js +142 -0
- package/dist/chunk-6D2E6UMD.js +695 -0
- package/dist/chunk-7NY22B5U.js +161 -0
- package/dist/chunk-AI2UULNX.js +9 -0
- package/dist/chunk-EFO6AWXN.js +19 -0
- package/dist/chunk-F3AGNDF4.js +2377 -0
- package/dist/chunk-GBPLER5H.js +426 -0
- package/dist/chunk-IL4RJOKI.js +186 -0
- package/dist/chunk-NNBJZPFM.js +193 -0
- package/dist/chunk-ORIUWJBQ.js +58 -0
- package/dist/chunk-OXOFRXEI.js +7129 -0
- package/dist/chunk-UYGCOWRF.js +1709 -0
- package/dist/chunk-WL75GQ5M.js +80 -0
- package/dist/compiler.d.ts +54 -7
- package/dist/compiler.js +121 -13147
- package/dist/components/blocks/agent-actions.d.ts +81 -0
- package/dist/components/blocks/agent-actions.js +594 -0
- package/dist/components/blocks/toc.d.ts +43 -0
- package/dist/components/blocks/toc.js +136 -0
- package/dist/components/ui/button.d.ts +5 -0
- package/dist/components/ui/button.js +94 -0
- package/dist/compose-CVBJRAF6.js +16 -0
- package/dist/config/createNextConfig.js +27 -0
- package/dist/dev-operation-OSHHWRWK.js +1095 -0
- package/dist/framework-selection-ZVO323PK.js +11 -0
- package/dist/ide-support-CU6Z5PVR.js +16 -0
- package/dist/index.d.ts +55 -4
- package/dist/jsx-dev-runtime.d.ts +6 -0
- package/dist/jsx-dev-runtime.js +100 -0
- package/dist/jsx-runtime.d.ts +7 -0
- package/dist/jsx-runtime.js +97 -0
- package/dist/kernel/components/blocks/AgentActions.d.ts +35 -6
- package/dist/kernel/components/blocks/AgentActions.js +401 -150
- package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
- package/dist/kernel/components/blocks/agent-actions.js +594 -0
- package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
- package/dist/kernel/components/blocks/color-palette.js +4 -4
- package/dist/kernel/components/blocks/logo-block.js +3 -3
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +10 -2
- package/dist/kernel/components/blocks/nav-breadcrumb.js +22 -7
- package/dist/kernel/components/blocks/navbar.d.ts +2 -2
- package/dist/kernel/components/blocks/navbar.js +406 -65
- package/dist/kernel/components/blocks/navigation-progress.js +6 -3
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +12 -24
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +7 -6
- package/dist/kernel/components/blocks/search.d.ts +83 -58
- package/dist/kernel/components/blocks/search.js +554 -428
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +12 -10
- package/dist/kernel/components/blocks/sidebar.d.ts +3 -3
- package/dist/kernel/components/blocks/sidebar.js +24 -14
- package/dist/kernel/components/blocks/theme-toggle.d.ts +2 -2
- package/dist/kernel/components/blocks/theme-toggle.js +47 -1
- package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
- package/dist/kernel/components/blocks/toc-client.js +495 -0
- package/dist/kernel/components/blocks/toc.d.ts +19 -1
- package/dist/kernel/components/blocks/toc.js +122 -180
- package/dist/kernel/components/mdx/components/blockquote.js +2 -2
- package/dist/kernel/components/mdx/components/callout.d.ts +5 -7
- package/dist/kernel/components/mdx/components/callout.js +67 -36
- 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 +61 -0
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
- package/dist/kernel/components/mdx/components/figure-caption.js +4 -3
- package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
- package/dist/kernel/components/mdx/components/figure.js +24 -14
- package/dist/kernel/components/mdx/components/footnotes.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.js +4 -4
- package/dist/kernel/components/mdx/components/heading.js +6 -3
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +2 -2
- package/dist/kernel/components/mdx/components/image.d.ts +1 -1
- package/dist/kernel/components/mdx/components/image.js +94 -68
- package/dist/kernel/components/mdx/components/inline-code.js +2 -2
- package/dist/kernel/components/mdx/components/kbd.d.ts +2 -2
- package/dist/kernel/components/mdx/components/kbd.js +5 -4
- package/dist/kernel/components/mdx/components/link.d.ts +35 -4
- package/dist/kernel/components/mdx/components/link.js +3 -3
- package/dist/kernel/components/mdx/components/paragraph.js +2 -5
- package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.js +2 -2
- package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
- package/dist/kernel/components/mdx/components/video-player.js +8 -4
- package/dist/kernel/components/mdx/components/video.d.ts +5 -3
- package/dist/kernel/components/mdx/components/video.js +8 -6
- package/dist/kernel/components/mdx/error-boundary.js +2 -2
- package/dist/kernel/components/mdx/error-fallback.js +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +28 -14
- package/dist/kernel/components/mdx/mdx.js +336 -63
- package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.js +6 -4
- package/dist/kernel/components/next-image.d.ts +12 -0
- package/dist/kernel/components/next-image.js +61 -0
- package/dist/kernel/components/ui/accordion.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +6 -23
- package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
- package/dist/kernel/components/ui/breadcrumb.d.ts +11 -3
- package/dist/kernel/components/ui/breadcrumb.js +10 -8
- package/dist/kernel/components/ui/button-group.js +8 -7
- package/dist/kernel/components/ui/button.d.ts +58 -6
- package/dist/kernel/components/ui/button.js +43 -39
- package/dist/kernel/components/ui/card.d.ts +2 -2
- package/dist/kernel/components/ui/card.js +1 -1
- package/dist/kernel/components/ui/dialog.js +1 -1
- package/dist/kernel/components/ui/drawer.d.ts +3 -1
- package/dist/kernel/components/ui/drawer.js +6 -2
- package/dist/kernel/components/ui/input.d.ts +2 -2
- package/dist/kernel/components/ui/input.js +1 -1
- package/dist/kernel/components/ui/kbd.js +10 -17
- package/dist/kernel/components/ui/link.d.ts +11 -3
- package/dist/kernel/components/ui/link.js +12 -11
- package/dist/kernel/components/ui/menu.js +6 -6
- 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 +3 -3
- package/dist/kernel/components/ui/popover.js +1 -1
- package/dist/kernel/components/ui/progress.js +2 -2
- package/dist/kernel/components/ui/scroll-area.js +5 -5
- package/dist/kernel/components/ui/select.js +8 -11
- package/dist/kernel/components/ui/separator.js +1 -1
- package/dist/kernel/components/ui/table.js +1 -1
- package/dist/kernel/components/ui/tabs.js +1 -1
- package/dist/kernel/components/ui/tag.js +1 -1
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/text.js +1 -1
- package/dist/kernel/components/ui/toast.js +1 -1
- package/dist/kernel/components/ui/tooltip.js +1 -1
- package/dist/kernel/defaults.registry.d.ts +11 -24
- package/dist/kernel/defaults.registry.js +11 -26
- package/dist/kernel/routes/agent/markdown.d.ts +3 -1
- package/dist/kernel/routes/agent/markdown.js +219 -48
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +5 -7
- package/dist/kernel/routes/metadata/feed.d.ts +1 -1
- package/dist/kernel/routes/metadata/feed.js +111 -81
- package/dist/kernel/routes/metadata/llms.d.ts +12 -3
- package/dist/kernel/routes/metadata/llms.js +156 -59
- package/dist/kernel/routes/metadata/og-image.js +1 -1
- 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 +26 -4
- package/dist/kernel/routes/metadata/sitemap.js +206 -38
- package/dist/kernel/routes/not-found.d.ts +34 -0
- package/dist/kernel/routes/not-found.js +213 -0
- package/dist/kernel/routes/pages/group.d.ts +2 -2
- package/dist/kernel/routes/pages/group.js +21 -13
- package/dist/kernel/routes/pages/leaf.d.ts +28 -1
- package/dist/kernel/routes/pages/leaf.js +25 -16
- package/dist/kernel/routes/pages/root.js +19 -13
- package/dist/keyboard-shortcuts.js +1 -1
- package/dist/resolvers/manifest-resolver.js +29 -6
- package/dist/search.d.ts +6 -7
- package/dist/search.js +52 -29
- package/dist/{sidebar-types-Bgchdfd6.d.ts → sidebar-types-DKpR27II.d.ts} +1 -1
- package/dist/theme-scope.js +1 -1
- 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-CIwwieNw.d.ts → types-J2w_puPF.d.ts} +11 -10
- package/dist/types.d.ts +15 -6
- package/dist/utils/heading-ids.js +30 -11
- package/dist/utils/toc-selection.d.ts +7 -0
- package/dist/utils/toc-selection.js +14 -0
- package/dist/validate-local-source-SV44DBQT.js +16 -0
- package/dist/validate-publish-os-source-NZJF3TB2.js +14 -0
- package/init/seed/minimal/.gitignore +1 -0
- package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
- package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
- package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
- package/init/seed/minimal/publish.os/blog/index.tsx +82 -0
- package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
- package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +6 -11
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +6 -7
- package/init/seed/minimal/publish.os/docs/content/{theme.mdx → themes.mdx} +14 -12
- package/init/seed/minimal/publish.os/publish.os.config.json +7 -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 +12 -2
- 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 +55 -44
- package/release/app/phosphor/package.json +5 -5
- package/release/app/phosphor/pnpm-lock.yaml.template +553 -377
- package/release/app/phosphor/pnpm-workspace.yaml +3 -0
- package/release/compiler/package.json +5 -3
- package/release/compiler/pnpm-lock.yaml.template +500 -303
- package/release/compiler/pnpm-workspace.yaml +3 -0
- package/release/release.json +8 -37
- 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/blocks/design-system-preview.d.ts +0 -61
- package/dist/kernel/components/blocks/design-system-preview.js +0 -648
- package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/link-playground.js +0 -744
- package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
- 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/components/ui/theme-toggle.d.ts +0 -24
- package/dist/kernel/components/ui/theme-toggle.js +0 -58
- 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/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,9 +1,9 @@
|
|
|
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";
|
|
6
|
-
import { jsx, jsxs } from "
|
|
6
|
+
import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
7
7
|
var SIDEBAR_NODE_VARIANT = "base", depthClassByDepth = {
|
|
8
8
|
0: "pl-2",
|
|
9
9
|
1: "pl-5",
|
|
@@ -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,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/components/block/
|
|
4
|
-
import { SidebarNode } from "@
|
|
5
|
-
import { ScrollArea } from "@
|
|
3
|
+
// src/components/block/sidebar/sidebar.tsx
|
|
4
|
+
import { SidebarNode } from "@components/blocks/sidebar-node";
|
|
5
|
+
import { ScrollArea } from "@components/ui/scroll-area";
|
|
6
6
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
7
7
|
import { usePathname } from "next/navigation";
|
|
8
8
|
import {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
useRef,
|
|
16
16
|
useState
|
|
17
17
|
} from "react";
|
|
18
|
-
import { jsx, jsxs } from "
|
|
18
|
+
import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
19
19
|
function normalizePath(path) {
|
|
20
20
|
if (!path) return "";
|
|
21
21
|
let [withoutQuery = ""] = path.split(/[?#]/);
|
|
@@ -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,10 @@ 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 = !1;
|
|
57
|
+
for (let child of nodeChildren(node))
|
|
58
|
+
childActive = visit(child) || childActive;
|
|
59
|
+
let activeState = exactActive ? "path-active" : childActive || pathActive ? "child-path-active" : void 0;
|
|
53
60
|
return activeIndex.set(node, {
|
|
54
61
|
activeState,
|
|
55
62
|
initiallyExpanded: exactActive || pathActive || childActive
|
|
@@ -90,7 +97,7 @@ function ExpandableChildren({
|
|
|
90
97
|
{
|
|
91
98
|
"aria-hidden": !expanded,
|
|
92
99
|
className: cn(
|
|
93
|
-
"grid overflow-hidden transition-[grid-template-rows] duration-300 ease-
|
|
100
|
+
"grid overflow-hidden transition-[grid-template-rows] duration-300 ease-in-out",
|
|
94
101
|
expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
95
102
|
),
|
|
96
103
|
"data-state": expanded ? "open" : "closed",
|
|
@@ -179,18 +186,20 @@ var SidebarTreeItem = memo(function SidebarTreeItem2({
|
|
|
179
186
|
);
|
|
180
187
|
});
|
|
181
188
|
function Sidebar({ className, currentPath, title, tree }) {
|
|
182
|
-
let resolvedCurrentPath = usePathname() ?? currentPath ?? "", instanceId = useId(), activeItemRef = useRef(null), activeIndex = useMemo(
|
|
189
|
+
let resolvedCurrentPath = usePathname() ?? currentPath ?? "", instanceId = useId(), activeItemRef = useRef(null), viewportRef = useRef(null), activeIndex = useMemo(
|
|
183
190
|
() => createActiveIndex({ currentPath: resolvedCurrentPath, tree }),
|
|
184
191
|
[resolvedCurrentPath, tree]
|
|
185
192
|
);
|
|
186
193
|
return useEffect(() => {
|
|
187
|
-
let
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
194
|
+
let viewport = viewportRef.current, win = viewport?.ownerDocument.defaultView;
|
|
195
|
+
if (!resolvedCurrentPath || !viewport || !win) return;
|
|
196
|
+
let frame = win.requestAnimationFrame(() => {
|
|
197
|
+
let item = activeItemRef.current;
|
|
198
|
+
if (!item) return;
|
|
199
|
+
let itemBounds = item.getBoundingClientRect(), viewportBounds = viewport.getBoundingClientRect();
|
|
200
|
+
itemBounds.top < viewportBounds.top ? viewport.scrollTop += itemBounds.top - viewportBounds.top : itemBounds.bottom > viewportBounds.bottom && (viewport.scrollTop += itemBounds.bottom - viewportBounds.bottom);
|
|
192
201
|
});
|
|
193
|
-
return () =>
|
|
202
|
+
return () => win.cancelAnimationFrame(frame);
|
|
194
203
|
}, [resolvedCurrentPath]), /* @__PURE__ */ jsxs(
|
|
195
204
|
"nav",
|
|
196
205
|
{
|
|
@@ -209,6 +218,7 @@ function Sidebar({ className, currentPath, title, tree }) {
|
|
|
209
218
|
mask: { height: 24 },
|
|
210
219
|
scrollbarClassName: "opacity-0 transition-opacity data-[hovering]:opacity-100 data-[scrolling]:opacity-100",
|
|
211
220
|
variant: "gradient",
|
|
221
|
+
viewportRef,
|
|
212
222
|
children: /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-px px-2 py-3", children: tree.map((node) => /* @__PURE__ */ jsx(
|
|
213
223
|
SidebarTreeItem,
|
|
214
224
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { B as ButtonProps } from '../../../button-BdCScEKi.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
3
|
// src/components/block/theme-toggle.tsx
|
|
4
|
-
import {
|
|
4
|
+
import { Button } from "@components/ui/button";
|
|
5
|
+
import { CircleHalfIcon, MoonIcon, SunIcon } from "@phosphor-icons/react/ssr";
|
|
6
|
+
import { useTheme } from "next-themes";
|
|
7
|
+
import { useEffect, useMemo, useState } from "react";
|
|
8
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
9
|
+
var themeOrder = ["system", "light", "dark"];
|
|
10
|
+
function ThemeIcon({ theme }) {
|
|
11
|
+
return theme === "light" ? /* @__PURE__ */ jsx(SunIcon, { "aria-hidden": "true", size: 16, weight: "fill" }) : theme === "dark" ? /* @__PURE__ */ jsx(MoonIcon, { "aria-hidden": "true", size: 16, weight: "fill" }) : /* @__PURE__ */ jsx(CircleHalfIcon, { "aria-hidden": "true", size: 16, weight: "fill" });
|
|
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
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type TocHeading = {
|
|
5
|
+
id: string;
|
|
6
|
+
level: number;
|
|
7
|
+
text: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type TocClientProps = {
|
|
11
|
+
className: string;
|
|
12
|
+
desktopClassName: string;
|
|
13
|
+
desktopListClassName?: string;
|
|
14
|
+
headings: TocHeading[];
|
|
15
|
+
levels: [number, number];
|
|
16
|
+
listClassName?: string;
|
|
17
|
+
mobileClassName: string;
|
|
18
|
+
mobileQuery: string;
|
|
19
|
+
readingOffset?: number;
|
|
20
|
+
title: string;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
declare function TocClientProvider({ className, desktopClassName, desktopListClassName, headings, levels, listClassName, mobileClassName, mobileQuery, readingOffset, title, children, }: TocClientProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare function TocDesktop({ children }: {
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
}): react_jsx_runtime.JSX.Element;
|
|
27
|
+
declare function TocMobile({ children }: {
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}): react_jsx_runtime.JSX.Element;
|
|
30
|
+
declare function TocMobileHeader({ children }: {
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}): react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare function TocLinksSlot({ className, listClassName, viewport, }: {
|
|
34
|
+
className?: string;
|
|
35
|
+
listClassName?: string;
|
|
36
|
+
viewport?: "desktop" | "mobile";
|
|
37
|
+
}): react_jsx_runtime.JSX.Element;
|
|
38
|
+
declare function TocTitle({ children, className, ...props }: React.ComponentPropsWithoutRef<"span">): react_jsx_runtime.JSX.Element;
|
|
39
|
+
|
|
40
|
+
export { TocClientProvider, TocDesktop, TocLinksSlot, TocMobile, TocMobileHeader, TocTitle };
|