@homebound/truss 1.118.0 → 1.120.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/generate.js +1 -1
- package/build/generate.js.map +1 -1
- package/build/methods.d.ts +4 -2
- package/build/methods.js +35 -20
- package/build/methods.js.map +1 -1
- package/build/methods.test.js +3 -3
- package/build/methods.test.js.map +1 -1
- package/build/sections/tachyons/heights.js +6 -6
- package/build/sections/tachyons/heights.js.map +1 -1
- package/build/sections/tachyons/widths.js +3 -1
- package/build/sections/tachyons/widths.js.map +1 -1
- package/package.json +1 -1
package/build/generate.js
CHANGED
|
@@ -133,7 +133,7 @@ function generateCssBuilder(config) {
|
|
|
133
133
|
var _b = __read(_a, 2), name = _b[0], value = _b[1];
|
|
134
134
|
return (0, ts_poet_1.code)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n get if", "() {\n return this.newCss({ selector: ", " });\n }"], ["\n get if", "() {\n return this.newCss({ selector: ", " });\n }"])), (0, change_case_1.pascalCase)(name), (0, utils_1.quote)(value));
|
|
135
135
|
});
|
|
136
|
-
return (0, ts_poet_1.code)(templateObject_3 || (templateObject_3 = __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 ", " = ", "
|
|
136
|
+
return (0, ts_poet_1.code)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n// This file is auto-generated by truss: https://github.com/homebound-team/truss.\n// See your project's `truss-config.ts` to make configuration changes (fonts, increments, etc).\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 ", " = ", "<string | 0, string>;\n\n", "\n\ntype Opts<T> = {\n rules: T,\n enabled: boolean,\n important: boolean,\n selector: string | undefined\n};\n\nclass CssBuilder<T extends Properties> {\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(bp: Breakpoint): CssBuilder<T>;\n if(cond: boolean): CssBuilder<T>;\n if(arg: boolean | Breakpoint): CssBuilder<T> {\n if (typeof arg === \"boolean\") {\n return this.newCss({ enabled: arg });\n } else {\n return this.newCss({ selector: Breakpoints[arg] });\n }\n }\n\n get onHover() {\n return this.newCss({ selector: \":hover\" });\n }\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// See your project's \\`truss-config.ts\\` to make configuration changes (fonts, increments, etc).\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 ", " = ", "<string | 0, string>;\n\n", "\n\ntype Opts<T> = {\n rules: T,\n enabled: boolean,\n important: boolean,\n selector: string | undefined\n};\n\nclass CssBuilder<T extends Properties> {\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(bp: Breakpoint): CssBuilder<T>;\n if(cond: boolean): CssBuilder<T>;\n if(arg: boolean | Breakpoint): CssBuilder<T> {\n if (typeof arg === \"boolean\") {\n return this.newCss({ enabled: arg });\n } else {\n return this.newCss({ selector: Breakpoints[arg] });\n }\n }\n\n get onHover() {\n return this.newCss({ selector: \":hover\" });\n }\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, lines.join("\n ").replace(/ +\n/g, "\n"), breakpointIfs, increment, Object.entries(palette).map(function (_a) {
|
|
137
137
|
var _b = __read(_a, 2), name = _b[0], value = _b[1];
|
|
138
138
|
return "".concat(name, " = \"").concat(value, "\",");
|
|
139
139
|
}), typeAliasCode, breakpointCode, extras || "");
|
package/build/generate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yBAAoC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AI,CAAC,EAiBzC,aAAa,EA8DA,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,CAAC,MAAc,EAAE,SAAmB;IAC1D,OAAO,MAAM,CAAC,WAAW,CAAC,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,CAAC,CAAC;AAC/F,CAAC"}
|
package/build/methods.d.ts
CHANGED
|
@@ -61,12 +61,14 @@ export declare type IncConfig = [string, Prop | string[]];
|
|
|
61
61
|
*
|
|
62
62
|
* TODO: Support non-pixel increments.
|
|
63
63
|
*
|
|
64
|
+
* @param config the config
|
|
64
65
|
* @param abbr the utility prefix, i.e. `mt`
|
|
65
66
|
* @param conf if a CSS prop, we assume "mt0 --> marginTop: 0px", otherwise if an array we delegate
|
|
66
67
|
* to other existing utility methods, i.e. `m0` -> `mx0.my0`.
|
|
67
68
|
*/
|
|
68
69
|
export declare function newIncrementMethods(config: Config, abbr: UtilityName, conf: Prop | string[]): UtilityMethod[];
|
|
69
70
|
/** Creates `<abbr>X` utility methods that call an `abbr(number)` that the caller is responsible for creating. */
|
|
70
|
-
export declare function newIncrementDelegateMethods(abbr: UtilityName,
|
|
71
|
-
export declare function newPxMethod(abbr: UtilityName):
|
|
71
|
+
export declare function newIncrementDelegateMethods(config: Config, abbr: UtilityName, prop: Prop | Prop[]): UtilityMethod[];
|
|
72
|
+
export declare function newPxMethod(abbr: UtilityName, prop: Prop): UtilityMethod;
|
|
72
73
|
export declare const zeroTo: (n: number) => number[];
|
|
74
|
+
export declare function comment(defs: object): string;
|
package/build/methods.js
CHANGED
|
@@ -25,13 +25,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
25
25
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.zeroTo = exports.newPxMethod = exports.newIncrementDelegateMethods = exports.newIncrementMethods = exports.newSetCssVariablesMethod = exports.newAliasesMethods = exports.newMethodsForProp = exports.newParamMethod = exports.newMethod = void 0;
|
|
28
|
+
exports.comment = exports.zeroTo = exports.newPxMethod = exports.newIncrementDelegateMethods = exports.newIncrementMethods = exports.newSetCssVariablesMethod = exports.newAliasesMethods = exports.newMethodsForProp = exports.newParamMethod = exports.newMethod = void 0;
|
|
29
29
|
/**
|
|
30
30
|
* Given a single abbreviation (i.e. `mt0`) and multiple `{ prop: value }` CSS values, returns
|
|
31
31
|
* the TypeScript code for a `mt0` utility method that sets those values.
|
|
32
32
|
*/
|
|
33
33
|
function newMethod(abbr, defs) {
|
|
34
|
-
return "get ".concat(abbr, "() { return this").concat(Object.entries(defs)
|
|
34
|
+
return "".concat(comment(defs), " get ").concat(abbr, "() { return this").concat(Object.entries(defs)
|
|
35
35
|
.map(function (_a) {
|
|
36
36
|
var _b = __read(_a, 2), prop = _b[0], value = _b[1];
|
|
37
37
|
return ".add(\"".concat(prop, "\", ").concat(maybeWrap(value), ")");
|
|
@@ -46,7 +46,8 @@ exports.newMethod = newMethod;
|
|
|
46
46
|
* I.e. `Css.mt(someValue).$`
|
|
47
47
|
*/
|
|
48
48
|
function newParamMethod(abbr, prop) {
|
|
49
|
-
|
|
49
|
+
var _a;
|
|
50
|
+
return "".concat(comment((_a = {}, _a[prop] = "value", _a)), " ").concat(abbr, "(value: Properties[\"").concat(prop, "\"]) { return this.add(\"").concat(prop, "\", value); }");
|
|
50
51
|
}
|
|
51
52
|
exports.newParamMethod = newParamMethod;
|
|
52
53
|
/**
|
|
@@ -72,7 +73,7 @@ function newMethodsForProp(prop, defs, baseName, includePx) {
|
|
|
72
73
|
var _b;
|
|
73
74
|
var _c = __read(_a, 2), abbr = _c[0], value = _c[1];
|
|
74
75
|
return newMethod(abbr, (_b = {}, _b[prop] = value, _b));
|
|
75
|
-
})), false), __read((baseName !== null ? [newParamMethod(baseName, prop)] : [])), false), __read((baseName !== null && includePx ? [newPxMethod(baseName)] : [])), false);
|
|
76
|
+
})), false), __read((baseName !== null ? [newParamMethod(baseName, prop)] : [])), false), __read((baseName !== null && includePx ? [newPxMethod(baseName, prop)] : [])), false);
|
|
76
77
|
}
|
|
77
78
|
exports.newMethodsForProp = newMethodsForProp;
|
|
78
79
|
/**
|
|
@@ -82,9 +83,7 @@ exports.newMethodsForProp = newMethodsForProp;
|
|
|
82
83
|
function newAliasesMethods(aliases) {
|
|
83
84
|
return Object.entries(aliases).map(function (_a) {
|
|
84
85
|
var _b = __read(_a, 2), abbr = _b[0], values = _b[1];
|
|
85
|
-
return "get ".concat(abbr, "() { return this").concat(values
|
|
86
|
-
.map(function (v) { return ".".concat(v); })
|
|
87
|
-
.join(""), "; }");
|
|
86
|
+
return "get ".concat(abbr, "() { return this").concat(values.map(function (v) { return ".".concat(v); }).join(""), "; }");
|
|
88
87
|
});
|
|
89
88
|
}
|
|
90
89
|
exports.newAliasesMethods = newAliasesMethods;
|
|
@@ -121,37 +120,42 @@ exports.newSetCssVariablesMethod = newSetCssVariablesMethod;
|
|
|
121
120
|
*
|
|
122
121
|
* TODO: Support non-pixel increments.
|
|
123
122
|
*
|
|
123
|
+
* @param config the config
|
|
124
124
|
* @param abbr the utility prefix, i.e. `mt`
|
|
125
125
|
* @param conf if a CSS prop, we assume "mt0 --> marginTop: 0px", otherwise if an array we delegate
|
|
126
126
|
* to other existing utility methods, i.e. `m0` -> `mx0.my0`.
|
|
127
127
|
*/
|
|
128
128
|
function newIncrementMethods(config, abbr, conf) {
|
|
129
|
-
var
|
|
129
|
+
var _a;
|
|
130
|
+
// Create `m1`, `m2`, etc. that will call our main `m` method.
|
|
131
|
+
var delegateMethods = newIncrementDelegateMethods(config, abbr, typeof conf === "string" ? conf : conf);
|
|
130
132
|
if (Array.isArray(conf)) {
|
|
131
133
|
return __spreadArray(__spreadArray([], __read(delegateMethods), false), [
|
|
132
|
-
"".concat(abbr, "(inc: number | string) { return this.").concat(conf
|
|
133
|
-
|
|
134
|
-
.join("."), "; }"),
|
|
135
|
-
"".concat(abbr, "Px(px: number) { return this.").concat(conf
|
|
136
|
-
.map(function (l) { return "".concat(l, "Px(px)"); })
|
|
137
|
-
.join("."), "; }"),
|
|
134
|
+
"".concat(abbr, "(inc: number | string) { return this.").concat(conf.map(function (l) { return "".concat(l, "(inc)"); }).join("."), "; }"),
|
|
135
|
+
"".concat(abbr, "Px(px: number) { return this.").concat(conf.map(function (l) { return "".concat(l, "Px(px)"); }).join("."), "; }"),
|
|
138
136
|
], false);
|
|
139
137
|
}
|
|
140
138
|
else {
|
|
141
139
|
return __spreadArray(__spreadArray([], __read(delegateMethods), false), [
|
|
142
|
-
"".concat(abbr, "(inc: number | string) { return this.add(\"").concat(conf, "\", maybeInc(inc)); }"),
|
|
143
|
-
newPxMethod(abbr),
|
|
140
|
+
"".concat(comment((_a = {}, _a[conf] = "inc", _a)), " ").concat(abbr, "(inc: number | string) { return this.add(\"").concat(conf, "\", maybeInc(inc)); }"),
|
|
141
|
+
newPxMethod(abbr, conf),
|
|
144
142
|
], false);
|
|
145
143
|
}
|
|
146
144
|
}
|
|
147
145
|
exports.newIncrementMethods = newIncrementMethods;
|
|
148
146
|
/** Creates `<abbr>X` utility methods that call an `abbr(number)` that the caller is responsible for creating. */
|
|
149
|
-
function newIncrementDelegateMethods(abbr,
|
|
150
|
-
return (0, exports.zeroTo)(numberOfIncrements).map(function (i) {
|
|
147
|
+
function newIncrementDelegateMethods(config, abbr, prop) {
|
|
148
|
+
return (0, exports.zeroTo)(config.numberOfIncrements).map(function (i) {
|
|
149
|
+
var _a;
|
|
150
|
+
var px = "".concat(i * config.increment, "px");
|
|
151
|
+
var defs = typeof prop === "string" ? (_a = {}, _a[prop] = px, _a) : Object.fromEntries(prop.map(function (prop) { return [prop, px]; }));
|
|
152
|
+
return "".concat(comment(defs), " get ").concat(abbr).concat(i, "() { return this.").concat(abbr, "(").concat(i, "); }");
|
|
153
|
+
});
|
|
151
154
|
}
|
|
152
155
|
exports.newIncrementDelegateMethods = newIncrementDelegateMethods;
|
|
153
|
-
function newPxMethod(abbr) {
|
|
154
|
-
|
|
156
|
+
function newPxMethod(abbr, prop) {
|
|
157
|
+
var _a;
|
|
158
|
+
return "".concat(comment((_a = {}, _a[prop] = "px", _a)), " ").concat(abbr, "Px(px: number) { return this.").concat(abbr, "(`${px}px`); }");
|
|
155
159
|
}
|
|
156
160
|
exports.newPxMethod = newPxMethod;
|
|
157
161
|
var zeroTo = function (n) { return __spreadArray([], __read(Array(n + 1).keys()), false); };
|
|
@@ -160,4 +164,15 @@ exports.zeroTo = zeroTo;
|
|
|
160
164
|
function maybeWrap(value) {
|
|
161
165
|
return typeof value === "number" ? String(value) : "\"".concat(value, "\"");
|
|
162
166
|
}
|
|
167
|
+
function comment(defs) {
|
|
168
|
+
var paramNames = ["value", "px", "inc"];
|
|
169
|
+
var values = Object.entries(defs)
|
|
170
|
+
.map(function (_a) {
|
|
171
|
+
var _b = __read(_a, 2), prop = _b[0], value = _b[1];
|
|
172
|
+
return "".concat(prop, ": ").concat(paramNames.includes(value) ? value : maybeWrap(value));
|
|
173
|
+
})
|
|
174
|
+
.join("; ");
|
|
175
|
+
return "/** Sets `".concat(values, "`. */\n");
|
|
176
|
+
}
|
|
177
|
+
exports.comment = comment;
|
|
163
178
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;;;GAGG;AACH,SAAgB,SAAS,CAAC,IAAiB,EAAE,IAAgB;IAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../src/methods.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;;;GAGG;AACH,SAAgB,SAAS,CAAC,IAAiB,EAAE,IAAgB;IAC3D,OAAO,UAAG,OAAO,CAAC,IAAI,CAAC,kBAAQ,IAAI,6BAAmB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;SACvE,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;AACnB,CAAC;AAJD,8BAIC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,IAAiB,EAAE,IAAsB;;IACtE,OAAO,UAAG,OAAO,WAAG,GAAC,IAAI,IAAG,OAAO,MAAG,cAAI,IAAI,kCAAuB,IAAI,sCAA0B,IAAI,kBAAc,CAAC;AACxH,CAAC;AAFD,wCAEC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,iBAAiB,CAC/B,IAAO,EACP,IAAwC,EACxC,QAA8B,EAC9B,SAA0B;IAD1B,yBAAA,EAAA,eAA8B;IAC9B,0BAAA,EAAA,iBAA0B;IAE1B,4DACK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAC,EAAa;;YAAb,KAAA,aAAa,EAAZ,IAAI,QAAA,EAAE,KAAK,QAAA;QAAM,OAAA,SAAS,CAAC,IAAI,YAAI,GAAC,IAAI,IAAG,KAAK,MAA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cAAI,CAAC,SAAM,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC;AAND,kEAMC;AAED,SAAgB,WAAW,CAAC,IAAiB,EAAE,IAAU;;IACvD,OAAO,UAAG,OAAO,WAAG,GAAC,IAAI,IAAG,IAAI,MAAG,cAAI,IAAI,0CAAgC,IAAI,mBAAmB,CAAC;AACrG,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;AAED,SAAgB,OAAO,CAAC,IAAY;IAClC,IAAM,UAAU,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1C,IAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;SAChC,GAAG,CAAC,UAAC,EAAa;YAAb,KAAA,aAAa,EAAZ,IAAI,QAAA,EAAE,KAAK,QAAA;QAAM,OAAA,UAAG,IAAI,eAAK,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAE;IAAnE,CAAmE,CAAC;SAC3F,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,oBAAc,MAAM,YAAU,CAAC;AACxC,CAAC;AAND,0BAMC"}
|
package/build/methods.test.js
CHANGED
|
@@ -11,13 +11,13 @@ describe("methods", function () {
|
|
|
11
11
|
};
|
|
12
12
|
describe("newIncrementMethods", function () {
|
|
13
13
|
it("can handle mt", function () {
|
|
14
|
-
expect((0, methods_1.newIncrementMethods)(config, "mt", "marginTop")).toMatchInlineSnapshot("\n [\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 ");
|
|
14
|
+
expect((0, methods_1.newIncrementMethods)(config, "mt", "marginTop")).toMatchInlineSnapshot("\n [\n \"/** Sets `marginTop: \"0px\"`. */\n get mt0() { return this.mt(0); }\",\n \"/** Sets `marginTop: \"8px\"`. */\n get mt1() { return this.mt(1); }\",\n \"/** Sets `marginTop: \"16px\"`. */\n get mt2() { return this.mt(2); }\",\n \"/** Sets `marginTop: \"24px\"`. */\n get mt3() { return this.mt(3); }\",\n \"/** Sets `marginTop: inc`. */\n mt(inc: number | string) { return this.add(\"marginTop\", maybeInc(inc)); }\",\n \"/** Sets `marginTop: px`. */\n mtPx(px: number) { return this.mt(`${px}px`); }\",\n ]\n ");
|
|
15
15
|
});
|
|
16
16
|
it("can handle mx", function () {
|
|
17
|
-
expect((0, methods_1.newIncrementMethods)(config, "mx", ["ml", "mr"])).toMatchInlineSnapshot("\n [\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 ");
|
|
17
|
+
expect((0, methods_1.newIncrementMethods)(config, "mx", ["ml", "mr"])).toMatchInlineSnapshot("\n [\n \"/** Sets `ml: \"0px\"; mr: \"0px\"`. */\n get mx0() { return this.mx(0); }\",\n \"/** Sets `ml: \"8px\"; mr: \"8px\"`. */\n get mx1() { return this.mx(1); }\",\n \"/** Sets `ml: \"16px\"; mr: \"16px\"`. */\n get mx2() { return this.mx(2); }\",\n \"/** Sets `ml: \"24px\"; mr: \"24px\"`. */\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 ");
|
|
18
18
|
});
|
|
19
19
|
it("can handle m", function () {
|
|
20
|
-
expect((0, methods_1.newIncrementMethods)(config, "m", ["mt", "mr", "mb", "ml"])).toMatchInlineSnapshot("\n [\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 ");
|
|
20
|
+
expect((0, methods_1.newIncrementMethods)(config, "m", ["mt", "mr", "mb", "ml"])).toMatchInlineSnapshot("\n [\n \"/** Sets `mt: \"0px\"; mr: \"0px\"; mb: \"0px\"; ml: \"0px\"`. */\n get m0() { return this.m(0); }\",\n \"/** Sets `mt: \"8px\"; mr: \"8px\"; mb: \"8px\"; ml: \"8px\"`. */\n get m1() { return this.m(1); }\",\n \"/** Sets `mt: \"16px\"; mr: \"16px\"; mb: \"16px\"; ml: \"16px\"`. */\n get m2() { return this.m(2); }\",\n \"/** Sets `mt: \"24px\"; mr: \"24px\"; mb: \"24px\"; ml: \"24px\"`. */\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 ");
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"methods.test.js","sourceRoot":"","sources":["../src/methods.test.ts"],"names":[],"mappings":";;AACA,qCAAkD;AAElD,QAAQ,CAAC,SAAS,EAAE;IAClB,IAAM,MA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AAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -27,7 +27,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.height = void 0;
|
|
29
29
|
var methods_1 = require("../../methods");
|
|
30
|
-
var height = function (config) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(
|
|
30
|
+
var height = function (config) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, methods_1.newIncrementMethods)(config, "h", "height")), false), __read((0, methods_1.newMethodsForProp)("height", {
|
|
31
31
|
h25: "25%",
|
|
32
32
|
h50: "50%",
|
|
33
33
|
h75: "75%",
|
|
@@ -36,16 +36,16 @@ var height = function (config) { return __spreadArray(__spreadArray(__spreadArra
|
|
|
36
36
|
vh50: "50vh",
|
|
37
37
|
vh75: "75vh",
|
|
38
38
|
vh100: "100vh",
|
|
39
|
-
},
|
|
39
|
+
},
|
|
40
|
+
// Skip `h` here b/c it's created by newIncrementMethods below
|
|
41
|
+
null)), false), __read((0, methods_1.newMethodsForProp)("minHeight", {
|
|
40
42
|
mh0: 0,
|
|
41
43
|
mh25: "25%",
|
|
42
44
|
mh50: "50%",
|
|
43
45
|
mh75: "75%",
|
|
44
46
|
mh100: "100%",
|
|
45
47
|
mvh100: "100vh",
|
|
46
|
-
}, "mh")), false),
|
|
47
|
-
"mhPx(px: number) { return this.add(\"minHeight\", `${px}px`); }"
|
|
48
|
-
], false), __read((0, methods_1.newMethodsForProp)("maxHeight", {
|
|
48
|
+
}, "mh", true)), false), __read((0, methods_1.newMethodsForProp)("maxHeight", {
|
|
49
49
|
maxh0: "0",
|
|
50
50
|
maxh25: "25%",
|
|
51
51
|
maxh50: "50%",
|
|
@@ -53,7 +53,7 @@ var height = function (config) { return __spreadArray(__spreadArray(__spreadArra
|
|
|
53
53
|
maxh100: "100%",
|
|
54
54
|
}, "maxh", true)), false), [
|
|
55
55
|
// Sneak this into heights.ts even though it's for width & height
|
|
56
|
-
"sqPx(px: number) { return this.add(\"height\", `${px}px`).add(\"width\", `${px}px`); }",
|
|
56
|
+
"".concat((0, methods_1.comment)({ height: "px", width: "px" }), "\n sqPx(px: number) { return this.add(\"height\", `${px}px`).add(\"width\", `${px}px`); }"),
|
|
57
57
|
], false); };
|
|
58
58
|
exports.height = height;
|
|
59
59
|
//# sourceMappingURL=heights.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heights.js","sourceRoot":"","sources":["../../../src/sections/tachyons/heights.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"heights.js","sourceRoot":"","sources":["../../../src/sections/tachyons/heights.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA8E;AAEvE,IAAM,MAAM,GAAoB,UAAC,MAAM,IAAK,wFAI9C,IAAA,6BAAmB,EAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,kBAE1C,IAAA,2BAAiB,EAClB,QAAQ,EACR;IACE,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;CACf;AACD,8DAA8D;AAC9D,IAAI,CACL,kBAEE,IAAA,2BAAiB,EAClB,WAAW,EACX;IACE,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,OAAO;CAChB,EACD,IAAI,EACJ,IAAI,CACL,kBAEE,IAAA,2BAAiB,EAClB,WAAW,EACX;IACE,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,MAAM;CAChB,EACD,MAAM,EACN,IAAI,CACL;IAED,iEAAiE;IACjE,UAAG,IAAA,iBAAO,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,+FACgD;WAnDxC,CAoDlD,CAAC;AApDW,QAAA,MAAM,UAoDjB"}
|
|
@@ -32,7 +32,9 @@ var width = function (config) { return __spreadArray(__spreadArray(__spreadArray
|
|
|
32
32
|
w50: "50%",
|
|
33
33
|
w75: "75%",
|
|
34
34
|
w100: "100%",
|
|
35
|
-
},
|
|
35
|
+
},
|
|
36
|
+
// Skip `w` here b/c it's created by newIncrementMethods below
|
|
37
|
+
null)), false), __read((0, methods_1.newMethodsForProp)("minWidth", {
|
|
36
38
|
mw0: 0,
|
|
37
39
|
mw25: "25%",
|
|
38
40
|
mw50: "50%",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widths.js","sourceRoot":"","sources":["../../../src/sections/tachyons/widths.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAqE;AAG9D,IAAM,KAAK,GAAoB,UAAC,MAAM,IAAK,0EAC7C,IAAA,2BAAiB,EAClB,OAAO,EACP;IACE,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb,
|
|
1
|
+
{"version":3,"file":"widths.js","sourceRoot":"","sources":["../../../src/sections/tachyons/widths.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAqE;AAG9D,IAAM,KAAK,GAAoB,UAAC,MAAM,IAAK,0EAC7C,IAAA,2BAAiB,EAClB,OAAO,EACP;IACE,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb;AACD,8DAA8D;AAC9D,IAAI,CACL,kBAEE,IAAA,2BAAiB,EAClB,UAAU,EACV;IACE,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,MAAM;CACd,EACD,IAAI,EACJ,IAAI,CACL,kBAEE,IAAA,2BAAiB,EAClB,UAAU,EACV;IACE,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,MAAM;CAChB,EACD,MAAM,EACN,IAAI,CACL,kBAEE,IAAA,6BAAmB,EAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,WAvCI,CAwCjD,CAAC;AAxCW,QAAA,KAAK,SAwChB"}
|