@breakside/jskit 2023.9.0 → 2023.9.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.
Files changed (44) hide show
  1. package/Frameworks/DOM.jsframework/Info.json +2 -2
  2. package/Frameworks/DOM.jsframework/JS/DOMParser.js +72 -63
  3. package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
  4. package/Frameworks/FontKit.jsframework/Info.json +2 -2
  5. package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
  6. package/Frameworks/Foundation.jsframework/Info.json +2 -2
  7. package/Frameworks/Foundation.jsframework/JS/JSImage.js +13 -16
  8. package/Frameworks/Foundation.jsframework/JS/JSXMLParser.js +206 -101
  9. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  10. package/Frameworks/Foundation.jsframework/sources.json +2 -0
  11. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  12. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  13. package/Info.json +2 -2
  14. package/Node/Resources.js +13 -16
  15. package/Node/io.breakside.jskit-bundle.js +2 -2
  16. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  17. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  18. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  19. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  20. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  21. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  22. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  23. package/Root/Frameworks/DOM/DOMParser.js +72 -63
  24. package/Root/Frameworks/DOM/Info.yaml +1 -1
  25. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  26. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  27. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  28. package/Root/Frameworks/Foundation/JSImage.js +13 -16
  29. package/Root/Frameworks/Foundation/JSXMLParser.js +206 -101
  30. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  31. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  32. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  33. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  34. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  35. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  36. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  37. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  38. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  39. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  40. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  41. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  42. package/Root/Frameworks/UIKit/UINavigationController.js +6 -1
  43. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  44. package/package.json +1 -1
@@ -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.9.0",
6
+ "JSBundleVersion": "2023.9.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": "f5a30c6a66cf6cf8e98d7a10b27a7e972243b75d"
14
+ "GitRevision": "1a4e4cfebe3671d6605583e7b24ff9665646b58f"
15
15
  },
