@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.
Files changed (265) hide show
  1. package/compiler-assets/nextjs/defaults/app/globals.css +1 -0
  2. package/compiler-assets/nextjs/defaults/group/index.tsx +50 -0
  3. package/compiler-assets/nextjs/defaults/group/layout.tsx +8 -8
  4. package/compiler-assets/nextjs/defaults/group/page.tsx +44 -43
  5. package/compiler-assets/nextjs/defaults/project/next.config.mjs +33 -13
  6. package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -3
  7. package/compiler-assets/nextjs/defaults/root/css/animation.css +131 -0
  8. package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
  9. package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +4 -1
  10. package/compiler-assets/nextjs/defaults/root/css/components/menu.css +1 -1
  11. package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +1 -1
  12. package/compiler-assets/nextjs/defaults/root/css/components/popover.css +1 -1
  13. package/compiler-assets/nextjs/defaults/root/css/components/select.css +1 -1
  14. package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +1 -1
  15. package/compiler-assets/nextjs/defaults/root/css/shadow.css +6 -25
  16. package/compiler-assets/nextjs/defaults/root/css/typography.css +51 -68
  17. package/compiler-assets/nextjs/defaults/root/globals.css +25 -0
  18. package/compiler-assets/nextjs/defaults/root/{page.tsx → index.tsx} +6 -2
  19. package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -1
  20. package/compiler-assets/nextjs/defaults/root/theme.css +22 -22
  21. package/compiler-assets/nextjs/shims/document.tsx +38 -0
  22. package/compiler-assets/nextjs/shims/generated-group-page.tsx +19 -2
  23. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +18 -2
  24. package/compiler-assets/nextjs/shims/global-layout.tsx +19 -85
  25. package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
  26. package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
  27. package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
  28. package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
  29. package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
  30. package/compiler-assets/nextjs/shims/proxy.ts +143 -65
  31. package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +76 -15
  32. package/compiler-assets/nextjs/shims/root-page.tsx +7 -1
  33. package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +30 -0
  34. package/compiler-assets/nextjs/shims/site-heading-level.tsx +14 -0
  35. package/compiler-assets/nextjs/shims/site-mdx-components.tsx +112 -0
  36. package/compiler-assets/nextjs/shims/site-mdx.tsx +17 -0
  37. package/compiler-assets/nextjs/shims/theme-defaults.css +41 -25
  38. package/dist/build-operation-5QMLXF7N.js +89 -0
  39. package/dist/{button-CFdx-ohV.d.ts → button-BdCScEKi.d.ts} +6 -6
  40. package/dist/capture-local-source-WGGDIUU2.js +258 -0
  41. package/dist/chunk-22RSSUNV.js +13 -0
  42. package/dist/chunk-4BC2L2KA.js +620 -0
  43. package/dist/chunk-5J3YUNRY.js +121 -0
  44. package/dist/chunk-5KAD7W53.js +248 -0
  45. package/dist/chunk-6C65KV7O.js +142 -0
  46. package/dist/chunk-6D2E6UMD.js +695 -0
  47. package/dist/chunk-7NY22B5U.js +161 -0
  48. package/dist/chunk-AI2UULNX.js +9 -0
  49. package/dist/chunk-EFO6AWXN.js +19 -0
  50. package/dist/chunk-F3AGNDF4.js +2377 -0
  51. package/dist/chunk-GBPLER5H.js +426 -0
  52. package/dist/chunk-IL4RJOKI.js +186 -0
  53. package/dist/chunk-NNBJZPFM.js +193 -0
  54. package/dist/chunk-ORIUWJBQ.js +58 -0
  55. package/dist/chunk-OXOFRXEI.js +7129 -0
  56. package/dist/chunk-UYGCOWRF.js +1709 -0
  57. package/dist/chunk-WL75GQ5M.js +80 -0
  58. package/dist/compiler.d.ts +54 -7
  59. package/dist/compiler.js +121 -13147
  60. package/dist/components/blocks/agent-actions.d.ts +81 -0
  61. package/dist/components/blocks/agent-actions.js +594 -0
  62. package/dist/components/blocks/toc.d.ts +43 -0
  63. package/dist/components/blocks/toc.js +136 -0
  64. package/dist/components/ui/button.d.ts +5 -0
  65. package/dist/components/ui/button.js +94 -0
  66. package/dist/compose-CVBJRAF6.js +16 -0
  67. package/dist/config/createNextConfig.js +27 -0
  68. package/dist/dev-operation-OSHHWRWK.js +1095 -0
  69. package/dist/framework-selection-ZVO323PK.js +11 -0
  70. package/dist/ide-support-CU6Z5PVR.js +16 -0
  71. package/dist/index.d.ts +55 -4
  72. package/dist/jsx-dev-runtime.d.ts +6 -0
  73. package/dist/jsx-dev-runtime.js +100 -0
  74. package/dist/jsx-runtime.d.ts +7 -0
  75. package/dist/jsx-runtime.js +97 -0
  76. package/dist/kernel/components/blocks/AgentActions.d.ts +35 -6
  77. package/dist/kernel/components/blocks/AgentActions.js +401 -150
  78. package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
  79. package/dist/kernel/components/blocks/agent-actions.js +594 -0
  80. package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
  81. package/dist/kernel/components/blocks/color-palette.js +4 -4
  82. package/dist/kernel/components/blocks/logo-block.js +3 -3
  83. package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +10 -2
  84. package/dist/kernel/components/blocks/nav-breadcrumb.js +22 -7
  85. package/dist/kernel/components/blocks/navbar.d.ts +2 -2
  86. package/dist/kernel/components/blocks/navbar.js +406 -65
  87. package/dist/kernel/components/blocks/navigation-progress.js +6 -3
  88. package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
  89. package/dist/kernel/components/blocks/next-prev.js +12 -24
  90. package/dist/kernel/components/blocks/page-list.d.ts +1 -1
  91. package/dist/kernel/components/blocks/page-list.js +7 -6
  92. package/dist/kernel/components/blocks/search.d.ts +83 -58
  93. package/dist/kernel/components/blocks/search.js +554 -428
  94. package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
  95. package/dist/kernel/components/blocks/sidebar-node.js +12 -10
  96. package/dist/kernel/components/blocks/sidebar.d.ts +3 -3
  97. package/dist/kernel/components/blocks/sidebar.js +24 -14
  98. package/dist/kernel/components/blocks/theme-toggle.d.ts +2 -2
  99. package/dist/kernel/components/blocks/theme-toggle.js +47 -1
  100. package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
  101. package/dist/kernel/components/blocks/toc-client.js +495 -0
  102. package/dist/kernel/components/blocks/toc.d.ts +19 -1
  103. package/dist/kernel/components/blocks/toc.js +122 -180
  104. package/dist/kernel/components/mdx/components/blockquote.js +2 -2
  105. package/dist/kernel/components/mdx/components/callout.d.ts +5 -7
  106. package/dist/kernel/components/mdx/components/callout.js +67 -36
  107. package/dist/kernel/components/mdx/components/code-block.d.ts +5 -2
  108. package/dist/kernel/components/mdx/components/code-block.js +106 -5
  109. package/dist/kernel/components/mdx/components/copy-code-button.d.ts +8 -0
  110. package/dist/kernel/components/mdx/components/copy-code-button.js +61 -0
  111. package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
  112. package/dist/kernel/components/mdx/components/figure-caption.js +4 -3
  113. package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
  114. package/dist/kernel/components/mdx/components/figure.js +24 -14
  115. package/dist/kernel/components/mdx/components/footnotes.js +1 -1
  116. package/dist/kernel/components/mdx/components/heading-copy-link.js +4 -4
  117. package/dist/kernel/components/mdx/components/heading.js +6 -3
  118. package/dist/kernel/components/mdx/components/hr.js +2 -2
  119. package/dist/kernel/components/mdx/components/image-zoom.js +2 -2
  120. package/dist/kernel/components/mdx/components/image.d.ts +1 -1
  121. package/dist/kernel/components/mdx/components/image.js +94 -68
  122. package/dist/kernel/components/mdx/components/inline-code.js +2 -2
  123. package/dist/kernel/components/mdx/components/kbd.d.ts +2 -2
  124. package/dist/kernel/components/mdx/components/kbd.js +5 -4
  125. package/dist/kernel/components/mdx/components/link.d.ts +35 -4
  126. package/dist/kernel/components/mdx/components/link.js +3 -3
  127. package/dist/kernel/components/mdx/components/paragraph.js +2 -5
  128. package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
  129. package/dist/kernel/components/mdx/components/table.js +2 -2
  130. package/dist/kernel/components/mdx/components/task-list.js +2 -2
  131. package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
  132. package/dist/kernel/components/mdx/components/video-player.js +8 -4
  133. package/dist/kernel/components/mdx/components/video.d.ts +5 -3
  134. package/dist/kernel/components/mdx/components/video.js +8 -6
  135. package/dist/kernel/components/mdx/error-boundary.js +2 -2
  136. package/dist/kernel/components/mdx/error-fallback.js +1 -1
  137. package/dist/kernel/components/mdx/mdx.d.ts +28 -14
  138. package/dist/kernel/components/mdx/mdx.js +336 -63
  139. package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
  140. package/dist/kernel/components/mdx/rehype-heading-ids.js +6 -4
  141. package/dist/kernel/components/next-image.d.ts +12 -0
  142. package/dist/kernel/components/next-image.js +61 -0
  143. package/dist/kernel/components/ui/accordion.js +1 -1
  144. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +6 -23
  145. package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
  146. package/dist/kernel/components/ui/breadcrumb.d.ts +11 -3
  147. package/dist/kernel/components/ui/breadcrumb.js +10 -8
  148. package/dist/kernel/components/ui/button-group.js +8 -7
  149. package/dist/kernel/components/ui/button.d.ts +58 -6
  150. package/dist/kernel/components/ui/button.js +43 -39
  151. package/dist/kernel/components/ui/card.d.ts +2 -2
  152. package/dist/kernel/components/ui/card.js +1 -1
  153. package/dist/kernel/components/ui/dialog.js +1 -1
  154. package/dist/kernel/components/ui/drawer.d.ts +3 -1
  155. package/dist/kernel/components/ui/drawer.js +6 -2
  156. package/dist/kernel/components/ui/input.d.ts +2 -2
  157. package/dist/kernel/components/ui/input.js +1 -1
  158. package/dist/kernel/components/ui/kbd.js +10 -17
  159. package/dist/kernel/components/ui/link.d.ts +11 -3
  160. package/dist/kernel/components/ui/link.js +12 -11
  161. package/dist/kernel/components/ui/menu.js +6 -6
  162. package/dist/kernel/components/ui/mod-key.d.ts +10 -0
  163. package/dist/kernel/components/ui/mod-key.js +36 -0
  164. package/dist/kernel/components/ui/navigation-menu.js +3 -3
  165. package/dist/kernel/components/ui/popover.js +1 -1
  166. package/dist/kernel/components/ui/progress.js +2 -2
  167. package/dist/kernel/components/ui/scroll-area.js +5 -5
  168. package/dist/kernel/components/ui/select.js +8 -11
  169. package/dist/kernel/components/ui/separator.js +1 -1
  170. package/dist/kernel/components/ui/table.js +1 -1
  171. package/dist/kernel/components/ui/tabs.js +1 -1
  172. package/dist/kernel/components/ui/tag.js +1 -1
  173. package/dist/kernel/components/ui/text.d.ts +2 -2
  174. package/dist/kernel/components/ui/text.js +1 -1
  175. package/dist/kernel/components/ui/toast.js +1 -1
  176. package/dist/kernel/components/ui/tooltip.js +1 -1
  177. package/dist/kernel/defaults.registry.d.ts +11 -24
  178. package/dist/kernel/defaults.registry.js +11 -26
  179. package/dist/kernel/routes/agent/markdown.d.ts +3 -1
  180. package/dist/kernel/routes/agent/markdown.js +219 -48
  181. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  182. package/dist/kernel/routes/layouts/group.js +5 -7
  183. package/dist/kernel/routes/metadata/feed.d.ts +1 -1
  184. package/dist/kernel/routes/metadata/feed.js +111 -81
  185. package/dist/kernel/routes/metadata/llms.d.ts +12 -3
  186. package/dist/kernel/routes/metadata/llms.js +156 -59
  187. package/dist/kernel/routes/metadata/og-image.js +1 -1
  188. package/dist/kernel/routes/metadata/robots.d.ts +1 -1
  189. package/dist/kernel/routes/metadata/robots.js +2 -2
  190. package/dist/kernel/routes/metadata/sitemap.d.ts +26 -4
  191. package/dist/kernel/routes/metadata/sitemap.js +206 -38
  192. package/dist/kernel/routes/not-found.d.ts +34 -0
  193. package/dist/kernel/routes/not-found.js +213 -0
  194. package/dist/kernel/routes/pages/group.d.ts +2 -2
  195. package/dist/kernel/routes/pages/group.js +21 -13
  196. package/dist/kernel/routes/pages/leaf.d.ts +28 -1
  197. package/dist/kernel/routes/pages/leaf.js +25 -16
  198. package/dist/kernel/routes/pages/root.js +19 -13
  199. package/dist/keyboard-shortcuts.js +1 -1
  200. package/dist/resolvers/manifest-resolver.js +29 -6
  201. package/dist/search.d.ts +6 -7
  202. package/dist/search.js +52 -29
  203. package/dist/{sidebar-types-Bgchdfd6.d.ts → sidebar-types-DKpR27II.d.ts} +1 -1
  204. package/dist/theme-scope.js +1 -1
  205. package/dist/{types-DHBm7-j6.d.ts → types-CJWRG05y.d.ts} +20 -1
  206. package/dist/{types-B_b3C0U6.d.ts → types-CUtrppxt.d.ts} +8 -2
  207. package/dist/{types-CIwwieNw.d.ts → types-J2w_puPF.d.ts} +11 -10
  208. package/dist/types.d.ts +15 -6
  209. package/dist/utils/heading-ids.js +30 -11
  210. package/dist/utils/toc-selection.d.ts +7 -0
  211. package/dist/utils/toc-selection.js +14 -0
  212. package/dist/validate-local-source-SV44DBQT.js +16 -0
  213. package/dist/validate-publish-os-source-NZJF3TB2.js +14 -0
  214. package/init/seed/minimal/.gitignore +1 -0
  215. package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
  216. package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
  217. package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
  218. package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
  219. package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
  220. package/init/seed/minimal/publish.os/blog/index.tsx +82 -0
  221. package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
  222. package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
  223. package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
  224. package/init/seed/minimal/publish.os/docs/content/get-started.mdx +6 -11
  225. package/init/seed/minimal/publish.os/docs/content/groups.mdx +6 -7
  226. package/init/seed/minimal/publish.os/docs/content/{theme.mdx → themes.mdx} +14 -12
  227. package/init/seed/minimal/publish.os/publish.os.config.json +7 -7
  228. package/init/seed/minimal/publish.os/theme.css +52 -24
  229. package/init/seed/minimal/publish.os/tsconfig.json +3 -0
  230. package/init/seed/minimal/seed.json +12 -2
  231. package/init/seed/scratch/publish.os/docs/content/get-started.mdx +6 -0
  232. package/init/seed/scratch/publish.os/publish.os.config.json +4 -0
  233. package/init/seed/scratch/seed.json +5 -0
  234. package/package.json +55 -44
  235. package/release/app/phosphor/package.json +5 -5
  236. package/release/app/phosphor/pnpm-lock.yaml.template +553 -377
  237. package/release/app/phosphor/pnpm-workspace.yaml +3 -0
  238. package/release/compiler/package.json +5 -3
  239. package/release/compiler/pnpm-lock.yaml.template +500 -303
  240. package/release/compiler/pnpm-workspace.yaml +3 -0
  241. package/release/release.json +8 -37
  242. package/compiler-assets/nextjs/defaults/group/leaf.tsx +0 -48
  243. package/dist/icons.d.ts +0 -1
  244. package/dist/icons.js +0 -2
  245. package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
  246. package/dist/kernel/components/blocks/design-system-preview.js +0 -648
  247. package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
  248. package/dist/kernel/components/blocks/link-playground.js +0 -744
  249. package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
  250. package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
  251. package/dist/kernel/components/mdx/components/pre.d.ts +0 -6
  252. package/dist/kernel/components/mdx/components/pre.js +0 -18
  253. package/dist/kernel/components/ui/meta-key.d.ts +0 -17
  254. package/dist/kernel/components/ui/meta-key.js +0 -9
  255. package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
  256. package/dist/kernel/components/ui/theme-toggle.js +0 -58
  257. package/dist/kernel/framework-icons.d.ts +0 -1
  258. package/dist/kernel/framework-icons.js +0 -39
  259. package/dist/link-CYaCRDb6.d.ts +0 -35
  260. package/release/app/lucide/package.json +0 -30
  261. package/release/app/lucide/pnpm-lock.yaml.template +0 -2905
  262. package/release/app/lucide/pnpm-workspace.yaml +0 -11
  263. package/release/app/tabler/package.json +0 -30
  264. package/release/app/tabler/pnpm-lock.yaml.template +0 -2911
  265. package/release/app/tabler/pnpm-workspace.yaml +0 -11
