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

onno

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onno - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

29

cjs/index.js

@@ -14,2 +14,3 @@ "use strict"

const isObject = isType("object")
const isPlainObject = (x) => !!x && isObject(x) && !isArray(x)
const isNumber = isType("number")

@@ -62,7 +63,7 @@ const isString = isType("string")

return renderers.reduce((collection, renderer) => {
if (renderer.options.renderers) {
unique(renderer.options.renderers, initial)
} else if (collection.indexOf(renderer) === -1) {
collection.push(renderer)
}
const isComposed = renderer.type === "compose"
const isIncluded = collection.includes(renderer)
const { renderers: renderFuncs } = renderer.options
if (!isComposed && !isIncluded) collection.push(renderer)
if (isArray(renderFuncs)) unique(renderFuncs, initial)
return collection

@@ -115,4 +116,3 @@ }, initial)

}
function transformStyle(renderers) {
const renderer = compose({ name: "transform", renderers })
function transformStyle(renderer) {
const { propsKeys, styleKeys } = renderer.options

@@ -124,3 +124,3 @@ const transform = (styleObject, theme) => {

const value = result[key]
if (isObject(value)) {
if (isPlainObject(value)) {
result[key] = transform(value, theme)

@@ -151,3 +151,7 @@ } else {

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

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

if (styleKeys === null) {
return isObject(value) && !isArray(value) ? value : null
return isPlainObject(value) ? value : null
} else {

@@ -828,3 +832,3 @@ return renderStyle(keys, value)

themeKeys: ["buttonStyles"],
renderers: [globalSet, colorStyle, textStyle]
renderers: [colorStyle, textStyle, globalSet]
})

@@ -834,3 +838,3 @@ const gst = variant({

themeKeys: ["globalStyles"],
renderers: [globalSet, buttonStyle, colorStyle, textStyle]
renderers: [buttonStyle, colorStyle, textStyle, globalSet]
})

@@ -922,2 +926,3 @@ const globalStyle = (props) => gst(Object.assign({ gst: "." }, props))

exports.isObject = isObject
exports.isPlainObject = isPlainObject
exports.isString = isString

@@ -924,0 +929,0 @@ exports.isType = isType

@@ -10,2 +10,3 @@ const PX_SCALE = [0, 2, 4, 8, 16, 32, 64, 128, 256, 512]

const isObject = isType("object")
const isPlainObject = (x) => !!x && isObject(x) && !isArray(x)
const isNumber = isType("number")

@@ -58,7 +59,7 @@ const isString = isType("string")

return renderers.reduce((collection, renderer) => {
if (renderer.options.renderers) {
unique(renderer.options.renderers, initial)
} else if (collection.indexOf(renderer) === -1) {
collection.push(renderer)
}
const isComposed = renderer.type === "compose"
const isIncluded = collection.includes(renderer)
const { renderers: renderFuncs } = renderer.options
if (!isComposed && !isIncluded) collection.push(renderer)
if (isArray(renderFuncs)) unique(renderFuncs, initial)
return collection

@@ -111,4 +112,3 @@ }, initial)

}
function transformStyle(renderers) {
const renderer = compose({ name: "transform", renderers })
function transformStyle(renderer) {
const { propsKeys, styleKeys } = renderer.options

@@ -120,3 +120,3 @@ const transform = (styleObject, theme) => {

const value = result[key]
if (isObject(value)) {
if (isPlainObject(value)) {
result[key] = transform(value, theme)

@@ -147,3 +147,7 @@ } else {

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

@@ -163,3 +167,3 @@ const renderValue = (value, theme) => {

if (styleKeys === null) {
return isObject(value) && !isArray(value) ? value : null
return isPlainObject(value) ? value : null
} else {

@@ -824,3 +828,3 @@ return renderStyle(keys, value)

themeKeys: ["buttonStyles"],
renderers: [globalSet, colorStyle, textStyle]
renderers: [colorStyle, textStyle, globalSet]
})

@@ -830,3 +834,3 @@ const gst = variant({

themeKeys: ["globalStyles"],
renderers: [globalSet, buttonStyle, colorStyle, textStyle]
renderers: [buttonStyle, colorStyle, textStyle, globalSet]
})

@@ -919,2 +923,3 @@ const globalStyle = (props) => gst(Object.assign({ gst: "." }, props))

isObject,
isPlainObject,
isString,

@@ -921,0 +926,0 @@ isType,

{
"name": "onno",
"license": "MIT",
"version": "0.0.17",
"version": "0.0.18",
"description": "Responsive style props for building themed design systems",

@@ -33,3 +33,3 @@ "homepage": "https://github.com/wagerfield/onno/tree/master/packages/onno#readme",

},
"gitHead": "ede6f7b2a2c3af02fdaf84db3104b48a41d2b3a1"
"gitHead": "7a5145c7f092640a61ecd97aeb5570e782c63659"
}

@@ -10,3 +10,3 @@ import * as T from "./types"

export declare function transformStyle<S extends T.Style>(
renderers: T.AnyRenderFunction[]
renderer: T.ComposedRenderFunction<any, any>
): T.StyleTransformFunction<S>

@@ -13,0 +13,0 @@ export declare function style<P extends T.ThemeProps, S extends T.Style>(

@@ -7,2 +7,3 @@ import { Func, Pred } from "./types"

export declare const isObject: (x: any) => x is unknown
export declare const isPlainObject: (x: any) => boolean
export declare const isNumber: (x: any) => x is number

@@ -9,0 +10,0 @@ export declare const isString: (x: any) => x is string

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