@mattsjones/css-core
Advanced tools
Comparing version 0.0.9 to 0.0.10
# @mattsjones/css-core | ||
## 0.0.10 | ||
### Patch Changes | ||
- c94979f: Add `mapToStyles` function | ||
## 0.0.9 | ||
### Patch Changes | ||
@@ -5,0 +12,0 @@ |
@@ -7,2 +7,4 @@ import type { StyleRule } from './types'; | ||
export declare function style(rule: StyleRule, debugId?: string): string; | ||
export declare function mapToStyles<StyleMap extends Record<string | number, StyleRule>>(styleMap: StyleMap, debugId?: string): Record<keyof StyleMap, string>; | ||
export declare function mapToStyles<Data extends Record<string | number, unknown>>(data: Data, mapData: <Key extends keyof Data>(value: Data[Key], key: Key) => StyleRule, debugId?: string): Record<keyof Data, string>; | ||
declare type ThemeVars<ThemeContract> = MapLeafNodes<ThemeContract, string>; | ||
@@ -9,0 +11,0 @@ export declare function createThemeVars<ThemeContract>(themeContract: ThemeContract): ThemeVars<ThemeContract>; |
@@ -122,2 +122,26 @@ 'use strict'; | ||
} | ||
function mapToStyles(...args) { | ||
if (typeof args[1] === 'function') { | ||
const data = args[0]; | ||
const mapData = args[1]; | ||
const debugId = args[2]; | ||
const classMap = {}; | ||
for (const key in data) { | ||
classMap[key] = style(mapData(data[key], key), debugId ? `${debugId}_${key}` : key); | ||
} | ||
return classMap; | ||
} | ||
const styleMap = args[0]; | ||
const debugId = args[1]; | ||
const classMap = {}; | ||
for (const key in styleMap) { | ||
classMap[key] = style(styleMap[key], debugId ? `${debugId}_${key}` : key); | ||
} | ||
return classMap; | ||
} | ||
function createThemeVars(themeContract) { | ||
@@ -187,2 +211,3 @@ return walkObject(themeContract, (_value, path) => { | ||
exports.createVar = createVar; | ||
exports.mapToStyles = mapToStyles; | ||
exports.style = style; |
@@ -113,2 +113,26 @@ import { g as generateCss, s as sanitiseIdent } from './generateCss-a758bf8f.browser.esm.js'; | ||
} | ||
function mapToStyles(...args) { | ||
if (typeof args[1] === 'function') { | ||
const data = args[0]; | ||
const mapData = args[1]; | ||
const debugId = args[2]; | ||
const classMap = {}; | ||
for (const key in data) { | ||
classMap[key] = style(mapData(data[key], key), debugId ? `${debugId}_${key}` : key); | ||
} | ||
return classMap; | ||
} | ||
const styleMap = args[0]; | ||
const debugId = args[1]; | ||
const classMap = {}; | ||
for (const key in styleMap) { | ||
classMap[key] = style(styleMap[key], debugId ? `${debugId}_${key}` : key); | ||
} | ||
return classMap; | ||
} | ||
function createThemeVars(themeContract) { | ||
@@ -173,2 +197,2 @@ return walkObject(themeContract, (_value, path) => { | ||
export { createGlobalTheme, createInlineTheme, createTheme, createThemeVars, createVar, style }; | ||
export { createGlobalTheme, createInlineTheme, createTheme, createThemeVars, createVar, mapToStyles, style }; |
@@ -122,2 +122,26 @@ 'use strict'; | ||
} | ||
function mapToStyles(...args) { | ||
if (typeof args[1] === 'function') { | ||
const data = args[0]; | ||
const mapData = args[1]; | ||
const debugId = args[2]; | ||
const classMap = {}; | ||
for (const key in data) { | ||
classMap[key] = style(mapData(data[key], key), debugId ? `${debugId}_${key}` : key); | ||
} | ||
return classMap; | ||
} | ||
const styleMap = args[0]; | ||
const debugId = args[1]; | ||
const classMap = {}; | ||
for (const key in styleMap) { | ||
classMap[key] = style(styleMap[key], debugId ? `${debugId}_${key}` : key); | ||
} | ||
return classMap; | ||
} | ||
function createThemeVars(themeContract) { | ||
@@ -187,2 +211,3 @@ return walkObject(themeContract, (_value, path) => { | ||
exports.createVar = createVar; | ||
exports.mapToStyles = mapToStyles; | ||
exports.style = style; |
@@ -111,2 +111,26 @@ 'use strict'; | ||
} | ||
function mapToStyles(...args) { | ||
if (typeof args[1] === 'function') { | ||
const data = args[0]; | ||
const mapData = args[1]; | ||
args[2]; | ||
const classMap = {}; | ||
for (const key in data) { | ||
classMap[key] = style(mapData(data[key], key)); | ||
} | ||
return classMap; | ||
} | ||
const styleMap = args[0]; | ||
args[1]; | ||
const classMap = {}; | ||
for (const key in styleMap) { | ||
classMap[key] = style(styleMap[key]); | ||
} | ||
return classMap; | ||
} | ||
function createThemeVars(themeContract) { | ||
@@ -176,2 +200,3 @@ return walkObject(themeContract, (_value, path) => { | ||
exports.createVar = createVar; | ||
exports.mapToStyles = mapToStyles; | ||
exports.style = style; |
@@ -113,2 +113,26 @@ import { g as generateCss, s as sanitiseIdent } from './generateCss-addefd6f.esm.js'; | ||
} | ||
function mapToStyles(...args) { | ||
if (typeof args[1] === 'function') { | ||
const data = args[0]; | ||
const mapData = args[1]; | ||
const debugId = args[2]; | ||
const classMap = {}; | ||
for (const key in data) { | ||
classMap[key] = style(mapData(data[key], key), debugId ? `${debugId}_${key}` : key); | ||
} | ||
return classMap; | ||
} | ||
const styleMap = args[0]; | ||
const debugId = args[1]; | ||
const classMap = {}; | ||
for (const key in styleMap) { | ||
classMap[key] = style(styleMap[key], debugId ? `${debugId}_${key}` : key); | ||
} | ||
return classMap; | ||
} | ||
function createThemeVars(themeContract) { | ||
@@ -173,2 +197,2 @@ return walkObject(themeContract, (_value, path) => { | ||
export { createGlobalTheme, createInlineTheme, createTheme, createThemeVars, createVar, style }; | ||
export { createGlobalTheme, createInlineTheme, createTheme, createThemeVars, createVar, mapToStyles, style }; |
{ | ||
"name": "@mattsjones/css-core", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"main": "dist/mattsjones-css-core.cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/mattsjones-css-core.esm.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
101626
2471
0