@animus-ui/theming 0.1.1-beta.2 → 0.1.1-beta.22

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/CHANGELOG.md CHANGED
@@ -3,6 +3,166 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.1.1-beta.22](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.21...@animus-ui/theming@0.1.1-beta.22) (2022-03-25)
7
+
8
+ **Note:** Version bump only for package @animus-ui/theming
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.1.1-beta.21](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.20...@animus-ui/theming@0.1.1-beta.21) (2022-02-14)
15
+
16
+ **Note:** Version bump only for package @animus-ui/theming
17
+
18
+
19
+
20
+
21
+
22
+ ## [0.1.1-beta.20](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.19...@animus-ui/theming@0.1.1-beta.20) (2022-02-14)
23
+
24
+ **Note:** Version bump only for package @animus-ui/theming
25
+
26
+
27
+
28
+
29
+
30
+ ## [0.1.1-beta.19](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.18...@animus-ui/theming@0.1.1-beta.19) (2022-02-12)
31
+
32
+ **Note:** Version bump only for package @animus-ui/theming
33
+
34
+
35
+
36
+
37
+
38
+ ## [0.1.1-beta.18](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.17...@animus-ui/theming@0.1.1-beta.18) (2022-02-11)
39
+
40
+ **Note:** Version bump only for package @animus-ui/theming
41
+
42
+
43
+
44
+
45
+
46
+ ## [0.1.1-beta.17](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.16...@animus-ui/theming@0.1.1-beta.17) (2022-02-02)
47
+
48
+ **Note:** Version bump only for package @animus-ui/theming
49
+
50
+
51
+
52
+
53
+
54
+ ## [0.1.1-beta.16](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.15...@animus-ui/theming@0.1.1-beta.16) (2022-02-02)
55
+
56
+ **Note:** Version bump only for package @animus-ui/theming
57
+
58
+
59
+
60
+
61
+
62
+ ## [0.1.1-beta.15](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.14...@animus-ui/theming@0.1.1-beta.15) (2022-01-26)
63
+
64
+ **Note:** Version bump only for package @animus-ui/theming
65
+
66
+
67
+
68
+
69
+
70
+ ## [0.1.1-beta.14](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.13...@animus-ui/theming@0.1.1-beta.14) (2022-01-24)
71
+
72
+ **Note:** Version bump only for package @animus-ui/theming
73
+
74
+
75
+
76
+
77
+
78
+ ## [0.1.1-beta.13](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.12...@animus-ui/theming@0.1.1-beta.13) (2022-01-24)
79
+
80
+ **Note:** Version bump only for package @animus-ui/theming
81
+
82
+
83
+
84
+
85
+
86
+ ## [0.1.1-beta.12](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.11...@animus-ui/theming@0.1.1-beta.12) (2022-01-24)
87
+
88
+ **Note:** Version bump only for package @animus-ui/theming
89
+
90
+
91
+
92
+
93
+
94
+ ## [0.1.1-beta.11](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.10...@animus-ui/theming@0.1.1-beta.11) (2022-01-24)
95
+
96
+ **Note:** Version bump only for package @animus-ui/theming
97
+
98
+
99
+
100
+
101
+
102
+ ## [0.1.1-beta.10](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.9...@animus-ui/theming@0.1.1-beta.10) (2022-01-23)
103
+
104
+ **Note:** Version bump only for package @animus-ui/theming
105
+
106
+
107
+
108
+
109
+
110
+ ## [0.1.1-beta.9](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.8...@animus-ui/theming@0.1.1-beta.9) (2022-01-18)
111
+
112
+ **Note:** Version bump only for package @animus-ui/theming
113
+
114
+
115
+
116
+
117
+
118
+ ## [0.1.1-beta.8](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.7...@animus-ui/theming@0.1.1-beta.8) (2022-01-16)
119
+
120
+ **Note:** Version bump only for package @animus-ui/theming
121
+
122
+
123
+
124
+
125
+
126
+ ## [0.1.1-beta.7](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.6...@animus-ui/theming@0.1.1-beta.7) (2022-01-16)
127
+
128
+ **Note:** Version bump only for package @animus-ui/theming
129
+
130
+
131
+
132
+
133
+
134
+ ## [0.1.1-beta.6](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.5...@animus-ui/theming@0.1.1-beta.6) (2022-01-11)
135
+
136
+ **Note:** Version bump only for package @animus-ui/theming
137
+
138
+
139
+
140
+
141
+
142
+ ## [0.1.1-beta.5](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.4...@animus-ui/theming@0.1.1-beta.5) (2022-01-09)
143
+
144
+ **Note:** Version bump only for package @animus-ui/theming
145
+
146
+
147
+
148
+
149
+
150
+ ## [0.1.1-beta.4](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.3...@animus-ui/theming@0.1.1-beta.4) (2022-01-09)
151
+
152
+ **Note:** Version bump only for package @animus-ui/theming
153
+
154
+
155
+
156
+
157
+
158
+ ## [0.1.1-beta.3](https://github.com/codecaaron/animus/compare/@animus-ui/theming@0.1.1-beta.2...@animus-ui/theming@0.1.1-beta.3) (2022-01-09)
159
+
160
+ **Note:** Version bump only for package @animus-ui/theming
161
+
162
+
163
+
164
+
165
+
6
166
  ## 0.1.1-beta.2 (2022-01-09)
7
167
 
8
168
 
package/dist/index.js ADDED
@@ -0,0 +1,371 @@
1
+ import { isObject, merge, mapValues } from 'lodash';
2
+
3
+ function ownKeys(object, enumerableOnly) {
4
+ var keys = Object.keys(object);
5
+
6
+ if (Object.getOwnPropertySymbols) {
7
+ var symbols = Object.getOwnPropertySymbols(object);
8
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
9
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
10
+ })), keys.push.apply(keys, symbols);
11
+ }
12
+
13
+ return keys;
14
+ }
15
+
16
+ function _objectSpread2(target) {
17
+ for (var i = 1; i < arguments.length; i++) {
18
+ var source = null != arguments[i] ? arguments[i] : {};
19
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
20
+ _defineProperty(target, key, source[key]);
21
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
22
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
23
+ });
24
+ }
25
+
26
+ return target;
27
+ }
28
+
29
+ function _classCallCheck(instance, Constructor) {
30
+ if (!(instance instanceof Constructor)) {
31
+ throw new TypeError("Cannot call a class as a function");
32
+ }
33
+ }
34
+
35
+ function _defineProperties(target, props) {
36
+ for (var i = 0; i < props.length; i++) {
37
+ var descriptor = props[i];
38
+ descriptor.enumerable = descriptor.enumerable || false;
39
+ descriptor.configurable = true;
40
+ if ("value" in descriptor) descriptor.writable = true;
41
+ Object.defineProperty(target, descriptor.key, descriptor);
42
+ }
43
+ }
44
+
45
+ function _createClass(Constructor, protoProps, staticProps) {
46
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
47
+ if (staticProps) _defineProperties(Constructor, staticProps);
48
+ Object.defineProperty(Constructor, "prototype", {
49
+ writable: false
50
+ });
51
+ return Constructor;
52
+ }
53
+
54
+ function _defineProperty(obj, key, value) {
55
+ if (key in obj) {
56
+ Object.defineProperty(obj, key, {
57
+ value: value,
58
+ enumerable: true,
59
+ configurable: true,
60
+ writable: true
61
+ });
62
+ } else {
63
+ obj[key] = value;
64
+ }
65
+
66
+ return obj;
67
+ }
68
+
69
+ function _objectWithoutPropertiesLoose(source, excluded) {
70
+ if (source == null) return {};
71
+ var target = {};
72
+ var sourceKeys = Object.keys(source);
73
+ var key, i;
74
+
75
+ for (i = 0; i < sourceKeys.length; i++) {
76
+ key = sourceKeys[i];
77
+ if (excluded.indexOf(key) >= 0) continue;
78
+ target[key] = source[key];
79
+ }
80
+
81
+ return target;
82
+ }
83
+
84
+ function _objectWithoutProperties(source, excluded) {
85
+ if (source == null) return {};
86
+
87
+ var target = _objectWithoutPropertiesLoose(source, excluded);
88
+
89
+ var key, i;
90
+
91
+ if (Object.getOwnPropertySymbols) {
92
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
93
+
94
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
95
+ key = sourceSymbolKeys[i];
96
+ if (excluded.indexOf(key) >= 0) continue;
97
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
98
+ target[key] = source[key];
99
+ }
100
+ }
101
+
102
+ return target;
103
+ }
104
+
105
+ function _classPrivateFieldGet(receiver, privateMap) {
106
+ var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
107
+
108
+ return _classApplyDescriptorGet(receiver, descriptor);
109
+ }
110
+
111
+ function _classPrivateFieldSet(receiver, privateMap, value) {
112
+ var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
113
+
114
+ _classApplyDescriptorSet(receiver, descriptor, value);
115
+
116
+ return value;
117
+ }
118
+
119
+ function _classExtractFieldDescriptor(receiver, privateMap, action) {
120
+ if (!privateMap.has(receiver)) {
121
+ throw new TypeError("attempted to " + action + " private field on non-instance");
122
+ }
123
+
124
+ return privateMap.get(receiver);
125
+ }
126
+
127
+ function _classApplyDescriptorGet(receiver, descriptor) {
128
+ if (descriptor.get) {
129
+ return descriptor.get.call(receiver);
130
+ }
131
+
132
+ return descriptor.value;
133
+ }
134
+
135
+ function _classApplyDescriptorSet(receiver, descriptor, value) {
136
+ if (descriptor.set) {
137
+ descriptor.set.call(receiver, value);
138
+ } else {
139
+ if (!descriptor.writable) {
140
+ throw new TypeError("attempted to set read only private field");
141
+ }
142
+
143
+ descriptor.value = value;
144
+ }
145
+ }
146
+
147
+ function _checkPrivateRedeclaration(obj, privateCollection) {
148
+ if (privateCollection.has(obj)) {
149
+ throw new TypeError("Cannot initialize the same private elements twice on an object");
150
+ }
151
+ }
152
+
153
+ function _classPrivateFieldInitSpec(obj, privateMap, value) {
154
+ _checkPrivateRedeclaration(obj, privateMap);
155
+
156
+ privateMap.set(obj, value);
157
+ }
158
+
159
+ function flattenScale(object, path) {
160
+ return Object.keys(object).reduce(function (carry, key) {
161
+ var nextKey = path ? "".concat(path).concat(key === '_' ? '' : "-".concat(key)) : key;
162
+ var current = object[key];
163
+
164
+ if (isObject(current)) {
165
+ return _objectSpread2(_objectSpread2({}, carry), flattenScale(current, nextKey));
166
+ }
167
+
168
+ return _objectSpread2(_objectSpread2({}, carry), {}, _defineProperty({}, nextKey, object[key]));
169
+ }, {});
170
+ }
171
+
172
+ var _excluded = ["_"];
173
+
174
+ var templateBreakpoints = function templateBreakpoints(value, alias, theme) {
175
+ if (isObject(value)) {
176
+ var _ = value._,
177
+ rest = _objectWithoutProperties(value, _excluded);
178
+
179
+ var css = _defineProperty({}, alias, _);
180
+
181
+ if (theme) {
182
+ var breakpoints = theme.breakpoints;
183
+ Object.keys(breakpoints).forEach(function (key) {
184
+ if (rest[key]) {
185
+ css[breakpoints[key]] = _defineProperty({}, alias, rest[key]);
186
+ }
187
+ });
188
+ }
189
+
190
+ return css;
191
+ }
192
+
193
+ return _defineProperty({}, alias, value);
194
+ };
195
+
196
+ var serializeTokens = function serializeTokens(tokens, prefix, theme) {
197
+ var tokenReferences = {};
198
+ var tokenVariables = {};
199
+ Object.keys(tokens).forEach(function (key) {
200
+ var varName = "--".concat(prefix, "-").concat(key.replace('$', ''));
201
+ tokenReferences[key] = "var(".concat(varName, ")");
202
+ merge(tokenVariables, templateBreakpoints(tokens[key], varName, theme));
203
+ });
204
+ return {
205
+ tokens: tokenReferences,
206
+ variables: tokenVariables
207
+ };
208
+ };
209
+
210
+ var _theme = /*#__PURE__*/new WeakMap();
211
+
212
+ var ThemeBuilder = /*#__PURE__*/function () {
213
+ function ThemeBuilder(baseTheme) {
214
+ _classCallCheck(this, ThemeBuilder);
215
+
216
+ _classPrivateFieldInitSpec(this, _theme, {
217
+ writable: true,
218
+ value: {}
219
+ });
220
+
221
+ _classPrivateFieldSet(this, _theme, baseTheme);
222
+ }
223
+ /**
224
+ *
225
+ * @param key A key of the current theme to transform into CSS Variables and Variable References
226
+ * @example .createScaleVariables('fontSize')
227
+ */
228
+
229
+
230
+ _createClass(ThemeBuilder, [{
231
+ key: "createScaleVariables",
232
+ value: function createScaleVariables(key) {
233
+ var _merge;
234
+
235
+ var _serializeTokens = serializeTokens(_classPrivateFieldGet(this, _theme)[key], key, _classPrivateFieldGet(this, _theme)),
236
+ variables = _serializeTokens.variables,
237
+ tokens = _serializeTokens.tokens;
238
+
239
+ _classPrivateFieldSet(this, _theme, merge({}, _classPrivateFieldGet(this, _theme), (_merge = {}, _defineProperty(_merge, key, tokens), _defineProperty(_merge, "_variables", _defineProperty({}, key, variables)), _defineProperty(_merge, "_tokens", _defineProperty({}, key, _classPrivateFieldGet(this, _theme)[key])), _merge)));
240
+
241
+ return this;
242
+ }
243
+ /**
244
+ *
245
+ * @param colors A map of color tokens to add to the theme. These tokens are immediately converted to CSS Variables `--color-${key}`.
246
+ * @example .addColors({ navy: 'navy', hyper: 'purple' })
247
+ */
248
+
249
+ }, {
250
+ key: "addColors",
251
+ value: function addColors(colors) {
252
+ var flatColors = flattenScale(colors);
253
+
254
+ var _serializeTokens2 = serializeTokens(flatColors, 'color', _classPrivateFieldGet(this, _theme)),
255
+ variables = _serializeTokens2.variables,
256
+ tokens = _serializeTokens2.tokens;
257
+
258
+ _classPrivateFieldSet(this, _theme, merge({}, _classPrivateFieldGet(this, _theme), {
259
+ colors: tokens,
260
+ _variables: {
261
+ root: variables
262
+ },
263
+ _tokens: {
264
+ colors: flatColors
265
+ }
266
+ }));
267
+
268
+ return this;
269
+ }
270
+ /**
271
+ *
272
+ * @param initialMode A key of the object passed for modes. This sets the default state for the theme and transforms the correct variables.
273
+ * @param modes A map of color modes with keys of each possible mode with a value of alias to color keys. This must be called after `addColors`
274
+ * @example .addColorModes('light', { light: { primary: 'hyper' }, { dark: { primary: 'navy' } } })
275
+ */
276
+
277
+ }, {
278
+ key: "addColorModes",
279
+ value: function addColorModes(initialMode, modeConfig) {
280
+ var _classPrivateFieldGet2,
281
+ _this = this;
282
+
283
+ var modes = mapValues(modeConfig, function (mode) {
284
+ return flattenScale(mode);
285
+ });
286
+
287
+ var _serializeTokens3 = serializeTokens(mapValues(merge({}, (_classPrivateFieldGet2 = _classPrivateFieldGet(this, _theme).modes) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2[initialMode], modes[initialMode]), function (color) {
288
+ return _classPrivateFieldGet(_this, _theme).colors[color];
289
+ }), 'color', _classPrivateFieldGet(this, _theme)),
290
+ colors = _serializeTokens3.tokens,
291
+ variables = _serializeTokens3.variables;
292
+
293
+ var getColorValue = function getColorValue(color) {
294
+ var _classPrivateFieldGet3, _classPrivateFieldGet4;
295
+
296
+ return (_classPrivateFieldGet3 = _classPrivateFieldGet(_this, _theme)._tokens) === null || _classPrivateFieldGet3 === void 0 ? void 0 : (_classPrivateFieldGet4 = _classPrivateFieldGet3.colors) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4[color];
297
+ };
298
+
299
+ _classPrivateFieldSet(this, _theme, merge({}, _classPrivateFieldGet(this, _theme), {
300
+ colors: colors,
301
+ modes: modes,
302
+ mode: initialMode,
303
+ _getColorValue: getColorValue,
304
+ _variables: {
305
+ mode: variables
306
+ },
307
+ _tokens: {
308
+ modes: mapValues(modes, function (mode) {
309
+ return mapValues(mode, getColorValue);
310
+ })
311
+ }
312
+ }));
313
+
314
+ return this;
315
+ }
316
+ /**
317
+ *
318
+ * @param key A new key of theme
319
+ * @param createScale A function that accepts the current theme and returns a new object of scale values.
320
+ * @example .addScale('fonts', () => ({ basic: 'Gotham', cool: 'Wingdings' }))
321
+ */
322
+
323
+ }, {
324
+ key: "addScale",
325
+ value: function addScale(key, createScale) {
326
+ _classPrivateFieldSet(this, _theme, merge({}, _classPrivateFieldGet(this, _theme), _defineProperty({}, key, flattenScale(createScale(_classPrivateFieldGet(this, _theme))))));
327
+
328
+ return this;
329
+ }
330
+ /**
331
+ *
332
+ * @param key A current key of theme to be updated with new or computed values
333
+ * @param updateFn A function that accepts an argument of the current values at the specified keys an returns a map of new values to merge.
334
+ * @example .updateScale('fonts', ({ basic }) => ({ basicFallback: `{basic}, Montserrat` }))
335
+ */
336
+
337
+ }, {
338
+ key: "updateScale",
339
+ value: function updateScale(key, updateFn) {
340
+ _classPrivateFieldSet(this, _theme, merge({}, _classPrivateFieldGet(this, _theme), _defineProperty({}, key, updateFn(_classPrivateFieldGet(this, _theme)[key]))));
341
+
342
+ return this;
343
+ }
344
+ /**
345
+ * This finalizes the theme build and returns the final theme and variables to be provided.
346
+ */
347
+
348
+ }, {
349
+ key: "build",
350
+ value: function build() {
351
+ var _serializeTokens4 = serializeTokens(mapValues(_classPrivateFieldGet(this, _theme).breakpoints, function (val) {
352
+ return "".concat(val, "px");
353
+ }), 'breakpoint', _classPrivateFieldGet(this, _theme)),
354
+ variables = _serializeTokens4.variables;
355
+
356
+ return merge({}, _classPrivateFieldGet(this, _theme), {
357
+ _variables: {
358
+ breakpoints: variables
359
+ },
360
+ _tokens: {}
361
+ });
362
+ }
363
+ }]);
364
+
365
+ return ThemeBuilder;
366
+ }();
367
+ function createTheme(base) {
368
+ return new ThemeBuilder(base);
369
+ }
370
+
371
+ export { ThemeBuilder, createTheme, flattenScale, serializeTokens };
@@ -1,4 +1,4 @@
1
- import { CSSObject, AbstractTheme } from '@animus-ui/core';
1
+ import { AbstractTheme, CSSObject } from '@animus-ui/core';
2
2
  import { LiteralPaths } from './flattenScale';
3
3
  import { KeyAsVariable } from './serializeTokens';
4
4
  import { ColorModeConfig, Merge, MergeTheme, PrivateThemeKeys } from './types';
@@ -17,4 +17,4 @@ export declare type PathToLiteral<T, K extends Path<T, D>, D extends string = '.
17
17
  export declare type LiteralPaths<T extends Record<string | number, any>, D extends string = '.', Base extends string = ''> = {
18
18
  [K in Path<T, D> as PathToLiteral<T, K, D, Base>]: PathValue<T, PathToLiteral<T, K, D>, D>;
19
19
  };
20
- export declare function flattenScale<T extends Record<string | number, any>, P extends string>(object: T, path?: P): LiteralPaths<T, '-', '_'>;
20
+ export declare function flattenScale<T extends Record<string | number, unknown>, P extends string>(object: T, path?: P): LiteralPaths<T, '-', '_'>;
@@ -1,11 +1,12 @@
1
- import { Theme } from '@emotion/react';
2
1
  import { CSSObject } from '@animus-ui/core';
2
+ import { Theme } from '@emotion/react';
3
3
  /**
4
4
  * Returns an type of any object with { key: 'var(--key) }
5
5
  */
6
6
  export declare type KeyAsVariable<T extends Record<string, any>, Prefix extends string> = {
7
- [V in keyof T]: `var(--${Prefix}-${Extract<V, string>})`;
7
+ [V in keyof T]: `var(--${Prefix}-${SanitizeKey<Extract<V, string>>})`;
8
8
  };
