@publish.os/nextjs 0.0.1-alpha.81 → 0.0.1-alpha.90

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 (200) 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 +7 -3
  4. package/compiler-assets/nextjs/defaults/group/page.tsx +35 -43
  5. package/compiler-assets/nextjs/defaults/project/next.config.mjs +22 -11
  6. package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +1 -4
  7. package/compiler-assets/nextjs/defaults/root/css/animation.css +131 -0
  8. package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +4 -1
  9. package/compiler-assets/nextjs/defaults/root/css/components/menu.css +1 -1
  10. package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +1 -1
  11. package/compiler-assets/nextjs/defaults/root/css/components/popover.css +1 -1
  12. package/compiler-assets/nextjs/defaults/root/css/components/select.css +1 -1
  13. package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +1 -1
  14. package/compiler-assets/nextjs/defaults/root/css/shadow.css +6 -25
  15. package/compiler-assets/nextjs/defaults/root/css/typography.css +51 -68
  16. package/compiler-assets/nextjs/defaults/root/globals.css +25 -0
  17. package/compiler-assets/nextjs/defaults/root/{page.tsx → index.tsx} +6 -2
  18. package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -1
  19. package/compiler-assets/nextjs/defaults/root/theme.css +22 -22
  20. package/compiler-assets/nextjs/shims/generated-group-page.tsx +19 -2
  21. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +16 -2
  22. package/compiler-assets/nextjs/shims/global-layout.tsx +11 -43
  23. package/compiler-assets/nextjs/shims/proxy.ts +21 -9
  24. package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +76 -15
  25. package/compiler-assets/nextjs/shims/root-page.tsx +7 -1
  26. package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +34 -0
  27. package/compiler-assets/nextjs/shims/site-heading-level.tsx +14 -0
  28. package/compiler-assets/nextjs/shims/site-mdx-components.tsx +100 -0
  29. package/compiler-assets/nextjs/shims/site-mdx.tsx +12 -0
  30. package/compiler-assets/nextjs/shims/theme-defaults.css +41 -25
  31. package/dist/build-operation-2JAYBSKF.js +83 -0
  32. package/dist/button-CtzUJB8u.d.ts +11 -0
  33. package/dist/{button-CFdx-ohV.d.ts → button-c3WGnxIj.d.ts} +3 -3
  34. package/dist/chunk-535TM4A5.js +1455 -0
  35. package/dist/chunk-726GV2NF.js +2344 -0
  36. package/dist/chunk-7OGTPSKI.js +156 -0
  37. package/dist/chunk-AI2UULNX.js +9 -0
  38. package/dist/chunk-B2V22WRT.js +297 -0
  39. package/dist/chunk-DLDFHU7Y.js +191 -0
  40. package/dist/chunk-DWA3ZRGW.js +142 -0
  41. package/dist/chunk-GGKFQ3MA.js +621 -0
  42. package/dist/chunk-H6XILMZX.js +6154 -0
  43. package/dist/chunk-NECL5IBJ.js +318 -0
  44. package/dist/chunk-SVYGXXYR.js +36 -0
  45. package/dist/chunk-UF6ATARM.js +1100 -0
  46. package/dist/chunk-VO2I7MTM.js +56 -0
  47. package/dist/chunk-WDY4IK6Z.js +128 -0
  48. package/dist/chunk-WKTEO6RS.js +586 -0
  49. package/dist/chunk-YLTOLYWM.js +92 -0
  50. package/dist/compiler.d.ts +41 -7
  51. package/dist/compiler.js +48 -13143
  52. package/dist/compose-NN23UJGC.js +13 -0
  53. package/dist/config/createNextConfig.js +13 -0
  54. package/dist/dev-operation-TZDVJCN7.js +1055 -0
  55. package/dist/framework-selection-X4U6Y6QC.js +10 -0
  56. package/dist/ide-support-ZNW7ODFY.js +15 -0
  57. package/dist/index.d.ts +15 -3
  58. package/dist/kernel/components/blocks/AgentActions.js +71 -61
  59. package/dist/kernel/components/blocks/design-system-preview.d.ts +1 -1
  60. package/dist/kernel/components/blocks/design-system-preview.js +32 -13
  61. package/dist/kernel/components/blocks/link-playground.js +2 -2
  62. package/dist/kernel/components/blocks/logo-block.js +2 -2
  63. package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +10 -2
  64. package/dist/kernel/components/blocks/nav-breadcrumb.js +20 -5
  65. package/dist/kernel/components/blocks/navbar.d.ts +2 -2
  66. package/dist/kernel/components/blocks/navbar.js +401 -60
  67. package/dist/kernel/components/blocks/navigation-progress-playground.js +4 -4
  68. package/dist/kernel/components/blocks/navigation-progress.js +4 -1
  69. package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
  70. package/dist/kernel/components/blocks/next-prev.js +11 -23
  71. package/dist/kernel/components/blocks/page-list.d.ts +1 -1
  72. package/dist/kernel/components/blocks/page-list.js +5 -4
  73. package/dist/kernel/components/blocks/search.d.ts +83 -58
  74. package/dist/kernel/components/blocks/search.js +553 -426
  75. package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
  76. package/dist/kernel/components/blocks/sidebar-node.js +11 -9
  77. package/dist/kernel/components/blocks/sidebar.d.ts +3 -3
  78. package/dist/kernel/components/blocks/sidebar.js +18 -11
  79. package/dist/kernel/components/blocks/theme-toggle.d.ts +2 -2
  80. package/dist/kernel/components/blocks/theme-toggle.js +48 -2
  81. package/dist/kernel/components/blocks/toc.js +3 -3
  82. package/dist/kernel/components/mdx/components/blockquote.js +1 -1
  83. package/dist/kernel/components/mdx/components/callout.d.ts +5 -7
  84. package/dist/kernel/components/mdx/components/callout.js +66 -35
  85. package/dist/kernel/components/mdx/components/code-block.d.ts +5 -2
  86. package/dist/kernel/components/mdx/components/code-block.js +106 -5
  87. package/dist/kernel/components/mdx/components/copy-code-button.d.ts +8 -0
  88. package/dist/kernel/components/mdx/components/copy-code-button.js +60 -0
  89. package/dist/kernel/components/mdx/components/figure-caption.js +1 -1
  90. package/dist/kernel/components/mdx/components/figure.js +1 -1
  91. package/dist/kernel/components/mdx/components/heading-copy-link.js +3 -3
  92. package/dist/kernel/components/mdx/components/image-zoom.js +1 -1
  93. package/dist/kernel/components/mdx/components/image.js +77 -56
  94. package/dist/kernel/components/mdx/components/inline-code.js +1 -1
  95. package/dist/kernel/components/mdx/components/kbd.d.ts +2 -2
  96. package/dist/kernel/components/mdx/components/kbd.js +3 -2
  97. package/dist/kernel/components/mdx/components/link.d.ts +35 -4
  98. package/dist/kernel/components/mdx/components/link.js +1 -1
  99. package/dist/kernel/components/mdx/components/paragraph.js +1 -4
  100. package/dist/kernel/components/mdx/components/task-list.js +1 -1
  101. package/dist/kernel/components/mdx/components/video-player.js +2 -2
  102. package/dist/kernel/components/mdx/components/video.js +1 -1
  103. package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
  104. package/dist/kernel/components/mdx/mdx.d.ts +12 -8
  105. package/dist/kernel/components/mdx/mdx.js +115 -39
  106. package/dist/kernel/components/mdx/rehype-heading-ids.js +1 -1
  107. package/dist/kernel/components/mdx/types.d.ts +1 -1
  108. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +6 -23
  109. package/dist/kernel/components/ui/breadcrumb.d.ts +11 -3
  110. package/dist/kernel/components/ui/breadcrumb.js +6 -4
  111. package/dist/kernel/components/ui/button-group.d.ts +1 -1
  112. package/dist/kernel/components/ui/button-group.js +5 -4
  113. package/dist/kernel/components/ui/button.d.ts +2 -2
  114. package/dist/kernel/components/ui/button.js +6 -6
  115. package/dist/kernel/components/ui/card.d.ts +2 -2
  116. package/dist/kernel/components/ui/drawer.d.ts +3 -1
  117. package/dist/kernel/components/ui/drawer.js +5 -1
  118. package/dist/kernel/components/ui/input.d.ts +4 -4
  119. package/dist/kernel/components/ui/kbd.d.ts +1 -1
  120. package/dist/kernel/components/ui/kbd.js +9 -16
  121. package/dist/kernel/components/ui/link.d.ts +5 -3
  122. package/dist/kernel/components/ui/link.js +10 -9
  123. package/dist/kernel/components/ui/menu.js +5 -5
  124. package/dist/kernel/components/ui/mod-key.d.ts +10 -0
  125. package/dist/kernel/components/ui/mod-key.js +36 -0
  126. package/dist/kernel/components/ui/navigation-menu.js +2 -2
  127. package/dist/kernel/components/ui/progress.js +1 -1
  128. package/dist/kernel/components/ui/scroll-area.d.ts +8 -8
  129. package/dist/kernel/components/ui/scroll-area.js +4 -4
  130. package/dist/kernel/components/ui/select.js +7 -10
  131. package/dist/kernel/components/ui/text.d.ts +2 -2
  132. package/dist/kernel/components/ui/theme-toggle.d.ts +3 -3
  133. package/dist/kernel/components/ui/theme-toggle.js +4 -9
  134. package/dist/kernel/defaults.registry.d.ts +9 -9
  135. package/dist/kernel/defaults.registry.js +9 -9
  136. package/dist/kernel/routes/agent/markdown.d.ts +0 -1
  137. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  138. package/dist/kernel/routes/metadata/feed.d.ts +1 -1
  139. package/dist/kernel/routes/metadata/feed.js +13 -9
  140. package/dist/kernel/routes/metadata/llms.d.ts +2 -1
  141. package/dist/kernel/routes/metadata/llms.js +4 -4
  142. package/dist/kernel/routes/metadata/robots.d.ts +1 -1
  143. package/dist/kernel/routes/metadata/robots.js +2 -2
  144. package/dist/kernel/routes/metadata/sitemap.d.ts +6 -3
  145. package/dist/kernel/routes/metadata/sitemap.js +48 -20
  146. package/dist/kernel/routes/pages/group.d.ts +1 -1
  147. package/dist/kernel/routes/pages/group.js +20 -12
  148. package/dist/kernel/routes/pages/leaf.d.ts +2 -2
  149. package/dist/kernel/routes/pages/leaf.js +20 -12
  150. package/dist/kernel/routes/pages/root.d.ts +2 -2
  151. package/dist/kernel/routes/pages/root.js +18 -12
  152. package/dist/resolvers/manifest-resolver.js +29 -6
  153. package/dist/search.d.ts +6 -7
  154. package/dist/search.js +47 -22
  155. package/dist/{sidebar-types-Bgchdfd6.d.ts → sidebar-types-DKpR27II.d.ts} +1 -1
  156. package/dist/{types-CIwwieNw.d.ts → types-BzkZty3r.d.ts} +23 -3
  157. package/dist/{types-DHBm7-j6.d.ts → types-CJWRG05y.d.ts} +20 -1
  158. package/dist/{types-B_b3C0U6.d.ts → types-CUtrppxt.d.ts} +8 -2
  159. package/dist/types.d.ts +14 -6
  160. package/dist/validate-local-source-XRL2Y7XE.js +14 -0
  161. package/dist/validate-publish-os-source-DAPZ4QGE.js +12 -0
  162. package/init/seed/minimal/.gitignore +1 -0
  163. package/init/seed/minimal/publish.os/assets/favicon/favicon.dark.png +0 -0
  164. package/init/seed/minimal/publish.os/assets/favicon/favicon.png +0 -0
  165. package/init/seed/minimal/publish.os/docs/content/get-started.mdx +6 -10
  166. package/init/seed/minimal/publish.os/docs/content/groups.mdx +1 -1
  167. package/init/seed/minimal/publish.os/docs/content/{theme.mdx → themes.mdx} +14 -12
  168. package/init/seed/minimal/publish.os/publish.os.config.json +3 -7
  169. package/init/seed/minimal/publish.os/theme.css +52 -24
  170. package/init/seed/minimal/publish.os/tsconfig.json +3 -0
  171. package/init/seed/minimal/seed.json +4 -1
  172. package/init/seed/scratch/publish.os/docs/content/get-started.mdx +6 -0
  173. package/init/seed/scratch/publish.os/publish.os.config.json +4 -0
  174. package/init/seed/scratch/seed.json +5 -0
  175. package/package.json +12 -26
  176. package/release/app/phosphor/package.json +3 -3
  177. package/release/app/phosphor/pnpm-lock.yaml.template +523 -360
  178. package/release/app/phosphor/pnpm-workspace.yaml +3 -0
  179. package/release/compiler/package.json +1 -1
  180. package/release/compiler/pnpm-lock.yaml.template +439 -286
  181. package/release/compiler/pnpm-workspace.yaml +3 -0
  182. package/release/release.json +7 -36
  183. package/compiler-assets/nextjs/defaults/group/leaf.tsx +0 -48
  184. package/dist/icons.d.ts +0 -1
  185. package/dist/icons.js +0 -2
  186. package/dist/kernel/components/mdx/components/pre.d.ts +0 -6
  187. package/dist/kernel/components/mdx/components/pre.js +0 -18
  188. package/dist/kernel/components/ui/meta-key.d.ts +0 -17
  189. package/dist/kernel/components/ui/meta-key.js +0 -9
  190. package/dist/kernel/framework-icons.d.ts +0 -1
  191. package/dist/kernel/framework-icons.js +0 -39
  192. package/dist/link-CYaCRDb6.d.ts +0 -35
  193. package/dist/route-metadata-og-image-BeKKFHg7.d.ts +0 -58
  194. package/dist/types-sM2g9nW0.d.ts +0 -12
  195. package/release/app/lucide/package.json +0 -30
  196. package/release/app/lucide/pnpm-lock.yaml.template +0 -2905
  197. package/release/app/lucide/pnpm-workspace.yaml +0 -11
  198. package/release/app/tabler/package.json +0 -30
  199. package/release/app/tabler/pnpm-lock.yaml.template +0 -2911
  200. package/release/app/tabler/pnpm-workspace.yaml +0 -11
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { S as SidebarNodePrimitiveProps } from '../../../sidebar-types-Bgchdfd6.js';
2
+ import { S as SidebarNodePrimitiveProps } from '../../../sidebar-types-DKpR27II.js';
3
3
  import 'react';
