@breakside/jskit 2023.12.2 → 2023.14.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/JS/DOM+HTML.js +14 -11
- package/Frameworks/DOM.jsframework/JS/DOMDocument.js +11 -0
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/DOM.jsframework/sources.json +3 -1
- 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/JSGradient.js +55 -0
- 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/HTMLBuilder.js +45 -1
- 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/DOM+HTML.js +14 -11
- package/Root/Frameworks/DOM/DOMDocument.js +11 -0
- 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/JSGradient.js +55 -0
- 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/UIHTMLContentEditableTextInputManager.js +164 -151
- package/Root/Frameworks/UIKit/UIHTMLTextLine.js +45 -25
- package/Root/Frameworks/UIKit/UIHTMLTextRun.js +7 -2
- package/Root/Frameworks/UIKit/UIHTMLTextTypesetter.js +9 -3
- package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +1 -0
- package/Root/Frameworks/UIKit/UIWindow.js +9 -1
- package/Root/Frameworks/UIKit/UIWindowServer.js +2 -2
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/Root/Templates/html/${PROJECT_NAME}/conf/debug/nginx.conf +4 -0
- package/Root/Templates/html/${PROJECT_NAME}/conf/release/nginx.conf +4 -0
- 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.
|
|
4
|
+
"JSBundleVersion": "2023.14.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": "673f51dd8f324ec88953da998a4c272d32956b13"
|
|
13
13
|
}
|
|
@@ -16,20 +16,23 @@
|
|
|
16
16
|
// jshint browser: true
|
|
17
17
|
'use strict';
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
Node:
|
|
21
|
-
Document:
|
|
22
|
-
DocumentType:
|
|
23
|
-
ProcessingInstruction:
|
|
24
|
-
Element:
|
|
25
|
-
Attr:
|
|
26
|
-
CharacterData:
|
|
27
|
-
Text:
|
|
28
|
-
CDATASection:
|
|
29
|
-
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.
|
|
6
|
+
"JSBundleVersion": "2023.14.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": "673f51dd8f324ec88953da998a4c272d32956b13"
|
|
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": "2023.
|
|
4
|
+
"JSBundleVersion": "2023.14.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": "673f51dd8f324ec88953da998a4c272d32956b13"
|
|
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.
|
|
6
|
+
"JSBundleVersion": "2023.14.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": "673f51dd8f324ec88953da998a4c272d32956b13"
|
|
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.
|
|
4
|
+
"JSBundleVersion": "2023.14.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": "673f51dd8f324ec88953da998a4c272d32956b13"
|
|
13
13
|
}
|
|
@@ -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.
|
|
6
|
+
"JSBundleVersion": "2023.14.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": "673f51dd8f324ec88953da998a4c272d32956b13"
|
|
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.
|
|
4
|
+
"JSBundleVersion": "2023.14.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": "673f51dd8f324ec88953da998a4c272d32956b13"
|
|
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.
|
|
6
|
+
"JSBundleVersion": "2023.14.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": "673f51dd8f324ec88953da998a4c272d32956b13"
|
|
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.
|
|
4
|
+
"JSBundleVersion": "2023.14.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": "673f51dd8f324ec88953da998a4c272d32956b13"
|
|
12
12
|
}
|
package/Node/HTMLBuilder.js
CHANGED
|
@@ -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.
|
|
6
|
+
"JSBundleVersion": "2023.14.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": "673f51dd8f324ec88953da998a4c272d32956b13"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [
|
|
16
16
|
{
|
|
@@ -16,20 +16,23 @@
|
|
|
16
16
|
// jshint browser: true
|
|
17
17
|
'use strict';
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
Node:
|
|
21
|
-
Document:
|
|
22
|
-
DocumentType:
|
|
23
|
-
ProcessingInstruction:
|
|
24
|
-
Element:
|
|
25
|
-
Attr:
|
|
26
|
-
CharacterData:
|
|
27
|
-
Text:
|
|
28
|
-
CDATASection:
|
|
29
|
-
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},
|
|
@@ -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);
|