@solidnative-dev/dialogs 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,69 @@
1
- # Temporary Holding Version
1
+ # `@solidnative-dev/dialogs`
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
+ This package exposes validated, promise-based native alerts without evaluating
4
+ React Native's `Alert.js` or mounting a React component tree. It has three
5
+ deliberately separate layers:
6
+
7
+ - `@solidnative-dev/dialogs` is the framework-neutral request/result contract and
8
+ adapter validator.
9
+ - `@solidnative-dev/dialogs/react-native` drives React Native 0.87's pinned
10
+ `DialogManagerAndroid` and `AlertManager` TurboModules directly.
11
+ - `@solidnative-dev/dialogs/solid` binds pending results to the current Solid owner
12
+ and records button presses and dismissals as privacy-safe causal inputs.
13
+
14
+ ```ts
15
+ import { createReactNativeAlertService } from "@solidnative-dev/dialogs/react-native";
16
+ import { createAlertController } from "@solidnative-dev/dialogs/solid";
17
+
18
+ const alerts = createAlertController(createReactNativeAlertService());
19
+ const result = await alerts.show({
20
+ title: "Remove download?",
21
+ message: "The local file will be deleted.",
22
+ buttons: [
23
+ { id: "cancel", text: "Cancel", style: "cancel" },
24
+ { id: "remove", text: "Remove", style: "destructive", preferred: true },
25
+ ],
26
+ });
27
+
28
+ if (result.action === "button" && result.buttonId === "remove") {
29
+ // Perform the application action.
30
+ }
31
+ ```
32
+
33
+ Applications receive stable button identities rather than platform indices.
34
+ Android supports up to three buttons and can report Back/outside-tap dismissal
35
+ when `cancelable` is enabled. iOS supports the bounded package limit of 32
36
+ buttons plus one cancel, destructive, and preferred button and explicit
37
+ appearance metadata.
38
+ Button style metadata has a visual effect only where the native platform
39
+ supports it.
40
+
41
+ One service permits one native alert at a time. A concurrent call rejects with
42
+ `AlertPresentationInProgressError` instead of silently replacing an Android
43
+ dialog or producing a platform-dependent presentation stack. The React Native
44
+ factory returns one process-local service so repeated factory calls preserve
45
+ that invariant.
46
+
47
+ The Solid controller requires a current Solid owner and rejects still-pending results with
48
+ `AlertOwnerDisposedError` when its owner is disposed. Native alert modules do
49
+ not expose a public programmatic dismissal operation, so owner disposal stops
50
+ delivery to dead application state but does not claim to remove an already
51
+ presented operating-system alert. Dialog titles, messages, button text, and
52
+ button identities are never attached to causal telemetry.
53
+
54
+ Run the Android physical Release gate on one attached, unlocked device with:
55
+
56
+ ```sh
57
+ pnpm --filter @solidnative-dev/native-e2e android:alert:test
58
+ ```
59
+
60
+ The gate presents two real operating-system dialogs on the Pixel: it taps the
61
+ native destructive button, sends Android system Back to the cancellable dialog,
62
+ and requires the exact stable results to drive user-blocking Solid commits.
63
+ Android themes may capitalize visible button text, so instrumentation compares
64
+ that native label case-insensitively while still requiring the application text
65
+ and button identity. The source map must contain the complete direct
66
+ TurboModule/Solid seam without `Alert.js`, private content must stay out of
67
+ telemetry, and the surface, process, and disposable packages must be gone before
68
+ success is published. The iOS implementation remains Release-compiled and
69
+ awaits an equivalent physical UIKit gate.
@@ -0,0 +1,57 @@
1
+ export declare const ALERT_MAX_TITLE_LENGTH = 512;
2
+ export declare const ALERT_MAX_MESSAGE_LENGTH = 4096;
3
+ export declare const ALERT_MAX_BUTTON_ID_LENGTH = 128;
4
+ export declare const ALERT_MAX_BUTTON_TEXT_LENGTH = 256;
5
+ export declare const ALERT_MAX_IOS_BUTTONS = 32;
6
+ export declare const ALERT_MAX_ANDROID_BUTTONS = 3;
7
+ export type AlertPlatform = "android" | "ios";
8
+ export type AlertButtonStyle = "default" | "cancel" | "destructive";
9
+ export type AlertUserInterfaceStyle = "system" | "light" | "dark";
10
+ export interface AlertButton {
11
+ readonly id: string;
12
+ readonly text: string;
13
+ readonly style?: AlertButtonStyle;
14
+ readonly preferred?: boolean;
15
+ }
16
+ export interface AlertRequest {
17
+ readonly title?: string;
18
+ readonly message?: string;
19
+ readonly buttons?: readonly AlertButton[];
20
+ /** Android-only outside-tap and Back dismissal. */
21
+ readonly cancelable?: boolean;
22
+ /** iOS-only explicit dialog appearance. */
23
+ readonly userInterfaceStyle?: AlertUserInterfaceStyle;
24
+ }
25
+ export interface NormalizedAlertButton {
26
+ readonly id: string;
27
+ readonly text: string;
28
+ readonly style: AlertButtonStyle;
29
+ readonly preferred: boolean;
30
+ }
31
+ export interface NormalizedAlertRequest {
32
+ readonly title?: string;
33
+ readonly message?: string;
34
+ readonly buttons: readonly NormalizedAlertButton[];
35
+ readonly cancelable: boolean;
36
+ readonly userInterfaceStyle: AlertUserInterfaceStyle;
37
+ }
38
+ export type AlertResult = {
39
+ readonly action: "button";
40
+ readonly buttonId: string;
41
+ } | {
42
+ readonly action: "dismissed";
43
+ };
44
+ export interface AlertAdapter {
45
+ readonly platform: AlertPlatform;
46
+ showAlert(request: NormalizedAlertRequest): Promise<unknown>;
47
+ }
48
+ export interface AlertService {
49
+ readonly platform: AlertPlatform;
50
+ show(request: AlertRequest): Promise<AlertResult>;
51
+ }
52
+ export declare class AlertPresentationInProgressError extends Error {
53
+ constructor();
54
+ }
55
+ /** Validates all dialog input and untrusted native callback results. */
56
+ export declare function createAlertService(adapter: AlertAdapter): AlertService;
57
+ //# 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,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,wBAAwB,OAAQ,CAAC;AAC9C,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAChD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,KAAK,CAAC;AAC9C,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;AACpE,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAElE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,mDAAmD;IACnD,QAA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
@@ -0,0 +1,168 @@
1
+ export const ALERT_MAX_TITLE_LENGTH = 512;
2
+ export const ALERT_MAX_MESSAGE_LENGTH = 4_096;
3
+ export const ALERT_MAX_BUTTON_ID_LENGTH = 128;
4
+ export const ALERT_MAX_BUTTON_TEXT_LENGTH = 256;
5
+ export const ALERT_MAX_IOS_BUTTONS = 32;
6
+ export const ALERT_MAX_ANDROID_BUTTONS = 3;
7
+ export class AlertPresentationInProgressError extends Error {
8
+ constructor() {
9
+ super("Another native alert presentation is still in progress.");
10
+ this.name = "AlertPresentationInProgressError";
11
+ }
12
+ }
13
+ function plainRecord(value, path) {
14
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
15
+ throw new TypeError(`${path} must be a plain object.`);
16
+ }
17
+ const prototype = Object.getPrototypeOf(value);
18
+ if (prototype !== Object.prototype && prototype !== null) {
19
+ throw new TypeError(`${path} must be a plain object.`);
20
+ }
21
+ return value;
22
+ }
23
+ function boundedString(value, path, maximumLength, allowEmpty = false) {
24
+ if (typeof value !== "string" ||
25
+ (!allowEmpty && value.length === 0) ||
26
+ value.length > maximumLength ||
27
+ value.includes("\0")) {
28
+ const minimum = allowEmpty ? 0 : 1;
29
+ throw new TypeError(`${path} must be a ${minimum}-${maximumLength} character string without null bytes.`);
30
+ }
31
+ return value;
32
+ }
33
+ function optionalString(value, path, maximumLength) {
34
+ return value === undefined
35
+ ? undefined
36
+ : boundedString(value, path, maximumLength, true);
37
+ }
38
+ function alertButton(value, index) {
39
+ const button = plainRecord(value, `Alert button ${index}`);
40
+ const style = button.style ?? "default";
41
+ if (style !== "default" && style !== "cancel" && style !== "destructive") {
42
+ throw new TypeError(`Alert button ${index}.style must be default, cancel, or destructive.`);
43
+ }
44
+ const preferred = button.preferred ?? false;
45
+ if (typeof preferred !== "boolean") {
46
+ throw new TypeError(`Alert button ${index}.preferred must be a boolean.`);
47
+ }
48
+ return Object.freeze({
49
+ id: boundedString(button.id, `Alert button ${index}.id`, ALERT_MAX_BUTTON_ID_LENGTH),
50
+ text: boundedString(button.text, `Alert button ${index}.text`, ALERT_MAX_BUTTON_TEXT_LENGTH),
51
+ style,
52
+ preferred,
53
+ });
54
+ }
55
+ function normalizeAlertRequest(value, platform) {
56
+ const request = plainRecord(value, "Alert request");
57
+ const title = optionalString(request.title, "Alert title", ALERT_MAX_TITLE_LENGTH);
58
+ const message = optionalString(request.message, "Alert message", ALERT_MAX_MESSAGE_LENGTH);
59
+ if ((title ?? "").length === 0 && (message ?? "").length === 0) {
60
+ throw new TypeError("An alert requires a non-empty title or message.");
61
+ }
62
+ const rawButtons = request.buttons === undefined
63
+ ? [{ id: "ok", text: "OK" }]
64
+ : request.buttons;
65
+ if (!Array.isArray(rawButtons) || rawButtons.length === 0) {
66
+ throw new TypeError("Alert buttons must be a non-empty array.");
67
+ }
68
+ const maximumButtons = platform === "android" ? ALERT_MAX_ANDROID_BUTTONS : ALERT_MAX_IOS_BUTTONS;
69
+ if (rawButtons.length > maximumButtons) {
70
+ throw new RangeError(`${platform === "android" ? "Android" : "iOS"} alerts support at most ${maximumButtons} buttons.`);
71
+ }
72
+ const buttons = Object.freeze(rawButtons.map(alertButton));
73
+ const ids = new Set();
74
+ let cancelButtons = 0;
75
+ let destructiveButtons = 0;
76
+ let preferredButtons = 0;
77
+ for (const button of buttons) {
78
+ if (ids.has(button.id)) {
79
+ throw new TypeError(`Alert button id ${JSON.stringify(button.id)} is duplicated.`);
80
+ }
81
+ ids.add(button.id);
82
+ if (button.style === "cancel")
83
+ cancelButtons++;
84
+ if (button.style === "destructive")
85
+ destructiveButtons++;
86
+ if (button.preferred)
87
+ preferredButtons++;
88
+ }
89
+ if (cancelButtons > 1) {
90
+ throw new TypeError("An alert can contain at most one cancel button.");
91
+ }
92
+ if (preferredButtons > 1) {
93
+ throw new TypeError("An alert can contain at most one preferred button.");
94
+ }
95
+ if (platform === "ios" && destructiveButtons > 1) {
96
+ throw new TypeError("The iOS alert manager supports at most one destructive button.");
97
+ }
98
+ const cancelable = request.cancelable ?? false;
99
+ if (typeof cancelable !== "boolean") {
100
+ throw new TypeError("Alert cancelable must be a boolean.");
101
+ }
102
+ if (platform === "ios" && cancelable) {
103
+ throw new TypeError("Cancelable outside-tap and Back alerts are Android-only.");
104
+ }
105
+ const userInterfaceStyle = request.userInterfaceStyle ?? "system";
106
+ if (userInterfaceStyle !== "system" &&
107
+ userInterfaceStyle !== "light" &&
108
+ userInterfaceStyle !== "dark") {
109
+ throw new TypeError("Alert userInterfaceStyle must be system, light, or dark.");
110
+ }
111
+ if (platform === "android" && userInterfaceStyle !== "system") {
112
+ throw new TypeError("Explicit alert userInterfaceStyle is iOS-only.");
113
+ }
114
+ return Object.freeze({
115
+ ...(title === undefined ? {} : { title }),
116
+ ...(message === undefined ? {} : { message }),
117
+ buttons,
118
+ cancelable,
119
+ userInterfaceStyle,
120
+ });
121
+ }
122
+ function alertResult(value, request) {
123
+ const result = plainRecord(value, "Native alert result");
124
+ if (result.action === "dismissed") {
125
+ if (result.buttonId !== undefined) {
126
+ throw new TypeError("A dismissed native alert result must not contain a button id.");
127
+ }
128
+ return Object.freeze({ action: "dismissed" });
129
+ }
130
+ if (result.action !== "button") {
131
+ throw new TypeError("A native alert result action must be button or dismissed.");
132
+ }
133
+ const buttonId = boundedString(result.buttonId, "Native alert result button id", ALERT_MAX_BUTTON_ID_LENGTH);
134
+ if (!request.buttons.some((button) => button.id === buttonId)) {
135
+ throw new TypeError("The native alert selected an unknown button id.");
136
+ }
137
+ return Object.freeze({ action: "button", buttonId });
138
+ }
139
+ /** Validates all dialog input and untrusted native callback results. */
140
+ export function createAlertService(adapter) {
141
+ const candidate = plainRecord(adapter, "Alert adapter");
142
+ if (candidate.platform !== "android" && candidate.platform !== "ios") {
143
+ throw new TypeError("Alert adapter platform must be android or ios.");
144
+ }
145
+ if (typeof candidate.showAlert !== "function") {
146
+ throw new TypeError("Alert adapter must provide showAlert().");
147
+ }
148
+ const platform = candidate.platform;
149
+ let presentationActive = false;
150
+ return Object.freeze({
151
+ platform,
152
+ async show(request) {
153
+ const normalized = normalizeAlertRequest(request, platform);
154
+ if (presentationActive) {
155
+ throw new AlertPresentationInProgressError();
156
+ }
157
+ presentationActive = true;
158
+ try {
159
+ const result = await adapter.showAlert(normalized);
160
+ return alertResult(result, normalized);
161
+ }
162
+ finally {
163
+ presentationActive = false;
164
+ }
165
+ },
166
+ });
167
+ }
168
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAC1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAC9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAC9C,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAChD,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAyD3C,MAAM,OAAO,gCAAiC,SAAQ,KAAK;IACzD;QACE,KAAK,CAAC,yDAAyD,CAAC,CAAC;QACjE,IAAI,CAAC,IAAI,GAAG,kCAAkC,CAAC;IACjD,CAAC;CACF;AAED,SAAS,WAAW,CAClB,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,0BAA0B,CAAC,CAAC;IACzD,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACzD,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,0BAA0B,CAAC,CAAC;I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C,MAAM,CAAC;QACnB,QAAQ;QACR,KAAK,CAAC,IAAI,CAAC,OAAqB;YAC9B,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC5D,IAAI,kBAAkB,EAAE,CAAC;gBACvB,MAAM,IAAI,gCAAgC,EAAE,CAAC;YAC/C,CAAC;YACD,kBAAkB,GAAG,IAAI,CAAC;YAC1B,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;gBACnD,OAAO,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YACzC,CAAC;oBAAS,CAAC;gBACT,kBAAkB,GAAG,KAAK,CAAC;YAC7B,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { type AlertAdapter } from "./index.js";
2
+ interface AndroidDialogConstants {
3
+ readonly buttonClicked: unknown;
4
+ readonly dismissed: unknown;
5
+ readonly buttonPositive: unknown;
6
+ readonly buttonNegative: unknown;
7
+ readonly buttonNeutral: unknown;
8
+ }
9
+ export interface AndroidDialogManagerModule {
10
+ getConstants(): AndroidDialogConstants;
11
+ showAlert(configuration: Readonly<Record<string, unknown>>, onError: (message: unknown) => void, onAction: (action: unknown, buttonKey?: unknown) => void): void;
12
+ }
13
+ export interface IOSAlertManagerModule {
14
+ alertWithArgs(configuration: Readonly<Record<string, unknown>>, callback: (buttonKey: unknown, value?: unknown) => void): void;
15
+ }
16
+ /** @internal Translation seam kept separate from React Native module lookup. */
17
+ export declare function createAndroidAlertAdapter(value: AndroidDialogManagerModule): AlertAdapter;
18
+ /** @internal Translation seam kept separate from React Native module lookup. */
19
+ export declare function createIOSAlertAdapter(value: IOSAlertManagerModule): AlertAdapter;
20
+ export {};
21
+ //# 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,EAAE,KAAK,YAAY,EAA+B,MAAM,YAAY,CAAC;AAE5E,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,0BAA0B;IACzC,YAAY,IAAI,sBAAsB,CAAC;IACvC,SAAS,CACP,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAChD,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,EACnC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,GACvD,IAAI,CAAC;CACT;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,CACX,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAChD,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,GACtD,IAAI,CAAC;CACT;AA8CD,gFAAgF;AAChF,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,0BAA0B,GAChC,YAAY,CAwHd;AAED,gFAAgF;AAChF,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,qBAAqB,GAC3B,YAAY,CAiEd"}
@@ -0,0 +1,193 @@
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 boundedNativeError(value) {
9
+ const message = typeof value === "string" && value.length > 0 && value.length <= 4_096
10
+ ? value
11
+ : "The native Android alert manager reported an invalid error.";
12
+ return new Error(message);
13
+ }
14
+ function finiteButtonKey(value, path) {
15
+ if (!Number.isSafeInteger(value)) {
16
+ throw new TypeError(`${path} must be a safe integer.`);
17
+ }
18
+ return value;
19
+ }
20
+ function iosButtonIndex(value, buttonCount) {
21
+ let index;
22
+ if (Number.isSafeInteger(value)) {
23
+ index = value;
24
+ }
25
+ else if (typeof value === "string" &&
26
+ /^(?:0|[1-9][0-9]*)$/u.test(value) &&
27
+ value.length <= 10) {
28
+ index = Number(value);
29
+ }
30
+ else {
31
+ throw new TypeError("iOS emitted an invalid alert callback.");
32
+ }
33
+ if (!Number.isSafeInteger(index) || index < 0 || index >= buttonCount) {
34
+ throw new TypeError("iOS emitted an invalid alert callback.");
35
+ }
36
+ return index;
37
+ }
38
+ /** @internal Translation seam kept separate from React Native module lookup. */
39
+ export function createAndroidAlertAdapter(value) {
40
+ const candidate = record(value, "Android alert manager");
41
+ if (typeof candidate.getConstants !== "function" ||
42
+ typeof candidate.showAlert !== "function") {
43
+ throw new TypeError("Android alert manager must provide getConstants() and showAlert().");
44
+ }
45
+ const module = value;
46
+ const constants = record(module.getConstants(), "Android alert manager constants");
47
+ if (typeof constants.buttonClicked !== "string" ||
48
+ constants.buttonClicked.length === 0 ||
49
+ typeof constants.dismissed !== "string" ||
50
+ constants.dismissed.length === 0 ||
51
+ constants.buttonClicked === constants.dismissed) {
52
+ throw new TypeError("Android alert action constants are invalid.");
53
+ }
54
+ const positive = finiteButtonKey(constants.buttonPositive, "Android positive alert button key");
55
+ const negative = finiteButtonKey(constants.buttonNegative, "Android negative alert button key");
56
+ const neutral = finiteButtonKey(constants.buttonNeutral, "Android neutral alert button key");
57
+ if (new Set([positive, negative, neutral]).size !== 3) {
58
+ throw new TypeError("Android alert button constants must be distinct.");
59
+ }
60
+ return Object.freeze({
61
+ platform: "android",
62
+ showAlert(request) {
63
+ const buttons = [...request.buttons];
64
+ const positiveButton = buttons.pop();
65
+ const negativeButton = buttons.pop();
66
+ const neutralButton = buttons.pop();
67
+ const buttonByKey = new Map();
68
+ const configuration = {
69
+ title: request.title ?? "",
70
+ message: request.message ?? "",
71
+ cancelable: request.cancelable,
72
+ };
73
+ if (neutralButton !== undefined) {
74
+ configuration.buttonNeutral = neutralButton.text;
75
+ buttonByKey.set(neutral, neutralButton.id);
76
+ }
77
+ if (negativeButton !== undefined) {
78
+ configuration.buttonNegative = negativeButton.text;
79
+ buttonByKey.set(negative, negativeButton.id);
80
+ }
81
+ if (positiveButton !== undefined) {
82
+ configuration.buttonPositive = positiveButton.text;
83
+ buttonByKey.set(positive, positiveButton.id);
84
+ }
85
+ Object.freeze(configuration);
86
+ return new Promise((resolve, reject) => {
87
+ let settled = false;
88
+ const resolveOnce = (result) => {
89
+ if (settled)
90
+ return;
91
+ settled = true;
92
+ resolve(result);
93
+ };
94
+ const rejectOnce = (error) => {
95
+ if (settled)
96
+ return;
97
+ settled = true;
98
+ reject(error);
99
+ };
100
+ try {
101
+ module.showAlert(configuration, (message) => rejectOnce(boundedNativeError(message)), (action, rawButtonKey) => {
102
+ if (action === constants.dismissed) {
103
+ resolveOnce({ action: "dismissed" });
104
+ return;
105
+ }
106
+ if (action !== constants.buttonClicked) {
107
+ rejectOnce(new TypeError("Android emitted an unknown alert action."));
108
+ return;
109
+ }
110
+ let buttonKey;
111
+ try {
112
+ buttonKey = finiteButtonKey(rawButtonKey, "Android alert callback button key");
113
+ }
114
+ catch (error) {
115
+ rejectOnce(error);
116
+ return;
117
+ }
118
+ const buttonId = buttonByKey.get(buttonKey);
119
+ if (buttonId === undefined) {
120
+ rejectOnce(new TypeError("Android selected an unknown alert button key."));
121
+ return;
122
+ }
123
+ resolveOnce({ action: "button", buttonId });
124
+ });
125
+ }
126
+ catch (error) {
127
+ rejectOnce(error);
128
+ }
129
+ });
130
+ },
131
+ });
132
+ }
133
+ /** @internal Translation seam kept separate from React Native module lookup. */
134
+ export function createIOSAlertAdapter(value) {
135
+ const candidate = record(value, "iOS alert manager");
136
+ if (typeof candidate.alertWithArgs !== "function") {
137
+ throw new TypeError("iOS alert manager must provide alertWithArgs().");
138
+ }
139
+ const module = value;
140
+ return Object.freeze({
141
+ platform: "ios",
142
+ showAlert(request) {
143
+ const cancelIndex = request.buttons.findIndex((button) => button.style === "cancel");
144
+ const destructiveIndex = request.buttons.findIndex((button) => button.style === "destructive");
145
+ const preferredIndex = request.buttons.findIndex((button) => button.preferred);
146
+ const buttons = Object.freeze(request.buttons.map((button, index) => Object.freeze({ [index]: button.text })));
147
+ const configuration = Object.freeze({
148
+ title: request.title ?? "",
149
+ ...(request.message === undefined ? {} : { message: request.message }),
150
+ buttons,
151
+ type: "default",
152
+ ...(cancelIndex === -1 ? {} : { cancelButtonKey: String(cancelIndex) }),
153
+ ...(destructiveIndex === -1
154
+ ? {}
155
+ : { destructiveButtonKey: String(destructiveIndex) }),
156
+ ...(preferredIndex === -1
157
+ ? {}
158
+ : { preferredButtonKey: String(preferredIndex) }),
159
+ ...(request.userInterfaceStyle === "system"
160
+ ? {}
161
+ : { userInterfaceStyle: request.userInterfaceStyle }),
162
+ });
163
+ return new Promise((resolve, reject) => {
164
+ let settled = false;
165
+ try {
166
+ module.alertWithArgs(configuration, (rawButtonKey) => {
167
+ if (settled)
168
+ return;
169
+ let index;
170
+ try {
171
+ index = iosButtonIndex(rawButtonKey, request.buttons.length);
172
+ }
173
+ catch (error) {
174
+ settled = true;
175
+ reject(error);
176
+ return;
177
+ }
178
+ settled = true;
179
+ resolve({
180
+ action: "button",
181
+ buttonId: request.buttons[index].id,
182
+ });
183
+ });
184
+ }
185
+ catch (error) {
186
+ settled = true;
187
+ reject(error);
188
+ }
189
+ });
190
+ },
191
+ });
192
+ }
193
+ //# 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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,cAAc,CAAC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;wBAC/D,CAAC;wBAAC,OAAO,KAAK,EAAE,CAAC;4BACf,OAAO,GAAG,IAAI,CAAC;4BACf,MAAM,CAAC,KAAK,CAAC,CAAC;4BACd,OAAO;wBACT,CAAC;wBACD,OAAO,GAAG,IAAI,CAAC;wBACf,OAAO,CAAC;4BACN,MAAM,EAAE,QAAQ;4BAChB,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAE,CAAC,EAAE;yBACrC,CAAC,CAAC;oBACL,CAAC,CAAC,CAAC;gBACL,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,GAAG,IAAI,CAAC;oBACf,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type AlertService } from "./index.js";
2
+ /** Resolves the pinned platform alert TurboModule without evaluating Alert.js. */
3
+ export declare function createReactNativeAlertService(): AlertService;
4
+ export { AlertPresentationInProgressError } from "./index.js";
5
+ export type { AlertButton, AlertButtonStyle, AlertPlatform, AlertRequest, AlertResult, AlertService, AlertUserInterfaceStyle, NormalizedAlertButton, NormalizedAlertRequest, } 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,kFAAkF;AAClF,wBAAgB,6BAA6B,IAAI,YAAY,CAmB5D;AAED,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAE9D,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,GACvB,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 { createAlertService } from "./index.js";
4
+ import { createAndroidAlertAdapter, createIOSAlertAdapter, } from "./react-native-adapter.js";
5
+ let service;
6
+ function platform() {
7
+ return assertVerifiedReactNativePlatform(getEnforcing("PlatformConstants").getConstants(), "Native alerts").platform;
8
+ }
9
+ /** Resolves the pinned platform alert TurboModule without evaluating Alert.js. */
10
+ export function createReactNativeAlertService() {
11
+ if (service !== undefined)
12
+ return service;
13
+ const nativePlatform = platform();
14
+ if (nativePlatform === "android") {
15
+ const module = get("DialogManagerAndroid");
16
+ if (module === null) {
17
+ throw new Error("The Android DialogManagerAndroid TurboModule is unavailable.");
18
+ }
19
+ service = createAlertService(createAndroidAlertAdapter(module));
20
+ return service;
21
+ }
22
+ const module = get("AlertManager");
23
+ if (module === null) {
24
+ throw new Error("The iOS AlertManager TurboModule is unavailable.");
25
+ }
26
+ service = createAlertService(createIOSAlertAdapter(module));
27
+ return service;
28
+ }
29
+ export { AlertPresentationInProgressError } 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,eAAe,CAChB,CAAC,QAAQ,CAAC;AACb,CAAC;AAED,kFAAkF;AAClF,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,CAA6B,sBAAsB,CAAC,CAAC;QACvE,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;QACJ,CAAC;QACD,OAAO,GAAG,kBAAkB,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC;QAChE,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,CAAwB,cAAc,CAAC,CAAC;IAC1D,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,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,15 @@
1
+ import { type AlertRequest, type AlertResult, type AlertService } from "./index.js";
2
+ export declare class AlertOwnerDisposedError extends Error {
3
+ constructor();
4
+ }
5
+ export interface SolidAlertController {
6
+ show(request: AlertRequest): Promise<AlertResult>;
7
+ }
8
+ /**
9
+ * Owns alert promise settlements with the current Solid owner. Native button
10
+ * and dismissal callbacks become discrete privacy-safe causal inputs.
11
+ */
12
+ export declare function createAlertController(service: AlertService): SolidAlertController;
13
+ export { AlertPresentationInProgressError } from "./index.js";
14
+ export type { AlertButton, AlertButtonStyle, AlertPlatform, AlertRequest, AlertResult, AlertService, AlertUserInterfaceStyle, } from "./index.js";
15
+ //# 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,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACnD;AA8BD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,YAAY,GACpB,oBAAoB,CA6DtB;AAED,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAE9D,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,uBAAuB,GACxB,MAAM,YAAY,CAAC"}
package/dist/solid.js ADDED
@@ -0,0 +1,91 @@
1
+ import { createCausalPlatformEventHandler, retainCausalPlatformEvent, } from "@solidnative-dev/core";
2
+ import { getOwner, onCleanup } from "solid-js";
3
+ import {} from "./index.js";
4
+ export class AlertOwnerDisposedError extends Error {
5
+ constructor() {
6
+ super("The Solid owner was disposed before its native alert settled.");
7
+ this.name = "AlertOwnerDisposedError";
8
+ }
9
+ }
10
+ function settlePromiseInsideEvent(settlement, result) {
11
+ return retainCausalPlatformEvent(undefined, (event) => {
12
+ settlement.resolve(result);
13
+ // A consumer's first await/then continuation is queued by resolve(). Queue
14
+ // this flush immediately after it so its Solid writes retain the discrete
15
+ // platform cause and priority.
16
+ void Promise.resolve().then(() => finishPromiseSettlement(event));
17
+ });
18
+ }
19
+ function finishPromiseSettlement(event) {
20
+ if (event.state !== "active")
21
+ return;
22
+ try {
23
+ event.run(() => undefined);
24
+ event.finish();
25
+ }
26
+ catch (error) {
27
+ event.fail(error);
28
+ }
29
+ }
30
+ /**
31
+ * Owns alert promise settlements with the current Solid owner. Native button
32
+ * and dismissal callbacks become discrete privacy-safe causal inputs.
33
+ */
34
+ export function createAlertController(service) {
35
+ if (typeof service !== "object" ||
36
+ service === null ||
37
+ typeof service.show !== "function") {
38
+ throw new TypeError("A Solid alert controller requires an AlertService.");
39
+ }
40
+ if (getOwner() === null) {
41
+ throw new Error("createAlertController requires an active Solid owner.");
42
+ }
43
+ let active = true;
44
+ const pending = new Set();
45
+ const settleButton = createCausalPlatformEventHandler("platform.alert.button", settlePromiseInsideEvent, { priority: "discrete" });
46
+ const settleDismissed = createCausalPlatformEventHandler("platform.alert.dismissed", settlePromiseInsideEvent, { priority: "discrete" });
47
+ onCleanup(() => {
48
+ if (!active)
49
+ return;
50
+ active = false;
51
+ const error = new AlertOwnerDisposedError();
52
+ for (const settlement of pending)
53
+ settlement.reject(error);
54
+ pending.clear();
55
+ });
56
+ return Object.freeze({
57
+ show(request) {
58
+ if (!active)
59
+ return Promise.reject(new AlertOwnerDisposedError());
60
+ return new Promise((resolve, reject) => {
61
+ const settlement = { reject, resolve };
62
+ pending.add(settlement);
63
+ let presentation;
64
+ try {
65
+ presentation = service.show(request);
66
+ }
67
+ catch (error) {
68
+ pending.delete(settlement);
69
+ reject(error);
70
+ return;
71
+ }
72
+ void Promise.resolve(presentation).then((result) => {
73
+ if (!pending.delete(settlement))
74
+ return;
75
+ if (result.action === "button") {
76
+ settleButton(settlement, result);
77
+ }
78
+ else {
79
+ settleDismissed(settlement, result);
80
+ }
81
+ }, (error) => {
82
+ if (!pending.delete(settlement))
83
+ return;
84
+ reject(error);
85
+ });
86
+ });
87
+ },
88
+ });
89
+ }
90
+ export { AlertPresentationInProgressError } from "./index.js";
91
+ //# 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;A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O,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,CACrC,CAAC,MAAM,EAAE,EAAE;oBACT,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;wBAAE,OAAO;oBACxC,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;wBAC/B,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;oBACnC,CAAC;yBAAM,CAAC;wBACN,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;oBACtC,CAAC;gBACH,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;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/dialogs",
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 native alerts and Solid-owned dialog 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/dialogs"
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
  }