node-mac-recorder 2.4.14 → 2.5.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.4.14",
3
+ "version": "2.5.1",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -57,10 +57,7 @@ bool hideScreenRecordingPreview();
57
57
  self = [super initWithFrame:frameRect];
58
58
  if (self) {
59
59
  self.wantsLayer = YES;
60
- self.layer.backgroundColor = [[NSColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:0.45] CGColor];
61
- self.layer.borderColor = [[NSColor colorWithRed:0.0 green:0.4 blue:0.8 alpha:0.9] CGColor];
62
- self.layer.borderWidth = 5.0;
63
- self.layer.cornerRadius = 8.0;
60
+ self.layer.backgroundColor = [[NSColor clearColor] CGColor];
64
61
  }
65
62
  return self;
66
63
  }
@@ -71,33 +68,16 @@ bool hideScreenRecordingPreview();
71
68
  if (!self.windowInfo) return;
72
69
 
73
70
  // Background with transparency
74
- [[NSColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:0.45] setFill];
75
- NSRectFill(dirtyRect);
71
+ [[NSColor colorWithRed:0.2 green:0.6 blue:1.0 alpha:0.3] setFill];
72
+ NSRectFill(self.bounds);
76
73
 
77
- // Border
78
- [[NSColor colorWithRed:0.0 green:0.4 blue:0.8 alpha:0.9] setStroke];
79
- NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:self.bounds xRadius:8 yRadius:8];
80
- [border setLineWidth:3.0];
74
+ // Modern border with rounded corners
75
+ [[NSColor colorWithRed:0.2 green:0.6 blue:1.0 alpha:0.8] setStroke];
76
+ NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds, 2, 2) xRadius:12 yRadius:12];
77
+ [border setLineWidth:4.0];
81
78
  [border stroke];
82
79
 
83
- // Window info text
84
- NSString *windowTitle = [self.windowInfo objectForKey:@"title"] ?: @"Unknown Window";
85
- NSString *appName = [self.windowInfo objectForKey:@"appName"] ?: @"Unknown App";
86
- NSString *infoText = [NSString stringWithFormat:@"%@\n%@", appName, windowTitle];
87
-
88
- NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
89
- [style setAlignment:NSTextAlignmentCenter];
90
-
91
- NSDictionary *attributes = @{
92
- NSFontAttributeName: [NSFont systemFontOfSize:21 weight:NSFontWeightMedium],
93
- NSForegroundColorAttributeName: [NSColor whiteColor],
94
- NSParagraphStyleAttributeName: style,
95
- NSStrokeColorAttributeName: [NSColor blackColor],
96
- NSStrokeWidthAttributeName: @(-2.0)
97
- };
98
-
99
- NSRect textRect = NSMakeRect(10, self.bounds.size.height - 90, self.bounds.size.width - 20, 80);
100
- [infoText drawInRect:textRect withAttributes:attributes];
80
+ // Text will be handled by separate label above button
101
81
  }
102
82
 
103
83
  @end
@@ -165,10 +145,7 @@ bool hideScreenRecordingPreview();
165
145
  self = [super initWithFrame:frameRect];
166
146
  if (self) {
167
147
  self.wantsLayer = YES;
168
- self.layer.backgroundColor = [[NSColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:0.45] CGColor];
169
- self.layer.borderColor = [[NSColor colorWithRed:0.0 green:0.4 blue:0.8 alpha:0.9] CGColor];
170
- self.layer.borderWidth = 5.0;
171
- self.layer.cornerRadius = 8.0;
148
+ self.layer.backgroundColor = [[NSColor clearColor] CGColor];
172
149
  }
173
150
  return self;
174
151
  }
@@ -179,33 +156,16 @@ bool hideScreenRecordingPreview();
179
156
  if (!self.screenInfo) return;
180
157
 
181
158
  // Background with transparency
182
- [[NSColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:0.45] setFill];
183
- NSRectFill(dirtyRect);
159
+ [[NSColor colorWithRed:0.2 green:0.6 blue:1.0 alpha:0.25] setFill];
160
+ NSRectFill(self.bounds);
184
161
 
185
- // Border
186
- [[NSColor colorWithRed:0.0 green:0.4 blue:0.8 alpha:0.9] setStroke];
187
- NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:self.bounds xRadius:8 yRadius:8];
188
- [border setLineWidth:3.0];
162
+ // Modern border with rounded corners
163
+ [[NSColor colorWithRed:0.2 green:0.6 blue:1.0 alpha:0.7] setStroke];
164
+ NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds, 3, 3) xRadius:15 yRadius:15];
165
+ [border setLineWidth:6.0];
189
166
  [border stroke];
190
167
 
191
- // Screen info text
192
- NSString *screenName = [self.screenInfo objectForKey:@"name"] ?: @"Unknown Screen";
193
- NSString *resolution = [self.screenInfo objectForKey:@"resolution"] ?: @"Unknown Resolution";
194
- NSString *infoText = [NSString stringWithFormat:@"%@\n%@", screenName, resolution];
195
-
196
- NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
197
- [style setAlignment:NSTextAlignmentCenter];
198
-
199
- NSDictionary *attributes = @{
200
- NSFontAttributeName: [NSFont systemFontOfSize:21 weight:NSFontWeightMedium],
201
- NSForegroundColorAttributeName: [NSColor whiteColor],
202
- NSParagraphStyleAttributeName: style,
203
- NSStrokeColorAttributeName: [NSColor blackColor],
204
- NSStrokeWidthAttributeName: @(-2.0)
205
- };
206
-
207
- NSRect textRect = NSMakeRect(10, self.bounds.size.height - 90, self.bounds.size.width - 20, 80);
208
- [infoText drawInRect:textRect withAttributes:attributes];
168
+ // Text will be handled by separate label above button
209
169
  }
210
170
 
211
171
  @end
@@ -526,15 +486,56 @@ void updateOverlay() {
526
486
  [(WindowSelectorOverlayView *)g_overlayView setWindowInfo:windowUnderCursor];
527
487
  [g_overlayView setNeedsDisplay:YES];
528
488
 
489
+ // Add/update info label above button
490
+ NSTextField *infoLabel = nil;
491
+ for (NSView *subview in [g_overlayWindow.contentView subviews]) {
492
+ if ([subview isKindOfClass:[NSTextField class]]) {
493
+ infoLabel = (NSTextField*)subview;
494
+ break;
495
+ }
496
+ }
497
+
498
+ if (!infoLabel) {
499
+ infoLabel = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, width - 40, 60)];
500
+ [infoLabel setEditable:NO];
501
+ [infoLabel setSelectable:NO];
502
+ [infoLabel setBezeled:NO];
503
+ [infoLabel setDrawsBackground:NO];
504
+ [infoLabel setAlignment:NSTextAlignmentCenter];
505
+ [infoLabel setFont:[NSFont systemFontOfSize:18 weight:NSFontWeightMedium]];
506
+ [infoLabel setTextColor:[NSColor whiteColor]];
507
+ [infoLabel setWantsLayer:YES];
508
+
509
+ // Add shadow for better visibility
510
+ [infoLabel.layer setShadowColor:[[NSColor blackColor] CGColor]];
511
+ [infoLabel.layer setShadowOffset:NSMakeSize(0, -1)];
512
+ [infoLabel.layer setShadowRadius:3.0];
513
+ [infoLabel.layer setShadowOpacity:0.8];
514
+
515
+ [g_overlayWindow.contentView addSubview:infoLabel];
516
+ }
517
+
518
+ // Update label text
519
+ NSString *labelWindowTitle = [windowUnderCursor objectForKey:@"title"] ?: @"Unknown Window";
520
+ NSString *labelAppName = [windowUnderCursor objectForKey:@"appName"] ?: @"Unknown App";
521
+ [infoLabel setStringValue:[NSString stringWithFormat:@"%@\n%@", labelAppName, labelWindowTitle]];
522
+
529
523
  // Position buttons - Start Record in center, Cancel below it
530
524
  if (g_selectButton) {
531
525
  NSSize buttonSize = [g_selectButton frame].size;
532
526
  NSPoint buttonCenter = NSMakePoint(
533
527
  (width - buttonSize.width) / 2,
534
- (height - buttonSize.height) / 2 + 30 // Slightly above center
528
+ (height - buttonSize.height) / 2 + 15 // Slightly above center
535
529
  );
536
530
  [g_selectButton setFrameOrigin:buttonCenter];
537
531
 
532
+ // Position info label above button
533
+ NSPoint labelCenter = NSMakePoint(
534
+ 20,
535
+ buttonCenter.y + buttonSize.height + 10 // 10px above button
536
+ );
537
+ [infoLabel setFrameOrigin:labelCenter];
538
+
538
539
  // Position cancel button below the main button
539
540
  NSButton *cancelButton = nil;
540
541
  for (NSView *subview in [g_overlayWindow.contentView subviews]) {
@@ -780,13 +781,14 @@ bool startScreenSelection() {
780
781
  [selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightSemibold]];
781
782
  [selectButton setTag:i]; // Set screen index as tag
782
783
 
783
- // Blue background with white text
784
+ // Modern button styling with gradient-like effect
784
785
  [selectButton setWantsLayer:YES];
785
- [selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.2 green:0.6 blue:1.0 alpha:0.95] CGColor]];
786
- [selectButton.layer setCornerRadius:12.0];
786
+ [selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.1 green:0.5 blue:0.9 alpha:0.95] CGColor]];
787
+ [selectButton.layer setCornerRadius:14.0];
787
788
  [selectButton.layer setBorderWidth:0.0];
788
789
 
789
- // White text color
790
+ // White text color with better font weight
791
+ [selectButton setFont:[NSFont systemFontOfSize:17 weight:NSFontWeightSemibold]];
790
792
  NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc]
791
793
  initWithString:[selectButton title]];
792
794
  [titleString addAttribute:NSForegroundColorAttributeName
@@ -794,11 +796,19 @@ bool startScreenSelection() {
794
796
  range:NSMakeRange(0, [titleString length])];
795
797
  [selectButton setAttributedTitle:titleString];
796
798
 
797
- // Add shadow for better visibility
798
- [selectButton.layer setShadowColor:[[NSColor blackColor] CGColor]];
799
- [selectButton.layer setShadowOffset:NSMakeSize(0, -2)];
800
- [selectButton.layer setShadowRadius:4.0];
801
- [selectButton.layer setShadowOpacity:0.3];
799
+ // Enhanced shadow for modern look
800
+ [selectButton.layer setShadowColor:[[NSColor colorWithRed:0.0 green:0.3 blue:0.7 alpha:0.8] CGColor]];
801
+ [selectButton.layer setShadowOffset:NSMakeSize(0, -3)];
802
+ [selectButton.layer setShadowRadius:8.0];
803
+ [selectButton.layer setShadowOpacity:0.4];
804
+
805
+ // Add subtle inner highlight
806
+ CALayer *highlightLayer = [CALayer layer];
807
+ [highlightLayer setFrame:CGRectMake(0, selectButton.frame.size.height * 0.6,
808
+ selectButton.frame.size.width, selectButton.frame.size.height * 0.4)];
809
+ [highlightLayer setBackgroundColor:[[NSColor colorWithRed:0.3 green:0.7 blue:1.0 alpha:0.3] CGColor]];
810
+ [highlightLayer setCornerRadius:14.0];
811
+ [selectButton.layer addSublayer:highlightLayer];
802
812
 
803
813
  // Set button target and action (reuse global delegate)
804
814
  if (!g_delegate) {
@@ -814,13 +824,14 @@ bool startScreenSelection() {
814
824
  [screenCancelButton setBezelStyle:NSBezelStyleRegularSquare];
815
825
  [screenCancelButton setFont:[NSFont systemFontOfSize:14 weight:NSFontWeightMedium]];
816
826
 
817
- // Gray cancel button styling
827
+ // Modern cancel button styling
818
828
  [screenCancelButton setWantsLayer:YES];
819
- [screenCancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.9] CGColor]];
820
- [screenCancelButton.layer setCornerRadius:10.0];
829
+ [screenCancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.4 green:0.4 blue:0.4 alpha:0.9] CGColor]];
830
+ [screenCancelButton.layer setCornerRadius:12.0];
821
831
  [screenCancelButton.layer setBorderWidth:0.0];
822
832
 
823
- // White text for cancel button
833
+ // White text for cancel button with better font
834
+ [screenCancelButton setFont:[NSFont systemFontOfSize:15 weight:NSFontWeightMedium]];
824
835
  NSMutableAttributedString *screenCancelTitleString = [[NSMutableAttributedString alloc]
825
836
  initWithString:[screenCancelButton title]];
826
837
  [screenCancelTitleString addAttribute:NSForegroundColorAttributeName
@@ -828,28 +839,58 @@ bool startScreenSelection() {
828
839
  range:NSMakeRange(0, [screenCancelTitleString length])];
829
840
  [screenCancelButton setAttributedTitle:screenCancelTitleString];
830
841
 
831
- // Add shadow for cancel button
832
- [screenCancelButton.layer setShadowColor:[[NSColor blackColor] CGColor]];
833
- [screenCancelButton.layer setShadowOffset:NSMakeSize(0, -1)];
834
- [screenCancelButton.layer setShadowRadius:2.0];
835
- [screenCancelButton.layer setShadowOpacity:0.2];
842
+ // Enhanced shadow for cancel button
843
+ [screenCancelButton.layer setShadowColor:[[NSColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.8] CGColor]];
844
+ [screenCancelButton.layer setShadowOffset:NSMakeSize(0, -2)];
845
+ [screenCancelButton.layer setShadowRadius:4.0];
846
+ [screenCancelButton.layer setShadowOpacity:0.3];
836
847
 
837
848
  [screenCancelButton setTarget:g_delegate];
838
849
  [screenCancelButton setAction:@selector(cancelButtonClicked:)];
839
850
 
851
+ // Create info label for screen
852
+ NSTextField *screenInfoLabel = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, screenFrame.size.width - 40, 60)];
853
+ [screenInfoLabel setEditable:NO];
854
+ [screenInfoLabel setSelectable:NO];
855
+ [screenInfoLabel setBezeled:NO];
856
+ [screenInfoLabel setDrawsBackground:NO];
857
+ [screenInfoLabel setAlignment:NSTextAlignmentCenter];
858
+ [screenInfoLabel setFont:[NSFont systemFontOfSize:20 weight:NSFontWeightMedium]];
859
+ [screenInfoLabel setTextColor:[NSColor whiteColor]];
860
+ [screenInfoLabel setWantsLayer:YES];
861
+
862
+ // Add shadow for better visibility
863
+ [screenInfoLabel.layer setShadowColor:[[NSColor blackColor] CGColor]];
864
+ [screenInfoLabel.layer setShadowOffset:NSMakeSize(0, -2)];
865
+ [screenInfoLabel.layer setShadowRadius:4.0];
866
+ [screenInfoLabel.layer setShadowOpacity:0.8];
867
+
868
+ // Set screen info text
869
+ NSString *screenName = [screenInfo objectForKey:@"name"] ?: @"Unknown Screen";
870
+ NSString *resolution = [screenInfo objectForKey:@"resolution"] ?: @"Unknown Resolution";
871
+ [screenInfoLabel setStringValue:[NSString stringWithFormat:@"%@\n%@", screenName, resolution]];
872
+
840
873
  // Position buttons - Start Record in center, Cancel below it
841
874
  NSPoint buttonCenter = NSMakePoint(
842
875
  (screenFrame.size.width - [selectButton frame].size.width) / 2,
843
- (screenFrame.size.height - [selectButton frame].size.height) / 2 + 30 // Slightly above center
876
+ (screenFrame.size.height - [selectButton frame].size.height) / 2 + 15 // Slightly above center
844
877
  );
845
878
  [selectButton setFrameOrigin:buttonCenter];
846
879
 
880
+ // Position info label above button
881
+ NSPoint labelCenter = NSMakePoint(
882
+ 20,
883
+ buttonCenter.y + [selectButton frame].size.height + 10 // 10px above button
884
+ );
885
+ [screenInfoLabel setFrameOrigin:labelCenter];
886
+
847
887
  NSPoint cancelButtonCenter = NSMakePoint(
848
888
  (screenFrame.size.width - [screenCancelButton frame].size.width) / 2,
849
889
  buttonCenter.y - [selectButton frame].size.height - 20 // 20px below main button
850
890
  );
851
891
  [screenCancelButton setFrameOrigin:cancelButtonCenter];
852
892
 
893
+ [overlayView addSubview:screenInfoLabel];
853
894
  [overlayView addSubview:selectButton];
854
895
  [overlayView addSubview:screenCancelButton];
855
896
  [overlayWindow orderFront:nil];
@@ -1012,13 +1053,14 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1012
1053
  [g_selectButton setBezelStyle:NSBezelStyleRegularSquare];
1013
1054
  [g_selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightSemibold]];
1014
1055
 
1015
- // Blue background with white text
1056
+ // Modern button styling with gradient-like effect
1016
1057
  [g_selectButton setWantsLayer:YES];
