maquina-components 0.7.1 → 0.7.2

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: ca1b928bf464480638e3f7504164a10cfecab249eed3a970dbaaad5a3d5b311a
4
- data.tar.gz: 27998f7d8cdf85c6e49af5b4db527086093149130af50a722105e8970c01838c
3
+ metadata.gz: 870cc289944a0b16196e5e259398cbdabf0ca1dd998bf2a178967898a3d1a57e
4
+ data.tar.gz: db3daba76341084ee6e096fd2186cebdcf594b6faee992be2c9e62e4b5781eed
5
5
  SHA512:
6
- metadata.gz: 8105dbdafd0bbf1f1be19ff9ba7f920f42f79b74703098e4229131b5310fb50cbd7e3ecdbf2af2cecfcd7f2f241f15be247e8592d5534995ed3cba931de50e7e
7
- data.tar.gz: 31286d951a265d58bb22021f625242ce36e612ce9d0fe6a8a8ac3c057d0f845d34ea240ba1d2cf15aa4a87a33be8592bee5e1c8483a26b4bc733b069528ba27e
6
+ metadata.gz: a1934e3230c028e772cbaf0a0276a21fbb6f8ea406e76c355fdfc29587b445619a717a2d7f69a388a65afbcdef5236e59495072192845993a3079c944b0ca59c
7
+ data.tar.gz: 6c29f68c06d96157c4402ff03f1594aac41a748480d464c678bd995d10aa49ba055f759674786d666a1fb8b0f146fc76243a95171b146c88e82aa88d42df644c
@@ -20,11 +20,11 @@
20
20
  accent. Set them to your own blue (or to var(--primary)) if you prefer. */
21
21
  --info: oklch(0.93 0.04 240);
22
22
  --info-foreground: oklch(0.4 0.12 250);
23
+ }
23
24
 
24
- .dark {
25
- --info: oklch(0.34 0.07 250);
26
- --info-foreground: oklch(0.88 0.06 240);
27
- }
25
+ .dark {
26
+ --info: oklch(0.34 0.07 250);
27
+ --info-foreground: oklch(0.88 0.06 240);
28
28
  }
29
29
 
30
30
  /* -------------------------------------------------------------------------
@@ -76,58 +76,61 @@
76
76
  --sidebar-accent-foreground: oklch(0.145 0 0);
77
77
  --sidebar-border: oklch(0.88 0 0);
78
78
  --sidebar-ring: oklch(0.645 0.246 16);
79
+ }
79
80
 
80
- /* Dark Mode */
81
- .dark {
82
- --background: oklch(0.145 0 0);
83
- --foreground: oklch(0.985 0 0);
81
+ /* Dark Mode
82
+ Put the `dark` class on <html>. This block must stay at the top level: nested
83
+ inside :root it compiles to `:root .dark`, which never matches <html> itself,
84
+ and the @theme bindings below resolve against <html>. */
85
+ .dark {
86
+ --background: oklch(0.145 0 0);
87
+ --foreground: oklch(0.985 0 0);
84
88
 
85
- --card: oklch(0.205 0 0);
86
- --card-foreground: oklch(0.985 0 0);
89
+ --card: oklch(0.205 0 0);
90
+ --card-foreground: oklch(0.985 0 0);
87
91
 
88
- --popover: oklch(0.269 0 0);
89
- --popover-foreground: oklch(0.985 0 0);
92
+ --popover: oklch(0.269 0 0);
93
+ --popover-foreground: oklch(0.985 0 0);
90
94
 
91
- --primary: oklch(0.712 0.194 13);
92
- --primary-foreground: oklch(0.15 0.052 13);
95
+ --primary: oklch(0.712 0.194 13);
96
+ --primary-foreground: oklch(0.15 0.052 13);
93
97
 
94
- --secondary: oklch(0.269 0 0);
95
- --secondary-foreground: oklch(0.985 0 0);
98
+ --secondary: oklch(0.269 0 0);
99
+ --secondary-foreground: oklch(0.985 0 0);
96
100
 
97
- --muted: oklch(0.269 0 0);
98
- --muted-foreground: oklch(0.708 0 0);
101
+ --muted: oklch(0.269 0 0);
102
+ --muted-foreground: oklch(0.708 0 0);
99
103
 
100
- --accent: oklch(0.371 0 0);
101
- --accent-foreground: oklch(0.985 0 0);
104
+ --accent: oklch(0.371 0 0);
105
+ --accent-foreground: oklch(0.985 0 0);
102
106
 
103
- --success: oklch(0.32 0.06 168);
104
- --success-foreground: oklch(0.82 0.06 168);
107
+ --success: oklch(0.32 0.06 168);
108
+ --success-foreground: oklch(0.82 0.06 168);
105
109
 
106
- --warning: oklch(0.36 0.06 55);
107
- --warning-foreground: oklch(0.86 0.06 55);
110
+ --warning: oklch(0.36 0.06 55);
111
+ --warning-foreground: oklch(0.86 0.06 55);
108
112
 
109
- --destructive: oklch(0.34 0.07 8);
110
- --destructive-foreground: oklch(0.88 0.06 8);
113
+ --destructive: oklch(0.34 0.07 8);
114
+ --destructive-foreground: oklch(0.88 0.06 8);
111
115
 
112
- --border: oklch(1 0 0 / 10%);
113
- --input: oklch(1 0 0 / 15%);
114
- --ring: oklch(0.455 0.188 13);
116
+ --border: oklch(1 0 0 / 10%);
117
+ --input: oklch(1 0 0 / 15%);
118
+ --ring: oklch(0.455 0.188 13);
115
119
 
116
- --chart-1: oklch(0.712 0.194 13);
117
- --chart-2: oklch(0.72 0.09 168);
118
- --chart-3: oklch(0.78 0.09 55);
119
- --chart-4: oklch(0.645 0.246 16);
120
- --chart-5: oklch(0.58 0.13 8);
120
+ --chart-1: oklch(0.712 0.194 13);
121
+ --chart-2: oklch(0.72 0.09 168);
122
+ --chart-3: oklch(0.78 0.09 55);
123
+ --chart-4: oklch(0.645 0.246 16);
124
+ --chart-5: oklch(0.58 0.13 8);
121
125
 
122
- --sidebar: oklch(0.14 0 0);
123
- --sidebar-foreground: oklch(0.9 0 0);
124
- --sidebar-primary: oklch(0.712 0.194 13);
125
- --sidebar-primary-foreground: oklch(0.15 0.052 13);
126
- --sidebar-accent: oklch(0.22 0 0);
127
- --sidebar-accent-foreground: oklch(0.95 0 0);
128
- --sidebar-border: oklch(1 0 0 / 12%);
129
- --sidebar-ring: oklch(0.455 0.188 13);
130
- }
126
+ --sidebar: oklch(0.14 0 0);
127
+ --sidebar-foreground: oklch(0.9 0 0);
128
+ --sidebar-primary: oklch(0.712 0.194 13);
129
+ --sidebar-primary-foreground: oklch(0.15 0.052 13);
130
+ --sidebar-accent: oklch(0.22 0 0);
131
+ --sidebar-accent-foreground: oklch(0.95 0 0);
132
+ --sidebar-border: oklch(1 0 0 / 12%);
133
+ --sidebar-ring: oklch(0.455 0.188 13);
131
134
  }
