@breakside/jskit 2022.25.1 → 2022.28.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/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSFileManager+HTML.js +29 -19
- package/Frameworks/Foundation.jsframework/JS/JSUserDefaults.js +2 -2
- 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/AuthKit/OAService.js +8 -0
- package/Root/Frameworks/AuthKit/Services.yaml +2 -0
- 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/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSFileManager+HTML.js +29 -19
- package/Root/Frameworks/Foundation/JSUserDefaults.js +2 -2
- 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/UICursor.js +19 -4
- package/Root/Frameworks/UIKit/UIDisplayServer.js +51 -10
- package/Root/Frameworks/UIKit/UIHTMLDisplayServerCanvasContext.js +2 -48
- package/Root/Frameworks/UIKit/UIHTMLDisplayServerContext.js +0 -6
- package/Root/Frameworks/UIKit/UIHTMLDisplayServerSVGContext.js +6 -77
- package/Root/Frameworks/UIKit/UIHTMLTextField.js +9 -3
- package/Root/Frameworks/UIKit/UIHTMLTextTypesetter.js +2 -29
- package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +6 -79
- package/Root/Frameworks/UIKit/UIKit.js +1 -0
- package/Root/Frameworks/UIKit/UILabel.js +72 -1
- package/Root/Frameworks/UIKit/UILayer.js +3 -0
- package/Root/Frameworks/UIKit/UIMouseTrackingArea.js +55 -0
- package/Root/Frameworks/UIKit/UINavigationBar.js +45 -22
- package/Root/Frameworks/UIKit/UIState.js +18 -0
- package/Root/Frameworks/UIKit/UITextEditor.js +277 -76
- package/Root/Frameworks/UIKit/UITextEditorDelegate.js +3 -1
- package/Root/Frameworks/UIKit/UITextLayer.js +1 -1
- package/Root/Frameworks/UIKit/UIView.js +129 -46
- package/Root/Frameworks/UIKit/UIViewController.js +6 -0
- package/Root/Frameworks/UIKit/UIWindow.js +89 -0
- package/Root/Frameworks/UIKit/UIWindowServer.js +20 -79
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// #import "UIResponder.js"
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
JSClass("UIMouseTrackingArea", UIResponder, {
|
|
5
|
+
|
|
6
|
+
responder: null,
|
|
7
|
+
rect: JSDynamicProperty("_rect", null),
|
|
8
|
+
trackingType: 0,
|
|
9
|
+
view: null,
|
|
10
|
+
cursor: null,
|
|
11
|
+
userInfo: null,
|
|
12
|
+
_entered: false,
|
|
13
|
+
|
|
14
|
+
initWithResponder: function(responder, rect, trackingType){
|
|
15
|
+
this.responder = responder;
|
|
16
|
+
this.rect = rect;
|
|
17
|
+
this.trackingType = trackingType;
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
setRect: function(rect){
|
|
21
|
+
this._rect = JSRect(rect);
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
containsPoint: function(location){
|
|
25
|
+
return this._rect.containsPoint(location);
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
mouseEntered: function(event){
|
|
29
|
+
if (this.cursor !== null){
|
|
30
|
+
this.cursor.set();
|
|
31
|
+
}else{
|
|
32
|
+
this.responder.mouseEntered(event);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
mouseExited: function(event){
|
|
37
|
+
if (this.cursor !== null){
|
|
38
|
+
this.cursor.unset();
|
|
39
|
+
}else{
|
|
40
|
+
this.responder.mouseExited(event);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
mouseMoved: function(event){
|
|
45
|
+
this.responder.mouseMoved(event);
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
UIMouseTrackingArea.TrackingType = {
|
|
51
|
+
none: 0,
|
|
52
|
+
move: 1,
|
|
53
|
+
enterAndExit: 2,
|
|
54
|
+
all: 3
|
|
55
|
+
};
|
|
@@ -428,6 +428,8 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
428
428
|
navigationBar.maskedBorders = UIView.Sides.maxY;
|
|
429
429
|
|
|
430
430
|
var props = navigationBar.stylerProperties;
|
|
431
|
+
props.isAnimating = false;
|
|
432
|
+
props.needsUpdate = false;
|
|
431
433
|
props.titleLabel = this.createTitleLabel();
|
|
432
434
|
props.customView = null;
|
|
433
435
|
navigationBar.addSubview(props.titleLabel);
|
|
@@ -468,6 +470,8 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
468
470
|
var removingRightBarItemViews = props.rightBarItemViews;
|
|
469
471
|
var removingTitleLabel = props.titleLabel;
|
|
470
472
|
var removingCustomView = props.customView;
|
|
473
|
+
var removingCustomViewTransform = removingCustomView ? removingCustomView.transform : JSAffineTransform.Identity;
|
|
474
|
+
var customViewTransform = JSAffineTransform.Identity;
|
|
471
475
|
var backToTitleScale = this.titleFont.displayLineHeight / this.itemFont.displayLineHeight;
|
|
472
476
|
props.titleLabel = this.createTitleLabel();
|
|
473
477
|
navigationBar.addSubview(props.titleLabel);
|
|
@@ -488,15 +492,16 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
488
492
|
props.titleLabel.alpha = 0;
|
|
489
493
|
props.titleLabel.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width, 0);
|
|
490
494
|
if (props.customView){
|
|
495
|
+
customViewTransform = props.customView.transform;
|
|
491
496
|
props.customView.alpha = 0;
|
|
492
|
-
props.customView.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width,
|
|
497
|
+
props.customView.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width + customViewTransform.tx, customViewTransform.ty);
|
|
493
498
|
}
|
|
494
499
|
props.backBarItemView.alpha = 0;
|
|
495
500
|
var backTitleFrame = props.backBarItemView.titleLabel.convertRectToView(props.backBarItemView.titleLabel.bounds, props.backBarItemView.superview);
|
|
496
501
|
if (removingCustomView){
|
|
497
|
-
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(Math.max(0, removingCustomView.
|
|
502
|
+
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(Math.max(0, removingCustomView.untransformedFrame.origin.x - backTitleFrame.origin.x), 0).scaledBy(backToTitleScale);
|
|
498
503
|
}else{
|
|
499
|
-
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(Math.max(0, removingTitleLabel.
|
|
504
|
+
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(Math.max(0, removingTitleLabel.untransformedFrame.origin.x - backTitleFrame.origin.x), 0).scaledBy(backToTitleScale);
|
|
500
505
|
}
|
|
501
506
|
animator.addAnimations(function(){
|
|
502
507
|
var i, l;
|
|
@@ -514,20 +519,20 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
514
519
|
}
|
|
515
520
|
removingBackBarItemView.alpha = 0;
|
|
516
521
|
removingTitleLabel.alpha = 0;
|
|
517
|
-
removingTitleLabel.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - removingTitleLabel.
|
|
522
|
+
removingTitleLabel.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - removingTitleLabel.untransformedFrame.origin.x), 0).scaledBy(1 / backToTitleScale);
|
|
518
523
|
if (removingCustomView){
|
|
519
524
|
removingCustomView.alpha = 0;
|
|
520
|
-
removingCustomView.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - removingCustomView.
|
|
525
|
+
removingCustomView.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - removingCustomView.untransformedFrame.origin.x) + removingCustomViewTransform.tx, removingCustomViewTransform.ty).scaledBy(1 / backToTitleScale);
|
|
521
526
|
}
|
|
522
527
|
props.titleLabel.alpha = 1;
|
|
523
528
|
props.titleLabel.transform = JSAffineTransform.Identity;
|
|
524
529
|
if (props.customView){
|
|
525
530
|
props.customView.alpha = 1;
|
|
526
|
-
props.customView.transform =
|
|
531
|
+
props.customView.transform = customViewTransform;
|
|
527
532
|
}
|
|
528
533
|
props.backBarItemView.alpha = 1;
|
|
529
534
|
props.backBarItemView.titleLabel.transform = JSAffineTransform.Identity;
|
|
530
|
-
});
|
|
535
|
+
}, this);
|
|
531
536
|
animator.addCompletion(function(){
|
|
532
537
|
var i, l;
|
|
533
538
|
for (i = 0, l = removingLeftBarItemViews.length; i < l; ++i){
|
|
@@ -540,9 +545,14 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
540
545
|
removingBackBarItemView.removeFromSuperview();
|
|
541
546
|
if (removingCustomView !== null){
|
|
542
547
|
removingCustomView.removeFromSuperview();
|
|
543
|
-
removingCustomView.transform =
|
|
548
|
+
removingCustomView.transform = removingCustomViewTransform;
|
|
544
549
|
}
|
|
545
|
-
|
|
550
|
+
props.isAnimating = false;
|
|
551
|
+
if (props.needsUpdate){
|
|
552
|
+
this.updateBar(navigationBar);
|
|
553
|
+
}
|
|
554
|
+
}, this);
|
|
555
|
+
props.isAnimating = true;
|
|
546
556
|
},
|
|
547
557
|
|
|
548
558
|
popToItem: function(navigationBar, item, animator){
|
|
@@ -553,6 +563,8 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
553
563
|
var removingRightBarItemViews = props.rightBarItemViews;
|
|
554
564
|
var removingTitleLabel = props.titleLabel;
|
|
555
565
|
var removingCustomView = props.customView;
|
|
566
|
+
var removingCustomViewTransform = removingCustomView ? removingCustomView.transform : JSAffineTransform.Identity;
|
|
567
|
+
var customViewTransform = JSAffineTransform.Identity;
|
|
556
568
|
var backToTitleScale = this.titleFont.displayLineHeight / this.itemFont.displayLineHeight;
|
|
557
569
|
props.titleLabel = this.createTitleLabel();
|
|
558
570
|
navigationBar.addSubview(props.titleLabel);
|
|
@@ -574,10 +586,11 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
574
586
|
props.backBarItemView.alpha = 0;
|
|
575
587
|
var backTitleFrame = removingBackBarItemView.titleLabel.convertRectToView(removingBackBarItemView.titleLabel.bounds, props.backBarItemView.superview);
|
|
576
588
|
if (props.customView){
|
|
577
|
-
|
|
589
|
+
customViewTransform = props.customView.transform;
|
|
590
|
+
props.customView.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - props.customView.untransformedFrame.origin.x) + customViewTransform.tx, customViewTransform.ty).scaledBy(1 / backToTitleScale);
|
|
578
591
|
props.customView.alpha = 0;
|
|
579
592
|
}else{
|
|
580
|
-
props.titleLabel.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - props.titleLabel.
|
|
593
|
+
props.titleLabel.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - props.titleLabel.untransformedFrame.origin.x), 0).scaledBy(1 / backToTitleScale);
|
|
581
594
|
}
|
|
582
595
|
animator.addAnimations(function(){
|
|
583
596
|
var i, l;
|
|
@@ -598,7 +611,7 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
598
611
|
removingTitleLabel.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width, 0);
|
|
599
612
|
if (removingCustomView){
|
|
600
613
|
removingCustomView.alpha = 0;
|
|
601
|
-
removingCustomView.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width,
|
|
614
|
+
removingCustomView.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width + removingCustomViewTransform.tx, removingCustomViewTransform.ty);
|
|
602
615
|
}
|
|
603
616
|
props.titleLabel.alpha = 1;
|
|
604
617
|
props.titleLabel.transform = JSAffineTransform.Identity;
|
|
@@ -606,9 +619,9 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
606
619
|
props.backBarItemView.titleLabel.transform = JSAffineTransform.Identity;
|
|
607
620
|
if (props.customView){
|
|
608
621
|
props.customView.alpha = 1;
|
|
609
|
-
props.customView.transform =
|
|
622
|
+
props.customView.transform = customViewTransform;
|
|
610
623
|
}
|
|
611
|
-
});
|
|
624
|
+
}, this);
|
|
612
625
|
animator.addCompletion(function(){
|
|
613
626
|
var i, l;
|
|
614
627
|
for (i = 0, l = removingLeftBarItemViews.length; i < l; ++i){
|
|
@@ -621,14 +634,24 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
621
634
|
removingBackBarItemView.removeFromSuperview();
|
|
622
635
|
if (removingCustomView !== null){
|
|
623
636
|
removingCustomView.removeFromSuperview();
|
|
624
|
-
removingCustomView.transform =
|
|
637
|
+
removingCustomView.transform = removingCustomViewTransform;
|
|
638
|
+
}
|
|
639
|
+
props.isAnimating = false;
|
|
640
|
+
if (props.needsUpdate){
|
|
641
|
+
this.updateBar(navigationBar);
|
|
625
642
|
}
|
|
626
|
-
});
|
|
643
|
+
}, this);
|
|
644
|
+
props.isAnimating = true;
|
|
627
645
|
},
|
|
628
646
|
|
|
629
647
|
updateBar: function(navigationBar){
|
|
630
648
|
var item = navigationBar.topItem;
|
|
631
649
|
var props = navigationBar.stylerProperties;
|
|
650
|
+
if (props.isAnimating){
|
|
651
|
+
props.needsUpdate = true;
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
props.needsUpdate = false;
|
|
632
655
|
|
|
633
656
|
var i, l;
|
|
634
657
|
for (i = 0, l = props.leftBarItemViews.length; i < l; ++i){
|
|
@@ -708,7 +731,7 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
708
731
|
var barItemView = props.backBarItemView;
|
|
709
732
|
var titleTextAlignment = item ? item.titleTextAlignment || this.titleTextAlignment : this.titleTextAlignment;
|
|
710
733
|
barItemView.sizeToFitSize(JSSize(xRight - xLeft, itemHeight));
|
|
711
|
-
barItemView.
|
|
734
|
+
barItemView.untransformedFrame = JSRect(JSPoint(xLeft, y + (itemHeight - barItemView.bounds.size.height) / 2), barItemView.bounds.size);
|
|
712
735
|
if (!barItemView.hidden){
|
|
713
736
|
xLeft += barItemView.bounds.size.width;
|
|
714
737
|
}else if (props.leftBarItemViews.length === 0 && titleTextAlignment === JSTextAlignment.left && this.titleInsets !== null){
|
|
@@ -717,14 +740,14 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
717
740
|
for (i = 0, l = props.leftBarItemViews.length; i < l; ++i){
|
|
718
741
|
barItemView = props.leftBarItemViews[i];
|
|
719
742
|
barItemView.sizeToFitSize(JSSize(xRight - xLeft, itemHeight));
|
|
720
|
-
barItemView.
|
|
743
|
+
barItemView.untransformedFrame = JSRect(JSPoint(xLeft, y + (itemHeight - barItemView.bounds.size.height) / 2), barItemView.bounds.size);
|
|
721
744
|
xLeft += barItemView.bounds.size.width;
|
|
722
745
|
}
|
|
723
746
|
for (i = props.rightBarItemViews.length - 1; i >= 0; --i){
|
|
724
747
|
barItemView = props.rightBarItemViews[i];
|
|
725
748
|
barItemView.sizeToFitSize(JSSize(xRight - xLeft, itemHeight));
|
|
726
749
|
xRight -= barItemView.bounds.size.width;
|
|
727
|
-
barItemView.
|
|
750
|
+
barItemView.untransformedFrame = JSRect(JSPoint(xRight, y + (itemHeight - barItemView.bounds.size.height) / 2), barItemView.bounds.size);
|
|
728
751
|
barItemView.hidden = xRight < xLeft;
|
|
729
752
|
}
|
|
730
753
|
|
|
@@ -746,11 +769,11 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
746
769
|
var centeredX = (size.width - viewSize.width) / 2;
|
|
747
770
|
var centeredY = (size.height - viewSize.height) / 2;
|
|
748
771
|
if (titleTextAlignment === JSTextAlignment.center){
|
|
749
|
-
titleView.
|
|
772
|
+
titleView.untransformedFrame = JSRect(JSPoint(Math.min(Math.max(minX, centeredX), maxX), centeredY), viewSize);
|
|
750
773
|
}else if (titleTextAlignment === JSTextAlignment.right){
|
|
751
|
-
titleView.
|
|
774
|
+
titleView.untransformedFrame = JSRect(JSPoint(maxX - viewSize.width, centeredY), viewSize);
|
|
752
775
|
}else{
|
|
753
|
-
titleView.
|
|
776
|
+
titleView.untransformedFrame = JSRect(JSPoint(minX, centeredY), viewSize);
|
|
754
777
|
}
|
|
755
778
|
}else{
|
|
756
779
|
props.titleLabel.hidden = true;
|
|
@@ -170,6 +170,24 @@ JSClass("UIState", JSObject, {
|
|
|
170
170
|
return this._path === other._path;
|
|
171
171
|
},
|
|
172
172
|
|
|
173
|
+
startsWithState: function(state){
|
|
174
|
+
if (state === null || state === undefined){
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
var a = this.pathComponents;
|
|
178
|
+
var b = state.pathComponents;
|
|
179
|
+
if (a.length < b.length){
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
var i, l;
|
|
183
|
+
for (i = 0, l = b.length; i < l; ++i){
|
|
184
|
+
if (a[i] != b[i]){
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
|
|
173
191
|
});
|
|
174
192
|
|
|
175
193
|
function componentsFromPath(path){
|