@breakside/jskit 2023.9.0 → 2023.10.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 (64) 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/JSClass.js +0 -2
  8. package/Frameworks/Foundation.jsframework/JS/JSFont.js +8 -0
  9. package/Frameworks/Foundation.jsframework/JS/JSFontDescriptor.js +5 -0
  10. package/Frameworks/Foundation.jsframework/JS/JSImage.js +13 -16
  11. package/Frameworks/Foundation.jsframework/JS/JSTextFramesetter.js +7 -2
  12. package/Frameworks/Foundation.jsframework/JS/JSTextLine.js +2 -2
  13. package/Frameworks/Foundation.jsframework/JS/JSTextTypesetter.js +1 -1
  14. package/Frameworks/Foundation.jsframework/JS/JSXMLParser.js +206 -101
  15. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  16. package/Frameworks/Foundation.jsframework/sources.json +2 -0
  17. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  18. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  19. package/Info.json +2 -2
  20. package/Node/Resources.js +13 -16
  21. package/Node/io.breakside.jskit-bundle.js +2 -2
  22. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  23. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  24. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  25. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  26. package/Root/Frameworks/ChartKit/CHPieChart.js +1 -1
  27. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  28. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  29. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  30. package/Root/Frameworks/DOM/DOMParser.js +72 -63
  31. package/Root/Frameworks/DOM/Info.yaml +1 -1
  32. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  33. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  34. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  35. package/Root/Frameworks/Foundation/JSClass.js +0 -2
  36. package/Root/Frameworks/Foundation/JSFont.js +8 -0
  37. package/Root/Frameworks/Foundation/JSFontDescriptor.js +5 -0
  38. package/Root/Frameworks/Foundation/JSImage.js +13 -16
  39. package/Root/Frameworks/Foundation/JSTextFramesetter.js +7 -2
  40. package/Root/Frameworks/Foundation/JSTextLine.js +2 -2
  41. package/Root/Frameworks/Foundation/JSTextTypesetter.js +1 -1
  42. package/Root/Frameworks/Foundation/JSXMLParser.js +206 -101
  43. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  44. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  45. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  46. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  47. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  48. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  49. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  50. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  51. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  52. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  53. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  54. package/Root/Frameworks/TestKit/TKTestSuite.js +1 -1
  55. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  56. package/Root/Frameworks/UIKit/UIAlertController.js +2 -2
  57. package/Root/Frameworks/UIKit/UIHTMLTextLine.js +6 -5
  58. package/Root/Frameworks/UIKit/UIListView.js +4 -1
  59. package/Root/Frameworks/UIKit/UIMenuBar.js +1 -1
  60. package/Root/Frameworks/UIKit/UINavigationController.js +6 -1
  61. package/Root/Frameworks/UIKit/UIVisualEffect+HTML.js +8 -0
  62. package/Root/Frameworks/UIKit/UIVisualEffect.js +25 -0
  63. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  64. package/package.json +1 -1
@@ -14,25 +14,58 @@
14
14
  // limitations under the License.
15
15
 
16
16
  // #import "JSObject.js"
17
+ // #import "JSProtocol.js"
18
+ // #import "String+JS.js"
17
19
  'use strict';
18
20
 
