@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,102 @@
|
|
|
1
|
+
import { createElement as i, Fragment as _ } from "react";
|
|
2
|
+
import { Marked as b } from "marked";
|
|
3
|
+
import { stripFrontmatter as M, HAS_MDX_RE as k, parseJsxProps as v, MDX_COMPONENT_PATTERN as w } from "../packages/mdx-schema/dist/composables/useMdxParsing.js";
|
|
4
|
+
import { sanitizeHtml as p } from "../packages/sanitize/dist/html.js";
|
|
5
|
+
import "../_virtual/index.js";
|
|
6
|
+
import { defaultImageHtml as $ } from "../core/markdown.js";
|
|
7
|
+
import { prepareProps as N } from "../packages/mdx-schema/dist/prepareProps.js";
|
|
8
|
+
import { getComponentMetadata as H } from "../packages/mdx-schema/dist/metadata/index.js";
|
|
9
|
+
function h(l) {
|
|
10
|
+
return new b({
|
|
11
|
+
renderer: {
|
|
12
|
+
image({ href: e, title: t, text: s }) {
|
|
13
|
+
return e ? l(e, s, t) : "";
|
|
14
|
+
},
|
|
15
|
+
link({ href: e, title: t, text: s }) {
|
|
16
|
+
const r = t ? ` title="${t}"` : "";
|
|
17
|
+
return e && /^https?:\/\//.test(e) ? `<a href="${e}"${r} target="_blank" rel="noopener noreferrer">${s}</a>` : `<a href="${e}"${r}>${s}</a>`;
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
hooks: {
|
|
21
|
+
postprocess(e) {
|
|
22
|
+
return e.replace(/<table>/g, '<div class="overflow-x-auto -mx-4 px-4"><table>').replace(/<\/table>/g, "</table></div>").replace(/<th>/g, '<th scope="col">');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function f(l, e) {
|
|
28
|
+
if (!l) return { mode: "html", html: "", items: [] };
|
|
29
|
+
const t = M(l);
|
|
30
|
+
if (!k.test(t))
|
|
31
|
+
return { mode: "html", html: p(e.parse(t)), items: [] };
|
|
32
|
+
const s = new RegExp(w.source, "g"), r = [];
|
|
33
|
+
let o = 0, n;
|
|
34
|
+
for (; (n = s.exec(t)) !== null; ) {
|
|
35
|
+
if (n.index > o) {
|
|
36
|
+
const u = t.slice(o, n.index);
|
|
37
|
+
u.trim() && r.push({ type: "html", content: p(e.parse(u)) });
|
|
38
|
+
}
|
|
39
|
+
const m = n[1] || n[4] || "", a = n[1] ? n[2] || "" : n[5] || "", y = n[3], c = v(a), d = H(m), x = d ? N(c, d) : c;
|
|
40
|
+
r.push({
|
|
41
|
+
type: "component",
|
|
42
|
+
name: m,
|
|
43
|
+
props: x,
|
|
44
|
+
children: y?.trim()
|
|
45
|
+
}), o = n.index + n[0].length;
|
|
46
|
+
}
|
|
47
|
+
if (o < t.length) {
|
|
48
|
+
const m = t.slice(o);
|
|
49
|
+
m.trim() && r.push({ type: "html", content: p(e.parse(m)) });
|
|
50
|
+
}
|
|
51
|
+
return r.length === 0 && t.trim() ? { mode: "html", html: p(e.parse(t)), items: [] } : { mode: "mdx", items: r, html: "" };
|
|
52
|
+
}
|
|
53
|
+
function g(l, e, t) {
|
|
54
|
+
const s = h(t);
|
|
55
|
+
return l.map((r, o) => {
|
|
56
|
+
if (r.type === "html")
|
|
57
|
+
return i("div", {
|
|
58
|
+
key: o,
|
|
59
|
+
dangerouslySetInnerHTML: { __html: r.content }
|
|
60
|
+
});
|
|
61
|
+
const n = e[r.name];
|
|
62
|
+
if (!n)
|
|
63
|
+
return i(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
key: o,
|
|
67
|
+
className: "bg-yellow-50 border border-yellow-200 rounded-lg p-4 my-4 text-yellow-800"
|
|
68
|
+
},
|
|
69
|
+
`Unknown component: ${r.name}`
|
|
70
|
+
);
|
|
71
|
+
let m;
|
|
72
|
+
if (r.children) {
|
|
73
|
+
const a = f(r.children, s);
|
|
74
|
+
a.mode === "html" ? m = i("div", {
|
|
75
|
+
dangerouslySetInnerHTML: { __html: a.html }
|
|
76
|
+
}) : m = g(a.items, e, t);
|
|
77
|
+
}
|
|
78
|
+
return i(n, { key: o, ...r.props }, m);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function R({
|
|
82
|
+
content: l,
|
|
83
|
+
components: e = {},
|
|
84
|
+
imageRenderer: t
|
|
85
|
+
}) {
|
|
86
|
+
const s = t ?? $, r = h(s), o = f(l, r);
|
|
87
|
+
if (o.mode === "html")
|
|
88
|
+
return i("div", {
|
|
89
|
+
className: "mdx-content",
|
|
90
|
+
dangerouslySetInnerHTML: { __html: o.html }
|
|
91
|
+
});
|
|
92
|
+
const n = g(o.items, e, s);
|
|
93
|
+
return i(
|
|
94
|
+
"div",
|
|
95
|
+
{ className: "mdx-content" },
|
|
96
|
+
n.map((m, a) => i(_, { key: a }, m))
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
R as KbMdxContent,
|
|
101
|
+
R as default
|
|
102
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { KbClient } from '../core/client';
|
|
2
|
+
import type { AuthManager } from '../core/auth';
|
|
3
|
+
import type { TranslateFn } from '../core/i18n';
|
|
4
|
+
import type { ImageHtmlRenderer } from '../core/client-types';
|
|
5
|
+
export interface KbContextValue {
|
|
6
|
+
client: KbClient;
|
|
7
|
+
auth: AuthManager;
|
|
8
|
+
i18n: TranslateFn;
|
|
9
|
+
imageRenderer: ImageHtmlRenderer;
|
|
10
|
+
}
|
|
11
|
+
export declare const KbContext: import("react").Context<KbContextValue | null>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ImageHtmlRenderer } from '../../core/client-types';
|
|
2
|
+
/**
|
|
3
|
+
* Access the image HTML renderer from the nearest <KbProvider>.
|
|
4
|
+
* Falls back to a plain <img> renderer when used outside a provider.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useImageRenderer(): ImageHtmlRenderer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext as o } from "react";
|
|
2
|
+
import { KbContext as r } from "../context.js";
|
|
3
|
+
function i() {
|
|
4
|
+
const t = o(r);
|
|
5
|
+
if (!t)
|
|
6
|
+
throw new Error("useKb* hooks must be used within a <KbProvider>");
|
|
7
|
+
return t;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
i as useKbContext
|
|
11
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TranslateFn } from '../../core/i18n';
|
|
2
|
+
/**
|
|
3
|
+
* Access the translation function from the nearest <KbProvider>.
|
|
4
|
+
* Falls back to returning the key as-is when used outside a provider
|
|
5
|
+
* (mirrors the Vue `useKbI18n` graceful fallback).
|
|
6
|
+
*/
|
|
7
|
+
export declare function useKbI18n(): TranslateFn;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Language, LocalizedTag } from '../../core/types';
|
|
2
|
+
export interface UseKbLanguageReturn {
|
|
3
|
+
currentLanguage: string;
|
|
4
|
+
languages: Language[];
|
|
5
|
+
languagesLoaded: boolean;
|
|
6
|
+
sourceLanguage: Language | null;
|
|
7
|
+
targetLanguages: Language[];
|
|
8
|
+
currentLanguageName: string;
|
|
9
|
+
isSourceLanguage: boolean;
|
|
10
|
+
loadLanguages: () => Promise<void>;
|
|
11
|
+
setLanguage: (code: string) => void;
|
|
12
|
+
getLanguage: (code: string) => Language | undefined;
|
|
13
|
+
fetchLocalizedTags: () => Promise<LocalizedTag[]>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Language-management hook (the React analogue of the Vue `useKbLanguage`).
|
|
17
|
+
*
|
|
18
|
+
* Framework-agnostic — doesn't depend on Next routing. Consumers pass the
|
|
19
|
+
* initial language and call `setLanguage()` for changes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useKbLanguage(initialLocale?: string): UseKbLanguageReturn;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useState as u, useMemo as s, useCallback as r } from "react";
|
|
2
|
+
import { retryWithBackoff as l } from "../../core/retry.js";
|
|
3
|
+
import { useKbClient as z } from "./useKbClient.js";
|
|
4
|
+
const d = [
|
|
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 A(L = "cs") {
|
|
9
|
+
const n = z(), [t, f] = u(L), [a, g] = u([...d]), [c, m] = u(!1), o = s(
|
|
10
|
+
() => a.find((e) => e.isSource) || null,
|
|
11
|
+
[a]
|
|
12
|
+
), h = s(
|
|
13
|
+
() => a.filter((e) => !e.isSource),
|
|
14
|
+
[a]
|
|
15
|
+
), y = s(() => {
|
|
16
|
+
const e = a.find((i) => i.code === t);
|
|
17
|
+
return e?.nativeName || e?.name || t;
|
|
18
|
+
}, [a, t]), S = s(
|
|
19
|
+
() => o?.code === t,
|
|
20
|
+
[o, t]
|
|
21
|
+
), b = r(
|
|
22
|
+
(e) => a.find((i) => i.code === e),
|
|
23
|
+
[a]
|
|
24
|
+
), E = r((e) => {
|
|
25
|
+
f(e);
|
|
26
|
+
}, []), N = r(async () => {
|
|
27
|
+
if (!c)
|
|
28
|
+
try {
|
|
29
|
+
const e = await l(() => n.languages.list(), {
|
|
30
|
+
retries: 3,
|
|
31
|
+
initialDelay: 500
|
|
32
|
+
});
|
|
33
|
+
g(e.kbLanguages || []), m(!0);
|
|
34
|
+
} catch {
|
|
35
|
+
g([...d]);
|
|
36
|
+
}
|
|
37
|
+
}, [n, c]), p = r(async () => {
|
|
38
|
+
try {
|
|
39
|
+
return (await l(
|
|
40
|
+
() => n.tags.listLocalized(t),
|
|
41
|
+
{ retries: 3, initialDelay: 500 }
|
|
42
|
+
)).localizedTags || [];
|
|
43
|
+
} catch {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
}, [n, t]);
|
|
47
|
+
return {
|
|
48
|
+
currentLanguage: t,
|
|
49
|
+
languages: a,
|
|
50
|
+
languagesLoaded: c,
|
|
51
|
+
sourceLanguage: o,
|
|
52
|
+
targetLanguages: h,
|
|
53
|
+
currentLanguageName: y,
|
|
54
|
+
isSourceLanguage: S,
|
|
55
|
+
loadLanguages: N,
|
|
56
|
+
setLanguage: E,
|
|
57
|
+
getLanguage: b,
|
|
58
|
+
fetchLocalizedTags: p
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
A as useKbLanguage
|
|
63
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SearchResult } from '../../core/types';
|
|
2
|
+
export type SearchMode = 'SEMANTIC' | 'KEYWORD' | 'HYBRID';
|
|
3
|
+
export interface UseKbSearchReturn {
|
|
4
|
+
results: SearchResult[];
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: Error | null;
|
|
7
|
+
search: (params: {
|
|
8
|
+
query: string;
|
|
9
|
+
tags?: string[];
|
|
10
|
+
contentType?: string;
|
|
11
|
+
limit?: number;
|
|
12
|
+
minSimilarity?: number;
|
|
13
|
+
searchMode?: SearchMode;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Reactive search hook (the React analogue of the Vue `useKbSearch`).
|
|
18
|
+
* Supports hybrid search (vector + BM25) via the `searchMode` parameter.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useKbSearch(): UseKbSearchReturn;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useState as r, useCallback as f } from "react";
|
|
2
|
+
import { useKbClient as h } from "./useKbClient.js";
|
|
3
|
+
function m() {
|
|
4
|
+
const t = h(), [a, o] = r([]), [c, s] = r(!1), [l, n] = r(null), u = f(
|
|
5
|
+
async (i) => {
|
|
6
|
+
s(!0), n(null);
|
|
7
|
+
try {
|
|
8
|
+
const e = await t.search.query(i);
|
|
9
|
+
o(e.searchKnowledgeBase);
|
|
10
|
+
} catch (e) {
|
|
11
|
+
n(e instanceof Error ? e : new Error(String(e)));
|
|
12
|
+
} finally {
|
|
13
|
+
s(!1);
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
[t]
|
|
17
|
+
);
|
|
18
|
+
return { results: a, loading: c, error: l, search: u };
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
m as useKbSearch
|
|
22
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convenience hook that returns an MDX render function bound to the consumer's
|
|
3
|
+
* component registry + the SDK's image renderer (from KbProvider context).
|
|
4
|
+
*
|
|
5
|
+
* const renderMdx = useMdxContent({ components })
|
|
6
|
+
* return <article>{renderMdx(article.content)}</article>
|
|
7
|
+
*
|
|
8
|
+
* The hook is sugar over `<KbMdxContent>` — same prepareProps guarantee,
|
|
9
|
+
* same fallback UX. Useful when a parent already manages layout and wants
|
|
10
|
+
* to keep the render inline.
|
|
11
|
+
*/
|
|
12
|
+
import type { ReactNode } from 'react';
|
|
13
|
+
import { type KbMdxComponentRegistry } from '../KbMdxContent';
|
|
14
|
+
export interface UseMdxContentOptions {
|
|
15
|
+
/** Component registry mapping schema names → React components. */
|
|
16
|
+
components?: KbMdxComponentRegistry;
|
|
17
|
+
}
|
|
18
|
+
export declare function useMdxContent(opts?: UseMdxContentOptions): (content: string) => ReactNode;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useImageRenderer as t } from "./useImageRenderer.js";
|
|
2
|
+
import { KbMdxContent as m } from "../KbMdxContent.js";
|
|
3
|
+
function u(e = {}) {
|
|
4
|
+
const n = t(), o = e.components ?? {};
|
|
5
|
+
return function(r) {
|
|
6
|
+
return m({ content: r, components: o, imageRenderer: n });
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
u as useMdxContent
|
|
11
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React client adapter for the KB Blog SDK (`@blogmcp/sdk/react`).
|
|
3
|
+
*
|
|
4
|
+
* Provider + hooks for the interactive client surface. Server-side data
|
|
5
|
+
* fetching lives in `@blogmcp/sdk/react/server` (directive-free, RSC-safe).
|
|
6
|
+
*/
|
|
7
|
+
export { KbProvider } from './provider';
|
|
8
|
+
export type { KbProviderProps } from './provider';
|
|
9
|
+
export { KbContext } from './context';
|
|
10
|
+
export type { KbContextValue } from './context';
|
|
11
|
+
export { useKbClient } from './hooks/useKbClient';
|
|
12
|
+
export { useKbI18n } from './hooks/useKbI18n';
|
|
13
|
+
export { useImageRenderer } from './hooks/useImageRenderer';
|
|
14
|
+
export { useKbLanguage } from './hooks/useKbLanguage';
|
|
15
|
+
export type { UseKbLanguageReturn } from './hooks/useKbLanguage';
|
|
16
|
+
export { useKbSearch } from './hooks/useKbSearch';
|
|
17
|
+
export type { UseKbSearchReturn, SearchMode } from './hooks/useKbSearch';
|
|
18
|
+
export { KbMdxContent } from './KbMdxContent';
|
|
19
|
+
export type { KbMdxContentProps, KbMdxComponentRegistry } from './KbMdxContent';
|
|
20
|
+
export { useMdxContent } from './hooks/useMdxContent';
|
|
21
|
+
export type { UseMdxContentOptions } from './hooks/useMdxContent';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { KbProvider as o } from "./provider.js";
|
|
2
|
+
import { KbContext as x } from "./context.js";
|
|
3
|
+
import { useKbClient as f } from "./hooks/useKbClient.js";
|
|
4
|
+
import { useKbI18n as p } from "./hooks/useKbI18n.js";
|
|
5
|
+
import { useImageRenderer as u } from "./hooks/useImageRenderer.js";
|
|
6
|
+
import { useKbLanguage as s } from "./hooks/useKbLanguage.js";
|
|
7
|
+
import { useKbSearch as d } from "./hooks/useKbSearch.js";
|
|
8
|
+
import { KbMdxContent as g } from "./KbMdxContent.js";
|
|
9
|
+
import { useMdxContent as I } from "./hooks/useMdxContent.js";
|
|
10
|
+
export {
|
|
11
|
+
x as KbContext,
|
|
12
|
+
g as KbMdxContent,
|
|
13
|
+
o as KbProvider,
|
|
14
|
+
u as useImageRenderer,
|
|
15
|
+
f as useKbClient,
|
|
16
|
+
p as useKbI18n,
|
|
17
|
+
s as useKbLanguage,
|
|
18
|
+
d as useKbSearch,
|
|
19
|
+
I as useMdxContent
|
|
20
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React provider for the KB Blog SDK — the analogue of the Vue `KbVue` plugin.
|
|
3
|
+
*
|
|
4
|
+
* <KbProvider endpoint="https://api.example.com/graphql" locale="en">
|
|
5
|
+
* <App />
|
|
6
|
+
* </KbProvider>
|
|
7
|
+
*
|
|
8
|
+
* Use this for the client-side interactive surface (search, language switch,
|
|
9
|
+
* comments). Server Components fetch via `createServerKbClient()` instead.
|
|
10
|
+
*/
|
|
11
|
+
import { type ReactNode } from 'react';
|
|
12
|
+
import type { KbClientConfig, ImageHtmlRenderer, TokenStorage } from '../core/client-types';
|
|
13
|
+
import type { TranslateFn } from '../core/i18n';
|
|
14
|
+
export interface KbProviderProps extends KbClientConfig {
|
|
15
|
+
/** Custom auth token storage. Defaults to localStorage in browser, memory on server. */
|
|
16
|
+
tokenStorage?: TokenStorage;
|
|
17
|
+
/** Translation function. Defaults to the built-in createKbI18n. */
|
|
18
|
+
i18n?: TranslateFn;
|
|
19
|
+
/** Default locale for the built-in i18n (if `i18n` not provided). Defaults to 'en'. */
|
|
20
|
+
locale?: string;
|
|
21
|
+
/** Image HTML renderer for MDX content. Defaults to a plain <img>. */
|
|
22
|
+
imageRenderer?: ImageHtmlRenderer;
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare function KbProvider({ children, tokenStorage, i18n, locale, imageRenderer, ...clientConfig }: KbProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as u } from "react";
|
|
3
|
+
import { createKbClient as c } from "../core/client.js";
|
|
4
|
+
import { createAuthManager as f, createLocalStorageTokenStorage as g, createMemoryTokenStorage as v } from "../core/auth.js";
|
|
5
|
+
import { createKbI18n as S } from "../core/i18n.js";
|
|
6
|
+
import { defaultImageHtml as b } from "../core/markdown.js";
|
|
7
|
+
import { KbContext as K } from "./context.js";
|
|
8
|
+
function P({
|
|
9
|
+
children: t,
|
|
10
|
+
tokenStorage: n,
|
|
11
|
+
i18n: m,
|
|
12
|
+
locale: r,
|
|
13
|
+
imageRenderer: a,
|
|
14
|
+
...e
|
|
15
|
+
}) {
|
|
16
|
+
const i = u(() => {
|
|
17
|
+
const o = n || (typeof window < "u" ? g() : v()), p = c({ ...e, tokenStorage: o }), d = f(o);
|
|
18
|
+
return {
|
|
19
|
+
client: p,
|
|
20
|
+
auth: d,
|
|
21
|
+
i18n: m || S(r || "en"),
|
|
22
|
+
imageRenderer: a || b
|
|
23
|
+
};
|
|
24
|
+
}, [e.endpoint, e.serverEndpoint, e.isServer, r]);
|
|
25
|
+
return /* @__PURE__ */ s(K.Provider, { value: i, children: t });
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
P as KbProvider
|
|
29
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-only helpers for React Server Components, route handlers, and
|
|
3
|
+
* `generateMetadata`. Intentionally directive-free (no `'use client'`) and
|
|
4
|
+
* importing NO React, so it stays tree-shakeable in the server graph.
|
|
5
|
+
*
|
|
6
|
+
* Server Components fetch by calling `createServerKbClient()` directly and
|
|
7
|
+
* `await`-ing the core client — no hooks, no context. This is the App Router
|
|
8
|
+
* analogue of Nuxt's `useAsyncData`.
|
|
9
|
+
*/
|
|
10
|
+
import type { KbClient } from '../../core/client';
|
|
11
|
+
import type { Fetcher, KbClientConfig, TokenStorage } from '../../core/client-types';
|
|
12
|
+
export interface NextFetcherOptions {
|
|
13
|
+
/** ISR revalidate seconds threaded into Next's fetch cache (`false` = no revalidate). */
|
|
14
|
+
revalidate?: number | false;
|
|
15
|
+
/** Next cache tags for on-demand revalidation. */
|
|
16
|
+
tags?: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A `Fetcher` that threads Next.js fetch caching (`revalidate` / `tags`) into
|
|
20
|
+
* SDK requests. Mirrors the SDK's default fetcher: returns the parsed GraphQL
|
|
21
|
+
* `{ data, errors }` body; the client checks `errors`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createNextFetcher(options?: NextFetcherOptions): Fetcher;
|
|
24
|
+
export interface CreateServerKbClientOptions extends Omit<KbClientConfig, 'isServer' | 'fetcher' | 'tokenStorage'> {
|
|
25
|
+
/** Override the fetcher. Defaults to `createNextFetcher(next)`. */
|
|
26
|
+
fetcher?: Fetcher;
|
|
27
|
+
/** Per-request token storage (e.g. seeded from cookies). Defaults to in-memory. */
|
|
28
|
+
tokenStorage?: TokenStorage;
|
|
29
|
+
/** Next ISR options used when no explicit `fetcher` is provided. */
|
|
30
|
+
next?: NextFetcherOptions;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a per-request KbClient for Server Components / route handlers.
|
|
34
|
+
*
|
|
35
|
+
* MUST be called per request — never assign the result to a module-scope
|
|
36
|
+
* singleton, or one request's auth token can leak into another.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createServerKbClient(options: CreateServerKbClientOptions): KbClient;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createKbClient as a } from "../../core/client.js";
|
|
2
|
+
import { createMemoryTokenStorage as c } from "../../core/auth.js";
|
|
3
|
+
function s(t = {}) {
|
|
4
|
+
return async (r, e) => {
|
|
5
|
+
const o = {
|
|
6
|
+
method: e.method,
|
|
7
|
+
headers: e.headers,
|
|
8
|
+
body: e.body,
|
|
9
|
+
next: { revalidate: t.revalidate, tags: t.tags }
|
|
10
|
+
};
|
|
11
|
+
return (await fetch(r, o)).json();
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function h(t) {
|
|
15
|
+
const { fetcher: r, tokenStorage: e, next: o, ...n } = t;
|
|
16
|
+
return a({
|
|
17
|
+
...n,
|
|
18
|
+
isServer: !0,
|
|
19
|
+
fetcher: r || s(o),
|
|
20
|
+
tokenStorage: e || c()
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
s as createNextFetcher,
|
|
25
|
+
h as createServerKbClient
|
|
26
|
+
};
|
package/dist/sdk.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.mdx-content[data-v-920ab56a] .broken-image{display:inline-block;min-height:4rem;min-width:8rem;background:#f3f4f6;border:1px dashed #d1d5db;border-radius:.5rem}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AccessLevel } from '../../core/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
article: {
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string | null;
|
|
6
|
+
};
|
|
7
|
+
requiredLevel: AccessLevel;
|
|
8
|
+
};
|
|
9
|
+
declare var __VLS_1: {
|
|
10
|
+
article: {
|
|
11
|
+
title: string;
|
|
12
|
+
description?: string | null;
|
|
13
|
+
};
|
|
14
|
+
requiredLevel: AccessLevel;
|
|
15
|
+
levelLabel: string;
|
|
16
|
+
isAuthenticated: boolean;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_Slots = {} & {
|
|
19
|
+
default?: (props: typeof __VLS_1) => any;
|
|
20
|
+
};
|
|
21
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
22
|
+
signIn: () => any;
|
|
23
|
+
upgrade: () => any;
|
|
24
|
+
browseFree: () => any;
|
|
25
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
26
|
+
onSignIn?: (() => any) | undefined;
|
|
27
|
+
onUpgrade?: (() => any) | undefined;
|
|
28
|
+
onBrowseFree?: (() => any) | undefined;
|
|
29
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
31
|
+
export default _default;
|
|
32
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
33
|
+
new (): {
|
|
34
|
+
$slots: S;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineComponent as y, computed as h, renderSlot as k, unref as t, createElementVNode as r, createElementBlock as i, createCommentVNode as v, toDisplayString as l, openBlock as o, Fragment as g, createTextVNode as b } from "vue";
|
|
2
|
+
import { useKbAuth as w } from "../composables/useKbAuth.js";
|
|
3
|
+
import { useKbI18n as A } from "../composables/useKbI18n.js";
|
|
4
|
+
const C = {
|
|
5
|
+
"data-testid": "access-gate",
|
|
6
|
+
class: "rounded-xl border border-gray-200 bg-gray-50 p-8 text-center"
|
|
7
|
+
}, G = { class: "mt-6 text-2xl font-bold text-gray-900" }, L = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "mt-2 text-gray-600"
|
|
10
|
+
}, q = { class: "mt-6 text-gray-600" }, I = { class: "mt-8 flex flex-col items-center gap-4 sm:flex-row sm:justify-center" }, j = /* @__PURE__ */ y({
|
|
11
|
+
__name: "KbAccessGate",
|
|
12
|
+
props: {
|
|
13
|
+
article: {},
|
|
14
|
+
requiredLevel: {}
|
|
15
|
+
},
|
|
16
|
+
emits: ["signIn", "upgrade", "browseFree"],
|
|
17
|
+
setup(s, { emit: x }) {
|
|
18
|
+
const f = s, c = x, { isAuthenticated: u } = w(), n = A(), d = h(() => n(`accessGate.level${p(f.requiredLevel)}`));
|
|
19
|
+
function p(a) {
|
|
20
|
+
return a.charAt(0).toUpperCase() + a.slice(1);
|
|
21
|
+
}
|
|
22
|
+
return (a, e) => k(a.$slots, "default", {
|
|
23
|
+
article: s.article,
|
|
24
|
+
requiredLevel: s.requiredLevel,
|
|
25
|
+
levelLabel: d.value,
|
|
26
|
+
isAuthenticated: t(u)
|
|
27
|
+
}, () => [
|
|
28
|
+
r("div", C, [
|
|
29
|
+
e[3] || (e[3] = r("div", { class: "mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-blue-50" }, [
|
|
30
|
+
r("svg", {
|
|
31
|
+
class: "h-8 w-8 text-blue-600",
|
|
32
|
+
fill: "none",
|
|
33
|
+
stroke: "currentColor",
|
|
34
|
+
viewBox: "0 0 24 24"
|
|
35
|
+
}, [
|
|
36
|
+
r("path", {
|
|
37
|
+
"stroke-linecap": "round",
|
|
38
|
+
"stroke-linejoin": "round",
|
|
39
|
+
"stroke-width": "2",
|
|
40
|
+
d: "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"
|
|
41
|
+
})
|
|
42
|
+
])
|
|
43
|
+
], -1)),
|
|
44
|
+
r("h2", G, l(s.article.title), 1),
|
|
45
|
+
s.article.description ? (o(), i("p", L, l(s.article.description), 1)) : v("", !0),
|
|
46
|
+
r("p", q, [
|
|
47
|
+
t(u) ? (o(), i(g, { key: 1 }, [
|
|
48
|
+
b(l(t(n)("accessGate.requiresAccess", { level: d.value })), 1)
|
|
49
|
+
], 64)) : (o(), i(g, { key: 0 }, [
|
|
50
|
+
b(l(t(n)("accessGate.signInToAccess", { level: d.value })), 1)
|
|
51
|
+
], 64))
|
|
52
|
+
]),
|
|
53
|
+
r("div", I, [
|
|
54
|
+
t(u) ? s.requiredLevel === "premium" ? (o(), i("button", {
|
|
55
|
+
key: 1,
|
|
56
|
+
class: "inline-flex items-center rounded-lg bg-blue-600 px-6 py-3 font-medium text-white hover:bg-blue-700",
|
|
57
|
+
onClick: e[1] || (e[1] = (m) => c("upgrade"))
|
|
58
|
+
}, l(t(n)("accessGate.upgradeToPremium")), 1)) : v("", !0) : (o(), i("button", {
|
|
59
|
+
key: 0,
|
|
60
|
+
class: "inline-flex items-center rounded-lg bg-blue-600 px-6 py-3 font-medium text-white hover:bg-blue-700",
|
|
61
|
+
onClick: e[0] || (e[0] = (m) => c("signIn"))
|
|
62
|
+
}, l(t(n)("accessGate.signIn")), 1)),
|
|
63
|
+
r("button", {
|
|
64
|
+
class: "inline-flex items-center text-gray-600 hover:text-gray-900",
|
|
65
|
+
onClick: e[2] || (e[2] = (m) => c("browseFree"))
|
|
66
|
+
}, l(t(n)("accessGate.browseFreeArticles")), 1)
|
|
67
|
+
])
|
|
68
|
+
])
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
j as default
|
|
74
|
+
};
|