@breakside/jskit 2021.43.0 → 2021.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/Frameworks/DOM.jsframework/Info.json +2 -2
  2. package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
  3. package/Frameworks/FontKit.jsframework/Info.json +2 -2
  4. package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
  5. package/Frameworks/Foundation.jsframework/Info.json +2 -2
  6. package/Frameworks/Foundation.jsframework/JS/Deflate.js +2 -3
  7. package/Frameworks/Foundation.jsframework/JS/Error+JS.js +10 -0
  8. package/Frameworks/Foundation.jsframework/JS/JSColor.js +15 -0
  9. package/Frameworks/Foundation.jsframework/JS/JSDate.js +6 -0
  10. package/Frameworks/Foundation.jsframework/JS/JSDateFormatter.js +2 -2
  11. package/Frameworks/Foundation.jsframework/JS/JSTimer.js +6 -0
  12. package/Frameworks/Foundation.jsframework/JS/JSURLResponse.js +60 -1
  13. package/Frameworks/Foundation.jsframework/JS/Zlib.js +2 -3
  14. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  15. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  16. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  17. package/Info.json +2 -2
  18. package/Node/HTMLBuilder.js +2 -1
  19. package/Node/JavascriptCompilation.js +1 -1
  20. package/Node/io.breakside.jskit-bundle.js +2 -2
  21. package/Root/Frameworks/APIKit/APIError.js +2 -3
  22. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  23. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  24. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  25. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  26. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  27. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  28. package/Root/Frameworks/DBKit/DBObjectDatabase.js +6 -5
  29. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  30. package/Root/Frameworks/DOM/Info.yaml +1 -1
  31. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  32. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  33. package/Root/Frameworks/Foundation/Deflate.js +2 -3
  34. package/Root/Frameworks/Foundation/Error+JS.js +10 -0
  35. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  36. package/Root/Frameworks/Foundation/JSColor.js +15 -0
  37. package/Root/Frameworks/Foundation/JSDate.js +6 -0
  38. package/Root/Frameworks/Foundation/JSDateFormatter.js +2 -2
  39. package/Root/Frameworks/Foundation/JSTimer.js +6 -0
  40. package/Root/Frameworks/Foundation/JSURLResponse.js +60 -1
  41. package/Root/Frameworks/Foundation/Zlib.js +2 -3
  42. package/Root/Frameworks/ImageKit/IKDecoderPNG.js +1 -3
  43. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  44. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  45. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  46. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  47. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  48. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  49. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  50. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  51. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  52. package/Root/Frameworks/ServerKit/SKFileJobQueue.js +3 -1
  53. package/Root/Frameworks/ServerKit/SKHTTPError.js +2 -3
  54. package/Root/Frameworks/ServerKit/SKHTTPRequest.js +7 -0
  55. package/Root/Frameworks/ServerKit/SKHTTPResponder.js +9 -2
  56. package/Root/Frameworks/ServerKit/SKUserAgent.js +130 -0
  57. package/Root/Frameworks/ServerKit/SKValidatingObject.js +1 -3
  58. package/Root/Frameworks/ServerKit/ServerKit.js +1 -0
  59. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  60. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  61. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  62. package/Root/Frameworks/UIKit/UIAnimation.js +4 -0
  63. package/Root/Frameworks/UIKit/UIContainerView.js +1 -1
  64. package/Root/Frameworks/UIKit/UIContainerViewController.js +3 -35
  65. package/Root/Frameworks/UIKit/UIHTMLDisplayServerCanvasContext.js +6 -1
  66. package/Root/Frameworks/UIKit/UIImageLayer.js +12 -14
  67. package/Root/Frameworks/UIKit/UILayer.js +3 -0
  68. package/Root/Frameworks/UIKit/UIListView.js +44 -7
  69. package/Root/Frameworks/UIKit/UIListViewHeaderFooterView.js +34 -0
  70. package/Root/Frameworks/UIKit/UINavigationBar.js +4 -2
  71. package/Root/Frameworks/UIKit/UINavigationBarItem.js +11 -0
  72. package/Root/Frameworks/UIKit/UINavigationController.js +2 -2
  73. package/Root/Frameworks/UIKit/UISplitViewController.js +9 -87
  74. package/Root/Frameworks/UIKit/UITabView.js +2 -2
  75. package/Root/Frameworks/UIKit/UITabViewController.js +6 -5
  76. package/Root/Frameworks/UIKit/UITextLayer.js +11 -10
  77. package/Root/Frameworks/UIKit/UIView.js +15 -0
  78. package/Root/Frameworks/UIKit/UIViewController.js +39 -0
  79. package/Root/Frameworks/UIKit/UIWindowServer.js +2 -2
  80. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  81. package/package.json +1 -1
