Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency twin.macro to v3 #547

Closed
wants to merge 1 commit into from
Closed

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 9, 2022

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
twin.macro 2.8.1 -> 3.4.1 age adoption passing confidence

Release Notes

ben-rogerson/twin.macro (twin.macro)

v3.4.1

Compare Source

v3.4.0

Compare Source

New preset

Not a fan of the virtual dom?
Try Twin's new SolidJS preset 🎉

Read more at #​817

More updates
  • Styled components v6 support added #​818
  • Escape selectors containing forward slashes #​816
  • Allow grabbing values containing a decimal with theme #​815

v3.3.1

Compare Source

Note: Twin will now autoload a tailwind.config.ts config file if found when a tailwind.config.[.js/.cjs] doesn't exist.

// tailwind.config.ts
// generate with: `npx tailwindcss init --ts`

import type { Config } from 'tailwindcss'

export default {
  content: ['*'],
  theme: {
    extend: {},
  },
  plugins: [],
} satisfies Config
// tailwind.config.js
// generate with: `npx tailwindcss init --esm`

/** @​type {import('tailwindcss').Config} */
export default {
  content: ['*'],
  theme: {
    extend: {},
  },
  plugins: [],
}
// Classic tailwind.config.js for comparison
// generate with: `npx tailwindcss init`

/** @​type {import('tailwindcss').Config} */
module.exports = {
  content: ['*'],
  theme: {
    extend: {},
  },
  plugins: [],
}

v3.3.0: v3.3

Compare Source

🎉 This version adds support for [email protected] - enjoy!

Read the official tailwind release notes for info on all the new goodies.

Install twin and tailwind latest:

npm i -D twin.macro@latest tailwindcss@latest
pnpm i -D twin.macro@latest tailwindcss@latest
yarn add -D twin.macro@latest tailwindcss@latest
Fixed

v3.1.0: v3.1

Compare Source

v3.0.1

Compare Source

This patch contains a fix for stitches:

  • Fixed stitches animation-x classes #​758

And mostly fixes for arbitrary variant usage:

  • Fixed a variant ordering bug when using multiple variants #​759
  • Fixed an error when non-media at-rules were used in arbitrary variants, eg: [@page]:m-0 #​759
  • Fixed comma bug where arbitrary variants aren't visited individually for the auto parent selector #​757
  • Fixed encoding bug in arbitrary variants when a number is added directly after a comma #​757
  • Added error message when incorrect arbitrary variant combination containing commas is used #​757
  • Removed a now unneeded error that notified us to add parent selectors #​759

Reminder: Update tailwind to latest also or you'll probably see a pieces.some is not a function error:

### `[email protected]` requires `tailwindcss@>=3.2.0`
npm i twin.macro@latest tailwindcss@latest

v3.0.0: v3.0: Support for tailwindcss v3.2.2+

Compare Source

Release changes

  • 🌟 Added support for all new classes in Tailwind v3.2+
    Use new variants like aria-xxx, data-xxx and min-xxx - check the official tailwindcss release posts for more info
  • 🌟 Added full Tailwind support for all plugin functions
    It's only taken three versions and a rewrite to achieve and now full plugin support is here!
  • 🌟 Added tailwindcss to peerDependencies
    No more waiting for twin to support new Tailwind features, just update tailwindcss
  • Improved style de-caching after adjusting values in tailwind.config.js https://github.com/ben-rogerson/twin.macro/pull/693
  • Added additional not- versions of many common variants, eg: not-empty:,:not-focus:,:not-required: ref
  • When working in a sub directory within a monorepo, twin will now look upwards for a missing tailwind.config.js
    https://github.com/ben-rogerson/twin.macro/pull/693/693
  • A tailwind config object can now be passed in via config - more at docs/config
  • tailwind.config.cjs has been added as a fallback ben-rogerson/twin.macro@9e7a7df
  • Added support for the important ! prefix on groups, eg: first:!(block mt-5)
  • New twin config option: hasLogColors: false to remove log coloring ben-rogerson/twin.macro@bbaec9d

Container queries

The new tailwind-container-queries plugin works with twin but there are some browser and version requirements:

Update notes

  • Twin config option debugPlugins was removed and rolled into another existing option: debug: true
  • Class ordering has been synced with tailwindcss
  • container has been aligned with tailwind - no longer has a custom margin value
Short Css deprecated

Twins custom "short css" has been deprecated in favour of Tailwind arbitrary properties:

tw`backgroundColor[red]` // short css (no dash next to the `[`)
tw`[backgroundColor:red]` // Updated to an arbitrary property
Emotion error: Value for 'content' without quotes

In Emotion, using before: or after: variants may trigger a console error like this:

You seem to be using a value for 'content' without quotes, try replacing it with `content: '"var(--tw-content)"'`

Update one or both of the packages below to avoid this error (version is when error was fixed):

Arbitrary variants/properties without parent selectors

