@sanity/ui 3.0.0-static.10 → 3.0.0-static.3
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 +105 -143
- 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-cjs/v3_v2.js +251 -0
- package/dist/_chunks-cjs/v3_v2.js.map +1 -0
- package/dist/_chunks-es/_visual-editing.mjs +106 -144
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_chunks-es/v3_v2.mjs +252 -0
- package/dist/_chunks-es/v3_v2.mjs.map +1 -0
- package/dist/_visual-editing.d.mts +11 -14
- package/dist/_visual-editing.d.ts +11 -14
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +1006 -282
- package/dist/css.d.ts +1006 -282
- package/dist/css.js +743 -852
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +743 -852
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +11 -14
- package/dist/index.d.ts +11 -14
- package/dist/index.js +31 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -19
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-palette.css +9 -1
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +1023 -1448
- package/dist/theme.d.mts +119 -85
- package/dist/theme.d.ts +119 -85
- package/dist/theme.js +219 -432
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +202 -413
- package/dist/theme.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cli/buildCommand.ts +2 -2
- package/src/css/_comp.ts +0 -1
- package/src/css/aspects/flex/flexJustify.style.ts +3 -3
- package/src/css/aspects/grid/types.ts +2 -2
- package/src/css/aspects/index.ts +0 -1
- package/src/css/aspects/textOverflow/textOverflow.ts +2 -2
- package/src/css/compile/compilePalette.ts +41 -8
- package/src/css/compile/compileRule.ts +0 -1
- package/src/css/compile/compileStyle.ts +1 -1
- package/src/css/compile/compileTheme_v3.ts +55 -46
- package/src/css/index.ts +2 -2
- package/src/css/primitives/_input/__workshop__/index.ts +1 -1
- package/src/css/primitives/_selectable/_contants.ts +1 -1
- package/src/css/primitives/badge/badge.style.ts +1 -1
- package/src/css/primitives/box/box.style.ts +1 -1
- package/src/css/primitives/box/box.ts +0 -2
- package/src/css/primitives/box/types.ts +0 -2
- package/src/css/primitives/button/_constants.ts +1 -1
- package/src/css/primitives/button/button.style.ts +13 -32
- package/src/css/primitives/card/_constants.ts +2 -2
- package/src/css/primitives/card/card.style.ts +44 -116
- package/src/css/primitives/card/card.ts +1 -1
- package/src/css/primitives/card/rules.ts +473 -0
- package/src/css/primitives/card/types.ts +1 -0
- package/src/css/primitives/kbd/kbd.style.ts +1 -1
- package/src/css/primitives/popover/popover.ts +0 -4
- package/src/css/primitives/switch/switch.style.ts +83 -8
- package/src/css/primitives/text/text.style.ts +3 -11
- package/src/css/system.style.ts +0 -4
- package/src/css/types.ts +188 -202
- package/src/css/varNames.ts +76 -110
- package/src/css/vars.ts +76 -109
- package/src/theme/defaults/config.ts +2 -2
- package/src/theme/defaults/fonts.ts +4 -4
- package/src/theme/palette/constants.ts +3 -1
- package/src/theme/palette/types.ts +12 -0
- package/src/theme/v3/buildTheme_v3.ts +2 -1
- package/src/theme/v3/color/buildColor_v3.ts +38 -43
- package/src/theme/v3/color/card.ts +38 -43
- package/src/theme/v3/color/color.ts +38 -42
- package/src/theme/v3/defaults.ts +72 -69
- package/src/theme/v3/resolveTokens.ts +38 -43
- package/src/theme/v3/types.ts +3 -0
- package/src/theme/versioning/themeColor_v3_v2.ts +1 -1
- package/src/ui/StyleTags.tsx +1 -1
- package/src/ui/components/autocomplete/__workshop__/async.tsx +1 -0
- package/src/ui/components/autocomplete/__workshop__/index.ts +1 -1
- package/src/ui/components/autocomplete/autocomplete.tsx +11 -2
- package/src/ui/components/dialog/dialog.tsx +4 -3
- package/src/ui/constants.ts +0 -6
- package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +2 -0
- package/src/ui/primitives/box/box.tsx +2 -9
- package/src/ui/primitives/button/button.tsx +11 -12
- package/src/ui/primitives/card/card.tsx +5 -4
- package/src/ui/primitives/code/code.tsx +1 -1
- package/src/ui/primitives/heading/heading.tsx +1 -1
- package/src/ui/primitives/kbd/kbd.tsx +2 -2
- package/src/ui/primitives/popover/popover.tsx +75 -5
- package/src/ui/primitives/popover/popoverCard.tsx +39 -45
- package/src/ui/primitives/select/select.tsx +3 -3
- package/src/ui/primitives/stack/stack.tsx +5 -10
- package/src/ui/primitives/text/text.tsx +1 -1
- package/src/ui/primitives/textInput/textInput.tsx +1 -1
- package/src/ui/primitives/tooltip/tooltip.tsx +3 -2
- package/src/css/aspects/minWidth/index.ts +0 -2
- package/src/css/aspects/minWidth/minWidth.style.ts +0 -13
- package/src/css/aspects/minWidth/minWidth.ts +0 -6
- package/src/css/aspects/minWidth/types.ts +0 -7
- package/src/css/primitives/stack/index.ts +0 -1
- package/src/css/primitives/stack/stack.style.ts +0 -9
- package/src/css/primitives/stack/stack.ts +0 -6
package/dist/theme.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var color = require("@sanity/color");
|
|
3
|
+
var v3_v2 = require("./_chunks-cjs/v3_v2.js"), color = require("@sanity/color");
|
|
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
|
+
}
|
|
4
16
|
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];
|
|
5
17
|
function createSelectableTones(opts, base, dark, solid, muted) {
|
|
6
18
|
return {
|
|
@@ -1141,7 +1153,7 @@ const defaultThemeConfig = {
|
|
|
1141
1153
|
button: {
|
|
1142
1154
|
textWeight: "medium",
|
|
1143
1155
|
border: {
|
|
1144
|
-
width:
|
|
1156
|
+
width: 0.5
|
|
1145
1157
|
},
|
|
1146
1158
|
focusRing: {
|
|
1147
1159
|
offset: -1,
|
|
@@ -1150,7 +1162,7 @@ const defaultThemeConfig = {
|
|
|
1150
1162
|
},
|
|
1151
1163
|
card: {
|
|
1152
1164
|
border: {
|
|
1153
|
-
width:
|
|
1165
|
+
width: 0.5
|
|
1154
1166
|
},
|
|
1155
1167
|
focusRing: {
|
|
1156
1168
|
offset: -1,
|
|
@@ -1173,7 +1185,7 @@ const defaultThemeConfig = {
|
|
|
1173
1185
|
zOffset: 200
|
|
1174
1186
|
}
|
|
1175
1187
|
},
|
|
1176
|
-
radius: [0, 1,
|
|
1188
|
+
radius: [0, 1, 5, 9, 13, 17, 25, 45, 77, 129],
|
|
1177
1189
|
shadow: [null, {
|
|
1178
1190
|
umbra: [0, 0, 0, 0],
|
|
1179
1191
|
penumbra: [0, 0, 0, 0],
|
|
@@ -1198,7 +1210,7 @@ const defaultThemeConfig = {
|
|
|
1198
1210
|
space: [0, 4, 8, 12, 20, 32, 52, 84, 136, 220],
|
|
1199
1211
|
input: {
|
|
1200
1212
|
border: {
|
|
1201
|
-
width:
|
|
1213
|
+
width: 0.5
|
|
1202
1214
|
},
|
|
1203
1215
|
checkbox: {
|
|
1204
1216
|
size: 17,
|
|
@@ -1289,10 +1301,10 @@ const defaultThemeConfig = {
|
|
|
1289
1301
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
1290
1302
|
featureSettings: "'liga' 1, 'calt' 1, 'ss01' 1, 'ss03' 1, 'zero' 1",
|
|
1291
1303
|
weights: {
|
|
1292
|
-
regular:
|
|
1293
|
-
medium:
|
|
1294
|
-
semibold:
|
|
1295
|
-
bold:
|
|
1304
|
+
regular: 400,
|
|
1305
|
+
medium: 500,
|
|
1306
|
+
semibold: 600,
|
|
1307
|
+
bold: 700
|
|
1296
1308
|
},
|
|
1297
1309
|
sizes: [{
|
|
1298
1310
|
ascenderHeight: 5,
|
|
@@ -1435,39 +1447,7 @@ const defaultThemeConfig = {
|
|
|
1435
1447
|
letterSpacing: 0
|
|
1436
1448
|
}]
|
|
1437
1449
|
}
|
|
1438
|
-
},
|
|
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]+)?/;
|
|
1450
|
+
}, HUES = ["gray", "blue", "purple", "magenta", "red", "orange", "yellow", "green", "cyan"], TINTS = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950], RE_PERCENTAGE = /^([0-9]+)%/, RE_OPACITY = /^(1|0\.[0-9]+)?/;
|
|
1471
1451
|
function parseColor$1(str) {
|
|
1472
1452
|
let cursor = 0;
|
|
1473
1453
|
const color2 = getColor();
|
|
@@ -1566,7 +1546,7 @@ function buildColorScheme_v3(tokens, options) {
|
|
|
1566
1546
|
scheme
|
|
1567
1547
|
} = options;
|
|
1568
1548
|
return {
|
|
1569
|
-
card: THEME_COLOR_CARD_TONES.reduce((acc, tone) => (acc[tone] = buildColorCard_v3(tokens[tone], {
|
|
1549
|
+
card: v3_v2.THEME_COLOR_CARD_TONES.reduce((acc, tone) => (acc[tone] = buildColorCard_v3(tokens[tone], {
|
|
1570
1550
|
scheme
|
|
1571
1551
|
}), acc), {})
|
|
1572
1552
|
};
|
|
@@ -1581,7 +1561,7 @@ function buildColorCard_v3(tokens, options) {
|
|
|
1581
1561
|
};
|
|
1582
1562
|
return {
|
|
1583
1563
|
_hue: tokens._hue ?? "gray",
|
|
1584
|
-
avatar: THEME_COLOR_AVATAR_COLORS.reduce((acc, hue) => {
|
|
1564
|
+
avatar: v3_v2.THEME_COLOR_AVATAR_COLORS.reduce((acc, hue) => {
|
|
1585
1565
|
const avatarTokens = tokens.avatar[hue];
|
|
1586
1566
|
return acc[hue] = {
|
|
1587
1567
|
bg: renderColor(avatarTokens.bg, {
|
|
@@ -1597,48 +1577,6 @@ function buildColorCard_v3(tokens, options) {
|
|
|
1597
1577
|
}, acc;
|
|
1598
1578
|
}, {}),
|
|
1599
1579
|
backdrop: renderColor(tokens.backdrop, context),
|
|
1600
|
-
code: {
|
|
1601
|
-
bg: renderColor(tokens.code.bg, context),
|
|
1602
|
-
fg: renderColor(tokens.code.fg, context),
|
|
1603
|
-
token: {
|
|
1604
|
-
atrule: renderColor(tokens.code.token.atrule, context),
|
|
1605
|
-
attrName: renderColor(tokens.code.token.attrName, context),
|
|
1606
|
-
attrValue: renderColor(tokens.code.token.attrValue, context),
|
|
1607
|
-
attribute: renderColor(tokens.code.token.attribute, context),
|
|
1608
|
-
boolean: renderColor(tokens.code.token.boolean, context),
|
|
1609
|
-
builtin: renderColor(tokens.code.token.builtin, context),
|
|
1610
|
-
cdata: renderColor(tokens.code.token.cdata, context),
|
|
1611
|
-
char: renderColor(tokens.code.token.char, context),
|
|
1612
|
-
class: renderColor(tokens.code.token.class, context),
|
|
1613
|
-
className: renderColor(tokens.code.token.className, context),
|
|
1614
|
-
comment: renderColor(tokens.code.token.comment, context),
|
|
1615
|
-
constant: renderColor(tokens.code.token.constant, context),
|
|
1616
|
-
deleted: renderColor(tokens.code.token.deleted, context),
|
|
1617
|
-
doctype: renderColor(tokens.code.token.doctype, context),
|
|
1618
|
-
entity: renderColor(tokens.code.token.entity, context),
|
|
1619
|
-
function: renderColor(tokens.code.token.function, context),
|
|
1620
|
-
hexcode: renderColor(tokens.code.token.hexcode, context),
|
|
1621
|
-
id: renderColor(tokens.code.token.id, context),
|
|
1622
|
-
important: renderColor(tokens.code.token.important, context),
|
|
1623
|
-
inserted: renderColor(tokens.code.token.inserted, context),
|
|
1624
|
-
keyword: renderColor(tokens.code.token.keyword, context),
|
|
1625
|
-
number: renderColor(tokens.code.token.number, context),
|
|
1626
|
-
operator: renderColor(tokens.code.token.operator, context),
|
|
1627
|
-
prolog: renderColor(tokens.code.token.prolog, context),
|
|
1628
|
-
property: renderColor(tokens.code.token.property, context),
|
|
1629
|
-
pseudoClass: renderColor(tokens.code.token.pseudoClass, context),
|
|
1630
|
-
pseudoElement: renderColor(tokens.code.token.pseudoElement, context),
|
|
1631
|
-
punctuation: renderColor(tokens.code.token.punctuation, context),
|
|
1632
|
-
regex: renderColor(tokens.code.token.regex, context),
|
|
1633
|
-
selector: renderColor(tokens.code.token.selector, context),
|
|
1634
|
-
string: renderColor(tokens.code.token.string, context),
|
|
1635
|
-
symbol: renderColor(tokens.code.token.symbol, context),
|
|
1636
|
-
tag: renderColor(tokens.code.token.tag, context),
|
|
1637
|
-
unit: renderColor(tokens.code.token.unit, context),
|
|
1638
|
-
url: renderColor(tokens.code.token.url, context),
|
|
1639
|
-
variable: renderColor(tokens.code.token.variable, context)
|
|
1640
|
-
}
|
|
1641
|
-
},
|
|
1642
1580
|
focusRing: renderColor(tokens.focusRing, context),
|
|
1643
1581
|
shadow: {
|
|
1644
1582
|
outline: renderColor(tokens.shadow.outline, context),
|
|
@@ -1650,9 +1588,47 @@ function buildColorCard_v3(tokens, options) {
|
|
|
1650
1588
|
from: renderColor(tokens.skeleton.from, context),
|
|
1651
1589
|
to: renderColor(tokens.skeleton.to, context)
|
|
1652
1590
|
},
|
|
1591
|
+
token: {
|
|
1592
|
+
atrule: renderColor(tokens.token.atrule, context),
|
|
1593
|
+
attrName: renderColor(tokens.token.attrName, context),
|
|
1594
|
+
attrValue: renderColor(tokens.token.attrValue, context),
|
|
1595
|
+
attribute: renderColor(tokens.token.attribute, context),
|
|
1596
|
+
boolean: renderColor(tokens.token.boolean, context),
|
|
1597
|
+
builtin: renderColor(tokens.token.builtin, context),
|
|
1598
|
+
cdata: renderColor(tokens.token.cdata, context),
|
|
1599
|
+
char: renderColor(tokens.token.char, context),
|
|
1600
|
+
class: renderColor(tokens.token.class, context),
|
|
1601
|
+
className: renderColor(tokens.token.className, context),
|
|
1602
|
+
comment: renderColor(tokens.token.comment, context),
|
|
1603
|
+
constant: renderColor(tokens.token.constant, context),
|
|
1604
|
+
deleted: renderColor(tokens.token.deleted, context),
|
|
1605
|
+
doctype: renderColor(tokens.token.doctype, context),
|
|
1606
|
+
entity: renderColor(tokens.token.entity, context),
|
|
1607
|
+
function: renderColor(tokens.token.function, context),
|
|
1608
|
+
hexcode: renderColor(tokens.token.hexcode, context),
|
|
1609
|
+
id: renderColor(tokens.token.id, context),
|
|
1610
|
+
important: renderColor(tokens.token.important, context),
|
|
1611
|
+
inserted: renderColor(tokens.token.inserted, context),
|
|
1612
|
+
keyword: renderColor(tokens.token.keyword, context),
|
|
1613
|
+
number: renderColor(tokens.token.number, context),
|
|
1614
|
+
operator: renderColor(tokens.token.operator, context),
|
|
1615
|
+
prolog: renderColor(tokens.token.prolog, context),
|
|
1616
|
+
property: renderColor(tokens.token.property, context),
|
|
1617
|
+
pseudoClass: renderColor(tokens.token.pseudoClass, context),
|
|
1618
|
+
pseudoElement: renderColor(tokens.token.pseudoElement, context),
|
|
1619
|
+
punctuation: renderColor(tokens.token.punctuation, context),
|
|
1620
|
+
regex: renderColor(tokens.token.regex, context),
|
|
1621
|
+
selector: renderColor(tokens.token.selector, context),
|
|
1622
|
+
string: renderColor(tokens.token.string, context),
|
|
1623
|
+
symbol: renderColor(tokens.token.symbol, context),
|
|
1624
|
+
tag: renderColor(tokens.token.tag, context),
|
|
1625
|
+
unit: renderColor(tokens.token.unit, context),
|
|
1626
|
+
url: renderColor(tokens.token.url, context),
|
|
1627
|
+
variable: renderColor(tokens.token.variable, context)
|
|
1628
|
+
},
|
|
1653
1629
|
variant: {
|
|
1654
1630
|
solid: {
|
|
1655
|
-
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
|
|
1631
|
+
...v3_v2.THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
|
|
1656
1632
|
...acc,
|
|
1657
1633
|
[tone]: buildColorElement_v3(tokens.variant.solid[tone], {
|
|
1658
1634
|
scheme
|
|
@@ -1660,7 +1636,7 @@ function buildColorCard_v3(tokens, options) {
|
|
|
1660
1636
|
}), {})
|
|
1661
1637
|
},
|
|
1662
1638
|
tinted: {
|
|
1663
|
-
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
|
|
1639
|
+
...v3_v2.THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
|
|
1664
1640
|
...acc,
|
|
1665
1641
|
[tone]: buildColorElement_v3(tokens.variant.tinted[tone], {
|
|
1666
1642
|
scheme
|
|
@@ -1694,53 +1670,59 @@ function buildColorElement_v3(tokens, options) {
|
|
|
1694
1670
|
}
|
|
1695
1671
|
};
|
|
1696
1672
|
}
|
|
1697
|
-
const
|
|
1673
|
+
const defaultPalette = {
|
|
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 = {
|
|
1698
1721
|
color: {
|
|
1699
1722
|
"*": {
|
|
1700
1723
|
// backdrop: ['black/0.2', '200/0.2'],
|
|
1701
1724
|
backdrop: ["black/0.5", "gray/100/0.5"],
|
|
1702
|
-
|
|
1703
|
-
bg: ["950", "50"],
|
|
1704
|
-
fg: ["300", "700"],
|
|
1705
|
-
token: {
|
|
1706
|
-
atrule: ["purple/300", "purple/600"],
|
|
1707
|
-
attrName: ["green/300", "green/600"],
|
|
1708
|
-
attrValue: ["yellow/300", "yellow/600"],
|
|
1709
|
-
attribute: ["yellow/300", "yellow/600"],
|
|
1710
|
-
boolean: ["purple/300", "purple/600"],
|
|
1711
|
-
builtin: ["purple/300", "purple/600"],
|
|
1712
|
-
cdata: ["yellow/300", "yellow/600"],
|
|
1713
|
-
char: ["yellow/300", "yellow/600"],
|
|
1714
|
-
class: ["orange/300", "orange/600"],
|
|
1715
|
-
className: ["cyan/300", "cyan/600"],
|
|
1716
|
-
comment: ["gray/600", "gray/300"],
|
|
1717
|
-
constant: ["purple/300", "purple/600"],
|
|
1718
|
-
deleted: ["red/300", "red/600"],
|
|
1719
|
-
entity: ["red/300", "red/600"],
|
|
1720
|
-
function: ["green/300", "green/600"],
|
|
1721
|
-
hexcode: ["blue/300", "blue/600"],
|
|
1722
|
-
id: ["purple/300", "purple/600"],
|
|
1723
|
-
important: ["purple/300", "purple/600"],
|
|
1724
|
-
inserted: ["green/300", "green/600"],
|
|
1725
|
-
keyword: ["magenta/300", "magenta/600"],
|
|
1726
|
-
number: ["purple/300", "purple/600"],
|
|
1727
|
-
operator: ["magenta/300", "magenta/600"],
|
|
1728
|
-
prolog: ["gray/300", "gray/600"],
|
|
1729
|
-
property: ["blue/300", "blue/600"],
|
|
1730
|
-
pseudoClass: ["yellow/300", "yellow/600"],
|
|
1731
|
-
pseudoElement: ["yellow/300", "yellow/600"],
|
|
1732
|
-
punctuation: ["gray/300", "gray/600"],
|
|
1733
|
-
regex: ["blue/300", "blue/600"],
|
|
1734
|
-
selector: ["red/300", "red/600"],
|
|
1735
|
-
string: ["yellow/300", "yellow/600"],
|
|
1736
|
-
symbol: ["purple/300", "purple/600"],
|
|
1737
|
-
tag: ["red/300", "red/600"],
|
|
1738
|
-
unit: ["orange/300", "orange/600"],
|
|
1739
|
-
url: ["red/300", "red/600"],
|
|
1740
|
-
variable: ["red/300", "red/600"]
|
|
1741
|
-
}
|
|
1742
|
-
},
|
|
1743
|
-
focusRing: ["blue/500", "blue/500"],
|
|
1725
|
+
focusRing: ["blue/500", "blue/300"],
|
|
1744
1726
|
link: {
|
|
1745
1727
|
fg: ["blue/400", "blue/600"]
|
|
1746
1728
|
},
|
|
@@ -1750,16 +1732,53 @@ const defaultTokens = {
|
|
|
1750
1732
|
penumbra: ["black/0.14", "500/0.07"],
|
|
1751
1733
|
ambient: ["black/0.12", "500/0.06"]
|
|
1752
1734
|
},
|
|
1735
|
+
token: {
|
|
1736
|
+
atrule: ["purple/300", "purple/600"],
|
|
1737
|
+
attrName: ["green/300", "green/600"],
|
|
1738
|
+
attrValue: ["yellow/300", "yellow/600"],
|
|
1739
|
+
attribute: ["yellow/300", "yellow/600"],
|
|
1740
|
+
boolean: ["purple/300", "purple/600"],
|
|
1741
|
+
builtin: ["purple/300", "purple/600"],
|
|
1742
|
+
cdata: ["yellow/300", "yellow/600"],
|
|
1743
|
+
char: ["yellow/300", "yellow/600"],
|
|
1744
|
+
class: ["orange/300", "orange/600"],
|
|
1745
|
+
className: ["cyan/300", "cyan/600"],
|
|
1746
|
+
comment: ["gray/600", "gray/300"],
|
|
1747
|
+
constant: ["purple/300", "purple/600"],
|
|
1748
|
+
deleted: ["red/300", "red/600"],
|
|
1749
|
+
entity: ["red/300", "red/600"],
|
|
1750
|
+
function: ["green/300", "green/600"],
|
|
1751
|
+
hexcode: ["blue/300", "blue/600"],
|
|
1752
|
+
id: ["purple/300", "purple/600"],
|
|
1753
|
+
important: ["purple/300", "purple/600"],
|
|
1754
|
+
inserted: ["green/300", "green/600"],
|
|
1755
|
+
keyword: ["magenta/300", "magenta/600"],
|
|
1756
|
+
number: ["purple/300", "purple/600"],
|
|
1757
|
+
operator: ["magenta/300", "magenta/600"],
|
|
1758
|
+
prolog: ["gray/300", "gray/600"],
|
|
1759
|
+
property: ["blue/300", "blue/600"],
|
|
1760
|
+
pseudoClass: ["yellow/300", "yellow/600"],
|
|
1761
|
+
pseudoElement: ["yellow/300", "yellow/600"],
|
|
1762
|
+
punctuation: ["gray/300", "gray/600"],
|
|
1763
|
+
regex: ["blue/300", "blue/600"],
|
|
1764
|
+
selector: ["red/300", "red/600"],
|
|
1765
|
+
string: ["yellow/300", "yellow/600"],
|
|
1766
|
+
symbol: ["purple/300", "purple/600"],
|
|
1767
|
+
tag: ["red/300", "red/600"],
|
|
1768
|
+
unit: ["orange/300", "orange/600"],
|
|
1769
|
+
url: ["red/300", "red/600"],
|
|
1770
|
+
variable: ["red/300", "red/600"]
|
|
1771
|
+
},
|
|
1753
1772
|
variant: {
|
|
1754
1773
|
tinted: {
|
|
1755
1774
|
"*": {
|
|
1756
1775
|
bg: {
|
|
1757
|
-
0: ["
|
|
1758
|
-
4: ["800", "
|
|
1776
|
+
0: ["900", "50"],
|
|
1777
|
+
4: ["800", "150"]
|
|
1759
1778
|
},
|
|
1760
1779
|
border: {
|
|
1761
|
-
0: ["
|
|
1762
|
-
4: ["
|
|
1780
|
+
0: ["800", "150"],
|
|
1781
|
+
4: ["600", "350"]
|
|
1763
1782
|
},
|
|
1764
1783
|
fg: {
|
|
1765
1784
|
0: ["100", "900"],
|
|
@@ -1785,8 +1804,8 @@ const defaultTokens = {
|
|
|
1785
1804
|
solid: {
|
|
1786
1805
|
"*": {
|
|
1787
1806
|
bg: {
|
|
1788
|
-
0: ["
|
|
1789
|
-
4: ["
|
|
1807
|
+
0: ["300", "500"],
|
|
1808
|
+
4: ["200", "600"]
|
|
1790
1809
|
},
|
|
1791
1810
|
border: {
|
|
1792
1811
|
0: ["200", "400"],
|
|
@@ -1831,15 +1850,15 @@ const defaultTokens = {
|
|
|
1831
1850
|
"*": {
|
|
1832
1851
|
bg: {
|
|
1833
1852
|
0: ["black", "gray/50"],
|
|
1834
|
-
4: ["
|
|
1853
|
+
4: ["900", "150"]
|
|
1835
1854
|
},
|
|
1836
1855
|
border: {
|
|
1837
|
-
0: ["
|
|
1838
|
-
4: ["
|
|
1856
|
+
0: ["900", "150"],
|
|
1857
|
+
4: ["700", "350"]
|
|
1839
1858
|
},
|
|
1840
1859
|
fg: {
|
|
1841
|
-
0: ["
|
|
1842
|
-
4: ["
|
|
1860
|
+
0: ["150", "black"],
|
|
1861
|
+
4: ["550", "600"]
|
|
1843
1862
|
}
|
|
1844
1863
|
}
|
|
1845
1864
|
}
|
|
@@ -1850,12 +1869,12 @@ const defaultTokens = {
|
|
|
1850
1869
|
tinted: {
|
|
1851
1870
|
"*": {
|
|
1852
1871
|
bg: {
|
|
1853
|
-
0: ["950", "white"],
|
|
1854
|
-
4: ["
|
|
1872
|
+
0: ["gray/950", "white"],
|
|
1873
|
+
4: ["850", "100"]
|
|
1855
1874
|
},
|
|
1856
1875
|
border: {
|
|
1857
|
-
0: ["
|
|
1858
|
-
4: ["
|
|
1876
|
+
0: ["850", "100"],
|
|
1877
|
+
4: ["650", "300"]
|
|
1859
1878
|
},
|
|
1860
1879
|
fg: {
|
|
1861
1880
|
0: ["white", "black"],
|
|
@@ -1865,18 +1884,6 @@ const defaultTokens = {
|
|
|
1865
1884
|
}
|
|
1866
1885
|
}
|
|
1867
1886
|
},
|
|
1868
|
-
neutral: {
|
|
1869
|
-
variant: {
|
|
1870
|
-
tinted: {
|
|
1871
|
-
"*": {
|
|
1872
|
-
bg: {
|
|
1873
|
-
0: ["900", "50"],
|
|
1874
|
-
4: ["700", "200"]
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
}
|
|
1879
|
-
},
|
|
1880
1887
|
primary: {
|
|
1881
1888
|
_hue: "blue"
|
|
1882
1889
|
},
|
|
@@ -1925,7 +1932,7 @@ function resolveTokens(tokens = {}) {
|
|
|
1925
1932
|
return {
|
|
1926
1933
|
color: {
|
|
1927
1934
|
"*": resolveCardColorTokens(tokens.color?.["*"]),
|
|
1928
|
-
...THEME_COLOR_CARD_TONES.reduce((acc, tone) => ({
|
|
1935
|
+
...v3_v2.THEME_COLOR_CARD_TONES.reduce((acc, tone) => ({
|
|
1929
1936
|
...acc,
|
|
1930
1937
|
[tone]: resolveCardColorTokens(merge(tokens.color?.["*"], tokens.color?.[tone]))
|
|
1931
1938
|
}), {})
|
|
@@ -1983,48 +1990,6 @@ function resolveCardColorTokens(tokens) {
|
|
|
1983
1990
|
}
|
|
1984
1991
|
},
|
|
1985
1992
|
backdrop: tokens?.backdrop ?? ["900", "100"],
|
|
1986
|
-
code: {
|
|
1987
|
-
bg: tokens?.code?.bg ?? ["950", "50"],
|
|
1988
|
-
fg: tokens?.code?.fg ?? ["400", "600"],
|
|
1989
|
-
token: {
|
|
1990
|
-
atrule: tokens?.code?.token?.atrule ?? ["400", "600"],
|
|
1991
|
-
attribute: tokens?.code?.token?.attribute ?? ["400", "600"],
|
|
1992
|
-
attrName: tokens?.code?.token?.attrName ?? ["400", "600"],
|
|
1993
|
-
attrValue: tokens?.code?.token?.attrValue ?? ["400", "600"],
|
|
1994
|
-
boolean: tokens?.code?.token?.boolean ?? ["400", "600"],
|
|
1995
|
-
builtin: tokens?.code?.token?.builtin ?? ["400", "600"],
|
|
1996
|
-
cdata: tokens?.code?.token?.cdata ?? ["400", "600"],
|
|
1997
|
-
char: tokens?.code?.token?.char ?? ["400", "600"],
|
|
1998
|
-
class: tokens?.code?.token?.class ?? ["400", "600"],
|
|
1999
|
-
className: tokens?.code?.token?.className ?? ["400", "600"],
|
|
2000
|
-
comment: tokens?.code?.token?.comment ?? ["600", "400"],
|
|
2001
|
-
constant: tokens?.code?.token?.constant ?? ["400", "600"],
|
|
2002
|
-
deleted: tokens?.code?.token?.deleted ?? ["400", "600"],
|
|
2003
|
-
doctype: tokens?.code?.token?.doctype ?? ["400", "600"],
|
|
2004
|
-
entity: tokens?.code?.token?.entity ?? ["400", "600"],
|
|
2005
|
-
function: tokens?.code?.token?.function ?? ["400", "600"],
|
|
2006
|
-
hexcode: tokens?.code?.token?.hexcode ?? ["400", "600"],
|
|
2007
|
-
id: tokens?.code?.token?.id ?? ["400", "600"],
|
|
2008
|
-
important: tokens?.code?.token?.important ?? ["400", "600"],
|
|
2009
|
-
inserted: tokens?.code?.token?.inserted ?? ["400", "600"],
|
|
2010
|
-
keyword: tokens?.code?.token?.keyword ?? ["400", "600"],
|
|
2011
|
-
number: tokens?.code?.token?.number ?? ["400", "600"],
|
|
2012
|
-
operator: tokens?.code?.token?.operator ?? ["400", "600"],
|
|
2013
|
-
prolog: tokens?.code?.token?.prolog ?? ["400", "600"],
|
|
2014
|
-
property: tokens?.code?.token?.property ?? ["400", "600"],
|
|
2015
|
-
pseudoClass: tokens?.code?.token?.pseudoClass ?? ["400", "600"],
|
|
2016
|
-
pseudoElement: tokens?.code?.token?.pseudoElement ?? ["400", "600"],
|
|
2017
|
-
punctuation: tokens?.code?.token?.punctuation ?? ["400", "600"],
|
|
2018
|
-
regex: tokens?.code?.token?.regex ?? ["400", "600"],
|
|
2019
|
-
selector: tokens?.code?.token?.selector ?? ["400", "600"],
|
|
2020
|
-
string: tokens?.code?.token?.string ?? ["400", "600"],
|
|
2021
|
-
symbol: tokens?.code?.token?.symbol ?? ["400", "600"],
|
|
2022
|
-
tag: tokens?.code?.token?.tag ?? ["400", "600"],
|
|
2023
|
-
unit: tokens?.code?.token?.unit ?? ["400", "600"],
|
|
2024
|
-
url: tokens?.code?.token?.url ?? ["400", "600"],
|
|
2025
|
-
variable: tokens?.code?.token?.variable ?? ["400", "600"]
|
|
2026
|
-
}
|
|
2027
|
-
},
|
|
2028
1993
|
focusRing: tokens?.focusRing ?? ["500", "500"],
|
|
2029
1994
|
link: {
|
|
2030
1995
|
fg: tokens?.link?.fg ?? ["400", "600"]
|
|
@@ -2039,14 +2004,52 @@ function resolveCardColorTokens(tokens) {
|
|
|
2039
2004
|
from: tokens?.skeleton?.from ?? ["900", "100"],
|
|
2040
2005
|
to: tokens?.skeleton?.to ?? ["950", "50"]
|
|
2041
2006
|
},
|
|
2007
|
+
token: {
|
|
2008
|
+
atrule: tokens?.token?.atrule ?? ["400", "600"],
|
|
2009
|
+
attribute: tokens?.token?.attribute ?? ["400", "600"],
|
|
2010
|
+
attrName: tokens?.token?.attrName ?? ["400", "600"],
|
|
2011
|
+
attrValue: tokens?.token?.attrValue ?? ["400", "600"],
|
|
2012
|
+
boolean: tokens?.token?.boolean ?? ["400", "600"],
|
|
2013
|
+
builtin: tokens?.token?.builtin ?? ["400", "600"],
|
|
2014
|
+
cdata: tokens?.token?.cdata ?? ["400", "600"],
|
|
2015
|
+
char: tokens?.token?.char ?? ["400", "600"],
|
|
2016
|
+
class: tokens?.token?.class ?? ["400", "600"],
|
|
2017
|
+
className: tokens?.token?.className ?? ["400", "600"],
|
|
2018
|
+
comment: tokens?.token?.comment ?? ["600", "400"],
|
|
2019
|
+
constant: tokens?.token?.constant ?? ["400", "600"],
|
|
2020
|
+
deleted: tokens?.token?.deleted ?? ["400", "600"],
|
|
2021
|
+
doctype: tokens?.token?.doctype ?? ["400", "600"],
|
|
2022
|
+
entity: tokens?.token?.entity ?? ["400", "600"],
|
|
2023
|
+
function: tokens?.token?.function ?? ["400", "600"],
|
|
2024
|
+
hexcode: tokens?.token?.hexcode ?? ["400", "600"],
|
|
2025
|
+
id: tokens?.token?.id ?? ["400", "600"],
|
|
2026
|
+
important: tokens?.token?.important ?? ["400", "600"],
|
|
2027
|
+
inserted: tokens?.token?.inserted ?? ["400", "600"],
|
|
2028
|
+
keyword: tokens?.token?.keyword ?? ["400", "600"],
|
|
2029
|
+
number: tokens?.token?.number ?? ["400", "600"],
|
|
2030
|
+
operator: tokens?.token?.operator ?? ["400", "600"],
|
|
2031
|
+
prolog: tokens?.token?.prolog ?? ["400", "600"],
|
|
2032
|
+
property: tokens?.token?.property ?? ["400", "600"],
|
|
2033
|
+
pseudoClass: tokens?.token?.pseudoClass ?? ["400", "600"],
|
|
2034
|
+
pseudoElement: tokens?.token?.pseudoElement ?? ["400", "600"],
|
|
2035
|
+
punctuation: tokens?.token?.punctuation ?? ["400", "600"],
|
|
2036
|
+
regex: tokens?.token?.regex ?? ["400", "600"],
|
|
2037
|
+
selector: tokens?.token?.selector ?? ["400", "600"],
|
|
2038
|
+
string: tokens?.token?.string ?? ["400", "600"],
|
|
2039
|
+
symbol: tokens?.token?.symbol ?? ["400", "600"],
|
|
2040
|
+
tag: tokens?.token?.tag ?? ["400", "600"],
|
|
2041
|
+
unit: tokens?.token?.unit ?? ["400", "600"],
|
|
2042
|
+
url: tokens?.token?.url ?? ["400", "600"],
|
|
2043
|
+
variable: tokens?.token?.variable ?? ["400", "600"]
|
|
2044
|
+
},
|
|
2042
2045
|
variant: {
|
|
2043
2046
|
solid: {
|
|
2044
2047
|
"*": resolveElementTokens(tokens?.variant?.solid?.["*"]),
|
|
2045
|
-
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = resolveElementTokens(merge(tokens, tokens?.variant?.solid?.["*"], tokens?.variant?.solid?.[tone])), acc), {})
|
|
2048
|
+
...v3_v2.THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = resolveElementTokens(merge(tokens, tokens?.variant?.solid?.["*"], tokens?.variant?.solid?.[tone])), acc), {})
|
|
2046
2049
|
},
|
|
2047
2050
|
tinted: {
|
|
2048
2051
|
"*": resolveElementTokens(tokens?.variant?.tinted?.["*"]),
|
|
2049
|
-
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = resolveElementTokens(merge(tokens, tokens?.variant?.tinted?.["*"], tokens?.variant?.tinted?.[tone])), acc), {})
|
|
2052
|
+
...v3_v2.THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = resolveElementTokens(merge(tokens, tokens?.variant?.tinted?.["*"], tokens?.variant?.tinted?.[tone])), acc), {})
|
|
2050
2053
|
}
|
|
2051
2054
|
}
|
|
2052
2055
|
};
|
|
@@ -2074,6 +2077,7 @@ function buildTheme_v3(options) {
|
|
|
2074
2077
|
} = options ?? {}, tokens = resolveTokens(options?.tokens ?? defaultTokens);
|
|
2075
2078
|
return {
|
|
2076
2079
|
_version: 3,
|
|
2080
|
+
_palette: options?.palette ?? defaultPalette,
|
|
2077
2081
|
_tokens: tokens,
|
|
2078
2082
|
avatar: v2?.avatar ?? defaultThemeConfig.avatar,
|
|
2079
2083
|
button: v2?.button ?? defaultThemeConfig.button,
|
|
@@ -2197,229 +2201,11 @@ function inputStateThemeColor_v2_v0(t) {
|
|
|
2197
2201
|
placeholder: t.placeholder
|
|
2198
2202
|
};
|
|
2199
2203
|
}
|
|
2200
|
-
function themeColor_v3_v2(options) {
|
|
2201
|
-
const {
|
|
2202
|
-
color: color2,
|
|
2203
|
-
dark
|
|
2204
|
-
} = options;
|
|
2205
|
-
return {
|
|
2206
|
-
_blend: "screen",
|
|
2207
|
-
_dark: dark,
|
|
2208
|
-
...buildColorState({
|
|
2209
|
-
cardColor: color2,
|
|
2210
|
-
state: "enabled",
|
|
2211
|
-
tone: "default",
|
|
2212
|
-
variant: "tinted"
|
|
2213
|
-
}),
|
|
2214
|
-
backdrop: color2.backdrop,
|
|
2215
|
-
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({
|
|
2216
|
-
cardColor: color2,
|
|
2217
|
-
state,
|
|
2218
|
-
tone,
|
|
2219
|
-
variant: mode === "default" ? "solid" : "tinted"
|
|
2220
|
-
}), mode === "bleed" && (states[state].border = "transparent"), states), {}), tones2), {}), modes), {}),
|
|
2221
|
-
focusRing: color2.focusRing,
|
|
2222
|
-
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), {}),
|
|
2223
|
-
selectable: THEME_COLOR_STATE_TONES.reduce((tones2, tone) => (tones2[tone] = THEME_COLOR_STATES.reduce((states, state) => (states[state] = buildColorState({
|
|
2224
|
-
cardColor: color2,
|
|
2225
|
-
// cardVars: vars,
|
|
2226
|
-
state,
|
|
2227
|
-
tone,
|
|
2228
|
-
variant: "tinted"
|
|
2229
|
-
}), states), {}), tones2), {}),
|
|
2230
|
-
shadow: color2.shadow,
|
|
2231
|
-
syntax: color2.code.token
|
|
2232
|
-
};
|
|
2233
|
-
}
|
|
2234
|
-
const stateShades = {
|
|
2235
|
-
enabled: {
|
|
2236
|
-
bg: [0, 1, 2],
|
|
2237
|
-
border: [0, 1, 2],
|
|
2238
|
-
fg: [0, 1, 2]
|
|
2239
|
-
},
|
|
2240
|
-
hovered: {
|
|
2241
|
-
bg: [1, 2, 3],
|
|
2242
|
-
border: [1, 2, 3],
|
|
2243
|
-
fg: [1, 2, 3]
|
|
2244
|
-
},
|
|
2245
|
-
pressed: {
|
|
2246
|
-
bg: [2, 3, 4],
|
|
2247
|
-
border: [2, 3, 4],
|
|
2248
|
-
fg: [2, 3, 4]
|
|
2249
|
-
},
|
|
2250
|
-
selected: {
|
|
2251
|
-
bg: [3, 4, 4],
|
|
2252
|
-
border: [3, 4, 4],
|
|
2253
|
-
fg: [3, 4, 4]
|
|
2254
|
-
},
|
|
2255
|
-
disabled: {
|
|
2256
|
-
bg: [4, 4, 4],
|
|
2257
|
-
border: [4, 4, 4],
|
|
2258
|
-
fg: [4, 4, 4]
|
|
2259
|
-
}
|
|
2260
|
-
};
|
|
2261
|
-
function mix$1(tokens, index) {
|
|
2262
|
-
return index === 0 ? tokens[0] : index === 4 ? tokens[4] : `color-mix(in oklch, ${tokens[0]}, ${tokens[4]} ${index * 25}%)`;
|
|
2263
|
-
}
|
|
2264
|
-
function buildColorState(options) {
|
|
2265
|
-
const {
|
|
2266
|
-
cardColor,
|
|
2267
|
-
state,
|
|
2268
|
-
tone,
|
|
2269
|
-
variant
|
|
2270
|
-
} = options, color2 = cardColor.variant[variant][tone], shades = stateShades[state];
|
|
2271
|
-
return {
|
|
2272
|
-
accent: {
|
|
2273
|
-
fg: color2.fg[4]
|
|
2274
|
-
},
|
|
2275
|
-
avatar: cardColor.avatar,
|
|
2276
|
-
badge: THEME_COLOR_STATE_TONES.reduce((tones2, tone2) => (tones2[tone2] = {
|
|
2277
|
-
bg: mix$1(color2.bg, 1),
|
|
2278
|
-
fg: mix$1(color2.fg, 1),
|
|
2279
|
-
dot: mix$1(color2.fg, 3),
|
|
2280
|
-
icon: mix$1(color2.fg, 3)
|
|
2281
|
-
}, tones2), {}),
|
|
2282
|
-
bg: mix$1(color2.bg, shades.bg[0]),
|
|
2283
|
-
border: mix$1(color2.border, shades.border[0]),
|
|
2284
|
-
fg: mix$1(color2.fg, shades.fg[0]),
|
|
2285
|
-
code: {
|
|
2286
|
-
bg: mix$1(color2.bg, shades.bg[1]),
|
|
2287
|
-
fg: mix$1(color2.fg, shades.fg[2])
|
|
2288
|
-
},
|
|
2289
|
-
icon: mix$1(color2.fg, shades.fg[2]),
|
|
2290
|
-
kbd: {
|
|
2291
|
-
bg: mix$1(color2.bg, 0),
|
|
2292
|
-
fg: mix$1(color2.fg, 0),
|
|
2293
|
-
border: mix$1(color2.bg, 0)
|
|
2294
|
-
},
|
|
2295
|
-
link: {
|
|
2296
|
-
fg: mix$1(color2.fg, shades.fg[2])
|
|
2297
|
-
},
|
|
2298
|
-
muted: {
|
|
2299
|
-
bg: mix$1(color2.bg, shades.bg[1]),
|
|
2300
|
-
fg: mix$1(color2.fg, shades.fg[2])
|
|
2301
|
-
},
|
|
2302
|
-
skeleton: cardColor.skeleton
|
|
2303
|
-
};
|
|
2304
|
-
}
|
|
2305
|
-
function buildInputState(colorElement) {
|
|
2306
|
-
return {
|
|
2307
|
-
bg: colorElement.bg[0],
|
|
2308
|
-
border: colorElement.bg[0],
|
|
2309
|
-
fg: colorElement.fg[0],
|
|
2310
|
-
muted: {
|
|
2311
|
-
bg: colorElement.bg[0]
|
|
2312
|
-
},
|
|
2313
|
-
placeholder: colorElement.fg[0]
|
|
2314
|
-
};
|
|
2315
|
-
}
|
|
2316
|
-
function v3_v2(theme_v3) {
|
|
2317
|
-
return {
|
|
2318
|
-
_version: 2,
|
|
2319
|
-
avatar: theme_v3.avatar,
|
|
2320
|
-
button: theme_v3.button,
|
|
2321
|
-
card: theme_v3.card,
|
|
2322
|
-
color: {
|
|
2323
|
-
dark: {
|
|
2324
|
-
transparent: themeColor_v3_v2({
|
|
2325
|
-
color: theme_v3.color.dark.card.transparent,
|
|
2326
|
-
dark: !0
|
|
2327
|
-
// vars: vars.color.dark.transparent,
|
|
2328
|
-
}),
|
|
2329
|
-
default: themeColor_v3_v2({
|
|
2330
|
-
color: theme_v3.color.dark.card.default,
|
|
2331
|
-
dark: !0
|
|
2332
|
-
// vars: vars.color.dark.default,
|
|
2333
|
-
}),
|
|
2334
|
-
neutral: themeColor_v3_v2({
|
|
2335
|
-
color: theme_v3.color.dark.card.neutral,
|
|
2336
|
-
dark: !0
|
|
2337
|
-
// vars: vars.color.dark.neutral,
|
|
2338
|
-
}),
|
|
2339
|
-
primary: themeColor_v3_v2({
|
|
2340
|
-
color: theme_v3.color.dark.card.primary,
|
|
2341
|
-
dark: !0
|
|
2342
|
-
// vars: vars.color.dark.primary,
|
|
2343
|
-
}),
|
|
2344
|
-
suggest: themeColor_v3_v2({
|
|
2345
|
-
color: theme_v3.color.dark.card.suggest,
|
|
2346
|
-
dark: !0
|
|
2347
|
-
// vars: vars.color.dark.suggest,
|
|
2348
|
-
}),
|
|
2349
|
-
positive: themeColor_v3_v2({
|
|
2350
|
-
color: theme_v3.color.dark.card.positive,
|
|
2351
|
-
dark: !0
|
|
2352
|
-
// vars: vars.color.dark.positive,
|
|
2353
|
-
}),
|
|
2354
|
-
caution: themeColor_v3_v2({
|
|
2355
|
-
color: theme_v3.color.dark.card.caution,
|
|
2356
|
-
dark: !0
|
|
2357
|
-
// vars: vars.color.dark.caution,
|
|
2358
|
-
}),
|
|
2359
|
-
critical: themeColor_v3_v2({
|
|
2360
|
-
color: theme_v3.color.dark.card.critical,
|
|
2361
|
-
dark: !0
|
|
2362
|
-
// vars: vars.color.dark.critical,
|
|
2363
|
-
})
|
|
2364
|
-
},
|
|
2365
|
-
light: {
|
|
2366
|
-
transparent: themeColor_v3_v2({
|
|
2367
|
-
color: theme_v3.color.light.card.transparent,
|
|
2368
|
-
dark: !1
|
|
2369
|
-
// vars: vars.color.light.transparent,
|
|
2370
|
-
}),
|
|
2371
|
-
default: themeColor_v3_v2({
|
|
2372
|
-
color: theme_v3.color.light.card.default,
|
|
2373
|
-
dark: !1
|
|
2374
|
-
// vars: vars.color.light.default,
|
|
2375
|
-
}),
|
|
2376
|
-
neutral: themeColor_v3_v2({
|
|
2377
|
-
color: theme_v3.color.light.card.neutral,
|
|
2378
|
-
dark: !1
|
|
2379
|
-
// vars: vars.color.light.neutral,
|
|
2380
|
-
}),
|
|
2381
|
-
primary: themeColor_v3_v2({
|
|
2382
|
-
color: theme_v3.color.light.card.primary,
|
|
2383
|
-
dark: !1
|
|
2384
|
-
// vars: vars.color.light.primary,
|
|
2385
|
-
}),
|
|
2386
|
-
suggest: themeColor_v3_v2({
|
|
2387
|
-
color: theme_v3.color.light.card.suggest,
|
|
2388
|
-
dark: !1
|
|
2389
|
-
// vars: vars.color.light.suggest,
|
|
2390
|
-
}),
|
|
2391
|
-
positive: themeColor_v3_v2({
|
|
2392
|
-
color: theme_v3.color.light.card.positive,
|
|
2393
|
-
dark: !1
|
|
2394
|
-
// vars: vars.color.light.positive,
|
|
2395
|
-
}),
|
|
2396
|
-
caution: themeColor_v3_v2({
|
|
2397
|
-
color: theme_v3.color.light.card.caution,
|
|
2398
|
-
dark: !1
|
|
2399
|
-
// vars: vars.color.light.caution,
|
|
2400
|
-
}),
|
|
2401
|
-
critical: themeColor_v3_v2({
|
|
2402
|
-
color: theme_v3.color.light.card.critical,
|
|
2403
|
-
dark: !1
|
|
2404
|
-
// vars: vars.color.light.critical,
|
|
2405
|
-
})
|
|
2406
|
-
}
|
|
2407
|
-
},
|
|
2408
|
-
container: theme_v3.container,
|
|
2409
|
-
font: theme_v3.font,
|
|
2410
|
-
input: theme_v3.input,
|
|
2411
|
-
layer: theme_v3.layer,
|
|
2412
|
-
media: theme_v3.media,
|
|
2413
|
-
radius: theme_v3.radius,
|
|
2414
|
-
shadow: theme_v3.shadow,
|
|
2415
|
-
space: theme_v3.space
|
|
2416
|
-
};
|
|
2417
|
-
}
|
|
2418
2204
|
function buildTheme(_config) {
|
|
2419
2205
|
const v3 = buildTheme_v3({
|
|
2420
2206
|
v2: _config
|
|
2421
2207
|
});
|
|
2422
|
-
return v2_v0(v3_v2(v3), v3);
|
|
2208
|
+
return v2_v0(v3_v2.v3_v2(v3), v3);
|
|
2423
2209
|
}
|
|
2424
2210
|
function mixChannel(b, s, weight) {
|
|
2425
2211
|
const delta = (s - b) * weight;
|
|
@@ -2568,7 +2354,7 @@ function rgba(color2, a) {
|
|
|
2568
2354
|
const rgb = parseColor(color2);
|
|
2569
2355
|
return `rgba(${rgb.r},${rgb.g},${rgb.b},${a})`;
|
|
2570
2356
|
}
|
|
2571
|
-
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];
|
|
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 = ["*", ...v3_v2.THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...v3_v2.THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...v3_v2.THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...v3_v2.THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...v3_v2.THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...v3_v2.THEME_COLOR_INPUT_STATES];
|
|
2572
2358
|
function parseTokenKey(str) {
|
|
2573
2359
|
const segments = str.split("/"), segment0 = segments.shift() || "";
|
|
2574
2360
|
if (isColorConfigBaseTone(segment0)) {
|
|
@@ -3134,6 +2920,15 @@ function getTheme_v2(theme) {
|
|
|
3134
2920
|
};
|
|
3135
2921
|
return cache.set(theme, v2), v2;
|
|
3136
2922
|
}
|
|
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;
|
|
3137
2932
|
exports.AVATAR_SIZE = AVATAR_SIZE;
|
|
3138
2933
|
exports.COLOR_CONFIG_AVATAR_COLORS = COLOR_CONFIG_AVATAR_COLORS;
|
|
3139
2934
|
exports.COLOR_CONFIG_BLEND_KEYS = COLOR_CONFIG_BLEND_KEYS;
|
|
@@ -3153,20 +2948,12 @@ exports.HUES = HUES;
|
|
|
3153
2948
|
exports.RADIUS = RADIUS;
|
|
3154
2949
|
exports.SHADOW = SHADOW;
|
|
3155
2950
|
exports.SPACE = SPACE;
|
|
3156
|
-
exports.THEME_COLOR_AVATAR_COLORS = THEME_COLOR_AVATAR_COLORS;
|
|
3157
|
-
exports.THEME_COLOR_BLEND_MODES = THEME_COLOR_BLEND_MODES;
|
|
3158
|
-
exports.THEME_COLOR_BUTTON_MODES = THEME_COLOR_BUTTON_MODES;
|
|
3159
|
-
exports.THEME_COLOR_CARD_TONES = THEME_COLOR_CARD_TONES;
|
|
3160
|
-
exports.THEME_COLOR_INPUT_MODES = THEME_COLOR_INPUT_MODES;
|
|
3161
|
-
exports.THEME_COLOR_INPUT_STATES = THEME_COLOR_INPUT_STATES;
|
|
3162
|
-
exports.THEME_COLOR_SCHEMES = THEME_COLOR_SCHEMES;
|
|
3163
|
-
exports.THEME_COLOR_STATES = THEME_COLOR_STATES;
|
|
3164
|
-
exports.THEME_COLOR_STATE_TONES = THEME_COLOR_STATE_TONES;
|
|
3165
2951
|
exports.TINTS = TINTS;
|
|
3166
2952
|
exports.buildColor_v3 = buildColor_v3;
|
|
3167
2953
|
exports.buildTheme = buildTheme;
|
|
3168
2954
|
exports.buildTheme_v3 = buildTheme_v3;
|
|
3169
2955
|
exports.createColorTheme = createColorTheme;
|
|
2956
|
+
exports.defaultPalette = defaultPalette;
|
|
3170
2957
|
exports.defaultTokens = defaultTokens;
|
|
3171
2958
|
exports.getContrastRatio = getContrastRatio;
|
|
3172
2959
|
exports.getScopedTheme = getScopedTheme;
|