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

onno-react

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onno-react - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

types/onno-react/src/index.d.ts

47

cjs/index.js

@@ -9,4 +9,9 @@ "use strict"

const PC_SCALE = Object.assign([], PX_SCALE, { 1: "100%" })
const BREAKPOINTS = ["all", "sm", "md", "lg", "xl"].map((alias, index) => ({
alias,
value: index * 360
}))
const IGNORE = /\s|\d+\.\d+/
const push = Array.prototype.push
const isArray = Array.isArray

@@ -62,3 +67,2 @@ const isNil = (x) => x == null

const KEYS = ["propsKeys", "styleKeys", "themeKeys"]
const push = Array.prototype.push
function unique(renderers, initial = []) {

@@ -104,17 +108,9 @@ return renderers.reduce((collection, renderer) => {

const BREAKPOINTS = ["all", "sm", "md", "lg", "xl"].map((alias, index) => ({
alias,
value: index * 360
}))
function merge(styles) {
return styles.reduce((o, s) => Object.assign(o, s), {})
}
function renderStyle(keys, value) {
if (isNil(value) || !isArray(keys) || !keys.length) return null
return keys.reduce((s, k) => {
s[k] = value
return s
}, {})
}
function transformStyle(renderer) {
function interpolate(options) {
let { name, renderers } = options
if (!/Transform$/.test(name)) name += "Transform"
const renderer = compose({ name, renderers })
const { propsKeys, styleKeys } = renderer.options

@@ -136,4 +132,14 @@ const transform = (styleObject, theme) => {

}
Object.defineProperty(transform, "name", { value: name })
return transform
}
function render(keys, value) {
if (isNil(value) || !isArray(keys) || !keys.length) return null
return keys.reduce((s, k) => {
s[k] = value
return s
}, {})
}
function style(options) {

@@ -153,7 +159,3 @@ const {

const keys = isArray(styleKeys) ? styleKeys : propsKeys.slice(0, 1)
let transformer
if (isArray(renderers)) {
const renderer = compose({ name: `${name}Renderer`, renderers })
transformer = transformStyle(renderer)
}
const transformStyle = isArray(renderers) && interpolate({ name, renderers })
if (isUndefined(styleKeys)) options.styleKeys = keys

@@ -175,3 +177,3 @@ const renderValue = (value, theme) => {

} else {
return renderStyle(keys, value)
return render(keys, value)
}

@@ -187,3 +189,3 @@ }

if (result) {
if (transformer) result = transformer(result, theme)
if (transformStyle) result = transformStyle(result, theme)
if (query) result = { [query]: result }

@@ -870,2 +872,3 @@ styles.push(result)

exports.ARRAY_TYPE = ARRAY_TYPE
exports.BREAKPOINTS = BREAKPOINTS
exports.OBJECT_TYPE = OBJECT_TYPE

@@ -951,2 +954,3 @@ exports.PC_SCALE = PC_SCALE

exports.height = height
exports.interpolate = interpolate
exports.isArray = isArray

@@ -1007,3 +1011,3 @@ exports.isFraction = isFraction

exports.push = push
exports.renderStyle = renderStyle
exports.render = render
exports.resolve = resolve

@@ -1027,3 +1031,2 @@ exports.right = right

exports.transformSet = transformSet
exports.transformStyle = transformStyle
exports.transition = transition

@@ -1030,0 +1033,0 @@ exports.unique = unique

@@ -5,4 +5,9 @@ import { oneOfType, number, string, objectOf, arrayOf } from "prop-types"

const PC_SCALE = Object.assign([], PX_SCALE, { 1: "100%" })
const BREAKPOINTS = ["all", "sm", "md", "lg", "xl"].map((alias, index) => ({
alias,
value: index * 360
}))
const IGNORE = /\s|\d+\.\d+/
const push = Array.prototype.push
const isArray = Array.isArray

@@ -58,3 +63,2 @@ const isNil = (x) => x == null

const KEYS = ["propsKeys", "styleKeys", "themeKeys"]
const push = Array.prototype.push
function unique(renderers, initial = []) {

@@ -100,17 +104,9 @@ return renderers.reduce((collection, renderer) => {

const BREAKPOINTS = ["all", "sm", "md", "lg", "xl"].map((alias, index) => ({
alias,
value: index * 360
}))
function merge(styles) {
return styles.reduce((o, s) => Object.assign(o, s), {})
}
function renderStyle(keys, value) {
if (isNil(value) || !isArray(keys) || !keys.length) return null
return keys.reduce((s, k) => {
s[k] = value
return s
}, {})
}
function transformStyle(renderer) {
function interpolate(options) {
let { name, renderers } = options
if (!/Transform$/.test(name)) name += "Transform"
const renderer = compose({ name, renderers })
const { propsKeys, styleKeys } = renderer.options

@@ -132,4 +128,14 @@ const transform = (styleObject, theme) => {

}
Object.defineProperty(transform, "name", { value: name })
return transform
}
function render(keys, value) {
if (isNil(value) || !isArray(keys) || !keys.length) return null
return keys.reduce((s, k) => {
s[k] = value
return s
}, {})
}
function style(options) {

@@ -149,7 +155,3 @@ const {

const keys = isArray(styleKeys) ? styleKeys : propsKeys.slice(0, 1)
let transformer
if (isArray(renderers)) {
const renderer = compose({ name: `${name}Renderer`, renderers })
transformer = transformStyle(renderer)
}
const transformStyle = isArray(renderers) && interpolate({ name, renderers })
if (isUndefined(styleKeys)) options.styleKeys = keys

@@ -171,3 +173,3 @@ const renderValue = (value, theme) => {

} else {
return renderStyle(keys, value)
return render(keys, value)
}

@@ -183,3 +185,3 @@ }

if (result) {
if (transformer) result = transformer(result, theme)
if (transformStyle) result = transformStyle(result, theme)
if (query) result = { [query]: result }

@@ -864,2 +866,3 @@ styles.push(result)

ARRAY_TYPE,
BREAKPOINTS,
OBJECT_TYPE,

@@ -945,2 +948,3 @@ PC_SCALE,

height,
interpolate,
isArray,

@@ -1001,3 +1005,3 @@ isFraction,

push,
renderStyle,
render,
resolve,

@@ -1021,3 +1025,2 @@ right,

transformSet,
transformStyle,
transition,

@@ -1024,0 +1027,0 @@ unique,

{
"name": "onno-react",
"license": "MIT",
"version": "0.1.2",
"version": "0.2.0",
"description": "Onno propTypes for React",

@@ -30,6 +30,6 @@ "homepage": "https://github.com/wagerfield/onno/tree/master/packages/onno-react#readme",

"@types/prop-types": "15.7.1",
"onno": "0.1.2",
"onno": "0.2.0",
"prop-types": "15.7.2"
},
"gitHead": "5f2759828c790ef6ff9eb09a6c8587f80a5ba528"
"gitHead": "505b07aa7998c2e2076b8622b6b5933f3be3a797"
}
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