node-mac-recorder 2.17.20 → 2.18.0

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.
@@ -7,7 +7,9 @@
7
7
  "Bash(git checkout:*)",
8
8
  "WebSearch",
9
9
  "WebFetch(domain:stackoverflow.com)",
10
- "Bash(timeout:*)"
10
+ "Bash(timeout:*)",
11
+ "Bash(grep:*)",
12
+ "Bash(./test-cleanup.sh:*)"
11
13
  ],
12
14
  "deny": [],
13
15
  "ask": []
@@ -0,0 +1 @@
1
+ []
@@ -0,0 +1 @@
1
+ [{"x":1151,"y":726,"timestamp":20,"cursorType":"text","type":"move"}
package/index.js CHANGED
@@ -359,10 +359,53 @@ class MacRecorder extends EventEmitter {
359
359
  // Start cursor tracking automatically with recording
360
360
  let cursorOptions = {};
361
361
 
362
- // Hem window hem display recording için aynı native cursor tracking kullan
363
- this.startCursorCapture(cursorFilePath).catch(cursorError => {
364
- console.warn('Cursor tracking failed to start:', cursorError.message);
365
- });
362
+ // For window recording, use simplified window-relative coordinates
363
+ if (this.options.windowId) {
364
+ // Use cached window info from the earlier window detection
365
+ this.getWindows().then(windows => {
366
+ const targetWindow = windows.find(w => w.id === this.options.windowId);
367
+ if (targetWindow) {
368
+ // Start cursor capture with simplified window-relative tracking
369
+ this.startCursorCapture(cursorFilePath, {
370
+ windowRelative: true,
371
+ windowInfo: {
372
+ // Use original global window coordinates for reference
373
+ x: targetWindow.x,
374
+ y: targetWindow.y,
375
+ width: targetWindow.width,
376
+ height: targetWindow.height,
377
+ displayId: this.options.displayId,
378
+ // Persist capture area so we can rebuild global offsets reliably
379
+ captureArea: this.options.captureArea,
380
+ // Keep a snapshot of the window details for debugging/analytics
381
+ originalWindow: targetWindow,
382
+ // Store display info for multi-display coordinate fixes
383
+ targetDisplay: this.recordingDisplayInfo
384
+ }
385
+ }).catch(cursorError => {
386
+ console.warn('Window cursor tracking failed:', cursorError.message);
387
+ // Fallback to display recording
388
+ this.startCursorCapture(cursorFilePath).catch(fallbackError => {
389
+ console.warn('Fallback cursor tracking failed:', fallbackError.message);
390
+ });
391
+ });
392
+ }
393
+ }).catch(error => {
394
+ console.warn('Could not get window info for cursor tracking:', error.message);
395
+ // Fallback to display cursor tracking
396
+ this.startCursorCapture(cursorFilePath).catch(cursorError => {
397
+ console.warn('Cursor tracking failed to start:', cursorError.message);
398
+ });
399
+ });
400
+ } else {
401
+ // For display recording, use display-relative cursor tracking
402
+ this.startCursorCapture(cursorFilePath, {
403
+ displayRelative: true,
404
+ displayInfo: this.recordingDisplayInfo
405
+ }).catch(cursorError => {
406
+ console.warn('Display cursor tracking failed:', cursorError.message);
407
+ });
408
+ }
366
409
 
367
410
  // Timer başlat (progress tracking için)
368
411
  this.recordingTimer = setInterval(() => {
@@ -456,11 +499,9 @@ class MacRecorder extends EventEmitter {
456
499
 
457
500
  // Stop cursor tracking automatically
458
501
  if (this.cursorCaptureInterval) {
459
- try {
460
- this.stopCursorCapture();
461
- } catch (cursorError) {
502
+ this.stopCursorCapture().catch(cursorError => {
462
503
  console.warn('Cursor tracking failed to stop:', cursorError.message);
463
- }
504
+ });
464
505
  }
465
506
 
466
507
  // Timer durdur
@@ -789,11 +830,9 @@ class MacRecorder extends EventEmitter {
789
830
 
790
831
  if (this.cursorDisplayInfo) {
791
832
  if (this.cursorDisplayInfo.windowRelative) {
792
- // Window recording: Use direct global-to-window transformation
793
- // This works correctly for both primary and secondary displays
833
+ // Window recording: Transform global → window-relative coordinates
794
834
  x = position.x - this.cursorDisplayInfo.x;
795
835
  y = position.y - this.cursorDisplayInfo.y;
796
-
797
836
  coordinateSystem = "window-relative";
798
837
 
799
838
  // Window bounds check - skip if cursor is outside window
@@ -875,34 +914,7 @@ class MacRecorder extends EventEmitter {
875
914
  /**
876
915
  * Cursor capture durdurur - dosya yazma işlemini sonlandırır
877
916
  */
878
- stopCursorCapture() {
879
- if (!this.cursorCaptureInterval) {
880
- return false;
881
- }
882
-
883
- try {
884
- // Native cursor tracking'i durdur
885
- const success = nativeBinding.stopCursorTracking();
886
-
887
- this.cursorCaptureInterval = null;
888
- this.cursorCaptureFile = null;
889
- this.cursorCaptureStartTime = null;
890
-
891
- this.emit("cursorCaptureStopped", {
892
- timestamp: Date.now()
893
- });
894
-
895
- return success;
896
- } catch (error) {
897
- console.warn("Error stopping cursor tracking:", error.message);
898
- return false;
899
- }
900
- }
901
-
902
- /**
903
- * LEGACY: Eski JS-based cursor capture durdurmak için geriye uyumluluk
904
- */
905
- async _legacyStopCursorCapture() {
917
+ async stopCursorCapture() {
906
918
  return new Promise((resolve, reject) => {
907
919
  try {
908
920
  if (!this.cursorCaptureInterval) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.17.20",
3
+ "version": "2.18.0",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
package/publish.sh CHANGED
@@ -3,6 +3,37 @@
3
3
  # Publish script for node-mac-recorder
4
4
  # Usage: ./publish.sh <patch|minor|major> "commit message"
5
5
 
6
+ # Clean up development files before publishing
7
+ echo "🧹 Cleaning up development files..."
8
+
9
+ # Remove video files
10
+ echo " • Removing .mov and .mp4 files..."
11
+ find . -name "*.mov" -type f -delete 2>/dev/null
12
+ find . -name "*.mp4" -type f -delete 2>/dev/null
13
+
14
+ # Remove files containing specific keywords
15
+ echo " • Removing files containing test, debug, example, demo, sample..."
16
+ find . -type f -not -path "./node_modules/*" \( \
17
+ -name "*test*" -o \
18
+ -name "*debug*" -o \
19
+ -name "*example*" -o \
20
+ -name "*demo*" -o \
21
+ -name "*sample*" \
22
+ \) -delete 2>/dev/null
23
+
24
+ # Remove folders containing specific keywords
25
+ echo " • Removing folders containing test, debug, example, demo, sample..."
26
+ find . -type d -not -path "./node_modules/*" \( \
27
+ -name "*test*" -o \
28
+ -name "*debug*" -o \
29
+ -name "*example*" -o \
30
+ -name "*demo*" -o \
31
+ -name "*sample*" \
32
+ \) -exec rm -rf {} + 2>/dev/null
33
+
34
+ echo "✅ Cleanup completed"
35
+ echo ""
36
+
6
37
  # Check if correct number of arguments provided
7
38
  if [ $# -ne 2 ]; then
8
39
  echo "❌ Usage: $0 <patch|minor|major> \"commit message\""