@breakside/jskit 2023.28.0 → 2023.32.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/CHPieChart.js +3 -0
- 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/TestKit/TKMock.js +4 -0
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/UIApplication.js +9 -1
- package/Root/Frameworks/UIKit/UIHTMLApplication.js +14 -0
- package/Root/Frameworks/UIKit/UIHTMLContentEditableTextInputManager.js +3 -3
- package/Root/Frameworks/UIKit/UIHTMLDisplayServerCanvasContext.js +1 -1
- package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +52 -0
- package/Root/Frameworks/UIKit/UIKeyboard.js +13 -0
- package/Root/Frameworks/UIKit/UITextField.js +6 -4
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
4
|
-
"JSBundleVersion": "2023.
|
|
4
|
+
"JSBundleVersion": "2023.32.1",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "DOM+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "03043b9695aec6e0f6ef43d36e67f37d7120eaa2"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
6
|
-
"JSBundleVersion": "2023.
|
|
6
|
+
"JSBundleVersion": "2023.32.1",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
11
11
|
"node": "DOM+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "03043b9695aec6e0f6ef43d36e67f37d7120eaa2"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [],
|
|
17
17
|
"ResourceLookup": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
4
|
-
"JSBundleVersion": "2023.
|
|
4
|
+
"JSBundleVersion": "2023.32.1",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
8
8
|
"html": "FontKit+HTML.js"
|
|
9
9
|
},
|
|
10
10
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
11
|
-
"GitRevision": "
|
|
11
|
+
"GitRevision": "03043b9695aec6e0f6ef43d36e67f37d7120eaa2"
|
|
12
12
|
}
|
|
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.JSKit.FontKit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
6
|
-
"JSBundleVersion": "2023.
|
|
6
|
+
"JSBundleVersion": "2023.32.1",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
10
10
|
"html": "FontKit+HTML.js"
|
|
11
11
|
},
|
|
12
12
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
13
|
-
"GitRevision": "
|
|
13
|
+
"GitRevision": "03043b9695aec6e0f6ef43d36e67f37d7120eaa2"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [],
|
|
16
16
|
"ResourceLookup": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.Foundation",
|
|
4
|
-
"JSBundleVersion": "2023.
|
|
4
|
+
"JSBundleVersion": "2023.32.1",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "Foundation+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "03043b9695aec6e0f6ef43d36e67f37d7120eaa2"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.Foundation'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.Foundation",
|
|
6
|
-
"JSBundleVersion": "2023.
|
|
6
|
+
"JSBundleVersion": "2023.32.1",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.Foundation'] = {
|
|
|
11
11
|
"node": "Foundation+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "03043b9695aec6e0f6ef43d36e67f37d7120eaa2"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [
|
|
17
17
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
|
|
4
|
-
"JSBundleVersion": "2023.
|
|
4
|
+
"JSBundleVersion": "2023.32.1",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "SecurityKit+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "03043b9695aec6e0f6ef43d36e67f37d7120eaa2"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.SecurityKit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
|
|
6
|
-
"JSBundleVersion": "2023.
|
|
6
|
+
"JSBundleVersion": "2023.32.1",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.SecurityKit'] = {
|
|
|
11
11
|
"node": "SecurityKit+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "03043b9695aec6e0f6ef43d36e67f37d7120eaa2"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [],
|
|
17
17
|
"ResourceLookup": {
|
package/Info.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "node",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.jskit",
|
|
4
|
-
"JSBundleVersion": "2023.
|
|
4
|
+
"JSBundleVersion": "2023.32.1",
|
|
5
5
|
"JSExecutableName": "jskit",
|
|
6
6
|
"NPMOrganization": "breakside",
|
|
7
7
|
"JSResources": [
|
|
8
8
|
"Tests/HTMLTestRunner.js",
|
|
9
9
|
"Tests/NodeTestRunner.js"
|
|
10
10
|
],
|
|
11
|
-
"GitRevision": "
|
|
11
|
+
"GitRevision": "03043b9695aec6e0f6ef43d36e67f37d7120eaa2"
|
|
12
12
|
}
|
|
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.jskit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "node",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.jskit",
|
|
6
|
-
"JSBundleVersion": "2023.
|
|
6
|
+
"JSBundleVersion": "2023.32.1",
|
|
7
7
|
"JSExecutableName": "jskit",
|
|
8
8
|
"NPMOrganization": "breakside",
|
|
9
9
|
"JSResources": [
|
|
10
10
|
"Tests/HTMLTestRunner.js",
|
|
11
11
|
"Tests/NodeTestRunner.js"
|
|
12
12
|
],
|
|
13
|
-
"GitRevision": "
|
|
13
|
+
"GitRevision": "03043b9695aec6e0f6ef43d36e67f37d7120eaa2"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [
|
|
16
16
|
{
|
|
@@ -75,6 +75,10 @@ JSGlobalObject.TKMock = function(methods){
|
|
|
75
75
|
}
|
|
76
76
|
mockMethod.results.push({callback: {args: args, argIndex: argIndex, targeted: true}});
|
|
77
77
|
};
|
|
78
|
+
mockMethod.reset = function(){
|
|
79
|
+
mockMethod.calls = [];
|
|
80
|
+
mockMethod.results = [];
|
|
81
|
+
};
|
|
78
82
|
return mockMethod;
|
|
79
83
|
};
|
|
80
84
|
for (var name in methods){
|
|
@@ -229,13 +229,21 @@ JSClass('UIApplication', UIResponder, {
|
|
|
229
229
|
}else{
|
|
230
230
|
this._stopCalled = true;
|
|
231
231
|
logger.info("Stopping application");
|
|
232
|
+
var closed = false;
|
|
232
233
|
var _close = function(){
|
|
234
|
+
if (closed){
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
closed = true;
|
|
233
238
|
JSUserDefaults.shared.close(function(){
|
|
234
239
|
completion.call(target);
|
|
235
240
|
});
|
|
236
241
|
};
|
|
237
242
|
if (this.delegate && this.delegate.applicationWillTerminate){
|
|
238
|
-
this.delegate.applicationWillTerminate(_close);
|
|
243
|
+
var promise = this.delegate.applicationWillTerminate(_close);
|
|
244
|
+
if (promise instanceof Promise){
|
|
245
|
+
promise.finally(_close);
|
|
246
|
+
}
|
|
239
247
|
}else{
|
|
240
248
|
_close();
|
|
241
249
|
}
|
|
@@ -134,6 +134,7 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
134
134
|
this.domWindow.addEventListener("hashchange", this);
|
|
135
135
|
this.domWindow.addEventListener("popstate", this);
|
|
136
136
|
this.domWindow.addEventListener("pageshow", this);
|
|
137
|
+
this.domWindow.addEventListener("visibilitychange", this);
|
|
137
138
|
},
|
|
138
139
|
|
|
139
140
|
removeEventListeners: function(){
|
|
@@ -143,6 +144,7 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
143
144
|
this.domWindow.removeEventListener("hashchange", this);
|
|
144
145
|
this.domWindow.removeEventListener("popstate", this);
|
|
145
146
|
this.domWindow.removeEventListener("pageshow", this);
|
|
147
|
+
this.domWindow.removeEventListener("visibilitychange", this);
|
|
146
148
|
},
|
|
147
149
|
|
|
148
150
|
handleEvent: function(e){
|
|
@@ -244,6 +246,18 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
244
246
|
}
|
|
245
247
|
},
|
|
246
248
|
|
|
249
|
+
_event_visibilitychange: function(e){
|
|
250
|
+
if (this.domWindow.document.visibilityState === "hidden"){
|
|
251
|
+
if (this.delegate && this.delegate.applicationDidEnterBackground){
|
|
252
|
+
this.delegate.applicationDidEnterBackground(this);
|
|
253
|
+
}
|
|
254
|
+
}else if (this.domWindow.document.visibilityState === "visible"){
|
|
255
|
+
if (this.delegate && this.delegate.applicationDidEnterForeground){
|
|
256
|
+
this.delegate.applicationDidEnterForeground(this);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
|
|
247
261
|
_crash: function(error){
|
|
248
262
|
this.removeEventListeners();
|
|
249
263
|
if (this.delegate && this.delegate.applicationDidCrash){
|
|
@@ -83,7 +83,7 @@ JSClass('UIHTMLContentEditableTextInputManager', UITextInputManager, {
|
|
|
83
83
|
setEditableElement: function(editableElement){
|
|
84
84
|
if (editableElement === this._editableElement){
|
|
85
85
|
if (this._editableElement !== null){
|
|
86
|
-
this._editableElement.focus();
|
|
86
|
+
this._editableElement.focus({preventScroll: true});
|
|
87
87
|
this.scheduleDocumentSelectionUpdate();
|
|
88
88
|
}
|
|
89
89
|
return;
|
|
@@ -95,7 +95,7 @@ JSClass('UIHTMLContentEditableTextInputManager', UITextInputManager, {
|
|
|
95
95
|
this._editableElement = editableElement;
|
|
96
96
|
if (this._editableElement !== null){
|
|
97
97
|
this.setupEditableElement();
|
|
98
|
-
this._editableElement.focus();
|
|
98
|
+
this._editableElement.focus({preventScroll: true});
|
|
99
99
|
}
|
|
100
100
|
this.scheduleDocumentSelectionUpdate();
|
|
101
101
|
},
|
|
@@ -749,7 +749,7 @@ JSClass('UIHTMLContentEditableTextInputManager', UITextInputManager, {
|
|
|
749
749
|
|
|
750
750
|
_ensureCorrectFocus: function(){
|
|
751
751
|
if (this._editableElement !== null){
|
|
752
|
-
this._editableElement.focus();
|
|
752
|
+
this._editableElement.focus({preventScroll: true});
|
|
753
753
|
this.updateDocumentSelection();
|
|
754
754
|
}
|
|
755
755
|
},
|
|
@@ -1116,7 +1116,7 @@ JSClass("UIHTMLDisplayServerCanvasContext", UIHTMLDisplayServerContext, {
|
|
|
1116
1116
|
|
|
1117
1117
|
updateAccessibilityFocus: function(accessibility){
|
|
1118
1118
|
var ariaRole = ariaRoleForAccessibility(accessibility);
|
|
1119
|
-
this.element.focus();
|
|
1119
|
+
this.element.focus({preventScroll: true});
|
|
1120
1120
|
// if (focusedAccessibility === null || focusedAccessibility === undefined){
|
|
1121
1121
|
// this.element.removeAttribute("aria-activedescendant");
|
|
1122
1122
|
// }else{
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
// #import "UIHTMLContentEditableTextInputManager.js"
|
|
23
23
|
// #import "UIPlatform.js"
|
|
24
24
|
// #import "UIOpenPanel.js"
|
|
25
|
+
// #import "UIKeyboard.js"
|
|
25
26
|
// #feature Element.prototype.addEventListener
|
|
26
27
|
// #feature 'key' in KeyboardEvent.prototype
|
|
27
28
|
// #feature File
|
|
@@ -166,6 +167,9 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
166
167
|
this.rootElement.addEventListener('touchend', this, {passive: false, capture: false});
|
|
167
168
|
this.rootElement.addEventListener('touchcancel', this, {passive: false, capture: false});
|
|
168
169
|
this.rootElement.addEventListener('touchmove', this, {passive: false, capture: false});
|
|
170
|
+
if (this.domWindow.visualViewport !== null){
|
|
171
|
+
this.domWindow.visualViewport.addEventListener('resize', this, false);
|
|
172
|
+
}
|
|
169
173
|
},
|
|
170
174
|
|
|
171
175
|
removeEventListeners: function(){
|
|
@@ -200,6 +204,9 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
200
204
|
this.rootElement.removeEventListener('touchend', this, {passive: false, capture: false});
|
|
201
205
|
this.rootElement.removeEventListener('touchcancel', this, {passive: false, capture: false});
|
|
202
206
|
this.rootElement.removeEventListener('touchmove', this, {passive: false, capture: false});
|
|
207
|
+
if (this.domWindow.visualViewport !== null){
|
|
208
|
+
this.domWindow.visualViewport.removeEventListener('resize', this, false);
|
|
209
|
+
}
|
|
203
210
|
},
|
|
204
211
|
|
|
205
212
|
handleEvent: function(e){
|
|
@@ -721,6 +728,10 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
721
728
|
// --------------------------------------------------------------------
|
|
722
729
|
// MARK: - Window Events
|
|
723
730
|
|
|
731
|
+
virtualKeyboard: JSLazyInitProperty(function(){
|
|
732
|
+
return UIKeyboard.init();
|
|
733
|
+
}),
|
|
734
|
+
|
|
724
735
|
resize: function(e){
|
|
725
736
|
// resize event is not cancelable, so no need for preventDefault
|
|
726
737
|
if (e.currentTarget === this.domWindow){
|
|
@@ -728,6 +739,47 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
728
739
|
this.screen.frame = JSRect(JSPoint.Zero, this.rootElementSize());
|
|
729
740
|
this.screenDidChangeFrame(oldFrame);
|
|
730
741
|
this.displayServer.setScreenSize(this.screen.frame.size);
|
|
742
|
+
}else if (e.currentTarget === this.domWindow.visualViewport){
|
|
743
|
+
// using touch screen as proxy for "has virtual keyboard"
|
|
744
|
+
// not a perfect match, but good enough for now
|
|
745
|
+
if (UIDevice.shared.primaryPointerType === UIUserInterface.PointerType.touch){
|
|
746
|
+
var viewportFrame = JSRect(
|
|
747
|
+
Math.floor(this.domWindow.visualViewport.offsetLeft),
|
|
748
|
+
Math.floor(this.domWindow.visualViewport.offsetTop),
|
|
749
|
+
Math.floor(this.domWindow.visualViewport.width),
|
|
750
|
+
Math.floor(this.domWindow.visualViewport.height)
|
|
751
|
+
);
|
|
752
|
+
if (viewportFrame.origin.x === this.screen.frame.origin.x && viewportFrame.origin.y === this.screen.frame.origin.y && viewportFrame.size.width === this.screen.frame.size.width){
|
|
753
|
+
// A keyboard may not be the only thing that obstructs the bottom of the screen, but
|
|
754
|
+
// we'll assume that a large-ish obstruction is a keyboard
|
|
755
|
+
var obstructedHeight = this.screen.frame.size.height - viewportFrame.size.height;
|
|
756
|
+
var obstructedFrame = JSRect(0, this.screen.frame.origin.x + this.screen.frame.size.height - obstructedHeight, this.screen.frame.size.width, obstructedHeight);
|
|
757
|
+
if (!this.virtualKeyboard.frame.isEqual(obstructedFrame)){
|
|
758
|
+
var wasVisible = this.virtualKeyboard.visible;
|
|
759
|
+
this.virtualKeyboard.frame = obstructedFrame;
|
|
760
|
+
this.virtualKeyboard.visible = this.virtualKeyboard.frame.size.height > 50;
|
|
761
|
+
if (wasVisible){
|
|
762
|
+
if (this.virtualKeyboard.visible){
|
|
763
|
+
JSNotificationCenter.shared.post("UIKeyboardDidShow", this, {frame: this.virtualKeyboard.frame});
|
|
764
|
+
}else{
|
|
765
|
+
JSNotificationCenter.shared.post("UIKeyboardDidHide", this);
|
|
766
|
+
// This should only come into play on Android, where hiding the keyboard
|
|
767
|
+
// does NOT cause a blur event. We want to go ahead and remove first responder
|
|
768
|
+
// status when the keyboard is hidden.
|
|
769
|
+
if (this.textInputManager.textInputClient instanceof UIView){
|
|
770
|
+
if (this.textInputManager.textInputClient.window.firstResponder === this.textInputManager.textInputClient){
|
|
771
|
+
this.textInputManager.textInputClient.window.firstResponder = null;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}else{
|
|
776
|
+
if (this.virtualKeyboard.visible){
|
|
777
|
+
JSNotificationCenter.shared.post("UIKeyboardDidShow", this, {frame: this.virtualKeyboard.frame});
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
731
783
|
}
|
|
732
784
|
},
|
|
733
785
|
|
|
@@ -1008,10 +1008,12 @@ JSClass("UITextField", UIControl, {
|
|
|
1008
1008
|
this._localEditor.handleTouchesEnded(touches, event);
|
|
1009
1009
|
return;
|
|
1010
1010
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
this.
|
|
1014
|
-
|
|
1011
|
+
if (this._touchOrigin !== null){
|
|
1012
|
+
var origin = this.convertPointToView(this.bounds.origin, this.window);
|
|
1013
|
+
if (this.containsPoint(location) && this._touchOrigin.distanceToPoint(origin) < 2){
|
|
1014
|
+
this.window.firstResponder = this;
|
|
1015
|
+
this._localEditor.handleTouchesEndedAtLocation(this.layer.convertPointToLayer(location, this._textLayer), touches, event);
|
|
1016
|
+
}
|
|
1015
1017
|
}
|
|
1016
1018
|
}
|
|
1017
1019
|
UITextField.$super.touchesEnded.call(this, touches, event);
|