@codecademy/variance 0.24.1-alpha.f41fe3.0 → 0.24.1-alpha.f7712b.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.
@@ -46,6 +46,13 @@ 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>>>;
49
56
  /**
50
57
  * This finalizes the theme build and returns the final theme and variables to be provided.
51
58
  */
@@ -106,6 +106,19 @@ 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
+
109
122
  /**
110
123
  * This finalizes the theme build and returns the final theme and variables to be provided.
111
124
  */
@@ -172,5 +172,9 @@ describe('createTheme', () => {
172
172
  }
173
173
  });
174
174
  });
175
+ it('adds a name to the theme', () => {
176
+ const theme = createTheme(base).addName('scoobyDoo').build();
177
+ expect(theme.name).toEqual('scoobyDoo');
178
+ });
175
179
  });
176
180
  });
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.f41fe3.0",
4
+ "version": "0.24.1-alpha.f7712b.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": "4ffd8960e52207aff52b45aebc0c1b926e347211"
35
+ "gitHead": "0e6a6da42071d60dd31d230fc38705e59d142f2c"
36
36
  }