daisyui 2.2.0 → 2.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1bf5647c845ed4fbdf7d538e4934c7171b23039cbc9029d8c68330b82f0acd2
4
- data.tar.gz: 9282c494a1db396b4153fda3c9696040e8c95ac7d495d0bbcf9a0be983a49fb1
3
+ metadata.gz: 6b5e9f54e5ef6670c715b8b23b7f25e2143b5dff828a17df64cd1c937cd8ea5a
4
+ data.tar.gz: 0ddd4bbef303e8fbbed5248317e107755cd96205ed8acb1e6b5e50b35505ad5c
5
5
  SHA512:
6
- metadata.gz: f2fa7469a01b18c4bb28110ab4da1238ce8c846fef910e3edc488d283ed641e8cee5fb3b2fb69ca528f643283a1339114db14354a0f3d0d306b67f996923e4d8
7
- data.tar.gz: 282f9add88cc7e82eabd013b81bb4e1470c8809f6687ada460470ef97a472d228182154f644c56a7df000f4714dd8d51eca4bbc5692f5ddbbdba7607e84617f4
6
+ metadata.gz: f0f500a23192a07122b72795bb10c391ac5541d35ab6c5e168d73a8cac84070b46fbfd68de149c4fe4d2e01263c449c903c0172732a4b0245b0083f39f0f234f
7
+ data.tar.gz: d9f72b8aa71f1289efbfc83c7763fe3be6ce9e71b1a9b07ecf8a63c157228772031128eb665e2cf6eefe28c3f30119d5e03d19961f57c00ed88a76e1270b201a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ### Fixed
4
+
5
+ - The Tailwind sources generator accepts named groups and peers
6
+ (`group/item`, `group-has-[…]/item:block`, `peer-checked/field:block`) and a
7
+ plugin utility's named modifier (`motion-ease-in-out/opacity`) instead of
8
+ raising on them as paths. A bare word before the `/` (`app/components`) and a
9
+ second `/` (`lib/daisy_ui/base.rb`) are still rejected (#71).
10
+
11
+ ## [2.2.0] - 2026-10-26
12
+
3
13
  ### Documentation for the variants API
4
14
 
5
15
  - Docs site: "Variants, states and slots" (when to use `variant`, `flag`,
@@ -6,18 +6,24 @@ module DaisyUI
6
6
  # quoted string with brace expansion, and one unbalanced bracket in it
7
7
  # makes Tailwind drop every class after it, so a candidate starts and ends
8
8
  # like a utility or variant, has balanced () and [], and holds no quote,
9
- # brace, semicolon, backslash or backtick. A `/` only introduces a
10
- # fraction or an opacity (`w-1/2`, `bg-base-100/50`), never a path.
9
+ # brace, semicolon, backslash or backtick.
10
+ #
11
+ # A `/` before a digit or `[` is a fraction or an opacity (`w-1/2`,
12
+ # `bg-base-100/50`). A `/` before anything else is a path, except one
13
+ # trailing `/<name>` on a variant or utility: a named group or peer
14
+ # (`group/item`, `group-hover/item:underline`, `peer-checked/field:block`)
15
+ # or a plugin utility's named modifier (`motion-ease-in-out/opacity`).
11
16
  #
12
17
  # @api private
13
18
  module Candidate
14
19
  SHAPE = /\A[a-z@!\[*-][^\s"'`;{}\\]*[a-z0-9\])%!]\z/
15
20
  PATH = %r{/(?![0-9\[])}
21
+ NAMED = %r{\A(?<head>.+)/[A-Za-z0-9_-]+!?\z}
16
22
  CLOSING = { ")" => "(", "]" => "[" }.freeze
17
23
 
18
24
  class << self
19
25
  def valid?(token)
20
- SHAPE.match?(token) && token.match?(/[a-z]/) && !PATH.match?(token) && balanced?(token)
26
+ SHAPE.match?(token) && token.match?(/[a-z]/) && balanced?(token) && !paths?(token)
21
27
  end
22
28
 
23
29
  # The candidates among the whitespace-separated words of `classes`.
@@ -38,6 +44,35 @@ module DaisyUI
38
44
  end
39
45
  open.empty?
40
46
  end
47
+
48
+ def paths?(token)
49
+ parts(token).any? { |part| path?(part) }
50
+ end
51
+
52
+ def path?(part)
53
+ return false unless PATH.match?(part)
54
+
55
+ head = part[NAMED, :head]
56
+ head.nil? || PATH.match?(head) || !named?(head)
57
+ end
58
+
59
+ # What may carry a `/<name>`: a group or a peer, or a utility with a
60
+ # `-` in it. A bare word (`app`, `vendor`, `hover`) is a directory.
61
+ def named?(head)
62
+ %w[group peer].include?(head) || (head.include?("-") && SHAPE.match?(head))
63
+ end
64
+
65
+ # The token split on its top-level `:`, as Tailwind splits variants
66
+ # from the utility; a `:` inside [] or () belongs to its part.
67
+ def parts(token)
68
+ depth = 0
69
+ slices = token.each_char.slice_when do |char, _|
70
+ depth += 1 if "[(".include?(char)
71
+ depth -= 1 if "])".include?(char)
72
+ char == ":" && depth.zero?
73
+ end
74
+ slices.map { |chars| chars.join.delete_suffix(":") }
75
+ end
41
76
  end
42
77
  end
43
78
  end
@@ -3,5 +3,5 @@
3
3
  module DaisyUI
4
4
  # This timestamp is automatically updated when releasing a new version
5
5
  # Format: YYYY-MM-DD HH:MM:SS UTC
6
- UPDATED_AT = "2026-10-26 18:45:50 UTC"
6
+ UPDATED_AT = "2026-10-27 04:51:27 UTC"
7
7
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DaisyUI
4
- VERSION = "2.2.0"
4
+ VERSION = "2.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daisyui
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson