app/assets/js/app.js in coveragebook_components-0.14.0 vs app/assets/js/app.js in coveragebook_components-0.15.0
- old
+ new
@@ -1,30 +1,11 @@
-import { registerComponents } from "@helpers/alpine";
-import { navigateTo } from "@helpers/location";
-import { Alpine } from "./base/setup";
+import "./base/polyfills";
+import Coco from "./coco/coco";
+import baseComponents from "./base/components";
+import bookComponents from "@bookComponents/**/*.js";
+import appComponents from "@appComponents/**/*.js";
-import components from "@components/**/*.js";
-registerComponents(components);
+Coco.registerComponents(baseComponents);
+Coco.registerComponents(bookComponents);
+Coco.registerComponents(appComponents);
-// Global JS navigation handler.
-// Optionally uses Turbo for the page navigation.
-window.addEventListener("app:navigate", (event) => {
- const url = event.detail.url;
- if (url) {
- delete event.detail.url;
- navigateTo(url, event.detail);
- }
-});
-
-// Uodate the value of the `--app-height` css variable
-// when the viewport size changes. To help work around the
-// issues when using 100vh on mobile safari (https://medium.com/quick-code/100vh-problem-with-ios-safari-92ab23c852a8)
-function setAppHeightProperty() {
- document.documentElement.style.setProperty(
- "--app-height",
- `${window.innerHeight}px`
- );
-}
-window.addEventListener("resize", setAppHeightProperty);
-setAppHeightProperty();
-
-Alpine.start();
+export default Coco;