@animus-ui/core 0.1.1-beta.15 → 0.1.1-beta.16
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 +8 -0
- package/dist/Animus.d.ts +1 -1
- package/dist/AnimusConfig.d.ts +1 -1
- package/dist/index.js +188 -188
- package/dist/legacy/config.d.ts +2 -2
- package/dist/legacy/core.d.ts +3 -3
- package/dist/legacy/responsive.d.ts +2 -2
- package/dist/styles/createPropertyStyle.d.ts +1 -1
- package/dist/styles/responsive.d.ts +1 -1
- package/dist/types/config.d.ts +4 -4
- package/package.json +2 -2
- package/tsconfig.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.16](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.15...@animus-ui/core@0.1.1-beta.16) (2022-02-02)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.1.1-beta.15](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.14...@animus-ui/core@0.1.1-beta.15) (2022-01-26)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @animus-ui/core
|
package/dist/Animus.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { CSSPropMap, CSSProps, Parser, Prop, SystemProps, VariantConfig } from './types/config';
|
|
2
3
|
import { AbstractProps, ThemeProps } from './types/props';
|
|
3
4
|
import { CSSObject } from './types/shared';
|
|
4
|
-
import { Parser, Prop, SystemProps, VariantConfig, CSSPropMap, CSSProps } from './types/config';
|
|
5
5
|
import { Arg } from './types/utils';
|
|
6
6
|
export declare class AnimusWithAll<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseParser extends Parser<PropRegistry>, BaseStyles extends CSSProps<AbstractProps, SystemProps<BaseParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<BaseParser>>, ActiveGroups extends Record<string, true>, CustomProps extends Record<string, Prop>> {
|
|
7
7
|
propRegistry: PropRegistry;
|
package/dist/AnimusConfig.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Prop } from './types/config';
|
|
2
1
|
import { Animus } from './Animus';
|
|
2
|
+
import { Prop } from './types/config';
|
|
3
3
|
export declare class AnimusConfig<C extends Record<string, Prop> = {}, G extends Record<string, (keyof C)[]> = {}> {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(config?: C, groups?: G);
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isNumber, get, isArray, isObject, isString, isUndefined, identity, mapValues, omit, intersection, merge, pick, isEmpty, set, keys } from 'lodash';
|
|
2
1
|
import _styled from '@emotion/styled/base';
|
|
2
|
+
import { isArray, isObject, get, isString, isUndefined, identity, mapValues, omit, intersection, merge, pick, isEmpty, set, isNumber, keys } from 'lodash';
|
|
3
3
|
|
|
4
4
|
function ownKeys(object, enumerableOnly) {
|
|
5
5
|
var keys = Object.keys(object);
|
|
@@ -330,103 +330,6 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
|
330
330
|
privateMap.set(obj, value);
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
var createScale = function createScale() {
|
|
334
|
-
return [];
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
var percentageOrAbsolute = function percentageOrAbsolute(coordinate) {
|
|
338
|
-
if (coordinate === 0) {
|
|
339
|
-
return coordinate;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
if (coordinate <= 1 && coordinate >= -1) {
|
|
343
|
-
return "".concat(coordinate * 100, "%");
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
return "".concat(coordinate, "px");
|
|
347
|
-
};
|
|
348
|
-
var valueWithUnit = /(-?\d*\.?\d+)(%|\w*)/;
|
|
349
|
-
var size = function size(value) {
|
|
350
|
-
if (isNumber(value)) {
|
|
351
|
-
return percentageOrAbsolute(value);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
if (value.includes('calc')) {
|
|
355
|
-
return value;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
var _ref = valueWithUnit.exec(value) || [],
|
|
359
|
-
_ref2 = _slicedToArray(_ref, 3),
|
|
360
|
-
match = _ref2[0],
|
|
361
|
-
number = _ref2[1],
|
|
362
|
-
unit = _ref2[2];
|
|
363
|
-
|
|
364
|
-
if (match === undefined) {
|
|
365
|
-
return value;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
var numericValue = parseFloat(number);
|
|
369
|
-
return !unit ? percentageOrAbsolute(numericValue) : "".concat(numericValue).concat(unit);
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
var gridItemMap = {
|
|
373
|
-
max: 'max-content',
|
|
374
|
-
min: 'min-content'
|
|
375
|
-
};
|
|
376
|
-
var unitlessNumber = new RegExp(/^[0-9]*$/);
|
|
377
|
-
|
|
378
|
-
var isUnitlessNumber = function isUnitlessNumber(val) {
|
|
379
|
-
return unitlessNumber.test(val);
|
|
380
|
-
};
|
|
381
|
-
|
|
382
|
-
var gridItem = function gridItem(item) {
|
|
383
|
-
var template = isUnitlessNumber(item) ? "".concat(item, "fr") : get(gridItemMap, item, item);
|
|
384
|
-
return "minmax(0, ".concat(template, ")");
|
|
385
|
-
};
|
|
386
|
-
var repeatGridItem = function repeatGridItem(item, count) {
|
|
387
|
-
var template = gridItem(item);
|
|
388
|
-
return count > 1 ? "repeat(".concat(count, ", ").concat(template, ")") : template;
|
|
389
|
-
};
|
|
390
|
-
var parseGridRatio = function parseGridRatio(val) {
|
|
391
|
-
var items = val.split(':');
|
|
392
|
-
var repeated = ['', 0];
|
|
393
|
-
var gridStyle = '';
|
|
394
|
-
|
|
395
|
-
for (var i = 0; i < items.length + 1; i += 1) {
|
|
396
|
-
var _repeated;
|
|
397
|
-
|
|
398
|
-
var delimiter = gridStyle.length > 0 ? ' ' : '';
|
|
399
|
-
var curr = items[i];
|
|
400
|
-
|
|
401
|
-
if (((_repeated = repeated) === null || _repeated === void 0 ? void 0 : _repeated[0]) !== curr) {
|
|
402
|
-
if (repeated[0].length) gridStyle += delimiter + repeatGridItem.apply(void 0, _toConsumableArray(repeated));
|
|
403
|
-
if (curr) repeated = [curr, 1];
|
|
404
|
-
} else {
|
|
405
|
-
repeated[1] += 1;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
return gridStyle;
|
|
410
|
-
};
|
|
411
|
-
var gridItemRatio = function gridItemRatio(val) {
|
|
412
|
-
return isNumber(val) ? repeatGridItem('1', val) : parseGridRatio(val);
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
var numberToTemplate = function numberToTemplate(val, template) {
|
|
416
|
-
return typeof val === 'number' ? template(val) : val;
|
|
417
|
-
};
|
|
418
|
-
var numberToPx = function numberToPx(val) {
|
|
419
|
-
return numberToTemplate(val, function (pixels) {
|
|
420
|
-
return "".concat(pixels, "px");
|
|
421
|
-
});
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
var borderShorthand = function borderShorthand(val) {
|
|
425
|
-
return numberToTemplate(val, function (width) {
|
|
426
|
-
return "".concat(width, "px solid currentColor");
|
|
427
|
-
});
|
|
428
|
-
};
|
|
429
|
-
|
|
430
333
|
var compatTheme = {
|
|
431
334
|
breakpoints: {
|
|
432
335
|
xs: 480,
|
|
@@ -454,6 +357,59 @@ var compatTheme = {
|
|
|
454
357
|
mode: undefined
|
|
455
358
|
};
|
|
456
359
|
|
|
360
|
+
var SHORTHAND_PROPERTIES = ['border', 'borderTop', 'borderBottom', 'borderLeft', 'borderRight', 'borderWidth', 'borderStyle', 'borderColor', 'background', 'flex', 'margin', 'padding', 'transition', 'gap', 'grid', 'gridArea', 'gridColumn', 'gridRow', 'gridTemplate', 'overflow', 'transition'];
|
|
361
|
+
var SORT = {
|
|
362
|
+
A_BEFORE_B: -1,
|
|
363
|
+
B_BEFORE_A: 1,
|
|
364
|
+
EQUAL: 1
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
var compare = function compare(a, b) {
|
|
368
|
+
if (a < b) return SORT.A_BEFORE_B;
|
|
369
|
+
if (b < a) return SORT.B_BEFORE_A;
|
|
370
|
+
return SORT.EQUAL;
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Orders all properties by the most dependent props
|
|
374
|
+
* @param config
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
var orderPropNames = function orderPropNames(config) {
|
|
379
|
+
return Object.keys(config).sort(function (a, b) {
|
|
380
|
+
var aConf = config[a],
|
|
381
|
+
bConf = config[b];
|
|
382
|
+
var aProp = aConf.property,
|
|
383
|
+
_aConf$properties = aConf.properties,
|
|
384
|
+
aProperties = _aConf$properties === void 0 ? [] : _aConf$properties;
|
|
385
|
+
var bProp = bConf.property,
|
|
386
|
+
_bConf$properties = bConf.properties,
|
|
387
|
+
bProperties = _bConf$properties === void 0 ? [] : _bConf$properties;
|
|
388
|
+
var aIsShorthand = SHORTHAND_PROPERTIES.includes(aProp);
|
|
389
|
+
var bIsShorthand = SHORTHAND_PROPERTIES.includes(bProp);
|
|
390
|
+
|
|
391
|
+
if (aIsShorthand && bIsShorthand) {
|
|
392
|
+
var aNum = aProperties.length;
|
|
393
|
+
var bNum = bProperties.length;
|
|
394
|
+
|
|
395
|
+
if (aProp !== bProp) {
|
|
396
|
+
return compare(SHORTHAND_PROPERTIES.indexOf(aProp), SHORTHAND_PROPERTIES.indexOf(bProp));
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (aProp === bProp) {
|
|
400
|
+
if (aNum === 0) return SORT.A_BEFORE_B;
|
|
401
|
+
if (bNum === 0) return SORT.B_BEFORE_A;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return compare(bNum, aNum);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (aIsShorthand) return SORT.A_BEFORE_B;
|
|
408
|
+
if (bIsShorthand) return SORT.B_BEFORE_A;
|
|
409
|
+
return SORT.EQUAL;
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
|
|
457
413
|
var lookupScaleValue = function lookupScaleValue(val, scale, theme) {
|
|
458
414
|
if (isArray(scale)) {
|
|
459
415
|
return val;
|
|
@@ -547,59 +503,6 @@ var createPropertyStyle = function createPropertyStyle(value, props, config) {
|
|
|
547
503
|
return styles;
|
|
548
504
|
};
|
|
549
505
|
|
|
550
|
-
var SHORTHAND_PROPERTIES = ['border', 'borderTop', 'borderBottom', 'borderLeft', 'borderRight', 'borderWidth', 'borderStyle', 'borderColor', 'background', 'flex', 'margin', 'padding', 'transition', 'gap', 'grid', 'gridArea', 'gridColumn', 'gridRow', 'gridTemplate', 'overflow', 'transition'];
|
|
551
|
-
var SORT = {
|
|
552
|
-
A_BEFORE_B: -1,
|
|
553
|
-
B_BEFORE_A: 1,
|
|
554
|
-
EQUAL: 1
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
var compare = function compare(a, b) {
|
|
558
|
-
if (a < b) return SORT.A_BEFORE_B;
|
|
559
|
-
if (b < a) return SORT.B_BEFORE_A;
|
|
560
|
-
return SORT.EQUAL;
|
|
561
|
-
};
|
|
562
|
-
/**
|
|
563
|
-
* Orders all properties by the most dependent props
|
|
564
|
-
* @param config
|
|
565
|
-
*/
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
var orderPropNames = function orderPropNames(config) {
|
|
569
|
-
return Object.keys(config).sort(function (a, b) {
|
|
570
|
-
var aConf = config[a],
|
|
571
|
-
bConf = config[b];
|
|
572
|
-
var aProp = aConf.property,
|
|
573
|
-
_aConf$properties = aConf.properties,
|
|
574
|
-
aProperties = _aConf$properties === void 0 ? [] : _aConf$properties;
|
|
575
|
-
var bProp = bConf.property,
|
|
576
|
-
_bConf$properties = bConf.properties,
|
|
577
|
-
bProperties = _bConf$properties === void 0 ? [] : _bConf$properties;
|
|
578
|
-
var aIsShorthand = SHORTHAND_PROPERTIES.includes(aProp);
|
|
579
|
-
var bIsShorthand = SHORTHAND_PROPERTIES.includes(bProp);
|
|
580
|
-
|
|
581
|
-
if (aIsShorthand && bIsShorthand) {
|
|
582
|
-
var aNum = aProperties.length;
|
|
583
|
-
var bNum = bProperties.length;
|
|
584
|
-
|
|
585
|
-
if (aProp !== bProp) {
|
|
586
|
-
return compare(SHORTHAND_PROPERTIES.indexOf(aProp), SHORTHAND_PROPERTIES.indexOf(bProp));
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
if (aProp === bProp) {
|
|
590
|
-
if (aNum === 0) return SORT.A_BEFORE_B;
|
|
591
|
-
if (bNum === 0) return SORT.B_BEFORE_A;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
return compare(bNum, aNum);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
if (aIsShorthand) return SORT.A_BEFORE_B;
|
|
598
|
-
if (bIsShorthand) return SORT.B_BEFORE_A;
|
|
599
|
-
return SORT.EQUAL;
|
|
600
|
-
});
|
|
601
|
-
};
|
|
602
|
-
|
|
603
506
|
var _excluded$1 = ["_"];
|
|
604
507
|
var BREAKPOINT_KEYS$1 = ['_', 'xs', 'sm', 'md', 'lg', 'xl'];
|
|
605
508
|
/**
|
|
@@ -997,7 +900,7 @@ var AnimusWithAll = /*#__PURE__*/function () {
|
|
|
997
900
|
return /*#__PURE__*/_styled(component, {
|
|
998
901
|
target: "e19x4vr0",
|
|
999
902
|
label: "AnimusWithAll"
|
|
1000
|
-
})(handler, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
903
|
+
})(handler, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFuaW11cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QmUiLCJmaWxlIjoiQW5pbXVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xyXG5pbXBvcnQgeyBtZXJnZSB9IGZyb20gJ2xvZGFzaCc7XHJcbmltcG9ydCB7IGNyZWF0ZVBhcnNlciB9IGZyb20gJy4vc3R5bGVzL2NyZWF0ZVBhcnNlcic7XHJcbmltcG9ydCB7IGNyZWF0ZVN0eWxpc3QgfSBmcm9tICcuL3N0eWxlcy9jcmVhdGVTdHlsaXN0JztcclxuZXhwb3J0IGNsYXNzIEFuaW11c1dpdGhBbGwge1xyXG4gICAgcHJvcFJlZ2lzdHJ5ID0ge307XHJcbiAgICBncm91cFJlZ2lzdHJ5ID0ge307XHJcbiAgICBwYXJzZXIgPSB7fTtcclxuICAgIGJhc2VTdHlsZXMgPSB7fTtcclxuICAgIHN0YXRlc0NvbmZpZyA9IHt9O1xyXG4gICAgdmFyaWFudHMgPSB7fTtcclxuICAgIGFjdGl2ZUdyb3VwcyA9IHt9O1xyXG4gICAgY3VzdG9tID0ge307XHJcbiAgICBjb25zdHJ1Y3Rvcihwcm9wcywgZ3JvdXBzLCBwYXJzZXIsIGJhc2UsIHZhcmlhbnRzLCBzdGF0ZXMsIGFjdGl2ZUdyb3VwcywgY3VzdG9tKSB7XHJcbiAgICAgICAgdGhpcy5wcm9wUmVnaXN0cnkgPSBwcm9wcztcclxuICAgICAgICB0aGlzLmdyb3VwUmVnaXN0cnkgPSBncm91cHM7XHJcbiAgICAgICAgdGhpcy5wYXJzZXIgPSBwYXJzZXI7XHJcbiAgICAgICAgdGhpcy5iYXNlU3R5bGVzID0gYmFzZTtcclxuICAgICAg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yXG4gICAgICAgIHJldHVybiBuZXcgQW5pbXVzV2l0aFZhcmlhbnRzKHRoaXMucHJvcFJlZ2lzdHJ5LCB0aGlzLmdyb3VwUmVnaXN0cnksIHRoaXMucGFyc2VyLCB0aGlzLmJhc2VTdHlsZXMsIG1lcmdlKHRoaXMudmFyaWFudHMsIHsgW3Byb3BdOiBvcHRpb25zIH0pKTtcclxuICAgIH1cclxufVxyXG5leHBvcnQgY2xhc3MgQW5pbXVzIGV4dGVuZHMgQW5pbXVzV2l0aEJhc2Uge1xyXG4gICAgY29uc3RydWN0b3IocHJvcHMsIGdyb3Vwcykge1xyXG4gICAgICAgIHN1cGVyKHByb3BzLCBncm91cHMsIGNyZWF0ZVBhcnNlcihwcm9wcyksIHt9KTtcclxuICAgIH1cclxuICAgIHN0eWxlcyhjb25maWcpIHtcclxuICAgICAgICByZXR1cm4gbmV3IEFuaW11c1dpdGhCYXNlKHRoaXMucHJvcFJlZ2lzdHJ5LCB0aGlzLmdyb3VwUmVnaXN0cnksIHRoaXMucGFyc2VyLCBjb25maWcpO1xyXG4gICAgfVxyXG59XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPUFuaW11cy5qcy5tYXAiXX0= */");
|
|
1001
904
|
}
|
|
1002
905
|
}, {
|
|
1003
906
|
key: "build",
|
|
@@ -1170,6 +1073,103 @@ var createAnimus = function createAnimus() {
|
|
|
1170
1073
|
return new AnimusConfig();
|
|
1171
1074
|
};
|
|
1172
1075
|
|
|
1076
|
+
var createScale = function createScale() {
|
|
1077
|
+
return [];
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
var percentageOrAbsolute = function percentageOrAbsolute(coordinate) {
|
|
1081
|
+
if (coordinate === 0) {
|
|
1082
|
+
return coordinate;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
if (coordinate <= 1 && coordinate >= -1) {
|
|
1086
|
+
return "".concat(coordinate * 100, "%");
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
return "".concat(coordinate, "px");
|
|
1090
|
+
};
|
|
1091
|
+
var valueWithUnit = /(-?\d*\.?\d+)(%|\w*)/;
|
|
1092
|
+
var size = function size(value) {
|
|
1093
|
+
if (isNumber(value)) {
|
|
1094
|
+
return percentageOrAbsolute(value);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
if (value.includes('calc')) {
|
|
1098
|
+
return value;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
var _ref = valueWithUnit.exec(value) || [],
|
|
1102
|
+
_ref2 = _slicedToArray(_ref, 3),
|
|
1103
|
+
match = _ref2[0],
|
|
1104
|
+
number = _ref2[1],
|
|
1105
|
+
unit = _ref2[2];
|
|
1106
|
+
|
|
1107
|
+
if (match === undefined) {
|
|
1108
|
+
return value;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
var numericValue = parseFloat(number);
|
|
1112
|
+
return !unit ? percentageOrAbsolute(numericValue) : "".concat(numericValue).concat(unit);
|
|
1113
|
+
};
|
|
1114
|
+
|
|
1115
|
+
var gridItemMap = {
|
|
1116
|
+
max: 'max-content',
|
|
1117
|
+
min: 'min-content'
|
|
1118
|
+
};
|
|
1119
|
+
var unitlessNumber = new RegExp(/^[0-9]*$/);
|
|
1120
|
+
|
|
1121
|
+
var isUnitlessNumber = function isUnitlessNumber(val) {
|
|
1122
|
+
return unitlessNumber.test(val);
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
var gridItem = function gridItem(item) {
|
|
1126
|
+
var template = isUnitlessNumber(item) ? "".concat(item, "fr") : get(gridItemMap, item, item);
|
|
1127
|
+
return "minmax(0, ".concat(template, ")");
|
|
1128
|
+
};
|
|
1129
|
+
var repeatGridItem = function repeatGridItem(item, count) {
|
|
1130
|
+
var template = gridItem(item);
|
|
1131
|
+
return count > 1 ? "repeat(".concat(count, ", ").concat(template, ")") : template;
|
|
1132
|
+
};
|
|
1133
|
+
var parseGridRatio = function parseGridRatio(val) {
|
|
1134
|
+
var items = val.split(':');
|
|
1135
|
+
var repeated = ['', 0];
|
|
1136
|
+
var gridStyle = '';
|
|
1137
|
+
|
|
1138
|
+
for (var i = 0; i < items.length + 1; i += 1) {
|
|
1139
|
+
var _repeated;
|
|
1140
|
+
|
|
1141
|
+
var delimiter = gridStyle.length > 0 ? ' ' : '';
|
|
1142
|
+
var curr = items[i];
|
|
1143
|
+
|
|
1144
|
+
if (((_repeated = repeated) === null || _repeated === void 0 ? void 0 : _repeated[0]) !== curr) {
|
|
1145
|
+
if (repeated[0].length) gridStyle += delimiter + repeatGridItem.apply(void 0, _toConsumableArray(repeated));
|
|
1146
|
+
if (curr) repeated = [curr, 1];
|
|
1147
|
+
} else {
|
|
1148
|
+
repeated[1] += 1;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
return gridStyle;
|
|
1153
|
+
};
|
|
1154
|
+
var gridItemRatio = function gridItemRatio(val) {
|
|
1155
|
+
return isNumber(val) ? repeatGridItem('1', val) : parseGridRatio(val);
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1158
|
+
var numberToTemplate = function numberToTemplate(val, template) {
|
|
1159
|
+
return typeof val === 'number' ? template(val) : val;
|
|
1160
|
+
};
|
|
1161
|
+
var numberToPx = function numberToPx(val) {
|
|
1162
|
+
return numberToTemplate(val, function (pixels) {
|
|
1163
|
+
return "".concat(pixels, "px");
|
|
1164
|
+
});
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
var borderShorthand = function borderShorthand(val) {
|
|
1168
|
+
return numberToTemplate(val, function (width) {
|
|
1169
|
+
return "".concat(width, "px solid currentColor");
|
|
1170
|
+
});
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
1173
|
var color = {
|
|
1174
1174
|
color: {
|
|
1175
1175
|
property: 'color',
|
|
@@ -1705,12 +1705,6 @@ var vars = {
|
|
|
1705
1705
|
var config = createAnimus().addGroup('flex', flex).addGroup('grid', grid).addGroup('mode', mode).addGroup('vars', vars).addGroup('space', space).addGroup('color', color).addGroup('layout', layout).addGroup('borders', border).addGroup('shadows', shadows).addGroup('background', background).addGroup('typography', typography).addGroup('positioning', positioning);
|
|
1706
1706
|
config.build();
|
|
1707
1707
|
|
|
1708
|
-
var getStylePropNames = function getStylePropNames(props, filteredKeys) {
|
|
1709
|
-
return pick(props, keys(props).filter(function (key) {
|
|
1710
|
-
return !filteredKeys.includes(key);
|
|
1711
|
-
}));
|
|
1712
|
-
};
|
|
1713
|
-
|
|
1714
1708
|
var _excluded = ["_"];
|
|
1715
1709
|
var BREAKPOINT_KEYS = ['_', 'xs', 'sm', 'md', 'lg', 'xl'];
|
|
1716
1710
|
/**
|
|
@@ -1868,6 +1862,16 @@ function createParser(config) {
|
|
|
1868
1862
|
});
|
|
1869
1863
|
}
|
|
1870
1864
|
|
|
1865
|
+
function compose() {
|
|
1866
|
+
for (var _len = arguments.length, parsers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1867
|
+
parsers[_key] = arguments[_key];
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
return createParser(parsers.reduce(function (carry, parser) {
|
|
1871
|
+
return _objectSpread2(_objectSpread2({}, carry), parser.config);
|
|
1872
|
+
}, {}));
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1871
1875
|
function createTransform(prop, config) {
|
|
1872
1876
|
var _config$transform = config.transform,
|
|
1873
1877
|
transform = _config$transform === void 0 ? identity : _config$transform,
|
|
@@ -1962,6 +1966,12 @@ function create(config) {
|
|
|
1962
1966
|
return createParser(transforms);
|
|
1963
1967
|
}
|
|
1964
1968
|
|
|
1969
|
+
var getStylePropNames = function getStylePropNames(props, filteredKeys) {
|
|
1970
|
+
return pick(props, keys(props).filter(function (key) {
|
|
1971
|
+
return !filteredKeys.includes(key);
|
|
1972
|
+
}));
|
|
1973
|
+
};
|
|
1974
|
+
|
|
1965
1975
|
function createCss(config) {
|
|
1966
1976
|
var parser = create(config);
|
|
1967
1977
|
var filteredProps = parser.propNames;
|
|
@@ -1998,6 +2008,26 @@ function createCss(config) {
|
|
|
1998
2008
|
};
|
|
1999
2009
|
}
|
|
2000
2010
|
|
|
2011
|
+
function createStates(config) {
|
|
2012
|
+
var css = createCss(config);
|
|
2013
|
+
return function (states) {
|
|
2014
|
+
var orderedStates = Object.keys(states);
|
|
2015
|
+
var stateFns = {};
|
|
2016
|
+
orderedStates.forEach(function (key) {
|
|
2017
|
+
var stateKey = key;
|
|
2018
|
+
var cssProps = states[stateKey];
|
|
2019
|
+
stateFns[stateKey] = css(cssProps);
|
|
2020
|
+
});
|
|
2021
|
+
return function (props) {
|
|
2022
|
+
var styles = {};
|
|
2023
|
+
orderedStates.forEach(function (state) {
|
|
2024
|
+
merge(styles, props[state] && stateFns[state](props));
|
|
2025
|
+
});
|
|
2026
|
+
return styles;
|
|
2027
|
+
};
|
|
2028
|
+
};
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2001
2031
|
function createVariant(config) {
|
|
2002
2032
|
var css = createCss(config);
|
|
2003
2033
|
return function (_ref) {
|
|
@@ -2026,36 +2056,6 @@ function createVariant(config) {
|
|
|
2026
2056
|
};
|
|
2027
2057
|
}
|
|
2028
2058
|
|
|
2029
|
-
function compose() {
|
|
2030
|
-
for (var _len = arguments.length, parsers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2031
|
-
parsers[_key] = arguments[_key];
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
|
-
return createParser(parsers.reduce(function (carry, parser) {
|
|
2035
|
-
return _objectSpread2(_objectSpread2({}, carry), parser.config);
|
|
2036
|
-
}, {}));
|
|
2037
|
-
}
|
|
2038
|
-
|
|
2039
|
-
function createStates(config) {
|
|
2040
|
-
var css = createCss(config);
|
|
2041
|
-
return function (states) {
|
|
2042
|
-
var orderedStates = Object.keys(states);
|
|
2043
|
-
var stateFns = {};
|
|
2044
|
-
orderedStates.forEach(function (key) {
|
|
2045
|
-
var stateKey = key;
|
|
2046
|
-
var cssProps = states[stateKey];
|
|
2047
|
-
stateFns[stateKey] = css(cssProps);
|
|
2048
|
-
});
|
|
2049
|
-
return function (props) {
|
|
2050
|
-
var styles = {};
|
|
2051
|
-
orderedStates.forEach(function (state) {
|
|
2052
|
-
merge(styles, props[state] && stateFns[state](props));
|
|
2053
|
-
});
|
|
2054
|
-
return styles;
|
|
2055
|
-
};
|
|
2056
|
-
};
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
2059
|
var animusProps = {
|
|
2060
2060
|
compose: compose,
|
|
2061
2061
|
create: create,
|
package/dist/legacy/config.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Theme } from '@emotion/react';
|
|
2
|
+
import { CSSPropMap, CSSProps } from '../types/config';
|
|
2
3
|
import { DefaultCSSPropertyValue, PropertyTypes } from '../types/properties';
|
|
3
|
-
import { CSSObject } from '../types/shared';
|
|
4
4
|
import { AbstractProps, ResponsiveProp, ThemeProps } from '../types/props';
|
|
5
|
-
import {
|
|
5
|
+
import { CSSObject } from '../types/shared';
|
|
6
6
|
import { AllUnionKeys, Key, KeyFromUnion } from '../types/utils';
|
|
7
7
|
export declare type MapScale = Record<string | number, string | number>;
|
|
8
8
|
export declare type ArrayScale = readonly (string | number | CSSObject)[] & {
|
package/dist/legacy/core.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createCss } from './createCss';
|
|
2
|
-
import { createVariant } from './createVariant';
|
|
3
|
-
import { create } from './create';
|
|
4
1
|
import { compose } from './compose';
|
|
2
|
+
import { create } from './create';
|
|
3
|
+
import { createCss } from './createCss';
|
|
5
4
|
import { createStates } from './createStates';
|
|
5
|
+
import { createVariant } from './createVariant';
|
|
6
6
|
export declare const animusProps: {
|
|
7
7
|
compose: typeof compose;
|
|
8
8
|
create: typeof create;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AbstractPropTransformer } from './config';
|
|
2
|
-
import { CSSObject } from '../types/shared';
|
|
3
1
|
import { MediaQueryCache, MediaQueryMap, ThemeProps } from '../types/props';
|
|
2
|
+
import { CSSObject } from '../types/shared';
|
|
4
3
|
import { Breakpoints } from '../types/theme';
|
|
4
|
+
import { AbstractPropTransformer } from './config';
|
|
5
5
|
export declare const createMediaQueries: (breakpoints?: Breakpoints | undefined) => MediaQueryCache | null;
|
|
6
6
|
export declare const isMediaArray: (val: unknown) => val is (string | number)[];
|
|
7
7
|
export declare const isMediaMap: (val: object) => val is MediaQueryMap<string | number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Prop } from '../types/config';
|
|
2
|
-
import { CSSObject } from '../types/shared';
|
|
3
2
|
import { AbstractProps } from '../types/props';
|
|
3
|
+
import { CSSObject } from '../types/shared';
|
|
4
4
|
export declare const createPropertyStyle: <Config extends Prop, Value>(value: Value, props: AbstractProps, config: Config) => CSSObject;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Prop } from '../types/config';
|
|
2
2
|
import { MediaQueryCache, MediaQueryMap, ThemeProps } from '../types/props';
|
|
3
|
-
import { Breakpoints } from '../types/theme';
|
|
4
3
|
import { CSSObject } from '../types/shared';
|
|
4
|
+
import { Breakpoints } from '../types/theme';
|
|
5
5
|
export declare const createMediaQueries: (breakpoints?: Breakpoints | undefined) => MediaQueryCache | null;
|
|
6
6
|
export declare const isMediaArray: (val: unknown) => val is (string | number)[];
|
|
7
7
|
export declare const isMediaMap: (val: object) => val is MediaQueryMap<string | number>;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Theme } from '@emotion/react';
|
|
2
|
-
import {
|
|
3
|
-
import { DefaultCSSPropertyValue, PropertyTypes
|
|
2
|
+
import { CompatTheme } from '../compatTheme';
|
|
3
|
+
import { CSSPropertyTypes, DefaultCSSPropertyValue, PropertyTypes } from './properties';
|
|
4
4
|
import { AbstractProps, ResponsiveProp, ThemeProps } from './props';
|
|
5
|
-
import { Arg } from './utils';
|
|
6
5
|
import { ArrayScale, MapScale } from './scales';
|
|
7
|
-
import {
|
|
6
|
+
import { CSSObject } from './shared';
|
|
7
|
+
import { Arg } from './utils';
|
|
8
8
|
export interface BaseProperty {
|
|
9
9
|
property: keyof PropertyTypes;
|
|
10
10
|
properties?: readonly (keyof PropertyTypes)[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/core",
|
|
3
3
|
"description": "Constraint based CSS in JS Foundations",
|
|
4
|
-
"version": "0.1.1-beta.
|
|
4
|
+
"version": "0.1.1-beta.16",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"emotion",
|
|
7
7
|
"css",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"csstype": "^3.0.7"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "7359d0512fd5a905fa96149c982bd00ee8245598"
|
|
40
40
|
}
|