@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,34 @@
|
|
|
1
|
+
import type { Article } from '../../core/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
article: Article;
|
|
4
|
+
featured?: boolean;
|
|
5
|
+
locale?: string;
|
|
6
|
+
};
|
|
7
|
+
declare function formatDate(dateString: string): string;
|
|
8
|
+
declare var __VLS_1: {
|
|
9
|
+
article: Article;
|
|
10
|
+
slug: string;
|
|
11
|
+
articleUrl: string;
|
|
12
|
+
tags: string[];
|
|
13
|
+
displayDate: string;
|
|
14
|
+
featured: boolean;
|
|
15
|
+
formatDate: typeof formatDate;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_Slots = {} & {
|
|
18
|
+
default?: (props: typeof __VLS_1) => any;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
|
+
click: (article: Article) => any;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
+
onClick?: ((article: Article) => any) | undefined;
|
|
24
|
+
}>, {
|
|
25
|
+
locale: string;
|
|
26
|
+
featured: boolean;
|
|
27
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { defineComponent as b, computed as s, renderSlot as k, createElementVNode as a, normalizeClass as n, createElementBlock as r, createCommentVNode as o, openBlock as c, Fragment as w, renderList as p, toDisplayString as d } from "vue";
|
|
2
|
+
const C = ["src", "alt"], D = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "mb-3 flex flex-wrap gap-2"
|
|
5
|
+
}, S = ["href"], U = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "mt-2 line-clamp-2 text-gray-600"
|
|
8
|
+
}, $ = { class: "mt-auto pt-4 text-sm text-gray-500" }, A = { key: 0 }, z = /* @__PURE__ */ b({
|
|
9
|
+
__name: "KbArticleCard",
|
|
10
|
+
props: {
|
|
11
|
+
article: {},
|
|
12
|
+
featured: { type: Boolean, default: !1 },
|
|
13
|
+
locale: { default: "en" }
|
|
14
|
+
},
|
|
15
|
+
emits: ["click"],
|
|
16
|
+
setup(e, { emit: y }) {
|
|
17
|
+
const t = e, h = y, g = s(
|
|
18
|
+
() => t.article.slug || t.article.filename.replace(/\.(md|mdx)$/, "")
|
|
19
|
+
), v = s(() => `/articles/${g.value}`), u = s(() => t.article.tags || []);
|
|
20
|
+
function x(l) {
|
|
21
|
+
const i = t.locale === "cs" ? "cs-CZ" : "en-US";
|
|
22
|
+
return new Date(l).toLocaleDateString(i, {
|
|
23
|
+
year: "numeric",
|
|
24
|
+
month: "long",
|
|
25
|
+
day: "numeric"
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const m = s(() => {
|
|
29
|
+
const l = t.article.publishedAt || t.article.updatedAt;
|
|
30
|
+
return l ? x(l) : "";
|
|
31
|
+
});
|
|
32
|
+
return (l, i) => k(l.$slots, "default", {
|
|
33
|
+
article: e.article,
|
|
34
|
+
slug: g.value,
|
|
35
|
+
articleUrl: v.value,
|
|
36
|
+
tags: u.value,
|
|
37
|
+
displayDate: m.value,
|
|
38
|
+
featured: e.featured,
|
|
39
|
+
formatDate: x
|
|
40
|
+
}, () => [
|
|
41
|
+
a("article", {
|
|
42
|
+
class: n([
|
|
43
|
+
"group relative overflow-hidden rounded-xl border border-gray-200 bg-white transition-all duration-200 hover:shadow-lg",
|
|
44
|
+
e.featured ? "md:col-span-2 md:flex" : ""
|
|
45
|
+
]),
|
|
46
|
+
onClick: i[0] || (i[0] = (f) => h("click", e.article))
|
|
47
|
+
}, [
|
|
48
|
+
e.article.featuredImageUrl ? (c(), r("div", {
|
|
49
|
+
key: 0,
|
|
50
|
+
class: n(["overflow-hidden bg-gray-100", e.featured ? "md:w-1/2" : "aspect-video"])
|
|
51
|
+
}, [
|
|
52
|
+
a("img", {
|
|
53
|
+
src: e.article.featuredImageUrl,
|
|
54
|
+
alt: e.article.title || "",
|
|
55
|
+
class: "h-full w-full object-cover",
|
|
56
|
+
loading: "lazy"
|
|
57
|
+
}, null, 8, C)
|
|
58
|
+
], 2)) : o("", !0),
|
|
59
|
+
a("div", {
|
|
60
|
+
class: n(["flex flex-col p-5", e.featured ? "md:w-1/2 md:p-6" : ""])
|
|
61
|
+
}, [
|
|
62
|
+
u.value.length > 0 ? (c(), r("div", D, [
|
|
63
|
+
(c(!0), r(w, null, p(u.value.slice(0, 3), (f) => (c(), r("span", {
|
|
64
|
+
key: f,
|
|
65
|
+
class: "rounded-full bg-blue-50 px-2.5 py-0.5 text-xs font-medium text-blue-600"
|
|
66
|
+
}, d(f), 1))), 128))
|
|
67
|
+
])) : o("", !0),
|
|
68
|
+
a("h3", {
|
|
69
|
+
class: n(["font-semibold text-gray-900", e.featured ? "text-xl md:text-2xl" : "text-lg"])
|
|
70
|
+
}, [
|
|
71
|
+
a("a", {
|
|
72
|
+
href: v.value,
|
|
73
|
+
class: "after:absolute after:inset-0"
|
|
74
|
+
}, d(e.article.title), 9, S)
|
|
75
|
+
], 2),
|
|
76
|
+
e.article.description ? (c(), r("p", U, d(e.article.description), 1)) : o("", !0),
|
|
77
|
+
a("div", $, [
|
|
78
|
+
m.value ? (c(), r("time", A, d(m.value), 1)) : o("", !0)
|
|
79
|
+
])
|
|
80
|
+
], 2)
|
|
81
|
+
], 2)
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
export {
|
|
86
|
+
z as default
|
|
87
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
content: string;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { defineComponent as L, withAsyncContext as x, inject as b, computed as E, createElementBlock as g, openBlock as l, Fragment as B, renderList as I, createBlock as O, resolveDynamicComponent as X, h as a } from "vue";
|
|
2
|
+
import { KB_IMAGE_RENDERER_KEY as F } from "../plugin.js";
|
|
3
|
+
import { defaultImageHtml as K, createMarkedInstance as Z, parseMarkdownSafe as z } from "../../core/markdown.js";
|
|
4
|
+
import { prepareProps as J } from "../../packages/mdx-schema/dist/prepareProps.js";
|
|
5
|
+
import { getComponentMetadata as W } from "../../packages/mdx-schema/dist/metadata/index.js";
|
|
6
|
+
import { sanitizeHtml as j } from "../../packages/sanitize/dist/html.js";
|
|
7
|
+
import "../../_virtual/index.js";
|
|
8
|
+
const G = { class: "mdx-content" }, U = ["innerHTML"], ne = /* @__PURE__ */ L({
|
|
9
|
+
__name: "KbMdxContent",
|
|
10
|
+
props: {
|
|
11
|
+
content: {}
|
|
12
|
+
},
|
|
13
|
+
async setup(R) {
|
|
14
|
+
let s, p, d, u, f, h, c, _;
|
|
15
|
+
try {
|
|
16
|
+
const e = ([s, p] = x(() => import("../../packages/mdx-schema/dist/composables/useMdxParsing.js")), s = await s, p(), s);
|
|
17
|
+
d = e.parseJsxProps, u = e.stripFrontmatter, f = e.HAS_MDX_RE, h = e.MDX_COMPONENT_PATTERN;
|
|
18
|
+
const n = ([s, p] = x(() => import("../../packages/mdx-render-vue/dist/registry.js")), s = await s, p(), s);
|
|
19
|
+
c = n.getWrappedRenderComponent, _ = (t) => t in n.componentRegistry;
|
|
20
|
+
} catch {
|
|
21
|
+
d = () => ({}), u = (e) => e.replace(/^---[\s\S]*?---\n?/, ""), f = /<[A-Z]/, h = /<([A-Z]\w+)([^>]*)>([\s\S]*?)<\/\1>|<([A-Z]\w+)([^>]*)\/>/, c = null, _ = () => !1;
|
|
22
|
+
}
|
|
23
|
+
const M = R, v = b(F, K);
|
|
24
|
+
function H(e) {
|
|
25
|
+
if (c && _(e))
|
|
26
|
+
return c(e, "default");
|
|
27
|
+
}
|
|
28
|
+
const T = Z({
|
|
29
|
+
imageRenderer: v
|
|
30
|
+
// sanitize: undefined — parseMarkdownSafe applies it below
|
|
31
|
+
});
|
|
32
|
+
function i(e) {
|
|
33
|
+
return z(e, T, j);
|
|
34
|
+
}
|
|
35
|
+
const y = E(() => {
|
|
36
|
+
if (!M.content) return { mode: "html", html: "", items: [] };
|
|
37
|
+
const e = u(M.content);
|
|
38
|
+
if (!f.test(e))
|
|
39
|
+
return { mode: "html", html: i(e), items: [] };
|
|
40
|
+
const n = new RegExp(h.source, "g"), t = [];
|
|
41
|
+
let o = 0, r;
|
|
42
|
+
for (; (r = n.exec(e)) !== null; ) {
|
|
43
|
+
if (r.index > o) {
|
|
44
|
+
const w = e.slice(o, r.index);
|
|
45
|
+
w.trim() && t.push({ type: "html", content: i(w) });
|
|
46
|
+
}
|
|
47
|
+
const m = r[1] || r[4] || "", N = r[1] ? r[2] || "" : r[5] || "", D = r[3], k = d(N), C = W(m), S = C ? J(k, C) : k;
|
|
48
|
+
t.push({ type: "component", name: m, props: S, children: D?.trim() }), o = r.index + r[0].length;
|
|
49
|
+
}
|
|
50
|
+
if (o < e.length) {
|
|
51
|
+
const m = e.slice(o);
|
|
52
|
+
m.trim() && t.push({ type: "html", content: i(m) });
|
|
53
|
+
}
|
|
54
|
+
return t.length === 0 && e.trim() ? { mode: "html", html: i(e), items: [] } : { mode: "mdx", html: "", items: t };
|
|
55
|
+
});
|
|
56
|
+
function A(e) {
|
|
57
|
+
return e.map((n, t) => {
|
|
58
|
+
if (n.type === "html")
|
|
59
|
+
return a("div", { key: t, innerHTML: n.content });
|
|
60
|
+
if (n.type === "component") {
|
|
61
|
+
const o = H(n.name);
|
|
62
|
+
return o ? a(o, { key: t, ...n.props }, () => n.children) : a("div", {
|
|
63
|
+
key: t,
|
|
64
|
+
class: "bg-yellow-50 border border-yellow-200 rounded-lg p-4 my-4 text-yellow-800",
|
|
65
|
+
innerHTML: `Unknown component: ${n.name}`
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return a("span", { key: t });
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const P = E(() => A(y.value.items));
|
|
72
|
+
return (e, n) => (l(), g("div", G, [
|
|
73
|
+
y.value.mode === "mdx" ? (l(!0), g(B, { key: 0 }, I(P.value, (t, o) => (l(), O(X(t), { key: o }))), 128)) : (l(), g("div", {
|
|
74
|
+
key: 1,
|
|
75
|
+
innerHTML: y.value.html
|
|
76
|
+
}, null, 8, U))
|
|
77
|
+
]));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
export {
|
|
81
|
+
ne as default
|
|
82
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { Article, ArticleWithTranslation } from '../../core/types';
|
|
3
|
+
export interface ArticleListParams {
|
|
4
|
+
status?: string;
|
|
5
|
+
limit?: number;
|
|
6
|
+
offset?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface UseArticleListReturn {
|
|
9
|
+
articles: Ref<Article[]>;
|
|
10
|
+
totalCount: Ref<number>;
|
|
11
|
+
loading: Ref<boolean>;
|
|
12
|
+
error: Ref<Error | null>;
|
|
13
|
+
fetch: (params?: ArticleListParams) => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Reactive article list composable.
|
|
17
|
+
* Works in any Vue 3 app. For Nuxt SSR, use useAsyncArticleList from /nuxt.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useArticleList(initialParams?: ArticleListParams): UseArticleListReturn;
|
|
20
|
+
export interface UseArticleReturn {
|
|
21
|
+
article: Ref<ArticleWithTranslation | null>;
|
|
22
|
+
loading: Ref<boolean>;
|
|
23
|
+
error: Ref<Error | null>;
|
|
24
|
+
fetch: (filename: string, languageCode: string) => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Reactive single article composable.
|
|
28
|
+
* For Nuxt SSR, use useAsyncArticle from /nuxt.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useArticle(): UseArticleReturn;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ref as e } from "vue";
|
|
2
|
+
import { useKbClient as u } from "./useKbClient.js";
|
|
3
|
+
function h(o) {
|
|
4
|
+
const i = u(), l = e([]), n = e(0), r = e(!1), c = e(null);
|
|
5
|
+
async function s(t) {
|
|
6
|
+
r.value = !0, c.value = null;
|
|
7
|
+
try {
|
|
8
|
+
const a = await i.articles.list(t ?? o);
|
|
9
|
+
l.value = a.accessibleKbArticles.articles, n.value = a.accessibleKbArticles.totalCount;
|
|
10
|
+
} catch (a) {
|
|
11
|
+
c.value = a instanceof Error ? a : new Error(String(a));
|
|
12
|
+
} finally {
|
|
13
|
+
r.value = !1;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return { articles: l, totalCount: n, loading: r, error: c, fetch: s };
|
|
17
|
+
}
|
|
18
|
+
function y() {
|
|
19
|
+
const o = u(), i = e(null), l = e(!1), n = e(null);
|
|
20
|
+
async function r(c, s) {
|
|
21
|
+
l.value = !0, n.value = null;
|
|
22
|
+
try {
|
|
23
|
+
const t = await o.articles.getWithTranslation(c, s);
|
|
24
|
+
i.value = t.articleWithTranslation;
|
|
25
|
+
} catch (t) {
|
|
26
|
+
n.value = t instanceof Error ? t : new Error(String(t));
|
|
27
|
+
} finally {
|
|
28
|
+
l.value = !1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return { article: i, loading: l, error: n, fetch: r };
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
y as useArticle,
|
|
35
|
+
h as useArticleList
|
|
36
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Ref, type ComputedRef } from 'vue';
|
|
2
|
+
import type { AuthUser, AccessLevel, AuthResult, RegisterResult } from '../../core/types';
|
|
3
|
+
export interface UseKbAuthReturn {
|
|
4
|
+
user: Ref<AuthUser | null>;
|
|
5
|
+
isAuthenticated: ComputedRef<boolean>;
|
|
6
|
+
accessLevel: ComputedRef<AccessLevel>;
|
|
7
|
+
hasAccess: (required: AccessLevel) => boolean;
|
|
8
|
+
login: (token: string, user?: AuthUser) => void;
|
|
9
|
+
logout: () => void;
|
|
10
|
+
loginWithEmail: (email: string, password: string) => Promise<AuthResult>;
|
|
11
|
+
register: (email: string, password: string, name?: string) => Promise<RegisterResult>;
|
|
12
|
+
verifyEmail: (token: string) => Promise<{
|
|
13
|
+
success: boolean;
|
|
14
|
+
error?: string;
|
|
15
|
+
}>;
|
|
16
|
+
forgotPassword: (email: string) => Promise<RegisterResult>;
|
|
17
|
+
resetPassword: (token: string, password: string) => Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
error?: string;
|
|
20
|
+
}>;
|
|
21
|
+
resendVerification: (email: string) => Promise<RegisterResult>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Vue composable wrapping the core AuthManager.
|
|
25
|
+
* Provides reactive auth state + mutation methods.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useKbAuth(): UseKbAuthReturn;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { inject as i, ref as b, computed as u } from "vue";
|
|
2
|
+
import { KB_AUTH_KEY as C, KB_CLIENT_KEY as K } from "../plugin.js";
|
|
3
|
+
function P() {
|
|
4
|
+
const n = i(C), t = i(K);
|
|
5
|
+
if (!n)
|
|
6
|
+
throw new Error("useKbAuth() requires KbVue plugin.");
|
|
7
|
+
const c = b(n.getUser()), l = u(() => c.value !== null), f = u(() => c.value?.accessLevel || "public");
|
|
8
|
+
function d(r) {
|
|
9
|
+
return n.hasAccess(r);
|
|
10
|
+
}
|
|
11
|
+
function o(r, e) {
|
|
12
|
+
n.login(r, e), c.value = n.getUser();
|
|
13
|
+
}
|
|
14
|
+
function g() {
|
|
15
|
+
n.logout(), c.value = null;
|
|
16
|
+
}
|
|
17
|
+
async function h(r, e) {
|
|
18
|
+
if (!t) return { success: !1, error: "Client not available" };
|
|
19
|
+
try {
|
|
20
|
+
const a = (await t.auth.login(r, e)).login;
|
|
21
|
+
return a.success && a.token && o(a.token, a.user), a;
|
|
22
|
+
} catch (s) {
|
|
23
|
+
return { success: !1, error: s instanceof Error ? s.message : "Login failed" };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function m(r, e, s) {
|
|
27
|
+
if (!t) return { success: !1, error: "Client not available" };
|
|
28
|
+
try {
|
|
29
|
+
return (await t.auth.register(r, e, s)).register;
|
|
30
|
+
} catch (a) {
|
|
31
|
+
return { success: !1, error: a instanceof Error ? a.message : "Registration failed" };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function v(r) {
|
|
35
|
+
if (!t) return { success: !1, error: "Client not available" };
|
|
36
|
+
try {
|
|
37
|
+
return (await t.auth.verifyEmail(r)).verifyEmail;
|
|
38
|
+
} catch (e) {
|
|
39
|
+
return { success: !1, error: e instanceof Error ? e.message : "Verification failed" };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function y(r) {
|
|
43
|
+
if (!t) return { success: !1, error: "Client not available" };
|
|
44
|
+
try {
|
|
45
|
+
return (await t.auth.forgotPassword(r)).forgotPassword;
|
|
46
|
+
} catch (e) {
|
|
47
|
+
return { success: !1, error: e instanceof Error ? e.message : "Request failed" };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async function w(r, e) {
|
|
51
|
+
if (!t) return { success: !1, error: "Client not available" };
|
|
52
|
+
try {
|
|
53
|
+
return (await t.auth.resetPassword(r, e)).resetPassword;
|
|
54
|
+
} catch (s) {
|
|
55
|
+
return { success: !1, error: s instanceof Error ? s.message : "Reset failed" };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function E(r) {
|
|
59
|
+
if (!t) return { success: !1, error: "Client not available" };
|
|
60
|
+
try {
|
|
61
|
+
return (await t.auth.resendVerification(r)).resendVerification;
|
|
62
|
+
} catch (e) {
|
|
63
|
+
return { success: !1, error: e instanceof Error ? e.message : "Request failed" };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
user: c,
|
|
68
|
+
isAuthenticated: l,
|
|
69
|
+
accessLevel: f,
|
|
70
|
+
hasAccess: d,
|
|
71
|
+
login: o,
|
|
72
|
+
logout: g,
|
|
73
|
+
loginWithEmail: h,
|
|
74
|
+
register: m,
|
|
75
|
+
verifyEmail: v,
|
|
76
|
+
forgotPassword: y,
|
|
77
|
+
resetPassword: w,
|
|
78
|
+
resendVerification: E
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
P as useKbAuth
|
|
83
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { inject as r } from "vue";
|
|
2
|
+
import { KB_CLIENT_KEY as t } from "../plugin.js";
|
|
3
|
+
function o() {
|
|
4
|
+
const e = r(t);
|
|
5
|
+
if (!e)
|
|
6
|
+
throw new Error(
|
|
7
|
+
'useKbClient() requires KbVue plugin. Call app.use(KbVue, { endpoint: "..." }) first.'
|
|
8
|
+
);
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
o as useKbClient
|
|
13
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comments composable with immutable tree operations.
|
|
3
|
+
*
|
|
4
|
+
* Ported from blog/app/composables/useComments.ts.
|
|
5
|
+
* Key difference: uses inject(KB_CLIENT_KEY) instead of direct executeGraphQL,
|
|
6
|
+
* and subscriptions are optional (provide via createSubscriptionClient).
|
|
7
|
+
*/
|
|
8
|
+
import { type Ref, type DeepReadonly } from 'vue';
|
|
9
|
+
import type { Comment, CommentResult } from '../../core/types';
|
|
10
|
+
export interface UseKbCommentsReturn {
|
|
11
|
+
comments: DeepReadonly<Ref<Comment[]>>;
|
|
12
|
+
totalCount: DeepReadonly<Ref<number>>;
|
|
13
|
+
loading: DeepReadonly<Ref<boolean>>;
|
|
14
|
+
error: DeepReadonly<Ref<string | null>>;
|
|
15
|
+
currentArticleId: DeepReadonly<Ref<string | null>>;
|
|
16
|
+
draftContent: Ref<string>;
|
|
17
|
+
replyingTo: Ref<string | null>;
|
|
18
|
+
editingId: Ref<string | null>;
|
|
19
|
+
editContent: Ref<string>;
|
|
20
|
+
fetchComments: (articleId: string, languageCode: string) => Promise<void>;
|
|
21
|
+
createComment: (content: string, languageCode: string, parentCommentId?: string) => Promise<CommentResult>;
|
|
22
|
+
updateComment: (commentId: string, content: string) => Promise<CommentResult>;
|
|
23
|
+
deleteComment: (commentId: string) => Promise<CommentResult>;
|
|
24
|
+
startReply: (commentId: string) => void;
|
|
25
|
+
cancelReply: () => void;
|
|
26
|
+
startEdit: (comment: Comment) => void;
|
|
27
|
+
cancelEdit: () => void;
|
|
28
|
+
isOwnComment: (comment: Comment) => boolean;
|
|
29
|
+
handleCommentEvent: (event: {
|
|
30
|
+
type: string;
|
|
31
|
+
comment: Comment | {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
}) => void;
|
|
35
|
+
clearState: () => void;
|
|
36
|
+
}
|
|
37
|
+
export declare function useKbComments(): UseKbCommentsReturn;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { ref as s, readonly as f } from "vue";
|
|
2
|
+
import { useKbClient as O } from "./useKbClient.js";
|
|
3
|
+
import { useKbAuth as S } from "./useKbAuth.js";
|
|
4
|
+
function D() {
|
|
5
|
+
const d = O(), { user: A, isAuthenticated: v } = S(), n = s([]), a = s(0), p = s(!1), C = s(null), m = s(null), h = s(""), o = s(null), i = s(null), c = s("");
|
|
6
|
+
async function R(e, u) {
|
|
7
|
+
if (e) {
|
|
8
|
+
p.value = !0, C.value = null, m.value = e;
|
|
9
|
+
try {
|
|
10
|
+
const l = await d.comments.list(e, u);
|
|
11
|
+
n.value = l.articleComments.comments || [], a.value = l.articleComments.totalCount || 0;
|
|
12
|
+
} catch (l) {
|
|
13
|
+
C.value = l instanceof Error ? l.message : "Failed to load comments", n.value = [], a.value = 0;
|
|
14
|
+
} finally {
|
|
15
|
+
p.value = !1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function T(e, u, l) {
|
|
20
|
+
if (!m.value)
|
|
21
|
+
return { success: !1, comment: null, error: "No article selected" };
|
|
22
|
+
if (!v.value)
|
|
23
|
+
return { success: !1, comment: null, error: "Authentication required" };
|
|
24
|
+
try {
|
|
25
|
+
const r = (await d.comments.create({
|
|
26
|
+
articleId: m.value,
|
|
27
|
+
content: e,
|
|
28
|
+
sourceLanguageCode: u,
|
|
29
|
+
parentCommentId: l
|
|
30
|
+
})).createComment;
|
|
31
|
+
return r.success && r.comment && (l ? n.value = y(n.value, l, r.comment) : n.value = [...n.value, r.comment], a.value++, h.value = "", o.value = null), r;
|
|
32
|
+
} catch (t) {
|
|
33
|
+
return { success: !1, comment: null, error: t instanceof Error ? t.message : "Failed to create comment" };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function w(e, u) {
|
|
37
|
+
if (!v.value)
|
|
38
|
+
return { success: !1, comment: null, error: "Authentication required" };
|
|
39
|
+
try {
|
|
40
|
+
const t = (await d.comments.update(e, u)).updateComment;
|
|
41
|
+
return t.success && t.comment && (n.value = g(n.value, e, t.comment), i.value = null, c.value = ""), t;
|
|
42
|
+
} catch (l) {
|
|
43
|
+
return { success: !1, comment: null, error: l instanceof Error ? l.message : "Failed to update comment" };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function F(e) {
|
|
47
|
+
if (!v.value)
|
|
48
|
+
return { success: !1, comment: null, error: "Authentication required" };
|
|
49
|
+
try {
|
|
50
|
+
const l = (await d.comments.delete(e)).deleteComment;
|
|
51
|
+
return l.success && (n.value = E(n.value, e), a.value = Math.max(0, a.value - 1)), l;
|
|
52
|
+
} catch (u) {
|
|
53
|
+
return { success: !1, comment: null, error: u instanceof Error ? u.message : "Failed to delete comment" };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function x(e) {
|
|
57
|
+
o.value = e, i.value = null, c.value = "";
|
|
58
|
+
}
|
|
59
|
+
function k() {
|
|
60
|
+
o.value = null, h.value = "";
|
|
61
|
+
}
|
|
62
|
+
function q(e) {
|
|
63
|
+
e.userId === A.value?.id && (i.value = e.id, c.value = e.displayContent, o.value = null);
|
|
64
|
+
}
|
|
65
|
+
function K() {
|
|
66
|
+
i.value = null, c.value = "";
|
|
67
|
+
}
|
|
68
|
+
function M(e) {
|
|
69
|
+
return v.value && e.userId === A.value?.id;
|
|
70
|
+
}
|
|
71
|
+
function L() {
|
|
72
|
+
n.value = [], a.value = 0, p.value = !1, C.value = null, m.value = null, h.value = "", o.value = null, i.value = null, c.value = "";
|
|
73
|
+
}
|
|
74
|
+
function y(e, u, l) {
|
|
75
|
+
return e.map((t) => {
|
|
76
|
+
if (t.id === u)
|
|
77
|
+
return { ...t, replies: [...t.replies || [], l] };
|
|
78
|
+
if (t.replies?.length) {
|
|
79
|
+
const r = y(t.replies, u, l);
|
|
80
|
+
if (r !== t.replies)
|
|
81
|
+
return { ...t, replies: r };
|
|
82
|
+
}
|
|
83
|
+
return t;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function g(e, u, l) {
|
|
87
|
+
return e.map((t) => {
|
|
88
|
+
if (t.id === u)
|
|
89
|
+
return { ...l, replies: t.replies };
|
|
90
|
+
if (t.replies?.length) {
|
|
91
|
+
const r = g(t.replies, u, l);
|
|
92
|
+
if (r !== t.replies)
|
|
93
|
+
return { ...t, replies: r };
|
|
94
|
+
}
|
|
95
|
+
return t;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function E(e, u) {
|
|
99
|
+
const l = [];
|
|
100
|
+
for (const t of e)
|
|
101
|
+
if (t.id !== u) {
|
|
102
|
+
if (t.replies?.length) {
|
|
103
|
+
const r = E(t.replies, u);
|
|
104
|
+
if (r.length !== t.replies.length) {
|
|
105
|
+
l.push({ ...t, replies: r });
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
l.push(t);
|
|
110
|
+
}
|
|
111
|
+
return l;
|
|
112
|
+
}
|
|
113
|
+
function b(e, u) {
|
|
114
|
+
for (const l of e)
|
|
115
|
+
if (l.id === u || l.replies?.length && b(l.replies, u)) return !0;
|
|
116
|
+
return !1;
|
|
117
|
+
}
|
|
118
|
+
function N(e) {
|
|
119
|
+
if (e.comment?.id)
|
|
120
|
+
switch (e.type) {
|
|
121
|
+
case "created":
|
|
122
|
+
if (!("displayContent" in e.comment) || b(n.value, e.comment.id)) return;
|
|
123
|
+
e.comment.parentCommentId ? n.value = y(n.value, e.comment.parentCommentId, e.comment) : (n.value = [...n.value, e.comment], a.value++);
|
|
124
|
+
break;
|
|
125
|
+
case "updated":
|
|
126
|
+
case "translated":
|
|
127
|
+
if (!("displayContent" in e.comment)) return;
|
|
128
|
+
n.value = g(n.value, e.comment.id, e.comment);
|
|
129
|
+
break;
|
|
130
|
+
case "deleted":
|
|
131
|
+
n.value = E(n.value, e.comment.id), a.value = Math.max(0, a.value - 1);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
comments: f(n),
|
|
137
|
+
totalCount: f(a),
|
|
138
|
+
loading: f(p),
|
|
139
|
+
error: f(C),
|
|
140
|
+
currentArticleId: f(m),
|
|
141
|
+
draftContent: h,
|
|
142
|
+
replyingTo: o,
|
|
143
|
+
editingId: i,
|
|
144
|
+
editContent: c,
|
|
145
|
+
fetchComments: R,
|
|
146
|
+
createComment: T,
|
|
147
|
+
updateComment: w,
|
|
148
|
+
deleteComment: F,
|
|
149
|
+
startReply: x,
|
|
150
|
+
cancelReply: k,
|
|
151
|
+
startEdit: q,
|
|
152
|
+
cancelEdit: K,
|
|
153
|
+
isOwnComment: M,
|
|
154
|
+
handleCommentEvent: N,
|
|
155
|
+
clearState: L
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
export {
|
|
159
|
+
D as useKbComments
|
|
160
|
+
};
|