@breakside/jskit 2021.37.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 (93) 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/io.breakside.JSKit.Foundation-bundle.js +2 -2
  11. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  12. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  13. package/Info.json +2 -2
  14. package/Node/io.breakside.jskit-bundle.js +4 -4
  15. package/Resources/doc-default.css +86 -0
  16. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  17. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  18. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  19. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  20. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  21. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  22. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  23. package/Root/Frameworks/DOM/Info.yaml +1 -1
  24. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  25. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  26. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  27. package/Root/Frameworks/Foundation/JSColor+HTML.js +11 -2
  28. package/Root/Frameworks/Foundation/JSColor.js +62 -26
  29. package/Root/Frameworks/Foundation/JSColorSpace.js +209 -1
  30. package/Root/Frameworks/Foundation/JSSpec.js +1 -1
  31. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  32. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  33. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  34. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  35. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  36. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  37. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  38. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  39. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  40. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  41. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  42. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  43. package/Root/Frameworks/UIKit/JSColor+UIKit.js +75 -0
  44. package/Root/Frameworks/UIKit/UIAccessibility.js +15 -0
  45. package/Root/Frameworks/UIKit/UIActivityIndicatorView.js +2 -1
  46. package/Root/Frameworks/UIKit/UIAlertController.js +4 -3
  47. package/Root/Frameworks/UIKit/UIAnimation.js +7 -13
  48. package/Root/Frameworks/UIKit/UIApplication.js +3 -0
  49. package/Root/Frameworks/UIKit/UIBasicAnimation.js +6 -0
  50. package/Root/Frameworks/UIKit/UIButton.js +17 -25
  51. package/Root/Frameworks/UIKit/UICheckbox.js +11 -22
  52. package/Root/Frameworks/UIKit/UIColorPanel.js +27 -15
  53. package/Root/Frameworks/UIKit/UIColorSpace.js +132 -0
  54. package/Root/Frameworks/UIKit/UIColorWell.js +18 -2
  55. package/Root/Frameworks/UIKit/UIHTMLDisplayServer.js +1 -5
  56. package/Root/Frameworks/UIKit/UIHTMLTextField.js +3 -15
  57. package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +72 -1
  58. package/Root/Frameworks/UIKit/UIImageView.js +4 -0
  59. package/Root/Frameworks/UIKit/UIKit.js +2 -0
  60. package/Root/Frameworks/UIKit/UILabel.js +14 -2
  61. package/Root/Frameworks/UIKit/UILayer.js +29 -1
  62. package/Root/Frameworks/UIKit/UIListView.js +10 -9
  63. package/Root/Frameworks/UIKit/UIMenu.js +10 -9
  64. package/Root/Frameworks/UIKit/UIMenuBar.js +5 -4
  65. package/Root/Frameworks/UIKit/UIMenuView.js +8 -4
  66. package/Root/Frameworks/UIKit/UINavigationBar.js +8 -5
  67. package/Root/Frameworks/UIKit/UINavigationController.js +3 -2
  68. package/Root/Frameworks/UIKit/UIOutlineViewCell.js +2 -1
  69. package/Root/Frameworks/UIKit/UIPopupButton.js +13 -24
  70. package/Root/Frameworks/UIKit/UIPopupWindow.js +3 -2
  71. package/Root/Frameworks/UIKit/UIProgressIndicatorView.js +1 -1
  72. package/Root/Frameworks/UIKit/UIRadioGroup.js +11 -22
  73. package/Root/Frameworks/UIKit/UIScroller.js +4 -3
  74. package/Root/Frameworks/UIKit/UISegmentedControl.js +16 -15
  75. package/Root/Frameworks/UIKit/UISlider.js +20 -36
  76. package/Root/Frameworks/UIKit/UITabView.js +34 -31
  77. package/Root/Frameworks/UIKit/UITextEditor.js +2 -1
  78. package/Root/Frameworks/UIKit/UITextField.js +13 -14
  79. package/Root/Frameworks/UIKit/UITextLayer.js +5 -0
  80. package/Root/Frameworks/UIKit/UITokenField.js +3 -3
  81. package/Root/Frameworks/UIKit/UIToolbar.js +84 -38
  82. package/Root/Frameworks/UIKit/UIToolbarOverflow.svg +8 -0
  83. package/Root/Frameworks/UIKit/UITooltipWindow.js +5 -5
  84. package/Root/Frameworks/UIKit/UITraitCollection.js +21 -0
  85. package/Root/Frameworks/UIKit/UIUserInterface.js +6 -0
  86. package/Root/Frameworks/UIKit/UIWebView.js +3 -2
  87. package/Root/Frameworks/UIKit/UIWindow.js +18 -24
  88. package/Root/Frameworks/UIKit/UIWindowButtonCloseInactive.svg +1 -1
  89. package/Root/Frameworks/UIKit/UIWindowButtonCloseNormal.svg +1 -1
  90. package/Root/Frameworks/UIKit/UIWindowServer.js +53 -8
  91. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  92. package/Root/Templates/html/${PROJECT_NAME}/www/index.html +24 -4
  93. package/package.json +1 -1
