Skip to content

Commit 3d8176c

Browse files
committed
Add support for CSS anchor positioning rules types
1 parent c66be53 commit 3d8176c

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

.changeset/chilled-lizards-count.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/css': minor
3+
---
4+
5+
Add support for `CSS anchor positioning` rules types

packages/css/src/types.ts

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { CSSVarFunction, MapLeafNodes } from '@vanilla-extract/private';
2-
import type { AtRule, Properties } from 'csstype';
2+
import type { AtRule, Properties, Globals } from 'csstype';
33

44
import type { SimplePseudos } from './simplePseudos';
55

@@ -16,8 +16,43 @@ interface ContainerProperties {
1616
containerName?: string;
1717
}
1818

19+
interface AnchorProperties {
20+
anchorName?: 'none' | `--${string}` | Globals | (string & {});
21+
positionAnchor?: 'auto' | `--${string}` | Globals;
22+
positionArea?:
23+
| 'none'
24+
| 'all'
25+
| 'bottom'
26+
| 'center'
27+
| 'end'
28+
| 'left'
29+
| 'right'
30+
| 'self-end'
31+
| 'self-start'
32+
| 'start'
33+
| 'top'
34+
| 'x-end'
35+
| 'x-start'
36+
| 'y-end'
37+
| 'y-start'
38+
| Globals
39+
| (string & {});
40+
positionTryFallbacks?: 'none' | Globals | (string & {});
41+
positionTry?: 'none' | Globals | (string & {});
42+
positionTryOrder?:
43+
| 'normal'
44+
| 'most-height'
45+
| 'most-width'
46+
| 'most-block-sise'
47+
| 'most-inline-size'
48+
| Globals
49+
| (string & {});
50+
positionVisibility?: 'always' | 'anchors-visible' | 'no-overflow' | Globals;
51+
}
52+
1953
type CSSTypeProperties = Properties<number | (string & {})> &
20-
ContainerProperties;
54+
ContainerProperties &
55+
AnchorProperties;
2156

2257
export type CSSProperties = {
2358
[Property in keyof CSSTypeProperties]:
@@ -52,12 +87,18 @@ export type MediaQueries<StyleType> = Query<'@media', StyleType>;
5287
export type FeatureQueries<StyleType> = Query<'@supports', StyleType>;
5388
export type ContainerQueries<StyleType> = Query<'@container', StyleType>;
5489
export type Layers<StyleType> = Query<'@layer', StyleType>;
90+
export type PositionTryQueries<StyleType> = Query<'@position-try', StyleType>;
91+
export type StartingStyleQueries<StyleType> = {
92+
'@starting-style'?: Omit<StyleType, '@starting-style'>;
93+
};
5594

5695
interface AllQueries<StyleType>
5796
extends MediaQueries<StyleType & AllQueries<StyleType>>,
5897
FeatureQueries<StyleType & AllQueries<StyleType>>,
5998
ContainerQueries<StyleType & AllQueries<StyleType>>,
60-
Layers<StyleType & AllQueries<StyleType>> {}
99+
Layers<StyleType & AllQueries<StyleType>>,
100+
PositionTryQueries<StyleType & AllQueries<StyleType>>,
101+
StartingStyleQueries<StyleType> {}
61102

62103
export type WithQueries<StyleType> = StyleType & AllQueries<StyleType>;
63104

0 commit comments

Comments
 (0)