@codecademy/variance 0.24.1-alpha.91f97f.0 → 0.24.1-alpha.9b9cf1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.js
CHANGED
|
@@ -115,7 +115,10 @@ export const variance = {
|
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
},
|
|
118
|
-
compose(
|
|
118
|
+
compose() {
|
|
119
|
+
for (var _len = arguments.length, parsers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
120
|
+
parsers[_key] = arguments[_key];
|
|
121
|
+
}
|
|
119
122
|
return this.createParser(parsers.reduce((carry, parser) => ({
|
|
120
123
|
...carry,
|
|
121
124
|
...parser.config
|
|
@@ -135,9 +138,10 @@ export const variance = {
|
|
|
135
138
|
const staticCss = getStaticCss(cssProps, ['theme',
|
|
136
139
|
// Just in case this gets passed somehow
|
|
137
140
|
...selectors, ...filteredProps]);
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
return _ref => {
|
|
142
|
+
let {
|
|
143
|
+
theme
|
|
144
|
+
} = _ref;
|
|
141
145
|
if (cache) return cache;
|
|
142
146
|
const css = parser({
|
|
143
147
|
...cssProps,
|
|
@@ -165,12 +169,13 @@ export const variance = {
|
|
|
165
169
|
},
|
|
166
170
|
createVariant(config) {
|
|
167
171
|
const css = this.createCss(config);
|
|
168
|
-
return
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
return _ref2 => {
|
|
173
|
+
let {
|
|
174
|
+
prop = 'variant',
|
|
175
|
+
defaultVariant,
|
|
176
|
+
base = {},
|
|
177
|
+
variants
|
|
178
|
+
} = _ref2;
|
|
174
179
|
const baseFn = css(base);
|
|
175
180
|
const variantFns = {};
|
|
176
181
|
Object.keys(variants).forEach(key => {
|
|
@@ -48,8 +48,7 @@ declare class ThemeBuilder<T extends AbstractTheme> {
|
|
|
48
48
|
updateScale<Key extends keyof T, Fn extends (tokens: T[Key]) => Record<string | number, unknown>>(key: Key, updateFn: Fn): ThemeBuilder<T & Record<Key, T[Key] & ReturnType<Fn>>>;
|
|
49
49
|
/**
|
|
50
50
|
*
|
|
51
|
-
* @param name Adds
|
|
52
|
-
* This is used for referencing the theme for replacing default fonts.
|
|
51
|
+
* @param name Adds an accessible name to the theme
|
|
53
52
|
* @example .addName('core')
|
|
54
53
|
*/
|
|
55
54
|
addName(name: string): ThemeBuilder<MergeTheme<T & PrivateThemeKeys, Record<'name', string>>>;
|
|
@@ -3,7 +3,7 @@ import merge from 'lodash/merge';
|
|
|
3
3
|
import { flattenScale } from '../utils/flattenScale';
|
|
4
4
|
import { serializeTokens } from '../utils/serializeTokens';
|
|
5
5
|
class ThemeBuilder {
|
|
6
|
-
#theme = {};
|
|
6
|
+
#theme = (() => ({}))();
|
|
7
7
|
constructor(baseTheme) {
|
|
8
8
|
this.#theme = baseTheme;
|
|
9
9
|
}
|
|
@@ -108,8 +108,7 @@ class ThemeBuilder {
|
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
*
|
|
111
|
-
* @param name Adds
|
|
112
|
-
* This is used for referencing the theme for replacing default fonts.
|
|
111
|
+
* @param name Adds an accessible name to the theme
|
|
113
112
|
* @example .addName('core')
|
|
114
113
|
*/
|
|
115
114
|
addName(name) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/variance",
|
|
3
3
|
"description": "Constraint based CSS in JS for building scalable design systems",
|
|
4
|
-
"version": "0.24.1-alpha.
|
|
4
|
+
"version": "0.24.1-alpha.9b9cf1.0",
|
|
5
5
|
"author": "codecaaron <aaron@codecademy.com>",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"csstype": "^3.0.7",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"build": "nx build @codecademy/variance"
|
|
33
33
|
},
|
|
34
34
|
"types": "dist/index.d.ts",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "dc8003cd68f37512742116c205a1acda46d9a6cf"
|
|
36
36
|
}
|