@blogmcp/sdk 0.1.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 (340) hide show
  1. package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
  2. package/dist/_virtual/constants.js +4 -0
  3. package/dist/_virtual/index.js +2 -0
  4. package/dist/_virtual/index2.js +4 -0
  5. package/dist/_virtual/index3.js +2 -0
  6. package/dist/_virtual/re.js +4 -0
  7. package/dist/core/article-seo.d.ts +27 -0
  8. package/dist/core/article-seo.js +25 -0
  9. package/dist/core/auth.d.ts +34 -0
  10. package/dist/core/auth.js +89 -0
  11. package/dist/core/blog-config.d.ts +5 -0
  12. package/dist/core/blog-config.js +14 -0
  13. package/dist/core/client-types.d.ts +51 -0
  14. package/dist/core/client.d.ts +159 -0
  15. package/dist/core/client.js +82 -0
  16. package/dist/core/i18n.d.ts +29 -0
  17. package/dist/core/i18n.js +34 -0
  18. package/dist/core/index.d.ts +26 -0
  19. package/dist/core/index.js +67 -0
  20. package/dist/core/markdown.d.ts +69 -0
  21. package/dist/core/markdown.js +47 -0
  22. package/dist/core/navigation.d.ts +70 -0
  23. package/dist/core/navigation.js +71 -0
  24. package/dist/core/queries.d.ts +34 -0
  25. package/dist/core/queries.js +363 -0
  26. package/dist/core/retry.d.ts +9 -0
  27. package/dist/core/retry.js +14 -0
  28. package/dist/core/seo.d.ts +142 -0
  29. package/dist/core/seo.js +166 -0
  30. package/dist/core/theme.d.ts +41 -0
  31. package/dist/core/theme.js +60 -0
  32. package/dist/core/translations/cs.json.js +27 -0
  33. package/dist/core/translations/en.json.js +27 -0
  34. package/dist/core/types.d.ts +184 -0
  35. package/dist/core/types.js +9 -0
  36. package/dist/core/view-model.d.ts +53 -0
  37. package/dist/core/view-model.js +47 -0
  38. package/dist/node_modules/@braintree/sanitize-url/dist/constants.js +8 -0
  39. package/dist/node_modules/@braintree/sanitize-url/dist/index.js +60 -0
  40. package/dist/node_modules/dompurify/dist/purify.es.js +662 -0
  41. package/dist/node_modules/semver/classes/comparator.js +56 -0
  42. package/dist/node_modules/semver/classes/range.js +148 -0
  43. package/dist/node_modules/semver/classes/semver.js +169 -0
  44. package/dist/node_modules/semver/functions/clean.js +14 -0
  45. package/dist/node_modules/semver/functions/cmp.js +39 -0
  46. package/dist/node_modules/semver/functions/coerce.js +33 -0
  47. package/dist/node_modules/semver/functions/compare-build.js +14 -0
  48. package/dist/node_modules/semver/functions/compare-loose.js +11 -0
  49. package/dist/node_modules/semver/functions/compare.js +11 -0
  50. package/dist/node_modules/semver/functions/diff.js +24 -0
  51. package/dist/node_modules/semver/functions/eq.js +11 -0
  52. package/dist/node_modules/semver/functions/gt.js +11 -0
  53. package/dist/node_modules/semver/functions/gte.js +11 -0
  54. package/dist/node_modules/semver/functions/inc.js +21 -0
  55. package/dist/node_modules/semver/functions/lt.js +11 -0
  56. package/dist/node_modules/semver/functions/lte.js +11 -0
  57. package/dist/node_modules/semver/functions/major.js +11 -0
  58. package/dist/node_modules/semver/functions/minor.js +11 -0
  59. package/dist/node_modules/semver/functions/neq.js +11 -0
  60. package/dist/node_modules/semver/functions/parse.js +21 -0
  61. package/dist/node_modules/semver/functions/patch.js +11 -0
  62. package/dist/node_modules/semver/functions/prerelease.js +14 -0
  63. package/dist/node_modules/semver/functions/rcompare.js +11 -0
  64. package/dist/node_modules/semver/functions/rsort.js +11 -0
  65. package/dist/node_modules/semver/functions/satisfies.js +18 -0
  66. package/dist/node_modules/semver/functions/sort.js +11 -0
  67. package/dist/node_modules/semver/functions/valid.js +14 -0
  68. package/dist/node_modules/semver/index.js +97 -0
  69. package/dist/node_modules/semver/internal/constants.js +28 -0
  70. package/dist/node_modules/semver/internal/debug.js +8 -0
  71. package/dist/node_modules/semver/internal/identifiers.js +18 -0
  72. package/dist/node_modules/semver/internal/lrucache.js +32 -0
  73. package/dist/node_modules/semver/internal/parse-options.js +10 -0
  74. package/dist/node_modules/semver/internal/re.js +32 -0
  75. package/dist/node_modules/semver/ranges/gtr.js +11 -0
  76. package/dist/node_modules/semver/ranges/intersects.js +11 -0
  77. package/dist/node_modules/semver/ranges/ltr.js +11 -0
  78. package/dist/node_modules/semver/ranges/max-satisfying.js +22 -0
  79. package/dist/node_modules/semver/ranges/min-satisfying.js +22 -0
  80. package/dist/node_modules/semver/ranges/min-version.js +42 -0
  81. package/dist/node_modules/semver/ranges/outside.js +44 -0
  82. package/dist/node_modules/semver/ranges/simplify.js +24 -0
  83. package/dist/node_modules/semver/ranges/subset.js +94 -0
  84. package/dist/node_modules/semver/ranges/to-comparators.js +11 -0
  85. package/dist/node_modules/semver/ranges/valid.js +17 -0
  86. package/dist/nuxt/composables/useAsyncKb.d.ts +32 -0
  87. package/dist/nuxt/composables/useAsyncKb.js +34 -0
  88. package/dist/nuxt/index.d.ts +1 -0
  89. package/dist/nuxt/index.js +6 -0
  90. package/dist/packages/mdx-render-vue/dist/_virtual/_plugin-vue_export-helper.js +9 -0
  91. package/dist/packages/mdx-render-vue/dist/_virtual/constants.js +4 -0
  92. package/dist/packages/mdx-render-vue/dist/_virtual/index.js +5 -0
  93. package/dist/packages/mdx-render-vue/dist/_virtual/index2.js +4 -0
  94. package/dist/packages/mdx-render-vue/dist/composables/useAudioPlayer.js +40 -0
  95. package/dist/packages/mdx-render-vue/dist/composables/useCallout.js +66 -0
  96. package/dist/packages/mdx-render-vue/dist/composables/useCodeBlock.js +62 -0
  97. package/dist/packages/mdx-render-vue/dist/composables/useGallery.js +68 -0
  98. package/dist/packages/mdx-render-vue/dist/composables/useMedia.js +9 -0
  99. package/dist/packages/mdx-render-vue/dist/composables/useYouTube.js +24 -0
  100. package/dist/packages/mdx-render-vue/dist/edit/AlertEdit.vue.js +4 -0
  101. package/dist/packages/mdx-render-vue/dist/edit/AlertEdit.vue2.js +16 -0
  102. package/dist/packages/mdx-render-vue/dist/edit/AudioPlayerEdit.vue.js +102 -0
  103. package/dist/packages/mdx-render-vue/dist/edit/AudioPlayerEdit.vue2.js +4 -0
  104. package/dist/packages/mdx-render-vue/dist/edit/BadgeEdit.vue.js +4 -0
  105. package/dist/packages/mdx-render-vue/dist/edit/BadgeEdit.vue2.js +11 -0
  106. package/dist/packages/mdx-render-vue/dist/edit/ButtonEdit.vue.js +4 -0
  107. package/dist/packages/mdx-render-vue/dist/edit/ButtonEdit.vue2.js +11 -0
  108. package/dist/packages/mdx-render-vue/dist/edit/CalloutEdit.vue.js +78 -0
  109. package/dist/packages/mdx-render-vue/dist/edit/CalloutEdit.vue2.js +4 -0
  110. package/dist/packages/mdx-render-vue/dist/edit/CardEdit.vue.js +4 -0
  111. package/dist/packages/mdx-render-vue/dist/edit/CardEdit.vue2.js +16 -0
  112. package/dist/packages/mdx-render-vue/dist/edit/CodeBlockEdit.vue.js +6 -0
  113. package/dist/packages/mdx-render-vue/dist/edit/CodeBlockEdit.vue2.js +74 -0
  114. package/dist/packages/mdx-render-vue/dist/edit/GalleryEdit.vue.js +56 -0
  115. package/dist/packages/mdx-render-vue/dist/edit/GalleryEdit.vue2.js +4 -0
  116. package/dist/packages/mdx-render-vue/dist/edit/IconEdit.vue.js +4 -0
  117. package/dist/packages/mdx-render-vue/dist/edit/IconEdit.vue2.js +11 -0
  118. package/dist/packages/mdx-render-vue/dist/edit/TooltipEdit.vue.js +4 -0
  119. package/dist/packages/mdx-render-vue/dist/edit/TooltipEdit.vue2.js +20 -0
  120. package/dist/packages/mdx-render-vue/dist/edit/YouTubeEdit.vue.js +34 -0
  121. package/dist/packages/mdx-render-vue/dist/edit/YouTubeEdit.vue2.js +4 -0
  122. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/_virtual/_rolldown/runtime.js +11 -0
  123. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/factory.js +29 -0
  124. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/presence/use-presence-context.js +6 -0
  125. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/presence/use-presence.js +32 -0
  126. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow-tip.js +5 -0
  127. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow-tip.vue_vue_type_script_setup_true_lang.js +18 -0
  128. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow.js +5 -0
  129. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow.vue_vue_type_script_setup_true_lang.js +18 -0
  130. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-content.js +5 -0
  131. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-content.vue_vue_type_script_setup_true_lang.js +20 -0
  132. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-context.js +5 -0
  133. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-context.vue_vue_type_script_setup_true_lang.js +12 -0
  134. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-positioner.js +5 -0
  135. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-positioner.vue_vue_type_script_setup_true_lang.js +19 -0
  136. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root-provider.js +5 -0
  137. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root-provider.vue_vue_type_script_setup_true_lang.js +29 -0
  138. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root.js +5 -0
  139. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root.vue_vue_type_script_setup_true_lang.js +59 -0
  140. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-trigger.js +5 -0
  141. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-trigger.vue_vue_type_script_setup_true_lang.js +21 -0
  142. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip.js +22 -0
  143. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/use-tooltip-context.js +6 -0
  144. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/use-tooltip.js +29 -0
  145. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/providers/environment/use-environment-context.js +12 -0
  146. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/providers/locale/use-locale-context.js +11 -0
  147. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/clean-props.js +8 -0
  148. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/create-context.js +12 -0
  149. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/dynamic.js +25 -0
  150. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/unref-element.js +8 -0
  151. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/use-forward-expose.js +36 -0
  152. package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/use-render-strategy.js +5 -0
  153. package/dist/packages/mdx-render-vue/dist/node_modules/@braintree/sanitize-url/dist/constants.js +8 -0
  154. package/dist/packages/mdx-render-vue/dist/node_modules/@braintree/sanitize-url/dist/index.js +60 -0
  155. package/dist/packages/mdx-render-vue/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +532 -0
  156. package/dist/packages/mdx-render-vue/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +403 -0
  157. package/dist/packages/mdx-render-vue/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
  158. package/dist/packages/mdx-render-vue/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +128 -0
  159. package/dist/packages/mdx-render-vue/dist/node_modules/@iconify/vue/dist/iconify.js +1192 -0
  160. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/anatomy/dist/create-anatomy.js +26 -0
  161. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/core/dist/create-machine.js +21 -0
  162. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/core/dist/merge-props.js +45 -0
  163. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/core/dist/scope.js +16 -0
  164. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/core/dist/state.js +136 -0
  165. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/core/dist/types.js +5 -0
  166. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/chunk-QZ7TP4HQ.js +4 -0
  167. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/computed-style.js +8 -0
  168. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/event.js +31 -0
  169. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/node.js +49 -0
  170. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/overflow.js +19 -0
  171. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/platform.js +16 -0
  172. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/query.js +6 -0
  173. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/raf.js +41 -0
  174. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/set.js +14 -0
  175. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/shared.js +7 -0
  176. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/focus-visible/dist/index.js +90 -0
  177. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/popper/dist/get-anchor.js +34 -0
  178. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/popper/dist/get-placement.js +187 -0
  179. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/popper/dist/get-styles.js +47 -0
  180. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/popper/dist/middleware.js +56 -0
  181. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/popper/dist/placement.js +7 -0
  182. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/presence/dist/presence.connect.js +16 -0
  183. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/presence/dist/presence.machine.js +147 -0
  184. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/tooltip/dist/tooltip.anatomy.js +6 -0
  185. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/tooltip/dist/tooltip.connect.js +119 -0
  186. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/tooltip/dist/tooltip.dom.js +15 -0
  187. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/tooltip/dist/tooltip.machine.js +375 -0
  188. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/tooltip/dist/tooltip.store.js +9 -0
  189. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/types/dist/prop-types.js +10 -0
  190. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/array.js +6 -0
  191. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/equal.js +27 -0
  192. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/functions.js +10 -0
  193. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/guard.js +15 -0
  194. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/object.js +13 -0
  195. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/store.js +25 -0
  196. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/warning.js +25 -0
  197. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/vue/dist/bindable.js +37 -0
  198. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/vue/dist/machine.js +205 -0
  199. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/vue/dist/normalize-props.js +30 -0
  200. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/vue/dist/refs.js +14 -0
  201. package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/vue/dist/track.js +19 -0
  202. package/dist/packages/mdx-render-vue/dist/node_modules/dompurify/dist/purify.es.js +659 -0
  203. package/dist/packages/mdx-render-vue/dist/registry.js +154 -0
  204. package/dist/packages/mdx-render-vue/dist/render/alert/Alert.vue.js +4 -0
  205. package/dist/packages/mdx-render-vue/dist/render/alert/Alert.vue2.js +37 -0
  206. package/dist/packages/mdx-render-vue/dist/render/audioplayer/AudioPlayerDefault.vue.js +102 -0
  207. package/dist/packages/mdx-render-vue/dist/render/audioplayer/AudioPlayerDefault.vue2.js +4 -0
  208. package/dist/packages/mdx-render-vue/dist/render/badge/Badge.vue.js +4 -0
  209. package/dist/packages/mdx-render-vue/dist/render/badge/Badge.vue2.js +25 -0
  210. package/dist/packages/mdx-render-vue/dist/render/button/Button.vue.js +4 -0
  211. package/dist/packages/mdx-render-vue/dist/render/button/Button.vue2.js +37 -0
  212. package/dist/packages/mdx-render-vue/dist/render/callout/CalloutDefault.vue.js +79 -0
  213. package/dist/packages/mdx-render-vue/dist/render/callout/CalloutDefault.vue2.js +4 -0
  214. package/dist/packages/mdx-render-vue/dist/render/callout/CalloutMinimal.vue.js +22 -0
  215. package/dist/packages/mdx-render-vue/dist/render/callout/CalloutMinimal.vue2.js +4 -0
  216. package/dist/packages/mdx-render-vue/dist/render/card/Card.vue.js +4 -0
  217. package/dist/packages/mdx-render-vue/dist/render/card/Card.vue2.js +24 -0
  218. package/dist/packages/mdx-render-vue/dist/render/codeblock/CodeBlockDefault.vue.js +6 -0
  219. package/dist/packages/mdx-render-vue/dist/render/codeblock/CodeBlockDefault.vue2.js +77 -0
  220. package/dist/packages/mdx-render-vue/dist/render/gallery/GalleryGrid.vue.js +103 -0
  221. package/dist/packages/mdx-render-vue/dist/render/gallery/GalleryGrid.vue2.js +4 -0
  222. package/dist/packages/mdx-render-vue/dist/render/gallery/GalleryLightbox.vue.js +6 -0
  223. package/dist/packages/mdx-render-vue/dist/render/gallery/GalleryLightbox.vue2.js +142 -0
  224. package/dist/packages/mdx-render-vue/dist/render/icon/Icon.vue.js +4 -0
  225. package/dist/packages/mdx-render-vue/dist/render/icon/Icon.vue2.js +23 -0
  226. package/dist/packages/mdx-render-vue/dist/render/tooltip/Tooltip.vue.js +4 -0
  227. package/dist/packages/mdx-render-vue/dist/render/tooltip/Tooltip.vue2.js +54 -0
  228. package/dist/packages/mdx-render-vue/dist/render/youtube/YouTubeDefault.vue.js +69 -0
  229. package/dist/packages/mdx-render-vue/dist/render/youtube/YouTubeDefault.vue2.js +4 -0
  230. package/dist/packages/mdx-schema/dist/composables/useMdxParsing.js +139 -0
  231. package/dist/packages/mdx-schema/dist/metadata/index.js +415 -0
  232. package/dist/packages/mdx-schema/dist/prepareProps.js +46 -0
  233. package/dist/packages/mdx-schema/dist/styles/index.js +119 -0
  234. package/dist/packages/mdx-schema/dist/types/index.js +26 -0
  235. package/dist/packages/sanitize/dist/html.js +41 -0
  236. package/dist/react/KbMdxContent.d.ts +35 -0
  237. package/dist/react/KbMdxContent.js +102 -0
  238. package/dist/react/context.d.ts +11 -0
  239. package/dist/react/context.js +5 -0
  240. package/dist/react/hooks/useImageRenderer.d.ts +6 -0
  241. package/dist/react/hooks/useImageRenderer.js +9 -0
  242. package/dist/react/hooks/useKbClient.d.ts +3 -0
  243. package/dist/react/hooks/useKbClient.js +7 -0
  244. package/dist/react/hooks/useKbContext.d.ts +3 -0
  245. package/dist/react/hooks/useKbContext.js +11 -0
  246. package/dist/react/hooks/useKbI18n.d.ts +7 -0
  247. package/dist/react/hooks/useKbI18n.js +8 -0
  248. package/dist/react/hooks/useKbLanguage.d.ts +21 -0
  249. package/dist/react/hooks/useKbLanguage.js +63 -0
  250. package/dist/react/hooks/useKbSearch.d.ts +20 -0
  251. package/dist/react/hooks/useKbSearch.js +22 -0
  252. package/dist/react/hooks/useMdxContent.d.ts +18 -0
  253. package/dist/react/hooks/useMdxContent.js +11 -0
  254. package/dist/react/index.d.ts +21 -0
  255. package/dist/react/index.js +20 -0
  256. package/dist/react/provider.d.ts +25 -0
  257. package/dist/react/provider.js +29 -0
  258. package/dist/react/server/index.d.ts +38 -0
  259. package/dist/react/server/index.js +26 -0
  260. package/dist/sdk.css +1 -0
  261. package/dist/vue/components/KbAccessGate.vue.d.ts +36 -0
  262. package/dist/vue/components/KbAccessGate.vue.js +74 -0
  263. package/dist/vue/components/KbAccessGate.vue2.js +4 -0
  264. package/dist/vue/components/KbArticleCard.vue.d.ts +34 -0
  265. package/dist/vue/components/KbArticleCard.vue.js +87 -0
  266. package/dist/vue/components/KbArticleCard.vue2.js +4 -0
  267. package/dist/vue/components/KbMdxContent.vue.d.ts +5 -0
  268. package/dist/vue/components/KbMdxContent.vue.js +7 -0
  269. package/dist/vue/components/KbMdxContent.vue2.js +82 -0
  270. package/dist/vue/composables/useArticles.d.ts +30 -0
  271. package/dist/vue/composables/useArticles.js +36 -0
  272. package/dist/vue/composables/useImageRenderer.d.ts +6 -0
  273. package/dist/vue/composables/useImageRenderer.js +9 -0
  274. package/dist/vue/composables/useKbAuth.d.ts +27 -0
  275. package/dist/vue/composables/useKbAuth.js +83 -0
  276. package/dist/vue/composables/useKbClient.d.ts +6 -0
  277. package/dist/vue/composables/useKbClient.js +13 -0
  278. package/dist/vue/composables/useKbComments.d.ts +37 -0
  279. package/dist/vue/composables/useKbComments.js +160 -0
  280. package/dist/vue/composables/useKbI18n.d.ts +6 -0
  281. package/dist/vue/composables/useKbI18n.js +8 -0
  282. package/dist/vue/composables/useKbLanguage.d.ts +22 -0
  283. package/dist/vue/composables/useKbLanguage.js +63 -0
  284. package/dist/vue/composables/useNavigation.d.ts +18 -0
  285. package/dist/vue/composables/useNavigation.js +20 -0
  286. package/dist/vue/composables/useSearch.d.ts +21 -0
  287. package/dist/vue/composables/useSearch.js +20 -0
  288. package/dist/vue/composables/useTags.d.ts +17 -0
  289. package/dist/vue/composables/useTags.js +36 -0
  290. package/dist/vue/index.d.ts +22 -0
  291. package/dist/vue/index.js +36 -0
  292. package/dist/vue/plugin.d.ts +30 -0
  293. package/dist/vue/plugin.js +17 -0
  294. package/package.json +97 -0
  295. package/src/core/article-seo.ts +101 -0
  296. package/src/core/auth.ts +138 -0
  297. package/src/core/blog-config.ts +30 -0
  298. package/src/core/client-types.ts +58 -0
  299. package/src/core/client.ts +287 -0
  300. package/src/core/i18n.ts +84 -0
  301. package/src/core/index.ts +147 -0
  302. package/src/core/markdown.ts +178 -0
  303. package/src/core/navigation.ts +152 -0
  304. package/src/core/queries.ts +414 -0
  305. package/src/core/retry.ts +19 -0
  306. package/src/core/seo.ts +374 -0
  307. package/src/core/theme.ts +128 -0
  308. package/src/core/translations/cs.json +225 -0
  309. package/src/core/translations/en.json +225 -0
  310. package/src/core/types.ts +231 -0
  311. package/src/core/view-model.ts +98 -0
  312. package/src/nuxt/composables/useAsyncKb.ts +119 -0
  313. package/src/nuxt/index.ts +6 -0
  314. package/src/react/KbMdxContent.tsx +215 -0
  315. package/src/react/context.ts +25 -0
  316. package/src/react/hooks/useImageRenderer.ts +15 -0
  317. package/src/react/hooks/useKbClient.ts +9 -0
  318. package/src/react/hooks/useKbContext.ts +13 -0
  319. package/src/react/hooks/useKbI18n.ts +15 -0
  320. package/src/react/hooks/useKbLanguage.ts +105 -0
  321. package/src/react/hooks/useKbSearch.ts +50 -0
  322. package/src/react/hooks/useMdxContent.tsx +33 -0
  323. package/src/react/index.ts +31 -0
  324. package/src/react/provider.tsx +70 -0
  325. package/src/react/server/index.ts +70 -0
  326. package/src/vue/components/KbAccessGate.vue +86 -0
  327. package/src/vue/components/KbArticleCard.vue +102 -0
  328. package/src/vue/components/KbMdxContent.vue +211 -0
  329. package/src/vue/composables/useArticles.ts +78 -0
  330. package/src/vue/composables/useImageRenderer.ts +12 -0
  331. package/src/vue/composables/useKbAuth.ts +131 -0
  332. package/src/vue/composables/useKbClient.ts +17 -0
  333. package/src/vue/composables/useKbComments.ts +281 -0
  334. package/src/vue/composables/useKbI18n.ts +11 -0
  335. package/src/vue/composables/useKbLanguage.ts +103 -0
  336. package/src/vue/composables/useNavigation.ts +38 -0
  337. package/src/vue/composables/useSearch.ts +52 -0
  338. package/src/vue/composables/useTags.ts +64 -0
  339. package/src/vue/index.ts +27 -0
  340. package/src/vue/plugin.ts +73 -0
