Socket
Socket
Sign inDemoInstall

@kaze-style/core

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kaze-style/core - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

2

dist/__preStyle.d.ts

@@ -8,5 +8,5 @@ import type { CssRuleObject } from './styleOrder';

};
export declare const __preStyle: <K extends string>(styles: Record<K, KazeStyle>, forBuild: {
export declare const __preStyle: <K extends string>(styles: KazeStyle<K>, forBuild: {
fileName: string;
styles: ForBuildStyle<K>[];
}, fileName: string, index: number) => Classes<K>;

@@ -8,3 +8,3 @@ import type { CssRuleObject } from './styleOrder';

};
export declare const createStyle: <K extends string>(styles: Record<K, KazeStyle>) => Result<K>;
export declare const createStyle: <K extends string>(styles: KazeStyle<K>) => Result<K>;
export {};

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

import{ClassName as o}from"./ClassName";import{resolveStyle as n}from"./resolveStyle";const b=e=>{const t={},c={},l=[];for(const s in e){const{classNameObject:a,cssRuleObjects:r}=n({style:e[s]});l.push(...r),t[s]=new o(a),c[s]=a}return{classes:t,classesObject:c,cssRuleObjects:Array.from(new Map(l.map(s=>[s.cssRule,s])).values())}};export{b as createStyle};
import{ClassName as o}from"./ClassName";import{resolveStyle as n}from"./resolveStyle";const b=e=>{const t={},l={},c=[];for(const s in e){const{classNameObject:a,cssRuleObjects:r}=n({style:e[s]});c.push(...r),t[s]=new o(a),l[s]=a}return{classes:t,classesObject:l,cssRuleObjects:Array.from(new Map(c.map(s=>[s.cssRule,s])).values())}};export{b as createStyle};

@@ -10,4 +10,4 @@ export * from './mergeStyle';

export * from './styleOrder';
export type { KazeStyle, KazeGlobalStyle } from './types/style';
export type { KazeStyle, KazeGlobalStyle, SupportStyle, SupportGlobalStyle, } from './types/style';
export type { ForBuildStyle } from './__preStyle';
export type { ForBuildGlobalStyle } from './__preGlobalStyle';
import type { ClassName } from './ClassName';
import type { CssRuleObject } from './styleOrder';
import type { KazeStyle } from './types/style';
import type { SupportStyle } from './types/style';
declare type ResolvedStyle = {

@@ -14,3 +14,3 @@ classNameObject: ClassName['object'];

declare type Args = {
style: KazeStyle;
style: SupportStyle;
pseudo?: string;

@@ -17,0 +17,0 @@ atRules?: AtRules;

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

import{checkStyleOrder as b}from"./utils/checkStyleOrder";import{combinedQuery as y}from"./utils/combinedQuery";import{compileCss as O}from"./utils/compileCss";import{compileKeyFrameCss as j}from"./utils/compileKeyFrameCss";import{hashClassName as u}from"./utils/hashClassName";import{hashSelector as N}from"./utils/hashSelector";import{hyphenateProperty as h}from"./utils/hyphenateProperty";import{isCssValue as g}from"./utils/isCssValue";import{isLayerSelector as C}from"./utils/isLayerSelector";import{isMediaQuerySelector as S}from"./utils/isMediaQuerySelector";import{isNestedSelector as d}from"./utils/isNestedSelector";import{isObject as R}from"./utils/isObject";import{isShortHandProperty as K}from"./utils/isShortHandProperty";import{isSupportQuerySelector as Q}from"./utils/isSupportQuerySelector";import{normalizeNestedProperty as k}from"./utils/normalizeNestedProperty";import{omit as z}from"./utils/omit";import{resolveShortHandStyle as A}from"./utils/resolveShortHandStyle";const i=({style:p,pseudo:o="",atRules:e={media:"",layer:"",support:""},resolvedStyle:t={classNameObject:{},cssRuleObjects:[]}})=>{for(const l in p){const r=l,m=p[r];if(g(m))if(K(r)){const s=A(r,m);i({style:Object.assign(z(p,[r]),s),pseudo:o,atRules:e,resolvedStyle:t})}else{const s=h(r),a=u({pseudo:o,atRules:e,property:s,styleValue:m}),c=N({pseudo:o,atRules:e,property:s}),n=O({className:a,pseudo:o,atRules:e,property:s,styleValue:m}),f=b({atRules:e,pseudo:o});t.cssRuleObjects.push({cssRule:n,order:f}),Object.assign(t.classNameObject,{[c]:a})}else if(r==="animationName"){const s=m,{keyframesRule:a,keyframeName:c}=j(s);t.cssRuleObjects.push({cssRule:a,order:"keyframes"}),Object.assign(t.classNameObject,{[c]:c}),i({style:{animationName:c},pseudo:o,atRules:e,resolvedStyle:t})}else if(R(m))if(S(r)){const s=y(e.media,r.slice(6).trim());i({style:m,pseudo:o,atRules:Object.assign({},e,{media:s}),resolvedStyle:t})}else if(C(r)){const s=(e.layer?`${e.layer}.`:"")+r.slice(6).trim();i({style:m,pseudo:o,atRules:Object.assign({},e,{layer:s}),resolvedStyle:t})}else if(Q(r)){const s=y(e.support,r.slice(9).trim());i({style:m,pseudo:o,atRules:Object.assign({},e,{support:s}),resolvedStyle:t})}else d(r)&&i({style:m,pseudo:k(r,o),atRules:e,resolvedStyle:t})}return t};export{i as resolveStyle};
import{checkStyleOrder as b}from"./utils/checkStyleOrder";import{combinedQuery as y}from"./utils/combinedQuery";import{compileCss as O}from"./utils/compileCss";import{compileKeyFrameCss as j}from"./utils/compileKeyFrameCss";import{hashClassName as u}from"./utils/hashClassName";import{hashSelector as N}from"./utils/hashSelector";import{hyphenateProperty as h}from"./utils/hyphenateProperty";import{isCssValue as S}from"./utils/isCssValue";import{isLayerSelector as g}from"./utils/isLayerSelector";import{isMediaQuerySelector as C}from"./utils/isMediaQuerySelector";import{isNestedSelector as d}from"./utils/isNestedSelector";import{isObject as R}from"./utils/isObject";import{isShortHandProperty as Q}from"./utils/isShortHandProperty";import{isSupportQuerySelector as k}from"./utils/isSupportQuerySelector";import{normalizeNestedProperty as A}from"./utils/normalizeNestedProperty";import{omit as P}from"./utils/omit";import{resolveShortHandStyle as H}from"./utils/resolveShortHandStyle";const i=({style:a,pseudo:o="",atRules:e={media:"",layer:"",support:""},resolvedStyle:t={classNameObject:{},cssRuleObjects:[]}})=>{for(const l in a){const r=l,m=a[r];if(S(m))if(Q(r)){const s=H(r,m);i({style:Object.assign(P(a,[r]),s),pseudo:o,atRules:e,resolvedStyle:t})}else{const s=h(r),p=u({pseudo:o,atRules:e,property:s,styleValue:m}),c=N({pseudo:o,atRules:e,property:s}),n=O({className:p,pseudo:o,atRules:e,property:s,styleValue:m}),f=b({atRules:e,pseudo:o});t.cssRuleObjects.push({cssRule:n,order:f}),Object.assign(t.classNameObject,{[c]:p})}else if(r==="animationName"){const s=m,{keyframesRule:p,keyframeName:c}=j(s);t.cssRuleObjects.push({cssRule:p,order:"keyframes"}),Object.assign(t.classNameObject,{[c]:c}),i({style:{animationName:c},pseudo:o,atRules:e,resolvedStyle:t})}else if(R(m))if(C(r)){const s=y(e.media,r.slice(6).trim());i({style:m,pseudo:o,atRules:Object.assign({},e,{media:s}),resolvedStyle:t})}else if(g(r)){const s=(e.layer?`${e.layer}.`:"")+r.slice(6).trim();i({style:m,pseudo:o,atRules:Object.assign({},e,{layer:s}),resolvedStyle:t})}else if(k(r)){const s=y(e.support,r.slice(9).trim());i({style:m,pseudo:o,atRules:Object.assign({},e,{support:s}),resolvedStyle:t})}else d(r)&&i({style:m,pseudo:A(r,o),atRules:e,resolvedStyle:t})}return t};export{i as resolveStyle};

@@ -1,14 +0,19 @@

import type { Pseudos, PropertiesFallback, PropertiesHyphenFallback, AtRule } from 'csstype';
import type { Pseudos, PropertiesFallback, AtRule } from 'csstype';
import type { ClassName } from '../ClassName';
import type { AndArray, NestedObject, TrimPrefix } from './utils';
import type { AndArray, IncludeChar, TrimPrefix } from './utils';
export declare type CssValue = string | number;
declare type PredictType = '@media screen and (max-width: 0)' | '@media screen and (min-width: 0)' | '@media (prefers-color-scheme: dark)' | '@media (prefers-color-scheme: light)' | '@layer utilities' | '@layer base' | '@supports ()' | '@supports not ()';
declare type PredictTypeRules = {
[_ in PredictType]?: SupportedAllStyle;
[_ in PredictType]?: SupportStyle;
};
declare type CssPseudosRules = {
[_ in Pseudos]?: SupportedAllStyle;
[_ in Pseudos]?: SupportStyle;
};
declare type CssStringRules = {
[_ in IncludeChar<':' | '&' | ' ' | '@' | ',' | '>' | '~' | '+' | '['>]?: SupportStyle;
};
export declare type CssKeyframesRules = {
[_ in 'from' | 'to' | string]?: SupportedCssProperties;
[_ in 'from' | 'to']?: SupportProperties;
} & {
[_ in string]?: SupportProperties;
};

@@ -22,6 +27,6 @@ declare type CssAnimationNameProperty = {

};
export declare type SupportedCssProperties = Omit<PropertiesFallback<CssValue> & PropertiesHyphenFallback<CssValue> & SupportShorthandProperties, 'animationName' | 'animation-name'>;
declare type SupportedAllStyle = SupportedCssProperties & CssPseudosRules & PredictTypeRules & CssAnimationNameProperty;
export declare type KazeStyle = NestedObject<NestedObject<NestedObject<NestedObject<NestedObject<SupportedAllStyle>>>>>;
declare type SupportedGlobalStyle = PropertiesFallback<CssValue> & PropertiesHyphenFallback<CssValue>;
export declare type SupportProperties = Omit<PropertiesFallback<CssValue> & SupportShorthandProperties, 'animationName'>;
export declare type SupportStyle = SupportProperties & CssPseudosRules & PredictTypeRules & CssStringRules & CssAnimationNameProperty;
export declare type KazeStyle<T extends string> = Record<T, SupportStyle>;
export declare type SupportGlobalStyle = PropertiesFallback<CssValue>;
declare type FontFaceStyle = AtRule.FontFaceFallback<CssValue> & AtRule.FontFaceHyphenFallback<CssValue>;

@@ -32,6 +37,6 @@ declare type PredictGlobalSelector = 'body' | 'html' | '*' | '::before,::after' | '*,::before,::after';

} & {
[_ in PredictGlobalSelector]?: SupportedGlobalStyle;
} & Record<string, SupportedGlobalStyle> & Record<string, Record<string, AndArray<CssValue>>>;
[_ in PredictGlobalSelector]?: SupportGlobalStyle;
} & Record<string, SupportGlobalStyle> & Record<string, Record<string, AndArray<CssValue>>>;
export declare type Classes<K extends string> = Record<K, string>;
export declare type ClassesObject<K extends string> = Record<K, ClassName['object']>;
export {};
export declare type ValueOf<T> = T[keyof T];
export declare type AndArray<T> = T | T[];
export declare type NestedObject<T> = T | {
[_: string]: T;
};
export declare type IncludeChar<T extends string> = `${string}${T}${string}`;
export declare type TrimPrefix<S extends string, P extends string> = S extends `${P}${infer E}` ? E : S;

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

import type { SupportedCssProperties } from '../types/style';
export declare const compileObjectCss: (style: SupportedCssProperties) => string;
import type { SupportProperties } from '../types/style';
export declare const compileObjectCss: (style: SupportProperties) => string;

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

import{hyphenateProperty as o}from"./hyphenateProperty";const i=e=>{const s=[];for(const t in e){const r=e[t];(typeof r=="string"||typeof r=="number")&&s.push(o(t)+":"+(Array.isArray(r)?r.join(" "):r)+";")}return s.join("")};export{i as compileObjectCss};
import{hyphenateProperty as p}from"./hyphenateProperty";const i=t=>{const o=[];for(const e in t){const r=t[e];(typeof r=="string"||typeof r=="number")&&o.push(p(e)+":"+(Array.isArray(r)?r.join(" "):r)+";")}return o.join("")};export{i as compileObjectCss};

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

import type { CssValue, SupportedCssProperties } from '../types/style';
import type { CssValue, SupportProperties } from '../types/style';
import type { AndArray } from '../types/utils';
export declare function generateStyles<Styles extends SupportedCssProperties>(property: 'border' | 'padding' | 'margin', suffix: '' | 'Color' | 'Style' | 'Width', ...values: AndArray<CssValue>[]): Styles;
export declare function generateStyles<Styles extends SupportProperties>(property: 'border' | 'padding' | 'margin', suffix: '' | 'Color' | 'Style' | 'Width', ...values: AndArray<CssValue>[]): Styles;

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

const u=["Top","Right","Bottom","Left"];function d(l,n,...y){const[s,o=s,a=s,i=o]=y,t=[s,o,a,i],r={};for(let e=0;e<t.length;e+=1)if(t[e]||t[e]===0){const p=l+u[e]+n;r[p]=t[e]}return r}export{d as generateStyles};
const u=["Top","Right","Bottom","Left"];function f(l,n,...y){const[s,o=s,a=s,i=o]=y,e=[s,o,a,i],r={};for(let t=0;t<e.length;t+=1)if(e[t]||e[t]===0){const p=l+u[t]+n;r[p]=e[t]}return r}export{f as generateStyles};

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

import type { CssValue, KazeStyle } from '../types/style';
import type { CssValue, SupportStyle } from '../types/style';
import type { AndArray, ValueOf } from '../types/utils';
export declare const isCssValue: (styleValue: ValueOf<KazeStyle>) => styleValue is AndArray<CssValue>;
export declare const isCssValue: (styleValue: ValueOf<SupportStyle>) => styleValue is AndArray<CssValue>;

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

const r=e=>typeof e=="string"||typeof e=="number"||Array.isArray(e);export{r as isCssValue};
const t=r=>typeof r=="string"||typeof r=="number"||Array.isArray(r);export{t as isCssValue};

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

import type { KazeStyle } from '../types/style';
export declare const isShortHandProperty: (property: keyof KazeStyle) => property is "$margin" | "$padding" | "$gap" | "$inset" | "$overflow" | "$outline" | "$borderRadius";
import type { SupportStyle } from '../types/style';
export declare const isShortHandProperty: (property: keyof SupportStyle) => property is "$margin" | "$padding" | "$gap" | "$inset" | "$overflow" | "$outline" | "$borderRadius";

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

import type { CssValue, SupportShorthandProperties, SupportedCssProperties } from '../types/style';
import type { CssValue, SupportShorthandProperties, SupportProperties } from '../types/style';
import type { AndArray } from '../types/utils';
export declare const resolveShortHandStyle: (_property: keyof SupportShorthandProperties, styleValue: AndArray<CssValue>) => SupportedCssProperties;
export declare const resolveShortHandStyle: (_property: keyof SupportShorthandProperties, styleValue: AndArray<CssValue>) => SupportProperties;

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

import{generateStyles as a}from"./generateStyles";import{normalizeShorthandProperty as n}from"./normalizeShorthandProperty";const f=(u,l)=>{const o=Array.isArray(l)?l.map(e=>e.toString()):l.toString().split(" ").filter(e=>e!==""),t=n(u);if(t==="margin"||t==="padding")return a(t,"",...o);if(t==="gap"){const[e,r=e]=o;return{columnGap:e,rowGap:r}}else if(t==="inset"){const[e,r=e,s=e,i=r]=o;return{top:e,right:r,bottom:s,left:i}}else if(t==="borderRadius"){const[e,r=e,s=e,i=r]=o;return{borderTopLeftRadius:e,borderTopRightRadius:r,borderBottomRightRadius:s,borderBottomLeftRadius:i}}else if(t==="overflow"){const[e,r=e]=o;return{overflowX:e,overflowY:r}}else if(t==="outline"){const[e,r,s]=o;return{outlineWidth:e,...r&&{outlineColor:r},...s&&{outlineStyle:s}}}else return{}};export{f as resolveShortHandStyle};
import{generateStyles as a}from"./generateStyles";import{normalizeShorthandProperty as n}from"./normalizeShorthandProperty";const d=(u,l)=>{const o=Array.isArray(l)?l.map(e=>e.toString()):l.toString().split(" ").filter(e=>e!==""),t=n(u);if(t==="margin"||t==="padding")return a(t,"",...o);if(t==="gap"){const[e,r=e]=o;return{columnGap:e,rowGap:r}}else if(t==="inset"){const[e,r=e,s=e,i=r]=o;return{top:e,right:r,bottom:s,left:i}}else if(t==="borderRadius"){const[e,r=e,s=e,i=r]=o;return{borderTopLeftRadius:e,borderTopRightRadius:r,borderBottomRightRadius:s,borderBottomLeftRadius:i}}else if(t==="overflow"){const[e,r=e]=o;return{overflowX:e,overflowY:r}}else if(t==="outline"){const[e,r,s]=o;return{outlineWidth:e,...r&&{outlineColor:r},...s&&{outlineStyle:s}}}else return{}};export{d as resolveShortHandStyle};
{
"name": "@kaze-style/core",
"version": "0.7.1",
"version": "0.7.2",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": "Taishi Naritomi",

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