16
16
  "Resources": [
17
17
  {
@@ -189,7 +189,9 @@
189
189
  "JSURLSession",
190
190
  "JSURLResponse",
191
191
  "JSURLResponseError",
192
+ "JSXMLParserDelegate",
192
193
  "JSXMLParser",
194
+ "JSXMLAttributeMap",
193
195
  "JSImage",
194
196
  "_JSResourceImage",
195
197
  "_JSDataImage",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "JSBundleType": "framework",
3
3
  "JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
4
- "JSBundleVersion": "2023.9.0",
4
+ "JSBundleVersion": "2023.9.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": "f5a30c6a66cf6cf8e98d7a10b27a7e972243b75d"
12
+ "GitRevision": "1a4e4cfebe3671d6605583e7b24ff9665646b58f"
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.9.0",
6
+ "JSBundleVersion": "2023.9.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": "f5a30c6a66cf6cf8e98d7a10b27a7e972243b75d"
14
+ "GitRevision": "1a4e4cfebe3671d6605583e7b24ff9665646b58f"
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.9.0",
4
+ "JSBundleVersion": "2023.9.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": "f5a30c6a66cf6cf8e98d7a10b27a7e972243b75d"
11
+ "GitRevision": "1a4e4cfebe3671d6605583e7b24ff9665646b58f"
12
12
  }
package/Node/Resources.js CHANGED
@@ -382,9 +382,9 @@ var addMetadata = {
382
382
  metadata.image = {
383
383
  vector: true
384
384
  };
385
- var parser = JSXMLParser.init();
386
- parser.parse(xml, {
387
- beginElement: function(name, prefix, namespace, attributes, isClosed){
385
+ var parser = JSXMLParser.initWithString(xml);
386
+ parser.delegate = {
387
+ xmlParserDidBeginElement: function(parser, name, prefix, namespace, attributes){
388
388
  var multiple = {
389
389
  'em': 12,
390
390
  'ex': 24,
@@ -414,25 +414,22 @@ var addMetadata = {
414
414
  return multiple[unit] * n;
415
415
  };
416
416
  if (namespace == 'http://www.w3.org/2000/svg' && name.toLowerCase() == 'svg'){
417
- var attrs = {};
418
- for (let i = 0, l = attributes.length; i < l; ++i){
419
- let attr = attributes[i];
420
- if (attr.namespace === null){
421
- attrs[attr.name] = attr.value;
422
- }
423
- }
424
- if (attrs.width && attrs.height){
425
- metadata.image.width = px(attrs.width);
426
- metadata.image.height = px(attrs.height);
427
- }else if (attrs.viewBox){
428
- var box = attrs.viewBox.split(/\s+/).map(n => parseInt(n));
417
+ let width = attributes.get("width");
418
+ let height = attributes.get("height");
419
+ let viewBox = attributes.get("viewBox");
420
+ if (width && height){
421
+ metadata.image.width = px(width);
422
+ metadata.image.height = px(height);
423
+ }else if (viewBox){
424
+ var box = viewBox.split(/\s+/).map(n => parseInt(n));
429
425
  metadata.image.width = box[2];
430
426
  metadata.image.height = box[3];
431
427
  }
432
428
  }
433
429
  parser.stop();
434
430
  }
435
- });
431
+ };
432
+ parser.parse();
436
433
  },
437
434
 
438
435
  '.ttf': async function(name, contents, metadata){
@@ -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.9.0",
6
+ "JSBundleVersion": "2023.9.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": "f5a30c6a66cf6cf8e98d7a10b27a7e972243b75d"
13
+ "GitRevision": "1a4e4cfebe3671d6605583e7b24ff9665646b58f"
14
14
  },
15
15
  "Resources": [
16
16
  {
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.APIKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.9.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSIncludeDirectories:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.APIKitTesting
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.9.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.AuthKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.9.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.CSSOM
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.9.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ChartKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.9.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2021 Breakside Inc.
6
6
  # JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ConferenceKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.9.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.DBKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.9.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -22,73 +22,82 @@ JSGlobalObject.DOMParser = function DOMParser(){
22
22
 
23
23
  DOMParser.prototype = {
24
24
 
25
+ document: null,
26
+ currentNode: null,
27
+
25
28
  parseFromString: function(str, mimetype){
26
- var parser = JSXMLParser.init();
27
- var isHTML = mimetype == "text/html";
28
- parser.isHTML = isHTML;
29
- var document = null;
30
- var node = null;
31
- var stack = [];
32
- parser.parse(str, {
33
- beginDocument: function(){
34
- document = DOM.createDocument();
35
- node = document;
36
- },
37
- handleDocumentType: function(name, publicId, systemId){
38
- var doctype = document.implementation.createDocumentType(name, publicId, systemId);
39
- document.appendChild(doctype);
40
- },
41
- handleProcessingInstruction: function(name, data){
42
- var pi = document.createProcessingInstruction(name, data);
43
- node.appendChild(pi);
44
- },
45
- handleComment: function(text){
46
- var comment = document.createComment(text);
47
- node.appendChild(comment);
48
- },
49
- handleCDATA: function(text){
50
- var cdata = document.createCDATASection(text);
51
- node.appendChild(cdata);
52
- },
53
- beginElement: function(name, prefix, namespace, attributes, isClosed){
54
- var element;
55
- if (namespace !== null){
56
- if (prefix !== null){
57
- element = document.createElementNS(namespace, prefix + ':' + name);
58
- }else{
59
- element = document.createElementNS(namespace, name);
60
- }
29
+ var parser = JSXMLParser.initWithString(str);
30
+ if (mimetype == "text/html"){
31
+ parser.mode = JSXMLParser.Mode.html;
32
+ }
33
+ this.document = null;
34
+ this.currentNode = null;
35
+ parser.delegate = this;
36
+ parser.parse();
37
+ return this.document;
38
+ },
39
+
40
+ xmlParserDidBeginDocument: function(parser){
41
+ this.document = DOM.createDocument();
42
+ this.currentNode = this.document;
43
+ },
44
+
45
+ xmlParserFoundDocumentType: function(parser, name, publicId, systemId){
46
+ var doctype = this.document.implementation.createDocumentType(name, publicId, systemId);
47
+ this.document.appendChild(doctype);
48
+ },
49
+
50
+ xmlParserFoundProcessingInstruction: function(parser, name, data){
51
+ var pi = this.document.createProcessingInstruction(name, data);
52
+ this.currentNode.appendChild(pi);
53
+ },
54
+
55
+ xmlParserFoundComment: function(parser, text){
56
+ var comment = this.document.createComment(text);
57
+ this.currentNode.appendChild(comment);
58
+ },
59
+
60
+ xmlParserFoundCDATA: function(parser, text){
61
+ var cdata = this.document.createCDATASection(text);
62
+ this.currentNode.appendChild(cdata);
63
+ },
64
+
65
+ xmlParserDidBeginElement: function(parser, name, prefix, namespace, attributes){
66
+ var element;
67
+ if (namespace !== null){
68
+ if (prefix !== null){
69
+ element = this.document.createElementNS(namespace, prefix + ':' + name);
70
+ }else{
71
+ element = this.document.createElementNS(namespace, name);
72
+ }
73
+ }else{
74
+ element = this.document.createElement(name);
75
+ }
76
+ var attrs = attributes.all();
77
+ var attr;
78
+ for (var i = 0, l = attrs.length; i < l; ++i){
79
+ attr = attrs[i];
80
+ if (attr.namespace){
81
+ if (attr.prefix !== null){
82
+ element.setAttributeNS(attr.namespace, attr.prefix + ':' + attr.name, attr.value);
61
83
  }else{
62
- element = document.createElement(name);
63
- }
64
- var attr;
65
- for (var i = 0, l = attributes.length; i < l; ++i){
66
- attr = attributes[i];
67
- if (attr.namespace){
68
- if (attr.prefix !== null){
69
- element.setAttributeNS(attr.namespace, attr.prefix + ':' + attr.name, attr.value);
70
- }else{
71
- element.setAttribute(attr.namespace, attr.name, attr.value);
72
- }
73
- }else{
74
- element.setAttribute(attr.name, attr.value);
75
- }
84
+ element.setAttribute(attr.namespace, attr.name, attr.value);
76
85
  }
77
- node.appendChild(element);
78
- if (!isClosed){
79
- stack.push(node);
80
- node = element;
81
- }
82
- },
83
- handleText: function(text){
84
- var textNode = document.createTextNode(text);
85
- node.appendChild(textNode);
86
- },
87
- endElement: function(){
88
- node = stack.pop();
86
+ }else{
87
+ element.setAttribute(attr.name, attr.value);
89
88
  }
90
- });
91
- return document;
89
+ }
90
+ this.currentNode.appendChild(element);
91
+ this.currentNode = element;
92
+ },
93
+
94
+ xmlParserFoundText: function(parser, text){
95
+ var textNode = this.document.createTextNode(text);
96
+ this.currentNode.appendChild(textNode);
97
+ },
98
+
99
+ xmlParserDidEndElement: function(parser){
100
+ this.currentNode = this.currentNode.parentNode;
92
101
  }
93
102
 
94
103
  };
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.DOM
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.9.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.Dispatch
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.9.1
4
4
  JSCopyright: Copyright © 2020 Breakside Inc.
5
5
  JSBundleEnvironments:
6
6
  html: Dispatch+HTML.js
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.FontKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.9.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.Foundation
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.9.1
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -373,10 +373,10 @@ _JSDataImage.sizeFromJPEGData = function(data){
373
373
  };
374
374
 
375
375
  _JSDataImage.sizeFromSVGData = function(data){
376
- var parser = JSXMLParser.init();
376
+ var parser = JSXMLParser.initWithData(data);
377
377
  var size = JSSize(1, 1);
378
- parser.parse(data.stringByDecodingUTF8(), {
379
- beginElement: function(name, prefix, namespace, attributes, isClosed){
378
+ parser.delegate = {
379
+ xmlParserDidBeginElement: function(parser, name, prefix, namespace, attributes){
380
380
  var multiple = {
381
381
  'em': 12,
382
382
  'ex': 24,
@@ -406,25 +406,22 @@ _JSDataImage.sizeFromSVGData = function(data){
406
406
  return multiple[unit] * n;
407
407
  };
408
408
  if (namespace == 'http://www.w3.org/2000/svg' && name.toLowerCase() == 'svg'){
409
- var attrs = {};
410
- for (var i = 0, l = attributes.length; i < l; ++i){
411
- var attr = attributes[i];
412
- if (attr.namespace === null){
413
- attrs[attr.name] = attr.value;
414
- }
415
- }
416
- if (attrs.width && attrs.height){
417
- size.width = px(attrs.width);
418
- size.height = px(attrs.height);
419
- }else if (attrs.viewBox){
420
- var box = attrs.viewBox.split(/\s+/).map(function(n){ return parseInt(n); });
409
+ var width = attributes.get("width");
410
+ var height = attributes.get("height");
411
+ var viewBox = attributes.get("viewBox");
412
+ if (width && height){
413
+ size.width = px(width);
414
+ size.height = px(height);
415
+ }else if (viewBox){
416
+ var box = viewBox.split(/\s+/).map(function(n){ return parseInt(n); });
421
417
  size.width = box[2];
422
418
  size.height = box[3];
423
419
  }
424
420
  }
425
421
  parser.stop();
426
422
  }
427
- });
423
+ };
424
+ parser.parse();
428
425
  return size;
429
426
  };
430
427