@blogmcp/sdk 0.6.1 → 0.7.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.
Files changed (136) hide show
  1. package/dist/consultations/channel-text.d.ts +118 -0
  2. package/dist/consultations/channel-text.js +40 -0
  3. package/dist/consultations/index.d.ts +28 -0
  4. package/dist/consultations/index.js +60 -0
  5. package/dist/consultations/messages.cs.d.ts +149 -0
  6. package/dist/consultations/messages.cs.js +143 -0
  7. package/dist/consultations/messages.d.ts +34 -0
  8. package/dist/consultations/messages.en.d.ts +143 -0
  9. package/dist/consultations/messages.en.js +141 -0
  10. package/dist/consultations/messages.js +48 -0
  11. package/dist/consultations/outcome.d.ts +121 -0
  12. package/dist/consultations/outcome.js +161 -0
  13. package/dist/consultations/public-config.d.ts +71 -0
  14. package/dist/consultations/public-config.js +104 -0
  15. package/dist/consultations/reader.d.ts +83 -0
  16. package/dist/consultations/reader.js +128 -0
  17. package/dist/consultations/routes.d.ts +214 -0
  18. package/dist/consultations/routes.js +149 -0
  19. package/dist/consultations/server/client-ip.d.ts +50 -0
  20. package/dist/consultations/server/client-ip.js +44 -0
  21. package/dist/consultations/server/contact.d.ts +23 -0
  22. package/dist/consultations/server/contact.js +138 -0
  23. package/dist/consultations/server/context.d.ts +246 -0
  24. package/dist/consultations/server/context.js +152 -0
  25. package/dist/consultations/server/cookie.d.ts +60 -0
  26. package/dist/consultations/server/cookie.js +57 -0
  27. package/dist/consultations/server/env.d.ts +20 -0
  28. package/dist/consultations/server/env.js +35 -0
  29. package/dist/consultations/server/http.d.ts +59 -0
  30. package/dist/consultations/server/http.js +64 -0
  31. package/dist/consultations/server/index.d.ts +37 -0
  32. package/dist/consultations/server/index.js +19 -0
  33. package/dist/consultations/server/origin.d.ts +39 -0
  34. package/dist/consultations/server/origin.js +31 -0
  35. package/dist/consultations/server/server.d.ts +106 -0
  36. package/dist/consultations/server/server.js +122 -0
  37. package/dist/consultations/server/session.d.ts +38 -0
  38. package/dist/consultations/server/session.js +210 -0
  39. package/dist/consultations/server/transport.d.ts +69 -0
  40. package/dist/consultations/server/transport.js +117 -0
  41. package/dist/consultations/server/turnstile.d.ts +44 -0
  42. package/dist/consultations/server/turnstile.js +31 -0
  43. package/dist/consultations/site.d.ts +100 -0
  44. package/dist/consultations/site.js +60 -0
  45. package/dist/consultations/submit-new.d.ts +103 -0
  46. package/dist/consultations/submit-new.js +72 -0
  47. package/dist/core/auth.d.ts +2 -2
  48. package/dist/core/client.d.ts +25 -4
  49. package/dist/core/client.js +35 -30
  50. package/dist/core/consultation-adapter.d.ts +2 -2
  51. package/dist/core/consultations.d.ts +1 -1
  52. package/dist/core/errors.d.ts +1 -1
  53. package/dist/core/errors.js +16 -15
  54. package/dist/core/index.d.ts +31 -31
  55. package/dist/core/index.js +35 -34
  56. package/dist/core/markdown.d.ts +1 -1
  57. package/dist/core/queries.d.ts +4 -1
  58. package/dist/core/queries.js +131 -86
  59. package/dist/core/review/format.d.ts +1 -1
  60. package/dist/core/review/index.d.ts +2 -2
  61. package/dist/core/seo.d.ts +1 -1
  62. package/dist/core/translations/cs.json.js +1 -1
  63. package/dist/core/translations/en.json.js +1 -1
  64. package/dist/core/types.d.ts +50 -1
  65. package/dist/core/view-model.d.ts +12 -2
  66. package/dist/core/view-model.js +40 -34
  67. package/dist/{packages/tripmap-core/node_modules → node_modules}/pmtiles/dist/esm/index.js +1 -1
  68. package/dist/nuxt/composables/useAsyncKb.d.ts +4 -4
  69. package/dist/nuxt/index.d.ts +1 -1
  70. package/dist/packages/tripmap-core/dist/engine.js +3 -3
  71. package/dist/packages/tripmap-core/dist/generated/maplibre-worker.bundle.js +1 -1
  72. package/dist/react/KbMdxContent.d.ts +1 -1
  73. package/dist/react/context.d.ts +4 -4
  74. package/dist/react/hooks/useImageRenderer.d.ts +1 -1
  75. package/dist/react/hooks/useKbClient.d.ts +1 -1
  76. package/dist/react/hooks/useKbContext.d.ts +1 -1
  77. package/dist/react/hooks/useKbI18n.d.ts +1 -1
  78. package/dist/react/hooks/useKbLanguage.d.ts +1 -1
  79. package/dist/react/hooks/useKbSearch.d.ts +1 -1
  80. package/dist/react/hooks/useMdxContent.d.ts +1 -1
  81. package/dist/react/index.d.ts +15 -15
  82. package/dist/react/provider.d.ts +2 -2
  83. package/dist/react/server/index.d.ts +2 -2
  84. package/dist/vue/components/KbAccessGate.vue.d.ts +4 -1
  85. package/dist/vue/components/KbAccessGate.vue.js +42 -32
  86. package/dist/vue/components/KbArticleCard.vue.d.ts +3 -1
  87. package/dist/vue/components/KbArticleCard.vue.js +67 -39
  88. package/dist/vue/composables/useArticles.d.ts +1 -1
  89. package/dist/vue/composables/useImageRenderer.d.ts +1 -1
  90. package/dist/vue/composables/useKbAuth.d.ts +1 -1
  91. package/dist/vue/composables/useKbClient.d.ts +1 -1
  92. package/dist/vue/composables/useKbComments.d.ts +1 -1
  93. package/dist/vue/composables/useKbI18n.d.ts +1 -1
  94. package/dist/vue/composables/useKbLanguage.d.ts +1 -1
  95. package/dist/vue/composables/useNavigation.d.ts +1 -1
  96. package/dist/vue/composables/useSearch.d.ts +1 -1
  97. package/dist/vue/composables/useTags.d.ts +1 -1
  98. package/dist/vue/index.d.ts +19 -19
  99. package/dist/vue/plugin.d.ts +4 -4
  100. package/package.json +15 -5
  101. package/src/consultations/channel-text.ts +168 -0
  102. package/src/consultations/index.ts +87 -0
  103. package/src/consultations/messages.cs.ts +175 -0
  104. package/src/consultations/messages.en.ts +171 -0
  105. package/src/consultations/messages.ts +91 -0
  106. package/src/consultations/outcome.ts +278 -0
  107. package/src/consultations/public-config.ts +246 -0
  108. package/src/consultations/reader.ts +281 -0
  109. package/src/consultations/routes.ts +341 -0
  110. package/src/consultations/server/client-ip.ts +106 -0
  111. package/src/consultations/server/contact.ts +267 -0
  112. package/src/consultations/server/context.ts +403 -0
  113. package/src/consultations/server/cookie.ts +129 -0
  114. package/src/consultations/server/env.ts +66 -0
  115. package/src/consultations/server/http.ts +148 -0
  116. package/src/consultations/server/index.ts +55 -0
  117. package/src/consultations/server/origin.ts +71 -0
  118. package/src/consultations/server/server.ts +322 -0
  119. package/src/consultations/server/session.ts +414 -0
  120. package/src/consultations/server/transport.ts +196 -0
  121. package/src/consultations/server/turnstile.ts +98 -0
  122. package/src/consultations/site.ts +183 -0
  123. package/src/consultations/submit-new.ts +266 -0
  124. package/src/core/auth.ts +1 -1
  125. package/src/core/client.ts +32 -1
  126. package/src/core/errors.ts +5 -2
  127. package/src/core/index.ts +3 -0
  128. package/src/core/queries.ts +56 -0
  129. package/src/core/translations/cs.json +2 -1
  130. package/src/core/translations/en.json +2 -1
  131. package/src/core/types.ts +51 -0
  132. package/src/core/view-model.ts +18 -0
  133. package/src/vue/components/KbAccessGate.vue +14 -1
  134. package/src/vue/components/KbArticleCard.vue +25 -0
  135. /package/dist/{packages/tripmap-core/node_modules → node_modules}/maplibre-gl/dist/maplibre-gl-shared.js +0 -0
  136. /package/dist/{packages/tripmap-core/node_modules → node_modules}/maplibre-gl/dist/maplibre-gl.js +0 -0
