flowboard-react 0.6.1 → 0.6.3

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 (97) hide show
  1. package/README.md +168 -52
  2. package/app.plugin.js +341 -0
  3. package/bin/setup.js +427 -0
  4. package/lib/module/Flowboard.js +1 -2
  5. package/lib/module/Flowboard.js.map +1 -1
  6. package/lib/module/FlowboardProvider.js +1 -1
  7. package/lib/module/FlowboardProvider.js.map +1 -1
  8. package/lib/module/components/FlowboardFlow.js +31 -9
  9. package/lib/module/components/FlowboardFlow.js.map +1 -1
  10. package/lib/module/components/FlowboardRenderer.js +419 -85
  11. package/lib/module/components/FlowboardRenderer.js.map +1 -1
  12. package/lib/module/core/clientContext.js +10 -29
  13. package/lib/module/core/clientContext.js.map +1 -1
  14. package/lib/module/core/fontAwesome.js +2 -9
  15. package/lib/module/core/fontAwesome.js.map +1 -1
  16. package/lib/module/core/onboardingRepository.js +13 -13
  17. package/lib/module/core/onboardingRepository.js.map +1 -1
  18. package/lib/module/native/asyncStorage.js +55 -0
  19. package/lib/module/native/asyncStorage.js.map +1 -0
  20. package/lib/module/native/deviceInfo.js +46 -0
  21. package/lib/module/native/deviceInfo.js.map +1 -0
  22. package/lib/module/native/inAppReview.js +17 -0
  23. package/lib/module/native/inAppReview.js.map +1 -0
  24. package/lib/module/native/linearGradient.js +29 -0
  25. package/lib/module/native/linearGradient.js.map +1 -0
  26. package/lib/module/native/lottie.js +20 -0
  27. package/lib/module/native/lottie.js.map +1 -0
  28. package/lib/module/native/maskedView.js +26 -0
  29. package/lib/module/native/maskedView.js.map +1 -0
  30. package/lib/module/native/pagerView.js +79 -0
  31. package/lib/module/native/pagerView.js.map +1 -0
  32. package/lib/module/native/permissions.js +30 -0
  33. package/lib/module/native/permissions.js.map +1 -0
  34. package/lib/module/native/runtime.js +81 -0
  35. package/lib/module/native/runtime.js.map +1 -0
  36. package/lib/module/native/safeAreaContext.js +43 -0
  37. package/lib/module/native/safeAreaContext.js.map +1 -0
  38. package/lib/module/native/svg.js +83 -0
  39. package/lib/module/native/svg.js.map +1 -0
  40. package/lib/module/native/vectorIcons.js +41 -0
  41. package/lib/module/native/vectorIcons.js.map +1 -0
  42. package/lib/module/utils/flowboardUtils.js +4 -1
  43. package/lib/module/utils/flowboardUtils.js.map +1 -1
  44. package/lib/typescript/src/Flowboard.d.ts.map +1 -1
  45. package/lib/typescript/src/components/FlowboardFlow.d.ts.map +1 -1
  46. package/lib/typescript/src/components/FlowboardRenderer.d.ts +33 -0
  47. package/lib/typescript/src/components/FlowboardRenderer.d.ts.map +1 -1
  48. package/lib/typescript/src/core/clientContext.d.ts.map +1 -1
  49. package/lib/typescript/src/core/fontAwesome.d.ts +1 -1
  50. package/lib/typescript/src/core/fontAwesome.d.ts.map +1 -1
  51. package/lib/typescript/src/core/onboardingRepository.d.ts.map +1 -1
  52. package/lib/typescript/src/native/asyncStorage.d.ts +16 -0
  53. package/lib/typescript/src/native/asyncStorage.d.ts.map +1 -0
  54. package/lib/typescript/src/native/deviceInfo.d.ts +11 -0
  55. package/lib/typescript/src/native/deviceInfo.d.ts.map +1 -0
  56. package/lib/typescript/src/native/inAppReview.d.ts +4 -0
  57. package/lib/typescript/src/native/inAppReview.d.ts.map +1 -0
  58. package/lib/typescript/src/native/linearGradient.d.ts +3 -0
  59. package/lib/typescript/src/native/linearGradient.d.ts.map +1 -0
  60. package/lib/typescript/src/native/lottie.d.ts +3 -0
  61. package/lib/typescript/src/native/lottie.d.ts.map +1 -0
  62. package/lib/typescript/src/native/maskedView.d.ts +3 -0
  63. package/lib/typescript/src/native/maskedView.d.ts.map +1 -0
  64. package/lib/typescript/src/native/pagerView.d.ts +14 -0
  65. package/lib/typescript/src/native/pagerView.d.ts.map +1 -0
  66. package/lib/typescript/src/native/permissions.d.ts +9 -0
  67. package/lib/typescript/src/native/permissions.d.ts.map +1 -0
  68. package/lib/typescript/src/native/runtime.d.ts +13 -0
  69. package/lib/typescript/src/native/runtime.d.ts.map +1 -0
  70. package/lib/typescript/src/native/safeAreaContext.d.ts +15 -0
  71. package/lib/typescript/src/native/safeAreaContext.d.ts.map +1 -0
  72. package/lib/typescript/src/native/svg.d.ts +8 -0
  73. package/lib/typescript/src/native/svg.d.ts.map +1 -0
  74. package/lib/typescript/src/native/vectorIcons.d.ts +4 -0
  75. package/lib/typescript/src/native/vectorIcons.d.ts.map +1 -0
  76. package/lib/typescript/src/utils/flowboardUtils.d.ts.map +1 -1
  77. package/package.json +24 -19
  78. package/src/Flowboard.ts +1 -2
  79. package/src/FlowboardProvider.tsx +1 -1
  80. package/src/components/FlowboardFlow.tsx +47 -9
  81. package/src/components/FlowboardRenderer.tsx +689 -113
  82. package/src/core/clientContext.ts +10 -32
  83. package/src/core/fontAwesome.ts +2 -9
  84. package/src/core/onboardingRepository.ts +18 -13
  85. package/src/native/asyncStorage.ts +99 -0
  86. package/src/native/deviceInfo.ts +88 -0
  87. package/src/native/inAppReview.ts +34 -0
  88. package/src/native/linearGradient.tsx +24 -0
  89. package/src/native/lottie.tsx +17 -0
  90. package/src/native/maskedView.tsx +19 -0
  91. package/src/native/pagerView.tsx +95 -0
  92. package/src/native/permissions.ts +59 -0
  93. package/src/native/runtime.ts +110 -0
  94. package/src/native/safeAreaContext.tsx +44 -0
  95. package/src/native/svg.tsx +82 -0
  96. package/src/native/vectorIcons.tsx +50 -0
  97. package/src/utils/flowboardUtils.ts +9 -1
