@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
package/src/core/seo.ts
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic SEO model builders.
|
|
3
|
+
*
|
|
4
|
+
* These compute the complete SEO surface (title, description, canonical,
|
|
5
|
+
* hreflang, Open Graph, Twitter card, schema.org JSON-LD) for the blog's page
|
|
6
|
+
* types ONCE, in pure code, so the Nuxt and Next.js reference implementations
|
|
7
|
+
* cannot drift. Each framework only maps the returned `SeoModel` into its own
|
|
8
|
+
* head mechanism (`useHead` for Nuxt, `generateMetadata` + a JSON-LD script for
|
|
9
|
+
* Next.js).
|
|
10
|
+
*
|
|
11
|
+
* i18n stays in the framework layer: callers pass already-translated strings
|
|
12
|
+
* (page title pieces, brand suffix, description).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { generateDescription } from './article-seo'
|
|
16
|
+
import type { MediaGeo, ContentImageGeo } from './types'
|
|
17
|
+
|
|
18
|
+
/** Cap on geotagged ImageObjects emitted per article (bounds JSON-LD size). */
|
|
19
|
+
const MAX_GEO_IMAGE_OBJECTS = 25
|
|
20
|
+
|
|
21
|
+
// ==================== Config ====================
|
|
22
|
+
|
|
23
|
+
export type LocalePrefixStrategy = 'prefix_except_default'
|
|
24
|
+
|
|
25
|
+
export interface SeoConfig {
|
|
26
|
+
/** Absolute site origin, no trailing slash, e.g. `https://blog.example.com`. */
|
|
27
|
+
siteUrl: string
|
|
28
|
+
/** Human site name used for `og:site_name` and the WebSite/Organization name. */
|
|
29
|
+
siteName: string
|
|
30
|
+
/** Enabled locale codes in display order, e.g. `['cs', 'en']`. */
|
|
31
|
+
locales: string[]
|
|
32
|
+
/** Default locale (rendered without a URL prefix). */
|
|
33
|
+
defaultLocale: string
|
|
34
|
+
/** URL strategy. Only `prefix_except_default` is supported today. */
|
|
35
|
+
localePrefixStrategy?: LocalePrefixStrategy
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ==================== Model ====================
|
|
39
|
+
|
|
40
|
+
export interface SeoHreflang {
|
|
41
|
+
hreflang: string
|
|
42
|
+
href: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface SeoOpenGraph {
|
|
46
|
+
title: string
|
|
47
|
+
description: string
|
|
48
|
+
type: 'website' | 'article'
|
|
49
|
+
url: string
|
|
50
|
+
siteName: string
|
|
51
|
+
image?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface SeoTwitter {
|
|
55
|
+
card: 'summary' | 'summary_large_image'
|
|
56
|
+
title: string
|
|
57
|
+
description: string
|
|
58
|
+
image?: string
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface SeoModel {
|
|
62
|
+
/** The document `<title>`. */
|
|
63
|
+
title: string
|
|
64
|
+
description: string
|
|
65
|
+
/** Absolute canonical URL of the current page. */
|
|
66
|
+
canonical: string
|
|
67
|
+
/** `<html lang>` value. */
|
|
68
|
+
htmlLang: string
|
|
69
|
+
/** Alternate-language links, including an `x-default` pointing at the default locale. */
|
|
70
|
+
hreflang: SeoHreflang[]
|
|
71
|
+
og: SeoOpenGraph
|
|
72
|
+
twitter: SeoTwitter
|
|
73
|
+
/** Present only for article pages. */
|
|
74
|
+
articleMeta?: { publishedTime?: string; modifiedTime?: string }
|
|
75
|
+
/** schema.org JSON-LD object (serialize into a `<script type="application/ld+json">`). */
|
|
76
|
+
jsonLd: Record<string, unknown>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ==================== Locale-aware URL helpers ====================
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Build a locale-aware path from a locale-agnostic logical path.
|
|
83
|
+
*
|
|
84
|
+
* Mirrors Nuxt i18n `prefix_except_default`: the default locale gets no prefix,
|
|
85
|
+
* every other locale gets a `/<locale>` prefix.
|
|
86
|
+
*/
|
|
87
|
+
export function localizedHref(logicalPath: string, locale: string, config: SeoConfig): string {
|
|
88
|
+
const path = logicalPath.startsWith('/') ? logicalPath : `/${logicalPath}`
|
|
89
|
+
if (locale === config.defaultLocale) return path
|
|
90
|
+
return path === '/' ? `/${locale}` : `/${locale}${path}`
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Remove a leading non-default locale prefix from a path, yielding the
|
|
95
|
+
* locale-agnostic logical path. `/en/articles/x` → `/articles/x`, `/en` → `/`.
|
|
96
|
+
*/
|
|
97
|
+
export function stripLocalePrefix(path: string, config: SeoConfig): string {
|
|
98
|
+
for (const loc of config.locales) {
|
|
99
|
+
if (loc === config.defaultLocale) continue
|
|
100
|
+
if (path === `/${loc}`) return '/'
|
|
101
|
+
if (path.startsWith(`/${loc}/`)) return path.slice(loc.length + 1)
|
|
102
|
+
}
|
|
103
|
+
return path
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Join a site origin and a path into an absolute URL. The root path collapses to
|
|
108
|
+
* the bare origin (no trailing slash) so that trailing-slash-normalizing SSR
|
|
109
|
+
* frameworks (Next.js, default `trailingSlash:false`) and non-normalizing ones
|
|
110
|
+
* (Nuxt) emit byte-identical canonical/hreflang URLs for the home page.
|
|
111
|
+
*/
|
|
112
|
+
export function pageUrl(siteUrl: string, path: string): string {
|
|
113
|
+
return path === '/' ? siteUrl : `${siteUrl}${path}`
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function buildHreflang(routePath: string, config: SeoConfig): SeoHreflang[] {
|
|
117
|
+
const logical = stripLocalePrefix(routePath, config)
|
|
118
|
+
const list: SeoHreflang[] = config.locales.map((loc) => ({
|
|
119
|
+
hreflang: loc,
|
|
120
|
+
href: pageUrl(config.siteUrl, localizedHref(logical, loc, config)),
|
|
121
|
+
}))
|
|
122
|
+
list.push({
|
|
123
|
+
hreflang: 'x-default',
|
|
124
|
+
href: pageUrl(config.siteUrl, localizedHref(logical, config.defaultLocale, config)),
|
|
125
|
+
})
|
|
126
|
+
return list
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function toAbsoluteUrl(url: string | null | undefined, siteUrl: string): string | undefined {
|
|
130
|
+
if (!url) return undefined
|
|
131
|
+
return url.startsWith('http') ? url : `${siteUrl}${url}`
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ==================== Article page ====================
|
|
135
|
+
|
|
136
|
+
/** Minimal structural shape an article needs to expose for SEO. */
|
|
137
|
+
export interface ArticleSeoSource {
|
|
138
|
+
title?: string
|
|
139
|
+
description?: string | null
|
|
140
|
+
content?: string
|
|
141
|
+
featuredImageUrl?: string | null
|
|
142
|
+
/**
|
|
143
|
+
* Geo of the featured image — present ONLY when the image opted in (the API
|
|
144
|
+
* gates this). When set, the JSON-LD image becomes an ImageObject with
|
|
145
|
+
* `contentLocation`, and the article gains `spatialCoverage`.
|
|
146
|
+
*/
|
|
147
|
+
featuredImageGeo?: MediaGeo | null
|
|
148
|
+
/**
|
|
149
|
+
* Geo for opted-in images referenced in the article body. Each becomes an
|
|
150
|
+
* additional ImageObject (with `contentLocation`) in the JSON-LD `image`
|
|
151
|
+
* array. Gated server-side — only opted-in images appear here.
|
|
152
|
+
*/
|
|
153
|
+
contentImagesGeo?: ContentImageGeo[] | null
|
|
154
|
+
publishedAt?: string | null
|
|
155
|
+
updatedAt?: string | null
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** schema.org Place from media geo, or undefined when coords are absent. */
|
|
159
|
+
function buildPlace(geo: MediaGeo | null | undefined): Record<string, unknown> | undefined {
|
|
160
|
+
if (!geo || typeof geo.latitude !== 'number' || typeof geo.longitude !== 'number') {
|
|
161
|
+
return undefined
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
'@type': 'Place',
|
|
165
|
+
...(geo.placeName ? { name: geo.placeName } : {}),
|
|
166
|
+
geo: {
|
|
167
|
+
'@type': 'GeoCoordinates',
|
|
168
|
+
latitude: geo.latitude,
|
|
169
|
+
longitude: geo.longitude,
|
|
170
|
+
...(geo.altitude != null ? { elevation: geo.altitude } : {}),
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface BuildArticleSeoOptions {
|
|
176
|
+
article: ArticleSeoSource
|
|
177
|
+
config: SeoConfig
|
|
178
|
+
/** Locale currently being rendered. */
|
|
179
|
+
locale: string
|
|
180
|
+
/** Current request path including any locale prefix, e.g. `/en/articles/x`. */
|
|
181
|
+
routePath: string
|
|
182
|
+
/** Translated brand suffix appended to the title (e.g. "Knowledge Base"). */
|
|
183
|
+
brandSuffix: string
|
|
184
|
+
/** Translated fallback used when the article has no title (e.g. "Articles"). */
|
|
185
|
+
fallbackTitle: string
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function buildArticleSeo(opts: BuildArticleSeoOptions): SeoModel {
|
|
189
|
+
const { article, config, locale, routePath, brandSuffix, fallbackTitle } = opts
|
|
190
|
+
|
|
191
|
+
const displayTitle = article.title || ''
|
|
192
|
+
const ogTitle = displayTitle || fallbackTitle
|
|
193
|
+
const title = `${ogTitle} | ${brandSuffix}`
|
|
194
|
+
const description =
|
|
195
|
+
article.description || generateDescription(article.content || '') || brandSuffix
|
|
196
|
+
const canonical = pageUrl(config.siteUrl, routePath)
|
|
197
|
+
const image = toAbsoluteUrl(article.featuredImageUrl, config.siteUrl)
|
|
198
|
+
|
|
199
|
+
const og: SeoOpenGraph = {
|
|
200
|
+
title: ogTitle,
|
|
201
|
+
description,
|
|
202
|
+
type: 'article',
|
|
203
|
+
url: canonical,
|
|
204
|
+
siteName: config.siteName,
|
|
205
|
+
...(image ? { image } : {}),
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const twitter: SeoTwitter = {
|
|
209
|
+
card: image ? 'summary_large_image' : 'summary',
|
|
210
|
+
title: ogTitle,
|
|
211
|
+
description,
|
|
212
|
+
...(image ? { image } : {}),
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const articleMeta = {
|
|
216
|
+
...(article.publishedAt ? { publishedTime: article.publishedAt } : {}),
|
|
217
|
+
...(article.updatedAt ? { modifiedTime: article.updatedAt } : {}),
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Build the JSON-LD `image`. Geotagged images (featured + opted-in body
|
|
221
|
+
// images) become ImageObjects carrying `contentLocation`; the article gains
|
|
222
|
+
// `spatialCoverage` from the first available place. og:/twitter: images stay
|
|
223
|
+
// plain URLs (those fields require a URL). The API has already gated geo to
|
|
224
|
+
// opted-in images only, so anything present here is safe to publish.
|
|
225
|
+
const featuredPlace = buildPlace(article.featuredImageGeo)
|
|
226
|
+
|
|
227
|
+
// Ordered, de-duplicated (by absolute URL) list of image nodes for JSON-LD.
|
|
228
|
+
const imageNodes: Array<string | Record<string, unknown>> = []
|
|
229
|
+
const seenUrls = new Set<string>()
|
|
230
|
+
let firstBodyPlace: Record<string, unknown> | undefined
|
|
231
|
+
|
|
232
|
+
if (image) {
|
|
233
|
+
seenUrls.add(image)
|
|
234
|
+
imageNodes.push(featuredPlace ? { '@type': 'ImageObject', url: image, contentLocation: featuredPlace } : image)
|
|
235
|
+
}
|
|
236
|
+
for (const ci of article.contentImagesGeo ?? []) {
|
|
237
|
+
if (imageNodes.length >= MAX_GEO_IMAGE_OBJECTS) break
|
|
238
|
+
const ciUrl = toAbsoluteUrl(ci.url, config.siteUrl)
|
|
239
|
+
if (!ciUrl || seenUrls.has(ciUrl)) continue // skip dupes (incl. the featured image)
|
|
240
|
+
const ciPlace = buildPlace(ci)
|
|
241
|
+
if (!ciPlace) continue // only emit body images that actually carry geo
|
|
242
|
+
seenUrls.add(ciUrl)
|
|
243
|
+
if (!firstBodyPlace) firstBodyPlace = ciPlace
|
|
244
|
+
imageNodes.push({ '@type': 'ImageObject', url: ciUrl, contentLocation: ciPlace })
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Single image → keep the scalar shape (back-compat); multiple → array.
|
|
248
|
+
const imageNode = imageNodes.length > 1 ? imageNodes : imageNodes[0]
|
|
249
|
+
const spatialPlace = featuredPlace ?? firstBodyPlace
|
|
250
|
+
|
|
251
|
+
const jsonLd: Record<string, unknown> = {
|
|
252
|
+
'@context': 'https://schema.org',
|
|
253
|
+
'@type': 'Article',
|
|
254
|
+
headline: displayTitle,
|
|
255
|
+
description,
|
|
256
|
+
url: canonical,
|
|
257
|
+
...(imageNode !== undefined ? { image: imageNode } : {}),
|
|
258
|
+
...(spatialPlace ? { spatialCoverage: spatialPlace } : {}),
|
|
259
|
+
...(article.publishedAt ? { datePublished: article.publishedAt } : {}),
|
|
260
|
+
...(article.updatedAt ? { dateModified: article.updatedAt } : {}),
|
|
261
|
+
publisher: { '@type': 'Organization', name: config.siteName },
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return {
|
|
265
|
+
title,
|
|
266
|
+
description,
|
|
267
|
+
canonical,
|
|
268
|
+
htmlLang: locale,
|
|
269
|
+
hreflang: buildHreflang(routePath, config),
|
|
270
|
+
og,
|
|
271
|
+
twitter,
|
|
272
|
+
...(Object.keys(articleMeta).length ? { articleMeta } : {}),
|
|
273
|
+
jsonLd,
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// ==================== Collection / list pages ====================
|
|
278
|
+
|
|
279
|
+
export interface BuildListPageSeoOptions {
|
|
280
|
+
/** Fully-composed page title (caller includes the brand suffix). */
|
|
281
|
+
title: string
|
|
282
|
+
description: string
|
|
283
|
+
config: SeoConfig
|
|
284
|
+
locale: string
|
|
285
|
+
routePath: string
|
|
286
|
+
/** schema.org `CollectionPage` name; defaults to `title`. */
|
|
287
|
+
jsonLdName?: string
|
|
288
|
+
/** Optional social image (absolutized if relative). */
|
|
289
|
+
image?: string | null
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** Builds SEO for `/articles`, `/topics`, and `/topics/[slug]` (CollectionPage). */
|
|
293
|
+
export function buildListPageSeo(opts: BuildListPageSeoOptions): SeoModel {
|
|
294
|
+
const { title, description, config, locale, routePath, jsonLdName, image } = opts
|
|
295
|
+
const canonical = pageUrl(config.siteUrl, routePath)
|
|
296
|
+
const absImage = toAbsoluteUrl(image, config.siteUrl)
|
|
297
|
+
|
|
298
|
+
return {
|
|
299
|
+
title,
|
|
300
|
+
description,
|
|
301
|
+
canonical,
|
|
302
|
+
htmlLang: locale,
|
|
303
|
+
hreflang: buildHreflang(routePath, config),
|
|
304
|
+
og: {
|
|
305
|
+
title,
|
|
306
|
+
description,
|
|
307
|
+
type: 'website',
|
|
308
|
+
url: canonical,
|
|
309
|
+
siteName: config.siteName,
|
|
310
|
+
...(absImage ? { image: absImage } : {}),
|
|
311
|
+
},
|
|
312
|
+
twitter: {
|
|
313
|
+
card: absImage ? 'summary_large_image' : 'summary',
|
|
314
|
+
title,
|
|
315
|
+
description,
|
|
316
|
+
...(absImage ? { image: absImage } : {}),
|
|
317
|
+
},
|
|
318
|
+
jsonLd: {
|
|
319
|
+
'@context': 'https://schema.org',
|
|
320
|
+
'@type': 'CollectionPage',
|
|
321
|
+
name: jsonLdName ?? title,
|
|
322
|
+
description,
|
|
323
|
+
url: canonical,
|
|
324
|
+
},
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// ==================== Home page ====================
|
|
329
|
+
|
|
330
|
+
export interface BuildHomeSeoOptions {
|
|
331
|
+
/** Translated home title (the document `<title>`). */
|
|
332
|
+
title: string
|
|
333
|
+
description: string
|
|
334
|
+
config: SeoConfig
|
|
335
|
+
locale: string
|
|
336
|
+
routePath: string
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** Builds SEO for the home page (WebSite JSON-LD with a SearchAction). */
|
|
340
|
+
export function buildHomeSeo(opts: BuildHomeSeoOptions): SeoModel {
|
|
341
|
+
const { title, description, config, locale, routePath } = opts
|
|
342
|
+
const canonical = pageUrl(config.siteUrl, routePath)
|
|
343
|
+
|
|
344
|
+
return {
|
|
345
|
+
title,
|
|
346
|
+
description,
|
|
347
|
+
canonical,
|
|
348
|
+
htmlLang: locale,
|
|
349
|
+
hreflang: buildHreflang(routePath, config),
|
|
350
|
+
og: {
|
|
351
|
+
title: config.siteName,
|
|
352
|
+
description,
|
|
353
|
+
type: 'website',
|
|
354
|
+
url: canonical,
|
|
355
|
+
siteName: config.siteName,
|
|
356
|
+
},
|
|
357
|
+
twitter: {
|
|
358
|
+
card: 'summary',
|
|
359
|
+
title: config.siteName,
|
|
360
|
+
description,
|
|
361
|
+
},
|
|
362
|
+
jsonLd: {
|
|
363
|
+
'@context': 'https://schema.org',
|
|
364
|
+
'@type': 'WebSite',
|
|
365
|
+
name: config.siteName,
|
|
366
|
+
url: canonical,
|
|
367
|
+
potentialAction: {
|
|
368
|
+
'@type': 'SearchAction',
|
|
369
|
+
target: `${config.siteUrl}/search?q={search_term_string}`,
|
|
370
|
+
'query-input': 'required name=search_term_string',
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
}
|
|
374
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-tenant theme color math + CSS-variable builder.
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH for the blog accent palette, shared by both the Nuxt
|
|
5
|
+
* blog (`app/plugins/theme-colors.ts`) and the Next.js blog (`app/layout.tsx`).
|
|
6
|
+
* Colors use RGB triplet format so Tailwind's `rgb(var(--color-accent) /
|
|
7
|
+
* <alpha-value>)` colors resolve with alpha support. Dark-mode variants are
|
|
8
|
+
* auto-computed from the base accent via HSL manipulation.
|
|
9
|
+
*
|
|
10
|
+
* The pure color helpers are ported VERBATIM from the original Nuxt plugin so
|
|
11
|
+
* the emitted CSS stays byte-identical across the refactor.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Parse a `#rrggbb` (or `rrggbb`) hex string into an `[r, g, b]` 0-255 tuple. */
|
|
15
|
+
export function hexToRgb(hex: string): [number, number, number] {
|
|
16
|
+
const h = hex.replace('#', '')
|
|
17
|
+
return [
|
|
18
|
+
parseInt(h.slice(0, 2), 16),
|
|
19
|
+
parseInt(h.slice(2, 4), 16),
|
|
20
|
+
parseInt(h.slice(4, 6), 16),
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Convert a hex color to HSL — `h` in degrees (0-360), `s`/`l` in 0-1. */
|
|
25
|
+
export function hexToHsl(hex: string): [number, number, number] {
|
|
26
|
+
const rgb = hexToRgb(hex)
|
|
27
|
+
const r = rgb[0] / 255
|
|
28
|
+
const g = rgb[1] / 255
|
|
29
|
+
const b = rgb[2] / 255
|
|
30
|
+
const max = Math.max(r, g, b)
|
|
31
|
+
const min = Math.min(r, g, b)
|
|
32
|
+
const l = (max + min) / 2
|
|
33
|
+
if (max === min) return [0, 0, l]
|
|
34
|
+
const d = max - min
|
|
35
|
+
const s = l > 0.5 ? d / (2 - max - min) : d / (max + min)
|
|
36
|
+
let h = 0
|
|
37
|
+
if (max === r) h = ((g - b) / d + (g < b ? 6 : 0)) / 6
|
|
38
|
+
else if (max === g) h = ((b - r) / d + 2) / 6
|
|
39
|
+
else h = ((r - g) / d + 4) / 6
|
|
40
|
+
return [h * 360, s, l]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Convert HSL (`h` in degrees, `s`/`l` in 0-1) to an `[r, g, b]` 0-255 tuple. */
|
|
44
|
+
export function hslToRgb(h: number, s: number, l: number): [number, number, number] {
|
|
45
|
+
h = h / 360
|
|
46
|
+
if (s === 0) {
|
|
47
|
+
const v = Math.round(l * 255)
|
|
48
|
+
return [v, v, v]
|
|
49
|
+
}
|
|
50
|
+
const hue2rgb = (p: number, q: number, t: number) => {
|
|
51
|
+
if (t < 0) t += 1
|
|
52
|
+
if (t > 1) t -= 1
|
|
53
|
+
if (t < 1 / 6) return p + (q - p) * 6 * t
|
|
54
|
+
if (t < 1 / 2) return q
|
|
55
|
+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6
|
|
56
|
+
return p
|
|
57
|
+
}
|
|
58
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s
|
|
59
|
+
const p = 2 * l - q
|
|
60
|
+
return [
|
|
61
|
+
Math.round(hue2rgb(p, q, h + 1 / 3) * 255),
|
|
62
|
+
Math.round(hue2rgb(p, q, h) * 255),
|
|
63
|
+
Math.round(hue2rgb(p, q, h - 1 / 3) * 255),
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Lighten a hex color by `amount` (0-1 added to L), returns an `"r g b"` triplet. */
|
|
68
|
+
export function lightenColor(hex: string, amount: number): string {
|
|
69
|
+
const [h, s, l] = hexToHsl(hex)
|
|
70
|
+
const newL = Math.min(1, Math.max(0, l + amount))
|
|
71
|
+
const [r, g, b] = hslToRgb(h, s, newL)
|
|
72
|
+
return `${r} ${g} ${b}`
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Darken a hex color by `amount` (0-1 subtracted from L), returns an `"r g b"` triplet. */
|
|
76
|
+
export function darkenColor(hex: string, amount: number): string {
|
|
77
|
+
return lightenColor(hex, -amount)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Render a hex color as a plain `"r g b"` RGB triplet (no transform). */
|
|
81
|
+
export function rgbTriplet(hex: string): string {
|
|
82
|
+
const [r, g, b] = hexToRgb(hex)
|
|
83
|
+
return `${r} ${g} ${b}`
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Per-tenant accent theme. All optional — defaults to the blue palette. */
|
|
87
|
+
export interface ThemeColors {
|
|
88
|
+
accent?: string
|
|
89
|
+
accentHover?: string
|
|
90
|
+
accentLight?: string
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Build the per-tenant theme CSS custom-property block.
|
|
95
|
+
*
|
|
96
|
+
* Returns the EXACT string both blogs inject into a `<style>` tag:
|
|
97
|
+
* - `:root { … }` — light-mode RGB triplets straight from the config.
|
|
98
|
+
* - `.dark { … }` — dark-mode variants auto-computed from the base accent
|
|
99
|
+
* (lighten accent for text visibility, darken light for backgrounds).
|
|
100
|
+
*
|
|
101
|
+
* Defaults: accent `#2563eb`, accentHover `#1d4ed8`, accentLight `#dbeafe`.
|
|
102
|
+
*/
|
|
103
|
+
export function buildThemeCssVars(theme?: ThemeColors): string {
|
|
104
|
+
const accent = theme?.accent ?? '#2563eb'
|
|
105
|
+
const accentHover = theme?.accentHover ?? '#1d4ed8'
|
|
106
|
+
const accentLight = theme?.accentLight ?? '#dbeafe'
|
|
107
|
+
|
|
108
|
+
// Light mode: direct from config
|
|
109
|
+
const lightAccent = rgbTriplet(accent)
|
|
110
|
+
const lightAccentHover = rgbTriplet(accentHover)
|
|
111
|
+
const lightAccentLight = rgbTriplet(accentLight)
|
|
112
|
+
|
|
113
|
+
// Dark mode: auto-computed — lighten accent for text visibility, darken light for bg
|
|
114
|
+
const darkAccent = lightenColor(accent, 0.2)
|
|
115
|
+
const darkAccentHover = lightenColor(accent, 0.35)
|
|
116
|
+
const darkAccentLight = darkenColor(accent, 0.25)
|
|
117
|
+
|
|
118
|
+
return `:root {
|
|
119
|
+
--color-accent: ${lightAccent};
|
|
120
|
+
--color-accent-hover: ${lightAccentHover};
|
|
121
|
+
--color-accent-light: ${lightAccentLight};
|
|
122
|
+
}
|
|
123
|
+
.dark {
|
|
124
|
+
--color-accent: ${darkAccent};
|
|
125
|
+
--color-accent-hover: ${darkAccentHover};
|
|
126
|
+
--color-accent-light: ${darkAccentLight};
|
|
127
|
+
}`
|
|
128
|
+
}
|