@sanity/ui 3.0.0-static.3 → 3.0.0-static.4
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/_chunks-cjs/_visual-editing.js +31 -43
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/buildCommand.js +1 -1
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +31 -43
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +2 -42
- package/dist/css.d.ts +2 -42
- package/dist/css.js +30 -53
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +30 -52
- package/dist/css.mjs.map +1 -1
- package/dist/index.js +12 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -14
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-palette.css +1 -9
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +60 -60
- package/dist/theme.d.mts +1 -43
- package/dist/theme.d.ts +1 -43
- package/dist/theme.js +22 -71
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +22 -71
- package/dist/theme.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cli/buildCommand.ts +2 -2
- package/src/css/_comp.ts +1 -0
- package/src/css/aspects/textOverflow/textOverflow.ts +2 -2
- package/src/css/compile/compilePalette.ts +8 -41
- package/src/css/compile/compileTheme_v3.ts +0 -18
- package/src/css/primitives/_selectable/_contants.ts +1 -1
- package/src/css/primitives/box/box.ts +3 -0
- package/src/css/primitives/button/_constants.ts +1 -1
- package/src/css/primitives/button/button.style.ts +6 -9
- package/src/css/primitives/card/_constants.ts +2 -2
- package/src/css/primitives/card/card.ts +1 -1
- package/src/theme/defaults/config.ts +2 -2
- package/src/theme/defaults/fonts.ts +4 -4
- package/src/theme/palette/constants.ts +1 -3
- package/src/theme/palette/types.ts +0 -12
- package/src/theme/v3/buildTheme_v3.ts +1 -2
- package/src/theme/v3/defaults.ts +12 -31
- package/src/theme/v3/types.ts +0 -3
- package/src/ui/StyleTags.tsx +1 -1
- package/src/ui/primitives/button/button.tsx +4 -4
- package/src/ui/primitives/card/card.tsx +5 -2
- package/src/ui/primitives/heading/heading.tsx +1 -1
- package/src/ui/primitives/select/select.tsx +3 -3
- package/src/ui/primitives/text/text.tsx +1 -1
package/dist/cli.js
CHANGED
|
@@ -335,7 +335,7 @@ class CAC extends events.EventEmitter {
|
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
const cac = (name = "") => new CAC(name);
|
|
338
|
-
var version = "3.0.0-static.
|
|
338
|
+
var version = "3.0.0-static.4";
|
|
339
339
|
const cli = cac("ui");
|
|
340
340
|
cli.command("build").option("--cwd [cwd]", "Working directory").option("--outDir [outDir]", "Output directory").action(async (options) => {
|
|
341
341
|
const {
|
package/dist/css.d.mts
CHANGED
|
@@ -8,7 +8,6 @@ import {FontLabelSize} from '@sanity/ui/theme'
|
|
|
8
8
|
import {FontTextSize} from '@sanity/ui/theme'
|
|
9
9
|
import {FontWeight} from '@sanity/ui/theme'
|
|
10
10
|
import {Hue as Hue_2} from '@sanity/ui/theme'
|
|
11
|
-
import {PaletteConfig as PaletteConfig_2} from '@sanity/ui/theme'
|
|
12
11
|
import {Radius} from '@sanity/ui/theme'
|
|
13
12
|
import {RootTheme} from '@sanity/ui/theme'
|
|
14
13
|
import {Shadow} from '@sanity/ui/theme'
|
|
@@ -680,7 +679,7 @@ export declare interface ColorVariantVars
|
|
|
680
679
|
|
|
681
680
|
export declare type Columns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12
|
|
682
681
|
|
|
683
|
-
export declare function compilePalette(
|
|
682
|
+
export declare function compilePalette(): string
|
|
684
683
|
|
|
685
684
|
/** @public */
|
|
686
685
|
export declare function compileSystem(): string
|
|
@@ -1159,24 +1158,6 @@ export declare interface PaddingStyleProps {
|
|
|
1159
1158
|
paddingY?: ResponsiveProp<Space>
|
|
1160
1159
|
}
|
|
1161
1160
|
|
|
1162
|
-
declare type PaletteConfig = {
|
|
1163
|
-
chroma: {
|
|
1164
|
-
min: number
|
|
1165
|
-
max: number
|
|
1166
|
-
}
|
|
1167
|
-
luminosity: {
|
|
1168
|
-
min: number
|
|
1169
|
-
max: number
|
|
1170
|
-
}
|
|
1171
|
-
hues: Record<
|
|
1172
|
-
Hue,
|
|
1173
|
-
{
|
|
1174
|
-
h: number
|
|
1175
|
-
c: number
|
|
1176
|
-
}
|
|
1177
|
-
>
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
1161
|
/** @public */
|
|
1181
1162
|
export declare type PaletteVarName = `--black` | `--white` | `--${Hue_2}-${Tint_2}`
|
|
1182
1163
|
|
|
@@ -1471,7 +1452,6 @@ declare const THEME_COLOR_STATES: readonly ['enabled', 'hovered', 'pressed', 'se
|
|
|
1471
1452
|
*/
|
|
1472
1453
|
declare interface Theme_v3 {
|
|
1473
1454
|
_version: 3
|
|
1474
|
-
_palette: PaletteConfig
|
|
1475
1455
|
_tokens: Tokens
|
|
1476
1456
|
avatar: ThemeAvatar_v2
|
|
1477
1457
|
button: {
|
|
@@ -2037,27 +2017,7 @@ export declare type ThemeVarName =
|
|
|
2037
2017
|
|
|
2038
2018
|
declare type Tint = (typeof TINTS)[number]
|
|
2039
2019
|
|
|
2040
|
-
declare const TINTS: readonly [
|
|
2041
|
-
50,
|
|
2042
|
-
100,
|
|
2043
|
-
150,
|
|
2044
|
-
200,
|
|
2045
|
-
250,
|
|
2046
|
-
300,
|
|
2047
|
-
350,
|
|
2048
|
-
400,
|
|
2049
|
-
450,
|
|
2050
|
-
500,
|
|
2051
|
-
550,
|
|
2052
|
-
600,
|
|
2053
|
-
650,
|
|
2054
|
-
700,
|
|
2055
|
-
750,
|
|
2056
|
-
800,
|
|
2057
|
-
850,
|
|
2058
|
-
900,
|
|
2059
|
-
950,
|
|
2060
|
-
]
|
|
2020
|
+
declare const TINTS: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
2061
2021
|
|
|
2062
2022
|
export declare function toast(): string | undefined
|
|
2063
2023
|
|
package/dist/css.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ import {FontLabelSize} from '@sanity/ui/theme'
|
|
|
8
8
|
import {FontTextSize} from '@sanity/ui/theme'
|
|
9
9
|
import {FontWeight} from '@sanity/ui/theme'
|
|
10
10
|
import {Hue as Hue_2} from '@sanity/ui/theme'
|
|
11
|
-
import {PaletteConfig as PaletteConfig_2} from '@sanity/ui/theme'
|
|
12
11
|
import {Radius} from '@sanity/ui/theme'
|
|
13
12
|
import {RootTheme} from '@sanity/ui/theme'
|
|
14
13
|
import {Shadow} from '@sanity/ui/theme'
|
|
@@ -680,7 +679,7 @@ export declare interface ColorVariantVars
|
|
|
680
679
|
|
|
681
680
|
export declare type Columns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12
|
|
682
681
|
|
|
683
|
-
export declare function compilePalette(
|
|
682
|
+
export declare function compilePalette(): string
|
|
684
683
|
|
|
685
684
|
/** @public */
|
|
686
685
|
export declare function compileSystem(): string
|
|
@@ -1159,24 +1158,6 @@ export declare interface PaddingStyleProps {
|
|
|
1159
1158
|
paddingY?: ResponsiveProp<Space>
|
|
1160
1159
|
}
|
|
1161
1160
|
|
|
1162
|
-
declare type PaletteConfig = {
|
|
1163
|
-
chroma: {
|
|
1164
|
-
min: number
|
|
1165
|
-
max: number
|
|
1166
|
-
}
|
|
1167
|
-
luminosity: {
|
|
1168
|
-
min: number
|
|
1169
|
-
max: number
|
|
1170
|
-
}
|
|
1171
|
-
hues: Record<
|
|
1172
|
-
Hue,
|
|
1173
|
-
{
|
|
1174
|
-
h: number
|
|
1175
|
-
c: number
|
|
1176
|
-
}
|
|
1177
|
-
>
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
1161
|
/** @public */
|
|
1181
1162
|
export declare type PaletteVarName = `--black` | `--white` | `--${Hue_2}-${Tint_2}`
|
|
1182
1163
|
|
|
@@ -1471,7 +1452,6 @@ declare const THEME_COLOR_STATES: readonly ['enabled', 'hovered', 'pressed', 'se
|
|
|
1471
1452
|
*/
|
|
1472
1453
|
declare interface Theme_v3 {
|
|
1473
1454
|
_version: 3
|
|
1474
|
-
_palette: PaletteConfig
|
|
1475
1455
|
_tokens: Tokens
|
|
1476
1456
|
avatar: ThemeAvatar_v2
|
|
1477
1457
|
button: {
|
|
@@ -2037,27 +2017,7 @@ export declare type ThemeVarName =
|
|
|
2037
2017
|
|
|
2038
2018
|
declare type Tint = (typeof TINTS)[number]
|
|
2039
2019
|
|
|
2040
|
-
declare const TINTS: readonly [
|
|
2041
|
-
50,
|
|
2042
|
-
100,
|
|
2043
|
-
150,
|
|
2044
|
-
200,
|
|
2045
|
-
250,
|
|
2046
|
-
300,
|
|
2047
|
-
350,
|
|
2048
|
-
400,
|
|
2049
|
-
450,
|
|
2050
|
-
500,
|
|
2051
|
-
550,
|
|
2052
|
-
600,
|
|
2053
|
-
650,
|
|
2054
|
-
700,
|
|
2055
|
-
750,
|
|
2056
|
-
800,
|
|
2057
|
-
850,
|
|
2058
|
-
900,
|
|
2059
|
-
950,
|
|
2060
|
-
]
|
|
2020
|
+
declare const TINTS: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
2061
2021
|
|
|
2062
2022
|
export declare function toast(): string | undefined
|
|
2063
2023
|
|
package/dist/css.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var v3_v2 = require("./_chunks-cjs/v3_v2.js"), theme = require("@sanity/ui/theme");
|
|
3
|
+
var v3_v2 = require("./_chunks-cjs/v3_v2.js"), color = require("@sanity/color"), theme = require("@sanity/ui/theme");
|
|
4
4
|
const PREFIX = "s-";
|
|
5
5
|
function compileRule(selector, props, context) {
|
|
6
6
|
let css = compileProperties$1(selector, props);
|
|
@@ -33,44 +33,22 @@ function compileNestedRules(selector, props, context) {
|
|
|
33
33
|
function toSnakeCase$1(value) {
|
|
34
34
|
return value.replace(/[A-Z]/g, (match) => "-" + match.toLowerCase());
|
|
35
35
|
}
|
|
36
|
-
function compilePalette(
|
|
36
|
+
function compilePalette() {
|
|
37
37
|
const props = {
|
|
38
|
-
|
|
39
|
-
"--
|
|
40
|
-
"--
|
|
41
|
-
"--c-min": `${config.chroma.min}`,
|
|
42
|
-
"--c-max": `${config.chroma.max}`,
|
|
43
|
-
"--c-range": "calc(var(--c-max) - var(--c-min))",
|
|
44
|
-
...compileHues(config.hues),
|
|
45
|
-
"--black": `oklch(
|
|
46
|
-
calc(var(--l-min) + 0.0 * var(--l-range))
|
|
47
|
-
calc(var(--c-min) + 0.0 * var(--gray-c-range))
|
|
48
|
-
var(--gray-h)
|
|
49
|
-
)`,
|
|
50
|
-
"--white": `oklch(
|
|
51
|
-
calc(var(--l-min) + 1.0 * var(--l-range))
|
|
52
|
-
calc(var(--c-min) + 0.0 * var(--gray-c-range))
|
|
53
|
-
var(--gray-h)
|
|
54
|
-
)`
|
|
38
|
+
...compileHues(),
|
|
39
|
+
"--black": color.color.black.hex,
|
|
40
|
+
"--white": color.color.white.hex
|
|
55
41
|
};
|
|
56
42
|
return compileRule(":root", props, {
|
|
57
43
|
keyframes: {},
|
|
58
44
|
media: {}
|
|
59
45
|
});
|
|
60
46
|
}
|
|
61
|
-
function compileHues(
|
|
47
|
+
function compileHues() {
|
|
62
48
|
const rules2 = {};
|
|
63
|
-
for (const hue of theme.HUES)
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
h
|
|
67
|
-
} = hues[hue];
|
|
68
|
-
rules2[`--${hue}-h`] = `${h}`, rules2[`--${hue}-c`] = `${c}`, rules2[`--${hue}-c-max`] = `min(var(--c-max), var(--${hue}-c))`, rules2[`--${hue}-c-range`] = `calc(var(--${hue}-c-max) - var(--c-min))`;
|
|
69
|
-
for (const tint of theme.TINTS) {
|
|
70
|
-
const l_offset = parseFloat((1 - tint / 1e3).toFixed(2)), c_offset_tmp = tint / 500, c_offset = parseFloat((c_offset_tmp < 1 ? c_offset_tmp : 2 - c_offset_tmp).toFixed(1));
|
|
71
|
-
rules2[`--${hue}-${tint}`] = ["oklch(", `calc(var(--l-min) + ${l_offset} * var(--l-range)) `, `calc(var(--c-min) + ${c_offset} * var(--${hue}-c-range)) `, `var(--${hue}-h)`, ")"].join("");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
49
|
+
for (const hue of theme.HUES)
|
|
50
|
+
for (const tint of theme.TINTS)
|
|
51
|
+
rules2[`--${hue}-${tint}`] = color.color[hue][tint].hex;
|
|
74
52
|
return rules2;
|
|
75
53
|
}
|
|
76
54
|
function _mergeStyles(styles) {
|
|
@@ -839,11 +817,11 @@ function buildColorCardVars(props) {
|
|
|
839
817
|
fg: `var(${prefix.accent.fg})`
|
|
840
818
|
},
|
|
841
819
|
avatar: {
|
|
842
|
-
...theme.THEME_COLOR_AVATAR_COLORS.reduce((acc,
|
|
820
|
+
...theme.THEME_COLOR_AVATAR_COLORS.reduce((acc, color2) => ({
|
|
843
821
|
...acc,
|
|
844
|
-
[
|
|
845
|
-
bg: `var(${prefix.avatar[
|
|
846
|
-
fg: `var(${prefix.avatar[
|
|
822
|
+
[color2]: {
|
|
823
|
+
bg: `var(${prefix.avatar[color2].bg})`,
|
|
824
|
+
fg: `var(${prefix.avatar[color2].fg})`
|
|
847
825
|
}
|
|
848
826
|
}), {})
|
|
849
827
|
},
|
|
@@ -2318,7 +2296,7 @@ const _inputStyle = {
|
|
|
2318
2296
|
primitive: primitive$n
|
|
2319
2297
|
}
|
|
2320
2298
|
}, toneMap$2 = {
|
|
2321
|
-
default: "
|
|
2299
|
+
default: "default",
|
|
2322
2300
|
neutral: "neutral",
|
|
2323
2301
|
suggest: "suggest",
|
|
2324
2302
|
primary: "accent",
|
|
@@ -2469,11 +2447,11 @@ const primitive$l = {
|
|
|
2469
2447
|
[varNames.color.avatar.bg]: vars.color.border,
|
|
2470
2448
|
[varNames.color.avatar.fg]: vars.color.bg
|
|
2471
2449
|
},
|
|
2472
|
-
...theme.THEME_COLOR_AVATAR_COLORS.reduce((acc,
|
|
2450
|
+
...theme.THEME_COLOR_AVATAR_COLORS.reduce((acc, color2) => ({
|
|
2473
2451
|
...acc,
|
|
2474
|
-
[`&.${
|
|
2475
|
-
[varNames.color.avatar.bg]: vars.color.avatar[
|
|
2476
|
-
[varNames.color.avatar.fg]: vars.color.avatar[
|
|
2452
|
+
[`&.${color2}`]: {
|
|
2453
|
+
[varNames.color.avatar.bg]: vars.color.avatar[color2].bg,
|
|
2454
|
+
[varNames.color.avatar.fg]: vars.color.avatar[color2].fg
|
|
2477
2455
|
}
|
|
2478
2456
|
}), {})
|
|
2479
2457
|
}
|
|
@@ -2613,7 +2591,7 @@ const badgeStyle = {
|
|
|
2613
2591
|
primitive: primitive$j
|
|
2614
2592
|
}
|
|
2615
2593
|
}, toneMap$1 = {
|
|
2616
|
-
default: "
|
|
2594
|
+
default: "default",
|
|
2617
2595
|
neutral: "neutral",
|
|
2618
2596
|
suggest: "suggest",
|
|
2619
2597
|
primary: "accent",
|
|
@@ -2704,31 +2682,31 @@ for (const tone of theme.THEME_COLOR_STATE_TONES) {
|
|
|
2704
2682
|
}
|
|
2705
2683
|
}
|
|
2706
2684
|
}, primitive$i[`.button.${variantMap.ghost}.${toneMap$1[tone]}`] = {
|
|
2707
|
-
[varNames.color.bg]: tinted.bg[
|
|
2685
|
+
[varNames.color.bg]: tinted.bg[1],
|
|
2708
2686
|
[varNames.color.border]: tinted.border[1],
|
|
2709
2687
|
[varNames.color.fg]: tinted.fg[2],
|
|
2710
|
-
"--button-box-shadow":
|
|
2688
|
+
"--button-box-shadow": "inset 0 0 0 var(--button-border-width) var(--color-border)",
|
|
2711
2689
|
"@nest": {
|
|
2712
2690
|
"&:not([data-disabled]):hover": {
|
|
2713
|
-
[varNames.color.bg]: tinted.bg[
|
|
2691
|
+
[varNames.color.bg]: tinted.bg[2],
|
|
2714
2692
|
[varNames.color.border]: tinted.border[2],
|
|
2715
2693
|
[varNames.color.fg]: tinted.fg[1]
|
|
2716
2694
|
// '--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
2717
2695
|
},
|
|
2718
2696
|
"&:not([data-disabled]):active": {
|
|
2719
|
-
[varNames.color.bg]: tinted.bg[
|
|
2697
|
+
[varNames.color.bg]: tinted.bg[3],
|
|
2720
2698
|
[varNames.color.border]: tinted.border[3],
|
|
2721
2699
|
[varNames.color.fg]: tinted.fg[1],
|
|
2722
2700
|
"--button-box-shadow": "inset 0 0 0 var(--button-border-width) var(--color-border)"
|
|
2723
2701
|
},
|
|
2724
2702
|
"&:not([data-disabled])[data-selected]": {
|
|
2725
|
-
[varNames.color.bg]: tinted.bg[
|
|
2703
|
+
[varNames.color.bg]: tinted.bg[3],
|
|
2726
2704
|
[varNames.color.border]: tinted.border[3],
|
|
2727
2705
|
[varNames.color.fg]: tinted.fg[1],
|
|
2728
2706
|
"--button-box-shadow": "inset 0 0 0 var(--button-border-width) var(--color-border)"
|
|
2729
2707
|
},
|
|
2730
2708
|
"&[data-disabled]": {
|
|
2731
|
-
[varNames.color.bg]: vars.color.default.tinted.bg[
|
|
2709
|
+
[varNames.color.bg]: vars.color.default.tinted.bg[1],
|
|
2732
2710
|
[varNames.color.border]: vars.color.default.tinted.border[0],
|
|
2733
2711
|
[varNames.color.fg]: vars.color.default.tinted.fg[2]
|
|
2734
2712
|
}
|
|
@@ -2773,8 +2751,8 @@ const buttonStyle = {
|
|
|
2773
2751
|
primitive: primitive$i
|
|
2774
2752
|
}
|
|
2775
2753
|
}, toneMap = {
|
|
2776
|
-
transparent: "
|
|
2777
|
-
default: "
|
|
2754
|
+
transparent: "transparent",
|
|
2755
|
+
default: "default",
|
|
2778
2756
|
neutral: "neutral",
|
|
2779
2757
|
suggest: "suggest",
|
|
2780
2758
|
primary: "accent",
|
|
@@ -4087,7 +4065,6 @@ function compileThemeProperties(theme2) {
|
|
|
4087
4065
|
...buildRadiusThemeProperties(theme2),
|
|
4088
4066
|
...buildShadowThemeProperties(theme2),
|
|
4089
4067
|
...buildSpaceThemeProperties(theme2),
|
|
4090
|
-
// ...buildColorPaletteProperties(palette),
|
|
4091
4068
|
...buildColorThemeProperties(theme2)
|
|
4092
4069
|
};
|
|
4093
4070
|
}
|
|
@@ -4379,7 +4356,7 @@ function scopeClassName(className) {
|
|
|
4379
4356
|
return `${PREFIX}${className.trim()}`;
|
|
4380
4357
|
}
|
|
4381
4358
|
function _comp(...classNames) {
|
|
4382
|
-
return getClassNames(...classNames).map(scopeClassName).join(" ") || void 0;
|
|
4359
|
+
return getClassNames(...classNames).filter(Boolean).map(scopeClassName).join(" ") || void 0;
|
|
4383
4360
|
}
|
|
4384
4361
|
function breadcrumbs() {
|
|
4385
4362
|
return _comp("breadcrumbs");
|
|
@@ -4447,7 +4424,7 @@ function shadow(props) {
|
|
|
4447
4424
|
return composeClassNames(_resp("shadow", props.shadow));
|
|
4448
4425
|
}
|
|
4449
4426
|
function textOverflow(props) {
|
|
4450
|
-
return
|
|
4427
|
+
return _comp(props.textOverflow && `text-overflow-${props.textOverflow}`);
|
|
4451
4428
|
}
|
|
4452
4429
|
function width(props) {
|
|
4453
4430
|
return _resp("w", props.width) ?? "";
|
|
@@ -4593,7 +4570,7 @@ function buttonLoadingBox() {
|
|
|
4593
4570
|
return "button-loading-box";
|
|
4594
4571
|
}
|
|
4595
4572
|
function card(props) {
|
|
4596
|
-
return _comp(props.scheme, toneMap[props.tone ?? "
|
|
4573
|
+
return _comp(props.scheme, toneMap[props.tone ?? "default"], "card", props.checkered && "card-checkered", shadow(props));
|
|
4597
4574
|
}
|
|
4598
4575
|
function checkbox() {
|
|
4599
4576
|
return _comp("checkbox");
|