homebound-team / truss

A TypeScript DSL for writing utility CSS in React/JSX
32 stars 0 forks source link

feat: support additional properties to utility method #120

Closed allangaldinosilva closed 5 months ago

allangaldinosilva commented 5 months ago

This PR enhances the utility method to support additional properties. For instance, the lineClamp property does have additional properties but those can't be passed to the lineClamp(value) utility method.

Before

/** Sets `WebkitLineClamp: value`. */
  lineClamp(value: Properties["WebkitLineClamp"]) {
    return this.add("WebkitLineClamp", value);
  }

After

/** Sets `WebkitLineClamp: value`. */
  lineClamp(value: Properties["WebkitLineClamp"]) {
    return this.add("WebkitLineClamp", value) // default def
    .add("overflow", "hidden").add("display", "-webkit-box").add("WebkitBoxOrient","vertical",).add("textOverflow", "ellipsis"); // additional defs
  }

With these changes, lineClamp(value) will have the ability to define additional properties combining to the value param.

Also, added a few tests for packages/truss/src/methods.test.ts

cc @bdow since he's going to use it.

homebound-team-bot commented 5 months ago

:tada: This PR is included in version 1.134.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: