@trops/dash-core 0.1.568 → 0.1.569

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/index.js CHANGED
@@ -28898,6 +28898,29 @@ function classFor(prefix, type, shade, channelValue) {
28898
28898
  }
28899
28899
  return "".concat(h).concat(prefix, "-").concat(channelValue, "-").concat(shade);
28900
28900
  }
28901
+
28902
+ /**
28903
+ * CSS color value (hex literal or `var(...)` reference) for the same
28904
+ * (type, shade, channelValue) tuple `classFor` resolves to a Tailwind
28905
+ * className. Inline-style consumers read these via
28906
+ * `currentTheme.cssValue[tokenName]` — see PRD US-007.
28907
+ *
28908
+ * Named channels look up the hex from TAILWIND_PALETTE. Hex channels
28909
+ * produce a `var(--{type}-{shade})` reference that resolves against
28910
+ * the CSS custom properties ThemePreviewProvider writes to :root.
28911
+ *
28912
+ * Returns null for unknown named-color families or shades — caller
28913
+ * falls back to className-only reactivity for that token.
28914
+ */
28915
+ function cssValueFor(type, shade, channelValue) {
28916
+ if (DashReact.isHexColor(channelValue)) {
28917
+ return "var(--".concat(type, "-").concat(shade, ")");
28918
+ }
28919
+ var family = DashReact.TAILWIND_PALETTE && DashReact.TAILWIND_PALETTE[channelValue];
28920
+ if (!family) return null;
28921
+ var hex = family[shade] || family[String(shade)];
28922
+ return hex || null;
28923
+ }
28901
28924
  function gradientFor(direction, type, fromShade, viaShade, toShade, channelValue) {
28902
28925
  if (DashReact.isHexColor(channelValue)) {
28903
28926
  return "bg-gradient-to-".concat(direction, " from-[var(--").concat(type, "-").concat(fromShade, ")] via-[var(--").concat(type, "-").concat(viaShade, ")] to-[var(--").concat(type, "-").concat(toShade, ")]");
@@ -28960,17 +28983,26 @@ var ThemeModel = function ThemeModel() {
28960
28983
  if (variant in theme === false) {
28961
28984
  theme[variant] = {};
28962
28985
  }
28986
+ if (!theme[variant].cssValue) {
28987
+ theme[variant].cssValue = {};
28988
+ }
28963
28989
  Object.keys(variants[variant]).forEach(function (shade) {
28964
28990
  var numShade = variants[variant][shade];
28965
28991
  var hoverShade = getNextLevel(numShade);
28966
28992
  var textShade = invert(numShade);
28967
28993
  theme[variant]["bg-".concat(type, "-").concat(shade)] = classFor("bg", type, numShade, channelValue);
28994
+ theme[variant].cssValue["bg-".concat(type, "-").concat(shade)] = cssValueFor(type, numShade, channelValue);
28968
28995
  theme[variant]["hover-bg-".concat(type, "-").concat(shade)] = classFor("bg", type, hoverShade, channelValue, true);
28996
+ theme[variant].cssValue["hover-bg-".concat(type, "-").concat(shade)] = cssValueFor(type, hoverShade, channelValue);
28969
28997
  theme[variant]["hover-border-".concat(type, "-").concat(shade)] = classFor("border", type, hoverShade, channelValue, true);
28998
+ theme[variant].cssValue["hover-border-".concat(type, "-").concat(shade)] = cssValueFor(type, hoverShade, channelValue);
28970
28999
  theme[variant]["border-".concat(type, "-").concat(shade)] = classFor("border", type, numShade, channelValue);
29000
+ theme[variant].cssValue["border-".concat(type, "-").concat(shade)] = cssValueFor(type, numShade, channelValue);
28971
29001
  // we should be "flipping" these so dark text on light and light on dark...
28972
29002
  theme[variant]["text-".concat(type, "-").concat(shade)] = classFor("text", type, textShade, channelValue);
29003
+ theme[variant].cssValue["text-".concat(type, "-").concat(shade)] = cssValueFor(type, textShade, channelValue);
28973
29004
  theme[variant]["hover-text-".concat(type, "-").concat(shade)] = classFor("text", type, textShade, channelValue, true);
29005
+ theme[variant].cssValue["hover-text-".concat(type, "-").concat(shade)] = cssValueFor(type, textShade, channelValue);
28974
29006
  });
28975
29007
  });
28976
29008
  });
@@ -29037,7 +29069,9 @@ var ThemeModel = function ThemeModel() {
29037
29069
  DashReact.colorTypes.forEach(function (type) {
29038
29070
  var channelValue = theme[type];
29039
29071
  theme["dark"]["bg-".concat(type, "-darkest")] = classFor("bg", type, 950, channelValue);
29072
+ theme["dark"].cssValue["bg-".concat(type, "-darkest")] = cssValueFor(type, 950, channelValue);
29040
29073
  theme["light"]["bg-".concat(type, "-darkest")] = classFor("bg", type, 50, channelValue);
29074
+ theme["light"].cssValue["bg-".concat(type, "-darkest")] = cssValueFor(type, 50, channelValue);
29041
29075
  });
29042
29076
 
29043
29077
  // Accumulate CSS custom properties for any hex-color channels.
@@ -29079,6 +29113,17 @@ var ThemeModel = function ThemeModel() {
29079
29113
  theme["light"]["hover-border-none"] = "hover:border-transparent";
29080
29114
  theme["light"]["hover-bg-none"] = "hover:bg-transparent";
29081
29115
  theme["light"]["hover-text-none"] = "hover:text-transparent";
29116
+
29117
+ // Mirror the transparent tokens into cssValue so inline-style
29118
+ // consumers can read borderless/transparent surfaces from the
29119
+ // same map as colored ones.
29120
+ ["dark", "light"].forEach(function (variant) {
29121
+ theme[variant].cssValue["bg-none"] = "transparent";
29122
+ theme[variant].cssValue["border-none"] = "transparent";
29123
+ theme[variant].cssValue["hover-bg-none"] = "transparent";
29124
+ theme[variant].cssValue["hover-border-none"] = "transparent";
29125
+ theme[variant].cssValue["hover-text-none"] = "transparent";
29126
+ });
29082
29127
  return theme;
29083
29128
  } catch (e) {
29084
29129
  return {};