@publish.os/nextjs 0.0.1-alpha.6 → 0.0.1-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/README.md +3 -5
  2. package/compiler-assets/nextjs/defaults/app/globals.css +6 -0
  3. package/compiler-assets/nextjs/defaults/group/layout.tsx +23 -0
  4. package/compiler-assets/nextjs/defaults/group/leaf.tsx +48 -0
  5. package/compiler-assets/nextjs/defaults/group/page.tsx +50 -0
  6. package/compiler-assets/nextjs/defaults/project/next.config.mjs +45 -0
  7. package/compiler-assets/nextjs/defaults/project/postcss.config.mjs +5 -0
  8. package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +41 -0
  9. package/compiler-assets/nextjs/defaults/root/css/animation.css +90 -0
  10. package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +21 -0
  11. package/compiler-assets/nextjs/defaults/root/css/components/drawer.css +21 -0
  12. package/compiler-assets/nextjs/defaults/root/css/components/menu.css +23 -0
  13. package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +25 -0
  14. package/compiler-assets/nextjs/defaults/root/css/components/popover.css +17 -0
  15. package/compiler-assets/nextjs/defaults/root/css/components/select.css +23 -0
  16. package/compiler-assets/nextjs/defaults/root/css/components/toast.css +19 -0
  17. package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +15 -0
  18. package/compiler-assets/nextjs/defaults/root/css/layout.css +22 -0
  19. package/compiler-assets/nextjs/defaults/root/css/media.css +81 -0
  20. package/compiler-assets/nextjs/defaults/root/css/radius.css +49 -0
  21. package/compiler-assets/nextjs/defaults/root/css/scrollbar.css +43 -0
  22. package/compiler-assets/nextjs/defaults/root/css/shadow.css +145 -0
  23. package/compiler-assets/nextjs/defaults/root/css/typography.css +607 -0
  24. package/compiler-assets/nextjs/defaults/root/css/zindex.css +39 -0
  25. package/compiler-assets/nextjs/defaults/root/globals.css +191 -0
  26. package/compiler-assets/nextjs/defaults/root/layout.tsx +19 -0
  27. package/compiler-assets/nextjs/defaults/root/page.tsx +61 -0
  28. package/compiler-assets/nextjs/defaults/root/theme.css +50 -0
  29. package/compiler-assets/nextjs/defaults/source/_internal/logger.ts +21 -0
  30. package/compiler-assets/nextjs/shims/generated-group-layout.tsx +19 -0
  31. package/compiler-assets/nextjs/shims/generated-group-page.tsx +18 -0
  32. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +21 -0
  33. package/compiler-assets/nextjs/shims/global-layout.tsx +134 -0
  34. package/compiler-assets/nextjs/shims/markdown-route.ts +29 -0
  35. package/compiler-assets/nextjs/shims/og-image-route.ts +18 -0
  36. package/compiler-assets/nextjs/shims/powered-by-footer.tsx +40 -0
  37. package/compiler-assets/nextjs/shims/providers.tsx +13 -0
  38. package/compiler-assets/nextjs/shims/proxy.ts +317 -0
  39. package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +77 -0
  40. package/compiler-assets/nextjs/shims/root-page.tsx +13 -0
  41. package/compiler-assets/nextjs/shims/theme-defaults.css +177 -0
  42. package/dist/button-CFdx-ohV.d.ts +20 -0
  43. package/dist/cache/tags.js +6 -14
  44. package/dist/compiler.d.ts +100 -0
  45. package/dist/compiler.js +13379 -0
  46. package/dist/config/createNextConfig.d.ts +2 -1
  47. package/dist/config/createNextConfig.js +16 -12
  48. package/dist/icons.d.ts +1 -0
  49. package/dist/icons.js +2 -0
  50. package/dist/index.d.ts +303 -15
  51. package/dist/index.js +30 -1198
  52. package/dist/kernel/components/blocks/AgentActions.d.ts +9 -3
  53. package/dist/kernel/components/blocks/AgentActions.js +114 -200
  54. package/dist/kernel/components/blocks/animated-icon-swap.js +4 -25
  55. package/dist/kernel/components/blocks/color-palette.js +88 -169
  56. package/dist/kernel/components/blocks/design-system-preview.d.ts +38 -6
  57. package/dist/kernel/components/blocks/design-system-preview.js +44 -52
  58. package/dist/kernel/components/blocks/link-playground.js +23 -71
  59. package/dist/kernel/components/blocks/logo-block.js +18 -47
  60. package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +1 -1
  61. package/dist/kernel/components/blocks/nav-breadcrumb.js +28 -42
  62. package/dist/kernel/components/blocks/navbar.d.ts +1 -1
  63. package/dist/kernel/components/blocks/navbar.js +14 -41
  64. package/dist/kernel/components/blocks/navigation-progress-playground.js +56 -149
  65. package/dist/kernel/components/blocks/navigation-progress.js +53 -157
  66. package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
  67. package/dist/kernel/components/blocks/next-prev.js +16 -42
  68. package/dist/kernel/components/blocks/page-list.d.ts +1 -1
  69. package/dist/kernel/components/blocks/page-list.js +11 -16
  70. package/dist/kernel/components/blocks/search.d.ts +13 -2
  71. package/dist/kernel/components/blocks/search.js +116 -247
  72. package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
  73. package/dist/kernel/components/blocks/sidebar-node.js +56 -95
  74. package/dist/kernel/components/blocks/sidebar.d.ts +5 -23
  75. package/dist/kernel/components/blocks/sidebar.js +35 -103
  76. package/dist/kernel/components/blocks/theme-toggle.d.ts +7 -3
  77. package/dist/kernel/components/blocks/theme-toggle.js +2 -2
  78. package/dist/kernel/components/blocks/toc.js +42 -178
  79. package/dist/kernel/components/mdx/components/blockquote.js +3 -24
  80. package/dist/kernel/components/mdx/components/callout.d.ts +1 -1
  81. package/dist/kernel/components/mdx/components/callout.js +15 -47
  82. package/dist/kernel/components/mdx/components/code-block.js +2 -2
  83. package/dist/kernel/components/mdx/components/figure-caption.js +6 -24
  84. package/dist/kernel/components/mdx/components/figure.js +9 -36
  85. package/dist/kernel/components/mdx/components/footnotes.js +3 -24
  86. package/dist/kernel/components/mdx/components/heading-copy-link.js +13 -37
  87. package/dist/kernel/components/mdx/components/heading.d.ts +8 -3
  88. package/dist/kernel/components/mdx/components/heading.js +32 -116
  89. package/dist/kernel/components/mdx/components/hr.d.ts +5 -3
  90. package/dist/kernel/components/mdx/components/hr.js +2 -2
  91. package/dist/kernel/components/mdx/components/image-zoom.js +2 -3
  92. package/dist/kernel/components/mdx/components/image.js +22 -62
  93. package/dist/kernel/components/mdx/components/inline-code.js +3 -24
  94. package/dist/kernel/components/mdx/components/kbd.d.ts +9 -4
  95. package/dist/kernel/components/mdx/components/kbd.js +2 -2
  96. package/dist/kernel/components/mdx/components/link.d.ts +1 -2
  97. package/dist/kernel/components/mdx/components/link.js +2 -2
  98. package/dist/kernel/components/mdx/components/paragraph.js +13 -41
  99. package/dist/kernel/components/mdx/components/pre.js +3 -24
  100. package/dist/kernel/components/mdx/components/strikethrough.js +6 -24
  101. package/dist/kernel/components/mdx/components/table.js +2 -2
  102. package/dist/kernel/components/mdx/components/task-list.js +6 -28
  103. package/dist/kernel/components/mdx/components/video-player.js +53 -88
  104. package/dist/kernel/components/mdx/components/video.js +27 -75
  105. package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
  106. package/dist/kernel/components/mdx/error-boundary.js +12 -15
  107. package/dist/kernel/components/mdx/error-fallback.js +4 -4
  108. package/dist/kernel/components/mdx/mdx.d.ts +68 -11
  109. package/dist/kernel/components/mdx/mdx.js +29 -29
  110. package/dist/kernel/components/mdx/rehype-heading-ids.js +11 -67
  111. package/dist/kernel/components/mdx/types.d.ts +1 -1
  112. package/dist/kernel/components/ui/accordion.js +3 -26
  113. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +23 -7
  114. package/dist/kernel/components/ui/breadcrumb-trail.js +32 -80
  115. package/dist/kernel/components/ui/breadcrumb.d.ts +1 -1
  116. package/dist/kernel/components/ui/breadcrumb.js +20 -54
  117. package/dist/kernel/components/ui/button-group.d.ts +4 -3
  118. package/dist/kernel/components/ui/button-group.js +7 -30
  119. package/dist/kernel/components/ui/button.js +13 -36
  120. package/dist/kernel/components/ui/card.d.ts +2 -2
  121. package/dist/kernel/components/ui/card.js +2 -23
  122. package/dist/kernel/components/ui/dialog.d.ts +9 -9
  123. package/dist/kernel/components/ui/dialog.js +15 -33
  124. package/dist/kernel/components/ui/drawer.d.ts +10 -10
  125. package/dist/kernel/components/ui/drawer.js +15 -33
  126. package/dist/kernel/components/ui/input.js +6 -30
  127. package/dist/kernel/components/ui/kbd.js +10 -31
  128. package/dist/kernel/components/ui/link.d.ts +1 -1
  129. package/dist/kernel/components/ui/link.js +53 -104
  130. package/dist/kernel/components/ui/menu.d.ts +21 -21
  131. package/dist/kernel/components/ui/menu.js +10 -32
  132. package/dist/kernel/components/ui/meta-key.d.ts +9 -4
  133. package/dist/kernel/components/ui/meta-key.js +2 -2
  134. package/dist/kernel/components/ui/navigation-menu.d.ts +14 -14
  135. package/dist/kernel/components/ui/navigation-menu.js +9 -30
  136. package/dist/kernel/components/ui/popover.d.ts +10 -10
  137. package/dist/kernel/components/ui/popover.js +19 -34
  138. package/dist/kernel/components/ui/progress.js +2 -25
  139. package/dist/kernel/components/ui/scroll-area.js +39 -118
  140. package/dist/kernel/components/ui/select.d.ts +15 -15
  141. package/dist/kernel/components/ui/select.js +19 -35
  142. package/dist/kernel/components/ui/separator.js +2 -25
  143. package/dist/kernel/components/ui/table.js +2 -23
  144. package/dist/kernel/components/ui/tabs.js +39 -99
  145. package/dist/kernel/components/ui/tag.d.ts +2 -2
  146. package/dist/kernel/components/ui/tag.js +4 -25
  147. package/dist/kernel/components/ui/text.d.ts +2 -2
  148. package/dist/kernel/components/ui/text.js +3 -25
  149. package/dist/kernel/components/ui/theme-toggle.d.ts +18 -4
  150. package/dist/kernel/components/ui/theme-toggle.js +18 -44
  151. package/dist/kernel/components/ui/toast.d.ts +10 -10
  152. package/dist/kernel/components/ui/toast.js +13 -35
  153. package/dist/kernel/components/ui/tooltip.d.ts +8 -8
  154. package/dist/kernel/components/ui/tooltip.js +8 -29
  155. package/dist/kernel/defaults.registry.d.ts +1 -1
  156. package/dist/kernel/defaults.registry.js +2 -2
  157. package/dist/kernel/framework-icons.d.ts +1 -0
  158. package/dist/kernel/framework-icons.js +39 -0
  159. package/dist/kernel/routes/agent/markdown.js +36 -65
  160. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  161. package/dist/kernel/routes/layouts/group.js +20 -109
  162. package/dist/kernel/routes/metadata/feed.d.ts +1 -2
  163. package/dist/kernel/routes/metadata/feed.js +46 -127
  164. package/dist/kernel/routes/metadata/llms.d.ts +1 -2
  165. package/dist/kernel/routes/metadata/llms.js +40 -120
  166. package/dist/kernel/routes/metadata/og-image.d.ts +10 -0
  167. package/dist/kernel/routes/metadata/og-image.js +264 -198
  168. package/dist/kernel/routes/metadata/robots.d.ts +1 -2
  169. package/dist/kernel/routes/metadata/robots.js +21 -90
  170. package/dist/kernel/routes/metadata/sitemap.d.ts +1 -2
  171. package/dist/kernel/routes/metadata/sitemap.js +36 -102
  172. package/dist/kernel/routes/pages/group.d.ts +1 -1
  173. package/dist/kernel/routes/pages/group.js +42 -137
  174. package/dist/kernel/routes/pages/leaf.d.ts +1 -1
  175. package/dist/kernel/routes/pages/leaf.js +74 -213
  176. package/dist/kernel/routes/pages/root.d.ts +1 -1
  177. package/dist/kernel/routes/pages/root.js +37 -108
  178. package/dist/keyboard-shortcuts.js +69 -141
  179. package/dist/link-CYaCRDb6.d.ts +35 -0
  180. package/dist/resolvers/manifest-resolver.d.ts +3 -3
  181. package/dist/resolvers/manifest-resolver.js +15 -21
  182. package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
  183. package/dist/search.d.ts +81 -4
  184. package/dist/search.js +124 -195
  185. package/dist/sidebar-types-Bgchdfd6.d.ts +25 -0
  186. package/dist/theme-scope.d.ts +15 -0
  187. package/dist/theme-scope.js +23 -0
  188. package/dist/types-B_b3C0U6.d.ts +63 -0
  189. package/dist/types-CIwwieNw.d.ts +127 -0
  190. package/dist/types-DHBm7-j6.d.ts +57 -0
  191. package/dist/types-sM2g9nW0.d.ts +12 -0
  192. package/dist/types.d.ts +0 -1
  193. package/dist/types.js +1 -1
  194. package/dist/utils/cn.d.ts +5 -9
  195. package/dist/utils/cn.js +13 -7
  196. package/dist/utils/heading-ids.js +20 -47
  197. package/dist/utils/pretty-date.js +7 -13
  198. package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.dark.png +0 -0
  199. package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.png +0 -0
  200. package/init/seed/minimal/publish.os/docs/content/get-started.mdx +54 -0
  201. package/init/seed/minimal/publish.os/docs/content/groups.mdx +31 -0
  202. package/init/seed/minimal/publish.os/docs/content/theme.mdx +64 -0
  203. package/init/seed/minimal/publish.os/publish.os.config.json +21 -0
  204. package/init/seed/minimal/publish.os/theme.css +47 -0
  205. package/init/seed/minimal/seed.json +13 -0
  206. package/package.json +469 -35
  207. package/release/{package.json → app/lucide/package.json} +11 -5
  208. package/release/app/lucide/pnpm-lock.yaml.template +2905 -0
  209. package/release/app/lucide/pnpm-workspace.yaml +11 -0
  210. package/release/app/phosphor/package.json +30 -0
  211. package/release/app/phosphor/pnpm-lock.yaml.template +2908 -0
  212. package/release/app/phosphor/pnpm-workspace.yaml +11 -0
  213. package/release/app/tabler/package.json +30 -0
  214. package/release/app/tabler/pnpm-lock.yaml.template +2911 -0
  215. package/release/app/tabler/pnpm-workspace.yaml +11 -0
  216. package/release/compiler/package.json +20 -0
  217. package/release/compiler/pnpm-lock.yaml.template +2432 -0
  218. package/release/compiler/pnpm-workspace.yaml +11 -0
  219. package/release/release.json +29 -5
  220. package/release/runtime-pnpm-lock.yaml +0 -1316