4
- import '../../../types-DHBm7-j6.js';
4
+ import '../../../types-CJWRG05y.js';
5
5
 
6
6
  declare function SidebarNode({ activeState, activeItemRef, children, contentId, depth, expanded, href, isExpandable, node, onLinkClick, onToggle, parentExpanded, title, }: SidebarNodePrimitiveProps): react_jsx_runtime.JSX.Element | null;
7
7
 
@@ -1,5 +1,5 @@
1
- // src/components/block/navigation/sidebar-node.tsx
2
- import { FrameworkChevronRightIcon as ChevronRight } from "@publish.os/nextjs/kernel/framework-icons";
1
+ // src/components/block/sidebar/sidebar-node.tsx
2
+ import { CaretRightIcon } from "@phosphor-icons/react/ssr";
3
3
  import { cn } from "@publish.os/nextjs/utils/cn";
4
4
  import { cva } from "class-variance-authority";
5
5
  import NextLink from "next/link";
@@ -42,12 +42,12 @@ var SIDEBAR_NODE_VARIANT = "base", depthClassByDepth = {
42
42
  variant: {
43
43
  base: [
44
44
  "font-normal text-foreground-2 hover:bg-surface-hover hover:text-foreground-1",
45
- "data-[state=child-path-active]:bg-surface-2 data-[state=child-path-active]:font-medium data-[state=child-path-active]:text-foreground-1",
46
- "data-[state=path-active]:bg-surface-active data-[state=path-active]:font-medium data-[state=path-active]:text-foreground-1 data-[state=path-active]:shadow-xs"
45
+ "data-[state=child-path-active]:bg-surface-active data-[state=child-path-active]:text-foreground-1",
46
+ "data-[state=path-active]:bg-surface-active data-[state=path-active]:font-medium data-[state=path-active]:text-foreground-1"
47
47
  ].join(" "),
48
48
  minimal: [
49
49
  "font-normal text-foreground-2 hover:text-foreground-1 hover:opacity-90",
50
- "data-[state=child-path-active]:font-medium data-[state=child-path-active]:text-foreground-1",
50
+ "data-[state=child-path-active]:text-foreground-1",
51
51
  "data-[state=path-active]:font-semibold data-[state=path-active]:text-foreground-1 data-[state=path-active]:[text-shadow:0_0_0_currentColor]"
52
52
  ].join(" ")
53
53
  }
@@ -78,10 +78,10 @@ function Caret({ active, expanded }) {
78
78
  "span",
79
79
  {
80
80
  className: cn(
81
- "block transition-transform duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]",
81
+ "block transition-transform duration-300 ease-in-out",
82
82
  expanded ? "rotate-90" : "rotate-0"
83
83
  ),
84
- children: /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", size: 13 })
84
+ children: /* @__PURE__ */ jsx(CaretRightIcon, { "aria-hidden": "true", size: 13 })
85
85
  }
86
86
  )
87
87
  }
