-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfieldset-legend.css
160 lines (159 loc) · 4.39 KB
/
fieldset-legend.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/* fieldset-legend
// BSD 2-Clause License
// Copyright (c) Jane Ori, PropJockey, 2025
*/
@property --fl_px {
syntax: "<length>"; initial-value: 0px; inherits: true;
}
@property --fl_hw {
syntax: "<number>"; initial-value: 0; inherits: true;
}
@keyframes --fl_hw {
from { --fl_hw: 0; } to { --fl_hw: 1000; }
}
@property --fl_hh {
syntax: "<number>"; initial-value: 0; inherits: true;
}
@keyframes --fl_hh {
from { --fl_hh: 0; } to { --fl_hh: 1000; }
}
@supports (timeline-scope: --propjockey\\io) and (view-timeline: --propjockey\\io) {
:root { --fl-supported: ; --fl-not-supported: initial; }
:where(
.fieldset-legend,
.fieldset-legend-before,
.fieldset-legend-after,
.fieldset-legend-custom
) {
box-sizing: border-box;
position: relative;
container-type: inline-size;
isolation: isolate;
--fl-top: initial;
--fl-sink: initial;
--fl-left: initial;
--fl-center: initial;
--fl-right: initial;
animation: --fl_hw 1ms linear, --fl_hh 1ms linear;
animation-timeline: --fl_hw, --fl_hh;
animation-range: entry 100% exit 100%;
timeline-scope: --fl_hw, --fl_hh;
--fl_hwint: calc(1000 / (1000 - var(--fl_hw)) * 10);
--fl_hhint: calc(1000 / (1000 - var(--fl_hh)) * 5);
margin: 0px;
margin-top: calc(var(--fl_hhint) / 2 * 1px - var(--fl-top, 0px));
&:not(.fieldset-legend-custom) { visibility: hidden; }
&:not(:has(> .fieldset-legend-title)) > :first-child,
> .fieldset-legend-title {
box-sizing: border-box;
margin: 0px;
}
&::before, &::after, > :not(&) {
visibility: visible;
--fl_px: 100cqw;
--fl_int: calc(1000 * tan(atan2(var(--fl_px), 1000px)));
--fl_leftness: 0px;
@container style(--fl-left) {
--fl_leftness: var(--fl-left);
}
@container style(--fl-center) {
--fl_leftness: calc(
50% -
((var(--fl_hwint) / 2) * 1px) +
var(--fl-center)
);
}
@container style(--fl-right) {
--fl_leftness: calc(
100% -
(var(--fl_hwint) * 1px) -
var(--fl-right)
);
}
--fl-mask: linear-gradient(
to right,
black 0px var(--fl_leftness),
transparent 0px calc(
var(--fl_leftness) + (var(--fl_hwint) * 1px)
),
black 0px
), linear-gradient(
transparent 0px calc(
var(--fl-sink,
(var(--fl_hhint) / 2) * 1px +
var(--fl-top, 0px)
)
),
black 0px
);
}
&:not(:has(> .fieldset-legend-title)) > :first-child,
> .fieldset-legend-title {
position: absolute;
overflow: hidden;
top: var(--fl-top, 0px);
left: var(--fl_leftness);
transform: translateY(-50%);
&::before {
content: "";
position: absolute;
left: 0px;
top: 0px;
width: 10px;
height: 5px;
view-timeline: --fl_hw inline, --fl_hh block;
}
}
&.fieldset-legend::before,
&.fieldset-legend-before::before,
&.fieldset-legend-after::after {
background: inherit;
border-radius: inherit;
border: inherit;
outline: inherit;
outline-offset: inherit;
content: "";
position: absolute;
inset: 0px;
z-index: -1;
-webkit-mask: var(--fl-mask);
mask: var(--fl-mask);
}
}
}
@supports not ((timeline-scope: --propjockey\\io) and (view-timeline: --propjockey\\io)) {
:root { --fl-supported: initial; --fl-not-supported: ; }
:where(
.fieldset-legend,
.fieldset-legend-before,
.fieldset-legend-after,
.fieldset-legend-custom
) {
position: relative;
isolation: isolate;
--fl-fallback-title-color: initial;
--fl-fallback-title-background: initial;
}
:is(
.fieldset-legend,
.fieldset-legend-before,
.fieldset-legend-after,
.fieldset-legend-custom
):not(:has(> .fieldset-legend-title)) > :first-child {
display: block;
margin: 0px;
color: var(--fl-fallback-title-color, currentColor)!important;
background: var(--fl-fallback-title-background, transparent)!important;
}
:is(
.fieldset-legend,
.fieldset-legend-before,
.fieldset-legend-after,
.fieldset-legend-custom
) > .fieldset-legend-title {
display: block;
margin: 0px;
color: var(--fl-fallback-title-color, currentColor)!important;
background: var(--fl-fallback-title-background, transparent)!important;
}
}