@breakside/jskit 2022.9.0 → 2022.11.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/JSHTMLHTTPClient.js +9 -1
- package/Frameworks/Foundation.jsframework/JS/JSImage.js +11 -4
- package/Frameworks/Foundation.jsframework/JS/JSURLResponse.js +10 -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/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/FNTFontDescriptor.js +9 -6
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSHTMLHTTPClient.js +9 -1
- package/Root/Frameworks/Foundation/JSImage.js +11 -4
- package/Root/Frameworks/Foundation/JSURLResponse.js +10 -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/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 +4 -9
- 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/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": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.11.0",
|
|
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": "7a79fc99aad9e09bba303eb9bc57b05f53242951"
|
|
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": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.11.0",
|
|
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": "7a79fc99aad9e09bba303eb9bc57b05f53242951"
|
|
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": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.11.0",
|
|
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": "7a79fc99aad9e09bba303eb9bc57b05f53242951"
|
|
12
12
|
}
|
|
@@ -42,13 +42,16 @@ JSClass("FNTFontDescriptor", JSDataFontDescriptor, {
|
|
|
42
42
|
}
|
|
43
43
|
var os2 = this.font.tables['OS/2'];
|
|
44
44
|
if (os2){
|
|
45
|
-
this._weight = Math.floor(os2.
|
|
46
|
-
this._style = (os2.
|
|
45
|
+
this._weight = Math.floor(os2.usWeightClass / 100) * 100;
|
|
46
|
+
this._style = (os2.fsSelection & 0x1) ? JSFont.Style.italic : JSFont.Style.normal;
|
|
47
|
+
}
|
|
48
|
+
var name = font.tables.name;
|
|
49
|
+
if (name){
|
|
50
|
+
this._family = name.family;
|
|
51
|
+
this._postScriptName = name.postscript;
|
|
52
|
+
this._face = name.face;
|
|
53
|
+
this._name = name.fullName;
|
|
47
54
|
}
|
|
48
|
-
// this._family
|
|
49
|
-
// this._name
|
|
50
|
-
// this._face
|
|
51
|
-
// this._postScriptName
|
|
52
55
|
this._characterToGlyphMap = {};
|
|
53
56
|
this._glyphToCharacterMap = {};
|
|
54
57
|
},
|
|
@@ -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": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.11.0",
|
|
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": "7a79fc99aad9e09bba303eb9bc57b05f53242951"
|
|
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": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.11.0",
|
|
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": "7a79fc99aad9e09bba303eb9bc57b05f53242951"
|
|
13
13
|
}
|
|
@@ -38,7 +38,15 @@ JSClass("JSHTMLHTTPClient", JSObject, {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
var failEventHandler = function(e){
|
|
41
|
-
|
|
41
|
+
if (e.type == "error"){
|
|
42
|
+
complete(new Error("XMLHttpRequest error (network down, timeout, CORS, etc)"));
|
|
43
|
+
}else if (e.type == "timeout"){
|
|
44
|
+
complete(new Error("XMLHttpRequest timeout"));
|
|
45
|
+
}else if (e.type == "abort"){
|
|
46
|
+
complete(new Error("XMLHttpRequest aborted"));
|
|
47
|
+
}else{
|
|
48
|
+
complete(new Error("XMLHttpRequest failed with event: " + e.type));
|
|
49
|
+
}
|
|
42
50
|
};
|
|
43
51
|
try {
|
|
44
52
|
var response = null;
|
|
@@ -449,14 +449,21 @@ JSClass("_JSURLImage", JSImage, {
|
|
|
449
449
|
|
|
450
450
|
getData: function(completion, target){
|
|
451
451
|
if (!completion){
|
|
452
|
-
completion = Promise.completion(Promise.
|
|
452
|
+
completion = Promise.completion(Promise.rejectNonNullSecondArgument);
|
|
453
453
|
}
|
|
454
454
|
var session = JSURLSession.shared;
|
|
455
455
|
var task = session.dataTaskWithURL(this.url, function(error){
|
|
456
|
-
if (error !== null
|
|
457
|
-
completion.call(target, null);
|
|
456
|
+
if (error !== null){
|
|
457
|
+
completion.call(target, null, error);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
try{
|
|
461
|
+
task.response.assertSuccess();
|
|
462
|
+
}catch (e){
|
|
463
|
+
completion.call(target, null, e);
|
|
464
|
+
return;
|
|
458
465
|
}
|
|
459
|
-
completion.call(target, task.response.data);
|
|
466
|
+
completion.call(target, task.response.data, null);
|
|
460
467
|
});
|
|
461
468
|
task.resume();
|
|
462
469
|
return completion.promise;
|
|
@@ -163,6 +163,16 @@ JSURLResponse.StatusClass = {
|
|
|
163
163
|
serverError: 5
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
+
JSURLResponse.error = function(statusCode, object){
|
|
167
|
+
var response = JSURLResponse.init();
|
|
168
|
+
response.statusCode = statusCode;
|
|
169
|
+
if (object !== undefined){
|
|
170
|
+
response.data = JSON.stringify(object).utf8();
|
|
171
|
+
response.headerMap.add("Content-Type", response.jsonMime);
|
|
172
|
+
}
|
|
173
|
+
return new JSURLResponseError(response);
|
|
174
|
+
};
|
|
175
|
+
|
|
166
176
|
JSGlobalObject.JSURLResponseError = function(response){
|
|
167
177
|
if (this === undefined){
|
|
168
178
|
return new JSURLResponseError();
|
|
@@ -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": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.11.0",
|
|
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": "7a79fc99aad9e09bba303eb9bc57b05f53242951"
|
|
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": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.11.0",
|
|
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": "7a79fc99aad9e09bba303eb9bc57b05f53242951"
|
|
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": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.11.0",
|
|
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": "7a79fc99aad9e09bba303eb9bc57b05f53242951"
|
|
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": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.11.0",
|
|
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": "7a79fc99aad9e09bba303eb9bc57b05f53242951"
|
|
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": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.11.0",
|
|
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": "7a79fc99aad9e09bba303eb9bc57b05f53242951"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [
|
|
16
16
|
{
|
|
@@ -42,13 +42,16 @@ JSClass("FNTFontDescriptor", JSDataFontDescriptor, {
|
|
|
42
42
|
}
|
|
43
43
|
var os2 = this.font.tables['OS/2'];
|
|
44
44
|
if (os2){
|
|
45
|
-
this._weight = Math.floor(os2.
|
|
46
|
-
this._style = (os2.
|
|
45
|
+
this._weight = Math.floor(os2.usWeightClass / 100) * 100;
|
|
46
|
+
this._style = (os2.fsSelection & 0x1) ? JSFont.Style.italic : JSFont.Style.normal;
|
|
47
|
+
}
|
|
48
|
+
var name = font.tables.name;
|
|
49
|
+
if (name){
|
|
50
|
+
this._family = name.family;
|
|
51
|
+
this._postScriptName = name.postscript;
|
|
52
|
+
this._face = name.face;
|
|
53
|
+
this._name = name.fullName;
|
|
47
54
|
}
|
|
48
|
-
// this._family
|
|
49
|
-
// this._name
|
|
50
|
-
// this._face
|
|
51
|
-
// this._postScriptName
|
|
52
55
|
this._characterToGlyphMap = {};
|
|
53
56
|
this._glyphToCharacterMap = {};
|
|
54
57
|
},
|
|
@@ -38,7 +38,15 @@ JSClass("JSHTMLHTTPClient", JSObject, {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
var failEventHandler = function(e){
|
|
41
|
-
|
|
41
|
+
if (e.type == "error"){
|
|
42
|
+
complete(new Error("XMLHttpRequest error (network down, timeout, CORS, etc)"));
|
|
43
|
+
}else if (e.type == "timeout"){
|
|
44
|
+
complete(new Error("XMLHttpRequest timeout"));
|
|
45
|
+
}else if (e.type == "abort"){
|
|
46
|
+
complete(new Error("XMLHttpRequest aborted"));
|
|
47
|
+
}else{
|
|
48
|
+
complete(new Error("XMLHttpRequest failed with event: " + e.type));
|
|
49
|
+
}
|
|
42
50
|
};
|
|
43
51
|
try {
|
|
44
52
|
var response = null;
|
|
@@ -449,14 +449,21 @@ JSClass("_JSURLImage", JSImage, {
|
|
|
449
449
|
|
|
450
450
|
getData: function(completion, target){
|
|
451
451
|
if (!completion){
|
|
452
|
-
completion = Promise.completion(Promise.
|
|
452
|
+
completion = Promise.completion(Promise.rejectNonNullSecondArgument);
|
|
453
453
|
}
|
|
454
454
|
var session = JSURLSession.shared;
|
|
455
455
|
var task = session.dataTaskWithURL(this.url, function(error){
|
|
456
|
-
if (error !== null
|
|
457
|
-
completion.call(target, null);
|
|
456
|
+
if (error !== null){
|
|
457
|
+
completion.call(target, null, error);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
try{
|
|
461
|
+
task.response.assertSuccess();
|
|
462
|
+
}catch (e){
|
|
463
|
+
completion.call(target, null, e);
|
|
464
|
+
return;
|
|
458
465
|
}
|
|
459
|
-
completion.call(target, task.response.data);
|
|
466
|
+
completion.call(target, task.response.data, null);
|
|
460
467
|
});
|
|
461
468
|
task.resume();
|
|
462
469
|
return completion.promise;
|
|
@@ -163,6 +163,16 @@ JSURLResponse.StatusClass = {
|
|
|
163
163
|
serverError: 5
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
+
JSURLResponse.error = function(statusCode, object){
|
|
167
|
+
var response = JSURLResponse.init();
|
|
168
|
+
response.statusCode = statusCode;
|
|
169
|
+
if (object !== undefined){
|
|
170
|
+
response.data = JSON.stringify(object).utf8();
|
|
171
|
+
response.headerMap.add("Content-Type", response.jsonMime);
|
|
172
|
+
}
|
|
173
|
+
return new JSURLResponseError(response);
|
|
174
|
+
};
|
|
175
|
+
|
|
166
176
|
JSGlobalObject.JSURLResponseError = function(response){
|
|
167
177
|
if (this === undefined){
|
|
168
178
|
return new JSURLResponseError();
|
|
@@ -126,7 +126,7 @@ JSClass('UIApplication', UIResponder, {
|
|
|
126
126
|
JSFont.Size[size] = Math.round(JSFont.Size[size] * 1.2);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
this.
|
|
129
|
+
this.registerFontDescriptors(descriptors, function(error){
|
|
130
130
|
completion.call(target, error);
|
|
131
131
|
}, this);
|
|
132
132
|
},
|
|
@@ -427,9 +427,23 @@ JSClass('UIApplication', UIResponder, {
|
|
|
427
427
|
this.windowServer.createMouseEvent(UIEvent.Type.leftMouseUp, event.timestamp, location);
|
|
428
428
|
},
|
|
429
429
|
|
|
430
|
+
// MARK: - Fonts
|
|
431
|
+
|
|
432
|
+
registerFontDescriptor: function(descriptor, completion, target){
|
|
433
|
+
return this.registerFontDescriptors([descriptor], completion, target);
|
|
434
|
+
},
|
|
435
|
+
|
|
436
|
+
registerFontDescriptors: function(descriptors, completion, target){
|
|
437
|
+
return this.windowServer.displayServer.registerFontDescriptors(descriptors, completion, target);
|
|
438
|
+
},
|
|
439
|
+
|
|
440
|
+
// MARK: - URLs
|
|
441
|
+
|
|
430
442
|
openURL: function(url, options){
|
|
431
443
|
},
|
|
432
444
|
|
|
445
|
+
// MARK: - Environment
|
|
446
|
+
|
|
433
447
|
getenv: function(name, defaultValue){
|
|
434
448
|
return this.environment.get(name, defaultValue);
|
|
435
449
|
},
|
|
@@ -288,6 +288,9 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
288
288
|
},
|
|
289
289
|
|
|
290
290
|
reloadCellsAtIndexPaths: function(indexPaths, animator){
|
|
291
|
+
if (this._needsReload){
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
291
294
|
if (this._visibleElements.length === 0){
|
|
292
295
|
return;
|
|
293
296
|
}
|
|
@@ -1222,15 +1225,7 @@ VisibleElement.prototype = Object.create(Function.prototype, {
|
|
|
1222
1225
|
indexPath: { value: null, writable: true },
|
|
1223
1226
|
rect: { value: null, writable: true, configurable: true },
|
|
1224
1227
|
kind: { value: null, writable: true },
|
|
1225
|
-
view: {
|
|
1226
|
-
configurable: true,
|
|
1227
|
-
set: function(view){
|
|
1228
|
-
Object.defineProperty(this, 'view', {value: view});
|
|
1229
|
-
},
|
|
1230
|
-
get: function(){
|
|
1231
|
-
return null;
|
|
1232
|
-
}
|
|
1233
|
-
},
|
|
1228
|
+
view: { value: null, writable: true },
|
|
1234
1229
|
state: { value: null, writable: true },
|
|
1235
1230
|
animation: { value: null, writable: true },
|
|
1236
1231
|
|
|
@@ -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){
|