@breakside/jskit 2023.1.0 → 2023.3.1
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/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 +2 -2
- 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/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/UICollectionReusableView.js +13 -0
- package/Root/Frameworks/UIKit/UICollectionView.js +620 -67
- package/Root/Frameworks/UIKit/UICollectionViewCell.js +42 -2
- package/Root/Frameworks/UIKit/UICollectionViewLayout.js +34 -3
- package/Root/Frameworks/UIKit/UIListView.js +46 -0
- package/Root/Frameworks/UIKit/UIListViewCell.js +36 -1
- package/Root/Frameworks/UIKit/UIView.js +15 -0
- package/Root/Frameworks/UIKit/UIWindow.js +3 -0
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- 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,31 @@ 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
|
+
var shouldSelect = (!this.collectionView || !this.collectionView.delegate || !this.collectionView.delegate.collectionViewShouldSelectCellAtIndexPath || this.collectionView.delegate.collectionViewShouldSelectCellAtIndexPath(this.collectionView, this.collectionView.indexPathOfCell(this)));
|
|
136
|
+
if (shouldSelect){
|
|
137
|
+
this.over = true;
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
mouseExited: function(event){
|
|
142
|
+
this.over = false;
|
|
143
|
+
},
|
|
144
|
+
|
|
106
145
|
// --------------------------------------------------------------------
|
|
107
146
|
// MARK: - Accessibility
|
|
108
147
|
|
|
@@ -126,6 +165,7 @@ UICollectionViewCell.State = {
|
|
|
126
165
|
active: 1 << 1,
|
|
127
166
|
selected: 1 << 2,
|
|
128
167
|
contextSelected: 1 << 3,
|
|
129
|
-
|
|
130
|
-
|
|
168
|
+
over: 1 << 4,
|
|
169
|
+
dropTarget: 1 << 5,
|
|
170
|
+
firstUserState: 1 << 6
|
|
131
171
|
};
|
|
@@ -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,39 @@ 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
|
+
var shouldSelect = (!this.listView || !this.listView.delegate || !this.listView.delegate.listViewShouldSelectCellAtIndexPath || this.listView.delegate.listViewShouldSelectCellAtIndexPath(this.listView, this.listView.indexPathOfCell(this)));
|
|
233
|
+
if (shouldSelect){
|
|
234
|
+
this.over = true;
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
mouseExited: function(event){
|
|
239
|
+
this.over = false;
|
|
240
|
+
},
|
|
241
|
+
|
|
208
242
|
// --------------------------------------------------------------------
|
|
209
243
|
// MARK: - Accessibility
|
|
210
244
|
|
|
@@ -239,5 +273,6 @@ UIListViewCell.State = {
|
|
|
239
273
|
active: 1 << 1,
|
|
240
274
|
selected: 1 << 2,
|
|
241
275
|
contextSelected: 1 << 3,
|
|
242
|
-
|
|
276
|
+
over: 1 << 4,
|
|
277
|
+
firstUserState: 1 << 5
|
|
243
278
|
};
|
|
@@ -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];
|