@breakside/jskit 2021.46.1 → 2022.4.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.js +9 -0
- package/Frameworks/Foundation.jsframework/JS/JSColorSpace.js +106 -20
- package/Frameworks/Foundation.jsframework/JS/JSMediaType.js +1 -1
- package/Frameworks/Foundation.jsframework/JS/JSTimer.js +6 -0
- 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/APIRequest.js +99 -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.js +9 -0
- package/Root/Frameworks/Foundation/JSColorSpace.js +106 -20
- package/Root/Frameworks/Foundation/JSMediaType.js +1 -1
- package/Root/Frameworks/Foundation/JSTimer.js +6 -0
- package/Root/Frameworks/ImageKit/IKColorProfile.js +1091 -0
- package/Root/Frameworks/ImageKit/IKColorSpace.js +49 -198
- package/Root/Frameworks/ImageKit/IKMatrix.js +124 -0
- package/Root/Frameworks/ImageKit/ImageKit.js +2 -0
- 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/SKHTTPRequest.js +44 -0
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/TKMock.js +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/UIBrowserViewController.js +2 -6
- package/Root/Frameworks/UIKit/UICollectionReusableView.js +91 -0
- package/Root/Frameworks/UIKit/UICollectionView.js +1254 -0
- package/Root/Frameworks/UIKit/UICollectionViewCell.js +121 -0
- package/Root/Frameworks/UIKit/UICollectionViewGridLayout.js +425 -0
- package/Root/Frameworks/UIKit/UICollectionViewLayout.js +82 -0
- package/Root/Frameworks/UIKit/UIColorWell.js +12 -1
- package/Root/Frameworks/UIKit/UIDisplayServer.js +5 -1
- package/Root/Frameworks/UIKit/UIKit.js +7 -0
- package/Root/Frameworks/UIKit/UILayer.js +3 -0
- package/Root/Frameworks/UIKit/UIListView.js +8 -9
- package/Root/Frameworks/UIKit/UIMenu.js +1 -1
- package/Root/Frameworks/UIKit/UIMenuView.js +5 -1
- package/Root/Frameworks/UIKit/UINavigationBar.js +9 -3
- package/Root/Frameworks/UIKit/UINavigationController.js +228 -112
- package/Root/Frameworks/UIKit/UINavigationItem.js +4 -0
- package/Root/Frameworks/UIKit/UIPopupButton.js +39 -3
- package/Root/Frameworks/UIKit/UIScrollView.js +2 -0
- package/Root/Frameworks/UIKit/UISplitViewController.js +215 -73
- package/Root/Frameworks/UIKit/UITabViewController.js +4 -10
- package/Root/Frameworks/UIKit/UITextField.js +3 -0
- package/Root/Frameworks/UIKit/UIView.js +3 -0
- package/Root/Frameworks/UIKit/UIViewController.js +144 -50
- package/Root/Frameworks/UIKit/UIWindow.js +4 -15
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/UIKitTesting/UIMockApplication.js +6 -0
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// #import Foundation
|
|
17
17
|
// #import "UIResponder.js"
|
|
18
18
|
// #import "UITabView.js"
|
|
19
|
-
/* global UINavigationItem, UINavigationController */
|
|
19
|
+
/* global UINavigationItem, UINavigationController, UIApplication */
|
|
20
20
|
'use strict';
|
|
21
21
|
|
|
22
22
|
JSClass("UIViewController", UIResponder, {
|
|
@@ -98,33 +98,9 @@ JSClass("UIViewController", UIResponder, {
|
|
|
98
98
|
// -------------------------------------------------------------------------
|
|
99
99
|
// MARK: - View Lifecycle
|
|
100
100
|
|
|
101
|
-
_needsDidAppear: false,
|
|
102
|
-
_needsDidDisappear: false,
|
|
103
101
|
isViewVisible: JSReadOnlyProperty("_isViewVisible", false),
|
|
104
102
|
|
|
105
|
-
|
|
106
|
-
if (!this._needsDidAppear){
|
|
107
|
-
this._needsDidAppear = true;
|
|
108
|
-
this.view.layer._displayServer.schedule(function(){
|
|
109
|
-
if (this._needsDidAppear){
|
|
110
|
-
this._needsDidAppear = false;
|
|
111
|
-
this.viewDidAppear(false);
|
|
112
|
-
}
|
|
113
|
-
}, this);
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
enqueueDidDisappear: function(){
|
|
118
|
-
if (!this._needsDidDisappear){
|
|
119
|
-
this._needsDidDisappear = true;
|
|
120
|
-
this.view.layer._displayServer.schedule(function(){
|
|
121
|
-
if (this._needsDidDisappear){
|
|
122
|
-
this._needsDidDisappear = false;
|
|
123
|
-
this.viewDidDisappear(false);
|
|
124
|
-
}
|
|
125
|
-
}, this);
|
|
126
|
-
}
|
|
127
|
-
},
|
|
103
|
+
lifecycleState: JSReadOnlyProperty("_lifecycleState", 0),
|
|
128
104
|
|
|
129
105
|
viewDidLoad: function(){
|
|
130
106
|
},
|
|
@@ -132,15 +108,18 @@ JSClass("UIViewController", UIResponder, {
|
|
|
132
108
|
viewDidUnload: function(){
|
|
133
109
|
},
|
|
134
110
|
|
|
135
|
-
viewWillAppear: function(){
|
|
111
|
+
viewWillAppear: function(animated){
|
|
112
|
+
this._lifecycleState = UIViewController.LifecycleState.appearing;
|
|
136
113
|
this._loadViewIfNeeded();
|
|
137
114
|
},
|
|
138
115
|
|
|
139
|
-
viewDidAppear: function(){
|
|
116
|
+
viewDidAppear: function(animated){
|
|
117
|
+
this._lifecycleState = UIViewController.LifecycleState.appeared;
|
|
140
118
|
this._isViewVisible = true;
|
|
141
119
|
},
|
|
142
120
|
|
|
143
|
-
viewWillDisappear: function(){
|
|
121
|
+
viewWillDisappear: function(animated){
|
|
122
|
+
this._lifecycleState = UIViewController.LifecycleState.disappearing;
|
|
144
123
|
if (this.isViewLoaded){
|
|
145
124
|
var window = this.view.window;
|
|
146
125
|
if (window !== null){
|
|
@@ -158,10 +137,106 @@ JSClass("UIViewController", UIResponder, {
|
|
|
158
137
|
}
|
|
159
138
|
},
|
|
160
139
|
|
|
161
|
-
viewDidDisappear: function(){
|
|
140
|
+
viewDidDisappear: function(animated){
|
|
141
|
+
this._lifecycleState = UIViewController.LifecycleState.disappeared;
|
|
162
142
|
this._isViewVisible = false;
|
|
163
143
|
},
|
|
164
144
|
|
|
145
|
+
// -------------------------------------------------------------------------
|
|
146
|
+
// MARK: - Lifecycle Control Methods
|
|
147
|
+
|
|
148
|
+
beginAppearance: function(animated){
|
|
149
|
+
this.beginAppearanceTransition(true, animated);
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
endAppearance: function(){
|
|
153
|
+
this.endAppearanceTransition();
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
beginAppearanceWithAnimator: function(animator){
|
|
157
|
+
this.beginAppearance(true);
|
|
158
|
+
animator.addCompletion(function(){
|
|
159
|
+
this.endAppearance();
|
|
160
|
+
}, this);
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
scheduleAppearance: function(){
|
|
164
|
+
this.beginAppearance(false);
|
|
165
|
+
this._scheduleAppearanceTransition();
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
beginDisappearance: function(animated){
|
|
169
|
+
this.beginAppearanceTransition(false, animated);
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
endDisappearance: function(){
|
|
173
|
+
this.endAppearanceTransition();
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
beginDisappearanceWithAnimator: function(animator){
|
|
177
|
+
this.beginDisappearance(true);
|
|
178
|
+
animator.addCompletion(function(){
|
|
179
|
+
this.endDisappearance();
|
|
180
|
+
}, this);
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
scheduleDisappearance: function(){
|
|
184
|
+
this.beginDisappearance(false);
|
|
185
|
+
this._scheduleAppearanceTransition();
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
beginAppearanceTransition: function(isAppearing, animated){
|
|
189
|
+
this._appearanceTransitionAnimated = animated;
|
|
190
|
+
if (isAppearing){
|
|
191
|
+
if (this._lifecycleState === UIViewController.LifecycleState.disappeared || this._lifecycleState === UIViewController.LifecycleState.disappearing){
|
|
192
|
+
this.viewWillAppear(animated);
|
|
193
|
+
}
|
|
194
|
+
}else{
|
|
195
|
+
if (this._lifecycleState === UIViewController.LifecycleState.appeared || this._lifecycleState === UIViewController.LifecycleState.appearing){
|
|
196
|
+
this.viewWillDisappear(animated);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
endAppearanceTransition: function(){
|
|
202
|
+
if (this._appearanceTransitionAnimated){
|
|
203
|
+
this._endAppearanceTransition(true);
|
|
204
|
+
}else{
|
|
205
|
+
this._scheduleAppearanceTransition();
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
_endAppearanceTransition: function(){
|
|
210
|
+
this._appearanceTransitionScheduled = false;
|
|
211
|
+
if (this._lifecycleState === UIViewController.LifecycleState.appearing){
|
|
212
|
+
this.viewDidAppear(this._appearanceTransitionAnimated);
|
|
213
|
+
}else if (this._lifecycleState === UIViewController.LifecycleState.disappearing){
|
|
214
|
+
this.viewDidDisappear(this._appearanceTransitionAnimated);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
_appearanceTransitionAnimated: false,
|
|
219
|
+
_appearanceTransitionScheduled: false,
|
|
220
|
+
|
|
221
|
+
_scheduleAppearanceTransition: function(){
|
|
222
|
+
if (this._appearanceTransitionScheduled){
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
this._appearanceTransitionScheduled = true;
|
|
226
|
+
this.schedule(this._endAppearanceTransition);
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
// -------------------------------------------------------------------------
|
|
230
|
+
// MARK: - Display Loop Syncrhonization
|
|
231
|
+
|
|
232
|
+
schedule: function(callback){
|
|
233
|
+
var displayServer = UIApplication.shared.windowServer.displayServer;
|
|
234
|
+
displayServer.schedule(callback, this);
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
// -------------------------------------------------------------------------
|
|
238
|
+
// MARK: - Layout
|
|
239
|
+
|
|
165
240
|
viewDidLayoutSubviews: function(){
|
|
166
241
|
},
|
|
167
242
|
|
|
@@ -169,18 +244,32 @@ JSClass("UIViewController", UIResponder, {
|
|
|
169
244
|
this.view.sizeToFitSize(size);
|
|
170
245
|
},
|
|
171
246
|
|
|
247
|
+
contentSizeThatFitsSize: function(maxSize){
|
|
248
|
+
this.view.sizeToFitSize(maxSize);
|
|
249
|
+
return JSSize(this.view.bounds.size);
|
|
250
|
+
},
|
|
251
|
+
|
|
172
252
|
// -------------------------------------------------------------------------
|
|
173
253
|
// MARK: - Child View Controllers
|
|
174
254
|
|
|
175
255
|
parentViewController: null,
|
|
176
256
|
|
|
177
257
|
addChildViewController: function(viewController){
|
|
258
|
+
if (viewController.parentViewController === this){
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (viewController.parentViewController !== null){
|
|
262
|
+
viewController.removeFromParentViewController();
|
|
263
|
+
}
|
|
178
264
|
viewController.willMoveToParentViewController(this);
|
|
179
265
|
viewController.parentViewController = this;
|
|
180
266
|
viewController.didMoveToParentViewController(this);
|
|
181
267
|
},
|
|
182
268
|
|
|
183
269
|
removeFromParentViewController: function(){
|
|
270
|
+
if (this.parentViewController === null){
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
184
273
|
this.willMoveToParentViewController(null);
|
|
185
274
|
this.parentViewController = null;
|
|
186
275
|
this.didMoveToParentViewController(null);
|
|
@@ -193,30 +282,28 @@ JSClass("UIViewController", UIResponder, {
|
|
|
193
282
|
},
|
|
194
283
|
|
|
195
284
|
replaceChildViewController: function(previousChildViewController, childViewController, animator){
|
|
285
|
+
if (previousChildViewController === childViewController){
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
196
288
|
if (this.isViewLoaded && this.isViewVisible){
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
var completion = function(){
|
|
289
|
+
if (animator !== undefined && animator !== null){
|
|
290
|
+
if (previousChildViewController !== null){
|
|
291
|
+
previousChildViewController.beginDisappearanceWithAnimator(animator);
|
|
292
|
+
previousChildViewController.removeFromParentViewController();
|
|
293
|
+
}
|
|
294
|
+
if (childViewController !== null){
|
|
295
|
+
this.addChildViewController(childViewController);
|
|
296
|
+
childViewController.beginAppearanceWithAnimator(animator);
|
|
297
|
+
}
|
|
298
|
+
}else{
|
|
209
299
|
if (previousChildViewController !== null){
|
|
210
|
-
previousChildViewController.
|
|
300
|
+
previousChildViewController.scheduleDisappearance();
|
|
301
|
+
previousChildViewController.removeFromParentViewController();
|
|
211
302
|
}
|
|
212
303
|
if (childViewController !== null){
|
|
213
|
-
|
|
304
|
+
this.addChildViewController(childViewController);
|
|
305
|
+
childViewController.scheduleAppearance();
|
|
214
306
|
}
|
|
215
|
-
};
|
|
216
|
-
if (animated){
|
|
217
|
-
animator.addCompletion(completion, this);
|
|
218
|
-
}else{
|
|
219
|
-
this.view.layer._displayServer.schedule(completion, this);
|
|
220
307
|
}
|
|
221
308
|
}else{
|
|
222
309
|
if (previousChildViewController !== null){
|
|
@@ -324,4 +411,11 @@ JSClass("UIViewController", UIResponder, {
|
|
|
324
411
|
}
|
|
325
412
|
|
|
326
413
|
|
|
327
|
-
});
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
UIViewController.LifecycleState = {
|
|
417
|
+
disappeared: 0,
|
|
418
|
+
appearing: 1,
|
|
419
|
+
appeared: 2,
|
|
420
|
+
disappearing: 3
|
|
421
|
+
};
|
|
@@ -214,27 +214,16 @@ JSClass('UIWindow', UIView, {
|
|
|
214
214
|
|
|
215
215
|
setContentViewController: function(contentViewController){
|
|
216
216
|
var previousViewController = this._contentViewController;
|
|
217
|
-
var contentView = null;
|
|
218
|
-
// load the view before calling viewWillAppear
|
|
219
|
-
if (contentViewController){
|
|
220
|
-
contentView = contentViewController.view;
|
|
221
|
-
}
|
|
222
217
|
if (this._isVisible){
|
|
223
218
|
if (previousViewController !== null){
|
|
224
|
-
previousViewController.
|
|
219
|
+
previousViewController.scheduleDisappearance();
|
|
225
220
|
}
|
|
226
221
|
if (contentViewController !== null){
|
|
227
|
-
contentViewController.
|
|
222
|
+
contentViewController.scheduleAppearance();
|
|
228
223
|
}
|
|
229
224
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (previousViewController !== null){
|
|
233
|
-
previousViewController.viewDidDisappear(false);
|
|
234
|
-
}
|
|
235
|
-
if (contentViewController !== null){
|
|
236
|
-
contentViewController.viewDidAppear(false);
|
|
237
|
-
}
|
|
225
|
+
if (contentViewController !== null){
|
|
226
|
+
this.contentView = contentViewController.view;
|
|
238
227
|
}
|
|
239
228
|
this._contentViewController = contentViewController;
|
|
240
229
|
},
|
|
@@ -59,6 +59,12 @@ JSClass("UIMockApplication", UIApplication, {
|
|
|
59
59
|
UIMockApplication.$super.deinit.call(this);
|
|
60
60
|
},
|
|
61
61
|
|
|
62
|
+
setScreenSize: function(size){
|
|
63
|
+
var oldFrame = this.windowServer.screen.frame;
|
|
64
|
+
this.windowServer.screen.frame = JSRect(JSPoint.Zero, size);
|
|
65
|
+
this.windowServer.screenDidChangeFrame(oldFrame);
|
|
66
|
+
},
|
|
67
|
+
|
|
62
68
|
displayTime: 0,
|
|
63
69
|
|
|
64
70
|
updateDisplay: function(dt){
|