@trops/dash-core 0.1.567 → 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/electron/index.js +387 -111
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +140 -72
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +139 -71
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
2
2
|
import _typeof from '@babel/runtime/helpers/typeof';
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import * as DashReact from '@trops/dash-react';
|
|
5
|
-
import { isObject, ThemeContext, Modal, FontAwesomeIcon, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, Tag, Button3, Button2, Paragraph, Sidebar, Panel, Stepper, Tag3, Card2, Card3, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, SelectInput, CodeEditorVS, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, ButtonIcon2, DropdownPanel, MenuItem2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, colorTypes, getCSSStyleForClassname, Panel2, Heading2, SubHeading, Paragraph2, Paragraph3, MenuItem, Tag2, ButtonIcon3, DashPanel, colorNames, shades, themeVariants, Tabs3, DataList, Checkbox, StatCard, Card, Tabs, Accordion, Alert, Toast, ProgressBar, Toggle, Breadcrumbs, Tabs2, Accordion2, Alert2, Toast2, ProgressBar2, Toggle2, Breadcrumbs2, Accordion3, Alert3, Toast3, ProgressBar3, Toggle3, Breadcrumbs3, ThemeFromUrlPane, TextArea, CodeEditorInline, Icon2, AlgoliaSearchBox, CommandPalette, useSidebar, Divider, Caption2, Caption, Caption3, EmptyState, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
|
|
5
|
+
import { isObject, ThemeContext, Modal, FontAwesomeIcon, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, Tag, Button3, Button2, Paragraph, Sidebar, Panel, Stepper, Tag3, Card2, Card3, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, SelectInput, CodeEditorVS, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, ButtonIcon2, DropdownPanel, MenuItem2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, colorTypes, isHexColor, deriveShades, TAILWIND_PALETTE, getCSSStyleForClassname, Panel2, Heading2, SubHeading, Paragraph2, Paragraph3, MenuItem, Tag2, ButtonIcon3, DashPanel, colorNames, shades, themeVariants, Tabs3, DataList, Checkbox, StatCard, Card, Tabs, Accordion, Alert, Toast, ProgressBar, Toggle, Breadcrumbs, Tabs2, Accordion2, Alert2, Toast2, ProgressBar2, Toggle2, Breadcrumbs2, Accordion3, Alert3, Toast3, ProgressBar3, Toggle3, Breadcrumbs3, ThemeFromUrlPane, TextArea, CodeEditorInline, Icon2, AlgoliaSearchBox, CommandPalette, useSidebar, Divider, Caption2, Caption, Caption3, EmptyState, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
|
|
6
6
|
export * from '@trops/dash-react';
|
|
7
7
|
export { ThemeContext } from '@trops/dash-react';
|
|
8
8
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
@@ -28848,11 +28848,6 @@ var WorkspaceModel = function WorkspaceModel(workspaceItem) {
|
|
|
28848
28848
|
return sanitizeWorkspaceObject(workspace);
|
|
28849
28849
|
};
|
|
28850
28850
|
|
|
28851
|
-
/**
|
|
28852
|
-
* ThemeModel
|
|
28853
|
-
*
|
|
28854
|
-
*/
|
|
28855
|
-
|
|
28856
28851
|
/**
|
|
28857
28852
|
* getNextLevel
|
|
28858
28853
|
* Need to generate the levels for tailwind
|
|
@@ -28865,6 +28860,55 @@ function getNextLevel(currentLevel) {
|
|
|
28865
28860
|
function invert(shade) {
|
|
28866
28861
|
return 900 - parseInt(shade, 10);
|
|
28867
28862
|
}
|
|
28863
|
+
|
|
28864
|
+
/**
|
|
28865
|
+
* Build a tailwind class string for the given prefix + type + numeric
|
|
28866
|
+
* shade. Routes to the arbitrary-value syntax (`bg-[var(--type-shade)]`)
|
|
28867
|
+
* when the channel's value is a hex.
|
|
28868
|
+
*
|
|
28869
|
+
* @param {"bg"|"text"|"border"} prefix
|
|
28870
|
+
* @param {string} type channel name (primary | secondary | …)
|
|
28871
|
+
* @param {number} shade tailwind shade (100..950)
|
|
28872
|
+
* @param {string} channelValue either a tailwind color name or a hex
|
|
28873
|
+
* @param {boolean} hover emit a `hover:` variant
|
|
28874
|
+
*/
|
|
28875
|
+
function classFor(prefix, type, shade, channelValue) {
|
|
28876
|
+
var hover = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
28877
|
+
var h = hover ? "hover:" : "";
|
|
28878
|
+
if (isHexColor(channelValue)) {
|
|
28879
|
+
return "".concat(h).concat(prefix, "-[var(--").concat(type, "-").concat(shade, ")]");
|
|
28880
|
+
}
|
|
28881
|
+
return "".concat(h).concat(prefix, "-").concat(channelValue, "-").concat(shade);
|
|
28882
|
+
}
|
|
28883
|
+
|
|
28884
|
+
/**
|
|
28885
|
+
* CSS color value (hex literal or `var(...)` reference) for the same
|
|
28886
|
+
* (type, shade, channelValue) tuple `classFor` resolves to a Tailwind
|
|
28887
|
+
* className. Inline-style consumers read these via
|
|
28888
|
+
* `currentTheme.cssValue[tokenName]` — see PRD US-007.
|
|
28889
|
+
*
|
|
28890
|
+
* Named channels look up the hex from TAILWIND_PALETTE. Hex channels
|
|
28891
|
+
* produce a `var(--{type}-{shade})` reference that resolves against
|
|
28892
|
+
* the CSS custom properties ThemePreviewProvider writes to :root.
|
|
28893
|
+
*
|
|
28894
|
+
* Returns null for unknown named-color families or shades — caller
|
|
28895
|
+
* falls back to className-only reactivity for that token.
|
|
28896
|
+
*/
|
|
28897
|
+
function cssValueFor(type, shade, channelValue) {
|
|
28898
|
+
if (isHexColor(channelValue)) {
|
|
28899
|
+
return "var(--".concat(type, "-").concat(shade, ")");
|
|
28900
|
+
}
|
|
28901
|
+
var family = TAILWIND_PALETTE && TAILWIND_PALETTE[channelValue];
|
|
28902
|
+
if (!family) return null;
|
|
28903
|
+
var hex = family[shade] || family[String(shade)];
|
|
28904
|
+
return hex || null;
|
|
28905
|
+
}
|
|
28906
|
+
function gradientFor(direction, type, fromShade, viaShade, toShade, channelValue) {
|
|
28907
|
+
if (isHexColor(channelValue)) {
|
|
28908
|
+
return "bg-gradient-to-".concat(direction, " from-[var(--").concat(type, "-").concat(fromShade, ")] via-[var(--").concat(type, "-").concat(viaShade, ")] to-[var(--").concat(type, "-").concat(toShade, ")]");
|
|
28909
|
+
}
|
|
28910
|
+
return "bg-gradient-to-".concat(direction, " from-").concat(channelValue, "-").concat(fromShade, " via-").concat(channelValue, "-").concat(viaShade, " to-").concat(channelValue, "-").concat(toShade);
|
|
28911
|
+
}
|
|
28868
28912
|
var ThemeModel = function ThemeModel() {
|
|
28869
28913
|
var themeItem = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
28870
28914
|
try {
|
|
@@ -28916,80 +28960,62 @@ var ThemeModel = function ThemeModel() {
|
|
|
28916
28960
|
// iterate over each color type "primary, secondary, tertiary ..."
|
|
28917
28961
|
// and generate the colors necessary (shades) based on tailwind
|
|
28918
28962
|
colorTypes.forEach(function (type) {
|
|
28963
|
+
var channelValue = theme[type];
|
|
28919
28964
|
Object.keys(variants).forEach(function (variant) {
|
|
28920
28965
|
if (variant in theme === false) {
|
|
28921
28966
|
theme[variant] = {};
|
|
28922
28967
|
}
|
|
28968
|
+
if (!theme[variant].cssValue) {
|
|
28969
|
+
theme[variant].cssValue = {};
|
|
28970
|
+
}
|
|
28923
28971
|
Object.keys(variants[variant]).forEach(function (shade) {
|
|
28924
|
-
|
|
28925
|
-
|
|
28926
|
-
|
|
28927
|
-
theme[variant]["
|
|
28972
|
+
var numShade = variants[variant][shade];
|
|
28973
|
+
var hoverShade = getNextLevel(numShade);
|
|
28974
|
+
var textShade = invert(numShade);
|
|
28975
|
+
theme[variant]["bg-".concat(type, "-").concat(shade)] = classFor("bg", type, numShade, channelValue);
|
|
28976
|
+
theme[variant].cssValue["bg-".concat(type, "-").concat(shade)] = cssValueFor(type, numShade, channelValue);
|
|
28977
|
+
theme[variant]["hover-bg-".concat(type, "-").concat(shade)] = classFor("bg", type, hoverShade, channelValue, true);
|
|
28978
|
+
theme[variant].cssValue["hover-bg-".concat(type, "-").concat(shade)] = cssValueFor(type, hoverShade, channelValue);
|
|
28979
|
+
theme[variant]["hover-border-".concat(type, "-").concat(shade)] = classFor("border", type, hoverShade, channelValue, true);
|
|
28980
|
+
theme[variant].cssValue["hover-border-".concat(type, "-").concat(shade)] = cssValueFor(type, hoverShade, channelValue);
|
|
28981
|
+
theme[variant]["border-".concat(type, "-").concat(shade)] = classFor("border", type, numShade, channelValue);
|
|
28982
|
+
theme[variant].cssValue["border-".concat(type, "-").concat(shade)] = cssValueFor(type, numShade, channelValue);
|
|
28928
28983
|
// we should be "flipping" these so dark text on light and light on dark...
|
|
28929
|
-
theme[variant]["text-".concat(type, "-").concat(shade)] = "text
|
|
28930
|
-
theme[variant]["
|
|
28984
|
+
theme[variant]["text-".concat(type, "-").concat(shade)] = classFor("text", type, textShade, channelValue);
|
|
28985
|
+
theme[variant].cssValue["text-".concat(type, "-").concat(shade)] = cssValueFor(type, textShade, channelValue);
|
|
28986
|
+
theme[variant]["hover-text-".concat(type, "-").concat(shade)] = classFor("text", type, textShade, channelValue, true);
|
|
28987
|
+
theme[variant].cssValue["hover-text-".concat(type, "-").concat(shade)] = cssValueFor(type, textShade, channelValue);
|
|
28931
28988
|
});
|
|
28932
28989
|
});
|
|
28933
28990
|
});
|
|
28934
28991
|
|
|
28935
|
-
//
|
|
28936
|
-
|
|
28937
|
-
//
|
|
28938
|
-
|
|
28939
|
-
|
|
28940
|
-
|
|
28941
|
-
|
|
28942
|
-
|
|
28943
|
-
|
|
28944
|
-
|
|
28945
|
-
|
|
28946
|
-
|
|
28947
|
-
|
|
28948
|
-
|
|
28949
|
-
|
|
28950
|
-
|
|
28951
|
-
|
|
28952
|
-
|
|
28953
|
-
|
|
28954
|
-
|
|
28955
|
-
|
|
28956
|
-
|
|
28957
|
-
|
|
28958
|
-
|
|
28959
|
-
|
|
28960
|
-
|
|
28961
|
-
|
|
28962
|
-
theme["dark"]["bg-secondary-gradient-left"] = "bg-gradient-to-l from-".concat(theme.secondary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["dark"]["dark"]);
|
|
28963
|
-
theme["dark"]["bg-secondary-gradient-top"] = "bg-gradient-to-t from-".concat(theme.secondary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["dark"]["dark"]);
|
|
28964
|
-
theme["dark"]["bg-secondary-gradient-top-right"] = "bg-gradient-to-tr from-".concat(theme.secondary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["dark"]["dark"]);
|
|
28965
|
-
theme["dark"]["bg-secondary-gradient-top-left"] = "bg-gradient-to-tl from-".concat(theme.secondary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["dark"]["dark"]);
|
|
28966
|
-
theme["light"]["bg-secondary-gradient-right"] = "bg-gradient-to-r from-".concat(theme.secondary, "-").concat(variants["light"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["light"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["light"]["dark"]);
|
|
28967
|
-
theme["light"]["bg-secondary-gradient-bottom"] = "bg-gradient-to-b from-".concat(theme.secondary, "-").concat(variants["light"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["light"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["light"]["dark"]);
|
|
28968
|
-
theme["light"]["bg-secondary-gradient-left"] = "bg-gradient-to-l from-".concat(theme.secondary, "-").concat(variants["light"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["light"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["light"]["dark"]);
|
|
28969
|
-
theme["light"]["bg-secondary-gradient-top"] = "bg-gradient-to-t from-".concat(theme.secondary, "-").concat(variants["light"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["light"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["light"]["dark"]);
|
|
28970
|
-
theme["light"]["bg-secondary-gradient-top-right"] = "bg-gradient-to-tr from-".concat(theme.secondary, "-").concat(variants["light"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["light"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["light"]["dark"]);
|
|
28971
|
-
theme["light"]["bg-secondary-gradient-bottom-right"] = "bg-gradient-to-br from-".concat(theme.secondary, "-").concat(variants["light"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["light"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["light"]["dark"]);
|
|
28972
|
-
theme["light"]["bg-secondary-gradient-top-left"] = "bg-gradient-to-tl from-".concat(theme.secondary, "-").concat(variants["light"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["light"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["light"]["dark"]);
|
|
28973
|
-
theme["light"]["bg-secondary-gradient-bottom-left"] = "bg-gradient-to-bl from-".concat(theme.secondary, "-").concat(variants["light"]["medium"], " via-").concat(theme.secondary, "-").concat(variants["light"]["medium"], " to-").concat(theme.secondary, "-").concat(variants["light"]["dark"]);
|
|
28974
|
-
|
|
28975
|
-
// Tertiary
|
|
28976
|
-
|
|
28977
|
-
theme["dark"]["bg-tertiary-gradient-right"] = "bg-gradient-to-r from-".concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["dark"]["dark"]);
|
|
28978
|
-
theme["dark"]["bg-tertiary-gradient-bottom"] = "bg-gradient-to-b from-".concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["dark"]["dark"]);
|
|
28979
|
-
theme["dark"]["bg-tertiary-gradient-bottom-right"] = "bg-gradient-to-br from-".concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["dark"]["dark"]);
|
|
28980
|
-
theme["dark"]["bg-tertiary-gradient-bottom-left"] = "bg-gradient-to-bl from-".concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["dark"]["dark"]);
|
|
28981
|
-
theme["dark"]["bg-tertiary-gradient-left"] = "bg-gradient-to-l from-".concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["dark"]["dark"]);
|
|
28982
|
-
theme["dark"]["bg-tertiary-gradient-top"] = "bg-gradient-to-t from-".concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["dark"]["dark"]);
|
|
28983
|
-
theme["dark"]["bg-tertiary-gradient-top-right"] = "bg-gradient-to-tr from-".concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["dark"]["dark"]);
|
|
28984
|
-
theme["dark"]["bg-tertiary-gradient-top-left"] = "bg-gradient-to-tl from-".concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["dark"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["dark"]["dark"]);
|
|
28985
|
-
theme["light"]["bg-tertiary-gradient-right"] = "bg-gradient-to-r from-".concat(theme.tertiary, "-").concat(variants["light"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["light"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["light"]["dark"]);
|
|
28986
|
-
theme["light"]["bg-tertiary-gradient-bottom"] = "bg-gradient-to-b from-".concat(theme.tertiary, "-").concat(variants["light"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["light"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["light"]["dark"]);
|
|
28987
|
-
theme["light"]["bg-tertiary-gradient-left"] = "bg-gradient-to-l from-".concat(theme.tertiary, "-").concat(variants["light"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["light"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["light"]["dark"]);
|
|
28988
|
-
theme["light"]["bg-tertiary-gradient-top"] = "bg-gradient-to-t from-".concat(theme.tertiary, "-").concat(variants["light"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["light"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["light"]["dark"]);
|
|
28989
|
-
theme["light"]["bg-tertiary-gradient-top-right"] = "bg-gradient-to-tr from-".concat(theme.tertiary, "-").concat(variants["light"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["light"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["light"]["dark"]);
|
|
28990
|
-
theme["light"]["bg-tertiary-gradient-bottom-right"] = "bg-gradient-to-br from-".concat(theme.tertiary, "-").concat(variants["light"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["light"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["light"]["dark"]);
|
|
28991
|
-
theme["light"]["bg-tertiary-gradient-top-left"] = "bg-gradient-to-tl from-".concat(theme.tertiary, "-").concat(variants["light"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["light"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["light"]["dark"]);
|
|
28992
|
-
theme["light"]["bg-tertiary-gradient-bottom-left"] = "bg-gradient-to-bl from-".concat(theme.tertiary, "-").concat(variants["light"]["medium"], " via-").concat(theme.tertiary, "-").concat(variants["light"]["medium"], " to-").concat(theme.tertiary, "-").concat(variants["light"]["dark"]);
|
|
28992
|
+
// Gradients — primary/secondary/tertiary, 8 directions × 2 variants.
|
|
28993
|
+
// Each gradient goes from the variant's medium shade via medium to dark.
|
|
28994
|
+
// For hex channels, the gradient stops use `from-[var(--type-shade)]` etc.
|
|
28995
|
+
var gradientDirs = {
|
|
28996
|
+
right: "r",
|
|
28997
|
+
bottom: "b",
|
|
28998
|
+
"bottom-right": "br",
|
|
28999
|
+
"bottom-left": "bl",
|
|
29000
|
+
left: "l",
|
|
29001
|
+
top: "t",
|
|
29002
|
+
"top-right": "tr",
|
|
29003
|
+
"top-left": "tl"
|
|
29004
|
+
};
|
|
29005
|
+
["primary", "secondary", "tertiary"].forEach(function (type) {
|
|
29006
|
+
var channelValue = theme[type];
|
|
29007
|
+
Object.keys(variants).forEach(function (variant) {
|
|
29008
|
+
var fromShade = variants[variant]["medium"];
|
|
29009
|
+
var viaShade = variants[variant]["medium"];
|
|
29010
|
+
var toShade = variants[variant]["dark"];
|
|
29011
|
+
Object.entries(gradientDirs).forEach(function (_ref) {
|
|
29012
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
29013
|
+
suffix = _ref2[0],
|
|
29014
|
+
dirCode = _ref2[1];
|
|
29015
|
+
theme[variant]["bg-".concat(type, "-gradient-").concat(suffix)] = gradientFor(dirCode, type, fromShade, viaShade, toShade, channelValue);
|
|
29016
|
+
});
|
|
29017
|
+
});
|
|
29018
|
+
});
|
|
28993
29019
|
|
|
28994
29020
|
// now for the overrides!
|
|
28995
29021
|
if (overrideDark !== null) {
|
|
@@ -29023,9 +29049,40 @@ var ThemeModel = function ThemeModel() {
|
|
|
29023
29049
|
// Added outside the variant loop to avoid generating invalid text/border
|
|
29024
29050
|
// classes (invert(950) would be negative).
|
|
29025
29051
|
colorTypes.forEach(function (type) {
|
|
29026
|
-
|
|
29027
|
-
theme["
|
|
29052
|
+
var channelValue = theme[type];
|
|
29053
|
+
theme["dark"]["bg-".concat(type, "-darkest")] = classFor("bg", type, 950, channelValue);
|
|
29054
|
+
theme["dark"].cssValue["bg-".concat(type, "-darkest")] = cssValueFor(type, 950, channelValue);
|
|
29055
|
+
theme["light"]["bg-".concat(type, "-darkest")] = classFor("bg", type, 50, channelValue);
|
|
29056
|
+
theme["light"].cssValue["bg-".concat(type, "-darkest")] = cssValueFor(type, 50, channelValue);
|
|
29057
|
+
});
|
|
29058
|
+
|
|
29059
|
+
// Accumulate CSS custom properties for any hex-color channels.
|
|
29060
|
+
// ThemePreviewProvider reads `currentTheme.cssVars` and writes
|
|
29061
|
+
// these to `document.documentElement.style` on theme activation
|
|
29062
|
+
// (PRD `arbitrary-color-themes.md` FR-003).
|
|
29063
|
+
var cssVarsAll = {};
|
|
29064
|
+
var hasAnyHex = false;
|
|
29065
|
+
colorTypes.forEach(function (type) {
|
|
29066
|
+
var channelValue = theme[type];
|
|
29067
|
+
if (isHexColor(channelValue)) {
|
|
29068
|
+
hasAnyHex = true;
|
|
29069
|
+
var shades = deriveShades(channelValue);
|
|
29070
|
+
if (shades) {
|
|
29071
|
+
for (var _i = 0, _Object$entries = Object.entries(shades); _i < _Object$entries.length; _i++) {
|
|
29072
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
29073
|
+
shade = _Object$entries$_i[0],
|
|
29074
|
+
hex = _Object$entries$_i[1];
|
|
29075
|
+
cssVarsAll["--".concat(type, "-").concat(shade)] = hex;
|
|
29076
|
+
}
|
|
29077
|
+
}
|
|
29078
|
+
}
|
|
29028
29079
|
});
|
|
29080
|
+
if (hasAnyHex) {
|
|
29081
|
+
// Attach to both variants so whichever is active on theme switch
|
|
29082
|
+
// delivers the same CSS variable set to :root.
|
|
29083
|
+
theme["dark"].cssVars = cssVarsAll;
|
|
29084
|
+
theme["light"].cssVars = cssVarsAll;
|
|
29085
|
+
}
|
|
29029
29086
|
|
|
29030
29087
|
// transparent colors
|
|
29031
29088
|
theme["dark"]["bg-none"] = "bg-transparent";
|
|
@@ -29038,6 +29095,17 @@ var ThemeModel = function ThemeModel() {
|
|
|
29038
29095
|
theme["light"]["hover-border-none"] = "hover:border-transparent";
|
|
29039
29096
|
theme["light"]["hover-bg-none"] = "hover:bg-transparent";
|
|
29040
29097
|
theme["light"]["hover-text-none"] = "hover:text-transparent";
|
|
29098
|
+
|
|
29099
|
+
// Mirror the transparent tokens into cssValue so inline-style
|
|
29100
|
+
// consumers can read borderless/transparent surfaces from the
|
|
29101
|
+
// same map as colored ones.
|
|
29102
|
+
["dark", "light"].forEach(function (variant) {
|
|
29103
|
+
theme[variant].cssValue["bg-none"] = "transparent";
|
|
29104
|
+
theme[variant].cssValue["border-none"] = "transparent";
|
|
29105
|
+
theme[variant].cssValue["hover-bg-none"] = "transparent";
|
|
29106
|
+
theme[variant].cssValue["hover-border-none"] = "transparent";
|
|
29107
|
+
theme[variant].cssValue["hover-text-none"] = "transparent";
|
|
29108
|
+
});
|
|
29041
29109
|
return theme;
|
|
29042
29110
|
} catch (e) {
|
|
29043
29111
|
return {};
|