@breakside/jskit 2026.11.0 → 2026.27.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.
Files changed (87) hide show
  1. package/Frameworks/DOM.jsframework/Info.json +2 -2
  2. package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
  3. package/Frameworks/FontKit.jsframework/Info.json +2 -2
  4. package/Frameworks/FontKit.jsframework/JS/FNTOpenTypeFont.js +331 -22
  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/JSAttributedString.js +56 -1
  8. package/Frameworks/Foundation.jsframework/JS/JSContext.js +44 -17
  9. package/Frameworks/Foundation.jsframework/JS/JSCubicBezier.js +54 -1
  10. package/Frameworks/Foundation.jsframework/JS/JSFont.js +8 -9
  11. package/Frameworks/Foundation.jsframework/JS/JSGradient.js +28 -2
  12. package/Frameworks/Foundation.jsframework/JS/JSImage+HTML.js +27 -1
  13. package/Frameworks/Foundation.jsframework/JS/JSNumberFormatter.js +23 -1
  14. package/Frameworks/Foundation.jsframework/JS/JSPath.js +194 -6
  15. package/Frameworks/Foundation.jsframework/JS/JSPoint.js +56 -0
  16. package/Frameworks/Foundation.jsframework/JS/JSTextRun.js +21 -4
  17. package/Frameworks/Foundation.jsframework/JS/JSTextStorage.js +5 -0
  18. package/Frameworks/Foundation.jsframework/JS/JSTextTypesetter.js +6 -1
  19. package/Frameworks/Foundation.jsframework/JS/JSXMLParser.js +1 -1
  20. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  21. package/Frameworks/Foundation.jsframework/sources.json +1 -0
  22. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  23. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  24. package/Info.json +2 -2
  25. package/Node/io.breakside.jskit-bundle.js +2 -2
  26. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  27. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  28. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  29. package/Root/Frameworks/CSSOM/CSSTokenizer.js +633 -470
  30. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  31. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  32. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  33. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  34. package/Root/Frameworks/DOM/Info.yaml +1 -1
  35. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  36. package/Root/Frameworks/FontKit/FNTOpenTypeFont.js +331 -22
  37. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  38. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  39. package/Root/Frameworks/Foundation/JSAttributedString.js +56 -1
  40. package/Root/Frameworks/Foundation/JSContext.js +44 -17
  41. package/Root/Frameworks/Foundation/JSCubicBezier.js +54 -1
  42. package/Root/Frameworks/Foundation/JSFont.js +8 -9
  43. package/Root/Frameworks/Foundation/JSGradient.js +28 -2
  44. package/Root/Frameworks/Foundation/JSImage+HTML.js +27 -1
  45. package/Root/Frameworks/Foundation/JSNumberFormatter.js +23 -1
  46. package/Root/Frameworks/Foundation/JSPath.js +194 -6
  47. package/Root/Frameworks/Foundation/JSPoint.js +56 -0
  48. package/Root/Frameworks/Foundation/JSTextRun.js +21 -4
  49. package/Root/Frameworks/Foundation/JSTextStorage.js +5 -0
  50. package/Root/Frameworks/Foundation/JSTextTypesetter.js +6 -1
  51. package/Root/Frameworks/Foundation/JSXMLParser.js +1 -1
  52. package/Root/Frameworks/ImageKit/IKHTMLCanvasBitmapContext.js +187 -101
  53. package/Root/Frameworks/ImageKit/IKNodeBitmapContext.js +4 -4
  54. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  55. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  56. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  57. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  58. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  59. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  60. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  61. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  62. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  63. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  64. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  65. package/Root/Frameworks/TestKit/TKAssert.js +4 -4
  66. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  67. package/Root/Frameworks/UIKit/UIApplication.js +9 -1
  68. package/Root/Frameworks/UIKit/UICollectionView.js +4 -0
  69. package/Root/Frameworks/UIKit/UIColorPanel.js +46 -0
  70. package/Root/Frameworks/UIKit/UIColorWell.js +8 -0
  71. package/Root/Frameworks/UIKit/UIHTMLDisplayServer.js +21 -2
  72. package/Root/Frameworks/UIKit/UIHTMLDisplayServerCanvasContext.js +150 -69
  73. package/Root/Frameworks/UIKit/UIHTMLTextRun.js +5 -0
  74. package/Root/Frameworks/UIKit/UIHTMLTextTypesetter.js +18 -3
  75. package/Root/Frameworks/UIKit/UIListView.js +7 -5
  76. package/Root/Frameworks/UIKit/UIMenu.js +50 -32
  77. package/Root/Frameworks/UIKit/UIMenuItem.js +12 -0
  78. package/Root/Frameworks/UIKit/UIMenuView.js +27 -5
  79. package/Root/Frameworks/UIKit/UIPlatform.js +7 -0
  80. package/Root/Frameworks/UIKit/UIPopupButton.js +7 -1
  81. package/Root/Frameworks/UIKit/UIResponder.js +8 -0
  82. package/Root/Frameworks/UIKit/UITextEditor.js +31 -7
  83. package/Root/Frameworks/UIKit/UITextField.js +7 -0
  84. package/Root/Frameworks/UIKit/UITokenField.js +65 -0
  85. package/Root/Frameworks/UIKit/UIToolbar.js +1 -1
  86. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  87. package/package.json +1 -1