@@ -1,32 +1,10 @@
1
- // src/utils/cn.ts
2
- import { clsx } from "clsx";
3
- import { extendTailwindMerge } from "tailwind-merge";
4
- var twMerge = extendTailwindMerge({
5
- extend: {
6
- classGroups: {
7
- z: [
8
- "z-content",
9
- "z-nav",
10
- "z-overlay",
11
- "z-modal",
12
- "z-search",
13
- "z-toast",
14
- "z-progress"
15
- ]
16
- }
17
- }
18
- });
19
- function cn(...inputs) {
20
- return twMerge(clsx(inputs));
21
- }
22
-
23
- // src/kernel/components/blocks/sidebar-node.tsx
1
+ // src/components/block/navigation/sidebar-node.tsx
2
+ import { FrameworkChevronRightIcon as ChevronRight } from "@publish.os/nextjs/kernel/framework-icons";
3
+ import { cn } from "@publish.os/nextjs/utils/cn";
24
4
  import { cva } from "class-variance-authority";
25
- import { ChevronRight } from "lucide-react";
26
5
  import NextLink from "next/link";
27
6
  import { jsx, jsxs } from "react/jsx-runtime";
28
- var SIDEBAR_NODE_VARIANT = "base";
29
- var depthClassByDepth = {
7
+ var SIDEBAR_NODE_VARIANT = "base", depthClassByDepth = {
30
8
  0: "pl-2",
31
9
  1: "pl-5",
32
10
  2: "pl-8",
@@ -40,8 +18,7 @@ var depthClassByDepth = {
40
18
  10: "pl-32",
41
19
  11: "pl-[140px]",
42
20
  12: "pl-[152px]"
43
- };
44
- var sidebarSectionVariants = cva(
21
+ }, sidebarSectionVariants = cva(
45
22
  "mb-2 mt-6 flex min-h-5 items-center gap-2 pr-2 text-[11px] font-semibold uppercase leading-4 tracking-wide text-foreground-3 first:mt-0",
46
23
  {
47
24
  variants: {
@@ -51,8 +28,7 @@ var sidebarSectionVariants = cva(
51
28
  }
52
29
  }
53
30
  }
54
- );
55
- var sidebarNodeVariants = cva(
31
+ ), sidebarNodeVariants = cva(
56
32
  [
57
33
  "group/sidebar-row relative flex min-h-8 w-full min-w-0 items-center gap-2 rounded-button py-1.5 pr-2 text-left text-[13px] leading-5",
58
34
  "transition-[background-color,color,box-shadow] duration-200 ease-out"
@@ -77,7 +53,7 @@ var sidebarNodeVariants = cva(
77
53
  }
78
54
  },
79
55
  defaultVariants: {
80
- interactive: false,
56
+ interactive: !1,
81
57
  variant: "base"
82
58
  }
83
59
  }
@@ -86,10 +62,8 @@ function isExternalHref(href) {
86
62
  return /^[a-z][a-z0-9+.-]*:/i.test(href) && !href.startsWith("mailto:") && !href.startsWith("tel:") || href.startsWith("//");
87
63
  }
88
64
  function mergeRel(rel) {
89
- const values = new Set((rel ?? "").split(/\s+/).filter(Boolean));
90
- values.add("noopener");
91
- values.add("noreferrer");
92
- return Array.from(values).join(" ");
65
+ let values = new Set((rel ?? "").split(/\s+/).filter(Boolean));
66
+ return values.add("noopener"), values.add("noreferrer"), Array.from(values).join(" ");
93
67
  }
94
68
  function Caret({ active, expanded }) {
95
69
  return /* @__PURE__ */ jsx(
@@ -159,20 +133,17 @@ function SidebarLink({
159
133
  parentExpanded,
160
134
  ...props
161
135
  }) {
162
- const commonProps = {
136
+ let commonProps = {
163
137
  "aria-current": active ? "page" : void 0,
164
138
  className: cn(
165
- "block rounded-button focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-ring",
139
+ "block rounded-button focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-stroke",
166
140
  className
167
141
  ),
168
142
  onClick,
169
143
  tabIndex: parentExpanded ? void 0 : -1,
170
144
  ...props
171
145
  };
172
- if (isExternalHref(href)) {
173
- return /* @__PURE__ */ jsx("a", { href, rel: mergeRel(void 0), target: "_blank", ...commonProps, children });
174
- }
175
- return /* @__PURE__ */ jsx(NextLink, { href, ...commonProps, children });
146
+ return isExternalHref(href) ? /* @__PURE__ */ jsx("a", { href, rel: mergeRel(void 0), target: "_blank", ...commonProps, children }) : /* @__PURE__ */ jsx(NextLink, { href, ...commonProps, children });
176
147
  }
177
148
  function SidebarNode({
178
149
  activeState,
@@ -180,65 +151,55 @@ function SidebarNode({
180
151
  children,
181
152
  contentId,
182
153
  depth,
183
- expanded = false,
154
+ expanded = !1,
184
155
  href,
185
- isExpandable = false,
156
+ isExpandable = !1,
186
157
  node,
187
158
  onLinkClick,
188
159
  onToggle,
189
160
  parentExpanded,
190
161
  title
191
162
  }) {
192
- const isActive = activeState === "path-active";
193
- const isChildActive = activeState === "child-path-active";
194
- const active = isActive || isChildActive;
195
- const isExternalLinkNode = node.type === "link" && href ? isExternalHref(href) : false;
196
- if (node.type === "section") {
197
- return /* @__PURE__ */ jsxs("li", { children: [
198
- /* @__PURE__ */ jsx(
199
- "div",
200
- {
201
- className: cn(
202
- sidebarSectionVariants({ variant: SIDEBAR_NODE_VARIANT }),
203
- depthClassByDepth[depth]
204
- ),
205
- children: title
206
- }
207
- ),
208
- children
209
- ] });
210
- }
211
- if (node.type === "folder") {
212
- return /* @__PURE__ */ jsxs("li", { className: "select-none", children: [
213
- /* @__PURE__ */ jsx(
214
- "button",
215
- {
216
- "aria-controls": contentId,
217
- "aria-expanded": expanded,
218
- className: "block w-full rounded-button focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-ring",
219
- onClick: onToggle,
220
- tabIndex: parentExpanded ? void 0 : -1,
221
- type: "button",
222
- children: /* @__PURE__ */ jsxs(
223
- RowInner,
224
- {
225
- activeItemRef,
226
- activeState,
227
- depth,
228
- interactive: true,
229
- children: [
230
- /* @__PURE__ */ jsx(RowText, { title }),
231
- isExpandable ? /* @__PURE__ */ jsx(Caret, { active, expanded }) : null
232
- ]
233
- }
234
- )
235
- }
236
- ),
237
- children
238
- ] });
239
- }
240
- if (!href) return null;
241
- return /* @__PURE__ */ jsxs("li", { className: "select-none", children: [
163
+ let isActive = activeState === "path-active", active = isActive || activeState === "child-path-active", isExternalLinkNode = node.type === "link" && href ? isExternalHref(href) : !1;
164
+ return node.type === "section" ? /* @__PURE__ */ jsxs("li", { children: [
165
+ /* @__PURE__ */ jsx(
166
+ "div",
167
+ {
168
+ className: cn(
169
+ sidebarSectionVariants({ variant: SIDEBAR_NODE_VARIANT }),
170
+ depthClassByDepth[depth]
171
+ ),
172
+ children: title
173
+ }
174
+ ),
175
+ children
176
+ ] }) : node.type === "folder" ? /* @__PURE__ */ jsxs("li", { className: "select-none", children: [
177
+ /* @__PURE__ */ jsx(
178
+ "button",
179
+ {
180
+ "aria-controls": contentId,
181
+ "aria-expanded": expanded,
182
+ className: "block w-full rounded-button focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-stroke",
183
+ onClick: onToggle,
184
+ tabIndex: parentExpanded ? void 0 : -1,
185
+ type: "button",
186
+ children: /* @__PURE__ */ jsxs(
187
+ RowInner,
188
+ {
189
+ activeItemRef,
190
+ activeState,
191
+ depth,
192
+ interactive: !0,
193
+ children: [
194
+ /* @__PURE__ */ jsx(RowText, { title }),
195
+ isExpandable ? /* @__PURE__ */ jsx(Caret, { active, expanded }) : null
196
+ ]
197
+ }
198
+ )
199
+ }
200
+ ),
201
+ children
202
+ ] }) : href ? /* @__PURE__ */ jsxs("li", { className: "select-none", children: [
242
203
  /* @__PURE__ */ jsx(
243
204
  SidebarLink,
244
205
  {
@@ -254,7 +215,7 @@ function SidebarNode({
254
215
  activeItemRef,
255
216
  activeState,
256
217
  depth,
257
- interactive: false,
218
+ interactive: !1,
258
219
  children: [
259
220
  /* @__PURE__ */ jsx(RowText, { title }),
260
221
  isExpandable ? /* @__PURE__ */ jsx(Caret, { active, expanded }) : null,
@@ -265,7 +226,7 @@ function SidebarNode({
265
226
  }
266
227
  ),
267
228
  children
268
- ] });
229
+ ] }) : null;
269
230
  }
270
231
  export {
271
232
  SidebarNode
@@ -1,27 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { TreeNode } from '@publish.os/nextjs/types';
3
- import { Ref, ReactNode, MouseEvent } from 'react';
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';
4
6
 
5
- type SidebarTreeNode = TreeNode & {
6
- children?: SidebarTreeNode[];
7
- };
8
- type SidebarActiveState = "path-active" | "child-path-active";
9
- type SidebarDepth = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
10
- type SidebarNodePrimitiveProps = {
11
- activeState?: SidebarActiveState;
12
- activeItemRef?: Ref<HTMLDivElement>;
13
- children?: ReactNode;
14
- contentId?: string;
15
- depth: SidebarDepth;
16
- expanded?: boolean;
17
- href?: string;
18
- isExpandable?: boolean;
19
- node: SidebarTreeNode;
20
- onLinkClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
21
- onToggle?: () => void;
22
- parentExpanded: boolean;
23
- title: string;
24
- };
25
7
  type SidebarProps = {
26
8
  className?: string;
27
9
  currentPath?: string;
@@ -30,4 +12,4 @@ type SidebarProps = {
30
12
  };
31
13
  declare function Sidebar({ className, currentPath, title, tree }: SidebarProps): react_jsx_runtime.JSX.Element;
32
14
 
33
- export { Sidebar, type SidebarActiveState, type SidebarDepth, type SidebarNodePrimitiveProps, type SidebarProps, type SidebarTreeNode };
15
+ export { Sidebar, type SidebarProps, SidebarTreeNode };
@@ -1,32 +1,9 @@
1
1
  "use client";
2
2
 
3
- // src/kernel/components/blocks/sidebar.tsx
4
- import { SidebarNode } from "./sidebar-node.js";
5
- import { ScrollArea } from "../ui/scroll-area.js";
6
-
7
- // src/utils/cn.ts
8
- import { clsx } from "clsx";
9
- import { extendTailwindMerge } from "tailwind-merge";
10
- var twMerge = extendTailwindMerge({
11
- extend: {
12
- classGroups: {
13
- z: [
14
- "z-content",
15
- "z-nav",
16
- "z-overlay",
17
- "z-modal",
18
- "z-search",
19
- "z-toast",
20
- "z-progress"
21
- ]
22
- }
23
- }
24
- });
25
- function cn(...inputs) {
26
- return twMerge(clsx(inputs));
27
- }
28
-
29
- // src/kernel/components/blocks/sidebar.tsx
3
+ // src/components/block/navigation/sidebar.tsx
4
+ import { SidebarNode } from "@publish.os/nextjs/kernel/components/blocks/sidebar-node";
5
+ import { ScrollArea } from "@publish.os/nextjs/kernel/components/ui/scroll-area";
6
+ import { cn } from "@publish.os/nextjs/utils/cn";
30
7
  import { usePathname } from "next/navigation";
31
8
  import {
32
9
  memo,
@@ -41,58 +18,45 @@ import {
41
18
  import { jsx, jsxs } from "react/jsx-runtime";
42
19
  function normalizePath(path) {
43
20
  if (!path) return "";
44
- const [withoutQuery = ""] = path.split(/[?#]/);
45
- if (withoutQuery === "/") return "/";
46
- return withoutQuery.replace(/\/+$/g, "");
21
+ let [withoutQuery = ""] = path.split(/[?#]/);
22
+ return withoutQuery === "/" ? "/" : withoutQuery.replace(/\/+$/g, "");
47
23
  }
48
24
  function isExternalHref(href) {
49
25
  return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
50
26
  }
51
27
  function nodeHref(node) {
52
28
  if (node.type === "link") return node.href;
53
- if ("path" in node && typeof node.path === "string") return node.path;
54
- return void 0;
29
+ if ("path" in node && typeof node.path == "string") return node.path;
55
30
  }
56
31
  function nodeChildren(node) {
57
32
  return Array.isArray(node.children) ? node.children : [];
58
33
  }
59
34
  function nodeKey(node, parentKey) {
60
- const prefix = parentKey ? `${parentKey}/` : "";
61
- if (node.type === "page") return `${prefix}page:${node.fileID}`;
62
- if (node.type === "link") return `${prefix}link:${node.id}`;
63
- return `${prefix}${node.type}:${node.id}`;
35
+ let prefix = parentKey ? `${parentKey}/` : "";
36
+ return node.type === "page" ? `${prefix}page:${node.fileID}` : node.type === "link" ? `${prefix}link:${node.id}` : `${prefix}${node.type}:${node.id}`;
64
37
  }
65
38
  function isActivePath(path, currentPath) {
66
- if (!path || isExternalHref(path)) return false;
67
- const normalizedPath = normalizePath(path);
68
- const normalizedCurrentPath = normalizePath(currentPath);
69
- if (!normalizedPath) return false;
70
- return normalizedCurrentPath === normalizedPath || normalizedCurrentPath.startsWith(`${normalizedPath}/`);
39
+ if (!path || isExternalHref(path)) return !1;
40
+ let normalizedPath = normalizePath(path), normalizedCurrentPath = normalizePath(currentPath);
41
+ return normalizedPath ? normalizedCurrentPath === normalizedPath || normalizedCurrentPath.startsWith(`${normalizedPath}/`) : !1;
71
42
  }
72
43
  function isExactActivePath(path, currentPath) {
73
- if (!path || isExternalHref(path)) return false;
74
- return normalizePath(path) === normalizePath(currentPath);
44
+ return !path || isExternalHref(path) ? !1 : normalizePath(path) === normalizePath(currentPath);
75
45
  }
76
46
  function createActiveIndex({
77
47
  currentPath,
78
48
  tree
79
49
  }) {
80
- const activeIndex = /* @__PURE__ */ new Map();
50
+ let activeIndex = /* @__PURE__ */ new Map();
81
51
  function visit(node) {
82
- const href = nodeHref(node);
83
- const exactActive = isExactActivePath(href, currentPath);
84
- const pathActive = node.type === "page" && isActivePath(href, currentPath);
85
- const childActive = nodeChildren(node).some(visit);
86
- const activeState = exactActive ? "path-active" : childActive || pathActive ? "child-path-active" : void 0;
87
- activeIndex.set(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;
53
+ return activeIndex.set(node, {
88
54
  activeState,
89
55
  initiallyExpanded: exactActive || pathActive || childActive
90
- });
91
- return exactActive || pathActive || childActive;
56
+ }), exactActive || pathActive || childActive;
92
57
  }
93
- for (const node of tree) {
58
+ for (let node of tree)
94
59
  visit(node);
95
- }
96
60
  return activeIndex;
97
61
  }
98
62
  function safeIdPart(value) {
@@ -102,7 +66,7 @@ function nodeContentId({
102
66
  instanceId,
103
67
  node
104
68
  }) {
105
- const key = "path" in node && node.path ? node.path : node.type === "page" ? node.fileID : node.id;
69
+ let key = "path" in node && node.path ? node.path : node.type === "page" ? node.fileID : node.id;
106
70
  return `sidebar-${safeIdPart(instanceId)}-${safeIdPart(key)}`;
107
71
  }
108
72
  function clampDepth(depth) {
@@ -120,7 +84,7 @@ function ExpandableChildren({
120
84
  parentExpanded,
121
85
  renderChildren
122
86
  }) {
123
- const childFocusable = parentExpanded && expanded;
87
+ let childFocusable = parentExpanded && expanded;
124
88
  return /* @__PURE__ */ jsx(
125
89
  "div",
126
90
  {
@@ -158,41 +122,16 @@ var SidebarTreeItem = memo(function SidebarTreeItem2({
158
122
  node,
159
123
  parentExpanded
160
124
  }) {
161
- const nodes = nodeChildren(node);
162
- const href = nodeHref(node);
163
- const activeInfo = activeIndex.get(node);
164
- const activeState = activeInfo?.activeState;
165
- const initiallyExpanded = Boolean(activeInfo?.initiallyExpanded);
166
- const isExpandable = nodes.length > 0 && (node.type === "folder" || node.type === "page");
167
- const [expanded, setExpanded] = useState(initiallyExpanded);
168
- const [renderChildren, setRenderChildren] = useState(initiallyExpanded);
169
- const interactedRef = useRef(false);
170
- const lastPathRef = useRef(normalizePath(currentPath));
171
- const contentId = nodeContentId({ instanceId, node });
125
+ let nodes = nodeChildren(node), href = nodeHref(node), activeInfo = activeIndex.get(node), activeState = activeInfo?.activeState, initiallyExpanded = !!activeInfo?.initiallyExpanded, isExpandable = nodes.length > 0 && (node.type === "folder" || node.type === "page"), [expanded, setExpanded] = useState(initiallyExpanded), [renderChildren, setRenderChildren] = useState(initiallyExpanded), interactedRef = useRef(!1), lastPathRef = useRef(normalizePath(currentPath)), contentId = nodeContentId({ instanceId, node });
172
126
  useEffect(() => {
173
- const normalizedCurrentPath = normalizePath(currentPath);
174
- const pathChanged = lastPathRef.current !== normalizedCurrentPath;
175
- if (pathChanged) {
176
- interactedRef.current = false;
177
- lastPathRef.current = normalizedCurrentPath;
178
- }
179
- if (initiallyExpanded && !expanded && !interactedRef.current) {
180
- setRenderChildren(true);
181
- startTransition(() => setExpanded(true));
182
- }
127
+ let normalizedCurrentPath = normalizePath(currentPath);
128
+ lastPathRef.current !== normalizedCurrentPath && (interactedRef.current = !1, lastPathRef.current = normalizedCurrentPath), initiallyExpanded && !expanded && !interactedRef.current && (setRenderChildren(!0), startTransition(() => setExpanded(!0)));
183
129
  }, [currentPath, expanded, initiallyExpanded]);
184
- const toggleExpanded = useCallback(() => {
185
- interactedRef.current = true;
186
- setRenderChildren(true);
187
- setExpanded((value) => !value);
188
- }, []);
189
- const expandOnNavigate = useCallback(() => {
190
- interactedRef.current = true;
191
- setRenderChildren(true);
192
- setExpanded(true);
193
- }, []);
194
- const pageWithChildrenLinkClick = node.type === "page" && nodes.length > 0 ? expandOnNavigate : void 0;
195
- const children = isExpandable && nodes.length > 0 ? /* @__PURE__ */ jsx(
130
+ let toggleExpanded = useCallback(() => {
131
+ interactedRef.current = !0, setRenderChildren(!0), setExpanded((value) => !value);
132
+ }, []), expandOnNavigate = useCallback(() => {
133
+ interactedRef.current = !0, setRenderChildren(!0), setExpanded(!0);
134
+ }, []), pageWithChildrenLinkClick = node.type === "page" && nodes.length > 0 ? expandOnNavigate : void 0, children = isExpandable && nodes.length > 0 ? /* @__PURE__ */ jsx(
196
135
  ExpandableChildren,
197
136
  {
198
137
  activeIndex,
@@ -240,26 +179,19 @@ var SidebarTreeItem = memo(function SidebarTreeItem2({
240
179
  );
241
180
  });
242
181
  function Sidebar({ className, currentPath, title, tree }) {
243
- const pathname = usePathname();
244
- const resolvedCurrentPath = pathname ?? currentPath ?? "";
245
- const instanceId = useId();
246
- const activeItemRef = useRef(null);
247
- const activeIndex = useMemo(
182
+ let resolvedCurrentPath = usePathname() ?? currentPath ?? "", instanceId = useId(), activeItemRef = useRef(null), activeIndex = useMemo(
248
183
  () => createActiveIndex({ currentPath: resolvedCurrentPath, tree }),
249
184
  [resolvedCurrentPath, tree]
250
185
  );
251
- useEffect(() => {
252
- const scrollPath = resolvedCurrentPath;
253
- const frame = window.requestAnimationFrame(() => {
254
- if (!scrollPath) return;
255
- activeItemRef.current?.scrollIntoView({
186
+ return useEffect(() => {
187
+ let scrollPath = resolvedCurrentPath, frame = window.requestAnimationFrame(() => {
188
+ scrollPath && activeItemRef.current?.scrollIntoView({
256
189
  block: "nearest",
257
190
  inline: "nearest"
258
191
  });
259
192
  });
260
193
  return () => window.cancelAnimationFrame(frame);
261
- }, [resolvedCurrentPath]);
262
- return /* @__PURE__ */ jsxs(
194
+ }, [resolvedCurrentPath]), /* @__PURE__ */ jsxs(
263
195
  "nav",
264
196
  {
265
197
  "aria-label": "Documentation navigation",
@@ -273,7 +205,7 @@ function Sidebar({ className, currentPath, title, tree }) {
273
205
  ScrollArea,
274
206
  {
275
207
  className: "min-h-0 flex-1",
276
- corner: true,
208
+ corner: !0,
277
209
  mask: { height: 24 },
278
210
  scrollbarClassName: "opacity-0 transition-opacity data-[hovering]:opacity-100 data-[scrolling]:opacity-100",
279
211
  variant: "gradient",
@@ -287,7 +219,7 @@ function Sidebar({ className, currentPath, title, tree }) {
287
219
  instanceId,
288
220
  itemKey: nodeKey(node, ""),
289
221
  node,
290
- parentExpanded: true
222
+ parentExpanded: !0
291
223
  },
292
224
  nodeKey(node, "")
293
225
  )) })
@@ -1,6 +1,10 @@
1
- export { ThemeToggle } from '../ui/theme-toggle.js';
2
- import 'react/jsx-runtime';
3
- import '../ui/button.js';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { a as ButtonProps } from '../../../button-CFdx-ohV.js';
4
3
  import 'class-variance-authority/types';
5
4
  import 'class-variance-authority';
6
5
  import 'react';
6
+
7
+ type ThemeToggleProps = Omit<ButtonProps, "children" | "iconOnly" | "leftIcon" | "loading" | "rightIcon">;
8
+ declare function ThemeToggle({ className, onClick, size, title, type, variant, ...props }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
9
+
10
+ export { ThemeToggle };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
- // src/kernel/components/blocks/theme-toggle.tsx
4
- import { ThemeToggle } from "../ui/theme-toggle.js";
3
+ // src/components/block/theme-toggle.tsx
4
+ import { ThemeToggle } from "@publish.os/nextjs/kernel/components/ui/theme-toggle";
5
5
  export {
6
6
  ThemeToggle
7
7
  };