@legendapp/spark 0.0.3 → 0.0.4
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/init-template.cjs +7 -1
- package/package.json +10 -5
- package/patches/dependencies.json +4 -4
- package/patches/react-native-mmkv@4.3.2.patch +2 -2
- package/patches/react-native-nitro-zxing@0.3.1.patch +22 -0
- package/patches/registry.json +615 -0
- package/patches/workspace/expo-audio@55.0.18.patch +159 -0
- package/patches/workspace/op-engineering-op-sqlite@18.2.1.patch +796 -0
- package/patches/workspace/react-native-nitro-modules@0.37.0.patch +1348 -0
- package/patches/workspace/react-native-runtimes-core@0.1.0-alpha.2.patch +276 -0
- package/patches/workspace/react-native-webview@16.0.0.patch +208 -0
- package/postinstall.cjs +10 -1
- package/skills/spark/SKILL.md +37 -4
- package/skills/spark/UPGRADING.md +116 -1
- package/skills/spark/ai-customize.md +39 -0
- package/skills/spark/app-and-documents.md +56 -0
- package/skills/spark/external-libraries.md +87 -0
- package/skills/spark/files.md +64 -0
- package/skills/spark/integrations.md +69 -0
- package/skills/spark/keyboard.md +54 -0
- package/skills/spark/library-compat.md +76 -0
- package/skills/spark/menus-tray-dock.md +83 -0
- package/skills/spark/storage-settings.md +85 -0
- package/skills/spark/ui.md +57 -0
- package/skills/spark/windows.md +91 -0
- package/ui-popover.ts +1 -0
- package/ui-progress.ts +1 -0
- package/ui-sheet.ts +1 -0
- package/ui-split-view.ts +1 -0
- package/ui-table.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-audio/package.json +3 -13
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +5 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +137 -105
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +16 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +19 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/enriched-html-pins.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/errors.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +57 -9
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.cjs +12 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.d.cts +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrate.js +65 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +4 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +12 -8
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +35 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/patch.js +92 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project-version.js +12 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +8 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +20 -20
- package/vendor/node_modules/@legendapp/spark-cli/dist/upgrade.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/package.json +5 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-clipboard/macos/RNDesktopClipboard.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-clipboard/src/desktop.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-codex/package.json +3 -7
- package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.h +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +51 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.h +4 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.mm +82 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +2 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +6 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/identity.cjs +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +300 -71
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.cjs +318 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.d.cts +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/validation.cjs +66 -9
- package/vendor/node_modules/@legendapp/spark-desktop-config/windows.plugin.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/RNDesktopWindows.mm +7 -2
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +235 -240
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +4 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +9 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/types.ts +32 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/validation.ts +28 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/createWindowsNavigator.tsx +15 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/primaryWindowLifecycle.ts +12 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/usePrimaryWindowLifecycle.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/useWindowFocusEffect.ts +4 -1
- package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-drag-drop/macos/RNDesktopDragView.mm +77 -17
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +3 -8
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/DesktopDragViewNativeComponent.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/contracts.ts +13 -4
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/index.tsx +5 -3
- package/vendor/node_modules/@legendapp/spark-drag-drop/windows/SparkDragDrop/SparkDragDrop.h +6 -1
- package/vendor/node_modules/@legendapp/spark-expo-compat/metro.cjs +44 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/package.json +20 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/clipboard.ts +40 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/document-picker.ts +52 -0
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/options.ts +5 -2
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/types.ts +3 -3
- package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +3 -11
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +3 -10
- 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-message-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-message-dialog/src/index.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-native-menu/src/hooks.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-processes/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +3 -10
- 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-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-system/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/src/index.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkButton.mm +82 -14
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.h +1 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.mm +94 -11
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +235 -18
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.h +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.mm +216 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.h +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.mm +212 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewUpdates.h +6 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +26 -13
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.mm +126 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.mm +66 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.mm +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.mm +4 -12
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.mm +109 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +418 -102
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.mm +179 -0
- package/vendor/node_modules/@legendapp/spark-ui/package.json +9 -8
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkButtonNativeComponent.ts +10 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkTextInputNativeComponent.ts +2 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitView.tsx +99 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitViewNativeComponent.ts +29 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +34 -17
- package/vendor/node_modules/@legendapp/spark-ui/src/availability.ts +5 -4
- package/vendor/node_modules/@legendapp/spark-ui/src/checkbox-unavailable.tsx +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/control.ts +24 -3
- package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +63 -13
- package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +12 -7
- package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +12 -7
- package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +35 -13
- package/vendor/node_modules/@legendapp/spark-ui/src/mobile-input.tsx +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/PopoverNativeComponent.ts +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/index.tsx +45 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/ProgressIndicatorNativeComponent.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/index.tsx +32 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/radio-group/RadioGroupNativeComponent.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/SheetNativeComponent.ts +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/index.tsx +38 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarItemNativeComponent.ts +9 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarNativeComponent.ts +17 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/index.tsx +106 -22
- package/vendor/node_modules/@legendapp/spark-ui/src/table/TableNativeComponent.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/table/index.tsx +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/types.ts +39 -6
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.web.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/windows/SparkUI/SparkUI.h +46 -15
- package/vendor/node_modules/@legendapp/spark-updates/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
#import <react/renderer/components/RNSparkUISpec/RCTComponentViewHelpers.h>
|
|
8
8
|
|
|
9
9
|
#if TARGET_OS_OSX
|
|
10
|
+
#import "RNSparkSplitViewUpdates.h"
|
|
10
11
|
#import <CoreImage/CoreImage.h>
|
|
11
12
|
#import <QuartzCore/QuartzCore.h>
|
|
12
13
|
#import <objc/runtime.h>
|
|
@@ -78,6 +79,11 @@ static CGFloat RNSidebarSplitViewClampedUnitValue(CGFloat value)
|
|
|
78
79
|
return MIN(MAX(0, value), 1);
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
static BOOL RNSidebarSplitViewWidthChanged(CGFloat previous, CGFloat next, CGFloat measured)
|
|
83
|
+
{
|
|
84
|
+
return fabs(previous - next) >= 0.5 && fabs(measured - next) >= 0.5;
|
|
85
|
+
}
|
|
86
|
+
|
|
81
87
|
static NSVisualEffectMaterial RNSidebarSplitViewMaterialForName(NSString *value)
|
|
82
88
|
{
|
|
83
89
|
if ([value isEqualToString:@"hudWindow"]) {
|
|
@@ -481,29 +487,41 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
481
487
|
NSViewController *_sidebarViewController;
|
|
482
488
|
NSViewController *_contentViewController;
|
|
483
489
|
NSViewController *_listViewController;
|
|
490
|
+
NSViewController *_inspectorViewController;
|
|
484
491
|
NSSplitViewItem *_sidebarItem;
|
|
485
492
|
NSSplitViewItem *_contentItem;
|
|
486
493
|
NSSplitViewItem *_listItem;
|
|
494
|
+
NSSplitViewItem *_inspectorItem;
|
|
487
495
|
NSView *_sidebarContainer;
|
|
488
496
|
NSView *_contentContainer;
|
|
489
497
|
NSView *_listContainer;
|
|
498
|
+
NSView *_inspectorContainer;
|
|
490
499
|
NSView *_sidebarHost;
|
|
491
500
|
NSView *_contentHost;
|
|
492
501
|
NSView *_listHost;
|
|
502
|
+
NSView *_inspectorHost;
|
|
493
503
|
RCTUIView<RCTComponentViewProtocol> *_sidebarReactView;
|
|
494
504
|
RCTUIView<RCTComponentViewProtocol> *_contentReactView;
|
|
495
505
|
RCTUIView<RCTComponentViewProtocol> *_listReactView;
|
|
506
|
+
RCTUIView<RCTComponentViewProtocol> *_inspectorReactView;
|
|
496
507
|
id _resizeObserver;
|
|
497
508
|
LayoutMetrics _currentLayoutMetrics;
|
|
498
509
|
LayoutMetrics _sidebarReactLayoutMetrics;
|
|
499
510
|
LayoutMetrics _contentReactLayoutMetrics;
|
|
500
511
|
LayoutMetrics _listReactLayoutMetrics;
|
|
512
|
+
LayoutMetrics _inspectorReactLayoutMetrics;
|
|
501
513
|
CGFloat _sidebarMinWidth;
|
|
502
514
|
CGFloat _sidebarWidth;
|
|
503
515
|
CGFloat _contentMinWidth;
|
|
504
516
|
CGFloat _listMinWidth;
|
|
505
517
|
CGFloat _listWidth;
|
|
506
518
|
BOOL _hasList;
|
|
519
|
+
CGFloat _inspectorMinWidth;
|
|
520
|
+
CGFloat _inspectorWidth;
|
|
521
|
+
BOOL _hasInspector;
|
|
522
|
+
// The inspector's effective and prop collapsed states, owned like the sidebar's below.
|
|
523
|
+
BOOL _inspectorCollapsed;
|
|
524
|
+
BOOL _inspectorCollapsedProp;
|
|
507
525
|
// Effective collapsed state, which React knows. Follows the prop when the prop changes and the sidebar item when
|
|
508
526
|
// AppKit collapses it (toggleSidebar:, the toolbar button, ...); the latter is reported via onSidebarCollapsedChange.
|
|
509
527
|
BOOL _sidebarCollapsed;
|
|
@@ -514,6 +532,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
514
532
|
BOOL _needsPreferredDividerPositions;
|
|
515
533
|
// Our own layout pass resizes subviews several times; only its final state is published.
|
|
516
534
|
BOOL _layingOutSplitView;
|
|
535
|
+
BOOL _splitViewPropsScheduled;
|
|
517
536
|
CGFloat _lastSidebarWidth;
|
|
518
537
|
CGFloat _lastContentWidth;
|
|
519
538
|
CGFloat _lastListWidth;
|
|
@@ -521,6 +540,8 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
521
540
|
CGPoint _lastSidebarOrigin;
|
|
522
541
|
CGPoint _lastContentOrigin;
|
|
523
542
|
CGPoint _lastListOrigin;
|
|
543
|
+
CGFloat _lastInspectorWidth;
|
|
544
|
+
CGPoint _lastInspectorOrigin;
|
|
524
545
|
BOOL _lastLayoutReady;
|
|
525
546
|
BOOL _didPublishMount;
|
|
526
547
|
NSString *_appearanceName;
|
|
@@ -550,6 +571,13 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
550
571
|
_sidebarReactLayoutMetrics = EmptyLayoutMetrics;
|
|
551
572
|
_contentReactLayoutMetrics = EmptyLayoutMetrics;
|
|
552
573
|
_listReactLayoutMetrics = EmptyLayoutMetrics;
|
|
574
|
+
_inspectorReactLayoutMetrics = EmptyLayoutMetrics;
|
|
575
|
+
_inspectorMinWidth = 220;
|
|
576
|
+
_inspectorWidth = 0;
|
|
577
|
+
_hasInspector = NO;
|
|
578
|
+
_inspectorCollapsed = NO;
|
|
579
|
+
_inspectorCollapsedProp = NO;
|
|
580
|
+
_lastInspectorWidth = -1;
|
|
553
581
|
_sidebarMinWidth = 180;
|
|
554
582
|
_sidebarWidth = 0;
|
|
555
583
|
_contentMinWidth = 320;
|
|
@@ -573,6 +601,10 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
573
601
|
_sidebarContainer = [NSView new];
|
|
574
602
|
_contentContainer = [RNSidebarSplitViewPaneView new];
|
|
575
603
|
_listContainer = [RNSidebarSplitViewPaneView new];
|
|
604
|
+
_inspectorContainer = [RNSidebarSplitViewPaneView new];
|
|
605
|
+
_inspectorContainer.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
606
|
+
_inspectorContainer.wantsLayer = YES;
|
|
607
|
+
_inspectorContainer.layer.masksToBounds = YES;
|
|
576
608
|
_sidebarContainer.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
577
609
|
_contentContainer.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
578
610
|
_listContainer.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
@@ -589,12 +621,14 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
589
621
|
_sidebarHost = [RNSidebarSplitViewPaneHost new];
|
|
590
622
|
_contentHost = [RNSidebarSplitViewPaneHost new];
|
|
591
623
|
_listHost = [RNSidebarSplitViewPaneHost new];
|
|
592
|
-
|
|
624
|
+
_inspectorHost = [RNSidebarSplitViewPaneHost new];
|
|
625
|
+
for (NSView *host in @[ _sidebarHost, _contentHost, _listHost, _inspectorHost ]) {
|
|
593
626
|
host.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
594
627
|
}
|
|
595
628
|
[_sidebarContainer addSubview:_sidebarHost];
|
|
596
629
|
[_contentContainer addSubview:_contentHost];
|
|
597
630
|
[_listContainer addSubview:_listHost];
|
|
631
|
+
[_inspectorContainer addSubview:_inspectorHost];
|
|
598
632
|
|
|
599
633
|
_sidebarViewController = [NSViewController new];
|
|
600
634
|
_contentViewController = [NSViewController new];
|
|
@@ -602,6 +636,8 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
602
636
|
_sidebarViewController.view = _sidebarContainer;
|
|
603
637
|
_contentViewController.view = _contentContainer;
|
|
604
638
|
_listViewController.view = _listContainer;
|
|
639
|
+
_inspectorViewController = [NSViewController new];
|
|
640
|
+
_inspectorViewController.view = _inspectorContainer;
|
|
605
641
|
|
|
606
642
|
_sidebarItem = [NSSplitViewItem sidebarWithViewController:_sidebarViewController];
|
|
607
643
|
_contentItem = [NSSplitViewItem splitViewItemWithViewController:_contentViewController];
|
|
@@ -612,12 +648,17 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
612
648
|
_listItem.canCollapse = NO;
|
|
613
649
|
// Window resizes go to the content column; sidebar (260) and list keep their widths.
|
|
614
650
|
_listItem.holdingPriority = NSLayoutPriorityDefaultLow + 1;
|
|
651
|
+
// Trailing inspector (as in Xcode or Keynote), appended after the content only while an inspector pane is supplied.
|
|
652
|
+
_inspectorItem = [NSSplitViewItem inspectorWithViewController:_inspectorViewController];
|
|
653
|
+
_inspectorItem.canCollapse = YES;
|
|
654
|
+
_inspectorItem.holdingPriority = NSLayoutPriorityDefaultLow + 1;
|
|
615
655
|
[self updateSplitItemSizing];
|
|
616
656
|
|
|
617
657
|
if (@available(macOS 11.0, *)) {
|
|
618
658
|
_sidebarItem.allowsFullHeightLayout = YES;
|
|
619
659
|
_contentItem.allowsFullHeightLayout = YES;
|
|
620
660
|
_listItem.allowsFullHeightLayout = YES;
|
|
661
|
+
_inspectorItem.allowsFullHeightLayout = YES;
|
|
621
662
|
}
|
|
622
663
|
|
|
623
664
|
_splitViewController = [RNSidebarSplitViewController new];
|
|
@@ -662,6 +703,64 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
662
703
|
_sidebarItem.preferredThicknessFraction = 0.26;
|
|
663
704
|
_contentItem.minimumThickness = MAX(240, _contentMinWidth);
|
|
664
705
|
_listItem.minimumThickness = MAX(120, _listMinWidth);
|
|
706
|
+
_inspectorItem.minimumThickness = MAX(120, _inspectorMinWidth);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
- (void)updateInspectorItem
|
|
710
|
+
{
|
|
711
|
+
BOOL installed = [_splitViewController.splitViewItems containsObject:_inspectorItem];
|
|
712
|
+
if (_hasInspector && !installed) {
|
|
713
|
+
[_splitViewController addSplitViewItem:_inspectorItem];
|
|
714
|
+
} else if (!_hasInspector && installed) {
|
|
715
|
+
[_splitViewController removeSplitViewItem:_inspectorItem];
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
- (CGFloat)inspectorReserveWidth
|
|
720
|
+
{
|
|
721
|
+
return _hasInspector && !_inspectorCollapsed ? _inspectorItem.minimumThickness + _splitViewController.splitView.dividerThickness : 0;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
- (CGFloat)preferredInspectorWidthForBounds:(CGRect)bounds sidebarExtent:(CGFloat)sidebarExtent
|
|
725
|
+
{
|
|
726
|
+
if (!_hasInspector || _inspectorCollapsed) {
|
|
727
|
+
return 0;
|
|
728
|
+
}
|
|
729
|
+
CGFloat dividerThickness = _splitViewController.splitView.dividerThickness;
|
|
730
|
+
CGFloat maxWidth = bounds.size.width - sidebarExtent - [self listReserveWidth] - _contentItem.minimumThickness - dividerThickness;
|
|
731
|
+
CGFloat preferred = _inspectorWidth > 0 ? _inspectorWidth : _inspectorMinWidth;
|
|
732
|
+
return MAX(0, MIN(MAX(_inspectorItem.minimumThickness, preferred), maxWidth));
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/// The inspector's counterparts of updateSidebarCollapsed and adoptNativeSidebarCollapsed below.
|
|
736
|
+
- (void)updateInspectorCollapsed
|
|
737
|
+
{
|
|
738
|
+
if (_inspectorItem.collapsed != _inspectorCollapsed) {
|
|
739
|
+
_inspectorItem.collapsed = _inspectorCollapsed;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
- (void)adoptNativeInspectorCollapsed
|
|
744
|
+
{
|
|
745
|
+
if (!_hasInspector || _inspectorItem.collapsed == _inspectorCollapsed) {
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
_inspectorCollapsed = _inspectorItem.collapsed;
|
|
749
|
+
const auto eventEmitter = std::static_pointer_cast<const SidebarSplitViewEventEmitter>(_eventEmitter);
|
|
750
|
+
if (eventEmitter) {
|
|
751
|
+
eventEmitter->onInspectorCollapsedChange(SidebarSplitViewEventEmitter::OnInspectorCollapsedChange{
|
|
752
|
+
.collapsed = static_cast<bool>(_inspectorCollapsed),
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
- (CGRect)inspectorPaneBounds
|
|
758
|
+
{
|
|
759
|
+
CGRect bounds = _inspectorContainer.bounds;
|
|
760
|
+
if (!_hasInspector || _inspectorItem.collapsed) {
|
|
761
|
+
bounds.size.width = 0;
|
|
762
|
+
}
|
|
763
|
+
return bounds;
|
|
665
764
|
}
|
|
666
765
|
|
|
667
766
|
- (void)updateListItem
|
|
@@ -682,7 +781,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
682
781
|
- (CGFloat)preferredSidebarWidthForBounds:(CGRect)bounds
|
|
683
782
|
{
|
|
684
783
|
CGFloat dividerThickness = _splitViewController.splitView.dividerThickness;
|
|
685
|
-
CGFloat maxSidebarWidth = bounds.size.width - _contentItem.minimumThickness - dividerThickness - [self listReserveWidth];
|
|
784
|
+
CGFloat maxSidebarWidth = bounds.size.width - _contentItem.minimumThickness - dividerThickness - [self listReserveWidth] - [self inspectorReserveWidth];
|
|
686
785
|
CGFloat preferredSidebarWidth = _sidebarWidth > 0 ? _sidebarWidth : _sidebarMinWidth;
|
|
687
786
|
CGFloat sidebarWidth = MIN(MAX(_sidebarItem.minimumThickness, preferredSidebarWidth), maxSidebarWidth);
|
|
688
787
|
return MAX(0, sidebarWidth);
|
|
@@ -694,7 +793,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
694
793
|
return 0;
|
|
695
794
|
}
|
|
696
795
|
CGFloat dividerThickness = _splitViewController.splitView.dividerThickness;
|
|
697
|
-
CGFloat maxListWidth = bounds.size.width - sidebarExtent - _contentItem.minimumThickness - dividerThickness;
|
|
796
|
+
CGFloat maxListWidth = bounds.size.width - sidebarExtent - _contentItem.minimumThickness - dividerThickness - [self inspectorReserveWidth];
|
|
698
797
|
CGFloat preferredListWidth = _listWidth > 0 ? _listWidth : _listMinWidth;
|
|
699
798
|
return MAX(0, MIN(MAX(_listItem.minimumThickness, preferredListWidth), maxListWidth));
|
|
700
799
|
}
|
|
@@ -896,6 +995,9 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
896
995
|
[self syncReactSubview:_listReactView
|
|
897
996
|
nativeBounds:_hasList ? _listContainer.bounds : CGRectZero
|
|
898
997
|
previousLayoutMetrics:&_listReactLayoutMetrics];
|
|
998
|
+
[self syncReactSubview:_inspectorReactView
|
|
999
|
+
nativeBounds:[self inspectorPaneBounds]
|
|
1000
|
+
previousLayoutMetrics:&_inspectorReactLayoutMetrics];
|
|
899
1001
|
}
|
|
900
1002
|
|
|
901
1003
|
- (CGPoint)splitViewOriginOfPane:(nullable NSView *)pane
|
|
@@ -954,7 +1056,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
954
1056
|
return;
|
|
955
1057
|
}
|
|
956
1058
|
|
|
957
|
-
BOOL panesReady = layoutReady && _sidebarReactView && _contentReactView && (!_hasList || _listReactView);
|
|
1059
|
+
BOOL panesReady = layoutReady && _sidebarReactView && _contentReactView && (!_hasList || _listReactView) && (!_hasInspector || _inspectorReactView);
|
|
958
1060
|
if (panesReady && self.window && !_didPublishMount) {
|
|
959
1061
|
// This also runs when an already-laid-out Fabric tree joins its window.
|
|
960
1062
|
// Keep it before metrics deduplication so the startup cover cannot linger.
|
|
@@ -965,7 +1067,11 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
965
1067
|
CGPoint sidebarOrigin = [self splitViewOriginOfPane:_sidebarContainer];
|
|
966
1068
|
CGPoint contentOrigin = [self splitViewOriginOfPane:_contentContainer];
|
|
967
1069
|
CGPoint listOrigin = _hasList ? [self splitViewOriginOfPane:_listContainer] : CGPointZero;
|
|
1070
|
+
CGFloat inspectorWidth = [self inspectorPaneBounds].size.width;
|
|
1071
|
+
CGPoint inspectorOrigin = inspectorWidth > 0 ? [self splitViewOriginOfPane:_inspectorContainer] : CGPointZero;
|
|
968
1072
|
if (fabs(sidebarWidth - _lastSidebarWidth) < 0.5 &&
|
|
1073
|
+
fabs(inspectorWidth - _lastInspectorWidth) < 0.5 &&
|
|
1074
|
+
CGPointEqualToPoint(inspectorOrigin, _lastInspectorOrigin) &&
|
|
969
1075
|
fabs(contentWidth - _lastContentWidth) < 0.5 &&
|
|
970
1076
|
fabs(listWidth - _lastListWidth) < 0.5 &&
|
|
971
1077
|
fabs(height - _lastHeight) < 0.5 &&
|
|
@@ -983,6 +1089,8 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
983
1089
|
_lastSidebarOrigin = sidebarOrigin;
|
|
984
1090
|
_lastContentOrigin = contentOrigin;
|
|
985
1091
|
_lastListOrigin = listOrigin;
|
|
1092
|
+
_lastInspectorWidth = inspectorWidth;
|
|
1093
|
+
_lastInspectorOrigin = inspectorOrigin;
|
|
986
1094
|
_lastLayoutReady = panesReady;
|
|
987
1095
|
|
|
988
1096
|
eventEmitter->onSplitViewDidResize(SidebarSplitViewEventEmitter::OnSplitViewDidResize{
|
|
@@ -991,6 +1099,10 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
991
1099
|
.contentX = contentOrigin.x,
|
|
992
1100
|
.contentY = contentOrigin.y,
|
|
993
1101
|
.height = height,
|
|
1102
|
+
.inspectorHeight = inspectorWidth > 0 ? height : 0,
|
|
1103
|
+
.inspectorWidth = inspectorWidth,
|
|
1104
|
+
.inspectorX = inspectorOrigin.x,
|
|
1105
|
+
.inspectorY = inspectorOrigin.y,
|
|
994
1106
|
.isLayoutReady = static_cast<bool>(panesReady),
|
|
995
1107
|
.isVertical = true,
|
|
996
1108
|
.listHeight = listWidth > 0 ? height : 0,
|
|
@@ -1025,12 +1137,15 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1025
1137
|
CGFloat listX = sidebarWidth > 0 ? sidebarWidth + dividerThickness : 0;
|
|
1026
1138
|
CGFloat listWidth = [self preferredListWidthForBounds:bounds sidebarExtent:listX];
|
|
1027
1139
|
CGFloat contentX = listWidth > 0 ? listX + listWidth + dividerThickness : listX;
|
|
1028
|
-
CGFloat
|
|
1140
|
+
CGFloat inspectorWidth = [self preferredInspectorWidthForBounds:bounds sidebarExtent:listX];
|
|
1141
|
+
CGFloat contentWidth = MAX(0, bounds.size.width - contentX - (inspectorWidth > 0 ? inspectorWidth + dividerThickness : 0));
|
|
1029
1142
|
if (contentWidth <= 0) {
|
|
1030
1143
|
contentWidth = bounds.size.width;
|
|
1031
1144
|
contentX = 0;
|
|
1032
1145
|
listWidth = 0;
|
|
1146
|
+
inspectorWidth = 0;
|
|
1033
1147
|
}
|
|
1148
|
+
CGFloat inspectorX = bounds.size.width - inspectorWidth;
|
|
1034
1149
|
|
|
1035
1150
|
// The offsets above run from the leading edge, as AppKit's split view lays out panes.
|
|
1036
1151
|
CGFloat sidebarX = 0;
|
|
@@ -1038,12 +1153,16 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1038
1153
|
sidebarX = bounds.size.width - sidebarWidth;
|
|
1039
1154
|
listX = bounds.size.width - listX - listWidth;
|
|
1040
1155
|
contentX = bounds.size.width - contentX - contentWidth;
|
|
1156
|
+
inspectorX = 0;
|
|
1041
1157
|
}
|
|
1042
1158
|
_splitViewController.view.frame = bounds;
|
|
1043
1159
|
_splitViewController.splitView.frame = bounds;
|
|
1044
1160
|
[self setPane:_sidebarContainer splitViewFrame:CGRectMake(sidebarX, 0, sidebarWidth, bounds.size.height)];
|
|
1045
1161
|
[self setPane:_listContainer splitViewFrame:CGRectMake(listX, 0, listWidth, bounds.size.height)];
|
|
1046
1162
|
[self setPane:_contentContainer splitViewFrame:CGRectMake(contentX, 0, contentWidth, bounds.size.height)];
|
|
1163
|
+
if (_hasInspector) {
|
|
1164
|
+
[self setPane:_inspectorContainer splitViewFrame:CGRectMake(inspectorX, 0, inspectorWidth, bounds.size.height)];
|
|
1165
|
+
}
|
|
1047
1166
|
|
|
1048
1167
|
CGRect sidebarBounds = CGRectMake(0, 0, sidebarWidth, bounds.size.height);
|
|
1049
1168
|
CGRect contentBounds = CGRectMake(0, 0, contentWidth, bounds.size.height);
|
|
@@ -1056,6 +1175,9 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1056
1175
|
[self syncReactSubview:_listReactView
|
|
1057
1176
|
nativeBounds:CGRectMake(0, 0, listWidth, bounds.size.height)
|
|
1058
1177
|
previousLayoutMetrics:&_listReactLayoutMetrics];
|
|
1178
|
+
[self syncReactSubview:_inspectorReactView
|
|
1179
|
+
nativeBounds:CGRectMake(0, 0, inspectorWidth, bounds.size.height)
|
|
1180
|
+
previousLayoutMetrics:&_inspectorReactLayoutMetrics];
|
|
1059
1181
|
[self layoutContentTitlebarMaterial];
|
|
1060
1182
|
if (!_layingOutSplitView) {
|
|
1061
1183
|
[self emitSplitViewDidResizeWithSidebarWidth:sidebarWidth
|
|
@@ -1073,6 +1195,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1073
1195
|
- (void)publishSplitViewLayoutAllowEstimatedReady:(BOOL)allowEstimatedReady
|
|
1074
1196
|
{
|
|
1075
1197
|
[self adoptNativeSidebarCollapsed];
|
|
1198
|
+
[self adoptNativeInspectorCollapsed];
|
|
1076
1199
|
CGFloat sidebarWidth = [self sidebarPaneBounds].size.width;
|
|
1077
1200
|
CGFloat contentWidth = _contentContainer.bounds.size.width;
|
|
1078
1201
|
CGFloat contentX = [self splitViewOriginOfPane:_contentContainer].x;
|
|
@@ -1149,13 +1272,20 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1149
1272
|
}
|
|
1150
1273
|
[_splitViewController.splitView setPosition:sidebarExtent + listWidth ofDividerAtIndex:1];
|
|
1151
1274
|
}
|
|
1275
|
+
CGFloat inspectorWidth = [self preferredInspectorWidthForBounds:bounds sidebarExtent:sidebarExtent];
|
|
1276
|
+
if (inspectorWidth > 0) {
|
|
1277
|
+
// The split view can hold views besides the items' (title-bar materials), so dividers are counted from the items.
|
|
1278
|
+
NSInteger divider = (NSInteger)_splitViewController.splitViewItems.count - 2;
|
|
1279
|
+
[_splitViewController.splitView setPosition:bounds.size.width - inspectorWidth - dividerThickness ofDividerAtIndex:divider];
|
|
1280
|
+
}
|
|
1152
1281
|
// A small startup frame can clamp a preference. Retry on later layouts until it fits,
|
|
1153
1282
|
// unless a real divider drag takes ownership in splitViewDidResize.
|
|
1154
1283
|
CGFloat desiredSidebarWidth = MAX(_sidebarItem.minimumThickness, _sidebarWidth > 0 ? _sidebarWidth : _sidebarMinWidth);
|
|
1155
1284
|
CGFloat desiredListWidth = MAX(_listItem.minimumThickness, _listWidth > 0 ? _listWidth : _listMinWidth);
|
|
1156
1285
|
_needsPreferredDividerPositions =
|
|
1157
1286
|
(!_sidebarCollapsed && [self preferredSidebarWidthForBounds:bounds] < desiredSidebarWidth - 0.5) ||
|
|
1158
|
-
(_hasList && [self preferredListWidthForBounds:bounds sidebarExtent:sidebarExtent] < desiredListWidth - 0.5)
|
|
1287
|
+
(_hasList && [self preferredListWidthForBounds:bounds sidebarExtent:sidebarExtent] < desiredListWidth - 0.5) ||
|
|
1288
|
+
(inspectorWidth > 0 && inspectorWidth < MAX(_inspectorItem.minimumThickness, _inspectorWidth > 0 ? _inspectorWidth : _inspectorMinWidth) - 0.5);
|
|
1159
1289
|
}
|
|
1160
1290
|
|
|
1161
1291
|
- (void)splitViewDidResize
|
|
@@ -1200,8 +1330,10 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1200
1330
|
_splitViewController.splitView.frame = bounds;
|
|
1201
1331
|
[self updateSplitItemSizing];
|
|
1202
1332
|
[self updateListItem];
|
|
1333
|
+
[self updateInspectorItem];
|
|
1203
1334
|
[self updateItemLayoutDirection];
|
|
1204
1335
|
[self adoptNativeSidebarCollapsed];
|
|
1336
|
+
[self adoptNativeInspectorCollapsed];
|
|
1205
1337
|
if (_contentContainer.bounds.size.width <= 0 ||
|
|
1206
1338
|
_contentContainer.bounds.size.height <= 0 ||
|
|
1207
1339
|
fabs(_contentContainer.bounds.size.height - bounds.size.height) >= 0.5) {
|
|
@@ -1219,6 +1351,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1219
1351
|
_lastSidebarWidth = -1;
|
|
1220
1352
|
_lastContentWidth = -1;
|
|
1221
1353
|
_lastListWidth = -1;
|
|
1354
|
+
_lastInspectorWidth = -1;
|
|
1222
1355
|
_lastHeight = -1;
|
|
1223
1356
|
_lastLayoutReady = NO;
|
|
1224
1357
|
}
|
|
@@ -1275,6 +1408,22 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1275
1408
|
return;
|
|
1276
1409
|
}
|
|
1277
1410
|
|
|
1411
|
+
// React renders the inspector pane last: after the list when there is one.
|
|
1412
|
+
if (index == 3 || (index == 2 && !_hasList && _hasInspector)) {
|
|
1413
|
+
[_inspectorReactView removeFromSuperview];
|
|
1414
|
+
_inspectorReactView = childComponentView;
|
|
1415
|
+
_inspectorReactLayoutMetrics = EmptyLayoutMetrics;
|
|
1416
|
+
childComponentView.hidden = YES;
|
|
1417
|
+
[_inspectorHost addSubview:childComponentView];
|
|
1418
|
+
[self syncReactSubview:_inspectorReactView
|
|
1419
|
+
nativeBounds:[self inspectorPaneBounds]
|
|
1420
|
+
previousLayoutMetrics:&_inspectorReactLayoutMetrics];
|
|
1421
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
1422
|
+
[self publishSplitViewLayoutAllowEstimatedReady:NO];
|
|
1423
|
+
});
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1278
1427
|
if (index == 2) {
|
|
1279
1428
|
[_listReactView removeFromSuperview];
|
|
1280
1429
|
_listReactView = childComponentView;
|
|
@@ -1295,7 +1444,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1295
1444
|
return;
|
|
1296
1445
|
}
|
|
1297
1446
|
|
|
1298
|
-
if (index == 1 || index == 2) {
|
|
1447
|
+
if (index == 1 || index == 2 || index == 3) {
|
|
1299
1448
|
[_contentContainer addSubview:childComponentView];
|
|
1300
1449
|
return;
|
|
1301
1450
|
}
|
|
@@ -1328,8 +1477,15 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1328
1477
|
[childComponentView removeFromSuperview];
|
|
1329
1478
|
return;
|
|
1330
1479
|
}
|
|
1480
|
+
|
|
1481
|
+
if (childComponentView == _inspectorReactView) {
|
|
1482
|
+
_inspectorReactView = nil;
|
|
1483
|
+
_inspectorReactLayoutMetrics = EmptyLayoutMetrics;
|
|
1484
|
+
[childComponentView removeFromSuperview];
|
|
1485
|
+
return;
|
|
1486
|
+
}
|
|
1331
1487
|
#else
|
|
1332
|
-
if (index == 0 || index == 1 || index == 2) {
|
|
1488
|
+
if (index == 0 || index == 1 || index == 2 || index == 3) {
|
|
1333
1489
|
[childComponentView removeFromSuperview];
|
|
1334
1490
|
return;
|
|
1335
1491
|
}
|
|
@@ -1340,9 +1496,35 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1340
1496
|
|
|
1341
1497
|
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
1342
1498
|
{
|
|
1343
|
-
|
|
1499
|
+
[super updateProps:props oldProps:oldProps];
|
|
1500
|
+
|
|
1501
|
+
#if TARGET_OS_OSX
|
|
1502
|
+
if (_splitViewPropsScheduled) return;
|
|
1503
|
+
const auto &next = *std::static_pointer_cast<const SidebarSplitViewProps>(props);
|
|
1504
|
+
BOOL widthChanged = oldProps && self.window && (fabs(_sidebarWidth - next.sidebarWidth) >= 0.5
|
|
1505
|
+
|| fabs(_listWidth - next.listWidth) >= 0.5 || fabs(_inspectorWidth - next.inspectorWidth) >= 0.5);
|
|
1506
|
+
RNSidebarSplitViewNativeSplitView *split = (RNSidebarSplitViewNativeSplitView *)_splitViewController.splitView;
|
|
1507
|
+
// Moving a divider installs AppKit constraints. Wait for Fabric's mount and any mouse tracking to finish.
|
|
1508
|
+
if (widthChanged || split.trackingDivider || [NSRunLoop.currentRunLoop.currentMode isEqualToString:NSEventTrackingRunLoopMode]) {
|
|
1509
|
+
_splitViewPropsScheduled = YES;
|
|
1510
|
+
__weak RNSidebarSplitViewComponent *weakSelf = self;
|
|
1511
|
+
RNSparkScheduleSplitViewUpdate(^{ [weakSelf flushSplitViewProps]; });
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
[self applySplitViewProps];
|
|
1515
|
+
#endif
|
|
1516
|
+
}
|
|
1344
1517
|
|
|
1345
1518
|
#if TARGET_OS_OSX
|
|
1519
|
+
- (void)flushSplitViewProps
|
|
1520
|
+
{
|
|
1521
|
+
if (_splitViewPropsScheduled) [self applySplitViewProps];
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
- (void)applySplitViewProps
|
|
1525
|
+
{
|
|
1526
|
+
_splitViewPropsScheduled = NO;
|
|
1527
|
+
const auto &newProps = *std::static_pointer_cast<SidebarSplitViewProps const>(_props);
|
|
1346
1528
|
// Collapse and accessory mutations can synchronously resize AppKit before list membership and sizing settle.
|
|
1347
1529
|
// Publish only after this prop transaction has completed, preserving any enclosing layout's guard.
|
|
1348
1530
|
BOOL wasLayingOutSplitView = _layingOutSplitView;
|
|
@@ -1359,9 +1541,17 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1359
1541
|
}
|
|
1360
1542
|
// Echoing an adopted native state acknowledges it; it must not reseed user-dragged dividers.
|
|
1361
1543
|
BOOL effectiveCollapsedChanged = collapsedPropChanged && _sidebarCollapsed != newProps.sidebarCollapsed;
|
|
1544
|
+
BOOL inspectorCollapsedPropChanged = _inspectorCollapsedProp != newProps.inspectorCollapsed;
|
|
1545
|
+
if (!inspectorCollapsedPropChanged) {
|
|
1546
|
+
[self adoptNativeInspectorCollapsed];
|
|
1547
|
+
}
|
|
1548
|
+
BOOL effectiveInspectorCollapsedChanged = inspectorCollapsedPropChanged && _inspectorCollapsed != newProps.inspectorCollapsed;
|
|
1362
1549
|
BOOL preferredWidthsChanged =
|
|
1363
|
-
|
|
1364
|
-
|
|
1550
|
+
RNSidebarSplitViewWidthChanged(_inspectorWidth, newProps.inspectorWidth, [self inspectorPaneBounds].size.width) ||
|
|
1551
|
+
_hasInspector != newProps.hasInspector ||
|
|
1552
|
+
effectiveInspectorCollapsedChanged ||
|
|
1553
|
+
RNSidebarSplitViewWidthChanged(_sidebarWidth, newProps.sidebarWidth, [self sidebarPaneBounds].size.width) ||
|
|
1554
|
+
RNSidebarSplitViewWidthChanged(_listWidth, newProps.listWidth, _hasList ? _listContainer.bounds.size.width : 0) ||
|
|
1365
1555
|
_hasList != newProps.hasList ||
|
|
1366
1556
|
effectiveCollapsedChanged;
|
|
1367
1557
|
BOOL shouldRelayout =
|
|
@@ -1369,6 +1559,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1369
1559
|
fabs(_sidebarMinWidth - newProps.sidebarMinWidth) >= 0.5 ||
|
|
1370
1560
|
fabs(_contentMinWidth - newProps.contentMinWidth) >= 0.5 ||
|
|
1371
1561
|
fabs(_listMinWidth - newProps.listMinWidth) >= 0.5 ||
|
|
1562
|
+
fabs(_inspectorMinWidth - newProps.inspectorMinWidth) >= 0.5 ||
|
|
1372
1563
|
fabs(_contentTitlebarHeight - newProps.contentTitlebarHeight) >= 0.5;
|
|
1373
1564
|
NSString *nextContentTitlebarMaterialName = [NSString stringWithUTF8String:newProps.contentTitlebarMaterial.c_str()];
|
|
1374
1565
|
if (nextContentTitlebarMaterialName.length == 0) {
|
|
@@ -1401,14 +1592,33 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1401
1592
|
_listMinWidth = newProps.listMinWidth;
|
|
1402
1593
|
_listWidth = newProps.listWidth;
|
|
1403
1594
|
_hasList = newProps.hasList;
|
|
1595
|
+
_inspectorMinWidth = newProps.inspectorMinWidth;
|
|
1596
|
+
_inspectorWidth = newProps.inspectorWidth;
|
|
1597
|
+
_hasInspector = newProps.hasInspector;
|
|
1598
|
+
// Fabric can mount the children before the first props arrive, so a third child taken for the list
|
|
1599
|
+
// is the inspector once the props say there is an inspector and no list.
|
|
1600
|
+
if (_hasInspector && !_hasList && _listReactView && !_inspectorReactView) {
|
|
1601
|
+
_inspectorReactView = _listReactView;
|
|
1602
|
+
_listReactView = nil;
|
|
1603
|
+
_listReactLayoutMetrics = EmptyLayoutMetrics;
|
|
1604
|
+
_inspectorReactLayoutMetrics = EmptyLayoutMetrics;
|
|
1605
|
+
_inspectorReactView.hidden = YES;
|
|
1606
|
+
[_inspectorHost addSubview:_inspectorReactView];
|
|
1607
|
+
shouldRelayout = YES;
|
|
1608
|
+
}
|
|
1609
|
+
_inspectorCollapsedProp = newProps.inspectorCollapsed;
|
|
1610
|
+
if (inspectorCollapsedPropChanged) {
|
|
1611
|
+
_inspectorCollapsed = newProps.inspectorCollapsed;
|
|
1612
|
+
}
|
|
1404
1613
|
_sidebarCollapsedProp = newProps.sidebarCollapsed;
|
|
1405
1614
|
if (collapsedPropChanged) {
|
|
1406
1615
|
_sidebarCollapsed = newProps.sidebarCollapsed;
|
|
1407
1616
|
}
|
|
1408
1617
|
// Apply the winning prop before accessory/list mutations can trigger resize observers. A prop can match the
|
|
1409
1618
|
// adopted effective state while overriding a newer, unobserved native toggle; that still needs final metrics.
|
|
1410
|
-
shouldRelayout = shouldRelayout || _sidebarItem.collapsed != _sidebarCollapsed;
|
|
1619
|
+
shouldRelayout = shouldRelayout || _sidebarItem.collapsed != _sidebarCollapsed || _inspectorItem.collapsed != _inspectorCollapsed;
|
|
1411
1620
|
[self updateSidebarCollapsed];
|
|
1621
|
+
[self updateInspectorCollapsed];
|
|
1412
1622
|
if (preferredWidthsChanged) {
|
|
1413
1623
|
_needsPreferredDividerPositions = YES;
|
|
1414
1624
|
}
|
|
@@ -1428,18 +1638,13 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1428
1638
|
_appearanceName = nextAppearanceName;
|
|
1429
1639
|
[self applyAppearance];
|
|
1430
1640
|
}
|
|
1431
|
-
#endif
|
|
1432
|
-
|
|
1433
|
-
[super updateProps:props oldProps:oldProps];
|
|
1434
|
-
|
|
1435
|
-
#if TARGET_OS_OSX
|
|
1436
1641
|
_layingOutSplitView = wasLayingOutSplitView;
|
|
1437
1642
|
if (shouldRelayout || shouldRecreateContentTitlebarMaterial || shouldRecreateSidebarTitlebarMaterial) {
|
|
1438
1643
|
[self invalidatePublishedLayout];
|
|
1439
1644
|
[self layoutSplitView];
|
|
1440
1645
|
}
|
|
1441
|
-
#endif
|
|
1442
1646
|
}
|
|
1647
|
+
#endif
|
|
1443
1648
|
|
|
1444
1649
|
- (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics
|
|
1445
1650
|
oldLayoutMetrics:(const LayoutMetrics &)oldLayoutMetrics
|
|
@@ -1512,6 +1717,15 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1512
1717
|
[_sidebarReactView removeFromSuperview];
|
|
1513
1718
|
[_contentReactView removeFromSuperview];
|
|
1514
1719
|
[_listReactView removeFromSuperview];
|
|
1720
|
+
[_inspectorReactView removeFromSuperview];
|
|
1721
|
+
_inspectorReactView = nil;
|
|
1722
|
+
_inspectorReactLayoutMetrics = EmptyLayoutMetrics;
|
|
1723
|
+
_inspectorMinWidth = 220;
|
|
1724
|
+
_inspectorWidth = 0;
|
|
1725
|
+
_hasInspector = NO;
|
|
1726
|
+
_inspectorCollapsed = NO;
|
|
1727
|
+
_inspectorCollapsedProp = NO;
|
|
1728
|
+
_lastInspectorWidth = -1;
|
|
1515
1729
|
_sidebarReactView = nil;
|
|
1516
1730
|
_contentReactView = nil;
|
|
1517
1731
|
_listReactView = nil;
|
|
@@ -1529,6 +1743,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1529
1743
|
_sidebarCollapsedProp = NO;
|
|
1530
1744
|
_needsPreferredDividerPositions = YES;
|
|
1531
1745
|
_layingOutSplitView = NO;
|
|
1746
|
+
_splitViewPropsScheduled = NO;
|
|
1532
1747
|
_lastSidebarWidth = -1;
|
|
1533
1748
|
_lastContentWidth = -1;
|
|
1534
1749
|
_lastListWidth = -1;
|
|
@@ -1546,7 +1761,9 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1546
1761
|
[self removeSidebarTitlebarMaterial];
|
|
1547
1762
|
[self applyAppearance];
|
|
1548
1763
|
[self updateListItem];
|
|
1764
|
+
[self updateInspectorItem];
|
|
1549
1765
|
[self updateSidebarCollapsed];
|
|
1766
|
+
[self updateInspectorCollapsed];
|
|
1550
1767
|
[self updateSplitItemSizing];
|
|
1551
1768
|
#else
|
|
1552
1769
|
for (UIView *subview in _sidebarContainer.subviews) {
|
package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.h
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#import <AppKit/AppKit.h>
|
|
2
|
+
#include <string>
|
|
3
|
+
#include <vector>
|
|
4
|
+
|
|
5
|
+
struct RNSparkSplitPaneSizing {
|
|
6
|
+
std::string id;
|
|
7
|
+
CGFloat initialSize;
|
|
8
|
+
CGFloat minSize;
|
|
9
|
+
CGFloat maxSize;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
@interface RNSparkPaneSplitView : NSSplitView
|
|
13
|
+
@property (nonatomic, copy, nullable) void (^onLayout)(void);
|
|
14
|
+
- (void)configurePanes:(const std::vector<RNSparkSplitPaneSizing> &)panes
|
|
15
|
+
horizontal:(BOOL)horizontal
|
|
16
|
+
dividerStyle:(NSSplitViewDividerStyle)style;
|
|
17
|
+
@end
|