From c3bfde1bf4385af8d5c55c460d0339deeeb011af Mon Sep 17 00:00:00 2001 From: Rohan Bansal Date: Wed, 30 Oct 2024 13:49:41 +0530 Subject: [PATCH] fix: export Stonecrop themes correctly --- aform/src/components/form/ADatePicker.vue | 2 +- aform/src/theme/aform.css | 2 +- aform/src/theme/login.css | 2 +- atable/src/components/ACell.vue | 2 +- atable/src/components/AExpansionRow.vue | 2 +- atable/src/components/ARow.vue | 2 +- atable/src/components/ATable.vue | 2 +- atable/src/components/ATableHeader.vue | 2 +- atable/src/components/ATableModal.vue | 2 +- beam/themes/beam.css | 2 +- common/config/rush/pnpm-lock.yaml | 6 ----- examples/atable/default.story.vue | 2 +- examples/atable/list.story.vue | 2 +- examples/atable/tree.story.vue | 2 +- examples/docbuilder/components/Builder.vue | 2 +- examples/docbuilder/components/Listview.vue | 2 +- themes/.npmignore | 5 ----- themes/README.md | 4 ++-- themes/agritheory/index.ts | 1 + themes/dark/index.ts | 1 + themes/default/index.ts | 1 + themes/excel/index.ts | 1 + themes/index.css | 2 -- themes/index.js | 1 - themes/legal/index.ts | 1 + themes/package.json | 13 ++++++++--- themes/verdant/index.ts | 1 + themes/vite.config.js | 25 ++++++++------------- themes/vue/index.ts | 1 + 29 files changed, 43 insertions(+), 50 deletions(-) create mode 100644 themes/agritheory/index.ts create mode 100644 themes/dark/index.ts create mode 100644 themes/default/index.ts create mode 100644 themes/excel/index.ts delete mode 100644 themes/index.css delete mode 100644 themes/index.js create mode 100644 themes/legal/index.ts create mode 100644 themes/verdant/index.ts create mode 100644 themes/vue/index.ts diff --git a/aform/src/components/form/ADatePicker.vue b/aform/src/components/form/ADatePicker.vue index f8749ae2..0e9a4a63 100644 --- a/aform/src/components/form/ADatePicker.vue +++ b/aform/src/components/form/ADatePicker.vue @@ -156,7 +156,7 @@ useKeyboardNav([ diff --git a/aform/src/theme/aform.css b/aform/src/theme/aform.css index 15d493c7..80fe5bf2 100644 --- a/aform/src/theme/aform.css +++ b/aform/src/theme/aform.css @@ -1 +1 @@ -@import url('@stonecrop/themes/default/default.css'); +@import url('@stonecrop/themes/default.css'); diff --git a/aform/src/theme/login.css b/aform/src/theme/login.css index 4bcbf482..fab0fd30 100644 --- a/aform/src/theme/login.css +++ b/aform/src/theme/login.css @@ -1,2 +1,2 @@ -@import url('@stonecrop/themes/default/default.css'); +@import url('@stonecrop/themes/default.css'); @import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200'); diff --git a/atable/src/components/ACell.vue b/atable/src/components/ACell.vue index 3d9537a0..a08045d4 100644 --- a/atable/src/components/ACell.vue +++ b/atable/src/components/ACell.vue @@ -193,5 +193,5 @@ const cellStyle: CSSProperties = { diff --git a/atable/src/components/AExpansionRow.vue b/atable/src/components/AExpansionRow.vue index 2a76df87..12211458 100644 --- a/atable/src/components/AExpansionRow.vue +++ b/atable/src/components/AExpansionRow.vue @@ -61,5 +61,5 @@ if (addNavigation) { diff --git a/atable/src/components/ARow.vue b/atable/src/components/ARow.vue index 86eef115..6c0434d1 100644 --- a/atable/src/components/ARow.vue +++ b/atable/src/components/ARow.vue @@ -87,5 +87,5 @@ if (addNavigation) { diff --git a/atable/src/components/ATable.vue b/atable/src/components/ATable.vue index 583c1638..93636cc4 100644 --- a/atable/src/components/ATable.vue +++ b/atable/src/components/ATable.vue @@ -224,5 +224,5 @@ window.addEventListener('keydown', (event: KeyboardEvent) => { diff --git a/atable/src/components/ATableHeader.vue b/atable/src/components/ATableHeader.vue index 8f57b2aa..43cd1a9a 100644 --- a/atable/src/components/ATableHeader.vue +++ b/atable/src/components/ATableHeader.vue @@ -34,5 +34,5 @@ const getHeaderCellStyle = (column: TableColumn): CSSProperties => ({ diff --git a/atable/src/components/ATableModal.vue b/atable/src/components/ATableModal.vue index 7d3274fa..abbdd568 100644 --- a/atable/src/components/ATableModal.vue +++ b/atable/src/components/ATableModal.vue @@ -31,5 +31,5 @@ const handleInput = (event: Event) => { diff --git a/beam/themes/beam.css b/beam/themes/beam.css index 441bf8b1..2b176a06 100644 --- a/beam/themes/beam.css +++ b/beam/themes/beam.css @@ -1,4 +1,4 @@ -/* @import url('../../themes/default/default.css'); */ +/* @import url('../../themes/default.css'); */ @import url('https://fonts.googleapis.com/css2?family=Arimo:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap'); /* Style */ diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 20354256..a144f7be 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -634,15 +634,9 @@ importers: ../../themes: devDependencies: - '@vitejs/plugin-vue': - specifier: ^5.1.3 - version: 5.1.3(vite@5.4.6)(vue@3.5.6) vite: specifier: ^5.4.5 version: 5.4.6(sass@1.78.0) - vue: - specifier: ^3.5.6 - version: 3.5.6(typescript@5.6.2) ../../utilities: dependencies: diff --git a/examples/atable/default.story.vue b/examples/atable/default.story.vue index 5c6fb906..f577ac8a 100644 --- a/examples/atable/default.story.vue +++ b/examples/atable/default.story.vue @@ -108,7 +108,7 @@ const full_width_table = ref({ diff --git a/examples/atable/list.story.vue b/examples/atable/list.story.vue index 4f9bf04a..e1943128 100644 --- a/examples/atable/list.story.vue +++ b/examples/atable/list.story.vue @@ -315,7 +315,7 @@ rowNav['keydown.enter'] = rowNav['keydown.down'] diff --git a/examples/atable/tree.story.vue b/examples/atable/tree.story.vue index cb2457d1..a33b3a97 100644 --- a/examples/atable/tree.story.vue +++ b/examples/atable/tree.story.vue @@ -95,7 +95,7 @@ const pinned = ref({ diff --git a/examples/docbuilder/components/Builder.vue b/examples/docbuilder/components/Builder.vue index d30e0e7d..bee826cd 100644 --- a/examples/docbuilder/components/Builder.vue +++ b/examples/docbuilder/components/Builder.vue @@ -88,7 +88,7 @@ const actionElements = [ diff --git a/themes/.npmignore b/themes/.npmignore index 0c5b1f0c..5073370d 100644 --- a/themes/.npmignore +++ b/themes/.npmignore @@ -5,16 +5,11 @@ # Use negative patterns to bring back the specific things we want to publish. !/bin/** -!/src/** -!/src-*/** !/dist/** !ThirdPartyNotice.txt # Ignore certain patterns that should not get published. /dist/*.stats.* -/src/**/test/ -/src-*/**/test/ -*.test.js # NOTE: These don't need to be specified, because NPM includes them automatically. # diff --git a/themes/README.md b/themes/README.md index 35330c4c..ad75ccf0 100644 --- a/themes/README.md +++ b/themes/README.md @@ -14,8 +14,8 @@ This directory contains various themes that can be used in Stonecrop application ## Usage -To use a theme, simply import the stylesheet into your application. For example, to use the `dark` theme: +To use a theme, import the corresponding stylesheet into your application. For example, to use the `dark` theme: ```javascript -import '@stonecrop/themes/dark'; +import '@stonecrop/themes/dark.css'; ``` \ No newline at end of file diff --git a/themes/agritheory/index.ts b/themes/agritheory/index.ts new file mode 100644 index 00000000..dd71f3d3 --- /dev/null +++ b/themes/agritheory/index.ts @@ -0,0 +1 @@ +import './agritheory.css' diff --git a/themes/dark/index.ts b/themes/dark/index.ts new file mode 100644 index 00000000..e8688055 --- /dev/null +++ b/themes/dark/index.ts @@ -0,0 +1 @@ +import './dark.css' diff --git a/themes/default/index.ts b/themes/default/index.ts new file mode 100644 index 00000000..0ddd6711 --- /dev/null +++ b/themes/default/index.ts @@ -0,0 +1 @@ +import './default.css' diff --git a/themes/excel/index.ts b/themes/excel/index.ts new file mode 100644 index 00000000..e972eec9 --- /dev/null +++ b/themes/excel/index.ts @@ -0,0 +1 @@ +import './excel.css' diff --git a/themes/index.css b/themes/index.css deleted file mode 100644 index b86581a4..00000000 --- a/themes/index.css +++ /dev/null @@ -1,2 +0,0 @@ -@import url('https://fonts.googleapis.com/css2?family=Arimo:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap'); -@import url('./default/default.css'); diff --git a/themes/index.js b/themes/index.js deleted file mode 100644 index d2ad33db..00000000 --- a/themes/index.js +++ /dev/null @@ -1 +0,0 @@ -import './index.css' diff --git a/themes/legal/index.ts b/themes/legal/index.ts new file mode 100644 index 00000000..fbb34b96 --- /dev/null +++ b/themes/legal/index.ts @@ -0,0 +1 @@ +import './legal.css' diff --git a/themes/package.json b/themes/package.json index b438742f..281f798b 100644 --- a/themes/package.json +++ b/themes/package.json @@ -14,6 +14,15 @@ "bugs": { "url": "https://github.com/agritheory/stonecrop/issues" }, + "exports": { + "./agritheory.css": "./dist/agritheory.css", + "./dark.css": "./dist/default.css", + "./default.css": "./dist/default.css", + "./excel.css": "./dist/default.css", + "./legal.css": "./dist/default.css", + "./verdant.css": "./dist/default.css", + "./vue.css": "./dist/default.css" + }, "scripts": { "prepublish": "vite build", "build": "vite build", @@ -21,9 +30,7 @@ "preview": "vite preview" }, "devDependencies": { - "@vitejs/plugin-vue": "^5.1.3", - "vite": "^5.4.5", - "vue": "^3.5.6" + "vite": "^5.4.5" }, "publishConfig": { "access": "public" diff --git a/themes/verdant/index.ts b/themes/verdant/index.ts new file mode 100644 index 00000000..c6b6308f --- /dev/null +++ b/themes/verdant/index.ts @@ -0,0 +1 @@ +import './verdant.css' diff --git a/themes/vite.config.js b/themes/vite.config.js index 0f749698..f57df406 100644 --- a/themes/vite.config.js +++ b/themes/vite.config.js @@ -1,28 +1,21 @@ import { resolve } from 'path' import { defineConfig } from 'vite' -import vue from '@vitejs/plugin-vue' const projectRootDir = resolve(__dirname) export default defineConfig({ - plugins: [vue()], - resolve: { - alias: { - '@': resolve(projectRootDir, 'src'), - }, - }, build: { - sourcemap: true, + cssCodeSplit: true, lib: { - entry: resolve(projectRootDir, 'index.js'), name: '@stonecrop/themes', - }, - rollupOptions: { - external: ['vue'], - output: { - globals: { - vue: 'Vue', - }, + entry: { + agritheory: resolve(projectRootDir, 'agritheory/index.ts'), + dark: resolve(projectRootDir, 'dark/index.ts'), + default: resolve(projectRootDir, 'default/index.ts'), + excel: resolve(projectRootDir, 'excel/index.ts'), + legal: resolve(projectRootDir, 'legal/index.ts'), + verdant: resolve(projectRootDir, 'verdant/index.ts'), + vue: resolve(projectRootDir, 'vue/index.ts'), }, }, }, diff --git a/themes/vue/index.ts b/themes/vue/index.ts new file mode 100644 index 00000000..b8896cb4 --- /dev/null +++ b/themes/vue/index.ts @@ -0,0 +1 @@ +import './vue.css'