@@ -72,6 +72,62 @@ JSPoint.prototype = {
72
72
 
73
73
  subtracting: function(other){
74
74
  return JSPoint(this.x - other.x, this.y - other.y);
75
+ },
76
+
77
+ interpolation: function(p1, percentage){
78
+ return JSPoint(
79
+ this.x + (p1.x - this.x) * percentage,
80
+ this.y + (p1.y - this.y) * percentage
81
+ );
82
+ },
83
+
84
+ lineToPointContainsPoint: function(other, point, tolerance){
85
+ // first check if we're within the box defined by the segment
86
+ var minX, maxX;
87
+ if (this.x <= other.x){
88
+ minX = this.x - tolerance;
89
+ maxX = other.x + tolerance;
90
+ }else{
91
+ minX = other.x - tolerance;
92
+ maxX = this.x + tolerance;
93
+ }
94
+ var minY, maxY;
95
+ if (this.y <= other.y){
96
+ minY = this.y - tolerance;
97
+ maxY = other.y + tolerance;
98
+ }else{
99
+ minY = other.y - tolerance;
100
+ maxY = this.y + tolerance;
101
+ }
102
+ if (point.x < minX){
103
+ return false;
104
+ }
105
+ if (point.x > maxX){
106
+ return false;
107
+ }
108
+ if (point.y < minY){
109
+ return false;
110
+ }
111
+ if (point.y > maxY){
112
+ return false;
113
+ }
114
+
115
+ // next check for the special cases of a vertical and horizontal line,
116
+ // where we must be near the line if we're within the box
117
+ var dx = (other.x - this.x);
118
+ var dy = (other.y - this.y);
119
+ if (Math.abs(dx) < 0.00001 || (Math.abs(dy) < 0.00001)){
120
+ return true;
121
+ }
122
+
123
+ // Finally, find the nearest point to the line and see how far away we are
124
+ var m1 = dy / dx;
125
+ var b1 = this.y - m1 * this.x;
126
+ var m2 = -1/m1;
127
+ var b2 = point.y - m2 * point.x;
128
+ var x = (b2 - b1) / (m1 - m2);
129
+ var y = m1 * x + b1;
130
+ return JSPoint(x, y).distanceToPoint(point) <= tolerance;
75
131
  }
76
132
  };
77
133
 
@@ -16,6 +16,7 @@
16
16
  // #import "JSObject.js"
17
17
  // #import "CoreTypes.js"
18
18
  // #import "JSAttributedString.js"
19
+ // #import "JSContext.js"
19
20
  'use strict';
20
21
 
