@streamplace/components 0.9.0 → 0.9.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 (138) hide show
  1. package/dist/components/chat/chat-box.d.ts.map +1 -1
  2. package/dist/components/chat/chat-box.js +90 -34
  3. package/dist/components/chat/chat-box.js.map +1 -1
  4. package/dist/components/chat/chat-message.d.ts +4 -0
  5. package/dist/components/chat/chat-message.d.ts.map +1 -1
  6. package/dist/components/chat/chat-message.js +3 -2
  7. package/dist/components/chat/chat-message.js.map +1 -1
  8. package/dist/components/chat/chat.d.ts.map +1 -1
  9. package/dist/components/chat/chat.js +56 -3
  10. package/dist/components/chat/chat.js.map +1 -1
  11. package/dist/components/chat/emoji-suggestions.d.ts.map +1 -1
  12. package/dist/components/chat/emoji-suggestions.js +11 -11
  13. package/dist/components/chat/emoji-suggestions.js.map +1 -1
  14. package/dist/components/chat/mention-suggestions.d.ts.map +1 -1
  15. package/dist/components/chat/mention-suggestions.js +20 -19
  16. package/dist/components/chat/mention-suggestions.js.map +1 -1
  17. package/dist/components/chat/system-message.d.ts +5 -1
  18. package/dist/components/chat/system-message.d.ts.map +1 -1
  19. package/dist/components/chat/system-message.js +4 -4
  20. package/dist/components/chat/system-message.js.map +1 -1
  21. package/dist/components/mobile-player/shared.d.ts +1 -1
  22. package/dist/components/mobile-player/shared.d.ts.map +1 -1
  23. package/dist/components/mobile-player/shared.js +11 -10
  24. package/dist/components/mobile-player/shared.js.map +1 -1
  25. package/dist/components/mobile-player/ui/viewer-context-menu.d.ts +1 -1
  26. package/dist/components/mobile-player/ui/viewer-context-menu.d.ts.map +1 -1
  27. package/dist/components/mobile-player/ui/viewer-context-menu.js +60 -43
  28. package/dist/components/mobile-player/ui/viewer-context-menu.js.map +1 -1
  29. package/dist/components/stream-notification/index.d.ts +3 -0
  30. package/dist/components/stream-notification/index.d.ts.map +1 -0
  31. package/dist/components/stream-notification/index.js +9 -0
  32. package/dist/components/stream-notification/index.js.map +1 -0
  33. package/dist/components/stream-notification/stream-notification-manager.d.ts +36 -0
  34. package/dist/components/stream-notification/stream-notification-manager.d.ts.map +1 -0
  35. package/dist/components/stream-notification/stream-notification-manager.js +96 -0
  36. package/dist/components/stream-notification/stream-notification-manager.js.map +1 -0
  37. package/dist/components/stream-notification/stream-notification.d.ts +5 -0
  38. package/dist/components/stream-notification/stream-notification.d.ts.map +1 -0
  39. package/dist/components/stream-notification/stream-notification.js +146 -0
  40. package/dist/components/stream-notification/stream-notification.js.map +1 -0
  41. package/dist/components/stream-notification/teleport-notification.d.ts +8 -0
  42. package/dist/components/stream-notification/teleport-notification.d.ts.map +1 -0
  43. package/dist/components/stream-notification/teleport-notification.js +116 -0
  44. package/dist/components/stream-notification/teleport-notification.js.map +1 -0
  45. package/dist/components/ui/button.d.ts +1 -1
  46. package/dist/components/ui/button.d.ts.map +1 -1
  47. package/dist/components/ui/button.js +7 -0
  48. package/dist/components/ui/button.js.map +1 -1
  49. package/dist/components/ui/dialog.d.ts +2 -2
  50. package/dist/components/ui/dropdown.d.ts +4 -0
  51. package/dist/components/ui/dropdown.d.ts.map +1 -1
  52. package/dist/components/ui/dropdown.js +41 -15
  53. package/dist/components/ui/dropdown.js.map +1 -1
  54. package/dist/components/ui/index.d.ts +1 -0
  55. package/dist/components/ui/index.d.ts.map +1 -1
  56. package/dist/components/ui/index.js +1 -0
  57. package/dist/components/ui/index.js.map +1 -1
  58. package/dist/components/ui/portal.d.ts +2 -0
  59. package/dist/components/ui/portal.d.ts.map +1 -0
  60. package/dist/components/ui/portal.js +5 -0
  61. package/dist/components/ui/portal.js.map +1 -0
  62. package/dist/components/ui/portal.web.d.ts +11 -0
  63. package/dist/components/ui/portal.web.d.ts.map +1 -0
  64. package/dist/components/ui/portal.web.js +22 -0
  65. package/dist/components/ui/portal.web.js.map +1 -0
  66. package/dist/components/ui/resizeable.d.ts +2 -1
  67. package/dist/components/ui/resizeable.d.ts.map +1 -1
  68. package/dist/components/ui/resizeable.js +68 -26
  69. package/dist/components/ui/resizeable.js.map +1 -1
  70. package/dist/components/ui/text.d.ts +1 -1
  71. package/dist/components/ui/view.d.ts +3 -3
  72. package/dist/index.d.ts +2 -0
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.js +2 -0
  75. package/dist/index.js.map +1 -1
  76. package/dist/lib/slash-commands/teleport.d.ts +4 -0
  77. package/dist/lib/slash-commands/teleport.d.ts.map +1 -0
  78. package/dist/lib/slash-commands/teleport.js +110 -0
  79. package/dist/lib/slash-commands/teleport.js.map +1 -0
  80. package/dist/lib/slash-commands.d.ts +16 -0
  81. package/dist/lib/slash-commands.d.ts.map +1 -0
  82. package/dist/lib/slash-commands.js +46 -0
  83. package/dist/lib/slash-commands.js.map +1 -0
  84. package/dist/lib/stream-notifications.d.ts +13 -0
  85. package/dist/lib/stream-notifications.d.ts.map +1 -0
  86. package/dist/lib/stream-notifications.js +46 -0
  87. package/dist/lib/stream-notifications.js.map +1 -0
  88. package/dist/lib/system-messages.d.ts +4 -8
  89. package/dist/lib/system-messages.d.ts.map +1 -1
  90. package/dist/lib/system-messages.js +38 -2
  91. package/dist/lib/system-messages.js.map +1 -1
  92. package/dist/lib/theme/atoms.d.ts +193 -193
  93. package/dist/livestream-provider/index.d.ts +7 -2
  94. package/dist/livestream-provider/index.d.ts.map +1 -1
  95. package/dist/livestream-provider/index.js +72 -4
  96. package/dist/livestream-provider/index.js.map +1 -1
  97. package/dist/livestream-store/livestream-state.d.ts +4 -1
  98. package/dist/livestream-store/livestream-state.d.ts.map +1 -1
  99. package/dist/livestream-store/livestream-store.d.ts.map +1 -1
  100. package/dist/livestream-store/livestream-store.js +3 -0
  101. package/dist/livestream-store/livestream-store.js.map +1 -1
  102. package/dist/livestream-store/websocket-consumer.d.ts.map +1 -1
  103. package/dist/livestream-store/websocket-consumer.js +30 -43
  104. package/dist/livestream-store/websocket-consumer.js.map +1 -1
  105. package/dist/streamplace-store/index.d.ts +1 -0
  106. package/dist/streamplace-store/index.d.ts.map +1 -1
  107. package/dist/streamplace-store/index.js +1 -0
  108. package/dist/streamplace-store/index.js.map +1 -1
  109. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
  110. package/package.json +4 -2
  111. package/src/components/chat/chat-box.tsx +126 -53
  112. package/src/components/chat/chat-message.tsx +1 -1
  113. package/src/components/chat/chat.tsx +79 -5
  114. package/src/components/chat/emoji-suggestions.tsx +27 -25
  115. package/src/components/chat/mention-suggestions.tsx +36 -33
  116. package/src/components/chat/system-message.tsx +14 -5
  117. package/src/components/mobile-player/shared.tsx +2 -1
  118. package/src/components/mobile-player/ui/viewer-context-menu.tsx +192 -166
  119. package/src/components/stream-notification/index.ts +5 -0
  120. package/src/components/stream-notification/stream-notification-manager.ts +140 -0
  121. package/src/components/stream-notification/stream-notification.tsx +227 -0
  122. package/src/components/stream-notification/teleport-notification.tsx +187 -0
  123. package/src/components/ui/button.tsx +7 -0
  124. package/src/components/ui/dropdown.tsx +96 -26
  125. package/src/components/ui/index.ts +1 -0
  126. package/src/components/ui/portal.tsx +1 -0
  127. package/src/components/ui/portal.web.tsx +37 -0
  128. package/src/components/ui/resizeable.tsx +89 -35
  129. package/src/index.tsx +3 -0
  130. package/src/lib/slash-commands/teleport.ts +136 -0
  131. package/src/lib/slash-commands.ts +65 -0
  132. package/src/lib/stream-notifications.ts +51 -0
  133. package/src/lib/system-messages.ts +52 -2
  134. package/src/livestream-provider/index.tsx +106 -3
  135. package/src/livestream-store/livestream-state.tsx +4 -0
  136. package/src/livestream-store/livestream-store.tsx +3 -0
  137. package/src/livestream-store/websocket-consumer.tsx +35 -54
  138. package/src/streamplace-store/index.tsx +1 -0
