@streamplace/components 0.7.18 → 0.7.21

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 (122) hide show
  1. package/dist/assets/emoji-data.json +19371 -0
  2. package/dist/components/chat/chat-box.js +319 -0
  3. package/dist/components/chat/chat-message.js +87 -0
  4. package/dist/components/chat/chat.js +150 -0
  5. package/dist/components/chat/emoji-suggestions.js +35 -0
  6. package/dist/components/chat/mention-suggestions.js +42 -0
  7. package/dist/components/chat/mod-view.js +112 -0
  8. package/dist/components/chat/system-message.js +19 -0
  9. package/dist/components/dashboard/chat-panel.js +38 -0
  10. package/dist/components/dashboard/header.js +80 -0
  11. package/dist/components/dashboard/index.js +14 -0
  12. package/dist/components/dashboard/information-widget.js +234 -0
  13. package/dist/components/dashboard/mod-actions.js +71 -0
  14. package/dist/components/dashboard/problems.js +74 -0
  15. package/dist/components/icons/bluesky-icon.js +9 -0
  16. package/dist/components/keep-awake.js +7 -0
  17. package/dist/components/keep-awake.native.js +16 -0
  18. package/dist/components/mobile-player/fullscreen.js +76 -0
  19. package/dist/components/mobile-player/fullscreen.native.js +141 -0
  20. package/dist/components/mobile-player/player.js +94 -0
  21. package/dist/components/mobile-player/props.js +2 -0
  22. package/dist/components/mobile-player/shared.js +54 -0
  23. package/dist/components/mobile-player/ui/autoplay-button.js +68 -0
  24. package/dist/components/mobile-player/ui/countdown.js +83 -0
  25. package/dist/components/mobile-player/ui/index.js +12 -0
  26. package/dist/components/mobile-player/ui/input.js +42 -0
  27. package/dist/components/mobile-player/ui/metrics.js +44 -0
  28. package/dist/components/mobile-player/ui/report-modal.js +90 -0
  29. package/dist/components/mobile-player/ui/streamer-context-menu.js +7 -0
  30. package/dist/components/mobile-player/ui/streamer-loading-overlay.js +104 -0
  31. package/dist/components/mobile-player/ui/viewer-context-menu.js +51 -0
  32. package/dist/components/mobile-player/ui/viewer-loading-overlay.js +49 -0
  33. package/dist/components/mobile-player/ui/viewers.js +23 -0
  34. package/dist/components/mobile-player/use-webrtc.js +243 -0
  35. package/dist/components/mobile-player/video-async.native.js +276 -0
  36. package/dist/components/mobile-player/video-retry.js +29 -0
  37. package/dist/components/mobile-player/video.js +475 -0
  38. package/dist/components/mobile-player/video.native.js +56 -0
  39. package/dist/components/mobile-player/webrtc-diagnostics.js +110 -0
  40. package/dist/components/mobile-player/webrtc-primitives.js +27 -0
  41. package/dist/components/mobile-player/webrtc-primitives.native.js +8 -0
  42. package/dist/components/share/sharesheet.js +91 -0
  43. package/dist/components/ui/button.js +223 -0
  44. package/dist/components/ui/dialog.js +206 -0
  45. package/dist/components/ui/dropdown.js +172 -0
  46. package/dist/components/ui/icons.js +25 -0
  47. package/dist/components/ui/index.js +34 -0
  48. package/dist/components/ui/info-box.js +31 -0
  49. package/dist/components/ui/info-row.js +23 -0
  50. package/dist/components/ui/input.js +205 -0
  51. package/dist/components/ui/loader.js +10 -0
  52. package/dist/components/ui/primitives/button.js +125 -0
  53. package/dist/components/ui/primitives/input.js +206 -0
  54. package/dist/components/ui/primitives/modal.js +206 -0
  55. package/dist/components/ui/primitives/text.js +292 -0
  56. package/dist/components/ui/resizeable.js +121 -0
  57. package/dist/components/ui/slider.js +5 -0
  58. package/dist/components/ui/text.js +177 -0
  59. package/dist/components/ui/textarea.js +19 -0
  60. package/dist/components/ui/toast.js +175 -0
  61. package/dist/components/ui/view.js +252 -0
  62. package/dist/hooks/index.js +14 -0
  63. package/dist/hooks/useAvatars.js +35 -0
  64. package/dist/hooks/useCameraToggle.js +12 -0
  65. package/dist/hooks/useKeyboard.js +36 -0
  66. package/dist/hooks/useKeyboardSlide.js +14 -0
  67. package/dist/hooks/useLivestreamInfo.js +69 -0
  68. package/dist/hooks/useOuterAndInnerDimensions.js +30 -0
  69. package/dist/hooks/usePlayerDimensions.js +22 -0
  70. package/dist/hooks/usePointerDevice.js +71 -0
  71. package/dist/hooks/useSegmentDimensions.js +17 -0
  72. package/dist/hooks/useSegmentTiming.js +65 -0
  73. package/dist/index.js +34 -0
  74. package/dist/lib/browser.js +35 -0
  75. package/dist/lib/facet.js +92 -0
  76. package/dist/lib/system-messages.js +101 -0
  77. package/dist/lib/theme/atoms.js +646 -0
  78. package/dist/lib/theme/atoms.types.js +6 -0
  79. package/dist/lib/theme/index.js +35 -0
  80. package/dist/lib/theme/theme.js +256 -0
  81. package/dist/lib/theme/tokens.js +659 -0
  82. package/dist/lib/utils.js +105 -0
  83. package/dist/livestream-provider/index.js +30 -0
  84. package/dist/livestream-provider/websocket.js +45 -0
  85. package/dist/livestream-store/chat.js +308 -0
  86. package/dist/livestream-store/context.js +5 -0
  87. package/dist/livestream-store/index.js +7 -0
  88. package/dist/livestream-store/livestream-state.js +2 -0
  89. package/dist/livestream-store/livestream-store.js +58 -0
  90. package/dist/livestream-store/problems.js +76 -0
  91. package/dist/livestream-store/stream-key.js +88 -0
  92. package/dist/livestream-store/websocket-consumer.js +94 -0
  93. package/dist/player-store/context.js +5 -0
  94. package/dist/player-store/index.js +9 -0
  95. package/dist/player-store/player-provider.js +58 -0
  96. package/dist/player-store/player-state.js +25 -0
  97. package/dist/player-store/player-store.js +201 -0
  98. package/dist/player-store/single-player-provider.js +121 -0
  99. package/dist/streamplace-provider/context.js +5 -0
  100. package/dist/streamplace-provider/index.js +20 -0
  101. package/dist/streamplace-provider/poller.js +49 -0
  102. package/dist/streamplace-provider/xrpc.js +0 -0
  103. package/dist/streamplace-store/block.js +65 -0
  104. package/dist/streamplace-store/index.js +6 -0
  105. package/dist/streamplace-store/stream.js +247 -0
  106. package/dist/streamplace-store/streamplace-store.js +47 -0
  107. package/dist/streamplace-store/user.js +52 -0
  108. package/dist/streamplace-store/xrpc.js +15 -0
  109. package/dist/ui/index.js +79 -0
  110. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
  111. package/package.json +5 -4
  112. package/src/components/chat/chat-box.tsx +3 -0
  113. package/src/components/chat/mod-view.tsx +39 -5
  114. package/src/components/mobile-player/fullscreen.tsx +2 -0
  115. package/src/components/mobile-player/ui/autoplay-button.tsx +86 -0
  116. package/src/components/mobile-player/ui/index.ts +1 -0
  117. package/src/components/mobile-player/video.tsx +11 -1
  118. package/src/livestream-store/chat.tsx +22 -0
  119. package/src/player-store/player-provider.tsx +2 -1
  120. package/src/player-store/player-state.tsx +6 -0
  121. package/src/player-store/player-store.tsx +4 -0
  122. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InputPrimitive = exports.InputGroup = exports.InputAddon = exports.InputError = exports.InputDescription = exports.InputLabel = exports.InputContainer = exports.InputRoot = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = tslib_1.__importStar(require("react"));
