Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions packages/shapes/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { StorybookConfig } from "@storybook/vue3-vite";
import vue from "@vitejs/plugin-vue";
import path from "node:path";
import { mergeConfig } from "vite";

const r = (...p: string[]) => path.resolve(__dirname, ...p);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change this to resolvePath or something, the 'r' is a little too short imo

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skill issue


const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@chromatic-com/storybook",
"@storybook/addon-docs",
"@storybook/addon-a11y",
],
framework: {
name: "@storybook/vue3-vite",
options: {},
},
viteFinal: async (config) => {
return mergeConfig(config, {
plugins: [vue()],
resolve: {
alias: {
"@magic/graph": r("../../graph/src"),
"@magic/utils": r("../../utils/src"),
"@magic/ui": r("../../ui/src"),
"@magic/shapes": r("../../shapes/src"),
"@magic/canvas": r("../../canvas/src"),
"@magic/products": r("../../products/src"),
vue: r("../../../node_modules/vue"),
primevue: r("../../../node_modules/primevue"),
},
},
});
},
};
export default config;
14 changes: 14 additions & 0 deletions packages/shapes/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Preview } from '@storybook/vue3-vite'

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
8 changes: 7 additions & 1 deletion packages/shapes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
"name": "@magic/shapes",
"version": "1.0.0",
"private": true,
"type": "module",
"exports": {
"./*": "./src/*"
},
"scripts": {
"build:types": "tsc -b ."
"build:types": "tsc -b .",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"peerDependencies": {
"vue": "^3.5.18"
Expand All @@ -17,8 +20,11 @@
"tinycolor2": "^1.6.0"
},
"devDependencies": {
"storybook": "^9.0.1",
"@storybook/vue3-vite": "^9.0.1",
"@types/tinycolor2": "^1.4.6",
"@vitejs/plugin-vue": "^5.0.5",
"vite": "^7.1.10",
"vue": "^3.5.18"
}
}
12 changes: 6 additions & 6 deletions packages/shapes/src/shapes/ellipse/elllipse.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import {
DEFAULT_STORIES,
DOC_MARKING_DEFAULTS,
createDocComponent,
} from '../../docs';
import type { Meta, StoryObj } from '@storybook/vue3-vite';
} from "../../docs";
import type { Meta, StoryObj } from "@storybook/vue3-vite";

import { ellipse } from '.';
import { ELLIPSE_SCHEMA_DEFAULTS } from './defaults';
import type { EllipseSchema } from './types';
import { ellipse } from ".";
import { ELLIPSE_SCHEMA_DEFAULTS } from "./defaults";
import type { EllipseSchema } from "./types";

const Ellipse = createDocComponent<EllipseSchema>(ellipse);

const meta = {
title: 'Shapes/Ellipse',
title: "Shapes/Ellipse",
component: Ellipse,
args: {
...ELLIPSE_SCHEMA_DEFAULTS,
Expand Down
6 changes: 3 additions & 3 deletions packages/shapes/src/shapes/ellipse/hitbox.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
areBoundingBoxesOverlapping,
normalizeBoundingBox,
} from '../../helpers';
import type { BoundingBox, Coordinate } from '../../types/utility';
} from "../../helpers";
import type { BoundingBox, Coordinate } from "../../types/utility";

import type { EllipseSchemaWithDefaults } from './defaults';
import type { EllipseSchemaWithDefaults } from "./defaults";

export const ellipseHitbox =
(schema: EllipseSchemaWithDefaults) => (point: Coordinate) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/shapes/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist/types",
"rootDir": "./src",
"rootDir": ".",
"paths": {
"@magic/utils/*": ["../utils/src/*"],
"@magic/canvas/*": ["../canvas/src/*"]
}
},
"references": [{ "path": "../utils" }, { "path": "../canvas" }],
"include": ["./src/**/*"],
"exclude": ["./dist", "**/node_modules", "**/*.stories.ts"]
"include": ["./src/**/*", "./.storybook/**/*"],
"exclude": ["./dist", "**/node_modules"]
}
114 changes: 91 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading