@breakside/jskit 2022.22.0 → 2022.22.3

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 (55) 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/DOM.jsframework/sources.json +10 -3
  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/FontKit.jsframework/sources.json +34 -2
  7. package/Frameworks/Foundation.jsframework/Info.json +2 -2
  8. package/Frameworks/Foundation.jsframework/JS/JSAttributedString.js +69 -20
  9. package/Frameworks/Foundation.jsframework/JS/JSTextAttachment.js +6 -1
  10. package/Frameworks/Foundation.jsframework/JS/JSTextRun.js +3 -0
  11. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  12. package/Frameworks/Foundation.jsframework/sources.json +159 -1
  13. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  14. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  15. package/Frameworks/SecurityKit.jsframework/sources.json +43 -2
  16. package/Info.json +2 -2
  17. package/Node/Builder.js +20 -9
  18. package/Node/FrameworkBuilder.js +22 -2
  19. package/Node/Project.js +22 -2
  20. package/Node/io.breakside.jskit-bundle.js +2 -2
  21. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  22. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  23. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  24. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  25. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  26. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  27. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  28. package/Root/Frameworks/DOM/Info.yaml +1 -1
  29. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  30. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  31. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  32. package/Root/Frameworks/Foundation/JSAttributedString.js +69 -20
  33. package/Root/Frameworks/Foundation/JSTextAttachment.js +6 -1
  34. package/Root/Frameworks/Foundation/JSTextRun.js +3 -0
  35. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  36. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  37. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  38. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  39. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  40. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  41. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  42. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  43. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  44. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  45. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  46. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  47. package/Root/Frameworks/UIKit/UICollectionView.js +11 -7
  48. package/Root/Frameworks/UIKit/UIContainerView.js +1 -1
  49. package/Root/Frameworks/UIKit/UIHTMLTextFrame.js +3 -0
  50. package/Root/Frameworks/UIKit/UIHTMLTextRun.js +3 -1
  51. package/Root/Frameworks/UIKit/UIHTMLTextTypesetter.js +14 -0
  52. package/Root/Frameworks/UIKit/UIImageView.js +4 -0
  53. package/Root/Frameworks/UIKit/UILabel.js +43 -10
  54. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  55. package/package.json +1 -1
@@ -174,11 +174,14 @@ JSClass('UILabel', UIView, {
174
174
  var attributes = this.attributedText.attributesAtIndex(index);
175
175
  this._didDrag = false;
176
176
  if (attributes.link){
177
- var range = this.attributedText.rangeOfRunAtIndex(index);
178
- var layer = UILayer.init();
179
- layer.frame = this.layer.textLayoutManager.rectsForCharacterRange(range)[0].rectWithInsets(JSInsets(-1, -2));
180
- layer.cornerRadius = 2;
181
- layer.backgroundColor = JSColor.black.colorWithAlpha(0.2);
177
+ var range = this.attributedText.longestRangeOfAttributeAtIndex("link", index);
178
+ var layer = UILabelLinkLayer.init();
179
+ layer.pathColor = (attributes.textColor || this.textColor).colorWithAlpha(0.2);
180
+ var rects = this.layer.textLayoutManager.rectsForCharacterRange(range);
181
+ var i, l;
182
+ for (i = 0, l = rects.length; i < l; ++i){
183
+ layer.addRect(rects[i]);
184
+ }
182
185
  this.layer.addSublayer(layer);
183
186
  this._mouseDownAction = {
184
187
  link: attributes.link,
@@ -271,11 +274,14 @@ JSClass('UILabel', UIView, {
271
274
  var index = this.layer.textLayoutManager.characterIndexAtPoint(location);
272
275
  var attributes = this.attributedText.attributesAtIndex(index);
273
276
  if (attributes.link){
274
- var range = this.attributedText.rangeOfRunAtIndex(index);
275
- var layer = UILayer.init();
276
- layer.frame = this.layer.textLayoutManager.rectsForCharacterRange(range)[0].rectWithInsets(JSInsets(-1, -2));
277
- layer.cornerRadius = 2;
278
- layer.backgroundColor = JSColor.black.colorWithAlpha(0.2);
277
+ var range = this.attributedText.longestRangeOfAttributeAtIndex("link", index);
278
+ var layer = UILabelLinkLayer.init();
279
+ layer.pathColor = (attributes.textColor || this.textColor).colorWithAlpha(0.2);
280
+ var rects = this.layer.textLayoutManager.rectsForCharacterRange(range);
281
+ var i, l;
282
+ for (i = 0, l = rects.length; i < l; ++i){
283
+ layer.addRect(rects[i]);
284
+ }
279
285
  this.layer.addSublayer(layer);
280
286
  this._touchAction = {
281
287
  link: attributes.link,
@@ -379,4 +385,31 @@ JSClass('UILabel', UIView, {
379
385
 
380
386
  });
381
387
 
388
+ JSClass("UILabelLinkLayer", UILayer, {
389
+
390
+ pathColor: null,
391
+
392
+ init: function(){
393
+ UILabelLinkLayer.$super.init.call(this);
394
+ this.path = JSPath.init();
395
+ this.pathColor = JSColor.black;
396
+ this.setNeedsDisplay();
397
+ },
398
+
399
+ addRect: function(rect){
400
+ this.path.addRoundedRect(rect.rectWithInsets(JSInsets(-1, -2)), 2);
401
+ this.frame = this.path.boundingRect;
402
+ },
403
+
404
+ drawInContext: function(context){
405
+ context.save();
406
+ context.translateBy(-this.path.boundingRect.origin.x, -this.path.boundingRect.origin.y);
407
+ context.setFillColor(this.pathColor);
408
+ context.addPath(this.path);
409
+ context.fillPath();
410
+ context.restore();
411
+ },
412
+
413
+ });
414
+
382
415
  UILabel.layerClass = UITextLayer;
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKitTesting
3
- JSBundleVersion: 2022.22.0
3
+ JSBundleVersion: 2022.22.3
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=10.10.0"
10
10
  },
11
11
  "name": "@breakside/jskit",
12
- "version": "2022.22.0",
12
+ "version": "2022.22.3",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"