@symbiote-native/solid 3.0.5 → 3.1.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 +3 -0
- package/build/index.js +3 -0
- package/build/primitives/create-event-value-hook.d.ts +3 -0
- package/build/primitives/create-event-value-hook.js +15 -0
- package/build/primitives/create-permission-hook.d.ts +3 -0
- package/build/primitives/create-permission-hook.js +17 -0
- package/build/primitives/create-resource-hook.d.ts +7 -0
- package/build/primitives/create-resource-hook.js +15 -0
- package/package.json +6 -6
package/build/index.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export { createTunnel } from './create-tunnel';
|
|
|
17
17
|
export type { ITunnel, ITunnelInProps } from './create-tunnel';
|
|
18
18
|
export { createColorScheme } from './primitives/create-color-scheme';
|
|
19
19
|
export { createWindowDimensions } from './primitives/create-window-dimensions';
|
|
20
|
+
export { createPermissionHook } from './primitives/create-permission-hook';
|
|
21
|
+
export { createResourceHook } from './primitives/create-resource-hook';
|
|
22
|
+
export { createEventValueHook } from './primitives/create-event-value-hook';
|
|
20
23
|
export { Animated, createAnimatedComponent } from './modules/animated';
|
|
21
24
|
export type { IAnimatedComponentProps } from './modules/animated';
|
|
22
25
|
export { Platform, StyleSheet, PixelRatio, PlatformColor, DynamicColorIOS, processColor, } from '@symbiote-native/engine';
|
package/build/index.js
CHANGED
|
@@ -62,6 +62,9 @@ export { createTunnel } from './create-tunnel/index.jsx';
|
|
|
62
62
|
// the subscription logic; these add only the Solid lifecycle (signal + onCleanup).
|
|
63
63
|
export { createColorScheme } from './primitives/create-color-scheme.js';
|
|
64
64
|
export { createWindowDimensions } from './primitives/create-window-dimensions.js';
|
|
65
|
+
export { createPermissionHook } from './primitives/create-permission-hook.js';
|
|
66
|
+
export { createResourceHook } from './primitives/create-resource-hook.js';
|
|
67
|
+
export { createEventValueHook } from './primitives/create-event-value-hook.js';
|
|
65
68
|
export { Animated, createAnimatedComponent } from './modules/animated/index.js';
|
|
66
69
|
// Everything below is re-exported VERBATIM from the shared packages — no Solid half exists or is
|
|
67
70
|
// wanted, so a passthrough stub file would only add a hop (.claude/rules/barrel-passthrough.md).
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type Accessor } from 'solid-js';
|
|
2
|
+
import type { IEventValueSource } from '@symbiote-native/engine';
|
|
3
|
+
export declare function createEventValueHook<TSource extends IEventValueSource<TValue, TEvent>, TValue, TEvent extends string = string>(event: TEvent, getValue: (source: TSource) => TValue): (getSource: Accessor<TSource>) => Accessor<TValue>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Every `useXStatus`-style primitive (`useAudioPlayerStatus`, `useAudioPlaylistStatus`, ...)
|
|
2
|
+
// binds this to its own event name + initial-value getter instead of repeating the effect wiring
|
|
3
|
+
import { createEffect, createSignal, onCleanup } from 'solid-js';
|
|
4
|
+
export function createEventValueHook(event, getValue) {
|
|
5
|
+
return function useEventValue(getSource) {
|
|
6
|
+
const [value, setValue] = createSignal(getValue(getSource()));
|
|
7
|
+
createEffect(() => {
|
|
8
|
+
const source = getSource();
|
|
9
|
+
setValue(() => getValue(source));
|
|
10
|
+
const subscription = source.addListener(event, next => setValue(() => next));
|
|
11
|
+
onCleanup(() => subscription.remove());
|
|
12
|
+
});
|
|
13
|
+
return value;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type Accessor } from 'solid-js';
|
|
2
|
+
import { type IPermissionHookBehavior, type IPermissionHookMethods } from '@symbiote-native/engine';
|
|
3
|
+
export declare function createPermissionHook<TPermission, TOptions extends object>(methods: IPermissionHookMethods<TPermission, TOptions>): (behavior?: IPermissionHookBehavior, methodOptions?: TOptions) => [Accessor<TPermission | null>, () => Promise<TPermission>, () => Promise<TPermission>];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Every Expo-wrapper package's own permission primitive binds this factory to its `methods`
|
|
2
|
+
import { createSignal, onMount } from 'solid-js';
|
|
3
|
+
import { createPermissionApi, fetchInitialPermission, } from '@symbiote-native/engine';
|
|
4
|
+
export function createPermissionHook(methods) {
|
|
5
|
+
return function usePermission(behavior, methodOptions) {
|
|
6
|
+
const [status, setStatus] = createSignal(null);
|
|
7
|
+
const api = createPermissionApi(methods, value => setStatus(() => value));
|
|
8
|
+
onMount(() => {
|
|
9
|
+
fetchInitialPermission(methods, behavior, methodOptions, response => setStatus(() => response));
|
|
10
|
+
});
|
|
11
|
+
return [
|
|
12
|
+
status,
|
|
13
|
+
() => api.request(methodOptions),
|
|
14
|
+
() => api.get(methodOptions),
|
|
15
|
+
];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Accessor } from 'solid-js';
|
|
2
|
+
export type IResourceHookController<TArgs extends unknown[], TResource> = {
|
|
3
|
+
resolve: (...args: TArgs) => TResource;
|
|
4
|
+
flushDispose: () => void;
|
|
5
|
+
dispose: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function createResourceHook<TArgs extends unknown[], TResource>(createController: () => IResourceHookController<TArgs, TResource>): (getArgs: () => TArgs) => Accessor<TResource>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Every `useReleasingSharedObject`-style primitive (`useAudioPlayer`, `useImageManipulator`, ...)
|
|
2
|
+
// binds this to its own `createXController()` instead of repeating the memo/effect wiring
|
|
3
|
+
import { createEffect, createMemo, onCleanup } from 'solid-js';
|
|
4
|
+
export function createResourceHook(createController) {
|
|
5
|
+
return function useResource(getArgs) {
|
|
6
|
+
const controller = createController();
|
|
7
|
+
const resource = createMemo(() => controller.resolve(...getArgs()));
|
|
8
|
+
createEffect(() => {
|
|
9
|
+
resource();
|
|
10
|
+
controller.flushDispose();
|
|
11
|
+
});
|
|
12
|
+
onCleanup(() => controller.dispose());
|
|
13
|
+
return resource;
|
|
14
|
+
};
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/solid",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.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",
|
|
@@ -62,19 +62,19 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"babel-preset-solid": "^1.9.12",
|
|
64
64
|
"typescript": "~6.0.0",
|
|
65
|
-
"@symbiote-native/components": "3.1.
|
|
66
|
-
"@symbiote-native/css-parser": "0.5.
|
|
65
|
+
"@symbiote-native/components": "3.1.4",
|
|
66
|
+
"@symbiote-native/css-parser": "0.5.3"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"solid-js": ">=1.9.0",
|
|
70
70
|
"react-native": ">=0.86",
|
|
71
|
-
"@symbiote-native/engine": "^1.
|
|
71
|
+
"@symbiote-native/engine": "^1.5.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.
|
|
77
|
-
"@symbiote-native/test-utils": "0.4.
|
|
76
|
+
"@symbiote-native/engine": "1.5.0",
|
|
77
|
+
"@symbiote-native/test-utils": "0.4.6"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"typecheck": "tsc --build",
|