7
+ const react_native_1 = require("react-native");
8
+ // Input root primitive - the main TextInput component
9
+ exports.InputRoot = (0, react_1.forwardRef)(({ value, onChangeText, onChange, onFocus, onBlur, error = false, disabled = false, loading = false, editable, style, placeholderTextColor = "#9ca3af", ...props }, ref) => {
10
+ const [isFocused, setIsFocused] = react_1.default.useState(false);
11
+ const handleChangeText = react_1.default.useCallback((text) => {
12
+ if (onChangeText) {
13
+ onChangeText(text);
14
+ }
15
+ if (onChange) {
16
+ onChange(text);
17
+ }
18
+ }, [onChangeText, onChange]);
19
+ const handleFocus = react_1.default.useCallback((event) => {
20
+ setIsFocused(true);
21
+ if (onFocus) {
22
+ onFocus(event);
23
+ }
24
+ }, [onFocus]);
25
+ const handleBlur = react_1.default.useCallback((event) => {
26
+ setIsFocused(false);
27
+ if (onBlur) {
28
+ onBlur(event);
29
+ }
30
+ }, [onBlur]);
31
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TextInput, { ref: ref, value: value, onChangeText: handleChangeText, onFocus: handleFocus, onBlur: handleBlur, editable: !disabled && !loading && editable, placeholderTextColor: placeholderTextColor, style: [
32
+ primitiveStyles.input,
33
+ style,
34
+ error && primitiveStyles.inputError,
35
+ disabled && primitiveStyles.inputDisabled,
36
+ loading && primitiveStyles.inputLoading,
37
+ ], ...props }));
38
+ });
39
+ exports.InputRoot.displayName = "InputRoot";
40
+ exports.InputContainer = (0, react_1.forwardRef)(({ children, focused = false, error = false, disabled = false, style, ...props }, ref) => {
41
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [
42
+ primitiveStyles.container,
43
+ style,
44
+ focused && primitiveStyles.containerFocused,
45
+ error && primitiveStyles.containerError,
46
+ disabled && primitiveStyles.containerDisabled,
47
+ ], ...props, children: children }));
48
+ });
49
+ exports.InputContainer.displayName = "InputContainer";
50
+ exports.InputLabel = (0, react_1.forwardRef)(({ children, required = false, disabled = false, error = false, style, ...props }, ref) => {
51
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.Text, { ref: ref, style: [
52
+ primitiveStyles.label,
53
+ style,
54
+ error && primitiveStyles.labelError,
55
+ disabled && primitiveStyles.labelDisabled,
56
+ ], ...props, children: [children, required && (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: primitiveStyles.required, children: " *" })] }));
57
+ });
58
+ exports.InputLabel.displayName = "InputLabel";
59
+ exports.InputDescription = (0, react_1.forwardRef)(({ children, error = false, disabled = false, style, ...props }, ref) => {
60
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [
61
+ primitiveStyles.description,
62
+ style,
63
+ error && primitiveStyles.descriptionError,
64
+ disabled && primitiveStyles.descriptionDisabled,
65
+ ], ...props, children: children }));
66
+ });
67
+ exports.InputDescription.displayName = "InputDescription";
68
+ exports.InputError = (0, react_1.forwardRef)(({ children, visible = true, style, ...props }, ref) => {
69
+ if (!visible || !children)
70
+ return null;
71
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [primitiveStyles.error, style], ...props, children: children }));
72
+ });
73
+ exports.InputError.displayName = "InputError";
74
+ exports.InputAddon = (0, react_1.forwardRef)(({ children, position = "left", touchable = false, onPress, style, ...props }, ref) => {
75
+ const addonStyle = [
76
+ primitiveStyles.addon,
77
+ primitiveStyles[`addon${position.charAt(0).toUpperCase() + position.slice(1)}`],
78
+ style,
79
+ ];
80
+ if (touchable && onPress) {
81
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { ref: ref, style: addonStyle, onPress: onPress, ...props, children: children }));
82
+ }
83
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: addonStyle, ...props, children: children }));
84
+ });
85
+ exports.InputAddon.displayName = "InputAddon";
86
+ exports.InputGroup = (0, react_1.forwardRef)(({ children, spacing = 8, style, ...props }, ref) => {
87
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [primitiveStyles.group, { gap: spacing }, style], ...props, children: children }));
88
+ });
89
+ exports.InputGroup.displayName = "InputGroup";
90
+ // Primitive styles (minimal, unstyled)
91
+ const primitiveStyles = react_native_1.StyleSheet.create({
92
+ input: {
93
+ minHeight: 44, // iOS minimum touch target
94
+ paddingHorizontal: 12,
95
+ paddingVertical: 8,
96
+ fontSize: 16,
97
+ borderWidth: 1,
98
+ borderColor: "#d1d5db",
99
+ borderRadius: 8,
100
+ backgroundColor: "white",
101
+ ...react_native_1.Platform.select({
102
+ ios: {
103
+ paddingVertical: 12,
104
+ },
105
+ android: {
106
+ paddingVertical: 8,
107
+ textAlignVertical: "center",
108
+ },
109
+ }),
110
+ },
111
+ inputFocused: {
112
+ // No focus styles for the actual input
113
+ },
114
+ inputError: {
115
+ borderColor: "#ef4444",
116
+ borderWidth: 1,
117
+ },
118
+ inputDisabled: {
119
+ backgroundColor: "#f3f4f6",
120
+ borderColor: "#e5e7eb",
121
+ opacity: 0.6,
122
+ },
123
+ inputLoading: {
124
+ opacity: 0.7,
125
+ },
126
+ container: {
127
+ flexDirection: "row",
128
+ alignItems: "center",
129
+ borderWidth: 1,
130
+ borderColor: "#d1d5db",
131
+ borderRadius: 8,
132
+ backgroundColor: "white",
133
+ paddingHorizontal: 12,
134
+ minHeight: 44,
135
+ },
136
+ containerFocused: {
137
+ borderColor: "#3b82f6",
138
+ borderWidth: 1,
139
+ },
140
+ containerError: {
141
+ borderColor: "#ef4444",
142
+ borderWidth: 1,
143
+ },
144
+ containerDisabled: {
145
+ backgroundColor: "#f3f4f6",
146
+ borderColor: "#e5e7eb",
147
+ opacity: 0.6,
148
+ },
149
+ label: {
150
+ fontSize: 14,
151
+ fontWeight: "500",
152
+ color: "#374151",
153
+ marginBottom: 4,
154
+ },
155
+ labelError: {
156
+ color: "#ef4444",
157
+ },
158
+ labelDisabled: {
159
+ color: "#9ca3af",
160
+ opacity: 0.6,
161
+ },
162
+ required: {
163
+ color: "#ef4444",
164
+ },
165
+ description: {
166
+ fontSize: 12,
167
+ color: "#6b7280",
168
+ marginTop: 4,
169
+ },
170
+ descriptionError: {
171
+ color: "#ef4444",
172
+ },
173
+ descriptionDisabled: {
174
+ color: "#9ca3af",
175
+ opacity: 0.6,
176
+ },
177
+ error: {
178
+ fontSize: 12,
179
+ color: "#ef4444",
180
+ marginTop: 4,
181
+ },
182
+ addon: {
183
+ alignItems: "center",
184
+ justifyContent: "center",
185
+ paddingHorizontal: 8,
186
+ },
187
+ addonLeft: {
188
+ marginRight: 8,
189
+ },
190
+ addonRight: {
191
+ marginLeft: 8,
192
+ },
193
+ group: {
194
+ flexDirection: "column",
195
+ },
196
+ });
197
+ // Export primitive collection
198
+ exports.InputPrimitive = {
199
+ Root: exports.InputRoot,
200
+ Container: exports.InputContainer,
201
+ Label: exports.InputLabel,
202
+ Description: exports.InputDescription,
203
+ Error: exports.InputError,
204
+ Addon: exports.InputAddon,
205
+ Group: exports.InputGroup,
206
+ };
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModalPrimitive = exports.ModalClose = exports.ModalFooter = exports.ModalBody = exports.ModalHeader = exports.ModalContent = exports.ModalOverlay = exports.ModalRoot = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = tslib_1.__importStar(require("react"));
7
+ const react_native_1 = require("react-native");
8
+ const { width: screenWidth, height: screenHeight } = react_native_1.Dimensions.get("window");
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", transparent = true, statusBarTranslucent = react_native_1.Platform.OS === "android", ...props }, ref) => {
11
+ const handleRequestClose = react_1.default.useCallback((e) => {
12
+ if (onOpenChange) {
13
+ onOpenChange(false);
14
+ }
15
+ if (onRequestClose) {
16
+ onRequestClose(e);
17
+ }
18
+ }, [onOpenChange, onRequestClose]);
19
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: open, onRequestClose: handleRequestClose, animationType: animationType, presentationStyle: presentationStyle, transparent: transparent, statusBarTranslucent: statusBarTranslucent, ...props, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: primitiveStyles.container, children: children }) }));
20
+ });
21
+ exports.ModalRoot.displayName = "ModalRoot";
22
+ exports.ModalOverlay = (0, react_1.forwardRef)(({ dismissible = true, onDismiss, onPress, style, children, activeOpacity = 1, ...props }, ref) => {
23
+ const handlePress = react_1.default.useCallback((event) => {
24
+ if (dismissible && onDismiss) {
25
+ onDismiss();
26
+ }
27
+ if (onPress) {
28
+ onPress(event);
29
+ }
30
+ }, [dismissible, onDismiss, onPress]);
31
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { ref: ref, style: [primitiveStyles.overlay, style], activeOpacity: activeOpacity, onPress: handlePress, ...props, children: children }));
32
+ });
33
+ exports.ModalOverlay.displayName = "ModalOverlay";
34
+ exports.ModalContent = (0, react_1.forwardRef)(({ children, position = "center", size = "md", style, onStartShouldSetResponder, ...props }, ref) => {
35
+ // Prevent touches from propagating to overlay
36
+ const handleStartShouldSetResponder = react_1.default.useCallback(() => {
37
+ return true;
38
+ }, []);
39
+ const positionStyle = react_1.default.useMemo(() => {
40
+ switch (position) {
41
+ case "top":
42
+ return primitiveStyles.contentTop;
43
+ case "bottom":
44
+ return primitiveStyles.contentBottom;
45
+ case "left":
46
+ return primitiveStyles.contentLeft;
47
+ case "right":
48
+ return primitiveStyles.contentRight;
49
+ case "center":
50
+ default:
51
+ return primitiveStyles.contentCenter;
52
+ }
53
+ }, [position]);
54
+ const sizeStyle = react_1.default.useMemo(() => {
55
+ switch (size) {
56
+ case "sm":
57
+ return primitiveStyles.sizeSm;
58
+ case "lg":
59
+ return primitiveStyles.sizeLg;
60
+ case "xl":
61
+ return primitiveStyles.sizeXl;
62
+ case "full":
63
+ return primitiveStyles.sizeFull;
64
+ case "md":
65
+ default:
66
+ return primitiveStyles.sizeMd;
67
+ }
68
+ }, [size]);
69
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [primitiveStyles.content, positionStyle, sizeStyle, style], onStartShouldSetResponder: onStartShouldSetResponder || handleStartShouldSetResponder, ...props, children: children }));
70
+ });
71
+ exports.ModalContent.displayName = "ModalContent";
72
+ exports.ModalHeader = (0, react_1.forwardRef)(({ children, withBorder = false, style, ...props }, ref) => {
73
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [
74
+ primitiveStyles.header,
75
+ withBorder && primitiveStyles.headerBorder,
76
+ style,
77
+ ], ...props, children: children }));
78
+ });
79
+ exports.ModalHeader.displayName = "ModalHeader";
80
+ exports.ModalBody = (0, react_1.forwardRef)(({ children, scrollable = true, style, ...props }, ref) => {
81
+ if (!scrollable) {
82
+ return (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [primitiveStyles.body, style], children: children });
83
+ }
84
+ return ((0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { ref: ref, style: [primitiveStyles.body, style], showsVerticalScrollIndicator: false, keyboardShouldPersistTaps: "handled", ...props, children: children }));
85
+ });
86
+ exports.ModalBody.displayName = "ModalBody";
87
+ exports.ModalFooter = (0, react_1.forwardRef)(({ children, withBorder = false, direction = "row", justify = "flex-end", style, ...props }, ref) => {
88
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [
89
+ primitiveStyles.footer,
90
+ withBorder && primitiveStyles.footerBorder,
91
+ {
92
+ flexDirection: direction,
93
+ justifyContent: justify,
94
+ },
95
+ style,
96
+ ], ...props, children: children }));
97
+ });
98
+ exports.ModalFooter.displayName = "ModalFooter";
99
+ exports.ModalClose = (0, react_1.forwardRef)(({ children, onClose, onPress, ...props }, ref) => {
100
+ const handlePress = react_1.default.useCallback((event) => {
101
+ if (onClose) {
102
+ onClose();
103
+ }
104
+ if (onPress) {
105
+ onPress(event);
106
+ }
107
+ }, [onClose, onPress]);
108
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { ref: ref, onPress: handlePress, ...props, children: children }));
109
+ });
110
+ exports.ModalClose.displayName = "ModalClose";
111
+ // Primitive styles (minimal, unstyled)
112
+ const primitiveStyles = react_native_1.StyleSheet.create({
113
+ container: {
114
+ flex: 1,
115
+ },
116
+ overlay: {
117
+ flex: 1,
118
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
119
+ justifyContent: "center",
120
+ alignItems: "center",
121
+ padding: 16,
122
+ },
123
+ content: {
124
+ borderRadius: 8,
125
+ overflow: "hidden",
126
+ },
127
+ contentCenter: {
128
+ alignSelf: "center",
129
+ },
130
+ contentTop: {
131
+ alignSelf: "center",
132
+ marginTop: 0,
133
+ },
134
+ contentBottom: {
135
+ alignSelf: "center",
136
+ marginTop: "auto",
137
+ },
138
+ contentLeft: {
139
+ alignSelf: "flex-start",
140
+ marginRight: "auto",
141
+ },
142
+ contentRight: {
143
+ alignSelf: "flex-end",
144
+ marginLeft: "auto",
145
+ },
146
+ sizeSm: {
147
+ maxWidth: screenWidth * 0.4,
148
+ maxHeight: screenHeight * 0.6,
149
+ },
150
+ sizeMd: {
151
+ maxWidth: screenWidth * 0.6,
152
+ maxHeight: screenHeight * 0.8,
153
+ },
154
+ sizeLg: {
155
+ maxWidth: screenWidth * 0.8,
156
+ maxHeight: screenHeight * 0.9,
157
+ },
158
+ sizeXl: {
159
+ maxWidth: screenWidth * 0.95,
160
+ maxHeight: screenHeight * 0.95,
161
+ },
162
+ sizeFull: {
163
+ width: screenWidth,
164
+ height: screenHeight,
165
+ maxWidth: screenWidth,
166
+ maxHeight: screenHeight,
167
+ borderRadius: 0,
168
+ },
169
+ header: {
170
+ paddingHorizontal: 16,
171
+ paddingVertical: 12,
172
+ flexDirection: "row",
173
+ alignItems: "center",
174
+ justifyContent: "space-between",
175
+ },
176
+ headerBorder: {
177
+ borderBottomWidth: 1,
178
+ borderBottomColor: "#e5e7eb",
179
+ },
180
+ body: {
181
+ flex: 1,
182
+ paddingHorizontal: 16,
183
+ paddingVertical: 12,
184
+ },
185
+ footer: {
186
+ paddingHorizontal: 16,
187
+ paddingVertical: 12,
188
+ flexDirection: "row",
189
+ alignItems: "center",
190
+ gap: 8,
191
+ },
192
+ footerBorder: {
193
+ borderTopWidth: 1,
194
+ borderTopColor: "#e5e7eb",
195
+ },
196
+ });
197
+ // Export primitive collection
198
+ exports.ModalPrimitive = {
199
+ Root: exports.ModalRoot,
200
+ Overlay: exports.ModalOverlay,
201
+ Content: exports.ModalContent,
202
+ Header: exports.ModalHeader,
203
+ Body: exports.ModalBody,
204
+ Footer: exports.ModalFooter,
205
+ Close: exports.ModalClose,
206
+ };
@@ -0,0 +1,292 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextPrimitive = exports.TextBlock = exports.TextSpan = exports.TextRoot = exports.TextContext = void 0;
4
+ exports.objectFromObjects = objectFromObjects;
5
+ exports.useTextContext = useTextContext;
6
+ exports.createTextStyle = createTextStyle;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const react_native_1 = require("react-native");
10
+ const theme_1 = require("../../../lib/theme/theme");
11
+ const tokens_1 = require("../../../lib/theme/tokens");
12
+ exports.TextContext = (0, react_1.createContext)(null);
13
+ function objectFromObjects(arr) {
14
+ return Object.assign({}, ...arr);
15
+ }
16
+ // Size mapping
17
+ const sizeMap = {
18
+ xs: 12,
19
+ sm: 14,
20
+ base: 16,
21
+ lg: 18,
22
+ xl: 20,
23
+ "2xl": 24,
24
+ "3xl": 30,
25
+ "4xl": 36,
26
+ };
27
+ // Weight mapping
28
+ const weightMap = {
29
+ thin: "100",
30
+ light: "300",
31
+ normal: "400",
32
+ medium: "500",
33
+ semibold: "600",
34
+ bold: "700",
35
+ extrabold: "800",
36
+ black: "900",
37
+ };
38
+ // Line height mapping
39
+ const leadingMap = {
40
+ none: 1,
41
+ tight: 1.2,
42
+ snug: 1.3,
43
+ normal: 1.5,
44
+ relaxed: 1.7,
45
+ loose: 2,
46
+ };
47
+ // Letter spacing mapping
48
+ const trackingMap = {
49
+ tighter: -0.8,
50
+ tight: -0.4,
51
+ normal: 0,
52
+ wide: 0.4,
53
+ wider: 0.8,
54
+ widest: 1.6,
55
+ };
56
+ // Variant definitions (platform-aware)
57
+ const getVariantStyles = () => {
58
+ // get platform-specific typography
59
+ // iOS, Android, Web (Universal)
60
+ const typographicPlatform = (react_native_1.Platform.OS === "ios"
61
+ ? "ios"
62
+ : react_native_1.Platform.OS === "android"
63
+ ? "android"
64
+ : "universal");
65
+ const platformTypography = tokens_1.typography[typographicPlatform];
66
+ if (!platformTypography) {
67
+ throw new Error("Platform typography not defined");
68
+ }
69
+ // Define mapping based on platform
70
+ if (typographicPlatform === "ios") {
71
+ return {
72
+ h1: platformTypography.largeTitle,
73
+ h2: platformTypography.title1,
74
+ h3: platformTypography.title2,
75
+ h4: platformTypography.title3,
76
+ h5: platformTypography.headline,
77
+ h6: platformTypography.headline,
78
+ subtitle1: platformTypography.subhead,
79
+ subtitle2: platformTypography.footnote,
80
+ body1: platformTypography.body,
81
+ body2: platformTypography.callout,
82
+ caption: platformTypography.caption1,
83
+ overline: platformTypography.caption2,
84
+ };
85
+ }
86
+ else if (typographicPlatform === "android") {
87
+ return {
88
+ h1: platformTypography.headline1,
89
+ h2: platformTypography.headline2,
90
+ h3: platformTypography.headline3,
91
+ h4: platformTypography.headline4,
92
+ h5: platformTypography.headline5,
93
+ h6: platformTypography.headline6,
94
+ subtitle1: platformTypography.subtitle1,
95
+ subtitle2: platformTypography.subtitle2,
96
+ body1: platformTypography.body1,
97
+ body2: platformTypography.body2,
98
+ caption: platformTypography.caption,
99
+ overline: platformTypography.overline,
100
+ };
101
+ }
102
+ else {
103
+ // universal
104
+ // Map variants to universal sizes
105
+ return {
106
+ h1: platformTypography["4xl"],
107
+ h2: platformTypography["3xl"],
108
+ h3: platformTypography["2xl"],
109
+ h4: platformTypography["xl"],
110
+ h5: platformTypography["lg"],
111
+ h6: platformTypography["base"],
112
+ subtitle1: platformTypography.base,
113
+ subtitle2: platformTypography.sm,
114
+ body1: platformTypography.base,
115
+ body2: platformTypography.sm,
116
+ caption: platformTypography.xs,
117
+ overline: platformTypography.xs,
118
+ };
119
+ }
120
+ };
121
+ // Text root primitive
122
+ exports.TextRoot = (0, react_1.forwardRef)(({ variant, size, weight, color, align, leading, tracking, transform, decoration, italic = false, opacity, style, inherit = true, reset = false, children, ...props }, ref) => {
123
+ const { theme } = (0, theme_1.useTheme)();
124
+ const parentContext = (0, react_1.useContext)(exports.TextContext);
125
+ // Get variant styles
126
+ const variantStyles = getVariantStyles();
127
+ // Calculate inherited values
128
+ const inheritedContext = inherit && !reset && parentContext ? parentContext : {};
129
+ // Calculate final styles
130
+ const finalStyles = {
131
+ // Start with inherited values
132
+ fontSize: inheritedContext.fontSize,
133
+ fontWeight: inheritedContext.fontWeight,
134
+ //color: inheritedContext.color,
135
+ fontFamily: inheritedContext.fontFamily,
136
+ lineHeight: inheritedContext.lineHeight,
137
+ textAlign: inheritedContext.textAlign,
138
+ letterSpacing: inheritedContext.letterSpacing,
139
+ textTransform: inheritedContext.textTransform,
140
+ textDecorationLine: inheritedContext.textDecorationLine,
141
+ fontStyle: inheritedContext.fontStyle,
142
+ opacity: inheritedContext.opacity,
143
+ // Apply variant styles (these may override inherited)
144
+ ...(variant && variantStyles[variant]),
145
+ // Apply explicit prop styles (these should override inherited and variant)
146
+ // Apply size
147
+ ...(size && {
148
+ fontSize: typeof size === "number" ? size : sizeMap[size],
149
+ }),
150
+ // Apply weight
151
+ ...(weight && {
152
+ fontWeight: weightMap[weight],
153
+ }),
154
+ // Apply color
155
+ ...(color
156
+ ? {
157
+ color: color === "default"
158
+ ? theme.colors.text
159
+ : color === "muted"
160
+ ? theme.colors.textMuted
161
+ : color === "primary"
162
+ ? theme.colors.primary
163
+ : color === "secondary"
164
+ ? theme.colors.secondary
165
+ : color === "destructive"
166
+ ? theme.colors.destructive
167
+ : color === "success"
168
+ ? theme.colors.success
169
+ : color === "warning"
170
+ ? theme.colors.warning
171
+ : color || inheritedContext.color, // Custom color string
172
+ }
173
+ : { color: inheritedContext.color || theme.colors.text }),
174
+ // Apply alignment
175
+ ...(align && {
176
+ textAlign: align,
177
+ }),
178
+ // Apply line height
179
+ ...(leading && {
180
+ lineHeight: typeof leading === "number" ? leading : leadingMap[leading],
181
+ }),
182
+ // Apply letter spacing
183
+ ...(tracking && {
184
+ letterSpacing: typeof tracking === "number" ? tracking : trackingMap[tracking],
185
+ }),
186
+ // Apply text transform
187
+ ...(transform &&
188
+ transform !== "none" && {
189
+ textTransform: transform,
190
+ }),
191
+ // Apply text decoration
192
+ ...(decoration &&
193
+ decoration !== "none" && {
194
+ textDecorationLine: decoration,
195
+ }),
196
+ // Apply italic
197
+ ...(italic && {
198
+ fontStyle: "italic",
199
+ }),
200
+ // Apply opacity
201
+ ...(opacity !== undefined && {
202
+ opacity,
203
+ }),
204
+ };
205
+ finalStyles.color = finalStyles.color;
206
+ // Create context value for children
207
+ const contextValue = {
208
+ fontSize: typeof finalStyles.fontSize === "number"
209
+ ? finalStyles.fontSize
210
+ : undefined,
211
+ fontWeight: finalStyles.fontWeight,
212
+ color: finalStyles.color || undefined,
213
+ fontFamily: typeof finalStyles.fontFamily === "string"
214
+ ? finalStyles.fontFamily
215
+ : undefined,
216
+ lineHeight: typeof finalStyles.lineHeight === "number"
217
+ ? finalStyles.lineHeight
218
+ : undefined,
219
+ textAlign: finalStyles.textAlign,
220
+ letterSpacing: finalStyles.letterSpacing,
221
+ textTransform: finalStyles.textTransform,
222
+ textDecorationLine: finalStyles.textDecorationLine,
223
+ fontStyle: finalStyles.fontStyle,
224
+ opacity: finalStyles.opacity,
225
+ };
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, style], ...props, children: children }) }));
227
+ });
228
+ exports.TextRoot.displayName = "TextRoot";
229
+ // Text span primitive (inherits from parent but doesn't create new context)
230
+ exports.TextSpan = (0, react_1.forwardRef)(({ children, ...props }, ref) => {
231
+ return ((0, jsx_runtime_1.jsx)(exports.TextRoot, { ref: ref, inherit: true, ...props, children: children }));
232
+ });
233
+ exports.TextSpan.displayName = "TextSpan";
234
+ // Text block primitive (always creates new context)
235
+ exports.TextBlock = (0, react_1.forwardRef)(({ children, reset = true, ...props }, ref) => {
236
+ return ((0, jsx_runtime_1.jsx)(exports.TextRoot, { ref: ref, reset: reset, ...props, children: children }));
237
+ });
238
+ exports.TextBlock.displayName = "TextBlock";
239
+ // Hook to access current text context
240
+ function useTextContext() {
241
+ return (0, react_1.useContext)(exports.TextContext);
242
+ }
243
+ // Utility function to create text styles
244
+ function createTextStyle(props) {
245
+ // This is a utility function that can be used to generate styles
246
+ // without rendering a component
247
+ const style = {};
248
+ if (props.size) {
249
+ style.fontSize =
250
+ typeof props.size === "number" ? props.size : sizeMap[props.size];
251
+ }
252
+ if (props.weight) {
253
+ style.fontWeight = weightMap[props.weight];
254
+ }
255
+ if (props.align) {
256
+ style.textAlign = props.align;
257
+ }
258
+ if (props.leading) {
259
+ style.lineHeight =
260
+ typeof props.leading === "number"
261
+ ? props.leading
262
+ : leadingMap[props.leading];
263
+ }
264
+ if (props.tracking) {
265
+ style.letterSpacing =
266
+ typeof props.tracking === "number"
267
+ ? props.tracking
268
+ : trackingMap[props.tracking];
269
+ }
270
+ if (props.transform && props.transform !== "none") {
271
+ style.textTransform = props.transform;
272
+ }
273
+ if (props.decoration && props.decoration !== "none") {
274
+ style.textDecorationLine = props.decoration;
275
+ }
276
+ if (props.italic) {
277
+ style.fontStyle = "italic";
278
+ }
279
+ if (props.opacity !== undefined) {
280
+ style.opacity = props.opacity;
281
+ }
282
+ return style;
283
+ }
284
+ // Export primitive collection
285
+ exports.TextPrimitive = {
286
+ Root: exports.TextRoot,
287
+ Span: exports.TextSpan,
288
+ Block: exports.TextBlock,
289
+ Context: exports.TextContext,
290
+ useContext: useTextContext,
291
+ createStyle: createTextStyle,
292
+ };