@react-spectrum/s2 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/private/Modal.cjs +12 -0
- package/dist/private/Modal.cjs.map +1 -1
- package/dist/private/Modal.css +30 -0
- package/dist/private/Modal.css.map +1 -1
- package/dist/private/Modal.mjs +12 -0
- package/dist/private/Modal.mjs.map +1 -1
- package/dist/private/Popover.cjs +12 -0
- package/dist/private/Popover.cjs.map +1 -1
- package/dist/private/Popover.css +28 -0
- package/dist/private/Popover.css.map +1 -1
- package/dist/private/Popover.mjs +12 -0
- package/dist/private/Popover.mjs.map +1 -1
- package/dist/private/Provider.cjs +12 -0
- package/dist/private/Provider.cjs.map +1 -1
- package/dist/private/Provider.css +37 -0
- package/dist/private/Provider.css.map +1 -1
- package/dist/private/Provider.mjs +12 -0
- package/dist/private/Provider.mjs.map +1 -1
- package/dist/private/TableView.cjs +12 -0
- package/dist/private/TableView.cjs.map +1 -1
- package/dist/private/TableView.css +28 -0
- package/dist/private/TableView.css.map +1 -1
- package/dist/private/TableView.mjs +12 -0
- package/dist/private/TableView.mjs.map +1 -1
- package/dist/private/Tooltip.cjs +12 -0
- package/dist/private/Tooltip.cjs.map +1 -1
- package/dist/private/Tooltip.css +28 -0
- package/dist/private/Tooltip.css.map +1 -1
- package/dist/private/Tooltip.mjs +12 -0
- package/dist/private/Tooltip.mjs.map +1 -1
- package/dist/types/src/style-utils.d.ts +26 -0
- package/package.json +3 -2
- package/page.css +11 -0
- package/page.css.map +1 -1
- package/src/page.macro.ts +26 -0
- package/src/style-utils.ts +30 -1
- package/style/__tests__/style-macro.test.js +71 -71
- package/style/dist/style-utils.cjs +30 -1
- package/style/dist/style-utils.cjs.map +1 -1
- package/style/dist/style-utils.mjs +30 -1
- package/style/dist/style-utils.mjs.map +1 -1
|
@@ -170,6 +170,32 @@ export declare const setColorScheme: () => {
|
|
|
170
170
|
};
|
|
171
171
|
};
|
|
172
172
|
readonly colorScheme: "--s2-color-scheme";
|
|
173
|
+
readonly '--lightningcss-light': {
|
|
174
|
+
readonly type: "transform";
|
|
175
|
+
readonly value: {
|
|
176
|
+
readonly colorScheme: {
|
|
177
|
+
readonly 'light dark': {
|
|
178
|
+
readonly default: "initial";
|
|
179
|
+
readonly '@media (prefers-color-scheme: dark)': " ";
|
|
180
|
+
};
|
|
181
|
+
readonly light: "initial";
|
|
182
|
+
readonly dark: " ";
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
readonly '--lightningcss-dark': {
|
|
187
|
+
readonly type: "transform";
|
|
188
|
+
readonly value: {
|
|
189
|
+
readonly colorScheme: {
|
|
190
|
+
readonly 'light dark': {
|
|
191
|
+
readonly default: " ";
|
|
192
|
+
readonly '@media (prefers-color-scheme: dark)': "initial";
|
|
193
|
+
};
|
|
194
|
+
readonly light: " ";
|
|
195
|
+
readonly dark: "initial";
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
};
|
|
173
199
|
};
|
|
174
200
|
export declare function staticColor(): Record<string, any>;
|
|
175
201
|
export declare const controlFont: () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/s2",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Spectrum 2 UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"./page.css": {
|
|
26
26
|
"source": "./src/page.ts",
|
|
27
|
+
"types": "./dist/types/src/page.d.ts",
|
|
27
28
|
"default": "./page.css"
|
|
28
29
|
},
|
|
29
30
|
"./style": {
|
|
@@ -95,5 +96,5 @@
|
|
|
95
96
|
"publishConfig": {
|
|
96
97
|
"access": "public"
|
|
97
98
|
},
|
|
98
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "a4bd206e65891004d3b559e5cb74508803a6ad8d"
|
|
99
100
|
}
|
package/page.css
CHANGED
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
background: var(--s2-container-bg);
|
|
6
6
|
--s2-scale: 1;
|
|
7
7
|
--s2-font-size-base: 14;
|
|
8
|
+
--lightningcss-light: initial;
|
|
9
|
+
--lightningcss-dark: ;
|
|
10
|
+
|
|
11
|
+
@media (prefers-color-scheme: dark) {
|
|
12
|
+
--lightningcss-light: ;
|
|
13
|
+
--lightningcss-dark: initial;
|
|
14
|
+
}
|
|
8
15
|
|
|
9
16
|
@media not ((hover: hover) and (pointer: fine)) {
|
|
10
17
|
--s2-scale: 1.25;
|
|
@@ -13,10 +20,14 @@
|
|
|
13
20
|
|
|
14
21
|
&[data-color-scheme="light"] {
|
|
15
22
|
--s2-color-scheme: light;
|
|
23
|
+
--lightningcss-light: initial;
|
|
24
|
+
--lightningcss-dark: ;
|
|
16
25
|
}
|
|
17
26
|
|
|
18
27
|
&[data-color-scheme="dark"] {
|
|
19
28
|
--s2-color-scheme: dark;
|
|
29
|
+
--lightningcss-light: ;
|
|
30
|
+
--lightningcss-dark: initial;
|
|
20
31
|
}
|
|
21
32
|
|
|
22
33
|
&[data-background="layer-1"] {
|
package/page.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAcA
|
|
1
|
+
{"mappings":"AAcA;;;;;;;;;;EAAA;IAAA;;;;EAAA;IAAA;;;;EAAA;;;;;;EAAA;;;;;;EAAA;;;;EAAA","sources":["packages/@react-spectrum/s2/src/page.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {generatePageStyles} from './page.macro' with {type: 'macro'};\n\ngeneratePageStyles();\n"],"names":[],"version":3,"file":"page.css.map"}
|
package/src/page.macro.ts
CHANGED
|
@@ -33,6 +33,17 @@ export function generatePageStyles(this: MacroContext | void): void {
|
|
|
33
33
|
--s2-scale: 1;
|
|
34
34
|
--s2-font-size-base: 14;
|
|
35
35
|
|
|
36
|
+
/* For backward compatibility in two cases:
|
|
37
|
+
* 1. When a component compiled with an earlier version of S2 is embedded in a newer provider.
|
|
38
|
+
* 2. When S2 CSS is compiled with lightningcss, setting color-scheme via a variable does not work. */
|
|
39
|
+
--lightningcss-light: initial;
|
|
40
|
+
--lightningcss-dark: ;
|
|
41
|
+
|
|
42
|
+
@media (prefers-color-scheme: dark) {
|
|
43
|
+
--lightningcss-light: ;
|
|
44
|
+
--lightningcss-dark: initial;
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
@media not ((hover: hover) and (pointer: fine)) {
|
|
37
48
|
--s2-scale: 1.25;
|
|
38
49
|
--s2-font-size-base: 17;
|
|
@@ -40,10 +51,14 @@ export function generatePageStyles(this: MacroContext | void): void {
|
|
|
40
51
|
|
|
41
52
|
&[data-color-scheme=light] {
|
|
42
53
|
--s2-color-scheme: light;
|
|
54
|
+
--lightningcss-light: initial;
|
|
55
|
+
--lightningcss-dark: ;
|
|
43
56
|
}
|
|
44
57
|
|
|
45
58
|
&[data-color-scheme=dark] {
|
|
46
59
|
--s2-color-scheme: dark;
|
|
60
|
+
--lightningcss-light: ;
|
|
61
|
+
--lightningcss-dark: initial;
|
|
47
62
|
}
|
|
48
63
|
|
|
49
64
|
&[data-background=layer-1] {
|
|
@@ -74,6 +89,17 @@ export function generateDefaultColorSchemeStyles(this: MacroContext | void): voi
|
|
|
74
89
|
--s2-scale: 1;
|
|
75
90
|
--s2-font-size-base: 14;
|
|
76
91
|
|
|
92
|
+
/* For backward compatibility in two cases:
|
|
93
|
+
* 1. When a component compiled with an earlier version of S2 is embedded in a newer provider.
|
|
94
|
+
* 2. When S2 CSS is compiled with lightningcss, setting color-scheme via a variable does not work. */
|
|
95
|
+
--lightningcss-light: initial;
|
|
96
|
+
--lightningcss-dark: ;
|
|
97
|
+
|
|
98
|
+
@media (prefers-color-scheme: dark) {
|
|
99
|
+
--lightningcss-light: ;
|
|
100
|
+
--lightningcss-dark: initial;
|
|
101
|
+
}
|
|
102
|
+
|
|
77
103
|
@media not ((hover: hover) and (pointer: fine)) {
|
|
78
104
|
--s2-scale: 1.25;
|
|
79
105
|
--s2-font-size-base: 17;
|
package/src/style-utils.ts
CHANGED
|
@@ -162,7 +162,36 @@ export const setColorScheme = () => ({
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
},
|
|
165
|
-
colorScheme: '--s2-color-scheme'
|
|
165
|
+
colorScheme: '--s2-color-scheme',
|
|
166
|
+
// For backward compatibility in two cases:
|
|
167
|
+
// 1. When a component compiled with an earlier version of S2 is embedded in a newer provider.
|
|
168
|
+
// 2. When S2 CSS is compiled with lightningcss, setting color-scheme via a variable does not work.
|
|
169
|
+
'--lightningcss-light': {
|
|
170
|
+
type: 'transform', // arbitrary string
|
|
171
|
+
value: {
|
|
172
|
+
colorScheme: {
|
|
173
|
+
'light dark': {
|
|
174
|
+
default: 'initial',
|
|
175
|
+
'@media (prefers-color-scheme: dark)': ' '
|
|
176
|
+
},
|
|
177
|
+
light: 'initial',
|
|
178
|
+
dark: ' '
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
'--lightningcss-dark': {
|
|
183
|
+
type: 'transform', // arbitrary string
|
|
184
|
+
value: {
|
|
185
|
+
colorScheme: {
|
|
186
|
+
'light dark': {
|
|
187
|
+
default: ' ',
|
|
188
|
+
'@media (prefers-color-scheme: dark)': 'initial'
|
|
189
|
+
},
|
|
190
|
+
light: ' ',
|
|
191
|
+
dark: 'initial'
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
166
195
|
} as const);
|
|
167
196
|
|
|
168
197
|
export function staticColor(): Record<string, any> {
|
|
@@ -40,26 +40,26 @@ describe('style-macro', () => {
|
|
|
40
40
|
"@layer _.a, _.b, _.c;
|
|
41
41
|
|
|
42
42
|
@layer _.b {
|
|
43
|
-
.
|
|
43
|
+
.Jbs131:first-child {
|
|
44
44
|
margin-top: 0.25rem;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
@layer _.c.p {
|
|
49
49
|
@media (min-width: 64rem) {
|
|
50
|
-
.
|
|
50
|
+
.Jbpv131:first-child {
|
|
51
51
|
margin-top: 0.5rem;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.-macro-static-
|
|
57
|
-
--macro-data-
|
|
56
|
+
.-macro-static-MypNfe {
|
|
57
|
+
--macro-data-MypNfe: {"style":{"marginTop":{":first-child":{"default":4,"lg":8}}},"loc":"undefined:undefined:undefined"};
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
"
|
|
61
61
|
`);
|
|
62
|
-
expect(js).toMatchInlineSnapshot('"
|
|
62
|
+
expect(js).toMatchInlineSnapshot('" Jbs131 Jbpv131 -macro-static-MypNfe"');
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('should support self references', () => {
|
|
@@ -73,59 +73,59 @@ describe('style-macro', () => {
|
|
|
73
73
|
"@layer _.a;
|
|
74
74
|
|
|
75
75
|
@layer _.a {
|
|
76
|
-
.
|
|
76
|
+
._kc131 {
|
|
77
77
|
border-top-width: 2px;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
.
|
|
81
|
+
.hc131 {
|
|
82
82
|
border-bottom-width: 2px;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
.
|
|
86
|
+
.mCPFGYc131 {
|
|
87
87
|
border-inline-start-width: var(--m);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
|
|
91
|
-
.
|
|
91
|
+
.lc131 {
|
|
92
92
|
border-inline-end-width: 2px;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
|
|
96
|
-
.
|
|
96
|
+
.SMBFGYc131 {
|
|
97
97
|
padding-inline-start: var(--S);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
|
|
101
|
-
.
|
|
101
|
+
.Rv131 {
|
|
102
102
|
padding-inline-end: calc(var(--F, var(--M)) * 3 / 8);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
.
|
|
106
|
+
.ZjUQgKd131 {
|
|
107
107
|
width: calc(200px - var(--m) - var(--S));
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
.-m_-
|
|
111
|
+
.-m_-mc131 {
|
|
112
112
|
--m: 2px;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
.-S_-
|
|
116
|
+
.-S_-Sv131 {
|
|
117
117
|
--S: calc(var(--F, var(--M)) * 3 / 8);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
.-macro-static-
|
|
122
|
-
--macro-data-
|
|
121
|
+
.-macro-static-uhFF5b {
|
|
122
|
+
--macro-data-uhFF5b: {"style":{"borderWidth":2,"paddingX":"edge-to-text","width":"calc(200px - self(borderStartWidth) - self(paddingStart))"},"loc":"undefined:undefined:undefined"};
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
"
|
|
126
126
|
`);
|
|
127
127
|
|
|
128
|
-
expect(js).toMatchInlineSnapshot('"
|
|
128
|
+
expect(js).toMatchInlineSnapshot('" _kc131 hc131 mCPFGYc131 lc131 SMBFGYc131 Rv131 ZjUQgKd131 -m_-mc131 -S_-Sv131 -macro-static-uhFF5b"');
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
it('should support allowed overrides', () => {
|
|
@@ -142,9 +142,9 @@ describe('style-macro', () => {
|
|
|
142
142
|
color: 'green-400'
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
-
expect(js()).toMatchInlineSnapshot('"
|
|
146
|
-
expect(overrides).toMatchInlineSnapshot('"
|
|
147
|
-
expect(js({}, overrides)).toMatchInlineSnapshot('"
|
|
145
|
+
expect(js()).toMatchInlineSnapshot('" gw131 pg131 -macro-dynamic-mu4yby"');
|
|
146
|
+
expect(overrides).toMatchInlineSnapshot('" g8tmWqb131 pHJ3AUd131 -macro-static-CvspF"');
|
|
147
|
+
expect(js({}, overrides)).toMatchInlineSnapshot('" g8tmWqb131 pg131 -macro-dynamic-1b9jdne"');
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
it('should support allowed overrides for properties that expand into multiple', () => {
|
|
@@ -159,9 +159,9 @@ describe('style-macro', () => {
|
|
|
159
159
|
translateX: 40
|
|
160
160
|
});
|
|
161
161
|
|
|
162
|
-
expect(js()).toMatchInlineSnapshot('" -_7PloMd-
|
|
163
|
-
expect(overrides).toMatchInlineSnapshot('" -_7PloMd-
|
|
164
|
-
expect(js({}, overrides)).toMatchInlineSnapshot('" -_7PloMd-
|
|
162
|
+
expect(js()).toMatchInlineSnapshot('" -_7PloMd-B131 __Ya131 -macro-dynamic-4f51mn"');
|
|
163
|
+
expect(overrides).toMatchInlineSnapshot('" -_7PloMd-D131 __Ya131 -macro-static-nMoh6b"');
|
|
164
|
+
expect(js({}, overrides)).toMatchInlineSnapshot('" -_7PloMd-D131 __Ya131 -macro-dynamic-f33ipt"');
|
|
165
165
|
});
|
|
166
166
|
|
|
167
167
|
it('should support allowed overrides for shorthands', () => {
|
|
@@ -176,9 +176,9 @@ describe('style-macro', () => {
|
|
|
176
176
|
padding: 40
|
|
177
177
|
});
|
|
178
178
|
|
|
179
|
-
expect(js()).toMatchInlineSnapshot('"
|
|
180
|
-
expect(overrides).toMatchInlineSnapshot('"
|
|
181
|
-
expect(js({}, overrides)).toMatchInlineSnapshot('"
|
|
179
|
+
expect(js()).toMatchInlineSnapshot('" Tk131 Qk131 Sk131 Rk131 -macro-dynamic-efgw2h"');
|
|
180
|
+
expect(overrides).toMatchInlineSnapshot('" Tm131 Qm131 Sm131 Rm131 -macro-static-9GxvHb"');
|
|
181
|
+
expect(js({}, overrides)).toMatchInlineSnapshot('" Tm131 Qm131 Sm131 Rm131 -macro-dynamic-15z7wbl"');
|
|
182
182
|
});
|
|
183
183
|
|
|
184
184
|
it('should support allowed overrides for fontSize', () => {
|
|
@@ -193,9 +193,9 @@ describe('style-macro', () => {
|
|
|
193
193
|
fontSize: 'ui-xs'
|
|
194
194
|
});
|
|
195
195
|
|
|
196
|
-
expect(js()).toMatchInlineSnapshot('" -_6BNtrc-
|
|
197
|
-
expect(overrides).toMatchInlineSnapshot('" -_6BNtrc-
|
|
198
|
-
expect(js({}, overrides)).toMatchInlineSnapshot('" -_6BNtrc-
|
|
196
|
+
expect(js()).toMatchInlineSnapshot('" -_6BNtrc-woabcc131 vx131 -macro-dynamic-zj2kbi"');
|
|
197
|
+
expect(overrides).toMatchInlineSnapshot('" -_6BNtrc-a131 vx131 -macro-static-EPvKFd"');
|
|
198
|
+
expect(js({}, overrides)).toMatchInlineSnapshot('" -_6BNtrc-a131 vx131 -macro-dynamic-jkg234"');
|
|
199
199
|
});
|
|
200
200
|
|
|
201
201
|
it("should support allowed overrides for values that aren't defined", () => {
|
|
@@ -210,9 +210,9 @@ describe('style-macro', () => {
|
|
|
210
210
|
minWidth: 32
|
|
211
211
|
});
|
|
212
212
|
|
|
213
|
-
expect(js()).toMatchInlineSnapshot('"
|
|
214
|
-
expect(overrides).toMatchInlineSnapshot('"
|
|
215
|
-
expect(js({}, overrides)).toMatchInlineSnapshot('"
|
|
213
|
+
expect(js()).toMatchInlineSnapshot('" gE131 -macro-dynamic-1osl3dc"');
|
|
214
|
+
expect(overrides).toMatchInlineSnapshot('" Nk131 -macro-static-J7ItY"');
|
|
215
|
+
expect(js({}, overrides)).toMatchInlineSnapshot('" Nk131 gE131 -macro-dynamic-1soyf0e"');
|
|
216
216
|
});
|
|
217
217
|
|
|
218
218
|
it('should support runtime conditions', () => {
|
|
@@ -233,32 +233,32 @@ describe('style-macro', () => {
|
|
|
233
233
|
"@layer _.a;
|
|
234
234
|
|
|
235
235
|
@layer _.a {
|
|
236
|
-
.
|
|
236
|
+
.gH131 {
|
|
237
237
|
background-color: light-dark(rgb(233, 233, 233), rgb(44, 44, 44));
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
|
|
241
|
-
.
|
|
241
|
+
.gF131 {
|
|
242
242
|
background-color: light-dark(rgb(225, 225, 225), rgb(50, 50, 50));
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
|
|
246
|
-
.
|
|
246
|
+
.gE131 {
|
|
247
247
|
background-color: light-dark(rgb(218, 218, 218), rgb(57, 57, 57));
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
|
|
251
|
-
.
|
|
251
|
+
.pt131 {
|
|
252
252
|
color: light-dark(rgb(41, 41, 41), rgb(219, 219, 219));
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
|
|
256
|
-
.
|
|
256
|
+
.po131 {
|
|
257
257
|
color: light-dark(rgb(19, 19, 19), rgb(242, 242, 242));
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
|
|
261
|
-
.
|
|
261
|
+
.pm131 {
|
|
262
262
|
color: light-dark(rgb(0, 0, 0), rgb(255, 255, 255));
|
|
263
263
|
}
|
|
264
264
|
}
|
|
@@ -266,9 +266,9 @@ describe('style-macro', () => {
|
|
|
266
266
|
"
|
|
267
267
|
`);
|
|
268
268
|
|
|
269
|
-
expect(js({})).toMatchInlineSnapshot('"
|
|
270
|
-
expect(js({isHovered: true})).toMatchInlineSnapshot('"
|
|
271
|
-
expect(js({isPressed: true})).toMatchInlineSnapshot('"
|
|
269
|
+
expect(js({})).toMatchInlineSnapshot('" gH131 pt131 -macro-dynamic-15nvpf0"');
|
|
270
|
+
expect(js({isHovered: true})).toMatchInlineSnapshot('" gF131 po131 -macro-dynamic-1g7f3s5"');
|
|
271
|
+
expect(js({isPressed: true})).toMatchInlineSnapshot('" gE131 pm131 -macro-dynamic-1nv6ioy"');
|
|
272
272
|
});
|
|
273
273
|
|
|
274
274
|
it('should support nested runtime conditions', () => {
|
|
@@ -287,32 +287,32 @@ describe('style-macro', () => {
|
|
|
287
287
|
"@layer _.a;
|
|
288
288
|
|
|
289
289
|
@layer _.a {
|
|
290
|
-
.
|
|
290
|
+
.gH131 {
|
|
291
291
|
background-color: light-dark(rgb(233, 233, 233), rgb(44, 44, 44));
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
|
|
295
|
-
.
|
|
295
|
+
.gF131 {
|
|
296
296
|
background-color: light-dark(rgb(225, 225, 225), rgb(50, 50, 50));
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
|
|
300
|
-
.
|
|
300
|
+
.g_h131 {
|
|
301
301
|
background-color: light-dark(rgb(75, 117, 255), rgb(64, 105, 253));
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
|
|
305
|
-
.
|
|
305
|
+
.g3131 {
|
|
306
306
|
background-color: light-dark(rgb(59, 99, 251), rgb(86, 129, 255));
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
"
|
|
311
311
|
`);
|
|
312
|
-
expect(js({})).toMatchInlineSnapshot('"
|
|
313
|
-
expect(js({isHovered: true})).toMatchInlineSnapshot('"
|
|
314
|
-
expect(js({isSelected: true})).toMatchInlineSnapshot('"
|
|
315
|
-
expect(js({isSelected: true, isHovered: true})).toMatchInlineSnapshot('"
|
|
312
|
+
expect(js({})).toMatchInlineSnapshot('" gH131 -macro-dynamic-43fbrn"');
|
|
313
|
+
expect(js({isHovered: true})).toMatchInlineSnapshot('" gF131 -macro-dynamic-1tkkitt"');
|
|
314
|
+
expect(js({isSelected: true})).toMatchInlineSnapshot('" g_h131 -macro-dynamic-zzf86q"');
|
|
315
|
+
expect(js({isSelected: true, isHovered: true})).toMatchInlineSnapshot('" g3131 -macro-dynamic-19tzf3y"');
|
|
316
316
|
});
|
|
317
317
|
|
|
318
318
|
it('should support variant runtime conditions', () => {
|
|
@@ -326,9 +326,9 @@ describe('style-macro', () => {
|
|
|
326
326
|
}
|
|
327
327
|
});
|
|
328
328
|
|
|
329
|
-
expect(js({variant: 'accent'})).toMatchInlineSnapshot('"
|
|
330
|
-
expect(js({variant: 'primary'})).toMatchInlineSnapshot('"
|
|
331
|
-
expect(js({variant: 'secondary'})).toMatchInlineSnapshot('"
|
|
329
|
+
expect(js({variant: 'accent'})).toMatchInlineSnapshot('" gY131 -macro-dynamic-ea1kkk"');
|
|
330
|
+
expect(js({variant: 'primary'})).toMatchInlineSnapshot('" gjQquMe131 -macro-dynamic-17nl5q"');
|
|
331
|
+
expect(js({variant: 'secondary'})).toMatchInlineSnapshot('" gw131 -macro-dynamic-fjccci"');
|
|
332
332
|
});
|
|
333
333
|
|
|
334
334
|
it('supports runtime conditions nested inside css conditions', () => {
|
|
@@ -346,14 +346,14 @@ describe('style-macro', () => {
|
|
|
346
346
|
|
|
347
347
|
@layer _.b.l {
|
|
348
348
|
@media (forced-colors: active) {
|
|
349
|
-
.
|
|
349
|
+
.plb131 {
|
|
350
350
|
color: ButtonText;
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
|
|
355
355
|
@media (forced-colors: active) {
|
|
356
|
-
.
|
|
356
|
+
.ple131 {
|
|
357
357
|
color: HighlightText;
|
|
358
358
|
}
|
|
359
359
|
}
|
|
@@ -362,8 +362,8 @@ describe('style-macro', () => {
|
|
|
362
362
|
"
|
|
363
363
|
`);
|
|
364
364
|
|
|
365
|
-
expect(js({})).toMatchInlineSnapshot('"
|
|
366
|
-
expect(js({isSelected: true})).toMatchInlineSnapshot('"
|
|
365
|
+
expect(js({})).toMatchInlineSnapshot('" plb131 -macro-dynamic-a7vfaa"');
|
|
366
|
+
expect(js({isSelected: true})).toMatchInlineSnapshot('" ple131 -macro-dynamic-ojtpnp"');
|
|
367
367
|
});
|
|
368
368
|
|
|
369
369
|
it('inherits parent default when nested branch has no default key', () => {
|
|
@@ -379,8 +379,8 @@ describe('style-macro', () => {
|
|
|
379
379
|
});
|
|
380
380
|
// forcedColors.default should apply when variant=highlight but !isSelected
|
|
381
381
|
expect(css).toContain('ButtonText');
|
|
382
|
-
expect(js({variant: 'highlight'})).toMatchInlineSnapshot('"
|
|
383
|
-
expect(js({variant: 'highlight', isSelected: true})).toMatchInlineSnapshot('"
|
|
382
|
+
expect(js({variant: 'highlight'})).toMatchInlineSnapshot('" plb131 -macro-dynamic-a7vfaa"');
|
|
383
|
+
expect(js({variant: 'highlight', isSelected: true})).toMatchInlineSnapshot('" ple131 -macro-dynamic-ojtpnp"');
|
|
384
384
|
});
|
|
385
385
|
|
|
386
386
|
it('should expand shorthand properties to longhands', () => {
|
|
@@ -388,33 +388,33 @@ describe('style-macro', () => {
|
|
|
388
388
|
padding: 24
|
|
389
389
|
});
|
|
390
390
|
|
|
391
|
-
expect(js).toMatchInlineSnapshot('"
|
|
391
|
+
expect(js).toMatchInlineSnapshot('" Th131 Qh131 Sh131 Rh131 -macro-static-D80Fbe"');
|
|
392
392
|
expect(css).toMatchInlineSnapshot(`
|
|
393
393
|
"@layer _.a;
|
|
394
394
|
|
|
395
395
|
@layer _.a {
|
|
396
|
-
.
|
|
396
|
+
.Th131 {
|
|
397
397
|
padding-top: 24px;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
|
|
401
|
-
.
|
|
401
|
+
.Qh131 {
|
|
402
402
|
padding-bottom: 24px;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
|
|
406
|
-
.
|
|
406
|
+
.Sh131 {
|
|
407
407
|
padding-inline-start: 24px;
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
|
|
411
|
-
.
|
|
411
|
+
.Rh131 {
|
|
412
412
|
padding-inline-end: 24px;
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
.-macro-static-
|
|
417
|
-
--macro-data-
|
|
416
|
+
.-macro-static-D80Fbe {
|
|
417
|
+
--macro-data-D80Fbe: {"style":{"padding":24},"loc":"undefined:undefined:undefined"};
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
"
|
|
@@ -430,13 +430,13 @@ describe('style-macro', () => {
|
|
|
430
430
|
"@layer _.a;
|
|
431
431
|
|
|
432
432
|
@layer _.a {
|
|
433
|
-
.
|
|
433
|
+
.gpQzfVb131 {
|
|
434
434
|
background-color: rgb(from light-dark(rgb(39, 77, 234), rgb(105, 149, 254)) r g b / 50%);
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
-
.-macro-static-
|
|
439
|
-
--macro-data-
|
|
438
|
+
.-macro-static-aOn8Q {
|
|
439
|
+
--macro-data-aOn8Q: {"style":{"backgroundColor":"blue-1000/50"},"loc":"undefined:undefined:undefined"};
|
|
440
440
|
}
|
|
441
441
|
|
|
442
442
|
"
|
|
@@ -455,13 +455,13 @@ describe('style-macro', () => {
|
|
|
455
455
|
"@layer _.a;
|
|
456
456
|
|
|
457
457
|
@layer _.a {
|
|
458
|
-
.-FUeYm-
|
|
458
|
+
.-FUeYm-gE131 {
|
|
459
459
|
--foo: light-dark(rgb(218, 218, 218), rgb(57, 57, 57));
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
|
|
463
|
-
.-macro-static-
|
|
464
|
-
--macro-data-
|
|
463
|
+
.-macro-static-kFNJUb {
|
|
464
|
+
--macro-data-kFNJUb: {"style":{"--foo":{"type":"backgroundColor","value":"gray-300"}},"loc":"undefined:undefined:undefined"};
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
"
|
|
@@ -139,7 +139,36 @@ const $247833060df99ecf$export$f2d00fe8ce80fd84 = ()=>({
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
},
|
|
142
|
-
colorScheme: '--s2-color-scheme'
|
|
142
|
+
colorScheme: '--s2-color-scheme',
|
|
143
|
+
// For backward compatibility in two cases:
|
|
144
|
+
// 1. When a component compiled with an earlier version of S2 is embedded in a newer provider.
|
|
145
|
+
// 2. When S2 CSS is compiled with lightningcss, setting color-scheme via a variable does not work.
|
|
146
|
+
'--lightningcss-light': {
|
|
147
|
+
type: 'transform',
|
|
148
|
+
value: {
|
|
149
|
+
colorScheme: {
|
|
150
|
+
'light dark': {
|
|
151
|
+
default: 'initial',
|
|
152
|
+
'@media (prefers-color-scheme: dark)': ' '
|
|
153
|
+
},
|
|
154
|
+
light: 'initial',
|
|
155
|
+
dark: ' '
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
'--lightningcss-dark': {
|
|
160
|
+
type: 'transform',
|
|
161
|
+
value: {
|
|
162
|
+
colorScheme: {
|
|
163
|
+
'light dark': {
|
|
164
|
+
default: ' ',
|
|
165
|
+
'@media (prefers-color-scheme: dark)': 'initial'
|
|
166
|
+
},
|
|
167
|
+
light: ' ',
|
|
168
|
+
dark: 'initial'
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
143
172
|
});
|
|
144
173
|
function $247833060df99ecf$export$1750a8f222a9157d() {
|
|
145
174
|
return {
|