@@ -926,6 +926,17 @@ JSClass("UIListView", UIScrollView, {
926
926
  this._cellsContainerView.insertSubviewAtIndex(item.view, viewIndex);
927
927
  },
928
928
 
929
+ sizeToFitSize: function(maxSize){
930
+ var bounds = JSRect(this.bounds.origin, this.contentSize);
931
+ if (maxSize.width < Number.MAX_VALUE){
932
+ bounds.size.width = maxSize.width;
933
+ }
934
+ if (bounds.size.height > maxSize.height){
935
+ bounds.size.height = maxSize.height;
936
+ }
937
+ this.bounds = bounds;
938
+ },
939
+
929
940
  // --------------------------------------------------------------------
930
941
  // MARK: - List Header and Footer
931
942
 
@@ -1550,9 +1561,12 @@ JSClass("UIListView", UIScrollView, {
1550
1561
 
1551
1562
  _createCellAtIndexPath: function(indexPath, rect){
1552
1563
  indexPath = JSIndexPath(indexPath);
1564
+ if (!this.delegate.cellForListViewAtIndexPath){
1565
+ throw new Error("%s must implement cellForListViewAtIndexPath()".sprintf(this.delegate.$class.className));
1566
+ }
1553
1567
  var cell = this.delegate.cellForListViewAtIndexPath(this, indexPath);
1554
1568
  if (cell === null || cell === undefined){
1555
- throw new Error("Got null/undefined cell for indexPath: %s".sprintf(indexPath));
1569
+ throw new Error("%s.cellForListViewAtIndexPath() returned null/undefined cell for indexPath: %s".sprintf(this.delegate.$class.className, indexPath));
1556
1570
  }
1557
1571
  this._adoptCell(cell, indexPath);
1558
1572
  cell.bounds = JSRect(JSPoint.Zero, rect.size);
@@ -1577,9 +1591,12 @@ JSClass("UIListView", UIScrollView, {
1577
1591
  header = this._stickyHeader;
1578
1592
  this._stickyHeader = null;
1579
1593
  }else{
1594
+ if (!this.delegate.headerViewForListViewSection){
1595
+ throw new Error("%s must implement headerViewForListViewSection() when headerHeight is non-zero".sprintf(this.delegate.$class.className));
1596
+ }
1580
1597
  header = this.delegate.headerViewForListViewSection(this, section);
1581
1598
  if (header === null || header === undefined){
1582
- throw new Error("Got null/undefined header for section: %d".sprintf(section));
1599
+ throw new Error("%s.headerViewForListViewSection() returned null/undefined header for section: %d".sprintf(this.delegate.$class.className, section));
1583
1600
  }
1584
1601
  }
1585
1602
  header.kind = UIListViewHeaderFooterView.Kind.header;
@@ -1587,19 +1604,24 @@ JSClass("UIListView", UIScrollView, {
1587
1604
  header.bounds = JSRect(JSPoint.Zero, rect.size);
1588
1605
  header.position = JSPoint(rect.origin.x + header.bounds.size.width * header.anchorPoint.x, rect.origin.y + header.bounds.size.height * header.anchorPoint.y);
1589
1606
  this._styler.updateHeader(header, section);
1607
+ header.setNeedsLayout();
1590
1608
  return header;
1591
1609
  },
1592
1610
 
1593
1611
  _createFooterAtSection: function(section, rect){
1612
+ if (!this.delegate.footerViewForListViewSection){
1613
+ throw new Error("%s must implement footerViewForListViewSection() when footerHeight is non-zero".sprintf(this.delegate.$class.className));
1614
+ }
1594
1615
  var footer = this.delegate.footerViewForListViewSection(this, section);
1595
1616
  if (footer === null || footer === undefined){
1596
- throw new Error("Got null/undefined footer for section: %d".sprintf(section));
1617
+ throw new Error("%s.headerViewForListViewSection() returned null/undefined header for section: %d".sprintf(this.delegate.$class.className, section));
1597
1618
  }
1598
1619
  footer.kind = UIListViewHeaderFooterView.Kind.footer;
1599
1620
  footer.section = section;
1600
1621
  footer.bounds = JSRect(JSPoint.Zero, rect.size);
1601
1622
  footer.position = JSPoint(rect.origin.x + footer.bounds.size.width * footer.anchorPoint.x, rect.origin.y + footer.bounds.size.height * footer.anchorPoint.y);
1602
1623
  this._styler.updateFooter(footer, section);
1624
+ footer.setNeedsLayout();
1603
1625
  return footer;
1604
1626
  },
1605
1627
 
@@ -2581,6 +2603,20 @@ JSClass("UIListView", UIScrollView, {
2581
2603
  return indexPaths;
2582
2604
  },
2583
2605
 
2606
+ visibleCells: JSReadOnlyProperty(),
2607
+
2608
+ getVisibleCells: function(){
2609
+ var cells = [];
2610
+ var item;
2611
+ for (var i = 0, l = this._visibleItems.length; i < l; ++i){
2612
+ item = this._visibleItems[i];
2613
+ if (item.kind === VisibleItem.Kind.cell){
2614
+ cells.push(item.view);
2615
+ }
2616
+ }
2617
+ return cells;
2618
+ },
2619
+
2584
2620
  // --------------------------------------------------------------------
2585
2621
  // MARK: - Scrolling
2586
2622
 
@@ -2769,7 +2805,7 @@ VisibleItemIterator.prototype = Object.create({}, {
2769
2805
  value: function(){
2770
2806
  var height;
2771
2807
  var item;
2772
- if (this.item !== null && this.item.Kind === VisibleItem.Kind.footer){
2808
+ if (this.item !== null && this.item.kind === VisibleItem.Kind.footer){
2773
2809
  ++this.section;
2774
2810
  }
2775
2811
  while (this.section < this.listView.__numberOfSections){
@@ -2790,7 +2826,7 @@ VisibleItemIterator.prototype = Object.create({}, {
2790
2826
  item = new VisibleItem(VisibleItem.Kind.cell, JSRect(0, this.y, this.width, height), this.cellIterator.indexPath);
2791
2827
  return item;
2792
2828
  }
2793
- if (this.item === null || this.item.section <= this.section){
2829
+ if (this.item === null || this.item.indexPath.section <= this.section){
2794
2830
  height = this.listView._heightForFooterInSection(this.section);
2795
2831
  if (height > 0){
2796
2832
  item = new VisibleItem(VisibleItem.Kind.footer, JSRect(0, this.y, this.width, height), JSIndexPath([this.section]));
@@ -3133,7 +3169,8 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
3133
3169
  }
3134
3170
  if (cell.selected){
3135
3171
  cell.contentView.borderColor = this.contextSelectedCellBorderColor;
3136
- if (this.showsMutedState && !cell.listView.keyActive){
3172
+ var showsMutedState = this.showsMutedState && UIDevice.shared && UIDevice.shared.primaryPointerType != UIUserInterface.PointerType.touch;
3173
+ if (showsMutedState && !cell.listView.keyActive){
3137
3174
  cell.contentView.backgroundColor = this.mutedSelectedCellBackgroundColor;
3138
3175
  if (cell._titleLabel !== null){
3139
3176
  cell._titleLabel.textColor = this.mutedSelectedCellTextColor;
@@ -3214,7 +3251,7 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
3214
3251
 
3215
3252
  layoutCell: function(cell){
3216
3253
  cell._contentView.frame = cell.bounds.rectWithInsets(this.cellContentInsets);
3217
- var size = JSSize(cell.bounds.size.width - cell._titleInsets.left - cell._titleInsets.right, 0);
3254
+ var size = JSSize(cell._contentView.bounds.size.width - cell._titleInsets.width, 0);
3218
3255
  var origin = JSPoint(cell._titleInsets.left, 0);
3219
3256
  var indent = this._indentationForCell(cell);
3220
3257
  origin.x += indent;
@@ -41,10 +41,17 @@ JSClass("UIListViewHeaderFooterView", UIView, {
41
41
  initWithSpec: function(spec){
42
42
  UIListViewHeaderFooterView.$super.initWithSpec.call(this, spec);
43
43
  this._commonHeaderFooterInit();
44
+ if (spec.containsKey("accessorySize")){
45
+ this._accessorySize = spec.valueForKey("accessorySize", JSSize);
46
+ }
47
+ if (spec.containsKey("accessoryView")){
48
+ this.accessoryView = spec.valueForKey("accessoryView", UIView);
49
+ }
44
50
  },
45
51
 
46
52
  _commonHeaderFooterInit: function(){
47
53
  this.stylerProperties = {};
54
+ this._accessorySize = JSSize(20, 20);
48
55
  this._titleInsets = JSInsets(0, 10);
49
56
  this._contentView = UIView.init();
50
57
  this.addSubview(this._contentView);
@@ -66,12 +73,39 @@ JSClass("UIListViewHeaderFooterView", UIView, {
66
73
  this._titleInsets = JSInsets(titleInsets);
67
74
  this.setNeedsLayout();
68
75
  },
76
+
77
+ accessoryView: JSDynamicProperty("_accessoryView", null),
78
+ accessorySize: JSDynamicProperty("_accessorySize", null),
79
+
80
+ setAccessoryView: function(accessoryView){
81
+ if (accessoryView === this._accessoryView){
82
+ return;
83
+ }
84
+ if (this._accessoryView !== null){
85
+ this._accessoryView.removeFromSuperview();
86
+ }
87
+ this._accessoryView = accessoryView;
88
+ if (this._accessoryView !== null){
89
+ this.contentView.addSubview(this._accessoryView);
90
+ }
91
+ this.setNeedsLayout();
92
+ },
93
+
94
+ setAccessorySize: function(size){
95
+ this._accessorySize = JSSize(size);
96
+ this.setNeedsLayout();
97
+ },
69
98
 
70
99
  layoutSubviews: function(){
71
100
  UIListViewHeaderFooterView.$super.layoutSubviews.call(this);
72
101
  this._contentView.frame = this.bounds;
73
102
  var size = JSSize(this.bounds.size.width - this._titleInsets.left - this._titleInsets.right, 0);
74
103
  var origin = JSPoint(this._titleInsets.left, 0);
104
+ if (this._accessoryView !== null){
105
+ this._accessoryView.bounds = JSRect(JSPoint.Zero, this._accessorySize);
106
+ this._accessoryView.position = JSPoint(origin.x + size.width - this._accessorySize.width / 2, this._contentView.bounds.center.y);
107
+ size.width -= this._accessorySize.width + this._titleInsets.right;
108
+ }
75
109
  if (this._titleLabel !== null){
76
110
  if (this._detailLabel !== null){
77
111
  size.height = this._titleLabel.font.displayLineHeight + this._detailLabel.font.displayLineHeight;
@@ -90,11 +90,11 @@ JSClass("UINavigationBar", UIView, {
90
90
  pushAnimator: null,
91
91
 
92
92
  createPushAnimator: function(){
93
- return UIViewPropertyAnimator.initWithDuration(0.2, UIAnimation.Timing.easeInOut);
93
+ return UIViewPropertyAnimator.initWithDuration(UIAnimation.Duration.transition, UIAnimation.Timing.easeInOut);
94
94
  },
95
95
 
96
96
  createPopAnimator: function(){
97
- return UIViewPropertyAnimator.initWithDuration(0.2, UIAnimation.Timing.easeInOut);
97
+ return UIViewPropertyAnimator.initWithDuration(UIAnimation.Duration.transition, UIAnimation.Timing.easeInOut);
98
98
  },
99
99
 
100
100
  pushItem: function(item, animated){
@@ -776,6 +776,8 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
776
776
  button._imageView.automaticRenderMode = JSImage.RenderMode.template;
777
777
  }
778
778
  button.addAction(barItem.action, barItem.target);
779
+ button.enabled = barItem.enabled;
780
+ barItem._barButton = button;
779
781
  return button;
780
782
  }
781
783
 
@@ -28,6 +28,14 @@ JSClass("UINavigationBarItem", JSObject, {
28
28
  action: JSDynamicProperty('_action', null),
29
29
  enabled: JSDynamicProperty('_enabled', true),
30
30
  view: JSDynamicProperty('_view', null),
31
+ _barButton: null,
32
+
33
+ initWithTitle: function(title, action, target){
34
+ this._title = title;
35
+ this._target = target;
36
+ this._action = action;
37
+ this._commonItemInit();
38
+ },
31
39
 
32
40
  initWithImage: function(image, action, target){
33
41
  this._image = image;
@@ -81,6 +89,9 @@ JSClass("UINavigationBarItem", JSObject, {
81
89
  if (this._view !== null && this._view.isKindOfClass(UIControl)){
82
90
  this._view.enabled = this.enabled;
83
91
  }
92
+ if (this._barButton !== null){
93
+ this._barButton.enabled = this.enabled;
94
+ }
84
95
  }
85
96
 
86
97
  });
@@ -152,11 +152,11 @@ JSClass("UINavigationController", UIViewController, {
152
152
  pushAnimator: null,
153
153
 
154
154
  createPushAnimator: function(){
155
- return UIViewPropertyAnimator.initWithDuration(0.3, UIAnimation.Timing.easeInOut);
155
+ return UIViewPropertyAnimator.initWithDuration(UIAnimation.Duration.transition, UIAnimation.Timing.easeInOut);
156
156
  },
157
157
 
158
158
  createPopAnimator: function(){
159
- return UIViewPropertyAnimator.initWithDuration(0.3, UIAnimation.Timing.easeInOut);
159
+ return UIViewPropertyAnimator.initWithDuration(UIAnimation.Duration.transition, UIAnimation.Timing.easeInOut);
160
160
  },
161
161
 
162
162
  pushViewController: function(viewController, animated){
@@ -120,70 +120,18 @@ JSClass("UISplitViewController", UIViewController, {
120
120
  },
121
121
 
122
122
  setLeadingViewController: function(leadingViewController){
123
- var callAppearanceMethods = this.isViewVisible && this.leadingViewOpen;
124
- var disappearingViewController = null;
125
- if (this._leadingViewController !== null){
126
- if (callAppearanceMethods){
127
- this._leadingViewController.viewWillDisappear(false);
128
- disappearingViewController = this._leadingViewController;
129
- }
130
- this._leadingViewController.removeFromParentViewController();
131
- }
123
+ this.replaceChildViewController(this._leadingViewController, leadingViewController);
132
124
  this._leadingViewController = leadingViewController;
133
- if (this._leadingViewController){
134
- if (callAppearanceMethods){
135
- this._leadingViewController.viewWillAppear(false);
136
- }
137
- this.addChildViewController(this._leadingViewController);
138
- }
139
- if (this._view !== null){
140
- var view = null;
141
- if (this._leadingViewController !== null){
142
- view = this._leadingViewController.view;
143
- }
144
- this._view.leadingView = view;
145
- }
146
- if (callAppearanceMethods){
147
- if (disappearingViewController !== null){
148
- disappearingViewController.enqueueDidDisappear();
149
- }
150
- if (this._leadingViewController !== null){
151
- this._leadingViewController.enqueueDidAppear();
152
- }
125
+ if (this.isViewLoaded){
126
+ this.view.leadingView = leadingViewController !== null ? leadingViewController.view : null;
153
127
  }
154
128
  },
155
129
 
156
130
  setTrailingViewController: function(trailingViewController){
157
- var callAppearanceMethods = this.isViewVisible && this.trailingViewOpen;
158
- var disappearingViewController = null;
159
- if (this._trailingViewController !== null){
160
- if (callAppearanceMethods){
161
- this._trailingViewController.viewWillDisappear(false);
162
- disappearingViewController = this._trailingViewController;
163
- }
164
- this._trailingViewController.removeFromParentViewController();
165
- }
131
+ this.replaceChildViewController(this._trailingViewController, trailingViewController);
166
132
  this._trailingViewController = trailingViewController;
167
- if (this._trailingViewController){
168
- if (callAppearanceMethods){
169
- this._trailingViewController.viewWillAppear(false);
170
- }
171
- this.addChildViewController(this._trailingViewController);
172
- }
173
- if (this._view !== null){
174
- var view = null;
175
- if (this._trailingViewController !== null){
176
- view = this._trailingViewController.view;
177
- }
178
- this._view.trailingView = view;
179
- }
180
- if (callAppearanceMethods){
181
- if (disappearingViewController !== null){
182
- disappearingViewController.enqueueDidDisappear();
183
- }
184
- if (this._trailingViewController !== null){
185
- this._trailingViewController.enqueueDidAppear();
186
- }
133
+ if (this.isViewLoaded){
134
+ this.view.trailingView = trailingViewController !== null ? trailingViewController.view : null;
187
135
  }
188
136
  },
189
137
 
@@ -192,36 +140,10 @@ JSClass("UISplitViewController", UIViewController, {
192
140
  this._setMainViewControllerCollapsed(mainViewController);
193
141
  return;
194
142
  }
195
- var callAppearanceMethods = this.isViewVisible;
196
- var disappearingViewController = null;
197
- if (this._mainViewController !== null && this._mainViewController.parentViewController === this){
198
- if (callAppearanceMethods){
199
- this._mainViewController.viewWillDisappear(false);
200
- disappearingViewController = this._mainViewController;
201
- }
202
- this._mainViewController.removeFromParentViewController();
203
- }
143
+ this.replaceChildViewController(this._mainViewController, mainViewController);
204
144
  this._mainViewController = mainViewController;
205
- if (this._mainViewController){
206
- if (callAppearanceMethods){
207
- this._mainViewController.viewWillAppear(false);
208
- }
209
- this.addChildViewController(this._mainViewController);
210
- }
211
- if (this._view !== null){
212
- var view = null;
213
- if (this._mainViewController !== null){
214
- view = this._mainViewController.view;
215
- }
216
- this._view.mainView = view;
217
- }
218
- if (callAppearanceMethods){
219
- if (disappearingViewController !== null){
220
- disappearingViewController.enqueueDidDisappear();
221
- }
222
- if (this._mainViewController !== null){
223
- this._mainViewController.enqueueDidAppear();
224
- }
145
+ if (this.isViewLoaded){
146
+ this.view.mainView = mainViewController !== null ? mainViewController.view : null;
225
147
  }
226
148
  },
227
149
 
@@ -790,10 +790,10 @@ JSClass("UITabViewDefaultStyler", UITabViewStyler, {
790
790
  this.activeSelectedTitleColor = this.selectedTitleColor;
791
791
  }
792
792
  if (this.normalItemColor === null){
793
- this.normalItemColor = JSColor.highlight;
793
+ this.normalItemColor = JSColor.controlBackground;
794
794
  }
795
795
  if (this.selectedItemColor === null){
796
- this.selectedItemColor = JSColor.highlight.colorDarkenedByPercentage(0.2);
796
+ this.selectedItemColor = JSColor.highlight;
797
797
  }
798
798
  if (this.activeItemColor === null){
799
799
  this.activeItemColor = this.normalItemColor.colorDarkenedByPercentage(0.1);
@@ -30,11 +30,12 @@ JSClass("UITabViewController", UIViewController, {
30
30
  initWithViewControllers: function(viewControllers, styler){
31
31
  UITabViewController.$super.init.call(this);
32
32
  this._viewControllers = JSCopy(viewControllers);
33
- this._styler = styler || null;
33
+ this._tabViewStyler = styler || null;
34
34
  },
35
35
 
36
36
  initWithSpec: function(spec){
37
37
  this._viewControllers = [];
38
+ this._tabViewStyler = null;
38
39
  var viewController;
39
40
  var i, l;
40
41
  if (spec.containsKey('viewControllers')){
@@ -51,7 +52,7 @@ JSClass("UITabViewController", UIViewController, {
51
52
  },
52
53
 
53
54
  loadView: function(){
54
- this._view = UITabView.initWithStyler(this._styler);
55
+ this._view = UITabView.initWithStyler(this._tabViewStyler);
55
56
  },
56
57
 
57
58
  viewDidLoad: function(){
@@ -85,9 +86,9 @@ JSClass("UITabViewController", UIViewController, {
85
86
  selectedViewController.viewWillDisappear(animated);
86
87
  }
87
88
  },
88
-
89
- viewDisDisappear: function(animated){
90
- UITabViewController.$super.viewDisDisappear.call(this, animated);
89
+
90
+ viewDidDisappear: function(animated){
91
+ UITabViewController.$super.viewDidDisappear.call(this, animated);
91
92
  var selectedViewController = this.selectedViewController;
92
93
  if (selectedViewController !== null){
93
94
  selectedViewController.viewDidDisappear(animated);
@@ -45,7 +45,7 @@ JSClass("UITextLayer", UILayer, {
45
45
  text: JSDynamicProperty(),
46
46
  attributedText: JSDynamicProperty(),
47
47
  font: JSDynamicProperty(),
48
- textColor: JSDynamicProperty(),
48
+ textColor: UILayerAnimatedProperty(),
49
49
  lineBreakMode: UITextLayerContainerProperty(),
50
50
  textAlignment: UITextLayerContainerProperty(),
51
51
  lineSpacing: UITextLayerContainerProperty(),
@@ -74,6 +74,7 @@ JSClass("UITextLayer", UILayer, {
74
74
  this._textStorage = JSTextStorage.init();
75
75
  this._textStorage.addLayoutManager(this._textLayoutManager);
76
76
  this._textLayoutManager.addTextContainer(this._textContainer);
77
+ this.model.textColor = JSColor.black;
77
78
  this.font = JSFont.systemFontOfSize(JSFont.Size.normal);
78
79
  this.setNeedsLayout();
79
80
  },
@@ -95,15 +96,6 @@ JSClass("UITextLayer", UILayer, {
95
96
  }
96
97
  this._textLayoutManager.defaultFont = font;
97
98
  },
98
-
99
- getTextColor: function(){
100
- return this._textLayoutManager.defaultTextColor;
101
- },
102
-
103
- setTextColor: function(color){
104
- this._textLayoutManager.defaultTextColor = color;
105
- this.setNeedsDisplay();
106
- },
107
99
 
108
100
  setTextInsets: function(insets){
109
101
  this._textInsets = JSInsets(insets);
@@ -190,6 +182,7 @@ JSClass("UITextLayer", UILayer, {
190
182
 
191
183
  drawInContext: function(context){
192
184
  var textOrigin = JSPoint(this._textInsets.left, this._textInsets.top);
185
+ this._textLayoutManager.defaultTextColor = this.presentation.textColor;
193
186
  this._textLayoutManager.layoutIfNeeded();
194
187
  this._textLayoutManager.drawContainerInContextAtPoint(this._textContainer, context, textOrigin);
195
188
  this._displayQueued = false;
@@ -217,6 +210,7 @@ JSClass("UITextLayer", UILayer, {
217
210
  layoutSublayers: function(){
218
211
  UITextLayer.$super.layoutSublayers.call(this);
219
212
  this._textContainer.origin = JSPoint(this._textInsets.left, this._textInsets.top);
213
+ this._textLayoutManager.defaultTextColor = this.presentation.textColor;
220
214
  this._textLayoutManager.layoutIfNeeded();
221
215
  if ((this._widthTracksText || this._heightTracksText) && this._textContainer.textFrame !== null){
222
216
  var width = this.bounds.size.width;
@@ -268,4 +262,11 @@ JSClass("UITextLayer", UILayer, {
268
262
 
269
263
  });
270
264
 
265
+ UITextLayer.Properties = Object.create(UILayer.Properties, {
266
+ textColor: {
267
+ writable: true,
268
+ value: null,
269
+ }
270
+ });
271
+
271
272
  })();
@@ -211,10 +211,16 @@ JSClass('UIView', UIResponder, {
211
211
  subviews: null,
212
212
 
213
213
  addSubview: function(subview){
214
+ if (!(subview instanceof UIView)){
215
+ throw new TypeError("addSubview() given view is not a UIView");
216
+ }
214
217
  return this._insertSubviewAtIndex(subview, this.subviews.length, this.layer.sublayers.length);
215
218
  },
216
219
 
217
220
  insertSubviewAtIndex: function(subview, index){
221
+ if (!(subview instanceof UIView)){
222
+ throw new TypeError("insertSubviewAtIndex() given view is not a UIView");
223
+ }
218
224
  var layerIndex;
219
225
  if (index < this.subviews.length){
220
226
  layerIndex = this.subviews[index].layer.sublayerIndex;
@@ -225,6 +231,9 @@ JSClass('UIView', UIResponder, {
225
231
  },
226
232
 
227
233
  insertSubviewBelowSibling: function(subview, sibling){
234
+ if (!(subview instanceof UIView)){
235
+ throw new TypeError("insertSubviewBelowSibling() given view is not a UIView");
236
+ }
228
237
  if (sibling.superview !== this){
229
238
  throw Error('Cannot insert subview [%s] in view [%s] because sibling view [%s] is not a valid subview.');
230
239
  }
@@ -232,6 +241,9 @@ JSClass('UIView', UIResponder, {
232
241
  },
233
242
 
234
243
  insertSubviewAboveSibling: function(subview, sibling){
244
+ if (!(subview instanceof UIView)){
245
+ throw new TypeError("insertSubviewAboveSibling() given view is not a UIView");
246
+ }
235
247
  if (sibling.superview !== this){
236
248
  throw Error('Cannot insert subview [%s] in view [%s] because sibling view [%s] is not a valid subview.');
237
249
  }
@@ -239,6 +251,9 @@ JSClass('UIView', UIResponder, {
239
251
  },
240
252
 
241
253
  removeSubview: function(subview){
254
+ if (!(subview instanceof UIView)){
255
+ throw new TypeError("removeSubview() given subview is not a UIView");
256
+ }
242
257
  if (subview.superview === this){
243
258
  this.layer.removeSublayer(subview.layer);
244
259
  for (var i = subview.subviewIndex + 1, l = this.subviews.length; i < l; ++i){
@@ -192,6 +192,45 @@ JSClass("UIViewController", UIResponder, {
192
192
  didMoveToParentViewController: function(parentViewController){
193
193
  },
194
194
 
195
+ replaceChildViewController: function(previousChildViewController, childViewController, animator){
196
+ if (previousChildViewController === childViewController){
197
+ return;
198
+ }
199
+ if (this.isViewLoaded && this.isViewVisible){
200
+ var animated = animator !== undefined && animator !== null;
201
+ if (previousChildViewController !== null){
202
+ previousChildViewController.viewWillDisappear(animated);
203
+ previousChildViewController.removeFromParentViewController();
204
+ }
205
+ if (childViewController !== null){
206
+ // trigger childViewController.viewDidLoad by accessing .view
207
+ var view = childViewController.view;
208
+ this.addChildViewController(childViewController);
209
+ childViewController.viewWillAppear(animated);
210
+ }
211
+ var completion = function(){
212
+ if (previousChildViewController !== null){
213
+ previousChildViewController.viewDidDisappear(animated);
214
+ }
215
+ if (childViewController !== null){
216
+ childViewController.viewDidAppear(animated);
217
+ }
218
+ };
219
+ if (animated){
220
+ animator.addCompletion(completion, this);
221
+ }else{
222
+ this.view.layer._displayServer.schedule(completion, this);
223
+ }
224
+ }else{
225
+ if (previousChildViewController !== null){
226
+ previousChildViewController.removeFromParentViewController();
227
+ }
228
+ if (childViewController !== null){
229
+ this.addChildViewController(childViewController);
230
+ }
231
+ }
232
+ },
233
+
195
234
  // -------------------------------------------------------------------------
196
235
  // MARK: - Responder
197
236
 
@@ -580,7 +580,7 @@ JSClass("UIWindowServer", JSObject, {
580
580
  }
581
581
 
582
582
  if (ignore){
583
- logger.warn("Ignoring mouse event: %d".sprintf(type));
583
+ logger.info("Ignoring mouse event: %d".sprintf(type));
584
584
  return;
585
585
  }
586
586
 
@@ -904,7 +904,7 @@ JSClass("UIWindowServer", JSObject, {
904
904
  // Create or update the active touch event
905
905
  if (this.activeTouchEvent === null){
906
906
  if (type != UIEvent.Type.touchesBegan){
907
- logger.warn("Ignoring touch event: %d", type);
907
+ logger.info("Ignoring touch event: %d", type);
908
908
  return;
909
909
  }
910
910
  this.activeTouchEvent = UIEvent.initTouchEventWithType(type, timestamp);
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKitTesting
3
- JSBundleVersion: 2021.43.0
3
+ JSBundleVersion: 2021.52.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=10.10.0"
10
10
  },
11
11
  "name": "@breakside/jskit",
12
- "version": "2021.43.0",
12
+ "version": "2021.52.0",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"