expo-orb 0.1.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +209 -1
  2. package/android/build.gradle +2 -0
  3. package/android/src/main/java/expo/modules/breathing/BreathingConfiguration.kt +25 -0
  4. package/android/src/main/java/expo/modules/breathing/BreathingExerciseView.kt +610 -0
  5. package/android/src/main/java/expo/modules/breathing/BreathingSharedState.kt +108 -0
  6. package/android/src/main/java/expo/modules/breathing/BreathingTextCue.kt +51 -0
  7. package/android/src/main/java/expo/modules/breathing/ExpoBreathingExerciseModule.kt +177 -0
  8. package/android/src/main/java/expo/modules/breathing/ExpoBreathingExerciseView.kt +144 -0
  9. package/android/src/main/java/expo/modules/breathing/MorphingBlobView.kt +128 -0
  10. package/android/src/main/java/expo/modules/breathing/ProgressRingView.kt +50 -0
  11. package/build/ExpoBreathingExercise.types.d.ts +48 -0
  12. package/build/ExpoBreathingExercise.types.d.ts.map +1 -0
  13. package/build/ExpoBreathingExercise.types.js +2 -0
  14. package/build/ExpoBreathingExercise.types.js.map +1 -0
  15. package/build/ExpoBreathingExerciseModule.d.ts +16 -0
  16. package/build/ExpoBreathingExerciseModule.d.ts.map +1 -0
  17. package/build/ExpoBreathingExerciseModule.js +52 -0
  18. package/build/ExpoBreathingExerciseModule.js.map +1 -0
  19. package/build/ExpoBreathingExerciseView.d.ts +4 -0
  20. package/build/ExpoBreathingExerciseView.d.ts.map +1 -0
  21. package/build/ExpoBreathingExerciseView.js +7 -0
  22. package/build/ExpoBreathingExerciseView.js.map +1 -0
  23. package/build/index.d.ts +3 -0
  24. package/build/index.d.ts.map +1 -1
  25. package/build/index.js +3 -0
  26. package/build/index.js.map +1 -1
  27. package/expo-module.config.json +2 -2
  28. package/ios/Breathing/BreathingConfiguration.swift +57 -0
  29. package/ios/Breathing/BreathingExerciseView.swift +451 -0
  30. package/ios/Breathing/BreathingParticlesView.swift +81 -0
  31. package/ios/Breathing/BreathingSharedState.swift +84 -0
  32. package/ios/Breathing/BreathingTextCue.swift +14 -0
  33. package/ios/Breathing/MorphingBlobView.swift +242 -0
  34. package/ios/Breathing/ProgressRingView.swift +27 -0
  35. package/ios/ExpoBreathingExerciseModule.swift +182 -0
  36. package/ios/ExpoBreathingExerciseView.swift +124 -0
  37. package/package.json +8 -5
  38. package/src/ExpoBreathingExercise.types.ts +50 -0
  39. package/src/ExpoBreathingExerciseModule.ts +67 -0
  40. package/src/ExpoBreathingExerciseView.tsx +11 -0
  41. package/src/index.ts +11 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "expo-orb",
3
- "version": "0.1.0",
4
- "description": "Animated orb component for React Native (iOS, Android, Web)",
3
+ "version": "0.2.2",
4
+ "description": "Animated orb and breathing exercise components for React Native (iOS, Android)",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
7
7
  "scripts": {
@@ -21,16 +21,19 @@
21
21
  "expo-orb",
22
22
  "orb",
23
23
  "animation",
24
+ "breathing",
25
+ "breathing-exercise",
26
+ "meditation",
24
27
  "ios",
25
28
  "android"
26
29
  ],
27
- "repository": "https://github.com/enso-works/expo-orb",
30
+ "repository": "https://github.com/enso-works/expo-orb-animation",
28
31
  "bugs": {
29
- "url": "https://github.com/enso-works/expo-orb/issues"
32
+ "url": "https://github.com/enso-works/expo-orb-animation/issues"
30
33
  },
31
34
  "author": "Ensar Bavrk <ensar.bavrk@gmail.com> (https://github.com/enso-works)",
32
35
  "license": "MIT",
33
- "homepage": "https://github.com/enso-works/expo-orb#readme",
36
+ "homepage": "https://github.com/enso-works/expo-orb-animation#readme",
34
37
  "dependencies": {},
35
38
  "devDependencies": {
36
39
  "@types/react": "~19.1.0",
@@ -0,0 +1,50 @@
1
+ import type { ColorValue, StyleProp, ViewStyle } from 'react-native';
2
+
3
+ export type BreathPhase = 'inhale' | 'holdIn' | 'exhale' | 'holdOut';
4
+
5
+ export interface BreathPhaseConfig {
6
+ phase: BreathPhase;
7
+ duration: number; // milliseconds
8
+ targetScale: number; // e.g., 1.0 to 1.3
9
+ label: string; // "Breathe In"
10
+ }
11
+
12
+ export interface BreathingPattern {
13
+ phases: BreathPhaseConfig[];
14
+ cycles?: number; // undefined = infinite
15
+ }
16
+
17
+ export type BreathingPreset = 'relaxing' | 'box' | 'energizing' | 'calming';
18
+
19
+ export interface PhaseChangeEvent {
20
+ phase: BreathPhase;
21
+ label: string;
22
+ phaseIndex: number;
23
+ cycle: number;
24
+ }
25
+
26
+ export interface ExerciseCompleteEvent {
27
+ totalCycles: number;
28
+ totalDuration: number;
29
+ }
30
+
31
+ export interface ExpoBreathingExerciseViewProps {
32
+ blobColors?: ColorValue[];
33
+ innerBlobColor?: ColorValue;
34
+ glowColor?: ColorValue;
35
+ particleColor?: ColorValue;
36
+ progressRingColor?: ColorValue;
37
+ textColor?: ColorValue;
38
+ showProgressRing?: boolean;
39
+ showTextCue?: boolean;
40
+ showInnerBlob?: boolean;
41
+ showShadow?: boolean;
42
+ showParticles?: boolean;
43
+ showWavyBlobs?: boolean;
44
+ showGlowEffects?: boolean;
45
+ pointCount?: number; // Morphing points (default: 8)
46
+ wobbleIntensity?: number; // 0-1
47
+ onPhaseChange?: (event: { nativeEvent: PhaseChangeEvent }) => void;
48
+ onExerciseComplete?: (event: { nativeEvent: ExerciseCompleteEvent }) => void;
49
+ style?: StyleProp<ViewStyle>;
50
+ }
@@ -0,0 +1,67 @@
1
+ import { NativeModule, requireNativeModule } from 'expo';
2
+ import type { BreathingPattern, BreathingPreset } from './ExpoBreathingExercise.types';
3
+
4
+ declare class ExpoBreathingExerciseModuleType extends NativeModule {
5
+ startBreathingExercise(pattern: BreathingPattern): void;
6
+ stopBreathingExercise(): void;
7
+ pauseBreathingExercise(): void;
8
+ resumeBreathingExercise(): void;
9
+ }
10
+
11
+ const module = requireNativeModule<ExpoBreathingExerciseModuleType>('ExpoBreathingExercise');
12
+
13
+ export default module;
14
+
15
+ export function startBreathingExercise(pattern: BreathingPattern): void {
16
+ module.startBreathingExercise(pattern);
17
+ }
18
+
19
+ export function stopBreathingExercise(): void {
20
+ module.stopBreathingExercise();
21
+ }
22
+
23
+ export function pauseBreathingExercise(): void {
24
+ module.pauseBreathingExercise();
25
+ }
26
+
27
+ export function resumeBreathingExercise(): void {
28
+ module.resumeBreathingExercise();
29
+ }
30
+
31
+ const BREATHING_PRESETS: Record<BreathingPreset, BreathingPattern> = {
32
+ relaxing: {
33
+ phases: [
34
+ { phase: 'inhale', duration: 4000, targetScale: 1.35, label: 'Breathe In' },
35
+ { phase: 'holdIn', duration: 7000, targetScale: 1.35, label: 'Hold' },
36
+ { phase: 'exhale', duration: 8000, targetScale: 0.75, label: 'Breathe Out' },
37
+ ],
38
+ cycles: 4,
39
+ },
40
+ box: {
41
+ phases: [
42
+ { phase: 'inhale', duration: 4000, targetScale: 1.35, label: 'Breathe In' },
43
+ { phase: 'holdIn', duration: 4000, targetScale: 1.35, label: 'Hold' },
44
+ { phase: 'exhale', duration: 4000, targetScale: 0.75, label: 'Breathe Out' },
45
+ { phase: 'holdOut', duration: 4000, targetScale: 0.75, label: 'Hold' },
46
+ ],
47
+ cycles: 4,
48
+ },
49
+ energizing: {
50
+ phases: [
51
+ { phase: 'inhale', duration: 2000, targetScale: 1.35, label: 'Breathe In' },
52
+ { phase: 'exhale', duration: 2000, targetScale: 0.75, label: 'Breathe Out' },
53
+ ],
54
+ cycles: 10,
55
+ },
56
+ calming: {
57
+ phases: [
58
+ { phase: 'inhale', duration: 4000, targetScale: 1.35, label: 'Breathe In' },
59
+ { phase: 'exhale', duration: 6000, targetScale: 0.75, label: 'Breathe Out' },
60
+ ],
61
+ cycles: 6,
62
+ },
63
+ };
64
+
65
+ export function getBreathingPreset(preset: BreathingPreset): BreathingPattern {
66
+ return BREATHING_PRESETS[preset];
67
+ }
@@ -0,0 +1,11 @@
1
+ import { requireNativeView } from 'expo';
2
+ import * as React from 'react';
3
+
4
+ import { ExpoBreathingExerciseViewProps } from './ExpoBreathingExercise.types';
5
+
6
+ const NativeView: React.ComponentType<ExpoBreathingExerciseViewProps> =
7
+ requireNativeView('ExpoBreathingExercise');
8
+
9
+ export default function ExpoBreathingExerciseView(props: ExpoBreathingExerciseViewProps) {
10
+ return <NativeView {...props} />;
11
+ }
package/src/index.ts CHANGED
@@ -1,3 +1,14 @@
1
1
  export { default, setOrbActivity } from './ExpoOrbModule';
2
2
  export { default as ExpoOrbView } from './ExpoOrbView';
3
3
  export * from './ExpoOrb.types';
4
+
5
+ export {
6
+ default as ExpoBreathingExerciseModule,
7
+ startBreathingExercise,
8
+ stopBreathingExercise,
9
+ pauseBreathingExercise,
10
+ resumeBreathingExercise,
11
+ getBreathingPreset,
12
+ } from './ExpoBreathingExerciseModule';
13
+ export { default as ExpoBreathingExerciseView } from './ExpoBreathingExerciseView';
14
+ export * from './ExpoBreathingExercise.types';