svelte-docsmith 0.5.1 → 0.7.0

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 (327) hide show
  1. package/README.md +6 -2
  2. package/dist/{markdown-layout.svelte → buildtime/markdown-layout.svelte} +1 -1
  3. package/dist/{markdown-layout.svelte.d.ts → buildtime/markdown-layout.svelte.d.ts} +2 -2
  4. package/dist/{vite.d.ts → buildtime/vite/collect.d.ts} +5 -23
  5. package/dist/buildtime/vite/collect.js +101 -0
  6. package/dist/buildtime/vite/extract.d.ts +30 -0
  7. package/dist/buildtime/vite/extract.js +104 -0
  8. package/dist/buildtime/vite/frontmatter.d.ts +6 -0
  9. package/dist/buildtime/vite/frontmatter.js +20 -0
  10. package/dist/buildtime/vite/git.d.ts +2 -0
  11. package/dist/buildtime/vite/git.js +11 -0
  12. package/dist/buildtime/vite/index.d.ts +25 -0
  13. package/dist/buildtime/vite/index.js +141 -0
  14. package/dist/buildtime/vite/pages.d.ts +6 -0
  15. package/dist/buildtime/vite/pages.js +23 -0
  16. package/dist/{ui → components/chrome}/copy-button.svelte +1 -1
  17. package/dist/{ui → components/chrome}/search-trigger.svelte +1 -1
  18. package/dist/{ui → components/chrome}/search.svelte +5 -5
  19. package/dist/{ui → components/chrome}/search.svelte.d.ts +1 -1
  20. package/dist/{ui → components/chrome}/table-of-contents.svelte +2 -2
  21. package/dist/{ui → components/chrome}/table-of-contents.svelte.d.ts +1 -1
  22. package/dist/{ui → components/chrome}/theme-toggle.svelte +1 -1
  23. package/dist/{ui → components/docs}/accordion-item.svelte +1 -1
  24. package/dist/{ui → components/docs}/accordion.svelte +1 -1
  25. package/dist/{ui → components/docs}/badge.svelte +1 -1
  26. package/dist/{ui → components/docs}/live-example.svelte +3 -3
  27. package/dist/{ui → components/docs}/tab-item.svelte +1 -1
  28. package/dist/{ui → components/docs}/tabs.svelte +1 -1
  29. package/dist/{ui → components}/layouts/docs-footer.svelte +1 -1
  30. package/dist/{ui → components}/layouts/docs-footer.svelte.d.ts +1 -1
  31. package/dist/{ui → components}/layouts/docs-header.svelte +3 -3
  32. package/dist/{ui → components}/layouts/docs-header.svelte.d.ts +1 -1
  33. package/dist/{ui → components}/layouts/docs-mobile-header.svelte +3 -3
  34. package/dist/{ui → components}/layouts/docs-mobile-header.svelte.d.ts +1 -1
  35. package/dist/{ui → components}/layouts/docs-shell.svelte +44 -10
  36. package/dist/{ui → components}/layouts/docs-shell.svelte.d.ts +12 -1
  37. package/dist/{ui → components}/layouts/docs-sidebar.svelte +3 -3
  38. package/dist/{ui → components}/layouts/docs-sidebar.svelte.d.ts +1 -1
  39. package/dist/{ui → components}/layouts/error-page.svelte +1 -1
  40. package/dist/{ui → components}/layouts/error-page.svelte.d.ts +1 -1
  41. package/dist/components/layouts/page-feedback.svelte +51 -0
  42. package/dist/components/layouts/page-feedback.svelte.d.ts +9 -0
  43. package/dist/{ui → components}/layouts/prev-next-nav.svelte +1 -1
  44. package/dist/{ui → components}/layouts/prev-next-nav.svelte.d.ts +1 -1
  45. package/dist/{ui → components}/layouts/seo-head.svelte +2 -2
  46. package/dist/{ui → components}/layouts/seo-head.svelte.d.ts +1 -1
  47. package/dist/{ui → components}/markdown/pre.svelte +2 -2
  48. package/dist/{ui → components}/markdown/types.d.ts +1 -1
  49. package/dist/{ui → components}/shadcn/accordion/accordion-content.svelte +1 -1
  50. package/dist/{ui → components}/shadcn/accordion/accordion-item.svelte +1 -1
  51. package/dist/{ui → components}/shadcn/accordion/accordion-trigger.svelte +1 -1
  52. package/dist/{ui → components}/shadcn/accordion/accordion-trigger.svelte.d.ts +1 -1
  53. package/dist/{ui → components}/shadcn/accordion/accordion.svelte +1 -1
  54. package/dist/{ui → components}/shadcn/badge/badge.svelte +1 -1
  55. package/dist/{ui → components}/shadcn/badge/badge.svelte.d.ts +1 -1
  56. package/dist/{ui → components}/shadcn/button/button.svelte +1 -1
  57. package/dist/{ui → components}/shadcn/button/button.svelte.d.ts +1 -1
  58. package/dist/{ui → components}/shadcn/command/command-dialog.svelte +1 -1
  59. package/dist/{ui → components}/shadcn/command/command-dialog.svelte.d.ts +1 -1
  60. package/dist/{ui → components}/shadcn/command/command-empty.svelte +1 -1
  61. package/dist/{ui → components}/shadcn/command/command-group.svelte +1 -1
  62. package/dist/{ui → components}/shadcn/command/command-input.svelte +1 -1
  63. package/dist/{ui → components}/shadcn/command/command-item.svelte +1 -1
  64. package/dist/{ui → components}/shadcn/command/command-link-item.svelte +1 -1
  65. package/dist/{ui → components}/shadcn/command/command-list.svelte +1 -1
  66. package/dist/{ui → components}/shadcn/command/command-separator.svelte +1 -1
  67. package/dist/{ui → components}/shadcn/command/command-shortcut.svelte +1 -1
  68. package/dist/{ui → components}/shadcn/command/command-shortcut.svelte.d.ts +1 -1
  69. package/dist/{ui → components}/shadcn/command/command.svelte +1 -1
  70. package/dist/{ui → components}/shadcn/dialog/dialog-content.svelte +1 -1
  71. package/dist/{ui → components}/shadcn/dialog/dialog-content.svelte.d.ts +1 -1
  72. package/dist/{ui → components}/shadcn/dialog/dialog-description.svelte +1 -1
  73. package/dist/{ui → components}/shadcn/dialog/dialog-footer.svelte +1 -1
  74. package/dist/{ui → components}/shadcn/dialog/dialog-footer.svelte.d.ts +1 -1
  75. package/dist/{ui → components}/shadcn/dialog/dialog-header.svelte +1 -1
  76. package/dist/{ui → components}/shadcn/dialog/dialog-header.svelte.d.ts +1 -1
  77. package/dist/{ui → components}/shadcn/dialog/dialog-overlay.svelte +1 -1
  78. package/dist/{ui → components}/shadcn/dialog/dialog-title.svelte +1 -1
  79. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-checkbox-item.svelte +1 -1
  80. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +1 -1
  81. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-content.svelte +1 -1
  82. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-content.svelte.d.ts +1 -1
  83. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-group-heading.svelte +1 -1
  84. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-item.svelte +1 -1
  85. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-label.svelte +1 -1
  86. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-label.svelte.d.ts +1 -1
  87. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-radio-item.svelte +1 -1
  88. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-separator.svelte +1 -1
  89. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-shortcut.svelte +1 -1
  90. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-shortcut.svelte.d.ts +1 -1
  91. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub-content.svelte +1 -1
  92. package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
  93. package/dist/{ui → components}/shadcn/input/input.svelte +1 -1
  94. package/dist/{ui → components}/shadcn/input/input.svelte.d.ts +1 -1
  95. package/dist/{ui → components}/shadcn/input-group/input-group-addon.svelte +1 -1
  96. package/dist/{ui → components}/shadcn/input-group/input-group-addon.svelte.d.ts +1 -1
  97. package/dist/{ui → components}/shadcn/input-group/input-group-button.svelte +1 -1
  98. package/dist/{ui → components}/shadcn/input-group/input-group-input.svelte +1 -1
  99. package/dist/{ui → components}/shadcn/input-group/input-group-input.svelte.d.ts +1 -1
  100. package/dist/{ui → components}/shadcn/input-group/input-group-text.svelte +1 -1
  101. package/dist/{ui → components}/shadcn/input-group/input-group-text.svelte.d.ts +1 -1
  102. package/dist/{ui → components}/shadcn/input-group/input-group-textarea.svelte +1 -1
  103. package/dist/{ui → components}/shadcn/input-group/input-group-textarea.svelte.d.ts +1 -1
  104. package/dist/{ui → components}/shadcn/input-group/input-group.svelte +1 -1
  105. package/dist/{ui → components}/shadcn/input-group/input-group.svelte.d.ts +1 -1
  106. package/dist/{ui → components}/shadcn/popover/popover-content.svelte +1 -1
  107. package/dist/{ui → components}/shadcn/popover/popover-content.svelte.d.ts +1 -1
  108. package/dist/{ui → components}/shadcn/popover/popover-description.svelte +1 -1
  109. package/dist/{ui → components}/shadcn/popover/popover-description.svelte.d.ts +1 -1
  110. package/dist/{ui → components}/shadcn/popover/popover-header.svelte +1 -1
  111. package/dist/{ui → components}/shadcn/popover/popover-header.svelte.d.ts +1 -1
  112. package/dist/{ui → components}/shadcn/popover/popover-title.svelte +1 -1
  113. package/dist/{ui → components}/shadcn/popover/popover-title.svelte.d.ts +1 -1
  114. package/dist/{ui → components}/shadcn/popover/popover-trigger.svelte +1 -1
  115. package/dist/{ui → components}/shadcn/scroll-area/scroll-area-scrollbar.svelte +1 -1
  116. package/dist/{ui → components}/shadcn/scroll-area/scroll-area.svelte +1 -1
  117. package/dist/{ui → components}/shadcn/scroll-area/scroll-area.svelte.d.ts +1 -1
  118. package/dist/{ui → components}/shadcn/separator/separator.svelte +1 -1
  119. package/dist/{ui → components}/shadcn/sheet/sheet-content.svelte +1 -1
  120. package/dist/{ui → components}/shadcn/sheet/sheet-content.svelte.d.ts +1 -1
  121. package/dist/{ui → components}/shadcn/sheet/sheet-description.svelte +1 -1
  122. package/dist/{ui → components}/shadcn/sheet/sheet-footer.svelte +1 -1
  123. package/dist/{ui → components}/shadcn/sheet/sheet-footer.svelte.d.ts +1 -1
  124. package/dist/{ui → components}/shadcn/sheet/sheet-header.svelte +1 -1
  125. package/dist/{ui → components}/shadcn/sheet/sheet-header.svelte.d.ts +1 -1
  126. package/dist/{ui → components}/shadcn/sheet/sheet-overlay.svelte +1 -1
  127. package/dist/{ui → components}/shadcn/sheet/sheet-title.svelte +1 -1
  128. package/dist/{ui → components}/shadcn/tabs/tabs-content.svelte +1 -1
  129. package/dist/{ui → components}/shadcn/tabs/tabs-list.svelte +1 -1
  130. package/dist/{ui → components}/shadcn/tabs/tabs-trigger.svelte +1 -1
  131. package/dist/{ui → components}/shadcn/tabs/tabs.svelte +1 -1
  132. package/dist/{ui → components}/shadcn/textarea/textarea.svelte +1 -1
  133. package/dist/{ui → components}/shadcn/textarea/textarea.svelte.d.ts +1 -1
  134. package/dist/core/config.d.ts +65 -0
  135. package/dist/{config.js → core/config.js} +0 -22
  136. package/dist/core/content.d.ts +68 -0
  137. package/dist/core/content.js +7 -0
  138. package/dist/core/index.d.ts +3 -0
  139. package/dist/core/index.js +6 -0
  140. package/dist/core/nav.d.ts +17 -0
  141. package/dist/core/nav.js +22 -0
  142. package/dist/{content.d.ts → fallbacks/content.d.ts} +3 -3
  143. package/dist/fallbacks/content.js +3 -0
  144. package/dist/{llms.d.ts → fallbacks/llms.d.ts} +2 -3
  145. package/dist/fallbacks/llms.js +3 -0
  146. package/dist/fallbacks/missing-plugin.d.ts +7 -0
  147. package/dist/fallbacks/missing-plugin.js +11 -0
  148. package/dist/{search.d.ts → fallbacks/search.d.ts} +3 -3
  149. package/dist/fallbacks/search.js +3 -0
  150. package/dist/{generate-llms.d.ts → generate/llms.d.ts} +1 -1
  151. package/dist/index.d.ts +23 -23
  152. package/dist/index.js +24 -24
  153. package/dist/search/create-search.d.ts +1 -1
  154. package/dist/theme.css +57 -57
  155. package/dist/themes/darkmatter.css +6 -4
  156. package/dist/themes/tangerine.css +3 -6
  157. package/package.json +21 -13
  158. package/dist/config.d.ts +0 -141
  159. package/dist/content.js +0 -4
  160. package/dist/llms.js +0 -4
  161. package/dist/search.js +0 -4
  162. package/dist/vite.js +0 -366
  163. /package/dist/{highlight.d.ts → buildtime/highlight.d.ts} +0 -0
  164. /package/dist/{highlight.js → buildtime/highlight.js} +0 -0
  165. /package/dist/{preprocess.d.ts → buildtime/preprocess.d.ts} +0 -0
  166. /package/dist/{preprocess.js → buildtime/preprocess.js} +0 -0
  167. /package/dist/{ui → components/chrome}/background-pattern.svelte +0 -0
  168. /package/dist/{ui → components/chrome}/background-pattern.svelte.d.ts +0 -0
  169. /package/dist/{ui → components/chrome}/copy-button.svelte.d.ts +0 -0
  170. /package/dist/{ui → components/chrome}/search-trigger.svelte.d.ts +0 -0
  171. /package/dist/{ui → components/chrome}/theme-provider.svelte +0 -0
  172. /package/dist/{ui → components/chrome}/theme-provider.svelte.d.ts +0 -0
  173. /package/dist/{ui → components/chrome}/theme-toggle.svelte.d.ts +0 -0
  174. /package/dist/{ui → components/docs}/accordion-item.svelte.d.ts +0 -0
  175. /package/dist/{ui → components/docs}/accordion.svelte.d.ts +0 -0
  176. /package/dist/{ui → components/docs}/badge.svelte.d.ts +0 -0
  177. /package/dist/{ui → components/docs}/callout.svelte +0 -0
  178. /package/dist/{ui → components/docs}/callout.svelte.d.ts +0 -0
  179. /package/dist/{ui → components/docs}/card-grid.svelte +0 -0
  180. /package/dist/{ui → components/docs}/card-grid.svelte.d.ts +0 -0
  181. /package/dist/{ui → components/docs}/card.svelte +0 -0
  182. /package/dist/{ui → components/docs}/card.svelte.d.ts +0 -0
  183. /package/dist/{ui → components/docs}/file-tree-item.svelte +0 -0
  184. /package/dist/{ui → components/docs}/file-tree-item.svelte.d.ts +0 -0
  185. /package/dist/{ui → components/docs}/file-tree.svelte +0 -0
  186. /package/dist/{ui → components/docs}/file-tree.svelte.d.ts +0 -0
  187. /package/dist/{ui → components/docs}/kbd.svelte +0 -0
  188. /package/dist/{ui → components/docs}/kbd.svelte.d.ts +0 -0
  189. /package/dist/{ui → components/docs}/live-example.svelte.d.ts +0 -0
  190. /package/dist/{ui → components/docs}/prop.svelte +0 -0
  191. /package/dist/{ui → components/docs}/prop.svelte.d.ts +0 -0
  192. /package/dist/{ui → components/docs}/props-table.svelte +0 -0
  193. /package/dist/{ui → components/docs}/props-table.svelte.d.ts +0 -0
  194. /package/dist/{ui → components/docs}/step.svelte +0 -0
  195. /package/dist/{ui → components/docs}/step.svelte.d.ts +0 -0
  196. /package/dist/{ui → components/docs}/steps.svelte +0 -0
  197. /package/dist/{ui → components/docs}/steps.svelte.d.ts +0 -0
  198. /package/dist/{ui → components/docs}/tab-item.svelte.d.ts +0 -0
  199. /package/dist/{ui → components/docs}/tabs-phase.svelte +0 -0
  200. /package/dist/{ui → components/docs}/tabs-phase.svelte.d.ts +0 -0
  201. /package/dist/{ui → components/docs}/tabs.svelte.d.ts +0 -0
  202. /package/dist/{ui → components}/icons/github.svelte +0 -0
  203. /package/dist/{ui → components}/icons/github.svelte.d.ts +0 -0
  204. /package/dist/{ui → components}/layouts/breadcrumbs.svelte +0 -0
  205. /package/dist/{ui → components}/layouts/breadcrumbs.svelte.d.ts +0 -0
  206. /package/dist/{ui → components}/layouts/copy-page-menu.svelte +0 -0
  207. /package/dist/{ui → components}/layouts/copy-page-menu.svelte.d.ts +0 -0
  208. /package/dist/{ui → components}/markdown/code.svelte +0 -0
  209. /package/dist/{ui → components}/markdown/code.svelte.d.ts +0 -0
  210. /package/dist/{ui → components}/markdown/h2.svelte +0 -0
  211. /package/dist/{ui → components}/markdown/h2.svelte.d.ts +0 -0
  212. /package/dist/{ui → components}/markdown/h3.svelte +0 -0
  213. /package/dist/{ui → components}/markdown/h3.svelte.d.ts +0 -0
  214. /package/dist/{ui → components}/markdown/index.d.ts +0 -0
  215. /package/dist/{ui → components}/markdown/index.js +0 -0
  216. /package/dist/{ui → components}/markdown/pre.svelte.d.ts +0 -0
  217. /package/dist/{ui → components}/markdown/table.svelte +0 -0
  218. /package/dist/{ui → components}/markdown/table.svelte.d.ts +0 -0
  219. /package/dist/{types.js → components/markdown/types.js} +0 -0
  220. /package/dist/{ui → components}/shadcn/accordion/accordion-content.svelte.d.ts +0 -0
  221. /package/dist/{ui → components}/shadcn/accordion/accordion-item.svelte.d.ts +0 -0
  222. /package/dist/{ui → components}/shadcn/accordion/accordion.svelte.d.ts +0 -0
  223. /package/dist/{ui → components}/shadcn/accordion/index.d.ts +0 -0
  224. /package/dist/{ui → components}/shadcn/accordion/index.js +0 -0
  225. /package/dist/{ui → components}/shadcn/badge/index.d.ts +0 -0
  226. /package/dist/{ui → components}/shadcn/badge/index.js +0 -0
  227. /package/dist/{ui → components}/shadcn/button/index.d.ts +0 -0
  228. /package/dist/{ui → components}/shadcn/button/index.js +0 -0
  229. /package/dist/{ui → components}/shadcn/command/command-empty.svelte.d.ts +0 -0
  230. /package/dist/{ui → components}/shadcn/command/command-group.svelte.d.ts +0 -0
  231. /package/dist/{ui → components}/shadcn/command/command-input.svelte.d.ts +0 -0
  232. /package/dist/{ui → components}/shadcn/command/command-item.svelte.d.ts +0 -0
  233. /package/dist/{ui → components}/shadcn/command/command-link-item.svelte.d.ts +0 -0
  234. /package/dist/{ui → components}/shadcn/command/command-list.svelte.d.ts +0 -0
  235. /package/dist/{ui → components}/shadcn/command/command-loading.svelte +0 -0
  236. /package/dist/{ui → components}/shadcn/command/command-loading.svelte.d.ts +0 -0
  237. /package/dist/{ui → components}/shadcn/command/command-separator.svelte.d.ts +0 -0
  238. /package/dist/{ui → components}/shadcn/command/command.svelte.d.ts +0 -0
  239. /package/dist/{ui → components}/shadcn/command/index.d.ts +0 -0
  240. /package/dist/{ui → components}/shadcn/command/index.js +0 -0
  241. /package/dist/{ui → components}/shadcn/dialog/dialog-close.svelte +0 -0
  242. /package/dist/{ui → components}/shadcn/dialog/dialog-close.svelte.d.ts +0 -0
  243. /package/dist/{ui → components}/shadcn/dialog/dialog-description.svelte.d.ts +0 -0
  244. /package/dist/{ui → components}/shadcn/dialog/dialog-overlay.svelte.d.ts +0 -0
  245. /package/dist/{ui → components}/shadcn/dialog/dialog-portal.svelte +0 -0
  246. /package/dist/{ui → components}/shadcn/dialog/dialog-portal.svelte.d.ts +0 -0
  247. /package/dist/{ui → components}/shadcn/dialog/dialog-title.svelte.d.ts +0 -0
  248. /package/dist/{ui → components}/shadcn/dialog/dialog-trigger.svelte +0 -0
  249. /package/dist/{ui → components}/shadcn/dialog/dialog-trigger.svelte.d.ts +0 -0
  250. /package/dist/{ui → components}/shadcn/dialog/dialog.svelte +0 -0
  251. /package/dist/{ui → components}/shadcn/dialog/dialog.svelte.d.ts +0 -0
  252. /package/dist/{ui → components}/shadcn/dialog/index.d.ts +0 -0
  253. /package/dist/{ui → components}/shadcn/dialog/index.js +0 -0
  254. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-checkbox-group.svelte +0 -0
  255. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-checkbox-group.svelte.d.ts +0 -0
  256. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-group-heading.svelte.d.ts +0 -0
  257. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-group.svelte +0 -0
  258. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-group.svelte.d.ts +0 -0
  259. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-item.svelte.d.ts +0 -0
  260. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-portal.svelte +0 -0
  261. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-portal.svelte.d.ts +0 -0
  262. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-radio-group.svelte +0 -0
  263. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +0 -0
  264. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-radio-item.svelte.d.ts +0 -0
  265. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-separator.svelte.d.ts +0 -0
  266. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub-content.svelte.d.ts +0 -0
  267. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub-trigger.svelte.d.ts +0 -0
  268. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub.svelte +0 -0
  269. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub.svelte.d.ts +0 -0
  270. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-trigger.svelte +0 -0
  271. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-trigger.svelte.d.ts +0 -0
  272. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu.svelte +0 -0
  273. /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu.svelte.d.ts +0 -0
  274. /package/dist/{ui → components}/shadcn/dropdown-menu/index.d.ts +0 -0
  275. /package/dist/{ui → components}/shadcn/dropdown-menu/index.js +0 -0
  276. /package/dist/{ui → components}/shadcn/input/index.d.ts +0 -0
  277. /package/dist/{ui → components}/shadcn/input/index.js +0 -0
  278. /package/dist/{ui → components}/shadcn/input-group/index.d.ts +0 -0
  279. /package/dist/{ui → components}/shadcn/input-group/index.js +0 -0
  280. /package/dist/{ui → components}/shadcn/input-group/input-group-button.svelte.d.ts +0 -0
  281. /package/dist/{ui → components}/shadcn/popover/index.d.ts +0 -0
  282. /package/dist/{ui → components}/shadcn/popover/index.js +0 -0
  283. /package/dist/{ui → components}/shadcn/popover/popover-close.svelte +0 -0
  284. /package/dist/{ui → components}/shadcn/popover/popover-close.svelte.d.ts +0 -0
  285. /package/dist/{ui → components}/shadcn/popover/popover-portal.svelte +0 -0
  286. /package/dist/{ui → components}/shadcn/popover/popover-portal.svelte.d.ts +0 -0
  287. /package/dist/{ui → components}/shadcn/popover/popover-trigger.svelte.d.ts +0 -0
  288. /package/dist/{ui → components}/shadcn/popover/popover.svelte +0 -0
  289. /package/dist/{ui → components}/shadcn/popover/popover.svelte.d.ts +0 -0
  290. /package/dist/{ui → components}/shadcn/scroll-area/index.d.ts +0 -0
  291. /package/dist/{ui → components}/shadcn/scroll-area/index.js +0 -0
  292. /package/dist/{ui → components}/shadcn/scroll-area/scroll-area-scrollbar.svelte.d.ts +0 -0
  293. /package/dist/{ui → components}/shadcn/separator/index.d.ts +0 -0
  294. /package/dist/{ui → components}/shadcn/separator/index.js +0 -0
  295. /package/dist/{ui → components}/shadcn/separator/separator.svelte.d.ts +0 -0
  296. /package/dist/{ui → components}/shadcn/sheet/index.d.ts +0 -0
  297. /package/dist/{ui → components}/shadcn/sheet/index.js +0 -0
  298. /package/dist/{ui → components}/shadcn/sheet/sheet-close.svelte +0 -0
  299. /package/dist/{ui → components}/shadcn/sheet/sheet-close.svelte.d.ts +0 -0
  300. /package/dist/{ui → components}/shadcn/sheet/sheet-description.svelte.d.ts +0 -0
  301. /package/dist/{ui → components}/shadcn/sheet/sheet-overlay.svelte.d.ts +0 -0
  302. /package/dist/{ui → components}/shadcn/sheet/sheet-portal.svelte +0 -0
  303. /package/dist/{ui → components}/shadcn/sheet/sheet-portal.svelte.d.ts +0 -0
  304. /package/dist/{ui → components}/shadcn/sheet/sheet-title.svelte.d.ts +0 -0
  305. /package/dist/{ui → components}/shadcn/sheet/sheet-trigger.svelte +0 -0
  306. /package/dist/{ui → components}/shadcn/sheet/sheet-trigger.svelte.d.ts +0 -0
  307. /package/dist/{ui → components}/shadcn/sheet/sheet.svelte +0 -0
  308. /package/dist/{ui → components}/shadcn/sheet/sheet.svelte.d.ts +0 -0
  309. /package/dist/{ui → components}/shadcn/tabs/index.d.ts +0 -0
  310. /package/dist/{ui → components}/shadcn/tabs/index.js +0 -0
  311. /package/dist/{ui → components}/shadcn/tabs/tabs-content.svelte.d.ts +0 -0
  312. /package/dist/{ui → components}/shadcn/tabs/tabs-list.svelte.d.ts +0 -0
  313. /package/dist/{ui → components}/shadcn/tabs/tabs-trigger.svelte.d.ts +0 -0
  314. /package/dist/{ui → components}/shadcn/tabs/tabs.svelte.d.ts +0 -0
  315. /package/dist/{ui → components}/shadcn/textarea/index.d.ts +0 -0
  316. /package/dist/{ui → components}/shadcn/textarea/index.js +0 -0
  317. /package/dist/{generate-llms.js → generate/llms.js} +0 -0
  318. /package/dist/{sitemap.d.ts → generate/sitemap.d.ts} +0 -0
  319. /package/dist/{sitemap.js → generate/sitemap.js} +0 -0
  320. /package/dist/{clipboard.svelte.d.ts → utils/clipboard.svelte.d.ts} +0 -0
  321. /package/dist/{clipboard.svelte.js → utils/clipboard.svelte.js} +0 -0
  322. /package/dist/{shadcn.d.ts → utils/cn.d.ts} +0 -0
  323. /package/dist/{shadcn.js → utils/cn.js} +0 -0
  324. /package/dist/{normalize-path.d.ts → utils/normalize-path.d.ts} +0 -0
  325. /package/dist/{normalize-path.js → utils/normalize-path.js} +0 -0
  326. /package/dist/{types.d.ts → utils/types.d.ts} +0 -0
  327. /package/dist/{ui/markdown → utils}/types.js +0 -0
