@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,22 @@
|
|
|
1
|
+
import { type Ref, type ComputedRef } from 'vue';
|
|
2
|
+
import type { Language, LocalizedTag } from '../../core/types';
|
|
3
|
+
export interface UseKbLanguageReturn {
|
|
4
|
+
currentLanguage: Ref<string>;
|
|
5
|
+
languages: Ref<Language[]>;
|
|
6
|
+
languagesLoaded: Ref<boolean>;
|
|
7
|
+
sourceLanguage: ComputedRef<Language | null>;
|
|
8
|
+
targetLanguages: ComputedRef<Language[]>;
|
|
9
|
+
currentLanguageName: ComputedRef<string>;
|
|
10
|
+
isSourceLanguage: ComputedRef<boolean>;
|
|
11
|
+
loadLanguages: () => Promise<void>;
|
|
12
|
+
setLanguage: (code: string) => void;
|
|
13
|
+
getLanguage: (code: string) => Language | undefined;
|
|
14
|
+
fetchLocalizedTags: () => Promise<LocalizedTag[]>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Language management composable.
|
|
18
|
+
*
|
|
19
|
+
* Framework-agnostic — doesn't depend on Nuxt's useRoute or useCookie.
|
|
20
|
+
* Consumers set the initial language and call setLanguage() for changes.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useKbLanguage(initialLocale?: string): UseKbLanguageReturn;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ref as c, computed as t } from "vue";
|
|
2
|
+
import { retryWithBackoff as o } from "../../core/retry.js";
|
|
3
|
+
import { useKbClient as E } from "./useKbClient.js";
|
|
4
|
+
const l = [
|
|
5
|
+
{ id: "1", code: "cs", name: "Czech", nativeName: "Čeština", isSource: !0, isEnabled: !0, sortOrder: 0 },
|
|
6
|
+
{ id: "2", code: "en", name: "English", nativeName: "English", isSource: !1, isEnabled: !0, sortOrder: 1 }
|
|
7
|
+
];
|
|
8
|
+
function N(g = "cs") {
|
|
9
|
+
const i = E(), n = c(g), a = c([...l]), u = c(!1), s = t(
|
|
10
|
+
() => a.value.find((e) => e.isSource) || null
|
|
11
|
+
), d = t(
|
|
12
|
+
() => a.value.filter((e) => !e.isSource)
|
|
13
|
+
), f = t(() => {
|
|
14
|
+
const e = a.value.find((r) => r.code === n.value);
|
|
15
|
+
return e?.nativeName || e?.name || n.value;
|
|
16
|
+
}), v = t(
|
|
17
|
+
() => s.value?.code === n.value
|
|
18
|
+
);
|
|
19
|
+
function L(e) {
|
|
20
|
+
return a.value.find((r) => r.code === e);
|
|
21
|
+
}
|
|
22
|
+
function m(e) {
|
|
23
|
+
n.value = e;
|
|
24
|
+
}
|
|
25
|
+
async function h() {
|
|
26
|
+
if (!u.value)
|
|
27
|
+
try {
|
|
28
|
+
const e = await o(
|
|
29
|
+
() => i.languages.list(),
|
|
30
|
+
{ retries: 3, initialDelay: 500 }
|
|
31
|
+
);
|
|
32
|
+
a.value = e.kbLanguages || [], u.value = !0;
|
|
33
|
+
} catch {
|
|
34
|
+
a.value = [...l];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function y() {
|
|
38
|
+
try {
|
|
39
|
+
return (await o(
|
|
40
|
+
() => i.tags.listLocalized(n.value),
|
|
41
|
+
{ retries: 3, initialDelay: 500 }
|
|
42
|
+
)).localizedTags || [];
|
|
43
|
+
} catch {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
currentLanguage: n,
|
|
49
|
+
languages: a,
|
|
50
|
+
languagesLoaded: u,
|
|
51
|
+
sourceLanguage: s,
|
|
52
|
+
targetLanguages: d,
|
|
53
|
+
currentLanguageName: f,
|
|
54
|
+
isSourceLanguage: v,
|
|
55
|
+
loadLanguages: h,
|
|
56
|
+
setLanguage: m,
|
|
57
|
+
getLanguage: L,
|
|
58
|
+
fetchLocalizedTags: y
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
N as useKbLanguage
|
|
63
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { NavNode } from '../../core/navigation';
|
|
3
|
+
export interface UseNavigationReturn {
|
|
4
|
+
/** The resolved, localized menu tree. */
|
|
5
|
+
tree: Ref<NavNode[]>;
|
|
6
|
+
loading: Ref<boolean>;
|
|
7
|
+
error: Ref<Error | null>;
|
|
8
|
+
fetch: (params?: {
|
|
9
|
+
scope?: string;
|
|
10
|
+
locale?: string;
|
|
11
|
+
}) => Promise<void>;
|
|
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 declare function useNavigation(): UseNavigationReturn;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ref as a } from "vue";
|
|
2
|
+
import { useKbClient as c } from "./useKbClient.js";
|
|
3
|
+
function f() {
|
|
4
|
+
const o = c(), r = a([]), n = a(!1), e = a(null);
|
|
5
|
+
async function i(l) {
|
|
6
|
+
n.value = !0, e.value = null;
|
|
7
|
+
try {
|
|
8
|
+
const t = await o.navigation.get(l);
|
|
9
|
+
r.value = t.kbNavigation ?? [];
|
|
10
|
+
} catch (t) {
|
|
11
|
+
e.value = t instanceof Error ? t : new Error(String(t));
|
|
12
|
+
} finally {
|
|
13
|
+
n.value = !1;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return { tree: r, loading: n, error: e, fetch: i };
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
f as useNavigation
|
|
20
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { SearchResult } from '../../core/types';
|
|
3
|
+
export type SearchMode = 'SEMANTIC' | 'KEYWORD' | 'HYBRID';
|
|
4
|
+
export interface UseKbSearchReturn {
|
|
5
|
+
results: Ref<SearchResult[]>;
|
|
6
|
+
loading: Ref<boolean>;
|
|
7
|
+
error: Ref<Error | null>;
|
|
8
|
+
search: (params: {
|
|
9
|
+
query: string;
|
|
10
|
+
tags?: string[];
|
|
11
|
+
contentType?: string;
|
|
12
|
+
limit?: number;
|
|
13
|
+
minSimilarity?: number;
|
|
14
|
+
searchMode?: SearchMode;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Reactive search composable.
|
|
19
|
+
* Supports hybrid search (vector + BM25) via searchMode parameter.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useKbSearch(): UseKbSearchReturn;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ref as a } from "vue";
|
|
2
|
+
import { useKbClient as c } from "./useKbClient.js";
|
|
3
|
+
function f() {
|
|
4
|
+
const l = c(), t = a([]), r = a(!1), n = a(null);
|
|
5
|
+
async function o(s) {
|
|
6
|
+
r.value = !0, n.value = null;
|
|
7
|
+
try {
|
|
8
|
+
const e = await l.search.query(s);
|
|
9
|
+
t.value = e.searchKnowledgeBase;
|
|
10
|
+
} catch (e) {
|
|
11
|
+
n.value = e instanceof Error ? e : new Error(String(e));
|
|
12
|
+
} finally {
|
|
13
|
+
r.value = !1;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return { results: t, loading: r, error: n, search: o };
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
f as useKbSearch
|
|
20
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { Tag, LocalizedTag } from '../../core/types';
|
|
3
|
+
export interface UseTagsReturn {
|
|
4
|
+
tags: Ref<Tag[]>;
|
|
5
|
+
totalCount: Ref<number>;
|
|
6
|
+
loading: Ref<boolean>;
|
|
7
|
+
error: Ref<Error | null>;
|
|
8
|
+
fetch: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare function useTags(): UseTagsReturn;
|
|
11
|
+
export interface UseLocalizedTagsReturn {
|
|
12
|
+
tags: Ref<LocalizedTag[]>;
|
|
13
|
+
loading: Ref<boolean>;
|
|
14
|
+
error: Ref<Error | null>;
|
|
15
|
+
fetch: (languageCode: string) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare function useLocalizedTags(): UseLocalizedTagsReturn;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ref as e } from "vue";
|
|
2
|
+
import { useKbClient as r } from "./useKbClient.js";
|
|
3
|
+
function f() {
|
|
4
|
+
const o = r(), l = e([]), n = e(0), a = e(!1), s = e(null);
|
|
5
|
+
async function c() {
|
|
6
|
+
a.value = !0, s.value = null;
|
|
7
|
+
try {
|
|
8
|
+
const t = await o.tags.list();
|
|
9
|
+
l.value = t.accessibleKbTags.tags, n.value = t.accessibleKbTags.totalCount;
|
|
10
|
+
} catch (t) {
|
|
11
|
+
s.value = t instanceof Error ? t : new Error(String(t));
|
|
12
|
+
} finally {
|
|
13
|
+
a.value = !1;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return { tags: l, totalCount: n, loading: a, error: s, fetch: c };
|
|
17
|
+
}
|
|
18
|
+
function g() {
|
|
19
|
+
const o = r(), l = e([]), n = e(!1), a = e(null);
|
|
20
|
+
async function s(c) {
|
|
21
|
+
n.value = !0, a.value = null;
|
|
22
|
+
try {
|
|
23
|
+
const t = await o.tags.listLocalized(c);
|
|
24
|
+
l.value = t.localizedTags;
|
|
25
|
+
} catch (t) {
|
|
26
|
+
a.value = t instanceof Error ? t : new Error(String(t));
|
|
27
|
+
} finally {
|
|
28
|
+
n.value = !1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return { tags: l, loading: n, error: a, fetch: s };
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
g as useLocalizedTags,
|
|
35
|
+
f as useTags
|
|
36
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { KbVue, KB_CLIENT_KEY, KB_AUTH_KEY, KB_I18N_KEY, KB_IMAGE_RENDERER_KEY } from './plugin';
|
|
2
|
+
export type { KbVueConfig } from './plugin';
|
|
3
|
+
export { useKbClient } from './composables/useKbClient';
|
|
4
|
+
export { useKbI18n } from './composables/useKbI18n';
|
|
5
|
+
export { useArticleList, useArticle } from './composables/useArticles';
|
|
6
|
+
export type { ArticleListParams, UseArticleListReturn, UseArticleReturn } from './composables/useArticles';
|
|
7
|
+
export { useKbSearch } from './composables/useSearch';
|
|
8
|
+
export type { UseKbSearchReturn } from './composables/useSearch';
|
|
9
|
+
export { useTags, useLocalizedTags } from './composables/useTags';
|
|
10
|
+
export type { UseTagsReturn, UseLocalizedTagsReturn } from './composables/useTags';
|
|
11
|
+
export { useNavigation } from './composables/useNavigation';
|
|
12
|
+
export type { UseNavigationReturn } from './composables/useNavigation';
|
|
13
|
+
export { useKbLanguage } from './composables/useKbLanguage';
|
|
14
|
+
export type { UseKbLanguageReturn } from './composables/useKbLanguage';
|
|
15
|
+
export { useKbAuth } from './composables/useKbAuth';
|
|
16
|
+
export type { UseKbAuthReturn } from './composables/useKbAuth';
|
|
17
|
+
export { useKbComments } from './composables/useKbComments';
|
|
18
|
+
export type { UseKbCommentsReturn } from './composables/useKbComments';
|
|
19
|
+
export { useImageRenderer } from './composables/useImageRenderer';
|
|
20
|
+
export { default as KbMdxContent } from './components/KbMdxContent.vue';
|
|
21
|
+
export { default as KbArticleCard } from './components/KbArticleCard.vue';
|
|
22
|
+
export { default as KbAccessGate } from './components/KbAccessGate.vue';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { KB_AUTH_KEY as o, KB_CLIENT_KEY as t, KB_I18N_KEY as s, KB_IMAGE_RENDERER_KEY as u, KbVue as K } from "./plugin.js";
|
|
2
|
+
import { useKbClient as f } from "./composables/useKbClient.js";
|
|
3
|
+
import { useKbI18n as x } from "./composables/useKbI18n.js";
|
|
4
|
+
import { useArticle as b, useArticleList as E } from "./composables/useArticles.js";
|
|
5
|
+
import { useKbSearch as i } from "./composables/useSearch.js";
|
|
6
|
+
import { useLocalizedTags as n, useTags as c } from "./composables/useTags.js";
|
|
7
|
+
import { useNavigation as A } from "./composables/useNavigation.js";
|
|
8
|
+
import { useKbLanguage as C } from "./composables/useKbLanguage.js";
|
|
9
|
+
import { useKbAuth as B } from "./composables/useKbAuth.js";
|
|
10
|
+
import { useKbComments as N } from "./composables/useKbComments.js";
|
|
11
|
+
import { useImageRenderer as T } from "./composables/useImageRenderer.js";
|
|
12
|
+
import { default as h } from "./components/KbMdxContent.vue.js";
|
|
13
|
+
import { default as M } from "./components/KbArticleCard.vue.js";
|
|
14
|
+
import { default as z } from "./components/KbAccessGate.vue.js";
|
|
15
|
+
export {
|
|
16
|
+
o as KB_AUTH_KEY,
|
|
17
|
+
t as KB_CLIENT_KEY,
|
|
18
|
+
s as KB_I18N_KEY,
|
|
19
|
+
u as KB_IMAGE_RENDERER_KEY,
|
|
20
|
+
z as KbAccessGate,
|
|
21
|
+
M as KbArticleCard,
|
|
22
|
+
h as KbMdxContent,
|
|
23
|
+
K as KbVue,
|
|
24
|
+
b as useArticle,
|
|
25
|
+
E as useArticleList,
|
|
26
|
+
T as useImageRenderer,
|
|
27
|
+
B as useKbAuth,
|
|
28
|
+
f as useKbClient,
|
|
29
|
+
N as useKbComments,
|
|
30
|
+
x as useKbI18n,
|
|
31
|
+
C as useKbLanguage,
|
|
32
|
+
i as useKbSearch,
|
|
33
|
+
n as useLocalizedTags,
|
|
34
|
+
A as useNavigation,
|
|
35
|
+
c as useTags
|
|
36
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue plugin for the KB Blog SDK.
|
|
3
|
+
*
|
|
4
|
+
* Sets up provide/inject for the KbClient, auth manager, i18n, and image renderer.
|
|
5
|
+
* Install once at app root:
|
|
6
|
+
*
|
|
7
|
+
* app.use(KbVue, { endpoint: 'https://api.example.com/graphql' })
|
|
8
|
+
*/
|
|
9
|
+
import type { App, InjectionKey } from 'vue';
|
|
10
|
+
import type { KbClient } from '../core/client';
|
|
11
|
+
import type { AuthManager } from '../core/auth';
|
|
12
|
+
import type { KbClientConfig, ImageHtmlRenderer, TokenStorage } from '../core/client-types';
|
|
13
|
+
import type { TranslateFn } from '../core/i18n';
|
|
14
|
+
export declare const KB_CLIENT_KEY: InjectionKey<KbClient>;
|
|
15
|
+
export declare const KB_AUTH_KEY: InjectionKey<AuthManager>;
|
|
16
|
+
export declare const KB_I18N_KEY: InjectionKey<TranslateFn>;
|
|
17
|
+
export declare const KB_IMAGE_RENDERER_KEY: InjectionKey<ImageHtmlRenderer>;
|
|
18
|
+
export interface KbVueConfig extends KbClientConfig {
|
|
19
|
+
/** Custom auth token storage. Defaults to localStorage in browser, memory on server. */
|
|
20
|
+
tokenStorage?: TokenStorage;
|
|
21
|
+
/** i18n translation function. Defaults to built-in createKbI18n. */
|
|
22
|
+
i18n?: TranslateFn;
|
|
23
|
+
/** Default locale for built-in i18n (if i18n not provided). Defaults to 'en'. */
|
|
24
|
+
locale?: string;
|
|
25
|
+
/** Image HTML renderer for MdxContent. Defaults to plain <img>. */
|
|
26
|
+
imageRenderer?: ImageHtmlRenderer;
|
|
27
|
+
}
|
|
28
|
+
export declare const KbVue: {
|
|
29
|
+
install(app: App, config: KbVueConfig): void;
|
|
30
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createKbClient as K } from "../core/client.js";
|
|
2
|
+
import { createLocalStorageTokenStorage as c, createMemoryTokenStorage as i, createAuthManager as l } from "../core/auth.js";
|
|
3
|
+
import { createKbI18n as b } from "../core/i18n.js";
|
|
4
|
+
import { defaultImageHtml as d } from "../core/markdown.js";
|
|
5
|
+
const s = Symbol("KbClient"), E = Symbol("KbAuth"), S = Symbol("KbI18n"), _ = Symbol("KbImageRenderer"), R = {
|
|
6
|
+
install(o, e) {
|
|
7
|
+
const t = e.tokenStorage || (typeof window < "u" ? c() : i()), r = K({ ...e, tokenStorage: t }), n = l(t), a = e.i18n || b(e.locale || "en"), m = e.imageRenderer || d;
|
|
8
|
+
o.provide(s, r), o.provide(E, n), o.provide(S, a), o.provide(_, m);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
E as KB_AUTH_KEY,
|
|
13
|
+
s as KB_CLIENT_KEY,
|
|
14
|
+
S as KB_I18N_KEY,
|
|
15
|
+
_ as KB_IMAGE_RENDERER_KEY,
|
|
16
|
+
R as KbVue
|
|
17
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@blogmcp/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Headless SDK for Knowledge Base blog — core client, Vue composables, Nuxt adapter",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/core/index.d.ts",
|
|
13
|
+
"import": "./dist/core/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./vue": {
|
|
16
|
+
"types": "./dist/vue/index.d.ts",
|
|
17
|
+
"import": "./dist/vue/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./nuxt": {
|
|
20
|
+
"types": "./dist/nuxt/index.d.ts",
|
|
21
|
+
"import": "./dist/nuxt/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./react": {
|
|
24
|
+
"types": "./dist/react/index.d.ts",
|
|
25
|
+
"import": "./dist/react/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./react/server": {
|
|
28
|
+
"types": "./dist/react/server/index.d.ts",
|
|
29
|
+
"import": "./dist/react/server/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"main": "./dist/core/index.js",
|
|
33
|
+
"types": "./dist/core/index.d.ts",
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"src"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "vite build && vue-tsc --emitDeclarationOnly",
|
|
40
|
+
"dev": "vite build --watch",
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"test:watch": "vitest",
|
|
43
|
+
"typecheck": "vue-tsc --noEmit",
|
|
44
|
+
"prepack": "node scripts/prepack.mjs",
|
|
45
|
+
"postpack": "node scripts/postpack.mjs"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"react": ">=18",
|
|
49
|
+
"react-dom": ">=18",
|
|
50
|
+
"vue": "^3.4.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependenciesMeta": {
|
|
53
|
+
"react": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
56
|
+
"react-dom": {
|
|
57
|
+
"optional": true
|
|
58
|
+
},
|
|
59
|
+
"vue": {
|
|
60
|
+
"optional": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@blogmcp/mdx-schema": "^0.1.0",
|
|
65
|
+
"@blogmcp/sanitize": "^0.1.0",
|
|
66
|
+
"marked": "^15.0.7"
|
|
67
|
+
},
|
|
68
|
+
"optionalDependencies": {
|
|
69
|
+
"graphql-ws": "^6.0.7"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@testing-library/react": "^16.1.0",
|
|
73
|
+
"@types/node": "^20.10.0",
|
|
74
|
+
"@types/react": "^18.3.0",
|
|
75
|
+
"@types/react-dom": "^18.3.0",
|
|
76
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
77
|
+
"@vue/test-utils": "^2.4.0",
|
|
78
|
+
"happy-dom": "^17.4.0",
|
|
79
|
+
"react": "^18.3.0",
|
|
80
|
+
"react-dom": "^18.3.0",
|
|
81
|
+
"typescript": "^5.3.3",
|
|
82
|
+
"vite": "^7.3.0",
|
|
83
|
+
"vitest": "^3.0.0",
|
|
84
|
+
"vue": "^3.5.0",
|
|
85
|
+
"vue-tsc": "^2.0.0"
|
|
86
|
+
},
|
|
87
|
+
"keywords": [
|
|
88
|
+
"knowledge-base",
|
|
89
|
+
"blog",
|
|
90
|
+
"sdk",
|
|
91
|
+
"headless",
|
|
92
|
+
"vue",
|
|
93
|
+
"nuxt",
|
|
94
|
+
"graphql"
|
|
95
|
+
],
|
|
96
|
+
"license": "MIT"
|
|
97
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content text utilities for article SEO.
|
|
3
|
+
* Pure functions — no framework dependencies.
|
|
4
|
+
*
|
|
5
|
+
* These were previously duplicated between the SDK core and the Nuxt blog
|
|
6
|
+
* (`blog/app/utils/article-seo.ts`). The two copies had diverged (the blog copy
|
|
7
|
+
* was frontmatter-aware and trimmed its output; the core copy was not). This is
|
|
8
|
+
* the single canonical implementation that both the Vue and React blogs consume
|
|
9
|
+
* via `@blogmcp/sdk` — see `buildArticleSeo` in `./seo` for the higher-level
|
|
10
|
+
* SEO-model builder that uses `generateDescription`.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Remove the first `# …` heading from markdown content.
|
|
15
|
+
*
|
|
16
|
+
* Preserves any YAML frontmatter (`--- … ---`) that precedes it, and only
|
|
17
|
+
* strips the H1 when it is the very first non-blank line of the body (so H2+
|
|
18
|
+
* and mid-document H1s are kept). Output is trimmed.
|
|
19
|
+
*/
|
|
20
|
+
export function stripLeadingH1(content: string): string {
|
|
21
|
+
if (!content) return ''
|
|
22
|
+
|
|
23
|
+
// Skip past frontmatter if present so the H1 check applies to the body.
|
|
24
|
+
let body = content
|
|
25
|
+
let frontmatter = ''
|
|
26
|
+
|
|
27
|
+
if (body.startsWith('---')) {
|
|
28
|
+
const endIndex = body.indexOf('---', 3)
|
|
29
|
+
if (endIndex !== -1) {
|
|
30
|
+
frontmatter = body.substring(0, endIndex + 3)
|
|
31
|
+
body = body.substring(endIndex + 3)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Remove a leading `# Title` (one space after the hash) — only when it is the
|
|
36
|
+
// first non-blank line. `[\s]*` lets it sit after frontmatter/blank lines.
|
|
37
|
+
const stripped = body.replace(/^[\s]*# [^\n]+\n?/, '')
|
|
38
|
+
|
|
39
|
+
if (frontmatter) {
|
|
40
|
+
return (frontmatter + stripped).trim()
|
|
41
|
+
}
|
|
42
|
+
return stripped.trim()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Strip markdown/MDX syntax and return a plain-text snippet for a meta
|
|
47
|
+
* description. Truncates on a word boundary at `maxLength` characters.
|
|
48
|
+
*
|
|
49
|
+
* Paired MDX components are removed together with their children (component
|
|
50
|
+
* internals are not prose); self-closing MDX components are removed entirely.
|
|
51
|
+
*/
|
|
52
|
+
export function generateDescription(content: string, maxLength = 160): string {
|
|
53
|
+
if (!content) return ''
|
|
54
|
+
|
|
55
|
+
let text = content
|
|
56
|
+
|
|
57
|
+
// Remove frontmatter
|
|
58
|
+
if (text.startsWith('---')) {
|
|
59
|
+
const endIndex = text.indexOf('---', 3)
|
|
60
|
+
if (endIndex !== -1) {
|
|
61
|
+
text = text.substring(endIndex + 3)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Remove leading H1
|
|
66
|
+
text = text.replace(/^[\s]*# [^\n]+\n?/, '')
|
|
67
|
+
|
|
68
|
+
text = text
|
|
69
|
+
// Paired JSX/MDX components incl. their children: <Callout …>…</Callout>
|
|
70
|
+
.replace(/<[A-Z][a-zA-Z]*[^>]*>[\s\S]*?<\/[A-Z][a-zA-Z]*>/g, '')
|
|
71
|
+
// Self-closing JSX/MDX components: <InfoBox … />
|
|
72
|
+
.replace(/<[A-Z][a-zA-Z]*[^>]*\/?>/g, '')
|
|
73
|
+
// Images 
|
|
74
|
+
.replace(/!\[[^\]]*\]\([^)]*\)/g, '')
|
|
75
|
+
// Links [text](url) → text
|
|
76
|
+
.replace(/\[([^\]]*)\]\([^)]*\)/g, '$1')
|
|
77
|
+
// HTML tags
|
|
78
|
+
.replace(/<[^>]+>/g, '')
|
|
79
|
+
// Headings ## etc
|
|
80
|
+
.replace(/^#{1,6}\s+/gm, '')
|
|
81
|
+
// Bold/italic ***text*** **text** *text* ___text___ __text__ _text_
|
|
82
|
+
.replace(/(\*{1,3}|_{1,3})(.+?)\1/g, '$2')
|
|
83
|
+
// Blockquotes
|
|
84
|
+
.replace(/^>\s+/gm, '')
|
|
85
|
+
// Horizontal rules
|
|
86
|
+
.replace(/^[-*_]{3,}\s*$/gm, '')
|
|
87
|
+
// Code blocks (must come before inline code)
|
|
88
|
+
.replace(/```[\s\S]*?```/g, '')
|
|
89
|
+
// Inline code
|
|
90
|
+
.replace(/`([^`]+)`/g, '$1')
|
|
91
|
+
// Collapse whitespace
|
|
92
|
+
.replace(/\s+/g, ' ')
|
|
93
|
+
.trim()
|
|
94
|
+
|
|
95
|
+
if (text.length <= maxLength) return text
|
|
96
|
+
|
|
97
|
+
// Truncate on word boundary
|
|
98
|
+
const truncated = text.substring(0, maxLength)
|
|
99
|
+
const lastSpace = truncated.lastIndexOf(' ')
|
|
100
|
+
return (lastSpace > 0 ? truncated.substring(0, lastSpace) : truncated) + '...'
|
|
101
|
+
}
|
package/src/core/auth.ts
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic auth manager.
|
|
3
|
+
*
|
|
4
|
+
* Handles JWT token decode, access level checking, login/logout.
|
|
5
|
+
* Consumers provide their own TokenStorage implementation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { TokenStorage } from './client-types'
|
|
9
|
+
import type { AuthUser, AccessLevel } from './types'
|
|
10
|
+
import { ACCESS_LEVEL_ORDER } from './types'
|
|
11
|
+
|
|
12
|
+
export interface AuthManager {
|
|
13
|
+
getToken(): string | null
|
|
14
|
+
getUser(): AuthUser | null
|
|
15
|
+
isAuthenticated(): boolean
|
|
16
|
+
accessLevel(): AccessLevel
|
|
17
|
+
hasAccess(required: AccessLevel): boolean
|
|
18
|
+
login(token: string, user?: AuthUser): void
|
|
19
|
+
logout(): void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Decode user info from a JWT token payload (base64url-encoded).
|
|
24
|
+
* Returns null if the token is malformed.
|
|
25
|
+
*/
|
|
26
|
+
export function decodeJwtUser(token: string): AuthUser | null {
|
|
27
|
+
try {
|
|
28
|
+
const parts = token.split('.')
|
|
29
|
+
if (parts.length !== 3) return null
|
|
30
|
+
const payload = JSON.parse(atob(parts[1]))
|
|
31
|
+
return {
|
|
32
|
+
id: payload.sub || payload.userId || '',
|
|
33
|
+
email: payload.email || '',
|
|
34
|
+
name: payload.name,
|
|
35
|
+
accessLevel: payload.accessLevel || 'public',
|
|
36
|
+
}
|
|
37
|
+
} catch {
|
|
38
|
+
return null
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Check if a user's access level meets the required level.
|
|
44
|
+
*/
|
|
45
|
+
export function hasAccessLevel(
|
|
46
|
+
userLevel: AccessLevel,
|
|
47
|
+
requiredLevel: AccessLevel,
|
|
48
|
+
): boolean {
|
|
49
|
+
const userIndex = ACCESS_LEVEL_ORDER.indexOf(userLevel)
|
|
50
|
+
const requiredIndex = ACCESS_LEVEL_ORDER.indexOf(requiredLevel)
|
|
51
|
+
return userIndex >= requiredIndex
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Create an auth manager with the given token storage.
|
|
56
|
+
*/
|
|
57
|
+
export function createAuthManager(storage: TokenStorage): AuthManager {
|
|
58
|
+
let cachedUser: AuthUser | null = null
|
|
59
|
+
|
|
60
|
+
// Try to restore user from existing token
|
|
61
|
+
const existingToken = storage.getToken()
|
|
62
|
+
if (existingToken) {
|
|
63
|
+
cachedUser = decodeJwtUser(existingToken)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
getToken() {
|
|
68
|
+
return storage.getToken()
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
getUser() {
|
|
72
|
+
return cachedUser
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
isAuthenticated() {
|
|
76
|
+
return storage.getToken() !== null
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
accessLevel(): AccessLevel {
|
|
80
|
+
return cachedUser?.accessLevel || 'public'
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
hasAccess(required: AccessLevel): boolean {
|
|
84
|
+
return hasAccessLevel(this.accessLevel(), required)
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
login(token: string, user?: AuthUser) {
|
|
88
|
+
storage.setToken(token)
|
|
89
|
+
cachedUser = user || decodeJwtUser(token)
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
logout() {
|
|
93
|
+
storage.removeToken()
|
|
94
|
+
cachedUser = null
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ==================== Token Storage Implementations ====================
|
|
100
|
+
|
|
101
|
+
/** In-memory token storage (for SSR or testing) */
|
|
102
|
+
export function createMemoryTokenStorage(): TokenStorage {
|
|
103
|
+
let token: string | null = null
|
|
104
|
+
return {
|
|
105
|
+
getToken: () => token,
|
|
106
|
+
setToken: (t: string) => { token = t },
|
|
107
|
+
removeToken: () => { token = null },
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** localStorage-based token storage (browser) */
|
|
112
|
+
export function createLocalStorageTokenStorage(
|
|
113
|
+
key = 'kb_blog_token',
|
|
114
|
+
): TokenStorage {
|
|
115
|
+
return {
|
|
116
|
+
getToken: () => {
|
|
117
|
+
try {
|
|
118
|
+
return localStorage.getItem(key)
|
|
119
|
+
} catch {
|
|
120
|
+
return null
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
setToken: (token: string) => {
|
|
124
|
+
try {
|
|
125
|
+
localStorage.setItem(key, token)
|
|
126
|
+
} catch {
|
|
127
|
+
// localStorage unavailable (e.g., private browsing)
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
removeToken: () => {
|
|
131
|
+
try {
|
|
132
|
+
localStorage.removeItem(key)
|
|
133
|
+
} catch {
|
|
134
|
+
// Ignore
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
}
|