@@ -119,7 +119,7 @@ JSClass('UIWindow', UIView, {
119
119
  _commonWindowInit: function(){
120
120
  this.window = this;
121
121
  if (this.backgroundColor === null){
122
- this.backgroundColor = JSColor.white;
122
+ this.backgroundColor = JSColor.background;
123
123
  }
124
124
  this.clipsToBounds = true;
125
125
  if (this._contentView === null){
@@ -135,8 +135,7 @@ JSClass('UIWindow', UIView, {
135
135
  this._styler = UIWindow.Styler.default;
136
136
  }
137
137
  }
138
- this._traitCollection = UITraitCollection.initWithSize(this.frame.size);
139
- this._traitCollection.accessibilityContrast = this.windowServer.contrast;
138
+ this._traitCollection = this.windowServer.traitCollection.traitsWithSize(this.bounds.size);
140
139
  this.stylerProperties = {};
141
140
  this._styler.initializeWindow(this);
142
141
  },
@@ -179,7 +178,7 @@ JSClass('UIWindow', UIView, {
179
178
 
180
179
  setToolbar: function(toolbar){
181
180
  this._toolbar = toolbar;
182
- this._styler.updateWindow();
181
+ this._styler.updateWindow(this);
183
182
  this.setNeedsLayout();
184
183
  },
185
184
 
@@ -309,9 +308,10 @@ JSClass('UIWindow', UIView, {
309
308
  // MARK: Traits
310
309
 
311
310
  layerDidChangeSize: function(){
312
- var traits = UITraitCollection.initWithSize(this.bounds.size);
313
- traits.contrast = this.windowServer.contrast;
314
- this._setTraitCollection(traits);
311
+ if (this._traitCollection !== null){
312
+ var traits = this._traitCollection.traitsWithSize(this.bounds.size);
313
+ this._setTraitCollection(traits);
314
+ }
315
315
  },
316
316
 
317
317
  traitCollection: JSReadOnlyProperty('_traitCollection', null),
@@ -1124,7 +1124,7 @@ JSClass("UIWindowStyler", JSObject, {
1124
1124
  focusRingWidth: 3.5,
1125
1125
 
1126
1126
  init: function(){
1127
- this.focusRingColor = this.localCursorColor = JSColor.initWithRGBA(0, 128/255.0, 255/255.0, 0.6);
1127
+ this.focusRingColor = JSColor.highlight;
1128
1128
  },
1129
1129
 
1130
1130
  initializeWindow: function(window){
@@ -1215,24 +1215,19 @@ JSClass("UIWindowDefaultStyler", UIWindowStyler, {
1215
1215
 
1216
1216
  init: function(){
1217
1217
  UIWindowDefaultStyler.$super.init.call(this);
1218
- this.activeTitleColor = JSColor.initWithWhite(51/255);
1219
- this.inactiveTitleColor = JSColor.initWithWhite(192/255);
1220
- this.shadowColor = JSColor.initWithRGBA(0, 0, 0, 0.4);
1221
- this.backgroundColor = JSColor.initWithRGBA(240/255,240/255,240/255,1);
1222
- this.titleBackgroundColor = null;
1223
- this.titleBackgroundGradient = JSGradient.initWithStops(
1224
- 0, JSColor.initWithRGBA(230/255,230/255,230/255,1),
1225
- 1, JSColor.initWithRGBA(204/255,204/255,204/255,1)
1226
- );
1227
- 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));
1228
1224
  this.closeButtonImages = {
1229
1225
  inactive: images.closeInactive,
1230
1226
  normal: images.closeNormal,
1231
1227
  over: images.closeOver,
1232
1228
  active: images.closeActive
1233
1229
  };
1234
- this.toolbarTitleColor = JSColor.initWithWhite(102/255);
1235
- this.toolbarDisabledTitleColor = JSColor.initWithWhite(204/255);
1230
+ this.toolbarTitleColor = JSColor.toolbarTitle;
1236
1231
  },
1237
1232
 
1238
1233
  initializeWindow: function(window){
@@ -1424,16 +1419,15 @@ JSClass("UIWindowTitlelessStyler", UIWindowStyler, {
1424
1419
 
1425
1420
  init: function(){
1426
1421
  UIWindowDefaultStyler.$super.init.call(this);
1427
- this.shadowColor = JSColor.initWithRGBA(0, 0, 0, 0.4);
1428
- this.backgroundColor = JSColor.initWithRGBA(240/255,240/255,240/255,1);
1422
+ this.shadowColor = JSColor.windowShadow;
1423
+ this.backgroundColor = JSColor.window;
1429
1424
  this.closeButtonImages = {
1430
1425
  inactive: images.closeInactive,
1431
1426
  normal: images.closeNormal,
1432
1427
  over: images.closeOver,
1433
1428
  active: images.closeActive
1434
1429
  };
1435
- this.toolbarTitleColor = JSColor.initWithWhite(102/255);
1436
- this.toolbarDisabledTitleColor = JSColor.initWithWhite(204/255);
1430
+ this.toolbarTitleColor = JSColor.toolbarTitle;
1437
1431
  },
1438
1432
 
1439
1433
  initializeWindow: function(window){
@@ -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){
@@ -1004,17 +1009,57 @@ JSClass("UIWindowServer", JSObject, {
1004
1009
  }
1005
1010
  },
1006
1011
 
1007
- setContrast: function(contrast){
1008
- 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)){
1009
1022
  return;
1010
1023
  }
1011
- this._contrast = contrast;
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){
1040
+ return;
1041
+ }
1042
+ this._needsRedisplay = true;
1043
+ var i, l;
1044
+ var layers = [];
1012
1045
  var window;
1013
- for (var i = 0, l = this.windowStack.length; i < l; ++i){
1046
+ for (i = 0, l = this.windowStack.length; i < l; ++i){
1014
1047
  window = this.windowStack[i];
1015
- 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
+ }
1016
1058
  }
1017
- }
1059
+ this.displayServer.schedule(function(){
1060
+ this._needsRedisplay = false;
1061
+ }, this);
1062
+ },
1018
1063
 
1019
1064
  });
1020
1065
 
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKitTesting
3
- JSBundleVersion: 2021.37.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.37.0",
12
+ "version": "2021.39.0",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"