@breakside/jskit 2023.12.1 → 2023.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/Frameworks/DOM.jsframework/Info.json +2 -2
  2. package/Frameworks/DOM.jsframework/JS/DOM+HTML.js +14 -11
  3. package/Frameworks/DOM.jsframework/JS/DOMDocument.js +11 -0
  4. package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
  5. package/Frameworks/DOM.jsframework/sources.json +3 -1
  6. package/Frameworks/FontKit.jsframework/Info.json +2 -2
  7. package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
  8. package/Frameworks/Foundation.jsframework/Info.json +2 -2
  9. package/Frameworks/Foundation.jsframework/JS/JSFileManager+HTML.js +12 -6
  10. package/Frameworks/Foundation.jsframework/JS/JSGradient.js +55 -0
  11. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  12. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  13. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  14. package/Info.json +2 -2
  15. package/Node/HTMLBuilder.js +45 -1
  16. package/Node/io.breakside.jskit-bundle.js +2 -2
  17. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  18. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  19. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  20. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  21. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  22. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  23. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  24. package/Root/Frameworks/DOM/DOM+HTML.js +14 -11
  25. package/Root/Frameworks/DOM/DOMDocument.js +11 -0
  26. package/Root/Frameworks/DOM/Info.yaml +1 -1
  27. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  28. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  29. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  30. package/Root/Frameworks/Foundation/JSFileManager+HTML.js +12 -6
  31. package/Root/Frameworks/Foundation/JSGradient.js +55 -0
  32. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  33. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  34. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  35. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  36. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  37. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  38. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  39. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  40. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  41. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  42. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  43. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  44. package/Root/Frameworks/UIKit/UIWindowServer.js +1 -1
  45. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  46. package/Root/Templates/html/${PROJECT_NAME}/conf/debug/nginx.conf +2 -0
  47. package/Root/Templates/html/${PROJECT_NAME}/conf/release/nginx.conf +2 -0
  48. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "JSBundleType": "framework",
3
3
  "JSBundleIdentifier": "io.breakside.JSKit.DOM",
4
- "JSBundleVersion": "2023.12.1",
4
+ "JSBundleVersion": "2023.13.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": "820701364a631e47c54073ae61f64172ae8085f0"
12
+ "GitRevision": "652d53e58a17366c7af981b29cf5192f667cf330"
13
13
  }
@@ -16,20 +16,23 @@
16
16
  // jshint browser: true
17
17
  'use strict';
18
18
 
