@breakside/jskit 2023.20.0 → 2023.22.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 (63) 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/JSImage.js +9 -7
  7. package/Frameworks/Foundation.jsframework/JS/JSURLResponse.js +1 -1
  8. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  9. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  10. package/Frameworks/SecurityKit.jsframework/JS/SECCipher+HTML.js +31 -44
  11. package/Frameworks/SecurityKit.jsframework/JS/SECCipher+Node.js +16 -38
  12. package/Frameworks/SecurityKit.jsframework/JS/SECCipher.js +33 -3
  13. package/Frameworks/SecurityKit.jsframework/JS/SECHMAC.js +17 -0
  14. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  15. package/Info.json +2 -2
  16. package/Node/HTMLBuilder.js +76 -20
  17. package/Node/Resources.js +21 -120
  18. package/Node/io.breakside.jskit-bundle.js +2 -2
  19. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  20. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  21. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  22. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  23. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  24. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  25. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  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/JSImage.js +9 -7
  31. package/Root/Frameworks/Foundation/JSURLResponse.js +1 -1
  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 +2 -1
  36. package/Root/Frameworks/NotificationKit/NKHTMLUserNotificationCenter.js +59 -18
  37. package/Root/Frameworks/NotificationKit/NKUserNotification.js +12 -1
  38. package/Root/Frameworks/NotificationKit/NKUserNotificationCenter.js +5 -0
  39. package/Root/Frameworks/NotificationKit/NKWebPushService.js +145 -38
  40. package/Root/Frameworks/NotificationKit/NotificationKit+Node.js +19 -0
  41. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  42. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  43. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  44. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  45. package/Root/Frameworks/SecurityKit/SECCipher+HTML.js +31 -44
  46. package/Root/Frameworks/SecurityKit/SECCipher+Node.js +16 -38
  47. package/Root/Frameworks/SecurityKit/SECCipher.js +33 -3
  48. package/Root/Frameworks/SecurityKit/SECHMAC.js +17 -0
  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/UIHTMLApplication.js +2 -0
  54. package/Root/Frameworks/UIKit/UIHTMLContentEditableTextInputManager.js +1 -1
  55. package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +8 -1
  56. package/Root/Frameworks/UIKit/UIListView.js +4 -2
  57. package/Root/Frameworks/UIKit/UIWindowServer.js +7 -13
  58. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  59. package/Root/Templates/html/${PROJECT_NAME}/www/${PROJECT_NAME}.webmanifest +9 -0
  60. package/Root/Templates/html/${PROJECT_NAME}/www/HTMLAppBootstrapper.js +7 -1
  61. package/Root/Templates/html/${PROJECT_NAME}/www/index.html +1 -0
  62. package/Root/Templates/html/${PROJECT_NAME}/www/service-worker.js +25 -1
  63. package/package.json +1 -1
@@ -305,6 +305,8 @@ JSGlobalObject.UIApplicationMain = function(rootElement, bootstrapper){
305
305
  application.run(function(error){
306
306
  if (error === null){
307
307
  application.addEventListeners();
308
+ }else{
309
+ application.windowServer.stop();
308
310
  }
309
311
  if (bootstrapper){
310
312
  bootstrapper.applicationLaunchResult(application, error);
@@ -57,8 +57,8 @@ JSClass('UIHTMLContentEditableTextInputManager', UITextInputManager, {
57
57
  this.textInputLayer = null;
58
58
  this.layoutManager = null;
59
59
  }else{
60
- this.textInputLayer = this.textInputClient.textInputLayer ? this.textInputClient.textInputLayer() : null;
61
60
  this.layoutManager = this.textInputClient.textInputLayoutManager ? this.textInputClient.textInputLayoutManager() : null;
61
+ this.textInputLayer = this.textInputClient.textInputLayer ? this.textInputClient.textInputLayer() : null;
62
62
  }
63
63
  },
64
64
 
@@ -401,6 +401,13 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
401
401
  preventDefault = false;
402
402
  }
403
403
  break;
404
+ case 81: // q
405
+ if (modifiers === UIPlatform.shared.commandModifier){
406
+ // We want to let the quit shortcut go through, so it can be
407
+ // handled by the system.
408
+ preventDefault = false;
409
+ }
410
+ break;
404
411
  case 88: // x
405
412
  if (modifiers === UIPlatform.shared.commandModifier){
406
413
  // We want to let the cut keyboard shortcut go through, so it can be
@@ -957,7 +964,7 @@ JSClass("UIHTMLWindowServer", UIWindowServer, {
957
964
  layoutWindow: function(window){
958
965
  UIHTMLWindowServer.$super.layoutWindow.call(this, window);
959
966
  if (window instanceof UIRootWindow){
960
- window.contentInsets = this.safeAreaInsets();
967
+ window.contentInsets = window.contentInsets.insetsWithInsets(this.safeAreaInsets());
961
968
  }
962
969
  },
963
970
 
@@ -535,9 +535,10 @@ JSClass("UIListView", UIScrollView, {
535
535
  },
536
536
 
537
537
  _approximateYForVisibleItem: function(item){
538
+ var y;
538
539
  if (item.kind === VisibleItem.Kind.cell){
539
540
  var row = this._sectionRowForIndexPath(item.indexPath);
540
- var y = this._approximateYForSection(item.indexPath.section);
541
+ y = this._approximateYForSection(item.indexPath.section);
541
542
  y += this._approximateYForSectionRow(item.indexPath.section, row);
542
543
  return y;
543
544
  }
@@ -545,7 +546,8 @@ JSClass("UIListView", UIScrollView, {
545
546
  return this._approximateYForSection(item.indexPath.section);
546
547
  }
547
548
  if (item.kind === VisibleItem.Kind.footer){
548
- return this._approximateYForSectionFooter(item.indexPath.section);
549
+ y = this._approximateYForSection(item.indexPath.section);
550
+ return y + this._approximateYForSectionFooter(item.indexPath.section);
549
551
  }
550
552
  return 0;
551
553
  },
@@ -165,9 +165,6 @@ JSClass("UIWindowServer", JSObject, {
165
165
  if (this._normalLevelRange.location === 0 && window.level === UIWindow.Level.normal){
166
166
  window.level = UIWindow.Level.back;
167
167
  }
168
- if (this._normalLevelRange.location === 0 && window.level == UIWindow.Level.back){
169
- this.updateRootWindowInsets(window);
170
- }
171
168
  this._beginWindowOrderChange();
172
169
  this._windowsById[window.objectID] = window;
173
170
  switch (window.level){
@@ -278,8 +275,13 @@ JSClass("UIWindowServer", JSObject, {
278
275
  },
279
276
 
280
277
  layoutWindow: function(window){
281
- if (window.level === UIWindow.Level.back){
278
+ if (window instanceof UIRootWindow){
282
279
  window.frame = window._screen.frame;
280
+ var insets = JSInsets.Zero;
281
+ if (this._menuBar !== null && this._menuBar.isOpaque){
282
+ insets.top = this._menuBar.frame.size.height;
283
+ }
284
+ window.contentInsets = insets;
283
285
  }else{
284
286
  // TODO: make sure nothing has moved off screen
285
287
  }
@@ -293,14 +295,6 @@ JSClass("UIWindowServer", JSObject, {
293
295
  this.screen.availableInsets = insets;
294
296
  },
295
297
 
296
- updateRootWindowInsets: function(rootWindow){
297
- var insets = JSInsets.Zero;
298
- if (this._menuBar !== null && this._menuBar.isOpaque){
299
- insets.top = this._menuBar.frame.size.height;
300
- rootWindow.contentInsets = insets;
301
- }
302
- },
303
-
304
298
  // -----------------------------------------------------------------------
305
299
  // MARK: - Text Input Coordination
306
300
 
@@ -346,7 +340,7 @@ JSClass("UIWindowServer", JSObject, {
346
340
  }
347
341
  this.updateScreenAvailableInsets();
348
342
  if (this.windowStack.length > 0 && this._normalLevelRange.location > 0){
349
- this.updateRootWindowInsets(this.windowStack[0]);
343
+ this.layoutWindow(this.windowStack[0]);
350
344
  }
351
345
  },
352
346
 
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKitTesting
3
- JSBundleVersion: 2023.20.0
3
+ JSBundleVersion: 2023.22.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
@@ -0,0 +1,9 @@
1
+ {
2
+ "lang": "en",
3
+ "name": "${PROJECT_NAME}",
4
+ "short_name": "${PROJECT_NAME}",
5
+ "scope": "/",
6
+ "start_url": "/",
7
+ "display": "standalone",
8
+ "shortcuts": []
9
+ }
@@ -222,6 +222,8 @@ HTMLAppBootstrapper.prototype = {
222
222
  this.setStatus(HTMLAppBootstrapper.STATUS.appCrashed);
223
223
  },
224
224
 
225
+ scriptContainerElement: null,
226
+
225
227
  include: function(src, async, callback, errorCallback){
226
228
  try{
227
229
  this.loadingScripts[src] = {
@@ -244,7 +246,11 @@ HTMLAppBootstrapper.prototype = {
244
246
  errorCallback(new Error("Include of '" + src + "' failed"));
245
247
  });
246
248
  script.src = src;
247
- this.rootElement.ownerDocument.body.appendChild(script);
249
+ if (this.scriptContainerElement === null){
250
+ this.scriptContainerElement = this.rootElement.appendChild(this.rootElement.ownerDocument.createElement("div"));
251
+ this.scriptContainerElement.style.display = "none";
252
+ }
253
+ this.scriptContainerElement.appendChild(script);
248
254
  }catch (e){
249
255
  errorCallback(e);
250
256
  }
@@ -2,6 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8">
5
+ <link rel="manifest" href="${PROJECT_NAME}.webmanifest">
5
6
  <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover">
6
7
  <meta name="theme-color" media="(prefers-color-scheme: light)" content="white">
7
8
  <meta name="theme-color" media="(prefers-color-scheme: dark)" content="rgb(38,38,38)">
@@ -166,4 +166,28 @@ self.addEventListener('message', function(event){
166
166
  console.log('Client message to activate ' + cacheKey);
167
167
  self.skipWaiting();
168
168
  }
169
- });
169
+ });
170
+
171
+ // Push notification handling example:
172
+ //
173
+ // self.addEventListener('push', function(event){
174
+ // let message = event.data.json();
175
+ // console.log("received push message", message);
176
+ // if (message.type === "notification"){
177
+ // if (!self.Notification){
178
+ // console.warn("notifications not available");
179
+ // }
180
+ // if (self.Notification.permission !== "granted"){
181
+ // console.warn("notifications permission not granted");
182
+ // }
183
+ // var options = {
184
+ // };
185
+ // if (message.identifier){
186
+ // options.tag = message.identifier;
187
+ // }
188
+ // if (message.body !== null && message.body !== undefined){
189
+ // options.body = message.body;
190
+ // }
191
+ // self.registration.showNotification(message.title, options);
192
+ // }
193
+ // });
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=10.10.0"
10
10
  },
11
11
  "name": "@breakside/jskit",
12
- "version": "2023.20.0",
12
+ "version": "2023.22.0",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"