@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
|
@@ -96,19 +96,7 @@ UIAnimation.interpolationForValues = function(from, to){
|
|
|
96
96
|
return UIAnimation.interpolateAffineTransform;
|
|
97
97
|
}
|
|
98
98
|
if (from.isKindOfClass && from.isKindOfClass(JSColor)){
|
|
99
|
-
|
|
100
|
-
return UIAnimation.interpolate1Color;
|
|
101
|
-
}
|
|
102
|
-
if (from.components.length == 2){
|
|
103
|
-
return UIAnimation.interpolate2Color;
|
|
104
|
-
}
|
|
105
|
-
if (from.components.length == 3){
|
|
106
|
-
return UIAnimation.interpolate3Color;
|
|
107
|
-
}
|
|
108
|
-
if (from.components.length == 4){
|
|
109
|
-
return UIAnimation.interpolate4Color;
|
|
110
|
-
}
|
|
111
|
-
return UIAnimation.interpolateNull;
|
|
99
|
+
return UIAnimation.interpolateColor;
|
|
112
100
|
}
|
|
113
101
|
if (from.animationInterpolation){
|
|
114
102
|
return from.animationInterpolation;
|
|
@@ -158,6 +146,12 @@ UIAnimation.interpolateAffineTransform = function(from, to, progress){
|
|
|
158
146
|
);
|
|
159
147
|
};
|
|
160
148
|
|
|
149
|
+
UIAnimation.interpolateColor = function(from, to, progress){
|
|
150
|
+
var mixed = from.space.mixedComponents(from.components, to.components, progress);
|
|
151
|
+
mixed.push(from.components[from.space.numberOfComponents] + (to.components[to.space.numberOfComponents] - from.components[from.space.numberOfComponents]) * progress);
|
|
152
|
+
return JSColor.initWithSpaceAndComponents(from.space, mixed);
|
|
153
|
+
};
|
|
154
|
+
|
|
161
155
|
UIAnimation.interpolate1Color = function(from, to, progress){
|
|
162
156
|
return JSColor.initWithSpaceAndComponents(from.space, [
|
|
163
157
|
from.components[0] + (to.components[0] - from.components[0]) * progress
|
|
@@ -37,6 +37,9 @@ JSClass('UIApplication', UIResponder, {
|
|
|
37
37
|
logger.info("Creating application");
|
|
38
38
|
shared = this;
|
|
39
39
|
this.windowServer = windowServer;
|
|
40
|
+
if (this.bundle.info.UIUserInterfaceStyle === "light"){
|
|
41
|
+
this.windowServer.darkModeEnabled = false;
|
|
42
|
+
}
|
|
40
43
|
this._windows = [];
|
|
41
44
|
this.windowServer.postNotificationForAccessibilityElement(UIAccessibility.Notification.elementCreated, this);
|
|
42
45
|
},
|
|
@@ -97,6 +97,12 @@ JSClass('UIBasicAnimation', UIPropertyAnimation, {
|
|
|
97
97
|
if (this._toValue === null){
|
|
98
98
|
this._toValue = JSResolveDottedName(this.layer.model, this.keyPath);
|
|
99
99
|
}
|
|
100
|
+
if ((this._fromValue instanceof JSColor) && (this._toValue instanceof JSColor)){
|
|
101
|
+
if (this._fromValue.space !== this._toValue.space || !this._fromValue.space.canMixComponents){
|
|
102
|
+
this._fromValue = this._fromValue.rgbaColor();
|
|
103
|
+
this._toValue = this._toValue.rgbaColor();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
100
106
|
return UIAnimation.interpolationForValues(this._fromValue, this._toValue);
|
|
101
107
|
}
|
|
102
108
|
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
// #import "UILabel.js"
|
|
18
18
|
// #import "UIImageView.js"
|
|
19
19
|
// #import "UIEvent.js"
|
|
20
|
+
// #import "JSColor+UIKit.js"
|
|
20
21
|
'use strict';
|
|
21
22
|
|
|
22
23
|
JSClass("UIButton", UIControl, {
|
|
@@ -404,7 +405,8 @@ JSClass("UIButtonStyler", UIControlStyler, {
|
|
|
404
405
|
size.width += titleSize.width;
|
|
405
406
|
}
|
|
406
407
|
}else if (image !== null){
|
|
407
|
-
|
|
408
|
+
imageScale = contentHeight / image.size.height;
|
|
409
|
+
size.width += Math.ceil(image.size.width * imageScale);
|
|
408
410
|
}
|
|
409
411
|
return size;
|
|
410
412
|
}
|
|
@@ -420,7 +422,9 @@ JSClass("UIButtonStyler", UIControlStyler, {
|
|
|
420
422
|
size.height += titleSize.height;
|
|
421
423
|
}
|
|
422
424
|
}else if (image !== null){
|
|
423
|
-
|
|
425
|
+
contentHeight = image.size.height;
|
|
426
|
+
imageScale = contentHeight / image.size.height;
|
|
427
|
+
size.width += Math.ceil(image.size.width * imageScale);
|
|
424
428
|
size.height += image.size.height;
|
|
425
429
|
}
|
|
426
430
|
return size;
|
|
@@ -472,9 +476,11 @@ JSClass("UIButtonCustomStyler", UIButtonStyler, {
|
|
|
472
476
|
|
|
473
477
|
normalBackgroundColor: null,
|
|
474
478
|
disabledBackgroundColor: null,
|
|
479
|
+
overBackgroundColor: null,
|
|
475
480
|
activeBackgroundColor: null,
|
|
476
481
|
normalTitleColor: null,
|
|
477
482
|
disabledTitleColor: null,
|
|
483
|
+
overTitleColor: null,
|
|
478
484
|
activeTitleColor: null,
|
|
479
485
|
cornerRadius: 0,
|
|
480
486
|
|
|
@@ -493,7 +499,7 @@ JSClass("UIButtonCustomStyler", UIButtonStyler, {
|
|
|
493
499
|
|
|
494
500
|
init: function(){
|
|
495
501
|
UIButtonCustomStyler.$super.init.call(this);
|
|
496
|
-
this.initWithColor(JSColor.
|
|
502
|
+
this.initWithColor(JSColor.text);
|
|
497
503
|
},
|
|
498
504
|
|
|
499
505
|
initWithSpec: function(spec){
|
|
@@ -501,9 +507,27 @@ JSClass("UIButtonCustomStyler", UIButtonStyler, {
|
|
|
501
507
|
if (spec.containsKey('normalBackgroundColor')){
|
|
502
508
|
this.normalBackgroundColor = spec.valueForKey("normalBackgroundColor", JSColor);
|
|
503
509
|
}
|
|
510
|
+
if (spec.containsKey('activeBackgroundColor')){
|
|
511
|
+
this.activeBackgroundColor = spec.valueForKey("activeBackgroundColor", JSColor);
|
|
512
|
+
}
|
|
513
|
+
if (spec.containsKey('disabledBackgroundColor')){
|
|
514
|
+
this.disabledBackgroundColor = spec.valueForKey("disabledBackgroundColor", JSColor);
|
|
515
|
+
}
|
|
516
|
+
if (spec.containsKey('overBackgroundColor')){
|
|
517
|
+
this.overBackgroundColor = spec.valueForKey("overBackgroundColor", JSColor);
|
|
518
|
+
}
|
|
504
519
|
if (spec.containsKey('normalTitleColor')){
|
|
505
520
|
this.normalTitleColor = spec.valueForKey("normalTitleColor", JSColor);
|
|
506
521
|
}
|
|
522
|
+
if (spec.containsKey('activeTitleColor')){
|
|
523
|
+
this.activeTitleColor = spec.valueForKey("activeTitleColor", JSColor);
|
|
524
|
+
}
|
|
525
|
+
if (spec.containsKey('disabledTitleColor')){
|
|
526
|
+
this.disabledTitleColor = spec.valueForKey("disabledTitleColor", JSColor);
|
|
527
|
+
}
|
|
528
|
+
if (spec.containsKey('overTitleColor')){
|
|
529
|
+
this.overTitleColor = spec.valueForKey("overTitleColor", JSColor);
|
|
530
|
+
}
|
|
507
531
|
if (spec.containsKey('cornerRadius')){
|
|
508
532
|
this.cornerRadius = spec.valueForKey("cornerRadius");
|
|
509
533
|
}
|
|
@@ -517,6 +541,9 @@ JSClass("UIButtonCustomStyler", UIButtonStyler, {
|
|
|
517
541
|
if (this.disabledTitleColor === null){
|
|
518
542
|
this.disabledTitleColor = this.normalTitleColor.colorWithAlpha(0.5);
|
|
519
543
|
}
|
|
544
|
+
if (this.overTitleColor === null){
|
|
545
|
+
this.overTitleColor = this.normalTitleColor;
|
|
546
|
+
}
|
|
520
547
|
if (this.normalBackgroundColor !== null){
|
|
521
548
|
if (this.activeBackgroundColor === null){
|
|
522
549
|
this.activeBackgroundColor = this.normalBackgroundColor.colorDarkenedByPercentage(0.2);
|
|
@@ -551,6 +578,14 @@ JSClass("UIButtonCustomStyler", UIButtonStyler, {
|
|
|
551
578
|
if (button._imageView !== null){
|
|
552
579
|
button._imageView.templateColor = this.activeTitleColor;
|
|
553
580
|
}
|
|
581
|
+
}else if (button.over){
|
|
582
|
+
button.layer.backgroundColor = this.overBackgroundColor;
|
|
583
|
+
if (button._titleLabel !== null){
|
|
584
|
+
button._titleLabel.textColor = this.overTitleColor;
|
|
585
|
+
}
|
|
586
|
+
if (button._imageView !== null){
|
|
587
|
+
button._imageView.templateColor = this.overTitleColor;
|
|
588
|
+
}
|
|
554
589
|
}else{
|
|
555
590
|
button.layer.backgroundColor = this.normalBackgroundColor;
|
|
556
591
|
if (button._titleLabel !== null){
|
|
@@ -587,16 +622,16 @@ JSClass("UIButtonDefaultStyler", UIButtonStyler, {
|
|
|
587
622
|
|
|
588
623
|
init: function(){
|
|
589
624
|
UIButtonDefaultStyler.$super.init.call(this);
|
|
590
|
-
this.normalBackgroundColor =
|
|
591
|
-
this.disabledBackgroundColor =
|
|
592
|
-
this.activeBackgroundColor =
|
|
593
|
-
this.normalBorderColor =
|
|
594
|
-
this.disabledBorderColor =
|
|
595
|
-
this.activeBorderColor =
|
|
596
|
-
this.normalTitleColor =
|
|
597
|
-
this.disabledTitleColor =
|
|
598
|
-
this.activeTitleColor =
|
|
599
|
-
this.shadowColor = JSColor.
|
|
625
|
+
this.normalBackgroundColor = JSColor.controlBackground;
|
|
626
|
+
this.disabledBackgroundColor = JSColor.disabledControlBackground;
|
|
627
|
+
this.activeBackgroundColor = JSColor.activeControlBackground;
|
|
628
|
+
this.normalBorderColor = JSColor.controlBorder;
|
|
629
|
+
this.disabledBorderColor = JSColor.disabledControlBorder;
|
|
630
|
+
this.activeBorderColor = JSColor.activeControlBorder;
|
|
631
|
+
this.normalTitleColor = JSColor.controlTitle;
|
|
632
|
+
this.disabledTitleColor = JSColor.disabledControlTitle;
|
|
633
|
+
this.activeTitleColor = JSColor.activeControlTitle;
|
|
634
|
+
this.shadowColor = JSColor.controlShadow;
|
|
600
635
|
this.shadowOffset = JSPoint(0, 1);
|
|
601
636
|
this.titleInsets = JSInsets(3, 7);
|
|
602
637
|
},
|
|
@@ -648,18 +683,6 @@ JSClass("UIButtonDefaultStyler", UIButtonStyler, {
|
|
|
648
683
|
|
|
649
684
|
});
|
|
650
685
|
|
|
651
|
-
UIButtonDefaultStyler.NormalBackgroundColor = JSColor.initWithRGBA(250/255,250/255,250/255);
|
|
652
|
-
UIButtonDefaultStyler.ActiveBackgroundColor = JSColor.initWithRGBA(224/255,224/255,224/255);
|
|
653
|
-
UIButtonDefaultStyler.DisabledBackgroundColor = JSColor.initWithRGBA(240/255,240/255,240/255);
|
|
654
|
-
|
|
655
|
-
UIButtonDefaultStyler.NormalBorderColor = JSColor.initWithRGBA(204/255,204/255,204/255);
|
|
656
|
-
UIButtonDefaultStyler.ActiveBorderColor = JSColor.initWithRGBA(192/255,192/255,192/255);
|
|
657
|
-
UIButtonDefaultStyler.DisabledBorderColor = JSColor.initWithRGBA(224/255,224/255,224/255);
|
|
658
|
-
|
|
659
|
-
UIButtonDefaultStyler.NormalTitleColor = JSColor.initWithRGBA(51/255,51/255,51/255);
|
|
660
|
-
UIButtonDefaultStyler.ActiveTitleColor = JSColor.initWithRGBA(51/255,51/255,51/255);
|
|
661
|
-
UIButtonDefaultStyler.DisabledTitleColor = JSColor.initWithRGBA(152/255,152/255,152/255);
|
|
662
|
-
|
|
663
686
|
JSClass("UIButtonImageStyler", UIButtonStyler, {
|
|
664
687
|
|
|
665
688
|
color: JSDynamicProperty('_color', null),
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
// #import "UILabel.js"
|
|
18
18
|
// #import "UIImageView.js"
|
|
19
19
|
// #import "UIEvent.js"
|
|
20
|
+
// #import "JSColor+UIKit.js"
|
|
20
21
|
'use strict';
|
|
21
22
|
|
|
22
23
|
(function(){
|
|
@@ -255,16 +256,16 @@ JSClass("UICheckboxDefaultStyler", UICheckboxStyler, {
|
|
|
255
256
|
shadowRadius: 1,
|
|
256
257
|
|
|
257
258
|
init: function(){
|
|
258
|
-
this.normalBackgroundColor =
|
|
259
|
-
this.disabledBackgroundColor =
|
|
260
|
-
this.activeBackgroundColor =
|
|
261
|
-
this.normalBorderColor =
|
|
262
|
-
this.disabledBorderColor =
|
|
263
|
-
this.activeBorderColor =
|
|
264
|
-
this.normalTitleColor =
|
|
265
|
-
this.disabledTitleColor =
|
|
266
|
-
this.activeTitleColor =
|
|
267
|
-
this.shadowColor = JSColor.
|
|
259
|
+
this.normalBackgroundColor = JSColor.controlBackground;
|
|
260
|
+
this.disabledBackgroundColor = JSColor.disabledControlBackground;
|
|
261
|
+
this.activeBackgroundColor = JSColor.activeControlBackground;
|
|
262
|
+
this.normalBorderColor = JSColor.controlBorder;
|
|
263
|
+
this.disabledBorderColor = JSColor.disabledControlBorder;
|
|
264
|
+
this.activeBorderColor = JSColor.activeControlBorder;
|
|
265
|
+
this.normalTitleColor = JSColor.controlTitle;
|
|
266
|
+
this.disabledTitleColor = JSColor.disabledControlTitle;
|
|
267
|
+
this.activeTitleColor = JSColor.activeControlTitle;
|
|
268
|
+
this.shadowColor = JSColor.controlShadow;
|
|
268
269
|
this.shadowOffset = JSPoint(0, 1);
|
|
269
270
|
},
|
|
270
271
|
|
|
@@ -344,18 +345,6 @@ JSClass("UICheckboxDefaultStyler", UICheckboxStyler, {
|
|
|
344
345
|
|
|
345
346
|
});
|
|
346
347
|
|
|
347
|
-
UICheckboxDefaultStyler.NormalBackgroundColor = JSColor.initWithRGBA(250/255,250/255,250/255);
|
|
348
|
-
UICheckboxDefaultStyler.ActiveBackgroundColor = JSColor.initWithRGBA(224/255,224/255,224/255);
|
|
349
|
-
UICheckboxDefaultStyler.DisabledBackgroundColor = JSColor.initWithRGBA(240/255,240/255,240/255);
|
|
350
|
-
|
|
351
|
-
UICheckboxDefaultStyler.NormalBorderColor = JSColor.initWithRGBA(204/255,204/255,204/255);
|
|
352
|
-
UICheckboxDefaultStyler.ActiveBorderColor = JSColor.initWithRGBA(192/255,192/255,192/255);
|
|
353
|
-
UICheckboxDefaultStyler.DisabledBorderColor = JSColor.initWithRGBA(224/255,224/255,224/255);
|
|
354
|
-
|
|
355
|
-
UICheckboxDefaultStyler.NormalTitleColor = JSColor.initWithRGBA(51/255,51/255,51/255);
|
|
356
|
-
UICheckboxDefaultStyler.ActiveTitleColor = JSColor.initWithRGBA(51/255,51/255,51/255);
|
|
357
|
-
UICheckboxDefaultStyler.DisabledTitleColor = JSColor.initWithRGBA(152/255,152/255,152/255);
|
|
358
|
-
|
|
359
348
|
var images = Object.create({}, {
|
|
360
349
|
|
|
361
350
|
bundle: {
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
// Copyright 2021 Breakside Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Breakside Public License, Version 1.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// If a copy of the License was not distributed with this file, you may
|
|
6
|
+
// obtain a copy at
|
|
7
|
+
//
|
|
8
|
+
// http://breakside.io/licenses/LICENSE-1.0.txt
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
1
16
|
// #import "UIPopupWindow.js"
|
|
2
17
|
// #import "UISlider.js"
|
|
3
18
|
// #import "UITextField.js"
|
|
@@ -153,16 +168,13 @@ JSClass("UIColorPanelViewController", UIViewController, {
|
|
|
153
168
|
wellStyler.disabledBorderWidth = 0;
|
|
154
169
|
wellStyler.cornerRadius = 3;
|
|
155
170
|
var componentStyler = UITextFieldCustomStyler.init();
|
|
156
|
-
componentStyler.backgroundColor = JSColor.white.colorWithAlpha(0.
|
|
157
|
-
componentStyler.activeBackgroundColor = JSColor.white.colorWithAlpha(0.8);
|
|
171
|
+
componentStyler.backgroundColor = JSColor.initWithUIStyles(JSColor.white, JSColor.white.colorWithAlpha(0.1));
|
|
158
172
|
componentStyler.cornerRadius = 3;
|
|
159
173
|
componentStyler.textInsets = JSInsets(3, 4);
|
|
160
|
-
componentStyler.textColor = JSColor.
|
|
161
|
-
componentStyler.placeholderColor = JSColor.
|
|
174
|
+
componentStyler.textColor = JSColor.text;
|
|
175
|
+
componentStyler.placeholderColor = JSColor.placeholderText;
|
|
162
176
|
componentStyler.borderWidth = 1;
|
|
163
|
-
componentStyler.borderColor = JSColor.black.colorWithAlpha(0.2);
|
|
164
|
-
componentStyler.activeBorderColor = JSColor.black.colorWithAlpha(0.4);
|
|
165
|
-
componentStyler.disabledBorderColor = JSColor.black.colorWithAlpha(0.2);
|
|
177
|
+
componentStyler.borderColor = JSColor.initWithUIStyles(JSColor.black.colorWithAlpha(0.2), JSColor.black.colorWithAlpha(0.4));
|
|
166
178
|
this.saturationBrightnessControl = UIColorPanelTwoAxisSlider.init();
|
|
167
179
|
this.hueSlider = UISlider.initWithStyler(hueStyler);
|
|
168
180
|
this.alphaSlider = UISlider.initWithStyler(alphaStyler);
|
|
@@ -203,7 +215,7 @@ JSClass("UIColorPanelViewController", UIViewController, {
|
|
|
203
215
|
this.hexLabel.text = "Hex";
|
|
204
216
|
this._updateComponentLabels();
|
|
205
217
|
this.component4Label.text = "Alpha";
|
|
206
|
-
this.hexLabel.textColor = JSColor.
|
|
218
|
+
this.hexLabel.textColor = JSColor.text.colorWithAlpha(0.5);
|
|
207
219
|
this.component1Label.textColor = this.hexLabel.textColor;
|
|
208
220
|
this.component2Label.textColor = this.hexLabel.textColor;
|
|
209
221
|
this.component3Label.textColor = this.hexLabel.textColor;
|
|
@@ -216,7 +228,7 @@ JSClass("UIColorPanelViewController", UIViewController, {
|
|
|
216
228
|
|
|
217
229
|
var hashLabel = UILabel.init();
|
|
218
230
|
hashLabel.font = this.hexField.font;
|
|
219
|
-
hashLabel.textColor = JSColor.
|
|
231
|
+
hashLabel.textColor = JSColor.text.colorWithAlpha(0.4);
|
|
220
232
|
hashLabel.text = "#";
|
|
221
233
|
hashLabel.sizeToFit();
|
|
222
234
|
this.hexField.leftAccessoryView = hashLabel;
|
|
@@ -733,12 +745,12 @@ JSClass("UIColorPanelTwoAxisSlider", UIControl, {
|
|
|
733
745
|
this._maximumValue = JSPoint(1, 1);
|
|
734
746
|
this.knobSize = JSSize(16, 16);
|
|
735
747
|
this._value = JSPoint(0, 0);
|
|
736
|
-
this.normalKnobBackgroundColor = JSColor.
|
|
737
|
-
this.activeKnobBackgroundColor = JSColor.
|
|
738
|
-
this.disabledKnobBackgroundColor =
|
|
739
|
-
this.normalKnobBorderColor = JSColor.
|
|
740
|
-
this.activeKnobBorderColor = JSColor.
|
|
741
|
-
this.disabledKnobBorderColor = JSColor.
|
|
748
|
+
this.normalKnobBackgroundColor = JSColor.controlBackground;
|
|
749
|
+
this.activeKnobBackgroundColor = JSColor.activeControlBackground;
|
|
750
|
+
this.disabledKnobBackgroundColor = JSColor.disabledControlBackground;
|
|
751
|
+
this.normalKnobBorderColor = JSColor.controlBorder;
|
|
752
|
+
this.activeKnobBorderColor = JSColor.activeControlBorder;
|
|
753
|
+
this.disabledKnobBorderColor = JSColor.disabledControlBorder;
|
|
742
754
|
this.xLayer = UILayer.init();
|
|
743
755
|
this.yLayer = UILayer.init();
|
|
744
756
|
this.yLayer.backgroundGradient = JSGradient.initWithColors([JSColor.black, JSColor.black.colorWithAlpha(0)]);
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Copyright 2021 Breakside Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Breakside Public License, Version 1.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// If a copy of the License was not distributed with this file, you may
|
|
6
|
+
// obtain a copy at
|
|
7
|
+
//
|
|
8
|
+
// http://breakside.io/licenses/LICENSE-1.0.txt
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
16
|
+
// #import Foundation
|
|
17
|
+
// #import "UIUserInterface.js"
|
|
18
|
+
/* global UIApplication */
|
|
19
|
+
"use strict";
|
|
20
|
+
|
|
21
|
+
JSClass("UIColorSpace", JSMappedColorSpace, {
|
|
22
|
+
|
|
23
|
+
name: "ui",
|
|
24
|
+
numberOfComponents: 1,
|
|
25
|
+
componentNames: {},
|
|
26
|
+
colors: null,
|
|
27
|
+
|
|
28
|
+
initWithStyles: function(lightColor, darkColor, lightContrastColor, darkContrastColor){
|
|
29
|
+
if (darkColor === undefined){
|
|
30
|
+
darkColor = lightColor;
|
|
31
|
+
}
|
|
32
|
+
if (lightContrastColor === undefined){
|
|
33
|
+
lightContrastColor = lightColor;
|
|
34
|
+
}
|
|
35
|
+
if (darkContrastColor === undefined){
|
|
36
|
+
darkContrastColor = darkColor;
|
|
37
|
+
}
|
|
38
|
+
this.colors = [
|
|
39
|
+
lightColor,
|
|
40
|
+
darkColor,
|
|
41
|
+
lightContrastColor,
|
|
42
|
+
darkContrastColor
|
|
43
|
+
];
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
colorFromComponents: function(components){
|
|
47
|
+
var color = this.colors[UIColorSpace.colorIndex];
|
|
48
|
+
if (components[0] < 1){
|
|
49
|
+
color = color.colorDarkenedByPercentage(1 - components[0]);
|
|
50
|
+
}else if (components[0] > 1){
|
|
51
|
+
color = color.colorLightenedByPercentage(components[0] - 1);
|
|
52
|
+
}
|
|
53
|
+
return color;
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
componentsDarkenedByPercentage: function(components, percentage){
|
|
57
|
+
return [
|
|
58
|
+
components[0] * (1.0 - percentage)
|
|
59
|
+
];
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
componentsLightenedByPercentage: function(components, percentage){
|
|
63
|
+
return [
|
|
64
|
+
components[0] * (1.0 + percentage)
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
UIColorSpace.colorIndex = 0;
|
|
71
|
+
|
|
72
|
+
UIColorSpace.setTraitCollection = function(traitCollection){
|
|
73
|
+
if (traitCollection.accessibilityContrast === UIUserInterface.Contrast.high){
|
|
74
|
+
if (traitCollection.userInterfaceStyle === UIUserInterface.Style.dark){
|
|
75
|
+
UIColorSpace.colorIndex = 3;
|
|
76
|
+
}else{
|
|
77
|
+
UIColorSpace.colorIndex = 2;
|
|
78
|
+
}
|
|
79
|
+
}else{
|
|
80
|
+
if (traitCollection.userInterfaceStyle === UIUserInterface.Style.dark){
|
|
81
|
+
UIColorSpace.colorIndex = 1;
|
|
82
|
+
}else{
|
|
83
|
+
UIColorSpace.colorIndex = 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (JSColor.invalidateCSSCache){
|
|
87
|
+
JSColor.invalidateCSSCache();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
JSClass("UINamedColorSpace", JSNamedColorSpace, {
|
|
92
|
+
|
|
93
|
+
setColorForName: function(name, color){
|
|
94
|
+
var namedColor = UINamedColorSpace.$super.setColorForName.call(this, name, color);
|
|
95
|
+
if (JSGlobalObject.UIApplication && UIApplication.shared){
|
|
96
|
+
UIApplication.shared.windowServer.setNeedsRedisplay();
|
|
97
|
+
if (JSColor.invalidateCSSCache){
|
|
98
|
+
JSColor.invalidateCSSCache();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
var space = this;
|
|
102
|
+
Object.defineProperty(JSColor, name, {
|
|
103
|
+
configurable: true,
|
|
104
|
+
get: function(){
|
|
105
|
+
return namedColor;
|
|
106
|
+
},
|
|
107
|
+
set: function(color){
|
|
108
|
+
space.setColorForName(name, color);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return namedColor;
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
setStylesForName: function(name, lightColor, darkColor, lightContrastColor, darkContrastColor){
|
|
115
|
+
var color = JSColor.initWithUIStyles(lightColor, darkColor, lightContrastColor, darkContrastColor);
|
|
116
|
+
this.setColorForName(name, color);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
Object.defineProperties(JSColorSpace, {
|
|
122
|
+
|
|
123
|
+
ui: {
|
|
124
|
+
configurable: true,
|
|
125
|
+
get: function(){
|
|
126
|
+
var space = UINamedColorSpace.init();
|
|
127
|
+
Object.defineProperty(this, "ui", {value: space});
|
|
128
|
+
return space;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
});
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
// Copyright 2021 Breakside Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Breakside Public License, Version 1.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// If a copy of the License was not distributed with this file, you may
|
|
6
|
+
// obtain a copy at
|
|
7
|
+
//
|
|
8
|
+
// http://breakside.io/licenses/LICENSE-1.0.txt
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
1
16
|
// #import "UIControl.js"
|
|
2
17
|
// #import "UIPasteboard.js"
|
|
3
18
|
// #import "UIColorPanel.js"
|
|
@@ -12,11 +27,12 @@ JSClass("UIColorWell", UIControl, {
|
|
|
12
27
|
initWithSpec: function(spec){
|
|
13
28
|
UIColorWell.$super.initWithSpec.call(this, spec);
|
|
14
29
|
if (spec.containsKey("color")){
|
|
15
|
-
this._color = spec.valueForKey("color", JSColor);
|
|
30
|
+
this._color = spec.valueForKey("color", JSColor).rgbaColor();
|
|
16
31
|
}
|
|
17
32
|
if (spec.containsKey("allowsAlpha")){
|
|
18
33
|
this._allowsAlpha = spec.valueForKey("allowsAlpha", JSColor);
|
|
19
34
|
}
|
|
35
|
+
this.update();
|
|
20
36
|
},
|
|
21
37
|
|
|
22
38
|
commonUIControlInit: function(){
|
|
@@ -36,7 +52,7 @@ JSClass("UIColorWell", UIControl, {
|
|
|
36
52
|
color: JSDynamicProperty("_color", JSColor.black),
|
|
37
53
|
|
|
38
54
|
setColor: function(color){
|
|
39
|
-
this._color = color;
|
|
55
|
+
this._color = color.rgbaColor();
|
|
40
56
|
this.update();
|
|
41
57
|
},
|
|
42
58
|
|
|
@@ -43,10 +43,14 @@ JSClass("UIControl", UIView, {
|
|
|
43
43
|
var target;
|
|
44
44
|
var action;
|
|
45
45
|
var event;
|
|
46
|
-
if (spec.containsKey('
|
|
47
|
-
|
|
46
|
+
if (spec.containsKey('action')){
|
|
47
|
+
if (spec.containsKey("target")){
|
|
48
|
+
target = spec.valueForKey("target");
|
|
49
|
+
}else{
|
|
50
|
+
target = null;
|
|
51
|
+
}
|
|
48
52
|
action = spec.valueForKey("action");
|
|
49
|
-
if (!target.isKindOfClass(UIResponder)){
|
|
53
|
+
if (target !== null && !target.isKindOfClass(UIResponder)){
|
|
50
54
|
throw new Error("Action target must be a UIResponder: %s.%s".sprintf(spec.unmodifiedValueForKey("target"), spec.unmodifiedValueForKey("action")));
|
|
51
55
|
}
|
|
52
56
|
this.addAction(action, target);
|
|
@@ -267,7 +271,7 @@ JSClass("UIControl", UIView, {
|
|
|
267
271
|
},
|
|
268
272
|
|
|
269
273
|
setOver: function(isOver){
|
|
270
|
-
this.toggleStates(UIControl.State.over, isOver);
|
|
274
|
+
this.toggleStates(UIControl.State.over, isOver && this.hasOverState);
|
|
271
275
|
},
|
|
272
276
|
|
|
273
277
|
isActive: function(){
|
|
@@ -343,6 +347,13 @@ JSClass("UIControlStyler", JSObject, {
|
|
|
343
347
|
|
|
344
348
|
showsOverState: false,
|
|
345
349
|
|
|
350
|
+
initWithSpec: function(spec){
|
|
351
|
+
UIControlStyler.$super.initWithSpec.call(this, spec);
|
|
352
|
+
if (spec.containsKey("showsOverState")){
|
|
353
|
+
this.showsOverState = spec.valueForKey("showsOverState");
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
|
|
346
357
|
initializeControl: function(control){
|
|
347
358
|
},
|
|
348
359
|
|
|
@@ -216,7 +216,6 @@ JSClass("UIHTMLDisplayServer", UIDisplayServer, {
|
|
|
216
216
|
setLayerNeedsDisplay: function(layer){
|
|
217
217
|
var context = this.contextForLayer(layer);
|
|
218
218
|
context.needsCustomDisplay = true;
|
|
219
|
-
layer._UIHTMLDisplayServerCustomDrawing = true;
|
|
220
219
|
UIHTMLDisplayServer.$super.setLayerNeedsDisplay.call(this, layer);
|
|
221
220
|
},
|
|
222
221
|
|
|
@@ -433,10 +432,7 @@ JSClass("UIHTMLDisplayServer", UIDisplayServer, {
|
|
|
433
432
|
|
|
434
433
|
_removeLayerFromDOM: function(layer){
|
|
435
434
|
layer._displayServer = null;
|
|
436
|
-
|
|
437
|
-
// So the layer will redraw if it's ever re-added
|
|
438
|
-
layer.setNeedsDisplay();
|
|
439
|
-
}
|
|
435
|
+
layer.setNeedsRedisplay();
|
|
440
436
|
var context = this.contextsByObjectID[layer.objectID];
|
|
441
437
|
if (context){
|
|
442
438
|
if (context.element.isConnected){
|
|
@@ -153,7 +153,7 @@ JSClass("UIHTMLTextField", UIControl, {
|
|
|
153
153
|
// MARK: - Placeholder
|
|
154
154
|
|
|
155
155
|
placeholder: JSDynamicProperty("_placeholder", null),
|
|
156
|
-
placeholderColor: JSDynamicProperty("_placeholderColor",
|
|
156
|
+
placeholderColor: JSDynamicProperty("_placeholderColor", JSColor.placeholderText),
|
|
157
157
|
|
|
158
158
|
setPlaceholder: function(placeholder){
|
|
159
159
|
this._placeholder = placeholder;
|
|
@@ -169,15 +169,6 @@ JSClass("UIHTMLTextField", UIControl, {
|
|
|
169
169
|
this.setNeedsDisplay();
|
|
170
170
|
},
|
|
171
171
|
|
|
172
|
-
_createPlaceholderColor: function(){
|
|
173
|
-
var backgroundColor = this.backgroundColor;
|
|
174
|
-
if (backgroundColor === null){
|
|
175
|
-
backgroundColor = JSColor.white;
|
|
176
|
-
}
|
|
177
|
-
this._placeholderColor = backgroundColor.colorByBlendingColor(this.textColor, 0.3);
|
|
178
|
-
this._needsPlaceholderColor = true;
|
|
179
|
-
},
|
|
180
|
-
|
|
181
172
|
// --------------------------------------------------------------------
|
|
182
173
|
// MARK: - Secure Entry
|
|
183
174
|
|
|
@@ -205,8 +196,8 @@ JSClass("UIHTMLTextField", UIControl, {
|
|
|
205
196
|
// MARK: - Styling
|
|
206
197
|
|
|
207
198
|
textAlignment: JSDynamicProperty("_textAlignment", JSTextAlignment.left),
|
|
208
|
-
textColor: JSDynamicProperty("_textColor", JSColor.
|
|
209
|
-
localCursorColor: JSDynamicProperty("_localCursorColor", JSColor.
|
|
199
|
+
textColor: JSDynamicProperty("_textColor", JSColor.text),
|
|
200
|
+
localCursorColor: JSDynamicProperty("_localCursorColor", JSColor.highlight),
|
|
210
201
|
font: JSDynamicProperty("_font", null),
|
|
211
202
|
|
|
212
203
|
setTextAlignment: function(textAlignment){
|
|
@@ -291,9 +282,6 @@ JSClass("UIHTMLTextField", UIControl, {
|
|
|
291
282
|
UIHTMLTextField.sharedStyleElement.type = "text/css";
|
|
292
283
|
layer.element.ownerDocument.head.appendChild(UIHTMLTextField.sharedStyleElement);
|
|
293
284
|
}
|
|
294
|
-
if (this._placeholderColor === null){
|
|
295
|
-
this._createPlaceholderColor();
|
|
296
|
-
}
|
|
297
285
|
var stylesheet = UIHTMLTextField.sharedStyleElement.sheet;
|
|
298
286
|
var index = stylesheet.insertRule("#%s::selection { }".sprintf(this.inputElement.id));
|
|
299
287
|
this.selectionStyleRule = stylesheet.cssRules.item(index);
|