@streamplace/components 0.7.14 → 0.7.17

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 (123) hide show
  1. package/package.json +13 -15
  2. package/src/components/mobile-player/fullscreen.native.tsx +14 -3
  3. package/src/components/mobile-player/fullscreen.tsx +10 -2
  4. package/src/components/mobile-player/player.tsx +7 -1
  5. package/src/components/mobile-player/props.tsx +7 -0
  6. package/src/components/mobile-player/video-async.native.tsx +436 -0
  7. package/src/components/mobile-player/video.native.tsx +16 -406
  8. package/src/components/mobile-player/video.tsx +14 -3
  9. package/src/hooks/useLivestreamInfo.ts +6 -2
  10. package/src/lib/browser.ts +27 -0
  11. package/src/livestream-store/stream-key.tsx +1 -28
  12. package/src/streamplace-store/stream.tsx +52 -13
  13. package/dist/assets/emoji-data.json +0 -19371
  14. package/dist/components/chat/chat-box.js +0 -314
  15. package/dist/components/chat/chat-message.js +0 -87
  16. package/dist/components/chat/chat.js +0 -149
  17. package/dist/components/chat/emoji-suggestions.js +0 -35
  18. package/dist/components/chat/mention-suggestions.js +0 -42
  19. package/dist/components/chat/mod-view.js +0 -94
  20. package/dist/components/chat/system-message.js +0 -19
  21. package/dist/components/dashboard/chat-panel.js +0 -38
  22. package/dist/components/dashboard/header.js +0 -80
  23. package/dist/components/dashboard/index.js +0 -14
  24. package/dist/components/dashboard/information-widget.js +0 -234
  25. package/dist/components/dashboard/mod-actions.js +0 -71
  26. package/dist/components/dashboard/problems.js +0 -74
  27. package/dist/components/icons/bluesky-icon.js +0 -9
  28. package/dist/components/keep-awake.js +0 -7
  29. package/dist/components/keep-awake.native.js +0 -16
  30. package/dist/components/mobile-player/fullscreen.js +0 -74
  31. package/dist/components/mobile-player/fullscreen.native.js +0 -141
  32. package/dist/components/mobile-player/player.js +0 -94
  33. package/dist/components/mobile-player/props.js +0 -2
  34. package/dist/components/mobile-player/shared.js +0 -54
  35. package/dist/components/mobile-player/ui/countdown.js +0 -83
  36. package/dist/components/mobile-player/ui/index.js +0 -11
  37. package/dist/components/mobile-player/ui/input.js +0 -42
  38. package/dist/components/mobile-player/ui/metrics.js +0 -44
  39. package/dist/components/mobile-player/ui/report-modal.js +0 -90
  40. package/dist/components/mobile-player/ui/streamer-context-menu.js +0 -7
  41. package/dist/components/mobile-player/ui/streamer-loading-overlay.js +0 -104
  42. package/dist/components/mobile-player/ui/viewer-context-menu.js +0 -51
  43. package/dist/components/mobile-player/ui/viewer-loading-overlay.js +0 -49
  44. package/dist/components/mobile-player/ui/viewers.js +0 -23
  45. package/dist/components/mobile-player/use-webrtc.js +0 -243
  46. package/dist/components/mobile-player/video-retry.js +0 -29
  47. package/dist/components/mobile-player/video.js +0 -460
  48. package/dist/components/mobile-player/video.native.js +0 -276
  49. package/dist/components/mobile-player/webrtc-diagnostics.js +0 -110
  50. package/dist/components/mobile-player/webrtc-primitives.js +0 -27
  51. package/dist/components/mobile-player/webrtc-primitives.native.js +0 -8
  52. package/dist/components/share/sharesheet.js +0 -91
  53. package/dist/components/ui/button.js +0 -223
  54. package/dist/components/ui/dialog.js +0 -206
  55. package/dist/components/ui/dropdown.js +0 -172
  56. package/dist/components/ui/icons.js +0 -25
  57. package/dist/components/ui/index.js +0 -34
  58. package/dist/components/ui/info-box.js +0 -31
  59. package/dist/components/ui/info-row.js +0 -23
  60. package/dist/components/ui/input.js +0 -205
  61. package/dist/components/ui/loader.js +0 -10
  62. package/dist/components/ui/primitives/button.js +0 -125
  63. package/dist/components/ui/primitives/input.js +0 -206
  64. package/dist/components/ui/primitives/modal.js +0 -206
  65. package/dist/components/ui/primitives/text.js +0 -292
  66. package/dist/components/ui/resizeable.js +0 -121
  67. package/dist/components/ui/slider.js +0 -5
  68. package/dist/components/ui/text.js +0 -177
  69. package/dist/components/ui/textarea.js +0 -19
  70. package/dist/components/ui/toast.js +0 -175
  71. package/dist/components/ui/view.js +0 -252
  72. package/dist/hooks/index.js +0 -14
  73. package/dist/hooks/useAvatars.js +0 -35
  74. package/dist/hooks/useCameraToggle.js +0 -12
  75. package/dist/hooks/useKeyboard.js +0 -36
  76. package/dist/hooks/useKeyboardSlide.js +0 -14
  77. package/dist/hooks/useLivestreamInfo.js +0 -65
  78. package/dist/hooks/useOuterAndInnerDimensions.js +0 -30
  79. package/dist/hooks/usePlayerDimensions.js +0 -22
  80. package/dist/hooks/usePointerDevice.js +0 -71
  81. package/dist/hooks/useSegmentDimensions.js +0 -17
  82. package/dist/hooks/useSegmentTiming.js +0 -65
  83. package/dist/index.js +0 -34
  84. package/dist/lib/facet.js +0 -92
  85. package/dist/lib/system-messages.js +0 -101
  86. package/dist/lib/theme/atoms.js +0 -646
  87. package/dist/lib/theme/atoms.types.js +0 -6
  88. package/dist/lib/theme/index.js +0 -35
  89. package/dist/lib/theme/theme.js +0 -256
  90. package/dist/lib/theme/tokens.js +0 -659
  91. package/dist/lib/utils.js +0 -105
  92. package/dist/livestream-provider/index.js +0 -30
  93. package/dist/livestream-provider/websocket.js +0 -45
  94. package/dist/livestream-store/chat.js +0 -286
  95. package/dist/livestream-store/context.js +0 -5
  96. package/dist/livestream-store/index.js +0 -7
  97. package/dist/livestream-store/livestream-state.js +0 -2
  98. package/dist/livestream-store/livestream-store.js +0 -58
  99. package/dist/livestream-store/problems.js +0 -76
  100. package/dist/livestream-store/stream-key.js +0 -119
  101. package/dist/livestream-store/websocket-consumer.js +0 -94
  102. package/dist/player-store/context.js +0 -5
  103. package/dist/player-store/index.js +0 -9
  104. package/dist/player-store/player-provider.js +0 -57
  105. package/dist/player-store/player-state.js +0 -25
  106. package/dist/player-store/player-store.js +0 -199
  107. package/dist/player-store/single-player-provider.js +0 -121
  108. package/dist/streamplace-provider/context.js +0 -5
  109. package/dist/streamplace-provider/index.js +0 -20
  110. package/dist/streamplace-provider/poller.js +0 -49
  111. package/dist/streamplace-provider/xrpc.js +0 -0
  112. package/dist/streamplace-store/block.js +0 -65
  113. package/dist/streamplace-store/index.js +0 -6
  114. package/dist/streamplace-store/stream.js +0 -218
  115. package/dist/streamplace-store/streamplace-store.js +0 -47
  116. package/dist/streamplace-store/user.js +0 -52
  117. package/dist/streamplace-store/xrpc.js +0 -15
  118. package/dist/ui/index.js +0 -79
  119. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
  120. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/56540125 +0 -0
  121. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/67b1eb60 +0 -0
  122. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/7c275f90 +0 -0
  123. package/tsconfig.tsbuildinfo +0 -1
