@oxyhq/bloom 0.1.25 → 0.1.27

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 (57) hide show
  1. package/lib/commonjs/assets.d.js +2 -0
  2. package/lib/commonjs/assets.d.js.map +1 -0
  3. package/lib/commonjs/avatar/Avatar.js +10 -3
  4. package/lib/commonjs/avatar/Avatar.js.map +1 -1
  5. package/lib/commonjs/avatar/index.js +5 -1
  6. package/lib/commonjs/avatar/index.js.map +1 -1
  7. package/lib/commonjs/bottom-sheet/index.js +3 -3
  8. package/lib/commonjs/bottom-sheet/index.js.map +1 -1
  9. package/lib/commonjs/loading/Loading.js +5 -1
  10. package/lib/commonjs/loading/Loading.js.map +1 -1
  11. package/lib/commonjs/loading/SpinnerIcon.js +10 -2
  12. package/lib/commonjs/loading/SpinnerIcon.js.map +1 -1
  13. package/lib/commonjs/theme/adaptive-colors.js +6 -2
  14. package/lib/commonjs/theme/adaptive-colors.js.map +1 -1
  15. package/lib/commonjs/theme/color-presets.js +48 -1
  16. package/lib/commonjs/theme/color-presets.js.map +1 -1
  17. package/lib/module/assets.d.js +2 -0
  18. package/lib/module/assets.d.js.map +1 -0
  19. package/lib/module/avatar/Avatar.js +9 -3
  20. package/lib/module/avatar/Avatar.js.map +1 -1
  21. package/lib/module/avatar/index.js +4 -1
  22. package/lib/module/avatar/index.js.map +1 -1
  23. package/lib/module/bottom-sheet/index.js +3 -3
  24. package/lib/module/bottom-sheet/index.js.map +1 -1
  25. package/lib/module/loading/Loading.js +5 -1
  26. package/lib/module/loading/Loading.js.map +1 -1
  27. package/lib/module/loading/SpinnerIcon.js +10 -2
  28. package/lib/module/loading/SpinnerIcon.js.map +1 -1
  29. package/lib/module/theme/adaptive-colors.js +6 -2
  30. package/lib/module/theme/adaptive-colors.js.map +1 -1
  31. package/lib/module/theme/color-presets.js +48 -1
  32. package/lib/module/theme/color-presets.js.map +1 -1
  33. package/lib/typescript/commonjs/avatar/Avatar.d.ts.map +1 -1
  34. package/lib/typescript/commonjs/avatar/index.d.ts +1 -1
  35. package/lib/typescript/commonjs/avatar/index.d.ts.map +1 -1
  36. package/lib/typescript/commonjs/loading/Loading.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/loading/SpinnerIcon.d.ts.map +1 -1
  38. package/lib/typescript/commonjs/theme/adaptive-colors.d.ts.map +1 -1
  39. package/lib/typescript/commonjs/theme/color-presets.d.ts +1 -1
  40. package/lib/typescript/commonjs/theme/color-presets.d.ts.map +1 -1
  41. package/lib/typescript/module/avatar/Avatar.d.ts.map +1 -1
  42. package/lib/typescript/module/avatar/index.d.ts +1 -1
  43. package/lib/typescript/module/avatar/index.d.ts.map +1 -1
  44. package/lib/typescript/module/loading/Loading.d.ts.map +1 -1
  45. package/lib/typescript/module/loading/SpinnerIcon.d.ts.map +1 -1
  46. package/lib/typescript/module/theme/adaptive-colors.d.ts.map +1 -1
  47. package/lib/typescript/module/theme/color-presets.d.ts +1 -1
  48. package/lib/typescript/module/theme/color-presets.d.ts.map +1 -1
  49. package/package.json +1 -1
  50. package/src/assets.d.ts +26 -0
  51. package/src/avatar/Avatar.tsx +8 -2
  52. package/src/avatar/index.ts +4 -1
  53. package/src/bottom-sheet/index.tsx +3 -3
  54. package/src/loading/Loading.tsx +5 -1
  55. package/src/loading/SpinnerIcon.tsx +10 -2
  56. package/src/theme/adaptive-colors.ts +6 -2
  57. package/src/theme/color-presets.ts +50 -2
@@ -0,0 +1,26 @@
1
+ /** Ambient module declarations for static image assets (Metro + web bundlers). */
2
+
3
+ declare module '*.jpg' {
4
+ const value: number; // Metro returns a numeric asset ID; web bundlers return a URL string at runtime
5
+ export default value;
6
+ }
7
+
8
+ declare module '*.jpeg' {
9
+ const value: number;
10
+ export default value;
11
+ }
12
+
13
+ declare module '*.png' {
14
+ const value: number;
15
+ export default value;
16
+ }
17
+
18
+ declare module '*.gif' {
19
+ const value: number;
20
+ export default value;
21
+ }
22
+
23
+ declare module '*.webp' {
24
+ const value: number;
25
+ export default value;
26
+ }
@@ -7,7 +7,8 @@ import { useAvatarPlaceholder } from './placeholder-context';
7
7
  import type { AvatarProps } from './types';
