@breakside/jskit 2021.36.1 → 2021.40.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.
Files changed (106) hide show
  1. package/Frameworks/DOM.jsframework/Info.json +2 -2
  2. package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
  3. package/Frameworks/FontKit.jsframework/Info.json +2 -2
  4. package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
  5. package/Frameworks/Foundation.jsframework/Info.json +2 -2
  6. package/Frameworks/Foundation.jsframework/JS/JSColor+HTML.js +11 -2
  7. package/Frameworks/Foundation.jsframework/JS/JSColor.js +62 -26
  8. package/Frameworks/Foundation.jsframework/JS/JSColorSpace.js +209 -1
  9. package/Frameworks/Foundation.jsframework/JS/JSImage.js +9 -3
  10. package/Frameworks/Foundation.jsframework/JS/JSSpec.js +1 -1
  11. package/Frameworks/Foundation.jsframework/JS/JSURL.js +42 -3
  12. package/Frameworks/Foundation.jsframework/JS/JSURLRequest.js +4 -1
  13. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  14. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  15. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  16. package/Info.json +2 -2
  17. package/Node/io.breakside.jskit-bundle.js +4 -4
  18. package/Resources/doc-default.css +86 -0
  19. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  20. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  21. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  22. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  23. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  24. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  25. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  26. package/Root/Frameworks/DOM/Info.yaml +1 -1
  27. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  28. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  29. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  30. package/Root/Frameworks/Foundation/JSColor+HTML.js +11 -2
  31. package/Root/Frameworks/Foundation/JSColor.js +62 -26
  32. package/Root/Frameworks/Foundation/JSColorSpace.js +209 -1
  33. package/Root/Frameworks/Foundation/JSImage.js +9 -3
  34. package/Root/Frameworks/Foundation/JSSpec.js +1 -1
  35. package/Root/Frameworks/Foundation/JSURL.js +42 -3
  36. package/Root/Frameworks/Foundation/JSURLRequest.js +4 -1
  37. package/Root/Frameworks/ImageKit/IKHTMLCanvasBitmapContext.js +1 -1
  38. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  39. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  40. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  41. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  42. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  43. package/Root/Frameworks/PDFKit/PDFColorSpace.js +1 -1
  44. package/Root/Frameworks/PDFKit/PDFReader.js +8 -3
  45. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  46. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  47. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  48. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  49. package/Root/Frameworks/ServerKit/SKValidatingObject.js +21 -0
  50. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  51. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  52. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  53. package/Root/Frameworks/UIKit/JSColor+UIKit.js +75 -0
  54. package/Root/Frameworks/UIKit/UIAccessibility.js +15 -0
  55. package/Root/Frameworks/UIKit/UIActivityIndicatorView.js +2 -1
  56. package/Root/Frameworks/UIKit/UIAlertController.js +4 -3
  57. package/Root/Frameworks/UIKit/UIAnimation.js +7 -13
  58. package/Root/Frameworks/UIKit/UIApplication.js +3 -0
  59. package/Root/Frameworks/UIKit/UIBasicAnimation.js +6 -0
  60. package/Root/Frameworks/UIKit/UIButton.js +49 -26
  61. package/Root/Frameworks/UIKit/UICheckbox.js +11 -22
  62. package/Root/Frameworks/UIKit/UIColorPanel.js +29 -15
  63. package/Root/Frameworks/UIKit/UIColorSpace.js +132 -0
  64. package/Root/Frameworks/UIKit/UIColorWell.js +30 -4
  65. package/Root/Frameworks/UIKit/UIControl.js +8 -4
  66. package/Root/Frameworks/UIKit/UIHTMLDisplayServer.js +1 -5
  67. package/Root/Frameworks/UIKit/UIHTMLTextField.js +3 -15
  68. package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +72 -1
  69. package/Root/Frameworks/UIKit/UIImageView.js +4 -0
  70. package/Root/Frameworks/UIKit/UIKit.js +2 -0
  71. package/Root/Frameworks/UIKit/UILabel.js +14 -2
  72. package/Root/Frameworks/UIKit/UILayer.js +29 -1
  73. package/Root/Frameworks/UIKit/UIListView.js +23 -12
  74. package/Root/Frameworks/UIKit/UIListViewCell.js +10 -2
  75. package/Root/Frameworks/UIKit/UIMenu.js +21 -13
  76. package/Root/Frameworks/UIKit/UIMenuBar.js +5 -4
  77. package/Root/Frameworks/UIKit/UIMenuView.js +9 -5
  78. package/Root/Frameworks/UIKit/UINavigationBar.js +8 -5
  79. package/Root/Frameworks/UIKit/UINavigationController.js +3 -2
  80. package/Root/Frameworks/UIKit/UIOutlineViewCell.js +2 -1
  81. package/Root/Frameworks/UIKit/UIPopupButton.js +22 -25
  82. package/Root/Frameworks/UIKit/UIPopupWindow.js +9 -2
  83. package/Root/Frameworks/UIKit/UIProgressIndicatorView.js +1 -1
  84. package/Root/Frameworks/UIKit/UIRadioGroup.js +11 -22
  85. package/Root/Frameworks/UIKit/UIScroller.js +4 -3
  86. package/Root/Frameworks/UIKit/UISegmentedControl.js +16 -15
  87. package/Root/Frameworks/UIKit/UISlider.js +29 -37
  88. package/Root/Frameworks/UIKit/UISplitView.js +16 -0
  89. package/Root/Frameworks/UIKit/UITabView.js +34 -31
  90. package/Root/Frameworks/UIKit/UITextEditor.js +2 -1
  91. package/Root/Frameworks/UIKit/UITextField.js +13 -14
  92. package/Root/Frameworks/UIKit/UITextLayer.js +5 -0
  93. package/Root/Frameworks/UIKit/UITokenField.js +3 -3
  94. package/Root/Frameworks/UIKit/UIToolbar.js +84 -38
  95. package/Root/Frameworks/UIKit/UIToolbarOverflow.svg +8 -0
  96. package/Root/Frameworks/UIKit/UITooltipWindow.js +38 -15
  97. package/Root/Frameworks/UIKit/UITraitCollection.js +21 -0
  98. package/Root/Frameworks/UIKit/UIUserInterface.js +6 -0
  99. package/Root/Frameworks/UIKit/UIWebView.js +3 -2
  100. package/Root/Frameworks/UIKit/UIWindow.js +178 -52
  101. package/Root/Frameworks/UIKit/UIWindowButtonCloseInactive.svg +1 -1
  102. package/Root/Frameworks/UIKit/UIWindowButtonCloseNormal.svg +1 -1
  103. package/Root/Frameworks/UIKit/UIWindowServer.js +72 -9
  104. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  105. package/Root/Templates/html/${PROJECT_NAME}/www/index.html +24 -4
  106. package/package.json +1 -1
