@blogmcp/community 0.1.0 → 0.3.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 (114) hide show
  1. package/README.md +162 -13
  2. package/dist/blogmcp-community.global.js +8 -8
  3. package/dist/chunks/mount--2_V2q3M.js +10063 -0
  4. package/dist/core/attrs.d.ts +42 -1
  5. package/dist/core/badge.d.ts +30 -0
  6. package/dist/core/centre.d.ts +28 -0
  7. package/dist/core/digest-token.d.ts +2 -0
  8. package/dist/core/discussion.d.ts +120 -15
  9. package/dist/core/follow.d.ts +26 -0
  10. package/dist/core/format.d.ts +7 -0
  11. package/dist/core/forum-category.d.ts +85 -0
  12. package/dist/core/forum-search.d.ts +35 -0
  13. package/dist/core/forum-state.d.ts +30 -0
  14. package/dist/core/forum-words.d.ts +8 -0
  15. package/dist/core/forum.d.ts +21 -0
  16. package/dist/core/moderation.d.ts +80 -0
  17. package/dist/core/onboarding.d.ts +49 -2
  18. package/dist/core/outcomes.d.ts +2 -1
  19. package/dist/core/panel.d.ts +17 -1
  20. package/dist/core/profile.d.ts +45 -0
  21. package/dist/core/push.d.ts +63 -0
  22. package/dist/core/realtime.d.ts +46 -0
  23. package/dist/core/settings.d.ts +53 -0
  24. package/dist/core/text.d.ts +13 -0
  25. package/dist/core/topic.d.ts +47 -0
  26. package/dist/element.d.ts +47 -1
  27. package/dist/global.d.ts +8 -4
  28. package/dist/index.d.ts +20 -3
  29. package/dist/index.js +62 -12
  30. package/dist/mount.d.ts +89 -0
  31. package/dist/react.d.ts +27 -3
  32. package/dist/react.js +48 -4
  33. package/dist/ui/BadgeView.vue.d.ts +13 -0
  34. package/dist/ui/DiscussionView.vue.d.ts +11 -0
  35. package/dist/ui/FollowButtonView.vue.d.ts +17 -0
  36. package/dist/ui/FollowToggle.vue.d.ts +6 -0
  37. package/dist/ui/ForumCategoryView.vue.d.ts +13 -0
  38. package/dist/ui/ForumModerationView.vue.d.ts +12 -0
  39. package/dist/ui/ForumNotices.vue.d.ts +7 -0
  40. package/dist/ui/ForumSearchView.vue.d.ts +11 -0
  41. package/dist/ui/ForumView.vue.d.ts +12 -0
  42. package/dist/ui/LinkedText.vue.d.ts +1 -0
  43. package/dist/ui/MemberSettingsView.vue.d.ts +13 -0
  44. package/dist/ui/MembersOnly.vue.d.ts +15 -0
  45. package/dist/ui/MessageComposer.vue.d.ts +8 -2
  46. package/dist/ui/MessageMenu.vue.d.ts +2 -0
  47. package/dist/ui/ModeratorDialog.vue.d.ts +11 -0
  48. package/dist/ui/NotificationCentreView.vue.d.ts +12 -0
  49. package/dist/ui/OnboardingSteps.vue.d.ts +1 -1
  50. package/dist/ui/ProfileView.vue.d.ts +13 -0
  51. package/dist/ui/TopicRow.vue.d.ts +10 -0
  52. package/dist/ui/TopicView.vue.d.ts +32 -0
  53. package/dist/ui/WelcomeView.vue.d.ts +12 -0
  54. package/dist/ui/context.d.ts +7 -1
  55. package/dist/ui/discussion-context.d.ts +11 -3
  56. package/dist/vue.d.ts +273 -3
  57. package/dist/vue.js +235 -5
  58. package/package.json +3 -3
  59. package/src/core/attrs.ts +61 -2
  60. package/src/core/badge.ts +120 -0
  61. package/src/core/centre.ts +136 -0
  62. package/src/core/digest-token.ts +26 -0
  63. package/src/core/discussion.ts +497 -46
  64. package/src/core/follow.ts +139 -0
  65. package/src/core/format.ts +22 -0
  66. package/src/core/forum-category.ts +323 -0
  67. package/src/core/forum-search.ts +153 -0
  68. package/src/core/forum-state.ts +59 -0
  69. package/src/core/forum-words.ts +38 -0
  70. package/src/core/forum.ts +83 -0
  71. package/src/core/moderation.ts +414 -0
  72. package/src/core/onboarding.ts +177 -18
  73. package/src/core/outcomes.ts +23 -1
  74. package/src/core/panel.ts +39 -4
  75. package/src/core/profile.ts +155 -0
  76. package/src/core/push.ts +174 -0
  77. package/src/core/realtime.ts +52 -0
  78. package/src/core/settings.ts +363 -0
  79. package/src/core/text.ts +32 -0
  80. package/src/core/topic.ts +234 -0
  81. package/src/element.ts +124 -6
  82. package/src/global.ts +40 -4
  83. package/src/index.ts +84 -2
  84. package/src/mount.ts +250 -1
  85. package/src/react.ts +90 -3
  86. package/src/ui/BadgeView.vue +51 -0
  87. package/src/ui/DiscussionView.vue +43 -3
  88. package/src/ui/FollowButtonView.vue +85 -0
  89. package/src/ui/FollowToggle.vue +39 -0
  90. package/src/ui/ForumCategoryView.vue +243 -0
  91. package/src/ui/ForumModerationView.vue +309 -0
  92. package/src/ui/ForumNotices.vue +23 -0
  93. package/src/ui/ForumSearchView.vue +171 -0
  94. package/src/ui/ForumView.vue +128 -0
  95. package/src/ui/LinkedText.vue +11 -5
  96. package/src/ui/MemberSettingsView.vue +175 -0
  97. package/src/ui/MembersOnly.vue +59 -0
  98. package/src/ui/MessageComposer.vue +64 -11
  99. package/src/ui/MessageItem.vue +36 -7
  100. package/src/ui/MessageMenu.vue +3 -2
  101. package/src/ui/ModeratorDialog.vue +102 -0
  102. package/src/ui/MyCommunityView.vue +12 -0
  103. package/src/ui/NoticeStatusView.vue +15 -2
  104. package/src/ui/NotificationCentreView.vue +193 -0
  105. package/src/ui/OnboardingSteps.vue +17 -6
  106. package/src/ui/ProfileView.vue +102 -0
  107. package/src/ui/TopicRow.vue +70 -0
  108. package/src/ui/TopicView.vue +395 -0
  109. package/src/ui/WelcomeView.vue +72 -0
  110. package/src/ui/context.ts +8 -3
  111. package/src/ui/discussion-context.ts +11 -3
  112. package/src/ui/styles.css +30 -0
  113. package/src/vue.ts +271 -3
  114. package/dist/chunks/mount-DzjwnHyx.js +0 -4597
package/src/vue.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  /**
2
- * `<KbDiscussion>`, `<KbNoticeForm>`, `<KbMyCommunity>` for Vue / Nuxt: each mounts its element on the
2
+ * `<KbDiscussion>`, `<KbNoticeForm>`, `<KbMyCommunity>`, (M2) `<KbNotificationCentre>`, `<KbBadge>`,
3
+ * `<KbMemberSettings>`, `<KbProfile>`, `<KbWelcome>` and (M3) `<KbForum>`, `<KbForumCategory>`, `<KbTopic>`,
4
+ * `<KbForumSearch>`, `<KbFollowButton>`, `<KbForumModeration>` for Vue / Nuxt: each mounts its element on the
3
5
  * client, after hydration, and removes it on unmount. Each renders one empty `<div>` as the mount point —
4
6
  * nothing else, on the server or the client — so the element sits where the component does and the page's
5
7
  * markup is otherwise the site's alone.
@@ -12,7 +14,23 @@
12
14
  import { defineComponent, h, onBeforeUnmount, onMounted, ref, watch, type PropType } from 'vue'
13
15
  import type { CommunityTransport } from '@blogmcp/sdk/community'
14
16
  import type { CommunityRoutes } from './core/attrs'
15
- import type { MountDiscussionOptions, MountMyCommunityOptions, MountNoticeFormOptions } from './mount'
17
+ import type { DiscussionRealtime, TopicRealtime } from './core/realtime'
18
+ import type {
19
+ MountBadgeOptions,
20
+ MountDiscussionOptions,
21
+ MountFollowButtonOptions,
22
+ MountForumCategoryOptions,
23
+ MountForumModerationOptions,
24
+ MountForumOptions,
25
+ MountForumSearchOptions,
26
+ MountMemberSettingsOptions,
27
+ MountMyCommunityOptions,
28
+ MountNoticeFormOptions,
29
+ MountNotificationCentreOptions,
30
+ MountProfileOptions,
31
+ MountTopicOptions,
32
+ MountWelcomeOptions,
33
+ } from './mount'
16
34
 
17
35
  type Mounter<O> = (o: O & { container: Element }) => () => void
18
36
 
@@ -60,6 +78,8 @@ export const KbDiscussion = defineComponent({
60
78
  pollMs: Number,
61
79
  nonce: String,
62
80
  transport: Function as PropType<CommunityTransport>,
81
+ /** M2: `createRealtimeSession` of `@blogmcp/sdk/community/realtime`. */
82
+ realtime: Function as PropType<DiscussionRealtime>,
63
83
  },
64
84
  setup(props) {
65
85
  return useMount<MountDiscussionOptions>(
@@ -113,4 +133,252 @@ export const KbMyCommunity = defineComponent({
113
133
  },
114
134
  })
115
135
 
116
- export type { MountDiscussionOptions, MountNoticeFormOptions, MountMyCommunityOptions, CommunityRoutes }
136
+ export const KbNotificationCentre = defineComponent({
137
+ name: 'KbNotificationCentre',
138
+ props: {
139
+ apiBase: String,
140
+ siteBase: String,
141
+ lang: String,
142
+ signInHref: String,
143
+ routes: Object as PropType<CommunityRoutes>,
144
+ nonce: String,
145
+ transport: Function as PropType<CommunityTransport>,
146
+ },
147
+ setup(props) {
148
+ return useMount<MountNotificationCentreOptions>(
149
+ 'notification-centre',
150
+ () => defined({ ...props }) as MountNotificationCentreOptions,
151
+ async () => (await import('./mount')).mountNotificationCentre as Mounter<MountNotificationCentreOptions>,
152
+ )
153
+ },
154
+ })
155
+
156
+ export const KbBadge = defineComponent({
157
+ name: 'KbBadge',
158
+ props: {
159
+ apiBase: String,
160
+ siteBase: String,
161
+ lang: String,
162
+ routes: Object as PropType<CommunityRoutes>,
163
+ pollMs: Number,
164
+ nonce: String,
165
+ transport: Function as PropType<CommunityTransport>,
166
+ },
167
+ setup(props) {
168
+ return useMount<MountBadgeOptions>(
169
+ 'badge',
170
+ () => defined({ ...props }) as MountBadgeOptions,
171
+ async () => (await import('./mount')).mountBadge as Mounter<MountBadgeOptions>,
172
+ )
173
+ },
174
+ })
175
+
176
+ export const KbMemberSettings = defineComponent({
177
+ name: 'KbMemberSettings',
178
+ props: {
179
+ apiBase: String,
180
+ siteBase: String,
181
+ lang: String,
182
+ swPath: String,
183
+ signInHref: String,
184
+ routes: Object as PropType<CommunityRoutes>,
185
+ nonce: String,
186
+ transport: Function as PropType<CommunityTransport>,
187
+ },
188
+ setup(props) {
189
+ return useMount<MountMemberSettingsOptions>(
190
+ 'member-settings',
191
+ () => defined({ ...props }) as MountMemberSettingsOptions,
192
+ async () => (await import('./mount')).mountMemberSettings as Mounter<MountMemberSettingsOptions>,
193
+ )
194
+ },
195
+ })
196
+
197
+ export const KbProfile = defineComponent({
198
+ name: 'KbProfile',
199
+ props: {
200
+ handle: { type: String, required: true },
201
+ apiBase: String,
202
+ siteBase: String,
203
+ lang: String,
204
+ signInHref: String,
205
+ routes: Object as PropType<CommunityRoutes>,
206
+ nonce: String,
207
+ transport: Function as PropType<CommunityTransport>,
208
+ },
209
+ setup(props) {
210
+ return useMount<MountProfileOptions>(
211
+ 'profile',
212
+ () => defined({ ...props }) as MountProfileOptions,
213
+ async () => (await import('./mount')).mountProfile as Mounter<MountProfileOptions>,
214
+ )
215
+ },
216
+ })
217
+
218
+ export const KbWelcome = defineComponent({
219
+ name: 'KbWelcome',
220
+ props: {
221
+ apiBase: String,
222
+ siteBase: String,
223
+ lang: String,
224
+ signInHref: String,
225
+ routes: Object as PropType<CommunityRoutes>,
226
+ nonce: String,
227
+ transport: Function as PropType<CommunityTransport>,
228
+ },
229
+ setup(props) {
230
+ return useMount<MountWelcomeOptions>(
231
+ 'welcome',
232
+ () => defined({ ...props }) as MountWelcomeOptions,
233
+ async () => (await import('./mount')).mountWelcome as Mounter<MountWelcomeOptions>,
234
+ )
235
+ },
236
+ })
237
+
238
+ // ───────────────────────── M3: the forum (m3-contracts.md §5.3) ─────────────────────────
239
+
240
+ export const KbForum = defineComponent({
241
+ name: 'KbForum',
242
+ props: {
243
+ apiBase: String,
244
+ siteBase: String,
245
+ lang: String,
246
+ signInHref: String,
247
+ routes: Object as PropType<CommunityRoutes>,
248
+ nonce: String,
249
+ transport: Function as PropType<CommunityTransport>,
250
+ },
251
+ setup(props) {
252
+ return useMount<MountForumOptions>(
253
+ 'forum',
254
+ () => defined({ ...props }) as MountForumOptions,
255
+ async () => (await import('./mount')).mountForum as Mounter<MountForumOptions>,
256
+ )
257
+ },
258
+ })
259
+
260
+ export const KbForumCategory = defineComponent({
261
+ name: 'KbForumCategory',
262
+ props: {
263
+ slug: { type: String, required: true },
264
+ apiBase: String,
265
+ siteBase: String,
266
+ lang: String,
267
+ signInHref: String,
268
+ routes: Object as PropType<CommunityRoutes>,
269
+ nonce: String,
270
+ transport: Function as PropType<CommunityTransport>,
271
+ },
272
+ setup(props) {
273
+ return useMount<MountForumCategoryOptions>(
274
+ 'forum-category',
275
+ () => defined({ ...props }) as MountForumCategoryOptions,
276
+ async () => (await import('./mount')).mountForumCategory as Mounter<MountForumCategoryOptions>,
277
+ )
278
+ },
279
+ })
280
+
281
+ export const KbTopic = defineComponent({
282
+ name: 'KbTopic',
283
+ props: {
284
+ conversationId: { type: String, required: true },
285
+ apiBase: String,
286
+ siteBase: String,
287
+ lang: String,
288
+ signInHref: String,
289
+ routes: Object as PropType<CommunityRoutes>,
290
+ pollMs: Number,
291
+ nonce: String,
292
+ transport: Function as PropType<CommunityTransport>,
293
+ /** `createRealtimeSession` of `@blogmcp/sdk/community/realtime`. */
294
+ realtime: Function as PropType<TopicRealtime>,
295
+ },
296
+ setup(props) {
297
+ return useMount<MountTopicOptions>(
298
+ 'topic',
299
+ () => defined({ ...props }) as MountTopicOptions,
300
+ async () => (await import('./mount')).mountTopic as Mounter<MountTopicOptions>,
301
+ )
302
+ },
303
+ })
304
+
305
+ export const KbForumSearch = defineComponent({
306
+ name: 'KbForumSearch',
307
+ props: {
308
+ apiBase: String,
309
+ siteBase: String,
310
+ lang: String,
311
+ signInHref: String,
312
+ routes: Object as PropType<CommunityRoutes>,
313
+ nonce: String,
314
+ transport: Function as PropType<CommunityTransport>,
315
+ },
316
+ setup(props) {
317
+ return useMount<MountForumSearchOptions>(
318
+ 'forum-search',
319
+ () => defined({ ...props }) as MountForumSearchOptions,
320
+ async () => (await import('./mount')).mountForumSearch as Mounter<MountForumSearchOptions>,
321
+ )
322
+ },
323
+ })
324
+
325
+ export const KbFollowButton = defineComponent({
326
+ name: 'KbFollowButton',
327
+ props: {
328
+ targetKind: { type: String as PropType<'conversation' | 'category'>, required: true },
329
+ targetId: { type: String, required: true },
330
+ following: { type: Boolean, default: undefined },
331
+ apiBase: String,
332
+ siteBase: String,
333
+ lang: String,
334
+ nonce: String,
335
+ transport: Function as PropType<CommunityTransport>,
336
+ },
337
+ setup(props) {
338
+ return useMount<MountFollowButtonOptions>(
339
+ 'follow-button',
340
+ () => defined({ ...props }) as MountFollowButtonOptions,
341
+ async () => (await import('./mount')).mountFollowButton as Mounter<MountFollowButtonOptions>,
342
+ )
343
+ },
344
+ })
345
+
346
+ export const KbForumModeration = defineComponent({
347
+ name: 'KbForumModeration',
348
+ props: {
349
+ categoryId: String,
350
+ apiBase: String,
351
+ siteBase: String,
352
+ lang: String,
353
+ routes: Object as PropType<CommunityRoutes>,
354
+ nonce: String,
355
+ transport: Function as PropType<CommunityTransport>,
356
+ },
357
+ setup(props) {
358
+ return useMount<MountForumModerationOptions>(
359
+ 'forum-moderation',
360
+ () => defined({ ...props }) as MountForumModerationOptions,
361
+ async () => (await import('./mount')).mountForumModeration as Mounter<MountForumModerationOptions>,
362
+ )
363
+ },
364
+ })
365
+
366
+ export type {
367
+ MountDiscussionOptions,
368
+ MountNoticeFormOptions,
369
+ MountMyCommunityOptions,
370
+ MountNotificationCentreOptions,
371
+ MountBadgeOptions,
372
+ MountMemberSettingsOptions,
373
+ MountProfileOptions,
374
+ MountWelcomeOptions,
375
+ MountForumOptions,
376
+ MountForumCategoryOptions,
377
+ MountTopicOptions,
378
+ MountForumSearchOptions,
379
+ MountFollowButtonOptions,
380
+ MountForumModerationOptions,
381
+ CommunityRoutes,
382
+ DiscussionRealtime,
383
+ TopicRealtime,
384
+ }