@blogmcp/community 0.0.0-stage → 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.
Files changed (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +146 -2
  3. package/dist/blogmcp-community.global.js +10 -0
  4. package/dist/chunks/mount-DzjwnHyx.js +4597 -0
  5. package/dist/core/attrs.d.ts +73 -0
  6. package/dist/core/avatars.d.ts +16 -0
  7. package/dist/core/client.d.ts +27 -0
  8. package/dist/core/discussion.d.ts +144 -0
  9. package/dist/core/download.d.ts +4 -0
  10. package/dist/core/format.d.ts +17 -0
  11. package/dist/core/i18n.d.ts +28 -0
  12. package/dist/core/names.d.ts +15 -0
  13. package/dist/core/notice.d.ts +50 -0
  14. package/dist/core/onboarding.d.ts +52 -0
  15. package/dist/core/outcomes.d.ts +28 -0
  16. package/dist/core/panel.d.ts +80 -0
  17. package/dist/core/receipt.d.ts +5 -0
  18. package/dist/core/text.d.ts +22 -0
  19. package/dist/core/turnstile.d.ts +33 -0
  20. package/dist/element.d.ts +26 -0
  21. package/dist/global.d.ts +8 -0
  22. package/dist/index.d.ts +25 -0
  23. package/dist/index.js +22 -0
  24. package/dist/mount.d.ts +65 -0
  25. package/dist/react.d.ts +17 -0
  26. package/dist/react.js +35 -0
  27. package/dist/ui/AuthorAvatar.vue.d.ts +11 -0
  28. package/dist/ui/ConfirmDialog.vue.d.ts +20 -0
  29. package/dist/ui/DiscussionView.vue.d.ts +33 -0
  30. package/dist/ui/LinkedText.vue.d.ts +5 -0
  31. package/dist/ui/MessageComposer.vue.d.ts +24 -0
  32. package/dist/ui/MessageItem.vue.d.ts +6 -0
  33. package/dist/ui/MessageMenu.vue.d.ts +10 -0
  34. package/dist/ui/MyCommunityView.vue.d.ts +16 -0
  35. package/dist/ui/NoticeFormView.vue.d.ts +26 -0
  36. package/dist/ui/NoticeStatusView.vue.d.ts +15 -0
  37. package/dist/ui/OnboardingSteps.vue.d.ts +11 -0
  38. package/dist/ui/ReactionBar.vue.d.ts +13 -0
  39. package/dist/ui/ReportDialog.vue.d.ts +15 -0
  40. package/dist/ui/StatementView.vue.d.ts +15 -0
  41. package/dist/ui/context.d.ts +21 -0
  42. package/dist/ui/discussion-context.d.ts +19 -0
  43. package/dist/ui/types.d.ts +7 -0
  44. package/dist/version.d.ts +1 -0
  45. package/dist/vue.d.ts +89 -0
  46. package/dist/vue.js +97 -0
  47. package/package.json +80 -4
  48. package/src/core/attrs.ts +147 -0
  49. package/src/core/avatars.ts +44 -0
  50. package/src/core/client.ts +54 -0
  51. package/src/core/discussion.ts +691 -0
  52. package/src/core/download.ts +21 -0
  53. package/src/core/format.ts +90 -0
  54. package/src/core/i18n.ts +49 -0
  55. package/src/core/names.ts +51 -0
  56. package/src/core/notice.ts +178 -0
  57. package/src/core/onboarding.ts +345 -0
  58. package/src/core/outcomes.ts +74 -0
  59. package/src/core/panel.ts +411 -0
  60. package/src/core/receipt.ts +28 -0
  61. package/src/core/text.ts +142 -0
  62. package/src/core/turnstile.ts +98 -0
  63. package/src/element.ts +109 -0
  64. package/src/global.ts +12 -0
  65. package/src/index.ts +35 -0
  66. package/src/mount.ts +127 -0
  67. package/src/react.ts +53 -0
  68. package/src/shims.d.ts +11 -0
  69. package/src/ui/AuthorAvatar.vue +26 -0
  70. package/src/ui/ConfirmDialog.vue +38 -0
  71. package/src/ui/DiscussionView.vue +294 -0
  72. package/src/ui/LinkedText.vue +18 -0
  73. package/src/ui/MessageComposer.vue +130 -0
  74. package/src/ui/MessageItem.vue +205 -0
  75. package/src/ui/MessageMenu.vue +67 -0
  76. package/src/ui/MyCommunityView.vue +369 -0
  77. package/src/ui/NoticeFormView.vue +244 -0
  78. package/src/ui/NoticeStatusView.vue +82 -0
  79. package/src/ui/OnboardingSteps.vue +163 -0
  80. package/src/ui/ReactionBar.vue +41 -0
  81. package/src/ui/ReportDialog.vue +88 -0
  82. package/src/ui/StatementView.vue +141 -0
  83. package/src/ui/context.ts +75 -0
  84. package/src/ui/discussion-context.ts +30 -0
  85. package/src/ui/styles.css +243 -0
  86. package/src/ui/types.ts +7 -0
  87. package/src/version.ts +3 -0
  88. package/src/vue.ts +116 -0
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @blogmcp/community — the community's elements for a site's own pages (m1-contracts.md §10.4; docs: "Add
3
+ * discussions to your frontend"), over `@blogmcp/sdk/community`. Every element talks to the HOST's relative
4
+ * base (`api-base`; default `/api/community` under the site's `site-base`: a headless site's BFF from
5
+ * `@blogmcp/sdk/community/server`, or with `site-base="/blog"` a managed blog's own proxy), never to kb-api directly.
6
+ *
7
+ * - `<blogmcp-discussion>` the discussion under an article;
8
+ * - `<blogmcp-notice-form>` the DSA notice form, for anyone;
9
+ * - `<blogmcp-my-community>` the reader's „Moje komunita", a statement page, a notifier's status page;
10
+ * - `defineCommunityElements()` and one `define…Element()` each — the custom elements;
11
+ * - `mountDiscussion(…)`, `mountNoticeForm(…)`, `mountMyCommunity(…)` — mount one from code;
12
+ * - `@blogmcp/community/vue`, `@blogmcp/community/react` — `<KbDiscussion>`, `<KbNoticeForm>`, `<KbMyCommunity>`;
13
+ * - `@blogmcp/community/global` — one `<script>` for sites without a bundler.
14
+ */
15
+ export { defineCommunityElements, defineDiscussionElement, defineNoticeFormElement, defineMyCommunityElement, DISCUSSION_ELEMENT_TAG, NOTICE_FORM_ELEMENT_TAG, MY_COMMUNITY_ELEMENT_TAG, type DefineCommunityElementOptions, type DefineCommunityElementsOptions, } from './element';
16
+ export { mountDiscussion, mountNoticeForm, mountMyCommunity, type MountDiscussionOptions, type MountNoticeFormOptions, type MountMyCommunityOptions } from './mount';
17
+ export { createDiscussionController, type DiscussionController, type DiscussionControllerOptions, type DiscussionUi, type ComposerMode, type Draft } from './core/discussion';
18
+ export { createNoticeForm, type NoticeFormController, type NoticeFormOptions, type NoticeFormUi } from './core/notice';
19
+ export { createPanel, type PanelController, type PanelOptions, type PanelUi } from './core/panel';
20
+ export { createOnboarding, type OnboardingModel, type OnboardingOptions, type OnboardingStep } from './core/onboarding';
21
+ export { pickLang, type Lang } from './core/i18n';
22
+ export { AVATAR_PRESETS, type AvatarPreset } from './core/avatars';
23
+ export { DEFAULT_API_BASE } from './core/client';
24
+ export type { CommunityRoutes } from './core/attrs';
25
+ export { VERSION } from './version';
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ import { A, k, D, M, N, g, h, j, i, d, a, c, b, m, f, e, p } from "./chunks/mount-DzjwnHyx.js";
2
+ const VERSION = "0.1.0";
3
+ export {
4
+ A as AVATAR_PRESETS,
5
+ k as DEFAULT_API_BASE,
6
+ D as DISCUSSION_ELEMENT_TAG,
7
+ M as MY_COMMUNITY_ELEMENT_TAG,
8
+ N as NOTICE_FORM_ELEMENT_TAG,
9
+ VERSION,
10
+ g as createDiscussionController,
11
+ h as createNoticeForm,
12
+ j as createOnboarding,
13
+ i as createPanel,
14
+ d as defineCommunityElements,
15
+ a as defineDiscussionElement,
16
+ c as defineMyCommunityElement,
17
+ b as defineNoticeFormElement,
18
+ m as mountDiscussion,
19
+ f as mountMyCommunity,
20
+ e as mountNoticeForm,
21
+ p as pickLang
22
+ };
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Put an element on the page from code: what the Vue and React wrappers do, and what any other framework can
3
+ * call from its client-side mount hook. The element is defined first, so it is created already upgraded (no
4
+ * upgrade of an unknown element later, which some DOMs never run), and every attribute and property is set
5
+ * BEFORE it connects, so it mounts with them; the returned function removes the element again (its poll and
6
+ * requests stop with it).
7
+ */
8
+ import type { CommunityTransport } from '@blogmcp/sdk/community';
9
+ import type { CommunityRoutes } from './core/attrs';
10
+ interface CommonMountOptions {
11
+ /** The host's relative base (default `/api/community` under `siteBase`): its proxy or BFF. Never kb-api's URL. */
12
+ apiBase?: string;
13
+ /**
14
+ * The path the site is served under (`/blog` on a managed blog, whose host's own `/api/` is kb-api): the default
15
+ * api-base and the default pages are taken under it. A page or base the host names itself is used as it is.
16
+ */
17
+ siteBase?: string;
18
+ /** `cs` or `en` (`sk` reads Czech); default the page's `<html lang>`. */
19
+ lang?: string;
20
+ /** The host's community pages (statements, the panel, the rules, the notice form, a notifier's status). */
21
+ routes?: CommunityRoutes;
22
+ /** CSP nonce for the element's stylesheet (and the Turnstile script). */
23
+ nonce?: string;
24
+ /** A replacement transport (tests; a signing transport later). */
25
+ transport?: CommunityTransport;
26
+ /** Where the element goes; default `document.body`. */
27
+ container?: Element;
28
+ }
29
+ export interface MountDiscussionOptions extends CommonMountOptions {
30
+ articleId: string;
31
+ /** The site's sign-in page; the current path is put in its fragment. */
32
+ signInHref?: string;
33
+ /** Head poll interval in ms (default 20 000; 0 = off). */
34
+ pollMs?: number;
35
+ }
36
+ export interface MountNoticeFormOptions extends CommonMountOptions {
37
+ /** What is reported: a message, a member (by id or handle) or an article. */
38
+ target?: {
39
+ conversationId: string;
40
+ seq: number;
41
+ } | {
42
+ memberId: string;
43
+ } | {
44
+ handle: string;
45
+ } | {
46
+ articleId: string;
47
+ };
48
+ /** Or the article (when `target` is absent). */
49
+ articleId?: string;
50
+ /** The site's Turnstile site key; without it no widget renders (kb-api then decides alone). */
51
+ turnstileSiteKey?: string;
52
+ }
53
+ export interface MountMyCommunityOptions extends CommonMountOptions {
54
+ /** Open this statement of reasons (the host's statement page). */
55
+ decisionId?: string;
56
+ /** The site's sign-in page. */
57
+ signInHref?: string;
58
+ }
59
+ /** Mount `<blogmcp-discussion>`; returns the function that removes it. */
60
+ export declare function mountDiscussion(o: MountDiscussionOptions): () => void;
61
+ /** Mount `<blogmcp-notice-form>`; returns the function that removes it. */
62
+ export declare function mountNoticeForm(o: MountNoticeFormOptions): () => void;
63
+ /** Mount `<blogmcp-my-community>`; returns the function that removes it. */
64
+ export declare function mountMyCommunity(o?: MountMyCommunityOptions): () => void;
65
+ export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `<KbDiscussion>`, `<KbNoticeForm>`, `<KbMyCommunity>` for React (18 and 19, Next.js App Router included — this
3
+ * module is a client component): each mounts its element after hydration and removes it on unmount. Each
4
+ * renders one empty `<div>` as the mount point — nothing else, on the server or the client — so the element
5
+ * sits where the component does and the page's markup is otherwise the site's alone.
6
+ *
7
+ * <KbDiscussion articleId={article.id} apiBase="/api/community" signInHref={`/sign-in#${pathname}`} />
8
+ */
9
+ import { type ReactElement } from 'react';
10
+ import type { MountDiscussionOptions, MountMyCommunityOptions, MountNoticeFormOptions } from './mount';
11
+ export type KbDiscussionProps = Omit<MountDiscussionOptions, 'container'>;
12
+ export type KbNoticeFormProps = Omit<MountNoticeFormOptions, 'container'>;
13
+ export type KbMyCommunityProps = Omit<MountMyCommunityOptions, 'container'>;
14
+ export declare function KbDiscussion(props: KbDiscussionProps): ReactElement;
15
+ export declare function KbNoticeForm(props: KbNoticeFormProps): ReactElement;
16
+ export declare function KbMyCommunity(props: KbMyCommunityProps): ReactElement;
17
+ export type { MountDiscussionOptions, MountNoticeFormOptions, MountMyCommunityOptions };
package/dist/react.js ADDED
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { useRef, useEffect, createElement } from "react";
3
+ const keyOf = (props) => JSON.stringify(props, (_k, v) => typeof v === "function" ? "[fn]" : v);
4
+ function useMounted(kind, props, load) {
5
+ const host = useRef(null);
6
+ const latest = useRef(props);
7
+ latest.current = props;
8
+ const key = keyOf(props);
9
+ useEffect(() => {
10
+ let unmount = null;
11
+ let gone = false;
12
+ void load().then((mount) => {
13
+ if (!gone && host.current) unmount = mount({ ...latest.current, container: host.current });
14
+ });
15
+ return () => {
16
+ gone = true;
17
+ unmount?.();
18
+ };
19
+ }, [key]);
20
+ return createElement("div", { ref: host, "data-blogmcp-community": kind });
21
+ }
22
+ function KbDiscussion(props) {
23
+ return useMounted("discussion", props, async () => (await import("./chunks/mount-DzjwnHyx.js").then((n) => n.l)).mountDiscussion);
24
+ }
25
+ function KbNoticeForm(props) {
26
+ return useMounted("notice-form", props, async () => (await import("./chunks/mount-DzjwnHyx.js").then((n) => n.l)).mountNoticeForm);
27
+ }
28
+ function KbMyCommunity(props) {
29
+ return useMounted("my-community", props, async () => (await import("./chunks/mount-DzjwnHyx.js").then((n) => n.l)).mountMyCommunity);
30
+ }
31
+ export {
32
+ KbDiscussion,
33
+ KbMyCommunity,
34
+ KbNoticeForm
35
+ };
@@ -0,0 +1,11 @@
1
+ import type { KnownAuthor } from '@blogmcp/sdk/community';
2
+ type __VLS_Props = {
3
+ author: KnownAuthor | {
4
+ kind: 'member';
5
+ memberId: string | null;
6
+ displayName: string | null;
7
+ avatarPreset: string | null;
8
+ };
9
+ };
10
+ 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>;
11
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import type { CommunityMessageKey } from '@blogmcp/sdk/community';
2
+ import type { TextParams } from '../core/i18n';
3
+ type __VLS_Props = {
4
+ title: CommunityMessageKey;
5
+ explain?: CommunityMessageKey;
6
+ explainParams?: TextParams;
7
+ confirm: CommunityMessageKey;
8
+ cancel?: CommunityMessageKey;
9
+ danger?: boolean;
10
+ busy?: boolean;
11
+ fallbackFocus?: () => HTMLElement | null;
12
+ };
13
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ confirm: () => any;
15
+ cancel: () => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
+ onConfirm?: (() => any) | undefined;
18
+ onCancel?: (() => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ export default _default;
@@ -0,0 +1,33 @@
1
+ import { type CommunityTransport } from '@blogmcp/sdk/community';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ articleId?: string;
4
+ /** The host's relative base (default `${siteBase}/api/community`). */
5
+ apiBase?: string;
6
+ /** The path the site is served under (`/blog` on a managed blog): its proxy and its pages, as the defaults. */
7
+ siteBase?: string;
8
+ lang?: string;
9
+ /** The site's sign-in page; the current path goes in its fragment. */
10
+ signInHref?: string;
11
+ /** JSON (or an object): `statementPath`, `myCommunityPath`, `rulesPath`, `reportPath`, `noticesPath`. */
12
+ routes?: string | Record<string, unknown>;
13
+ /** Head poll interval in ms (default 20 000; 0 = off). */
14
+ pollMs?: number;
15
+ /** A replacement transport (a property, never an attribute): tests, a signing transport later. */
16
+ transport?: CommunityTransport;
17
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
18
+ articleId?: string;
19
+ /** The host's relative base (default `${siteBase}/api/community`). */
20
+ apiBase?: string;
21
+ /** The path the site is served under (`/blog` on a managed blog): its proxy and its pages, as the defaults. */
22
+ siteBase?: string;
23
+ lang?: string;
24
+ /** The site's sign-in page; the current path goes in its fragment. */
25
+ signInHref?: string;
26
+ /** JSON (or an object): `statementPath`, `myCommunityPath`, `rulesPath`, `reportPath`, `noticesPath`. */
27
+ routes?: string | Record<string, unknown>;
28
+ /** Head poll interval in ms (default 20 000; 0 = off). */
29
+ pollMs?: number;
30
+ /** A replacement transport (a property, never an attribute): tests, a signing transport later. */
31
+ transport?: CommunityTransport;
32
+ }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ export default _default;
@@ -0,0 +1,5 @@
1
+ type __VLS_Props = {
2
+ text: string | null;
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,24 @@
1
+ import type { Draft } from '../core/discussion';
2
+ type __VLS_Props = {
3
+ draft: Draft;
4
+ kind: 'new' | 'reply' | 'edit';
5
+ /** Seconds the draft still waits (the controller's clock). */
6
+ wait: number;
7
+ replyingTo?: string | null;
8
+ /** The host's rules page. */
9
+ rulesHref?: string;
10
+ };
11
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {
12
+ focus: () => void | undefined;
13
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ confirm: (code: string, checked: boolean) => any;
15
+ submit: () => any;
16
+ cancel: () => any;
17
+ confirmed: () => any;
18
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
19
+ onConfirm?: ((code: string, checked: boolean) => any) | undefined;
20
+ onSubmit?: (() => any) | undefined;
21
+ onCancel?: (() => any) | undefined;
22
+ onConfirmed?: (() => any) | undefined;
23
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { type DiscussionMessage } from '@blogmcp/sdk/community';
2
+ type __VLS_Props = {
3
+ message: DiscussionMessage;
4
+ };
5
+ 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>;
6
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import type { MenuItem } from './types';
2
+ type __VLS_Props = {
3
+ items: MenuItem[];
4
+ };
5
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ select: (id: string) => any;
7
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
8
+ onSelect?: ((id: string) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import { type CommunityTransport } from '@blogmcp/sdk/community';
2
+ type __VLS_Props = {
3
+ apiBase?: string;
4
+ /** The path the site is served under (`/blog`): its proxy and its pages, as the defaults. */
5
+ siteBase?: string;
6
+ lang?: string;
7
+ /** Opens this statement (the host's statement page). */
8
+ decisionId?: string;
9
+ /** JSON (or an object): `statementPath`, `myCommunityPath`, `rulesPath`, `reportPath`, `noticesPath`. */
10
+ routes?: string | Record<string, unknown>;
11
+ /** The site's sign-in page, for a reader without a session. */
12
+ signInHref?: string;
13
+ transport?: CommunityTransport;
14
+ };
15
+ 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>;
16
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import { type CommunityTransport } from '@blogmcp/sdk/community';
2
+ type __VLS_Props = {
3
+ apiBase?: string;
4
+ /** The path the site is served under (`/blog`): its proxy and its pages, as the defaults. */
5
+ siteBase?: string;
6
+ lang?: string;
7
+ turnstileSiteKey?: string;
8
+ /** JSON (or an object): `{ conversationId, seq }`, `{ memberId }`, `{ handle }` or `{ articleId }`. */
9
+ target?: string | Record<string, unknown>;
10
+ articleId?: string;
11
+ /** JSON (or an object): `noticesPath` (the status page), `rulesPath`. */
12
+ routes?: string | Record<string, unknown>;
13
+ transport?: CommunityTransport;
14
+ };
15
+ declare var __VLS_1: {};
16
+ type __VLS_Slots = {} & {
17
+ turnstile?: (props: typeof __VLS_1) => any;
18
+ };
19
+ declare const __VLS_component: 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>;
20
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,15 @@
1
+ import { type NoticeStatus } from '@blogmcp/sdk/community';
2
+ import type { AppealDraft } from '../core/panel';
3
+ type __VLS_Props = {
4
+ notice: NoticeStatus;
5
+ appeal: AppealDraft;
6
+ withdrawing: boolean;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ appeal: () => any;
10
+ withdraw: () => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onAppeal?: (() => any) | undefined;
13
+ onWithdraw?: (() => any) | undefined;
14
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import type { OnboardingModel } from '../core/onboarding';
2
+ type __VLS_Props = {
3
+ model: OnboardingModel;
4
+ rulesHref: string;
5
+ };
6
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ cancel: () => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onCancel?: (() => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import type { ReactionSummary } from '@blogmcp/sdk/community';
2
+ type __VLS_Props = {
3
+ reactionSet: readonly string[];
4
+ summary: ReactionSummary;
5
+ interactive: boolean;
6
+ busy: boolean;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ react: (emoji: string) => any;
10
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
+ onReact?: ((emoji: string) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import type { ReportDraft } from '../core/discussion';
2
+ type __VLS_Props = {
3
+ report: ReportDraft;
4
+ myCommunityHref: string;
5
+ rulesHref?: string;
6
+ fallbackFocus?: () => HTMLElement | null;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ submit: () => any;
10
+ close: () => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onSubmit?: (() => any) | undefined;
13
+ onClose?: (() => any) | undefined;
14
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import { type Statement } from '@blogmcp/sdk/community';
2
+ import type { AppealDraft } from '../core/panel';
3
+ type __VLS_Props = {
4
+ statement: Statement;
5
+ appeal: AppealDraft;
6
+ withdrawing: boolean;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ appeal: () => any;
10
+ withdraw: () => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onAppeal?: (() => any) | undefined;
13
+ onWithdraw?: (() => any) | undefined;
14
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ export default _default;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * What the components of one element share: the language and its texts (`t` reads the catalogue through
3
+ * `communityMessage` and nothing else), ids unique to the element, and the dialog's focus handling.
4
+ */
5
+ import { type Ref } from 'vue';
6
+ import type { Lang, TextRef, Translate } from '../core/i18n';
7
+ export interface TextContext {
8
+ lang: Ref<Lang>;
9
+ t: Translate;
10
+ /** A TextRef (a controller's outcome) as text. */
11
+ text(ref: TextRef | null | undefined): string;
12
+ }
13
+ export declare function provideText(lang: Ref<Lang>): TextContext;
14
+ export declare function useText(): TextContext;
15
+ /** An id unique on the page (ids live in each element's shadow root, but the labels reference them). */
16
+ export declare function uid(prefix: string): string;
17
+ /**
18
+ * A native `<dialog>` opened modally while the component lives: the top layer, Esc, the focus kept
19
+ * inside — and returned to where it was (or to `fallback` when that is gone, e.g. a deleted message's menu).
20
+ */
21
+ export declare function useModal(dialog: Ref<HTMLDialogElement | null>, onCancel: () => void, fallback?: () => HTMLElement | null): void;
@@ -0,0 +1,19 @@
1
+ /** What the discussion's components share: the controller, the host's routes, what the reader opened. */
2
+ import { type ComputedRef } from 'vue';
3
+ import type { DiscussionController } from '../core/discussion';
4
+ import type { routesWithDefaults } from '../core/attrs';
5
+ export interface DiscussionContext {
6
+ ctl: DiscussionController;
7
+ routes: ComputedRef<ReturnType<typeof routesWithDefaults>>;
8
+ /** Messages of a blocked author the reader opened anyway. */
9
+ opened: Set<number>;
10
+ /** Translated messages the reader reads in the original. */
11
+ originals: Set<number>;
12
+ /** Top-level messages whose every reply the reader asked to see. */
13
+ allReplies: Set<number>;
14
+ /** Where the focus goes when the element it came from is gone (a deleted message). */
15
+ focusHeading(): HTMLElement | null;
16
+ deleteMessage(seq: number): void;
17
+ }
18
+ export declare function provideDiscussion(ctx: DiscussionContext): void;
19
+ export declare function useDiscussion(): DiscussionContext;
@@ -0,0 +1,7 @@
1
+ /** One action of a message's menu: a button, or a link (the notice page for a reader without a session). */
2
+ export interface MenuItem {
3
+ id: string;
4
+ label: string;
5
+ href?: string;
6
+ danger?: boolean;
7
+ }
@@ -0,0 +1 @@
1
+ export declare const VERSION: string;
package/dist/vue.d.ts ADDED
@@ -0,0 +1,89 @@
1
+ /**
2
+ * `<KbDiscussion>`, `<KbNoticeForm>`, `<KbMyCommunity>` for Vue / Nuxt: each mounts its element on the
3
+ * client, after hydration, and removes it on unmount. Each renders one empty `<div>` as the mount point —
4
+ * nothing else, on the server or the client — so the element sits where the component does and the page's
5
+ * markup is otherwise the site's alone.
6
+ *
7
+ * <KbDiscussion :article-id="article.id" :sign-in-href="localePath('/login')" />
8
+ *
9
+ * A site served under a path names it: `site-base="/blog"` on a managed blog (its proxy is `/blog/api/community`;
10
+ * the host's own `/api/` there is kb-api, which no element may call).
11
+ */
12
+ import { type PropType } from 'vue';
13
+ import type { CommunityTransport } from '@blogmcp/sdk/community';
14
+ import type { CommunityRoutes } from './core/attrs';
15
+ import type { MountDiscussionOptions, MountMyCommunityOptions, MountNoticeFormOptions } from './mount';
16
+ export declare const KbDiscussion: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
17
+ articleId: {
18
+ type: StringConstructor;
19
+ required: true;
20
+ };
21
+ apiBase: StringConstructor;
22
+ siteBase: StringConstructor;
23
+ lang: StringConstructor;
24
+ signInHref: StringConstructor;
25
+ routes: PropType<CommunityRoutes>;
26
+ pollMs: NumberConstructor;
27
+ nonce: StringConstructor;
28
+ transport: PropType<CommunityTransport>;
29
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
30
+ [key: string]: any;
31
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
32
+ articleId: {
33
+ type: StringConstructor;
34
+ required: true;
35
+ };
36
+ apiBase: StringConstructor;
37
+ siteBase: StringConstructor;
38
+ lang: StringConstructor;
39
+ signInHref: StringConstructor;
40
+ routes: PropType<CommunityRoutes>;
41
+ pollMs: NumberConstructor;
42
+ nonce: StringConstructor;
43
+ transport: PropType<CommunityTransport>;
44
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
45
+ export declare const KbNoticeForm: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
46
+ target: PropType<MountNoticeFormOptions["target"]>;
47
+ articleId: StringConstructor;
48
+ apiBase: StringConstructor;
49
+ siteBase: StringConstructor;
50
+ lang: StringConstructor;
51
+ turnstileSiteKey: StringConstructor;
52
+ routes: PropType<CommunityRoutes>;
53
+ nonce: StringConstructor;
54
+ transport: PropType<CommunityTransport>;
55
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
56
+ [key: string]: any;
57
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
58
+ target: PropType<MountNoticeFormOptions["target"]>;
59
+ articleId: StringConstructor;
60
+ apiBase: StringConstructor;
61
+ siteBase: StringConstructor;
62
+ lang: StringConstructor;
63
+ turnstileSiteKey: StringConstructor;
64
+ routes: PropType<CommunityRoutes>;
65
+ nonce: StringConstructor;
66
+ transport: PropType<CommunityTransport>;
67
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
68
+ export declare const KbMyCommunity: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
69
+ decisionId: StringConstructor;
70
+ apiBase: StringConstructor;
71
+ siteBase: StringConstructor;
72
+ lang: StringConstructor;
73
+ signInHref: StringConstructor;
74
+ routes: PropType<CommunityRoutes>;
75
+ nonce: StringConstructor;
76
+ transport: PropType<CommunityTransport>;
77
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
78
+ [key: string]: any;
79
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
80
+ decisionId: StringConstructor;
81
+ apiBase: StringConstructor;
82
+ siteBase: StringConstructor;
83
+ lang: StringConstructor;
84
+ signInHref: StringConstructor;
85
+ routes: PropType<CommunityRoutes>;
86
+ nonce: StringConstructor;
87
+ transport: PropType<CommunityTransport>;
88
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
89
+ export type { MountDiscussionOptions, MountNoticeFormOptions, MountMyCommunityOptions, CommunityRoutes };