In arbitrary variants/properties without parent selectors, Twin now needs to add the parent selector for you in order to create a compatible class to run through tailwindcss.
If twin miscalculates where the parent selector should be added then you'll need to add the parent selector yourself.

Arbitrary variant escaping

Twin now replaces all spaces with underscores in arbitrary variants, so to keep any underscores in the output we can escape them:

// Bad
<div class="[.header__menu]:block">...</div>
// Good
<div class="[.header\_\_menu]:block">...</div>
General value escaping

Previously in many instances, escaping required a double backslash before the character (\\).
Now we'll only need a single backslash:

tw`after:content-['\a0']`
Theme values/import and DEFAULT

When theme is used within an arbitrary value or property and there is a DEFAULT value found, the theme value will now return the default value automatically:

// tailwind.config.js
module.exports = {
  theme: { colors: { black: { DEFAULT: "redish" } } },
}
// Usage
tw`bg-[theme(colors.black)]` // Arbitrary value
tw`[background-color:theme(colors.black)]` // Arbitrary property
// ↓ ↓ ↓ ↓ ↓ ↓
({ "backgroundColor": "redish" }); // < DEFAULT key returned
({ "backgroundColor": "redish" }); // < DEFAULT key returned

The theme import now won't return the DEFAULT option automatically.
We can still select the DEFAULT value by specifying it, eg: themecolors.black.DEFAULT.
This makes it possible to grab whole objects from the config without automatically returning the DEFAULT value:

// tailwind.config.js
module.exports = {
  theme: { colors: { black: { DEFAULT: "redish", another: 'greenish' } } },
}

// Usage
import { theme } from 'twin.macro'
theme`colors.black`
// ↓ ↓ ↓ ↓ ↓ ↓
// Whole object returned
({
  "DEFAULT": "redish",
  "another": "greenish"
});
Daisy UI tailwind plugin

DaisyUI often styles their components based on classNames, eg: .btn.loading { ... }
This means in some situations we have to add classNames to the jsx element to add their modifier styling

Some discussion here and at #​760

Vite build issue

If you're noticing build issues after upgrading, try updating your Vite config with the updated build target:

optimizeDeps: {
  esbuildOptions: {
    target: "es2020",
  },
},

Support

If you’re kicking ass with twin - especially if you’re in a team - then please consider supporting this project.
It will really help out with the continued development of twin - cheers! 🍻

Thanks

A huge thanks and shout out to all the rc contributors helping with features, fixes and bug testing over the past year - you folks are awesome 👋🙏

@​omaemae, @​ChrisEbert, @​Macksi, @​atxiii, @​mohammadsiyou, @​MatthiasDunker, @​lguima, @​EduardoBautista, @​HaidarEzio, @​ajmnz

Full Changelog: ben-rogerson/twin.macro@2.8.2...3.0.0

v2.8.2

Compare Source

This patch contains a few changes for those using the styled-components preset.

⚠️ Possible breaking changes

  • Remove auto css prop
    The css prop can now be added with babel-plugin-styled-components - Setup info →
  • Tweak the styled import preset
    The default import was changed from import "styled-components/macro" to import "styled-components" - More info →

Edit: Try the new rc with the latest changes npm i twin.macro@rc


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch 5 times, most recently from ba6272e to 1875d41 Compare November 15, 2022 02:55
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch 6 times, most recently from 716e634 to 96dfd85 Compare November 23, 2022 09:32
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch 5 times, most recently from 417ed75 to e139767 Compare December 5, 2022 16:03
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch 8 times, most recently from fea708a to 65b9c92 Compare December 12, 2022 23:40
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch 5 times, most recently from 9b51158 to ae1c40c Compare December 22, 2022 13:07
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch 6 times, most recently from 4773c0a to 8eaa5b1 Compare January 16, 2023 22:52
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch 4 times, most recently from b18b3e3 to 314fd08 Compare January 25, 2023 13:00
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch 3 times, most recently from 43fc760 to 11fb3fa Compare January 31, 2023 15:47
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch 6 times, most recently from ca6bd1b to 2b002d3 Compare February 14, 2023 00:06
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch 3 times, most recently from 0ff38cd to ca7a41d Compare February 23, 2023 18:23
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch 2 times, most recently from 038499d to e950720 Compare February 27, 2023 22:54
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch from e950720 to d29e4a2 Compare May 22, 2024 06:38
@renovate renovate bot force-pushed the renovate/twin.macro-3.x branch from d29e4a2 to beb5107 Compare May 22, 2024 07:49
@k4y4k k4y4k closed this Aug 2, 2024
Copy link
Contributor Author

renovate bot commented Aug 2, 2024

Renovate Ignore Notification

Because you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future 3.x releases. But if you manually upgrade to 3.x then Renovate will re-enable minor and patch updates automatically.

If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.

@renovate renovate bot deleted the renovate/twin.macro-3.x branch August 2, 2024 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant