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

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 (229) hide show
  1. package/README.md +1 -1
  2. package/dist/config/createNextConfig.js +3 -3
  3. package/dist/index.js +7 -5
  4. package/dist/kernel/components/blocks/color-palette.js +35 -4
  5. package/dist/kernel/components/blocks/design-system-preview.js +18 -17
  6. package/dist/kernel/components/blocks/link-playground.js +3 -3
  7. package/dist/kernel/components/blocks/logo-block.js +1 -1
  8. package/dist/kernel/components/blocks/nav-breadcrumb.js +2 -12
  9. package/dist/kernel/components/blocks/navbar.js +1 -1
  10. package/dist/kernel/components/blocks/navigation-progress-playground.js +2 -2
  11. package/dist/kernel/components/mdx/components/image.js +1 -1
  12. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +3 -1
  13. package/dist/kernel/components/ui/breadcrumb-trail.js +1 -0
  14. package/dist/kernel/components/ui/breadcrumb.d.ts +1 -5
  15. package/dist/kernel/components/ui/breadcrumb.js +1 -16
  16. package/dist/kernel/components/ui/button-group.d.ts +2 -2
  17. package/dist/kernel/components/ui/button-group.js +2 -3
  18. package/dist/kernel/components/ui/button.d.ts +3 -4
  19. package/dist/kernel/components/ui/button.js +4 -12
  20. package/dist/kernel/components/ui/card.d.ts +1 -1
  21. package/dist/kernel/components/ui/menu.js +5 -5
  22. package/dist/kernel/components/ui/navigation-menu.js +2 -2
  23. package/dist/kernel/components/ui/popover.js +5 -11
  24. package/dist/kernel/components/ui/select.js +5 -5
  25. package/dist/kernel/components/ui/tag.d.ts +14 -0
  26. package/dist/kernel/components/ui/tag.js +76 -0
  27. package/dist/kernel/components/ui/text.d.ts +1 -1
  28. package/dist/kernel/components/ui/text.js +109 -106
  29. package/dist/kernel/components/ui/theme-toggle.js +1 -1
  30. package/dist/kernel/components/ui/tooltip.js +2 -2
  31. package/dist/kernel/defaults.registry.d.ts +63 -72
  32. package/dist/kernel/defaults.registry.js +62 -70
  33. package/dist/kernel/routes/agent/markdown.js +2 -2
  34. package/dist/kernel/routes/metadata/feed.js +2 -2
  35. package/dist/kernel/routes/metadata/llms.js +4 -2
  36. package/dist/kernel/routes/metadata/og-image.d.ts +1 -1
  37. package/dist/kernel/routes/metadata/robots.js +2 -2
  38. package/dist/kernel/routes/metadata/sitemap.js +2 -2
  39. package/dist/utils/cn.d.ts +1 -1
  40. package/package.json +4 -9
  41. package/release/package.json +4 -3
  42. package/release/release.json +5 -5
  43. package/release/{pnpm-lock.yaml → runtime-pnpm-lock.yaml} +348 -224
  44. package/dist/cache/tags.cjs +0 -79
  45. package/dist/cache/tags.d.cts +0 -13
  46. package/dist/config/createNextConfig.cjs +0 -52
  47. package/dist/config/createNextConfig.d.cts +0 -8
  48. package/dist/config.cjs +0 -78
  49. package/dist/config.d.cts +0 -101
  50. package/dist/config.d.ts +0 -101
  51. package/dist/config.js +0 -48
  52. package/dist/index.cjs +0 -1266
  53. package/dist/index.d.cts +0 -18
  54. package/dist/kernel/components/blocks/AgentActions.cjs +0 -425
  55. package/dist/kernel/components/blocks/AgentActions.d.cts +0 -52
  56. package/dist/kernel/components/blocks/animated-icon-swap.cjs +0 -101
  57. package/dist/kernel/components/blocks/animated-icon-swap.d.cts +0 -16
  58. package/dist/kernel/components/blocks/color-palette.cjs +0 -413
  59. package/dist/kernel/components/blocks/color-palette.d.cts +0 -7
  60. package/dist/kernel/components/blocks/design-system-preview.cjs +0 -592
  61. package/dist/kernel/components/blocks/design-system-preview.d.cts +0 -29
  62. package/dist/kernel/components/blocks/link-playground.cjs +0 -816
  63. package/dist/kernel/components/blocks/link-playground.d.cts +0 -5
  64. package/dist/kernel/components/blocks/logo-block.cjs +0 -156
  65. package/dist/kernel/components/blocks/logo-block.d.cts +0 -21
  66. package/dist/kernel/components/blocks/nav-breadcrumb.cjs +0 -122
  67. package/dist/kernel/components/blocks/nav-breadcrumb.d.cts +0 -11
  68. package/dist/kernel/components/blocks/navbar.cjs +0 -154
  69. package/dist/kernel/components/blocks/navbar.d.cts +0 -16
  70. package/dist/kernel/components/blocks/navigation-progress-playground.cjs +0 -735
  71. package/dist/kernel/components/blocks/navigation-progress-playground.d.cts +0 -5
  72. package/dist/kernel/components/blocks/navigation-progress.cjs +0 -270
  73. package/dist/kernel/components/blocks/navigation-progress.d.cts +0 -16
  74. package/dist/kernel/components/blocks/next-prev.cjs +0 -142
  75. package/dist/kernel/components/blocks/next-prev.d.cts +0 -11
  76. package/dist/kernel/components/blocks/page-list.cjs +0 -59
  77. package/dist/kernel/components/blocks/page-list.d.cts +0 -11
  78. package/dist/kernel/components/blocks/search.cjs +0 -717
  79. package/dist/kernel/components/blocks/search.d.cts +0 -77
  80. package/dist/kernel/components/blocks/sidebar-node.cjs +0 -309
  81. package/dist/kernel/components/blocks/sidebar-node.d.cts +0 -8
  82. package/dist/kernel/components/blocks/sidebar.cjs +0 -317
  83. package/dist/kernel/components/blocks/sidebar.d.cts +0 -33
  84. package/dist/kernel/components/blocks/theme-toggle.cjs +0 -31
  85. package/dist/kernel/components/blocks/theme-toggle.d.cts +0 -6
  86. package/dist/kernel/components/blocks/toc.cjs +0 -356
  87. package/dist/kernel/components/blocks/toc.d.cts +0 -10
  88. package/dist/kernel/components/mdx/components/blockquote.cjs +0 -66
  89. package/dist/kernel/components/mdx/components/blockquote.d.cts +0 -6
  90. package/dist/kernel/components/mdx/components/callout.cjs +0 -137
  91. package/dist/kernel/components/mdx/components/callout.d.cts +0 -18
  92. package/dist/kernel/components/mdx/components/code-block.cjs +0 -39
  93. package/dist/kernel/components/mdx/components/code-block.d.cts +0 -9
  94. package/dist/kernel/components/mdx/components/figure-caption.cjs +0 -63
  95. package/dist/kernel/components/mdx/components/figure-caption.d.cts +0 -6
  96. package/dist/kernel/components/mdx/components/figure.cjs +0 -78
  97. package/dist/kernel/components/mdx/components/figure.d.cts +0 -10
  98. package/dist/kernel/components/mdx/components/footnotes.cjs +0 -66
  99. package/dist/kernel/components/mdx/components/footnotes.d.cts +0 -6
  100. package/dist/kernel/components/mdx/components/heading-copy-link.cjs +0 -108
  101. package/dist/kernel/components/mdx/components/heading-copy-link.d.cts +0 -23
  102. package/dist/kernel/components/mdx/components/heading.cjs +0 -166
  103. package/dist/kernel/components/mdx/components/heading.d.cts +0 -8
  104. package/dist/kernel/components/mdx/components/hr.cjs +0 -34
  105. package/dist/kernel/components/mdx/components/hr.d.cts +0 -9
  106. package/dist/kernel/components/mdx/components/image-zoom.cjs +0 -49
  107. package/dist/kernel/components/mdx/components/image-zoom.d.cts +0 -10
  108. package/dist/kernel/components/mdx/components/image.cjs +0 -192
  109. package/dist/kernel/components/mdx/components/image.d.cts +0 -21
  110. package/dist/kernel/components/mdx/components/inline-code.cjs +0 -66
  111. package/dist/kernel/components/mdx/components/inline-code.d.cts +0 -6
  112. package/dist/kernel/components/mdx/components/kbd.cjs +0 -34
  113. package/dist/kernel/components/mdx/components/kbd.d.cts +0 -10
  114. package/dist/kernel/components/mdx/components/link.cjs +0 -49
  115. package/dist/kernel/components/mdx/components/link.d.cts +0 -11
  116. package/dist/kernel/components/mdx/components/paragraph.cjs +0 -87
  117. package/dist/kernel/components/mdx/components/paragraph.d.cts +0 -5
  118. package/dist/kernel/components/mdx/components/pre.cjs +0 -66
  119. package/dist/kernel/components/mdx/components/pre.d.cts +0 -6
  120. package/dist/kernel/components/mdx/components/strikethrough.cjs +0 -63
  121. package/dist/kernel/components/mdx/components/strikethrough.d.cts +0 -6
  122. package/dist/kernel/components/mdx/components/table.cjs +0 -59
  123. package/dist/kernel/components/mdx/components/table.d.cts +0 -10
  124. package/dist/kernel/components/mdx/components/task-list.cjs +0 -88
  125. package/dist/kernel/components/mdx/components/task-list.d.cts +0 -8
  126. package/dist/kernel/components/mdx/components/video-player.cjs +0 -173
  127. package/dist/kernel/components/mdx/components/video-player.d.cts +0 -18
  128. package/dist/kernel/components/mdx/components/video.cjs +0 -185
  129. package/dist/kernel/components/mdx/components/video.d.cts +0 -15
  130. package/dist/kernel/components/mdx/error-boundary.cjs +0 -62
  131. package/dist/kernel/components/mdx/error-boundary.d.cts +0 -8
  132. package/dist/kernel/components/mdx/error-fallback.cjs +0 -58
  133. package/dist/kernel/components/mdx/error-fallback.d.cts +0 -9
  134. package/dist/kernel/components/mdx/mdx.cjs +0 -141
  135. package/dist/kernel/components/mdx/mdx.d.cts +0 -22
  136. package/dist/kernel/components/mdx/rehype-heading-ids.cjs +0 -113
  137. package/dist/kernel/components/mdx/rehype-heading-ids.d.cts +0 -10
  138. package/dist/kernel/components/mdx/types.cjs +0 -18
  139. package/dist/kernel/components/mdx/types.d.cts +0 -18
  140. package/dist/kernel/components/ui/accordion.cjs +0 -104
  141. package/dist/kernel/components/ui/accordion.d.cts +0 -16
  142. package/dist/kernel/components/ui/badge.cjs +0 -75
  143. package/dist/kernel/components/ui/badge.d.cts +0 -12
  144. package/dist/kernel/components/ui/badge.d.ts +0 -12
  145. package/dist/kernel/components/ui/badge.js +0 -47
  146. package/dist/kernel/components/ui/breadcrumb-trail.cjs +0 -238
  147. package/dist/kernel/components/ui/breadcrumb-trail.d.cts +0 -13
  148. package/dist/kernel/components/ui/breadcrumb.cjs +0 -399
  149. package/dist/kernel/components/ui/breadcrumb.d.cts +0 -52
  150. package/dist/kernel/components/ui/button-group.cjs +0 -144
  151. package/dist/kernel/components/ui/button-group.d.cts +0 -19
  152. package/dist/kernel/components/ui/button.cjs +0 -147
  153. package/dist/kernel/components/ui/button.d.cts +0 -23
  154. package/dist/kernel/components/ui/card.cjs +0 -133
  155. package/dist/kernel/components/ui/card.d.cts +0 -17
  156. package/dist/kernel/components/ui/dialog.cjs +0 -149
  157. package/dist/kernel/components/ui/dialog.d.cts +0 -22
  158. package/dist/kernel/components/ui/drawer.cjs +0 -163
  159. package/dist/kernel/components/ui/drawer.d.cts +0 -24
  160. package/dist/kernel/components/ui/input.cjs +0 -96
  161. package/dist/kernel/components/ui/input.d.cts +0 -18
  162. package/dist/kernel/components/ui/kbd.cjs +0 -105
  163. package/dist/kernel/components/ui/kbd.d.cts +0 -13
  164. package/dist/kernel/components/ui/link.cjs +0 -253
  165. package/dist/kernel/components/ui/link.d.cts +0 -31
  166. package/dist/kernel/components/ui/menu.cjs +0 -301
  167. package/dist/kernel/components/ui/menu.d.cts +0 -70
  168. package/dist/kernel/components/ui/meta-key.cjs +0 -34
  169. package/dist/kernel/components/ui/meta-key.d.cts +0 -12
  170. package/dist/kernel/components/ui/navigation-menu.cjs +0 -253
  171. package/dist/kernel/components/ui/navigation-menu.d.cts +0 -47
  172. package/dist/kernel/components/ui/popover.cjs +0 -168
  173. package/dist/kernel/components/ui/popover.d.cts +0 -24
  174. package/dist/kernel/components/ui/progress.cjs +0 -112
  175. package/dist/kernel/components/ui/progress.d.cts +0 -16
  176. package/dist/kernel/components/ui/scroll-area.cjs +0 -413
  177. package/dist/kernel/components/ui/scroll-area.d.cts +0 -58
  178. package/dist/kernel/components/ui/select.cjs +0 -244
  179. package/dist/kernel/components/ui/select.d.cts +0 -40
  180. package/dist/kernel/components/ui/separator.cjs +0 -73
  181. package/dist/kernel/components/ui/separator.d.cts +0 -8
  182. package/dist/kernel/components/ui/table.cjs +0 -131
  183. package/dist/kernel/components/ui/table.d.cts +0 -11
  184. package/dist/kernel/components/ui/tabs.cjs +0 -450
  185. package/dist/kernel/components/ui/tabs.d.cts +0 -82
  186. package/dist/kernel/components/ui/text.cjs +0 -184
  187. package/dist/kernel/components/ui/text.d.cts +0 -17
  188. package/dist/kernel/components/ui/theme-toggle.cjs +0 -108
  189. package/dist/kernel/components/ui/theme-toggle.d.cts +0 -10
  190. package/dist/kernel/components/ui/toast.cjs +0 -154
  191. package/dist/kernel/components/ui/toast.d.cts +0 -26
  192. package/dist/kernel/components/ui/tooltip.cjs +0 -127
  193. package/dist/kernel/components/ui/tooltip.d.cts +0 -20
  194. package/dist/kernel/defaults.registry.cjs +0 -541
  195. package/dist/kernel/defaults.registry.d.cts +0 -469
  196. package/dist/kernel/routes/agent/markdown.cjs +0 -202
  197. package/dist/kernel/routes/agent/markdown.d.cts +0 -58
  198. package/dist/kernel/routes/layouts/group.cjs +0 -181
  199. package/dist/kernel/routes/layouts/group.d.cts +0 -20
  200. package/dist/kernel/routes/metadata/feed.cjs +0 -293
  201. package/dist/kernel/routes/metadata/feed.d.cts +0 -20
  202. package/dist/kernel/routes/metadata/llms.cjs +0 -239
  203. package/dist/kernel/routes/metadata/llms.d.cts +0 -26
  204. package/dist/kernel/routes/metadata/og-image.cjs +0 -630
  205. package/dist/kernel/routes/metadata/og-image.d.cts +0 -62
  206. package/dist/kernel/routes/metadata/robots.cjs +0 -148
  207. package/dist/kernel/routes/metadata/robots.d.cts +0 -6
  208. package/dist/kernel/routes/metadata/sitemap.cjs +0 -192
  209. package/dist/kernel/routes/metadata/sitemap.d.cts +0 -8
  210. package/dist/kernel/routes/pages/group.cjs +0 -263
  211. package/dist/kernel/routes/pages/group.d.cts +0 -17
  212. package/dist/kernel/routes/pages/leaf.cjs +0 -421
  213. package/dist/kernel/routes/pages/leaf.d.cts +0 -36
  214. package/dist/kernel/routes/pages/root.cjs +0 -229
  215. package/dist/kernel/routes/pages/root.d.cts +0 -16
  216. package/dist/keyboard-shortcuts.cjs +0 -345
  217. package/dist/keyboard-shortcuts.d.cts +0 -34
  218. package/dist/resolvers/manifest-resolver.cjs +0 -111
  219. package/dist/resolvers/manifest-resolver.d.cts +0 -13
  220. package/dist/search.cjs +0 -411
  221. package/dist/search.d.cts +0 -20
  222. package/dist/types.cjs +0 -30
  223. package/dist/types.d.cts +0 -269
  224. package/dist/utils/cn.cjs +0 -49
  225. package/dist/utils/cn.d.cts +0 -15
  226. package/dist/utils/heading-ids.cjs +0 -119
  227. package/dist/utils/heading-ids.d.cts +0 -15
  228. package/dist/utils/pretty-date.cjs +0 -55
  229. package/dist/utils/pretty-date.d.cts +0 -6