@@ -1,177 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextPrimitive = exports.textVariants = exports.Span = exports.Code = exports.Label = exports.Caption = exports.Body = exports.Subtitle = exports.Heading = exports.Text = void 0;
4
- const tslib_1 = require("tslib");
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const class_variance_authority_1 = require("class-variance-authority");
7
- const react_1 = tslib_1.__importStar(require("react"));
8
- const react_native_1 = require("react-native");
9
- const atoms_1 = require("../../lib/theme/atoms");
10
- const text_1 = require("./primitives/text");
11
- Object.defineProperty(exports, "TextPrimitive", { enumerable: true, get: function () { return text_1.TextPrimitive; } });
12
- // Text variants using class-variance-authority pattern
13
- const textVariants = (0, class_variance_authority_1.cva)("", {
14
- variants: {
15
- variant: {
16
- h1: "h1",
17
- h2: "h2",
18
- h3: "h3",
19
- h4: "h4",
20
- h5: "h5",
21
- h6: "h6",
22
- subtitle1: "subtitle1",
23
- subtitle2: "subtitle2",
24
- body1: "body1",
25
- body2: "body2",
26
- caption: "caption",
27
- overline: "overline",
28
- },
29
- size: {
30
- xs: "xs",
31
- sm: "sm",
32
- base: "base",
33
- lg: "lg",
34
- xl: "xl",
35
- "2xl": "2xl",
36
- "3xl": "3xl",
37
- "4xl": "4xl",
38
- },
39
- weight: {
40
- thin: "thin",
41
- light: "light",
42
- normal: "normal",
43
- medium: "medium",
44
- semibold: "semibold",
45
- bold: "bold",
46
- extrabold: "extrabold",
47
- black: "black",
48
- },
49
- color: {
50
- default: "default",
51
- muted: "muted",
52
- primary: "primary",
53
- secondary: "secondary",
54
- destructive: "destructive",
55
- success: "success",
56
- warning: "warning",
57
- },
58
- },
59
- defaultVariants: {
60
- variant: "body1",
61
- size: "base",
62
- weight: "normal",
63
- color: "default",
64
- },
65
- });
66
- exports.textVariants = textVariants;
67
- exports.Text = (0, react_1.forwardRef)(({ variant = undefined, size = undefined, weight = undefined, color = undefined, muted = false, bold = false, italic = false, underline = false, strikethrough = false, uppercase = false, lowercase = false, capitalize = false, center = false, right = false, justify = false, customColor, style, children, ...props }, ref) => {
68
- // Create dynamic styles based on atoms
69
- const styles = react_1.default.useMemo(() => createStyles(), []);
70
- // Override props based on convenience props
71
- const finalColor = customColor ? customColor : muted ? "muted" : color;
72
- const finalTransform = uppercase
73
- ? "uppercase"
74
- : lowercase
75
- ? "lowercase"
76
- : capitalize
77
- ? "capitalize"
78
- : "none";
79
- const finalDecoration = underline && strikethrough
80
- ? "underline line-through"
81
- : underline
82
- ? "underline"
83
- : strikethrough
84
- ? "line-through"
85
- : "none";
86
- const finalAlign = center
87
- ? "center"
88
- : right
89
- ? "right"
90
- : justify
91
- ? "justify"
92
- : "left";
93
- // Get variant-specific styles
94
- const variantStyle = styles[`${variant}Style`] || {};
95
- const styleArr = (Array.isArray(style) ? style : [style || undefined]).filter((s) => s !== undefined);
96
- return ((0, jsx_runtime_1.jsx)(text_1.TextPrimitive.Root, { ref: ref, variant: variant || "body1", size: size || "base", color: finalColor || "default", align: finalAlign, transform: finalTransform, decoration: finalDecoration, italic: italic, style: [variantStyle, ...styleArr], ...props, children: children }));
97
- });
98
- exports.Text.displayName = "Text";
99
- // Convenience components for common text elements
100
- exports.Heading = (0, react_1.forwardRef)(({ level = 1, ...props }, ref) => ((0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, variant: `h${level}`, ...props })));
101
- exports.Heading.displayName = "Heading";
102
- exports.Subtitle = (0, react_1.forwardRef)(({ level = 1, ...props }, ref) => ((0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, variant: level === 1 ? "subtitle1" : "subtitle2", ...props })));
103
- exports.Subtitle.displayName = "Subtitle";
104
- exports.Body = (0, react_1.forwardRef)(({ level = 1, ...props }, ref) => ((0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, variant: level === 1 ? "body1" : "body2", ...props })));
105
- exports.Body.displayName = "Body";
106
- exports.Caption = (0, react_1.forwardRef)((props, ref) => (0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, variant: "caption", ...props }));
107
- exports.Caption.displayName = "Caption";
108
- exports.Label = (0, react_1.forwardRef)((props, ref) => ((0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, variant: "subtitle1", weight: "medium", ...props })));
109
- exports.Label.displayName = "Label";
110
- exports.Code = (0, react_1.forwardRef)(({ style, ...props }, ref) => {
111
- const styles = react_1.default.useMemo(() => createStyles(), []);
112
- // if style is not an array, convert it to an array
113
- const styleArr = (Array.isArray(style) ? style : [style || undefined]).filter((s) => s !== undefined);
114
- return (0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, style: [styles.codeStyle, ...styleArr], ...props });
115
- });
116
- exports.Code.displayName = "Code";
117
- // Span component for inline text styling (inherits from parent)
118
- exports.Span = (0, react_1.forwardRef)(({ children, ...props }, ref) => ((0, jsx_runtime_1.jsx)(text_1.TextPrimitive.Span, { ref: ref, ...props, children: children })));
119
- exports.Span.displayName = "Span";
120
- // Create atom-based styles
121
- function createStyles() {
122
- return react_native_1.StyleSheet.create({
123
- // Variant-specific styles
124
- h1Style: {
125
- marginBottom: atoms_1.spacing[4],
126
- },
127
- h2Style: {
128
- marginBottom: atoms_1.spacing[3],
129
- },
130
- h3Style: {
131
- marginBottom: atoms_1.spacing[3],
132
- },
133
- h4Style: {
134
- marginBottom: atoms_1.spacing[2],
135
- },
136
- h5Style: {
137
- marginBottom: atoms_1.spacing[2],
138
- },
139
- h6Style: {
140
- marginBottom: atoms_1.spacing[2],
141
- },
142
- subtitle1Style: {
143
- marginBottom: atoms_1.spacing[2],
144
- },
145
- subtitle2Style: {
146
- marginBottom: atoms_1.spacing[1],
147
- },
148
- body1Style: {
149
- marginBottom: atoms_1.spacing[3],
150
- },
151
- body2Style: {
152
- marginBottom: atoms_1.spacing[2],
153
- },
154
- captionStyle: {
155
- marginBottom: atoms_1.spacing[1],
156
- },
157
- overlineStyle: {
158
- marginBottom: atoms_1.spacing[1],
159
- textTransform: "uppercase",
160
- letterSpacing: 1,
161
- },
162
- labelStyle: {
163
- marginBottom: atoms_1.spacing[1],
164
- },
165
- buttonStyle: {
166
- textAlign: "center",
167
- },
168
- codeStyle: {
169
- fontFamily: "monospace",
170
- backgroundColor: atoms_1.colors["muted"],
171
- paddingHorizontal: atoms_1.spacing[1],
172
- paddingVertical: 2,
173
- borderRadius: atoms_1.borderRadius.sm,
174
- fontSize: 14,
175
- },
176
- });
177
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Textarea = Textarea;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_native_1 = require("react-native");
6
- const atoms_1 = require("../../lib/theme/atoms");
7
- function Textarea({ style, multiline = true, numberOfLines = 4, ...props }) {
8
- return ((0, jsx_runtime_1.jsx)(react_native_1.TextInput, { style: [
9
- atoms_1.flex.values[1],
10
- atoms_1.borders.width.thin,
11
- atoms_1.borders.color.gray[400],
12
- atoms_1.bg.gray[900],
13
- atoms_1.p[3],
14
- atoms_1.text.gray[200],
15
- props.editable === false && { opacity: 0.5 },
16
- { borderRadius: 10 },
17
- style,
18
- ], multiline: multiline, numberOfLines: numberOfLines, textAlignVertical: "top", ...props }));
19
- }
@@ -1,175 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useToast = useToast;
4
- exports.Toast = Toast;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const portal_1 = require("@rn-primitives/portal");
7
- const react_1 = require("react");
8
- const react_native_1 = require("react-native");
9
- const react_native_safe_area_context_1 = require("react-native-safe-area-context");
10
- const theme_1 = require("../../lib/theme/theme");
11
- const react_2 = require("react");
12
- /**
13
- * useToast - a hook to manage Toast state and provide a toastController.
14
- * Returns a ready-to-render ToastComponent.
15
- */
16
- function useToast(initial = {}) {
17
- const [open, setOpen] = (0, react_1.useState)(false);
18
- const [title, setTitle] = (0, react_1.useState)(initial.title ?? "");
19
- const [description, setDescription] = (0, react_1.useState)(initial.description ?? "");
20
- const [duration, setDuration] = (0, react_1.useState)(initial.duration ?? 3);
21
- const [actionLabel, setActionLabel] = (0, react_1.useState)(initial.actionLabel ?? "Action");
22
- const [onAction, setOnAction] = (0, react_1.useState)(initial.onAction);
23
- const show = (0, react_2.useCallback)((toastTitle, toastDescription, options) => {
24
- setTitle(toastTitle);
25
- setDescription(toastDescription ?? "");
26
- setDuration(options?.duration ?? 3);
27
- setActionLabel(options?.actionLabel ?? "Action");
28
- setOnAction(options?.onAction);
29
- setOpen(true);
30
- }, []);
31
- const hide = (0, react_2.useCallback)(() => {
32
- setOpen(false);
33
- }, []);
34
- // Ready-to-render Toast component
35
- const ToastComponent = ((0, jsx_runtime_1.jsx)(Toast, { open: open, onOpenChange: setOpen, title: title, description: description, actionLabel: actionLabel, onAction: onAction, duration: duration }));
36
- return {
37
- open,
38
- title,
39
- description,
40
- actionLabel,
41
- onAction,
42
- duration,
43
- setOpen,
44
- setTitle,
45
- setDescription,
46
- setActionLabel,
47
- setOnAction,
48
- setDuration,
49
- toastController: { show, hide },
50
- ToastComponent,
51
- };
52
- }
53
- function Toast({ open, onOpenChange, title, description, actionLabel = "Action", onAction, duration = 3, }) {
54
- const [seconds, setSeconds] = (0, react_1.useState)(duration);
55
- const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
56
- const { theme } = (0, theme_1.useTheme)();
57
- const [fadeAnim] = (0, react_1.useState)(new react_native_1.Animated.Value(0));
58
- const { width } = (0, react_native_1.useWindowDimensions)();
59
- const isWeb = react_native_1.Platform.OS === "web";
60
- const isDesktop = isWeb && width >= 768;
61
- const containerPosition = isDesktop
62
- ? {
63
- top: undefined,
64
- bottom: theme.spacing[4],
65
- right: theme.spacing[4], // <-- use spacing, not 1
66
- alignItems: "flex-end",
67
- minWidth: 400,
68
- width: 400,
69
- // Do NOT set left at all
70
- }
71
- : {
72
- bottom: insets.bottom + theme.spacing[1],
73
- left: 0,
74
- right: 0,
75
- alignItems: "center",
76
- width: "100%",
77
- maxWidth: undefined,
78
- };
79
- (0, react_1.useEffect)(() => {
80
- let interval = null;
81
- if (open) {
82
- setSeconds(duration);
83
- react_native_1.Animated.timing(fadeAnim, {
84
- toValue: 1,
85
- duration: 200,
86
- useNativeDriver: true,
87
- }).start();
88
- interval = setInterval(() => {
89
- setSeconds((prev) => {
90
- if (prev <= 1) {
91
- onOpenChange(false);
92
- if (interval)
93
- clearInterval(interval);
94
- return duration;
95
- }
96
- return prev - 1;
97
- });
98
- }, 1000);
99
- }
100
- else {
101
- if (interval)
102
- clearInterval(interval);
103
- react_native_1.Animated.timing(fadeAnim, {
104
- toValue: 0,
105
- duration: 150,
106
- useNativeDriver: true,
107
- }).start();
108
- setSeconds(duration);
109
- }
110
- return () => {
111
- if (interval)
112
- clearInterval(interval);
113
- };
114
- // eslint-disable-next-line
115
- }, [open, duration]);
116
- if (!open)
117
- return null;
118
- return ((0, jsx_runtime_1.jsx)(portal_1.Portal, { name: "toast", children: (0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { style: [styles.container, containerPosition, { opacity: fadeAnim }], pointerEvents: "box-none", children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
119
- styles.toast,
120
- {
121
- backgroundColor: theme.colors.secondary,
122
- borderColor: theme.colors.border,
123
- borderRadius: theme.borderRadius.xl,
124
- flexDirection: "column",
125
- justifyContent: "space-between",
126
- alignItems: "center",
127
- padding: theme.spacing[4],
128
- width: isDesktop ? "100%" : "95%",
129
- },
130
- ], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { gap: theme.spacing[1], width: "100%" }, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
131
- {
132
- color: theme.colors.foreground,
133
- fontSize: 16,
134
- fontWeight: "500",
135
- },
136
- ], children: title }), description ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [{ color: theme.colors.foreground, fontSize: 14 }], children: description })) : null] }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: {
137
- gap: theme.spacing[1],
138
- flexDirection: "row",
139
- justifyContent: "flex-end",
140
- width: "100%",
141
- }, children: [onAction && ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { style: [
142
- styles.button,
143
- {
144
- borderColor: theme.colors.primary,
145
- paddingHorizontal: theme.spacing[4],
146
- paddingVertical: theme.spacing[2],
147
- },
148
- ], onPress: onAction, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: { color: theme.colors.foreground }, children: actionLabel }) })), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { style: [
149
- styles.button,
150
- {
151
- borderColor: theme.colors.primary,
152
- paddingHorizontal: theme.spacing[4],
153
- paddingVertical: theme.spacing[2],
154
- },
155
- ], onPress: () => onOpenChange(false), children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: { color: theme.colors.foreground }, children: "Close" }) })] })] }) }) }));
156
- }
157
- const styles = react_native_1.StyleSheet.create({
158
- container: {
159
- position: "absolute",
160
- zIndex: 1000,
161
- paddingHorizontal: 16,
162
- },
163
- toast: {
164
- opacity: 0.95,
165
- borderWidth: 1,
166
- gap: 8,
167
- },
168
- button: {
169
- borderWidth: 1,
170
- borderRadius: 8,
171
- alignItems: "center",
172
- justifyContent: "center",
173
- backgroundColor: "transparent",
174
- },
175
- });
@@ -1,252 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.viewVariants = exports.Center = exports.Column = exports.Row = exports.Overlay = exports.Surface = exports.Container = exports.Card = exports.View = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const class_variance_authority_1 = require("class-variance-authority");
6
- const react_1 = require("react");
7
- const react_native_1 = require("react-native");
8
- const atoms_1 = require("../../lib/theme/atoms");
9
- const theme_1 = require("../../lib/theme/theme");
10
- // View variants using class-variance-authority pattern
11
- const viewVariants = (0, class_variance_authority_1.cva)("", {
12
- variants: {
13
- variant: {
14
- default: "default",
15
- card: "card",
16
- overlay: "overlay",
17
- surface: "surface",
18
- container: "container",
19
- },
20
- padding: {
21
- none: "none",
22
- xs: "xs",
23
- sm: "sm",
24
- md: "md",
25
- lg: "lg",
26
- xl: "xl",
27
- },
28
- margin: {
29
- none: "none",
30
- xs: "xs",
31
- sm: "sm",
32
- md: "md",
33
- lg: "lg",
34
- xl: "xl",
35
- },
36
- direction: {
37
- row: "row",
38
- column: "column",
39
- "row-reverse": "row-reverse",
40
- "column-reverse": "column-reverse",
41
- },
42
- align: {
43
- start: "start",
44
- center: "center",
45
- end: "end",
46
- stretch: "stretch",
47
- baseline: "baseline",
48
- },
49
- justify: {
50
- start: "start",
51
- center: "center",
52
- end: "end",
53
- between: "between",
54
- around: "around",
55
- evenly: "evenly",
56
- },
57
- flex: {
58
- none: "none",
59
- auto: "auto",
60
- initial: "initial",
61
- },
62
- },
63
- defaultVariants: {
64
- variant: "default",
65
- padding: "none",
66
- margin: "none",
67
- direction: "column",
68
- align: "stretch",
69
- justify: "start",
70
- flex: "none",
71
- },
72
- });
73
- exports.viewVariants = viewVariants;
74
- exports.View = (0, react_1.forwardRef)(({ variant = "default", padding = "none", margin = "none", direction = "column", align = "stretch", justify = "start", flex = "none", fullWidth = false, fullHeight = false, centered = false, backgroundColor, borderColor, borderWidth, borderRadius, shadow = false, style, ...props }, ref) => {
75
- const { theme } = (0, theme_1.useTheme)();
76
- // Map variant to styles
77
- const variantStyles = (() => {
78
- switch (variant) {
79
- case "card":
80
- return {
81
- backgroundColor: theme.colors.card,
82
- borderRadius: atoms_1.borderRadius.lg,
83
- shadowColor: "#000",
84
- shadowOffset: { width: 0, height: 2 },
85
- shadowOpacity: 0.1,
86
- shadowRadius: 4,
87
- elevation: 3,
88
- };
89
- case "overlay":
90
- return {
91
- backgroundColor: "rgba(0, 0, 0, 0.5)",
92
- };
93
- case "surface":
94
- return {
95
- backgroundColor: theme.colors.background,
96
- };
97
- case "container":
98
- return {
99
- backgroundColor: theme.colors.background,
100
- padding: atoms_1.spacing[4],
101
- };
102
- default:
103
- return {};
104
- }
105
- })();
106
- // Map padding to numeric values
107
- const paddingValue = (() => {
108
- switch (padding) {
109
- case "xs":
110
- return atoms_1.spacing[1];
111
- case "sm":
112
- return atoms_1.spacing[2];
113
- case "md":
114
- return atoms_1.spacing[3];
115
- case "lg":
116
- return atoms_1.spacing[4];
117
- case "xl":
118
- return atoms_1.spacing[5];
119
- default:
120
- return undefined;
121
- }
122
- })();
123
- // Map margin to numeric values
124
- const marginValue = (() => {
125
- switch (margin) {
126
- case "xs":
127
- return atoms_1.spacing[1];
128
- case "sm":
129
- return atoms_1.spacing[2];
130
- case "md":
131
- return atoms_1.spacing[3];
132
- case "lg":
133
- return atoms_1.spacing[4];
134
- case "xl":
135
- return atoms_1.spacing[5];
136
- default:
137
- return undefined;
138
- }
139
- })();
140
- // Map flex direction
141
- const flexDirection = (() => {
142
- switch (direction) {
143
- case "row":
144
- return "row";
145
- case "column":
146
- return "column";
147
- case "row-reverse":
148
- return "row-reverse";
149
- case "column-reverse":
150
- return "column-reverse";
151
- default:
152
- return "column";
153
- }
154
- })();
155
- // Map align items
156
- const alignItems = (() => {
157
- switch (align) {
158
- case "start":
159
- return "flex-start";
160
- case "center":
161
- return "center";
162
- case "end":
163
- return "flex-end";
164
- case "stretch":
165
- return "stretch";
166
- case "baseline":
167
- return "baseline";
168
- default:
169
- return "stretch";
170
- }
171
- })();
172
- // Map justify content
173
- const justifyContent = (() => {
174
- switch (justify) {
175
- case "start":
176
- return "flex-start";
177
- case "center":
178
- return "center";
179
- case "end":
180
- return "flex-end";
181
- case "between":
182
- return "space-between";
183
- case "around":
184
- return "space-around";
185
- case "evenly":
186
- return "space-evenly";
187
- default:
188
- return "flex-start";
189
- }
190
- })();
191
- // Map flex value
192
- const flexValue = (() => {
193
- if (typeof flex === "number") {
194
- return flex;
195
- }
196
- switch (flex) {
197
- case "auto":
198
- return undefined; // auto is default
199
- case "initial":
200
- return 0;
201
- case "none":
202
- default:
203
- return undefined;
204
- }
205
- })();
206
- const computedStyle = {
207
- ...variantStyles,
208
- ...(paddingValue !== undefined && { padding: paddingValue }),
209
- ...(marginValue !== undefined && { margin: marginValue }),
210
- flexDirection,
211
- alignItems,
212
- justifyContent,
213
- ...(flexValue !== undefined && { flex: flexValue }),
214
- ...(fullWidth && { width: "100%" }),
215
- ...(fullHeight && { height: "100%" }),
216
- ...(centered && {
217
- alignItems: "center",
218
- justifyContent: "center",
219
- }),
220
- ...(backgroundColor && { backgroundColor }),
221
- ...(borderColor && { borderColor }),
222
- ...(borderWidth !== undefined && { borderWidth }),
223
- ...(borderRadius !== undefined && { borderRadius }),
224
- ...(shadow && {
225
- shadowColor: "#000",
226
- shadowOffset: { width: 0, height: 2 },
227
- shadowOpacity: 0.1,
228
- shadowRadius: 4,
229
- elevation: 3,
230
- }),
231
- };
232
- const finalStyle = Array.isArray(style)
233
- ? [computedStyle, ...style]
234
- : [computedStyle, style];
235
- return (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: finalStyle, ...props });
236
- });
237
- exports.View.displayName = "View";
238
- // Convenience components
239
- exports.Card = (0, react_1.forwardRef)((props, ref) => (0, jsx_runtime_1.jsx)(exports.View, { ref: ref, variant: "card", ...props }));
240
- exports.Card.displayName = "Card";
241
- exports.Container = (0, react_1.forwardRef)((props, ref) => (0, jsx_runtime_1.jsx)(exports.View, { ref: ref, variant: "container", ...props }));
242
- exports.Container.displayName = "Container";
243
- exports.Surface = (0, react_1.forwardRef)((props, ref) => (0, jsx_runtime_1.jsx)(exports.View, { ref: ref, variant: "surface", ...props }));
244
- exports.Surface.displayName = "Surface";
245
- exports.Overlay = (0, react_1.forwardRef)((props, ref) => (0, jsx_runtime_1.jsx)(exports.View, { ref: ref, variant: "overlay", ...props }));
246
- exports.Overlay.displayName = "Overlay";
247
- exports.Row = (0, react_1.forwardRef)((props, ref) => (0, jsx_runtime_1.jsx)(exports.View, { ref: ref, direction: "row", ...props }));
248
- exports.Row.displayName = "Row";
249
- exports.Column = (0, react_1.forwardRef)((props, ref) => (0, jsx_runtime_1.jsx)(exports.View, { ref: ref, direction: "column", ...props }));
250
- exports.Column.displayName = "Column";
251
- exports.Center = (0, react_1.forwardRef)((props, ref) => ((0, jsx_runtime_1.jsx)(exports.View, { ref: ref, centered: true, ...props })));
252
- exports.Center.displayName = "Center";
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- // barrel file :)
5
- tslib_1.__exportStar(require("./useAvatars"), exports);
6
- tslib_1.__exportStar(require("./useCameraToggle"), exports);
7
- tslib_1.__exportStar(require("./useKeyboard"), exports);
8
- tslib_1.__exportStar(require("./useKeyboardSlide"), exports);
9
- tslib_1.__exportStar(require("./useLivestreamInfo"), exports);
10
- tslib_1.__exportStar(require("./useOuterAndInnerDimensions"), exports);
11
- tslib_1.__exportStar(require("./usePlayerDimensions"), exports);
12
- tslib_1.__exportStar(require("./usePointerDevice"), exports);
13
- tslib_1.__exportStar(require("./useSegmentDimensions"), exports);
14
- tslib_1.__exportStar(require("./useSegmentTiming"), exports);
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useAvatars = useAvatars;
4
- const react_1 = require("react");
5
- const xrpc_1 = require("../streamplace-store/xrpc");
6
- function useAvatars(dids) {
7
- let agent = (0, xrpc_1.usePDSAgent)();
8
- const [profiles, setProfiles] = (0, react_1.useState)({});
9
- const inFlight = (0, react_1.useRef)(new Set());
10
- const missingDids = (0, react_1.useMemo)(() => dids.filter((did) => !(did in profiles) && !inFlight.current.has(did)), [dids, profiles]);
11
- (0, react_1.useEffect)(() => {
12
- if (missingDids.length === 0 || !agent)
13
- return;
14
- const toFetch = missingDids.slice(0, 25);
15
- toFetch.forEach((did) => inFlight.current.add(did));
16
- const fetchProfiles = async () => {
17
- try {
18
- const result = await agent.getProfiles({ actors: toFetch });
19
- const newProfiles = {};
20
- result.data.profiles.forEach((p) => {
21
- newProfiles[p.did] = p;
22
- });
23
- setProfiles((prev) => ({ ...prev, ...newProfiles }));
24
- }
25
- catch (e) {
26
- console.error("Failed to fetch profiles", e);
27
- }
28
- finally {
29
- toFetch.forEach((did) => inFlight.current.delete(did));
30
- }
31
- };
32
- fetchProfiles();
33
- }, [missingDids, agent]);
34
- return profiles;
35
- }