@breakside/jskit 2022.11.0 → 2022.22.1
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/JSEnvironment.js +5 -0
- package/Frameworks/Foundation.jsframework/JS/JSSynchronizer.js +1 -0
- package/Frameworks/Foundation.jsframework/JS/JSUserDefaults.js +14 -1
- 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/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/JSEnvironment.js +5 -0
- package/Root/Frameworks/Foundation/JSSynchronizer.js +1 -0
- package/Root/Frameworks/Foundation/JSUserDefaults.js +14 -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/UICollectionReusableView.js +1 -1
- package/Root/Frameworks/UIKit/UICollectionView.js +99 -4
- package/Root/Frameworks/UIKit/UICollectionViewCell.js +11 -1
- package/Root/Frameworks/UIKit/UICollectionViewLayout.js +1 -1
- package/Root/Frameworks/UIKit/UIColorPanel.js +4 -1
- package/Root/Frameworks/UIKit/UIContainerView.js +1 -1
- package/Root/Frameworks/UIKit/UIDraggingSession.js +7 -0
- package/Root/Frameworks/UIKit/UIHTMLTextField.js +3 -1
- package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +13 -1
- package/Root/Frameworks/UIKit/UIImageView.js +4 -0
- package/Root/Frameworks/UIKit/UIMenu.js +12 -5
- package/Root/Frameworks/UIKit/UIMenuItem.js +6 -0
- package/Root/Frameworks/UIKit/UIMenuView.js +12 -1
- package/Root/Frameworks/UIKit/UIPressGestureRecognizer.js +13 -2
- package/Root/Frameworks/UIKit/UISlider.js +9 -0
- package/Root/Frameworks/UIKit/UIStackView.js +16 -0
- package/Root/Frameworks/UIKit/UITextField.js +2 -0
- package/Root/Frameworks/UIKit/UIView.js +1 -1
- package/Root/Frameworks/UIKit/UIWindow.js +32 -1
- package/Root/Frameworks/UIKit/UIWindowServer.js +3 -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.22.1",
|
|
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": "5fd19ed5f4d9bc2a74be2eef1e45ad5c0de02cc9"
|
|
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.22.1",
|
|
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": "5fd19ed5f4d9bc2a74be2eef1e45ad5c0de02cc9"
|
|
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.22.1",
|
|
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": "5fd19ed5f4d9bc2a74be2eef1e45ad5c0de02cc9"
|
|
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.22.1",
|
|
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": "5fd19ed5f4d9bc2a74be2eef1e45ad5c0de02cc9"
|
|
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.22.1",
|
|
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": "5fd19ed5f4d9bc2a74be2eef1e45ad5c0de02cc9"
|
|
13
13
|
}
|
|
@@ -112,6 +112,11 @@ JSClass("JSEnvironment", JSObject, {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
return null;
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
booleanForName: function(name){
|
|
118
|
+
var stringValue = this.stringForName(name);
|
|
119
|
+
return (stringValue === 'true' || stringValue === '1' || stringValue === 'yes' || stringValue === 'on');
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
});
|
|
@@ -125,11 +125,19 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
125
125
|
this._definePropertyForKey(key);
|
|
126
126
|
},
|
|
127
127
|
|
|
128
|
+
deleteValueForKey: function(key){
|
|
129
|
+
if (this._values === null){
|
|
130
|
+
throw new Error("JSUserDefaults is closed, cannot set value. Be sure to call open() first.");
|
|
131
|
+
}
|
|
132
|
+
delete this._values[key];
|
|
133
|
+
this._persistAfterDelay();
|
|
134
|
+
},
|
|
135
|
+
|
|
128
136
|
// MARK: - Register defaults
|
|
129
137
|
|
|
130
138
|
registerDefaults: function(defaults){
|
|
131
|
-
this._defaults = defaults;
|
|
132
139
|
for (var key in defaults){
|
|
140
|
+
this._defaults[key] = defaults[key];
|
|
133
141
|
this._definePropertyForKey(key);
|
|
134
142
|
}
|
|
135
143
|
},
|
|
@@ -141,12 +149,17 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
141
149
|
return this.valueForKey(key);
|
|
142
150
|
},
|
|
143
151
|
set: function JSUserDefaults_setValue(value){
|
|
152
|
+
this.willChangeValueForKey(key);
|
|
144
153
|
this.setValueForKey(value, key);
|
|
154
|
+
this.didChangeValueForKey(key);
|
|
145
155
|
}
|
|
146
156
|
});
|
|
147
157
|
}
|
|
148
158
|
},
|
|
149
159
|
|
|
160
|
+
defineObservablePropertyForKey: function(){
|
|
161
|
+
},
|
|
162
|
+
|
|
150
163
|
// MARK: - Saving to Persistent Storage
|
|
151
164
|
|
|
152
165
|
_persistScheduled: false,
|
|
@@ -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.22.1",
|
|
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": "5fd19ed5f4d9bc2a74be2eef1e45ad5c0de02cc9"
|
|
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.22.1",
|
|
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": "5fd19ed5f4d9bc2a74be2eef1e45ad5c0de02cc9"
|
|
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.22.1",
|
|
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": "5fd19ed5f4d9bc2a74be2eef1e45ad5c0de02cc9"
|
|
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.22.1",
|
|
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": "5fd19ed5f4d9bc2a74be2eef1e45ad5c0de02cc9"
|
|
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.22.1",
|
|
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": "5fd19ed5f4d9bc2a74be2eef1e45ad5c0de02cc9"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [
|
|
16
16
|
{
|
|
@@ -112,6 +112,11 @@ JSClass("JSEnvironment", JSObject, {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
return null;
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
booleanForName: function(name){
|
|
118
|
+
var stringValue = this.stringForName(name);
|
|
119
|
+
return (stringValue === 'true' || stringValue === '1' || stringValue === 'yes' || stringValue === 'on');
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
});
|
|
@@ -125,11 +125,19 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
125
125
|
this._definePropertyForKey(key);
|
|
126
126
|
},
|
|
127
127
|
|
|
128
|
+
deleteValueForKey: function(key){
|
|
129
|
+
if (this._values === null){
|
|
130
|
+
throw new Error("JSUserDefaults is closed, cannot set value. Be sure to call open() first.");
|
|
131
|
+
}
|
|
132
|
+
delete this._values[key];
|
|
133
|
+
this._persistAfterDelay();
|
|
134
|
+
},
|
|
135
|
+
|
|
128
136
|
// MARK: - Register defaults
|
|
129
137
|
|
|
130
138
|
registerDefaults: function(defaults){
|
|
131
|
-
this._defaults = defaults;
|
|
132
139
|
for (var key in defaults){
|
|
140
|
+
this._defaults[key] = defaults[key];
|
|
133
141
|
this._definePropertyForKey(key);
|
|
134
142
|
}
|
|
135
143
|
},
|
|
@@ -141,12 +149,17 @@ JSClass("JSUserDefaults", JSObject, {
|
|
|
141
149
|
return this.valueForKey(key);
|
|
142
150
|
},
|
|
143
151
|
set: function JSUserDefaults_setValue(value){
|
|
152
|
+
this.willChangeValueForKey(key);
|
|
144
153
|
this.setValueForKey(value, key);
|
|
154
|
+
this.didChangeValueForKey(key);
|
|
145
155
|
}
|
|
146
156
|
});
|
|
147
157
|
}
|
|
148
158
|
},
|
|
149
159
|
|
|
160
|
+
defineObservablePropertyForKey: function(){
|
|
161
|
+
},
|
|
162
|
+
|
|
150
163
|
// MARK: - Saving to Persistent Storage
|
|
151
164
|
|
|
152
165
|
_persistScheduled: false,
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
// #import "UIScrollView.js"
|
|
18
18
|
// #import "UIPlatform.js"
|
|
19
19
|
// #import "UICollectionViewLayout.js"
|
|
20
|
+
// #import "UIPressGestureRecognizer.js"
|
|
20
21
|
"use strict";
|
|
21
22
|
|
|
22
23
|
(function(){
|
|
@@ -36,7 +37,13 @@ JSProtocol("UICollectionViewDelegate", JSProtocol, {
|
|
|
36
37
|
// Dragging cells
|
|
37
38
|
collectionViewShouldDragCellAtIndexPath: function(collectionView, indexPath){},
|
|
38
39
|
pasteboardItemsForCollectionViewAtIndexPath: function(collectionView, indexPath){},
|
|
39
|
-
collectionViewWillBeginDraggingSession: function(collectionView, session){}
|
|
40
|
+
collectionViewWillBeginDraggingSession: function(collectionView, session, indexPath, location){},
|
|
41
|
+
|
|
42
|
+
// Dragging destination
|
|
43
|
+
collectionViewDraggingSessionDidEnter: function(collectionView, session){},
|
|
44
|
+
collectionViewDraggingSessionDidUpdate: function(collectionView, session, indexPath){},
|
|
45
|
+
collectionViewDraggingSessionDidExit: function(collectionView, session){},
|
|
46
|
+
collectionViewPerformDragOperation: function(collectionView, session, operation, indexPath){}
|
|
40
47
|
|
|
41
48
|
});
|
|
42
49
|
|
|
@@ -346,6 +353,9 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
346
353
|
deleteCellsAtIndexPaths: function(indexPaths, animation){
|
|
347
354
|
// TODO:
|
|
348
355
|
this.reloadData();
|
|
356
|
+
if (this.selectedIndexPaths.length > 0){
|
|
357
|
+
this._setSelectedIndexPaths([], {notifyDelegate: true});
|
|
358
|
+
}
|
|
349
359
|
},
|
|
350
360
|
|
|
351
361
|
insertSection: function(section, animation){
|
|
@@ -364,6 +374,9 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
364
374
|
deleteSections: function(sections, animation){
|
|
365
375
|
// TODO:
|
|
366
376
|
this.reloadData();
|
|
377
|
+
if (this.selectedIndexPaths.length > 0){
|
|
378
|
+
this._setSelectedIndexPaths([], {notifyDelegate: true});
|
|
379
|
+
}
|
|
367
380
|
},
|
|
368
381
|
|
|
369
382
|
// -------------------------------------------------------------------------
|
|
@@ -814,6 +827,10 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
814
827
|
if (cell === null){
|
|
815
828
|
return;
|
|
816
829
|
}
|
|
830
|
+
this._contextSelectCell(cell, location);
|
|
831
|
+
},
|
|
832
|
+
|
|
833
|
+
_contextSelectCell: function(cell, location){
|
|
817
834
|
if (this.delegate && this.delegate.menuForCollectionViewCellAtIndexPath){
|
|
818
835
|
var contextSelectedIndexPaths;
|
|
819
836
|
if (this._selectionContainsIndexPath(cell.indexPath)){
|
|
@@ -837,11 +854,13 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
837
854
|
this._updateVisibleCellStates();
|
|
838
855
|
},
|
|
839
856
|
|
|
857
|
+
|
|
840
858
|
mouseDragged: function(event){
|
|
841
859
|
var location = event.locationInView(this);
|
|
842
860
|
var cell = this._cellHitTest(location);
|
|
843
861
|
if (this._shouldDrag){
|
|
844
862
|
var dragItems = [];
|
|
863
|
+
var indexPaths = [];
|
|
845
864
|
if (cell !== null){
|
|
846
865
|
var cellItems = [];
|
|
847
866
|
if (this.allowsMultipleSelection && this._selectionContainsIndexPath(cell.indexPath)){
|
|
@@ -853,6 +872,7 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
853
872
|
if (cellItems !== null){
|
|
854
873
|
dragItems = dragItems.concat(cellItems);
|
|
855
874
|
}
|
|
875
|
+
indexPaths.push(indexPath);
|
|
856
876
|
}
|
|
857
877
|
}
|
|
858
878
|
}else{
|
|
@@ -861,13 +881,14 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
861
881
|
if (cellItems !== null){
|
|
862
882
|
dragItems = cellItems;
|
|
863
883
|
}
|
|
884
|
+
indexPaths.push(cell.indexPath);
|
|
864
885
|
}
|
|
865
886
|
}
|
|
866
887
|
}
|
|
867
888
|
if (dragItems.length > 0){
|
|
868
889
|
var session = this.beginDraggingSessionWithItems(dragItems, event);
|
|
869
890
|
if (this.delegate && this.delegate.collectionViewWillBeginDraggingSession){
|
|
870
|
-
this.delegate.collectionViewWillBeginDraggingSession(this, session);
|
|
891
|
+
this.delegate.collectionViewWillBeginDraggingSession(this, session, indexPaths, location);
|
|
871
892
|
}
|
|
872
893
|
}
|
|
873
894
|
}else{
|
|
@@ -955,7 +976,7 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
955
976
|
this._touch = null;
|
|
956
977
|
},
|
|
957
978
|
|
|
958
|
-
_makeTouchActiveCell: function(touch){
|
|
979
|
+
_makeTouchActiveCell: function(touch, waitForLongPress){
|
|
959
980
|
var location = touch.locationInView(this);
|
|
960
981
|
var cell = this._cellHitTest(location);
|
|
961
982
|
if (cell === null){
|
|
@@ -967,6 +988,19 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
967
988
|
}
|
|
968
989
|
cell.active = true;
|
|
969
990
|
this._touch.cell = cell;
|
|
991
|
+
if (waitForLongPress){
|
|
992
|
+
this._touch.timer = JSTimer.scheduledTimerWithInterval(UIPressGestureRecognizer.PressInterval.long, function(){
|
|
993
|
+
this._touch.timer = null;
|
|
994
|
+
this._longPressCell(location);
|
|
995
|
+
}, this);
|
|
996
|
+
}
|
|
997
|
+
},
|
|
998
|
+
|
|
999
|
+
_longPressCell: function(location){
|
|
1000
|
+
var cell = this._touch.cell;
|
|
1001
|
+
var indexPath = cell.indexPath;
|
|
1002
|
+
this._cancelTouchSelection();
|
|
1003
|
+
this._contextSelectCell(cell, location);
|
|
970
1004
|
},
|
|
971
1005
|
|
|
972
1006
|
touchesBegan: function(touches, event){
|
|
@@ -979,7 +1013,7 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
979
1013
|
cell: null,
|
|
980
1014
|
timer: JSTimer.scheduledTimerWithInterval(0.05, function(){
|
|
981
1015
|
this._touch.timer = null;
|
|
982
|
-
this._makeTouchActiveCell(touches[0]);
|
|
1016
|
+
this._makeTouchActiveCell(touches[0], true);
|
|
983
1017
|
}, this)
|
|
984
1018
|
};
|
|
985
1019
|
},
|
|
@@ -1018,6 +1052,66 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
1018
1052
|
this._cancelTouchSelection();
|
|
1019
1053
|
},
|
|
1020
1054
|
|
|
1055
|
+
// ----------------------------------------------------------------------
|
|
1056
|
+
// MARK: - Drag Destination
|
|
1057
|
+
|
|
1058
|
+
draggingEntered: function(session){
|
|
1059
|
+
if (this.delegate && this.delegate.collectionViewDraggingSessionDidEnter){
|
|
1060
|
+
this.delegate.collectionViewDraggingSessionDidEnter(this, session);
|
|
1061
|
+
}
|
|
1062
|
+
return UIDragOperation.none;
|
|
1063
|
+
},
|
|
1064
|
+
|
|
1065
|
+
draggingUpdated: function(session){
|
|
1066
|
+
var location = this.convertPointFromScreen(session.screenLocation);
|
|
1067
|
+
var indexPath = null;
|
|
1068
|
+
var cell = this._cellHitTest(location);
|
|
1069
|
+
if (cell !== null){
|
|
1070
|
+
indexPath = cell.indexPath;
|
|
1071
|
+
}
|
|
1072
|
+
var operation = UIDragOperation.none;
|
|
1073
|
+
if (this.delegate && this.delegate.collectionViewDraggingSessionDidUpdate){
|
|
1074
|
+
operation = this.delegate.collectionViewDraggingSessionDidUpdate(this, session, indexPath);
|
|
1075
|
+
}
|
|
1076
|
+
if (operation === UIDragOperation.none){
|
|
1077
|
+
this._updateDropTarget(null);
|
|
1078
|
+
}else{
|
|
1079
|
+
this._updateDropTarget(cell);
|
|
1080
|
+
}
|
|
1081
|
+
return operation;
|
|
1082
|
+
},
|
|
1083
|
+
|
|
1084
|
+
draggingExited: function(session){
|
|
1085
|
+
this._updateDropTarget(null);
|
|
1086
|
+
if (this.delegate && this.delegate.collectionViewDraggingSessionDidExit){
|
|
1087
|
+
this.delegate.collectionViewDraggingSessionDidExit(this, session);
|
|
1088
|
+
}
|
|
1089
|
+
},
|
|
1090
|
+
|
|
1091
|
+
performDragOperation: function(session, operation){
|
|
1092
|
+
var location = this.convertPointFromScreen(session.screenLocation);
|
|
1093
|
+
var cell = this._cellHitTest(location);
|
|
1094
|
+
var indexPath = null;
|
|
1095
|
+
if (cell !== null){
|
|
1096
|
+
indexPath = cell.indexPath;
|
|
1097
|
+
}
|
|
1098
|
+
this._updateDropTarget(null);
|
|
1099
|
+
if (this.delegate && this.delegate.collectionViewPerformDragOperation){
|
|
1100
|
+
this.delegate.collectionViewPerformDragOperation(this, session, operation, indexPath);
|
|
1101
|
+
}
|
|
1102
|
+
},
|
|
1103
|
+
|
|
1104
|
+
_updateDropTarget: function(cell){
|
|
1105
|
+
var i, l;
|
|
1106
|
+
var item;
|
|
1107
|
+
for (i = 0, l = this._visibleElements.length; i < l; ++i){
|
|
1108
|
+
item = this._visibleElements[i];
|
|
1109
|
+
if (item.attributes.elementCategory === UICollectionView.ElementCategory.cell){
|
|
1110
|
+
item.view.dropTarget = item.view === cell;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
},
|
|
1114
|
+
|
|
1021
1115
|
// --------------------------------------------------------------------
|
|
1022
1116
|
// MARK: - Finding Cells by Location
|
|
1023
1117
|
|
|
@@ -1117,6 +1211,7 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
1117
1211
|
// MARK: - Scrolling
|
|
1118
1212
|
|
|
1119
1213
|
scrollToCellAtIndexPath: function(indexPath, position){
|
|
1214
|
+
this.layoutIfNeeded();
|
|
1120
1215
|
if (position === undefined){
|
|
1121
1216
|
position = UICollectionView.ScrollPosition.auto;
|
|
1122
1217
|
}
|
|
@@ -36,6 +36,7 @@ JSClass("UICollectionViewCell", UICollectionReusableView, {
|
|
|
36
36
|
active: JSDynamicProperty(null, null, 'isActive'),
|
|
37
37
|
selected: JSDynamicProperty(null, null, 'isSelected'),
|
|
38
38
|
contextSelected: JSDynamicProperty(null, null, 'isContextSelected'),
|
|
39
|
+
dropTarget: JSDynamicProperty(null, null, 'isDropTarget'),
|
|
39
40
|
|
|
40
41
|
_updateState: function(newState){
|
|
41
42
|
if (newState != this._state){
|
|
@@ -94,6 +95,14 @@ JSClass("UICollectionViewCell", UICollectionReusableView, {
|
|
|
94
95
|
this._toggleState(UICollectionViewCell.State.contextSelected, isContextSelected);
|
|
95
96
|
},
|
|
96
97
|
|
|
98
|
+
isDropTarget: function(){
|
|
99
|
+
return (this._state & UICollectionViewCell.State.dropTarget) === UICollectionViewCell.State.dropTarget;
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
setDropTarget: function(isDropTarget){
|
|
103
|
+
this._toggleState(UICollectionViewCell.State.dropTarget, isDropTarget);
|
|
104
|
+
},
|
|
105
|
+
|
|
97
106
|
// --------------------------------------------------------------------
|
|
98
107
|
// MARK: - Accessibility
|
|
99
108
|
|
|
@@ -117,5 +126,6 @@ UICollectionViewCell.State = {
|
|
|
117
126
|
active: 1 << 1,
|
|
118
127
|
selected: 1 << 2,
|
|
119
128
|
contextSelected: 1 << 3,
|
|
120
|
-
|
|
129
|
+
dropTarget: 1 << 4,
|
|
130
|
+
firstUserState: 1 << 5
|
|
121
131
|
};
|
|
@@ -35,7 +35,7 @@ JSClass("UICollectionViewLayout", JSObject, {
|
|
|
35
35
|
layoutAttributesForCellAtIndexPath: function(indexPath){
|
|
36
36
|
},
|
|
37
37
|
|
|
38
|
-
layoutAttributesForSupplimentaryViewAtIndexPath: function(indexPath){
|
|
38
|
+
layoutAttributesForSupplimentaryViewAtIndexPath: function(indexPath, kind){
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
shouldInvalidateLayoutForBounds: function(bounds){
|
|
@@ -257,7 +257,9 @@ JSClass("UIColorPanelViewController", UIViewController, {
|
|
|
257
257
|
|
|
258
258
|
viewDidAppear: function(animated){
|
|
259
259
|
UIColorPanelViewController.$super.viewDidAppear.call(this, animated);
|
|
260
|
-
|
|
260
|
+
if (UIDevice.shared !== null && UIDevice.shared.primaryPointerType !== UIUserInterface.PointerType.touch){
|
|
261
|
+
this.view.window.firstResponder = this.hexField;
|
|
262
|
+
}
|
|
261
263
|
},
|
|
262
264
|
|
|
263
265
|
viewWillDisappear: function(animated){
|
|
@@ -656,6 +658,7 @@ JSClass("UIColorPanelViewController", UIViewController, {
|
|
|
656
658
|
componentFieldSpacing: 4,
|
|
657
659
|
|
|
658
660
|
contentSizeThatFitsSize: function(maxSize){
|
|
661
|
+
var view = this.view; // force view load
|
|
659
662
|
var size = JSSize(this.contentInsets.width + 220, this.contentInsets.height);
|
|
660
663
|
if (size.width > maxSize.width){
|
|
661
664
|
size.width = maxSize.width;
|
|
@@ -104,7 +104,7 @@ JSClass("UIContainerView", UIView, {
|
|
|
104
104
|
maxSize.height < Number.MAX_VALUE ? maxSize.height - this._contentInsets.height : Number.MAX_VALUE
|
|
105
105
|
);
|
|
106
106
|
this._contentView.sizeToFitSize(maxContentSize);
|
|
107
|
-
this.bounds = JSRect(0, 0, this._contentView.bounds.size.width + this._contentInsets.width, this._contentView.bounds.size.height
|
|
107
|
+
this.bounds = JSRect(0, 0, this._contentView.bounds.size.width + this._contentInsets.width, this._contentView.bounds.size.height + this._contentInsets.height);
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
|
|
@@ -83,6 +83,9 @@ JSClass("UIDraggingSession", JSObject, {
|
|
|
83
83
|
},
|
|
84
84
|
|
|
85
85
|
cancel: function(){
|
|
86
|
+
if (this.destination){
|
|
87
|
+
this.destination.draggingExited(this);
|
|
88
|
+
}
|
|
86
89
|
},
|
|
87
90
|
|
|
88
91
|
isValidDestination: function(destination){
|
|
@@ -95,6 +98,10 @@ JSClass("UIDraggingSession", JSObject, {
|
|
|
95
98
|
this.imageOffset = JSPoint(offset);
|
|
96
99
|
},
|
|
97
100
|
|
|
101
|
+
setImageFromView: function(view, offset){
|
|
102
|
+
this.imageOffset = JSPoint(offset);
|
|
103
|
+
},
|
|
104
|
+
|
|
98
105
|
centerImageScreenLocation: JSReadOnlyProperty(),
|
|
99
106
|
|
|
100
107
|
getCenterImageScreenLocation: function(){
|
|
@@ -239,7 +239,7 @@ JSClass("UIHTMLTextField", UIControl, {
|
|
|
239
239
|
this.didChangeValueForBinding('text');
|
|
240
240
|
this.didChangeValueForBinding('integerValue');
|
|
241
241
|
this.postAccessibilityNotification(UIAccessibility.Notification.valueChanged);
|
|
242
|
-
this.sendActionsForEvents(UIControl.Event.
|
|
242
|
+
this.sendActionsForEvents(UIControl.Event.editingChanged);
|
|
243
243
|
if (this.delegate && this.delegate.textFieldDidChange){
|
|
244
244
|
this.delegate.textFieldDidChange(this);
|
|
245
245
|
}
|
|
@@ -904,6 +904,8 @@ UIHTMLTextField.layerClass = UIHTMLElementLayer;
|
|
|
904
904
|
|
|
905
905
|
UIHTMLTextField.sharedStyleElement = null;
|
|
906
906
|
|
|
907
|
+
UIHTMLTextField.Styler = UITextField.Styler;
|
|
908
|
+
|
|
907
909
|
var htmlInputModeByKeyboardType = {};
|
|
908
910
|
htmlInputModeByKeyboardType[UITextInput.KeyboardType.default] = "";
|
|
909
911
|
htmlInputModeByKeyboardType[UITextInput.KeyboardType.url] = "url";
|
|
@@ -562,7 +562,7 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
562
562
|
dragend: function(e){
|
|
563
563
|
// dragend is not cancelable, so no need for preventDefault()
|
|
564
564
|
if (this._dragImageElement !== null){
|
|
565
|
-
if (this._dragImageElement.parentNode !== null){
|
|
565
|
+
if (this._dragImageElement.parentNode !== null && this._createdDragImageElement){
|
|
566
566
|
this._dragImageElement.parentNode.removeChild(this._dragImageElement);
|
|
567
567
|
}
|
|
568
568
|
this._dragImageElement = null;
|
|
@@ -839,6 +839,7 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
839
839
|
// MARK: - Drag & Drop Support
|
|
840
840
|
|
|
841
841
|
_dragImageElement: null,
|
|
842
|
+
_createdDragImageElement: false,
|
|
842
843
|
|
|
843
844
|
prerenderDragImage: function(image){
|
|
844
845
|
// Safari is picky here and requires that the image element be in the document and
|
|
@@ -852,6 +853,7 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
852
853
|
imageElement.src = image.htmlURLString();
|
|
853
854
|
this.rootElement.appendChild(imageElement);
|
|
854
855
|
this._dragImageElement = imageElement;
|
|
856
|
+
this._createdDragImageElement = true;
|
|
855
857
|
},
|
|
856
858
|
|
|
857
859
|
createDraggingSessionWithItems: function(items, event, view){
|
|
@@ -863,6 +865,7 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
863
865
|
context.element.draggable = true;
|
|
864
866
|
// Could use a subclass here, but this seems to work too
|
|
865
867
|
var originalSetImage = session.setImage;
|
|
868
|
+
var originalSetImageFromView = session.setImageFromView;
|
|
866
869
|
var windowServer = this;
|
|
867
870
|
Object.defineProperties(session, {
|
|
868
871
|
setImage: {
|
|
@@ -871,6 +874,15 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
|
|
|
871
874
|
originalSetImage.call(this, image, imageOffset);
|
|
872
875
|
windowServer.prerenderDragImage(image);
|
|
873
876
|
}
|
|
877
|
+
},
|
|
878
|
+
setImageFromView: {
|
|
879
|
+
configurable: true,
|
|
880
|
+
value: function UIHTMLWindowServer_UIDragSession_setImageFromView(view, imageOffset){
|
|
881
|
+
originalSetImageFromView.call(this, view, imageOffset);
|
|
882
|
+
var context = windowServer.displayServer.contextForLayer(view.layer);
|
|
883
|
+
windowServer._dragImageElement = context.element;
|
|
884
|
+
windowServer._createdDragImageElement = false;
|
|
885
|
+
}
|
|
874
886
|
}
|
|
875
887
|
});
|
|
876
888
|
}
|
|
@@ -155,6 +155,10 @@ JSClass("UIImageView", UIView, {
|
|
|
155
155
|
return JSSize(UIView.noIntrinsicSize, UIView.noIntrinsicSize);
|
|
156
156
|
},
|
|
157
157
|
|
|
158
|
+
sizeToFit: function(){
|
|
159
|
+
this.layer.sizeToFit();
|
|
160
|
+
},
|
|
161
|
+
|
|
158
162
|
// -------------------------------------------------------------------------
|
|
159
163
|
// MARK: - Accessibility
|
|
160
164
|
|
|
@@ -747,10 +747,6 @@ JSClass("UIMenuWindowStyler", UIMenuStyler, {
|
|
|
747
747
|
}
|
|
748
748
|
|
|
749
749
|
// Figure out how much space we have on either side of the target rect
|
|
750
|
-
// IMPORTANT: target rect is assumed to leave enough room on at least
|
|
751
|
-
// one side. In our two uses cases 1) submenus, and 2) context menus,
|
|
752
|
-
// menu must be true because 1) a menu is < 1/3 screen wide, leaving
|
|
753
|
-
// at least 1/3 on one side, and 2) context menu rects are Zero size
|
|
754
750
|
var viewFrame = view.convertRectToScreen(rect);
|
|
755
751
|
|
|
756
752
|
// If our rect if offscreen to the left or right, move it over
|
|
@@ -779,6 +775,11 @@ JSClass("UIMenuWindowStyler", UIMenuStyler, {
|
|
|
779
775
|
origin.x = viewFrame.origin.x - size.width;
|
|
780
776
|
}
|
|
781
777
|
|
|
778
|
+
// Adjust our x position if we've overflowed
|
|
779
|
+
if (origin.x < screenMetrics.safeFrame.origin.x){
|
|
780
|
+
origin.x = screenMetrics.safeFrame.origin.x;
|
|
781
|
+
}
|
|
782
|
+
|
|
782
783
|
// Prefer the y origin at the top of our rect
|
|
783
784
|
origin.y = viewFrame.origin.y;
|
|
784
785
|
|
|
@@ -840,9 +841,15 @@ JSClass("UIMenuWindowStyler", UIMenuStyler, {
|
|
|
840
841
|
|
|
841
842
|
metricsForScreen: function(screen){
|
|
842
843
|
var safeFrame = screen.availableFrame.rectWithInsets(4, 7);
|
|
844
|
+
if (screen.traitCollection.horizontalSizeClass === UIUserInterface.SizeClass.compact){
|
|
845
|
+
return {
|
|
846
|
+
safeFrame: safeFrame,
|
|
847
|
+
maximumWidth: Math.floor(safeFrame.size.width * 0.75)
|
|
848
|
+
};
|
|
849
|
+
}
|
|
843
850
|
return {
|
|
844
851
|
safeFrame: safeFrame,
|
|
845
|
-
maximumWidth: Math.floor(safeFrame.size.width * 0.
|
|
852
|
+
maximumWidth: Math.min(450, Math.floor(safeFrame.size.width * 0.5))
|
|
846
853
|
};
|
|
847
854
|
},
|
|
848
855
|
|
|
@@ -101,6 +101,12 @@ JSClass("UIMenuItem", JSObject, {
|
|
|
101
101
|
this.target = target || null;
|
|
102
102
|
},
|
|
103
103
|
|
|
104
|
+
initWithView: function(view, action, target){
|
|
105
|
+
this.view = view;
|
|
106
|
+
this.action = action || null;
|
|
107
|
+
this.target = target || null;
|
|
108
|
+
},
|
|
109
|
+
|
|
104
110
|
initSeparator: function(){
|
|
105
111
|
this._isSeparator = true;
|
|
106
112
|
this._isEnabled = false;
|
|
@@ -646,9 +646,13 @@ JSClass("UIMenuView", UIView, {
|
|
|
646
646
|
|
|
647
647
|
addViewForItem: function(item){
|
|
648
648
|
var view = item.view;
|
|
649
|
+
var separatorInsets = this.menuWindow.itemContentInsets.insetsWithInsets(0, item.menu.showStatusColumn ? (item.menu.font.displayLineHeight + this.menuWindow.itemContentInsets.left) : 0, 0, 0);
|
|
650
|
+
if (UIDevice.shared !== null && UIDevice.shared.primaryPointerType === UIUserInterface.PointerType.touch){
|
|
651
|
+
separatorInsets = JSInsets.Zero;
|
|
652
|
+
}
|
|
649
653
|
if (view === null){
|
|
650
654
|
if (item.separator){
|
|
651
|
-
view = UIMenuItemSeparatorView.initWithColor(this.menuWindow.separatorColor, this.menuWindow.separatorLineWidth,
|
|
655
|
+
view = UIMenuItemSeparatorView.initWithColor(this.menuWindow.separatorColor, this.menuWindow.separatorLineWidth, separatorInsets);
|
|
652
656
|
view.frame = JSRect(0, 0, 1, this.menuWindow.separatorSize);
|
|
653
657
|
}else{
|
|
654
658
|
view = UIMenuItemView.init();
|
|
@@ -662,6 +666,13 @@ JSClass("UIMenuView", UIView, {
|
|
|
662
666
|
view.setItem(item);
|
|
663
667
|
}
|
|
664
668
|
}
|
|
669
|
+
if (UIDevice.shared !== null && UIDevice.shared.primaryPointerType === UIUserInterface.PointerType.touch){
|
|
670
|
+
if (!item.separator && this.itemViews.length > 0 && !(this.itemViews[this.itemViews.length - 1] instanceof UIMenuItemSeparatorView)){
|
|
671
|
+
view.borderWidth = 1;
|
|
672
|
+
}
|
|
673
|
+
view.maskedBorders = UIView.Sides.minY;
|
|
674
|
+
view.borderColor = this.menuWindow.separatorColor;
|
|
675
|
+
}
|
|
665
676
|
view.hidden = item.alternate;
|
|
666
677
|
this.addSubview(view);
|
|
667
678
|
this.itemViews.push(view);
|
|
@@ -18,14 +18,21 @@
|
|
|
18
18
|
|
|
19
19
|
JSClass("UIPressGestureRecognizer", UIGestureRecognizer, {
|
|
20
20
|
|
|
21
|
+
init: function(){
|
|
22
|
+
UIPressGestureRecognizer.$super.init.call(this);
|
|
23
|
+
this.minimumPressInterval = UIPressGestureRecognizer.PressInterval.long;
|
|
24
|
+
},
|
|
25
|
+
|
|
21
26
|
initWithSpec: function(spec){
|
|
22
27
|
UIPressGestureRecognizer.$super.initWithSpec.call(this, spec);
|
|
23
28
|
if (spec.containsKey("minimumPressInterval")){
|
|
24
29
|
this.minimumPressInterval = spec.valueForKey("minimumPressInterval");
|
|
30
|
+
}else{
|
|
31
|
+
this.minimumPressInterval = UIPressGestureRecognizer.PressInterval.long;
|
|
25
32
|
}
|
|
26
33
|
},
|
|
27
34
|
|
|
28
|
-
minimumPressInterval:
|
|
35
|
+
minimumPressInterval: 0,
|
|
29
36
|
|
|
30
37
|
// MARK: - Events
|
|
31
38
|
|
|
@@ -106,4 +113,8 @@ JSClass("UIPressGestureRecognizer", UIGestureRecognizer, {
|
|
|
106
113
|
this.end(UIGestureRecognizer.State.failed);
|
|
107
114
|
}
|
|
108
115
|
|
|
109
|
-
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
UIPressGestureRecognizer.PressInterval = {
|
|
119
|
+
long: 1
|
|
120
|
+
};
|
|
@@ -29,6 +29,7 @@ JSClass("UISlider", UIControl, {
|
|
|
29
29
|
minimumValue: JSDynamicProperty("_minimumValue", 0),
|
|
30
30
|
maximumValue: JSDynamicProperty("_maximumValue", 1),
|
|
31
31
|
value: JSDynamicProperty("_value", 0),
|
|
32
|
+
integerValue: JSDynamicProperty(),
|
|
32
33
|
|
|
33
34
|
setMinimumValue: function(minimumValue){
|
|
34
35
|
this._minimumValue = minimumValue;
|
|
@@ -53,6 +54,14 @@ JSClass("UISlider", UIControl, {
|
|
|
53
54
|
this.setNeedsLayout();
|
|
54
55
|
},
|
|
55
56
|
|
|
57
|
+
getIntegerValue: function(){
|
|
58
|
+
return Math.round(this._value);
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
setIntegerValue: function(value){
|
|
62
|
+
this.value = value;
|
|
63
|
+
},
|
|
64
|
+
|
|
56
65
|
minimumPoint: JSReadOnlyProperty(),
|
|
57
66
|
maximumPoint: JSReadOnlyProperty(),
|
|
58
67
|
|
|
@@ -215,6 +215,22 @@ JSClass("UIStackView", UIView, {
|
|
|
215
215
|
|
|
216
216
|
subviewsDidChange: function(){
|
|
217
217
|
this.setNeedsLayout();
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
getFirstBaselineOffsetFromTop: function(){
|
|
221
|
+
var top = this._contentInsets.top;
|
|
222
|
+
if (this._arrangedSubviews.length > 0){
|
|
223
|
+
top += this._arrangedSubviews[0].firstBaselineOffsetFromTop;
|
|
224
|
+
}
|
|
225
|
+
return top;
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
getLastBaselineOffsetFromBottom: function(){
|
|
229
|
+
var bottom = this._contentInsets.bottom;
|
|
230
|
+
if (this._arrangedSubviews.length > 0){
|
|
231
|
+
bottom += this._arrangedSubviews[this._arrangedSubviews.length - 1].lastBaselineOffsetFromBottom;
|
|
232
|
+
}
|
|
233
|
+
return bottom;
|
|
218
234
|
}
|
|
219
235
|
|
|
220
236
|
});
|
|
@@ -159,6 +159,7 @@ JSClass("UITextField", UIControl, {
|
|
|
159
159
|
}else{
|
|
160
160
|
this._textLayer.text = text;
|
|
161
161
|
}
|
|
162
|
+
this.setNeedsLayout();
|
|
162
163
|
this._updateIsEmpty(!this._textLayer.hasText());
|
|
163
164
|
},
|
|
164
165
|
|
|
@@ -172,6 +173,7 @@ JSClass("UITextField", UIControl, {
|
|
|
172
173
|
return;
|
|
173
174
|
}
|
|
174
175
|
this._textLayer.attributedText = attributedText;
|
|
176
|
+
this.setNeedsLayout();
|
|
175
177
|
this._updateIsEmpty(!this._textLayer.hasText());
|
|
176
178
|
},
|
|
177
179
|
|
|
@@ -896,7 +896,17 @@ JSClass('UIWindow', UIView, {
|
|
|
896
896
|
},
|
|
897
897
|
|
|
898
898
|
_sendTouchEvent: function(event){
|
|
899
|
-
|
|
899
|
+
var modal = this._modal;
|
|
900
|
+
while (modal !== null && modal._modal !== null){
|
|
901
|
+
modal = modal._modal;
|
|
902
|
+
}
|
|
903
|
+
if (modal !== null){
|
|
904
|
+
if (event.type == UIEvent.Type.touchesBegan){
|
|
905
|
+
if (modal._isOpen){
|
|
906
|
+
modal.makeKeyAndOrderFront();
|
|
907
|
+
modal.indicateModalStatus();
|
|
908
|
+
}
|
|
909
|
+
}
|
|
900
910
|
return;
|
|
901
911
|
}
|
|
902
912
|
var i, l;
|
|
@@ -1148,7 +1158,18 @@ JSClass("UIWindowStyler", JSObject, {
|
|
|
1148
1158
|
window.layer.addSublayer(window.stylerProperties.focusRingLayer);
|
|
1149
1159
|
},
|
|
1150
1160
|
|
|
1161
|
+
_isUpdatingFocusRing: false,
|
|
1162
|
+
|
|
1151
1163
|
updateFocusRingInWindow: function(window, animated){
|
|
1164
|
+
if (this._isUpdatingFocusRing){
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
this._isUpdatingFocusRing = true;
|
|
1168
|
+
this._updateFocusRingInWindow(window, animated);
|
|
1169
|
+
this._isUpdatingFocusRing = false;
|
|
1170
|
+
},
|
|
1171
|
+
|
|
1172
|
+
_updateFocusRingInWindow: function(window, animated){
|
|
1152
1173
|
var responder = window.firstResponder;
|
|
1153
1174
|
var focusRingLayer = window.stylerProperties.focusRingLayer;
|
|
1154
1175
|
if (!window.isKeyWindow || responder === null || !responder.isKindOfClass(UIView)){
|
|
@@ -1156,6 +1177,16 @@ JSClass("UIWindowStyler", JSObject, {
|
|
|
1156
1177
|
return;
|
|
1157
1178
|
}
|
|
1158
1179
|
var view = responder;
|
|
1180
|
+
var views = [];
|
|
1181
|
+
while (view !== window){
|
|
1182
|
+
views.push(view);
|
|
1183
|
+
view = view.superview;
|
|
1184
|
+
}
|
|
1185
|
+
view = responder;
|
|
1186
|
+
var i;
|
|
1187
|
+
for (i = views.length - 1; i >= 0; --i){
|
|
1188
|
+
views[i].layoutIfNeeded();
|
|
1189
|
+
}
|
|
1159
1190
|
var path = view.focusRingPath;
|
|
1160
1191
|
if (path === null){
|
|
1161
1192
|
focusRingLayer.hidden = true;
|