@actuate-media/cms-admin 0.11.0 → 0.12.1

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 (183) hide show
  1. package/LICENSE +21 -21
  2. package/dist/__tests__/components/comment-mark.test.d.ts +2 -0
  3. package/dist/__tests__/components/comment-mark.test.d.ts.map +1 -0
  4. package/dist/__tests__/components/comment-mark.test.js +89 -0
  5. package/dist/__tests__/components/comment-mark.test.js.map +1 -0
  6. package/dist/__tests__/components/comment-side-panel.test.d.ts +2 -0
  7. package/dist/__tests__/components/comment-side-panel.test.d.ts.map +1 -0
  8. package/dist/__tests__/components/comment-side-panel.test.js +291 -0
  9. package/dist/__tests__/components/comment-side-panel.test.js.map +1 -0
  10. package/dist/__tests__/components/notification-bell.test.d.ts +2 -0
  11. package/dist/__tests__/components/notification-bell.test.d.ts.map +1 -0
  12. package/dist/__tests__/components/notification-bell.test.js +200 -0
  13. package/dist/__tests__/components/notification-bell.test.js.map +1 -0
  14. package/dist/__tests__/components/offline-status.test.d.ts +2 -0
  15. package/dist/__tests__/components/offline-status.test.d.ts.map +1 -0
  16. package/dist/__tests__/components/offline-status.test.js +56 -0
  17. package/dist/__tests__/components/offline-status.test.js.map +1 -0
  18. package/dist/__tests__/components/presence-chips-helpers.test.d.ts +2 -0
  19. package/dist/__tests__/components/presence-chips-helpers.test.d.ts.map +1 -0
  20. package/dist/__tests__/components/presence-chips-helpers.test.js +35 -0
  21. package/dist/__tests__/components/presence-chips-helpers.test.js.map +1 -0
  22. package/dist/__tests__/fields/component-block-helpers.test.d.ts +7 -0
  23. package/dist/__tests__/fields/component-block-helpers.test.d.ts.map +1 -0
  24. package/dist/__tests__/fields/component-block-helpers.test.js +592 -0
  25. package/dist/__tests__/fields/component-block-helpers.test.js.map +1 -0
  26. package/dist/__tests__/lib/active-editor.test.d.ts +2 -0
  27. package/dist/__tests__/lib/active-editor.test.d.ts.map +1 -0
  28. package/dist/__tests__/lib/active-editor.test.js +57 -0
  29. package/dist/__tests__/lib/active-editor.test.js.map +1 -0
  30. package/dist/__tests__/lib/coauthor-client.test.d.ts +2 -0
  31. package/dist/__tests__/lib/coauthor-client.test.d.ts.map +1 -0
  32. package/dist/__tests__/lib/coauthor-client.test.js +173 -0
  33. package/dist/__tests__/lib/coauthor-client.test.js.map +1 -0
  34. package/dist/__tests__/lib/collaboration-provider.test.d.ts +2 -0
  35. package/dist/__tests__/lib/collaboration-provider.test.d.ts.map +1 -0
  36. package/dist/__tests__/lib/collaboration-provider.test.js +335 -0
  37. package/dist/__tests__/lib/collaboration-provider.test.js.map +1 -0
  38. package/dist/__tests__/lib/comment-anchor.test.d.ts +2 -0
  39. package/dist/__tests__/lib/comment-anchor.test.d.ts.map +1 -0
  40. package/dist/__tests__/lib/comment-anchor.test.js +173 -0
  41. package/dist/__tests__/lib/comment-anchor.test.js.map +1 -0
  42. package/dist/__tests__/lib/comments-client.test.d.ts +2 -0
  43. package/dist/__tests__/lib/comments-client.test.d.ts.map +1 -0
  44. package/dist/__tests__/lib/comments-client.test.js +202 -0
  45. package/dist/__tests__/lib/comments-client.test.js.map +1 -0
  46. package/dist/__tests__/lib/notifications-client.test.d.ts +2 -0
  47. package/dist/__tests__/lib/notifications-client.test.d.ts.map +1 -0
  48. package/dist/__tests__/lib/notifications-client.test.js +155 -0
  49. package/dist/__tests__/lib/notifications-client.test.js.map +1 -0
  50. package/dist/__tests__/lib/slash-command.test.d.ts +2 -0
  51. package/dist/__tests__/lib/slash-command.test.d.ts.map +1 -0
  52. package/dist/__tests__/lib/slash-command.test.js +123 -0
  53. package/dist/__tests__/lib/slash-command.test.js.map +1 -0
  54. package/dist/actuate-admin.css +1 -1
  55. package/dist/components/AICoauthorBubbleMenu.d.ts +18 -0
  56. package/dist/components/AICoauthorBubbleMenu.d.ts.map +1 -0
  57. package/dist/components/AICoauthorBubbleMenu.js +113 -0
  58. package/dist/components/AICoauthorBubbleMenu.js.map +1 -0
  59. package/dist/components/CoauthorResultPopover.d.ts +28 -0
  60. package/dist/components/CoauthorResultPopover.d.ts.map +1 -0
  61. package/dist/components/CoauthorResultPopover.js +42 -0
  62. package/dist/components/CoauthorResultPopover.js.map +1 -0
  63. package/dist/components/CommandPalette.d.ts +1 -1
  64. package/dist/components/CommandPalette.d.ts.map +1 -1
  65. package/dist/components/CommandPalette.js +138 -40
  66. package/dist/components/CommandPalette.js.map +1 -1
  67. package/dist/components/CommentMark.d.ts +54 -0
  68. package/dist/components/CommentMark.d.ts.map +1 -0
  69. package/dist/components/CommentMark.js +104 -0
  70. package/dist/components/CommentMark.js.map +1 -0
  71. package/dist/components/CommentSidePanel.d.ts +86 -0
  72. package/dist/components/CommentSidePanel.d.ts.map +1 -0
  73. package/dist/components/CommentSidePanel.js +165 -0
  74. package/dist/components/CommentSidePanel.js.map +1 -0
  75. package/dist/components/LivePreview.d.ts.map +1 -1
  76. package/dist/components/LivePreview.js +80 -16
  77. package/dist/components/LivePreview.js.map +1 -1
  78. package/dist/components/NotificationBell.d.ts +45 -0
  79. package/dist/components/NotificationBell.d.ts.map +1 -0
  80. package/dist/components/NotificationBell.js +90 -0
  81. package/dist/components/NotificationBell.js.map +1 -0
  82. package/dist/components/OfflineStatus.d.ts +39 -0
  83. package/dist/components/OfflineStatus.d.ts.map +1 -0
  84. package/dist/components/OfflineStatus.js +47 -0
  85. package/dist/components/OfflineStatus.js.map +1 -0
  86. package/dist/components/PresenceChips.d.ts +31 -0
  87. package/dist/components/PresenceChips.d.ts.map +1 -0
  88. package/dist/components/PresenceChips.js +58 -0
  89. package/dist/components/PresenceChips.js.map +1 -0
  90. package/dist/components/TipTapEditor.d.ts +61 -1
  91. package/dist/components/TipTapEditor.d.ts.map +1 -1
  92. package/dist/components/TipTapEditor.js +211 -8
  93. package/dist/components/TipTapEditor.js.map +1 -1
  94. package/dist/components/ui/Badge.d.ts +1 -1
  95. package/dist/fields/ComponentBlockField.d.ts +25 -0
  96. package/dist/fields/ComponentBlockField.d.ts.map +1 -0
  97. package/dist/fields/ComponentBlockField.js +74 -0
  98. package/dist/fields/ComponentBlockField.js.map +1 -0
  99. package/dist/fields/FieldRenderer.d.ts +3 -0
  100. package/dist/fields/FieldRenderer.d.ts.map +1 -1
  101. package/dist/fields/FieldRenderer.js +3 -1
  102. package/dist/fields/FieldRenderer.js.map +1 -1
  103. package/dist/fields/PropInput.d.ts +14 -0
  104. package/dist/fields/PropInput.d.ts.map +1 -0
  105. package/dist/fields/PropInput.js +163 -0
  106. package/dist/fields/PropInput.js.map +1 -0
  107. package/dist/fields/component-block-helpers.d.ts +96 -0
  108. package/dist/fields/component-block-helpers.d.ts.map +1 -0
  109. package/dist/fields/component-block-helpers.js +323 -0
  110. package/dist/fields/component-block-helpers.js.map +1 -0
  111. package/dist/fields/index.d.ts +4 -0
  112. package/dist/fields/index.d.ts.map +1 -1
  113. package/dist/fields/index.js +2 -0
  114. package/dist/fields/index.js.map +1 -1
  115. package/dist/index.d.ts +10 -0
  116. package/dist/index.d.ts.map +1 -1
  117. package/dist/index.js +5 -0
  118. package/dist/index.js.map +1 -1
  119. package/dist/lib/active-editor.d.ts +6 -0
  120. package/dist/lib/active-editor.d.ts.map +1 -0
  121. package/dist/lib/active-editor.js +35 -0
  122. package/dist/lib/active-editor.js.map +1 -0
  123. package/dist/lib/coauthor-client.d.ts +72 -0
  124. package/dist/lib/coauthor-client.d.ts.map +1 -0
  125. package/dist/lib/coauthor-client.js +98 -0
  126. package/dist/lib/coauthor-client.js.map +1 -0
  127. package/dist/lib/collaboration-provider.d.ts +142 -0
  128. package/dist/lib/collaboration-provider.d.ts.map +1 -0
  129. package/dist/lib/collaboration-provider.js +168 -0
  130. package/dist/lib/collaboration-provider.js.map +1 -0
  131. package/dist/lib/comment-anchor.d.ts +86 -0
  132. package/dist/lib/comment-anchor.d.ts.map +1 -0
  133. package/dist/lib/comment-anchor.js +139 -0
  134. package/dist/lib/comment-anchor.js.map +1 -0
  135. package/dist/lib/comments-client.d.ts +106 -0
  136. package/dist/lib/comments-client.d.ts.map +1 -0
  137. package/dist/lib/comments-client.js +138 -0
  138. package/dist/lib/comments-client.js.map +1 -0
  139. package/dist/lib/notifications-client.d.ts +68 -0
  140. package/dist/lib/notifications-client.d.ts.map +1 -0
  141. package/dist/lib/notifications-client.js +85 -0
  142. package/dist/lib/notifications-client.js.map +1 -0
  143. package/dist/lib/slash-command.d.ts +39 -0
  144. package/dist/lib/slash-command.d.ts.map +1 -0
  145. package/dist/lib/slash-command.js +50 -0
  146. package/dist/lib/slash-command.js.map +1 -0
  147. package/package.json +20 -4
  148. package/src/__tests__/components/comment-mark.test.ts +99 -0
  149. package/src/__tests__/components/comment-side-panel.test.tsx +343 -0
  150. package/src/__tests__/components/notification-bell.test.tsx +213 -0
  151. package/src/__tests__/components/offline-status.test.tsx +66 -0
  152. package/src/__tests__/components/presence-chips-helpers.test.ts +44 -0
  153. package/src/__tests__/fields/component-block-helpers.test.ts +674 -0
  154. package/src/__tests__/lib/active-editor.test.ts +70 -0
  155. package/src/__tests__/lib/coauthor-client.test.ts +213 -0
  156. package/src/__tests__/lib/collaboration-provider.test.ts +425 -0
  157. package/src/__tests__/lib/comment-anchor.test.ts +188 -0
  158. package/src/__tests__/lib/comments-client.test.ts +239 -0
  159. package/src/__tests__/lib/notifications-client.test.ts +195 -0
  160. package/src/__tests__/lib/slash-command.test.ts +146 -0
  161. package/src/components/AICoauthorBubbleMenu.tsx +187 -0
  162. package/src/components/CoauthorResultPopover.tsx +193 -0
  163. package/src/components/CommandPalette.tsx +397 -209
  164. package/src/components/CommentMark.ts +138 -0
  165. package/src/components/CommentSidePanel.tsx +521 -0
  166. package/src/components/LivePreview.tsx +117 -11
  167. package/src/components/NotificationBell.tsx +242 -0
  168. package/src/components/OfflineStatus.tsx +90 -0
  169. package/src/components/PresenceChips.tsx +150 -0
  170. package/src/components/TipTapEditor.tsx +310 -12
  171. package/src/fields/ComponentBlockField.tsx +179 -0
  172. package/src/fields/FieldRenderer.tsx +8 -0
  173. package/src/fields/PropInput.tsx +552 -0
  174. package/src/fields/component-block-helpers.ts +341 -0
  175. package/src/fields/index.ts +4 -0
  176. package/src/index.ts +27 -0
  177. package/src/lib/active-editor.ts +39 -0
  178. package/src/lib/coauthor-client.ts +160 -0
  179. package/src/lib/collaboration-provider.ts +306 -0
  180. package/src/lib/comment-anchor.ts +179 -0
  181. package/src/lib/comments-client.ts +208 -0
  182. package/src/lib/notifications-client.ts +146 -0
  183. package/src/lib/slash-command.ts +67 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACt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MAAM,gBAAgB,CAAA"}
