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

@chakra-ui/breakpoint-utils

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chakra-ui/breakpoint-utils - npm Package Compare versions

Comparing version 0.0.0-dev-20220819191103 to 0.0.0-dev-20220820124231

46

dist/index.cjs.js

@@ -25,3 +25,2 @@ "use strict";

arrayToObjectNotation: () => arrayToObjectNotation,
breakpoints: () => breakpoints,
isCustomBreakpoint: () => isCustomBreakpoint,

@@ -31,3 +30,2 @@ isResponsiveObjectLike: () => isResponsiveObjectLike,

objectToArrayNotation: () => objectToArrayNotation,
px: () => px,
toMediaQueryString: () => toMediaQueryString

@@ -37,26 +35,15 @@ });

// ../shared-utils/dist/index.esm.js
function isObject(value) {
const type = typeof value;
return value != null && (type === "object" || type === "function") && !Array.isArray(value);
}
// src/responsive.ts
var import_shared_utils = require("@chakra-ui/shared-utils");
function getLastItem(array) {
const length = array == null ? 0 : array.length;
return length ? array[length - 1] : void 0;
}
var breakpoints = Object.freeze([
"base",
"sm",
"md",
"lg",
"xl",
"2xl"
]);
var breakpoints = Object.freeze(["base", "sm", "md", "lg", "xl", "2xl"]);
function mapResponsive(prop, mapper) {
if (Array.isArray(prop)) {
return prop.map((item) => {
if (item === null) {
return null;
}
return mapper(item);
});
return prop.map((item) => item === null ? null : mapper(item));
}
if ((0, import_shared_utils.isObject)(prop)) {
if (isObject(prop)) {
return Object.keys(prop).reduce((result, key) => {

@@ -74,5 +61,5 @@ result[key] = mapper(prop[key]);

const result = bps.map((br) => obj[br] ?? null);
while (getLastItem(result) === null) {
const lastItem = result[result.length - 1];
while (lastItem === null)
result.pop();
}
return result;

@@ -94,7 +81,6 @@ }

}
var isCustomBreakpoint = (maybeBreakpoint) => Number.isNaN(Number(maybeBreakpoint));
var isCustomBreakpoint = (v) => Number.isNaN(Number(v));
// src/breakpoint.ts
var import_shared_utils2 = require("@chakra-ui/shared-utils");
function getLastItem2(array) {
function getLastItem(array) {
const length = array == null ? 0 : array.length;

@@ -174,7 +160,7 @@ return length ? array[length - 1] : void 0;

toArrayValue(test) {
if (!(0, import_shared_utils2.isObject)(test)) {
if (!isObject(test)) {
throw new Error("toArrayValue: value must be an object");
}
const result = _keysArr.map((bp) => test[bp] ?? null);
while (getLastItem2(result) === null) {
while (getLastItem(result) === null) {
result.pop();

@@ -201,3 +187,2 @@ }

arrayToObjectNotation,
breakpoints,
isCustomBreakpoint,

@@ -207,4 +192,3 @@ isResponsiveObjectLike,

objectToArrayNotation,
px,
toMediaQueryString
});

@@ -1,2 +0,1 @@

declare const breakpoints: readonly string[];
declare function mapResponsive(prop: any, mapper: (val: any) => any): any;

@@ -13,5 +12,4 @@ declare function objectToArrayNotation(obj: Record<string, any>, bps?: readonly string[]): any[];

*/
declare const isCustomBreakpoint: (maybeBreakpoint: string) => boolean;
declare const isCustomBreakpoint: (v: string) => boolean;
declare function px(value: number | string | null): string | null;
declare function toMediaQueryString(min: string | null, max?: string): string;

@@ -49,4 +47,3 @@ declare function analyzeBreakpoints(breakpoints: Record<string, any>): {

} | null;
declare type AnalyzeBreakpointsReturn = ReturnType<typeof analyzeBreakpoints>;
export { AnalyzeBreakpointsReturn, analyzeBreakpoints, arrayToObjectNotation, breakpoints, isCustomBreakpoint, isResponsiveObjectLike, mapResponsive, objectToArrayNotation, px, toMediaQueryString };
export { analyzeBreakpoints, arrayToObjectNotation, isCustomBreakpoint, isResponsiveObjectLike, mapResponsive, objectToArrayNotation, toMediaQueryString };

@@ -0,23 +1,12 @@

// ../shared-utils/dist/index.esm.js
function isObject(value) {
const type = typeof value;
return value != null && (type === "object" || type === "function") && !Array.isArray(value);
}
// src/responsive.ts
import { isObject } from "@chakra-ui/shared-utils";
function getLastItem(array) {
const length = array == null ? 0 : array.length;
return length ? array[length - 1] : void 0;
}
var breakpoints = Object.freeze([
"base",
"sm",
"md",
"lg",
"xl",
"2xl"
]);
var breakpoints = Object.freeze(["base", "sm", "md", "lg", "xl", "2xl"]);
function mapResponsive(prop, mapper) {
if (Array.isArray(prop)) {
return prop.map((item) => {
if (item === null) {
return null;
}
return mapper(item);
});
return prop.map((item) => item === null ? null : mapper(item));
}

@@ -37,5 +26,5 @@ if (isObject(prop)) {

const result = bps.map((br) => obj[br] ?? null);
while (getLastItem(result) === null) {
const lastItem = result[result.length - 1];
while (lastItem === null)
result.pop();
}
return result;

@@ -57,7 +46,6 @@ }

}
var isCustomBreakpoint = (maybeBreakpoint) => Number.isNaN(Number(maybeBreakpoint));
var isCustomBreakpoint = (v) => Number.isNaN(Number(v));
// src/breakpoint.ts
import { isObject as isObject2 } from "@chakra-ui/shared-utils";
function getLastItem2(array) {
function getLastItem(array) {
const length = array == null ? 0 : array.length;

@@ -137,7 +125,7 @@ return length ? array[length - 1] : void 0;

toArrayValue(test) {
if (!isObject2(test)) {
if (!isObject(test)) {
throw new Error("toArrayValue: value must be an object");
}
const result = _keysArr.map((bp) => test[bp] ?? null);
while (getLastItem2(result) === null) {
while (getLastItem(result) === null) {
result.pop();

@@ -163,3 +151,2 @@ }

arrayToObjectNotation,
breakpoints,
isCustomBreakpoint,

@@ -169,4 +156,3 @@ isResponsiveObjectLike,

objectToArrayNotation,
px,
toMediaQueryString
};
{
"name": "@chakra-ui/breakpoint-utils",
"version": "0.0.0-dev-20220819191103",
"version": "0.0.0-dev-20220820124231",
"description": "",

@@ -31,4 +31,4 @@ "keywords": [

},
"dependencies": {
"@chakra-ui/shared-utils": "0.0.0-dev-20220819191103"
"devDependencies": {
"@chakra-ui/shared-utils": "0.0.0-dev-20220820124231"
},

@@ -35,0 +35,0 @@ "scripts": {

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