@docsplain-kit/core 0.0.56 → 0.0.58

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/README.md CHANGED
@@ -62,3 +62,39 @@ export default function Page() {
62
62
  ```
63
63
 
64
64
  📖 **See [SERVER_COMPONENTS.md](./SERVER_COMPONENTS.md) for a complete guide** with examples, best practices, and troubleshooting.
65
+
66
+ ---
67
+
68
+ ## 🎨 **Theme-Aware Div Colors**
69
+
70
+ `Div` supports `bgColor` and `borderColor` props. Pass Tailwind color tokens without the utility prefix:
71
+
72
+ ```tsx
73
+ <Div bgColor="control-50" borderColor="control-200" />
74
+ ```
75
+
76
+ The dark-mode color is generated by `withUiKit`. Numeric shades reverse automatically, so `control-50` becomes `control-950`.
77
+
78
+ You can override any reverse color from `tailwind.config.js`:
79
+
80
+ ```js
81
+ const withUiKit = require('@docsplain-kit/core/withUiKit');
82
+
83
+ module.exports = withUiKit({
84
+ content: ['./src/**/*.{js,ts,jsx,tsx}'],
85
+ theme: { extend: {} },
86
+ plugins: [],
87
+ uiKit: {
88
+ reverseColors: {
89
+ bg: {
90
+ white: 'control-800',
91
+ },
92
+ border: {
93
+ white: 'control-700',
94
+ },
95
+ },
96
+ },
97
+ });
98
+ ```
99
+
100
+ Use a top-level key such as `white: 'control-800'` when the same reverse color should apply to both `bgColor` and `borderColor`.
package/div/div.js CHANGED
@@ -5,9 +5,10 @@ exports.Div = void 0;
5
5
  var tslib_1 = require("tslib");
6
6
  var react_1 = tslib_1.__importStar(require("react"));
7
7
  var tailwind_merge_config_1 = require("../tailwind-merge-config");
8
+ var color_class_1 = require("../theme/color-class");
8
9
  exports.Div = (0, react_1.forwardRef)(function Div(props, ref) {
9
- var children = props.children, style = props.style, onClick = props.onClick, dangerouslySetInnerHTML = props.dangerouslySetInnerHTML, dataTestId = props.dataTestId, role = props.role, className = props.className, id = props.id, onMouseOver = props.onMouseOver, onMouseLeave = props.onMouseLeave, rest = tslib_1.__rest(props, ["children", "style", "onClick", "dangerouslySetInnerHTML", "dataTestId", "role", "className", "id", "onMouseOver", "onMouseLeave"]);
10
- return (react_1["default"].createElement("div", tslib_1.__assign({ "data-testid": dataTestId, id: id, role: role, className: (0, tailwind_merge_config_1.twMerge)("flex flex-row", className), dangerouslySetInnerHTML: dangerouslySetInnerHTML, onClick: onClick, style: style, ref: ref, onMouseOver: onMouseOver, onMouseLeave: onMouseLeave }, rest), children));
10
+ var children = props.children, style = props.style, onClick = props.onClick, dangerouslySetInnerHTML = props.dangerouslySetInnerHTML, dataTestId = props.dataTestId, role = props.role, className = props.className, id = props.id, onMouseOver = props.onMouseOver, onMouseLeave = props.onMouseLeave, bgColor = props.bgColor, borderColor = props.borderColor, rest = tslib_1.__rest(props, ["children", "style", "onClick", "dangerouslySetInnerHTML", "dataTestId", "role", "className", "id", "onMouseOver", "onMouseLeave", "bgColor", "borderColor"]);
11
+ return (react_1["default"].createElement("div", tslib_1.__assign({ "data-testid": dataTestId, id: id, role: role, className: (0, tailwind_merge_config_1.twMerge)('flex flex-row', (0, color_class_1.getColorClass)('bg', bgColor), (0, color_class_1.getColorClass)('border', borderColor), className), dangerouslySetInnerHTML: dangerouslySetInnerHTML, onClick: onClick, style: style, ref: ref, onMouseOver: onMouseOver, onMouseLeave: onMouseLeave }, rest), children));
11
12
  });
12
13
  exports["default"] = exports.Div;
13
14
  //# sourceMappingURL=div.js.map
package/div/div.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"div.js","sourceRoot":"","sources":["../../div/div.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAEb,qDAA0C;AAE1C,kEAAmD;AAEtC,QAAA,GAAG,GAAG,IAAA,kBAAU,EAAgB,SAAS,GAAG,CAAC,KAAK,EAAE,GAAG;IAC1D,IAAA,QAAQ,GAAmH,KAAK,SAAxH,EAAE,KAAK,GAA4G,KAAK,MAAjH,EAAE,OAAO,GAAmG,KAAK,QAAxG,EAAE,uBAAuB,GAA0E,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Ac,KAAK,YAAnB,EAAK,IAAI,kBAAK,KAAK,EAAxJ,6JAAgJ,CAAF,CAAW;IAE/J,OAAO,CACL,0EACe,UAAU,EACvB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,IAAA,+BAAO,EAChB,eAAe,EACf,IAAA,2BAAa,EAAC,IAAI,EAAE,OAAO,CAAC,EAC5B,IAAA,2BAAa,EAAC,QAAQ,EAAE,WAAW,CAAC,EACpC,SAAS,CACV,EACD,uBAAuB,EAAE,uBAAuB,EAChD,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,IACtB,IAAI,GAEP,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAe,WAAG,CAAC"}
@@ -5,6 +5,8 @@ export interface DivProps {
5
5
  itemProp?: string;
6
6
  children?: ReactNode;
7
7
  className?: string | undefined;
8
+ bgColor?: string;
9
+ borderColor?: string;
8
10
  style?: CSSProperties | undefined;
9
11
  dangerouslySetInnerHTML?: any;
10
12
  role?: string;
@@ -1,8 +1,4 @@
1
1
  import { Theme } from '../provider';
2
- /**
3
- * Get modal background color based on theme
4
- */
5
- export declare const getModalBackground: (theme: Theme) => string;
6
2
  /**
7
3
  * Get modal backdrop color based on theme
8
4
  */
@@ -1,13 +1,6 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- exports.getModalSecondaryTextColor = exports.getModalTextColor = exports.getModalBackdrop = exports.getModalBackground = void 0;
4
- /**
5
- * Get modal background color based on theme
6
- */
7
- var getModalBackground = function (theme) {
8
- return theme === 'dark' ? 'bg-gray-900' : 'bg-white';
9
- };
10
- exports.getModalBackground = getModalBackground;
3
+ exports.getModalSecondaryTextColor = exports.getModalTextColor = exports.getModalBackdrop = void 0;
11
4
  /**
12
5
  * Get modal backdrop color based on theme
13
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"modal-theme.js","sourceRoot":"","sources":["../../modal/modal-theme.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACI,IAAM,kBAAkB,GAAG,UAAC,KAAY;IAC7C,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC;AACvD,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B;AAEF;;GAEG;AACI,IAAM,gBAAgB,GAAG,UAAC,KAAY;IAC3C,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAC7D,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AAEF;;GAEG;AACI,IAAM,iBAAiB,GAAG,UAAC,KAAY;IAC5C,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;AAC9D,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAEF;;GAEG;AACI,IAAM,0BAA0B,GAAG,UAAC,KAAY;IACrD,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;AAC9D,CAAC,CAAC;AAFW,QAAA,0BAA0B,8BAErC"}
1
+ {"version":3,"file":"modal-theme.js","sourceRoot":"","sources":["../../modal/modal-theme.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACI,IAAM,gBAAgB,GAAG,UAAC,KAAY;IAC3C,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAC7D,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AAEF;;GAEG;AACI,IAAM,iBAAiB,GAAG,UAAC,KAAY;IAC5C,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;AAC9D,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAEF;;GAEG;AACI,IAAM,0BAA0B,GAAG,UAAC,KAAY;IACrD,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;AAC9D,CAAC,CAAC;AAFW,QAAA,0BAA0B,8BAErC"}
package/modal/modal.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ModalProps } from './modal.props';
3
- export declare const Modal: ({ open, position, children, onClose, className, wrapperClassName }: ModalProps) => React.JSX.Element | null;
3
+ export declare const Modal: ({ open, position, children, onClose, className, wrapperClassName, bgColor }: ModalProps) => React.JSX.Element | null;
4
4
  export default Modal;
package/modal/modal.js CHANGED
@@ -7,6 +7,7 @@ var react_1 = tslib_1.__importStar(require("react"));
7
7
  var div_1 = tslib_1.__importDefault(require("../div"));
8
8
  var react_2 = require("motion/react");
9
9
  var tailwind_merge_config_1 = require("../tailwind-merge-config");
10
+ var color_class_1 = require("../theme/color-class");
10
11
  var modal_theme_1 = require("./modal-theme");
11
12
  var SafeAnimatePresence = function (_a) {
12
13
  var children = _a.children;
@@ -22,7 +23,7 @@ catch (_a) {
22
23
  // Provider not available, use default
23
24
  }
24
25
  var Modal = function (_a) {
25
- var open = _a.open, _b = _a.position, position = _b === void 0 ? 'float' : _b, children = _a.children, onClose = _a.onClose, className = _a.className, wrapperClassName = _a.wrapperClassName;
26
+ var open = _a.open, _b = _a.position, position = _b === void 0 ? 'float' : _b, children = _a.children, onClose = _a.onClose, className = _a.className, wrapperClassName = _a.wrapperClassName, _c = _a.bgColor, bgColor = _c === void 0 ? 'bg-whtie' : _c;
26
27
  var escFunction = (0, react_1.useCallback)(function (event) {
27
28
  if (event.key === 'Escape' && typeof onClose === 'function') {
28
29
  event.preventDefault();
@@ -50,18 +51,18 @@ var Modal = function (_a) {
50
51
  try {
51
52
  theme = useThemeSafe();
52
53
  }
53
- catch (_c) {
54
+ catch (_d) {
54
55
  // Not in provider, use default
55
56
  }
56
57
  if (position === 'float') {
57
58
  return (react_1["default"].createElement(SafeAnimatePresence, null, open && (react_1["default"].createElement(react_2.motion.div, { key: "float", exit: { opacity: 0, transition: { duration: 0.6 } }, initial: { opacity: 0 }, animate: { opacity: 100, transition: { duration: 0.2 } }, className: (0, tailwind_merge_config_1.twMerge)("flex justify-center items-center backdrop-blur-sm fixed top-0 left-0 right-0 z-[1300] w-full h-dvh", (0, modal_theme_1.getModalBackdrop)(theme), className) },
58
59
  react_1["default"].createElement(div_1["default"], { className: "-z-10 w-screen h-dvh absolute", onClick: onClose }),
59
- react_1["default"].createElement(react_2.motion.div, { className: (0, tailwind_merge_config_1.twMerge)('relative w-11/12 md:w-2/3 md:max-w-[800px] md:h-auto h-3/4 z-40 rounded-lg md:p-6 pt-2 px-2 pb-0 flex flex-col justify-center items-center self-center gap-8', (0, modal_theme_1.getModalBackground)(theme), wrapperClassName), exit: { translateY: 2000, transition: { duration: 0.6 } }, initial: { translateY: 2000 }, animate: { translateY: 0, transition: { duration: 0.5 } } }, children)))));
60
+ react_1["default"].createElement(react_2.motion.div, { className: (0, tailwind_merge_config_1.twMerge)('relative w-11/12 md:w-2/3 md:max-w-[800px] md:h-auto h-3/4 z-40 rounded-lg md:p-6 pt-2 px-2 pb-0 flex flex-col justify-center items-center self-center gap-8', (0, color_class_1.getColorClass)('bg', bgColor), wrapperClassName), exit: { translateY: 2000, transition: { duration: 0.6 } }, initial: { translateY: 2000 }, animate: { translateY: 0, transition: { duration: 0.5 } } }, children)))));
60
61
  }
61
62
  if (position === 'bottom') {
62
63
  return (react_1["default"].createElement(SafeAnimatePresence, null, open && (react_1["default"].createElement(react_2.motion.div, { key: "bottom", exit: { opacity: 0, transition: { duration: 0.6 } }, initial: { opacity: 0 }, animate: { opacity: 100, transition: { duration: 0.2 } }, className: (0, tailwind_merge_config_1.twMerge)("flex w-full h-dvh justify-center backdrop-blur-sm fixed top-0 left-0 right-0 z-[1300] items-end", (0, modal_theme_1.getModalBackdrop)(theme), className) },
63
64
  react_1["default"].createElement(div_1["default"], { onClick: onClose, className: '-z-10 w-screen h-dvh absolute' }),
64
- react_1["default"].createElement(react_2.motion.div, { exit: { translateY: 2000, transition: { duration: 0.6 } }, initial: { translateY: 2000 }, animate: { translateY: 0, transition: { duration: 0.5 } }, className: (0, tailwind_merge_config_1.twMerge)('w-full h-auto rounded-tr-2xl rounded-tl-2xl justify-center overflow-hidden', (0, modal_theme_1.getModalBackground)(theme), wrapperClassName) }, children)))));
65
+ react_1["default"].createElement(react_2.motion.div, { exit: { translateY: 2000, transition: { duration: 0.6 } }, initial: { translateY: 2000 }, animate: { translateY: 0, transition: { duration: 0.5 } }, className: (0, tailwind_merge_config_1.twMerge)('w-full h-auto rounded-tr-2xl rounded-tl-2xl justify-center overflow-hidden', (0, color_class_1.getColorClass)('bg', bgColor), wrapperClassName) }, children)))));
65
66
  }
66
67
  return null;
67
68
  };
@@ -1 +1 @@
1
- {"version":3,"file":"modal.js","sourceRoot":"","sources":["../../modal/modal.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAEb,qDAAsD;AAEtD,uDAAyB;AACzB,sCAAuD;AACvD,kEAAmD;AACnD,6CAGuB;AAEvB,IAAM,mBAAmB,GAAG,UAAC,EAA2C;QAAzC,QAAQ,cAAA;IACrC,aAAa;IACb,OAAO,iCAAC,uBAAe,QAAE,QAAQ,CAAyC,CAAC;AAC7E,CAAC,CAAC;AAEF,IAAI,YAAY,GAA2B,cAAM,OAAA,OAAO,EAAP,CAAO,CAAC;AACzD,IAAI;IACM,IAAA,QAAQ,GAAK,OAAO,CAAC,aAAa,CAAC,SAA3B,CAA4B;IAC5C,YAAY,GAAG,QAAQ,CAAC;CACzB;AAAC,WAAM;IACN,sCAAsC;CACvC;AAEM,IAAM,KAAK,GAAG,UAAC,EAAwF;QAAtF,IAAI,UAAA,EAAE,gBAAkB,EAAlB,QAAQ,mBAAG,OAAO,KAAA,EAAE,QAAQ,cAAA,EAAE,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
  "module": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { PopperContentProps } from './popper-content.props';
3
3
  declare const PopperContent: {
4
- ({ className, children, ref }: PopperContentProps): React.JSX.Element;
4
+ ({ className, children, ref, bgColor, borderColor }: PopperContentProps): React.JSX.Element;
5
5
  displayName: string;
6
6
  };
7
7
  export default PopperContent;
@@ -4,27 +4,9 @@ var tslib_1 = require("tslib");
4
4
  var react_1 = tslib_1.__importDefault(require("react"));
5
5
  var div_1 = tslib_1.__importDefault(require("../../div"));
6
6
  var tailwind_merge_config_1 = require("../../tailwind-merge-config");
7
- var popper_theme_1 = require("../popper-theme");
8
- // Try to import the theme provider, but make it optional
9
- var useThemeSafe = function () { return 'light'; };
10
- try {
11
- var useTheme = require('../../provider').useTheme;
12
- useThemeSafe = useTheme;
13
- }
14
- catch (_a) {
15
- // Provider not available, use default
16
- }
17
7
  var PopperContent = function (_a) {
18
- var className = _a.className, children = _a.children, ref = _a.ref;
19
- // Try to get theme from provider, fallback to 'light'
20
- var theme = 'light';
21
- try {
22
- theme = useThemeSafe();
23
- }
24
- catch (_b) {
25
- // Not in provider, use default
26
- }
27
- return (react_1["default"].createElement(div_1["default"], { ref: ref, className: (0, tailwind_merge_config_1.twMerge)('h-auto w-full rounded-lg shadow-lg', (0, popper_theme_1.getPopperBackground)(theme), (0, popper_theme_1.getPopperBorder)(theme), 'border', className) }, children));
8
+ var className = _a.className, children = _a.children, ref = _a.ref, _b = _a.bgColor, bgColor = _b === void 0 ? 'bg-white' : _b, _c = _a.borderColor, borderColor = _c === void 0 ? 'border-control-200' : _c;
9
+ return (react_1["default"].createElement(div_1["default"], { ref: ref, bgColor: bgColor, borderColor: borderColor, className: (0, tailwind_merge_config_1.twMerge)('h-auto w-full rounded-lg shadow-lg border', className) }, children));
28
10
  };
29
11
  PopperContent.displayName = 'PopperContent';
30
12
  exports["default"] = PopperContent;
@@ -1 +1 @@
1
- {"version":3,"file":"popper-content.js","sourceRoot":"","sources":["../../../popper/popper-content/popper-content.tsx"],"names":[],"mappings":";;;AAAA,wDAA0B;AAE1B,0DAA4B;AAC5B,qEAAsD;AACtD,gDAGyB;AAEzB,yDAAyD;AACzD,IAAI,YAAY,GAA2B,cAAM,OAAA,OAAO,EAAP,CAAO,CAAC;AACzD,IAAI;IACM,IAAA,QAAQ,GAAK,OAAO,CAAC,gBAAgB,CAAC,SAA9B,CAA+B;IAC/C,YAAY,GAAG,QAAQ,CAAC;CACzB;AAAC,WAAM;IACN,sCAAsC;CACvC;AAED,IAAM,aAAa,GAAG,UAAC,EAAgD;QAA9C,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAE,GAAG,SAAA;IAC/C,sDAAsD;IACtD,IAAI,KAAK,GAAqB,OAAO,CAAC;IACtC,IAAI;QACF,KAAK,GAAG,YAAY,EAAE,CAAC;KACxB;IAAC,WAAM;QACN,+BAA+B;KAChC;IAED,OAAO,CACL,iCAAC,gBAAG,IACF,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,+BAAO,EAChB,oCAAoC,EACpC,IAAA,kCAAmB,EAAC,KAAK,CAAC,EAC1B,IAAA,8BAAe,EAAC,KAAK,CAAC,EACtB,QAAQ,EACR,SAAS,CACV,IAEA,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC;AAE5C,qBAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"popper-content.js","sourceRoot":"","sources":["../../../popper/popper-content/popper-content.tsx"],"names":[],"mappings":";;;AAAA,wDAA0B;AAE1B,0DAA4B;AAC5B,qEAAsD;AAEtD,IAAM,aAAa,GAAG,UAAC,EAA0G;QAAxG,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAE,GAAG,SAAA,EAAE,eAAoB,EAApB,OAAO,mBAAG,UAAU,KAAA,EAAE,mBAAkC,EAAlC,WAAW,mBAAG,oBAAoB,KAAA;IACzG,OAAO,CACL,iCAAC,gBAAG,IACF,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,IAAA,+BAAO,EAChB,2CAA2C,EAC3C,SAAS,CACV,IAEA,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC;AAE5C,qBAAe,aAAa,CAAC"}
@@ -3,4 +3,6 @@ export interface PopperContentProps {
3
3
  className?: string;
4
4
  children: ReactNode;
5
5
  ref?: any;
6
+ bgColor?: string;
7
+ borderColor?: string;
6
8
  }
@@ -1,12 +1,4 @@
1
1
  import { Theme } from '../provider';
2
- /**
3
- * Get popper content background color based on theme
4
- */
5
- export declare const getPopperBackground: (theme: Theme) => string;
6
- /**
7
- * Get popper content border color based on theme
8
- */
9
- export declare const getPopperBorder: (theme: Theme) => string;
10
2
  /**
11
3
  * Get popper content text color based on theme
12
4
  */
@@ -1,20 +1,6 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- exports.getPopperHoverBackground = exports.getPopperSecondaryTextColor = exports.getPopperTextColor = exports.getPopperBorder = exports.getPopperBackground = void 0;
4
- /**
5
- * Get popper content background color based on theme
6
- */
7
- var getPopperBackground = function (theme) {
8
- return theme === 'dark' ? 'bg-gray-800' : 'bg-white';
9
- };
10
- exports.getPopperBackground = getPopperBackground;
11
- /**
12
- * Get popper content border color based on theme
13
- */
14
- var getPopperBorder = function (theme) {
15
- return theme === 'dark' ? 'border-gray-700' : 'border-gray-200';
16
- };
17
- exports.getPopperBorder = getPopperBorder;
3
+ exports.getPopperHoverBackground = exports.getPopperSecondaryTextColor = exports.getPopperTextColor = void 0;
18
4
  /**
19
5
  * Get popper content text color based on theme
20
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"popper-theme.js","sourceRoot":"","sources":["../../popper/popper-theme.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACI,IAAM,mBAAmB,GAAG,UAAC,KA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,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;AAC9D,CAAC,CAAC;AAFW,QAAA,2BAA2B,+BAEtC;AAEF;;GAEG;AACI,IAAM,wBAAwB,GAAG,UAAC,KAAY;IACnD,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC;AACtE,CAAC,CAAC;AAFW,QAAA,wBAAwB,4BAEnC"}
@@ -0,0 +1 @@
1
+ export declare const getColorClass: (type: 'bg' | 'border', color?: string) => string | undefined;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.getColorClass = void 0;
4
+ var normalizeColorToken = function (color) {
5
+ if (!color) {
6
+ return undefined;
7
+ }
8
+ return color
9
+ .trim()
10
+ .replace(/^!?(bg|border)-/, '')
11
+ .replace(/./g, '-');
12
+ };
13
+ var getColorClass = function (type, color) {
14
+ var colorToken = normalizeColorToken(color);
15
+ if (!colorToken) {
16
+ return undefined;
17
+ }
18
+ return type === 'bg'
19
+ ? "bg-[var(--dpc-bg-color)] dpc-bg-".concat(colorToken)
20
+ : "border-[var(--dpc-border-color)] dpc-border-".concat(colorToken);
21
+ };
22
+ exports.getColorClass = getColorClass;
23
+ //# sourceMappingURL=color-class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-class.js","sourceRoot":"","sources":["../../theme/color-class.ts"],"names":[],"mappings":";;;AAAA,IAAM,mBAAmB,GAAG,UAAC,KAAc;IACzC,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,KAAK;SACT,IAAI,EAAE;SACN,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;SAC9B,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACxB,CAAC,CAAC;AAEK,IAAM,aAAa,GAAG,UAAC,IAAqB,EAAE,KAAc;IACjE,IAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAE9C,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,IAAI,KAAK,IAAI;QAClB,CAAC,CAAC,0CAAmC,UAAU,CAAE;QACjD,CAAC,CAAC,sDAA+C,UAAU,CAAE,CAAC;AAClE,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB"}
package/withUiKit.js CHANGED
@@ -10,15 +10,209 @@ const { lineHeights } = require('./config/typography/line-heights');
10
10
  const { fontFamily } = require('./config/typography/font-family');
11
11
  const { widthHeight } = require('./config/width-height');
12
12
 
13
- const withUiKit = (tailwindConfig) => {
13
+ const DEFAULT_REVERSE_COLOR_SHADES = {
14
+ 50: '950',
15
+ 100: '900',
16
+ 200: '800',
17
+ 300: '700',
18
+ 400: '600',
19
+ 500: '500',
20
+ 600: '400',
21
+ 700: '300',
22
+ 800: '200',
23
+ 900: '100',
24
+ 950: '50',
25
+ };
26
+
27
+ const DEPRECATED_TAILWIND_COLOR_KEYS = ['lightBlue', 'warmGray', 'trueGray', 'coolGray', 'blueGray'];
28
+
29
+ const UI_KIT_COLORS = {
30
+ 'transparent': 'transparent',
31
+ 'white': '#FFFFFF',
32
+ 'black': '#000000',
33
+ 'primary': {
34
+ ...primary,
35
+ light: primary['300'],
36
+ DEFAULT: primary['500'],
37
+ dark: primary['700'],
38
+ },
39
+ 'secondary': {
40
+ ...secondary,
41
+ light: secondary['300'],
42
+ DEFAULT: secondary['500'],
43
+ dark: secondary['700'],
44
+ },
45
+ 'info': {
46
+ ...info,
47
+ light: info['300'],
48
+ DEFAULT: info['500'],
49
+ dark: info['700'],
50
+ },
51
+ 'success': {
52
+ ...success,
53
+ light: success['300'],
54
+ DEFAULT: success['500'],
55
+ dark: success['700'],
56
+ },
57
+ 'warning': {
58
+ ...warning,
59
+ light: warning['300'],
60
+ DEFAULT: warning['500'],
61
+ dark: warning['700'],
62
+ },
63
+ 'danger': {
64
+ ...danger,
65
+ light: danger['300'],
66
+ DEFAULT: danger['500'],
67
+ dark: danger['700'],
68
+ },
69
+ 'control': {
70
+ ...control,
71
+ light: control['300'],
72
+ DEFAULT: control['500'],
73
+ dark: control['700'],
74
+ },
75
+ };
76
+
77
+ const normalizeColorToken = (color) => {
78
+ if (typeof color !== 'string') {
79
+ return color;
80
+ }
81
+
82
+ return color
83
+ .trim()
84
+ .replace(/^!?(bg|border)-/, '')
85
+ .replace(/\./g, '-');
86
+ };
87
+
88
+ const flattenColorPalette = (colors, prefix = '') => {
89
+ return Object.keys(colors || {}).reduce((result, key) => {
90
+ if (DEPRECATED_TAILWIND_COLOR_KEYS.includes(key)) {
91
+ return result;
92
+ }
93
+
94
+ const value = colors[key];
95
+
96
+ if (typeof value === 'string') {
97
+ const colorKey = key === 'DEFAULT' ? prefix : [prefix, key].filter(Boolean).join('-');
98
+
99
+ if (colorKey) {
100
+ result[colorKey] = value;
101
+ }
102
+
103
+ return result;
104
+ }
105
+
106
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
107
+ return Object.assign(result, flattenColorPalette(value, [prefix, key].filter(Boolean).join('-')));
108
+ }
109
+
110
+ return result;
111
+ }, {});
112
+ };
113
+
114
+ const getReverseColorToken = (token, type, reverseColors, colorMap) => {
115
+ const typeReverseColors = reverseColors && reverseColors[type];
116
+ const configuredReverseColor = (
117
+ typeReverseColors && typeReverseColors[token]
118
+ ) || (reverseColors && reverseColors[token]);
119
+
120
+ if (configuredReverseColor) {
121
+ return normalizeColorToken(configuredReverseColor);
122
+ }
123
+
124
+ if (token === 'white') {
125
+ return 'black';
126
+ }
127
+
128
+ if (token === 'black') {
129
+ return 'white';
130
+ }
131
+
132
+ const shadeMatch = token.match(/^(.*)-(\d{2,3})$/);
133
+
134
+ if (!shadeMatch) {
135
+ return token;
136
+ }
137
+
138
+ const [, colorName, shade] = shadeMatch;
139
+ const reverseShade = DEFAULT_REVERSE_COLOR_SHADES[shade];
140
+ const reverseToken = `${colorName}-${reverseShade}`;
141
+
142
+ return colorMap[reverseToken] ? reverseToken : token;
143
+ };
144
+
145
+ const createThemedColorUtilities = (reverseColors = {}) => {
146
+ return ({ addUtilities, theme, e }) => {
147
+ const colorMap = flattenColorPalette(theme('colors') || {});
148
+ const utilities = {};
149
+
150
+ Object.entries(colorMap).forEach(([token, value]) => {
151
+ const bgClassName = e(`dpc-bg-${token}`);
152
+ const borderClassName = e(`dpc-border-${token}`);
153
+ const reverseBgToken = getReverseColorToken(token, 'bg', reverseColors, colorMap);
154
+ const reverseBorderToken = getReverseColorToken(token, 'border', reverseColors, colorMap);
155
+ const reverseBgValue = colorMap[reverseBgToken] || value;
156
+ const reverseBorderValue = colorMap[reverseBorderToken] || value;
157
+
158
+ utilities[`.${bgClassName}`] = {
159
+ '--dpc-bg-color': value,
160
+ };
161
+ utilities[`.dark .${bgClassName}, [data-theme="dark"] .${bgClassName}, .${bgClassName}.dark, .${bgClassName}[data-theme="dark"]`] = {
162
+ '--dpc-bg-color': reverseBgValue,
163
+ };
164
+ utilities[`.${borderClassName}`] = {
165
+ '--dpc-border-color': value,
166
+ };
167
+ utilities[`.dark .${borderClassName}, [data-theme="dark"] .${borderClassName}, .${borderClassName}.dark, .${borderClassName}[data-theme="dark"]`] = {
168
+ '--dpc-border-color': reverseBorderValue,
169
+ };
170
+ });
171
+
172
+ addUtilities(utilities);
173
+ };
174
+ };
175
+
176
+ const getThemedColorSafelist = (tailwindConfig) => {
177
+ const tailwindTheme = tailwindConfig.theme || {};
178
+ const tailwindExtend = tailwindTheme.extend || {};
179
+ let tailwindDefaultColors = {};
180
+
181
+ try {
182
+ tailwindDefaultColors = require('tailwindcss/colors');
183
+ } catch {
184
+ tailwindDefaultColors = {};
185
+ }
186
+
187
+ const configuredColors = Object.assign(
188
+ {},
189
+ tailwindDefaultColors,
190
+ UI_KIT_COLORS,
191
+ tailwindTheme.colors || {},
192
+ tailwindExtend.colors || {},
193
+ );
194
+ const colorTokens = Object.keys(flattenColorPalette(configuredColors));
195
+
196
+ return colorTokens.flatMap((token) => [`dpc-bg-${token}`, `dpc-border-${token}`]);
197
+ };
198
+
199
+ const withUiKit = (tailwindConfig = {}) => {
200
+ const theme = tailwindConfig.theme || {};
201
+ const themeExtend = theme.extend || {};
202
+ const uiKit = tailwindConfig.uiKit || {};
203
+
14
204
  return {
15
205
  darkMode: 'selector',
206
+ safelist: [
207
+ ...(tailwindConfig.safelist || []),
208
+ ...getThemedColorSafelist(tailwindConfig),
209
+ ],
16
210
  content: [
17
211
  './node_modules/@docsplain-kit/core/**/*',
18
- ...tailwindConfig.content,
212
+ ...(tailwindConfig.content || []),
19
213
  ],
20
214
  theme: {
21
- ...tailwindConfig.theme,
215
+ ...theme,
22
216
  screens: {
23
217
  'sm': '640px',
24
218
  'md': '1024px',
@@ -34,87 +228,44 @@ const withUiKit = (tailwindConfig) => {
34
228
  'gt-xs': { 'min': '640px' },
35
229
  'gt-sm': { 'min': '1024px' },
36
230
  'gt-md': { 'min': '1200px' },
37
- ...tailwindConfig.theme.screens,
231
+ ...theme.screens,
38
232
  },
39
233
  fontSize: {
40
234
  ...fontSizes,
41
- ...tailwindConfig.theme.fontSize,
235
+ ...theme.fontSize,
42
236
  },
43
237
  fontFamily: {
44
238
  ...fontFamily,
45
- ...tailwindConfig.theme.fontFamily,
239
+ ...theme.fontFamily,
46
240
  },
47
241
  lineHeight: {
48
242
  ...lineHeights,
49
- ...tailwindConfig.theme.lineHeight,
243
+ ...theme.lineHeight,
50
244
  },
51
245
  minWidth: {
52
246
  ...widthHeight,
53
- ...tailwindConfig.theme.minWidth,
247
+ ...theme.minWidth,
54
248
  },
55
249
  minHeight: {
56
250
  ...widthHeight,
57
- ...tailwindConfig.theme.minHeight,
251
+ ...theme.minHeight,
58
252
  },
59
253
  extend: {
60
- ...tailwindConfig.theme.extend,
61
- colors: Object.assign({}, {
62
- 'transparent': 'transparent',
63
- 'white': '#FFFFFF',
64
- 'black': '#000000',
65
- 'primary': {
66
- ...primary,
67
- light: primary['300'],
68
- DEFAULT: primary['500'],
69
- dark: primary['700'],
70
- },
71
- 'secondary': {
72
- ...secondary,
73
- light: secondary['300'],
74
- DEFAULT: secondary['500'],
75
- dark: secondary['700'],
76
- },
77
- 'info': {
78
- ...info,
79
- light: info['300'],
80
- DEFAULT: info['500'],
81
- dark: info['700'],
82
- },
83
- 'success': {
84
- ...success,
85
- light: success['300'],
86
- DEFAULT: success['500'],
87
- dark: success['700'],
88
- },
89
- 'warning': {
90
- ...warning,
91
- light: warning['300'],
92
- DEFAULT: warning['500'],
93
- dark: warning['700'],
94
- },
95
- 'danger': {
96
- ...danger,
97
- light: danger['300'],
98
- DEFAULT: danger['500'],
99
- dark: danger['700'],
100
- },
101
- 'control': {
102
- ...control,
103
- light: control['300'],
104
- DEFAULT: control['500'],
105
- dark: control['700'],
106
- },
107
- }, tailwindConfig.theme.extend.colors),
254
+ ...themeExtend,
255
+ colors: Object.assign({}, UI_KIT_COLORS, themeExtend.colors),
108
256
  height: {
109
257
  'dvh': '100dvh',
258
+ ...themeExtend.height,
110
259
  },
111
260
  direction: {
112
261
  'inherit': 'inherit',
262
+ ...themeExtend.direction,
113
263
  },
114
264
  },
115
265
  },
116
266
  plugins: [
117
- ...tailwindConfig.plugins,
267
+ createThemedColorUtilities(uiKit.reverseColors || {}),
268
+ ...(tailwindConfig.plugins || []),
118
269
  ],
119
270
  };
120
271
  };