node-mac-recorder 2.10.18 โ†’ 2.10.19

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.10.18",
3
+ "version": "2.10.19",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
package/quick-test.js CHANGED
@@ -1,33 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const WindowSelector = require("./window-selector");
3
+ const WindowSelector = require('./window-selector');
4
4
 
5
5
  async function quickTest() {
6
- console.log("๐Ÿงช Quick Window Selector Test");
7
- console.log("============================
8
- ");
6
+ console.log('๐Ÿงช Quick Window Selector Test');
7
+ console.log('============================\n');
9
8
 
10
9
  const selector = new WindowSelector();
11
10
 
12
11
  try {
13
- console.log("โœ… Starting window selection...");
14
- console.log("๐ŸŽฏ Hover over windows to see highlighting (no border)");
15
- console.log("๐Ÿ”’ Window dragging should be blocked");
16
- console.log("โŒ› Test will auto-stop in 15 seconds
17
- ");
12
+ console.log('โœ… Starting window selection...');
13
+ console.log('๐ŸŽฏ Hover over windows to see highlighting (no border)');
14
+ console.log('๐Ÿ”’ Window dragging should be blocked');
15
+ console.log('โŒ› Test will auto-stop in 15 seconds\n');
18
16
 
19
17
  await selector.startSelection();
20
18
 
21
19
  // Auto stop after 15 seconds
22
20
  setTimeout(async () => {
23
- console.log("
24
- โน๏ธ Auto-stopping test...");
21
+ console.log('\nโน๏ธ Auto-stopping test...');
25
22
  await selector.cleanup();
26
23
  process.exit(0);
27
24
  }, 15000);
28
25
 
29
26
  } catch (error) {
30
- console.error("โŒ Test failed:", error.message);
27
+ console.error('โŒ Test failed:', error.message);
31
28
  await selector.cleanup();
32
29
  process.exit(1);
33
30
  }
@@ -60,6 +60,12 @@ void updateScreenOverlays();
60
60
  - (void)setHighlightFrame:(NSRect)frame;
61
61
  @end
62
62
 
63
+ // Custom button with hover effects
64
+ @interface HoverButton : NSButton
65
+ @property (nonatomic) BOOL isHovered;
66
+ - (void)setupHoverTracking;
67
+ @end
68
+
63
69
  @implementation WindowSelectorOverlayView
64
70
 
65
71
  - (instancetype)initWithFrame:(NSRect)frameRect {
@@ -95,17 +101,29 @@ void updateScreenOverlays();
95
101
  xRadius:8.0
96
102
  yRadius:8.0];
97
103
 
98
- // Fill color based on toggle state - no border
104
+ // Fill color and border based on toggle state
99
105
  NSColor *fillColor;
106
+ NSColor *strokeColor;
107
+ CGFloat lineWidth;
100
108
 
101
109
  if (self.isToggled) {
110
+ // Locked state: thicker border
102
111
  fillColor = [NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.4];
112
+ strokeColor = [NSColor colorWithRed:0.45 green:0.25 blue:0.75 alpha:0.9];
113
+ lineWidth = 3.0;
103
114
  } else {
115
+ // Normal state: thin border
104
116
  fillColor = [NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.4];
117
+ strokeColor = [NSColor whiteColor];
118
+ lineWidth = 1.0;
105
119
  }
106
120
 
107
121
  [fillColor setFill];
108
122
  [highlightPath fill];
123
+
124
+ [strokeColor setStroke];
125
+ [highlightPath setLineWidth:lineWidth];
126
+ [highlightPath stroke];
109
127
  }
110
128
 
111
129
  - (void)updateAppearance {
@@ -162,6 +180,62 @@ void updateScreenOverlays();
162
180
 
163
181
  @end
164
182
 
183
+ @implementation HoverButton
184
+
185
+ - (instancetype)initWithFrame:(NSRect)frameRect {
186
+ self = [super initWithFrame:frameRect];
187
+ if (self) {
188
+ self.isHovered = NO;
189
+ [self setupHoverTracking];
190
+ }
191
+ return self;
192
+ }
193
+
194
+ - (void)setupHoverTracking {
195
+ NSTrackingArea *trackingArea = [[NSTrackingArea alloc]
196
+ initWithRect:self.bounds
197
+ options:(NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways)
198
+ owner:self
199
+ userInfo:nil];
200
+ [self addTrackingArea:trackingArea];
201
+ }
202
+
203
+ - (void)mouseEntered:(NSEvent *)event {
204
+ self.isHovered = YES;
205
+ [self animateScale:1.2 duration:0.15];
206
+ }
207
+
208
+ - (void)mouseExited:(NSEvent *)event {
209
+ self.isHovered = NO;
210
+ [self animateScale:1.0 duration:0.15];
211
+ }
212
+
213
+ - (void)animateScale:(CGFloat)scale duration:(NSTimeInterval)duration {
214
+ [NSAnimationContext beginGrouping];
215
+ [NSAnimationContext currentContext].duration = duration;
216
+ [NSAnimationContext currentContext].timingFunction =
217
+ [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
218
+
219
+ CATransform3D transform = CATransform3DMakeScale(scale, scale, 1.0);
220
+ self.layer.transform = transform;
221
+
222
+ [NSAnimationContext endGrouping];
223
+ }
224
+
225
+ - (void)updateTrackingAreas {
226
+ [super updateTrackingAreas];
227
+
228
+ // Remove old tracking areas
229
+ for (NSTrackingArea *area in self.trackingAreas) {
230
+ [self removeTrackingArea:area];
231
+ }
232
+
233
+ // Add new tracking area
234
+ [self setupHoverTracking];
235
+ }
236
+
237
+ @end
238
+
165
239
  // Recording preview overlay view - full screen with cutout
166
240
  @interface RecordingPreviewView : NSView
167
241
  @property (nonatomic, strong) NSDictionary *recordingWindowInfo;
@@ -1239,8 +1313,8 @@ bool startScreenSelection() {
1239
1313
 
1240
1314
  // Note: NSWindow doesn't have setWantsLayer method, only NSView does
1241
1315
 
1242
- // Create select button with more padding
1243
- NSButton *selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 60)];
1316
+ // Create select button with more padding and hover effects
1317
+ NSButton *selectButton = [[HoverButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 60)];
1244
1318
  [selectButton setTitle:@"Start Record"];
1245
1319
  [selectButton setButtonType:NSButtonTypeMomentaryPushIn];
1246
1320
  [selectButton setBordered:NO];
@@ -1282,8 +1356,8 @@ bool startScreenSelection() {
1282
1356
  [selectButton setFocusRingType:NSFocusRingTypeNone];
1283
1357
  [selectButton setShowsBorderOnlyWhileMouseInside:NO];
1284
1358
 
1285
- // Create cancel button for screen selection
1286
- NSButton *screenCancelButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 120, 40)];
1359
+ // Create cancel button for screen selection with hover effects
1360
+ NSButton *screenCancelButton = [[HoverButton alloc] initWithFrame:NSMakeRect(0, 0, 120, 40)];
1287
1361
  [screenCancelButton setTitle:@"Cancel"];
1288
1362
  [screenCancelButton setButtonType:NSButtonTypeMomentaryPushIn];
1289
1363
  [screenCancelButton setBordered:NO];
@@ -1640,8 +1714,8 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1640
1714
  [g_overlayWindow setMovable:NO];
1641
1715
  [g_overlayWindow setMovableByWindowBackground:NO];
1642
1716
 
1643
- // Create select button with purple theme
1644
- g_selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 60)];
1717
+ // Create select button with purple theme and hover effects
1718
+ g_selectButton = [[HoverButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 60)];
1645
1719
  [g_selectButton setTitle:@"Start Record"];
1646
1720
  [g_selectButton setButtonType:NSButtonTypeMomentaryPushIn];
1647
1721
  [g_selectButton setBordered:NO];
@@ -1681,8 +1755,8 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1681
1755
  // Add select button directly to window (not view) for proper layering
1682
1756
  [g_overlayWindow.contentView addSubview:g_selectButton];
1683
1757
 
1684
- // Create cancel button
1685
- NSButton *cancelButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 120, 40)];
1758
+ // Create cancel button with hover effects
1759
+ NSButton *cancelButton = [[HoverButton alloc] initWithFrame:NSMakeRect(0, 0, 120, 40)];
1686
1760
  [cancelButton setTitle:@"Cancel"];
1687
1761
  [cancelButton setButtonType:NSButtonTypeMomentaryPushIn];
1688
1762
  [cancelButton setBordered:NO];