132
135
 
133
136
  /* Tailwind Theme Bindings
@@ -57,6 +57,10 @@ module MaquinaComponents
57
57
  RADIUS_DECL = /(?:border-radius\s*:|@apply[^;{}]*\brounded(?:-[a-z0-9\[\].\/-]+)?\b)/
58
58
  SHADOW_DECL = /(?:box-shadow\s*:|@apply[^;{}]*\b(?:shadow|ring)(?:-[a-z0-9\[\].\/-]+)?\b)/
59
59
  FOCUS_SELECTOR = /:focus(-visible|-within)?\b/
60
+ # A bare `.dark` in a selector list; `&.dark` (which compiles to :root.dark)
61
+ # is fine and does not match.
62
+ BARE_DARK_SELECTOR = /(?:\A|,)\s*\.dark\s*(?:,|\z)/
63
+ ROOT_SELECTOR = /\A(?::root|html)\z/
60
64
 
61
65
  # 0.7.1 -----------------------------------------------------------------
62
66
  # The destructive pair plus the surface it lands on, read out of a host
@@ -196,7 +200,10 @@ module MaquinaComponents
196
200
  selector = buffer.strip
197
201
  buffer = +""
198
202
  at_rule = selector.start_with?("@")
199
- check_selector(path, index, selector, in_layer?(stack)) unless at_rule
203
+ unless at_rule
204
+ check_selector(path, index, selector, in_layer?(stack))
205
+ check_nested_dark(path, index, selector, stack)
206
+ end
200
207
  stack.push(selector)
201
208
  when "}"
202
209
  check_declaration(path, index, buffer.strip, stack)
@@ -281,6 +288,24 @@ module MaquinaComponents
281
288
  end
282
289
  end
283
290
 
291
+ # `.dark` nested in `:root` compiles to `:root .dark`, a descendant of
292
+ # <html>, so `<html class="dark">` never matches it. And the @theme
293
+ # bindings resolve against <html>, so moving the class to <body> does not
294
+ # help either: dark mode silently never applies. The 0.7.1 installer
295
+ # shipped its palette this way.
296
+ def check_nested_dark(path, index, selector, stack)
297
+ return unless BARE_DARK_SELECTOR.match?(selector)
298
+ return unless stack.any? { |ancestor| ROOT_SELECTOR.match?(ancestor) }
299
+
300
+ add(path, index, selector, :breaking, "nested-dark-block",
301
+ "This .dark block is nested inside :root, so it compiles to `:root .dark` and\n" \
302
+ "never matches <html class=\"dark\">: dark mode does not apply. Move it out to\n" \
303
+ "the top level, after the closing brace of :root:\n" \
304
+ " :root { ... }\n" \
305
+ " .dark { ... }",
306
+ "0.7.2")
307
+ end
308
+
284
309
  # Checks that read the same in CSS, ERB and JS.
285
310
  def scan_shared(path, index, line)
286
311
  if PRESENCE_ACTIVE.match?(line)
@@ -1,3 +1,3 @@
1
1
  module MaquinaComponents
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maquina-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Alberto Chávez