From e066e72a7bbe3f112794e3510dae1ccee86d5188 Mon Sep 17 00:00:00 2001 From: Lukas Mestel Date: Thu, 28 Sep 2023 17:42:48 +0200 Subject: [PATCH] fix: add manager.js entry point, fix doc container style --- .storybook/main.ts | 2 +- bundle.js | 2 +- manager.js | 1 + package.json | 4 ++-- preset.js | 12 ------------ src/Panel.tsx | 3 +++ src/{preset => }/manager.ts | 4 ++-- 7 files changed, 10 insertions(+), 18 deletions(-) create mode 100644 manager.js delete mode 100644 preset.js rename src/{preset => }/manager.ts (74%) diff --git a/.storybook/main.ts b/.storybook/main.ts index b873424..5664723 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -5,7 +5,7 @@ const config: StorybookConfig = { "../stories/**/*.mdx", "../stories/**/*.stories.@(js|jsx|ts|tsx)", ], - addons: ["../preset.js", "@storybook/addon-essentials"], + addons: ["@storybook/addon-essentials", "../manager.js"], framework: { name: '@storybook/react-vite', options: {} diff --git a/bundle.js b/bundle.js index 9881adb..20935af 100644 --- a/bundle.js +++ b/bundle.js @@ -3,7 +3,7 @@ const { nodeExternalsPlugin } = require("esbuild-node-externals"); /** @type import("esbuild").BuildOptions */ const sharedConfig = { - entryPoints: ["src/index.ts", "src/preset/manager.ts"], + entryPoints: ["src/index.ts", "src/manager.ts"], bundle: true, platform: "browser", format: "esm", diff --git a/manager.js b/manager.js new file mode 100644 index 0000000..b4aa441 --- /dev/null +++ b/manager.js @@ -0,0 +1 @@ +export * from "./dist/esm/manager"; \ No newline at end of file diff --git a/package.json b/package.json index 22da75c..65d3a99 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "module": "dist/esm/index.js", "types": "dist/ts/index.d.ts", "files": [ - "dist" + "dist", "manager.js" ], "scripts": { "clean": "rimraf ./dist", @@ -29,7 +29,7 @@ "prepare": "patch-package", "build": "yarn buildJs && yarn buildTsc", "test": "echo \"Error: no test specified\" && exit 1", - "storybook": "storybook dev -p 6006", + "storybook": "storybook dev -p 6007", "start": "yarn build && yarn storybook", "build-storybook": "storybook build", "release": "yarn build && auto shipit" diff --git a/preset.js b/preset.js deleted file mode 100644 index 91a357d..0000000 --- a/preset.js +++ /dev/null @@ -1,12 +0,0 @@ -function config(entry = []) { - return [...entry]; -} - -function managerEntries(entry = []) { - return [...entry, require.resolve("./dist/esm/preset/manager")]; -} - -module.exports = { - managerEntries, - config, -}; diff --git a/src/Panel.tsx b/src/Panel.tsx index 1a09bb0..7c8caf5 100644 --- a/src/Panel.tsx +++ b/src/Panel.tsx @@ -9,6 +9,9 @@ interface PanelProps { } const PanelContainer = styled.div` + position: absolute; + inset: 0; + > div { height: 100%; } diff --git a/src/preset/manager.ts b/src/manager.ts similarity index 74% rename from src/preset/manager.ts rename to src/manager.ts index 98879e5..2174473 100644 --- a/src/preset/manager.ts +++ b/src/manager.ts @@ -1,7 +1,7 @@ import { addons, types } from "@storybook/manager-api"; -import { ADDON_ID, PANEL_ID } from "../constants"; -import { Panel } from "../Panel"; +import { ADDON_ID, PANEL_ID } from "./constants"; +import { Panel } from "./Panel"; addons.register(ADDON_ID, () => { addons.add(PANEL_ID, {