Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@cssfn/jss-plugin-extend

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cssfn/jss-plugin-extend - npm Package Compare versions

Comparing version
1.0.0
to
1.0.1
+7
-15
dist/jss-plugin-extend.js

@@ -1,9 +0,3 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeStyle = void 0;
// others libs:
const tiny_warning_1 = __importDefault(require("tiny-warning"));
import warning from 'tiny-warning';
const isLiteralObject = (object) => object && (typeof (object) === 'object') && !Array.isArray(object);

@@ -23,3 +17,3 @@ const isStyle = (object) => isLiteralObject(object);

if (isStyle(singleExtend)) {
(0, exports.mergeStyle)(style, singleExtend, rule, sheet);
mergeStyle(style, singleExtend, rule, sheet);
} // if

@@ -33,3 +27,3 @@ //#endregion extend using a `Style`

if (refRule === rule) {
(0, tiny_warning_1.default)(false, `[JSS] A rule tries to extend itself \n${rule.toString()}`);
warning(false, `[JSS] A rule tries to extend itself \n${rule.toString()}`);
// TODO: detect circular ref, causing infinite recursive

@@ -42,3 +36,3 @@ }

if (ruleStyle) {
(0, exports.mergeStyle)(style, ruleStyle, rule, sheet);
mergeStyle(style, ruleStyle, rule, sheet);
} // if

@@ -75,3 +69,3 @@ } // if

const currentValueClone = { ...currentPropValue }; // clone the `currentPropValue` to avoid side effect, because the `currentPropValue` is not **the primary object** we're working on
(0, exports.mergeStyle)(currentValueClone, newPropValue, rule, sheet);
mergeStyle(currentValueClone, newPropValue, rule, sheet);
// merging style prop no need to rearrange the prop position

@@ -84,3 +78,3 @@ style[propName] = currentValueClone; // set the mutated `currentValueClone` back to `style`

// we export `mergeStyle` so it reusable:
const mergeStyle = (style, newStyle, rule, sheet) => {
export const mergeStyle = (style, newStyle, rule, sheet) => {
const newStyleClone = { ...newStyle }; // clone the `newStyle` to avoid side effect, because the `newStyle` is not **the primary object** we're working on

@@ -90,3 +84,2 @@ mergeExtend(newStyleClone, rule, sheet);

};
exports.mergeStyle = mergeStyle;
const onProcessStyle = (style, rule, sheet) => {

@@ -140,3 +133,3 @@ mergeExtend(style, rule, sheet);

};
function pluginExtend() {
export default function pluginExtend() {
return {

@@ -147,2 +140,1 @@ onProcessStyle,

}
exports.default = pluginExtend;
{
"name": "@cssfn/jss-plugin-extend",
"version": "1.0.0",
"version": "1.0.1",
"description": "A plugin for JSS.",
"type": "module",
"main": "dist/jss-plugin-extend.js",

@@ -6,0 +7,0 @@ "types": "dist/jss-plugin-extend.d.ts",

@@ -27,5 +27,5 @@ {

/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
"module": "ESNext", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */

@@ -32,0 +32,0 @@ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */