@symbiote-native/splash-screen 3.0.3 → 3.2.0

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 (47) hide show
  1. package/README.md +21 -4
  2. package/build/angular/index.d.ts +1 -1
  3. package/build/angular/services/hide-animation.service/index.js +15 -14
  4. package/build/core/hide-animation-controller.d.ts +3 -1
  5. package/build/core/hide-animation-controller.js +35 -2
  6. package/build/core/index.d.ts +1 -1
  7. package/build/core/native-module.js +18 -0
  8. package/build/core/types.d.ts +6 -0
  9. package/build/react/hooks/use-hide-animation/index.js +14 -18
  10. package/build/react/index.d.ts +1 -1
  11. package/build/solid/index.d.ts +3 -0
  12. package/build/solid/index.js +8 -0
  13. package/build/solid/primitives/create-hide-animation.d.ts +3 -0
  14. package/build/solid/primitives/create-hide-animation.js +24 -0
  15. package/build/svelte/index.d.ts +3 -0
  16. package/build/svelte/index.js +7 -0
  17. package/build/svelte/runes/use-hide-animation.svelte.d.ts +4 -0
  18. package/build/svelte/runes/use-hide-animation.svelte.js +24 -0
  19. package/build/vue/composables/use-hide-animation/index.js +11 -12
  20. package/build/vue/index.d.ts +1 -1
  21. package/build-ngc/angular/index.d.ts +1 -1
  22. package/build-ngc/angular/services/hide-animation.service/index.js +18 -17
  23. package/build-ngc/angular/services/hide-animation.service/index.js.map +1 -1
  24. package/build-ngc/core/hide-animation-controller.d.ts +3 -1
  25. package/build-ngc/core/hide-animation-controller.js +35 -2
  26. package/build-ngc/core/hide-animation-controller.js.map +1 -1
  27. package/build-ngc/core/index.d.ts +1 -1
  28. package/build-ngc/core/native-module.js +18 -0
  29. package/build-ngc/core/native-module.js.map +1 -1
  30. package/build-ngc/core/types.d.ts +6 -0
  31. package/package.json +43 -15
  32. package/src/angular/index.ts +8 -1
  33. package/src/angular/services/hide-animation.service/index.ts +23 -14
  34. package/src/core/hide-animation-controller.ts +45 -3
  35. package/src/core/index.ts +2 -0
  36. package/src/core/native-module.ts +21 -1
  37. package/src/core/types.ts +23 -1
  38. package/src/react/hooks/use-hide-animation/index.ts +16 -21
  39. package/src/react/index.ts +8 -1
  40. package/src/solid/index.ts +17 -0
  41. package/src/solid/primitives/create-hide-animation.ts +37 -0
  42. package/src/svelte/index.ts +16 -0
  43. package/src/svelte/runes/use-hide-animation.svelte.ts +41 -0
  44. package/src/svelte/svelte-ambient.d.ts +6 -0
  45. package/src/vue/composables/use-hide-animation/index.ts +12 -12
  46. package/src/vue/index.ts +8 -1
  47. package/symbiote-splash-screen.podspec +8 -0
@@ -2,4 +2,4 @@ export { hide, isVisible } from './hide';
2
2
  export { HideAnimationController } from './hide-animation-controller';
3
3
  export { computeHideAnimationStyles } from './compute-hide-animation-styles';
4
4
  export { getHideAnimationConstants } from './native-module';
5
- export type { IHideConfig, IManifest, IHideAnimationConfig, IHideAnimationContainerProps, IHideAnimationImageProps, IHideAnimationResult, IHideAnimationConstants, } from './types';
5
+ export type { IHideConfig, IManifest, IHideAnimationConfig, IHideAnimationContainerProps, IHideAnimationFailure, IHideAnimationFailureStage, IHideAnimationImageProps, IHideAnimationResult, IHideAnimationConstants, } from './types';
@@ -7,6 +7,24 @@
7
7
  // (hide/isVisible/useHideAnimation) never exposes directly.
8
8
  import { getEnforcingNativeModule } from '@symbiote-native/engine';
9
9
  const RN_BOOT_SPLASH_MODULE_NAME = 'RNBootSplash';
