@codecademy/variance 0.24.1-alpha.bd0e21.0 → 0.24.1-alpha.bd9682.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,10 +115,7 @@ export const variance = {
|
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
},
|
|
118
|
-
compose() {
|
|
119
|
-
for (var _len = arguments.length, parsers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
120
|
-
parsers[_key] = arguments[_key];
|
|
121
|
-
}
|
|
118
|
+
compose(...parsers) {
|
|
122
119
|
return this.createParser(parsers.reduce((carry, parser) => ({
|
|
123
120
|
...carry,
|
|
124
121
|
...parser.config
|
|
@@ -138,10 +135,9 @@ export const variance = {
|
|
|
138
135
|
const staticCss = getStaticCss(cssProps, ['theme',
|
|
139
136
|
// Just in case this gets passed somehow
|
|
140
137
|
...selectors, ...filteredProps]);
|
|
141
|
-
return
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
} = _ref;
|
|
138
|
+
return ({
|
|
139
|
+
theme
|
|
140
|
+
}) => {
|
|
145
141
|
if (cache) return cache;
|
|
146
142
|
const css = parser({
|
|
147
143
|
...cssProps,
|
|
@@ -169,13 +165,12 @@ export const variance = {
|
|
|
169
165
|
},
|
|
170
166
|
createVariant(config) {
|
|
171
167
|
const css = this.createCss(config);
|
|
172
|
-
return
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
} = _ref2;
|
|
168
|
+
return ({
|
|
169
|
+
prop = 'variant',
|
|
170
|
+
defaultVariant,
|
|
171
|
+
base = {},
|
|
172
|
+
variants
|
|
173
|
+
}) => {
|
|
179
174
|
const baseFn = css(base);
|
|
180
175
|
const variantFns = {};
|
|
181
176
|
Object.keys(variants).forEach(key => {
|
|
@@ -46,13 +46,6 @@ declare class ThemeBuilder<T extends AbstractTheme> {
|
|
|
46
46
|
* @example .updateScale('fonts', ({ basic }) => ({ basicFallback: `{basic}, Montserrat` }))
|
|
47
47
|
*/
|
|
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
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
* @param name Adds a name to the theme
|
|
52
|
-
* This is used for referencing the theme for replacing default fonts.
|
|
53
|
-
* @example .addName('core')
|
|
54
|
-
*/
|
|
55
|
-
addName(name: string): ThemeBuilder<MergeTheme<T & PrivateThemeKeys, Record<'name', string>>>;
|
|
56
49
|
/**
|
|
57
50
|
* This finalizes the theme build and returns the final theme and variables to be provided.
|
|
58
51
|
*/
|
|
@@ -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
|
}
|
|
@@ -106,19 +106,6 @@ class ThemeBuilder {
|
|
|
106
106
|
return this;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
/**
|
|
110
|
-
*
|
|
111
|
-
* @param name Adds a name to the theme
|
|
112
|
-
* This is used for referencing the theme for replacing default fonts.
|
|
113
|
-
* @example .addName('core')
|
|
114
|
-
*/
|
|
115
|
-
addName(name) {
|
|
116
|
-
this.#theme = merge({}, this.#theme, {
|
|
117
|
-
name
|
|
118
|
-
});
|
|
119
|
-
return this;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
109
|
/**
|
|
123
110
|
* This finalizes the theme build and returns the final theme and variables to be provided.
|
|
124
111
|
*/
|
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.bd9682.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": "2fa14cd7306c4807239a6d7e64fff32d81f3fc54"
|
|
36
36
|
}
|