@publish.os/nextjs 0.0.1-alpha.6 → 0.0.1-alpha.7
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 +2 -2
- 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,19 +1,19 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import { Blockquote } from "
|
|
3
|
-
import { Callout } from "
|
|
4
|
-
import { CodeBlock } from "
|
|
5
|
-
import { Figure } from "
|
|
6
|
-
import { FigureCaption } from "
|
|
7
|
-
import { Footnotes } from "
|
|
8
|
-
import { Heading } from "
|
|
9
|
-
import { Hr } from "
|
|
10
|
-
import { Image } from "
|
|
11
|
-
import { InlineCode } from "
|
|
12
|
-
import { Kbd } from "
|
|
13
|
-
import { Link } from "
|
|
14
|
-
import { Paragraph } from "
|
|
15
|
-
import { Pre } from "
|
|
16
|
-
import { Strikethrough } from "
|
|
1
|
+
// src/components/mdx/mdx.tsx
|
|
2
|
+
import { Blockquote } from "@publish.os/nextjs/kernel/components/mdx/components/blockquote";
|
|
3
|
+
import { Callout } from "@publish.os/nextjs/kernel/components/mdx/components/callout";
|
|
4
|
+
import { CodeBlock } from "@publish.os/nextjs/kernel/components/mdx/components/code-block";
|
|
5
|
+
import { Figure } from "@publish.os/nextjs/kernel/components/mdx/components/figure";
|
|
6
|
+
import { FigureCaption } from "@publish.os/nextjs/kernel/components/mdx/components/figure-caption";
|
|
7
|
+
import { Footnotes } from "@publish.os/nextjs/kernel/components/mdx/components/footnotes";
|
|
8
|
+
import { Heading } from "@publish.os/nextjs/kernel/components/mdx/components/heading";
|
|
9
|
+
import { Hr } from "@publish.os/nextjs/kernel/components/mdx/components/hr";
|
|
10
|
+
import { Image } from "@publish.os/nextjs/kernel/components/mdx/components/image";
|
|
11
|
+
import { InlineCode } from "@publish.os/nextjs/kernel/components/mdx/components/inline-code";
|
|
12
|
+
import { Kbd } from "@publish.os/nextjs/kernel/components/mdx/components/kbd";
|
|
13
|
+
import { Link } from "@publish.os/nextjs/kernel/components/mdx/components/link";
|
|
14
|
+
import { Paragraph } from "@publish.os/nextjs/kernel/components/mdx/components/paragraph";
|
|
15
|
+
import { Pre } from "@publish.os/nextjs/kernel/components/mdx/components/pre";
|
|
16
|
+
import { Strikethrough } from "@publish.os/nextjs/kernel/components/mdx/components/strikethrough";
|
|
17
17
|
import {
|
|
18
18
|
Table,
|
|
19
19
|
TableBodyGroup,
|
|
@@ -21,17 +21,17 @@ import {
|
|
|
21
21
|
TableHeaderCell,
|
|
22
22
|
TableHeadGroup,
|
|
23
23
|
TableRowGroup
|
|
24
|
-
} from "
|
|
25
|
-
import { TaskList, TaskListInput } from "
|
|
26
|
-
import { Video } from "
|
|
27
|
-
import { MDXErrorBoundary } from "
|
|
28
|
-
import { rehypeHeadingIds } from "
|
|
24
|
+
} from "@publish.os/nextjs/kernel/components/mdx/components/table";
|
|
25
|
+
import { TaskList, TaskListInput } from "@publish.os/nextjs/kernel/components/mdx/components/task-list";
|
|
26
|
+
import { Video } from "@publish.os/nextjs/kernel/components/mdx/components/video";
|
|
27
|
+
import { MDXErrorBoundary } from "@publish.os/nextjs/kernel/components/mdx/error-boundary";
|
|
28
|
+
import { rehypeHeadingIds } from "@publish.os/nextjs/kernel/components/mdx/rehype-heading-ids";
|
|
29
29
|
import { compileMDX } from "next-mdx-remote/rsc";
|
|
30
30
|
import remarkGfm from "remark-gfm";
|
|
31
|
-
import { Figure as Figure2 } from "
|
|
32
|
-
import { Image as Image2 } from "
|
|
33
|
-
import { Link as Link2 } from "
|
|
34
|
-
import { Video as Video2 } from "
|
|
31
|
+
import { Figure as Figure2 } from "@publish.os/nextjs/kernel/components/mdx/components/figure";
|
|
32
|
+
import { Image as Image2 } from "@publish.os/nextjs/kernel/components/mdx/components/image";
|
|
33
|
+
import { Link as Link2 } from "@publish.os/nextjs/kernel/components/mdx/components/link";
|
|
34
|
+
import { Video as Video2 } from "@publish.os/nextjs/kernel/components/mdx/components/video";
|
|
35
35
|
import { jsx } from "react/jsx-runtime";
|
|
36
36
|
var defaultMdxComponents = {
|
|
37
37
|
h1: (props) => /* @__PURE__ */ jsx(Heading, { as: "h1", ...props }),
|
|
@@ -72,11 +72,11 @@ function getErrorMessage(error) {
|
|
|
72
72
|
return error instanceof Error ? error.message : "An error occurred while rendering the content";
|
|
73
73
|
}
|
|
74
74
|
async function MDX({ components, content, pageId, slug }) {
|
|
75
|
-
|
|
75
|
+
let mdx = await compileMDX({
|
|
76
76
|
source: content,
|
|
77
77
|
components: { ...defaultMdxComponents, ...components ?? {} },
|
|
78
78
|
options: {
|
|
79
|
-
parseFrontmatter:
|
|
79
|
+
parseFrontmatter: !1,
|
|
80
80
|
mdxOptions: {
|
|
81
81
|
rehypePlugins: [rehypeHeadingIds],
|
|
82
82
|
remarkPlugins: [remarkGfm]
|
|
@@ -95,11 +95,11 @@ async function MDX({ components, content, pageId, slug }) {
|
|
|
95
95
|
errorMessage: mdx.errorMessage,
|
|
96
96
|
pageId,
|
|
97
97
|
slug,
|
|
98
|
-
children: /* @__PURE__ */ jsx("div", { className: "markdown-prose", "data-publishos-mdx-root":
|
|
98
|
+
children: /* @__PURE__ */ jsx("div", { className: "markdown-prose", "data-publishos-mdx-root": !0, children: mdx.compiledContent })
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
|
-
Object.defineProperty(MDX, "__publishOsMdx", { value:
|
|
102
|
+
Object.defineProperty(MDX, "__publishOsMdx", { value: !0 });
|
|
103
103
|
export {
|
|
104
104
|
Figure2 as Figure,
|
|
105
105
|
Image2 as Image,
|
|
@@ -1,83 +1,27 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var MDX_ITALIC_RE = /\*(.*?)\*/g;
|
|
7
|
-
var MDX_UNDERLINE_BOLD_RE = /__(.*?)__/g;
|
|
8
|
-
var MDX_UNDERLINE_ITALIC_RE = /_(.*?)_/g;
|
|
9
|
-
var MDX_STRIKETHROUGH_RE = /~~(.*?)~~/g;
|
|
10
|
-
var MDX_INLINE_CODE_RE = /`(.*?)`/g;
|
|
11
|
-
var MDX_LINK_RE = /\[(.*?)\]\(.*?\)/g;
|
|
12
|
-
var NON_ALPHANUMERIC_RE = /[^a-z0-9]+/g;
|
|
13
|
-
var LEADING_TRAILING_HYPHEN_RE = /^-+|-+$/g;
|
|
14
|
-
var LEADING_DIGIT_RE = /^(\d)/;
|
|
15
|
-
function extractText(node) {
|
|
16
|
-
if (typeof node === "string") return node;
|
|
17
|
-
if (typeof node === "number") return String(node);
|
|
18
|
-
if (node == null || typeof node === "boolean") return "";
|
|
19
|
-
if (Array.isArray(node)) {
|
|
20
|
-
return node.map(extractText).join("");
|
|
21
|
-
}
|
|
22
|
-
if (isValidElement(node)) {
|
|
23
|
-
const element = node;
|
|
24
|
-
return element.props.children === void 0 ? "" : extractText(element.props.children);
|
|
25
|
-
}
|
|
26
|
-
return "";
|
|
27
|
-
}
|
|
28
|
-
function cleanHeadingText(input) {
|
|
29
|
-
const text = typeof input === "string" ? input : extractText(input);
|
|
30
|
-
return text.replace(SELF_CLOSING_TAG_RE, "").replace(PAIRED_TAG_RE, "").replace(MDX_BOLD_RE, "$1").replace(MDX_ITALIC_RE, "$1").replace(MDX_UNDERLINE_BOLD_RE, "$1").replace(MDX_UNDERLINE_ITALIC_RE, "$1").replace(MDX_STRIKETHROUGH_RE, "$1").replace(MDX_INLINE_CODE_RE, "$1").replace(MDX_LINK_RE, "$1").trim();
|
|
31
|
-
}
|
|
32
|
-
function slugify(text) {
|
|
33
|
-
return text.toLowerCase().replace(NON_ALPHANUMERIC_RE, "-").replace(LEADING_TRAILING_HYPHEN_RE, "").replace(LEADING_DIGIT_RE, "id-$1");
|
|
34
|
-
}
|
|
35
|
-
function headingToHTMLId(input) {
|
|
36
|
-
try {
|
|
37
|
-
const id = slugify(cleanHeadingText(input));
|
|
38
|
-
return id || "empty-heading";
|
|
39
|
-
} catch {
|
|
40
|
-
return "empty-heading";
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function createHeadingIdGenerator() {
|
|
44
|
-
const usedIds = /* @__PURE__ */ new Map();
|
|
45
|
-
return (input) => {
|
|
46
|
-
const baseId = headingToHTMLId(input);
|
|
47
|
-
if (baseId === "empty-heading") return baseId;
|
|
48
|
-
const count = usedIds.get(baseId) ?? 0;
|
|
49
|
-
usedIds.set(baseId, count + 1);
|
|
50
|
-
return count === 0 ? baseId : `${baseId}-${count}`;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// src/kernel/components/mdx/rehype-heading-ids.ts
|
|
1
|
+
// src/components/mdx/rehype-heading-ids.ts
|
|
2
|
+
import {
|
|
3
|
+
cleanHeadingText,
|
|
4
|
+
createHeadingIdGenerator
|
|
5
|
+
} from "@publish.os/nextjs/utils/heading-ids";
|
|
55
6
|
var HEADING_TAG_RE = /^h[1-6]$/;
|
|
56
7
|
function textFromNode(node) {
|
|
57
|
-
|
|
58
|
-
return typeof node.value === "string" ? node.value : "";
|
|
59
|
-
}
|
|
60
|
-
if (!node.children) return "";
|
|
61
|
-
return node.children.map(textFromNode).join("");
|
|
8
|
+
return node.type === "text" || node.type === "inlineCode" ? typeof node.value == "string" ? node.value : "" : node.children ? node.children.map(textFromNode).join("") : "";
|
|
62
9
|
}
|
|
63
10
|
function visit(node, callback) {
|
|
64
11
|
callback(node);
|
|
65
|
-
for (
|
|
12
|
+
for (let child of node.children ?? [])
|
|
66
13
|
visit(child, callback);
|
|
67
|
-
}
|
|
68
14
|
}
|
|
69
15
|
function rehypeHeadingIds() {
|
|
70
16
|
return (tree) => {
|
|
71
|
-
|
|
17
|
+
let headingId = createHeadingIdGenerator();
|
|
72
18
|
visit(tree, (node) => {
|
|
73
19
|
if (!node.tagName || !HEADING_TAG_RE.test(node.tagName)) return;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (!text || id === "empty-heading") return;
|
|
77
|
-
node.properties = {
|
|
20
|
+
let text = cleanHeadingText(textFromNode(node)), id = headingId(text);
|
|
21
|
+
!text || id === "empty-heading" || (node.properties = {
|
|
78
22
|
...node.properties,
|
|
79
23
|
id
|
|
80
|
-
};
|
|
24
|
+
});
|
|
81
25
|
});
|
|
82
26
|
};
|
|
83
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MDXComponents as MDXComponents$1 } from 'mdx/types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
type MDXComponents = MDXComponents$1;
|
|
5
5
|
type HeadingElement = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/
|
|
3
|
+
// src/components/ui/accordion.tsx
|
|
4
4
|
import { Accordion as BaseAccordion } from "@base-ui/react/accordion";
|
|
5
|
-
|
|
6
|
-
// src/utils/cn.ts
|
|
7
|
-
import { clsx } from "clsx";
|
|
8
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
9
|
-
var twMerge = extendTailwindMerge({
|
|
10
|
-
extend: {
|
|
11
|
-
classGroups: {
|
|
12
|
-
z: [
|
|
13
|
-
"z-content",
|
|
14
|
-
"z-nav",
|
|
15
|
-
"z-overlay",
|
|
16
|
-
"z-modal",
|
|
17
|
-
"z-search",
|
|
18
|
-
"z-toast",
|
|
19
|
-
"z-progress"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
function cn(...inputs) {
|
|
25
|
-
return twMerge(clsx(inputs));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// src/kernel/components/ui/accordion.tsx
|
|
5
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
29
6
|
import { jsx } from "react/jsx-runtime";
|
|
30
7
|
function Accordion(props) {
|
|
31
8
|
return /* @__PURE__ */ jsx(BaseAccordion.Root, { ...props });
|
|
@@ -51,7 +28,7 @@ function AccordionTrigger({
|
|
|
51
28
|
{
|
|
52
29
|
className: cn(
|
|
53
30
|
"flex w-full items-center justify-between gap-4 py-3 text-left text-sm font-medium text-foreground-1 transition-colors hover:bg-surface-hover",
|
|
54
|
-
"focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-
|
|
31
|
+
"focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-stroke",
|
|
55
32
|
className
|
|
56
33
|
),
|
|
57
34
|
...props
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
5
|
-
import '
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { a as LinkStyleVariant, b as LinkButtonVariant } from '../../../link-CYaCRDb6.js';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
declare const breadcrumbVariants: (props?: ({
|
|
8
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
type BreadcrumbVariantProps = VariantProps<typeof breadcrumbVariants>;
|
|
11
|
+
type BreadcrumbStyleVariant = "default" | `link.${LinkStyleVariant}` | LinkButtonVariant;
|
|
12
|
+
type BreadcrumbSizeProps = Pick<BreadcrumbVariantProps, "size">;
|
|
13
|
+
type BreadcrumbStyleProps = {
|
|
14
|
+
variant?: BreadcrumbStyleVariant;
|
|
15
|
+
};
|
|
16
|
+
type BreadcrumbTrailItem = {
|
|
17
|
+
current?: boolean;
|
|
18
|
+
href: string;
|
|
19
|
+
title: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
type BreadcrumbTrailProps = {
|
|
22
|
+
className?: string;
|
|
23
|
+
items: BreadcrumbTrailItem[];
|
|
24
|
+
} & BreadcrumbSizeProps & BreadcrumbStyleProps;
|
|
9
25
|
|
|
10
26
|
type CollapsibleBreadcrumbTrailProps = BreadcrumbTrailProps & {
|
|
11
27
|
menuLabel?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/
|
|
3
|
+
// src/components/ui/breadcrumb-trail.tsx
|
|
4
4
|
import {
|
|
5
5
|
Breadcrumb,
|
|
6
6
|
BreadcrumbEllipsis,
|
|
@@ -12,58 +12,30 @@ import {
|
|
|
12
12
|
BreadcrumbTrailEntry,
|
|
13
13
|
BreadcrumbTrailMenu,
|
|
14
14
|
breadcrumbVariants
|
|
15
|
-
} from "
|
|
16
|
-
|
|
17
|
-
// src/utils/cn.ts
|
|
18
|
-
import { clsx } from "clsx";
|
|
19
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
20
|
-
var twMerge = extendTailwindMerge({
|
|
21
|
-
extend: {
|
|
22
|
-
classGroups: {
|
|
23
|
-
z: [
|
|
24
|
-
"z-content",
|
|
25
|
-
"z-nav",
|
|
26
|
-
"z-overlay",
|
|
27
|
-
"z-modal",
|
|
28
|
-
"z-search",
|
|
29
|
-
"z-toast",
|
|
30
|
-
"z-progress"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
function cn(...inputs) {
|
|
36
|
-
return twMerge(clsx(inputs));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// src/kernel/components/ui/breadcrumb-trail.tsx
|
|
15
|
+
} from "@publish.os/nextjs/kernel/components/ui/breadcrumb";
|
|
16
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
40
17
|
import { Fragment, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
41
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
42
19
|
function sameIndexes(left, right) {
|
|
43
20
|
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
44
21
|
}
|
|
45
22
|
function leafIndexFor(items) {
|
|
46
|
-
for (let index = items.length - 1; index >= 0; index -= 1)
|
|
23
|
+
for (let index = items.length - 1; index >= 0; index -= 1)
|
|
47
24
|
if (items[index]?.current) return index;
|
|
48
|
-
}
|
|
49
25
|
return items.length - 1;
|
|
50
26
|
}
|
|
51
27
|
function hideOrderFor(items) {
|
|
52
|
-
|
|
28
|
+
let leafIndex = leafIndexFor(items);
|
|
53
29
|
return items.map((_item, index) => index).filter((index) => index > 0 && index !== leafIndex);
|
|
54
30
|
}
|
|
55
31
|
function displayElementsFor({
|
|
56
32
|
hiddenIndexes,
|
|
57
33
|
items
|
|
58
34
|
}) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
items.forEach((item, index) => {
|
|
35
|
+
let elements = [], insertedMenu = !1;
|
|
36
|
+
return items.forEach((item, index) => {
|
|
62
37
|
if (hiddenIndexes.has(index)) {
|
|
63
|
-
|
|
64
|
-
elements.push({ key: "breadcrumb-menu", type: "menu" });
|
|
65
|
-
insertedMenu = true;
|
|
66
|
-
}
|
|
38
|
+
insertedMenu || (elements.push({ key: "breadcrumb-menu", type: "menu" }), insertedMenu = !0);
|
|
67
39
|
return;
|
|
68
40
|
}
|
|
69
41
|
elements.push({
|
|
@@ -72,8 +44,7 @@ function displayElementsFor({
|
|
|
72
44
|
key: item.href,
|
|
73
45
|
type: "item"
|
|
74
46
|
});
|
|
75
|
-
});
|
|
76
|
-
return elements;
|
|
47
|
+
}), elements;
|
|
77
48
|
}
|
|
78
49
|
function widthFor({
|
|
79
50
|
gapWidth,
|
|
@@ -82,13 +53,11 @@ function widthFor({
|
|
|
82
53
|
menuWidth,
|
|
83
54
|
separatorWidth
|
|
84
55
|
}) {
|
|
85
|
-
|
|
56
|
+
let visibleItemWidths = itemWidths.filter(
|
|
86
57
|
(_width, index) => !hiddenIndexes.has(index)
|
|
87
|
-
);
|
|
88
|
-
const elementCount = visibleItemWidths.length + (hiddenIndexes.size > 0 ? 1 : 0);
|
|
58
|
+
), elementCount = visibleItemWidths.length + (hiddenIndexes.size > 0 ? 1 : 0);
|
|
89
59
|
if (elementCount === 0) return 0;
|
|
90
|
-
|
|
91
|
-
const flexChildCount = elementCount + separatorCount;
|
|
60
|
+
let separatorCount = elementCount - 1, flexChildCount = elementCount + separatorCount;
|
|
92
61
|
return visibleItemWidths.reduce((total, width) => total + width, 0) + (hiddenIndexes.size > 0 ? menuWidth : 0) + separatorWidth * separatorCount + gapWidth * Math.max(flexChildCount - 1, 0);
|
|
93
62
|
}
|
|
94
63
|
function CollapsibleBreadcrumbTrail({
|
|
@@ -98,49 +67,36 @@ function CollapsibleBreadcrumbTrail({
|
|
|
98
67
|
size,
|
|
99
68
|
variant
|
|
100
69
|
}) {
|
|
101
|
-
|
|
102
|
-
const measureListRef = useRef(null);
|
|
103
|
-
const [hiddenIndexes, setHiddenIndexes] = useState(
|
|
70
|
+
let rootRef = useRef(null), measureListRef = useRef(null), [hiddenIndexes, setHiddenIndexes] = useState(
|
|
104
71
|
() => hideOrderFor(items)
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const elements = displayElementsFor({ hiddenIndexes: hiddenIndexSet, items });
|
|
109
|
-
useLayoutEffect(() => {
|
|
110
|
-
const root = rootRef.current;
|
|
111
|
-
const measureList = measureListRef.current;
|
|
72
|
+
), hiddenIndexSet = useMemo(() => new Set(hiddenIndexes), [hiddenIndexes]), hiddenItems = items.filter((_item, index) => hiddenIndexSet.has(index)), elements = displayElementsFor({ hiddenIndexes: hiddenIndexSet, items });
|
|
73
|
+
return useLayoutEffect(() => {
|
|
74
|
+
let root = rootRef.current, measureList = measureListRef.current;
|
|
112
75
|
if (!root || !measureList) return;
|
|
113
|
-
let animationFrame = 0
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
animationFrame = requestAnimationFrame(() => {
|
|
117
|
-
const availableWidth = root.clientWidth;
|
|
76
|
+
let animationFrame = 0, measure = () => {
|
|
77
|
+
cancelAnimationFrame(animationFrame), animationFrame = requestAnimationFrame(() => {
|
|
78
|
+
let availableWidth = root.clientWidth;
|
|
118
79
|
if (availableWidth <= 0) return;
|
|
119
|
-
|
|
80
|
+
let itemWidths = Array.from(
|
|
120
81
|
measureList.querySelectorAll(
|
|
121
82
|
"[data-breadcrumb-measure-item]"
|
|
122
83
|
)
|
|
123
|
-
).map((node) => node.offsetWidth)
|
|
124
|
-
const separatorWidth = measureList.querySelector(
|
|
84
|
+
).map((node) => node.offsetWidth), separatorWidth = measureList.querySelector(
|
|
125
85
|
"[data-breadcrumb-measure-separator]"
|
|
126
|
-
)?.offsetWidth ?? 0
|
|
127
|
-
const menuWidth = measureList.querySelector(
|
|
86
|
+
)?.offsetWidth ?? 0, menuWidth = measureList.querySelector(
|
|
128
87
|
"[data-breadcrumb-measure-menu]"
|
|
129
|
-
)?.offsetWidth ?? 0;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
for (const index of hideOrderFor(items)) {
|
|
133
|
-
const measuredWidth = widthFor({
|
|
88
|
+
)?.offsetWidth ?? 0, gapWidth = Number.parseFloat(getComputedStyle(measureList).columnGap) || 0, nextHiddenIndexes = /* @__PURE__ */ new Set();
|
|
89
|
+
for (let index of hideOrderFor(items)) {
|
|
90
|
+
if (widthFor({
|
|
134
91
|
gapWidth,
|
|
135
92
|
hiddenIndexes: nextHiddenIndexes,
|
|
136
93
|
itemWidths,
|
|
137
94
|
menuWidth,
|
|
138
95
|
separatorWidth
|
|
139
|
-
});
|
|
140
|
-
if (measuredWidth <= availableWidth + 1) break;
|
|
96
|
+
}) <= availableWidth + 1) break;
|
|
141
97
|
nextHiddenIndexes.add(index);
|
|
142
98
|
}
|
|
143
|
-
|
|
99
|
+
let next = Array.from(nextHiddenIndexes).sort(
|
|
144
100
|
(left, right) => left - right
|
|
145
101
|
);
|
|
146
102
|
setHiddenIndexes(
|
|
@@ -149,15 +105,11 @@ function CollapsibleBreadcrumbTrail({
|
|
|
149
105
|
});
|
|
150
106
|
};
|
|
151
107
|
measure();
|
|
152
|
-
|
|
153
|
-
resizeObserver.observe(root)
|
|
154
|
-
|
|
155
|
-
return () => {
|
|
156
|
-
cancelAnimationFrame(animationFrame);
|
|
157
|
-
resizeObserver.disconnect();
|
|
108
|
+
let resizeObserver = new ResizeObserver(measure);
|
|
109
|
+
return resizeObserver.observe(root), resizeObserver.observe(measureList), () => {
|
|
110
|
+
cancelAnimationFrame(animationFrame), resizeObserver.disconnect();
|
|
158
111
|
};
|
|
159
|
-
}, [items])
|
|
160
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("relative min-w-0", className), ref: rootRef, children: [
|
|
112
|
+
}, [items]), /* @__PURE__ */ jsxs("div", { className: cn("relative min-w-0", className), ref: rootRef, children: [
|
|
161
113
|
/* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsx(BreadcrumbList, { className: "flex-nowrap overflow-hidden", size, children: elements.map((element, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
162
114
|
index > 0 ? /* @__PURE__ */ jsx(BreadcrumbSeparator, { className: "shrink-0", size }) : null,
|
|
163
115
|
element.type === "menu" ? /* @__PURE__ */ jsx(
|
|
@@ -182,7 +134,7 @@ function CollapsibleBreadcrumbTrail({
|
|
|
182
134
|
{
|
|
183
135
|
"aria-hidden": "true",
|
|
184
136
|
className: "pointer-events-none absolute left-0 top-0 h-0 overflow-hidden",
|
|
185
|
-
inert:
|
|
137
|
+
inert: !0,
|
|
186
138
|
style: { visibility: "hidden" },
|
|
187
139
|
children: /* @__PURE__ */ jsxs(
|
|
188
140
|
"ol",
|
|
@@ -3,7 +3,7 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
|
|
|
3
3
|
import { LinkStyleVariant, LinkButtonVariant } from './link.js';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
import NextLink from 'next/link';
|
|
6
|
-
import {
|
|
6
|
+
import { ComponentPropsWithoutRef, ReactNode, HTMLAttributes } from 'react';
|
|
7
7
|
import './button.js';
|
|
8
8
|
|
|
9
9
|
declare const breadcrumbVariants: (props?: ({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import { buttonVariants } from "
|
|
1
|
+
// src/components/ui/breadcrumb.tsx
|
|
2
|
+
import { buttonVariants } from "@publish.os/nextjs/kernel/components/ui/button";
|
|
3
3
|
import {
|
|
4
4
|
linkVariants
|
|
5
|
-
} from "
|
|
5
|
+
} from "@publish.os/nextjs/kernel/components/ui/link";
|
|
6
6
|
import {
|
|
7
7
|
Menu,
|
|
8
8
|
MenuLinkItem,
|
|
@@ -10,31 +10,8 @@ import {
|
|
|
10
10
|
MenuPortal,
|
|
11
11
|
MenuPositioner,
|
|
12
12
|
MenuTrigger
|
|
13
|
-
} from "
|
|
14
|
-
|
|
15
|
-
// src/utils/cn.ts
|
|
16
|
-
import { clsx } from "clsx";
|
|
17
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
18
|
-
var twMerge = extendTailwindMerge({
|
|
19
|
-
extend: {
|
|
20
|
-
classGroups: {
|
|
21
|
-
z: [
|
|
22
|
-
"z-content",
|
|
23
|
-
"z-nav",
|
|
24
|
-
"z-overlay",
|
|
25
|
-
"z-modal",
|
|
26
|
-
"z-search",
|
|
27
|
-
"z-toast",
|
|
28
|
-
"z-progress"
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
function cn(...inputs) {
|
|
34
|
-
return twMerge(clsx(inputs));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// src/kernel/components/ui/breadcrumb.tsx
|
|
13
|
+
} from "@publish.os/nextjs/kernel/components/ui/menu";
|
|
14
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
38
15
|
import { cva } from "class-variance-authority";
|
|
39
16
|
import NextLink from "next/link";
|
|
40
17
|
import {
|
|
@@ -57,8 +34,7 @@ var breadcrumbVariants = cva(
|
|
|
57
34
|
size: "md"
|
|
58
35
|
}
|
|
59
36
|
}
|
|
60
|
-
)
|
|
61
|
-
var breadcrumbItemVariants = cva("inline-flex min-w-0 items-center", {
|
|
37
|
+
), breadcrumbItemVariants = cva("inline-flex min-w-0 items-center", {
|
|
62
38
|
variants: {
|
|
63
39
|
size: {
|
|
64
40
|
xs: "gap-1",
|
|
@@ -71,8 +47,7 @@ var breadcrumbItemVariants = cva("inline-flex min-w-0 items-center", {
|
|
|
71
47
|
defaultVariants: {
|
|
72
48
|
size: "md"
|
|
73
49
|
}
|
|
74
|
-
})
|
|
75
|
-
var breadcrumbTextVariants = cva("", {
|
|
50
|
+
}), breadcrumbTextVariants = cva("", {
|
|
76
51
|
variants: {
|
|
77
52
|
size: {
|
|
78
53
|
xs: "text-xs",
|
|
@@ -82,11 +57,10 @@ var breadcrumbTextVariants = cva("", {
|
|
|
82
57
|
xl: "text-base"
|
|
83
58
|
}
|
|
84
59
|
}
|
|
85
|
-
})
|
|
86
|
-
var breadcrumbDefaultVariants = cva(
|
|
60
|
+
}), breadcrumbDefaultVariants = cva(
|
|
87
61
|
[
|
|
88
62
|
"inline-flex min-w-0 max-w-full truncate rounded-button text-foreground-2 opacity-100 transition-[color,opacity] hover:text-foreground-1 hover:opacity-90",
|
|
89
|
-
"focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-
|
|
63
|
+
"focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-stroke",
|
|
90
64
|
"data-[state=path-active]:text-foreground-1 data-[state=path-active]:opacity-100"
|
|
91
65
|
].join(" "),
|
|
92
66
|
{
|
|
@@ -100,8 +74,7 @@ var breadcrumbDefaultVariants = cva(
|
|
|
100
74
|
}
|
|
101
75
|
}
|
|
102
76
|
}
|
|
103
|
-
)
|
|
104
|
-
var breadcrumbPageVariants = cva("", {
|
|
77
|
+
), breadcrumbPageVariants = cva("", {
|
|
105
78
|
variants: {
|
|
106
79
|
size: {
|
|
107
80
|
xs: "text-xs",
|
|
@@ -111,8 +84,7 @@ var breadcrumbPageVariants = cva("", {
|
|
|
111
84
|
xl: "text-base"
|
|
112
85
|
}
|
|
113
86
|
}
|
|
114
|
-
})
|
|
115
|
-
var breadcrumbEllipsisVariants = cva(
|
|
87
|
+
}), breadcrumbEllipsisVariants = cva(
|
|
116
88
|
"inline-flex items-center justify-center",
|
|
117
89
|
{
|
|
118
90
|
variants: {
|
|
@@ -130,19 +102,13 @@ var breadcrumbEllipsisVariants = cva(
|
|
|
130
102
|
}
|
|
131
103
|
);
|
|
132
104
|
function resolveBreadcrumbVariant(variant) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return {
|
|
141
|
-
buttonVariant: null,
|
|
142
|
-
linkVariant: variant.slice("link.".length)
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
return {
|
|
105
|
+
return variant?.startsWith("button.") ? {
|
|
106
|
+
buttonVariant: variant.slice(7),
|
|
107
|
+
linkVariant: null
|
|
108
|
+
} : variant?.startsWith("link.") ? {
|
|
109
|
+
buttonVariant: null,
|
|
110
|
+
linkVariant: variant.slice(5)
|
|
111
|
+
} : {
|
|
146
112
|
buttonVariant: null,
|
|
147
113
|
linkVariant: null
|
|
148
114
|
};
|
|
@@ -153,7 +119,7 @@ function breadcrumbLinkClasses({
|
|
|
153
119
|
size,
|
|
154
120
|
variant = "default"
|
|
155
121
|
}) {
|
|
156
|
-
|
|
122
|
+
let { buttonVariant, linkVariant } = resolveBreadcrumbVariant(variant);
|
|
157
123
|
return cn(
|
|
158
124
|
buttonVariant ? buttonVariants({ size, variant: buttonVariant }) : linkVariant ? linkVariants({ color: "default", size, variant: linkVariant }) : breadcrumbDefaultVariants({ size }),
|
|
159
125
|
active ? "font-medium" : void 0,
|
|
@@ -225,7 +191,7 @@ function BreadcrumbPage({
|
|
|
225
191
|
{
|
|
226
192
|
"aria-current": "page",
|
|
227
193
|
className: cn(
|
|
228
|
-
variant ? breadcrumbLinkClasses({ active:
|
|
194
|
+
variant ? breadcrumbLinkClasses({ active: !0, size, variant }) : "max-w-full truncate font-medium text-foreground-1 opacity-100",
|
|
229
195
|
breadcrumbPageVariants({ size }),
|
|
230
196
|
className
|
|
231
197
|
),
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
3
|
import { ButtonVariantProps } from './button.js';
|
|
4
|
-
import {
|
|
5
|
-
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { Separator } from '@base-ui/react/separator';
|
|
6
5
|
import { ComponentPropsWithoutRef } from 'react';
|
|
7
|
-
import '
|
|
6
|
+
import { VariantProps } from 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
type SeparatorProps = ComponentPropsWithoutRef<typeof Separator>;
|
|
8
9
|
|
|
9
10
|
declare const buttonGroupVariants: (props?: ({
|
|
10
11
|
orientation?: "horizontal" | "vertical" | null | undefined;
|