qcobjectsnewapp 2.5.8-ts → 2.5.10-ts

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 (31) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/VERSION +1 -1
  3. package/package.json +4 -4
  4. package/public/js/config.js +18 -18
  5. package/public/js/config.js.map +3 -3
  6. package/public/js/customWidgets.js +19 -19
  7. package/public/js/customWidgets.js.map +3 -3
  8. package/public/js/init.js +41 -41
  9. package/public/js/init.js.map +3 -3
  10. package/public/js/packages/com.qcobjects.installer.js +32 -32
  11. package/public/js/packages/com.qcobjects.installer.js.map +3 -3
  12. package/public/js/packages/com.qcobjects.services.github.js +18 -18
  13. package/public/js/packages/com.qcobjects.services.github.js.map +3 -3
  14. package/public/js/packages/com.qcobjects.services.newapp.js +19 -19
  15. package/public/js/packages/com.qcobjects.services.newapp.js.map +3 -3
  16. package/public/js/packages/org.quickcorp.custom.components.js +27 -27
  17. package/public/js/packages/org.quickcorp.custom.components.js.map +3 -3
  18. package/public/js/packages/org.quickcorp.custom.controllers.js +33 -33
  19. package/public/js/packages/org.quickcorp.custom.controllers.js.map +3 -3
  20. package/public/js/packages/org.quickcorp.custom.effects.js +19 -19
  21. package/public/js/packages/org.quickcorp.custom.effects.js.map +3 -3
  22. package/public/js/packages/org.quickcorp.custom.js +41 -41
  23. package/public/js/packages/org.quickcorp.custom.js.map +3 -3
  24. package/public/js/packages/org.quickcorp.custom.models.js +19 -19
  25. package/public/js/packages/org.quickcorp.custom.models.js.map +3 -3
  26. package/public/js/packages/org.quickcorp.custom.views.js +19 -19
  27. package/public/js/packages/org.quickcorp.custom.views.js.map +3 -3
  28. package/spec/testsSpec.js +8 -3
  29. package/src/js/packages/com.qcobjects.installer.ts +5 -5
  30. package/src/js/packages/org.quickcorp.custom.components.ts +4 -4
  31. package/src/js/packages/org.quickcorp.custom.controllers.ts +19 -4
package/spec/testsSpec.js CHANGED
@@ -7,7 +7,8 @@ const {
7
7
  New,
8
8
  Component,
9
9
  Effect,
10
- logger
10
+ logger,
11
+ global
11
12
  } = require("qcobjects");
12
13
  const { NotificationComponent } = require("qcobjects-sdk");
13
14
 
@@ -37,9 +38,13 @@ describe("QCObjects Main Test", function () {
37
38
  logger.debug("Existence of Effect Class... OK");
38
39
  });
39
40
 
