@breakside/jskit 2022.49.1 → 2022.52.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 (66) hide show
  1. package/Frameworks/DOM.jsframework/Info.json +2 -2
  2. package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
  3. package/Frameworks/FontKit.jsframework/Info.json +2 -2
  4. package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
  5. package/Frameworks/Foundation.jsframework/Info.json +2 -2
  6. package/Frameworks/Foundation.jsframework/JS/Error+JS.js +6 -1
  7. package/Frameworks/Foundation.jsframework/JS/JSObject.js +5 -4
  8. package/Frameworks/Foundation.jsframework/JS/JSTextFramesetter.js +1 -1
  9. package/Frameworks/Foundation.jsframework/JS/Number+JS.js +3 -1
  10. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  11. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  12. package/Frameworks/SecurityKit.jsframework/JS/SECSign+Node.js +1 -1
  13. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  14. package/Info.json +2 -2
  15. package/Node/HTMLBuilder.js +9 -8
  16. package/Node/KeyCommand.js +1 -1
  17. package/Node/KeypairCommand.js +73 -0
  18. package/Node/io.breakside.jskit-bundle.js +2 -2
  19. package/Node/jskit +1 -0
  20. package/Node/main.js +1 -0
  21. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  22. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  23. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  24. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  25. package/Root/Frameworks/ChartKit/CHBarChart.js +1 -1
  26. package/Root/Frameworks/ChartKit/CHStackedAreaChart.js +0 -2
  27. package/Root/Frameworks/ChartKit/CHStackedBarChart.js +0 -2
  28. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  29. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  30. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  31. package/Root/Frameworks/DOM/Info.yaml +1 -1
  32. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  33. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  34. package/Root/Frameworks/Foundation/Error+JS.js +6 -1
  35. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  36. package/Root/Frameworks/Foundation/JSObject.js +5 -4
  37. package/Root/Frameworks/Foundation/JSTextFramesetter.js +1 -1
  38. package/Root/Frameworks/Foundation/Number+JS.js +3 -1
  39. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  40. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  41. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  42. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  43. package/Root/Frameworks/NotificationKit/NKHTMLUserNotificationCenter.js +2 -2
  44. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  45. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  46. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  47. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  48. package/Root/Frameworks/SecurityKit/SECSign+Node.js +1 -1
  49. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  50. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  51. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  52. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  53. package/Root/Frameworks/UIKit/UIDevice+HTML.js +29 -18
  54. package/Root/Frameworks/UIKit/UIDevice.js +15 -1
  55. package/Root/Frameworks/UIKit/UIHTMLApplication.js +36 -21
  56. package/Root/Frameworks/UIKit/UIListView.js +20 -2
  57. package/Root/Frameworks/UIKit/UIMenuView.js +1 -0
  58. package/Root/Frameworks/UIKit/UIScrollGestureRecognizer.js +184 -0
  59. package/Root/Frameworks/UIKit/UIStackView.js +4 -0
  60. package/Root/Frameworks/UIKit/UIWindow.js +3 -0
  61. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  62. package/Root/Templates/html/${PROJECT_NAME}/MainWindow.spec.yaml +2 -4
  63. package/Root/Templates/html/${PROJECT_NAME}/www/HTMLAppBootstrapper.js +24 -9
  64. package/Root/Templates/html/${PROJECT_NAME}/www/index.html +45 -30
  65. package/Root/Templates/html/${PROJECT_NAME}/www/service-worker.js +6 -5
  66. package/package.json +1 -1