@@ -16,7 +16,7 @@
16
16
  * etc. Mirrors the Vue path one-for-one.
17
17
  */
18
18
  import { type ComponentType, type ReactNode } from 'react';
19
- import type { ImageHtmlRenderer } from '../core/client-types';
19
+ import type { ImageHtmlRenderer } from '../core/client-types.js';
20
20
  /** Per-component map a consumer passes into `<KbMdxContent components={…} />`. */
21
21
  export type KbMdxComponentRegistry = Record<string, ComponentType<any>>;
22
22
  export interface KbMdxContentProps {
@@ -1,7 +1,7 @@
1
- import type { KbClient } from '../core/client';
2
- import type { AuthManager } from '../core/auth';
3
- import type { TranslateFn } from '../core/i18n';
4
- import type { ImageHtmlRenderer } from '../core/client-types';
1
+ import type { KbClient } from '../core/client.js';
2
+ import type { AuthManager } from '../core/auth.js';
3
+ import type { TranslateFn } from '../core/i18n.js';
4
+ import type { ImageHtmlRenderer } from '../core/client-types.js';
5
5
  export interface KbContextValue {
6
6
  client: KbClient;
7
7
  auth: AuthManager;
@@ -1,4 +1,4 @@
1
- import type { ImageHtmlRenderer } from '../../core/client-types';
1
+ import type { ImageHtmlRenderer } from '../../core/client-types.js';
2
2
  /**
3
3
  * Access the image HTML renderer from the nearest <KbProvider>.
4
4
  * Falls back to a plain <img> renderer when used outside a provider.
@@ -1,3 +1,3 @@
1
- import type { KbClient } from '../../core/client';
1
+ import type { KbClient } from '../../core/client.js';
2
2
  /** Access the KbClient from the nearest <KbProvider>. */
3
3
  export declare function useKbClient(): KbClient;
@@ -1,3 +1,3 @@
1
- import { type KbContextValue } from '../context';
1
+ import { type KbContextValue } from '../context.js';
2
2
  /** Internal: read the KbProvider context or throw a helpful error. */
3
3
  export declare function useKbContext(): KbContextValue;
@@ -1,4 +1,4 @@
1
- import type { TranslateFn } from '../../core/i18n';
1
+ import type { TranslateFn } from '../../core/i18n.js';
2
2
  /**
3
3
  * Access the translation function from the nearest <KbProvider>.
4
4
  * Falls back to returning the key as-is when used outside a provider
@@ -1,4 +1,4 @@
1
- import type { Language, LocalizedTag } from '../../core/types';
1
+ import type { Language, LocalizedTag } from '../../core/types.js';
2
2
  export interface UseKbLanguageReturn {
3
3
  currentLanguage: string;
4
4
  languages: Language[];
@@ -1,4 +1,4 @@
1
- import type { SearchResult } from '../../core/types';
1
+ import type { SearchResult } from '../../core/types.js';
2
2
  export type SearchMode = 'SEMANTIC' | 'KEYWORD' | 'HYBRID';
3
3
  export interface UseKbSearchReturn {
4
4
  results: SearchResult[];
@@ -10,7 +10,7 @@
10
10
  * to keep the render inline.
11
11
  */
12
12
  import type { ReactNode } from 'react';
13
- import { type KbMdxComponentRegistry } from '../KbMdxContent';
13
+ import { type KbMdxComponentRegistry } from '../KbMdxContent.js';
14
14
  export interface UseMdxContentOptions {
15
15
  /** Component registry mapping schema names → React components. */
16
16
  components?: KbMdxComponentRegistry;
@@ -4,18 +4,18 @@
4
4
  * Provider + hooks for the interactive client surface. Server-side data
5
5
  * fetching lives in `@blogmcp/sdk/react/server` (directive-free, RSC-safe).
6
6
  */
7
- export { KbProvider } from './provider';
8
- export type { KbProviderProps } from './provider';
9
- export { KbContext } from './context';
10
- export type { KbContextValue } from './context';
11
- export { useKbClient } from './hooks/useKbClient';
12
- export { useKbI18n } from './hooks/useKbI18n';
13
- export { useImageRenderer } from './hooks/useImageRenderer';
14
- export { useKbLanguage } from './hooks/useKbLanguage';
15
- export type { UseKbLanguageReturn } from './hooks/useKbLanguage';
16
- export { useKbSearch } from './hooks/useKbSearch';
17
- export type { UseKbSearchReturn, SearchMode } from './hooks/useKbSearch';
18
- export { KbMdxContent } from './KbMdxContent';
19
- export type { KbMdxContentProps, KbMdxComponentRegistry } from './KbMdxContent';
20
- export { useMdxContent } from './hooks/useMdxContent';
21
- export type { UseMdxContentOptions } from './hooks/useMdxContent';
7
+ export { KbProvider } from './provider.js';
8
+ export type { KbProviderProps } from './provider.js';
9
+ export { KbContext } from './context.js';
10
+ export type { KbContextValue } from './context.js';
11
+ export { useKbClient } from './hooks/useKbClient.js';
12
+ export { useKbI18n } from './hooks/useKbI18n.js';
13
+ export { useImageRenderer } from './hooks/useImageRenderer.js';
14
+ export { useKbLanguage } from './hooks/useKbLanguage.js';
15
+ export type { UseKbLanguageReturn } from './hooks/useKbLanguage.js';
16
+ export { useKbSearch } from './hooks/useKbSearch.js';
17
+ export type { UseKbSearchReturn, SearchMode } from './hooks/useKbSearch.js';
18
+ export { KbMdxContent } from './KbMdxContent.js';
19
+ export type { KbMdxContentProps, KbMdxComponentRegistry } from './KbMdxContent.js';
20
+ export { useMdxContent } from './hooks/useMdxContent.js';
21
+ export type { UseMdxContentOptions } from './hooks/useMdxContent.js';
@@ -9,8 +9,8 @@
9
9
  * comments). Server Components fetch via `createServerKbClient()` instead.
10
10
  */
11
11
  import { type ReactNode } from 'react';
12
- import type { KbClientConfig, ImageHtmlRenderer, TokenStorage } from '../core/client-types';
13
- import type { TranslateFn } from '../core/i18n';
12
+ import type { KbClientConfig, ImageHtmlRenderer, TokenStorage } from '../core/client-types.js';
13
+ import type { TranslateFn } from '../core/i18n.js';
14
14
  export interface KbProviderProps extends KbClientConfig {
15
15
  /** Custom auth token storage. Defaults to localStorage in browser, memory on server. */
16
16
  tokenStorage?: TokenStorage;
@@ -7,8 +7,8 @@
7
7
  * `await`-ing the core client — no hooks, no context. This is the App Router
8
8
  * analogue of Nuxt's `useAsyncData`.
9
9
  */
10
- import type { KbClient } from '../../core/client';
11
- import type { Fetcher, KbClientConfig, TokenStorage } from '../../core/client-types';
10
+ import type { KbClient } from '../../core/client.js';
11
+ import type { Fetcher, KbClientConfig, TokenStorage } from '../../core/client-types.js';
12
12
  export interface NextFetcherOptions {
13
13
  /** ISR revalidate seconds threaded into Next's fetch cache (`false` = no revalidate). */
14
14
  revalidate?: number | false;
@@ -1,8 +1,9 @@
1
- import type { AccessLevel } from '../../core/types';
1
+ import type { AccessLevel } from '../../core/types.js';
2
2
  type __VLS_Props = {
3
3
  article: {
4
4
  title: string;
5
5
  description?: string | null;
6
+ excerpt?: string | null;
6
7
  };
7
8
  requiredLevel: AccessLevel;
8
9
  };
@@ -10,10 +11,12 @@ declare var __VLS_1: {
10
11
  article: {
11
12
  title: string;
12
13
  description?: string | null;
14
+ excerpt?: string | null;
13
15
  };
14
16
  requiredLevel: AccessLevel;
15
17
  levelLabel: string;
16
18
  isAuthenticated: boolean;
19
+ excerptParagraphs: string[];
17
20
  };
18
21
  type __VLS_Slots = {} & {
19
22
  default?: (props: typeof __VLS_1) => any;
@@ -1,31 +1,38 @@
1
- import { defineComponent as y, computed as h, renderSlot as k, unref as t, createElementVNode as r, createElementBlock as i, createCommentVNode as v, toDisplayString as l, openBlock as o, Fragment as g, createTextVNode as b } from "vue";
2
- import { useKbAuth as w } from "../composables/useKbAuth.js";
3
- import { useKbI18n as A } from "../composables/useKbI18n.js";
4
- const C = {
1
+ import { defineComponent as w, computed as b, renderSlot as A, unref as t, createElementVNode as r, createElementBlock as s, createCommentVNode as v, toDisplayString as l, openBlock as n, Fragment as x, renderList as L, createTextVNode as f } from "vue";
2
+ import { useKbAuth as C } from "../composables/useKbAuth.js";
3
+ import { useKbI18n as G } from "../composables/useKbI18n.js";
4
+ const q = {
5
5
  "data-testid": "access-gate",
6
6
  class: "rounded-xl border border-gray-200 bg-gray-50 p-8 text-center"
7
- }, G = { class: "mt-6 text-2xl font-bold text-gray-900" }, L = {
7
+ }, I = { class: "mt-6 text-2xl font-bold text-gray-900" }, $ = {
8
8
  key: 0,
9
9
  class: "mt-2 text-gray-600"
10
- }, q = { class: "mt-6 text-gray-600" }, I = { class: "mt-8 flex flex-col items-center gap-4 sm:flex-row sm:justify-center" }, j = /* @__PURE__ */ y({
10
+ }, B = {
11
+ key: 1,
12
+ "data-testid": "access-gate-excerpt",
13
+ class: "mt-6 space-y-3 text-left text-gray-700"
14
+ }, F = { class: "mt-6 text-gray-600" }, V = { class: "mt-8 flex flex-col items-center gap-4 sm:flex-row sm:justify-center" }, N = /* @__PURE__ */ w({
11
15
  __name: "KbAccessGate",
12
16
  props: {
13
17
  article: {},
14
18
  requiredLevel: {}
15
19
  },
16
20
  emits: ["signIn", "upgrade", "browseFree"],
17
- setup(s, { emit: x }) {
18
- const f = s, c = x, { isAuthenticated: u } = w(), n = A(), d = h(() => n(`accessGate.level${p(f.requiredLevel)}`));
19
- function p(a) {
20
- return a.charAt(0).toUpperCase() + a.slice(1);
21
+ setup(a, { emit: y }) {
22
+ const p = a, u = y, { isAuthenticated: d } = C(), i = G(), m = b(() => i(`accessGate.level${h(p.requiredLevel)}`)), g = b(
23
+ () => (p.article.excerpt ?? "").split(/\n\s*\n/).map((o) => o.trim()).filter(Boolean)
24
+ );
25
+ function h(o) {
26
+ return o.charAt(0).toUpperCase() + o.slice(1);
21
27
  }
22
- return (a, e) => k(a.$slots, "default", {
23
- article: s.article,
24
- requiredLevel: s.requiredLevel,
25
- levelLabel: d.value,
26
- isAuthenticated: t(u)
28
+ return (o, e) => A(o.$slots, "default", {
29
+ article: a.article,
30
+ requiredLevel: a.requiredLevel,
31
+ levelLabel: m.value,
32
+ isAuthenticated: t(d),
33
+ excerptParagraphs: g.value
27
34
  }, () => [
28
- r("div", C, [
35
+ r("div", q, [
29
36
  e[3] || (e[3] = r("div", { class: "mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-blue-50" }, [
30
37
  r("svg", {
31
38
  class: "h-8 w-8 text-blue-600",
@@ -41,34 +48,37 @@ const C = {
41
48
  })
42
49
  ])
43
50
  ], -1)),
44
- r("h2", G, l(s.article.title), 1),
45
- s.article.description ? (o(), i("p", L, l(s.article.description), 1)) : v("", !0),
46
- r("p", q, [
47
- t(u) ? (o(), i(g, { key: 1 }, [
48
- b(l(t(n)("accessGate.requiresAccess", { level: d.value })), 1)
49
- ], 64)) : (o(), i(g, { key: 0 }, [
50
- b(l(t(n)("accessGate.signInToAccess", { level: d.value })), 1)
51
+ r("h2", I, l(a.article.title), 1),
52
+ a.article.description ? (n(), s("p", $, l(a.article.description), 1)) : v("", !0),
53
+ g.value.length ? (n(), s("div", B, [
54
+ (n(!0), s(x, null, L(g.value, (c, k) => (n(), s("p", { key: k }, l(c), 1))), 128))
55
+ ])) : v("", !0),
56
+ r("p", F, [
57
+ t(d) ? (n(), s(x, { key: 1 }, [
58
+ f(l(t(i)("accessGate.requiresAccess", { level: m.value })), 1)
59
+ ], 64)) : (n(), s(x, { key: 0 }, [
60
+ f(l(t(i)("accessGate.signInToAccess", { level: m.value })), 1)
51
61
  ], 64))
52
62
  ]),
53
- r("div", I, [
54
- t(u) ? s.requiredLevel === "premium" ? (o(), i("button", {
63
+ r("div", V, [
64
+ t(d) ? a.requiredLevel === "premium" ? (n(), s("button", {
55
65
  key: 1,
56
66
  class: "inline-flex items-center rounded-lg bg-blue-600 px-6 py-3 font-medium text-white hover:bg-blue-700",
57
- onClick: e[1] || (e[1] = (m) => c("upgrade"))
58
- }, l(t(n)("accessGate.upgradeToPremium")), 1)) : v("", !0) : (o(), i("button", {
67
+ onClick: e[1] || (e[1] = (c) => u("upgrade"))
68
+ }, l(t(i)("accessGate.upgradeToPremium")), 1)) : v("", !0) : (n(), s("button", {
59
69
  key: 0,
60
70
  class: "inline-flex items-center rounded-lg bg-blue-600 px-6 py-3 font-medium text-white hover:bg-blue-700",
61
- onClick: e[0] || (e[0] = (m) => c("signIn"))
62
- }, l(t(n)("accessGate.signIn")), 1)),
71
+ onClick: e[0] || (e[0] = (c) => u("signIn"))
72
+ }, l(t(i)("accessGate.signIn")), 1)),
63
73
  r("button", {
64
74
  class: "inline-flex items-center text-gray-600 hover:text-gray-900",
65
- onClick: e[2] || (e[2] = (m) => c("browseFree"))
66
- }, l(t(n)("accessGate.browseFreeArticles")), 1)
75
+ onClick: e[2] || (e[2] = (c) => u("browseFree"))
76
+ }, l(t(i)("accessGate.browseFreeArticles")), 1)
67
77
  ])
68
78
  ])
69
79
  ]);
70
80
  }
71
81
  });
72
82
  export {
73
- j as default
83
+ N as default
74
84
  };
@@ -1,4 +1,4 @@
1
- import type { Article } from '../../core/types';
1
+ import type { Article } from '../../core/types.js';
2
2
  type __VLS_Props = {
3
3
  article: Article;
4
4
  featured?: boolean;
@@ -13,6 +13,8 @@ declare var __VLS_1: {
13
13
  displayDate: string;
14
14
  featured: boolean;
15
15
  formatDate: typeof formatDate;
16
+ locked: boolean;
17
+ requiredAccess: "premium" | "partners" | null;
16
18
  };
17
19
  type __VLS_Slots = {} & {
18
20
  default?: (props: typeof __VLS_1) => any;
@@ -1,11 +1,13 @@
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 = {
1
+ import { defineComponent as C, computed as a, renderSlot as A, createElementVNode as l, normalizeClass as d, createElementBlock as r, createCommentVNode as o, openBlock as c, Fragment as D, renderList as S, toDisplayString as n, unref as U, createTextVNode as $ } from "vue";
2
+ import { lockedRequiredAccess as z } from "../../core/view-model.js";
3
+ import { useKbI18n as B } from "../composables/useKbI18n.js";
4
+ const V = ["src", "alt"], q = {
3
5
  key: 0,
4
6
  class: "mb-3 flex flex-wrap gap-2"
5
- }, S = ["href"], U = {
6
- key: 1,
7
+ }, I = ["aria-label"], L = ["href"], N = {
8
+ key: 2,
7
9
  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({
10
+ }, j = { class: "mt-auto pt-4 text-sm text-gray-500" }, E = { key: 0 }, P = /* @__PURE__ */ C({
9
11
  __name: "KbArticleCard",
10
12
  props: {
11
13
  article: {},
@@ -13,69 +15,95 @@ const C = ["src", "alt"], D = {
13
15
  locale: { default: "en" }
14
16
  },
15
17
  emits: ["click"],
16
- setup(e, { emit: y }) {
17
- const t = e, h = y, g = s(
18
+ setup(e, { emit: p }) {
19
+ const t = e, w = p, x = a(
18
20
  () => 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
+ ), h = a(() => `/articles/${x.value}`), u = a(() => t.article.tags || []), k = B(), m = a(() => t.article.locked === !0), f = a(() => m.value ? z(t.article.access) : null), b = a(
22
+ () => f.value ? k(`accessGate.level${f.value === "premium" ? "Premium" : "Partners"}`) : null
23
+ );
24
+ function y(s) {
21
25
  const i = t.locale === "cs" ? "cs-CZ" : "en-US";
22
- return new Date(l).toLocaleDateString(i, {
26
+ return new Date(s).toLocaleDateString(i, {
23
27
  year: "numeric",
24
28
  month: "long",
25
29
  day: "numeric"
26
30
  });
27
31
  }
28
- const m = s(() => {
29
- const l = t.article.publishedAt || t.article.updatedAt;
30
- return l ? x(l) : "";
32
+ const v = a(() => {
33
+ const s = t.article.publishedAt || t.article.updatedAt;
34
+ return s ? y(s) : "";
31
35
  });
32
- return (l, i) => k(l.$slots, "default", {
36
+ return (s, i) => A(s.$slots, "default", {
33
37
  article: e.article,
34
- slug: g.value,
35
- articleUrl: v.value,
38
+ slug: x.value,
39
+ articleUrl: h.value,
36
40
  tags: u.value,
37
- displayDate: m.value,
41
+ displayDate: v.value,
38
42
  featured: e.featured,
39
- formatDate: x
43
+ formatDate: y,
44
+ locked: m.value,
45
+ requiredAccess: f.value
40
46
  }, () => [
41
- a("article", {
42
- class: n([
47
+ l("article", {
48
+ class: d([
43
49
  "group relative overflow-hidden rounded-xl border border-gray-200 bg-white transition-all duration-200 hover:shadow-lg",
44
50
  e.featured ? "md:col-span-2 md:flex" : ""
45
51
  ]),
46
- onClick: i[0] || (i[0] = (f) => h("click", e.article))
52
+ onClick: i[0] || (i[0] = (g) => w("click", e.article))
47
53
  }, [
48
54
  e.article.featuredImageUrl ? (c(), r("div", {
49
55
  key: 0,
50
- class: n(["overflow-hidden bg-gray-100", e.featured ? "md:w-1/2" : "aspect-video"])
56
+ class: d(["overflow-hidden bg-gray-100", e.featured ? "md:w-1/2" : "aspect-video"])
51
57
  }, [
52
- a("img", {
58
+ l("img", {
53
59
  src: e.article.featuredImageUrl,
54
60
  alt: e.article.title || "",
55
61
  class: "h-full w-full object-cover",
56
62
  loading: "lazy"
57
- }, null, 8, C)
63
+ }, null, 8, V)
58
64
  ], 2)) : o("", !0),
59
- a("div", {
60
- class: n(["flex flex-col p-5", e.featured ? "md:w-1/2 md:p-6" : ""])
65
+ l("div", {
66
+ class: d(["flex flex-col p-5", e.featured ? "md:w-1/2 md:p-6" : ""])
61
67
  }, [
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,
68
+ u.value.length > 0 ? (c(), r("div", q, [
69
+ (c(!0), r(D, null, S(u.value.slice(0, 3), (g) => (c(), r("span", {
70
+ key: g,
65
71
  class: "rounded-full bg-blue-50 px-2.5 py-0.5 text-xs font-medium text-blue-600"
66
- }, d(f), 1))), 128))
72
+ }, n(g), 1))), 128))
67
73
  ])) : o("", !0),
68
- a("h3", {
69
- class: n(["font-semibold text-gray-900", e.featured ? "text-xl md:text-2xl" : "text-lg"])
74
+ m.value ? (c(), r("span", {
75
+ key: 1,
76
+ "data-testid": "article-card-locked",
77
+ class: "mb-2 inline-flex w-fit items-center gap-1 rounded-full bg-amber-50 px-2.5 py-0.5 text-xs font-medium text-amber-700",
78
+ "aria-label": U(k)("accessGate.lockedFor", { level: b.value ?? "" })
70
79
  }, [
71
- a("a", {
72
- href: v.value,
80
+ i[1] || (i[1] = l("svg", {
81
+ class: "h-3.5 w-3.5",
82
+ fill: "none",
83
+ stroke: "currentColor",
84
+ viewBox: "0 0 24 24",
85
+ "aria-hidden": "true"
86
+ }, [
87
+ l("path", {
88
+ "stroke-linecap": "round",
89
+ "stroke-linejoin": "round",
90
+ "stroke-width": "2",
91
+ d: "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"
92
+ })
93
+ ], -1)),
94
+ $(" " + n(b.value), 1)
95
+ ], 8, I)) : o("", !0),
96
+ l("h3", {
97
+ class: d(["font-semibold text-gray-900", e.featured ? "text-xl md:text-2xl" : "text-lg"])
98
+ }, [
99
+ l("a", {
100
+ href: h.value,
73
101
  class: "after:absolute after:inset-0"
74
- }, d(e.article.title), 9, S)
102
+ }, n(e.article.title), 9, L)
75
103
  ], 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)
104
+ e.article.description ? (c(), r("p", N, n(e.article.description), 1)) : o("", !0),
105
+ l("div", j, [
106
+ v.value ? (c(), r("time", E, n(v.value), 1)) : o("", !0)
79
107
  ])
80
108
  ], 2)
81
109
  ], 2)
@@ -83,5 +111,5 @@ const C = ["src", "alt"], D = {
83
111
  }
84
112
  });
85
113
  export {
86
- z as default
114
+ P as default
87
115
  };
@@ -1,5 +1,5 @@
1
1
  import { type Ref } from 'vue';
2
- import type { Article, ArticleWithTranslation } from '../../core/types';
2
+ import type { Article, ArticleWithTranslation } from '../../core/types.js';
3
3
  export interface ArticleListParams {
4
4
  status?: string;
5
5
  limit?: number;
@@ -1,4 +1,4 @@
1
- import type { ImageHtmlRenderer } from '../../core/client-types';
1
+ import type { ImageHtmlRenderer } from '../../core/client-types.js';
2
2
  /**
3
3
  * Inject the image HTML renderer provided by KbVue plugin.
4
4
  * Falls back to plain <img> if none provided.
@@ -1,5 +1,5 @@
1
1
  import { type Ref, type ComputedRef } from 'vue';
2
- import type { AuthUser, AccessLevel, AuthResult, RegisterResult } from '../../core/types';
2
+ import type { AuthUser, AccessLevel, AuthResult, RegisterResult } from '../../core/types.js';
3
3
  export interface UseKbAuthReturn {
4
4
  user: Ref<AuthUser | null>;
5
5
  isAuthenticated: ComputedRef<boolean>;
@@ -1,4 +1,4 @@
1
- import type { KbClient } from '../../core/client';
1
+ import type { KbClient } from '../../core/client.js';
2
2
  /**
3
3
  * Inject the KbClient instance provided by KbVue plugin.
4
4
  * Throws if called outside of a KbVue-provided context.
@@ -6,7 +6,7 @@
6
6
  * and subscriptions are optional (provide via createSubscriptionClient).
7
7
  */
8
8
  import { type Ref, type DeepReadonly } from 'vue';
9
- import type { Comment, CommentResult } from '../../core/types';
9
+ import type { Comment, CommentResult } from '../../core/types.js';
10
10
  export interface UseKbCommentsReturn {
11
11
  comments: DeepReadonly<Ref<Comment[]>>;
12
12
  totalCount: DeepReadonly<Ref<number>>;
@@ -1,4 +1,4 @@
1
- import type { TranslateFn } from '../../core/i18n';
1
+ import type { TranslateFn } from '../../core/i18n.js';
2
2
  /**
3
3
  * Inject the translation function provided by KbVue plugin.
4
4
  * Falls back to returning the key as-is if no i18n is provided.
@@ -1,5 +1,5 @@
1
1
  import { type Ref, type ComputedRef } from 'vue';
2
- import type { Language, LocalizedTag } from '../../core/types';
2
+ import type { Language, LocalizedTag } from '../../core/types.js';
3
3
  export interface UseKbLanguageReturn {
4
4
  currentLanguage: Ref<string>;
5
5
  languages: Ref<Language[]>;
@@ -1,5 +1,5 @@
1
1
  import { type Ref } from 'vue';
2
- import type { NavNode } from '../../core/navigation';
2
+ import type { NavNode } from '../../core/navigation.js';
3
3
  export interface UseNavigationReturn {
4
4
  /** The resolved, localized menu tree. */
5
5
  tree: Ref<NavNode[]>;
@@ -1,5 +1,5 @@
1
1
  import { type Ref } from 'vue';
2
- import type { SearchResult } from '../../core/types';
2
+ import type { SearchResult } from '../../core/types.js';
3
3
  export type SearchMode = 'SEMANTIC' | 'KEYWORD' | 'HYBRID';
4
4
  export interface UseKbSearchReturn {
5
5
  results: Ref<SearchResult[]>;
@@ -1,5 +1,5 @@
1
1
  import { type Ref } from 'vue';
2
- import type { Tag, LocalizedTag } from '../../core/types';
2
+ import type { Tag, LocalizedTag } from '../../core/types.js';
3
3
  export interface UseTagsReturn {
4
4
  tags: Ref<Tag[]>;
5
5
  totalCount: Ref<number>;
@@ -1,22 +1,22 @@
1
- export { KbVue, KB_CLIENT_KEY, KB_AUTH_KEY, KB_I18N_KEY, KB_IMAGE_RENDERER_KEY } from './plugin';
2
- export type { KbVueConfig } from './plugin';
3
- export { useKbClient } from './composables/useKbClient';
4
- export { useKbI18n } from './composables/useKbI18n';
5
- export { useArticleList, useArticle } from './composables/useArticles';
6
- export type { ArticleListParams, UseArticleListReturn, UseArticleReturn } from './composables/useArticles';
7
- export { useKbSearch } from './composables/useSearch';
8
- export type { UseKbSearchReturn } from './composables/useSearch';
9
- export { useTags, useLocalizedTags } from './composables/useTags';
10
- export type { UseTagsReturn, UseLocalizedTagsReturn } from './composables/useTags';
11
- export { useNavigation } from './composables/useNavigation';
12
- export type { UseNavigationReturn } from './composables/useNavigation';
13
- export { useKbLanguage } from './composables/useKbLanguage';
14
- export type { UseKbLanguageReturn } from './composables/useKbLanguage';
15
- export { useKbAuth } from './composables/useKbAuth';
16
- export type { UseKbAuthReturn } from './composables/useKbAuth';
17
- export { useKbComments } from './composables/useKbComments';
18
- export type { UseKbCommentsReturn } from './composables/useKbComments';
19
- export { useImageRenderer } from './composables/useImageRenderer';
1
+ export { KbVue, KB_CLIENT_KEY, KB_AUTH_KEY, KB_I18N_KEY, KB_IMAGE_RENDERER_KEY } from './plugin.js';
2
+ export type { KbVueConfig } from './plugin.js';
3
+ export { useKbClient } from './composables/useKbClient.js';
4
+ export { useKbI18n } from './composables/useKbI18n.js';
5
+ export { useArticleList, useArticle } from './composables/useArticles.js';
6
+ export type { ArticleListParams, UseArticleListReturn, UseArticleReturn } from './composables/useArticles.js';
7
+ export { useKbSearch } from './composables/useSearch.js';
8
+ export type { UseKbSearchReturn } from './composables/useSearch.js';
9
+ export { useTags, useLocalizedTags } from './composables/useTags.js';
10
+ export type { UseTagsReturn, UseLocalizedTagsReturn } from './composables/useTags.js';
11
+ export { useNavigation } from './composables/useNavigation.js';
12
+ export type { UseNavigationReturn } from './composables/useNavigation.js';
13
+ export { useKbLanguage } from './composables/useKbLanguage.js';
14
+ export type { UseKbLanguageReturn } from './composables/useKbLanguage.js';
15
+ export { useKbAuth } from './composables/useKbAuth.js';
16
+ export type { UseKbAuthReturn } from './composables/useKbAuth.js';
17
+ export { useKbComments } from './composables/useKbComments.js';
18
+ export type { UseKbCommentsReturn } from './composables/useKbComments.js';
19
+ export { useImageRenderer } from './composables/useImageRenderer.js';
20
20
  export { default as KbMdxContent } from './components/KbMdxContent.vue';
21
21
  export { default as KbArticleCard } from './components/KbArticleCard.vue';
22
22
  export { default as KbAccessGate } from './components/KbAccessGate.vue';
@@ -7,10 +7,10 @@
7
7
  * app.use(KbVue, { endpoint: 'https://api.example.com/graphql' })
8
8
  */
9
9
  import type { App, InjectionKey } from 'vue';
10
- import type { KbClient } from '../core/client';
11
- import type { AuthManager } from '../core/auth';
12
- import type { KbClientConfig, ImageHtmlRenderer, TokenStorage } from '../core/client-types';
13
- import type { TranslateFn } from '../core/i18n';
10
+ import type { KbClient } from '../core/client.js';
11
+ import type { AuthManager } from '../core/auth.js';
12
+ import type { KbClientConfig, ImageHtmlRenderer, TokenStorage } from '../core/client-types.js';
13
+ import type { TranslateFn } from '../core/i18n.js';
14
14
  export declare const KB_CLIENT_KEY: InjectionKey<KbClient>;
15
15
  export declare const KB_AUTH_KEY: InjectionKey<AuthManager>;
16
16
  export declare const KB_I18N_KEY: InjectionKey<TranslateFn>;