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

@stitches/core

Package Overview
Dependencies
Maintainers
2
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stitches/core - npm Package Compare versions

Comparing version 0.0.2-canary.0 to 0.0.3-canary.0

39

dist/core.cjs.dev.js

@@ -5,4 +5,7 @@ 'use strict';

var tokenTypes = ['colors', 'space', 'fontSizes', 'fonts', 'fontWeights', 'lineHeights', 'letterSpacings', 'sizes', 'borderWidths', 'borderStyles', 'radii', 'shadows', 'zIndices', 'transitions'];
var tokenTypes = ['colors', 'space', 'fontSizes', 'fonts', 'fontWeights', 'lineHeights', 'letterSpacings', 'sizes', 'borderWidths', 'borderStyles', 'radii', 'shadows', 'zIndices', 'transitions']; // Note: when running Jest tests, make sure that the test file is running in node env
// if this constant was giving incorrect results.
var isServer = typeof window === 'undefined';
var ATOM = Symbol('ATOM');

@@ -931,20 +934,4 @@

return nestingPath.reduce(function (acc, breakpointOrSelector, i) {
// utilityFirst selector specific resolution:
var isOverride = config.utilityFirst && breakpointOrSelector === 'override';
if (isOverride) {
// any level above 0
if (i) {
throw new Error("@stitches/core - You can not override at this level [".concat(nestingPath.slice(0, i - 1).join(', '), ", -> ").concat(breakpointOrSelector, "], only at the top level definition"));
}
return acc;
} // breakpoints handling:
// breakpoints handling:
if (breakpointOrSelector in config.breakpoints || breakpointOrSelector === MAIN_BREAKPOINT_ID) {
if (acc.breakpoint !== MAIN_BREAKPOINT_ID) {
throw new Error("@stitches/core - You are nesting the breakpoint \"".concat(breakpointOrSelector, "\" into \"").concat(acc.breakpoint, "\", that makes no sense? :-)"));
}
acc.breakpoint = breakpointOrSelector;

@@ -1005,5 +992,9 @@ return acc;

this._className = className; // @ts-ignore
this._className = className; // we only want to enable caching on the client
// because on the server we want to make sure that the composition is evaluated on each request
this.toString = toStringCachedAtom;
if (!isServer) {
this.toString = toStringCachedAtom;
}
return className;

@@ -1322,3 +1313,2 @@ };

var compositionsCache = new Set();
var atomCache = new Map();

@@ -1358,3 +1348,2 @@ var keyFramesCache = new Map();

var composition = compose.apply(void 0, args);
compositionsCache.add(composition);
return composition;

@@ -1450,7 +1439,3 @@ };

cssInstance.getStyles = function (cb) {
// Reset the composition to avoid ssr issues
compositionsCache.forEach(function (composition) {
composition.toString = toStringCompose;
}); // tslint:disable-next-line
// tslint:disable-next-line
for (var sheet in sheets) {

@@ -1457,0 +1442,0 @@ sheets[sheet].cssRules.length = 0;

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

var currentType, tokenTypes = [ "colors", "space", "fontSizes", "fonts", "fontWeights", "lineHeights", "letterSpacings", "sizes", "borderWidths", "borderStyles", "radii", "shadows", "zIndices", "transitions" ], ATOM = Symbol("ATOM"), unitlessKeys = {
var currentType, tokenTypes = [ "colors", "space", "fontSizes", "fonts", "fontWeights", "lineHeights", "letterSpacings", "sizes", "borderWidths", "borderStyles", "radii", "shadows", "zIndices", "transitions" ], isServer = "undefined" == typeof window, ATOM = Symbol("ATOM"), unitlessKeys = {
animationDuration: 1,

@@ -669,11 +669,4 @@ animationIterationCount: 1,

return nestingPath.reduce((function(acc, breakpointOrSelector, i) {
if (config.utilityFirst && "override" === breakpointOrSelector) {
if (i) throw new Error("@stitches/core - You can not override at this level [".concat(nestingPath.slice(0, i - 1).join(", "), ", -> ").concat(breakpointOrSelector, "], only at the top level definition"));
return acc;
}
if (breakpointOrSelector in config.breakpoints || breakpointOrSelector === MAIN_BREAKPOINT_ID) {
if (acc.breakpoint !== MAIN_BREAKPOINT_ID) throw new Error('@stitches/core - You are nesting the breakpoint "'.concat(breakpointOrSelector, '" into "').concat(acc.breakpoint, '", that makes no sense? :-)'));
return acc.breakpoint = breakpointOrSelector, acc;
}
return "@" === breakpointOrSelector[0] ? (acc.inlineMediaQueries.push(breakpointOrSelector),
return breakpointOrSelector in config.breakpoints || breakpointOrSelector === MAIN_BREAKPOINT_ID ? (acc.breakpoint = breakpointOrSelector,
acc) : "@" === breakpointOrSelector[0] ? (acc.inlineMediaQueries.push(breakpointOrSelector),
acc) : (acc.nestingPath = acc.nestingPath + ("&" === breakpointOrSelector[0] && ":" === breakpointOrSelector[1] ? breakpointOrSelector.substr(1) : ":" === breakpointOrSelector[0] ? breakpointOrSelector : " " + breakpointOrSelector),

@@ -698,3 +691,4 @@ acc);

})).join(" ");
return this._className = className, this.toString = toStringCachedAtom, className;
return this._className = className, isServer || (this.toString = toStringCachedAtom),
className;
}, createCssRule = function(breakpoints, atom, className) {

@@ -819,3 +813,3 @@ var cssRule = "";

baseTokens += "}", preInjectedRules.has(":root") || sheets.__variables__.insertRule(baseTokens);
var compositionsCache = new Set, atomCache = new Map, keyFramesCache = new Map, themeCache = new Map, cssInstance = function() {
var atomCache = new Map, keyFramesCache = new Map, themeCache = new Map, cssInstance = function() {
for (var args = [], index = 0, _len2 = arguments.length, definitions = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) definitions[_key2] = arguments[_key2];

@@ -827,3 +821,3 @@ for (var x = 0; x < definitions.length; x++) definitions[x] && ("string" == typeof definitions[x] || definitions[x][ATOM] ? args[index++] = definitions[x] : processStyleObject(definitions[x], config, (function(prop, value, path) {

var composition = compose.apply(void 0, args);
return compositionsCache.add(composition), composition;
return composition;
};

@@ -868,5 +862,3 @@ return cssInstance.dispose = function() {

}, cssInstance.getStyles = function(cb) {
for (var sheet in compositionsCache.forEach((function(composition) {
composition.toString = toStringCompose;
})), sheets) sheets[sheet].cssRules.length = 0;
for (var sheet in sheets) sheets[sheet].cssRules.length = 0;
return baseTokens && sheets.__variables__.insertRule(baseTokens), toString = createServerToString(sheets, config.breakpoints, cssClassnameProvider),

@@ -873,0 +865,0 @@ keyframesToString = createKeyframesToString(sheets[MAIN_BREAKPOINT_ID]), themeToString = createThemeToString(classPrefix, sheets.__variables__),

@@ -1,3 +0,6 @@

var tokenTypes = ['colors', 'space', 'fontSizes', 'fonts', 'fontWeights', 'lineHeights', 'letterSpacings', 'sizes', 'borderWidths', 'borderStyles', 'radii', 'shadows', 'zIndices', 'transitions'];
var tokenTypes = ['colors', 'space', 'fontSizes', 'fonts', 'fontWeights', 'lineHeights', 'letterSpacings', 'sizes', 'borderWidths', 'borderStyles', 'radii', 'shadows', 'zIndices', 'transitions']; // Note: when running Jest tests, make sure that the test file is running in node env
// if this constant was giving incorrect results.
var isServer = typeof window === 'undefined';
var ATOM = Symbol('ATOM');

@@ -926,20 +929,4 @@

return nestingPath.reduce(function (acc, breakpointOrSelector, i) {
// utilityFirst selector specific resolution:
var isOverride = config.utilityFirst && breakpointOrSelector === 'override';
if (isOverride) {
// any level above 0
if (i) {
throw new Error("@stitches/core - You can not override at this level [".concat(nestingPath.slice(0, i - 1).join(', '), ", -> ").concat(breakpointOrSelector, "], only at the top level definition"));
}
return acc;
} // breakpoints handling:
// breakpoints handling:
if (breakpointOrSelector in config.breakpoints || breakpointOrSelector === MAIN_BREAKPOINT_ID) {
if (acc.breakpoint !== MAIN_BREAKPOINT_ID) {
throw new Error("@stitches/core - You are nesting the breakpoint \"".concat(breakpointOrSelector, "\" into \"").concat(acc.breakpoint, "\", that makes no sense? :-)"));
}
acc.breakpoint = breakpointOrSelector;

@@ -1000,5 +987,9 @@ return acc;

this._className = className; // @ts-ignore
this._className = className; // we only want to enable caching on the client
// because on the server we want to make sure that the composition is evaluated on each request
this.toString = toStringCachedAtom;
if (!isServer) {
this.toString = toStringCachedAtom;
}
return className;

@@ -1317,3 +1308,2 @@ };

var compositionsCache = new Set();
var atomCache = new Map();

@@ -1353,3 +1343,2 @@ var keyFramesCache = new Map();

var composition = compose.apply(void 0, args);
compositionsCache.add(composition);
return composition;

@@ -1445,7 +1434,3 @@ };

cssInstance.getStyles = function (cb) {
// Reset the composition to avoid ssr issues
compositionsCache.forEach(function (composition) {
composition.toString = toStringCompose;
}); // tslint:disable-next-line
// tslint:disable-next-line
for (var sheet in sheets) {

@@ -1452,0 +1437,0 @@ sheets[sheet].cssRules.length = 0;

export declare const tokenTypes: readonly ["colors", "space", "fontSizes", "fonts", "fontWeights", "lineHeights", "letterSpacings", "sizes", "borderWidths", "borderStyles", "radii", "shadows", "zIndices", "transitions"];
export declare const isServer: boolean;

@@ -177,3 +177,2 @@ import { Color, LineStyle, LineWidth, Properties } from './css-types';

prefix?: string;
utilityFirst?: boolean;
} & (STRICT_MODE extends true ? {

@@ -188,18 +187,7 @@ breakpoints: IBreakpoints;

});
export declare type TUtilityFirstCss<T extends TConfig> = T['breakpoints'] extends unknown ? {
override?: TRecursiveCss<T>;
} & TRecursiveUtils<T> : {
override?: TRecursiveCss<T> & {
[S in keyof T['breakpoints']]?: TRecursiveCss<T>;
};
} & {
[S in keyof T['breakpoints']]?: TRecursiveUtils<T>;
} & TRecursiveUtils<T>;
export declare type TDefaultCss<T extends TConfig> = T['breakpoints'] extends object ? TRecursiveCss<T> & TRecursiveUtils<T> & {
export declare type TCssProperties<T extends TConfig> = T['breakpoints'] extends object ? TRecursiveCss<T> & TRecursiveUtils<T> & {
[S in keyof T['breakpoints']]?: TRecursiveCss<T> & TRecursiveUtils<T>;
} : TRecursiveCss<T> & TRecursiveUtils<T>;
export interface TCss<T extends TConfig> {
(...styles: ((T extends {
utilityFirst: true;
} ? TUtilityFirstCss<T> : TDefaultCss<T>) | string | boolean | null | undefined)[]): string;
(...styles: (TCssProperties<T> | string | boolean | null | undefined)[]): string;
getStyles: (callback: () => any) => {

@@ -210,5 +198,3 @@ styles: string[];

keyframes: (definition: Record<string, TFlatCSS<T> & TFlatUtils<T>>) => string;
global: (definition: Record<string, T extends {
utilityFirst: true;
} ? TUtilityFirstCss<T> : TDefaultCss<T>>) => string;
global: (definition: Record<string, TCssProperties<T>>) => string;
theme: (theme: Partial<{

@@ -215,0 +201,0 @@ [TO in keyof T['tokens']]: Partial<T['tokens'][TO]>;

{
"name": "@stitches/core",
"version": "0.0.2-canary.0",
"version": "0.0.3-canary.0",
"description": "The modern CSS-in-JS library",

@@ -55,3 +55,3 @@ "main": "dist/core.cjs.js",

},
"gitHead": "fcf069d00544c1438a4d2c55669bca2abc338b8b"
"gitHead": "483ad0781514a92f7323df56bfd4948ad781686c"
}
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