@@ -13,4 +13,6 @@ export { PRESET_BLOCKS } from './block-types.js';
13
13
  export { GroupField } from './GroupField.js';
14
14
  export { NavBuilderField } from './NavBuilderField.js';
15
15
  export { NumberField } from './NumberField.js';
16
+ export { ComponentBlockField } from './ComponentBlockField.js';
17
+ export { PropInput, defaultForType } from './PropInput.js';
16
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/index.d.ts CHANGED
@@ -56,6 +56,14 @@ export type { MediaPickerModalProps } from './components/MediaPickerModal.js';
56
56
  export { ThemeProvider, useTheme } from './components/ThemeProvider.js';
57
57
  export { FocalPointPicker } from './components/FocalPointPicker.js';
58
58
  export { PresenceIndicator } from './components/PresenceIndicator.js';
59
+ export { NotificationBell } from './components/NotificationBell.js';
60
+ export type { NotificationBellProps, NotificationsApi } from './components/NotificationBell.js';
61
+ export { listNotifications, unreadCount as listNotificationsUnread, markNotificationRead, markAllNotificationsRead, notificationSummary, } from './lib/notifications-client.js';
62
+ export type { Notification, NotificationKind, NotificationPayload, NotificationOutcome, ListNotificationsOptions, } from './lib/notifications-client.js';
63
+ export { OfflineStatus, describeOfflineStatus } from './components/OfflineStatus.js';
64
+ export type { OfflineStatusProps } from './components/OfflineStatus.js';
65
+ export { CommentSidePanel } from './components/CommentSidePanel.js';
66
+ export type { CommentSidePanelProps } from './components/CommentSidePanel.js';
59
67
  export { LocaleProvider, useLocale } from './components/LocaleProvider.js';
60
68
  export type { LocaleProviderProps } from './components/LocaleProvider.js';
61
69
  export { LocaleSwitcher } from './components/LocaleSwitcher.js';
@@ -63,4 +71,6 @@ export { useKeyboardShortcuts } from './hooks/useKeyboardShortcuts.js';
63
71
  export { cmsApi, setApiBase, ensureCsrfToken } from './lib/api.js';
64
72
  export { useApiData } from './lib/useApiData.js';
65
73
  export type { UseApiDataResult } from './lib/useApiData.js';
74
+ export { ComponentBlockField, PropInput, defaultForType } from './fields/index.js';
75
+ export type { ComponentBlockFieldProps, ComponentBlockValue, PropInputProps, } from './fields/index.js';
66
76
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIrD,OAAO,EACL,UAAU,EACV,aAAa,EACb,KAAK,EACL,OAAO,EACP,IAAI,EACJ,KAAK,EACL,GAAG,EACH,MAAM,GACP,MAAM,8BA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AAEtE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClF,YAAY,EACV,wBAAwB,EACxB,mBAAmB,EACnB,cAAc,GACf,MAAM,mBAAmB,CAAA"}
package/dist/index.js CHANGED
@@ -41,9 +41,14 @@ export { MediaPickerModal } from './components/MediaPickerModal.js';
41
41
  export { ThemeProvider, useTheme } from './components/ThemeProvider.js';
42
42
  export { FocalPointPicker } from './components/FocalPointPicker.js';
43
43
  export { PresenceIndicator } from './components/PresenceIndicator.js';
44
+ export { NotificationBell } from './components/NotificationBell.js';
45
+ export { listNotifications, unreadCount as listNotificationsUnread, markNotificationRead, markAllNotificationsRead, notificationSummary, } from './lib/notifications-client.js';
46
+ export { OfflineStatus, describeOfflineStatus } from './components/OfflineStatus.js';
47
+ export { CommentSidePanel } from './components/CommentSidePanel.js';
44
48
  export { LocaleProvider, useLocale } from './components/LocaleProvider.js';