9
+ export declare type SanitizeKey<T extends string> = T extends `${'$'}${infer Y}` ? Y : T;
9
10
  declare type SerializedTokensInput = Record<string, string | number | CSSObject | SerializedTokensInputRecursive>;
10
11
  interface SerializedTokensInputRecursive {
11
12
  [i: number]: SerializedTokensInput;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@animus-ui/theming",
3
- "version": "0.1.1-beta.2",
4
- "description": "> TODO: description",
3
+ "version": "0.1.1-beta.22",
4
+ "description": "Theming Utilities",
5
5
  "author": "Aaron Robb <airrobb@gmail.com>",
6
6
  "homepage": "https://github.com/codecaaron/animus#readme",
7
7
  "license": "MIT",
8
- "main": "dist/index.cjs.js",
9
- "module": "dist/index.esm.js",
8
+ "module": "./dist/index.js",
9
+ "main": "./dist/index.js",
10
10
  "types": "dist/index.d.ts",
11
11
  "publishConfig": {
12
12
  "access": "public"
@@ -18,13 +18,14 @@
18
18
  "scripts": {
19
19
  "build:clean": "rm -rf ./dist",
20
20
  "build": "yarn build:clean && rollup -c",
21
- "lernaBuildTask": "yarn build"
21
+ "lernaBuildTask": "yarn build",
22
+ "compile": "tsc --noEmit"
22
23
  },
23
24
  "bugs": {
24
25
  "url": "https://github.com/codecaaron/animus/issues"
25
26
  },
26
27
  "dependencies": {
27
- "@animus-ui/core": "^0.1.1-beta.2"
28
+ "@animus-ui/core": "^0.1.1-beta.21"
28
29
  },
29
30
  "peerDependencies": {
30
31
  "@emotion/react": ">=11.0.0",
@@ -32,5 +33,5 @@
32
33
  "lodash": "*",
33
34
  "typescript": ">=4.3.5"
34
35
  },
35
- "gitHead": "10f4d6df3d99fb8e9105b48111aeb3c31ca8335f"
36
+ "gitHead": "53751c58349dc7d5848465fe539552ea2f285954"
36
37
  }
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
- // "emitDeclarationOnly": true,
4
+ "skipLibCheck": false,
5
5
  "outDir": "./dist"
6
6
  },