10
+ // DELIBERATELY UNGUARDED — do not wrap this in a try/catch or hand it a fallback.
11
+ //
12
+ // A missing RNBootSplash is a BUILD error, not a runtime condition: the module is either linked
13
+ // into the binary or it is not, deterministically, on the very first launch. Upstream treats it
14
+ // the same way and does not soften it either — react-native-bootsplash's whole spec file is
15
+ // `TurboModuleRegistry.getEnforcing<Spec>("RNBootSplash")` (src/specs/NativeRNBootSplash.ts),
16
+ // which throws at module-IMPORT time, and its useHideAnimation calls `NativeModule.getConstants()`
17
+ // with no guard at all. `getEnforcing` exists precisely to make this loud.
18
+ //
19
+ // This repo has a live footgun that depends on it staying loud: `npm install` deletes the
20
+ // `.rn-bootsplash/` folder this package's podspec vendors at pod-install time (see CLAUDE.md), so
21
+ // a skipped `pod install` yields exactly this missing module. Degrading to light-mode defaults
22
+ // would turn that into "the splash looks fine, just never dark" and it would ship.
23
+ //
24
+ // Note the failure is currently invisible under @symbiote-native/react specifically: mount()
25
+ // (adapters/react/src/render.ts) wires the reconciler's uncaught-error callbacks to `noop`, so the
26
+ // throw never reaches the app. That is a defect in THAT adapter, tracked separately — it is not a
27
+ // reason to stop throwing here.
10
28
  export function getHideAnimationConstants() {
11
29
  return getEnforcingNativeModule(RN_BOOT_SPLASH_MODULE_NAME).getConstants();
12
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,gFAAgF;AAChF,wFAAwF;AACxF,qFAAqF;AACrF,yFAAyF;AACzF,oFAAoF;AACpF,4DAA4D;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,MAAM,0BAA0B,GAAG,cAAc,CAAC;AAMlD,MAAM,UAAU,yBAAyB;IACvC,OAAO,wBAAwB,CAAoB,0BAA0B,CAAC,CAAC,YAAY,EAAE,CAAC;AAChG,CAAC"}
1
+ {"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,gFAAgF;AAChF,wFAAwF;AACxF,qFAAqF;AACrF,yFAAyF;AACzF,oFAAoF;AACpF,4DAA4D;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,MAAM,0BAA0B,GAAG,cAAc,CAAC;AAMlD,kFAAkF;AAClF,EAAE;AACF,gGAAgG;AAChG,gGAAgG;AAChG,4FAA4F;AAC5F,8FAA8F;AAC9F,mGAAmG;AACnG,2EAA2E;AAC3E,EAAE;AACF,0FAA0F;AAC1F,kGAAkG;AAClG,+FAA+F;AAC/F,mFAAmF;AACnF,EAAE;AACF,6FAA6F;AAC7F,mGAAmG;AACnG,kGAAkG;AAClG,gCAAgC;AAChC,MAAM,UAAU,yBAAyB;IACvC,OAAO,wBAAwB,CAC7B,0BAA0B,CAC3B,CAAC,YAAY,EAAE,CAAC;AACnB,CAAC"}
@@ -16,6 +16,11 @@ export type IManifest = {
16
16
  height: number;
17
17
  };
18
18
  };
19
+ export type IHideAnimationFailureStage = 'hide' | 'animate';
20
+ export type IHideAnimationFailure = {
21
+ stage: IHideAnimationFailureStage;
22
+ error: unknown;
23
+ };
19
24
  export type IHideAnimationConfig = {
20
25
  manifest: IManifest;
21
26
  ready?: boolean;
@@ -24,6 +29,7 @@ export type IHideAnimationConfig = {
24
29
  brand?: IImageSourceProp;
25
30
  darkBrand?: IImageSourceProp;
26
31
  animate: () => void;
32
+ onError?: (failure: IHideAnimationFailure) => void;
27
33
  statusBarTranslucent?: boolean;
28
34
  navigationBarTranslucent?: boolean;
29
35
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@symbiote-native/splash-screen",
3
- "version": "3.0.3",
4
- "description": "Third-party splash-screen native module wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, and Angular adapters.",
3
+ "version": "3.2.0",
4
+ "description": "Third-party splash-screen native module wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -33,6 +33,14 @@
33
33
  "types": "./build/react/index.d.ts",
34
34
  "default": "./build/react/index.js"
35
35
  },
36
+ "./svelte": {
37
+ "types": "./build/svelte/index.d.ts",
38
+ "default": "./build/svelte/index.js"
39
+ },
40
+ "./solid": {
41
+ "types": "./build/solid/index.d.ts",
42
+ "default": "./build/solid/index.js"
43
+ },
36
44
  "./angular": {
37
45
  "types": "./build-ngc/angular/index.d.ts",
38
46
  "react-native": "./build-ngc/angular/index.js",
@@ -65,18 +73,22 @@
65
73
  "dependencies": {
66
74
  "react-native-bootsplash": "7.3.2",
67
75
  "react-native-is-edge-to-edge": "^1.3.1",
68
- "@symbiote-native/components": "0.3.0"
76
+ "@symbiote-native/components": "0.5.0"
69
77
  },
70
78
  "peerDependencies": {
79
+ "@symbiote-native/angular": ">=0.6.2",
71
80
  "@symbiote-native/engine": ">=0.1.7",
81
+ "@symbiote-native/react": ">=0.2.8",
82
+ "@symbiote-native/solid": ">=0.0.1",
83
+ "@symbiote-native/svelte": ">=0.1.0",
84
+ "@symbiote-native/vue": ">=0.3.8",
72
85
  "@angular/core": ">=20",
73
86
  "@vue/runtime-core": "^3.5.13",
74
87
  "react": ">=19.0.0",
75
88
  "react-native": ">=0.86",
76
- "vue": ">=3.5.0",
77
- "@symbiote-native/angular": "0.6.2",
78
- "@symbiote-native/react": "0.2.8",
79
- "@symbiote-native/vue": "0.3.8"
89
+ "solid-js": ">=1.9.0",
90
+ "svelte": ">=5.0.0",
91
+ "vue": ">=3.5.0"
80
92
  },
81
93
  "peerDependenciesMeta": {
82
94
  "@symbiote-native/angular": {
@@ -85,6 +97,12 @@
85
97
  "@symbiote-native/react": {
86
98
  "optional": true
87
99
  },
100
+ "@symbiote-native/solid": {
101
+ "optional": true
102
+ },
103
+ "@symbiote-native/svelte": {
104
+ "optional": true
105
+ },
88
106
  "@symbiote-native/vue": {
89
107
  "optional": true
90
108
  },
@@ -97,24 +115,34 @@
97
115
  "react": {
98
116
  "optional": true
99
117
  },
118
+ "solid-js": {
119
+ "optional": true
120
+ },
121
+ "svelte": {
122
+ "optional": true
123
+ },
100
124
  "vue": {
101
125
  "optional": true
102
126
  }
103
127
  },
104
128
  "devDependencies": {
105
- "@angular/compiler": "^22",
106
- "@angular/compiler-cli": "^22",
107
- "@angular/core": "^22",
129
+ "@angular/compiler": "~22.0.8",
130
+ "@angular/compiler-cli": "~22.0.8",
131
+ "@angular/core": "~22.0.8",
108
132
  "@types/node": "^26.0.0",
109
133
  "@types/react": "^19.2.0",
110
134
  "@vue/runtime-core": "^3.5.13",
111
135
  "react": "19.2.3",
136
+ "solid-js": "^1.9.14",
137
+ "svelte": "^5.56.0",
112
138
  "typescript": "~6.0.0",
113
- "@symbiote-native/angular": "0.6.2",
114
- "@symbiote-native/engine": "0.1.7",
115
- "@symbiote-native/react": "0.2.8",
116
- "@symbiote-native/test-utils": "0.1.6",
117
- "@symbiote-native/vue": "0.3.8"
139
+ "@symbiote-native/angular": "0.8.0",
140
+ "@symbiote-native/engine": "0.3.0",
141
+ "@symbiote-native/react": "0.4.0",
142
+ "@symbiote-native/solid": "0.1.0",
143
+ "@symbiote-native/svelte": "0.3.0",
144
+ "@symbiote-native/test-utils": "0.2.0",
145
+ "@symbiote-native/vue": "0.5.0"
118
146
  },
119
147
  "scripts": {
120
148
  "typecheck": "tsc --build",
@@ -3,4 +3,11 @@
3
3
  // machine, style computation, and native-constants read all live in core, shared with React/Vue.
4
4
  export { hide, isVisible } from '../core';
5
5
  export { HideAnimationService } from './services/hide-animation.service';
6
- export type { IHideAnimationConfig, IHideAnimationResult, IManifest, IHideConfig } from '../core';
6
+ export type {
7
+ IHideAnimationConfig,
8
+ IHideAnimationFailure,
9
+ IHideAnimationFailureStage,
10
+ IHideAnimationResult,
11
+ IManifest,
12
+ IHideConfig,
13
+ } from '../core';
@@ -1,35 +1,44 @@
1
- import { computed, effect, inject, Injectable, Injector, type Signal } from '@angular/core';
1
+ import {
2
+ computed,
3
+ effect,
4
+ inject,
5
+ Injectable,
6
+ Injector,
7
+ type Signal,
8
+ } from '@angular/core';
2
9
  import {
3
10
  computeHideAnimationStyles,
4
- getHideAnimationConstants,
5
11
  HideAnimationController,
6
12
  type IHideAnimationConfig,
7
13
  type IHideAnimationResult,
8
14
  } from '../../../core';
9
15
 
10
16
  // Angular twin of React's `useHideAnimation` hook and Vue's `useHideAnimation` composable.
11
- // Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
12
- // stands in for the hook's role: call it ONCE (typically from a component's field initializer,
13
- // inside an injection context) with a GETTER, so it can keep reading the caller's own signals —
14
- // the same reason Vue's composable also takes a getter rather than a value: there is no
15
- // re-render/re-setup cycle here to hang a fresh read off of.
17
+ // Angular has no per-instance hook, so `connect()` stands in for it: call it ONCE (typically
18
+ // from a component's field initializer, inside an injection context) with a GETTER so it can
19
+ // keep reading the caller's own signals — same reason Vue's composable takes a getter too.
16
20
  //
17
21
  // readonly hideAnimation = inject(HideAnimationService).connect(() => this.config());
18
22
  // // template: [style]="hideAnimation().container.style", (layout)="..." etc.
19
23
  @Injectable({ providedIn: 'root' })
20
24
  export class HideAnimationService {
21
- // Captured in the constructor (itself always run inside an injection context by Angular's
22
- // own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
23
- // code that is not, on its own, an active injection context — mirrors create-tunnel.ts's
24
- // `TunnelOut`, which passes its own captured `Injector` to `effect()` for the same reason.
25
+ // Captured in the constructor (always run inside an injection context by Angular's own DI)
26
+ // so `connect()` can create an `effect()` even when called from field-initializer code that
27
+ // isn't itself an active injection context — mirrors create-tunnel.ts's `TunnelOut`.
25
28
  private readonly injector = inject(Injector);
26
29
 
30
+ // The controller reads the native constants in its constructor, so a missing RNBootSplash
31
+ // throws out of connect() and aborts the host component's construction — deliberately: that
32
+ // is a build error, and a splash quietly stuck in light mode would ship unnoticed.
27
33
  connect(getConfig: () => IHideAnimationConfig): Signal<IHideAnimationResult> {
28
34
  const controller = new HideAnimationController(getConfig());
29
- const constants = getHideAnimationConstants();
30
35
 
31
- effect(() => controller.updateConfig(getConfig()), { injector: this.injector });
36
+ effect(() => controller.updateConfig(getConfig()), {
37
+ injector: this.injector,
38
+ });
32
39
 
33
- return computed(() => computeHideAnimationStyles(getConfig(), constants, controller));
40
+ return computed(() =>
41
+ computeHideAnimationStyles(getConfig(), controller.constants, controller),
42
+ );
34
43
  }
35
44
  }
@@ -1,5 +1,11 @@
1
+ import { dlog } from '@symbiote-native/engine';
1
2
  import { hide } from './hide';
2
- import type { IHideAnimationConfig } from './types';
3
+ import { getHideAnimationConstants } from './native-module';
4
+ import type {
5
+ IHideAnimationConfig,
6
+ IHideAnimationConstants,
7
+ IHideAnimationFailure,
8
+ } from './types';
3
9
 
4
10
  type IReadinessState = {
5
11
  layoutReady: boolean;
@@ -7,6 +13,7 @@ type IReadinessState = {
7
13
  brandReady: boolean;
8
14
  userReady: boolean;
9
15
  animate: () => void;
16
+ onError: ((failure: IHideAnimationFailure) => void) | undefined;
10
17
  animateHasBeenCalled: boolean;
11
18
  };
12
19
 
@@ -16,9 +23,28 @@ type IReadinessState = {
16
23
  // brandReady are captured ONCE at construction (mirrors the original's useRef factory,
17
24
  // evaluated only on first render) — a config that later drops its logo/brand source does
18
25
  // NOT retroactively flip readiness back on, only updateConfig's animate/userReady do.
26
+ //
27
+ // DELIBERATE DIVERGENCE from upstream, one place only: upstream swallows a rejected hide() with a
28
+ // bare `.catch(() => {})`, which strands the app under a splash it can no longer dismiss (see
29
+ // maybeRunAnimate). We fail open and report instead. Everything else, the unguarded constants read
30
+ // included, stays a faithful port.
19
31
  export class HideAnimationController {
32
+ // Read once here rather than once per adapter: the values never change over a splash's lifetime.
33
+ // Unguarded on purpose — a missing RNBootSplash is a build error that must stay loud, see
34
+ // native-module.ts for the full reasoning before wrapping this in anything.
35
+ readonly constants: IHideAnimationConstants;
36
+
20
37
  private readonly readiness: IReadinessState;
21
38
 
39
+ // dlog is DEBUG-gated, so it is the developer's seam, not the report: config.onError is the
40
+ // channel the app actually hears about this on.
41
+ private readonly reportFailure = (failure: IHideAnimationFailure): void => {
42
+ dlog(
43
+ `splash-screen: hide animation degraded at "${failure.stage}": ${String(failure.error)}`,
44
+ );
45
+ this.readiness.onError?.(failure);
46
+ };
47
+
22
48
  constructor(config: IHideAnimationConfig) {
23
49
  this.readiness = {
24
50
  layoutReady: false,
@@ -26,12 +52,15 @@ export class HideAnimationController {
26
52
  brandReady: config.manifest.brand == null || config.brand == null,
27
53
  userReady: config.ready ?? true,
28
54
  animate: config.animate,
55
+ onError: config.onError,
29
56
  animateHasBeenCalled: false,
30
57
  };
58
+ this.constants = getHideAnimationConstants();
31
59
  }
32
60
 
33
61
  updateConfig(config: IHideAnimationConfig): void {
34
62
  this.readiness.animate = config.animate;
63
+ this.readiness.onError = config.onError;
35
64
  this.readiness.userReady = config.ready ?? true;
36
65
  this.maybeRunAnimate();
37
66
  }
@@ -62,9 +91,22 @@ export class HideAnimationController {
62
91
  !state.animateHasBeenCalled
63
92
  ) {
64
93
  state.animateHasBeenCalled = true;
94
+ // Fail open. animateHasBeenCalled is already true by the time hide() settles, so the gate
95
+ // is shut for good: on a rejection there is no readiness callback left that could retry,
96
+ // and skipping animate() means the caller's splash overlay never fades out — the app sits
97
+ // under it forever. Running animate() anyway costs at worst a fade over a native splash
98
+ // that is still up; not running it costs the whole app.
65
99
  hide({ fade: false })
66
- .then(() => state.animate())
67
- .catch(() => {});
100
+ .catch((error: unknown) => {
101
+ this.reportFailure({ stage: 'hide', error });
102
+ })
103
+ .then(() => {
104
+ state.animate();
105
+ })
106
+ .catch((error: unknown) => {
107
+ // The caller's own animation throwing must not become an unhandled rejection either.
108
+ this.reportFailure({ stage: 'animate', error });
109
+ });
68
110
  }
69
111
  }
70
112
  }
package/src/core/index.ts CHANGED
@@ -7,6 +7,8 @@ export type {
7
7
  IManifest,
8
8
  IHideAnimationConfig,
9
9
  IHideAnimationContainerProps,
10
+ IHideAnimationFailure,
11
+ IHideAnimationFailureStage,
10
12
  IHideAnimationImageProps,
11
13
  IHideAnimationResult,
12
14
  IHideAnimationConstants,
@@ -14,6 +14,26 @@ type IRNBootSplashSpec = {
14
14
  getConstants(): IHideAnimationConstants;
15
15
  };
16
16
 
17
+ // DELIBERATELY UNGUARDED — do not wrap this in a try/catch or hand it a fallback.
18
+ //
19
+ // A missing RNBootSplash is a BUILD error, not a runtime condition: the module is either linked
20
+ // into the binary or it is not, deterministically, on the very first launch. Upstream treats it
21
+ // the same way and does not soften it either — react-native-bootsplash's whole spec file is
22
+ // `TurboModuleRegistry.getEnforcing<Spec>("RNBootSplash")` (src/specs/NativeRNBootSplash.ts),
23
+ // which throws at module-IMPORT time, and its useHideAnimation calls `NativeModule.getConstants()`
24
+ // with no guard at all. `getEnforcing` exists precisely to make this loud.
25
+ //
26
+ // This repo has a live footgun that depends on it staying loud: `npm install` deletes the
27
+ // `.rn-bootsplash/` folder this package's podspec vendors at pod-install time (see CLAUDE.md), so
28
+ // a skipped `pod install` yields exactly this missing module. Degrading to light-mode defaults
29
+ // would turn that into "the splash looks fine, just never dark" and it would ship.
30
+ //
31
+ // Note the failure is currently invisible under @symbiote-native/react specifically: mount()
32
+ // (adapters/react/src/render.ts) wires the reconciler's uncaught-error callbacks to `noop`, so the
33
+ // throw never reaches the app. That is a defect in THAT adapter, tracked separately — it is not a
34
+ // reason to stop throwing here.
17
35
  export function getHideAnimationConstants(): IHideAnimationConstants {
18
- return getEnforcingNativeModule<IRNBootSplashSpec>(RN_BOOT_SPLASH_MODULE_NAME).getConstants();
36
+ return getEnforcingNativeModule<IRNBootSplashSpec>(
37
+ RN_BOOT_SPLASH_MODULE_NAME,
38
+ ).getConstants();
19
39
  }
package/src/core/types.ts CHANGED
@@ -1,4 +1,7 @@
1
- import type { IImageSourceProp, IResizeMode } from '@symbiote-native/components';
1
+ import type {
2
+ IImageSourceProp,
3
+ IResizeMode,
4
+ } from '@symbiote-native/components';
2
5
  import type { IStyleProp, IViewStyle } from '@symbiote-native/engine';
3
6
 
4
7
  export type IHideConfig = {
@@ -19,6 +22,21 @@ export type IManifest = {
19
22
  };
20
23
  };
21
24
 
25
+ // The two RECOVERABLE points in the hide sequence, both of them runtime failures of a native
26
+ // module that does exist:
27
+ // hide - the native hide() call rejected.
28
+ // animate - the caller's own fade-out threw.
29
+ // Neither is allowed to strand the app under a splash it can no longer dismiss, so each is
30
+ // reported and the sequence carries on. A `hide` failure means the native splash may still be up
31
+ // underneath the caller's fade-out. A MISSING native module is deliberately not on this list —
32
+ // that is a build error and it throws (see native-module.ts).
33
+ export type IHideAnimationFailureStage = 'hide' | 'animate';
34
+
35
+ export type IHideAnimationFailure = {
36
+ stage: IHideAnimationFailureStage;
37
+ error: unknown;
38
+ };
39
+
22
40
  export type IHideAnimationConfig = {
23
41
  manifest: IManifest;
24
42
  ready?: boolean;
@@ -30,6 +48,10 @@ export type IHideAnimationConfig = {
30
48
 
31
49
  animate: () => void;
32
50
 
51
+ // The caller's only way to tell a nominal hide from a degraded one: `animate()` now runs in
52
+ // both cases, so its firing no longer proves the native side succeeded.
53
+ onError?: (failure: IHideAnimationFailure) => void;
54
+
33
55
  statusBarTranslucent?: boolean;
34
56
  navigationBarTranslucent?: boolean;
35
57
  };
@@ -1,40 +1,35 @@
1
- // React lifecycle wiring over the framework-agnostic HideAnimationController + style
2
- // computation (core/) — mirrors the lifecycle-bucket naming convention of
3
- // adapters/react/src/hooks. Faithful port of react-native-bootsplash's own useHideAnimation:
4
- // the controller is constructed lazily ONCE (a useRef factory, never reconstructed across
5
- // re-renders), native constants are read once via useState's lazy initializer (they never
6
- // change), and an effect with NO dependency array re-syncs the controller's config after
7
- // EVERY render — intentional, since `ready` flipping true only gets picked up this way.
1
+ // Port of react-native-bootsplash's own useHideAnimation over the framework-agnostic
2
+ // HideAnimationController + style computation in core/. The controller is built lazily ONCE
3
+ // via a useRef factory (never reconstructed across re-renders); the effect below has NO
4
+ // dependency array and re-syncs the controller's config after EVERY render on purpose, since
5
+ // `ready` flipping true is only picked up that way. The native constants ride along on that same
6
+ // once-built controller, so there is no separate useState to hold them.
8
7
  //
9
- // No useMemo around the style computation: upstream lists ~15 individual primitive fields
10
- // (manifest.logo.width, backgroundColor, ...) as its memo's deps specifically so Object.is
11
- // compares by VALUE, not by the `config`/`manifest` object's reference — callers construct
12
- // that object fresh on every render (the normal way to call this hook), so keying a memo off
13
- // the whole object would recompute every render anyway while looking like it memoizes.
14
- // Reproducing the fine-grained list isn't worth it for a splash screen shown for a couple of
15
- // renders at boot; computing plainly is honest about the actual cost and simpler to read.
16
- import { useEffect, useRef, useState } from 'react';
8
+ // No useMemo around the style computation: upstream memoizes on ~15 individual primitive
9
+ // fields so Object.is compares by value rather than by the config/manifest object's
10
+ // reference (callers construct that object fresh every render, so keying off the whole
11
+ // object would recompute anyway). Not worth reproducing for a splash screen shown a couple
12
+ // of renders at boot — computing plainly is simpler and equally cheap.
13
+ import { useEffect, useRef } from 'react';
17
14
  import {
18
15
  computeHideAnimationStyles,
19
- getHideAnimationConstants,
20
16
  HideAnimationController,
21
17
  type IHideAnimationConfig,
22
- type IHideAnimationConstants,
23
18
  type IHideAnimationResult,
24
19
  } from '../../../core';
25
20
 
26
- export function useHideAnimation(config: IHideAnimationConfig): IHideAnimationResult {
21
+ export function useHideAnimation(
22
+ config: IHideAnimationConfig,
23
+ ): IHideAnimationResult {
27
24
  const controllerRef = useRef<HideAnimationController | null>(null);
28
25
  if (controllerRef.current == null) {
29
26
  controllerRef.current = new HideAnimationController(config);
30
27
  }
31
28
  const controller = controllerRef.current;
32
29
 
33
- const [constants] = useState<IHideAnimationConstants>(() => getHideAnimationConstants());
34
-
35
30
  useEffect(() => {
36
31
  controller.updateConfig(config);
37
32
  });
38
33
 
39
- return computeHideAnimationStyles(config, constants, controller);
34
+ return computeHideAnimationStyles(config, controller.constants, controller);
40
35
  }
@@ -6,4 +6,11 @@
6
6
 
7
7
  export { hide, isVisible } from '../core';
8
8
  export { useHideAnimation } from './hooks/use-hide-animation';
9
- export type { IHideAnimationConfig, IHideAnimationResult, IManifest, IHideConfig } from '../core';
9
+ export type {
10
+ IHideAnimationConfig,
11
+ IHideAnimationFailure,
12
+ IHideAnimationFailureStage,
13
+ IHideAnimationResult,
14
+ IManifest,
15
+ IHideConfig,
16
+ } from '../core';
@@ -0,0 +1,17 @@
1
+ // @symbiote-native/splash-screen/solid: the Solid entry over the framework-agnostic core.
2
+ // hide/isVisible carry zero lifecycle and are re-exported verbatim; createHideAnimation wraps
3
+ // HideAnimationController + computeHideAnimationStyles with Solid's own reactivity
4
+ // (primitives/create-hide-animation.ts) — mirrors the lifecycle-bucket naming convention of
5
+ // adapters/solid/src/primitives (never `hooks`/`composables`/`runes`, those are React's, Vue's
6
+ // and Svelte's terms).
7
+
8
+ export { hide, isVisible } from '../core';
9
+ export { createHideAnimation } from './primitives/create-hide-animation';
10
+ export type {
11
+ IHideAnimationConfig,
12
+ IHideAnimationFailure,
13
+ IHideAnimationFailureStage,
14
+ IHideAnimationResult,
15
+ IManifest,
16
+ IHideConfig,
17
+ } from '../core';
@@ -0,0 +1,37 @@
1
+ // Solid lifecycle wiring over the framework-agnostic HideAnimationController + style computation
2
+ // (core/) — the Solid twin of React's useHideAnimation hook, Vue's composable and Svelte's rune.
3
+ //
4
+ // `primitives/` and `create*`, never `hooks/`+`use*`: Solid's ecosystem calls a composable
5
+ // reactive function a PRIMITIVE and reserves `use*` for consuming something that already exists.
6
+ // Full rationale in adapters/solid/src/primitives/create-color-scheme.ts.
7
+ //
8
+ // Takes a config ACCESSOR, not a plain value, and returns one: a Solid component body runs ONCE
9
+ // (like Vue's setup, unlike a React hook re-running every render), so a plain config would freeze
10
+ // at its boot value and `ready` flipping true would never be seen. The effect below re-syncs the
11
+ // controller on every signal the accessor reads, mirroring Vue's watchEffect.
12
+ //
13
+ // The controller stays a plain local, never a signal: only its methods are called. It also carries
14
+ // the native constants, read once in its constructor — so a missing RNBootSplash throws straight
15
+ // out of the primitive body, on purpose.
16
+
17
+ import { createEffect, createMemo, type Accessor } from 'solid-js';
18
+ import {
19
+ computeHideAnimationStyles,
20
+ HideAnimationController,
21
+ type IHideAnimationConfig,
22
+ type IHideAnimationResult,
23
+ } from '../../core';
24
+
25
+ export function createHideAnimation(
26
+ config: Accessor<IHideAnimationConfig>,
27
+ ): Accessor<IHideAnimationResult> {
28
+ const controller = new HideAnimationController(config());
29
+
30
+ createEffect(() => {
31
+ controller.updateConfig(config());
32
+ });
33
+
34
+ return createMemo(() =>
35
+ computeHideAnimationStyles(config(), controller.constants, controller),
36
+ );
37
+ }
@@ -0,0 +1,16 @@
1
+ // @symbiote-native/splash-screen/svelte: the Svelte entry over the framework-agnostic core.
2
+ // hide/isVisible carry zero lifecycle and are re-exported verbatim; useHideAnimation wraps
3
+ // HideAnimationController + computeHideAnimationStyles with Svelte's own runes
4
+ // (runes/use-hide-animation.svelte.ts) — mirrors the lifecycle-bucket naming convention of
5
+ // adapters/svelte/src/runes (never `hooks`/`composables`, those are React's/Vue's terms).
6
+
7
+ export { hide, isVisible } from '../core';
8
+ export { useHideAnimation } from './runes/use-hide-animation.svelte';
9
+ export type {
10
+ IHideAnimationConfig,
11
+ IHideAnimationFailure,
12
+ IHideAnimationFailureStage,
13
+ IHideAnimationResult,
14
+ IManifest,
15
+ IHideConfig,
16
+ } from '../core';
@@ -0,0 +1,41 @@
1
+ // Svelte lifecycle wiring over the framework-agnostic HideAnimationController + style
2
+ // computation (core/). A Svelte component's `<script>` body runs ONCE (like Vue's setup,
3
+ // unlike a React hook re-running every render), so this takes a config GETTER, not a plain
4
+ // value — the boxed-getter convention from use-color-scheme.svelte.ts. The controller stays
5
+ // a plain local, not `$state`: only its methods are called, nothing needs Svelte to react to
6
+ // the reference itself. `$effect` re-syncs the controller's config on every reactive read
7
+ // inside `getConfig()`, mirroring Vue's `watchEffect`. The controller also carries the native
8
+ // constants, read once in its constructor — so a missing RNBootSplash throws straight out of the
9
+ // component's script body, on purpose.
10
+ import {
11
+ computeHideAnimationStyles,
12
+ HideAnimationController,
13
+ type IHideAnimationConfig,
14
+ type IHideAnimationResult,
15
+ } from '../../core';
16
+
17
+ export function useHideAnimation(getConfig: () => IHideAnimationConfig): {
18
+ readonly current: IHideAnimationResult;
19
+ } {
20
+ const controller = new HideAnimationController(getConfig());
21
+
22
+ let result = $state<IHideAnimationResult>(
23
+ computeHideAnimationStyles(getConfig(), controller.constants, controller),
24
+ );
25
+
26
+ $effect(() => {
27
+ const config = getConfig();
28
+ controller.updateConfig(config);
29
+ result = computeHideAnimationStyles(
30
+ config,
31
+ controller.constants,
32
+ controller,
33
+ );
34
+ });
35
+
36
+ return {
37
+ get current(): IHideAnimationResult {
38
+ return result;
39
+ },
40
+ };
41
+ }
@@ -0,0 +1,6 @@
1
+ // Pulls in svelte's ambient global declarations ($state/$effect/...) for this package's tsc
2
+ // program. adapters/svelte gets these for free because render.ts does a real value import from
3
+ // 'svelte' (any file in a program importing a module loads its ambient globals for the whole
4
+ // program); this package has no such import, so a triple-slash reference does the same job
5
+ // explicitly rather than relying on an incidental side-effect.
6
+ /// <reference types="svelte" />