40
- it("global exposes QCObjects classes", function () {
41
- expect(typeof global.Component).toEqual("function");
41
+ it("global exposes QCObjects classes (shared context)", function () {
42
+ // global is the shared context (== _top); classes are consumed via direct
43
+ // import or ClassFactory since core 2.7.0 deduped the ambient global.
44
+ expect(typeof global).toEqual("object");
42
45
  expect(typeof global.Class).toEqual("function");
46
+ expect(ClassFactory("Component")).toEqual(Component);
47
+ expect(typeof Component).toEqual("function");
43
48
  logger.debug("global as QCObjects global... OK");
44
49
  });
45
50
 
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-unreachable */
2
2
  "use strict";
3
- import global, { InheritClass, Package, logger } from "qcobjects";
3
+ import { InheritClass, Package, logger, set, get } from "qcobjects";
4
4
  import { NotificationComponent } from "qcobjects-sdk";
5
5
 
6
6
  Package("com.qcobjects.installer", [
@@ -32,7 +32,7 @@ Package("com.qcobjects.installer", [
32
32
  }
33
33
  NotificationComponent.success(`TWA in ${displayMode} Mode`);
34
34
  });
35
- global.set("installer", this);
35
+ set("installer", this);
36
36
  }
37
37
 
38
38
  /**
@@ -45,7 +45,7 @@ Package("com.qcobjects.installer", [
45
45
  beforeinstallprompt (e: Event) {
46
46
  logger.debug("registering installer event");
47
47
  e.preventDefault();
48
- global.set("promptEvent", e);
48
+ set("promptEvent", e);
49
49
  this.root.classList.add("available");
50
50
  return false;
51
51
  }
@@ -56,7 +56,7 @@ Package("com.qcobjects.installer", [
56
56
  */
57
57
  installed () {
58
58
  logger.debug("app is already installed");
59
- global.set("promptEvent", null);
59
+ set("promptEvent", null);
60
60
  // This fires after onbeforinstallprompt OR after manual add to homescreen.
61
61
  this.root.classList.remove("available");
62
62
  }
@@ -68,7 +68,7 @@ Package("com.qcobjects.installer", [
68
68
  install () {
69
69
  const root = this.root;
70
70
  logger.debug("installer actioned");
71
- let promptEvent = global.get("promptEvent", null);
71
+ let promptEvent = get("promptEvent", null);
72
72
  if (promptEvent) {
73
73
  logger.debug("prompt event");
74
74
 
@@ -111,10 +111,10 @@ class AdminSidebarOption extends AdminCheckComponent {
111
111
  <details>
112
112
  <summary>Admin</summary>
113
113
  <ul>
114
- <li><a onclick="global.sideNavController.close();return true;" href="/admin">Admin Tool</a></li>
115
- <li><a onclick="global.sideNavController.close();return true;" href="/admin/plugins">Plugins</a></li>
116
- <li><a onclick="global.sideNavController.close();return true;" href="/admin/handlers">Handlers</a></li>
117
- <li><a onclick="global.sideNavController.close();return true;" href="/admin/libs">Libs</a></li>
114
+ <li><a href="/admin">Admin Tool</a></li>
115
+ <li><a href="/admin/plugins">Plugins</a></li>
116
+ <li><a href="/admin/handlers">Handlers</a></li>
117
+ <li><a href="/admin/libs">Libs</a></li>
118
118
  </ul>
119
119
  </details>
120
120
 
@@ -3,7 +3,7 @@
3
3
  /* eslint-disable no-unused-vars */
4
4
  "use strict";
5
5
 
6
- import global, { Package, Controller, logger, _DOMCreateElement,
6
+ import { Package, Controller, logger, _DOMCreateElement, set,
7
7
  type Effect, New, ClassFactory, type QCObjectsElement,
8
8
  type QCObjectsShadowedElement, type Component, type ControllerParams } from "qcobjects";
9
9
  import { Fade } from "qcobjects-sdk";
@@ -46,7 +46,7 @@ Package("org.quickcorp.custom.controllers", [
46
46
  } else {
47
47
  this.componentRoot = this.component.body;
48
48
  }
49
- (global as any).sideNavController = this;
49
+ set("sideNavController", this);
50
50
  this.effect = new Fade({
51
51
  duration: 300
52
52
  });
@@ -54,10 +54,21 @@ Package("org.quickcorp.custom.controllers", [
54
54
 
55
55
  done(...args: any[]) {
56
56
  const _ret_ = super.done(args);
57
+ this.bindControls();
57
58
  this.close();
58
59
  return _ret_;
59
60
  }
60
61
 
62
+ bindControls() {
63
+ if (this.componentRoot) {
64
+ const navLinks = (this.componentRoot as QCObjectsElement)?.subelements("a[href]");
65
+ navLinks?.map((link: HTMLElement) => {
66
+ link.addEventListener("click", () => this.close());
67
+ return link;
68
+ });
69
+ }
70
+ }
71
+
61
72
  open() {
62
73
  if (this.componentRoot !== null) {
63
74
  if (this.effect != null) {
@@ -111,9 +122,13 @@ Package("org.quickcorp.custom.controllers", [
111
122
  }
112
123
 
113
124
  loadInstallerButton() {
114
- const componentRoot = (this.component.shadowed != null)
115
- ? (this.component.shadowRoot as QCObjectsShadowedElement)
125
+ const componentRoot = this.component.shadowed
126
+ ? (this.component.shadowRoot as QCObjectsShadowedElement)
116
127
  : (this.component.body as QCObjectsElement);
128
+ if (typeof componentRoot === "undefined" || componentRoot === null) {
129
+ logger.debug("HeaderController has no component root yet, skipping installer button");
130
+ return;
131
+ }
117
132
  componentRoot.subelements("#installerbutton").map(
118
133
  (element) => {
119
134
  this.installer = New(ClassFactory("Installer"), element);