@@ -14,6 +14,16 @@ interface DialogFilter {
1414 name : string
1515 /**
1616 * Extensions to filter, without a `.` prefix.
17+ *
18+ * **Note:** Mobile platforms have different APIs for filtering that may not support extensions.
19+ * iOS: Extensions are supported in the document picker, but not in the media picker.
20+ * Android: Extensions are not supported.
21+ *
22+ * For these platforms, MIME types are the primary way to filter files, as opposed to extensions.
23+ * This means the string values here labeled as `extensions` may also be a MIME type.
24+ * This property name of `extensions` is being kept for backwards compatibility, but this may be revisited to
25+ * specify the difference between extension or MIME type filtering.
26+ *
1727 * @example
1828 * ```typescript
1929 * extensions: ['svg', 'png']
@@ -30,7 +40,14 @@ interface DialogFilter {
3040interface OpenDialogOptions {
3141 /** The title of the dialog window (desktop only). */
3242 title ?: string
33- /** The filters of the dialog. */
43+ /**
44+ * The filters of the dialog.
45+ * On mobile platforms, if either:
46+ * A) the {@linkcode pickerMode} is set to `media`, `image`, or `video`
47+ * -- or --
48+ * B) the filters include **only** either image or video mime types, the media picker will be displayed.
49+ * Otherwise, the document picker will be displayed.
50+ */
3451 filters ?: DialogFilter [ ]
3552 /**
3653 * Initial directory or file path.
@@ -52,6 +69,13 @@ interface OpenDialogOptions {
5269 recursive ?: boolean
5370 /** Whether to allow creating directories in the dialog. Enabled by default. **macOS Only** */
5471 canCreateDirectories ?: boolean
72+ /**
73+ * The preferred mode of the dialog.
74+ * This is meant for mobile platforms (iOS and Android) which have distinct file and media pickers.
75+ * If not provided, the dialog will automatically choose the best mode based on the MIME types or extensions of the {@linkcode filters}.
76+ * On desktop, this option is ignored.
77+ */
78+ pickerMode ?: PickerMode
5579}
5680
5781/**
@@ -77,6 +101,16 @@ interface SaveDialogOptions {
77101 canCreateDirectories ?: boolean
78102}
79103
104+ /**
105+ * The preferred mode of the dialog.
106+ * This is meant for mobile platforms (iOS and Android) which have distinct file and media pickers.
107+ * On desktop, this option is ignored.
108+ * If not provided, the dialog will automatically choose the best mode based on the MIME types or extensions of the {@linkcode filters}.
109+ *
110+ * **Note:** This option is only supported on iOS 14 and above. This parameter is ignored on iOS 13 and below.
111+ */
112+ export type PickerMode = 'document' | 'media' | 'image' | 'video'
113+
80114/**
81115 * Default buttons for a message dialog.
82116 *
0 commit comments