@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.
Files changed (150) hide show
  1. package/dist/blogmcp-community-private.global.js +4 -0
  2. package/dist/blogmcp-community.global.js +3 -3
  3. package/dist/chunks/{mount-Ts_r2fwt.js → mount-SKmc4NgD.js} +39 -9
  4. package/dist/chunks/private-mount-bhCQeScD.js +5397 -0
  5. package/dist/core/attrs.d.ts +15 -0
  6. package/dist/core/settings.d.ts +5 -0
  7. package/dist/index.js +2 -2
  8. package/dist/private/core/dock.d.ts +38 -0
  9. package/dist/private/core/push.d.ts +49 -0
  10. package/dist/private/core/realtime.d.ts +57 -0
  11. package/dist/private/core/setup.d.ts +43 -0
  12. package/dist/private/core/view.d.ts +179 -0
  13. package/dist/private/dm/composer.d.ts +34 -0
  14. package/dist/private/dm/controller.d.ts +162 -0
  15. package/dist/private/dm/index.d.ts +14 -0
  16. package/dist/private/dm/links.d.ts +33 -0
  17. package/dist/private/dm/muted.d.ts +37 -0
  18. package/dist/private/dm/search.d.ts +7 -0
  19. package/dist/private/dm/text.d.ts +27 -0
  20. package/dist/private/dm/ui/DmBlocks.vue.d.ts +8 -0
  21. package/dist/private/dm/ui/DmCases.vue.d.ts +8 -0
  22. package/dist/private/dm/ui/DmComposer.vue.d.ts +20 -0
  23. package/dist/private/dm/ui/DmInbox.vue.d.ts +12 -0
  24. package/dist/private/dm/ui/DmLinkWarning.vue.d.ts +8 -0
  25. package/dist/private/dm/ui/DmLocalAids.vue.d.ts +8 -0
  26. package/dist/private/dm/ui/DmMessageText.vue.d.ts +8 -0
  27. package/dist/private/dm/ui/DmNew.vue.d.ts +12 -0
  28. package/dist/private/dm/ui/DmReport.vue.d.ts +8 -0
  29. package/dist/private/dm/ui/DmRequests.vue.d.ts +12 -0
  30. package/dist/private/dm/ui/DmScreens.vue.d.ts +9 -0
  31. package/dist/private/dm/ui/DmThread.vue.d.ts +9 -0
  32. package/dist/private/element.d.ts +23 -0
  33. package/dist/private/global.d.ts +10 -0
  34. package/dist/private/i18n.d.ts +41 -0
  35. package/dist/private/index.d.ts +32 -0
  36. package/dist/private/index.js +57 -0
  37. package/dist/private/mount.d.ts +55 -0
  38. package/dist/private/pages/api.d.ts +44 -0
  39. package/dist/private/pages/element.d.ts +6 -0
  40. package/dist/private/pages/fragment.d.ts +43 -0
  41. package/dist/private/pages/i18n.d.ts +25 -0
  42. package/dist/private/pages/index.d.ts +1 -0
  43. package/dist/private/pages/pages.d.ts +276 -0
  44. package/dist/private/pages/proof.d.ts +36 -0
  45. package/dist/private/pages/provider-view.d.ts +33 -0
  46. package/dist/private/pages/setup.d.ts +42 -0
  47. package/dist/private/pages/ui/AccountPageRoot.vue.d.ts +9 -0
  48. package/dist/private/pages/ui/PageActivation.vue.d.ts +9 -0
  49. package/dist/private/pages/ui/PageAddress.vue.d.ts +8 -0
  50. package/dist/private/pages/ui/PageDeviceApprove.vue.d.ts +8 -0
  51. package/dist/private/pages/ui/PageDevices.vue.d.ts +8 -0
  52. package/dist/private/pages/ui/PageExport.vue.d.ts +8 -0
  53. package/dist/private/pages/ui/PageMessages.vue.d.ts +9 -0
  54. package/dist/private/react.d.ts +12 -0
  55. package/dist/private/react.js +36 -0
  56. package/dist/private/ui/ChatDockRoot.vue.d.ts +20 -0
  57. package/dist/private/ui/LegalText.vue.d.ts +13 -0
  58. package/dist/private/ui/PrivateScreens.vue.d.ts +14 -0
  59. package/dist/private/ui/PrivateViewRoot.vue.d.ts +23 -0
  60. package/dist/private/ui/PromiseBlock.vue.d.ts +9 -0
  61. package/dist/private/ui/ProviderLine.vue.d.ts +8 -0
  62. package/dist/private/ui/ScreenActivation.vue.d.ts +8 -0
  63. package/dist/private/ui/ScreenAddress.vue.d.ts +8 -0
  64. package/dist/private/ui/ScreenApproval.vue.d.ts +8 -0
  65. package/dist/private/ui/ScreenDevices.vue.d.ts +8 -0
  66. package/dist/private/ui/ScreenHome.vue.d.ts +12 -0
  67. package/dist/private/ui/ScreenNotifications.vue.d.ts +8 -0
  68. package/dist/private/ui/ScreenReads.vue.d.ts +8 -0
  69. package/dist/private/ui/ScreenSettings.vue.d.ts +8 -0
  70. package/dist/private/ui/root.d.ts +35 -0
  71. package/dist/private/ui/text.d.ts +22 -0
  72. package/dist/private/vue.d.ts +88 -0
  73. package/dist/private/vue.js +72 -0
  74. package/dist/react.js +14 -14
  75. package/dist/vue.js +14 -14
  76. package/package.json +23 -6
  77. package/src/core/attrs.ts +19 -0
  78. package/src/core/settings.ts +55 -12
  79. package/src/private/core/dock.ts +105 -0
  80. package/src/private/core/push.ts +166 -0
  81. package/src/private/core/realtime.ts +109 -0
  82. package/src/private/core/setup.ts +75 -0
  83. package/src/private/core/view.ts +920 -0
  84. package/src/private/dm/composer.ts +74 -0
  85. package/src/private/dm/controller.ts +636 -0
  86. package/src/private/dm/index.ts +14 -0
  87. package/src/private/dm/links.ts +55 -0
  88. package/src/private/dm/muted.ts +160 -0
  89. package/src/private/dm/search.ts +18 -0
  90. package/src/private/dm/text.ts +60 -0
  91. package/src/private/dm/ui/DmBlocks.vue +27 -0
  92. package/src/private/dm/ui/DmCases.vue +58 -0
  93. package/src/private/dm/ui/DmComposer.vue +68 -0
  94. package/src/private/dm/ui/DmInbox.vue +34 -0
  95. package/src/private/dm/ui/DmLinkWarning.vue +27 -0
  96. package/src/private/dm/ui/DmLocalAids.vue +43 -0
  97. package/src/private/dm/ui/DmMessageText.vue +16 -0
  98. package/src/private/dm/ui/DmNew.vue +46 -0
  99. package/src/private/dm/ui/DmReport.vue +93 -0
  100. package/src/private/dm/ui/DmRequests.vue +50 -0
  101. package/src/private/dm/ui/DmScreens.vue +66 -0
  102. package/src/private/dm/ui/DmThread.vue +235 -0
  103. package/src/private/element.ts +90 -0
  104. package/src/private/global.ts +14 -0
  105. package/src/private/i18n.ts +127 -0
  106. package/src/private/index.ts +68 -0
  107. package/src/private/messages/cs.json +311 -0
  108. package/src/private/messages/en.json +319 -0
  109. package/src/private/mount.ts +103 -0
  110. package/src/private/pages/api.ts +96 -0
  111. package/src/private/pages/build.d.mts +2 -0
  112. package/src/private/pages/build.mjs +72 -0
  113. package/src/private/pages/element.ts +49 -0
  114. package/src/private/pages/fragment.ts +63 -0
  115. package/src/private/pages/i18n.ts +82 -0
  116. package/src/private/pages/index.ts +10 -0
  117. package/src/private/pages/messages/cs.json +97 -0
  118. package/src/private/pages/messages/en.json +97 -0
  119. package/src/private/pages/pages.ts +410 -0
  120. package/src/private/pages/proof.ts +110 -0
  121. package/src/private/pages/provider-view.ts +121 -0
  122. package/src/private/pages/setup.ts +79 -0
  123. package/src/private/pages/ui/AccountPageRoot.vue +45 -0
  124. package/src/private/pages/ui/PageActivation.vue +42 -0
  125. package/src/private/pages/ui/PageAddress.vue +39 -0
  126. package/src/private/pages/ui/PageDeviceApprove.vue +62 -0
  127. package/src/private/pages/ui/PageDevices.vue +84 -0
  128. package/src/private/pages/ui/PageExport.vue +35 -0
  129. package/src/private/pages/ui/PageMessages.vue +39 -0
  130. package/src/private/pages/ui/account.css +6 -0
  131. package/src/private/react.ts +49 -0
  132. package/src/private/shims.d.ts +6 -0
  133. package/src/private/ui/ChatDockRoot.vue +119 -0
  134. package/src/private/ui/LegalText.vue +18 -0
  135. package/src/private/ui/PrivateScreens.vue +61 -0
  136. package/src/private/ui/PrivateViewRoot.vue +70 -0
  137. package/src/private/ui/PromiseBlock.vue +18 -0
  138. package/src/private/ui/ProviderLine.vue +20 -0
  139. package/src/private/ui/ScreenActivation.vue +82 -0
  140. package/src/private/ui/ScreenAddress.vue +37 -0
  141. package/src/private/ui/ScreenApproval.vue +71 -0
  142. package/src/private/ui/ScreenDevices.vue +42 -0
  143. package/src/private/ui/ScreenHome.vue +29 -0
  144. package/src/private/ui/ScreenNotifications.vue +44 -0
  145. package/src/private/ui/ScreenReads.vue +23 -0
  146. package/src/private/ui/ScreenSettings.vue +44 -0
  147. package/src/private/ui/private.css +81 -0
  148. package/src/private/ui/root.ts +89 -0
  149. package/src/private/ui/text.ts +40 -0
  150. package/src/private/vue.ts +87 -0
