@blogmcp/community 0.4.0 → 0.5.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/blogmcp-community-private.global.js +4 -0
- package/dist/blogmcp-community.global.js +3 -3
- package/dist/chunks/{mount-Ts_r2fwt.js → mount-SKmc4NgD.js} +39 -9
- package/dist/chunks/private-mount-bhCQeScD.js +5397 -0
- package/dist/core/attrs.d.ts +15 -0
- package/dist/core/settings.d.ts +5 -0
- package/dist/index.js +2 -2
- package/dist/private/core/dock.d.ts +38 -0
- package/dist/private/core/push.d.ts +49 -0
- package/dist/private/core/realtime.d.ts +57 -0
- package/dist/private/core/setup.d.ts +43 -0
- package/dist/private/core/view.d.ts +179 -0
- package/dist/private/dm/composer.d.ts +34 -0
- package/dist/private/dm/controller.d.ts +162 -0
- package/dist/private/dm/index.d.ts +14 -0
- package/dist/private/dm/links.d.ts +33 -0
- package/dist/private/dm/muted.d.ts +37 -0
- package/dist/private/dm/search.d.ts +7 -0
- package/dist/private/dm/text.d.ts +27 -0
- package/dist/private/dm/ui/DmBlocks.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmCases.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmComposer.vue.d.ts +20 -0
- package/dist/private/dm/ui/DmInbox.vue.d.ts +12 -0
- package/dist/private/dm/ui/DmLinkWarning.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmLocalAids.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmMessageText.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmNew.vue.d.ts +12 -0
- package/dist/private/dm/ui/DmReport.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmRequests.vue.d.ts +12 -0
- package/dist/private/dm/ui/DmScreens.vue.d.ts +9 -0
- package/dist/private/dm/ui/DmThread.vue.d.ts +9 -0
- package/dist/private/element.d.ts +23 -0
- package/dist/private/global.d.ts +10 -0
- package/dist/private/i18n.d.ts +41 -0
- package/dist/private/index.d.ts +32 -0
- package/dist/private/index.js +57 -0
- package/dist/private/mount.d.ts +55 -0
- package/dist/private/pages/api.d.ts +44 -0
- package/dist/private/pages/element.d.ts +6 -0
- package/dist/private/pages/fragment.d.ts +43 -0
- package/dist/private/pages/i18n.d.ts +25 -0
- package/dist/private/pages/index.d.ts +1 -0
- package/dist/private/pages/pages.d.ts +276 -0
- package/dist/private/pages/proof.d.ts +36 -0
- package/dist/private/pages/provider-view.d.ts +33 -0
- package/dist/private/pages/setup.d.ts +42 -0
- package/dist/private/pages/ui/AccountPageRoot.vue.d.ts +9 -0
- package/dist/private/pages/ui/PageActivation.vue.d.ts +9 -0
- package/dist/private/pages/ui/PageAddress.vue.d.ts +8 -0
- package/dist/private/pages/ui/PageDeviceApprove.vue.d.ts +8 -0
- package/dist/private/pages/ui/PageDevices.vue.d.ts +8 -0
- package/dist/private/pages/ui/PageExport.vue.d.ts +8 -0
- package/dist/private/pages/ui/PageMessages.vue.d.ts +9 -0
- package/dist/private/react.d.ts +12 -0
- package/dist/private/react.js +36 -0
- package/dist/private/ui/ChatDockRoot.vue.d.ts +20 -0
- package/dist/private/ui/LegalText.vue.d.ts +13 -0
- package/dist/private/ui/PrivateScreens.vue.d.ts +14 -0
- package/dist/private/ui/PrivateViewRoot.vue.d.ts +23 -0
- package/dist/private/ui/PromiseBlock.vue.d.ts +9 -0
- package/dist/private/ui/ProviderLine.vue.d.ts +8 -0
- package/dist/private/ui/ScreenActivation.vue.d.ts +8 -0
- package/dist/private/ui/ScreenAddress.vue.d.ts +8 -0
- package/dist/private/ui/ScreenApproval.vue.d.ts +8 -0
- package/dist/private/ui/ScreenDevices.vue.d.ts +8 -0
- package/dist/private/ui/ScreenHome.vue.d.ts +12 -0
- package/dist/private/ui/ScreenNotifications.vue.d.ts +8 -0
- package/dist/private/ui/ScreenReads.vue.d.ts +8 -0
- package/dist/private/ui/ScreenSettings.vue.d.ts +8 -0
- package/dist/private/ui/root.d.ts +35 -0
- package/dist/private/ui/text.d.ts +22 -0
- package/dist/private/vue.d.ts +88 -0
- package/dist/private/vue.js +72 -0
- package/dist/react.js +14 -14
- package/dist/vue.js +14 -14
- package/package.json +23 -6
- package/src/core/attrs.ts +19 -0
- package/src/core/settings.ts +55 -12
- package/src/private/core/dock.ts +105 -0
- package/src/private/core/push.ts +166 -0
- package/src/private/core/realtime.ts +109 -0
- package/src/private/core/setup.ts +75 -0
- package/src/private/core/view.ts +920 -0
- package/src/private/dm/composer.ts +74 -0
- package/src/private/dm/controller.ts +636 -0
- package/src/private/dm/index.ts +14 -0
- package/src/private/dm/links.ts +55 -0
- package/src/private/dm/muted.ts +160 -0
- package/src/private/dm/search.ts +18 -0
- package/src/private/dm/text.ts +60 -0
- package/src/private/dm/ui/DmBlocks.vue +27 -0
- package/src/private/dm/ui/DmCases.vue +58 -0
- package/src/private/dm/ui/DmComposer.vue +68 -0
- package/src/private/dm/ui/DmInbox.vue +34 -0
- package/src/private/dm/ui/DmLinkWarning.vue +27 -0
- package/src/private/dm/ui/DmLocalAids.vue +43 -0
- package/src/private/dm/ui/DmMessageText.vue +16 -0
- package/src/private/dm/ui/DmNew.vue +46 -0
- package/src/private/dm/ui/DmReport.vue +93 -0
- package/src/private/dm/ui/DmRequests.vue +50 -0
- package/src/private/dm/ui/DmScreens.vue +66 -0
- package/src/private/dm/ui/DmThread.vue +235 -0
- package/src/private/element.ts +90 -0
- package/src/private/global.ts +14 -0
- package/src/private/i18n.ts +127 -0
- package/src/private/index.ts +68 -0
- package/src/private/messages/cs.json +311 -0
- package/src/private/messages/en.json +319 -0
- package/src/private/mount.ts +103 -0
- package/src/private/pages/api.ts +96 -0
- package/src/private/pages/build.d.mts +2 -0
- package/src/private/pages/build.mjs +72 -0
- package/src/private/pages/element.ts +49 -0
- package/src/private/pages/fragment.ts +63 -0
- package/src/private/pages/i18n.ts +82 -0
- package/src/private/pages/index.ts +10 -0
- package/src/private/pages/messages/cs.json +97 -0
- package/src/private/pages/messages/en.json +97 -0
- package/src/private/pages/pages.ts +410 -0
- package/src/private/pages/proof.ts +110 -0
- package/src/private/pages/provider-view.ts +121 -0
- package/src/private/pages/setup.ts +79 -0
- package/src/private/pages/ui/AccountPageRoot.vue +45 -0
- package/src/private/pages/ui/PageActivation.vue +42 -0
- package/src/private/pages/ui/PageAddress.vue +39 -0
- package/src/private/pages/ui/PageDeviceApprove.vue +62 -0
- package/src/private/pages/ui/PageDevices.vue +84 -0
- package/src/private/pages/ui/PageExport.vue +35 -0
- package/src/private/pages/ui/PageMessages.vue +39 -0
- package/src/private/pages/ui/account.css +6 -0
- package/src/private/react.ts +49 -0
- package/src/private/shims.d.ts +6 -0
- package/src/private/ui/ChatDockRoot.vue +119 -0
- package/src/private/ui/LegalText.vue +18 -0
- package/src/private/ui/PrivateScreens.vue +61 -0
- package/src/private/ui/PrivateViewRoot.vue +70 -0
- package/src/private/ui/PromiseBlock.vue +18 -0
- package/src/private/ui/ProviderLine.vue +20 -0
- package/src/private/ui/ScreenActivation.vue +82 -0
- package/src/private/ui/ScreenAddress.vue +37 -0
- package/src/private/ui/ScreenApproval.vue +71 -0
- package/src/private/ui/ScreenDevices.vue +42 -0
- package/src/private/ui/ScreenHome.vue +29 -0
- package/src/private/ui/ScreenNotifications.vue +44 -0
- package/src/private/ui/ScreenReads.vue +23 -0
- package/src/private/ui/ScreenSettings.vue +44 -0
- package/src/private/ui/private.css +81 -0
- package/src/private/ui/root.ts +89 -0
- package/src/private/ui/text.ts +40 -0
- package/src/private/vue.ts +87 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PrivateViewController } from '../core/view';
|
|
2
|
+
import type { Lang } from '../i18n';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
controller: PrivateViewController;
|
|
5
|
+
lang: Lang;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
navigate: (screen: "messages" | "settings" | "notifications" | "address" | "activation" | "devices" | "approval" | "home" | "reads") => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onNavigate?: ((screen: "messages" | "settings" | "notifications" | "address" | "activation" | "devices" | "approval" | "home" | "reads") => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PrivateViewController } from '../core/view';
|
|
2
|
+
import type { Lang } from '../i18n';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
controller: PrivateViewController;
|
|
5
|
+
lang: Lang;
|
|
6
|
+
};
|
|
7
|
+
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>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PrivateViewController } from '../core/view';
|
|
2
|
+
import type { Lang } from '../i18n';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
controller: PrivateViewController;
|
|
5
|
+
lang: Lang;
|
|
6
|
+
};
|
|
7
|
+
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>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type PrivateViewController } from '../core/view';
|
|
2
|
+
import type { Lang } from '../i18n';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
controller: PrivateViewController;
|
|
5
|
+
lang: Lang;
|
|
6
|
+
};
|
|
7
|
+
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>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What both private roots share: their props (attributes, and the `transport`, `client` and `push` properties), the
|
|
3
|
+
* setup from them, and the private-root mark on the host element (`markPrivateRoot`, §6.1, §7.1). The mark makes the
|
|
4
|
+
* host pause its analytics and RUM, so it is on only while the root may show something private: from the moment the
|
|
5
|
+
* host's `me/get` names a private block that is live or read_only and rendered here — before the private client is
|
|
6
|
+
* asked anything — through the private screens, a reload of them and a refusal said in their place. It is off for a
|
|
7
|
+
* visitor, on a dark instance, under `provider_page` (only a link to the account host), when the setup is refused and
|
|
8
|
+
* after a refusal no retry cures (FINAL_REFUSALS), and it goes with the element. A dock in the root layout is therefore unmarked on every page of a signed-out visitor.
|
|
9
|
+
*/
|
|
10
|
+
import { type ComputedRef, type ShallowRef } from 'vue';
|
|
11
|
+
import { type PrivateClient } from '@blogmcp/sdk/community/private';
|
|
12
|
+
import type { CommunityTransport } from '@blogmcp/sdk/community';
|
|
13
|
+
import { type Lang } from '../i18n';
|
|
14
|
+
import { type PrivateSetup } from '../core/setup';
|
|
15
|
+
import type { PrivatePushPort } from '../core/push';
|
|
16
|
+
import type { PrivateRealtimeInput } from '../core/realtime';
|
|
17
|
+
export interface PrivateRootProps {
|
|
18
|
+
kbOrigin?: string;
|
|
19
|
+
apiBase?: string;
|
|
20
|
+
siteBase?: string;
|
|
21
|
+
routes?: string;
|
|
22
|
+
lang?: string;
|
|
23
|
+
siteName?: string;
|
|
24
|
+
swPath?: string;
|
|
25
|
+
accountOrigin?: string;
|
|
26
|
+
transport?: CommunityTransport;
|
|
27
|
+
client?: PrivateClient;
|
|
28
|
+
push?: PrivatePushPort | null;
|
|
29
|
+
realtime?: PrivateRealtimeInput;
|
|
30
|
+
}
|
|
31
|
+
export interface PrivateRoot {
|
|
32
|
+
setup: ShallowRef<PrivateSetup | null>;
|
|
33
|
+
lang: ComputedRef<Lang>;
|
|
34
|
+
}
|
|
35
|
+
export declare function usePrivateRoot(props: PrivateRootProps): PrivateRoot;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The screens' words: catalogue keys turned into text in the element's language (i18n.ts), a controller's text
|
|
3
|
+
* reference (an `error:<CODE>` one is its refusal's sentence), and a date.
|
|
4
|
+
*/
|
|
5
|
+
import { type Lang, type PrivateParams } from '../i18n';
|
|
6
|
+
import type { PrivateTextRef } from '../core/view';
|
|
7
|
+
export interface ScreenText {
|
|
8
|
+
pt(key: string, params?: PrivateParams): string;
|
|
9
|
+
refText(ref: PrivateTextRef | null): string;
|
|
10
|
+
when(iso: string | null | undefined, withTime?: boolean): string;
|
|
11
|
+
}
|
|
12
|
+
export declare function screenText(lang: Lang): ScreenText;
|
|
13
|
+
/** An https address kb-api handed over (the address link, the provider's links), or null: nothing else is a link. */
|
|
14
|
+
export declare function httpsHref(value: string | null | undefined): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* A served text with the session's placeholders filled from `display` (§5.11: `{{device_label}}`, `{{approval_email}}`
|
|
17
|
+
* — masked on this screen, B-63 —, `{{accepted_at}}`); the text stays text.
|
|
18
|
+
*/
|
|
19
|
+
export declare function fillDisplay(body: string, display: {
|
|
20
|
+
approvalEmail: string | null;
|
|
21
|
+
deviceLabel: string;
|
|
22
|
+
} | null | undefined, acceptedAt: string): string;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<KbChatDock>` and `<KbPrivateView>` for Vue / Nuxt (m4-contracts.md §6.2): each mounts its element on the client,
|
|
3
|
+
* after hydration, and removes it on unmount; each renders one empty `<div>` as the mount point. The element's module
|
|
4
|
+
* (which imports the browser-only `@blogmcp/sdk/community/private`) is imported lazily, so a server render never
|
|
5
|
+
* loads it. `<KbChatDock>` belongs in the root layout: a client-side navigation then keeps its session and windows,
|
|
6
|
+
* and `hidden-by-host` hides it on a page without unmounting it.
|
|
7
|
+
*/
|
|
8
|
+
import { type PropType } from 'vue';
|
|
9
|
+
import type { CommunityTransport } from '@blogmcp/sdk/community';
|
|
10
|
+
import type { PrivateClient } from '@blogmcp/sdk/community/private';
|
|
11
|
+
import type { CommunityRoutes } from '../core/attrs';
|
|
12
|
+
import type { PrivateDockRealtime } from './core/dock';
|
|
13
|
+
export declare const KbChatDock: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
14
|
+
hiddenByHost: BooleanConstructor;
|
|
15
|
+
kbOrigin: {
|
|
16
|
+
readonly type: StringConstructor;
|
|
17
|
+
readonly required: true;
|
|
18
|
+
};
|
|
19
|
+
apiBase: StringConstructor;
|
|
20
|
+
siteBase: StringConstructor;
|
|
21
|
+
lang: StringConstructor;
|
|
22
|
+
routes: PropType<CommunityRoutes>;
|
|
23
|
+
siteName: StringConstructor;
|
|
24
|
+
swPath: StringConstructor;
|
|
25
|
+
accountOrigin: StringConstructor;
|
|
26
|
+
nonce: StringConstructor;
|
|
27
|
+
transport: PropType<CommunityTransport>;
|
|
28
|
+
client: PropType<PrivateClient>;
|
|
29
|
+
realtime: PropType<PrivateDockRealtime>;
|
|
30
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
|
+
hiddenByHost: BooleanConstructor;
|
|
34
|
+
kbOrigin: {
|
|
35
|
+
readonly type: StringConstructor;
|
|
36
|
+
readonly required: true;
|
|
37
|
+
};
|
|
38
|
+
apiBase: StringConstructor;
|
|
39
|
+
siteBase: StringConstructor;
|
|
40
|
+
lang: StringConstructor;
|
|
41
|
+
routes: PropType<CommunityRoutes>;
|
|
42
|
+
siteName: StringConstructor;
|
|
43
|
+
swPath: StringConstructor;
|
|
44
|
+
accountOrigin: StringConstructor;
|
|
45
|
+
nonce: StringConstructor;
|
|
46
|
+
transport: PropType<CommunityTransport>;
|
|
47
|
+
client: PropType<PrivateClient>;
|
|
48
|
+
realtime: PropType<PrivateDockRealtime>;
|
|
49
|
+
}>> & Readonly<{}>, {
|
|
50
|
+
hiddenByHost: boolean;
|
|
51
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
52
|
+
export declare const KbPrivateView: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
53
|
+
screen: StringConstructor;
|
|
54
|
+
kbOrigin: {
|
|
55
|
+
readonly type: StringConstructor;
|
|
56
|
+
readonly required: true;
|
|
57
|
+
};
|
|
58
|
+
apiBase: StringConstructor;
|
|
59
|
+
siteBase: StringConstructor;
|
|
60
|
+
lang: StringConstructor;
|
|
61
|
+
routes: PropType<CommunityRoutes>;
|
|
62
|
+
siteName: StringConstructor;
|
|
63
|
+
swPath: StringConstructor;
|
|
64
|
+
accountOrigin: StringConstructor;
|
|
65
|
+
nonce: StringConstructor;
|
|
66
|
+
transport: PropType<CommunityTransport>;
|
|
67
|
+
client: PropType<PrivateClient>;
|
|
68
|
+
realtime: PropType<PrivateDockRealtime>;
|
|
69
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
70
|
+
[key: string]: any;
|
|
71
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
72
|
+
screen: StringConstructor;
|
|
73
|
+
kbOrigin: {
|
|
74
|
+
readonly type: StringConstructor;
|
|
75
|
+
readonly required: true;
|
|
76
|
+
};
|
|
77
|
+
apiBase: StringConstructor;
|
|
78
|
+
siteBase: StringConstructor;
|
|
79
|
+
lang: StringConstructor;
|
|
80
|
+
routes: PropType<CommunityRoutes>;
|
|
81
|
+
siteName: StringConstructor;
|
|
82
|
+
swPath: StringConstructor;
|
|
83
|
+
accountOrigin: StringConstructor;
|
|
84
|
+
nonce: StringConstructor;
|
|
85
|
+
transport: PropType<CommunityTransport>;
|
|
86
|
+
client: PropType<PrivateClient>;
|
|
87
|
+
realtime: PropType<PrivateDockRealtime>;
|
|
88
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { defineComponent, watch, h, ref, onMounted, onBeforeUnmount } from "vue";
|
|
2
|
+
const HIDDEN_BY_HOST = "hidden-by-host";
|
|
3
|
+
function defined(o) {
|
|
4
|
+
const out = {};
|
|
5
|
+
for (const [k, v] of Object.entries(o)) if (v !== void 0 && v !== null) out[k] = v;
|
|
6
|
+
return out;
|
|
7
|
+
}
|
|
8
|
+
const commonProps = {
|
|
9
|
+
kbOrigin: { type: String, required: true },
|
|
10
|
+
apiBase: String,
|
|
11
|
+
siteBase: String,
|
|
12
|
+
lang: String,
|
|
13
|
+
routes: Object,
|
|
14
|
+
siteName: String,
|
|
15
|
+
swPath: String,
|
|
16
|
+
accountOrigin: String,
|
|
17
|
+
nonce: String,
|
|
18
|
+
transport: Function,
|
|
19
|
+
client: Object,
|
|
20
|
+
/** The live inbox: the SDK's `createPrivateRealtime`, or a source of the host's own (`{ subscribe }`). */
|
|
21
|
+
realtime: [Function, Object]
|
|
22
|
+
};
|
|
23
|
+
function useMount(kind, options, load, after) {
|
|
24
|
+
const host = ref(null);
|
|
25
|
+
let unmount = null;
|
|
26
|
+
let gone = false;
|
|
27
|
+
let ticket = 0;
|
|
28
|
+
async function mount() {
|
|
29
|
+
const mine = ++ticket;
|
|
30
|
+
const mountFn = await load();
|
|
31
|
+
if (gone || mine !== ticket || !host.value) return;
|
|
32
|
+
unmount?.();
|
|
33
|
+
unmount = mountFn({ ...options(), container: host.value });
|
|
34
|
+
after?.(host.value.firstElementChild);
|
|
35
|
+
}
|
|
36
|
+
onMounted(() => void mount());
|
|
37
|
+
watch(
|
|
38
|
+
() => JSON.stringify(options(), (_k, v) => typeof v === "function" ? "[fn]" : v),
|
|
39
|
+
() => void mount()
|
|
40
|
+
);
|
|
41
|
+
onBeforeUnmount(() => {
|
|
42
|
+
gone = true;
|
|
43
|
+
unmount?.();
|
|
44
|
+
unmount = null;
|
|
45
|
+
});
|
|
46
|
+
return host;
|
|
47
|
+
}
|
|
48
|
+
const KbChatDock = defineComponent({
|
|
49
|
+
name: "KbChatDock",
|
|
50
|
+
props: { ...commonProps, hiddenByHost: Boolean },
|
|
51
|
+
setup(props) {
|
|
52
|
+
const opts = () => defined({ ...props, hiddenByHost: void 0 });
|
|
53
|
+
const host = useMount("chat-dock", opts, async () => (await import("../chunks/private-mount-bhCQeScD.js").then((n) => n._)).mountChatDock, (el) => el?.toggleAttribute(HIDDEN_BY_HOST, props.hiddenByHost));
|
|
54
|
+
watch(
|
|
55
|
+
() => props.hiddenByHost,
|
|
56
|
+
(hidden) => host.value?.firstElementChild?.toggleAttribute(HIDDEN_BY_HOST, hidden)
|
|
57
|
+
);
|
|
58
|
+
return () => h("div", { ref: host, "data-blogmcp-community": "chat-dock" });
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const KbPrivateView = defineComponent({
|
|
62
|
+
name: "KbPrivateView",
|
|
63
|
+
props: { ...commonProps, screen: String },
|
|
64
|
+
setup(props) {
|
|
65
|
+
const host = useMount("private-view", () => defined({ ...props }), async () => (await import("../chunks/private-mount-bhCQeScD.js").then((n) => n._)).mountPrivateView);
|
|
66
|
+
return () => h("div", { ref: host, "data-blogmcp-community": "private-view" });
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
export {
|
|
70
|
+
KbChatDock,
|
|
71
|
+
KbPrivateView
|
|
72
|
+
};
|
package/dist/react.js
CHANGED
|
@@ -20,46 +20,46 @@ function useMounted(kind, props, load) {
|
|
|
20
20
|
return createElement("div", { ref: host, "data-blogmcp-community": kind });
|
|
21
21
|
}
|
|
22
22
|
function KbDiscussion(props) {
|
|
23
|
-
return useMounted("discussion", props, async () => (await import("./chunks/mount-
|
|
23
|
+
return useMounted("discussion", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountDiscussion);
|
|
24
24
|
}
|
|
25
25
|
function KbNoticeForm(props) {
|
|
26
|
-
return useMounted("notice-form", props, async () => (await import("./chunks/mount-
|
|
26
|
+
return useMounted("notice-form", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountNoticeForm);
|
|
27
27
|
}
|
|
28
28
|
function KbMyCommunity(props) {
|
|
29
|
-
return useMounted("my-community", props, async () => (await import("./chunks/mount-
|
|
29
|
+
return useMounted("my-community", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountMyCommunity);
|
|
30
30
|
}
|
|
31
31
|
function KbNotificationCentre(props) {
|
|
32
|
-
return useMounted("notification-centre", props, async () => (await import("./chunks/mount-
|
|
32
|
+
return useMounted("notification-centre", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountNotificationCentre);
|
|
33
33
|
}
|
|
34
34
|
function KbBadge(props) {
|
|
35
|
-
return useMounted("badge", props, async () => (await import("./chunks/mount-
|
|
35
|
+
return useMounted("badge", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountBadge);
|
|
36
36
|
}
|
|
37
37
|
function KbMemberSettings(props) {
|
|
38
|
-
return useMounted("member-settings", props, async () => (await import("./chunks/mount-
|
|
38
|
+
return useMounted("member-settings", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountMemberSettings);
|
|
39
39
|
}
|
|
40
40
|
function KbProfile(props) {
|
|
41
|
-
return useMounted("profile", props, async () => (await import("./chunks/mount-
|
|
41
|
+
return useMounted("profile", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountProfile);
|
|
42
42
|
}
|
|
43
43
|
function KbWelcome(props) {
|
|
44
|
-
return useMounted("welcome", props, async () => (await import("./chunks/mount-
|
|
44
|
+
return useMounted("welcome", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountWelcome);
|
|
45
45
|
}
|
|
46
46
|
function KbForum(props) {
|
|
47
|
-
return useMounted("forum", props, async () => (await import("./chunks/mount-
|
|
47
|
+
return useMounted("forum", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountForum);
|
|
48
48
|
}
|
|
49
49
|
function KbForumCategory(props) {
|
|
50
|
-
return useMounted("forum-category", props, async () => (await import("./chunks/mount-
|
|
50
|
+
return useMounted("forum-category", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountForumCategory);
|
|
51
51
|
}
|
|
52
52
|
function KbTopic(props) {
|
|
53
|
-
return useMounted("topic", props, async () => (await import("./chunks/mount-
|
|
53
|
+
return useMounted("topic", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountTopic);
|
|
54
54
|
}
|
|
55
55
|
function KbForumSearch(props) {
|
|
56
|
-
return useMounted("forum-search", props, async () => (await import("./chunks/mount-
|
|
56
|
+
return useMounted("forum-search", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountForumSearch);
|
|
57
57
|
}
|
|
58
58
|
function KbFollowButton(props) {
|
|
59
|
-
return useMounted("follow-button", props, async () => (await import("./chunks/mount-
|
|
59
|
+
return useMounted("follow-button", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountFollowButton);
|
|
60
60
|
}
|
|
61
61
|
function KbForumModeration(props) {
|
|
62
|
-
return useMounted("forum-moderation", props, async () => (await import("./chunks/mount-
|
|
62
|
+
return useMounted("forum-moderation", props, async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountForumModeration);
|
|
63
63
|
}
|
|
64
64
|
export {
|
|
65
65
|
KbBadge,
|
package/dist/vue.js
CHANGED
|
@@ -47,7 +47,7 @@ const KbDiscussion = defineComponent({
|
|
|
47
47
|
return useMount(
|
|
48
48
|
"discussion",
|
|
49
49
|
() => defined({ ...props }),
|
|
50
|
-
async () => (await import("./chunks/mount-
|
|
50
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountDiscussion
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
});
|
|
@@ -68,7 +68,7 @@ const KbNoticeForm = defineComponent({
|
|
|
68
68
|
return useMount(
|
|
69
69
|
"notice-form",
|
|
70
70
|
() => defined({ ...props }),
|
|
71
|
-
async () => (await import("./chunks/mount-
|
|
71
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountNoticeForm
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
});
|
|
@@ -88,7 +88,7 @@ const KbMyCommunity = defineComponent({
|
|
|
88
88
|
return useMount(
|
|
89
89
|
"my-community",
|
|
90
90
|
() => defined({ ...props }),
|
|
91
|
-
async () => (await import("./chunks/mount-
|
|
91
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountMyCommunity
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -107,7 +107,7 @@ const KbNotificationCentre = defineComponent({
|
|
|
107
107
|
return useMount(
|
|
108
108
|
"notification-centre",
|
|
109
109
|
() => defined({ ...props }),
|
|
110
|
-
async () => (await import("./chunks/mount-
|
|
110
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountNotificationCentre
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
});
|
|
@@ -126,7 +126,7 @@ const KbBadge = defineComponent({
|
|
|
126
126
|
return useMount(
|
|
127
127
|
"badge",
|
|
128
128
|
() => defined({ ...props }),
|
|
129
|
-
async () => (await import("./chunks/mount-
|
|
129
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountBadge
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
});
|
|
@@ -146,7 +146,7 @@ const KbMemberSettings = defineComponent({
|
|
|
146
146
|
return useMount(
|
|
147
147
|
"member-settings",
|
|
148
148
|
() => defined({ ...props }),
|
|
149
|
-
async () => (await import("./chunks/mount-
|
|
149
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountMemberSettings
|
|
150
150
|
);
|
|
151
151
|
}
|
|
152
152
|
});
|
|
@@ -166,7 +166,7 @@ const KbProfile = defineComponent({
|
|
|
166
166
|
return useMount(
|
|
167
167
|
"profile",
|
|
168
168
|
() => defined({ ...props }),
|
|
169
|
-
async () => (await import("./chunks/mount-
|
|
169
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountProfile
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
});
|
|
@@ -185,7 +185,7 @@ const KbWelcome = defineComponent({
|
|
|
185
185
|
return useMount(
|
|
186
186
|
"welcome",
|
|
187
187
|
() => defined({ ...props }),
|
|
188
|
-
async () => (await import("./chunks/mount-
|
|
188
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountWelcome
|
|
189
189
|
);
|
|
190
190
|
}
|
|
191
191
|
});
|
|
@@ -204,7 +204,7 @@ const KbForum = defineComponent({
|
|
|
204
204
|
return useMount(
|
|
205
205
|
"forum",
|
|
206
206
|
() => defined({ ...props }),
|
|
207
|
-
async () => (await import("./chunks/mount-
|
|
207
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountForum
|
|
208
208
|
);
|
|
209
209
|
}
|
|
210
210
|
});
|
|
@@ -224,7 +224,7 @@ const KbForumCategory = defineComponent({
|
|
|
224
224
|
return useMount(
|
|
225
225
|
"forum-category",
|
|
226
226
|
() => defined({ ...props }),
|
|
227
|
-
async () => (await import("./chunks/mount-
|
|
227
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountForumCategory
|
|
228
228
|
);
|
|
229
229
|
}
|
|
230
230
|
});
|
|
@@ -247,7 +247,7 @@ const KbTopic = defineComponent({
|
|
|
247
247
|
return useMount(
|
|
248
248
|
"topic",
|
|
249
249
|
() => defined({ ...props }),
|
|
250
|
-
async () => (await import("./chunks/mount-
|
|
250
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountTopic
|
|
251
251
|
);
|
|
252
252
|
}
|
|
253
253
|
});
|
|
@@ -266,7 +266,7 @@ const KbForumSearch = defineComponent({
|
|
|
266
266
|
return useMount(
|
|
267
267
|
"forum-search",
|
|
268
268
|
() => defined({ ...props }),
|
|
269
|
-
async () => (await import("./chunks/mount-
|
|
269
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountForumSearch
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
272
|
});
|
|
@@ -286,7 +286,7 @@ const KbFollowButton = defineComponent({
|
|
|
286
286
|
return useMount(
|
|
287
287
|
"follow-button",
|
|
288
288
|
() => defined({ ...props }),
|
|
289
|
-
async () => (await import("./chunks/mount-
|
|
289
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountFollowButton
|
|
290
290
|
);
|
|
291
291
|
}
|
|
292
292
|
});
|
|
@@ -305,7 +305,7 @@ const KbForumModeration = defineComponent({
|
|
|
305
305
|
return useMount(
|
|
306
306
|
"forum-moderation",
|
|
307
307
|
() => defined({ ...props }),
|
|
308
|
-
async () => (await import("./chunks/mount-
|
|
308
|
+
async () => (await import("./chunks/mount-SKmc4NgD.js").then((n) => n.ad)).mountForumModeration
|
|
309
309
|
);
|
|
310
310
|
}
|
|
311
311
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blogmcp/community",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Community elements for your own site: the discussion under an article, the DSA notice form and the reader's „My community” panel. Custom elements + Vue/React wrappers + a script build, over @blogmcp/sdk/community.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"sideEffects": [
|
|
13
13
|
"./dist/global.js",
|
|
14
14
|
"./dist/blogmcp-community.global.js",
|
|
15
|
-
"./src/global.ts"
|
|
15
|
+
"./src/global.ts",
|
|
16
|
+
"./dist/blogmcp-community-private.global.js",
|
|
17
|
+
"./src/private/global.ts"
|
|
16
18
|
],
|
|
17
19
|
"exports": {
|
|
18
20
|
".": {
|
|
@@ -27,23 +29,38 @@
|
|
|
27
29
|
"types": "./dist/react.d.ts",
|
|
28
30
|
"import": "./dist/react.js"
|
|
29
31
|
},
|
|
30
|
-
"./global": "./dist/blogmcp-community.global.js"
|
|
32
|
+
"./global": "./dist/blogmcp-community.global.js",
|
|
33
|
+
"./private": {
|
|
34
|
+
"types": "./dist/private/index.d.ts",
|
|
35
|
+
"import": "./dist/private/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./private/vue": {
|
|
38
|
+
"types": "./dist/private/vue.d.ts",
|
|
39
|
+
"import": "./dist/private/vue.js"
|
|
40
|
+
},
|
|
41
|
+
"./private/react": {
|
|
42
|
+
"types": "./dist/private/react.d.ts",
|
|
43
|
+
"import": "./dist/private/react.js"
|
|
44
|
+
},
|
|
45
|
+
"./private/global": "./dist/blogmcp-community-private.global.js"
|
|
31
46
|
},
|
|
32
47
|
"files": [
|
|
33
48
|
"dist",
|
|
34
49
|
"src"
|
|
35
50
|
],
|
|
36
51
|
"scripts": {
|
|
37
|
-
"build": "
|
|
52
|
+
"build": "npm run build:esm && vite build --config vite.global.config.ts && vite build --config vite.private.config.ts --mode global && vue-tsc -p tsconfig.build.json && node scripts/check-size.mjs",
|
|
53
|
+
"build:esm": "vite build && vite build --config vite.private.config.ts",
|
|
38
54
|
"test": "vitest run",
|
|
39
55
|
"test:e2e": "playwright test --config test/e2e/playwright.config.ts",
|
|
56
|
+
"test:e2e:private": "playwright test --config test/private/e2e/playwright.config.ts",
|
|
40
57
|
"typecheck": "vue-tsc --noEmit -p tsconfig.json",
|
|
41
58
|
"prepack": "node ../../scripts/pack-dist-types.mjs prepack",
|
|
42
59
|
"postpack": "node ../../scripts/pack-dist-types.mjs postpack"
|
|
43
60
|
},
|
|
44
61
|
"dependencies": {
|
|
45
|
-
"@blogmcp/sanitize": "^0.
|
|
46
|
-
"@blogmcp/sdk": "^0.
|
|
62
|
+
"@blogmcp/sanitize": "^0.14.0",
|
|
63
|
+
"@blogmcp/sdk": "^0.14.0",
|
|
47
64
|
"vue": "^3.5.0"
|
|
48
65
|
},
|
|
49
66
|
"peerDependencies": {
|
package/src/core/attrs.ts
CHANGED
|
@@ -69,6 +69,18 @@ export interface CommunityRoutes {
|
|
|
69
69
|
topicPath?: string
|
|
70
70
|
/** M3: the forum's search (the forum's search box goes there with the query in the fragment, `#q=…`). */
|
|
71
71
|
searchPath?: string
|
|
72
|
+
/**
|
|
73
|
+
* M4 PU2 (m4-contracts.md §6.2, A.9): the private view's page (`/komunita/zpravy`); the dock links it, and the host
|
|
74
|
+
* centre's content-free „Soukromé zprávy" link leads there.
|
|
75
|
+
*/
|
|
76
|
+
messagesPath?: string
|
|
77
|
+
/**
|
|
78
|
+
* M4: the host's grant route (POST, `createPrivateGrantHandler`), on its own origin: the private view posts its key's
|
|
79
|
+
* thumbprint there for a one-minute grant. Only `@blogmcp/community/private` reads it; the public elements never call it.
|
|
80
|
+
*/
|
|
81
|
+
grantPath?: string
|
|
82
|
+
/** M4: the host's hand-off route (GET, `createPrivateGrantHandoff`) for `provider_page`: the link to the account host goes through it. */
|
|
83
|
+
grantHandoffPath?: string
|
|
72
84
|
}
|
|
73
85
|
|
|
74
86
|
const ROUTE_KEYS = [
|
|
@@ -89,6 +101,9 @@ const ROUTE_KEYS = [
|
|
|
89
101
|
'categoryPath',
|
|
90
102
|
'topicPath',
|
|
91
103
|
'searchPath',
|
|
104
|
+
'messagesPath',
|
|
105
|
+
'grantPath',
|
|
106
|
+
'grantHandoffPath',
|
|
92
107
|
] as const
|
|
93
108
|
|
|
94
109
|
/** A path on the host's own site (the SDK's links.ts rule). */
|
|
@@ -164,6 +179,10 @@ export function routesWithDefaults(
|
|
|
164
179
|
categoryPath: routes.categoryPath ?? `${siteBase}${COMMUNITY_ROUTES.category}`,
|
|
165
180
|
topicPath: routes.topicPath ?? `${siteBase}${COMMUNITY_ROUTES.topic}`,
|
|
166
181
|
searchPath: routes.searchPath ?? `${siteBase}${COMMUNITY_ROUTES.search}`,
|
|
182
|
+
// M4 PU2 (§6.2): the private view's page and the two grant routes the host's server serves.
|
|
183
|
+
messagesPath: routes.messagesPath ?? `${siteBase}${COMMUNITY_ROUTES.messages}`,
|
|
184
|
+
grantPath: routes.grantPath ?? `${siteBase}${COMMUNITY_ROUTES.grant}`,
|
|
185
|
+
grantHandoffPath: routes.grantHandoffPath ?? `${siteBase}${COMMUNITY_ROUTES.grantHandoff}`,
|
|
167
186
|
}
|
|
168
187
|
}
|
|
169
188
|
|