@homebound/truss 1.108.0 → 1.110.1
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/build/breakpoints.d.ts +0 -1
- package/build/breakpoints.js +11 -11
- package/build/breakpoints.js.map +1 -1
- package/build/breakpoints.test.d.ts +0 -1
- package/build/breakpoints.test.js +4 -4
- package/build/breakpoints.test.js.map +1 -1
- package/build/config.d.ts +4 -6
- package/build/generate.d.ts +0 -1
- package/build/generate.js +21 -18
- package/build/generate.js.map +1 -1
- package/build/index.d.ts +3 -3
- package/build/index.js +7 -3
- package/build/index.js.map +1 -1
- package/build/methods.d.ts +1 -2
- package/build/methods.js +35 -30
- package/build/methods.js.map +1 -1
- package/build/methods.test.d.ts +0 -1
- package/build/methods.test.js +3 -3
- package/build/methods.test.js.map +1 -1
- package/build/sections/tachyons/border.d.ts +2 -0
- package/build/sections/{border.js → tachyons/border.js} +14 -9
- package/build/sections/tachyons/border.js.map +1 -0
- package/build/sections/tachyons/borderColors.d.ts +2 -0
- package/build/sections/{borderColors.js → tachyons/borderColors.js} +3 -3
- package/build/sections/tachyons/borderColors.js.map +1 -0
- package/build/sections/tachyons/borderRadius.d.ts +2 -0
- package/build/sections/{borderRadius.js → tachyons/borderRadius.js} +2 -2
- package/build/sections/tachyons/borderRadius.js.map +1 -0
- package/build/sections/tachyons/borderStyles.d.ts +2 -0
- package/build/sections/{borderStyles.js → tachyons/borderStyles.js} +2 -2
- package/build/sections/tachyons/borderStyles.js.map +1 -0
- package/build/sections/tachyons/borderWidths.d.ts +2 -0
- package/build/sections/{borderWidths.js → tachyons/borderWidths.js} +2 -2
- package/build/sections/tachyons/borderWidths.js.map +1 -0
- package/build/sections/tachyons/boxShadow.d.ts +2 -0
- package/build/sections/{boxShadow.js → tachyons/boxShadow.js} +2 -2
- package/build/sections/tachyons/boxShadow.js.map +1 -0
- package/build/sections/tachyons/coordinates.d.ts +2 -0
- package/build/sections/{coordinates.js → tachyons/coordinates.js} +2 -2
- package/build/sections/tachyons/coordinates.js.map +1 -0
- package/build/sections/tachyons/cursor.d.ts +2 -0
- package/build/sections/{cursor.js → tachyons/cursor.js} +11 -6
- package/build/sections/tachyons/cursor.js.map +1 -0
- package/build/sections/tachyons/display.d.ts +2 -0
- package/build/sections/{display.js → tachyons/display.js} +2 -2
- package/build/sections/tachyons/display.js.map +1 -0
- package/build/sections/tachyons/flexbox.d.ts +2 -0
- package/build/sections/{flexbox.js → tachyons/flexbox.js} +16 -11
- package/build/sections/tachyons/flexbox.js.map +1 -0
- package/build/sections/tachyons/floats.d.ts +2 -0
- package/build/sections/{floats.js → tachyons/floats.js} +2 -2
- package/build/sections/tachyons/floats.js.map +1 -0
- package/build/sections/tachyons/fontWeight.d.ts +2 -0
- package/build/sections/{fontWeight.js → tachyons/fontWeight.js} +2 -2
- package/build/sections/tachyons/fontWeight.js.map +1 -0
- package/build/sections/tachyons/grid.d.ts +2 -0
- package/build/sections/tachyons/grid.js +37 -0
- package/build/sections/tachyons/grid.js.map +1 -0
- package/build/sections/tachyons/heights.d.ts +2 -0
- package/build/sections/{heights.js → tachyons/heights.js} +15 -10
- package/build/sections/tachyons/heights.js.map +1 -0
- package/build/sections/tachyons/index.d.ts +35 -0
- package/build/sections/{index.js → tachyons/index.js} +0 -0
- package/build/sections/tachyons/index.js.map +1 -0
- package/build/sections/tachyons/lineClamp.d.ts +2 -0
- package/build/sections/{lineClamp.js → tachyons/lineClamp.js} +14 -9
- package/build/sections/tachyons/lineClamp.js.map +1 -0
- package/build/sections/tachyons/objectFit.d.ts +2 -0
- package/build/sections/{objectFit.js → tachyons/objectFit.js} +2 -2
- package/build/sections/tachyons/objectFit.js.map +1 -0
- package/build/sections/tachyons/outlines.d.ts +2 -0
- package/build/sections/{outlines.js → tachyons/outlines.js} +2 -2
- package/build/sections/tachyons/outlines.js.map +1 -0
- package/build/sections/tachyons/overflow.d.ts +2 -0
- package/build/sections/{overflow.js → tachyons/overflow.js} +13 -8
- package/build/sections/tachyons/overflow.js.map +1 -0
- package/build/sections/tachyons/position.d.ts +2 -0
- package/build/sections/{position.js → tachyons/position.js} +2 -2
- package/build/sections/tachyons/position.js.map +1 -0
- package/build/sections/tachyons/skins.d.ts +2 -0
- package/build/sections/tachyons/skins.js +51 -0
- package/build/sections/tachyons/skins.js.map +1 -0
- package/build/sections/tachyons/spacing.d.ts +2 -0
- package/build/sections/{spacing.js → tachyons/spacing.js} +12 -7
- package/build/sections/tachyons/spacing.js.map +1 -0
- package/build/sections/tachyons/textAlign.d.ts +2 -0
- package/build/sections/{textAlign.js → tachyons/textAlign.js} +2 -2
- package/build/sections/tachyons/textAlign.js.map +1 -0
- package/build/sections/tachyons/textDecoration.d.ts +2 -0
- package/build/sections/{textDecoration.js → tachyons/textDecoration.js} +2 -2
- package/build/sections/tachyons/textDecoration.js.map +1 -0
- package/build/sections/tachyons/textTransform.d.ts +2 -0
- package/build/sections/{textTransform.js → tachyons/textTransform.js} +2 -2
- package/build/sections/tachyons/textTransform.js.map +1 -0
- package/build/sections/tachyons/typeScale.d.ts +2 -0
- package/build/sections/{typeScale.js → tachyons/typeScale.js} +3 -3
- package/build/sections/tachyons/typeScale.js.map +1 -0
- package/build/sections/tachyons/typography.d.ts +2 -0
- package/build/sections/tachyons/typography.js +24 -0
- package/build/sections/tachyons/typography.js.map +1 -0
- package/build/sections/tachyons/userSelect.d.ts +2 -0
- package/build/sections/{userSelect.js → tachyons/userSelect.js} +2 -2
- package/build/sections/tachyons/userSelect.js.map +1 -0
- package/build/sections/tachyons/verticalAlign.d.ts +2 -0
- package/build/sections/{verticalAlign.js → tachyons/verticalAlign.js} +2 -2
- package/build/sections/tachyons/verticalAlign.js.map +1 -0
- package/build/sections/tachyons/visibility.d.ts +2 -0
- package/build/sections/{visibility.js → tachyons/visibility.js} +2 -2
- package/build/sections/tachyons/visibility.js.map +1 -0
- package/build/sections/tachyons/whitespace.d.ts +2 -0
- package/build/sections/{whitespace.js → tachyons/whitespace.js} +2 -2
- package/build/sections/tachyons/whitespace.js.map +1 -0
- package/build/sections/tachyons/widths.d.ts +2 -0
- package/build/sections/tachyons/widths.js +49 -0
- package/build/sections/tachyons/widths.js.map +1 -0
- package/build/sections/tachyons/wordBreak.d.ts +2 -0
- package/build/sections/{wordBreak.js → tachyons/wordBreak.js} +2 -2
- package/build/sections/tachyons/wordBreak.js.map +1 -0
- package/build/sections/tachyons/zIndex.d.ts +2 -0
- package/build/sections/{zIndex.js → tachyons/zIndex.js} +11 -6
- package/build/sections/tachyons/zIndex.js.map +1 -0
- package/build/utils.d.ts +0 -1
- package/build/utils.js +1 -1
- package/build/utils.js.map +1 -1
- package/package.json +9 -17
- package/.nvmrc +0 -1
- package/README.markdown +0 -373
- package/build/breakpoints.d.ts.map +0 -1
- package/build/breakpoints.test.d.ts.map +0 -1
- package/build/config.d.ts.map +0 -1
- package/build/generate.d.ts.map +0 -1
- package/build/index.d.ts.map +0 -1
- package/build/methods.d.ts.map +0 -1
- package/build/methods.test.d.ts.map +0 -1
- package/build/sections/border.d.ts +0 -3
- package/build/sections/border.d.ts.map +0 -1
- package/build/sections/border.js.map +0 -1
- package/build/sections/borderColors.d.ts +0 -3
- package/build/sections/borderColors.d.ts.map +0 -1
- package/build/sections/borderColors.js.map +0 -1
- package/build/sections/borderRadius.d.ts +0 -3
- package/build/sections/borderRadius.d.ts.map +0 -1
- package/build/sections/borderRadius.js.map +0 -1
- package/build/sections/borderStyles.d.ts +0 -3
- package/build/sections/borderStyles.d.ts.map +0 -1
- package/build/sections/borderStyles.js.map +0 -1
- package/build/sections/borderWidths.d.ts +0 -3
- package/build/sections/borderWidths.d.ts.map +0 -1
- package/build/sections/borderWidths.js.map +0 -1
- package/build/sections/boxShadow.d.ts +0 -3
- package/build/sections/boxShadow.d.ts.map +0 -1
- package/build/sections/boxShadow.js.map +0 -1
- package/build/sections/coordinates.d.ts +0 -3
- package/build/sections/coordinates.d.ts.map +0 -1
- package/build/sections/coordinates.js.map +0 -1
- package/build/sections/cursor.d.ts +0 -3
- package/build/sections/cursor.d.ts.map +0 -1
- package/build/sections/cursor.js.map +0 -1
- package/build/sections/display.d.ts +0 -3
- package/build/sections/display.d.ts.map +0 -1
- package/build/sections/display.js.map +0 -1
- package/build/sections/flexbox.d.ts +0 -3
- package/build/sections/flexbox.d.ts.map +0 -1
- package/build/sections/flexbox.js.map +0 -1
- package/build/sections/floats.d.ts +0 -3
- package/build/sections/floats.d.ts.map +0 -1
- package/build/sections/floats.js.map +0 -1
- package/build/sections/fontWeight.d.ts +0 -3
- package/build/sections/fontWeight.d.ts.map +0 -1
- package/build/sections/fontWeight.js.map +0 -1
- package/build/sections/grid.d.ts +0 -3
- package/build/sections/grid.d.ts.map +0 -1
- package/build/sections/grid.js +0 -32
- package/build/sections/grid.js.map +0 -1
- package/build/sections/heights.d.ts +0 -3
- package/build/sections/heights.d.ts.map +0 -1
- package/build/sections/heights.js.map +0 -1
- package/build/sections/index.d.ts +0 -36
- package/build/sections/index.d.ts.map +0 -1
- package/build/sections/index.js.map +0 -1
- package/build/sections/lineClamp.d.ts +0 -3
- package/build/sections/lineClamp.d.ts.map +0 -1
- package/build/sections/lineClamp.js.map +0 -1
- package/build/sections/objectFit.d.ts +0 -3
- package/build/sections/objectFit.d.ts.map +0 -1
- package/build/sections/objectFit.js.map +0 -1
- package/build/sections/outlines.d.ts +0 -3
- package/build/sections/outlines.d.ts.map +0 -1
- package/build/sections/outlines.js.map +0 -1
- package/build/sections/overflow.d.ts +0 -3
- package/build/sections/overflow.d.ts.map +0 -1
- package/build/sections/overflow.js.map +0 -1
- package/build/sections/position.d.ts +0 -3
- package/build/sections/position.d.ts.map +0 -1
- package/build/sections/position.js.map +0 -1
- package/build/sections/skins.d.ts +0 -3
- package/build/sections/skins.d.ts.map +0 -1
- package/build/sections/skins.js +0 -46
- package/build/sections/skins.js.map +0 -1
- package/build/sections/spacing.d.ts +0 -3
- package/build/sections/spacing.d.ts.map +0 -1
- package/build/sections/spacing.js.map +0 -1
- package/build/sections/textAlign.d.ts +0 -3
- package/build/sections/textAlign.d.ts.map +0 -1
- package/build/sections/textAlign.js.map +0 -1
- package/build/sections/textDecoration.d.ts +0 -3
- package/build/sections/textDecoration.d.ts.map +0 -1
- package/build/sections/textDecoration.js.map +0 -1
- package/build/sections/textTransform.d.ts +0 -3
- package/build/sections/textTransform.d.ts.map +0 -1
- package/build/sections/textTransform.js.map +0 -1
- package/build/sections/typeScale.d.ts +0 -3
- package/build/sections/typeScale.d.ts.map +0 -1
- package/build/sections/typeScale.js.map +0 -1
- package/build/sections/typography.d.ts +0 -3
- package/build/sections/typography.d.ts.map +0 -1
- package/build/sections/typography.js +0 -24
- package/build/sections/typography.js.map +0 -1
- package/build/sections/userSelect.d.ts +0 -3
- package/build/sections/userSelect.d.ts.map +0 -1
- package/build/sections/userSelect.js.map +0 -1
- package/build/sections/verticalAlign.d.ts +0 -3
- package/build/sections/verticalAlign.d.ts.map +0 -1
- package/build/sections/verticalAlign.js.map +0 -1
- package/build/sections/visibility.d.ts +0 -3
- package/build/sections/visibility.d.ts.map +0 -1
- package/build/sections/visibility.js.map +0 -1
- package/build/sections/whitespace.d.ts +0 -3
- package/build/sections/whitespace.d.ts.map +0 -1
- package/build/sections/whitespace.js.map +0 -1
- package/build/sections/widths.d.ts +0 -3
- package/build/sections/widths.d.ts.map +0 -1
- package/build/sections/widths.js +0 -44
- package/build/sections/widths.js.map +0 -1
- package/build/sections/wordBreak.d.ts +0 -3
- package/build/sections/wordBreak.d.ts.map +0 -1
- package/build/sections/wordBreak.js.map +0 -1
- package/build/sections/zIndex.d.ts +0 -3
- package/build/sections/zIndex.d.ts.map +0 -1
- package/build/sections/zIndex.js.map +0 -1
- package/build/utils.d.ts.map +0 -1
- package/logo.svg +0 -11
- package/package.json.bak +0 -38
- package/tsconfig.json +0 -20
package/build/breakpoints.d.ts
CHANGED
package/build/breakpoints.js
CHANGED
|
@@ -33,48 +33,48 @@ function makeBreakpoints(breakpoints) {
|
|
|
33
33
|
var isFirst = i === 0;
|
|
34
34
|
var isLast = i === bps.length - 1;
|
|
35
35
|
// Calc this breakpoint's min/max, which is its px --> the next bp's px - 1
|
|
36
|
-
var min = !isFirst ? px
|
|
37
|
-
var max = !isLast ? breakpoints[bps[i + 1]] - 1
|
|
36
|
+
var min = !isFirst ? "".concat(px, "px") : "0";
|
|
37
|
+
var max = !isLast ? "".concat(breakpoints[bps[i + 1]] - 1, "px") : "0";
|
|
38
38
|
// Make a rule for exactly this breakpoint, i.e. "just sm" or "just md".
|
|
39
39
|
if (isFirst) {
|
|
40
40
|
// Don't bother with min-width on the smallest bp
|
|
41
|
-
r[bp] = "@media screen and (max-width:"
|
|
41
|
+
r[bp] = "@media screen and (max-width:".concat(max, ")");
|
|
42
42
|
}
|
|
43
43
|
else if (isLast) {
|
|
44
44
|
// Don't bother with max-width on the largest bp
|
|
45
|
-
r[bp] = "@media screen and (min-width:"
|
|
45
|
+
r[bp] = "@media screen and (min-width:".concat(min, ")");
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
|
-
r[bp] = "@media screen and (min-width:"
|
|
48
|
+
r[bp] = "@media screen and (min-width:".concat(min, ") and (max-width:").concat(max, ")");
|
|
49
49
|
}
|
|
50
50
|
// Make combinations of neighbors, i.e. smOrMd or mdOrLg. We could go further, like smOrMdOrLg, but that seems excessive.
|
|
51
51
|
if (!isFirst) {
|
|
52
52
|
var isSecond = i === 1;
|
|
53
53
|
var prevBp = bps[i - 1];
|
|
54
|
-
var name = prevBp
|
|
54
|
+
var name = "".concat(prevBp, "Or").concat(capitalize(bp));
|
|
55
55
|
var rule = "@media screen";
|
|
56
56
|
// If we're the `firstOrSecond` combination, we can skip min-width.
|
|
57
57
|
if (!isSecond) {
|
|
58
58
|
var prevMin = breakpoints[bps[i - 1]];
|
|
59
|
-
rule += " and (min-width:"
|
|
59
|
+
rule += " and (min-width:".concat(prevMin, "px)");
|
|
60
60
|
}
|
|
61
61
|
// If we're the `secondToLastOrLast` combination, we can skip max-width.
|
|
62
62
|
if (!isLast) {
|
|
63
|
-
rule += " and (max-width:"
|
|
63
|
+
rule += " and (max-width:".concat(max, ")");
|
|
64
64
|
}
|
|
65
65
|
r[name] = rule;
|
|
66
66
|
}
|
|
67
67
|
// Make up/down variants for any "middle" breakpoints, i.e. `smUp` is "everything" and
|
|
68
68
|
// `smDown` is "just sm", so skip both of those, and same for largest `lgUp`/`lgDown` bp.
|
|
69
69
|
if (!isFirst && !isLast) {
|
|
70
|
-
r[bp
|
|
71
|
-
r[bp
|
|
70
|
+
r["".concat(bp, "AndUp")] = "@media screen and (min-width:".concat(min, ")");
|
|
71
|
+
r["".concat(bp, "AndDown")] = "@media screen and (max-width:".concat(max, ")");
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
return r;
|
|
75
75
|
}
|
|
76
76
|
exports.makeBreakpoints = makeBreakpoints;
|
|
77
77
|
function capitalize(s) {
|
|
78
|
-
return ""
|
|
78
|
+
return "".concat(s[0].toUpperCase()).concat(s.substring(1));
|
|
79
79
|
}
|
|
80
80
|
//# sourceMappingURL=breakpoints.js.map
|
package/build/breakpoints.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.js","sourceRoot":"","sources":["../src/breakpoints.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,SAAgB,eAAe,CAC7B,WAAmC;IAEnC,IAAM,CAAC,GAA2B;QAChC,KAAK,EAAE,cAAc;KACtB,CAAC;IACF,IAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,UAAC,EAAQ,EAAE,CAAC;YAAX,KAAA,aAAQ,EAAP,EAAE,QAAA,EAAE,EAAE,QAAA;QAC1C,IAAM,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;QACxB,IAAM,MAAM,GAAG,CAAC,KAAK,GAAG,CAAC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HAAyH;QACzH,IAAI,CAAC,OAAO,EAAE;YACZ,IAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,CAAC;YACzB,IAAM,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1B,IAAM,IAAI,GAAG,UAAG,MAAM,eAAK,UAAU,CAAC,EAAE,CAAC,CAAE,CAAC;YAC5C,IAAI,IAAI,GAAG,eAAe,CAAC;YAC3B,mEAAmE;YACnE,IAAI,CAAC,QAAQ,EAAE;gBACb,IAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBACxC,IAAI,IAAI,0BAAmB,OAAO,QAAK,CAAC;aACzC;YACD,wEAAwE;YACxE,IAAI,CAAC,MAAM,EAAE;gBACX,IAAI,IAAI,0BAAmB,GAAG,MAAG,CAAC;aACnC;YACD,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;SAChB;QAED,sFAAsF;QACtF,yFAAyF;QACzF,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE;YACvB,CAAC,CAAC,UAAG,EAAE,UAAO,CAAC,GAAG,uCAAgC,GAAG,MAAG,CAAC;YACzD,CAAC,CAAC,UAAG,EAAE,YAAS,CAAC,GAAG,uCAAgC,GAAG,MAAG,CAAC;SAC5D;IACH,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,CAAC;AACX,CAAC;AAnDD,0CAmDC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,UAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,SAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAE,CAAC;AAClD,CAAC"}
|
|
@@ -4,13 +4,13 @@ var breakpoints_1 = require("./breakpoints");
|
|
|
4
4
|
describe("breakpoints", function () {
|
|
5
5
|
it("works with one breakpoint", function () {
|
|
6
6
|
// this doesn't really make sense, but just make sure it doesn't blow up
|
|
7
|
-
expect(breakpoints_1.makeBreakpoints({ sm: 0 })).toEqual({
|
|
7
|
+
expect((0, breakpoints_1.makeBreakpoints)({ sm: 0 })).toEqual({
|
|
8
8
|
print: "@media print",
|
|
9
9
|
sm: "@media screen and (max-width:0)",
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
12
|
it("works with two breakpoints", function () {
|
|
13
|
-
expect(breakpoints_1.makeBreakpoints({ sm: 0, lg: 600 })).toEqual({
|
|
13
|
+
expect((0, breakpoints_1.makeBreakpoints)({ sm: 0, lg: 600 })).toEqual({
|
|
14
14
|
print: "@media print",
|
|
15
15
|
sm: "@media screen and (max-width:599px)",
|
|
16
16
|
lg: "@media screen and (min-width:600px)",
|
|
@@ -18,7 +18,7 @@ describe("breakpoints", function () {
|
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
20
|
it("works with three breakpoints", function () {
|
|
21
|
-
expect(breakpoints_1.makeBreakpoints({ sm: 0, md: 600, lg: 960 })).toEqual({
|
|
21
|
+
expect((0, breakpoints_1.makeBreakpoints)({ sm: 0, md: 600, lg: 960 })).toEqual({
|
|
22
22
|
print: "@media print",
|
|
23
23
|
sm: "@media screen and (max-width:599px)",
|
|
24
24
|
md: "@media screen and (min-width:600px) and (max-width:959px)",
|
|
@@ -30,7 +30,7 @@ describe("breakpoints", function () {
|
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
it("works with four breakpoints", function () {
|
|
33
|
-
expect(breakpoints_1.makeBreakpoints({ sm: 0, md: 600, lg: 960, xl: 1200 })).toEqual({
|
|
33
|
+
expect((0, breakpoints_1.makeBreakpoints)({ sm: 0, md: 600, lg: 960, xl: 1200 })).toEqual({
|
|
34
34
|
print: "@media print",
|
|
35
35
|
sm: "@media screen and (max-width:599px)",
|
|
36
36
|
md: "@media screen and (min-width:600px) and (max-width:959px)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.test.js","sourceRoot":"","sources":["../src/breakpoints.test.ts"],"names":[],"mappings":";;AAA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EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YACrE,KAAK,EAAE,cAAc;YACrB,EAAE,EAAE,qCAAqC;YACzC,EAAE,EAAE,2DAA2D;YAC/D,EAAE,EAAE,4DAA4D;YAChE,EAAE,EAAE,sCAAsC;YAC1C,MAAM,EAAE,qCAAqC;YAC7C,MAAM,EAAE,4DAA4D;YACpE,MAAM,EAAE,qCAAqC;YAC7C,OAAO,EAAE,qCAAqC;YAC9C,SAAS,EAAE,qCAAqC;YAChD,OAAO,EAAE,qCAAqC;YAC9C,SAAS,EAAE,sCAAsC;SAClD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/build/config.d.ts
CHANGED
|
@@ -64,9 +64,8 @@ export interface Config {
|
|
|
64
64
|
extras?: Array<string | Code>;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
* A
|
|
68
|
-
*
|
|
69
|
-
* file.
|
|
67
|
+
* A function takes the project's `Config` and produces a list of utility methods to
|
|
68
|
+
* add to the generated `Css.ts` file.
|
|
70
69
|
*
|
|
71
70
|
* I.e. a return value might be:
|
|
72
71
|
*
|
|
@@ -80,7 +79,7 @@ export interface Config {
|
|
|
80
79
|
* See the `newMethod` and `newParamMethod` functions for more easily
|
|
81
80
|
* creating the `get ...() { ... }` output.
|
|
82
81
|
*/
|
|
83
|
-
export declare type
|
|
82
|
+
export declare type CreateMethodsFn = (config: Config) => UtilityMethod[];
|
|
84
83
|
/**
|
|
85
84
|
* A type-alias to clarify strings that are meant to be abbreviation/utility names.
|
|
86
85
|
*/
|
|
@@ -96,7 +95,6 @@ export declare type UtilityMethod = string;
|
|
|
96
95
|
/** A type-alias to clarify groups of utility methods. */
|
|
97
96
|
export declare type SectionName = string;
|
|
98
97
|
/** A type-alias for a group of utility methods. */
|
|
99
|
-
export declare type Sections = Record<SectionName,
|
|
98
|
+
export declare type Sections = Record<SectionName, CreateMethodsFn>;
|
|
100
99
|
/** A type-alias for aliasing existing utility methods as a new utility method. */
|
|
101
100
|
export declare type Aliases = Record<UtilityName, UtilityName[]>;
|
|
102
|
-
//# sourceMappingURL=config.d.ts.map
|
package/build/generate.d.ts
CHANGED
package/build/generate.js
CHANGED
|
@@ -66,9 +66,14 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
66
66
|
}
|
|
67
67
|
return ar;
|
|
68
68
|
};
|
|
69
|
-
var
|
|
70
|
-
for (var
|
|
71
|
-
|
|
69
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
70
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
71
|
+
if (ar || !(i in from)) {
|
|
72
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
73
|
+
ar[i] = from[i];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
72
77
|
};
|
|
73
78
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74
79
|
exports.generate = exports.defaultTypeAliases = void 0;
|
|
@@ -76,7 +81,7 @@ var fs_1 = require("fs");
|
|
|
76
81
|
var ts_poet_1 = require("ts-poet");
|
|
77
82
|
var breakpoints_1 = require("./breakpoints");
|
|
78
83
|
var methods_1 = require("./methods");
|
|
79
|
-
var
|
|
84
|
+
var tachyons_1 = require("./sections/tachyons");
|
|
80
85
|
var utils_1 = require("./utils");
|
|
81
86
|
exports.defaultTypeAliases = {
|
|
82
87
|
Margin: ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"],
|
|
@@ -111,36 +116,34 @@ function generateCssBuilder(config) {
|
|
|
111
116
|
var aliases = config.aliases, fonts = config.fonts, increment = config.increment, extras = config.extras, typeAliases = config.typeAliases, breakpoints = config.breakpoints, palette = config.palette, _a = config.defaultMethods, defaultMethods = _a === void 0 ? "tachyons" : _a, customSections = config.sections;
|
|
112
117
|
// Combine our out-of-the-box utility methods with any custom ones
|
|
113
118
|
var sections = __assign(__assign(__assign({}, (defaultMethods === "tachyons"
|
|
114
|
-
? generateMethods(config,
|
|
115
|
-
: {})), (customSections ? generateMethods(config, customSections) : {})), (aliases && { aliases: methods_1.newAliasesMethods(aliases) }));
|
|
116
|
-
var Properties = ts_poet_1.imp("Properties@csstype");
|
|
119
|
+
? generateMethods(config, tachyons_1.defaultSections)
|
|
120
|
+
: {})), (customSections ? generateMethods(config, customSections) : {})), (aliases && { aliases: (0, methods_1.newAliasesMethods)(aliases) }));
|
|
121
|
+
var Properties = (0, ts_poet_1.imp)("Properties@csstype");
|
|
117
122
|
var lines = Object.entries(sections)
|
|
118
123
|
.map(function (_a) {
|
|
119
124
|
var _b = __read(_a, 2), name = _b[0], value = _b[1];
|
|
120
|
-
return
|
|
125
|
+
return __spreadArray(__spreadArray(["// ".concat(name)], __read(value), false), [""], false);
|
|
121
126
|
})
|
|
122
127
|
.flat();
|
|
123
128
|
var typeAliasCode = Object.entries(__assign(__assign({}, exports.defaultTypeAliases), typeAliases)).map(function (_a) {
|
|
124
129
|
var _b = __read(_a, 2), name = _b[0], props = _b[1];
|
|
125
|
-
return "export type "
|
|
130
|
+
return "export type ".concat(name, " = ").concat(props.map(utils_1.quote).join(" | "), ";\n\n");
|
|
126
131
|
});
|
|
127
|
-
var typographyType = ts_poet_1.code(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n export type ", " = ", ";\n "], ["\n export type ", " = ",
|
|
128
|
-
";\n "])), ts_poet_1.def("Typography"), Object.keys(fonts)
|
|
132
|
+
var typographyType = (0, ts_poet_1.code)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n export type ", " = ", ";\n "], ["\n export type ", " = ", ";\n "])), (0, ts_poet_1.def)("Typography"), Object.keys(fonts)
|
|
129
133
|
.map(utils_1.quote)
|
|
130
134
|
.join(" | "));
|
|
131
135
|
var breakpointCode = breakpoints === undefined
|
|
132
136
|
? []
|
|
133
|
-
:
|
|
137
|
+
: __spreadArray([
|
|
134
138
|
"type Brand<K, T> = K & { __brand: T };",
|
|
135
139
|
"type Breakpoint = Brand<string, 'Breakpoint'>;"
|
|
136
|
-
], Object.entries(breakpoints_1.makeBreakpoints(breakpoints || {})).map(function (_a) {
|
|
140
|
+
], __read(Object.entries((0, breakpoints_1.makeBreakpoints)(breakpoints || {})).map(function (_a) {
|
|
137
141
|
var _b = __read(_a, 2), name = _b[0], query = _b[1];
|
|
138
|
-
return "export const "
|
|
139
|
-
}));
|
|
140
|
-
return ts_poet_1.code(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n// This file is auto-generated by truss: https://github.com/homebound-team/truss.\n\n/** Given a type X, and the user's proposed type T, only allow keys in X and nothing else. */\nexport type Only<X, T> = X & Record<Exclude<keyof T, keyof X>, never>;\n\nexport type ", " = ", ";\n\n", "\n\ntype Opts<T> = {\n rules: T,\n enabled: boolean,\n important: boolean,\n selector: string | undefined\n};\n\n// prettier-ignore\nclass CssBuilder<T extends ", "> {\n constructor(private opts: Opts<T>) {}\n\n private get rules(): T { return this.opts.rules };\n private get enabled(): boolean { return this.opts.enabled };\n private get selector(): string | undefined { return this.opts.selector };\n private newCss(opts: Partial<Opts<T>>): CssBuilder<T> {\n return new CssBuilder({ ...this.opts, ...opts });\n }\n\n ", "\n get $(): T { return maybeImportant(sortObject(this.rules), this.opts.important); }\n\n if(t: boolean | Breakpoint) {\n if (typeof t === \"boolean\") {\n return this.newCss({ enabled: t });\n } else {\n return this.newCss({ selector: t as string });\n }\n }\n\n get else() {\n if (this.selector !== undefined) {\n throw new Error(\"else is not supported with if(selector)\");\n }\n return this.newCss({ enabled: !this.enabled });\n }\n\n get important() { return this.newCss({ important: true }); }\n\n /** Adds new properties, either a specific key/value or a Properties object, to the current css. */\n add<P extends Properties>(props: P): CssBuilder<T & P>;\n add<K extends keyof Properties>(prop: K, value: Properties[K]): CssBuilder<T & { [U in K]: Properties[K] }>;\n add<K extends keyof Properties>(propOrProperties: K | Properties, value?: Properties[K]): CssBuilder<any> {\n const newRules = typeof propOrProperties === \"string\" ? { [propOrProperties]: value } : propOrProperties;\n const rules = this.selector\n ? { ...this.rules, [this.selector]: { ...(this.rules as any)[this.selector], ...newRules } }\n : this.enabled ? { ...this.rules, ...newRules } : this.rules;\n return this.newCss({ rules: rules as any });\n }\n\n /** Adds new properties, either a specific key/value or a Properties object, to a nested selector. */\n addIn<P extends Properties>(selector: string, props: P | undefined): CssBuilder<T & P>;\n addIn<K extends keyof Properties>(selector: string, prop: K, value: Properties[K]): CssBuilder<T & { [U in K]: Properties[K] }>;\n addIn<K extends keyof Properties>(selector: string, propOrProperties: K | Properties, value?: Properties[K]): CssBuilder<any> {\n const newRules = typeof propOrProperties === \"string\" ? { [propOrProperties]: value } : propOrProperties;\n if (newRules === undefined) {\n return this;\n }\n const rules = { ...this.rules, [selector]: { ...(this.rules as any)[selector], ...newRules } };\n return this.newCss({ rules: rules as any });\n }\n}\n\n/** Emotion treats the same rules, ordered differently as different classes, but naively they can be the same. */\nfunction sortObject<T extends object>(obj: T): T {\n return Object.keys(obj)\n .sort()\n .reduce((acc, key) => {\n acc[key as keyof T] = obj[key as keyof T];\n return acc;\n }, ({} as any) as T) as T;\n}\n\n/** Conditionally adds `important!` to everything. */\nfunction maybeImportant<T extends object>(obj: T, important: boolean): T {\n if (important) {\n Object.keys(obj).forEach(key => {\n (obj as any)[key] = `${(obj as any)[key]} !important`;\n });\n }\n return obj;\n}\n\n/** Converts `inc` into pixels value with a `px` suffix. */\nexport function maybeInc(inc: number | string): string {\n return typeof inc === \"string\" ? inc : `${increment(inc)}px`;\n}\n\n/** Converts `inc` into pixels. */\nexport function increment(inc: number): number {\n return inc * ", ";\n}\n\n/** Convert `pixels` to a `px` units string so it's not ambiguous. */\nexport function px(pixels: number): string {\n return `${pixels}px`;\n}\n\nexport enum Palette {\n ", "\n}\n\n/** A shortcut for defining Xss types. */\nexport type Xss<P extends keyof Properties> = Pick<Properties, P>;\n\n/** An entry point for Css expressions. CssBuilder is immutable so this is safe to share. */\nexport const Css = new CssBuilder({ rules: {}, enabled: true, important: false, selector: undefined });\n\n", "\n\n", "\n\n", "\n "], ["\n// This file is auto-generated by truss: https://github.com/homebound-team/truss.\n\n/** Given a type X, and the user's proposed type T, only allow keys in X and nothing else. */\nexport type Only<X, T> = X & Record<Exclude<keyof T, keyof X>, never>;\n\nexport type ", " = ", ";\n\n", "\n\ntype Opts<T> = {\n rules: T,\n enabled: boolean,\n important: boolean,\n selector: string | undefined\n};\n\n// prettier-ignore\nclass CssBuilder<T extends ", "> {\n constructor(private opts: Opts<T>) {}\n\n private get rules(): T { return this.opts.rules };\n private get enabled(): boolean { return this.opts.enabled };\n private get selector(): string | undefined { return this.opts.selector };\n private newCss(opts: Partial<Opts<T>>): CssBuilder<T> {\n return new CssBuilder({ ...this.opts, ...opts });\n }\n\n ", "\n get $(): T { return maybeImportant(sortObject(this.rules), this.opts.important); }\n\n if(t: boolean | Breakpoint) {\n if (typeof t === \"boolean\") {\n return this.newCss({ enabled: t });\n } else {\n return this.newCss({ selector: t as string });\n }\n }\n\n get else() {\n if (this.selector !== undefined) {\n throw new Error(\"else is not supported with if(selector)\");\n }\n return this.newCss({ enabled: !this.enabled });\n }\n\n get important() { return this.newCss({ important: true }); }\n\n /** Adds new properties, either a specific key/value or a Properties object, to the current css. */\n add<P extends Properties>(props: P): CssBuilder<T & P>;\n add<K extends keyof Properties>(prop: K, value: Properties[K]): CssBuilder<T & { [U in K]: Properties[K] }>;\n add<K extends keyof Properties>(propOrProperties: K | Properties, value?: Properties[K]): CssBuilder<any> {\n const newRules = typeof propOrProperties === \"string\" ? { [propOrProperties]: value } : propOrProperties;\n const rules = this.selector\n ? { ...this.rules, [this.selector]: { ...(this.rules as any)[this.selector], ...newRules } }\n : this.enabled ? { ...this.rules, ...newRules } : this.rules;\n return this.newCss({ rules: rules as any });\n }\n\n /** Adds new properties, either a specific key/value or a Properties object, to a nested selector. */\n addIn<P extends Properties>(selector: string, props: P | undefined): CssBuilder<T & P>;\n addIn<K extends keyof Properties>(selector: string, prop: K, value: Properties[K]): CssBuilder<T & { [U in K]: Properties[K] }>;\n addIn<K extends keyof Properties>(selector: string, propOrProperties: K | Properties, value?: Properties[K]): CssBuilder<any> {\n const newRules = typeof propOrProperties === \"string\" ? { [propOrProperties]: value } : propOrProperties;\n if (newRules === undefined) {\n return this;\n }\n const rules = { ...this.rules, [selector]: { ...(this.rules as any)[selector], ...newRules } };\n return this.newCss({ rules: rules as any });\n }\n}\n\n/** Emotion treats the same rules, ordered differently as different classes, but naively they can be the same. */\nfunction sortObject<T extends object>(obj: T): T {\n return Object.keys(obj)\n .sort()\n .reduce((acc, key) => {\n acc[key as keyof T] = obj[key as keyof T];\n return acc;\n }, ({} as any) as T) as T;\n}\n\n/** Conditionally adds \\`important!\\` to everything. */\nfunction maybeImportant<T extends object>(obj: T, important: boolean): T {\n if (important) {\n Object.keys(obj).forEach(key => {\n (obj as any)[key] = \\`\\${(obj as any)[key]} !important\\`;\n });\n }\n return obj;\n}\n\n/** Converts \\`inc\\` into pixels value with a \\`px\\` suffix. */\nexport function maybeInc(inc: number | string): string {\n return typeof inc === \"string\" ? inc : \\`\\${increment(inc)}px\\`;\n}\n\n/** Converts \\`inc\\` into pixels. */\nexport function increment(inc: number): number {\n return inc * ", ";\n}\n\n/** Convert \\`pixels\\` to a \\`px\\` units string so it's not ambiguous. */\nexport function px(pixels: number): string {\n return \\`\\${pixels}px\\`;\n}\n\nexport enum Palette {\n ",
|
|
141
|
-
"\n}\n\n/** A shortcut for defining Xss types. */\nexport type Xss<P extends keyof Properties> = Pick<Properties, P>;\n\n/** An entry point for Css expressions. CssBuilder is immutable so this is safe to share. */\nexport const Css = new CssBuilder({ rules: {}, enabled: true, important: false, selector: undefined });\n\n", "\n\n", "\n\n", "\n "])), ts_poet_1.def("Properties"), Properties, typographyType, Properties, lines.join("\n ").replace(/ +\n/g, "\n"), increment, Object.entries(palette).map(function (_a) {
|
|
142
|
+
return "export const ".concat(name, " = \"").concat(query, "\" as Breakpoint;");
|
|
143
|
+
})), false);
|
|
144
|
+
return (0, ts_poet_1.code)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n// This file is auto-generated by truss: https://github.com/homebound-team/truss.\n\n/** Given a type X, and the user's proposed type T, only allow keys in X and nothing else. */\nexport type Only<X, T> = X & Record<Exclude<keyof T, keyof X>, never>;\n\nexport type ", " = ", ";\n\n", "\n\ntype Opts<T> = {\n rules: T,\n enabled: boolean,\n important: boolean,\n selector: string | undefined\n};\n\n// prettier-ignore\nclass CssBuilder<T extends ", "> {\n constructor(private opts: Opts<T>) {}\n\n private get rules(): T { return this.opts.rules };\n private get enabled(): boolean { return this.opts.enabled };\n private get selector(): string | undefined { return this.opts.selector };\n private newCss(opts: Partial<Opts<T>>): CssBuilder<T> {\n return new CssBuilder({ ...this.opts, ...opts });\n }\n\n ", "\n get $(): T { return maybeImportant(sortObject(this.rules), this.opts.important); }\n\n if(t: boolean | Breakpoint) {\n if (typeof t === \"boolean\") {\n return this.newCss({ enabled: t });\n } else {\n return this.newCss({ selector: t as string });\n }\n }\n\n get else() {\n if (this.selector !== undefined) {\n throw new Error(\"else is not supported with if(selector)\");\n }\n return this.newCss({ enabled: !this.enabled });\n }\n\n get important() { return this.newCss({ important: true }); }\n\n /** Adds new properties, either a specific key/value or a Properties object, to the current css. */\n add<P extends Properties>(props: P): CssBuilder<T & P>;\n add<K extends keyof Properties>(prop: K, value: Properties[K]): CssBuilder<T & { [U in K]: Properties[K] }>;\n add<K extends keyof Properties>(propOrProperties: K | Properties, value?: Properties[K]): CssBuilder<any> {\n const newRules = typeof propOrProperties === \"string\" ? { [propOrProperties]: value } : propOrProperties;\n const rules = this.selector\n ? { ...this.rules, [this.selector]: { ...(this.rules as any)[this.selector], ...newRules } }\n : this.enabled ? { ...this.rules, ...newRules } : this.rules;\n return this.newCss({ rules: rules as any });\n }\n\n /** Adds new properties, either a specific key/value or a Properties object, to a nested selector. */\n addIn<P extends Properties>(selector: string, props: P | undefined): CssBuilder<T & P>;\n addIn<K extends keyof Properties>(selector: string, prop: K, value: Properties[K]): CssBuilder<T & { [U in K]: Properties[K] }>;\n addIn<K extends keyof Properties>(selector: string, propOrProperties: K | Properties, value?: Properties[K]): CssBuilder<any> {\n const newRules = typeof propOrProperties === \"string\" ? { [propOrProperties]: value } : propOrProperties;\n if (newRules === undefined) {\n return this;\n }\n const rules = { ...this.rules, [selector]: { ...(this.rules as any)[selector], ...newRules } };\n return this.newCss({ rules: rules as any });\n }\n}\n\n/** Emotion treats the same rules, ordered differently as different classes, but naively they can be the same. */\nfunction sortObject<T extends object>(obj: T): T {\n return Object.keys(obj)\n .sort()\n .reduce((acc, key) => {\n acc[key as keyof T] = obj[key as keyof T];\n return acc;\n }, ({} as any) as T) as T;\n}\n\n/** Conditionally adds `important!` to everything. */\nfunction maybeImportant<T extends object>(obj: T, important: boolean): T {\n if (important) {\n Object.keys(obj).forEach(key => {\n (obj as any)[key] = `${(obj as any)[key]} !important`;\n });\n }\n return obj;\n}\n\n/** Converts `inc` into pixels value with a `px` suffix. */\nexport function maybeInc(inc: number | string): string {\n return typeof inc === \"string\" ? inc : `${increment(inc)}px`;\n}\n\n/** Converts `inc` into pixels. */\nexport function increment(inc: number): number {\n return inc * ", ";\n}\n\n/** Convert `pixels` to a `px` units string so it's not ambiguous. */\nexport function px(pixels: number): string {\n return `${pixels}px`;\n}\n\nexport enum Palette {\n ", "\n}\n\n/** A shortcut for defining Xss types. */\nexport type Xss<P extends keyof Properties> = Pick<Properties, P>;\n\n/** An entry point for Css expressions. CssBuilder is immutable so this is safe to share. */\nexport const Css = new CssBuilder({ rules: {}, enabled: true, important: false, selector: undefined });\n\n", "\n\n", "\n\n", "\n "], ["\n// This file is auto-generated by truss: https://github.com/homebound-team/truss.\n\n/** Given a type X, and the user's proposed type T, only allow keys in X and nothing else. */\nexport type Only<X, T> = X & Record<Exclude<keyof T, keyof X>, never>;\n\nexport type ", " = ", ";\n\n", "\n\ntype Opts<T> = {\n rules: T,\n enabled: boolean,\n important: boolean,\n selector: string | undefined\n};\n\n// prettier-ignore\nclass CssBuilder<T extends ", "> {\n constructor(private opts: Opts<T>) {}\n\n private get rules(): T { return this.opts.rules };\n private get enabled(): boolean { return this.opts.enabled };\n private get selector(): string | undefined { return this.opts.selector };\n private newCss(opts: Partial<Opts<T>>): CssBuilder<T> {\n return new CssBuilder({ ...this.opts, ...opts });\n }\n\n ", "\n get $(): T { return maybeImportant(sortObject(this.rules), this.opts.important); }\n\n if(t: boolean | Breakpoint) {\n if (typeof t === \"boolean\") {\n return this.newCss({ enabled: t });\n } else {\n return this.newCss({ selector: t as string });\n }\n }\n\n get else() {\n if (this.selector !== undefined) {\n throw new Error(\"else is not supported with if(selector)\");\n }\n return this.newCss({ enabled: !this.enabled });\n }\n\n get important() { return this.newCss({ important: true }); }\n\n /** Adds new properties, either a specific key/value or a Properties object, to the current css. */\n add<P extends Properties>(props: P): CssBuilder<T & P>;\n add<K extends keyof Properties>(prop: K, value: Properties[K]): CssBuilder<T & { [U in K]: Properties[K] }>;\n add<K extends keyof Properties>(propOrProperties: K | Properties, value?: Properties[K]): CssBuilder<any> {\n const newRules = typeof propOrProperties === \"string\" ? { [propOrProperties]: value } : propOrProperties;\n const rules = this.selector\n ? { ...this.rules, [this.selector]: { ...(this.rules as any)[this.selector], ...newRules } }\n : this.enabled ? { ...this.rules, ...newRules } : this.rules;\n return this.newCss({ rules: rules as any });\n }\n\n /** Adds new properties, either a specific key/value or a Properties object, to a nested selector. */\n addIn<P extends Properties>(selector: string, props: P | undefined): CssBuilder<T & P>;\n addIn<K extends keyof Properties>(selector: string, prop: K, value: Properties[K]): CssBuilder<T & { [U in K]: Properties[K] }>;\n addIn<K extends keyof Properties>(selector: string, propOrProperties: K | Properties, value?: Properties[K]): CssBuilder<any> {\n const newRules = typeof propOrProperties === \"string\" ? { [propOrProperties]: value } : propOrProperties;\n if (newRules === undefined) {\n return this;\n }\n const rules = { ...this.rules, [selector]: { ...(this.rules as any)[selector], ...newRules } };\n return this.newCss({ rules: rules as any });\n }\n}\n\n/** Emotion treats the same rules, ordered differently as different classes, but naively they can be the same. */\nfunction sortObject<T extends object>(obj: T): T {\n return Object.keys(obj)\n .sort()\n .reduce((acc, key) => {\n acc[key as keyof T] = obj[key as keyof T];\n return acc;\n }, ({} as any) as T) as T;\n}\n\n/** Conditionally adds \\`important!\\` to everything. */\nfunction maybeImportant<T extends object>(obj: T, important: boolean): T {\n if (important) {\n Object.keys(obj).forEach(key => {\n (obj as any)[key] = \\`\\${(obj as any)[key]} !important\\`;\n });\n }\n return obj;\n}\n\n/** Converts \\`inc\\` into pixels value with a \\`px\\` suffix. */\nexport function maybeInc(inc: number | string): string {\n return typeof inc === \"string\" ? inc : \\`\\${increment(inc)}px\\`;\n}\n\n/** Converts \\`inc\\` into pixels. */\nexport function increment(inc: number): number {\n return inc * ", ";\n}\n\n/** Convert \\`pixels\\` to a \\`px\\` units string so it's not ambiguous. */\nexport function px(pixels: number): string {\n return \\`\\${pixels}px\\`;\n}\n\nexport enum Palette {\n ", "\n}\n\n/** A shortcut for defining Xss types. */\nexport type Xss<P extends keyof Properties> = Pick<Properties, P>;\n\n/** An entry point for Css expressions. CssBuilder is immutable so this is safe to share. */\nexport const Css = new CssBuilder({ rules: {}, enabled: true, important: false, selector: undefined });\n\n", "\n\n", "\n\n", "\n "])), (0, ts_poet_1.def)("Properties"), Properties, typographyType, Properties, lines.join("\n ").replace(/ +\n/g, "\n"), increment, Object.entries(palette).map(function (_a) {
|
|
142
145
|
var _b = __read(_a, 2), name = _b[0], value = _b[1];
|
|
143
|
-
return name
|
|
146
|
+
return "".concat(name, " = \"").concat(value, "\",");
|
|
144
147
|
}), typeAliasCode, breakpointCode, extras || "");
|
|
145
148
|
}
|
|
146
149
|
/** Invokes all of the `MethodFns` to create actual `UtilityMethod`s. */
|
package/build/generate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yBAAoC;AACpC,mCAA+C;AAC/C,6CAAkD;AAElD,qCAAgD;AAChD,gDAAwD;AACxD,iCAAkC;AAErB,QAAA,kBAAkB,GAA4C;IACzE,MAAM,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,CAAC;IAC5E,OAAO,EAAE;QACP,SAAS;QACT,YAAY;QACZ,cAAc;QACd,eAAe;QACf,aAAa;KACd;CACF,CAAC;AAEF,SAAsB,QAAQ,CAAC,MAAc;;;;;;oBACnC,UAAU,GAAK,MAAM,WAAX,CAAY;oBACf,qBAAM,kBAAkB,CAAC,MAAM,CAAC,CAAC,mBAAmB,EAAE,EAAA;;oBAA/D,MAAM,GAAG,SAAsD;oBACrE,qBAAM,aAAE,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC,EAAA;;oBAAtC,SAAsC,CAAC;;;;;CACxC;AAJD,4BAIC;AAED,SAAS,kBAAkB,CAAC,MAAc;IAEtC,IAAA,OAAO,GASL,MAAM,QATD,EACP,KAAK,GAQH,MAAM,MARH,EACL,SAAS,GAOP,MAAM,UAPC,EACT,MAAM,GAMJ,MAAM,OANF,EACN,WAAW,GAKT,MAAM,YALG,EACX,WAAW,GAIT,MAAM,YAJG,EACX,OAAO,GAGL,MAAM,QAHD,EACP,KAEE,MAAM,eAFmB,EAA3B,cAAc,mBAAG,UAAU,KAAA,EACjB,cAAc,GACtB,MAAM,SADgB,CACf;IAEX,kEAAkE;IAClE,IAAM,QAAQ,kCAET,CAAC,cAAc,KAAK,UAAU;QAC/B,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,0BAAe,CAAC;QAC1C,CA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C,CAAC,GAAG,CACvD,UAAC,EAAa;gBAAb,KAAA,aAAa,EAAZ,IAAI,QAAA,EAAE,KAAK,QAAA;YACX,OAAA,uBAAgB,IAAI,kBAAO,KAAK,sBAAkB;QAAlD,CAAkD,CACrD,SACF,CAAC;IAER,WAAO,cAAI,81IAAA,8QAMC,EAAiB,KAAM,EAAU,OAE7C,EAAc,sKAUa,EAAU,gXAUnC,EAAyC,u+FAuE5B,EAAS,oMAStB,EAEA,mUASF,EAAa,MAEb,EAAc,MAEd,EAAY,MACX,KAtHW,IAAA,aAAG,EAAC,YAAY,CAAC,EAAM,UAAU,EAE7C,cAAc,EAUa,UAAU,EAUnC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,EAuE5B,SAAS,EAStB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,UAAC,EAAa;YAAb,KAAA,aAAa,EAAZ,IAAI,QAAA,EAAE,KAAK,QAAA;QACzC,OAAO,UAAG,IAAI,kBAAO,KAAK,QAAI,CAAC;IACjC,CAAC,CAAC,EASF,aAAa,EAEb,cAAc,EAEd,MAAM,IAAI,EAAE,EACV;AACJ,CAAC;AAED,wEAAwE;AACxE,SAAS,eAAe,CACtB,MAAc,EACd,SAAmB;IAEnB,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,UAAC,EAAU;YAAV,KAAA,aAAU,EAAT,IAAI,QAAA,EAAE,EAAE,QAAA;QAAM,OAAA,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IAAlB,CAAkB,CAAC,CAClE,CAAC;AACJ,CAAC"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./config";
|
|
2
|
-
export { defaultSections } from "./sections";
|
|
2
|
+
export { defaultSections } from "./sections/tachyons";
|
|
3
3
|
export { generate } from "./generate";
|
|
4
|
-
export {
|
|
5
|
-
|
|
4
|
+
export type { IncConfig } from "./methods";
|
|
5
|
+
export { newAliasesMethods, newMethod, newMethodsForProp, newIncrementDelegateMethods, newIncrementMethods, newParamMethod, newSetCssVariablesMethod, } from "./methods";
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -12,8 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
exports.newSetCssVariablesMethod = exports.newParamMethod = exports.newIncrementMethods = exports.newIncrementDelegateMethods = exports.newMethodsForProp = exports.newMethod = exports.newAliasesMethods = exports.generate = exports.defaultSections = void 0;
|
|
14
18
|
__exportStar(require("./config"), exports);
|
|
15
|
-
var
|
|
16
|
-
Object.defineProperty(exports, "defaultSections", { enumerable: true, get: function () { return
|
|
19
|
+
var tachyons_1 = require("./sections/tachyons");
|
|
20
|
+
Object.defineProperty(exports, "defaultSections", { enumerable: true, get: function () { return tachyons_1.defaultSections; } });
|
|
17
21
|
var generate_1 = require("./generate");
|
|
18
22
|
Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return generate_1.generate; } });
|
|
19
23
|
var methods_1 = require("./methods");
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAA2B;AAC3B,gDAAwD;AAA/C,2GAAA,eAAe,OAAA;AACxB,uCAAwC;AAA/B,oGAAA,QAAQ,OAAA;AAEjB,qCAQqB;AAPnB,4GAAA,iBAAiB,OAAA;AACjB,oGAAA,SAAS,OAAA;AACT,4GAAA,iBAAiB,OAAA;AACjB,sHAAA,2BAA2B,OAAA;AAC3B,8GAAA,mBAAmB,OAAA;AACnB,yGAAA,cAAc,OAAA;AACd,mHAAA,wBAAwB,OAAA"}
|
package/build/methods.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Aliases, Config, UtilityMethod, UtilityName } from "config";
|
|
1
|
+
import { Aliases, Config, UtilityMethod, UtilityName } from "./config";
|
|
2
2
|
import { Properties } from "csstype";
|
|
3
3
|
export declare type Prop = keyof Properties;
|
|
4
4
|
/**
|
|
@@ -70,4 +70,3 @@ export declare function newIncrementMethods(config: Config, abbr: UtilityName, c
|
|
|
70
70
|
export declare function newIncrementDelegateMethods(abbr: UtilityName, numberOfIncrements: number): UtilityMethod[];
|
|
71
71
|
export declare function newPxMethod(abbr: UtilityName): UtilityName;
|
|
72
72
|
export declare const zeroTo: (n: number) => number[];
|
|
73
|
-
//# sourceMappingURL=methods.d.ts.map
|
package/build/methods.js
CHANGED
|
@@ -15,9 +15,14 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
15
15
|
}
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
|
-
var
|
|
19
|
-
for (var
|
|
20
|
-
|
|
18
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
+
if (ar || !(i in from)) {
|
|
21
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
+
ar[i] = from[i];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
26
|
};
|
|
22
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
28
|
exports.zeroTo = exports.newPxMethod = exports.newIncrementDelegateMethods = exports.newIncrementMethods = exports.newSetCssVariablesMethod = exports.newAliasesMethods = exports.newMethodsForProp = exports.newParamMethod = exports.newMethod = void 0;
|
|
@@ -26,12 +31,12 @@ exports.zeroTo = exports.newPxMethod = exports.newIncrementDelegateMethods = exp
|
|
|
26
31
|
* the TypeScript code for a `mt0` utility method that sets those values.
|
|
27
32
|
*/
|
|
28
33
|
function newMethod(abbr, defs) {
|
|
29
|
-
return "get "
|
|
34
|
+
return "get ".concat(abbr, "() { return this").concat(Object.entries(defs)
|
|
30
35
|
.map(function (_a) {
|
|
31
36
|
var _b = __read(_a, 2), prop = _b[0], value = _b[1];
|
|
32
|
-
return ".add(\""
|
|
37
|
+
return ".add(\"".concat(prop, "\", ").concat(maybeWrap(value), ")");
|
|
33
38
|
})
|
|
34
|
-
.join("")
|
|
39
|
+
.join(""), "; }");
|
|
35
40
|
}
|
|
36
41
|
exports.newMethod = newMethod;
|
|
37
42
|
/**
|
|
@@ -41,7 +46,7 @@ exports.newMethod = newMethod;
|
|
|
41
46
|
* I.e. `Css.mt(someValue).$`
|
|
42
47
|
*/
|
|
43
48
|
function newParamMethod(abbr, prop) {
|
|
44
|
-
return abbr
|
|
49
|
+
return "".concat(abbr, "(value: Properties[\"").concat(prop, "\"]) { return this.add(\"").concat(prop, "\", value); }");
|
|
45
50
|
}
|
|
46
51
|
exports.newParamMethod = newParamMethod;
|
|
47
52
|
/**
|
|
@@ -63,11 +68,11 @@ exports.newParamMethod = newParamMethod;
|
|
|
63
68
|
function newMethodsForProp(prop, defs, baseName, includePx) {
|
|
64
69
|
if (baseName === void 0) { baseName = prop; }
|
|
65
70
|
if (includePx === void 0) { includePx = false; }
|
|
66
|
-
return
|
|
71
|
+
return __spreadArray(__spreadArray(__spreadArray([], __read(Object.entries(defs).map(function (_a) {
|
|
67
72
|
var _b;
|
|
68
73
|
var _c = __read(_a, 2), abbr = _c[0], value = _c[1];
|
|
69
74
|
return newMethod(abbr, (_b = {}, _b[prop] = value, _b));
|
|
70
|
-
}), (baseName !== null ? [newParamMethod(baseName, prop)] : []), (baseName !== null && includePx ? [newPxMethod(baseName)] : []));
|
|
75
|
+
})), false), __read((baseName !== null ? [newParamMethod(baseName, prop)] : [])), false), __read((baseName !== null && includePx ? [newPxMethod(baseName)] : [])), false);
|
|
71
76
|
}
|
|
72
77
|
exports.newMethodsForProp = newMethodsForProp;
|
|
73
78
|
/**
|
|
@@ -77,9 +82,9 @@ exports.newMethodsForProp = newMethodsForProp;
|
|
|
77
82
|
function newAliasesMethods(aliases) {
|
|
78
83
|
return Object.entries(aliases).map(function (_a) {
|
|
79
84
|
var _b = __read(_a, 2), abbr = _b[0], values = _b[1];
|
|
80
|
-
return "get "
|
|
81
|
-
.map(function (v) { return "."
|
|
82
|
-
.join("")
|
|
85
|
+
return "get ".concat(abbr, "() { return this").concat(values
|
|
86
|
+
.map(function (v) { return ".".concat(v); })
|
|
87
|
+
.join(""), "; }");
|
|
83
88
|
});
|
|
84
89
|
}
|
|
85
90
|
exports.newAliasesMethods = newAliasesMethods;
|
|
@@ -95,12 +100,12 @@ exports.newAliasesMethods = newAliasesMethods;
|
|
|
95
100
|
* TODO: Create a `Css.set(cssVars).$` method.
|
|
96
101
|
*/
|
|
97
102
|
function newSetCssVariablesMethod(abbr, defs) {
|
|
98
|
-
return "get "
|
|
103
|
+
return "get ".concat(abbr, "() { return this").concat(Object.entries(defs)
|
|
99
104
|
.map(function (_a) {
|
|
100
105
|
var _b = __read(_a, 2), prop = _b[0], value = _b[1];
|
|
101
|
-
return ".add(\""
|
|
106
|
+
return ".add(\"".concat(prop, "\" as any, \"").concat(value, "\")");
|
|
102
107
|
})
|
|
103
|
-
.join("")
|
|
108
|
+
.join(""), "; }");
|
|
104
109
|
}
|
|
105
110
|
exports.newSetCssVariablesMethod = newSetCssVariablesMethod;
|
|
106
111
|
/**
|
|
@@ -123,36 +128,36 @@ exports.newSetCssVariablesMethod = newSetCssVariablesMethod;
|
|
|
123
128
|
function newIncrementMethods(config, abbr, conf) {
|
|
124
129
|
var delegateMethods = newIncrementDelegateMethods(abbr, config.numberOfIncrements);
|
|
125
130
|
if (Array.isArray(conf)) {
|
|
126
|
-
return
|
|
127
|
-
abbr
|
|
128
|
-
.map(function (l) { return l
|
|
129
|
-
.join(".")
|
|
130
|
-
abbr
|
|
131
|
-
.map(function (l) { return l
|
|
132
|
-
.join(".")
|
|
133
|
-
]);
|
|
131
|
+
return __spreadArray(__spreadArray([], __read(delegateMethods), false), [
|
|
132
|
+
"".concat(abbr, "(inc: number | string) { return this.").concat(conf
|
|
133
|
+
.map(function (l) { return "".concat(l, "(inc)"); })
|
|
134
|
+
.join("."), "; }"),
|
|
135
|
+
"".concat(abbr, "Px(px: number) { return this.").concat(conf
|
|
136
|
+
.map(function (l) { return "".concat(l, "Px(px)"); })
|
|
137
|
+
.join("."), "; }"),
|
|
138
|
+
], false);
|
|
134
139
|
}
|
|
135
140
|
else {
|
|
136
|
-
return
|
|
137
|
-
abbr
|
|
141
|
+
return __spreadArray(__spreadArray([], __read(delegateMethods), false), [
|
|
142
|
+
"".concat(abbr, "(inc: number | string) { return this.add(\"").concat(conf, "\", maybeInc(inc)); }"),
|
|
138
143
|
newPxMethod(abbr),
|
|
139
|
-
]);
|
|
144
|
+
], false);
|
|
140
145
|
}
|
|
141
146
|
}
|
|
142
147
|
exports.newIncrementMethods = newIncrementMethods;
|
|
143
148
|
/** Creates `<abbr>X` utility methods that call an `abbr(number)` that the caller is responsible for creating. */
|
|
144
149
|
function newIncrementDelegateMethods(abbr, numberOfIncrements) {
|
|
145
|
-
return exports.zeroTo(numberOfIncrements).map(function (i) { return "get "
|
|
150
|
+
return (0, exports.zeroTo)(numberOfIncrements).map(function (i) { return "get ".concat(abbr).concat(i, "() { return this.").concat(abbr, "(").concat(i, "); }"); });
|
|
146
151
|
}
|
|
147
152
|
exports.newIncrementDelegateMethods = newIncrementDelegateMethods;
|
|
148
153
|
function newPxMethod(abbr) {
|
|
149
|
-
return abbr
|
|
154
|
+
return "".concat(abbr, "Px(px: number) { return this.").concat(abbr, "(`${px}px`); }");
|
|
150
155
|
}
|
|
151
156
|
exports.newPxMethod = newPxMethod;
|
|
152
|
-
var zeroTo = function (n) { return
|
|
157
|
+
var zeroTo = function (n) { return __spreadArray([], __read(Array(n + 1).keys()), false); };
|
|
153
158
|
exports.zeroTo = zeroTo;
|
|
154
159
|
/** Keeps numbers as literals, and wraps anything else with double quotes. */
|
|
155
160
|
function maybeWrap(value) {
|
|
156
|
-
return typeof value === "number" ? String(value) : "\""
|
|
161
|
+
return typeof value === "number" ? String(value) : "\"".concat(value, "\"");
|
|
157
162
|
}
|
|
158
163
|
//# sourceMappingURL=methods.js.map
|
package/build/methods.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../src/methods.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../src/methods.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;;;GAGG;AACH,SAAgB,SAAS,CAAC,IAAiB,EAAE,IAAgB;IAC3D,OAAO,cAAO,IAAI,6BAAmB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;SACtD,GAAG,CAAC,UAAC,EAAa;YAAb,KAAA,aAAa,EAAZ,IAAI,QAAA,EAAE,KAAK,QAAA;QAAM,OAAA,iBAAS,IAAI,iBAAM,SAAS,CAAC,KAAK,CAAC,MAAG;IAAtC,CAAsC,CAAC;SAC9D,IAAI,CAAC,EAAE,CAAC,QAAK,CAAC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oB,IAAI,cAAI,CAAC,SAAM,EAAlD,CAAkD,CAC1D,CAAC;AACJ,CAAC;AAPD,kEAOC;AAED,SAAgB,WAAW,CAAC,IAAiB;IAC3C,OAAO,UAAG,IAAI,0CAAgC,IAAI,mBAAmB,CAAC;AACxE,CAAC;AAFD,kCAEC;AAEM,IAAM,MAAM,GAA4B,UAAC,CAAC,IAAK,gCAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,WAAvB,CAAwB,CAAC;AAAlE,QAAA,MAAM,UAA4D;AAE/E,6EAA6E;AAC7E,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAI,KAAK,OAAG,CAAC;AAClE,CAAC"}
|
package/build/methods.test.d.ts
CHANGED
package/build/methods.test.js
CHANGED
|
@@ -11,15 +11,15 @@ describe("methods", function () {
|
|
|
11
11
|
};
|
|
12
12
|
describe("newIncrementMethods", function () {
|
|
13
13
|
it("can handle mt", function () {
|
|
14
|
-
expect(methods_1.newIncrementMethods(config, "mt", "marginTop"))
|
|
14
|
+
expect((0, methods_1.newIncrementMethods)(config, "mt", "marginTop"))
|
|
15
15
|
.toMatchInlineSnapshot("\n Array [\n \"get mt0() { return this.mt(0); }\",\n \"get mt1() { return this.mt(1); }\",\n \"get mt2() { return this.mt(2); }\",\n \"get mt3() { return this.mt(3); }\",\n \"mt(inc: number | string) { return this.add(\\\"marginTop\\\", maybeInc(inc)); }\",\n \"mtPx(px: number) { return this.mt(`${px}px`); }\",\n ]\n ");
|
|
16
16
|
});
|
|
17
17
|
it("can handle mx", function () {
|
|
18
|
-
expect(methods_1.newIncrementMethods(config, "mx", ["ml", "mr"]))
|
|
18
|
+
expect((0, methods_1.newIncrementMethods)(config, "mx", ["ml", "mr"]))
|
|
19
19
|
.toMatchInlineSnapshot("\n Array [\n \"get mx0() { return this.mx(0); }\",\n \"get mx1() { return this.mx(1); }\",\n \"get mx2() { return this.mx(2); }\",\n \"get mx3() { return this.mx(3); }\",\n \"mx(inc: number | string) { return this.ml(inc).mr(inc); }\",\n \"mxPx(px: number) { return this.mlPx(px).mrPx(px); }\",\n ]\n ");
|
|
20
20
|
});
|
|
21
21
|
it("can handle m", function () {
|
|
22
|
-
expect(methods_1.newIncrementMethods(config, "m", ["mt", "mr", "mb", "ml"]))
|
|
22
|
+
expect((0, methods_1.newIncrementMethods)(config, "m", ["mt", "mr", "mb", "ml"]))
|
|
23
23
|
.toMatchInlineSnapshot("\n Array [\n \"get m0() { return this.m(0); }\",\n \"get m1() { return this.m(1); }\",\n \"get m2() { return this.m(2); }\",\n \"get m3() { return this.m(3); }\",\n \"m(inc: number | string) { return this.mt(inc).mr(inc).mb(inc).ml(inc); }\",\n \"mPx(px: number) { return this.mtPx(px).mrPx(px).mbPx(px).mlPx(px); }\",\n ]\n ");
|
|
24
24
|
});
|
|
25
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"methods.test.js","sourceRoot":"","sources":["../src/methods.test.ts"],"names":[],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"file":"methods.test.js","sourceRoot":"","sources":["../src/methods.test.ts"],"names":[],"mappings":";;AACA,qCAAkD;AAElD,QAAQ,CAAC,SAAS,EAAE;IAClB,IAAM,MAAM,GAAW;QACrB,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,CAAC;QACZ,kBAAkB,EAAE,CAAC;QACrB,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,QAAQ,CAAC,qBAAqB,EAAE;QAC9B,EAAE,CAAC,eAAe,EAAE;YAClB,MAAM,CAAC,IAAA,6BAAmB,EAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;iBACnD,qBAAqB,CAAC,0YASxB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,eAAe,EAAE;YAClB,MAAM,CAAC,IAAA,6BAAmB,EAAC,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;iBACpD,qBAAqB,CAAC,wXASxB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,cAAc,EAAE;YACjB,MAAM,CAAC,IAAA,6BAAmB,EAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;iBAC/D,qBAAqB,CAAC,gZASxB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -15,13 +15,18 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
15
15
|
}
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
|
-
var
|
|
19
|
-
for (var
|
|
20
|
-
|
|
18
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
+
if (ar || !(i in from)) {
|
|
21
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
+
ar[i] = from[i];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
26
|
};
|
|
22
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
28
|
exports.border = void 0;
|
|
24
|
-
var methods_1 = require("
|
|
29
|
+
var methods_1 = require("../../methods");
|
|
25
30
|
var borderDefs = [
|
|
26
31
|
["ba", ["borderStyle", "borderWidth"]],
|
|
27
32
|
["bt", ["borderTopStyle", "borderTopWidth"]],
|
|
@@ -29,12 +34,12 @@ var borderDefs = [
|
|
|
29
34
|
["bb", ["borderBottomStyle", "borderBottomWidth"]],
|
|
30
35
|
["bl", ["borderLeftStyle", "borderLeftWidth"]],
|
|
31
36
|
];
|
|
32
|
-
var border = function () { return
|
|
37
|
+
var border = function () { return __spreadArray(__spreadArray([], __read(borderDefs.map(function (_a) {
|
|
33
38
|
var _b;
|
|
34
39
|
var _c = __read(_a, 2), abbr = _c[0], _d = __read(_c[1], 2), style = _d[0], width = _d[1];
|
|
35
|
-
return methods_1.newMethod(abbr, (_b = {}, _b[style] = "solid", _b[width] = "1px", _b));
|
|
36
|
-
}), [
|
|
37
|
-
methods_1.newMethod("bn", { borderStyle: "none", borderWidth: "0" }),
|
|
38
|
-
]); };
|
|
40
|
+
return (0, methods_1.newMethod)(abbr, (_b = {}, _b[style] = "solid", _b[width] = "1px", _b));
|
|
41
|
+
})), false), [
|
|
42
|
+
(0, methods_1.newMethod)("bn", { borderStyle: "none", borderWidth: "0" }),
|
|
43
|
+
], false); };
|
|
39
44
|
exports.border = border;
|
|
40
45
|
//# sourceMappingURL=border.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"border.js","sourceRoot":"","sources":["../../../src/sections/tachyons/border.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAwC;AAGxC,IAAM,UAAU,GAAiC;IAC/C,CAAC,IAAI,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IACtC,CAAC,IAAI,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;IAC5C,CAAC,IAAI,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;IAChD,CAAC,IAAI,EAAE,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC;IAClD,CAAC,IAAI,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;CAC/C,CAAC;AAEK,IAAM,MAAM,GAAoB,cAAM,8CACxC,UAAU,CAAC,GAAG,CAAC,UAAC,EAAsB;;QAAtB,KAAA,aAAsB,EAArB,IAAI,QAAA,EAAE,KAAA,gBAAc,EAAb,KAAK,QAAA,EAAE,KAAK,QAAA;IACrC,OAAO,IAAA,mBAAS,EAAC,IAAI,YAAI,GAAC,KAAK,IAAG,OAAO,EAAE,GAAC,KAAK,IAAG,KAAK,MAAG,CAAC;AAC/D,CAAC,CAAC;IACF,IAAA,mBAAS,EAAC,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC;WAJf,CAK5C,CAAC;AALW,QAAA,MAAM,UAKjB"}
|