@breakside/jskit 2022.52.1 → 2022.53.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/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/Node/main.js +8 -0
- 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/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/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/UIAnimation.js +28 -0
- package/Root/Frameworks/UIKit/UIBasicAnimation.js +5 -0
- package/Root/Frameworks/UIKit/UIHTMLApplication.js +8 -0
- package/Root/Frameworks/UIKit/UIHTMLDisplayServerCanvasContext.js +13 -1
- package/Root/Frameworks/UIKit/UIKit+HTML.js +1 -0
- package/Root/Frameworks/UIKit/UIKit.js +1 -0
- package/Root/Frameworks/UIKit/UILayer.js +9 -1
- package/Root/Frameworks/UIKit/UITextEditor.js +3 -3
- package/Root/Frameworks/UIKit/UITextField.js +71 -53
- package/Root/Frameworks/UIKit/UITextLayer.js +21 -0
- package/Root/Frameworks/UIKit/UIView.js +9 -0
- package/Root/Frameworks/UIKit/UIVisualEffect+HTML.js +57 -0
- package/Root/Frameworks/UIKit/UIVisualEffect.js +121 -0
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
4
|
-
"JSBundleVersion": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.53.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "DOM+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": "
|
|
12
|
+
"GitRevision": "69175744f6dece9832105d84c318088057912bfc"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
6
|
-
"JSBundleVersion": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.53.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
11
11
|
"node": "DOM+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": "
|
|
14
|
+
"GitRevision": "69175744f6dece9832105d84c318088057912bfc"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [],
|
|
17
17
|
"ResourceLookup": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
4
|
-
"JSBundleVersion": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.53.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
8
8
|
"html": "FontKit+HTML.js"
|
|
9
9
|
},
|
|
10
10
|
"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",
|
|
11
|
-
"GitRevision": "
|
|
11
|
+
"GitRevision": "69175744f6dece9832105d84c318088057912bfc"
|
|
12
12
|
}
|
|
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.JSKit.FontKit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
6
|
-
"JSBundleVersion": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.53.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
10
10
|
"html": "FontKit+HTML.js"
|
|
11
11
|
},
|
|
12
12
|
"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",
|
|
13
|
-
"GitRevision": "
|
|
13
|
+
"GitRevision": "69175744f6dece9832105d84c318088057912bfc"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [],
|
|
16
16
|
"ResourceLookup": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.Foundation",
|
|
4
|
-
"JSBundleVersion": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.53.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "Foundation+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": "
|
|
12
|
+
"GitRevision": "69175744f6dece9832105d84c318088057912bfc"
|
|
13
13
|
}
|
|
@@ -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": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.53.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": "
|
|
14
|
+
"GitRevision": "69175744f6dece9832105d84c318088057912bfc"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [
|
|
17
17
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
|
|
4
|
-
"JSBundleVersion": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.53.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": "
|
|
12
|
+
"GitRevision": "69175744f6dece9832105d84c318088057912bfc"
|
|
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": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.53.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": "
|
|
14
|
+
"GitRevision": "69175744f6dece9832105d84c318088057912bfc"
|
|
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": "2022.
|
|
4
|
+
"JSBundleVersion": "2022.53.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": "
|
|
11
|
+
"GitRevision": "69175744f6dece9832105d84c318088057912bfc"
|
|
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": "2022.
|
|
6
|
+
"JSBundleVersion": "2022.53.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": "
|
|
13
|
+
"GitRevision": "69175744f6dece9832105d84c318088057912bfc"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [
|
|
16
16
|
{
|
package/Node/main.js
CHANGED
|
@@ -31,6 +31,14 @@ var options = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
module.exports.main = async function(){
|
|
34
|
+
let [y, w, r] = JSBundle.mainBundle.info.JSBundleVersion.split(".").map(s => parseInt(s));
|
|
35
|
+
if (w >= 53){
|
|
36
|
+
process.stderr.write("**** jskit update available ****\n");
|
|
37
|
+
process.stderr.write("but npm update won't get you there, instead use:\n");
|
|
38
|
+
process.stderr.write("$ npm uninstall -D @breakside/jskit\n");
|
|
39
|
+
process.stderr.write("$ npm install -D @breakside/jskit\n");
|
|
40
|
+
process.stderr.write("\n");
|
|
41
|
+
}
|
|
34
42
|
var args = JSArguments.initWithOptions(options);
|
|
35
43
|
var argv = process.argv.slice(1);
|
|
36
44
|
try{
|
|
@@ -104,6 +104,34 @@ UIAnimation.interpolationForValues = function(from, to){
|
|
|
104
104
|
return UIAnimation.interpolateNull;
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
UIAnimation.defaultInterpolationValueToPairWithValue = function(value){
|
|
108
|
+
if (value === null || value === undefined){
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
if (typeof(value) === 'number'){
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
if (value instanceof JSPoint){
|
|
115
|
+
return JSPoint.Zero;
|
|
116
|
+
}
|
|
117
|
+
if (value instanceof JSSize){
|
|
118
|
+
return JSSize.Zero;
|
|
119
|
+
}
|
|
120
|
+
if (value instanceof JSRect){
|
|
121
|
+
return JSRect.Zero;
|
|
122
|
+
}
|
|
123
|
+
if (value instanceof JSAffineTransform){
|
|
124
|
+
return JSAffineTransform.Zero;
|
|
125
|
+
}
|
|
126
|
+
if (value.isKindOfClass && value.isKindOfClass(JSColor)){
|
|
127
|
+
return value.colorWithAlpha(0);
|
|
128
|
+
}
|
|
129
|
+
if (value.defaultAnimationValue){
|
|
130
|
+
return value.defaultAnimationValue();
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
};
|
|
134
|
+
|
|
107
135
|
UIAnimation.interpolateNull = function(from, to, progress){
|
|
108
136
|
return from;
|
|
109
137
|
};
|
|
@@ -97,6 +97,11 @@ JSClass('UIBasicAnimation', UIPropertyAnimation, {
|
|
|
97
97
|
if (this._toValue === null){
|
|
98
98
|
this._toValue = JSResolveDottedName(this.layer.model, this.keyPath);
|
|
99
99
|
}
|
|
100
|
+
if (this._fromValue === null && this._toValue !== null){
|
|
101
|
+
this._fromValue = UIAnimation.defaultInterpolationValueToPairWithValue(this._toValue);
|
|
102
|
+
}else if (this._fromValue !== null && this._toValue === null){
|
|
103
|
+
this._toValue = UIAnimation.defaultInterpolationValueToPairWithValue(this._fromValue);
|
|
104
|
+
}
|
|
100
105
|
if ((this._fromValue instanceof JSColor) && (this._toValue instanceof JSColor)){
|
|
101
106
|
if (this._fromValue.space !== this._toValue.space || !this._fromValue.space.canMixComponents){
|
|
102
107
|
this._fromValue = this._fromValue.rgbaColor();
|
|
@@ -133,6 +133,7 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
133
133
|
this.domWindow.addEventListener("beforeunload", this);
|
|
134
134
|
this.domWindow.addEventListener("hashchange", this);
|
|
135
135
|
this.domWindow.addEventListener("popstate", this);
|
|
136
|
+
this.domWindow.addEventListener("pageshow", this);
|
|
136
137
|
},
|
|
137
138
|
|
|
138
139
|
removeEventListeners: function(){
|
|
@@ -141,6 +142,7 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
141
142
|
this.domWindow.removeEventListener("beforeunload", this);
|
|
142
143
|
this.domWindow.removeEventListener("hashchange", this);
|
|
143
144
|
this.domWindow.removeEventListener("popstate", this);
|
|
145
|
+
this.domWindow.removeEventListener("pageshow", this);
|
|
144
146
|
},
|
|
145
147
|
|
|
146
148
|
handleEvent: function(e){
|
|
@@ -236,6 +238,12 @@ JSClass("UIHTMLApplication", UIApplication, {
|
|
|
236
238
|
}
|
|
237
239
|
},
|
|
238
240
|
|
|
241
|
+
_event_pageshow: function(e){
|
|
242
|
+
if (e.persisted){
|
|
243
|
+
this.domWindow.location.reload();
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
|
|
239
247
|
_crash: function(error){
|
|
240
248
|
this.removeEventListeners();
|
|
241
249
|
if (this.delegate && this.delegate.applicationDidCrash){
|
|
@@ -54,7 +54,9 @@ JSClass("UIHTMLDisplayServerCanvasContext", UIHTMLDisplayServerContext, {
|
|
|
54
54
|
borderWidth: true,
|
|
55
55
|
borderColor: true,
|
|
56
56
|
cornerRadius: true,
|
|
57
|
-
shadow: true
|
|
57
|
+
shadow: true,
|
|
58
|
+
contentVisualEffect: true,
|
|
59
|
+
backgroundVisualEffect: true
|
|
58
60
|
};
|
|
59
61
|
this._imageElements = [];
|
|
60
62
|
this._canvasElements = [];
|
|
@@ -308,6 +310,12 @@ JSClass("UIHTMLDisplayServerCanvasContext", UIHTMLDisplayServerContext, {
|
|
|
308
310
|
this.style.backgroundImage = layer.presentation.backgroundGradient ? layer.presentation.backgroundGradient.cssString(this.bounds.size) : '';
|
|
309
311
|
},
|
|
310
312
|
|
|
313
|
+
updateHTMLProperty_backgroundVisualEffect: function(layer){
|
|
314
|
+
var value = layer.presentation.backgroundVisualEffect ? layer.presentation.backgroundVisualEffect.cssFilterString() : '';
|
|
315
|
+
this.style.backdropFilter = value;
|
|
316
|
+
this.style.webkitBackdropFilter = value;
|
|
317
|
+
},
|
|
318
|
+
|
|
311
319
|
updateHTMLProperty_borderWidth: function(layer){
|
|
312
320
|
if (layer.presentation.borderWidth){
|
|
313
321
|
var css = '';
|
|
@@ -365,6 +373,10 @@ JSClass("UIHTMLDisplayServerCanvasContext", UIHTMLDisplayServerContext, {
|
|
|
365
373
|
}
|
|
366
374
|
},
|
|
367
375
|
|
|
376
|
+
updateHTMLProperty_contentVisualEffect: function(layer){
|
|
377
|
+
this.style.filter = layer.presentation.contentVisualEffect ? layer.presentation.contentVisualEffect.cssFilterString() : '';
|
|
378
|
+
},
|
|
379
|
+
|
|
368
380
|
// --------------------------------------------------------------------
|
|
369
381
|
// MARK: - Managing Canvas Elements & Context
|
|
370
382
|
|
|
@@ -312,6 +312,12 @@ JSClass("UILayer", JSObject, {
|
|
|
312
312
|
this.didChangeProperty('shadowOffset');
|
|
313
313
|
},
|
|
314
314
|
|
|
315
|
+
// -------------------------------------------------------------------------
|
|
316
|
+
// MARK: - Visual Effects
|
|
317
|
+
|
|
318
|
+
contentVisualEffect: UILayerAnimatedProperty(),
|
|
319
|
+
backgroundVisualEffect: UILayerAnimatedProperty(),
|
|
320
|
+
|
|
315
321
|
// -------------------------------------------------------------------------
|
|
316
322
|
// MARK: - Adding and Removing Sublayers
|
|
317
323
|
|
|
@@ -818,6 +824,7 @@ UILayer.Properties = {
|
|
|
818
824
|
alpha : 1.0,
|
|
819
825
|
backgroundColor : null,
|
|
820
826
|
backgroundGradient : null,
|
|
827
|
+
backgroundVisualEffect : null,
|
|
821
828
|
borderWidth : null,
|
|
822
829
|
borderColor : null,
|
|
823
830
|
maskedBorders : UILayer.Sides.all,
|
|
@@ -825,7 +832,8 @@ UILayer.Properties = {
|
|
|
825
832
|
maskedCorners : UILayer.Corners.all,
|
|
826
833
|
shadowColor : null,
|
|
827
834
|
shadowOffset : JSPoint.Zero,
|
|
828
|
-
shadowRadius : 0.0
|
|
835
|
+
shadowRadius : 0.0,
|
|
836
|
+
contentVisualEffect : null
|
|
829
837
|
};
|
|
830
838
|
|
|
831
839
|
UILayer.Path = {
|
|
@@ -308,7 +308,7 @@ JSClass("UITextEditor", JSObject, {
|
|
|
308
308
|
useRightEdge = true;
|
|
309
309
|
}
|
|
310
310
|
var container = this.textLayoutManager.textContainerForCharacterAtIndex(index);
|
|
311
|
-
if (container === null){
|
|
311
|
+
if (container === null || container.textFrame === null){
|
|
312
312
|
return JSRect.Zero;
|
|
313
313
|
}
|
|
314
314
|
var rect = container.rectForCharacterAtIndex(index);
|
|
@@ -316,8 +316,8 @@ JSClass("UITextEditor", JSObject, {
|
|
|
316
316
|
if (useRightEdge){
|
|
317
317
|
x += rect.size.width;
|
|
318
318
|
}
|
|
319
|
-
if (x > container.size.width - this.cursorWidth){
|
|
320
|
-
x = container.size.width - this.cursorWidth;
|
|
319
|
+
if (x > container.textFrame.size.width - this.cursorWidth){
|
|
320
|
+
x = container.textFrame.size.width - this.cursorWidth;
|
|
321
321
|
}
|
|
322
322
|
if (x < 0){
|
|
323
323
|
if (useRightEdge){
|
|
@@ -239,14 +239,12 @@ JSClass("UITextField", UIControl, {
|
|
|
239
239
|
this._placeholderLabel = UILabel.init();
|
|
240
240
|
this._placeholderLabel.textAlignment = this._textLayer.textAlignment;
|
|
241
241
|
this._placeholderLabel.lineBreakMode = JSLineBreakMode.truncateTail;
|
|
242
|
-
this._placeholderLabel.maximumNumberOfLines =
|
|
242
|
+
this._placeholderLabel.maximumNumberOfLines = this._textLayer.maximumNumberOfLines;
|
|
243
243
|
this._placeholderLabel.font = this._textLayer.font;
|
|
244
244
|
this._placeholderLabel.hidden = true;
|
|
245
|
-
this._placeholderLabel.layer.widthTracksText = this._textLayer.widthTracksText;
|
|
246
|
-
this._placeholderLabel.layer.heightTracksText = true;
|
|
247
245
|
this._placeholderLabel.textColor = this._placeholderColor;
|
|
248
|
-
this.
|
|
249
|
-
this.
|
|
246
|
+
this._placeholderLabel.layer.textContainer.framesetter.typesetter.delegate = this;
|
|
247
|
+
this.insertSubviewAboveSibling(this._placeholderLabel, this._clipView);
|
|
250
248
|
},
|
|
251
249
|
|
|
252
250
|
_placeholderLabel: null,
|
|
@@ -349,10 +347,10 @@ JSClass("UITextField", UIControl, {
|
|
|
349
347
|
this._multiline = multiline;
|
|
350
348
|
this._textLayer.textLayoutManager.includeEmptyFinalLine = multiline;
|
|
351
349
|
this._textLayer.widthTracksText = !multiline;
|
|
350
|
+
this._textLayer.maximumNumberOfLines = multiline ? 0 : 1;
|
|
352
351
|
if (this._placeholderLabel !== null){
|
|
353
|
-
this._placeholderLabel.
|
|
352
|
+
this._placeholderLabel.maximumNumberOfLines = this._textLayer.maximumNumberOfLines;
|
|
354
353
|
}
|
|
355
|
-
this._textLayer.maximumNumberOfLines = multiline ? 0 : 1;
|
|
356
354
|
},
|
|
357
355
|
|
|
358
356
|
setTextInsets: function(textInsets){
|
|
@@ -633,19 +631,16 @@ JSClass("UITextField", UIControl, {
|
|
|
633
631
|
if (layer === this.layer){
|
|
634
632
|
this.layoutSubviews();
|
|
635
633
|
if (!this._multiline){
|
|
636
|
-
this._textLayer.
|
|
634
|
+
if (this._textLayer.needsLayout()){
|
|
635
|
+
this._textLayer.layoutSublayers();
|
|
636
|
+
}
|
|
637
637
|
}
|
|
638
638
|
var clipSize = this._clipView.bounds.size;
|
|
639
639
|
var textSize = this._textLayer.bounds.size;
|
|
640
640
|
if (this._multiline){
|
|
641
641
|
this._textLayer.frame = JSRect(0, 0, clipSize.width, textSize.height);
|
|
642
|
-
}else if (this._textLayer.textAlignment == JSTextAlignment.center){
|
|
643
|
-
this._textLayer.frame = JSRect(Math.max(0, (clipSize.width - textSize.width) / 2), 0, textSize.width, textSize.height);
|
|
644
|
-
}else if (this._textLayer.textAlignment == JSTextAlignment.right){
|
|
645
|
-
this._textLayer.frame = JSRect(Math.max(0, clipSize.width - textSize.width), 0, textSize.width, textSize.height);
|
|
646
|
-
}else{
|
|
647
|
-
this._textLayer.frame = JSRect(JSPoint.Zero, textSize);
|
|
648
642
|
}
|
|
643
|
+
this._adjustClipViewOrigin(this._clipView.bounds.origin);
|
|
649
644
|
}else if (layer === this._textLayer){
|
|
650
645
|
this._textLayer.layoutSublayers();
|
|
651
646
|
this._localEditor.layout();
|
|
@@ -675,29 +670,22 @@ JSClass("UITextField", UIControl, {
|
|
|
675
670
|
}
|
|
676
671
|
this._clipView.frame = this.bounds.rectWithInsets(textInsets);
|
|
677
672
|
if (this._placeholderLabel !== null){
|
|
678
|
-
|
|
679
|
-
this._placeholderLabel.layoutIfNeeded();
|
|
680
|
-
}
|
|
681
|
-
var clipSize = this._clipView.bounds.size;
|
|
682
|
-
var placeholderSize = this._placeholderLabel.bounds.size;
|
|
683
|
-
if (this._multiline){
|
|
684
|
-
this._placeholderLabel.frame = JSRect(0, 0, clipSize.width, placeholderSize.height);
|
|
685
|
-
}else if (this._placeholderLabel.textAlignment == JSTextAlignment.center){
|
|
686
|
-
this._placeholderLabel.frame = JSRect((clipSize.width - placeholderSize.width) / 2, 0, placeholderSize.width, placeholderSize.height);
|
|
687
|
-
}else if (this._placeholderLabel.textAlignment == JSTextAlignment.right){
|
|
688
|
-
this._placeholderLabel.frame = JSRect(clipSize.width - placeholderSize.width, 0, placeholderSize.width, placeholderSize.height);
|
|
689
|
-
}else{
|
|
690
|
-
this._placeholderLabel.frame = JSRect(JSPoint.Zero, placeholderSize);
|
|
691
|
-
}
|
|
673
|
+
this._placeholderLabel.frame = this._clipView.frame;
|
|
692
674
|
}
|
|
693
675
|
},
|
|
694
676
|
|
|
695
677
|
layerDidChangeSize: function(layer){
|
|
696
678
|
UITextField.$super.layerDidChangeSize.call(this, layer);
|
|
697
679
|
if (layer === this._textLayer && this._multiline){
|
|
680
|
+
var height = this._textInsets.height;
|
|
681
|
+
if (this._isShowingPlaceholder){
|
|
682
|
+
height += this._placeholderLabel.bounds.size.height;
|
|
683
|
+
}else{
|
|
684
|
+
height += this._textLayer.bounds.size.height;
|
|
685
|
+
}
|
|
698
686
|
this.layer.bounds = JSRect(this.layer.bounds.origin, JSSize(
|
|
699
687
|
this.layer.bounds.size.width,
|
|
700
|
-
Math.max(this._minimumHeight,
|
|
688
|
+
Math.max(this._minimumHeight, height)
|
|
701
689
|
));
|
|
702
690
|
this.setNeedsLayout();
|
|
703
691
|
}
|
|
@@ -705,34 +693,46 @@ JSClass("UITextField", UIControl, {
|
|
|
705
693
|
|
|
706
694
|
sizeToFitText: function(maxSize){
|
|
707
695
|
var size;
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
696
|
+
var maxTextSize = JSSize(maxSize);
|
|
697
|
+
if (maxTextSize.width < Number.MAX_VALUE){
|
|
698
|
+
maxTextSize.width -= this._textInsets.width;
|
|
699
|
+
if (this._leftAccessoryView !== null){
|
|
700
|
+
maxTextSize.width -= this._leftAccessorySize.width + this._leftAccessoryInsets.width;
|
|
701
|
+
}
|
|
702
|
+
if (this._rightAccessoryView !== null){
|
|
703
|
+
maxTextSize.width -= this._rightAccessorySize.width + this._rightAccessoryInsets.width;
|
|
711
704
|
}
|
|
705
|
+
}
|
|
706
|
+
if (maxTextSize.height < Number.MAX_VALUE){
|
|
707
|
+
maxTextSize.height -= this._textInsets.height;
|
|
708
|
+
}
|
|
709
|
+
if (this._isShowingPlaceholder){
|
|
710
|
+
this._placeholderLabel.sizeToFitSize(maxTextSize);
|
|
712
711
|
this._placeholderLabel.layoutIfNeeded();
|
|
713
712
|
size = JSSize(this._placeholderLabel.bounds.size);
|
|
714
713
|
}else{
|
|
715
714
|
if (this._multiline){
|
|
716
|
-
var maxTextSize = JSSize(maxSize);
|
|
717
|
-
if (maxTextSize.width < Number.MAX_VALUE){
|
|
718
|
-
maxTextSize.width -= this._textInsets.width;
|
|
719
|
-
}
|
|
720
|
-
if (maxTextSize.height < Number.MAX_VALUE){
|
|
721
|
-
maxTextSize.height -= this._textInsets.height;
|
|
722
|
-
}
|
|
723
715
|
this._textLayer.sizeToFitSize(maxTextSize);
|
|
724
716
|
}
|
|
725
717
|
this._textLayer.layoutIfNeeded();
|
|
726
718
|
size = JSSize(this._textLayer.bounds.size);
|
|
727
719
|
}
|
|
720
|
+
size.width = Math.ceil(size.width);
|
|
721
|
+
size.height = Math.ceil(size.height);
|
|
722
|
+
size.width += this._textInsets.width;
|
|
723
|
+
size.height += this._textInsets.height;
|
|
724
|
+
if (this._leftAccessoryView !== null){
|
|
725
|
+
size.width += this._leftAccessorySize.width + this._leftAccessoryInsets.width;
|
|
726
|
+
}
|
|
727
|
+
if (this._rightAccessoryView !== null){
|
|
728
|
+
size.width += this._rightAccessorySize.width + this._rightAccessoryInsets.width;
|
|
729
|
+
}
|
|
728
730
|
if (size.width > maxSize.width){
|
|
729
731
|
size.width = maxSize.width;
|
|
730
732
|
}
|
|
731
733
|
if (size.height > maxSize.height){
|
|
732
734
|
size.height = maxSize.height;
|
|
733
735
|
}
|
|
734
|
-
size.width += this._textInsets.width;
|
|
735
|
-
size.height += this._textInsets.height;
|
|
736
736
|
this.bounds = JSRect(JSPoint.Zero, size);
|
|
737
737
|
this.layoutIfNeeded();
|
|
738
738
|
this._adjustClipViewOrigin(this._clipView.bounds.origin);
|
|
@@ -817,6 +817,8 @@ JSClass("UITextField", UIControl, {
|
|
|
817
817
|
var cursorRect = this._clipView.layer.convertRectFromLayer(cursorRectInTextLayer, this._textLayer);
|
|
818
818
|
if ((cursorRect.origin.x < clipBounds.origin.x) || (cursorRect.origin.x + cursorRect.size.width > clipBounds.origin.x + clipBounds.size.width)){
|
|
819
819
|
this._adjustClipViewOrigin(JSPoint(cursorRect.origin.x - clipBounds.size.width / 2.0, clipBounds.origin.y));
|
|
820
|
+
}else{
|
|
821
|
+
this._adjustClipViewOrigin(this._clipView.bounds.origin);
|
|
820
822
|
}
|
|
821
823
|
},
|
|
822
824
|
|
|
@@ -832,13 +834,28 @@ JSClass("UITextField", UIControl, {
|
|
|
832
834
|
},
|
|
833
835
|
|
|
834
836
|
_adjustClipViewOrigin: function(origin){
|
|
835
|
-
var
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
837
|
+
var clipSize = this._clipView.bounds.size;
|
|
838
|
+
var textSize = this._textLayer.bounds.size;
|
|
839
|
+
var textAlignment = this._textLayer.textAlignment;
|
|
840
|
+
var over = textSize.width - clipSize.width;
|
|
841
|
+
var minX = 0;
|
|
842
|
+
if (textAlignment === JSTextAlignment.center){
|
|
843
|
+
if (over < 0){
|
|
844
|
+
minX = over / 2;
|
|
845
|
+
if (textSize.width === 0){
|
|
846
|
+
minX += Math.floor(this._localEditor.cursorWidth / 2);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}else if (textAlignment === JSTextAlignment.right){
|
|
850
|
+
if (over < 0){
|
|
851
|
+
minX = over;
|
|
852
|
+
if (textSize.width === 0){
|
|
853
|
+
minX += this._localEditor.cursorWidth;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
841
856
|
}
|
|
857
|
+
var maxX = over > 0 && !this._multiline ? over : minX;
|
|
858
|
+
origin.x = Math.max(minX, Math.min(maxX, origin.x));
|
|
842
859
|
var newBounds = JSRect(origin, this._clipView.bounds.size);
|
|
843
860
|
if (!this._clipView.bounds.isEqual(newBounds)){
|
|
844
861
|
this._clipView.bounds = newBounds;
|
|
@@ -1303,16 +1320,17 @@ JSClass("UITextFieldStyler", UIControlStyler, {
|
|
|
1303
1320
|
},
|
|
1304
1321
|
|
|
1305
1322
|
sizeControlToFitSize: function(textField, maxSize){
|
|
1323
|
+
var size = JSSize(textField.bounds.size);
|
|
1324
|
+
if (maxSize.width < Number.MAX_VALUE){
|
|
1325
|
+
size.width = maxSize.width;
|
|
1326
|
+
}
|
|
1306
1327
|
if (!textField.multiline){
|
|
1307
|
-
var size = JSSize(textField.bounds.size);
|
|
1308
|
-
if (maxSize.width < Number.MAX_VALUE){
|
|
1309
|
-
size.width = maxSize.width;
|
|
1310
|
-
}
|
|
1311
1328
|
size.height = textField.intrinsicSize.height;
|
|
1312
|
-
textField.bounds = JSRect(JSPoint.Zero, size);
|
|
1313
1329
|
}else{
|
|
1314
|
-
|
|
1330
|
+
textField.sizeToFitText(JSSize(size.width, maxSize.height));
|
|
1331
|
+
size.height = textField.bounds.size.height;
|
|
1315
1332
|
}
|
|
1333
|
+
textField.bounds = JSRect(JSPoint.Zero, size);
|
|
1316
1334
|
}
|
|
1317
1335
|
|
|
1318
1336
|
});
|
|
@@ -201,6 +201,8 @@ JSClass("UITextLayer", UILayer, {
|
|
|
201
201
|
this._displayQueued = false;
|
|
202
202
|
},
|
|
203
203
|
|
|
204
|
+
integerSizeRequired: false,
|
|
205
|
+
|
|
204
206
|
sizeToFitSize: function(maxSize){
|
|
205
207
|
var size = JSSize(maxSize);
|
|
206
208
|
if (size.width < Number.MAX_VALUE){
|
|
@@ -215,6 +217,10 @@ JSClass("UITextLayer", UILayer, {
|
|
|
215
217
|
size = JSSize(this._textContainer.textFrame.usedSize);
|
|
216
218
|
size.width += this._textInsets.width;
|
|
217
219
|
size.height += this._textInsets.height;
|
|
220
|
+
if (this.integerSizeRequired){
|
|
221
|
+
size.width = Math.ceil(size.width);
|
|
222
|
+
size.height = Math.ceil(size.height);
|
|
223
|
+
}
|
|
218
224
|
this.bounds = JSRect(JSPoint.Zero, size);
|
|
219
225
|
this._textContainer.size = this._availableTextSize();
|
|
220
226
|
}
|
|
@@ -234,8 +240,23 @@ JSClass("UITextLayer", UILayer, {
|
|
|
234
240
|
if (this._heightTracksText){
|
|
235
241
|
height = this._textContainer.textFrame.size.height + this._textInsets.top + this._textInsets.bottom;
|
|
236
242
|
}
|
|
243
|
+
if (this.integerSizeRequired){
|
|
244
|
+
width = Math.ceil(width);
|
|
245
|
+
height = Math.ceil(height);
|
|
246
|
+
}
|
|
247
|
+
this.ignoreSetNeedsLayout = true;
|
|
237
248
|
this.bounds = JSRect(0, 0, width, height);
|
|
249
|
+
this.ignoreSetNeedsLayout = false;
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
ignoreSetNeedsLayout: false,
|
|
254
|
+
|
|
255
|
+
setNeedsLayout: function(){
|
|
256
|
+
if (this.ignoreSetNeedsLayout){
|
|
257
|
+
return;
|
|
238
258
|
}
|
|
259
|
+
UITextLayer.$super.setNeedsLayout.call(this);
|
|
239
260
|
},
|
|
240
261
|
|
|
241
262
|
firstBaselineOffsetFromTop: JSReadOnlyProperty(),
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
// #import "UICursor.js"
|
|
24
24
|
// #import "UIAccessibility.js"
|
|
25
25
|
// #import "UIMouseTrackingArea.js"
|
|
26
|
+
// #import "UIVisualEffect.js"
|
|
26
27
|
'use strict';
|
|
27
28
|
|
|
28
29
|
JSGlobalObject.UIViewLayerProperty = function(){
|
|
@@ -74,6 +75,9 @@ JSClass('UIView', UIResponder, {
|
|
|
74
75
|
if (spec.containsKey("backgroundGradient")){
|
|
75
76
|
this.backgroundGradient = spec.valueForKey("backgroundGradient", JSGradient);
|
|
76
77
|
}
|
|
78
|
+
if (spec.containsKey("backgroundVisualEffect")){
|
|
79
|
+
this.backgroundVisualEffect = spec.valueForKey("backgroundVisualEffect", UIVisualEffect);
|
|
80
|
+
}
|
|
77
81
|
if (spec.containsKey("borderColor")){
|
|
78
82
|
this.borderColor = spec.valueForKey("borderColor", JSColor);
|
|
79
83
|
}
|
|
@@ -89,6 +93,9 @@ JSClass('UIView', UIResponder, {
|
|
|
89
93
|
if (spec.containsKey("shadowOffset")){
|
|
90
94
|
this.shadowOffset = spec.valueForKey("shadowOffset", JSPoint);
|
|
91
95
|
}
|
|
96
|
+
if (spec.containsKey("contentVisualEffect")){
|
|
97
|
+
this.contentVisualEffect = spec.valueForKey("contentVisualEffect", UIVisualEffect);
|
|
98
|
+
}
|
|
92
99
|
if (spec.containsKey("maskedBorders")){
|
|
93
100
|
this.maskedBorders = spec.valueForKey("maskedBorders", UIView.Sides);
|
|
94
101
|
}
|
|
@@ -176,6 +183,7 @@ JSClass('UIView', UIResponder, {
|
|
|
176
183
|
alpha: UIViewLayerProperty(),
|
|
177
184
|
backgroundColor: UIViewLayerProperty(),
|
|
178
185
|
backgroundGradient: UIViewLayerProperty(),
|
|
186
|
+
backgroundVisualEffect: UIViewLayerProperty(),
|
|
179
187
|
borderWidth: UIViewLayerProperty(),
|
|
180
188
|
borderColor: UIViewLayerProperty(),
|
|
181
189
|
maskedBorders: UIViewLayerProperty(),
|
|
@@ -184,6 +192,7 @@ JSClass('UIView', UIResponder, {
|
|
|
184
192
|
shadowColor: UIViewLayerProperty(),
|
|
185
193
|
shadowOffset: UIViewLayerProperty(),
|
|
186
194
|
shadowRadius: UIViewLayerProperty(),
|
|
195
|
+
contentVisualEffect: UIViewLayerProperty(),
|
|
187
196
|
cursor: JSDynamicProperty(),
|
|
188
197
|
tooltip: null,
|
|
189
198
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Copyright 2023 Breakside Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Breakside Public License, Version 1.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// If a copy of the License was not distributed with this file, you may
|
|
6
|
+
// obtain a copy at
|
|
7
|
+
//
|
|
8
|
+
// http://breakside.io/licenses/LICENSE-1.0.txt
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
16
|
+
// #import "UIVisualEffect.js"
|
|
17
|
+
"use strict";
|
|
18
|
+
|
|
19
|
+
UIVisualEffect.definePropertiesFromExtensions({
|
|
20
|
+
|
|
21
|
+
cssFilterString: function(){
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
UIBlurEffect.definePropertiesFromExtensions({
|
|
28
|
+
|
|
29
|
+
cssFilterString: function(){
|
|
30
|
+
return "blur(%fpx)".sprintf(this.radius);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
UIGrayscaleEffect.definePropertiesFromExtensions({
|
|
36
|
+
|
|
37
|
+
cssFilterString: function(){
|
|
38
|
+
return "grayscale(%f)".sprintf(this.percentage);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
UISepiaEffect.definePropertiesFromExtensions({
|
|
44
|
+
|
|
45
|
+
cssFilterString: function(){
|
|
46
|
+
return "sepia(%f)".sprintf(this.percentage);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
UIDesaturateEffect.definePropertiesFromExtensions({
|
|
52
|
+
|
|
53
|
+
cssFilterString: function(){
|
|
54
|
+
return "saturate(%f)".sprintf(1 - this.percentage);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// Copyright 2023 Breakside Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Breakside Public License, Version 1.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// If a copy of the License was not distributed with this file, you may
|
|
6
|
+
// obtain a copy at
|
|
7
|
+
//
|
|
8
|
+
// http://breakside.io/licenses/LICENSE-1.0.txt
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
16
|
+
// #import Foundation
|
|
17
|
+
"use strict";
|
|
18
|
+
|
|
19
|
+
JSClass("UIVisualEffect", JSObject, {
|
|
20
|
+
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
JSClass("UIBlurEffect", UIVisualEffect, {
|
|
24
|
+
|
|
25
|
+
radius: 10,
|
|
26
|
+
|
|
27
|
+
initWithRadius: function(radius){
|
|
28
|
+
this.radius = radius;
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
initWithSpec: function(spec){
|
|
32
|
+
UIBlurEffect.$super.initWithSpec.call(this, spec);
|
|
33
|
+
if (spec.containsKey("radius")){
|
|
34
|
+
this.radius = spec.valueForKey("radius", Number);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
animationInterpolation: function(from, to, progress){
|
|
39
|
+
return UIBlurEffect.initWithRadius(from.radius + (to.radius - from.radius) * progress);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
defaultAnimationValue: function(){
|
|
43
|
+
return UIBlurEffect.initWithRadius(0);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
JSClass("UIGrayscaleEffect", UIVisualEffect, {
|
|
49
|
+
|
|
50
|
+
percentage: 1,
|
|
51
|
+
|
|
52
|
+
initWithPercentage: function(percentage){
|
|
53
|
+
this.percentage = percentage;
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
initWithSpec: function(spec){
|
|
57
|
+
UIGrayscaleEffect.$super.initWithSpec.call(this, spec);
|
|
58
|
+
if (spec.containsKey("percentage")){
|
|
59
|
+
this.percentage = spec.valueForKey("percentage", Number);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
animationInterpolation: function(from, to, progress){
|
|
64
|
+
return UIGrayscaleEffect.initWithPercentage(from.percentage + (to.percentage - from.percentage) * progress);
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
defaultAnimationValue: function(){
|
|
68
|
+
return UIGrayscaleEffect.initWithPercentage(0);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
JSClass("UISepiaEffect", UIVisualEffect, {
|
|
74
|
+
|
|
75
|
+
percentage: 1,
|
|
76
|
+
|
|
77
|
+
initWithPercentage: function(percentage){
|
|
78
|
+
this.percentage = percentage;
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
initWithSpec: function(spec){
|
|
82
|
+
UISepiaEffect.$super.initWithSpec.call(this, spec);
|
|
83
|
+
if (spec.containsKey("percentage")){
|
|
84
|
+
this.percentage = spec.valueForKey("percentage", Number);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
animationInterpolation: function(from, to, progress){
|
|
89
|
+
return UISepiaEffect.initWithPercentage(from.percentage + (to.percentage - from.percentage) * progress);
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
defaultAnimationValue: function(){
|
|
93
|
+
return UISepiaEffect.initWithPercentage(0);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
JSClass("UIDesaturateEffect", UIVisualEffect, {
|
|
99
|
+
|
|
100
|
+
percentage: 1,
|
|
101
|
+
|
|
102
|
+
initWithPercentage: function(percentage){
|
|
103
|
+
this.percentage = percentage;
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
initWithSpec: function(spec){
|
|
107
|
+
UIDesaturateEffect.$super.initWithSpec.call(this, spec);
|
|
108
|
+
if (spec.containsKey("percentage")){
|
|
109
|
+
this.percentage = spec.valueForKey("percentage", Number);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
animationInterpolation: function(from, to, progress){
|
|
114
|
+
return UIDesaturateEffect.initWithPercentage(from.percentage + (to.percentage - from.percentage) * progress);
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
defaultAnimationValue: function(){
|
|
118
|
+
return UIDesaturateEffect.initWithPercentage(0);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
});
|