@@ -0,0 +1,33 @@
1
+ 'use client'
2
+
3
+ /**
4
+ * Convenience hook that returns an MDX render function bound to the consumer's
5
+ * component registry + the SDK's image renderer (from KbProvider context).
6
+ *
7
+ * const renderMdx = useMdxContent({ components })
8
+ * return <article>{renderMdx(article.content)}</article>
9
+ *
10
+ * The hook is sugar over `<KbMdxContent>` — same prepareProps guarantee,
11
+ * same fallback UX. Useful when a parent already manages layout and wants
12
+ * to keep the render inline.
13
+ */
14
+
15
+ import type { ReactNode } from 'react'
16
+ import { useImageRenderer } from './useImageRenderer'
17
+ import {
18
+ KbMdxContent,
19
+ type KbMdxComponentRegistry,
20
+ } from '../KbMdxContent'
21
+
22
+ export interface UseMdxContentOptions {
23
+ /** Component registry mapping schema names → React components. */
24
+ components?: KbMdxComponentRegistry
25
+ }
26
+
27
+ export function useMdxContent(opts: UseMdxContentOptions = {}): (content: string) => ReactNode {
28
+ const imageRenderer = useImageRenderer()
29
+ const components = opts.components ?? {}
30
+ return function renderMdx(content: string) {
31
+ return KbMdxContent({ content, components, imageRenderer })
32
+ }
33
+ }
@@ -0,0 +1,31 @@
1
+ 'use client'
2
+
3
+ /**
4
+ * React client adapter for the KB Blog SDK (`@blogmcp/sdk/react`).
5
+ *
6
+ * Provider + hooks for the interactive client surface. Server-side data
7
+ * fetching lives in `@blogmcp/sdk/react/server` (directive-free, RSC-safe).
8
+ */
9
+
10
+ // Provider + context
11
+ export { KbProvider } from './provider'
12
+ export type { KbProviderProps } from './provider'
13
+ export { KbContext } from './context'
14
+ export type { KbContextValue } from './context'
15
+
16
+ // Hooks
17
+ export { useKbClient } from './hooks/useKbClient'
18
+ export { useKbI18n } from './hooks/useKbI18n'
19
+ export { useImageRenderer } from './hooks/useImageRenderer'
20
+ export { useKbLanguage } from './hooks/useKbLanguage'
21
+ export type { UseKbLanguageReturn } from './hooks/useKbLanguage'
22
+ export { useKbSearch } from './hooks/useKbSearch'
23
+ export type { UseKbSearchReturn, SearchMode } from './hooks/useKbSearch'
24
+
25
+ // MDX renderer + convenience hook (Fix 3)
26
+ // Mirrors the Vue path: parse → prepareProps → render via a consumer-supplied
27
+ // component registry. Framework-neutral — no dependency on @blogmcp/mdx-render-react.
28
+ export { KbMdxContent } from './KbMdxContent'
29
+ export type { KbMdxContentProps, KbMdxComponentRegistry } from './KbMdxContent'
30
+ export { useMdxContent } from './hooks/useMdxContent'
31
+ export type { UseMdxContentOptions } from './hooks/useMdxContent'
@@ -0,0 +1,70 @@
1
+ 'use client'
2
+
3
+ /**
4
+ * React provider for the KB Blog SDK — the analogue of the Vue `KbVue` plugin.
5
+ *
6
+ * <KbProvider endpoint="https://api.example.com/graphql" locale="en">
7
+ * <App />
8
+ * </KbProvider>
9
+ *
10
+ * Use this for the client-side interactive surface (search, language switch,
11
+ * comments). Server Components fetch via `createServerKbClient()` instead.
12
+ */
13
+
14
+ import { useMemo, type ReactNode } from 'react'
15
+ import type { KbClientConfig, ImageHtmlRenderer, TokenStorage } from '../core/client-types'
16
+ import type { TranslateFn } from '../core/i18n'
17
+ import { createKbClient } from '../core/client'
18
+ import {
19
+ createAuthManager,
20
+ createLocalStorageTokenStorage,
21
+ createMemoryTokenStorage,
22
+ } from '../core/auth'
23
+ import { createKbI18n } from '../core/i18n'
24
+ import { defaultImageHtml } from '../core/markdown'
25
+ import { KbContext, type KbContextValue } from './context'
26
+
27
+ export interface KbProviderProps extends KbClientConfig {
28
+ /** Custom auth token storage. Defaults to localStorage in browser, memory on server. */
29
+ tokenStorage?: TokenStorage
30
+ /** Translation function. Defaults to the built-in createKbI18n. */
31
+ i18n?: TranslateFn
32
+ /** Default locale for the built-in i18n (if `i18n` not provided). Defaults to 'en'. */
33
+ locale?: string
34
+ /** Image HTML renderer for MDX content. Defaults to a plain <img>. */
35
+ imageRenderer?: ImageHtmlRenderer
36
+ children: ReactNode
37
+ }
38
+
39
+ export function KbProvider({
40
+ children,
41
+ tokenStorage,
42
+ i18n,
43
+ locale,
44
+ imageRenderer,
45
+ ...clientConfig
46
+ }: KbProviderProps) {
47
+ const value = useMemo<KbContextValue>(() => {
48
+ // Auto-detect browser vs server token storage (mirrors the Vue plugin).
49
+ const storage =
50
+ tokenStorage ||
51
+ (typeof window !== 'undefined'
52
+ ? createLocalStorageTokenStorage()
53
+ : createMemoryTokenStorage())
54
+
55
+ const client = createKbClient({ ...clientConfig, tokenStorage: storage })
56
+ const auth = createAuthManager(storage)
57
+
58
+ return {
59
+ client,
60
+ auth,
61
+ i18n: i18n || createKbI18n(locale || 'en'),
62
+ imageRenderer: imageRenderer || defaultImageHtml,
63
+ }
64
+ // Rebuild only when the connection identity / locale changes. Other props
65
+ // (fetcher, storage, i18n, imageRenderer) are expected to be stable.
66
+ // eslint-disable-next-line react-hooks/exhaustive-deps
67
+ }, [clientConfig.endpoint, clientConfig.serverEndpoint, clientConfig.isServer, locale])
68
+
69
+ return <KbContext.Provider value={value}>{children}</KbContext.Provider>
70
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Server-only helpers for React Server Components, route handlers, and
3
+ * `generateMetadata`. Intentionally directive-free (no `'use client'`) and
4
+ * importing NO React, so it stays tree-shakeable in the server graph.
5
+ *
6
+ * Server Components fetch by calling `createServerKbClient()` directly and
7
+ * `await`-ing the core client — no hooks, no context. This is the App Router
8
+ * analogue of Nuxt's `useAsyncData`.
9
+ */
10
+
11
+ import type { KbClient } from '../../core/client'
12
+ import type { Fetcher, KbClientConfig, TokenStorage } from '../../core/client-types'
13
+ import { createKbClient } from '../../core/client'
14
+ import { createMemoryTokenStorage } from '../../core/auth'
15
+
16
+ export interface NextFetcherOptions {
17
+ /** ISR revalidate seconds threaded into Next's fetch cache (`false` = no revalidate). */
18
+ revalidate?: number | false
19
+ /** Next cache tags for on-demand revalidation. */
20
+ tags?: string[]
21
+ }
22
+
23
+ /** Minimal shape of Next.js's `fetch` cache extension (avoids a Next dependency). */
24
+ type NextRequestInit = RequestInit & {
25
+ next?: { revalidate?: number | false; tags?: string[] }
26
+ }
27
+
28
+ /**
29
+ * A `Fetcher` that threads Next.js fetch caching (`revalidate` / `tags`) into
30
+ * SDK requests. Mirrors the SDK's default fetcher: returns the parsed GraphQL
31
+ * `{ data, errors }` body; the client checks `errors`.
32
+ */
33
+ export function createNextFetcher(options: NextFetcherOptions = {}): Fetcher {
34
+ return async (url, init) => {
35
+ const requestInit: NextRequestInit = {
36
+ method: init.method,
37
+ headers: init.headers,
38
+ body: init.body,
39
+ next: { revalidate: options.revalidate, tags: options.tags },
40
+ }
41
+ const response = await fetch(url, requestInit)
42
+ return response.json()
43
+ }
44
+ }
45
+
46
+ export interface CreateServerKbClientOptions
47
+ extends Omit<KbClientConfig, 'isServer' | 'fetcher' | 'tokenStorage'> {
48
+ /** Override the fetcher. Defaults to `createNextFetcher(next)`. */
49
+ fetcher?: Fetcher
50
+ /** Per-request token storage (e.g. seeded from cookies). Defaults to in-memory. */
51
+ tokenStorage?: TokenStorage
52
+ /** Next ISR options used when no explicit `fetcher` is provided. */
53
+ next?: NextFetcherOptions
54
+ }
55
+
56
+ /**
57
+ * Create a per-request KbClient for Server Components / route handlers.
58
+ *
59
+ * MUST be called per request — never assign the result to a module-scope
60
+ * singleton, or one request's auth token can leak into another.
61
+ */
62
+ export function createServerKbClient(options: CreateServerKbClientOptions): KbClient {
63
+ const { fetcher, tokenStorage, next, ...config } = options
64
+ return createKbClient({
65
+ ...config,
66
+ isServer: true,
67
+ fetcher: fetcher || createNextFetcher(next),
68
+ tokenStorage: tokenStorage || createMemoryTokenStorage(),
69
+ })
70
+ }
@@ -0,0 +1,86 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Headless Access Gate
4
+ *
5
+ * Blocks content access for insufficient access levels.
6
+ * Provides state via slot props for custom rendering.
7
+ */
8
+
9
+ import { computed } from 'vue'
10
+ import type { AccessLevel } from '../../core/types'
11
+ import { useKbAuth } from '../composables/useKbAuth'
12
+ import { useKbI18n } from '../composables/useKbI18n'
13
+
14
+ const props = defineProps<{
15
+ article: { title: string; description?: string | null }
16
+ requiredLevel: AccessLevel
17
+ }>()
18
+
19
+ const emit = defineEmits<{
20
+ signIn: []
21
+ upgrade: []
22
+ browseFree: []
23
+ }>()
24
+
25
+ const { isAuthenticated } = useKbAuth()
26
+ const t = useKbI18n()
27
+
28
+ const levelLabel = computed(() => t(`accessGate.level${capitalize(props.requiredLevel)}`))
29
+
30
+ function capitalize(s: string): string {
31
+ return s.charAt(0).toUpperCase() + s.slice(1)
32
+ }
33
+ </script>
34
+
35
+ <template>
36
+ <slot
37
+ :article="article"
38
+ :required-level="requiredLevel"
39
+ :level-label="levelLabel"
40
+ :is-authenticated="isAuthenticated"
41
+ >
42
+ <!-- Default rendering -->
43
+ <div
44
+ data-testid="access-gate"
45
+ class="rounded-xl border border-gray-200 bg-gray-50 p-8 text-center"
46
+ >
47
+ <div class="mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-blue-50">
48
+ <svg class="h-8 w-8 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
49
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
50
+ </svg>
51
+ </div>
52
+ <h2 class="mt-6 text-2xl font-bold text-gray-900">{{ article.title }}</h2>
53
+ <p v-if="article.description" class="mt-2 text-gray-600">{{ article.description }}</p>
54
+ <p class="mt-6 text-gray-600">
55
+ <template v-if="!isAuthenticated">
56
+ {{ t('accessGate.signInToAccess', { level: levelLabel }) }}
57
+ </template>
58
+ <template v-else>
59
+ {{ t('accessGate.requiresAccess', { level: levelLabel }) }}
60
+ </template>
61
+ </p>
62
+ <div class="mt-8 flex flex-col items-center gap-4 sm:flex-row sm:justify-center">
63
+ <button
64
+ v-if="!isAuthenticated"
65
+ class="inline-flex items-center rounded-lg bg-blue-600 px-6 py-3 font-medium text-white hover:bg-blue-700"
66
+ @click="emit('signIn')"
67
+ >
68
+ {{ t('accessGate.signIn') }}
69
+ </button>
70
+ <button
71
+ v-else-if="requiredLevel === 'premium'"
72
+ class="inline-flex items-center rounded-lg bg-blue-600 px-6 py-3 font-medium text-white hover:bg-blue-700"
73
+ @click="emit('upgrade')"
74
+ >
75
+ {{ t('accessGate.upgradeToPremium') }}
76
+ </button>
77
+ <button
78
+ class="inline-flex items-center text-gray-600 hover:text-gray-900"
79
+ @click="emit('browseFree')"
80
+ >
81
+ {{ t('accessGate.browseFreeArticles') }}
82
+ </button>
83
+ </div>
84
+ </div>
85
+ </slot>
86
+ </template>
@@ -0,0 +1,102 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Headless Article Card
4
+ *
5
+ * Provides article data and computed properties via slot props.
6
+ * Consumer controls rendering via the default slot.
7
+ * Falls back to a basic pre-styled card if no slot is provided.
8
+ */
9
+
10
+ import { computed } from 'vue'
11
+ import type { Article } from '../../core/types'
12
+
13
+ const props = withDefaults(defineProps<{
14
+ article: Article
15
+ featured?: boolean
16
+ locale?: string
17
+ }>(), {
18
+ featured: false,
19
+ locale: 'en',
20
+ })
21
+
22
+ const emit = defineEmits<{
23
+ click: [article: Article]
24
+ }>()
25
+
26
+ const slug = computed(() =>
27
+ props.article.slug || props.article.filename.replace(/\.(md|mdx)$/, ''),
28
+ )
29
+
30
+ const articleUrl = computed(() => `/articles/${slug.value}`)
31
+
32
+ const tags = computed(() => props.article.tags || [])
33
+
34
+ function formatDate(dateString: string): string {
35
+ const loc = props.locale === 'cs' ? 'cs-CZ' : 'en-US'
36
+ return new Date(dateString).toLocaleDateString(loc, {
37
+ year: 'numeric',
38
+ month: 'long',
39
+ day: 'numeric',
40
+ })
41
+ }
42
+
43
+ const displayDate = computed(() => {
44
+ const dateStr = props.article.publishedAt || props.article.updatedAt
45
+ return dateStr ? formatDate(dateStr) : ''
46
+ })
47
+ </script>
48
+
49
+ <template>
50
+ <slot
51
+ :article="article"
52
+ :slug="slug"
53
+ :article-url="articleUrl"
54
+ :tags="tags"
55
+ :display-date="displayDate"
56
+ :featured="featured"
57
+ :format-date="formatDate"
58
+ >
59
+ <!-- Default rendering (basic card) -->
60
+ <article
61
+ :class="[
62
+ 'group relative overflow-hidden rounded-xl border border-gray-200 bg-white transition-all duration-200 hover:shadow-lg',
63
+ featured ? 'md:col-span-2 md:flex' : '',
64
+ ]"
65
+ @click="emit('click', article)"
66
+ >
67
+ <div
68
+ v-if="article.featuredImageUrl"
69
+ :class="['overflow-hidden bg-gray-100', featured ? 'md:w-1/2' : 'aspect-video']"
70
+ >
71
+ <img
72
+ :src="article.featuredImageUrl"
73
+ :alt="article.title || ''"
74
+ class="h-full w-full object-cover"
75
+ loading="lazy"
76
+ />
77
+ </div>
78
+ <div :class="['flex flex-col p-5', featured ? 'md:w-1/2 md:p-6' : '']">
79
+ <div v-if="tags.length > 0" class="mb-3 flex flex-wrap gap-2">
80
+ <span
81
+ v-for="tag in tags.slice(0, 3)"
82
+ :key="tag"
83
+ class="rounded-full bg-blue-50 px-2.5 py-0.5 text-xs font-medium text-blue-600"
84
+ >
85
+ {{ tag }}
86
+ </span>
87
+ </div>
88
+ <h3 :class="['font-semibold text-gray-900', featured ? 'text-xl md:text-2xl' : 'text-lg']">
89
+ <a :href="articleUrl" class="after:absolute after:inset-0">
90
+ {{ article.title }}
91
+ </a>
92
+ </h3>
93
+ <p v-if="article.description" class="mt-2 line-clamp-2 text-gray-600">
94
+ {{ article.description }}
95
+ </p>
96
+ <div class="mt-auto pt-4 text-sm text-gray-500">
97
+ <time v-if="displayDate">{{ displayDate }}</time>
98
+ </div>
99
+ </div>
100
+ </article>
101
+ </slot>
102
+ </template>
@@ -0,0 +1,211 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * MDX Content Renderer (SDK version)
4
+ *
5
+ * Renders MDX content with Vue components.
6
+ * Falls back to marked for pure markdown content.
7
+ *
8
+ * Differences from blog's MdxContent.vue:
9
+ * - Uses inject(KB_IMAGE_RENDERER_KEY) for pluggable image rendering
10
+ * - No dependency on Nuxt auto-imports
11
+ */
12
+
13
+ import { computed, inject, h, type Component, type VNode } from 'vue'
14
+ import type { Marked } from 'marked'
15
+ import type { ImageHtmlRenderer } from '../../core/client-types'
16
+ import { KB_IMAGE_RENDERER_KEY } from '../plugin'
17
+ import { createMarkedInstance, defaultImageHtml, parseMarkdownSafe } from '../../core/markdown'
18
+ // Re-exported from the SDK core so the seam works regardless of which renderer
19
+ // (built-in Vue, custom Vue with `registerCustomComponent`, or none) the consumer
20
+ // wires. We normalize `item.props` at parse-time so the props the renderer sees
21
+ // always match the latest schema shape — propRename, enumValueRename, and
22
+ // propBecameRequired defaults are applied even when the consumer skipped
23
+ // `@blogmcp/mdx-render-vue/registry`. See Fix 2.
24
+ import { prepareProps, getComponentMetadata } from '../../core'
25
+ // Sanitize-by-default: KbMdxContent ships safe — DOMPurify wired in via the
26
+ // strict config from @blogmcp/sanitize. Consumers who don't want the
27
+ // sanitizer in their bundle should NOT import KbMdxContent — use the lower-
28
+ // level core exports (extractMdxComponents, parseJsxProps, raw Marked) and
29
+ // own the trust contract at their renderer.
30
+ // See: competitor-monitor/docs/internal/sanitization-trust-contract.md
31
+ import { sanitizeHtml } from '@blogmcp/sanitize'
32
+
33
+ // Import from @blogmcp/mdx-render-vue (peer dependency in consumer's app)
34
+ // These are re-exported parsing utilities + the prepareProps-aware getter.
35
+ let parseJsxProps: (str: string) => Record<string, unknown>
36
+ let stripFrontmatter: (content: string) => string
37
+ let HAS_MDX_RE: RegExp
38
+ let MDX_COMPONENT_PATTERN: RegExp
39
+ let getWrappedRenderComponent: ((name: string, variant?: string) => Component | undefined) | null
40
+ let registryHasComponent: (name: string) => boolean
41
+
42
+ // Dynamic import to avoid hard dependency — consumer provides @blogmcp/mdx-render-vue.
43
+ // We prefer `getWrappedRenderComponent` over a hand-rolled `defineAsyncComponent`
44
+ // loader so SDK consumers get the schema's render-time prepareProps shim
45
+ // automatically (prop renames + enum-value renames + propBecameRequired
46
+ // defaults normalized before reaching the component). See
47
+ // packages/mdx-render-vue/src/registry.ts for the wrapper implementation.
48
+ try {
49
+ const parsing = await import('@blogmcp/mdx-schema/composables/parsing')
50
+ parseJsxProps = parsing.parseJsxProps
51
+ stripFrontmatter = parsing.stripFrontmatter
52
+ HAS_MDX_RE = parsing.HAS_MDX_RE
53
+ MDX_COMPONENT_PATTERN = parsing.MDX_COMPONENT_PATTERN
54
+
55
+ const registry = await import('@blogmcp/mdx-render-vue/registry')
56
+ getWrappedRenderComponent = registry.getWrappedRenderComponent
57
+ registryHasComponent = (name: string) => name in registry.componentRegistry
58
+ } catch {
59
+ // Fallback: no MDX component support — render as pure markdown
60
+ parseJsxProps = () => ({})
61
+ stripFrontmatter = (c: string) => c.replace(/^---[\s\S]*?---\n?/, '')
62
+ HAS_MDX_RE = /<[A-Z]/
63
+ MDX_COMPONENT_PATTERN = /<([A-Z]\w+)([^>]*)>([\s\S]*?)<\/\1>|<([A-Z]\w+)([^>]*)\/>/
64
+ getWrappedRenderComponent = null
65
+ registryHasComponent = () => false
66
+ }
67
+
68
+ interface ParsedContent {
69
+ type: 'html' | 'component'
70
+ content?: string
71
+ name?: string
72
+ props?: Record<string, unknown>
73
+ children?: string
74
+ }
75
+
76
+ const props = defineProps<{
77
+ content: string
78
+ }>()
79
+
80
+ // Get image renderer from plugin or use default
81
+ const imageRenderer = inject<ImageHtmlRenderer>(KB_IMAGE_RENDERER_KEY, defaultImageHtml)
82
+
83
+ // Component lookup — defers to mdx-render-vue's wrapped getter which
84
+ // (a) caches per-(name, variant) for stable identity across re-renders
85
+ // and (b) bakes prepareProps into every invocation so SDK consumers
86
+ // don't need to know about the schema's deprecation entries.
87
+ function getComponent(name: string): Component | undefined {
88
+ if (!getWrappedRenderComponent) return undefined
89
+ if (!registryHasComponent(name)) return undefined
90
+ return getWrappedRenderComponent(name, 'default')
91
+ }
92
+
93
+ // Shared Marked instance via the SDK factory — keeps the image/link
94
+ // renderers, table wrap, and th-scope postprocess in lock-step with the
95
+ // other reference renderers (Nuxt blog MdxContent.vue, Next.js blog via
96
+ // mdx-render-react, md-editor BlogPreviewPanel.vue).
97
+ //
98
+ // We pass `sanitize: undefined` to the factory; the actual sanitization
99
+ // runs through `parseMarkdownSafe(source, marked, sanitizeHtml)` below.
100
+ // That path adds a source-pre-scan fast-path (skips DOMPurify for pure-
101
+ // markdown sources — typical 85-95% of our corpus). Setting `sanitize`
102
+ // here would run DOMPurify twice for ~10ms of wasted work per render.
103
+ const marked: Marked = createMarkedInstance({
104
+ imageRenderer,
105
+ // sanitize: undefined — parseMarkdownSafe applies it below
106
+ })
107
+
108
+ function renderHtml(source: string): string {
109
+ return parseMarkdownSafe(source, marked, sanitizeHtml)
110
+ }
111
+
112
+ const parsed = computed<{ mode: 'html' | 'mdx'; html: string; items: ParsedContent[] }>(() => {
113
+ if (!props.content) return { mode: 'html', html: '', items: [] }
114
+
115
+ const content = stripFrontmatter(props.content)
116
+
117
+ // Fast path: pure markdown
118
+ if (!HAS_MDX_RE.test(content)) {
119
+ return { mode: 'html', html: renderHtml(content), items: [] }
120
+ }
121
+
122
+ // MDX path
123
+ const componentRe = new RegExp(MDX_COMPONENT_PATTERN.source, 'g')
124
+ const items: ParsedContent[] = []
125
+ let lastIndex = 0
126
+ let match
127
+
128
+ while ((match = componentRe.exec(content)) !== null) {
129
+ if (match.index > lastIndex) {
130
+ const md = content.slice(lastIndex, match.index)
131
+ if (md.trim()) {
132
+ items.push({ type: 'html', content: renderHtml(md) })
133
+ }
134
+ }
135
+ const name = match[1] || match[4] || ''
136
+ const propsStr = match[1] ? (match[2] || '') : (match[5] || '')
137
+ const children = match[3]
138
+ const rawProps = parseJsxProps(propsStr)
139
+ // Normalize against the schema's deprecation entries BEFORE handing the
140
+ // props to the renderer. The bundled Vue registry's `getWrappedRenderComponent`
141
+ // also runs prepareProps, so this is a no-op there (idempotent), but
142
+ // custom-registered components OR consumers that skipped mdx-render-vue
143
+ // entirely still get a normalized props object. See Fix 2.
144
+ const meta = getComponentMetadata(name)
145
+ const normalizedProps = meta ? prepareProps(rawProps, meta) : rawProps
146
+ items.push({ type: 'component', name, props: normalizedProps, children: children?.trim() })
147
+ lastIndex = match.index + match[0].length
148
+ }
149
+
150
+ if (lastIndex < content.length) {
151
+ const remaining = content.slice(lastIndex)
152
+ if (remaining.trim()) {
153
+ items.push({ type: 'html', content: renderHtml(remaining) })
154
+ }
155
+ }
156
+
157
+ if (items.length === 0 && content.trim()) {
158
+ return { mode: 'html', html: renderHtml(content), items: [] }
159
+ }
160
+
161
+ return { mode: 'mdx', html: '', items }
162
+ })
163
+
164
+ function renderContent(items: ParsedContent[]): VNode[] {
165
+ return items.map((item, index) => {
166
+ if (item.type === 'html') {
167
+ return h('div', { key: index, innerHTML: item.content })
168
+ } else if (item.type === 'component') {
169
+ const Comp = getComponent(item.name!)
170
+ if (Comp) {
171
+ return h(Comp, { key: index, ...item.props }, () => item.children)
172
+ }
173
+ return h('div', {
174
+ key: index,
175
+ class: 'bg-yellow-50 border border-yellow-200 rounded-lg p-4 my-4 text-yellow-800',
176
+ innerHTML: `Unknown component: ${item.name}`,
177
+ })
178
+ }
179
+ return h('span', { key: index })
180
+ })
181
+ }
182
+
183
+ const renderedContent = computed(() => renderContent(parsed.value.items))
184
+ </script>
185
+
186
+ <template>
187
+ <div class="mdx-content">
188
+ <template v-if="parsed.mode === 'mdx'">
189
+ <component
190
+ v-for="(node, index) in renderedContent"
191
+ :key="index"
192
+ :is="node"
193
+ />
194
+ </template>
195
+ <div v-else v-html="parsed.html" />
196
+ </div>
197
+ </template>
198
+
199
+ <style scoped>
200
+ .mdx-content :deep(> div) {
201
+ /* Allow markdown content to flow naturally */
202
+ }
203
+ .mdx-content :deep(.broken-image) {
204
+ display: inline-block;
205
+ min-height: 4rem;
206
+ min-width: 8rem;
207
+ background: #f3f4f6;
208
+ border: 1px dashed #d1d5db;
209
+ border-radius: 0.5rem;
210
+ }
211
+ </style>
@@ -0,0 +1,78 @@
1
+ import { ref, type Ref } from 'vue'
2
+ import type { Article, ArticleWithTranslation } from '../../core/types'
3
+ import { useKbClient } from './useKbClient'
4
+
5
+ export interface ArticleListParams {
6
+ status?: string
7
+ limit?: number
8
+ offset?: number
9
+ }
10
+
11
+ export interface UseArticleListReturn {
12
+ articles: Ref<Article[]>
13
+ totalCount: Ref<number>
14
+ loading: Ref<boolean>
15
+ error: Ref<Error | null>
16
+ fetch: (params?: ArticleListParams) => Promise<void>
17
+ }
18
+
19
+ /**
20
+ * Reactive article list composable.
21
+ * Works in any Vue 3 app. For Nuxt SSR, use useAsyncArticleList from /nuxt.
22
+ */
23
+ export function useArticleList(initialParams?: ArticleListParams): UseArticleListReturn {
24
+ const client = useKbClient()
25
+ const articles = ref<Article[]>([])
26
+ const totalCount = ref(0)
27
+ const loading = ref(false)
28
+ const error = ref<Error | null>(null)
29
+
30
+ async function fetch(params?: ArticleListParams) {
31
+ loading.value = true
32
+ error.value = null
33
+ try {
34
+ const data = await client.articles.list(params ?? initialParams)
35
+ articles.value = data.accessibleKbArticles.articles
36
+ totalCount.value = data.accessibleKbArticles.totalCount
37
+ } catch (e) {
38
+ error.value = e instanceof Error ? e : new Error(String(e))
39
+ } finally {
40
+ loading.value = false
41
+ }
42
+ }
43
+
44
+ return { articles, totalCount, loading, error, fetch }
45
+ }
46
+
47
+ export interface UseArticleReturn {
48
+ article: Ref<ArticleWithTranslation | null>
49
+ loading: Ref<boolean>
50
+ error: Ref<Error | null>
51
+ fetch: (filename: string, languageCode: string) => Promise<void>
52
+ }
53
+
54
+ /**
55
+ * Reactive single article composable.
56
+ * For Nuxt SSR, use useAsyncArticle from /nuxt.
57
+ */
58
+ export function useArticle(): UseArticleReturn {
59
+ const client = useKbClient()
60
+ const article = ref<ArticleWithTranslation | null>(null)
61
+ const loading = ref(false)
62
+ const error = ref<Error | null>(null)
63
+
64
+ async function fetch(filename: string, languageCode: string) {
65
+ loading.value = true
66
+ error.value = null
67
+ try {
68
+ const data = await client.articles.getWithTranslation(filename, languageCode)
69
+ article.value = data.articleWithTranslation
70
+ } catch (e) {
71
+ error.value = e instanceof Error ? e : new Error(String(e))
72
+ } finally {
73
+ loading.value = false
74
+ }
75
+ }
76
+
77
+ return { article, loading, error, fetch }
78
+ }