@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
package/dist/lib/theme/theme.js
CHANGED
|
@@ -1,51 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createThemeStyles = exports.createThemeIcons = exports.createThemeColors = exports.darkTheme = exports.lightTheme = void 0;
|
|
4
|
+
exports.ThemeProvider = ThemeProvider;
|
|
5
|
+
exports.useTheme = useTheme;
|
|
6
|
+
exports.usePlatformTypography = usePlatformTypography;
|
|
7
|
+
exports.createThemedStyles = createThemedStyles;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const portal_1 = require("@rn-primitives/portal");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const react_native_1 = require("react-native");
|
|
12
|
+
const tokens_1 = require("./tokens");
|
|
13
|
+
const react_native_gesture_handler_1 = require("react-native-gesture-handler");
|
|
7
14
|
// Create theme colors based on dark mode
|
|
8
15
|
const createThemeColors = (isDark) => ({
|
|
9
|
-
background: isDark ? colors.gray[950] : colors.white,
|
|
10
|
-
foreground: isDark ? colors.gray[50] : colors.gray[950],
|
|
11
|
-
card: isDark ? colors.gray[900] : colors.white,
|
|
12
|
-
cardForeground: isDark ? colors.gray[50] : colors.gray[950],
|
|
13
|
-
popover: isDark ? colors.gray[900] : colors.white,
|
|
14
|
-
popoverForeground: isDark ? colors.gray[50] : colors.gray[950],
|
|
15
|
-
primary: Platform.OS === "ios" ? colors.ios.systemBlue : colors.primary[500],
|
|
16
|
-
primaryForeground: colors.white,
|
|
17
|
-
secondary: isDark ? colors.gray[800] : colors.gray[100],
|
|
18
|
-
secondaryForeground: isDark ? colors.gray[50] : colors.gray[900],
|
|
19
|
-
muted: isDark ? colors.gray[800] : colors.gray[100],
|
|
20
|
-
mutedForeground: isDark ? colors.gray[400] : colors.gray[500],
|
|
21
|
-
accent: isDark ? colors.gray[800] : colors.gray[100],
|
|
22
|
-
accentForeground: isDark ? colors.gray[50] : colors.gray[900],
|
|
23
|
-
destructive: Platform.OS === "ios" ? colors.ios.systemRed : colors.destructive[500],
|
|
24
|
-
destructiveForeground: colors.white,
|
|
25
|
-
success: Platform.OS === "ios" ? colors.ios.systemGreen : colors.success[500],
|
|
26
|
-
successForeground: colors.white,
|
|
27
|
-
warning: Platform.OS === "ios" ? colors.ios.systemOrange : colors.warning[500],
|
|
28
|
-
warningForeground: colors.white,
|
|
29
|
-
border: isDark ? colors.gray[500] + "30" : colors.gray[200] + "30",
|
|
30
|
-
input: isDark ? colors.gray[800] : colors.gray[200],
|
|
31
|
-
ring: Platform.OS === "ios" ? colors.ios.systemBlue : colors.primary[500],
|
|
32
|
-
text: isDark ? colors.gray[50] : colors.gray[950],
|
|
33
|
-
textMuted: isDark ? colors.gray[400] : colors.gray[500],
|
|
34
|
-
textDisabled: isDark ? colors.gray[600] : colors.gray[400],
|
|
16
|
+
background: isDark ? tokens_1.colors.gray[950] : tokens_1.colors.white,
|
|
17
|
+
foreground: isDark ? tokens_1.colors.gray[50] : tokens_1.colors.gray[950],
|
|
18
|
+
card: isDark ? tokens_1.colors.gray[900] : tokens_1.colors.white,
|
|
19
|
+
cardForeground: isDark ? tokens_1.colors.gray[50] : tokens_1.colors.gray[950],
|
|
20
|
+
popover: isDark ? tokens_1.colors.gray[900] : tokens_1.colors.white,
|
|
21
|
+
popoverForeground: isDark ? tokens_1.colors.gray[50] : tokens_1.colors.gray[950],
|
|
22
|
+
primary: react_native_1.Platform.OS === "ios" ? tokens_1.colors.ios.systemBlue : tokens_1.colors.primary[500],
|
|
23
|
+
primaryForeground: tokens_1.colors.white,
|
|
24
|
+
secondary: isDark ? tokens_1.colors.gray[800] : tokens_1.colors.gray[100],
|
|
25
|
+
secondaryForeground: isDark ? tokens_1.colors.gray[50] : tokens_1.colors.gray[900],
|
|
26
|
+
muted: isDark ? tokens_1.colors.gray[800] : tokens_1.colors.gray[100],
|
|
27
|
+
mutedForeground: isDark ? tokens_1.colors.gray[400] : tokens_1.colors.gray[500],
|
|
28
|
+
accent: isDark ? tokens_1.colors.gray[800] : tokens_1.colors.gray[100],
|
|
29
|
+
accentForeground: isDark ? tokens_1.colors.gray[50] : tokens_1.colors.gray[900],
|
|
30
|
+
destructive: react_native_1.Platform.OS === "ios" ? tokens_1.colors.ios.systemRed : tokens_1.colors.destructive[500],
|
|
31
|
+
destructiveForeground: tokens_1.colors.white,
|
|
32
|
+
success: react_native_1.Platform.OS === "ios" ? tokens_1.colors.ios.systemGreen : tokens_1.colors.success[500],
|
|
33
|
+
successForeground: tokens_1.colors.white,
|
|
34
|
+
warning: react_native_1.Platform.OS === "ios" ? tokens_1.colors.ios.systemOrange : tokens_1.colors.warning[500],
|
|
35
|
+
warningForeground: tokens_1.colors.white,
|
|
36
|
+
border: isDark ? tokens_1.colors.gray[500] + "30" : tokens_1.colors.gray[200] + "30",
|
|
37
|
+
input: isDark ? tokens_1.colors.gray[800] : tokens_1.colors.gray[200],
|
|
38
|
+
ring: react_native_1.Platform.OS === "ios" ? tokens_1.colors.ios.systemBlue : tokens_1.colors.primary[500],
|
|
39
|
+
text: isDark ? tokens_1.colors.gray[50] : tokens_1.colors.gray[950],
|
|
40
|
+
textMuted: isDark ? tokens_1.colors.gray[400] : tokens_1.colors.gray[500],
|
|
41
|
+
textDisabled: isDark ? tokens_1.colors.gray[600] : tokens_1.colors.gray[400],
|
|
35
42
|
});
|
|
43
|
+
exports.createThemeColors = createThemeColors;
|
|
36
44
|
// Create theme styles based on colors
|
|
37
45
|
const createThemeStyles = (themeColors) => ({
|
|
38
46
|
shadow: {
|
|
39
|
-
sm: shadows.sm,
|
|
40
|
-
md: shadows.md,
|
|
41
|
-
lg: shadows.lg,
|
|
42
|
-
xl: shadows.xl,
|
|
47
|
+
sm: tokens_1.shadows.sm,
|
|
48
|
+
md: tokens_1.shadows.md,
|
|
49
|
+
lg: tokens_1.shadows.lg,
|
|
50
|
+
xl: tokens_1.shadows.xl,
|
|
43
51
|
},
|
|
44
52
|
button: {
|
|
45
53
|
primary: {
|
|
46
54
|
backgroundColor: themeColors.primary,
|
|
47
55
|
borderWidth: 0,
|
|
48
|
-
...shadows.sm,
|
|
56
|
+
...tokens_1.shadows.sm,
|
|
49
57
|
},
|
|
50
58
|
secondary: {
|
|
51
59
|
backgroundColor: themeColors.secondary,
|
|
@@ -77,10 +85,10 @@ const createThemeStyles = (themeColors) => ({
|
|
|
77
85
|
backgroundColor: themeColors.background,
|
|
78
86
|
borderWidth: 1,
|
|
79
87
|
borderColor: themeColors.border,
|
|
80
|
-
borderRadius: borderRadius.md,
|
|
81
|
-
paddingHorizontal: spacing[3],
|
|
82
|
-
paddingVertical: spacing[3],
|
|
83
|
-
minHeight: touchTargets.minimum,
|
|
88
|
+
borderRadius: tokens_1.borderRadius.md,
|
|
89
|
+
paddingHorizontal: tokens_1.spacing[3],
|
|
90
|
+
paddingVertical: tokens_1.spacing[3],
|
|
91
|
+
minHeight: tokens_1.touchTargets.minimum,
|
|
84
92
|
},
|
|
85
93
|
focused: {
|
|
86
94
|
borderColor: themeColors.ring,
|
|
@@ -94,11 +102,12 @@ const createThemeStyles = (themeColors) => ({
|
|
|
94
102
|
card: {
|
|
95
103
|
base: {
|
|
96
104
|
backgroundColor: themeColors.card,
|
|
97
|
-
borderRadius: borderRadius.lg,
|
|
98
|
-
...shadows.sm,
|
|
105
|
+
borderRadius: tokens_1.borderRadius.lg,
|
|
106
|
+
...tokens_1.shadows.sm,
|
|
99
107
|
},
|
|
100
108
|
},
|
|
101
109
|
});
|
|
110
|
+
exports.createThemeStyles = createThemeStyles;
|
|
102
111
|
// Create theme icons based on colors
|
|
103
112
|
const createThemeIcons = (themeColors) => ({
|
|
104
113
|
color: {
|
|
@@ -117,14 +126,15 @@ const createThemeIcons = (themeColors) => ({
|
|
|
117
126
|
xl: 32,
|
|
118
127
|
},
|
|
119
128
|
});
|
|
129
|
+
exports.createThemeIcons = createThemeIcons;
|
|
120
130
|
// Create the theme context
|
|
121
|
-
const ThemeContext = createContext(null);
|
|
131
|
+
const ThemeContext = (0, react_1.createContext)(null);
|
|
122
132
|
// Theme provider component
|
|
123
|
-
|
|
124
|
-
const systemColorScheme = useColorScheme();
|
|
125
|
-
const [currentTheme, setCurrentTheme] = useState(defaultTheme);
|
|
133
|
+
function ThemeProvider({ children, defaultTheme = "system", forcedTheme, }) {
|
|
134
|
+
const systemColorScheme = (0, react_native_1.useColorScheme)();
|
|
135
|
+
const [currentTheme, setCurrentTheme] = (0, react_1.useState)(defaultTheme);
|
|
126
136
|
// Determine if dark mode should be active
|
|
127
|
-
const isDark = useMemo(() => {
|
|
137
|
+
const isDark = (0, react_1.useMemo)(() => {
|
|
128
138
|
if (forcedTheme === "light")
|
|
129
139
|
return false;
|
|
130
140
|
if (forcedTheme === "dark")
|
|
@@ -138,24 +148,24 @@ export function ThemeProvider({ children, defaultTheme = "system", forcedTheme,
|
|
|
138
148
|
return systemColorScheme === "dark";
|
|
139
149
|
}, [forcedTheme, currentTheme, systemColorScheme]);
|
|
140
150
|
// Create theme based on dark mode
|
|
141
|
-
const theme = useMemo(() => {
|
|
151
|
+
const theme = (0, react_1.useMemo)(() => {
|
|
142
152
|
const themeColors = createThemeColors(isDark);
|
|
143
153
|
return {
|
|
144
154
|
colors: themeColors,
|
|
145
|
-
spacing,
|
|
146
|
-
borderRadius,
|
|
147
|
-
typography,
|
|
148
|
-
shadows,
|
|
149
|
-
touchTargets,
|
|
150
|
-
animations,
|
|
155
|
+
spacing: tokens_1.spacing,
|
|
156
|
+
borderRadius: tokens_1.borderRadius,
|
|
157
|
+
typography: tokens_1.typography,
|
|
158
|
+
shadows: tokens_1.shadows,
|
|
159
|
+
touchTargets: tokens_1.touchTargets,
|
|
160
|
+
animations: tokens_1.animations,
|
|
151
161
|
};
|
|
152
162
|
}, [isDark]);
|
|
153
163
|
// Create utility styles
|
|
154
|
-
const styles = useMemo(() => {
|
|
164
|
+
const styles = (0, react_1.useMemo)(() => {
|
|
155
165
|
return createThemeStyles(theme.colors);
|
|
156
166
|
}, [theme.colors]);
|
|
157
167
|
// Create icon utilities
|
|
158
|
-
const icons = useMemo(() => {
|
|
168
|
+
const icons = (0, react_1.useMemo)(() => {
|
|
159
169
|
return createThemeIcons(theme.colors);
|
|
160
170
|
}, [theme.colors]);
|
|
161
171
|
// Theme controls
|
|
@@ -175,7 +185,7 @@ export function ThemeProvider({ children, defaultTheme = "system", forcedTheme,
|
|
|
175
185
|
});
|
|
176
186
|
}
|
|
177
187
|
};
|
|
178
|
-
const value = useMemo(() => ({
|
|
188
|
+
const value = (0, react_1.useMemo)(() => ({
|
|
179
189
|
theme,
|
|
180
190
|
styles,
|
|
181
191
|
icons,
|
|
@@ -195,54 +205,52 @@ export function ThemeProvider({ children, defaultTheme = "system", forcedTheme,
|
|
|
195
205
|
setTheme,
|
|
196
206
|
toggleTheme,
|
|
197
207
|
]);
|
|
198
|
-
return (
|
|
208
|
+
return ((0, jsx_runtime_1.jsx)(ThemeContext.Provider, { value: value, children: (0, jsx_runtime_1.jsxs)(react_native_gesture_handler_1.GestureHandlerRootView, { children: [children, (0, jsx_runtime_1.jsx)(portal_1.PortalHost, {})] }) }));
|
|
199
209
|
}
|
|
200
210
|
// Hook to use theme
|
|
201
|
-
|
|
202
|
-
const context = useContext(ThemeContext);
|
|
211
|
+
function useTheme() {
|
|
212
|
+
const context = (0, react_1.useContext)(ThemeContext);
|
|
203
213
|
if (!context) {
|
|
204
214
|
throw new Error("useTheme must be used within a ThemeProvider");
|
|
205
215
|
}
|
|
206
216
|
return context;
|
|
207
217
|
}
|
|
208
218
|
// Hook to get current platform's typography
|
|
209
|
-
|
|
219
|
+
function usePlatformTypography() {
|
|
210
220
|
const { theme } = useTheme();
|
|
211
|
-
return useMemo(() => {
|
|
212
|
-
if (Platform.OS === "ios") {
|
|
221
|
+
return (0, react_1.useMemo)(() => {
|
|
222
|
+
if (react_native_1.Platform.OS === "ios") {
|
|
213
223
|
return theme.typography.ios;
|
|
214
224
|
}
|
|
215
|
-
else if (Platform.OS === "android") {
|
|
225
|
+
else if (react_native_1.Platform.OS === "android") {
|
|
216
226
|
return theme.typography.android;
|
|
217
227
|
}
|
|
218
228
|
return theme.typography.universal;
|
|
219
229
|
}, [theme.typography]);
|
|
220
230
|
}
|
|
221
231
|
// Utility function to create theme-aware styles
|
|
222
|
-
|
|
232
|
+
function createThemedStyles(styleCreator) {
|
|
223
233
|
return function useThemedStyles() {
|
|
224
234
|
const { theme, styles, icons } = useTheme();
|
|
225
|
-
return useMemo(() => styleCreator(theme, styles, icons), [theme, styles, icons]);
|
|
235
|
+
return (0, react_1.useMemo)(() => styleCreator(theme, styles, icons), [theme, styles, icons]);
|
|
226
236
|
};
|
|
227
237
|
}
|
|
228
238
|
// Create light and dark theme instances for external use
|
|
229
|
-
|
|
239
|
+
exports.lightTheme = {
|
|
230
240
|
colors: createThemeColors(false),
|
|
231
|
-
spacing,
|
|
232
|
-
borderRadius,
|
|
233
|
-
typography,
|
|
234
|
-
shadows,
|
|
235
|
-
touchTargets,
|
|
236
|
-
animations,
|
|
241
|
+
spacing: tokens_1.spacing,
|
|
242
|
+
borderRadius: tokens_1.borderRadius,
|
|
243
|
+
typography: tokens_1.typography,
|
|
244
|
+
shadows: tokens_1.shadows,
|
|
245
|
+
touchTargets: tokens_1.touchTargets,
|
|
246
|
+
animations: tokens_1.animations,
|
|
237
247
|
};
|
|
238
|
-
|
|
248
|
+
exports.darkTheme = {
|
|
239
249
|
colors: createThemeColors(true),
|
|
240
|
-
spacing,
|
|
241
|
-
borderRadius,
|
|
242
|
-
typography,
|
|
243
|
-
shadows,
|
|
244
|
-
touchTargets,
|
|
245
|
-
animations,
|
|
250
|
+
spacing: tokens_1.spacing,
|
|
251
|
+
borderRadius: tokens_1.borderRadius,
|
|
252
|
+
typography: tokens_1.typography,
|
|
253
|
+
shadows: tokens_1.shadows,
|
|
254
|
+
touchTargets: tokens_1.touchTargets,
|
|
255
|
+
animations: tokens_1.animations,
|
|
246
256
|
};
|
|
247
|
-
// Export individual theme utilities for convenience
|
|
248
|
-
export { createThemeColors, createThemeIcons, createThemeStyles };
|
package/dist/lib/theme/tokens.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* Design tokens for React Native components
|
|
3
4
|
* Inspired by shadcn/ui but adapted for React Native styling
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.breakpoints = exports.animations = exports.touchTargets = exports.shadows = exports.typography = exports.borderRadius = exports.spacing = exports.colors = void 0;
|
|
8
|
+
exports.colors = {
|
|
6
9
|
// Primary colors
|
|
7
10
|
primary: {
|
|
8
11
|
50: "#eff6ff",
|
|
@@ -109,7 +112,7 @@ export const colors = {
|
|
|
109
112
|
black: "#000000",
|
|
110
113
|
white: "#FFFFFF",
|
|
111
114
|
};
|
|
112
|
-
|
|
115
|
+
exports.spacing = {
|
|
113
116
|
0: 0,
|
|
114
117
|
1: 4,
|
|
115
118
|
2: 8,
|
|
@@ -142,7 +145,7 @@ export const spacing = {
|
|
|
142
145
|
96: 384,
|
|
143
146
|
auto: "auto",
|
|
144
147
|
};
|
|
145
|
-
|
|
148
|
+
exports.borderRadius = {
|
|
146
149
|
none: 0,
|
|
147
150
|
sm: 4,
|
|
148
151
|
md: 8,
|
|
@@ -152,7 +155,7 @@ export const borderRadius = {
|
|
|
152
155
|
"3xl": 24,
|
|
153
156
|
full: 999,
|
|
154
157
|
};
|
|
155
|
-
|
|
158
|
+
exports.typography = {
|
|
156
159
|
// iOS system font sizes
|
|
157
160
|
ios: {
|
|
158
161
|
largeTitle: {
|
|
@@ -323,7 +326,7 @@ export const typography = {
|
|
|
323
326
|
},
|
|
324
327
|
},
|
|
325
328
|
};
|
|
326
|
-
|
|
329
|
+
exports.shadows = {
|
|
327
330
|
none: {
|
|
328
331
|
shadowColor: "transparent",
|
|
329
332
|
shadowOffset: { width: 0, height: 0 },
|
|
@@ -332,28 +335,28 @@ export const shadows = {
|
|
|
332
335
|
elevation: 0,
|
|
333
336
|
},
|
|
334
337
|
sm: {
|
|
335
|
-
shadowColor: colors.black,
|
|
338
|
+
shadowColor: exports.colors.black,
|
|
336
339
|
shadowOffset: { width: 0, height: 1 },
|
|
337
340
|
shadowOpacity: 0.05,
|
|
338
341
|
shadowRadius: 2,
|
|
339
342
|
elevation: 2,
|
|
340
343
|
},
|
|
341
344
|
md: {
|
|
342
|
-
shadowColor: colors.black,
|
|
345
|
+
shadowColor: exports.colors.black,
|
|
343
346
|
shadowOffset: { width: 0, height: 2 },
|
|
344
347
|
shadowOpacity: 0.1,
|
|
345
348
|
shadowRadius: 4,
|
|
346
349
|
elevation: 4,
|
|
347
350
|
},
|
|
348
351
|
lg: {
|
|
349
|
-
shadowColor: colors.black,
|
|
352
|
+
shadowColor: exports.colors.black,
|
|
350
353
|
shadowOffset: { width: 0, height: 4 },
|
|
351
354
|
shadowOpacity: 0.15,
|
|
352
355
|
shadowRadius: 8,
|
|
353
356
|
elevation: 8,
|
|
354
357
|
},
|
|
355
358
|
xl: {
|
|
356
|
-
shadowColor: colors.black,
|
|
359
|
+
shadowColor: exports.colors.black,
|
|
357
360
|
shadowOffset: { width: 0, height: 8 },
|
|
358
361
|
shadowOpacity: 0.2,
|
|
359
362
|
shadowRadius: 16,
|
|
@@ -361,20 +364,20 @@ export const shadows = {
|
|
|
361
364
|
},
|
|
362
365
|
};
|
|
363
366
|
// Touch targets (iOS Human Interface Guidelines)
|
|
364
|
-
|
|
367
|
+
exports.touchTargets = {
|
|
365
368
|
minimum: 44, // Minimum touch target size
|
|
366
369
|
comfortable: 48, // Comfortable touch target size
|
|
367
370
|
large: 56, // Large touch target size
|
|
368
371
|
};
|
|
369
372
|
// Animation durations
|
|
370
|
-
|
|
373
|
+
exports.animations = {
|
|
371
374
|
fast: 150,
|
|
372
375
|
normal: 200,
|
|
373
376
|
slow: 300,
|
|
374
377
|
slower: 500,
|
|
375
378
|
};
|
|
376
379
|
// Breakpoints for responsive design
|
|
377
|
-
|
|
380
|
+
exports.breakpoints = {
|
|
378
381
|
sm: 640,
|
|
379
382
|
md: 768,
|
|
380
383
|
lg: 1024,
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeStyles = mergeStyles;
|
|
4
|
+
exports.createStyleMerger = createStyleMerger;
|
|
5
|
+
exports.conditionalStyle = conditionalStyle;
|
|
6
|
+
exports.responsiveValue = responsiveValue;
|
|
7
|
+
exports.platformStyle = platformStyle;
|
|
8
|
+
exports.hexToRgba = hexToRgba;
|
|
9
|
+
exports.debounce = debounce;
|
|
10
|
+
exports.throttle = throttle;
|
|
11
|
+
exports.forwardProps = forwardProps;
|
|
12
|
+
const react_native_1 = require("react-native");
|
|
2
13
|
/**
|
|
3
14
|
* Merges React Native styles similar to how cn() merges CSS classes
|
|
4
15
|
* Handles arrays, objects, and falsy values
|
|
5
16
|
*/
|
|
6
|
-
|
|
17
|
+
function mergeStyles(...styles) {
|
|
7
18
|
const validStyles = styles.filter(Boolean).flat();
|
|
8
|
-
return StyleSheet.flatten(validStyles) || {};
|
|
19
|
+
return react_native_1.StyleSheet.flatten(validStyles) || {};
|
|
9
20
|
}
|
|
10
21
|
/**
|
|
11
22
|
* Creates a style merger function that includes base styles
|
|
12
23
|
* Useful for component variants
|
|
13
24
|
*/
|
|
14
|
-
|
|
25
|
+
function createStyleMerger(baseStyle) {
|
|
15
26
|
return (...styles) => {
|
|
16
27
|
return mergeStyles(baseStyle, ...styles);
|
|
17
28
|
};
|
|
@@ -19,13 +30,13 @@ export function createStyleMerger(baseStyle) {
|
|
|
19
30
|
/**
|
|
20
31
|
* Conditionally applies styles based on boolean conditions
|
|
21
32
|
*/
|
|
22
|
-
|
|
33
|
+
function conditionalStyle(condition, trueStyle, falseStyle) {
|
|
23
34
|
return condition ? trueStyle : falseStyle;
|
|
24
35
|
}
|
|
25
36
|
/**
|
|
26
37
|
* Creates responsive values based on screen dimensions
|
|
27
38
|
*/
|
|
28
|
-
|
|
39
|
+
function responsiveValue(values, screenWidth) {
|
|
29
40
|
if (screenWidth >= 1280 && values.xl !== undefined)
|
|
30
41
|
return values.xl;
|
|
31
42
|
if (screenWidth >= 1024 && values.lg !== undefined)
|
|
@@ -39,7 +50,7 @@ export function responsiveValue(values, screenWidth) {
|
|
|
39
50
|
/**
|
|
40
51
|
* Creates platform-specific styles
|
|
41
52
|
*/
|
|
42
|
-
|
|
53
|
+
function platformStyle(styles) {
|
|
43
54
|
const Platform = require("react-native").Platform;
|
|
44
55
|
if (Platform.OS === "ios" && styles.ios)
|
|
45
56
|
return styles.ios;
|
|
@@ -52,7 +63,7 @@ export function platformStyle(styles) {
|
|
|
52
63
|
/**
|
|
53
64
|
* Converts hex color to rgba
|
|
54
65
|
*/
|
|
55
|
-
|
|
66
|
+
function hexToRgba(hex, alpha = 1) {
|
|
56
67
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
57
68
|
if (!result)
|
|
58
69
|
return hex;
|
|
@@ -64,7 +75,7 @@ export function hexToRgba(hex, alpha = 1) {
|
|
|
64
75
|
/**
|
|
65
76
|
* Creates a debounced function for performance
|
|
66
77
|
*/
|
|
67
|
-
|
|
78
|
+
function debounce(func, delay) {
|
|
68
79
|
let timeoutId;
|
|
69
80
|
return (...args) => {
|
|
70
81
|
clearTimeout(timeoutId);
|
|
@@ -74,7 +85,7 @@ export function debounce(func, delay) {
|
|
|
74
85
|
/**
|
|
75
86
|
* Creates a throttled function for performance
|
|
76
87
|
*/
|
|
77
|
-
|
|
88
|
+
function throttle(func, delay) {
|
|
78
89
|
let lastCall = 0;
|
|
79
90
|
return (...args) => {
|
|
80
91
|
const now = Date.now();
|
|
@@ -87,7 +98,7 @@ export function throttle(func, delay) {
|
|
|
87
98
|
/**
|
|
88
99
|
* Type-safe component prop forwarding
|
|
89
100
|
*/
|
|
90
|
-
|
|
101
|
+
function forwardProps(props, omit) {
|
|
91
102
|
const result = { ...props };
|
|
92
103
|
omit.forEach((key) => delete result[key]);
|
|
93
104
|
return result;
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LivestreamProvider = LivestreamProvider;
|
|
4
|
+
exports.WebsocketWatcher = WebsocketWatcher;
|
|
5
|
+
exports.LivestreamPoller = LivestreamPoller;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const livestream_store_1 = require("../livestream-store");
|
|
9
|
+
const websocket_1 = require("./websocket");
|
|
10
|
+
function LivestreamProvider({ children, src, }) {
|
|
11
|
+
const context = (0, react_1.useContext)(livestream_store_1.LivestreamContext);
|
|
12
|
+
const store = (0, react_1.useRef)((0, livestream_store_1.makeLivestreamStore)()).current;
|
|
8
13
|
if (context) {
|
|
9
14
|
// this is ok, there's use cases for having one in another
|
|
10
15
|
// like having a player component that's independently usable
|
|
11
16
|
// but can also be embedded within an entire livestream page
|
|
12
|
-
return
|
|
17
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
13
18
|
}
|
|
14
19
|
window.livestreamStore = store;
|
|
15
|
-
return (
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(livestream_store_1.LivestreamContext.Provider, { value: { store: store }, children: (0, jsx_runtime_1.jsx)(LivestreamPoller, { src: src, children: children }) }));
|
|
16
21
|
}
|
|
17
|
-
|
|
18
|
-
useLivestreamWebsocket(src);
|
|
19
|
-
return
|
|
22
|
+
function WebsocketWatcher({ src }) {
|
|
23
|
+
(0, websocket_1.useLivestreamWebsocket)(src);
|
|
24
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
20
25
|
}
|
|
21
|
-
|
|
26
|
+
function LivestreamPoller({ children, src, }) {
|
|
22
27
|
// Websocket watcher is a sibling instead of a parent to avoid
|
|
23
28
|
// re-rendering when the websocket does stuff
|
|
24
|
-
return (
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(WebsocketWatcher, { src: src }), children] }));
|
|
25
30
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLivestreamWebsocket = useLivestreamWebsocket;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_use_websocket_1 = tslib_1.__importDefault(require("react-use-websocket"));
|
|
7
|
+
const livestream_store_1 = require("../livestream-store");
|
|
8
|
+
const streamplace_store_1 = require("../streamplace-store");
|
|
9
|
+
function useLivestreamWebsocket(src) {
|
|
10
|
+
const url = (0, streamplace_store_1.useUrl)();
|
|
11
|
+
const handleWebSocketMessages = (0, livestream_store_1.useHandleWebsocketMessages)();
|
|
8
12
|
let wsUrl = url.replace(/^http\:/, "ws:");
|
|
9
13
|
wsUrl = wsUrl.replace(/^https\:/, "wss:");
|
|
10
|
-
const ref = useRef([]);
|
|
11
|
-
const handle = useRef(null);
|
|
12
|
-
const { readyState } =
|
|
14
|
+
const ref = (0, react_1.useRef)([]);
|
|
15
|
+
const handle = (0, react_1.useRef)(null);
|
|
16
|
+
const { readyState } = (0, react_use_websocket_1.default)(`${wsUrl}/api/websocket/${src}`, {
|
|
13
17
|
reconnectInterval: 1000,
|
|
14
18
|
shouldReconnect: () => true,
|
|
15
19
|
onOpen: () => {
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reduceChat = exports.reduceChatIncremental = exports.useCreateChatMessage = exports.useSetReplyToMessage = exports.useReplyToMessage = void 0;
|
|
4
|
+
const api_1 = require("@atproto/api");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const streamplace_store_1 = require("../streamplace-store");
|
|
7
|
+
const xrpc_1 = require("../streamplace-store/xrpc");
|
|
8
|
+
const livestream_store_1 = require("./livestream-store");
|
|
9
|
+
const useReplyToMessage = () => (0, livestream_store_1.useLivestreamStore)((state) => state.replyToMessage);
|
|
10
|
+
exports.useReplyToMessage = useReplyToMessage;
|
|
11
|
+
const useSetReplyToMessage = () => {
|
|
12
|
+
const store = (0, livestream_store_1.getStoreFromContext)();
|
|
13
|
+
return (0, react_1.useCallback)((message) => {
|
|
10
14
|
store.setState({ replyToMessage: message });
|
|
11
15
|
}, [store]);
|
|
12
16
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
exports.useSetReplyToMessage = useSetReplyToMessage;
|
|
18
|
+
const useCreateChatMessage = () => {
|
|
19
|
+
const pdsAgent = (0, xrpc_1.usePDSAgent)();
|
|
20
|
+
const store = (0, livestream_store_1.getStoreFromContext)();
|
|
21
|
+
const userDID = (0, streamplace_store_1.useDID)();
|
|
22
|
+
const userHandle = (0, streamplace_store_1.useHandle)();
|
|
23
|
+
const chatProfile = (0, streamplace_store_1.useChatProfile)();
|
|
19
24
|
return async (msg) => {
|
|
20
25
|
if (!pdsAgent || !userDID) {
|
|
21
26
|
throw new Error("No PDS agent or user DID found");
|
|
@@ -25,7 +30,7 @@ export const useCreateChatMessage = () => {
|
|
|
25
30
|
if (!streamerProfile) {
|
|
26
31
|
throw new Error("Profile not found");
|
|
27
32
|
}
|
|
28
|
-
const rt = new RichText({ text: msg.text });
|
|
33
|
+
const rt = new api_1.RichText({ text: msg.text });
|
|
29
34
|
await rt.detectFacets(pdsAgent);
|
|
30
35
|
const record = {
|
|
31
36
|
text: msg.text,
|
|
@@ -58,7 +63,7 @@ export const useCreateChatMessage = () => {
|
|
|
58
63
|
indexedAt: new Date().toISOString(),
|
|
59
64
|
chatProfile: chatProfile || undefined,
|
|
60
65
|
};
|
|
61
|
-
state = reduceChat(state, [localChat], []);
|
|
66
|
+
state = (0, exports.reduceChat)(state, [localChat], []);
|
|
62
67
|
store.setState(state);
|
|
63
68
|
await pdsAgent.com.atproto.repo.createRecord({
|
|
64
69
|
repo: userDID,
|
|
@@ -67,6 +72,7 @@ export const useCreateChatMessage = () => {
|
|
|
67
72
|
});
|
|
68
73
|
};
|
|
69
74
|
};
|
|
75
|
+
exports.useCreateChatMessage = useCreateChatMessage;
|
|
70
76
|
const buildSortedChatList = (chatIndex, existingChatList, newMessages, removedKeys) => {
|
|
71
77
|
const sortedKeys = Object.keys(chatIndex).sort((a, b) => {
|
|
72
78
|
const aTime = parseInt(a.split("-")[0], 10);
|
|
@@ -93,7 +99,7 @@ const profileIsDifferent = (newProfile, oldProfile) => {
|
|
|
93
99
|
const { red: oldRed, green: oldGreen, blue: oldBlue } = oldProfile.color;
|
|
94
100
|
return newRed !== oldRed || newGreen !== oldGreen || newBlue !== oldBlue;
|
|
95
101
|
};
|
|
96
|
-
|
|
102
|
+
const reduceChatIncremental = (state, newMessages, blocks) => {
|
|
97
103
|
if (newMessages.length === 0 && blocks.length === 0) {
|
|
98
104
|
return state;
|
|
99
105
|
}
|
|
@@ -183,4 +189,5 @@ export const reduceChatIncremental = (state, newMessages, blocks) => {
|
|
|
183
189
|
chat: newChatList,
|
|
184
190
|
};
|
|
185
191
|
};
|
|
186
|
-
|
|
192
|
+
exports.reduceChatIncremental = reduceChatIncremental;
|
|
193
|
+
exports.reduceChat = exports.reduceChatIncremental;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LivestreamContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.LivestreamContext = (0, react_1.createContext)(null);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./chat"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./context"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./livestream-store"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./stream-key"), exports);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|