@streamplace/components 0.7.26 → 0.7.29
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 +2 -2
- package/dist/components/chat/chat.js +1 -1
- package/dist/components/mobile-player/ui/autoplay-button.js +1 -0
- package/dist/components/mobile-player/ui/viewer-context-menu.js +1 -1
- package/dist/components/mobile-player/ui/viewer-loading-overlay.js +2 -2
- package/dist/components/mobile-player/use-webrtc.js +37 -1
- package/dist/components/mobile-player/video.native.js +10 -1
- package/dist/components/ui/button.js +107 -155
- package/dist/components/ui/dialog.js +83 -116
- package/dist/components/ui/dropdown.js +41 -18
- package/dist/components/ui/input.js +53 -128
- package/dist/components/ui/primitives/button.js +0 -2
- package/dist/components/ui/primitives/modal.js +2 -2
- package/dist/components/ui/primitives/text.js +48 -8
- package/dist/components/ui/text.js +37 -66
- package/dist/components/ui/toast.js +78 -40
- package/dist/components/ui/view.js +28 -41
- package/dist/crypto-polyfill.js +0 -0
- package/dist/crypto-polyfill.native.js +24 -0
- package/dist/index.js +1 -0
- package/dist/lib/theme/index.js +1 -2
- package/dist/lib/theme/theme.js +106 -54
- package/dist/lib/theme/tokens.js +94 -1
- package/dist/livestream-store/chat.js +0 -2
- package/dist/livestream-store/stream-key.js +1 -1
- package/dist/player-store/player-provider.js +10 -2
- package/dist/player-store/single-player-provider.js +1 -1
- package/dist/streamplace-store/stream.js +1 -1
- package/dist/ui/index.js +2 -3
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
- package/package.json +3 -2
- package/src/components/chat/chat-box.tsx +6 -3
- package/src/components/chat/chat.tsx +1 -0
- package/src/components/mobile-player/ui/autoplay-button.tsx +1 -0
- package/src/components/mobile-player/ui/viewer-context-menu.tsx +2 -2
- package/src/components/mobile-player/ui/viewer-loading-overlay.tsx +2 -2
- package/src/components/mobile-player/use-webrtc.tsx +41 -1
- package/src/components/mobile-player/video.native.tsx +19 -4
- package/src/components/ui/button.tsx +110 -172
- package/src/components/ui/dialog.tsx +96 -138
- package/src/components/ui/dropdown.tsx +60 -22
- package/src/components/ui/input.tsx +57 -144
- package/src/components/ui/primitives/button.tsx +0 -2
- package/src/components/ui/primitives/modal.tsx +0 -2
- package/src/components/ui/primitives/text.tsx +51 -8
- package/src/components/ui/text.tsx +42 -67
- package/src/components/ui/toast.tsx +108 -90
- package/src/components/ui/view.tsx +27 -41
- package/src/crypto-polyfill.native.tsx +24 -0
- package/src/crypto-polyfill.tsx +0 -0
- package/src/index.tsx +2 -0
- package/src/lib/theme/index.ts +0 -2
- package/src/lib/theme/theme.tsx +179 -72
- package/src/lib/theme/tokens.ts +97 -0
- package/src/livestream-store/chat.tsx +0 -3
- package/src/livestream-store/stream-key.tsx +1 -1
- package/src/player-store/player-provider.tsx +13 -1
- package/src/player-store/single-player-provider.tsx +1 -1
- package/src/streamplace-store/stream.tsx +1 -1
- package/src/ui/index.ts +0 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -7,7 +7,7 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
7
7
|
const react_native_1 = require("react-native");
|
|
8
8
|
const { width: screenWidth, height: screenHeight } = react_native_1.Dimensions.get("window");
|
|
9
9
|
// Modal root primitive - handles the native Modal component
|
|
10
|
-
exports.ModalRoot = (0, react_1.forwardRef)(({ open = false, onOpenChange, children, onRequestClose, animationType = "fade", presentationStyle = react_native_1.Platform.OS === "ios" ? "pageSheet" : "fullScreen",
|
|
10
|
+
exports.ModalRoot = (0, react_1.forwardRef)(({ open = false, onOpenChange, children, onRequestClose, animationType = "fade", presentationStyle = react_native_1.Platform.OS === "ios" ? "pageSheet" : "fullScreen", statusBarTranslucent = react_native_1.Platform.OS === "android", ...props }, ref) => {
|
|
11
11
|
const handleRequestClose = react_1.default.useCallback((e) => {
|
|
12
12
|
if (onOpenChange) {
|
|
13
13
|
onOpenChange(false);
|
|
@@ -16,7 +16,7 @@ exports.ModalRoot = (0, react_1.forwardRef)(({ open = false, onOpenChange, child
|
|
|
16
16
|
onRequestClose(e);
|
|
17
17
|
}
|
|
18
18
|
}, [onOpenChange, onRequestClose]);
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: open, onRequestClose: handleRequestClose, animationType: animationType, presentationStyle: presentationStyle,
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: open, onRequestClose: handleRequestClose, animationType: animationType, presentationStyle: presentationStyle, statusBarTranslucent: statusBarTranslucent, ...props, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: primitiveStyles.container, children: children }) }));
|
|
20
20
|
});
|
|
21
21
|
exports.ModalRoot.displayName = "ModalRoot";
|
|
22
22
|
exports.ModalOverlay = (0, react_1.forwardRef)(({ dismissible = true, onDismiss, onPress, style, children, activeOpacity = 1, ...props }, ref) => {
|
|
@@ -24,6 +24,17 @@ const sizeMap = {
|
|
|
24
24
|
"3xl": 30,
|
|
25
25
|
"4xl": 36,
|
|
26
26
|
};
|
|
27
|
+
// Size-specific line height mapping (provides better default line heights for each size)
|
|
28
|
+
const sizeLineHeightMap = {
|
|
29
|
+
xs: 16, // 12px * 1.33 = tight but readable
|
|
30
|
+
sm: 20, // 14px * 1.43 = good for small text
|
|
31
|
+
base: 24, // 16px * 1.5 = standard body text
|
|
32
|
+
lg: 28, // 18px * 1.56 = comfortable for larger text
|
|
33
|
+
xl: 30, // 20px * 1.5 = balanced
|
|
34
|
+
"2xl": 32, // 24px * 1.33 = tighter for headings
|
|
35
|
+
"3xl": 36, // 30px * 1.2 = tight for large headings
|
|
36
|
+
"4xl": 40, // 36px * 1.11 = very tight for display text
|
|
37
|
+
};
|
|
27
38
|
// Weight mapping
|
|
28
39
|
const weightMap = {
|
|
29
40
|
thin: "100",
|
|
@@ -85,12 +96,12 @@ const getVariantStyles = () => {
|
|
|
85
96
|
}
|
|
86
97
|
else if (typographicPlatform === "android") {
|
|
87
98
|
return {
|
|
88
|
-
h1: platformTypography.
|
|
89
|
-
h2: platformTypography.
|
|
90
|
-
h3: platformTypography.
|
|
91
|
-
h4: platformTypography.
|
|
92
|
-
h5: platformTypography.
|
|
93
|
-
h6: platformTypography.
|
|
99
|
+
h1: platformTypography.headline4, // 34px instead of 96px
|
|
100
|
+
h2: platformTypography.headline5, // 24px instead of 60px
|
|
101
|
+
h3: platformTypography.headline6, // 20px instead of 48px
|
|
102
|
+
h4: platformTypography.subtitle1, // 16px instead of 34px
|
|
103
|
+
h5: platformTypography.subtitle2, // 14px instead of 24px
|
|
104
|
+
h6: platformTypography.subtitle2, // 14px - consistent with h5
|
|
94
105
|
subtitle1: platformTypography.subtitle1,
|
|
95
106
|
subtitle2: platformTypography.subtitle2,
|
|
96
107
|
body1: platformTypography.body1,
|
|
@@ -143,9 +154,15 @@ exports.TextRoot = (0, react_1.forwardRef)(({ variant, size, weight, color, alig
|
|
|
143
154
|
// Apply variant styles (these may override inherited)
|
|
144
155
|
...(variant && variantStyles[variant]),
|
|
145
156
|
// Apply explicit prop styles (these should override inherited and variant)
|
|
146
|
-
// Apply size
|
|
157
|
+
// Apply size (with corresponding line height if not explicitly set)
|
|
147
158
|
...(size && {
|
|
148
159
|
fontSize: typeof size === "number" ? size : sizeMap[size],
|
|
160
|
+
// Apply size-specific line height only if leading is not explicitly set
|
|
161
|
+
...(leading === undefined && {
|
|
162
|
+
lineHeight: typeof size === "number"
|
|
163
|
+
? size // Auto line height for numeric sizes
|
|
164
|
+
: sizeLineHeightMap[size],
|
|
165
|
+
}),
|
|
149
166
|
}),
|
|
150
167
|
// Apply weight
|
|
151
168
|
...(weight && {
|
|
@@ -204,6 +221,22 @@ exports.TextRoot = (0, react_1.forwardRef)(({ variant, size, weight, color, alig
|
|
|
204
221
|
};
|
|
205
222
|
finalStyles.color = finalStyles.color;
|
|
206
223
|
// Create context value for children
|
|
224
|
+
// Process custom styles to auto-add line height for fontSize
|
|
225
|
+
const processedStyle = Array.isArray(style)
|
|
226
|
+
? style
|
|
227
|
+
: [style].filter(Boolean);
|
|
228
|
+
const enhancedStyles = processedStyle.map((styleObj) => {
|
|
229
|
+
if (styleObj && typeof styleObj === "object" && "fontSize" in styleObj) {
|
|
230
|
+
const fontSize = styleObj.fontSize;
|
|
231
|
+
if (typeof fontSize === "number" && !styleObj.lineHeight && !leading) {
|
|
232
|
+
return {
|
|
233
|
+
...styleObj,
|
|
234
|
+
lineHeight: fontSize * 1.2,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return styleObj;
|
|
239
|
+
});
|
|
207
240
|
const contextValue = {
|
|
208
241
|
fontSize: typeof finalStyles.fontSize === "number"
|
|
209
242
|
? finalStyles.fontSize
|
|
@@ -223,7 +256,7 @@ exports.TextRoot = (0, react_1.forwardRef)(({ variant, size, weight, color, alig
|
|
|
223
256
|
fontStyle: finalStyles.fontStyle,
|
|
224
257
|
opacity: finalStyles.opacity,
|
|
225
258
|
};
|
|
226
|
-
return ((0, jsx_runtime_1.jsx)(exports.TextContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [finalStyles,
|
|
259
|
+
return ((0, jsx_runtime_1.jsx)(exports.TextContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [finalStyles, ...enhancedStyles], ...props, children: children }) }));
|
|
227
260
|
});
|
|
228
261
|
exports.TextRoot.displayName = "TextRoot";
|
|
229
262
|
// Text span primitive (inherits from parent but doesn't create new context)
|
|
@@ -248,6 +281,13 @@ function createTextStyle(props) {
|
|
|
248
281
|
if (props.size) {
|
|
249
282
|
style.fontSize =
|
|
250
283
|
typeof props.size === "number" ? props.size : sizeMap[props.size];
|
|
284
|
+
// Apply size-specific line height only if leading is not explicitly set
|
|
285
|
+
if (props.leading === undefined) {
|
|
286
|
+
style.lineHeight =
|
|
287
|
+
typeof props.size === "number"
|
|
288
|
+
? props.size * 1.2 // Auto line height for numeric sizes
|
|
289
|
+
: sizeLineHeightMap[props.size];
|
|
290
|
+
}
|
|
251
291
|
}
|
|
252
292
|
if (props.weight) {
|
|
253
293
|
style.fontWeight = weightMap[props.weight];
|
|
@@ -5,8 +5,9 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const class_variance_authority_1 = require("class-variance-authority");
|
|
7
7
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const theme_1 = require("../../lib/theme/theme");
|
|
9
|
+
const tokens_1 = require("../../lib/theme/tokens");
|
|
10
|
+
const zero = tslib_1.__importStar(require("../../ui"));
|
|
10
11
|
const text_1 = require("./primitives/text");
|
|
11
12
|
Object.defineProperty(exports, "TextPrimitive", { enumerable: true, get: function () { return text_1.TextPrimitive; } });
|
|
12
13
|
// Text variants using class-variance-authority pattern
|
|
@@ -65,8 +66,7 @@ const textVariants = (0, class_variance_authority_1.cva)("", {
|
|
|
65
66
|
});
|
|
66
67
|
exports.textVariants = textVariants;
|
|
67
68
|
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
|
-
|
|
69
|
-
const styles = react_1.default.useMemo(() => createStyles(), []);
|
|
69
|
+
const { zero: zt } = (0, theme_1.useTheme)();
|
|
70
70
|
// Override props based on convenience props
|
|
71
71
|
const finalColor = customColor ? customColor : muted ? "muted" : color;
|
|
72
72
|
const finalTransform = uppercase
|
|
@@ -90,8 +90,31 @@ exports.Text = (0, react_1.forwardRef)(({ variant = undefined, size = undefined,
|
|
|
90
90
|
: justify
|
|
91
91
|
? "justify"
|
|
92
92
|
: "left";
|
|
93
|
-
// Get variant-specific styles
|
|
94
|
-
const variantStyle =
|
|
93
|
+
// Get variant-specific styles using theme.zero
|
|
94
|
+
const variantStyle = react_1.default.useMemo(() => {
|
|
95
|
+
switch (variant) {
|
|
96
|
+
case "h1":
|
|
97
|
+
return zero.my[6];
|
|
98
|
+
case "h2":
|
|
99
|
+
case "h3":
|
|
100
|
+
return zero.my[4];
|
|
101
|
+
case "h4":
|
|
102
|
+
case "h5":
|
|
103
|
+
case "h6":
|
|
104
|
+
case "subtitle1":
|
|
105
|
+
return zero.my[2];
|
|
106
|
+
case "subtitle2":
|
|
107
|
+
case "caption":
|
|
108
|
+
case "overline":
|
|
109
|
+
return zero.my[1];
|
|
110
|
+
case "body1":
|
|
111
|
+
return zero.my[4];
|
|
112
|
+
case "body2":
|
|
113
|
+
return zero.my[2];
|
|
114
|
+
default:
|
|
115
|
+
return {};
|
|
116
|
+
}
|
|
117
|
+
}, [variant, zt]);
|
|
95
118
|
const styleArr = (Array.isArray(style) ? style : [style || undefined]).filter((s) => s !== undefined);
|
|
96
119
|
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
120
|
});
|
|
@@ -108,70 +131,18 @@ exports.Caption.displayName = "Caption";
|
|
|
108
131
|
exports.Label = (0, react_1.forwardRef)((props, ref) => ((0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, variant: "subtitle1", weight: "medium", ...props })));
|
|
109
132
|
exports.Label.displayName = "Label";
|
|
110
133
|
exports.Code = (0, react_1.forwardRef)(({ style, ...props }, ref) => {
|
|
111
|
-
const
|
|
134
|
+
const { zero: zt } = (0, theme_1.useTheme)();
|
|
135
|
+
const codeStyle = react_1.default.useMemo(() => [
|
|
136
|
+
{
|
|
137
|
+
borderRadius: zero.borderRadius.sm,
|
|
138
|
+
fontFamily: tokens_1.fontFamilies.monoRegular,
|
|
139
|
+
},
|
|
140
|
+
], [zt]);
|
|
112
141
|
// if style is not an array, convert it to an array
|
|
113
142
|
const styleArr = (Array.isArray(style) ? style : [style || undefined]).filter((s) => s !== undefined);
|
|
114
|
-
return (0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, style: [
|
|
143
|
+
return (0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, style: [...codeStyle, ...styleArr], ...props });
|
|
115
144
|
});
|
|
116
145
|
exports.Code.displayName = "Code";
|
|
117
146
|
// Span component for inline text styling (inherits from parent)
|
|
118
147
|
exports.Span = (0, react_1.forwardRef)(({ children, ...props }, ref) => ((0, jsx_runtime_1.jsx)(text_1.TextPrimitive.Span, { ref: ref, ...props, children: children })));
|
|
119
148
|
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,59 +1,97 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toast = void 0;
|
|
3
4
|
exports.useToast = useToast;
|
|
5
|
+
exports.ToastProvider = ToastProvider;
|
|
4
6
|
exports.Toast = Toast;
|
|
5
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
8
|
const portal_1 = require("@rn-primitives/portal");
|
|
7
9
|
const react_1 = require("react");
|
|
8
10
|
const react_native_1 = require("react-native");
|
|
9
11
|
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
12
|
+
const ui_1 = require("../../ui");
|
|
13
|
+
class ToastManager {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.listeners = new Set();
|
|
16
|
+
this.currentToast = null;
|
|
17
|
+
this.timeoutId = null;
|
|
18
|
+
}
|
|
19
|
+
show(config) {
|
|
20
|
+
if (this.timeoutId) {
|
|
21
|
+
clearTimeout(this.timeoutId);
|
|
22
|
+
}
|
|
23
|
+
const toast = {
|
|
24
|
+
id: Math.random().toString(36).substr(2, 9),
|
|
25
|
+
open: true,
|
|
26
|
+
title: config.title,
|
|
27
|
+
description: config.description,
|
|
28
|
+
duration: config.duration ?? 3,
|
|
29
|
+
actionLabel: config.actionLabel,
|
|
30
|
+
onAction: config.onAction,
|
|
31
|
+
};
|
|
32
|
+
this.currentToast = toast;
|
|
33
|
+
this.notifyListeners();
|
|
34
|
+
if (toast.duration > 0) {
|
|
35
|
+
this.timeoutId = setTimeout(() => {
|
|
36
|
+
this.hide();
|
|
37
|
+
}, toast.duration * 1000);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
hide() {
|
|
41
|
+
if (this.timeoutId) {
|
|
42
|
+
clearTimeout(this.timeoutId);
|
|
43
|
+
this.timeoutId = null;
|
|
44
|
+
}
|
|
45
|
+
this.currentToast = null;
|
|
46
|
+
this.notifyListeners();
|
|
47
|
+
}
|
|
48
|
+
subscribe(listener) {
|
|
49
|
+
this.listeners.add(listener);
|
|
50
|
+
return () => {
|
|
51
|
+
this.listeners.delete(listener);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
notifyListeners() {
|
|
55
|
+
this.listeners.forEach((listener) => listener(this.currentToast));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const toastManager = new ToastManager();
|
|
59
|
+
exports.toast = {
|
|
60
|
+
show: (title, description, options) => {
|
|
61
|
+
toastManager.show({
|
|
62
|
+
title,
|
|
63
|
+
description,
|
|
64
|
+
...options,
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
hide: () => toastManager.hide(),
|
|
68
|
+
};
|
|
69
|
+
function useToast() {
|
|
70
|
+
const [toastState, setToastState] = (0, react_1.useState)(null);
|
|
71
|
+
(0, react_1.useEffect)(() => {
|
|
72
|
+
return toastManager.subscribe(setToastState);
|
|
33
73
|
}, []);
|
|
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
74
|
return {
|
|
37
|
-
|
|
38
|
-
|
|
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,
|
|
75
|
+
toast: toastState,
|
|
76
|
+
...exports.toast,
|
|
51
77
|
};
|
|
52
78
|
}
|
|
79
|
+
function ToastProvider() {
|
|
80
|
+
const [toastState, setToastState] = (0, react_1.useState)(null);
|
|
81
|
+
(0, react_1.useEffect)(() => {
|
|
82
|
+
return toastManager.subscribe(setToastState);
|
|
83
|
+
}, []);
|
|
84
|
+
if (!toastState?.open)
|
|
85
|
+
return null;
|
|
86
|
+
return ((0, jsx_runtime_1.jsx)(Toast, { open: toastState.open, onOpenChange: (open) => {
|
|
87
|
+
if (!open)
|
|
88
|
+
toastManager.hide();
|
|
89
|
+
}, title: toastState.title, description: toastState.description, actionLabel: toastState.actionLabel, onAction: toastState.onAction, duration: toastState.duration }));
|
|
90
|
+
}
|
|
53
91
|
function Toast({ open, onOpenChange, title, description, actionLabel = "Action", onAction, duration = 3, }) {
|
|
54
92
|
const [seconds, setSeconds] = (0, react_1.useState)(duration);
|
|
55
93
|
const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
56
|
-
const { theme } = (0,
|
|
94
|
+
const { theme } = (0, ui_1.useTheme)();
|
|
57
95
|
const [fadeAnim] = (0, react_1.useState)(new react_native_1.Animated.Value(0));
|
|
58
96
|
const { width } = (0, react_native_1.useWindowDimensions)();
|
|
59
97
|
const isWeb = react_native_1.Platform.OS === "web";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.viewVariants = exports.Center = exports.Column = exports.Row = exports.Overlay = exports.Surface = exports.Container = exports.Card = exports.View = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
6
|
const class_variance_authority_1 = require("class-variance-authority");
|
|
6
7
|
const react_1 = require("react");
|
|
7
8
|
const react_native_1 = require("react-native");
|
|
8
|
-
const atoms_1 = require("../../lib/theme/atoms");
|
|
9
9
|
const theme_1 = require("../../lib/theme/theme");
|
|
10
|
+
const zero = tslib_1.__importStar(require("../../ui"));
|
|
10
11
|
// View variants using class-variance-authority pattern
|
|
11
12
|
const viewVariants = (0, class_variance_authority_1.cva)("", {
|
|
12
13
|
variants: {
|
|
@@ -72,69 +73,61 @@ const viewVariants = (0, class_variance_authority_1.cva)("", {
|
|
|
72
73
|
});
|
|
73
74
|
exports.viewVariants = viewVariants;
|
|
74
75
|
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 {
|
|
76
|
-
// Map variant to styles
|
|
76
|
+
const { zero: zt } = (0, theme_1.useTheme)();
|
|
77
|
+
// Map variant to styles using theme.zero
|
|
77
78
|
const variantStyles = (() => {
|
|
78
79
|
switch (variant) {
|
|
79
80
|
case "card":
|
|
80
81
|
return {
|
|
81
|
-
|
|
82
|
-
borderRadius:
|
|
83
|
-
|
|
84
|
-
shadowOffset: { width: 0, height: 2 },
|
|
85
|
-
shadowOpacity: 0.1,
|
|
86
|
-
shadowRadius: 4,
|
|
87
|
-
elevation: 3,
|
|
82
|
+
...zt.bg.card,
|
|
83
|
+
borderRadius: zero.borderRadius.lg,
|
|
84
|
+
...zero.shadows.md,
|
|
88
85
|
};
|
|
89
86
|
case "overlay":
|
|
90
|
-
return
|
|
91
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
92
|
-
};
|
|
87
|
+
return zt.bg.overlay;
|
|
93
88
|
case "surface":
|
|
94
|
-
return
|
|
95
|
-
backgroundColor: theme.colors.background,
|
|
96
|
-
};
|
|
89
|
+
return zt.bg.background;
|
|
97
90
|
case "container":
|
|
98
91
|
return {
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
...zt.bg.background,
|
|
93
|
+
...zero.p[8],
|
|
101
94
|
};
|
|
102
95
|
default:
|
|
103
96
|
return {};
|
|
104
97
|
}
|
|
105
98
|
})();
|
|
106
|
-
// Map padding to
|
|
99
|
+
// Map padding to zero tokens
|
|
107
100
|
const paddingValue = (() => {
|
|
108
101
|
switch (padding) {
|
|
109
102
|
case "xs":
|
|
110
|
-
return
|
|
103
|
+
return zero.p[1];
|
|
111
104
|
case "sm":
|
|
112
|
-
return
|
|
105
|
+
return zero.p[2];
|
|
113
106
|
case "md":
|
|
114
|
-
return
|
|
107
|
+
return zero.p[4];
|
|
115
108
|
case "lg":
|
|
116
|
-
return
|
|
109
|
+
return zero.p[6];
|
|
117
110
|
case "xl":
|
|
118
|
-
return
|
|
111
|
+
return zero.p[8];
|
|
119
112
|
default:
|
|
120
|
-
return
|
|
113
|
+
return {};
|
|
121
114
|
}
|
|
122
115
|
})();
|
|
123
|
-
// Map margin to
|
|
116
|
+
// Map margin to zero tokens
|
|
124
117
|
const marginValue = (() => {
|
|
125
118
|
switch (margin) {
|
|
126
119
|
case "xs":
|
|
127
|
-
return
|
|
120
|
+
return zero.m[1];
|
|
128
121
|
case "sm":
|
|
129
|
-
return
|
|
122
|
+
return zero.m[2];
|
|
130
123
|
case "md":
|
|
131
|
-
return
|
|
124
|
+
return zero.m[4];
|
|
132
125
|
case "lg":
|
|
133
|
-
return
|
|
126
|
+
return zero.m[6];
|
|
134
127
|
case "xl":
|
|
135
|
-
return
|
|
128
|
+
return zero.m[8];
|
|
136
129
|
default:
|
|
137
|
-
return
|
|
130
|
+
return {};
|
|
138
131
|
}
|
|
139
132
|
})();
|
|
140
133
|
// Map flex direction
|
|
@@ -205,8 +198,8 @@ exports.View = (0, react_1.forwardRef)(({ variant = "default", padding = "none",
|
|
|
205
198
|
})();
|
|
206
199
|
const computedStyle = {
|
|
207
200
|
...variantStyles,
|
|
208
|
-
...
|
|
209
|
-
...
|
|
201
|
+
...paddingValue,
|
|
202
|
+
...marginValue,
|
|
210
203
|
flexDirection,
|
|
211
204
|
alignItems,
|
|
212
205
|
justifyContent,
|
|
@@ -221,13 +214,7 @@ exports.View = (0, react_1.forwardRef)(({ variant = "default", padding = "none",
|
|
|
221
214
|
...(borderColor && { borderColor }),
|
|
222
215
|
...(borderWidth !== undefined && { borderWidth }),
|
|
223
216
|
...(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
|
-
}),
|
|
217
|
+
...(shadow && zero.shadows.md),
|
|
231
218
|
};
|
|
232
219
|
const finalStyle = Array.isArray(style)
|
|
233
220
|
? [computedStyle, ...style]
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// awkward use of require()? you betcha. but import() with Metro causes it to try and
|
|
2
|
+
// resolve the package at compile-time even if not installed, so here we are.
|
|
3
|
+
let rnqc = null;
|
|
4
|
+
let expoCrypto = null;
|
|
5
|
+
try {
|
|
6
|
+
rnqc = require("react-native-quick-crypto");
|
|
7
|
+
}
|
|
8
|
+
catch (err) { }
|
|
9
|
+
try {
|
|
10
|
+
expoCrypto = require("expo-crypto");
|
|
11
|
+
}
|
|
12
|
+
catch (err) { }
|
|
13
|
+
if (!rnqc && !expoCrypto) {
|
|
14
|
+
throw new Error("Livestreaming requires one of react-native-quick-crypto or expo-crypto");
|
|
15
|
+
}
|
|
16
|
+
else if (!rnqc && expoCrypto) {
|
|
17
|
+
// @atproto/crypto dependencies expect crypto.getRandomValues to be a function
|
|
18
|
+
if (typeof globalThis.crypto === "undefined") {
|
|
19
|
+
globalThis.crypto = {};
|
|
20
|
+
}
|
|
21
|
+
if (typeof globalThis.crypto.getRandomValues === "undefined") {
|
|
22
|
+
globalThis.crypto.getRandomValues = expoCrypto.getRandomValues;
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.storage = exports.Dashboard = exports.VideoRetry = exports.zero = exports.ui = exports.PlayerUI = exports.Player = exports.usePlayerContext = exports.withPlayerProvider = exports.PlayerProvider = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
// barrel file :)
|
|
6
|
+
require("./crypto-polyfill");
|
|
6
7
|
tslib_1.__exportStar(require("./livestream-provider"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./livestream-store"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./player-store"), exports);
|
package/dist/lib/theme/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tokens = exports.atoms = exports.typographyAtoms = exports.layout = exports.iconSizes = exports.getPlatformTypography = exports.borders = exports.typography = exports.touchTargets = exports.spacing = exports.shadows = exports.colors = exports.breakpoints = exports.borderRadius = exports.animations = exports.useTheme = exports.usePlatformTypography = exports.lightTheme = exports.darkTheme = exports.createThemedStyles = exports.
|
|
3
|
+
exports.tokens = exports.atoms = exports.typographyAtoms = exports.layout = exports.iconSizes = exports.getPlatformTypography = exports.borders = exports.typography = exports.touchTargets = exports.spacing = exports.shadows = exports.colors = exports.breakpoints = exports.borderRadius = exports.animations = exports.useTheme = exports.usePlatformTypography = exports.lightTheme = exports.darkTheme = exports.createThemedStyles = exports.createThemeIcons = exports.createThemeColors = exports.ThemeProvider = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
// Main theme system exports
|
|
6
6
|
var theme_1 = require("./theme");
|
|
7
7
|
Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return theme_1.ThemeProvider; } });
|
|
8
8
|
Object.defineProperty(exports, "createThemeColors", { enumerable: true, get: function () { return theme_1.createThemeColors; } });
|
|
9
9
|
Object.defineProperty(exports, "createThemeIcons", { enumerable: true, get: function () { return theme_1.createThemeIcons; } });
|
|
10
|
-
Object.defineProperty(exports, "createThemeStyles", { enumerable: true, get: function () { return theme_1.createThemeStyles; } });
|
|
11
10
|
Object.defineProperty(exports, "createThemedStyles", { enumerable: true, get: function () { return theme_1.createThemedStyles; } });
|
|
12
11
|
Object.defineProperty(exports, "darkTheme", { enumerable: true, get: function () { return theme_1.darkTheme; } });
|
|
13
12
|
Object.defineProperty(exports, "lightTheme", { enumerable: true, get: function () { return theme_1.lightTheme; } });
|