Skip to content

Commit

Permalink
feat: add text opacity plugin support
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed May 22, 2023
1 parent 4af7e7a commit 64d5f32
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions crates/tailwind-parse/src/eval/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ pub fn transform_origin<'a>(Value(rest): &Value, _theme: &'a TailwindTheme) -> P
}
}

lookup_plugin!(text_opacity, opacity, "--tw-text-opacity");

pub fn text<'a>(
value: &SubjectValue,
theme: &'a TailwindTheme,
Expand Down
4 changes: 3 additions & 1 deletion crates/tailwind-parse/src/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ impl<'a> Literal<'a> {
use crate::Min;
use crate::Plugin::*;
use crate::Ring;
use crate::Text;
use PluginType::*;

let plugin = match self.cmd {
Expand Down Expand Up @@ -143,7 +144,8 @@ impl<'a> Literal<'a> {
Auto(Auto::Rows) => RequiredArbitrary(plugin::auto_rows),

// all other plugins
Text => RequiredArbitraryTransparency(plugin::text),
Text(None) => RequiredArbitraryTransparency(plugin::text),
Text(Some(Text::Opacity)) => Required(plugin::text_opacity),
Font => Required(plugin::font),
Shadow => Optional(plugin::shadow),
Transition => Optional(plugin::transition),
Expand Down
7 changes: 6 additions & 1 deletion crates/tailwind-parse/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ mod plugin {
TransformOrigin,
Mb,
Z,
Text,
Text(Option<Text>),
Accent,
Caret,
Bg,
Expand Down Expand Up @@ -140,6 +140,11 @@ mod plugin {
Not(Not),
}

#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum Text {
Opacity,
}

#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum Scroll {
Auto,
Expand Down

0 comments on commit 64d5f32

Please sign in to comment.