@breakside/jskit 2022.53.0 → 2023.3.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 (43) 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/io.breakside.JSKit.Foundation-bundle.js +2 -2
  7. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  8. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  9. package/Info.json +2 -2
  10. package/Node/io.breakside.jskit-bundle.js +2 -2
  11. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  12. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  13. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  14. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  15. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  16. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  17. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  18. package/Root/Frameworks/DOM/Info.yaml +1 -1
  19. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  20. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  21. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  22. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  23. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  24. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  25. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  26. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  27. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  28. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  29. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  30. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  31. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  32. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  33. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  34. package/Root/Frameworks/UIKit/UICollectionReusableView.js +13 -0
  35. package/Root/Frameworks/UIKit/UICollectionView.js +620 -67
  36. package/Root/Frameworks/UIKit/UICollectionViewCell.js +39 -2
  37. package/Root/Frameworks/UIKit/UICollectionViewLayout.js +34 -3
  38. package/Root/Frameworks/UIKit/UIListView.js +46 -0
  39. package/Root/Frameworks/UIKit/UIListViewCell.js +33 -1
  40. package/Root/Frameworks/UIKit/UIView.js +15 -0
  41. package/Root/Frameworks/UIKit/UIWindow.js +3 -0
  42. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  43. package/package.json +1 -1