45
49
  export { LocaleSwitcher } from './components/LocaleSwitcher.js';
46
50
  export { useKeyboardShortcuts } from './hooks/useKeyboardShortcuts.js';
47
51
  export { cmsApi, setApiBase, ensureCsrfToken } from './lib/api.js';
48
52
  export { useApiData } from './lib/useApiData.js';
53
+ export { ComponentBlockField, PropInput, defaultForType } from './fields/index.js';
49
54
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG1C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM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F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAEnE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAEtE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGhD,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { Editor } from '@tiptap/react';
2
+ export declare function setActiveEditor(editor: Editor | null): void;
3
+ export declare function getActiveEditor(): Editor | null;
4
+ export declare function clearActiveEditorIf(editor: Editor): void;
5
+ export declare function subscribeActiveEditor(listener: () => void): () => void;
6
+ //# sourceMappingURL=active-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"active-editor.d.ts","sourceRoot":"","sources":["../../src/lib/active-editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAiB3C,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAI3D;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAIxD;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAKtE"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Singleton registry for the most-recently focused TipTap editor in the
3
+ * admin shell. Lets out-of-tree surfaces (Cmd+K palette, slash commands,
4
+ * future global shortcuts) target the editor a user was last working in
5
+ * without prop-drilling refs through the layout.
6
+ *
7
+ * The `TipTapEditor` component calls `setActiveEditor(editor)` from its
8
+ * `onFocus` callback and clears it on unmount. Subscribers receive a no-op
9
+ * payload — they should re-read via `getActiveEditor()` after the
10
+ * notification.
11
+ */
12
+ let activeEditor = null;
13
+ const listeners = new Set();
14
+ export function setActiveEditor(editor) {
15
+ if (activeEditor === editor)
16
+ return;
17
+ activeEditor = editor;
18
+ for (const listener of listeners)
19
+ listener();
20
+ }
21
+ export function getActiveEditor() {
22
+ return activeEditor;
23
+ }
24
+ export function clearActiveEditorIf(editor) {
25
+ if (activeEditor === editor) {
26
+ setActiveEditor(null);
27
+ }
28
+ }
29
+ export function subscribeActiveEditor(listener) {
30
+ listeners.add(listener);
31
+ return () => {
32
+ listeners.delete(listener);
33
+ };
34
+ }
35
+ //# sourceMappingURL=active-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"active-editor.js","sourceRoot":"","sources":["../../src/lib/active-editor.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,IAAI,YAAY,GAAkB,IAAI,CAAA;AACtC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAA;AAEvC,MAAM,UAAU,eAAe,CAAC,MAAqB;IACnD,IAAI,YAAY,KAAK,MAAM;QAAE,OAAM;IACnC,YAAY,GAAG,MAAM,CAAA;IACrB,KAAK,MAAM,QAAQ,IAAI,SAAS;QAAE,QAAQ,EAAE,CAAA;AAC9C,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,YAAY,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,IAAI,YAAY,KAAK,MAAM,EAAE,CAAC;QAC5B,eAAe,CAAC,IAAI,CAAC,CAAA;IACvB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAoB;IACxD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACvB,OAAO,GAAG,EAAE;QACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC5B,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Inline AI co-author client — thin, typed wrapper around the
3
+ * `POST /ai/coauthor` endpoint exposed by `cms-core`.
4
+ *
5
+ * The endpoint implements four text-transformation micro-actions backed by
6
+ * the configured AI provider. This client lives in `cms-admin` so the
7
+ * editor (bubble menu) and the command palette (slash commands) can share
8
+ * exactly one request path, error model, and option shape.
9
+ *
10
+ * Mirrors the request body documented in `packages/cms-core/src/api/handlers.ts`:
11
+ *
12
+ * POST /ai/coauthor
13
+ * { action, text, style?, tone?, instructions?, targetLength? }
14
+ */
15
+ export type CoauthorAction = 'rewrite' | 'expand' | 'compress' | 'proofread';
16
+ /**
17
+ * Frozen tuple of every action the server accepts. Used both as a type-safe
18
+ * iteration source (bubble menu pills, slash-command registration) and by
19
+ * the runtime `isCoauthorAction` guard so callers don't drift from the
20
+ * server's allowlist.
21
+ */
22
+ export declare const COAUTHOR_ACTIONS: readonly ["rewrite", "expand", "compress", "proofread"];
23
+ /**
24
+ * Hard client-side ceiling that matches `AI_CONTEXT_MAX_CHARS` in cms-core.
25
+ * Catching this here avoids a round-trip just to get a 400 back when a user
26
+ * pastes a giant block into the bubble menu.
27
+ */
28
+ export declare const COAUTHOR_TEXT_MAX_CHARS = 50000;
29
+ export type ProofreadChange = {
30
+ original: string;
31
+ corrected: string;
32
+ reason?: string;
33
+ };
34
+ export interface CoauthorOptions {
35
+ /** Free-form style cue, e.g. "more concise", "academic". Used by rewrite. */
36
+ style?: string;
37
+ /** Tone cue, e.g. "friendly", "professional". Used by rewrite. */
38
+ tone?: string;
39
+ /** Free-form instructions. Used by expand. */
40
+ instructions?: string;
41
+ /** Target length in words. Used by compress. */
42
+ targetLength?: number;
43
+ }
44
+ export interface CoauthorResult {
45
+ action: CoauthorAction;
46
+ text: string;
47
+ /** Populated only when `action === 'proofread'`. */
48
+ changes?: ProofreadChange[];
49
+ }
50
+ export type CoauthorOutcome = {
51
+ ok: true;
52
+ result: CoauthorResult;
53
+ } | {
54
+ ok: false;
55
+ error: string;
56
+ status: number;
57
+ };
58
+ export declare function coauthorActionLabel(action: CoauthorAction): string;
59
+ export declare function coauthorActionDescription(action: CoauthorAction): string;
60
+ export declare function isCoauthorAction(value: unknown): value is CoauthorAction;
61
+ /**
62
+ * Run a text-transformation micro-action against `/ai/coauthor`.
63
+ *
64
+ * Returns a discriminated outcome so callers can switch on `outcome.ok`
65
+ * without a try/catch — the underlying `cmsApi` already turns every
66
+ * non-2xx and every network failure into a structured error envelope.
67
+ *
68
+ * Pre-flight validation is intentionally cheap (whitespace + length) so the
69
+ * server stays the single source of truth for richer auth/rate-limit logic.
70
+ */
71
+ export declare function coauthorText(action: CoauthorAction, text: string, opts?: CoauthorOptions): Promise<CoauthorOutcome>;
72
+ //# sourceMappingURL=coauthor-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coauthor-client.d.ts","sourceRoot":"","sources":["../../src/lib/coauthor-client.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAA;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,yDAA0D,CAAA;AAgBvF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,QAAS,CAAA;AAE7C,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,cAAc,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;CAC5B;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GACpC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAElE;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAExE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,eAAe,CAAC,CAyD1B"}
@@ -0,0 +1,98 @@
1
+ import { cmsApi } from './api.js';
2
+ /**
3
+ * Frozen tuple of every action the server accepts. Used both as a type-safe
4
+ * iteration source (bubble menu pills, slash-command registration) and by
5
+ * the runtime `isCoauthorAction` guard so callers don't drift from the
6
+ * server's allowlist.
7
+ */
8
+ export const COAUTHOR_ACTIONS = ['rewrite', 'expand', 'compress', 'proofread'];
9
+ const ACTION_LABELS = {
10
+ rewrite: 'Rewrite',
11
+ expand: 'Expand',
12
+ compress: 'Compress',
13
+ proofread: 'Proofread',
14
+ };
15
+ const ACTION_DESCRIPTIONS = {
16
+ rewrite: 'Rewrite the selection in a new tone or style',
17
+ expand: 'Expand the selection with more detail',
18
+ compress: 'Shorten the selection while preserving meaning',
19
+ proofread: 'Correct grammar, spelling, and punctuation',
20
+ };
21
+ /**
22
+ * Hard client-side ceiling that matches `AI_CONTEXT_MAX_CHARS` in cms-core.
23
+ * Catching this here avoids a round-trip just to get a 400 back when a user
24
+ * pastes a giant block into the bubble menu.
25
+ */
26
+ export const COAUTHOR_TEXT_MAX_CHARS = 50_000;
27
+ export function coauthorActionLabel(action) {
28
+ return ACTION_LABELS[action];
29
+ }
30
+ export function coauthorActionDescription(action) {
31
+ return ACTION_DESCRIPTIONS[action];
32
+ }
33
+ export function isCoauthorAction(value) {
34
+ return typeof value === 'string' && COAUTHOR_ACTIONS.includes(value);
35
+ }
36
+ /**
37
+ * Run a text-transformation micro-action against `/ai/coauthor`.
38
+ *
39
+ * Returns a discriminated outcome so callers can switch on `outcome.ok`
40
+ * without a try/catch — the underlying `cmsApi` already turns every
41
+ * non-2xx and every network failure into a structured error envelope.
42
+ *
43
+ * Pre-flight validation is intentionally cheap (whitespace + length) so the
44
+ * server stays the single source of truth for richer auth/rate-limit logic.
45
+ */
46
+ export async function coauthorText(action, text, opts = {}) {
47
+ if (!isCoauthorAction(action)) {
48
+ return { ok: false, error: `Unknown action "${String(action)}"`, status: 0 };
49
+ }
50
+ if (typeof text !== 'string' || text.trim().length === 0) {
51
+ return { ok: false, error: 'No text provided', status: 0 };
52
+ }
53
+ if (text.length > COAUTHOR_TEXT_MAX_CHARS) {
54
+ return {
55
+ ok: false,
56
+ error: `Text exceeds ${COAUTHOR_TEXT_MAX_CHARS.toLocaleString()} character limit`,
57
+ status: 0,
58
+ };
59
+ }
60
+ const body = { action, text };
61
+ if (opts.style !== undefined)
62
+ body.style = opts.style;
63
+ if (opts.tone !== undefined)
64
+ body.tone = opts.tone;
65
+ if (opts.instructions !== undefined)
66
+ body.instructions = opts.instructions;
67
+ if (opts.targetLength !== undefined)
68
+ body.targetLength = opts.targetLength;
69
+ const res = await cmsApi('/ai/coauthor', {
70
+ method: 'POST',
71
+ body: JSON.stringify(body),
72
+ });
73
+ if (res.error || !res.data) {
74
+ return {
75
+ ok: false,
76
+ error: res.error ?? `Request failed (${res.status})`,
77
+ status: res.status,
78
+ };
79
+ }
80
+ if (typeof res.data.text !== 'string') {
81
+ return {
82
+ ok: false,
83
+ error: 'Malformed response from /ai/coauthor (missing text)',
84
+ status: res.status,
85
+ };
86
+ }
87
+ return {
88
+ ok: true,
89
+ result: {
90
+ action: res.data.action ?? action,
91
+ text: res.data.text,
92
+ changes: action === 'proofread' && Array.isArray(res.data.changes)
93
+ ? res.data.changes
94
+ : undefined,
95
+ },
96
+ };
97
+ }
98
+ //# sourceMappingURL=coauthor-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coauthor-client.js","sourceRoot":"","sources":["../../src/lib/coauthor-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAmBjC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,CAAU,CAAA;AAEvF,MAAM,aAAa,GAAmC;IACpD,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;CACvB,CAAA;AAED,MAAM,mBAAmB,GAAmC;IAC1D,OAAO,EAAE,8CAA8C;IACvD,MAAM,EAAE,uCAAuC;IAC/C,QAAQ,EAAE,gDAAgD;IAC1D,SAAS,EAAE,4CAA4C;CACxD,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAA;AA8B7C,MAAM,UAAU,mBAAmB,CAAC,MAAsB;IACxD,OAAO,aAAa,CAAC,MAAM,CAAC,CAAA;AAC9B,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,MAAsB;IAC9D,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAA;AACpC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,gBAAsC,CAAC,QAAQ,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CAIrB,cAAc,EAAE;QACjB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAA;IAEF,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAC3B,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,mBAAmB,GAAG,CAAC,MAAM,GAAG;YACpD,MAAM,EAAE,GAAG,CAAC,MAAM;SACnB,CAAA;IACH,CAAC;IAED,IAAI,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,qDAAqD;YAC5D,MAAM,EAAE,GAAG,CAAC,MAAM;SACnB,CAAA;IACH,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,MAAM,EAAE;YACN,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM;YACjC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI;YACnB,OAAO,EACL,MAAM,KAAK,WAAW,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;gBACvD,CAAC,CAAE,GAAG,CAAC,IAAI,CAAC,OAA6B;gBACzC,CAAC,CAAC,SAAS;SAChB;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Browser-side Yjs collaboration provider for the TipTap editor.
3
+ *
4
+ * Wraps `y-websocket`'s `WebsocketProvider` with sensible defaults and a
5
+ * narrow public API. The wire protocol is byte-compatible with the
6
+ * cms-core realtime gateway shipped in PR #106, so the standard
7
+ * `WebsocketProvider` connects without any custom client code.
8
+ *
9
+ * Auth flows through the browser's cookie jar — `cms-admin` already uses
10
+ * cookie-based sessions, and the WebSocket upgrade request carries those
11
+ * cookies automatically against same-origin gateways. For cross-origin
12
+ * deployments, attach a query-string token via the `params` option.
13
+ */
14
+ import { Awareness } from 'y-protocols/awareness';
15
+ import { WebsocketProvider } from 'y-websocket';
16
+ import { IndexeddbPersistence } from 'y-indexeddb';
17
+ import * as Y from 'yjs';
18
+ /** Connection status reported via `onStatus` and surfaced in the editor UI. */
19
+ export type CollaborationStatus = 'connecting' | 'connected' | 'disconnected';
20
+ /**
21
+ * Offline-draft persistence status. Slice 6 layers a local IndexedDB
22
+ * mirror on top of the y-websocket transport so edits made while
23
+ * disconnected aren't lost. The lifecycle is:
24
+ *
25
+ * - `unsupported` — `indexedDB` is unavailable (Safari private mode,
26
+ * SSR, jsdom-without-fake-indexeddb).
27
+ * - `pending` — provider is being constructed; no local state yet.
28
+ * - `loading` — IndexedDB is replaying the last saved snapshot into
29
+ * the Y.Doc.
30
+ * - `ready` — the local store is initialised and every change is
31
+ * persisted locally before the WebSocket pushes it upstream.
32
+ * - `error` — IndexedDB threw; the editor still works in-memory but
33
+ * refresh will lose pending edits.
34
+ */
35
+ export type OfflinePersistenceStatus = 'unsupported' | 'pending' | 'loading' | 'ready' | 'error';
36
+ /** Per-user presence info that becomes the local awareness state. */
37
+ export interface CollaborationUser {
38
+ /** Display name (used for cursor labels and the presence chip strip). */
39
+ name: string;
40
+ /** CSS color value for the user's cursor / chip background. */
41
+ color: string;
42
+ /** Optional avatar URL (32-square recommended). Rendered if present. */
43
+ avatarUrl?: string;
44
+ /** Stable user id from the cms-core session (used as a dedup key). */
45
+ userId?: string;
46
+ }
47
+ export interface CollaborationOptions {
48
+ /** Logical document id (becomes the y-websocket "room name"). */
49
+ documentId: string;
50
+ /**
51
+ * Base URL of the realtime gateway, e.g. `wss://your.app/api/cms/realtime/sync`.
52
+ * The provider appends `/${documentId}` automatically (y-websocket convention).
53
+ * Use `ws://` for local dev.
54
+ */
55
+ url: string;
56
+ /** Presence info for the local user. */
57
+ user: CollaborationUser;
58
+ /**
59
+ * Extra query-string parameters (e.g. an auth token for cross-origin
60
+ * deployments). Forwarded to `WebsocketProvider`'s `params` option.
61
+ */
62
+ params?: Record<string, string>;
63
+ /** Called on every connection-state transition. */
64
+ onStatus?: (status: CollaborationStatus) => void;
65
+ /** Called on connection-level errors (e.g. 4401 auth rejection). */
66
+ onError?: (err: Error) => void;
67
+ /**
68
+ * If `false`, the helper does not connect on construction. Useful for
69
+ * tests and for editors that want a `Y.Doc` without network traffic.
70
+ * Defaults to `true`.
71
+ */
72
+ connect?: boolean;
73
+ /**
74
+ * Offline-draft persistence. When `true` (default), the provider
75
+ * mounts a `y-indexeddb` mirror so edits made while the WebSocket is
76
+ * disconnected survive a refresh. Pass `false` to skip the mirror
77
+ * (e.g. on shared kiosk machines where you don't want drafts in
78
+ * IndexedDB).
79
+ */
80
+ offline?: boolean;
81
+ /** Called on every offline-persistence status transition. */
82
+ onOfflineStatus?: (status: OfflinePersistenceStatus) => void;
83
+ }
84
+ export interface CollaborationContext {
85
+ /** Shared Y.Doc — bind this to the TipTap `Collaboration` extension. */
86
+ ydoc: Y.Doc;
87
+ /** The underlying y-websocket provider. */
88
+ provider: WebsocketProvider;
89
+ /** Awareness instance — bind to `CollaborationCursor` and the presence strip. */
90
+ awareness: Awareness;
91
+ /**
92
+ * Local IndexedDB mirror, when `offline` is enabled and the runtime
93
+ * supports it. `null` when persistence is disabled or unsupported
94
+ * (e.g. SSR / Safari private browsing).
95
+ */
96
+ offlinePersistence: IndexeddbPersistence | null;
97
+ /** Latest offline-persistence status. Mirrors `onOfflineStatus`. */
98
+ offlineStatus: OfflinePersistenceStatus;
99
+ /** Stop the provider, evict awareness, and destroy the Y.Doc. */
100
+ destroy: () => void;
101
+ }
102
+ /** Optional dependency-injection seam used by tests to avoid real WebSockets. */
103
+ export interface CollaborationDeps {
104
+ WebsocketProviderCtor?: typeof WebsocketProvider;
105
+ /**
106
+ * Override the IndexedDB persistence constructor (test seam). The
107
+ * default uses `y-indexeddb` which requires a browser-like
108
+ * `indexedDB` global; tests inject a no-op stub.
109
+ */
110
+ IndexeddbPersistenceCtor?: typeof IndexeddbPersistence;
111
+ /**
112
+ * Override the IndexedDB feature check. Defaults to inspecting
113
+ * `globalThis.indexedDB`. Tests inject `() => true` to exercise the
114
+ * persistence path under happy-dom.
115
+ */
116
+ isIndexedDbSupported?: () => boolean;
117
+ }
118
+ /**
119
+ * Open a collaboration session for `documentId`. Must be called in a browser
120
+ * context (jsdom is fine for tests when a fake provider is injected).
121
+ *
122
+ * The returned `ydoc` is the document the editor binds to via TipTap's
123
+ * `Collaboration` extension; `awareness` carries cursor + presence state.
124
+ * Always call `destroy()` on unmount to evict the local awareness state and
125
+ * close the socket.
126
+ */
127
+ export declare function createCollaborationProvider(opts: CollaborationOptions, deps?: CollaborationDeps): CollaborationContext;
128
+ /**
129
+ * Reduce an Awareness map into a deduplicated array of `CollaborationUser`s.
130
+ * Used by `PresenceChips` and any other UI that visualises co-editors.
131
+ */
132
+ export interface PresenceSnapshot {
133
+ /** Local user's client id (so UIs can omit themselves from the strip). */
134
+ selfClientId: number;
135
+ /** Connected users, deduplicated by `userId` when present, otherwise by clientId. */
136
+ users: Array<{
137
+ clientId: number;
138
+ user: CollaborationUser;
139
+ }>;
140
+ }
141
+ export declare function summarisePresence(awareness: Awareness): PresenceSnapshot;
142
+ //# sourceMappingURL=collaboration-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collaboration-provider.d.ts","sourceRoot":"","sources":["../../src/lib/collaboration-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,+EAA+E;AAC/E,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAA;AAE7E;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CAAA;IACvC,iEAAiE;IACjE,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED,iFAAiF;AACjF,MAAM,WAAW,iBAAiB;IAChC,qBAAqB,CAAC,EAAE,OAAO,iBAAiB,CAAA;IAChD;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,OAAO,oBAAoB,CAAA;IACtD;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,OAAO,CAAA;CACrC;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,oBAAoB,EAC1B,IAAI,GAAE,iBAAsB,GAC3B,oBAAoB,CAiItB;AAgBD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAA;IACpB,qFAAqF;IACrF,KAAK,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,iBAAiB,CAAA;KAAE,CAAC,CAAA;CAC5D;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAaxE"}
@@ -0,0 +1,168 @@
1
+ import { WebsocketProvider } from 'y-websocket';
2
+ import { IndexeddbPersistence } from 'y-indexeddb';
3
+ import * as Y from 'yjs';
4
+ /**
5
+ * Open a collaboration session for `documentId`. Must be called in a browser
6
+ * context (jsdom is fine for tests when a fake provider is injected).
7
+ *
8
+ * The returned `ydoc` is the document the editor binds to via TipTap's
9
+ * `Collaboration` extension; `awareness` carries cursor + presence state.
10
+ * Always call `destroy()` on unmount to evict the local awareness state and
11
+ * close the socket.
12
+ */
13
+ export function createCollaborationProvider(opts, deps = {}) {
14
+ if (typeof globalThis === 'undefined' ||
15
+ typeof globalThis.window === 'undefined') {
16
+ // Note: jsdom defines `window`, so this only trips on bare-Node SSR.
17
+ throw new Error('createCollaborationProvider can only be called in a browser context (window is undefined)');
18
+ }
19
+ if (!opts.documentId || !opts.url) {
20
+ throw new Error('createCollaborationProvider requires both documentId and url');
21
+ }
22
+ const Ctor = deps.WebsocketProviderCtor ?? WebsocketProvider;
23
+ const ydoc = new Y.Doc();
24
+ const provider = new Ctor(opts.url, opts.documentId, ydoc, {
25
+ connect: opts.connect ?? true,
26
+ params: opts.params,
27
+ });
28
+ // Layer y-indexeddb on top of the y-websocket transport for offline
29
+ // drafts. Both providers share the same Y.Doc, so they automatically
30
+ // converge: IndexedDB hydrates the doc on load, the websocket pushes
31
+ // pending updates to the gateway on reconnect.
32
+ const offlineEnabled = opts.offline !== false;
33
+ const offlineCheck = deps.isIndexedDbSupported ?? defaultIndexedDbSupportCheck;
34
+ let offlineStatus = 'pending';
35
+ const setOfflineStatus = (next) => {
36
+ offlineStatus = next;
37
+ opts.onOfflineStatus?.(next);
38
+ };
39
+ let offlinePersistence = null;
40
+ if (!offlineEnabled) {
41
+ setOfflineStatus('unsupported');
42
+ }
43
+ else if (!offlineCheck()) {
44
+ setOfflineStatus('unsupported');
45
+ }
46
+ else {
47
+ setOfflineStatus('loading');
48
+ const PersistenceCtor = deps.IndexeddbPersistenceCtor ?? IndexeddbPersistence;
49
+ try {
50
+ offlinePersistence = new PersistenceCtor(
51
+ // Namespace the IndexedDB key by documentId so multiple docs in
52
+ // the same admin session don't collide.
53
+ `actuate-cms:${opts.documentId}`, ydoc);
54
+ // `whenSynced` is the canonical "snapshot replay finished" hook
55
+ // from y-indexeddb (https://github.com/yjs/y-indexeddb).
56
+ offlinePersistence.whenSynced
57
+ .then(() => setOfflineStatus('ready'))
58
+ .catch((err) => {
59
+ opts.onError?.(err instanceof Error ? err : new Error('Offline persistence failed'));
60
+ setOfflineStatus('error');
61
+ });
62
+ }
63
+ catch (err) {
64
+ opts.onError?.(err instanceof Error ? err : new Error('Offline persistence failed'));
65
+ setOfflineStatus('error');
66
+ offlinePersistence = null;
67
+ }
68
+ }
69
+ // Seed local awareness with the user's presence info. The
70
+ // `CollaborationCursor` TipTap extension reads `user.name` + `user.color`
71
+ // out of awareness state and renders cursors accordingly.
72
+ provider.awareness.setLocalState({
73
+ user: {
74
+ name: opts.user.name,
75
+ color: opts.user.color,
76
+ avatarUrl: opts.user.avatarUrl,
77
+ userId: opts.user.userId,
78
+ },
79
+ });
80
+ if (opts.onStatus) {
81
+ const handler = (event) => {
82
+ const status = normaliseStatus(event.status);
83
+ if (status)
84
+ opts.onStatus(status);
85
+ };
86
+ provider.on('status', handler);
87
+ }
88
+ if (opts.onError) {
89
+ const handler = () => {
90
+ // y-websocket emits this on socket close + on protocol errors. We
91
+ // surface a generic Error so callers can render a toast without
92
+ // sniffing y-websocket internals.
93
+ opts.onError(new Error('Realtime connection error'));
94
+ };
95
+ provider.on('connection-error', handler);
96
+ }
97
+ const destroy = () => {
98
+ try {
99
+ provider.awareness.setLocalState(null);
100
+ }
101
+ catch {
102
+ /* awareness may already be torn down */
103
+ }
104
+ try {
105
+ provider.destroy();
106
+ }
107
+ catch {
108
+ /* idempotent */
109
+ }
110
+ if (offlinePersistence) {
111
+ try {
112
+ // y-indexeddb keeps the IDB connection open until `destroy()`;
113
+ // we don't drop the stored data (that's the point of offline
114
+ // drafts), but we close the handle so the runtime can GC.
115
+ offlinePersistence.destroy();
116
+ }
117
+ catch {
118
+ /* idempotent */
119
+ }
120
+ }
121
+ try {
122
+ ydoc.destroy();
123
+ }
124
+ catch {
125
+ /* idempotent */
126
+ }
127
+ };
128
+ return {
129
+ ydoc,
130
+ provider,
131
+ awareness: provider.awareness,
132
+ offlinePersistence,
133
+ get offlineStatus() {
134
+ return offlineStatus;
135
+ },
136
+ destroy,
137
+ };
138
+ }
139
+ function defaultIndexedDbSupportCheck() {
140
+ return (typeof globalThis !== 'undefined' &&
141
+ typeof globalThis.indexedDB !== 'undefined');
142
+ }
143
+ function normaliseStatus(value) {
144
+ if (value === 'connected')
145
+ return 'connected';
146
+ if (value === 'connecting')
147
+ return 'connecting';
148
+ if (value === 'disconnected')
149
+ return 'disconnected';
150
+ return null;
151
+ }
152
+ export function summarisePresence(awareness) {
153
+ const seenUserIds = new Set();
154
+ const users = [];
155
+ for (const [clientId, state] of awareness.getStates()) {
156
+ const user = state?.user;
157
+ if (!user || typeof user.name !== 'string')
158
+ continue;
159
+ if (user.userId) {
160
+ if (seenUserIds.has(user.userId))
161
+ continue;
162
+ seenUserIds.add(user.userId);
163
+ }
164
+ users.push({ clientId, user });
165
+ }
166
+ return { selfClientId: awareness.clientID, users };
167
+ }
168
+ //# sourceMappingURL=collaboration-provider.js.map