7
7
  "include": ["../../typings/*.d.ts", "./src/**/*.ts", "./src/**/*.tsx"],
package/dist/index.cjs.js DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("lodash");function t(s,r){return Object.keys(s).reduce(((o,h)=>{const i=r?`${r}${"_"===h?"":`-${h}`}`:h,a=s[h];return e.isObject(a)?{...o,...t(a,i)}:{...o,[i]:s[h]}}),{})}const s=(t,s,r)=>{const o={},h={};return Object.keys(t).forEach((i=>{const a=`--${s}-${i}`;o[i]=`var(${a})`,e.merge(h,((t,s,r)=>{if(e.isObject(t)){const{_:e,base:o,...h}=t,i={[s]:e??o};if(r){const{breakpoints:e}=r;Object.keys(e).forEach((t=>{i[e[t]]={[s]:h[t]}}))}return i}return{[s]:t}})(t[i],a,r))})),{tokens:o,variables:h}};class r{#e={};constructor(e){this.#e=e}createScaleVariables(t){const{variables:r,tokens:o}=s(this.#e[t],t,this.#e);return this.#e=e.merge({},this.#e,{[t]:o,_variables:{root:r},_tokens:{[t]:this.#e[t]}}),this}addColors(r){const o=t(r),{variables:h,tokens:i}=s(o,"color",this.#e);return this.#e=e.merge({},this.#e,{colors:i,_variables:{root:h},_tokens:{colors:o}}),this}addColorModes(r,o){const h=e.mapValues(o,(e=>t(e))),{tokens:i,variables:a}=s(e.mapValues(e.merge({},this.#e.modes?.[r],h[r]),(e=>this.#e.colors[e])),"color",this.#e),m=e=>this.#e._tokens?.colors?.[e];return this.#e=e.merge({},this.#e,{colors:i,modes:h,mode:r,_getColorValue:m,_variables:{mode:a},_tokens:{modes:e.mapValues(h,(t=>e.mapValues(t,m)))}}),this}addScale(s,r){return this.#e=e.merge({},this.#e,{[s]:t(r(this.#e))}),this}updateScale(t,s){return this.#e=e.merge({},this.#e,{[t]:s(this.#e[t])}),this}build(){return e.merge({},this.#e,{_variables:{},_tokens:{}})}}exports.ThemeBuilder=r,exports.createTheme=function(e){return new r(e)},exports.flattenScale=t,exports.serializeTokens=s;
package/dist/index.esm.js DELETED
@@ -1 +0,0 @@
1
- import{isObject as e,merge as t,mapValues as s}from"lodash";function o(t,s){return Object.keys(t).reduce(((r,h)=>{const i=s?`${s}${"_"===h?"":`-${h}`}`:h,n=t[h];return e(n)?{...r,...o(n,i)}:{...r,[i]:t[h]}}),{})}const r=(s,o,r)=>{const h={},i={};return Object.keys(s).forEach((n=>{const a=`--${o}-${n}`;h[n]=`var(${a})`,t(i,((t,s,o)=>{if(e(t)){const{_:e,base:r,...h}=t,i={[s]:e??r};if(o){const{breakpoints:e}=o;Object.keys(e).forEach((t=>{i[e[t]]={[s]:h[t]}}))}return i}return{[s]:t}})(s[n],a,r))})),{tokens:h,variables:i}};class h{#e={};constructor(e){this.#e=e}createScaleVariables(e){const{variables:s,tokens:o}=r(this.#e[e],e,this.#e);return this.#e=t({},this.#e,{[e]:o,_variables:{root:s},_tokens:{[e]:this.#e[e]}}),this}addColors(e){const s=o(e),{variables:h,tokens:i}=r(s,"color",this.#e);return this.#e=t({},this.#e,{colors:i,_variables:{root:h},_tokens:{colors:s}}),this}addColorModes(e,h){const i=s(h,(e=>o(e))),{tokens:n,variables:a}=r(s(t({},this.#e.modes?.[e],i[e]),(e=>this.#e.colors[e])),"color",this.#e),c=e=>this.#e._tokens?.colors?.[e];return this.#e=t({},this.#e,{colors:n,modes:i,mode:e,_getColorValue:c,_variables:{mode:a},_tokens:{modes:s(i,(e=>s(e,c)))}}),this}addScale(e,s){return this.#e=t({},this.#e,{[e]:o(s(this.#e))}),this}updateScale(e,s){return this.#e=t({},this.#e,{[e]:s(this.#e[e])}),this}build(){return t({},this.#e,{_variables:{},_tokens:{}})}}function i(e){return new h(e)}export{h as ThemeBuilder,i as createTheme,o as flattenScale,r as serializeTokens};