Skip to content

Commit 89df158

Browse files
Add all known shorthand properties, constituents, and sibling constituents.
This no longer sorts `border-top` vs. `border-block-start` as they are siblings, not a sibling of a constituent…
1 parent bc029db commit 89df158

File tree

3 files changed

+244
-108
lines changed

3 files changed

+244
-108
lines changed

packages/css/src/plugins/__tests__/sort-shorthand-declarations.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ describe('sort shorthand vs. longhand declarations', () => {
193193
.e {
194194
border-block-start-color: transparent;
195195
}
196-
.d {
196+
.c {
197197
border-block-start: none;
198198
}
199-
.c {
199+
.d {
200200
border-top: none;
201201
}
202202
.b {
@@ -232,10 +232,10 @@ describe('sort shorthand vs. longhand declarations', () => {
232232
.e {
233233
border-block-start-color: transparent;
234234
}
235-
.d {
235+
.c {
236236
border-block-start: none;
237237
}
238-
.c {
238+
.d {
239239
border-top: none;
240240
}
241241
.b {
@@ -268,10 +268,10 @@ describe('sort shorthand vs. longhand declarations', () => {
268268
border: none;
269269
}
270270
.c {
271-
border-top: none;
271+
border-block-start: none;
272272
}
273273
.d {
274-
border-block-start: none;
274+
border-top: none;
275275
}
276276
.d:active {
277277
border-block-start: none;
@@ -296,10 +296,10 @@ describe('sort shorthand vs. longhand declarations', () => {
296296
border: none;
297297
}
298298
.c {
299-
border-top: none;
299+
border-block-start: none;
300300
}
301301
.d {
302-
border-block-start: none;
302+
border-top: none;
303303
}
304304
.e {
305305
border-block-start-color: transparent;
@@ -331,8 +331,8 @@ describe('sort shorthand vs. longhand declarations', () => {
331331
.a {
332332
all: reset;
333333
border: 2px dashed;
334-
border-top: red;
335334
border-block-start: 1px solid;
335+
border-top: red;
336336
border-block-start-color: transparent;
337337
}
338338
.b { all: unset; }

packages/css/src/plugins/sort-shorthand-declarations.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const findDeclaration = (node: ChildNode): Declaration | Declaration[] | undefin
2121

2222
return declarations;
2323
}
24+
25+
return undefined;
2426
};
2527

2628
const sortNodes = (a: ChildNode, b: ChildNode): number => {

0 commit comments

Comments
 (0)