21
22
  (function(){
@@ -31,8 +32,10 @@ JSClass("JSTextRun", JSObject, {
31
32
  attributes: null,
32
33
  font: null,
33
34
  attachment: null,
35
+ _useDisplayMetrics: false,
34
36
 
35
- initWithGlyphs: function(glyphs, glyphCharacterLengths, font, attributes, range){
37
+ initWithGlyphs: function(glyphs, glyphCharacterLengths, font, attributes, range, useDisplayMetrics){
38
+ this._useDisplayMetrics = useDisplayMetrics === true;
36
39
  this.glyphs = glyphs;
37
40
  this.glyphCharacterLengths = glyphCharacterLengths;
38
41
  this.attributes = attributes;
@@ -42,8 +45,13 @@ JSClass("JSTextRun", JSObject, {
42
45
  this._size = JSSize(this.attachment.size);
43
46
  }else{
44
47
  this.font = font;
45
- this.baseline = -font.descender;
46
- this._size = JSSize(0, font.lineHeight);
48
+ if (this._useDisplayMetrics){
49
+ this.baseline = -font.displayDescender;
50
+ this._size = JSSize(0, font.displayLineHeight);
51
+ }else{
52
+ this.baseline = -font.descender;
53
+ this._size = JSSize(0, font.lineHeight);
54
+ }
47
55
  for (var i = 0, l = glyphs.length; i < l; ++i){
48
56
  this._size.width += font.widthOfGlyph(glyphs[i]);
49
57
  }
@@ -67,9 +75,18 @@ JSClass("JSTextRun", JSObject, {
67
75
  context.restore();
68
76
  }else{
69
77
  context.save();
70
- context.translateBy(point.x, point.y + this.font.ascender);
78
+ if (this._useDisplayMetrics){
79
+ context.translateBy(point.x, point.y + this.font.displayAscender);
80
+ }else{
81
+ context.translateBy(point.x, point.y + this.font.ascender);
82
+ }
71
83
  context.setFont(this.font);
72
84
  context.setFillColor(this.attributes.textColor);
85
+ if (this.attributes.strokeWidth){
86
+ context.setLineWidth(this.attributes.strokeWidth);
87
+ context.setStrokeColor(this.attributes.strokeColor);
88
+ context.setTextDrawingMode(JSContext.TextDrawingMode.fillStroke);
89
+ }
73
90
  context.showGlyphs(this.glyphs);
74
91
  context.restore();
75
92
  }
@@ -30,6 +30,11 @@ JSClass("JSTextStorage", JSAttributedString, {
30
30
  this._commonTextStorageInit();
31
31
  },
32
32
 
33
+ initFromDictionary: function(dictionary){
34
+ JSTextStorage.$super.initFromDictionary.call(this, dictionary);
35
+ this._commonTextStorageInit();
36
+ },
37
+
33
38
  _commonTextStorageInit: function(){
34
39
  this._layoutManagers = [];
35
40
  },
@@ -77,9 +77,14 @@ JSClass("JSTextTypesetter", JSObject, {
77
77
  var attributes = this._attributedString.attributesAtIndex(range.location);
78
78
  attributes = this.resolveAttributes(attributes);
79
79
  var font = attributes.font;
80
+ if (this.useDisplayMetrics){
81
+ return JSTextLine.initWithHeight(font.displayLineHeight, -font.displayDescender, range.location);
82
+ }
80
83
  return JSTextLine.initWithHeight(font.lineHeight, -font.descender, range.location);
81
84
  },
82
85
 
86
+ useDisplayMetrics: false,
87
+
83
88
  _createLineFromLayout: function(layout){
84
89
  // Create runs from the adjusted run descriptors
85
90
  var runs = [];
@@ -88,7 +93,7 @@ JSClass("JSTextTypesetter", JSObject, {
88
93
  var runDescriptor;
89
94
  for (var i = 0, l = layout.runDescriptors.length; i < l; ++i){
90
95
  runDescriptor = layout.runDescriptors[i];
91
- run = JSTextRun.initWithGlyphs(runDescriptor.glyphs, runDescriptor.glyphCharacterLengths, runDescriptor.font, runDescriptor.attributes, JSRange(runDescriptor.location, runDescriptor.length));
96
+ run = JSTextRun.initWithGlyphs(runDescriptor.glyphs, runDescriptor.glyphCharacterLengths, runDescriptor.font, runDescriptor.attributes, JSRange(runDescriptor.location, runDescriptor.length), this.useDisplayMetrics);
92
97
  run.origin.x = x;
93
98
  x += run.size.width;
94
99
  runs.push(run);
@@ -475,7 +475,7 @@ JSClass("JSXMLParser", JSObject, {
475
475
  }
476
476
  obj = readObject();
477
477
  }
478
- if (!this.isStopped && this.delegate.xmlParserDidEndDocument){
478
+ if (!this.isStopped && this.delegate && this.delegate.xmlParserDidEndDocument){
479
479
  this.delegate.xmlParserDidEndDocument(this);
480
480
  }
481
481
  }catch (e){
@@ -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": "2026.11.0",
6
+ "JSBundleVersion": "2026.27.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": "812100aa4c3e5b1ec1d0d432be903bba4db01b0e"
14
+ "GitRevision": "f25bf439a7b48f4536a7f4a44d2f1ec39c46208d"
15
15
  },
16
16
  "Resources": [
17
17
  {
@@ -233,6 +233,7 @@
233
233
  "JSSparseArrayController",
234
234
  "JSGradient",
235
235
  "JSPath",
236
+ "JSPathElement",
236
237
  "JSContext",
237
238
  "JSDateFormatter",
238
239
  "JSNumberFormatter",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "JSBundleType": "framework",
3
3
  "JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
4
- "JSBundleVersion": "2026.11.0",
4
+ "JSBundleVersion": "2026.27.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": "812100aa4c3e5b1ec1d0d432be903bba4db01b0e"
12
+ "GitRevision": "f25bf439a7b48f4536a7f4a44d2f1ec39c46208d"
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": "2026.11.0",
6
+ "JSBundleVersion": "2026.27.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": "812100aa4c3e5b1ec1d0d432be903bba4db01b0e"
14
+ "GitRevision": "f25bf439a7b48f4536a7f4a44d2f1ec39c46208d"
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": "2026.11.0",
4
+ "JSBundleVersion": "2026.27.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": "812100aa4c3e5b1ec1d0d432be903bba4db01b0e"
11
+ "GitRevision": "f25bf439a7b48f4536a7f4a44d2f1ec39c46208d"
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": "2026.11.0",
6
+ "JSBundleVersion": "2026.27.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": "812100aa4c3e5b1ec1d0d432be903bba4db01b0e"
13
+ "GitRevision": "f25bf439a7b48f4536a7f4a44d2f1ec39c46208d"
14
14
  },
15
15
  "Resources": [
16
16
  {
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.APIKit
3
- JSBundleVersion: 2026.11.0
3
+ JSBundleVersion: 2026.27.0
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: 2026.11.0
3
+ JSBundleVersion: 2026.27.0
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: 2026.11.0
3
+ JSBundleVersion: 2026.27.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |