Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

2.1 KB
Raw Blame
/*
 * Copyright 2025, OpenRemote Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
import type { Preview } from "@storybook/web-components";
import { setStorybookHelpersConfig } from "@wc-toolkit/storybook-helpers";
import { themes } from "storybook/theming";
import "./styles.css";

setStorybookHelpersConfig({
  hideArgRef: true,
  categoryOrder: ["attributes", "slots", "cssProps", "cssParts", "events", "methods"],
});

const style = globalThis.getComputedStyle(document.documentElement);
const preview: Preview = {
  parameters: {
    controls: {
      expanded: true,
      disableSaveFromUI: true,
      presetColors: [
        style.getPropertyValue("--or-color-primary").trim(),
        style.getPropertyValue("--or-color-error").trim(),
        style.getPropertyValue("--or-color-warning").trim(),
        style.getPropertyValue("--or-color-success").trim(),
      ],
      matchers: {
        color: /(background|color)$/i,
        date: /Date$/i,
      },
    },
    docs: {
      theme: themes.light,
      story: {
        inline: false,
      },
      toc: {
        disable: false,
        headingSelector: "h2,h3",
      },
      source: {
        // TODO: Use a proper code formatter like Prettier
        transform: async (source) => source.replaceAll(/&quot;/g, '"'),
      },
    },
    options: {
      storySort: {
        method: "alphabetical",
        order: ["Introduction"],
      },
    },
  },
};

export default preview;