@streamplace/components 0.7.18 → 0.7.21
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/assets/emoji-data.json +19371 -0
- package/dist/components/chat/chat-box.js +319 -0
- package/dist/components/chat/chat-message.js +87 -0
- package/dist/components/chat/chat.js +150 -0
- package/dist/components/chat/emoji-suggestions.js +35 -0
- package/dist/components/chat/mention-suggestions.js +42 -0
- package/dist/components/chat/mod-view.js +112 -0
- package/dist/components/chat/system-message.js +19 -0
- package/dist/components/dashboard/chat-panel.js +38 -0
- package/dist/components/dashboard/header.js +80 -0
- package/dist/components/dashboard/index.js +14 -0
- package/dist/components/dashboard/information-widget.js +234 -0
- package/dist/components/dashboard/mod-actions.js +71 -0
- package/dist/components/dashboard/problems.js +74 -0
- package/dist/components/icons/bluesky-icon.js +9 -0
- package/dist/components/keep-awake.js +7 -0
- package/dist/components/keep-awake.native.js +16 -0
- package/dist/components/mobile-player/fullscreen.js +76 -0
- package/dist/components/mobile-player/fullscreen.native.js +141 -0
- package/dist/components/mobile-player/player.js +94 -0
- package/dist/components/mobile-player/props.js +2 -0
- package/dist/components/mobile-player/shared.js +54 -0
- package/dist/components/mobile-player/ui/autoplay-button.js +68 -0
- package/dist/components/mobile-player/ui/countdown.js +83 -0
- package/dist/components/mobile-player/ui/index.js +12 -0
- package/dist/components/mobile-player/ui/input.js +42 -0
- package/dist/components/mobile-player/ui/metrics.js +44 -0
- package/dist/components/mobile-player/ui/report-modal.js +90 -0
- package/dist/components/mobile-player/ui/streamer-context-menu.js +7 -0
- package/dist/components/mobile-player/ui/streamer-loading-overlay.js +104 -0
- package/dist/components/mobile-player/ui/viewer-context-menu.js +51 -0
- package/dist/components/mobile-player/ui/viewer-loading-overlay.js +49 -0
- package/dist/components/mobile-player/ui/viewers.js +23 -0
- package/dist/components/mobile-player/use-webrtc.js +243 -0
- package/dist/components/mobile-player/video-async.native.js +276 -0
- package/dist/components/mobile-player/video-retry.js +29 -0
- package/dist/components/mobile-player/video.js +475 -0
- package/dist/components/mobile-player/video.native.js +56 -0
- package/dist/components/mobile-player/webrtc-diagnostics.js +110 -0
- package/dist/components/mobile-player/webrtc-primitives.js +27 -0
- package/dist/components/mobile-player/webrtc-primitives.native.js +8 -0
- package/dist/components/share/sharesheet.js +91 -0
- package/dist/components/ui/button.js +223 -0
- package/dist/components/ui/dialog.js +206 -0
- package/dist/components/ui/dropdown.js +172 -0
- package/dist/components/ui/icons.js +25 -0
- package/dist/components/ui/index.js +34 -0
- package/dist/components/ui/info-box.js +31 -0
- package/dist/components/ui/info-row.js +23 -0
- package/dist/components/ui/input.js +205 -0
- package/dist/components/ui/loader.js +10 -0
- package/dist/components/ui/primitives/button.js +125 -0
- package/dist/components/ui/primitives/input.js +206 -0
- package/dist/components/ui/primitives/modal.js +206 -0
- package/dist/components/ui/primitives/text.js +292 -0
- package/dist/components/ui/resizeable.js +121 -0
- package/dist/components/ui/slider.js +5 -0
- package/dist/components/ui/text.js +177 -0
- package/dist/components/ui/textarea.js +19 -0
- package/dist/components/ui/toast.js +175 -0
- package/dist/components/ui/view.js +252 -0
- package/dist/hooks/index.js +14 -0
- package/dist/hooks/useAvatars.js +35 -0
- package/dist/hooks/useCameraToggle.js +12 -0
- package/dist/hooks/useKeyboard.js +36 -0
- package/dist/hooks/useKeyboardSlide.js +14 -0
- package/dist/hooks/useLivestreamInfo.js +69 -0
- package/dist/hooks/useOuterAndInnerDimensions.js +30 -0
- package/dist/hooks/usePlayerDimensions.js +22 -0
- package/dist/hooks/usePointerDevice.js +71 -0
- package/dist/hooks/useSegmentDimensions.js +17 -0
- package/dist/hooks/useSegmentTiming.js +65 -0
- package/dist/index.js +34 -0
- package/dist/lib/browser.js +35 -0
- package/dist/lib/facet.js +92 -0
- package/dist/lib/system-messages.js +101 -0
- package/dist/lib/theme/atoms.js +646 -0
- package/dist/lib/theme/atoms.types.js +6 -0
- package/dist/lib/theme/index.js +35 -0
- package/dist/lib/theme/theme.js +256 -0
- package/dist/lib/theme/tokens.js +659 -0
- package/dist/lib/utils.js +105 -0
- package/dist/livestream-provider/index.js +30 -0
- package/dist/livestream-provider/websocket.js +45 -0
- package/dist/livestream-store/chat.js +308 -0
- package/dist/livestream-store/context.js +5 -0
- package/dist/livestream-store/index.js +7 -0
- package/dist/livestream-store/livestream-state.js +2 -0
- package/dist/livestream-store/livestream-store.js +58 -0
- package/dist/livestream-store/problems.js +76 -0
- package/dist/livestream-store/stream-key.js +88 -0
- package/dist/livestream-store/websocket-consumer.js +94 -0
- package/dist/player-store/context.js +5 -0
- package/dist/player-store/index.js +9 -0
- package/dist/player-store/player-provider.js +58 -0
- package/dist/player-store/player-state.js +25 -0
- package/dist/player-store/player-store.js +201 -0
- package/dist/player-store/single-player-provider.js +121 -0
- package/dist/streamplace-provider/context.js +5 -0
- package/dist/streamplace-provider/index.js +20 -0
- package/dist/streamplace-provider/poller.js +49 -0
- package/dist/streamplace-provider/xrpc.js +0 -0
- package/dist/streamplace-store/block.js +65 -0
- package/dist/streamplace-store/index.js +6 -0
- package/dist/streamplace-store/stream.js +247 -0
- package/dist/streamplace-store/streamplace-store.js +47 -0
- package/dist/streamplace-store/user.js +52 -0
- package/dist/streamplace-store/xrpc.js +15 -0
- package/dist/ui/index.js +79 -0
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
- package/package.json +5 -4
- package/src/components/chat/chat-box.tsx +3 -0
- package/src/components/chat/mod-view.tsx +39 -5
- package/src/components/mobile-player/fullscreen.tsx +2 -0
- package/src/components/mobile-player/ui/autoplay-button.tsx +86 -0
- package/src/components/mobile-player/ui/index.ts +1 -0
- package/src/components/mobile-player/video.tsx +11 -1
- package/src/livestream-store/chat.tsx +22 -0
- package/src/player-store/player-provider.tsx +2 -1
- package/src/player-store/player-state.tsx +6 -0
- package/src/player-store/player-store.tsx +4 -0
- package/tsconfig.tsbuildinfo +1 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Dashboard = exports.VideoRetry = exports.zero = exports.ui = exports.PlayerUI = exports.Player = exports.usePlayerContext = exports.withPlayerProvider = exports.PlayerProvider = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// barrel file :)
|
|
6
|
+
tslib_1.__exportStar(require("./livestream-provider"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./livestream-store"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./player-store"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./streamplace-provider"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./streamplace-store"), exports);
|
|
11
|
+
var player_provider_1 = require("./player-store/player-provider");
|
|
12
|
+
Object.defineProperty(exports, "PlayerProvider", { enumerable: true, get: function () { return player_provider_1.PlayerProvider; } });
|
|
13
|
+
Object.defineProperty(exports, "withPlayerProvider", { enumerable: true, get: function () { return player_provider_1.withPlayerProvider; } });
|
|
14
|
+
var player_store_1 = require("./player-store/player-store");
|
|
15
|
+
Object.defineProperty(exports, "usePlayerContext", { enumerable: true, get: function () { return player_store_1.usePlayerContext; } });
|
|
16
|
+
var player_1 = require("./components/mobile-player/player");
|
|
17
|
+
Object.defineProperty(exports, "Player", { enumerable: true, get: function () { return player_1.Player; } });
|
|
18
|
+
Object.defineProperty(exports, "PlayerUI", { enumerable: true, get: function () { return player_1.PlayerUI; } });
|
|
19
|
+
exports.ui = tslib_1.__importStar(require("./components/ui"));
|
|
20
|
+
tslib_1.__exportStar(require("./components/ui"), exports);
|
|
21
|
+
exports.zero = tslib_1.__importStar(require("./ui"));
|
|
22
|
+
tslib_1.__exportStar(require("./hooks"), exports);
|
|
23
|
+
// Theme system exports
|
|
24
|
+
tslib_1.__exportStar(require("./lib/theme"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./components/chat/chat"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./components/chat/chat-box"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./components/chat/system-message"), exports);
|
|
28
|
+
var video_retry_1 = require("./components/mobile-player/video-retry");
|
|
29
|
+
Object.defineProperty(exports, "VideoRetry", { enumerable: true, get: function () { return tslib_1.__importDefault(video_retry_1).default; } });
|
|
30
|
+
tslib_1.__exportStar(require("./lib/system-messages"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./components/share/sharesheet"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./components/keep-awake"), exports);
|
|
33
|
+
// Dashboard components
|
|
34
|
+
exports.Dashboard = tslib_1.__importStar(require("./components/dashboard"));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBrowserName = getBrowserName;
|
|
4
|
+
function getBrowserName(userAgent) {
|
|
5
|
+
// The order matters here, and this may report false positives for unlisted browsers.
|
|
6
|
+
if (userAgent.includes("Firefox")) {
|
|
7
|
+
// "Mozilla/5.0 (X11; Linux i686; rv:104.0) Gecko/20100101 Firefox/104.0"
|
|
8
|
+
return "Firefox";
|
|
9
|
+
}
|
|
10
|
+
else if (userAgent.includes("SamsungBrowser")) {
|
|
11
|
+
// "Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G955F Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/9.4 Chrome/67.0.3396.87 Mobile Safari/537.36"
|
|
12
|
+
return "Samsung Internet";
|
|
13
|
+
}
|
|
14
|
+
else if (userAgent.includes("Opera") || userAgent.includes("OPR")) {
|
|
15
|
+
// "Mozilla/5.0 (Macintosh; Intel Mac OS X 12_5_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36 OPR/90.0.4480.54"
|
|
16
|
+
return "Opera";
|
|
17
|
+
}
|
|
18
|
+
else if (userAgent.includes("Edge")) {
|
|
19
|
+
// "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299"
|
|
20
|
+
return "Edge (Legacy)";
|
|
21
|
+
}
|
|
22
|
+
else if (userAgent.includes("Edg")) {
|
|
23
|
+
// "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36 Edg/104.0.1293.70"
|
|
24
|
+
return "Edge (Chromium)";
|
|
25
|
+
}
|
|
26
|
+
else if (userAgent.includes("Chrome")) {
|
|
27
|
+
// "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
|
|
28
|
+
return "Chrome";
|
|
29
|
+
}
|
|
30
|
+
else if (userAgent.includes("Safari")) {
|
|
31
|
+
// "Mozilla/5.0 (iPhone; CPU iPhone OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Mobile/15E148 Safari/604.1"
|
|
32
|
+
return "Safari";
|
|
33
|
+
}
|
|
34
|
+
return "unknown";
|
|
35
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.segmentize = void 0;
|
|
4
|
+
const segment = (text, features) => {
|
|
5
|
+
return { text, features: text.length > 0 ? features : undefined };
|
|
6
|
+
};
|
|
7
|
+
const segmentize = (text, facets) => {
|
|
8
|
+
if (facets === undefined || facets.length === 0) {
|
|
9
|
+
return [segment(text, undefined)];
|
|
10
|
+
}
|
|
11
|
+
const segments = [];
|
|
12
|
+
const utf16Length = text.length;
|
|
13
|
+
let utf16Cursor = 0;
|
|
14
|
+
let utf8Cursor = 0;
|
|
15
|
+
const advanceCursor = (startUtf16, endUtf8) => {
|
|
16
|
+
let curs = startUtf16;
|
|
17
|
+
// Fast-path for entirely ASCII text
|
|
18
|
+
const isLikelyAsciiText = text.charCodeAt(curs) < 0x80;
|
|
19
|
+
if (isLikelyAsciiText) {
|
|
20
|
+
curs += 1;
|
|
21
|
+
utf8Cursor += 1;
|
|
22
|
+
// SIMD-like batch processing
|
|
23
|
+
while (utf8Cursor + 8 <= endUtf8 && curs + 8 <= utf16Length) {
|
|
24
|
+
const char1 = text.charCodeAt(curs);
|
|
25
|
+
const char2 = text.charCodeAt(curs + 1);
|
|
26
|
+
const char3 = text.charCodeAt(curs + 2);
|
|
27
|
+
const char4 = text.charCodeAt(curs + 3);
|
|
28
|
+
const char5 = text.charCodeAt(curs + 4);
|
|
29
|
+
const char6 = text.charCodeAt(curs + 5);
|
|
30
|
+
const char7 = text.charCodeAt(curs + 6);
|
|
31
|
+
const char8 = text.charCodeAt(curs + 7);
|
|
32
|
+
if ((char1 | char2 | char3 | char4 | char5 | char6 | char7 | char8) <
|
|
33
|
+
0x80) {
|
|
34
|
+
curs += 8;
|
|
35
|
+
utf8Cursor += 8;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Process remaining characters individually
|
|
42
|
+
while (utf8Cursor < endUtf8 && curs < utf16Length) {
|
|
43
|
+
const code = text.charCodeAt(curs);
|
|
44
|
+
if (code < 0x80) {
|
|
45
|
+
curs += 1;
|
|
46
|
+
utf8Cursor += 1;
|
|
47
|
+
}
|
|
48
|
+
else if (code < 0x800) {
|
|
49
|
+
curs += 1;
|
|
50
|
+
utf8Cursor += 2;
|
|
51
|
+
}
|
|
52
|
+
else if (code < 0xd800 || code > 0xdbff) {
|
|
53
|
+
curs += 1;
|
|
54
|
+
utf8Cursor += 3;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
curs += 2;
|
|
58
|
+
utf8Cursor += 4;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return curs;
|
|
62
|
+
};
|
|
63
|
+
// Process facets
|
|
64
|
+
for (let idx = 0, len = facets.length; idx < len; idx++) {
|
|
65
|
+
const facet = facets[idx];
|
|
66
|
+
const { byteStart, byteEnd } = facet.index;
|
|
67
|
+
const features = facet.features;
|
|
68
|
+
if (byteStart > byteEnd || features.length === 0) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (utf8Cursor < byteStart) {
|
|
72
|
+
const nextUtf16Cursor = advanceCursor(utf16Cursor, byteStart);
|
|
73
|
+
if (nextUtf16Cursor > utf16Cursor) {
|
|
74
|
+
segments.push(segment(text.slice(utf16Cursor, nextUtf16Cursor), undefined));
|
|
75
|
+
}
|
|
76
|
+
utf16Cursor = nextUtf16Cursor;
|
|
77
|
+
}
|
|
78
|
+
{
|
|
79
|
+
const nextUtf16Cursor = advanceCursor(utf16Cursor, byteEnd);
|
|
80
|
+
if (nextUtf16Cursor > utf16Cursor) {
|
|
81
|
+
segments.push(segment(text.slice(utf16Cursor, nextUtf16Cursor), features));
|
|
82
|
+
}
|
|
83
|
+
utf16Cursor = nextUtf16Cursor;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Handle remaining text
|
|
87
|
+
if (utf16Cursor < utf16Length) {
|
|
88
|
+
segments.push(segment(text.slice(utf16Cursor), undefined));
|
|
89
|
+
}
|
|
90
|
+
return segments;
|
|
91
|
+
};
|
|
92
|
+
exports.segmentize = segmentize;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSystemMessageMetadata = exports.getSystemMessageType = exports.isSystemMessage = exports.SystemMessages = exports.createSystemMessage = exports.SystemMessageType = void 0;
|
|
4
|
+
var SystemMessageType;
|
|
5
|
+
(function (SystemMessageType) {
|
|
6
|
+
SystemMessageType["stream_start"] = "stream_start";
|
|
7
|
+
SystemMessageType["stream_end"] = "stream_end";
|
|
8
|
+
SystemMessageType["notification"] = "notification";
|
|
9
|
+
})(SystemMessageType || (exports.SystemMessageType = SystemMessageType = {}));
|
|
10
|
+
/**
|
|
11
|
+
* Creates a system message with the proper structure
|
|
12
|
+
* @param type The type of system message
|
|
13
|
+
* @param text The message text
|
|
14
|
+
* @param metadata Optional metadata for the message
|
|
15
|
+
* @returns A properly formatted ChatMessageViewHydrated object
|
|
16
|
+
*/
|
|
17
|
+
const createSystemMessage = (type, text, metadata, date = new Date()) => {
|
|
18
|
+
const now = date;
|
|
19
|
+
return {
|
|
20
|
+
uri: `at://did:sys:system/place.stream.chat.message/${now.getTime()}`,
|
|
21
|
+
cid: `system-${now.getTime()}`,
|
|
22
|
+
author: {
|
|
23
|
+
did: "did:sys:system",
|
|
24
|
+
handle: type, // Use handle to specify the type of system message
|
|
25
|
+
},
|
|
26
|
+
record: {
|
|
27
|
+
text,
|
|
28
|
+
createdAt: now.toISOString(),
|
|
29
|
+
streamer: "system",
|
|
30
|
+
$type: "place.stream.chat.message",
|
|
31
|
+
},
|
|
32
|
+
indexedAt: now.toISOString(),
|
|
33
|
+
chatProfile: {
|
|
34
|
+
color: { red: 128, green: 128, blue: 128 }, // Gray color for system messages
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
exports.createSystemMessage = createSystemMessage;
|
|
39
|
+
/**
|
|
40
|
+
* System message factory functions for common scenarios
|
|
41
|
+
*/
|
|
42
|
+
exports.SystemMessages = {
|
|
43
|
+
streamStart: (streamerName) => (0, exports.createSystemMessage)(SystemMessageType.stream_start, `Now streaming - ${streamerName}`, {
|
|
44
|
+
streamerName,
|
|
45
|
+
}),
|
|
46
|
+
// technically, streams can't 'end' on Streamplace
|
|
47
|
+
// possibly we could use deleting or editing streams (`endedAt` param) for this?
|
|
48
|
+
streamEnd: (duration) => (0, exports.createSystemMessage)(SystemMessageType.stream_end, duration ? `Stream has ended. Duration: ${duration}` : "Stream has ended", { duration }),
|
|
49
|
+
notification: (message) => (0, exports.createSystemMessage)(SystemMessageType.notification, message),
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Checks if a message is a system message
|
|
53
|
+
* @param message The message to check
|
|
54
|
+
* @returns True if the message is a system message
|
|
55
|
+
*/
|
|
56
|
+
const isSystemMessage = (message) => {
|
|
57
|
+
return message.author.did === "did:sys:system";
|
|
58
|
+
};
|
|
59
|
+
exports.isSystemMessage = isSystemMessage;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the system message type from a message
|
|
62
|
+
* @param message The message to check
|
|
63
|
+
* @returns The system message type or null if not a system message
|
|
64
|
+
*/
|
|
65
|
+
const getSystemMessageType = (message) => {
|
|
66
|
+
if (!(0, exports.isSystemMessage)(message)) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return message.author.handle;
|
|
70
|
+
};
|
|
71
|
+
exports.getSystemMessageType = getSystemMessageType;
|
|
72
|
+
/**
|
|
73
|
+
* Parses metadata from a system message based on its type
|
|
74
|
+
* @param message The system message to parse
|
|
75
|
+
* @returns The parsed metadata
|
|
76
|
+
*/
|
|
77
|
+
const parseSystemMessageMetadata = (message) => {
|
|
78
|
+
const metadata = {};
|
|
79
|
+
const type = (0, exports.getSystemMessageType)(message);
|
|
80
|
+
const text = message.record.text;
|
|
81
|
+
if (!type)
|
|
82
|
+
return metadata;
|
|
83
|
+
switch (type) {
|
|
84
|
+
case "stream_end": {
|
|
85
|
+
const durationMatch = text.match(/Duration:\s*(\d+:\d+(?::\d+)?)/);
|
|
86
|
+
if (durationMatch) {
|
|
87
|
+
metadata.duration = durationMatch[1];
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case "stream_start": {
|
|
92
|
+
const streamerMatch = text.match(/^(.+?)\s+is now live!/);
|
|
93
|
+
if (streamerMatch) {
|
|
94
|
+
metadata.streamerName = streamerMatch[1];
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return metadata;
|
|
100
|
+
};
|
|
101
|
+
exports.parseSystemMessageMetadata = parseSystemMessageMetadata;
|