@streamplace/components 0.7.0 → 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 (97) 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 -5
  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 +23 -0
  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 +108 -84
  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 +54 -43
  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 -8
  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 +17 -0
  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 +6 -7
  87. package/src/components/mobile-player/ui/index.ts +1 -0
  88. package/src/components/mobile-player/ui/viewer-context-menu.tsx +5 -4
  89. package/src/components/mobile-player/ui/viewers.tsx +32 -0
  90. package/src/components/mobile-player/video.native.tsx +50 -5
  91. package/src/components/ui/resizeable.tsx +15 -3
  92. package/src/hooks/index.ts +1 -0
  93. package/src/hooks/useSegmentDimensions.tsx +18 -0
  94. package/tsconfig.json +2 -1
  95. package/tsconfig.tsbuildinfo +1 -1
  96. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
  97. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/56540125 +0 -0
@@ -1,7 +1,10 @@
1
- import { usePlayerStore } from "../player-store";
2
- export function useCameraToggle() {
3
- const ingestCamera = usePlayerStore((x) => x.ingestCamera);
4
- const setIngestCamera = usePlayerStore((x) => x.setIngestCamera);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCameraToggle = useCameraToggle;
4
+ const player_store_1 = require("../player-store");
5
+ function useCameraToggle() {
6
+ const ingestCamera = (0, player_store_1.usePlayerStore)((x) => x.ingestCamera);
7
+ const setIngestCamera = (0, player_store_1.usePlayerStore)((x) => x.setIngestCamera);
5
8
  const doSetIngestCamera = () => {
6
9
  setIngestCamera(ingestCamera === "user" ? "environment" : "user");
7
10
  };
@@ -1,25 +1,28 @@
1
- import { useEffect, useState } from "react";
2
- import { Keyboard } from "react-native";
3
- export function useKeyboard() {
4
- const [isKeyboardVisible, setIsKeyboardVisible] = useState(false);
5
- const [keyboardHeight, setKeyboardHeight] = useState(0);
6
- useEffect(() => {
7
- const willShowSubscription = Keyboard.addListener("keyboardWillShow", (e) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useKeyboard = useKeyboard;
4
+ const react_1 = require("react");
5
+ const react_native_1 = require("react-native");
6
+ function useKeyboard() {
7
+ const [isKeyboardVisible, setIsKeyboardVisible] = (0, react_1.useState)(false);
8
+ const [keyboardHeight, setKeyboardHeight] = (0, react_1.useState)(0);
9
+ (0, react_1.useEffect)(() => {
10
+ const willShowSubscription = react_native_1.Keyboard.addListener("keyboardWillShow", (e) => {
8
11
  // setIsKeyboardVisible(true);
9
12
  setKeyboardHeight(e.endCoordinates.height);
10
13
  console.log("keyboardWillShow", e.endCoordinates.height);
11
14
  });
12
- const willHideSubscription = Keyboard.addListener("keyboardWillHide", (e) => {
15
+ const willHideSubscription = react_native_1.Keyboard.addListener("keyboardWillHide", (e) => {
13
16
  // setIsKeyboardVisible(false);
14
17
  setKeyboardHeight(0);
15
18
  console.log("keyboardWillHide", e.endCoordinates.height);
16
19
  });
17
- const showSubscription = Keyboard.addListener("keyboardDidShow", (e) => {
20
+ const showSubscription = react_native_1.Keyboard.addListener("keyboardDidShow", (e) => {
18
21
  setIsKeyboardVisible(true);
19
22
  setKeyboardHeight(e.endCoordinates.height);
20
23
  console.log("keyboardDidShow", e.endCoordinates.height);
21
24
  });
22
- const hideSubscription = Keyboard.addListener("keyboardDidHide", () => {
25
+ const hideSubscription = react_native_1.Keyboard.addListener("keyboardDidHide", () => {
23
26
  setIsKeyboardVisible(false);
24
27
  setKeyboardHeight(0);
25
28
  });
@@ -1,8 +1,11 @@
1
- import { useKeyboard } from "../hooks/useKeyboard";
2
- import { useOuterAndInnerDimensions } from "../hooks/useOuterAndInnerDimensions";
3
- export function useKeyboardSlide() {
4
- const { keyboardHeight } = useKeyboard();
5
- const { outerHeight, innerHeight } = useOuterAndInnerDimensions();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useKeyboardSlide = useKeyboardSlide;
4
+ const useKeyboard_1 = require("../hooks/useKeyboard");
5
+ const useOuterAndInnerDimensions_1 = require("../hooks/useOuterAndInnerDimensions");
6
+ function useKeyboardSlide() {
7
+ const { keyboardHeight } = (0, useKeyboard_1.useKeyboard)();
8
+ const { outerHeight, innerHeight } = (0, useOuterAndInnerDimensions_1.useOuterAndInnerDimensions)();
6
9
  let slideKeyboard = 0;
7
10
  if (keyboardHeight > 0) {
8
11
  slideKeyboard = -keyboardHeight + (outerHeight - innerHeight);
@@ -1,17 +1,20 @@
1
- import { useState } from "react";
2
- import { useLivestreamStore } from "../livestream-store";
3
- import { usePlayerStore } from "../player-store";
4
- import { useCreateStreamRecord } from "../streamplace-store";
5
- export function useLivestreamInfo() {
6
- const ingest = usePlayerStore((x) => x.ingestConnectionState);
7
- const profile = useLivestreamStore((x) => x.profile);
8
- const ingestStarting = usePlayerStore((x) => x.ingestStarting);
9
- const setIngestStarting = usePlayerStore((x) => x.setIngestStarting);
10
- const setIngestLive = usePlayerStore((x) => x.setIngestLive);
11
- const createStreamRecord = useCreateStreamRecord();
12
- const [title, setTitle] = useState("");
13
- const [showCountdown, setShowCountdown] = useState(false);
14
- const [recordSubmitted, setRecordSubmitted] = useState(false);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLivestreamInfo = useLivestreamInfo;
4
+ const react_1 = require("react");
5
+ const livestream_store_1 = require("../livestream-store");
6
+ const player_store_1 = require("../player-store");
7
+ const streamplace_store_1 = require("../streamplace-store");
8
+ function useLivestreamInfo() {
9
+ const ingest = (0, player_store_1.usePlayerStore)((x) => x.ingestConnectionState);
10
+ const profile = (0, livestream_store_1.useLivestreamStore)((x) => x.profile);
11
+ const ingestStarting = (0, player_store_1.usePlayerStore)((x) => x.ingestStarting);
12
+ const setIngestStarting = (0, player_store_1.usePlayerStore)((x) => x.setIngestStarting);
13
+ const setIngestLive = (0, player_store_1.usePlayerStore)((x) => x.setIngestLive);
14
+ const createStreamRecord = (0, streamplace_store_1.useCreateStreamRecord)();
15
+ const [title, setTitle] = (0, react_1.useState)("");
16
+ const [showCountdown, setShowCountdown] = (0, react_1.useState)(false);
17
+ const [recordSubmitted, setRecordSubmitted] = (0, react_1.useState)(false);
15
18
  const handleSubmit = async () => {
16
19
  try {
17
20
  if (title !== "") {
@@ -1,18 +1,21 @@
1
- import { useCallback, useState } from "react";
2
- export function useOuterAndInnerDimensions() {
3
- const [outerDimensions, setOuterDimensions] = useState({
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useOuterAndInnerDimensions = useOuterAndInnerDimensions;
4
+ const react_1 = require("react");
5
+ function useOuterAndInnerDimensions() {
6
+ const [outerDimensions, setOuterDimensions] = (0, react_1.useState)({
4
7
  width: 0,
5
8
  height: 0,
6
9
  });
7
- const [innerDimensions, setInnerDimensions] = useState({
10
+ const [innerDimensions, setInnerDimensions] = (0, react_1.useState)({
8
11
  width: 0,
9
12
  height: 0,
10
13
  });
11
- const onOuterLayout = useCallback((event) => {
14
+ const onOuterLayout = (0, react_1.useCallback)((event) => {
12
15
  const { width, height } = event.nativeEvent.layout;
13
16
  setOuterDimensions({ width, height });
14
17
  }, []);
15
- const onInnerLayout = useCallback((event) => {
18
+ const onInnerLayout = (0, react_1.useCallback)((event) => {
16
19
  const { width, height } = event.nativeEvent.layout;
17
20
  setInnerDimensions({ width, height });
18
21
  }, []);
@@ -1,13 +1,16 @@
1
- import { Dimensions } from "react-native";
2
- import { usePlayerStore } from "../player-store";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePlayerDimensions = usePlayerDimensions;
4
+ const react_native_1 = require("react-native");
5
+ const player_store_1 = require("../player-store");
3
6
  /**
4
7
  * usePlayerDimensions
5
8
  * Returns player and device dimensions, and whether the player aspect ratio is greater than the device's.
6
9
  */
7
- export function usePlayerDimensions() {
8
- const { width, height } = Dimensions.get("window");
9
- const pHeight = Number(usePlayerStore((x) => x.playerHeight)) || 0;
10
- const pWidth = Number(usePlayerStore((x) => x.playerWidth)) || 0;
10
+ function usePlayerDimensions() {
11
+ const { width, height } = react_native_1.Dimensions.get("window");
12
+ const pHeight = Number((0, player_store_1.usePlayerStore)((x) => x.playerHeight)) || 0;
13
+ const pWidth = Number((0, player_store_1.usePlayerStore)((x) => x.playerWidth)) || 0;
11
14
  const isPlayerRatioGreater = pHeight > 0 && pWidth > 0 ? pWidth / pHeight > width / height : false;
12
15
  return {
13
16
  width,
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSegmentDimensions = useSegmentDimensions;
4
+ const livestream_store_1 = require("../livestream-store");
5
+ function useSegmentDimensions() {
6
+ const latestSegment = (0, livestream_store_1.useLivestreamStore)((x) => x.segment);
7
+ let seg = latestSegment?.video && latestSegment.video[0];
8
+ let ratio = {
9
+ height: seg?.height || 0,
10
+ width: seg?.width || 0,
11
+ };
12
+ return {
13
+ isPlayerRatioGreater: ratio.width > ratio.height,
14
+ height: ratio.height,
15
+ width: ratio.width,
16
+ };
17
+ }
@@ -1,5 +1,8 @@
1
- import { useEffect, useRef, useState } from "react";
2
- import { useLivestreamStore } from "../livestream-store";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSegmentTiming = useSegmentTiming;
4
+ const react_1 = require("react");
5
+ const livestream_store_1 = require("../livestream-store");
3
6
  function getLiveConnectionQuality(timeBetweenSegments, range, numOfSegments = 1) {
4
7
  if (timeBetweenSegments === null || range === null)
5
8
  return "poor";
@@ -11,20 +14,20 @@ function getLiveConnectionQuality(timeBetweenSegments, range, numOfSegments = 1)
11
14
  }
12
15
  return "poor";
13
16
  }
14
- export function useSegmentTiming() {
15
- const latestSegment = useLivestreamStore((x) => x.segment);
16
- const [segmentDeltas, setSegmentDeltas] = useState([]);
17
- const prevSegmentRef = useRef();
18
- const prevTimestampRef = useRef(null);
17
+ function useSegmentTiming() {
18
+ const latestSegment = (0, livestream_store_1.useLivestreamStore)((x) => x.segment);
19
+ const [segmentDeltas, setSegmentDeltas] = (0, react_1.useState)([]);
20
+ const prevSegmentRef = (0, react_1.useRef)();
21
+ const prevTimestampRef = (0, react_1.useRef)(null);
19
22
  // Dummy state to force update every second
20
- const [, setNow] = useState(Date.now());
21
- useEffect(() => {
23
+ const [, setNow] = (0, react_1.useState)(Date.now());
24
+ (0, react_1.useEffect)(() => {
22
25
  const interval = setInterval(() => {
23
26
  setNow(Date.now());
24
27
  }, 1000);
25
28
  return () => clearInterval(interval);
26
29
  }, []);
27
- useEffect(() => {
30
+ (0, react_1.useEffect)(() => {
28
31
  if (latestSegment && prevSegmentRef.current !== latestSegment) {
29
32
  const now = Date.now();
30
33
  if (prevTimestampRef.current !== null) {
package/dist/index.js CHANGED
@@ -1,16 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.atoms = exports.theme = exports.ui = exports.PlayerUI = exports.Player = exports.usePlayerContext = exports.withPlayerProvider = exports.PlayerProvider = void 0;
4
+ const tslib_1 = require("tslib");
1
5
  // barrel file :)
2
- export * from "./livestream-provider";
3
- export * from "./livestream-store";
4
- export * from "./player-store";
5
- export * from "./streamplace-provider";
6
- export * from "./streamplace-store";
7
- export { PlayerProvider, withPlayerProvider, } from "./player-store/player-provider";
8
- export { usePlayerContext } from "./player-store/player-store";
9
- export { Player, PlayerUI } from "./components/mobile-player/player";
10
- export * as ui from "./components/ui";
11
- export * from "./components/ui";
12
- export * as theme from "./lib/theme";
13
- export * as atoms from "./lib/theme/atoms";
14
- export * from "./hooks";
15
- export * from "./components/chat/chat";
16
- export * from "./components/chat/chat-box";
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.theme = tslib_1.__importStar(require("./lib/theme"));
22
+ exports.atoms = tslib_1.__importStar(require("./lib/theme/atoms"));
23
+ tslib_1.__exportStar(require("./hooks"), exports);
24
+ tslib_1.__exportStar(require("./components/chat/chat"), exports);
25
+ tslib_1.__exportStar(require("./components/chat/chat-box"), exports);
package/dist/lib/facet.js CHANGED
@@ -1,7 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.segmentize = void 0;
1
4
  const segment = (text, features) => {
2
5
  return { text, features: text.length > 0 ? features : undefined };
3
6
  };
4
- export const segmentize = (text, facets) => {
7
+ const segmentize = (text, facets) => {
5
8
  if (facets === undefined || facets.length === 0) {
6
9
  return [segment(text, undefined)];
7
10
  }
@@ -86,3 +89,4 @@ export const segmentize = (text, facets) => {
86
89
  }
87
90
  return segments;
88
91
  };
92
+ exports.segmentize = segmentize;