@breakside/jskit 2022.7.1 → 2022.20.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/JS/FNTFontDescriptor.js +9 -6
- 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/JSEnvironment.js +5 -0
- package/Frameworks/Foundation.jsframework/JS/JSHTMLHTTPClient.js +9 -1
- package/Frameworks/Foundation.jsframework/JS/JSImage.js +12 -5
- package/Frameworks/Foundation.jsframework/JS/JSURLResponse.js +10 -0
- package/Frameworks/Foundation.jsframework/JS/JSXMLParser.js +81 -8
- 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/Dispatch/JSHTMLDispatchQueue.js +4 -2
- package/Root/Frameworks/FontKit/FNTFontDescriptor.js +9 -6
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSEnvironment.js +5 -0
- package/Root/Frameworks/Foundation/JSHTMLHTTPClient.js +9 -1
- package/Root/Frameworks/Foundation/JSImage.js +12 -5
- package/Root/Frameworks/Foundation/JSURLResponse.js +10 -0
- package/Root/Frameworks/Foundation/JSXMLParser.js +81 -8
- 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/SKHTTPServer+Node.js +8 -0
- package/Root/Frameworks/ServerKit/SKNodeHTTPRequest.js +3 -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/UIApplication.js +15 -1
- package/Root/Frameworks/UIKit/UICollectionView.js +93 -34
- package/Root/Frameworks/UIKit/UICollectionViewCell.js +11 -1
- package/Root/Frameworks/UIKit/UICollectionViewLayout.js +1 -1
- package/Root/Frameworks/UIKit/UIDraggingSession.js +7 -0
- package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +13 -1
- package/Root/Frameworks/UIKit/UIScrollView.js +15 -12
- package/Root/Frameworks/UIKit/UISegmentedControl.js +15 -0
- package/Root/Frameworks/UIKit/UITabView.js +5 -6
- package/Root/Frameworks/UIKit/UIWindow.js +21 -0
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -562,7 +562,7 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
562
562
|
dragend: function(e){
|
|
563
563
|
// dragend is not cancelable, so no need for preventDefault()
|
|
564
564
|
if (this._dragImageElement !== null){
|
|
565
|
-
if (this._dragImageElement.parentNode !== null){
|
|
565
|
+
if (this._dragImageElement.parentNode !== null && this._createdDragImageElement){
|
|
566
566
|
this._dragImageElement.parentNode.removeChild(this._dragImageElement);
|
|
567
567
|
}
|
|
568
568
|
this._dragImageElement = null;
|
|
@@ -839,6 +839,7 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
839
839
|
// MARK: - Drag & Drop Support
|
|
840
840
|
|
|
841
841
|
_dragImageElement: null,
|
|
842
|
+
_createdDragImageElement: false,
|
|
842
843
|
|
|
843
844
|
prerenderDragImage: function(image){
|
|
844
845
|
// Safari is picky here and requires that the image element be in the document and
|
|
@@ -852,6 +853,7 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
852
853
|
imageElement.src = image.htmlURLString();
|
|
853
854
|
this.rootElement.appendChild(imageElement);
|
|
854
855
|
this._dragImageElement = imageElement;
|
|
856
|
+
this._createdDragImageElement = true;
|
|
855
857
|
},
|
|
856
858
|
|
|
857
859
|
createDraggingSessionWithItems: function(items, event, view){
|
|
@@ -863,6 +865,7 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
863
865
|
context.element.draggable = true;
|
|
864
866
|
// Could use a subclass here, but this seems to work too
|
|
865
867
|
var originalSetImage = session.setImage;
|
|
868
|
+
var originalSetImageFromView = session.setImageFromView;
|
|
866
869
|
var windowServer = this;
|
|
867
870
|
Object.defineProperties(session, {
|
|
868
871
|
setImage: {
|
|
@@ -871,6 +874,15 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
871
874
|
originalSetImage.call(this, image, imageOffset);
|
|
872
875
|
windowServer.prerenderDragImage(image);
|
|
873
876
|
}
|
|
877
|
+
},
|
|
878
|
+
setImageFromView: {
|
|
879
|
+
configurable: true,
|
|
880
|
+
value: function UIHTMLWindowServer_UIDragSession_setImageFromView(view, imageOffset){
|
|
881
|
+
originalSetImageFromView.call(this, view, imageOffset);
|
|
882
|
+
var context = windowServer.displayServer.contextForLayer(view.layer);
|
|
883
|
+
windowServer._dragImageElement = context.element;
|
|
884
|
+
windowServer._createdDragImageElement = false;
|
|
885
|
+
}
|
|
874
886
|
}
|
|
875
887
|
});
|
|
876
888
|
}
|
|
@@ -37,16 +37,19 @@ JSClass('UIScrollView', UIView, {
|
|
|
37
37
|
initWithSpec: function(spec){
|
|
38
38
|
UIScrollView.$super.initWithSpec.call(this, spec);
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
// These properties are optional in the spec, and are typically only provided if
|
|
47
|
-
// the user wants to provide specialized customization
|
|
40
|
+
var contentSubviews = [];
|
|
41
|
+
|
|
42
|
+
// If the content view and scrollers are specified in the spec, create them
|
|
43
|
+
// before doing the _commonScrollViewInit, so it won't try to create them itself.
|
|
44
|
+
// These properties are optional in the spec, and are typically only provided if
|
|
45
|
+
// the user wants to provide specialized customization
|
|
48
46
|
if (spec.containsKey('contentView')){
|
|
49
47
|
this._contentView = spec.valueForKey("contentView", UIView);
|
|
48
|
+
}else{
|
|
49
|
+
// If any subviews were added directly to this view, and a
|
|
50
|
+
// contentView was not provided, treat the subviews as children
|
|
51
|
+
// of the contentView
|
|
52
|
+
contentSubviews = JSCopy(this.subviews);
|
|
50
53
|
}
|
|
51
54
|
if (spec.containsKey('verticalScroller')){
|
|
52
55
|
this._verticalScroller = spec.valueForKey("verticalScroller", UIScroller);
|
|
@@ -59,13 +62,13 @@ JSClass('UIScrollView', UIView, {
|
|
|
59
62
|
}
|
|
60
63
|
this._commonScrollViewInit();
|
|
61
64
|
|
|
62
|
-
//
|
|
63
|
-
//
|
|
65
|
+
// Finish the contentSubvies work after _commonScrollViewInit,
|
|
66
|
+
// when we can be sure that a contentView has been created
|
|
64
67
|
for (var i = 0, l = contentSubviews.length; i < l; ++i){
|
|
65
68
|
this._contentView.addSubview(contentSubviews[i]);
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
//
|
|
71
|
+
// Handle all the other properties
|
|
69
72
|
if (spec.containsKey('contentInsets')){
|
|
70
73
|
this.contentInsets = spec.valueForKey("contentInsets", JSInsets);
|
|
71
74
|
}
|
|
@@ -105,7 +108,7 @@ JSClass('UIScrollView', UIView, {
|
|
|
105
108
|
this._maxContentOffset = JSPoint.Zero;
|
|
106
109
|
this._horizontalScroller.addAction("_horizontalScrollerValueChanged", this, UIControl.Event.valueChanged);
|
|
107
110
|
this._verticalScroller.addAction("_verticalScrollerValueChanged", this, UIControl.Event.valueChanged);
|
|
108
|
-
this.
|
|
111
|
+
this.insertSubviewAtIndex(this._contentView, 0);
|
|
109
112
|
this.addSubview(this._verticalScroller);
|
|
110
113
|
this.addSubview(this._horizontalScroller);
|
|
111
114
|
this._updateScrollers();
|
|
@@ -769,6 +769,21 @@ JSClass("UISegmentedControlDefaultStyler", UISegmentedControlStyler, {
|
|
|
769
769
|
}
|
|
770
770
|
},
|
|
771
771
|
|
|
772
|
+
sizeControlToFitSize: function(control, maxSize){
|
|
773
|
+
var intrinsicSize = this.intrinsicSizeOfControl(control);
|
|
774
|
+
var size = JSSize(control.bounds.size);
|
|
775
|
+
if (maxSize.width < Number.MAX_VALUE){
|
|
776
|
+
size.width = maxSize.width;
|
|
777
|
+
}
|
|
778
|
+
if (intrinsicSize.width < maxSize.width){
|
|
779
|
+
size.width = intrinsicSize.width;
|
|
780
|
+
}
|
|
781
|
+
if (intrinsicSize.height < maxSize.height){
|
|
782
|
+
size.height = intrinsicSize.height;
|
|
783
|
+
}
|
|
784
|
+
control.bounds = JSRect(JSPoint.Zero, size);
|
|
785
|
+
},
|
|
786
|
+
|
|
772
787
|
intrinsicSizeOfControl: function(control){
|
|
773
788
|
var itemView;
|
|
774
789
|
var size = JSSize.Zero;
|
|
@@ -59,16 +59,14 @@ JSClass("UITabView", UIView, {
|
|
|
59
59
|
if (spec.containsKey('delegate')){
|
|
60
60
|
this.delegate = spec.valueForKey("delegate");
|
|
61
61
|
}
|
|
62
|
+
if (spec.containsKey("font")){
|
|
63
|
+
this.font = spec.valueForKey("font", JSFont);
|
|
64
|
+
}
|
|
62
65
|
if (spec.containsKey('items')){
|
|
63
|
-
var items = [];
|
|
64
66
|
var specItems = spec.valueForKey('items');
|
|
65
67
|
for (var i = 0, l = specItems.length; i < l; ++i){
|
|
66
|
-
|
|
68
|
+
this.insertItemAtIndex(specItems.valueForKey(i, UITabViewItem), i);
|
|
67
69
|
}
|
|
68
|
-
this.items = items;
|
|
69
|
-
}
|
|
70
|
-
if (spec.containsKey("font")){
|
|
71
|
-
this.font = spec.valueForKey("font", JSFont);
|
|
72
70
|
}
|
|
73
71
|
},
|
|
74
72
|
|
|
@@ -1067,6 +1065,7 @@ JSClass("UITabViewTablessStyler", UITabViewStyler, {
|
|
|
1067
1065
|
showContentViewInTabView: function(contentView, tabView){
|
|
1068
1066
|
tabView.addSubview(contentView);
|
|
1069
1067
|
tabView.stylerProperties.contentView = contentView;
|
|
1068
|
+
this.layoutTabView(tabView);
|
|
1070
1069
|
},
|
|
1071
1070
|
|
|
1072
1071
|
removeContentViewFromTabView: function(contentView, tabView){
|
|
@@ -1148,7 +1148,18 @@ JSClass("UIWindowStyler", JSObject, {
|
|
|
1148
1148
|
window.layer.addSublayer(window.stylerProperties.focusRingLayer);
|
|
1149
1149
|
},
|
|
1150
1150
|
|
|
1151
|
+
_isUpdatingFocusRing: false,
|
|
1152
|
+
|
|
1151
1153
|
updateFocusRingInWindow: function(window, animated){
|
|
1154
|
+
if (this._isUpdatingFocusRing){
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
this._isUpdatingFocusRing = true;
|
|
1158
|
+
this._updateFocusRingInWindow(window, animated);
|
|
1159
|
+
this._isUpdatingFocusRing = false;
|
|
1160
|
+
},
|
|
1161
|
+
|
|
1162
|
+
_updateFocusRingInWindow: function(window, animated){
|
|
1152
1163
|
var responder = window.firstResponder;
|
|
1153
1164
|
var focusRingLayer = window.stylerProperties.focusRingLayer;
|
|
1154
1165
|
if (!window.isKeyWindow || responder === null || !responder.isKindOfClass(UIView)){
|
|
@@ -1156,6 +1167,16 @@ JSClass("UIWindowStyler", JSObject, {
|
|
|
1156
1167
|
return;
|
|
1157
1168
|
}
|
|
1158
1169
|
var view = responder;
|
|
1170
|
+
var views = [];
|
|
1171
|
+
while (view !== window){
|
|
1172
|
+
views.push(view);
|
|
1173
|
+
view = view.superview;
|
|
1174
|
+
}
|
|
1175
|
+
view = responder;
|
|
1176
|
+
var i;
|
|
1177
|
+
for (i = views.length - 1; i >= 0; --i){
|
|
1178
|
+
views[i].layoutIfNeeded();
|
|
1179
|
+
}
|
|
1159
1180
|
var path = view.focusRingPath;
|
|
1160
1181
|
if (path === null){
|
|
1161
1182
|
focusRingLayer.hidden = true;
|