@symbiote-native/solid 3.3.0 → 3.4.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.
package/build/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import './register';
2
2
  export { mount, unmount } from './render';
3
+ export { RootTagContext } from './root-tag-context';
3
4
  export { findNodeHandle } from './host-instance';
4
5
  export type { IHostInstance } from './host-instance';
5
6
  export * from './components';
@@ -31,7 +32,7 @@ export { Platform, StyleSheet, PixelRatio, PlatformColor, DynamicColorIOS, proce
31
32
  export { setNativeViewConfigSource, setColorProcessor, } from '@symbiote-native/engine';
32
33
  export { dlog, isDebug } from '@symbiote-native/engine';
33
34
  export type { IViewStyle, ITextStyle, IFlexAlign, IFlexJustify, ISymbioteEvent, ISymbioteNode, IRootTag, INativeViewConfig, INativeViewConfigSource, IColorValue, IOpaqueColorValue, IDynamicColorIOSTuple, IPixelRatioStatic, IPlatformStatic, IPlatformOSType, IPlatformConstantsIOS, IPlatformConstantsAndroid, IPlatformSelectSpec, } from '@symbiote-native/engine';
34
- export { Alert, Share, ActionSheetIOS, Linking, Vibration, ToastAndroid, Settings, I18nManager, Dimensions, Appearance, AppState, Keyboard, KEYBOARD_EVENT, TextInputState, BackHandler, PermissionsAndroid, PERMISSIONS, RESULTS, LayoutAnimation, InteractionManager, } from '@symbiote-native/engine';
35
+ export { Alert, Share, ActionSheetIOS, Linking, Vibration, ToastAndroid, Settings, I18nManager, Dimensions, Appearance, matchMedia, MediaQueryList, MediaQueryListEvent, setVariable, getComputedVariable, registerProperty, AppState, Keyboard, KEYBOARD_EVENT, TextInputState, BackHandler, PermissionsAndroid, PERMISSIONS, RESULTS, LayoutAnimation, InteractionManager, } from '@symbiote-native/engine';
35
36
  export type { IAlertType, IAlertButtonStyle, IAlertButton, IAlertButtons, IAlertOptions, IShareContent, IShareOptions, IShareAction, IActionSheetIOSOptions, IShareActionSheetIOSOptions, IShareActionSheetError, IUrlEvent, II18nManagerConstants, IDisplayMetrics, IDisplayMetricsAndroid, IDimensionsPayload, IDimensionsSet, IDimensionsKey, IDimensionsChangeListener, IDimensionsStatic, IColorSchemeName, IColorSchemePreference, IAppStateStatus, IAppStateEvent, IKeyboardEventName, IKeyboardEvent, IKeyboardMetrics, IBackPressEventName, IBackPressHandler, IPermission, IPermissionStatus, IRationale, ILayoutAnimationType, ILayoutAnimationProperty, ILayoutAnimationConfig, ILayoutAnimationAnim, IInteractionEvent, ISimpleTask, IPromiseTask, ITask, IHandle, } from '@symbiote-native/engine';
36
37
  export { PanResponder } from '@symbiote-native/engine';
37
38
  export type { IPanResponderGestureState, IPanResponderCallbacks, IGestureResponderHandlers, IPanResponderInstance, } from '@symbiote-native/engine';
package/build/index.js CHANGED
@@ -20,6 +20,7 @@
20
20
  // Bare, side-effect only, and deliberately NOT `export * from './register'` — see that file.
21
21
  import './register.js';
22
22
  export { mount, unmount } from './render.js';
23
+ export { RootTagContext } from './root-tag-context.js';
23
24
  export { findNodeHandle } from './host-instance.js';
24
25
  export * from './components.js';
25
26
  // The app-entry seam that hands Image RN's own source resolver; grouped with the Image types it
@@ -77,7 +78,7 @@ export { setNativeViewConfigSource, setColorProcessor, } from '@symbiote-native/
77
78
  export { dlog, isDebug } from '@symbiote-native/engine';
78
79
  // Imperative runtime modules: thin JS over getNativeModule + device events, no Fabric component
79
80
  // of their own, so there is nothing per-framework to write.
80
- export { Alert, Share, ActionSheetIOS, Linking, Vibration, ToastAndroid, Settings, I18nManager, Dimensions, Appearance, AppState, Keyboard, KEYBOARD_EVENT, TextInputState, BackHandler, PermissionsAndroid, PERMISSIONS, RESULTS, LayoutAnimation, InteractionManager, } from '@symbiote-native/engine';
81
+ export { Alert, Share, ActionSheetIOS, Linking, Vibration, ToastAndroid, Settings, I18nManager, Dimensions, Appearance, matchMedia, MediaQueryList, MediaQueryListEvent, setVariable, getComputedVariable, registerProperty, AppState, Keyboard, KEYBOARD_EVENT, TextInputState, BackHandler, PermissionsAndroid, PERMISSIONS, RESULTS, LayoutAnimation, InteractionManager, } from '@symbiote-native/engine';
81
82
  // PanResponder: the gesture recognizer over the engine's responder events, shared by every adapter.
82
83
  export { PanResponder } from '@symbiote-native/engine';
83
84
  // AccessibilityInfo comes STRAIGHT from the engine, which owns the iOS/Android split
package/build/render.js CHANGED
@@ -4,10 +4,10 @@
4
4
  import { createSurface, disposeRoot, dlog, reportUncaughtError, } from '@symbiote-native/engine';
5
5
  import { catchError, createRoot } from 'solid-js';
6
6
  import { createComponent, insert, setActiveSurface } from './renderer.js';
7
- // One Solid root per surface, so a surface can be torn down (unmount) or cleanly re-mounted on the
8
- // same rootTag: the bridgeless host stops and restarts a surface on Fast Refresh and on
9
- // lifecycle/focus changes, reusing the rootTag. The value is Solid's own dispose function — the
10
- // whole reactive root goes with it, effects and cleanups included.
7
+ import { RootTagContext } from './root-tag-context.js';
8
+ // One Solid root per surface, so a surface can be torn down or re-mounted on the same `rootTag`
9
+ // The bridgeless host does that on Fast Refresh and on lifecycle or focus changes
10
+ // The value is Solid's own `dispose`, the whole reactive root goes with it
11
11
  const roots = new Map();
12
12
  // Insertion-ordered, so the last entry is the most recently mounted surface. Kept alongside
13
13
  // `roots` only to answer one question: when a surface is torn down, is there another one still
@@ -21,16 +21,9 @@ function teardown(rootTag) {
21
21
  dispose();
22
22
  roots.delete(rootTag);
23
23
  surfaces.delete(rootTag);
24
- // Cleared AFTER dispose() on purpose: disposing runs user cleanups, which can still mutate the
25
- // tree, and those mutations should reach the surface they belong to rather than be dropped by
26
- // renderer.ts's post-unmount guard.
27
- //
28
- // And cleared ONLY when the surface going away is the one the renderer is actually committing
29
- // into. Clearing unconditionally killed a surface that was still mounted: with two surfaces up,
30
- // unmounting the FIRST left the second alive but permanently uncommitted — every later mutation
31
- // hit renderer.ts's "mutation after unmount" guard and was silently dropped. That is reachable
32
- // from ordinary code the moment two surfaces exist, which is exactly the createTunnel case
33
- // (../create-tunnel): the source surface stops, the target must keep painting.
24
+ // Cleared after `dispose()`, since user cleanups run inside it and can still mutate the tree
25
+ // Cleared only for the surface the renderer commits into, else a live surface goes dead
26
+ // With two surfaces up, unmounting the first must leave the second painting, as `createTunnel`
34
27
  if (activeRootTag !== rootTag) {
35
28
  disposeRoot(rootTag);
36
29
  return;
@@ -47,23 +40,18 @@ export function mount(rootTag, RootComponent) {
47
40
  surfaces.set(rootTag, surface);
48
41
  activeRootTag = rootTag;
49
42
  setActiveSurface(surface);
50
- // `createComponent(RootComponent, {})` is exactly what compiled JSX emits for `<RootComponent />`
51
- // — written by hand here because this file is plain TS, deliberately: render.ts is the one module
52
- // an app's entry point imports before any JSX has been compiled, so keeping it JSX-free means it
53
- // needs no Babel pass of its own.
54
- //
55
- // The surface IS the render container: a top-level insert routes to surface.appendChild
56
- // (renderer.ts's insertNode), and the engine wraps surface.children in its synthetic flex root.
57
- //
58
- // `createRoot` + `insert` IS renderer.ts's `render(code, surface)`, spelled out so `catchError`
59
- // can sit BETWEEN them. Solid's own `render` runs `insert(element, code())` — the insert lands
60
- // outside anything `code` wrapped, so a root component returning a bare accessor would build its
61
- // render effect under an owner with no error handler and throw past this seam. Written this way
62
- // the insert is inside, and every computation the mount creates inherits the handler.
43
+ // `createComponent` is what compiled JSX emits, written by hand: render.ts must stay JSX-free
44
+ // `createRoot` + `insert` is `render()` spelled out, so `catchError` wraps the insert as well
45
+ // The Provider hands the surface tag to `useContext(RootTagContext)` for the whole tree
63
46
  let unwinding;
64
47
  const dispose = createRoot(disposeRootScope => {
65
48
  catchError(() => {
66
- insert(surface, createComponent(RootComponent, {}));
49
+ insert(surface, createComponent(RootTagContext.Provider, {
50
+ value: rootTag,
51
+ get children() {
52
+ return createComponent(RootComponent, {});
53
+ },
54
+ }));
67
55
  }, error => {
68
56
  if (unwinding?.error !== error) {
69
57
  unwinding = { error };
@@ -0,0 +1 @@
1
+ export declare const RootTagContext: import("solid-js").Context<number>;
@@ -0,0 +1,4 @@
1
+ // RN's `RootTagContext`: every `mount` provides the tag of its surface, 0 stays the default
2
+ import { createContext } from 'solid-js';
3
+ const NO_SURFACE = 0;
4
+ export const RootTagContext = createContext(NO_SURFACE);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbiote-native/solid",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "SymbioteNative's Solid adapter — a solid-js/universal createRenderer driving real native iOS/Android views through the same engine as every other adapter.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -68,13 +68,13 @@
68
68
  "peerDependencies": {
69
69
  "solid-js": ">=1.9.0",
70
70
  "react-native": ">=0.86",
71
- "@symbiote-native/engine": "^1.7.0"
71
+ "@symbiote-native/engine": "^1.8.0"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@babel/core": "^7.25.2",
75
75
  "solid-js": "^1.9.14",
76
- "@symbiote-native/engine": "1.7.0",
77
- "@symbiote-native/test-utils": "0.5.0"
76
+ "@symbiote-native/engine": "1.8.0",
77
+ "@symbiote-native/test-utils": "0.5.1"
78
78
  },
79
79
  "scripts": {
80
80
  "typecheck": "tsc --build",