@@ -7,13 +7,18 @@ window.HTMLAppBootstrapper = function(rootElement, jskitapp){
7
7
  if (this === undefined){
8
8
  return new HTMLAppBootstrapper(rootElement, jskitapp);
9
9
  }
10
- this.app = jskitapp;
11
10
  this.rootElement = rootElement;
12
- this.preflightID = jskitapp.preflightId;
13
- this.preflightSrc = jskitapp.preflightSrc;
14
- this.serviceWorkerSrc = jskitapp.serviceWorkerSrc;
15
- this.appSrc = jskitapp.appSrc;
16
- this.appCss = jskitapp.appCss;
11
+ if (jskitapp.TEMPLATE === "JSKIT_APP"){
12
+ window.bootstrapper = this;
13
+ this.app = null;
14
+ }else{
15
+ this.app = jskitapp;
16
+ this.preflightID = jskitapp.preflightId;
17
+ this.preflightSrc = jskitapp.preflightSrc;
18
+ this.serviceWorkerSrc = jskitapp.serviceWorkerSrc;
19
+ this.appSrc = jskitapp.appSrc;
20
+ this.appCss = jskitapp.appCss;
21
+ }
17
22
  this.status = HTMLAppBootstrapper.STATUS.notstarted;
18
23
  this.statusDispatchTimeoutID = null;
19
24
  this.preflightChecks = [];
@@ -45,7 +50,8 @@ HTMLAppBootstrapper.STATUS = {
45
50
  appRunning: 'appRunning',
46
51
  appLaunched: 'appLaunched',
47
52
  appLaunchFailure: 'appLaunchFailure',
48
- appRequiresNoOtherInstances: 'appRequiresNoOtherInstances'
53
+ appRequiresNoOtherInstances: 'appRequiresNoOtherInstances',
54
+ appCrashed: 'appCrashed'
49
55
  };
50
56
 
51
57
  HTMLAppBootstrapper.prototype = {
@@ -62,6 +68,9 @@ HTMLAppBootstrapper.prototype = {
62
68
  },
63
69
 
64
70
  run: function(){
71
+ if (this.app === null){
72
+ return;
73
+ }
65
74
  this.log_info("boot", "Booting " + this.app.bundleId + ", build " + this.app.buildId);
66
75
  if (this.serviceWorkerSrc && window.navigator.serviceWorker){
67
76
  this._installUsingServiceWorker(window.navigator.serviceWorker);
@@ -209,6 +218,10 @@ HTMLAppBootstrapper.prototype = {
209
218
  this.setStatus(HTMLAppBootstrapper.STATUS.appLaunched);
210
219
  },
211
220
 
221
+ applicationDidCrash: function(application){
222
+ this.setStatus(HTMLAppBootstrapper.STATUS.appCrashed);
223
+ },
224
+
212
225
  include: function(src, async, callback, errorCallback){
213
226
  try{
214
227
  this.loadingScripts[src] = {
@@ -238,10 +251,12 @@ HTMLAppBootstrapper.prototype = {
238
251
  },
239
252
 
240
253
  setStatus: function(status){
241
- this.log_info("status", this.status + " -> " + status);
254
+ if (status !== HTMLAppBootstrapper.STATUS.appCrashed){
255
+ this.log_info("status", this.status + " -> " + status);
256
+ }
242
257
  this.status = status;
243
258
  var bootstrapper = this;
244
- if (status === HTMLAppBootstrapper.STATUS.appRunning || status === HTMLAppBootstrapper.STATUS.appLaunched){
259
+ if (status === HTMLAppBootstrapper.STATUS.appRunning || status === HTMLAppBootstrapper.STATUS.appLaunched || status === HTMLAppBootstrapper.STATUS.appCrashed){
245
260
  if (this.statusDispatchTimeoutID !== null){
246
261
  clearTimeout(this.statusDispatchTimeoutID);
247
262
  this.statusDispatchTimeoutID = null;
@@ -7,13 +7,7 @@
7
7
  <meta name="theme-color" media="(prefers-color-scheme: dark)" content="rgb(38,38,38)">
8
8
  <title></title>
9
9
  <base href="/">
10
- <style id="bootstrap-style" type="text/css">
11
- @import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,600&display=swap');
12
- * {
13
- cursor: default;
14
- user-select: none;
15
- -webkit-user-select: none;
16
- }
10
+ <style type="text/css">
17
11
  #splash {
18
12
  position: fixed;
19
13
  top: 0;
@@ -21,8 +15,9 @@
21
15
  right: 0;
22
16
  bottom: 0;
23
17
  background-color: rgb(255,255,255);
18
+ z-index: 100;
24
19
  }
25
- #status {
20
+ #splash-status {
26
21
  position: absolute;
27
22
  opacity: 0;
28
23
  top: 50%;
@@ -31,14 +26,17 @@
31
26
  white-space: nowrap;
32
27
  overflow: hidden;
33
28
  text-overflow: ellipsis;
34
- font: 300 16px/24px "Source Sans Pro", "Helvetica", sans-serif;
29
+ font: 300 16px/24px "Helvetica", sans-serif;
35
30
  height: 24px;
36
31
  text-align: center;
37
32
  transition-property: opacity, color, margin-top;
38
33
  transition-duration: .25s;
39
34
  color: rgb(164,164,164);
35
+ cursor: default;
36
+ user-select: none;
37
+ -webkit-user-select: none;
40
38
  }
41
- #details {
39
+ #splash-details {
42
40
  position: absolute;
43
41
  opacity: 0;
44
42
  top: 50%;
@@ -47,13 +45,16 @@
47
45
  left: 40px;
48
46
  overflow: hidden;
49
47
  text-overflow: ellipsis;
50
- font: 300 16px/20px "Source Sans Pro", "Helvetica", sans-serif;
48
+ font: 300 16px/20px "Helvetica", sans-serif;
51
49
  text-align: center;
52
50
  transition: opacity linear .5s .5s;
53
51
  opacity: 0;
54
52
  color: rgb(192,192,192);
53
+ cursor: default;
54
+ user-select: none;
55
+ -webkit-user-select: none;
55
56
  }
56
- #progress {
57
+ #splash-progress {
57
58
  opacity: 0;
58
59
  position: absolute;
59
60
  box-sizing: border-box;
@@ -69,33 +70,36 @@
69
70
  transition-duration: .25s;
70
71
  background-color: rgba(245,245,245);
71
72
  box-shadow: inset 0 0 2px rgba(0,0,0,0.15);
73
+ cursor: default;
74
+ user-select: none;
75
+ -webkit-user-select: none;
72
76
  }
73
- #progress-bar {
77
+ #splash-progress-bar {
74
78
  height: 100%;
75
79
  width: 0%;
76
80
  background-color: rgb(224,224,224);
77
81
  }
78
- #splash.error #status {
82
+ #splash.error #splash-status {
79
83
  font-weight: 600;
80
84
  }
81
- #splash.error #details {
85
+ #splash.error #splash-details {
82
86
  opacity: 1;
83
87
  }
84
88
  @media (prefers-color-scheme: dark) {
85
89
  #splash {
86
90
  background-color: rgb(38,38,38);
87
91
  }
88
- #status {
92
+ #splash-status {
89
93
  color: rgb(128,128,128);
90
94
  }
91
- #details {
95
+ #splash-details {
92
96
  color: rgb(102,102,102);
93
97
  }
94
- #progress {
98
+ #splash-progress {
95
99
  background-color: rgba(26,26,26);
96
100
  box-shadow: inset 0 0 2px rgba(0,0,0,0.15);
97
101
  }
98
- #progress-bar {
102
+ #splash-progress-bar {
99
103
  background-color: rgb(80,80,80);
100
104
  }
