@publish.os/nextjs 0.0.1-alpha.6 → 0.0.1-alpha.8
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/README.md +3 -5
- package/compiler-assets/nextjs/defaults/app/globals.css +6 -0
- package/compiler-assets/nextjs/defaults/group/layout.tsx +23 -0
- package/compiler-assets/nextjs/defaults/group/leaf.tsx +48 -0
- package/compiler-assets/nextjs/defaults/group/page.tsx +50 -0
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +45 -0
- package/compiler-assets/nextjs/defaults/project/postcss.config.mjs +5 -0
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +41 -0
- package/compiler-assets/nextjs/defaults/root/css/animation.css +90 -0
- package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/drawer.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/menu.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +25 -0
- package/compiler-assets/nextjs/defaults/root/css/components/popover.css +17 -0
- package/compiler-assets/nextjs/defaults/root/css/components/select.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/toast.css +19 -0
- package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +15 -0
- package/compiler-assets/nextjs/defaults/root/css/layout.css +22 -0
- package/compiler-assets/nextjs/defaults/root/css/media.css +81 -0
- package/compiler-assets/nextjs/defaults/root/css/radius.css +49 -0
- package/compiler-assets/nextjs/defaults/root/css/scrollbar.css +43 -0
- package/compiler-assets/nextjs/defaults/root/css/shadow.css +145 -0
- package/compiler-assets/nextjs/defaults/root/css/typography.css +607 -0
- package/compiler-assets/nextjs/defaults/root/css/zindex.css +39 -0
- package/compiler-assets/nextjs/defaults/root/globals.css +191 -0
- package/compiler-assets/nextjs/defaults/root/layout.tsx +19 -0
- package/compiler-assets/nextjs/defaults/root/page.tsx +61 -0
- package/compiler-assets/nextjs/defaults/root/theme.css +50 -0
- package/compiler-assets/nextjs/defaults/source/_internal/logger.ts +21 -0
- package/compiler-assets/nextjs/shims/generated-group-layout.tsx +19 -0
- package/compiler-assets/nextjs/shims/generated-group-page.tsx +18 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +21 -0
- package/compiler-assets/nextjs/shims/global-layout.tsx +134 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +29 -0
- package/compiler-assets/nextjs/shims/og-image-route.ts +18 -0
- package/compiler-assets/nextjs/shims/powered-by-footer.tsx +40 -0
- package/compiler-assets/nextjs/shims/providers.tsx +13 -0
- package/compiler-assets/nextjs/shims/proxy.ts +317 -0
- package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +77 -0
- package/compiler-assets/nextjs/shims/root-page.tsx +13 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +177 -0
- package/dist/button-CFdx-ohV.d.ts +20 -0
- package/dist/cache/tags.js +6 -14
- package/dist/compiler.d.ts +100 -0
- package/dist/compiler.js +13379 -0
- package/dist/config/createNextConfig.d.ts +2 -1
- package/dist/config/createNextConfig.js +16 -12
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +2 -0
- package/dist/index.d.ts +303 -15
- package/dist/index.js +30 -1198
- package/dist/kernel/components/blocks/AgentActions.d.ts +9 -3
- package/dist/kernel/components/blocks/AgentActions.js +114 -200
- package/dist/kernel/components/blocks/animated-icon-swap.js +4 -25
- package/dist/kernel/components/blocks/color-palette.js +88 -169
- package/dist/kernel/components/blocks/design-system-preview.d.ts +38 -6
- package/dist/kernel/components/blocks/design-system-preview.js +44 -52
- package/dist/kernel/components/blocks/link-playground.js +23 -71
- package/dist/kernel/components/blocks/logo-block.js +18 -47
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.js +28 -42
- package/dist/kernel/components/blocks/navbar.d.ts +1 -1
- package/dist/kernel/components/blocks/navbar.js +14 -41
- package/dist/kernel/components/blocks/navigation-progress-playground.js +56 -149
- package/dist/kernel/components/blocks/navigation-progress.js +53 -157
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +16 -42
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +11 -16
- package/dist/kernel/components/blocks/search.d.ts +13 -2
- package/dist/kernel/components/blocks/search.js +116 -247
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +56 -95
- package/dist/kernel/components/blocks/sidebar.d.ts +5 -23
- package/dist/kernel/components/blocks/sidebar.js +35 -103
- package/dist/kernel/components/blocks/theme-toggle.d.ts +7 -3
- package/dist/kernel/components/blocks/theme-toggle.js +2 -2
- package/dist/kernel/components/blocks/toc.js +42 -178
- package/dist/kernel/components/mdx/components/blockquote.js +3 -24
- package/dist/kernel/components/mdx/components/callout.d.ts +1 -1
- package/dist/kernel/components/mdx/components/callout.js +15 -47
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/figure-caption.js +6 -24
- package/dist/kernel/components/mdx/components/figure.js +9 -36
- package/dist/kernel/components/mdx/components/footnotes.js +3 -24
- package/dist/kernel/components/mdx/components/heading-copy-link.js +13 -37
- package/dist/kernel/components/mdx/components/heading.d.ts +8 -3
- package/dist/kernel/components/mdx/components/heading.js +32 -116
- package/dist/kernel/components/mdx/components/hr.d.ts +5 -3
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +2 -3
- package/dist/kernel/components/mdx/components/image.js +22 -62
- package/dist/kernel/components/mdx/components/inline-code.js +3 -24
- package/dist/kernel/components/mdx/components/kbd.d.ts +9 -4
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +1 -2
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +13 -41
- package/dist/kernel/components/mdx/components/pre.js +3 -24
- package/dist/kernel/components/mdx/components/strikethrough.js +6 -24
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.js +6 -28
- package/dist/kernel/components/mdx/components/video-player.js +53 -88
- package/dist/kernel/components/mdx/components/video.js +27 -75
- package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
- package/dist/kernel/components/mdx/error-boundary.js +12 -15
- package/dist/kernel/components/mdx/error-fallback.js +4 -4
- package/dist/kernel/components/mdx/mdx.d.ts +68 -11
- package/dist/kernel/components/mdx/mdx.js +29 -29
- package/dist/kernel/components/mdx/rehype-heading-ids.js +11 -67
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- package/dist/kernel/components/ui/accordion.js +3 -26
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +23 -7
- package/dist/kernel/components/ui/breadcrumb-trail.js +32 -80
- package/dist/kernel/components/ui/breadcrumb.d.ts +1 -1
- package/dist/kernel/components/ui/breadcrumb.js +20 -54
- package/dist/kernel/components/ui/button-group.d.ts +4 -3
- package/dist/kernel/components/ui/button-group.js +7 -30
- package/dist/kernel/components/ui/button.js +13 -36
- package/dist/kernel/components/ui/card.d.ts +1 -1
- package/dist/kernel/components/ui/card.js +2 -23
- package/dist/kernel/components/ui/dialog.d.ts +9 -9
- package/dist/kernel/components/ui/dialog.js +15 -33
- package/dist/kernel/components/ui/drawer.d.ts +10 -10
- package/dist/kernel/components/ui/drawer.js +15 -33
- package/dist/kernel/components/ui/input.js +6 -30
- package/dist/kernel/components/ui/kbd.js +10 -31
- package/dist/kernel/components/ui/link.d.ts +1 -1
- package/dist/kernel/components/ui/link.js +53 -104
- package/dist/kernel/components/ui/menu.d.ts +21 -21
- package/dist/kernel/components/ui/menu.js +10 -32
- package/dist/kernel/components/ui/meta-key.d.ts +9 -4
- package/dist/kernel/components/ui/meta-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.d.ts +14 -14
- package/dist/kernel/components/ui/navigation-menu.js +9 -30
- package/dist/kernel/components/ui/popover.d.ts +10 -10
- package/dist/kernel/components/ui/popover.js +19 -34
- package/dist/kernel/components/ui/progress.js +2 -25
- package/dist/kernel/components/ui/scroll-area.js +39 -118
- package/dist/kernel/components/ui/select.d.ts +15 -15
- package/dist/kernel/components/ui/select.js +19 -35
- package/dist/kernel/components/ui/separator.js +2 -25
- package/dist/kernel/components/ui/table.js +2 -23
- package/dist/kernel/components/ui/tabs.js +39 -99
- package/dist/kernel/components/ui/tag.d.ts +2 -2
- package/dist/kernel/components/ui/tag.js +4 -25
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/text.js +3 -25
- package/dist/kernel/components/ui/theme-toggle.d.ts +18 -4
- package/dist/kernel/components/ui/theme-toggle.js +18 -44
- package/dist/kernel/components/ui/toast.d.ts +10 -10
- package/dist/kernel/components/ui/toast.js +13 -35
- package/dist/kernel/components/ui/tooltip.d.ts +8 -8
- package/dist/kernel/components/ui/tooltip.js +8 -29
- package/dist/kernel/defaults.registry.d.ts +1 -1
- package/dist/kernel/defaults.registry.js +2 -2
- package/dist/kernel/framework-icons.d.ts +1 -0
- package/dist/kernel/framework-icons.js +39 -0
- package/dist/kernel/routes/agent/markdown.js +36 -65
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +20 -109
- package/dist/kernel/routes/metadata/feed.d.ts +1 -2
- package/dist/kernel/routes/metadata/feed.js +46 -127
- package/dist/kernel/routes/metadata/llms.d.ts +1 -2
- package/dist/kernel/routes/metadata/llms.js +40 -120
- package/dist/kernel/routes/metadata/og-image.d.ts +10 -0
- package/dist/kernel/routes/metadata/og-image.js +264 -198
- package/dist/kernel/routes/metadata/robots.d.ts +1 -2
- package/dist/kernel/routes/metadata/robots.js +21 -90
- package/dist/kernel/routes/metadata/sitemap.d.ts +1 -2
- package/dist/kernel/routes/metadata/sitemap.js +36 -102
- package/dist/kernel/routes/pages/group.d.ts +1 -1
- package/dist/kernel/routes/pages/group.js +42 -137
- package/dist/kernel/routes/pages/leaf.d.ts +1 -1
- package/dist/kernel/routes/pages/leaf.js +74 -213
- package/dist/kernel/routes/pages/root.d.ts +1 -1
- package/dist/kernel/routes/pages/root.js +37 -108
- package/dist/keyboard-shortcuts.js +69 -141
- package/dist/link-CYaCRDb6.d.ts +35 -0
- package/dist/resolvers/manifest-resolver.d.ts +3 -3
- package/dist/resolvers/manifest-resolver.js +15 -21
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.d.ts +81 -4
- package/dist/search.js +124 -195
- package/dist/sidebar-types-Bgchdfd6.d.ts +25 -0
- package/dist/theme-scope.d.ts +15 -0
- package/dist/theme-scope.js +23 -0
- package/dist/types-B_b3C0U6.d.ts +63 -0
- package/dist/types-CIwwieNw.d.ts +127 -0
- package/dist/types-DHBm7-j6.d.ts +57 -0
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +0 -1
- package/dist/types.js +1 -1
- package/dist/utils/cn.d.ts +5 -9
- package/dist/utils/cn.js +13 -7
- package/dist/utils/heading-ids.js +20 -47
- package/dist/utils/pretty-date.js +7 -13
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.dark.png +0 -0
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.png +0 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +54 -0
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +31 -0
- package/init/seed/minimal/publish.os/docs/content/theme.mdx +64 -0
- package/init/seed/minimal/publish.os/publish.os.config.json +21 -0
- package/init/seed/minimal/publish.os/theme.css +47 -0
- package/init/seed/minimal/seed.json +13 -0
- package/package.json +469 -35
- package/release/{package.json → app/lucide/package.json} +11 -5
- package/release/app/lucide/pnpm-lock.yaml.template +2905 -0
- package/release/app/lucide/pnpm-workspace.yaml +11 -0
- package/release/app/phosphor/package.json +30 -0
- package/release/app/phosphor/pnpm-lock.yaml.template +2908 -0
- package/release/app/phosphor/pnpm-workspace.yaml +11 -0
- package/release/app/tabler/package.json +30 -0
- package/release/app/tabler/pnpm-lock.yaml.template +2911 -0
- package/release/app/tabler/pnpm-workspace.yaml +11 -0
- package/release/compiler/package.json +20 -0
- package/release/compiler/pnpm-lock.yaml.template +2432 -0
- package/release/compiler/pnpm-workspace.yaml +11 -0
- package/release/release.json +29 -5
- package/release/runtime-pnpm-lock.yaml +0 -1316
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/
|
|
4
|
-
import { AnimatedIconSwap } from "
|
|
5
|
-
import ColorPalette from "
|
|
6
|
-
import { InlineCode } from "
|
|
3
|
+
// src/modules/design-system/design-system-preview.tsx
|
|
4
|
+
import { AnimatedIconSwap } from "@publish.os/nextjs/kernel/components/blocks/animated-icon-swap";
|
|
5
|
+
import ColorPalette from "@publish.os/nextjs/kernel/components/blocks/color-palette";
|
|
6
|
+
import { InlineCode } from "@publish.os/nextjs/kernel/components/mdx/components/inline-code";
|
|
7
7
|
import {
|
|
8
8
|
Accordion,
|
|
9
9
|
AccordionHeader,
|
|
10
10
|
AccordionItem,
|
|
11
11
|
AccordionPanel,
|
|
12
12
|
AccordionTrigger
|
|
13
|
-
} from "
|
|
13
|
+
} from "@publish.os/nextjs/kernel/components/ui/accordion";
|
|
14
14
|
import {
|
|
15
15
|
Breadcrumb,
|
|
16
16
|
BreadcrumbItem,
|
|
@@ -18,20 +18,20 @@ import {
|
|
|
18
18
|
BreadcrumbList,
|
|
19
19
|
BreadcrumbPage,
|
|
20
20
|
BreadcrumbSeparator
|
|
21
|
-
} from "
|
|
22
|
-
import { Button, buttonVariants } from "
|
|
21
|
+
} from "@publish.os/nextjs/kernel/components/ui/breadcrumb";
|
|
22
|
+
import { Button, buttonVariants } from "@publish.os/nextjs/kernel/components/ui/button";
|
|
23
23
|
import {
|
|
24
24
|
ButtonGroup,
|
|
25
25
|
ButtonGroupSeparator,
|
|
26
26
|
ButtonGroupText
|
|
27
|
-
} from "
|
|
27
|
+
} from "@publish.os/nextjs/kernel/components/ui/button-group";
|
|
28
28
|
import {
|
|
29
29
|
Card,
|
|
30
30
|
CardContent,
|
|
31
31
|
CardDescription,
|
|
32
32
|
CardHeader,
|
|
33
33
|
CardTitle
|
|
34
|
-
} from "
|
|
34
|
+
} from "@publish.os/nextjs/kernel/components/ui/card";
|
|
35
35
|
import {
|
|
36
36
|
Dialog,
|
|
37
37
|
DialogBackdrop,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
DialogPortal,
|
|
40
40
|
DialogTitle,
|
|
41
41
|
DialogTrigger
|
|
42
|
-
} from "
|
|
42
|
+
} from "@publish.os/nextjs/kernel/components/ui/dialog";
|
|
43
43
|
import {
|
|
44
44
|
Drawer,
|
|
45
45
|
DrawerPopup,
|
|
@@ -47,10 +47,10 @@ import {
|
|
|
47
47
|
DrawerTitle,
|
|
48
48
|
DrawerTrigger,
|
|
49
49
|
DrawerViewport
|
|
50
|
-
} from "
|
|
51
|
-
import { Input } from "
|
|
52
|
-
import { Kbd } from "
|
|
53
|
-
import { Link } from "
|
|
50
|
+
} from "@publish.os/nextjs/kernel/components/ui/drawer";
|
|
51
|
+
import { Input } from "@publish.os/nextjs/kernel/components/ui/input";
|
|
52
|
+
import { Kbd } from "@publish.os/nextjs/kernel/components/ui/kbd";
|
|
53
|
+
import { Link } from "@publish.os/nextjs/kernel/components/ui/link";
|
|
54
54
|
import {
|
|
55
55
|
Menu,
|
|
56
56
|
MenuItem,
|
|
@@ -58,8 +58,8 @@ import {
|
|
|
58
58
|
MenuPortal,
|
|
59
59
|
MenuPositioner,
|
|
60
60
|
MenuTrigger
|
|
61
|
-
} from "
|
|
62
|
-
import { MetaKey } from "
|
|
61
|
+
} from "@publish.os/nextjs/kernel/components/ui/menu";
|
|
62
|
+
import { MetaKey } from "@publish.os/nextjs/kernel/components/ui/meta-key";
|
|
63
63
|
import {
|
|
64
64
|
Popover,
|
|
65
65
|
PopoverPopup,
|
|
@@ -67,13 +67,13 @@ import {
|
|
|
67
67
|
PopoverPositioner,
|
|
68
68
|
PopoverTitle,
|
|
69
69
|
PopoverTrigger
|
|
70
|
-
} from "
|
|
70
|
+
} from "@publish.os/nextjs/kernel/components/ui/popover";
|
|
71
71
|
import {
|
|
72
72
|
Progress,
|
|
73
73
|
ProgressIndicator,
|
|
74
74
|
ProgressTrack
|
|
75
|
-
} from "
|
|
76
|
-
import { ScrollArea } from "
|
|
75
|
+
} from "@publish.os/nextjs/kernel/components/ui/progress";
|
|
76
|
+
import { ScrollArea } from "@publish.os/nextjs/kernel/components/ui/scroll-area";
|
|
77
77
|
import {
|
|
78
78
|
Select,
|
|
79
79
|
SelectIcon,
|
|
@@ -86,8 +86,8 @@ import {
|
|
|
86
86
|
SelectPositioner,
|
|
87
87
|
SelectTrigger,
|
|
88
88
|
SelectValue
|
|
89
|
-
} from "
|
|
90
|
-
import { Separator } from "
|
|
89
|
+
} from "@publish.os/nextjs/kernel/components/ui/select";
|
|
90
|
+
import { Separator } from "@publish.os/nextjs/kernel/components/ui/separator";
|
|
91
91
|
import {
|
|
92
92
|
Table,
|
|
93
93
|
TableBody,
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
TableHead,
|
|
96
96
|
TableHeader,
|
|
97
97
|
TableRow
|
|
98
|
-
} from "
|
|
98
|
+
} from "@publish.os/nextjs/kernel/components/ui/table";
|
|
99
99
|
import {
|
|
100
100
|
NavigationTabs,
|
|
101
101
|
NavigationTabsIndicator,
|
|
@@ -106,16 +106,16 @@ import {
|
|
|
106
106
|
TabsList,
|
|
107
107
|
TabsPanel,
|
|
108
108
|
TabsTab
|
|
109
|
-
} from "
|
|
110
|
-
import { Tag } from "
|
|
111
|
-
import { Text } from "
|
|
109
|
+
} from "@publish.os/nextjs/kernel/components/ui/tabs";
|
|
110
|
+
import { Tag } from "@publish.os/nextjs/kernel/components/ui/tag";
|
|
111
|
+
import { Text } from "@publish.os/nextjs/kernel/components/ui/text";
|
|
112
112
|
import {
|
|
113
113
|
Toast,
|
|
114
114
|
ToastContent,
|
|
115
115
|
ToastDescription,
|
|
116
116
|
ToastProvider,
|
|
117
117
|
ToastTitle
|
|
118
|
-
} from "
|
|
118
|
+
} from "@publish.os/nextjs/kernel/components/ui/toast";
|
|
119
119
|
import {
|
|
120
120
|
Tooltip,
|
|
121
121
|
TooltipPopup,
|
|
@@ -123,8 +123,11 @@ import {
|
|
|
123
123
|
TooltipPositioner,
|
|
124
124
|
TooltipProvider,
|
|
125
125
|
TooltipTrigger
|
|
126
|
-
} from "
|
|
127
|
-
import {
|
|
126
|
+
} from "@publish.os/nextjs/kernel/components/ui/tooltip";
|
|
127
|
+
import {
|
|
128
|
+
FrameworkCheckIcon as Check,
|
|
129
|
+
FrameworkCopyIcon as Copy
|
|
130
|
+
} from "@publish.os/nextjs/kernel/framework-icons";
|
|
128
131
|
import { useState } from "react";
|
|
129
132
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
130
133
|
var tabs = [
|
|
@@ -133,8 +136,7 @@ var tabs = [
|
|
|
133
136
|
{ id: "ui", label: "UI" },
|
|
134
137
|
{ id: "mdx", label: "MDX" },
|
|
135
138
|
{ id: "blocks", label: "Blocks" }
|
|
136
|
-
]
|
|
137
|
-
var scrollRows = Array.from({ length: 8 }, (_, index) => ({
|
|
139
|
+
], scrollRows = Array.from({ length: 8 }, (_, index) => ({
|
|
138
140
|
id: `row-${index + 1}`,
|
|
139
141
|
label: `Scrollable row ${index + 1}`
|
|
140
142
|
}));
|
|
@@ -177,7 +179,7 @@ function UiPreview({ items = [] }) {
|
|
|
177
179
|
!hasFixture(items, "Button") && /* @__PURE__ */ jsx(PreviewCell, { name: "Button", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3", children: [
|
|
178
180
|
/* @__PURE__ */ jsx(Button, { children: "Solid" }),
|
|
179
181
|
/* @__PURE__ */ jsx(Button, { variant: "soft", children: "Soft" }),
|
|
180
|
-
/* @__PURE__ */ jsx(Button, { disabled:
|
|
182
|
+
/* @__PURE__ */ jsx(Button, { disabled: !0, variant: "outline", children: "Disabled" })
|
|
181
183
|
] }) }),
|
|
182
184
|
/* @__PURE__ */ jsx(PreviewCell, { name: "ButtonGroup", children: /* @__PURE__ */ jsxs("div", { className: "grid gap-4", children: [
|
|
183
185
|
/* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
@@ -242,13 +244,13 @@ function UiPreview({ items = [] }) {
|
|
|
242
244
|
children: "External resource"
|
|
243
245
|
}
|
|
244
246
|
),
|
|
245
|
-
/* @__PURE__ */ jsx(Link, { color: "accent", disabled:
|
|
247
|
+
/* @__PURE__ */ jsx(Link, { color: "accent", disabled: !0, href: "#", variant: "link.standalone", children: "Disabled link" }),
|
|
246
248
|
/* @__PURE__ */ jsx(Link, { href: "#", size: "sm", variant: "button.solid", children: "Link as button" })
|
|
247
249
|
] }) }),
|
|
248
250
|
/* @__PURE__ */ jsx(PreviewCell, { name: "Link colors", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3", children: [
|
|
249
251
|
/* @__PURE__ */ jsx(Link, { href: "/ds", color: "green-300", children: "Docs" }),
|
|
250
252
|
/* @__PURE__ */ jsx(Link, { href: "/ds", color: "purple-800", children: "Purple link" }),
|
|
251
|
-
/* @__PURE__ */ jsx(Link, { href: "/ds", color: "accent-
|
|
253
|
+
/* @__PURE__ */ jsx(Link, { href: "/ds", color: "accent-1-hover", children: "Accent hover" }),
|
|
252
254
|
/* @__PURE__ */ jsx(Link, { href: "/ds", color: "foreground-3", children: "Foreground 3" }),
|
|
253
255
|
/* @__PURE__ */ jsx(Link, { href: "/ds", color: "--brand-link", children: "Brand var" }),
|
|
254
256
|
/* @__PURE__ */ jsx(Link, { href: "/ds", color: "var(--brand-link)", children: "Brand var" }),
|
|
@@ -420,11 +422,11 @@ function UiPreview({ items = [] }) {
|
|
|
420
422
|
) }),
|
|
421
423
|
/* @__PURE__ */ jsx(PreviewCell, { name: "NavigationTabs", children: /* @__PURE__ */ jsxs("div", { className: "grid w-full max-w-sm gap-4", children: [
|
|
422
424
|
/* @__PURE__ */ jsx(NavigationTabs, { defaultValue: "docs", variant: "base", children: /* @__PURE__ */ jsxs(NavigationTabsList, { "aria-label": "Base navigation tabs", children: [
|
|
423
|
-
/* @__PURE__ */ jsx(NavigationTabsLink, { active:
|
|
425
|
+
/* @__PURE__ */ jsx(NavigationTabsLink, { active: !0, href: "#docs", value: "docs", children: "Docs" }),
|
|
424
426
|
/* @__PURE__ */ jsx(NavigationTabsLink, { href: "#api", value: "api", children: "API" })
|
|
425
427
|
] }) }),
|
|
426
428
|
/* @__PURE__ */ jsx(NavigationTabs, { defaultValue: "drafts", variant: "button", children: /* @__PURE__ */ jsxs(NavigationTabsList, { "aria-label": "Button navigation tabs", children: [
|
|
427
|
-
/* @__PURE__ */ jsx(NavigationTabsLink, { active:
|
|
429
|
+
/* @__PURE__ */ jsx(NavigationTabsLink, { active: !0, href: "#drafts", value: "drafts", children: "Drafts" }),
|
|
428
430
|
/* @__PURE__ */ jsx(NavigationTabsLink, { href: "#published", value: "published", children: "Published" })
|
|
429
431
|
] }) }),
|
|
430
432
|
/* @__PURE__ */ jsx(
|
|
@@ -434,7 +436,7 @@ function UiPreview({ items = [] }) {
|
|
|
434
436
|
indicatorColor: "foreground",
|
|
435
437
|
variant: "underline",
|
|
436
438
|
children: /* @__PURE__ */ jsxs(NavigationTabsList, { "aria-label": "Underline navigation tabs", children: [
|
|
437
|
-
/* @__PURE__ */ jsx(NavigationTabsLink, { active:
|
|
439
|
+
/* @__PURE__ */ jsx(NavigationTabsLink, { active: !0, href: "#overview", value: "overview", children: "Overview" }),
|
|
438
440
|
/* @__PURE__ */ jsx(NavigationTabsLink, { href: "#analytics", value: "analytics", children: "Analytics" }),
|
|
439
441
|
/* @__PURE__ */ jsx(NavigationTabsIndicator, {})
|
|
440
442
|
] })
|
|
@@ -522,15 +524,13 @@ function MdxPreview({ items = [] }) {
|
|
|
522
524
|
/* @__PURE__ */ jsx(TableCell, { children: "Panels" })
|
|
523
525
|
] }) })
|
|
524
526
|
] }) }) }),
|
|
525
|
-
/* @__PURE__ */ jsx(PreviewCell, { name: "Code", children: /* @__PURE__ */ jsx("pre", { className: "max-w-xs overflow-auto rounded-codeblock border border-stroke-2 bg-surface-3 p-4 text-xs text-foreground-1", children: /* @__PURE__ */ jsx("code", { children:
|
|
527
|
+
/* @__PURE__ */ jsx(PreviewCell, { name: "Code", children: /* @__PURE__ */ jsx("pre", { className: "max-w-xs overflow-auto rounded-codeblock border border-stroke-2 bg-surface-3 p-4 text-xs text-foreground-1", children: /* @__PURE__ */ jsx("code", { children: 'export const value = "publishOS";' }) }) })
|
|
526
528
|
] });
|
|
527
529
|
}
|
|
528
530
|
function CopyToClipboardPreview() {
|
|
529
|
-
|
|
531
|
+
let [copied, setCopied] = useState(!1);
|
|
530
532
|
function handleCopy() {
|
|
531
|
-
|
|
532
|
-
setCopied(true);
|
|
533
|
-
window.setTimeout(() => setCopied(false), 1200);
|
|
533
|
+
navigator.clipboard?.writeText("pnpm publish.os add block"), setCopied(!0), window.setTimeout(() => setCopied(!1), 1200);
|
|
534
534
|
}
|
|
535
535
|
return /* @__PURE__ */ jsx(
|
|
536
536
|
Button,
|
|
@@ -571,7 +571,7 @@ function BlocksPreview({
|
|
|
571
571
|
/* @__PURE__ */ jsx("div", { className: "mt-8 border-y border-stroke-3 bg-surface-2 px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto flex max-w-6xl flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
572
572
|
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-foreground-1", children: "publishOS / Docs / Introduction" }),
|
|
573
573
|
/* @__PURE__ */ jsxs("nav", { className: "flex flex-wrap gap-4", children: [
|
|
574
|
-
/* @__PURE__ */ jsx(Link, { active:
|
|
574
|
+
/* @__PURE__ */ jsx(Link, { active: !0, color: "accent", href: "#", size: "sm", children: "Docs" }),
|
|
575
575
|
/* @__PURE__ */ jsx(Link, { href: "#", size: "sm", children: "Blog" }),
|
|
576
576
|
/* @__PURE__ */ jsx(Link, { href: "#", size: "sm", children: "Changelog" })
|
|
577
577
|
] })
|
|
@@ -596,11 +596,7 @@ function ActivePanel({
|
|
|
596
596
|
tab,
|
|
597
597
|
ui
|
|
598
598
|
}) {
|
|
599
|
-
|
|
600
|
-
if (tab === "typography") return /* @__PURE__ */ jsx(TypographyPreview, {});
|
|
601
|
-
if (tab === "ui") return /* @__PURE__ */ jsx(UiPreview, { items: ui });
|
|
602
|
-
if (tab === "mdx") return /* @__PURE__ */ jsx(MdxPreview, { items: mdx });
|
|
603
|
-
return /* @__PURE__ */ jsx(BlocksPreview, { items: blocks });
|
|
599
|
+
return tab === "tokens" ? /* @__PURE__ */ jsx(ColorPalette, {}) : tab === "typography" ? /* @__PURE__ */ jsx(TypographyPreview, {}) : tab === "ui" ? /* @__PURE__ */ jsx(UiPreview, { items: ui }) : tab === "mdx" ? /* @__PURE__ */ jsx(MdxPreview, { items: mdx }) : /* @__PURE__ */ jsx(BlocksPreview, { items: blocks });
|
|
604
600
|
}
|
|
605
601
|
function DesignSystemPreview({
|
|
606
602
|
blocks,
|
|
@@ -609,11 +605,7 @@ function DesignSystemPreview({
|
|
|
609
605
|
tabComponents,
|
|
610
606
|
ui
|
|
611
607
|
}) {
|
|
612
|
-
|
|
613
|
-
const TabsRoot = tabComponents?.Tabs ?? Tabs;
|
|
614
|
-
const TabsListRoot = tabComponents?.TabsList ?? TabsList;
|
|
615
|
-
const TabsPanelRoot = tabComponents?.TabsPanel ?? TabsPanel;
|
|
616
|
-
const TabsTabRoot = tabComponents?.TabsTab ?? TabsTab;
|
|
608
|
+
let [activeTab, setActiveTab] = useState(initialTab), TabsRoot = tabComponents?.Tabs ?? Tabs, TabsListRoot = tabComponents?.TabsList ?? TabsList, TabsPanelRoot = tabComponents?.TabsPanel ?? TabsPanel, TabsTabRoot = tabComponents?.TabsTab ?? TabsTab;
|
|
617
609
|
return /* @__PURE__ */ jsx("section", { className: "w-full text-foreground-1", children: /* @__PURE__ */ jsxs(
|
|
618
610
|
TabsRoot,
|
|
619
611
|
{
|
|
@@ -1,34 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/
|
|
4
|
-
import { InlineCode } from "
|
|
5
|
-
import { Button } from "
|
|
6
|
-
import { Link } from "
|
|
7
|
-
import { Tabs, TabsList, TabsPanel, TabsTab } from "
|
|
8
|
-
|
|
9
|
-
// src/utils/cn.ts
|
|
10
|
-
import { clsx } from "clsx";
|
|
11
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
12
|
-
var twMerge = extendTailwindMerge({
|
|
13
|
-
extend: {
|
|
14
|
-
classGroups: {
|
|
15
|
-
z: [
|
|
16
|
-
"z-content",
|
|
17
|
-
"z-nav",
|
|
18
|
-
"z-overlay",
|
|
19
|
-
"z-modal",
|
|
20
|
-
"z-search",
|
|
21
|
-
"z-toast",
|
|
22
|
-
"z-progress"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
function cn(...inputs) {
|
|
28
|
-
return twMerge(clsx(inputs));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// src/kernel/components/blocks/link-playground.tsx
|
|
3
|
+
// src/modules/design-system/link-playground.tsx
|
|
4
|
+
import { InlineCode } from "@publish.os/nextjs/kernel/components/mdx/components/inline-code";
|
|
5
|
+
import { Button } from "@publish.os/nextjs/kernel/components/ui/button";
|
|
6
|
+
import { Link } from "@publish.os/nextjs/kernel/components/ui/link";
|
|
7
|
+
import { Tabs, TabsList, TabsPanel, TabsTab } from "@publish.os/nextjs/kernel/components/ui/tabs";
|
|
8
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
32
9
|
import { useId, useMemo, useState } from "react";
|
|
33
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
34
11
|
var defaultSettings = {
|
|
@@ -52,30 +29,16 @@ var defaultSettings = {
|
|
|
52
29
|
lightnessDelta: 0,
|
|
53
30
|
chromaScale: 1,
|
|
54
31
|
hueShift: 0
|
|
55
|
-
};
|
|
56
|
-
var toneOrder = ["default", "accent"];
|
|
57
|
-
var variantOrder = ["link.standalone", "link.inline"];
|
|
32
|
+
}, toneOrder = ["default", "accent"], variantOrder = ["link.standalone", "link.inline"];
|
|
58
33
|
function adjustedColor(color, settings) {
|
|
59
|
-
|
|
60
|
-
return color;
|
|
61
|
-
}
|
|
62
|
-
return `oklch(from ${color} calc(l + ${settings.lightnessDelta / 100}) calc(c * ${settings.chromaScale}) calc(h + ${settings.hueShift}))`;
|
|
34
|
+
return settings.lightnessDelta === 0 && settings.chromaScale === 1 && settings.hueShift === 0 ? color : `oklch(from ${color} calc(l + ${settings.lightnessDelta / 100}) calc(c * ${settings.chromaScale}) calc(h + ${settings.hueShift}))`;
|
|
63
35
|
}
|
|
64
36
|
function linkStyle({
|
|
65
37
|
tone,
|
|
66
38
|
variant,
|
|
67
39
|
settings
|
|
68
40
|
}) {
|
|
69
|
-
|
|
70
|
-
const isStandalone = variant === "link.standalone";
|
|
71
|
-
const textOpacity = isStandalone ? settings.standaloneTextOpacity : settings.textOpacity;
|
|
72
|
-
const hoverTextOpacity = isStandalone ? settings.standaloneTextOpacity : settings.hoverTextOpacity;
|
|
73
|
-
const underlineOpacity = isStandalone ? 0 : settings.underlineOpacity;
|
|
74
|
-
const hoverUnderlineOpacity = isStandalone ? settings.standaloneHoverUnderlineOpacity : settings.hoverUnderlineOpacity;
|
|
75
|
-
const underlineColor = settings.underlineColor;
|
|
76
|
-
const resolvedUnderlineColor = underlineColor === "currentColor" ? baseColor : underlineColor;
|
|
77
|
-
const resolvedHoverUnderlineColor = settings.hoverUnderlineColor === "currentColor" ? baseColor : settings.hoverUnderlineColor;
|
|
78
|
-
const resolvedActiveUnderlineColor = settings.activeUnderlineColor === "currentColor" ? baseColor : settings.activeUnderlineColor;
|
|
41
|
+
let baseColor = tone === "accent" ? settings.accentColor : settings.defaultColor, isStandalone = variant === "link.standalone", textOpacity = isStandalone ? settings.standaloneTextOpacity : settings.textOpacity, hoverTextOpacity = isStandalone ? settings.standaloneTextOpacity : settings.hoverTextOpacity, underlineOpacity = isStandalone ? 0 : settings.underlineOpacity, hoverUnderlineOpacity = isStandalone ? settings.standaloneHoverUnderlineOpacity : settings.hoverUnderlineOpacity, underlineColor = settings.underlineColor, resolvedUnderlineColor = underlineColor === "currentColor" ? baseColor : underlineColor, resolvedHoverUnderlineColor = settings.hoverUnderlineColor === "currentColor" ? baseColor : settings.hoverUnderlineColor, resolvedActiveUnderlineColor = settings.activeUnderlineColor === "currentColor" ? baseColor : settings.activeUnderlineColor;
|
|
79
42
|
return {
|
|
80
43
|
"--link-active-text-opacity": `${settings.activeTextOpacity}%`,
|
|
81
44
|
"--link-active-underline-color": adjustedColor(
|
|
@@ -139,7 +102,7 @@ function NumberControl({
|
|
|
139
102
|
unit,
|
|
140
103
|
value
|
|
141
104
|
}) {
|
|
142
|
-
|
|
105
|
+
let id = useId();
|
|
143
106
|
return /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
144
107
|
/* @__PURE__ */ jsxs(
|
|
145
108
|
"label",
|
|
@@ -159,7 +122,7 @@ function NumberControl({
|
|
|
159
122
|
/* @__PURE__ */ jsx(
|
|
160
123
|
"input",
|
|
161
124
|
{
|
|
162
|
-
className: "h-1 w-full accent-foreground-1",
|
|
125
|
+
className: "h-1 w-full accent-1-foreground-1",
|
|
163
126
|
id,
|
|
164
127
|
max,
|
|
165
128
|
min,
|
|
@@ -189,7 +152,7 @@ function TextControl({
|
|
|
189
152
|
onChange,
|
|
190
153
|
value
|
|
191
154
|
}) {
|
|
192
|
-
|
|
155
|
+
let id = useId();
|
|
193
156
|
return /* @__PURE__ */ jsxs(
|
|
194
157
|
"label",
|
|
195
158
|
{
|
|
@@ -203,7 +166,7 @@ function TextControl({
|
|
|
203
166
|
className: "h-8 rounded-button border border-stroke-2 bg-surface-1 px-2 font-mono text-xs text-foreground-1 outline-none focus:border-accent-1",
|
|
204
167
|
id,
|
|
205
168
|
onChange: (event) => onChange(event.target.value),
|
|
206
|
-
spellCheck:
|
|
169
|
+
spellCheck: !1,
|
|
207
170
|
value
|
|
208
171
|
}
|
|
209
172
|
)
|
|
@@ -256,8 +219,8 @@ function PreviewBlock({
|
|
|
256
219
|
children,
|
|
257
220
|
title
|
|
258
221
|
}) {
|
|
259
|
-
return /* @__PURE__ */ jsxs("section", { className: "min-h-64 border-b border-r border-stroke-3 bg-
|
|
260
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 pt-5 text-sm font-medium text-
|
|
222
|
+
return /* @__PURE__ */ jsxs("section", { className: "min-h-64 border-b border-r border-stroke-3 bg-surface-1", children: [
|
|
223
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 pt-5 text-sm font-medium text-foreground-3", children: title }),
|
|
261
224
|
/* @__PURE__ */ jsx("div", { className: "flex min-h-52 items-center justify-center px-8 py-8", children })
|
|
262
225
|
] });
|
|
263
226
|
}
|
|
@@ -319,7 +282,7 @@ function LinkSet({ settings }) {
|
|
|
319
282
|
/* @__PURE__ */ jsx(
|
|
320
283
|
PlaygroundLink,
|
|
321
284
|
{
|
|
322
|
-
disabled:
|
|
285
|
+
disabled: !0,
|
|
323
286
|
settings,
|
|
324
287
|
tone: "accent",
|
|
325
288
|
variant: "link.standalone",
|
|
@@ -351,7 +314,7 @@ function SizeScale({ settings }) {
|
|
|
351
314
|
)) });
|
|
352
315
|
}
|
|
353
316
|
function MdxSample({ settings }) {
|
|
354
|
-
|
|
317
|
+
let inlineStyle = linkStyle({
|
|
355
318
|
settings,
|
|
356
319
|
tone: "accent",
|
|
357
320
|
variant: "link.inline"
|
|
@@ -468,25 +431,14 @@ function BlockSamples({ settings }) {
|
|
|
468
431
|
] });
|
|
469
432
|
}
|
|
470
433
|
function LinkPlayground() {
|
|
471
|
-
|
|
472
|
-
const [tone, setTone] = useState("accent");
|
|
473
|
-
const [variant, setVariant] = useState("link.standalone");
|
|
474
|
-
const [copyState, setCopyState] = useState("idle");
|
|
475
|
-
const output = useMemo(() => buildOutput(settings), [settings]);
|
|
476
|
-
const previewStyle = linkStyle({ settings, tone, variant });
|
|
477
|
-
const updateNumber = (key, value) => {
|
|
434
|
+
let [settings, setSettings] = useState(defaultSettings), [tone, setTone] = useState("accent"), [variant, setVariant] = useState("link.standalone"), [copyState, setCopyState] = useState("idle"), output = useMemo(() => buildOutput(settings), [settings]), previewStyle = linkStyle({ settings, tone, variant }), updateNumber = (key, value) => {
|
|
478
435
|
setSettings((current) => ({ ...current, [key]: value }));
|
|
479
|
-
}
|
|
480
|
-
const updateText = (key, value) => {
|
|
436
|
+
}, updateText = (key, value) => {
|
|
481
437
|
setSettings((current) => ({ ...current, [key]: value }));
|
|
438
|
+
}, reset = () => setSettings(defaultSettings), copyOutput = async () => {
|
|
439
|
+
await navigator.clipboard.writeText(output), setCopyState("copied"), window.setTimeout(() => setCopyState("idle"), 1200);
|
|
482
440
|
};
|
|
483
|
-
|
|
484
|
-
const copyOutput = async () => {
|
|
485
|
-
await navigator.clipboard.writeText(output);
|
|
486
|
-
setCopyState("copied");
|
|
487
|
-
window.setTimeout(() => setCopyState("idle"), 1200);
|
|
488
|
-
};
|
|
489
|
-
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-[#fafafa] text-foreground-1", children: /* @__PURE__ */ jsxs("div", { className: "grid min-h-screen lg:grid-cols-[1fr_24rem]", children: [
|
|
441
|
+
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-surface-page text-foreground-1", children: /* @__PURE__ */ jsxs("div", { className: "grid min-h-screen lg:grid-cols-[1fr_24rem]", children: [
|
|
490
442
|
/* @__PURE__ */ jsx("main", { className: "min-h-screen overflow-hidden", children: /* @__PURE__ */ jsxs("div", { className: "grid border-l border-t border-stroke-3", children: [
|
|
491
443
|
/* @__PURE__ */ jsx(PreviewBlock, { title: "Link", children: /* @__PURE__ */ jsx(LinkSet, { settings }) }),
|
|
492
444
|
/* @__PURE__ */ jsx(PreviewBlock, { title: "Focused sample", children: /* @__PURE__ */ jsxs("div", { className: "grid justify-items-center gap-5 text-[2rem] leading-none", children: [
|
|
@@ -776,7 +728,7 @@ function LinkPlayground() {
|
|
|
776
728
|
"textarea",
|
|
777
729
|
{
|
|
778
730
|
className: "min-h-[26rem] resize-none rounded-panel border border-stroke-2 bg-surface-2 p-3 font-mono text-xs leading-5 text-foreground-1 outline-none focus:border-accent-1",
|
|
779
|
-
readOnly:
|
|
731
|
+
readOnly: !0,
|
|
780
732
|
value: output
|
|
781
733
|
}
|
|
782
734
|
),
|
|
@@ -1,39 +1,17 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import {
|
|
3
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
4
|
-
var twMerge = extendTailwindMerge({
|
|
5
|
-
extend: {
|
|
6
|
-
classGroups: {
|
|
7
|
-
z: [
|
|
8
|
-
"z-content",
|
|
9
|
-
"z-nav",
|
|
10
|
-
"z-overlay",
|
|
11
|
-
"z-modal",
|
|
12
|
-
"z-search",
|
|
13
|
-
"z-toast",
|
|
14
|
-
"z-progress"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
function cn(...inputs) {
|
|
20
|
-
return twMerge(clsx(inputs));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// src/kernel/components/blocks/logo-block.tsx
|
|
1
|
+
// src/components/block/logo-block.tsx
|
|
2
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
24
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
25
|
-
var DEFAULT_LOGO_MAX_HEIGHT = 24;
|
|
26
|
-
var DEFAULT_LOGO_MAX_WIDTH = 160;
|
|
4
|
+
var DEFAULT_LOGO_MAX_HEIGHT = 24, DEFAULT_LOGO_MAX_WIDTH = 160;
|
|
27
5
|
function isValidLogoAsset(asset) {
|
|
28
|
-
return typeof asset?.outputPath
|
|
6
|
+
return typeof asset?.outputPath == "string" && asset.outputPath.trim() !== "";
|
|
29
7
|
}
|
|
30
8
|
function fitLogoDimensions({
|
|
31
9
|
asset,
|
|
32
10
|
maxHeight,
|
|
33
11
|
maxWidth
|
|
34
12
|
}) {
|
|
35
|
-
if (!asset.width || !asset.height) return
|
|
36
|
-
|
|
13
|
+
if (!asset.width || !asset.height) return;
|
|
14
|
+
let scale = Math.min(maxWidth / asset.width, maxHeight / asset.height, 1);
|
|
37
15
|
return {
|
|
38
16
|
height: Math.max(1, Math.round(asset.height * scale)),
|
|
39
17
|
width: Math.max(1, Math.round(asset.width * scale))
|
|
@@ -84,24 +62,17 @@ function LogoBlock({
|
|
|
84
62
|
maxWidth = DEFAULT_LOGO_MAX_WIDTH,
|
|
85
63
|
siteName
|
|
86
64
|
}) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
maxHeight,
|
|
99
|
-
maxWidth,
|
|
100
|
-
siteName
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
|
+
let lightCandidate = logo?.light, darkCandidate = logo?.dark, lightLogo = isValidLogoAsset(lightCandidate) ? lightCandidate : darkCandidate, darkLogo = isValidLogoAsset(darkCandidate) ? darkCandidate : lightLogo;
|
|
66
|
+
return isValidLogoAsset(lightLogo) ? !isValidLogoAsset(darkLogo) || darkLogo.outputPath === lightLogo.outputPath ? /* @__PURE__ */ jsx(
|
|
67
|
+
LogoBlockImage,
|
|
68
|
+
{
|
|
69
|
+
asset: lightLogo,
|
|
70
|
+
className,
|
|
71
|
+
maxHeight,
|
|
72
|
+
maxWidth,
|
|
73
|
+
siteName
|
|
74
|
+
}
|
|
75
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
105
76
|
/* @__PURE__ */ jsx("span", { className: "block dark:hidden", children: /* @__PURE__ */ jsx(
|
|
106
77
|
LogoBlockImage,
|
|
107
78
|
{
|
|
@@ -122,7 +93,7 @@ function LogoBlock({
|
|
|
122
93
|
siteName
|
|
123
94
|
}
|
|
124
95
|
) })
|
|
125
|
-
] });
|
|
96
|
+
] }) : /* @__PURE__ */ jsx(Fragment, { children: siteName });
|
|
126
97
|
}
|
|
127
98
|
export {
|
|
128
99
|
LogoBlock
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { SiteData, TreeNode } from '
|
|
2
|
+
import { S as SiteData, T as TreeNode } from '../../../types-B_b3C0U6.js';
|
|
3
3
|
|
|
4
4
|
declare function NavBreadcrumb({ currentPath, showRoot, site, tree, }: {
|
|
5
5
|
currentPath?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import { CollapsibleBreadcrumbTrail } from "
|
|
1
|
+
// src/components/block/navigation/nav-breadcrumb.tsx
|
|
2
|
+
import { CollapsibleBreadcrumbTrail } from "@publish.os/nextjs/kernel/components/ui/breadcrumb-trail";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
function titleFor(node) {
|
|
5
5
|
return node.title;
|
|
@@ -7,33 +7,25 @@ function titleFor(node) {
|
|
|
7
7
|
function pathFor(node) {
|
|
8
8
|
if (node.type === "page") return node.path;
|
|
9
9
|
if (node.type === "link") return node.href;
|
|
10
|
-
if (node.type === "folder") return node.path;
|
|
11
|
-
if (node.type === "section") return node.path;
|
|
12
|
-
return void 0;
|
|
10
|
+
if (node.type === "folder" || node.type === "section") return node.path;
|
|
13
11
|
}
|
|
14
12
|
function rankFor(node) {
|
|
15
|
-
|
|
16
|
-
if (node.type === "folder") return 1;
|
|
17
|
-
return 0;
|
|
13
|
+
return node.type === "page" || node.type === "section" ? 2 : node.type === "folder" ? 1 : 0;
|
|
18
14
|
}
|
|
19
15
|
function findCrumbs(nodes, pathname, parents = []) {
|
|
20
|
-
|
|
21
|
-
for (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
if (node.type === "section" || node.type === "folder") {
|
|
35
|
-
const childMatch = findCrumbs(node.children, pathname, nextParents);
|
|
36
|
-
if (childMatch) matches.push(childMatch);
|
|
16
|
+
let matches = [];
|
|
17
|
+
for (let node of nodes) {
|
|
18
|
+
let path = pathFor(node), nextParents = path ? [...parents, { title: titleFor(node), path }] : parents;
|
|
19
|
+
if (path === pathname && matches.push({
|
|
20
|
+
crumbs: nextParents.map((crumb, index) => ({
|
|
21
|
+
...crumb,
|
|
22
|
+
current: index === nextParents.length - 1
|
|
23
|
+
})),
|
|
24
|
+
pathLength: path.length,
|
|
25
|
+
rank: rankFor(node)
|
|
26
|
+
}), node.type === "section" || node.type === "folder") {
|
|
27
|
+
let childMatch = findCrumbs(node.children, pathname, nextParents);
|
|
28
|
+
childMatch && matches.push(childMatch);
|
|
37
29
|
}
|
|
38
30
|
}
|
|
39
31
|
return matches.sort(
|
|
@@ -41,48 +33,42 @@ function findCrumbs(nodes, pathname, parents = []) {
|
|
|
41
33
|
)[0] ?? null;
|
|
42
34
|
}
|
|
43
35
|
function groupFallback(tree, pathname) {
|
|
44
|
-
|
|
45
|
-
(entry) => typeof entry.path
|
|
36
|
+
let groups = tree.map((group) => ({ group, path: pathFor(group) })).filter(
|
|
37
|
+
(entry) => typeof entry.path == "string"
|
|
46
38
|
).sort((a, b) => b.path.length - a.path.length);
|
|
47
|
-
for (
|
|
48
|
-
if (pathname.startsWith(`${path}/`))
|
|
39
|
+
for (let { group, path } of groups)
|
|
40
|
+
if (pathname.startsWith(`${path}/`))
|
|
49
41
|
return [{ title: titleFor(group), path }];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
42
|
return [];
|
|
53
43
|
}
|
|
54
44
|
function buildCrumbs(site, tree, pathname) {
|
|
55
|
-
|
|
45
|
+
let root = {
|
|
56
46
|
title: site.name,
|
|
57
47
|
path: "/",
|
|
58
48
|
current: pathname === "/"
|
|
59
49
|
};
|
|
60
50
|
if (pathname === "/") return [root];
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return [
|
|
51
|
+
let treeMatch = findCrumbs(tree, pathname);
|
|
52
|
+
return treeMatch ? [root, ...treeMatch.crumbs] : [
|
|
64
53
|
root,
|
|
65
54
|
...groupFallback(tree, pathname).map((crumb) => ({
|
|
66
55
|
...crumb,
|
|
67
|
-
current:
|
|
56
|
+
current: !1
|
|
68
57
|
}))
|
|
69
58
|
];
|
|
70
59
|
}
|
|
71
60
|
function NavBreadcrumb({
|
|
72
61
|
currentPath = "/",
|
|
73
|
-
showRoot =
|
|
62
|
+
showRoot = !0,
|
|
74
63
|
site,
|
|
75
64
|
tree
|
|
76
65
|
}) {
|
|
77
|
-
|
|
78
|
-
const visibleCrumbs = showRoot ? crumbs : crumbs.slice(1);
|
|
79
|
-
const items = visibleCrumbs.map((crumb) => ({
|
|
66
|
+
let crumbs = buildCrumbs(site, tree, currentPath), items = (showRoot ? crumbs : crumbs.slice(1)).map((crumb) => ({
|
|
80
67
|
current: crumb.current,
|
|
81
68
|
href: crumb.path,
|
|
82
69
|
title: crumb.title
|
|
83
70
|
}));
|
|
84
|
-
|
|
85
|
-
return /* @__PURE__ */ jsx(CollapsibleBreadcrumbTrail, { items, size: "sm" });
|
|
71
|
+
return items.length === 0 ? null : /* @__PURE__ */ jsx(CollapsibleBreadcrumbTrail, { items, size: "sm" });
|
|
86
72
|
}
|
|
87
73
|
export {
|
|
88
74
|
NavBreadcrumb
|