Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kremling

Package Overview
Dependencies
Maintainers
7
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kremling - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

2

lib/scoped.component.js

@@ -79,3 +79,3 @@ "use strict";

if (props.css && props.postcss) throw Error("Kremling's <Scoped /> component requires either the 'css' or 'postcss' props. Cannot use both.");
if (props.postcss && !(typeof props.postcss.styles === 'string' && props.postcss.id)) throw Error("Kremlings's <Scoped /> component 'postcss' prop requires an object containing 'styles' and 'id' properties. Try using the kremling-loader.");
if (props.postcss && !(typeof props.postcss.styles === 'string' && props.postcss.id)) throw Error("Kremling's <Scoped /> component 'postcss' prop requires an object containing 'styles' and 'id' properties. Try using the kremling-loader.");
_this.state = _this.newCssState(props);

@@ -82,0 +82,0 @@ return _this;

@@ -24,4 +24,11 @@ "use strict";

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function useCss(css, overrideNamespace) {
var isPostCss = Boolean(css && css.id && css.styles);
var isPostCss = _typeof(css) === 'object';
if (isPostCss && !(css.id && typeof css.styles === 'string')) {
throw Error("Kremling's \"useCss\" hook requires \"id\" and \"styles\" properties when using the kremling-loader");
}
var namespace = overrideNamespace || isPostCss && css.namespace || _scopedComponent.Scoped.defaultNamespace;

@@ -28,0 +35,0 @@

@@ -150,2 +150,18 @@ "use strict";

});
it("postcss should accept empty style strings", function () {
var postcss = {
id: '15',
styles: "",
namespace: 'donkey-kong'
};
(0, _testUtils.act)(function () {
_reactDom.default.render(_react.default.createElement(ScopedDiv, {
css: postcss
}), container);
});
expect(container.innerHTML).toEqual('<div donkey-kong="15"></div>');
(0, _testUtils.act)(function () {
_reactDom.default.unmountComponentAtNode(container);
});
});
});

@@ -152,0 +168,0 @@

{
"name": "kremling",
"version": "1.2.1",
"version": "1.2.2",
"description": "Embarrassingly simple css for React",

@@ -5,0 +5,0 @@ "main": "lib/kremling.js",

@@ -22,3 +22,3 @@ import React from 'react';

if (props.css && props.postcss) throw Error(`Kremling's <Scoped /> component requires either the 'css' or 'postcss' props. Cannot use both.`);
if (props.postcss && !(typeof props.postcss.styles === 'string' && props.postcss.id)) throw Error(`Kremlings's <Scoped /> component 'postcss' prop requires an object containing 'styles' and 'id' properties. Try using the kremling-loader.`);
if (props.postcss && !(typeof props.postcss.styles === 'string' && props.postcss.id)) throw Error(`Kremling's <Scoped /> component 'postcss' prop requires an object containing 'styles' and 'id' properties. Try using the kremling-loader.`);

@@ -25,0 +25,0 @@ this.state = this.newCssState(props)

@@ -6,3 +6,6 @@ import {useLayoutEffect, useEffect, useState} from 'react'

export function useCss(css, overrideNamespace) {
const isPostCss = Boolean(css && css.id && css.styles)
const isPostCss = typeof css === 'object'
if (isPostCss && !(css.id && typeof css.styles === 'string')) {
throw Error(`Kremling's "useCss" hook requires "id" and "styles" properties when using the kremling-loader`)
}
const namespace = overrideNamespace || (isPostCss && css.namespace) || Scoped.defaultNamespace

@@ -9,0 +12,0 @@ const [styleElement, setStyleElement] = useState(() => getStyleElement(null, isPostCss, css, namespace))

@@ -139,2 +139,18 @@ import React from 'react'

})
it(`postcss should accept empty style strings`, () => {
const postcss = {
id: '15',
styles: ``,
namespace: 'donkey-kong',
}
act(() => {
ReactDOM.render(<ScopedDiv css={postcss} />, container)
})
expect(container.innerHTML).toEqual('<div donkey-kong="15"></div>')
act(() => {
ReactDOM.unmountComponentAtNode(container)
})
})
})

@@ -141,0 +157,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc