@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,12 @@
1
+ import { inject } from 'vue'
2
+ import type { ImageHtmlRenderer } from '../../core/client-types'
3
+ import { defaultImageHtml } from '../../core/markdown'
4
+ import { KB_IMAGE_RENDERER_KEY } from '../plugin'
5
+
6
+ /**
7
+ * Inject the image HTML renderer provided by KbVue plugin.
8
+ * Falls back to plain <img> if none provided.
9
+ */
10
+ export function useImageRenderer(): ImageHtmlRenderer {
11
+ return inject(KB_IMAGE_RENDERER_KEY, defaultImageHtml)
12
+ }
@@ -0,0 +1,131 @@
1
+ import { ref, computed, inject, type Ref, type ComputedRef } from 'vue'
2
+ import type { AuthUser, AccessLevel, AuthResult, RegisterResult } from '../../core/types'
3
+ import type { AuthManager } from '../../core/auth'
4
+ import { KB_AUTH_KEY, KB_CLIENT_KEY } from '../plugin'
5
+
6
+ export interface UseKbAuthReturn {
7
+ user: Ref<AuthUser | null>
8
+ isAuthenticated: ComputedRef<boolean>
9
+ accessLevel: ComputedRef<AccessLevel>
10
+ hasAccess: (required: AccessLevel) => boolean
11
+ login: (token: string, user?: AuthUser) => void
12
+ logout: () => void
13
+ loginWithEmail: (email: string, password: string) => Promise<AuthResult>
14
+ register: (email: string, password: string, name?: string) => Promise<RegisterResult>
15
+ verifyEmail: (token: string) => Promise<{ success: boolean; error?: string }>
16
+ forgotPassword: (email: string) => Promise<RegisterResult>
17
+ resetPassword: (token: string, password: string) => Promise<{ success: boolean; error?: string }>
18
+ resendVerification: (email: string) => Promise<RegisterResult>
19
+ }
20
+
21
+ /**
22
+ * Vue composable wrapping the core AuthManager.
23
+ * Provides reactive auth state + mutation methods.
24
+ */
25
+ export function useKbAuth(): UseKbAuthReturn {
26
+ const authManager = inject(KB_AUTH_KEY) as AuthManager
27
+ const client = inject(KB_CLIENT_KEY)
28
+
29
+ if (!authManager) {
30
+ throw new Error('useKbAuth() requires KbVue plugin.')
31
+ }
32
+
33
+ // Reactive state — synced with auth manager
34
+ const user = ref<AuthUser | null>(authManager.getUser())
35
+
36
+ const isAuthenticated = computed(() => user.value !== null)
37
+ const accessLevel = computed<AccessLevel>(() => user.value?.accessLevel || 'public')
38
+
39
+ function hasAccess(required: AccessLevel): boolean {
40
+ return authManager.hasAccess(required)
41
+ }
42
+
43
+ function login(token: string, userData?: AuthUser) {
44
+ authManager.login(token, userData)
45
+ user.value = authManager.getUser()
46
+ }
47
+
48
+ function logout() {
49
+ authManager.logout()
50
+ user.value = null
51
+ }
52
+
53
+ async function loginWithEmail(email: string, password: string): Promise<AuthResult> {
54
+ if (!client) return { success: false, error: 'Client not available' }
55
+ try {
56
+ const data = await client.auth.login(email, password)
57
+ const result = data.login
58
+ if (result.success && result.token) {
59
+ login(result.token, result.user)
60
+ }
61
+ return result
62
+ } catch (e) {
63
+ return { success: false, error: e instanceof Error ? e.message : 'Login failed' }
64
+ }
65
+ }
66
+
67
+ async function register(email: string, password: string, name?: string): Promise<RegisterResult> {
68
+ if (!client) return { success: false, error: 'Client not available' }
69
+ try {
70
+ const data = await client.auth.register(email, password, name)
71
+ return data.register
72
+ } catch (e) {
73
+ return { success: false, error: e instanceof Error ? e.message : 'Registration failed' }
74
+ }
75
+ }
76
+
77
+ async function verifyEmail(token: string) {
78
+ if (!client) return { success: false, error: 'Client not available' }
79
+ try {
80
+ const data = await client.auth.verifyEmail(token)
81
+ return data.verifyEmail
82
+ } catch (e) {
83
+ return { success: false, error: e instanceof Error ? e.message : 'Verification failed' }
84
+ }
85
+ }
86
+
87
+ async function forgotPassword(email: string): Promise<RegisterResult> {
88
+ if (!client) return { success: false, error: 'Client not available' }
89
+ try {
90
+ const data = await client.auth.forgotPassword(email)
91
+ return data.forgotPassword
92
+ } catch (e) {
93
+ return { success: false, error: e instanceof Error ? e.message : 'Request failed' }
94
+ }
95
+ }
96
+
97
+ async function resetPassword(token: string, password: string) {
98
+ if (!client) return { success: false, error: 'Client not available' }
99
+ try {
100
+ const data = await client.auth.resetPassword(token, password)
101
+ return data.resetPassword
102
+ } catch (e) {
103
+ return { success: false, error: e instanceof Error ? e.message : 'Reset failed' }
104
+ }
105
+ }
106
+
107
+ async function resendVerification(email: string): Promise<RegisterResult> {
108
+ if (!client) return { success: false, error: 'Client not available' }
109
+ try {
110
+ const data = await client.auth.resendVerification(email)
111
+ return data.resendVerification
112
+ } catch (e) {
113
+ return { success: false, error: e instanceof Error ? e.message : 'Request failed' }
114
+ }
115
+ }
116
+
117
+ return {
118
+ user,
119
+ isAuthenticated,
120
+ accessLevel,
121
+ hasAccess,
122
+ login,
123
+ logout,
124
+ loginWithEmail,
125
+ register,
126
+ verifyEmail,
127
+ forgotPassword,
128
+ resetPassword,
129
+ resendVerification,
130
+ }
131
+ }
@@ -0,0 +1,17 @@
1
+ import { inject } from 'vue'
2
+ import type { KbClient } from '../../core/client'
3
+ import { KB_CLIENT_KEY } from '../plugin'
4
+
5
+ /**
6
+ * Inject the KbClient instance provided by KbVue plugin.
7
+ * Throws if called outside of a KbVue-provided context.
8
+ */
9
+ export function useKbClient(): KbClient {
10
+ const client = inject(KB_CLIENT_KEY)
11
+ if (!client) {
12
+ throw new Error(
13
+ 'useKbClient() requires KbVue plugin. Call app.use(KbVue, { endpoint: "..." }) first.',
14
+ )
15
+ }
16
+ return client
17
+ }
@@ -0,0 +1,281 @@
1
+ /**
2
+ * Comments composable with immutable tree operations.
3
+ *
4
+ * Ported from blog/app/composables/useComments.ts.
5
+ * Key difference: uses inject(KB_CLIENT_KEY) instead of direct executeGraphQL,
6
+ * and subscriptions are optional (provide via createSubscriptionClient).
7
+ */
8
+
9
+ import { ref, readonly, type Ref, type DeepReadonly } from 'vue'
10
+ import type { Comment, CommentsConnection, CommentResult, CommentSubscriptionEvent } from '../../core/types'
11
+ import { useKbClient } from './useKbClient'
12
+ import { useKbAuth } from './useKbAuth'
13
+
14
+ export interface UseKbCommentsReturn {
15
+ comments: DeepReadonly<Ref<Comment[]>>
16
+ totalCount: DeepReadonly<Ref<number>>
17
+ loading: DeepReadonly<Ref<boolean>>
18
+ error: DeepReadonly<Ref<string | null>>
19
+ currentArticleId: DeepReadonly<Ref<string | null>>
20
+ draftContent: Ref<string>
21
+ replyingTo: Ref<string | null>
22
+ editingId: Ref<string | null>
23
+ editContent: Ref<string>
24
+ fetchComments: (articleId: string, languageCode: string) => Promise<void>
25
+ createComment: (content: string, languageCode: string, parentCommentId?: string) => Promise<CommentResult>
26
+ updateComment: (commentId: string, content: string) => Promise<CommentResult>
27
+ deleteComment: (commentId: string) => Promise<CommentResult>
28
+ startReply: (commentId: string) => void
29
+ cancelReply: () => void
30
+ startEdit: (comment: Comment) => void
31
+ cancelEdit: () => void
32
+ isOwnComment: (comment: Comment) => boolean
33
+ handleCommentEvent: (event: { type: string; comment: Comment | { id: string } }) => void
34
+ clearState: () => void
35
+ }
36
+
37
+ export function useKbComments(): UseKbCommentsReturn {
38
+ const client = useKbClient()
39
+ const { user, isAuthenticated } = useKbAuth()
40
+
41
+ const comments = ref<Comment[]>([])
42
+ const totalCount = ref(0)
43
+ const loading = ref(false)
44
+ const error = ref<string | null>(null)
45
+ const currentArticleId = ref<string | null>(null)
46
+ const draftContent = ref('')
47
+ const replyingTo = ref<string | null>(null)
48
+ const editingId = ref<string | null>(null)
49
+ const editContent = ref('')
50
+
51
+ async function fetchComments(articleId: string, languageCode: string) {
52
+ if (!articleId) return
53
+ loading.value = true
54
+ error.value = null
55
+ currentArticleId.value = articleId
56
+ try {
57
+ const data = await client.comments.list(articleId, languageCode)
58
+ comments.value = data.articleComments.comments || []
59
+ totalCount.value = data.articleComments.totalCount || 0
60
+ } catch (e) {
61
+ error.value = e instanceof Error ? e.message : 'Failed to load comments'
62
+ comments.value = []
63
+ totalCount.value = 0
64
+ } finally {
65
+ loading.value = false
66
+ }
67
+ }
68
+
69
+ async function createComment(
70
+ content: string,
71
+ languageCode: string,
72
+ parentCommentId?: string,
73
+ ): Promise<CommentResult> {
74
+ if (!currentArticleId.value) {
75
+ return { success: false, comment: null, error: 'No article selected' }
76
+ }
77
+ if (!isAuthenticated.value) {
78
+ return { success: false, comment: null, error: 'Authentication required' }
79
+ }
80
+ try {
81
+ const data = await client.comments.create({
82
+ articleId: currentArticleId.value,
83
+ content,
84
+ sourceLanguageCode: languageCode,
85
+ parentCommentId,
86
+ })
87
+ const result = data.createComment
88
+ if (result.success && result.comment) {
89
+ if (parentCommentId) {
90
+ comments.value = addReplyToTree(comments.value, parentCommentId, result.comment)
91
+ } else {
92
+ comments.value = [...comments.value, result.comment]
93
+ }
94
+ totalCount.value++
95
+ draftContent.value = ''
96
+ replyingTo.value = null
97
+ }
98
+ return result
99
+ } catch (e) {
100
+ return { success: false, comment: null, error: e instanceof Error ? e.message : 'Failed to create comment' }
101
+ }
102
+ }
103
+
104
+ async function updateComment(commentId: string, content: string): Promise<CommentResult> {
105
+ if (!isAuthenticated.value) {
106
+ return { success: false, comment: null, error: 'Authentication required' }
107
+ }
108
+ try {
109
+ const data = await client.comments.update(commentId, content)
110
+ const result = data.updateComment
111
+ if (result.success && result.comment) {
112
+ comments.value = updateCommentInTree(comments.value, commentId, result.comment)
113
+ editingId.value = null
114
+ editContent.value = ''
115
+ }
116
+ return result
117
+ } catch (e) {
118
+ return { success: false, comment: null, error: e instanceof Error ? e.message : 'Failed to update comment' }
119
+ }
120
+ }
121
+
122
+ async function deleteComment(commentId: string): Promise<CommentResult> {
123
+ if (!isAuthenticated.value) {
124
+ return { success: false, comment: null, error: 'Authentication required' }
125
+ }
126
+ try {
127
+ const data = await client.comments.delete(commentId)
128
+ const result = data.deleteComment
129
+ if (result.success) {
130
+ comments.value = removeCommentFromTree(comments.value, commentId)
131
+ totalCount.value = Math.max(0, totalCount.value - 1)
132
+ }
133
+ return result
134
+ } catch (e) {
135
+ return { success: false, comment: null, error: e instanceof Error ? e.message : 'Failed to delete comment' }
136
+ }
137
+ }
138
+
139
+ function startReply(commentId: string) {
140
+ replyingTo.value = commentId
141
+ editingId.value = null
142
+ editContent.value = ''
143
+ }
144
+
145
+ function cancelReply() {
146
+ replyingTo.value = null
147
+ draftContent.value = ''
148
+ }
149
+
150
+ function startEdit(comment: Comment) {
151
+ if (comment.userId !== user.value?.id) return
152
+ editingId.value = comment.id
153
+ editContent.value = comment.displayContent
154
+ replyingTo.value = null
155
+ }
156
+
157
+ function cancelEdit() {
158
+ editingId.value = null
159
+ editContent.value = ''
160
+ }
161
+
162
+ function isOwnComment(comment: Comment): boolean {
163
+ return isAuthenticated.value && comment.userId === user.value?.id
164
+ }
165
+
166
+ function clearState() {
167
+ comments.value = []
168
+ totalCount.value = 0
169
+ loading.value = false
170
+ error.value = null
171
+ currentArticleId.value = null
172
+ draftContent.value = ''
173
+ replyingTo.value = null
174
+ editingId.value = null
175
+ editContent.value = ''
176
+ }
177
+
178
+ // ==================== Tree Helpers (Immutable) ====================
179
+
180
+ function addReplyToTree(tree: Comment[], parentId: string, newComment: Comment): Comment[] {
181
+ return tree.map((comment) => {
182
+ if (comment.id === parentId) {
183
+ return { ...comment, replies: [...(comment.replies || []), newComment] }
184
+ }
185
+ if (comment.replies?.length) {
186
+ const updatedReplies = addReplyToTree(comment.replies, parentId, newComment)
187
+ if (updatedReplies !== comment.replies) {
188
+ return { ...comment, replies: updatedReplies }
189
+ }
190
+ }
191
+ return comment
192
+ })
193
+ }
194
+
195
+ function updateCommentInTree(tree: Comment[], commentId: string, updated: Comment): Comment[] {
196
+ return tree.map((comment) => {
197
+ if (comment.id === commentId) {
198
+ return { ...updated, replies: comment.replies }
199
+ }
200
+ if (comment.replies?.length) {
201
+ const updatedReplies = updateCommentInTree(comment.replies, commentId, updated)
202
+ if (updatedReplies !== comment.replies) {
203
+ return { ...comment, replies: updatedReplies }
204
+ }
205
+ }
206
+ return comment
207
+ })
208
+ }
209
+
210
+ function removeCommentFromTree(tree: Comment[], commentId: string): Comment[] {
211
+ const result: Comment[] = []
212
+ for (const comment of tree) {
213
+ if (comment.id === commentId) continue
214
+ if (comment.replies?.length) {
215
+ const updatedReplies = removeCommentFromTree(comment.replies, commentId)
216
+ if (updatedReplies.length !== comment.replies.length) {
217
+ result.push({ ...comment, replies: updatedReplies })
218
+ continue
219
+ }
220
+ }
221
+ result.push(comment)
222
+ }
223
+ return result
224
+ }
225
+
226
+ function commentExistsInTree(tree: Comment[], commentId: string): boolean {
227
+ for (const comment of tree) {
228
+ if (comment.id === commentId) return true
229
+ if (comment.replies?.length && commentExistsInTree(comment.replies, commentId)) return true
230
+ }
231
+ return false
232
+ }
233
+
234
+ function handleCommentEvent(event: { type: string; comment: Comment | { id: string } }) {
235
+ if (!event.comment?.id) return
236
+ switch (event.type) {
237
+ case 'created':
238
+ if (!('displayContent' in event.comment)) return
239
+ if (commentExistsInTree(comments.value, event.comment.id)) return
240
+ if (event.comment.parentCommentId) {
241
+ comments.value = addReplyToTree(comments.value, event.comment.parentCommentId, event.comment)
242
+ } else {
243
+ comments.value = [...comments.value, event.comment]
244
+ totalCount.value++
245
+ }
246
+ break
247
+ case 'updated':
248
+ case 'translated':
249
+ if (!('displayContent' in event.comment)) return
250
+ comments.value = updateCommentInTree(comments.value, event.comment.id, event.comment)
251
+ break
252
+ case 'deleted':
253
+ comments.value = removeCommentFromTree(comments.value, event.comment.id)
254
+ totalCount.value = Math.max(0, totalCount.value - 1)
255
+ break
256
+ }
257
+ }
258
+
259
+ return {
260
+ comments: readonly(comments),
261
+ totalCount: readonly(totalCount),
262
+ loading: readonly(loading),
263
+ error: readonly(error),
264
+ currentArticleId: readonly(currentArticleId),
265
+ draftContent,
266
+ replyingTo,
267
+ editingId,
268
+ editContent,
269
+ fetchComments,
270
+ createComment,
271
+ updateComment,
272
+ deleteComment,
273
+ startReply,
274
+ cancelReply,
275
+ startEdit,
276
+ cancelEdit,
277
+ isOwnComment,
278
+ handleCommentEvent,
279
+ clearState,
280
+ }
281
+ }
@@ -0,0 +1,11 @@
1
+ import { inject } from 'vue'
2
+ import type { TranslateFn } from '../../core/i18n'
3
+ import { KB_I18N_KEY } from '../plugin'
4
+
5
+ /**
6
+ * Inject the translation function provided by KbVue plugin.
7
+ * Falls back to returning the key as-is if no i18n is provided.
8
+ */
9
+ export function useKbI18n(): TranslateFn {
10
+ return inject(KB_I18N_KEY, (key: string) => key)
11
+ }
@@ -0,0 +1,103 @@
1
+ import { ref, computed, type Ref, type ComputedRef } from 'vue'
2
+ import type { Language, LocalizedTag } from '../../core/types'
3
+ import { retryWithBackoff } from '../../core/retry'
4
+ import { useKbClient } from './useKbClient'
5
+
6
+ const DEFAULT_LANGUAGES: Language[] = [
7
+ { id: '1', code: 'cs', name: 'Czech', nativeName: 'Čeština', isSource: true, isEnabled: true, sortOrder: 0 },
8
+ { id: '2', code: 'en', name: 'English', nativeName: 'English', isSource: false, isEnabled: true, sortOrder: 1 },
9
+ ]
10
+
11
+ export interface UseKbLanguageReturn {
12
+ currentLanguage: Ref<string>
13
+ languages: Ref<Language[]>
14
+ languagesLoaded: Ref<boolean>
15
+ sourceLanguage: ComputedRef<Language | null>
16
+ targetLanguages: ComputedRef<Language[]>
17
+ currentLanguageName: ComputedRef<string>
18
+ isSourceLanguage: ComputedRef<boolean>
19
+ loadLanguages: () => Promise<void>
20
+ setLanguage: (code: string) => void
21
+ getLanguage: (code: string) => Language | undefined
22
+ fetchLocalizedTags: () => Promise<LocalizedTag[]>
23
+ }
24
+
25
+ /**
26
+ * Language management composable.
27
+ *
28
+ * Framework-agnostic — doesn't depend on Nuxt's useRoute or useCookie.
29
+ * Consumers set the initial language and call setLanguage() for changes.
30
+ */
31
+ export function useKbLanguage(initialLocale = 'cs'): UseKbLanguageReturn {
32
+ const client = useKbClient()
33
+
34
+ const currentLanguage = ref(initialLocale)
35
+ const languages = ref<Language[]>([...DEFAULT_LANGUAGES])
36
+ const languagesLoaded = ref(false)
37
+
38
+ const sourceLanguage = computed(() =>
39
+ languages.value.find((l) => l.isSource) || null,
40
+ )
41
+
42
+ const targetLanguages = computed(() =>
43
+ languages.value.filter((l) => !l.isSource),
44
+ )
45
+
46
+ const currentLanguageName = computed(() => {
47
+ const lang = languages.value.find((l) => l.code === currentLanguage.value)
48
+ return lang?.nativeName || lang?.name || currentLanguage.value
49
+ })
50
+
51
+ const isSourceLanguage = computed(() =>
52
+ sourceLanguage.value?.code === currentLanguage.value,
53
+ )
54
+
55
+ function getLanguage(code: string): Language | undefined {
56
+ return languages.value.find((l) => l.code === code)
57
+ }
58
+
59
+ function setLanguage(code: string) {
60
+ currentLanguage.value = code
61
+ }
62
+
63
+ async function loadLanguages() {
64
+ if (languagesLoaded.value) return
65
+ try {
66
+ const data = await retryWithBackoff(
67
+ () => client.languages.list(),
68
+ { retries: 3, initialDelay: 500 },
69
+ )
70
+ languages.value = data.kbLanguages || []
71
+ languagesLoaded.value = true
72
+ } catch {
73
+ // Fallback to defaults
74
+ languages.value = [...DEFAULT_LANGUAGES]
75
+ }
76
+ }
77
+
78
+ async function fetchLocalizedTags(): Promise<LocalizedTag[]> {
79
+ try {
80
+ const data = await retryWithBackoff(
81
+ () => client.tags.listLocalized(currentLanguage.value),
82
+ { retries: 3, initialDelay: 500 },
83
+ )
84
+ return data.localizedTags || []
85
+ } catch {
86
+ return []
87
+ }
88
+ }
89
+
90
+ return {
91
+ currentLanguage,
92
+ languages,
93
+ languagesLoaded,
94
+ sourceLanguage,
95
+ targetLanguages,
96
+ currentLanguageName,
97
+ isSourceLanguage,
98
+ loadLanguages,
99
+ setLanguage,
100
+ getLanguage,
101
+ fetchLocalizedTags,
102
+ }
103
+ }
@@ -0,0 +1,38 @@
1
+ import { ref, type Ref } from 'vue'
2
+ import type { NavNode } from '../../core/navigation'
3
+ import { useKbClient } from './useKbClient'
4
+
5
+ export interface UseNavigationReturn {
6
+ /** The resolved, localized menu tree. */
7
+ tree: Ref<NavNode[]>
8
+ loading: Ref<boolean>
9
+ error: Ref<Error | null>
10
+ fetch: (params?: { scope?: string; locale?: string }) => Promise<void>
11
+ }
12
+
13
+ /**
14
+ * Fetch the resolved navigation menu (the server does auto-build + override
15
+ * merge + access filtering + localization; the SDK just consumes the tree).
16
+ * Pair with the traversal helpers from `@blogmcp/sdk` (navBreadcrumbs, …).
17
+ */
18
+ export function useNavigation(): UseNavigationReturn {
19
+ const client = useKbClient()
20
+ const tree = ref<NavNode[]>([])
21
+ const loading = ref(false)
22
+ const error = ref<Error | null>(null)
23
+
24
+ async function fetch(params?: { scope?: string; locale?: string }) {
25
+ loading.value = true
26
+ error.value = null
27
+ try {
28
+ const data = await client.navigation.get(params)
29
+ tree.value = data.kbNavigation ?? []
30
+ } catch (e) {
31
+ error.value = e instanceof Error ? e : new Error(String(e))
32
+ } finally {
33
+ loading.value = false
34
+ }
35
+ }
36
+
37
+ return { tree, loading, error, fetch }
38
+ }
@@ -0,0 +1,52 @@
1
+ import { ref, type Ref } from 'vue'
2
+ import type { SearchResult } from '../../core/types'
3
+ import { useKbClient } from './useKbClient'
4
+
5
+ export type SearchMode = 'SEMANTIC' | 'KEYWORD' | 'HYBRID'
6
+
7
+ export interface UseKbSearchReturn {
8
+ results: Ref<SearchResult[]>
9
+ loading: Ref<boolean>
10
+ error: Ref<Error | null>
11
+ search: (params: {
12
+ query: string
13
+ tags?: string[]
14
+ contentType?: string
15
+ limit?: number
16
+ minSimilarity?: number
17
+ searchMode?: SearchMode
18
+ }) => Promise<void>
19
+ }
20
+
21
+ /**
22
+ * Reactive search composable.
23
+ * Supports hybrid search (vector + BM25) via searchMode parameter.
24
+ */
25
+ export function useKbSearch(): UseKbSearchReturn {
26
+ const client = useKbClient()
27
+ const results = ref<SearchResult[]>([])
28
+ const loading = ref(false)
29
+ const error = ref<Error | null>(null)
30
+
31
+ async function search(params: {
32
+ query: string
33
+ tags?: string[]
34
+ contentType?: string
35
+ limit?: number
36
+ minSimilarity?: number
37
+ searchMode?: SearchMode
38
+ }) {
39
+ loading.value = true
40
+ error.value = null
41
+ try {
42
+ const data = await client.search.query(params)
43
+ results.value = data.searchKnowledgeBase
44
+ } catch (e) {
45
+ error.value = e instanceof Error ? e : new Error(String(e))
46
+ } finally {
47
+ loading.value = false
48
+ }
49
+ }
50
+
51
+ return { results, loading, error, search }
52
+ }