@@ -112,7 +112,7 @@ function RowInner({
112
112
  );
113
113
  }
114
114
  function RowText({ title }) {
115
- return /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 whitespace-normal break-words text-pretty", children: title });
115
+ return /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 whitespace-normal wrap-break-word text-pretty", children: title });
116
116
  }
117
117
  function ExternalLinkIndicator() {
118
118
  return /* @__PURE__ */ jsx(
@@ -128,6 +128,7 @@ function SidebarLink({
128
128
  active,
129
129
  children,
130
130
  className,
131
+ external = !1,
131
132
  href,
132
133
  onClick,
133
134
  parentExpanded,
@@ -143,7 +144,7 @@ function SidebarLink({
143
144
  tabIndex: parentExpanded ? void 0 : -1,
144
145
  ...props
145
146
  };
146
- return isExternalHref(href) ? /* @__PURE__ */ jsx("a", { href, rel: mergeRel(void 0), target: "_blank", ...commonProps, children }) : /* @__PURE__ */ jsx(NextLink, { href, ...commonProps, children });
147
+ return external && isExternalHref(href) ? /* @__PURE__ */ jsx("a", { href, rel: mergeRel(void 0), target: "_blank", ...commonProps, children }) : /* @__PURE__ */ jsx(NextLink, { href, ...commonProps, children });
147
148
  }
148
149
  function SidebarNode({
149
150
  activeState,
@@ -206,6 +207,7 @@ function SidebarNode({
206
207
  active: isActive,
207
208
  "aria-controls": isExpandable ? contentId : void 0,
208
209
  "aria-expanded": isExpandable ? expanded : void 0,
210
+ external: isExternalLinkNode,
209
211
  href,
210
212
  onClick: onLinkClick,
211
213
  parentExpanded,
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { a as SidebarTreeNode } from '../../../sidebar-types-Bgchdfd6.js';
4
- export { b as SidebarActiveState, c as SidebarDepth, S as SidebarNodePrimitiveProps } from '../../../sidebar-types-Bgchdfd6.js';
5
- import '../../../types-DHBm7-j6.js';
3
+ import { a as SidebarTreeNode } from '../../../sidebar-types-DKpR27II.js';
4
+ export { b as SidebarActiveState, c as SidebarDepth, S as SidebarNodePrimitiveProps } from '../../../sidebar-types-DKpR27II.js';
5
+ import '../../../types-CJWRG05y.js';
6
6
 
7
7
  type SidebarProps = {
8
8
  className?: string;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- // src/components/block/navigation/sidebar.tsx
3
+ // src/components/block/sidebar/sidebar.tsx
4
4
  import { SidebarNode } from "@publish.os/nextjs/kernel/components/blocks/sidebar-node";
5
5
  import { ScrollArea } from "@publish.os/nextjs/kernel/components/ui/scroll-area";
6
6
  import { cn } from "@publish.os/nextjs/utils/cn";
@@ -25,9 +25,13 @@ function isExternalHref(href) {
25
25
  return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
26
26
  }
27
27
  function nodeHref(node) {
28
- if (node.type === "link") return node.href;
28
+ if (node.type === "link" || "href" in node && typeof node.href == "string") return node.href;
29
29
  if ("path" in node && typeof node.path == "string") return node.path;
30
30
  }
31
+ function nodePath(node) {
32
+ if (node.type !== "link" && "path" in node && typeof node.path == "string")
33
+ return node.path;
34
+ }
31
35
  function nodeChildren(node) {
32
36
  return Array.isArray(node.children) ? node.children : [];
33
37
  }
@@ -49,7 +53,7 @@ function createActiveIndex({
49
53
  }) {
50
54
  let activeIndex = /* @__PURE__ */ new Map();
51
55
  function visit(node) {
52
- let href = nodeHref(node), exactActive = isExactActivePath(href, currentPath), pathActive = node.type === "page" && isActivePath(href, currentPath), childActive = nodeChildren(node).some(visit), activeState = exactActive ? "path-active" : childActive || pathActive ? "child-path-active" : void 0;
56
+ let path = nodePath(node), exactActive = isExactActivePath(path, currentPath), pathActive = node.type === "page" && isActivePath(path, currentPath), childActive = nodeChildren(node).some(visit), activeState = exactActive ? "path-active" : childActive || pathActive ? "child-path-active" : void 0;
53
57
  return activeIndex.set(node, {
54
58
  activeState,
55
59
  initiallyExpanded: exactActive || pathActive || childActive
@@ -90,7 +94,7 @@ function ExpandableChildren({
90
94
  {
91
95
  "aria-hidden": !expanded,
92
96
  className: cn(
93
- "grid overflow-hidden transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]",
97
+ "grid overflow-hidden transition-[grid-template-rows] duration-300 ease-in-out",
94
98
  expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
95
99
  ),
96
100
  "data-state": expanded ? "open" : "closed",
@@ -179,18 +183,20 @@ var SidebarTreeItem = memo(function SidebarTreeItem2({
179
183
  );
180
184
  });
181
185
  function Sidebar({ className, currentPath, title, tree }) {
182
- let resolvedCurrentPath = usePathname() ?? currentPath ?? "", instanceId = useId(), activeItemRef = useRef(null), activeIndex = useMemo(
186
+ let resolvedCurrentPath = usePathname() ?? currentPath ?? "", instanceId = useId(), activeItemRef = useRef(null), viewportRef = useRef(null), activeIndex = useMemo(
183
187
  () => createActiveIndex({ currentPath: resolvedCurrentPath, tree }),
184
188
  [resolvedCurrentPath, tree]
185
189
  );
186
190
  return useEffect(() => {
187
- let scrollPath = resolvedCurrentPath, frame = window.requestAnimationFrame(() => {
188
- scrollPath && activeItemRef.current?.scrollIntoView({
189
- block: "nearest",
190
- inline: "nearest"
191
- });
191
+ let viewport = viewportRef.current, win = viewport?.ownerDocument.defaultView;
192
+ if (!resolvedCurrentPath || !viewport || !win) return;
193
+ let frame = win.requestAnimationFrame(() => {
194
+ let item = activeItemRef.current;
195
+ if (!item) return;
196
+ let itemBounds = item.getBoundingClientRect(), viewportBounds = viewport.getBoundingClientRect();
197
+ itemBounds.top < viewportBounds.top ? viewport.scrollTop += itemBounds.top - viewportBounds.top : itemBounds.bottom > viewportBounds.bottom && (viewport.scrollTop += itemBounds.bottom - viewportBounds.bottom);
192
198
  });
193
- return () => window.cancelAnimationFrame(frame);
199
+ return () => win.cancelAnimationFrame(frame);
194
200
  }, [resolvedCurrentPath]), /* @__PURE__ */ jsxs(
195
201
  "nav",
196
202
  {
@@ -209,6 +215,7 @@ function Sidebar({ className, currentPath, title, tree }) {
209
215
  mask: { height: 24 },
210
216
  scrollbarClassName: "opacity-0 transition-opacity data-[hovering]:opacity-100 data-[scrolling]:opacity-100",
211
217
  variant: "gradient",
218
+ viewportRef,
212
219
  children: /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-px px-2 py-3", children: tree.map((node) => /* @__PURE__ */ jsx(
213
220
  SidebarTreeItem,
214
221
  {
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { a as ButtonProps } from '../../../button-CFdx-ohV.js';
2
+ import { B as ButtonProps } from '../../../button-c3WGnxIj.js';
3
3
  import 'class-variance-authority/types';
4
4
  import 'class-variance-authority';
5
5
  import 'react';
@@ -7,4 +7,4 @@ import 'react';
7
7
  type ThemeToggleProps = Omit<ButtonProps, "children" | "iconOnly" | "leftIcon" | "loading" | "rightIcon">;
8
8
  declare function ThemeToggle({ className, onClick, size, title, type, variant, ...props }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
9
9
 
10
- export { ThemeToggle };
10
+ export { ThemeToggle, type ThemeToggleProps };
@@ -1,7 +1,53 @@
1
1
  "use client";
2
2
 
3
- // src/components/block/theme-toggle.tsx
4
- import { ThemeToggle } from "@publish.os/nextjs/kernel/components/ui/theme-toggle";
3
+ // src/components/ui/theme-toggle.tsx
4
+ import { Button } from "@publish.os/nextjs/kernel/components/ui/button";
5
+ import { MonitorIcon, MoonIcon, SunIcon } from "@phosphor-icons/react/ssr";
6
+ import { useTheme } from "next-themes";
7
+ import { useEffect, useMemo, useState } from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ var themeOrder = ["system", "light", "dark"];
10
+ function ThemeIcon({ theme }) {
11
+ return theme === "light" ? /* @__PURE__ */ jsx(SunIcon, { "aria-hidden": "true", size: 16 }) : theme === "dark" ? /* @__PURE__ */ jsx(MoonIcon, { "aria-hidden": "true", size: 16 }) : /* @__PURE__ */ jsx(MonitorIcon, { "aria-hidden": "true", size: 16 });
12
+ }
13
+ function normalizeTheme(theme) {
14
+ return theme === "light" || theme === "dark" ? theme : "system";
15
+ }
16
+ function ThemeToggle({
17
+ className,
18
+ onClick,
19
+ size = "sm",
20
+ title,
21
+ type = "button",
22
+ variant = "ghost",
23
+ ...props
24
+ }) {
25
+ let { theme, setTheme } = useTheme(), [mounted, setMounted] = useState(!1), activeTheme = normalizeTheme(theme), nextTheme = useMemo(() => {
26
+ let index = themeOrder.indexOf(activeTheme);
27
+ return themeOrder[(index + 1) % themeOrder.length] ?? "system";
28
+ }, [activeTheme]);
29
+ useEffect(() => {
30
+ setMounted(!0);
31
+ }, []);
32
+ let label = mounted ? `Switch to ${nextTheme} theme` : "Theme preference";
33
+ return /* @__PURE__ */ jsx(
34
+ Button,
35
+ {
36
+ "aria-label": props["aria-label"] ?? label,
37
+ className,
38
+ iconOnly: !0,
39
+ onClick: (event) => {
40
+ onClick?.(event), event.defaultPrevented || setTheme(nextTheme);
41
+ },
42
+ size,
43
+ title: title ?? label,
44
+ type,
45
+ variant,
46
+ ...props,
47
+ children: /* @__PURE__ */ jsx(ThemeIcon, { theme: mounted ? activeTheme : "system" })
48
+ }
49
+ );
50
+ }
5
51
  export {
6
52
  ThemeToggle
7
53
  };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- // src/components/block/navigation/toc.tsx
3
+ // src/components/block/toc/toc.tsx
4
4
  import { cn } from "@publish.os/nextjs/utils/cn";
5
5
  import {
6
6
  extractMdxHeadings
@@ -135,7 +135,7 @@ function Toc({ className, content, levels = DEFAULT_LEVELS }) {
135
135
  "div",
136
136
  {
137
137
  ref: viewportRef,
138
- className: "max-h-[calc(100dvh_-_var(--layout-global-nav-height)_-_3rem)] overflow-y-auto pr-2 [scrollbar-gutter:stable] supports-[top:anchor-size(--global-navbar_height)]:max-h-[calc(100dvh_-_anchor-size(--global-navbar_height,3.5rem)_-_3rem)]",
138
+ className: "max-h-[calc(100dvh-var(--layout-global-nav-height)-3rem)] overflow-y-auto pr-2 scrollbar-gutter-stable supports-[top:anchor-size(--global-navbar_height)]:max-h-[calc(100dvh-anchor-size(--global-navbar_height,3.5rem)-3rem)]",
139
139
  onScroll: updateViewport,
140
140
  style: {
141
141
  WebkitMaskImage: maskImage,
@@ -177,7 +177,7 @@ function Toc({ className, content, levels = DEFAULT_LEVELS }) {
177
177
  "data-toc-link": "",
178
178
  href: `#${heading.id}`,
179
179
  onClick: () => handleTocClick(heading.id),
180
- children: /* @__PURE__ */ jsx("span", { className: "block min-w-0 text-wrap break-words", children: heading.text })
180
+ children: /* @__PURE__ */ jsx("span", { className: "block min-w-0 text-wrap wrap-break-word", children: heading.text })
181
181
  }
182
182
  )
183
183
  },
@@ -6,7 +6,7 @@ function Blockquote({ className, ...props }) {
6
6
  "blockquote",
7
7
  {
8
8
  className: cn(
9
- "my-6 border-l-2 border-typography-quote-stroke pl-4 text-sm leading-7 text-typography-quote-foreground",
9
+ "my-6 border-l-2 border-typography-quote-stroke pl-4 text-typography-quote-foreground",
10
10
  className
11
11
  ),
12
12
  ...props
@@ -1,18 +1,16 @@
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 { VariantProps } from 'class-variance-authority';
4
- import { ReactNode } from 'react';
4
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
5
5
 
6
6
  declare const calloutVariants: (props?: ({
7
- color?: "default" | "accent" | "danger" | "info" | "success" | "warning" | null | undefined;
8
- variant?: "outline" | "soft" | "solid" | null | undefined;
7
+ color?: "neutral" | "info" | "warning" | "danger" | "success" | null | undefined;
8
+ variant?: "solid" | "soft" | "outline" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
- type CalloutProps = VariantProps<typeof calloutVariants> & {
11
- children?: ReactNode;
12
- className?: string;
10
+ type CalloutProps = Omit<ComponentPropsWithoutRef<"aside">, "color" | "title" | "role" | "style"> & VariantProps<typeof calloutVariants> & {
13
11
  icon?: ReactNode;
14
12
  title?: ReactNode;
15
13
  };
16
- declare function Callout({ children, className, color, icon, title, variant, }: CalloutProps): react_jsx_runtime.JSX.Element;
14
+ declare function Callout({ children, className, color, icon, title, variant, ...props }: CalloutProps): react_jsx_runtime.JSX.Element;
17
15
 
18
16
  export { Callout, type CalloutProps, calloutVariants };
@@ -1,29 +1,55 @@
1
1
  // src/components/mdx/callout.tsx
2
2
  import { cn } from "@publish.os/nextjs/utils/cn";
3
3
  import { cva } from "class-variance-authority";
4
+ import { useId } from "react";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  var calloutVariants = cva(
6
- "my-6 rounded-callout border p-4 text-sm leading-6 [--callout-emphasis-foreground:var(--typography-heading-foreground)] [--callout-foreground:var(--typography-body-foreground)] [--callout-solid-foreground:var(--surface-1)] [--callout-solid-surface:var(--foreground-1)] [--callout-stroke:var(--typography-rule-stroke)] [--callout-surface:var(--surface-2)] [--callout-title-foreground:var(--typography-heading-foreground)]",
7
+ "not-markdown-prose my-6 grid min-w-0 items-start gap-2.5 rounded-callout p-3 [&_[data-slot=callout-icon]_svg]:size-[1.125em]",
7
8
  {
8
9
  variants: {
9
10
  color: {
10
- accent: "[--callout-emphasis-foreground:var(--accent-1)] [--callout-solid-foreground:var(--accent-1-foreground)] [--callout-solid-surface:var(--accent-1)] [--callout-stroke:var(--accent-3-stroke)] [--callout-surface:var(--accent-3)]",
11
- danger: "[--callout-emphasis-foreground:var(--danger-1100)] [--callout-foreground:var(--danger-1100)] [--callout-solid-foreground:var(--danger-100)] [--callout-solid-surface:var(--danger-900)] [--callout-stroke:var(--danger-600)] [--callout-surface:var(--danger-200)]",
12
- default: "",
13
- info: "[--callout-emphasis-foreground:var(--info-1100)] [--callout-foreground:var(--info-1100)] [--callout-solid-foreground:var(--info-100)] [--callout-solid-surface:var(--info-900)] [--callout-stroke:var(--info-600)] [--callout-surface:var(--info-200)]",
14
- success: "[--callout-emphasis-foreground:var(--success-1100)] [--callout-foreground:var(--success-1100)] [--callout-solid-foreground:var(--success-100)] [--callout-solid-surface:var(--success-900)] [--callout-stroke:var(--success-600)] [--callout-surface:var(--success-200)]",
15
- warning: "[--callout-emphasis-foreground:var(--warning-1100)] [--callout-foreground:var(--warning-1100)] [--callout-solid-foreground:var(--warning-100)] [--callout-solid-surface:var(--warning-900)] [--callout-stroke:var(--warning-600)] [--callout-surface:var(--warning-200)]"
11
+ neutral: "text-foreground-2 selection:bg-surface-4 selection:text-foreground-1",
12
+ info: "text-info-1200 selection:bg-info-400 selection:text-info-1200",
13
+ warning: "text-warning-1200 selection:bg-warning-400 selection:text-warning-1200",
14
+ danger: "text-danger-1200 selection:bg-danger-400 selection:text-danger-1200",
15
+ success: "text-success-1200 selection:bg-success-400 selection:text-success-1200"
16
16
  },
17
17
  variant: {
18
- outline: "border-[var(--callout-stroke)] bg-transparent text-[var(--callout-foreground)]",
19
- soft: "border-[var(--callout-stroke)] bg-[var(--callout-surface)] text-[var(--callout-foreground)]",
20
- solid: "border-[var(--callout-solid-surface)] bg-[var(--callout-solid-surface)] text-[var(--callout-solid-foreground)]"
18
+ solid: "border-0 border-shadow-3",
19
+ soft: "border-0 shadow-none",
20
+ outline: "border bg-transparent shadow-none"
21
21
  }
22
22
  },
23
- defaultVariants: {
24
- color: "default",
25
- variant: "soft"
26
- }
23
+ compoundVariants: [
24
+ { color: "neutral", variant: "solid", className: "bg-surface-3" },
25
+ { color: "info", variant: "solid", className: "bg-info-300" },
26
+ { color: "warning", variant: "solid", className: "bg-warning-300" },
27
+ { color: "danger", variant: "solid", className: "bg-danger-300" },
28
+ { color: "success", variant: "solid", className: "bg-success-300" },
29
+ { color: "neutral", variant: "soft", className: "bg-surface-3/50" },
30
+ { color: "info", variant: "soft", className: "bg-info-300/50" },
31
+ { color: "warning", variant: "soft", className: "bg-warning-300/50" },
32
+ { color: "danger", variant: "soft", className: "bg-danger-300/50" },
33
+ { color: "success", variant: "soft", className: "bg-success-300/50" },
34
+ { color: "neutral", variant: "outline", className: "border-stroke-3" },
35
+ { color: "info", variant: "outline", className: "border-info-1100/25" },
36
+ {
37
+ color: "warning",
38
+ variant: "outline",
39
+ className: "border-warning-1100/25"
40
+ },
41
+ {
42
+ color: "danger",
43
+ variant: "outline",
44
+ className: "border-danger-1100/25"
45
+ },
46
+ {
47
+ color: "success",
48
+ variant: "outline",
49
+ className: "border-success-1100/25"
50
+ }
51
+ ],
52
+ defaultVariants: { color: "neutral", variant: "solid" }
27
53
  }
28
54
  );
29
55
  function Callout({
@@ -32,42 +58,47 @@ function Callout({
32
58
  color,
33
59
  icon,
34
60
  title,
35
- variant
61
+ variant,
62
+ ...props
36
63
  }) {
37
- let resolvedVariant = variant ?? "soft", hasIcon = icon != null && icon !== !1, hasTitle = title != null && title !== !1;
38
- return /* @__PURE__ */ jsx(
64
+ let titleId = useId(), hasTitle = title != null && title !== !1;
65
+ return /* @__PURE__ */ jsxs(
39
66
  "aside",
40
67
  {
41
- "data-color": color ?? "default",
42
- "data-variant": resolvedVariant,
43
- className: cn(calloutVariants({ color, variant }), className),
44
- children: /* @__PURE__ */ jsxs("div", { className: cn(hasIcon ? "grid grid-cols-[auto_1fr] gap-x-3" : ""), children: [
45
- hasIcon ? /* @__PURE__ */ jsx(
68
+ ...props,
69
+ "aria-labelledby": hasTitle ? titleId : props["aria-labelledby"],
70
+ className: cn(
71
+ calloutVariants({ color, variant }),
72
+ icon ? "grid-cols-[auto_minmax(0,1fr)]" : "grid-cols-1",
73
+ className
74
+ ),
75
+ "data-color": color ?? "neutral",
76
+ "data-slot": "callout",
77
+ "data-variant": variant ?? "solid",
78
+ role: "note",
79
+ children: [
80
+ icon ? /* @__PURE__ */ jsx(
46
81
  "span",
47
82
  {
48
83
  "aria-hidden": "true",
49
- className: cn(
50
- "mt-[0.1875rem] flex size-4 shrink-0 items-center justify-center",
51
- resolvedVariant === "solid" ? "text-inherit" : "text-[var(--callout-emphasis-foreground)]",
52
- "[&_svg]:size-4 [&_svg]:shrink-0"
53
- ),
84
+ className: "flex h-lh shrink-0 items-center justify-center [&_svg]:shrink-0",
85
+ "data-slot": "callout-icon",
54
86
  children: icon
55
87
  }
56
88
  ) : null,
57
- /* @__PURE__ */ jsxs("div", { children: [
89
+ /* @__PURE__ */ jsxs("div", { className: "grid min-w-0 gap-1", "data-slot": "callout-body", children: [
58
90
  hasTitle ? /* @__PURE__ */ jsx(
59
- "p",
91
+ "div",
60
92
  {
61
- className: cn(
62
- "font-medium",
63
- resolvedVariant === "solid" ? "text-inherit" : "text-[var(--callout-title-foreground)]"
64
- ),
93
+ className: "min-w-0 wrap-break-word font-semibold text-pretty",
94
+ "data-slot": "callout-title",
95
+ id: titleId,
65
96
  children: title
66
97
  }
67
98
  ) : null,
68
- /* @__PURE__ */ jsx("div", { className: cn(hasTitle ? "mt-1" : ""), children })
99
+ children != null ? /* @__PURE__ */ jsx("div", { className: "min-w-0 wrap-break-word", "data-slot": "callout-content", children }) : null
69
100
  ] })
70
- ] })
101
+ ]
71
102
  }
72
103
  );
73
104
  }
@@ -1,9 +1,12 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { BundledTheme } from 'shiki';
2
3
 
3
- type CodeBlockProps = React.ComponentPropsWithoutRef<"pre"> & {
4
+ type CodeBlockProps = Omit<React.ComponentPropsWithoutRef<"div">, "style"> & {
4
5
  code?: string;
5
6
  language?: string;
7
+ lightTheme?: BundledTheme;
8
+ darkTheme?: BundledTheme;
6
9
  };
7
- declare function CodeBlock({ children, code, language, ...props }: CodeBlockProps): react_jsx_runtime.JSX.Element;
10
+ declare function CodeBlock({ children, className, code, language, lightTheme, darkTheme, title, ...props }: CodeBlockProps): Promise<react_jsx_runtime.JSX.Element>;
8
11
 
9
12
  export { CodeBlock, type CodeBlockProps };
@@ -1,13 +1,114 @@
1
- // src/components/mdx/code-block.tsx
2
- import { Pre } from "@publish.os/nextjs/kernel/components/mdx/components/pre";
3
- import { jsx } from "react/jsx-runtime";
4
- function CodeBlock({
1
+ // src/components/mdx/code-block/code-block.tsx
2
+ import { CopyCodeButton } from "@publish.os/nextjs/kernel/components/mdx/components/copy-code-button";
3
+ import { cn } from "@publish.os/nextjs/utils/cn";
4
+ import { isValidElement } from "react";
5
+ import {
6
+ bundledLanguages,
7
+ codeToHtml
8
+ } from "shiki";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ var copyButtonRadius = "rounded-[max(calc(var(--radius-codeblock)-0.5rem),0px)]";
11
+ function codeChild(children) {
12
+ if (!isValidElement(children))
13
+ return { code: typeof children == "string" ? children : "" };
14
+ let { className, title } = children.props, language = /(?:^|\s)language-([^\s]+)/.exec(className ?? "")?.[1], value = children.props.children;
15
+ return { code: typeof value == "string" ? value : "", language, title };
16
+ }
17
+ function breakableTitle(title) {
18
+ let parts = [], start = 0;
19
+ for (let separator of title.matchAll(/[/\\]/g)) {
20
+ let end = separator.index + 1;
21
+ parts.push(title.slice(start, end), /* @__PURE__ */ jsx("wbr", {}, end)), start = end;
22
+ }
23
+ return parts.push(title.slice(start)), parts;
24
+ }
25
+ function isCssDeclarationFragment(code) {
26
+ let source = code.replace(/^(?:\s|\/\*[\s\S]*?\*\/)*\s*/, "");
27
+ if (!/^(?:--[\w-]+|[a-zA-Z-]+)\s*:/.test(source)) return !1;
28
+ let firstBlock = source.indexOf("{"), firstDeclarationEnd = source.indexOf(";");
29
+ return firstBlock === -1 || firstDeclarationEnd !== -1 && firstDeclarationEnd < firstBlock;
30
+ }
31
+ async function CodeBlock({
5
32
  children,
33
+ className,
6
34
  code,
7
35
  language,
36
+ lightTheme = "github-light",
37
+ darkTheme = "github-dark",
38
+ title,
8
39
  ...props
9
40
  }) {
10
- return /* @__PURE__ */ jsx(Pre, { "data-language": language, ...props, children: /* @__PURE__ */ jsx("code", { children: code ?? children }) });
41
+ let child = codeChild(children), displayedCode = code ?? child.code, displayLanguage = language ?? child.language, displayTitle = title ?? child.title, token = displayLanguage?.toLowerCase() ?? "txt", highlightedLanguage = Object.hasOwn(bundledLanguages, token) ? token : "txt", html = await codeToHtml(displayedCode.replace(/\r?\n$/, ""), {
42
+ lang: highlightedLanguage,
43
+ themes: { light: lightTheme, dark: darkTheme },
44
+ defaultColor: !1,
45
+ transformers: highlightedLanguage === "css" && isCssDeclarationFragment(displayedCode) ? [
46
+ {
47
+ preprocess(source) {
48
+ return `:root {
49
+ ${source}
50
+ }`;
51
+ },
52
+ tokens(lines) {
53
+ return lines.slice(1, -1);
54
+ }
55
+ }
56
+ ] : []
57
+ });
58
+ return /* @__PURE__ */ jsxs(
59
+ "div",
60
+ {
61
+ className: cn(
62
+ "not-markdown-prose relative my-6 min-w-0 overflow-hidden rounded-codeblock border border-typography-pre-stroke bg-typography-pre-surface text-typography-pre-foreground",
63
+ className
64
+ ),
65
+ "data-slot": "code-block",
66
+ ...props,
67
+ children: [
68
+ displayTitle ? /* @__PURE__ */ jsxs(
69
+ "div",
70
+ {
71
+ className: "flex min-h-11 min-w-0 items-center gap-3 border-b border-typography-pre-stroke bg-surface-2 py-2 ps-4 pe-2",
72
+ "data-slot": "code-block-header",
73
+ children: [
74
+ /* @__PURE__ */ jsx(
75
+ "span",
76
+ {
77
+ className: "min-w-0 flex-1 [overflow-wrap:anywhere] text-sm font-medium leading-5 text-foreground-2",
78
+ dir: "auto",
79
+ children: breakableTitle(displayTitle)
80
+ }
81
+ ),
82
+ /* @__PURE__ */ jsx(CopyCodeButton, { className: copyButtonRadius, code: displayedCode })
83
+ ]
84
+ }
85
+ ) : null,
86
+ /* @__PURE__ */ jsxs(
87
+ "div",
88
+ {
89
+ className: cn(
90
+ "flex min-w-0 items-start gap-2 py-2 ps-4 pe-2",
91
+ displayTitle && "py-3 pe-4"
92
+ ),
93
+ "data-slot": "code-block-content",
94
+ children: [
95
+ /* @__PURE__ */ jsx(
96
+ "div",
97
+ {
98
+ className: cn(
99
+ "code-block-highlight min-w-0 flex-1 overflow-x-auto overscroll-x-contain font-mono text-sm leading-6 [&_pre]:m-0 [&_pre]:min-w-max [&_pre]:overflow-visible [&_pre]:bg-transparent! [&_pre]:p-0 [&_pre]:text-inherit [&_pre]:font-inherit [&_pre]:outline-none [&_code]:block [&_code]:font-inherit",
100
+ !displayTitle && "[&_pre]:py-1"
101
+ ),
102
+ dangerouslySetInnerHTML: { __html: html }
103
+ }
104
+ ),
105
+ displayTitle ? null : /* @__PURE__ */ jsx(CopyCodeButton, { className: copyButtonRadius, code: displayedCode })
106
+ ]
107
+ }
108
+ )
109
+ ]
110
+ }
111
+ );
11
112
  }
12
113
  export {
13
114
  CodeBlock
@@ -0,0 +1,8 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function CopyCodeButton({ className, code, }: {
4
+ className?: string;
5
+ code: string;
6
+ }): react_jsx_runtime.JSX.Element;
7
+
8
+ export { CopyCodeButton };