@@ -0,0 +1,112 @@
1
+ import type { MDXComponents } from "@publish.os/nextjs/mdx/mdx";
2
+ import {
3
+ Figure as PublishOsFigure,
4
+ Image as PublishOsImage,
5
+ Link as PublishOsLink,
6
+ Video as PublishOsVideo,
7
+ } from "@publish.os/nextjs/mdx/mdx";
8
+ import { mediaManifest } from "@source/.publishos/media-manifest.generated";
9
+ import {
10
+ mediaOverrides,
11
+ sourceMdxComponents,
12
+ } from "@source/_internal/mdx-source-components.generated";
13
+ import type { ComponentProps } from "react";
14
+
15
+ type ImageProps = ComponentProps<typeof PublishOsImage>;
16
+ type LinkProps = ComponentProps<typeof PublishOsLink>;
17
+ type VideoProps = ComponentProps<typeof PublishOsVideo>;
18
+ type ResolvedMediaAsset = {
19
+ aspect?: number;
20
+ height?: number;
21
+ intrinsicHeight?: number;
22
+ intrinsicWidth?: number;
23
+ mediaType: string;
24
+ mimeType?: string;
25
+ optimized?: boolean;
26
+ outputPath: string;
27
+ width?: number;
28
+ };
29
+
30
+ const sourceMedia = mediaOverrides as MDXComponents;
31
+ const LinkComponent = (sourceMedia.link ??
32
+ PublishOsLink) as typeof PublishOsLink;
33
+ const ImageComponent = (sourceMedia.image ??
34
+ PublishOsImage) as typeof PublishOsImage;
35
+ const VideoComponent = (sourceMedia.video ??
36
+ PublishOsVideo) as typeof PublishOsVideo;
37
+ const FigureComponent = (sourceMedia.figure ??
38
+ PublishOsFigure) as typeof PublishOsFigure;
39
+
40
+ function getMediaMetadata(src: unknown): ResolvedMediaAsset | undefined {
41
+ if (typeof src !== "string") return undefined;
42
+ const pathname = src.split(/[?#]/u, 1)[0];
43
+ if (!pathname?.startsWith("/publishos/assets/")) return undefined;
44
+ return Object.values(
45
+ mediaManifest.assets as Record<string, ResolvedMediaAsset>,
46
+ ).find((asset) => asset.outputPath === pathname);
47
+ }
48
+
49
+ function authoredDimension(value: unknown): number | undefined {
50
+ if (typeof value === "number") return value;
51
+ if (typeof value !== "string" || !/^\d+$/u.test(value)) return undefined;
52
+ const dimension = Number(value);
53
+ return Number.isSafeInteger(dimension) && dimension > 0
54
+ ? dimension
55
+ : undefined;
56
+ }
57
+
58
+ function Link(props: LinkProps) {
59
+ const asset = getMediaMetadata(props.href);
60
+ const shouldDownload =
61
+ asset?.mediaType === "document" || asset?.mediaType === "file";
62
+ return (
63
+ <LinkComponent
64
+ {...props}
65
+ download={props.download ?? (shouldDownload ? "" : undefined)}
66
+ href={props.href}
67
+ />
68
+ );
69
+ }
70
+
71
+ function Image(props: ImageProps) {
72
+ const asset = getMediaMetadata(props.src);
73
+ const width = authoredDimension(props.width);
74
+ const height = authoredDimension(props.height);
75
+ return (
76
+ <ImageComponent
77
+ {...props}
78
+ aspect={props.aspect ?? asset?.aspect}
79
+ height={height ?? asset?.height}
80
+ intrinsicHeight={asset?.intrinsicHeight ?? asset?.height}
81
+ intrinsicWidth={asset?.intrinsicWidth ?? asset?.width}
82
+ optimized={props.optimized ?? asset?.optimized}
83
+ src={props.src}
84
+ width={width ?? asset?.width}
85
+ />
86
+ );
87
+ }
88
+
89
+ function Video(props: VideoProps) {
90
+ const asset = getMediaMetadata(props.src);
91
+ return (
92
+ <VideoComponent
93
+ {...props}
94
+ height={props.height ?? asset?.height}
95
+ poster={props.poster}
96
+ src={props.src}
97
+ width={props.width ?? asset?.width}
98
+ />
99
+ );
100
+ }
101
+
102
+ export const mdxComponents = {
103
+ ...sourceMdxComponents,
104
+ a: Link,
105
+ Link,
106
+ img: Image,
107
+ Image,
108
+ figure: FigureComponent,
109
+ Figure: FigureComponent,
110
+ video: Video,
111
+ Video,
112
+ } satisfies MDXComponents;
@@ -0,0 +1,17 @@
1
+ import type { MDXProps } from "@publish.os/nextjs/mdx/mdx";
2
+ import { renderMdx } from "@publish.os/nextjs/mdx/mdx";
3
+ import { mdxComponents } from "@source/_internal/mdx-components.generated";
4
+ import { importedMdxComponents } from "@source/_internal/mdx-icon-components.generated";
5
+
6
+ export type { MDXComponents, MDXProps } from "@publish.os/nextjs/mdx/mdx";
7
+ export { Figure, Image, Link, Video } from "@publish.os/nextjs/mdx/mdx";
8
+
9
+ export async function MDX(props: MDXProps) {
10
+ return renderMdx({
11
+ ...props,
12
+ siteComponents: mdxComponents,
13
+ importedComponents: importedMdxComponents[props.page.path],
14
+ });
15
+ }
16
+
17
+ Object.defineProperty(MDX, "__publishOsMdx", { value: true });
@@ -4,18 +4,18 @@
4
4
  --surface-2: var(--neutral-200);
5
5
  --surface-3: var(--neutral-300);
6
6
  --surface-4: var(--neutral-400);
7
- --surface-hover: var(--surface-3);
8
- --surface-active: var(--surface-4);
7
+ --surface-hover: color-mix(in oklab, var(--foreground-1) 4%, transparent);
8
+ --surface-active: color-mix(in oklab, var(--foreground-1) 7%, transparent);
9
9
 
10
10
  --foreground-1: var(--neutral-1200);
11
11
  --foreground-2: var(--neutral-1100);
12
12
  --foreground-3: var(--neutral-1000);
13
13
  --foreground-4: var(--neutral-800);
14
14
 
15
- --stroke-1: var(--neutral-800);
16
- --stroke-2: var(--neutral-700);
17
- --stroke-3: var(--neutral-500);
18
- --stroke-4: var(--neutral-400);
15
+ --stroke-1: color-mix(in oklab, var(--foreground-1) 32%, transparent);
16
+ --stroke-2: color-mix(in oklab, var(--foreground-1) 18%, transparent);
17
+ --stroke-3: color-mix(in oklab, var(--foreground-1) 10%, transparent);
18
+ --stroke-4: color-mix(in oklab, var(--foreground-1) 6%, transparent);
19
19
  --backdrop: rgb(0 0 0 / 72%);
20
20
 
21
21
  --accent-1: var(--accent);
@@ -24,9 +24,17 @@
24
24
  --accent-4: color-mix(in oklch, var(--accent) 6%, transparent);
25
25
  /* biome-ignore lint/correctness/noUnknownFunction: CSS Color 5. */
26
26
  --accent-foreground: contrast-color(var(--accent-1));
27
+ /* Keep accent text vivid, not mixed with gray. Scale chroma with lightness
28
+ when darkening to avoid clipping saturated accents outside sRGB. */
29
+ --accent-text-foreground: light-dark(
30
+ oklch(
31
+ from var(--accent-1) min(l, 0.5) calc(c * min(1, 0.5 / max(l, 0.001))) h
32
+ ),
33
+ oklch(from var(--accent-1) max(l, 0.72) c h)
34
+ );
27
35
 
28
36
  --accent-1-foreground: var(--accent-foreground);
29
- --accent-1-stroke: var(--accent-1);
37
+ --accent-1-stroke: color-mix(in oklch, var(--accent-1) 85%, transparent);
30
38
  --accent-1-hover: oklch(
31
39
  from var(--accent-1) calc(l - 0.025) calc(c * 1.02) h
32
40
  );
@@ -36,25 +44,25 @@
36
44
 
37
45
  /* biome-ignore lint/correctness/noUnknownFunction: CSS Color 5. */
38
46
  --accent-2-foreground: contrast-color(var(--accent-2));
39
- --accent-2-stroke: color-mix(in oklch, var(--accent-2) 70%, var(--accent));
40
- --accent-2-hover: color-mix(in oklch, var(--accent-2) 75%, var(--accent));
41
- --accent-2-active: color-mix(in oklch, var(--accent-2) 60%, var(--accent));
47
+ --accent-2-stroke: oklch(from var(--accent-2) l c h / 0.3);
48
+ --accent-2-hover: oklch(from var(--accent-2) l c h / 0.24);
49
+ --accent-2-active: oklch(from var(--accent-2) l c h / 0.3);
42
50
 
43
51
  /* biome-ignore lint/correctness/noUnknownFunction: CSS Color 5. */
44
52
  --accent-3-foreground: contrast-color(var(--accent-3));
45
- --accent-3-stroke: color-mix(in oklch, var(--accent-3) 55%, var(--accent));
46
- --accent-3-hover: color-mix(in oklch, var(--accent-3) 75%, var(--accent));
47
- --accent-3-active: color-mix(in oklch, var(--accent-3) 60%, var(--accent));
53
+ --accent-3-stroke: oklch(from var(--accent-3) l c h / 0.2);
54
+ --accent-3-hover: oklch(from var(--accent-3) l c h / 0.18);
55
+ --accent-3-active: oklch(from var(--accent-3) l c h / 0.24);
48
56
 
49
57
  /* biome-ignore lint/correctness/noUnknownFunction: CSS Color 5. */
50
58
  --accent-4-foreground: contrast-color(var(--accent-4));
51
- --accent-4-stroke: color-mix(in oklch, var(--accent-4) 45%, var(--accent));
52
- --accent-4-hover: color-mix(in oklch, var(--accent-4) 70%, var(--accent));
53
- --accent-4-active: color-mix(in oklch, var(--accent-4) 55%, var(--accent));
59
+ --accent-4-stroke: oklch(from var(--accent-4) l c h / 0.12);
60
+ --accent-4-hover: oklch(from var(--accent-4) l c h / 0.1);
61
+ --accent-4-active: oklch(from var(--accent-4) l c h / 0.14);
54
62
 
55
- --focus-stroke: var(--accent-3-stroke);
56
- --selection-surface: var(--accent-2-active);
57
- --selection-foreground: var(--foreground-1);
63
+ --focus-stroke: var(--accent-1);
64
+ --selection-surface: color-mix(in oklch, var(--accent-1) 12%, transparent);
65
+ --selection-foreground: var(--accent-1);
58
66
  --progress-track-surface: transparent;
59
67
  --progress-indicator-surface: var(--accent-1);
60
68
  --progress-height: 2px;
@@ -150,12 +158,20 @@
150
158
  --typography-quote-foreground: var(--foreground-2);
151
159
  --typography-quote-stroke: var(--stroke-4);
152
160
  --typography-caption-foreground: var(--foreground-4);
153
- --typography-code-foreground: var(--foreground-1);
154
- --typography-code-surface: var(--surface-2);
155
- --typography-code-stroke: var(--stroke-2);
161
+ --typography-code-foreground: var(--accent-text-foreground);
162
+ --typography-code-surface: color-mix(
163
+ in oklch,
164
+ var(--accent-1) 8%,
165
+ transparent
166
+ );
167
+ --typography-code-stroke: color-mix(
168
+ in oklch,
169
+ var(--accent-1) 20%,
170
+ transparent
171
+ );
156
172
  --typography-variable-foreground: var(--accent-1);
157
173
  --typography-pre-foreground: var(--foreground-2);
158
- --typography-pre-surface: var(--surface-3);
174
+ --typography-pre-surface: var(--surface-1);
159
175
  --typography-pre-stroke: var(--stroke-3);
160
176
  --typography-table-heading-stroke: var(--stroke-3);
161
177
  --typography-table-cell-stroke: var(--stroke-4);
@@ -164,8 +180,8 @@
164
180
 
165
181
  --floating-surface-1: var(--surface-1);
166
182
  --floating-surface-2: var(--surface-2);
167
- --floating-surface-3: var(--surface-3);
168
- --floating-surface-4: var(--surface-4);
183
+ --floating-surface-3: var(--surface-hover);
184
+ --floating-surface-4: var(--surface-active);
169
185
  --floating-foreground-1: var(--foreground-1);
170
186
  --floating-foreground-2: var(--foreground-2);
171
187
  --floating-foreground-3: var(--foreground-3);
@@ -0,0 +1,89 @@
1
+ import {
2
+ approveLocalComposition,
3
+ installLocalApp
4
+ } from "./chunk-4BC2L2KA.js";
5
+ import {
6
+ withLocalOperation
7
+ } from "./chunk-IL4RJOKI.js";
8
+ import {
9
+ prepareIdeSupport
10
+ } from "./chunk-GBPLER5H.js";
11
+ import "./chunk-6D2E6UMD.js";
12
+ import {
13
+ composeFrameworkSource
14
+ } from "./chunk-OXOFRXEI.js";
15
+ import {
16
+ validateLocalSource
17
+ } from "./chunk-ORIUWJBQ.js";
18
+ import "./chunk-NNBJZPFM.js";
19
+ import "./chunk-F3AGNDF4.js";
20
+ import "./chunk-7NY22B5U.js";
21
+ import "./chunk-UYGCOWRF.js";
22
+ import "./chunk-EFO6AWXN.js";
23
+ import "./chunk-5KAD7W53.js";
24
+ import "./chunk-WL75GQ5M.js";
25
+ import "./chunk-AI2UULNX.js";
26
+ import "./chunk-5J3YUNRY.js";
27
+ import "./chunk-22RSSUNV.js";
28
+
29
+ // src/lib/compiler/lifecycle/build-operation.ts
30
+ async function runLocalBuild(options) {
31
+ return withLocalOperation({
32
+ sourceRoot: options.request.paths.source,
33
+ outputDir: options.request.paths.output,
34
+ operation: "build",
35
+ signal: options.signal,
36
+ run: async (lifetime) => {
37
+ let { source, framework } = await validateLocalSource({
38
+ options,
39
+ sourceDir: lifetime.sourceDir,
40
+ sourceRoot: lifetime.sourceRoot
41
+ });
42
+ return await approveLocalComposition({ options }), options.request.context?.ide && await prepareIdeSupport({
43
+ frameworkOptions: { ...options, signal: lifetime.signal },
44
+ publishOsDir: lifetime.sourceRoot,
45
+ source,
46
+ framework
47
+ }), await lifetime.replaceOutput(async (outputDir) => {
48
+ await composeFrameworkSource({
49
+ request: {
50
+ ...options.request,
51
+ paths: {
52
+ source: lifetime.sourceDir,
53
+ originalSource: lifetime.sourceRoot,
54
+ output: outputDir
55
+ },
56
+ context: {
57
+ ...options.request.context,
58
+ previewUrl: void 0,
59
+ sourceRevision: lifetime.sourceRevision,
60
+ sourcePath: options.request.context?.sourcePath ?? "publish.os"
61
+ }
62
+ },
63
+ source,
64
+ signal: lifetime.signal,
65
+ onProgress: (message) => options.onEvent?.({ type: "progress", message }),
66
+ onWarning: (warning) => options.onEvent?.({
67
+ type: "diagnostics",
68
+ diagnostics: {
69
+ diagnostics: [{ ...warning, severity: "warning" }]
70
+ }
71
+ })
72
+ });
73
+ let app = await installLocalApp({
74
+ outputDir,
75
+ framework,
76
+ options,
77
+ lifetime
78
+ });
79
+ options.onEvent?.({
80
+ type: "progress",
81
+ message: "Building production output"
82
+ }), await app.run(["run", "build"]);
83
+ }), { status: "success", type: "result" };
84
+ }
85
+ });
86
+ }
87
+ export {
88
+ runLocalBuild
89
+ };
@@ -1,11 +1,11 @@
1
1
  import * as class_variance_authority_types from 'class-variance-authority/types';
2
2
  import { VariantProps } from 'class-variance-authority';
3
- import { ReactNode, ButtonHTMLAttributes } from 'react';
3
+ import { ReactNode, ComponentPropsWithRef } from 'react';
4
4
 
5
5
  declare const buttonVariants: (props?: ({
6
- variant?: "solid" | "soft" | "outline" | "ghost" | null | undefined;
7
- size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
8
- iconOnly?: boolean | null | undefined;
6
+ readonly variant?: "solid" | "soft" | "outline" | "ghost" | null | undefined;
7
+ readonly size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
8
+ readonly iconOnly?: boolean | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  type ButtonVariantProps = VariantProps<typeof buttonVariants>;
11
11
  type ButtonProps = {
@@ -15,6 +15,6 @@ type ButtonProps = {
15
15
  leftIcon?: ReactNode;
16
16
  loading?: boolean;
17
17
  rightIcon?: ReactNode;
18
- } & ButtonVariantProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "className">;
18
+ } & ButtonVariantProps & Omit<ComponentPropsWithRef<"button">, "children" | "className">;
19
19
 
20
- export type { ButtonVariantProps as B, ButtonProps as a };
20
+ export type { ButtonProps as B, ButtonVariantProps as a };
@@ -0,0 +1,258 @@
1
+ import {
2
+ assertPublishOsSourceBoundary
3
+ } from "./chunk-7NY22B5U.js";
4
+ import {
5
+ decodeCssPath,
6
+ ignoredMediaDocumentWarning,
7
+ mediaFileByteLimit,
8
+ readBoundedMediaFile,
9
+ themeResourceByteLimit
10
+ } from "./chunk-5KAD7W53.js";
11
+ import {
12
+ isExcludedSourcePath
13
+ } from "./chunk-WL75GQ5M.js";
14
+ import {
15
+ AppError
16
+ } from "./chunk-22RSSUNV.js";
17
+
18
+ // src/lib/compiler/lifecycle/capture-local-source.ts
19
+ import { createHash } from "crypto";
20
+ import { constants } from "fs";
21
+ import {
22
+ lstat,
23
+ mkdir,
24
+ open,
25
+ readdir,
26
+ readFile,
27
+ realpath,
28
+ writeFile
29
+ } from "fs/promises";
30
+ import { dirname, isAbsolute, join, relative, resolve, sep } from "path";
31
+ import valueParser from "postcss-value-parser";
32
+ function isInside({ root, path }) {
33
+ let value = relative(root, path);
34
+ return value !== "" && value !== ".." && !value.startsWith(`..${sep}`) && !isAbsolute(value);
35
+ }
36
+ function cssResourcePaths(css) {
37
+ let paths = /* @__PURE__ */ new Set();
38
+ return valueParser(css).walk((node) => {
39
+ if (node.type !== "function") return;
40
+ let name = node.value.toLowerCase(), candidates = name === "url" ? node.nodes.filter(
41
+ (child) => child.type === "string" || child.type === "word"
42
+ ) : ["image-set", "-webkit-image-set"].includes(name) ? node.nodes.filter((child) => child.type === "string") : [];
43
+ for (let candidate of candidates) {
44
+ let decoded = decodeCssPath(candidate.value.trim());
45
+ if (!decoded || decoded.startsWith("#") || decoded.startsWith("/") || decoded.startsWith("//") || /^[a-z][a-z0-9+.-]*:/iu.test(decoded))
46
+ continue;
47
+ let path = decoded.split(/[?#]/u, 1)[0] ?? "";
48
+ path && paths.add(path);
49
+ }
50
+ if (name === "url") return !1;
51
+ }), [...paths];
52
+ }
53
+ async function collectCssReferencedResources({
54
+ captureDir,
55
+ capturedFiles
56
+ }) {
57
+ let referenced = /* @__PURE__ */ new Set();
58
+ for (let cssFile of capturedFiles.filter(
59
+ (path) => path.toLowerCase().endsWith(".css")
60
+ )) {
61
+ let css = await readFile(join(captureDir, cssFile), "utf8");
62
+ for (let urlPath of cssResourcePaths(css)) {
63
+ let absolutePath = resolve(captureDir, dirname(cssFile), urlPath);
64
+ isInside({ root: captureDir, path: absolutePath }) && referenced.add(relative(captureDir, absolutePath).split(sep).join("/"));
65
+ }
66
+ }
67
+ return referenced;
68
+ }
69
+ function localFontPaths(config) {
70
+ if (!config || typeof config != "object" || Array.isArray(config)) return [];
71
+ let fonts = config.fonts;
72
+ if (!fonts || typeof fonts != "object" || Array.isArray(fonts)) return [];
73
+ let paths = /* @__PURE__ */ new Set();
74
+ for (let role of Object.values(fonts)) {
75
+ if (!role || typeof role != "object" || Array.isArray(role)) continue;
76
+ let src = role.src, addPath = (value) => {
77
+ if (typeof value != "string" || /^[a-z][a-z0-9+.-]*:/iu.test(value) || value.startsWith("//") || value.includes("\0"))
78
+ return;
79
+ let normalized = value.replace(/^\/+/, "").replace(/^\.\//, "");
80
+ normalized && paths.add(normalized);
81
+ };
82
+ if (addPath(src), Array.isArray(src))
83
+ for (let file of src)
84
+ file && typeof file == "object" && !Array.isArray(file) && addPath(file.path);
85
+ }
86
+ return [...paths];
87
+ }
88
+ async function collectConfiguredFontResources({
89
+ captureDir,
90
+ capturedFiles
91
+ }) {
92
+ let referenced = /* @__PURE__ */ new Set();
93
+ for (let configPath of capturedFiles.filter(
94
+ (path) => path.endsWith(".config.json")
95
+ )) {
96
+ let config;
97
+ try {
98
+ config = JSON.parse(await readFile(join(captureDir, configPath), "utf8"));
99
+ } catch {
100
+ continue;
101
+ }
102
+ for (let fontPath of localFontPaths(config)) {
103
+ let absolutePath = resolve(captureDir, fontPath);
104
+ isInside({ root: captureDir, path: absolutePath }) && referenced.add(relative(captureDir, absolutePath).split(sep).join("/"));
105
+ }
106
+ }
107
+ return referenced;
108
+ }
109
+ async function readUnboundedSourceFile({
110
+ path,
111
+ entry,
112
+ signal
113
+ }) {
114
+ let file = await open(
115
+ path,
116
+ constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0)
117
+ );
118
+ try {
119
+ let opened = await file.stat();
120
+ if (!opened.isFile() || opened.dev !== entry.dev || opened.ino !== entry.ino)
121
+ throw new AppError({
122
+ code: "FRAMEWORK_CAPTURE_SOURCE_CHANGED",
123
+ message: "A source entry changed before capture could read it."
124
+ });
125
+ signal?.throwIfAborted();
126
+ let contents = await file.readFile({ signal });
127
+ return signal?.throwIfAborted(), contents;
128
+ } finally {
129
+ await file.close();
130
+ }
131
+ }
132
+ async function captureLocalSource({
133
+ sourceRoot,
134
+ captureDir,
135
+ signal
136
+ }) {
137
+ signal?.throwIfAborted(), await assertPublishOsSourceBoundary(sourceRoot), signal?.throwIfAborted();
138
+ let root = await realpath(sourceRoot), destination = resolve(captureDir), outputRoot = join(root, ".publish.os");
139
+ if (!isInside({ root: outputRoot, path: destination }) || await realpath(dirname(destination)) !== dirname(destination))
140
+ throw new AppError({
141
+ code: "FRAMEWORK_CAPTURE_OUTPUT_INVALID",
142
+ message: "Source capture requires an owned path inside source output."
143
+ });
144
+ await mkdir(destination).catch((error) => {
145
+ if (error.code !== "EEXIST") throw error;
146
+ });
147
+ let destinationEntry = await lstat(destination);
148
+ if (!destinationEntry.isDirectory() || destinationEntry.isSymbolicLink() || await realpath(destination) !== destination || (await readdir(destination)).length > 0)
149
+ throw new AppError({
150
+ code: "FRAMEWORK_CAPTURE_OUTPUT_INVALID",
151
+ message: "Source capture requires an empty owned directory."
152
+ });
153
+ let capturedFiles = [], deferredResources = [], copyDirectory = async (relativeDirectory) => {
154
+ signal?.throwIfAborted();
155
+ let directory = join(root, relativeDirectory), names = (await readdir(directory)).sort();
156
+ if (!relativeDirectory) {
157
+ let configIndex = names.indexOf("publish.os.config.json");
158
+ if (configIndex > 0) {
159
+ let [configName] = names.splice(configIndex, 1);
160
+ configName && names.unshift(configName);
161
+ }
162
+ }
163
+ for (let name of names) {
164
+ signal?.throwIfAborted();
165
+ let path = relativeDirectory ? `${relativeDirectory}/${name}` : name;
166
+ if (isExcludedSourcePath(path) || relativeDirectory === "" && name.startsWith(".env"))
167
+ continue;
168
+ let sourcePath = join(root, path), outputPath = join(destination, path), entry = await lstat(sourcePath);
169
+ if (entry.isSymbolicLink())
170
+ throw new AppError({
171
+ code: "FRAMEWORK_SOURCE_SYMLINK",
172
+ message: "Symbolic links are not allowed inside publish.os."
173
+ });
174
+ if (!isInside({ root, path: await realpath(sourcePath) }))
175
+ throw new AppError({
176
+ code: "FRAMEWORK_SOURCE_PATH_ESCAPE",
177
+ message: "A source entry resolves outside the selected source."
178
+ });
179
+ if (entry.isDirectory()) {
180
+ await mkdir(outputPath), await copyDirectory(path);
181
+ continue;
182
+ }
183
+ if (!entry.isFile())
184
+ throw new AppError({
185
+ code: "FRAMEWORK_SOURCE_ENTRY_NOT_REGULAR",
186
+ message: "Source capture accepts only directories and regular files."
187
+ });
188
+ let contents;
189
+ if (ignoredMediaDocumentWarning(path))
190
+ contents = Buffer.alloc(0);
191
+ else if (path.startsWith("assets/")) {
192
+ let relativeAssetPath = path.slice(7);
193
+ contents = await readBoundedMediaFile({
194
+ path: sourcePath,
195
+ relativePath: `assets/${relativeAssetPath}`,
196
+ limit: mediaFileByteLimit(relativeAssetPath),
197
+ expectedIdentity: { dev: entry.dev, ino: entry.ino },
198
+ signal
199
+ });
200
+ } else if (themeResourceByteLimit(path) !== void 0) {
201
+ deferredResources.push({
202
+ path: sourcePath,
203
+ outputPath,
204
+ relativePath: path,
205
+ entry
206
+ });
207
+ continue;
208
+ } else
209
+ contents = await readUnboundedSourceFile({
210
+ path: sourcePath,
211
+ entry,
212
+ signal
213
+ });
214
+ await writeFile(outputPath, contents, { flag: "wx", signal }), capturedFiles.push(path);
215
+ }
216
+ };
217
+ await copyDirectory("");
218
+ let cssResources = await collectCssReferencedResources({
219
+ captureDir: destination,
220
+ capturedFiles
221
+ });
222
+ for (let path of await collectConfiguredFontResources({
223
+ captureDir: destination,
224
+ capturedFiles
225
+ }))
226
+ cssResources.add(path);
227
+ for (let resource of deferredResources) {
228
+ signal?.throwIfAborted();
229
+ let contents = cssResources.has(resource.relativePath) ? await readBoundedMediaFile({
230
+ path: resource.path,
231
+ relativePath: resource.relativePath,
232
+ limit: themeResourceByteLimit(resource.relativePath) ?? 0,
233
+ expectedIdentity: {
234
+ dev: resource.entry.dev,
235
+ ino: resource.entry.ino
236
+ },
237
+ signal
238
+ }) : await readUnboundedSourceFile({
239
+ path: resource.path,
240
+ entry: resource.entry,
241
+ signal
242
+ });
243
+ await writeFile(resource.outputPath, contents, { flag: "wx", signal }), capturedFiles.push(resource.relativePath);
244
+ }
245
+ let hash = createHash("sha256");
246
+ for (let path of capturedFiles.sort()) {
247
+ signal?.throwIfAborted();
248
+ let contents = await readFile(join(destination, path), { signal });
249
+ hash.update(JSON.stringify([path, contents.byteLength])), hash.update("\0"), hash.update(contents);
250
+ }
251
+ return signal?.throwIfAborted(), {
252
+ sourceDir: captureDir,
253
+ sourceRevision: `sha256:${hash.digest("hex")}`
254
+ };
255
+ }
256
+ export {
257
+ captureLocalSource
258
+ };
@@ -0,0 +1,13 @@
1
+ // src/lib/compiler/internal/errors.ts
2
+ var AppError = class extends Error {
3
+ code;
4
+ details;
5
+ fix;
6
+ constructor({ code, message, details, fix }) {
7
+ super(message), this.name = "FrameworkError", this.code = code, this.details = details, this.fix = fix;
8
+ }
9
+ };
10
+
11
+ export {
12
+ AppError
13
+ };