@publish.os/nextjs 0.0.1-alpha.81 → 0.0.1-alpha.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler-assets/nextjs/defaults/app/globals.css +1 -0
- package/compiler-assets/nextjs/defaults/group/index.tsx +50 -0
- package/compiler-assets/nextjs/defaults/group/layout.tsx +8 -8
- package/compiler-assets/nextjs/defaults/group/page.tsx +44 -43
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +33 -13
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -3
- package/compiler-assets/nextjs/defaults/root/css/animation.css +131 -0
- package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
- package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +4 -1
- package/compiler-assets/nextjs/defaults/root/css/components/menu.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/popover.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/select.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/shadow.css +6 -25
- package/compiler-assets/nextjs/defaults/root/css/typography.css +51 -68
- package/compiler-assets/nextjs/defaults/root/globals.css +25 -0
- package/compiler-assets/nextjs/defaults/root/{page.tsx → index.tsx} +6 -2
- package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -1
- package/compiler-assets/nextjs/defaults/root/theme.css +22 -22
- package/compiler-assets/nextjs/shims/document.tsx +38 -0
- package/compiler-assets/nextjs/shims/generated-group-page.tsx +19 -2
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +18 -2
- package/compiler-assets/nextjs/shims/global-layout.tsx +19 -85
- package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
- package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
- package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
- package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
- package/compiler-assets/nextjs/shims/proxy.ts +143 -65
- package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +76 -15
- package/compiler-assets/nextjs/shims/root-page.tsx +7 -1
- package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +30 -0
- package/compiler-assets/nextjs/shims/site-heading-level.tsx +14 -0
- package/compiler-assets/nextjs/shims/site-mdx-components.tsx +112 -0
- package/compiler-assets/nextjs/shims/site-mdx.tsx +17 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +41 -25
- package/dist/build-operation-5QMLXF7N.js +89 -0
- package/dist/{button-CFdx-ohV.d.ts → button-BdCScEKi.d.ts} +6 -6
- package/dist/capture-local-source-WGGDIUU2.js +258 -0
- package/dist/chunk-22RSSUNV.js +13 -0
- package/dist/chunk-4BC2L2KA.js +620 -0
- package/dist/chunk-5J3YUNRY.js +121 -0
- package/dist/chunk-5KAD7W53.js +248 -0
- package/dist/chunk-6C65KV7O.js +142 -0
- package/dist/chunk-6D2E6UMD.js +695 -0
- package/dist/chunk-7NY22B5U.js +161 -0
- package/dist/chunk-AI2UULNX.js +9 -0
- package/dist/chunk-EFO6AWXN.js +19 -0
- package/dist/chunk-F3AGNDF4.js +2377 -0
- package/dist/chunk-GBPLER5H.js +426 -0
- package/dist/chunk-IL4RJOKI.js +186 -0
- package/dist/chunk-NNBJZPFM.js +193 -0
- package/dist/chunk-ORIUWJBQ.js +58 -0
- package/dist/chunk-OXOFRXEI.js +7129 -0
- package/dist/chunk-UYGCOWRF.js +1709 -0
- package/dist/chunk-WL75GQ5M.js +80 -0
- package/dist/compiler.d.ts +54 -7
- package/dist/compiler.js +121 -13147
- package/dist/components/blocks/agent-actions.d.ts +81 -0
- package/dist/components/blocks/agent-actions.js +594 -0
- package/dist/components/blocks/toc.d.ts +43 -0
- package/dist/components/blocks/toc.js +136 -0
- package/dist/components/ui/button.d.ts +5 -0
- package/dist/components/ui/button.js +94 -0
- package/dist/compose-CVBJRAF6.js +16 -0
- package/dist/config/createNextConfig.js +27 -0
- package/dist/dev-operation-OSHHWRWK.js +1095 -0
- package/dist/framework-selection-ZVO323PK.js +11 -0
- package/dist/ide-support-CU6Z5PVR.js +16 -0
- package/dist/index.d.ts +55 -4
- package/dist/jsx-dev-runtime.d.ts +6 -0
- package/dist/jsx-dev-runtime.js +100 -0
- package/dist/jsx-runtime.d.ts +7 -0
- package/dist/jsx-runtime.js +97 -0
- package/dist/kernel/components/blocks/AgentActions.d.ts +35 -6
- package/dist/kernel/components/blocks/AgentActions.js +401 -150
- package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
- package/dist/kernel/components/blocks/agent-actions.js +594 -0
- package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
- package/dist/kernel/components/blocks/color-palette.js +4 -4
- package/dist/kernel/components/blocks/logo-block.js +3 -3
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +10 -2
- package/dist/kernel/components/blocks/nav-breadcrumb.js +22 -7
- package/dist/kernel/components/blocks/navbar.d.ts +2 -2
- package/dist/kernel/components/blocks/navbar.js +406 -65
- package/dist/kernel/components/blocks/navigation-progress.js +6 -3
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +12 -24
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +7 -6
- package/dist/kernel/components/blocks/search.d.ts +83 -58
- package/dist/kernel/components/blocks/search.js +554 -428
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +12 -10
- package/dist/kernel/components/blocks/sidebar.d.ts +3 -3
- package/dist/kernel/components/blocks/sidebar.js +24 -14
- package/dist/kernel/components/blocks/theme-toggle.d.ts +2 -2
- package/dist/kernel/components/blocks/theme-toggle.js +47 -1
- package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
- package/dist/kernel/components/blocks/toc-client.js +495 -0
- package/dist/kernel/components/blocks/toc.d.ts +19 -1
- package/dist/kernel/components/blocks/toc.js +122 -180
- package/dist/kernel/components/mdx/components/blockquote.js +2 -2
- package/dist/kernel/components/mdx/components/callout.d.ts +5 -7
- package/dist/kernel/components/mdx/components/callout.js +67 -36
- package/dist/kernel/components/mdx/components/code-block.d.ts +5 -2
- package/dist/kernel/components/mdx/components/code-block.js +106 -5
- package/dist/kernel/components/mdx/components/copy-code-button.d.ts +8 -0
- package/dist/kernel/components/mdx/components/copy-code-button.js +61 -0
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
- package/dist/kernel/components/mdx/components/figure-caption.js +4 -3
- package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
- package/dist/kernel/components/mdx/components/figure.js +24 -14
- package/dist/kernel/components/mdx/components/footnotes.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.js +4 -4
- package/dist/kernel/components/mdx/components/heading.js +6 -3
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +2 -2
- package/dist/kernel/components/mdx/components/image.d.ts +1 -1
- package/dist/kernel/components/mdx/components/image.js +94 -68
- package/dist/kernel/components/mdx/components/inline-code.js +2 -2
- package/dist/kernel/components/mdx/components/kbd.d.ts +2 -2
- package/dist/kernel/components/mdx/components/kbd.js +5 -4
- package/dist/kernel/components/mdx/components/link.d.ts +35 -4
- package/dist/kernel/components/mdx/components/link.js +3 -3
- package/dist/kernel/components/mdx/components/paragraph.js +2 -5
- package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.js +2 -2
- package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
- package/dist/kernel/components/mdx/components/video-player.js +8 -4
- package/dist/kernel/components/mdx/components/video.d.ts +5 -3
- package/dist/kernel/components/mdx/components/video.js +8 -6
- package/dist/kernel/components/mdx/error-boundary.js +2 -2
- package/dist/kernel/components/mdx/error-fallback.js +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +28 -14
- package/dist/kernel/components/mdx/mdx.js +336 -63
- package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.js +6 -4
- package/dist/kernel/components/next-image.d.ts +12 -0
- package/dist/kernel/components/next-image.js +61 -0
- package/dist/kernel/components/ui/accordion.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +6 -23
- package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
- package/dist/kernel/components/ui/breadcrumb.d.ts +11 -3
- package/dist/kernel/components/ui/breadcrumb.js +10 -8
- package/dist/kernel/components/ui/button-group.js +8 -7
- package/dist/kernel/components/ui/button.d.ts +58 -6
- package/dist/kernel/components/ui/button.js +43 -39
- package/dist/kernel/components/ui/card.d.ts +2 -2
- package/dist/kernel/components/ui/card.js +1 -1
- package/dist/kernel/components/ui/dialog.js +1 -1
- package/dist/kernel/components/ui/drawer.d.ts +3 -1
- package/dist/kernel/components/ui/drawer.js +6 -2
- package/dist/kernel/components/ui/input.d.ts +2 -2
- package/dist/kernel/components/ui/input.js +1 -1
- package/dist/kernel/components/ui/kbd.js +10 -17
- package/dist/kernel/components/ui/link.d.ts +11 -3
- package/dist/kernel/components/ui/link.js +12 -11
- package/dist/kernel/components/ui/menu.js +6 -6
- package/dist/kernel/components/ui/mod-key.d.ts +10 -0
- package/dist/kernel/components/ui/mod-key.js +36 -0
- package/dist/kernel/components/ui/navigation-menu.js +3 -3
- package/dist/kernel/components/ui/popover.js +1 -1
- package/dist/kernel/components/ui/progress.js +2 -2
- package/dist/kernel/components/ui/scroll-area.js +5 -5
- package/dist/kernel/components/ui/select.js +8 -11
- package/dist/kernel/components/ui/separator.js +1 -1
- package/dist/kernel/components/ui/table.js +1 -1
- package/dist/kernel/components/ui/tabs.js +1 -1
- package/dist/kernel/components/ui/tag.js +1 -1
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/text.js +1 -1
- package/dist/kernel/components/ui/toast.js +1 -1
- package/dist/kernel/components/ui/tooltip.js +1 -1
- package/dist/kernel/defaults.registry.d.ts +11 -24
- package/dist/kernel/defaults.registry.js +11 -26
- package/dist/kernel/routes/agent/markdown.d.ts +3 -1
- package/dist/kernel/routes/agent/markdown.js +219 -48
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +5 -7
- package/dist/kernel/routes/metadata/feed.d.ts +1 -1
- package/dist/kernel/routes/metadata/feed.js +111 -81
- package/dist/kernel/routes/metadata/llms.d.ts +12 -3
- package/dist/kernel/routes/metadata/llms.js +156 -59
- package/dist/kernel/routes/metadata/og-image.js +1 -1
- package/dist/kernel/routes/metadata/robots.d.ts +1 -1
- package/dist/kernel/routes/metadata/robots.js +2 -2
- package/dist/kernel/routes/metadata/sitemap.d.ts +26 -4
- package/dist/kernel/routes/metadata/sitemap.js +206 -38
- package/dist/kernel/routes/not-found.d.ts +34 -0
- package/dist/kernel/routes/not-found.js +213 -0
- package/dist/kernel/routes/pages/group.d.ts +2 -2
- package/dist/kernel/routes/pages/group.js +21 -13
- package/dist/kernel/routes/pages/leaf.d.ts +28 -1
- package/dist/kernel/routes/pages/leaf.js +25 -16
- package/dist/kernel/routes/pages/root.js +19 -13
- package/dist/keyboard-shortcuts.js +1 -1
- package/dist/resolvers/manifest-resolver.js +29 -6
- package/dist/search.d.ts +6 -7
- package/dist/search.js +52 -29
- package/dist/{sidebar-types-Bgchdfd6.d.ts → sidebar-types-DKpR27II.d.ts} +1 -1
- package/dist/theme-scope.js +1 -1
- package/dist/{types-DHBm7-j6.d.ts → types-CJWRG05y.d.ts} +20 -1
- package/dist/{types-B_b3C0U6.d.ts → types-CUtrppxt.d.ts} +8 -2
- package/dist/{types-CIwwieNw.d.ts → types-J2w_puPF.d.ts} +11 -10
- package/dist/types.d.ts +15 -6
- package/dist/utils/heading-ids.js +30 -11
- package/dist/utils/toc-selection.d.ts +7 -0
- package/dist/utils/toc-selection.js +14 -0
- package/dist/validate-local-source-SV44DBQT.js +16 -0
- package/dist/validate-publish-os-source-NZJF3TB2.js +14 -0
- package/init/seed/minimal/.gitignore +1 -0
- package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
- package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
- package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
- package/init/seed/minimal/publish.os/blog/index.tsx +82 -0
- package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
- package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +6 -11
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +6 -7
- package/init/seed/minimal/publish.os/docs/content/{theme.mdx → themes.mdx} +14 -12
- package/init/seed/minimal/publish.os/publish.os.config.json +7 -7
- package/init/seed/minimal/publish.os/theme.css +52 -24
- package/init/seed/minimal/publish.os/tsconfig.json +3 -0
- package/init/seed/minimal/seed.json +12 -2
- package/init/seed/scratch/publish.os/docs/content/get-started.mdx +6 -0
- package/init/seed/scratch/publish.os/publish.os.config.json +4 -0
- package/init/seed/scratch/seed.json +5 -0
- package/package.json +55 -44
- package/release/app/phosphor/package.json +5 -5
- package/release/app/phosphor/pnpm-lock.yaml.template +553 -377
- package/release/app/phosphor/pnpm-workspace.yaml +3 -0
- package/release/compiler/package.json +5 -3
- package/release/compiler/pnpm-lock.yaml.template +500 -303
- package/release/compiler/pnpm-workspace.yaml +3 -0
- package/release/release.json +8 -37
- package/compiler-assets/nextjs/defaults/group/leaf.tsx +0 -48
- package/dist/icons.d.ts +0 -1
- package/dist/icons.js +0 -2
- package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
- package/dist/kernel/components/blocks/design-system-preview.js +0 -648
- package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/link-playground.js +0 -744
- package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
- package/dist/kernel/components/mdx/components/pre.d.ts +0 -6
- package/dist/kernel/components/mdx/components/pre.js +0 -18
- package/dist/kernel/components/ui/meta-key.d.ts +0 -17
- package/dist/kernel/components/ui/meta-key.js +0 -9
- package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
- package/dist/kernel/components/ui/theme-toggle.js +0 -58
- package/dist/kernel/framework-icons.d.ts +0 -1
- package/dist/kernel/framework-icons.js +0 -39
- package/dist/link-CYaCRDb6.d.ts +0 -35
- package/release/app/lucide/package.json +0 -30
- package/release/app/lucide/pnpm-lock.yaml.template +0 -2905
- package/release/app/lucide/pnpm-workspace.yaml +0 -11
- package/release/app/tabler/package.json +0 -30
- package/release/app/tabler/pnpm-lock.yaml.template +0 -2911
- package/release/app/tabler/pnpm-workspace.yaml +0 -11
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
// src/components/mdx/mdx.tsx
|
|
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 {
|
|
16
|
-
import { Strikethrough } from "@publish.os/nextjs/kernel/components/mdx/components/strikethrough";
|
|
2
|
+
import { Blockquote } from "@components/mdx/components/blockquote";
|
|
3
|
+
import { Callout } from "@components/mdx/components/callout";
|
|
4
|
+
import { CodeBlock } from "@components/mdx/components/code-block";
|
|
5
|
+
import { Figure } from "@components/mdx/components/figure";
|
|
6
|
+
import { FigureCaption } from "@components/mdx/components/figure-caption";
|
|
7
|
+
import { Footnotes } from "@components/mdx/components/footnotes";
|
|
8
|
+
import { Heading } from "@components/mdx/components/heading";
|
|
9
|
+
import { Hr } from "@components/mdx/components/hr";
|
|
10
|
+
import { Image } from "@components/mdx/components/image";
|
|
11
|
+
import { InlineCode } from "@components/mdx/components/inline-code";
|
|
12
|
+
import { Kbd } from "@components/mdx/components/kbd";
|
|
13
|
+
import { Link } from "@components/mdx/components/link";
|
|
14
|
+
import { Paragraph } from "@components/mdx/components/paragraph";
|
|
15
|
+
import { Strikethrough } from "@components/mdx/components/strikethrough";
|
|
17
16
|
import {
|
|
18
17
|
Table,
|
|
19
18
|
TableBodyGroup,
|
|
@@ -21,65 +20,335 @@ import {
|
|
|
21
20
|
TableHeaderCell,
|
|
22
21
|
TableHeadGroup,
|
|
23
22
|
TableRowGroup
|
|
24
|
-
} from "@
|
|
25
|
-
import { TaskList, TaskListInput } from "@
|
|
26
|
-
import { Video } from "@
|
|
27
|
-
import { MDXErrorBoundary } from "@
|
|
28
|
-
import { rehypeHeadingIds } from "@
|
|
23
|
+
} from "@components/mdx/components/table";
|
|
24
|
+
import { TaskList, TaskListInput } from "@components/mdx/components/task-list";
|
|
25
|
+
import { Video } from "@components/mdx/components/video";
|
|
26
|
+
import { MDXErrorBoundary } from "@components/mdx/error-boundary";
|
|
27
|
+
import { rehypeHeadingIds } from "@components/mdx/rehype-heading-ids";
|
|
29
28
|
import { compileMDX } from "next-mdx-remote/rsc";
|
|
30
29
|
import remarkGfm from "remark-gfm";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
|
|
31
|
+
// src/components/mdx/mod-key.tsx
|
|
32
|
+
import {
|
|
33
|
+
ModKey as UiModKey
|
|
34
|
+
} from "@components/ui/mod-key";
|
|
35
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
36
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
37
|
+
function ModKey({ className, ...props }) {
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
UiModKey,
|
|
40
|
+
{
|
|
41
|
+
...props,
|
|
42
|
+
size: null,
|
|
43
|
+
className: cn("text-[0.75em]", className)
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/components/mdx/plugins/remark-code-elements.ts
|
|
49
|
+
function remarkCodeElements() {
|
|
50
|
+
return (tree) => {
|
|
51
|
+
function visit(node, insidePre = !1) {
|
|
52
|
+
if ((node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && node.name === "code" && !insidePre && node.data && Reflect.deleteProperty(node.data, "_mdxExplicitJsx"), "children" in node) {
|
|
53
|
+
let childInsidePre = insidePre || (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && node.name === "pre";
|
|
54
|
+
for (let child of node.children) visit(child, childInsidePre);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
visit(tree);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/components/mdx/plugins/remark-code-title.ts
|
|
62
|
+
function remarkCodeTitle() {
|
|
63
|
+
return (tree) => {
|
|
64
|
+
function visit(node) {
|
|
65
|
+
if (node.type === "code") {
|
|
66
|
+
let title = /^title="(.*)"$/.exec(node.meta?.trim() ?? "")?.[1];
|
|
67
|
+
title !== void 0 && (node.data = {
|
|
68
|
+
...node.data,
|
|
69
|
+
hProperties: { ...node.data?.hProperties ?? {}, title }
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if ("children" in node)
|
|
73
|
+
for (let child of node.children) visit(child);
|
|
74
|
+
}
|
|
75
|
+
visit(tree);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/components/mdx/plugins/remark-component-references.ts
|
|
80
|
+
function remarkComponentReferences({
|
|
81
|
+
components,
|
|
82
|
+
pagePath
|
|
83
|
+
}) {
|
|
84
|
+
return () => (tree) => {
|
|
85
|
+
function visit(node) {
|
|
86
|
+
if ((node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && node.name && /^[A-Z]/.test(node.name)) {
|
|
87
|
+
let rootName = node.name.split(".")[0];
|
|
88
|
+
if (rootName && !components[rootName]) {
|
|
89
|
+
let file = rootName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), position = node.position?.start;
|
|
90
|
+
throw new Error(
|
|
91
|
+
`Undefined MDX component "${rootName}" on page "${pagePath}"` + (position ? ` (body line ${position.line}, column ${position.column})` : "") + (rootName.endsWith("Icon") ? `. For a Phosphor icon, use import { ${rootName} } from "@phosphor-icons/react/ssr".` : `. Add publish.os/components/mdx/${file}.tsx with a named ${rootName} export, or supply it through the MDX components prop.`)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if ("children" in node)
|
|
96
|
+
for (let child of node.children) visit(child);
|
|
97
|
+
}
|
|
98
|
+
visit(tree);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/components/mdx/plugins/remark-keyboard-input.ts
|
|
103
|
+
function remarkKeyboardInput() {
|
|
104
|
+
return (tree) => {
|
|
105
|
+
function visit(node) {
|
|
106
|
+
if ((node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && node.name === "kbd" && node.data && Reflect.deleteProperty(node.data, "_mdxExplicitJsx"), "children" in node)
|
|
107
|
+
for (let child of node.children) visit(child);
|
|
108
|
+
}
|
|
109
|
+
visit(tree);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/components/mdx/plugins/remark-media-elements.ts
|
|
114
|
+
var mediaElements = /* @__PURE__ */ new Set(["img", "figure", "figcaption"]);
|
|
115
|
+
function remarkMediaElements() {
|
|
116
|
+
return (tree) => {
|
|
117
|
+
function visit(node) {
|
|
118
|
+
if ((node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && node.name && mediaElements.has(node.name) && node.data && Reflect.deleteProperty(node.data, "_mdxExplicitJsx"), "children" in node)
|
|
119
|
+
for (let child of node.children) visit(child);
|
|
120
|
+
}
|
|
121
|
+
visit(tree);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// src/lib/hosting/framework-paths.ts
|
|
126
|
+
var FRAMEWORK_PREFIX = "/publishos", SOURCE_ASSET_PREFIX = `${FRAMEWORK_PREFIX}/assets`, INTERNAL_PREFIX = `${FRAMEWORK_PREFIX}/internal`, SITE_API_PREFIX = `${FRAMEWORK_PREFIX}/api`, SEARCH_PREFIX = `${INTERNAL_PREFIX}/search`, PAGEFIND_MODULE_URL = `${SEARCH_PREFIX}/pagefind.js`, PAGEFIND_ENTRY_URL = `${SEARCH_PREFIX}/pagefind-entry.json`, IMAGE_OPTIMIZER_PATH = `${SITE_API_PREFIX}/image`;
|
|
127
|
+
var OG_SERVICE_PREFIX = `${SITE_API_PREFIX}/og`, PUBLIC_INTERNAL_DIRECTORY = INTERNAL_PREFIX.slice(1), PUBLIC_FONT_DIRECTORY = `${PUBLIC_INTERNAL_DIRECTORY}/fonts`, PUBLIC_SEARCH_DIRECTORY = `public/${PUBLIC_INTERNAL_DIRECTORY}/search`, FRAMEWORK_PROXY_MATCHER = `/((?!${FRAMEWORK_PREFIX.slice(1)}(?:/|$)|_next/static|_next/image|_next/webpack-hmr).*)`;
|
|
128
|
+
|
|
129
|
+
// src/lib/assets/map-source-asset-url.ts
|
|
130
|
+
var SOURCE_ASSET_PATH = "/assets/", URL_PROPS = [
|
|
131
|
+
"action",
|
|
132
|
+
"cite",
|
|
133
|
+
"data",
|
|
134
|
+
"formAction",
|
|
135
|
+
"href",
|
|
136
|
+
"poster",
|
|
137
|
+
"src",
|
|
138
|
+
"xlinkHref"
|
|
139
|
+
];
|
|
140
|
+
function hasUnsafeControlCharacters(value) {
|
|
141
|
+
for (let character of value) {
|
|
142
|
+
let code = character.codePointAt(0) ?? 0;
|
|
143
|
+
if (code <= 31 || code >= 127 && code <= 159) return !0;
|
|
144
|
+
}
|
|
145
|
+
return !1;
|
|
146
|
+
}
|
|
147
|
+
function assertSafeAssetPath(path) {
|
|
148
|
+
if (path.includes("\\") || hasUnsafeControlCharacters(path))
|
|
149
|
+
throw new TypeError("Local asset URLs must use safe path segments.");
|
|
150
|
+
for (let segment of path.split("/")) {
|
|
151
|
+
if (!segment)
|
|
152
|
+
throw new TypeError("Local asset URLs must use safe path segments.");
|
|
153
|
+
let decoded;
|
|
154
|
+
try {
|
|
155
|
+
decoded = decodeURIComponent(segment);
|
|
156
|
+
} catch {
|
|
157
|
+
throw new TypeError("Local asset URLs must use valid URL encoding.");
|
|
158
|
+
}
|
|
159
|
+
if (decoded === "." || decoded === ".." || decoded.includes("/") || decoded.includes("\\") || hasUnsafeControlCharacters(decoded))
|
|
160
|
+
throw new TypeError("Local asset URLs must use safe path segments.");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function mapSourceAssetUrl(value) {
|
|
164
|
+
if (typeof value != "string" || !value.startsWith(SOURCE_ASSET_PATH))
|
|
165
|
+
return value;
|
|
166
|
+
let suffixIndex = value.search(/[?#]/u), pathname = suffixIndex < 0 ? value : value.slice(0, suffixIndex), suffix = suffixIndex < 0 ? "" : value.slice(suffixIndex), path = pathname.slice(SOURCE_ASSET_PATH.length);
|
|
167
|
+
return assertSafeAssetPath(path), `${SOURCE_ASSET_PREFIX}/${path}${suffix}`;
|
|
168
|
+
}
|
|
169
|
+
function mapSourceSet(value) {
|
|
170
|
+
let candidates = [], cursor = 0;
|
|
171
|
+
for (; cursor < value.length; ) {
|
|
172
|
+
for (; cursor < value.length && /[\s,]/u.test(value[cursor] ?? ""); )
|
|
173
|
+
cursor += 1;
|
|
174
|
+
if (cursor >= value.length) break;
|
|
175
|
+
let start = cursor;
|
|
176
|
+
for (; cursor < value.length && !/\s/u.test(value[cursor] ?? ""); )
|
|
177
|
+
cursor += 1;
|
|
178
|
+
let url = value.slice(start, cursor), endsCandidate = url.endsWith(",");
|
|
179
|
+
endsCandidate && (url = url.replace(/,+$/u, ""));
|
|
180
|
+
let mapped = String(mapSourceAssetUrl(url));
|
|
181
|
+
if (endsCandidate) {
|
|
182
|
+
candidates.push(mapped);
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
for (; cursor < value.length && /\s/u.test(value[cursor] ?? ""); )
|
|
186
|
+
cursor += 1;
|
|
187
|
+
let descriptorStart = cursor;
|
|
188
|
+
for (; cursor < value.length && value[cursor] !== ","; ) cursor += 1;
|
|
189
|
+
let descriptor = value.slice(descriptorStart, cursor).trim();
|
|
190
|
+
candidates.push(descriptor ? `${mapped} ${descriptor}` : mapped), value[cursor] === "," && (cursor += 1);
|
|
191
|
+
}
|
|
192
|
+
return candidates.join(", ");
|
|
193
|
+
}
|
|
194
|
+
function mapSourceAssetProps(props) {
|
|
195
|
+
if (!props || typeof props != "object") return props;
|
|
196
|
+
let source = props, mapped;
|
|
197
|
+
for (let name of URL_PROPS) {
|
|
198
|
+
let value = source[name], next = mapSourceAssetUrl(value);
|
|
199
|
+
next !== value && (mapped ??= { ...source }, mapped[name] = next);
|
|
200
|
+
}
|
|
201
|
+
if (typeof source.srcSet == "string") {
|
|
202
|
+
let next = mapSourceSet(source.srcSet);
|
|
203
|
+
next !== source.srcSet && (mapped ??= { ...source }, mapped.srcSet = next);
|
|
204
|
+
}
|
|
205
|
+
return mapped ?? props;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/lib/assets/remark-map-source-assets.ts
|
|
209
|
+
var imageBooleanAttributes = /* @__PURE__ */ new Set([
|
|
210
|
+
"decorative",
|
|
211
|
+
"fill",
|
|
212
|
+
"frame",
|
|
213
|
+
"optimized",
|
|
214
|
+
"priority",
|
|
215
|
+
"zoom"
|
|
216
|
+
]);
|
|
217
|
+
function preserveImageControlLiteral(node) {
|
|
218
|
+
if (!(node.name !== "Image" && node.name !== "img" || !node.attributes))
|
|
219
|
+
for (let attribute of node.attributes) {
|
|
220
|
+
if (attribute.type !== "mdxJsxAttribute" || !attribute.value || typeof attribute.value != "object")
|
|
221
|
+
continue;
|
|
222
|
+
let expression = attribute.value.value;
|
|
223
|
+
if (typeof expression != "string") continue;
|
|
224
|
+
let value = expression.trim();
|
|
225
|
+
if (imageBooleanAttributes.has(attribute.name ?? "") && (value === "true" || value === "false")) {
|
|
226
|
+
attribute.value = value;
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
let isPositiveNumber = (candidate) => {
|
|
230
|
+
let number = Number(candidate);
|
|
231
|
+
return candidate !== "" && Number.isFinite(number) && number > 0;
|
|
232
|
+
}, unquotedValue = value.replace(/^(?:"(.*)"|'(.*)')$/u, "$1$2"), ratio = unquotedValue.match(
|
|
233
|
+
/^(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)$/u
|
|
234
|
+
), isPositiveAspect = isPositiveNumber(unquotedValue) || ratio !== null && Number(ratio[1]) > 0 && Number(ratio[2]) > 0;
|
|
235
|
+
(attribute.name === "width" || attribute.name === "height") && /^\d+$/u.test(value) && isPositiveNumber(value) && Number.isSafeInteger(Number(value)) ? attribute.value = value : attribute.name === "aspect" && isPositiveAspect && (attribute.value = unquotedValue);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function mapAttribute(node) {
|
|
239
|
+
if (preserveImageControlLiteral(node), (node.type === "image" || node.type === "link" || node.type === "definition") && typeof node.url == "string") {
|
|
240
|
+
let prop = node.type === "image" ? "src" : "href", props = mapSourceAssetProps({ [prop]: node.url });
|
|
241
|
+
typeof props[prop] == "string" && (node.url = props[prop]);
|
|
242
|
+
}
|
|
243
|
+
for (let attribute of node.attributes ?? []) {
|
|
244
|
+
if (attribute.type !== "mdxJsxAttribute" || typeof attribute.value != "string")
|
|
245
|
+
continue;
|
|
246
|
+
let mapped = mapSourceAssetProps({
|
|
247
|
+
[attribute.name ?? ""]: attribute.value
|
|
248
|
+
});
|
|
249
|
+
attribute.name && typeof mapped[attribute.name] == "string" && (attribute.value = mapped[attribute.name]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function remarkMapSourceAssets() {
|
|
253
|
+
return (tree) => {
|
|
254
|
+
let visit = (node) => {
|
|
255
|
+
mapAttribute(node), node.children?.forEach(visit);
|
|
256
|
+
};
|
|
257
|
+
visit(tree);
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// src/components/mdx/mdx.tsx
|
|
262
|
+
import { Figure as Figure2 } from "@components/mdx/components/figure";
|
|
263
|
+
import { Image as Image2 } from "@components/mdx/components/image";
|
|
264
|
+
import { Link as Link2 } from "@components/mdx/components/link";
|
|
265
|
+
import { Video as Video2 } from "@components/mdx/components/video";
|
|
266
|
+
import { jsx as jsx2 } from "@publish.os/nextjs/jsx-runtime";
|
|
36
267
|
var defaultMdxComponents = {
|
|
37
|
-
h1: (props) => /* @__PURE__ */
|
|
38
|
-
h2: (props) => /* @__PURE__ */
|
|
39
|
-
h3: (props) => /* @__PURE__ */
|
|
40
|
-
h4: (props) => /* @__PURE__ */
|
|
41
|
-
h5: (props) => /* @__PURE__ */
|
|
42
|
-
h6: (props) => /* @__PURE__ */
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
268
|
+
h1: (props) => /* @__PURE__ */ jsx2(Heading, { as: "h1", ...props }),
|
|
269
|
+
h2: (props) => /* @__PURE__ */ jsx2(Heading, { as: "h2", ...props }),
|
|
270
|
+
h3: (props) => /* @__PURE__ */ jsx2(Heading, { as: "h3", ...props }),
|
|
271
|
+
h4: (props) => /* @__PURE__ */ jsx2(Heading, { as: "h4", ...props }),
|
|
272
|
+
h5: (props) => /* @__PURE__ */ jsx2(Heading, { as: "h5", ...props }),
|
|
273
|
+
h6: (props) => /* @__PURE__ */ jsx2(Heading, { as: "h6", ...props }),
|
|
274
|
+
Heading,
|
|
275
|
+
a: Link,
|
|
276
|
+
p: Paragraph,
|
|
277
|
+
blockquote: Blockquote,
|
|
278
|
+
Blockquote,
|
|
46
279
|
Callout,
|
|
47
|
-
code:
|
|
280
|
+
code: InlineCode,
|
|
281
|
+
InlineCode,
|
|
48
282
|
CodeBlock,
|
|
49
|
-
del:
|
|
50
|
-
figcaption:
|
|
51
|
-
|
|
283
|
+
del: Strikethrough,
|
|
284
|
+
figcaption: FigureCaption,
|
|
285
|
+
FigureCaption,
|
|
286
|
+
figure: Figure,
|
|
52
287
|
Figure,
|
|
53
|
-
hr:
|
|
54
|
-
|
|
288
|
+
hr: Hr,
|
|
289
|
+
Hr,
|
|
290
|
+
img: Image,
|
|
55
291
|
Image,
|
|
56
|
-
input:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
292
|
+
input: TaskListInput,
|
|
293
|
+
TaskListInput,
|
|
294
|
+
Kbd,
|
|
295
|
+
ModKey,
|
|
296
|
+
kbd: Kbd,
|
|
297
|
+
pre: CodeBlock,
|
|
298
|
+
Paragraph,
|
|
299
|
+
section: Footnotes,
|
|
300
|
+
Footnotes,
|
|
301
|
+
Strikethrough,
|
|
302
|
+
table: Table,
|
|
303
|
+
Table,
|
|
304
|
+
tbody: TableBodyGroup,
|
|
305
|
+
TableBodyGroup,
|
|
306
|
+
td: TableDataCell,
|
|
307
|
+
TableDataCell,
|
|
308
|
+
th: TableHeaderCell,
|
|
309
|
+
TableHeaderCell,
|
|
310
|
+
thead: TableHeadGroup,
|
|
311
|
+
TableHeadGroup,
|
|
312
|
+
tr: TableRowGroup,
|
|
313
|
+
TableRowGroup,
|
|
314
|
+
ul: TaskList,
|
|
315
|
+
TaskList,
|
|
316
|
+
video: Video,
|
|
69
317
|
Video
|
|
70
318
|
};
|
|
71
319
|
function getErrorMessage(error) {
|
|
72
320
|
return error instanceof Error ? error.message : "An error occurred while rendering the content";
|
|
73
321
|
}
|
|
74
|
-
async function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
322
|
+
async function renderMdx({
|
|
323
|
+
components,
|
|
324
|
+
page,
|
|
325
|
+
siteComponents,
|
|
326
|
+
importedComponents
|
|
327
|
+
}) {
|
|
328
|
+
let selectedComponents = {
|
|
329
|
+
...defaultMdxComponents,
|
|
330
|
+
...siteComponents ?? {},
|
|
331
|
+
...components ?? {},
|
|
332
|
+
...importedComponents ?? {}
|
|
333
|
+
}, mdx = await compileMDX({
|
|
334
|
+
source: page.body,
|
|
335
|
+
components: selectedComponents,
|
|
78
336
|
options: {
|
|
79
337
|
parseFrontmatter: !1,
|
|
80
338
|
mdxOptions: {
|
|
81
339
|
rehypePlugins: [rehypeHeadingIds],
|
|
82
|
-
remarkPlugins: [
|
|
340
|
+
remarkPlugins: [
|
|
341
|
+
remarkGfm,
|
|
342
|
+
remarkCodeTitle,
|
|
343
|
+
remarkKeyboardInput,
|
|
344
|
+
remarkCodeElements,
|
|
345
|
+
remarkMediaElements,
|
|
346
|
+
remarkMapSourceAssets,
|
|
347
|
+
remarkComponentReferences({
|
|
348
|
+
components: selectedComponents,
|
|
349
|
+
pagePath: page.path
|
|
350
|
+
})
|
|
351
|
+
]
|
|
83
352
|
}
|
|
84
353
|
}
|
|
85
354
|
}).then(({ content: compiledContent }) => ({
|
|
@@ -89,21 +358,25 @@ async function MDX({ components, content, pageId, slug }) {
|
|
|
89
358
|
compiledContent: null,
|
|
90
359
|
errorMessage: getErrorMessage(error)
|
|
91
360
|
}));
|
|
92
|
-
return /* @__PURE__ */
|
|
361
|
+
return /* @__PURE__ */ jsx2(
|
|
93
362
|
MDXErrorBoundary,
|
|
94
363
|
{
|
|
95
364
|
errorMessage: mdx.errorMessage,
|
|
96
|
-
pageId,
|
|
97
|
-
slug,
|
|
98
|
-
children: /* @__PURE__ */
|
|
365
|
+
pageId: page.fileID,
|
|
366
|
+
slug: page.slug,
|
|
367
|
+
children: /* @__PURE__ */ jsx2("div", { className: "markdown-prose", children: mdx.compiledContent })
|
|
99
368
|
}
|
|
100
369
|
);
|
|
101
370
|
}
|
|
371
|
+
async function MDX(props) {
|
|
372
|
+
return renderMdx(props);
|
|
373
|
+
}
|
|
102
374
|
Object.defineProperty(MDX, "__publishOsMdx", { value: !0 });
|
|
103
375
|
export {
|
|
104
376
|
Figure2 as Figure,
|
|
105
377
|
Image2 as Image,
|
|
106
378
|
Link2 as Link,
|
|
107
379
|
MDX,
|
|
108
|
-
Video2 as Video
|
|
380
|
+
Video2 as Video,
|
|
381
|
+
renderMdx
|
|
109
382
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// src/components/mdx/rehype-heading-ids.ts
|
|
1
|
+
// src/components/mdx/plugins/rehype-heading-ids.ts
|
|
2
2
|
import {
|
|
3
3
|
cleanHeadingText,
|
|
4
4
|
createHeadingIdGenerator
|
|
5
5
|
} from "@publish.os/nextjs/utils/heading-ids";
|
|
6
6
|
var HEADING_TAG_RE = /^h[1-6]$/;
|
|
7
7
|
function textFromNode(node) {
|
|
8
|
-
return node.type === "text" || node.type === "inlineCode" ? typeof node.value == "string" ? node.value : "" : node.children ? node.children.map(textFromNode).join("") : "";
|
|
8
|
+
return node.type === "text" || node.type === "inlineCode" ? typeof node.value == "string" ? node.value : "" : node.tagName === "img" ? typeof node.properties?.alt == "string" ? node.properties.alt : "" : node.tagName === "br" || node.name === "br" ? " " : node.children ? node.children.map(textFromNode).join("") : "";
|
|
9
9
|
}
|
|
10
10
|
function visit(node, callback) {
|
|
11
11
|
callback(node);
|
|
@@ -17,8 +17,10 @@ function rehypeHeadingIds() {
|
|
|
17
17
|
let headingId = createHeadingIdGenerator();
|
|
18
18
|
visit(tree, (node) => {
|
|
19
19
|
if (!node.tagName || !HEADING_TAG_RE.test(node.tagName)) return;
|
|
20
|
-
let text = cleanHeadingText(textFromNode(node))
|
|
21
|
-
!text
|
|
20
|
+
let text = cleanHeadingText(textFromNode(node));
|
|
21
|
+
if (!text) return;
|
|
22
|
+
let id = headingId(text);
|
|
23
|
+
id !== "empty-heading" && (node.properties = {
|
|
22
24
|
...node.properties,
|
|
23
25
|
id
|
|
24
26
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import NextImage, { getImageProps as getImageProps$1 } from 'next/dist/shared/lib/image-external';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
export { ImageProps } from 'next/image';
|
|
5
|
+
|
|
6
|
+
type NextImageComponentProps = ComponentProps<typeof NextImage>;
|
|
7
|
+
/** Keep the helper callable from server and client components. */
|
|
8
|
+
declare function getImageProps(props: Parameters<typeof getImageProps$1>[0]): ReturnType<typeof getImageProps$1>;
|
|
9
|
+
/** Keep remote image URLs direct while preserving Next.js behavior for local assets. */
|
|
10
|
+
declare function PublishOsNextImage(props: NextImageComponentProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { PublishOsNextImage as default, getImageProps };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// src/components/next-image.tsx
|
|
2
|
+
import NextImage, {
|
|
3
|
+
getImageProps as nextGetImageProps
|
|
4
|
+
} from "next/dist/shared/lib/image-external";
|
|
5
|
+
|
|
6
|
+
// src/lib/hosting/framework-paths.ts
|
|
7
|
+
var FRAMEWORK_PREFIX = "/publishos", SOURCE_ASSET_PREFIX = `${FRAMEWORK_PREFIX}/assets`, INTERNAL_PREFIX = `${FRAMEWORK_PREFIX}/internal`, SITE_API_PREFIX = `${FRAMEWORK_PREFIX}/api`, SEARCH_PREFIX = `${INTERNAL_PREFIX}/search`, PAGEFIND_MODULE_URL = `${SEARCH_PREFIX}/pagefind.js`, PAGEFIND_ENTRY_URL = `${SEARCH_PREFIX}/pagefind-entry.json`, IMAGE_OPTIMIZER_PATH = `${SITE_API_PREFIX}/image`;
|
|
8
|
+
var OG_SERVICE_PREFIX = `${SITE_API_PREFIX}/og`, PUBLIC_INTERNAL_DIRECTORY = INTERNAL_PREFIX.slice(1), PUBLIC_FONT_DIRECTORY = `${PUBLIC_INTERNAL_DIRECTORY}/fonts`, PUBLIC_SEARCH_DIRECTORY = `public/${PUBLIC_INTERNAL_DIRECTORY}/search`, FRAMEWORK_PROXY_MATCHER = `/((?!${FRAMEWORK_PREFIX.slice(1)}(?:/|$)|_next/static|_next/image|_next/webpack-hmr).*)`;
|
|
9
|
+
|
|
10
|
+
// src/lib/assets/map-source-asset-url.ts
|
|
11
|
+
var SOURCE_ASSET_PATH = "/assets/";
|
|
12
|
+
function hasUnsafeControlCharacters(value) {
|
|
13
|
+
for (let character of value) {
|
|
14
|
+
let code = character.codePointAt(0) ?? 0;
|
|
15
|
+
if (code <= 31 || code >= 127 && code <= 159) return !0;
|
|
16
|
+
}
|
|
17
|
+
return !1;
|
|
18
|
+
}
|
|
19
|
+
function assertSafeAssetPath(path) {
|
|
20
|
+
if (path.includes("\\") || hasUnsafeControlCharacters(path))
|
|
21
|
+
throw new TypeError("Local asset URLs must use safe path segments.");
|
|
22
|
+
for (let segment of path.split("/")) {
|
|
23
|
+
if (!segment)
|
|
24
|
+
throw new TypeError("Local asset URLs must use safe path segments.");
|
|
25
|
+
let decoded;
|
|
26
|
+
try {
|
|
27
|
+
decoded = decodeURIComponent(segment);
|
|
28
|
+
} catch {
|
|
29
|
+
throw new TypeError("Local asset URLs must use valid URL encoding.");
|
|
30
|
+
}
|
|
31
|
+
if (decoded === "." || decoded === ".." || decoded.includes("/") || decoded.includes("\\") || hasUnsafeControlCharacters(decoded))
|
|
32
|
+
throw new TypeError("Local asset URLs must use safe path segments.");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function mapSourceAssetUrl(value) {
|
|
36
|
+
if (typeof value != "string" || !value.startsWith(SOURCE_ASSET_PATH))
|
|
37
|
+
return value;
|
|
38
|
+
let suffixIndex = value.search(/[?#]/u), pathname = suffixIndex < 0 ? value : value.slice(0, suffixIndex), suffix = suffixIndex < 0 ? "" : value.slice(suffixIndex), path = pathname.slice(SOURCE_ASSET_PATH.length);
|
|
39
|
+
return assertSafeAssetPath(path), `${SOURCE_ASSET_PREFIX}/${path}${suffix}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/components/next-image.tsx
|
|
43
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
44
|
+
function resolveImageProps(props) {
|
|
45
|
+
let remote = typeof props.src == "string" && /^https?:\/\//iu.test(props.src);
|
|
46
|
+
return {
|
|
47
|
+
...props,
|
|
48
|
+
src: mapSourceAssetUrl(props.src),
|
|
49
|
+
unoptimized: remote || props.unoptimized
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function getImageProps(props) {
|
|
53
|
+
return nextGetImageProps(resolveImageProps(props));
|
|
54
|
+
}
|
|
55
|
+
function PublishOsNextImage(props) {
|
|
56
|
+
return /* @__PURE__ */ jsx(NextImage, { ...resolveImageProps(props) });
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
PublishOsNextImage as default,
|
|
60
|
+
getImageProps
|
|
61
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// src/components/ui/accordion.tsx
|
|
4
4
|
import { Accordion as BaseAccordion } from "@base-ui/react/accordion";
|
|
5
5
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
6
|
-
import { jsx } from "
|
|
6
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
7
7
|
function Accordion(props) {
|
|
8
8
|
return /* @__PURE__ */ jsx(BaseAccordion.Root, { ...props });
|
|
9
9
|
}
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
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;
|
|
2
|
+
import { BreadcrumbTrailProps } from './breadcrumb.js';
|
|
3
|
+
import 'class-variance-authority/types';
|
|
4
|
+
import './button.js';
|
|
5
|
+
import 'class-variance-authority';
|
|
6
|
+
import 'react';
|
|
7
|
+
import 'next/link';
|
|
25
8
|
|
|
26
9
|
type CollapsibleBreadcrumbTrailProps = BreadcrumbTrailProps & {
|
|
27
10
|
menuLabel?: string;
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
BreadcrumbTrailEntry,
|
|
13
13
|
BreadcrumbTrailMenu,
|
|
14
14
|
breadcrumbVariants
|
|
15
|
-
} from "@
|
|
15
|
+
} from "@components/ui/breadcrumb";
|
|
16
16
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
17
17
|
import { Fragment, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
18
|
-
import { jsx, jsxs } from "
|
|
18
|
+
import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
19
19
|
function sameIndexes(left, right) {
|
|
20
20
|
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
21
21
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
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
|
-
import {
|
|
3
|
+
import { ButtonVariantProps } from './button.js';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
import NextLink from 'next/link';
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { ReactNode, ComponentPropsWithoutRef, HTMLAttributes } from 'react';
|
|
7
|
+
|
|
8
|
+
declare const linkVariants: (props?: ({
|
|
9
|
+
color?: "accent" | "default" | null | undefined;
|
|
10
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
11
|
+
variant?: "inline" | "standalone" | null | undefined;
|
|
12
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
13
|
+
type LinkVariantProps = VariantProps<typeof linkVariants>;
|
|
14
|
+
type LinkStyleVariant = NonNullable<LinkVariantProps["variant"]>;
|
|
15
|
+
type LinkButtonVariant = `button.${NonNullable<ButtonVariantProps["variant"]>}`;
|
|
8
16
|
|
|
9
17
|
declare const breadcrumbVariants: (props?: ({
|
|
10
18
|
size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|