@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.
Files changed (90) hide show
  1. package/dist/components/chat/chat-box.js +46 -43
  2. package/dist/components/chat/chat-message.js +36 -33
  3. package/dist/components/chat/chat.js +31 -27
  4. package/dist/components/chat/mention-suggestions.js +16 -13
  5. package/dist/components/chat/mod-view.js +20 -17
  6. package/dist/components/mobile-player/fullscreen.js +21 -17
  7. package/dist/components/mobile-player/fullscreen.native.js +39 -35
  8. package/dist/components/mobile-player/player.js +38 -32
  9. package/dist/components/mobile-player/props.js +2 -1
  10. package/dist/components/mobile-player/shared.js +16 -13
  11. package/dist/components/mobile-player/ui/countdown.js +23 -19
  12. package/dist/components/mobile-player/ui/index.js +9 -6
  13. package/dist/components/mobile-player/ui/input.js +16 -12
  14. package/dist/components/mobile-player/ui/metrics.js +20 -16
  15. package/dist/components/mobile-player/ui/streamer-context-menu.js +6 -3
  16. package/dist/components/mobile-player/ui/viewer-context-menu.js +19 -16
  17. package/dist/components/mobile-player/ui/viewers.js +13 -9
  18. package/dist/components/mobile-player/use-webrtc.js +29 -24
  19. package/dist/components/mobile-player/video.js +109 -99
  20. package/dist/components/mobile-player/video.native.js +92 -85
  21. package/dist/components/mobile-player/webrtc-diagnostics.js +9 -5
  22. package/dist/components/mobile-player/webrtc-primitives.js +8 -6
  23. package/dist/components/mobile-player/webrtc-primitives.native.js +8 -1
  24. package/dist/components/ui/button.js +26 -23
  25. package/dist/components/ui/dialog.js +43 -40
  26. package/dist/components/ui/dropdown.js +121 -116
  27. package/dist/components/ui/icons.js +8 -5
  28. package/dist/components/ui/index.js +27 -19
  29. package/dist/components/ui/input.js +31 -28
  30. package/dist/components/ui/loader.js +9 -6
  31. package/dist/components/ui/primitives/button.js +33 -29
  32. package/dist/components/ui/primitives/input.js +44 -40
  33. package/dist/components/ui/primitives/modal.js +45 -41
  34. package/dist/components/ui/primitives/text.js +35 -29
  35. package/dist/components/ui/resizeable.js +48 -44
  36. package/dist/components/ui/text.js +50 -48
  37. package/dist/components/ui/textarea.js +13 -11
  38. package/dist/components/ui/toast.js +26 -23
  39. package/dist/components/ui/view.js +41 -39
  40. package/dist/hooks/index.js +12 -9
  41. package/dist/hooks/useAvatars.js +11 -8
  42. package/dist/hooks/useCameraToggle.js +7 -4
  43. package/dist/hooks/useKeyboard.js +13 -10
  44. package/dist/hooks/useKeyboardSlide.js +8 -5
  45. package/dist/hooks/useLivestreamInfo.js +17 -14
  46. package/dist/hooks/useOuterAndInnerDimensions.js +9 -6
  47. package/dist/hooks/usePlayerDimensions.js +9 -6
  48. package/dist/hooks/useSegmentDimensions.js +6 -3
  49. package/dist/hooks/useSegmentTiming.js +13 -10
  50. package/dist/index.js +24 -15
  51. package/dist/lib/facet.js +5 -1
  52. package/dist/lib/theme/atoms.js +153 -148
  53. package/dist/lib/theme/atoms.types.js +2 -1
  54. package/dist/lib/theme/index.js +31 -5
  55. package/dist/lib/theme/theme.js +91 -83
  56. package/dist/lib/theme/tokens.js +15 -12
  57. package/dist/lib/utils.js +22 -11
  58. package/dist/livestream-provider/index.js +19 -14
  59. package/dist/livestream-provider/websocket.js +14 -10
  60. package/dist/livestream-store/chat.js +26 -19
  61. package/dist/livestream-store/context.js +5 -2
  62. package/dist/livestream-store/index.js +7 -4
  63. package/dist/livestream-store/livestream-state.js +2 -1
  64. package/dist/livestream-store/livestream-store.js +31 -18
  65. package/dist/livestream-store/stream-key.js +22 -18
  66. package/dist/livestream-store/websocket-consumer.js +18 -14
  67. package/dist/player-store/context.js +5 -2
  68. package/dist/player-store/index.js +8 -5
  69. package/dist/player-store/player-provider.js +20 -15
  70. package/dist/player-store/player-state.js +9 -6
  71. package/dist/player-store/player-store.js +32 -21
  72. package/dist/player-store/single-player-provider.js +35 -23
  73. package/dist/streamplace-provider/context.js +5 -2
  74. package/dist/streamplace-provider/index.js +14 -10
  75. package/dist/streamplace-provider/poller.js +20 -17
  76. package/dist/streamplace-store/block.js +6 -3
  77. package/dist/streamplace-store/index.js +6 -3
  78. package/dist/streamplace-store/stream.js +14 -10
  79. package/dist/streamplace-store/streamplace-store.js +23 -13
  80. package/dist/streamplace-store/user.js +19 -14
  81. package/dist/streamplace-store/xrpc.js +10 -7
  82. package/node-compile-cache/v22.15.0-x64-92db9086-0/37be0eec +0 -0
  83. package/node-compile-cache/v22.15.0-x64-92db9086-0/56540125 +0 -0
  84. package/node-compile-cache/{v22.15.0-x64-efe9a9df-0 → v22.15.0-x64-92db9086-0}/67b1eb60 +0 -0
  85. package/node-compile-cache/{v22.15.0-x64-efe9a9df-0 → v22.15.0-x64-92db9086-0}/7c275f90 +0 -0
  86. package/package.json +5 -6
  87. package/tsconfig.json +2 -1
  88. package/tsconfig.tsbuildinfo +1 -1
  89. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
  90. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/56540125 +0 -0
@@ -1,24 +1,27 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect } from "react";
3
- import { StreamplaceAgent } from "streamplace";
4
- import { useDID, useGetBskyProfile, useGetChatProfile, useStreamplaceStore, } from "../streamplace-store";
5
- import { usePDSAgent } from "../streamplace-store/xrpc";
6
- export default function Poller({ children }) {
7
- const url = useStreamplaceStore((state) => state.url);
8
- const setLiveUsers = useStreamplaceStore((state) => state.setLiveUsers);
9
- const did = useDID();
10
- const pdsAgent = usePDSAgent();
11
- const getChatProfile = useGetChatProfile();
12
- const getBskyProfile = useGetBskyProfile();
13
- const liveUserRefresh = useStreamplaceStore((state) => state.liveUsersRefresh);
14
- useEffect(() => {
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 _jsx(_Fragment, { children: children });
48
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
46
49
  }
@@ -1,6 +1,9 @@
1
- import { usePDSAgent } from "./xrpc";
2
- export function useCreateBlockRecord() {
3
- let agent = usePDSAgent();
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
- export * from "./stream";
2
- export * from "./streamplace-store";
3
- export * from "./user";
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
- import { RichText } from "@atproto/api";
2
- import { useUrl } from "./streamplace-store";
3
- import { usePDSAgent } from "./xrpc";
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
- export function useCreateStreamRecord() {
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
- export function useUpdateStreamRecord() {
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
- import { useContext } from "react";
2
- import { createStore, useStore } from "zustand";
3
- import { StreamplaceContext } from "../streamplace-provider/context";
4
- export const makeStreamplaceStore = ({ url, }) => {
5
- return createStore()((set) => ({
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
- export function getStreamplaceStoreFromContext() {
22
- const context = useContext(StreamplaceContext);
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
- export function useStreamplaceStore(selector) {
29
- return useStore(getStreamplaceStoreFromContext(), selector);
34
+ function useStreamplaceStore(selector) {
35
+ return (0, zustand_1.useStore)(getStreamplaceStoreFromContext(), selector);
30
36
  }
31
- export const useUrl = () => useStreamplaceStore((x) => x.url);
32
- export const useDID = () => useStreamplaceStore((x) => x.oauthSession?.did);
33
- export const useHandle = () => useStreamplaceStore((x) => x.handle);
34
- export const useSetHandle = () => {
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
- import { PlaceStreamChatProfile } from "streamplace";
2
- import { getStreamplaceStoreFromContext, useDID, useStreamplaceStore, } from "./streamplace-store";
3
- import { usePDSAgent } from "./xrpc";
4
- export function useGetChatProfile() {
5
- const did = useDID();
6
- const pdsAgent = usePDSAgent();
7
- const store = getStreamplaceStoreFromContext();
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
- export function useGetBskyProfile() {
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
- export function useChatProfile() {
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
- import { useMemo } from "react";
2
- import { StreamplaceAgent } from "streamplace";
3
- import { useStreamplaceStore } from ".";
4
- export function usePDSAgent() {
5
- const oauthSession = useStreamplaceStore((state) => state.oauthSession);
6
- return useMemo(() => {
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
  }
package/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "@streamplace/components",
3
- "version": "0.7.1",
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": "./dist/index.d.mjs",
12
- "default": "./dist/index.mjs"
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.1",
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": "e092ac26f32426cfb14ec3cbda96265ad2fbae12"
53
+ "gitHead": "b07a68160ae6da34cf47aa397b4ef452248d79e5"
55
54
  }
package/tsconfig.json CHANGED
@@ -3,7 +3,8 @@
3
3
  "compilerOptions": {
4
4
  "rootDir": "./src",
5
5
  "outDir": "./dist",
6
- "jsx": "react-jsx"
6
+ "jsx": "react-jsx",
7
+ "module": "commonjs"
7
8
  },
8
9
  "include": ["./src"]
9
10
  }