Skip to content

Commit

Permalink
[themes] export Stonecrop themes correctly (#178)
Browse files Browse the repository at this point in the history
* fix: export Stonecrop themes correctly

* fix: add changelogs

---------

Co-authored-by: Rohan Bansal <[email protected]>
  • Loading branch information
Alchez and Rohan Bansal authored Oct 30, 2024
1 parent 82bc6d2 commit 0f7b886
Show file tree
Hide file tree
Showing 33 changed files with 83 additions and 50 deletions.
2 changes: 1 addition & 1 deletion aform/src/components/form/ADatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ useKeyboardNav([
</script>

<style>
@import url('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
@import url('@/theme/adate.css');
@import url('@/theme/aform.css');
</style>
2 changes: 1 addition & 1 deletion aform/src/theme/aform.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import url('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
2 changes: 1 addition & 1 deletion aform/src/theme/login.css
Original file line number Diff line number Diff line change
@@ -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,[email protected],100..700,0..1,-50..200');
2 changes: 1 addition & 1 deletion atable/src/components/ACell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,5 @@ const cellStyle: CSSProperties = {
</script>

<style>
@import url('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
</style>
2 changes: 1 addition & 1 deletion atable/src/components/AExpansionRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ if (addNavigation) {
</script>

<style>
@import url('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
</style>
2 changes: 1 addition & 1 deletion atable/src/components/ARow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ if (addNavigation) {
</script>

<style>
@import url('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
</style>
2 changes: 1 addition & 1 deletion atable/src/components/ATable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,5 +224,5 @@ window.addEventListener('keydown', (event: KeyboardEvent) => {
</script>

<style>
@import url('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
</style>
2 changes: 1 addition & 1 deletion atable/src/components/ATableHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ const getHeaderCellStyle = (column: TableColumn): CSSProperties => ({
</script>

<style>
@import url('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
</style>
2 changes: 1 addition & 1 deletion atable/src/components/ATableModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ const handleInput = (event: Event) => {
</script>

<style>
@import url('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
</style>
2 changes: 1 addition & 1 deletion beam/themes/beam.css
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@stonecrop/aform",
"comment": "update theme path",
"type": "patch"
}
],
"packageName": "@stonecrop/aform"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@stonecrop/atable",
"comment": "update theme path",
"type": "patch"
}
],
"packageName": "@stonecrop/atable"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@stonecrop/beam",
"comment": "update theme path",
"type": "patch"
}
],
"packageName": "@stonecrop/beam"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@stonecrop/themes",
"comment": "export themes correctly",
"type": "patch"
}
],
"packageName": "@stonecrop/themes"
}
6 changes: 0 additions & 6 deletions common/config/rush/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion examples/atable/default.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const full_width_table = ref({

<style>
@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('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
@import url('@stonecrop/atable/styles');
</style>

Expand Down
2 changes: 1 addition & 1 deletion examples/atable/list.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ rowNav['keydown.enter'] = rowNav['keydown.down']
</script>

<style>
@import url('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
@import url('@stonecrop/atable/styles');
</style>

Expand Down
2 changes: 1 addition & 1 deletion examples/atable/tree.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const pinned = ref({

<style>
@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('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
@import url('@stonecrop/atable/styles');
</style>

Expand Down
2 changes: 1 addition & 1 deletion examples/docbuilder/components/Builder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const actionElements = [

<style>
@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('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
/* @import '../style.css'; */
html,
body {
Expand Down
2 changes: 1 addition & 1 deletion examples/docbuilder/components/Listview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ rowNav['keydown.enter'] = rowNav['keydown.down']

<style>
@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('@stonecrop/themes/default/default.css');
@import url('@stonecrop/themes/default.css');
/* @import '../style.css'; */
</style>
5 changes: 0 additions & 5 deletions themes/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
4 changes: 2 additions & 2 deletions themes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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';
```
1 change: 1 addition & 0 deletions themes/agritheory/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './agritheory.css'
1 change: 1 addition & 0 deletions themes/dark/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './dark.css'
1 change: 1 addition & 0 deletions themes/default/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './default.css'
1 change: 1 addition & 0 deletions themes/excel/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './excel.css'
2 changes: 0 additions & 2 deletions themes/index.css

This file was deleted.

1 change: 0 additions & 1 deletion themes/index.js

This file was deleted.

1 change: 1 addition & 0 deletions themes/legal/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './legal.css'
13 changes: 10 additions & 3 deletions themes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,23 @@
"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",
"dev": "vite",
"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"
Expand Down
1 change: 1 addition & 0 deletions themes/verdant/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './verdant.css'
25 changes: 9 additions & 16 deletions themes/vite.config.js
Original file line number Diff line number Diff line change
@@ -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'),
},
},
},
Expand Down
1 change: 1 addition & 0 deletions themes/vue/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './vue.css'

0 comments on commit 0f7b886

Please sign in to comment.