8
8
 
9
9
  // Built-in default avatar image — used when no source, fallbackSource, or placeholderIcon is provided
10
- const DEFAULT_AVATAR_IMAGE = require('./default-avatar.jpg');
10
+ // ESM static import works in both Metro (RN 0.72+) and web bundlers (Vite, webpack).
11
+ import DEFAULT_AVATAR_IMAGE from './default-avatar.jpg';
11
12
 
12
13
  // Squircle clip path normalized to 0–1 coordinate space (viewBox="0 0 1 1").
13
14
  const SQUIRCLE_PATH =
@@ -28,7 +29,12 @@ function getSvgModule(): SvgModuleType | null {
28
29
  if (!svgModuleResolved) {
29
30
  svgModuleResolved = true;
30
31
  try {
31
- svgModule = require('react-native-svg');
32
+ // Guard for ESM environments (Vite/browser) where require is not defined.
33
+ // In React Native (Metro), require is always available.
34
+ if (typeof require !== 'undefined') {
35
+ const moduleName = 'react-native-svg';
36
+ svgModule = require(moduleName);
37
+ }
32
38
  } catch {
33
39
  svgModule = null;
34
40
  }
@@ -3,5 +3,8 @@ export { AvatarPlaceholderProvider } from './placeholder-context';
3
3
  export type { AvatarPlaceholderConfig } from './placeholder-context';
4
4
  export type { AvatarProps, AvatarShape } from './types';
5
5
 
6
+ // ESM static import works in both Metro (RN 0.72+) and web bundlers (Vite, webpack).
7
+ import defaultAvatar from './default-avatar.jpg';
8
+
6
9
  /** Default avatar placeholder image — use as `fallbackSource` on Avatar or in AvatarPlaceholderProvider */
7
- export const defaultAvatarSource = require('./default-avatar.jpg');
10
+ export const defaultAvatarSource = defaultAvatar;
@@ -26,10 +26,10 @@ import { useTheme } from '../theme/use-theme';
26
26
  // Keyboard handler — only on native platforms. On web, keyboard events are handled by the browser.
27
27
  const noopKeyboardHandler = (_handlers: Record<string, (e: { height: number }) => void>, _deps: unknown[]) => {};
28
28
  let useKeyboardHandler: (handlers: Record<string, (e: { height: number }) => void>, deps: unknown[]) => void = noopKeyboardHandler;
29
- if (Platform.OS !== 'web') {
29
+ if (Platform.OS !== 'web' && typeof require !== 'undefined') {
30
30
  try {
31
- // eslint-disable-next-line @typescript-eslint/no-require-imports
32
- useKeyboardHandler = require('react-native-keyboard-controller').useKeyboardHandler;
31
+ const moduleName = 'react-native-keyboard-controller';
32
+ useKeyboardHandler = require(moduleName).useKeyboardHandler;
33
33
  } catch {
34
34
  // react-native-keyboard-controller not available
35
35
  }
@@ -27,7 +27,11 @@ function getReanimated(): ReanimatedType | null {
27
27
  if (!reanimatedResolved) {
28
28
  reanimatedResolved = true;
29
29
  try {
30
- reanimatedModule = require('react-native-reanimated');
30
+ // Guard for ESM environments (Vite/browser) where require is not defined.
31
+ if (typeof require !== 'undefined') {
32
+ const moduleName = 'react-native-reanimated';
33
+ reanimatedModule = require(moduleName);
34
+ }
31
35
  } catch {
32
36
  reanimatedModule = null;
33
37
  }
@@ -15,7 +15,11 @@ function getSvgModule(): SvgModuleType | null {
15
15
  if (!svgModuleResolved) {
16
16
  svgModuleResolved = true;
17
17
  try {
18
- svgModule = require('react-native-svg');
18
+ // Guard for ESM environments (Vite/browser) where require is not defined.
19
+ if (typeof require !== 'undefined') {
20
+ const moduleName = 'react-native-svg';
21
+ svgModule = require(moduleName);
22
+ }
19
23
  } catch {
20
24
  svgModule = null;
21
25
  }
@@ -27,7 +31,11 @@ function getReanimated(): ReanimatedType | null {
27
31
  if (!reanimatedResolved) {
28
32
  reanimatedResolved = true;
29
33
  try {
30
- reanimatedModule = require('react-native-reanimated');
34
+ // Guard for ESM environments (Vite/browser) where require is not defined.
35
+ if (typeof require !== 'undefined') {
36
+ const moduleName = 'react-native-reanimated';
37
+ reanimatedModule = require(moduleName);
38
+ }
31
39
  } catch {
32
40
  reanimatedModule = null;
33
41
  }
@@ -5,7 +5,9 @@ const c = (v: unknown): string => v as string;
5
5
 
6
6
  function getAndroidColors(): ThemeColors | null {
7
7
  try {
8
- const { Color } = require('expo-router');
8
+ if (typeof require === 'undefined') return null;
9
+ const moduleName = 'expo-router';
10
+ const { Color } = require(moduleName);
9
11
  const d = Color.android.dynamic;
10
12
  return {
11
13
  background: c(d.surface),
@@ -45,7 +47,9 @@ function getAndroidColors(): ThemeColors | null {
45
47
 
46
48
  function getIOSColors(): ThemeColors | null {
47
49
  try {
48
- const { Color } = require('expo-router');
50
+ if (typeof require === 'undefined') return null;
51
+ const moduleName = 'expo-router';
52
+ const { Color } = require(moduleName);
49
53
  const i = Color.ios;
50
54
  return {
51
55
  background: c(i.systemBackground),
@@ -1,4 +1,4 @@
1
- export type AppColorName = 'teal' | 'blue' | 'green' | 'amber' | 'red' | 'purple' | 'pink' | 'sky' | 'orange' | 'mint' | 'oxy';
1
+ export type AppColorName = 'teal' | 'blue' | 'green' | 'amber' | 'yellow' | 'red' | 'purple' | 'pink' | 'sky' | 'orange' | 'mint' | 'oxy';
2
2
 
3
3
  export interface AppColorPreset {
4
4
  name: AppColorName;
@@ -7,13 +7,14 @@ export interface AppColorPreset {
7
7
  dark: Record<string, string>;
8
8
  }
9
9
 
10
- export const APP_COLOR_NAMES: AppColorName[] = ['teal', 'blue', 'green', 'amber', 'red', 'purple', 'pink', 'sky', 'orange', 'mint'];
10
+ export const APP_COLOR_NAMES: AppColorName[] = ['teal', 'blue', 'green', 'amber', 'yellow', 'red', 'purple', 'pink', 'sky', 'orange', 'mint'];
11
11
 
12
12
  export const HEX_TO_APP_COLOR: Record<string, AppColorName> = {
13
13
  '#005c67': 'teal',
14
14
  '#1d9bf0': 'blue',
15
15
  '#10b981': 'green',
16
16
  '#f59e0b': 'amber',
17
+ '#ffc300': 'yellow',
17
18
  '#ef4444': 'red',
18
19
  '#8b5cf6': 'purple',
19
20
  '#ec4899': 'pink',
@@ -216,6 +217,53 @@ export const APP_COLOR_PRESETS: Record<AppColorName, AppColorPreset> = {
216
217
  },
217
218
  },
218
219
 
220
+ yellow: {
221
+ name: 'yellow',
222
+ hex: '#ffc300',
223
+ light: {
224
+ '--background': '0 0% 99%',
225
+ '--foreground': '0 0% 12%',
226
+ '--surface': '46 10% 97%',
227
+ '--surface-foreground': '0 0% 12%',
228
+ '--popover': '0 0% 100%',
229
+ '--popover-foreground': '0 0% 12%',
230
+ '--primary': '46 100% 50%',
231
+ '--primary-foreground': '0 0% 0%',
232
+ '--secondary': '46 8% 95%',
233
+ '--secondary-foreground': '0 0% 12%',
234
+ '--muted': '46 8% 95%',
235
+ '--muted-foreground': '46 5% 42%',
236
+ '--accent': '46 8% 95%',
237
+ '--accent-foreground': '0 0% 12%',
238
+ '--destructive': '0 84% 60%',
239
+ '--border': '46 8% 88%',
240
+ '--input': '46 8% 88%',
241
+ '--ring': '46 100% 50%',
242
+ '--sidebar': '46 10% 97%',
243
+ },
244
+ dark: {
245
+ '--background': '46 50% 5%',
246
+ '--foreground': '0 0% 93%',
247
+ '--surface': '46 20% 18%',
248
+ '--surface-foreground': '0 0% 93%',
249
+ '--popover': '46 20% 18%',
250
+ '--popover-foreground': '0 0% 93%',
251
+ '--primary': '46 100% 50%',
252
+ '--primary-foreground': '0 0% 0%',
253
+ '--secondary': '46 20% 18%',
254
+ '--secondary-foreground': '0 0% 93%',
255
+ '--muted': '46 18% 20%',
256
+ '--muted-foreground': '0 0% 70%',
257
+ '--accent': '46 18% 20%',
258
+ '--accent-foreground': '0 0% 93%',
259
+ '--destructive': '0 84% 60%',
260
+ '--border': '46 12% 20%',
261
+ '--input': '46 10% 23%',
262
+ '--ring': '46 100% 50%',
263
+ '--sidebar': '46 30% 8%',
264
+ },
265
+ },
266
+
219
267
  red: {
220
268
  name: 'red',
221
269
  hex: '#EF4444',