Sha256: ffc4a440663528033371b2fb0f6facaa304599a033ea4bbca1b7dab8e74662d6

Contents?: true

Size: 1.88 KB

Versions: 21

Compression:

Stored size: 1.88 KB

Contents

import Alpine from "alpinejs";

import Morph from "@alpinejs/morph";
import Persist from "@alpinejs/persist";
import Collapse from "@alpinejs/morph";
import Tooltip from "@ryangjchandler/alpine-tooltip";

import Logger, { log } from "./plugins/logger";

import initLayoutStore from "./stores/layout";
import initNavStore from "./stores/nav";
import initInspectorStore from "./stores/inspector";
import initPagesStore from "./stores/pages";
import initSettingsStore from "./stores/settings";
import initWorkbenchStore from "./stores/workbench";

import app from "./app";

// Note: A ParcelJS issue prevents loading all depths of component JS files in one glob,
// so need to split it up. Path aliases also do not work with the glob imports.
import { getComponents } from "./helpers/build";
import * as components from "../../app/components/lookbook/*/*component.js";
import * as subComponents from "../../app/components/lookbook/*/*/component.js";
import * as jsComponents from "./components/*.js";

// Plugins

Alpine.plugin(Morph);
Alpine.plugin(Persist);
Alpine.plugin(Collapse);
Alpine.plugin(Tooltip);
Alpine.plugin(Logger);

// Stores
const prefix = window.APP_NAME;
Alpine.store("layout", initLayoutStore(Alpine, { prefix }));
Alpine.store("nav", initNavStore(Alpine, { prefix }));
Alpine.store("inspector", initInspectorStore(Alpine, { prefix }));
Alpine.store("pages", initPagesStore(Alpine, { prefix }));
Alpine.store("settings", initSettingsStore(Alpine, { prefix }));

if (process.env.NODE_ENV !== "production") {
  Alpine.store("workbench", initWorkbenchStore(Alpine, { prefix }));
}

// Components

Alpine.data("app", app);

[components, subComponents, jsComponents].forEach((scripts) => {
  const components = getComponents(scripts);
  Object.keys(components).forEach((name) => {
    Alpine.data(`${name}Component`, components[name]);
  });
});

// Init

window.log = log;
window.Alpine = Alpine;
Alpine.start();

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
lookbook-2.3.4 assets/js/index.js
lookbook-2.3.3 assets/js/index.js
lookbook-2.3.2 assets/js/index.js
lookbook-2.3.0 assets/js/index.js
lookbook-2.2.2 assets/js/index.js
lookbook-2.2.1 assets/js/index.js
lookbook-2.2.0 assets/js/index.js
lookbook-2.1.1 assets/js/index.js
lookbook-2.1.0 assets/js/index.js
lookbook-2.0.5 assets/js/index.js
lookbook-2.0.4 assets/js/index.js
lookbook-2.0.3 assets/js/index.js
lookbook-2.0.2 assets/js/index.js
lookbook-2.0.1 assets/js/index.js
lookbook-2.0.0 assets/js/index.js
lookbook-2.0.0.rc.3 assets/js/index.js
lookbook-2.0.0.rc.2 assets/js/index.js
lookbook-2.0.0.rc.1 assets/js/index.js
lookbook-2.0.0.beta.9 assets/js/index.js
lookbook-2.0.0.beta.8 assets/js/index.js