@@ -0,0 +1,110 @@
1
+ import { NativeModules, UIManager } from 'react-native';
2
+
3
+ const warnedMessages = new Set<string>();
4
+ const reactNativeModule = require('react-native') as {
5
+ TurboModuleRegistry?: {
6
+ get?: (name: string) => unknown;
7
+ getEnforcing?: (name: string) => unknown;
8
+ };
9
+ };
10
+
11
+ export const ZERO_INSETS = {
12
+ top: 0,
13
+ right: 0,
14
+ bottom: 0,
15
+ left: 0,
16
+ } as const;
17
+
18
+ function isDevelopment(): boolean {
19
+ if (typeof __DEV__ !== 'undefined') return __DEV__;
20
+ return process.env.NODE_ENV !== 'production';
21
+ }
22
+
23
+ export function warnOnce(key: string, message: string): void {
24
+ if (!isDevelopment() || warnedMessages.has(key)) return;
25
+ warnedMessages.add(key);
26
+ console.warn(`[flowboard-react] ${message}`);
27
+ }
28
+
29
+ export function hasTurboModule(name: string): boolean {
30
+ const registry = reactNativeModule.TurboModuleRegistry;
31
+ if (!registry) return false;
32
+ try {
33
+ if (typeof registry.get === 'function' && registry.get(name)) {
34
+ return true;
35
+ }
36
+ } catch {
37
+ return false;
38
+ }
39
+ try {
40
+ if (typeof registry.getEnforcing === 'function') {
41
+ return Boolean(registry.getEnforcing(name));
42
+ }
43
+ } catch {
44
+ return false;
45
+ }
46
+ return false;
47
+ }
48
+
49
+ export function hasNativeModule(...names: string[]): boolean {
50
+ const modules = NativeModules as Record<string, unknown>;
51
+ return names.some((name) => Boolean(modules[name]) || hasTurboModule(name));
52
+ }
53
+
54
+ export function hasViewManager(...names: string[]): boolean {
55
+ const uiManager = UIManager as unknown as {
56
+ getViewManagerConfig?: (name: string) => unknown;
57
+ [key: string]: unknown;
58
+ };
59
+
60
+ return names.some((name) => {
61
+ try {
62
+ if (typeof uiManager.getViewManagerConfig === 'function') {
63
+ return Boolean(uiManager.getViewManagerConfig(name));
64
+ }
65
+ return Boolean(uiManager[name]);
66
+ } catch {
67
+ return false;
68
+ }
69
+ });
70
+ }
71
+
72
+ export function safeSync<T>(
73
+ key: string,
74
+ available: boolean,
75
+ run: () => T,
76
+ fallback: T,
77
+ warning: string
78
+ ): T {
79
+ if (!available) {
80
+ warnOnce(key, warning);
81
+ return fallback;
82
+ }
83
+
84
+ try {
85
+ return run();
86
+ } catch {
87
+ warnOnce(key, warning);
88
+ return fallback;
89
+ }
90
+ }
91
+
92
+ export async function safeAsync<T>(
93
+ key: string,
94
+ available: boolean,
95
+ run: () => Promise<T>,
96
+ fallback: T,
97
+ warning: string
98
+ ): Promise<T> {
99
+ if (!available) {
100
+ warnOnce(key, warning);
101
+ return fallback;
102
+ }
103
+
104
+ try {
105
+ return await run();
106
+ } catch {
107
+ warnOnce(key, warning);
108
+ return fallback;
109
+ }
110
+ }
@@ -0,0 +1,44 @@
1
+ import { View } from 'react-native';
2
+ import {
3
+ SafeAreaProvider as NativeSafeAreaProvider,
4
+ SafeAreaView as NativeSafeAreaView,
5
+ useSafeAreaInsets as nativeUseSafeAreaInsets,
6
+ } from 'react-native-safe-area-context';
7
+ import { hasViewManager, warnOnce, ZERO_INSETS } from './runtime';
8
+
9
+ const warning =
10
+ 'react-native-safe-area-context is unavailable. Flowboard will render without device safe-area insets until native setup is fixed.';
11
+
12
+ export const safeAreaContextAvailable = hasViewManager('RNCSafeAreaProvider');
13
+
14
+ export function SafeAreaProvider(props: any) {
15
+ if (!safeAreaContextAvailable) {
16
+ warnOnce('native-safe-area-provider', warning);
17
+ return <>{props.children}</>;
18
+ }
19
+
20
+ return <NativeSafeAreaProvider {...props} />;
21
+ }
22
+
23
+ export function SafeAreaView(props: any) {
24
+ if (!safeAreaContextAvailable) {
25
+ warnOnce('native-safe-area-view', warning);
26
+ return <View {...props} />;
27
+ }
28
+
29
+ return <NativeSafeAreaView {...props} />;
30
+ }
31
+
32
+ export function useSafeAreaInsets() {
33
+ if (!safeAreaContextAvailable) {
34
+ warnOnce('native-safe-area-insets', warning);
35
+ return ZERO_INSETS;
36
+ }
37
+
38
+ try {
39
+ return nativeUseSafeAreaInsets();
40
+ } catch {
41
+ warnOnce('native-safe-area-insets-error', warning);
42
+ return ZERO_INSETS;
43
+ }
44
+ }
@@ -0,0 +1,82 @@
1
+ import { Text as ReactNativeText, View } from 'react-native';
2
+ import NativeSvg, {
3
+ Circle as NativeCircle,
4
+ G as NativeG,
5
+ Line as NativeLine,
6
+ Polygon as NativePolygon,
7
+ Text as NativeSvgText,
8
+ } from 'react-native-svg';
9
+ import { hasViewManager, warnOnce } from './runtime';
10
+
11
+ const warning =
12
+ 'react-native-svg is unavailable. Flowboard will fall back to simplified chart rendering until native setup is fixed.';
13
+
14
+ export const svgAvailable = hasViewManager(
15
+ 'RNSVGSvgView',
16
+ 'RNSVGSvgViewAndroid'
17
+ );
18
+
19
+ function NullShape() {
20
+ return null;
21
+ }
22
+
23
+ export default function Svg(props: any) {
24
+ if (!svgAvailable) {
25
+ warnOnce('native-svg-root', warning);
26
+ const { children, height, style, width } = props;
27
+ return (
28
+ <View
29
+ style={[style, width ? { width } : null, height ? { height } : null]}
30
+ >
31
+ {children}
32
+ </View>
33
+ );
34
+ }
35
+
36
+ return <NativeSvg {...props} />;
37
+ }
38
+
39
+ export function Circle(props: any) {
40
+ if (!svgAvailable) {
41
+ warnOnce('native-svg-circle', warning);
42
+ return <NullShape />;
43
+ }
44
+
45
+ return <NativeCircle {...props} />;
46
+ }
47
+
48
+ export function G(props: any) {
49
+ if (!svgAvailable) {
50
+ warnOnce('native-svg-group', warning);
51
+ return <>{props.children}</>;
52
+ }
53
+
54
+ return <NativeG {...props} />;
55
+ }
56
+
57
+ export function Line(props: any) {
58
+ if (!svgAvailable) {
59
+ warnOnce('native-svg-line', warning);
60
+ return <NullShape />;
61
+ }
62
+
63
+ return <NativeLine {...props} />;
64
+ }
65
+
66
+ export function Polygon(props: any) {
67
+ if (!svgAvailable) {
68
+ warnOnce('native-svg-polygon', warning);
69
+ return <NullShape />;
70
+ }
71
+
72
+ return <NativePolygon {...props} />;
73
+ }
74
+
75
+ export function SvgText(props: any) {
76
+ if (!svgAvailable) {
77
+ warnOnce('native-svg-text', warning);
78
+ return <ReactNativeText>{props.children}</ReactNativeText>;
79
+ }
80
+
81
+ return <NativeSvgText {...props} />;
82
+ }
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import NativeFontAwesome6 from 'react-native-vector-icons/FontAwesome6';
3
+ import { hasNativeModule, warnOnce } from './runtime';
4
+
5
+ const warning =
6
+ 'react-native-vector-icons could not load FontAwesome6 fonts. Verify the package is installed and fonts are bundled in the host app.';
7
+
8
+ let attemptedFontLoad = false;
9
+
10
+ export const vectorIconsNativeAvailable = hasNativeModule(
11
+ 'RNVectorIcons',
12
+ 'RNVectorIconsManager'
13
+ );
14
+
15
+ function ensureFontLoaded(): void {
16
+ if (attemptedFontLoad) return;
17
+ attemptedFontLoad = true;
18
+
19
+ const anyIcon = NativeFontAwesome6 as any;
20
+ if (typeof anyIcon.loadFont !== 'function') return;
21
+
22
+ Promise.resolve(anyIcon.loadFont()).catch(() => {
23
+ warnOnce('native-vector-icons-load-font', warning);
24
+ });
25
+ }
26
+
27
+ export function getFontAwesomeGlyphMap(): Record<string, number> | null {
28
+ const anyIcon = NativeFontAwesome6 as any;
29
+
30
+ try {
31
+ if (typeof anyIcon.getRawGlyphMap === 'function') {
32
+ return anyIcon.getRawGlyphMap();
33
+ }
34
+ if (anyIcon.glyphMap) {
35
+ return anyIcon.glyphMap as Record<string, number>;
36
+ }
37
+ } catch {
38
+ warnOnce('native-vector-icons-glyph-map', warning);
39
+ }
40
+
41
+ return null;
42
+ }
43
+
44
+ export function FontAwesome6(props: any) {
45
+ React.useEffect(() => {
46
+ ensureFontLoaded();
47
+ }, []);
48
+
49
+ return <NativeFontAwesome6 {...props} />;
50
+ }
@@ -91,7 +91,15 @@ export function parseDimension(
91
91
  return value;
92
92
  }
93
93
  if (typeof value === 'string') {
94
- if (value.toLowerCase() === 'infinity') return Number.POSITIVE_INFINITY;
94
+ const normalized = value.trim().toLowerCase();
95
+ if (
96
+ normalized === 'infinity' ||
97
+ normalized === 'infinite' ||
98
+ normalized === 'double.infinity' ||
99
+ normalized === '+infinity'
100
+ ) {
101
+ return Number.POSITIVE_INFINITY;
102
+ }
95
103
  const numeric = Number(value);
96
104
  if (!Number.isNaN(numeric)) {
97
105
  if (zeroIsNull && numeric === 0) return undefined;