@breakside/jskit 2021.36.0 → 2021.39.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 (105) 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/JSSpec.js +1 -1
  10. package/Frameworks/Foundation.jsframework/JS/JSSynchronizer.js +9 -1
  11. package/Frameworks/Foundation.jsframework/JS/JSURL.js +42 -3
  12. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  13. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  14. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  15. package/Info.json +2 -2
  16. package/Node/HTMLBuilder.js +10 -10
  17. package/Node/NodeBuilder.js +10 -7
  18. package/Node/io.breakside.jskit-bundle.js +4 -4
  19. package/Resources/doc-default.css +86 -0
  20. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  21. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  22. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  23. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  24. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  25. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  26. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  27. package/Root/Frameworks/DOM/Info.yaml +1 -1
  28. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  29. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  30. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  31. package/Root/Frameworks/Foundation/JSColor+HTML.js +11 -2
  32. package/Root/Frameworks/Foundation/JSColor.js +62 -26
  33. package/Root/Frameworks/Foundation/JSColorSpace.js +209 -1
  34. package/Root/Frameworks/Foundation/JSSpec.js +1 -1
  35. package/Root/Frameworks/Foundation/JSSynchronizer.js +9 -1
  36. package/Root/Frameworks/Foundation/JSURL.js +42 -3
  37. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  38. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  39. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  40. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  41. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  42. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  43. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  44. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  45. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  46. package/Root/Frameworks/ServerKit/SKValidatingObject.js +21 -0
  47. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  48. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  49. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  50. package/Root/Frameworks/UIKit/JSColor+UIKit.js +75 -0
  51. package/Root/Frameworks/UIKit/UIAccessibility.js +15 -0
  52. package/Root/Frameworks/UIKit/UIActivityIndicatorView.js +2 -1
  53. package/Root/Frameworks/UIKit/UIAlertController.js +4 -3
  54. package/Root/Frameworks/UIKit/UIAnimation.js +7 -13
  55. package/Root/Frameworks/UIKit/UIApplication.js +3 -0
  56. package/Root/Frameworks/UIKit/UIBasicAnimation.js +6 -0
  57. package/Root/Frameworks/UIKit/UIButton.js +48 -25
  58. package/Root/Frameworks/UIKit/UICheckbox.js +11 -22
  59. package/Root/Frameworks/UIKit/UIColorPanel.js +27 -15
  60. package/Root/Frameworks/UIKit/UIColorSpace.js +132 -0
  61. package/Root/Frameworks/UIKit/UIColorWell.js +18 -2
  62. package/Root/Frameworks/UIKit/UIControl.js +15 -4
  63. package/Root/Frameworks/UIKit/UIHTMLDisplayServer.js +1 -5
  64. package/Root/Frameworks/UIKit/UIHTMLTextField.js +3 -15
  65. package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +72 -1
  66. package/Root/Frameworks/UIKit/UIImageView.js +4 -0
  67. package/Root/Frameworks/UIKit/UIKit.js +2 -0
  68. package/Root/Frameworks/UIKit/UILabel.js +14 -2
  69. package/Root/Frameworks/UIKit/UILayer.js +29 -1
  70. package/Root/Frameworks/UIKit/UIListView.js +23 -12
  71. package/Root/Frameworks/UIKit/UIListViewCell.js +10 -2
  72. package/Root/Frameworks/UIKit/UIMenu.js +21 -13
  73. package/Root/Frameworks/UIKit/UIMenuBar.js +5 -4
  74. package/Root/Frameworks/UIKit/UIMenuView.js +9 -5
  75. package/Root/Frameworks/UIKit/UINavigationBar.js +8 -5
  76. package/Root/Frameworks/UIKit/UINavigationController.js +3 -2
  77. package/Root/Frameworks/UIKit/UIOutlineViewCell.js +2 -1
  78. package/Root/Frameworks/UIKit/UIPopupButton.js +13 -24
  79. package/Root/Frameworks/UIKit/UIPopupWindow.js +3 -2
  80. package/Root/Frameworks/UIKit/UIProgressIndicatorView.js +1 -1
  81. package/Root/Frameworks/UIKit/UIRadioGroup.js +11 -22
  82. package/Root/Frameworks/UIKit/UIScroller.js +4 -3
  83. package/Root/Frameworks/UIKit/UISegmentedControl.js +16 -15
  84. package/Root/Frameworks/UIKit/UISlider.js +20 -36
  85. package/Root/Frameworks/UIKit/UISplitView.js +40 -0
  86. package/Root/Frameworks/UIKit/UISplitViewController.js +7 -7
  87. package/Root/Frameworks/UIKit/UISplitViewDivider.js +9 -0
  88. package/Root/Frameworks/UIKit/UITabView.js +34 -31
  89. package/Root/Frameworks/UIKit/UITextEditor.js +2 -1
  90. package/Root/Frameworks/UIKit/UITextField.js +34 -23
  91. package/Root/Frameworks/UIKit/UITextLayer.js +5 -0
  92. package/Root/Frameworks/UIKit/UITokenField.js +3 -3
  93. package/Root/Frameworks/UIKit/UIToolbar.js +84 -38
  94. package/Root/Frameworks/UIKit/UIToolbarOverflow.svg +8 -0
  95. package/Root/Frameworks/UIKit/UITooltipWindow.js +38 -15
  96. package/Root/Frameworks/UIKit/UITraitCollection.js +21 -0
  97. package/Root/Frameworks/UIKit/UIUserInterface.js +6 -0
  98. package/Root/Frameworks/UIKit/UIWebView.js +3 -2
  99. package/Root/Frameworks/UIKit/UIWindow.js +139 -21
  100. package/Root/Frameworks/UIKit/UIWindowButtonCloseInactive.svg +1 -1
  101. package/Root/Frameworks/UIKit/UIWindowButtonCloseNormal.svg +1 -1
  102. package/Root/Frameworks/UIKit/UIWindowServer.js +72 -9
  103. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  104. package/Root/Templates/html/${PROJECT_NAME}/www/index.html +24 -4
  105. package/package.json +1 -1
@@ -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),
@@ -1089,7 +1090,19 @@ UIWindow.Styler = Object.create({}, {
1089
1090
  Object.defineProperty(this, 'custom', {configurable: true, value: styler});
1090
1091
  return styler;
1091
1092
  },
1092
- }
1093
+ },
1094
+
1095
+ tooltip: {
1096
+ configurable: true,
1097
+ get: function UIWindow_getTooltipStyler(){
1098
+ var styler = UITooltipWindowStyler.init();
1099
+ Object.defineProperty(this, 'tooltip', {configurable: true, value: styler});
1100
+ return styler;
1101
+ },
1102
+ set: function UIWindow_setTooltipStyler(styler){
1103
+ Object.defineProperty(this, 'tooltip', {configurable: true, value: styler});
1104
+ }
1105
+ },
1093
1106
 
1094
1107
  });
1095
1108
 
@@ -1111,7 +1124,7 @@ JSClass("UIWindowStyler", JSObject, {
1111
1124
  focusRingWidth: 3.5,
1112
1125
 
1113
1126
  init: function(){
1114
- this.focusRingColor = this.localCursorColor = JSColor.initWithRGBA(0, 128/255.0, 255/255.0, 0.6);
1127
+ this.focusRingColor = JSColor.highlight;
1115
1128
  },
1116
1129
 
1117
1130
  initializeWindow: function(window){
@@ -1202,24 +1215,19 @@ JSClass("UIWindowDefaultStyler", UIWindowStyler, {
1202
1215
 
1203
1216
  init: function(){
1204
1217
  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);
1218
+ this.activeTitleColor = JSColor.text;
1219
+ this.inactiveTitleColor = JSColor.text.colorWithAlpha(0.3);
1220
+ this.shadowColor = JSColor.windowShadow;
1221
+ this.backgroundColor = JSColor.window;
1222
+ this.titleBackgroundColor = JSColor.initWithUIStyles(JSColor.window.colorLightenedByPercentage(0.5), JSColor.window.colorLightenedByPercentage(0.05));
1223
+ this.contentSeparatorColor = JSColor.initWithUIStyles(JSColor.black.colorWithAlpha(0.1), JSColor.black.colorWithAlpha(0.8));
1215
1224
  this.closeButtonImages = {
1216
1225
  inactive: images.closeInactive,
1217
1226
  normal: images.closeNormal,
1218
1227
  over: images.closeOver,
1219
1228
  active: images.closeActive
1220
1229
  };
1221
- this.toolbarTitleColor = JSColor.initWithWhite(102/255);
1222
- this.toolbarDisabledTitleColor = JSColor.initWithWhite(204/255);
1230
+ this.toolbarTitleColor = JSColor.toolbarTitle;
1223
1231
  },
1224
1232
 
1225
1233
  initializeWindow: function(window){
@@ -1398,6 +1406,116 @@ JSClass("UIWindowDefaultStyler", UIWindowStyler, {
1398
1406
 
1399
1407
  });
1400
1408
 
1409
+ JSClass("UIWindowTitlelessStyler", UIWindowStyler, {
1410
+
1411
+ _titlebarSize: 22,
1412
+ _controlButtonSize: 12,
1413
+ shadowRadius: 40,
1414
+ inactiveShadowRadius: 25,
1415
+ cornerRadius: 6,
1416
+ backgroundColor: null,
1417
+ shadowColor: null,
1418
+ closeButtonImages: null,
1419
+
1420
+ init: function(){
1421
+ UIWindowDefaultStyler.$super.init.call(this);
1422
+ this.shadowColor = JSColor.windowShadow;
1423
+ this.backgroundColor = JSColor.window;
1424
+ this.closeButtonImages = {
1425
+ inactive: images.closeInactive,
1426
+ normal: images.closeNormal,
1427
+ over: images.closeOver,
1428
+ active: images.closeActive
1429
+ };
1430
+ this.toolbarTitleColor = JSColor.toolbarTitle;
1431
+ },
1432
+
1433
+ initializeWindow: function(window){
1434
+ UIWindowDefaultStyler.$super.initializeWindow.call(this, window);
1435
+ var closeButton = UIButton.initWithStyler(UIButton.Styler.custom);
1436
+ closeButton.setImageForState(this.closeButtonImages.normal, UIControl.State.normal);
1437
+ closeButton.setImageForState(this.closeButtonImages.over, UIControl.State.over);
1438
+ closeButton.setImageForState(this.closeButtonImages.active, UIControl.State.active);
1439
+ closeButton.addAction("close", window);
1440
+
1441
+ var controlsView = UIView.init();
1442
+ controlsView.addSubview(closeButton);
1443
+ window.addSubview(controlsView);
1444
+
1445
+ window.stylerProperties.controlsView = controlsView;
1446
+ window.stylerProperties.closeButton = closeButton;
1447
+ window.stylerProperties.toolbar = null;
1448
+
1449
+ window.shadowColor = this.shadowColor;
1450
+ window.shadowRadius = this.shadowRadius;
1451
+ window.cornerRadius = this.cornerRadius;
1452
+ window.backgroundColor = this.backgroundColor;
1453
+
1454
+ this.updateWindow(window);
1455
+ },
1456
+
1457
+ layoutWindow: function(window){
1458
+ UIWindowDefaultStyler.$super.layoutWindow.call(this, window);
1459
+ var controlsView = window.stylerProperties.controlsView;
1460
+ var closeButton = window.stylerProperties.closeButton;
1461
+ var toolbar = window.stylerProperties.toolbar;
1462
+ var bounds = window.bounds;
1463
+ var controlsHeight = this._controlButtonSize * 2;
1464
+ if (toolbar){
1465
+ controlsHeight = toolbar.frame.size.height;
1466
+ }
1467
+ var controlPadding = (controlsHeight - this._controlButtonSize) / 2;
1468
+ closeButton.frame = JSRect(controlPadding, controlPadding, this._controlButtonSize, this._controlButtonSize);
1469
+ controlsView.frame = JSRect(0, 0, controlsHeight, controlsHeight);
1470
+ var x = controlsView.bounds.size.width;
1471
+ if (window.contentView.isKindOfClass(UISplitView)){
1472
+ var splitView = window.contentView;
1473
+ x = splitView.leadingView.convertPointToView(JSPoint(splitView.leadingView.bounds.size.width, 0), window).x;
1474
+ }
1475
+ window.addSubview(controlsView);
1476
+ if (toolbar){
1477
+ toolbar.frame = JSRect(x, 0, bounds.size.width - x, toolbar.intrinsicSize.height);
1478
+ window.insertSubviewBelowSibling(toolbar, controlsView);
1479
+ }
1480
+ },
1481
+
1482
+ updateWindow: function(window){
1483
+ var closeButton = window.stylerProperties.closeButton;
1484
+ var controlsView = window.stylerProperties.controlsView;
1485
+ closeButton.hidden = !window.allowsClose;
1486
+
1487
+ if (window.isMainWindow || window.isKeyWindow){
1488
+ window.shadowRadius = this.shadowRadius;
1489
+ }else{
1490
+ window.shadowRadius = this.inactiveShadowRadius;
1491
+ }
1492
+ if (window.isMainWindow){
1493
+ closeButton.setImageForState(this.closeButtonImages.normal, UIControl.State.normal);
1494
+ }else{
1495
+ closeButton.setImageForState(this.closeButtonImages.inactive, UIControl.State.normal);
1496
+ }
1497
+
1498
+ if (window.toolbar){
1499
+ if (window.stylerProperties.toolbar && window.stylerProperties.toolbar !== window.toolbar){
1500
+ window.stylerProperties.toolbar.removeFromSuperview();
1501
+ window.stylerProperties.toolbar = null;
1502
+ }
1503
+ if (window.stylerProperties.toolbar === null){
1504
+ window.stylerProperties.toolbar = window.toolbar;
1505
+ window.insertSubviewBelowSibling(window.stylerProperties.toolbar, controlsView);
1506
+ }
1507
+ }else{
1508
+ if (window.stylerProperties.toolbar !== null){
1509
+ window.stylerProperties.toolbar.removeFromSuperview();
1510
+ window.stylerProperties.toolbar = null;
1511
+ }
1512
+ }
1513
+
1514
+ window.contentInsets = JSInsets.Zero;
1515
+ },
1516
+
1517
+ });
1518
+
1401
1519
  JSClass("UIWindowCustomStyler", UIWindowStyler, {
1402
1520
 
1403
1521
  });
@@ -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.0
3
+ JSBundleVersion: 2021.39.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.0",
12
+ "version": "2021.39.0",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"