@@ -14,6 +14,7 @@
14
14
  // limitations under the License.
15
15
 
16
16
  // #import "UIView.js"
17
+ // #import "JSColor+UIKit.js"
17
18
  'use strict';
18
19
 
19
20
  (function(){
@@ -30,14 +31,14 @@ JSClass("UIWebView", UIView, {
30
31
 
31
32
  initWithFrame: function(frame){
32
33
  UIWebView.$super.initWithFrame.call(this, frame);
33
- this.backgroundColor = JSColor.white;
34
+ this.backgroundColor = JSColor.background;
34
35
  this.setNeedsDisplay();
35
36
  },
36
37
 
37
38
  initWithSpec: function(spec){
38
39
  UIWebView.$super.initWithSpec.call(this, spec);
39
40
  if (this.backgroundColor === null){
40
- this.backgroundColor = JSColor.white;
41
+ this.backgroundColor = JSColor.background;
41
42
  }
42
43
  if (spec.containsKey("delegate")){
43
44
  this.delegate = spec.valueForKey("delegate");
@@ -24,6 +24,7 @@
24
24
  // #import "UIViewPropertyAnimator.js"
25
25
  // #import "UIViewController.js"
26
26
  // #import "UIFocusRingLayer.js"
27
+ /* global UISplitView */
27
28
  'use strict';
28
29
 
29
30
  (function(){
@@ -118,7 +119,7 @@ JSClass('UIWindow', UIView, {
118
119
  _commonWindowInit: function(){
119
120
  this.window = this;
120
121
  if (this.backgroundColor === null){
121
- this.backgroundColor = JSColor.white;
122
+ this.backgroundColor = JSColor.background;
122
123
  }
123
124
  this.clipsToBounds = true;
124
125
  if (this._contentView === null){
@@ -134,8 +135,7 @@ JSClass('UIWindow', UIView, {
134
135
  this._styler = UIWindow.Styler.default;
135
136
  }
136
137
  }
137
- this._traitCollection = UITraitCollection.initWithSize(this.frame.size);
138
- this._traitCollection.accessibilityContrast = this.windowServer.contrast;
138
+ this._traitCollection = this.windowServer.traitCollection.traitsWithSize(this.bounds.size);
139
139
  this.stylerProperties = {};
140
140
  this._styler.initializeWindow(this);
141
141
  },
@@ -178,7 +178,7 @@ JSClass('UIWindow', UIView, {
178
178
 
179
179
  setToolbar: function(toolbar){
180
180
  this._toolbar = toolbar;
181
- this._styler.updateWindow();
181
+ this._styler.updateWindow(this);
182
182
  this.setNeedsLayout();
183
183
  },
184
184
 
@@ -308,9 +308,10 @@ JSClass('UIWindow', UIView, {
308
308
  // MARK: Traits
309
309
 
310
310
  layerDidChangeSize: function(){
311
- var traits = UITraitCollection.initWithSize(this.bounds.size);
312
- traits.contrast = this.windowServer.contrast;
313
- this._setTraitCollection(traits);
311
+ if (this._traitCollection !== null){
312
+ var traits = this._traitCollection.traitsWithSize(this.bounds.size);
313
+ this._setTraitCollection(traits);
314
+ }
314
315
  },
315
316
 
316
317
  traitCollection: JSReadOnlyProperty('_traitCollection', null),
@@ -432,6 +433,7 @@ JSClass('UIWindow', UIView, {
432
433
  }else if (this._contentViewController){
433
434
  this._contentViewController.viewWillAppear(false);
434
435
  }
436
+ this._shouldCallDidAppear = true;
435
437
  }
436
438
  this.windowServer.orderWindowFront(this);
437
439
  if (!this._isOpen){
@@ -442,15 +444,19 @@ JSClass('UIWindow', UIView, {
442
444
  }
443
445
  },
444
446
 
447
+ _shouldCallDidAppear: false,
445
448
  _isVisible: false,
446
449
 
447
450
  didBecomeVisible: function(){
448
451
  this._application._windows.push(this);
449
452
  this._isVisible = true;
450
- if (this.viewController){
451
- this.viewController.viewDidAppear(false);
452
- }else if (this._contentViewController){
453
- this._contentViewController.viewDidAppear(false);
453
+ if (this._shouldCallDidAppear){
454
+ this._shouldCallDidAppear = false;
455
+ if (this.viewController){
456
+ this.viewController.viewDidAppear(false);
457
+ }else if (this._contentViewController){
458
+ this._contentViewController.viewDidAppear(false);
459
+ }
454
460
  }
455
461
  if (this._initialFirstResponder !== null){
456
462
  var responder = this._initialFirstResponder;
@@ -520,36 +526,22 @@ JSClass('UIWindow', UIView, {
520
526
  return;
521
527
  }
522
528
  var window = this;
523
- var alpha = this.alpha;
524
- window._modalAnimator = UIViewPropertyAnimator.initWithDuration(0.05);
525
- window._modalAnimator.addAnimations(function(){
526
- window.alpha = alpha * 0.8;
529
+ var transform = this.transform;
530
+ this._modalAnimator = UIViewPropertyAnimator.initWithDuration(0.075);
531
+ this._modalAnimator.addAnimations(function(){
532
+ window.transform = transform.scaledBy(1.15);
527
533
  });
528
- window._modalAnimator.addCompletion(function(){
529
- window._modalAnimator = UIViewPropertyAnimator.initWithDuration(0.05);
534
+ this._modalAnimator.addCompletion(function(){
535
+ window._modalAnimator = UIViewPropertyAnimator.initWithDuration(0.075);
530
536
  window._modalAnimator.addAnimations(function(){
531
- window.alpha = alpha;
537
+ window.transform = transform;
532
538
  });
533
539
  window._modalAnimator.addCompletion(function(){
534
- window._modalAnimator = UIViewPropertyAnimator.initWithDuration(0.05);
535
- window._modalAnimator.addAnimations(function(){
536
- window.alpha = alpha * 0.8;
537
- });
538
- window._modalAnimator.addCompletion(function(){
539
- window._modalAnimator = UIViewPropertyAnimator.initWithDuration(0.05);
540
- window._modalAnimator.addAnimations(function(){
541
- window.alpha = alpha;
542
- });
543
- window._modalAnimator.addCompletion(function(){
544
- window._modalAnimator = null;
545
- });
546
- window._modalAnimator.start();
547
- });
548
- window._modalAnimator.start();
540
+ window._modalAnimator = null;
549
541
  });
550
542
  window._modalAnimator.start();
551
543
  });
552
- window._modalAnimator.start();
544
+ this._modalAnimator.start();
553
545
  },
554
546
 
555
547
  // -------------------------------------------------------------------------
@@ -628,7 +620,27 @@ JSClass('UIWindow', UIView, {
628
620
  }
629
621
  return;
630
622
  }
631
- UIWindow.$super.keyDown.call(this, event);
623
+ var next = this._nextKeyResponder();
624
+ if (next !== null){
625
+ next.keyDown(event);
626
+ }
627
+ },
628
+
629
+ keyUp: function(event){
630
+ var next = this._nextKeyResponder();
631
+ if (next !== null){
632
+ next.keyUp(event);
633
+ }
634
+ },
635
+
636
+ _nextKeyResponder: function(){
637
+ var responder = this.getNextResponder();
638
+ if (responder === this._application){
639
+ if (this.isKeyWindow && this.windowServer.mainWindow !== null && this.windowServer.mainWindow !== this){
640
+ return this.windowServer.mainWindow;
641
+ }
642
+ }
643
+ return responder;
632
644
  },
633
645
 
634
646
  // -------------------------------------------------------------------------
@@ -683,9 +695,6 @@ JSClass('UIWindow', UIView, {
683
695
  if (this.viewController !== null){
684
696
  return this.viewController;
685
697
  }
686
- if (this.isKeyWindow && this.windowServer.mainWindow !== null && this.windowServer.mainWindow !== this){
687
- return this.windowServer.mainWindow;
688
- }
689
698
  return this._application;
690
699
  },
691
700
 
@@ -1089,7 +1098,19 @@ UIWindow.Styler = Object.create({}, {
1089
1098
  Object.defineProperty(this, 'custom', {configurable: true, value: styler});
1090
1099
  return styler;
1091
1100
  },
1092
- }
1101
+ },
1102
+
1103
+ tooltip: {
1104
+ configurable: true,
1105
+ get: function UIWindow_getTooltipStyler(){
1106
+ var styler = UITooltipWindowStyler.init();
1107
+ Object.defineProperty(this, 'tooltip', {configurable: true, value: styler});
1108
+ return styler;
1109
+ },
1110
+ set: function UIWindow_setTooltipStyler(styler){
1111
+ Object.defineProperty(this, 'tooltip', {configurable: true, value: styler});
1112
+ }
1113
+ },
1093
1114
 
1094
1115
  });
1095
1116
 
@@ -1111,7 +1132,7 @@ JSClass("UIWindowStyler", JSObject, {
1111
1132
  focusRingWidth: 3.5,
1112
1133
 
1113
1134
  init: function(){
1114
- this.focusRingColor = this.localCursorColor = JSColor.initWithRGBA(0, 128/255.0, 255/255.0, 0.6);
1135
+ this.focusRingColor = JSColor.highlight;
1115
1136
  },
1116
1137
 
1117
1138
  initializeWindow: function(window){
@@ -1202,24 +1223,19 @@ JSClass("UIWindowDefaultStyler", UIWindowStyler, {
1202
1223
 
1203
1224
  init: function(){
1204
1225
  UIWindowDefaultStyler.$super.init.call(this);
1205
- this.activeTitleColor = JSColor.initWithWhite(51/255);
1206
- this.inactiveTitleColor = JSColor.initWithWhite(192/255);
1207
- this.shadowColor = JSColor.initWithRGBA(0, 0, 0, 0.4);
1208
- this.backgroundColor = JSColor.initWithRGBA(240/255,240/255,240/255,1);
1209
- this.titleBackgroundColor = null;
1210
- this.titleBackgroundGradient = JSGradient.initWithStops(
1211
- 0, JSColor.initWithRGBA(230/255,230/255,230/255,1),
1212
- 1, JSColor.initWithRGBA(204/255,204/255,204/255,1)
1213
- );
1214
- this.contentSeparatorColor = JSColor.initWithRGBA(0, 0, 0, 0.1);
1226
+ this.activeTitleColor = JSColor.text;
1227
+ this.inactiveTitleColor = JSColor.text.colorWithAlpha(0.3);
1228
+ this.shadowColor = JSColor.windowShadow;
1229
+ this.backgroundColor = JSColor.window;
1230
+ this.titleBackgroundColor = JSColor.initWithUIStyles(JSColor.window.colorLightenedByPercentage(0.5), JSColor.window.colorLightenedByPercentage(0.05));
1231
+ this.contentSeparatorColor = JSColor.initWithUIStyles(JSColor.black.colorWithAlpha(0.1), JSColor.black.colorWithAlpha(0.8));
1215
1232
  this.closeButtonImages = {
1216
1233
  inactive: images.closeInactive,
1217
1234
  normal: images.closeNormal,
1218
1235
  over: images.closeOver,
1219
1236
  active: images.closeActive
1220
1237
  };
1221
- this.toolbarTitleColor = JSColor.initWithWhite(102/255);
1222
- this.toolbarDisabledTitleColor = JSColor.initWithWhite(204/255);
1238
+ this.toolbarTitleColor = JSColor.toolbarTitle;
1223
1239
  },
1224
1240
 
1225
1241
  initializeWindow: function(window){
@@ -1398,6 +1414,116 @@ JSClass("UIWindowDefaultStyler", UIWindowStyler, {
1398
1414
 
1399
1415
  });
1400
1416
 
1417
+ JSClass("UIWindowTitlelessStyler", UIWindowStyler, {
1418
+
1419
+ _titlebarSize: 22,
1420
+ _controlButtonSize: 12,
1421
+ shadowRadius: 40,
1422
+ inactiveShadowRadius: 25,
1423
+ cornerRadius: 6,
1424
+ backgroundColor: null,
1425
+ shadowColor: null,
1426
+ closeButtonImages: null,
1427
+
1428
+ init: function(){
1429
+ UIWindowDefaultStyler.$super.init.call(this);
1430
+ this.shadowColor = JSColor.windowShadow;
1431
+ this.backgroundColor = JSColor.window;
1432
+ this.closeButtonImages = {
1433
+ inactive: images.closeInactive,
1434
+ normal: images.closeNormal,
1435
+ over: images.closeOver,
1436
+ active: images.closeActive
1437
+ };
1438
+ this.toolbarTitleColor = JSColor.toolbarTitle;
1439
+ },
1440
+
1441
+ initializeWindow: function(window){
1442
+ UIWindowDefaultStyler.$super.initializeWindow.call(this, window);
1443
+ var closeButton = UIButton.initWithStyler(UIButton.Styler.custom);
1444
+ closeButton.setImageForState(this.closeButtonImages.normal, UIControl.State.normal);
1445
+ closeButton.setImageForState(this.closeButtonImages.over, UIControl.State.over);
1446
+ closeButton.setImageForState(this.closeButtonImages.active, UIControl.State.active);
1447
+ closeButton.addAction("close", window);
1448
+
1449
+ var controlsView = UIView.init();
1450
+ controlsView.addSubview(closeButton);
1451
+ window.addSubview(controlsView);
1452
+
1453
+ window.stylerProperties.controlsView = controlsView;
1454
+ window.stylerProperties.closeButton = closeButton;
1455
+ window.stylerProperties.toolbar = null;
1456
+
1457
+ window.shadowColor = this.shadowColor;
1458
+ window.shadowRadius = this.shadowRadius;
1459
+ window.cornerRadius = this.cornerRadius;
1460
+ window.backgroundColor = this.backgroundColor;
1461
+
1462
+ this.updateWindow(window);
1463
+ },
1464
+
1465
+ layoutWindow: function(window){
1466
+ UIWindowDefaultStyler.$super.layoutWindow.call(this, window);
1467
+ var controlsView = window.stylerProperties.controlsView;
1468
+ var closeButton = window.stylerProperties.closeButton;
1469
+ var toolbar = window.stylerProperties.toolbar;
1470
+ var bounds = window.bounds;
1471
+ var controlsHeight = this._controlButtonSize * 2;
1472
+ if (toolbar){
1473
+ controlsHeight = toolbar.frame.size.height;
1474
+ }
1475
+ var controlPadding = (controlsHeight - this._controlButtonSize) / 2;
1476
+ closeButton.frame = JSRect(controlPadding, controlPadding, this._controlButtonSize, this._controlButtonSize);
1477
+ controlsView.frame = JSRect(0, 0, controlsHeight, controlsHeight);
1478
+ var x = controlsView.bounds.size.width;
1479
+ if (window.contentView.isKindOfClass(UISplitView)){
1480
+ var splitView = window.contentView;
1481
+ x = splitView.leadingView.convertPointToView(JSPoint(splitView.leadingView.bounds.size.width, 0), window).x;
1482
+ }
1483
+ window.addSubview(controlsView);
1484
+ if (toolbar){
1485
+ toolbar.frame = JSRect(x, 0, bounds.size.width - x, toolbar.intrinsicSize.height);
1486
+ window.insertSubviewBelowSibling(toolbar, controlsView);
1487
+ }
1488
+ },
1489
+
1490
+ updateWindow: function(window){
1491
+ var closeButton = window.stylerProperties.closeButton;
1492
+ var controlsView = window.stylerProperties.controlsView;
1493
+ closeButton.hidden = !window.allowsClose;
1494
+
1495
+ if (window.isMainWindow || window.isKeyWindow){
1496
+ window.shadowRadius = this.shadowRadius;
1497
+ }else{
1498
+ window.shadowRadius = this.inactiveShadowRadius;
1499
+ }
1500
+ if (window.isMainWindow){
1501
+ closeButton.setImageForState(this.closeButtonImages.normal, UIControl.State.normal);
1502
+ }else{
1503
+ closeButton.setImageForState(this.closeButtonImages.inactive, UIControl.State.normal);
1504
+ }
1505
+
1506
+ if (window.toolbar){
1507
+ if (window.stylerProperties.toolbar && window.stylerProperties.toolbar !== window.toolbar){
1508
+ window.stylerProperties.toolbar.removeFromSuperview();
1509
+ window.stylerProperties.toolbar = null;
1510
+ }
1511
+ if (window.stylerProperties.toolbar === null){
1512
+ window.stylerProperties.toolbar = window.toolbar;
1513
+ window.insertSubviewBelowSibling(window.stylerProperties.toolbar, controlsView);
1514
+ }
1515
+ }else{
1516
+ if (window.stylerProperties.toolbar !== null){
1517
+ window.stylerProperties.toolbar.removeFromSuperview();
1518
+ window.stylerProperties.toolbar = null;
1519
+ }
1520
+ }
1521
+
1522
+ window.contentInsets = JSInsets.Zero;
1523
+ },
1524
+
1525
+ });
1526
+
1401
1527
  JSClass("UIWindowCustomStyler", UIWindowStyler, {
1402
1528
 
1403
1529
  });
@@ -5,6 +5,6 @@
5
5
  <desc>Created with Sketch.</desc>
6
6
  <defs></defs>
7
7
  <g id="UIWindowButtonCloseInactive" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
- <circle id="Oval" stroke="#D8D8D8" cx="6" cy="6" r="5.5"></circle>
8
+ <circle id="Oval" stroke="rgb(0,0,0,0.1)" cx="6" cy="6" r="5.5"></circle>
9
9
  </g>
10
10
  </svg>
@@ -5,6 +5,6 @@
5
5
  <desc>Created with Sketch.</desc>
6
6
  <defs></defs>
7
7
  <g id="UIWindowButtonCloseNormal" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
- <circle id="Oval" stroke="#979797" cx="6" cy="6" r="5.5"></circle>
8
+ <circle id="Oval" stroke="rgba(0,0,0,0.4)" cx="6" cy="6" r="5.5"></circle>
9
9
  </g>
10
10
  </svg>
@@ -21,6 +21,7 @@
21
21
  // #import "UITooltipWindow.js"
22
22
  // #import "UIDraggingSession.js"
23
23
  // #import "UIUserInterface.js"
24
+ // #import "UIColorSpace.js"
24
25
  'use strict';
25
26
 
26
27
  (function(){
@@ -34,11 +35,10 @@ JSClass("UIWindowServer", JSObject, {
34
35
  textInputManager: null,
35
36
  keyWindow: null,
36
37
  mainWindow: null,
37
- menuBar: JSDynamicProperty('_menuBar', null),
38
38
  screen: null,
39
- contrast: JSDynamicProperty('_contrast', UIUserInterface.Contrast.normal),
40
39
  mouseLocation: null,
41
40
  fullKeyboardAccessEnabled: false,
41
+ darkModeEnabled: true,
42
42
  _windowsById: null,
43
43
  _mouseIdleTimer: null,
44
44
  _tooltipWindow: null,
@@ -51,6 +51,9 @@ JSClass("UIWindowServer", JSObject, {
51
51
  // MARK: - Creating a Window Server
52
52
 
53
53
  init: function(){
54
+ this._traitCollection = UITraitCollection.init();
55
+ this._traitCollection.accessibilityContrast = UIUserInterface.Contrast.normal;
56
+ this._traitCollection.userInterfaceStyle = UIUserInterface.Style.light;
54
57
  this.windowStack = [];
55
58
  this._windowsById = {};
56
59
  this._normalLevelRange = JSRange.Zero;
@@ -340,6 +343,8 @@ JSClass("UIWindowServer", JSObject, {
340
343
 
341
344
  // -----------------------------------------------------------------------
342
345
  // MARK: - Menu Bar
346
+
347
+ menuBar: JSDynamicProperty('_menuBar', null),
343
348
 
344
349
  setMenuBar: function(menuBar){
345
350
  if (this._menuBar){
@@ -360,7 +365,12 @@ JSClass("UIWindowServer", JSObject, {
360
365
  // -----------------------------------------------------------------------
361
366
  // MARK: - Tooltips
362
367
 
368
+ _hideTooltipInterval: 0.15,
369
+
363
370
  showTooltipForView: function(view, screenLocation){
371
+ if (this._tooltipWindow !== null){
372
+ this.hideTooltip();
373
+ }
364
374
  var safeArea = view.window.screen.frame.rectWithInsets(3);
365
375
 
366
376
  this._tooltipSourceView = view;
@@ -389,7 +399,19 @@ JSClass("UIWindowServer", JSObject, {
389
399
  this._tooltipWindow.orderFront();
390
400
  },
391
401
 
402
+ _hideTooltipTimer: null,
403
+
404
+ _scheduleHideTooltip: function(){
405
+ if (this._hideTooltipTimer === null){
406
+ this._hideTooltipTimer = JSTimer.scheduledTimerWithInterval(this._hideTooltipInterval, this.hideTooltip, this);
407
+ }
408
+ },
409
+
392
410
  hideTooltip: function(){
411
+ if (this._hideTooltipTimer !== null){
412
+ this._hideTooltipTimer.invalidate();
413
+ this._hideTooltipTimer = null;
414
+ }
393
415
  this._tooltipWindow.close();
394
416
  this._tooltipWindow = null;
395
417
  this._tooltipSourceView = null;
@@ -412,9 +434,10 @@ JSClass("UIWindowServer", JSObject, {
412
434
  }
413
435
  }
414
436
  if (shouldHideTooltip){
415
- this.hideTooltip();
416
437
  if (view !== null && view.tooltip !== null){
417
438
  this.showTooltipForView(view, this.mouseLocation);
439
+ }else{
440
+ this._scheduleHideTooltip();
418
441
  }
419
442
  }
420
443
  },
@@ -986,17 +1009,57 @@ JSClass("UIWindowServer", JSObject, {
986
1009
  }
987
1010
  },
988
1011
 
989
- setContrast: function(contrast){
990
- if (contrast === this._contrast){
1012
+ // -----------------------------------------------------------------------
1013
+ // MARK: - Traits
1014
+
1015
+ traitCollection: JSDynamicProperty("_traitCollection", null),
1016
+
1017
+ setTraitCollection: function(traitCollection){
1018
+ if (!this.darkModeEnabled && traitCollection.userInterfaceStyle === UIUserInterface.Style.dark){
1019
+ traitCollection = traitCollection.traitsWithUserInterfaceStyle(UIUserInterface.Style.light);
1020
+ }
1021
+ if (this._traitCollection.isEqual(traitCollection)){
1022
+ return;
1023
+ }
1024
+ this._traitCollection = traitCollection;
1025
+ UIColorSpace.setTraitCollection(traitCollection);
1026
+ if (this.windowStack.length > 0){
1027
+ var window;
1028
+ for (var i = 0, l = this.windowStack.length; i < l; ++i){
1029
+ window = this.windowStack[i];
1030
+ window._setTraitCollection(this._traitCollection.traitsWithSize(window.bounds.size));
1031
+ }
1032
+ this.setNeedsRedisplay();
1033
+ }
1034
+ },
1035
+
1036
+ _needsRedisplay: false,
1037
+
1038
+ setNeedsRedisplay: function(){
1039
+ if (this._needsRedisplay){
991
1040
  return;
992
1041
  }
993
- this._contrast = contrast;
1042
+ this._needsRedisplay = true;
1043
+ var i, l;
1044
+ var layers = [];
994
1045
  var window;
995
- for (var i = 0, l = this.windowStack.length; i < l; ++i){
1046
+ for (i = 0, l = this.windowStack.length; i < l; ++i){
996
1047
  window = this.windowStack[i];
997
- window._setTraitCollection(window.traitCollection.traitsWithContrast(this._contrast));
1048
+ layers.push(window.layer);
1049
+ }
1050
+ var layer;
1051
+ var sublayer;
1052
+ while (layers.length > 0){
1053
+ layer = layers.shift();
1054
+ layer.setNeedsRedisplay();
1055
+ for (i = 0, l = layer.sublayers.length; i < l; ++i){
1056
+ layers.push(layer.sublayers[i]);
1057
+ }
998
1058
  }
999
- }
1059
+ this.displayServer.schedule(function(){
1060
+ this._needsRedisplay = false;
1061
+ }, this);
1062
+ },
1000
1063
 
1001
1064
  });
1002
1065
 
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKitTesting
3
- JSBundleVersion: 2021.36.1
3
+ JSBundleVersion: 2021.40.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -3,6 +3,8 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover">
6
+ <meta name="theme-color" media="(prefers-color-scheme: light)" content="white">
7
+ <meta name="theme-color" media="(prefers-color-scheme: dark)" content="rgb(38,38,38)">
6
8
  <title></title>
7
9
  <base href="/">
8
10
  <style id="bootstrap-style" type="text/css">
@@ -32,9 +34,9 @@
32
34
  font: 300 16px/24px "Source Sans Pro", "Helvetica", sans-serif;
33
35
  height: 24px;
34
36
  text-align: center;
35
- color: rgb(164,164,164);
36
37
  transition-property: opacity, color, margin-top;
37
38
  transition-duration: .25s;
39
+ color: rgb(164,164,164);
38
40
  }
39
41
  #details {
40
42
  position: absolute;
@@ -47,9 +49,9 @@
47
49
  text-overflow: ellipsis;
48
50
  font: 300 16px/20px "Source Sans Pro", "Helvetica", sans-serif;
49
51
  text-align: center;
50
- color: rgb(192,192,192);
51
52
  transition: opacity linear .5s .5s;
52
53
  opacity: 0;
54
+ color: rgb(192,192,192);
53
55
  }
54
56
  #progress {
55
57
  opacity: 0;
@@ -61,17 +63,17 @@
61
63
  margin-left: -51px;
62
64
  margin-top: -12px;
63
65
  border-radius: 5px;
64
- background-color: rgba(245,245,245);
65
66
  height: 7px;
66
67
  overflow: hidden;
67
68
  transition-property: opacity;
68
69
  transition-duration: .25s;
70
+ background-color: rgba(245,245,245);
69
71
  box-shadow: inset 0 0 2px rgba(0,0,0,0.15);
70
72
  }
71
73
  #progress-bar {
72
- background-color: rgb(224,224,224);
73
74
  height: 100%;
74
75
  width: 0%;
76
+ background-color: rgb(224,224,224);
75
77
  }
76
78
  #splash.error #status {
77
79
  font-weight: 600;
@@ -79,6 +81,24 @@
79
81
  #splash.error #details {
80
82
  opacity: 1;
81
83
  }
84
+ @media (prefers-color-scheme: dark) {
85
+ #splash {
86
+ background-color: rgb(38,38,38);
87
+ }
88
+ #status {
89
+ color: rgb(128,128,128);
90
+ }
91
+ #details {
92
+ color: rgb(102,102,102);
93
+ }
94
+ #progress {
95
+ background-color: rgba(26,26,26);
96
+ box-shadow: inset 0 0 2px rgba(0,0,0,0.15);
97
+ }
98
+ #progress-bar {
99
+ background-color: rgb(80,80,80);
100
+ }
101
+ }
82
102
  </style>
83
103
  </head>
84
104
  <body>
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=10.10.0"
10
10
  },
11
11
  "name": "@breakside/jskit",
12
- "version": "2021.36.1",
12
+ "version": "2021.40.0",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"