@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
|
@@ -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: {
|
|
@@ -101,7 +101,15 @@ JSClass("JSSynchronizer", JSObject, {
|
|
|
101
101
|
},
|
|
102
102
|
};
|
|
103
103
|
try{
|
|
104
|
-
this.action.call(this.target, context);
|
|
104
|
+
var promise = this.action.call(this.target, context);
|
|
105
|
+
if (promise instanceof Promise){
|
|
106
|
+
context.started();
|
|
107
|
+
promise.then(function(){
|
|
108
|
+
context.completed();
|
|
109
|
+
}, function(error){
|
|
110
|
+
context.completed(error);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
105
113
|
}catch (e){
|
|
106
114
|
logger.error(e);
|
|
107
115
|
this.error = e;
|
|
@@ -361,9 +361,48 @@ JSClass("JSURL", JSObject, {
|
|
|
361
361
|
this._query = null;
|
|
362
362
|
},
|
|
363
363
|
|
|
364
|
+
_createQuery: function(other){
|
|
365
|
+
var url = this;
|
|
366
|
+
var query = Object.create(JSFormFieldMap.prototype, {
|
|
367
|
+
|
|
368
|
+
add: {
|
|
369
|
+
value: function(name, value){
|
|
370
|
+
JSFormFieldMap.prototype.add.call(this, name, value);
|
|
371
|
+
url._encodedQuery = this.urlEncoded();
|
|
372
|
+
if (url._encodedQuery.length === 0){
|
|
373
|
+
url._encodedQuery = null;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
|
|
378
|
+
set: {
|
|
379
|
+
value: function(name, value){
|
|
380
|
+
JSFormFieldMap.prototype.set.call(this, name, value);
|
|
381
|
+
url._encodedQuery = this.urlEncoded();
|
|
382
|
+
if (url._encodedQuery.length === 0){
|
|
383
|
+
url._encodedQuery = null;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
unset: {
|
|
389
|
+
value: function(name, value){
|
|
390
|
+
JSFormFieldMap.prototype.unset.call(this, name);
|
|
391
|
+
url._encodedQuery = this.urlEncoded();
|
|
392
|
+
if (url._encodedQuery.length === 0){
|
|
393
|
+
url._encodedQuery = null;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
});
|
|
399
|
+
JSFormFieldMap.call(query, other);
|
|
400
|
+
return query;
|
|
401
|
+
},
|
|
402
|
+
|
|
364
403
|
getQuery: function(){
|
|
365
404
|
if (this._query === null){
|
|
366
|
-
this._query =
|
|
405
|
+
this._query = this._createQuery();
|
|
367
406
|
if (this._encodedQuery !== null){
|
|
368
407
|
this._query.decode(this._encodedQuery, true);
|
|
369
408
|
}
|
|
@@ -373,9 +412,9 @@ JSClass("JSURL", JSObject, {
|
|
|
373
412
|
|
|
374
413
|
setQuery: function(query){
|
|
375
414
|
if (query === null){
|
|
376
|
-
this._query =
|
|
415
|
+
this._query = this._createQuery();
|
|
377
416
|
}else{
|
|
378
|
-
this._query =
|
|
417
|
+
this._query = this._createQuery(query);
|
|
379
418
|
}
|
|
380
419
|
this._encodedQuery = this._query.urlEncoded();
|
|
381
420
|
if (this._encodedQuery.length === 0){
|
|
@@ -84,6 +84,10 @@ JSClass("SKValidatingObjectPropertyProvider", JSObject, {
|
|
|
84
84
|
return null;
|
|
85
85
|
},
|
|
86
86
|
|
|
87
|
+
getKeys: function(){
|
|
88
|
+
return Object.keys(this.obj);
|
|
89
|
+
}
|
|
90
|
+
|
|
87
91
|
});
|
|
88
92
|
|
|
89
93
|
JSClass("SKValidatingObjectFormFieldProvider", JSObject, {
|
|
@@ -159,6 +163,14 @@ JSClass("SKValidatingObjectFormFieldProvider", JSObject, {
|
|
|
159
163
|
|
|
160
164
|
getLength: function(){
|
|
161
165
|
return null;
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
getKeys: function(){
|
|
169
|
+
var keys = [];
|
|
170
|
+
for (var i = 0, l = this.form.fields.length; i < l; ++i){
|
|
171
|
+
keys.push(this.form.fields[i].name);
|
|
172
|
+
}
|
|
173
|
+
return keys;
|
|
162
174
|
}
|
|
163
175
|
|
|
164
176
|
});
|
|
@@ -190,6 +202,10 @@ JSClass("SKValidatingObjectFormFieldArrayProvider", SKValidatingObjectFormFieldP
|
|
|
190
202
|
|
|
191
203
|
getLength: function(){
|
|
192
204
|
return this.array.length;
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
getKeys: function(){
|
|
208
|
+
return Object.keys(this.array);
|
|
193
209
|
}
|
|
194
210
|
|
|
195
211
|
});
|
|
@@ -197,6 +213,7 @@ JSClass("SKValidatingObjectFormFieldArrayProvider", SKValidatingObjectFormFieldP
|
|
|
197
213
|
JSClass("SKValidatingObject", JSObject, {
|
|
198
214
|
|
|
199
215
|
length: JSReadOnlyProperty(),
|
|
216
|
+
keys: JSReadOnlyProperty(),
|
|
200
217
|
|
|
201
218
|
initWithObject: function(obj){
|
|
202
219
|
this.initWithValueProvider(SKValidatingObjectPropertyProvider.initWithObject(obj));
|
|
@@ -216,6 +233,10 @@ JSClass("SKValidatingObject", JSObject, {
|
|
|
216
233
|
return this.valueProvider.getLength();
|
|
217
234
|
},
|
|
218
235
|
|
|
236
|
+
getKeys: function(){
|
|
237
|
+
return this.valueProvider.getKeys();
|
|
238
|
+
},
|
|
239
|
+
|
|
219
240
|
numberForKey: function(key, defaultValue, validator){
|
|
220
241
|
var n = this.valueProvider.numberForKey(key);
|
|
221
242
|
if (typeof(defaultValue) == 'function'){
|
|
@@ -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
|
},
|