@@ -0,0 +1,74 @@
1
+ /**
2
+ * What the composer says, and what a message still allows (m4-contracts.md §7.8 DM8b, §3.5, invariant 12).
3
+ *
4
+ * **The composer sentence** is read from the capability matrix (`privatePromise`'s `receivers` and `keys`, PU1), never
5
+ * worded on its own, and it says no more than the promise does: one short line under the text box per party that
6
+ * receives what the member is about to write — the other participant; the website's code, which puts it on the screen
7
+ * under tenant rendering (and, where the website and blogmcp are the same legal person, `same_entity`, the line that
8
+ * says this person writes that code and is barred by the law, not by a contract it would sign with itself); whoever
9
+ * handles a report, with the at most 10 preceding messages the matrix gives them; the court or police order, which is in
10
+ * every row, so the list never reads as complete without it; the delegated addendum where the website can sign in as the
11
+ * member (under both renderings); and that the messages are not end-to-end encrypted. test/private/dm/composer.spec.ts
12
+ * checks every space × identity × rendering × same-entity × host combination against the promise's own keys, and the
13
+ * tone test covers its words with the rest of the conversations' catalogue.
14
+ *
15
+ * **The windows.** An edit is taken within `private_edit_window_minutes` of the message (15) and a delete for everyone
16
+ * within `private_delete_for_all_hours` (48) — platform settings the browser is not told. The affordances follow those
17
+ * defaults; kb-api's `EDIT_WINDOW` / `DELETE_WINDOW` stays the authority, and the thread then offers „Smazat u mě“
18
+ * (hide), which has no window.
19
+ */
20
+ import type { PrivateDmMessage, PrivatePromise } from '@blogmcp/sdk/community/private'
21
+
22
+ export const DM_COMPOSER_KEYS = Object.freeze([
23
+ 'private.dm.composer.participants',
24
+ 'private.dm.composer.display',
25
+ 'private.dm.composer.sameEntity',
26
+ 'private.dm.composer.reports',
27
+ 'private.dm.composer.orders',
28
+ 'private.dm.composer.delegated',
29
+ 'private.dm.composer.notE2e',
30
+ ] as const)
31
+ export type DmComposerKey = (typeof DM_COMPOSER_KEYS)[number]
32
+
33
+ /** The composer sentence's keys for this member, in the order they are shown (see the module doc). */
34
+ export function composerKeys(promise: Pick<PrivatePromise, 'receivers' | 'keys' | 'delegated'> | null): DmComposerKey[] {
35
+ if (!promise) return []
36
+ const r = promise.receivers
37
+ const said = new Set<string>(promise.keys)
38
+ const keys: DmComposerKey[] = []
39
+ if (r.participants === 'content') keys.push('private.dm.composer.participants')
40
+ if (r.websiteCode === 'content_for_display') {
41
+ // Under same_entity the promise drops its contract sentence for the one that names the operator: so does this line.
42
+ keys.push(said.has('private.promise.same_entity') ? 'private.dm.composer.sameEntity' : 'private.dm.composer.display')
43
+ }
44
+ if (r.authorisedPersons === 'reported_content' || r.trustAndSafety === 'reported_content') keys.push('private.dm.composer.reports')
45
+ if (said.has('private.promise.orders')) keys.push('private.dm.composer.orders')
46
+ if (promise.delegated) keys.push('private.dm.composer.delegated')
47
+ if (said.has('private.promise.not_e2e')) keys.push('private.dm.composer.notE2e')
48
+ return keys
49
+ }
50
+
51
+ /** `private_edit_window_minutes`' default (§5.11's settings). */
52
+ export const DM_EDIT_WINDOW_MS = 15 * 60_000
53
+ /** `private_delete_for_all_hours`' default. */
54
+ export const DM_DELETE_FOR_ALL_MS = 48 * 3_600_000
55
+
56
+ const age = (m: Pick<PrivateDmMessage, 'createdAt'>, now: number): number => {
57
+ const t = Date.parse(m.createdAt)
58
+ return Number.isNaN(t) ? Number.POSITIVE_INFINITY : now - t
59
+ }
60
+
61
+ /** The member's own visible message, still within the edit window. */
62
+ export function canEdit(m: PrivateDmMessage, now = Date.now()): boolean {
63
+ return m.mine && m.state === 'visible' && age(m, now) < DM_EDIT_WINDOW_MS
64
+ }
65
+
66
+ /** The member's own visible message, still within the window of a delete for everyone. */
67
+ export function canDeleteForAll(m: PrivateDmMessage, now = Date.now()): boolean {
68
+ return m.mine && m.state === 'visible' && age(m, now) < DM_DELETE_FOR_ALL_MS
69
+ }
70
+
71
+ /** A message the member can report: the other participant's, with its text (a tombstone or a removed one has none). */
72
+ export function canReport(m: PrivateDmMessage): boolean {
73
+ return !m.mine && m.state === 'visible'
74
+ }