@react-spectrum/s2 3.0.0-nightly-63d4359d6-250428 → 3.0.0-nightly-1dd65ffc5-250430
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/Accordion.cjs +4 -5
- package/dist/Accordion.cjs.map +1 -1
- package/dist/Accordion.css +2 -4
- package/dist/Accordion.css.map +1 -1
- package/dist/Accordion.mjs +4 -5
- package/dist/Accordion.mjs.map +1 -1
- package/dist/ActionBar.cjs +72 -63
- package/dist/ActionBar.cjs.map +1 -1
- package/dist/ActionBar.css +70 -63
- package/dist/ActionBar.css.map +1 -1
- package/dist/ActionBar.mjs +72 -63
- package/dist/ActionBar.mjs.map +1 -1
- package/dist/ActionButton.cjs +161 -160
- package/dist/ActionButton.cjs.map +1 -1
- package/dist/ActionButton.css +174 -168
- package/dist/ActionButton.css.map +1 -1
- package/dist/ActionButton.mjs +161 -160
- package/dist/ActionButton.mjs.map +1 -1
- package/dist/ActionButtonGroup.cjs +17 -18
- package/dist/ActionButtonGroup.cjs.map +1 -1
- package/dist/ActionButtonGroup.css +9 -11
- package/dist/ActionButtonGroup.css.map +1 -1
- package/dist/ActionButtonGroup.mjs +17 -18
- package/dist/ActionButtonGroup.mjs.map +1 -1
- package/dist/AlertDialog.cjs +4 -4
- package/dist/AlertDialog.css +3 -5
- package/dist/AlertDialog.css.map +1 -1
- package/dist/AlertDialog.mjs +4 -4
- package/dist/Avatar.cjs +21 -21
- package/dist/Avatar.css +14 -16
- package/dist/Avatar.css.map +1 -1
- package/dist/Avatar.mjs +21 -21
- package/dist/AvatarGroup.cjs +131 -110
- package/dist/AvatarGroup.cjs.map +1 -1
- package/dist/AvatarGroup.css +43 -49
- package/dist/AvatarGroup.css.map +1 -1
- package/dist/AvatarGroup.mjs +131 -110
- package/dist/AvatarGroup.mjs.map +1 -1
- package/dist/Badge.cjs +150 -149
- package/dist/Badge.cjs.map +1 -1
- package/dist/Badge.css +140 -134
- package/dist/Badge.css.map +1 -1
- package/dist/Badge.mjs +150 -149
- package/dist/Badge.mjs.map +1 -1
- package/dist/Breadcrumbs.cjs +169 -154
- package/dist/Breadcrumbs.cjs.map +1 -1
- package/dist/Breadcrumbs.css +119 -105
- package/dist/Breadcrumbs.css.map +1 -1
- package/dist/Breadcrumbs.mjs +169 -154
- package/dist/Breadcrumbs.mjs.map +1 -1
- package/dist/Button.cjs +321 -275
- package/dist/Button.cjs.map +1 -1
- package/dist/Button.css +245 -215
- package/dist/Button.css.map +1 -1
- package/dist/Button.mjs +321 -275
- package/dist/Button.mjs.map +1 -1
- package/dist/ButtonGroup.cjs +27 -25
- package/dist/ButtonGroup.cjs.map +1 -1
- package/dist/ButtonGroup.css +15 -17
- package/dist/ButtonGroup.css.map +1 -1
- package/dist/ButtonGroup.mjs +27 -25
- package/dist/ButtonGroup.mjs.map +1 -1
- package/dist/Card.cjs +316 -299
- package/dist/Card.cjs.map +1 -1
- package/dist/Card.css +242 -215
- package/dist/Card.css.map +1 -1
- package/dist/Card.mjs +316 -299
- package/dist/Card.mjs.map +1 -1
- package/dist/CardView.cjs +29 -30
- package/dist/CardView.cjs.map +1 -1
- package/dist/CardView.css +19 -19
- package/dist/CardView.mjs +29 -30
- package/dist/CardView.mjs.map +1 -1
- package/dist/CenterBaseline.cjs +2 -2
- package/dist/CenterBaseline.css +3 -5
- package/dist/CenterBaseline.css.map +1 -1
- package/dist/CenterBaseline.mjs +2 -2
- package/dist/Checkbox.cjs +114 -112
- package/dist/Checkbox.cjs.map +1 -1
- package/dist/Checkbox.css +99 -93
- package/dist/Checkbox.css.map +1 -1
- package/dist/Checkbox.mjs +114 -112
- package/dist/Checkbox.mjs.map +1 -1
- package/dist/CheckboxGroup.cjs +54 -54
- package/dist/CheckboxGroup.css +42 -42
- package/dist/CheckboxGroup.mjs +54 -54
- package/dist/ClearButton.cjs +19 -19
- package/dist/ClearButton.css +19 -21
- package/dist/ClearButton.css.map +1 -1
- package/dist/ClearButton.mjs +19 -19
- package/dist/CloseButton.cjs +64 -62
- package/dist/CloseButton.cjs.map +1 -1
- package/dist/CloseButton.css +48 -48
- package/dist/CloseButton.mjs +64 -62
- package/dist/CloseButton.mjs.map +1 -1
- package/dist/ColorArea.cjs +28 -28
- package/dist/ColorArea.css +17 -17
- package/dist/ColorArea.mjs +28 -28
- package/dist/ColorField.cjs +41 -41
- package/dist/ColorField.css +33 -33
- package/dist/ColorField.mjs +41 -41
- package/dist/ColorHandle.cjs +29 -29
- package/dist/ColorHandle.css +45 -45
- package/dist/ColorHandle.mjs +29 -29
- package/dist/ColorSlider.cjs +68 -64
- package/dist/ColorSlider.cjs.map +1 -1
- package/dist/ColorSlider.css +64 -58
- package/dist/ColorSlider.css.map +1 -1
- package/dist/ColorSlider.mjs +68 -64
- package/dist/ColorSlider.mjs.map +1 -1
- package/dist/ColorSwatch.cjs +44 -38
- package/dist/ColorSwatch.cjs.map +1 -1
- package/dist/ColorSwatch.css +29 -31
- package/dist/ColorSwatch.css.map +1 -1
- package/dist/ColorSwatch.mjs +44 -38
- package/dist/ColorSwatch.mjs.map +1 -1
- package/dist/ColorSwatchPicker.cjs +31 -32
- package/dist/ColorSwatchPicker.cjs.map +1 -1
- package/dist/ColorSwatchPicker.css +48 -48
- package/dist/ColorSwatchPicker.css.map +1 -1
- package/dist/ColorSwatchPicker.mjs +31 -32
- package/dist/ColorSwatchPicker.mjs.map +1 -1
- package/dist/ColorWheel.cjs +28 -28
- package/dist/ColorWheel.css +18 -18
- package/dist/ColorWheel.mjs +28 -28
- package/dist/ComboBox.cjs +108 -108
- package/dist/ComboBox.css +101 -101
- package/dist/ComboBox.mjs +108 -108
- package/dist/ContextualHelp.cjs +5 -5
- package/dist/ContextualHelp.css +58 -44
- package/dist/ContextualHelp.css.map +1 -1
- package/dist/ContextualHelp.mjs +5 -5
- package/dist/CustomDialog.cjs +38 -38
- package/dist/CustomDialog.css +26 -26
- package/dist/CustomDialog.mjs +38 -38
- package/dist/Dialog.cjs +18 -18
- package/dist/Dialog.css +86 -72
- package/dist/Dialog.css.map +1 -1
- package/dist/Dialog.mjs +18 -18
- package/dist/Disclosure.cjs +139 -133
- package/dist/Disclosure.cjs.map +1 -1
- package/dist/Disclosure.css +144 -120
- package/dist/Disclosure.css.map +1 -1
- package/dist/Disclosure.mjs +139 -133
- package/dist/Disclosure.mjs.map +1 -1
- package/dist/Divider.cjs +47 -47
- package/dist/Divider.css +26 -26
- package/dist/Divider.mjs +47 -47
- package/dist/DropZone.cjs +68 -64
- package/dist/DropZone.cjs.map +1 -1
- package/dist/DropZone.css +66 -60
- package/dist/DropZone.css.map +1 -1
- package/dist/DropZone.mjs +68 -64
- package/dist/DropZone.mjs.map +1 -1
- package/dist/Field.cjs +192 -186
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +167 -159
- package/dist/Field.css.map +1 -1
- package/dist/Field.mjs +192 -186
- package/dist/Field.mjs.map +1 -1
- package/dist/Form.cjs +11 -12
- package/dist/Form.cjs.map +1 -1
- package/dist/Form.css +9 -11
- package/dist/Form.css.map +1 -1
- package/dist/Form.mjs +11 -12
- package/dist/Form.mjs.map +1 -1
- package/dist/FullscreenDialog.cjs +5 -5
- package/dist/FullscreenDialog.css +94 -80
- package/dist/FullscreenDialog.css.map +1 -1
- package/dist/FullscreenDialog.mjs +5 -5
- package/dist/IllustratedMessage.cjs +185 -160
- package/dist/IllustratedMessage.cjs.map +1 -1
- package/dist/IllustratedMessage.css +93 -91
- package/dist/IllustratedMessage.css.map +1 -1
- package/dist/IllustratedMessage.mjs +185 -160
- package/dist/IllustratedMessage.mjs.map +1 -1
- package/dist/Image.cjs +14 -14
- package/dist/Image.css +14 -16
- package/dist/Image.css.map +1 -1
- package/dist/Image.mjs +14 -14
- package/dist/InlineAlert.cjs +130 -122
- package/dist/InlineAlert.cjs.map +1 -1
- package/dist/InlineAlert.css +109 -95
- package/dist/InlineAlert.css.map +1 -1
- package/dist/InlineAlert.mjs +130 -122
- package/dist/InlineAlert.mjs.map +1 -1
- package/dist/Link.cjs +57 -47
- package/dist/Link.cjs.map +1 -1
- package/dist/Link.css +52 -44
- package/dist/Link.css.map +1 -1
- package/dist/Link.mjs +57 -47
- package/dist/Link.mjs.map +1 -1
- package/dist/Menu.cjs +353 -325
- package/dist/Menu.cjs.map +1 -1
- package/dist/Menu.css +189 -189
- package/dist/Menu.css.map +1 -1
- package/dist/Menu.mjs +353 -325
- package/dist/Menu.mjs.map +1 -1
- package/dist/Meter.cjs +116 -114
- package/dist/Meter.cjs.map +1 -1
- package/dist/Meter.css +106 -104
- package/dist/Meter.css.map +1 -1
- package/dist/Meter.mjs +116 -114
- package/dist/Meter.mjs.map +1 -1
- package/dist/Modal.cjs +62 -59
- package/dist/Modal.cjs.map +1 -1
- package/dist/Modal.css +52 -51
- package/dist/Modal.css.map +1 -1
- package/dist/Modal.mjs +62 -59
- package/dist/Modal.mjs.map +1 -1
- package/dist/NotificationBadge.cjs +66 -62
- package/dist/NotificationBadge.cjs.map +1 -1
- package/dist/NotificationBadge.css +78 -72
- package/dist/NotificationBadge.css.map +1 -1
- package/dist/NotificationBadge.mjs +66 -62
- package/dist/NotificationBadge.mjs.map +1 -1
- package/dist/NumberField.cjs +133 -133
- package/dist/NumberField.css +120 -120
- package/dist/NumberField.mjs +133 -133
- package/dist/Picker.cjs +209 -207
- package/dist/Picker.cjs.map +1 -1
- package/dist/Picker.css +179 -173
- package/dist/Picker.css.map +1 -1
- package/dist/Picker.mjs +209 -207
- package/dist/Picker.mjs.map +1 -1
- package/dist/Popover.cjs +124 -93
- package/dist/Popover.cjs.map +1 -1
- package/dist/Popover.css +67 -83
- package/dist/Popover.css.map +1 -1
- package/dist/Popover.mjs +124 -93
- package/dist/Popover.mjs.map +1 -1
- package/dist/ProgressBar.cjs +132 -130
- package/dist/ProgressBar.cjs.map +1 -1
- package/dist/ProgressBar.css +119 -117
- package/dist/ProgressBar.css.map +1 -1
- package/dist/ProgressBar.mjs +132 -130
- package/dist/ProgressBar.mjs.map +1 -1
- package/dist/ProgressCircle.cjs +32 -32
- package/dist/ProgressCircle.css +20 -20
- package/dist/ProgressCircle.css.map +1 -1
- package/dist/ProgressCircle.mjs +32 -32
- package/dist/Provider.cjs +11 -11
- package/dist/Provider.css +9 -11
- package/dist/Provider.css.map +1 -1
- package/dist/Provider.mjs +11 -11
- package/dist/Radio.cjs +101 -99
- package/dist/Radio.cjs.map +1 -1
- package/dist/Radio.css +101 -95
- package/dist/Radio.css.map +1 -1
- package/dist/Radio.mjs +101 -99
- package/dist/Radio.mjs.map +1 -1
- package/dist/RadioGroup.cjs +52 -52
- package/dist/RadioGroup.css +42 -42
- package/dist/RadioGroup.mjs +52 -52
- package/dist/SearchField.cjs +52 -52
- package/dist/SearchField.css +54 -54
- package/dist/SearchField.mjs +52 -52
- package/dist/SegmentedControl.cjs +123 -119
- package/dist/SegmentedControl.cjs.map +1 -1
- package/dist/SegmentedControl.css +110 -104
- package/dist/SegmentedControl.css.map +1 -1
- package/dist/SegmentedControl.mjs +123 -119
- package/dist/SegmentedControl.mjs.map +1 -1
- package/dist/Slider.cjs +251 -248
- package/dist/Slider.cjs.map +1 -1
- package/dist/Slider.css +166 -157
- package/dist/Slider.css.map +1 -1
- package/dist/Slider.mjs +251 -248
- package/dist/Slider.mjs.map +1 -1
- package/dist/StatusLight.cjs +74 -70
- package/dist/StatusLight.cjs.map +1 -1
- package/dist/StatusLight.css +70 -64
- package/dist/StatusLight.css.map +1 -1
- package/dist/StatusLight.mjs +74 -70
- package/dist/StatusLight.mjs.map +1 -1
- package/dist/Switch.cjs +110 -108
- package/dist/Switch.cjs.map +1 -1
- package/dist/Switch.css +86 -80
- package/dist/Switch.css.map +1 -1
- package/dist/Switch.mjs +110 -108
- package/dist/Switch.mjs.map +1 -1
- package/dist/TableView.cjs +334 -329
- package/dist/TableView.cjs.map +1 -1
- package/dist/TableView.css +193 -193
- package/dist/TableView.css.map +1 -1
- package/dist/TableView.mjs +334 -329
- package/dist/TableView.mjs.map +1 -1
- package/dist/Tabs.cjs +153 -149
- package/dist/Tabs.cjs.map +1 -1
- package/dist/Tabs.css +102 -96
- package/dist/Tabs.css.map +1 -1
- package/dist/Tabs.mjs +153 -149
- package/dist/Tabs.mjs.map +1 -1
- package/dist/TabsPicker.cjs +131 -129
- package/dist/TabsPicker.cjs.map +1 -1
- package/dist/TabsPicker.css +132 -126
- package/dist/TabsPicker.css.map +1 -1
- package/dist/TabsPicker.mjs +131 -129
- package/dist/TabsPicker.mjs.map +1 -1
- package/dist/TagGroup.cjs +197 -193
- package/dist/TagGroup.cjs.map +1 -1
- package/dist/TagGroup.css +164 -158
- package/dist/TagGroup.css.map +1 -1
- package/dist/TagGroup.mjs +197 -193
- package/dist/TagGroup.mjs.map +1 -1
- package/dist/TextField.cjs +67 -65
- package/dist/TextField.cjs.map +1 -1
- package/dist/TextField.css +71 -65
- package/dist/TextField.css.map +1 -1
- package/dist/TextField.mjs +67 -65
- package/dist/TextField.mjs.map +1 -1
- package/dist/Toast.cjs +138 -136
- package/dist/Toast.cjs.map +1 -1
- package/dist/Toast.css +117 -111
- package/dist/Toast.css.map +1 -1
- package/dist/Toast.mjs +138 -136
- package/dist/Toast.mjs.map +1 -1
- package/dist/ToggleButton.cjs +3 -3
- package/dist/ToggleButton.css +12 -14
- package/dist/ToggleButton.css.map +1 -1
- package/dist/ToggleButton.mjs +3 -3
- package/dist/Tooltip.cjs +99 -72
- package/dist/Tooltip.cjs.map +1 -1
- package/dist/Tooltip.css +87 -87
- package/dist/Tooltip.css.map +1 -1
- package/dist/Tooltip.mjs +99 -72
- package/dist/Tooltip.mjs.map +1 -1
- package/dist/TreeView.cjs +169 -157
- package/dist/TreeView.cjs.map +1 -1
- package/dist/TreeView.css +155 -153
- package/dist/TreeView.css.map +1 -1
- package/dist/TreeView.mjs +169 -157
- package/dist/TreeView.mjs.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/icons/Skeleton.cjs +3 -3
- package/icons/Skeleton.cjs.map +1 -1
- package/icons/Skeleton.css +8 -10
- package/icons/Skeleton.css.map +1 -1
- package/icons/Skeleton.mjs +3 -3
- package/icons/Skeleton.mjs.map +1 -1
- package/package.json +22 -22
- package/src/Card.tsx +3 -3
- package/src/Disclosure.tsx +3 -3
- package/src/TableView.tsx +1 -4
- package/src/style-utils.ts +0 -2
- package/style/__tests__/style-macro.test.js +323 -27
- package/style/dist/properties.cjs +4 -0
- package/style/dist/properties.cjs.map +1 -0
- package/style/dist/properties.mjs +6 -0
- package/style/dist/properties.mjs.map +1 -0
- package/style/dist/spectrum-theme.cjs +123 -124
- package/style/dist/spectrum-theme.cjs.map +1 -1
- package/style/dist/spectrum-theme.mjs +124 -125
- package/style/dist/spectrum-theme.mjs.map +1 -1
- package/style/dist/style-macro.cjs +244 -263
- package/style/dist/style-macro.cjs.map +1 -1
- package/style/dist/style-macro.mjs +240 -259
- package/style/dist/style-macro.mjs.map +1 -1
- package/style/dist/types.d.ts +84 -80
- package/style/dist/types.d.ts.map +1 -1
- package/style/properties.json +2422 -0
- package/style/spectrum-theme.ts +101 -110
- package/style/style-macro.ts +319 -220
- package/style/types.ts +8 -4
package/style/spectrum-theme.ts
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import {ArbitraryProperty, Color, ColorProperty, createTheme, ExpandedProperty, MappedProperty, parseArbitraryValue, SizingProperty} from './style-macro';
|
|
13
14
|
import {ArbitraryValue, CSSProperties, CSSValue, PropertyValueMap} from './types';
|
|
14
15
|
import {autoStaticColor, colorScale, colorToken, fontSizeToken, generateOverlayColorScale, getToken, simpleColorScale, weirdColorToken} from './tokens' with {type: 'macro'};
|
|
15
|
-
import {Color, createArbitraryProperty, createColorProperty, createMappedProperty, createRenamedProperty, createSizingProperty, createTheme, parseArbitraryValue} from './style-macro';
|
|
16
16
|
import type * as CSS from 'csstype';
|
|
17
17
|
|
|
18
18
|
interface MacroContext {
|
|
@@ -291,8 +291,8 @@ const width = {
|
|
|
291
291
|
screen: '100vw'
|
|
292
292
|
};
|
|
293
293
|
|
|
294
|
-
function createSpectrumSizingProperty<T extends CSSValue>(values: PropertyValueMap<T>) {
|
|
295
|
-
return
|
|
294
|
+
function createSpectrumSizingProperty<T extends CSSValue>(property: string, values: PropertyValueMap<T>) {
|
|
295
|
+
return new SizingProperty(property, values, px => `calc(${pxToRem(px)} * var(--s2-scale))`);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
const margin = {
|
|
@@ -311,7 +311,7 @@ const translate = {
|
|
|
311
311
|
...baseSpacing,
|
|
312
312
|
...negativeSpacing,
|
|
313
313
|
full: '100%'
|
|
314
|
-
};
|
|
314
|
+
} as const;
|
|
315
315
|
|
|
316
316
|
const borderWidth = {
|
|
317
317
|
0: '0px',
|
|
@@ -349,8 +349,8 @@ let gridTrackSize = (value: GridTrackSize) => {
|
|
|
349
349
|
const transitionProperty = {
|
|
350
350
|
// var(--gp) is generated by the backgroundImage property when setting a gradient.
|
|
351
351
|
// It includes a list of all of the custom properties used for each color stop.
|
|
352
|
-
default: 'color, background-color, var(--gp), border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, translate, scale, rotate, filter, backdrop-filter',
|
|
353
|
-
colors: 'color, background-color, var(--gp), border-color, text-decoration-color, fill, stroke',
|
|
352
|
+
default: 'color, background-color, var(--gp, color), border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, translate, scale, rotate, filter, backdrop-filter',
|
|
353
|
+
colors: 'color, background-color, var(--gp, color), border-color, text-decoration-color, fill, stroke',
|
|
354
354
|
opacity: 'opacity',
|
|
355
355
|
shadow: 'box-shadow',
|
|
356
356
|
transform: 'transform, translate, scale, rotate',
|
|
@@ -368,9 +368,7 @@ const timingFunction = {
|
|
|
368
368
|
};
|
|
369
369
|
|
|
370
370
|
// TODO: do these need tokens or are arbitrary values ok?
|
|
371
|
-
let
|
|
372
|
-
|
|
373
|
-
// const colorWithAlpha = createColorProperty(color);
|
|
371
|
+
let durationValue = (value: number | string) => typeof value === 'number' ? value + 'ms' : value;
|
|
374
372
|
|
|
375
373
|
const fontWeightBase = {
|
|
376
374
|
light: '300',
|
|
@@ -382,6 +380,22 @@ const fontWeightBase = {
|
|
|
382
380
|
black: '900'
|
|
383
381
|
} as const;
|
|
384
382
|
|
|
383
|
+
const fontWeight = {
|
|
384
|
+
...fontWeightBase,
|
|
385
|
+
heading: {
|
|
386
|
+
default: fontWeightBase[getToken('heading-sans-serif-font-weight') as keyof typeof fontWeightBase],
|
|
387
|
+
':lang(ja, ko, zh, zh-Hant, zh-Hans)': fontWeightBase[getToken('heading-cjk-font-weight') as keyof typeof fontWeightBase]
|
|
388
|
+
},
|
|
389
|
+
title: {
|
|
390
|
+
default: fontWeightBase[getToken('title-sans-serif-font-weight') as keyof typeof fontWeightBase],
|
|
391
|
+
':lang(ja, ko, zh, zh-Hant, zh-Hans)': fontWeightBase[getToken('title-cjk-font-weight') as keyof typeof fontWeightBase]
|
|
392
|
+
},
|
|
393
|
+
detail: {
|
|
394
|
+
default: fontWeightBase[getToken('detail-sans-serif-font-weight') as keyof typeof fontWeightBase],
|
|
395
|
+
':lang(ja, ko, zh, zh-Hant, zh-Hans)': fontWeightBase[getToken('detail-cjk-font-weight') as keyof typeof fontWeightBase]
|
|
396
|
+
}
|
|
397
|
+
} as const;
|
|
398
|
+
|
|
385
399
|
const i18nFonts = {
|
|
386
400
|
':lang(ar)': 'myriad-arabic, ui-sans-serif, system-ui, sans-serif',
|
|
387
401
|
':lang(he)': 'myriad-hebrew, ui-sans-serif, system-ui, sans-serif',
|
|
@@ -455,7 +469,7 @@ const fontSize = {
|
|
|
455
469
|
export const style = createTheme({
|
|
456
470
|
properties: {
|
|
457
471
|
// colors
|
|
458
|
-
color:
|
|
472
|
+
color: new ColorProperty('color', {
|
|
459
473
|
...color,
|
|
460
474
|
accent: {
|
|
461
475
|
default: colorToken('accent-content-color-default'),
|
|
@@ -495,7 +509,7 @@ export const style = createTheme({
|
|
|
495
509
|
code: colorToken('code-color'),
|
|
496
510
|
auto: autoStaticColor('self(backgroundColor, var(--s2-container-bg))')
|
|
497
511
|
}),
|
|
498
|
-
backgroundColor:
|
|
512
|
+
backgroundColor: new ColorProperty('backgroundColor', {
|
|
499
513
|
...color,
|
|
500
514
|
accent: {
|
|
501
515
|
default: weirdColorToken('accent-background-color-default'),
|
|
@@ -585,7 +599,7 @@ export const style = createTheme({
|
|
|
585
599
|
pasteboard: weirdColorToken('background-pasteboard-color'),
|
|
586
600
|
elevated: weirdColorToken('background-elevated-color')
|
|
587
601
|
}),
|
|
588
|
-
borderColor:
|
|
602
|
+
borderColor: new ColorProperty('borderColor', {
|
|
589
603
|
...color,
|
|
590
604
|
negative: {
|
|
591
605
|
default: colorToken('negative-border-color-default'),
|
|
@@ -596,17 +610,14 @@ export const style = createTheme({
|
|
|
596
610
|
disabled: colorToken('disabled-border-color')
|
|
597
611
|
// forcedColors: 'GrayText'
|
|
598
612
|
}),
|
|
599
|
-
outlineColor:
|
|
613
|
+
outlineColor: new ColorProperty('outlineColor', {
|
|
600
614
|
...color,
|
|
601
615
|
'focus-ring': {
|
|
602
616
|
default: colorToken('focus-indicator-color'),
|
|
603
617
|
forcedColors: 'Highlight'
|
|
604
618
|
}
|
|
605
619
|
}),
|
|
606
|
-
|
|
607
|
-
// accentColor: colorWithAlpha,
|
|
608
|
-
// caretColor: colorWithAlpha,
|
|
609
|
-
fill: createColorProperty({
|
|
620
|
+
fill: new ColorProperty('fill', {
|
|
610
621
|
none: 'none',
|
|
611
622
|
currentColor: 'currentColor',
|
|
612
623
|
accent: weirdColorToken('accent-visual-color'),
|
|
@@ -636,7 +647,7 @@ export const style = createTheme({
|
|
|
636
647
|
silver: weirdColorToken('silver-visual-color'),
|
|
637
648
|
...color
|
|
638
649
|
}),
|
|
639
|
-
stroke:
|
|
650
|
+
stroke: new ColorProperty('stroke', {
|
|
640
651
|
none: 'none',
|
|
641
652
|
currentColor: 'currentColor',
|
|
642
653
|
...color
|
|
@@ -651,22 +662,22 @@ export const style = createTheme({
|
|
|
651
662
|
},
|
|
652
663
|
rowGap: spacing,
|
|
653
664
|
columnGap: spacing,
|
|
654
|
-
height: createSpectrumSizingProperty(height),
|
|
655
|
-
width: createSpectrumSizingProperty(width),
|
|
656
|
-
containIntrinsicWidth: createSpectrumSizingProperty(width),
|
|
657
|
-
containIntrinsicHeight: createSpectrumSizingProperty(height),
|
|
658
|
-
minHeight: createSpectrumSizingProperty(height),
|
|
659
|
-
maxHeight: createSpectrumSizingProperty({
|
|
665
|
+
height: createSpectrumSizingProperty('height', height),
|
|
666
|
+
width: createSpectrumSizingProperty('width', width),
|
|
667
|
+
containIntrinsicWidth: createSpectrumSizingProperty('containIntrinsicWidth', width),
|
|
668
|
+
containIntrinsicHeight: createSpectrumSizingProperty('containIntrinsicHeight', height),
|
|
669
|
+
minHeight: createSpectrumSizingProperty('minHeight', height),
|
|
670
|
+
maxHeight: createSpectrumSizingProperty('maxHeight', {
|
|
660
671
|
...height,
|
|
661
672
|
none: 'none'
|
|
662
673
|
}),
|
|
663
|
-
minWidth: createSpectrumSizingProperty(width),
|
|
664
|
-
maxWidth: createSpectrumSizingProperty({
|
|
674
|
+
minWidth: createSpectrumSizingProperty('minWidth', width),
|
|
675
|
+
maxWidth: createSpectrumSizingProperty('maxWidth', {
|
|
665
676
|
...width,
|
|
666
677
|
none: 'none'
|
|
667
678
|
}),
|
|
668
|
-
borderStartWidth:
|
|
669
|
-
borderEndWidth:
|
|
679
|
+
borderStartWidth: new MappedProperty('borderInlineStartWidth', borderWidth),
|
|
680
|
+
borderEndWidth: new MappedProperty('borderInlineEndWidth', borderWidth),
|
|
670
681
|
borderTopWidth: borderWidth,
|
|
671
682
|
borderBottomWidth: borderWidth,
|
|
672
683
|
borderStyle: ['solid', 'dashed', 'dotted', 'double', 'hidden', 'none'] as const,
|
|
@@ -675,44 +686,44 @@ export const style = createTheme({
|
|
|
675
686
|
1: '1',
|
|
676
687
|
2: '2'
|
|
677
688
|
},
|
|
678
|
-
marginStart:
|
|
679
|
-
marginEnd:
|
|
689
|
+
marginStart: new MappedProperty('marginInlineStart', margin),
|
|
690
|
+
marginEnd: new MappedProperty('marginInlineEnd', margin),
|
|
680
691
|
marginTop: margin,
|
|
681
692
|
marginBottom: margin,
|
|
682
|
-
paddingStart:
|
|
683
|
-
paddingEnd:
|
|
693
|
+
paddingStart: new MappedProperty('paddingInlineStart', spacing),
|
|
694
|
+
paddingEnd: new MappedProperty('paddingInlineEnd', spacing),
|
|
684
695
|
paddingTop: spacing,
|
|
685
696
|
paddingBottom: spacing,
|
|
686
|
-
scrollMarginStart:
|
|
687
|
-
scrollMarginEnd:
|
|
697
|
+
scrollMarginStart: new MappedProperty('scrollMarginInlineStart', baseSpacing),
|
|
698
|
+
scrollMarginEnd: new MappedProperty('scrollMarginInlineEnd', baseSpacing),
|
|
688
699
|
scrollMarginTop: baseSpacing,
|
|
689
700
|
scrollMarginBottom: baseSpacing,
|
|
690
|
-
scrollPaddingStart:
|
|
691
|
-
scrollPaddingEnd:
|
|
701
|
+
scrollPaddingStart: new MappedProperty('scrollPaddingInlineStart', baseSpacing),
|
|
702
|
+
scrollPaddingEnd: new MappedProperty('scrollPaddingInlineEnd', baseSpacing),
|
|
692
703
|
scrollPaddingTop: baseSpacing,
|
|
693
704
|
scrollPaddingBottom: baseSpacing,
|
|
694
705
|
textIndent: baseSpacing,
|
|
695
|
-
translateX:
|
|
696
|
-
'--translateX': value,
|
|
706
|
+
translateX: new ExpandedProperty<keyof typeof translate>(['--translateX', 'translate'], value => ({
|
|
707
|
+
'--translateX': String(value),
|
|
697
708
|
translate: 'var(--translateX, 0) var(--translateY, 0)'
|
|
698
709
|
}), translate),
|
|
699
|
-
translateY:
|
|
700
|
-
'--translateY': value,
|
|
710
|
+
translateY: new ExpandedProperty<keyof typeof translate>(['--translateY', 'translate'], value => ({
|
|
711
|
+
'--translateY': String(value),
|
|
701
712
|
translate: 'var(--translateX, 0) var(--translateY, 0)'
|
|
702
713
|
}), translate),
|
|
703
|
-
rotate:
|
|
704
|
-
scaleX:
|
|
705
|
-
'--scaleX': value,
|
|
714
|
+
rotate: new ArbitraryProperty('rotate', (value: number | `${number}deg` | `${number}rad` | `${number}grad` | `${number}turn`) => typeof value === 'number' ? `${value}deg` : value),
|
|
715
|
+
scaleX: new ExpandedProperty<number>(['--scaleX', 'scale'], value => ({
|
|
716
|
+
'--scaleX': String(value),
|
|
706
717
|
scale: 'var(--scaleX, 1) var(--scaleY, 1)'
|
|
707
718
|
})),
|
|
708
|
-
scaleY:
|
|
709
|
-
'--scaleY': value,
|
|
719
|
+
scaleY: new ExpandedProperty<number>(['--scaleY', 'scale'], value => ({
|
|
720
|
+
'--scaleY': String(value),
|
|
710
721
|
scale: 'var(--scaleX, 1) var(--scaleY, 1)'
|
|
711
722
|
})),
|
|
712
|
-
transform:
|
|
723
|
+
transform: new ArbitraryProperty<string>('transform'),
|
|
713
724
|
position: ['absolute', 'fixed', 'relative', 'sticky', 'static'] as const,
|
|
714
|
-
insetStart:
|
|
715
|
-
insetEnd:
|
|
725
|
+
insetStart: new MappedProperty('insetInlineStart', inset),
|
|
726
|
+
insetEnd: new MappedProperty('insetInlineEnd', inset),
|
|
716
727
|
top: inset,
|
|
717
728
|
left: inset,
|
|
718
729
|
bottom: inset,
|
|
@@ -736,32 +747,14 @@ export const style = createTheme({
|
|
|
736
747
|
code: 'source-code-pro, "Source Code Pro", Monaco, monospace'
|
|
737
748
|
},
|
|
738
749
|
fontSize,
|
|
739
|
-
fontWeight:
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
return {[property]: value};
|
|
750
|
-
}, {
|
|
751
|
-
...fontWeightBase,
|
|
752
|
-
heading: {
|
|
753
|
-
default: fontWeightBase[getToken('heading-sans-serif-font-weight') as keyof typeof fontWeightBase],
|
|
754
|
-
':lang(ja, ko, zh, zh-Hant, zh-Hans)': fontWeightBase[getToken('heading-cjk-font-weight') as keyof typeof fontWeightBase]
|
|
755
|
-
},
|
|
756
|
-
title: {
|
|
757
|
-
default: fontWeightBase[getToken('title-sans-serif-font-weight') as keyof typeof fontWeightBase],
|
|
758
|
-
':lang(ja, ko, zh, zh-Hant, zh-Hans)': fontWeightBase[getToken('title-cjk-font-weight') as keyof typeof fontWeightBase]
|
|
759
|
-
},
|
|
760
|
-
detail: {
|
|
761
|
-
default: fontWeightBase[getToken('detail-sans-serif-font-weight') as keyof typeof fontWeightBase],
|
|
762
|
-
':lang(ja, ko, zh, zh-Hant, zh-Hans)': fontWeightBase[getToken('detail-cjk-font-weight') as keyof typeof fontWeightBase]
|
|
763
|
-
}
|
|
764
|
-
}),
|
|
750
|
+
fontWeight: new ExpandedProperty<keyof typeof fontWeight>(['fontWeight', 'fontVariationSettings', 'fontSynthesisWeight'], (value) => {
|
|
751
|
+
return {
|
|
752
|
+
// Set font-variation-settings in addition to font-weight to work around typekit issue.
|
|
753
|
+
fontVariationSettings: value === 'inherit' ? 'inherit' : `"wght" ${value}`,
|
|
754
|
+
fontWeight: value as any,
|
|
755
|
+
fontSynthesisWeight: 'none'
|
|
756
|
+
};
|
|
757
|
+
}, fontWeight),
|
|
765
758
|
lineHeight: {
|
|
766
759
|
// See https://spectrum.corp.adobe.com/page/typography/#Line-height
|
|
767
760
|
ui: {
|
|
@@ -794,16 +787,16 @@ export const style = createTheme({
|
|
|
794
787
|
textTransform: ['uppercase', 'lowercase', 'capitalize', 'none'] as const,
|
|
795
788
|
textAlign: ['start', 'center', 'end', 'justify'] as const,
|
|
796
789
|
verticalAlign: ['baseline', 'top', 'middle', 'bottom', 'text-top', 'text-bottom', 'sub', 'super'] as const,
|
|
797
|
-
textDecoration:
|
|
790
|
+
textDecoration: new ExpandedProperty<'underline' | 'overline' | 'line-through' | 'none'>(['textDecoration', 'textUnderlineOffset'], (value) => ({
|
|
798
791
|
textDecoration: value === 'none' ? 'none' : `${value} ${getToken('text-underline-thickness')}`,
|
|
799
792
|
textUnderlineOffset: value === 'underline' ? getToken('text-underline-gap') : undefined
|
|
800
|
-
})
|
|
793
|
+
})),
|
|
801
794
|
textOverflow: ['ellipsis', 'clip'] as const,
|
|
802
|
-
lineClamp:
|
|
795
|
+
lineClamp: new ExpandedProperty<number>(['overflow', 'display', '-webkit-box-orient', '-webkit-line-clamp'], (value) => ({
|
|
803
796
|
overflow: 'hidden',
|
|
804
797
|
display: '-webkit-box',
|
|
805
798
|
'-webkit-box-orient': 'vertical',
|
|
806
|
-
'-webkit-line-clamp': value
|
|
799
|
+
'-webkit-line-clamp': String(value)
|
|
807
800
|
})),
|
|
808
801
|
hyphens: ['none', 'manual', 'auto'] as const,
|
|
809
802
|
whiteSpace: ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'] as const,
|
|
@@ -824,18 +817,18 @@ export const style = createTheme({
|
|
|
824
817
|
dragged: `drop-shadow${getToken('drop-shadow-dragged-x')} ${getToken('drop-shadow-dragged-y')} ${getToken('drop-shadow-dragged-blur')} ${colorToken('drop-shadow-dragged-color')}`,
|
|
825
818
|
none: 'none'
|
|
826
819
|
},
|
|
827
|
-
borderTopStartRadius:
|
|
828
|
-
borderTopEndRadius:
|
|
829
|
-
borderBottomStartRadius:
|
|
830
|
-
borderBottomEndRadius:
|
|
820
|
+
borderTopStartRadius: new MappedProperty('borderStartStartRadius', radius),
|
|
821
|
+
borderTopEndRadius: new MappedProperty('borderStartEndRadius', radius),
|
|
822
|
+
borderBottomStartRadius: new MappedProperty('borderEndStartRadius', radius),
|
|
823
|
+
borderBottomEndRadius: new MappedProperty('borderEndEndRadius', radius),
|
|
831
824
|
forcedColorAdjust: ['auto', 'none'] as const,
|
|
832
825
|
colorScheme: ['light', 'dark', 'light dark'] as const,
|
|
833
|
-
backgroundImage:
|
|
826
|
+
backgroundImage: new ExpandedProperty<string | [LinearGradient]>(['backgroundImage', '--g0', '--g1', '--g2', '--gp'], (value) => {
|
|
834
827
|
if (typeof value === 'string') {
|
|
835
|
-
return {
|
|
828
|
+
return {backgroundImage: value};
|
|
836
829
|
} else if (Array.isArray(value) && value[0]?.type === 'linear-gradient') {
|
|
837
830
|
let values: CSSProperties = {
|
|
838
|
-
|
|
831
|
+
backgroundImage: `linear-gradient(${value[0].angle}, ${value[0].stops.map(([, stop], i) => `var(--g${i}) ${stop}%`)})`
|
|
839
832
|
};
|
|
840
833
|
|
|
841
834
|
// Create a CSS var for each color stop so the gradient can be transitioned.
|
|
@@ -862,22 +855,22 @@ export const style = createTheme({
|
|
|
862
855
|
backgroundOrigin: ['border-box', 'padding-box', 'content-box'] as const,
|
|
863
856
|
backgroundBlendMode: ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'] as const,
|
|
864
857
|
mixBlendMode: ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity', 'plus-darker', 'plus-lighter'] as const,
|
|
865
|
-
opacity:
|
|
858
|
+
opacity: new ArbitraryProperty<number>('opacity'),
|
|
866
859
|
|
|
867
860
|
outlineStyle: ['none', 'solid', 'dashed', 'dotted', 'double', 'inset'] as const,
|
|
868
|
-
outlineOffset:
|
|
861
|
+
outlineOffset: new ArbitraryProperty<number>('outlineOffset', v => `${v}px`),
|
|
869
862
|
outlineWidth: borderWidth,
|
|
870
863
|
|
|
871
|
-
transition:
|
|
872
|
-
transitionDelay:
|
|
873
|
-
transitionDuration:
|
|
864
|
+
transition: new MappedProperty('transitionProperty', transitionProperty),
|
|
865
|
+
transitionDelay: new ArbitraryProperty('transitionDelay', durationValue),
|
|
866
|
+
transitionDuration: new ArbitraryProperty('transitionDuration', durationValue),
|
|
874
867
|
transitionTimingFunction: timingFunction,
|
|
875
|
-
animation:
|
|
876
|
-
animationDuration:
|
|
877
|
-
animationDelay:
|
|
868
|
+
animation: new ArbitraryProperty<string>('animationName'),
|
|
869
|
+
animationDuration: new ArbitraryProperty('animationDuration', durationValue),
|
|
870
|
+
animationDelay: new ArbitraryProperty('animationDelay', durationValue),
|
|
878
871
|
animationDirection: ['normal', 'reverse', 'alternate', 'alternate-reverse'] as const,
|
|
879
872
|
animationFillMode: ['none', 'forwards', 'backwards', 'both'] as const,
|
|
880
|
-
animationIterationCount:
|
|
873
|
+
animationIterationCount: new ArbitraryProperty<number | string>('animationIterationCount'),
|
|
881
874
|
animationTimingFunction: timingFunction,
|
|
882
875
|
|
|
883
876
|
// layout
|
|
@@ -890,18 +883,18 @@ export const style = createTheme({
|
|
|
890
883
|
justifySelf: ['auto', 'start', 'end', 'center', 'stretch'] as const,
|
|
891
884
|
flexDirection: ['row', 'column', 'row-reverse', 'column-reverse'] as const,
|
|
892
885
|
flexWrap: ['wrap', 'wrap-reverse', 'nowrap'] as const,
|
|
893
|
-
flexShrink:
|
|
894
|
-
flexGrow:
|
|
895
|
-
gridColumnStart:
|
|
896
|
-
gridColumnEnd:
|
|
897
|
-
gridRowStart:
|
|
898
|
-
gridRowEnd:
|
|
886
|
+
flexShrink: new ArbitraryProperty<CSS.Property.FlexShrink>('flexShrink'),
|
|
887
|
+
flexGrow: new ArbitraryProperty<CSS.Property.FlexGrow>('flexGrow'),
|
|
888
|
+
gridColumnStart: new ArbitraryProperty<CSS.Property.GridColumnStart>('gridColumnStart'),
|
|
889
|
+
gridColumnEnd: new ArbitraryProperty<CSS.Property.GridColumnEnd>('gridColumnEnd'),
|
|
890
|
+
gridRowStart: new ArbitraryProperty<CSS.Property.GridRowStart>('gridRowStart'),
|
|
891
|
+
gridRowEnd: new ArbitraryProperty<CSS.Property.GridRowEnd>('gridRowEnd'),
|
|
899
892
|
gridAutoFlow: ['row', 'column', 'dense', 'row dense', 'column dense'] as const,
|
|
900
|
-
gridAutoRows:
|
|
901
|
-
gridAutoColumns:
|
|
902
|
-
gridTemplateColumns:
|
|
903
|
-
gridTemplateRows:
|
|
904
|
-
gridTemplateAreas:
|
|
893
|
+
gridAutoRows: new ArbitraryProperty('gridAutoRows', gridTrackSize),
|
|
894
|
+
gridAutoColumns: new ArbitraryProperty('gridAutoColumns', gridTrackSize),
|
|
895
|
+
gridTemplateColumns: new ArbitraryProperty('gridTemplateColumns', gridTrack),
|
|
896
|
+
gridTemplateRows: new ArbitraryProperty('gridTemplateRows', gridTrack),
|
|
897
|
+
gridTemplateAreas: new ArbitraryProperty('gridTemplateAreas', (value: readonly string[]) => value.map(v => `"${v}"`).join('')),
|
|
905
898
|
float: ['inline-start', 'inline-end', 'right', 'left', 'none'] as const,
|
|
906
899
|
clear: ['inline-start', 'inline-end', 'left', 'right', 'both', 'none'] as const,
|
|
907
900
|
contain: ['none', 'strict', 'content', 'size', 'inline-size', 'layout', 'style', 'paint'] as const,
|
|
@@ -946,7 +939,7 @@ export const style = createTheme({
|
|
|
946
939
|
overscrollBehaviorX: ['auto', 'contain', 'none'] as const,
|
|
947
940
|
overscrollBehaviorY: ['auto', 'contain', 'none'] as const,
|
|
948
941
|
scrollBehavior: ['auto', 'smooth'] as const,
|
|
949
|
-
order:
|
|
942
|
+
order: new ArbitraryProperty<number>('order'),
|
|
950
943
|
|
|
951
944
|
pointerEvents: ['none', 'auto'] as const,
|
|
952
945
|
touchAction: ['auto', 'none', 'pan-x', 'pan-y', 'manipulation', 'pinch-zoom'] as const,
|
|
@@ -963,11 +956,9 @@ export const style = createTheme({
|
|
|
963
956
|
objectFit: ['contain', 'cover', 'fill', 'none', 'scale-down'] as const,
|
|
964
957
|
objectPosition: ['bottom', 'center', 'left', 'left bottom', 'left top', 'right', 'right bottom', 'right top', 'top'] as const,
|
|
965
958
|
willChange: ['auto', 'scroll-position', 'contents', 'transform'] as const,
|
|
966
|
-
zIndex:
|
|
959
|
+
zIndex: new ArbitraryProperty<number>('zIndex'),
|
|
967
960
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
968
|
-
disableTapHighlight:
|
|
969
|
-
'-webkit-tap-highlight-color': 'rgba(0,0,0,0)'
|
|
970
|
-
})),
|
|
961
|
+
disableTapHighlight: new ArbitraryProperty('-webkit-tap-highlight-color', (_value: true) => 'rgba(0,0,0,0)'),
|
|
971
962
|
unicodeBidi: ['normal', 'embed', 'bidi-override', 'isolate', 'isolate-override', 'plaintext'] as const
|
|
972
963
|
},
|
|
973
964
|
shorthands: {
|