Skip to content

Commit

Permalink
feat: remove css package
Browse files Browse the repository at this point in the history
  • Loading branch information
toshusai committed Sep 17, 2024
1 parent 8f1a5dd commit 2b61908
Show file tree
Hide file tree
Showing 47 changed files with 100 additions and 118 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ CmpUI is a component library designed for creating complex GUI applications in w

| package name | framework | NPM |
| -------------------- | --------- | --------------------------------------------------------------------------------------------------------------------- |
| @toshusai/cmpui-css | CSS | [![NPM Version](https://img.shields.io/npm/v/%40toshusai%2Fcmpui)](https://www.npmjs.com/package/@toshusai/cmpui-css) |
| @toshusai/cmpui | React | [![NPM Version](https://img.shields.io/npm/v/%40toshusai%2Fcmpui)](https://www.npmjs.com/package/@toshusai/cmpui) |
| @toshusai/cmpui-vue | Vue | WIP |
| @toshusai/cmpui-core | Vanilla | WIP |
Expand All @@ -31,8 +30,7 @@ npm install @toshusai/cmpui

```tsx
import { Button } from "@toshusai/cmpui";
import "@toshusai/cmpui/dist/index.css";
import "@toshusai/cmpui-css/dist/index.css";
import "@toshusai/cmpui-core/dist/style.css";

export default function App() {
return <Button>Hello world</Button>;
Expand Down
10 changes: 8 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@
".": {
"import": {
"default": "./dist/index.es.js",
"types": "./types/index.d.ts"
"types": "./types/index.d.ts",
"style.css": "./dist/style.css"
},
"require": {
"default": "./dist/index.umd.js",
"types": "./types/index.d.ts"
"types": "./types/index.d.ts",
"dist/*": "./dist/*"
}
},
"./dist/*": {
"import": "./dist/*",
"require": "./dist/*"
}
},
"files": [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions packages/core/src/css/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

import "./alpha-checker-board.css";
import "./Button.css";
import "./CanvasView.css";
import "./Checkbox.css";
import "./Chip.css";
import "./Circle.css";
import "./Drawer.css";
import "./FloatBox.css";
import "./global.css";
import "./Grid.css";
import "./horizontal-cursor.css";
import "./IconButton.css";
import "./ListItem.css";
import "./Loading.css";
import "./MenuBarButton.css";
import "./MenuList.css";
import "./Modal.css";
import "./Radio.css";
import "./RectGizmo.css";
import "./Select.css";
import "./Skelton.css";
import "./Slider.css";
import "./SVPicker.css";
import "./Switch.css";
import "./TextInput.css";
import "./Toast.css";
import "./Tooltip.css";
import "./TreeView.css";
3 changes: 2 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

export * from "./Button";
export * from "./CanvasView/createPanDragHandler";
export * from "./CanvasView/handleWheelZoom";
Expand All @@ -21,3 +20,5 @@ export * from "./interactions/createDragHandler";
export * from "./interactions/KeyboardKey";
export * from "./styles/matrixToCss";
export * from "./styles/px";

import "./css/index"
2 changes: 0 additions & 2 deletions packages/core/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import { defineConfig } from "vite";
import path from "path";

export default defineConfig({
plugins: [],
build: {
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
name: "CmpUiCore",
fileName: (format) => `index.${format}.js`,
},
outDir: path.resolve(__dirname, "dist"),
rollupOptions: {},
},
});
45 changes: 45 additions & 0 deletions packages/core/vite.config.split.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { defineConfig } from "vite";
import path from "path";
import { readdirSync, unlinkSync, writeFileSync } from "fs";

function getCssFileNames() {
const dir = path.resolve(__dirname, "src/css");
return readdirSync(dir).filter(
(file) => file.endsWith(".css") && file !== "index.ts"
);
}

export default defineConfig({
plugins: [
{
buildStart: () => {
const dir = path.resolve(__dirname, "src/css");
getCssFileNames().forEach((cssFileName) => {
writeFileSync(
`${dir}/${cssFileName}.ts`,
`import "./${cssFileName}"`
);
});
},
closeBundle: () => {
const dir = path.resolve(__dirname, "src/css");
getCssFileNames().forEach((cssFileName) => {
unlinkSync(`${dir}/${cssFileName}.ts`);
});
},
},
],
build: {
outDir: path.resolve(__dirname, "dist/split"),
rollupOptions: {
input: [
"src/index.ts",
...getCssFileNames().map((file) => `src/css/${file}.ts`),
],
output: {
assetFileNames: "[name][extname]",
entryFileNames: "[name].js",
},
},
},
});
24 changes: 0 additions & 24 deletions packages/css/package.json

This file was deleted.

29 changes: 0 additions & 29 deletions packages/css/src/index.ts

This file was deleted.

25 changes: 0 additions & 25 deletions packages/css/tsconfig.json

This file was deleted.

9 changes: 0 additions & 9 deletions packages/css/tsup.config.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/react/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Decorator, Preview } from "@storybook/react";

import DocumentationTemplate from "./DocumentationTemplate.mdx";

import "@toshusai/cmpui-css/dist/index.css";
import "@toshusai/cmpui-core/dist/style.css";
import "./storybook.css";

const preview: Preview = {
Expand Down
1 change: 0 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"dependencies": {
"@floating-ui/dom": "^1.6.10",
"@toshusai/cmpui-core": "link:../core",
"@toshusai/cmpui-css": "link:../css",
"react-transition-group": "^4.4.5"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Decorator, Preview } from "@storybook/vue3";

import "@toshusai/cmpui-css/dist/index.css";
import "@toshusai/cmpui-core/dist/style.css"

const preview: Preview = {
parameters: {
Expand Down
3 changes: 1 addition & 2 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
},
"dependencies": {
"@floating-ui/dom": "^1.6.10",
"@toshusai/cmpui-core": "link:../core",
"@toshusai/cmpui-css": "link:../css"
"@toshusai/cmpui-core": "link:../core"
},
"peerDependencies": {
"vue": "^3.4.38"
Expand Down
11 changes: 10 additions & 1 deletion packages/vue/src/components/CRectGizmo/CRectGizmo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,26 @@ import {
px,
radToDeg,
createResizeHandler,
Vector2,
} from "@toshusai/cmpui-core";
import { computed, ref } from "vue";
import { corners } from "@toshusai/cmpui-core";
import CCircle from "../CCircle/CCircle.vue";
import { RectGizmoProps } from "@toshusai/cmpui-core";
import { createEdgeHandler, createEdgeStyle } from "@toshusai/cmpui-core";
import { createStepped } from "@toshusai/cmpui-core";
import { createRotateHandler, createRotateStyle } from "@toshusai/cmpui-core";
import { whIndexToCornerName } from "@toshusai/cmpui-core";
export type RectGizmoProps = {
width: number;
height: number;
scale: Vector2;
rotation: number;
position: Vector2;
origin: Vector2;
};
const props = defineProps<RectGizmoProps>();
const emit = defineEmits<{
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/src/components/CSelect/CSelect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { test, expect } from "vitest";
import CSelect from "./CSelect.vue";
import { defineComponent, h, nextTick, ref } from "vue";

import "@toshusai/cmpui-css/dist/index.css";
import "@toshusai/cmpui-core/dist/style.css";

const waitNextTick = () => new Promise<void>((resolve) => nextTick(resolve));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { userEvent } from "@vitest/browser/context";
import { asyncNextTick } from "../../../../test/asyncNextTick";
import { asyncSetTimeout } from "../../../../test/asyncSetTimeout";

import "@toshusai/cmpui-css/dist/index.css";
import "@toshusai/cmpui-core/dist/style.css";
import "../../../../test/test.css";

beforeEach(cleanup);
Expand Down
15 changes: 0 additions & 15 deletions pnpm-lock.yaml

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

0 comments on commit 2b61908

Please sign in to comment.