@legendapp/spark 0.0.1-next.7 → 0.0.1-next.8
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/package.json +8 -8
- package/schema.json +9 -0
- package/skills/spark/SKILL.md +1 -1
- package/skills/spark/UPGRADING.md +21 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-audio/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +16 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/create.js +16 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.cjs +2 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/macos-release.js +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +10 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/release-driver.js +35 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +18 -18
- package/vendor/node_modules/@legendapp/spark-cli/dist/updates.js +18 -8
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/app.json +5 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/gitignore +2 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/app.json +5 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/gitignore +2 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +8 -8
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/app.json +5 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/gitignore +2 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +8 -8
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-codex/cpp/HybridCodexAppServer.mm +88 -76
- package/vendor/node_modules/@legendapp/spark-codex/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/RNDesktopApp.podspec +12 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/RNDesktopApp.mm +8 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.h +8 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +84 -21
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkInstance.h +27 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkInstance.mm +207 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.h +44 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +349 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkWindow.mm +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/api.ts +39 -6
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/menu.ts +21 -7
- package/vendor/node_modules/@legendapp/spark-desktop-config/accessibility-state.cjs +50 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +9 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +8 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.d.cts +7 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-scroll-view.cjs +144 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-alignment.cjs +60 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-input-alignment.cjs +112 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/schema.json +9 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/test-driver.cjs +11 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/test-driver.d.cts +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/text-input-accessibility.cjs +47 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/updates.cjs +4 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/validation.cjs +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/windows.plugin.cjs +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +18 -6
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-host/windows/application.inc +61 -15
- package/vendor/node_modules/@legendapp/spark-desktop-host/windows/launch.inc +67 -0
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-windows/RNDesktopWindows.podspec +3 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/RNDesktopWindows.mm +5 -2
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +22 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-file-dialog/RNFileDialog.podspec +1 -0
- package/vendor/node_modules/@legendapp/spark-file-dialog/ios/RNFileDialog.mm +153 -64
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/index.ts +19 -7
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/native.ts +5 -1
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/options.ts +42 -4
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/types.ts +18 -2
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-html/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-markdown/src/Markdown.tsx +2 -1
- package/vendor/node_modules/@legendapp/spark-message-dialog/macos/RNDesktopMessageDialog.mm +113 -12
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/src/index.ts +110 -14
- package/vendor/node_modules/@legendapp/spark-native-menu/ios/RNNativeMenu.mm +116 -8
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-native-menu/src/api.ts +63 -18
- package/vendor/node_modules/@legendapp/spark-native-menu/src/hooks.ts +9 -3
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-processes/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/index.tsx +5 -2
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-system/macos/RNDesktopSystem.mm +13 -3
- package/vendor/node_modules/@legendapp/spark-system/macos/SparkAppearancePreferences.h +9 -0
- package/vendor/node_modules/@legendapp/spark-system/macos/SparkAppearancePreferences.mm +31 -0
- package/vendor/node_modules/@legendapp/spark-system/macos/SparkDockTile.h +24 -0
- package/vendor/node_modules/@legendapp/spark-system/macos/SparkDockTile.mm +101 -0
- package/vendor/node_modules/@legendapp/spark-system/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-system/src/index.ts +73 -7
- package/vendor/node_modules/@legendapp/spark-tray/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkButton.mm +2 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkLayoutDirection.h +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.mm +6 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +55 -8
- package/vendor/node_modules/@legendapp/spark-ui/macos/glass-effect-view/RNGlassEffectView.mm +11 -7
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSelect.mm +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.mm +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +77 -14
- package/vendor/node_modules/@legendapp/spark-ui/macos/swipe-actions/RNSwipeActions.mm +31 -7
- package/vendor/node_modules/@legendapp/spark-ui/macos/text-input-search/RNTextInputSearch.mm +25 -1
- package/vendor/node_modules/@legendapp/spark-ui/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarNativeComponent.ts +5 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/index.tsx +19 -8
- package/vendor/node_modules/@legendapp/spark-updates/macos/RNDesktopUpdates.mm +25 -13
- package/vendor/node_modules/@legendapp/spark-updates/macos/SparkUpdateState.h +39 -0
- package/vendor/node_modules/@legendapp/spark-updates/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-updates/src/index.ts +45 -9
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
|
@@ -6,11 +6,73 @@
|
|
|
6
6
|
|
|
7
7
|
#if TARGET_OS_OSX
|
|
8
8
|
#import <AppKit/AppKit.h>
|
|
9
|
+
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
|
|
10
|
+
|
|
11
|
+
static NSArray<UTType *> *SparkContentTypes(NSArray<NSString *> *extensions)
|
|
12
|
+
{
|
|
13
|
+
NSMutableArray<UTType *> *types = [NSMutableArray new];
|
|
14
|
+
for (NSString *extension in extensions) {
|
|
15
|
+
UTType *type = [UTType typeWithFilenameExtension:extension];
|
|
16
|
+
if (type) [types addObject:type];
|
|
17
|
+
}
|
|
18
|
+
return types;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Accessory controls are data: checkboxes and labeled pop-ups in a two-column grid. `controls`
|
|
22
|
+
// receives each control by ID so its final value can be read when the panel completes.
|
|
23
|
+
static NSView *SparkAccessoryView(NSArray<NSDictionary *> *specs, NSMutableDictionary<NSString *, NSControl *> *controls)
|
|
24
|
+
{
|
|
25
|
+
NSMutableArray<NSArray<NSView *> *> *rows = [NSMutableArray arrayWithCapacity:specs.count];
|
|
26
|
+
for (NSDictionary *spec in specs) {
|
|
27
|
+
NSControl *control;
|
|
28
|
+
if ([spec[@"type"] isEqual:@"checkbox"]) {
|
|
29
|
+
NSButton *checkbox = [NSButton checkboxWithTitle:spec[@"label"] target:nil action:nil];
|
|
30
|
+
checkbox.state = [spec[@"checked"] boolValue] ? NSControlStateValueOn : NSControlStateValueOff;
|
|
31
|
+
[rows addObject:@[NSGridCell.emptyContentView, checkbox]];
|
|
32
|
+
control = checkbox;
|
|
33
|
+
} else {
|
|
34
|
+
NSPopUpButton *popup = [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:NO];
|
|
35
|
+
for (NSDictionary *option in spec[@"options"]) [popup addItemWithTitle:option[@"label"]];
|
|
36
|
+
NSUInteger selected = [[spec[@"options"] valueForKey:@"value"] indexOfObject:spec[@"value"]];
|
|
37
|
+
if (selected != NSNotFound) [popup selectItemAtIndex:(NSInteger)selected];
|
|
38
|
+
popup.accessibilityLabel = spec[@"label"];
|
|
39
|
+
[rows addObject:@[[NSTextField labelWithString:spec[@"label"]], popup]];
|
|
40
|
+
control = popup;
|
|
41
|
+
}
|
|
42
|
+
control.identifier = spec[@"id"];
|
|
43
|
+
control.accessibilityIdentifier = spec[@"id"];
|
|
44
|
+
controls[spec[@"id"]] = control;
|
|
45
|
+
}
|
|
46
|
+
NSGridView *grid = [NSGridView gridViewWithViews:rows];
|
|
47
|
+
grid.rowSpacing = 8;
|
|
48
|
+
grid.columnSpacing = 8;
|
|
49
|
+
grid.rowAlignment = NSGridRowAlignmentFirstBaseline;
|
|
50
|
+
[grid columnAtIndex:0].xPlacement = NSGridCellPlacementTrailing;
|
|
51
|
+
NSSize size = grid.fittingSize;
|
|
52
|
+
NSView *container = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, size.width + 40, size.height + 24)];
|
|
53
|
+
grid.frame = NSMakeRect(20, 12, size.width, size.height);
|
|
54
|
+
grid.autoresizingMask = NSViewMinXMargin | NSViewMaxXMargin;
|
|
55
|
+
[container addSubview:grid];
|
|
56
|
+
return container;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static NSDictionary *SparkAccessoryValues(NSArray<NSDictionary *> *specs, NSDictionary<NSString *, NSControl *> *controls)
|
|
60
|
+
{
|
|
61
|
+
NSMutableDictionary *values = [NSMutableDictionary dictionaryWithCapacity:specs.count];
|
|
62
|
+
for (NSDictionary *spec in specs) {
|
|
63
|
+
NSControl *control = controls[spec[@"id"]];
|
|
64
|
+
if ([spec[@"type"] isEqual:@"checkbox"]) values[spec[@"id"]] = @(((NSButton *)control).state == NSControlStateValueOn);
|
|
65
|
+
else values[spec[@"id"]] = spec[@"options"][(NSUInteger)((NSPopUpButton *)control).indexOfSelectedItem][@"value"];
|
|
66
|
+
}
|
|
67
|
+
return values;
|
|
68
|
+
}
|
|
9
69
|
#endif
|
|
10
70
|
|
|
11
71
|
@interface RNFileDialog ()
|
|
12
72
|
#if TARGET_OS_OSX
|
|
13
73
|
@property NSSavePanel *activePanel;
|
|
74
|
+
+ (NSDictionary *)configureOpenPanel:(NSOpenPanel *)panel options:(NSDictionary *)options;
|
|
75
|
+
+ (NSDictionary *)configureSavePanel:(NSSavePanel *)panel options:(NSDictionary *)options;
|
|
14
76
|
#endif
|
|
15
77
|
@end
|
|
16
78
|
@implementation RNFileDialog
|
|
@@ -41,6 +103,93 @@ RCT_EXPORT_MODULE(NativeFileDialog)
|
|
|
41
103
|
return data ? [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] : @"null";
|
|
42
104
|
}
|
|
43
105
|
|
|
106
|
+
#if TARGET_OS_OSX
|
|
107
|
+
// Configure without presenting, so native tests can inspect panels. Each returns its accessory controls by ID.
|
|
108
|
+
+ (NSDictionary *)configureOpenPanel:(NSOpenPanel *)panel options:(NSDictionary *)options
|
|
109
|
+
{
|
|
110
|
+
panel.canChooseFiles = options[@"canChooseFiles"] ? [options[@"canChooseFiles"] boolValue] : YES;
|
|
111
|
+
panel.canChooseDirectories = options[@"canChooseDirectories"] ? [options[@"canChooseDirectories"] boolValue] : NO;
|
|
112
|
+
panel.allowsMultipleSelection = options[@"allowsMultipleSelection"] ? [options[@"allowsMultipleSelection"] boolValue] : NO;
|
|
113
|
+
panel.resolvesAliases = YES;
|
|
114
|
+
panel.treatsFilePackagesAsDirectories = YES;
|
|
115
|
+
|
|
116
|
+
NSString *title = [options[@"title"] isKindOfClass:[NSString class]] ? options[@"title"] : nil;
|
|
117
|
+
if (title.length > 0) {
|
|
118
|
+
panel.title = title;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
NSString *message = [options[@"message"] isKindOfClass:[NSString class]] ? options[@"message"] : nil;
|
|
122
|
+
if (message.length > 0) {
|
|
123
|
+
panel.message = message;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
NSString *prompt = [options[@"prompt"] isKindOfClass:[NSString class]] ? options[@"prompt"] : nil;
|
|
127
|
+
if (prompt.length > 0) {
|
|
128
|
+
panel.prompt = prompt;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
NSArray *allowedFileTypes = [options[@"allowedFileTypes"] isKindOfClass:[NSArray class]] ? options[@"allowedFileTypes"] : nil;
|
|
132
|
+
if (allowedFileTypes.count > 0 && panel.canChooseFiles) {
|
|
133
|
+
panel.allowedContentTypes = SparkContentTypes(allowedFileTypes);
|
|
134
|
+
panel.allowsOtherFileTypes = NO;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
NSString *directoryURL = [options[@"directoryURL"] isKindOfClass:[NSString class]] ? options[@"directoryURL"] : nil;
|
|
138
|
+
if (directoryURL.length > 0) {
|
|
139
|
+
NSURL *url = [directoryURL hasPrefix:@"file://"] ? [NSURL URLWithString:directoryURL] : [NSURL fileURLWithPath:directoryURL];
|
|
140
|
+
if (url) {
|
|
141
|
+
panel.directoryURL = url;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
NSMutableDictionary *controls = [NSMutableDictionary new];
|
|
145
|
+
if ([options[@"accessory"] isKindOfClass:[NSArray class]]) {
|
|
146
|
+
panel.accessoryView = SparkAccessoryView(options[@"accessory"], controls);
|
|
147
|
+
panel.accessoryViewDisclosed = YES;
|
|
148
|
+
}
|
|
149
|
+
return controls;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
+ (NSDictionary *)configureSavePanel:(NSSavePanel *)panel options:(NSDictionary *)options
|
|
153
|
+
{
|
|
154
|
+
panel.canCreateDirectories = YES;
|
|
155
|
+
panel.showsTagField = NO;
|
|
156
|
+
|
|
157
|
+
NSString *defaultName = [options[@"defaultName"] isKindOfClass:[NSString class]] && [(NSString *)options[@"defaultName"] length] > 0 ? options[@"defaultName"] : nil;
|
|
158
|
+
|
|
159
|
+
NSArray *allowedFileTypes = [options[@"allowedFileTypes"] isKindOfClass:[NSArray class]] ? options[@"allowedFileTypes"] : nil;
|
|
160
|
+
if (allowedFileTypes.count > 0) {
|
|
161
|
+
panel.allowedContentTypes = SparkContentTypes(allowedFileTypes);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// defaultPath may name a file: a live directory starts the panel, otherwise the
|
|
165
|
+
// last component suggests the name (an explicit defaultName wins) and the parent starts it.
|
|
166
|
+
NSString *directory = [options[@"directory"] isKindOfClass:[NSString class]] ? options[@"directory"] : nil;
|
|
167
|
+
if (directory.length > 0) {
|
|
168
|
+
BOOL isDirectory = NO;
|
|
169
|
+
if ([[NSFileManager defaultManager] fileExistsAtPath:directory isDirectory:&isDirectory] && isDirectory) {
|
|
170
|
+
panel.directoryURL = [NSURL fileURLWithPath:directory isDirectory:YES];
|
|
171
|
+
} else {
|
|
172
|
+
NSString *parent = [directory stringByDeletingLastPathComponent];
|
|
173
|
+
if (defaultName.length == 0) defaultName = [directory lastPathComponent];
|
|
174
|
+
if (parent.length > 0) panel.directoryURL = [NSURL fileURLWithPath:parent isDirectory:YES];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (defaultName.length > 0) {
|
|
178
|
+
panel.nameFieldStringValue = defaultName;
|
|
179
|
+
}
|
|
180
|
+
NSMutableDictionary *controls = [NSMutableDictionary new];
|
|
181
|
+
if ([options[@"accessory"] isKindOfClass:[NSArray class]]) panel.accessoryView = SparkAccessoryView(options[@"accessory"], controls);
|
|
182
|
+
return controls;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// With accessory controls, the selection is wrapped as { <key>: selection, accessory: values }.
|
|
186
|
+
- (id)selection:(id)selection key:(NSString *)key options:(NSDictionary *)options controls:(NSDictionary *)controls
|
|
187
|
+
{
|
|
188
|
+
if (![options[@"accessory"] isKindOfClass:[NSArray class]]) return selection;
|
|
189
|
+
return @{ key: selection, @"accessory": SparkAccessoryValues(options[@"accessory"], controls) };
|
|
190
|
+
}
|
|
191
|
+
#endif
|
|
192
|
+
|
|
44
193
|
- (void)open:(NSString *)optionsJson resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
45
194
|
{
|
|
46
195
|
#if TARGET_OS_OSX
|
|
@@ -55,47 +204,13 @@ RCT_EXPORT_MODULE(NativeFileDialog)
|
|
|
55
204
|
}
|
|
56
205
|
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
|
57
206
|
self.activePanel = panel;
|
|
58
|
-
|
|
59
|
-
panel.canChooseDirectories = options[@"canChooseDirectories"] ? [options[@"canChooseDirectories"] boolValue] : NO;
|
|
60
|
-
panel.allowsMultipleSelection = options[@"allowsMultipleSelection"] ? [options[@"allowsMultipleSelection"] boolValue] : NO;
|
|
61
|
-
panel.resolvesAliases = YES;
|
|
62
|
-
panel.treatsFilePackagesAsDirectories = YES;
|
|
63
|
-
|
|
64
|
-
NSString *title = [options[@"title"] isKindOfClass:[NSString class]] ? options[@"title"] : nil;
|
|
65
|
-
if (title.length > 0) {
|
|
66
|
-
panel.title = title;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
NSString *message = [options[@"message"] isKindOfClass:[NSString class]] ? options[@"message"] : nil;
|
|
70
|
-
if (message.length > 0) {
|
|
71
|
-
panel.message = message;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
NSString *prompt = [options[@"prompt"] isKindOfClass:[NSString class]] ? options[@"prompt"] : nil;
|
|
75
|
-
if (prompt.length > 0) {
|
|
76
|
-
panel.prompt = prompt;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
NSArray *allowedFileTypes = [options[@"allowedFileTypes"] isKindOfClass:[NSArray class]] ? options[@"allowedFileTypes"] : nil;
|
|
80
|
-
if (allowedFileTypes.count > 0 && panel.canChooseFiles) {
|
|
81
|
-
panel.allowedFileTypes = allowedFileTypes;
|
|
82
|
-
panel.allowsOtherFileTypes = NO;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
NSString *directoryURL = [options[@"directoryURL"] isKindOfClass:[NSString class]] ? options[@"directoryURL"] : nil;
|
|
86
|
-
if (directoryURL.length > 0) {
|
|
87
|
-
NSURL *url = [directoryURL hasPrefix:@"file://"] ? [NSURL URLWithString:directoryURL] : [NSURL fileURLWithPath:directoryURL];
|
|
88
|
-
if (url) {
|
|
89
|
-
panel.directoryURL = url;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
207
|
+
NSDictionary *controls = [RNFileDialog configureOpenPanel:panel options:options];
|
|
93
208
|
void (^complete)(NSModalResponse) = ^(NSModalResponse result) {
|
|
94
209
|
self.activePanel = nil;
|
|
95
210
|
if (result != NSModalResponseOK) { resolve(@"null"); return; }
|
|
96
211
|
NSMutableArray<NSString *> *paths = [NSMutableArray arrayWithCapacity:panel.URLs.count];
|
|
97
212
|
for (NSURL *url in panel.URLs) if (url.path.length > 0) [paths addObject:url.path];
|
|
98
|
-
resolve([self jsonStringFromObject:paths]);
|
|
213
|
+
resolve([self jsonStringFromObject:[self selection:paths key:@"paths" options:options controls:controls]]);
|
|
99
214
|
};
|
|
100
215
|
if (parent) [panel beginSheetModalForWindow:parent completionHandler:complete];
|
|
101
216
|
else [panel beginWithCompletionHandler:complete];
|
|
@@ -119,37 +234,11 @@ RCT_EXPORT_MODULE(NativeFileDialog)
|
|
|
119
234
|
}
|
|
120
235
|
NSSavePanel *panel = [NSSavePanel savePanel];
|
|
121
236
|
self.activePanel = panel;
|
|
122
|
-
|
|
123
|
-
panel.showsTagField = NO;
|
|
124
|
-
|
|
125
|
-
NSString *defaultName = [options[@"defaultName"] isKindOfClass:[NSString class]] && [(NSString *)options[@"defaultName"] length] > 0 ? options[@"defaultName"] : nil;
|
|
126
|
-
|
|
127
|
-
NSArray *allowedFileTypes = [options[@"allowedFileTypes"] isKindOfClass:[NSArray class]] ? options[@"allowedFileTypes"] : nil;
|
|
128
|
-
if (allowedFileTypes.count > 0) {
|
|
129
|
-
panel.allowedFileTypes = allowedFileTypes;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// defaultPath may name a file: a live directory starts the panel, otherwise the
|
|
133
|
-
// last component suggests the name (an explicit defaultName wins) and the parent starts it.
|
|
134
|
-
NSString *directory = [options[@"directory"] isKindOfClass:[NSString class]] ? options[@"directory"] : nil;
|
|
135
|
-
if (directory.length > 0) {
|
|
136
|
-
BOOL isDirectory = NO;
|
|
137
|
-
if ([[NSFileManager defaultManager] fileExistsAtPath:directory isDirectory:&isDirectory] && isDirectory) {
|
|
138
|
-
panel.directoryURL = [NSURL fileURLWithPath:directory isDirectory:YES];
|
|
139
|
-
} else {
|
|
140
|
-
NSString *parent = [directory stringByDeletingLastPathComponent];
|
|
141
|
-
if (defaultName.length == 0) defaultName = [directory lastPathComponent];
|
|
142
|
-
if (parent.length > 0) panel.directoryURL = [NSURL fileURLWithPath:parent isDirectory:YES];
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (defaultName.length > 0) {
|
|
146
|
-
panel.nameFieldStringValue = defaultName;
|
|
147
|
-
}
|
|
148
|
-
|
|
237
|
+
NSDictionary *controls = [RNFileDialog configureSavePanel:panel options:options];
|
|
149
238
|
void (^complete)(NSModalResponse) = ^(NSModalResponse result) {
|
|
150
239
|
self.activePanel = nil;
|
|
151
240
|
if (result == NSModalResponseOK && panel.URL.path.length > 0) {
|
|
152
|
-
resolve([self jsonStringFromObject:panel.URL.path]);
|
|
241
|
+
resolve([self jsonStringFromObject:[self selection:panel.URL.path key:@"path" options:options controls:controls]]);
|
|
153
242
|
} else {
|
|
154
243
|
resolve(@"null");
|
|
155
244
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-file-dialog",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.8",
|
|
4
4
|
"main": "src/index",
|
|
5
5
|
"react-native": "src/index",
|
|
6
6
|
"codegenConfig": {
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
},
|
|
46
46
|
"private": true,
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@legendapp/spark-desktop-app": "0.0.1-next.
|
|
48
|
+
"@legendapp/spark-desktop-app": "0.0.1-next.8"
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,24 +1,36 @@
|
|
|
1
1
|
import { absolutePath } from "@legendapp/spark-desktop-app/src/contracts/path";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
3
|
import { parseNativeResult, invokeNative } from "@legendapp/spark-desktop-app/src/contracts";
|
|
4
|
-
import { dialogOptions } from "./options";
|
|
4
|
+
import { dialogOptions, isAccessoryValues } from "./options";
|
|
5
5
|
import { fileDialogNative } from "./native";
|
|
6
|
-
import type { OpenFileDialogOptions, OpenFileDialogResult, SaveFileDialogOptions, SaveFileDialogResult } from "./types";
|
|
7
|
-
export type { FileFilter, FileDialogOptions, OpenFileDialogOptions, OpenFileDialogResult, SaveFileDialogOptions, SaveFileDialogResult } from "./types";
|
|
6
|
+
import type { DialogAccessoryControl, DialogAccessoryValues, OpenFileDialogOptions, OpenFileDialogResult, SaveFileDialogOptions, SaveFileDialogResult } from "./types";
|
|
7
|
+
export type { DialogAccessoryControl, DialogAccessoryOption, DialogAccessoryValues, FileDialogFeature, FileFilter, FileDialogOptions, OpenFileDialogOptions, OpenFileDialogResult, SaveFileDialogOptions, SaveFileDialogResult } from "./types";
|
|
8
8
|
export { getFileDialogAvailability } from "./native";
|
|
9
9
|
|
|
10
10
|
function isNativePath(value: unknown): value is string {
|
|
11
11
|
if (typeof value !== "string" || value.startsWith("file://")) return false;
|
|
12
12
|
try { absolutePath(value, Platform.OS); return true; } catch { return false; }
|
|
13
13
|
}
|
|
14
|
+
const isPaths = (value: unknown): value is string[] => Array.isArray(value) && value.length > 0 && value.every(isNativePath);
|
|
15
|
+
|
|
16
|
+
// With accessory controls the bridge answers { <selection>, accessory }; without them, the bare selection.
|
|
17
|
+
function selection<T>(json: string, key: "paths" | "path", controls: readonly DialogAccessoryControl[] | undefined, valid: (value: unknown) => value is T): { value: T; accessory?: DialogAccessoryValues } | null {
|
|
18
|
+
if (!controls) {
|
|
19
|
+
const value = parseNativeResult(json, (value): value is T | null => value === null || valid(value));
|
|
20
|
+
return value === null ? null : { value };
|
|
21
|
+
}
|
|
22
|
+
const result = parseNativeResult(json, (value): value is Record<string, unknown> | null => value === null || (!!value && typeof value === "object" && valid((value as Record<string, unknown>)[key]) && isAccessoryValues((value as Record<string, unknown>).accessory, controls)));
|
|
23
|
+
if (result === null) return null;
|
|
24
|
+
return { value: result[key] as T, accessory: result.accessory as DialogAccessoryValues };
|
|
25
|
+
}
|
|
14
26
|
|
|
15
27
|
export async function openFileDialog(options: OpenFileDialogOptions = {}): Promise<OpenFileDialogResult> {
|
|
16
28
|
const args = dialogOptions(options, "open", Platform.OS);
|
|
17
|
-
const
|
|
18
|
-
return
|
|
29
|
+
const result = selection(await invokeNative(() => fileDialogNative().open(JSON.stringify(args))), "paths", args.accessory, isPaths);
|
|
30
|
+
return result === null ? { canceled: true } : { canceled: false, paths: result.value, ...(result.accessory && { accessory: result.accessory }) };
|
|
19
31
|
}
|
|
20
32
|
export async function saveFileDialog(options: SaveFileDialogOptions = {}): Promise<SaveFileDialogResult> {
|
|
21
33
|
const args = dialogOptions(options, "save", Platform.OS);
|
|
22
|
-
const
|
|
23
|
-
return
|
|
34
|
+
const result = selection(await invokeNative(() => fileDialogNative().save(JSON.stringify(args))), "path", args.accessory, isNativePath);
|
|
35
|
+
return result === null ? { canceled: true } : { canceled: false, path: result.value, ...(result.accessory && { accessory: result.accessory }) };
|
|
24
36
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
2
|
import { SparkError, type Availability } from "@legendapp/spark-desktop-app/src/contracts";
|
|
3
3
|
import Native from "./NativeFileDialog";
|
|
4
|
-
|
|
4
|
+
import type { FileDialogFeature } from "./types";
|
|
5
|
+
/** Without a feature, reports the open/save panels. Accessory controls are macOS-only. */
|
|
6
|
+
export function getFileDialogAvailability(feature?: FileDialogFeature): Availability {
|
|
7
|
+
if (feature !== undefined && feature !== "accessory") throw new SparkError("E_INVALID_ARGUMENT", "Unknown file dialog feature");
|
|
5
8
|
if (Platform.OS !== "macos" && Platform.OS !== "windows") return { available: false, reason: "unsupported-platform" };
|
|
9
|
+
if (feature === "accessory" && Platform.OS === "windows") return { available: false, reason: "unsupported-platform" };
|
|
6
10
|
return Native ? { available: true } : { available: false, reason: "missing-module" };
|
|
7
11
|
}
|
|
8
12
|
export function fileDialogNative() {
|
|
@@ -1,10 +1,47 @@
|
|
|
1
1
|
import { SparkError } from "@legendapp/spark-desktop-app/src/contracts";
|
|
2
2
|
import { nativePath } from "@legendapp/spark-desktop-app/src/contracts/path";
|
|
3
|
-
import type { OpenFileDialogOptions, SaveFileDialogOptions } from "./types";
|
|
3
|
+
import type { DialogAccessoryControl, OpenFileDialogOptions, SaveFileDialogOptions } from "./types";
|
|
4
|
+
|
|
5
|
+
const ACCESSORY_ID = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
6
|
+
const text = (value: unknown): value is string => typeof value === "string" && value.trim().length > 0 && !value.includes("\0");
|
|
7
|
+
const unique = (values: readonly string[]) => new Set(values).size === values.length;
|
|
8
|
+
const invalid = (message: string) => new SparkError("E_INVALID_ARGUMENT", message);
|
|
9
|
+
|
|
10
|
+
/** Validates accessory controls and returns a fresh copy for the native bridge. */
|
|
11
|
+
export function accessoryControls(value: unknown, platform: string): DialogAccessoryControl[] {
|
|
12
|
+
if (platform === "windows") throw new SparkError("E_UNSUPPORTED_OPTION", "Dialog accessory controls are not supported on Windows");
|
|
13
|
+
if (!Array.isArray(value) || value.length < 1 || value.length > 8) throw invalid("accessory must list 1–8 controls");
|
|
14
|
+
const controls = value.map((control: DialogAccessoryControl): DialogAccessoryControl => {
|
|
15
|
+
if (!control || typeof control !== "object") throw invalid("Expected an accessory control");
|
|
16
|
+
const allowed = control.type === "checkbox" ? ["type", "id", "label", "checked"] : control.type === "popup" ? ["type", "id", "label", "options", "value"] : undefined;
|
|
17
|
+
if (!allowed) throw invalid("Accessory control type must be checkbox or popup");
|
|
18
|
+
for (const key of Object.keys(control)) if (!allowed.includes(key)) throw new SparkError("E_UNSUPPORTED_OPTION", `Unsupported accessory option: ${key}`);
|
|
19
|
+
if (typeof control.id !== "string" || !ACCESSORY_ID.test(control.id)) throw invalid("Accessory control IDs are 1–64 letters, digits, _ or -");
|
|
20
|
+
if (!text(control.label)) throw invalid("Accessory controls need a label without NULs");
|
|
21
|
+
if (control.type === "checkbox") {
|
|
22
|
+
if (control.checked !== undefined && typeof control.checked !== "boolean") throw invalid("checked must be boolean");
|
|
23
|
+
return { type: "checkbox", id: control.id, label: control.label, checked: control.checked ?? false };
|
|
24
|
+
}
|
|
25
|
+
const options = control.options;
|
|
26
|
+
if (!Array.isArray(options) || options.length < 1 || options.length > 64 || options.some(option => !option || Object.keys(option).some(key => key !== "value" && key !== "label") || !text(option.value) || !text(option.label))) throw invalid("Pop-up options need 1–64 entries with a value and label");
|
|
27
|
+
if (!unique(options.map(option => option.value)) || !unique(options.map(option => option.label))) throw invalid("Pop-up option values and labels must be unique");
|
|
28
|
+
if (control.value !== undefined && !options.some(option => option.value === control.value)) throw invalid("Pop-up value must identify an option");
|
|
29
|
+
return { type: "popup", id: control.id, label: control.label, options: options.map(option => ({ value: option.value, label: option.label })), value: control.value ?? options[0]!.value };
|
|
30
|
+
});
|
|
31
|
+
if (!unique(controls.map(control => control.id))) throw invalid("Accessory control IDs must be unique");
|
|
32
|
+
return controls;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** True when native accessory values name every control once with a value of its type. */
|
|
36
|
+
export function isAccessoryValues(value: unknown, controls: readonly DialogAccessoryControl[]): value is Record<string, boolean | string> {
|
|
37
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).length !== controls.length) return false;
|
|
38
|
+
const values = value as Record<string, unknown>;
|
|
39
|
+
return controls.every(control => control.type === "checkbox" ? typeof values[control.id] === "boolean" : control.options.some(option => option.value === values[control.id]));
|
|
40
|
+
}
|
|
4
41
|
|
|
5
42
|
export function dialogOptions(options: OpenFileDialogOptions | SaveFileDialogOptions, kind: "open" | "save", platform: string) {
|
|
6
43
|
if (!options || typeof options !== "object" || Array.isArray(options)) throw new SparkError("E_INVALID_ARGUMENT", "Expected dialog options");
|
|
7
|
-
const allowed = new Set(["windowId", "defaultPath", "filters", ...(kind === "open" ? ["selection", "multiple", "title", "message", "prompt", "macos"] : ["defaultName"])]);
|
|
44
|
+
const allowed = new Set(["windowId", "defaultPath", "filters", "accessory", ...(kind === "open" ? ["selection", "multiple", "title", "message", "prompt", "macos"] : ["defaultName"])]);
|
|
8
45
|
for (const [key, value] of Object.entries(options)) {
|
|
9
46
|
if (!allowed.has(key)) throw new SparkError("E_UNSUPPORTED_OPTION", `Unsupported dialog option: ${key}`);
|
|
10
47
|
if (value === undefined) continue;
|
|
@@ -26,11 +63,12 @@ export function dialogOptions(options: OpenFileDialogOptions | SaveFileDialogOpt
|
|
|
26
63
|
}
|
|
27
64
|
}
|
|
28
65
|
const allowedFileTypes = filters?.flatMap(filter => filter.extensions);
|
|
29
|
-
|
|
66
|
+
const accessory = options.accessory === undefined ? undefined : accessoryControls(options.accessory, platform);
|
|
67
|
+
if (kind === "save") return { windowId, directory, filters, allowedFileTypes, defaultName: (options as SaveFileDialogOptions).defaultName, accessory };
|
|
30
68
|
const open = options as OpenFileDialogOptions;
|
|
31
69
|
if (open.selection !== undefined && !["files", "directories"].includes(open.selection)) throw new SparkError("E_INVALID_ARGUMENT", "selection must be files or directories");
|
|
32
70
|
if (open.multiple !== undefined && typeof open.multiple !== "boolean") throw new SparkError("E_INVALID_ARGUMENT", "multiple must be boolean");
|
|
33
71
|
if (platform === "macos" && open.macos !== undefined && (!open.macos || typeof open.macos !== "object" || Object.keys(open.macos).some(key => key !== "mixedSelection") || (open.macos.mixedSelection !== undefined && typeof open.macos.mixedSelection !== "boolean"))) throw new SparkError("E_INVALID_ARGUMENT", "Invalid macOS dialog options");
|
|
34
72
|
const mixed = platform === "macos" && open.macos?.mixedSelection === true;
|
|
35
|
-
return { windowId, directoryURL: directory, filters, allowedFileTypes, canChooseFiles: mixed || open.selection !== "directories", canChooseDirectories: mixed || open.selection === "directories", allowsMultipleSelection: open.multiple ?? false, title: open.title, message: open.message, prompt: open.prompt };
|
|
73
|
+
return { windowId, directoryURL: directory, filters, allowedFileTypes, canChooseFiles: mixed || open.selection !== "directories", canChooseDirectories: mixed || open.selection === "directories", allowsMultipleSelection: open.multiple ?? false, title: open.title, message: open.message, prompt: open.prompt, accessory };
|
|
36
74
|
}
|
|
@@ -4,6 +4,19 @@ export interface FileFilter {
|
|
|
4
4
|
name?: string;
|
|
5
5
|
extensions: readonly string[];
|
|
6
6
|
}
|
|
7
|
+
export interface DialogAccessoryOption { value: string; label: string }
|
|
8
|
+
/**
|
|
9
|
+
* A native control in the dialog's accessory area. Its final value returns with an accepted
|
|
10
|
+
* result under its `id`, which is also the control's accessibility identifier.
|
|
11
|
+
*/
|
|
12
|
+
export type DialogAccessoryControl =
|
|
13
|
+
| { type: "checkbox"; id: string; label: string; checked?: boolean }
|
|
14
|
+
/** A labeled pop-up button; `value` selects an option (default: the first). */
|
|
15
|
+
| { type: "popup"; id: string; label: string; options: readonly DialogAccessoryOption[]; value?: string };
|
|
16
|
+
/** Checkbox IDs map to booleans, pop-up IDs to the selected option's value. Key enumeration order is unspecified; iterate the supplied controls for display order. */
|
|
17
|
+
export type DialogAccessoryValues = Readonly<Record<string, boolean | string>>;
|
|
18
|
+
/** Features beyond the base open/save panels, for `getFileDialogAvailability(feature)`. */
|
|
19
|
+
export type FileDialogFeature = "accessory";
|
|
7
20
|
export interface FileDialogOptions {
|
|
8
21
|
/** Attach to this live Spark window. Omitted presents an unowned dialog. */
|
|
9
22
|
windowId?: string;
|
|
@@ -11,6 +24,8 @@ export interface FileDialogOptions {
|
|
|
11
24
|
defaultPath?: string;
|
|
12
25
|
/** macOS combines filters into one allowed-extension set; Windows keeps each labeled group. An empty array allows all files. */
|
|
13
26
|
filters?: readonly FileFilter[];
|
|
27
|
+
/** 1–8 controls shown below the file browser (macOS). Check `getFileDialogAvailability("accessory")`; other targets reject E_UNSUPPORTED_OPTION. */
|
|
28
|
+
accessory?: readonly DialogAccessoryControl[];
|
|
14
29
|
}
|
|
15
30
|
export interface OpenFileDialogOptions extends FileDialogOptions {
|
|
16
31
|
selection?: "files" | "directories";
|
|
@@ -22,5 +37,6 @@ export interface OpenFileDialogOptions extends FileDialogOptions {
|
|
|
22
37
|
macos?: { mixedSelection?: boolean };
|
|
23
38
|
}
|
|
24
39
|
export interface SaveFileDialogOptions extends FileDialogOptions { defaultName?: string }
|
|
25
|
-
|
|
26
|
-
export type
|
|
40
|
+
/** `accessory` is present only when the options supplied accessory controls. */
|
|
41
|
+
export type OpenFileDialogResult = { canceled: true } | { canceled: false; paths: string[]; accessory?: DialogAccessoryValues };
|
|
42
|
+
export type SaveFileDialogResult = { canceled: true } | { canceled: false; path: string; accessory?: DialogAccessoryValues };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-file-system",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@legendapp/spark-desktop-app": "0.0.1-next.
|
|
46
|
+
"@legendapp/spark-desktop-app": "0.0.1-next.8"
|
|
47
47
|
},
|
|
48
48
|
"private": true
|
|
49
49
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-global-shortcuts",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
]
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@legendapp/spark-desktop-app": "0.0.1-next.
|
|
44
|
+
"@legendapp/spark-desktop-app": "0.0.1-next.8"
|
|
45
45
|
},
|
|
46
46
|
"private": true
|
|
47
47
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-html",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"react-native-enriched-html": "1.1.1"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@legendapp/spark-rich-text": "0.0.1-next.
|
|
17
|
+
"@legendapp/spark-rich-text": "0.0.1-next.8"
|
|
18
18
|
},
|
|
19
19
|
"peerDependenciesMeta": {
|
|
20
20
|
"react-native-enriched-html": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-markdown",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"react-native-enriched-markdown": "1.1.1"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@legendapp/spark-rich-text": "0.0.1-next.
|
|
17
|
+
"@legendapp/spark-rich-text": "0.0.1-next.8"
|
|
18
18
|
},
|
|
19
19
|
"peerDependenciesMeta": {
|
|
20
20
|
"react-native-enriched-markdown": {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { StyleSheet, type StyleProp, type TextStyle, type ViewProps } from "react-native";
|
|
2
|
-
import { EnrichedMarkdownText, type MarkdownStyle } from "react-native-enriched-markdown";
|
|
2
|
+
import { EnrichedMarkdownText, type EnrichedMarkdownTextProps, type MarkdownStyle } from "react-native-enriched-markdown";
|
|
3
3
|
|
|
4
4
|
export interface MarkdownProps extends Omit<ViewProps, "children" | "style"> {
|
|
5
5
|
value?: string;
|
|
6
6
|
children?: string;
|
|
7
7
|
style?: StyleProp<TextStyle>;
|
|
8
8
|
markdownStyle?: MarkdownStyle;
|
|
9
|
+
flavor?: EnrichedMarkdownTextProps["flavor"];
|
|
9
10
|
selectable?: boolean;
|
|
10
11
|
onLinkPress?(event: { url: string }): void;
|
|
11
12
|
}
|