@sanity/ui 2.8.8 → 2.8.9

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/theme.js CHANGED
@@ -981,7 +981,7 @@ function v0_v2(v0) {
981
981
  ...input.switch
982
982
  }
983
983
  },
984
- layer: layer != null ? layer : getTheme_v2.defaultThemeConfig.layer,
984
+ layer: layer ?? getTheme_v2.defaultThemeConfig.layer,
985
985
  media,
986
986
  radius,
987
987
  shadow,
@@ -1301,8 +1301,7 @@ function isColorConfigBlendKey(str) {
1301
1301
  return COLOR_CONFIG_BLEND_KEYS.includes(str);
1302
1302
  }
1303
1303
  function isColorTokenValue(str) {
1304
- var _a, _b;
1305
- return ((_a = parseTokenValue(str)) == null ? void 0 : _a.type) === "color" || ((_b = parseTokenValue(str)) == null ? void 0 : _b.type) === "hue";
1304
+ return parseTokenValue(str)?.type === "color" || parseTokenValue(str)?.type === "hue";
1306
1305
  }
1307
1306
  function isColorValue(str) {
1308
1307
  return str === "black" || str === "white";
@@ -1995,47 +1994,46 @@ function resolveBaseColorTokens(sparseTokens) {
1995
1994
  return tokens;
1996
1995
  }
1997
1996
  function resolveBaseColorTones(inputTokens, tone) {
1998
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P;
1999
- const spec = merge((_a = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _a["*"], (_b = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _b[tone]), hue = spec._hue || ((_d = (_c = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _c[tone]) == null ? void 0 : _d._hue) || "gray";
1997
+ const spec = merge(inputTokens?.base?.["*"], inputTokens?.base?.[tone]), hue = spec._hue || inputTokens?.base?.[tone]?._hue || "gray";
2000
1998
  return {
2001
1999
  ...spec,
2002
2000
  _hue: hue,
2003
2001
  avatar: {
2004
- gray: merge({ _hue: "gray" }, (_e = spec.avatar) == null ? void 0 : _e["*"], (_f = spec.avatar) == null ? void 0 : _f.gray),
2005
- blue: merge({ _hue: "blue" }, (_g = spec.avatar) == null ? void 0 : _g["*"], (_h = spec.avatar) == null ? void 0 : _h.blue),
2006
- purple: merge({ _hue: "purple" }, (_i = spec.avatar) == null ? void 0 : _i["*"], (_j = spec.avatar) == null ? void 0 : _j.purple),
2007
- magenta: merge({ _hue: "magenta" }, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.magenta),
2008
- red: merge({ _hue: "red" }, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.red),
2009
- orange: merge({ _hue: "orange" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.orange),
2010
- yellow: merge({ _hue: "yellow" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.yellow),
2011
- green: merge({ _hue: "green" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.green),
2012
- cyan: merge({ _hue: "cyan" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.cyan)
2002
+ gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
2003
+ blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
2004
+ purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
2005
+ magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
2006
+ red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
2007
+ orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
2008
+ yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
2009
+ green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
2010
+ cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
2013
2011
  },
2014
2012
  badge: {
2015
2013
  default: {
2016
- _hue: ((_x = (_w = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _w.default) == null ? void 0 : _x._hue) || hue,
2017
- ...(_y = spec.badge) == null ? void 0 : _y["*"],
2018
- ...(_z = spec.badge) == null ? void 0 : _z.default
2014
+ _hue: inputTokens?.base?.default?._hue || hue,
2015
+ ...spec.badge?.["*"],
2016
+ ...spec.badge?.default
2019
2017
  },
2020
2018
  primary: {
2021
- _hue: ((_B = (_A = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _A.primary) == null ? void 0 : _B._hue) || hue,
2022
- ...(_C = spec.badge) == null ? void 0 : _C["*"],
2023
- ...(_D = spec.badge) == null ? void 0 : _D.primary
2019
+ _hue: inputTokens?.base?.primary?._hue || hue,
2020
+ ...spec.badge?.["*"],
2021
+ ...spec.badge?.primary
2024
2022
  },
2025
2023
  positive: {
2026
- _hue: ((_F = (_E = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _E.positive) == null ? void 0 : _F._hue) || hue,
2027
- ...(_G = spec.badge) == null ? void 0 : _G["*"],
2028
- ...(_H = spec.badge) == null ? void 0 : _H.positive
2024
+ _hue: inputTokens?.base?.positive?._hue || hue,
2025
+ ...spec.badge?.["*"],
2026
+ ...spec.badge?.positive
2029
2027
  },
2030
2028
  caution: {
2031
- _hue: ((_J = (_I = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _I.caution) == null ? void 0 : _J._hue) || hue,
2032
- ...(_K = spec.badge) == null ? void 0 : _K["*"],
2033
- ...(_L = spec.badge) == null ? void 0 : _L.caution
2029
+ _hue: inputTokens?.base?.caution?._hue || hue,
2030
+ ...spec.badge?.["*"],
2031
+ ...spec.badge?.caution
2034
2032
  },
2035
2033
  critical: {
2036
- _hue: ((_N = (_M = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _M.critical) == null ? void 0 : _N._hue) || hue,
2037
- ...(_O = spec.badge) == null ? void 0 : _O["*"],
2038
- ...(_P = spec.badge) == null ? void 0 : _P.critical
2034
+ _hue: inputTokens?.base?.critical?._hue || hue,
2035
+ ...spec.badge?.["*"],
2036
+ ...spec.badge?.critical
2039
2037
  }
2040
2038
  }
2041
2039
  };
@@ -2059,52 +2057,51 @@ function resolveButtonModeColorTokens(inputTokens, mode, tone) {
2059
2057
  return tokens;
2060
2058
  }
2061
2059
  function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
2062
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z;
2063
2060
  const spec = merge(
2064
- (_c = (_b = (_a = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _a[mode]) == null ? void 0 : _b["*"]) == null ? void 0 : _c["*"],
2065
- (_f = (_e = (_d = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _d[mode]) == null ? void 0 : _e[tone]) == null ? void 0 : _f["*"],
2066
- (_i = (_h = (_g = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _g[mode]) == null ? void 0 : _h["*"]) == null ? void 0 : _i[state],
2067
- (_l = (_k = (_j = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _j[mode]) == null ? void 0 : _k[tone]) == null ? void 0 : _l[state]
2068
- ), hue = spec._hue || ((_n = (_m = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _m[tone]) == null ? void 0 : _n._hue);
2061
+ inputTokens?.button?.[mode]?.["*"]?.["*"],
2062
+ inputTokens?.button?.[mode]?.[tone]?.["*"],
2063
+ inputTokens?.button?.[mode]?.["*"]?.[state],
2064
+ inputTokens?.button?.[mode]?.[tone]?.[state]
2065
+ ), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
2069
2066
  return {
2070
2067
  ...spec,
2071
2068
  _hue: hue,
2072
2069
  avatar: {
2073
- gray: merge({ _hue: "gray" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.gray),
2074
- blue: merge({ _hue: "blue" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.blue),
2075
- purple: merge({ _hue: "purple" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.purple),
2076
- magenta: merge({ _hue: "magenta" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.magenta),
2077
- red: merge({ _hue: "red" }, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.red),
2078
- orange: merge({ _hue: "orange" }, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.orange),
2079
- yellow: merge({ _hue: "yellow" }, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.yellow),
2080
- green: merge({ _hue: "green" }, (_C = spec.avatar) == null ? void 0 : _C["*"], (_D = spec.avatar) == null ? void 0 : _D.green),
2081
- cyan: merge({ _hue: "cyan" }, (_E = spec.avatar) == null ? void 0 : _E["*"], (_F = spec.avatar) == null ? void 0 : _F.cyan)
2070
+ gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
2071
+ blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
2072
+ purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
2073
+ magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
2074
+ red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
2075
+ orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
2076
+ yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
2077
+ green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
2078
+ cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
2082
2079
  },
2083
2080
  badge: {
2084
2081
  default: {
2085
- _hue: (_H = (_G = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _G.default) == null ? void 0 : _H._hue,
2086
- ...(_I = spec.badge) == null ? void 0 : _I["*"],
2087
- ...(_J = spec.badge) == null ? void 0 : _J.default
2082
+ _hue: inputTokens?.base?.default?._hue,
2083
+ ...spec.badge?.["*"],
2084
+ ...spec.badge?.default
2088
2085
  },
2089
2086
  primary: {
2090
- _hue: (_L = (_K = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _K.primary) == null ? void 0 : _L._hue,
2091
- ...(_M = spec.badge) == null ? void 0 : _M["*"],
2092
- ...(_N = spec.badge) == null ? void 0 : _N.primary
2087
+ _hue: inputTokens?.base?.primary?._hue,
2088
+ ...spec.badge?.["*"],
2089
+ ...spec.badge?.primary
2093
2090
  },
2094
2091
  positive: {
2095
- _hue: (_P = (_O = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _O.positive) == null ? void 0 : _P._hue,
2096
- ...(_Q = spec.badge) == null ? void 0 : _Q["*"],
2097
- ...(_R = spec.badge) == null ? void 0 : _R.positive
2092
+ _hue: inputTokens?.base?.positive?._hue,
2093
+ ...spec.badge?.["*"],
2094
+ ...spec.badge?.positive
2098
2095
  },
2099
2096
  caution: {
2100
- _hue: (_T = (_S = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _S.caution) == null ? void 0 : _T._hue,
2101
- ...(_U = spec.badge) == null ? void 0 : _U["*"],
2102
- ...(_V = spec.badge) == null ? void 0 : _V.caution
2097
+ _hue: inputTokens?.base?.caution?._hue,
2098
+ ...spec.badge?.["*"],
2099
+ ...spec.badge?.caution
2103
2100
  },
2104
2101
  critical: {
2105
- _hue: (_X = (_W = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _W.critical) == null ? void 0 : _X._hue,
2106
- ...(_Y = spec.badge) == null ? void 0 : _Y["*"],
2107
- ...(_Z = spec.badge) == null ? void 0 : _Z.critical
2102
+ _hue: inputTokens?.base?.critical?._hue,
2103
+ ...spec.badge?.["*"],
2104
+ ...spec.badge?.critical
2108
2105
  }
2109
2106
  }
2110
2107
  };
@@ -2122,13 +2119,12 @@ function resolveInputModeColorTokens(inputTokens, mode) {
2122
2119
  return states;
2123
2120
  }
2124
2121
  function resolveInputStateColorTokens(inputTokens, mode, state) {
2125
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2126
2122
  const spec = merge(
2127
- (_b = (_a = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"],
2128
- (_d = (_c = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _c[mode]) == null ? void 0 : _d["*"],
2129
- (_f = (_e = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state],
2130
- (_h = (_g = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _g[mode]) == null ? void 0 : _h[state]
2131
- ), hue = spec._hue || ((_j = (_i = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _i[mode]) == null ? void 0 : _j._hue);
2123
+ inputTokens?.input?.["*"]?.["*"],
2124
+ inputTokens?.input?.[mode]?.["*"],
2125
+ inputTokens?.input?.["*"]?.[state],
2126
+ inputTokens?.input?.[mode]?.[state]
2127
+ ), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
2132
2128
  return { ...spec, _hue: hue };
2133
2129
  }
2134
2130
  function resolveSelectableColorTokens(inputTokens) {
@@ -2138,61 +2134,59 @@ function resolveSelectableColorTokens(inputTokens) {
2138
2134
  return tokens;
2139
2135
  }
2140
2136
  function resolveSelectableToneColorTokens(inputTokens, tone) {
2141
- var _a, _b, _c, _d;
2142
2137
  const states = {
2143
- _hue: ((_b = (_a = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _a[tone]) == null ? void 0 : _b._hue) || ((_d = (_c = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _c[tone]) == null ? void 0 : _d._hue)
2138
+ _hue: inputTokens?.selectable?.[tone]?._hue || inputTokens?.base?.[tone]?._hue
2144
2139
  };
2145
2140
  for (const state of THEME_COLOR_STATES)
2146
2141
  states[state] = resolveSelectableStateColorTokens(inputTokens, tone, state);
2147
2142
  return states;
2148
2143
  }
2149
2144
  function resolveSelectableStateColorTokens(inputTokens, tone, state) {
2150
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V;
2151
2145
  const spec = merge(
2152
- (_b = (_a = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"],
2153
- (_d = (_c = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _c[tone]) == null ? void 0 : _d["*"],
2154
- (_f = (_e = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state],
2155
- (_h = (_g = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _g[tone]) == null ? void 0 : _h[state]
2156
- ), hue = spec._hue || ((_j = (_i = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _i[tone]) == null ? void 0 : _j._hue);
2146
+ inputTokens?.selectable?.["*"]?.["*"],
2147
+ inputTokens?.selectable?.[tone]?.["*"],
2148
+ inputTokens?.selectable?.["*"]?.[state],
2149
+ inputTokens?.selectable?.[tone]?.[state]
2150
+ ), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
2157
2151
  return {
2158
2152
  ...spec,
2159
2153
  _hue: hue,
2160
2154
  avatar: {
2161
- gray: merge({ _hue: "gray" }, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.gray),
2162
- blue: merge({ _hue: "blue" }, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.blue),
2163
- purple: merge({ _hue: "purple" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.purple),
2164
- magenta: merge({ _hue: "magenta" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.magenta),
2165
- red: merge({ _hue: "red" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.red),
2166
- orange: merge({ _hue: "orange" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.orange),
2167
- yellow: merge({ _hue: "yellow" }, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.yellow),
2168
- green: merge({ _hue: "green" }, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.green),
2169
- cyan: merge({ _hue: "cyan" }, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.cyan)
2155
+ gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
2156
+ blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
2157
+ purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
2158
+ magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
2159
+ red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
2160
+ orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
2161
+ yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
2162
+ green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
2163
+ cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
2170
2164
  },
2171
2165
  badge: {
2172
2166
  default: {
2173
- _hue: (_D = (_C = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _C.default) == null ? void 0 : _D._hue,
2174
- ...(_E = spec.badge) == null ? void 0 : _E["*"],
2175
- ...(_F = spec.badge) == null ? void 0 : _F.default
2167
+ _hue: inputTokens?.base?.default?._hue,
2168
+ ...spec.badge?.["*"],
2169
+ ...spec.badge?.default
2176
2170
  },
2177
2171
  primary: {
2178
- _hue: (_H = (_G = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _G.primary) == null ? void 0 : _H._hue,
2179
- ...(_I = spec.badge) == null ? void 0 : _I["*"],
2180
- ...(_J = spec.badge) == null ? void 0 : _J.primary
2172
+ _hue: inputTokens?.base?.primary?._hue,
2173
+ ...spec.badge?.["*"],
2174
+ ...spec.badge?.primary
2181
2175
  },
2182
2176
  positive: {
2183
- _hue: (_L = (_K = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _K.positive) == null ? void 0 : _L._hue,
2184
- ...(_M = spec.badge) == null ? void 0 : _M["*"],
2185
- ...(_N = spec.badge) == null ? void 0 : _N.positive
2177
+ _hue: inputTokens?.base?.positive?._hue,
2178
+ ...spec.badge?.["*"],
2179
+ ...spec.badge?.positive
2186
2180
  },
2187
2181
  caution: {
2188
- _hue: (_P = (_O = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _O.caution) == null ? void 0 : _P._hue,
2189
- ...(_Q = spec.badge) == null ? void 0 : _Q["*"],
2190
- ...(_R = spec.badge) == null ? void 0 : _R.caution
2182
+ _hue: inputTokens?.base?.caution?._hue,
2183
+ ...spec.badge?.["*"],
2184
+ ...spec.badge?.caution
2191
2185
  },
2192
2186
  critical: {
2193
- _hue: (_T = (_S = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _S.critical) == null ? void 0 : _T._hue,
2194
- ...(_U = spec.badge) == null ? void 0 : _U["*"],
2195
- ...(_V = spec.badge) == null ? void 0 : _V.critical
2187
+ _hue: inputTokens?.base?.critical?._hue,
2188
+ ...spec.badge?.["*"],
2189
+ ...spec.badge?.critical
2196
2190
  }
2197
2191
  }
2198
2192
  };
@@ -2200,7 +2194,7 @@ function resolveSelectableStateColorTokens(inputTokens, tone, state) {
2200
2194
  function buildColorTheme(config) {
2201
2195
  const resolvedConfig = {
2202
2196
  ...config,
2203
- color: resolveColorTokens(config == null ? void 0 : config.color)
2197
+ color: resolveColorTokens(config?.color)
2204
2198
  };
2205
2199
  return {
2206
2200
  light: buildColorScheme({ scheme: "light" }, resolvedConfig),
@@ -2219,57 +2213,55 @@ function buildColorScheme(options, config) {
2219
2213
  };
2220
2214
  }
2221
2215
  function buildCardColorTheme(options, config) {
2222
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2223
- const { scheme, tone } = options, tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone], context = { hue: (tokens == null ? void 0 : tokens._hue) || "gray", scheme };
2216
+ const { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = { hue: tokens?._hue || "gray", scheme };
2224
2217
  return {
2225
- _blend: ((tokens == null ? void 0 : tokens._blend) || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
2218
+ _blend: (tokens?._blend || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
2226
2219
  _dark: scheme === "dark",
2227
2220
  accent: {
2228
- fg: resolveColorTokenValue(context, (_c = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _c.fg)
2221
+ fg: resolveColorTokenValue(context, tokens?.accent?.fg)
2229
2222
  },
2230
2223
  avatar: buildAvatarColorTheme({ scheme }, tokens),
2231
- backdrop: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.backdrop),
2232
- badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
2233
- bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
2234
- border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
2224
+ backdrop: resolveColorTokenValue(context, tokens?.backdrop),
2225
+ badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
2226
+ bg: resolveColorTokenValue(context, tokens?.bg),
2227
+ border: resolveColorTokenValue(context, tokens?.border),
2235
2228
  button: buildButtonColorTheme({ scheme }, config),
2236
2229
  code: {
2237
- bg: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.code) == null ? void 0 : _d.bg),
2238
- fg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.code) == null ? void 0 : _e.fg)
2230
+ bg: resolveColorTokenValue(context, tokens?.code?.bg),
2231
+ fg: resolveColorTokenValue(context, tokens?.code?.fg)
2239
2232
  },
2240
- fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
2241
- focusRing: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.focusRing),
2242
- icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon),
2233
+ fg: resolveColorTokenValue(context, tokens?.fg),
2234
+ focusRing: resolveColorTokenValue(context, tokens?.focusRing),
2235
+ icon: resolveColorTokenValue(context, tokens?.icon),
2243
2236
  input: buildInputColorTheme({ scheme, tone }, config),
2244
2237
  kbd: {
2245
- bg: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _f.bg),
2246
- fg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _g.fg),
2247
- border: resolveColorTokenValue(context, (_h = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _h.border)
2238
+ bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
2239
+ fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
2240
+ border: resolveColorTokenValue(context, tokens?.kbd?.border)
2248
2241
  },
2249
2242
  link: {
2250
- fg: resolveColorTokenValue(context, (_i = tokens == null ? void 0 : tokens.link) == null ? void 0 : _i.fg)
2243
+ fg: resolveColorTokenValue(context, tokens?.link?.fg)
2251
2244
  },
2252
2245
  muted: {
2253
- bg: resolveColorTokenValue(context, (_j = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _j.bg),
2254
- fg: resolveColorTokenValue(context, (_k = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _k.fg)
2246
+ bg: resolveColorTokenValue(context, tokens?.muted?.bg),
2247
+ fg: resolveColorTokenValue(context, tokens?.muted?.fg)
2255
2248
  },
2256
2249
  selectable: buildSelectableColorTheme({ scheme }, config),
2257
2250
  shadow: buildShadowColorTheme({ scheme, tone }, config),
2258
2251
  skeleton: {
2259
- from: resolveColorTokenValue(context, (_l = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _l.from),
2260
- to: resolveColorTokenValue(context, (_m = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _m.to)
2252
+ from: resolveColorTokenValue(context, tokens?.skeleton?.from),
2253
+ to: resolveColorTokenValue(context, tokens?.skeleton?.to)
2261
2254
  },
2262
2255
  syntax: buildSyntaxColorTheme({ scheme }, config)
2263
2256
  };
2264
2257
  }
2265
2258
  function buildShadowColorTheme(options, config) {
2266
- var _a, _b, _c, _d, _e, _f;
2267
- const { scheme, tone } = options, tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone], context = { hue: (tokens == null ? void 0 : tokens._hue) || "gray", scheme };
2259
+ const { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = { hue: tokens?._hue || "gray", scheme };
2268
2260
  return {
2269
- outline: resolveColorTokenValue(context, (_c = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _c.outline),
2270
- umbra: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _d.umbra),
2271
- penumbra: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _e.penumbra),
2272
- ambient: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _f.ambient)
2261
+ outline: resolveColorTokenValue(context, tokens?.shadow?.outline),
2262
+ umbra: resolveColorTokenValue(context, tokens?.shadow?.umbra),
2263
+ penumbra: resolveColorTokenValue(context, tokens?.shadow?.penumbra),
2264
+ ambient: resolveColorTokenValue(context, tokens?.shadow?.ambient)
2273
2265
  };
2274
2266
  }
2275
2267
  function buildAvatarColorTheme(options, stateTokens) {
@@ -2287,12 +2279,11 @@ function buildAvatarColorTheme(options, stateTokens) {
2287
2279
  };
2288
2280
  }
2289
2281
  function _buildAvatarColorTheme(options, stateTokens) {
2290
- var _a;
2291
- const { color: color2, scheme } = options, tokens = (_a = stateTokens == null ? void 0 : stateTokens.avatar) == null ? void 0 : _a[color2], context = { hue: (tokens == null ? void 0 : tokens._hue) || "gray", scheme };
2282
+ const { color: color2, scheme } = options, tokens = stateTokens?.avatar?.[color2], context = { hue: tokens?._hue || "gray", scheme };
2292
2283
  return {
2293
- _blend: ((tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
2294
- bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
2295
- fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg)
2284
+ _blend: (tokens?._blend || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
2285
+ bg: resolveColorTokenValue(context, tokens?.bg),
2286
+ fg: resolveColorTokenValue(context, tokens?.fg)
2296
2287
  };
2297
2288
  }
2298
2289
  function buildBadgeColorTheme(tokens, options, config) {
@@ -2306,13 +2297,12 @@ function buildBadgeColorTheme(tokens, options, config) {
2306
2297
  };
2307
2298
  }
2308
2299
  function _buildBadgeColorTheme(parentTokens, options, config) {
2309
- var _a, _b, _c;
2310
- const { scheme, tone } = options, tokens = parentTokens == null ? void 0 : parentTokens[tone], context = { hue: (tokens == null ? void 0 : tokens._hue) || ((_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone]) == null ? void 0 : _c._hue) || "gray", scheme };
2300
+ const { scheme, tone } = options, tokens = parentTokens?.[tone], context = { hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", scheme };
2311
2301
  return {
2312
- bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
2313
- fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
2314
- dot: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.dot),
2315
- icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon)
2302
+ bg: resolveColorTokenValue(context, tokens?.bg),
2303
+ fg: resolveColorTokenValue(context, tokens?.fg),
2304
+ dot: resolveColorTokenValue(context, tokens?.dot),
2305
+ icon: resolveColorTokenValue(context, tokens?.icon)
2316
2306
  };
2317
2307
  }
2318
2308
  function buildButtonColorTheme(options, config) {
@@ -2334,38 +2324,37 @@ function buildButtonStatesColorTheme(options, config) {
2334
2324
  return states;
2335
2325
  }
2336
2326
  function buildButtonStateColorTheme(options, config) {
2337
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
2338
- const { mode, tone, scheme, state } = options, tokens = (_d = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.button) == null ? void 0 : _b[mode]) == null ? void 0 : _c[tone]) == null ? void 0 : _d[state], hue = (tokens == null ? void 0 : tokens._hue) || "gray", blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"], context = { hue, scheme };
2327
+ const { mode, tone, scheme, state } = options, tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
2339
2328
  return {
2340
2329
  _blend: blendMode[scheme === "light" ? 0 : 1],
2341
2330
  accent: {
2342
- fg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _e.fg)
2331
+ fg: resolveColorTokenValue(context, tokens?.accent?.fg)
2343
2332
  },
2344
2333
  avatar: buildAvatarColorTheme({ scheme }, tokens),
2345
- badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
2346
- bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
2347
- border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
2334
+ badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
2335
+ bg: resolveColorTokenValue(context, tokens?.bg),
2336
+ border: resolveColorTokenValue(context, tokens?.border),
2348
2337
  code: {
2349
- bg: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.code) == null ? void 0 : _f.bg),
2350
- fg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.code) == null ? void 0 : _g.fg)
2338
+ bg: resolveColorTokenValue(context, tokens?.code?.bg),
2339
+ fg: resolveColorTokenValue(context, tokens?.code?.fg)
2351
2340
  },
2352
- fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
2353
- icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon),
2341
+ fg: resolveColorTokenValue(context, tokens?.fg),
2342
+ icon: resolveColorTokenValue(context, tokens?.icon),
2354
2343
  muted: {
2355
- bg: resolveColorTokenValue(context, (_h = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _h.bg),
2356
- fg: resolveColorTokenValue(context, (_i = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _i.fg)
2344
+ bg: resolveColorTokenValue(context, tokens?.muted?.bg),
2345
+ fg: resolveColorTokenValue(context, tokens?.muted?.fg)
2357
2346
  },
2358
2347
  kbd: {
2359
- bg: resolveColorTokenValue(context, (_j = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _j.bg),
2360
- fg: resolveColorTokenValue(context, (_k = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _k.fg),
2361
- border: resolveColorTokenValue(context, (_l = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _l.border)
2348
+ bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
2349
+ fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
2350
+ border: resolveColorTokenValue(context, tokens?.kbd?.border)
2362
2351
  },
2363
2352
  link: {
2364
- fg: resolveColorTokenValue(context, (_m = tokens == null ? void 0 : tokens.link) == null ? void 0 : _m.fg)
2353
+ fg: resolveColorTokenValue(context, tokens?.link?.fg)
2365
2354
  },
2366
2355
  skeleton: {
2367
- from: resolveColorTokenValue(context, (_n = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _n.from),
2368
- to: resolveColorTokenValue(context, (_o = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _o.to)
2356
+ from: resolveColorTokenValue(context, tokens?.skeleton?.from),
2357
+ to: resolveColorTokenValue(context, tokens?.skeleton?.to)
2369
2358
  }
2370
2359
  };
2371
2360
  }
@@ -2386,17 +2375,16 @@ function buildInputStatesColorTheme(options, config) {
2386
2375
  };
2387
2376
  }
2388
2377
  function buildInputStateColorTheme(options, config) {
2389
- var _a, _b, _c, _d, _e, _f, _g;
2390
- const { mode, tone, scheme, state } = options, tokens = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.input) == null ? void 0 : _b[mode]) == null ? void 0 : _c[state], hue = (tokens == null ? void 0 : tokens._hue) || ((_f = (_e = (_d = config == null ? void 0 : config.color) == null ? void 0 : _d.base) == null ? void 0 : _e[tone]) == null ? void 0 : _f._hue) || "gray", blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"], context = { hue, scheme };
2378
+ const { mode, tone, scheme, state } = options, tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
2391
2379
  return {
2392
2380
  _blend: blendMode[scheme === "light" ? 0 : 1],
2393
- bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
2394
- border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
2395
- fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
2381
+ bg: resolveColorTokenValue(context, tokens?.bg),
2382
+ border: resolveColorTokenValue(context, tokens?.border),
2383
+ fg: resolveColorTokenValue(context, tokens?.fg),
2396
2384
  muted: {
2397
- bg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _g.bg)
2385
+ bg: resolveColorTokenValue(context, tokens?.muted?.bg)
2398
2386
  },
2399
- placeholder: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.placeholder)
2387
+ placeholder: resolveColorTokenValue(context, tokens?.placeholder)
2400
2388
  };
2401
2389
  }
2402
2390
  function buildSelectableColorTheme(options, config) {
@@ -2412,81 +2400,79 @@ function buildSelectableStatesColorTheme(options, config) {
2412
2400
  return states;
2413
2401
  }
2414
2402
  function buildSelectableStateColorTheme(options, config) {
2415
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
2416
- const { scheme, state, tone } = options, tokens = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.selectable) == null ? void 0 : _b[tone]) == null ? void 0 : _c[state], hue = (tokens == null ? void 0 : tokens._hue) || "gray", blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"], context = { hue, scheme };
2403
+ const { scheme, state, tone } = options, tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
2417
2404
  return {
2418
2405
  _blend: blendMode[scheme === "light" ? 0 : 1],
2419
2406
  accent: {
2420
- fg: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _d.fg)
2407
+ fg: resolveColorTokenValue(context, tokens?.accent?.fg)
2421
2408
  },
2422
2409
  avatar: buildAvatarColorTheme({ scheme }, tokens),
2423
- badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
2424
- bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
2425
- border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
2410
+ badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
2411
+ bg: resolveColorTokenValue(context, tokens?.bg),
2412
+ border: resolveColorTokenValue(context, tokens?.border),
2426
2413
  code: {
2427
- bg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.code) == null ? void 0 : _e.bg),
2428
- fg: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.code) == null ? void 0 : _f.fg)
2414
+ bg: resolveColorTokenValue(context, tokens?.code?.bg),
2415
+ fg: resolveColorTokenValue(context, tokens?.code?.fg)
2429
2416
  },
2430
- fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
2431
- icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon),
2417
+ fg: resolveColorTokenValue(context, tokens?.fg),
2418
+ icon: resolveColorTokenValue(context, tokens?.icon),
2432
2419
  muted: {
2433
- bg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _g.bg),
2434
- fg: resolveColorTokenValue(context, (_h = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _h.fg)
2420
+ bg: resolveColorTokenValue(context, tokens?.muted?.bg),
2421
+ fg: resolveColorTokenValue(context, tokens?.muted?.fg)
2435
2422
  },
2436
2423
  kbd: {
2437
- bg: resolveColorTokenValue(context, (_i = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _i.bg),
2438
- fg: resolveColorTokenValue(context, (_j = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _j.fg),
2439
- border: resolveColorTokenValue(context, (_k = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _k.border)
2424
+ bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
2425
+ fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
2426
+ border: resolveColorTokenValue(context, tokens?.kbd?.border)
2440
2427
  },
2441
2428
  link: {
2442
- fg: resolveColorTokenValue(context, (_l = tokens == null ? void 0 : tokens.link) == null ? void 0 : _l.fg)
2429
+ fg: resolveColorTokenValue(context, tokens?.link?.fg)
2443
2430
  },
2444
2431
  skeleton: {
2445
- from: resolveColorTokenValue(context, (_m = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _m.from),
2446
- to: resolveColorTokenValue(context, (_n = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _n.to)
2432
+ from: resolveColorTokenValue(context, tokens?.skeleton?.from),
2433
+ to: resolveColorTokenValue(context, tokens?.skeleton?.to)
2447
2434
  }
2448
2435
  };
2449
2436
  }
2450
2437
  function buildSyntaxColorTheme(options, config) {
2451
- var _a;
2452
- const { scheme } = options, tokens = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.syntax, context = { hue: "gray", scheme };
2438
+ const { scheme } = options, tokens = config?.color?.syntax, context = { hue: "gray", scheme };
2453
2439
  return {
2454
- atrule: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.atrule),
2455
- attrName: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.attrName),
2456
- attrValue: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.attrValue),
2457
- attribute: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.attribute),
2458
- boolean: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.boolean),
2459
- builtin: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.builtin),
2460
- cdata: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.cdata),
2461
- char: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.char),
2462
- class: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.class),
2463
- className: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.className),
2464
- comment: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.comment),
2465
- constant: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.constant),
2466
- deleted: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.deleted),
2467
- doctype: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.doctype),
2468
- entity: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.entity),
2469
- function: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.function),
2470
- hexcode: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.hexcode),
2471
- id: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.id),
2472
- important: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.important),
2473
- inserted: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.inserted),
2474
- keyword: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.keyword),
2475
- number: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.number),
2476
- operator: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.operator),
2477
- prolog: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.prolog),
2478
- property: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.property),
2479
- pseudoClass: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.pseudoClass),
2480
- pseudoElement: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.pseudoElement),
2481
- punctuation: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.punctuation),
2482
- regex: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.regex),
2483
- selector: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.selector),
2484
- string: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.string),
2485
- symbol: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.symbol),
2486
- tag: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.tag),
2487
- unit: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.unit),
2488
- url: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.url),
2489
- variable: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.variable)
2440
+ atrule: resolveColorTokenValue(context, tokens?.atrule),
2441
+ attrName: resolveColorTokenValue(context, tokens?.attrName),
2442
+ attrValue: resolveColorTokenValue(context, tokens?.attrValue),
2443
+ attribute: resolveColorTokenValue(context, tokens?.attribute),
2444
+ boolean: resolveColorTokenValue(context, tokens?.boolean),
2445
+ builtin: resolveColorTokenValue(context, tokens?.builtin),
2446
+ cdata: resolveColorTokenValue(context, tokens?.cdata),
2447
+ char: resolveColorTokenValue(context, tokens?.char),
2448
+ class: resolveColorTokenValue(context, tokens?.class),
2449
+ className: resolveColorTokenValue(context, tokens?.className),
2450
+ comment: resolveColorTokenValue(context, tokens?.comment),
2451
+ constant: resolveColorTokenValue(context, tokens?.constant),
2452
+ deleted: resolveColorTokenValue(context, tokens?.deleted),
2453
+ doctype: resolveColorTokenValue(context, tokens?.doctype),
2454
+ entity: resolveColorTokenValue(context, tokens?.entity),
2455
+ function: resolveColorTokenValue(context, tokens?.function),
2456
+ hexcode: resolveColorTokenValue(context, tokens?.hexcode),
2457
+ id: resolveColorTokenValue(context, tokens?.id),
2458
+ important: resolveColorTokenValue(context, tokens?.important),
2459
+ inserted: resolveColorTokenValue(context, tokens?.inserted),
2460
+ keyword: resolveColorTokenValue(context, tokens?.keyword),
2461
+ number: resolveColorTokenValue(context, tokens?.number),
2462
+ operator: resolveColorTokenValue(context, tokens?.operator),
2463
+ prolog: resolveColorTokenValue(context, tokens?.prolog),
2464
+ property: resolveColorTokenValue(context, tokens?.property),
2465
+ pseudoClass: resolveColorTokenValue(context, tokens?.pseudoClass),
2466
+ pseudoElement: resolveColorTokenValue(context, tokens?.pseudoElement),
2467
+ punctuation: resolveColorTokenValue(context, tokens?.punctuation),
2468
+ regex: resolveColorTokenValue(context, tokens?.regex),
2469
+ selector: resolveColorTokenValue(context, tokens?.selector),
2470
+ string: resolveColorTokenValue(context, tokens?.string),
2471
+ symbol: resolveColorTokenValue(context, tokens?.symbol),
2472
+ tag: resolveColorTokenValue(context, tokens?.tag),
2473
+ unit: resolveColorTokenValue(context, tokens?.unit),
2474
+ url: resolveColorTokenValue(context, tokens?.url),
2475
+ variable: resolveColorTokenValue(context, tokens?.variable)
2490
2476
  };
2491
2477
  }
2492
2478
  const defaultColorPalette = color.color;
@@ -2676,8 +2662,7 @@ function renderColorHex(color2) {
2676
2662
  return typeof color2 == "string" ? color2 : color2.hex;
2677
2663
  }
2678
2664
  function renderThemeColorSchemes(value, config) {
2679
- var _a;
2680
- const colorPalette = (_a = config == null ? void 0 : config.palette) != null ? _a : defaultColorPalette;
2665
+ const colorPalette = config?.palette ?? defaultColorPalette;
2681
2666
  return {
2682
2667
  light: renderThemeColorScheme(colorPalette, value.light),
2683
2668
  dark: renderThemeColorScheme(colorPalette, value.dark)
@@ -2854,7 +2839,6 @@ function renderThemeColorButtonStates(value, options) {
2854
2839
  };
2855
2840
  }
2856
2841
  function renderThemeColorState(value, options) {
2857
- var _a, _b;
2858
2842
  const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
2859
2843
  bg: baseBg,
2860
2844
  blendMode: rootBlendMode,
@@ -2892,8 +2876,8 @@ function renderThemeColorState(value, options) {
2892
2876
  border: renderColorValue(value.kbd.border, colorOptions)
2893
2877
  },
2894
2878
  skeleton: {
2895
- from: renderColorValue((_a = value.skeleton) == null ? void 0 : _a.from, colorOptions),
2896
- to: renderColorValue((_b = value.skeleton) == null ? void 0 : _b.to, colorOptions)
2879
+ from: renderColorValue(value.skeleton?.from, colorOptions),
2880
+ to: renderColorValue(value.skeleton?.to, colorOptions)
2897
2881
  }
2898
2882
  };
2899
2883
  }
@@ -2984,27 +2968,26 @@ function renderSyntaxColorTheme(value, options) {
2984
2968
  };
2985
2969
  }
2986
2970
  function buildTheme(config) {
2987
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2988
2971
  const colorTheme = buildColorTheme(config), v2 = {
2989
2972
  _version: 2,
2990
- avatar: (_a = config == null ? void 0 : config.avatar) != null ? _a : getTheme_v2.defaultThemeConfig.avatar,
2991
- button: (_b = config == null ? void 0 : config.button) != null ? _b : getTheme_v2.defaultThemeConfig.button,
2992
- card: (_c = config == null ? void 0 : config.card) != null ? _c : getTheme_v2.defaultThemeConfig.card,
2973
+ avatar: config?.avatar ?? getTheme_v2.defaultThemeConfig.avatar,
2974
+ button: config?.button ?? getTheme_v2.defaultThemeConfig.button,
2975
+ card: config?.card ?? getTheme_v2.defaultThemeConfig.card,
2993
2976
  // How colors are generated:
2994
2977
  // 1. Merge custom tokens with default tokens
2995
2978
  // 2. Generate tree of color keys (gray/500, black, white, etc.)
2996
2979
  // 3. Apply mixing and render to hex values
2997
2980
  // render(build(mergeWithDefaults()))
2998
2981
  color: renderThemeColorSchemes(colorTheme, config),
2999
- container: (_d = config == null ? void 0 : config.container) != null ? _d : getTheme_v2.defaultThemeConfig.container,
3000
- font: (_e = config == null ? void 0 : config.font) != null ? _e : defaultThemeFonts,
3001
- input: (_f = config == null ? void 0 : config.input) != null ? _f : getTheme_v2.defaultThemeConfig.input,
3002
- layer: (_g = config == null ? void 0 : config.layer) != null ? _g : getTheme_v2.defaultThemeConfig.layer,
3003
- media: (_h = config == null ? void 0 : config.media) != null ? _h : getTheme_v2.defaultThemeConfig.media,
3004
- radius: (_i = config == null ? void 0 : config.radius) != null ? _i : getTheme_v2.defaultThemeConfig.radius,
3005
- shadow: (_j = config == null ? void 0 : config.shadow) != null ? _j : getTheme_v2.defaultThemeConfig.shadow,
3006
- space: (_k = config == null ? void 0 : config.space) != null ? _k : getTheme_v2.defaultThemeConfig.space,
3007
- style: (_l = config == null ? void 0 : config.style) != null ? _l : getTheme_v2.defaultThemeConfig.style
2982
+ container: config?.container ?? getTheme_v2.defaultThemeConfig.container,
2983
+ font: config?.font ?? defaultThemeFonts,
2984
+ input: config?.input ?? getTheme_v2.defaultThemeConfig.input,
2985
+ layer: config?.layer ?? getTheme_v2.defaultThemeConfig.layer,
2986
+ media: config?.media ?? getTheme_v2.defaultThemeConfig.media,
2987
+ radius: config?.radius ?? getTheme_v2.defaultThemeConfig.radius,
2988
+ shadow: config?.shadow ?? getTheme_v2.defaultThemeConfig.shadow,
2989
+ space: config?.space ?? getTheme_v2.defaultThemeConfig.space,
2990
+ style: config?.style ?? getTheme_v2.defaultThemeConfig.style
3008
2991
  };
3009
2992
  return v2_v0(v2);
3010
2993
  }