19
- window.DOM = {
20
- Node: window.Node,
21
- Document: window.Document,
22
- DocumentType: window.DocumentType,
23
- ProcessingInstruction: window.ProcessingInstruction,
24
- Element: window.Element,
25
- Attr: window.Attr,
26
- CharacterData: window.CharacterData,
27
- Text: window.Text,
28
- CDATASection: window.CDATASection,
29
- Comment: window.Comment,
19
+ JSGlobalObject.DOM = {
20
+ Node: JSGlobalObject.Node,
21
+ Document: JSGlobalObject.Document,
22
+ DocumentType: JSGlobalObject.DocumentType,
23
+ ProcessingInstruction: JSGlobalObject.ProcessingInstruction,
24
+ Element: JSGlobalObject.Element,
25
+ Attr: JSGlobalObject.Attr,
26
+ CharacterData: JSGlobalObject.CharacterData,
27
+ Text: JSGlobalObject.Text,
28
+ CDATASection: JSGlobalObject.CDATASection,
29
+ Comment: JSGlobalObject.Comment,
30
30
  createDocument: function(namespace, qualifiedName, doctype){
31
31
  return document.implementation.createDocument(namespace, qualifiedName, doctype);
32
32
  },
33
+ createHTMLDocument: function(title){
34
+ return document.implementation.createHTMLDocument(title);
35
+ },
33
36
  createDocumentType: function(name, publicId, systemId){
34
37
  return document.implementation.createDocumentType(name, publicId, systemId);
35
38
  }
@@ -52,6 +52,17 @@ DOM.createDocument = function(namespace, qualifiedName, doctype){
52
52
  return document;
53
53
  };
54
54
 
55
+ DOM.createHTMLDocument = function(title){
56
+ var doctype = DOM.createDocumentType("html", "", "");
57
+ var document = DOM.createDocument(null, "html", doctype);
58
+ document.head = document.documentElement.appendChild(document.createElement("head"));
59
+ if (title){
60
+ document.head.appendChild(document.createElement("title")).appendChild(document.createTextNode(title));
61
+ }
62
+ document.body = document.documentElement.appendChild(document.createElement("body"));
63
+ return document;
64
+ };
65
+
55
66
  DOM.createDocumentType = function(name, publicId, systemId){
56
67
  var doctype = Object.create(DOM.DocumentType.prototype, {
57
68
  nodeType: {value: DOM.Node.DOCUMENT_TYPE_NODE},
@@ -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": "2023.12.1",
6
+ "JSBundleVersion": "2023.13.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": "820701364a631e47c54073ae61f64172ae8085f0"
14
+ "GitRevision": "652d53e58a17366c7af981b29cf5192f667cf330"
15
15
  },
16
16
  "Resources": [],
17
17
  "ResourceLookup": {
@@ -13,7 +13,9 @@
13
13
  "DOM+HTML.js"
14
14
  ],
15
15
  "features": [],
16
- "globals": []
16
+ "globals": [
17
+ "DOM"
18
+ ]
17
19
  },
18
20
  "node": {
19
21
  "frameworks": [
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "JSBundleType": "framework",
3
3
  "JSBundleIdentifier": "io.breakside.JSKit.FontKit",
4
- "JSBundleVersion": "2023.12.1",
4
+ "JSBundleVersion": "2023.13.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": "820701364a631e47c54073ae61f64172ae8085f0"
11
+ "GitRevision": "652d53e58a17366c7af981b29cf5192f667cf330"
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": "2023.12.1",
6
+ "JSBundleVersion": "2023.13.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": "820701364a631e47c54073ae61f64172ae8085f0"
13
+ "GitRevision": "652d53e58a17366c7af981b29cf5192f667cf330"
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": "2023.12.1",
4
+ "JSBundleVersion": "2023.13.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": "820701364a631e47c54073ae61f64172ae8085f0"
12
+ "GitRevision": "652d53e58a17366c7af981b29cf5192f667cf330"
13
13
  }
@@ -96,13 +96,19 @@ JSClass("JSHTMLFileManager", JSFileManager, {
96
96
  if (oldVersion === 1){
97
97
  var v1url = manager._rootURL.appendingPathComponents(["Containers", "io.breakside.JSKit.Foundation.JSFileManager"], true);
98
98
  var v2url = manager.persistentContainerURL;
99
- logger.info("moving persistentContainerURL from %{public} to %{public}", v1url.encodedString, v2url.encodedString);
100
- manager.moveItemAtURL(v1url, v2url, function(success){
101
- if (success){
102
- completion.call(target, JSFileManager.State.success);
99
+ manager.itemExistsAtURL(v1url, function(exists){
100
+ if (exists){
101
+ logger.info("moving persistentContainerURL from %{public} to %{public}", v1url.encodedString, v2url.encodedString);
102
+ manager.moveItemAtURL(v1url, v2url, function(success){
103
+ if (success){
104
+ completion.call(target, JSFileManager.State.success);
105
+ }else{
106
+ logger.error("failed to move persistentContainerURL");
107
+ completion.call(target, JSFileManager.State.genericFailure);
108
+ }
109
+ });
103
110
  }else{
104
- logger.error("failed to move persistentContainerURL");
105
- completion.call(target, JSFileManager.State.genericFailure);
111
+ completion.call(target, JSFileManager.State.success);
106
112
  }
107
113
  });
108
114
  }else{
@@ -142,6 +142,61 @@ JSClass('JSGradient', JSObject, {
142
142
  return 'linear-gradient(%fdeg, %s)'.sprintf(angle, cssStops.join(', '));
143
143
  },
144
144
 
145
+ colorAtPosition: function(position){
146
+ if (position <= this.stops[0].position){
147
+ return this.stops[0].color;
148
+ }
149
+ var l = this.stops.length;
150
+ if (position >= this.stops[l - 1].position){
151
+ return this.stops[l - 1].color;
152
+ }
153
+ var i;
154
+ for (i = l - 2; i > 0; --i){
155
+ if (position >= this.stops[i].position){
156
+ break;
157
+ }
158
+ }
159
+ var stop0 = this.stops[i];
160
+ var stop1 = this.stops[i + 1];
161
+ var percentage = (position - stop0.position) / (stop1.position - stop0.position);
162
+ return stop0.color.colorByBlendingColor(stop1.color, percentage);
163
+ },
164
+
165
+ gradientBetweenPositions: function(position0, position1){
166
+ var gradient = JSGradient.init();
167
+ var position;
168
+ var color;
169
+ var i = 0;
170
+ var l = this.stops.length;
171
+ var stop0, stop1;
172
+ var percentage;
173
+ for (; i < l && this.stops[i].position < position0; ++i){
174
+ }
175
+ if (i < l){
176
+ if (i > 0){
177
+ stop0 = this.stops[i - 1];
178
+ stop1 = this.stops[i];
179
+ color = stop0.color.colorByBlendingColor(stop1.color, (position0 - stop0.position) / (stop1.position - stop0.position));
180
+ gradient.addStop(0, color);
181
+ }
182
+ for (; i < l && this.stops[i].position <= position1; ++i){
183
+ stop0 = this.stops[i];
184
+ position = (stop0.position - position0) / (position1 - position0);
185
+ gradient.addStop(position, stop0.color);
186
+ }
187
+ if (i < l && position1 > stop0.position){
188
+ stop0 = this.stops[i - 1];
189
+ stop1 = this.stops[i];
190
+ color = stop0.color.colorByBlendingColor(stop1.color, (position1 - stop0.position) / (stop1.position - stop0.position));
191
+ gradient.addStop(1, color);
192
+ }
193
+ }else{
194
+ gradient.addStop(0, this.stops[l - 1].color);
195
+ gradient.addStop(1, this.stops[l - 1].color);
196
+ }
197
+ return gradient;
198
+ },
199
+
145
200
  rotated: function(radians){
146
201
  var transform = JSAffineTransform.Translated(0.5, 0.5);
147
202
  transform = transform.rotatedBy(radians);
@@ -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": "2023.12.1",
6
+ "JSBundleVersion": "2023.13.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": "820701364a631e47c54073ae61f64172ae8085f0"
14
+ "GitRevision": "652d53e58a17366c7af981b29cf5192f667cf330"
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": "2023.12.1",
4
+ "JSBundleVersion": "2023.13.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": "820701364a631e47c54073ae61f64172ae8085f0"
12
+ "GitRevision": "652d53e58a17366c7af981b29cf5192f667cf330"
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": "2023.12.1",
6
+ "JSBundleVersion": "2023.13.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": "820701364a631e47c54073ae61f64172ae8085f0"
14
+ "GitRevision": "652d53e58a17366c7af981b29cf5192f667cf330"
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": "2023.12.1",
4
+ "JSBundleVersion": "2023.13.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": "820701364a631e47c54073ae61f64172ae8085f0"
11
+ "GitRevision": "652d53e58a17366c7af981b29cf5192f667cf330"
12
12
  }
@@ -876,8 +876,18 @@ JSClass("HTMLBuilder", Builder, {
876
876
  HTTP_PORT: this.arguments['http-port'],
877
877
  SSL_LISTEN: this.arguments['tls-cert'] ? " ssl" : "",
878
878
  SSL_CERT: this.arguments['tls-cert'] ? "ssl_certificate tls.crt;" : "",
879
- SSL_KEY: this.arguments['tls-key'] ? "ssl_certificate_key tls.key;" : ""
879
+ SSL_KEY: this.arguments['tls-key'] ? "ssl_certificate_key tls.key;" : "",
880
+ STATE_PATH_REDIRECTS: "",
880
881
  };
882
+ let statePaths = this.project.info.UIHTMLStatePaths || [];
883
+ for (let path of statePaths){
884
+ path = path.trim();
885
+ if (path.endsWith("/")){
886
+ params.STATE_PATH_REDIRECTS += "location %s {\n rewrite ^(.*)$ /#$1 redirect;\n }\n\n ".sprintf(path);
887
+ }else{
888
+ params.STATE_PATH_REDIRECTS += "location = %s {\n rewrite ^(.*)$ /#$1 redirect;\n }\n\n ".sprintf(path);
889
+ }
890
+ }
881
891
  var projectConfURL = this.project.url.appendingPathComponents(["conf", this.debug ? "debug" : "release"], true);
882
892
  var entries = await this.fileManager.contentsOfDirectoryAtURL(projectConfURL);
883
893
  for (let i = 0, l = entries.length; i < l; ++i){
@@ -922,6 +932,8 @@ JSClass("HTMLBuilder", Builder, {
922
932
  lines.push(" exit 1");
923
933
  lines.push("fi");
924
934
  lines.push("");
935
+
936
+ var emptyPath = emptyURL.encodedStringRelativeTo(this.wwwURL);
925
937
  let resourcesPath = this.resourcesURL.settingHasDirectoryPath(true).encodedStringRelativeTo(this.wwwURL);
926
938
  let cacheBustingPath = this.cacheBustingURL.settingHasDirectoryPath(true).encodedStringRelativeTo(this.wwwURL);
927
939
  let indexPath = this.indexURL.encodedStringRelativeTo(this.wwwURL);
@@ -950,16 +962,48 @@ JSClass("HTMLBuilder", Builder, {
950
962
  lines.push("aws s3 cp ${LOCAL_ROOT}/%1$s ${S3_ROOT}/%1$s --cache-control='max-age=315360000' --expires 'Thu, 31 Dec 2037 23:55:55 GMT' || exit 1".sprintf(preflightPath));
951
963
  lines.push("aws s3 cp ${LOCAL_ROOT}/%1$s ${S3_ROOT}/%1$s --cache-control='no-cache' --expires 'Thu, 01 Jan 1970 00:00:01 GMT' || exit 1".sprintf(bootstrapperPath));
952
964
  lines.push("aws s3 cp ${LOCAL_ROOT}/%1$s ${S3_ROOT}/%1$s --cache-control='no-cache' --expires 'Thu, 01 Jan 1970 00:00:01 GMT' || exit 1".sprintf(indexPath));
965
+ let statePaths = this.project.info.UIHTMLStatePaths || [];
966
+ let statePathPrefixes = [];
967
+ for (let path of statePaths){
968
+ if (path.endsWith("/")){
969
+ statePathPrefixes.push(path);
970
+ }else{
971
+ lines.push("aws s3 cp ${LOCAL_ROOT}/%1$s ${S3_ROOT}%2$s --website-redirect /#%2$s || exit 1".sprintf(emptyPath, path));
972
+ }
973
+ }
953
974
  if (manifestPath !== null){
954
975
  lines.push("aws s3 cp ${LOCAL_ROOT}/%1$s ${S3_ROOT}/%1$s --cache-control='no-cache' --expires 'Thu, 01 Jan 1970 00:00:01 GMT' --content-type='text/cache-manifest' || exit 1".sprintf(manifestPath));
955
976
  }
956
977
  if (serviceWorkerPath !== null){
957
978
  lines.push("aws s3 cp ${LOCAL_ROOT}/%1$s ${S3_ROOT}/%1$s --cache-control='no-cache' --expires 'Thu, 01 Jan 1970 00:00:01 GMT' || exit 1".sprintf(serviceWorkerPath));
958
979
  }
980
+ let lambdaFunctionURL = this.s3URL.appendingPathComponent("lambda-redirect.js");
981
+ if (statePathPrefixes.length > 0){
982
+ lines.push("echo 'Lambda@Edge CloudFront Behavior function required for some state path redirects'");
983
+ lines.push("echo ''");
984
+ lines.push("echo ''");
985
+ lines.push("cat ${LOCAL_ROOT}/%1$s".sprintf(lambdaFunctionURL.encodedStringRelativeTo(this.wwwURL)));
986
+ }
959
987
  lines.push("");
960
988
  var contents = lines.join("\n").utf8();
961
989
  await this.fileManager.createFileAtURL(scriptURL, contents);
962
990
  await this.fileManager.makeExecutableAtURL(scriptURL);
991
+
992
+ if (statePathPrefixes.length > 0){
993
+ lines = [];
994
+ lines.push("export async function handler(event){");
995
+ lines.push(" let request = event.Records[0].cf.request;");
996
+ for (let path of statePathPrefixes){
997
+ lines.push(" if (request.uri.startsWith('%1$s')){".sprintf(path));
998
+ lines.push(" return {status: 302, statusDescription: 'Found', headers: {location: [{value: '/#' + request.uri}]}};");
999
+ lines.push(" }");
1000
+ }
1001
+ lines.push(" return request;");
1002
+ lines.push("}");
1003
+ lines.push("");
1004
+ contents = lines.join("\n").utf8();
1005
+ await this.fileManager.createFileAtURL(lambdaFunctionURL, contents);
1006
+ }
963
1007
  },
964
1008
 
965
1009
  // -----------------------------------------------------------------------
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.jskit'] = {
3
3
  "Info": {
4
4
  "JSBundleType": "node",
5
5
  "JSBundleIdentifier": "io.breakside.jskit",
6
- "JSBundleVersion": "2023.12.1",
6
+ "JSBundleVersion": "2023.13.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": "820701364a631e47c54073ae61f64172ae8085f0"
13
+ "GitRevision": "652d53e58a17366c7af981b29cf5192f667cf330"
14
14
  },
15
15
  "Resources": [
16
16
  {
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.APIKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSIncludeDirectories:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.APIKitTesting
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.AuthKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.CSSOM
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ChartKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2021 Breakside Inc.
6
6
  # JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ConferenceKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.DBKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -16,20 +16,23 @@
16
16
  // jshint browser: true
17
17
  'use strict';
18
18
 
19
- window.DOM = {
20
- Node: window.Node,
21
- Document: window.Document,
22
- DocumentType: window.DocumentType,
23
- ProcessingInstruction: window.ProcessingInstruction,
24
- Element: window.Element,
25
- Attr: window.Attr,
26
- CharacterData: window.CharacterData,
27
- Text: window.Text,
28
- CDATASection: window.CDATASection,
29
- Comment: window.Comment,
19
+ JSGlobalObject.DOM = {
20
+ Node: JSGlobalObject.Node,
21
+ Document: JSGlobalObject.Document,
22
+ DocumentType: JSGlobalObject.DocumentType,
23
+ ProcessingInstruction: JSGlobalObject.ProcessingInstruction,
24
+ Element: JSGlobalObject.Element,
25
+ Attr: JSGlobalObject.Attr,
26
+ CharacterData: JSGlobalObject.CharacterData,
27
+ Text: JSGlobalObject.Text,
28
+ CDATASection: JSGlobalObject.CDATASection,
29
+ Comment: JSGlobalObject.Comment,
30
30
  createDocument: function(namespace, qualifiedName, doctype){
31
31
  return document.implementation.createDocument(namespace, qualifiedName, doctype);
32
32
  },
33
+ createHTMLDocument: function(title){
34
+ return document.implementation.createHTMLDocument(title);
35
+ },
33
36
  createDocumentType: function(name, publicId, systemId){
34
37
  return document.implementation.createDocumentType(name, publicId, systemId);
35
38
  }
@@ -52,6 +52,17 @@ DOM.createDocument = function(namespace, qualifiedName, doctype){
52
52
  return document;
53
53
  };
54
54
 
55
+ DOM.createHTMLDocument = function(title){
56
+ var doctype = DOM.createDocumentType("html", "", "");
57
+ var document = DOM.createDocument(null, "html", doctype);
58
+ document.head = document.documentElement.appendChild(document.createElement("head"));
59
+ if (title){
60
+ document.head.appendChild(document.createElement("title")).appendChild(document.createTextNode(title));
61
+ }
62
+ document.body = document.documentElement.appendChild(document.createElement("body"));
63
+ return document;
64
+ };
65
+
55
66
  DOM.createDocumentType = function(name, publicId, systemId){
56
67
  var doctype = Object.create(DOM.DocumentType.prototype, {
57
68
  nodeType: {value: DOM.Node.DOCUMENT_TYPE_NODE},
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.DOM
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.Dispatch
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSCopyright: Copyright © 2020 Breakside Inc.
5
5
  JSBundleEnvironments:
6
6
  html: Dispatch+HTML.js
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.FontKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.Foundation
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -96,13 +96,19 @@ JSClass("JSHTMLFileManager", JSFileManager, {
96
96
  if (oldVersion === 1){
97
97
  var v1url = manager._rootURL.appendingPathComponents(["Containers", "io.breakside.JSKit.Foundation.JSFileManager"], true);
98
98
  var v2url = manager.persistentContainerURL;
99
- logger.info("moving persistentContainerURL from %{public} to %{public}", v1url.encodedString, v2url.encodedString);
100
- manager.moveItemAtURL(v1url, v2url, function(success){
101
- if (success){
102
- completion.call(target, JSFileManager.State.success);
99
+ manager.itemExistsAtURL(v1url, function(exists){
100
+ if (exists){
101
+ logger.info("moving persistentContainerURL from %{public} to %{public}", v1url.encodedString, v2url.encodedString);
102
+ manager.moveItemAtURL(v1url, v2url, function(success){
103
+ if (success){
104
+ completion.call(target, JSFileManager.State.success);
105
+ }else{
106
+ logger.error("failed to move persistentContainerURL");
107
+ completion.call(target, JSFileManager.State.genericFailure);
108
+ }
109
+ });
103
110
  }else{
104
- logger.error("failed to move persistentContainerURL");
105
- completion.call(target, JSFileManager.State.genericFailure);
111
+ completion.call(target, JSFileManager.State.success);
106
112
  }
107
113
  });
108
114
  }else{
@@ -142,6 +142,61 @@ JSClass('JSGradient', JSObject, {
142
142
  return 'linear-gradient(%fdeg, %s)'.sprintf(angle, cssStops.join(', '));
143
143
  },
144
144
 
145
+ colorAtPosition: function(position){
146
+ if (position <= this.stops[0].position){
147
+ return this.stops[0].color;
148
+ }
149
+ var l = this.stops.length;
150
+ if (position >= this.stops[l - 1].position){
151
+ return this.stops[l - 1].color;
152
+ }
153
+ var i;
154
+ for (i = l - 2; i > 0; --i){
155
+ if (position >= this.stops[i].position){
156
+ break;
157
+ }
158
+ }
159
+ var stop0 = this.stops[i];
160
+ var stop1 = this.stops[i + 1];
161
+ var percentage = (position - stop0.position) / (stop1.position - stop0.position);
162
+ return stop0.color.colorByBlendingColor(stop1.color, percentage);
163
+ },
164
+
165
+ gradientBetweenPositions: function(position0, position1){
166
+ var gradient = JSGradient.init();
167
+ var position;
168
+ var color;
169
+ var i = 0;
170
+ var l = this.stops.length;
171
+ var stop0, stop1;
172
+ var percentage;
173
+ for (; i < l && this.stops[i].position < position0; ++i){
174
+ }
175
+ if (i < l){
176
+ if (i > 0){
177
+ stop0 = this.stops[i - 1];
178
+ stop1 = this.stops[i];
179
+ color = stop0.color.colorByBlendingColor(stop1.color, (position0 - stop0.position) / (stop1.position - stop0.position));
180
+ gradient.addStop(0, color);
181
+ }
182
+ for (; i < l && this.stops[i].position <= position1; ++i){
183
+ stop0 = this.stops[i];
184
+ position = (stop0.position - position0) / (position1 - position0);
185
+ gradient.addStop(position, stop0.color);
186
+ }
187
+ if (i < l && position1 > stop0.position){
188
+ stop0 = this.stops[i - 1];
189
+ stop1 = this.stops[i];
190
+ color = stop0.color.colorByBlendingColor(stop1.color, (position1 - stop0.position) / (stop1.position - stop0.position));
191
+ gradient.addStop(1, color);
192
+ }
193
+ }else{
194
+ gradient.addStop(0, this.stops[l - 1].color);
195
+ gradient.addStop(1, this.stops[l - 1].color);
196
+ }
197
+ return gradient;
198
+ },
199
+
145
200
  rotated: function(radians){
146
201
  var transform = JSAffineTransform.Translated(0.5, 0.5);
147
202
  transform = transform.rotatedBy(radians);
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ImageKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.MediaKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.MediaKitUI
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.NotificationKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2021 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.PDFKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.QRKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.SearchKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.SecurityKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ServerKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.ServerKitTesting
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.TestKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKit
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSBundleEnvironments:
@@ -422,7 +422,7 @@ JSClass("UIWindowServer", JSObject, {
422
422
  }
423
423
  }
424
424
  if (shouldHideTooltip){
425
- if (view !== null && view.tooltip !== null){
425
+ if (view !== null && view.tooltip !== null && view.tooltip !== ""){
426
426
  this.showTooltipForView(view, this.mouseLocation);
427
427
  }else{
428
428
  this._scheduleHideTooltip();
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKitTesting
3
- JSBundleVersion: 2023.12.1
3
+ JSBundleVersion: 2023.13.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -76,6 +76,8 @@ http {
76
76
  return 200;
77
77
  }
78
78
 
79
+ {{STATE_PATH_REDIRECTS}}
80
+
79
81
  location /Resources {
80
82
  expires max;
81
83
  }
@@ -77,6 +77,8 @@ http {
77
77
  return 200;
78
78
  }
79
79
 
80
+ {{STATE_PATH_REDIRECTS}}
81
+
80
82
  location / {
81
83
  # REQUIRED to eliminate extra requests for everything else
82
84
  expires max;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=10.10.0"
10
10
  },
11
11
  "name": "@breakside/jskit",
12
- "version": "2023.12.1",
12
+ "version": "2023.13.0",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"