Skip to content

Commit

Permalink
fix: add missing pseudoclasses for gap, accessiblity and inset classes
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadsammy committed Aug 31, 2020
1 parent 66a32d4 commit 9c7d3a3
Show file tree
Hide file tree
Showing 4 changed files with 465 additions and 12 deletions.
13 changes: 10 additions & 3 deletions src/cli/ClassesGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class ClassesGenerator implements IGenerator {
return {
...defaultClasses.Layout,
objectPosition: Object.keys(this.theme.objectPosition).map(x => 'object-' + x),
topRightBottomLeft: Object.keys(this.theme.inset).flatMap(insetValue => {
inset: Object.keys(this.theme.inset).flatMap(insetValue => {
return ['inset', 'inset-x', 'inset-y', 'top', 'right', 'bottom', 'left'].map(side =>
insetValue.startsWith('-')
? `-${side}-${insetValue.substring(1)}`
Expand Down Expand Up @@ -250,7 +250,7 @@ export class ClassesGenerator implements IGenerator {
gridRow: Object.keys(this.theme.gridRow).map(value => `row-${value}`),
gridRowStart: Object.keys(this.theme.gridRowStart).map(value => `row-start-${value}`),
gridRowEnd: Object.keys(this.theme.gridRowEnd).map(value => `row-end-${value}`),
gridGap: ['gap-', 'gap-y-', 'gap-x-']
gap: ['gap-', 'gap-y-', 'gap-x-']
.concat(this.deprecations.removeDeprecatedGapUtilities ? [] : ['row-gap-', 'col-gap-'])
.flatMap(x => {
// grid gap inherits its values from theme.spacing by default, but theme.gap overrides it.
Expand Down Expand Up @@ -341,7 +341,14 @@ export class ClassesGenerator implements IGenerator {
private pseudoClasses = (): string[] => {
const pseudoClasses: string[] = [];

for (const [variantsKey, variantsForKey] of Object.entries(this.configScanner.getVariants())) {
// HACK
const variantsConfig = Object.entries(
_.merge(this.configScanner.getVariants(), {
screenReaders: this.configScanner.getVariants().accessibility,
}),
);

for (const [variantsKey, variantsForKey] of variantsConfig) {
Object.keys(this.generatedRegularClasses).map(key => {
if (_.has(this.generatedRegularClasses[key as keyof typeof defaultClasses], variantsKey)) {
const generatedClass = _.get(
Expand Down
4 changes: 2 additions & 2 deletions src/cli/default-classes/Grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const deprecatedGridGaps = [
'col-gap-px',
];

const gridGap = [
const gap = [
'gap-0',
'gap-1',
'gap-2',
Expand Down Expand Up @@ -222,6 +222,6 @@ export const Grid = {
gridRow,
gridRowStart,
gridRowEnd,
gridGap,
gap,
gridAutoFlow,
};
4 changes: 2 additions & 2 deletions src/cli/default-classes/Layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const overscrollBehavior = [

const position = ['static', 'fixed', 'absolute', 'relative', 'sticky'];

const topRightBottomLeft = [
const inset = [
'inset-0',
'inset-y-0',
'inset-x-0',
Expand Down Expand Up @@ -104,7 +104,7 @@ export const Layout = {
overflow,
overscrollBehavior,
position,
topRightBottomLeft,
inset,
visibility,
zIndex,
};
Loading

0 comments on commit 9c7d3a3

Please sign in to comment.