react-native-worklets 0.8.0-nightly-20260318-d2b8286a6 → 0.8.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.
@@ -5,5 +5,5 @@
5
5
  * version used to build the native part of the library in runtime. Remember to
6
6
  * keep this in sync with the version declared in `package.json`
7
7
  */
8
- export const jsVersion = '0.8.0-nightly-20260318-d2b8286a6';
8
+ export const jsVersion = '0.8.0';
9
9
  //# sourceMappingURL=jsVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jsVersion"],"sourceRoot":"../../../src","sources":["debug/jsVersion.ts"],"mappings":"AAAA,YAAY;;AAEZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,kCAAkC","ignoreList":[]}
1
+ {"version":3,"names":["jsVersion"],"sourceRoot":"../../../src","sources":["debug/jsVersion.ts"],"mappings":"AAAA,YAAY;;AAEZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,OAAO","ignoreList":[]}
@@ -2,6 +2,21 @@
2
2
 
3
3
  import { WorkletsError } from '../debug/WorkletsError';
4
4
 
5
+ /**
6
+ * Creates a new {@link Shareable} holding the provided initial value. You must
7
+ * explicitly declare which Worklet Runtime will host the Shareable by passing
8
+ * its `runtimeId`.
9
+ *
10
+ * Currently only hosting a Shareable on the UI Runtime is supported.
11
+ *
12
+ * @param hostRuntimeId - The `runtimeId` of the Worklet Runtime that will host
13
+ * the Shareable. Use {@link UIRuntimeId}.
14
+ * @param initial - The initial value of the Shareable.
15
+ * @param config - Optional advanced configuration.
16
+ * @returns The created {@link Shareable}.
17
+ * @see {@link https://docs.swmansion.com/react-native-worklets/docs/memory/createShareable | createShareable docs}
18
+ */
19
+
5
20
  /**
6
21
  * @deprecated Only UI host runtime is supported now. Use {@link UIRuntimeId} as
7
22
  * the `hostRuntimeId` argument.
@@ -1 +1 @@
1
- {"version":3,"names":["WorkletsError","createShareable","_hostRuntimeId","_initial","_config"],"sourceRoot":"../../../src","sources":["memory/shareable.ts"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,aAAa,QAAQ,wBAAwB;;AActD;AACA;AACA;AACA;;AAWA,OAAO,SAASC,eAAeA,CAK7BC,cAAsB,EACtBC,QAAgB,EAChBC,OAAkE,EACd;EACpD,MAAM,IAAIJ,aAAa,CAAC,4CAA4C,CAAC;AACvE","ignoreList":[]}
1
+ {"version":3,"names":["WorkletsError","createShareable","_hostRuntimeId","_initial","_config"],"sourceRoot":"../../../src","sources":["memory/shareable.ts"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,aAAa,QAAQ,wBAAwB;;AAItD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;;AAWA,OAAO,SAASC,eAAeA,CAK7BC,cAAsB,EACtBC,QAAgB,EAChBC,OAAkE,EACd;EACpD,MAAM,IAAIJ,aAAa,CAAC,4CAA4C,CAAC;AACvE","ignoreList":[]}
@@ -7,6 +7,21 @@ import { isWorkletFunction } from '../workletFunction';
7
7
  import { WorkletsModule } from '../WorkletsModule/NativeWorklets';
8
8
  import { createSerializable } from './serializable';
9
9
 
10
+ /**
11
+ * Creates a new {@link Shareable} holding the provided initial value. You must
12
+ * explicitly declare which Worklet Runtime will host the Shareable by passing
13
+ * its `runtimeId`.
14
+ *
15
+ * Currently only hosting a Shareable on the UI Runtime is supported.
16
+ *
17
+ * @param hostRuntimeId - The `runtimeId` of the Worklet Runtime that will host
18
+ * the Shareable. Use {@link UIRuntimeId}.
19
+ * @param initial - The initial value of the Shareable.
20
+ * @param config - Optional advanced configuration.
21
+ * @returns The created {@link Shareable}.
22
+ * @see {@link https://docs.swmansion.com/react-native-worklets/docs/memory/createShareable | createShareable docs}
23
+ */
24
+
10
25
  /**
11
26
  * @deprecated Only UI host runtime is supported now. Use {@link UIRuntimeId} as
12
27
  * the `hostRuntimeId` argument.
@@ -1 +1 @@
1
- {"version":3,"names":["WorkletsError","addGuardImplementation","UIRuntimeId","isWorkletFunction","WorkletsModule","createSerializable","createShareable","hostRuntimeId","initial","config","hostDecorator","guestDecorator","initSynchronously","__DEV__","shareableRef","globalThis","__shareableGuestUnpacker","_WORKLETS_BUNDLE_MODE_ENABLED"],"sourceRoot":"../../../src","sources":["memory/shareable.native.ts"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,aAAa,QAAQ,wBAAwB;AACtD,SAASC,sBAAsB,QAAQ,wBAAwB;AAC/D,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,kBAAkB,QAAQ,gBAAgB;;AAanD;AACA;AACA;AACA;;AAWA,OAAO,SAASC,eAAeA,CAK7BC,aAAqB,EACrBC,OAAe,EACfC,MAAiE,EACb;EACpD,MAAM;IAAEC,aAAa;IAAEC,cAAc;IAAEC;EAAkB,CAAC,GAAGH,MAAM,IAAI,CAAC,CAAC;EACzE,IAAII,OAAO,EAAE;IACX,IAAIN,aAAa,KAAKL,WAAW,EAAE;MACjC,MAAM,IAAIF,aAAa,CAAC,6CAA6C,CAAC;IACxE;IACA,IAAIU,aAAa,IAAI,CAACP,iBAAiB,CAACO,aAAa,CAAC,EAAE;MACtD,MAAM,IAAIV,aAAa,CAAC,0CAA0C,CAAC;IACrE;IACA,IAAIW,cAAc,IAAI,CAACR,iBAAiB,CAACQ,cAAc,CAAC,EAAE;MACxD,MAAM,IAAIX,aAAa,CAAC,2CAA2C,CAAC;IACtE;EACF;EAEA,MAAMc,YAAY,GAAGV,cAAc,CAACE,eAAe,CACjDJ,WAAW,EACXG,kBAAkB,CAACG,OAAO,CAAC,EAC3B,CAAC,CAACI,iBAAiB,EACnBP,kBAAkB,CAACK,aAAa,CAAC,EACjCL,kBAAkB,CAACM,cAAc,CACnC,CAAC;EAED,OAAOI,UAAU,CAACC,wBAAwB,CACxCd,WAAW,EACXY,YAAY,EACZH,cACF,CAAC;AACH;AAEA,IAAIE,OAAO,IAAIE,UAAU,CAACE,6BAA6B,EAAE;EACvDhB,sBAAsB,CAACK,eAAe,CAAC;AACzC","ignoreList":[]}
1
+ {"version":3,"names":["WorkletsError","addGuardImplementation","UIRuntimeId","isWorkletFunction","WorkletsModule","createSerializable","createShareable","hostRuntimeId","initial","config","hostDecorator","guestDecorator","initSynchronously","__DEV__","shareableRef","globalThis","__shareableGuestUnpacker","_WORKLETS_BUNDLE_MODE_ENABLED"],"sourceRoot":"../../../src","sources":["memory/shareable.native.ts"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,aAAa,QAAQ,wBAAwB;AACtD,SAASC,sBAAsB,QAAQ,wBAAwB;AAC/D,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,kBAAkB,QAAQ,gBAAgB;;AAGnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;;AAWA,OAAO,SAASC,eAAeA,CAK7BC,aAAqB,EACrBC,OAAe,EACfC,MAAiE,EACb;EACpD,MAAM;IAAEC,aAAa;IAAEC,cAAc;IAAEC;EAAkB,CAAC,GAAGH,MAAM,IAAI,CAAC,CAAC;EACzE,IAAII,OAAO,EAAE;IACX,IAAIN,aAAa,KAAKL,WAAW,EAAE;MACjC,MAAM,IAAIF,aAAa,CAAC,6CAA6C,CAAC;IACxE;IACA,IAAIU,aAAa,IAAI,CAACP,iBAAiB,CAACO,aAAa,CAAC,EAAE;MACtD,MAAM,IAAIV,aAAa,CAAC,0CAA0C,CAAC;IACrE;IACA,IAAIW,cAAc,IAAI,CAACR,iBAAiB,CAACQ,cAAc,CAAC,EAAE;MACxD,MAAM,IAAIX,aAAa,CAAC,2CAA2C,CAAC;IACtE;EACF;EAEA,MAAMc,YAAY,GAAGV,cAAc,CAACE,eAAe,CACjDJ,WAAW,EACXG,kBAAkB,CAACG,OAAO,CAAC,EAC3B,CAAC,CAACI,iBAAiB,EACnBP,kBAAkB,CAACK,aAAa,CAAC,EACjCL,kBAAkB,CAACM,cAAc,CACnC,CAAC;EAED,OAAOI,UAAU,CAACC,wBAAwB,CACxCd,WAAW,EACXY,YAAY,EACZH,cACF,CAAC;AACH;AAEA,IAAIE,OAAO,IAAIE,UAAU,CAACE,6BAA6B,EAAE;EACvDhB,sBAAsB,CAACK,eAAe,CAAC;AACzC","ignoreList":[]}
@@ -3,5 +3,5 @@
3
3
  * version used to build the native part of the library in runtime. Remember to
4
4
  * keep this in sync with the version declared in `package.json`
5
5
  */
6
- export declare const jsVersion = "0.8.0-nightly-20260318-d2b8286a6";
6
+ export declare const jsVersion = "0.8.0";
7
7
  //# sourceMappingURL=jsVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsVersion.d.ts","sourceRoot":"","sources":["../../../src/debug/jsVersion.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,SAAS,qCAAqC,CAAC"}
1
+ {"version":3,"file":"jsVersion.d.ts","sourceRoot":"","sources":["../../../src/debug/jsVersion.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,SAAS,UAAU,CAAC"}
@@ -1,9 +1,23 @@
1
1
  import type { UIRuntimeId } from '../runtimes';
2
- import type { SerializableRef, Shareable, ShareableConfig } from './types';
2
+ import type { Shareable, ShareableConfig } from './types';
3
+ /**
4
+ * Creates a new {@link Shareable} holding the provided initial value. You must
5
+ * explicitly declare which Worklet Runtime will host the Shareable by passing
6
+ * its `runtimeId`.
7
+ *
8
+ * Currently only hosting a Shareable on the UI Runtime is supported.
9
+ *
10
+ * @param hostRuntimeId - The `runtimeId` of the Worklet Runtime that will host
11
+ * the Shareable. Use {@link UIRuntimeId}.
12
+ * @param initial - The initial value of the Shareable.
13
+ * @param config - Optional advanced configuration.
14
+ * @returns The created {@link Shareable}.
15
+ * @see {@link https://docs.swmansion.com/react-native-worklets/docs/memory/createShareable | createShareable docs}
16
+ */
3
17
  export declare function createShareable<TValue = unknown, THostDecorated = unknown, TGuestDecorated = unknown>(hostRuntimeId: typeof UIRuntimeId, initial: TValue, config?: ShareableConfig<TValue, THostDecorated, TGuestDecorated>): Shareable<TValue, THostDecorated, TGuestDecorated>;
4
18
  /**
5
19
  * @deprecated Only UI host runtime is supported now. Use {@link UIRuntimeId} as
6
20
  * the `hostRuntimeId` argument.
7
21
  */
8
- export declare function createShareable<TValue = unknown, THostDecorated = unknown, TGuestDecorated = unknown>(hostRuntimeId: number, initial: SerializableRef<TValue>, config?: ShareableConfig<TValue, THostDecorated, TGuestDecorated>): Shareable<TValue, THostDecorated, TGuestDecorated>;
22
+ export declare function createShareable<TValue = unknown, THostDecorated = unknown, TGuestDecorated = unknown>(hostRuntimeId: number, initial: TValue, config?: ShareableConfig<TValue, THostDecorated, TGuestDecorated>): Shareable<TValue, THostDecorated, TGuestDecorated>;
9
23
  //# sourceMappingURL=shareable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shareable.d.ts","sourceRoot":"","sources":["../../../src/memory/shareable.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE3E,wBAAgB,eAAe,CAC7B,MAAM,GAAG,OAAO,EAChB,cAAc,GAAG,OAAO,EACxB,eAAe,GAAG,OAAO,EAEzB,aAAa,EAAE,OAAO,WAAW,EACjC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,CAAC,GAChE,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,MAAM,GAAG,OAAO,EAChB,cAAc,GAAG,OAAO,EACxB,eAAe,GAAG,OAAO,EAEzB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,EAChC,MAAM,CAAC,EAAE,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,CAAC,GAChE,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"shareable.d.ts","sourceRoot":"","sources":["../../../src/memory/shareable.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,MAAM,GAAG,OAAO,EAChB,cAAc,GAAG,OAAO,EACxB,eAAe,GAAG,OAAO,EAEzB,aAAa,EAAE,OAAO,WAAW,EACjC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,CAAC,GAChE,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,MAAM,GAAG,OAAO,EAChB,cAAc,GAAG,OAAO,EACxB,eAAe,GAAG,OAAO,EAEzB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,CAAC,GAChE,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC"}
@@ -1,9 +1,23 @@
1
1
  import { UIRuntimeId } from '../runtimes';
2
- import type { SerializableRef, Shareable, ShareableConfig } from './types';
2
+ import type { Shareable, ShareableConfig } from './types';
3
+ /**
4
+ * Creates a new {@link Shareable} holding the provided initial value. You must
5
+ * explicitly declare which Worklet Runtime will host the Shareable by passing
6
+ * its `runtimeId`.
7
+ *
8
+ * Currently only hosting a Shareable on the UI Runtime is supported.
9
+ *
10
+ * @param hostRuntimeId - The `runtimeId` of the Worklet Runtime that will host
11
+ * the Shareable. Use {@link UIRuntimeId}.
12
+ * @param initial - The initial value of the Shareable.
13
+ * @param config - Optional advanced configuration.
14
+ * @returns The created {@link Shareable}.
15
+ * @see {@link https://docs.swmansion.com/react-native-worklets/docs/memory/createShareable | createShareable docs}
16
+ */
3
17
  export declare function createShareable<TValue = unknown, THostDecorated = unknown, TGuestDecorated = unknown>(hostRuntimeId: typeof UIRuntimeId, initial: TValue, config?: ShareableConfig<TValue, THostDecorated, TGuestDecorated>): Shareable<TValue, THostDecorated, TGuestDecorated>;
4
18
  /**
5
19
  * @deprecated Only UI host runtime is supported now. Use {@link UIRuntimeId} as
6
20
  * the `hostRuntimeId` argument.
7
21
  */
8
- export declare function createShareable<TValue = unknown, THostDecorated = unknown, TGuestDecorated = unknown>(hostRuntimeId: number, initial: SerializableRef<TValue>, config?: ShareableConfig<TValue, THostDecorated, TGuestDecorated>): Shareable<TValue, THostDecorated, TGuestDecorated>;
22
+ export declare function createShareable<TValue = unknown, THostDecorated = unknown, TGuestDecorated = unknown>(hostRuntimeId: number, initial: TValue, config?: ShareableConfig<TValue, THostDecorated, TGuestDecorated>): Shareable<TValue, THostDecorated, TGuestDecorated>;
9
23
  //# sourceMappingURL=shareable.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shareable.native.d.ts","sourceRoot":"","sources":["../../../src/memory/shareable.native.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE3E,wBAAgB,eAAe,CAC7B,MAAM,GAAG,OAAO,EAChB,cAAc,GAAG,OAAO,EACxB,eAAe,GAAG,OAAO,EAEzB,aAAa,EAAE,OAAO,WAAW,EACjC,OAA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Ae,CAAC,CAAC"}
@@ -67,6 +67,11 @@ export type ShareableHostMeta = {
67
67
  isHost: true;
68
68
  __shareableRef: true;
69
69
  };
70
+ /**
71
+ * A worklet that takes the created {@link ShareableHost} and decorates it with
72
+ * additional properties or methods. It must return the same reference it
73
+ * received.
74
+ */
70
75
  export type ShareableHostDecorator<TValue = unknown, TDecorated = unknown> = (shareable: ShareableHost<TValue> & TDecorated) => ShareableHost<TValue> & TDecorated;
71
76
  export type ShareableGuestMeta = {
72
77
  isHost: false;
@@ -78,13 +83,50 @@ export type ShareableGuestProps<TValue = unknown> = {
78
83
  setAsync(value: TValue | ((prev: TValue) => TValue)): void;
79
84
  setSync(value: TValue | ((prev: TValue) => TValue)): void;
80
85
  };
86
+ /**
87
+ * A worklet that decorates each {@link ShareableGuest} created for the Shareable
88
+ * with additional properties or methods. It must return the same reference it
89
+ * received.
90
+ */
81
91
  export type ShareableGuestDecorator<TValue = unknown, TDecorated = unknown> = (shareable: ShareableGuest<TValue> & TDecorated) => ShareableGuest<TValue> & TDecorated;
92
+ /**
93
+ * The host-side representation of a {@link Shareable}, living on the
94
+ * {@link https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worklet-runtime | Worklet Runtime}
95
+ * that hosts the Shareable.
96
+ */
82
97
  export type ShareableHost<TValue = unknown, THostDecorated = unknown> = ShareableHostMeta & ShareableHostProps<TValue> & (THostDecorated extends object ? THostDecorated : object);
98
+ /**
99
+ * A guest-side representation of a {@link Shareable}, used on any runtime other
100
+ * than the host runtime.
101
+ */
83
102
  export type ShareableGuest<TValue = unknown, TGuestDecorated = unknown> = ShareableGuestMeta & ShareableGuestProps<TValue> & (TGuestDecorated extends object ? TGuestDecorated : object);
103
+ /**
104
+ * A type of shared memory tied to a given runtime, called the Host Runtime.
105
+ * Depending on the context it's either a {@link ShareableHost} (on the hosting
106
+ * Worklet Runtime) or a {@link ShareableGuest} (on every other runtime).
107
+ *
108
+ * @see {@link https://docs.swmansion.com/react-native-worklets/docs/memory/shareable | Shareable docs}
109
+ */
84
110
  export type Shareable<TValue = unknown, THostDecorated = unknown, TGuestDecorated = unknown> = (ShareableHost<TValue, THostDecorated> & Partial<ShareableGuestProps<TValue> & (TGuestDecorated extends object ? Partial<TGuestDecorated> : object)>) | (ShareableGuest<TValue, TGuestDecorated> & Partial<ShareableHostProps<TValue> & (THostDecorated extends object ? Partial<THostDecorated> : object)>);
111
+ /** Optional advanced configuration for a {@link Shareable}. */
85
112
  export type ShareableConfig<TValue, THostDecorated, TGuestDecorated> = {
113
+ /**
114
+ * A worklet that decorates the {@link ShareableHost} with additional
115
+ * properties or methods.
116
+ */
86
117
  hostDecorator?: ShareableHostDecorator<TValue, THostDecorated>;
118
+ /**
119
+ * A worklet that decorates each {@link ShareableGuest} with additional
120
+ * properties or methods.
121
+ */
87
122
  guestDecorator?: ShareableGuestDecorator<TValue, TGuestDecorated>;
123
+ /**
124
+ * When `true`, the {@link ShareableHost} is created synchronously during the
125
+ * call to `createShareable` instead of lazily on first access. Use this when
126
+ * the host initialization triggers side effects that must happen eagerly.
127
+ *
128
+ * @defaultValue `false`
129
+ */
88
130
  initSynchronously?: boolean;
89
131
  };
90
132
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/memory/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,CAAC,MAAM,GAAG,OAAO,IAAI;IAC9C,iBAAiB,EAAE,IAAI,CAAC;IACxB,8BAA8B,EAAE,MAAM,CAAC;CACxC,CAAC;AAIF,MAAM,MAAM,mBAAmB,CAAC,MAAM,IACpC,MAAM,SAAS,eAAe,CAAC,MAAM,UAAU,CAAC,GAC5C,eAAe,CAAC,UAAU,CAAC,GAC3B,eAAe,CAAC,MAAM,CAAC,CAAC;AAE9B,MAAM,MAAM,iBAAiB,CAAC,MAAM,GAAG,OAAO,IAAI;IAChD,mBAAmB,EAAE,IAAI,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5D;;;GAGG;AACH,MAAM,MAAM,cAAc,CACxB,MAAM,GAAG,OAAO,EAChB,eAAe,GAAG,OAAO,IACvB,kBAAkB,GACpB,mBAAmB,CAAC,MAAM,CAAC,GAC3B,CAAC,eAAe,SAAS,MAAM,GAAG,eAAe,GAAG,MAAM,CAAC,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,CACnB,MAAM,GAAG,OAAO,EAChB,cAAc,GAAG,OAAO,EACxB,eAAe,GAAG,OAAO,IAEvB,CAAC,aAAa,CAAC,MAAM,EAAE,cAAc,CAAC,GACpC,OAAO,CACL,mBAAmB,CAAC,MAAM,CAAC,GACzB,CAAC,eAAe,SAAS,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,CACvE,CAAC,GACJ,CAAC,cAAc,CAAC,MAAM,EAAE,eAAe,CAAC,GACtC,OAAO,CACL,kBAAkB,CAAC,MAAM,CAAC,GACxB,CAAC,cAAc,SAAS,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC,CACrE,CAAC,CAAC;AAET,+DAA+D;AAC/D,MAAM,MAAM,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,IAAI;IACrE;;;OAGG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC/D;;;OAGG;IACH,cAAc,CAAC,EAAE,uBAAuB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAClE;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-worklets",
3
- "version": "0.8.0-nightly-20260318-d2b8286a6",
3
+ "version": "0.8.0",
4
4
  "description": "The React Native multithreading library",
5
5
  "keywords": [
6
6
  "react-native",
@@ -58,18 +58,17 @@
58
58
  "react-native": "0.81 - 0.85"
59
59
  },
60
60
  "dependencies": {
61
- "@babel/plugin-transform-arrow-functions": "7.27.1",
62
- "@babel/plugin-transform-class-properties": "7.27.1",
63
- "@babel/plugin-transform-classes": "7.28.4",
64
- "@babel/plugin-transform-nullish-coalescing-operator": "7.27.1",
65
- "@babel/plugin-transform-optional-chaining": "7.27.1",
66
- "@babel/plugin-transform-shorthand-properties": "7.27.1",
67
- "@babel/plugin-transform-template-literals": "7.27.1",
68
- "@babel/plugin-transform-unicode-regex": "7.27.1",
69
- "@babel/preset-typescript": "7.27.1",
70
- "convert-source-map": "2.0.0",
71
- "is-tree-shakable": "0.5.0",
72
- "semver": "7.7.3"
61
+ "@babel/plugin-transform-arrow-functions": "^7.27.1",
62
+ "@babel/plugin-transform-class-properties": "^7.27.1",
63
+ "@babel/plugin-transform-classes": "^7.28.4",
64
+ "@babel/plugin-transform-nullish-coalescing-operator": "^7.27.1",
65
+ "@babel/plugin-transform-optional-chaining": "^7.27.1",
66
+ "@babel/plugin-transform-shorthand-properties": "^7.27.1",
67
+ "@babel/plugin-transform-template-literals": "^7.27.1",
68
+ "@babel/plugin-transform-unicode-regex": "^7.27.1",
69
+ "@babel/preset-typescript": "^7.27.1",
70
+ "convert-source-map": "^2.0.0",
71
+ "semver": "^7.7.3"
73
72
  },
74
73
  "devDependencies": {
75
74
  "@babel/cli": "7.28.3",
@@ -83,6 +82,7 @@
83
82
  "clang-format-node": "1.3.5",
84
83
  "code-tag": "1.2.0",
85
84
  "eslint": "9.37.0",
85
+ "is-tree-shakable": "^0.5.0",
86
86
  "jest": "30.2.0",
87
87
  "knip": "5.61.3",
88
88
  "madge": "8.0.0",
@@ -5,4 +5,4 @@
5
5
  * version used to build the native part of the library in runtime. Remember to
6
6
  * keep this in sync with the version declared in `package.json`
7
7
  */
8
- export const jsVersion = '0.8.0-nightly-20260318-d2b8286a6';
8
+ export const jsVersion = '0.8.0';
@@ -6,8 +6,22 @@ import { UIRuntimeId } from '../runtimes';
6
6
  import { isWorkletFunction } from '../workletFunction';
7
7
  import { WorkletsModule } from '../WorkletsModule/NativeWorklets';
8
8
  import { createSerializable } from './serializable';
9
- import type { SerializableRef, Shareable, ShareableConfig } from './types';
9
+ import type { Shareable, ShareableConfig } from './types';
10
10
 
11
+ /**
12
+ * Creates a new {@link Shareable} holding the provided initial value. You must
13
+ * explicitly declare which Worklet Runtime will host the Shareable by passing
14
+ * its `runtimeId`.
15
+ *
16
+ * Currently only hosting a Shareable on the UI Runtime is supported.
17
+ *
18
+ * @param hostRuntimeId - The `runtimeId` of the Worklet Runtime that will host
19
+ * the Shareable. Use {@link UIRuntimeId}.
20
+ * @param initial - The initial value of the Shareable.
21
+ * @param config - Optional advanced configuration.
22
+ * @returns The created {@link Shareable}.
23
+ * @see {@link https://docs.swmansion.com/react-native-worklets/docs/memory/createShareable | createShareable docs}
24
+ */
11
25
  export function createShareable<
12
26
  TValue = unknown,
13
27
  THostDecorated = unknown,
@@ -28,7 +42,7 @@ export function createShareable<
28
42
  TGuestDecorated = unknown,
29
43
  >(
30
44
  hostRuntimeId: number,
31
- initial: SerializableRef<TValue>,
45
+ initial: TValue,
32
46
  config?: ShareableConfig<TValue, THostDecorated, TGuestDecorated>
33
47
  ): Shareable<TValue, THostDecorated, TGuestDecorated>;
34
48
 
@@ -2,8 +2,22 @@
2
2
 
3
3
  import { WorkletsError } from '../debug/WorkletsError';
4
4
  import type { UIRuntimeId } from '../runtimes';
5
- import type { SerializableRef, Shareable, ShareableConfig } from './types';
5
+ import type { Shareable, ShareableConfig } from './types';
6
6
 
7
+ /**
8
+ * Creates a new {@link Shareable} holding the provided initial value. You must
9
+ * explicitly declare which Worklet Runtime will host the Shareable by passing
10
+ * its `runtimeId`.
11
+ *
12
+ * Currently only hosting a Shareable on the UI Runtime is supported.
13
+ *
14
+ * @param hostRuntimeId - The `runtimeId` of the Worklet Runtime that will host
15
+ * the Shareable. Use {@link UIRuntimeId}.
16
+ * @param initial - The initial value of the Shareable.
17
+ * @param config - Optional advanced configuration.
18
+ * @returns The created {@link Shareable}.
19
+ * @see {@link https://docs.swmansion.com/react-native-worklets/docs/memory/createShareable | createShareable docs}
20
+ */
7
21
  export function createShareable<
8
22
  TValue = unknown,
9
23
  THostDecorated = unknown,
@@ -24,7 +38,7 @@ export function createShareable<
24
38
  TGuestDecorated = unknown,
25
39
  >(
26
40
  hostRuntimeId: number,
27
- initial: SerializableRef<TValue>,
41
+ initial: TValue,
28
42
  config?: ShareableConfig<TValue, THostDecorated, TGuestDecorated>
29
43
  ): Shareable<TValue, THostDecorated, TGuestDecorated>;
30
44
 
@@ -87,6 +87,11 @@ export type ShareableHostMeta = {
87
87
  __shareableRef: true;
88
88
  };
89
89
 
90
+ /**
91
+ * A worklet that takes the created {@link ShareableHost} and decorates it with
92
+ * additional properties or methods. It must return the same reference it
93
+ * received.
94
+ */
90
95
  export type ShareableHostDecorator<TValue = unknown, TDecorated = unknown> = (
91
96
  shareable: ShareableHost<TValue> & TDecorated
92
97
  ) => ShareableHost<TValue> & TDecorated;
@@ -103,10 +108,20 @@ export type ShareableGuestProps<TValue = unknown> = {
103
108
  setSync(value: TValue | ((prev: TValue) => TValue)): void;
104
109
  };
105
110
 
111
+ /**
112
+ * A worklet that decorates each {@link ShareableGuest} created for the Shareable
113
+ * with additional properties or methods. It must return the same reference it
114
+ * received.
115
+ */
106
116
  export type ShareableGuestDecorator<TValue = unknown, TDecorated = unknown> = (
107
117
  shareable: ShareableGuest<TValue> & TDecorated
108
118
  ) => ShareableGuest<TValue> & TDecorated;
109
119
 
120
+ /**
121
+ * The host-side representation of a {@link Shareable}, living on the
122
+ * {@link https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worklet-runtime | Worklet Runtime}
123
+ * that hosts the Shareable.
124
+ */
110
125
  export type ShareableHost<
111
126
  TValue = unknown,
112
127
  THostDecorated = unknown,
@@ -114,6 +129,10 @@ export type ShareableHost<
114
129
  ShareableHostProps<TValue> &
115
130
  (THostDecorated extends object ? THostDecorated : object);
116
131
 
132
+ /**
133
+ * A guest-side representation of a {@link Shareable}, used on any runtime other
134
+ * than the host runtime.
135
+ */
117
136
  export type ShareableGuest<
118
137
  TValue = unknown,
119
138
  TGuestDecorated = unknown,
@@ -121,6 +140,13 @@ export type ShareableGuest<
121
140
  ShareableGuestProps<TValue> &
122
141
  (TGuestDecorated extends object ? TGuestDecorated : object);
123
142
 
143
+ /**
144
+ * A type of shared memory tied to a given runtime, called the Host Runtime.
145
+ * Depending on the context it's either a {@link ShareableHost} (on the hosting
146
+ * Worklet Runtime) or a {@link ShareableGuest} (on every other runtime).
147
+ *
148
+ * @see {@link https://docs.swmansion.com/react-native-worklets/docs/memory/shareable | Shareable docs}
149
+ */
124
150
  export type Shareable<
125
151
  TValue = unknown,
126
152
  THostDecorated = unknown,
@@ -137,8 +163,24 @@ export type Shareable<
137
163
  (THostDecorated extends object ? Partial<THostDecorated> : object)
138
164
  >);
139
165
 
166
+ /** Optional advanced configuration for a {@link Shareable}. */
140
167
  export type ShareableConfig<TValue, THostDecorated, TGuestDecorated> = {
168
+ /**
169
+ * A worklet that decorates the {@link ShareableHost} with additional
170
+ * properties or methods.
171
+ */
141
172
  hostDecorator?: ShareableHostDecorator<TValue, THostDecorated>;
173
+ /**
174
+ * A worklet that decorates each {@link ShareableGuest} with additional
175
+ * properties or methods.
176
+ */
142
177
  guestDecorator?: ShareableGuestDecorator<TValue, TGuestDecorated>;
178
+ /**
179
+ * When `true`, the {@link ShareableHost} is created synchronously during the
180
+ * call to `createShareable` instead of lazily on first access. Use this when
181
+ * the host initialization triggers side effects that must happen eagerly.
182
+ *
183
+ * @defaultValue `false`
184
+ */
143
185
  initSynchronously?: boolean;
144
186
  };