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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/compiler-assets/nextjs/defaults/app/globals.css +1 -0
  2. package/compiler-assets/nextjs/defaults/group/index.tsx +50 -0
  3. package/compiler-assets/nextjs/defaults/group/layout.tsx +8 -8
  4. package/compiler-assets/nextjs/defaults/group/page.tsx +44 -43
  5. package/compiler-assets/nextjs/defaults/project/next.config.mjs +33 -13
  6. package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -3
  7. package/compiler-assets/nextjs/defaults/root/css/animation.css +131 -0
  8. package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
  9. package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +4 -1
  10. package/compiler-assets/nextjs/defaults/root/css/components/menu.css +1 -1
  11. package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +1 -1
  12. package/compiler-assets/nextjs/defaults/root/css/components/popover.css +1 -1
  13. package/compiler-assets/nextjs/defaults/root/css/components/select.css +1 -1
  14. package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +1 -1
  15. package/compiler-assets/nextjs/defaults/root/css/shadow.css +6 -25
  16. package/compiler-assets/nextjs/defaults/root/css/typography.css +51 -68
  17. package/compiler-assets/nextjs/defaults/root/globals.css +25 -0
  18. package/compiler-assets/nextjs/defaults/root/{page.tsx → index.tsx} +6 -2
  19. package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -1
  20. package/compiler-assets/nextjs/defaults/root/theme.css +22 -22
  21. package/compiler-assets/nextjs/shims/document.tsx +38 -0
  22. package/compiler-assets/nextjs/shims/generated-group-page.tsx +19 -2
  23. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +18 -2
  24. package/compiler-assets/nextjs/shims/global-layout.tsx +19 -85
  25. package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
  26. package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
  27. package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
  28. package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
  29. package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
  30. package/compiler-assets/nextjs/shims/proxy.ts +143 -65
  31. package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +76 -15
  32. package/compiler-assets/nextjs/shims/root-page.tsx +7 -1
  33. package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +30 -0
  34. package/compiler-assets/nextjs/shims/site-heading-level.tsx +14 -0
  35. package/compiler-assets/nextjs/shims/site-mdx-components.tsx +112 -0
  36. package/compiler-assets/nextjs/shims/site-mdx.tsx +17 -0
  37. package/compiler-assets/nextjs/shims/theme-defaults.css +41 -25
  38. package/dist/build-operation-5QMLXF7N.js +89 -0
  39. package/dist/{button-CFdx-ohV.d.ts → button-BdCScEKi.d.ts} +6 -6
  40. package/dist/capture-local-source-WGGDIUU2.js +258 -0
  41. package/dist/chunk-22RSSUNV.js +13 -0
  42. package/dist/chunk-4BC2L2KA.js +620 -0
  43. package/dist/chunk-5J3YUNRY.js +121 -0
  44. package/dist/chunk-5KAD7W53.js +248 -0
  45. package/dist/chunk-6C65KV7O.js +142 -0
  46. package/dist/chunk-6D2E6UMD.js +695 -0
  47. package/dist/chunk-7NY22B5U.js +161 -0
  48. package/dist/chunk-AI2UULNX.js +9 -0
  49. package/dist/chunk-EFO6AWXN.js +19 -0
  50. package/dist/chunk-F3AGNDF4.js +2377 -0
  51. package/dist/chunk-GBPLER5H.js +426 -0
  52. package/dist/chunk-IL4RJOKI.js +186 -0
  53. package/dist/chunk-NNBJZPFM.js +193 -0
  54. package/dist/chunk-ORIUWJBQ.js +58 -0
  55. package/dist/chunk-OXOFRXEI.js +7129 -0
  56. package/dist/chunk-UYGCOWRF.js +1709 -0
  57. package/dist/chunk-WL75GQ5M.js +80 -0
  58. package/dist/compiler.d.ts +54 -7
  59. package/dist/compiler.js +121 -13147
  60. package/dist/components/blocks/agent-actions.d.ts +81 -0
  61. package/dist/components/blocks/agent-actions.js +594 -0
  62. package/dist/components/blocks/toc.d.ts +43 -0
  63. package/dist/components/blocks/toc.js +136 -0
  64. package/dist/components/ui/button.d.ts +5 -0
  65. package/dist/components/ui/button.js +94 -0
  66. package/dist/compose-CVBJRAF6.js +16 -0
  67. package/dist/config/createNextConfig.js +27 -0
  68. package/dist/dev-operation-OSHHWRWK.js +1095 -0
  69. package/dist/framework-selection-ZVO323PK.js +11 -0
  70. package/dist/ide-support-CU6Z5PVR.js +16 -0
  71. package/dist/index.d.ts +55 -4
  72. package/dist/jsx-dev-runtime.d.ts +6 -0
  73. package/dist/jsx-dev-runtime.js +100 -0
  74. package/dist/jsx-runtime.d.ts +7 -0
  75. package/dist/jsx-runtime.js +97 -0
  76. package/dist/kernel/components/blocks/AgentActions.d.ts +35 -6
  77. package/dist/kernel/components/blocks/AgentActions.js +401 -150
  78. package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
  79. package/dist/kernel/components/blocks/agent-actions.js +594 -0
  80. package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
  81. package/dist/kernel/components/blocks/color-palette.js +4 -4
  82. package/dist/kernel/components/blocks/logo-block.js +3 -3
  83. package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +10 -2
  84. package/dist/kernel/components/blocks/nav-breadcrumb.js +22 -7
  85. package/dist/kernel/components/blocks/navbar.d.ts +2 -2
  86. package/dist/kernel/components/blocks/navbar.js +406 -65
  87. package/dist/kernel/components/blocks/navigation-progress.js +6 -3
  88. package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
  89. package/dist/kernel/components/blocks/next-prev.js +12 -24
  90. package/dist/kernel/components/blocks/page-list.d.ts +1 -1
  91. package/dist/kernel/components/blocks/page-list.js +7 -6
  92. package/dist/kernel/components/blocks/search.d.ts +83 -58
  93. package/dist/kernel/components/blocks/search.js +554 -428
  94. package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
  95. package/dist/kernel/components/blocks/sidebar-node.js +12 -10
  96. package/dist/kernel/components/blocks/sidebar.d.ts +3 -3
  97. package/dist/kernel/components/blocks/sidebar.js +24 -14
  98. package/dist/kernel/components/blocks/theme-toggle.d.ts +2 -2
  99. package/dist/kernel/components/blocks/theme-toggle.js +47 -1
  100. package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
  101. package/dist/kernel/components/blocks/toc-client.js +495 -0
  102. package/dist/kernel/components/blocks/toc.d.ts +19 -1
  103. package/dist/kernel/components/blocks/toc.js +122 -180
  104. package/dist/kernel/components/mdx/components/blockquote.js +2 -2
  105. package/dist/kernel/components/mdx/components/callout.d.ts +5 -7
  106. package/dist/kernel/components/mdx/components/callout.js +67 -36
  107. package/dist/kernel/components/mdx/components/code-block.d.ts +5 -2
  108. package/dist/kernel/components/mdx/components/code-block.js +106 -5
  109. package/dist/kernel/components/mdx/components/copy-code-button.d.ts +8 -0
  110. package/dist/kernel/components/mdx/components/copy-code-button.js +61 -0
  111. package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
  112. package/dist/kernel/components/mdx/components/figure-caption.js +4 -3
  113. package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
  114. package/dist/kernel/components/mdx/components/figure.js +24 -14
  115. package/dist/kernel/components/mdx/components/footnotes.js +1 -1
  116. package/dist/kernel/components/mdx/components/heading-copy-link.js +4 -4
  117. package/dist/kernel/components/mdx/components/heading.js +6 -3
  118. package/dist/kernel/components/mdx/components/hr.js +2 -2
  119. package/dist/kernel/components/mdx/components/image-zoom.js +2 -2
  120. package/dist/kernel/components/mdx/components/image.d.ts +1 -1
  121. package/dist/kernel/components/mdx/components/image.js +94 -68
  122. package/dist/kernel/components/mdx/components/inline-code.js +2 -2
  123. package/dist/kernel/components/mdx/components/kbd.d.ts +2 -2
  124. package/dist/kernel/components/mdx/components/kbd.js +5 -4
  125. package/dist/kernel/components/mdx/components/link.d.ts +35 -4
  126. package/dist/kernel/components/mdx/components/link.js +3 -3
  127. package/dist/kernel/components/mdx/components/paragraph.js +2 -5
  128. package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
  129. package/dist/kernel/components/mdx/components/table.js +2 -2
  130. package/dist/kernel/components/mdx/components/task-list.js +2 -2
  131. package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
  132. package/dist/kernel/components/mdx/components/video-player.js +8 -4
  133. package/dist/kernel/components/mdx/components/video.d.ts +5 -3
  134. package/dist/kernel/components/mdx/components/video.js +8 -6
  135. package/dist/kernel/components/mdx/error-boundary.js +2 -2
  136. package/dist/kernel/components/mdx/error-fallback.js +1 -1
  137. package/dist/kernel/components/mdx/mdx.d.ts +28 -14
  138. package/dist/kernel/components/mdx/mdx.js +336 -63
  139. package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
  140. package/dist/kernel/components/mdx/rehype-heading-ids.js +6 -4
  141. package/dist/kernel/components/next-image.d.ts +12 -0
  142. package/dist/kernel/components/next-image.js +61 -0
  143. package/dist/kernel/components/ui/accordion.js +1 -1
  144. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +6 -23
  145. package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
  146. package/dist/kernel/components/ui/breadcrumb.d.ts +11 -3
  147. package/dist/kernel/components/ui/breadcrumb.js +10 -8
  148. package/dist/kernel/components/ui/button-group.js +8 -7
  149. package/dist/kernel/components/ui/button.d.ts +58 -6
  150. package/dist/kernel/components/ui/button.js +43 -39
  151. package/dist/kernel/components/ui/card.d.ts +2 -2
  152. package/dist/kernel/components/ui/card.js +1 -1
  153. package/dist/kernel/components/ui/dialog.js +1 -1
  154. package/dist/kernel/components/ui/drawer.d.ts +3 -1
  155. package/dist/kernel/components/ui/drawer.js +6 -2
  156. package/dist/kernel/components/ui/input.d.ts +2 -2
  157. package/dist/kernel/components/ui/input.js +1 -1
  158. package/dist/kernel/components/ui/kbd.js +10 -17
  159. package/dist/kernel/components/ui/link.d.ts +11 -3
  160. package/dist/kernel/components/ui/link.js +12 -11
  161. package/dist/kernel/components/ui/menu.js +6 -6
  162. package/dist/kernel/components/ui/mod-key.d.ts +10 -0
  163. package/dist/kernel/components/ui/mod-key.js +36 -0
  164. package/dist/kernel/components/ui/navigation-menu.js +3 -3
  165. package/dist/kernel/components/ui/popover.js +1 -1
  166. package/dist/kernel/components/ui/progress.js +2 -2
  167. package/dist/kernel/components/ui/scroll-area.js +5 -5
  168. package/dist/kernel/components/ui/select.js +8 -11
  169. package/dist/kernel/components/ui/separator.js +1 -1
  170. package/dist/kernel/components/ui/table.js +1 -1
  171. package/dist/kernel/components/ui/tabs.js +1 -1
  172. package/dist/kernel/components/ui/tag.js +1 -1
  173. package/dist/kernel/components/ui/text.d.ts +2 -2
  174. package/dist/kernel/components/ui/text.js +1 -1
  175. package/dist/kernel/components/ui/toast.js +1 -1
  176. package/dist/kernel/components/ui/tooltip.js +1 -1
  177. package/dist/kernel/defaults.registry.d.ts +11 -24
  178. package/dist/kernel/defaults.registry.js +11 -26
  179. package/dist/kernel/routes/agent/markdown.d.ts +3 -1
  180. package/dist/kernel/routes/agent/markdown.js +219 -48
  181. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  182. package/dist/kernel/routes/layouts/group.js +5 -7
  183. package/dist/kernel/routes/metadata/feed.d.ts +1 -1
  184. package/dist/kernel/routes/metadata/feed.js +111 -81
  185. package/dist/kernel/routes/metadata/llms.d.ts +12 -3
  186. package/dist/kernel/routes/metadata/llms.js +156 -59
  187. package/dist/kernel/routes/metadata/og-image.js +1 -1
  188. package/dist/kernel/routes/metadata/robots.d.ts +1 -1
  189. package/dist/kernel/routes/metadata/robots.js +2 -2
  190. package/dist/kernel/routes/metadata/sitemap.d.ts +26 -4
  191. package/dist/kernel/routes/metadata/sitemap.js +206 -38
  192. package/dist/kernel/routes/not-found.d.ts +34 -0
  193. package/dist/kernel/routes/not-found.js +213 -0
  194. package/dist/kernel/routes/pages/group.d.ts +2 -2
  195. package/dist/kernel/routes/pages/group.js +21 -13
  196. package/dist/kernel/routes/pages/leaf.d.ts +28 -1
  197. package/dist/kernel/routes/pages/leaf.js +25 -16
  198. package/dist/kernel/routes/pages/root.js +19 -13
  199. package/dist/keyboard-shortcuts.js +1 -1
  200. package/dist/resolvers/manifest-resolver.js +29 -6
  201. package/dist/search.d.ts +6 -7
  202. package/dist/search.js +52 -29
  203. package/dist/{sidebar-types-Bgchdfd6.d.ts → sidebar-types-DKpR27II.d.ts} +1 -1
  204. package/dist/theme-scope.js +1 -1
  205. package/dist/{types-DHBm7-j6.d.ts → types-CJWRG05y.d.ts} +20 -1
  206. package/dist/{types-B_b3C0U6.d.ts → types-CUtrppxt.d.ts} +8 -2
  207. package/dist/{types-CIwwieNw.d.ts → types-J2w_puPF.d.ts} +11 -10
  208. package/dist/types.d.ts +15 -6
  209. package/dist/utils/heading-ids.js +30 -11
  210. package/dist/utils/toc-selection.d.ts +7 -0
  211. package/dist/utils/toc-selection.js +14 -0
  212. package/dist/validate-local-source-SV44DBQT.js +16 -0
  213. package/dist/validate-publish-os-source-NZJF3TB2.js +14 -0
  214. package/init/seed/minimal/.gitignore +1 -0
  215. package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
  216. package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
  217. package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
  218. package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
  219. package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
  220. package/init/seed/minimal/publish.os/blog/index.tsx +82 -0
  221. package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
  222. package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
  223. package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
  224. package/init/seed/minimal/publish.os/docs/content/get-started.mdx +6 -11
  225. package/init/seed/minimal/publish.os/docs/content/groups.mdx +6 -7
  226. package/init/seed/minimal/publish.os/docs/content/{theme.mdx → themes.mdx} +14 -12
  227. package/init/seed/minimal/publish.os/publish.os.config.json +7 -7
  228. package/init/seed/minimal/publish.os/theme.css +52 -24
  229. package/init/seed/minimal/publish.os/tsconfig.json +3 -0
  230. package/init/seed/minimal/seed.json +12 -2
  231. package/init/seed/scratch/publish.os/docs/content/get-started.mdx +6 -0
  232. package/init/seed/scratch/publish.os/publish.os.config.json +4 -0
  233. package/init/seed/scratch/seed.json +5 -0
  234. package/package.json +55 -44
  235. package/release/app/phosphor/package.json +5 -5
  236. package/release/app/phosphor/pnpm-lock.yaml.template +553 -377
  237. package/release/app/phosphor/pnpm-workspace.yaml +3 -0
  238. package/release/compiler/package.json +5 -3
  239. package/release/compiler/pnpm-lock.yaml.template +500 -303
  240. package/release/compiler/pnpm-workspace.yaml +3 -0
  241. package/release/release.json +8 -37
  242. package/compiler-assets/nextjs/defaults/group/leaf.tsx +0 -48
  243. package/dist/icons.d.ts +0 -1
  244. package/dist/icons.js +0 -2
  245. package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
  246. package/dist/kernel/components/blocks/design-system-preview.js +0 -648
  247. package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
  248. package/dist/kernel/components/blocks/link-playground.js +0 -744
  249. package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
  250. package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
  251. package/dist/kernel/components/mdx/components/pre.d.ts +0 -6
  252. package/dist/kernel/components/mdx/components/pre.js +0 -18
  253. package/dist/kernel/components/ui/meta-key.d.ts +0 -17
  254. package/dist/kernel/components/ui/meta-key.js +0 -9
  255. package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
  256. package/dist/kernel/components/ui/theme-toggle.js +0 -58
  257. package/dist/kernel/framework-icons.d.ts +0 -1
  258. package/dist/kernel/framework-icons.js +0 -39
  259. package/dist/link-CYaCRDb6.d.ts +0 -35
  260. package/release/app/lucide/package.json +0 -30
  261. package/release/app/lucide/pnpm-lock.yaml.template +0 -2905
  262. package/release/app/lucide/pnpm-workspace.yaml +0 -11
  263. package/release/app/tabler/package.json +0 -30
  264. package/release/app/tabler/pnpm-lock.yaml.template +0 -2911
  265. package/release/app/tabler/pnpm-workspace.yaml +0 -11
