@homebound/truss 1.114.0 → 1.116.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.
@@ -51,7 +51,7 @@ function makeBreakpoints(breakpoints) {
51
51
  if (!isFirst) {
52
52
  var isSecond = i === 1;
53
53
  var prevBp = bps[i - 1];
54
- var name = "".concat(prevBp, "Or").concat(capitalize(bp));
54
+ var name_1 = "".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) {
@@ -62,7 +62,7 @@ function makeBreakpoints(breakpoints) {
62
62
  if (!isLast) {
63
63
  rule += " and (max-width:".concat(max, ")");
64
64
  }
65
- r[name] = rule;
65
+ r[name_1] = 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.
@@ -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,MAAM,GAAG,CAAC,CAAC;QACpC,2EAA2E;QAC3E,IAAM,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,UAAG,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AC,CAAC,WAAW,EAAE,SAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAE,CAAC;AAClD,CAAC"}
package/build/generate.js CHANGED
@@ -83,15 +83,10 @@ var breakpoints_1 = require("./breakpoints");
83
83
  var methods_1 = require("./methods");
84
84
  var tachyons_1 = require("./sections/tachyons");
85
85
  var utils_1 = require("./utils");
86
+ var change_case_1 = require("change-case");
86
87
  exports.defaultTypeAliases = {
87
88
  Margin: ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"],
88
- Padding: [
89
- "padding",
90
- "paddingTop",
91
- "paddingRight",
92
- "paddingBottom",
93
- "paddingLeft",
94
- ],
89
+ Padding: ["padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
95
90
  };
96
91
  function generate(config) {
97
92
  return __awaiter(this, void 0, void 0, function () {
@@ -100,11 +95,9 @@ function generate(config) {
100
95
  switch (_a.label) {
101
96
  case 0:
102
97
  outputPath = config.outputPath;
103
- return [4 /*yield*/, generateCssBuilder(config).toStringWithImports()];
104
- case 1:
105
- output = _a.sent();
98
+ output = generateCssBuilder(config).toString();
106
99
  return [4 /*yield*/, fs_1.promises.writeFile(outputPath, output)];
107
- case 2:
100
+ case 1:
108
101
  _a.sent();
109
102
  return [2 /*return*/];
110
103
  }
@@ -113,11 +106,9 @@ function generate(config) {
113
106
  }
114
107
  exports.generate = generate;
115
108
  function generateCssBuilder(config) {
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;
109
+ var aliases = config.aliases, fonts = config.fonts, increment = config.increment, extras = config.extras, typeAliases = config.typeAliases, _a = config.breakpoints, breakpoints = _a === void 0 ? {} : _a, palette = config.palette, _b = config.defaultMethods, defaultMethods = _b === void 0 ? "tachyons" : _b, customSections = config.sections;
117
110
  // Combine our out-of-the-box utility methods with any custom ones
118
- var sections = __assign(__assign(__assign({}, (defaultMethods === "tachyons"
119
- ? generateMethods(config, tachyons_1.defaultSections)
120
- : {})), (customSections ? generateMethods(config, customSections) : {})), (aliases && { aliases: (0, methods_1.newAliasesMethods)(aliases) }));
111
+ var sections = __assign(__assign(__assign({}, (defaultMethods === "tachyons" ? generateMethods(config, tachyons_1.defaultSections) : {})), (customSections ? generateMethods(config, customSections) : {})), (aliases && { aliases: (0, methods_1.newAliasesMethods)(aliases) }));
121
112
  var Properties = (0, ts_poet_1.imp)("Properties@csstype");
122
113
  var lines = Object.entries(sections)
123
114
  .map(function (_a) {
@@ -129,19 +120,20 @@ function generateCssBuilder(config) {
129
120
  var _b = __read(_a, 2), name = _b[0], props = _b[1];
130
121
  return "export type ".concat(name, " = ").concat(props.map(utils_1.quote).join(" | "), ";\n\n");
131
122
  });
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)
133
- .map(utils_1.quote)
134
- .join(" | "));
135
- var breakpointCode = breakpoints === undefined
136
- ? []
137
- : __spreadArray([
138
- "type Brand<K, T> = K & { __brand: T };",
139
- "type Breakpoint = Brand<string, 'Breakpoint'>;"
140
- ], __read(Object.entries((0, breakpoints_1.makeBreakpoints)(breakpoints || {})).map(function (_a) {
141
- var _b = __read(_a, 2), name = _b[0], query = _b[1];
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) {
123
+ 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).map(utils_1.quote).join(" | "));
124
+ var genBreakpoints = (0, breakpoints_1.makeBreakpoints)(breakpoints);
125
+ var breakpointCode = [
126
+ "export type Breakpoint = ".concat(Object.keys(genBreakpoints).map(utils_1.quote).join(" | "), ";"),
127
+ "export enum Breakpoints {\n ".concat(Object.entries(genBreakpoints).map(function (_a) {
128
+ var _b = __read(_a, 2), name = _b[0], value = _b[1];
129
+ return "".concat(name, " = \"").concat(value, "\"");
130
+ }), "\n };"),
131
+ ];
132
+ var breakpointIfs = Object.entries(genBreakpoints).map(function (_a) {
133
+ var _b = __read(_a, 2), name = _b[0], value = _b[1];
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
+ });
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 ", " = ", ";\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(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 ", "\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(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 ", "\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"), breakpointIfs, increment, Object.entries(palette).map(function (_a) {
145
137
  var _b = __read(_a, 2), name = _b[0], value = _b[1];
146
138
  return "".concat(name, " = \"").concat(value, "\",");
147
139
  }), typeAliasCode, breakpointCode, extras || "");
@@ -153,5 +145,5 @@ function generateMethods(config, methodFns) {
153
145
  return [name, fn(config)];
154
146
  }));
155
147
  }
156
- var templateObject_1, templateObject_2;
148
+ var templateObject_1, templateObject_2, templateObject_3;
157
149
  //# sourceMappingURL=generate.js.map
@@ -1 +1 @@
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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C1D,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"}
@@ -11,16 +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"))
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 ");
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 ");
16
15
  });
17
16
  it("can handle mx", function () {
18
- expect((0, methods_1.newIncrementMethods)(config, "mx", ["ml", "mr"]))
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 ");
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 ");
20
18
  });
21
19
  it("can handle m", function () {
22
- expect((0, methods_1.newIncrementMethods)(config, "m", ["mt", "mr", "mb", "ml"]))
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 ");
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 ");
24
21
  });
25
22
  });
26
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,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,E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,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,CAAC,qBAAqB,CAAC,0YASxF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -32,7 +32,6 @@ var lineClamp = function () { return __spreadArray(__spreadArray([], __read((0,
32
32
  return (0, methods_1.newMethod)("lineClamp".concat(i + 1), {
33
33
  overflow: "hidden",
34
34
  display: "-webkit-box",
35
- WebkitBoxOrient: "vertical",
36
35
  WebkitLineClamp: i + 1,
37
36
  // tailwinds doesn't add this by default, but it seems like a good default for us.
38
37
  textOverflow: "ellipsis",
@@ -1 +1 @@
1
- {"version":3,"file":"lineClamp.js","sourceRoot":"","sources":["../../../src/sections/tachyons/lineClamp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAgD;AAGhD,0DAA0D;AACnD,IAAM,SAAS,GAAoB,cAAM,8CAC3C,IAAA,gBAAM,EAAC,CAAC,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC;IACjB,OAAA,IAAA,mBAAS,EAAC,mBAAY,CAAC,GAAG,CAAC,CAAE,EAAE;QAC7B,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,aAAa;QACtB,eAAe,EAAE,UAAU;QAC3B,eAAe,EAAE,CAAC,GAAG,CAAC;QACtB,kFAAkF;QAClF,YAAY,EAAE,UAAU;KACzB,CAAC;AAPF,CAOE,CACH;IACD,IAAA,mBAAS,EAAC,eAAe,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC;WAXV,CAY/C,CAAC;AAZW,QAAA,SAAS,aAYpB"}
1
+ {"version":3,"file":"lineClamp.js","sourceRoot":"","sources":["../../../src/sections/tachyons/lineClamp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAgD;AAGhD,0DAA0D;AACnD,IAAM,SAAS,GAAoB,cAAM,8CAC3C,IAAA,gBAAM,EAAC,CAAC,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC;IACjB,OAAA,IAAA,mBAAS,EAAC,mBAAY,CAAC,GAAG,CAAC,CAAE,EAAE;QAC7B,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,aAAa;QACtB,eAAe,EAAE,CAAC,GAAG,CAAC;QACtB,kFAAkF;QAClF,YAAY,EAAE,UAAU;KACzB,CAAC;AANF,CAME,CACH;IACD,IAAA,mBAAS,EAAC,eAAe,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC;WAVV,CAW/C,CAAC;AAXW,QAAA,SAAS,aAWpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/truss",
3
- "version": "1.114.0",
3
+ "version": "1.116.0",
4
4
  "main": "build/index.js",
5
5
  "bin": "cli.js",
6
6
  "scripts": {
@@ -8,17 +8,18 @@
8
8
  },
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
- "csstype": "^2.6.10",
12
- "ts-node": "^10.7.0",
13
- "ts-poet": "^3.2.2"
11
+ "change-case": "^4.1.2",
12
+ "csstype": "^3.1.1",
13
+ "ts-node": "^10.9.1",
14
+ "ts-poet": "^6.1.0"
14
15
  },
15
16
  "devDependencies": {
16
17
  "@homebound/tsconfig": "^1.0.3",
17
- "@types/jest": "^26.0.20",
18
- "@types/node": "^16.0.3",
19
- "jest": "^26.6.3",
20
- "ts-jest": "^26.4.4",
21
- "typescript": "^4.6.3"
18
+ "@types/jest": "^29.2.1",
19
+ "@types/node": "^18.11.9",
20
+ "jest": "^29.2.2",
21
+ "ts-jest": "^29.0.3",
22
+ "typescript": "^4.8.4"
22
23
  },
23
24
  "jest": {
24
25
  "preset": "ts-jest",