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 +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/daisy_ui/tailwind/candidate.rb +38 -3
- data/lib/daisy_ui/updated_at.rb +1 -1
- data/lib/daisy_ui/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6b5e9f54e5ef6670c715b8b23b7f25e2143b5dff828a17df64cd1c937cd8ea5a
|
|
4
|
+
data.tar.gz: 0ddd4bbef303e8fbbed5248317e107755cd96205ed8acb1e6b5e50b35505ad5c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
10
|
-
#
|
|
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]/) &&
|
|
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
|
data/lib/daisy_ui/updated_at.rb
CHANGED
data/lib/daisy_ui/version.rb
CHANGED