@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.
- 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/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/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/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/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 +17 -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/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 +10 -9
- package/Root/Frameworks/UIKit/UIMenu.js +10 -9
- package/Root/Frameworks/UIKit/UIMenuBar.js +5 -4
- package/Root/Frameworks/UIKit/UIMenuView.js +8 -4
- 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/UITabView.js +34 -31
- package/Root/Frameworks/UIKit/UITextEditor.js +2 -1
- package/Root/Frameworks/UIKit/UITextField.js +13 -14
- 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 +5 -5
- 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 +18 -24
- package/Root/Frameworks/UIKit/UIWindowButtonCloseInactive.svg +1 -1
- package/Root/Frameworks/UIKit/UIWindowButtonCloseNormal.svg +1 -1
- package/Root/Frameworks/UIKit/UIWindowServer.js +53 -8
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/Root/Templates/html/${PROJECT_NAME}/www/index.html +24 -4
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
// #import "JSObject.js"
|
|
17
17
|
// #import "CoreTypes.js"
|
|
18
|
+
/* global JSSpec, JSBundle, JSColor */
|
|
18
19
|
'use strict';
|
|
19
20
|
|
|
20
21
|
(function(){
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
JSClass("JSColorSpace", JSObject, {
|
|
23
24
|
|
|
24
25
|
numberOfComponents: 0,
|
|
26
|
+
canMixComponents: true,
|
|
25
27
|
|
|
26
28
|
rgbFromComponents: function(components){
|
|
27
29
|
return JSColorSpace.rgb.componentsFromSpace(this, components);
|
|
@@ -31,6 +33,10 @@ JSClass("JSColorSpace", JSObject, {
|
|
|
31
33
|
return JSColorSpace.gray.componentsFromSpace(this, components);
|
|
32
34
|
},
|
|
33
35
|
|
|
36
|
+
alphaFromComponents: function(components){
|
|
37
|
+
return 1;
|
|
38
|
+
},
|
|
39
|
+
|
|
34
40
|
xyzFromComponents: function(components){
|
|
35
41
|
},
|
|
36
42
|
|
|
@@ -45,7 +51,36 @@ JSClass("JSColorSpace", JSObject, {
|
|
|
45
51
|
}
|
|
46
52
|
var xyz = space.xyzFromComponents(components);
|
|
47
53
|
return this.componentsFromXYZ(xyz);
|
|
48
|
-
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
mixedComponents: function(a, b, percentage){
|
|
57
|
+
var mixed = [];
|
|
58
|
+
for (var i = 0; i < this.numberOfComponents; ++i){
|
|
59
|
+
mixed.push(a[i] + (b[i] - a[i]) * percentage);
|
|
60
|
+
}
|
|
61
|
+
return mixed;
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
componentsDarkenedByPercentage: function(components, percentage){
|
|
65
|
+
var rgb = this.rgbFromComponents(components);
|
|
66
|
+
var darkenedRGB = JSColorSpace.rgb.componentsDarkenedByPercentage(rgb, percentage);
|
|
67
|
+
return this.componentsFromSpace(JSColorSpace.rgb, darkenedRGB);
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
componentsLightenedByPercentage: function(components, percentage){
|
|
71
|
+
var rgb = this.rgbFromComponents(components);
|
|
72
|
+
var lightenedRGB = JSColorSpace.rgb.componentsLightenedByPercentage(rgb, percentage);
|
|
73
|
+
return this.componentsFromSpace(JSColorSpace.rgb, lightenedRGB);
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
compareComponents: function(a, b){
|
|
77
|
+
for (var i = 0; i < this.numberOfComponents; ++i){
|
|
78
|
+
if (a[i] !== b[i]){
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
},
|
|
49
84
|
|
|
50
85
|
});
|
|
51
86
|
|
|
@@ -186,6 +221,22 @@ JSClass("JSRGBColorSpace", JSColorSpace, {
|
|
|
186
221
|
return [(components[0] + components[1] + components[2]) / 3];
|
|
187
222
|
},
|
|
188
223
|
|
|
224
|
+
componentsDarkenedByPercentage: function(components, percentage){
|
|
225
|
+
return [
|
|
226
|
+
components[0] - components[0] * percentage,
|
|
227
|
+
components[1] - components[1] * percentage,
|
|
228
|
+
components[2] - components[2] * percentage
|
|
229
|
+
];
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
componentsLightenedByPercentage: function(components, percentage){
|
|
233
|
+
return [
|
|
234
|
+
components[0] + (1.0 - components[0]) * percentage,
|
|
235
|
+
components[1] + (1.0 - components[1]) * percentage,
|
|
236
|
+
components[2] + (1.0 - components[2]) * percentage
|
|
237
|
+
];
|
|
238
|
+
},
|
|
239
|
+
|
|
189
240
|
// MARK: - Lab conversions
|
|
190
241
|
|
|
191
242
|
xyzFromComponents: function(components){
|
|
@@ -328,6 +379,15 @@ JSClass("JSRGBColorSpace", JSColorSpace, {
|
|
|
328
379
|
];
|
|
329
380
|
},
|
|
330
381
|
|
|
382
|
+
compareComponents: function(a, b){
|
|
383
|
+
for (var i = 0; i < this.numberOfComponents; ++i){
|
|
384
|
+
if (Math.round(a[i] * 255) !== Math.round(b[i] * 255)){
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
|
|
331
391
|
});
|
|
332
392
|
|
|
333
393
|
JSClass("JSGrayColorSpace", JSColorSpace, {
|
|
@@ -346,6 +406,27 @@ JSClass("JSGrayColorSpace", JSColorSpace, {
|
|
|
346
406
|
return [components[0]];
|
|
347
407
|
},
|
|
348
408
|
|
|
409
|
+
compareComponents: function(a, b){
|
|
410
|
+
for (var i = 0; i < this.numberOfComponents; ++i){
|
|
411
|
+
if (Math.round(a[i] * 255) !== Math.round(b[i] * 255)){
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return true;
|
|
416
|
+
},
|
|
417
|
+
|
|
418
|
+
componentsDarkenedByPercentage: function(components, percentage){
|
|
419
|
+
return [
|
|
420
|
+
components[0] - components[0] * percentage
|
|
421
|
+
];
|
|
422
|
+
},
|
|
423
|
+
|
|
424
|
+
componentsLightenedByPercentage: function(components, percentage){
|
|
425
|
+
return [
|
|
426
|
+
components[0] + (1.0 - components[0]) * percentage
|
|
427
|
+
];
|
|
428
|
+
}
|
|
429
|
+
|
|
349
430
|
});
|
|
350
431
|
|
|
351
432
|
JSClass("JSDerivedColorSpace", JSColorSpace, {
|
|
@@ -382,6 +463,133 @@ JSClass("JSDerivedColorSpace", JSColorSpace, {
|
|
|
382
463
|
|
|
383
464
|
});
|
|
384
465
|
|
|
466
|
+
JSClass("JSMappedColorSpace", JSColorSpace, {
|
|
467
|
+
|
|
468
|
+
canMixComponents: false,
|
|
469
|
+
|
|
470
|
+
colorFromComponents: function(components){
|
|
471
|
+
},
|
|
472
|
+
|
|
473
|
+
rgbFromComponents: function(components){
|
|
474
|
+
var rgba = this.colorFromComponents(components).rgbaColor().components;
|
|
475
|
+
return [
|
|
476
|
+
rgba[0],
|
|
477
|
+
rgba[1],
|
|
478
|
+
rgba[2],
|
|
479
|
+
];
|
|
480
|
+
},
|
|
481
|
+
|
|
482
|
+
grayFromComponents: function(components){
|
|
483
|
+
var graya = this.colorFromComponents(components).grayColor().components;
|
|
484
|
+
return [
|
|
485
|
+
graya[0],
|
|
486
|
+
];
|
|
487
|
+
},
|
|
488
|
+
|
|
489
|
+
alphaFromComponents: function(components){
|
|
490
|
+
return this.colorFromComponents(components).alpha;
|
|
491
|
+
},
|
|
492
|
+
|
|
493
|
+
xyzFromComponents: function(components){
|
|
494
|
+
var rgb = this.rgbFromComponents(components);
|
|
495
|
+
return JSColorSpace.rgb.xyzFromComponents(rgb);
|
|
496
|
+
},
|
|
497
|
+
|
|
498
|
+
componentsFromXYZ: function(xyz){
|
|
499
|
+
throw new Error("Unable to convert from xyz -> %s mapped color space".sprintf(this.name));
|
|
500
|
+
},
|
|
501
|
+
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
JSClass("JSIndexedColorSpace", JSMappedColorSpace, {
|
|
505
|
+
|
|
506
|
+
name: "indexed",
|
|
507
|
+
numberOfComponents: 2,
|
|
508
|
+
componentNames: {"index": 0},
|
|
509
|
+
colors: null,
|
|
510
|
+
|
|
511
|
+
init: function(){
|
|
512
|
+
this.colors = [];
|
|
513
|
+
},
|
|
514
|
+
|
|
515
|
+
addColor: function(color){
|
|
516
|
+
var index = this.colors.length;
|
|
517
|
+
this.colors.push(color);
|
|
518
|
+
return JSColor.initWithSpaceAndComponents(this, [index, 1, -1]);
|
|
519
|
+
},
|
|
520
|
+
|
|
521
|
+
setColorAtIndex: function(color, index){
|
|
522
|
+
this.colors[index] = color;
|
|
523
|
+
},
|
|
524
|
+
|
|
525
|
+
colorFromComponents: function(components){
|
|
526
|
+
var color = this.colors[components[0]];
|
|
527
|
+
if (components[1] < 1){
|
|
528
|
+
color = color.colorDarkenedByPercentage(1 - components[1]);
|
|
529
|
+
}else if (components[1] > 1){
|
|
530
|
+
color = color.colorLightenedByPercentage(components[1] - 1);
|
|
531
|
+
}
|
|
532
|
+
return color;
|
|
533
|
+
},
|
|
534
|
+
|
|
535
|
+
componentsDarkenedByPercentage: function(components, percentage){
|
|
536
|
+
return [
|
|
537
|
+
components[0],
|
|
538
|
+
components[1] * (1.0 - percentage)
|
|
539
|
+
];
|
|
540
|
+
},
|
|
541
|
+
|
|
542
|
+
componentsLightenedByPercentage: function(components, percentage){
|
|
543
|
+
return [
|
|
544
|
+
components[0],
|
|
545
|
+
components[1] * (1.0 + percentage)
|
|
546
|
+
];
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
JSClass("JSNamedColorSpace", JSMappedColorSpace, {
|
|
552
|
+
|
|
553
|
+
name: "named",
|
|
554
|
+
numberOfComponents: 2,
|
|
555
|
+
componentNames: {"name": 0},
|
|
556
|
+
colors: null,
|
|
557
|
+
|
|
558
|
+
init: function(){
|
|
559
|
+
this.colors = {};
|
|
560
|
+
},
|
|
561
|
+
|
|
562
|
+
setColorForName: function(name, color){
|
|
563
|
+
this.colors[name] = color;
|
|
564
|
+
return JSColor.initWithSpaceAndComponents(this, [name, 1, -1]);
|
|
565
|
+
},
|
|
566
|
+
|
|
567
|
+
colorFromComponents: function(components){
|
|
568
|
+
var color = this.colors[components[0]];
|
|
569
|
+
if (components[1] < 1){
|
|
570
|
+
color = color.colorDarkenedByPercentage(1 - components[1]);
|
|
571
|
+
}else if (components[1] > 1){
|
|
572
|
+
color = color.colorLightenedByPercentage(components[1] - 1);
|
|
573
|
+
}
|
|
574
|
+
return color;
|
|
575
|
+
},
|
|
576
|
+
|
|
577
|
+
componentsDarkenedByPercentage: function(components, percentage){
|
|
578
|
+
return [
|
|
579
|
+
components[0],
|
|
580
|
+
components[1] * (1.0 - percentage)
|
|
581
|
+
];
|
|
582
|
+
},
|
|
583
|
+
|
|
584
|
+
componentsLightenedByPercentage: function(components, percentage){
|
|
585
|
+
return [
|
|
586
|
+
components[0],
|
|
587
|
+
components[1] * (1.0 + percentage)
|
|
588
|
+
];
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
});
|
|
592
|
+
|
|
385
593
|
Object.defineProperties(JSColorSpace, {
|
|
386
594
|
|
|
387
595
|
rgb: {
|
|
@@ -0,0 +1,75 @@
|
|
|
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 "UIColorSpace.js"
|
|
18
|
+
"use strict";
|
|
19
|
+
|
|
20
|
+
JSColor.definePropertiesFromExtensions({
|
|
21
|
+
|
|
22
|
+
initWithUIStyles: function(lightColor, darkColor, lightContrastColor, darkContrastColor){
|
|
23
|
+
var space = UIColorSpace.initWithStyles(lightColor, darkColor, lightContrastColor, darkContrastColor);
|
|
24
|
+
var components = [1, -1];
|
|
25
|
+
this.initWithSpaceAndComponents(space, components);
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
JSColor.defineInitMethod("initWithUIStyles");
|
|
31
|
+
|
|
32
|
+
// Common Colors
|
|
33
|
+
JSColorSpace.ui.setStylesForName("background", JSColor.white, JSColor.initWithWhite(0.15));
|
|
34
|
+
JSColorSpace.ui.setStylesForName("text", JSColor.black.colorWithAlpha(0.9), JSColor.white.colorWithAlpha(0.9));
|
|
35
|
+
JSColorSpace.ui.setStylesForName("secondaryText", JSColor.black.colorWithAlpha(0.6), JSColor.white.colorWithAlpha(0.6));
|
|
36
|
+
JSColorSpace.ui.setStylesForName("highlight", JSColor.initWithRGBA(0, 0.5, 1), JSColor.initWithRGBA(0, 0.5, 1));
|
|
37
|
+
JSColorSpace.ui.setStylesForName("mutedHighlight", JSColor.black.colorWithAlpha(0.15), JSColor.white.colorWithAlpha(0.1));
|
|
38
|
+
JSColorSpace.ui.setStylesForName("highlightedText", JSColor.white, JSColor.white);
|
|
39
|
+
JSColorSpace.ui.setColorForName("placeholderText", JSColor.text.colorWithAlpha(0.3));
|
|
40
|
+
JSColorSpace.ui.setStylesForName("destructive", JSColor.initWithRGBA(0.8,0,0), JSColor.initWithRGBA(1,0.5,0.5));
|
|
41
|
+
|
|
42
|
+
// Control Colors
|
|
43
|
+
JSColorSpace.ui.setStylesForName("controlBackground", JSColor.initWithWhite(0.98), JSColor.initWithWhite(0.35));
|
|
44
|
+
JSColorSpace.ui.setStylesForName("controlBorder", JSColor.black.colorWithAlpha(0.2), JSColor.black.colorWithAlpha(0.8));
|
|
45
|
+
JSColorSpace.ui.setStylesForName("controlTitle", JSColor.initWithWhite(0.2), JSColor.white);
|
|
46
|
+
JSColorSpace.ui.setStylesForName("activeControlBackground", JSColor.initWithWhite(0.875), JSColor.initWithWhite(0.2));
|
|
47
|
+
JSColorSpace.ui.setStylesForName("activeControlBorder", JSColor.black.colorWithAlpha(0.2), JSColor.black.colorWithAlpha(0.8));
|
|
48
|
+
JSColorSpace.ui.setStylesForName("activeControlTitle", JSColor.initWithWhite(0.2), JSColor.initWithWhite(0.8));
|
|
49
|
+
JSColorSpace.ui.setStylesForName("selectedControlBackground", JSColor.initWithWhite(0.5), JSColor.initWithWhite(0.1));
|
|
50
|
+
JSColorSpace.ui.setStylesForName("selectedControlBorder", JSColor.black.colorWithAlpha(0.2), JSColor.black.colorWithAlpha(0.8));
|
|
51
|
+
JSColorSpace.ui.setStylesForName("selectedControlTitle", JSColor.initWithWhite(0.94), JSColor.initWithWhite(0.94));
|
|
52
|
+
JSColorSpace.ui.setStylesForName("activeSelectedControlBackground", JSColor.initWithWhite(0.4), JSColor.black);
|
|
53
|
+
JSColorSpace.ui.setStylesForName("activeSelectedControlBorder", JSColor.black.colorWithAlpha(0.2), JSColor.black.colorWithAlpha(0.8));
|
|
54
|
+
JSColorSpace.ui.setStylesForName("activeSelectedControlTitle", JSColor.initWithWhite(0.94), JSColor.initWithWhite(1.0));
|
|
55
|
+
JSColorSpace.ui.setStylesForName("disabledControlBackground", JSColor.initWithWhite(0.94), JSColor.initWithWhite(0.1));
|
|
56
|
+
JSColorSpace.ui.setStylesForName("disabledControlBorder", JSColor.black.colorWithAlpha(0.2), JSColor.black.colorWithAlpha(0.8));
|
|
57
|
+
JSColorSpace.ui.setStylesForName("disabledControlTitle", JSColor.initWithWhite(0.6), JSColor.initWithWhite(0.4));
|
|
58
|
+
JSColorSpace.ui.setColorForName("controlShadow", JSColor.black.colorWithAlpha(0.1));
|
|
59
|
+
|
|
60
|
+
// Window Colors
|
|
61
|
+
JSColorSpace.ui.setStylesForName("window", JSColor.initWithWhite(0.94), JSColor.initWithWhite(0.2));
|
|
62
|
+
JSColorSpace.ui.setColorForName("windowShadow", JSColor.black.colorWithAlpha(0.4));
|
|
63
|
+
JSColorSpace.ui.setColorForName("toolbarTitle", JSColor.text.colorWithAlpha(0.6));
|
|
64
|
+
|
|
65
|
+
// Tooltip Colors
|
|
66
|
+
JSColorSpace.ui.setColorForName("tooltip", JSColor.window);
|
|
67
|
+
JSColorSpace.ui.setColorForName("tooltipText", JSColor.text);
|
|
68
|
+
JSColorSpace.ui.setStylesForName("tooltipBorder", JSColor.initWithWhite(0.7), JSColor.black);
|
|
69
|
+
JSColorSpace.ui.setColorForName("tooltipShadow", JSColor.black.colorWithAlpha(0.2));
|
|
70
|
+
|
|
71
|
+
// Menu Colors
|
|
72
|
+
JSColorSpace.ui.setStylesForName("menuBar", JSColor.initWithWhite(0.94), JSColor.initWithWhite(0.1));
|
|
73
|
+
JSColorSpace.ui.setStylesForName("menuBarText", JSColor.black, JSColor.white);
|
|
74
|
+
JSColorSpace.ui.setColorForName("menu", JSColor.window);
|
|
75
|
+
JSColorSpace.ui.setColorForName("menuShadow", JSColor.black.colorWithAlpha(0.2));
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
// Copyright 2020 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 Foundation
|
|
2
17
|
'use strict';
|
|
3
18
|
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
// #import "UIView.js"
|
|
17
17
|
// #import "UICustomAnimation.js"
|
|
18
18
|
// #import "UIImageLayer.js"
|
|
19
|
+
// #import "JSColor+UIKit.js"
|
|
19
20
|
'use strict';
|
|
20
21
|
|
|
21
22
|
(function(){
|
|
@@ -190,7 +191,7 @@ UIActivityIndicatorView.Style = {
|
|
|
190
191
|
light: 1
|
|
191
192
|
};
|
|
192
193
|
|
|
193
|
-
var darkColor = JSColor.black;
|
|
194
|
+
var darkColor = JSColor.initWithUIStyles(JSColor.black, JSColor.white);
|
|
194
195
|
var lightColor = JSColor.white;
|
|
195
196
|
|
|
196
197
|
var images = Object.create({}, {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
// #import "UIButton.js"
|
|
20
20
|
// #import "UIPopupWindow.js"
|
|
21
21
|
// #import "UIAlertAction.js"
|
|
22
|
+
// #import "JSColor+UIKit.js"
|
|
22
23
|
'use strict';
|
|
23
24
|
|
|
24
25
|
(function(){
|
|
@@ -214,9 +215,9 @@ UIAlertController.ButtonStylers = Object.create({}, {
|
|
|
214
215
|
get: function(){
|
|
215
216
|
var styler = UIButtonDefaultStyler.init();
|
|
216
217
|
styler.font = styler.font.fontWithPointSize(JSFont.Size.detail).fontWithWeight(JSFont.Weight.bold);
|
|
217
|
-
styler.normalTitleColor = JSColor.
|
|
218
|
-
styler.activeTitleColor =
|
|
219
|
-
styler.disabledTitleColor =
|
|
218
|
+
styler.normalTitleColor = JSColor.destructive;
|
|
219
|
+
styler.activeTitleColor = JSColor.destructive.colorDarkenedByPercentage(0.2);
|
|
220
|
+
styler.disabledTitleColor = JSColor.destructive.colorWithAlpha(0.5);
|
|
220
221
|
Object.defineProperty(this, 'destructive', {writable: true, value: styler});
|
|
221
222
|
return styler;
|
|
222
223
|
},
|
|
@@ -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;
|
|
@@ -495,7 +499,7 @@ JSClass("UIButtonCustomStyler", UIButtonStyler, {
|
|
|
495
499
|
|
|
496
500
|
init: function(){
|
|
497
501
|
UIButtonCustomStyler.$super.init.call(this);
|
|
498
|
-
this.initWithColor(JSColor.
|
|
502
|
+
this.initWithColor(JSColor.text);
|
|
499
503
|
},
|
|
500
504
|
|
|
501
505
|
initWithSpec: function(spec){
|
|
@@ -618,16 +622,16 @@ JSClass("UIButtonDefaultStyler", UIButtonStyler, {
|
|
|
618
622
|
|
|
619
623
|
init: function(){
|
|
620
624
|
UIButtonDefaultStyler.$super.init.call(this);
|
|
621
|
-
this.normalBackgroundColor =
|
|
622
|
-
this.disabledBackgroundColor =
|
|
623
|
-
this.activeBackgroundColor =
|
|
624
|
-
this.normalBorderColor =
|
|
625
|
-
this.disabledBorderColor =
|
|
626
|
-
this.activeBorderColor =
|
|
627
|
-
this.normalTitleColor =
|
|
628
|
-
this.disabledTitleColor =
|
|
629
|
-
this.activeTitleColor =
|
|
630
|
-
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;
|
|
631
635
|
this.shadowOffset = JSPoint(0, 1);
|
|
632
636
|
this.titleInsets = JSInsets(3, 7);
|
|
633
637
|
},
|
|
@@ -679,18 +683,6 @@ JSClass("UIButtonDefaultStyler", UIButtonStyler, {
|
|
|
679
683
|
|
|
680
684
|
});
|
|
681
685
|
|
|
682
|
-
UIButtonDefaultStyler.NormalBackgroundColor = JSColor.initWithRGBA(250/255,250/255,250/255);
|
|
683
|
-
UIButtonDefaultStyler.ActiveBackgroundColor = JSColor.initWithRGBA(224/255,224/255,224/255);
|
|
684
|
-
UIButtonDefaultStyler.DisabledBackgroundColor = JSColor.initWithRGBA(240/255,240/255,240/255);
|
|
685
|
-
|
|
686
|
-
UIButtonDefaultStyler.NormalBorderColor = JSColor.initWithRGBA(204/255,204/255,204/255);
|
|
687
|
-
UIButtonDefaultStyler.ActiveBorderColor = JSColor.initWithRGBA(192/255,192/255,192/255);
|
|
688
|
-
UIButtonDefaultStyler.DisabledBorderColor = JSColor.initWithRGBA(224/255,224/255,224/255);
|
|
689
|
-
|
|
690
|
-
UIButtonDefaultStyler.NormalTitleColor = JSColor.initWithRGBA(51/255,51/255,51/255);
|
|
691
|
-
UIButtonDefaultStyler.ActiveTitleColor = JSColor.initWithRGBA(51/255,51/255,51/255);
|
|
692
|
-
UIButtonDefaultStyler.DisabledTitleColor = JSColor.initWithRGBA(152/255,152/255,152/255);
|
|
693
|
-
|
|
694
686
|
JSClass("UIButtonImageStyler", UIButtonStyler, {
|
|
695
687
|
|
|
696
688
|
color: JSDynamicProperty('_color', null),
|