@streamplace/components 0.7.1 → 0.7.2
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 +46 -43
- package/dist/components/chat/chat-message.js +36 -33
- package/dist/components/chat/chat.js +31 -27
- package/dist/components/chat/mention-suggestions.js +16 -13
- package/dist/components/chat/mod-view.js +20 -17
- package/dist/components/mobile-player/fullscreen.js +21 -17
- package/dist/components/mobile-player/fullscreen.native.js +39 -35
- package/dist/components/mobile-player/player.js +38 -32
- package/dist/components/mobile-player/props.js +2 -1
- package/dist/components/mobile-player/shared.js +16 -13
- package/dist/components/mobile-player/ui/countdown.js +23 -19
- package/dist/components/mobile-player/ui/index.js +9 -6
- package/dist/components/mobile-player/ui/input.js +16 -12
- package/dist/components/mobile-player/ui/metrics.js +20 -16
- package/dist/components/mobile-player/ui/streamer-context-menu.js +6 -3
- package/dist/components/mobile-player/ui/viewer-context-menu.js +19 -16
- package/dist/components/mobile-player/ui/viewers.js +13 -9
- package/dist/components/mobile-player/use-webrtc.js +29 -24
- package/dist/components/mobile-player/video.js +109 -99
- package/dist/components/mobile-player/video.native.js +92 -85
- package/dist/components/mobile-player/webrtc-diagnostics.js +9 -5
- package/dist/components/mobile-player/webrtc-primitives.js +8 -6
- package/dist/components/mobile-player/webrtc-primitives.native.js +8 -1
- package/dist/components/ui/button.js +26 -23
- package/dist/components/ui/dialog.js +43 -40
- package/dist/components/ui/dropdown.js +121 -116
- package/dist/components/ui/icons.js +8 -5
- package/dist/components/ui/index.js +27 -19
- package/dist/components/ui/input.js +31 -28
- package/dist/components/ui/loader.js +9 -6
- package/dist/components/ui/primitives/button.js +33 -29
- package/dist/components/ui/primitives/input.js +44 -40
- package/dist/components/ui/primitives/modal.js +45 -41
- package/dist/components/ui/primitives/text.js +35 -29
- package/dist/components/ui/resizeable.js +48 -44
- package/dist/components/ui/text.js +50 -48
- package/dist/components/ui/textarea.js +13 -11
- package/dist/components/ui/toast.js +26 -23
- package/dist/components/ui/view.js +41 -39
- package/dist/hooks/index.js +12 -9
- package/dist/hooks/useAvatars.js +11 -8
- package/dist/hooks/useCameraToggle.js +7 -4
- package/dist/hooks/useKeyboard.js +13 -10
- package/dist/hooks/useKeyboardSlide.js +8 -5
- package/dist/hooks/useLivestreamInfo.js +17 -14
- package/dist/hooks/useOuterAndInnerDimensions.js +9 -6
- package/dist/hooks/usePlayerDimensions.js +9 -6
- package/dist/hooks/useSegmentDimensions.js +6 -3
- package/dist/hooks/useSegmentTiming.js +13 -10
- package/dist/index.js +24 -15
- package/dist/lib/facet.js +5 -1
- package/dist/lib/theme/atoms.js +153 -148
- package/dist/lib/theme/atoms.types.js +2 -1
- package/dist/lib/theme/index.js +31 -5
- package/dist/lib/theme/theme.js +91 -83
- package/dist/lib/theme/tokens.js +15 -12
- package/dist/lib/utils.js +22 -11
- package/dist/livestream-provider/index.js +19 -14
- package/dist/livestream-provider/websocket.js +14 -10
- package/dist/livestream-store/chat.js +26 -19
- package/dist/livestream-store/context.js +5 -2
- package/dist/livestream-store/index.js +7 -4
- package/dist/livestream-store/livestream-state.js +2 -1
- package/dist/livestream-store/livestream-store.js +31 -18
- package/dist/livestream-store/stream-key.js +22 -18
- package/dist/livestream-store/websocket-consumer.js +18 -14
- package/dist/player-store/context.js +5 -2
- package/dist/player-store/index.js +8 -5
- package/dist/player-store/player-provider.js +20 -15
- package/dist/player-store/player-state.js +9 -6
- package/dist/player-store/player-store.js +32 -21
- package/dist/player-store/single-player-provider.js +35 -23
- package/dist/streamplace-provider/context.js +5 -2
- package/dist/streamplace-provider/index.js +14 -10
- package/dist/streamplace-provider/poller.js +20 -17
- package/dist/streamplace-store/block.js +6 -3
- package/dist/streamplace-store/index.js +6 -3
- package/dist/streamplace-store/stream.js +14 -10
- package/dist/streamplace-store/streamplace-store.js +23 -13
- package/dist/streamplace-store/user.js +19 -14
- package/dist/streamplace-store/xrpc.js +10 -7
- package/node-compile-cache/v22.15.0-x64-92db9086-0/37be0eec +0 -0
- package/node-compile-cache/v22.15.0-x64-92db9086-0/56540125 +0 -0
- package/node-compile-cache/{v22.15.0-x64-efe9a9df-0 → v22.15.0-x64-92db9086-0}/67b1eb60 +0 -0
- package/node-compile-cache/{v22.15.0-x64-efe9a9df-0 → v22.15.0-x64-92db9086-0}/7c275f90 +0 -0
- package/package.json +5 -6
- package/tsconfig.json +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- 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
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = Poller;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const streamplace_1 = require("streamplace");
|
|
7
|
+
const streamplace_store_1 = require("../streamplace-store");
|
|
8
|
+
const xrpc_1 = require("../streamplace-store/xrpc");
|
|
9
|
+
function Poller({ children }) {
|
|
10
|
+
const url = (0, streamplace_store_1.useStreamplaceStore)((state) => state.url);
|
|
11
|
+
const setLiveUsers = (0, streamplace_store_1.useStreamplaceStore)((state) => state.setLiveUsers);
|
|
12
|
+
const did = (0, streamplace_store_1.useDID)();
|
|
13
|
+
const pdsAgent = (0, xrpc_1.usePDSAgent)();
|
|
14
|
+
const getChatProfile = (0, streamplace_store_1.useGetChatProfile)();
|
|
15
|
+
const getBskyProfile = (0, streamplace_store_1.useGetBskyProfile)();
|
|
16
|
+
const liveUserRefresh = (0, streamplace_store_1.useStreamplaceStore)((state) => state.liveUsersRefresh);
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
15
18
|
if (pdsAgent && did) {
|
|
16
19
|
getChatProfile();
|
|
17
20
|
getBskyProfile();
|
|
18
21
|
}
|
|
19
22
|
}, [pdsAgent, did]);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
const agent = new StreamplaceAgent(url);
|
|
23
|
+
(0, react_1.useEffect)(() => {
|
|
24
|
+
const agent = new streamplace_1.StreamplaceAgent(url);
|
|
22
25
|
const go = async () => {
|
|
23
26
|
setLiveUsers({
|
|
24
27
|
liveUsersLoading: true,
|
|
@@ -42,5 +45,5 @@ export default function Poller({ children }) {
|
|
|
42
45
|
const handle = setInterval(go, 3000);
|
|
43
46
|
return () => clearInterval(handle);
|
|
44
47
|
}, [url, liveUserRefresh]);
|
|
45
|
-
return
|
|
48
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
46
49
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCreateBlockRecord = useCreateBlockRecord;
|
|
4
|
+
const xrpc_1 = require("./xrpc");
|
|
5
|
+
function useCreateBlockRecord() {
|
|
6
|
+
let agent = (0, xrpc_1.usePDSAgent)();
|
|
4
7
|
return async (subjectDID) => {
|
|
5
8
|
if (!agent) {
|
|
6
9
|
throw new Error("No PDS agent found");
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./stream"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./streamplace-store"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./user"), exports);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCreateStreamRecord = useCreateStreamRecord;
|
|
4
|
+
exports.useUpdateStreamRecord = useUpdateStreamRecord;
|
|
5
|
+
const api_1 = require("@atproto/api");
|
|
6
|
+
const streamplace_store_1 = require("./streamplace-store");
|
|
7
|
+
const xrpc_1 = require("./xrpc");
|
|
4
8
|
const uploadThumbnail = async (pdsAgent, customThumbnail) => {
|
|
5
9
|
if (customThumbnail) {
|
|
6
10
|
let tries = 0;
|
|
@@ -42,7 +46,7 @@ function buildGoLivePost(text, url, profile, params, thumbnail) {
|
|
|
42
46
|
const textUrl = `${url.protocol}//${url.host}/${profile.handle}`;
|
|
43
47
|
const suffix = ` ${text}`;
|
|
44
48
|
const content = prefix + textUrl + suffix;
|
|
45
|
-
const rt = new RichText({ text: content });
|
|
49
|
+
const rt = new api_1.RichText({ text: content });
|
|
46
50
|
rt.detectFacetsWithoutResolution();
|
|
47
51
|
const record = {
|
|
48
52
|
$type: "app.bsky.feed.post",
|
|
@@ -65,9 +69,9 @@ function buildGoLivePost(text, url, profile, params, thumbnail) {
|
|
|
65
69
|
};
|
|
66
70
|
return record;
|
|
67
71
|
}
|
|
68
|
-
|
|
69
|
-
let agent = usePDSAgent();
|
|
70
|
-
let url = useUrl();
|
|
72
|
+
function useCreateStreamRecord() {
|
|
73
|
+
let agent = (0, xrpc_1.usePDSAgent)();
|
|
74
|
+
let url = (0, streamplace_store_1.useUrl)();
|
|
71
75
|
return async (title, customThumbnail, submitPost = true) => {
|
|
72
76
|
if (!agent) {
|
|
73
77
|
throw new Error("No PDS agent found");
|
|
@@ -147,9 +151,9 @@ export function useCreateStreamRecord() {
|
|
|
147
151
|
return record;
|
|
148
152
|
};
|
|
149
153
|
}
|
|
150
|
-
|
|
151
|
-
let agent = usePDSAgent();
|
|
152
|
-
let url = useUrl();
|
|
154
|
+
function useUpdateStreamRecord() {
|
|
155
|
+
let agent = (0, xrpc_1.usePDSAgent)();
|
|
156
|
+
let url = (0, streamplace_store_1.useUrl)();
|
|
153
157
|
return async (title, livestream, customThumbnail) => {
|
|
154
158
|
if (!agent) {
|
|
155
159
|
throw new Error("No PDS agent found");
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSetHandle = exports.useHandle = exports.useDID = exports.useUrl = exports.makeStreamplaceStore = void 0;
|
|
4
|
+
exports.getStreamplaceStoreFromContext = getStreamplaceStoreFromContext;
|
|
5
|
+
exports.useStreamplaceStore = useStreamplaceStore;
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const zustand_1 = require("zustand");
|
|
8
|
+
const context_1 = require("../streamplace-provider/context");
|
|
9
|
+
const makeStreamplaceStore = ({ url, }) => {
|
|
10
|
+
return (0, zustand_1.createStore)()((set) => ({
|
|
6
11
|
url,
|
|
7
12
|
liveUsers: null,
|
|
8
13
|
setLiveUsers: (opts) => {
|
|
@@ -18,20 +23,25 @@ export const makeStreamplaceStore = ({ url, }) => {
|
|
|
18
23
|
chatProfile: null,
|
|
19
24
|
}));
|
|
20
25
|
};
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
exports.makeStreamplaceStore = makeStreamplaceStore;
|
|
27
|
+
function getStreamplaceStoreFromContext() {
|
|
28
|
+
const context = (0, react_1.useContext)(context_1.StreamplaceContext);
|
|
23
29
|
if (!context) {
|
|
24
30
|
throw new Error("useStreamplaceStore must be used within a StreamplaceProvider");
|
|
25
31
|
}
|
|
26
32
|
return context.store;
|
|
27
33
|
}
|
|
28
|
-
|
|
29
|
-
return useStore(getStreamplaceStoreFromContext(), selector);
|
|
34
|
+
function useStreamplaceStore(selector) {
|
|
35
|
+
return (0, zustand_1.useStore)(getStreamplaceStoreFromContext(), selector);
|
|
30
36
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
const useUrl = () => useStreamplaceStore((x) => x.url);
|
|
38
|
+
exports.useUrl = useUrl;
|
|
39
|
+
const useDID = () => useStreamplaceStore((x) => x.oauthSession?.did);
|
|
40
|
+
exports.useDID = useDID;
|
|
41
|
+
const useHandle = () => useStreamplaceStore((x) => x.handle);
|
|
42
|
+
exports.useHandle = useHandle;
|
|
43
|
+
const useSetHandle = () => {
|
|
35
44
|
const store = getStreamplaceStoreFromContext();
|
|
36
45
|
return (handle) => store.setState({ handle });
|
|
37
46
|
};
|
|
47
|
+
exports.useSetHandle = useSetHandle;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGetChatProfile = useGetChatProfile;
|
|
4
|
+
exports.useGetBskyProfile = useGetBskyProfile;
|
|
5
|
+
exports.useChatProfile = useChatProfile;
|
|
6
|
+
const streamplace_1 = require("streamplace");
|
|
7
|
+
const streamplace_store_1 = require("./streamplace-store");
|
|
8
|
+
const xrpc_1 = require("./xrpc");
|
|
9
|
+
function useGetChatProfile() {
|
|
10
|
+
const did = (0, streamplace_store_1.useDID)();
|
|
11
|
+
const pdsAgent = (0, xrpc_1.usePDSAgent)();
|
|
12
|
+
const store = (0, streamplace_store_1.getStreamplaceStoreFromContext)();
|
|
8
13
|
return async () => {
|
|
9
14
|
if (!did || !pdsAgent) {
|
|
10
15
|
throw new Error("No DID or PDS agent");
|
|
@@ -17,7 +22,7 @@ export function useGetChatProfile() {
|
|
|
17
22
|
if (!res.success) {
|
|
18
23
|
throw new Error("Failed to get chat profile record");
|
|
19
24
|
}
|
|
20
|
-
if (PlaceStreamChatProfile.isRecord(res.data.value)) {
|
|
25
|
+
if (streamplace_1.PlaceStreamChatProfile.isRecord(res.data.value)) {
|
|
21
26
|
store.setState({ chatProfile: res.data.value });
|
|
22
27
|
}
|
|
23
28
|
else {
|
|
@@ -25,10 +30,10 @@ export function useGetChatProfile() {
|
|
|
25
30
|
}
|
|
26
31
|
};
|
|
27
32
|
}
|
|
28
|
-
|
|
29
|
-
const did = useDID();
|
|
30
|
-
const pdsAgent = usePDSAgent();
|
|
31
|
-
const store = getStreamplaceStoreFromContext();
|
|
33
|
+
function useGetBskyProfile() {
|
|
34
|
+
const did = (0, streamplace_store_1.useDID)();
|
|
35
|
+
const pdsAgent = (0, xrpc_1.usePDSAgent)();
|
|
36
|
+
const store = (0, streamplace_store_1.getStreamplaceStoreFromContext)();
|
|
32
37
|
return async () => {
|
|
33
38
|
if (!did || !pdsAgent) {
|
|
34
39
|
throw new Error("No DID or PDS agent");
|
|
@@ -42,6 +47,6 @@ export function useGetBskyProfile() {
|
|
|
42
47
|
store.setState({ handle: res.data.handle });
|
|
43
48
|
};
|
|
44
49
|
}
|
|
45
|
-
|
|
46
|
-
return useStreamplaceStore((x) => x.chatProfile);
|
|
50
|
+
function useChatProfile() {
|
|
51
|
+
return (0, streamplace_store_1.useStreamplaceStore)((x) => x.chatProfile);
|
|
47
52
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePDSAgent = usePDSAgent;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const streamplace_1 = require("streamplace");
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
function usePDSAgent() {
|
|
8
|
+
const oauthSession = (0, _1.useStreamplaceStore)((state) => state.oauthSession);
|
|
9
|
+
return (0, react_1.useMemo)(() => {
|
|
7
10
|
if (!oauthSession) {
|
|
8
11
|
return null;
|
|
9
12
|
}
|
|
10
|
-
return new StreamplaceAgent(oauthSession);
|
|
13
|
+
return new streamplace_1.StreamplaceAgent(oauthSession);
|
|
11
14
|
}, [oauthSession]);
|
|
12
15
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamplace/components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Streamplace React (Native) Components",
|
|
5
|
-
"type": "module",
|
|
6
5
|
"main": "dist/index.js",
|
|
7
6
|
"types": "src/index.tsx",
|
|
8
7
|
"exports": {
|
|
9
8
|
".": {
|
|
10
9
|
"@streamplace/dev": "./src/index.tsx",
|
|
11
|
-
"types": "./
|
|
12
|
-
"default": "./dist/index.
|
|
10
|
+
"types": "./src/index.tsx",
|
|
11
|
+
"default": "./dist/index.js"
|
|
13
12
|
}
|
|
14
13
|
},
|
|
15
14
|
"scripts": {
|
|
@@ -44,12 +43,12 @@
|
|
|
44
43
|
"react-native-safe-area-context": "5.4.1",
|
|
45
44
|
"react-native-webrtc": "git+https://github.com/streamplace/react-native-webrtc.git#6b8472a771ac47f89217d327058a8a4124a6ae56",
|
|
46
45
|
"react-use-websocket": "^4.13.0",
|
|
47
|
-
"streamplace": "0.7.
|
|
46
|
+
"streamplace": "0.7.2",
|
|
48
47
|
"viem": "^2.21.44",
|
|
49
48
|
"zustand": "^5.0.5"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
52
51
|
"react": "*"
|
|
53
52
|
},
|
|
54
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "b07a68160ae6da34cf47aa397b4ef452248d79e5"
|
|
55
54
|
}
|