You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2022/11/01 13:15:42 UTC

[myfaces-tobago] branch main updated (c2d015f062 -> c8fb1e51a8)

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


    from c2d015f062 build(deps): bump gson from 2.9.1 to 2.10 (#3365)
     new 54e93bfa6e refactor(typescript): MenuStore
     new c8fb1e51a8 build(theme): rebuild after refactoring typescript (menuStore)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js  |  4 ++--
 .../tobago-theme-standard/src/main/js/tobago.js.map       |  2 +-
 .../tobago-theme-standard/src/main/ts/tobago-dropdown.ts  |  9 +++------
 .../src/main/ts/tobago-menu-store.ts                      | 15 ++++++---------
 .../tobago-theme-standard/src/main/ts/tobago-popover.ts   |  9 +++------
 .../tobago-theme-standard/src/main/ts/tobago-range.ts     |  5 -----
 .../tobago-theme-standard/src/main/ts/tobago-suggest.ts   |  8 ++------
 7 files changed, 17 insertions(+), 35 deletions(-)
 copy tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ObjectUtils.java => tobago-theme/tobago-theme-standard/src/main/ts/tobago-menu-store.ts (73%)


[myfaces-tobago] 02/02: build(theme): rebuild after refactoring typescript (menuStore)

Posted by hn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit c8fb1e51a83038f9324106727e4783573c58fab4
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue Nov 1 14:03:43 2022 +0100

    build(theme): rebuild after refactoring typescript (menuStore)
---
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js     | 4 ++--
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
index c926103e1c..23201d5594 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
@@ -1,8 +1,8 @@
-!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";class e extends HTMLElement{constructor(){super(),this.CssClass={SHOW:"show",COLLAPSE:"collapse",COLLAPSING:"collapsing"},this.toggleButton.addEventListener("click",this.toggleCollapse.bind(this))}connectedCallback(){this.expanded="true"===this.toggleButton.ariaExpanded}toggleCollapse(e){window.clearTimeout(this.timeout),this.expanded?(this.expanded=!1,this.navbarContent.style.height=`${this.navbar [...]
+!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";class e extends HTMLElement{constructor(){super(),this.CssClass={SHOW:"show",COLLAPSE:"collapse",COLLAPSING:"collapsing"},this.toggleButton.addEventListener("click",this.toggleCollapse.bind(this))}connectedCallback(){this.expanded="true"===this.toggleButton.ariaExpanded}toggleCollapse(e){window.clearTimeout(this.timeout),this.expanded?(this.expanded=!1,this.navbarContent.style.height=`${this.navbar [...]
 /*!
     * Bootstrap v5.2.2 (https://getbootstrap.com/)
     * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
     * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
     */
-const Me="transitionend",Re=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s=`#${s.split("#")[1]}`),t=s&&"#"!==s?s.trim():null}return t},je=e=>{const t=Re(e);return t&&document.querySelector(t)?t:null},He=e=>{const t=Re(e);return t?document.querySelector(t):null},qe=e=>{e.dispatchEvent(new Event(Me))},Be=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&( [...]
+const Me="transitionend",Re=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s=`#${s.split("#")[1]}`),t=s&&"#"!==s?s.trim():null}return t},je=e=>{const t=Re(e);return t&&document.querySelector(t)?t:null},He=e=>{const t=Re(e);return t?document.querySelector(t):null},Be=e=>{e.dispatchEvent(new Event(Me))},Pe=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&( [...]
 //# sourceMappingURL=tobago.js.map
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
index 2a8c294e74..eb5c0f3d1c 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
@@ -1 +1 @@
-{"version":3,"file":"tobago.js","sources":["../ts/tobago-bar.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../../node_m [...]
\ No newline at end of file
+{"version":3,"file":"tobago.js","sources":["../ts/tobago-bar.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../../node_m [...]
\ No newline at end of file


[myfaces-tobago] 01/02: refactor(typescript): MenuStore

Posted by hn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 54e93bfa6ef9d3ad747cf0f61f5c3e28d380448d
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue Nov 1 14:00:19 2022 +0100

    refactor(typescript): MenuStore
    
    Use dedicated MenuStore Typescript Class.
---
 .../src/main/ts/tobago-dropdown.ts                 |  9 +++----
 .../src/main/ts/tobago-menu-store.ts               | 29 ++++++++++++++++++++++
 .../src/main/ts/tobago-popover.ts                  |  9 +++----
 .../src/main/ts/tobago-range.ts                    |  5 ----
 .../src/main/ts/tobago-suggest.ts                  |  8 ++----
 5 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-dropdown.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-dropdown.ts
index d542a0925b..edcfbd2194 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-dropdown.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-dropdown.ts
@@ -15,6 +15,8 @@
  * limitations under the License.
  */
 
+import {MenuStore} from "./tobago-menu-store";
+
 const TobagoDropdownEvent = {
   HIDE: "tobago.dropdown.hide",
   HIDDEN: "tobago.dropdown.hidden",
@@ -46,7 +48,7 @@ class Dropdown extends HTMLElement {
     this.dispatchEvent(new CustomEvent(TobagoDropdownEvent.SHOW));
 
     if (!this.insideNavbar()) {
-      this.menuStore.appendChild(this.dropdownMenu);
+      MenuStore.appendChild(this.dropdownMenu);
     }
 
     this.dispatchEvent(new CustomEvent(TobagoDropdownEvent.SHOWN));
@@ -73,11 +75,6 @@ class Dropdown extends HTMLElement {
     const root = this.getRootNode() as ShadowRoot | Document;
     return root.querySelector(`.dropdown-menu[name='${this.id}']`);
   }
-
-  private get menuStore(): HTMLDivElement {
-    const root = this.getRootNode() as ShadowRoot | Document;
-    return root.querySelector(".tobago-page-menuStore");
-  }
 }
 
 document.addEventListener("tobago.init", function (event: Event): void {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-menu-store.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-menu-store.ts
new file mode 100644
index 0000000000..2d988b0bf9
--- /dev/null
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-menu-store.ts
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export class MenuStore {
+  static appendChild<T extends Node>(node: T): T {
+    return MenuStore.get().appendChild(node);
+  }
+
+  static get(): HTMLDivElement {
+    const root = document.getRootNode() as ShadowRoot | Document;
+    return root.querySelector<HTMLDivElement>(".tobago-page-menuStore");
+  }
+}
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-popover.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-popover.ts
index 18558a1947..4a1b83167b 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-popover.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-popover.ts
@@ -20,6 +20,8 @@
 // import Popover from "bootstrap/dist/js/bootstrap.bundle";
 // import {createPopper} from "@popperjs/core/dist/esm/popper";
 import {Popover} from "bootstrap";
+import {MenuStore} from "./tobago-menu-store";
+
 // import {Popover} from "bootstrap/dist/js/bootstrap.bundle";
 
 class TobagoPopover extends HTMLElement {
@@ -32,18 +34,13 @@ class TobagoPopover extends HTMLElement {
 
   connectedCallback(): void {
     this.popover = new Popover(this.trigger, {
-      container: this.menuStore
+      container: MenuStore.get()
     });
   }
 
   get trigger(): HTMLElement {
     return this;
   }
-
-  private get menuStore(): HTMLDivElement {
-    const root = this.getRootNode() as ShadowRoot | Document;
-    return root.querySelector(".tobago-page-menuStore");
-  }
 }
 
 document.addEventListener("tobago.init", function (event: Event): void {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-range.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-range.ts
index 0b99d0471c..dff2bf8139 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-range.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-range.ts
@@ -36,11 +36,6 @@ class TobagoRange extends HTMLElement {
     return this.querySelector(".tobago-tooltip");
   }
 
-  private get menuStore(): HTMLDivElement {
-    const root = this.getRootNode() as ShadowRoot | Document;
-    return root.querySelector(".tobago-page-menuStore");
-  }
-
   private updateTooltip(): void {
     this.tooltip.textContent = this.range.value;
 
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
index d08330110c..bfce3c92c0 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
@@ -17,6 +17,7 @@
 
 import Autocomplete from "@trevoreyre/autocomplete-js";
 import {SuggestFilter} from "./tobago-suggest-filter";
+import {MenuStore} from "./tobago-menu-store";
 
 export class Suggest {
 
@@ -86,7 +87,7 @@ export class Suggest {
 
     new Autocomplete(this.base, options);
     if (!this.localMenu) {
-      this.menuStore.append(this.resultList);
+      MenuStore.appendChild(this.resultList);
     }
   }
 
@@ -201,11 +202,6 @@ export class Suggest {
     return this.base.dataset.position;
   }
 
-  private get menuStore(): HTMLDivElement {
-    const root = this.base.getRootNode() as ShadowRoot | Document;
-    return root.querySelector(".tobago-page-menuStore");
-  }
-
   private get update(): boolean {
     return this.suggest.getAttribute("update") !== null;
   }