@solidnative-dev/sharing 0.0.0-stage → 0.1.0-alpha.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Solid Native contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,53 @@
1
- # Temporary Holding Version
1
+ # `@solidnative-dev/sharing`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Validated system sharing for Solid Native applications. The package calls the
4
+ pinned React Native 0.87 native modules directly and does not evaluate
5
+ `Libraries/Share/Share.js`.
6
+
7
+ ```ts
8
+ import { createReactNativeShareService } from "@solidnative-dev/sharing/react-native";
9
+ import { createShareController } from "@solidnative-dev/sharing/solid";
10
+
11
+ const sharing = createShareController(createReactNativeShareService());
12
+ const result = await sharing.share({
13
+ message: "A native app rendered by Solid",
14
+ url: "https://solid-native.dev",
15
+ subject: "Solid Native",
16
+ });
17
+ ```
18
+
19
+ The result is deliberately truthful about the native contract:
20
+
21
+ - Android returns `{ action: "presented" }` when it has launched the chooser.
22
+ Android's built-in module cannot tell whether the user later completed a
23
+ share.
24
+ - iOS returns `{ action: "completed", activityType? }` or
25
+ `{ action: "dismissed" }`.
26
+
27
+ On Android, a separate URL is appended to the message so URL-only and
28
+ message-plus-URL requests work consistently instead of being silently dropped
29
+ by React Native's facade. On iOS, message and URL remain separate activity
30
+ items.
31
+
32
+ The package bounds all strings, validates URLs before native presentation,
33
+ rejects overlapping sheets, and validates every native settlement. The Solid
34
+ controller rejects pending work with `ShareOwnerDisposedError` when its owner
35
+ is disposed. Settlements enter observability as privacy-safe causal event names;
36
+ message, URL, subject, and activity type are never attached to causal metadata.
37
+
38
+ Run the Android physical Release gate on one attached, unlocked device with:
39
+
40
+ ```sh
41
+ pnpm --filter @solidnative-dev/native-e2e android:sharing:test
42
+ ```
43
+
44
+ The gate opens two real Pixel sharesheets and physically selects a temporary
45
+ receiver contained only in the instrumentation APK. The receiver verifies the
46
+ actual Android `ACTION_SEND` boundary for message-plus-URL with subject and for
47
+ URL-only input; safe result labels cross back into the application, while the
48
+ private payload never enters telemetry or logs. Both Android `presented`
49
+ settlements must produce causal user-blocking Solid commits. The direct
50
+ TurboModule seam must pass its facade-rejecting source-map policy, and success
51
+ is withheld until surface teardown and app/test process and package cleanup are
52
+ complete. iOS remains Release-compiled and awaits physical activity-sheet
53
+ promotion.
@@ -0,0 +1,44 @@
1
+ export declare const SHARE_MAX_MESSAGE_LENGTH = 65536;
2
+ export declare const SHARE_MAX_URL_LENGTH = 8192;
3
+ export declare const SHARE_MAX_SUBJECT_LENGTH = 512;
4
+ export declare const SHARE_MAX_ACTIVITY_TYPE_LENGTH = 512;
5
+ export type SharePlatform = "android" | "ios";
6
+ export interface ShareRequest {
7
+ /** Plain text presented to the receiving application. */
8
+ readonly message?: string;
9
+ /** Absolute URL presented separately on iOS and appended to text on Android. */
10
+ readonly url?: string;
11
+ /** Email subject on iOS and Intent subject on Android. */
12
+ readonly subject?: string;
13
+ }
14
+ export interface NormalizedShareRequest {
15
+ readonly message?: string;
16
+ readonly url?: string;
17
+ readonly subject?: string;
18
+ }
19
+ /**
20
+ * Android resolves after launching its chooser, not after the user shares.
21
+ * iOS reports whether an activity completed or the sheet was dismissed.
22
+ */
23
+ export type ShareResult = {
24
+ readonly action: "presented";
25
+ } | {
26
+ readonly action: "completed";
27
+ readonly activityType?: string;
28
+ } | {
29
+ readonly action: "dismissed";
30
+ };
31
+ export interface ShareAdapter {
32
+ readonly platform: SharePlatform;
33
+ showShareSheet(request: NormalizedShareRequest): Promise<unknown>;
34
+ }
35
+ export interface ShareService {
36
+ readonly platform: SharePlatform;
37
+ share(request: ShareRequest): Promise<ShareResult>;
38
+ }
39
+ export declare class SharePresentationInProgressError extends Error {
40
+ constructor();
41
+ }
42
+ /** Validates application input and untrusted native settlement payloads. */
43
+ export declare function createShareService(adapter: ShareAdapter): ShareService;
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,eAAO,MAAM,oBAAoB,OAAQ,CAAC;AAC1C,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,KAAK,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB;IACE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B,GACD;IACE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC,GACD;IACE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B,CAAC;AAEN,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,cAAc,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACpD;AAED,qBAAa,gCAAiC,SAAQ,KAAK;;CAK1D;AAmHD,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CAyBtE"}
package/dist/index.js ADDED
@@ -0,0 +1,110 @@
1
+ export const SHARE_MAX_MESSAGE_LENGTH = 65_536;
2
+ export const SHARE_MAX_URL_LENGTH = 8_192;
3
+ export const SHARE_MAX_SUBJECT_LENGTH = 512;
4
+ export const SHARE_MAX_ACTIVITY_TYPE_LENGTH = 512;
5
+ export class SharePresentationInProgressError extends Error {
6
+ constructor() {
7
+ super("Another system share sheet is still in progress.");
8
+ this.name = "SharePresentationInProgressError";
9
+ }
10
+ }
11
+ function plainRecord(value, path) {
12
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
13
+ throw new TypeError(`${path} must be a plain object.`);
14
+ }
15
+ const prototype = Object.getPrototypeOf(value);
16
+ if (prototype !== Object.prototype && prototype !== null) {
17
+ throw new TypeError(`${path} must be a plain object.`);
18
+ }
19
+ return value;
20
+ }
21
+ function boundedString(value, path, maximumLength) {
22
+ if (typeof value !== "string" ||
23
+ value.length === 0 ||
24
+ value.length > maximumLength ||
25
+ value.includes("\0")) {
26
+ throw new TypeError(`${path} must be a 1-${maximumLength} character string without null bytes.`);
27
+ }
28
+ return value;
29
+ }
30
+ function optionalString(value, path, maximumLength) {
31
+ return value === undefined
32
+ ? undefined
33
+ : boundedString(value, path, maximumLength);
34
+ }
35
+ function absoluteURL(value) {
36
+ if (value === undefined)
37
+ return undefined;
38
+ const url = boundedString(value, "Share URL", SHARE_MAX_URL_LENGTH);
39
+ if (!/^[A-Za-z][A-Za-z\d+.-]*:/u.test(url) ||
40
+ /[\u0000-\u001f\u007f]/u.test(url)) {
41
+ throw new TypeError("Share URL must be an absolute URI without ASCII control characters.");
42
+ }
43
+ return url;
44
+ }
45
+ function normalizeShareRequest(value) {
46
+ const request = plainRecord(value, "Share request");
47
+ const message = optionalString(request.message, "Share message", SHARE_MAX_MESSAGE_LENGTH);
48
+ const url = absoluteURL(request.url);
49
+ const subject = optionalString(request.subject, "Share subject", SHARE_MAX_SUBJECT_LENGTH);
50
+ if (message === undefined && url === undefined) {
51
+ throw new TypeError("A share request requires a non-empty message or URL.");
52
+ }
53
+ return Object.freeze({
54
+ ...(message === undefined ? {} : { message }),
55
+ ...(url === undefined ? {} : { url }),
56
+ ...(subject === undefined ? {} : { subject }),
57
+ });
58
+ }
59
+ function shareResult(value, platform) {
60
+ const result = plainRecord(value, "Native share result");
61
+ if (platform === "android") {
62
+ if (result.action !== "presented" || result.activityType !== undefined) {
63
+ throw new TypeError("An Android native share result must contain only action presented.");
64
+ }
65
+ return Object.freeze({ action: "presented" });
66
+ }
67
+ if (result.action === "dismissed") {
68
+ if (result.activityType !== undefined) {
69
+ throw new TypeError("A dismissed native share result must not contain an activity type.");
70
+ }
71
+ return Object.freeze({ action: "dismissed" });
72
+ }
73
+ if (result.action !== "completed") {
74
+ throw new TypeError("An iOS native share result action must be completed or dismissed.");
75
+ }
76
+ const activityType = optionalString(result.activityType, "Native share activity type", SHARE_MAX_ACTIVITY_TYPE_LENGTH);
77
+ return Object.freeze({
78
+ action: "completed",
79
+ ...(activityType === undefined ? {} : { activityType }),
80
+ });
81
+ }
82
+ /** Validates application input and untrusted native settlement payloads. */
83
+ export function createShareService(adapter) {
84
+ const candidate = plainRecord(adapter, "Share adapter");
85
+ if (candidate.platform !== "android" && candidate.platform !== "ios") {
86
+ throw new TypeError("Share adapter platform must be android or ios.");
87
+ }
88
+ if (typeof candidate.showShareSheet !== "function") {
89
+ throw new TypeError("Share adapter must provide showShareSheet().");
90
+ }
91
+ const platform = candidate.platform;
92
+ let presentationActive = false;
93
+ return Object.freeze({
94
+ platform,
95
+ async share(request) {
96
+ const normalized = normalizeShareRequest(request);
97
+ if (presentationActive) {
98
+ throw new SharePresentationInProgressError();
99
+ }
100
+ presentationActive = true;
101
+ try {
102
+ return shareResult(await adapter.showShareSheet(normalized), platform);
103
+ }
104
+ finally {
105
+ presentationActive = false;
106
+ }
107
+ },
108
+ });
109
+ }
110
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAC/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAC1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAC5C,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AA6ClD,MAAM,OAAO,gCAAiC,SAAQ,KAAK;IACzD;QACE,KAAK,CAAC,kDAAkD,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,GAAG,kCAAkC,CAA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AAC;IACtE,CAAC;IACD,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;IACpC,IAAI,kBAAkB,GAAG,KAAK,CAAC;IAC/B,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,QAAQ;QACR,KAAK,CAAC,KAAK,CAAC,OAAqB;YAC/B,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAClD,IAAI,kBAAkB,EAAE,CAAC;gBACvB,MAAM,IAAI,gCAAgC,EAAE,CAAC;YAC/C,CAAC;YACD,kBAAkB,GAAG,IAAI,CAAC;YAC1B,IAAI,CAAC;gBACH,OAAO,WAAW,CAAC,MAAM,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAC;YACzE,CAAC;oBAAS,CAAC;gBACT,kBAAkB,GAAG,KAAK,CAAC;YAC7B,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type ShareAdapter } from "./index.js";
2
+ export interface AndroidShareModule {
3
+ share(content: Readonly<{
4
+ title?: string;
5
+ message?: string;
6
+ }>, dialogTitle?: string): Promise<unknown>;
7
+ }
8
+ export interface IOSActionSheetManagerModule {
9
+ showShareActionSheetWithOptions(options: Readonly<{
10
+ message?: string;
11
+ url?: string;
12
+ subject?: string;
13
+ }>, failureCallback: (error: unknown) => void, successCallback: (success: unknown, activityType?: unknown) => void): void;
14
+ }
15
+ /** @internal Translation seam kept separate from React Native module lookup. */
16
+ export declare function createAndroidShareAdapter(value: AndroidShareModule): ShareAdapter;
17
+ /** @internal Translation seam kept separate from React Native module lookup. */
18
+ export declare function createIOSShareAdapter(value: IOSActionSheetManagerModule): ShareAdapter;
19
+ //# sourceMappingURL=react-native-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-native-adapter.d.ts","sourceRoot":"","sources":["../src/react-native-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,WAAW,kBAAkB;IACjC,KAAK,CACH,OAAO,EAAE,QAAQ,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EACvD,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,CAAC,CAAC;CACrB;AAED,MAAM,WAAW,2BAA2B;IAC1C,+BAA+B,CAC7B,OAAO,EAAE,QAAQ,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,EACF,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,EACzC,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,GAClE,IAAI,CAAC;CACT;AAuBD,gFAAgF;AAChF,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,kBAAkB,GACxB,YAAY,CAyBd;AAoBD,gFAAgF;AAChF,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,2BAA2B,GACjC,YAAY,CAwEd"}
@@ -0,0 +1,116 @@
1
+ import {} from "./index.js";
2
+ function record(value, path) {
3
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
4
+ throw new TypeError(`${path} must be an object.`);
5
+ }
6
+ return value;
7
+ }
8
+ function androidMessage(request) {
9
+ if (request.message === undefined) {
10
+ if (request.url === undefined) {
11
+ throw new TypeError("Android sharing requires a message or URL.");
12
+ }
13
+ return request.url;
14
+ }
15
+ if (request.url === undefined)
16
+ return request.message;
17
+ return `${request.message}\n${request.url}`;
18
+ }
19
+ /** @internal Translation seam kept separate from React Native module lookup. */
20
+ export function createAndroidShareAdapter(value) {
21
+ const candidate = record(value, "Android share module");
22
+ if (typeof candidate.share !== "function") {
23
+ throw new TypeError("Android share module must provide share().");
24
+ }
25
+ const module = value;
26
+ return Object.freeze({
27
+ platform: "android",
28
+ async showShareSheet(request) {
29
+ const nativeResult = await module.share(Object.freeze({
30
+ ...(request.subject === undefined ? {} : { title: request.subject }),
31
+ message: androidMessage(request),
32
+ }), undefined);
33
+ const result = record(nativeResult, "Android ShareModule result");
34
+ if (result.action !== "sharedAction") {
35
+ throw new TypeError("Android ShareModule returned an unknown share action.");
36
+ }
37
+ return { action: "presented" };
38
+ },
39
+ });
40
+ }
41
+ function nativeShareError(value) {
42
+ if (value instanceof Error)
43
+ return value;
44
+ if (typeof value === "string" && value.length > 0 && value.length <= 4_096) {
45
+ return new Error(value);
46
+ }
47
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
48
+ const message = value.message;
49
+ if (typeof message === "string" &&
50
+ message.length > 0 &&
51
+ message.length <= 4_096) {
52
+ return new Error(message);
53
+ }
54
+ }
55
+ return new Error("The iOS share sheet reported an invalid native error.");
56
+ }
57
+ /** @internal Translation seam kept separate from React Native module lookup. */
58
+ export function createIOSShareAdapter(value) {
59
+ const candidate = record(value, "iOS action sheet manager");
60
+ if (typeof candidate.showShareActionSheetWithOptions !== "function") {
61
+ throw new TypeError("iOS action sheet manager must provide showShareActionSheetWithOptions().");
62
+ }
63
+ const module = value;
64
+ return Object.freeze({
65
+ platform: "ios",
66
+ showShareSheet(request) {
67
+ const options = Object.freeze({
68
+ ...(request.message === undefined ? {} : { message: request.message }),
69
+ ...(request.url === undefined ? {} : { url: request.url }),
70
+ ...(request.subject === undefined ? {} : { subject: request.subject }),
71
+ });
72
+ return new Promise((resolve, reject) => {
73
+ let settled = false;
74
+ const rejectOnce = (error) => {
75
+ if (settled)
76
+ return;
77
+ settled = true;
78
+ reject(error);
79
+ };
80
+ try {
81
+ module.showShareActionSheetWithOptions(options, (error) => rejectOnce(nativeShareError(error)), (success, activityType) => {
82
+ if (settled)
83
+ return;
84
+ if (typeof success !== "boolean") {
85
+ rejectOnce(new TypeError("iOS emitted an invalid share completion flag."));
86
+ return;
87
+ }
88
+ settled = true;
89
+ if (!success) {
90
+ if (activityType !== undefined && activityType !== null) {
91
+ reject(new TypeError("A dismissed iOS share must not include an activity type."));
92
+ return;
93
+ }
94
+ resolve({ action: "dismissed" });
95
+ return;
96
+ }
97
+ if (activityType !== undefined &&
98
+ activityType !== null &&
99
+ typeof activityType !== "string") {
100
+ reject(new TypeError("iOS emitted an invalid share activity type."));
101
+ return;
102
+ }
103
+ resolve({
104
+ action: "completed",
105
+ ...(typeof activityType === "string" ? { activityType } : {}),
106
+ });
107
+ });
108
+ }
109
+ catch (error) {
110
+ rejectOnce(error);
111
+ }
112
+ });
113
+ },
114
+ });
115
+ }
116
+ //# sourceMappingURL=react-native-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-native-adapter.js","sourceRoot":"","sources":["../src/react-native-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,MAAM,YAAY,CAAC;AAqB5E,SAAS,MAAM,CACb,KAAc,EACd,IAAY;IAEZ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,KAA0C,CAAC;AACpD,CAAC;AAED,SAAS,cAAc,CAAC,OAA+B;IACrD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAClC,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAC;QACpE,CAAC;QACD,OAAO,OAAO,CAAC,GAAG,CAAC;IACrB,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC;IACtD,OAAO,GAAG,OAAO,CAAC,OAAO,KAAK,OAAO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ACnB,GAAG,CAAC,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;yBAC9D,CAAC,CAAC;oBACL,CAAC,CACF,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,UAAU,CAAC,KAAK,CAAC,CAAC;gBACpB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type ShareService } from "./index.js";
2
+ /** Resolves pinned native modules without evaluating React Native's Share.js. */
3
+ export declare function createReactNativeShareService(): ShareService;
4
+ export { SharePresentationInProgressError } from "./index.js";
5
+ export type { NormalizedShareRequest, SharePlatform, ShareRequest, ShareResult, ShareService, } from "./index.js";
6
+ //# sourceMappingURL=react-native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-native.d.ts","sourceRoot":"","sources":["../src/react-native.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAsBnE,iFAAiF;AACjF,wBAAgB,6BAA6B,IAAI,YAAY,CAiB5D;AAED,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAE9D,YAAY,EACV,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,GACb,MAAM,YAAY,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { get, getEnforcing, } from "react-native/Libraries/TurboModule/TurboModuleRegistry";
2
+ import { assertVerifiedReactNativePlatform } from "@solidnative-dev/react-native-compat";
3
+ import { createShareService } from "./index.js";
4
+ import { createAndroidShareAdapter, createIOSShareAdapter, } from "./react-native-adapter.js";
5
+ let service;
6
+ function platform() {
7
+ return assertVerifiedReactNativePlatform(getEnforcing("PlatformConstants").getConstants(), "System sharing").platform;
8
+ }
9
+ /** Resolves pinned native modules without evaluating React Native's Share.js. */
10
+ export function createReactNativeShareService() {
11
+ if (service !== undefined)
12
+ return service;
13
+ const nativePlatform = platform();
14
+ if (nativePlatform === "android") {
15
+ const module = get("ShareModule");
16
+ if (module === null) {
17
+ throw new Error("The Android ShareModule TurboModule is unavailable.");
18
+ }
19
+ service = createShareService(createAndroidShareAdapter(module));
20
+ return service;
21
+ }
22
+ const module = get("ActionSheetManager");
23
+ if (module === null) {
24
+ throw new Error("The iOS ActionSheetManager TurboModule is unavailable.");
25
+ }
26
+ service = createShareService(createIOSShareAdapter(module));
27
+ return service;
28
+ }
29
+ export { SharePresentationInProgressError } from "./index.js";
30
+ //# sourceMappingURL=react-native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-native.js","sourceRoot":"","sources":["../src/react-native.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,YAAY,GACb,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAEzF,OAAO,EAAE,kBAAkB,EAAqB,MAAM,YAAY,CAAC;AACnE,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GAGtB,MAAM,2BAA2B,CAAC;AAOnC,IAAI,OAAiC,CAAC;AAEtC,SAAS,QAAQ;IACf,OAAO,iCAAiC,CACtC,YAAY,CAA0B,mBAAmB,CAAC,CAAC,YAAY,EAAE,EACzE,gBAAgB,CACjB,CAAC,QAAQ,CAAC;AACb,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,6BAA6B;IAC3C,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IAC1C,MAAM,cAAc,GAAG,QAAQ,EAAE,CAAC;IAClC,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,GAAG,CAAqB,aAAa,CAAC,CAAC;QACtD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,GAAG,kBAAkB,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC;QAChE,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,CAA8B,oBAAoB,CAAC,CAAC;IACtE,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type ShareRequest, type ShareResult, type ShareService } from "./index.js";
2
+ export declare class ShareOwnerDisposedError extends Error {
3
+ constructor();
4
+ }
5
+ export interface SolidShareController {
6
+ share(request: ShareRequest): Promise<ShareResult>;
7
+ }
8
+ /** Owns share settlements and carries system responses into Solid causality. */
9
+ export declare function createShareController(service: ShareService): SolidShareController;
10
+ export { SharePresentationInProgressError } from "./index.js";
11
+ export type { SharePlatform, ShareRequest, ShareResult, ShareService, } from "./index.js";
12
+ //# sourceMappingURL=solid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid.d.ts","sourceRoot":"","sources":["../src/solid.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAEpB,qBAAa,uBAAwB,SAAQ,KAAK;;CAKjD;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACpD;AA2BD,gFAAgF;AAChF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,YAAY,GACpB,oBAAoB,CAoEtB;AAED,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAE9D,YAAY,EACV,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,GACb,MAAM,YAAY,CAAC"}
package/dist/solid.js ADDED
@@ -0,0 +1,89 @@
1
+ import { createCausalPlatformEventHandler, retainCausalPlatformEvent, } from "@solidnative-dev/core";
2
+ import { getOwner, onCleanup } from "solid-js";
3
+ import {} from "./index.js";
4
+ export class ShareOwnerDisposedError extends Error {
5
+ constructor() {
6
+ super("The Solid owner was disposed before its system share settled.");
7
+ this.name = "ShareOwnerDisposedError";
8
+ }
9
+ }
10
+ function settlePromiseInsideEvent(settlement, result) {
11
+ return retainCausalPlatformEvent(undefined, (event) => {
12
+ settlement.resolve(result);
13
+ void Promise.resolve().then(() => finishPromiseSettlement(event));
14
+ });
15
+ }
16
+ function finishPromiseSettlement(event) {
17
+ if (event.state !== "active")
18
+ return;
19
+ try {
20
+ event.run(() => undefined);
21
+ event.finish();
22
+ }
23
+ catch (error) {
24
+ event.fail(error);
25
+ }
26
+ }
27
+ /** Owns share settlements and carries system responses into Solid causality. */
28
+ export function createShareController(service) {
29
+ if (typeof service !== "object" ||
30
+ service === null ||
31
+ typeof service.share !== "function") {
32
+ throw new TypeError("A Solid share controller requires a ShareService.");
33
+ }
34
+ if (getOwner() === null) {
35
+ throw new Error("createShareController requires an active Solid owner.");
36
+ }
37
+ let active = true;
38
+ const pending = new Set();
39
+ const settlePresented = createCausalPlatformEventHandler("platform.share.presented", settlePromiseInsideEvent, { priority: "discrete" });
40
+ const settleCompleted = createCausalPlatformEventHandler("platform.share.completed", settlePromiseInsideEvent, { priority: "discrete" });
41
+ const settleDismissed = createCausalPlatformEventHandler("platform.share.dismissed", settlePromiseInsideEvent, { priority: "discrete" });
42
+ onCleanup(() => {
43
+ if (!active)
44
+ return;
45
+ active = false;
46
+ const error = new ShareOwnerDisposedError();
47
+ for (const settlement of pending)
48
+ settlement.reject(error);
49
+ pending.clear();
50
+ });
51
+ return Object.freeze({
52
+ share(request) {
53
+ if (!active)
54
+ return Promise.reject(new ShareOwnerDisposedError());
55
+ return new Promise((resolve, reject) => {
56
+ const settlement = { reject, resolve };
57
+ pending.add(settlement);
58
+ let presentation;
59
+ try {
60
+ presentation = service.share(request);
61
+ }
62
+ catch (error) {
63
+ pending.delete(settlement);
64
+ reject(error);
65
+ return;
66
+ }
67
+ void Promise.resolve(presentation).then((result) => {
68
+ if (!pending.delete(settlement))
69
+ return;
70
+ if (result.action === "presented") {
71
+ settlePresented(settlement, result);
72
+ }
73
+ else if (result.action === "completed") {
74
+ settleCompleted(settlement, result);
75
+ }
76
+ else {
77
+ settleDismissed(settlement, result);
78
+ }
79
+ }, (error) => {
80
+ if (!pending.delete(settlement))
81
+ return;
82
+ reject(error);
83
+ });
84
+ });
85
+ },
86
+ });
87
+ }
88
+ export { SharePresentationInProgressError } from "./index.js";
89
+ //# sourceMappingURL=solid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid.js","sourceRoot":"","sources":["../src/solid.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,yBAAyB,GAE1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAIN,MAAM,YAAY,CAAC;AAEpB,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD;QACE,KAAK,CAAC,+DAA+D,CAAC,CAAC;QACvE,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AAWD,SAAS,wBAAwB,CAC/B,UAAwB,EACxB,MAAmB;IAEnB,OAAO,yBAAyB,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QACpD,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3B,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,S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E;oBACjB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;wBAAE,OAAO;oBACxC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC,CACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,66 @@
1
1
  {
2
2
  "name": "@solidnative-dev/sharing",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0-alpha.0",
4
+ "type": "module",
5
+ "description": "Validated system sharing with truthful platform results and Solid-owned settlements.",
6
+ "license": "MIT",
7
+ "homepage": "https://solidnative.dev",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/solid-native/solid-native.git",
11
+ "directory": "packages/sharing"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "engines": {
17
+ "node": "^22.13.0 || ^24.3.0 || >=26.0.0"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "./react-native": {
25
+ "types": "./dist/react-native.d.ts",
26
+ "default": "./dist/react-native.js"
27
+ },
28
+ "./solid": {
29
+ "types": "./dist/solid.d.ts",
30
+ "default": "./dist/solid.js"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist/index.d.ts",
35
+ "dist/index.d.ts.map",
36
+ "dist/index.js",
37
+ "dist/index.js.map",
38
+ "dist/react-native.d.ts",
39
+ "dist/react-native.d.ts.map",
40
+ "dist/react-native.js",
41
+ "dist/react-native.js.map",
42
+ "dist/react-native-adapter.d.ts",
43
+ "dist/react-native-adapter.d.ts.map",
44
+ "dist/react-native-adapter.js",
45
+ "dist/react-native-adapter.js.map",
46
+ "dist/solid.d.ts",
47
+ "dist/solid.d.ts.map",
48
+ "dist/solid.js",
49
+ "dist/solid.js.map"
50
+ ],
51
+ "dependencies": {
52
+ "@solidnative-dev/core": "0.1.0-alpha.0",
53
+ "@solidnative-dev/react-native-compat": "0.1.0-alpha.0"
54
+ },
55
+ "peerDependencies": {
56
+ "solid-js": "2.0.4"
57
+ },
58
+ "devDependencies": {
59
+ "solid-js": "2.0.4"
60
+ },
61
+ "scripts": {
62
+ "build": "tsc -p tsconfig.json",
63
+ "check": "tsc -p tsconfig.json --noEmit",
64
+ "test": "pnpm build && node --conditions=browser --test test/*.test.mjs"
65
+ }
6
66
  }