@@ -1,317 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/kernel/components/blocks/sidebar.tsx
22
- var sidebar_exports = {};
23
- __export(sidebar_exports, {
24
- Sidebar: () => Sidebar
25
- });
26
- module.exports = __toCommonJS(sidebar_exports);
27
- var import_sidebar_node = require("./sidebar-node.js");
28
- var import_scroll_area = require("../ui/scroll-area.js");
29
-
30
- // src/utils/cn.ts
31
- var import_clsx = require("clsx");
32
- var import_tailwind_merge = require("tailwind-merge");
33
- var twMerge = (0, import_tailwind_merge.extendTailwindMerge)({
34
- extend: {
35
- classGroups: {
36
- z: [
37
- "z-content",
38
- "z-nav",
39
- "z-overlay",
40
- "z-modal",
41
- "z-search",
42
- "z-toast",
43
- "z-progress"
44
- ]
45
- }
46
- }
47
- });
48
- function cn(...inputs) {
49
- return twMerge((0, import_clsx.clsx)(inputs));
50
- }
51
-
52
- // src/kernel/components/blocks/sidebar.tsx
53
- var import_navigation = require("next/navigation");
54
- var import_react = require("react");
55
- var import_jsx_runtime = require("react/jsx-runtime");
56
- function normalizePath(path) {
57
- if (!path) return "";
58
- const [withoutQuery = ""] = path.split(/[?#]/);
59
- if (withoutQuery === "/") return "/";
60
- return withoutQuery.replace(/\/+$/g, "");
61
- }
62
- function isExternalHref(href) {
63
- return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
64
- }
65
- function nodeHref(node) {
66
- if (node.type === "link") return node.href;
67
- if ("path" in node && typeof node.path === "string") return node.path;
68
- return void 0;
69
- }
70
- function nodeChildren(node) {
71
- return Array.isArray(node.children) ? node.children : [];
72
- }
73
- function nodeKey(node, parentKey) {
74
- const prefix = parentKey ? `${parentKey}/` : "";
75
- if (node.type === "page") return `${prefix}page:${node.fileID}`;
76
- if (node.type === "link") return `${prefix}link:${node.id}`;
77
- return `${prefix}${node.type}:${node.id}`;
78
- }
79
- function isActivePath(path, currentPath) {
80
- if (!path || isExternalHref(path)) return false;
81
- const normalizedPath = normalizePath(path);
82
- const normalizedCurrentPath = normalizePath(currentPath);
83
- if (!normalizedPath) return false;
84
- return normalizedCurrentPath === normalizedPath || normalizedCurrentPath.startsWith(`${normalizedPath}/`);
85
- }
86
- function isExactActivePath(path, currentPath) {
87
- if (!path || isExternalHref(path)) return false;
88
- return normalizePath(path) === normalizePath(currentPath);
89
- }
90
- function createActiveIndex({
91
- currentPath,
92
- tree
93
- }) {
94
- const activeIndex = /* @__PURE__ */ new Map();
95
- function visit(node) {
96
- const href = nodeHref(node);
97
- const exactActive = isExactActivePath(href, currentPath);
98
- const pathActive = node.type === "page" && isActivePath(href, currentPath);
99
- const childActive = nodeChildren(node).some(visit);
100
- const activeState = exactActive ? "path-active" : childActive || pathActive ? "child-path-active" : void 0;
101
- activeIndex.set(node, {
102
- activeState,
103
- initiallyExpanded: exactActive || pathActive || childActive
104
- });
105
- return exactActive || pathActive || childActive;
106
- }
107
- for (const node of tree) {
108
- visit(node);
109
- }
110
- return activeIndex;
111
- }
112
- function safeIdPart(value) {
113
- return value.replace(/[^a-zA-Z0-9-]/g, "-");
114
- }
115
- function nodeContentId({
116
- instanceId,
117
- node
118
- }) {
119
- const key = "path" in node && node.path ? node.path : node.type === "page" ? node.fileID : node.id;
120
- return `sidebar-${safeIdPart(instanceId)}-${safeIdPart(key)}`;
121
- }
122
- function clampDepth(depth) {
123
- return Math.min(depth, 12);
124
- }
125
- function ExpandableChildren({
126
- activeIndex,
127
- activeItemRef,
128
- contentId,
129
- currentPath,
130
- depth,
131
- expanded,
132
- instanceId,
133
- nodes,
134
- parentExpanded,
135
- renderChildren
136
- }) {
137
- const childFocusable = parentExpanded && expanded;
138
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
139
- "div",
140
- {
141
- "aria-hidden": !expanded,
142
- className: cn(
143
- "grid overflow-hidden transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]",
144
- expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
145
- ),
146
- "data-state": expanded ? "open" : "closed",
147
- id: contentId,
148
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "flex flex-col gap-px py-0.5", children: renderChildren ? nodes.map((child) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
149
- SidebarTreeItem,
150
- {
151
- activeIndex,
152
- activeItemRef,
153
- currentPath,
154
- depth: clampDepth(depth + 1),
155
- instanceId,
156
- itemKey: nodeKey(child, contentId),
157
- node: child,
158
- parentExpanded: childFocusable
159
- },
160
- nodeKey(child, contentId)
161
- )) : null }) })
162
- }
163
- );
164
- }
165
- var SidebarTreeItem = (0, import_react.memo)(function SidebarTreeItem2({
166
- activeIndex,
167
- activeItemRef,
168
- currentPath,
169
- depth,
170
- instanceId,
171
- itemKey,
172
- node,
173
- parentExpanded
174
- }) {
175
- const nodes = nodeChildren(node);
176
- const href = nodeHref(node);
177
- const activeInfo = activeIndex.get(node);
178
- const activeState = activeInfo?.activeState;
179
- const initiallyExpanded = Boolean(activeInfo?.initiallyExpanded);
180
- const isExpandable = nodes.length > 0 && (node.type === "folder" || node.type === "page");
181
- const [expanded, setExpanded] = (0, import_react.useState)(initiallyExpanded);
182
- const [renderChildren, setRenderChildren] = (0, import_react.useState)(initiallyExpanded);
183
- const interactedRef = (0, import_react.useRef)(false);
184
- const lastPathRef = (0, import_react.useRef)(normalizePath(currentPath));
185
- const contentId = nodeContentId({ instanceId, node });
186
- (0, import_react.useEffect)(() => {
187
- const normalizedCurrentPath = normalizePath(currentPath);
188
- const pathChanged = lastPathRef.current !== normalizedCurrentPath;
189
- if (pathChanged) {
190
- interactedRef.current = false;
191
- lastPathRef.current = normalizedCurrentPath;
192
- }
193
- if (initiallyExpanded && !expanded && !interactedRef.current) {
194
- setRenderChildren(true);
195
- (0, import_react.startTransition)(() => setExpanded(true));
196
- }
197
- }, [currentPath, expanded, initiallyExpanded]);
198
- const toggleExpanded = (0, import_react.useCallback)(() => {
199
- interactedRef.current = true;
200
- setRenderChildren(true);
201
- setExpanded((value) => !value);
202
- }, []);
203
- const expandOnNavigate = (0, import_react.useCallback)(() => {
204
- interactedRef.current = true;
205
- setRenderChildren(true);
206
- setExpanded(true);
207
- }, []);
208
- const pageWithChildrenLinkClick = node.type === "page" && nodes.length > 0 ? expandOnNavigate : void 0;
209
- const children = isExpandable && nodes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
210
- ExpandableChildren,
211
- {
212
- activeIndex,
213
- activeItemRef,
214
- contentId,
215
- currentPath,
216
- depth,
217
- expanded,
218
- instanceId,
219
- nodes,
220
- parentExpanded,
221
- renderChildren
222
- }
223
- ) : node.type === "section" && nodes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "flex flex-col gap-px", children: nodes.map((child) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
224
- SidebarTreeItem2,
225
- {
226
- activeIndex,
227
- activeItemRef,
228
- currentPath,
229
- depth,
230
- instanceId,
231
- itemKey: nodeKey(child, itemKey),
232
- node: child,
233
- parentExpanded
234
- },
235
- nodeKey(child, itemKey)
236
- )) }) : null;
237
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
238
- import_sidebar_node.SidebarNode,
239
- {
240
- activeState,
241
- activeItemRef: activeState === "path-active" ? activeItemRef : void 0,
242
- contentId: isExpandable ? contentId : void 0,
243
- depth,
244
- expanded: isExpandable ? expanded : void 0,
245
- href,
246
- isExpandable,
247
- node,
248
- onLinkClick: pageWithChildrenLinkClick,
249
- onToggle: isExpandable ? toggleExpanded : void 0,
250
- parentExpanded,
251
- title: node.title,
252
- children
253
- }
254
- );
255
- });
256
- function Sidebar({ className, currentPath, title, tree }) {
257
- const pathname = (0, import_navigation.usePathname)();
258
- const resolvedCurrentPath = pathname ?? currentPath ?? "";
259
- const instanceId = (0, import_react.useId)();
260
- const activeItemRef = (0, import_react.useRef)(null);
261
- const activeIndex = (0, import_react.useMemo)(
262
- () => createActiveIndex({ currentPath: resolvedCurrentPath, tree }),
263
- [resolvedCurrentPath, tree]
264
- );
265
- (0, import_react.useEffect)(() => {
266
- const scrollPath = resolvedCurrentPath;
267
- const frame = window.requestAnimationFrame(() => {
268
- if (!scrollPath) return;
269
- activeItemRef.current?.scrollIntoView({
270
- block: "nearest",
271
- inline: "nearest"
272
- });
273
- });
274
- return () => window.cancelAnimationFrame(frame);
275
- }, [resolvedCurrentPath]);
276
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
277
- "nav",
278
- {
279
- "aria-label": "Documentation navigation",
280
- className: cn(
281
- "flex h-full min-h-0 w-(--layout-sidebar-width) min-w-(--layout-sidebar-width) max-w-(--layout-sidebar-width) flex-col overflow-hidden pb-4",
282
- className
283
- ),
284
- children: [
285
- title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "shrink-0 px-5 pb-2 pt-5 text-xs font-semibold uppercase tracking-wide text-foreground-3", children: title }) : null,
286
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
287
- import_scroll_area.ScrollArea,
288
- {
289
- className: "min-h-0 flex-1",
290
- corner: true,
291
- mask: { height: 24 },
292
- scrollbarClassName: "opacity-0 transition-opacity data-[hovering]:opacity-100 data-[scrolling]:opacity-100",
293
- variant: "gradient",
294
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "flex flex-col gap-px px-2 py-3", children: tree.map((node) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
295
- SidebarTreeItem,
296
- {
297
- activeIndex,
298
- activeItemRef,
299
- currentPath: resolvedCurrentPath,
300
- depth: 0,
301
- instanceId,
302
- itemKey: nodeKey(node, ""),
303
- node,
304
- parentExpanded: true
305
- },
306
- nodeKey(node, "")
307
- )) })
308
- }
309
- )
310
- ]
311
- }
312
- );
313
- }
314
- // Annotate the CommonJS export names for ESM import in node:
315
- 0 && (module.exports = {
316
- Sidebar
317
- });
@@ -1,33 +0,0 @@
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';
4
-
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
- type SidebarProps = {
26
- className?: string;
27
- currentPath?: string;
28
- title?: ReactNode;
29
- tree: SidebarTreeNode[];
30
- };
31
- declare function Sidebar({ className, currentPath, title, tree }: SidebarProps): react_jsx_runtime.JSX.Element;
32
-
33
- export { Sidebar, type SidebarActiveState, type SidebarDepth, type SidebarNodePrimitiveProps, type SidebarProps, type SidebarTreeNode };
@@ -1,31 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/kernel/components/blocks/theme-toggle.tsx
22
- var theme_toggle_exports = {};
23
- __export(theme_toggle_exports, {
24
- ThemeToggle: () => import_theme_toggle.ThemeToggle
25
- });
26
- module.exports = __toCommonJS(theme_toggle_exports);
27
- var import_theme_toggle = require("../ui/theme-toggle.js");
28
- // Annotate the CommonJS export names for ESM import in node:
29
- 0 && (module.exports = {
30
- ThemeToggle
31
- });
@@ -1,6 +0,0 @@
1
- export { ThemeToggle } from '../ui/theme-toggle.cjs';
2
- import 'react/jsx-runtime';
3
- import '../ui/button.cjs';
4
- import 'class-variance-authority/types';
5
- import 'class-variance-authority';
6
- import 'react';