@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.
- package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/_virtual/constants.js +4 -0
- package/dist/_virtual/index.js +2 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/index3.js +2 -0
- package/dist/_virtual/re.js +4 -0
- package/dist/core/article-seo.d.ts +27 -0
- package/dist/core/article-seo.js +25 -0
- package/dist/core/auth.d.ts +34 -0
- package/dist/core/auth.js +89 -0
- package/dist/core/blog-config.d.ts +5 -0
- package/dist/core/blog-config.js +14 -0
- package/dist/core/client-types.d.ts +51 -0
- package/dist/core/client.d.ts +159 -0
- package/dist/core/client.js +82 -0
- package/dist/core/i18n.d.ts +29 -0
- package/dist/core/i18n.js +34 -0
- package/dist/core/index.d.ts +26 -0
- package/dist/core/index.js +67 -0
- package/dist/core/markdown.d.ts +69 -0
- package/dist/core/markdown.js +47 -0
- package/dist/core/navigation.d.ts +70 -0
- package/dist/core/navigation.js +71 -0
- package/dist/core/queries.d.ts +34 -0
- package/dist/core/queries.js +363 -0
- package/dist/core/retry.d.ts +9 -0
- package/dist/core/retry.js +14 -0
- package/dist/core/seo.d.ts +142 -0
- package/dist/core/seo.js +166 -0
- package/dist/core/theme.d.ts +41 -0
- package/dist/core/theme.js +60 -0
- package/dist/core/translations/cs.json.js +27 -0
- package/dist/core/translations/en.json.js +27 -0
- package/dist/core/types.d.ts +184 -0
- package/dist/core/types.js +9 -0
- package/dist/core/view-model.d.ts +53 -0
- package/dist/core/view-model.js +47 -0
- package/dist/node_modules/@braintree/sanitize-url/dist/constants.js +8 -0
- package/dist/node_modules/@braintree/sanitize-url/dist/index.js +60 -0
- package/dist/node_modules/dompurify/dist/purify.es.js +662 -0
- package/dist/node_modules/semver/classes/comparator.js +56 -0
- package/dist/node_modules/semver/classes/range.js +148 -0
- package/dist/node_modules/semver/classes/semver.js +169 -0
- package/dist/node_modules/semver/functions/clean.js +14 -0
- package/dist/node_modules/semver/functions/cmp.js +39 -0
- package/dist/node_modules/semver/functions/coerce.js +33 -0
- package/dist/node_modules/semver/functions/compare-build.js +14 -0
- package/dist/node_modules/semver/functions/compare-loose.js +11 -0
- package/dist/node_modules/semver/functions/compare.js +11 -0
- package/dist/node_modules/semver/functions/diff.js +24 -0
- package/dist/node_modules/semver/functions/eq.js +11 -0
- package/dist/node_modules/semver/functions/gt.js +11 -0
- package/dist/node_modules/semver/functions/gte.js +11 -0
- package/dist/node_modules/semver/functions/inc.js +21 -0
- package/dist/node_modules/semver/functions/lt.js +11 -0
- package/dist/node_modules/semver/functions/lte.js +11 -0
- package/dist/node_modules/semver/functions/major.js +11 -0
- package/dist/node_modules/semver/functions/minor.js +11 -0
- package/dist/node_modules/semver/functions/neq.js +11 -0
- package/dist/node_modules/semver/functions/parse.js +21 -0
- package/dist/node_modules/semver/functions/patch.js +11 -0
- package/dist/node_modules/semver/functions/prerelease.js +14 -0
- package/dist/node_modules/semver/functions/rcompare.js +11 -0
- package/dist/node_modules/semver/functions/rsort.js +11 -0
- package/dist/node_modules/semver/functions/satisfies.js +18 -0
- package/dist/node_modules/semver/functions/sort.js +11 -0
- package/dist/node_modules/semver/functions/valid.js +14 -0
- package/dist/node_modules/semver/index.js +97 -0
- package/dist/node_modules/semver/internal/constants.js +28 -0
- package/dist/node_modules/semver/internal/debug.js +8 -0
- package/dist/node_modules/semver/internal/identifiers.js +18 -0
- package/dist/node_modules/semver/internal/lrucache.js +32 -0
- package/dist/node_modules/semver/internal/parse-options.js +10 -0
- package/dist/node_modules/semver/internal/re.js +32 -0
- package/dist/node_modules/semver/ranges/gtr.js +11 -0
- package/dist/node_modules/semver/ranges/intersects.js +11 -0
- package/dist/node_modules/semver/ranges/ltr.js +11 -0
- package/dist/node_modules/semver/ranges/max-satisfying.js +22 -0
- package/dist/node_modules/semver/ranges/min-satisfying.js +22 -0
- package/dist/node_modules/semver/ranges/min-version.js +42 -0
- package/dist/node_modules/semver/ranges/outside.js +44 -0
- package/dist/node_modules/semver/ranges/simplify.js +24 -0
- package/dist/node_modules/semver/ranges/subset.js +94 -0
- package/dist/node_modules/semver/ranges/to-comparators.js +11 -0
- package/dist/node_modules/semver/ranges/valid.js +17 -0
- package/dist/nuxt/composables/useAsyncKb.d.ts +32 -0
- package/dist/nuxt/composables/useAsyncKb.js +34 -0
- package/dist/nuxt/index.d.ts +1 -0
- package/dist/nuxt/index.js +6 -0
- package/dist/packages/mdx-render-vue/dist/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/packages/mdx-render-vue/dist/_virtual/constants.js +4 -0
- package/dist/packages/mdx-render-vue/dist/_virtual/index.js +5 -0
- package/dist/packages/mdx-render-vue/dist/_virtual/index2.js +4 -0
- package/dist/packages/mdx-render-vue/dist/composables/useAudioPlayer.js +40 -0
- package/dist/packages/mdx-render-vue/dist/composables/useCallout.js +66 -0
- package/dist/packages/mdx-render-vue/dist/composables/useCodeBlock.js +62 -0
- package/dist/packages/mdx-render-vue/dist/composables/useGallery.js +68 -0
- package/dist/packages/mdx-render-vue/dist/composables/useMedia.js +9 -0
- package/dist/packages/mdx-render-vue/dist/composables/useYouTube.js +24 -0
- package/dist/packages/mdx-render-vue/dist/edit/AlertEdit.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/edit/AlertEdit.vue2.js +16 -0
- package/dist/packages/mdx-render-vue/dist/edit/AudioPlayerEdit.vue.js +102 -0
- package/dist/packages/mdx-render-vue/dist/edit/AudioPlayerEdit.vue2.js +4 -0
- package/dist/packages/mdx-render-vue/dist/edit/BadgeEdit.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/edit/BadgeEdit.vue2.js +11 -0
- package/dist/packages/mdx-render-vue/dist/edit/ButtonEdit.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/edit/ButtonEdit.vue2.js +11 -0
- package/dist/packages/mdx-render-vue/dist/edit/CalloutEdit.vue.js +78 -0
- package/dist/packages/mdx-render-vue/dist/edit/CalloutEdit.vue2.js +4 -0
- package/dist/packages/mdx-render-vue/dist/edit/CardEdit.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/edit/CardEdit.vue2.js +16 -0
- package/dist/packages/mdx-render-vue/dist/edit/CodeBlockEdit.vue.js +6 -0
- package/dist/packages/mdx-render-vue/dist/edit/CodeBlockEdit.vue2.js +74 -0
- package/dist/packages/mdx-render-vue/dist/edit/GalleryEdit.vue.js +56 -0
- package/dist/packages/mdx-render-vue/dist/edit/GalleryEdit.vue2.js +4 -0
- package/dist/packages/mdx-render-vue/dist/edit/IconEdit.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/edit/IconEdit.vue2.js +11 -0
- package/dist/packages/mdx-render-vue/dist/edit/TooltipEdit.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/edit/TooltipEdit.vue2.js +20 -0
- package/dist/packages/mdx-render-vue/dist/edit/YouTubeEdit.vue.js +34 -0
- package/dist/packages/mdx-render-vue/dist/edit/YouTubeEdit.vue2.js +4 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/_virtual/_rolldown/runtime.js +11 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/factory.js +29 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/presence/use-presence-context.js +6 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/presence/use-presence.js +32 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow-tip.js +5 -0
- 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
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow.js +5 -0
- 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
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-content.js +5 -0
- 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
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-context.js +5 -0
- 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
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-positioner.js +5 -0
- 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
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root-provider.js +5 -0
- 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
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root.js +5 -0
- 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
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-trigger.js +5 -0
- 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
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip.js +22 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/use-tooltip-context.js +6 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/components/tooltip/use-tooltip.js +29 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/providers/environment/use-environment-context.js +12 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/providers/locale/use-locale-context.js +11 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/clean-props.js +8 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/create-context.js +12 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/dynamic.js +25 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/unref-element.js +8 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/use-forward-expose.js +36 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@ark-ui/vue/dist/utils/use-render-strategy.js +5 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@braintree/sanitize-url/dist/constants.js +8 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@braintree/sanitize-url/dist/index.js +60 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +532 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +403 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +128 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@iconify/vue/dist/iconify.js +1192 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/anatomy/dist/create-anatomy.js +26 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/core/dist/create-machine.js +21 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/core/dist/merge-props.js +45 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/core/dist/scope.js +16 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/core/dist/state.js +136 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/core/dist/types.js +5 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/chunk-QZ7TP4HQ.js +4 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/computed-style.js +8 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/event.js +31 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/node.js +49 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/overflow.js +19 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/platform.js +16 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/query.js +6 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/raf.js +41 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/set.js +14 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/dom-query/dist/shared.js +7 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/focus-visible/dist/index.js +90 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/popper/dist/get-anchor.js +34 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/popper/dist/get-placement.js +187 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/popper/dist/get-styles.js +47 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/popper/dist/middleware.js +56 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/popper/dist/placement.js +7 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/presence/dist/presence.connect.js +16 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/presence/dist/presence.machine.js +147 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/tooltip/dist/tooltip.anatomy.js +6 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/tooltip/dist/tooltip.connect.js +119 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/tooltip/dist/tooltip.dom.js +15 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/tooltip/dist/tooltip.machine.js +375 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/tooltip/dist/tooltip.store.js +9 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/types/dist/prop-types.js +10 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/array.js +6 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/equal.js +27 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/functions.js +10 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/guard.js +15 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/object.js +13 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/store.js +25 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/utils/dist/warning.js +25 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/vue/dist/bindable.js +37 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/vue/dist/machine.js +205 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/vue/dist/normalize-props.js +30 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/vue/dist/refs.js +14 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/@zag-js/vue/dist/track.js +19 -0
- package/dist/packages/mdx-render-vue/dist/node_modules/dompurify/dist/purify.es.js +659 -0
- package/dist/packages/mdx-render-vue/dist/registry.js +154 -0
- package/dist/packages/mdx-render-vue/dist/render/alert/Alert.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/render/alert/Alert.vue2.js +37 -0
- package/dist/packages/mdx-render-vue/dist/render/audioplayer/AudioPlayerDefault.vue.js +102 -0
- package/dist/packages/mdx-render-vue/dist/render/audioplayer/AudioPlayerDefault.vue2.js +4 -0
- package/dist/packages/mdx-render-vue/dist/render/badge/Badge.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/render/badge/Badge.vue2.js +25 -0
- package/dist/packages/mdx-render-vue/dist/render/button/Button.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/render/button/Button.vue2.js +37 -0
- package/dist/packages/mdx-render-vue/dist/render/callout/CalloutDefault.vue.js +79 -0
- package/dist/packages/mdx-render-vue/dist/render/callout/CalloutDefault.vue2.js +4 -0
- package/dist/packages/mdx-render-vue/dist/render/callout/CalloutMinimal.vue.js +22 -0
- package/dist/packages/mdx-render-vue/dist/render/callout/CalloutMinimal.vue2.js +4 -0
- package/dist/packages/mdx-render-vue/dist/render/card/Card.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/render/card/Card.vue2.js +24 -0
- package/dist/packages/mdx-render-vue/dist/render/codeblock/CodeBlockDefault.vue.js +6 -0
- package/dist/packages/mdx-render-vue/dist/render/codeblock/CodeBlockDefault.vue2.js +77 -0
- package/dist/packages/mdx-render-vue/dist/render/gallery/GalleryGrid.vue.js +103 -0
- package/dist/packages/mdx-render-vue/dist/render/gallery/GalleryGrid.vue2.js +4 -0
- package/dist/packages/mdx-render-vue/dist/render/gallery/GalleryLightbox.vue.js +6 -0
- package/dist/packages/mdx-render-vue/dist/render/gallery/GalleryLightbox.vue2.js +142 -0
- package/dist/packages/mdx-render-vue/dist/render/icon/Icon.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/render/icon/Icon.vue2.js +23 -0
- package/dist/packages/mdx-render-vue/dist/render/tooltip/Tooltip.vue.js +4 -0
- package/dist/packages/mdx-render-vue/dist/render/tooltip/Tooltip.vue2.js +54 -0
- package/dist/packages/mdx-render-vue/dist/render/youtube/YouTubeDefault.vue.js +69 -0
- package/dist/packages/mdx-render-vue/dist/render/youtube/YouTubeDefault.vue2.js +4 -0
- package/dist/packages/mdx-schema/dist/composables/useMdxParsing.js +139 -0
- package/dist/packages/mdx-schema/dist/metadata/index.js +415 -0
- package/dist/packages/mdx-schema/dist/prepareProps.js +46 -0
- package/dist/packages/mdx-schema/dist/styles/index.js +119 -0
- package/dist/packages/mdx-schema/dist/types/index.js +26 -0
- package/dist/packages/sanitize/dist/html.js +41 -0
- package/dist/react/KbMdxContent.d.ts +35 -0
- package/dist/react/KbMdxContent.js +102 -0
- package/dist/react/context.d.ts +11 -0
- package/dist/react/context.js +5 -0
- package/dist/react/hooks/useImageRenderer.d.ts +6 -0
- package/dist/react/hooks/useImageRenderer.js +9 -0
- package/dist/react/hooks/useKbClient.d.ts +3 -0
- package/dist/react/hooks/useKbClient.js +7 -0
- package/dist/react/hooks/useKbContext.d.ts +3 -0
- package/dist/react/hooks/useKbContext.js +11 -0
- package/dist/react/hooks/useKbI18n.d.ts +7 -0
- package/dist/react/hooks/useKbI18n.js +8 -0
- package/dist/react/hooks/useKbLanguage.d.ts +21 -0
- package/dist/react/hooks/useKbLanguage.js +63 -0
- package/dist/react/hooks/useKbSearch.d.ts +20 -0
- package/dist/react/hooks/useKbSearch.js +22 -0
- package/dist/react/hooks/useMdxContent.d.ts +18 -0
- package/dist/react/hooks/useMdxContent.js +11 -0
- package/dist/react/index.d.ts +21 -0
- package/dist/react/index.js +20 -0
- package/dist/react/provider.d.ts +25 -0
- package/dist/react/provider.js +29 -0
- package/dist/react/server/index.d.ts +38 -0
- package/dist/react/server/index.js +26 -0
- package/dist/sdk.css +1 -0
- package/dist/vue/components/KbAccessGate.vue.d.ts +36 -0
- package/dist/vue/components/KbAccessGate.vue.js +74 -0
- package/dist/vue/components/KbAccessGate.vue2.js +4 -0
- package/dist/vue/components/KbArticleCard.vue.d.ts +34 -0
- package/dist/vue/components/KbArticleCard.vue.js +87 -0
- package/dist/vue/components/KbArticleCard.vue2.js +4 -0
- package/dist/vue/components/KbMdxContent.vue.d.ts +5 -0
- package/dist/vue/components/KbMdxContent.vue.js +7 -0
- package/dist/vue/components/KbMdxContent.vue2.js +82 -0
- package/dist/vue/composables/useArticles.d.ts +30 -0
- package/dist/vue/composables/useArticles.js +36 -0
- package/dist/vue/composables/useImageRenderer.d.ts +6 -0
- package/dist/vue/composables/useImageRenderer.js +9 -0
- package/dist/vue/composables/useKbAuth.d.ts +27 -0
- package/dist/vue/composables/useKbAuth.js +83 -0
- package/dist/vue/composables/useKbClient.d.ts +6 -0
- package/dist/vue/composables/useKbClient.js +13 -0
- package/dist/vue/composables/useKbComments.d.ts +37 -0
- package/dist/vue/composables/useKbComments.js +160 -0
- package/dist/vue/composables/useKbI18n.d.ts +6 -0
- package/dist/vue/composables/useKbI18n.js +8 -0
- package/dist/vue/composables/useKbLanguage.d.ts +22 -0
- package/dist/vue/composables/useKbLanguage.js +63 -0
- package/dist/vue/composables/useNavigation.d.ts +18 -0
- package/dist/vue/composables/useNavigation.js +20 -0
- package/dist/vue/composables/useSearch.d.ts +21 -0
- package/dist/vue/composables/useSearch.js +20 -0
- package/dist/vue/composables/useTags.d.ts +17 -0
- package/dist/vue/composables/useTags.js +36 -0
- package/dist/vue/index.d.ts +22 -0
- package/dist/vue/index.js +36 -0
- package/dist/vue/plugin.d.ts +30 -0
- package/dist/vue/plugin.js +17 -0
- package/package.json +97 -0
- package/src/core/article-seo.ts +101 -0
- package/src/core/auth.ts +138 -0
- package/src/core/blog-config.ts +30 -0
- package/src/core/client-types.ts +58 -0
- package/src/core/client.ts +287 -0
- package/src/core/i18n.ts +84 -0
- package/src/core/index.ts +147 -0
- package/src/core/markdown.ts +178 -0
- package/src/core/navigation.ts +152 -0
- package/src/core/queries.ts +414 -0
- package/src/core/retry.ts +19 -0
- package/src/core/seo.ts +374 -0
- package/src/core/theme.ts +128 -0
- package/src/core/translations/cs.json +225 -0
- package/src/core/translations/en.json +225 -0
- package/src/core/types.ts +231 -0
- package/src/core/view-model.ts +98 -0
- package/src/nuxt/composables/useAsyncKb.ts +119 -0
- package/src/nuxt/index.ts +6 -0
- package/src/react/KbMdxContent.tsx +215 -0
- package/src/react/context.ts +25 -0
- package/src/react/hooks/useImageRenderer.ts +15 -0
- package/src/react/hooks/useKbClient.ts +9 -0
- package/src/react/hooks/useKbContext.ts +13 -0
- package/src/react/hooks/useKbI18n.ts +15 -0
- package/src/react/hooks/useKbLanguage.ts +105 -0
- package/src/react/hooks/useKbSearch.ts +50 -0
- package/src/react/hooks/useMdxContent.tsx +33 -0
- package/src/react/index.ts +31 -0
- package/src/react/provider.tsx +70 -0
- package/src/react/server/index.ts +70 -0
- package/src/vue/components/KbAccessGate.vue +86 -0
- package/src/vue/components/KbArticleCard.vue +102 -0
- package/src/vue/components/KbMdxContent.vue +211 -0
- package/src/vue/composables/useArticles.ts +78 -0
- package/src/vue/composables/useImageRenderer.ts +12 -0
- package/src/vue/composables/useKbAuth.ts +131 -0
- package/src/vue/composables/useKbClient.ts +17 -0
- package/src/vue/composables/useKbComments.ts +281 -0
- package/src/vue/composables/useKbI18n.ts +11 -0
- package/src/vue/composables/useKbLanguage.ts +103 -0
- package/src/vue/composables/useNavigation.ts +38 -0
- package/src/vue/composables/useSearch.ts +52 -0
- package/src/vue/composables/useTags.ts +64 -0
- package/src/vue/index.ts +27 -0
- package/src/vue/plugin.ts +73 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep-merge utility for blog configuration.
|
|
3
|
+
* Merges override values into base config, with nested object support.
|
|
4
|
+
*/
|
|
5
|
+
export function deepMerge<T extends Record<string, unknown>>(
|
|
6
|
+
base: T,
|
|
7
|
+
override: Partial<T>,
|
|
8
|
+
): T {
|
|
9
|
+
const result = { ...base } as Record<string, unknown>
|
|
10
|
+
for (const key of Object.keys(override)) {
|
|
11
|
+
const baseVal = result[key]
|
|
12
|
+
const overVal = (override as Record<string, unknown>)[key]
|
|
13
|
+
if (
|
|
14
|
+
baseVal &&
|
|
15
|
+
overVal &&
|
|
16
|
+
typeof baseVal === 'object' &&
|
|
17
|
+
!Array.isArray(baseVal) &&
|
|
18
|
+
typeof overVal === 'object' &&
|
|
19
|
+
!Array.isArray(overVal)
|
|
20
|
+
) {
|
|
21
|
+
result[key] = deepMerge(
|
|
22
|
+
baseVal as Record<string, unknown>,
|
|
23
|
+
overVal as Record<string, unknown>,
|
|
24
|
+
)
|
|
25
|
+
} else if (overVal !== undefined) {
|
|
26
|
+
result[key] = overVal
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return result as T
|
|
30
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client configuration and interface types for the KB SDK.
|
|
3
|
+
*
|
|
4
|
+
* The core principle: consumers provide their own fetch implementation
|
|
5
|
+
* and token storage, making the SDK framework-agnostic.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Function that performs HTTP requests. Compatible with native fetch, $fetch, axios, etc. */
|
|
9
|
+
export type Fetcher = (
|
|
10
|
+
url: string,
|
|
11
|
+
init: {
|
|
12
|
+
method: string
|
|
13
|
+
headers: Record<string, string>
|
|
14
|
+
body: string
|
|
15
|
+
},
|
|
16
|
+
) => Promise<{ data?: unknown; errors?: Array<{ message: string }> }>
|
|
17
|
+
|
|
18
|
+
/** Pluggable token storage. Implement for localStorage, cookies, or custom stores. */
|
|
19
|
+
export interface TokenStorage {
|
|
20
|
+
getToken(): string | null
|
|
21
|
+
setToken(token: string): void
|
|
22
|
+
removeToken(): void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Configuration for createKbClient */
|
|
26
|
+
export interface KbClientConfig {
|
|
27
|
+
/** GraphQL endpoint URL (e.g., 'https://api.example.com/graphql') */
|
|
28
|
+
endpoint: string
|
|
29
|
+
/** Optional: different endpoint for server-side (SSR). Falls back to endpoint. */
|
|
30
|
+
serverEndpoint?: string
|
|
31
|
+
/** Custom fetch implementation. Defaults to native fetch wrapper. */
|
|
32
|
+
fetcher?: Fetcher
|
|
33
|
+
/** Token storage implementation. Defaults to in-memory. */
|
|
34
|
+
tokenStorage?: TokenStorage
|
|
35
|
+
/** Whether currently running on server (for endpoint selection). Defaults to false. */
|
|
36
|
+
isServer?: boolean
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Generates HTML for images in markdown content. Pluggable for IPX, Cloudinary, etc. */
|
|
40
|
+
export type ImageHtmlRenderer = (
|
|
41
|
+
href: string,
|
|
42
|
+
alt: string,
|
|
43
|
+
title?: string | null,
|
|
44
|
+
) => string
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* HTML sanitizer function — takes dirty HTML, returns clean HTML.
|
|
48
|
+
*
|
|
49
|
+
* Mirror of `@blogmcp/sanitize`'s `SanitizeFn` type; defined here (not
|
|
50
|
+
* imported) so the SDK core has zero dependency on the sanitize package.
|
|
51
|
+
* Headless consumers either:
|
|
52
|
+
* - pass `sanitizeHtml` from `@blogmcp/sanitize` (our default policy), or
|
|
53
|
+
* - pass their own implementation matching this signature, or
|
|
54
|
+
* - omit the option and own the trust contract at their downstream renderer.
|
|
55
|
+
*
|
|
56
|
+
* See `competitor-monitor/docs/internal/sanitization-trust-contract.md`.
|
|
57
|
+
*/
|
|
58
|
+
export type SanitizeFn = (html: string) => string
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic GraphQL client for the Knowledge Base API.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* const client = createKbClient({ endpoint: 'https://api.example.com/graphql' })
|
|
6
|
+
* const data = await client.articles.list({ status: 'published', limit: 10 })
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { KbClientConfig, Fetcher, TokenStorage } from './client-types'
|
|
10
|
+
import type {
|
|
11
|
+
Article,
|
|
12
|
+
ArticleWithTranslation,
|
|
13
|
+
Tag,
|
|
14
|
+
LocalizedTag,
|
|
15
|
+
Language,
|
|
16
|
+
SearchResult,
|
|
17
|
+
KBContextChunk,
|
|
18
|
+
Translation,
|
|
19
|
+
Comment,
|
|
20
|
+
CommentsConnection,
|
|
21
|
+
CommentResult,
|
|
22
|
+
AuthResult,
|
|
23
|
+
RegisterResult,
|
|
24
|
+
UpdateProfileResult,
|
|
25
|
+
ReportSettings,
|
|
26
|
+
UpdateReportSettingsInput,
|
|
27
|
+
} from './types'
|
|
28
|
+
import type { NavNode } from './navigation'
|
|
29
|
+
import * as Q from './queries'
|
|
30
|
+
import { createMemoryTokenStorage } from './auth'
|
|
31
|
+
|
|
32
|
+
/** Default fetcher using native fetch */
|
|
33
|
+
function createDefaultFetcher(): Fetcher {
|
|
34
|
+
return async (url, init) => {
|
|
35
|
+
const response = await fetch(url, {
|
|
36
|
+
method: init.method,
|
|
37
|
+
headers: init.headers,
|
|
38
|
+
body: init.body,
|
|
39
|
+
})
|
|
40
|
+
return response.json()
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Execute a GraphQL query and return typed data */
|
|
45
|
+
async function executeGraphQL<T>(
|
|
46
|
+
config: { endpoint: string; fetcher: Fetcher; tokenStorage: TokenStorage },
|
|
47
|
+
query: string,
|
|
48
|
+
variables?: Record<string, unknown>,
|
|
49
|
+
): Promise<T> {
|
|
50
|
+
const headers: Record<string, string> = {
|
|
51
|
+
'Content-Type': 'application/json',
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const token = config.tokenStorage.getToken()
|
|
55
|
+
if (token) {
|
|
56
|
+
headers['Authorization'] = `Bearer ${token}`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const result = await config.fetcher(config.endpoint, {
|
|
60
|
+
method: 'POST',
|
|
61
|
+
headers,
|
|
62
|
+
body: JSON.stringify({ query, variables }),
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
if (result.errors?.length) {
|
|
66
|
+
throw new Error(result.errors[0].message)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (result as { data: T }).data
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ==================== Client Interface ====================
|
|
73
|
+
|
|
74
|
+
export interface KbClient {
|
|
75
|
+
articles: {
|
|
76
|
+
list(params?: {
|
|
77
|
+
status?: string
|
|
78
|
+
/** Filter to articles carrying these tag slugs (combined per tagMode). */
|
|
79
|
+
tags?: string[]
|
|
80
|
+
/** 'all' = AND (must have every tag); 'any' = OR (default). */
|
|
81
|
+
tagMode?: 'all' | 'any'
|
|
82
|
+
limit?: number
|
|
83
|
+
offset?: number
|
|
84
|
+
}): Promise<{
|
|
85
|
+
accessibleKbArticles: { articles: Article[]; totalCount: number }
|
|
86
|
+
}>
|
|
87
|
+
getWithTranslation(
|
|
88
|
+
filename: string,
|
|
89
|
+
languageCode: string,
|
|
90
|
+
): Promise<{
|
|
91
|
+
articleWithTranslation: ArticleWithTranslation | null
|
|
92
|
+
}>
|
|
93
|
+
/**
|
|
94
|
+
* Resolve a retired article slug to the article's current slug (no
|
|
95
|
+
* extension), or null if the slug was never an alias. Backs the blog
|
|
96
|
+
* 301-redirect after a rename.
|
|
97
|
+
*/
|
|
98
|
+
resolveAlias(
|
|
99
|
+
filename: string,
|
|
100
|
+
): Promise<{ articleAliasTarget: string | null }>
|
|
101
|
+
}
|
|
102
|
+
search: {
|
|
103
|
+
query(params: {
|
|
104
|
+
query: string
|
|
105
|
+
tags?: string[]
|
|
106
|
+
contentType?: string
|
|
107
|
+
limit?: number
|
|
108
|
+
minSimilarity?: number
|
|
109
|
+
}): Promise<{
|
|
110
|
+
searchKnowledgeBase: SearchResult[]
|
|
111
|
+
}>
|
|
112
|
+
getContext(
|
|
113
|
+
query: string,
|
|
114
|
+
maxChunks?: number,
|
|
115
|
+
): Promise<{
|
|
116
|
+
getKBContext: { chunks: KBContextChunk[]; totalChunks: number }
|
|
117
|
+
}>
|
|
118
|
+
}
|
|
119
|
+
tags: {
|
|
120
|
+
list(): Promise<{
|
|
121
|
+
accessibleKbTags: { tags: Tag[]; totalCount: number }
|
|
122
|
+
}>
|
|
123
|
+
listLocalized(languageCode: string): Promise<{
|
|
124
|
+
localizedTags: LocalizedTag[]
|
|
125
|
+
}>
|
|
126
|
+
}
|
|
127
|
+
languages: {
|
|
128
|
+
list(): Promise<{ kbLanguages: Language[] }>
|
|
129
|
+
}
|
|
130
|
+
navigation: {
|
|
131
|
+
get(params?: { scope?: string; locale?: string }): Promise<{ kbNavigation: NavNode[] }>
|
|
132
|
+
}
|
|
133
|
+
translations: {
|
|
134
|
+
list(sourceFilename: string): Promise<{
|
|
135
|
+
listArticleTranslations: Translation[]
|
|
136
|
+
}>
|
|
137
|
+
get(
|
|
138
|
+
sourceFilename: string,
|
|
139
|
+
languageCode: string,
|
|
140
|
+
): Promise<{ getTranslation: Translation }>
|
|
141
|
+
}
|
|
142
|
+
comments: {
|
|
143
|
+
list(
|
|
144
|
+
articleId: string,
|
|
145
|
+
languageCode: string,
|
|
146
|
+
): Promise<{ articleComments: CommentsConnection }>
|
|
147
|
+
get(
|
|
148
|
+
commentId: string,
|
|
149
|
+
languageCode: string,
|
|
150
|
+
): Promise<{ comment: Comment | null }>
|
|
151
|
+
create(params: {
|
|
152
|
+
articleId: string
|
|
153
|
+
content: string
|
|
154
|
+
sourceLanguageCode: string
|
|
155
|
+
parentCommentId?: string
|
|
156
|
+
}): Promise<{ createComment: CommentResult }>
|
|
157
|
+
update(
|
|
158
|
+
commentId: string,
|
|
159
|
+
content: string,
|
|
160
|
+
): Promise<{ updateComment: CommentResult }>
|
|
161
|
+
delete(commentId: string): Promise<{ deleteComment: CommentResult }>
|
|
162
|
+
}
|
|
163
|
+
auth: {
|
|
164
|
+
login(
|
|
165
|
+
email: string,
|
|
166
|
+
password: string,
|
|
167
|
+
): Promise<{ login: AuthResult }>
|
|
168
|
+
register(
|
|
169
|
+
email: string,
|
|
170
|
+
password: string,
|
|
171
|
+
name?: string,
|
|
172
|
+
): Promise<{ register: RegisterResult }>
|
|
173
|
+
verifyEmail(
|
|
174
|
+
token: string,
|
|
175
|
+
): Promise<{ verifyEmail: { success: boolean; error?: string } }>
|
|
176
|
+
forgotPassword(
|
|
177
|
+
email: string,
|
|
178
|
+
): Promise<{ forgotPassword: RegisterResult }>
|
|
179
|
+
resetPassword(
|
|
180
|
+
token: string,
|
|
181
|
+
password: string,
|
|
182
|
+
): Promise<{ resetPassword: { success: boolean; error?: string } }>
|
|
183
|
+
resendVerification(
|
|
184
|
+
email: string,
|
|
185
|
+
): Promise<{ resendVerification: RegisterResult }>
|
|
186
|
+
changePassword(
|
|
187
|
+
currentPassword: string,
|
|
188
|
+
newPassword: string,
|
|
189
|
+
): Promise<{ changePassword: { success: boolean; error?: string } }>
|
|
190
|
+
updateProfile(
|
|
191
|
+
input: { name?: string | null; email?: string | null },
|
|
192
|
+
): Promise<{ updateMyProfile: UpdateProfileResult }>
|
|
193
|
+
}
|
|
194
|
+
reportSettings: {
|
|
195
|
+
get(): Promise<{ myReportSettings: ReportSettings }>
|
|
196
|
+
update(
|
|
197
|
+
input: UpdateReportSettingsInput,
|
|
198
|
+
): Promise<{ updateMyReportSettings: ReportSettings }>
|
|
199
|
+
}
|
|
200
|
+
/** Raw GraphQL execution for escape hatch */
|
|
201
|
+
executeGraphQL<T = unknown>(
|
|
202
|
+
query: string,
|
|
203
|
+
variables?: Record<string, unknown>,
|
|
204
|
+
): Promise<T>
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ==================== Client Factory ====================
|
|
208
|
+
|
|
209
|
+
export function createKbClient(config: KbClientConfig): KbClient {
|
|
210
|
+
const fetcher = config.fetcher || createDefaultFetcher()
|
|
211
|
+
const tokenStorage = config.tokenStorage || createMemoryTokenStorage()
|
|
212
|
+
const endpoint = config.isServer && config.serverEndpoint
|
|
213
|
+
? config.serverEndpoint
|
|
214
|
+
: config.endpoint
|
|
215
|
+
|
|
216
|
+
const ctx = { endpoint, fetcher, tokenStorage }
|
|
217
|
+
|
|
218
|
+
function exec<T>(query: string, variables?: Record<string, unknown>) {
|
|
219
|
+
return executeGraphQL<T>(ctx, query, variables)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
articles: {
|
|
224
|
+
list: (params) => exec(Q.ACCESSIBLE_ARTICLES, params),
|
|
225
|
+
getWithTranslation: (filename, languageCode) =>
|
|
226
|
+
exec(Q.ARTICLE_WITH_TRANSLATION, { filename, languageCode }),
|
|
227
|
+
resolveAlias: (filename) =>
|
|
228
|
+
exec(Q.ARTICLE_ALIAS_TARGET, { filename }),
|
|
229
|
+
},
|
|
230
|
+
search: {
|
|
231
|
+
query: (params) => exec(Q.SEARCH_KNOWLEDGE_BASE, params),
|
|
232
|
+
getContext: (query, maxChunks) =>
|
|
233
|
+
exec(Q.GET_KB_CONTEXT, { query, maxChunks }),
|
|
234
|
+
},
|
|
235
|
+
tags: {
|
|
236
|
+
list: () => exec(Q.ACCESSIBLE_TAGS),
|
|
237
|
+
listLocalized: (languageCode) =>
|
|
238
|
+
exec(Q.LOCALIZED_TAGS, { languageCode }),
|
|
239
|
+
},
|
|
240
|
+
languages: {
|
|
241
|
+
list: () => exec(Q.KB_LANGUAGES),
|
|
242
|
+
},
|
|
243
|
+
navigation: {
|
|
244
|
+
get: (params) => exec(Q.KB_NAVIGATION, params ?? {}),
|
|
245
|
+
},
|
|
246
|
+
translations: {
|
|
247
|
+
list: (sourceFilename) =>
|
|
248
|
+
exec(Q.ARTICLE_TRANSLATIONS, { sourceFilename }),
|
|
249
|
+
get: (sourceFilename, languageCode) =>
|
|
250
|
+
exec(Q.GET_TRANSLATION, { sourceFilename, languageCode }),
|
|
251
|
+
},
|
|
252
|
+
comments: {
|
|
253
|
+
list: (articleId, languageCode) =>
|
|
254
|
+
exec(Q.ARTICLE_COMMENTS, { articleId, languageCode }),
|
|
255
|
+
get: (commentId, languageCode) =>
|
|
256
|
+
exec(Q.GET_COMMENT, { commentId, languageCode }),
|
|
257
|
+
create: (params) => exec(Q.CREATE_COMMENT, params),
|
|
258
|
+
update: (commentId, content) =>
|
|
259
|
+
exec(Q.UPDATE_COMMENT, { commentId, content }),
|
|
260
|
+
delete: (commentId) => exec(Q.DELETE_COMMENT, { commentId }),
|
|
261
|
+
},
|
|
262
|
+
auth: {
|
|
263
|
+
login: (email, password) => exec(Q.LOGIN, { email, password }),
|
|
264
|
+
register: (email, password, name) =>
|
|
265
|
+
exec(Q.REGISTER, { email, password, name }),
|
|
266
|
+
verifyEmail: (token) => exec(Q.VERIFY_EMAIL, { token }),
|
|
267
|
+
forgotPassword: (email) => exec(Q.FORGOT_PASSWORD, { email }),
|
|
268
|
+
resetPassword: (token, password) =>
|
|
269
|
+
exec(Q.RESET_PASSWORD, { token, password }),
|
|
270
|
+
resendVerification: (email) =>
|
|
271
|
+
exec(Q.RESEND_VERIFICATION, { email }),
|
|
272
|
+
changePassword: (currentPassword, newPassword) =>
|
|
273
|
+
exec(Q.CHANGE_PASSWORD, { currentPassword, newPassword }),
|
|
274
|
+
updateProfile: (input) =>
|
|
275
|
+
exec(Q.UPDATE_MY_PROFILE, {
|
|
276
|
+
name: input.name ?? null,
|
|
277
|
+
email: input.email ?? null,
|
|
278
|
+
}),
|
|
279
|
+
},
|
|
280
|
+
reportSettings: {
|
|
281
|
+
get: () => exec(Q.MY_REPORT_SETTINGS),
|
|
282
|
+
update: (input) =>
|
|
283
|
+
exec(Q.UPDATE_MY_REPORT_SETTINGS, input as Record<string, unknown>),
|
|
284
|
+
},
|
|
285
|
+
executeGraphQL: exec,
|
|
286
|
+
}
|
|
287
|
+
}
|
package/src/core/i18n.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* i18n utilities for the blog SDK.
|
|
3
|
+
*
|
|
4
|
+
* Ships default Czech and English translations.
|
|
5
|
+
* Consumers can override specific keys or provide entirely custom translations.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import csDefaults from './translations/cs.json'
|
|
9
|
+
import enDefaults from './translations/en.json'
|
|
10
|
+
import { deepMerge } from './blog-config'
|
|
11
|
+
|
|
12
|
+
export { csDefaults as csTranslations, enDefaults as enTranslations }
|
|
13
|
+
|
|
14
|
+
export type TranslationMap = Record<string, unknown>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Merge default translations with consumer overrides.
|
|
18
|
+
* Override keys take precedence; missing keys fall back to defaults.
|
|
19
|
+
*/
|
|
20
|
+
export function mergeTranslations(
|
|
21
|
+
defaults: TranslationMap,
|
|
22
|
+
overrides: TranslationMap,
|
|
23
|
+
): TranslationMap {
|
|
24
|
+
return deepMerge(defaults, overrides)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get the nested value from a translations object using dot-separated key.
|
|
29
|
+
* Returns the key itself as fallback if not found.
|
|
30
|
+
*/
|
|
31
|
+
function getNestedValue(
|
|
32
|
+
obj: TranslationMap,
|
|
33
|
+
key: string,
|
|
34
|
+
): string {
|
|
35
|
+
const parts = key.split('.')
|
|
36
|
+
let current: unknown = obj
|
|
37
|
+
for (const part of parts) {
|
|
38
|
+
if (current == null || typeof current !== 'object') return key
|
|
39
|
+
current = (current as Record<string, unknown>)[part]
|
|
40
|
+
}
|
|
41
|
+
return typeof current === 'string' ? current : key
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Simple parameter interpolation: replaces {param} with values.
|
|
46
|
+
*/
|
|
47
|
+
function interpolate(
|
|
48
|
+
template: string,
|
|
49
|
+
params?: Record<string, unknown>,
|
|
50
|
+
): string {
|
|
51
|
+
if (!params) return template
|
|
52
|
+
return template.replace(/\{(\w+)\}/g, (_, key) =>
|
|
53
|
+
params[key] != null ? String(params[key]) : `{${key}}`,
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Translation function type — compatible with vue-i18n's t() */
|
|
58
|
+
export type TranslateFn = (key: string, params?: Record<string, unknown>) => string
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Create a standalone translation function.
|
|
62
|
+
*
|
|
63
|
+
* @param locale - 'cs' or 'en' (or any code with provided translations)
|
|
64
|
+
* @param overrides - Optional overrides merged on top of defaults
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* const t = createKbI18n('en')
|
|
68
|
+
* t('comments.title') // → "Comments"
|
|
69
|
+
* t('articles.browseCollection', { count: 42 }) // → "Browse our collection of 42 articles"
|
|
70
|
+
*/
|
|
71
|
+
export function createKbI18n(
|
|
72
|
+
locale: string,
|
|
73
|
+
overrides?: TranslationMap,
|
|
74
|
+
): TranslateFn {
|
|
75
|
+
const defaults = locale === 'cs' ? csDefaults : enDefaults
|
|
76
|
+
const translations = overrides
|
|
77
|
+
? mergeTranslations(defaults as TranslationMap, overrides)
|
|
78
|
+
: (defaults as TranslationMap)
|
|
79
|
+
|
|
80
|
+
return (key: string, params?: Record<string, unknown>) => {
|
|
81
|
+
const value = getNestedValue(translations, key)
|
|
82
|
+
return interpolate(value, params)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// Types
|
|
2
|
+
export type {
|
|
3
|
+
Article,
|
|
4
|
+
ArticleWithTranslation,
|
|
5
|
+
MediaGeo,
|
|
6
|
+
ContentImageGeo,
|
|
7
|
+
Tag,
|
|
8
|
+
LocalizedTag,
|
|
9
|
+
SearchResult,
|
|
10
|
+
KBContextChunk,
|
|
11
|
+
Translation,
|
|
12
|
+
Language,
|
|
13
|
+
AccessLevel,
|
|
14
|
+
Comment,
|
|
15
|
+
CommentSubscriptionEvent,
|
|
16
|
+
CommentsConnection,
|
|
17
|
+
CommentResult,
|
|
18
|
+
AuthUser,
|
|
19
|
+
AuthResult,
|
|
20
|
+
RegisterResult,
|
|
21
|
+
UpdateProfileResult,
|
|
22
|
+
ReportSettings,
|
|
23
|
+
ReportPolicyValue,
|
|
24
|
+
EmailNotificationFrequency,
|
|
25
|
+
FeedbackNotificationFrequency,
|
|
26
|
+
UpdateReportSettingsInput,
|
|
27
|
+
PaginatedResponse,
|
|
28
|
+
} from './types'
|
|
29
|
+
export { ACCESS_LEVEL_ORDER } from './types'
|
|
30
|
+
|
|
31
|
+
// Client types
|
|
32
|
+
export type {
|
|
33
|
+
KbClientConfig,
|
|
34
|
+
Fetcher,
|
|
35
|
+
TokenStorage,
|
|
36
|
+
ImageHtmlRenderer,
|
|
37
|
+
SanitizeFn,
|
|
38
|
+
} from './client-types'
|
|
39
|
+
|
|
40
|
+
// Client
|
|
41
|
+
export type { KbClient } from './client'
|
|
42
|
+
export { createKbClient } from './client'
|
|
43
|
+
|
|
44
|
+
// Navigation (resolved/localized tree + traversal helpers)
|
|
45
|
+
export type { NavNode, NavNodeType, NavBadge, NavGroupLink, NavNextPrev, FlatNavNode } from './navigation'
|
|
46
|
+
export {
|
|
47
|
+
navWalk,
|
|
48
|
+
findNavNode,
|
|
49
|
+
navBreadcrumbs,
|
|
50
|
+
navSiblings,
|
|
51
|
+
navSubtree,
|
|
52
|
+
navNextPrev,
|
|
53
|
+
isNavigable,
|
|
54
|
+
flattenNav,
|
|
55
|
+
} from './navigation'
|
|
56
|
+
|
|
57
|
+
// Auth
|
|
58
|
+
export type { AuthManager } from './auth'
|
|
59
|
+
export {
|
|
60
|
+
createAuthManager,
|
|
61
|
+
createMemoryTokenStorage,
|
|
62
|
+
createLocalStorageTokenStorage,
|
|
63
|
+
decodeJwtUser,
|
|
64
|
+
hasAccessLevel,
|
|
65
|
+
} from './auth'
|
|
66
|
+
|
|
67
|
+
// Content utilities
|
|
68
|
+
export { stripLeadingH1, generateDescription } from './article-seo'
|
|
69
|
+
export { createMarkedInstance, defaultImageHtml, parseMarkdownSafe } from './markdown'
|
|
70
|
+
export type { CreateMarkedOptions } from './markdown'
|
|
71
|
+
export { deepMerge } from './blog-config'
|
|
72
|
+
export { retryWithBackoff } from './retry'
|
|
73
|
+
|
|
74
|
+
// Theme (per-tenant accent color math + CSS-var builder — shared by both blogs)
|
|
75
|
+
export {
|
|
76
|
+
buildThemeCssVars,
|
|
77
|
+
hexToRgb,
|
|
78
|
+
hexToHsl,
|
|
79
|
+
hslToRgb,
|
|
80
|
+
lightenColor,
|
|
81
|
+
darkenColor,
|
|
82
|
+
rgbTriplet,
|
|
83
|
+
} from './theme'
|
|
84
|
+
export type { ThemeColors } from './theme'
|
|
85
|
+
|
|
86
|
+
// SEO model builders (framework-agnostic — consumed by both Nuxt + Next blogs)
|
|
87
|
+
export {
|
|
88
|
+
localizedHref,
|
|
89
|
+
stripLocalePrefix,
|
|
90
|
+
pageUrl,
|
|
91
|
+
buildArticleSeo,
|
|
92
|
+
buildListPageSeo,
|
|
93
|
+
buildHomeSeo,
|
|
94
|
+
} from './seo'
|
|
95
|
+
export type {
|
|
96
|
+
SeoConfig,
|
|
97
|
+
SeoModel,
|
|
98
|
+
SeoHreflang,
|
|
99
|
+
SeoOpenGraph,
|
|
100
|
+
SeoTwitter,
|
|
101
|
+
LocalePrefixStrategy,
|
|
102
|
+
ArticleSeoSource,
|
|
103
|
+
BuildArticleSeoOptions,
|
|
104
|
+
BuildListPageSeoOptions,
|
|
105
|
+
BuildHomeSeoOptions,
|
|
106
|
+
} from './seo'
|
|
107
|
+
|
|
108
|
+
// View-model builders (framework-agnostic)
|
|
109
|
+
export {
|
|
110
|
+
toIsoDate,
|
|
111
|
+
formatArticleDate,
|
|
112
|
+
resolveArticleAccessLevel,
|
|
113
|
+
buildArticleListItem,
|
|
114
|
+
} from './view-model'
|
|
115
|
+
export type { ArticleListItemVM, BuildArticleListItemOptions } from './view-model'
|
|
116
|
+
|
|
117
|
+
// i18n
|
|
118
|
+
export {
|
|
119
|
+
csTranslations,
|
|
120
|
+
enTranslations,
|
|
121
|
+
mergeTranslations,
|
|
122
|
+
createKbI18n,
|
|
123
|
+
} from './i18n'
|
|
124
|
+
export type { TranslateFn, TranslationMap } from './i18n'
|
|
125
|
+
|
|
126
|
+
// Queries (for advanced usage / escape hatch)
|
|
127
|
+
export * as queries from './queries'
|
|
128
|
+
|
|
129
|
+
// MDX schema seam (framework-neutral). Re-exported so SDK consumers — including
|
|
130
|
+
// non-Vue frameworks that wire their own renderer — can normalize an MDX item's
|
|
131
|
+
// raw `props` against the schema's deprecation entries WITHOUT depending on
|
|
132
|
+
// `@blogmcp/mdx-render-vue/registry`. Pair with `getComponentMetadata(name)`:
|
|
133
|
+
//
|
|
134
|
+
// const meta = getComponentMetadata(item.name)
|
|
135
|
+
// const props = meta ? prepareProps(item.props, meta) : item.props
|
|
136
|
+
//
|
|
137
|
+
// The Vue + React MDX renderers shipped with the SDK do this internally; this
|
|
138
|
+
// export exists so a custom renderer (e.g. Svelte, Solid, or a hand-rolled
|
|
139
|
+
// React tree) can preserve the same shim guarantee — propRename, enumValueRename,
|
|
140
|
+
// and propBecameRequired defaults are applied identically across frameworks.
|
|
141
|
+
export { prepareProps } from '@blogmcp/mdx-schema/prepareProps'
|
|
142
|
+
export {
|
|
143
|
+
getComponentMetadata,
|
|
144
|
+
getComponentNames,
|
|
145
|
+
componentMetadata,
|
|
146
|
+
} from '@blogmcp/mdx-schema/metadata'
|
|
147
|
+
export type { ComponentMetadata, PropMetadata } from '@blogmcp/mdx-schema/metadata'
|