Comparing version 1.5.0 to 1.6.0
@@ -1,1 +0,1 @@ | ||
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const prefix_1=require("./utils/prefix"),isEmpty_1=require("./utils/isEmpty"),ligh_theme_1=require("./theme/ligh-theme"),var_theme_1=require("./theme/var-theme"),dark_theme_1=require("./theme/dark-theme"),plugin_1=__importDefault(require("tailwindcss/plugin")),fs_1=__importDefault(require("fs")),postcss_1=__importDefault(require("postcss")),postcss_js_1=__importDefault(require("postcss-js")),path_1=__importDefault(require("path")),default_schema_1=require("./colors/default-schema"),hexToRGB_1=require("./utils/hexToRGB"),extractNewVariables_1=require("./utils/extractNewVariables"),theme_1=require("./utils/theme"),theme_2=require("./utils/theme"),basePath=path_1.default.resolve(__dirname,path_1.default.join("..","css")),baseCSS=fs_1.default.readFileSync(basePath+"/base.css","utf-8"),componentsCSS=fs_1.default.readFileSync(basePath+"/components.css","utf-8"),utilitiesCSS=fs_1.default.readFileSync(basePath+"/utilities.css","utf-8"),config=plugin_1.default.withOptions((e=>({addBase:t,addComponents:s,addUtilities:a,theme:i,config:r})=>{var l,o,m,h;const _=postcss_1.default.parse(baseCSS),c=postcss_1.default.parse(componentsCSS),u=postcss_1.default.parse(utilitiesCSS),d=postcss_js_1.default.objectify(_),f=postcss_js_1.default.objectify(c),n=postcss_js_1.default.objectify(u),p=r("rippleui")||Object.assign({},e)||{},g=null===(l=p.themes)||void 0===l?void 0:l.find((e=>"light"===e.themeName)),b=null===(o=p.themes)||void 0===o?void 0:o.find((e=>"dark"===e.themeName)),j=(null===(m=p.themes)||void 0===m?void 0:m.filter((e=>"light"!==e.themeName&&"dark"!==e.themeName)))||[];let v={defaultStyle:null===(h=p.defaultStyle)||void 0===h||h,removeThemes:p.removeThemes||[],themes:[Object.assign({themeName:"light",colorScheme:"light"},g),Object.assign({themeName:"dark",colorScheme:"dark"},b),...j]};if((0,isEmpty_1.isValid)(v)){v.defaultStyle&&t({":root, [data-theme]":Object.assign({},default_schema_1.defaultSchema)});const e=v.themes||[],s=v.removeThemes||[],a=(0,theme_1.removeThemes)(s,e);a.length>0&&a.forEach((e=>{const s=(0,prefix_1.addPrefix)(Object.assign({},e.colors)),a=(0,hexToRGB_1.palleteToRGB)(s),i=Object.assign(Object.assign({},e),{colors:a});let r;r="light"===e.themeName?(0,theme_2.mergeNestedObjects)(ligh_theme_1.lightTheme,i):"dark"===e.themeName?(0,theme_2.mergeNestedObjects)(dark_theme_1.darkTheme,i):i;const l=(0,theme_1.createTheme)(r);t([...l])}))}t(d),s(f),a(n)}),(e=>{let t=Object.assign({},var_theme_1.varTheme.colors);if((0,isEmpty_1.isValid)(e)){const s=e.themes||[];null==s||s.forEach((e=>{if(null==e?void 0:e.colors){const s=(0,extractNewVariables_1.extractNewVariables)(var_theme_1.varTheme.colors,e.colors);t=Object.assign(Object.assign({},t),s)}}))}return{theme:{extend:{colors:Object.assign({},t)}}}}));module.exports=config; | ||
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const prefix_1=require("./utils/prefix"),isEmpty_1=require("./utils/isEmpty"),ligh_theme_1=require("./theme/ligh-theme"),var_theme_1=require("./theme/var-theme"),dark_theme_1=require("./theme/dark-theme"),plugin_1=__importDefault(require("tailwindcss/plugin")),fs_1=__importDefault(require("fs")),postcss_1=__importDefault(require("postcss")),postcss_js_1=__importDefault(require("postcss-js")),path_1=__importDefault(require("path")),default_schema_1=require("./colors/default-schema"),hexToRGB_1=require("./utils/hexToRGB"),extractNewVariables_1=require("./utils/extractNewVariables"),theme_1=require("./utils/theme"),theme_2=require("./utils/theme"),prefix_2=require("./prefix/prefix"),basePath=path_1.default.resolve(__dirname,path_1.default.join("..","css")),baseCSS=fs_1.default.readFileSync(basePath+"/base.css","utf-8"),componentsCSS=fs_1.default.readFileSync(basePath+"/components.css","utf-8"),utilitiesCSS=fs_1.default.readFileSync(basePath+"/utilities.css","utf-8"),config=plugin_1.default.withOptions((e=>({addBase:t,addComponents:s,addUtilities:i,theme:r,config:a})=>{var l,o,m,h;const _=postcss_1.default.parse(baseCSS),c=postcss_1.default.parse(componentsCSS),u=postcss_1.default.parse(utilitiesCSS),f=postcss_js_1.default.objectify(_),d=postcss_js_1.default.objectify(c),n=postcss_js_1.default.objectify(u),p=a("rippleui")||Object.assign({},e)||{},g=null===(l=p.themes)||void 0===l?void 0:l.find((e=>"light"===e.themeName)),b=null===(o=p.themes)||void 0===o?void 0:o.find((e=>"dark"===e.themeName)),j=(null===(m=p.themes)||void 0===m?void 0:m.filter((e=>"light"!==e.themeName&&"dark"!==e.themeName)))||[];let x={defaultStyle:null===(h=p.defaultStyle)||void 0===h||h,removeThemes:p.removeThemes||[],prefix:p.prefix,themes:[Object.assign({themeName:"light",colorScheme:"light"},g),Object.assign({themeName:"dark",colorScheme:"dark"},b),...j]};if((0,isEmpty_1.isValid)(x)){x.defaultStyle&&t({":root, [data-theme]":Object.assign({},default_schema_1.defaultSchema)});const e=x.themes||[],s=x.removeThemes||[],i=(0,theme_1.removeThemes)(s,e);i.length>0&&i.forEach((e=>{const s=(0,prefix_1.addPrefix)(Object.assign({},e.colors)),i=(0,hexToRGB_1.palleteToRGB)(s),r=Object.assign(Object.assign({},e),{colors:i});let a;a="light"===e.themeName?(0,theme_2.mergeNestedObjects)(ligh_theme_1.lightTheme,r):"dark"===e.themeName?(0,theme_2.mergeNestedObjects)(dark_theme_1.darkTheme,r):r;const l=(0,theme_1.createTheme)(a);t([...l])}))}if(t(f),p.prefix){s((0,prefix_2.getSelectorsWithPrefix)(p.prefix,d))}else s(d);i(n)}),(e=>{let t=Object.assign({},var_theme_1.varTheme.colors);if((0,isEmpty_1.isValid)(e)){const s=e.themes||[];null==s||s.forEach((e=>{if(null==e?void 0:e.colors){const s=(0,extractNewVariables_1.extractNewVariables)(var_theme_1.varTheme.colors,e.colors);t=Object.assign(Object.assign({},t),s)}}))}return{theme:{extend:{colors:Object.assign({},t)}}}}));module.exports=config; |
@@ -8,2 +8,3 @@ import { Theme } from "./theme.types"; | ||
* @property {boolean} [defaultStyle] - Will apply by default bg-color and color to the root element. | ||
* @property {string} [prefix] - Will add a prefix to all the variables. | ||
* @property {string[]} [removeThemes] - The list of themes to remove. | ||
@@ -18,2 +19,6 @@ * @property {ThemeExtended[]} [themes] - The list of themes to modify, add or remove, you can also add new variables in each theme. | ||
/** | ||
* Will add a prefix to all the variables `(default: "")` | ||
*/ | ||
prefix?: string; | ||
/** | ||
* The list of themes to remove `(default: [])` | ||
@@ -20,0 +25,0 @@ */ |
@@ -1,5 +0,1 @@ | ||
import { ColorsMap, RecursivePartial } from "../types/theme.types"; | ||
import { ColorsVariableMap } from "../types/variables.types"; | ||
export declare const extractNewVariables: (obj1: ColorsVariableMap, obj2: RecursivePartial<ColorsMap>) => { | ||
[key: string]: any; | ||
}; | ||
export declare const extractNewVariables: <T extends object, U extends object>(obj1: T, obj2: U) => Record<string, T>; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.palleteToRGB=exports.hexToRGB=void 0;const hexToRGB=e=>{const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return`${parseInt(t[1],16)} ${parseInt(t[2],16)} ${parseInt(t[3],16)}`;throw new Error("Invalid hexadecimal string")};exports.hexToRGB=hexToRGB;const palleteToRGB=(e={})=>{const t={};return Object.keys(e).map((o=>{t[o]=(0,exports.hexToRGB)(e[o])})),t};exports.palleteToRGB=palleteToRGB; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.palleteToRGB=exports.hexToRGB=void 0;const hexToRGB=e=>{const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t){return`${parseInt(t[1],16)} ${parseInt(t[2],16)} ${parseInt(t[3],16)}`}throw new Error("Invalid hexadecimal string")};exports.hexToRGB=hexToRGB;const palleteToRGB=(e={})=>{const t={};return Object.keys(e).map((o=>{t[o]=(0,exports.hexToRGB)(e[o])})),t};exports.palleteToRGB=palleteToRGB; |
{ | ||
"name": "rippleui", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Cleanest, modern and beatifull Tailwind CSS library.", | ||
@@ -5,0 +5,0 @@ "main": "dist/js/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
4126669
65
305
7