@sanity/ui 3.0.0-static.3 → 3.0.0-static.5
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 +98 -64
- 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 +99 -65
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +4 -1
- package/dist/_visual-editing.d.ts +4 -1
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +145 -893
- package/dist/css.d.ts +145 -893
- package/dist/css.js +182 -191
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +182 -191
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -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 +114 -109
- package/dist/theme.d.mts +1 -43
- package/dist/theme.d.ts +1 -43
- package/dist/theme.js +291 -102
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +272 -85
- 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/flex/flexJustify.style.ts +3 -3
- package/src/css/aspects/grid/types.ts +2 -2
- 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/index.ts +2 -2
- 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 +12 -13
- package/src/css/primitives/card/_constants.ts +2 -2
- package/src/css/primitives/card/card.ts +1 -1
- package/src/css/primitives/stack/index.ts +1 -0
- package/src/css/primitives/stack/stack.style.ts +9 -0
- package/src/css/primitives/stack/stack.ts +6 -0
- package/src/css/system.style.ts +2 -0
- 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/box/box.tsx +6 -0
- package/src/ui/primitives/button/button.tsx +12 -11
- 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/stack/stack.tsx +10 -5
- package/src/ui/primitives/text/text.tsx +1 -1
- package/dist/_chunks-cjs/v3_v2.js +0 -251
- package/dist/_chunks-cjs/v3_v2.js.map +0 -1
- package/dist/_chunks-es/v3_v2.mjs +0 -252
- package/dist/_chunks-es/v3_v2.mjs.map +0 -1
package/dist/theme.d.ts
CHANGED
|
@@ -280,8 +280,6 @@ export declare type CSSObject = StyledObject<any>
|
|
|
280
280
|
|
|
281
281
|
declare type CSSVariableKey = `--${string}`
|
|
282
282
|
|
|
283
|
-
export declare const defaultPalette: PaletteConfig
|
|
284
|
-
|
|
285
283
|
export declare const defaultTokens: PartialTokens<Tokens>
|
|
286
284
|
|
|
287
285
|
/** @public */
|
|
@@ -423,24 +421,6 @@ export declare function mix(b: RGB | RGBA, s: RGB | RGBA, weight: number): RGB
|
|
|
423
421
|
*/
|
|
424
422
|
export declare function multiply(b: RGB | RGBA, s: RGB | RGBA): RGB
|
|
425
423
|
|
|
426
|
-
export declare type PaletteConfig = {
|
|
427
|
-
chroma: {
|
|
428
|
-
min: number
|
|
429
|
-
max: number
|
|
430
|
-
}
|
|
431
|
-
luminosity: {
|
|
432
|
-
min: number
|
|
433
|
-
max: number
|
|
434
|
-
}
|
|
435
|
-
hues: Record<
|
|
436
|
-
Hue,
|
|
437
|
-
{
|
|
438
|
-
h: number
|
|
439
|
-
c: number
|
|
440
|
-
}
|
|
441
|
-
>
|
|
442
|
-
}
|
|
443
|
-
|
|
444
424
|
/**
|
|
445
425
|
* @internal
|
|
446
426
|
*/
|
|
@@ -746,7 +726,6 @@ export declare type Theme_v2 = Omit<RootTheme_v2, 'color'> & {
|
|
|
746
726
|
*/
|
|
747
727
|
export declare interface Theme_v3 {
|
|
748
728
|
_version: 3
|
|
749
|
-
_palette: PaletteConfig
|
|
750
729
|
_tokens: Tokens
|
|
751
730
|
avatar: ThemeAvatar_v2
|
|
752
731
|
button: {
|
|
@@ -1780,7 +1759,6 @@ export declare interface ThemeLayer {
|
|
|
1780
1759
|
/** @public */
|
|
1781
1760
|
export declare interface ThemeOptions {
|
|
1782
1761
|
v2?: ThemeConfig
|
|
1783
|
-
palette?: PaletteConfig
|
|
1784
1762
|
tokens?: PartialTokens<Tokens>
|
|
1785
1763
|
}
|
|
1786
1764
|
|
|
@@ -1807,27 +1785,7 @@ export declare interface ThemeStyles {
|
|
|
1807
1785
|
|
|
1808
1786
|
export declare type Tint = (typeof TINTS)[number]
|
|
1809
1787
|
|
|
1810
|
-
export declare const TINTS: readonly [
|
|
1811
|
-
50,
|
|
1812
|
-
100,
|
|
1813
|
-
150,
|
|
1814
|
-
200,
|
|
1815
|
-
250,
|
|
1816
|
-
300,
|
|
1817
|
-
350,
|
|
1818
|
-
400,
|
|
1819
|
-
450,
|
|
1820
|
-
500,
|
|
1821
|
-
550,
|
|
1822
|
-
600,
|
|
1823
|
-
650,
|
|
1824
|
-
700,
|
|
1825
|
-
750,
|
|
1826
|
-
800,
|
|
1827
|
-
850,
|
|
1828
|
-
900,
|
|
1829
|
-
950,
|
|
1830
|
-
]
|
|
1788
|
+
export declare const TINTS: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
1831
1789
|
|
|
1832
1790
|
/** @internal */
|
|
1833
1791
|
export declare interface TokenBaseKeyNode {
|
package/dist/theme.js
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var
|
|
4
|
-
function isColorBlendModeValue(str) {
|
|
5
|
-
return v3_v2.THEME_COLOR_BLEND_MODES.includes(str);
|
|
6
|
-
}
|
|
7
|
-
function isColorHueKey(str) {
|
|
8
|
-
return color.COLOR_HUES.includes(str);
|
|
9
|
-
}
|
|
10
|
-
function isColorTintKey(str) {
|
|
11
|
-
return color.COLOR_TINTS.includes(str);
|
|
12
|
-
}
|
|
13
|
-
function isColorButtonMode(str) {
|
|
14
|
-
return v3_v2.THEME_COLOR_BUTTON_MODES.includes(str);
|
|
15
|
-
}
|
|
3
|
+
var color = require("@sanity/color");
|
|
16
4
|
const AVATAR_SIZE = [0, 1, 2, 3], CONTAINER = [0, 1, 2, 3, 4, 5, "auto"], RADIUS = [0, 1, 2, 3, 4, 5, 6, "full"], SPACE = [0, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9], FONT_CODE_SIZE = [0, 1, 2, 3, 4], FONT_HEADING_SIZE = [0, 1, 2, 3, 4, 5], FONT_LABEL_SIZE = [0, 1, 2, 3, 4, 5], FONT_TEXT_SIZE = [0, 1, 2, 3, 4], SHADOW = [0, 1, 2, 3, 4, 5];
|
|
17
5
|
function createSelectableTones(opts, base, dark, solid, muted) {
|
|
18
6
|
return {
|
|
@@ -1153,7 +1141,7 @@ const defaultThemeConfig = {
|
|
|
1153
1141
|
button: {
|
|
1154
1142
|
textWeight: "medium",
|
|
1155
1143
|
border: {
|
|
1156
|
-
width:
|
|
1144
|
+
width: 1
|
|
1157
1145
|
},
|
|
1158
1146
|
focusRing: {
|
|
1159
1147
|
offset: -1,
|
|
@@ -1162,7 +1150,7 @@ const defaultThemeConfig = {
|
|
|
1162
1150
|
},
|
|
1163
1151
|
card: {
|
|
1164
1152
|
border: {
|
|
1165
|
-
width:
|
|
1153
|
+
width: 1
|
|
1166
1154
|
},
|
|
1167
1155
|
focusRing: {
|
|
1168
1156
|
offset: -1,
|
|
@@ -1185,7 +1173,7 @@ const defaultThemeConfig = {
|
|
|
1185
1173
|
zOffset: 200
|
|
1186
1174
|
}
|
|
1187
1175
|
},
|
|
1188
|
-
radius: [0, 1,
|
|
1176
|
+
radius: [0, 1, 3, 7, 11, 15, 23, 43, 75, 127],
|
|
1189
1177
|
shadow: [null, {
|
|
1190
1178
|
umbra: [0, 0, 0, 0],
|
|
1191
1179
|
penumbra: [0, 0, 0, 0],
|
|
@@ -1210,7 +1198,7 @@ const defaultThemeConfig = {
|
|
|
1210
1198
|
space: [0, 4, 8, 12, 20, 32, 52, 84, 136, 220],
|
|
1211
1199
|
input: {
|
|
1212
1200
|
border: {
|
|
1213
|
-
width:
|
|
1201
|
+
width: 1
|
|
1214
1202
|
},
|
|
1215
1203
|
checkbox: {
|
|
1216
1204
|
size: 17,
|
|
@@ -1301,10 +1289,10 @@ const defaultThemeConfig = {
|
|
|
1301
1289
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
1302
1290
|
featureSettings: "'liga' 1, 'calt' 1, 'ss01' 1, 'ss03' 1, 'zero' 1",
|
|
1303
1291
|
weights: {
|
|
1304
|
-
regular:
|
|
1305
|
-
medium:
|
|
1306
|
-
semibold:
|
|
1307
|
-
bold:
|
|
1292
|
+
regular: 600,
|
|
1293
|
+
medium: 700,
|
|
1294
|
+
semibold: 800,
|
|
1295
|
+
bold: 900
|
|
1308
1296
|
},
|
|
1309
1297
|
sizes: [{
|
|
1310
1298
|
ascenderHeight: 5,
|
|
@@ -1447,7 +1435,39 @@ const defaultThemeConfig = {
|
|
|
1447
1435
|
letterSpacing: 0
|
|
1448
1436
|
}]
|
|
1449
1437
|
}
|
|
1450
|
-
},
|
|
1438
|
+
}, THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1439
|
+
"transparent",
|
|
1440
|
+
"default",
|
|
1441
|
+
"neutral",
|
|
1442
|
+
"primary",
|
|
1443
|
+
// deprecated
|
|
1444
|
+
"suggest",
|
|
1445
|
+
"positive",
|
|
1446
|
+
"caution",
|
|
1447
|
+
"critical"
|
|
1448
|
+
], THEME_COLOR_STATE_TONES = [
|
|
1449
|
+
"default",
|
|
1450
|
+
"neutral",
|
|
1451
|
+
"primary",
|
|
1452
|
+
// deprecated
|
|
1453
|
+
"suggest",
|
|
1454
|
+
"positive",
|
|
1455
|
+
"caution",
|
|
1456
|
+
"critical"
|
|
1457
|
+
], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = color.COLOR_HUES;
|
|
1458
|
+
function isColorBlendModeValue(str) {
|
|
1459
|
+
return THEME_COLOR_BLEND_MODES.includes(str);
|
|
1460
|
+
}
|
|
1461
|
+
function isColorHueKey(str) {
|
|
1462
|
+
return color.COLOR_HUES.includes(str);
|
|
1463
|
+
}
|
|
1464
|
+
function isColorTintKey(str) {
|
|
1465
|
+
return color.COLOR_TINTS.includes(str);
|
|
1466
|
+
}
|
|
1467
|
+
function isColorButtonMode(str) {
|
|
1468
|
+
return THEME_COLOR_BUTTON_MODES.includes(str);
|
|
1469
|
+
}
|
|
1470
|
+
const HUES = ["gray", "blue", "purple", "magenta", "red", "orange", "yellow", "green", "cyan"], TINTS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950], RE_PERCENTAGE = /^([0-9]+)%/, RE_OPACITY = /^(1|0\.[0-9]+)?/;
|
|
1451
1471
|
function parseColor$1(str) {
|
|
1452
1472
|
let cursor = 0;
|
|
1453
1473
|
const color2 = getColor();
|
|
@@ -1546,7 +1566,7 @@ function buildColorScheme_v3(tokens, options) {
|
|
|
1546
1566
|
scheme
|
|
1547
1567
|
} = options;
|
|
1548
1568
|
return {
|
|
1549
|
-
card:
|
|
1569
|
+
card: THEME_COLOR_CARD_TONES.reduce((acc, tone) => (acc[tone] = buildColorCard_v3(tokens[tone], {
|
|
1550
1570
|
scheme
|
|
1551
1571
|
}), acc), {})
|
|
1552
1572
|
};
|
|
@@ -1561,7 +1581,7 @@ function buildColorCard_v3(tokens, options) {
|
|
|
1561
1581
|
};
|
|
1562
1582
|
return {
|
|
1563
1583
|
_hue: tokens._hue ?? "gray",
|
|
1564
|
-
avatar:
|
|
1584
|
+
avatar: THEME_COLOR_AVATAR_COLORS.reduce((acc, hue) => {
|
|
1565
1585
|
const avatarTokens = tokens.avatar[hue];
|
|
1566
1586
|
return acc[hue] = {
|
|
1567
1587
|
bg: renderColor(avatarTokens.bg, {
|
|
@@ -1628,7 +1648,7 @@ function buildColorCard_v3(tokens, options) {
|
|
|
1628
1648
|
},
|
|
1629
1649
|
variant: {
|
|
1630
1650
|
solid: {
|
|
1631
|
-
...
|
|
1651
|
+
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
|
|
1632
1652
|
...acc,
|
|
1633
1653
|
[tone]: buildColorElement_v3(tokens.variant.solid[tone], {
|
|
1634
1654
|
scheme
|
|
@@ -1636,7 +1656,7 @@ function buildColorCard_v3(tokens, options) {
|
|
|
1636
1656
|
}), {})
|
|
1637
1657
|
},
|
|
1638
1658
|
tinted: {
|
|
1639
|
-
...
|
|
1659
|
+
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
|
|
1640
1660
|
...acc,
|
|
1641
1661
|
[tone]: buildColorElement_v3(tokens.variant.tinted[tone], {
|
|
1642
1662
|
scheme
|
|
@@ -1670,54 +1690,7 @@ function buildColorElement_v3(tokens, options) {
|
|
|
1670
1690
|
}
|
|
1671
1691
|
};
|
|
1672
1692
|
}
|
|
1673
|
-
const
|
|
1674
|
-
chroma: {
|
|
1675
|
-
min: 5e-3,
|
|
1676
|
-
max: 0.2325
|
|
1677
|
-
},
|
|
1678
|
-
luminosity: {
|
|
1679
|
-
min: 0.1875,
|
|
1680
|
-
max: 1
|
|
1681
|
-
},
|
|
1682
|
-
hues: {
|
|
1683
|
-
gray: {
|
|
1684
|
-
h: 277,
|
|
1685
|
-
c: 0.04
|
|
1686
|
-
},
|
|
1687
|
-
blue: {
|
|
1688
|
-
h: 273,
|
|
1689
|
-
c: 0.185
|
|
1690
|
-
},
|
|
1691
|
-
purple: {
|
|
1692
|
-
h: 295,
|
|
1693
|
-
c: 0.4
|
|
1694
|
-
},
|
|
1695
|
-
magenta: {
|
|
1696
|
-
h: 12,
|
|
1697
|
-
c: 0.4
|
|
1698
|
-
},
|
|
1699
|
-
red: {
|
|
1700
|
-
h: 30,
|
|
1701
|
-
c: 0.4
|
|
1702
|
-
},
|
|
1703
|
-
orange: {
|
|
1704
|
-
h: 68,
|
|
1705
|
-
c: 0.4
|
|
1706
|
-
},
|
|
1707
|
-
yellow: {
|
|
1708
|
-
h: 90,
|
|
1709
|
-
c: 0.4
|
|
1710
|
-
},
|
|
1711
|
-
green: {
|
|
1712
|
-
h: 171,
|
|
1713
|
-
c: 0.4
|
|
1714
|
-
},
|
|
1715
|
-
cyan: {
|
|
1716
|
-
h: 194,
|
|
1717
|
-
c: 0.4
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
}, defaultTokens = {
|
|
1693
|
+
const defaultTokens = {
|
|
1721
1694
|
color: {
|
|
1722
1695
|
"*": {
|
|
1723
1696
|
// backdrop: ['black/0.2', '200/0.2'],
|
|
@@ -1773,12 +1746,12 @@ const defaultPalette = {
|
|
|
1773
1746
|
tinted: {
|
|
1774
1747
|
"*": {
|
|
1775
1748
|
bg: {
|
|
1776
|
-
0: ["
|
|
1777
|
-
4: ["800", "
|
|
1749
|
+
0: ["950", "50"],
|
|
1750
|
+
4: ["800", "100"]
|
|
1778
1751
|
},
|
|
1779
1752
|
border: {
|
|
1780
|
-
0: ["800", "
|
|
1781
|
-
4: ["600", "
|
|
1753
|
+
0: ["800", "100"],
|
|
1754
|
+
4: ["600", "300"]
|
|
1782
1755
|
},
|
|
1783
1756
|
fg: {
|
|
1784
1757
|
0: ["100", "900"],
|
|
@@ -1850,15 +1823,15 @@ const defaultPalette = {
|
|
|
1850
1823
|
"*": {
|
|
1851
1824
|
bg: {
|
|
1852
1825
|
0: ["black", "gray/50"],
|
|
1853
|
-
4: ["
|
|
1826
|
+
4: ["800", "300 50%"]
|
|
1854
1827
|
},
|
|
1855
1828
|
border: {
|
|
1856
|
-
0: ["900", "
|
|
1857
|
-
4: ["700", "
|
|
1829
|
+
0: ["900", "300 40%"],
|
|
1830
|
+
4: ["700", "300"]
|
|
1858
1831
|
},
|
|
1859
1832
|
fg: {
|
|
1860
|
-
0: ["
|
|
1861
|
-
4: ["
|
|
1833
|
+
0: ["100", "black"],
|
|
1834
|
+
4: ["500", "600"]
|
|
1862
1835
|
}
|
|
1863
1836
|
}
|
|
1864
1837
|
}
|
|
@@ -1870,11 +1843,11 @@ const defaultPalette = {
|
|
|
1870
1843
|
"*": {
|
|
1871
1844
|
bg: {
|
|
1872
1845
|
0: ["gray/950", "white"],
|
|
1873
|
-
4: ["
|
|
1846
|
+
4: ["800", "200"]
|
|
1874
1847
|
},
|
|
1875
1848
|
border: {
|
|
1876
|
-
0: ["
|
|
1877
|
-
4: ["
|
|
1849
|
+
0: ["800", "100"],
|
|
1850
|
+
4: ["600", "300"]
|
|
1878
1851
|
},
|
|
1879
1852
|
fg: {
|
|
1880
1853
|
0: ["white", "black"],
|
|
@@ -1932,7 +1905,7 @@ function resolveTokens(tokens = {}) {
|
|
|
1932
1905
|
return {
|
|
1933
1906
|
color: {
|
|
1934
1907
|
"*": resolveCardColorTokens(tokens.color?.["*"]),
|
|
1935
|
-
...
|
|
1908
|
+
...THEME_COLOR_CARD_TONES.reduce((acc, tone) => ({
|
|
1936
1909
|
...acc,
|
|
1937
1910
|
[tone]: resolveCardColorTokens(merge(tokens.color?.["*"], tokens.color?.[tone]))
|
|
1938
1911
|
}), {})
|
|
@@ -2045,11 +2018,11 @@ function resolveCardColorTokens(tokens) {
|
|
|
2045
2018
|
variant: {
|
|
2046
2019
|
solid: {
|
|
2047
2020
|
"*": resolveElementTokens(tokens?.variant?.solid?.["*"]),
|
|
2048
|
-
...
|
|
2021
|
+
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = resolveElementTokens(merge(tokens, tokens?.variant?.solid?.["*"], tokens?.variant?.solid?.[tone])), acc), {})
|
|
2049
2022
|
},
|
|
2050
2023
|
tinted: {
|
|
2051
2024
|
"*": resolveElementTokens(tokens?.variant?.tinted?.["*"]),
|
|
2052
|
-
...
|
|
2025
|
+
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = resolveElementTokens(merge(tokens, tokens?.variant?.tinted?.["*"], tokens?.variant?.tinted?.[tone])), acc), {})
|
|
2053
2026
|
}
|
|
2054
2027
|
}
|
|
2055
2028
|
};
|
|
@@ -2077,7 +2050,6 @@ function buildTheme_v3(options) {
|
|
|
2077
2050
|
} = options ?? {}, tokens = resolveTokens(options?.tokens ?? defaultTokens);
|
|
2078
2051
|
return {
|
|
2079
2052
|
_version: 3,
|
|
2080
|
-
_palette: options?.palette ?? defaultPalette,
|
|
2081
2053
|
_tokens: tokens,
|
|
2082
2054
|
avatar: v2?.avatar ?? defaultThemeConfig.avatar,
|
|
2083
2055
|
button: v2?.button ?? defaultThemeConfig.button,
|
|
@@ -2201,11 +2173,229 @@ function inputStateThemeColor_v2_v0(t) {
|
|
|
2201
2173
|
placeholder: t.placeholder
|
|
2202
2174
|
};
|
|
2203
2175
|
}
|
|
2176
|
+
function themeColor_v3_v2(options) {
|
|
2177
|
+
const {
|
|
2178
|
+
color: color2,
|
|
2179
|
+
dark
|
|
2180
|
+
} = options;
|
|
2181
|
+
return {
|
|
2182
|
+
_blend: "screen",
|
|
2183
|
+
_dark: dark,
|
|
2184
|
+
...buildColorState({
|
|
2185
|
+
cardColor: color2,
|
|
2186
|
+
state: "enabled",
|
|
2187
|
+
tone: "default",
|
|
2188
|
+
variant: "tinted"
|
|
2189
|
+
}),
|
|
2190
|
+
backdrop: color2.backdrop,
|
|
2191
|
+
button: THEME_COLOR_BUTTON_MODES.reduce((modes, mode) => (modes[mode] = THEME_COLOR_STATE_TONES.reduce((tones2, tone) => (tones2[tone] = THEME_COLOR_STATES.reduce((states, state) => (states[state] = buildColorState({
|
|
2192
|
+
cardColor: color2,
|
|
2193
|
+
state,
|
|
2194
|
+
tone,
|
|
2195
|
+
variant: mode === "default" ? "solid" : "tinted"
|
|
2196
|
+
}), mode === "bleed" && (states[state].border = "transparent"), states), {}), tones2), {}), modes), {}),
|
|
2197
|
+
focusRing: color2.focusRing,
|
|
2198
|
+
input: THEME_COLOR_INPUT_MODES.reduce((modes, mode) => (modes[mode] = THEME_COLOR_INPUT_STATES.reduce((states, state) => (states[state] = buildInputState(color2.variant.tinted.default), states), {}), modes), {}),
|
|
2199
|
+
selectable: THEME_COLOR_STATE_TONES.reduce((tones2, tone) => (tones2[tone] = THEME_COLOR_STATES.reduce((states, state) => (states[state] = buildColorState({
|
|
2200
|
+
cardColor: color2,
|
|
2201
|
+
// cardVars: vars,
|
|
2202
|
+
state,
|
|
2203
|
+
tone,
|
|
2204
|
+
variant: "tinted"
|
|
2205
|
+
}), states), {}), tones2), {}),
|
|
2206
|
+
shadow: color2.shadow,
|
|
2207
|
+
syntax: color2.token
|
|
2208
|
+
};
|
|
2209
|
+
}
|
|
2210
|
+
const stateShades = {
|
|
2211
|
+
enabled: {
|
|
2212
|
+
bg: [0, 1, 2],
|
|
2213
|
+
border: [0, 1, 2],
|
|
2214
|
+
fg: [0, 1, 2]
|
|
2215
|
+
},
|
|
2216
|
+
hovered: {
|
|
2217
|
+
bg: [1, 2, 3],
|
|
2218
|
+
border: [1, 2, 3],
|
|
2219
|
+
fg: [1, 2, 3]
|
|
2220
|
+
},
|
|
2221
|
+
pressed: {
|
|
2222
|
+
bg: [2, 3, 4],
|
|
2223
|
+
border: [2, 3, 4],
|
|
2224
|
+
fg: [2, 3, 4]
|
|
2225
|
+
},
|
|
2226
|
+
selected: {
|
|
2227
|
+
bg: [3, 4, 4],
|
|
2228
|
+
border: [3, 4, 4],
|
|
2229
|
+
fg: [3, 4, 4]
|
|
2230
|
+
},
|
|
2231
|
+
disabled: {
|
|
2232
|
+
bg: [4, 4, 4],
|
|
2233
|
+
border: [4, 4, 4],
|
|
2234
|
+
fg: [4, 4, 4]
|
|
2235
|
+
}
|
|
2236
|
+
};
|
|
2237
|
+
function mix$1(tokens, index) {
|
|
2238
|
+
return index === 0 ? tokens[0] : index === 4 ? tokens[4] : `color-mix(in oklch, ${tokens[0]}, ${tokens[4]} ${index * 25}%)`;
|
|
2239
|
+
}
|
|
2240
|
+
function buildColorState(options) {
|
|
2241
|
+
const {
|
|
2242
|
+
cardColor,
|
|
2243
|
+
state,
|
|
2244
|
+
tone,
|
|
2245
|
+
variant
|
|
2246
|
+
} = options, color2 = cardColor.variant[variant][tone], shades = stateShades[state];
|
|
2247
|
+
return {
|
|
2248
|
+
accent: {
|
|
2249
|
+
fg: color2.fg[4]
|
|
2250
|
+
},
|
|
2251
|
+
avatar: cardColor.avatar,
|
|
2252
|
+
badge: THEME_COLOR_STATE_TONES.reduce((tones2, tone2) => (tones2[tone2] = {
|
|
2253
|
+
bg: mix$1(color2.bg, 1),
|
|
2254
|
+
fg: mix$1(color2.fg, 1),
|
|
2255
|
+
dot: mix$1(color2.fg, 3),
|
|
2256
|
+
icon: mix$1(color2.fg, 3)
|
|
2257
|
+
}, tones2), {}),
|
|
2258
|
+
bg: mix$1(color2.bg, shades.bg[0]),
|
|
2259
|
+
border: mix$1(color2.border, shades.border[0]),
|
|
2260
|
+
fg: mix$1(color2.fg, shades.fg[0]),
|
|
2261
|
+
code: {
|
|
2262
|
+
bg: mix$1(color2.bg, shades.bg[1]),
|
|
2263
|
+
fg: mix$1(color2.fg, shades.fg[2])
|
|
2264
|
+
},
|
|
2265
|
+
icon: mix$1(color2.fg, shades.fg[2]),
|
|
2266
|
+
kbd: {
|
|
2267
|
+
bg: mix$1(color2.bg, 0),
|
|
2268
|
+
fg: mix$1(color2.fg, 0),
|
|
2269
|
+
border: mix$1(color2.bg, 0)
|
|
2270
|
+
},
|
|
2271
|
+
link: {
|
|
2272
|
+
fg: mix$1(color2.fg, shades.fg[2])
|
|
2273
|
+
},
|
|
2274
|
+
muted: {
|
|
2275
|
+
bg: mix$1(color2.bg, shades.bg[1]),
|
|
2276
|
+
fg: mix$1(color2.fg, shades.fg[2])
|
|
2277
|
+
},
|
|
2278
|
+
skeleton: cardColor.skeleton
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
function buildInputState(colorElement) {
|
|
2282
|
+
return {
|
|
2283
|
+
bg: colorElement.bg[0],
|
|
2284
|
+
border: colorElement.bg[0],
|
|
2285
|
+
fg: colorElement.fg[0],
|
|
2286
|
+
muted: {
|
|
2287
|
+
bg: colorElement.bg[0]
|
|
2288
|
+
},
|
|
2289
|
+
placeholder: colorElement.fg[0]
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2292
|
+
function v3_v2(theme_v3) {
|
|
2293
|
+
return {
|
|
2294
|
+
_version: 2,
|
|
2295
|
+
avatar: theme_v3.avatar,
|
|
2296
|
+
button: theme_v3.button,
|
|
2297
|
+
card: theme_v3.card,
|
|
2298
|
+
color: {
|
|
2299
|
+
dark: {
|
|
2300
|
+
transparent: themeColor_v3_v2({
|
|
2301
|
+
color: theme_v3.color.dark.card.transparent,
|
|
2302
|
+
dark: !0
|
|
2303
|
+
// vars: vars.color.dark.transparent,
|
|
2304
|
+
}),
|
|
2305
|
+
default: themeColor_v3_v2({
|
|
2306
|
+
color: theme_v3.color.dark.card.default,
|
|
2307
|
+
dark: !0
|
|
2308
|
+
// vars: vars.color.dark.default,
|
|
2309
|
+
}),
|
|
2310
|
+
neutral: themeColor_v3_v2({
|
|
2311
|
+
color: theme_v3.color.dark.card.neutral,
|
|
2312
|
+
dark: !0
|
|
2313
|
+
// vars: vars.color.dark.neutral,
|
|
2314
|
+
}),
|
|
2315
|
+
primary: themeColor_v3_v2({
|
|
2316
|
+
color: theme_v3.color.dark.card.primary,
|
|
2317
|
+
dark: !0
|
|
2318
|
+
// vars: vars.color.dark.primary,
|
|
2319
|
+
}),
|
|
2320
|
+
suggest: themeColor_v3_v2({
|
|
2321
|
+
color: theme_v3.color.dark.card.suggest,
|
|
2322
|
+
dark: !0
|
|
2323
|
+
// vars: vars.color.dark.suggest,
|
|
2324
|
+
}),
|
|
2325
|
+
positive: themeColor_v3_v2({
|
|
2326
|
+
color: theme_v3.color.dark.card.positive,
|
|
2327
|
+
dark: !0
|
|
2328
|
+
// vars: vars.color.dark.positive,
|
|
2329
|
+
}),
|
|
2330
|
+
caution: themeColor_v3_v2({
|
|
2331
|
+
color: theme_v3.color.dark.card.caution,
|
|
2332
|
+
dark: !0
|
|
2333
|
+
// vars: vars.color.dark.caution,
|
|
2334
|
+
}),
|
|
2335
|
+
critical: themeColor_v3_v2({
|
|
2336
|
+
color: theme_v3.color.dark.card.critical,
|
|
2337
|
+
dark: !0
|
|
2338
|
+
// vars: vars.color.dark.critical,
|
|
2339
|
+
})
|
|
2340
|
+
},
|
|
2341
|
+
light: {
|
|
2342
|
+
transparent: themeColor_v3_v2({
|
|
2343
|
+
color: theme_v3.color.light.card.transparent,
|
|
2344
|
+
dark: !1
|
|
2345
|
+
// vars: vars.color.light.transparent,
|
|
2346
|
+
}),
|
|
2347
|
+
default: themeColor_v3_v2({
|
|
2348
|
+
color: theme_v3.color.light.card.default,
|
|
2349
|
+
dark: !1
|
|
2350
|
+
// vars: vars.color.light.default,
|
|
2351
|
+
}),
|
|
2352
|
+
neutral: themeColor_v3_v2({
|
|
2353
|
+
color: theme_v3.color.light.card.neutral,
|
|
2354
|
+
dark: !1
|
|
2355
|
+
// vars: vars.color.light.neutral,
|
|
2356
|
+
}),
|
|
2357
|
+
primary: themeColor_v3_v2({
|
|
2358
|
+
color: theme_v3.color.light.card.primary,
|
|
2359
|
+
dark: !1
|
|
2360
|
+
// vars: vars.color.light.primary,
|
|
2361
|
+
}),
|
|
2362
|
+
suggest: themeColor_v3_v2({
|
|
2363
|
+
color: theme_v3.color.light.card.suggest,
|
|
2364
|
+
dark: !1
|
|
2365
|
+
// vars: vars.color.light.suggest,
|
|
2366
|
+
}),
|
|
2367
|
+
positive: themeColor_v3_v2({
|
|
2368
|
+
color: theme_v3.color.light.card.positive,
|
|
2369
|
+
dark: !1
|
|
2370
|
+
// vars: vars.color.light.positive,
|
|
2371
|
+
}),
|
|
2372
|
+
caution: themeColor_v3_v2({
|
|
2373
|
+
color: theme_v3.color.light.card.caution,
|
|
2374
|
+
dark: !1
|
|
2375
|
+
// vars: vars.color.light.caution,
|
|
2376
|
+
}),
|
|
2377
|
+
critical: themeColor_v3_v2({
|
|
2378
|
+
color: theme_v3.color.light.card.critical,
|
|
2379
|
+
dark: !1
|
|
2380
|
+
// vars: vars.color.light.critical,
|
|
2381
|
+
})
|
|
2382
|
+
}
|
|
2383
|
+
},
|
|
2384
|
+
container: theme_v3.container,
|
|
2385
|
+
font: theme_v3.font,
|
|
2386
|
+
input: theme_v3.input,
|
|
2387
|
+
layer: theme_v3.layer,
|
|
2388
|
+
media: theme_v3.media,
|
|
2389
|
+
radius: theme_v3.radius,
|
|
2390
|
+
shadow: theme_v3.shadow,
|
|
2391
|
+
space: theme_v3.space
|
|
2392
|
+
};
|
|
2393
|
+
}
|
|
2204
2394
|
function buildTheme(_config) {
|
|
2205
2395
|
const v3 = buildTheme_v3({
|
|
2206
2396
|
v2: _config
|
|
2207
2397
|
});
|
|
2208
|
-
return v2_v0(v3_v2
|
|
2398
|
+
return v2_v0(v3_v2(v3), v3);
|
|
2209
2399
|
}
|
|
2210
2400
|
function mixChannel(b, s, weight) {
|
|
2211
2401
|
const delta = (s - b) * weight;
|
|
@@ -2354,7 +2544,7 @@ function rgba(color2, a) {
|
|
|
2354
2544
|
const rgb = parseColor(color2);
|
|
2355
2545
|
return `rgba(${rgb.r},${rgb.g},${rgb.b},${a})`;
|
|
2356
2546
|
}
|
|
2357
|
-
const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "accent/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to", "status/dot", "status/icon"], COLOR_CONFIG_CARD_KEYS = [...COLOR_CONFIG_STATE_KEYS, "_hue", "bg", "fg", "border", "focusRing", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient"], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...
|
|
2547
|
+
const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "accent/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to", "status/dot", "status/icon"], COLOR_CONFIG_CARD_KEYS = [...COLOR_CONFIG_STATE_KEYS, "_hue", "bg", "fg", "border", "focusRing", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient"], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
|
|
2358
2548
|
function parseTokenKey(str) {
|
|
2359
2549
|
const segments = str.split("/"), segment0 = segments.shift() || "";
|
|
2360
2550
|
if (isColorConfigBaseTone(segment0)) {
|
|
@@ -2920,15 +3110,6 @@ function getTheme_v2(theme) {
|
|
|
2920
3110
|
};
|
|
2921
3111
|
return cache.set(theme, v2), v2;
|
|
2922
3112
|
}
|
|
2923
|
-
exports.THEME_COLOR_AVATAR_COLORS = v3_v2.THEME_COLOR_AVATAR_COLORS;
|
|
2924
|
-
exports.THEME_COLOR_BLEND_MODES = v3_v2.THEME_COLOR_BLEND_MODES;
|
|
2925
|
-
exports.THEME_COLOR_BUTTON_MODES = v3_v2.THEME_COLOR_BUTTON_MODES;
|
|
2926
|
-
exports.THEME_COLOR_CARD_TONES = v3_v2.THEME_COLOR_CARD_TONES;
|
|
2927
|
-
exports.THEME_COLOR_INPUT_MODES = v3_v2.THEME_COLOR_INPUT_MODES;
|
|
2928
|
-
exports.THEME_COLOR_INPUT_STATES = v3_v2.THEME_COLOR_INPUT_STATES;
|
|
2929
|
-
exports.THEME_COLOR_SCHEMES = v3_v2.THEME_COLOR_SCHEMES;
|
|
2930
|
-
exports.THEME_COLOR_STATES = v3_v2.THEME_COLOR_STATES;
|
|
2931
|
-
exports.THEME_COLOR_STATE_TONES = v3_v2.THEME_COLOR_STATE_TONES;
|
|
2932
3113
|
exports.AVATAR_SIZE = AVATAR_SIZE;
|
|
2933
3114
|
exports.COLOR_CONFIG_AVATAR_COLORS = COLOR_CONFIG_AVATAR_COLORS;
|
|
2934
3115
|
exports.COLOR_CONFIG_BLEND_KEYS = COLOR_CONFIG_BLEND_KEYS;
|
|
@@ -2948,12 +3129,20 @@ exports.HUES = HUES;
|
|
|
2948
3129
|
exports.RADIUS = RADIUS;
|
|
2949
3130
|
exports.SHADOW = SHADOW;
|
|
2950
3131
|
exports.SPACE = SPACE;
|
|
3132
|
+
exports.THEME_COLOR_AVATAR_COLORS = THEME_COLOR_AVATAR_COLORS;
|
|
3133
|
+
exports.THEME_COLOR_BLEND_MODES = THEME_COLOR_BLEND_MODES;
|
|
3134
|
+
exports.THEME_COLOR_BUTTON_MODES = THEME_COLOR_BUTTON_MODES;
|
|
3135
|
+
exports.THEME_COLOR_CARD_TONES = THEME_COLOR_CARD_TONES;
|
|
3136
|
+
exports.THEME_COLOR_INPUT_MODES = THEME_COLOR_INPUT_MODES;
|
|
3137
|
+
exports.THEME_COLOR_INPUT_STATES = THEME_COLOR_INPUT_STATES;
|
|
3138
|
+
exports.THEME_COLOR_SCHEMES = THEME_COLOR_SCHEMES;
|
|
3139
|
+
exports.THEME_COLOR_STATES = THEME_COLOR_STATES;
|
|
3140
|
+
exports.THEME_COLOR_STATE_TONES = THEME_COLOR_STATE_TONES;
|
|
2951
3141
|
exports.TINTS = TINTS;
|
|
2952
3142
|
exports.buildColor_v3 = buildColor_v3;
|
|
2953
3143
|
exports.buildTheme = buildTheme;
|
|
2954
3144
|
exports.buildTheme_v3 = buildTheme_v3;
|
|
2955
3145
|
exports.createColorTheme = createColorTheme;
|
|
2956
|
-
exports.defaultPalette = defaultPalette;
|
|
2957
3146
|
exports.defaultTokens = defaultTokens;
|
|
2958
3147
|
exports.getContrastRatio = getContrastRatio;
|
|
2959
3148
|
exports.getScopedTheme = getScopedTheme;
|