Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove postcss-nested #3418

Merged
merged 1 commit into from
Jan 4, 2024
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
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"jspdf-autotable": "^3.5.23",
"lodash-es": "^4.17.21",
"postcss": "^8.4.25",
"postcss-nested": "^6.0.1",
"prettier": "3.1.1",
"react": "^18.1.0",
"react-dnd": "^16.0.1",
Expand Down
2 changes: 0 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { isAbsolute } from 'node:path';
import wyw from '@wyw-in-js/rollup';
import postcss from 'rollup-plugin-postcss';
import postcssNested from 'postcss-nested';
import { babel } from '@rollup/plugin-babel';
import nodeResolve from '@rollup/plugin-node-resolve';
import pkg from './package.json' assert { type: 'json' };
Expand Down Expand Up @@ -35,7 +34,6 @@ export default {
}
}),
postcss({
plugins: [postcssNested],
extract: 'styles.css'
}),
babel({
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import './style/layers.css';

export { default, type DataGridProps, type DataGridHandle } from './DataGrid';
export { default as TreeDataGrid, type TreeDataGridProps } from './TreeDataGrid';
export { DataGridDefaultRenderersProvider } from './DataGridDefaultRenderersProvider';
Expand Down
105 changes: 44 additions & 61 deletions src/style/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,72 +37,55 @@ const darkTheme = `
`;

const root = css`
@layer rdg {
@layer Defaults,
FocusSink,
CheckboxInput,
CheckboxIcon,
CheckboxLabel,
Cell,
HeaderCell,
SummaryCell,
EditCell,
Row,
HeaderRow,
SummaryRow,
GroupedRow,
Root;

@layer Defaults {
*,
*::before,
*::after {
box-sizing: inherit;
}
@layer rdg.Defaults {
*,
*::before,
*::after {
box-sizing: inherit;
}
}

@layer Root {
${lightTheme}
--rdg-selection-color: #66afe9;
--rdg-font-size: 14px;

display: grid;

color-scheme: var(--rdg-color-scheme, light dark);

/* https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context */
/* We set a stacking context so internal elements don't render on top of external elements. */
/* size containment is not used as it could break "width: min-content" for example, and the grid would infinitely resize on Chromium browsers */
contain: content;
content-visibility: auto;
block-size: 350px;
border: 1px solid var(--rdg-border-color);
box-sizing: border-box;
overflow: auto;
background-color: var(--rdg-background-color);
color: var(--rdg-color);
font-size: var(--rdg-font-size);

/* needed on Firefox to fix scrollbars */
&::before {
content: '';
grid-column: 1/-1;
grid-row: 1/-1;
}
@layer rdg.Root {
${lightTheme}
--rdg-selection-color: #66afe9;
--rdg-font-size: 14px;

display: grid;

color-scheme: var(--rdg-color-scheme, light dark);

/* https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context */
/* We set a stacking context so internal elements don't render on top of external elements. */
/* size containment is not used as it could break "width: min-content" for example, and the grid would infinitely resize on Chromium browsers */
contain: content;
content-visibility: auto;
block-size: 350px;
border: 1px solid var(--rdg-border-color);
box-sizing: border-box;
overflow: auto;
background-color: var(--rdg-background-color);
color: var(--rdg-color);
font-size: var(--rdg-font-size);

/* needed on Firefox to fix scrollbars */
&::before {
content: '';
grid-column: 1/-1;
grid-row: 1/-1;
}

&.rdg-dark {
--rdg-color-scheme: dark;
${darkTheme}
}
&.rdg-dark {
--rdg-color-scheme: dark;
${darkTheme}
}

&.rdg-light {
--rdg-color-scheme: light;
}
&.rdg-light {
--rdg-color-scheme: light;
}

@media (prefers-color-scheme: dark) {
&:not(.rdg-light) {
${darkTheme}
}
@media (prefers-color-scheme: dark) {
&:not(.rdg-light) {
${darkTheme}
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions src/style/layers.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@layer rdg {
@layer Defaults,
FocusSink,
CheckboxInput,
CheckboxIcon,
CheckboxLabel,
Cell,
HeaderCell,
SummaryCell,
EditCell,
Row,
HeaderRow,
SummaryRow,
GroupedRow,
Root;
}
6 changes: 0 additions & 6 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import react from '@vitejs/plugin-react';
import wyw from '@wyw-in-js/vite';
import postcssNested from 'postcss-nested';
import { defineConfig } from 'vite';

const isCI = process.env.CI === 'true';
Expand All @@ -27,11 +26,6 @@ export default defineConfig({
}),
!isTest && wyw({ preprocessor: 'none' })
],
css: {
postcss: {
plugins: [postcssNested]
}
},
server: {
open: true
},
Expand Down