@@ -22,6 +22,9 @@ export const makeLivestreamStore = (): StoreApi<LivestreamState> => {
22
22
  authors: {},
23
23
  recentSegments: [],
24
24
  problems: [],
25
+ activeTeleport: null,
26
+ activeTeleportUri: null,
27
+ setActiveTeleportUri: (uri) => set({ activeTeleportUri: uri }),
25
28
  websocketConnected: false,
26
29
  hasReceivedSegment: false,
27
30
  moderationPermissions: [],
@@ -7,10 +7,11 @@ import {
7
7
  PlaceStreamChatMessage,
8
8
  PlaceStreamDefs,
9
9
  PlaceStreamLivestream,
10
- PlaceStreamModerationPermission,
10
+ PlaceStreamLiveTeleport,
11
11
  PlaceStreamSegment,
12
12
  } from "streamplace";
13
13
  import { SystemMessages } from "../lib/system-messages";
14
+ import { formatHandleWithAt } from "../utils/format-handle";
14
15
  import { reduceChat } from "./chat";
15
16
  import { LivestreamState } from "./livestream-state";
16
17
  import { findProblems } from "./problems";
@@ -121,65 +122,45 @@ export const handleWebSocketMessages = (
121
122
  pendingHides: newPendingHides,
122
123
  };
123
124
  state = reduceChat(state, [], [], [hiddenMessageUri]);
124
- } else if (
125
- PlaceStreamModerationPermission.isRecord(message) ||
126
- (message &&
127
- typeof message === "object" &&
128
- "$type" in message &&
129
- (message as { $type?: string }).$type ===
130
- "place.stream.moderation.permission")
131
- ) {
132
- // Handle moderation permission record updates
133
- // This can be a new permission or a deletion marker
134
- const permRecord = message as
135
- | PlaceStreamModerationPermission.Record
136
- | { deleted?: boolean; rkey?: string; streamer?: string };
125
+ } else if (PlaceStreamLiveTeleport.isRecord(message)) {
126
+ const teleportRecord = message as PlaceStreamLiveTeleport.Record;
127
+ state = {
128
+ ...state,
129
+ activeTeleport: teleportRecord,
130
+ };
131
+ } else if (PlaceStreamLivestream.isTeleportArrival(message)) {
132
+ // teleport has succeeded, we are now at the target stream
133
+ const arrival = message as PlaceStreamLivestream.TeleportArrival;
137
134
 
138
- if ((permRecord as any).deleted) {
139
- // Handle deletion: clear permissions to trigger refetch
140
- // The useCanModerate hook will refetch and repopulate
135
+ // add the teleporter's chat profile to the authors cache FIRST so mention rendering works
136
+ if (arrival.chatProfile && arrival.source.did) {
141
137
  state = {
142
138
  ...state,
143
- moderationPermissions: [],
139
+ authors: {
140
+ ...state.authors,
141
+ [arrival.source.did]: arrival.chatProfile,
142
+ },
144
143
  };
145
- } else {
146
- // Handle new/updated permission: add or update in the list
147
- // Use createdAt as a unique identifier since multiple records can exist for the same moderator
148
- // (e.g., one record with "ban" permission, another with "hide" permission)
149
- // Note: rkey would be ideal but isn't always present in the WebSocket message
150
- const newPerm =
151
- permRecord as PlaceStreamModerationPermission.Record & {
152
- rkey?: string;
153
- };
154
- const existingIndex = state.moderationPermissions.findIndex((p) => {
155
- const pWithRkey = p as PlaceStreamModerationPermission.Record & {
156
- rkey?: string;
157
- };
158
- // Prefer matching by rkey if available, fall back to createdAt
159
- if (newPerm.rkey && pWithRkey.rkey) {
160
- return pWithRkey.rkey === newPerm.rkey;
161
- }
162
- return (
163
- p.moderator === newPerm.moderator &&
164
- p.createdAt === newPerm.createdAt
165
- );
166
- });
144
+ }
167
145
 
168
- let newPermissions: PlaceStreamModerationPermission.Record[];
169
- if (existingIndex >= 0) {
170
- // Update existing record with same moderator AND createdAt
171
- newPermissions = [...state.moderationPermissions];
172
- newPermissions[existingIndex] = newPerm;
173
- } else {
174
- // Add new record (could be a new record for an existing moderator with different permissions)
175
- newPermissions = [...state.moderationPermissions, newPerm];
176
- }
146
+ const systemMessage = SystemMessages.teleportArrival(
147
+ formatHandleWithAt(arrival.source),
148
+ arrival.source.did,
149
+ arrival.viewerCount,
150
+ arrival.chatProfile,
151
+ );
152
+ // set proper times
153
+ systemMessage.indexedAt = arrival.startsAt;
154
+ systemMessage.record.createdAt = arrival.startsAt;
177
155
 
178
- state = {
179
- ...state,
180
- moderationPermissions: newPermissions,
181
- };
182
- }
156
+ state = reduceChat(state, [systemMessage], []);
157
+ } else if (PlaceStreamLivestream.isTeleportCanceled(message)) {
158
+ // teleport was canceled (deleted or denied)
159
+ state = {
160
+ ...state,
161
+ activeTeleport: null,
162
+ activeTeleportUri: null,
163
+ };
183
164
  }
184
165
  }
185
166
  }
@@ -5,3 +5,4 @@ export * from "./moderator-management";
5
5
  export * from "./stream";
6
6
  export * from "./streamplace-store";
7
7
  export * from "./user";
8
+ export * from "./xrpc";