@streamplace/components 0.6.37 → 0.7.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.
- package/dist/components/chat/chat-box.js +109 -0
- package/dist/components/chat/chat-message.js +76 -0
- package/dist/components/chat/chat.js +56 -0
- package/dist/components/chat/mention-suggestions.js +39 -0
- package/dist/components/chat/mod-view.js +33 -0
- package/dist/components/mobile-player/fullscreen.js +69 -0
- package/dist/components/mobile-player/fullscreen.native.js +151 -0
- package/dist/components/mobile-player/player.js +103 -0
- package/dist/components/mobile-player/props.js +1 -0
- package/dist/components/mobile-player/shared.js +51 -0
- package/dist/components/mobile-player/ui/countdown.js +79 -0
- package/dist/components/mobile-player/ui/index.js +5 -0
- package/dist/components/mobile-player/ui/input.js +38 -0
- package/dist/components/mobile-player/ui/metrics.js +40 -0
- package/dist/components/mobile-player/ui/streamer-context-menu.js +4 -0
- package/dist/components/mobile-player/ui/viewer-context-menu.js +20 -0
- package/dist/components/mobile-player/use-webrtc.js +232 -0
- package/dist/components/mobile-player/video.js +375 -0
- package/dist/components/mobile-player/video.native.js +238 -0
- package/dist/components/mobile-player/webrtc-diagnostics.js +106 -0
- package/dist/components/mobile-player/webrtc-primitives.js +25 -0
- package/dist/components/mobile-player/webrtc-primitives.native.js +1 -0
- package/dist/components/ui/button.js +220 -0
- package/dist/components/ui/dialog.js +203 -0
- package/dist/components/ui/dropdown.js +148 -0
- package/dist/components/ui/icons.js +22 -0
- package/dist/components/ui/index.js +22 -0
- package/dist/components/ui/input.js +202 -0
- package/dist/components/ui/loader.js +7 -0
- package/dist/components/ui/primitives/button.js +121 -0
- package/dist/components/ui/primitives/input.js +202 -0
- package/dist/components/ui/primitives/modal.js +203 -0
- package/dist/components/ui/primitives/text.js +286 -0
- package/dist/components/ui/resizeable.js +101 -0
- package/dist/components/ui/text.js +175 -0
- package/dist/components/ui/textarea.js +17 -0
- package/dist/components/ui/toast.js +129 -0
- package/dist/components/ui/view.js +250 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/useAvatars.js +32 -0
- package/dist/hooks/useCameraToggle.js +9 -0
- package/dist/hooks/useKeyboard.js +33 -0
- package/dist/hooks/useKeyboardSlide.js +11 -0
- package/dist/hooks/useLivestreamInfo.js +62 -0
- package/dist/hooks/useOuterAndInnerDimensions.js +27 -0
- package/dist/hooks/usePlayerDimensions.js +19 -0
- package/dist/hooks/useSegmentTiming.js +62 -0
- package/dist/index.js +10 -0
- package/dist/lib/facet.js +88 -0
- package/dist/lib/theme/atoms.js +620 -0
- package/dist/lib/theme/atoms.types.js +5 -0
- package/dist/lib/theme/index.js +9 -0
- package/dist/lib/theme/theme.js +248 -0
- package/dist/lib/theme/tokens.js +383 -0
- package/dist/lib/utils.js +94 -0
- package/dist/livestream-provider/index.js +8 -3
- package/dist/livestream-store/chat.js +89 -65
- package/dist/livestream-store/index.js +1 -0
- package/dist/livestream-store/livestream-store.js +3 -0
- package/dist/livestream-store/stream-key.js +115 -0
- package/dist/player-store/player-provider.js +0 -1
- package/dist/player-store/player-store.js +13 -0
- package/dist/streamplace-store/block.js +23 -0
- package/dist/streamplace-store/index.js +1 -0
- package/dist/streamplace-store/stream.js +193 -0
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/56540125 +0 -0
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/67b1eb60 +0 -0
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/7c275f90 +0 -0
- package/package.json +20 -4
- package/src/components/chat/chat-box.tsx +195 -0
- package/src/components/chat/chat-message.tsx +192 -0
- package/src/components/chat/chat.tsx +128 -0
- package/src/components/chat/mention-suggestions.tsx +71 -0
- package/src/components/chat/mod-view.tsx +118 -0
- package/src/components/mobile-player/fullscreen.native.tsx +193 -0
- package/src/components/mobile-player/fullscreen.tsx +79 -0
- package/src/components/mobile-player/player.tsx +134 -0
- package/src/components/mobile-player/props.tsx +11 -0
- package/src/components/mobile-player/shared.tsx +56 -0
- package/src/components/mobile-player/ui/countdown.tsx +119 -0
- package/src/components/mobile-player/ui/index.ts +5 -0
- package/src/components/mobile-player/ui/input.tsx +85 -0
- package/src/components/mobile-player/ui/metrics.tsx +69 -0
- package/src/components/mobile-player/ui/streamer-context-menu.tsx +3 -0
- package/src/components/mobile-player/ui/viewer-context-menu.tsx +70 -0
- package/src/components/mobile-player/use-webrtc.tsx +282 -0
- package/src/components/mobile-player/video.native.tsx +360 -0
- package/src/components/mobile-player/video.tsx +557 -0
- package/src/components/mobile-player/webrtc-diagnostics.tsx +149 -0
- package/src/components/mobile-player/webrtc-primitives.native.tsx +6 -0
- package/src/components/mobile-player/webrtc-primitives.tsx +33 -0
- package/src/components/ui/button.tsx +309 -0
- package/src/components/ui/dialog.tsx +376 -0
- package/src/components/ui/dropdown.tsx +399 -0
- package/src/components/ui/icons.tsx +50 -0
- package/src/components/ui/index.ts +33 -0
- package/src/components/ui/input.tsx +350 -0
- package/src/components/ui/loader.tsx +9 -0
- package/src/components/ui/primitives/button.tsx +292 -0
- package/src/components/ui/primitives/input.tsx +422 -0
- package/src/components/ui/primitives/modal.tsx +421 -0
- package/src/components/ui/primitives/text.tsx +499 -0
- package/src/components/ui/resizeable.tsx +169 -0
- package/src/components/ui/text.tsx +330 -0
- package/src/components/ui/textarea.tsx +34 -0
- package/src/components/ui/toast.tsx +203 -0
- package/src/components/ui/view.tsx +344 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useAvatars.tsx +44 -0
- package/src/hooks/useCameraToggle.ts +12 -0
- package/src/hooks/useKeyboard.tsx +41 -0
- package/src/hooks/useKeyboardSlide.ts +12 -0
- package/src/hooks/useLivestreamInfo.ts +67 -0
- package/src/hooks/useOuterAndInnerDimensions.tsx +32 -0
- package/src/hooks/usePlayerDimensions.ts +23 -0
- package/src/hooks/useSegmentTiming.tsx +88 -0
- package/src/index.tsx +21 -0
- package/src/lib/facet.ts +131 -0
- package/src/lib/theme/atoms.ts +760 -0
- package/src/lib/theme/atoms.types.ts +258 -0
- package/src/lib/theme/index.ts +48 -0
- package/src/lib/theme/theme.tsx +436 -0
- package/src/lib/theme/tokens.ts +409 -0
- package/src/lib/utils.ts +132 -0
- package/src/livestream-provider/index.tsx +13 -2
- package/src/livestream-store/chat.tsx +115 -78
- package/src/livestream-store/index.tsx +1 -0
- package/src/livestream-store/livestream-state.tsx +3 -0
- package/src/livestream-store/livestream-store.tsx +3 -0
- package/src/livestream-store/stream-key.tsx +124 -0
- package/src/player-store/player-provider.tsx +0 -1
- package/src/player-store/player-state.tsx +28 -0
- package/src/player-store/player-store.tsx +22 -0
- package/src/streamplace-store/block.tsx +29 -0
- package/src/streamplace-store/index.tsx +1 -0
- package/src/streamplace-store/stream.tsx +262 -0
- package/tsconfig.tsbuildinfo +1 -1
package/src/lib/facet.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Taken from ATcute's richtext-segmenter
|
|
2
|
+
// https://github.com/mary-ext/atcute/blob/trunk/packages/bluesky/richtext-segmenter/lib/index.ts
|
|
3
|
+
// repoed b/c we need to import types from @atproto/api not @atcute/bsky
|
|
4
|
+
import { Main } from "@atproto/api/dist/client/types/app/bsky/richtext/facet";
|
|
5
|
+
|
|
6
|
+
type UnwrapArray<T> = T extends (infer V)[] ? V : never;
|
|
7
|
+
|
|
8
|
+
export type Facet = Main;
|
|
9
|
+
export type FacetFeature = UnwrapArray<Facet["features"]>;
|
|
10
|
+
|
|
11
|
+
export interface RichtextSegment {
|
|
12
|
+
text: string;
|
|
13
|
+
features: FacetFeature[] | undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const segment = (
|
|
17
|
+
text: string,
|
|
18
|
+
features: FacetFeature[] | undefined,
|
|
19
|
+
): RichtextSegment => {
|
|
20
|
+
return { text, features: text.length > 0 ? features : undefined };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const segmentize = (
|
|
24
|
+
text: string,
|
|
25
|
+
facets: Facet[] | undefined,
|
|
26
|
+
): RichtextSegment[] => {
|
|
27
|
+
if (facets === undefined || facets.length === 0) {
|
|
28
|
+
return [segment(text, undefined)];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const segments: RichtextSegment[] = [];
|
|
32
|
+
const utf16Length = text.length;
|
|
33
|
+
let utf16Cursor = 0;
|
|
34
|
+
let utf8Cursor = 0;
|
|
35
|
+
|
|
36
|
+
const advanceCursor = (startUtf16: number, endUtf8: number): number => {
|
|
37
|
+
let curs = startUtf16;
|
|
38
|
+
|
|
39
|
+
// Fast-path for entirely ASCII text
|
|
40
|
+
const isLikelyAsciiText = text.charCodeAt(curs) < 0x80;
|
|
41
|
+
if (isLikelyAsciiText) {
|
|
42
|
+
curs += 1;
|
|
43
|
+
utf8Cursor += 1;
|
|
44
|
+
|
|
45
|
+
// SIMD-like batch processing
|
|
46
|
+
while (utf8Cursor + 8 <= endUtf8 && curs + 8 <= utf16Length) {
|
|
47
|
+
const char1 = text.charCodeAt(curs);
|
|
48
|
+
const char2 = text.charCodeAt(curs + 1);
|
|
49
|
+
const char3 = text.charCodeAt(curs + 2);
|
|
50
|
+
const char4 = text.charCodeAt(curs + 3);
|
|
51
|
+
const char5 = text.charCodeAt(curs + 4);
|
|
52
|
+
const char6 = text.charCodeAt(curs + 5);
|
|
53
|
+
const char7 = text.charCodeAt(curs + 6);
|
|
54
|
+
const char8 = text.charCodeAt(curs + 7);
|
|
55
|
+
|
|
56
|
+
if (
|
|
57
|
+
(char1 | char2 | char3 | char4 | char5 | char6 | char7 | char8) <
|
|
58
|
+
0x80
|
|
59
|
+
) {
|
|
60
|
+
curs += 8;
|
|
61
|
+
utf8Cursor += 8;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Process remaining characters individually
|
|
70
|
+
while (utf8Cursor < endUtf8 && curs < utf16Length) {
|
|
71
|
+
const code = text.charCodeAt(curs);
|
|
72
|
+
|
|
73
|
+
if (code < 0x80) {
|
|
74
|
+
curs += 1;
|
|
75
|
+
utf8Cursor += 1;
|
|
76
|
+
} else if (code < 0x800) {
|
|
77
|
+
curs += 1;
|
|
78
|
+
utf8Cursor += 2;
|
|
79
|
+
} else if (code < 0xd800 || code > 0xdbff) {
|
|
80
|
+
curs += 1;
|
|
81
|
+
utf8Cursor += 3;
|
|
82
|
+
} else {
|
|
83
|
+
curs += 2;
|
|
84
|
+
utf8Cursor += 4;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return curs;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Process facets
|
|
92
|
+
for (let idx = 0, len = facets.length; idx < len; idx++) {
|
|
93
|
+
const facet = facets[idx];
|
|
94
|
+
|
|
95
|
+
const { byteStart, byteEnd } = facet.index;
|
|
96
|
+
const features = facet.features;
|
|
97
|
+
|
|
98
|
+
if (byteStart > byteEnd || features.length === 0) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (utf8Cursor < byteStart) {
|
|
103
|
+
const nextUtf16Cursor = advanceCursor(utf16Cursor, byteStart);
|
|
104
|
+
if (nextUtf16Cursor > utf16Cursor) {
|
|
105
|
+
segments.push(
|
|
106
|
+
segment(text.slice(utf16Cursor, nextUtf16Cursor), undefined),
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
utf16Cursor = nextUtf16Cursor;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
{
|
|
114
|
+
const nextUtf16Cursor = advanceCursor(utf16Cursor, byteEnd);
|
|
115
|
+
if (nextUtf16Cursor > utf16Cursor) {
|
|
116
|
+
segments.push(
|
|
117
|
+
segment(text.slice(utf16Cursor, nextUtf16Cursor), features),
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
utf16Cursor = nextUtf16Cursor;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Handle remaining text
|
|
126
|
+
if (utf16Cursor < utf16Length) {
|
|
127
|
+
segments.push(segment(text.slice(utf16Cursor), undefined));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return segments;
|
|
131
|
+
};
|