1017
- [g_selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.2 green:0.6 blue:1.0 alpha:0.95] CGColor]];
1018
- [g_selectButton.layer setCornerRadius:12.0];
1058
+ [g_selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.1 green:0.5 blue:0.9 alpha:0.95] CGColor]];
1059
+ [g_selectButton.layer setCornerRadius:14.0];
1019
1060
  [g_selectButton.layer setBorderWidth:0.0];
1020
1061
 
1021
- // White text color
1062
+ // White text color with better font weight
1063
+ [g_selectButton setFont:[NSFont systemFontOfSize:17 weight:NSFontWeightSemibold]];
1022
1064
  NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc]
1023
1065
  initWithString:[g_selectButton title]];
1024
1066
  [titleString addAttribute:NSForegroundColorAttributeName
@@ -1026,11 +1068,11 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1026
1068
  range:NSMakeRange(0, [titleString length])];
1027
1069
  [g_selectButton setAttributedTitle:titleString];
1028
1070
 
1029
- // Add shadow for better visibility
1030
- [g_selectButton.layer setShadowColor:[[NSColor blackColor] CGColor]];
1031
- [g_selectButton.layer setShadowOffset:NSMakeSize(0, -2)];
1032
- [g_selectButton.layer setShadowRadius:4.0];
1033
- [g_selectButton.layer setShadowOpacity:0.3];
1071
+ // Enhanced shadow for modern look
1072
+ [g_selectButton.layer setShadowColor:[[NSColor colorWithRed:0.0 green:0.3 blue:0.7 alpha:0.8] CGColor]];
1073
+ [g_selectButton.layer setShadowOffset:NSMakeSize(0, -3)];
1074
+ [g_selectButton.layer setShadowRadius:8.0];
1075
+ [g_selectButton.layer setShadowOpacity:0.4];
1034
1076
 
1035
1077
  // Create delegate for button action and timer
1036
1078
  g_delegate = [[WindowSelectorDelegate alloc] init];
@@ -1047,13 +1089,14 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1047
1089
  [cancelButton setBezelStyle:NSBezelStyleRegularSquare];
1048
1090
  [cancelButton setFont:[NSFont systemFontOfSize:14 weight:NSFontWeightMedium]];
1049
1091
 
1050
- // Gray cancel button styling
1092
+ // Modern cancel button styling
1051
1093
  [cancelButton setWantsLayer:YES];
1052
- [cancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.9] CGColor]];
1053
- [cancelButton.layer setCornerRadius:10.0];
1094
+ [cancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.4 green:0.4 blue:0.4 alpha:0.9] CGColor]];
1095
+ [cancelButton.layer setCornerRadius:12.0];
1054
1096
  [cancelButton.layer setBorderWidth:0.0];
1055
1097
 
1056
- // White text for cancel button
1098
+ // White text for cancel button with better font
1099
+ [cancelButton setFont:[NSFont systemFontOfSize:15 weight:NSFontWeightMedium]];
1057
1100
  NSMutableAttributedString *cancelTitleString = [[NSMutableAttributedString alloc]
1058
1101
  initWithString:[cancelButton title]];
1059
1102
  [cancelTitleString addAttribute:NSForegroundColorAttributeName
@@ -1061,11 +1104,11 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1061
1104
  range:NSMakeRange(0, [cancelTitleString length])];
1062
1105
  [cancelButton setAttributedTitle:cancelTitleString];
1063
1106
 
1064
- // Add shadow for cancel button
1065
- [cancelButton.layer setShadowColor:[[NSColor blackColor] CGColor]];
1066
- [cancelButton.layer setShadowOffset:NSMakeSize(0, -1)];
1067
- [cancelButton.layer setShadowRadius:2.0];
1068
- [cancelButton.layer setShadowOpacity:0.2];
1107
+ // Enhanced shadow for cancel button
1108
+ [cancelButton.layer setShadowColor:[[NSColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.8] CGColor]];
1109
+ [cancelButton.layer setShadowOffset:NSMakeSize(0, -2)];
1110
+ [cancelButton.layer setShadowRadius:4.0];
1111
+ [cancelButton.layer setShadowOpacity:0.3];
1069
1112
 
1070
1113
  [cancelButton setTarget:g_delegate];
1071
1114
  [cancelButton setAction:@selector(cancelButtonClicked:)];