package/dist/config.d.ts DELETED
@@ -1,141 +0,0 @@
1
- /**
2
- * Static site configuration passed to `DocsShell`. Content-derived data (the
3
- * sidebar nav) is NOT here — it comes from your content collection at runtime.
4
- */
5
- /** A link rendered in the header nav or footer. */
6
- export type DocsmithLink = {
7
- label: string;
8
- href: string;
9
- /** Open in a new tab with `rel="noopener"`. */
10
- external?: boolean;
11
- };
12
- /** A titled column of links in the footer. */
13
- export type DocsmithFooterColumn = {
14
- title: string;
15
- links: DocsmithLink[];
16
- };
17
- export type DocsmithConfig = {
18
- /** Site title, shown in the header/sidebar and in the `<title>` suffix. */
19
- title: string;
20
- /**
21
- * Default meta description, used for pages whose frontmatter has none (and
22
- * as the site's social-share description).
23
- */
24
- description?: string;
25
- /**
26
- * Canonical site origin, e.g. `https://docs.example.com`. When set, DocsShell
27
- * emits `<link rel="canonical">` and absolute Open Graph URLs.
28
- */
29
- url?: string;
30
- /** Default social-share image (absolute URL, or a path resolved against `url`). */
31
- ogImage?: string;
32
- /**
33
- * Base URL for the "Edit this page" link, pointing at the directory that maps
34
- * to your app's working directory in the repo, e.g.
35
- * `https://github.com/you/repo/edit/main/apps/docs`. DocsShell appends each
36
- * page's source path. Omit to hide the edit link.
37
- */
38
- editUrl?: string;
39
- /** Optional GitHub URL; renders a link in the header when set. */
40
- github?: string;
41
- /** Optional version string, shown in the header (e.g. your library version). */
42
- version?: string;
43
- /** Optional logo image src; falls back to the built-in book mark. */
44
- logo?: string;
45
- /** Top-level header navigation links. */
46
- nav?: DocsmithLink[];
47
- /** Footer content, driven by data. */
48
- footer?: {
49
- /** Copyright / attribution line. */
50
- copyright?: string;
51
- /** Titled columns of links. */
52
- columns?: DocsmithFooterColumn[];
53
- /**
54
- * Show the "Powered by Svelte DocSmith" attribution in the footer.
55
- * Defaults to `true`; set `false` to hide it.
56
- */
57
- poweredBy?: boolean;
58
- };
59
- };
60
- /**
61
- * Validate a {@link DocsmithConfig} at build time. Purely a pass-through for
62
- * typed callers; the runtime checks catch untyped or dynamically-built configs
63
- * with a real error message instead of a blank header.
64
- */
65
- export declare function defineConfig(config: DocsmithConfig): DocsmithConfig;
66
- /**
67
- * The minimal shape `DocsShell` needs from each content entry to build the
68
- * sidebar. The generated `svelte-docsmith/content` module produces these from
69
- * your pages' frontmatter; any source with matching title/path/section/order
70
- * fields satisfies it structurally.
71
- */
72
- export type DocsContentItem = {
73
- title: string;
74
- path: string;
75
- section?: string;
76
- order?: number;
77
- description?: string;
78
- /** Source file path relative to the app cwd, for the "Edit this page" link. */
79
- sourcePath?: string;
80
- /** Last git commit date (ISO) for the page's source file. */
81
- lastUpdated?: string;
82
- /**
83
- * The page's `h2`/`h3` headings, extracted at build time by the `docsmith()`
84
- * vite plugin, so `DocsShell` can render the in-page TOC server-side. The
85
- * runtime TOC engine still owns scroll-spy and re-scans the DOM.
86
- */
87
- toc?: {
88
- id: string;
89
- title: string;
90
- depth: 2 | 3;
91
- }[];
92
- };
93
- /**
94
- * One page's searchable record, emitted at build time by the `docsmith()` vite
95
- * plugin as the `svelte-docsmith/search` virtual module. `text` is the page's
96
- * prose and headings reduced to plain text (frontmatter, `<script>` blocks,
97
- * fenced code, tags, and markdown punctuation stripped) so a client-side search
98
- * index can be built over it without shipping raw markdown.
99
- */
100
- export type SearchDoc = {
101
- path: string;
102
- title: string;
103
- section?: string;
104
- description?: string;
105
- /** The page's `h2`/`h3` heading text, for weighting title/heading matches. */
106
- headings: string[];
107
- /** Plain-text body: prose and headings, code and markup removed. */
108
- text: string;
109
- };
110
- /**
111
- * One page's record for LLM-facing output, emitted at build time by the
112
- * `docsmith()` vite plugin as the `svelte-docsmith/llms` virtual module. Feeds
113
- * `generateLlmsTxt` (an index) and `generateLlmsFullTxt` (the full corpus).
114
- */
115
- export type LlmsDoc = {
116
- path: string;
117
- title: string;
118
- section?: string;
119
- /** Sidebar order within the section, so LLM output follows reading order. */
120
- order?: number;
121
- description?: string;
122
- /** The page's markdown body (frontmatter and `<script>`/`<style>` removed,
123
- * headings and code kept), with the title prepended as an `h1`. */
124
- content: string;
125
- };
126
- /** A single sidebar link. */
127
- export type NavItem = {
128
- title: string;
129
- url: string;
130
- };
131
- /** A titled group of sidebar links. */
132
- export type NavGroup = {
133
- title: string;
134
- items: NavItem[];
135
- };
136
- /**
137
- * Derive sidebar nav from a content collection: group by `section`, order by
138
- * `order` within a group, and order groups by the smallest `order` they
139
- * contain. Entries without a `section` fall under "Docs".
140
- */
141
- export declare function navFromContent(content: DocsContentItem[]): NavGroup[];
package/dist/content.js DELETED
@@ -1,4 +0,0 @@
1
- export const docs = [];
2
- throw new Error("[svelte-docsmith] 'svelte-docsmith/content' requires the docsmith() plugin. " +
3
- "Add it to your vite.config: import { docsmith } from 'svelte-docsmith/vite'; " +
4
- 'plugins: [docsmith(), tailwindcss(), sveltekit()]');
package/dist/llms.js DELETED
@@ -1,4 +0,0 @@
1
- export const docs = [];
2
- throw new Error("[svelte-docsmith] 'svelte-docsmith/llms' requires the docsmith() plugin. " +
3
- "Add it to your vite.config: import { docsmith } from 'svelte-docsmith/vite'; " +
4
- 'plugins: [docsmith(), tailwindcss(), sveltekit()]');
package/dist/search.js DELETED
@@ -1,4 +0,0 @@
1
- export const docs = [];
2
- throw new Error("[svelte-docsmith] 'svelte-docsmith/search' requires the docsmith() plugin. " +
3
- "Add it to your vite.config: import { docsmith } from 'svelte-docsmith/vite'; " +
4
- 'plugins: [docsmith(), tailwindcss(), sveltekit()]');
package/dist/vite.js DELETED
@@ -1,366 +0,0 @@
1
- /**
2
- * `svelte-docsmith/vite` — the build-time half of the framework. Node context
3
- * only. One `docsmith()` call in `vite.config.ts` wires three things:
4
- *
5
- * 1. A **content index** served as the virtual module `svelte-docsmith/content`
6
- * — your doc pages' frontmatter, scanned at build time, so the sidebar nav
7
- * is derived from content and never hand-written. No collection config, no
8
- * aliases.
9
- * 2. A **search index** served as the virtual module `svelte-docsmith/search`
10
- * — the same pages reduced to plain-text bodies, in a separate chunk so it
11
- * can be lazy-loaded only when search opens.
12
- * 3. The **`?source` transform** powering `LiveExample`: importing
13
- * `Component.svelte?source` yields that file's Shiki-highlighted source.
14
- */
15
- import { spawnSync } from 'node:child_process';
16
- import fs from 'node:fs';
17
- import path from 'node:path';
18
- import GithubSlugger from 'github-slugger';
19
- import yaml from 'js-yaml';
20
- import { DEFAULT_THEMES, lazyHighlighter } from './highlight.js';
21
- /**
22
- * The svelte-docsmith Vite plugin. Add it to `plugins` in `vite.config.ts`:
23
- *
24
- * ```ts
25
- * import { docsmith } from 'svelte-docsmith/vite';
26
- * export default defineConfig({ plugins: [docsmith(), tailwindcss(), sveltekit()] });
27
- * ```
28
- */
29
- export function docsmith(options = {}) {
30
- return [contentIndexPlugin(options), exampleSourcePlugin(options)];
31
- }
32
- // --- content index -------------------------------------------------------
33
- const CONTENT_SPECIFIER = 'svelte-docsmith/content';
34
- const VIRTUAL_CONTENT_ID = '\0svelte-docsmith:content';
35
- const SEARCH_SPECIFIER = 'svelte-docsmith/search';
36
- const VIRTUAL_SEARCH_ID = '\0svelte-docsmith:search';
37
- const LLMS_SPECIFIER = 'svelte-docsmith/llms';
38
- const VIRTUAL_LLMS_ID = '\0svelte-docsmith:llms';
39
- const PAGE_NAMES = ['+page.md', '+page.svx'];
40
- function isPageFile(file) {
41
- return PAGE_NAMES.some((name) => file.endsWith(name));
42
- }
43
- /**
44
- * List the absolute paths of every `+page.md`/`+page.svx` under `contentDir`.
45
- */
46
- function listPageFiles(contentDir) {
47
- if (!fs.existsSync(contentDir))
48
- return [];
49
- const entries = fs.readdirSync(contentDir, { recursive: true, withFileTypes: true });
50
- const files = [];
51
- for (const entry of entries) {
52
- if (!entry.isFile() || !isPageFile(entry.name))
53
- continue;
54
- const dir = entry.parentPath ?? entry.path ?? contentDir;
55
- files.push(path.join(dir, entry.name));
56
- }
57
- return files;
58
- }
59
- /** Strip inline markdown so a heading's TOC label is plain text. */
60
- function stripInlineMarkdown(text) {
61
- return text
62
- .replace(/!\[([^\]]*)\]\([^)]*\)/g, '$1')
63
- .replace(/`([^`]+)`/g, '$1')
64
- .replace(/\*\*([^*]+)\*\*/g, '$1')
65
- .replace(/\*([^*]+)\*/g, '$1')
66
- .replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
67
- .replace(/[_~]/g, '')
68
- .trim();
69
- }
70
- /**
71
- * Reduce a markdown page to plain, searchable body text: prose and heading text
72
- * with frontmatter, `<script>`/`<style>` blocks, fenced code, HTML/Svelte tags,
73
- * and markdown punctuation removed. Feeds the generated search index. Code
74
- * samples are intentionally dropped to keep the index small and prose-focused.
75
- */
76
- function extractSearchText(source) {
77
- let body = source.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, '');
78
- // Component/setup blocks aren't prose; drop them whole before line scanning.
79
- body = body.replace(/<script[\s\S]*?<\/script>/gi, '').replace(/<style[\s\S]*?<\/style>/gi, '');
80
- const out = [];
81
- let fence = null;
82
- for (const line of body.split('\n')) {
83
- const f = /^\s*(`{3,}|~{3,})/.exec(line);
84
- if (f) {
85
- const ch = f[1][0];
86
- if (fence === null)
87
- fence = ch;
88
- else if (ch === fence)
89
- fence = null;
90
- continue;
91
- }
92
- if (fence !== null)
93
- continue;
94
- // Skip table delimiter rows (`| --- | :--: |`) — pure structure, no words.
95
- if (/^\s*\|?[\s:|-]+\|[\s:|-]*$/.test(line))
96
- continue;
97
- const text = stripInlineMarkdown(line
98
- .replace(/<[^>]+>/g, ' ') // strip HTML/Svelte tags, keep their text content
99
- .replace(/^\s{0,3}#{1,6}\s+/, '') // heading markers
100
- .replace(/^\s{0,3}>\s?/, '') // blockquote markers
101
- .replace(/^\s*[-*+]\s+/, '') // unordered list bullets
102
- .replace(/^\s*\d+\.\s+/, '') // ordered list markers
103
- .replace(/\s*\|\s*/g, ' ') // table cell separators → spaces, not "| a | b |"
104
- ).replace(/\s+/g, ' ');
105
- if (text)
106
- out.push(text);
107
- }
108
- return out.join(' ');
109
- }
110
- /**
111
- * Extract `h2`/`h3` headings from a markdown page so the in-page TOC can be
112
- * server-rendered (no post-hydration pop-in). Skips fenced code blocks. Ids are
113
- * produced with the same `github-slugger` that `rehype-slug` uses at render
114
- * time — including its duplicate-suffixing — so the SSR anchors match the real
115
- * heading ids exactly, not just for common cases.
116
- */
117
- function extractToc(source) {
118
- const body = source.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, '');
119
- const slugger = new GithubSlugger();
120
- const toc = [];
121
- let fence = null;
122
- for (const line of body.split('\n')) {
123
- const f = /^\s*(`{3,}|~{3,})/.exec(line);
124
- if (f) {
125
- const ch = f[1][0];
126
- if (fence === null)
127
- fence = ch;
128
- else if (ch === fence)
129
- fence = null;
130
- continue;
131
- }
132
- if (fence !== null)
133
- continue;
134
- const m = /^(#{2,3})\s+(.+?)\s*#*\s*$/.exec(line);
135
- if (!m)
136
- continue;
137
- const title = stripInlineMarkdown(m[2]);
138
- if (!title)
139
- continue;
140
- toc.push({ id: slugger.slug(title), title, depth: m[1].length });
141
- }
142
- return toc;
143
- }
144
- /** Last git commit date (strict ISO) for a file, or undefined outside a repo. */
145
- function lastCommitDate(file) {
146
- const res = spawnSync('git', ['log', '-1', '--format=%cI', '--', file], {
147
- cwd: path.dirname(file),
148
- encoding: 'utf-8'
149
- });
150
- const date = res.status === 0 ? res.stdout.trim() : '';
151
- return date || undefined;
152
- }
153
- /**
154
- * Walk every nav-worthy page under `contentDir` once: a page is nav-worthy when
155
- * its frontmatter has a string `title`. Yields the raw source, parsed
156
- * frontmatter, derived URL, and title so both the nav index and the search
157
- * index can be built from a single read of each file.
158
- */
159
- function* eachTitledPage(contentDir, routesDir) {
160
- for (const file of listPageFiles(contentDir)) {
161
- const source = fs.readFileSync(file, 'utf-8');
162
- const front = parseFrontmatter(source, file);
163
- if (typeof front.title !== 'string')
164
- continue;
165
- const dir = path.dirname(file);
166
- const url = '/' + path.relative(routesDir, dir).split(path.sep).join('/');
167
- yield { source, front, url, title: front.title, file };
168
- }
169
- }
170
- export function collectDocs(contentDir, routesDir) {
171
- if (!fs.existsSync(contentDir)) {
172
- console.warn(`[svelte-docsmith] content directory not found: ${contentDir}\n` +
173
- ` The sidebar will be empty. Create your doc pages there, or point docsmith() at the right place with \`content\`.`);
174
- return [];
175
- }
176
- const items = [];
177
- for (const { source, front, url, title, file } of eachTitledPage(contentDir, routesDir)) {
178
- items.push({
179
- title,
180
- path: url,
181
- description: typeof front.description === 'string' ? front.description : undefined,
182
- section: typeof front.section === 'string' ? front.section : undefined,
183
- order: typeof front.order === 'number' ? front.order : undefined,
184
- sourcePath: path.relative(process.cwd(), file).split(path.sep).join('/'),
185
- lastUpdated: lastCommitDate(file),
186
- toc: extractToc(source)
187
- });
188
- }
189
- if (items.length === 0) {
190
- console.warn(`[svelte-docsmith] no doc pages found under ${contentDir}\n` +
191
- ` Add \`+page.md\` files with at least a \`title:\` in their frontmatter to populate the sidebar.`);
192
- }
193
- // Stable output keeps the generated module diff-friendly across rebuilds.
194
- return items.sort((a, b) => a.path.localeCompare(b.path));
195
- }
196
- /**
197
- * Build the search records for every page under `contentDir`: title, section,
198
- * description, heading list, and plain-text body. Served as the lazy-loaded
199
- * `svelte-docsmith/search` virtual module so search can index bodies without
200
- * bloating the eagerly-imported nav index. The missing-directory case is
201
- * already reported by {@link collectDocs}, so this stays quiet.
202
- */
203
- export function collectSearchDocs(contentDir, routesDir) {
204
- if (!fs.existsSync(contentDir))
205
- return [];
206
- const docs = [];
207
- for (const { source, front, url, title } of eachTitledPage(contentDir, routesDir)) {
208
- docs.push({
209
- path: url,
210
- title,
211
- section: typeof front.section === 'string' ? front.section : undefined,
212
- description: typeof front.description === 'string' ? front.description : undefined,
213
- headings: extractToc(source).map((entry) => entry.title),
214
- text: extractSearchText(source)
215
- });
216
- }
217
- return docs.sort((a, b) => a.path.localeCompare(b.path));
218
- }
219
- /**
220
- * The page's markdown body for LLM output: frontmatter and `<script>`/`<style>`
221
- * blocks removed, everything else (headings, prose, code, component tags) kept,
222
- * with the frontmatter title prepended as an `h1` (pages start their body at h2).
223
- */
224
- function extractLlmsContent(source, title) {
225
- const body = source
226
- .replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, '')
227
- .replace(/<script[\s\S]*?<\/script>/gi, '')
228
- .replace(/<style[\s\S]*?<\/style>/gi, '')
229
- .trim();
230
- return `# ${title}\n\n${body}`;
231
- }
232
- /**
233
- * Build the LLM records for every page: title, section, description, and the
234
- * full markdown content. Served as the `svelte-docsmith/llms` virtual module and
235
- * consumed server-side by `llms.txt` / `llms-full.txt` routes, so it never ships
236
- * to the client.
237
- */
238
- export function collectLlmsDocs(contentDir, routesDir) {
239
- if (!fs.existsSync(contentDir))
240
- return [];
241
- const docs = [];
242
- for (const { source, front, url, title } of eachTitledPage(contentDir, routesDir)) {
243
- docs.push({
244
- path: url,
245
- title,
246
- section: typeof front.section === 'string' ? front.section : undefined,
247
- order: typeof front.order === 'number' ? front.order : undefined,
248
- description: typeof front.description === 'string' ? front.description : undefined,
249
- content: extractLlmsContent(source, title)
250
- });
251
- }
252
- return docs.sort((a, b) => a.path.localeCompare(b.path));
253
- }
254
- function parseFrontmatter(source, file) {
255
- const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(source);
256
- if (!match)
257
- return {};
258
- let data;
259
- try {
260
- data = yaml.load(match[1]);
261
- }
262
- catch (err) {
263
- const reason = err instanceof Error ? err.message : String(err);
264
- throw new Error(`[svelte-docsmith] invalid YAML frontmatter in ${file}\n${reason}`);
265
- }
266
- return data && typeof data === 'object' ? data : {};
267
- }
268
- function contentIndexPlugin(options) {
269
- const contentDir = path.resolve(options.content ?? 'src/routes/docs');
270
- const routesDir = path.resolve(options.routes ?? 'src/routes');
271
- return {
272
- name: 'docsmith-content',
273
- enforce: 'pre',
274
- resolveId(id) {
275
- if (id === CONTENT_SPECIFIER)
276
- return VIRTUAL_CONTENT_ID;
277
- if (id === SEARCH_SPECIFIER)
278
- return VIRTUAL_SEARCH_ID;
279
- if (id === LLMS_SPECIFIER)
280
- return VIRTUAL_LLMS_ID;
281
- },
282
- load(id) {
283
- // Watch each page file (not the directory) so editing frontmatter or
284
- // body re-runs this load. A directory here is treated as an
285
- // unresolvable import by vite:import-analysis; new/removed pages are
286
- // handled by the watcher in configureServer.
287
- if (id === VIRTUAL_CONTENT_ID) {
288
- for (const file of listPageFiles(contentDir))
289
- this.addWatchFile(file);
290
- const docs = collectDocs(contentDir, routesDir);
291
- return `export const docs = ${JSON.stringify(docs, null, 2)};\n`;
292
- }
293
- if (id === VIRTUAL_SEARCH_ID) {
294
- for (const file of listPageFiles(contentDir))
295
- this.addWatchFile(file);
296
- const docs = collectSearchDocs(contentDir, routesDir);
297
- return `export const docs = ${JSON.stringify(docs)};\n`;
298
- }
299
- if (id === VIRTUAL_LLMS_ID) {
300
- for (const file of listPageFiles(contentDir))
301
- this.addWatchFile(file);
302
- const docs = collectLlmsDocs(contentDir, routesDir);
303
- return `export const docs = ${JSON.stringify(docs)};\n`;
304
- }
305
- },
306
- configureServer(server) {
307
- server.watcher.add(contentDir);
308
- const onChange = (file) => {
309
- if (!isPageFile(file))
310
- return;
311
- let invalidated = false;
312
- for (const virtualId of [VIRTUAL_CONTENT_ID, VIRTUAL_SEARCH_ID, VIRTUAL_LLMS_ID]) {
313
- const mod = server.moduleGraph.getModuleById(virtualId);
314
- if (!mod)
315
- continue;
316
- server.moduleGraph.invalidateModule(mod);
317
- invalidated = true;
318
- }
319
- if (invalidated)
320
- server.ws.send({ type: 'full-reload' });
321
- };
322
- server.watcher.on('add', onChange);
323
- server.watcher.on('unlink', onChange);
324
- server.watcher.on('change', onChange);
325
- }
326
- };
327
- }
328
- // --- ?source transform (LiveExample) ------------------------------------
329
- const SOURCE_PREFIX = '\0docsmith-source:';
330
- // The virtual id must NOT end in `.svelte`, or vite-plugin-svelte will try to
331
- // compile the highlighted-HTML string as a component.
332
- const SOURCE_EXT = '.docsmith-src';
333
- const SOURCE_SUFFIX = '?source';
334
- function exampleSourcePlugin(options) {
335
- const themes = options.themes ?? DEFAULT_THEMES;
336
- const getHighlighter = lazyHighlighter([themes.light, themes.dark], ['svelte']);
337
- return {
338
- name: 'docsmith-example-source',
339
- enforce: 'pre',
340
- async resolveId(id, importer) {
341
- if (!id.endsWith('.svelte' + SOURCE_SUFFIX))
342
- return;
343
- const base = id.slice(0, -SOURCE_SUFFIX.length);
344
- const resolved = await this.resolve(base, importer, { skipSelf: true });
345
- if (resolved)
346
- return SOURCE_PREFIX + resolved.id + SOURCE_EXT;
347
- },
348
- async load(id) {
349
- if (!id.startsWith(SOURCE_PREFIX))
350
- return;
351
- const file = id.slice(SOURCE_PREFIX.length, -SOURCE_EXT.length);
352
- this.addWatchFile(file);
353
- const code = fs.readFileSync(file, 'utf-8').trimEnd();
354
- const highlighter = await getHighlighter();
355
- // Strip Shiki's own surface (the inline light `background-color` and the
356
- // `--shiki-dark-bg` var) so the highlighted source sits on the
357
- // consuming component's token background — matching markdown code blocks,
358
- // and never flashing Shiki's default before component CSS applies.
359
- const html = highlighter
360
- .codeToHtml(code, { lang: 'svelte', themes })
361
- .replace(/background-color:[^;"]*;?/gi, '')
362
- .replace(/--shiki-dark-bg:[^;"]*;?/gi, '');
363
- return `export default ${JSON.stringify(html)};`;
364
- }
365
- };
366
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes