@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.
- 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 -5
- 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 +23 -0
- 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 +108 -84
- 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 +54 -43
- 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 -8
- 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 +17 -0
- 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 +6 -7
- package/src/components/mobile-player/ui/index.ts +1 -0
- package/src/components/mobile-player/ui/viewer-context-menu.tsx +5 -4
- package/src/components/mobile-player/ui/viewers.tsx +32 -0
- package/src/components/mobile-player/video.native.tsx +50 -5
- package/src/components/ui/resizeable.tsx +15 -3
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useSegmentDimensions.tsx +18 -0
- 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,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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;
|