@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.esm.js +46 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +45 -0
- 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, isHexColor, deriveShades, 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';
|
|
@@ -28880,6 +28880,29 @@ function classFor(prefix, type, shade, channelValue) {
|
|
|
28880
28880
|
}
|
|
28881
28881
|
return "".concat(h).concat(prefix, "-").concat(channelValue, "-").concat(shade);
|
|
28882
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
|
+
}
|
|
28883
28906
|
function gradientFor(direction, type, fromShade, viaShade, toShade, channelValue) {
|
|
28884
28907
|
if (isHexColor(channelValue)) {
|
|
28885
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, ")]");
|
|
@@ -28942,17 +28965,26 @@ var ThemeModel = function ThemeModel() {
|
|
|
28942
28965
|
if (variant in theme === false) {
|
|
28943
28966
|
theme[variant] = {};
|
|
28944
28967
|
}
|
|
28968
|
+
if (!theme[variant].cssValue) {
|
|
28969
|
+
theme[variant].cssValue = {};
|
|
28970
|
+
}
|
|
28945
28971
|
Object.keys(variants[variant]).forEach(function (shade) {
|
|
28946
28972
|
var numShade = variants[variant][shade];
|
|
28947
28973
|
var hoverShade = getNextLevel(numShade);
|
|
28948
28974
|
var textShade = invert(numShade);
|
|
28949
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);
|
|
28950
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);
|
|
28951
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);
|
|
28952
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);
|
|
28953
28983
|
// we should be "flipping" these so dark text on light and light on dark...
|
|
28954
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);
|
|
28955
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);
|
|
28956
28988
|
});
|
|
28957
28989
|
});
|
|
28958
28990
|
});
|
|
@@ -29019,7 +29051,9 @@ var ThemeModel = function ThemeModel() {
|
|
|
29019
29051
|
colorTypes.forEach(function (type) {
|
|
29020
29052
|
var channelValue = theme[type];
|
|
29021
29053
|
theme["dark"]["bg-".concat(type, "-darkest")] = classFor("bg", type, 950, channelValue);
|
|
29054
|
+
theme["dark"].cssValue["bg-".concat(type, "-darkest")] = cssValueFor(type, 950, channelValue);
|
|
29022
29055
|
theme["light"]["bg-".concat(type, "-darkest")] = classFor("bg", type, 50, channelValue);
|
|
29056
|
+
theme["light"].cssValue["bg-".concat(type, "-darkest")] = cssValueFor(type, 50, channelValue);
|
|
29023
29057
|
});
|
|
29024
29058
|
|
|
29025
29059
|
// Accumulate CSS custom properties for any hex-color channels.
|
|
@@ -29061,6 +29095,17 @@ var ThemeModel = function ThemeModel() {
|
|
|
29061
29095
|
theme["light"]["hover-border-none"] = "hover:border-transparent";
|
|
29062
29096
|
theme["light"]["hover-bg-none"] = "hover:bg-transparent";
|
|
29063
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
|
+
});
|
|
29064
29109
|
return theme;
|
|
29065
29110
|
} catch (e) {
|
|
29066
29111
|
return {};
|