101
105
  }
@@ -103,9 +107,9 @@
103
107
  </head>
104
108
  <body>
105
109
  <div id="splash" role="none presentation">
106
- <div id="status"></div>
107
- <div id="progress" role="progressbar" aria-label="Application loading progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-hidden="true"><div id="progress-bar"></div></div>
108
- <div id="details"></div>
110
+ <div id="splash-status"></div>
111
+ <div id="splash-progress" role="progressbar" aria-label="Application loading progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-hidden="true"><div id="splash-progress-bar"></div></div>
112
+ <div id="splash-details"></div>
109
113
  </div>
110
114
  <script type="text/javascript" src="HTMLAppBootstrapper.js"></script>
111
115
  <script type="text/javascript" jskit>
@@ -115,11 +119,10 @@
115
119
  (function(){
116
120
  var app = {TEMPLATE: "JSKIT_APP"};
117
121
  var splash = document.getElementById('splash');
118
- var statusLabel = document.getElementById('status');
119
- var detailsLabel = document.getElementById('details');
120
- var bootstrapStyle = document.getElementById('bootstrap-style');
121
- var progress = document.getElementById('progress');
122
- var progressBar = document.getElementById('progress-bar');
122
+ var statusLabel = document.getElementById('splash-status');
123
+ var detailsLabel = document.getElementById('splash-details');
124
+ var progress = document.getElementById('splash-progress');
125
+ var progressBar = document.getElementById('splash-progress-bar');
123
126
  var bootstrapper = HTMLAppBootstrapper(document.body, app);
124
127
  var downListener = null;
125
128
  bootstrapper.onstatus = function index_boostrapper_status(){
@@ -165,9 +168,9 @@
165
168
  progress.style.opacity = 0;
166
169
  progress.setAttribute("aria-hidden", "true");
167
170
  splash.className = 'error';
168
- statusLabel.innerHTML = "Apologies, but we couldn't start the application";
171
+ statusLabel.innerHTML = "Unable to Start Application";
169
172
  detailsLabel.style.opacity = 1;
170
- detailsLabel.innerHTML = "Don't worry, it wasn't anything you did, and it isn't something we expect to happen under normal usage.<br>We've notified our engineers of the problem, and the best thing you can do is try again soon.";
173
+ detailsLabel.innerHTML = "Apologies, but we couldn't start the application. Don't worry, it wasn't anything you did, and it isn't something we expect to happen under normal usage.<br>We've notified our engineers of the problem, and the best thing you can do is try again soon.";
171
174
  reportError(bootstrapper.error, bootstrapper.getLogs());
172
175
  break;
173
176
  case S.appRequiresNoOtherInstances:
@@ -183,8 +186,20 @@
183
186
  break;
184
187
  case S.appLaunched:
185
188
  window.requestAnimationFrame(function(){
189
+ progress.style.opacity = 0;
190
+ progress.setAttribute("aria-hidden", "true");
191
+ statusLabel.style.opacity = 0;
186
192
  splash.parentNode.removeChild(splash);
187
- bootstrapStyle.parentNode.removeChild(bootstrapStyle);
193
+ });
194
+ break;
195
+ case S.appCrashed:
196
+ document.body.appendChild(splash);
197
+ statusLabel.innerHTML = "Application Error";
198
+ detailsLabel.innerHTML = "Apologies, but the application needs to restart. We've notified our engineers of the problem.<br><br><button onclick='location.reload()'>Restart</button>";
199
+ window.requestAnimationFrame(function(){
200
+ splash.className = 'error';
201
+ statusLabel.style.opacity = 1;
202
+ detailsLabel.style.opacity = 1;
188
203
  });
189
204
  break;
190
205
  }
@@ -12,18 +12,19 @@ function install(){
12
12
  for (var path in app.sources){
13
13
  source = app.sources[path];
14
14
  if (source.required){
15
- required.push(path);
15
+ required.push({path: path, cache: source.cache});
16
16
  }
17
17
  }
18
18
  var loaded = 0;
19
19
  var total = required.length;
20
20
  return clients.matchAll({includeUncontrolled: true}).then(function(clients){
21
- var client = clients[0];
22
21
  return caches.open(cacheKey).then(function(cache){
23
- return Promise.all(required.map(function(path){
24
- return cache.add(path).then(function(){
22
+ return Promise.all(required.map(function(resource){
23
+ return cache.add(new Request(resource.path, {cache: resource.cache || "default"})).then(function(){
25
24
  ++loaded;
26
- client.postMessage({type: 'progress', loaded: loaded, total: total});
25
+ for (let client of clients){
26
+ client.postMessage({type: 'progress', loaded: loaded, total: total});
27
+ }
27
28
  });
28
29
  }));
29
30
  });
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=10.10.0"
10
10
  },
11
11
  "name": "@breakside/jskit",
12
- "version": "2022.49.1",
12
+ "version": "2022.52.0",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"