@@ -29,12 +29,18 @@ JSClass("UICollectionViewCell", UICollectionReusableView, {
29
29
  styler.layoutCell(this);
30
30
  },
31
31
 
32
+ prepareForReuse: function(){
33
+ this.active = false;
34
+ this.over = false;
35
+ },
36
+
32
37
  // --------------------------------------------------------------------
33
38
  // MARK: - State
34
39
 
35
40
  state: JSReadOnlyProperty('_state', null),
36
41
  active: JSDynamicProperty(null, null, 'isActive'),
37
42
  selected: JSDynamicProperty(null, null, 'isSelected'),
43
+ over: JSDynamicProperty(null, null, 'isOver'),
38
44
  contextSelected: JSDynamicProperty(null, null, 'isContextSelected'),
39
45
  dropTarget: JSDynamicProperty(null, null, 'isDropTarget'),
40
46
 
@@ -95,6 +101,14 @@ JSClass("UICollectionViewCell", UICollectionReusableView, {
95
101
  this._toggleState(UICollectionViewCell.State.contextSelected, isContextSelected);
96
102
  },
97
103
 
104
+ isOver: function(){
105
+ return (this._state & UICollectionViewCell.State.over) === UICollectionViewCell.State.over;
106
+ },
107
+
108
+ setOver: function(isOver){
109
+ this._toggleState(UICollectionViewCell.State.over, isOver);
110
+ },
111
+
98
112
  isDropTarget: function(){
99
113
  return (this._state & UICollectionViewCell.State.dropTarget) === UICollectionViewCell.State.dropTarget;
100
114
  },
@@ -103,6 +117,28 @@ JSClass("UICollectionViewCell", UICollectionReusableView, {
103
117
  this._toggleState(UICollectionViewCell.State.dropTarget, isDropTarget);
104
118
  },
105
119
 
120
+ // --------------------------------------------------------------------
121
+ // MARK: - Over State
122
+
123
+ hasOverState: JSDynamicProperty("_hasOverState", false),
124
+
125
+ setHasOverState: function(hasOverState){
126
+ this._hasOverState = hasOverState;
127
+ if (hasOverState){
128
+ this.contentView.startMouseTracking(UIView.MouseTracking.enterAndExit);
129
+ }else{
130
+ this.contentView.stopMouseTracking();
131
+ }
132
+ },
133
+
134
+ mouseEntered: function(event){
135
+ this.over = true;
136
+ },
137
+
138
+ mouseExited: function(event){
139
+ this.over = false;
140
+ },
141
+
106
142
  // --------------------------------------------------------------------
107
143
  // MARK: - Accessibility
108
144
 
@@ -126,6 +162,7 @@ UICollectionViewCell.State = {
126
162
  active: 1 << 1,
127
163
  selected: 1 << 2,
128
164
  contextSelected: 1 << 3,
129
- dropTarget: 1 << 4,
130
- firstUserState: 1 << 5
165
+ over: 1 << 4,
166
+ dropTarget: 1 << 5,
167
+ firstUserState: 1 << 6
131
168
  };
@@ -32,6 +32,16 @@ JSClass("UICollectionViewLayout", JSObject, {
32
32
  layoutAttributesForElementsInRect: function(rect){
33
33
  },
34
34
 
35
+ layoutAttributesForElement: function(element){
36
+ if (element.attributes.elementCategory === UICollectionView.ElementCategory.cell){
37
+ return this.layoutAttributesForCellAtIndexPath(element.attributes.indexPath);
38
+ }
39
+ if (element.attributes.elementCategory === UICollectionView.ElementCategory.supplimentary){
40
+ return this.layoutAttributesForSupplimentaryViewAtIndexPath(element.attributes.indexPath, element.attributes.kind);
41
+ }
42
+ return element.attributes;
43
+ },
44
+
35
45
  layoutAttributesForCellAtIndexPath: function(indexPath){
36
46
  },
37
47
 
@@ -57,7 +67,6 @@ JSClass("UICollectionViewLayoutAttributes", JSObject, {
57
67
  this.elementCategory = UICollectionView.ElementCategory.cell;
58
68
  this.indexPath = JSIndexPath(indexPath);
59
69
  this.frame = JSRect(frame);
60
- this.elementIdentifier = indexPath.toString();
61
70
  this.transform = JSAffineTransform.Identity;
62
71
  },
63
72
 
@@ -66,17 +75,39 @@ JSClass("UICollectionViewLayoutAttributes", JSObject, {
66
75
  this.kind = kind;
67
76
  this.indexPath = JSIndexPath(indexPath);
68
77
  this.frame = JSRect(frame);
69
- this.elementIdentifier = "%s/%s".sprintf(indexPath.toString(), kind);
70
78
  this.transform = JSAffineTransform.Identity;
71
79
  },
72
80
 
81
+ copy: function(){
82
+ var copy = this.$class.init();
83
+ copy.elementCategory = this.elementCategory;
84
+ copy.kind = this.kind;
85
+ copy.indexPath = JSIndexPath(this.indexPath);
86
+ copy.frame = JSRect(this.frame);
87
+ copy.rowIndex = this.rowIndex;
88
+ copy.columnIndex = this.columnIndex;
89
+ copy.transform = JSAffineTransform(this.transform);
90
+ return copy;
91
+ },
92
+
73
93
  elementCategory: 0,
74
94
  kind: null,
75
95
  indexPath: null,
76
96
  frame: null,
77
97
  rowIndex: 0,
78
98
  columnIndex: 0,
79
- elementIdentifier: null,
80
99
  transform: null,
81
100
 
101
+ elementIdentifier: JSReadOnlyProperty(),
102
+
103
+ getElementIdentifier: function(){
104
+ if (this.elementCategory === UICollectionView.ElementCategory.cell){
105
+ return this.indexPath.toString();
106
+ }
107
+ if (this.elementCategory === UICollectionView.ElementCategory.supplimentary){
108
+ return "%s/%s".sprintf(this.kind, this.indexPath.toString());
109
+ }
110
+ return "%s/%s/%s".sprintf(this.elementCategory, this.kind, this.indexPath.toString());
111
+ },
112
+
82
113
  });
@@ -1594,6 +1594,7 @@ JSClass("UIListView", UIScrollView, {
1594
1594
  cell.bounds = JSRect(JSPoint.Zero, rect.size);
1595
1595
  cell.position = JSPoint(rect.origin.x + cell.bounds.size.width * cell.anchorPoint.x, rect.origin.y + cell.bounds.size.height * cell.anchorPoint.y);
1596
1596
  cell.active = false;
1597
+ cell.over = false;
1597
1598
  this._updateCellState(cell);
1598
1599
  cell.update();
1599
1600
  cell.setNeedsLayout();
@@ -2984,6 +2985,10 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
2984
2985
  activeCellDetailTextColor: null,
2985
2986
  activeCellBackgroundColor: null,
2986
2987
  activeCellSeparatorColor: null,
2988
+ overCellTextColor: null,
2989
+ overCellDetailTextColor: null,
2990
+ overCellBackgroundColor: null,
2991
+ overCellSeparatorColor: null,
2987
2992
  showsMutedState: true,
2988
2993
  mutedSelectedCellTextColor: null,
2989
2994
  mutedSelectedCellDetailTextColor: null,
@@ -3050,6 +3055,18 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
3050
3055
  if (spec.containsKey('activeCellSeparatorColor')){
3051
3056
  this.activeCellSeparatorColor = spec.valueForKey("activeCellSeparatorColor", JSColor);
3052
3057
  }
3058
+ if (spec.containsKey('overCellTextColor')){
3059
+ this.overCellTextColor = spec.valueForKey("overCellTextColor", JSColor);
3060
+ }
3061
+ if (spec.containsKey('overCellDetailTextColor')){
3062
+ this.overCellDetailTextColor = spec.valueForKey("overCellDetailTextColor", JSColor);
3063
+ }
3064
+ if (spec.containsKey('overCellBackgroundColor')){
3065
+ this.overCellBackgroundColor = spec.valueForKey("overCellBackgroundColor", JSColor);
3066
+ }
3067
+ if (spec.containsKey('overCellSeparatorColor')){
3068
+ this.overCellSeparatorColor = spec.valueForKey("overCellSeparatorColor", JSColor);
3069
+ }
3053
3070
  if (spec.containsKey('mutedSelectedCellTextColor')){
3054
3071
  this.mutedSelectedCellTextColor = spec.valueForKey("mutedSelectedCellTextColor", JSColor);
3055
3072
  }
@@ -3165,6 +3182,18 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
3165
3182
  if (this.activeCellSeparatorColor === null){
3166
3183
  this.activeCellSeparatorColor = this.cellSeparatorColor;
3167
3184
  }
3185
+ if (this.overCellBackgroundColor === null){
3186
+ this.overCellBackgroundColor = this.cellBackgroundColor;
3187
+ }
3188
+ if (this.overCellTextColor === null){
3189
+ this.overCellTextColor = this.cellTextColor;
3190
+ }
3191
+ if (this.overCellDetailTextColor === null){
3192
+ this.overCellDetailTextColor = this.cellDetailTextColor;
3193
+ }
3194
+ if (this.overCellSeparatorColor === null){
3195
+ this.overCellSeparatorColor = this.cellSeparatorColor;
3196
+ }
3168
3197
  if (this.mutedSelectedCellTextColor === null){
3169
3198
  this.mutedSelectedCellTextColor = this.cellTextColor;
3170
3199
  }
@@ -3261,6 +3290,23 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
3261
3290
  if (cell.stylerProperties.separatorLayer){
3262
3291
  cell.stylerProperties.separatorLayer.backgroundColor = this.activeCellSeparatorColor;
3263
3292
  }
3293
+ }else if (cell.over){
3294
+ cell.contentView.backgroundColor = this.overCellBackgroundColor;
3295
+ if (cell._titleLabel !== null){
3296
+ cell._titleLabel.textColor = this.overCellTextColor;
3297
+ }
3298
+ if (cell._detailLabel !== null){
3299
+ cell._detailLabel.textColor = this.overCellDetailTextColor;
3300
+ }
3301
+ if (cell._imageView !== null){
3302
+ cell._imageView.templateColor = this.overCellTextColor;
3303
+ }
3304
+ if (cell._accessoryView !== null && cell._accessoryView.isKindOfClass(UIImageView)){
3305
+ cell._accessoryView.templateColor = this.overCellTextColor;
3306
+ }
3307
+ if (cell.stylerProperties.separatorLayer){
3308
+ cell.stylerProperties.separatorLayer.backgroundColor = this.overCellSeparatorColor;
3309
+ }
3264
3310
  }else{
3265
3311
  cell.contentView.backgroundColor = this.cellBackgroundColor;
3266
3312
  if (cell._titleLabel !== null){
@@ -147,6 +147,7 @@ JSClass("UIListViewCell", UIView, {
147
147
  active: JSDynamicProperty(null, null, 'isActive'),
148
148
  selected: JSDynamicProperty(null, null, 'isSelected'),
149
149
  contextSelected: JSDynamicProperty(null, null, 'isContextSelected'),
150
+ over: JSDynamicProperty(null, null, 'isOver'),
150
151
 
151
152
  _updateState: function(newState){
152
153
  if (newState != this._state){
@@ -205,6 +206,36 @@ JSClass("UIListViewCell", UIView, {
205
206
  this._toggleState(UIListViewCell.State.contextSelected, isContextSelected);
206
207
  },
207
208
 
209
+ isOver: function(){
210
+ return (this._state & UIListViewCell.State.over) === UIListViewCell.State.over;
211
+ },
212
+
213
+ setOver: function(isOver){
214
+ this._toggleState(UIListViewCell.State.over, isOver);
215
+ },
216
+
217
+ // --------------------------------------------------------------------
218
+ // MARK: - Over State
219
+
220
+ hasOverState: JSDynamicProperty("_hasOverState", false),
221
+
222
+ setHasOverState: function(hasOverState){
223
+ this._hasOverState = hasOverState;
224
+ if (hasOverState){
225
+ this.contentView.startMouseTracking(UIView.MouseTracking.enterAndExit);
226
+ }else{
227
+ this.contentView.stopMouseTracking();
228
+ }
229
+ },
230
+
231
+ mouseEntered: function(event){
232
+ this.over = true;
233
+ },
234
+
235
+ mouseExited: function(event){
236
+ this.over = false;
237
+ },
238
+
208
239
  // --------------------------------------------------------------------
209
240
  // MARK: - Accessibility
210
241
 
@@ -239,5 +270,6 @@ UIListViewCell.State = {
239
270
  active: 1 << 1,
240
271
  selected: 1 << 2,
241
272
  contextSelected: 1 << 3,
242
- firstUserState: 1 << 4
273
+ over: 1 << 4,
274
+ firstUserState: 1 << 5
243
275
  };
@@ -578,6 +578,21 @@ JSClass('UIView', UIResponder, {
578
578
  }
579
579
  },
580
580
 
581
+ userVisible: JSReadOnlyProperty(),
582
+
583
+ getUserVisible: function(){
584
+ if (this.hidden){
585
+ return false;
586
+ }
587
+ if (this.alpha === 0){
588
+ return false;
589
+ }
590
+ if (this.superview !== null){
591
+ return this.superview.userVisible;
592
+ }
593
+ return true;
594
+ },
595
+
581
596
  // -------------------------------------------------------------------------
582
597
  // MARK: - Constraints
583
598
 
@@ -794,6 +794,9 @@ JSClass('UIWindow', UIView, {
794
794
  var moves = [];
795
795
  for (viewIndex = 0, viewCount = this.mouseTrackingViews.length; viewIndex < viewCount; ++viewIndex){
796
796
  view = this.mouseTrackingViews[viewIndex];
797
+ if (!view.userVisible){
798
+ continue;
799
+ }
797
800
  location = this.convertPointToView(locationInWindow, view);
798
801
  for (areaIndex = 0, areaCount = view._mouseTrackingAreas.length; areaIndex < areaCount; ++areaIndex){
799
802
  area = view._mouseTrackingAreas[areaIndex];
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKitTesting
3
- JSBundleVersion: 2022.53.0
3
+ JSBundleVersion: 2023.3.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": "2022.53.0",
12
+ "version": "2023.3.0",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"