@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.
- package/Frameworks/DOM.jsframework/Info.json +2 -2
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSColor+HTML.js +11 -2
- package/Frameworks/Foundation.jsframework/JS/JSColor.js +62 -26
- package/Frameworks/Foundation.jsframework/JS/JSColorSpace.js +209 -1
- package/Frameworks/Foundation.jsframework/JS/JSSpec.js +1 -1
- package/Frameworks/Foundation.jsframework/JS/JSSynchronizer.js +9 -1
- package/Frameworks/Foundation.jsframework/JS/JSURL.js +42 -3
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Info.json +2 -2
- package/Node/HTMLBuilder.js +10 -10
- package/Node/NodeBuilder.js +10 -7
- package/Node/io.breakside.jskit-bundle.js +4 -4
- package/Resources/doc-default.css +86 -0
- package/Root/Frameworks/APIKit/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/CSSOM/Info.yaml +1 -1
- package/Root/Frameworks/ChartKit/Info.yaml +1 -1
- package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
- package/Root/Frameworks/DBKit/Info.yaml +1 -1
- package/Root/Frameworks/DOM/Info.yaml +1 -1
- package/Root/Frameworks/Dispatch/Info.yaml +1 -1
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSColor+HTML.js +11 -2
- package/Root/Frameworks/Foundation/JSColor.js +62 -26
- package/Root/Frameworks/Foundation/JSColorSpace.js +209 -1
- package/Root/Frameworks/Foundation/JSSpec.js +1 -1
- package/Root/Frameworks/Foundation/JSSynchronizer.js +9 -1
- package/Root/Frameworks/Foundation/JSURL.js +42 -3
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
- package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
- package/Root/Frameworks/PDFKit/Info.yaml +1 -1
- package/Root/Frameworks/QRKit/Info.yaml +1 -1
- package/Root/Frameworks/SearchKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/SKValidatingObject.js +21 -0
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/JSColor+UIKit.js +75 -0
- package/Root/Frameworks/UIKit/UIAccessibility.js +15 -0
- package/Root/Frameworks/UIKit/UIActivityIndicatorView.js +2 -1
- package/Root/Frameworks/UIKit/UIAlertController.js +4 -3
- package/Root/Frameworks/UIKit/UIAnimation.js +7 -13
- package/Root/Frameworks/UIKit/UIApplication.js +3 -0
- package/Root/Frameworks/UIKit/UIBasicAnimation.js +6 -0
- package/Root/Frameworks/UIKit/UIButton.js +48 -25
- package/Root/Frameworks/UIKit/UICheckbox.js +11 -22
- package/Root/Frameworks/UIKit/UIColorPanel.js +27 -15
- package/Root/Frameworks/UIKit/UIColorSpace.js +132 -0
- package/Root/Frameworks/UIKit/UIColorWell.js +18 -2
- package/Root/Frameworks/UIKit/UIControl.js +15 -4
- package/Root/Frameworks/UIKit/UIHTMLDisplayServer.js +1 -5
- package/Root/Frameworks/UIKit/UIHTMLTextField.js +3 -15
- package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +72 -1
- package/Root/Frameworks/UIKit/UIImageView.js +4 -0
- package/Root/Frameworks/UIKit/UIKit.js +2 -0
- package/Root/Frameworks/UIKit/UILabel.js +14 -2
- package/Root/Frameworks/UIKit/UILayer.js +29 -1
- package/Root/Frameworks/UIKit/UIListView.js +23 -12
- package/Root/Frameworks/UIKit/UIListViewCell.js +10 -2
- package/Root/Frameworks/UIKit/UIMenu.js +21 -13
- package/Root/Frameworks/UIKit/UIMenuBar.js +5 -4
- package/Root/Frameworks/UIKit/UIMenuView.js +9 -5
- package/Root/Frameworks/UIKit/UINavigationBar.js +8 -5
- package/Root/Frameworks/UIKit/UINavigationController.js +3 -2
- package/Root/Frameworks/UIKit/UIOutlineViewCell.js +2 -1
- package/Root/Frameworks/UIKit/UIPopupButton.js +13 -24
- package/Root/Frameworks/UIKit/UIPopupWindow.js +3 -2
- package/Root/Frameworks/UIKit/UIProgressIndicatorView.js +1 -1
- package/Root/Frameworks/UIKit/UIRadioGroup.js +11 -22
- package/Root/Frameworks/UIKit/UIScroller.js +4 -3
- package/Root/Frameworks/UIKit/UISegmentedControl.js +16 -15
- package/Root/Frameworks/UIKit/UISlider.js +20 -36
- package/Root/Frameworks/UIKit/UISplitView.js +40 -0
- package/Root/Frameworks/UIKit/UISplitViewController.js +7 -7
- package/Root/Frameworks/UIKit/UISplitViewDivider.js +9 -0
- package/Root/Frameworks/UIKit/UITabView.js +34 -31
- package/Root/Frameworks/UIKit/UITextEditor.js +2 -1
- package/Root/Frameworks/UIKit/UITextField.js +34 -23
- package/Root/Frameworks/UIKit/UITextLayer.js +5 -0
- package/Root/Frameworks/UIKit/UITokenField.js +3 -3
- package/Root/Frameworks/UIKit/UIToolbar.js +84 -38
- package/Root/Frameworks/UIKit/UIToolbarOverflow.svg +8 -0
- package/Root/Frameworks/UIKit/UITooltipWindow.js +38 -15
- package/Root/Frameworks/UIKit/UITraitCollection.js +21 -0
- package/Root/Frameworks/UIKit/UIUserInterface.js +6 -0
- package/Root/Frameworks/UIKit/UIWebView.js +3 -2
- package/Root/Frameworks/UIKit/UIWindow.js +139 -21
- package/Root/Frameworks/UIKit/UIWindowButtonCloseInactive.svg +1 -1
- package/Root/Frameworks/UIKit/UIWindowButtonCloseNormal.svg +1 -1
- package/Root/Frameworks/UIKit/UIWindowServer.js +72 -9
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/Root/Templates/html/${PROJECT_NAME}/www/index.html +24 -4
- package/package.json +1 -1
|
@@ -65,6 +65,7 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
65
65
|
rootElement: null,
|
|
66
66
|
domDocument: null,
|
|
67
67
|
domWindow: null,
|
|
68
|
+
themeColorElement: null,
|
|
68
69
|
_screenClientOrigin: null,
|
|
69
70
|
|
|
70
71
|
setupRenderingEnvironment: function(){
|
|
@@ -85,11 +86,24 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
85
86
|
body.style.overflow = 'hidden';
|
|
86
87
|
body.style.borderLeft = "env(safe-area-inset-left) solid black";
|
|
87
88
|
body.style.borderRight = "env(safe-area-inset-right) solid black";
|
|
89
|
+
var head = this.domDocument.head;
|
|
90
|
+
var child;
|
|
91
|
+
for (var i = head.childNodes.length - 1; i >= 0; --i){
|
|
92
|
+
child = head.childNodes[i];
|
|
93
|
+
if (child.nodeType == Node.ELEMENT_NODE){
|
|
94
|
+
if (child.tagName.toLowerCase() === "meta" && child.getAttribute("name") == "theme-color"){
|
|
95
|
+
head.removeChild(child);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
this.themeColorElement = head.appendChild(this.domDocument.createElement("meta"));
|
|
100
|
+
this.themeColorElement.setAttribute("name", "theme-color");
|
|
88
101
|
}else{
|
|
89
102
|
var style = this.domWindow.getComputedStyle(this.rootElement);
|
|
90
103
|
if (style.position != 'absolute' && style.position != 'relative' && style.position != 'fixed'){
|
|
91
104
|
this.rootElement.style.position = 'relative';
|
|
92
105
|
}
|
|
106
|
+
this.themeColorElement = null;
|
|
93
107
|
}
|
|
94
108
|
this.rootElement.style.userSelect = 'none';
|
|
95
109
|
this.rootElement.style.mozUserSelect = 'none';
|
|
@@ -267,16 +281,21 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
267
281
|
// --------------------------------------------------------------------
|
|
268
282
|
// MARK: - Media Queries
|
|
269
283
|
|
|
284
|
+
darkColorSchemeListener: null,
|
|
270
285
|
highContrastListener: null,
|
|
271
286
|
reducedMotionListener: null,
|
|
272
287
|
|
|
273
288
|
setupMediaListeners: function(){
|
|
289
|
+
this.darkColorSchemeListener = this.handleDarkColorSchemeChanged.bind(this);
|
|
290
|
+
this.darkColorSchemeQuery = this.domWindow.matchMedia("(prefers-color-scheme: dark)");
|
|
291
|
+
this.darkColorSchemeQuery.addListener(this.darkColorSchemeListener);
|
|
274
292
|
this.highContrastListener = this.handleHighContrastChanged.bind(this);
|
|
275
293
|
this.highContrastQuery = this.domWindow.matchMedia("(prefers-contrast: more)");
|
|
276
294
|
this.highContrastQuery.addListener(this.highContrastListener);
|
|
277
295
|
this.reducedMotionListener = this.handleReducedMotionChanged.bind(this);
|
|
278
296
|
this.reducedMotionQuery = this.domWindow.matchMedia("(prefers-reduced-motion)");
|
|
279
297
|
this.reducedMotionQuery.addListener(this.reducedMotionListener);
|
|
298
|
+
this.handleDarkColorSchemeChanged(this.darkColorSchemeQuery);
|
|
280
299
|
this.handleHighContrastChanged(this.highContrastQuery);
|
|
281
300
|
this.handleReducedMotionChanged(this.reducedMotionQuery);
|
|
282
301
|
},
|
|
@@ -286,8 +305,16 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
286
305
|
this.reducedMotionQuery.removeListener(this.reducedMotionListener);
|
|
287
306
|
},
|
|
288
307
|
|
|
308
|
+
handleDarkColorSchemeChanged: function(query){
|
|
309
|
+
var style = query.matches ? UIUserInterface.Style.dark : UIUserInterface.Style.light;
|
|
310
|
+
this.traitCollection = this._traitCollection.traitsWithUserInterfaceStyle(style);
|
|
311
|
+
this.updateThemeColorElement();
|
|
312
|
+
},
|
|
313
|
+
|
|
289
314
|
handleHighContrastChanged: function(query){
|
|
290
|
-
|
|
315
|
+
var contrast = query.matches ? UIUserInterface.Contrast.high : UIUserInterface.Contrast.normal;
|
|
316
|
+
this.traitCollection = this._traitCollection.traitsWithContrast(contrast);
|
|
317
|
+
this.updateThemeColorElement();
|
|
291
318
|
},
|
|
292
319
|
|
|
293
320
|
handleReducedMotionChanged: function(query){
|
|
@@ -872,6 +899,50 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
872
899
|
}
|
|
873
900
|
},
|
|
874
901
|
|
|
902
|
+
orderWindowFront: function(window){
|
|
903
|
+
UIHTMLWindowServer.$super.orderWindowFront.call(this, window);
|
|
904
|
+
if (window.subviewIndex === 0){
|
|
905
|
+
this.updateThemeColorElement();
|
|
906
|
+
}
|
|
907
|
+
},
|
|
908
|
+
|
|
909
|
+
// --------------------------------------------------------------------
|
|
910
|
+
// MARK: - Menu Bar
|
|
911
|
+
|
|
912
|
+
setMenuBar: function(menuBar){
|
|
913
|
+
UIHTMLWindowServer.$super.setMenuBar.call(this, menuBar);
|
|
914
|
+
this.updateThemeColorElement();
|
|
915
|
+
},
|
|
916
|
+
|
|
917
|
+
updateThemeColorElement: function(){
|
|
918
|
+
if (this.themeColorElement === null){
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
var window = this._menuBar;
|
|
922
|
+
var color = null;
|
|
923
|
+
if (window === null && this.windowStack.length > 0){
|
|
924
|
+
window = this.windowStack[0];
|
|
925
|
+
}
|
|
926
|
+
if (window !== null){
|
|
927
|
+
var vc = window.contentViewController;
|
|
928
|
+
if ((vc instanceof UISplitViewController) && vc.view.mainHidden){
|
|
929
|
+
vc = vc.leadingViewController;
|
|
930
|
+
}
|
|
931
|
+
if (vc instanceof UINavigationController){
|
|
932
|
+
color = vc.navigationBar.backgroundColor;
|
|
933
|
+
}else if (window.backgroundGradient !== null){
|
|
934
|
+
color = window.backgroundGradient.stops[0].color;
|
|
935
|
+
}else if (window.backgroundColor !== null){
|
|
936
|
+
color = window.backgroundColor;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
if (color !== null){
|
|
940
|
+
this.themeColorElement.setAttribute("content", color.cssString());
|
|
941
|
+
}else{
|
|
942
|
+
this.themeColorElement.setAttribute("content", JSColor.background);
|
|
943
|
+
}
|
|
944
|
+
},
|
|
945
|
+
|
|
875
946
|
// --------------------------------------------------------------------
|
|
876
947
|
// MARK: - Screen Updates
|
|
877
948
|
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
// #import "UIView.js"
|
|
17
17
|
// #import "UIImageLayer.js"
|
|
18
|
+
// #import "JSColor+UIKit.js"
|
|
18
19
|
'use strict';
|
|
19
20
|
|
|
20
21
|
JSClass("UIImageView", UIView, {
|
|
@@ -32,6 +33,7 @@ JSClass("UIImageView", UIView, {
|
|
|
32
33
|
initWithFrame: function(frame){
|
|
33
34
|
UIImageView.$super.initWithFrame.call(this, frame);
|
|
34
35
|
this._contentInsets = JSInsets.Zero;
|
|
36
|
+
this.templateColor = JSColor.text;
|
|
35
37
|
this._commonImageViewInit();
|
|
36
38
|
},
|
|
37
39
|
|
|
@@ -39,6 +41,8 @@ JSClass("UIImageView", UIView, {
|
|
|
39
41
|
UIImageView.$super.initWithSpec.call(this, spec);
|
|
40
42
|
if (spec.containsKey('templateColor')){
|
|
41
43
|
this.templateColor = spec.valueForKey("templateColor", JSColor);
|
|
44
|
+
}else{
|
|
45
|
+
this.templateColor = JSColor.text;
|
|
42
46
|
}
|
|
43
47
|
if (spec.containsKey("automaticRenderMode")){
|
|
44
48
|
this.automaticRenderMode = spec.valueForKey("automaticRenderMode", JSImage.RenderMode);
|
|
@@ -38,7 +38,8 @@ JSClass('UILabel', UIView, {
|
|
|
38
38
|
initWithFrame: function(frame){
|
|
39
39
|
UILabel.$super.initWithFrame.call(this, frame);
|
|
40
40
|
this.maximumNumberOfLines = 1;
|
|
41
|
-
this.
|
|
41
|
+
this.textColor = JSColor.text;
|
|
42
|
+
this._selectionColor = JSColor.initWithUIStyles(JSColor.black.colorWithAlpha(0.2), JSColor.white.colorWithAlpha(0.2));
|
|
42
43
|
},
|
|
43
44
|
|
|
44
45
|
initWithSpec: function(spec){
|
|
@@ -51,6 +52,8 @@ JSClass('UILabel', UIView, {
|
|
|
51
52
|
}
|
|
52
53
|
if (spec.containsKey("textColor")){
|
|
53
54
|
this.textColor = spec.valueForKey("textColor", JSColor);
|
|
55
|
+
}else{
|
|
56
|
+
this.textColor = JSColor.text;
|
|
54
57
|
}
|
|
55
58
|
if (spec.containsKey("textAlignment")){
|
|
56
59
|
this.textAlignment = spec.valueForKey("textAlignment", JSTextAlignment);
|
|
@@ -72,7 +75,16 @@ JSClass('UILabel', UIView, {
|
|
|
72
75
|
if (spec.containsKey("selectionColor")){
|
|
73
76
|
this._selectionColor = spec.valueForKey("selectionColor");
|
|
74
77
|
}else{
|
|
75
|
-
this._selectionColor = JSColor.white.colorWithAlpha(0.2);
|
|
78
|
+
this._selectionColor = JSColor.initWithUIStyles(JSColor.black.colorWithAlpha(0.2), JSColor.white.colorWithAlpha(0.2));
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
tooltip: JSDynamicProperty("_tooltip"),
|
|
83
|
+
|
|
84
|
+
setTooltip: function(tooltip){
|
|
85
|
+
this._tooltip = tooltip;
|
|
86
|
+
if (this._tooltip !== null){
|
|
87
|
+
this.userInteractionEnabled = true;
|
|
76
88
|
}
|
|
77
89
|
},
|
|
78
90
|
|
|
@@ -686,6 +686,16 @@ JSClass("UILayer", JSObject, {
|
|
|
686
686
|
}
|
|
687
687
|
},
|
|
688
688
|
|
|
689
|
+
setNeedsRedisplay: function(){
|
|
690
|
+
this.didChangeProperty("backgroundColor");
|
|
691
|
+
this.didChangeProperty("backgroundGradient");
|
|
692
|
+
this.didChangeProperty("borderColor");
|
|
693
|
+
this.didChangeProperty("shadowColor");
|
|
694
|
+
if (this.performsCustomDrawing){
|
|
695
|
+
this.setNeedsDisplay();
|
|
696
|
+
}
|
|
697
|
+
},
|
|
698
|
+
|
|
689
699
|
displayIfNeeded: function(){
|
|
690
700
|
if (this._displayServer !== null){
|
|
691
701
|
this._displayServer.displayLayerIfNeeded(this);
|
|
@@ -699,6 +709,15 @@ JSClass("UILayer", JSObject, {
|
|
|
699
709
|
}
|
|
700
710
|
},
|
|
701
711
|
|
|
712
|
+
performsCustomDrawing: JSReadOnlyProperty(),
|
|
713
|
+
|
|
714
|
+
getPerformsCustomDrawing: function(){
|
|
715
|
+
if (this.delegate && this.delegate.drawLayerInContext){
|
|
716
|
+
return true;
|
|
717
|
+
}
|
|
718
|
+
return this.drawInContext !== UILayer.prototype.drawInContext;
|
|
719
|
+
},
|
|
720
|
+
|
|
702
721
|
drawInContext: function(context){
|
|
703
722
|
},
|
|
704
723
|
|
|
@@ -714,7 +733,16 @@ JSClass("UILayer", JSObject, {
|
|
|
714
733
|
if (this._displayServer !== null){
|
|
715
734
|
var displayContext = this._displayServer.contextForLayer(this);
|
|
716
735
|
if (context === displayContext){
|
|
717
|
-
this
|
|
736
|
+
var layers = [this];
|
|
737
|
+
var layer;
|
|
738
|
+
var i, l;
|
|
739
|
+
while (layers.length > 0){
|
|
740
|
+
layer = layers.shift();
|
|
741
|
+
layer.setNeedsRedisplay();
|
|
742
|
+
for (i = 0, l = layer.sublayers.length; i < l; ++i){
|
|
743
|
+
layers.push(layer.sublayers[i]);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
718
746
|
return;
|
|
719
747
|
}
|
|
720
748
|
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
// #import "UIPlatform.js"
|
|
19
19
|
// #import "UIImageView.js"
|
|
20
20
|
// #import "UIViewPropertyAnimator.js"
|
|
21
|
+
// #import "JSColor+UIKit.js"
|
|
21
22
|
/* global UIListViewCell, UIListViewHeaderFooterView */
|
|
22
23
|
'use strict';
|
|
23
24
|
|
|
@@ -132,6 +133,9 @@ JSClass("UIListView", UIScrollView, {
|
|
|
132
133
|
if (spec.containsKey('allowsMultipleSelection')){
|
|
133
134
|
this.allowsMultipleSelection = spec.valueForKey("allowsMultipleSelection");
|
|
134
135
|
}
|
|
136
|
+
if (spec.containsKey('allowsEmptySelection')){
|
|
137
|
+
this.allowsEmptySelection = spec.valueForKey("allowsEmptySelection");
|
|
138
|
+
}
|
|
135
139
|
if (spec.containsKey('headersStickToTop')){
|
|
136
140
|
this._headersStickToTop = spec.valueForKey("headersStickToTop");
|
|
137
141
|
}
|
|
@@ -1708,6 +1712,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
1708
1712
|
// MARK: - Selecting cells
|
|
1709
1713
|
|
|
1710
1714
|
allowsMultipleSelection: false,
|
|
1715
|
+
allowsEmptySelection: true,
|
|
1711
1716
|
selectedIndexPaths: JSDynamicProperty('_selectedIndexPaths', null),
|
|
1712
1717
|
selectedIndexPath: JSDynamicProperty(),
|
|
1713
1718
|
contextSelectedIndexPaths: JSReadOnlyProperty('_contextSelectedIndexPaths', null),
|
|
@@ -1730,6 +1735,9 @@ JSClass("UIListView", UIScrollView, {
|
|
|
1730
1735
|
return;
|
|
1731
1736
|
}
|
|
1732
1737
|
}
|
|
1738
|
+
if (!this.allowsEmptySelection && indexPaths.length === 0){
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1733
1741
|
this._selectedIndexPaths = indexPaths;
|
|
1734
1742
|
if (this._edit !== null){
|
|
1735
1743
|
this._edit.selectionChanged = true;
|
|
@@ -1816,6 +1824,9 @@ JSClass("UIListView", UIScrollView, {
|
|
|
1816
1824
|
if (index === null){
|
|
1817
1825
|
return;
|
|
1818
1826
|
}
|
|
1827
|
+
if (!this.allowsEmptySelection && this._selectedIndexPaths.length === 1){
|
|
1828
|
+
return;
|
|
1829
|
+
}
|
|
1819
1830
|
this._selectedIndexPaths.splice(index, 1);
|
|
1820
1831
|
this._updateSelectedIndexPaths(options);
|
|
1821
1832
|
},
|
|
@@ -3019,22 +3030,22 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
|
|
|
3019
3030
|
this.headerFont = JSFont.systemFontOfSize(JSFont.Size.normal).fontWithWeight(JSFont.Weight.bold);
|
|
3020
3031
|
}
|
|
3021
3032
|
if (this.cellTextColor === null){
|
|
3022
|
-
this.cellTextColor = JSColor.
|
|
3033
|
+
this.cellTextColor = JSColor.text;
|
|
3023
3034
|
}
|
|
3024
3035
|
if (this.cellDetailTextColor === null){
|
|
3025
|
-
this.cellDetailTextColor =
|
|
3036
|
+
this.cellDetailTextColor = JSColor.secondaryText;
|
|
3026
3037
|
}
|
|
3027
3038
|
if (this.cellDetailFont === null && this.cellFont !== null){
|
|
3028
|
-
this.cellDetailFont = this.cellFont.fontWithPointSize(
|
|
3039
|
+
this.cellDetailFont = this.cellFont.fontWithPointSize(JSFont.Size.detail);
|
|
3029
3040
|
}
|
|
3030
3041
|
if (this.selectedCellBackgroundColor === null){
|
|
3031
|
-
this.selectedCellBackgroundColor = JSColor.
|
|
3042
|
+
this.selectedCellBackgroundColor = JSColor.highlight;
|
|
3032
3043
|
}
|
|
3033
3044
|
if (this.contextSelectedCellBorderColor === null){
|
|
3034
3045
|
this.contextSelectedCellBorderColor = this.selectedCellBackgroundColor.colorDarkenedByPercentage(0.5);
|
|
3035
3046
|
}
|
|
3036
3047
|
if (this.headerTextColor === null){
|
|
3037
|
-
this.headerTextColor = JSColor.
|
|
3048
|
+
this.headerTextColor = JSColor.text;
|
|
3038
3049
|
}
|
|
3039
3050
|
if (this.cellSeparatorColor === null){
|
|
3040
3051
|
this.cellSeparatorColor = this.cellTextColor.colorWithAlpha(0.2);
|
|
@@ -3043,13 +3054,13 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
|
|
|
3043
3054
|
this.accessoryColor = this.cellTextColor;
|
|
3044
3055
|
}
|
|
3045
3056
|
if (this.selectedCellTextColor === null){
|
|
3046
|
-
this.selectedCellTextColor = JSColor.
|
|
3057
|
+
this.selectedCellTextColor = JSColor.highlightedText;
|
|
3047
3058
|
}
|
|
3048
3059
|
if (this.selectedCellDetailTextColor === null){
|
|
3049
3060
|
this.selectedCellDetailTextColor = this.selectedCellTextColor;
|
|
3050
3061
|
}
|
|
3051
3062
|
if (this.selectedCellSeparatorColor === null){
|
|
3052
|
-
this.selectedCellSeparatorColor =
|
|
3063
|
+
this.selectedCellSeparatorColor = JSColor.clear;
|
|
3053
3064
|
}
|
|
3054
3065
|
if (this.activeCellBackgroundColor === null){
|
|
3055
3066
|
this.activeCellBackgroundColor = this.cellBackgroundColor;
|
|
@@ -3070,10 +3081,10 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
|
|
|
3070
3081
|
this.mutedSelectedCellDetailTextColor = this.cellDetailTextColor;
|
|
3071
3082
|
}
|
|
3072
3083
|
if (this.mutedSelectedCellBackgroundColor === null){
|
|
3073
|
-
this.mutedSelectedCellBackgroundColor =
|
|
3084
|
+
this.mutedSelectedCellBackgroundColor = JSColor.mutedHighlight;
|
|
3074
3085
|
}
|
|
3075
3086
|
if (this.mutedSelectedCellSeparatorColor === null){
|
|
3076
|
-
this.mutedSelectedCellSeparatorColor =
|
|
3087
|
+
this.mutedSelectedCellSeparatorColor = JSColor.clear;
|
|
3077
3088
|
}
|
|
3078
3089
|
if (this.cellContentInsets === null){
|
|
3079
3090
|
this.cellContentInsets = JSInsets.Zero;
|
|
@@ -3217,7 +3228,7 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
|
|
|
3217
3228
|
if (cell._titleLabel !== null){
|
|
3218
3229
|
if (cell._detailLabel !== null){
|
|
3219
3230
|
size.height = cell._titleLabel.font.displayLineHeight * (cell._titleLabel.maximumNumberOfLines || 1) + cell._detailLabel.font.displayLineHeight * (cell._detailLabel.maximumNumberOfLines || 1);
|
|
3220
|
-
origin.y = Math.floor((cell.bounds.size.height - size.height) / 2.0);
|
|
3231
|
+
origin.y = Math.floor((cell._contentView.bounds.size.height - size.height) / 2.0);
|
|
3221
3232
|
size.height = cell._titleLabel.font.displayLineHeight * (cell._titleLabel.maximumNumberOfLines || 1);
|
|
3222
3233
|
cell._titleLabel.frame = JSRect(origin, size);
|
|
3223
3234
|
origin.y += size.height;
|
|
@@ -3225,12 +3236,12 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
|
|
|
3225
3236
|
cell._detailLabel.frame = JSRect(origin, size);
|
|
3226
3237
|
}else{
|
|
3227
3238
|
size.height = cell._titleLabel.font.displayLineHeight * (cell._titleLabel.maximumNumberOfLines || 1);
|
|
3228
|
-
origin.y = Math.floor((cell.bounds.size.height - size.height) / 2.0);
|
|
3239
|
+
origin.y = Math.floor((cell._contentView.bounds.size.height - size.height) / 2.0);
|
|
3229
3240
|
cell._titleLabel.frame = JSRect(origin, size);
|
|
3230
3241
|
}
|
|
3231
3242
|
}else if (cell._detailLabel !== null){
|
|
3232
3243
|
size.height = cell._detailLabel.font.displayLineHeight * (cell._detailLabel.maximumNumberOfLines || 1);
|
|
3233
|
-
cell._detailLabel.frame = JSRect(JSPoint(cell._titleInsets.left, Math.floor((cell.bounds.size.height - size.height) / 2.0)), size);
|
|
3244
|
+
cell._detailLabel.frame = JSRect(JSPoint(cell._titleInsets.left, Math.floor((cell._contentView.bounds.size.height - size.height) / 2.0)), size);
|
|
3234
3245
|
}
|
|
3235
3246
|
|
|
3236
3247
|
var separatorInsets = cell._separatorInsets;
|
|
@@ -151,11 +151,15 @@ JSClass("UIListViewCell", UIView, {
|
|
|
151
151
|
_updateState: function(newState){
|
|
152
152
|
if (newState != this._state){
|
|
153
153
|
this._state = newState;
|
|
154
|
-
this._didChangeState
|
|
154
|
+
if (this._didChangeState){
|
|
155
|
+
this._didChangeState();
|
|
156
|
+
}else{
|
|
157
|
+
this.update();
|
|
158
|
+
}
|
|
155
159
|
}
|
|
156
160
|
},
|
|
157
161
|
|
|
158
|
-
|
|
162
|
+
update: function(){
|
|
159
163
|
var styler = (this._styler || (this.listView && this.listView._styler));
|
|
160
164
|
if (!styler){
|
|
161
165
|
return;
|
|
@@ -173,6 +177,10 @@ JSClass("UIListViewCell", UIView, {
|
|
|
173
177
|
this._updateState(newState);
|
|
174
178
|
},
|
|
175
179
|
|
|
180
|
+
toggleStates: function(flag, on){
|
|
181
|
+
this._toggleState(flag, on);
|
|
182
|
+
},
|
|
183
|
+
|
|
176
184
|
isActive: function(){
|
|
177
185
|
return (this._state & UIListViewCell.State.active) === UIListViewCell.State.active;
|
|
178
186
|
},
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
// #import "UIEvent.js"
|
|
21
21
|
// #import "UIWindow.js"
|
|
22
22
|
// #import "UIAccessibility.js"
|
|
23
|
+
// #import "JSColor+UIKit.js"
|
|
23
24
|
/* global UIMenuWindow */
|
|
24
25
|
'use strict';
|
|
25
26
|
|
|
@@ -444,12 +445,12 @@ JSClass("UIMenuStyler", JSObject, {
|
|
|
444
445
|
|
|
445
446
|
});
|
|
446
447
|
|
|
447
|
-
var defaultTextColor = JSColor.
|
|
448
|
-
var defaultHighlightTextColor = JSColor.
|
|
449
|
-
var defaultDisabledTextColor = JSColor.
|
|
450
|
-
var defaultHighlightColor = JSColor.
|
|
451
|
-
var defaultBackgroundColor = JSColor.
|
|
452
|
-
var defaultBorderColor = JSColor.
|
|
448
|
+
var defaultTextColor = JSColor.text;
|
|
449
|
+
var defaultHighlightTextColor = JSColor.highlightedText;
|
|
450
|
+
var defaultDisabledTextColor = JSColor.text.colorWithAlpha(0.2);
|
|
451
|
+
var defaultHighlightColor = JSColor.highlight;
|
|
452
|
+
var defaultBackgroundColor = JSColor.menu;
|
|
453
|
+
var defaultBorderColor = JSColor.initWithUIStyles(JSColor.black.colorWithAlpha(0.2), JSColor.white.colorWithAlpha(0.2));
|
|
453
454
|
|
|
454
455
|
JSClass("UIMenuWindowStyler", UIMenuStyler, {
|
|
455
456
|
|
|
@@ -465,7 +466,8 @@ JSClass("UIMenuWindowStyler", UIMenuStyler, {
|
|
|
465
466
|
itemContentInsets: JSDynamicProperty('_itemContentInsets', JSInsets(2, 3, 2, 7)),
|
|
466
467
|
indentationSize: JSDynamicProperty('_indentationSize', 10),
|
|
467
468
|
separatorSize: 10,
|
|
468
|
-
separatorLineWidth:
|
|
469
|
+
separatorLineWidth: 1,
|
|
470
|
+
separatorColor: null,
|
|
469
471
|
shadowColor: null,
|
|
470
472
|
shadowRadius: 14,
|
|
471
473
|
shadowOffset: null,
|
|
@@ -473,13 +475,14 @@ JSClass("UIMenuWindowStyler", UIMenuStyler, {
|
|
|
473
475
|
|
|
474
476
|
init: function(){
|
|
475
477
|
UIMenuWindowStyler.$super.init.call(this);
|
|
476
|
-
this.shadowColor = JSColor.
|
|
478
|
+
this.shadowColor = JSColor.menuShadow;
|
|
477
479
|
this.shadowOffset = JSPoint.Zero;
|
|
480
|
+
this.separatorColor = this.disabledTextColor;
|
|
478
481
|
},
|
|
479
482
|
|
|
480
483
|
initWithSpec: function(spec){
|
|
481
484
|
UIMenuWindowStyler.$super.initWithSpec.call(this, spec);
|
|
482
|
-
this.shadowColor = JSColor.
|
|
485
|
+
this.shadowColor = JSColor.menuShadow;
|
|
483
486
|
this.shadowOffset = JSPoint.Zero;
|
|
484
487
|
if (spec.containsKey('capSize')){
|
|
485
488
|
this._capSize = spec.valueForKey("capSize");
|
|
@@ -520,8 +523,13 @@ JSClass("UIMenuWindowStyler", UIMenuStyler, {
|
|
|
520
523
|
if (spec.containsKey('separatorSize')){
|
|
521
524
|
this.separatorSize = spec.valueForKey("separatorSize");
|
|
522
525
|
}
|
|
523
|
-
if (spec.containsKey('
|
|
524
|
-
this.
|
|
526
|
+
if (spec.containsKey('separatorLineWidth')){
|
|
527
|
+
this.separatorLineWidth = spec.valueForKey("separatorLineWidth");
|
|
528
|
+
}
|
|
529
|
+
if (spec.containsKey('separatorColor')){
|
|
530
|
+
this.separatorColor = spec.valueForKey("separatorColor", JSColor);
|
|
531
|
+
}else{
|
|
532
|
+
this.separatorColor = this.disabledTextColor;
|
|
525
533
|
}
|
|
526
534
|
if (spec.containsKey('itemContentInsets')){
|
|
527
535
|
this.itemContentInsets = spec.valueForKey("itemContentInsets", JSInsets);
|
|
@@ -854,8 +862,8 @@ JSClass("UIMenuWindowStyler", UIMenuStyler, {
|
|
|
854
862
|
window.downIndicatorImageView.templateColor = this._textColor;
|
|
855
863
|
window.menuView.backgroundColor = this._backgroundColor;
|
|
856
864
|
window.capSize = this._capSize;
|
|
857
|
-
window.separatorColor = this.
|
|
858
|
-
window.separatorLineWidth = this.
|
|
865
|
+
window.separatorColor = this.separatorColor;
|
|
866
|
+
window.separatorLineWidth = this.separatorLineWidth;
|
|
859
867
|
window.separatorSize = this.separatorSize;
|
|
860
868
|
window.itemContentInsets = this._itemContentInsets;
|
|
861
869
|
window.indentationSize = this.indentationSize;
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
// #import "UIWindow.js"
|
|
17
17
|
// #import "UIMenu.js"
|
|
18
18
|
// #import "UIMenuView.js"
|
|
19
|
+
// #import "JSColor+UIKit.js"
|
|
19
20
|
'use strict';
|
|
20
21
|
|
|
21
22
|
JSClass("UIMenuBar", UIWindow, {
|
|
@@ -86,11 +87,11 @@ JSClass("UIMenuBar", UIWindow, {
|
|
|
86
87
|
this.contentView = UIView.init();
|
|
87
88
|
this._clipView = UIView.init();
|
|
88
89
|
this.contentView.addSubview(this._clipView);
|
|
89
|
-
|
|
90
|
+
this.backgroundColor = JSColor.menuBar;
|
|
90
91
|
this._font = JSFont.systemFontOfSize(JSFont.Size.normal).fontWithWeight(JSFont.Weight.regular);
|
|
91
|
-
this._textColor =
|
|
92
|
-
this._highlightColor =
|
|
93
|
-
this._highlightedTextColor =
|
|
92
|
+
this._textColor = JSColor.menuBarText;
|
|
93
|
+
this._highlightColor = JSColor.highlight;
|
|
94
|
+
this._highlightedTextColor = JSColor.highlightedText;
|
|
94
95
|
},
|
|
95
96
|
|
|
96
97
|
// --------------------------------------------------------------------
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
// #import "UIImageView.js"
|
|
21
21
|
// #import "UIEvent.js"
|
|
22
22
|
// #import "UIPlatform.js"
|
|
23
|
+
// #import "JSColor+UIKit.js"
|
|
23
24
|
'use strict';
|
|
24
25
|
|
|
25
26
|
(function(){
|
|
@@ -48,7 +49,7 @@ JSClass("UIMenuWindow", UIWindow, {
|
|
|
48
49
|
_keyWidth: 0,
|
|
49
50
|
separatorColor: null,
|
|
50
51
|
separatorSize: 10,
|
|
51
|
-
|
|
52
|
+
separatorLineWidth: 2,
|
|
52
53
|
itemContentInsets: null,
|
|
53
54
|
indentationSize: 10,
|
|
54
55
|
highlightColor: null,
|
|
@@ -635,7 +636,7 @@ JSClass("UIMenuView", UIView, {
|
|
|
635
636
|
|
|
636
637
|
initWithFrame: function(frame){
|
|
637
638
|
UIMenuView.$super.initWithFrame.call(this, frame);
|
|
638
|
-
this.backgroundColor = JSColor.
|
|
639
|
+
this.backgroundColor = JSColor.background;
|
|
639
640
|
this.itemViews = [];
|
|
640
641
|
},
|
|
641
642
|
|
|
@@ -643,7 +644,7 @@ JSClass("UIMenuView", UIView, {
|
|
|
643
644
|
var view = item.view;
|
|
644
645
|
if (view === null){
|
|
645
646
|
if (item.separator){
|
|
646
|
-
view = UIMenuItemSeparatorView.initWithColor(this.menuWindow.separatorColor, this.menuWindow.
|
|
647
|
+
view = UIMenuItemSeparatorView.initWithColor(this.menuWindow.separatorColor, this.menuWindow.separatorLineWidth, this.menuWindow.itemContentInsets.insetsWithInsets(0, item.menu.showStatusColumn ? (item.menu.font.displayLineHeight + this.menuWindow.itemContentInsets.left) : 0, 0, 0));
|
|
647
648
|
view.frame = JSRect(0, 0, 1, this.menuWindow.separatorSize);
|
|
648
649
|
}else{
|
|
649
650
|
view = UIMenuItemView.init();
|
|
@@ -714,10 +715,12 @@ JSClass("UIMenuItemSeparatorView", UIView, {
|
|
|
714
715
|
|
|
715
716
|
lineLayer: null,
|
|
716
717
|
size: 0,
|
|
718
|
+
insets: null,
|
|
717
719
|
|
|
718
|
-
initWithColor: function(color, size){
|
|
720
|
+
initWithColor: function(color, size, insets){
|
|
719
721
|
UIMenuItemSeparatorView.$super.init.call(this);
|
|
720
722
|
this.size = size;
|
|
723
|
+
this.insets = JSInsets(insets);
|
|
721
724
|
this.lineLayer = UILayer.init();
|
|
722
725
|
this.lineLayer.backgroundColor = color;
|
|
723
726
|
this.layer.addSublayer(this.lineLayer);
|
|
@@ -725,7 +728,8 @@ JSClass("UIMenuItemSeparatorView", UIView, {
|
|
|
725
728
|
|
|
726
729
|
layoutSubviews: function(){
|
|
727
730
|
UIMenuItemSeparatorView.$super.layoutSubviews.call(this);
|
|
728
|
-
|
|
731
|
+
|
|
732
|
+
this.lineLayer.frame = JSRect(this.insets.left, (this.bounds.size.height - this.size) / 2, this.bounds.size.width - this.insets.width, this.size);
|
|
729
733
|
},
|
|
730
734
|
|
|
731
735
|
isAccessibilityElement: true,
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
// #import "UILabel.js"
|
|
18
18
|
// #import "UINavigationBarItem.js"
|
|
19
19
|
// #import "UIViewPropertyAnimator.js"
|
|
20
|
+
// #import "JSColor+UIKit.js"
|
|
20
21
|
'use strict';
|
|
21
22
|
|
|
22
23
|
(function(){
|
|
@@ -317,10 +318,11 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
317
318
|
init: function(){
|
|
318
319
|
UINavigationBarDefaultStyler.$super.init.call(this);
|
|
319
320
|
this.coversContent = true;
|
|
320
|
-
this.backgroundColor = JSColor.
|
|
321
|
+
this.backgroundColor = JSColor.background;
|
|
321
322
|
this.contentSeparatorSize = 1;
|
|
322
|
-
this.contentSeparatorColor = JSColor.
|
|
323
|
-
this.titleColor = JSColor.
|
|
323
|
+
this.contentSeparatorColor = JSColor.initWithUIStyles(JSColor.black.colorWithAlpha(0.1), JSColor.white.colorWithAlpha(0.1));
|
|
324
|
+
this.titleColor = JSColor.text;
|
|
325
|
+
this.itemColor = JSColor.highlight;
|
|
324
326
|
this.itemInsets = JSInsets.Zero;
|
|
325
327
|
this._fillInDefaultStyles();
|
|
326
328
|
},
|
|
@@ -336,8 +338,8 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
336
338
|
if (spec.containsKey("contentSeparatorColor")){
|
|
337
339
|
this.contentSeparatorColor = spec.valueForKey("contentSeparatorColor", JSColor);
|
|
338
340
|
}
|
|
339
|
-
if (spec.containsKey("
|
|
340
|
-
this.
|
|
341
|
+
if (spec.containsKey("contentSeparatorSize")){
|
|
342
|
+
this.contentSeparatorSize = spec.valueForKey("contentSeparatorSize");
|
|
341
343
|
}
|
|
342
344
|
if (spec.containsKey("titleColor")){
|
|
343
345
|
this.titleColor = spec.valueForKey("titleColor", JSColor);
|
|
@@ -772,6 +774,7 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
772
774
|
button.accessibilityLabel = barItem.accessibilityTitle;
|
|
773
775
|
if (barItem.image){
|
|
774
776
|
button.setImageForState(barItem.image, UIControl.State.normal);
|
|
777
|
+
button._imageView.automaticRenderMode = JSImage.RenderMode.template;
|
|
775
778
|
}
|
|
776
779
|
button.addAction(barItem.action, barItem.target);
|
|
777
780
|
return button;
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
// #import "UINavigationBar.js"
|
|
18
18
|
// #import "UIScrollView.js"
|
|
19
19
|
// #import "UIViewPropertyAnimator.js"
|
|
20
|
+
// #import "JSColor+UIKit.js"
|
|
20
21
|
/* global UISplitViewController */
|
|
21
22
|
'use strict';
|
|
22
23
|
|
|
@@ -195,7 +196,7 @@ JSClass("UINavigationController", UIViewController, {
|
|
|
195
196
|
var navController = this;
|
|
196
197
|
this.layoutChildView(viewController.view);
|
|
197
198
|
viewController.view.transform = JSAffineTransform.Translated(viewController.view.bounds.size.width, 0);
|
|
198
|
-
viewController.view.shadowColor = JSColor.
|
|
199
|
+
viewController.view.shadowColor = JSColor.windowShadow;
|
|
199
200
|
viewController.view.shadowRadius = 20;
|
|
200
201
|
this.pushAnimator.addAnimations(function(){
|
|
201
202
|
viewController.view.transform = JSAffineTransform.Identity;
|
|
@@ -272,7 +273,7 @@ JSClass("UINavigationController", UIViewController, {
|
|
|
272
273
|
var navController = this;
|
|
273
274
|
this.layoutChildView(viewController.view);
|
|
274
275
|
viewController.view.transform = JSAffineTransform.Translated(-viewController.view.bounds.size.width / 2, 0);
|
|
275
|
-
fromViewController.view.shadowColor = JSColor.
|
|
276
|
+
fromViewController.view.shadowColor = JSColor.windowShadow;
|
|
276
277
|
fromViewController.view.shadowRadius = 20;
|
|
277
278
|
this.popAnimator.addAnimations(function(){
|
|
278
279
|
viewController.view.transform = JSAffineTransform.Identity;
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
// #import "UIListViewCell.js"
|
|
17
17
|
// #import "UIButton.js"
|
|
18
18
|
// #import "UIEvent.js"
|
|
19
|
+
// #import "JSColor+UIKit.js"
|
|
19
20
|
'use strict';
|
|
20
21
|
|
|
21
22
|
JSClass("UIOutlineViewCell", UIListViewCell, {
|
|
@@ -28,7 +29,7 @@ JSClass("UIOutlineViewCell", UIListViewCell, {
|
|
|
28
29
|
|
|
29
30
|
_commonCellInit: function(){
|
|
30
31
|
UIOutlineViewCell.$super._commonCellInit.call(this);
|
|
31
|
-
var buttonStyler = UIButtonImageStyler.initWithColor(JSColor.
|
|
32
|
+
var buttonStyler = UIButtonImageStyler.initWithColor(JSColor.text);
|
|
32
33
|
this._disclosureButton = UIButton.initWithStyler(buttonStyler);
|
|
33
34
|
this._disclosureButton.addAction("_toggleExpanded", this);
|
|
34
35
|
this._disclosureButton.accessibilityRole = UIAccessibility.Role.disclosureTriangle;
|