19
21
  (function(){
20
22
 
23
+ JSProtocol("JSXMLParserDelegate", JSProtocol, {
24
+
25
+ xmlParserDidBeginDocument: function(parser){},
26
+ xmlParserDidEndDocument: function(parser){},
27
+ xmlParserFoundDocumentType: function(parser, name, publicId, systemId){},
28
+ xmlParserFoundProcessingInstruction: function(parser, name, data){},
29
+ xmlParserDidBeginElement: function(parser, name, prefix, namespace, attributes){},
30
+ xmlParserDidEndElement: function(parser, name, prefix, namespace){},
31
+ xmlParserFoundComment: function(parser, text){},
32
+ xmlParserFoundCDATA: function(parser, text){},
33
+ xmlParserFoundText: function(parser, text){},
34
+ xmlParserErrorOccurred: function(parser, error){}
35
+
36
+ });
37
+
21
38
  JSClass("JSXMLParser", JSObject, {
22
39
 
23
- isHTML: false,
40
+ initWithData: function(data, encoding){
41
+ if (encoding === undefined){
42
+ encoding = String.Encoding.utf8;
43
+ }
44
+ var xml = String.initWithData(data, encoding);
45
+ this.initWithString(xml);
46
+ },
47
+
48
+ initWithString: function(str){
49
+ this.xml = str;
50
+ },
24
51
 
25
- state: null,
52
+ mode: "xml",
53
+
54
+ xml: null,
55
+ error: null,
26
56
  isStopped: false,
27
57
 
28
58
  stop: function(){
29
59
  this.isStopped = true;
30
60
  },
31
61
 
32
- parse: function(input, listener){
62
+ parse: function(){
63
+ this.isStopped = false;
64
+ this.error = null;
65
+ var input = this.xml;
33
66
  var length = input.length;
34
67
  var offset = 0;
35
- var isHTML = this.isHTML;
68
+ var isHTML = this.mode === JSXMLParser.Mode.html;
36
69
  var c;
37
70
  var lineNumber = 1;
38
71
  var lineOffset;
@@ -309,13 +342,13 @@ JSClass("JSXMLParser", JSObject, {
309
342
  name: resolved.name,
310
343
  prefix: resolved.prefix,
311
344
  namespace: resolved.namespace,
312
- attributes: []
345
+ attributes: JSXMLAttributeMap()
313
346
  };
314
347
  for (i = 0, l = attributes.length; i < l; ++i){
315
348
  attr = attributes[i];
316
349
  if (!attr.name.startsWith("xmlns:") && attr.name != "xmlns"){
317
350
  resolved = resolveNamespace(attr.name, true);
318
- element.attributes.push({
351
+ element.attributes.add({
319
352
  name: resolved.name,
320
353
  prefix: resolved.prefix,
321
354
  namespace: resolved.namespace,
@@ -325,110 +358,125 @@ JSClass("JSXMLParser", JSObject, {
325
358
  }
326
359
  return element;
327
360
  };
328
-
329
- var obj;
330
- if (isHTML){
331
- readWhitespace();
332
- }else{
361
+ try{
362
+ var obj;
363
+ if (isHTML){
364
+ readWhitespace();
365
+ }else{
366
+ obj = readObject();
367
+ if (obj === null || obj.kind != 'PI' || obj.name != 'xml'){
368
+ throw new Error("Expecting <?xml at start of document");
369
+ }
370
+ }
333
371
  obj = readObject();
334
- if (obj === null || obj.kind != 'PI' || obj.name != 'xml'){
335
- throw new Error("Expecting <?xml at start of document");
372
+ var elementStack = [];
373
+ var namespaces = {
374
+ ':default:': null,
375
+ 'xml': 'http://www.w3.org/XML/1998/namespace'
376
+ };
377
+ var namespacesStack = [];
378
+ var hasDocumentElement = false;
379
+ var hasSentDoctype = false;
380
+ var element;
381
+ if (this.delegate && this.delegate.xmlParserDidBeginDocument){
382
+ this.delegate.xmlParserDidBeginDocument(this);
336
383
  }
337
- }
338
- obj = readObject();
339
- var elementNameStack = [];
340
- var namespaces = {
341
- ':default:': null,
342
- 'xml': 'http://www.w3.org/XML/1998/namespace'
343
- };
344
- var namespacesStack = [];
345
- var hasDocumentElement = false;
346
- var hasSentDoctype = false;
347
- if (listener.beginDocument){
348
- listener.beginDocument();
349
- }
350
- while (!this.isStopped && obj !== null){
351
- if (obj.kind == 'Doctype'){
352
- if (hasSentDoctype){
353
- throw new Error("Only one doctype allowed");
354
- }
355
- if (hasDocumentElement){
356
- throw new Error("Doctype must come before the document element");
357
- }
358
- if (elementNameStack.length > 0){
359
- throw new Error("Doctype only allowed at document root");
360
- }
361
- if (listener.handleDocumentType){
362
- listener.handleDocumentType(obj.name, obj.publicId || null, obj.systemId || null);
363
- }
364
- hasSentDoctype = true;
365
- }else if (obj.kind == "PI"){
366
- if (elementNameStack.length > 0){
367
- throw new Error("Processing instructions only allowed at document root");
368
- }
369
- if (listener.handleProcessingInstruction){
370
- listener.handleProcessingInstruction(obj.name, obj.value);
371
- }
372
- }else if (obj.kind == 'CDATA'){
373
- if (elementNameStack.length === 0){
374
- throw new Error("CDATA not allowed at document root");
375
- }
376
- if (listener.handleCDATA){
377
- listener.handleCDATA(obj.value);
378
- }
379
- }else if (obj.kind == 'Comment'){
380
- if (listener.handleComment){
381
- listener.handleComment(obj.value);
382
- }
383
- }else if (obj.kind == 'ElementStart'){
384
- if (elementNameStack.length === 0){
385
- hasDocumentElement = true;
386
- }
387
- elementNameStack.push(obj.name);
388
- namespacesStack.push(namespaces);
389
- namespaces = Object.create(namespaces);
390
- var element = resolveElementNamespace(obj.name, obj.attributes);
391
- if (listener.beginElement){
392
- listener.beginElement(element.name, element.prefix, element.namespace, element.attributes, obj.isClosed);
393
- }
394
- var elementIsClosed = obj.isClosed;
395
- if (obj.rawContents !== null){
396
- if (!this.isStopped && listener.handleText && obj.rawContents.length > 0){
397
- listener.handleText(obj.rawContents);
384
+ while (!this.isStopped && obj !== null){
385
+ if (obj.kind == 'Doctype'){
386
+ if (hasSentDoctype){
387
+ throw new Error("Only one doctype allowed");
398
388
  }
399
- if (!this.isStopped && listener.endElement){
400
- listener.endElement();
389
+ if (hasDocumentElement){
390
+ throw new Error("Doctype must come before the document element");
401
391
  }
402
- elementIsClosed = true;
403
- }
404
- if (elementIsClosed){
405
- elementNameStack.pop();
392
+ if (elementStack.length > 0){
393
+ throw new Error("Doctype only allowed at document root");
394
+ }
395
+ if (this.delegate && this.delegate.xmlParserFoundDocumentType){
396
+ this.delegate.xmlParserFoundDocumentType(this, obj.name, obj.publicId || null, obj.systemId || null);
397
+ }
398
+ hasSentDoctype = true;
399
+ }else if (obj.kind == "PI"){
400
+ if (elementStack.length > 0){
401
+ throw new Error("Processing instructions only allowed at document root");
402
+ }
403
+ if (this.delegate && this.delegate.xmlParserFoundProcessingInstruction){
404
+ this.delegate.xmlParserFoundProcessingInstruction(this, obj.name, obj.value);
405
+ }
406
+ }else if (obj.kind == 'CDATA'){
407
+ if (elementStack.length === 0){
408
+ throw new Error("CDATA not allowed at document root");
409
+ }
410
+ if (this.delegate && this.delegate.xmlParserFoundCDATA){
411
+ this.delegate.xmlParserFoundCDATA(this, obj.value);
412
+ }
413
+ }else if (obj.kind == 'Comment'){
414
+ if (this.delegate && this.delegate.xmlParserFoundComment){
415
+ this.delegate.xmlParserFoundComment(this, obj.value);
416
+ }
417
+ }else if (obj.kind == 'ElementStart'){
418
+ if (elementStack.length === 0){
419
+ hasDocumentElement = true;
420
+ }
421
+ namespacesStack.push(namespaces);
422
+ namespaces = Object.create(namespaces);
423
+ element = resolveElementNamespace(obj.name, obj.attributes);
424
+ elementStack.push(element);
425
+ if (this.delegate && this.delegate.xmlParserDidBeginElement){
426
+ this.delegate.xmlParserDidBeginElement(this, element.name, element.prefix, element.namespace, element.attributes);
427
+ }
428
+ var elementIsClosed = obj.isClosed;
429
+ if (obj.rawContents !== null){
430
+ if (!this.isStopped && this.delegate.xmlParserFoundText && obj.rawContents.length > 0){
431
+ this.delegate.xmlParserFoundText(this, obj.rawContents);
432
+ }
433
+ elementIsClosed = true;
434
+ }
435
+ if (elementIsClosed){
436
+ if (!this.isStopped && this.delegate.xmlParserDidEndElement){
437
+ this.delegate.xmlParserDidEndElement(this, element.name, element.prefix, element.namespace);
438
+ }
439
+ elementStack.pop();
440
+ namespaces = namespacesStack.pop();
441
+ }
442
+ }else if (obj.kind == 'Text'){
443
+ if (elementStack.length === 0){
444
+ if (!obj.value.match(/^[\r\n\t ]*$/)){
445
+ throw new Error("Text not allowed at the document root");
446
+ }
447
+ }else{
448
+ if (this.delegate && this.delegate.xmlParserFoundText){
449
+ this.delegate.xmlParserFoundText(this, obj.value);
450
+ }
451
+ }
452
+ }else if (obj.kind == 'ElementEnd'){
453
+ element = elementStack.pop();
406
454
  namespaces = namespacesStack.pop();
407
- }
408
- }else if (obj.kind == 'Text'){
409
- if (elementNameStack.length === 0){
410
- if (!obj.value.match(/^[\r\n\t ]*$/)){
411
- throw new Error("Text not allowed at the document root");
455
+ if (element.prefix !== null){
456
+ if (obj.name != element.prefix + ":" + element.name){
457
+ throw new Error("Mismatched end tag");
458
+ }
459
+ }else{
460
+ if (obj.name != element.name){
461
+ throw new Error("Mismatched end tag");
462
+ }
412
463
  }
413
- }else{
414
- if (listener.handleText){
415
- listener.handleText(obj.value);
464
+ if (this.delegate && this.delegate.xmlParserDidEndElement){
465
+ this.delegate.xmlParserDidEndElement(this, element.name, element.prefix, element.namespace);
416
466
  }
417
467
  }
418
- }else if (obj.kind == 'ElementEnd'){
419
- var name = elementNameStack.pop();
420
- namespaces = namespacesStack.pop();
421
- if (obj.name != name){
422
- throw new Error("Mismatched end tag");
423
- }
424
- if (listener.endElement){
425
- listener.endElement();
426
- }
468
+ obj = readObject();
469
+ }
470
+ if (!this.isStopped && this.delegate.xmlParserDidEndDocument){
471
+ this.delegate.xmlParserDidEndDocument(this);
472
+ }
473
+ }catch (e){
474
+ this.isStopped = true;
475
+ if (this.delegate && this.delegate.xmlParserErrorOccurred){
476
+ this.delegate.xmlParserErrorOccurred(this, e);
477
+ }else{
478
+ throw e;
427
479
  }
428
- obj = readObject();
429
- }
430
- if (!this.isStopped && listener.endDocument){
431
- listener.endDocument();
432
480
  }
433
481
  }
434
482
 
@@ -518,4 +566,61 @@ var htmlElements = {
518
566
  raw: new Set(['script', 'style'])
519
567
  };
520
568
 
569
+ JSXMLParser.Mode = {
570
+ xml: "xml",
571
+ html: "html"
572
+ };
573
+
574
+ JSGlobalObject.JSXMLAttributeMap = function(){
575
+ if (this === undefined){
576
+ return new JSXMLAttributeMap();
577
+ }
578
+ this.namespaces = {};
579
+ this.noNamespace = {};
580
+ this.attributes = [];
581
+ };
582
+
583
+ JSXMLAttributeMap.prototype = {
584
+
585
+ namespaces: null,
586
+ noNamespace: null,
587
+ attributes: null,
588
+
589
+ add: function(attr){
590
+ this.attributes.push(attr);
591
+ var map = this.noNamespace;
592
+ if (attr.namespace){
593
+ map = this.namespaces[attr.namespace];
594
+ if (!map){
595
+ map = this.namespaces[attr.namespace] = {};
596
+ }
597
+ }
598
+ map[attr.name] = attr;
599
+ },
600
+
601
+ all: function(){
602
+ return this.attributes;
603
+ },
604
+
605
+ contains: function(name, namespace){
606
+ var map = namespace ? this.namespaces[namespace] : this.noNamespace;
607
+ if (map){
608
+ return name in map;
609
+ }
610
+ return false;
611
+ },
612
+
613
+ get: function(name, namespace){
614
+ var map = namespace ? this.namespaces[namespace] : this.noNamespace;
615
+ if (map){
616
+ var attr = map[name];
617
+ if (attr){
618
+ return attr.value;
619
+ }
620
+ }
621
+ return null;
622
+ },
623
+
624
+ };
625
+
521
626
  })();
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ImageKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.0
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.MediaKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.0
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.MediaKitUI
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.0
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.NotificationKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.0
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.PDFKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.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.QRKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.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.SearchKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.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.SecurityKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.0
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.ServerKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.0
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.ServerKitTesting
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.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.TestKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -49,7 +49,7 @@ JSClass("TKTestSuite", JSObject, {
49
49
 
50
50
  getResourceData: function(resourceName, ext, completion, target){
51
51
  var metadata = this.bundle.metadataForResourceName(resourceName, ext);
52
- this.bundle.getResourceData(metadata, completion, target);
52
+ return this.bundle.getResourceData(metadata, completion, target);
53
53
  }
54
54
 
55
55
  });
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKit
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -75,7 +75,7 @@ JSClass("UIAlertController", UIViewController, {
75
75
  this._titleLabel.maximumNumberOfLines = 2;
76
76
  this._titleLabel.textAlignment = JSTextAlignment.center;
77
77
  this._titleLabel.text = this.title;
78
- this._titleLabel.font = this._titleLabel.font.fontWithWeight(JSFont.Weight.bold);
78
+ this._titleLabel.font = this._titleLabel.font.bolderFont();
79
79
  this._primaryStackView.addSubview(this._titleLabel);
80
80
  }
81
81
  if (this.message !== null && this.message !== ''){
@@ -214,7 +214,7 @@ UIAlertController.ButtonStylers = Object.create({}, {
214
214
  configurable: true,
215
215
  get: function(){
216
216
  var styler = UIButtonDefaultStyler.init();
217
- styler.font = styler.font.fontWithPointSize(JSFont.Size.detail).fontWithWeight(JSFont.Weight.bold);
217
+ styler.font = styler.font.fontWithPointSize(JSFont.Size.detail).bolderFont();
218
218
  styler.normalTitleColor = JSColor.destructive;
219
219
  styler.activeTitleColor = JSColor.destructive.colorDarkenedByPercentage(0.2);
220
220
  styler.disabledTitleColor = JSColor.destructive.colorWithAlpha(0.5);
@@ -64,8 +64,8 @@ JSClass("UIHTMLTextLine", JSTextLine, {
64
64
  // // HTML does this for us
65
65
  // },
66
66
 
67
- truncatedLine: function(width, token){
68
- if (width + 0.1 >= this._size.width){
67
+ truncatedLine: function(width, token, force){
68
+ if (width + 0.1 >= this._size.width && force !== true){
69
69
  return this;
70
70
  }
71
71
 
@@ -119,12 +119,13 @@ JSClass("UIHTMLTextLine", JSTextLine, {
119
119
  line.size.width += tokenRun.size.width;
120
120
 
121
121
  var iterator = run.textNode.nodeValue.userPerceivedCharacterIterator(run.textNode.nodeValue.length - 1);
122
- while (iterator.character !== null && iterator.isMandatoryLineBreak){
123
- iterator.decrement();
122
+ while (iterator.firstCharacter !== null && iterator.isMandatoryLineBreak){
124
123
  run.range.length -= iterator.range.length;
125
124
  line.range.length -= iterator.range.length;
125
+ run.textNode.nodeValue = run.textNode.nodeValue.substr(0, run.textNode.nodeValue.length - iterator.range.length);
126
+ iterator.decrement();
126
127
  }
127
- while (iterator.character !== null && line.size.width > width){
128
+ while (iterator.firstCharacter !== null && line.size.width > width){
128
129
  metrics = this.canvasContext.measureText(iterator.utf16);
129
130
  run.size.width -= metrics.width;
130
131
  run.range.length -= iterator.range.length;
@@ -2421,6 +2421,9 @@ JSClass("UIListView", UIScrollView, {
2421
2421
  if (this._touch.cell){
2422
2422
  this._touch.cell.active = false;
2423
2423
  this._setSelectedIndexPaths([this._touch.cell.indexPath], {notifyDelegate: true});
2424
+ if (this.delegate && this.delegate.listViewDidFinishSelectingCellAtIndexPath){
2425
+ this.delegate.listViewDidFinishSelectingCellAtIndexPath(this, this._touch.cell.indexPath);
2426
+ }
2424
2427
  }
2425
2428
  this._touch = null;
2426
2429
  }
@@ -3135,7 +3138,7 @@ JSClass("UIListViewDefaultStyler", UIListViewStyler, {
3135
3138
  this.cellFont = JSFont.systemFontOfSize(JSFont.Size.normal);
3136
3139
  }
3137
3140
  if (this.headerFont === null){
3138
- this.headerFont = JSFont.systemFontOfSize(JSFont.Size.normal).fontWithWeight(JSFont.Weight.bold);
3141
+ this.headerFont = JSFont.systemFontOfSize(JSFont.Size.normal).bolderFont();
3139
3142
  }
3140
3143
  if (this.cellTextColor === null){
3141
3144
  this.cellTextColor = JSColor.text;
@@ -882,7 +882,7 @@ JSClass("UIMenuBarItemView", UIView, {
882
882
  if (this._titleLabel){
883
883
  var font = this._menuBar.font;
884
884
  if (this._item === this._menuBar.primaryMenuItem){
885
- font = font.fontWithWeight(JSFont.Weight.bold);
885
+ font = font.bolderFont();
886
886
  }
887
887
  this._titleLabel.font = font;
888
888
  this._titleLabel.textColor = textColor;
@@ -82,7 +82,12 @@ JSClass("UINavigationController", UIViewController, {
82
82
  viewDidLoad: function(){
83
83
  UINavigationController.$super.viewDidLoad.call(this);
84
84
  this.view.addSubview(this._navigationBar);
85
- this.view.insertSubviewBelowSibling(this.topViewController.view, this._navigationBar);
85
+ var topView = this.topViewController.view;
86
+ if (this.topViewController.navigationItem.hidesNavigationBar){
87
+ this.view.addSubview(topView);
88
+ }else{
89
+ this.view.insertSubviewBelowSibling(topView, this._navigationBar);
90
+ }
86
91
  this.view.setNeedsLayout();
87
92
  },
88
93
 
@@ -54,4 +54,12 @@ UIDesaturateEffect.definePropertiesFromExtensions({
54
54
  return "saturate(%f)".sprintf(1 - this.percentage);
55
55
  }
56
56
 
57
+ });
58
+
59
+ UIDarkenEffect.definePropertiesFromExtensions({
60
+
61
+ cssFilterString: function(){
62
+ return "brightness(%f)".sprintf(1 - this.percentage);
63
+ }
64
+
57
65
  });
@@ -118,4 +118,29 @@ JSClass("UIDesaturateEffect", UIVisualEffect, {
118
118
  return UIDesaturateEffect.initWithPercentage(0);
119
119
  }
120
120
 
121
+ });
122
+
123
+ JSClass("UIDarkenEffect", UIVisualEffect, {
124
+
125
+ percentage: 1,
126
+
127
+ initWithPercentage: function(percentage){
128
+ this.percentage = percentage;
129
+ },
130
+
131
+ initWithSpec: function(spec){
132
+ UIDesaturateEffect.$super.initWithSpec.call(this, spec);
133
+ if (spec.containsKey("percentage")){
134
+ this.percentage = spec.valueForKey("percentage", Number);
135
+ }
136
+ },
137
+
138
+ animationInterpolation: function(from, to, progress){
139
+ return UIDesaturateEffect.initWithPercentage(from.percentage + (to.percentage - from.percentage) * progress);
140
+ },
141
+
142
+ defaultAnimationValue: function(){
143
+ return UIDesaturateEffect.initWithPercentage(0);
144
+ }
145
+
121
146
  });
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKitTesting
3
- JSBundleVersion: 2023.9.0
3
+ JSBundleVersion: 2023.10.0
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": "2023.9.0",
12
+ "version": "2023.10.0",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"