@publish.os/nextjs 0.0.1-alpha.90 → 0.0.1-alpha.92
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/group/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/group/layout.tsx +6 -6
- package/compiler-assets/nextjs/defaults/group/page.tsx +36 -26
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +21 -11
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -0
- package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
- package/compiler-assets/nextjs/defaults/root/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -3
- package/compiler-assets/nextjs/shims/agent-user-agents.ts +65 -0
- package/compiler-assets/nextjs/shims/document.tsx +46 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +5 -0
- package/compiler-assets/nextjs/shims/global-layout.tsx +8 -42
- 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 +254 -86
- package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +2 -6
- package/compiler-assets/nextjs/shims/site-mdx-components.tsx +28 -16
- package/compiler-assets/nextjs/shims/site-mdx.tsx +6 -1
- package/dist/{build-operation-2JAYBSKF.js → build-operation-CJDUL4OW.js} +29 -23
- package/dist/{button-c3WGnxIj.d.ts → button-D6Xp2HBm.d.ts} +4 -4
- package/dist/capture-local-source-WGGDIUU2.js +258 -0
- package/dist/chunk-22RSSUNV.js +13 -0
- package/dist/chunk-3T4HVDSC.js +426 -0
- package/dist/{chunk-WKTEO6RS.js → chunk-4BC2L2KA.js} +46 -12
- package/dist/{chunk-WDY4IK6Z.js → chunk-5J3YUNRY.js} +3 -10
- package/dist/chunk-5KAD7W53.js +248 -0
- package/dist/{chunk-DWA3ZRGW.js → chunk-6C65KV7O.js} +2 -2
- package/dist/{chunk-GGKFQ3MA.js → chunk-6D2E6UMD.js} +144 -70
- package/dist/{chunk-7OGTPSKI.js → chunk-7NY22B5U.js} +8 -3
- package/dist/chunk-DX7PXFCM.js +2519 -0
- package/dist/{chunk-726GV2NF.js → chunk-DZ3VWEV5.js} +950 -632
- package/dist/chunk-EFO6AWXN.js +19 -0
- package/dist/chunk-IL4RJOKI.js +186 -0
- package/dist/{chunk-H6XILMZX.js → chunk-NHSLTARU.js} +2588 -1493
- package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
- package/dist/{chunk-VO2I7MTM.js → chunk-SBMDONTV.js} +10 -7
- package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
- package/dist/compiler.d.ts +15 -2
- package/dist/compiler.js +111 -23
- package/dist/components/blocks/agent-actions.d.ts +81 -0
- package/dist/components/blocks/agent-actions.js +563 -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 +4 -0
- package/dist/components/ui/button.js +94 -0
- package/dist/compose-44GJSMXD.js +16 -0
- package/dist/config/createNextConfig.js +19 -3
- package/dist/{dev-operation-TZDVJCN7.js → dev-operation-WNECBHZ5.js} +134 -84
- package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
- package/dist/ide-support-TG74L4FF.js +16 -0
- package/dist/index.d.ts +151 -95
- package/dist/index.js +25 -0
- 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 +37 -8
- package/dist/kernel/components/blocks/AgentActions.js +384 -174
- package/dist/kernel/components/blocks/agent-actions.d.ts +4 -0
- package/dist/kernel/components/blocks/agent-actions.js +563 -0
- package/dist/kernel/components/blocks/animated-icon-swap.d.ts +2 -2
- package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
- package/dist/kernel/components/blocks/color-palette.d.ts +2 -2
- package/dist/kernel/components/blocks/color-palette.js +4 -4
- package/dist/kernel/components/blocks/logo-block.d.ts +2 -2
- package/dist/kernel/components/blocks/logo-block.js +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +6 -5
- package/dist/kernel/components/blocks/nav-breadcrumb.js +21 -15
- package/dist/kernel/components/blocks/navbar.d.ts +5 -4
- package/dist/kernel/components/blocks/navbar.js +79 -59
- package/dist/kernel/components/blocks/navigation-progress.d.ts +2 -2
- package/dist/kernel/components/blocks/navigation-progress.js +2 -2
- package/dist/kernel/components/blocks/next-prev.d.ts +4 -4
- package/dist/kernel/components/blocks/next-prev.js +30 -7
- package/dist/kernel/components/blocks/page-list.d.ts +4 -4
- package/dist/kernel/components/blocks/page-list.js +32 -9
- package/dist/kernel/components/blocks/search.d.ts +9 -15
- package/dist/kernel/components/blocks/search.js +16 -17
- package/dist/kernel/components/blocks/sidebar-node.d.ts +3 -5
- package/dist/kernel/components/blocks/sidebar-node.js +13 -3
- package/dist/kernel/components/blocks/sidebar.d.ts +6 -7
- package/dist/kernel/components/blocks/sidebar.js +137 -28
- package/dist/kernel/components/blocks/theme-toggle.d.ts +3 -4
- package/dist/kernel/components/blocks/theme-toggle.js +5 -5
- 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 +20 -2
- package/dist/kernel/components/blocks/toc.js +121 -179
- package/dist/kernel/components/mdx/components/blockquote.d.ts +2 -2
- package/dist/kernel/components/mdx/components/blockquote.js +1 -1
- package/dist/kernel/components/mdx/components/callout.d.ts +3 -3
- package/dist/kernel/components/mdx/components/callout.js +1 -1
- package/dist/kernel/components/mdx/components/code-block.d.ts +2 -2
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.d.ts +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +3 -3
- package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
- package/dist/kernel/components/mdx/components/figure.d.ts +8 -4
- package/dist/kernel/components/mdx/components/figure.js +23 -13
- package/dist/kernel/components/mdx/components/footnotes.d.ts +2 -2
- package/dist/kernel/components/mdx/components/footnotes.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
- package/dist/kernel/components/mdx/components/heading.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading.js +6 -3
- package/dist/kernel/components/mdx/components/hr.d.ts +4 -4
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.d.ts +3 -3
- package/dist/kernel/components/mdx/components/image-zoom.js +4 -3
- package/dist/kernel/components/mdx/components/image.d.ts +2 -2
- package/dist/kernel/components/mdx/components/image.js +22 -17
- package/dist/kernel/components/mdx/components/inline-code.d.ts +2 -2
- package/dist/kernel/components/mdx/components/inline-code.js +1 -1
- package/dist/kernel/components/mdx/components/kbd.d.ts +3 -3
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +6 -6
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.d.ts +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +1 -1
- package/dist/kernel/components/mdx/components/strikethrough.d.ts +2 -2
- package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
- package/dist/kernel/components/mdx/components/table.d.ts +7 -7
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.d.ts +3 -3
- package/dist/kernel/components/mdx/components/task-list.js +1 -1
- package/dist/kernel/components/mdx/components/video-player.d.ts +8 -4
- package/dist/kernel/components/mdx/components/video-player.js +6 -2
- package/dist/kernel/components/mdx/components/video.d.ts +5 -4
- package/dist/kernel/components/mdx/components/video.js +7 -5
- package/dist/kernel/components/mdx/error-boundary.d.ts +3 -4
- package/dist/kernel/components/mdx/error-boundary.js +2 -2
- package/dist/kernel/components/mdx/error-fallback.d.ts +2 -2
- package/dist/kernel/components/mdx/error-fallback.js +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +57 -16
- package/dist/kernel/components/mdx/mdx.js +232 -35
- package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.js +5 -3
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- 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.d.ts +7 -7
- package/dist/kernel/components/ui/accordion.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +3 -4
- package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
- package/dist/kernel/components/ui/breadcrumb.d.ts +14 -14
- package/dist/kernel/components/ui/breadcrumb.js +4 -4
- package/dist/kernel/components/ui/button-group.d.ts +6 -6
- package/dist/kernel/components/ui/button-group.js +3 -3
- package/dist/kernel/components/ui/button.d.ts +59 -7
- package/dist/kernel/components/ui/button.js +43 -39
- package/dist/kernel/components/ui/card.d.ts +7 -7
- package/dist/kernel/components/ui/card.js +1 -1
- package/dist/kernel/components/ui/dialog.d.ts +10 -10
- package/dist/kernel/components/ui/dialog.js +1 -1
- package/dist/kernel/components/ui/drawer.d.ts +12 -12
- package/dist/kernel/components/ui/drawer.js +1 -1
- 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.d.ts +4 -4
- package/dist/kernel/components/ui/kbd.js +1 -1
- package/dist/kernel/components/ui/link.d.ts +11 -5
- package/dist/kernel/components/ui/link.js +2 -2
- package/dist/kernel/components/ui/menu.d.ts +22 -22
- package/dist/kernel/components/ui/menu.js +1 -1
- package/dist/kernel/components/ui/mod-key.d.ts +2 -3
- package/dist/kernel/components/ui/mod-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.d.ts +15 -15
- package/dist/kernel/components/ui/navigation-menu.js +1 -1
- package/dist/kernel/components/ui/popover.d.ts +11 -11
- package/dist/kernel/components/ui/popover.js +1 -1
- package/dist/kernel/components/ui/progress.d.ts +7 -7
- package/dist/kernel/components/ui/progress.js +1 -1
- package/dist/kernel/components/ui/scroll-area.d.ts +9 -10
- package/dist/kernel/components/ui/scroll-area.js +1 -1
- package/dist/kernel/components/ui/select.d.ts +16 -16
- package/dist/kernel/components/ui/select.js +1 -1
- package/dist/kernel/components/ui/separator.d.ts +3 -3
- package/dist/kernel/components/ui/separator.js +1 -1
- package/dist/kernel/components/ui/table.d.ts +7 -7
- package/dist/kernel/components/ui/table.js +1 -1
- package/dist/kernel/components/ui/tabs.d.ts +12 -12
- package/dist/kernel/components/ui/tabs.js +1 -1
- package/dist/kernel/components/ui/tag.d.ts +3 -3
- package/dist/kernel/components/ui/tag.js +1 -1
- package/dist/kernel/components/ui/text.d.ts +4 -4
- package/dist/kernel/components/ui/text.js +1 -1
- package/dist/kernel/components/ui/toast.d.ts +11 -11
- package/dist/kernel/components/ui/toast.js +1 -1
- package/dist/kernel/components/ui/tooltip.d.ts +9 -9
- package/dist/kernel/components/ui/tooltip.js +1 -1
- package/dist/kernel/defaults.registry.d.ts +4 -17
- package/dist/kernel/defaults.registry.js +4 -19
- package/dist/kernel/routes/agent/markdown.d.ts +7 -0
- package/dist/kernel/routes/agent/markdown.js +229 -54
- 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 -2
- package/dist/kernel/routes/metadata/feed.js +119 -88
- package/dist/kernel/routes/metadata/llms.d.ts +3 -23
- package/dist/kernel/routes/metadata/llms.js +2 -103
- package/dist/kernel/routes/metadata/og-image.js +1 -1
- package/dist/kernel/routes/metadata/robots.d.ts +5 -3
- package/dist/kernel/routes/metadata/robots.js +4 -25
- package/dist/kernel/routes/metadata/sitemap.d.ts +36 -3
- package/dist/kernel/routes/metadata/sitemap.js +277 -49
- 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 +5 -5
- package/dist/kernel/routes/pages/group.js +11 -5
- package/dist/kernel/routes/pages/leaf.d.ts +38 -6
- package/dist/kernel/routes/pages/leaf.js +21 -12
- package/dist/kernel/routes/pages/root.d.ts +5 -5
- package/dist/kernel/routes/pages/root.js +21 -6
- package/dist/keyboard-shortcuts.d.ts +2 -2
- package/dist/keyboard-shortcuts.js +1 -1
- package/dist/manifest-types-CcVPH_jh.d.ts +83 -0
- package/dist/resolvers/manifest-resolver.d.ts +2 -2
- package/dist/resolvers/manifest-resolver.js +65 -35
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.d.ts +2 -9
- package/dist/search.js +9 -16
- package/dist/sidebar-types-CMrMM0Nj.d.ts +105 -0
- package/dist/theme-scope.d.ts +2 -2
- package/dist/theme-scope.js +1 -1
- package/dist/types-BbqmOzLC.d.ts +168 -0
- package/dist/types-TjH1ek0X.d.ts +22 -0
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +117 -91
- 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-EN2GW4FR.js +16 -0
- package/dist/validate-publish-os-source-OEWQDB7B.js +14 -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 +85 -0
- package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
- package/init/seed/minimal/publish.os/blog/page.tsx +91 -0
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
- package/init/seed/minimal/publish.os/components/blog/frontmatter.ts +41 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +2 -3
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +5 -6
- package/init/seed/minimal/publish.os/publish.os.config.json +17 -2
- package/init/seed/minimal/publish.os/theme.css +3 -3
- package/init/seed/minimal/seed.json +12 -4
- package/init/seed/scratch/publish.os/docs/content/get-started.mdx +1 -1
- package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
- package/package.json +48 -23
- package/release/app/phosphor/package.json +4 -4
- package/release/app/phosphor/pnpm-lock.yaml.template +123 -184
- package/release/compiler/package.json +5 -3
- package/release/compiler/pnpm-lock.yaml.template +153 -183
- package/release/release.json +6 -6
- package/dist/button-CtzUJB8u.d.ts +0 -11
- package/dist/chunk-535TM4A5.js +0 -1455
- package/dist/chunk-B2V22WRT.js +0 -297
- package/dist/chunk-NECL5IBJ.js +0 -318
- package/dist/chunk-SVYGXXYR.js +0 -36
- package/dist/chunk-UF6ATARM.js +0 -1100
- package/dist/compose-NN23UJGC.js +0 -13
- package/dist/ide-support-ZNW7ODFY.js +0 -15
- package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
- package/dist/kernel/components/blocks/design-system-preview.js +0 -667
- 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/ui/theme-toggle.d.ts +0 -24
- package/dist/kernel/components/ui/theme-toggle.js +0 -53
- package/dist/sidebar-types-DKpR27II.d.ts +0 -25
- package/dist/types-BzkZty3r.d.ts +0 -147
- package/dist/types-CJWRG05y.d.ts +0 -76
- package/dist/types-CUtrppxt.d.ts +0 -69
- package/dist/validate-local-source-XRL2Y7XE.js +0 -14
- package/dist/validate-publish-os-source-DAPZ4QGE.js +0 -12
- 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
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as react from 'react';
|
|
3
2
|
import { ReactNode, ComponentPropsWithRef, ComponentPropsWithoutRef } from 'react';
|
|
4
3
|
import { useRender } from '@base-ui/react/use-render';
|
|
5
|
-
import { B as ButtonProps } from '../../../button-
|
|
4
|
+
import { B as ButtonProps } from '../../../button-D6Xp2HBm.js';
|
|
6
5
|
import { Dialog } from '@base-ui/react/dialog';
|
|
7
6
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
8
7
|
import { Input } from '@base-ui/react/input';
|
|
@@ -18,17 +17,12 @@ type SearchResult = {
|
|
|
18
17
|
excerpt: string;
|
|
19
18
|
id: string;
|
|
20
19
|
meta: {
|
|
21
|
-
author?: string;
|
|
22
20
|
description?: string;
|
|
23
21
|
group?: string;
|
|
24
|
-
image?: string;
|
|
25
22
|
nodeId?: string;
|
|
26
23
|
path?: string;
|
|
27
|
-
publishedAt?: string;
|
|
28
24
|
section?: string;
|
|
29
|
-
tags?: string;
|
|
30
25
|
title?: string;
|
|
31
|
-
updatedAt?: string;
|
|
32
26
|
};
|
|
33
27
|
plainExcerpt: string;
|
|
34
28
|
score?: number;
|
|
@@ -45,7 +39,7 @@ type SearchProviderProps = {
|
|
|
45
39
|
open?: boolean;
|
|
46
40
|
shortcut?: string | false;
|
|
47
41
|
};
|
|
48
|
-
declare function SearchProvider({ children, defaultOpen, limit, onOpenChange, open: controlledOpen, shortcut, }: SearchProviderProps):
|
|
42
|
+
declare function SearchProvider({ children, defaultOpen, limit, onOpenChange, open: controlledOpen, shortcut, }: SearchProviderProps): react.JSX.Element;
|
|
49
43
|
|
|
50
44
|
type DialogPortalProps = ComponentPropsWithRef<typeof Dialog.Portal>;
|
|
51
45
|
|
|
@@ -60,13 +54,13 @@ type SearchResultsProps = Omit<ComponentPropsWithRef<"div">, "children"> & {
|
|
|
60
54
|
emptyText?: string;
|
|
61
55
|
itemClassName?: string;
|
|
62
56
|
};
|
|
63
|
-
declare function SearchResults({ children, className, emptyText, itemClassName, ...props }: SearchResultsProps):
|
|
57
|
+
declare function SearchResults({ children, className, emptyText, itemClassName, ...props }: SearchResultsProps): react.JSX.Element | null;
|
|
64
58
|
type SearchFooterProps = ComponentPropsWithRef<"div">;
|
|
65
|
-
declare function SearchFooter({ children, className, ...props }: SearchFooterProps):
|
|
59
|
+
declare function SearchFooter({ children, className, ...props }: SearchFooterProps): react.JSX.Element | null;
|
|
66
60
|
|
|
67
61
|
declare function SearchProgressBar({ className }: {
|
|
68
62
|
className?: string;
|
|
69
|
-
}):
|
|
63
|
+
}): react.JSX.Element;
|
|
70
64
|
|
|
71
65
|
type SearchTriggerProps = ButtonProps & {
|
|
72
66
|
icon?: ReactNode;
|
|
@@ -85,7 +79,7 @@ type SearchDialogProps = {
|
|
|
85
79
|
mobileQuery?: string;
|
|
86
80
|
title?: string;
|
|
87
81
|
};
|
|
88
|
-
declare function DialogContent({ children, className, container, description, mobileQuery, title, }: SearchDialogProps):
|
|
82
|
+
declare function DialogContent({ children, className, container, description, mobileQuery, title, }: SearchDialogProps): react.JSX.Element;
|
|
89
83
|
type SearchInputProps = Omit<InputProps, "value" | "defaultValue" | "onValueChange"> & {
|
|
90
84
|
ref?: ComponentPropsWithRef<"input">["ref"];
|
|
91
85
|
closeClassName?: string;
|
|
@@ -94,11 +88,11 @@ type SearchInputProps = Omit<InputProps, "value" | "defaultValue" | "onValueChan
|
|
|
94
88
|
rootClassName?: string;
|
|
95
89
|
showCloseShortcut?: boolean;
|
|
96
90
|
};
|
|
97
|
-
declare function SearchInputField({ className, closeClassName, closeLabel, icon, onChange, onKeyDown, placeholder, ref, rootClassName, showCloseShortcut, ...props }: SearchInputProps):
|
|
91
|
+
declare function SearchInputField({ className, closeClassName, closeLabel, icon, onChange, onKeyDown, placeholder, ref, rootClassName, showCloseShortcut, ...props }: SearchInputProps): react.JSX.Element;
|
|
98
92
|
type SearchCommandProps = ComponentPropsWithRef<"div">;
|
|
99
|
-
declare function Command({ children, className, ...props }?: SearchCommandProps):
|
|
93
|
+
declare function Command({ children, className, ...props }?: SearchCommandProps): react.JSX.Element;
|
|
100
94
|
type SearchProps = Omit<SearchProviderProps, "children">;
|
|
101
|
-
declare function Search(props: SearchProps):
|
|
95
|
+
declare function Search(props: SearchProps): react.JSX.Element;
|
|
102
96
|
declare namespace Search {
|
|
103
97
|
var Root: typeof SearchProvider;
|
|
104
98
|
var Trigger: typeof Trigger;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/modules/search/search-block.tsx
|
|
4
4
|
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
-
import { Button } from "@
|
|
5
|
+
import { Button } from "@components/ui/button";
|
|
6
6
|
import {
|
|
7
7
|
Dialog,
|
|
8
8
|
DialogBackdrop,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
DialogPopup,
|
|
11
11
|
DialogPortal,
|
|
12
12
|
DialogTitle
|
|
13
|
-
} from "@
|
|
13
|
+
} from "@components/ui/dialog";
|
|
14
14
|
import {
|
|
15
15
|
Drawer,
|
|
16
16
|
DrawerBackdrop,
|
|
@@ -20,11 +20,11 @@ import {
|
|
|
20
20
|
DrawerTitle,
|
|
21
21
|
DrawerViewport,
|
|
22
22
|
DrawerVirtualKeyboardProvider
|
|
23
|
-
} from "@
|
|
24
|
-
import { Input } from "@
|
|
25
|
-
import { Kbd as Kbd2
|
|
26
|
-
import { ModKey } from "@
|
|
27
|
-
import { Separator as Separator2 } from "@
|
|
23
|
+
} from "@components/ui/drawer";
|
|
24
|
+
import { Input } from "@components/ui/input";
|
|
25
|
+
import { Kbd as Kbd2 } from "@components/ui/kbd";
|
|
26
|
+
import { ModKey } from "@components/ui/mod-key";
|
|
27
|
+
import { Separator as Separator2 } from "@components/ui/separator";
|
|
28
28
|
import { MagnifyingGlassIcon } from "@phosphor-icons/react/ssr";
|
|
29
29
|
import { formatShortcut } from "@publish.os/nextjs/keyboard-shortcuts";
|
|
30
30
|
import {
|
|
@@ -38,21 +38,21 @@ import {
|
|
|
38
38
|
} from "react";
|
|
39
39
|
|
|
40
40
|
// src/modules/search/results.tsx
|
|
41
|
-
import { Kbd } from "@
|
|
41
|
+
import { Kbd } from "@components/ui/kbd";
|
|
42
42
|
import {
|
|
43
43
|
ScrollAreaContent,
|
|
44
44
|
ScrollAreaRoot,
|
|
45
45
|
ScrollAreaScrollbar,
|
|
46
46
|
ScrollAreaThumb,
|
|
47
47
|
ScrollAreaViewport
|
|
48
|
-
} from "@
|
|
49
|
-
import { Separator } from "@
|
|
48
|
+
} from "@components/ui/scroll-area";
|
|
49
|
+
import { Separator } from "@components/ui/separator";
|
|
50
50
|
import { ArrowElbowDownLeftIcon } from "@phosphor-icons/react/ssr";
|
|
51
51
|
import { useSearchBlock } from "@publish.os/nextjs/search";
|
|
52
52
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
53
53
|
import NextLink from "next/link";
|
|
54
54
|
import { useEffect } from "react";
|
|
55
|
-
import { Fragment, jsx, jsxs } from "
|
|
55
|
+
import { Fragment, jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
56
56
|
var SEARCH_RESULT_SNIPPET_LENGTH = 180;
|
|
57
57
|
function getSearchPanel({
|
|
58
58
|
displayResults,
|
|
@@ -323,11 +323,11 @@ import {
|
|
|
323
323
|
Progress,
|
|
324
324
|
ProgressIndicator,
|
|
325
325
|
ProgressTrack
|
|
326
|
-
} from "@
|
|
326
|
+
} from "@components/ui/progress";
|
|
327
327
|
import { useSearchBlock as useSearchBlock2 } from "@publish.os/nextjs/search";
|
|
328
328
|
import { cn as cn2 } from "@publish.os/nextjs/utils/cn";
|
|
329
329
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
330
|
-
import { jsx as jsx2 } from "
|
|
330
|
+
import { jsx as jsx2 } from "@publish.os/nextjs/jsx-runtime";
|
|
331
331
|
var INITIAL_PROGRESS = 5, FAST_PHASE_END = 25, TARGET_PROGRESS = 95, FAST_DURATION = 50, MAX_DURATION = 5e3, COMPLETE_DURATION = 200, EXIT_DURATION = 150;
|
|
332
332
|
function SearchProgressBar({ className }) {
|
|
333
333
|
let {
|
|
@@ -393,7 +393,7 @@ function SearchProgressBar({ className }) {
|
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
// src/modules/search/search-block.tsx
|
|
396
|
-
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "
|
|
396
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "@publish.os/nextjs/jsx-runtime";
|
|
397
397
|
function Trigger({
|
|
398
398
|
children,
|
|
399
399
|
className,
|
|
@@ -625,13 +625,12 @@ function SearchInputField({
|
|
|
625
625
|
{
|
|
626
626
|
"aria-label": "Close search",
|
|
627
627
|
className: cn3(
|
|
628
|
-
|
|
629
|
-
"absolute right-4 top-1/2 hidden -translate-y-1/2 cursor-pointer text-foreground-2 before:absolute before:left-1/2 before:top-1/2 before:size-10 before:-translate-1/2 before:content-[''] active:translate-y-[calc(-50%_+_1px)] md:inline-flex",
|
|
628
|
+
"absolute right-4 top-1/2 hidden -translate-y-1/2 cursor-pointer before:absolute before:left-1/2 before:top-1/2 before:size-10 before:-translate-1/2 before:content-[''] active:translate-y-[calc(-50%_+_1px)] md:inline-flex",
|
|
630
629
|
closeClassName
|
|
631
630
|
),
|
|
632
631
|
onClick: () => setOpen(!1),
|
|
633
632
|
type: "button",
|
|
634
|
-
children: closeLabel
|
|
633
|
+
children: /* @__PURE__ */ jsx3(Kbd2, { size: "xs", children: closeLabel })
|
|
635
634
|
}
|
|
636
635
|
) : null,
|
|
637
636
|
/* @__PURE__ */ jsx3(Separator2, { className: "absolute inset-x-0 bottom-0 z-content md:hidden group-data-[search-presentation=drawer]/search:block group-data-[search-presentation=dialog]/search:hidden" })
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { S as SidebarNodePrimitiveProps } from '../../../sidebar-types-
|
|
3
|
-
import 'react';
|
|
4
|
-
import '../../../types-CJWRG05y.js';
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { S as SidebarNodePrimitiveProps } from '../../../sidebar-types-CMrMM0Nj.js';
|
|
5
3
|
|
|
6
|
-
declare function SidebarNode({ activeState, activeItemRef, children, contentId, depth, expanded, href, isExpandable, node, onLinkClick, onToggle, parentExpanded, title, }: SidebarNodePrimitiveProps):
|
|
4
|
+
declare function SidebarNode({ activeState, activeItemRef, children, contentId, depth, expanded, href, isExpandable, node, onLinkClick, onSwitchView, onToggle, parentExpanded, title, }: SidebarNodePrimitiveProps): react.JSX.Element | null;
|
|
7
5
|
|
|
8
6
|
export { SidebarNode, SidebarNodePrimitiveProps };
|
|
@@ -3,7 +3,7 @@ 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",
|
|
@@ -157,6 +157,7 @@ function SidebarNode({
|
|
|
157
157
|
isExpandable = !1,
|
|
158
158
|
node,
|
|
159
159
|
onLinkClick,
|
|
160
|
+
onSwitchView,
|
|
160
161
|
onToggle,
|
|
161
162
|
parentExpanded,
|
|
162
163
|
title
|
|
@@ -174,7 +175,7 @@ function SidebarNode({
|
|
|
174
175
|
}
|
|
175
176
|
),
|
|
176
177
|
children
|
|
177
|
-
] }) : node.type === "folder" ? /* @__PURE__ */ jsxs("li", { className: "select-none", children: [
|
|
178
|
+
] }) : node.type === "folder" || node.type === "group" && node.presentation === "folder" ? /* @__PURE__ */ jsxs("li", { className: "select-none", children: [
|
|
178
179
|
/* @__PURE__ */ jsx(
|
|
179
180
|
"button",
|
|
180
181
|
{
|
|
@@ -200,7 +201,16 @@ function SidebarNode({
|
|
|
200
201
|
}
|
|
201
202
|
),
|
|
202
203
|
children
|
|
203
|
-
] }) :
|
|
204
|
+
] }) : node.type === "switch-view" ? /* @__PURE__ */ jsx("li", { className: "select-none", children: /* @__PURE__ */ jsx(
|
|
205
|
+
"button",
|
|
206
|
+
{
|
|
207
|
+
className: "block w-full rounded-button text-left focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-stroke",
|
|
208
|
+
onClick: onSwitchView,
|
|
209
|
+
tabIndex: parentExpanded ? void 0 : -1,
|
|
210
|
+
type: "button",
|
|
211
|
+
children: /* @__PURE__ */ jsx(RowInner, { activeState, depth, interactive: !0, children: /* @__PURE__ */ jsx(RowText, { title }) })
|
|
212
|
+
}
|
|
213
|
+
) }) : href ? /* @__PURE__ */ jsxs("li", { className: "select-none", children: [
|
|
204
214
|
/* @__PURE__ */ jsx(
|
|
205
215
|
SidebarLink,
|
|
206
216
|
{
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import '../../../types-CJWRG05y.js';
|
|
3
|
+
import { R as ResolvedNavigation } from '../../../sidebar-types-CMrMM0Nj.js';
|
|
4
|
+
export { a as SidebarActiveState, b as SidebarDepth, c as SidebarNavigationNode, S as SidebarNodePrimitiveProps } from '../../../sidebar-types-CMrMM0Nj.js';
|
|
6
5
|
|
|
7
6
|
type SidebarProps = {
|
|
8
7
|
className?: string;
|
|
9
8
|
currentPath?: string;
|
|
10
9
|
title?: ReactNode;
|
|
11
|
-
|
|
10
|
+
navigation: ResolvedNavigation;
|
|
12
11
|
};
|
|
13
|
-
declare function Sidebar({ className, currentPath, title,
|
|
12
|
+
declare function Sidebar({ className, currentPath, title, navigation, }: SidebarProps): react.JSX.Element;
|
|
14
13
|
|
|
15
|
-
export { Sidebar, type SidebarProps
|
|
14
|
+
export { Sidebar, type SidebarProps };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/components/block/sidebar/sidebar.tsx
|
|
4
|
-
import { SidebarNode } from "@
|
|
5
|
-
import { ScrollArea } from "@
|
|
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,51 +15,112 @@ import {
|
|
|
15
15
|
useRef,
|
|
16
16
|
useState
|
|
17
17
|
} from "react";
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
// src/components/block/sidebar/sidebar-navigation-view.ts
|
|
19
20
|
function normalizePath(path) {
|
|
20
21
|
if (!path) return "";
|
|
21
22
|
let [withoutQuery = ""] = path.split(/[?#]/);
|
|
22
23
|
return withoutQuery === "/" ? "/" : withoutQuery.replace(/\/+$/g, "");
|
|
23
24
|
}
|
|
25
|
+
function nodePath(node) {
|
|
26
|
+
if (node.type === "page") return node.page.path;
|
|
27
|
+
if (node.type === "group") return node.route;
|
|
28
|
+
}
|
|
29
|
+
function pathSpecificity(nodes, path) {
|
|
30
|
+
let normalizedPath = normalizePath(path), specificity = -1;
|
|
31
|
+
for (let node of nodes) {
|
|
32
|
+
let candidate = normalizePath(nodePath(node));
|
|
33
|
+
candidate && (normalizedPath === candidate || normalizedPath.startsWith(`${candidate}/`)) && (specificity = Math.max(specificity, candidate.length)), node.type === "view" ? specificity = Math.max(specificity, pathSpecificity(node.items, path)) : "children" in node && (specificity = Math.max(
|
|
34
|
+
specificity,
|
|
35
|
+
pathSpecificity(node.children ?? [], path)
|
|
36
|
+
));
|
|
37
|
+
}
|
|
38
|
+
return specificity;
|
|
39
|
+
}
|
|
40
|
+
function focusedViewForPath(nodes, path) {
|
|
41
|
+
let selected, selectedDepth = -1, selectedSpecificity = -1;
|
|
42
|
+
function visit(entries, depth) {
|
|
43
|
+
for (let node of entries)
|
|
44
|
+
if (node.type === "view") {
|
|
45
|
+
let specificity = pathSpecificity(node.items, path);
|
|
46
|
+
specificity >= 0 && (depth > selectedDepth || depth === selectedDepth && specificity > selectedSpecificity) && (selected = node, selectedDepth = depth, selectedSpecificity = specificity), visit(node.items, depth + 1);
|
|
47
|
+
} else "children" in node && visit(node.children ?? [], depth);
|
|
48
|
+
}
|
|
49
|
+
return visit(nodes, 0), selected;
|
|
50
|
+
}
|
|
51
|
+
function focusedViewForTarget(nodes, target) {
|
|
52
|
+
if (typeof target != "string")
|
|
53
|
+
return findNamedView(nodes, target.view);
|
|
54
|
+
let group = findGroup(nodes, target);
|
|
55
|
+
return group ? focusedViewForPath(nodes, group.route) : findNamedView(nodes, target);
|
|
56
|
+
}
|
|
57
|
+
function findNavigationView(nodes, viewId) {
|
|
58
|
+
if (viewId)
|
|
59
|
+
for (let node of nodes) {
|
|
60
|
+
if (node.type === "view" && (node.viewId === viewId || node.id === viewId))
|
|
61
|
+
return node;
|
|
62
|
+
let nested = node.type === "view" ? findNavigationView(node.items, viewId) : "children" in node ? findNavigationView(node.children ?? [], viewId) : void 0;
|
|
63
|
+
if (nested) return nested;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function findNamedView(nodes, viewId) {
|
|
67
|
+
return findNavigationView(nodes, viewId);
|
|
68
|
+
}
|
|
69
|
+
function findGroup(nodes, groupKey) {
|
|
70
|
+
for (let node of nodes) {
|
|
71
|
+
if (node.type === "group" && node.groupKey === groupKey) return node;
|
|
72
|
+
let nested = node.type === "view" ? findGroup(node.items, groupKey) : "children" in node ? findGroup(node.children ?? [], groupKey) : void 0;
|
|
73
|
+
if (nested) return nested;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/components/block/sidebar/sidebar.tsx
|
|
78
|
+
import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
79
|
+
function normalizePath2(path) {
|
|
80
|
+
if (!path) return "";
|
|
81
|
+
let [withoutQuery = ""] = path.split(/[?#]/);
|
|
82
|
+
return withoutQuery === "/" ? "/" : withoutQuery.replace(/\/+$/g, "");
|
|
83
|
+
}
|
|
24
84
|
function isExternalHref(href) {
|
|
25
85
|
return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
|
|
26
86
|
}
|
|
27
87
|
function nodeHref(node) {
|
|
28
|
-
if (node.type === "link" || "
|
|
29
|
-
if ("path" in node && typeof node.path == "string") return node.path;
|
|
88
|
+
if (node.type === "link" || node.type === "page" || node.type === "group" && node.presentation === "page") return node.href;
|
|
30
89
|
}
|
|
31
|
-
function
|
|
32
|
-
if (node.type
|
|
33
|
-
|
|
90
|
+
function nodePath2(node) {
|
|
91
|
+
if (node.type === "page") return node.page.path;
|
|
92
|
+
if (node.type === "group" && node.presentation === "page") return node.route;
|
|
34
93
|
}
|
|
35
94
|
function nodeChildren(node) {
|
|
36
|
-
return
|
|
95
|
+
return node.type === "view" ? node.items : "children" in node ? node.children ?? [] : [];
|
|
37
96
|
}
|
|
38
97
|
function nodeKey(node, parentKey) {
|
|
39
|
-
|
|
40
|
-
return node.type === "page" ? `${prefix}page:${node.fileID}` : node.type === "link" ? `${prefix}link:${node.id}` : `${prefix}${node.type}:${node.id}`;
|
|
98
|
+
return `${parentKey ? `${parentKey}/` : ""}${node.type}:${node.id}`;
|
|
41
99
|
}
|
|
42
100
|
function isActivePath(path, currentPath) {
|
|
43
101
|
if (!path || isExternalHref(path)) return !1;
|
|
44
|
-
let normalizedPath =
|
|
102
|
+
let normalizedPath = normalizePath2(path), normalizedCurrentPath = normalizePath2(currentPath);
|
|
45
103
|
return normalizedPath ? normalizedCurrentPath === normalizedPath || normalizedCurrentPath.startsWith(`${normalizedPath}/`) : !1;
|
|
46
104
|
}
|
|
47
105
|
function isExactActivePath(path, currentPath) {
|
|
48
|
-
return !path || isExternalHref(path) ? !1 :
|
|
106
|
+
return !path || isExternalHref(path) ? !1 : normalizePath2(path) === normalizePath2(currentPath);
|
|
49
107
|
}
|
|
50
108
|
function createActiveIndex({
|
|
51
109
|
currentPath,
|
|
52
|
-
|
|
110
|
+
nodes
|
|
53
111
|
}) {
|
|
54
112
|
let activeIndex = /* @__PURE__ */ new Map();
|
|
55
113
|
function visit(node) {
|
|
56
|
-
let path =
|
|
114
|
+
let path = nodePath2(node), exactActive = isExactActivePath(path, currentPath), pathActive = (node.type === "page" || node.type === "group") && isActivePath(path, currentPath), childActive = !1;
|
|
115
|
+
for (let child of nodeChildren(node))
|
|
116
|
+
childActive = visit(child) || childActive;
|
|
117
|
+
let activeState = exactActive ? "path-active" : childActive || pathActive ? "child-path-active" : void 0;
|
|
57
118
|
return activeIndex.set(node, {
|
|
58
119
|
activeState,
|
|
59
120
|
initiallyExpanded: exactActive || pathActive || childActive
|
|
60
121
|
}), exactActive || pathActive || childActive;
|
|
61
122
|
}
|
|
62
|
-
for (let node of
|
|
123
|
+
for (let node of nodes)
|
|
63
124
|
visit(node);
|
|
64
125
|
return activeIndex;
|
|
65
126
|
}
|
|
@@ -70,7 +131,7 @@ function nodeContentId({
|
|
|
70
131
|
instanceId,
|
|
71
132
|
node
|
|
72
133
|
}) {
|
|
73
|
-
let key =
|
|
134
|
+
let key = node.type === "page" ? node.page.path : node.type === "group" ? node.route : node.id;
|
|
74
135
|
return `sidebar-${safeIdPart(instanceId)}-${safeIdPart(key)}`;
|
|
75
136
|
}
|
|
76
137
|
function clampDepth(depth) {
|
|
@@ -85,6 +146,7 @@ function ExpandableChildren({
|
|
|
85
146
|
expanded,
|
|
86
147
|
instanceId,
|
|
87
148
|
nodes,
|
|
149
|
+
onSwitchView,
|
|
88
150
|
parentExpanded,
|
|
89
151
|
renderChildren
|
|
90
152
|
}) {
|
|
@@ -109,6 +171,7 @@ function ExpandableChildren({
|
|
|
109
171
|
instanceId,
|
|
110
172
|
itemKey: nodeKey(child, contentId),
|
|
111
173
|
node: child,
|
|
174
|
+
onSwitchView,
|
|
112
175
|
parentExpanded: childFocusable
|
|
113
176
|
},
|
|
114
177
|
nodeKey(child, contentId)
|
|
@@ -124,18 +187,19 @@ var SidebarTreeItem = memo(function SidebarTreeItem2({
|
|
|
124
187
|
instanceId,
|
|
125
188
|
itemKey,
|
|
126
189
|
node,
|
|
190
|
+
onSwitchView,
|
|
127
191
|
parentExpanded
|
|
128
192
|
}) {
|
|
129
|
-
let nodes = nodeChildren(node), href = nodeHref(node), activeInfo = activeIndex.get(node), activeState = activeInfo?.activeState, initiallyExpanded = !!activeInfo?.initiallyExpanded,
|
|
193
|
+
let nodes = nodeChildren(node), href = nodeHref(node), activeInfo = activeIndex.get(node), activeState = activeInfo?.activeState, initiallyExpanded = !!activeInfo?.initiallyExpanded, hasChildren = nodes.length > 0, isExpandable = hasChildren && (node.type === "folder" || node.type === "page" || node.type === "group" && node.presentation === "folder"), [expanded, setExpanded] = useState(initiallyExpanded), [renderChildren, setRenderChildren] = useState(initiallyExpanded), interactedRef = useRef(!1), lastPathRef = useRef(normalizePath2(currentPath)), contentId = nodeContentId({ instanceId, node });
|
|
130
194
|
useEffect(() => {
|
|
131
|
-
let normalizedCurrentPath =
|
|
195
|
+
let normalizedCurrentPath = normalizePath2(currentPath);
|
|
132
196
|
lastPathRef.current !== normalizedCurrentPath && (interactedRef.current = !1, lastPathRef.current = normalizedCurrentPath), initiallyExpanded && !expanded && !interactedRef.current && (setRenderChildren(!0), startTransition(() => setExpanded(!0)));
|
|
133
197
|
}, [currentPath, expanded, initiallyExpanded]);
|
|
134
198
|
let toggleExpanded = useCallback(() => {
|
|
135
199
|
interactedRef.current = !0, setRenderChildren(!0), setExpanded((value) => !value);
|
|
136
200
|
}, []), expandOnNavigate = useCallback(() => {
|
|
137
201
|
interactedRef.current = !0, setRenderChildren(!0), setExpanded(!0);
|
|
138
|
-
}, []), pageWithChildrenLinkClick = node.type === "page" &&
|
|
202
|
+
}, []), pageWithChildrenLinkClick = (node.type === "page" || node.type === "group" && node.presentation === "page") && hasChildren ? expandOnNavigate : void 0, children = isExpandable && hasChildren ? /* @__PURE__ */ jsx(
|
|
139
203
|
ExpandableChildren,
|
|
140
204
|
{
|
|
141
205
|
activeIndex,
|
|
@@ -146,10 +210,11 @@ var SidebarTreeItem = memo(function SidebarTreeItem2({
|
|
|
146
210
|
expanded,
|
|
147
211
|
instanceId,
|
|
148
212
|
nodes,
|
|
213
|
+
onSwitchView,
|
|
149
214
|
parentExpanded,
|
|
150
215
|
renderChildren
|
|
151
216
|
}
|
|
152
|
-
) : node.type === "section" &&
|
|
217
|
+
) : node.type === "section" && hasChildren ? /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-px", children: nodes.map((child) => /* @__PURE__ */ jsx(
|
|
153
218
|
SidebarTreeItem2,
|
|
154
219
|
{
|
|
155
220
|
activeIndex,
|
|
@@ -159,11 +224,26 @@ var SidebarTreeItem = memo(function SidebarTreeItem2({
|
|
|
159
224
|
instanceId,
|
|
160
225
|
itemKey: nodeKey(child, itemKey),
|
|
161
226
|
node: child,
|
|
227
|
+
onSwitchView,
|
|
228
|
+
parentExpanded
|
|
229
|
+
},
|
|
230
|
+
nodeKey(child, itemKey)
|
|
231
|
+
)) }) : node.type === "view" && hasChildren ? /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-px", children: nodes.map((child) => /* @__PURE__ */ jsx(
|
|
232
|
+
SidebarTreeItem2,
|
|
233
|
+
{
|
|
234
|
+
activeIndex,
|
|
235
|
+
activeItemRef,
|
|
236
|
+
currentPath,
|
|
237
|
+
depth,
|
|
238
|
+
instanceId,
|
|
239
|
+
itemKey: nodeKey(child, itemKey),
|
|
240
|
+
node: child,
|
|
241
|
+
onSwitchView,
|
|
162
242
|
parentExpanded
|
|
163
243
|
},
|
|
164
244
|
nodeKey(child, itemKey)
|
|
165
245
|
)) }) : null;
|
|
166
|
-
return /* @__PURE__ */ jsx(
|
|
246
|
+
return node.type === "view" ? children : /* @__PURE__ */ jsx(
|
|
167
247
|
SidebarNode,
|
|
168
248
|
{
|
|
169
249
|
activeState,
|
|
@@ -175,17 +255,45 @@ var SidebarTreeItem = memo(function SidebarTreeItem2({
|
|
|
175
255
|
isExpandable,
|
|
176
256
|
node,
|
|
177
257
|
onLinkClick: pageWithChildrenLinkClick,
|
|
258
|
+
onSwitchView: node.type === "switch-view" ? () => onSwitchView(node.target) : void 0,
|
|
178
259
|
onToggle: isExpandable ? toggleExpanded : void 0,
|
|
179
260
|
parentExpanded,
|
|
180
|
-
title: node.
|
|
261
|
+
title: node.label ?? "",
|
|
181
262
|
children
|
|
182
263
|
}
|
|
183
264
|
);
|
|
184
265
|
});
|
|
185
|
-
function Sidebar({
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
266
|
+
function Sidebar({
|
|
267
|
+
className,
|
|
268
|
+
currentPath,
|
|
269
|
+
title,
|
|
270
|
+
navigation
|
|
271
|
+
}) {
|
|
272
|
+
let resolvedCurrentPath = usePathname() ?? currentPath ?? "", normalizedCurrentPath = normalizePath2(resolvedCurrentPath), [selection, setSelection] = useState(() => ({
|
|
273
|
+
path: normalizedCurrentPath,
|
|
274
|
+
viewId: focusedViewForPath(navigation.items, resolvedCurrentPath)?.id
|
|
275
|
+
})), defaultViewId = focusedViewForPath(
|
|
276
|
+
navigation.items,
|
|
277
|
+
resolvedCurrentPath
|
|
278
|
+
)?.id, viewId = selection.path === normalizedCurrentPath ? selection.viewId : defaultViewId, selectedView = findNavigationView(navigation.items, viewId), visibleNodes = selectedView?.type === "view" ? selectedView.items : navigation.items, switchView = useCallback(
|
|
279
|
+
(target) => {
|
|
280
|
+
let targetView = focusedViewForTarget(navigation.items, target);
|
|
281
|
+
setSelection({ path: normalizedCurrentPath, viewId: targetView?.id });
|
|
282
|
+
},
|
|
283
|
+
[navigation.items, normalizedCurrentPath]
|
|
284
|
+
);
|
|
285
|
+
useEffect(() => {
|
|
286
|
+
setSelection({
|
|
287
|
+
path: normalizedCurrentPath,
|
|
288
|
+
viewId: defaultViewId
|
|
289
|
+
});
|
|
290
|
+
}, [defaultViewId, normalizedCurrentPath]);
|
|
291
|
+
let instanceId = useId(), activeItemRef = useRef(null), viewportRef = useRef(null), activeIndex = useMemo(
|
|
292
|
+
() => createActiveIndex({
|
|
293
|
+
currentPath: resolvedCurrentPath,
|
|
294
|
+
nodes: visibleNodes
|
|
295
|
+
}),
|
|
296
|
+
[resolvedCurrentPath, visibleNodes]
|
|
189
297
|
);
|
|
190
298
|
return useEffect(() => {
|
|
191
299
|
let viewport = viewportRef.current, win = viewport?.ownerDocument.defaultView;
|
|
@@ -216,7 +324,7 @@ function Sidebar({ className, currentPath, title, tree }) {
|
|
|
216
324
|
scrollbarClassName: "opacity-0 transition-opacity data-[hovering]:opacity-100 data-[scrolling]:opacity-100",
|
|
217
325
|
variant: "gradient",
|
|
218
326
|
viewportRef,
|
|
219
|
-
children: /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-px px-2 py-3", children:
|
|
327
|
+
children: /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-px px-2 py-3", children: visibleNodes.map((node) => /* @__PURE__ */ jsx(
|
|
220
328
|
SidebarTreeItem,
|
|
221
329
|
{
|
|
222
330
|
activeIndex,
|
|
@@ -226,6 +334,7 @@ function Sidebar({ className, currentPath, title, tree }) {
|
|
|
226
334
|
instanceId,
|
|
227
335
|
itemKey: nodeKey(node, ""),
|
|
228
336
|
node,
|
|
337
|
+
onSwitchView: switchView,
|
|
229
338
|
parentExpanded: !0
|
|
230
339
|
},
|
|
231
340
|
nodeKey(node, "")
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { B as ButtonProps } from '../../../button-
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { B as ButtonProps } from '../../../button-D6Xp2HBm.js';
|
|
3
3
|
import 'class-variance-authority/types';
|
|
4
4
|
import 'class-variance-authority';
|
|
5
|
-
import 'react';
|
|
6
5
|
|
|
7
6
|
type ThemeToggleProps = Omit<ButtonProps, "children" | "iconOnly" | "leftIcon" | "loading" | "rightIcon">;
|
|
8
|
-
declare function ThemeToggle({ className, onClick, size, title, type, variant, ...props }: ThemeToggleProps):
|
|
7
|
+
declare function ThemeToggle({ className, onClick, size, title, type, variant, ...props }: ThemeToggleProps): react.JSX.Element;
|
|
9
8
|
|
|
10
9
|
export { ThemeToggle, type ThemeToggleProps };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/components/
|
|
4
|
-
import { Button } from "@
|
|
5
|
-
import {
|
|
3
|
+
// src/components/block/theme-toggle.tsx
|
|
4
|
+
import { Button } from "@components/ui/button";
|
|
5
|
+
import { CircleHalfIcon, MoonIcon, SunIcon } from "@phosphor-icons/react/ssr";
|
|
6
6
|
import { useTheme } from "next-themes";
|
|
7
7
|
import { useEffect, useMemo, useState } from "react";
|
|
8
|
-
import { jsx } from "
|
|
8
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
9
9
|
var themeOrder = ["system", "light", "dark"];
|
|
10
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(
|
|
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
12
|
}
|
|
13
13
|
function normalizeTheme(theme) {
|
|
14
14
|
return theme === "light" || theme === "dark" ? theme : "system";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
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.Element;
|
|
24
|
+
declare function TocDesktop({ children }: {
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
}): react.JSX.Element;
|
|
27
|
+
declare function TocMobile({ children }: {
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}): react.JSX.Element;
|
|
30
|
+
declare function TocMobileHeader({ children }: {
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}): react.JSX.Element;
|
|
33
|
+
declare function TocLinksSlot({ className, listClassName, viewport, }: {
|
|
34
|
+
className?: string;
|
|
35
|
+
listClassName?: string;
|
|
36
|
+
viewport?: "desktop" | "mobile";
|
|
37
|
+
}): react.JSX.Element;
|
|
38
|
+
declare function TocTitle({ children, className, ...props }: React.ComponentPropsWithoutRef<"span">): react.JSX.Element;
|
|
39
|
+
|
|
40
|
+
export { TocClientProvider, TocDesktop, TocLinksSlot, TocMobile, TocMobileHeader, TocTitle };
|