package/dist/search.d.ts CHANGED
@@ -47,7 +47,6 @@ type SearchOutput = {
47
47
  status: SearchStatus;
48
48
  total: number;
49
49
  };
50
- type SearchBlockVariant = "desktop" | "mobile";
51
50
  type SearchBlockState = {
52
51
  displayResults: SearchResult[];
53
52
  isTyping: boolean;
@@ -71,8 +70,9 @@ type SearchBlockMeta = {
71
70
  inputRef: RefObject<HTMLInputElement | null>;
72
71
  listId: string;
73
72
  listRef: RefObject<HTMLDivElement | null>;
74
- shortcut: string;
75
- variant: SearchBlockVariant;
73
+ popupId: string;
74
+ shortcut: string | false;
75
+ triggerRef: RefObject<HTMLButtonElement | null>;
76
76
  };
77
77
  type SearchBlockContextValue = {
78
78
  actions: SearchBlockActions;
@@ -89,9 +89,8 @@ type SearchProviderProps = {
89
89
  limit?: number;
90
90
  onOpenChange?: (open: boolean) => void;
91
91
  open?: boolean;
92
- shortcut?: string;
93
- variant?: SearchBlockVariant;
92
+ shortcut?: string | false;
94
93
  };
95
- declare function SearchProvider({ children, defaultOpen, limit, onOpenChange, open: controlledOpen, shortcut, variant, }: SearchProviderProps): react_jsx_runtime.JSX.Element;
94
+ declare function SearchProvider({ children, defaultOpen, limit, onOpenChange, open: controlledOpen, shortcut, }: SearchProviderProps): react_jsx_runtime.JSX.Element;
96
95
 
97
- export { type SearchBlockActions, type SearchBlockContextValue, type SearchBlockMeta, type SearchBlockState, type SearchBlockVariant, type SearchInput, type SearchOutput, SearchProvider, type SearchProviderProps, type SearchResult, type SearchStatus, type SearchSubResult, search, useSearch, useSearchBlock };
96
+ export { type SearchBlockActions, type SearchBlockContextValue, type SearchBlockMeta, type SearchBlockState, type SearchInput, type SearchOutput, SearchProvider, type SearchProviderProps, type SearchResult, type SearchStatus, type SearchSubResult, search, useSearch, useSearchBlock };
package/dist/search.js CHANGED
@@ -5,15 +5,22 @@ import { useShortcut } from "@publish.os/nextjs/keyboard-shortcuts";
5
5
  import { useRouter } from "next/navigation";
6
6
  import {
7
7
  createContext,
8
+ startTransition,
9
+ use,
8
10
  useCallback,
9
- useContext,
10
11
  useEffect,
11
12
  useId,
12
13
  useMemo,
13
14
  useRef,
14
15
  useState
15
16
  } from "react";
16
- import { jsx } from "react/jsx-runtime";
17
+
18
+ // src/lib/hosting/framework-paths.ts
19
+ var FRAMEWORK_PREFIX = "/publishos", SOURCE_ASSET_PREFIX = `${FRAMEWORK_PREFIX}/assets`, INTERNAL_PREFIX = `${FRAMEWORK_PREFIX}/internal`, SITE_API_PREFIX = `${FRAMEWORK_PREFIX}/api`, SEARCH_PREFIX = `${INTERNAL_PREFIX}/search`, PAGEFIND_MODULE_URL = `${SEARCH_PREFIX}/pagefind.js`, PAGEFIND_ENTRY_URL = `${SEARCH_PREFIX}/pagefind-entry.json`, IMAGE_OPTIMIZER_PATH = `${SITE_API_PREFIX}/image`;
20
+ var OG_SERVICE_PREFIX = `${SITE_API_PREFIX}/og`, PUBLIC_INTERNAL_DIRECTORY = INTERNAL_PREFIX.slice(1), PUBLIC_FONT_DIRECTORY = `${PUBLIC_INTERNAL_DIRECTORY}/fonts`, PUBLIC_SEARCH_DIRECTORY = `public/${PUBLIC_INTERNAL_DIRECTORY}/search`, FRAMEWORK_PROXY_MATCHER = `/((?!${FRAMEWORK_PREFIX.slice(1)}(?:/|$)|_next/static|_next/image|_next/webpack-hmr).*)`;
21
+
22
+ // src/modules/search/search.tsx
23
+ import { jsx } from "@publish.os/nextjs/jsx-runtime";
17
24
  var EMPTY_SEARCH_OUTPUT = {
18
25
  items: [],
19
26
  nextOffset: null,
@@ -40,7 +47,7 @@ function inactiveIndexMessage() {
40
47
  total: 0
41
48
  };
42
49
  }
43
- var SEARCH_STATUS_URL = "/pagefind/pagefind-entry.json", PAGEFIND_URL = "/pagefind/pagefind.js", pagefindModulePromise = null, activeIndex;
50
+ var SEARCH_STATUS_URL = PAGEFIND_ENTRY_URL, PAGEFIND_URL = PAGEFIND_MODULE_URL, pagefindModulePromise = null, pagefindModuleFailures = 0, activeIndex;
44
51
  async function fetchSearchStatus(signal) {
45
52
  let response = await fetch(SEARCH_STATUS_URL, {
46
53
  cache: "no-store",
@@ -53,7 +60,10 @@ async function fetchSearchStatus(signal) {
53
60
  return response?.ok ? (await response.json()).publishos ?? null : null;
54
61
  }
55
62
  async function loadPagefind() {
56
- return pagefindModulePromise ??= new Function("src", "return import(src)")(PAGEFIND_URL), pagefindModulePromise;
63
+ let url = pagefindModuleFailures ? `${PAGEFIND_URL}?retry=${pagefindModuleFailures}` : PAGEFIND_URL;
64
+ return pagefindModulePromise ??= new Function("src", "return import(src)")(url).catch((error) => {
65
+ throw pagefindModuleFailures += 1, pagefindModulePromise = null, error;
66
+ }), pagefindModulePromise;
57
67
  }
58
68
  async function withPagefindIndex(revision, run) {
59
69
  let release = async (index) => {
@@ -66,7 +76,9 @@ async function withPagefindIndex(revision, run) {
66
76
  readers: 0,
67
77
  retired: !1,
68
78
  instance: loadPagefind().then(async (module) => {
69
- let instance = module.createInstance({ bundlePath: "/pagefind/" });
79
+ let instance = module.createInstance({
80
+ baseUrl: "/"
81
+ });
70
82
  return await instance.init?.(), instance;
71
83
  })
72
84
  }, previous && (previous.retired = !0, release(previous).catch(() => {
@@ -76,6 +88,8 @@ async function withPagefindIndex(revision, run) {
76
88
  selected.readers += 1;
77
89
  try {
78
90
  return await run(await selected.instance);
91
+ } catch (error) {
92
+ throw activeIndex === selected && (activeIndex = void 0), selected.retired = !0, error;
79
93
  } finally {
80
94
  selected.readers -= 1, await release(selected);
81
95
  }
@@ -92,6 +106,20 @@ function pagefindFilters(filters) {
92
106
  function titleForResult(data) {
93
107
  return data.meta?.title ?? data.sub_results?.find((subResult) => subResult.title)?.title ?? data.url;
94
108
  }
109
+ function plainExcerpt(value) {
110
+ let entities = {
111
+ "&amp;": "&",
112
+ "&lt;": "<",
113
+ "&gt;": ">",
114
+ "&quot;": '"',
115
+ "&#39;": "'",
116
+ "&#x27;": "'"
117
+ };
118
+ return value.replace(/<[^>]*>/g, "").replace(
119
+ /&(?:amp|lt|gt|quot|#39|#x27);/g,
120
+ (entity) => entities[entity] ?? entity
121
+ );
122
+ }
95
123
  function toSearchResult({
96
124
  data,
97
125
  fallbackId,
@@ -102,11 +130,11 @@ function toSearchResult({
102
130
  excerpt,
103
131
  id: data.url || fallbackId,
104
132
  meta: data.meta ?? {},
105
- plainExcerpt: data.plain_excerpt ?? excerpt.replace(/<[^>]*>/g, ""),
133
+ plainExcerpt: plainExcerpt(data.plain_excerpt ?? excerpt),
106
134
  score,
107
135
  subResults: (data.sub_results ?? []).map((result) => ({
108
136
  excerpt: result.excerpt ?? "",
109
- plainExcerpt: (result.excerpt ?? "").replace(/<[^>]*>/g, ""),
137
+ plainExcerpt: plainExcerpt(result.plain_excerpt ?? result.excerpt ?? ""),
110
138
  title: result.title ?? title,
111
139
  url: result.url ?? data.url
112
140
  })),
@@ -148,20 +176,18 @@ async function runPagefindSearch(input) {
148
176
  let status = await fetchSearchStatus(input.signal), blockedByStatus = status ? statusOutput(status) : null;
149
177
  return blockedByStatus || await withPagefindIndex(status?.revision, async (pagefind) => {
150
178
  let limit = normalized.limit ?? DEFAULT_SEARCH_LIMIT, offset = normalized.offset ?? 0, result = await pagefind.search(normalized.q, {
151
- filters: pagefindFilters(normalized.filters),
152
- limit,
153
- offset
179
+ filters: pagefindFilters(normalized.filters)
154
180
  });
155
181
  if (!result) return EMPTY_SEARCH_OUTPUT;
156
- let items = await Promise.all(
157
- result.results.map(
182
+ let total = result.results.length, page = result.results.slice(offset, offset + limit), items = await Promise.all(
183
+ page.map(
158
184
  async (pagefindResult) => toSearchResult({
159
185
  data: await pagefindResult.data(),
160
186
  fallbackId: pagefindResult.id,
161
187
  score: pagefindResult.score
162
188
  })
163
189
  )
164
- ), total = result.unfilteredResultCount ?? items.length, nextOffset = offset + limit < total ? offset + limit : null;
190
+ ), nextOffset = offset + limit < total ? offset + limit : null;
165
191
  return {
166
192
  items,
167
193
  nextOffset,
@@ -204,7 +230,7 @@ function useSearch(input) {
204
230
  }, [stableInput]), output;
205
231
  }
206
232
  function useSearchBlock() {
207
- let value = useContext(SearchBlockContext);
233
+ let value = use(SearchBlockContext);
208
234
  if (!value)
209
235
  throw new Error("useSearchBlock must be used inside <Search.Root>.");
210
236
  return value;
@@ -215,14 +241,15 @@ function SearchProvider({
215
241
  limit = DEFAULT_SEARCH_LIMIT,
216
242
  onOpenChange,
217
243
  open: controlledOpen,
218
- shortcut = "mod+k",
219
- variant = "desktop"
244
+ shortcut = "mod+k"
220
245
  }) {
221
- let [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen), [query, setQuery] = useState(""), [isTyping, setIsTyping] = useState(!1), [selectedValue, setSelectedValue] = useState(""), typingTimer = useRef(null), inputRef = useRef(null), listRef = useRef(null), router = useRouter(), inputId = useId(), listId = useId(), open = controlledOpen ?? uncontrolledOpen, output = useSearch({ limit, q: query }), [displayResults, setDisplayResults] = useState([]), selectedResultId = (displayResults.find((result) => result.id === selectedValue) ?? displayResults[0])?.id ?? "", loading = !!query.trim() && !isTyping && output.status === "idle", setOpen = useCallback(
246
+ let [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen), [query, setQuery] = useState(""), [isTyping, setIsTyping] = useState(!1), [selectedValue, setSelectedValue] = useState(""), typingTimer = useRef(null), inputRef = useRef(null), listRef = useRef(null), triggerRef = useRef(null), router = useRouter(), inputId = useId(), listId = useId(), popupId = useId(), open = controlledOpen ?? uncontrolledOpen, output = useSearch({ limit, q: open ? query : "" }), [displayResults, setDisplayResults] = useState([]), selectedResultId = (displayResults.find((result) => result.id === selectedValue) ?? displayResults[0])?.id ?? "", loading = open && !!query.trim() && !isTyping && output.status === "idle", setOpen = useCallback(
222
247
  (nextOpen) => {
223
- controlledOpen === void 0 && setUncontrolledOpen(nextOpen), onOpenChange?.(nextOpen), nextOpen || (setQuery(""), setSelectedValue(""), setIsTyping(!1));
248
+ startTransition(() => {
249
+ controlledOpen === void 0 && setUncontrolledOpen(nextOpen), onOpenChange?.(nextOpen);
250
+ }), nextOpen && !open && (setQuery(""), setSelectedValue(""), setIsTyping(!1)), nextOpen || typingTimer.current !== null && (window.clearTimeout(typingTimer.current), typingTimer.current = null);
224
251
  },
225
- [controlledOpen, onOpenChange]
252
+ [controlledOpen, onOpenChange, open]
226
253
  ), setQueryValue = useCallback((value) => {
227
254
  setQuery(value);
228
255
  }, []), handleInputChange = useCallback((value) => {
@@ -235,13 +262,8 @@ function SearchProvider({
235
262
  },
236
263
  [router, setOpen]
237
264
  );
238
- useEffect(() => {
239
- if (!open) return;
240
- let frame = window.requestAnimationFrame(() => {
241
- inputRef.current?.focus();
242
- });
243
- return () => window.cancelAnimationFrame(frame);
244
- }, [open]), useShortcut(shortcut, () => setOpen(!0), {
265
+ useShortcut(shortcut || "mod+k", () => setOpen(!0), {
266
+ enabled: shortcut !== !1 && !open,
245
267
  description: "Open search",
246
268
  group: "Search",
247
269
  priority: 100
@@ -277,8 +299,9 @@ function SearchProvider({
277
299
  inputRef,
278
300
  listId,
279
301
  listRef,
302
+ popupId,
280
303
  shortcut,
281
- variant
304
+ triggerRef
282
305
  },
283
306
  state: {
284
307
  displayResults,
@@ -304,12 +327,12 @@ function SearchProvider({
304
327
  output.message,
305
328
  output.status,
306
329
  output.total,
330
+ popupId,
307
331
  query,
308
332
  selectedResultId,
309
333
  setOpen,
310
334
  setQueryValue,
311
- shortcut,
312
- variant
335
+ shortcut
313
336
  ]
314
337
  );
315
338
  return /* @__PURE__ */ jsx(SearchBlockContext.Provider, { value: contextValue, children });
@@ -1,5 +1,5 @@
1
1
  import { Ref, ReactNode, MouseEvent } from 'react';
2
- import { T as TreeNode } from './types-DHBm7-j6.js';
2
+ import { T as TreeNode } from './types-CJWRG05y.js';
3
3
 
4
4
  type SidebarTreeNode = TreeNode & {
5
5
  children?: SidebarTreeNode[];
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/lib/theme/theme-scope.tsx
4
4
  import { createContext, use } from "react";
5
- import { jsx } from "react/jsx-runtime";
5
+ import { jsx } from "@publish.os/nextjs/jsx-runtime";
6
6
  var ROOT_SCOPE = Object.freeze({
7
7
  "data-group": "",
8
8
  "data-theme-root": ""
@@ -15,11 +15,28 @@ type Author = {
15
15
  url?: string;
16
16
  };
17
17
  type PageStatus = "published" | "draft" | "archived";
18
+ type PageData<TMeta extends Record<string, unknown> = Record<string, unknown>> = {
19
+ fileID: string;
20
+ group: string;
21
+ slug: string;
22
+ path: string;
23
+ title: string;
24
+ description?: string;
25
+ status: PageStatus;
26
+ publishedAt?: string;
27
+ updatedAt?: string;
28
+ authors: Author[];
29
+ tags: string[];
30
+ og?: OgMetadata;
31
+ meta: TMeta;
32
+ body: string;
33
+ };
18
34
  type PageNode = {
19
35
  type: "page";
20
36
  fileID: string;
21
37
  title: string;
22
38
  path: string;
39
+ href?: string;
23
40
  group: string;
24
41
  description?: string;
25
42
  status: PageStatus;
@@ -35,6 +52,7 @@ type SectionNode = {
35
52
  id: string;
36
53
  title: string;
37
54
  path?: string;
55
+ href?: string;
38
56
  group?: string;
39
57
  children: TreeNode[];
40
58
  };
@@ -43,6 +61,7 @@ type FolderNode = {
43
61
  id: string;
44
62
  title: string;
45
63
  path?: string;
64
+ href?: string;
46
65
  group?: string;
47
66
  children: TreeNode[];
48
67
  };
@@ -54,4 +73,4 @@ type LinkNode = {
54
73
  };
55
74
  type TreeNode = PageNode | SectionNode | FolderNode | LinkNode;
56
75
 
57
- export type { TreeNode as T };
76
+ export type { PageData as P, TreeNode as T };
@@ -1,8 +1,8 @@
1
1
  type SiteData = {
2
2
  name: string;
3
3
  description?: string;
4
- url?: string;
5
- og?: OgMetadata;
4
+ origin?: string;
5
+ og?: OgIndexMetadata;
6
6
  };
7
7
  type OgImageMetadata = string | {
8
8
  src: string;
@@ -13,6 +13,9 @@ type OgMetadata = {
13
13
  description?: string;
14
14
  image?: OgImageMetadata;
15
15
  };
16
+ type OgIndexMetadata = OgMetadata & {
17
+ scope?: "page" | "subtree";
18
+ };
16
19
  type Author = {
17
20
  id?: string;
18
21
  name: string;
@@ -26,6 +29,7 @@ type PageNode = {
26
29
  fileID: string;
27
30
  title: string;
28
31
  path: string;
32
+ href?: string;
29
33
  group: string;
30
34
  description?: string;
31
35
  status: PageStatus;
@@ -41,6 +45,7 @@ type SectionNode = {
41
45
  id: string;
42
46
  title: string;
43
47
  path?: string;
48
+ href?: string;
44
49
  group?: string;
45
50
  children: TreeNode[];
46
51
  };
@@ -49,6 +54,7 @@ type FolderNode = {
49
54
  id: string;
50
55
  title: string;
51
56
  path?: string;
57
+ href?: string;
52
58
  group?: string;
53
59
  children: TreeNode[];
54
60
  };
@@ -1,8 +1,8 @@
1
1
  type SiteData = {
2
2
  name: string;
3
3
  description?: string;
4
- url?: string;
5
- og?: OgMetadata;
4
+ origin?: string;
5
+ og?: OgIndexMetadata;
6
6
  };
7
7
  type OgImageMetadata = string | {
8
8
  src: string;
@@ -13,6 +13,9 @@ type OgMetadata = {
13
13
  description?: string;
14
14
  image?: OgImageMetadata;
15
15
  };
16
+ type OgIndexMetadata = OgMetadata & {
17
+ scope?: "page" | "subtree";
18
+ };
16
19
  type Author = {
17
20
  id?: string;
18
21
  name: string;
@@ -42,6 +45,7 @@ type PageNode = {
42
45
  fileID: string;
43
46
  title: string;
44
47
  path: string;
48
+ href?: string;
45
49
  group: string;
46
50
  description?: string;
47
51
  status: PageStatus;
@@ -57,6 +61,7 @@ type SectionNode = {
57
61
  id: string;
58
62
  title: string;
59
63
  path?: string;
64
+ href?: string;
60
65
  group?: string;
61
66
  children: TreeNode[];
62
67
  };
@@ -65,6 +70,7 @@ type FolderNode = {
65
70
  id: string;
66
71
  title: string;
67
72
  path?: string;
73
+ href?: string;
68
74
  group?: string;
69
75
  children: TreeNode[];
70
76
  };
@@ -94,7 +100,9 @@ type GroupManifest = {
94
100
  key: string;
95
101
  title: string;
96
102
  path: string;
103
+ origin?: string;
97
104
  ancestry?: string[];
105
+ og?: OgIndexMetadata;
98
106
  meta?: Record<string, unknown>;
99
107
  tree: TreeNode[];
100
108
  pages: PageData[];
@@ -116,12 +124,5 @@ type LayoutProps = {
116
124
  currentPath: string;
117
125
  group: string;
118
126
  };
119
- type IndexPageProps = {
120
- site: SiteData;
121
- tree: TreeNode[];
122
- node: TreeNode;
123
- currentPath: string;
124
- group: string;
125
- };
126
127
 
127
- export type { IndexPageProps as I, LayoutProps as L, ManifestLike as M, PageStatus as P };
128
+ export type { LayoutProps as L, ManifestLike as M, PageStatus as P };
package/dist/types.d.ts CHANGED
@@ -46,7 +46,6 @@ type SearchOutput = {
46
46
  status: SearchStatus;
47
47
  total: number;
48
48
  };
49
- type SearchBlockVariant = "desktop" | "mobile";
50
49
  type SearchBlockState = {
51
50
  displayResults: SearchResult[];
52
51
  isTyping: boolean;
@@ -70,8 +69,9 @@ type SearchBlockMeta = {
70
69
  inputRef: RefObject<HTMLInputElement | null>;
71
70
  listId: string;
72
71
  listRef: RefObject<HTMLDivElement | null>;
73
- shortcut: string;
74
- variant: SearchBlockVariant;
72
+ popupId: string;
73
+ shortcut: string | false;
74
+ triggerRef: RefObject<HTMLButtonElement | null>;
75
75
  };
76
76
  type SearchBlockContextValue = {
77
77
  actions: SearchBlockActions;
@@ -87,8 +87,8 @@ type Heading = {
87
87
  type SiteData = {
88
88
  name: string;
89
89
  description?: string;
90
- url?: string;
91
- og?: OgMetadata;
90
+ origin?: string;
91
+ og?: OgIndexMetadata;
92
92
  };
93
93
  type OgImageMetadata = string | {
94
94
  src: string;
@@ -99,6 +99,9 @@ type OgMetadata = {
99
99
  description?: string;
100
100
  image?: OgImageMetadata;
101
101
  };
102
+ type OgIndexMetadata = OgMetadata & {
103
+ scope?: "page" | "subtree";
104
+ };
102
105
  type Author = {
103
106
  id?: string;
104
107
  name: string;
@@ -142,6 +145,7 @@ type PageNode = {
142
145
  fileID: string;
143
146
  title: string;
144
147
  path: string;
148
+ href?: string;
145
149
  group: string;
146
150
  description?: string;
147
151
  status: PageStatus;
@@ -157,6 +161,7 @@ type SectionNode = {
157
161
  id: string;
158
162
  title: string;
159
163
  path?: string;
164
+ href?: string;
160
165
  group?: string;
161
166
  children: TreeNode[];
162
167
  };
@@ -165,6 +170,7 @@ type FolderNode = {
165
170
  id: string;
166
171
  title: string;
167
172
  path?: string;
173
+ href?: string;
168
174
  group?: string;
169
175
  children: TreeNode[];
170
176
  };
@@ -199,7 +205,9 @@ type GroupManifest = {
199
205
  key: string;
200
206
  title: string;
201
207
  path: string;
208
+ origin?: string;
202
209
  ancestry?: string[];
210
+ og?: OgIndexMetadata;
203
211
  meta?: Record<string, unknown>;
204
212
  tree: TreeNode[];
205
213
  pages: PageData[];
@@ -238,6 +246,7 @@ type PageProps<TMeta extends Record<string, unknown> = Record<string, unknown>>
238
246
  tree: TreeNode[];
239
247
  node: TreeNode;
240
248
  page: PageData<TMeta>;
249
+ markdownRevision?: string;
241
250
  currentPath: string;
242
251
  group: string;
243
252
  };
@@ -265,4 +274,4 @@ type GroupContext = {
265
274
 
266
275
  declare const __publishOsTypesModule = true;
267
276
 
268
- export { type Author, type FolderNode, type GroupContext, type GroupForcedMode, type GroupManifest, type Heading, type IndexPageProps, type LayoutProps, type LinkNode, type ManifestLike, type NavFolder, type NavItem, type NavLink, type NavPage, type NavSection, type OgImageMetadata, type OgMetadata, type PageData, type PageFrontmatter, type PageNode, type PageProps, type PageStatus, type PageSummary, type ResolvedAttribution, type RootLayoutProps, type RootPageProps, type RouteRecord, type SearchBlockActions, type SearchBlockContextValue, type SearchBlockMeta, type SearchBlockState, type SearchBlockVariant, type SearchInput, type SearchOutput, type SearchResult, type SearchStatus, type SearchSubResult, type SectionNode, type SiteData, type ThemeMode, type TreeNode, __publishOsTypesModule };
277
+ export { type Author, type FolderNode, type GroupContext, type GroupForcedMode, type GroupManifest, type Heading, type IndexPageProps, type LayoutProps, type LinkNode, type ManifestLike, type NavFolder, type NavItem, type NavLink, type NavPage, type NavSection, type OgImageMetadata, type OgIndexMetadata, type OgMetadata, type PageData, type PageFrontmatter, type PageNode, type PageProps, type PageStatus, type PageSummary, type ResolvedAttribution, type RootLayoutProps, type RootPageProps, type RouteRecord, type SearchBlockActions, type SearchBlockContextValue, type SearchBlockMeta, type SearchBlockState, type SearchInput, type SearchOutput, type SearchResult, type SearchStatus, type SearchSubResult, type SectionNode, type SiteData, type ThemeMode, type TreeNode, __publishOsTypesModule };
@@ -1,6 +1,29 @@
1
1
  // src/components/mdx/heading-ids.ts
2
2
  import { isValidElement } from "react";
3
- var SELF_CLOSING_TAG_RE = new RegExp("<[^>]+/>", "g"), PAIRED_TAG_RE = /<\/?\w[^>]*>/g, MDX_BOLD_RE = /\*\*(.*?)\*\*/g, MDX_ITALIC_RE = /\*(.*?)\*/g, MDX_UNDERLINE_BOLD_RE = /__(.*?)__/g, MDX_UNDERLINE_ITALIC_RE = /_(.*?)_/g, MDX_STRIKETHROUGH_RE = /~~(.*?)~~/g, MDX_INLINE_CODE_RE = /`(.*?)`/g, MDX_LINK_RE = /\[(.*?)\]\(.*?\)/g, NON_ALPHANUMERIC_RE = /[^a-z0-9]+/g, LEADING_TRAILING_HYPHEN_RE = /^-+|-+$/g, LEADING_DIGIT_RE = /^(\d)/, HEADING_RE = /^(#{1,6})[ \t]+(.+?)\s*#*\s*$/gm, FENCED_CODE_RE = /```[\s\S]*?```|~~~[\s\S]*?~~~/g;
3
+
4
+ // src/components/mdx/heading-string.ts
5
+ var SELF_CLOSING_TAG_RE = /<[^>]+\/>/g, PAIRED_TAG_RE = /<\/?\w[^>]*>/g, MDX_BOLD_RE = /\*\*(.*?)\*\*/g, MDX_ITALIC_RE = /\*(.*?)\*/g, MDX_UNDERLINE_BOLD_RE = /__(.*?)__/g, MDX_UNDERLINE_ITALIC_RE = /_(.*?)_/g, MDX_STRIKETHROUGH_RE = /~~(.*?)~~/g, MDX_INLINE_CODE_RE = /`(.*?)`/g, MDX_LINK_RE = /\[(.*?)\]\(.*?\)/g, NON_ALPHANUMERIC_RE = /[^a-z0-9]+/g, LEADING_TRAILING_HYPHEN_RE = /^-+|-+$/g, LEADING_DIGIT_RE = /^(\d)/;
6
+ function cleanHeadingString(input) {
7
+ return input.replace(SELF_CLOSING_TAG_RE, "").replace(PAIRED_TAG_RE, "").replace(MDX_BOLD_RE, "$1").replace(MDX_ITALIC_RE, "$1").replace(MDX_UNDERLINE_BOLD_RE, "$1").replace(MDX_UNDERLINE_ITALIC_RE, "$1").replace(MDX_STRIKETHROUGH_RE, "$1").replace(MDX_INLINE_CODE_RE, "$1").replace(MDX_LINK_RE, "$1").trim();
8
+ }
9
+ function headingStringToHTMLId(input) {
10
+ let text = cleanHeadingString(input);
11
+ return text ? text.toLowerCase().replace(NON_ALPHANUMERIC_RE, "-").replace(LEADING_TRAILING_HYPHEN_RE, "").replace(LEADING_DIGIT_RE, "id-$1") || "heading" : "empty-heading";
12
+ }
13
+ function createHeadingStringIdGenerator() {
14
+ let nextSuffix = /* @__PURE__ */ new Map(), usedIds = /* @__PURE__ */ new Set();
15
+ return (input) => {
16
+ let baseId = headingStringToHTMLId(input);
17
+ if (baseId === "empty-heading") return baseId;
18
+ let suffix = nextSuffix.get(baseId) ?? 0, id = suffix === 0 ? baseId : `${baseId}-${suffix}`;
19
+ for (; usedIds.has(id); )
20
+ suffix += 1, id = `${baseId}-${suffix}`;
21
+ return nextSuffix.set(baseId, suffix + 1), usedIds.add(id), id;
22
+ };
23
+ }
24
+
25
+ // src/components/mdx/heading-ids.ts
26
+ var HEADING_RE = /^(#{1,6})[ \t]+(.+?)\s*#*\s*$/gm, FENCED_CODE_RE = /```[\s\S]*?```|~~~[\s\S]*?~~~/g;
4
27
  function extractText(node) {
5
28
  if (typeof node == "string") return node;
6
29
  if (typeof node == "number") return String(node);
@@ -14,26 +37,22 @@ function extractText(node) {
14
37
  return "";
15
38
  }
16
39
  function cleanHeadingText(input) {
17
- return (typeof input == "string" ? input : extractText(input)).replace(SELF_CLOSING_TAG_RE, "").replace(PAIRED_TAG_RE, "").replace(MDX_BOLD_RE, "$1").replace(MDX_ITALIC_RE, "$1").replace(MDX_UNDERLINE_BOLD_RE, "$1").replace(MDX_UNDERLINE_ITALIC_RE, "$1").replace(MDX_STRIKETHROUGH_RE, "$1").replace(MDX_INLINE_CODE_RE, "$1").replace(MDX_LINK_RE, "$1").trim();
40
+ let text = typeof input == "string" ? input : extractText(input);
41
+ return cleanHeadingString(text);
18
42
  }
19
43
  function slugify(text) {
20
- return text.toLowerCase().replace(NON_ALPHANUMERIC_RE, "-").replace(LEADING_TRAILING_HYPHEN_RE, "").replace(LEADING_DIGIT_RE, "id-$1");
44
+ return headingStringToHTMLId(text);
21
45
  }
22
46
  function headingToHTMLId(input) {
23
47
  try {
24
- return slugify(cleanHeadingText(input)) || "empty-heading";
48
+ return slugify(cleanHeadingText(input)) || (cleanHeadingText(input) ? "heading" : "empty-heading");
25
49
  } catch {
26
50
  return "empty-heading";
27
51
  }
28
52
  }
29
53
  function createHeadingIdGenerator() {
30
- let usedIds = /* @__PURE__ */ new Map();
31
- return (input) => {
32
- let baseId = headingToHTMLId(input);
33
- if (baseId === "empty-heading") return baseId;
34
- let count = usedIds.get(baseId) ?? 0;
35
- return usedIds.set(baseId, count + 1), count === 0 ? baseId : `${baseId}-${count}`;
36
- };
54
+ let headingId = createHeadingStringIdGenerator();
55
+ return (input) => headingId(cleanHeadingText(input));
37
56
  }
38
57
  function extractMdxHeadings(content = "", levels) {
39
58
  let [minDepth, maxDepth] = levels, headingId = createHeadingIdGenerator(), headings = [], searchableContent = content.replace(FENCED_CODE_RE, "");
@@ -0,0 +1,7 @@
1
+ type HeadingPosition = {
2
+ id: string;
3
+ top: number;
4
+ };
5
+ declare function findActiveHeadingIndex(headings: readonly HeadingPosition[], readingLine: number, isAtBottom?: boolean): number;
6
+
7
+ export { type HeadingPosition, findActiveHeadingIndex };
@@ -0,0 +1,14 @@
1
+ // src/components/block/toc/selection.ts
2
+ function findActiveHeadingIndex(headings, readingLine, isAtBottom = !1) {
3
+ if (headings.length === 0) return -1;
4
+ if (isAtBottom) return headings.length - 1;
5
+ let low = 0, high = headings.length;
6
+ for (; low < high; ) {
7
+ let middle = low + Math.floor((high - low) / 2), heading = headings[middle];
8
+ heading && heading.top <= readingLine ? low = middle + 1 : high = middle;
9
+ }
10
+ return Math.max(0, low - 1);
11
+ }
12
+ export {
13
+ findActiveHeadingIndex
14
+ };
@@ -0,0 +1,16 @@
1
+ import {
2
+ validateLocalSource
3
+ } from "./chunk-ORIUWJBQ.js";
4
+ import "./chunk-NNBJZPFM.js";
5
+ import "./chunk-F3AGNDF4.js";
6
+ import "./chunk-7NY22B5U.js";
7
+ import "./chunk-UYGCOWRF.js";
8
+ import "./chunk-EFO6AWXN.js";
9
+ import "./chunk-5KAD7W53.js";
10
+ import "./chunk-WL75GQ5M.js";
11
+ import "./chunk-AI2UULNX.js";
12
+ import "./chunk-5J3YUNRY.js";
13
+ import "./chunk-22RSSUNV.js";
14
+ export {
15
+ validateLocalSource
16
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ validatePublishOsSource
3
+ } from "./chunk-F3AGNDF4.js";
4
+ import "./chunk-7NY22B5U.js";
5
+ import "./chunk-UYGCOWRF.js";
6
+ import "./chunk-EFO6AWXN.js";
7
+ import "./chunk-5KAD7W53.js";
8
+ import "./chunk-WL75GQ5M.js";
9
+ import "./chunk-AI2UULNX.js";
10
+ import "./chunk-5J3YUNRY.js";
11
+ import "./chunk-22RSSUNV.js";
12
+ export {
13
+ validatePublishOsSource
14
+ };
@@ -0,0 +1 @@
1
+ .publish.os/
@@ -0,0 +1,13 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1600" height="800" viewBox="0 0 1600 800" fill="none">
2
+ <rect width="1600" height="800" fill="#101214"/>
3
+ <g stroke="#343A40" stroke-width="2">
4
+ <path d="M160 240H1440M160 320H1440M160 480H1440M160 560H1440"/>
5
+ <path d="M160 400H560C640 400 640 280 720 280H880C960 280 960 400 1040 400H1440"/>
6
+ <path d="M160 400H560C640 400 640 520 720 520H880C960 520 960 400 1040 400H1440"/>
7
+ </g>
8
+ <path d="M160 400H1440" stroke="#A9CFFF" stroke-width="3"/>
9
+ <circle cx="800" cy="400" r="50" fill="#101214" stroke="#A9CFFF" stroke-width="3"/>
10
+ <path d="m786 383-17 17 17 17m28-34 17 17-17 17" stroke="#A9CFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
11
+ <g fill="#727C86"><circle cx="160" cy="240" r="4"/><circle cx="160" cy="320" r="4"/><circle cx="160" cy="480" r="4"/><circle cx="160" cy="560" r="4"/></g>
12
+ <circle cx="160" cy="400" r="4" fill="#A9CFFF"/>
13
+ </svg>
@@ -0,0 +1,13 @@
1
+ <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="512" height="512" rx="120" fill="#181818"/>
3
+ <rect x="6" y="6" width="500" height="500" rx="114" stroke="white" stroke-opacity="0.18" stroke-width="12"/>
4
+ <g clip-path="url(#clip0_1715_626)">
5
+ <path d="M273.137 237.996L306.335 157.85L343.538 173.259L310.7 252.535L372.044 191.192L400.518 219.666L339.839 280.343L419.988 247.145L435.398 284.348L307.078 337.498L312.354 339.684H196.574L201.851 337.498L73.5332 284.348L88.9434 247.145L166.473 279.258L106.881 219.666L135.354 191.192L194.937 250.774L162.829 173.259L200.032 157.85L232.869 237.124V152.184H273.137V237.996Z" fill="white"/>
6
+ <rect x="68.5" y="319.551" width="375" height="40.2685" fill="white"/>
7
+ </g>
8
+ <defs>
9
+ <clipPath id="clip0_1715_626">
10
+ <rect width="375" height="375" fill="white" transform="translate(68.5 68.5)"/>
11
+ </clipPath>
12
+ </defs>
13
+ </svg>
@@ -0,0 +1,13 @@
1
+ <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="512" height="512" rx="120" fill="white"/>
3
+ <rect x="6" y="6" width="500" height="500" rx="114" stroke="#291E00" stroke-opacity="0.2" stroke-width="12"/>
4
+ <g clip-path="url(#clip0_1715_611)">
5
+ <path d="M273.137 237.996L306.335 157.85L343.538 173.259L310.7 252.535L372.044 191.192L400.518 219.666L339.839 280.343L419.988 247.145L435.398 284.348L307.078 337.498L312.354 339.684H196.574L201.851 337.498L73.5332 284.348L88.9434 247.145L166.473 279.258L106.881 219.666L135.354 191.192L194.937 250.774L162.829 173.259L200.032 157.85L232.869 237.124V152.184H273.137V237.996Z" fill="#161000"/>
6
+ <rect x="68.5" y="319.551" width="375" height="40.2685" fill="#161000"/>
7
+ </g>
8
+ <defs>
9
+ <clipPath id="clip0_1715_611">
10
+ <rect width="375" height="375" fill="white" transform="translate(68.5 68.5)"/>
11
+ </clipPath>
12
+ </defs>
13
+ </svg>