@breakside/jskit 2022.50.0 → 2022.52.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/JS/Error+JS.js +6 -1
- package/Frameworks/Foundation.jsframework/JS/JSTextFramesetter.js +1 -1
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/JS/SECSign+Node.js +1 -1
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Info.json +2 -2
- package/Node/KeyCommand.js +1 -1
- package/Node/KeypairCommand.js +73 -0
- package/Node/io.breakside.jskit-bundle.js +2 -2
- package/Node/jskit +1 -0
- package/Node/main.js +1 -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/CHBarChart.js +1 -1
- package/Root/Frameworks/ChartKit/CHStackedAreaChart.js +0 -2
- package/Root/Frameworks/ChartKit/CHStackedBarChart.js +0 -2
- 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/Error+JS.js +6 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSTextFramesetter.js +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/NotificationKit/NKHTMLUserNotificationCenter.js +2 -2
- 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/SecurityKit/SECSign+Node.js +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/UIDevice+HTML.js +29 -18
- package/Root/Frameworks/UIKit/UIDevice.js +15 -1
- package/Root/Frameworks/UIKit/UIHTMLApplication.js +36 -21
- package/Root/Frameworks/UIKit/UIKit.js +1 -0
- package/Root/Frameworks/UIKit/UIListView.js +20 -2
- package/Root/Frameworks/UIKit/UIMenuView.js +1 -0
- package/Root/Frameworks/UIKit/UIScrollGestureRecognizer.js +184 -0
- package/Root/Frameworks/UIKit/UIStackView.js +4 -0
- package/Root/Frameworks/UIKit/UIWindow.js +3 -0
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/Root/Templates/html/${PROJECT_NAME}/MainWindow.spec.yaml +2 -4
- package/Root/Templates/html/${PROJECT_NAME}/www/HTMLAppBootstrapper.js +24 -9
- package/Root/Templates/html/${PROJECT_NAME}/www/index.html +45 -30
- package/Root/Templates/html/${PROJECT_NAME}/www/service-worker.js +3 -2
- package/package.json +1 -1
|
@@ -20,28 +20,39 @@
|
|
|
20
20
|
|
|
21
21
|
(function(){
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
var device = UIDevice.init();
|
|
23
|
+
Object.defineProperties(UIDevice, {
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
shared: {
|
|
26
|
+
configurable: true,
|
|
27
|
+
get: function(){
|
|
28
|
+
var device = UIDevice.init();
|
|
29
|
+
try{
|
|
30
|
+
device.supportsTouchInput = ('ontouchstart' in document.body) && navigator.maxTouchPoints > 0;
|
|
31
|
+
var primaryPointerHovers = window.matchMedia('(hover)').matches;
|
|
32
|
+
var primaryFinePointer = window.matchMedia('(pointer: fine)').matches;
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
if (primaryFinePointer){
|
|
35
|
+
device.primaryPointerAccuracy = UIUserInterface.PointerAccuracy.fine;
|
|
36
|
+
if (primaryPointerHovers){
|
|
37
|
+
device.primaryPointerType = UIUserInterface.PointerType.cursor;
|
|
38
|
+
}else{
|
|
39
|
+
device.primaryPointerType = UIUserInterface.PointerType.touch;
|
|
40
|
+
}
|
|
41
|
+
}else if (device.supportsTouchInput){
|
|
42
|
+
device.primaryPointerAccuracy = UIUserInterface.PointerAccuracy.coarse;
|
|
43
|
+
device.primaryPointerType = UIUserInterface.PointerType.touch;
|
|
44
|
+
}
|
|
45
|
+
}catch (e){
|
|
46
|
+
// assumed to be in a worker env, where UIDevice isn't really applicable
|
|
47
|
+
}
|
|
48
|
+
Object.defineProperty(this, "shared", {writable: true, configurable: true, value: device});
|
|
49
|
+
return device;
|
|
50
|
+
},
|
|
51
|
+
set: function(device){
|
|
52
|
+
Object.defineProperty(this, "shared", {writable: true, configurable: true, value: device});
|
|
36
53
|
}
|
|
37
|
-
}else if (device.supportsTouchInput){
|
|
38
|
-
device.primaryPointerAccuracy = UIUserInterface.PointerAccuracy.coarse;
|
|
39
|
-
device.primaryPointerType = UIUserInterface.PointerType.touch;
|
|
40
54
|
}
|
|
41
55
|
|
|
42
|
-
|
|
43
|
-
}catch (e){
|
|
44
|
-
// assumed to be in a worker env, where UIDevice isn't really applicable
|
|
45
|
-
}
|
|
56
|
+
});
|
|
46
57
|
|
|
47
58
|
})();
|
|
@@ -25,4 +25,18 @@ JSClass("UIDevice", JSObject, {
|
|
|
25
25
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
UIDevice
|
|
28
|
+
Object.defineProperties(UIDevice, {
|
|
29
|
+
|
|
30
|
+
shared: {
|
|
31
|
+
configurable: true,
|
|
32
|
+
get: function(){
|
|
33
|
+
var device = UIDevice.init();
|
|
34
|
+
Object.defineProperty(this, "shared", {writable: true, configurable: true, value: device});
|
|
35
|
+
return device;
|
|
36
|
+
},
|
|
37
|
+
set: function(device){
|
|
38
|
+
Object.defineProperty(this, "shared", {writable: true, configurable: true, value: device});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
});
|
|
@@ -24,6 +24,7 @@ var logger = JSLog("uikit", "application");
|
|
|
24
24
|
|
|
25
25
|
JSClass("UIHTMLApplication", UIApplication, {
|
|
26
26
|
|
|
27
|
+
bootstrapper: null,
|
|
27
28
|
domWindow: null,
|
|
28
29
|
|
|
29
30
|
initWithBundle: function(bundle, windowServer){
|
|
@@ -134,6 +135,14 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
134
135
|
this.domWindow.addEventListener("popstate", this);
|
|
135
136
|
},
|
|
136
137
|
|
|
138
|
+
removeEventListeners: function(){
|
|
139
|
+
this.domWindow.removeEventListener("error", this);
|
|
140
|
+
this.domWindow.removeEventListener("unhandledrejection", this);
|
|
141
|
+
this.domWindow.removeEventListener("beforeunload", this);
|
|
142
|
+
this.domWindow.removeEventListener("hashchange", this);
|
|
143
|
+
this.domWindow.removeEventListener("popstate", this);
|
|
144
|
+
},
|
|
145
|
+
|
|
137
146
|
handleEvent: function(e){
|
|
138
147
|
this['_event_' + e.type](e);
|
|
139
148
|
},
|
|
@@ -228,6 +237,7 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
228
237
|
},
|
|
229
238
|
|
|
230
239
|
_crash: function(error){
|
|
240
|
+
this.removeEventListeners();
|
|
231
241
|
if (this.delegate && this.delegate.applicationDidCrash){
|
|
232
242
|
try{
|
|
233
243
|
var logs = JSLog.getRecords();
|
|
@@ -250,28 +260,32 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
250
260
|
|
|
251
261
|
_showCrashScreen: function(){
|
|
252
262
|
this.windowServer.stop();
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
if (this.bootstrapper && this.bootstrapper.applicationDidCrash){
|
|
264
|
+
this.bootstrapper.applicationDidCrash(this);
|
|
265
|
+
}else{
|
|
266
|
+
var root = this.windowServer.displayServer.rootElement;
|
|
267
|
+
var cover = root.appendChild(root.ownerDocument.createElement('div'));
|
|
268
|
+
cover.style.position = 'absolute';
|
|
269
|
+
cover.style.backgroundColor = 'rgba(0,0,0,0.9)';
|
|
270
|
+
cover.style.top = '0';
|
|
271
|
+
cover.style.left = '0';
|
|
272
|
+
cover.style.right = '0';
|
|
273
|
+
cover.style.bottom = '0';
|
|
274
|
+
var message;
|
|
275
|
+
if (!message){
|
|
276
|
+
message = "Sorry, there was a problem and the application needs to restart.\n\nPlease reload the page to continue.";
|
|
277
|
+
}
|
|
278
|
+
var label = cover.appendChild(cover.ownerDocument.createElement('div'));
|
|
279
|
+
label.style.position = 'absolute';
|
|
280
|
+
label.style.color = 'white';
|
|
281
|
+
label.style.font = '400 normal 17px/24px sans-serif';
|
|
282
|
+
label.appendChild(label.ownerDocument.createTextNode(message));
|
|
283
|
+
label.style.top = 'calc(50% - 36px)';
|
|
284
|
+
label.style.left = '20px';
|
|
285
|
+
label.style.right = '20px';
|
|
286
|
+
label.style.textAlign = 'center';
|
|
287
|
+
label.style.whiteSpace = 'pre-wrap';
|
|
264
288
|
}
|
|
265
|
-
var label = cover.appendChild(cover.ownerDocument.createElement('div'));
|
|
266
|
-
label.style.position = 'absolute';
|
|
267
|
-
label.style.color = 'white';
|
|
268
|
-
label.style.font = '400 normal 17px/24px sans-serif';
|
|
269
|
-
label.appendChild(label.ownerDocument.createTextNode(message));
|
|
270
|
-
label.style.top = 'calc(50% - 36px)';
|
|
271
|
-
label.style.left = '20px';
|
|
272
|
-
label.style.right = '20px';
|
|
273
|
-
label.style.textAlign = 'center';
|
|
274
|
-
label.style.whiteSpace = 'pre-wrap';
|
|
275
289
|
}
|
|
276
290
|
|
|
277
291
|
});
|
|
@@ -279,6 +293,7 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
279
293
|
JSGlobalObject.UIApplicationMain = function(rootElement, bootstrapper){
|
|
280
294
|
var windowServer = UIHTMLWindowServer.initWithRootElement(rootElement);
|
|
281
295
|
var application = UIHTMLApplication.initWithWindowServer(windowServer);
|
|
296
|
+
application.bootstrapper = bootstrapper;
|
|
282
297
|
application.run(function(error){
|
|
283
298
|
if (error === null){
|
|
284
299
|
application.addEventListeners();
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
// #import "UIImageView.js"
|
|
20
20
|
// #import "UIViewPropertyAnimator.js"
|
|
21
21
|
// #import "JSColor+UIKit.js"
|
|
22
|
+
// #import "UIPressGestureRecognizer.js"
|
|
22
23
|
/* global UIListViewCell, UIListViewHeaderFooterView */
|
|
23
24
|
'use strict';
|
|
24
25
|
|
|
@@ -2211,6 +2212,10 @@ JSClass("UIListView", UIScrollView, {
|
|
|
2211
2212
|
if (cell === null){
|
|
2212
2213
|
return;
|
|
2213
2214
|
}
|
|
2215
|
+
this._contextSelectCell(cell, location);
|
|
2216
|
+
},
|
|
2217
|
+
|
|
2218
|
+
_contextSelectCell: function(cell, location){
|
|
2214
2219
|
if (this.delegate && this.delegate.menuForListViewCellAtIndexPath){
|
|
2215
2220
|
var menu = this.delegate.menuForListViewCellAtIndexPath(this, cell.indexPath);
|
|
2216
2221
|
if (menu !== null){
|
|
@@ -2349,7 +2354,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
2349
2354
|
this._touch = null;
|
|
2350
2355
|
},
|
|
2351
2356
|
|
|
2352
|
-
_makeTouchActiveCell: function(touch){
|
|
2357
|
+
_makeTouchActiveCell: function(touch, waitForLongPress){
|
|
2353
2358
|
var location = touch.locationInView(this);
|
|
2354
2359
|
var cell = this._cellHitTest(location);
|
|
2355
2360
|
if (cell === null){
|
|
@@ -2361,6 +2366,19 @@ JSClass("UIListView", UIScrollView, {
|
|
|
2361
2366
|
}
|
|
2362
2367
|
cell.active = true;
|
|
2363
2368
|
this._touch.cell = cell;
|
|
2369
|
+
if (waitForLongPress){
|
|
2370
|
+
this._touch.timer = JSTimer.scheduledTimerWithInterval(UIPressGestureRecognizer.PressInterval.long, function(){
|
|
2371
|
+
this._touch.timer = null;
|
|
2372
|
+
this._longPressCell(location);
|
|
2373
|
+
}, this);
|
|
2374
|
+
}
|
|
2375
|
+
},
|
|
2376
|
+
|
|
2377
|
+
_longPressCell: function(location){
|
|
2378
|
+
var cell = this._touch.cell;
|
|
2379
|
+
var indexPath = cell.indexPath;
|
|
2380
|
+
this._cancelTouchSelection();
|
|
2381
|
+
this._contextSelectCell(cell, location);
|
|
2364
2382
|
},
|
|
2365
2383
|
|
|
2366
2384
|
touchesBegan: function(touches, event){
|
|
@@ -2373,7 +2391,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
2373
2391
|
cell: null,
|
|
2374
2392
|
timer: JSTimer.scheduledTimerWithInterval(0.05, function(){
|
|
2375
2393
|
this._touch.timer = null;
|
|
2376
|
-
this._makeTouchActiveCell(touches[0]);
|
|
2394
|
+
this._makeTouchActiveCell(touches[0], true);
|
|
2377
2395
|
}, this)
|
|
2378
2396
|
};
|
|
2379
2397
|
},
|
|
@@ -110,6 +110,7 @@ JSClass("UIMenuWindow", UIWindow, {
|
|
|
110
110
|
if (event !== null && event.type == UIEvent.Type.leftMouseDown){
|
|
111
111
|
this._openEvent = null;
|
|
112
112
|
var location = event.locationInView(this);
|
|
113
|
+
this._lastMoveLocation = JSPoint(location);
|
|
113
114
|
this._adjustHighlightForLocation(location);
|
|
114
115
|
this._itemDownTimestamp = event.timestamp;
|
|
115
116
|
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// Copyright 2022 Breakside Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Breakside Public License, Version 1.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// If a copy of the License was not distributed with this file, you may
|
|
6
|
+
// obtain a copy at
|
|
7
|
+
//
|
|
8
|
+
// http://breakside.io/licenses/LICENSE-1.0.txt
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
|
|
16
|
+
// #import "UIGestureRecognizer.js"
|
|
17
|
+
'use strict';
|
|
18
|
+
|
|
19
|
+
JSClass("UIScrollGestureRecognizer", UIGestureRecognizer, {
|
|
20
|
+
|
|
21
|
+
scrollsVertically: JSDynamicProperty("_scrollsVertically", true),
|
|
22
|
+
scrollsHorizontally: JSDynamicProperty("_scrollsHorizontally", true),
|
|
23
|
+
contentOffset: JSDynamicProperty("_contentOffset", null),
|
|
24
|
+
|
|
25
|
+
getContentOffset: function(){
|
|
26
|
+
if (this._contentOffset === null){
|
|
27
|
+
this._contentOffset = JSPoint.Zero;
|
|
28
|
+
}
|
|
29
|
+
return this._contentOffset;
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
setContentOffset: function(contentOffset){
|
|
33
|
+
this._contentOffset = JSPoint(contentOffset);
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
_touchTracking: null,
|
|
37
|
+
_coasting: null,
|
|
38
|
+
|
|
39
|
+
_beginTrackingTouches: function(touches, event){
|
|
40
|
+
if (this._state !== UIGestureRecognizer.State.possible){
|
|
41
|
+
this._endCoasting();
|
|
42
|
+
this._setState(UIGestureRecognizer.State.ended);
|
|
43
|
+
}
|
|
44
|
+
var velocity = JSPoint.Zero;
|
|
45
|
+
if (this._coasting !== null){
|
|
46
|
+
velocity = this._coasting.velocity;
|
|
47
|
+
}
|
|
48
|
+
var touch = touches[0];
|
|
49
|
+
var location = touch.locationInWindow;
|
|
50
|
+
this._touchTracking = {
|
|
51
|
+
identifier: touches[0],
|
|
52
|
+
startingLocation: JSPoint(location),
|
|
53
|
+
location: location,
|
|
54
|
+
contentOffset: JSPoint(this.contentOffset),
|
|
55
|
+
timestamp: event.timestamp,
|
|
56
|
+
startingVelocity: velocity,
|
|
57
|
+
velocity: velocity
|
|
58
|
+
};
|
|
59
|
+
this._setState(UIGestureRecognizer.State.began);
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
_endTrackingTouches: function(){
|
|
63
|
+
this._touchTracking = null;
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
_beginCoasting: function(velocity){
|
|
67
|
+
this._coasting = {
|
|
68
|
+
timestamp: -1,
|
|
69
|
+
displayServer: this.view.layer._displayServer,
|
|
70
|
+
velocity: velocity
|
|
71
|
+
};
|
|
72
|
+
this._coasting.displayServer.schedule(this._displayUpdate, this);
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
_endCoasting: function(){
|
|
76
|
+
this._coasting = null;
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
touchesBegan: function(touches, event){
|
|
80
|
+
if (!this._scrollsVertically && !this._scrollsHorizontally){
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (this._touchTracking === null){
|
|
84
|
+
this._beginTrackingTouches(touches, event);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
touchesMoved: function(touches, event){
|
|
89
|
+
if (!this._scrollsVertically && !this._scrollsHorizontally){
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (this._touchTracking === null){
|
|
93
|
+
this._beginTrackingTouches(touches, event);
|
|
94
|
+
if (this._touchTracking === null){
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
var touch = event.touchForIdentifier(this._touchTracking.identifier);
|
|
99
|
+
if (touch === null){
|
|
100
|
+
touch = touches[0];
|
|
101
|
+
}
|
|
102
|
+
var location = touch.locationInWindow;
|
|
103
|
+
var delta = location.subtracting(this._touchTracking.startingLocation);
|
|
104
|
+
if (!this._scrollsVertically){
|
|
105
|
+
delta.y = 0;
|
|
106
|
+
}
|
|
107
|
+
if (!this._scrollsHorizontally){
|
|
108
|
+
delta.x = 0;
|
|
109
|
+
}
|
|
110
|
+
var offset = this._touchTracking.contentOffset.subtracting(delta);
|
|
111
|
+
offset.x = Math.round(offset.x);
|
|
112
|
+
offset.y = Math.round(offset.y);
|
|
113
|
+
delta = location.subtracting(this._touchTracking.location);
|
|
114
|
+
if (!this._scrollsVertically){
|
|
115
|
+
delta.y = 0;
|
|
116
|
+
}
|
|
117
|
+
if (!this._scrollsHorizontally){
|
|
118
|
+
delta.x = 0;
|
|
119
|
+
}
|
|
120
|
+
var dt = event.timestamp - this._touchTracking.timestamp;
|
|
121
|
+
this._touchTracking.location = location;
|
|
122
|
+
this._touchTracking.timestamp = event.timestamp;
|
|
123
|
+
if (dt > 0){
|
|
124
|
+
this._touchTracking.velocity = JSPoint(delta.x / dt, delta.y / dt);
|
|
125
|
+
}
|
|
126
|
+
if (!this.contentOffset.isEqual(offset)){
|
|
127
|
+
this.contentOffset = offset;
|
|
128
|
+
this._setState(UIGestureRecognizer.State.changed);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
touchesEnded: function(touches, event){
|
|
133
|
+
if (!this._scrollsVertically && !this._scrollsHorizontally){
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
var dt = event.timestamp - this._touchTracking.timestamp;
|
|
137
|
+
if (dt < 0.05){
|
|
138
|
+
this._beginCoasting(this._touchTracking.velocity);
|
|
139
|
+
}else{
|
|
140
|
+
this._setState(UIGestureRecognizer.State.ended);
|
|
141
|
+
}
|
|
142
|
+
this._endTrackingTouches();
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
touchesCanceled: function(touches, event){
|
|
146
|
+
if (!this._scrollsVertically && !this._scrollsHorizontally){
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this._endTrackingTouches();
|
|
150
|
+
this._setState(UIGestureRecognizer.State.ended);
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
_displayUpdate: function(t){
|
|
154
|
+
if (this._coasting === null){
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (this._coasting.timestamp < 0){
|
|
158
|
+
this._coasting.timestamp = t;
|
|
159
|
+
this._coasting.displayServer.schedule(this._displayUpdate, this);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (this.view.window === null){
|
|
163
|
+
this._endCoasting();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if ((this._scrollsHorizontally && Math.abs(this._coasting.velocity.x) >= 10) || (this._scrollsVertically && (Math.abs(this._coasting.velocity.y) >= 10))){
|
|
167
|
+
var dt = t - this._coasting.timestamp;
|
|
168
|
+
this._coasting.timestamp = t;
|
|
169
|
+
var delta = JSPoint(this._coasting.velocity.x * dt, this._coasting.velocity.y * dt);
|
|
170
|
+
var offset = this.contentOffset.subtracting(delta);
|
|
171
|
+
offset.x = Math.round(offset.x);
|
|
172
|
+
offset.y = Math.round(offset.y);
|
|
173
|
+
this.contentOffset = offset;
|
|
174
|
+
this._coasting.velocity.x *= 0.97;
|
|
175
|
+
this._coasting.velocity.y *= 0.97;
|
|
176
|
+
this._coasting.displayServer.schedule(this._displayUpdate, this);
|
|
177
|
+
this._setState(UIGestureRecognizer.State.changed);
|
|
178
|
+
}else{
|
|
179
|
+
this._endCoasting();
|
|
180
|
+
this._setState(UIGestureRecognizer.State.ended);
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
});
|
|
@@ -220,6 +220,10 @@ JSClass("UIStackView", UIView, {
|
|
|
220
220
|
getFirstBaselineOffsetFromTop: function(){
|
|
221
221
|
var top = this._contentInsets.top;
|
|
222
222
|
if (this._arrangedSubviews.length > 0){
|
|
223
|
+
if (this.axis === UIStackView.Axis.horizontal){
|
|
224
|
+
this.layoutIfNeeded();
|
|
225
|
+
top = this._arrangedSubviews[0].untransformedFrame.origin.y;
|
|
226
|
+
}
|
|
223
227
|
top += this._arrangedSubviews[0].firstBaselineOffsetFromTop;
|
|
224
228
|
}
|
|
225
229
|
return top;
|
|
@@ -439,6 +439,9 @@ JSClass('UIWindow', UIView, {
|
|
|
439
439
|
}
|
|
440
440
|
this.windowServer.orderWindowFront(this);
|
|
441
441
|
if (!this._isOpen){
|
|
442
|
+
if (this.closeAnimator !== null){
|
|
443
|
+
this.closeAnimator.stop();
|
|
444
|
+
}
|
|
442
445
|
this._isOpen = true;
|
|
443
446
|
if (this.openAnimator !== null){
|
|
444
447
|
this.openAnimator.start();
|
|
@@ -19,8 +19,7 @@ MainViewController:
|
|
|
19
19
|
|
|
20
20
|
MainView:
|
|
21
21
|
class: UIView
|
|
22
|
-
backgroundColor:
|
|
23
|
-
rgba: 255,255,255
|
|
22
|
+
backgroundColor: background
|
|
24
23
|
subviews:
|
|
25
24
|
- /Label
|
|
26
25
|
- /TestButton
|
|
@@ -30,8 +29,7 @@ Label:
|
|
|
30
29
|
text: .helloWorld
|
|
31
30
|
font:
|
|
32
31
|
size: heading
|
|
33
|
-
textColor:
|
|
34
|
-
rgba: 51,51,51
|
|
32
|
+
textColor: text
|
|
35
33
|
textAlignment: center
|
|
36
34
|
|
|
37
35
|
TestButton:
|
|
@@ -7,13 +7,18 @@ window.HTMLAppBootstrapper = function(rootElement, jskitapp){
|
|
|
7
7
|
if (this === undefined){
|
|
8
8
|
return new HTMLAppBootstrapper(rootElement, jskitapp);
|
|
9
9
|
}
|
|
10
|
-
this.app = jskitapp;
|
|
11
10
|
this.rootElement = rootElement;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
if (jskitapp.TEMPLATE === "JSKIT_APP"){
|
|
12
|
+
window.bootstrapper = this;
|
|
13
|
+
this.app = null;
|
|
14
|
+
}else{
|
|
15
|
+
this.app = jskitapp;
|
|
16
|
+
this.preflightID = jskitapp.preflightId;
|
|
17
|
+
this.preflightSrc = jskitapp.preflightSrc;
|
|
18
|
+
this.serviceWorkerSrc = jskitapp.serviceWorkerSrc;
|
|
19
|
+
this.appSrc = jskitapp.appSrc;
|
|
20
|
+
this.appCss = jskitapp.appCss;
|
|
21
|
+
}
|
|
17
22
|
this.status = HTMLAppBootstrapper.STATUS.notstarted;
|
|
18
23
|
this.statusDispatchTimeoutID = null;
|
|
19
24
|
this.preflightChecks = [];
|
|
@@ -45,7 +50,8 @@ HTMLAppBootstrapper.STATUS = {
|
|
|
45
50
|
appRunning: 'appRunning',
|
|
46
51
|
appLaunched: 'appLaunched',
|
|
47
52
|
appLaunchFailure: 'appLaunchFailure',
|
|
48
|
-
appRequiresNoOtherInstances: 'appRequiresNoOtherInstances'
|
|
53
|
+
appRequiresNoOtherInstances: 'appRequiresNoOtherInstances',
|
|
54
|
+
appCrashed: 'appCrashed'
|
|
49
55
|
};
|
|
50
56
|
|
|
51
57
|
HTMLAppBootstrapper.prototype = {
|
|
@@ -62,6 +68,9 @@ HTMLAppBootstrapper.prototype = {
|
|
|
62
68
|
},
|
|
63
69
|
|
|
64
70
|
run: function(){
|
|
71
|
+
if (this.app === null){
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
65
74
|
this.log_info("boot", "Booting " + this.app.bundleId + ", build " + this.app.buildId);
|
|
66
75
|
if (this.serviceWorkerSrc && window.navigator.serviceWorker){
|
|
67
76
|
this._installUsingServiceWorker(window.navigator.serviceWorker);
|
|
@@ -209,6 +218,10 @@ HTMLAppBootstrapper.prototype = {
|
|
|
209
218
|
this.setStatus(HTMLAppBootstrapper.STATUS.appLaunched);
|
|
210
219
|
},
|
|
211
220
|
|
|
221
|
+
applicationDidCrash: function(application){
|
|
222
|
+
this.setStatus(HTMLAppBootstrapper.STATUS.appCrashed);
|
|
223
|
+
},
|
|
224
|
+
|
|
212
225
|
include: function(src, async, callback, errorCallback){
|
|
213
226
|
try{
|
|
214
227
|
this.loadingScripts[src] = {
|
|
@@ -238,10 +251,12 @@ HTMLAppBootstrapper.prototype = {
|
|
|
238
251
|
},
|
|
239
252
|
|
|
240
253
|
setStatus: function(status){
|
|
241
|
-
|
|
254
|
+
if (status !== HTMLAppBootstrapper.STATUS.appCrashed){
|
|
255
|
+
this.log_info("status", this.status + " -> " + status);
|
|
256
|
+
}
|
|
242
257
|
this.status = status;
|
|
243
258
|
var bootstrapper = this;
|
|
244
|
-
if (status === HTMLAppBootstrapper.STATUS.appRunning || status === HTMLAppBootstrapper.STATUS.appLaunched){
|
|
259
|
+
if (status === HTMLAppBootstrapper.STATUS.appRunning || status === HTMLAppBootstrapper.STATUS.appLaunched || status === HTMLAppBootstrapper.STATUS.appCrashed){
|
|
245
260
|
if (this.statusDispatchTimeoutID !== null){
|
|
246
261
|
clearTimeout(this.statusDispatchTimeoutID);
|
|
247
262
|
this.statusDispatchTimeoutID = null;
|