@legendapp/spark 0.0.1-next.4 → 0.0.1-next.5
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/README.md +1 -1
- package/customize.ts +2 -0
- package/html.ts +1 -0
- package/markdown.ts +1 -0
- package/package.json +22 -13
- package/patches/dependencies.json +10 -4
- package/patches/react-native-enriched-html@1.1.1.patch +854 -0
- package/patches/{react-native-enriched-markdown@1.0.2.patch → react-native-enriched-markdown@1.1.1.patch} +2560 -1983
- package/schema.json +104 -0
- package/skills/spark/SKILL.md +56 -0
- package/skills/spark/UPGRADING.md +246 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-ai/src/invocation-command.cjs +11 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/invocation-command.d.cts +2 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/invocations.ts +2 -19
- package/vendor/node_modules/@legendapp/spark-audio/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +4 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/create.js +31 -11
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-ai.cjs +108 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-artifacts.js +315 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-cli.cjs +75 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-github.cjs +133 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-policy.cjs +102 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-provider.cjs +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-worker.cjs +273 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +54 -29
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/enriched-html-pins.js +128 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-patch.cjs +30 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +16 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.d.cts +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/js-runtime.cjs +96 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +152 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +15 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +184 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.d.cts +16 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/package-manager-config.js +41 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/package-manager.js +13 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project-version.js +12 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +40 -9
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +19 -19
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-bootstrap.ps1 +87 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-bootstrap.sh +107 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-downloads.tsv +13 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/sdk-install.js +8 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/upgrade.js +102 -0
- package/vendor/node_modules/@legendapp/spark-cli/package.json +6 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/.claude/skills/spark/SKILL.md +9 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/AGENTS.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/CLAUDE.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/README.md +15 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +46 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/.claude/skills/spark/SKILL.md +9 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/AGENTS.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/CLAUDE.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/README.md +15 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +45 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/.claude/skills/spark/SKILL.md +9 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/AGENTS.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/CLAUDE.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/README.md +15 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +46 -2
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-codex/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-commands/package.json +6 -6
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/RNDesktopApp.mm +14 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/customize-hooks.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/customize.ts +117 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +20 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.d.cts +14 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/customize-provider.cjs +16 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/customize.cjs +16 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-desktop-config/schema.json +104 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/SparkCustomize.mm +517 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/RNDesktopShortcuts.mm +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/keyboard-manager/RNKeyboardManager.h +3 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/keyboard-manager/RNKeyboardManager.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +5 -4
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +62 -25
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +7 -5
- package/vendor/node_modules/@legendapp/spark-documents/package.json +8 -8
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-file-system/macos/SparkFileMutations.h +1 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/SparkFileMutations.mm +11 -10
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-html/package.json +24 -0
- package/vendor/node_modules/@legendapp/spark-html/src/Html.tsx +22 -0
- package/vendor/node_modules/@legendapp/spark-html/src/HtmlInput.tsx +102 -0
- package/vendor/node_modules/@legendapp/spark-html/src/index.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-html/src/types.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +24 -0
- package/vendor/node_modules/@legendapp/spark-markdown/src/Markdown.tsx +24 -0
- package/vendor/node_modules/@legendapp/spark-markdown/src/MarkdownInput.tsx +111 -0
- package/vendor/node_modules/@legendapp/spark-markdown/src/index.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-processes/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +18 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/components.tsx +52 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/index.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/types.ts +24 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/useInputShortcuts.macos.ts +55 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/useInputShortcuts.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/useInputValue.ts +14 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/value.ts +16 -0
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-system/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-tray/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +102 -14
- package/vendor/node_modules/@legendapp/spark-ui/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +5 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +12 -4
- package/vendor/node_modules/@legendapp/spark-updates/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
|
@@ -239,8 +239,17 @@ static void RNSidebarSplitViewApplyColorOverlay(NSView *view, NSColor *color, CG
|
|
|
239
239
|
|
|
240
240
|
- (void)drawDividerInRect:(NSRect)rect
|
|
241
241
|
{
|
|
242
|
+
// AppKit hands a sidebar's divider a 0.5pt hairline rect but still reserves the full dividerThickness. The
|
|
243
|
+
// other half of the gap is left to the split view's own backing, which shows as a bright column in dark mode.
|
|
244
|
+
// Paint the whole gap, then the hairline.
|
|
245
|
+
NSRect gap = rect;
|
|
246
|
+
if (self.vertical) {
|
|
247
|
+
gap.size.width = MAX(rect.size.width, self.dividerThickness);
|
|
248
|
+
} else {
|
|
249
|
+
gap.size.height = MAX(rect.size.height, self.dividerThickness);
|
|
250
|
+
}
|
|
242
251
|
[NSColor.windowBackgroundColor setFill];
|
|
243
|
-
NSRectFill(
|
|
252
|
+
NSRectFill(gap);
|
|
244
253
|
[self.dividerColor setFill];
|
|
245
254
|
NSRectFillUsingOperation(rect, NSCompositingOperationSourceOver);
|
|
246
255
|
}
|
|
@@ -272,6 +281,19 @@ static void RNSidebarSplitViewApplyColorOverlay(NSView *view, NSColor *color, CG
|
|
|
272
281
|
|
|
273
282
|
static char RNSidebarSplitViewStartupKey;
|
|
274
283
|
|
|
284
|
+
// NSSplitViewController answers a divider double-click by snapping the pane beside it to its minimum or maximum
|
|
285
|
+
// thickness (the shouldCollapse...forDoubleClick delegate is deprecated and never called). The snap bypasses the
|
|
286
|
+
// layout flow React panes follow, and a sidebar here collapses only through the explicit toggle, so swallow it.
|
|
287
|
+
// Dragging a divider is unaffected.
|
|
288
|
+
@interface RNSidebarSplitViewController : NSSplitViewController
|
|
289
|
+
@end
|
|
290
|
+
|
|
291
|
+
@implementation RNSidebarSplitViewController
|
|
292
|
+
- (void)splitView:(NSSplitView *)splitView doubleClickedOnDividerAtIndex:(NSInteger)dividerIndex
|
|
293
|
+
{
|
|
294
|
+
}
|
|
295
|
+
@end
|
|
296
|
+
|
|
275
297
|
// Startup must stay entirely in AppKit: constructing a Fabric view here would
|
|
276
298
|
// read React feature flags before RCTReactNativeFactory configures them.
|
|
277
299
|
@interface RNSidebarSplitViewStartupView : NSView
|
|
@@ -325,7 +347,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
325
347
|
sidebarItem.allowsFullHeightLayout = YES;
|
|
326
348
|
contentItem.allowsFullHeightLayout = YES;
|
|
327
349
|
|
|
328
|
-
_controller = [
|
|
350
|
+
_controller = [RNSidebarSplitViewController new];
|
|
329
351
|
_controller.minimumThicknessForInlineSidebars = 0;
|
|
330
352
|
_controller.splitView.vertical = YES;
|
|
331
353
|
_controller.splitView.dividerStyle = NSSplitViewDividerStyleThin;
|
|
@@ -444,7 +466,12 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
444
466
|
CGFloat _listMinWidth;
|
|
445
467
|
CGFloat _listWidth;
|
|
446
468
|
BOOL _hasList;
|
|
469
|
+
// Effective collapsed state, which React knows. Follows the prop when the prop changes and the sidebar item when
|
|
470
|
+
// AppKit collapses it (toggleSidebar:, the toolbar button, ...); the latter is reported via onSidebarCollapsedChange.
|
|
447
471
|
BOOL _sidebarCollapsed;
|
|
472
|
+
// The last sidebarCollapsed prop. Only a change of the prop overrides the effective state, so a stale prop never
|
|
473
|
+
// undoes a native toggle.
|
|
474
|
+
BOOL _sidebarCollapsedProp;
|
|
448
475
|
// Preferred widths seed the dividers once; afterwards the user's drag owns them.
|
|
449
476
|
BOOL _needsPreferredDividerPositions;
|
|
450
477
|
// Our own layout pass resizes subviews several times; only its final state is published.
|
|
@@ -489,6 +516,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
489
516
|
_listWidth = 0;
|
|
490
517
|
_hasList = NO;
|
|
491
518
|
_sidebarCollapsed = NO;
|
|
519
|
+
_sidebarCollapsedProp = NO;
|
|
492
520
|
_needsPreferredDividerPositions = YES;
|
|
493
521
|
_layingOutSplitView = NO;
|
|
494
522
|
_lastSidebarWidth = -1;
|
|
@@ -541,7 +569,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
541
569
|
_listItem.allowsFullHeightLayout = YES;
|
|
542
570
|
}
|
|
543
571
|
|
|
544
|
-
_splitViewController = [
|
|
572
|
+
_splitViewController = [RNSidebarSplitViewController new];
|
|
545
573
|
_splitViewController.splitView = [RNSidebarSplitViewNativeSplitView new];
|
|
546
574
|
_splitViewController.minimumThicknessForInlineSidebars = 0;
|
|
547
575
|
_splitViewController.splitView.vertical = YES;
|
|
@@ -620,6 +648,8 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
620
648
|
return MAX(0, MIN(MAX(_listItem.minimumThickness, preferredListWidth), maxListWidth));
|
|
621
649
|
}
|
|
622
650
|
|
|
651
|
+
/// Pushes the effective collapsed state to AppKit. Only updateProps and recycling call this: layout passes must
|
|
652
|
+
/// adopt the native state instead, or a stale prop would re-expand a sidebar AppKit just collapsed.
|
|
623
653
|
- (void)updateSidebarCollapsed
|
|
624
654
|
{
|
|
625
655
|
if (_sidebarItem.collapsed != _sidebarCollapsed) {
|
|
@@ -627,6 +657,35 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
627
657
|
}
|
|
628
658
|
}
|
|
629
659
|
|
|
660
|
+
/// Adopts a collapse or expand AppKit performed itself and tells React. Idempotent, so every layout and resize
|
|
661
|
+
/// notification can call it: AppKit posts NSSplitViewDidResizeSubviewsNotification as soon as the sidebar item's
|
|
662
|
+
/// state flips and then once per animation step, and only the first call sees a difference.
|
|
663
|
+
- (void)adoptNativeSidebarCollapsed
|
|
664
|
+
{
|
|
665
|
+
BOOL collapsed = _sidebarItem.collapsed;
|
|
666
|
+
if (collapsed == _sidebarCollapsed) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
_sidebarCollapsed = collapsed;
|
|
670
|
+
const auto eventEmitter = std::static_pointer_cast<const SidebarSplitViewEventEmitter>(_eventEmitter);
|
|
671
|
+
if (eventEmitter) {
|
|
672
|
+
eventEmitter->onSidebarCollapsedChange(SidebarSplitViewEventEmitter::OnSidebarCollapsedChange{
|
|
673
|
+
.collapsed = static_cast<bool>(collapsed),
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/// A collapsed item keeps its container at the width it had (the container is only hidden), so the item, not the
|
|
679
|
+
/// container, says whether the sidebar pane is open.
|
|
680
|
+
- (CGRect)sidebarPaneBounds
|
|
681
|
+
{
|
|
682
|
+
CGRect bounds = _sidebarContainer.bounds;
|
|
683
|
+
if (_sidebarItem.collapsed) {
|
|
684
|
+
bounds.size.width = 0;
|
|
685
|
+
}
|
|
686
|
+
return bounds;
|
|
687
|
+
}
|
|
688
|
+
|
|
630
689
|
- (void)applyAppearance
|
|
631
690
|
{
|
|
632
691
|
NSAppearance *appearance = RNSidebarSplitViewAppearanceForName(_appearanceName);
|
|
@@ -774,7 +833,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
774
833
|
|
|
775
834
|
- (void)syncReactSubviewFrames
|
|
776
835
|
{
|
|
777
|
-
CGRect sidebarBounds =
|
|
836
|
+
CGRect sidebarBounds = [self sidebarPaneBounds];
|
|
778
837
|
CGRect contentBounds = _contentContainer.bounds;
|
|
779
838
|
|
|
780
839
|
[self syncReactSubview:_sidebarReactView
|
|
@@ -931,7 +990,8 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
931
990
|
|
|
932
991
|
- (void)publishSplitViewLayoutAllowEstimatedReady:(BOOL)allowEstimatedReady
|
|
933
992
|
{
|
|
934
|
-
|
|
993
|
+
[self adoptNativeSidebarCollapsed];
|
|
994
|
+
CGFloat sidebarWidth = [self sidebarPaneBounds].size.width;
|
|
935
995
|
CGFloat contentWidth = _contentContainer.bounds.size.width;
|
|
936
996
|
CGFloat contentX = [_contentContainer convertRect:_contentContainer.bounds toView:self].origin.x;
|
|
937
997
|
CGFloat sidebarHeight = _sidebarContainer.bounds.size.height;
|
|
@@ -941,14 +1001,21 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
941
1001
|
CGFloat height = MAX(sidebarHeight, contentHeight);
|
|
942
1002
|
CGRect bounds = [self currentLayoutBounds];
|
|
943
1003
|
|
|
944
|
-
if (contentWidth <= 0 || height <= 0 ||
|
|
945
|
-
contentX < -0.5 ||
|
|
946
|
-
contentX + contentWidth > bounds.size.width + 0.5 ||
|
|
947
|
-
fabs(_contentContainer.bounds.size.height - bounds.size.height) >= 0.5 ||
|
|
948
|
-
(_hasList && listWidth <= 0)) {
|
|
1004
|
+
if (contentWidth <= 0 || height <= 0 || (_hasList && listWidth <= 0)) {
|
|
949
1005
|
[self applyEstimatedSplitViewLayoutForBounds:bounds layoutReady:allowEstimatedReady];
|
|
950
1006
|
return;
|
|
951
1007
|
}
|
|
1008
|
+
// AppKit may publish an animation target origin before its size catches up. Keep its owned frames;
|
|
1009
|
+
// estimating here would overwrite dragged widths and interrupt the native transition.
|
|
1010
|
+
if (contentX < -0.5 ||
|
|
1011
|
+
contentX + contentWidth > bounds.size.width + 0.5 ||
|
|
1012
|
+
fabs(_contentContainer.bounds.size.height - bounds.size.height) >= 0.5) {
|
|
1013
|
+
if (!allowEstimatedReady) {
|
|
1014
|
+
// Expansion may send only this target-frame notification; request a layout to publish settled metrics.
|
|
1015
|
+
[self setNeedsLayout:YES];
|
|
1016
|
+
}
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
952
1019
|
|
|
953
1020
|
[self syncReactSubviewFrames];
|
|
954
1021
|
[self layoutContentTitlebarMaterial];
|
|
@@ -1034,7 +1101,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1034
1101
|
_splitViewController.splitView.frame = bounds;
|
|
1035
1102
|
[self updateSplitItemSizing];
|
|
1036
1103
|
[self updateListItem];
|
|
1037
|
-
[self
|
|
1104
|
+
[self adoptNativeSidebarCollapsed];
|
|
1038
1105
|
if (_contentContainer.bounds.size.width <= 0 ||
|
|
1039
1106
|
_contentContainer.bounds.size.height <= 0 ||
|
|
1040
1107
|
fabs(_contentContainer.bounds.size.height - bounds.size.height) >= 0.5) {
|
|
@@ -1071,7 +1138,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1071
1138
|
[self applyEstimatedSplitViewLayoutForBounds:[self currentLayoutBounds] layoutReady:NO];
|
|
1072
1139
|
} else {
|
|
1073
1140
|
[self syncReactSubview:_sidebarReactView
|
|
1074
|
-
nativeBounds:
|
|
1141
|
+
nativeBounds:[self sidebarPaneBounds]
|
|
1075
1142
|
previousLayoutMetrics:&_sidebarReactLayoutMetrics];
|
|
1076
1143
|
}
|
|
1077
1144
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
@@ -1167,15 +1234,27 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1167
1234
|
const auto &newProps = *std::static_pointer_cast<SidebarSplitViewProps const>(props);
|
|
1168
1235
|
|
|
1169
1236
|
#if TARGET_OS_OSX
|
|
1237
|
+
// Collapse and accessory mutations can synchronously resize AppKit before list membership and sizing settle.
|
|
1238
|
+
// Publish only after this prop transaction has completed, preserving any enclosing layout's guard.
|
|
1239
|
+
BOOL wasLayingOutSplitView = _layingOutSplitView;
|
|
1240
|
+
_layingOutSplitView = YES;
|
|
1170
1241
|
NSString *nextAppearanceName = [NSString stringWithUTF8String:newProps.appearance.c_str()];
|
|
1171
1242
|
if (nextAppearanceName.length == 0) {
|
|
1172
1243
|
nextAppearanceName = @"system";
|
|
1173
1244
|
}
|
|
1245
|
+
// A changed prop is the last writer and wins over a native toggle React has not heard about yet (no event is
|
|
1246
|
+
// sent for it: the app just set a newer value). An unchanged prop never overrides the native state.
|
|
1247
|
+
BOOL collapsedPropChanged = _sidebarCollapsedProp != newProps.sidebarCollapsed;
|
|
1248
|
+
if (!collapsedPropChanged) {
|
|
1249
|
+
[self adoptNativeSidebarCollapsed];
|
|
1250
|
+
}
|
|
1251
|
+
// Echoing an adopted native state acknowledges it; it must not reseed user-dragged dividers.
|
|
1252
|
+
BOOL effectiveCollapsedChanged = collapsedPropChanged && _sidebarCollapsed != newProps.sidebarCollapsed;
|
|
1174
1253
|
BOOL preferredWidthsChanged =
|
|
1175
1254
|
fabs(_sidebarWidth - newProps.sidebarWidth) >= 0.5 ||
|
|
1176
1255
|
fabs(_listWidth - newProps.listWidth) >= 0.5 ||
|
|
1177
1256
|
_hasList != newProps.hasList ||
|
|
1178
|
-
|
|
1257
|
+
effectiveCollapsedChanged;
|
|
1179
1258
|
BOOL shouldRelayout =
|
|
1180
1259
|
preferredWidthsChanged ||
|
|
1181
1260
|
fabs(_sidebarMinWidth - newProps.sidebarMinWidth) >= 0.5 ||
|
|
@@ -1213,7 +1292,14 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1213
1292
|
_listMinWidth = newProps.listMinWidth;
|
|
1214
1293
|
_listWidth = newProps.listWidth;
|
|
1215
1294
|
_hasList = newProps.hasList;
|
|
1216
|
-
|
|
1295
|
+
_sidebarCollapsedProp = newProps.sidebarCollapsed;
|
|
1296
|
+
if (collapsedPropChanged) {
|
|
1297
|
+
_sidebarCollapsed = newProps.sidebarCollapsed;
|
|
1298
|
+
}
|
|
1299
|
+
// Apply the winning prop before accessory/list mutations can trigger resize observers. A prop can match the
|
|
1300
|
+
// adopted effective state while overriding a newer, unobserved native toggle; that still needs final metrics.
|
|
1301
|
+
shouldRelayout = shouldRelayout || _sidebarItem.collapsed != _sidebarCollapsed;
|
|
1302
|
+
[self updateSidebarCollapsed];
|
|
1217
1303
|
if (preferredWidthsChanged) {
|
|
1218
1304
|
_needsPreferredDividerPositions = YES;
|
|
1219
1305
|
}
|
|
@@ -1238,6 +1324,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1238
1324
|
[super updateProps:props oldProps:oldProps];
|
|
1239
1325
|
|
|
1240
1326
|
#if TARGET_OS_OSX
|
|
1327
|
+
_layingOutSplitView = wasLayingOutSplitView;
|
|
1241
1328
|
if (shouldRelayout || shouldRecreateContentTitlebarMaterial || shouldRecreateSidebarTitlebarMaterial) {
|
|
1242
1329
|
_lastSidebarWidth = -1;
|
|
1243
1330
|
_lastContentWidth = -1;
|
|
@@ -1328,6 +1415,7 @@ static char RNSidebarSplitViewStartupKey;
|
|
|
1328
1415
|
_listWidth = 0;
|
|
1329
1416
|
_hasList = NO;
|
|
1330
1417
|
_sidebarCollapsed = NO;
|
|
1418
|
+
_sidebarCollapsedProp = NO;
|
|
1331
1419
|
_needsPreferredDividerPositions = YES;
|
|
1332
1420
|
_layingOutSplitView = NO;
|
|
1333
1421
|
_lastSidebarWidth = -1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-ui",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"react-native": "src/index",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"uniwind.web.ts"
|
|
15
15
|
],
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"react": "19.1.
|
|
17
|
+
"react": "^19.1.0",
|
|
18
18
|
"react-native": "0.81.6",
|
|
19
19
|
"@expo/ui": "0.2.0-beta.9",
|
|
20
20
|
"uniwind": "^1.6.3",
|
|
@@ -69,6 +69,6 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"clsx": "^2.1.1",
|
|
71
71
|
"tailwind-merge": "^3.4.0",
|
|
72
|
-
"@legendapp/spark-desktop-app": "0.0.1-next.
|
|
72
|
+
"@legendapp/spark-desktop-app": "0.0.1-next.5"
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -16,6 +16,10 @@ export type SidebarSplitViewResizeEvent = Readonly<{
|
|
|
16
16
|
sidebarWidth: Double;
|
|
17
17
|
}>;
|
|
18
18
|
|
|
19
|
+
export type SidebarSplitViewCollapsedChangeEvent = Readonly<{
|
|
20
|
+
collapsed: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
|
|
19
23
|
export interface NativeProps extends ViewProps {
|
|
20
24
|
appearance?: string;
|
|
21
25
|
contentTitlebarHeight?: Double;
|
|
@@ -26,6 +30,7 @@ export interface NativeProps extends ViewProps {
|
|
|
26
30
|
hasList?: boolean;
|
|
27
31
|
listMinWidth?: Double;
|
|
28
32
|
listWidth?: Double;
|
|
33
|
+
onSidebarCollapsedChange?: DirectEventHandler<SidebarSplitViewCollapsedChangeEvent>;
|
|
29
34
|
onSplitViewDidResize?: DirectEventHandler<SidebarSplitViewResizeEvent>;
|
|
30
35
|
sidebarCollapsed?: boolean;
|
|
31
36
|
sidebarMinWidth?: Double;
|
|
@@ -30,6 +30,8 @@ export interface SidebarSplitViewProps extends Omit<SpecializedViewProps, "child
|
|
|
30
30
|
initialPaneMetrics?: SidebarSplitViewPaneMetrics;
|
|
31
31
|
titleBar?: SplitViewTitleBarOptions;
|
|
32
32
|
onResize?: (event: SidebarSplitViewResizeEvent) => void;
|
|
33
|
+
/** Fires when AppKit collapses or expands the sidebar itself (View > Hide Sidebar, the toolbar button). Not called for `sidebarCollapsed` changes. */
|
|
34
|
+
onSidebarCollapsedChange?: (collapsed: boolean) => void;
|
|
33
35
|
}
|
|
34
36
|
export function getSplitViewAvailability() { return macosViewAvailability("SidebarSplitView"); }
|
|
35
37
|
function metrics(value: SidebarSplitViewPaneMetrics) {
|
|
@@ -48,7 +50,7 @@ function overlay(value?: SplitViewTitleBarOverlay) {
|
|
|
48
50
|
if (typeof value.color !== "string" || !/^#(?:[\da-f]{6}|[\da-f]{8})$/i.test(value.color)) throw new SparkError("E_INVALID_ARGUMENT", "Expected #RRGGBB or #RRGGBBAA title-bar color");
|
|
49
51
|
if (value.opacity !== undefined) finite(value.opacity, "overlay opacity", 0, 1);
|
|
50
52
|
}
|
|
51
|
-
export function SidebarSplitView({ sidebar, content, list, children, appearance: theme = "system", contentMinWidth = 320, sidebarMinWidth = 180, sidebarWidth, listMinWidth = 240, listWidth, sidebarCollapsed = false, initialPaneMetrics, titleBar = {}, onResize, ref, onError, ...props }: SidebarSplitViewProps) {
|
|
53
|
+
export function SidebarSplitView({ sidebar, content, list, children, appearance: theme = "system", contentMinWidth = 320, sidebarMinWidth = 180, sidebarWidth, listMinWidth = 240, listWidth, sidebarCollapsed = false, initialPaneMetrics, titleBar = {}, onResize, onSidebarCollapsedChange, ref, onError, ...props }: SidebarSplitViewProps) {
|
|
52
54
|
appearance(theme); finite(contentMinWidth, "minimum content width"); finite(sidebarMinWidth, "minimum sidebar width"); finite(listMinWidth, "minimum list width");
|
|
53
55
|
if (sidebarWidth !== undefined) finite(sidebarWidth, "sidebar width", sidebarMinWidth);
|
|
54
56
|
if (listWidth !== undefined) finite(listWidth, "list width", listMinWidth);
|
|
@@ -61,7 +63,7 @@ export function SidebarSplitView({ sidebar, content, list, children, appearance:
|
|
|
61
63
|
overlay(titleBar.content?.overlay); overlay(titleBar.sidebar?.overlay);
|
|
62
64
|
const material = titleBar.content?.material ?? "none";
|
|
63
65
|
if (!["none", "glass", "titlebar", "headerView", "hudWindow", "sidebar", "windowBackground"].includes(material)) throw new SparkError("E_INVALID_ARGUMENT", "Invalid title-bar material");
|
|
64
|
-
callback(onResize, "resize");
|
|
66
|
+
callback(onResize, "resize"); callback(onSidebarCollapsedChange, "sidebar collapsed change");
|
|
65
67
|
const control = useControl({ ref, onError }, getSplitViewAvailability());
|
|
66
68
|
const [paneMetrics, setPaneMetrics] = useState<SidebarSplitViewPaneMetrics | undefined>(() => initialPaneMetrics ? { ...initialPaneMetrics } : undefined);
|
|
67
69
|
function resize(event: NativeSyntheticEvent<SidebarSplitViewPaneMetrics & { contentX: number; listX: number; height: number; isLayoutReady: boolean }>) {
|
|
@@ -75,11 +77,17 @@ export function SidebarSplitView({ sidebar, content, list, children, appearance:
|
|
|
75
77
|
setPaneMetrics(current => current && paneKeys.every(key => current[key] === value[key]) ? current : value);
|
|
76
78
|
onResize?.(value);
|
|
77
79
|
}
|
|
80
|
+
function collapsedChange(event: NativeSyntheticEvent<{ collapsed: boolean }>) {
|
|
81
|
+
if (!control.active()) return;
|
|
82
|
+
const collapsed = event?.nativeEvent?.collapsed;
|
|
83
|
+
if (typeof collapsed !== "boolean") { control.error(new SparkError("E_INVALID_DATA", "Invalid sidebar collapsed state")); return; }
|
|
84
|
+
onSidebarCollapsedChange?.(collapsed);
|
|
85
|
+
}
|
|
78
86
|
if (control.failed) return <View {...props} ref={control.ref} style={[{ flexDirection: "row" }, props.style]}>{sidebarCollapsed ? null : sidebar}{list}{content}</View>;
|
|
79
|
-
return <NativeSplitView {...props} ref={control.ref} appearance={theme} contentMinWidth={contentMinWidth} sidebarMinWidth={sidebarMinWidth} sidebarWidth={sidebarWidth} hasList={hasList} listMinWidth={listMinWidth} listWidth={listWidth} sidebarCollapsed={sidebarCollapsed} onSplitViewDidResize={resize}
|
|
87
|
+
return <NativeSplitView {...props} ref={control.ref} appearance={theme} contentMinWidth={contentMinWidth} sidebarMinWidth={sidebarMinWidth} sidebarWidth={sidebarWidth} hasList={hasList} listMinWidth={listMinWidth} listWidth={listWidth} sidebarCollapsed={sidebarCollapsed} onSplitViewDidResize={resize} onSidebarCollapsedChange={collapsedChange}
|
|
80
88
|
contentTitlebarHeight={titleBar.content?.height ?? 0} contentTitlebarMaterial={material} contentTitlebarOverlayColor={titleBar.content?.overlay?.color} contentTitlebarOverlayOpacity={titleBar.content?.overlay?.opacity ?? (titleBar.content?.overlay ? 1 : 0)}
|
|
81
89
|
sidebarTitlebarOverlayColor={titleBar.sidebar?.overlay?.color} sidebarTitlebarOverlayOpacity={titleBar.sidebar?.overlay?.opacity ?? (titleBar.sidebar?.overlay ? 1 : 0)}>
|
|
82
|
-
<View key="sidebar" style={{ position: "absolute", top: 0, left: 0, minWidth: 0, height: paneMetrics?.sidebarHeight, width: sidebarCollapsed ? 0 :
|
|
90
|
+
<View key="sidebar" style={{ position: "absolute", top: 0, left: 0, minWidth: 0, height: paneMetrics?.sidebarHeight, width: paneMetrics?.sidebarWidth ?? (sidebarCollapsed ? 0 : sidebarWidth ?? sidebarMinWidth) }}>{sidebar}</View>
|
|
83
91
|
<View key="content" style={{ position: "absolute", top: 0, left: 0, minWidth: 0, overflow: "hidden", height: paneMetrics?.contentHeight, width: paneMetrics?.contentWidth }}>{content}</View>
|
|
84
92
|
{hasList ? <View key="list" style={{ position: "absolute", top: 0, left: 0, minWidth: 0, height: paneMetrics?.listHeight, width: paneMetrics?.listWidth ?? listWidth ?? listMinWidth }}>{list}</View> : null}
|
|
85
93
|
</NativeSplitView>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-updates",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"Sparkle.podspec.json"
|
|
12
12
|
],
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"react": "19.1.
|
|
14
|
+
"react": "^19.1.0",
|
|
15
15
|
"react-native": "0.81.6"
|
|
16
16
|
},
|
|
17
17
|
"codegenConfig": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
]
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@legendapp/spark-desktop-app": "0.0.1-next.
|
|
41
|
+
"@legendapp/spark-desktop-app": "0.0.1-next.5"
|
|
42
42
|
},
|
|
43
43
|
"private": true
|
|
44
44
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-webview",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"react-native-webview": "16.0.0",
|
|
12
|
-
"@legendapp/spark-desktop-app": "0.0.1-next.
|
|
12
|
+
"@legendapp/spark-desktop-app": "0.0.1-next.5"
|
|
13
13
|
},
|
|
14
14
|
"private": true
|
|
15
15
|
}
|